diff --git a/CMakeLists.txt b/CMakeLists.txt index 09d96051..11abb4c3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,15 @@ project(Plasma) cmake_minimum_required(VERSION 2.8) +# HeadSpin Configuration +if(WIN32 AND NOT CYGWIN) + add_definitions(-DHS_BUILD_FOR_WIN32) +endif(WIN32 AND NOT CYGWIN) +if(UNIX) + add_definitions(-DHS_BUILD_FOR_UNIX) +endif(UNIX) +# End HeadSpin Configuration + set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake") SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${Plasma_BINARY_DIR}/bin) @@ -42,6 +51,10 @@ set(PLASMA_TARGETS "Client" set_property(CACHE PLASMA_TARGETS PROPERTY STRINGS "Client" "Server" "Patcher" "Ethereal" "NoAvMsgs") +if(PLASMA_TARGETS STREQUAL "Client") + add_definitions(-DCLIENT) +endif(PLASMA_TARGETS STREQUAL "Client") + if(PLASMA_TARGETS STREQUAL "Patcher") add_definitions(-DPATCHER) endif(PLASMA_TARGETS STREQUAL "Patcher") diff --git a/Sources/Plasma/Apps/plClient/CMakeLists.txt b/Sources/Plasma/Apps/plClient/CMakeLists.txt index 46c230f5..5f28cf8c 100644 --- a/Sources/Plasma/Apps/plClient/CMakeLists.txt +++ b/Sources/Plasma/Apps/plClient/CMakeLists.txt @@ -71,7 +71,6 @@ if(PLASMA_EXTERNAL_RELEASE) set_target_properties(plClient PROPERTIES OUTPUT_NAME "UruExplorer") endif(PLASMA_EXTERNAL_RELEASE) target_link_libraries(plClient CoreLib) -target_link_libraries(plClient CoreLibExe) target_link_libraries(plClient pfAnimation) target_link_libraries(plClient pfAudio) target_link_libraries(plClient pfCamera) diff --git a/Sources/Plasma/Apps/plClient/plAllCreatables.cpp b/Sources/Plasma/Apps/plClient/plAllCreatables.cpp index 89b05509..4bc4b3e5 100644 --- a/Sources/Plasma/Apps/plClient/plAllCreatables.cpp +++ b/Sources/Plasma/Apps/plClient/plAllCreatables.cpp @@ -39,5 +39,5 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com Mead, WA 99021 *==LICENSE==*/ -#include "hsWindows.h" + #include "plAllCreatables.h" diff --git a/Sources/Plasma/Apps/plClient/plClient.cpp b/Sources/Plasma/Apps/plClient/plClient.cpp index 283feaed..7a90dc88 100644 --- a/Sources/Plasma/Apps/plClient/plClient.cpp +++ b/Sources/Plasma/Apps/plClient/plClient.cpp @@ -41,8 +41,6 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ #pragma warning(disable: 4284) #include "HeadSpin.h" -#include "hsTypes.h" -#include "hsWindowHndl.h" #include "plClient.h" #include "hsStream.h" #include "plResMgr/plResManager.h" @@ -164,7 +162,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #define MSG_LOADING_BAR -// static hsVector3 gAbsDown(0,0,-hsScalar1); +// static hsVector3 gAbsDown(0,0,-1.f); static plDispatchBase* gDisp = nil; static plTimerCallbackManager* gTimerMgr = nil; @@ -224,14 +222,14 @@ plClient::plClient() /// allow console commands to start working early // Create the console engine - fConsoleEngine = TRACKED_NEW pfConsoleEngine(); + fConsoleEngine = new pfConsoleEngine(); // create network mgr before console runs - plNetClientMgr::SetInstance(TRACKED_NEW plNetClientMgr); - plAgeLoader::SetInstance(TRACKED_NEW plAgeLoader); + plNetClientMgr::SetInstance(new plNetClientMgr); + plAgeLoader::SetInstance(new plAgeLoader); // Use it to parse the init directory - wchar initFolder[MAX_PATH]; + wchar_t initFolder[MAX_PATH]; PathGetInitDirectory(initFolder, arrsize(initFolder)); pfConsoleDirSrc dirSrc( fConsoleEngine, initFolder, L"*.ini" ); @@ -276,7 +274,7 @@ hsBool plClient::Shutdown() plBinkPlayer::DeInit(); // // Get any proxies to commit suicide. - plProxyDrawMsg* nuke = TRACKED_NEW plProxyDrawMsg(plProxyDrawMsg::kAllTypes + plProxyDrawMsg* nuke = new plProxyDrawMsg(plProxyDrawMsg::kAllTypes | plProxyDrawMsg::kDestroy); plgDispatch::MsgSend(nuke); @@ -449,17 +447,17 @@ void plClient::InitAuxInits() void plClient::InitInputs() { hsStatusMessage("InitInputs client\n"); - fInputManager = TRACKED_NEW plInputManager( fWindowHndl ); + fInputManager = new plInputManager( fWindowHndl ); fInputManager->CreateInterfaceMod(fPipeline); fInputManager->RegisterAs( kInput_KEY ); plgDispatch::Dispatch()->RegisterForExactType(plIMouseXEventMsg::Index(), fInputManager->GetKey()); plgDispatch::Dispatch()->RegisterForExactType(plIMouseYEventMsg::Index(), fInputManager->GetKey()); plgDispatch::Dispatch()->RegisterForExactType(plIMouseBEventMsg::Index(), fInputManager->GetKey()); plgDispatch::Dispatch()->RegisterForExactType(plEvalMsg::Index(), fInputManager->GetKey()); - plInputDevice* pKeyboard = TRACKED_NEW plKeyboardDevice(); + plInputDevice* pKeyboard = new plKeyboardDevice(); fInputManager->AddInputDevice(pKeyboard); - plInputDevice* pMouse = TRACKED_NEW plMouseDevice(); + plInputDevice* pMouse = new plMouseDevice(); fInputManager->AddInputDevice(pMouse); if( fWindowActive ) @@ -469,7 +467,7 @@ void plClient::InitInputs() void plClient::ISetGraphicsDefaults() { // couldn't find display mode set defaults write to ini file - wchar graphicsIniFile[MAX_PATH]; + wchar_t graphicsIniFile[MAX_PATH]; PathGetInitDirectory(graphicsIniFile, arrsize(graphicsIniFile)); PathAddFilename(graphicsIniFile, graphicsIniFile, L"graphics.ini", arrsize(graphicsIniFile)); IWriteDefaultGraphicsSettings(graphicsIniFile); @@ -571,7 +569,7 @@ hsBool plClient::InitPipeline() float yon = 500.0f; - pipe->SetFOV( 60.f, hsIntToScalar( 60.f * pipe->Height() / pipe->Width() ) ); + pipe->SetFOV( 60.f, int32_t( 60.f * pipe->Height() / pipe->Width() ) ); pipe->SetDepth( 0.3f, yon ); hsMatrix44 id; @@ -793,7 +791,7 @@ hsBool plClient::MsgReceive(plMessage* msg) plAudible* aud = plAudible::ConvertNoRef(callback->GetSender()->ObjectIsLoaded()); if( simpMod ) { - plAnimCmdMsg* cmd = TRACKED_NEW plAnimCmdMsg; + plAnimCmdMsg* cmd = new plAnimCmdMsg; cmd->AddReceiver(simpMod->GetKey()); cmd->SetCmd(plAnimCmdMsg::kRemoveCallbacks); cmd->AddCallback(callback); @@ -802,7 +800,7 @@ hsBool plClient::MsgReceive(plMessage* msg) } else if( aud ) { - plSoundMsg* cmd = TRACKED_NEW plSoundMsg; + plSoundMsg* cmd = new plSoundMsg; cmd->AddReceiver(aud->GetKey()); cmd->SetCmd(plSoundMsg::kRemoveCallbacks); cmd->AddCallback(callback); @@ -892,7 +890,7 @@ hsBool plClient::IHandleMovieMsg(plMovieMsg* mov) if( i == fMovies.GetCount() ) { - fMovies.Append(TRACKED_NEW plBinkPlayer); + fMovies.Append(new plBinkPlayer); fMovies[i]->SetFileName(mov->GetFileName()); } @@ -989,7 +987,7 @@ void plClient::IQueueRoomLoad(const std::vector& locs, bool hold) bool allSameAge = true; const char* lastAgeName = nil; - UInt32 numRooms = 0; + uint32_t numRooms = 0; for (int i = 0; i < locs.size(); i++) { const plLocation& loc = locs[i]; @@ -1011,7 +1009,7 @@ void plClient::IQueueRoomLoad(const std::vector& locs, bool hold) continue; } - fLoadRooms.push_back(TRACKED_NEW LoadRequest(loc, hold)); + fLoadRooms.push_back(new LoadRequest(loc, hold)); if (!lastAgeName || hsStrEQ(info->GetAge(), lastAgeName)) lastAgeName = info->GetAge(); @@ -1051,7 +1049,7 @@ void plClient::ILoadNextRoom() if (req) { - plClientRefMsg* pRefMsg = TRACKED_NEW plClientRefMsg(GetKey(), + plClientRefMsg* pRefMsg = new plClientRefMsg(GetKey(), plRefMsg::kOnCreate, -1, req->hold ? plClientRefMsg::kLoadRoomHold : plClientRefMsg::kLoadRoom); @@ -1063,7 +1061,7 @@ void plClient::ILoadNextRoom() delete req; - plClientMsg* nextRoom = TRACKED_NEW plClientMsg(plClientMsg::kLoadNextRoom); + plClientMsg* nextRoom = new plClientMsg(plClientMsg::kLoadNextRoom); nextRoom->Send(GetKey()); } } @@ -1108,7 +1106,7 @@ void plClient::IUnloadRooms(const std::vector& locs) } GetKey()->Release(nodeKey); // release notify interest in scene node - UInt32 recFlags = 0; + uint32_t recFlags = 0; if (roomIdx != -1) { recFlags = fRooms[roomIdx].fFlags; @@ -1237,7 +1235,7 @@ void plClient::IRoomLoaded(plSceneNode* node, bool hold) // now tell all those who are interested that a room was loaded if (!hold) { - plRoomLoadNotifyMsg* loadmsg = TRACKED_NEW plRoomLoadNotifyMsg; + plRoomLoadNotifyMsg* loadmsg = new plRoomLoadNotifyMsg; loadmsg->SetRoom(pRmKey); loadmsg->SetWhatHappen(plRoomLoadNotifyMsg::kLoaded); plgDispatch::MsgSend(loadmsg); @@ -1273,7 +1271,7 @@ void plClient::IRoomUnloaded(plSceneNode* node) plAgeLoader::GetInstance()->FinishedPagingOutRoom(&pRmKey, 1); // tell all those who are interested that a room was unloaded - plRoomLoadNotifyMsg* loadmsg = TRACKED_NEW plRoomLoadNotifyMsg; + plRoomLoadNotifyMsg* loadmsg = new plRoomLoadNotifyMsg; loadmsg->SetRoom(pRmKey); loadmsg->SetWhatHappen(plRoomLoadNotifyMsg::kUnloaded); plgDispatch::MsgSend(loadmsg); @@ -1295,7 +1293,7 @@ void plClient::IProgressMgrCallbackProc(plOperationProgress * progress) } //============================================================================ -void plClient::IIncProgress (hsScalar byHowMuch, const char * text) +void plClient::IIncProgress (float byHowMuch, const char * text) { if (fProgressBar) { #ifndef PLASMA_EXTERNAL_RELEASE @@ -1306,7 +1304,7 @@ void plClient::IIncProgress (hsScalar byHowMuch, const char * text) } //============================================================================ -void plClient::IStartProgress( const char *title, hsScalar len ) +void plClient::IStartProgress( const char *title, float len ) { if (fProgressBar) { @@ -1375,11 +1373,11 @@ public: LoginNetClientCommCallback() : plNetClientComm::Callback(), fNumCurrentOps(0) {} - virtual void OperationStarted( UInt32 context ) + virtual void OperationStarted( uint32_t context ) { fNumCurrentOps++; } - virtual void OperationComplete( UInt32 context, int resultCode ) + virtual void OperationComplete( uint32_t context, int resultCode ) { if (context == kAuth) { @@ -1392,14 +1390,14 @@ public: { if ( hsSucceeded( resultCode ) ) { - UInt32 numPlayers = fCbArgs.GetInt(0); - UInt32 pId = -1; + uint32_t numPlayers = fCbArgs.GetInt(0); + uint32_t pId = -1; std::string pName; - for (UInt32 i = 0; i < numPlayers; i++) + for (uint32_t i = 0; i < numPlayers; i++) { - pId = fCbArgs.GetInt((UInt16)(i*3+1)); - pName = fCbArgs.GetString((UInt16)(i*3+2)); + pId = fCbArgs.GetInt((uint16_t)(i*3+1)); + pName = fCbArgs.GetString((uint16_t)(i*3+2)); if (pName == plClient::GetInstance()->fUsername) { @@ -1473,7 +1471,7 @@ hsBool plClient::StartInit() InitDLLs(); plGlobalVisMgr::Init(); - fPageMgr = TRACKED_NEW plPageTreeMgr; + fPageMgr = new plPageTreeMgr; plVisLOSMgr::Init(fPipeline, fPageMgr); @@ -1493,32 +1491,32 @@ hsBool plClient::StartInit() /// Note: this can be done last because the console engine was inited first, and /// everything in code that works with the console does so through the console engine - fConsole = TRACKED_NEW pfConsole(); + fConsole = new pfConsole(); pfConsole::SetPipeline( fPipeline ); fConsole->RegisterAs( kConsoleObject_KEY ); // fixedKey from plFixedKey.h fConsole->Init( fConsoleEngine ); /// Init the font cache - fFontCache = TRACKED_NEW plFontCache(); + fFontCache = new plFontCache(); /// Init the transition manager - fTransitionMgr = TRACKED_NEW plTransitionMgr(); + fTransitionMgr = new plTransitionMgr(); fTransitionMgr->RegisterAs( kTransitionMgr_KEY ); // fixedKey from plFixedKey.h fTransitionMgr->Init(); // Init the Age Linking effects manager - fLinkEffectsMgr = TRACKED_NEW plLinkEffectsMgr(); + fLinkEffectsMgr = new plLinkEffectsMgr(); fLinkEffectsMgr->RegisterAs( kLinkEffectsMgr_KEY ); // fixedKey from plFixedKey.h fLinkEffectsMgr->Init(); /// Init the in-game GUI manager - fGameGUIMgr = TRACKED_NEW pfGameGUIMgr(); + fGameGUIMgr = new pfGameGUIMgr(); fGameGUIMgr->RegisterAs( kGameGUIMgr_KEY ); fGameGUIMgr->Init(); plgAudioSys::Activate(true); - plConst(hsScalar) delay(2.f); + plConst(float) delay(2.f); //commenting out publisher splash for MORE //IPlayIntroBink("avi/intro0.bik", delay, 0.f, 0.f, 1.f, 1.f, 0.75); //if( GetDone() ) return false; @@ -1534,14 +1532,14 @@ hsBool plClient::StartInit() plAgeLoader::GetInstance()->Init(); pfSecurePreloader::GetInstance()->Init(); - plCmdIfaceModMsg* pModMsg2 = TRACKED_NEW plCmdIfaceModMsg; + plCmdIfaceModMsg* pModMsg2 = new plCmdIfaceModMsg; pModMsg2->SetBCastFlag(plMessage::kBCastByExactType); pModMsg2->SetSender(fConsole->GetKey()); pModMsg2->SetCmd(plCmdIfaceModMsg::kAdd); plgDispatch::MsgSend(pModMsg2); // create new the virtual camera - fNewCamera = TRACKED_NEW plVirtualCam1; + fNewCamera = new plVirtualCam1; fNewCamera->RegisterAs( kVirtualCamera1_KEY ); fNewCamera->Init(); fNewCamera->SetPipeline( GetPipeline() ); @@ -1555,7 +1553,7 @@ hsBool plClient::StartInit() plInputManager::SetRecenterMouse(false); // create the listener for the audio system: - plListener* pLMod = TRACKED_NEW plListener; + plListener* pLMod = new plListener; pLMod->RegisterAs(kListenerMod_KEY ); plgDispatch::Dispatch()->RegisterForExactType(plEvalMsg::Index(), pLMod->GetKey()); @@ -1565,7 +1563,7 @@ hsBool plClient::StartInit() if (StrCmp(NetCommGetStartupAge()->ageDatasetName, "StartUp") == 0) { - plNetCommAuthMsg * msg = NEW(plNetCommAuthMsg); + plNetCommAuthMsg * msg = new plNetCommAuthMsg(); msg->result = kNetSuccess; msg->param = nil; msg->Send(); @@ -1730,7 +1728,7 @@ hsBool plClient::IUpdate() // Time may have been clamped in IncSysSeconds, depending on hsTimer's current mode. double currTime = hsTimer::GetSysSeconds(); - hsScalar delSecs = hsTimer::GetDelSysSeconds(); + float delSecs = hsTimer::GetDelSysSeconds(); // do not change this ordering @@ -1749,18 +1747,18 @@ hsBool plClient::IUpdate() // starting trouble during their update. So to get rid of this message, some // other way of flushing the dispatch after NegClientMgr's update is needed. mf plProfile_BeginTiming(TimeMsg); - plTimeMsg* msg = TRACKED_NEW plTimeMsg(nil, nil, nil, nil); + plTimeMsg* msg = new plTimeMsg(nil, nil, nil, nil); plgDispatch::MsgSend(msg); plProfile_EndTiming(TimeMsg); plProfile_BeginTiming(EvalMsg); - plEvalMsg* eval = TRACKED_NEW plEvalMsg(nil, nil, nil, nil); + plEvalMsg* eval = new plEvalMsg(nil, nil, nil, nil); plgDispatch::MsgSend(eval); plProfile_EndTiming(EvalMsg); char *xFormLap1 = "Main"; plProfile_BeginLap(TransformMsg, xFormLap1); - plTransformMsg* xform = TRACKED_NEW plTransformMsg(nil, nil, nil, nil); + plTransformMsg* xform = new plTransformMsg(nil, nil, nil, nil); plgDispatch::MsgSend(xform); plProfile_EndLap(TransformMsg, xFormLap1); @@ -1778,7 +1776,7 @@ hsBool plClient::IUpdate() { char *xFormLap2 = "Simulation"; plProfile_BeginLap(TransformMsg, xFormLap2); - xform = TRACKED_NEW plTransformMsg(nil, nil, nil, nil); + xform = new plTransformMsg(nil, nil, nil, nil); plgDispatch::MsgSend(xform); plProfile_EndLap(TransformMsg, xFormLap2); } @@ -1786,7 +1784,7 @@ hsBool plClient::IUpdate() { char *xFormLap3 = "Delayed"; plProfile_BeginLap(TransformMsg, xFormLap3); - xform = TRACKED_NEW plDelayedTransformMsg(nil, nil, nil, nil); + xform = new plDelayedTransformMsg(nil, nil, nil, nil); plgDispatch::MsgSend(xform); plProfile_EndLap(TransformMsg, xFormLap3); } @@ -1794,7 +1792,7 @@ hsBool plClient::IUpdate() plCoordinateInterface::SetTransformPhase(plCoordinateInterface::kTransformPhaseNormal); plProfile_BeginTiming(CameraMsg); - plCameraMsg* cameras = TRACKED_NEW plCameraMsg; + plCameraMsg* cameras = new plCameraMsg; cameras->SetCmd(plCameraMsg::kUpdateCameras); cameras->SetBCastFlag(plMessage::kBCastByExactType); plgDispatch::MsgSend(cameras); @@ -1867,11 +1865,11 @@ hsBool plClient::IDraw() plProfile_EndTiming(VisEval); plProfile_BeginTiming(RenderMsg); - plRenderMsg* rendMsg = TRACKED_NEW plRenderMsg(fPipeline); + plRenderMsg* rendMsg = new plRenderMsg(fPipeline); plgDispatch::MsgSend(rendMsg); plProfile_EndTiming(RenderMsg); - plPreResourceMsg* preMsg = TRACKED_NEW plPreResourceMsg(fPipeline); + plPreResourceMsg* preMsg = new plPreResourceMsg(fPipeline); plgDispatch::MsgSend(preMsg); // This might not be the ideal place for this, but it @@ -1970,7 +1968,7 @@ void plClient::IKillMovies() fMovies.Reset(); } -hsBool plClient::IPlayIntroBink(const char* movieName, hsScalar endDelay, hsScalar posX, hsScalar posY, hsScalar scaleX, hsScalar scaleY, hsScalar volume /* = 1.0 */) +hsBool plClient::IPlayIntroBink(const char* movieName, float endDelay, float posX, float posY, float scaleX, float scaleY, float volume /* = 1.0 */) { SetQuitIntro(false); plBinkPlayer player; @@ -2113,7 +2111,7 @@ hsG3DDeviceModeRecord plClient::ILoadDevMode(const char* devModeFile) /// Read the rest in selMode.Read(&stream); - UInt16 performance = stream.ReadLE16(); + uint16_t performance = stream.ReadLE16(); if( performance < 25 ) plBitmap::SetGlobalLevelChopCount( 2 ); @@ -2147,7 +2145,7 @@ hsG3DDeviceModeRecord plClient::ILoadDevMode(const char* devModeFile) { dmr.GetDevice()->Write(&stream); dmr.GetMode()->Write(&stream); - stream.WriteLE16((UInt16)(0*100)); + stream.WriteLE16((uint16_t)(0*100)); stream.Close(); } @@ -2179,7 +2177,7 @@ void plClient::ResizeDisplayDevice(int Width, int Height, hsBool Windowed) pfGameGUIMgr::GetInstance()->SetAspectRatio( aspectratio ); - UInt32 winStyle, winExStyle; + uint32_t winStyle, winExStyle; if( Windowed ) { winStyle = WS_OVERLAPPEDWINDOW; @@ -2192,8 +2190,8 @@ void plClient::ResizeDisplayDevice(int Width, int Height, hsBool Windowed) SetWindowLong(fWindowHndl, GWL_EXSTYLE, winExStyle); - UInt32 flags = SWP_NOCOPYBITS | SWP_SHOWWINDOW | SWP_FRAMECHANGED; - UInt32 OutsideWidth, OutsideHeight; + uint32_t flags = SWP_NOCOPYBITS | SWP_SHOWWINDOW | SWP_FRAMECHANGED; + uint32_t OutsideWidth, OutsideHeight; HWND insertAfter; if( Windowed ) { @@ -2312,7 +2310,7 @@ void plClient::IDetectAudioVideoSettings() int val = 0; hsStream *stream = nil; hsUNIXStream s; - wchar audioIniFile[MAX_PATH], graphicsIniFile[MAX_PATH]; + wchar_t audioIniFile[MAX_PATH], graphicsIniFile[MAX_PATH]; PathGetInitDirectory(audioIniFile, arrsize(audioIniFile)); StrCopy(graphicsIniFile, audioIniFile, arrsize(audioIniFile)); PathAddFilename(audioIniFile, audioIniFile, L"audio.ini", arrsize(audioIniFile)); @@ -2371,7 +2369,7 @@ void plClient::IDetectAudioVideoSettings() } } -void plClient::IWriteDefaultGraphicsSettings(const wchar* destFile) +void plClient::IWriteDefaultGraphicsSettings(const wchar_t* destFile) { hsStream *stream = plEncryptedStream::OpenEncryptedFileWrite(destFile); @@ -2445,11 +2443,11 @@ void plClient::IOnAsyncInitComplete () { pfMarkerMgr::Instance(); - fAnimDebugList = TRACKED_NEW plAnimDebugList(); + fAnimDebugList = new plAnimDebugList(); /// Now parse final init files (*.fni). These are files just like ini files, only to be run /// after all hell has broken loose in the client. - wchar initFolder[MAX_PATH]; + wchar_t initFolder[MAX_PATH]; PathGetInitDirectory(initFolder, arrsize(initFolder)); pfConsoleDirSrc dirSrc( fConsoleEngine, initFolder, L"net*.fni" ); // connect to net first #ifndef PLASMA_EXTERNAL_RELEASE @@ -2477,7 +2475,7 @@ void plClient::IOnAsyncInitComplete () { // Tell the transition manager to start faded out. This is so we don't // get a frame or two of non-faded drawing before we do our initial fade in - (void)(TRACKED_NEW plTransitionMsg( plTransitionMsg::kFadeOut, 0.0f, true ))->Send(); + (void)(new plTransitionMsg( plTransitionMsg::kFadeOut, 0.0f, true ))->Send(); fFlags.SetBit(kFlagAsyncInitComplete); if (fFlags.IsBitSet(kFlagGlobalDataLoaded)) @@ -2495,7 +2493,7 @@ void plClient::ICompleteInit () { hsStatusMessage("Client init complete."); // Tell everyone we're ready to rock. - plClientMsg* clientMsg = TRACKED_NEW plClientMsg(plClientMsg::kInitComplete); + plClientMsg* clientMsg = new plClientMsg(plClientMsg::kInitComplete); clientMsg->SetBCastFlag(plMessage::kBCastByType); clientMsg->Send(); diff --git a/Sources/Plasma/Apps/plClient/plClient.h b/Sources/Plasma/Apps/plClient/plClient.h index b99b4efd..459ae84f 100644 --- a/Sources/Plasma/Apps/plClient/plClient.h +++ b/Sources/Plasma/Apps/plClient/plClient.h @@ -47,10 +47,10 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com //#define NEW_CAMERA_CODE -#include "hsWindowHndl.h" +#include "HeadSpin.h" #include "hsBitVector.h" #include "hsTemplates.h" -#include "hsUtils.h" + #include "hsStlUtils.h" #include "pnKeyedObject/hsKeyedObject.h" #include "pnKeyedObject/plUoid.h" @@ -94,10 +94,10 @@ protected: { public: plSceneNode *fNode; - UInt32 fFlags; + uint32_t fFlags; plRoomRec() { fNode = nil; fFlags = 0; } - plRoomRec( plSceneNode *n, UInt32 f ) : fNode( n ), fFlags( f ) {} + plRoomRec( plSceneNode *n, uint32_t f ) : fNode( n ), fFlags( f ) {} enum Flags { @@ -189,13 +189,13 @@ protected: void IProcessRenderRequests(hsTArray& reqs); void IAddRenderRequest(plRenderRequest* req); - hsBool IPlayIntroBink(const char* movieName, hsScalar endDelay, hsScalar posX, hsScalar posY, hsScalar scaleX, hsScalar scaleY, hsScalar volume = 1.0); + hsBool IPlayIntroBink(const char* movieName, float endDelay, float posX, float posY, float scaleX, float scaleY, float volume = 1.0); hsBool IHandleMovieMsg(plMovieMsg* mov); void IKillMovies(); void IServiceMovies(); - void IStartProgress( const char *title, hsScalar len ); - void IIncProgress( hsScalar byHowMuch, const char *text ); + void IStartProgress( const char *title, float len ); + void IIncProgress( float byHowMuch, const char *text ); void IStopProgress( void ); static void IDispatchMsgReceiveCallback(); @@ -293,7 +293,7 @@ public: 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 IDetectAudioVideoSettings(); - void IWriteDefaultGraphicsSettings(const wchar* destFile); + void IWriteDefaultGraphicsSettings(const wchar_t* destFile); plAnimDebugList *fAnimDebugList; diff --git a/Sources/Plasma/Apps/plClient/plClientUpdateFormat.h b/Sources/Plasma/Apps/plClient/plClientUpdateFormat.h index 406a95f6..c316cc8a 100644 --- a/Sources/Plasma/Apps/plClient/plClientUpdateFormat.h +++ b/Sources/Plasma/Apps/plClient/plClientUpdateFormat.h @@ -54,13 +54,13 @@ namespace ClientUpdate // // Format of the update stream // -// UInt8 - type (kUpdate, kShutdown) +// uint8_t - type (kUpdate, kShutdown) // // If type is kUpdate: -// UInt32 - number of deleted keys +// uint32_t - number of deleted keys // plUoid - uoid of deleted key (* num) // -// UInt32 - number of new creatables +// uint32_t - number of new creatables // plCreatable - new creatable (* num) // diff --git a/Sources/Plasma/Apps/plClient/winmain.cpp b/Sources/Plasma/Apps/plClient/winmain.cpp index 466c4530..1648fad9 100644 --- a/Sources/Plasma/Apps/plClient/winmain.cpp +++ b/Sources/Plasma/Apps/plClient/winmain.cpp @@ -53,7 +53,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "HeadSpin.h" #include "hsStream.h" -#include "hsUtils.h" + #include "plClient.h" #include "plClientResMgr/plClientResMgr.h" #include "plNetClient/plNetClientMgr.h" @@ -133,14 +133,14 @@ static const unsigned AUTH_FAILED_TIMER = 2; //============================================================================ #ifdef PLASMA_EXTERNAL_RELEASE -static wchar s_patcherExeName[] = L"UruLauncher.exe"; +static wchar_t s_patcherExeName[] = L"UruLauncher.exe"; #endif // PLASMA_EXTERNAL_RELEASE //============================================================================ // PhysX installer //============================================================================ -static wchar s_physXSetupExeName[] = L"PhysX_Setup.exe"; +static wchar_t s_physXSetupExeName[] = L"PhysX_Setup.exe"; //============================================================================ // TRANSGAMING detection & dialog replacement @@ -178,12 +178,12 @@ struct LoginDialogParam { }; static bool AuthenticateNetClientComm(ENetError* result, HWND parentWnd); -static void GetCryptKey(UInt32* cryptKey, unsigned size); +static void GetCryptKey(uint32_t* cryptKey, unsigned size); static void SaveUserPass (LoginDialogParam *pLoginParam, char *password); static void LoadUserPass (LoginDialogParam *pLoginParam); static void AuthFailedStrings (ENetError authError, const char **ppStr1, const char **ppStr2, - const wchar **ppWStr); + const wchar_t **ppWStr); // Detect whether we're running under TRANSGAMING Cider @@ -290,7 +290,7 @@ static bool TGRunLoginDialog (LoginDialogParam *pLoginParam) if (!cancelled) { const char *pStr1, *pStr2; - const wchar *pWStr; + const wchar_t *pWStr; unsigned int Len; char *pTmpStr; @@ -302,7 +302,7 @@ static bool TGRunLoginDialog (LoginDialogParam *pLoginParam) if (pWStr) Len += StrLen (pWStr) + 2; - pTmpStr = TRACKED_NEW char[Len]; + pTmpStr = new char[Len]; StrCopy (pTmpStr, pStr1, StrLen (pStr1)); if (pStr2) { @@ -361,7 +361,7 @@ void DebugMsgF(const char* format, ...); LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { static bool gDragging = false; - static UInt32 keyState=0; + static uint32_t keyState=0; // Handle messages switch (message) { @@ -661,8 +661,8 @@ bool InitPhysX() // launch the PhysX installer STARTUPINFOW startupInfo; PROCESS_INFORMATION processInfo; - ZERO(startupInfo); - ZERO(processInfo); + memset(&startupInfo, 0, sizeof(startupInfo)); + memset(&processInfo, 0, sizeof(processInfo)); startupInfo.cb = sizeof(startupInfo); if(!CreateProcessW(NULL, s_physXSetupExeName, NULL, NULL, FALSE, 0, NULL, NULL, &startupInfo, &processInfo)) { @@ -702,7 +702,7 @@ bool InitPhysX() bool InitClient( HWND hWnd ) { - plResManager *resMgr = TRACKED_NEW plResManager; + plResManager *resMgr = new plResManager; resMgr->SetDataPath("dat"); hsgResMgr::Init(resMgr); @@ -713,7 +713,7 @@ bool InitClient( HWND hWnd ) } plClientResMgr::Instance().ILoadResources("resource.dat"); - gClient = TRACKED_NEW plClient; + gClient = new plClient; if( gClient == nil ) return false; @@ -773,7 +773,7 @@ BOOL WinInit(HINSTANCE hInst, int nCmdShow) /// else, use our normal styles char windowName[256]; - wchar productString[256]; + wchar_t productString[256]; StrCopy(productString, ProductLongName(), arrsize(productString)); StrToAnsi(windowName, productString, arrsize(windowName)); @@ -837,7 +837,7 @@ void DebugMsgF(const char* format, ...) static void AuthFailedStrings (ENetError authError, const char **ppStr1, const char **ppStr2, - const wchar **ppWStr) + const wchar_t **ppWStr) { *ppStr1 = NULL; *ppStr2 = NULL; @@ -895,7 +895,7 @@ BOOL CALLBACK AuthFailedDialogProc( HWND hwndDlg, UINT uMsg, WPARAM wParam, LPAR { LoginDialogParam* loginParam = (LoginDialogParam*)lParam; const char *pStr1, *pStr2; - const wchar *pWStr; + const wchar_t *pWStr; AuthFailedStrings (loginParam->authError, &pStr1, &pStr2, &pWStr); @@ -939,7 +939,7 @@ BOOL CALLBACK UruTOSDialogProc( HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l char* eulaData = NULL; unsigned dataLen = stream.GetSizeLeft(); - eulaData = TRACKED_NEW char[dataLen + 1]; + eulaData = new char[dataLen + 1]; ZeroMemory(eulaData, dataLen + 1); stream.Read(dataLen, eulaData); @@ -970,12 +970,12 @@ BOOL CALLBACK UruTOSDialogProc( HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l static void SaveUserPass (LoginDialogParam *pLoginParam, char *password) { - UInt32 cryptKey[4]; + uint32_t cryptKey[4]; ZeroMemory(cryptKey, sizeof(cryptKey)); GetCryptKey(cryptKey, arrsize(cryptKey)); - wchar wusername[kMaxAccountNameLength]; - wchar wpassword[kMaxPasswordLength]; + wchar_t wusername[kMaxAccountNameLength]; + wchar_t wpassword[kMaxPasswordLength]; StrToUnicode(wusername, pLoginParam->username, arrsize(wusername)); @@ -985,7 +985,7 @@ static void SaveUserPass (LoginDialogParam *pLoginParam, char *password) { StrToUnicode(wpassword, password, arrsize(wpassword)); - wchar domain[15]; + wchar_t domain[15]; PathSplitEmail(wusername, nil, 0, domain, arrsize(domain), nil, 0, nil, 0, 0); if (StrLen(domain) == 0 || StrCmpI(domain, L"gametap") == 0) { @@ -1012,12 +1012,12 @@ static void SaveUserPass (LoginDialogParam *pLoginParam, char *password) else NetCommSetAuthTokenAndOS(nil, L"win"); - wchar fileAndPath[MAX_PATH]; + wchar_t fileAndPath[MAX_PATH]; PathGetInitDirectory(fileAndPath, arrsize(fileAndPath)); PathAddFilename(fileAndPath, fileAndPath, L"login.dat", arrsize(fileAndPath)); #ifndef PLASMA_EXTERNAL_RELEASE // internal builds can use the local init directory - wchar localFileAndPath[MAX_PATH]; + wchar_t localFileAndPath[MAX_PATH]; StrCopy(localFileAndPath, L"init\\login.dat", arrsize(localFileAndPath)); if (PathDoesFileExist(localFileAndPath)) StrCopy(fileAndPath, localFileAndPath, arrsize(localFileAndPath)); @@ -1038,7 +1038,7 @@ static void SaveUserPass (LoginDialogParam *pLoginParam, char *password) static void LoadUserPass (LoginDialogParam *pLoginParam) { - UInt32 cryptKey[4]; + uint32_t cryptKey[4]; ZeroMemory(cryptKey, sizeof(cryptKey)); GetCryptKey(cryptKey, arrsize(cryptKey)); @@ -1046,12 +1046,12 @@ static void LoadUserPass (LoginDialogParam *pLoginParam) pLoginParam->remember = false; pLoginParam->username[0] = '\0'; - wchar fileAndPath[MAX_PATH]; + wchar_t fileAndPath[MAX_PATH]; PathGetInitDirectory(fileAndPath, arrsize(fileAndPath)); PathAddFilename(fileAndPath, fileAndPath, L"login.dat", arrsize(fileAndPath)); #ifndef PLASMA_EXTERNAL_RELEASE // internal builds can use the local init directory - wchar localFileAndPath[MAX_PATH]; + wchar_t localFileAndPath[MAX_PATH]; StrCopy(localFileAndPath, L"init\\login.dat", arrsize(localFileAndPath)); if (PathDoesFileExist(localFileAndPath)) StrCopy(fileAndPath, localFileAndPath, arrsize(localFileAndPath)); @@ -1059,7 +1059,7 @@ static void LoadUserPass (LoginDialogParam *pLoginParam) hsStream* stream = plEncryptedStream::OpenEncryptedFile(fileAndPath, true, cryptKey); if (stream && !stream->AtEnd()) { - UInt32 savedKey[4]; + uint32_t savedKey[4]; stream->Read(sizeof(savedKey), savedKey); if (memcmp(cryptKey, savedKey, sizeof(savedKey)) == 0) @@ -1166,7 +1166,7 @@ BOOL CALLBACK UruLoginDialogProc( HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM } char windowName[256]; - wchar productString[256]; + wchar_t productString[256]; ProductString(productString, arrsize(productString)); StrToAnsi(windowName, productString, arrsize(windowName)); SendMessage(GetDlgItem(hwndDlg, IDC_PRODUCTSTRING), WM_SETTEXT, 0, (LPARAM) windowName); @@ -1218,7 +1218,7 @@ BOOL CALLBACK UruLoginDialogProc( HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM SaveUserPass (pLoginParam, password); - MemSet(&pLoginParam->authError, 0, sizeof(pLoginParam->authError)); + memset(&pLoginParam->authError, 0, sizeof(pLoginParam->authError)); bool cancelled = AuthenticateNetClientComm(&pLoginParam->authError, hwndDlg); if (IS_NET_SUCCESS(pLoginParam->authError) && !cancelled) @@ -1251,7 +1251,7 @@ BOOL CALLBACK UruLoginDialogProc( HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM } else if (HIWORD(wParam) == BN_CLICKED && LOWORD(wParam) == IDC_URULOGIN_GAMETAPLINK) { - const wchar *signupurl = GetServerSignupUrl(); + const wchar_t *signupurl = GetServerSignupUrl(); ShellExecuteW(NULL, L"open", signupurl, NULL, NULL, SW_SHOWNORMAL); return TRUE; @@ -1380,7 +1380,7 @@ LONG WINAPI plCustomUnhandledExceptionFilter( struct _EXCEPTION_POINTERS *Except } char prodName[256]; - wchar productString[256]; + wchar_t productString[256]; ProductString(productString, arrsize(productString)); StrToAnsi(prodName, productString, arrsize(prodName)); @@ -1390,7 +1390,7 @@ LONG WINAPI plCustomUnhandledExceptionFilter( struct _EXCEPTION_POINTERS *Except /// Print the info out to a log file as well hsUNIXStream log; - wchar fileAndPath[MAX_PATH]; + wchar_t fileAndPath[MAX_PATH]; PathGetLogDirectory(fileAndPath, arrsize(fileAndPath)); PathAddFilename(fileAndPath, fileAndPath, L"stackDump.log", arrsize(fileAndPath)); if( log.Open( fileAndPath, L"wt" ) ) @@ -1430,7 +1430,7 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpCmdLine, int nC gDataServerLocal = true; #endif - const wchar *serverIni = L"server.ini"; + const wchar_t *serverIni = L"server.ini"; if (cmdParser.IsSpecified(kArgServerIni)) serverIni = cmdParser.GetString(kArgServerIni); @@ -1455,11 +1455,11 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpCmdLine, int nC // if the client was started directly, run the patcher, and shutdown STARTUPINFOW si; PROCESS_INFORMATION pi; - ZERO(si); - ZERO(pi); + memset(&si, 0, sizeof(si)); + memset(&pi, 0, sizeof(pi)); si.cb = sizeof(si); - wchar cmdLine[MAX_PATH]; - const wchar ** addrs; + wchar_t cmdLine[MAX_PATH]; + const wchar_t ** addrs; if (!eventExists) // if it is missing, assume patcher wasn't launched { @@ -1487,7 +1487,7 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpCmdLine, int nC #endif // Load an optional general.ini - wchar gipath[MAX_PATH]; + wchar_t gipath[MAX_PATH]; PathGetInitDirectory(gipath, arrsize(gipath)); PathAddFilename(gipath, gipath, L"general.ini", arrsize(gipath)); FILE *generalini = _wfopen(gipath, L"rb"); @@ -1547,13 +1547,13 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpCmdLine, int nC bool needExit = false; LoginDialogParam loginParam; - MemSet(&loginParam, 0, sizeof(loginParam)); + memset(&loginParam, 0, sizeof(loginParam)); LoadUserPass(&loginParam); if (!doIntroDialogs && loginParam.remember) { ENetError auth; - wchar wusername[kMaxAccountNameLength]; + wchar_t wusername[kMaxAccountNameLength]; StrToUnicode(wusername, loginParam.username, arrsize(wusername)); NetCommSetAccountUsernamePassword(wusername, loginParam.namePassHash); bool cancelled = AuthenticateNetClientComm(&auth, NULL); @@ -1616,7 +1616,7 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpCmdLine, int nC gDebugFile = NULL; if ( !plStatusLog::fLoggingOff ) { - wchar fileAndPath[MAX_PATH]; + wchar_t fileAndPath[MAX_PATH]; PathGetLogDirectory(fileAndPath, arrsize(fileAndPath)); PathAddFilename(fileAndPath, fileAndPath, L"plasmalog.txt", arrsize(fileAndPath)); gDebugFile = _wfopen(fileAndPath, L"wt"); @@ -1625,7 +1625,7 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpCmdLine, int nC if (gDebugFile != NULL) { char prdName[256]; - wchar prdString[256]; + wchar_t prdString[256]; ProductString(prdString, arrsize(prdString)); StrToAnsi(prdName, prdString, arrsize(prdName)); fprintf(gDebugFile, "%s\n", prdName); @@ -1635,10 +1635,10 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpCmdLine, int nC // log stackdump.log text if the log exists char stackDumpText[1024]; - wchar stackDumpTextW[1024]; + wchar_t stackDumpTextW[1024]; memset(stackDumpText, 0, arrsize(stackDumpText)); - memset(stackDumpTextW, 0, arrsize(stackDumpTextW) * sizeof(wchar)); - wchar fileAndPath[MAX_PATH]; + memset(stackDumpTextW, 0, arrsize(stackDumpTextW) * sizeof(wchar_t)); + wchar_t fileAndPath[MAX_PATH]; PathGetLogDirectory(fileAndPath, arrsize(fileAndPath)); PathAddFilename(fileAndPath, fileAndPath, L"stackDump.log", arrsize(fileAndPath)); FILE *stackDumpLog = _wfopen(fileAndPath, L"r"); @@ -1758,7 +1758,7 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpCmdLine, int nC return PARABLE_NORMAL_EXIT; } -static void GetCryptKey(UInt32* cryptKey, unsigned numElements) +static void GetCryptKey(uint32_t* cryptKey, unsigned numElements) { char volName[] = "C:\\"; int index = 0; diff --git a/Sources/Plasma/Apps/plClientKey/plClientKey.cpp b/Sources/Plasma/Apps/plClientKey/plClientKey.cpp index 8dc30d18..370c43bd 100644 --- a/Sources/Plasma/Apps/plClientKey/plClientKey.cpp +++ b/Sources/Plasma/Apps/plClientKey/plClientKey.cpp @@ -40,11 +40,10 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ #include "plClientKey.h" -#include "hsWindows.h" -typedef const UInt32* (*GETKEY)(); +typedef const uint32_t* (*GETKEY)(); -const UInt32* plClientKey::GetKey() +const uint32_t* plClientKey::GetKey() { HMODULE hDll = LoadLibrary("sp.dll"); if (hDll) @@ -52,7 +51,7 @@ const UInt32* plClientKey::GetKey() GETKEY getKey = (GETKEY)GetProcAddress(hDll, "GetKey"); if (getKey) { - static UInt32 key[4]; + static uint32_t key[4]; memcpy(key, getKey(), sizeof(key)); FreeLibrary(hDll); return key; diff --git a/Sources/Plasma/Apps/plClientKey/plClientKey.h b/Sources/Plasma/Apps/plClientKey/plClientKey.h index 29fb930d..4c4faca2 100644 --- a/Sources/Plasma/Apps/plClientKey/plClientKey.h +++ b/Sources/Plasma/Apps/plClientKey/plClientKey.h @@ -42,7 +42,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #ifndef plClientKey_h_inc #define plClientKey_h_inc -#include "hsTypes.h" +#include "HeadSpin.h" // // For getting the "SafeDisc protected" encryption key in single player mode @@ -53,7 +53,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // namespace plClientKey { - const UInt32* GetKey(); + const uint32_t* GetKey(); } #endif // plClientKey_h_inc \ No newline at end of file diff --git a/Sources/Plasma/Apps/plClientPatcher/UruPlayer.cpp b/Sources/Plasma/Apps/plClientPatcher/UruPlayer.cpp index cfa8935e..add04291 100644 --- a/Sources/Plasma/Apps/plClientPatcher/UruPlayer.cpp +++ b/Sources/Plasma/Apps/plClientPatcher/UruPlayer.cpp @@ -55,19 +55,19 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com * ***/ #ifndef PLASMA_EXTERNAL_RELEASE - static const wchar s_manifest[] = L"Internal"; - static const wchar s_macmanifest[] = L"macInternal"; - static const wchar s_thinmanifest[] = L"ThinInternal"; + static const wchar_t s_manifest[] = L"Internal"; + static const wchar_t s_macmanifest[] = L"macInternal"; + static const wchar_t s_thinmanifest[] = L"ThinInternal"; #else - static const wchar s_manifest[] = L"External"; - static const wchar s_macmanifest[] = L"macExternal"; - static const wchar s_thinmanifest[] = L"ThinExternal"; + static const wchar_t s_manifest[] = L"External"; + static const wchar_t s_macmanifest[] = L"macExternal"; + static const wchar_t s_thinmanifest[] = L"ThinExternal"; #endif struct ManifestFile { LINK(ManifestFile) link; - ManifestFile(const wchar clientName[], const wchar downloadName[], const wchar md5val[], int flags, plLauncherInfo *info) + ManifestFile(const wchar_t clientName[], const wchar_t downloadName[], const wchar_t md5val[], int flags, plLauncherInfo *info) { StrCopy(filename, clientName, arrsize(filename)); StrCopy(zipName, downloadName, arrsize(zipName)); @@ -77,9 +77,9 @@ struct ManifestFile md5failed = false; } - wchar filename[MAX_PATH]; - wchar zipName[MAX_PATH]; - wchar md5[MAX_PATH]; + wchar_t filename[MAX_PATH]; + wchar_t zipName[MAX_PATH]; + wchar_t md5[MAX_PATH]; int flags; bool md5failed; plLauncherInfo *info; @@ -88,13 +88,13 @@ struct ManifestFile class ProgressStream : public plZlibStream { public: - virtual UInt32 Write(UInt32 byteCount, const void* buffer); + virtual uint32_t Write(uint32_t byteCount, const void* buffer); static plLauncherInfo *info; static long totalBytes; static unsigned progress; // for updating bytes per second - static dword startTime; + static uint32_t startTime; }; struct ProcessManifestEntryParam { @@ -107,7 +107,7 @@ struct ProcessManifestEntryParam { }; struct ManifestResult { - wchar group[MAX_PATH]; + wchar_t group[MAX_PATH]; ARRAY(NetCliFileManifestEntry) manifest; long * indicator; plLauncherInfo * info; @@ -120,7 +120,7 @@ struct ManifestResult { static void DownloadCallback ( ENetError result, void * param, - const wchar filename[], + const wchar_t filename[], hsStream * writer ); @@ -165,7 +165,7 @@ static long s_perf[kNumPerf]; long ProgressStream::totalBytes; unsigned ProgressStream::progress; plLauncherInfo * ProgressStream::info; -dword ProgressStream::startTime = 0; +uint32_t ProgressStream::startTime = 0; long ProcessManifestEntryParam::progress = 0; long ProcessManifestEntryParam::totalSize = 0; double ProcessManifestEntryParam::startTime = 0; @@ -181,9 +181,9 @@ double ProcessManifestEntryParam::startTime = 0; // leaving clients with older patchers "dead in the water", without // a way to play Uru. #ifdef PLASMA_EXTERNAL_RELEASE -const wchar kPatcherExeFilename[] = L"UruLauncher.exe"; +const wchar_t kPatcherExeFilename[] = L"UruLauncher.exe"; #else -const wchar kPatcherExeFilename[] = L"plUruLauncher.exe"; +const wchar_t kPatcherExeFilename[] = L"plUruLauncher.exe"; #endif @@ -192,9 +192,9 @@ const wchar kPatcherExeFilename[] = L"plUruLauncher.exe"; //============================================================================ #ifdef PLASMA_EXTERNAL_RELEASE #ifdef HS_DEBUGGING -static wchar s_clientExeName[] = L"plClient_dbg.exe"; +static wchar_t s_clientExeName[] = L"plClient_dbg.exe"; #else -static wchar s_clientExeName[] = L"UruExplorer.exe"; +static wchar_t s_clientExeName[] = L"UruExplorer.exe"; #endif // HS_DEBUGGING //============================================================================ @@ -202,9 +202,9 @@ static wchar s_clientExeName[] = L"UruExplorer.exe"; //============================================================================ #else #ifdef HS_DEBUGGING -static wchar s_clientExeName[] = L"plClient_dbg.exe"; +static wchar_t s_clientExeName[] = L"plClient_dbg.exe"; #else -static wchar s_clientExeName[] = L"plClient.exe"; +static wchar_t s_clientExeName[] = L"plClient.exe"; #endif // HS_DEBUGGING #endif // PLASMA_EXTERNAL_RELEASE @@ -216,14 +216,14 @@ static wchar s_clientExeName[] = L"plClient.exe"; ***/ //============================================================================ -static void LogHandler (ELogSeverity severity, const wchar msg[]) { +static void LogHandler (ELogSeverity severity, const wchar_t msg[]) { AsyncLogWriteMsg(L"UruPlayer", severity, msg); } //============================================================================ static void NetErrorHandler (ENetProtocol protocol, ENetError error) { - const wchar * srv; + const wchar_t * srv; switch (protocol) { case kNetProtocolNil: srv = L"Notify"; break; case kNetProtocolCli2File: srv = L"File"; break; @@ -287,7 +287,7 @@ static void WaitUruExitProc (void * param) { */ //============================================================================ -static bool MD5Check (const char filename[], const wchar md5[]) { +static bool MD5Check (const char filename[], const wchar_t md5[]) { // Do md5 check char md5copy[MAX_PATH]; plMD5Checksum existingMD5(filename); @@ -315,7 +315,7 @@ static void DecompressOgg (ManifestFile *mf) { break; } - UInt32 size = reader->GetDataSize(); + uint32_t size = reader->GetDataSize(); delete reader; ULARGE_INTEGER freeBytesAvailable, totalNumberOfBytes, neededBytes; @@ -355,13 +355,13 @@ static void RequestNextManifestFile () { return; s_manifestQueue.Unlink(nextfile); char path[MAX_PATH]; - wchar basePath[MAX_PATH]; + wchar_t basePath[MAX_PATH]; StrPrintf(path, arrsize(path), "%s%S", s_workingDir, nextfile->filename); StrToUnicode(basePath, path, arrsize(basePath)); PathRemoveFilename(basePath, basePath, arrsize(basePath)); PathCreateDirectory(basePath, kPathCreateDirFlagEntireTree); - ProgressStream *writer = NEW(ProgressStream); // optimization: dont delete and recreate. Doesn't seem to be working currently, ZLibStream is breaking + ProgressStream *writer = new ProgressStream(); // optimization: dont delete and recreate. Doesn't seem to be working currently, ZLibStream is breaking if(!writer->Open(path, "wb")) { writer->Close(); @@ -384,7 +384,7 @@ static void RequestNextManifestFile () { static void DownloadCallback ( ENetError result, void * param, - const wchar filename[], + const wchar_t filename[], hsStream * writer ) { s_numConnectFailures = 0; @@ -435,7 +435,7 @@ static void DownloadCallback ( #endif // PLASMA_EXTERNAL_RELEASE Shutdown(mf->info); } - writer = NEW(ProgressStream); + writer = new ProgressStream(); if (!writer->Open(path, "wb")) { #ifdef PLASMA_EXTERNAL_RELEASE MessageBox(nil, s_fileOpenError, "URU Launcher", MB_ICONERROR); @@ -457,7 +457,7 @@ static void DownloadCallback ( if(s_running) { - wchar ext[MAX_EXT]; + wchar_t ext[MAX_EXT]; PathSplitPath(mf->filename, nil, nil, nil, ext); if(!StrCmpI(L".ogg", ext)) { @@ -497,7 +497,7 @@ static void ProcessManifestEntry (void * param, ENetError error) { s_workingDir, p->mr->manifest[p->index].clientName ); - dword start = (dword)(TimeGetTime() / kTimeIntervalsPerMs); + uint32_t start = (uint32_t)(TimeGetTime() / kTimeIntervalsPerMs); if(!MD5Check(path, p->mr->manifest[p->index].md5)) { p->mr->critsect.Enter(); p->mr->indices.Add(p->index); @@ -506,7 +506,7 @@ static void ProcessManifestEntry (void * param, ENetError error) { } // if we have a file that was cached the MD5 check will be really fast throwing off our approx time remaining. - dword t = (dword)(TimeGetTime() / kTimeIntervalsPerMs - start); + uint32_t t = (uint32_t)(TimeGetTime() / kTimeIntervalsPerMs - start); if(t < 25) { // cached file @@ -542,7 +542,7 @@ static void ProcessManifestEntry (void * param, ENetError error) { //============================================================================ static void ProcessManifest (void * param) { - wchar basePath[MAX_PATH]; + wchar_t basePath[MAX_PATH]; char path[MAX_PATH]; AtomicAdd(&s_perf[kPerfThreadTaskCount], 1); @@ -617,7 +617,7 @@ static void ProcessManifest (void * param) { PathRemoveFilename(basePath, basePath, arrsize(basePath)); PathCreateDirectory(basePath, kPathCreateDirFlagEntireTree); - ManifestFile * mf = NEW(ManifestFile)( + ManifestFile * mf = new ManifestFile( manifest[index].clientName, manifest[index].downloadName, manifest[index].md5, @@ -654,7 +654,7 @@ static void ProcessManifest (void * param) { } } } - DEL(mr); + delete mr; AtomicAdd(&s_perf[kPerfThreadTaskCount], -1); } @@ -662,7 +662,7 @@ static void ProcessManifest (void * param) { static void ManifestCallback ( ENetError result, void * param, - const wchar group[], + const wchar_t group[], const NetCliFileManifestEntry manifest[], unsigned entryCount ){ @@ -689,7 +689,7 @@ static void ManifestCallback ( return; } - ManifestResult * mr = NEW(ManifestResult); + ManifestResult * mr = new ManifestResult(); StrCopy(mr->group, group, arrsize(mr->group)); mr->manifest.Set(manifest, entryCount); mr->info = info; @@ -725,7 +725,7 @@ static void ManifestCallback ( static void ThinManifestCallback ( ENetError result, void * param, - const wchar group[], + const wchar_t group[], const NetCliFileManifestEntry manifest[], unsigned entryCount ){ @@ -788,7 +788,7 @@ static void ThinManifestCallback ( ***/ //============================================================================ -UInt32 ProgressStream::Write(UInt32 byteCount, const void* buffer) { +uint32_t ProgressStream::Write(uint32_t byteCount, const void* buffer) { if(!s_running || s_patchError) return 0; if(!startTime) { @@ -814,7 +814,7 @@ UInt32 ProgressStream::Write(UInt32 byteCount, const void* buffer) { info->SetBytesRemaining(totalBytes - progress); if(TimeGetSecondsSince2001Utc() != startTime) { - dword bytesPerSec = (progress ) / (TimeGetSecondsSince2001Utc() - startTime); + uint32_t bytesPerSec = (progress ) / (TimeGetSecondsSince2001Utc() - startTime); info->SetTimeRemaining(bytesPerSec ? (totalBytes - progress) / bytesPerSec : 0); } } @@ -826,7 +826,7 @@ UInt32 ProgressStream::Write(UInt32 byteCount, const void* buffer) { static void FileSrvIpAddressCallback ( ENetError result, void * param, - const wchar addr[] + const wchar_t addr[] ) { NetCliGateKeeperDisconnect(); @@ -866,7 +866,7 @@ void InitAsyncCore () { AsyncCoreInitialize(); AsyncLogInitialize(L"Log", false); - wchar productString[256]; + wchar_t productString[256]; ProductString(productString, arrsize(productString)); LogMsg(kLogPerf, L"Patcher: %s", productString); } @@ -902,7 +902,7 @@ void UruPrepProc (void * param) { s_patchComplete = false; s_patchError = false; - const wchar ** addrs; + const wchar_t ** addrs; unsigned count; count = GetGateKeeperSrvHostnames(&addrs); @@ -920,7 +920,7 @@ void UruPrepProc (void * param) { while(ManifestFile *mf = s_manifestQueue.Head()) { - DEL(mf); + delete mf; } // If s_patchError, we don't wait around for s_numFiles // to drop to zero because it never does for reasons @@ -974,11 +974,11 @@ void UruStartProc (void * param) { plLauncherInfo *info = (plLauncherInfo *) param; - wchar workDir[MAX_PATH]; + wchar_t workDir[MAX_PATH]; StrPrintf(workDir, arrsize(workDir), L"%s", info->path); //fprintf(stderr, "URUPlayer StartProc gamePath is:%ws\n", workDir); - wchar cmdLine[MAX_PATH]; + wchar_t cmdLine[MAX_PATH]; StrPrintf(cmdLine, arrsize(cmdLine), L"%s%s %s", workDir, s_clientExeName, info->cmdLine); // Create the named event so the client won't restart us (Windows will clean it up when we exit) @@ -991,8 +991,8 @@ void UruStartProc (void * param) { fprintf(stderr, "URUPlayer StartProc, running game process at dir:%ws, cmd:%ws for application:%ws\n", workDir, cmdLine, s_clientExeName); STARTUPINFOW si; - ZERO(si); - ZERO(s_pi); + memset(&si, 0, sizeof(si)); + memset(&s_pi, 0, sizeof(s_pi)); si.cb = sizeof(si); info->SetText("Launching URU..."); @@ -1030,4 +1030,4 @@ void UruStartProc (void * param) { { info->startCallback(kStatusError, nil); } -} \ No newline at end of file +} diff --git a/Sources/Plasma/Apps/plClientPatcher/UruPlayer.h b/Sources/Plasma/Apps/plClientPatcher/UruPlayer.h index 03297c7a..1a15d9be 100644 --- a/Sources/Plasma/Apps/plClientPatcher/UruPlayer.h +++ b/Sources/Plasma/Apps/plClientPatcher/UruPlayer.h @@ -64,4 +64,4 @@ void UruStartProc (void * param); void PlayerTerminateProc (void * param); void PlayerStopProc (void * param); -extern const wchar kPatcherExeFilename[]; +extern const wchar_t kPatcherExeFilename[]; diff --git a/Sources/Plasma/Apps/plFileEncrypt/CMakeLists.txt b/Sources/Plasma/Apps/plFileEncrypt/CMakeLists.txt index b4fdd13f..f19e9b79 100644 --- a/Sources/Plasma/Apps/plFileEncrypt/CMakeLists.txt +++ b/Sources/Plasma/Apps/plFileEncrypt/CMakeLists.txt @@ -12,6 +12,6 @@ set(plFileEncrypt_SOURCES ) add_executable(plFileEncrypt ${plFileEncrypt_SOURCES}) -target_link_libraries(plFileEncrypt CoreLib CoreLibExe pnProduct plFile) +target_link_libraries(plFileEncrypt CoreLib pnProduct plFile) source_group("Source Files" FILES ${plFileEncrypt_SOURCES}) diff --git a/Sources/Plasma/Apps/plFileEncrypt/main.cpp b/Sources/Plasma/Apps/plFileEncrypt/main.cpp index 0b1f894b..d821433d 100644 --- a/Sources/Plasma/Apps/plFileEncrypt/main.cpp +++ b/Sources/Plasma/Apps/plFileEncrypt/main.cpp @@ -42,12 +42,12 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "plFile/hsFiles.h" #include "plFile/plEncryptedStream.h" #include "pnProduct/pnProduct.h" -#include "hsUtils.h" + void EncryptFiles(const char* dir, const char* ext, bool encrypt); void print_version(){ - wchar productString[256]; + wchar_t productString[256]; ProductString(productString, arrsize(productString)); printf("%S\n\n", productString); } diff --git a/Sources/Plasma/Apps/plFileSecure/CMakeLists.txt b/Sources/Plasma/Apps/plFileSecure/CMakeLists.txt index 09500b00..23f278aa 100644 --- a/Sources/Plasma/Apps/plFileSecure/CMakeLists.txt +++ b/Sources/Plasma/Apps/plFileSecure/CMakeLists.txt @@ -12,6 +12,6 @@ set(plFileSecure_SOURCES ) add_executable(plFileSecure ${plFileSecure_SOURCES}) -target_link_libraries(plFileSecure CoreLib CoreLibExe pnProduct plFile) +target_link_libraries(plFileSecure CoreLib pnProduct plFile) source_group("Source Files" FILES ${plFileSecure_SOURCES}) diff --git a/Sources/Plasma/Apps/plFileSecure/main.cpp b/Sources/Plasma/Apps/plFileSecure/main.cpp index 6503def1..4d8172ed 100644 --- a/Sources/Plasma/Apps/plFileSecure/main.cpp +++ b/Sources/Plasma/Apps/plFileSecure/main.cpp @@ -43,13 +43,13 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "plFile/plFileUtils.h" #include "plFile/plSecureStream.h" #include "pnProduct/pnProduct.h" -#include "hsUtils.h" + #include #include void print_version() { - wchar productString[256]; + wchar_t productString[256]; ProductString(productString, arrsize(productString)); printf("%S\n\n", productString); } @@ -75,40 +75,40 @@ void print_help() { void GenerateKey(bool useDefault) { - UInt32 key[4]; + uint32_t key[4]; if (useDefault) { unsigned memSize = min(arrsize(key), arrsize(plSecureStream::kDefaultKey)); - memSize *= sizeof(UInt32); + memSize *= sizeof(uint32_t); memcpy(key, plSecureStream::kDefaultKey, memSize); } else { srand((unsigned)time(nil)); double randNum = (double)rand() / (double)RAND_MAX; // converts to 0..1 - UInt32 keyNum = (UInt32)(randNum * (double)0xFFFFFFFF); // multiply it by the max unsigned 32-bit int + uint32_t keyNum = (uint32_t)(randNum * (double)0xFFFFFFFF); // multiply it by the max unsigned 32-bit int key[0] = keyNum; randNum = (double)rand() / (double)RAND_MAX; - keyNum = (UInt32)(randNum * (double)0xFFFFFFFF); + keyNum = (uint32_t)(randNum * (double)0xFFFFFFFF); key[1] = keyNum; randNum = (double)rand() / (double)RAND_MAX; - keyNum = (UInt32)(randNum * (double)0xFFFFFFFF); + keyNum = (uint32_t)(randNum * (double)0xFFFFFFFF); key[2] = keyNum; randNum = (double)rand() / (double)RAND_MAX; - keyNum = (UInt32)(randNum * (double)0xFFFFFFFF); + keyNum = (uint32_t)(randNum * (double)0xFFFFFFFF); key[3] = keyNum; } hsUNIXStream out; out.Open(plFileUtils::kKeyFilename, "wb"); - out.Write(sizeof(UInt32) * arrsize(key), (void*)key); + out.Write(sizeof(uint32_t) * arrsize(key), (void*)key); out.Close(); } -void SecureFiles(std::string dir, std::string ext, UInt32* key) +void SecureFiles(std::string dir, std::string ext, uint32_t* key) { char filePath[256]; @@ -203,7 +203,7 @@ int main(int argc, char *argv[]) SecureFiles(directory, ext, nil); else { - UInt32 key[4]; + uint32_t key[4]; plFileUtils::GetSecureEncryptionKey(plFileUtils::kKeyFilename, key, arrsize(key)); SecureFiles(directory, ext, key); } diff --git a/Sources/Plasma/Apps/plLogDecrypt/CMakeLists.txt b/Sources/Plasma/Apps/plLogDecrypt/CMakeLists.txt index 9a62efdc..a8f2fe35 100644 --- a/Sources/Plasma/Apps/plLogDecrypt/CMakeLists.txt +++ b/Sources/Plasma/Apps/plLogDecrypt/CMakeLists.txt @@ -12,6 +12,6 @@ set(plLogDecrypt_SOURCES ) add_executable(plLogDecrypt ${plLogDecrypt_SOURCES}) -target_link_libraries(plLogDecrypt CoreLib CoreLibExe plStatusLog pnProduct) +target_link_libraries(plLogDecrypt CoreLib plStatusLog pnProduct) source_group("Source Files" FILES ${plLogDecrypt_SOURCES}) diff --git a/Sources/Plasma/Apps/plLogDecrypt/plLogDecrypt.cpp b/Sources/Plasma/Apps/plLogDecrypt/plLogDecrypt.cpp index b2bdd348..2ff255ca 100644 --- a/Sources/Plasma/Apps/plLogDecrypt/plLogDecrypt.cpp +++ b/Sources/Plasma/Apps/plLogDecrypt/plLogDecrypt.cpp @@ -47,8 +47,8 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include #include -#include "hsTypes.h" -#include "hsUtils.h" +#include "HeadSpin.h" + #include "plStatusLog/plEncryptLogLine.h" void IProcessFile(const char *path) @@ -62,16 +62,16 @@ void IProcessFile(const char *path) if( fpIn != nil && fpOut != nil) { - UInt8 line[ 2048 ]; + uint8_t line[ 2048 ]; while( !feof( fpIn ) ) { // Read next string long pos = ftell(fpIn); if( pos == -1L ) break; - UInt8 hint = (UInt8)pos; - UInt16 sizeHint = (UInt16)pos; - UInt16 size; + uint8_t hint = (uint8_t)pos; + uint16_t sizeHint = (uint16_t)pos; + uint16_t size; if( stricmp( path + strlen( path ) - 4, ".log" ) == 0 ) { @@ -81,14 +81,14 @@ void IProcessFile(const char *path) int c = fgetc( fpIn ); if( c == EOF || c == hint ) break; - line[ i ] = (UInt8)c; + line[ i ] = (uint8_t)c; } line[ i ] = 0; size = i; } else { - // UInt16 line length is encoded first + // uint16_t line length is encoded first int c = fgetc( fpIn ); if( c == EOF ) break; diff --git a/Sources/Plasma/Apps/plPageInfo/CMakeLists.txt b/Sources/Plasma/Apps/plPageInfo/CMakeLists.txt index 8fe28883..0ff9e0ba 100644 --- a/Sources/Plasma/Apps/plPageInfo/CMakeLists.txt +++ b/Sources/Plasma/Apps/plPageInfo/CMakeLists.txt @@ -13,6 +13,6 @@ set(plPageInfo_SOURCES ) add_executable(plPageInfo ${plPageInfo_SOURCES}) -target_link_libraries(plPageInfo CoreLib CoreLibExe pnProduct plResMgr plAudioCore) +target_link_libraries(plPageInfo CoreLib pnProduct plResMgr plAudioCore) source_group("Source Files" FILES ${plPageInfo_SOURCES}) diff --git a/Sources/Plasma/Apps/plPageInfo/plAllCreatables.cpp b/Sources/Plasma/Apps/plPageInfo/plAllCreatables.cpp index ce7c10f5..e007f7a6 100644 --- a/Sources/Plasma/Apps/plPageInfo/plAllCreatables.cpp +++ b/Sources/Plasma/Apps/plPageInfo/plAllCreatables.cpp @@ -39,7 +39,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com Mead, WA 99021 *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "pnFactory/plCreator.h" diff --git a/Sources/Plasma/Apps/plPageInfo/plPageInfo.cpp b/Sources/Plasma/Apps/plPageInfo/plPageInfo.cpp index 219a2d88..0d5509e7 100644 --- a/Sources/Plasma/Apps/plPageInfo/plPageInfo.cpp +++ b/Sources/Plasma/Apps/plPageInfo/plPageInfo.cpp @@ -39,7 +39,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com Mead, WA 99021 *==LICENSE==*/ -#include "hsUtils.h" + #include "hsTimer.h" #include "plFile/hsFiles.h" #include "plFile/plFileUtils.h" @@ -67,7 +67,7 @@ bool DumpSounds(); //// PrintVersion /////////////////////////////////////////////////////////////// void PrintVersion() { - wchar productString[256]; + wchar_t productString[256]; ProductString(productString, arrsize(productString)); printf("%S\n\n", productString); } @@ -129,7 +129,7 @@ int main(int argc, char* argv[]) plResMgrSettings::Get().SetFilterNewerPageVersions(false); plResMgrSettings::Get().SetFilterOlderPageVersions(false); plResMgrSettings::Get().SetLoadPagesOnInit(false); - gResMgr = TRACKED_NEW plResManager; + gResMgr = new plResManager; hsgResMgr::Init(gResMgr); gResMgr->AddSinglePage(pageFile); @@ -185,7 +185,7 @@ bool DumpSounds() const char* filename = buffer->GetFileName(); if (filename) { - UInt32 flags = 0; + uint32_t flags = 0; if (stricmp(plFileUtils::GetFileExt(filename), "wav") != 0) { diff --git a/Sources/Plasma/Apps/plPageOptimizer/main.cpp b/Sources/Plasma/Apps/plPageOptimizer/main.cpp index d817de9d..e3967ce4 100644 --- a/Sources/Plasma/Apps/plPageOptimizer/main.cpp +++ b/Sources/Plasma/Apps/plPageOptimizer/main.cpp @@ -63,12 +63,12 @@ int main(int argc, char* argv[]) try { #endif - plResManager* resMgr = TRACKED_NEW plResManager; + plResManager* resMgr = new plResManager; hsgResMgr::Init(resMgr); // Setup all the crap that needs to be around to load plSimulationMgr::Init(); - fontCache = TRACKED_NEW plFontCache; + fontCache = new plFontCache; plPythonFileMod::SetAtConvertTime(); #ifndef _DEBUG } catch (...) diff --git a/Sources/Plasma/Apps/plPageOptimizer/plPageOptimizer.cpp b/Sources/Plasma/Apps/plPageOptimizer/plPageOptimizer.cpp index 74c7d241..87d3cf97 100644 --- a/Sources/Plasma/Apps/plPageOptimizer/plPageOptimizer.cpp +++ b/Sources/Plasma/Apps/plPageOptimizer/plPageOptimizer.cpp @@ -135,8 +135,8 @@ void plPageOptimizer::Optimize() if (loaded) IRewritePage(); - UInt32 oldSize = plFileUtils::GetFileSize(fPagePath); - UInt32 newSize = plFileUtils::GetFileSize(fTempPagePath); + uint32_t oldSize = plFileUtils::GetFileSize(fPagePath); + uint32_t newSize = plFileUtils::GetFileSize(fTempPagePath); if (!loaded) { @@ -190,19 +190,19 @@ void plPageOptimizer::IWriteKeyData(hsStream* oldPage, hsStream* newPage, plKey class plUpdateKeyImp : public plKeyImp { public: - void SetStartPos(UInt32 startPos) { fStartPos = startPos; } + void SetStartPos(uint32_t startPos) { fStartPos = startPos; } }; plUpdateKeyImp* keyImp = (plUpdateKeyImp*)(plKeyImp*)key; - UInt32 startPos = keyImp->GetStartPos(); - UInt32 len = keyImp->GetDataLen(); + uint32_t startPos = keyImp->GetStartPos(); + uint32_t len = keyImp->GetDataLen(); oldPage->SetPosition(startPos); if (len > fBuf.size()) fBuf.resize(len); oldPage->Read(len, &fBuf[0]); - UInt32 newStartPos = newPage->GetPosition(); + uint32_t newStartPos = newPage->GetPosition(); // If we move any buffers, this page wasn't optimized already if (newStartPos != startPos) @@ -223,7 +223,7 @@ void plPageOptimizer::IRewritePage() const plPageInfo& pageInfo = fPageNode->GetPageInfo(); - UInt32 dataStart = pageInfo.GetDataStart(); + uint32_t dataStart = pageInfo.GetDataStart(); fBuf.resize(dataStart); @@ -243,31 +243,31 @@ void plPageOptimizer::IRewritePage() IWriteKeyData(&oldPage, &newPage, fAllKeys[i]); } - UInt32 newKeyStart = newPage.GetPosition(); - UInt32 oldKeyStart = pageInfo.GetIndexStart(); + uint32_t newKeyStart = newPage.GetPosition(); + uint32_t oldKeyStart = pageInfo.GetIndexStart(); oldPage.SetPosition(oldKeyStart); - UInt32 numTypes = oldPage.ReadSwap32(); + uint32_t numTypes = oldPage.ReadSwap32(); newPage.WriteSwap32(numTypes); - for (UInt32 i = 0; i < numTypes; i++) + for (uint32_t i = 0; i < numTypes; i++) { - UInt16 classType = oldPage.ReadSwap16(); - UInt32 len = oldPage.ReadSwap32(); - UInt8 flags = oldPage.ReadByte(); - UInt32 numKeys = oldPage.ReadSwap32(); + uint16_t classType = oldPage.ReadSwap16(); + uint32_t len = oldPage.ReadSwap32(); + uint8_t flags = oldPage.ReadByte(); + uint32_t numKeys = oldPage.ReadSwap32(); newPage.WriteSwap16(classType); newPage.WriteSwap32(len); newPage.WriteByte(flags); newPage.WriteSwap32(numKeys); - for (UInt32 j = 0; j < numKeys; j++) + for (uint32_t j = 0; j < numKeys; j++) { plUoid uoid; uoid.Read(&oldPage); - UInt32 startPos = oldPage.ReadSwap32(); - UInt32 dataLen = oldPage.ReadSwap32(); + uint32_t startPos = oldPage.ReadSwap32(); + uint32_t dataLen = oldPage.ReadSwap32(); // Get the new start pos plKeyImp* key = (plKeyImp*)fResMgr->FindKey(uoid); diff --git a/Sources/Plasma/Apps/plPageOptimizer/plPageOptimizer.h b/Sources/Plasma/Apps/plPageOptimizer/plPageOptimizer.h index 3bf8ce5b..69bf573c 100644 --- a/Sources/Plasma/Apps/plPageOptimizer/plPageOptimizer.h +++ b/Sources/Plasma/Apps/plPageOptimizer/plPageOptimizer.h @@ -59,7 +59,7 @@ protected: KeyVec fKeyLoadOrder; // The order objects were loaded in KeySet fLoadedKeys; // Keys we've loaded objects for, for quick lookup KeyVec fAllKeys; // All the keys in the page - std::vector fBuf; + std::vector fBuf; bool fOptimized; // True after optimization if the page was already optimized diff --git a/Sources/Plasma/Apps/plPlasmaUpdate/main.cpp b/Sources/Plasma/Apps/plPlasmaUpdate/main.cpp index 37606e56..aa6d8f4b 100644 --- a/Sources/Plasma/Apps/plPlasmaUpdate/main.cpp +++ b/Sources/Plasma/Apps/plPlasmaUpdate/main.cpp @@ -42,7 +42,6 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "HeadSpin.h" #include "plPlasmaUpdate.h" #include "jvCoreUtil.h" -#include "hsUtils.h" int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { diff --git a/Sources/Plasma/Apps/plPlasmaUpdate/plFileGrabber.cpp b/Sources/Plasma/Apps/plPlasmaUpdate/plFileGrabber.cpp index b5c3332c..bc9798f1 100644 --- a/Sources/Plasma/Apps/plPlasmaUpdate/plFileGrabber.cpp +++ b/Sources/Plasma/Apps/plPlasmaUpdate/plFileGrabber.cpp @@ -126,7 +126,7 @@ bool plNetShareFileGrabber::FileToStream(const char* path, hsStream* stream) if (fileStream.Open(filePath.c_str())) { char* buffer = new char[BUFFER_SIZE]; - UInt32 streamSize = fileStream.GetSizeLeft(); + uint32_t streamSize = fileStream.GetSizeLeft(); while (streamSize > (BUFFER_SIZE)) { fileStream.Read(BUFFER_SIZE, buffer); diff --git a/Sources/Plasma/Apps/plPlasmaUpdate/plManifest.cpp b/Sources/Plasma/Apps/plPlasmaUpdate/plManifest.cpp index 0ca9ffce..1b5c7c07 100644 --- a/Sources/Plasma/Apps/plPlasmaUpdate/plManifest.cpp +++ b/Sources/Plasma/Apps/plPlasmaUpdate/plManifest.cpp @@ -40,7 +40,6 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ #include "HeadSpin.h" -#include "hsUtils.h" #include "plManifest.h" #include "../plEncryption/plChecksum.h" @@ -55,9 +54,9 @@ public: char* fFilename; plMD5Checksum fSum; plMD5Checksum fLocalSum; - UInt32 fSize; - UInt32 fCompressedSize; - UInt32 fFlags; + uint32_t fSize; + uint32_t fCompressedSize; + uint32_t fFlags; }; plManifest::plManifest(LogFunc log) : @@ -175,8 +174,8 @@ void plManifest::DownloadUpdates(ProgressFunc progress, plFileGrabber* grabber) if (localStream.Open(file->fFilename, "wb")) { char dataBuf[1024]; - UInt32 sizeLeft = serverStream.GetSizeLeft(); - while (UInt32 amtRead = serverStream.Read( (sizeof(dataBuf) > sizeLeft) ? sizeLeft : sizeof(dataBuf), dataBuf)) + uint32_t sizeLeft = serverStream.GetSizeLeft(); + while (uint32_t amtRead = serverStream.Read( (sizeof(dataBuf) > sizeLeft) ? sizeLeft : sizeof(dataBuf), dataBuf)) { progress(file->fFilename, amtRead); @@ -228,7 +227,7 @@ void plManifest::IWriteCache() bool openedFile = false; - UInt32 numFiles = 0; + uint32_t numFiles = 0; for (int i = 0; i < fFiles.size(); i++) { plManifestFile* file = fFiles[i]; @@ -278,8 +277,8 @@ void plManifest::IReadCache(ProgressFunc progress) if (s) { - UInt32 numCached = s->ReadSwap32(); - UInt32 cacheFileVersion = s->ReadSwap32(); + uint32_t numCached = s->ReadSwap32(); + uint32_t cacheFileVersion = s->ReadSwap32(); if (cacheFileVersion != kCacheFileVersion) { @@ -294,7 +293,7 @@ void plManifest::IReadCache(ProgressFunc progress) { char* name = s->ReadSafeString(); - UInt8 checksumBuf[MD5_DIGEST_LENGTH]; + uint8_t checksumBuf[MD5_DIGEST_LENGTH]; s->Read(sizeof(checksumBuf), checksumBuf); plMD5Checksum checksum; checksum.SetValue(checksumBuf); @@ -349,7 +348,7 @@ bool plManifest::IDecompressSound(plManifestFile* file) plAudioFileReader* reader = plAudioFileReader::CreateReader(file->fFilename, plAudioCore::kAll, plAudioFileReader::kStreamNative); if (!reader) return false; - UInt32 size = reader->GetDataSize(); + uint32_t size = reader->GetDataSize(); delete reader; if (hsCheckBits(file->fFlags, kSndFlagCacheSplit)) diff --git a/Sources/Plasma/Apps/plPlasmaUpdate/plManifest.h b/Sources/Plasma/Apps/plPlasmaUpdate/plManifest.h index aa5caf0f..f9ff0162 100644 --- a/Sources/Plasma/Apps/plPlasmaUpdate/plManifest.h +++ b/Sources/Plasma/Apps/plPlasmaUpdate/plManifest.h @@ -42,7 +42,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #ifndef plManifest_h_inc #define plManifest_h_inc -#include "hsTypes.h" +#include "HeadSpin.h" #include "plFileGrabber.h" #include #include @@ -61,8 +61,8 @@ protected: typedef std::vector FileVec; FileVec fFiles; - UInt32 fDownloadFiles; - UInt32 fDownloadBytes; + uint32_t fDownloadFiles; + uint32_t fDownloadBytes; bool fDirtySums; @@ -86,8 +86,8 @@ public: void DownloadUpdates(ProgressFunc progress, plFileGrabber* grabber); int NumFiles() { return fFiles.size(); } - UInt32 NumDownloadFiles() { return fDownloadFiles; } - UInt32 DownloadSize() { return fDownloadBytes; } + uint32_t NumDownloadFiles() { return fDownloadFiles; } + uint32_t DownloadSize() { return fDownloadBytes; } }; #endif // plManifest_h_inc \ No newline at end of file diff --git a/Sources/Plasma/Apps/plPlasmaUpdate/plPlasmaServers.cpp b/Sources/Plasma/Apps/plPlasmaUpdate/plPlasmaServers.cpp index 0fd36040..2f5af516 100644 --- a/Sources/Plasma/Apps/plPlasmaUpdate/plPlasmaServers.cpp +++ b/Sources/Plasma/Apps/plPlasmaUpdate/plPlasmaServers.cpp @@ -41,7 +41,6 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ #include "plPlasmaServers.h" #include "hsStream.h" -#include "hsUtils.h" bool plPlasmaServers::GetServerInfo() { diff --git a/Sources/Plasma/Apps/plPlasmaUpdate/plPlasmaServers.h b/Sources/Plasma/Apps/plPlasmaUpdate/plPlasmaServers.h index de908aaa..3890f257 100644 --- a/Sources/Plasma/Apps/plPlasmaUpdate/plPlasmaServers.h +++ b/Sources/Plasma/Apps/plPlasmaUpdate/plPlasmaServers.h @@ -42,7 +42,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #ifndef plPlasmaServers_h_inc #define plPlasmaServers_h_inc -#include "hsTypes.h" +#include "HeadSpin.h" #include class plPlasmaServers diff --git a/Sources/Plasma/Apps/plPlasmaUpdate/plPlasmaUpdate.cpp b/Sources/Plasma/Apps/plPlasmaUpdate/plPlasmaUpdate.cpp index 109c5cbb..04b4f5b4 100644 --- a/Sources/Plasma/Apps/plPlasmaUpdate/plPlasmaUpdate.cpp +++ b/Sources/Plasma/Apps/plPlasmaUpdate/plPlasmaUpdate.cpp @@ -53,7 +53,6 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "../plUnifiedTime/plUnifiedTime.h" #include "hsStream.h" #include "plManifest.h" -#include "hsUtils.h" #include "../plStatusLog/plStatusLog.h" static plPlasmaUpdate* gInst = nil; @@ -360,7 +359,7 @@ void plPlasmaUpdate::IUpdateServer() // Get the manifests // bool gotManifests = IGetManifests(serverRoot, external); - UInt32 dlSize = 0; + uint32_t dlSize = 0; fProgressType = kValidating; @@ -368,7 +367,7 @@ void plPlasmaUpdate::IUpdateServer() { int i; - UInt32 numFiles = 0; + uint32_t numFiles = 0; for (i = 0; i < fManifests.size(); i++) numFiles += fManifests[i]->NumFiles(); @@ -413,7 +412,7 @@ void plPlasmaUpdate::IDownloadUpdates() int i; - UInt32 dlSize = 0; + uint32_t dlSize = 0; for (i = 0; i < fManifests.size(); i++) dlSize += fManifests[i]->DownloadSize(); diff --git a/Sources/Plasma/Apps/plPythonPack/CMakeLists.txt b/Sources/Plasma/Apps/plPythonPack/CMakeLists.txt index 3fd9cf70..6c170425 100644 --- a/Sources/Plasma/Apps/plPythonPack/CMakeLists.txt +++ b/Sources/Plasma/Apps/plPythonPack/CMakeLists.txt @@ -13,7 +13,7 @@ set(plPythonPack_HEADERS ) add_executable(plPythonPack ${plPythonPack_SOURCES} ${plPythonPack_HEADERS}) -target_link_libraries(plPythonPack CoreLib CoreLibExe plFile) +target_link_libraries(plPythonPack CoreLib plFile) if(PYTHON_DEBUG_LIBRARY) target_link_libraries(plPythonPack debug ${PYTHON_DEBUG_LIBRARY}) diff --git a/Sources/Plasma/Apps/plPythonPack/PythonInterface.cpp b/Sources/Plasma/Apps/plPythonPack/PythonInterface.cpp index d6db9154..6685c47e 100644 --- a/Sources/Plasma/Apps/plPythonPack/PythonInterface.cpp +++ b/Sources/Plasma/Apps/plPythonPack/PythonInterface.cpp @@ -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* size) +hsBool 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 diff --git a/Sources/Plasma/Apps/plPythonPack/PythonInterface.h b/Sources/Plasma/Apps/plPythonPack/PythonInterface.h index 8956a330..b2480c6b 100644 --- a/Sources/Plasma/Apps/plPythonPack/PythonInterface.h +++ b/Sources/Plasma/Apps/plPythonPack/PythonInterface.h @@ -40,7 +40,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ #include -#include "hsTypes.h" +#include "HeadSpin.h" #include @@ -52,7 +52,7 @@ namespace PythonInterface void addPythonPath(std::string dir); PyObject* CompileString(const char *command, const char* filename); - hsBool DumpObject(PyObject* pyobj, char** pickle, Int32* size); + hsBool DumpObject(PyObject* pyobj, char** pickle, int32_t* size); int getOutputAndReset(char** line=nil); PyObject* CreateModule(const char* module); hsBool RunPYC(PyObject* code, PyObject* module); diff --git a/Sources/Plasma/Apps/plPythonPack/main.cpp b/Sources/Plasma/Apps/plPythonPack/main.cpp index 56940d57..234c4d16 100644 --- a/Sources/Plasma/Apps/plPythonPack/main.cpp +++ b/Sources/Plasma/Apps/plPythonPack/main.cpp @@ -91,18 +91,18 @@ void WritePythonFile(std::string fileName, std::string path, hsStream *s) printf("==Packing %s, ",fileName.c_str()); pyStream.FastFwd(); - UInt32 pyFileSize = pyStream.GetPosition(); + uint32_t pyFileSize = pyStream.GetPosition(); pyStream.Rewind(); glueStream.FastFwd(); - UInt32 glueFileSize = glueStream.GetPosition(); + uint32_t glueFileSize = glueStream.GetPosition(); glueStream.Rewind(); - UInt32 totalSize = pyFileSize + glueFileSize + 2; + uint32_t totalSize = pyFileSize + glueFileSize + 2; char *code = new char[totalSize]; - UInt32 amountRead = pyStream.Read(pyFileSize, code); + uint32_t amountRead = pyStream.Read(pyFileSize, code); hsAssert(amountRead == pyFileSize, "Bad read"); code[pyFileSize] = '\n'; @@ -189,7 +189,7 @@ void WritePythonFile(std::string fileName, std::string path, hsStream *s) // make sure that we have code to save if (pythonCode) { - Int32 size; + int32_t size; char* pycode; PythonInterface::DumpObject(pythonCode,&pycode,&size); @@ -420,21 +420,21 @@ void PackDirectory(std::string dir, std::string rootPath, std::string pakName, s // set to maximum optimization (includes removing __doc__ strings) Py_OptimizeFlag = 2; - std::vector filePositions; + std::vector filePositions; filePositions.resize(fileNames.size()); for (i = 0; i < fileNames.size(); i++) { // strip '.py' from the file name std::string properFileName = fileNames[i].substr(0, fileNames[i].size()-3); - UInt32 initialPos = s.GetPosition(); + uint32_t initialPos = s.GetPosition(); WritePythonFile(properFileName, pathNames[i], &s); - UInt32 endPos = s.GetPosition(); + uint32_t endPos = s.GetPosition(); filePositions[i] = initialPos; } - s.SetPosition(sizeof(UInt32)); + s.SetPosition(sizeof(uint32_t)); for (i = 0; i < fileNames.size(); i++) { s.WriteSafeString(fileNames[i].c_str()); diff --git a/Sources/Plasma/Apps/plUruLauncher/CMakeLists.txt b/Sources/Plasma/Apps/plUruLauncher/CMakeLists.txt index c759488c..705e4586 100644 --- a/Sources/Plasma/Apps/plUruLauncher/CMakeLists.txt +++ b/Sources/Plasma/Apps/plUruLauncher/CMakeLists.txt @@ -33,7 +33,6 @@ if(PLASMA_EXTERNAL_RELEASE) set_target_properties(plUruLauncher PROPERTIES OUTPUT_NAME UruLauncher) endif(PLASMA_EXTERNAL_RELEASE) target_link_libraries(plUruLauncher CoreLib) -target_link_libraries(plUruLauncher CoreLibExe) target_link_libraries(plUruLauncher pfConsoleCore) target_link_libraries(plUruLauncher plAudioCore) target_link_libraries(plUruLauncher plClientPatcher) diff --git a/Sources/Plasma/Apps/plUruLauncher/Main.cpp b/Sources/Plasma/Apps/plUruLauncher/Main.cpp index 739ad3a0..3b27e30b 100644 --- a/Sources/Plasma/Apps/plUruLauncher/Main.cpp +++ b/Sources/Plasma/Apps/plUruLauncher/Main.cpp @@ -151,7 +151,7 @@ static CEvent s_dialogCreateEvent(kEventManualReset); static CCritSect s_critsect; static LISTDECL(WndEvent, link) s_eventQ; static CEvent s_shutdownEvent(kEventManualReset); -static wchar s_workingDir[MAX_PATH]; +static wchar_t s_workingDir[MAX_PATH]; static CEvent s_statusEvent(kEventManualReset); static char s_curlError[CURL_ERROR_SIZE]; @@ -202,8 +202,8 @@ static void PostEvent (WndEvent *event) { } //============================================================================ -static void LogV (ELogSev sev, const wchar fmt[], va_list args) { - static struct { FILE * file; const wchar * pre; } s_log[] = { +static void LogV (ELogSev sev, const wchar_t fmt[], va_list args) { + static struct { FILE * file; const wchar_t * pre; } s_log[] = { { stdout, L"Inf" }, { stderr, L"Err" }, }; @@ -218,7 +218,7 @@ static void LogV (ELogSev sev, const wchar fmt[], va_list args) { } //============================================================================ -static void Log (ELogSev sev, const wchar fmt[], ...) { +static void Log (ELogSev sev, const wchar_t fmt[], ...) { va_list args; va_start(args, fmt); LogV(sev, fmt, args); @@ -227,7 +227,7 @@ static void Log (ELogSev sev, const wchar fmt[], ...) { //============================================================================ // NOTE: Must use LocalFree() on the return value of this function when finished with the string -static wchar *TranslateErrorCode(DWORD errorCode) { +static wchar_t *TranslateErrorCode(DWORD errorCode) { LPVOID lpMsgBuf; FormatMessageW( @@ -236,11 +236,11 @@ static wchar *TranslateErrorCode(DWORD errorCode) { NULL, errorCode, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), - (wchar *) &lpMsgBuf, + (wchar_t *) &lpMsgBuf, 0, NULL ); - return (wchar *)lpMsgBuf; + return (wchar_t *)lpMsgBuf; } //============================================================================ @@ -409,7 +409,7 @@ static void DispatchEvents (HWND hwnd) { DISPATCH(SetBytesRemaining); DEFAULT_FATAL(event->type); } - DEL(event); // unlinks from list + delete event; // unlinks from list } #undef DISPATCH } @@ -531,7 +531,7 @@ static void WindowThreadProc(void *) { SetTimer(s_dialog, kEventTimer, 250, 0); char productString[256]; - wchar productStringW[256]; + wchar_t productStringW[256]; ProductString(productStringW, arrsize(productStringW)); StrToAnsi(productString, productStringW, arrsize(productString)); SendMessage(GetDlgItem(s_dialog, IDC_PRODUCTSTRING), WM_SETTEXT, 0, (LPARAM) productString); @@ -740,8 +740,8 @@ int __stdcall WinMain ( ){ PF_CONSOLE_INITIALIZE(Core) - wchar token[256]; - const wchar *appCmdLine = AppGetCommandLine(); + wchar_t token[256]; + const wchar_t *appCmdLine = AppGetCommandLine(); StrTokenize(&appCmdLine, token, arrsize(token), WHITESPACE); while(!StrStr(token, L".exe") && !StrStr(token, L".tmp")) { @@ -750,8 +750,8 @@ int __stdcall WinMain ( while (*appCmdLine == L' ') ++appCmdLine; - wchar curPatcherFile[MAX_PATH]; - wchar newPatcherFile[MAX_PATH]; + wchar_t curPatcherFile[MAX_PATH]; + wchar_t newPatcherFile[MAX_PATH]; bool isTempPatcher = false; PathGetProgramName(curPatcherFile, arrsize(curPatcherFile)); @@ -774,13 +774,13 @@ int __stdcall WinMain ( TGDoCiderDetection (); s_hInstance = hInstance; - ZERO(s_launcherInfo); + memset(&s_launcherInfo, 0, sizeof(s_launcherInfo)); StrPrintf(s_launcherInfo.cmdLine, arrsize(s_launcherInfo.cmdLine), appCmdLine); s_launcherInfo.returnCode = 0; curl_global_init(CURL_GLOBAL_ALL); - const wchar *serverIni = L"server.ini"; + const wchar_t *serverIni = L"server.ini"; if(cmdParser.IsSpecified(kArgServerIni)) serverIni = cmdParser.GetString(kArgServerIni); @@ -835,9 +835,9 @@ int __stdcall WinMain ( Sleep(1000); if (!PathDeleteFile(newPatcherFile)) { - wchar error[256]; + wchar_t error[256]; DWORD errorCode = GetLastError(); - wchar *msg = TranslateErrorCode(errorCode); + wchar_t *msg = TranslateErrorCode(errorCode); StrPrintf(error, arrsize(error), L"Failed to delete old patcher executable. %s", msg); MessageBoxW(GetTopWindow(nil), error, L"Error", MB_OK); @@ -845,9 +845,9 @@ int __stdcall WinMain ( break; } if (!PathMoveFile(curPatcherFile, newPatcherFile)) { - wchar error[256]; + wchar_t error[256]; DWORD errorCode = GetLastError(); - wchar *msg = TranslateErrorCode(errorCode); + wchar_t *msg = TranslateErrorCode(errorCode); StrPrintf(error, arrsize(error), L"Failed to replace old patcher executable. %s", msg); MessageBoxW(GetTopWindow(nil), error, L"Error", MB_OK); @@ -860,11 +860,11 @@ int __stdcall WinMain ( // launch new patcher STARTUPINFOW si; PROCESS_INFORMATION pi; - ZERO(si); - ZERO(pi); + memset(&si, 0, sizeof(si)); + memset(&pi, 0, sizeof(pi)); si.cb = sizeof(si); - wchar cmdline[MAX_PATH]; + wchar_t cmdline[MAX_PATH]; StrPrintf(cmdline, arrsize(cmdline), L"%s %s", newPatcherFile, s_launcherInfo.cmdLine); // we have only successfully patched if we actually launch the new version of the patcher @@ -891,7 +891,7 @@ int __stdcall WinMain ( // Clean up old temp files ARRAY(PathFind) paths; - wchar fileSpec[MAX_PATH]; + wchar_t fileSpec[MAX_PATH]; PathGetProgramDirectory(fileSpec, arrsize(fileSpec)); PathAddFilename(fileSpec, fileSpec, L"*.tmp", arrsize(fileSpec)); PathFindFiles(&paths, fileSpec, kPathFlagFile); @@ -937,7 +937,7 @@ int __stdcall WinMain ( // Self-patch failed SetText("Self-patch failed. Exiting..."); if (!s_shutdown) { - wchar str[256]; + wchar_t str[256]; StrPrintf(str, arrsize(str), L"Patcher update failed. Error %u, %s", selfPatchResult, NetErrorToString(selfPatchResult)); MessageBoxW(GetTopWindow(nil), str, L"Error", MB_OK); } @@ -990,7 +990,7 @@ void SetReturnCode (DWORD retCode) { //============================================================================ void SetProgress (unsigned progress) { - SetProgressEvent *event = NEW(SetProgressEvent); + SetProgressEvent *event = new SetProgressEvent(); event->type = kEventSetProgress; event->progress = progress; PostEvent(event); @@ -998,7 +998,7 @@ void SetProgress (unsigned progress) { //============================================================================ void SetText (const char text[]) { - SetTextEvent *event = NEW(SetTextEvent); + SetTextEvent *event = new SetTextEvent(); event->type = kEventSetText; StrCopy(event->text, text, arrsize(event->text)); PostEvent(event); @@ -1006,7 +1006,7 @@ void SetText (const char text[]) { //============================================================================ void SetStatusText (const char text[]) { - SetTextEvent *event = NEW(SetTextEvent); + SetTextEvent *event = new SetTextEvent(); event->type = kEventSetStatusText; StrCopy(event->text, text, arrsize(event->text)); PostEvent(event); diff --git a/Sources/Plasma/Apps/plUruLauncher/SelfPatcher.cpp b/Sources/Plasma/Apps/plUruLauncher/SelfPatcher.cpp index de2d9dc4..2f39689e 100644 --- a/Sources/Plasma/Apps/plUruLauncher/SelfPatcher.cpp +++ b/Sources/Plasma/Apps/plUruLauncher/SelfPatcher.cpp @@ -56,14 +56,14 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com ***/ #ifndef PLASMA_EXTERNAL_RELEASE - static const wchar s_manifest[] = L"InternalPatcher"; + static const wchar_t s_manifest[] = L"InternalPatcher"; #else - static const wchar s_manifest[] = L"ExternalPatcher"; + static const wchar_t s_manifest[] = L"ExternalPatcher"; #endif class SelfPatcherStream : public plZlibStream { public: - virtual UInt32 Write(UInt32 byteCount, const void* buffer); + virtual uint32_t Write(uint32_t byteCount, const void* buffer); static plLauncherInfo *info; static unsigned totalBytes; static unsigned progress; @@ -76,7 +76,7 @@ static bool s_downloadComplete; static long s_numFiles; static ENetError s_patchResult; static bool s_updated; -static wchar s_newPatcherFile[MAX_PATH]; +static wchar_t s_newPatcherFile[MAX_PATH]; /***************************************************************************** @@ -105,7 +105,7 @@ static void NetErrorHandler (ENetProtocol protocol, ENetError error) { static void DownloadCallback ( ENetError result, void * param, - const wchar filename[], + const wchar_t filename[], hsStream * writer ) { if(IS_NET_ERROR(result)) { @@ -135,7 +135,7 @@ static void DownloadCallback ( } //============================================================================ -static bool MD5Check (const char filename[], const wchar md5[]) { +static bool MD5Check (const char filename[], const wchar_t md5[]) { // Do md5 check char md5copy[MAX_PATH]; plMD5Checksum existingMD5(filename); @@ -150,7 +150,7 @@ static bool MD5Check (const char filename[], const wchar md5[]) { static void ManifestCallback ( ENetError result, void * param, - const wchar group[], + const wchar_t group[], const NetCliFileManifestEntry manifest[], unsigned entryCount ) { @@ -180,7 +180,7 @@ static void ManifestCallback ( // MD5 check current patcher against value in manifest ASSERT(entryCount == 1); - wchar curPatcherFile[MAX_PATH]; + wchar_t curPatcherFile[MAX_PATH]; PathGetProgramName(curPatcherFile, arrsize(curPatcherFile)); StrToAnsi(ansi, curPatcherFile, arrsize(ansi)); if (!MD5Check(ansi, manifest[0].md5)) { @@ -193,7 +193,7 @@ static void ManifestCallback ( StrToAnsi(ansi, s_newPatcherFile, arrsize(ansi)); SelfPatcherStream * stream = NEWZERO(SelfPatcherStream); if (!stream->Open(ansi, "wb")) - ErrorFatal(__LINE__, __FILE__, "Failed to create file: %s, errno: %u", ansi, errno); + ErrorAssert(__LINE__, __FILE__, "Failed to create file: %s, errno: %u", ansi, errno); NetCliFileDownloadRequest(manifest[0].downloadName, stream, DownloadCallback, nil); } @@ -206,7 +206,7 @@ static void ManifestCallback ( static void FileSrvIpAddressCallback ( ENetError result, void * param, - const wchar addr[] + const wchar_t addr[] ) { NetCliGateKeeperDisconnect(); @@ -236,7 +236,7 @@ static bool SelfPatcherProc (bool * abort, plLauncherInfo *info) { NetClientInitialize(); NetClientSetErrorHandler(NetErrorHandler); - const wchar ** addrs; + const wchar_t ** addrs; unsigned count; count = GetGateKeeperSrvHostnames(&addrs); @@ -263,11 +263,11 @@ static bool SelfPatcherProc (bool * abort, plLauncherInfo *info) { // launch new patcher STARTUPINFOW si; PROCESS_INFORMATION pi; - ZERO(si); - ZERO(pi); + memset(&si, 0, sizeof(si)); + memset(&pi, 0, sizeof(pi)); si.cb = sizeof(si); - wchar cmdline[MAX_PATH]; + wchar_t cmdline[MAX_PATH]; StrPrintf(cmdline, arrsize(cmdline), L"%s %s", s_newPatcherFile, info->cmdLine); // we have only successfully patched if we actually launch the new version of the patcher @@ -300,7 +300,7 @@ static bool SelfPatcherProc (bool * abort, plLauncherInfo *info) { ***/ //============================================================================ -UInt32 SelfPatcherStream::Write(UInt32 byteCount, const void* buffer) { +uint32_t SelfPatcherStream::Write(uint32_t byteCount, const void* buffer) { progress += byteCount; float p = (float)progress / (float)totalBytes * 100; // progress SetProgress( (int)p ); diff --git a/Sources/Plasma/Apps/plUruLauncher/plLauncherInfo.h b/Sources/Plasma/Apps/plUruLauncher/plLauncherInfo.h index 4874dfa2..9c06e732 100644 --- a/Sources/Plasma/Apps/plUruLauncher/plLauncherInfo.h +++ b/Sources/Plasma/Apps/plUruLauncher/plLauncherInfo.h @@ -69,8 +69,8 @@ typedef void (*setTimeRemainingCallback)(unsigned seconds); typedef void (*setBytesRemainingCallback)(unsigned bytes); struct plLauncherInfo { - wchar path[MAX_PATH]; - wchar cmdLine[512]; + wchar_t path[MAX_PATH]; + wchar_t cmdLine[512]; unsigned buildId; // buildId override launcherCallback prepCallback; launcherCallback initCallback; diff --git a/Sources/Plasma/CMakeLists.txt b/Sources/Plasma/CMakeLists.txt index 104d0fa5..5d749c64 100644 --- a/Sources/Plasma/CMakeLists.txt +++ b/Sources/Plasma/CMakeLists.txt @@ -1,6 +1,5 @@ add_subdirectory(Apps) add_subdirectory(CoreLib) -add_subdirectory(CoreLibExe) add_subdirectory(FeatureLib) add_subdirectory(NucleusLib) add_subdirectory(PubUtilLib) diff --git a/Sources/Plasma/CoreLib/CMakeLists.txt b/Sources/Plasma/CoreLib/CMakeLists.txt index c6ad4945..e4cf8278 100644 --- a/Sources/Plasma/CoreLib/CMakeLists.txt +++ b/Sources/Plasma/CoreLib/CMakeLists.txt @@ -19,11 +19,9 @@ set(CoreLib_SOURCES hsExceptionStack.cpp hsFastMath.cpp hsGeometry3.cpp - hsMalloc.cpp hsMatrix33.cpp hsMatrix44.cpp hsMemory.cpp - hsMMIOStream.cpp hsQuat.cpp hsSafeRefCnt.cpp hsSTLStream.cpp @@ -59,35 +57,27 @@ set(CoreLib_HEADERS hsBitVector.h hsBounds.h hsColorRGBA.h - hsConfig.h hsCritSect.h hsExceptions.h hsFastMath.h - hsFixedTypes.h hsGeometry3.h hsHashTable.h - hsMalloc.h hsMatrix44.h hsMemory.h - hsMMIOStream.h hsPoint2.h hsQuat.h - hsQueue.h hsRefCnt.h hsSafeRefCnt.h - hsScalar.h hsStlSortUtils.h hsSTLStream.h hsStlUtils.h hsStream.h hsStringTokenizer.h hsTemplates.h - hsTempPointer.h hsThread.h hsTypes.h hsUtils.h hsWide.h - hsWindowHndl.h hsWindows.h pcSmallRect.h plGeneric.h diff --git a/Sources/Plasma/CoreLib/HS_POINT2.inc b/Sources/Plasma/CoreLib/HS_POINT2.inc deleted file mode 100644 index 30d95867..00000000 --- a/Sources/Plasma/CoreLib/HS_POINT2.inc +++ /dev/null @@ -1,61 +0,0 @@ -struct HS_POINT2_NAME { - HS_POINT2_TYPE fX, fY; - - HS_POINT2_NAME& Set(HS_POINT2_TYPE x, HS_POINT2_TYPE y) - { - fX = x; - fY = y; - return *this; - } - HS_POINT2_NAME& operator+=(const HS_POINT2_NAME& s) - { - this->fX += s.fX; - this->fY += s.fY; - return *this; - } - HS_POINT2_NAME& operator-=(const HS_POINT2_NAME& s) - { - this->fX -= s.fX; - this->fY -= s.fY; - return *this; - } - -#if 0 // Havok reeks - friend int operator==(const HS_POINT2_NAME& s, const HS_POINT2_NAME& t) - { - return (s.fX == t.fX && s.fY == t.fY); - } - friend int operator!=(const HS_POINT2_NAME& s, const HS_POINT2_NAME& t) - { - return !(s == t); - } -#else // Havok reeks - int operator==(const HS_POINT2_NAME& ss) const - { - return (ss.fX == fX && ss.fY == fY); - } - int operator!=(const HS_POINT2_NAME& ss) - { - return !(ss == *this); - } -#endif // Havok reeks - friend HS_POINT2_NAME operator+(const HS_POINT2_NAME& s, const HS_POINT2_NAME& t) - { - HS_POINT2_NAME result; - result.Set(s.fX + t.fX, s.fY + t.fY); - return result; - } - friend HS_POINT2_NAME operator-(const HS_POINT2_NAME& s, const HS_POINT2_NAME& t) - { - HS_POINT2_NAME result; - result.Set(s.fX - t.fX, s.fY - t.fY); - return result; - } - friend HS_POINT2_NAME operator-(const HS_POINT2_NAME& s) - { - HS_POINT2_NAME result = { -s.fX, -s.fY }; - return result; - } - -#undef HS_POINT2_NAME -#undef HS_POINT2_TYPE diff --git a/Sources/Plasma/CoreLib/HeadSpin.cpp b/Sources/Plasma/CoreLib/HeadSpin.cpp index 2dd1ef1d..c9a50e54 100644 --- a/Sources/Plasma/CoreLib/HeadSpin.cpp +++ b/Sources/Plasma/CoreLib/HeadSpin.cpp @@ -41,18 +41,12 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ #include "HeadSpin.h" #include "hsRefCnt.h" -#include "hsUtils.h" #include "hsStlUtils.h" #include "hsExceptions.h" +#include - -#if HS_BUILD_FOR_WIN32 #ifdef _MSC_VER -# include /* for _RPT_BASE */ -#endif -# define WIN32_LEAN_AND_MEAN -# define WIN32_EXTRA_LEAN -# include // For OutputDebugString() +# include #endif @@ -88,16 +82,10 @@ void hsDebugMessage (const char message[], long val) { char s[1024]; -#if HS_BUILD_FOR_WIN32 - #define strfmt _snprintf -#else - #define strfmt snprintf -#endif - if (val) - s[0] = strfmt(&s[1], 1022, "%s: %ld", message, val); + s[0] = snprintf(&s[1], 1022, "%s: %ld", message, val); else - s[0] = strfmt(&s[1], 1022, "%s", message); + s[0] = snprintf(&s[1], 1022, "%s", message); if (gHSDebugProc) gHSDebugProc(&s[1]); @@ -116,6 +104,93 @@ void hsDebugMessage (const char message[], long val) } #endif +static bool s_GuiAsserts = true; +void ErrorEnableGui(bool enabled) +{ + s_GuiAsserts = enabled; +} + +void ErrorAssert(int line, const char file[], const char fmt[], ...) +{ +#if defined(HS_DEBUGGING) || !defined(PLASMA_EXTERNAL_RELEASE) + char msg[1024]; + va_list args; + va_start(args, fmt); + vsnprintf(msg, sizeof(msg), fmt, args); +#ifdef HS_DEBUGGING + if (s_GuiAsserts) + { + if(_CrtDbgReport(_CRT_ASSERT, file, line, NULL, msg)) + DebugBreak(); + } else +#endif // HS_DEBUGGING + if (DebugIsDebuggerPresent()) { + char str[] = "-------\nASSERTION FAILED:\nFile: %s Line: %i\nMessage: %s\n-------"; + DebugMsg(str, file, line, msg); + } +#else + DebugBreakIfDebuggerPresent(); +#endif // defined(HS_DEBUGGING) || !defined(PLASMA_EXTERNAL_RELEASE) +} + +bool DebugIsDebuggerPresent() +{ +#ifdef _MSC_VER + return IsDebuggerPresent(); +#else + // FIXME + return false; +#endif +} + +void DebugBreakIfDebuggerPresent() +{ +#ifdef _MSC_VER + __try + { + __debugbreak(); + } __except(EXCEPTION_EXECUTE_HANDLER) { + // Debugger not present or some such shwiz. + // Whatever. Don't crash here. + } +#endif // _MSC_VER +} + +void DebugMsg(const char fmt[], ...) +{ + char msg[1024]; + va_list args; + va_start(args, fmt); + vsnprintf(msg, sizeof(msg), fmt, args); + + if (DebugIsDebuggerPresent()) + { +#ifdef _MSC_VER + OutputDebugStringA(msg); + OutputDebugStringA("\n"); +#endif + } else { + fprintf(stderr, msg); + fprintf(stderr, "\n"); + } +} + +void ErrorMinimizeAppWindow () +{ +#ifdef HS_BUILD_FOR_WIN32 + // If the application's topmost window is a fullscreen + // popup window, minimize it before displaying an error + HWND appWindow = GetActiveWindow(); + if ( ((GetWindowLong(appWindow, GWL_STYLE) & WS_POPUP) != 0) ) + SetWindowPos( + appWindow, + HWND_NOTOPMOST, + 0, 0, // position + 0, 0, // size + SWP_HIDEWINDOW | SWP_NOMOVE | SWP_NOSIZE + ); +#endif +} /////////////////////////////////////////////////////////////////// diff --git a/Sources/Plasma/CoreLib/HeadSpin.h b/Sources/Plasma/CoreLib/HeadSpin.h index ac14da11..0405e223 100644 --- a/Sources/Plasma/CoreLib/HeadSpin.h +++ b/Sources/Plasma/CoreLib/HeadSpin.h @@ -42,10 +42,14 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #ifndef HeadSpinHDefined #define HeadSpinHDefined -#include "hsConfig.h" -// Winsock2 compatibility; winsock2.h must always be included before windows.h =( +#if (defined(_DEBUG) || defined(UNIX_DEBUG)) +# define HS_DEBUGGING +#endif // defined(_DEBUG) || defined(UNIX_DENUG) + +// Internal Headers +// These are only ever included here :) #include "hsWindows.h" #include "hsTypes.h" -#include "hsMalloc.h" +#include "hsUtils.h" #endif diff --git a/Sources/Plasma/CoreLib/hsBiExpander.h b/Sources/Plasma/CoreLib/hsBiExpander.h index 64823c27..7e07aa65 100644 --- a/Sources/Plasma/CoreLib/hsBiExpander.h +++ b/Sources/Plasma/CoreLib/hsBiExpander.h @@ -51,14 +51,14 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com /////////////////////////////////////////////////////////////////////////////// template class hsExpander { private: - Int32 fNumPost; - Int32 fNumPostAlloc; + int32_t fNumPost; + int32_t fNumPostAlloc; T* fArray; - Int32 fGrowBy; // default = 0, to double - Int32 fMinSize; // default = 1, min == 1 + int32_t fGrowBy; // default = 0, to double + int32_t fMinSize; // default = 1, min == 1 - Int32 fCurrent; + int32_t fCurrent; hsExpander(const hsExpander& x); // make it passed as ref or pointer @@ -66,29 +66,29 @@ private: public: enum { kMissingIndex = -1 }; - hsExpander(Int32 minSize = 1, Int32 growBy = 0); + hsExpander(int32_t minSize = 1, int32_t growBy = 0); virtual ~hsExpander(); hsExpander& operator=(const hsExpander&orig) { return Copy(orig); } hsExpander& Copy(const hsExpander& orig); void SetCount(int cnt) { if( cnt >= fNumPostAlloc )IExpand(cnt); fNumPost = cnt; } - Int32 GetCount() const { return fNumPost; } + int32_t GetCount() const { return fNumPost; } hsBool Empty() const { return GetCount() == 0; } - const T& Get(Int32 index) const; - Int32 Get(Int32 index, Int32 count, T data[]) const; - Int32 Find(const T&) const; // returns kMissingIndex if not found + 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 cnt); + void SetArray(T* a, int32_t cnt); T* GetArray() { return fArray; } - T& operator[]( Int32 index ); - Int32 Append(const T&); // returns t's index + T& operator[]( int32_t index ); + int32_t Append(const T&); // returns t's index T* Append(); - Int32 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 Pop(T* t); // returns count of remaining - Int32 Pop(); + int32_t Pop(T* t); // returns count of remaining + int32_t Pop(); void Reset(); // clears out everything T& Head() { return fArray[0]; } @@ -111,7 +111,7 @@ hsExpander& hsExpander::Copy(const hsExpander& orig) } template -void hsExpander::SetArray(T* a, Int32 cnt) +void hsExpander::SetArray(T* a, int32_t cnt) { delete [] fArray; if( a ) @@ -122,12 +122,12 @@ void hsExpander::SetArray(T* a, Int32 cnt) template void hsExpander::IExpand(int newSize) { - Int32 newPostAlloc = fNumPostAlloc; + int32_t newPostAlloc = fNumPostAlloc; if( !newPostAlloc ) newPostAlloc++; while( newPostAlloc <= newSize ) newPostAlloc = fGrowBy ? newPostAlloc + fGrowBy : newPostAlloc << 1; - T* newArray = TRACKED_NEW T[newPostAlloc]; + T* newArray = new T[newPostAlloc]; int i; for( i = 0; i < fNumPost; i++ ) newArray[i] = fArray[i]; @@ -137,7 +137,7 @@ void hsExpander::IExpand(int newSize) } template -hsExpander::hsExpander(Int32 minSize, Int32 growBy) +hsExpander::hsExpander(int32_t minSize, int32_t growBy) { hsThrowIfBadParam(minSize < 0); hsThrowIfBadParam(growBy < 0); @@ -145,7 +145,7 @@ hsExpander::hsExpander(Int32 minSize, Int32 growBy) fMinSize = minSize+1; fGrowBy = growBy; - fArray = TRACKED_NEW T[fMinSize]; + fArray = new T[fMinSize]; fNumPostAlloc = fMinSize; fNumPost = 0; @@ -170,7 +170,7 @@ void hsExpander::Last() } template -T& hsExpander::operator[]( Int32 index ) +T& hsExpander::operator[]( int32_t index ) { hsDebugCode(hsThrowIfBadParam((index < 0)||(index >= fNumPost));) @@ -178,7 +178,7 @@ T& hsExpander::operator[]( Int32 index ) } template -const T& hsExpander::Get( Int32 index ) const +const T& hsExpander::Get( int32_t index ) const { hsDebugCode(hsThrowIfBadParam((index < 0)||(index >= fNumPost));) @@ -186,7 +186,7 @@ const T& hsExpander::Get( Int32 index ) const } template -Int32 hsExpander::Get(Int32 index, Int32 count, T data[]) const +int32_t hsExpander::Get(int32_t index, int32_t count, T data[]) const { if( count > 0 ) { hsThrowIfNilParam(data); @@ -201,7 +201,7 @@ Int32 hsExpander::Get(Int32 index, Int32 count, T data[]) const } template -Int32 hsExpander::Find(const T& obj) const +int32_t hsExpander::Find(const T& obj) const { for (int i = 0; i < fNumPost; i++) if (fArray[i] == obj) @@ -210,7 +210,7 @@ Int32 hsExpander::Find(const T& obj) const } template -Int32 hsExpander::Append(const T& obj) +int32_t hsExpander::Append(const T& obj) { hsAssert(!(fNumPost >= fNumPostAlloc), "Must be less"); if( fNumPost == fNumPostAlloc-1 ) @@ -229,7 +229,7 @@ T* hsExpander::Append() } template -Int32 hsExpander::Pop(T*t) +int32_t hsExpander::Pop(T*t) { hsThrowIfBadParam(Empty()); --fNumPost; @@ -239,7 +239,7 @@ Int32 hsExpander::Pop(T*t) } template -Int32 hsExpander::Pop() +int32_t hsExpander::Pop() { hsThrowIfBadParam(Empty()); --fNumPost; @@ -257,16 +257,16 @@ void hsExpander::Reset() /////////////////////////////////////////////////////////////////////////////// template class hsBiExpander { private: - Int32 fNumPre; - Int32 fNumPost; - Int32 fNumPreAlloc; - Int32 fNumPostAlloc; + int32_t fNumPre; + int32_t fNumPost; + int32_t fNumPreAlloc; + int32_t fNumPostAlloc; T* fArray; - Int32 fGrowBy; // default = 0, to double - Int32 fMinSize; // default = 1, min == 1 + int32_t fGrowBy; // default = 0, to double + int32_t fMinSize; // default = 1, min == 1 - Int32 fCurrent; + int32_t fCurrent; hsBiExpander& operator=(const hsBiExpander&); // don't allow assignment hsBiExpander(const hsBiExpander&); // make it passed as ref or pointer @@ -275,26 +275,26 @@ private: public: enum { kMissingIndex = -1 }; - hsBiExpander(Int32 minSize = 1, Int32 growBy = 0); + hsBiExpander(int32_t minSize = 1, int32_t growBy = 0); virtual ~hsBiExpander(); - Int32 GetFirst() const { return -fNumPre; } - Int32 GetCount() const { return fNumPre + fNumPost; } + int32_t GetFirst() const { return -fNumPre; } + int32_t GetCount() const { return fNumPre + fNumPost; } hsBool Empty() const { return GetCount() == 0; } - const T& Get(Int32 index) const; - Int32 Get(Int32 index, Int32 count, T data[]) const; - Int32 Find(const T&) const; // returns kMissingIndex if not found + 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 cnt, Int32 numPre=0); + void SetArray(T* a, int32_t cnt, int32_t numPre=0); T** GetArray() { return fArray - fNumPre; } - T& operator[]( Int32 index ); + T& operator[]( int32_t index ); T* Append(); // returns t's index T* Push(); // returns t's index - Int32 Append(const T&); // returns t's index - Int32 Push(const T&); // returns t's index - Int32 Pop(T*t = nil) { return PopHead(t); } // returns count of remaining - Int32 PopHead(T*t = nil); // returns count of remaining - Int32 PopTail(T*t = nil); // returns count of remaining + 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 T& Head() { return fArray[-fNumPre]; } @@ -308,7 +308,7 @@ public: }; template -void hsBiExpander::SetArray(T* a, Int32 cnt, Int32 numPre) +void hsBiExpander::SetArray(T* a, int32_t cnt, int32_t numPre) { if( !numPre ) Reset(); @@ -323,8 +323,8 @@ void hsBiExpander::SetArray(T* a, Int32 cnt, Int32 numPre) template void hsBiExpander::IExpand(int newSize, hsBool towardEnd) { - Int32 newPreAlloc = fNumPreAlloc; - Int32 newPostAlloc = fNumPostAlloc; + int32_t newPreAlloc = fNumPreAlloc; + int32_t newPostAlloc = fNumPostAlloc; if( towardEnd ) { if( !newPostAlloc ) @@ -339,7 +339,7 @@ void hsBiExpander::IExpand(int newSize, hsBool towardEnd) while( newPreAlloc <= newSize ) newPreAlloc = fGrowBy ? newPreAlloc + fGrowBy : newPreAlloc << 1; } - T* newArray = TRACKED_NEW T[newPreAlloc + newPostAlloc]; + T* newArray = new T[newPreAlloc + newPostAlloc]; newArray += newPreAlloc; int i; for( i = -fNumPre; i < fNumPost; i++ ) @@ -353,7 +353,7 @@ void hsBiExpander::IExpand(int newSize, hsBool towardEnd) } template -hsBiExpander::hsBiExpander(Int32 minSize, Int32 growBy) +hsBiExpander::hsBiExpander(int32_t minSize, int32_t growBy) { hsThrowIfBadParam(minSize < 0); hsThrowIfBadParam(growBy < 0); @@ -361,7 +361,7 @@ hsBiExpander::hsBiExpander(Int32 minSize, Int32 growBy) fMinSize = minSize+1; fGrowBy = growBy; - fArray = TRACKED_NEW T[fMinSize << 1]; + fArray = new T[fMinSize << 1]; fNumPreAlloc = fNumPostAlloc = fMinSize; fArray += fNumPreAlloc; @@ -387,7 +387,7 @@ void hsBiExpander::Last() } template -T& hsBiExpander::operator[]( Int32 index ) +T& hsBiExpander::operator[]( int32_t index ) { hsDebugCode(hsThrowIfBadParam((index < -fNumPre)||(index >= fNumPost));) @@ -395,7 +395,7 @@ T& hsBiExpander::operator[]( Int32 index ) } template -const T& hsBiExpander::Get( Int32 index ) const +const T& hsBiExpander::Get( int32_t index ) const { hsDebugCode(hsThrowIfBadParam((index < -fNumPre)||(index >= fNumPost));) @@ -403,7 +403,7 @@ const T& hsBiExpander::Get( Int32 index ) const } template -Int32 hsBiExpander::Get(Int32 index, Int32 count, T data[]) const +int32_t hsBiExpander::Get(int32_t index, int32_t count, T data[]) const { if( count > 0 ) { hsThrowIfNilParam(data); @@ -418,7 +418,7 @@ Int32 hsBiExpander::Get(Int32 index, Int32 count, T data[]) const } template -Int32 hsBiExpander::Find(const T& obj) const +int32_t hsBiExpander::Find(const T& obj) const { for (int i = -fNumPre; i < fNumPost; i++) if (fArray[i] == obj) @@ -445,7 +445,7 @@ T* hsBiExpander::Push() } template -Int32 hsBiExpander::Append(const T& obj) +int32_t hsBiExpander::Append(const T& obj) { hsAssert(!(fNumPost >= fNumPostAlloc), "Must be less"); if( fNumPost == fNumPostAlloc-1 ) @@ -455,7 +455,7 @@ Int32 hsBiExpander::Append(const T& obj) } template -Int32 hsBiExpander::Push(const T& obj) +int32_t hsBiExpander::Push(const T& obj) { hsAssert(!(fNumPre >= fNumPreAlloc), "Must be less"); if( ++fNumPre == fNumPreAlloc ) @@ -465,7 +465,7 @@ Int32 hsBiExpander::Push(const T& obj) } template -Int32 hsBiExpander::PopHead(T*t) +int32_t hsBiExpander::PopHead(T*t) { hsThrowIfBadParam(Empty()); if( t ) @@ -475,7 +475,7 @@ Int32 hsBiExpander::PopHead(T*t) } template -Int32 hsBiExpander::PopTail(T*t) +int32_t hsBiExpander::PopTail(T*t) { hsThrowIfBadParam(Empty()); --fNumPost; diff --git a/Sources/Plasma/CoreLib/hsBitVector.cpp b/Sources/Plasma/CoreLib/hsBitVector.cpp index 1e75570a..c3194b2c 100644 --- a/Sources/Plasma/CoreLib/hsBitVector.cpp +++ b/Sources/Plasma/CoreLib/hsBitVector.cpp @@ -40,7 +40,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "hsStream.h" #include "hsBitVector.h" #include "hsTemplates.h" @@ -62,18 +62,18 @@ hsBitVector::hsBitVector(int b, ...) va_end( vl ); } -hsBitVector::hsBitVector(const hsTArray& src) +hsBitVector::hsBitVector(const hsTArray& src) : fBitVectors(nil), fNumBitVectors(0) { FromList(src); } -void hsBitVector::IGrow(UInt32 newNumBitVectors) +void hsBitVector::IGrow(uint32_t newNumBitVectors) { hsAssert(newNumBitVectors > fNumBitVectors, "Growing smaller"); - UInt32 *old = fBitVectors; - fBitVectors = TRACKED_NEW UInt32[newNumBitVectors]; + uint32_t *old = fBitVectors; + fBitVectors = new uint32_t[newNumBitVectors]; int i; for( i = 0; i < fNumBitVectors; i++ ) fBitVectors[i] = old[i]; @@ -95,8 +95,8 @@ hsBitVector& hsBitVector::Compact() for( hiVec = fNumBitVectors-1; (hiVec >= 0)&& !fBitVectors[hiVec]; --hiVec ); if( hiVec >= 0 ) { - UInt32 *old = fBitVectors; - fBitVectors = TRACKED_NEW UInt32[++hiVec]; + uint32_t *old = fBitVectors; + fBitVectors = new uint32_t[++hiVec]; int i; for( i = 0; i < hiVec; i++ ) fBitVectors[i] = old[i]; @@ -119,7 +119,7 @@ void hsBitVector::Read(hsStream* s) if( fNumBitVectors ) { delete [] fBitVectors; - fBitVectors = TRACKED_NEW UInt32[fNumBitVectors]; + fBitVectors = new uint32_t[fNumBitVectors]; int i; for( i = 0; i < fNumBitVectors; i++ ) s->LogReadLE(&fBitVectors[i],"BitVector"); @@ -135,7 +135,7 @@ void hsBitVector::Write(hsStream* s) const s->WriteLE32(fBitVectors[i]); } -hsTArray& hsBitVector::Enumerate(hsTArray& dst) const +hsTArray& hsBitVector::Enumerate(hsTArray& dst) const { dst.SetCount(0); hsBitIterator iter(*this); @@ -148,7 +148,7 @@ hsTArray& hsBitVector::Enumerate(hsTArray& dst) const return dst; } -hsBitVector& hsBitVector::FromList(const hsTArray& src) +hsBitVector& hsBitVector::FromList(const hsTArray& src) { Clear(); int i; diff --git a/Sources/Plasma/CoreLib/hsBitVector.h b/Sources/Plasma/CoreLib/hsBitVector.h index 7c103e4d..bd2fe865 100644 --- a/Sources/Plasma/CoreLib/hsBitVector.h +++ b/Sources/Plasma/CoreLib/hsBitVector.h @@ -43,7 +43,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #ifndef hsBitVector_inc #define hsBitVector_inc -#include "hsTypes.h" +#include "HeadSpin.h" template class hsTArray; class hsStream; @@ -51,17 +51,17 @@ class hsStream; class hsBitVector { protected: - UInt32* fBitVectors; - UInt32 fNumBitVectors; + uint32_t* fBitVectors; + uint32_t fNumBitVectors; - void IGrow(UInt32 newNumBitVectors); + void IGrow(uint32_t newNumBitVectors); friend class hsBitIterator; public: hsBitVector(const hsBitVector& other); - hsBitVector(UInt32 which) : fBitVectors(nil), fNumBitVectors(0) { SetBit(which); } + hsBitVector(uint32_t which) : fBitVectors(nil), fNumBitVectors(0) { SetBit(which); } hsBitVector(int b, ...); // list of one or more integer bits to set. -1 (or any negative) terminates the list (e.g. hsBitVector(0,1,4,-1); - hsBitVector(const hsTArray& list); // sets bit for each int in list + hsBitVector(const hsTArray& list); // sets bit for each int in list hsBitVector() : fBitVectors(nil), fNumBitVectors(0) {} virtual ~hsBitVector() { Reset(); } @@ -73,17 +73,17 @@ public: int operator!=(const hsBitVector& other) const { return !(*this == other); } hsBitVector& operator=(const hsBitVector& other); // will wind up identical - hsBool ClearBit(UInt32 which) { return SetBit(which, 0); } // returns previous state - hsBool SetBit(UInt32 which, hsBool on = true); // returns previous state - hsBool IsBitSet(UInt32 which) const; // returns current state - hsBool ToggleBit(UInt32 which); // returns previous state - hsBitVector& RemoveBit(UInt32 which); // removes bit, sliding higher bits down to fill the gap. + 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 + 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; - hsBool operator[](UInt32 which) const { return IsBitSet(which); } + hsBool 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); @@ -96,19 +96,19 @@ public: hsBitVector& operator-=(const hsBitVector& other); // return me w/ other's bits turned off hsBitVector& Compact(); - hsBitVector& SetSize(UInt32 numBits) { ClearBit(numBits+1); return *this; } - UInt32 GetSize() { return fNumBitVectors << 5; } + hsBitVector& SetSize(uint32_t numBits) { ClearBit(numBits+1); return *this; } + uint32_t GetSize() { return fNumBitVectors << 5; } // integer level access - UInt32 GetNumBitVectors() const { return fNumBitVectors; } - UInt32 GetBitVector(int i) const { return fBitVectors[i]; } - void SetNumBitVectors(UInt32 n) { Reset(); fNumBitVectors=n; fBitVectors = TRACKED_NEW UInt32[n]; } - void SetBitVector(int i, UInt32 val) { fBitVectors[i]=val; } + uint32_t GetNumBitVectors() const { return fNumBitVectors; } + uint32_t GetBitVector(int i) const { return fBitVectors[i]; } + void SetNumBitVectors(uint32_t n) { Reset(); fNumBitVectors=n; fBitVectors = new uint32_t[n]; } + void SetBitVector(int i, uint32_t val) { fBitVectors[i]=val; } // Do dst.SetCount(0), then add each set bit's index into dst, returning dst. - hsTArray& Enumerate(hsTArray& dst) const; + hsTArray& Enumerate(hsTArray& dst) const; // this->Clear(), then set all bits listed in src, returning *this. - hsBitVector& FromList(const hsTArray& src); + hsBitVector& FromList(const hsTArray& src); void Read(hsStream* s); void Write(hsStream* s) const; @@ -118,7 +118,7 @@ inline hsBitVector::hsBitVector(const hsBitVector& other) { if( 0 != (fNumBitVectors = other.fNumBitVectors) ) { - fBitVectors = TRACKED_NEW UInt32[fNumBitVectors]; + fBitVectors = new uint32_t[fNumBitVectors]; int i; for( i = 0; i < fNumBitVectors; i++ ) fBitVectors[i] = other.fBitVectors[i]; @@ -160,7 +160,7 @@ inline hsBitVector& hsBitVector::operator=(const hsBitVector& other) { Reset(); fNumBitVectors = other.fNumBitVectors; - fBitVectors = TRACKED_NEW UInt32[fNumBitVectors]; + fBitVectors = new uint32_t[fNumBitVectors]; } else { @@ -295,12 +295,12 @@ inline hsBitVector& hsBitVector::Set(int upToBit) { if( upToBit >= 0 ) { - UInt32 major = upToBit >> 5; - UInt32 minor = 1 << (upToBit & 0x1f); + uint32_t major = upToBit >> 5; + uint32_t minor = 1 << (upToBit & 0x1f); if( major >= fNumBitVectors ) IGrow(major+1); - UInt32 i; + uint32_t i; for( i = 0; i < major; i++ ) fBitVectors[i] = 0xffffffff; for( i = 1; i <= minor && i > 0; i <<= 1 ) @@ -315,18 +315,18 @@ inline hsBitVector& hsBitVector::Set(int upToBit) return *this; } -inline hsBool hsBitVector::IsBitSet(UInt32 which) const +inline hsBool hsBitVector::IsBitSet(uint32_t which) const { - UInt32 major = which >> 5; + uint32_t major = which >> 5; return (major < fNumBitVectors) && (0 != (fBitVectors[major] & 1 << (which & 0x1f))); } -inline hsBool hsBitVector::SetBit(UInt32 which, hsBool on) +inline hsBool hsBitVector::SetBit(uint32_t which, hsBool on) { - UInt32 major = which >> 5; - UInt32 minor = 1 << (which & 0x1f); + uint32_t major = which >> 5; + uint32_t minor = 1 << (which & 0x1f); if( major >= fNumBitVectors ) IGrow(major+1); hsBool ret = 0 != (fBitVectors[major] & minor); @@ -341,10 +341,10 @@ inline hsBool hsBitVector::SetBit(UInt32 which, hsBool on) return ret; } -inline hsBool hsBitVector::ToggleBit(UInt32 which) +inline hsBool hsBitVector::ToggleBit(uint32_t which) { - UInt32 major = which >> 5; - UInt32 minor = 1 << (which & 0x1f); + uint32_t major = which >> 5; + uint32_t minor = 1 << (which & 0x1f); if( major >= fNumBitVectors ) IGrow(major); hsBool ret = 0 != (fBitVectors[major] & minor); @@ -355,14 +355,14 @@ inline hsBool hsBitVector::ToggleBit(UInt32 which) return ret; } -inline hsBitVector& hsBitVector::RemoveBit(UInt32 which) +inline hsBitVector& hsBitVector::RemoveBit(uint32_t which) { - UInt32 major = which >> 5; + uint32_t major = which >> 5; if( major >= fNumBitVectors ) return *this; - UInt32 minor = 1 << (which & 0x1f); - UInt32 lowMask = minor-1; - UInt32 hiMask = ~(lowMask); + uint32_t minor = 1 << (which & 0x1f); + uint32_t lowMask = minor-1; + uint32_t hiMask = ~(lowMask); fBitVectors[major] = (fBitVectors[major] & lowMask) | ((fBitVectors[major] >> 1) & hiMask); diff --git a/Sources/Plasma/CoreLib/hsBounds.cpp b/Sources/Plasma/CoreLib/hsBounds.cpp index d68a495c..ad7c9124 100644 --- a/Sources/Plasma/CoreLib/hsBounds.cpp +++ b/Sources/Plasma/CoreLib/hsBounds.cpp @@ -40,13 +40,13 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "hsBounds.h" #include "hsStream.h" #include "hsFastMath.h" -const hsScalar hsBounds::kRealSmall = 1.0e-5f; +const float hsBounds::kRealSmall = 1.0e-5f; /////////////////////////////////////////////////////////////////////////////////////// // @@ -61,7 +61,7 @@ void hsBounds::Read(hsStream *s) void hsBounds::Write(hsStream *s) { - s->WriteLE32((Int32)fType); + s->WriteLE32((int32_t)fType); } /////////////////////////////////////////////////////////////////////////////////////// @@ -186,18 +186,18 @@ void hsBounds3::MakeSymmetric(const hsPoint3* p) if( fType != kBoundsNormal ) return; - hsScalar delMax = 0; + float delMax = 0; int i; for( i = 0; i < 3; i++ ) { - hsScalar delUp; + float delUp; delUp = fMaxs[i] - (*p)[i]; delMax = hsMaximum(delMax, delUp); delUp = (*p)[i] - fMins[i]; delMax = hsMaximum(delMax, delUp); } - const hsScalar sqrtTwo = 1.41421f; + const float sqrtTwo = 1.41421f; delMax *= sqrtTwo; hsAssert((delMax > -1.e6f)&&(delMax < 1.e6f), "MakeSymmetric going out to sea"); fCenter = *p; @@ -213,8 +213,8 @@ void hsBounds3::InscribeSphere() if( fType != kBoundsNormal ) return; - const hsScalar ooSix = hsScalarInvert(2.f * 3.f); - hsScalar a = GetMaxDim() * ooSix; + const float ooSix = hsInvert(2.f * 3.f); + float a = GetMaxDim() * ooSix; hsPoint3 p = GetCenter(); p.fX += a; p.fY += a; @@ -230,9 +230,9 @@ void hsBounds3::InscribeSphere() } // neg, pos, zero == disjoint, I contain other, overlap -Int32 hsBounds3::TestBound(const hsBounds3& other) const +int32_t hsBounds3::TestBound(const hsBounds3& other) const { - Int32 retVal = 1; + int32_t retVal = 1; int i; for( i = 0; i < 3; i++ ) { @@ -264,7 +264,7 @@ hsBool hsBounds3::IsInside(const hsPoint3* pos) const void hsBounds3::MakeTriMeshSphere(hsGTriMesh* tMesh, hsPoint3* cornersIn) const { hsPoint3 center = (*GetMaxs() + *GetMins()) * 0.5f; - hsScalar radius = GetMaxDim() * 0.5f; + float radius = GetMaxDim() * 0.5f; const int nLong = 9; const int nLati = 5; @@ -290,13 +290,13 @@ void hsBounds3::MakeTriMeshSphere(hsGTriMesh* tMesh, hsPoint3* cornersIn) const { for( j = 0; j < nLati; j++ ) { - hsScalar theta = (hsScalar(i) / nLong) * 2.f * hsScalarPI; - hsScalar cosTheta = hsCosine(theta); - hsScalar sinTheta = hsSine(theta); + float theta = (float(i) / nLong) * 2.f * M_PI; + float cosTheta = cos(theta); + float sinTheta = sin(theta); - hsScalar phi = (hsScalar(j+1) / (nLati+1)) * hsScalarPI; - hsScalar cosPhi = hsCosine(phi); - hsScalar sinPhi = hsSine(phi); + float phi = (float(j+1) / (nLati+1)) * M_PI; + float cosPhi = cos(phi); + float sinPhi = sin(phi); pt.fX = center.fX + radius * sinPhi * cosTheta; pt.fY = center.fY + radius * sinPhi * sinTheta; @@ -348,7 +348,7 @@ void hsBounds3::MakeTriMeshSphere(hsGTriMesh* tMesh, hsPoint3* cornersIn) const // // Allocate and create mesh from bounding box // -void hsBounds3::MakeTriMesh(hsGTriMesh* tMesh, UInt32 triFlags, hsPoint3* cornersIn) const +void hsBounds3::MakeTriMesh(hsGTriMesh* tMesh, uint32_t triFlags, hsPoint3* cornersIn) const { hsAssert(cornersIn || fType == kBoundsNormal, "Invalid bounds type for hsBounds3::MakeTriMesh "); @@ -412,13 +412,13 @@ void hsBounds3::TestPlane(const hsVector3 &n, hsPoint2 &depth) const { hsAssert(fType == kBoundsNormal, "TestPlane only valid for kBoundsNormal filled bounds"); - hsScalar dmax = fMins.InnerProduct(n); - hsScalar dmin = dmax; + float dmax = fMins.InnerProduct(n); + float dmin = dmax; int i; for( i = 0; i < 3; i++ ) { - hsScalar dd; + float dd; dd = fMaxs[i] - fMins[i]; dd *= n[i]; @@ -432,19 +432,19 @@ void hsBounds3::TestPlane(const hsVector3 &n, hsPoint2 &depth) const depth.fY = dmax; } -hsScalar hsBounds3::ClosestPointToLine(const hsPoint3 *p, const hsPoint3 *v0, const hsPoint3 *v1, hsPoint3 *out) +float hsBounds3::ClosestPointToLine(const hsPoint3 *p, const hsPoint3 *v0, const hsPoint3 *v1, hsPoint3 *out) { hsVector3 del(v1, v0); - hsScalar magSq = del.MagnitudeSquared(); - hsScalar t = 0.f; + float magSq = del.MagnitudeSquared(); + float t = 0.f; if( magSq < hsBounds::kRealSmall ) { *out = *v0; } else { - t = del.InnerProduct(hsVector3(p, v0)) * hsScalarInvert(magSq); - if( t >= hsScalar1 ) + t = del.InnerProduct(hsVector3(p, v0)) * hsInvert(magSq); + if( t >= 1.f ) *out = *v1; else if( t <= 0 ) *out = *v0; @@ -454,10 +454,10 @@ hsScalar hsBounds3::ClosestPointToLine(const hsPoint3 *p, const hsPoint3 *v0, co return t; } -hsScalar hsBounds3::ClosestPointToInfiniteLine(const hsPoint3* p, const hsVector3* v, hsPoint3* out) +float hsBounds3::ClosestPointToInfiniteLine(const hsPoint3* p, const hsVector3* v, hsPoint3* out) { - hsScalar magSq = v->MagnitudeSquared(); - hsScalar t = 0.f; + float magSq = v->MagnitudeSquared(); + float t = 0.f; hsPoint3 origin(0,0,0); if( magSq < hsBounds::kRealSmall ) { @@ -465,7 +465,7 @@ hsScalar hsBounds3::ClosestPointToInfiniteLine(const hsPoint3* p, const hsVector } else { - t = v->InnerProduct(hsVector3(*p)) * hsScalarInvert(magSq); + t = v->InnerProduct(hsVector3(*p)) * hsInvert(magSq); *out = hsPoint3(*v * t); } return t; @@ -542,7 +542,7 @@ hsBool hsBoundsOriented::IsInside(const hsPoint3* pos) const int i; for( i = 0; i < fNumPlanes; i++ ) { - hsScalar dis = fPlanes[i].fN.InnerProduct(pos); + float dis = fPlanes[i].fN.InnerProduct(pos); dis += fPlanes[i].fD; if( dis > 0.f ) return false; @@ -551,18 +551,18 @@ hsBool hsBoundsOriented::IsInside(const hsPoint3* pos) const return true; } -void hsBoundsOriented::SetNumberPlanes(UInt32 n) +void hsBoundsOriented::SetNumberPlanes(uint32_t n) { delete [] fPlanes; - fPlanes = TRACKED_NEW hsPlane3[fNumPlanes = n]; + fPlanes = new hsPlane3[fNumPlanes = n]; } -void hsBoundsOriented::SetPlane(UInt32 i, hsPlane3 *pln) +void hsBoundsOriented::SetPlane(uint32_t i, hsPlane3 *pln) { fType = kBoundsNormal; if( i >= fNumPlanes ) { - hsPlane3 *newPlanes = TRACKED_NEW hsPlane3[i+1]; + hsPlane3 *newPlanes = new hsPlane3[i+1]; if( fPlanes ) { int k; @@ -633,7 +633,7 @@ void hsBoundsOriented::Read(hsStream *stream) fNumPlanes = stream->ReadLE32(); if (fPlanes) delete [] fPlanes; - fPlanes = TRACKED_NEW hsPlane3[fNumPlanes]; + fPlanes = new hsPlane3[fNumPlanes]; int i; for( i = 0; i < fNumPlanes; i++ ) { @@ -690,7 +690,7 @@ void hsBounds3Ext::IMakeDists() const fDists[i].fY = fDists[i].fX + fAxes[i].InnerProduct(fAxes[i]); if( fDists[i].fX > fDists[i].fY ) { - hsScalar t = fDists[i].fX; + float t = fDists[i].fX; fDists[i].fX = fDists[i].fY; fDists[i].fY = t; } @@ -713,7 +713,7 @@ void hsBounds3Ext::IMakeSphere() const int i; for( i = 1; i < 3; i++ ) { - hsScalar dist = fMaxs[i] - fMins[i]; + float dist = fMaxs[i] - fMins[i]; if( dist < fRadius ) fRadius = dist; } @@ -721,21 +721,21 @@ void hsBounds3Ext::IMakeSphere() const } else { - fRadius = hsSquareRoot(hsVector3(&fMaxs, &fCenter).MagnitudeSquared()); + fRadius = sqrt(hsVector3(&fMaxs, &fCenter).MagnitudeSquared()); } } else { if( fBounds3Flags & kIsSphere ) { - hsScalar minMagSq = fAxes[0].MagnitudeSquared(); - hsScalar magSq = fAxes[1].MagnitudeSquared(); + float minMagSq = fAxes[0].MagnitudeSquared(); + float magSq = fAxes[1].MagnitudeSquared(); if( magSq < minMagSq ) magSq = minMagSq; magSq = fAxes[2].MagnitudeSquared(); if( magSq < minMagSq ) magSq = minMagSq; - fRadius = hsSquareRoot(magSq); + fRadius = sqrt(magSq); } else { @@ -747,7 +747,7 @@ void hsBounds3Ext::IMakeSphere() const if( !IAxisIsZero(i) ) accum += fAxes[i]; } - fRadius = hsSquareRoot((accum * 0.5f).MagnitudeSquared()); + fRadius = sqrt((accum * 0.5f).MagnitudeSquared()); } } fExtFlags |= kSphereSet; @@ -850,7 +850,7 @@ void hsBounds3Ext::Union(const hsVector3 *v) int i; for( i = 0; i < 3; i++ ) { - hsScalar dot = fAxes[i].InnerProduct(v); + float dot = fAxes[i].InnerProduct(v); dot /= fAxes[i].MagnitudeSquared(); if( dot > 0 ) { @@ -911,9 +911,9 @@ void hsBounds3Ext::InscribeSphere() return; } - const hsScalar oneThird = hsScalarInvert(3.f); -// hsScalar a = GetMaxDim() * hsScalarInvert(6.f); - hsScalar a = GetRadius() * oneThird; + const float oneThird = hsInvert(3.f); +// float a = GetMaxDim() * hsInvert(6.f); + float a = GetRadius() * oneThird; hsPoint3 p = GetCenter(); p.fX += a; p.fY += a; @@ -941,12 +941,12 @@ void hsBounds3Ext::Transform(const hsMatrix44 *m) fCorner = *m * fMins; hsVector3 v; - hsScalar span; + float span; span = fMaxs.fX - fMins.fX; if( span < kRealSmall ) { fExtFlags |= kAxisZeroZero; - span = hsScalar1; + span = 1.f; } v.Set(span, 0, 0); fAxes[0] = *m * v; @@ -954,7 +954,7 @@ void hsBounds3Ext::Transform(const hsMatrix44 *m) if( span < kRealSmall ) { fExtFlags |= kAxisOneZero; - span = hsScalar1; + span = 1.f; } v.Set(0, span, 0); fAxes[1] = *m * v; @@ -962,7 +962,7 @@ void hsBounds3Ext::Transform(const hsMatrix44 *m) if( span < kRealSmall ) { fExtFlags |= kAxisTwoZero; - span = hsScalar1; + span = 1.f; } v.Set(0, 0, span); fAxes[2] = *m * v; @@ -1001,7 +1001,7 @@ void hsBounds3Ext::Translate(const hsVector3 &v) int i; for( i = 0; i < 3; i++ ) { - hsScalar d; + float d; d = fAxes[i].InnerProduct(v); fDists[i].fX += d; fDists[i].fY += d; @@ -1020,7 +1020,7 @@ hsBool hsBounds3Ext::IsInside(const hsPoint3 *p) const int i; for( i = 0; i < 3; i++ ) { - hsScalar diss = p->InnerProduct(fAxes[i]); + float diss = p->InnerProduct(fAxes[i]); if( (diss < fDists[i].fX) ||(diss > fDists[i].fY) ) return false; @@ -1030,7 +1030,7 @@ hsBool hsBounds3Ext::IsInside(const hsPoint3 *p) const } // neg, pos, zero == disjoint, I contain other, overlap -Int32 hsBounds3Ext::TestBound(const hsBounds3Ext& other) const +int32_t hsBounds3Ext::TestBound(const hsBounds3Ext& other) const { if( fExtFlags & kAxisAligned ) return hsBounds3::TestBound(other); @@ -1038,7 +1038,7 @@ Int32 hsBounds3Ext::TestBound(const hsBounds3Ext& other) const if( !(fExtFlags & kDistsSet) ) IMakeDists(); - Int32 retVal = 1; + int32_t retVal = 1; int i; for( i = 0; i < 3; i++ ) { @@ -1068,15 +1068,15 @@ void hsBounds3Ext::TestPlane(const hsVector3 &n, hsPoint2 &depth) const } else { - hsScalar dmax = fCorner.InnerProduct(n); - hsScalar dmin = dmax; + float dmax = fCorner.InnerProduct(n); + float dmin = dmax; int i; for( i = 0; i < 3; i++ ) { if( !IAxisIsZero(i) ) { - hsScalar d; + float d; d = fAxes[i].InnerProduct(n); if( d < 0 ) dmin += d; @@ -1098,9 +1098,9 @@ void hsBounds3Ext::TestPlane(const hsVector3 &n, const hsVector3 &myVel, hsPoint { if( fExtFlags & kAxisAligned ) { - hsScalar dmax = fMins.InnerProduct(n); - hsScalar dmin = dmax; - hsScalar dvel = myVel.InnerProduct(n); + float dmax = fMins.InnerProduct(n); + float dmin = dmax; + float dvel = myVel.InnerProduct(n); if( dvel < 0 ) dmin += dvel; else @@ -1109,7 +1109,7 @@ void hsBounds3Ext::TestPlane(const hsVector3 &n, const hsVector3 &myVel, hsPoint int i; for( i = 0; i < 3; i++ ) { - hsScalar dd; + float dd; dd = fMaxs[i] - fMins[i]; dd *= n[i]; @@ -1124,9 +1124,9 @@ void hsBounds3Ext::TestPlane(const hsVector3 &n, const hsVector3 &myVel, hsPoint } else { - hsScalar dmax = fCorner.InnerProduct(n); - hsScalar dmin = dmax; - hsScalar dvel = myVel.InnerProduct(n); + float dmax = fCorner.InnerProduct(n); + float dmin = dmax; + float dvel = myVel.InnerProduct(n); if( dvel < 0 ) dmin += dvel; else @@ -1137,7 +1137,7 @@ void hsBounds3Ext::TestPlane(const hsVector3 &n, const hsVector3 &myVel, hsPoint { if( !IAxisIsZero(i) ) { - hsScalar d; + float d; d = fAxes[i].InnerProduct(n); if( d < 0 ) dmin += d; @@ -1151,24 +1151,24 @@ void hsBounds3Ext::TestPlane(const hsVector3 &n, const hsVector3 &myVel, hsPoint } } -Int32 hsBounds3Ext::TestPoints(int n, const hsPoint3 *pList, const hsVector3 &ptVel) const +int32_t hsBounds3Ext::TestPoints(int n, const hsPoint3 *pList, const hsVector3 &ptVel) const { if( fExtFlags & kAxisAligned ) { - Int32 retVal = -1; + int32_t retVal = -1; int i; for( i = 0; i < 3; i++ ) { - hsScalar effMax = fMaxs[i]; - hsScalar effMin = fMins[i]; + float effMax = fMaxs[i]; + float effMin = fMins[i]; if( ptVel[i] < 0 ) effMax -= ptVel[i]; else effMin -= ptVel[i]; int j; - const UInt32 low = 0x1, hi = 0x2; - UInt32 mask = low | hi; + const uint32_t low = 0x1, hi = 0x2; + uint32_t mask = low | hi; for( j = 0; j < n; j++ ) { if( pList[j][i] > effMin ) @@ -1185,21 +1185,21 @@ Int32 hsBounds3Ext::TestPoints(int n, const hsPoint3 *pList, const hsVector3 &pt } else // non-axis aligned case { - Int32 retVal = -1; // all inside + int32_t retVal = -1; // all inside if( !(fExtFlags & kDistsSet) ) IMakeDists(); int i; for( i = 0; i < 3; i++ ) { - hsScalar diff = fAxes[i].InnerProduct(ptVel); + float diff = fAxes[i].InnerProduct(ptVel); hsBool someLow = false; hsBool someHi = false; hsBool someIn = false; int j; for( j = 0; j < n; j++ ) { - hsScalar d = fAxes[i].InnerProduct(pList[j]); - hsScalar ddiff = d + diff; + float d = fAxes[i].InnerProduct(pList[j]); + float ddiff = d + diff; if( d < fDists[i].fX ) someLow = true; else if( d > fDists[i].fY ) @@ -1228,7 +1228,7 @@ Int32 hsBounds3Ext::TestPoints(int n, const hsPoint3 *pList, const hsVector3 &pt } } -Int32 hsBounds3Ext::TestPoints(int n, const hsPoint3 *pList) const +int32_t hsBounds3Ext::TestPoints(int n, const hsPoint3 *pList) const { hsBool someIn = false; hsBool someOut = false; @@ -1260,7 +1260,7 @@ hsBool hsBounds3Ext::ClosestPoint(const hsPoint3& p, hsPoint3& inner, hsPoint3& int i; for( i = 0; i < 3; i++ ) { - hsScalar dist = fAxes[i].InnerProduct(p); + float dist = fAxes[i].InnerProduct(p); if( dist < fDists[i].fX ) { outer += fAxes[i]; @@ -1271,7 +1271,7 @@ hsBool hsBounds3Ext::ClosestPoint(const hsPoint3& p, hsPoint3& inner, hsPoint3& } else { - hsScalar t = (dist - fDists[i].fX) / (fDists[i].fY - fDists[i].fX); + float t = (dist - fDists[i].fX) / (fDists[i].fY - fDists[i].fX); inner += t * fAxes[i]; if( t > 0.5f ) outer += fAxes[i]; @@ -1309,8 +1309,8 @@ hsBool hsBounds3Ext::ISectBB(const hsBounds3Ext &other, const hsVector3 &myVel) if( other.fExtFlags & kAxisAligned ) { - hsScalar myMin = fMins[i]; - hsScalar myMax = fMaxs[i]; + float myMin = fMins[i]; + float myMax = fMaxs[i]; if( myVel[i] < 0 ) myMin += myVel[i]; else @@ -1329,11 +1329,11 @@ hsBool hsBounds3Ext::ISectBB(const hsBounds3Ext &other, const hsVector3 &myVel) // still leaves the 3 axes of origAxis.Cross(myVel) hsVector3 ax = fAxes[i] % myVel; - hsScalar dmax = fCorner.InnerProduct(ax); - hsScalar dmin = dmax; + float dmax = fCorner.InnerProduct(ax); + float dmin = dmax; int j = i+1; if( 3 == j )j = 0; - hsScalar d; + float d; d = fAxes[j].InnerProduct(ax); if( d < 0 ) dmin += d; @@ -1368,10 +1368,10 @@ static hsBool ISectInterval(const hsPoint2& other, const hsPoint2& mine) static hsBool ITestDepth(const hsPoint2& other, const hsPoint2& mine, const hsVector3& inAx, - hsVector3 &outAx, hsScalar& depth) + hsVector3 &outAx, float& depth) { depth = 0; - hsScalar d0, d1; + float d0, d1; d0 = other.fY - mine.fX; if( d0 <= 0 ) return false; @@ -1397,20 +1397,20 @@ static hsBool ITestDepth(const hsPoint2& other, const hsPoint2& mine, return true; } -Int32 hsBounds3Ext::IClosestISect(const hsBounds3Ext& other, const hsVector3& myVel, - hsScalar* tClose, hsScalar* tImpact) const +int32_t hsBounds3Ext::IClosestISect(const hsBounds3Ext& other, const hsVector3& myVel, + float* tClose, float* tImpact) const { // Should assert both have their spheres set. hsVector3 meToOt(&other.GetCenter(), &GetCenter()); // cTerm = (myCenter - otCenter)^2 - (myRad + otRad)^2 - hsScalar cTerm; + float cTerm; cTerm = GetRadius() + other.GetRadius(); cTerm *= -cTerm; - hsScalar meToOtLen = meToOt.MagnitudeSquared(); + float meToOtLen = meToOt.MagnitudeSquared(); cTerm += meToOtLen; if( cTerm <= 0 ) { @@ -1418,27 +1418,27 @@ Int32 hsBounds3Ext::IClosestISect(const hsBounds3Ext& other, const hsVector3& my return -1; // started off in contact } - hsScalar ooATerm = myVel.InnerProduct(myVel); + float ooATerm = myVel.InnerProduct(myVel); if( ooATerm < hsBounds::kRealSmall ) { *tClose = *tImpact = 0; return 0; } - ooATerm = hsScalarInvert(ooATerm); + ooATerm = hsInvert(ooATerm); - hsScalar bTerm = myVel.InnerProduct(meToOt); + float bTerm = myVel.InnerProduct(meToOt); bTerm *= ooATerm; - hsScalar bSqTerm = bTerm * bTerm; + float bSqTerm = bTerm * bTerm; // bTerm is t for closest point to line - hsScalar det = bSqTerm - ooATerm * cTerm; + float det = bSqTerm - ooATerm * cTerm; if( det < 0 ) { *tClose = *tImpact = bTerm; return 0; } - det = hsSquareRoot(det); + det = sqrt(det); *tClose = bTerm; *tImpact = bTerm - det; @@ -1451,26 +1451,26 @@ void hsBounds3Ext::Unalign() fCorner = fMins; hsVector3 v; - hsScalar span; + float span; span = fMaxs.fX - fMins.fX; if( span < kRealSmall ) { fExtFlags |= kAxisZeroZero; - span = hsScalar1; + span = 1.f; } fAxes[0].Set(span, 0, 0); span = fMaxs.fY - fMins.fY; if( span < kRealSmall ) { fExtFlags |= kAxisOneZero; - span = hsScalar1; + span = 1.f; } fAxes[1].Set(0, span, 0); span = fMaxs.fZ - fMins.fZ; if( span < kRealSmall ) { fExtFlags |= kAxisTwoZero; - span = hsScalar1; + span = 1.f; } fAxes[2].Set(0, 0, span); } @@ -1491,15 +1491,15 @@ hsBool hsBounds3Ext::ISectBB(const hsBounds3Ext &other, const hsVector3 &myVel, if( !(other.fExtFlags & (kDistsSet|kAxisAligned)) ) other.IMakeDists(); - const hsScalar kRealBig = 1.e30f; - hsScalar tstDepths[9]; + const float kRealBig = 1.e30f; + float tstDepths[9]; hsVector3 tstAxes[9]; - hsScalar totDepth = 0; + float totDepth = 0; int nDeep = 0; int i; for( i = 0; i < 3; i++ ) { - const hsScalar kFavorConstant = 0.01f; // smaller is favored + const float kFavorConstant = 0.01f; // smaller is favored other.TestPlane(fAxes[i], -myVel, depth); @@ -1527,9 +1527,9 @@ hsBool hsBounds3Ext::ISectBB(const hsBounds3Ext &other, const hsVector3 &myVel, depth.fY = other.fMaxs[i]; hsVector3 ax; - ax.Set( 0 == i ? hsScalar1 : 0, - 1 == i ? hsScalar1 : 0, - 2 == i ? hsScalar1 : 0); + ax.Set( 0 == i ? 1.f : 0, + 1 == i ? 1.f : 0, + 2 == i ? 1.f : 0); if( !ITestDepth(depth, mine, ax, tstAxes[i+3], tstDepths[i+3]) ) return false; @@ -1571,7 +1571,7 @@ hsBool hsBounds3Ext::ISectBB(const hsBounds3Ext &other, const hsVector3 &myVel, { hsPoint2 myDepth; myDepth.fX = myDepth.fY = fCorner.InnerProduct(ax); - hsScalar d; + float d; int j = i == 2 ? 0 : i+1; if( !IAxisIsZero(j) ) { @@ -1604,7 +1604,7 @@ hsBool hsBounds3Ext::ISectBB(const hsBounds3Ext &other, const hsVector3 &myVel, hsVector3 norm; if( totDepth <= 0 ) { - hsScalar t, tIgnore; + float t, tIgnore; IClosestISect(other, myVel, &tIgnore, &t); if( t < 0 ) t = 0; @@ -1648,8 +1648,8 @@ hsBool hsBounds3Ext::ISectABB(const hsBounds3Ext &other, const hsVector3 &myVel) int i; for( i = 0; i < 3; i++ ) { - hsScalar effMax = fMaxs[i]; - hsScalar effMin = fMins[i]; + float effMax = fMaxs[i]; + float effMin = fMins[i]; if( myVel[i] > 0 ) effMax += myVel[i]; else @@ -1675,17 +1675,17 @@ hsBool hsBounds3Ext::ISectBS(const hsBounds3Ext &other, const hsVector3 &myVel) // such uglies... if( myVel.MagnitudeSquared() > 0 ) { - hsScalar parm = hsVector3(&other.GetCenter(), &fCenter).InnerProduct(myVel) + float parm = hsVector3(&other.GetCenter(), &fCenter).InnerProduct(myVel) / myVel.InnerProduct(myVel); if( parm > 0 ) { - if( parm > hsScalar1 ) - parm = hsScalar1; + if( parm > 1.f ) + parm = 1.f; closestPt += myVel * parm; } } - hsScalar combRad = fRadius + other.fRadius; + float combRad = fRadius + other.fRadius; return hsVector3(&closestPt, &other.GetCenter()).MagnitudeSquared() < combRad*combRad; } @@ -1696,16 +1696,16 @@ hsBool hsBounds3Ext::ISectTriABB(hsBounds3Tri &tri, const hsVector3 &myVel) cons int i; for( i = 0; i < 3; i++ ) { - hsScalar effMax = fMaxs[i]; - hsScalar effMin = fMins[i]; + float effMax = fMaxs[i]; + float effMin = fMins[i]; if( myVel[i] < 0 ) effMin += myVel[i]; else effMax += myVel[i]; int j; - const UInt32 low = 0x1, hi = 0x2; - UInt32 mask = low | hi; + const uint32_t low = 0x1, hi = 0x2; + uint32_t mask = low | hi; for( j = 0; j < 3; j++ ) { if( tri.fVerts[j][i] > effMin ) @@ -1730,8 +1730,8 @@ hsBool hsBounds3Ext::TriBSHitInfo(hsBounds3Tri& tri, const hsVector3& myVel, hsH hsVector3 repel; repel.Set(&myPt, &closePt); - hsScalar myDepth; - hsScalar repelMagSq = repel.MagnitudeSquared(); + float myDepth; + float repelMagSq = repel.MagnitudeSquared(); if( repelMagSq < hsBounds::kRealSmall ) { repel = tri.fNormal; @@ -1767,11 +1767,11 @@ hsBool hsBounds3Ext::TriBBHitInfo(hsBounds3Tri& tri, const hsVector3& myVel, hsH hsPoint3 myPt = fCorner; myPt += myVel; - const hsScalar kMinDist = 1.f; // Huge min dist because world is really big right now. mf horse + const float kMinDist = 1.f; // Huge min dist because world is really big right now. mf horse int i; for( i = 0; i < 3; i++ ) { - hsScalar axDot = fAxes[i].InnerProduct(tri.fNormal); + float axDot = fAxes[i].InnerProduct(tri.fNormal); if( axDot < -kMinDist ) { // moving towards @@ -1796,7 +1796,7 @@ hsBool hsBounds3Ext::TriBBHitInfo(hsBounds3Tri& tri, const hsVector3& myVel, hsH repel.Set(&myPt, &closePt); repel += (-2.f * repel.InnerProduct(tri.fNormal)) * tri.fNormal; - hsScalar repelMag = hsFastMath::InvSqrt(repel.MagnitudeSquared()); + float repelMag = hsFastMath::InvSqrt(repel.MagnitudeSquared()); if( repelMag < hsBounds::kRealSmall ) { @@ -1826,18 +1826,18 @@ hsBool hsBounds3Ext::TriBBHitInfo(hsBounds3Tri& tri, const hsVector3& myVel, hsH hsVector3 repel; repel.Set(&myPt, &closePt); - hsScalar repelDotNorm = repel.InnerProduct(tri.fNormal); + float repelDotNorm = repel.InnerProduct(tri.fNormal); if( repelDotNorm < 0 ) { repel += (-2.f * repelDotNorm) * tri.fNormal; } - hsScalar repelMagSq = repel.MagnitudeSquared(); + float repelMagSq = repel.MagnitudeSquared(); if( repelMagSq < hsBounds::kRealSmall ) repel = tri.fNormal; else { - hsScalar repelMag = hsFastMath::InvSqrt(repelMagSq); + float repelMag = hsFastMath::InvSqrt(repelMagSq); repel *= repelMag; } @@ -1872,7 +1872,7 @@ hsBool hsBounds3Ext::ISectTriBB(hsBounds3Tri &tri, const hsVector3 &myVel) const if( !(tri.fTriFlags & hsBounds3Tri::kAxesSet) ) tri.SetAxes(); - hsScalar depth = tri.fDist - faceDepth.fX; + float depth = tri.fDist - faceDepth.fX; hsVector3 norm = tri.fNormal; // that only leaves the planes of triEdge.Cross(vel) @@ -1886,7 +1886,7 @@ hsBool hsBounds3Ext::ISectTriBB(hsBounds3Tri &tri, const hsVector3 &myVel) const return false; #if 0 - hsScalar testDepth = tri.fPerpDists[i].fY - depths.fX; + float testDepth = tri.fPerpDists[i].fY - depths.fX; if( testDepth < depth ) { depth = testDepth; @@ -1894,7 +1894,7 @@ hsBool hsBounds3Ext::ISectTriBB(hsBounds3Tri &tri, const hsVector3 &myVel) const } #endif } - hsScalar vDotN = myVel.InnerProduct(tri.fNormal); + float vDotN = myVel.InnerProduct(tri.fNormal); if( vDotN > 0 ) depth -= vDotN; @@ -1914,7 +1914,7 @@ hsBool hsBounds3Ext::ISectTriBB(hsBounds3Tri &tri, const hsVector3 &myVel, hsHit ||(tri.fDist < faceDepth.fX) ) return false; - hsScalar centDist = tri.fNormal.InnerProduct(hit->fRootCenter); + float centDist = tri.fNormal.InnerProduct(hit->fRootCenter); if( centDist < tri.fDist ) return false; @@ -1925,7 +1925,7 @@ hsBool hsBounds3Ext::ISectTriBB(hsBounds3Tri &tri, const hsVector3 &myVel, hsHit if( !(tri.fTriFlags & hsBounds3Tri::kAxesSet) ) tri.SetAxes(); - hsScalar depth = tri.fDist - faceDepth.fX; + float depth = tri.fDist - faceDepth.fX; hsVector3 norm = tri.fNormal; // that only leaves the planes of triEdge.Cross(vel) @@ -1939,7 +1939,7 @@ hsBool hsBounds3Ext::ISectTriBB(hsBounds3Tri &tri, const hsVector3 &myVel, hsHit return false; #if 0 - hsScalar testDepth = tri.fPerpDists[i].fY - depths.fX; + float testDepth = tri.fPerpDists[i].fY - depths.fX; if( testDepth < depth ) { depth = testDepth; @@ -1947,7 +1947,7 @@ hsBool hsBounds3Ext::ISectTriBB(hsBounds3Tri &tri, const hsVector3 &myVel, hsHit } #endif } - hsScalar vDotN = myVel.InnerProduct(tri.fNormal); + float vDotN = myVel.InnerProduct(tri.fNormal); if( vDotN > 0 ) depth -= vDotN; @@ -1978,11 +1978,11 @@ hsBool hsBounds3Ext::ISectTriBS(hsBounds3Tri &tri, const hsVector3 &myVel) const IMakeSphere(); hsAssert(fBounds3Flags & kCenterValid, "Sphere set but not center (TriBS)"); - hsScalar radScaled = fRadius * tri.fNormal.Magnitude(); - hsScalar centerDist = tri.fNormal.InnerProduct(fCenter); - hsScalar velDist = tri.fNormal.InnerProduct(myVel); - hsScalar effMin = centerDist; - hsScalar effMax = centerDist; + float radScaled = fRadius * tri.fNormal.Magnitude(); + float centerDist = tri.fNormal.InnerProduct(fCenter); + float velDist = tri.fNormal.InnerProduct(myVel); + float effMin = centerDist; + float effMax = centerDist; if( velDist > 0 ) effMax += velDist; @@ -1997,7 +1997,7 @@ hsBool hsBounds3Ext::ISectTriBS(hsBounds3Tri &tri, const hsVector3 &myVel) const return false; // mf horse - hsScalar normDepth = tri.fDist - (centerDist - radScaled + velDist); + float normDepth = tri.fDist - (centerDist - radScaled + velDist); if( normDepth <= 0 ) { // we'll report a depth of zero to (hopefully) neutralize any effects @@ -2034,7 +2034,7 @@ hsBool hsBounds3Ext::ISectTriBS(hsBounds3Tri &tri, const hsVector3 &myVel) const else effMin += velDist; - hsScalar radScale = fRadius * tri.fPerpAxes[i].Magnitude(); + float radScale = fRadius * tri.fPerpAxes[i].Magnitude(); effMax += radScale; effMin -= radScale; if( tri.fPerpDists[i].fY <= effMin ) @@ -2053,11 +2053,11 @@ hsBool hsBounds3Ext::ISectTriBS(hsBounds3Tri &tri, const hsVector3 &myVel, hsHit IMakeSphere(); hsAssert(fBounds3Flags & kCenterValid, "Sphere set but not center (TriBS)"); - hsScalar radScaled = fRadius * tri.fNormal.Magnitude(); - hsScalar centerDist = tri.fNormal.InnerProduct(fCenter); - hsScalar velDist = tri.fNormal.InnerProduct(myVel); - hsScalar effMin = centerDist; - hsScalar effMax = centerDist; + float radScaled = fRadius * tri.fNormal.Magnitude(); + float centerDist = tri.fNormal.InnerProduct(fCenter); + float velDist = tri.fNormal.InnerProduct(myVel); + float effMin = centerDist; + float effMax = centerDist; if( velDist > 0 ) effMax += velDist; @@ -2072,7 +2072,7 @@ hsBool hsBounds3Ext::ISectTriBS(hsBounds3Tri &tri, const hsVector3 &myVel, hsHit return false; // mf horse - hsScalar normDepth = tri.fDist - (centerDist - radScaled + velDist); + float normDepth = tri.fDist - (centerDist - radScaled + velDist); if( normDepth <= 0 ) { #if 0 // need to report the collision even if the object is leaving the tri @@ -2120,7 +2120,7 @@ hsBool hsBounds3Ext::ISectTriBS(hsBounds3Tri &tri, const hsVector3 &myVel, hsHit else effMin += velDist; - hsScalar radScale = fRadius * tri.fPerpAxes[i].Magnitude(); + float radScale = fRadius * tri.fPerpAxes[i].Magnitude(); effMax += radScale; effMin -= radScale; if( tri.fPerpDists[i].fY <= effMin ) @@ -2130,7 +2130,7 @@ hsBool hsBounds3Ext::ISectTriBS(hsBounds3Tri &tri, const hsVector3 &myVel, hsHit } - hsScalar invLen = hsScalarInvert(tri.fNormal.Magnitude()); + float invLen = hsInvert(tri.fNormal.Magnitude()); hit->Set(this, &tri, &tri.fNormal, normDepth); // mf horse - move this into Set()? @@ -2149,7 +2149,7 @@ hsBool hsBounds3Ext::ISectBSBS(const hsBounds3Ext& other, const hsVector3& myVel if(!(other.fExtFlags & kSphereSet) ) other.IMakeSphere(); - hsScalar tClose, tImpact; + float tClose, tImpact; if( !IClosestISect(other, myVel, &tClose, &tImpact) ) return false; if( (tImpact < 0) || (tImpact > 1.f) ) @@ -2163,8 +2163,8 @@ hsBool hsBounds3Ext::ISectBSBS(const hsBounds3Ext& other, const hsVector3& myVel hsVector3 del; del.Set(&closePt, &other.GetCenter()); - hsScalar mag = del.Magnitude(); - hsScalar depth = GetRadius() + other.GetRadius() - mag; + float mag = del.Magnitude(); + float depth = GetRadius() + other.GetRadius() - mag; if( depth <= 0 ) return false; @@ -2201,10 +2201,10 @@ hsBool hsBounds3Ext::ISectBoxBS(const hsBounds3Ext &other, const hsVector3 &myVe hsAssert(fBounds3Flags & kCenterValid, "Sphere set but not center (BoxBS(vel))"); hsVector3 minAxis; - hsScalar minDepth; + float minDepth; hsBool haveAxis = false; hsVector3 tstAxis; - hsScalar tstDepth; + float tstDepth; int i; for( i = 0; i < 3; i++ ) { @@ -2212,9 +2212,9 @@ hsBool hsBounds3Ext::ISectBoxBS(const hsBounds3Ext &other, const hsVector3 &myVe if( other.fExtFlags & kAxisAligned ) { // first try the other box axes - hsScalar effMin = fCenter[i]; - hsScalar effMax = effMin; - hsScalar velDist = myVel[i]; + float effMin = fCenter[i]; + float effMax = effMin; + float velDist = myVel[i]; if( velDist > 0 ) effMax += velDist; else @@ -2232,7 +2232,7 @@ hsBool hsBounds3Ext::ISectBoxBS(const hsBounds3Ext &other, const hsVector3 &myVe { tstDepth = other.fMaxs[i] - effMin; hsAssert(tstDepth > -kRealSmall, "Late to be finding sep axis"); - tstAxis.Set(i == 0 ? hsScalar1 : 0, i & 1 ? hsScalar1 : 0, i & 2 ? hsScalar1 : 0); + tstAxis.Set(i == 0 ? 1.f : 0, i & 1 ? 1.f : 0, i & 2 ? 1.f : 0); tryAxis = true; } else @@ -2241,7 +2241,7 @@ hsBool hsBounds3Ext::ISectBoxBS(const hsBounds3Ext &other, const hsVector3 &myVe { tstDepth = effMax - other.fMins[i]; hsAssert(tstDepth > -kRealSmall, "Late to be finding sep axis"); - tstAxis.Set(i == 0 ? -hsScalar1 : 0, i & 1 ? -hsScalar1 : 0, i & 2 ? -hsScalar1 : 0); + tstAxis.Set(i == 0 ? -1.f : 0, i & 1 ? -1.f : 0, i & 2 ? -1.f : 0); tryAxis = true; } else @@ -2250,11 +2250,11 @@ hsBool hsBounds3Ext::ISectBoxBS(const hsBounds3Ext &other, const hsVector3 &myVe else { // first try the other box axes - hsScalar radScaled = fRadius * other.fAxes[i].Magnitude(); - hsScalar centerDist = other.fAxes[i].InnerProduct(fCenter); - hsScalar effMin = centerDist; - hsScalar effMax = centerDist; - hsScalar velDist = other.fAxes[i].InnerProduct(myVel); + float radScaled = fRadius * other.fAxes[i].Magnitude(); + float centerDist = other.fAxes[i].InnerProduct(fCenter); + float effMin = centerDist; + float effMax = centerDist; + float velDist = other.fAxes[i].InnerProduct(myVel); if( velDist > 0 ) effMax += velDist; else @@ -2289,10 +2289,10 @@ hsBool hsBounds3Ext::ISectBoxBS(const hsBounds3Ext &other, const hsVector3 &myVe } if( tryAxis ) { - hsScalar magSq = tstAxis.MagnitudeSquared(); + float magSq = tstAxis.MagnitudeSquared(); if( magSq > kRealSmall ) { - tstDepth *= tstDepth * hsScalarInvert(magSq); + tstDepth *= tstDepth * hsInvert(magSq); if( !haveAxis||(tstDepth < minDepth) ) { minDepth = tstDepth; @@ -2307,14 +2307,14 @@ hsBool hsBounds3Ext::ISectBoxBS(const hsBounds3Ext &other, const hsVector3 &myVe hsVector3 diag(&fCenter, &other.GetCenter()); if( !haveAxis && (diag.MagnitudeSquared() < kRealSmall) ) diag.Set(1.f, 0, 0); - hsScalar effMin = diag.InnerProduct(fCenter); - hsScalar effMax = effMin; - hsScalar velDist = diag.InnerProduct(myVel); + float effMin = diag.InnerProduct(fCenter); + float effMax = effMin; + float velDist = diag.InnerProduct(myVel); if( velDist > 0 ) effMax += velDist; else effMin += velDist; - hsScalar radDist = fRadius * diag.Magnitude(); + float radDist = fRadius * diag.Magnitude(); effMax += radDist; effMin -= radDist; hsPoint2 otherDepth; @@ -2326,10 +2326,10 @@ hsBool hsBounds3Ext::ISectBoxBS(const hsBounds3Ext &other, const hsVector3 &myVe tstAxis = diag; tstDepth = otherDepth.fY - effMin; - hsScalar magSq = tstAxis.MagnitudeSquared(); + float magSq = tstAxis.MagnitudeSquared(); if( magSq > 0 ) { - tstDepth *= tstDepth * hsScalarInvert(magSq); + tstDepth *= tstDepth * hsInvert(magSq); if( !haveAxis ||(tstDepth < minDepth) ) { minDepth = tstDepth; @@ -2337,10 +2337,10 @@ hsBool hsBounds3Ext::ISectBoxBS(const hsBounds3Ext &other, const hsVector3 &myVe } } - hsScalar invMag = hsScalarInvert(minAxis.Magnitude()); + float invMag = hsInvert(minAxis.Magnitude()); minAxis *= invMag; hsAssert(minDepth >= 0, "Late to find sep plane"); - minDepth = hsSquareRoot(minDepth); + minDepth = sqrt(minDepth); hit->Set(this, &other, minAxis, minDepth); return true; @@ -2358,9 +2358,9 @@ hsBool hsBounds3Ext::ISectBoxBS(const hsBounds3Ext &other, const hsVector3 &myVe int i; for( i = 0; i < 3; i++ ) { - hsScalar effMin = fCenter[i]; - hsScalar effMax = effMin; - hsScalar velDist = myVel[i]; + float effMin = fCenter[i]; + float effMax = effMin; + float velDist = myVel[i]; if( velDist > 0 ) effMax += velDist; else @@ -2383,14 +2383,14 @@ hsBool hsBounds3Ext::ISectBoxBS(const hsBounds3Ext &other, const hsVector3 &myVe int i; for( i = 0; i < 3; i++ ) { - hsScalar effMin = other.fAxes[i].InnerProduct(fCenter); - hsScalar effMax = effMin; - hsScalar velDist = other.fAxes[i].InnerProduct(myVel); + float effMin = other.fAxes[i].InnerProduct(fCenter); + float effMax = effMin; + float velDist = other.fAxes[i].InnerProduct(myVel); if( velDist > 0 ) effMax += velDist; else effMin += velDist; - hsScalar radScaled = fRadius * other.fAxes[i].Magnitude(); + float radScaled = fRadius * other.fAxes[i].Magnitude(); effMax += radScaled; effMin -= radScaled; @@ -2403,14 +2403,14 @@ hsBool hsBounds3Ext::ISectBoxBS(const hsBounds3Ext &other, const hsVector3 &myVe // now try the axis between the center of sphere and center of other box hsVector3 diag(&fCenter, &other.GetCenter()); - hsScalar effMin = diag.InnerProduct(fCenter); - hsScalar effMax = effMin; - hsScalar velDist = diag.InnerProduct(myVel); + float effMin = diag.InnerProduct(fCenter); + float effMax = effMin; + float velDist = diag.InnerProduct(myVel); if( velDist > 0 ) effMax += velDist; else effMin += velDist; - hsScalar radDist = fRadius * diag.Magnitude(); + float radDist = fRadius * diag.Magnitude(); effMax += radDist; effMin -= radDist; hsPoint2 otherDepth; @@ -2429,9 +2429,9 @@ hsBool hsBounds3Ext::ISectLine(const hsPoint3* from, const hsPoint3* at) const IMakeSphere(); hsPoint3 onLine; - hsScalar z = ClosestPointToLine(&fCenter, from, at, &onLine); + float z = ClosestPointToLine(&fCenter, from, at, &onLine); - hsScalar distSq = hsVector3(&onLine, &fCenter).MagnitudeSquared(); + float distSq = hsVector3(&onLine, &fCenter).MagnitudeSquared(); if( distSq >= fRadius*fRadius ) return false; @@ -2454,8 +2454,8 @@ hsBool hsBounds3Ext::ISectLine(const hsPoint3* from, const hsPoint3* at) const int i; for( i = 0; i < 3; i++ ) { - hsScalar d0 = fAxes[i].InnerProduct(from); - hsScalar d1 = fAxes[i].InnerProduct(at); + float d0 = fAxes[i].InnerProduct(from); + float d1 = fAxes[i].InnerProduct(at); if( d0 < d1 ) { if( d1 < fDists[i].fX ) @@ -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, hsScalar radius) const +hsBool hsBounds3Ext::ISectCone(const hsPoint3* from, const hsPoint3* at, float radius) const { if( !(fExtFlags & kSphereSet) ) IMakeSphere(); @@ -2484,14 +2484,14 @@ hsBool hsBounds3Ext::ISectCone(const hsPoint3* from, const hsPoint3* at, hsScala hsPoint3 onLine; ClosestPointToLine(&fCenter, from, at, &onLine); - hsScalar distSq = hsVector3(&onLine, &fCenter).MagnitudeSquared(); - hsScalar radiusSq = fRadius * fRadius; + float distSq = hsVector3(&onLine, &fCenter).MagnitudeSquared(); + float radiusSq = fRadius * fRadius; if (distSq - radius*radius >= radiusSq) return false; - hsScalar dist = hsVector3(from, &onLine).Magnitude(); - hsScalar len = hsVector3(from, at).Magnitude(); - hsScalar partRadius = radius/len * dist; + float dist = hsVector3(from, &onLine).Magnitude(); + float len = hsVector3(from, at).Magnitude(); + float partRadius = radius/len * dist; if (distSq - fRadius*fRadius - partRadius*partRadius >= 0) { hsVector3 rayToCenter(&fCenter,&onLine); @@ -2531,8 +2531,8 @@ hsBool hsBounds3Ext::ISectCone(const hsPoint3* from, const hsPoint3* at, hsScala atLine.Normalize(); hsPoint3 atEdge = *at + atLine * radius; - hsScalar d0 = fAxes[i].InnerProduct(*from); - hsScalar d1 = fAxes[i].InnerProduct(atEdge); + float d0 = fAxes[i].InnerProduct(*from); + float d1 = fAxes[i].InnerProduct(atEdge); if( d0 < d1 ) { if( d1 < fDists[i].fX ) @@ -2557,18 +2557,18 @@ hsBool hsBounds3Ext::ISectRayBS(const hsPoint3& from, const hsPoint3& to, hsPoin { hsVector3 c2f(&from,&GetCenter()); hsVector3 f2t(&to,&from); - hsScalar a = f2t.MagnitudeSquared(); - hsScalar b = 2 * (c2f.InnerProduct(f2t)); - hsScalar c = c2f.MagnitudeSquared() - GetRadius()*GetRadius(); + float a = f2t.MagnitudeSquared(); + float b = 2 * (c2f.InnerProduct(f2t)); + float c = c2f.MagnitudeSquared() - GetRadius()*GetRadius(); - hsScalar disc = b*b - 4*a*c; + float disc = b*b - 4*a*c; if (disc < 0) return false; else { - hsScalar discSqrt = hsSquareRoot(disc); - hsScalar denom = 1.f/(2*a); - hsScalar t = (-b - discSqrt) * denom; + float discSqrt = sqrt(disc); + float denom = 1.f/(2*a); + float t = (-b - discSqrt) * denom; if (t<1 && t>0) at = from + (f2t * t); @@ -2640,7 +2640,7 @@ void hsBounds3Tri::TestPlane(const hsVector3 &n, hsPoint2 &depth) const { depth.fX = depth.fY = n.InnerProduct(fVerts[0]); - hsScalar d1, d2; + float d1, d2; d1 = n.InnerProduct(fVerts[1]); d2 = n.InnerProduct(fVerts[2]); @@ -2666,10 +2666,10 @@ hsBool hsBounds3Tri::ClosestTriPoint(const hsPoint3 *p, hsPoint3 *out, const hsV hsPoint3 pPln; if( ax ) { - hsScalar t; + float t; t = fNormal.InnerProduct(fVerts[0] - *p); - hsScalar s = fNormal.InnerProduct(ax); + float s = fNormal.InnerProduct(ax); if( (s > hsBounds::kRealSmall)||(s < -hsBounds::kRealSmall) ) { t /= s; @@ -2684,7 +2684,7 @@ hsBool hsBounds3Tri::ClosestTriPoint(const hsPoint3 *p, hsPoint3 *out, const hsV } else { - hsScalar t; + float t; t = fNormal.InnerProduct(fVerts[0] - *p); t /= fNormal.MagnitudeSquared(); @@ -2701,7 +2701,7 @@ hsBool hsBounds3Tri::ClosestTriPoint(const hsPoint3 *p, hsPoint3 *out, const hsV int i; for( i = 0; i < 3; i++ ) { - hsScalar tst = fPerpAxes[i].InnerProduct(pPln); + float tst = fPerpAxes[i].InnerProduct(pPln); hsBool in = false; if( fOnIsMax & (1 << i) ) { @@ -2733,9 +2733,9 @@ hsBool hsBounds3Tri::ClosestTriPoint(const hsPoint3 *p, hsPoint3 *out, const hsV kPlus = k == 2 ? 0 : k+1; hsPoint3 pTmp; - hsScalar z; + float z; z = hsBounds3::ClosestPointToLine(&pPln, fVerts+k, fVerts+kPlus, &pTmp); - if( z <= hsScalar1 ) + if( z <= 1.f ) *out = pTmp; else { @@ -2768,13 +2768,13 @@ hsBool hsBounds3Tri::ClosestTriPoint(const hsPoint3 *p, hsPoint3 *out, const hsV if( 0 ) { hsVector3 ndeb = hsVector3(fVerts+1, fVerts) % hsVector3(fVerts+2, fVerts); - hsScalar dis; + float dis; dis = fNormal.InnerProduct(pPln) - fDist; if( (fDist > hsBounds::kRealSmall)||(fDist < -hsBounds::kRealSmall) ) dis /= fDist; hsAssert((dis < hsBounds::kRealSmall)&&(dis > -hsBounds::kRealSmall), "Non-planar pPln"); dis = hsVector3(&pPln, out).MagnitudeSquared(); - hsScalar vDis; + float vDis; vDis = hsVector3(&pPln, fVerts+0).MagnitudeSquared(); hsAssert( vDis - dis > -hsBounds::kRealSmall, "Bad closest point"); vDis = hsVector3(&pPln, fVerts+1).MagnitudeSquared(); @@ -2784,9 +2784,9 @@ hsBool hsBounds3Tri::ClosestTriPoint(const hsPoint3 *p, hsPoint3 *out, const hsV hsBool dork = false; if( dork ) { - hsScalar zn[3]; - hsScalar zf[3]; - hsScalar z[3]; + float zn[3]; + float zf[3]; + float z[3]; int i; for( i = 0; i < 3; i++ ) { @@ -2829,7 +2829,7 @@ void hsBounds3Tri::SetAxes() const if( fPerpDists[i].fX > fPerpDists[i].fY ) { fOnIsMax |= 1 << i; - hsScalar d = fPerpDists[i].fX; + float d = fPerpDists[i].fX; fPerpDists[i].fX = fPerpDists[i].fY; fPerpDists[i].fY = d; } @@ -2878,7 +2878,7 @@ hsBounds3Tri* hsBounds3Tri::Translate(const hsVector3& v) int j = i == 2 ? 0 : i+1; int k = j == 2 ? 0 : j+1; - hsScalar del = fPerpAxes[i].InnerProduct(v); + float del = fPerpAxes[i].InnerProduct(v); fPerpDists[i].fX += del; fPerpDists[i].fY += del; } @@ -2940,7 +2940,7 @@ hsBounds3Tri::hsBounds3Tri(hsTriangle3* t, const hsMatrix44& x) t, x); } -void hsBounds3Tri::Set(hsPoint3 *v0, hsPoint3 *v1, hsPoint3 *v2, hsVector3 *n, UInt32 triFlags, hsTriangle3 *t) +void hsBounds3Tri::Set(hsPoint3 *v0, hsPoint3 *v1, hsPoint3 *v2, hsVector3 *n, uint32_t triFlags, hsTriangle3 *t) { fTriFlags = 0; @@ -2958,7 +2958,7 @@ void hsBounds3Tri::Set(hsPoint3 *v0, hsPoint3 *v1, hsPoint3 *v2, hsVector3 *n, U fDist = fNormal.InnerProduct(fVerts[0]); } -hsBounds3Tri::hsBounds3Tri(hsPoint3 *v0, hsPoint3 *v1, hsPoint3 *v2, hsVector3 *n, UInt32 triFlags, hsTriangle3 *t) +hsBounds3Tri::hsBounds3Tri(hsPoint3 *v0, hsPoint3 *v1, hsPoint3 *v2, hsVector3 *n, uint32_t triFlags, hsTriangle3 *t) { Set(v0, v1, v2, n, triFlags, t); } @@ -2977,11 +2977,11 @@ hsBounds3Tri::~hsBounds3Tri() // Finds closest intersection vertex or triangle/center-line intersection -hsBool hsBounds3Tri::ISectCone(const hsPoint3& from, const hsPoint3& to, hsScalar cosThetaSq, hsBool ignoreFacing, hsPoint3& at, hsBool& backSide) const +hsBool hsBounds3Tri::ISectCone(const hsPoint3& from, const hsPoint3& to, float cosThetaSq, hsBool ignoreFacing, hsPoint3& at, hsBool& backSide) const { - hsScalar d0 = from.InnerProduct(fNormal); - hsScalar d1 = at.InnerProduct(fNormal); - hsScalar dt = fNormal.InnerProduct(fVerts[0]); + float d0 = from.InnerProduct(fNormal); + float d1 = at.InnerProduct(fNormal); + float dt = fNormal.InnerProduct(fVerts[0]); backSide = d0 < dt; if( !ignoreFacing && backSide ) return false; @@ -2991,16 +2991,16 @@ hsBool hsBounds3Tri::ISectCone(const hsPoint3& from, const hsPoint3& to, hsScala return true; hsVector3 av(&to,&from); - hsScalar distASq = av.MagnitudeSquared(); - hsScalar radiusSq = distASq * (1-cosThetaSq)/cosThetaSq; + float distASq = av.MagnitudeSquared(); + float radiusSq = distASq * (1-cosThetaSq)/cosThetaSq; - hsScalar minDistSq = 0; - Int32 minVert = 0; + float minDistSq = 0; + int32_t minVert = 0; hsBool sect = false; - for (Int32 i=0; i<3; i++) + for (int32_t i=0; i<3; i++) { hsPoint3 onLine; - hsScalar t = hsBounds3::ClosestPointToLine(&fVerts[i], &from, &to, &onLine); + float t = hsBounds3::ClosestPointToLine(&fVerts[i], &from, &to, &onLine); // outside the cap of the cylinder if (t<0 || t>1) @@ -3012,9 +3012,9 @@ hsBool hsBounds3Tri::ISectCone(const hsPoint3& from, const hsPoint3& to, hsScala hsVector3 bv(&fVerts[i],&from); - hsScalar distBSq = bv.MagnitudeSquared(); + float distBSq = bv.MagnitudeSquared(); - hsScalar cosMuSquared = (av * bv) / (distASq * distBSq); + float cosMuSquared = (av * bv) / (distASq * distBSq); // outside the angle of the cone if (cosMuSquared > cosThetaSq) diff --git a/Sources/Plasma/CoreLib/hsBounds.h b/Sources/Plasma/CoreLib/hsBounds.h index c6659e36..d582f970 100644 --- a/Sources/Plasma/CoreLib/hsBounds.h +++ b/Sources/Plasma/CoreLib/hsBounds.h @@ -68,7 +68,7 @@ class hsBounds protected: hsBoundsType fType; public: - static const hsScalar kRealSmall; + static const float kRealSmall; hsBounds() : fType(kBoundsUninitialized) { }; @@ -98,7 +98,7 @@ public: kIsSphere = 0x2 }; protected: - mutable UInt32 fBounds3Flags; + mutable uint32_t fBounds3Flags; hsPoint3 fMins; hsPoint3 fMaxs; mutable hsPoint3 fCenter; @@ -130,7 +130,7 @@ public: virtual void GetCorners(hsPoint3 *b) const; const hsPoint3& GetMins() const; const hsPoint3& GetMaxs() const; - hsScalar GetMaxDim() const; // Computes the answer + 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 void TestPlane(const hsVector3 &n, hsPoint2 &depth) const; @@ -139,10 +139,10 @@ public: // Test according to my axes only, doesn't check other's axes // neg, pos, zero == disjoint, I contain other, overlap - virtual Int32 TestBound(const hsBounds3& other) const; + virtual int32_t TestBound(const hsBounds3& other) const; - static hsScalar ClosestPointToLine(const hsPoint3 *p, const hsPoint3 *v0, const hsPoint3 *v1, hsPoint3 *out); - static hsScalar ClosestPointToInfiniteLine(const hsPoint3* p, const hsVector3* v, hsPoint3* out); + static float ClosestPointToLine(const hsPoint3 *p, const hsPoint3 *v0, const hsPoint3 *v1, hsPoint3 *out); + static float ClosestPointToInfiniteLine(const hsPoint3* p, const hsVector3* v, hsPoint3* out); virtual void Read(hsStream*); virtual void Write(hsStream*); @@ -183,7 +183,7 @@ inline const hsPoint3& hsBounds3::GetCenter() const return fCenter; } -inline hsScalar hsBounds3::GetMaxDim() const +inline float hsBounds3::GetMaxDim() const { hsAssert(kBoundsNormal == fType, "Invalid type for GetMaxDim"); return hsMaximum(hsMaximum(fMaxs.fX-fMins.fX, fMaxs.fY-fMins.fY), fMaxs.fZ-fMins.fZ); @@ -198,7 +198,7 @@ private: hsBool fCenterValid; hsPoint3 fCenter; hsPlane3 *fPlanes; - UInt32 fNumPlanes; + uint32_t fNumPlanes; public: hsBoundsOriented() : fPlanes(nil),fNumPlanes(0),fCenterValid(false) {} virtual ~hsBoundsOriented() { if (fPlanes) delete [] fPlanes; } @@ -209,7 +209,7 @@ public: void SetCenter(const hsBoundsOriented* b) { fCenter=b->GetCenter(); fCenterValid = true; } hsPoint3 GetCenter() const; - void SetNumberPlanes(UInt32 n); + void SetNumberPlanes(uint32_t n); hsPlane3* GetPlane(int i) { return &fPlanes[i]; } int GetNumPlanes() { return fNumPlanes; } @@ -218,7 +218,7 @@ public: // These set type to kBounds Normal // virtual void Reset(const hsBounds3*); - void SetPlane(UInt32 i, hsPlane3 *p); + void SetPlane(uint32_t i, hsPlane3 *p); // // Only valid for kBounds Normal @@ -241,13 +241,13 @@ protected: kAxisOneZero =(1<<21), kAxisTwoZero =(1<<22) }; - mutable UInt32 fExtFlags; + mutable uint32_t fExtFlags; hsPoint3 fCorner; hsVector3 fAxes[3]; mutable hsPoint2 fDists[3]; - mutable hsScalar fRadius; + mutable float fRadius; - hsBool IAxisIsZero(UInt32 i) const { return (fExtFlags & (1 << (20+i))) != 0; }; + hsBool IAxisIsZero(uint32_t i) const { return (fExtFlags & (1 << (20+i))) != 0; }; void IMakeSphere() const; void IMakeDists() const; void IMakeMinsMaxs(); @@ -276,7 +276,7 @@ public: virtual void Transform(const hsMatrix44 *m); virtual void Translate(const hsVector3 &v); - virtual hsScalar GetRadius() const; + virtual float GetRadius() const; 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; @@ -285,36 +285,36 @@ public: virtual hsBool IsInside(const hsPoint3* pos) const; // ok for full/empty virtual void TestPlane(const hsVector3 &n, hsPoint2 &depth) const; - virtual Int32 TestPoints(int n, const hsPoint3 *pList) const; // pos,neg,zero == allout, allin, cut + virtual int32_t TestPoints(int n, const hsPoint3 *pList) const; // pos,neg,zero == allout, allin, cut // Test according to my axes only, doesn't check other's axes // neg, pos, zero == disjoint, I contain other, overlap - virtual Int32 TestBound(const hsBounds3Ext& other) const; + virtual int32_t TestBound(const hsBounds3Ext& other) const; 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 TestPoints(int n, const hsPoint3 *pList, const hsVector3 &ptVel) const; // pos,neg,zero == allout, allin, cut + 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 Int32 IClosestISect(const hsBounds3Ext& other, const hsVector3& myVel, - hsScalar* tClose, hsScalar* tImpact) 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 hsBool ISectLine(const hsPoint3* from, const hsPoint3* to) const; - virtual hsBool ISectCone(const hsPoint3* from, const hsPoint3* to, hsScalar radius) 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 void Read(hsStream *s); virtual void Write(hsStream *s); }; -inline hsScalar hsBounds3Ext::GetRadius() const +inline float hsBounds3Ext::GetRadius() const { if( !(fExtFlags & kSphereSet) ) IMakeSphere(); @@ -323,7 +323,7 @@ inline hsScalar hsBounds3Ext::GetRadius() const class hsHitInfoExt { public: - hsScalar fDepth; + float fDepth; hsVector3 fNormal; hsVector3 fDelPos; @@ -333,9 +333,9 @@ public: hsHitInfoExt(const hsPoint3 *ctr, const hsVector3& offset) { fRootCenter=ctr; fDelPos=offset; }; - void Set(const hsBounds3Ext *m, const hsVector3* n, hsScalar d) + void Set(const hsBounds3Ext *m, const hsVector3* n, float d) { fDepth = d; fBoxBnd = m; fNormal = *n; fOtherBoxBnd = nil; } - void Set(const hsBounds3Ext *m, const hsBounds3Ext *o, const hsVector3 &norm, hsScalar d) + void Set(const hsBounds3Ext *m, const hsBounds3Ext *o, const hsVector3 &norm, float d) { fDepth = d; fBoxBnd = m, fOtherBoxBnd = o; fNormal = norm; } }; #endif // hsBounds_inc diff --git a/Sources/Plasma/CoreLib/hsColorRGBA.h b/Sources/Plasma/CoreLib/hsColorRGBA.h index 8ecca454..a0c06a65 100644 --- a/Sources/Plasma/CoreLib/hsColorRGBA.h +++ b/Sources/Plasma/CoreLib/hsColorRGBA.h @@ -43,15 +43,14 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #ifndef hsColorRGBA_inc #define hsColorRGBA_inc -#include "hsScalar.h" #include "hsStream.h" struct hsColorRGBA { - hsScalar r,g,b,a; + float r,g,b,a; hsRGBAColor32 ToRGBA32() const; - hsColorRGBA& Set(hsScalar red, hsScalar grn, hsScalar blu, hsScalar alp) { r = red; g = grn; b = blu; a = alp; return *this; } + 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); } @@ -65,12 +64,12 @@ struct hsColorRGBA { friend inline hsColorRGBA operator-(const hsColorRGBA& s, const hsColorRGBA& t); hsColorRGBA& operator-=(const hsColorRGBA& s); - friend inline hsColorRGBA operator*(const hsColorRGBA& c, const hsScalar s); - friend inline hsColorRGBA operator*(const hsScalar s, const hsColorRGBA& c); - hsColorRGBA& operator*=(const hsScalar s); + friend inline hsColorRGBA operator*(const hsColorRGBA& c, const float s); + friend inline hsColorRGBA operator*(const float s, const hsColorRGBA& c); + hsColorRGBA& operator*=(const float s); - hsColorRGBA& FromARGB32(UInt32 c); - UInt32 ToARGB32() const; + hsColorRGBA& FromARGB32(uint32_t c); + uint32_t ToARGB32() const; void Read(hsStream *stream); void Write(hsStream *stream) const; @@ -91,22 +90,22 @@ inline void hsColorRGBA::Write(hsStream *s) const s->WriteLEScalar(a); } -inline hsColorRGBA& hsColorRGBA::FromARGB32(UInt32 c) +inline hsColorRGBA& hsColorRGBA::FromARGB32(uint32_t c) { - const hsScalar oo255 = 1.f / 255.f; - a = hsScalar((c >> 24) & 0xff) * oo255; - r = hsScalar((c >> 16) & 0xff) * oo255; - g = hsScalar((c >> 8) & 0xff) * oo255; - b = hsScalar((c >> 0) & 0xff) * oo255; + const float oo255 = 1.f / 255.f; + a = float((c >> 24) & 0xff) * oo255; + r = float((c >> 16) & 0xff) * oo255; + g = float((c >> 8) & 0xff) * oo255; + b = float((c >> 0) & 0xff) * oo255; return *this; } -inline UInt32 hsColorRGBA::ToARGB32() const +inline uint32_t hsColorRGBA::ToARGB32() const { - return (UInt32(a * 255.99f) << 24) - | (UInt32(r * 255.99f) << 16) - | (UInt32(g * 255.99f) << 8) - | (UInt32(b * 255.99f) << 0); + return (uint32_t(a * 255.99f) << 24) + | (uint32_t(r * 255.99f) << 16) + | (uint32_t(g * 255.99f) << 8) + | (uint32_t(b * 255.99f) << 0); } inline hsColorRGBA operator+(const hsColorRGBA& s, const hsColorRGBA& t) @@ -151,16 +150,16 @@ inline hsColorRGBA& hsColorRGBA::operator-=(const hsColorRGBA& s) return *this; } -inline hsColorRGBA operator*(const hsColorRGBA& t, const hsScalar s) +inline hsColorRGBA operator*(const hsColorRGBA& t, const float s) { hsColorRGBA res; return res.Set(s * t.r, s * t.g, s * t.b, s * t.a); } -inline hsColorRGBA operator*(const hsScalar s, const hsColorRGBA&t) +inline hsColorRGBA operator*(const float s, const hsColorRGBA&t) { return t * s; } -inline hsColorRGBA& hsColorRGBA::operator*=(const hsScalar s) +inline hsColorRGBA& hsColorRGBA::operator*=(const float s) { r *= s; g *= s; diff --git a/Sources/Plasma/CoreLib/hsConfig.h b/Sources/Plasma/CoreLib/hsConfig.h deleted file mode 100644 index 10878ae5..00000000 --- a/Sources/Plasma/CoreLib/hsConfig.h +++ /dev/null @@ -1,128 +0,0 @@ -/*==LICENSE==* - -CyanWorlds.com Engine - MMOG client, server and tools -Copyright (C) 2011 Cyan Worlds, Inc. - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . - -Additional permissions under GNU GPL version 3 section 7 - -If you modify this Program, or any covered work, by linking or -combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK, -NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent -JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK -(or a modified version of those libraries), -containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA, -PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG -JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the -licensors of this Program grant you additional -permission to convey the resulting work. Corresponding Source for a -non-source form of such a combination shall include the source code for -the parts of OpenSSL and IJG JPEG Library used as well as that of the covered -work. - -You can contact Cyan Worlds, Inc. by email legal@cyan.com - or by snail mail at: - Cyan Worlds, Inc. - 14617 N Newport Hwy - Mead, WA 99021 - -*==LICENSE==*/ -#include "HeadSpin.h" - -#ifndef hsConfigDefined -#define hsConfigDefined - - -#ifndef SERVER -# define CLIENT -#endif - - -//////////////////// Change the 1s and 0s ////////////////////// - -#define HS_CAN_USE_FLOAT 1 -#define HS_SCALAR_IS_FLOAT 1 - -#define HS_PIN_MATH_OVERFLOW 0 // This forces hsWide versions of FixMath routines -#define HS_DEBUG_MATH_OVERFLOW 0 // This calls hsDebugMessage on k[Pos,Neg]Infinity - - - -//////////////////// Specific Compiler Stuff This Section is computed //////////// - -#if defined(_WIN32) - #define HS_BUILD_FOR_WIN32 1 -#elif defined(__unix__) - #define HS_BUILD_FOR_UNIX 1 -#endif - -#define HS_SCALAR_IS_FIXED !(HS_SCALAR_IS_FLOAT) -#define HS_NEVER_USE_FLOAT !(HS_CAN_USE_FLOAT) - -#if HS_DEBUG_MATH_OVERFLOW && !(HS_PIN_MATH_OVERFLOW) - #error "Can't debug overflow unless HS_PIN_MATH_OVERFLOW is ON" -#endif - - -///////////////////////Windows Specific Defines ///////////////////////////// - -#if HS_BUILD_FOR_WIN32 - -// 4244: Conversion -// 4305: Truncation -// 4503: 'identifier' : decorated name length exceeded, name was truncated -// 4018: signed/unsigned mismatch -// 4786: 255 character debug limit -// 4284: STL template defined operator-> for a class it doesn't make sense for (int, etc) -// 4800: 'int': forcing value to bool 'true' or 'false' (performance warning) -#ifdef _MSC_VER -#pragma warning( disable : 4305 4503 4018 4786 4284 4800) -#endif - -// VC++ version greater than 6.0, must be building for .NET -#if defined(_MSC_VER) && (_MSC_VER > 1200) -#define HS_BUILD_FOR_WIN32_NET -#endif - -#pragma optimize( "y", off ) - -#endif - - -#ifdef HS_BUILD_FOR_WIN32 -# ifndef CDECL -# define CDECL __cdecl -# endif -#else -# define CDECL -#endif - - -/////////////////////Debugging Defines /////////////////////////////////// - -#if (defined(_DEBUG)||defined(UNIX_DEBUG)) && !defined(HS_DISABLE_ASSERT) -#define HS_DEBUGGING -#if (!defined(HS_NO_MEM_TRACKER)) -#define HS_FIND_MEM_LEAKS -#endif -#endif - - -///////////////////// Required facilities /////////////////////////////// -#ifndef HeadSpinHDefined -#include "HeadSpin.h" -#endif - -#endif // hsConfigDefined diff --git a/Sources/Plasma/CoreLib/hsExceptionStack.h b/Sources/Plasma/CoreLib/hsExceptionStack.h index cd0e27e1..c11f0274 100644 --- a/Sources/Plasma/CoreLib/hsExceptionStack.h +++ b/Sources/Plasma/CoreLib/hsExceptionStack.h @@ -42,8 +42,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #ifndef hsExceptionStack_inc #define hsExceptionStack_inc -#include "hsUtils.h" -#include "hsTypes.h" +#include "HeadSpin.h" #include "hsTemplates.h" class hsExceptionStackDestroyer; @@ -62,8 +61,8 @@ public: static hsExceptionStack& Instance(); - Int32 GetNumEntries() const { return fEntries.Count(); } - const char* GetEntry(Int32 i) const { return fEntries[i]; } + int32_t GetNumEntries() const { return fEntries.Count(); } + const char* GetEntry(int32_t i) const { return fEntries[i]; } void Push(const char* str); @@ -84,7 +83,7 @@ inline hsExceptionStack& hsExceptionStack::Instance() { if (!fExceptionStack) { - fExceptionStack = TRACKED_NEW hsExceptionStack; + fExceptionStack = new hsExceptionStack; } return *fExceptionStack; diff --git a/Sources/Plasma/CoreLib/hsExceptions.h b/Sources/Plasma/CoreLib/hsExceptions.h index d6ba38e6..1cf3dd33 100644 --- a/Sources/Plasma/CoreLib/hsExceptions.h +++ b/Sources/Plasma/CoreLib/hsExceptions.h @@ -42,7 +42,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #ifndef hsExceptionDefined #define hsExceptionDefined -#include "hsTypes.h" +#include "HeadSpin.h" // #define HS_NO_EXCEPTIONS -- this will turn off execptions you might want // to do it with -D or equivalent instead of here since who knows who includes this. diff --git a/Sources/Plasma/CoreLib/hsFastMath.cpp b/Sources/Plasma/CoreLib/hsFastMath.cpp index d6e679b4..969d4037 100644 --- a/Sources/Plasma/CoreLib/hsFastMath.cpp +++ b/Sources/Plasma/CoreLib/hsFastMath.cpp @@ -40,14 +40,13 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ -#include "hsTypes.h" -#include "hsScalar.h" +#include "HeadSpin.h" #include "hsGeometry3.h" #include "hsFastMath.h" -const hsScalar hsFastMath::kSqrtTwo = hsSquareRoot(2.f); -const hsScalar hsFastMath::kInvSqrtTwo = hsScalarInvert(hsFastMath::kSqrtTwo); -const hsScalar hsFastMath::kTwoPI = hsScalarPI * 2.f; +const float hsFastMath::kSqrtTwo = sqrt(2.f); +const float hsFastMath::kInvSqrtTwo = hsInvert(hsFastMath::kSqrtTwo); +const float hsFastMath::kTwoPI = M_PI * 2.f; hsPoint2 statCosSinTable[9] = // must match length in inline { @@ -579,11 +578,11 @@ unsigned char statSeedTable[] = { 0x6a }; -hsScalar hsFastMath::IATan2OverTwoPi(hsScalar y, hsScalar x) +float hsFastMath::IATan2OverTwoPi(float y, float x) { const int tabSize = 16; // pad with one extra because hi can go hi const int tabMax = tabSize-1; - static hsScalar tab[tabSize+1] = { + static float tab[tabSize+1] = { 0.f, 0.0105947f, 0.0210962f, @@ -609,14 +608,14 @@ hsScalar hsFastMath::IATan2OverTwoPi(hsScalar y, hsScalar x) if((yNeg = (y < 0)))y = -y; if((xNeg = (x < 0)))x = -x; hsBool yBigger = y >= x; - hsScalar div = yBigger ? x / y : y / x; + float div = yBigger ? x / y : y / x; - hsScalar fInd = div * tabMax; + float fInd = div * tabMax; int lo = int(fInd); int hi = lo+1; - hsScalar frac = fInd - lo; + float frac = fInd - lo; - hsScalar res = tab[lo]; + float res = tab[lo]; res += frac * (tab[hi] - res); // now move to proper half quadrant diff --git a/Sources/Plasma/CoreLib/hsFastMath.h b/Sources/Plasma/CoreLib/hsFastMath.h index 58beffd5..b9ade03b 100644 --- a/Sources/Plasma/CoreLib/hsFastMath.h +++ b/Sources/Plasma/CoreLib/hsFastMath.h @@ -51,27 +51,27 @@ protected: static const hsPoint2* fCosSinTable; public: - static const hsScalar kSqrtTwo; - static const hsScalar kInvSqrtTwo; - static const hsScalar kTwoPI; + static const float kSqrtTwo; + static const float kInvSqrtTwo; + static const float kTwoPI; - static hsScalar IATan2OverTwoPi(hsScalar y, hsScalar x); + static float IATan2OverTwoPi(float y, float x); - static inline hsScalar InvSqrtAppr(hsScalar x); - static inline hsScalar InvSqrt(hsScalar x); + static inline float InvSqrtAppr(float x); + static inline float InvSqrt(float x); static inline hsVector3& Normalize(hsVector3& v) { return (v *= InvSqrt(v.MagnitudeSquared())); } static inline hsVector3& NormalizeAppr(hsVector3& v) { return (v *= InvSqrtAppr(v.MagnitudeSquared())); } - static inline void SinCosAppr(hsScalar rads, hsScalar& sinRads, hsScalar& cosRads); - static inline void SinCosInRangeAppr(hsScalar rads, hsScalar& sinRads, hsScalar& cosRads); + static inline void SinCosAppr(float rads, float& sinRads, float& cosRads); + static inline void SinCosInRangeAppr(float rads, float& sinRads, float& cosRads); - static inline void SinCos(hsScalar rads, hsScalar& sinRads, hsScalar& cosRads); - static inline void SinCosInRange(hsScalar ang, hsScalar& sinRads, hsScalar& cosRads); + static inline void SinCos(float rads, float& sinRads, float& cosRads); + static inline void SinCosInRange(float ang, float& sinRads, float& cosRads); - static inline hsScalar Sin(hsScalar rads); - static inline hsScalar Cos(hsScalar rads); - static inline hsScalar SinInRange(hsScalar rads); - static inline hsScalar CosInRange(hsScalar rads); + static inline float Sin(float rads); + static inline float Cos(float rads); + static inline float SinInRange(float rads); + static inline float CosInRange(float rads); }; @@ -104,7 +104,7 @@ public: #define SET_MANTSEED(a) (((unsigned long) (a)) << SEED_POS) -inline hsScalar hsFastMath::InvSqrtAppr(hsScalar x) +inline float hsFastMath::InvSqrtAppr(float x) { register unsigned long a = *(long*)&x; register float arg = x; @@ -131,7 +131,7 @@ inline hsScalar hsFastMath::InvSqrtAppr(hsScalar x) return r; } -inline hsScalar hsFastMath::InvSqrt(hsScalar x) +inline float hsFastMath::InvSqrt(float x) { register unsigned long a = *(long*)&x; register float arg = x; @@ -155,7 +155,7 @@ inline hsScalar hsFastMath::InvSqrt(hsScalar x) } -inline void hsFastMath::SinCosAppr(hsScalar rads, hsScalar& sinRads, hsScalar& cosRads) +inline void hsFastMath::SinCosAppr(float rads, float& sinRads, float& cosRads) { rads = fmodf(rads, kTwoPI); if( rads < 0 ) @@ -163,11 +163,11 @@ inline void hsFastMath::SinCosAppr(hsScalar rads, hsScalar& sinRads, hsScalar& c SinCosInRangeAppr(rads, sinRads, cosRads); } -inline void hsFastMath::SinCosInRangeAppr(hsScalar rads, hsScalar& sinRads, hsScalar& cosRads) +inline void hsFastMath::SinCosInRangeAppr(float rads, float& sinRads, float& cosRads) { const int kNumSinCosEntries = 8; - const hsScalar kNumEntriesOverTwoPI = kNumSinCosEntries * 0.5f / hsScalarPI; - hsScalar t = rads * kNumEntriesOverTwoPI; + const float kNumEntriesOverTwoPI = kNumSinCosEntries * 0.5f / M_PI; + float t = rads * kNumEntriesOverTwoPI; int iLo = (int)t; t -= iLo; @@ -184,7 +184,7 @@ inline void hsFastMath::SinCosInRangeAppr(hsScalar rads, hsScalar& sinRads, hsSc } -inline hsScalar hsFastMath::Sin(hsScalar rads) +inline float hsFastMath::Sin(float rads) { rads = fmodf(rads, kTwoPI); if( rads < 0 ) @@ -193,7 +193,7 @@ inline hsScalar hsFastMath::Sin(hsScalar rads) return SinInRange(rads); } -inline hsScalar hsFastMath::Cos(hsScalar rads) +inline float hsFastMath::Cos(float rads) { rads = fmodf(rads, kTwoPI); if( rads < 0 ) @@ -202,7 +202,7 @@ inline hsScalar hsFastMath::Cos(hsScalar rads) return CosInRange(rads); } -inline hsScalar hsFastMath::SinInRange(hsScalar ang) +inline float hsFastMath::SinInRange(float ang) { float sgn = 1.f; @@ -217,7 +217,7 @@ inline hsScalar hsFastMath::SinInRange(hsScalar ang) return (ang - (ang*ang*ang) * (1.0f/6.0f) + (ang*ang*ang*ang*ang) / 120.0f) * sgn; } -inline hsScalar hsFastMath::CosInRange(hsScalar ang) +inline float hsFastMath::CosInRange(float ang) { float sgn = 1.f; @@ -232,7 +232,7 @@ inline hsScalar hsFastMath::CosInRange(hsScalar ang) return (1.0f - (ang*ang / 2.0f) + (ang*ang*ang*ang) / 24.0f) *sgn; } -inline void hsFastMath::SinCos(hsScalar rads, hsScalar& sinRads, hsScalar& cosRads) +inline void hsFastMath::SinCos(float rads, float& sinRads, float& cosRads) { rads = fmodf(rads, kTwoPI); if( rads < 0 ) @@ -240,7 +240,7 @@ inline void hsFastMath::SinCos(hsScalar rads, hsScalar& sinRads, hsScalar& cosRa SinCosInRange(rads, sinRads, cosRads); } -inline void hsFastMath::SinCosInRange(hsScalar ang, hsScalar& sinRads, hsScalar& cosRads) +inline void hsFastMath::SinCosInRange(float ang, float& sinRads, float& cosRads) { float sgn = 1.f; diff --git a/Sources/Plasma/CoreLib/hsFixedTypes.h b/Sources/Plasma/CoreLib/hsFixedTypes.h deleted file mode 100644 index d695223b..00000000 --- a/Sources/Plasma/CoreLib/hsFixedTypes.h +++ /dev/null @@ -1,120 +0,0 @@ -/*==LICENSE==* - -CyanWorlds.com Engine - MMOG client, server and tools -Copyright (C) 2011 Cyan Worlds, Inc. - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . - -Additional permissions under GNU GPL version 3 section 7 - -If you modify this Program, or any covered work, by linking or -combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK, -NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent -JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK -(or a modified version of those libraries), -containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA, -PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG -JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the -licensors of this Program grant you additional -permission to convey the resulting work. Corresponding Source for a -non-source form of such a combination shall include the source code for -the parts of OpenSSL and IJG JPEG Library used as well as that of the covered -work. - -You can contact Cyan Worlds, Inc. by email legal@cyan.com - or by snail mail at: - Cyan Worlds, Inc. - 14617 N Newport Hwy - Mead, WA 99021 - -*==LICENSE==*/ -#ifndef hsFixedTypesDefined -#define hsFixedTypesDefined - -#include "hsTypes.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#define hsIntToFixed(x) ((hsFixed)(x) << 16) -#define hsFixedToInt(x) ((x) >> 16) -#define hsFixedRound(x) (((x) + 0x8000) >> 16) -#define hsFixed1 hsIntToFixed(1) -#define hsFixedPI (0x3243F) -#define hsFixedPiOver2 (0x1921F) - -#define hsFixedToFract(x) ((hsFract)(x) << 14) -#define hsFractToFixed(x) ((hsFixed)(x) >> 14) -#define hsFract1 hsFixedToFract(hsFixed1) -#define hsFractPiOver2 (0x6487ED34) /* needs some work */ - -#define hsFixFloor(x) \ - (hsFixed)((x) < 0 ? -(hsFixed)((-(x) + 0xFFFF) & 0xFFFF0000) : (x) & 0xFFFF0000) - -#define hsFixedToFloorInt(x) \ - (int)((x) < 0 ? -(int)((-(x) + 0xFFFF) >> 16) : ((x) >> 16)) - -#define hsFixCeiling(x) \ - (hsFixed)((x) < 0 ? -(hsFixed)(-(x) & 0xFFFF0000) : ((x) + 0xFFFF) & 0xFFFF0000) - -#define hsFixedToCeilingInt(x) \ - (int)((x) < 0 ? -(int)(-(x) >> 16) : (((x) + 0xFFFF) >> 16)) - - -#if HS_CAN_USE_FLOAT - #define hsFixedToFloat(x) ((x) / float(hsFixed1)) - #define hsFloatToFixed(x) hsFixed((x) * hsFixed1) - - #define hsFractToFloat(x) ((x) / float(hsFract1)) - #define hsFloatToFract(x) hsFract((x) * hsFract1) -#endif - - -hsFixed hsFixMul(hsFixed a, hsFixed b); - -hsFract hsFixDiv(hsFixed a, hsFixed b); -hsFract hsFracMul(hsFract a, hsFract b); -hsFract hsFracDiv(hsFract a, hsFract b); - -hsFract hsFracSqrt(hsFract value); -#define hsFixSqrt(value) (hsFracSqrt(value) >> 7) -hsFract hsFracCubeRoot(hsFract value); -hsFixed hsFixedSin(hsFixed s); -hsFixed hsFixedCos(hsFixed s); -hsFixed hsFixedASin(hsFixed s); -hsFixed hsFixedACos(hsFixed s); - -UInt16 hsSqrt32(UInt32 value); -UInt16 hsCubeRoot32(UInt32 value); -Int32 hsMulDiv32(Int32 numer1, Int32 numer2, Int32 denom); -Int32 hsMagnitude32(Int32 x, Int32 y); - -#ifdef __cplusplus -} -#endif - -#ifdef __cplusplus - struct hsFixedPlane { - hsFixed fA, fB, fC; - - void Set(hsFixed a, hsFixed b, hsFixed c) { fA = a; fB = b; fC = c; } - - hsFixed FixEval(hsFixed x, hsFixed y) const { return hsFixMul(fA, x) + hsFixMul(fB, y) + fC; } - Int32 IntEval(Int32 x, Int32 y) const { return fA * x + fB * y + fC; } - void ShiftDown(UInt32 i) { fA >>= i; fB >>= i; fC >>= i;} - }; -#endif - -#endif diff --git a/Sources/Plasma/CoreLib/hsGeometry3.cpp b/Sources/Plasma/CoreLib/hsGeometry3.cpp index f83c6359..c9cbeb17 100644 --- a/Sources/Plasma/CoreLib/hsGeometry3.cpp +++ b/Sources/Plasma/CoreLib/hsGeometry3.cpp @@ -41,14 +41,15 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ #include "hsGeometry3.h" #include "hsStream.h" +#include hsVector3 operator%(const hsVector3& t, const hsVector3& s) { hsVector3 result; - return *result.Set( hsScalarMul(t.fY, s.fZ) - hsScalarMul(s.fY, t.fZ), - -hsScalarMul(t.fX, s.fZ) + hsScalarMul(s.fX, t.fZ), - hsScalarMul(t.fX, s.fY) - hsScalarMul(s.fX, t.fY)); + return *result.Set((t.fY * s.fZ) - (s.fY * t.fZ), + -(t.fX * s.fZ) + (s.fX * t.fZ), + (t.fX * s.fY) - (s.fX * t.fY)); } @@ -56,33 +57,10 @@ hsVector3 operator%(const hsVector3& t, const hsVector3& s) ////////////////////////////////// ///////////////////////////////// -#if HS_SCALAR_IS_FIXED -hsScalar hsScalarTriple::Magnitude() const +float hsScalarTriple::Magnitude() const { - hsWide result, temp; - - result.Mul(fCoord[0], fCoord[0]); - temp.Mul(fCoord[1], fCoord[1]); - result.Add(&temp); - temp.Mul(fCoord[2], fCoord[2]); - result.Add(&temp); - - return result.Sqrt(); -} - -hsScalar hsScalarTriple::MagnitudeSquared() const -{ - hsWide result, temp; - - result.Mul(fCoord[0], fCoord[0]); - temp.Mul(fCoord[1], fCoord[1]); - result.Add(&temp); - temp.Mul(fCoord[2], fCoord[2]); - result.Add(&temp); - - return result.AsFixed(); + return sqrt(MagnitudeSquared()); } -#endif void hsScalarTriple::Read(hsStream *stream) { diff --git a/Sources/Plasma/CoreLib/hsGeometry3.h b/Sources/Plasma/CoreLib/hsGeometry3.h index a77025e7..acef0a8e 100644 --- a/Sources/Plasma/CoreLib/hsGeometry3.h +++ b/Sources/Plasma/CoreLib/hsGeometry3.h @@ -42,26 +42,27 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #ifndef hsGGeometry3Defined #define hsGGeometry3Defined -#include "hsTypes.h" +#include "HeadSpin.h" + struct hsVector3; struct hsPoint3; struct hsScalarTriple; class hsStream; /* - If value is already close to hsScalar1, then this is a good approx. of 1/sqrt(value) + If value is already close to 1.f, then this is a good approx. of 1/sqrt(value) */ -static inline hsScalar hsInvSqrt(hsScalar value) +static inline float hsInvSqrt(float value) { - hsScalar guess; - hsScalar threeOverTwo = hsScalar1 + hsScalarHalf; + float guess; + float threeOverTwo = 1.5f; - value = hsScalarDiv2(value); + value /= 2.f; guess = threeOverTwo - value; // with initial guess = 1.0 // repeat this line for better approx - guess = hsScalarMul(guess, threeOverTwo - hsScalarMul(hsScalarMul(value, guess), guess)); - guess = hsScalarMul(guess, threeOverTwo - hsScalarMul(hsScalarMul(value, guess), guess)); + guess = (guess * threeOverTwo - ((value * guess) * guess)); + guess = (guess * threeOverTwo - ((value * guess) * guess)); return guess; } @@ -71,12 +72,12 @@ struct hsScalarTriple { //protected: // hsScalarTriple() : fX(privateData[0]), fY(privateData[1]), fZ(privateData[2]) {} -// hsScalarTriple(hsScalar x, hsScalar y, hsScalar z) +// hsScalarTriple(float x, float y, float z) // : fX(privateData[0]), fY(privateData[1]), fZ(privateData[2]) { fX = x, fY = y, fZ = z; } // // union { // u_long128 privateTemp; -// hsScalar privateData[4]; +// float privateData[4]; // }; //public: // @@ -84,34 +85,29 @@ struct hsScalarTriple // hsScalarTriple(const hsScalarTriple& o) : fX(privateData[0]), fY(privateData[1]), fZ(privateData[2]) // { *this = o; } // -// hsScalar& fX; -// hsScalar& fY; -// hsScalar& fZ; +// float& fX; +// float& fY; +// float& fZ; protected: hsScalarTriple() {} - hsScalarTriple(hsScalar x, hsScalar y, hsScalar z) : fX(x), fY(y), fZ(z) {} + hsScalarTriple(float x, float y, float z) : fX(x), fY(y), fZ(z) {} public: - hsScalar fX, fY, fZ; + float fX, fY, fZ; - hsScalarTriple* Set(hsScalar x, hsScalar y, hsScalar z) { fX= x; fY = y; fZ = z; return this;} + hsScalarTriple* Set(float x, float y, float z) { fX= x; fY = y; fZ = z; return this;} hsScalarTriple* Set(const hsScalarTriple *p) { fX = p->fX; fY = p->fY; fZ = p->fZ; return this;} - hsScalar InnerProduct(const hsScalarTriple &p) const; - hsScalar InnerProduct(const hsScalarTriple *p) const; - -// hsScalarTriple LERP(hsScalarTriple &other, hsScalar t); -#if HS_SCALAR_IS_FIXED - hsScalar Magnitude() const; - hsScalar MagnitudeSquared() const; -#else - hsScalar Magnitude() const { return hsSquareRoot(MagnitudeSquared()); } - hsScalar MagnitudeSquared() const { return (fX * fX + fY * fY + fZ * fZ); } -#endif + float InnerProduct(const hsScalarTriple &p) const; + float InnerProduct(const hsScalarTriple *p) const; + +// hsScalarTriple LERP(hsScalarTriple &other, float t); + float Magnitude() const; + float MagnitudeSquared() const { return (fX * fX + fY * fY + fZ * fZ); } hsBool IsEmpty() const { return fX == 0 && fY == 0 && fZ == 0; } - hsScalar operator[](int i) const; - hsScalar& operator[](int i); + float operator[](int i) const; + float& operator[](int i); void Read(hsStream *stream); void Write(hsStream *stream) const; @@ -120,32 +116,32 @@ public: /////////////////////////////////////////////////////////////////////////// -inline hsScalar& hsScalarTriple::operator[] (int i) +inline float& hsScalarTriple::operator[] (int i) { hsAssert(i >=0 && i <3, "Bad index for hsScalarTriple::operator[]"); return *(&fX + i); } -inline hsScalar hsScalarTriple::operator[] (int i) const +inline float hsScalarTriple::operator[] (int i) const { hsAssert(i >=0 && i <3, "Bad index for hsScalarTriple::operator[]"); return *(&fX + i); } -inline hsScalar hsScalarTriple::InnerProduct(const hsScalarTriple &p) const +inline float hsScalarTriple::InnerProduct(const hsScalarTriple &p) const { - hsScalar tmp = fX*p.fX; + float tmp = fX*p.fX; tmp += fY*p.fY; tmp += fZ*p.fZ; return tmp; } -inline hsScalar hsScalarTriple::InnerProduct(const hsScalarTriple *p) const +inline float hsScalarTriple::InnerProduct(const hsScalarTriple *p) const { - hsScalar tmp = fX*p->fX; + float tmp = fX*p->fX; tmp += fY*p->fY; tmp += fZ*p->fZ; return tmp; } -//inline hsScalarTriple hsScalarTriple::LERP(hsScalarTriple &other, hsScalar t) +//inline hsScalarTriple hsScalarTriple::LERP(hsScalarTriple &other, float t) //{ // hsScalarTriple p = other - this; // p = p / t; @@ -157,26 +153,26 @@ inline hsScalar hsScalarTriple::InnerProduct(const hsScalarTriple *p) const ///////////////////////////////////////////////////////////////////////////////////////////// struct hsPoint3 : public hsScalarTriple { hsPoint3() {}; - hsPoint3(hsScalar x, hsScalar y, hsScalar z) : hsScalarTriple(x,y,z) {} + hsPoint3(float x, float y, float z) : hsScalarTriple(x,y,z) {} explicit hsPoint3(const hsScalarTriple& p) : hsScalarTriple(p) {} - hsPoint3* Set(hsScalar x, hsScalar y, hsScalar z) { return (hsPoint3*)this->hsScalarTriple::Set(x,y,z);} + hsPoint3* Set(float x, float y, float z) { return (hsPoint3*)this->hsScalarTriple::Set(x,y,z);} hsPoint3* Set(const hsScalarTriple* p) { return (hsPoint3*)this->hsScalarTriple::Set(p) ;} friend inline hsPoint3 operator+(const hsPoint3& s, const hsPoint3& t); friend inline hsPoint3 operator+(const hsPoint3& s, const hsVector3& t); friend inline hsPoint3 operator-(const hsPoint3& s, const hsPoint3& t); friend inline hsPoint3 operator-(const hsPoint3& s); - friend inline hsPoint3 operator*(const hsScalar& s, const hsPoint3& t); - friend inline hsPoint3 operator*(const hsPoint3& t, const hsScalar& s); - friend inline hsPoint3 operator/(const hsPoint3& t, const hsScalar& s); + 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 { return (ss.fX == fX && ss.fY == fY && ss.fZ == fZ); } hsBool operator!=(const hsPoint3& ss) const { return !(*this == ss); } hsPoint3 &operator+=(const hsScalarTriple &s) { fX += s.fX; fY += s.fY; fZ += s.fZ; return *this; } - hsPoint3 &operator*=(const hsScalar s) { fX *= s; fY *= s; fZ *= s; return *this; } + hsPoint3 &operator*=(const float s) { fX *= s; fY *= s; fZ *= s; return *this; } }; @@ -185,38 +181,38 @@ struct hsPoint3 : public hsScalarTriple { struct hsVector3 : public hsScalarTriple { hsVector3() {}; - hsVector3(hsScalar x, hsScalar y, hsScalar z) : hsScalarTriple(x,y,z) {} + hsVector3(float x, float y, float z) : hsScalarTriple(x,y,z) {} explicit hsVector3(const hsScalarTriple& p) : hsScalarTriple(p) { } hsVector3(const hsPoint3 *p1, const hsPoint3 *p2) { fX = p1->fX - p2->fX, fY= p1->fY - p2->fY, fZ = p1->fZ - p2->fZ; } - hsVector3* Set(hsScalar x, hsScalar y, hsScalar z) { return (hsVector3*)hsScalarTriple::Set(x,y,z); } + hsVector3* Set(float x, float y, float z) { return (hsVector3*)hsScalarTriple::Set(x,y,z); } hsVector3* Set(const hsScalarTriple* p) { return (hsVector3*)hsScalarTriple::Set(p) ;} hsVector3* Set(const hsScalarTriple* p1, const hsScalarTriple* p2) { return Set(p1->fX-p2->fX,p1->fY-p2->fY,p1->fZ-p2->fZ);} void Normalize() { - hsScalar length = this->Magnitude(); + float length = this->Magnitude(); // hsIfDebugMessage(length == 0, "Err: Normalizing hsVector3 of length 0", 0); if (length == 0) return; - hsScalar invMag = hsScalarInvert(length); + float invMag = hsInvert(length); - fX = hsScalarMul(fX, invMag); - fY = hsScalarMul(fY, invMag); - fZ = hsScalarMul(fZ, invMag); + fX = (fX * invMag); + fY = (fY * invMag); + fZ = (fZ * invMag); } inline void Renormalize() // if the vector is already close to unit length { - hsScalar mag2 = *this * *this; + float mag2 = *this * *this; hsIfDebugMessage(mag2 == 0, "Err: Renormalizing hsVector3 of length 0", 0); if (mag2 == 0) return; - hsScalar invMag = hsInvSqrt(mag2); + float invMag = hsInvSqrt(mag2); - fX = hsScalarMul(fX, invMag); - fY = hsScalarMul(fY, invMag); - fZ = hsScalarMul(fZ, invMag); + fX = (fX * invMag); + fY = (fY * invMag); + fZ = (fZ * invMag); } // hsVector3 &Sub(const hsPoint3& s, const hsPoint3& t) @@ -225,10 +221,10 @@ struct hsVector3 : public hsScalarTriple { friend inline hsVector3 operator+(const hsVector3& s, const hsVector3& t); friend inline hsVector3 operator-(const hsVector3& s, const hsVector3& t); friend inline hsVector3 operator-(const hsVector3& s); - friend inline hsVector3 operator*(const hsScalar& s, const hsVector3& t); - friend inline hsVector3 operator*(const hsVector3& t, const hsScalar& s); - friend inline hsVector3 operator/(const hsVector3& t, const hsScalar& s); - friend inline hsScalar operator*(const hsVector3& t, const hsVector3& s); + friend inline hsVector3 operator*(const float& s, const hsVector3& t); + friend inline hsVector3 operator*(const hsVector3& t, const float& s); + 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) @@ -243,20 +239,20 @@ struct hsVector3 : public hsScalarTriple { #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 hsScalar s) { fX *= s; fY *= s; fZ *= s; return *this; } - hsVector3 &operator/=(const hsScalar s) { fX /= s; fY /= s; fZ /= s; return *this; } + hsVector3 &operator*=(const float s) { fX *= s; fY *= s; fZ *= s; return *this; } + hsVector3 &operator/=(const float s) { fX /= s; fY /= s; fZ /= s; return *this; } }; struct hsPoint4 { - hsScalar fX, fY, fZ, fW; + float fX, fY, fZ, fW; hsPoint4() {} - hsPoint4(hsScalar x, hsScalar y, hsScalar z, hsScalar w) : fX(x), fY(y), fZ(z), fW(w) {} - hsScalar& operator[](int i); - hsScalar operator[](int i) const; + hsPoint4(float x, float y, float z, float w) : fX(x), fY(y), fZ(z), fW(w) {} + float& operator[](int i); + float operator[](int i) const; - hsPoint4& operator=(const hsPoint3&p) { Set(p.fX, p.fY, p.fZ, hsScalar1); return *this; } + hsPoint4& operator=(const hsPoint3&p) { Set(p.fX, p.fY, p.fZ, 1.f); return *this; } - hsPoint4* Set(hsScalar x, hsScalar y, hsScalar z, hsScalar w) + hsPoint4* Set(float x, float y, float z, float w) { fX = x; fY = y; fZ = z; fW = w; return this; } }; @@ -282,28 +278,28 @@ inline hsVector3 operator-(const hsVector3& s) return *result.Set(-s.fX, -s.fY, -s.fZ); } -inline hsVector3 operator*(const hsVector3& s, const hsScalar& t) +inline hsVector3 operator*(const hsVector3& s, const float& t) { hsVector3 result; - return *result.Set(hsScalarMul(s.fX, t), hsScalarMul(s.fY, t), hsScalarMul(s.fZ, t)); + return *result.Set(s.fX * t, s.fY * t, s.fZ * t); } -inline hsVector3 operator/(const hsVector3& s, const hsScalar& t) +inline hsVector3 operator/(const hsVector3& s, const float& t) { hsVector3 result; - return *result.Set(hsScalarDiv(s.fX, t), hsScalarDiv(s.fY, t), hsScalarDiv(s.fZ, t)); + return *result.Set(s.fX / t, s.fY / t, s.fZ / t); } -inline hsVector3 operator*(const hsScalar& t, const hsVector3& s) +inline hsVector3 operator*(const float& t, const hsVector3& s) { hsVector3 result; - return *result.Set(hsScalarMul(s.fX, t), hsScalarMul(s.fY, t), hsScalarMul(s.fZ, t)); + return *result.Set(s.fX * t, s.fY * t, s.fZ * t); } -inline hsScalar operator*(const hsVector3& t, const hsVector3& s) +inline float operator*(const hsVector3& t, const hsVector3& s) { - return hsScalarMul(t.fX, s.fX) + hsScalarMul(t.fY, s.fY) + hsScalarMul(t.fZ, s.fZ); + return (t.fX * s.fX) + (t.fY * s.fY) + (t.fZ * s.fZ); } //////////////////////////////////////////////////////////////////////////// @@ -343,32 +339,32 @@ inline hsPoint3 operator-(const hsPoint3& s, const hsVector3& t) return *result.Set(s.fX - t.fX, s.fY - t.fY, s.fZ - t.fZ); } -inline hsPoint3 operator*(const hsPoint3& s, const hsScalar& t) +inline hsPoint3 operator*(const hsPoint3& s, const float& t) { hsPoint3 result; - return *result.Set(hsScalarMul(s.fX, t), hsScalarMul(s.fY, t), hsScalarMul(s.fZ, t)); + return *result.Set((s.fX * t), (s.fY * t), (s.fZ * t)); } -inline hsPoint3 operator/(const hsPoint3& s, const hsScalar& t) +inline hsPoint3 operator/(const hsPoint3& s, const float& t) { hsPoint3 result; - return *result.Set(hsScalarDiv(s.fX, t), hsScalarDiv(s.fY, t), hsScalarDiv(s.fZ, t)); + return *result.Set((s.fX / t), (s.fY / t), (s.fZ / t)); } -inline hsPoint3 operator*(const hsScalar& t, const hsPoint3& s) +inline hsPoint3 operator*(const float& t, const hsPoint3& s) { hsPoint3 result; - return *result.Set(hsScalarMul(s.fX, t), hsScalarMul(s.fY, t), hsScalarMul(s.fZ, t)); + return *result.Set((s.fX * t), (s.fY * t), (s.fZ * t)); } -inline hsScalar hsPoint4::operator[] (int i) const +inline float hsPoint4::operator[] (int i) const { hsAssert(i >=0 && i <4, "Bad index for hsPoint4::operator[]"); return *(&fX + i); } -inline hsScalar& hsPoint4::operator[] (int i) +inline float& hsPoint4::operator[] (int i) { hsAssert(i >=0 && i <4, "Bad index for hsPoint4::operator[]"); return *(&fX + i); @@ -389,10 +385,10 @@ struct hsPointNorm { struct hsPlane3 { hsVector3 fN; - hsScalar fD; + float fD; hsPlane3() { } - hsPlane3(const hsVector3* nrml, hsScalar d) + hsPlane3(const hsVector3* nrml, float d) { fN = *nrml; fD=d; } hsPlane3(const hsPoint3* pt, const hsVector3* nrml) { fN = *nrml; fD = -pt->InnerProduct(nrml); } diff --git a/Sources/Plasma/CoreLib/hsHashTable.h b/Sources/Plasma/CoreLib/hsHashTable.h index 1313fa0b..c3973a35 100644 --- a/Sources/Plasma/CoreLib/hsHashTable.h +++ b/Sources/Plasma/CoreLib/hsHashTable.h @@ -51,7 +51,7 @@ class hsHashTableIterator { public: hsHashTableIterator() : fList(nil), fIndex(-1) { } - explicit hsHashTableIterator(hsTArray* list, UInt32 idx) : fList(list), fIndex(idx) { } + explicit hsHashTableIterator(hsTArray* list, uint32_t idx) : fList(list), fIndex(idx) { } T* operator->() const { return &((*fList)[fIndex]); } T& operator*() const { return (*fList)[fIndex]; } @@ -67,7 +67,7 @@ public: private: hsTArray* fList; - UInt32 fIndex; + uint32_t fIndex; }; @@ -75,7 +75,7 @@ template class hsHashTable { public: - hsHashTable(UInt32 size=150001, UInt32 step=1); + hsHashTable(uint32_t size=150001, uint32_t step=1); ~hsHashTable(); typedef hsHashTableIterator iterator; @@ -84,25 +84,25 @@ public: iterator end() { return iterator(&fItemList,0); } void clear(); - UInt32 count() { return fItemList.Count()-1; } - UInt32 size() { return fSize; } + uint32_t count() { return fItemList.Count()-1; } + uint32_t size() { return fSize; } - UInt32 CollisionCount() { return fCollisionCount; } + uint32_t CollisionCount() { return fCollisionCount; } inline void insert(T& item); inline void erase(T& item); inline iterator find(const T& item); - iterator GetItem(UInt32 i); + iterator GetItem(uint32_t i); private: hsTArray fItemList; - hsTArray fClearList; + hsTArray fClearList; - UInt32* fHashTable; - UInt32 fSize; - UInt32 fCollisionStep; - UInt32 fCollisionCount; + uint32_t* fHashTable; + uint32_t fSize; + uint32_t fCollisionStep; + uint32_t fCollisionCount; // No copy or assignment hsHashTable(const hsHashTable&); @@ -110,14 +110,14 @@ private: }; template -hsHashTable::hsHashTable(UInt32 size, UInt32 step) : +hsHashTable::hsHashTable(uint32_t size, uint32_t step) : fSize(size), fCollisionStep(step), fCollisionCount(0) { fItemList.SetCount(1); - fHashTable = TRACKED_NEW UInt32[fSize]; - memset(fHashTable,0,fSize*sizeof(UInt32)); + fHashTable = new uint32_t[fSize]; + memset(fHashTable,0,fSize*sizeof(uint32_t)); } template @@ -130,7 +130,7 @@ template void hsHashTable::clear() { fItemList.SetCount(1); - for (Int32 i=0; i void hsHashTable::insert(T& item) { hsAssert(fClearList.Count() < fSize,"Hash table overflow! Increase the table size."); - UInt32 h = item.GetHash(); + uint32_t h = item.GetHash(); h %= fSize; - while (UInt32 it = fHashTable[h]) + while (uint32_t it = fHashTable[h]) { if ( fItemList[it] == item) { @@ -160,9 +160,9 @@ void hsHashTable::insert(T& item) template void hsHashTable::erase(T& item) { - UInt32 h = item.GetHash(); + uint32_t h = item.GetHash(); h %= fSize; - while (UInt32 it = fHashTable[h]) + while (uint32_t it = fHashTable[h]) { if ( fItemList[it] == item ) { @@ -175,9 +175,9 @@ void hsHashTable::erase(T& item) template hsHashTableIterator hsHashTable::find(const T& item) { - UInt32 h = item.GetHash(); + uint32_t h = item.GetHash(); h %= fSize; - while (UInt32 it = fHashTable[h]) + while (uint32_t it = fHashTable[h]) { if ( fItemList[it] == item ) { @@ -191,7 +191,7 @@ hsHashTableIterator hsHashTable::find(const T& item) } template -hsHashTableIterator hsHashTable::GetItem(UInt32 i) +hsHashTableIterator hsHashTable::GetItem(uint32_t i) { return iterator(&fItemList,i+1); } diff --git a/Sources/Plasma/CoreLib/hsMMIOStream.cpp b/Sources/Plasma/CoreLib/hsMMIOStream.cpp deleted file mode 100644 index 31e9e214..00000000 --- a/Sources/Plasma/CoreLib/hsMMIOStream.cpp +++ /dev/null @@ -1,105 +0,0 @@ -/*==LICENSE==* - -CyanWorlds.com Engine - MMOG client, server and tools -Copyright (C) 2011 Cyan Worlds, Inc. - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . - -Additional permissions under GNU GPL version 3 section 7 - -If you modify this Program, or any covered work, by linking or -combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK, -NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent -JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK -(or a modified version of those libraries), -containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA, -PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG -JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the -licensors of this Program grant you additional -permission to convey the resulting work. Corresponding Source for a -non-source form of such a combination shall include the source code for -the parts of OpenSSL and IJG JPEG Library used as well as that of the covered -work. - -You can contact Cyan Worlds, Inc. by email legal@cyan.com - or by snail mail at: - Cyan Worlds, Inc. - 14617 N Newport Hwy - Mead, WA 99021 - -*==LICENSE==*/ -#include "hsMMIOStream.h" - -////////////////////////////////////////////////////////////////////////////////////// - -#if HS_BUILD_FOR_WIN32 - -#include "hsExceptions.h" - -UInt32 hsMMIOStream::Read(UInt32 bytes, void* buffer) -{ - fBytesRead += bytes; - fPosition += bytes; - int numItems = ::mmioRead(fHmfr, (char*)buffer, bytes); - if ((unsigned)numItems < bytes) - { - if (numItems>=0 && ::mmioSeek(fHmfr,0,SEEK_CUR)==::mmioSeek(fHmfr,0,SEEK_END)) { - // EOF ocurred - char str[128]; - sprintf(str, "Hit EOF on MMIO Read, only read %d out of requested %d bytes\n", numItems, bytes); - hsDebugMessage(str, 0); - } - else - { - hsDebugMessage("Error on MMIO Read",0); - } - } - return numItems; -} - -hsBool hsMMIOStream::AtEnd() -{ - return (::mmioSeek(fHmfr,0,SEEK_CUR)==::mmioSeek(fHmfr,0,SEEK_END)); -} - -UInt32 hsMMIOStream::Write(UInt32 bytes, const void* buffer) -{ - fPosition += bytes; - return ::mmioWrite(fHmfr,(const char*)buffer,bytes); -} - -void hsMMIOStream::Skip(UInt32 delta) -{ - fBytesRead += delta; - fPosition += delta; - (void)::mmioSeek(fHmfr, delta, SEEK_CUR); -} - -void hsMMIOStream::Rewind() -{ - fBytesRead = 0; - fPosition = 0; - (void)::mmioSeek(fHmfr, 0, SEEK_SET); -} - -void hsMMIOStream::FastFwd() -{ - fBytesRead = fPosition = ::mmioSeek(fHmfr, 0, SEEK_END); -} - -void hsMMIOStream::Truncate() -{ - hsThrow("Truncate unimplemented by subclass of stream"); -} -#endif diff --git a/Sources/Plasma/CoreLib/hsMMIOStream.h b/Sources/Plasma/CoreLib/hsMMIOStream.h deleted file mode 100644 index 6baa1edf..00000000 --- a/Sources/Plasma/CoreLib/hsMMIOStream.h +++ /dev/null @@ -1,72 +0,0 @@ -/*==LICENSE==* - -CyanWorlds.com Engine - MMOG client, server and tools -Copyright (C) 2011 Cyan Worlds, Inc. - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . - -Additional permissions under GNU GPL version 3 section 7 - -If you modify this Program, or any covered work, by linking or -combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK, -NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent -JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK -(or a modified version of those libraries), -containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA, -PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG -JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the -licensors of this Program grant you additional -permission to convey the resulting work. Corresponding Source for a -non-source form of such a combination shall include the source code for -the parts of OpenSSL and IJG JPEG Library used as well as that of the covered -work. - -You can contact Cyan Worlds, Inc. by email legal@cyan.com - or by snail mail at: - Cyan Worlds, Inc. - 14617 N Newport Hwy - Mead, WA 99021 - -*==LICENSE==*/ -#ifndef hsMMIOStream_inc -#define hsMMIOStream_inc - -#include "hsWindows.h" -#include "hsStream.h" - -#if HS_BUILD_FOR_WIN32 -#include - -class hsMMIOStream: public hsStream -{ - HMMIO fHmfr; -public: - - virtual hsBool Open(const char *, const char *) { hsAssert(0, "hsMMIOStream::Open NotImplemented"); return false; } - virtual hsBool Close() { hsAssert(0, "hsMMIOStream::Close NotImplemented"); return false; } - - virtual hsBool AtEnd(); - virtual UInt32 Read(UInt32 byteCount, void* buffer); - virtual UInt32 Write(UInt32 byteCount, const void* buffer); - virtual void Skip(UInt32 deltaByteCount); - virtual void Rewind(); - virtual void FastFwd(); - virtual void Truncate(); - - HMMIO GetHandle() { return fHmfr; } - void SetHandle(HMMIO handle) { fHmfr = handle; } -}; -#endif - -#endif // hsMMIOStream_inc diff --git a/Sources/Plasma/CoreLib/hsMalloc.cpp b/Sources/Plasma/CoreLib/hsMalloc.cpp deleted file mode 100644 index 957d4ab8..00000000 --- a/Sources/Plasma/CoreLib/hsMalloc.cpp +++ /dev/null @@ -1,56 +0,0 @@ -/*==LICENSE==* - -CyanWorlds.com Engine - MMOG client, server and tools -Copyright (C) 2011 Cyan Worlds, Inc. - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . - -Additional permissions under GNU GPL version 3 section 7 - -If you modify this Program, or any covered work, by linking or -combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK, -NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent -JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK -(or a modified version of those libraries), -containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA, -PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG -JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the -licensors of this Program grant you additional -permission to convey the resulting work. Corresponding Source for a -non-source form of such a combination shall include the source code for -the parts of OpenSSL and IJG JPEG Library used as well as that of the covered -work. - -You can contact Cyan Worlds, Inc. by email legal@cyan.com - or by snail mail at: - Cyan Worlds, Inc. - 14617 N Newport Hwy - Mead, WA 99021 - -*==LICENSE==*/ -/***************************************************************************** -* -* $/Plasma20/Sources/Plasma/CoreLib/hsMalloc.cpp -* -***/ - -#include "HeadSpin.h" - - -/***************************************************************************** -* -* Exports -* -***/ - diff --git a/Sources/Plasma/CoreLib/hsMalloc.h b/Sources/Plasma/CoreLib/hsMalloc.h deleted file mode 100644 index eaf7b472..00000000 --- a/Sources/Plasma/CoreLib/hsMalloc.h +++ /dev/null @@ -1,205 +0,0 @@ -/*==LICENSE==* - -CyanWorlds.com Engine - MMOG client, server and tools -Copyright (C) 2011 Cyan Worlds, Inc. - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . - -Additional permissions under GNU GPL version 3 section 7 - -If you modify this Program, or any covered work, by linking or -combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK, -NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent -JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK -(or a modified version of those libraries), -containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA, -PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG -JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the -licensors of this Program grant you additional -permission to convey the resulting work. Corresponding Source for a -non-source form of such a combination shall include the source code for -the parts of OpenSSL and IJG JPEG Library used as well as that of the covered -work. - -You can contact Cyan Worlds, Inc. by email legal@cyan.com - or by snail mail at: - Cyan Worlds, Inc. - 14617 N Newport Hwy - Mead, WA 99021 - -*==LICENSE==*/ -/***************************************************************************** -* -* $/Plasma20/Sources/Plasma/CoreLib/hsMalloc.h -* -***/ - -#ifndef PLASMA20_SOURCES_PLASMA_CORELIB_HSMALLOC_H -#define PLASMA20_SOURCES_PLASMA_CORELIB_HSMALLOC_H - - -/**************************************************************************** -* -* Allocation functions -* -***/ - -#ifdef __cplusplus -extern "C" { -#endif - -// MemAlloc flags -extern const unsigned kMemReallocInPlaceOnly; // use _expand when realloc'ing -extern const unsigned kMemZero; // fill allocated memory with zeros -extern const unsigned kMemIgnoreBlock; // don't track this allocation - - -void * MemAlloc (unsigned bytes, unsigned flags, const char file[], int line); -void * MemDup (const void * ptr, unsigned bytes, unsigned flags, const char file[], int line); -void MemFree (void * ptr, unsigned flags); -void * MemRealloc (void * ptr, unsigned bytes, unsigned flags, const char file[], int line); -unsigned MemSize (void * ptr); - - -/**************************************************************************** -* -* Manipulation functions -* -***/ - -int MemCmp (const void * buf1, const void * buf2, unsigned bytes); -void MemCopy (void * dest, const void * source, unsigned bytes); -void MemMove (void * dest, const void * source, unsigned bytes); -void MemSet (void * dest, unsigned value, unsigned bytes); -void MemZero (void * dest, unsigned bytes); - - -/***************************************************************************** -* -* Debugging functions -* -***/ - -void MemDumpAllocReport (); -void MemDumpUsageReport (); -void MemValidateNow (); -void MemSetValidation (unsigned on); -void MemPushDisableTracking (); -void MemPopDisableTracking (); -void MemSetColor (unsigned short color); - - -#ifdef __cplusplus -} -#endif - - -/**************************************************************************** -* -* C++ Operators -* -***/ - -#ifdef __cplusplus - -#include - -#ifndef _MSC_VER -#define THROW(x) throw(x) -#define THROW_EMPTY throw() -#else -#define THROW(x) -#define THROW_EMPTY -#endif - -// standard new and delete -inline void* CDECL operator new (size_t bytes) THROW(std::bad_alloc) - { return MemAlloc((unsigned)bytes, 0, __FILE__, __LINE__); } -inline void* CDECL operator new [](size_t bytes) THROW(std::bad_alloc) - { return MemAlloc((unsigned)bytes, 0, __FILE__, __LINE__); } -inline void CDECL operator delete (void * ptr) THROW_EMPTY - { MemFree(ptr, 0); } -inline void CDECL operator delete [](void * ptr) THROW_EMPTY - { MemFree(ptr, 0); } - -// memcheck-friendly new -inline void* CDECL operator new (size_t bytes, const char file[], unsigned line) - { return MemAlloc((unsigned)bytes, 0, file, line); } -inline void* CDECL operator new [](size_t bytes, const char file[], unsigned line) - { return MemAlloc((unsigned)bytes, 0, file, line); } -inline void CDECL operator delete (void * ptr, const char [], unsigned) - { return MemFree(ptr, 0); } -inline void CDECL operator delete [](void * ptr, const char [], unsigned) - { return MemFree(ptr, 0); } -#define TRACKED_NEW new(__FILE__, __LINE__) - - -// placement new -#if defined(_MSC_VER) && !defined(__PLACEMENT_NEW_INLINE) -#define __PLACEMENT_NEW_INLINE -inline void* CDECL operator new (size_t, void * ptr) { return ptr; } -inline void CDECL operator delete (void *, void *) {} -#endif // ifndef __PLACEMENT_NEW_INLINE - -#endif // ifdef __cplusplus - - -/**************************************************************************** -* -* Macros -* -***/ - -#define ALLOC(b) MemAlloc(b, 0, __FILE__, __LINE__) -#define ALLOCZERO(b) MemAlloc(b, kMemZero, __FILE__, __LINE__) -#define ALLOCFLAGS(b, f) MemAlloc(b, (f), __FILE__, __LINE__) -#define FREE(p) MemFree(p, 0) -#define FREEFLAGS(p, f) MemFree(p, (f)) -#define REALLOC(p, b) MemRealloc(p, b, 0, __FILE__, __LINE__) -#define REALLOCFLAGS(p, b, f) MemRealloc(p, b, (f), __FILE__, __LINE__) -#define CALLOC(n, s) MemAlloc((n)*(s), kMemZero, __FILE__, __LINE__) -#define MEMDUP(s, b) MemDup(s, b, 0, __FILE__, __LINE__) -#define ZERO(s) MemSet(&s, 0, sizeof(s)) -#define ZEROPTR(p) MemSet(p, 0, sizeof(*p)) -// Client must #include -#define ALLOCA(t, n) (t *)_alloca((n) * sizeof(t)) - - -#ifdef __cplusplus - -#define NEW(t) new(MemAlloc(sizeof(t), 0, __FILE__, __LINE__)) t -#define NEWFLAGS(t, f) new(MemAlloc(sizeof(t), (f), __FILE__, __LINE__)) t -#define NEWZERO(t) new(MemAlloc(sizeof(t), kMemZero, __FILE__, __LINE__)) t -#define DEL(t) delete (t) - -#endif // __cplusplus - - - -/**************************************************************************** -* -* TypeInfo -* (needed for memory leak reporting) -* -***/ - -#ifdef __cplusplus - -#if !defined(HS_NO_TYPEINFO) -#include -#endif - -#endif // ifdef __cplusplus - -#endif // PLASMA20_SOURCES_PLASMA_CORELIB_HSMALLOC_H diff --git a/Sources/Plasma/CoreLib/hsMatrix33.cpp b/Sources/Plasma/CoreLib/hsMatrix33.cpp index cb66df1e..6e9fd6a0 100644 --- a/Sources/Plasma/CoreLib/hsMatrix33.cpp +++ b/Sources/Plasma/CoreLib/hsMatrix33.cpp @@ -40,7 +40,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "hsMatrix33.h" #include "hsStream.h" diff --git a/Sources/Plasma/CoreLib/hsMatrix33.h b/Sources/Plasma/CoreLib/hsMatrix33.h index 857bc584..499365aa 100644 --- a/Sources/Plasma/CoreLib/hsMatrix33.h +++ b/Sources/Plasma/CoreLib/hsMatrix33.h @@ -47,7 +47,7 @@ class hsStream; struct hsMatrix33 { - hsScalar fMap[3][3]; + float fMap[3][3]; hsMatrix33* Reset(); diff --git a/Sources/Plasma/CoreLib/hsMatrix44.cpp b/Sources/Plasma/CoreLib/hsMatrix44.cpp index 7af5a0ef..81eba463 100644 --- a/Sources/Plasma/CoreLib/hsMatrix44.cpp +++ b/Sources/Plasma/CoreLib/hsMatrix44.cpp @@ -34,7 +34,8 @@ work. You can contact Cyan Worlds, Inc. by email legal@cyan.com or by snail mail at: - Cyan Worlds, Inc. + Cyan Worlds, I + nc. 14617 N Newport Hwy Mead, WA 99021 @@ -44,6 +45,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "hsQuat.h" #include "hsMatrix44.h" #include "hsStream.h" +#include static hsMatrix44 myIdent = hsMatrix44().Reset(); const hsMatrix44& hsMatrix44::IdentityMatrix() { return myIdent; } @@ -91,75 +93,6 @@ void hsMatrix44::DecompRigid(hsScalarTriple &translate, hsQuat &rotate) const } - -#if 0 - -hsMatrix44& hsMatrix44::Reset() -{ - for(int i = 0; i < 4; i++) - { - for(int j = 0; j < 4; j++) - { - fMap[i][j] = (i==j) ? hsScalar1 : 0; - } - } - return *this; -} -#endif - -#if 0 // Havok reeks -hsMatrix44 operator*(const hsMatrix44& a, const hsMatrix44& b) -{ - hsMatrix44 c; - - if( a.fFlags & b.fFlags & hsMatrix44::kIsIdent ) - { - c.Reset(); - return c; - } - - if( a.fFlags & hsMatrix44::kIsIdent ) - return b; - if( b.fFlags & hsMatrix44::kIsIdent ) - return a; - - c.fMap[0][0] = hsScalarMul(a.fMap[0][0], b.fMap[0][0]) + hsScalarMul(a.fMap[0][1], b.fMap[1][0]) + hsScalarMul(a.fMap[0][2], b.fMap[2][0]) + hsScalarMul(a.fMap[0][3], b.fMap[3][0]); - c.fMap[0][1] = hsScalarMul(a.fMap[0][0], b.fMap[0][1]) + hsScalarMul(a.fMap[0][1], b.fMap[1][1]) + hsScalarMul(a.fMap[0][2], b.fMap[2][1]) + hsScalarMul(a.fMap[0][3], b.fMap[3][1]); - c.fMap[0][2] = hsScalarMul(a.fMap[0][0], b.fMap[0][2]) + hsScalarMul(a.fMap[0][1], b.fMap[1][2]) + hsScalarMul(a.fMap[0][2], b.fMap[2][2]) + hsScalarMul(a.fMap[0][3], b.fMap[3][2]); - c.fMap[0][3] = hsScalarMul(a.fMap[0][0], b.fMap[0][3]) + hsScalarMul(a.fMap[0][1], b.fMap[1][3]) + hsScalarMul(a.fMap[0][2], b.fMap[2][3]) + hsScalarMul(a.fMap[0][3], b.fMap[3][3]); - - c.fMap[1][0] = hsScalarMul(a.fMap[1][0], b.fMap[0][0]) + hsScalarMul(a.fMap[1][1], b.fMap[1][0]) + hsScalarMul(a.fMap[1][2], b.fMap[2][0]) + hsScalarMul(a.fMap[1][3], b.fMap[3][0]); - c.fMap[1][1] = hsScalarMul(a.fMap[1][0], b.fMap[0][1]) + hsScalarMul(a.fMap[1][1], b.fMap[1][1]) + hsScalarMul(a.fMap[1][2], b.fMap[2][1]) + hsScalarMul(a.fMap[1][3], b.fMap[3][1]); - c.fMap[1][2] = hsScalarMul(a.fMap[1][0], b.fMap[0][2]) + hsScalarMul(a.fMap[1][1], b.fMap[1][2]) + hsScalarMul(a.fMap[1][2], b.fMap[2][2]) + hsScalarMul(a.fMap[1][3], b.fMap[3][2]); - c.fMap[1][3] = hsScalarMul(a.fMap[1][0], b.fMap[0][3]) + hsScalarMul(a.fMap[1][1], b.fMap[1][3]) + hsScalarMul(a.fMap[1][2], b.fMap[2][3]) + hsScalarMul(a.fMap[1][3], b.fMap[3][3]); - - c.fMap[2][0] = hsScalarMul(a.fMap[2][0], b.fMap[0][0]) + hsScalarMul(a.fMap[2][1], b.fMap[1][0]) + hsScalarMul(a.fMap[2][2], b.fMap[2][0]) + hsScalarMul(a.fMap[2][3], b.fMap[3][0]); - c.fMap[2][1] = hsScalarMul(a.fMap[2][0], b.fMap[0][1]) + hsScalarMul(a.fMap[2][1], b.fMap[1][1]) + hsScalarMul(a.fMap[2][2], b.fMap[2][1]) + hsScalarMul(a.fMap[2][3], b.fMap[3][1]); - c.fMap[2][2] = hsScalarMul(a.fMap[2][0], b.fMap[0][2]) + hsScalarMul(a.fMap[2][1], b.fMap[1][2]) + hsScalarMul(a.fMap[2][2], b.fMap[2][2]) + hsScalarMul(a.fMap[2][3], b.fMap[3][2]); - c.fMap[2][3] = hsScalarMul(a.fMap[2][0], b.fMap[0][3]) + hsScalarMul(a.fMap[2][1], b.fMap[1][3]) + hsScalarMul(a.fMap[2][2], b.fMap[2][3]) + hsScalarMul(a.fMap[2][3], b.fMap[3][3]); - - c.fMap[3][0] = hsScalarMul(a.fMap[3][0], b.fMap[0][0]) + hsScalarMul(a.fMap[3][1], b.fMap[1][0]) + hsScalarMul(a.fMap[3][2], b.fMap[2][0]) + hsScalarMul(a.fMap[3][3], b.fMap[3][0]); - c.fMap[3][1] = hsScalarMul(a.fMap[3][0], b.fMap[0][1]) + hsScalarMul(a.fMap[3][1], b.fMap[1][1]) + hsScalarMul(a.fMap[3][2], b.fMap[2][1]) + hsScalarMul(a.fMap[3][3], b.fMap[3][1]); - c.fMap[3][2] = hsScalarMul(a.fMap[3][0], b.fMap[0][2]) + hsScalarMul(a.fMap[3][1], b.fMap[1][2]) + hsScalarMul(a.fMap[3][2], b.fMap[2][2]) + hsScalarMul(a.fMap[3][3], b.fMap[3][2]); - c.fMap[3][3] = hsScalarMul(a.fMap[3][0], b.fMap[0][3]) + hsScalarMul(a.fMap[3][1], b.fMap[1][3]) + hsScalarMul(a.fMap[3][2], b.fMap[2][3]) + hsScalarMul(a.fMap[3][3], b.fMap[3][3]); - - return c; -} - -hsVector3 operator*(const hsMatrix44& m, const hsVector3& p) -{ - if( m.fFlags & hsMatrix44::kIsIdent ) - return p; - - hsVector3 rVal; - - rVal.fX = hsScalarMul(p.fX, m.fMap[0][0]) + hsScalarMul(p.fY, m.fMap[0][1]) + hsScalarMul(p.fZ, m.fMap[0][2]); - rVal.fY = hsScalarMul(p.fX, m.fMap[1][0]) + hsScalarMul(p.fY, m.fMap[1][1]) + hsScalarMul(p.fZ, m.fMap[1][2]); - rVal.fZ = hsScalarMul(p.fX, m.fMap[2][0]) + hsScalarMul(p.fY, m.fMap[2][1]) + hsScalarMul(p.fZ, m.fMap[2][2]); - - return rVal; -} -#else // Havok reeks hsMatrix44 hsMatrix44::operator*(const hsMatrix44& b) const { hsMatrix44 c; @@ -175,25 +108,25 @@ hsMatrix44 hsMatrix44::operator*(const hsMatrix44& b) const if( b.fFlags & hsMatrix44::kIsIdent ) return *this; - c.fMap[0][0] = hsScalarMul(fMap[0][0], b.fMap[0][0]) + hsScalarMul(fMap[0][1], b.fMap[1][0]) + hsScalarMul(fMap[0][2], b.fMap[2][0]) + hsScalarMul(fMap[0][3], b.fMap[3][0]); - c.fMap[0][1] = hsScalarMul(fMap[0][0], b.fMap[0][1]) + hsScalarMul(fMap[0][1], b.fMap[1][1]) + hsScalarMul(fMap[0][2], b.fMap[2][1]) + hsScalarMul(fMap[0][3], b.fMap[3][1]); - c.fMap[0][2] = hsScalarMul(fMap[0][0], b.fMap[0][2]) + hsScalarMul(fMap[0][1], b.fMap[1][2]) + hsScalarMul(fMap[0][2], b.fMap[2][2]) + hsScalarMul(fMap[0][3], b.fMap[3][2]); - c.fMap[0][3] = hsScalarMul(fMap[0][0], b.fMap[0][3]) + hsScalarMul(fMap[0][1], b.fMap[1][3]) + hsScalarMul(fMap[0][2], b.fMap[2][3]) + hsScalarMul(fMap[0][3], b.fMap[3][3]); + c.fMap[0][0] = (fMap[0][0] * b.fMap[0][0]) + (fMap[0][1] * b.fMap[1][0]) + (fMap[0][2] * b.fMap[2][0]) + (fMap[0][3] * b.fMap[3][0]); + c.fMap[0][1] = (fMap[0][0] * b.fMap[0][1]) + (fMap[0][1] * b.fMap[1][1]) + (fMap[0][2] * b.fMap[2][1]) + (fMap[0][3] * b.fMap[3][1]); + c.fMap[0][2] = (fMap[0][0] * b.fMap[0][2]) + (fMap[0][1] * b.fMap[1][2]) + (fMap[0][2] * b.fMap[2][2]) + (fMap[0][3] * b.fMap[3][2]); + c.fMap[0][3] = (fMap[0][0] * b.fMap[0][3]) + (fMap[0][1] * b.fMap[1][3]) + (fMap[0][2] * b.fMap[2][3]) + (fMap[0][3] * b.fMap[3][3]); - c.fMap[1][0] = hsScalarMul(fMap[1][0], b.fMap[0][0]) + hsScalarMul(fMap[1][1], b.fMap[1][0]) + hsScalarMul(fMap[1][2], b.fMap[2][0]) + hsScalarMul(fMap[1][3], b.fMap[3][0]); - c.fMap[1][1] = hsScalarMul(fMap[1][0], b.fMap[0][1]) + hsScalarMul(fMap[1][1], b.fMap[1][1]) + hsScalarMul(fMap[1][2], b.fMap[2][1]) + hsScalarMul(fMap[1][3], b.fMap[3][1]); - c.fMap[1][2] = hsScalarMul(fMap[1][0], b.fMap[0][2]) + hsScalarMul(fMap[1][1], b.fMap[1][2]) + hsScalarMul(fMap[1][2], b.fMap[2][2]) + hsScalarMul(fMap[1][3], b.fMap[3][2]); - c.fMap[1][3] = hsScalarMul(fMap[1][0], b.fMap[0][3]) + hsScalarMul(fMap[1][1], b.fMap[1][3]) + hsScalarMul(fMap[1][2], b.fMap[2][3]) + hsScalarMul(fMap[1][3], b.fMap[3][3]); + c.fMap[1][0] = (fMap[1][0] * b.fMap[0][0]) + (fMap[1][1] * b.fMap[1][0]) + (fMap[1][2] * b.fMap[2][0]) + (fMap[1][3] * b.fMap[3][0]); + c.fMap[1][1] = (fMap[1][0] * b.fMap[0][1]) + (fMap[1][1] * b.fMap[1][1]) + (fMap[1][2] * b.fMap[2][1]) + (fMap[1][3] * b.fMap[3][1]); + c.fMap[1][2] = (fMap[1][0] * b.fMap[0][2]) + (fMap[1][1] * b.fMap[1][2]) + (fMap[1][2] * b.fMap[2][2]) + (fMap[1][3] * b.fMap[3][2]); + c.fMap[1][3] = (fMap[1][0] * b.fMap[0][3]) + (fMap[1][1] * b.fMap[1][3]) + (fMap[1][2] * b.fMap[2][3]) + (fMap[1][3] * b.fMap[3][3]); - c.fMap[2][0] = hsScalarMul(fMap[2][0], b.fMap[0][0]) + hsScalarMul(fMap[2][1], b.fMap[1][0]) + hsScalarMul(fMap[2][2], b.fMap[2][0]) + hsScalarMul(fMap[2][3], b.fMap[3][0]); - c.fMap[2][1] = hsScalarMul(fMap[2][0], b.fMap[0][1]) + hsScalarMul(fMap[2][1], b.fMap[1][1]) + hsScalarMul(fMap[2][2], b.fMap[2][1]) + hsScalarMul(fMap[2][3], b.fMap[3][1]); - c.fMap[2][2] = hsScalarMul(fMap[2][0], b.fMap[0][2]) + hsScalarMul(fMap[2][1], b.fMap[1][2]) + hsScalarMul(fMap[2][2], b.fMap[2][2]) + hsScalarMul(fMap[2][3], b.fMap[3][2]); - c.fMap[2][3] = hsScalarMul(fMap[2][0], b.fMap[0][3]) + hsScalarMul(fMap[2][1], b.fMap[1][3]) + hsScalarMul(fMap[2][2], b.fMap[2][3]) + hsScalarMul(fMap[2][3], b.fMap[3][3]); + c.fMap[2][0] = (fMap[2][0] * b.fMap[0][0]) + (fMap[2][1] * b.fMap[1][0]) + (fMap[2][2] * b.fMap[2][0]) + (fMap[2][3] * b.fMap[3][0]); + c.fMap[2][1] = (fMap[2][0] * b.fMap[0][1]) + (fMap[2][1] * b.fMap[1][1]) + (fMap[2][2] * b.fMap[2][1]) + (fMap[2][3] * b.fMap[3][1]); + c.fMap[2][2] = (fMap[2][0] * b.fMap[0][2]) + (fMap[2][1] * b.fMap[1][2]) + (fMap[2][2] * b.fMap[2][2]) + (fMap[2][3] * b.fMap[3][2]); + c.fMap[2][3] = (fMap[2][0] * b.fMap[0][3]) + (fMap[2][1] * b.fMap[1][3]) + (fMap[2][2] * b.fMap[2][3]) + (fMap[2][3] * b.fMap[3][3]); - c.fMap[3][0] = hsScalarMul(fMap[3][0], b.fMap[0][0]) + hsScalarMul(fMap[3][1], b.fMap[1][0]) + hsScalarMul(fMap[3][2], b.fMap[2][0]) + hsScalarMul(fMap[3][3], b.fMap[3][0]); - c.fMap[3][1] = hsScalarMul(fMap[3][0], b.fMap[0][1]) + hsScalarMul(fMap[3][1], b.fMap[1][1]) + hsScalarMul(fMap[3][2], b.fMap[2][1]) + hsScalarMul(fMap[3][3], b.fMap[3][1]); - c.fMap[3][2] = hsScalarMul(fMap[3][0], b.fMap[0][2]) + hsScalarMul(fMap[3][1], b.fMap[1][2]) + hsScalarMul(fMap[3][2], b.fMap[2][2]) + hsScalarMul(fMap[3][3], b.fMap[3][2]); - c.fMap[3][3] = hsScalarMul(fMap[3][0], b.fMap[0][3]) + hsScalarMul(fMap[3][1], b.fMap[1][3]) + hsScalarMul(fMap[3][2], b.fMap[2][3]) + hsScalarMul(fMap[3][3], b.fMap[3][3]); + c.fMap[3][0] = (fMap[3][0] * b.fMap[0][0]) + (fMap[3][1] * b.fMap[1][0]) + (fMap[3][2] * b.fMap[2][0]) + (fMap[3][3] * b.fMap[3][0]); + c.fMap[3][1] = (fMap[3][0] * b.fMap[0][1]) + (fMap[3][1] * b.fMap[1][1]) + (fMap[3][2] * b.fMap[2][1]) + (fMap[3][3] * b.fMap[3][1]); + c.fMap[3][2] = (fMap[3][0] * b.fMap[0][2]) + (fMap[3][1] * b.fMap[1][2]) + (fMap[3][2] * b.fMap[2][2]) + (fMap[3][3] * b.fMap[3][2]); + c.fMap[3][3] = (fMap[3][0] * b.fMap[0][3]) + (fMap[3][1] * b.fMap[1][3]) + (fMap[3][2] * b.fMap[2][3]) + (fMap[3][3] * b.fMap[3][3]); return c; } @@ -205,34 +138,13 @@ hsVector3 hsMatrix44::operator*(const hsVector3& p) const hsVector3 rVal; - rVal.fX = hsScalarMul(p.fX, fMap[0][0]) + hsScalarMul(p.fY, fMap[0][1]) + hsScalarMul(p.fZ, fMap[0][2]); - rVal.fY = hsScalarMul(p.fX, fMap[1][0]) + hsScalarMul(p.fY, fMap[1][1]) + hsScalarMul(p.fZ, fMap[1][2]); - rVal.fZ = hsScalarMul(p.fX, fMap[2][0]) + hsScalarMul(p.fY, fMap[2][1]) + hsScalarMul(p.fZ, fMap[2][2]); + rVal.fX = (p.fX * fMap[0][0]) + (p.fY * fMap[0][1]) + (p.fZ * fMap[0][2]); + rVal.fY = (p.fX * fMap[1][0]) + (p.fY * fMap[1][1]) + (p.fZ * fMap[1][2]); + rVal.fZ = (p.fX * fMap[2][0]) + (p.fY * fMap[2][1]) + (p.fZ * fMap[2][2]); return rVal; } -#endif // Havok reeks - -#if 0 // Havok reeks -int operator==(const hsMatrix44& s, const hsMatrix44& t) -{ - if( s.fFlags & t.fFlags & hsMatrix44::kIsIdent ) - { - return true; - } - for(int i = 0; i < 4; i++) - { - for(int j = 0; j < 4; j++) - { - if (s.fMap[i][j] != t.fMap[i][j]) - return false; - } - } - - return true; -} -#else // Havok reeks int hsMatrix44::operator==(const hsMatrix44& ss) const { if( ss.fFlags & fFlags & hsMatrix44::kIsIdent ) @@ -251,7 +163,6 @@ int hsMatrix44::operator==(const hsMatrix44& ss) const return true; } -#endif // Havok reeks hsMatrix44& hsMatrix44::Scale(const hsVector3* scale) { @@ -315,7 +226,7 @@ hsMatrix44& hsMatrix44::SetTranslate(const hsScalarTriple* pt) NotIdentity(); return *this; } -hsMatrix44& hsMatrix44::MakeRotateMat(int axis, hsScalar radians) +hsMatrix44& hsMatrix44::MakeRotateMat(int axis, float radians) { Reset(); SetRotate(axis, radians); @@ -323,7 +234,7 @@ hsMatrix44& hsMatrix44::MakeRotateMat(int axis, hsScalar radians) return *this; } -hsMatrix44& hsMatrix44::Rotate(int axis, hsScalar radians) +hsMatrix44& hsMatrix44::Rotate(int axis, float radians) { hsMatrix44 rMat; rMat.MakeRotateMat(axis, radians); @@ -331,10 +242,10 @@ hsMatrix44& hsMatrix44::Rotate(int axis, hsScalar radians) return *this; } -hsMatrix44& hsMatrix44::SetRotate(int axis, hsScalar radians) +hsMatrix44& hsMatrix44::SetRotate(int axis, float radians) { - hsScalar s = hsSine(radians); - hsScalar c = hsCosine(radians); + float s = sin(radians); + float c = cos(radians); int c1,c2; switch (axis) { @@ -361,11 +272,11 @@ hsMatrix44& hsMatrix44::SetRotate(int axis, hsScalar radians) return *this; } -void hsMatrix44::MakeXRotation(hsScalar radians) +void hsMatrix44::MakeXRotation(float radians) { Reset(); - hsScalar s = hsSine(radians); - hsScalar c = hsCosine(radians); + float s = sin(radians); + float c = cos(radians); fMap[1][1] = c; fMap[2][2] = c; @@ -374,11 +285,11 @@ void hsMatrix44::MakeXRotation(hsScalar radians) NotIdentity(); } -void hsMatrix44::MakeYRotation(hsScalar radians) +void hsMatrix44::MakeYRotation(float radians) { Reset(); - hsScalar s = hsSine(radians); - hsScalar c = hsCosine(radians); + float s = sin(radians); + float c = cos(radians); fMap[0][0] = c; fMap[2][2] = c; fMap[0][2] = -s; @@ -386,11 +297,11 @@ void hsMatrix44::MakeYRotation(hsScalar radians) NotIdentity(); } -void hsMatrix44::MakeZRotation(hsScalar radians) +void hsMatrix44::MakeZRotation(float radians) { Reset(); - hsScalar s = hsSine(radians); - hsScalar c = hsCosine(radians); + float s = sin(radians); + float c = cos(radians); fMap[0][0] = c; fMap[1][1] = c; fMap[0][1] = s; @@ -630,14 +541,14 @@ hsMatrix44& hsMatrix44::MakeCameraUpPreserving(const hsPoint3* from, const hsPoi /////////////////////////////////////////////////////// -static hsScalar GetDeterminant33(const hsMatrix44* mat) +static float GetDeterminant33(const hsMatrix44* mat) { - return hsScalarMul(hsScalarMul(mat->fMap[0][0], mat->fMap[1][1]), mat->fMap[2][2]) + - hsScalarMul(hsScalarMul(mat->fMap[0][1], mat->fMap[1][2]), mat->fMap[2][0]) + - hsScalarMul(hsScalarMul(mat->fMap[0][2], mat->fMap[1][0]), mat->fMap[2][1]) - - hsScalarMul(hsScalarMul(mat->fMap[0][2], mat->fMap[1][1]), mat->fMap[2][0]) - - hsScalarMul(hsScalarMul(mat->fMap[0][1], mat->fMap[1][0]), mat->fMap[2][2]) - - hsScalarMul(hsScalarMul(mat->fMap[0][0], mat->fMap[1][2]), mat->fMap[2][1]); + return ((mat->fMap[0][0] * mat->fMap[1][1]) * mat->fMap[2][2]) + + ((mat->fMap[0][1] * mat->fMap[1][2]) * mat->fMap[2][0]) + + ((mat->fMap[0][2] * mat->fMap[1][0]) * mat->fMap[2][1]) - + ((mat->fMap[0][2] * mat->fMap[1][1]) * mat->fMap[2][0]) - + ((mat->fMap[0][1] * mat->fMap[1][0]) * mat->fMap[2][2]) - + ((mat->fMap[0][0] * mat->fMap[1][2]) * mat->fMap[2][1]); } hsMatrix44* hsMatrix44::GetTranspose(hsMatrix44* transp) const @@ -649,21 +560,21 @@ hsMatrix44* hsMatrix44::GetTranspose(hsMatrix44* transp) const } -static inline hsScalar Determinant2(hsScalar a, hsScalar b,hsScalar c, hsScalar d) +static inline float Determinant2(float a, float b,float c, float d) { - return hsScalarMul(a,d) - hsScalarMul(c,b); + return (a * d) - (c * b); } -static inline hsScalar Determinant3(hsScalar a, hsScalar b, hsScalar c, - hsScalar d, hsScalar e, hsScalar f, - hsScalar g, hsScalar h, hsScalar i) +static inline float Determinant3(float a, float b, float c, + float d, float e, float f, + float g, float h, float i) { - return hsScalarMul(a, Determinant2(e, f, h, i)) - - hsScalarMul(b, Determinant2(d, f, g, i)) - + hsScalarMul(c, Determinant2(d, e, g, h)); + return (a * Determinant2(e, f, h, i)) + - (b * Determinant2(d, f, g, i)) + + (c * Determinant2(d, e, g, h)); } -hsScalar hsMatrix44::GetDeterminant() const +float hsMatrix44::GetDeterminant() const { return (fMap[0][0]*Determinant3(fMap[1][1], fMap[2][1], fMap[3][1], fMap[1][2], fMap[2][2], fMap[3][2], @@ -753,7 +664,7 @@ hsMatrix44 *hsMatrix44::GetAdjoint(hsMatrix44 *adj) const hsMatrix44* hsMatrix44::GetInverse(hsMatrix44* inverse) const { - hsScalar det = GetDeterminant(); + float det = GetDeterminant(); int i,j; if (det == 0.0f) @@ -762,7 +673,7 @@ hsMatrix44* hsMatrix44::GetInverse(hsMatrix44* inverse) const return inverse; } - det = hsScalarInvert(det); + det = hsInvert(det); GetAdjoint(inverse); for (i=0; i<4; i++) @@ -840,7 +751,7 @@ hsBool hsMatrix44::IsIdentity(void) #if 0 // IDENTITY_CRISIS if( i == j) { - if (fMap[i][j] != hsScalar1) + if (fMap[i][j] != 1.f) { NotIdentity(); retVal = false; @@ -855,17 +766,17 @@ hsBool hsMatrix44::IsIdentity(void) } } #else // IDENTITY_CRISIS - const hsScalar kEPS = 1.e-5f; + const float kEPS = 1.e-5f; if( i == j) { - if( (fMap[i][j] < hsScalar1-kEPS) || (fMap[i][j] > hsScalar1+kEPS) ) + if( (fMap[i][j] < 1.f-kEPS) || (fMap[i][j] > 1.f+kEPS) ) { NotIdentity(); retVal = false; } else { - fMap[i][j] = hsScalar1; + fMap[i][j] = 1.f; } } else @@ -909,12 +820,7 @@ void hsMatrix44::Read(hsStream *stream) int i,j; for(i=0; i<4; i++) for(j=0; j<4; j++) -#if HS_SCALAR_IS_FIXED - fMap[i][j] = stream->ReadLE32(); -#endif -#if HS_SCALAR_IS_FLOAT fMap[i][j] = stream->ReadLEFloat(); -#endif IsIdentity(); } else @@ -930,11 +836,6 @@ void hsMatrix44::Write(hsStream *stream) int i,j; for(i=0; i<4; i++) for(j=0; j<4; j++) -#if HS_SCALAR_IS_FIXED - stream->WriteLE32(fMap[i][j]); -#endif -#if HS_SCALAR_IS_FLOAT stream->WriteLEFloat(fMap[i][j]); -#endif } } diff --git a/Sources/Plasma/CoreLib/hsMatrix44.h b/Sources/Plasma/CoreLib/hsMatrix44.h index 4e5d70d8..7804631d 100644 --- a/Sources/Plasma/CoreLib/hsMatrix44.h +++ b/Sources/Plasma/CoreLib/hsMatrix44.h @@ -42,7 +42,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #ifndef HSMATRIX44_inc #define HSMATRIX44_inc -#include "hsTypes.h" +#include "HeadSpin.h" #include "hsGeometry3.h" class hsQuat; @@ -59,8 +59,8 @@ struct hsMatrix44 { kUp, kView }; - hsScalar fMap[4][4]; - UInt32 fFlags; + float fMap[4][4]; + uint32_t fFlags; hsMatrix44() : fFlags(0) {} hsMatrix44(const hsScalarTriple &translate, const hsQuat &rotate); @@ -76,7 +76,7 @@ struct hsMatrix44 { // Concat transform hsMatrix44& Translate(const hsVector3 *); hsMatrix44& Scale(const hsVector3 *); - hsMatrix44& Rotate(int axis, hsScalar radians); + hsMatrix44& Rotate(int axis, float radians); hsMatrix44& Reset(hsBool asIdent=true) { @@ -92,7 +92,7 @@ struct hsMatrix44 { // Create matrix from scratch hsMatrix44& MakeTranslateMat(const hsVector3 *trans); hsMatrix44& MakeScaleMat(const hsVector3 *scale); - hsMatrix44& MakeRotateMat(int axis, hsScalar radians); + hsMatrix44& MakeRotateMat(int axis, float radians); hsMatrix44& Make(const hsPoint3* from, const hsPoint3* at, const hsVector3* up); // Not a camera matrix hsMatrix44& MakeUpPreserving(const hsPoint3* from, const hsPoint3* at, @@ -104,7 +104,7 @@ struct hsMatrix44 { const hsVector3* up); hsBool GetParity() const; - hsScalar GetDeterminant() const; + float GetDeterminant() const; hsMatrix44* GetInverse(hsMatrix44* inverse) const; hsMatrix44* GetTranspose(hsMatrix44* inverse) const; hsMatrix44* GetAdjoint(hsMatrix44* adjoint) const; @@ -120,67 +120,39 @@ struct hsMatrix44 { // Change component of matrix hsMatrix44& SetTranslate(const hsScalarTriple *); hsMatrix44& SetScale(const hsVector3 *); - hsMatrix44& SetRotate(int axis, hsScalar radians); + hsMatrix44& SetRotate(int axis, float radians); hsVector3 RemoveScale(); // returns old scale - void MakeXRotation(hsScalar radians); - void MakeYRotation(hsScalar radians); - void MakeZRotation(hsScalar radians); + void MakeXRotation(float radians); + void MakeYRotation(float radians); + void MakeZRotation(float radians); -#if 0 // Havok reeks - friend hsPoint3 operator*(const hsMatrix44& m, const hsPoint3& p) - { - if( m.fFlags & hsMatrix44::kIsIdent ) - return p; - - hsPoint3 rVal; - rVal.fX = hsScalarMul(p.fX, m.fMap[0][0]) + hsScalarMul(p.fY, m.fMap[0][1]) + hsScalarMul(p.fZ, m.fMap[0][2]) + m.fMap[0][3]; - rVal.fY = hsScalarMul(p.fX, m.fMap[1][0]) + hsScalarMul(p.fY, m.fMap[1][1]) + hsScalarMul(p.fZ, m.fMap[1][2]) + m.fMap[1][3]; - rVal.fZ = hsScalarMul(p.fX, m.fMap[2][0]) + hsScalarMul(p.fY, m.fMap[2][1]) + hsScalarMul(p.fZ, m.fMap[2][2]) + m.fMap[2][3]; - return rVal; - } - friend hsVector3 operator*(const hsMatrix44& m, const hsVector3& p); - friend hsMatrix44 operator*(const hsMatrix44& a, const hsMatrix44& b); -#else // Havok reeks hsPoint3 operator*(const hsPoint3& p) const { if( fFlags & hsMatrix44::kIsIdent ) return p; hsPoint3 rVal; - rVal.fX = hsScalarMul(p.fX, fMap[0][0]) + hsScalarMul(p.fY, fMap[0][1]) + hsScalarMul(p.fZ, fMap[0][2]) + fMap[0][3]; - rVal.fY = hsScalarMul(p.fX, fMap[1][0]) + hsScalarMul(p.fY, fMap[1][1]) + hsScalarMul(p.fZ, fMap[1][2]) + fMap[1][3]; - rVal.fZ = hsScalarMul(p.fX, fMap[2][0]) + hsScalarMul(p.fY, fMap[2][1]) + hsScalarMul(p.fZ, fMap[2][2]) + fMap[2][3]; + rVal.fX = (p.fX * fMap[0][0]) + (p.fY * fMap[0][1]) + (p.fZ * fMap[0][2]) + fMap[0][3]; + rVal.fY = (p.fX * fMap[1][0]) + (p.fY * fMap[1][1]) + (p.fZ * fMap[1][2]) + fMap[1][3]; + rVal.fZ = (p.fX * fMap[2][0]) + (p.fY * fMap[2][1]) + (p.fZ * fMap[2][2]) + fMap[2][3]; return rVal; } hsVector3 operator*(const hsVector3& p) const; hsMatrix44 operator*(const hsMatrix44& b) const; -#endif // Havok reeks hsPoint3* MapPoints(long count, hsPoint3 points[]) const; hsBool IsIdentity(void); void NotIdentity() { fFlags &= ~kIsIdent; } -#if 0 // Havok reeks - friend int operator==(const hsMatrix44& s, const hsMatrix44& t); - friend int operator!=(const hsMatrix44& s, const hsMatrix44& t); -#else // Havok reeks hsBool operator==(const hsMatrix44& ss) const; hsBool operator!=(const hsMatrix44& ss) const { return !(ss == *this); } -#endif // Havok reeks void Read(hsStream *stream); void Write(hsStream *stream); }; -#if 0 // Havok reeks -inline int operator!=(const hsMatrix44& s, const hsMatrix44& t) -{ - return (!(s==t)); -} -#endif // Havok reeks - //////////////////////////////////////////////////////////////////////////// #endif diff --git a/Sources/Plasma/CoreLib/hsMemory.cpp b/Sources/Plasma/CoreLib/hsMemory.cpp index 130ee8f7..f4e6ed23 100644 --- a/Sources/Plasma/CoreLib/hsMemory.cpp +++ b/Sources/Plasma/CoreLib/hsMemory.cpp @@ -49,15 +49,15 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com /////////////////////////////////////////////////////////////////////////////////////////// -void HSMemory::BlockMove(const void* src, void* dst, UInt32 length) +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 length) +hsBool HSMemory::EqualBlocks(const void* block1, const void* block2, uint32_t length) { - const Byte* byte1 = (Byte*)block1; - const Byte* byte2 = (Byte*)block2; + const uint8_t* byte1 = (uint8_t*)block1; + const uint8_t* byte2 = (uint8_t*)block2; while (length--) if (*byte1++ != *byte2++) @@ -65,17 +65,17 @@ hsBool HSMemory::EqualBlocks(const void* block1, const void* block2, UInt32 leng return true; } -void* HSMemory::New(UInt32 size) +void* HSMemory::New(uint32_t size) { - return TRACKED_NEW UInt32[(size + 3) >> 2]; + return new uint32_t[(size + 3) >> 2]; } void HSMemory::Delete(void* block) { - delete[] (UInt32*)block; + delete[] (uint32_t*)block; } -void* HSMemory::Copy(UInt32 length, const void* source) +void* HSMemory::Copy(uint32_t length, const void* source) { void* destination = HSMemory::New(length); @@ -83,22 +83,22 @@ void* HSMemory::Copy(UInt32 length, const void* source) return destination; } -void HSMemory::Clear(void* m, UInt32 byteLen) +void HSMemory::Clear(void* m, uint32_t byteLen) { - UInt8* mem = (UInt8*)m; - UInt8* memStop = mem + byteLen; + uint8_t* mem = (uint8_t*)m; + uint8_t* memStop = mem + byteLen; if (byteLen > 8) - { while (unsigned_ptr(mem) & 3) + { while (uintptr_t(mem) & 3) *mem++ = 0; - UInt32* mem32 = (UInt32*)mem; - UInt32* mem32Stop = (UInt32*)(unsigned_ptr(memStop) & ~3); + uint32_t* mem32 = (uint32_t*)mem; + uint32_t* mem32Stop = (uint32_t*)(uintptr_t(memStop) & ~3); do { *mem32++ = 0; } while (mem32 < mem32Stop); - mem = (UInt8*)mem32; + mem = (uint8_t*)mem32; // fall through to finish any remaining bytes (0..3) } while (mem < memStop) @@ -113,7 +113,7 @@ void HSMemory::Clear(void* m, UInt32 byteLen) template T* hsSoftNew(T*& obj) { try { - obj = TRACKED_NEW T; + obj = new T; } catch (...) { obj = nil; @@ -124,7 +124,7 @@ template T* hsSoftNew(T*& obj) inline template T* hsSoftNew(T*& obj, unsigned count) { try { - obj = TRACKED_NEW T[count]; + obj = new T[count]; } catch (...) { obj = nil; @@ -133,12 +133,12 @@ inline template T* hsSoftNew(T*& obj, unsigned count) } #endif -void* HSMemory::SoftNew(UInt32 size) +void* HSMemory::SoftNew(uint32_t size) { - UInt32* p; + uint32_t* p; hsTry { - p = TRACKED_NEW UInt32[(size + 3) >> 2]; + p = new uint32_t[(size + 3) >> 2]; } hsCatch(...) { p = nil; } @@ -150,15 +150,15 @@ void* HSMemory::SoftNew(UInt32 size) struct hsPrivateChunk { hsPrivateChunk* fNext; char* fAvailableAddr; - UInt32 fAvailableSize; + uint32_t fAvailableSize; - hsDebugCode(UInt32 fSize;) - hsDebugCode(UInt32 fCount;) + hsDebugCode(uint32_t fSize;) + hsDebugCode(uint32_t fCount;) - static hsPrivateChunk* NewPrivateChunk(hsPrivateChunk* next, UInt32 chunkSize); + static hsPrivateChunk* NewPrivateChunk(hsPrivateChunk* next, uint32_t chunkSize); }; -hsPrivateChunk* hsPrivateChunk::NewPrivateChunk(hsPrivateChunk* next, UInt32 chunkSize) +hsPrivateChunk* hsPrivateChunk::NewPrivateChunk(hsPrivateChunk* next, uint32_t chunkSize) { hsPrivateChunk* chunk = (hsPrivateChunk*)HSMemory::New(sizeof(hsPrivateChunk) + chunkSize); @@ -171,7 +171,7 @@ hsPrivateChunk* hsPrivateChunk::NewPrivateChunk(hsPrivateChunk* next, UInt32 chu return chunk; } -hsChunkAllocator::hsChunkAllocator(UInt32 chunkSize) : fChunkSize(chunkSize), fChunk(nil) +hsChunkAllocator::hsChunkAllocator(uint32_t chunkSize) : fChunkSize(chunkSize), fChunk(nil) { hsDebugCode(fChunkCount = 0;) } @@ -194,12 +194,12 @@ void hsChunkAllocator::Reset() hsDebugCode(fChunkCount = 0;) } -void hsChunkAllocator::SetChunkSize(UInt32 chunkSize) +void hsChunkAllocator::SetChunkSize(uint32_t chunkSize) { fChunkSize = chunkSize; } -void* hsChunkAllocator::Allocate(UInt32 size, const void* data) +void* hsChunkAllocator::Allocate(uint32_t size, const void* data) { void* addr; @@ -221,7 +221,7 @@ void* hsChunkAllocator::Allocate(UInt32 size, const void* data) return addr; } -void* hsChunkAllocator::SoftAllocate(UInt32 size, const void* data) +void* hsChunkAllocator::SoftAllocate(uint32_t size, const void* data) { void* addr; @@ -248,22 +248,22 @@ struct hsAppenderHead { void* GetStop() const { return fStop; } void* GetFirst() const { return fFirst; } - void* GetLast(UInt32 elemSize) const { return (char*)fStop - elemSize; } - UInt32 GetSize() const { return (char*)fStop - (char*)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(); } int PrependSize() const { return (char*)fFirst - (char*)this->GetTop(); } hsBool CanAppend() const { return fStop != this->GetBottom(); } int AppendSize() const { return (char*)this->GetBottom() - (char*)fStop; } - void* Prepend(UInt32 elemSize) + void* Prepend(uint32_t elemSize) { hsAssert(this->CanPrepend(), "bad prepend"); fFirst = (char*)fFirst - elemSize; hsAssert((char*)fFirst >= (char*)this->GetTop(), "bad elemSize"); return fFirst; } - void* Append(UInt32 elemSize) + void* Append(uint32_t elemSize) { hsAssert(this->CanAppend(), "bad append"); void* data = fStop; @@ -271,7 +271,7 @@ struct hsAppenderHead { hsAssert((char*)fStop <= (char*)fBottom, "bad elemSize"); return data; } - hsBool PopHead(UInt32 elemSize, void* data) + hsBool 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 elemSize, void* data) + hsBool PopTail(uint32_t elemSize, void* data) { hsAssert(fFirst != fStop, "Empty"); fStop = (char*)fStop - elemSize; @@ -288,9 +288,9 @@ struct hsAppenderHead { return fFirst == fStop; } - static hsAppenderHead* NewAppend(UInt32 elemSize, UInt32 elemCount, hsAppenderHead* prev) + static hsAppenderHead* NewAppend(uint32_t elemSize, uint32_t elemCount, hsAppenderHead* prev) { - UInt32 dataSize = elemSize * elemCount; + uint32_t dataSize = elemSize * elemCount; hsAppenderHead* head = (hsAppenderHead*)HSMemory::New(sizeof(hsAppenderHead) + dataSize); head->fNext = nil; @@ -300,9 +300,9 @@ struct hsAppenderHead { head->fBottom = (char*)head->fFirst + dataSize; return head; } - static hsAppenderHead* NewPrepend(UInt32 elemSize, UInt32 elemCount, hsAppenderHead* next) + static hsAppenderHead* NewPrepend(uint32_t elemSize, uint32_t elemCount, hsAppenderHead* next) { - UInt32 dataSize = elemSize * elemCount; + uint32_t dataSize = elemSize * elemCount; hsAppenderHead* head = (hsAppenderHead*)HSMemory::New(sizeof(hsAppenderHead) + dataSize); head->fNext = next; @@ -316,7 +316,7 @@ struct hsAppenderHead { //////////////////////////////////////////////////////////////////////////////////////// -hsAppender::hsAppender(UInt32 elemSize, UInt32 elemCount) +hsAppender::hsAppender(uint32_t elemSize, uint32_t elemCount) : fFirstBlock(nil), fElemSize(elemSize), fElemCount(elemCount), fCount(0) { } @@ -326,14 +326,14 @@ hsAppender::~hsAppender() this->Reset(); } -UInt32 hsAppender::CopyInto(void* data) const +uint32_t hsAppender::CopyInto(void* data) const { if (data) { const hsAppenderHead* head = fFirstBlock; - hsDebugCode(UInt32 totalSize = 0;) + hsDebugCode(uint32_t totalSize = 0;) while (head != nil) - { UInt32 size = head->GetSize(); + { uint32_t size = head->GetSize(); HSMemory::BlockMove(head->GetFirst(), data, size); data = (char*)data + size; @@ -721,7 +721,7 @@ void SortNDumpUnfreedMemory(const char *nm, bool full) // file name base, and FU _CrtMemState heap_state; -static UInt32 GrandTotal =0; +static uint32_t GrandTotal =0; static _CrtMemBlockHeader *cmbh_last; // Remember this header for next incremental check DANGER this // could break if this is freed...(gives bad report) _CrtMemBlockHeader *cmbh_last_good; @@ -736,7 +736,7 @@ static _CrtMemBlockHeader *cmbh_last; // Remember this header for next increme long totsize= 0; // Track Total Bytes long normsize = 0; // Track total of NORMAL Blocks - looktbl *ltb = TRACKED_NEW looktbl[LTBLMAX]; + looktbl *ltb = new looktbl[LTBLMAX]; long tblEnd=1; // first is "NULL"; memset((void *)ltb,0,sizeof(looktbl) * LTBLMAX); // clear table area @@ -821,7 +821,7 @@ static _CrtMemBlockHeader *cmbh_last; // Remember this header for next increme for(int x=len; x < 25; x++) fputc(' ',DumpLogFile); // make even columns - fprintf(DumpLogFile,"%5ld K\n",(UInt32)( ltb[i].fBytes+500)/1000);//,ltb[i].fAllocs); + fprintf(DumpLogFile,"%5ld K\n",(uint32_t)( ltb[i].fBytes+500)/1000);//,ltb[i].fAllocs); //allocs += ltb[i].fAllocs; } @@ -847,11 +847,11 @@ static _CrtMemBlockHeader *cmbh_last; // Remember this header for next increme if( DumpLogFile) { fprintf(DumpLogFile,"%s ",nm); int len = strlen(nm); - GrandTotal += (UInt32)(normsize+500)/1000; + GrandTotal += (uint32_t)(normsize+500)/1000; for(int x=len; x < 25; x++) fputc(' ',DumpLogFile); // make even columns - fprintf(DumpLogFile,"%5ld K %5ld %s\n",(UInt32)(normsize+500)/1000,GrandTotal,errStr);//, allocs); + fprintf(DumpLogFile,"%5ld K %5ld %s\n",(uint32_t)(normsize+500)/1000,GrandTotal,errStr);//, allocs); fclose(DumpLogFile); } } diff --git a/Sources/Plasma/CoreLib/hsMemory.h b/Sources/Plasma/CoreLib/hsMemory.h index 11361aac..fa45bbaa 100644 --- a/Sources/Plasma/CoreLib/hsMemory.h +++ b/Sources/Plasma/CoreLib/hsMemory.h @@ -42,30 +42,29 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #ifndef hsMemoryDefined #define hsMemoryDefined -#include "hsTypes.h" -#include "hsMalloc.h" +#include "HeadSpin.h" //#include "hsTemplates.h" class HSMemory { public: - static void BlockMove(const void* src, void* dst, UInt32 length); - static void Clear(void *m, UInt32 byteLen); - static void ClearMemory(void *m, UInt32 byteLen) { HSMemory::Clear(m, byteLen); } + static void BlockMove(const void* src, void* dst, uint32_t length); + 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 length); + static hsBool EqualBlocks(const void* block1, const void* block2, uint32_t length); - static void* New(UInt32 size); + static void* New(uint32_t size); static void Delete(void* block); - static void* Copy(UInt32 length, const void* source); + static void* Copy(uint32_t length, const void* source); - static void* SoftNew(UInt32 size); // returns nil if can't allocate + static void* SoftNew(uint32_t size); // returns nil if can't allocate }; /////////////////////////////////////////////////////////////////////////////////////////// class hsAllocator { public: - virtual void* Alloc(UInt32 size) = 0; + virtual void* Alloc(uint32_t size) = 0; virtual void Free(void* addr) = 0; }; @@ -73,9 +72,9 @@ class hsScratchMem { enum { kBufferSize = 32 }; - UInt8* fMem; - UInt8 fMemBuffer[kBufferSize]; - UInt32 fLength; + uint8_t* fMem; + uint8_t fMemBuffer[kBufferSize]; + uint32_t fLength; public: hsScratchMem() : fLength(kBufferSize) { @@ -86,12 +85,12 @@ public: if (fMem != fMemBuffer) delete[] fMem; } - UInt8* GetMem(UInt32 length) + uint8_t* GetMem(uint32_t length) { if (length > fLength) { if (fMem != fMemBuffer) delete[] fMem; - fMem = TRACKED_NEW UInt8[length]; + fMem = new uint8_t[length]; fLength = length; } return fMem; @@ -102,36 +101,36 @@ class hsChunkAllocator { enum { kDefaultChunkSize = 4096 }; - UInt32 fChunkSize; + uint32_t fChunkSize; struct hsPrivateChunk* fChunk; - hsDebugCode(UInt32 fChunkCount;) + hsDebugCode(uint32_t fChunkCount;) public: - hsChunkAllocator(UInt32 chunkSize = kDefaultChunkSize); + hsChunkAllocator(uint32_t chunkSize = kDefaultChunkSize); ~hsChunkAllocator(); void Reset(); - void SetChunkSize(UInt32 size); - void* Allocate(UInt32 size, const void* data = nil); // throws if fails - void* SoftAllocate(UInt32 size, const void* data = nil); // returns nil if fails + void SetChunkSize(uint32_t size); + void* Allocate(uint32_t size, const void* data = nil); // throws if fails + void* SoftAllocate(uint32_t size, const void* data = nil); // returns nil if fails }; /////////////////////////////////////////////////////////////////////////////////////////// class hsAppender { struct hsAppenderHead* fFirstBlock, *fLastBlock; - UInt32 fElemSize, fElemCount, fCount; + uint32_t fElemSize, fElemCount, fCount; friend class hsAppenderIterator; public: - hsAppender(UInt32 elemSize, UInt32 minCount = 16); + hsAppender(uint32_t elemSize, uint32_t minCount = 16); ~hsAppender(); - UInt32 ElemSize() const { return fElemSize; } - UInt32 Count() const { return fCount; } + uint32_t ElemSize() const { return fElemSize; } + uint32_t Count() const { return fCount; } hsBool IsEmpty() const { return fCount == 0; } void Reset(); - UInt32 CopyInto(void* data = nil) const; // return size of data array in bytes + uint32_t CopyInto(void* data = nil) const; // return size of data array in bytes void* PushHead(); void PushHead(const void* data); @@ -185,16 +184,16 @@ public: template class hsTAppender : hsAppender { public: hsTAppender() : hsAppender(sizeof(T)) {} - hsTAppender(UInt32 minCount) : hsAppender(sizeof(T), minCount) {} + hsTAppender(uint32_t minCount) : hsAppender(sizeof(T), minCount) {} hsAppender* GetAppender() { return this; } const hsAppender* GetAppender() const { return this; } - UInt32 Count() const { return hsAppender::Count(); } + uint32_t Count() const { return hsAppender::Count(); } hsBool IsEmpty() const { return hsAppender::IsEmpty(); } void Reset() { hsAppender::Reset(); } - UInt32 CopyInto(T copy[]) const { return hsAppender::CopyInto(copy); } + uint32_t CopyInto(T copy[]) const { return hsAppender::CopyInto(copy); } T* PushHead() { return (T*)hsAppender::PushHead(); } void PushHead(const T& item) { *this->PushHead() = item; } diff --git a/Sources/Plasma/CoreLib/hsPoint2.h b/Sources/Plasma/CoreLib/hsPoint2.h index 2e7366eb..91c34d59 100644 --- a/Sources/Plasma/CoreLib/hsPoint2.h +++ b/Sources/Plasma/CoreLib/hsPoint2.h @@ -42,90 +42,92 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #ifndef hsPoint2_Defined #define hsPoint2_Defined -#include "hsScalar.h" +#include -#define HS_POINT2_NAME hsIntPoint2 -#define HS_POINT2_TYPE Int32 -#include "HS_POINT2.inc" +struct hsPolar { + float fRadius; + float fAngle; }; -#define HS_POINT2_NAME hsFixedPoint2 -#define HS_POINT2_TYPE hsFixed -#include "HS_POINT2.inc" - - hsFixedPoint2& operator=(const hsIntPoint2& src) - { - this->fX = hsIntToFixed(src.fX); - this->fY = hsIntToFixed(src.fY); - return *this; - } - - hsFixed Magnitude() const { return hsMagnitude32(fX, fY); } - - static hsFixed Magnitude(hsFixed x, hsFixed y) - { - return hsMagnitude32(x, y); - } - static hsFixed Distance(const hsFixedPoint2& p1, const hsFixedPoint2& p2) - { - return hsMagnitude32(p2.fX - p1.fX, p2.fY - p1.fY); - } +struct hsPoint2 { + float fX, fY; + + hsPoint2& Set(float x, float y) + { + fX = x; + fY = y; + return *this; + } + hsPoint2& operator+=(const hsPoint2& s) + { + this->fX += s.fX; + this->fY += s.fY; + return *this; + } + hsPoint2& operator-=(const hsPoint2& s) + { + this->fX -= s.fX; + this->fY -= s.fY; + return *this; + } + + int operator==(const hsPoint2& ss) const + { + return (ss.fX == fX && ss.fY == fY); + } + int operator!=(const hsPoint2& ss) + { + return !(ss == *this); + } + + friend hsPoint2 operator+(const hsPoint2& s, const hsPoint2& t) + { + hsPoint2 result; + result.Set(s.fX + t.fX, s.fY + t.fY); + return result; + } + friend hsPoint2 operator-(const hsPoint2& s, const hsPoint2& t) + { + hsPoint2 result; + result.Set(s.fX - t.fX, s.fY - t.fY); + return result; + } + friend hsPoint2 operator-(const hsPoint2& s) + { + hsPoint2 result = { -s.fX, -s.fY }; + return result; + } + + friend hsPoint2 operator*(const hsPoint2& s, float t) + { + hsPoint2 result; + result.Set(s.fX * t, s.fY * t); + return result; + } + friend hsPoint2 operator*(float t, const hsPoint2& s) + { + hsPoint2 result; + result.Set(s.fX * t, s.fY * t); + return result; + } + + hsPoint2* Grid(float period); + hsBool CloseEnough(const hsPoint2* p, float tolerance) const; + + float MagnitudeSquared() const { return fX * fX + fY * fY; } + float Magnitude() const { return Magnitude(fX, fY); } + hsPolar* ToPolar(hsPolar* polar) const; + + static float Magnitude(float x, float y) { return sqrt(x * x + y * y); } + static float Distance(const hsPoint2& p1, const hsPoint2& p2); + static hsPoint2 Average(const hsPoint2& a, const hsPoint2& b) + { + hsPoint2 result; + result.Set((a.fX + b.fX) * float(0.5), (a.fY + b.fY) * float(0.5)); + return result; + } + static float ComputeAngle(const hsPoint2& a, const hsPoint2& b, const hsPoint2& c); }; -#if HS_CAN_USE_FLOAT - struct hsPolar { - float fRadius; - float fAngle; - }; - - #define HS_POINT2_NAME hsFloatPoint2 - #define HS_POINT2_TYPE float - #include "HS_POINT2.inc" - - hsFloatPoint2& operator=(const hsIntPoint2& src) - { - this->fX = float(src.fX); - this->fY = float(src.fY); - return *this; - } - - friend hsFloatPoint2 operator*(const hsFloatPoint2& s, float t) - { - hsFloatPoint2 result; - result.Set(s.fX * t, s.fY * t); - return result; - } - friend hsFloatPoint2 operator*(float t, const hsFloatPoint2& s) - { - hsFloatPoint2 result; - result.Set(s.fX * t, s.fY * t); - return result; - } - - hsFloatPoint2* Grid(float period); - hsBool CloseEnough(const hsFloatPoint2* p, float tolerance) const; - - float Magnitude() const { return hsFloatPoint2::Magnitude(fX, fY); } - float MagnitudeSquared() const { return fX * fX + fY * fY; } - hsPolar* ToPolar(hsPolar* polar) const; - - static float Magnitude(float x, float y) { return hsSquareRoot(x * x + y * y); } - static hsScalar Distance(const hsFloatPoint2& p1, const hsFloatPoint2& p2); - static hsFloatPoint2 Average(const hsFloatPoint2& a, const hsFloatPoint2& b) - { - hsFloatPoint2 result; - result.Set((a.fX + b.fX) * float(0.5), (a.fY + b.fY) * float(0.5)); - return result; - } - static hsScalar ComputeAngle(const hsFloatPoint2& a, const hsFloatPoint2& b, const hsFloatPoint2& c); - }; -#endif - -#if HS_SCALAR_IS_FIXED - typedef hsFixedPoint2 hsPoint2; -#else - typedef hsFloatPoint2 hsPoint2; -#endif - #endif // hsPoint2_Defined diff --git a/Sources/Plasma/CoreLib/hsQuat.cpp b/Sources/Plasma/CoreLib/hsQuat.cpp index a1436235..da9c1667 100644 --- a/Sources/Plasma/CoreLib/hsQuat.cpp +++ b/Sources/Plasma/CoreLib/hsQuat.cpp @@ -53,13 +53,13 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // // Construct quat from angle (in radians) and axis of rotation // -hsQuat::hsQuat(hsScalar rad, const hsVector3* axis) +hsQuat::hsQuat(float rad, const hsVector3* axis) { - // hsAssert(rad >= -hsScalarPI && rad <= hsScalarPI, "Quat: Angle should be between -PI and PI"); + // hsAssert(rad >= -M_PI && rad <= M_PI, "Quat: Angle should be between -PI and PI"); - fW = hsCosine(rad*0.5f); + fW = cos(rad*0.5f); - hsScalar s = hsSine(rad*0.5f); + float s = sin(rad*0.5f); fX = axis->fX*s; fY = axis->fY*s; fZ = axis->fZ*s; @@ -68,7 +68,7 @@ hsQuat::hsQuat(hsScalar rad, const hsVector3* axis) hsQuat hsQuat::Inverse() { hsQuat q2 = Conjugate(); - hsScalar msInv = 1.0f/q2.MagnitudeSquared(); + float msInv = 1.0f/q2.MagnitudeSquared(); return (q2 * msInv); } @@ -82,11 +82,11 @@ hsPoint3 hsQuat::Rotate(const hsScalarTriple* v) return hsPoint3(res.fX, res.fY, res.fZ); } -void hsQuat::SetAngleAxis(const hsScalar rad, const hsVector3 &axis) +void hsQuat::SetAngleAxis(const float rad, const hsVector3 &axis) { - fW = hsCosine(rad*0.5f); + fW = cos(rad*0.5f); - hsScalar s = hsSine(rad*0.5f); + float s = sin(rad*0.5f); fX = axis.fX*s; fY = axis.fY*s; fZ = axis.fZ*s; @@ -95,16 +95,16 @@ void hsQuat::SetAngleAxis(const hsScalar rad, const hsVector3 &axis) // // Might want to Normalize before calling this // -void hsQuat::GetAngleAxis(hsScalar *rad, hsVector3 *axis) const +void hsQuat::GetAngleAxis(float *rad, hsVector3 *axis) const { hsAssert((fW >= -1) && (fW <= 1), "Invalid acos argument"); - hsScalar ac = hsACosine(fW); + float ac = acos(fW); *rad = 2.0f * ac; - hsScalar s = hsSine(ac); + float s = sin(ac); if (s != 0.0f) { - hsScalar invS = 1.0f/s; + float invS = 1.0f/s; axis->Set(fX*invS, fY*invS, fZ*invS); } else @@ -114,7 +114,7 @@ void hsQuat::GetAngleAxis(hsScalar *rad, hsVector3 *axis) const // // // -hsScalar hsQuat::MagnitudeSquared() +float hsQuat::MagnitudeSquared() { return (fX*fX + fY*fY + fZ*fZ + fW*fW); } @@ -122,9 +122,9 @@ hsScalar hsQuat::MagnitudeSquared() // // // -hsScalar hsQuat::Magnitude() +float hsQuat::Magnitude() { - return hsSquareRoot(MagnitudeSquared()); + return sqrt(MagnitudeSquared()); } // @@ -132,7 +132,7 @@ hsScalar hsQuat::Magnitude() // void hsQuat::Normalize() { - hsScalar invMag = 1.0f/Magnitude(); + float invMag = 1.0f/Magnitude(); fX *= invMag; fY *= invMag; fZ *= invMag; @@ -145,11 +145,11 @@ void hsQuat::Normalize() void hsQuat::NormalizeIfNeeded() { - hsScalar magSquared = MagnitudeSquared(); + float magSquared = MagnitudeSquared(); if (magSquared == 1.0f) return; - hsScalar invMag = 1.0f/hsSquareRoot(magSquared); + float invMag = 1.0f/sqrt(magSquared); fX *= invMag; fY *= invMag; fZ *= invMag; @@ -259,17 +259,17 @@ void hsQuat::Write(hsStream *stream) // // Interpolate on a sphere. // -void hsQuat::SetFromSlerp(hsQuat *q1, hsQuat *q2, hsScalar t) +void hsQuat::SetFromSlerp(hsQuat *q1, hsQuat *q2, float t) { hsAssert(t>=0.0 && t<= 1.0, "Quat slerp param must be between 0 an 1"); - hsScalar theta = hsACosine(q1->Dot(*q2)); + float theta = acos(q1->Dot(*q2)); - hsScalar st = hsSine(theta); + float st = sin(theta); assert(st != 0.0); - hsScalar s1 = hsSine(1.0-t)*theta / st; + float s1 = sin(1.0-t)*theta / st; - hsScalar s2 = hsSine(t)*theta / st; + float s2 = sin(t)*theta / st; *this = (*q1) * s1 + (*q2) * s2; } @@ -280,15 +280,15 @@ void hsQuat::SetFromSlerp(hsQuat *q1, hsQuat *q2, hsScalar t) #define EPSILON 1.0E-6 /* a tiny number */ -void hsQuat::SetFromSlerp(const hsQuat &a, const hsQuat &b, hsScalar alpha, int spin) +void hsQuat::SetFromSlerp(const hsQuat &a, const hsQuat &b, float alpha, int spin) // double alpha; /* interpolation parameter (0 to 1) */ // Quaternion *a, *b; /* start and end unit quaternions */ // int spin; /* number of extra spin rotations */ { - hsScalar beta; /* complementary interp parameter */ - hsScalar theta; /* angle between A and B */ - hsScalar sin_t, cos_t; /* sine, cosine of theta */ - hsScalar phi; /* theta plus spins */ + float beta; /* complementary interp parameter */ + float theta; /* angle between A and B */ + float sin_t, cos_t; /* sine, cosine of theta */ + float phi; /* theta plus spins */ int bflip; /* use negation of B? */ /* cosine theta = dot product of A and B */ @@ -313,12 +313,12 @@ void hsQuat::SetFromSlerp(const hsQuat &a, const hsQuat &b, hsScalar alpha, int } else { /* normal case */ // hsAssert((cos_t >= -1) && (cos_t <= 1), "Invalid acos argument"); - theta = hsACosine(cos_t); - phi = theta + spin * hsScalarPI; - sin_t = hsSine(theta); + theta = acos(cos_t); + phi = theta + spin * M_PI; + sin_t = sin(theta); hsAssert(sin_t != 0.0, "Invalid sin value in quat slerp"); - beta = hsSine(theta - alpha*phi) / sin_t; - alpha = hsSine(alpha*phi) / sin_t; + beta = sin(theta - alpha*phi) / sin_t; + alpha = sin(alpha*phi) / sin_t; } if (bflip) @@ -337,11 +337,11 @@ void hsQuat::SetFromSlerp(const hsQuat &a, const hsQuat &b, hsScalar alpha, int // void hsQuat::SetFromMatrix(const hsMatrix44* mat) { - hsScalar wSq = 0.25f*(1 + mat->fMap[0][0] + mat->fMap[1][1] + mat->fMap[2][2]); + float wSq = 0.25f*(1 + mat->fMap[0][0] + mat->fMap[1][1] + mat->fMap[2][2]); if (wSq > EPSILON) { - fW = hsSquareRoot(wSq); - hsScalar iw4 = 1.0f/(4.0f*fW); + fW = sqrt(wSq); + float iw4 = 1.0f/(4.0f*fW); fX = (mat->fMap[2][1] - mat->fMap[1][2]) * iw4; fY = (mat->fMap[0][2] - mat->fMap[2][0]) * iw4; fZ = (mat->fMap[1][0] - mat->fMap[0][1]) * iw4; @@ -349,21 +349,21 @@ void hsQuat::SetFromMatrix(const hsMatrix44* mat) } fW = 0; - hsScalar xSq = -0.5f*(mat->fMap[1][1] + mat->fMap[2][2]); + float xSq = -0.5f*(mat->fMap[1][1] + mat->fMap[2][2]); if (xSq > EPSILON) { - fX = hsSquareRoot(xSq); - hsScalar ix2 = 1.0f/(2.0f*fX); + fX = sqrt(xSq); + float ix2 = 1.0f/(2.0f*fX); fY = mat->fMap[1][0] * ix2; fZ = mat->fMap[2][0] * ix2; return; } fX = 0; - hsScalar ySq = 0.5f * (1 - mat->fMap[2][2]); + float ySq = 0.5f * (1 - mat->fMap[2][2]); if (ySq > EPSILON) { - fY = hsSquareRoot(ySq); + fY = sqrt(ySq); fZ = mat->fMap[2][1] / (2.0f*fY); return; } diff --git a/Sources/Plasma/CoreLib/hsQuat.h b/Sources/Plasma/CoreLib/hsQuat.h index 4f1a3003..a61f484e 100644 --- a/Sources/Plasma/CoreLib/hsQuat.h +++ b/Sources/Plasma/CoreLib/hsQuat.h @@ -53,29 +53,29 @@ struct hsMatrix44; class hsQuat { public: - hsScalar fX,fY,fZ,fW; + float fX,fY,fZ,fW; // Constructors hsQuat(){} - hsQuat(hsScalar X, hsScalar Y, hsScalar Z, hsScalar W) : + hsQuat(float X, float Y, float Z, float W) : fX(X), fY(Y), fZ(Z), fW(W) {} hsQuat(const hsQuat& a) { fX = a.fX; fY = a.fY; fZ = a.fZ; fW = a.fW; } - hsQuat(hsScalar af[4]) { fX = af[0]; fY = af[1]; fZ = af[2]; fW = af[3]; } - hsQuat(hsScalar rad, const hsVector3* axis); + hsQuat(float af[4]) { fX = af[0]; fY = af[1]; fZ = af[2]; fW = af[3]; } + hsQuat(float rad, const hsVector3* axis); static hsQuat QuatFromMatrix44(const hsMatrix44& mat); hsQuat& SetFromMatrix44(const hsMatrix44& mat); void SetFromMatrix(const hsMatrix44 *mat); - void SetFromSlerp(const hsQuat &q1, const hsQuat &q2, hsScalar t, int spin=0); - void Set(hsScalar X, hsScalar Y, hsScalar Z, hsScalar W) + void SetFromSlerp(const hsQuat &q1, const hsQuat &q2, float t, int spin=0); + void Set(float X, float Y, float Z, float W) { fX = X; fY = Y; fZ = Z; fW = W; } - void GetAngleAxis(hsScalar *rad, hsVector3 *axis) const; - void SetAngleAxis(const hsScalar rad, const hsVector3 &axis); + void GetAngleAxis(float *rad, hsVector3 *axis) const; + void SetAngleAxis(const float rad, const hsVector3 &axis); hsPoint3 Rotate(const hsScalarTriple* v); // Access operators - hsScalar& operator[](int i) { return (&fX)[i]; } - const hsScalar& operator[](int i) const { return (&fX)[i]; } + float& operator[](int i) { return (&fX)[i]; } + const float& operator[](int i) const { return (&fX)[i]; } // Unary operators hsQuat operator-() const { return(hsQuat(-fX,-fY,-fZ,-fW)); } @@ -84,14 +84,14 @@ public: // Comparison int operator==(const hsQuat& a) const { return (fX==a.fX && fY==a.fY && fZ==a.fZ && fW==a.fW); } - void Identity() { fX = fY = fZ = (hsScalar)0.0; fW = (hsScalar) 1.0; } + void Identity() { fX = fY = fZ = (float)0.0; fW = (float) 1.0; } int IsIdentity() const { return (fX==0.0 && fY==0.0 && fZ==0.0 && fW==1.0); } void Normalize(); void NormalizeIfNeeded(); void MakeMatrix(hsMatrix44 *mat) const; - hsScalar Magnitude(); - hsScalar MagnitudeSquared(); + float Magnitude(); + float MagnitudeSquared(); hsQuat Conjugate() const { return hsQuat(-fX,-fY,-fZ,fW); } hsQuat Inverse(); @@ -99,13 +99,13 @@ public: hsQuat operator-(const hsQuat&) const; hsQuat operator+(const hsQuat&) const; hsQuat operator*(const hsQuat&) const; - hsQuat operator*(hsScalar f) const + hsQuat operator*(float f) const { return hsQuat(fX*f,fY*f,fZ*f,fW*f); } - hsQuat operator/(hsScalar f) const + hsQuat operator/(float f) const { return hsQuat(fX/f,fY/f,fZ/f,fW/f); } hsQuat operator/(const hsQuat&) const; - hsScalar Dot(const hsQuat &q2) const + float Dot(const hsQuat &q2) const { return (fX*q2.fX + fY*q2.fY + fZ*q2.fZ + fW*q2.fW); } // I/O diff --git a/Sources/Plasma/CoreLib/hsQueue.h b/Sources/Plasma/CoreLib/hsQueue.h deleted file mode 100644 index 835063cf..00000000 --- a/Sources/Plasma/CoreLib/hsQueue.h +++ /dev/null @@ -1,369 +0,0 @@ -/*==LICENSE==* - -CyanWorlds.com Engine - MMOG client, server and tools -Copyright (C) 2011 Cyan Worlds, Inc. - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . - -Additional permissions under GNU GPL version 3 section 7 - -If you modify this Program, or any covered work, by linking or -combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK, -NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent -JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK -(or a modified version of those libraries), -containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA, -PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG -JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the -licensors of this Program grant you additional -permission to convey the resulting work. Corresponding Source for a -non-source form of such a combination shall include the source code for -the parts of OpenSSL and IJG JPEG Library used as well as that of the covered -work. - -You can contact Cyan Worlds, Inc. by email legal@cyan.com - or by snail mail at: - Cyan Worlds, Inc. - 14617 N Newport Hwy - Mead, WA 99021 - -*==LICENSE==*/ -#ifndef hsQueue_Defined -#define hsQueue_Defined - -#include "hsTypes.h" - -template class hsQueue { -private: - - int fArraySize; - T *fArray; - int fHead; // Index of first element in the queue - int fTail; // Index of next free spot in the queue - int fLook; // Index of look pointer - hsBool fFull; // Is queue full? - hsBool fEmpty; // Is queue empty? - - void Inc(int *index); - int Inc(int index); - - void Dec(int *index); - int Dec(int index); - -public: - hsQueue( int size ); - ~hsQueue(); - hsBool Append(const T &newTail); // Add to end of line - hsBool Remove(const T &someElement); // Find and remove element in the line - hsBool Pop(T *headElement); // Remove and return the head of the line - hsBool StartLook(T *headElement); // Return the head of the line w/out removing it - hsBool NextLook(T *nextElement); // Return the head of the line w/out removing it - hsBool IsEmpty(void) { return fEmpty; } - hsBool IsFull(void) { return fFull; } -}; - -// -// Constructor -// Allocate array, init head/tail indices -// -template hsQueue::hsQueue( int size ) -{ - fArraySize = size; - fArray = TRACKED_NEW T[ size ]; - fHead = -1; - fTail = -1; - fLook = -1; - fEmpty = true; - fFull = false; -} - -// -// Destructor. free array -// -template hsQueue::~hsQueue() -{ - delete [] fArray; -} - -// -// Wrap index on increment -// -template void hsQueue::Inc( int *index ) -{ - (*index) ++; - if ((*index) == fArraySize) { - *index = 0; - } -} - -// -// Wrap index on increment -// -template int hsQueue::Inc( int index ) -{ - (index) ++; - if ((index) == fArraySize) { - index = 0; - } - return index; -} - -// -// Wrap index on decrement -// -template void hsQueue::Dec( int *index ) -{ - (*index) --; - if ((*index) < 0) { - *index = fArraySize-1; - } -} - -// -// Wrap index on decrement -// -template int hsQueue::Dec( int index ) -{ - (index) --; - if ((index) < 0) { - index = fArraySize-1; - } - return index; -} - -// -// Add copy of item to the array. -// -template hsBool hsQueue::Append(const T &thing) -{ - if (fHead == -1 && fTail == -1) { - // init case - fHead = 0; - fTail = 0; - } - - if (fFull) { - // Queue is full - return false; - } - - if ( (fHead<0 || fHead>=fArraySize) ) { - hsIfDebugMessage( (fHead<0 || fHead>=fArraySize), "Append: Illegal head pointer", fHead); - } - - hsIfDebugMessage( (fTail<0 || fTail>=fArraySize), "Append: Illegal tail pointer", fTail); - - // Copy - fArray[fTail] = thing; - fEmpty = false; - - // increment tail pointer - Inc(&fTail); - if (fTail == fHead) { - fFull = true; - } - - return true; -} - -// -// Get a copy of the head of the array -// -template hsBool hsQueue::Pop(T *thing) -{ - if (fEmpty) { - return false; - } - - hsIfDebugMessage( (fHead<0 || fHead>=fArraySize), "Pop: Illegal head pointer", fHead); - hsIfDebugMessage( (fTail<0 || fTail>=fArraySize), "Pop: Illegal tail pointer", fTail); - - // Copy - *thing = fArray[fHead]; - fFull = false; - - // Increment head pointer - Inc(&fHead); - if (fHead == fTail) { - fEmpty = true; - } - - return true; -} - -// -// Remove item from list -// -template hsBool hsQueue::Remove(const T &thing) -{ - if (fEmpty) { - return false; - } - - hsIfDebugMessage( (fHead<0 || fHead>=fArraySize), "Remove: Illegal head pointer", fHead); - hsIfDebugMessage( (fTail<0 || fTail>=fArraySize), "Remove: Illegal tail pointer", fTail); - - // loop through list, find item - int i = fHead; - do { - if (fArray[i] == thing) { - // Found it - now remove it by sliding everything down 1 - int j=Inc(i); - while(j!= fTail) { - if (fLook==j) - Dec(&fLook); - fArray[Dec(j)] = fArray[j]; - Inc(&j); - } - if (fLook==fTail) - Dec(&fLook); - Dec(&fTail); - if (fTail == fHead) { - fEmpty = true; - } - return true; - } - - Inc(&i); - if (i==fTail) { - return false; - } - - } while(true); -} - -// -// Return pointer to first item in list, without popping it. -// Return false if nothing there. -// -template hsBool hsQueue::StartLook(T *thing) -{ - if (fEmpty) { - return false; - } - - hsIfDebugMessage( (fHead<0 || fHead>=fArraySize), "StartLook: Illegal head pointer", fHead); - hsIfDebugMessage( (fTail<0 || fTail>=fArraySize), "StartLook: Illegal tail pointer", fTail); - - fLook = fHead; - *thing = fArray[fLook]; - - // inc look pointer - Inc(&fLook); - - // success - return true; -} - -// -// Return pointer to next item in list, without popping it. Doesn't change head or tail. -// Should be called immediately after StartLook. -// Return false when at end of list. -// -template hsBool hsQueue::NextLook(T *thing) -{ - if (fEmpty || fLook == fTail) { - return false; - } - - hsAssert(fLook != -1, "Must call StartLook first\n"); - hsIfDebugMessage( (fHead<0 || fHead>=fArraySize), "NextLook: Illegal head pointer", fHead); - hsIfDebugMessage( (fTail<0 || fTail>=fArraySize), "NextLook: Illegal tail pointer", fTail); - - // Return copy of item without removing it - *thing = fArray[fLook]; - Inc(&fLook); - return true; -} - -///////////////////////////////////////////////////////////////////////////////////////// -// -// Code for threaded message queues - move to another file -// -#ifdef MQUEUE - -#include "hsThread.h" -#if HS_BUILD_FOR_UNIX - #include -#endif - -class hsListQue { -public: - struct Elem { - Elem* fNext; - }; -private: - Elem* fHead; - Elem* fTail; - int fCount; -public: - hsListQue(); - virtual ~hsListQue(); - - virtual int Count(); - virtual void Enqueue(Elem* newItem); - virtual Elem* Dequeue(); -}; - -class hsMutexQueue : public hsListQue { - hsMutex fMutex; -public: - hsMutexQueue() {} - - virtual int Count(); - virtual void Enqueue(Elem* newItem); - virtual Elem* Dequeue(); // will return nil if the queue is empty -}; - -class hsSemaphoreQueue : public hsMutexQueue { - hsSemaphore fSema; -public: - hsSemaphoreQueue() {} - - virtual void Enqueue(Elem* newItem); - virtual Elem* Dequeue(); // never returns nil, it just waits -}; - -class hsMsgQueue { - int fMaxSize; -#if HS_BUILD_FOR_UNIX - mqd_t fMQ; -#else - class hsPrivateMQ* fMQ; - UInt32 fAccess; -#endif -public: - enum { - kRead = 0x0001, - kWrite = 0x0002, - kBlock = 0x0004 - }; - - hsMsgQueue(); - virtual ~hsMsgQueue(); - - hsBool Create(const char name[], int maxSize, UInt32 access); - hsBool Open(const char name[], UInt32 access); - void Close(); - - int GetMaxSize() const { return fMaxSize; } - hsBool Send(const void* data, int size = 0); - int Receive(void* data); // returns actual size or 0 - - static void Delete(const char name[]); -}; -#endif // MQUEUE - -#endif - diff --git a/Sources/Plasma/CoreLib/hsSTLStream.cpp b/Sources/Plasma/CoreLib/hsSTLStream.cpp index aa7eb174..523a4a1c 100644 --- a/Sources/Plasma/CoreLib/hsSTLStream.cpp +++ b/Sources/Plasma/CoreLib/hsSTLStream.cpp @@ -45,7 +45,7 @@ hsVectorStream::hsVectorStream() : fEnd(0) { } -hsVectorStream::hsVectorStream(UInt32 chunkSize) +hsVectorStream::hsVectorStream(uint32_t chunkSize) { fVector.reserve(chunkSize); } @@ -59,7 +59,7 @@ hsBool hsVectorStream::AtEnd() return (fBytesRead >= fEnd); } -UInt32 hsVectorStream::Read(UInt32 byteCount, void *buffer) +uint32_t hsVectorStream::Read(uint32_t byteCount, void *buffer) { if (fBytesRead + byteCount > fEnd) { @@ -75,18 +75,18 @@ UInt32 hsVectorStream::Read(UInt32 byteCount, void *buffer) return byteCount; } -UInt32 hsVectorStream::Write(UInt32 byteCount, const void* buffer) +uint32_t hsVectorStream::Write(uint32_t byteCount, const void* buffer) { // If we are at the end of the vector, we can just do a block insert of the data if (fPosition == fVector.size()) - fVector.insert(fVector.end(), (Byte*)buffer, (Byte*)buffer+byteCount); + fVector.insert(fVector.end(), (uint8_t*)buffer, (uint8_t*)buffer+byteCount); // If we are in the middle, I don't know how to just overwrite a block of the vector. // So, we make sure there is enough space and copy the elements one by one else { fVector.reserve(fPosition+byteCount); - for (UInt32 i = 0; i < byteCount; i++) - fVector[fPosition+i] = ((Byte*)buffer)[i]; + for (uint32_t i = 0; i < byteCount; i++) + fVector[fPosition+i] = ((uint8_t*)buffer)[i]; } fPosition += byteCount; @@ -97,7 +97,7 @@ UInt32 hsVectorStream::Write(UInt32 byteCount, const void* buffer) return byteCount; } -void hsVectorStream::Skip(UInt32 deltaByteCount) +void hsVectorStream::Skip(uint32_t deltaByteCount) { fBytesRead += deltaByteCount; fPosition += deltaByteCount; @@ -120,7 +120,7 @@ void hsVectorStream::Truncate() fEnd = fPosition-1; } -UInt32 hsVectorStream::GetEOF() +uint32_t hsVectorStream::GetEOF() { return fEnd; } @@ -130,7 +130,7 @@ void hsVectorStream::CopyToMem(void* mem) memcpy(mem, &fVector[0], fEnd); } -void hsVectorStream::Erase(UInt32 bytes) +void hsVectorStream::Erase(uint32_t bytes) { hsAssert(fPosition+bytes <= fEnd, "Erasing past end of stream"); @@ -158,7 +158,7 @@ const void *hsVectorStream::GetData() #ifdef HS_BUILD_FOR_WIN32 -hsNamedPipeStream::hsNamedPipeStream(UInt8 flags, UInt32 timeout) : +hsNamedPipeStream::hsNamedPipeStream(uint8_t flags, uint32_t timeout) : fFlags(flags), fPipe(INVALID_HANDLE_VALUE), fReadMode(false), @@ -203,15 +203,15 @@ hsBool hsNamedPipeStream::WaitForClientConnect() hsBool hsNamedPipeStream::Open(const char *name, const char *mode) { - wchar* wName = hsStringToWString(name); - wchar* wMode = hsStringToWString(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 *name, const wchar *mode) +hsBool hsNamedPipeStream::Open(const wchar_t *name, const wchar_t *mode) { if (wcschr(mode, L'w')) { @@ -270,7 +270,7 @@ hsBool hsNamedPipeStream::Close() return true; } -hsBool hsNamedPipeStream::ICheckOverlappedResult(BOOL result, UInt32 &numTransferred) +hsBool hsNamedPipeStream::ICheckOverlappedResult(BOOL result, uint32_t &numTransferred) { // Read/Write succeeded, return now if (result) @@ -294,7 +294,7 @@ hsBool hsNamedPipeStream::ICheckOverlappedResult(BOOL result, UInt32 &numTransfe return false; } -hsBool hsNamedPipeStream::IRead(UInt32 byteCount, void *buffer, UInt32 &numRead) +hsBool hsNamedPipeStream::IRead(uint32_t byteCount, void *buffer, uint32_t &numRead) { numRead = 0; @@ -312,7 +312,7 @@ hsBool hsNamedPipeStream::IRead(UInt32 byteCount, void *buffer, UInt32 &numRead) return false; } -hsBool hsNamedPipeStream::IWrite(UInt32 byteCount, const void *buffer, UInt32 &numWritten) +hsBool hsNamedPipeStream::IWrite(uint32_t byteCount, const void *buffer, uint32_t &numWritten) { numWritten = 0; @@ -330,13 +330,13 @@ hsBool hsNamedPipeStream::IWrite(UInt32 byteCount, const void *buffer, UInt32 &n return false; } -UInt32 hsNamedPipeStream::Read(UInt32 byteCount, void *buffer) +uint32_t hsNamedPipeStream::Read(uint32_t byteCount, void *buffer) { - UInt32 totalRead = 0; + uint32_t totalRead = 0; // Read until we get all our data or an error - UInt32 numRead = 0; - while (IRead(byteCount-totalRead, (void*)((UInt32)buffer+totalRead), numRead)) + uint32_t numRead = 0; + while (IRead(byteCount-totalRead, (void*)((uint32_t)buffer+totalRead), numRead)) { totalRead += numRead; @@ -347,13 +347,13 @@ UInt32 hsNamedPipeStream::Read(UInt32 byteCount, void *buffer) return totalRead; } -UInt32 hsNamedPipeStream::Write(UInt32 byteCount, const void *buffer) +uint32_t hsNamedPipeStream::Write(uint32_t byteCount, const void *buffer) { - UInt32 totalWritten = 0; + uint32_t totalWritten = 0; // Write until we get all our data or an error - UInt32 numWritten = 0; - while (IWrite(byteCount-totalWritten, (const void*)((UInt32)buffer+totalWritten), numWritten)) + uint32_t numWritten = 0; + while (IWrite(byteCount-totalWritten, (const void*)((uint32_t)buffer+totalWritten), numWritten)) { totalWritten += numWritten; @@ -368,14 +368,14 @@ UInt32 hsNamedPipeStream::Write(UInt32 byteCount, const void *buffer) using std::min; #endif -void hsNamedPipeStream::Skip(UInt32 deltaByteCount) +void hsNamedPipeStream::Skip(uint32_t deltaByteCount) { char buf[256]; // Read until we get all our data or an error - UInt32 totalRead = 0; - UInt32 numRead = 0; - while (IRead(min((UInt32)256L, deltaByteCount-totalRead), buf, numRead)) + uint32_t totalRead = 0; + uint32_t numRead = 0; + while (IRead(min((uint32_t)256L, deltaByteCount-totalRead), buf, numRead)) { totalRead += numRead; diff --git a/Sources/Plasma/CoreLib/hsSTLStream.h b/Sources/Plasma/CoreLib/hsSTLStream.h index 0ea61f1f..a3420bbb 100644 --- a/Sources/Plasma/CoreLib/hsSTLStream.h +++ b/Sources/Plasma/CoreLib/hsSTLStream.h @@ -49,43 +49,43 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com class hsVectorStream : public hsStream { protected: - std::vector fVector; - UInt32 fEnd; // End of file (one past the last byte) + std::vector fVector; + uint32_t fEnd; // End of file (one past the last byte) public: hsVectorStream(); - hsVectorStream(UInt32 chunkSize); + 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 *, const wchar *) { 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 hsBool AtEnd(); - virtual UInt32 Read(UInt32 byteCount, void * buffer); - virtual UInt32 Write(UInt32 byteCount, const void* buffer); - virtual void Skip(UInt32 deltaByteCount); + 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 UInt32 GetEOF(); + virtual uint32_t GetEOF(); virtual void CopyToMem(void* mem); virtual void Reset(); // clears the buffers // Erase number of bytes at the current position - virtual void Erase(UInt32 bytes); + virtual void Erase(uint32_t bytes); // A pointer to the beginning of the data in the stream. This is only valid // until someone modifies the stream. const void *GetData(); // In case you want to try and be efficient with your memory allocations - void Reserve(UInt32 bytes) { fVector.reserve(bytes); } + void Reserve(uint32_t bytes) { fVector.reserve(bytes); } }; #ifdef HS_BUILD_FOR_WIN32 -#include "hsWindows.h" + class hsNamedPipeStream : public hsStream { @@ -93,17 +93,17 @@ protected: HANDLE fPipe; OVERLAPPED fOverlap; hsBool fReadMode; // True for read, false for write - UInt8 fFlags; - UInt32 fTimeout; + uint8_t fFlags; + uint32_t fTimeout; - hsBool ICheckOverlappedResult(BOOL result, UInt32 &numTransferred); - hsBool IRead(UInt32 byteCount, void *buffer, UInt32 &numRead); - hsBool IWrite(UInt32 byteCount, const void *buffer, UInt32 &numWritten); + 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 flags=0, UInt32 timeout=INFINITE); + hsNamedPipeStream(uint8_t flags=0, uint32_t timeout=INFINITE); virtual ~hsNamedPipeStream(); // The server (writer) and client (reader) need to open the same file. @@ -111,12 +111,12 @@ public: // 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 *name, const wchar *mode); + virtual hsBool Open(const wchar_t *name, const wchar_t *mode); virtual hsBool Close(); - virtual UInt32 Read(UInt32 byteCount, void *buffer); - virtual UInt32 Write(UInt32 byteCount, const void *buffer); - virtual void Skip(UInt32 deltaByteCount); + 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 - diff --git a/Sources/Plasma/CoreLib/hsScalar.h b/Sources/Plasma/CoreLib/hsScalar.h deleted file mode 100644 index 6e56b068..00000000 --- a/Sources/Plasma/CoreLib/hsScalar.h +++ /dev/null @@ -1,200 +0,0 @@ -/*==LICENSE==* - -CyanWorlds.com Engine - MMOG client, server and tools -Copyright (C) 2011 Cyan Worlds, Inc. - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . - -Additional permissions under GNU GPL version 3 section 7 - -If you modify this Program, or any covered work, by linking or -combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK, -NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent -JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK -(or a modified version of those libraries), -containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA, -PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG -JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the -licensors of this Program grant you additional -permission to convey the resulting work. Corresponding Source for a -non-source form of such a combination shall include the source code for -the parts of OpenSSL and IJG JPEG Library used as well as that of the covered -work. - -You can contact Cyan Worlds, Inc. by email legal@cyan.com - or by snail mail at: - Cyan Worlds, Inc. - 14617 N Newport Hwy - Mead, WA 99021 - -*==LICENSE==*/ -#ifndef hsScalarMacrosDefined -#define hsScalarMacrosDefined - -#include "hsFixedTypes.h" - -#ifndef HS_SCALAR_IS_FLOAT - #define HS_SCALAR_IS_FIXED 0 - #define HS_SCALAR_IS_FLOAT 1 - #define HS_NEVER_USE_FLOAT 0 -#endif - -#if HS_SCALAR_IS_FLOAT && HS_NEVER_USE_FLOAT - #error "can't define HS_SCALAR_IS_FLOAT and HS_NEVER_USE_FLOAT" -#endif - -#if HS_SCALAR_IS_FLOAT - #include -#endif - -#define hsScalarDegToRad(deg) hsScalarMul(deg, hsScalarPI / 180) -#define hsScalarRadToDeg(rad) hsScalarMul(rad, 180 / hsScalarPI) - -#if HS_SCALAR_IS_FIXED - typedef hsFixed hsScalar; - - #define hsScalar1 hsFixed1 - #define hsScalarHalf (hsFixed1 >> 1) - #define hsScalarPI (hsFixedPI) - #define hsScalarMax (0x7fffffff) - - #if HS_CAN_USE_FLOAT - #define hsFloatToScalar(x) hsFixed((x) * float(hsFixed1)) - #define hsScalarToFloat(x) ((x) / float(hsFixed1)) - #endif - - #define hsIntToScalar(x) hsIntToFixed(x) - #define hsScalarToInt(x) hsFixedToInt(x) - #define hsScalarRound(x) hsFixedRound(x) - - #define hsFixedToScalar(x) (x) - #define hsScalarToFixed(x) (x) - - #define hsFractToScalar(x) hsFractToFixed(x) - #define hsScalarToFract(x) hsFixedToFract(x) - - #define hsScalarMul(a, b) hsFixMul(a, b) - #define hsScalarMul2(a) ((a) << 1) - #define hsScalarDiv(a, b) hsFixDiv(a, b) - #define hsScalarDiv2(a) ((a) >> 1) - #define hsScalarInvert(a) hsFixDiv(hsFixed1, a) - #define hsScalarMod(a,b) ((a) % (b)) - #define hsScalarMulDiv(n1, n2, d) hsMulDiv32(n1, n2, d) - #define hsScalarMulAdd(a, b, c) (hsFixMul(a, b) + (c)) - - #define hsSquareRoot(scalar) hsFixSqrt(scalar) - #define hsSine(angle) hsFixedSin(angle) - #define hsCosine(angle) hsFixedCos(angle) - #define hsTan(angle) (hsSine(angle)/hsCosine(angle)) - #define hsASine(value) hsFixedASin(value) - #define hsACosine(value) hsFixedACos(value) - -#ifdef __cplusplus - inline hsScalar hsScalarAverage(hsScalar a, hsScalar b) { return a + b >> 1; } - inline hsScalar hsScalarAverage(hsScalar a, hsScalar b, hsScalar t) - { - return a + hsFixMul(t, b - a); - } - - #if HS_CAN_USE_FLOAT - inline hsScalar hsPow(hsScalar base, hsScalar exponent) - { - return hsFloatToScalar(powf(hsScalarToFloat(base), hsScalarToFloat(exponent))); - } - inline hsScalar hsATan2(hsScalar y, hsScalar x) - { - return hsFloatToScalar(atan2f(hsScalarToFloat(y), hsScalarToFloat(x))); - } - #endif - inline hsScalar hsCeil(hsScalar x) { return (x + 0xFFFF) & 0xFFFF0000; } - inline hsScalar hsFloor(hsScalar x) { return x & 0xFFFF0000; } -#endif -#endif -#if HS_SCALAR_IS_FLOAT - typedef float hsScalar; - - #define hsScalar1 float(1) - #define hsScalarHalf float(0.5) - #define hsScalarPI float(HS_PI) - #define hsScalarMax float(3.402823466e+38F) - - #define hsFloatToScalar(x) float(x) - #define hsScalarToFloat(x) float(x) - - #define hsIntToScalar(x) float(x) - #define hsScalarToInt(x) Int32(x) - - - #define hsFixedToScalar(x) ((hsScalar)(x) / float(hsFixed1)) - #define hsScalarToFixed(x) hsFixed((x) * float(hsFixed1)) - - #define hsFractToScalar(x) ((x) / float(hsFract1)) - #define hsScalarToFract(x) hsFract((x) * float(hsFract1)) -#ifdef __cplusplus - - #define hsScalarMod(a,b) fmodf(a, b) - #define hsScalarMulAdd(a, b, c) ((a) * (b) + (c)) - #define hsScalarMul(a,b) ((a) * (b)) - #define hsScalarMul2(a) ((a) * 2) - #define hsScalarDiv(a,b) ((a) / (b)) - #define hsScalarDiv2(a) ((a) * float(0.5)) - #define hsScalarInvert(a) (float(1) / (a)) - #define hsScalarMulDiv(n1,n2,d) ((n1) * (n2) / (d)) - -#ifndef HS_DEBUGGING /* mf horse testing defines vs inlines for VC++5.0 performance */ - - #define hsScalarRound(x) Int32((x) + ((x) < 0 ? -hsScalarHalf : hsScalarHalf)) - -#else /* HS_DEBUGGING - use inlines for type-checking etc...and all */ - inline Int32 hsScalarRound(float x) - { - float half = hsScalarHalf; - if (x < 0) - half = -half; - return Int32(x + half); - } -#endif /* HS_DEBUGGING - use inlines for type-checking etc...and all */ - - inline float hsScalarAverage(float a, float b) { return (a + b) * float(0.5); } - inline float hsScalarAverage(float a, float b, float t) { return a + t * (b - a); } - - inline hsScalar hsSquareRoot(hsScalar scalar) { return sqrtf(scalar); } - inline hsScalar hsSine(hsScalar angle) { return sinf(angle); } - inline hsScalar hsCosine(hsScalar angle) { return cosf(angle); } - inline hsScalar hsTan(hsScalar rads) { return tanf(rads); } - inline hsScalar hsASine(hsScalar value) { return asinf(value); } - inline hsScalar hsACosine(hsScalar value) { return acosf(value); } - inline hsScalar hsPow(hsScalar base, hsScalar exponent) { return powf(base, exponent); } - inline hsScalar hsATan2(hsScalar y, hsScalar x) { return atan2f(y, x); } - inline hsScalar hsCeil(hsScalar x) { return ceilf(x); } - inline hsScalar hsFloor(hsScalar x) { return floorf(x); } -#endif /* HS_SCALAR_IS_FLOAT */ -#endif /* __CPLUSPLUS */ - -// -// Macros for enabling double precision math ops -// require #include -// -#if HS_BUILD_FOR_WIN32 -#define hsDoublePrecBegin \ - unsigned int fpc=_controlfp( 0, 0); \ - _controlfp( _PC_64, MCW_PC ); -#define hsDoublePrecEnd \ - _controlfp( fpc, 0xfffff ); -#else -#define hsDoublePrecBegin -#define hsDoublePrecEnd -#endif - -#endif diff --git a/Sources/Plasma/CoreLib/hsStlUtils.cpp b/Sources/Plasma/CoreLib/hsStlUtils.cpp index 8c396d08..f93e0962 100644 --- a/Sources/Plasma/CoreLib/hsStlUtils.cpp +++ b/Sources/Plasma/CoreLib/hsStlUtils.cpp @@ -262,7 +262,7 @@ bool formatv(std::string & out, const char * fmt, va_list args) { if (pbuf!=buf) delete [] pbuf; - pbuf = TRACKED_NEW char[kBufSz+kBufSz*attempts]; + pbuf = new char[kBufSz+kBufSz*attempts]; } } while (!success && attempts + +#include "HeadSpin.h" #include #include #include @@ -114,12 +114,12 @@ public: void deallocate(pointer _Ptr, size_type) { // deallocate object at _Ptr, ignore size - FREE(_Ptr); + free(_Ptr); } pointer allocate(size_type _Count) { // allocate array of _Count elements - return (pointer)ALLOC(_Count * sizeof(_Ty)); + return (pointer)malloc(_Count * sizeof(_Ty)); } pointer allocate(size_type _Count, const void*) diff --git a/Sources/Plasma/CoreLib/hsStream.cpp b/Sources/Plasma/CoreLib/hsStream.cpp index 5bac2757..9641e57d 100644 --- a/Sources/Plasma/CoreLib/hsStream.cpp +++ b/Sources/Plasma/CoreLib/hsStream.cpp @@ -42,7 +42,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include #include "hsStream.h" #include "hsMemory.h" -#include "hsUtils.h" + #include "hsTemplates.h" #include "hsStlUtils.h" @@ -51,7 +51,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include #endif -#include "hsWindows.h" + #if HS_BUILD_FOR_WIN32 #include #endif @@ -64,12 +64,12 @@ void hsStream::FastFwd() hsThrow("FastFwd unimplemented by subclass of stream"); } -UInt32 hsStream::GetPosition() const +uint32_t hsStream::GetPosition() const { return fPosition; } -void hsStream::SetPosition(UInt32 position) +void hsStream::SetPosition(uint32_t position) { if (position == fPosition) return; @@ -82,9 +82,9 @@ void hsStream::Truncate() hsThrow("Truncate unimplemented by subclass of stream"); } -UInt32 hsStream::GetSizeLeft() +uint32_t hsStream::GetSizeLeft() { - UInt32 ret = 0; + uint32_t ret = 0; if (GetPosition() > GetEOF()) { hsThrow("Position is beyond EOF"); @@ -99,7 +99,7 @@ UInt32 hsStream::GetSizeLeft() ////////////////////////////////////////////////////////////////////////////////// -UInt32 hsStream::GetEOF() +uint32_t hsStream::GetEOF() { hsThrow( "GetEOF() unimplemented by subclass of stream"); return 0; @@ -116,41 +116,41 @@ hsStream::~hsStream() { } -UInt32 hsStream::WriteString(const char cstring[]) +uint32_t hsStream::WriteString(const char cstring[]) { return Write(hsStrlen(cstring), cstring); } -UInt32 hsStream::WriteFmt(const char * fmt, ...) +uint32_t hsStream::WriteFmt(const char * fmt, ...) { va_list av; va_start( av, fmt ); - UInt32 n = WriteFmtV( fmt, av ); + uint32_t n = WriteFmtV( fmt, av ); va_end( av ); return n; } -UInt32 hsStream::WriteFmtV(const char * fmt, va_list av) +uint32_t hsStream::WriteFmtV(const char * fmt, va_list av) { std::string buf; xtl::formatv( buf, fmt, av ); return Write( buf.length(), buf.data() ); } -UInt32 hsStream::WriteSafeStringLong(const char *string) +uint32_t hsStream::WriteSafeStringLong(const char *string) { - UInt32 len = hsStrlen(string); + uint32_t len = hsStrlen(string); WriteLE32(len); if (len > 0) { - char *buff = TRACKED_NEW char[len+1]; + char *buff = new char[len+1]; int i; for (i = 0; i < len; i++) { buff[i] = ~string[i]; } buff[len] = '\0'; - UInt32 result = Write(len, buff); + uint32_t result = Write(len, buff); delete [] buff; return result; } @@ -158,9 +158,9 @@ UInt32 hsStream::WriteSafeStringLong(const char *string) return 0; } -UInt32 hsStream::WriteSafeWStringLong(const wchar_t *string) +uint32_t hsStream::WriteSafeWStringLong(const wchar_t *string) { - UInt32 len = wcslen(string); + uint32_t len = wcslen(string); WriteLE32(len); if (len > 0) { @@ -168,9 +168,9 @@ UInt32 hsStream::WriteSafeWStringLong(const wchar_t *string) for (i=0; i 0 && numChars <= GetSizeLeft()) { - name = TRACKED_NEW char[numChars+1]; + name = new char[numChars+1]; Read(numChars, name); name[numChars] = '\0'; @@ -200,10 +200,10 @@ char *hsStream::ReadSafeStringLong() wchar_t *hsStream::ReadSafeWStringLong() { wchar_t *retVal = nil; - UInt32 numChars = ReadLE32(); + uint32_t numChars = ReadLE32(); if (numChars > 0 && numChars <= (GetSizeLeft()/2)) // divide by two because each char is two bytes { - retVal = TRACKED_NEW wchar_t[numChars+1]; + retVal = new wchar_t[numChars+1]; int i; for (i=0; i 0) { - char *buff = TRACKED_NEW char[len+1]; + char *buff = new char[len+1]; int i; for (i = 0; i < len; i++) { buff[i] = ~string[i]; } buff[len] = '\0'; - UInt32 result = Write(len, buff); + uint32_t result = Write(len, buff); delete [] buff; return result; } @@ -244,7 +244,7 @@ UInt32 hsStream::WriteSafeString(const char *string) return 0; } -UInt32 hsStream::WriteSafeWString(const wchar_t *string) +uint32_t hsStream::WriteSafeWString(const wchar_t *string) { int len = wcslen(string); hsAssert(len<0xf000, xtl::format("string len of %d is too long for WriteSafeWString, use WriteSafeWStringLong", @@ -257,9 +257,9 @@ UInt32 hsStream::WriteSafeWString(const wchar_t *string) for (i=0; i 0 && numChars <= GetSizeLeft()) { - name = TRACKED_NEW char[numChars+1]; + name = new char[numChars+1]; Read(numChars, name); name[numChars] = '\0'; @@ -299,13 +299,13 @@ char *hsStream::ReadSafeString() wchar_t *hsStream::ReadSafeWString() { wchar_t *retVal = nil; - UInt32 numChars = ReadLE16(); + uint32_t numChars = ReadLE16(); numChars &= ~0xf000; hsAssert(numChars <= GetSizeLeft()/2, "Bad string"); if (numChars > 0 && numChars <= (GetSizeLeft()/2)) // divide by two because each char is two bytes { - retVal = TRACKED_NEW wchar_t[numChars+1]; + retVal = new wchar_t[numChars+1]; int i; for (i=0; iRead(sizeof(UInt32), pv); + int knt = this->Read(sizeof(uint32_t), pv); if (knt != 4) return false; return true; @@ -388,7 +388,7 @@ void hsStream::ReadBool(int count, hsBool values[]) this->Read(count, values); if (sizeof(hsBool) > 1) - { const UInt8* src = (UInt8*)values; + { const uint8_t* src = (uint8_t*)values; // go backwards so we don't overwrite ourselves for (int i = count - 1; i >= 0; --i) @@ -396,11 +396,11 @@ void hsStream::ReadBool(int count, hsBool values[]) } } -UInt8 hsStream::ReadByte() +uint8_t hsStream::ReadByte() { - UInt8 value; + uint8_t value; - this->Read(sizeof(UInt8), &value); + this->Read(sizeof(uint8_t), &value); return value; } @@ -415,7 +415,7 @@ hsBool hsStream::IsTokenSeparator(char c) return (isspace(c) || c==',' || c=='='); } -hsBool hsStream::GetToken(char *s, UInt32 maxLen, const char beginComment, const char endComment) +hsBool hsStream::GetToken(char *s, uint32_t maxLen, const char beginComment, const char endComment) { char c; char endCom; @@ -439,7 +439,7 @@ hsBool hsStream::GetToken(char *s, UInt32 maxLen, const char beginComment, const } s[0] = c; - UInt32 k = 1; + uint32_t k = 1; while( !AtEnd() && !IsTokenSeparator(c = ReadByte()) ) { if( k < maxLen ) @@ -465,7 +465,7 @@ hsBool hsStream::GetToken(char *s, UInt32 maxLen, const char beginComment, const return true; } -hsBool hsStream::ReadLn(char *s, UInt32 maxLen, const char beginComment, const char endComment) +hsBool hsStream::ReadLn(char *s, uint32_t maxLen, const char beginComment, const char endComment) { char c; char endCom; @@ -489,7 +489,7 @@ hsBool hsStream::ReadLn(char *s, UInt32 maxLen, const char beginComment, const c } s[0] = c; - UInt32 k = 1; + uint32_t k = 1; while( !AtEnd() && !strchr("\r\n",c = ReadByte()) ) { if( k < maxLen ) @@ -515,105 +515,103 @@ hsBool hsStream::ReadLn(char *s, UInt32 maxLen, const char beginComment, const c return true; } -UInt16 hsStream::ReadLE16() +uint16_t hsStream::ReadLE16() { - UInt16 value; - this->Read(sizeof(UInt16), &value); + uint16_t value; + this->Read(sizeof(uint16_t), &value); value = hsToLE16(value); return value; } -void hsStream::ReadLE16(int count, UInt16 values[]) +void hsStream::ReadLE16(int count, uint16_t values[]) { - this->Read(count * sizeof(UInt16), values); + this->Read(count * sizeof(uint16_t), values); for (int i = 0; i < count; i++) values[i] = hsToLE16(values[i]); } -UInt32 hsStream::ReadLE32() +uint32_t hsStream::ReadLE32() { - UInt32 value; + uint32_t value; Read4Bytes(&value); value = hsToLE32(value); return value; } -void hsStream::ReadLE32(int count, UInt32 values[]) +void hsStream::ReadLE32(int count, uint32_t values[]) { - this->Read(count * sizeof(UInt32), values); + this->Read(count * sizeof(uint32_t), values); for (int i = 0; i < count; i++) values[i] = hsToLE32(values[i]); } -UInt32 hsStream::ReadBE32() +uint32_t hsStream::ReadBE32() { - UInt32 value; + uint32_t value; Read4Bytes(&value); value = hsToBE32(value); return value; } -#if HS_CAN_USE_FLOAT - double hsStream::ReadLEDouble() - { - double value; - Read8Bytes(&value); - value = hsToLEDouble(value); - return value; - } +double hsStream::ReadLEDouble() +{ + double value; + Read8Bytes(&value); + value = hsToLEDouble(value); + return value; +} - void hsStream::ReadLEDouble(int count, double values[]) - { - this->Read(count * sizeof(double), values); - for (int i = 0; i < count; i++) - values[i] = hsToLEDouble(values[i]); - } +void hsStream::ReadLEDouble(int count, double values[]) +{ + this->Read(count * sizeof(double), values); + for (int i = 0; i < count; i++) + values[i] = hsToLEDouble(values[i]); +} - float hsStream::ReadLEFloat() - { - float value; - Read4Bytes(&value); - value = hsToLEFloat(value); - return value; - } +float hsStream::ReadLEFloat() +{ + float value; + Read4Bytes(&value); + value = hsToLEFloat(value); + return value; +} - void hsStream::ReadLEFloat(int count, float values[]) - { - this->Read(count * sizeof(float), values); - for (int i = 0; i < count; i++) - values[i] = hsToLEFloat(values[i]); - } +void hsStream::ReadLEFloat(int count, float values[]) +{ + this->Read(count * sizeof(float), values); + for (int i = 0; i < count; i++) + values[i] = hsToLEFloat(values[i]); +} - float hsStream::ReadBEFloat() - { - float value; - this->Read(sizeof(float), &value); - value = hsToBEFloat(value); - return value; - } -#endif +float hsStream::ReadBEFloat() +{ + float value; + this->Read(sizeof(float), &value); + value = hsToBEFloat(value); + return value; +} void hsStream::WriteBool(hsBool value) { - UInt8 dst = (value != 0); + uint8_t dst = (value != 0); - this->Write(sizeof(UInt8), &dst); + this->Write(sizeof(uint8_t), &dst); } void hsStream::Writebool(bool value) { - UInt8 dst = (value != 0); + uint8_t dst = (value != 0); - this->Write(sizeof(UInt8), &dst); + this->Write(sizeof(uint8_t), &dst); } void hsStream::WriteBool(int count, const hsBool values[]) { if (sizeof(hsBool) > 1) - { hsTempArray storage(count); - UInt8* dst = (UInt8*)values; + { hsTempArray storage(count); + uint8_t* dst = (uint8_t*)values; for (int i = 0; i < count; i++) dst[i] = (values[i] != 0); @@ -623,83 +621,81 @@ void hsStream::WriteBool(int count, const hsBool values[]) this->Write(count, values); } -void hsStream::WriteByte(UInt8 value) +void hsStream::WriteByte(uint8_t value) { - this->Write(sizeof(UInt8), &value); + this->Write(sizeof(uint8_t), &value); } -void hsStream::WriteLE16(UInt16 value) +void hsStream::WriteLE16(uint16_t value) { value = hsToLE16(value); - this->Write(sizeof(Int16), &value); + this->Write(sizeof(int16_t), &value); } -void hsStream::WriteLE16(int count, const UInt16 values[]) +void hsStream::WriteLE16(int count, const uint16_t values[]) { for (int i = 0; i < count; i++) this->WriteLE16(values[i]); } -void hsStream::WriteLE32(UInt32 value) +void hsStream::WriteLE32(uint32_t value) { value = hsToLE32(value); - this->Write(sizeof(Int32), &value); + this->Write(sizeof(int32_t), &value); } -void hsStream::WriteLE32(int count, const UInt32 values[]) +void hsStream::WriteLE32(int count, const uint32_t values[]) { for (int i = 0; i < count; i++) this->WriteLE32(values[i]); } -void hsStream::WriteBE32(UInt32 value) +void hsStream::WriteBE32(uint32_t value) { value = hsToBE32(value); - this->Write(sizeof(Int32), &value); + this->Write(sizeof(int32_t), &value); } -#if HS_CAN_USE_FLOAT - void hsStream::WriteLEDouble(double value) - { - value = hsToLEDouble(value); - this->Write(sizeof(double), &value); - } +void hsStream::WriteLEDouble(double value) +{ + value = hsToLEDouble(value); + this->Write(sizeof(double), &value); +} - void hsStream::WriteLEDouble(int count, const double values[]) - { - for (int i = 0; i < count; i++) - this->WriteLEDouble(values[i]); - } +void hsStream::WriteLEDouble(int count, const double values[]) +{ + for (int i = 0; i < count; i++) + this->WriteLEDouble(values[i]); +} - void hsStream::WriteLEFloat(float value) - { - value = hsToLEFloat(value); - this->Write(sizeof(float), &value); - } +void hsStream::WriteLEFloat(float value) +{ + value = hsToLEFloat(value); + this->Write(sizeof(float), &value); +} - void hsStream::WriteLEFloat(int count, const float values[]) - { - for (int i = 0; i < count; i++) - this->WriteLEFloat(values[i]); - } +void hsStream::WriteLEFloat(int count, const float values[]) +{ + for (int i = 0; i < count; i++) + this->WriteLEFloat(values[i]); +} - void hsStream::WriteBEFloat(float value) - { - value = hsToBEFloat(value); - this->Write(sizeof(float), &value); - } -#endif +void hsStream::WriteBEFloat(float value) +{ + value = hsToBEFloat(value); + this->Write(sizeof(float), &value); +} -void hsStream::WriteLEAtom(UInt32 tag, UInt32 size) +void hsStream::WriteLEAtom(uint32_t tag, uint32_t size) { this->WriteLE32(tag); this->WriteLE32(size); } -UInt32 hsStream::ReadLEAtom(UInt32* sizePtr) +uint32_t hsStream::ReadLEAtom(uint32_t* sizePtr) { - UInt32 tag = this->ReadLE32(); - UInt32 size = this->ReadLE32(); + uint32_t tag = this->ReadLE32(); + uint32_t size = this->ReadLE32(); if (sizePtr) *sizePtr = size; @@ -716,7 +712,7 @@ hsBool hsFileStream::Open(const char *name, const char *mode) return false; } -hsBool hsFileStream::Open(const wchar *name, const wchar *mode) +hsBool hsFileStream::Open(const wchar_t *name, const wchar_t *mode) { hsAssert(0, "hsFileStream::Open NotImplemented"); return false; @@ -728,12 +724,12 @@ hsBool hsFileStream::Close () return false; } -UInt32 hsFileStream::GetFileRef() +uint32_t hsFileStream::GetFileRef() { return fRef; } -void hsFileStream::SetFileRef(UInt32 ref) +void hsFileStream::SetFileRef(uint32_t ref) { hsAssert(ref != kFileStream_Uninitialized, "bad ref"); fRef = ref; @@ -748,7 +744,7 @@ hsFileStream::~hsFileStream() { } -UInt32 hsFileStream::Read(UInt32 bytes, void* buffer) +uint32_t hsFileStream::Read(uint32_t bytes, void* buffer) { hsAssert(fRef != kFileStream_Uninitialized, "fRef uninitialized"); @@ -756,7 +752,7 @@ UInt32 hsFileStream::Read(UInt32 bytes, void* buffer) fPosition += bytes; #if HS_BUILD_FOR_WIN32 - UInt32 rBytes; + uint32_t rBytes; ReadFile((HANDLE)fRef, buffer, bytes, (LPDWORD)&rBytes, nil); if(bytes == rBytes) return bytes; @@ -767,7 +763,7 @@ UInt32 hsFileStream::Read(UInt32 bytes, void* buffer) #endif } -UInt32 hsFileStream::Write(UInt32 bytes, const void* buffer) +uint32_t hsFileStream::Write(uint32_t bytes, const void* buffer) { hsAssert(fRef != kFileStream_Uninitialized, "fRef uninitialized"); @@ -775,7 +771,7 @@ UInt32 hsFileStream::Write(UInt32 bytes, const void* buffer) fPosition += bytes; #if HS_BUILD_FOR_WIN32 - UInt32 wBytes; + uint32_t wBytes; WriteFile((HANDLE)fRef, buffer, bytes, (LPDWORD)&wBytes, nil); if(bytes == wBytes) return bytes; @@ -795,7 +791,7 @@ UInt32 hsFileStream::Write(UInt32 bytes, const void* buffer) hsBool hsFileStream::AtEnd() { #if HS_BUILD_FOR_WIN32 - UInt32 bytes; + uint32_t bytes; PeekNamedPipe((void*)fRef, nil, 0, nil, (LPDWORD)&bytes, nil); return bytes>0; #else @@ -804,7 +800,7 @@ hsBool hsFileStream::AtEnd() #endif } -void hsFileStream::Skip(UInt32 delta) +void hsFileStream::Skip(uint32_t delta) { fBytesRead += delta; fPosition += delta; @@ -844,7 +840,7 @@ hsBool hsUNIXStream::Open(const char *name, const char *mode) return (fRef) ? true : false; } -hsBool hsUNIXStream::Open(const wchar *name, const wchar *mode) +hsBool hsUNIXStream::Open(const wchar_t *name, const wchar_t *mode) { fPosition = 0; fRef = hsWFopen(name, mode); @@ -863,7 +859,7 @@ hsBool hsUNIXStream::Close() return !rtn; } -UInt32 hsUNIXStream::Read(UInt32 bytes, void* buffer) +uint32_t hsUNIXStream::Read(uint32_t bytes, void* buffer) { if (!fRef || !bytes) return 0; @@ -895,7 +891,7 @@ hsBool hsUNIXStream::AtEnd() return rVal; } -UInt32 hsUNIXStream::Write(UInt32 bytes, const void* buffer) +uint32_t hsUNIXStream::Write(uint32_t bytes, const void* buffer) { if (!fRef) return 0; @@ -903,7 +899,7 @@ UInt32 hsUNIXStream::Write(UInt32 bytes, const void* buffer) return fwrite(buffer, bytes, 1, fRef); } -void hsUNIXStream::SetPosition(UInt32 position) +void hsUNIXStream::SetPosition(uint32_t position) { if (!fRef || (position == fPosition)) return; @@ -912,7 +908,7 @@ void hsUNIXStream::SetPosition(UInt32 position) (void)::fseek(fRef, position, SEEK_SET); } -void hsUNIXStream::Skip(UInt32 delta) +void hsUNIXStream::Skip(uint32_t delta) { if (!fRef) return; @@ -938,14 +934,14 @@ void hsUNIXStream::FastFwd() fBytesRead = fPosition = ftell(fRef); } -UInt32 hsUNIXStream::GetEOF() +uint32_t hsUNIXStream::GetEOF() { if( !fRef ) return 0; long oldPos = ftell( fRef ); (void)::fseek( fRef, 0, SEEK_END ); - UInt32 end = (UInt32)ftell( fRef ); + uint32_t end = (uint32_t)ftell( fRef ); (void)::fseek( fRef, oldPos, SEEK_SET ); return end; @@ -977,7 +973,7 @@ plReadOnlySubStream::~plReadOnlySubStream() { } -void plReadOnlySubStream::Open( hsStream *base, UInt32 offset, UInt32 length ) +void plReadOnlySubStream::Open( hsStream *base, uint32_t offset, uint32_t length ) { fBase = base; fOffset = offset; @@ -999,7 +995,7 @@ hsBool plReadOnlySubStream::AtEnd() return false; } -UInt32 plReadOnlySubStream::Read(UInt32 byteCount, void* buffer) +uint32_t plReadOnlySubStream::Read(uint32_t byteCount, void* buffer) { if( byteCount > GetSizeLeft() ) { @@ -1007,18 +1003,18 @@ UInt32 plReadOnlySubStream::Read(UInt32 byteCount, void* buffer) byteCount = GetSizeLeft(); } - UInt32 read = fBase->Read( byteCount, buffer ); + uint32_t read = fBase->Read( byteCount, buffer ); IFixPosition(); return read; } -UInt32 plReadOnlySubStream::Write(UInt32 byteCount, const void* buffer) +uint32_t plReadOnlySubStream::Write(uint32_t byteCount, const void* buffer) { hsAssert( false, "Write not allowed on an plReadOnlySubStream" ); return 0; } -void plReadOnlySubStream::Skip(UInt32 deltaByteCount) +void plReadOnlySubStream::Skip(uint32_t deltaByteCount) { fBase->Skip( deltaByteCount ); IFixPosition(); @@ -1041,7 +1037,7 @@ void plReadOnlySubStream::Truncate() hsAssert( false, "Can't truncate a read-only stream" ); } -UInt32 plReadOnlySubStream::GetEOF() +uint32_t plReadOnlySubStream::GetEOF() { return fLength; } @@ -1055,7 +1051,7 @@ hsRAMStream::hsRAMStream() : fAppender(1, kRAMStreamChunkSize) fIter.ResetToHead(&fAppender); } -hsRAMStream::hsRAMStream(UInt32 chunkSize) : fAppender(1, chunkSize) +hsRAMStream::hsRAMStream(uint32_t chunkSize) : fAppender(1, chunkSize) { fIter.ResetToHead(&fAppender); } @@ -1078,7 +1074,7 @@ hsBool hsRAMStream::AtEnd() return (fBytesRead >= fAppender.Count() * fAppender.ElemSize()); } -UInt32 hsRAMStream::Read(UInt32 byteCount, void * buffer) +uint32_t hsRAMStream::Read(uint32_t byteCount, void * buffer) { if (fBytesRead + byteCount > fAppender.Count() * fAppender.ElemSize()) byteCount = (fAppender.Count() * fAppender.ElemSize()) - fBytesRead; @@ -1091,7 +1087,7 @@ UInt32 hsRAMStream::Read(UInt32 byteCount, void * buffer) return byteCount; } -UInt32 hsRAMStream::Write(UInt32 byteCount, const void* buffer) +uint32_t hsRAMStream::Write(uint32_t byteCount, const void* buffer) { fPosition += byteCount; @@ -1100,7 +1096,7 @@ UInt32 hsRAMStream::Write(UInt32 byteCount, const void* buffer) return byteCount; } -void hsRAMStream::Skip(UInt32 deltaByteCount) +void hsRAMStream::Skip(uint32_t deltaByteCount) { fPosition += deltaByteCount; fIter.Next(deltaByteCount, nil); @@ -1118,7 +1114,7 @@ void hsRAMStream::Truncate() Reset(); } -UInt32 hsRAMStream::GetEOF() +uint32_t hsRAMStream::GetEOF() { return fAppender.Count() * fAppender.ElemSize(); } @@ -1130,13 +1126,13 @@ void hsRAMStream::CopyToMem(void* mem) ////////////////////////////////////////////////////////////////////// -UInt32 hsNullStream::Read(UInt32 byteCount, void * buffer) +uint32_t hsNullStream::Read(uint32_t byteCount, void * buffer) { hsThrow("hsNullStream: Can't read from this stream!"); return 0; } -UInt32 hsNullStream::Write(UInt32 byteCount, const void* buffer) +uint32_t hsNullStream::Write(uint32_t byteCount, const void* buffer) { fBytesRead += byteCount; fPosition += byteCount; @@ -1144,7 +1140,7 @@ UInt32 hsNullStream::Write(UInt32 byteCount, const void* buffer) return byteCount; } -void hsNullStream::Skip(UInt32 deltaByteCount) +void hsNullStream::Skip(uint32_t deltaByteCount) { fBytesRead += deltaByteCount; fPosition += deltaByteCount; @@ -1167,7 +1163,7 @@ hsBool hsReadOnlyStream::AtEnd() return fData >= fStop; } -UInt32 hsReadOnlyStream::Read(UInt32 byteCount, void* buffer) +uint32_t hsReadOnlyStream::Read(uint32_t byteCount, void* buffer) { if (fData + byteCount > fStop) { @@ -1182,13 +1178,13 @@ UInt32 hsReadOnlyStream::Read(UInt32 byteCount, void* buffer) return byteCount; } -UInt32 hsReadOnlyStream::Write(UInt32 byteCount, const void* buffer) +uint32_t hsReadOnlyStream::Write(uint32_t byteCount, const void* buffer) { hsThrow( "can't write to a readonly stream"); return 0; } -void hsReadOnlyStream::Skip(UInt32 deltaByteCount) +void hsReadOnlyStream::Skip(uint32_t deltaByteCount) { fBytesRead += deltaByteCount; fPosition += deltaByteCount; @@ -1217,13 +1213,13 @@ void hsReadOnlyStream::CopyToMem(void* mem) //////////////////////////////////////////////////////////////////////////////////// -UInt32 hsWriteOnlyStream::Read(UInt32 byteCount, void* buffer) +uint32_t hsWriteOnlyStream::Read(uint32_t byteCount, void* buffer) { hsThrow( "can't read to a writeonly stream"); return 0; } -UInt32 hsWriteOnlyStream::Write(UInt32 byteCount, const void* buffer) +uint32_t hsWriteOnlyStream::Write(uint32_t byteCount, const void* buffer) { if (fData + byteCount > fStop) hsThrow("Write past end of stream"); @@ -1237,12 +1233,12 @@ UInt32 hsWriteOnlyStream::Write(UInt32 byteCount, const void* buffer) /////////////////////////////////////////////////////////////////////////////////// -hsQueueStream::hsQueueStream(Int32 size) : +hsQueueStream::hsQueueStream(int32_t size) : fSize(size), fReadCursor(0), fWriteCursor(0) { - fQueue = TRACKED_NEW char[fSize]; + fQueue = new char[fSize]; } hsQueueStream::~hsQueueStream() @@ -1250,12 +1246,12 @@ hsQueueStream::~hsQueueStream() delete [] fQueue; } -UInt32 hsQueueStream::Read(UInt32 byteCount, void * buffer) +uint32_t hsQueueStream::Read(uint32_t byteCount, void * buffer) { hsAssert(fWriteCursor >= 0 && fWriteCursor < fSize,"hsQueueStream: WriteCursor out of range."); hsAssert(fReadCursor >= 0 && fReadCursor < fSize,"hsQueueStream: ReadCursor out of range."); - Int32 limit, length, total; + int32_t limit, length, total; limit = fWriteCursor >= fReadCursor ? fWriteCursor : fSize; length = hsMinimum(limit-fReadCursor,byteCount); @@ -1276,12 +1272,12 @@ UInt32 hsQueueStream::Read(UInt32 byteCount, void * buffer) return total; } -UInt32 hsQueueStream::Write(UInt32 byteCount, const void* buffer) +uint32_t hsQueueStream::Write(uint32_t byteCount, const void* buffer) { hsAssert(fWriteCursor >= 0 && fWriteCursor < fSize,"hsQueueStream: WriteCursor out of range."); hsAssert(fReadCursor >= 0 && fReadCursor < fSize,"hsQueueStream: ReadCursor out of range."); - Int32 length; + int32_t length; length = hsMinimum(fSize-fWriteCursor,byteCount); HSMemory::BlockMove(buffer,fQueue+fWriteCursor,length); @@ -1305,9 +1301,9 @@ UInt32 hsQueueStream::Write(UInt32 byteCount, const void* buffer) return byteCount; } -void hsQueueStream::Skip(UInt32 deltaByteCount) +void hsQueueStream::Skip(uint32_t deltaByteCount) { - Int32 limit, length; + int32_t limit, length; limit = fWriteCursor >= fReadCursor ? fWriteCursor : fSize; length = hsMinimum(limit-fReadCursor,deltaByteCount); @@ -1345,20 +1341,20 @@ hsBool hsQueueStream::AtEnd() // hsBufferedStream /////////////////////////////////////////////////////////////////////////////// -inline void FastByteCopy(void* dest, const void* src, UInt32 bytes) +inline void FastByteCopy(void* dest, const void* src, uint32_t bytes) { // Don't use memcpy if the read is 4 bytes or less, it's faster to just do a // direct copy switch (bytes) { case 4: - *((UInt32*)dest) = *((const UInt32*)src); + *((uint32_t*)dest) = *((const uint32_t*)src); break; case 2: - *((UInt16*)dest) = *((const UInt16*)src); + *((uint16_t*)dest) = *((const uint16_t*)src); break; case 1: - *((UInt8*)dest) = *((const UInt8*)src); + *((uint8_t*)dest) = *((const uint8_t*)src); break; default: memcpy(dest, src, bytes); @@ -1412,9 +1408,9 @@ hsBool hsBufferedStream::Open(const char* name, const char* mode) return true; } -hsBool hsBufferedStream::Open(const wchar *name, const wchar *mode) +hsBool hsBufferedStream::Open(const wchar_t *name, const wchar_t *mode) { - hsAssert(0, "hsFileStream::Open NotImplemented for wchar"); + hsAssert(0, "hsFileStream::Open NotImplemented for wchar_t"); return false; } @@ -1471,13 +1467,13 @@ void hsBufferedStream::SetFileRef(FILE* ref) fWriteBufferUsed = false; } -UInt32 hsBufferedStream::Read(UInt32 bytes, void* buffer) +uint32_t hsBufferedStream::Read(uint32_t bytes, void* buffer) { hsAssert(fRef, "fRef uninitialized"); if (!fRef || bytes == 0) return 0; - UInt32 numReadBytes = 0; + uint32_t numReadBytes = 0; while (bytes > 0 && fPosition < fFileSize) { @@ -1485,9 +1481,9 @@ UInt32 hsBufferedStream::Read(UInt32 bytes, void* buffer) if (fBufferLen > 0) { // Figure out how much we can copy out of the buffer - UInt32 bufferPos = fPosition % kBufferSize; - UInt32 bytesInBuffer = fBufferLen - bufferPos; - UInt32 cachedReadSize = bytesInBuffer < bytes ? bytesInBuffer : bytes; + uint32_t bufferPos = fPosition % kBufferSize; + uint32_t bytesInBuffer = fBufferLen - bufferPos; + uint32_t cachedReadSize = bytesInBuffer < bytes ? bytesInBuffer : bytes; FastByteCopy(buffer, &fBuffer[bufferPos], cachedReadSize); @@ -1511,7 +1507,7 @@ UInt32 hsBufferedStream::Read(UInt32 bytes, void* buffer) // If it is, read as many complete blocks as possible directly into the output buffer. if (bytes >= kBufferSize && fPosition % kBufferSize == 0) { - UInt32 directReadSize = bytes - (bytes % kBufferSize); + uint32_t directReadSize = bytes - (bytes % kBufferSize); hsAssert(ftell(fRef) % kBufferSize == 0 , "read buffer is not in alignment."); int amtRead = ::fread(buffer, 1, directReadSize, fRef); fPosition += amtRead; @@ -1546,7 +1542,7 @@ UInt32 hsBufferedStream::Read(UInt32 bytes, void* buffer) return numReadBytes; } -UInt32 hsBufferedStream::Write(UInt32 bytes, const void* buffer) +uint32_t hsBufferedStream::Write(uint32_t bytes, const void* buffer) { hsAssert(fRef, "fRef uninitialized"); fWriteBufferUsed = true; @@ -1574,7 +1570,7 @@ hsBool hsBufferedStream::AtEnd() } } -void hsBufferedStream::Skip(UInt32 delta) +void hsBufferedStream::Skip(uint32_t delta) { if (fWriteBufferUsed) { @@ -1583,15 +1579,15 @@ void hsBufferedStream::Skip(UInt32 delta) } else { - UInt32 blockStart = ((fPosition + delta) / kBufferSize) * kBufferSize; + uint32_t blockStart = ((fPosition + delta) / kBufferSize) * kBufferSize; // We've got data in the buffer, see if we can just skip in that if (fBufferLen > 0) { - Int32 newBufferPos = Int32(fPosition % kBufferSize) + Int32(delta); + int32_t newBufferPos = int32_t(fPosition % kBufferSize) + int32_t(delta); // If we skipped outside of our buffer, invalidate it - if (newBufferPos < 0 || UInt32(newBufferPos) >= fBufferLen) + if (newBufferPos < 0 || uint32_t(newBufferPos) >= fBufferLen) { fBufferLen = 0; fseek(fRef, blockStart, SEEK_SET); @@ -1618,7 +1614,7 @@ void hsBufferedStream::Rewind() fPosition = 0; } -UInt32 hsBufferedStream::GetEOF() +uint32_t hsBufferedStream::GetEOF() { if (fWriteBufferUsed) { @@ -1627,7 +1623,7 @@ UInt32 hsBufferedStream::GetEOF() long oldPos = ftell(fRef); fseek(fRef, 0, SEEK_END); - UInt32 end = (UInt32)ftell(fRef); + uint32_t end = (uint32_t)ftell(fRef); fseek(fRef, oldPos, SEEK_SET); return end; diff --git a/Sources/Plasma/CoreLib/hsStream.h b/Sources/Plasma/CoreLib/hsStream.h index 1ed46bd7..cf0c5599 100644 --- a/Sources/Plasma/CoreLib/hsStream.h +++ b/Sources/Plasma/CoreLib/hsStream.h @@ -44,7 +44,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include // Included for GCC 3.2.2+ -#include "hsTypes.h" +#include "HeadSpin.h" #include "hsMemory.h" #include "plString.h" @@ -82,8 +82,8 @@ enum VDB_Type {// Virtual Database type kVDB_Mesh }; protected: - UInt32 fBytesRead; - UInt32 fPosition; + uint32_t fBytesRead; + uint32_t fPosition; hsBool IsTokenSeparator(char c); public: @@ -91,25 +91,25 @@ public: virtual ~hsStream(); virtual hsBool Open(const char *, const char * = "rb")=0; - virtual hsBool Open(const wchar *, const wchar * = L"rb")=0; + virtual hsBool Open(const wchar_t *, const wchar_t * = L"rb")=0; virtual hsBool Close()=0; virtual hsBool AtEnd(); - virtual UInt32 Read(UInt32 byteCount, void * buffer) = 0; - virtual UInt32 Write(UInt32 byteCount, const void* buffer) = 0; - virtual void Skip(UInt32 deltaByteCount) = 0; + 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 UInt32 GetPosition() const; - virtual void SetPosition(UInt32 position); + virtual uint32_t GetPosition() const; + virtual void SetPosition(uint32_t position); virtual void Truncate(); virtual void Flush() {} #ifdef STREAM_LOGGER // Logging Reads & Skips - virtual UInt32 LogRead(UInt32 byteCount, void * buffer, const char* desc) { return Read(byteCount,buffer); } + virtual uint32_t LogRead(uint32_t byteCount, void * buffer, const char* desc) { return Read(byteCount,buffer); } virtual char* LogReadSafeString() { return ReadSafeString(); } virtual char* LogReadSafeStringLong() { return ReadSafeStringLong(); } - virtual void LogSkip(UInt32 deltaByteCount, const char* desc) { Skip(deltaByteCount); } + virtual void LogSkip(uint32_t deltaByteCount, const char* desc) { Skip(deltaByteCount); } // Stream Notes for Logging virtual void LogStringString(const char* s) { } @@ -120,120 +120,119 @@ public: void LogVoidFunc() { } // Optimization for small Reads - virtual UInt8 ReadByte(); + 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 UInt32 GetEOF(); - UInt32 GetSizeLeft(); - virtual void CopyToMem(void* mem); - virtual hsBool IsCompressed() { return false; } + virtual uint32_t GetEOF(); + uint32_t GetSizeLeft(); + virtual void CopyToMem(void* mem); + virtual hsBool IsCompressed() { return false; } - UInt32 WriteString(const char cstring[]); - UInt32 WriteString_TEMP(const plString & string) { return WriteString(string.c_str()); } - UInt32 WriteFmt(const char * fmt, ...); - UInt32 WriteFmtV(const char * fmt, va_list av); + uint32_t WriteString(const char cstring[]); + uint32_t WriteString_TEMP(const plString & string) { return WriteString(string.c_str()); } + uint32_t WriteFmt(const char * fmt, ...); + uint32_t WriteFmtV(const char * fmt, va_list av); - UInt32 WriteSafeStringLong(const char *string); // uses 4 bytes for length - UInt32 WriteSafeWStringLong(const wchar_t *string); + uint32_t WriteSafeStringLong(const char *string); // uses 4 bytes for length + uint32_t WriteSafeWStringLong(const wchar_t *string); char * ReadSafeStringLong(); wchar_t * ReadSafeWStringLong(); - UInt32 WriteSafeString(const char *string); // uses 2 bytes for length - UInt32 WriteSafeWString(const wchar_t *string); + uint32_t WriteSafeString(const char *string); // uses 2 bytes for length + uint32_t WriteSafeWString(const wchar_t *string); char * ReadSafeString(); wchar_t * ReadSafeWString(); - UInt32 WriteSafeString_TEMP(const plString &string); // uses 2 bytes for length - UInt32 WriteSafeWString_TEMP(const plString &string); + uint32_t WriteSafeString_TEMP(const plString &string); // uses 2 bytes for length + uint32_t WriteSafeWString_TEMP(const plString &string); plString ReadSafeString_TEMP(); plString ReadSafeWString_TEMP(); - hsBool GetToken(char *s, UInt32 maxLen=UInt32(-1), const char beginComment=kComment, const char endComment=kEolnCode); - hsBool ReadLn(char* s, UInt32 maxLen=UInt32(-1), const char beginComment=kComment, const char endComment=kEolnCode); + 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 Readbool(); hsBool ReadBool(); void ReadBool(int count, hsBool values[]); - UInt16 ReadLE16(); - void ReadLE16(int count, UInt16 values[]); - UInt32 ReadLE32(); - void ReadLE32(int count, UInt32 values[]); - UInt32 ReadBE32(); + 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 WriteByte(UInt8 value); - void WriteLE16(UInt16 value); - void WriteLE16(int count, const UInt16 values[]); - void WriteLE32(UInt32 value); - void WriteLE32(int count, const UInt32 values[]); - void WriteBE32(UInt32 value); + void WriteByte(uint8_t value); + void WriteLE16(uint16_t value); + void WriteLE16(int count, const uint16_t values[]); + void WriteLE32(uint32_t value); + void WriteLE32(int count, const uint32_t values[]); + void WriteBE32(uint32_t value); /* Overloaded Begin (8 & 16 & 32 int)*/ /* yes, swapping an 8 bit value does nothing, just useful*/ void ReadLE(bool* value) { *value = this->ReadByte() ? true : false; } - void ReadLE(UInt8* value) { *value = this->ReadByte(); } - void ReadLE(int count, UInt8 values[]) { this->Read(count, values); } - void ReadLE(UInt16* value) { *value = this->ReadLE16(); } - void ReadLE(int count, UInt16 values[]) { this->ReadLE16(count, values); } - void ReadLE(UInt32* value) { *value = this->ReadLE32(); } - void ReadLE(int count, UInt32 values[]) { this->ReadLE32(count, values); } + void ReadLE(uint8_t* value) { *value = this->ReadByte(); } + void ReadLE(int count, uint8_t values[]) { this->Read(count, values); } + void ReadLE(uint16_t* value) { *value = this->ReadLE16(); } + void ReadLE(int count, uint16_t values[]) { this->ReadLE16(count, values); } + void ReadLE(uint32_t* value) { *value = this->ReadLE32(); } + void ReadLE(int count, uint32_t values[]) { this->ReadLE32(count, values); } #ifdef STREAM_LOGGER // Begin LogReadLEs virtual void LogReadLE(bool* value, const char* desc) { this->ReadLE(value); } - virtual void LogReadLE(UInt8* value, const char* desc) { this->ReadLE(value); } - virtual void LogReadLEArray(int count, UInt8 values[], const char* desc) { this->ReadLE(count, values); } - virtual void LogReadLE(UInt16* value, const char* desc) { this->ReadLE(value); } - virtual void LogReadLEArray(int count, UInt16 values[], const char* desc) { this->ReadLE(count, values); } - virtual void LogReadLE(UInt32* value, const char* desc) { this->ReadLE(value); } - virtual void LogReadLEArray(int count, UInt32 values[], const char* desc) { this->ReadLE(count, values); } + virtual void LogReadLE(uint8_t* value, const char* desc) { this->ReadLE(value); } + virtual void LogReadLEArray(int count, uint8_t values[], const char* desc) { this->ReadLE(count, values); } + virtual void LogReadLE(uint16_t* value, const char* desc) { this->ReadLE(value); } + virtual void LogReadLEArray(int count, uint16_t values[], const char* desc) { this->ReadLE(count, values); } + virtual void LogReadLE(uint32_t* value, const char* desc) { this->ReadLE(value); } + virtual void LogReadLEArray(int count, uint32_t values[], const char* desc) { this->ReadLE(count, values); } // End LogReadLEs #endif void WriteLE(bool value) { this->Write(1,&value); } - void WriteLE(UInt8 value) { this->Write(1,&value); } - void WriteLE(int count, const UInt8 values[]) { this->Write(count, values); } - void WriteLE(UInt16 value) { this->WriteLE16(value); } - void WriteLE(int count, const UInt16 values[]) { this->WriteLE16(count, values); } - void WriteLE(UInt32 value) { this->WriteLE32(value); } - void WriteLE(int count, const UInt32 values[]) { this->WriteLE32(count, values); } - void ReadLE(Int8* value) { *value = this->ReadByte(); } - void ReadLE(int count, Int8 values[]) { this->Read(count, values); } + void WriteLE(uint8_t value) { this->Write(1,&value); } + void WriteLE(int count, const uint8_t values[]) { this->Write(count, values); } + void WriteLE(uint16_t value) { this->WriteLE16(value); } + void WriteLE(int count, const uint16_t values[]) { this->WriteLE16(count, values); } + void WriteLE(uint32_t value) { this->WriteLE32(value); } + void WriteLE(int count, const uint32_t values[]) { this->WriteLE32(count, values); } + void ReadLE(int8_t* value) { *value = this->ReadByte(); } + void ReadLE(int count, int8_t values[]) { this->Read(count, values); } void ReadLE(char* value) { *value = (char)this->ReadByte(); } void ReadLE(int count, char values[]) { this->Read(count, values); } - void ReadLE(Int16* value) { *value = (Int16)this->ReadLE16(); } - void ReadLE(int count, Int16 values[]) { this->ReadLE16(count, (UInt16*)values); } - void ReadLE(Int32* value) { *value = (Int32)this->ReadLE32(); } - void ReadLE(int count, Int32 values[]) { this->ReadLE32(count, (UInt32*)values); } + void ReadLE(int16_t* value) { *value = (int16_t)this->ReadLE16(); } + void ReadLE(int count, int16_t values[]) { this->ReadLE16(count, (uint16_t*)values); } + void ReadLE(int32_t* value) { *value = (int32_t)this->ReadLE32(); } + void ReadLE(int count, int32_t values[]) { this->ReadLE32(count, (uint32_t*)values); } #ifdef STREAM_LOGGER // Begin LogReadLEs - virtual void LogReadLE(Int8* value, const char* desc) { this->ReadLE(value); } - virtual void LogReadLEArray(int count, Int8 values[], const char* desc) { this->ReadLE(count, values); } + virtual void LogReadLE(int8_t* value, const char* desc) { this->ReadLE(value); } + virtual void LogReadLEArray(int count, int8_t values[], const char* desc) { this->ReadLE(count, values); } virtual void LogReadLE(char* value, const char* desc) { this->ReadLE(value); } virtual void LogReadLEArray(int count, char values[], const char* desc) { this->ReadLE(count, values); } - virtual void LogReadLE(Int16* value, const char* desc) { this->ReadLE(value); } - virtual void LogReadLEArray(int count, Int16 values[], const char* desc) { this->ReadLE(count, (UInt16*)values); } - virtual void LogReadLE(Int32* value, const char* desc) { this->ReadLE(value); } - virtual void LogReadLEArray(int count, Int32 values[], const char* desc) { this->ReadLE(count, (UInt32*)values); } + virtual void LogReadLE(int16_t* value, const char* desc) { this->ReadLE(value); } + virtual void LogReadLEArray(int count, int16_t values[], const char* desc) { this->ReadLE(count, (uint16_t*)values); } + virtual void LogReadLE(int32_t* value, const char* desc) { this->ReadLE(value); } + virtual void LogReadLEArray(int count, int32_t values[], const char* desc) { this->ReadLE(count, (uint32_t*)values); } virtual void LogReadLE(int* value, const char* desc) { this->ReadLE(value); } - virtual void LogReadLEArray(int count, int values[], const char* desc) { this->ReadLE(count, (UInt32*)values); } + virtual void LogReadLEArray(int count, int values[], const char* desc) { this->ReadLE(count, (uint32_t*)values); } // End LogReadLEs #endif - void WriteLE(Int8 value) { this->Write(1,&value); } - void WriteLE(int count, const Int8 values[]) { this->Write(count, values); } - void WriteLE(char value) { this->Write(1,(UInt8*)&value); } - void WriteLE(int count, const char values[]) { this->Write(count, (UInt8*)values); } - void WriteLE(Int16 value) { this->WriteLE16((UInt16)value); } - void WriteLE(int count, const Int16 values[]) { this->WriteLE16(count, (UInt16*)values); } - void WriteLE(Int32 value) { this->WriteLE32((UInt32)value); } - void WriteLE(int count, const Int32 values[]) { this->WriteLE32(count, (UInt32*)values); } + void WriteLE(int8_t value) { this->Write(1,&value); } + void WriteLE(int count, const int8_t values[]) { this->Write(count, values); } + void WriteLE(char value) { this->Write(1,(uint8_t*)&value); } + void WriteLE(int count, const char values[]) { this->Write(count, (uint8_t*)values); } + void WriteLE(int16_t value) { this->WriteLE16((uint16_t)value); } + void WriteLE(int count, const int16_t values[]) { this->WriteLE16(count, (uint16_t*)values); } + void WriteLE(int32_t value) { this->WriteLE32((uint32_t)value); } + void WriteLE(int count, const int32_t values[]) { this->WriteLE32(count, (uint32_t*)values); } /* Overloaded End */ -#if HS_CAN_USE_FLOAT float ReadLEFloat(); void ReadLEFloat(int count, float values[]); double ReadLEDouble(); @@ -264,33 +263,7 @@ public: void WriteLE(double value) { WriteLEDouble(value); } void WriteLE(int count, const double values[]) { WriteLEDouble(count, values); } /* Overloaded End */ -#endif -#if HS_SCALAR_IS_FIXED - hsFixed ReadLEScalar() { return (hsFixed)this->ReadLE32(); } - void ReadLEScalar(int count, hsFixed values[]) - { - this->ReadLE32(count, (UInt32*)values); - } - hsFixed ReadBEScalar() { return (hsFixed)this->ReadBE32(); } - - - void WriteLEScalar(hsFixed value) { this->WriteLE32(value); } - void WriteLEScalar(int count, const hsFixed values[]) - { - this->WriteLE32(count, (UInt32*)values); - } - void WriteBEScalar(hsFixed value) { this->WriteBE32(value); } - - - /* Overloaded Begin (Scalar) */ - void ReadLE(hsFixed* value) { this->ReadLE((UInt32*)value); } - void ReadLE(int count, hsFixed values[]) { this->ReadLE(count, (UInt32*)values); } - void WriteLE(hsFixed value) { this->WriteLE((UInt32)value); } - void WriteLE(int count, const hsFixed values[]) { this->WriteLE(count, (UInt32*)values); } - /* Overloaded End */ - -#else float ReadLEScalar() { return (float)this->ReadLEFloat(); } void ReadLEScalar(int count, float values[]) { @@ -303,17 +276,16 @@ public: this->WriteLEFloat(count, (float*)values); } void WriteBEScalar(float value) { this->WriteBEFloat(value); } -#endif - void WriteLEAtom(UInt32 tag, UInt32 size); - UInt32 ReadLEAtom(UInt32* size); + void WriteLEAtom(uint32_t tag, uint32_t size); + uint32_t ReadLEAtom(uint32_t* size); /* Overloaded Begin (Atom)*/ - void WriteLE(UInt32* tag, UInt32 size) { WriteLEAtom(*tag, size); } - void ReadLE(UInt32* tag, UInt32 *size) { *tag = ReadLEAtom(size); } + 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 pos, VDB_Type ){ SetPosition(pos); }; + virtual void VirtualSetPosition(uint32_t pos, VDB_Type ){ SetPosition(pos); }; virtual hsPackFileSys::FileEntry *GetFileEntry() { return nil; } // Streams from Packfiles can return a FileEntry }; @@ -322,29 +294,29 @@ class hsStreamable { public: virtual void Read(hsStream* stream) = 0; virtual void Write(hsStream* stream) = 0; - virtual UInt32 GetStreamSize() = 0; + virtual uint32_t GetStreamSize() = 0; }; class hsFileStream: public hsStream { - UInt32 fRef; + uint32_t fRef; public: hsFileStream(); virtual ~hsFileStream(); virtual hsBool Open(const char *name, const char *mode = "rb"); - virtual hsBool Open(const wchar *name, const wchar *mode = L"rb"); + virtual hsBool Open(const wchar_t *name, const wchar_t *mode = L"rb"); virtual hsBool Close(); virtual hsBool AtEnd(); - virtual UInt32 Read(UInt32 byteCount, void* buffer); - virtual UInt32 Write(UInt32 byteCount, const void* buffer); - virtual void Skip(UInt32 deltaByteCount); + 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 UInt32 GetFileRef(); - virtual void SetFileRef(UInt32 refNum); + virtual uint32_t GetFileRef(); + virtual void SetFileRef(uint32_t refNum); }; class hsUNIXStream: public hsStream @@ -356,14 +328,14 @@ public: hsUNIXStream(): fRef(0), fBuff(nil) {} ~hsUNIXStream(); virtual hsBool Open(const char* name, const char* mode = "rb"); - virtual hsBool Open(const wchar *name, const wchar *mode = L"rb"); + virtual hsBool Open(const wchar_t *name, const wchar_t *mode = L"rb"); virtual hsBool Close(); virtual hsBool AtEnd(); - virtual UInt32 Read(UInt32 byteCount, void* buffer); - virtual UInt32 Write(UInt32 byteCount, const void* buffer); - virtual void SetPosition(UInt32 position); - virtual void Skip(UInt32 deltaByteCount); + 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(); @@ -372,7 +344,7 @@ public: FILE* GetFILE() { return fRef; } void SetFILE(FILE* file) { fRef = file; } - virtual UInt32 GetEOF(); + virtual uint32_t GetEOF(); }; // Small substream class: give it a base stream, an offset and a length, and it'll @@ -382,7 +354,7 @@ public: class plReadOnlySubStream: public hsStream { hsStream *fBase; - UInt32 fOffset, fLength; + uint32_t fOffset, fLength; void IFixPosition( void ); @@ -391,18 +363,18 @@ public: ~plReadOnlySubStream(); virtual hsBool Open(const char *, const char *) { hsAssert(0, "plReadOnlySubStream::Open NotImplemented"); return false; } - virtual hsBool Open(const wchar *, const wchar *) { hsAssert(0, "plReadOnlySubStream::Open NotImplemented"); return false; } - void Open( hsStream *base, UInt32 offset, UInt32 length ); + 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 UInt32 Read(UInt32 byteCount, void* buffer); - virtual UInt32 Write(UInt32 byteCount, const void* buffer); - virtual void Skip(UInt32 deltaByteCount); + 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 UInt32 GetEOF(); + virtual uint32_t GetEOF(); }; class hsRAMStream : public hsStream { @@ -410,22 +382,22 @@ class hsRAMStream : public hsStream { hsAppenderIterator fIter; public: hsRAMStream(); - hsRAMStream(UInt32 chunkSize); + 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 *, const wchar *) { 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 hsBool AtEnd(); - virtual UInt32 Read(UInt32 byteCount, void * buffer); - virtual UInt32 Write(UInt32 byteCount, const void* buffer); - virtual void Skip(UInt32 deltaByteCount); + 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 UInt32 GetEOF(); + virtual uint32_t GetEOF(); virtual void CopyToMem(void* mem); void Reset(); // clears the buffers @@ -435,16 +407,16 @@ class hsNullStream : public hsStream { public: virtual hsBool Open(const char *, const char *) { return true; } - virtual hsBool Open(const wchar *, const wchar *) { return true; } + virtual hsBool Open(const wchar_t *, const wchar_t *) { return true; } virtual hsBool Close() { return true; } - virtual UInt32 Read(UInt32 byteCount, void * buffer); // throw's exception - virtual UInt32 Write(UInt32 byteCount, const void* buffer); - virtual void Skip(UInt32 deltaByteCount); + 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(); - UInt32 GetBytesWritten() const { return fBytesRead; } + uint32_t GetBytesWritten() const { return fBytesRead; } void Reset( ) { fBytesRead = 0; } }; @@ -460,16 +432,16 @@ public: 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 *, const wchar *) { 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 UInt32 Read(UInt32 byteCount, void * buffer); - virtual UInt32 Write(UInt32 byteCount, const void* buffer); // throws exception - virtual void Skip(UInt32 deltaByteCount); + 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 UInt32 GetBytesRead() const { return fBytesRead; } - virtual UInt32 GetEOF() { return (UInt32)(fStop-fStart); } + virtual uint32_t GetBytesRead() const { return fBytesRead; } + virtual uint32_t GetEOF() { return (uint32_t)(fStop-fStart); } virtual void CopyToMem(void* mem); }; @@ -480,61 +452,61 @@ public: hsWriteOnlyStream() {} virtual hsBool Open(const char *, const char *) { hsAssert(0, "hsWriteOnlyStream::Open NotImplemented"); return false; } - virtual hsBool Open(const wchar *, const wchar *) { 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 UInt32 Read(UInt32 byteCount, void * buffer); // throws exception - virtual UInt32 Write(UInt32 byteCount, const void* buffer); - virtual UInt32 GetBytesRead() const { return 0; } - virtual UInt32 GetBytesWritten() const { return fBytesRead; } + 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; } + virtual uint32_t GetBytesWritten() const { return fBytesRead; } }; // circular queue stream class hsQueueStream : public hsStream { private: char* fQueue; - UInt32 fReadCursor; - UInt32 fWriteCursor; - UInt32 fSize; + uint32_t fReadCursor; + uint32_t fWriteCursor; + uint32_t fSize; public: - hsQueueStream(Int32 size); + hsQueueStream(int32_t size); ~hsQueueStream(); virtual hsBool Open(const char *, const char *) { hsAssert(0, "hsQueueStream::Open NotImplemented"); return false; } - virtual hsBool Open(const wchar *, const wchar *) { 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 UInt32 Read(UInt32 byteCount, void * buffer); - virtual UInt32 Write(UInt32 byteCount, const void* buffer); - virtual void Skip(UInt32 deltaByteCount); + 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(); - UInt32 GetSize() { return fSize; } + uint32_t GetSize() { return fSize; } const char* GetQueue() { return fQueue; } - UInt32 GetReadCursor() { return fReadCursor; } - UInt32 GetWriteCursor() { return fWriteCursor; } + uint32_t GetReadCursor() { return fReadCursor; } + uint32_t GetWriteCursor() { return fWriteCursor; } }; class hsBufferedStream : public hsStream { FILE* fRef; - UInt32 fFileSize; + uint32_t fFileSize; enum { kBufferSize = 2*1024 }; char fBuffer[kBufferSize]; // If the buffer is empty, this is zero. Otherwise it is the size of the // buffer (if we read a full block), or something less than that if we read // a partial block at the end of the file. - UInt32 fBufferLen; + uint32_t fBufferLen; hsBool fWriteBufferUsed; #ifdef HS_DEBUGGING // For doing statistics on how efficient we are int fBufferHits, fBufferMisses; - UInt32 fBufferReadIn, fBufferReadOut, fReadDirect, fLastReadPos; + uint32_t fBufferReadIn, fBufferReadOut, fReadDirect, fLastReadPos; char* fFilename; const char* fCloseReason; #endif @@ -544,16 +516,16 @@ public: virtual ~hsBufferedStream(); virtual hsBool Open(const char* name, const char* mode = "rb"); - virtual hsBool Open(const wchar* name, const wchar* mode = L"rb"); + virtual hsBool Open(const wchar_t* name, const wchar_t* mode = L"rb"); virtual hsBool Close(); virtual hsBool AtEnd(); - virtual UInt32 Read(UInt32 byteCount, void* buffer); - virtual UInt32 Write(UInt32 byteCount, const void* buffer); - virtual void Skip(UInt32 deltaByteCount); + 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 UInt32 GetEOF(); + virtual uint32_t GetEOF(); FILE* GetFileRef(); void SetFileRef(FILE* file); diff --git a/Sources/Plasma/CoreLib/hsStringTokenizer.cpp b/Sources/Plasma/CoreLib/hsStringTokenizer.cpp index b219d542..cb7becbc 100644 --- a/Sources/Plasma/CoreLib/hsStringTokenizer.cpp +++ b/Sources/Plasma/CoreLib/hsStringTokenizer.cpp @@ -42,7 +42,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // hsStringTokenizer.cpp #include "hsStringTokenizer.h" -#include "hsUtils.h" + // String Tokenizer routines hsStringTokenizer::hsStringTokenizer(const char *string, const char *seps) : @@ -72,7 +72,7 @@ inline hsBool hsStringTokenizer::IsSep(char c) { if ( fCheckAlphaNum || !isalnum(c) ) { - for (Int32 i=0; i @@ -58,7 +58,7 @@ private: char *fLastTerminator; char fLastRep; - Int32 fNumSeps; + int32_t fNumSeps; hsBool fQAsTok; hsBool fInQuote; hsBool fCheckAlphaNum; @@ -66,7 +66,7 @@ public: hsStringTokenizer(const char *string=nil, const char *seps=nil); ~hsStringTokenizer(); char *next(); - hsBool Next( char *token, UInt32 maxTokLen ); + hsBool Next( char *token, uint32_t maxTokLen ); hsBool HasMoreTokens(); void Reset(const char *string, const char *seps); void ParseQuotes(hsBool qAsTok); @@ -84,32 +84,32 @@ private: class hsWStringTokenizer { private: - wchar *fSeps; - wchar *fTok; - wchar *fLastTerminator; - wchar fLastRep; + wchar_t *fSeps; + wchar_t *fTok; + wchar_t *fLastTerminator; + wchar_t fLastRep; - Int32 fNumSeps; + int32_t fNumSeps; hsBool fQAsTok; hsBool fInQuote; hsBool fCheckAlphaNum; public: - hsWStringTokenizer(const wchar *string=nil, const wchar *seps=nil); + hsWStringTokenizer(const wchar_t *string=nil, const wchar_t *seps=nil); ~hsWStringTokenizer(); - wchar *next(); - hsBool Next( wchar *token, UInt32 maxTokLen ); + wchar_t *next(); + hsBool Next( wchar_t *token, uint32_t maxTokLen ); hsBool HasMoreTokens(); - void Reset(const wchar *string, const wchar *seps); + void Reset(const wchar_t *string, const wchar_t *seps); void ParseQuotes(hsBool qAsTok); - wchar *GetRestOfString( void ) const { return fTok; } + wchar_t *GetRestOfString( void ) const { return fTok; } - wchar *fString; + wchar_t *fString; void RestoreLastTerminator( void ); private: - hsBool IsSep(wchar c); + hsBool IsSep(wchar_t c); }; #endif // _hsStringTokenizer_Included_ diff --git a/Sources/Plasma/CoreLib/hsTempPointer.h b/Sources/Plasma/CoreLib/hsTempPointer.h deleted file mode 100644 index a7eadcd8..00000000 --- a/Sources/Plasma/CoreLib/hsTempPointer.h +++ /dev/null @@ -1,174 +0,0 @@ -/*==LICENSE==* - -CyanWorlds.com Engine - MMOG client, server and tools -Copyright (C) 2011 Cyan Worlds, Inc. - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . - -Additional permissions under GNU GPL version 3 section 7 - -If you modify this Program, or any covered work, by linking or -combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK, -NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent -JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK -(or a modified version of those libraries), -containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA, -PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG -JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the -licensors of this Program grant you additional -permission to convey the resulting work. Corresponding Source for a -non-source form of such a combination shall include the source code for -the parts of OpenSSL and IJG JPEG Library used as well as that of the covered -work. - -You can contact Cyan Worlds, Inc. by email legal@cyan.com - or by snail mail at: - Cyan Worlds, Inc. - 14617 N Newport Hwy - Mead, WA 99021 - -*==LICENSE==*/ - -#ifndef hsTempPointer_inc -#define hsTempPointer_inc - -#include "hsMemory.h" -#include "hsExceptions.h" - -template class hsTempPointer { -private: - T** fArray; - - UInt32 fCurrBlock; - UInt32 fNumBlockAlloc; - - UInt32 fCurrElem; - UInt32 fNumElemAlloc; - - UInt32 fGrowBy; // def = 0, to double - UInt32 fMinSize; // def = 1 - - hsTempPointer& operator=(const hsTempPointer&); - - void IConsolidate(); - void IGrow(); - -public: - hsTempPointer(UInt32 minSize = 1, UInt32 growBy = 0); - ~hsTempPointer(); - - void Reset(); - - T* Next(); - T* Array(int n); -}; - -template -hsTempPointer::~hsTempPointer() -{ - int i; - for( i = 0; i <= fCurrBlock; i++ ) - delete [] fArray[i]; - delete [] fArray; -} - -template -hsTempPointer::hsTempPointer(UInt32 minSize, UInt32 growBy) -{ - fGrowBy = growBy; - fMinSize = minSize; - - fArray = TRACKED_NEW T*[2]; - fNumBlockAlloc = 2; - fCurrBlock = 0; - - fArray[fCurrBlock] = TRACKED_NEW T[fMinSize]; - fNumElemAlloc = minSize; - - fCurrElem = 0; -} - - -template -void hsTempPointer::IConsolidate() -{ - hsAssert(fCurrBlock > 0, "Shouldn't consolidate when nothing to do"); - - UInt32 numUsed = fCurrBlock * fNumElemAlloc + fCurrElem; - - UInt32 newSize = fNumElemAlloc; - if( !fGrowBy ) - { - while( newSize <= numUsed ) - newSize <<= 1; - } - else - { - while( newSize <= numUsed ) - newSize += fGrowBy; - } - int i; - for( i = 0; i <= fCurrBlock; i++ ) - delete [] fArray[i]; - - fArray[0] = TRACKED_NEW T[newSize]; - fNumElemAlloc = newSize; - fCurrElem = 0; - fCurrBlock = 0; -} - -template -void hsTempPointer::IGrow() -{ - if( ++fCurrBlock >= fNumBlockAlloc ) - { - T** newBlockArray = TRACKED_NEW T*[fNumBlockAlloc <<= 1]; - HSMemory::BlockMove(fArray, newBlockArray, fCurrBlock * sizeof(*fArray)); - delete [] fArray; - fArray = newBlockArray; - } - fArray[fCurrBlock] = TRACKED_NEW T[fNumElemAlloc]; - fCurrElem = 0; - -} - -template -T* hsTempPointer::Next() -{ - if( fCurrElem >= fNumElemAlloc ) - IGrow(); - return fArray[fCurrBlock] + fCurrElem++; -} - -template -T* hsTempPointer::Array(int n) -{ - // minSize (on constructor) should be greater than max n - hsDebugCode(hsThrowIfBadParam((UInt32)n > (UInt32)fNumElemAlloc);) - if( fCurrElem + n >= fNumElemAlloc ) - IGrow(); - int idx = fCurrElem; - fCurrElem += n; - return fArray[fCurrBlock] + idx; -} - -template -void hsTempPointer::Reset() -{ - if( fCurrBlock > 0 ) - IConsolidate(); - fCurrElem = 0; -} - -#endif // hsTempPointer_inc diff --git a/Sources/Plasma/CoreLib/hsTemplates.cpp b/Sources/Plasma/CoreLib/hsTemplates.cpp index 0a40a309..65218fef 100644 --- a/Sources/Plasma/CoreLib/hsTemplates.cpp +++ b/Sources/Plasma/CoreLib/hsTemplates.cpp @@ -40,7 +40,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ #include "hsTemplates.h" -#include "hsUtils.h" + //////////////////////////////////////////////////////////////////////////////// @@ -83,8 +83,8 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com hsDlistNode *hsDlistNode::fpFirst=0; hsDlistNode *hsDlistNode::fpLast=0; -UInt32 hsDlistNode::fcreated=0; -UInt32 hsDlistNode::fdestroyed=0; +uint32_t hsDlistNode::fcreated=0; +uint32_t hsDlistNode::fdestroyed=0; static int NodeKnt = 0; void RemoveNode(void *pthing) @@ -261,7 +261,7 @@ int hsTArrayBase::GetSizeOf(void) { return 0; } hsTArrayBase::hsTArrayBase():fUseCount(0), fTotalCount(0) { - self = TRACKED_NEW hsDlistNode(this); + self = new hsDlistNode(this); } hsTArrayBase::~hsTArrayBase() @@ -280,7 +280,7 @@ int hsLargeArrayBase::GetSizeOf(void) { return 0; } hsLargeArrayBase::hsLargeArrayBase():fUseCount(0), fTotalCount(0) { - self = TRACKED_NEW hsDlistNode(this); + self = new hsDlistNode(this); } hsLargeArrayBase::~hsLargeArrayBase() @@ -302,7 +302,7 @@ void LargeArrayStats() {} -void hsTArrayBase::GrowArraySize(UInt16 newCount) +void hsTArrayBase::GrowArraySize(uint16_t newCount) { #if 1 if (newCount < 8) @@ -321,7 +321,7 @@ void hsTArrayBase::GrowArraySize(UInt16 newCount) #endif } -void hsLargeArrayBase::GrowArraySize(UInt32 newCount) +void hsLargeArrayBase::GrowArraySize(uint32_t newCount) { #if 1 if (newCount < 8) diff --git a/Sources/Plasma/CoreLib/hsTemplates.h b/Sources/Plasma/CoreLib/hsTemplates.h index f3fb29b3..f178429b 100644 --- a/Sources/Plasma/CoreLib/hsTemplates.h +++ b/Sources/Plasma/CoreLib/hsTemplates.h @@ -45,7 +45,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "hsExceptions.h" #include "hsMemory.h" #include "hsRefCnt.h" -#include "hsUtils.h" + #include @@ -62,8 +62,8 @@ class hsDlistNode public: static hsDlistNode *fpFirst; static hsDlistNode *fpLast; - static UInt32 fcreated; - static UInt32 fdestroyed; + static uint32_t fcreated; + static uint32_t fdestroyed; void *fpThing; hsDlistNode *fpPrev; @@ -127,13 +127,13 @@ public: // Use this for an array of objects of class T allocated with new[] template class hsTempArray { T* fArray; - UInt32 fCount; + uint32_t fCount; hsTempArray& operator=(const hsTempArray&); public: - hsTempArray(long count) : fArray(TRACKED_NEW T[count]), fCount(count) + hsTempArray(long count) : fArray(new T[count]), fCount(count) { } - hsTempArray(long count, T initValue) : fArray(TRACKED_NEW T[count]), fCount(count) + hsTempArray(long count, T initValue) : fArray(new T[count]), fCount(count) { for (int i = 0; i < count; i++) fArray[i] = initValue; @@ -151,12 +151,12 @@ public: operator T*() const { return fArray; } T* GetArray() const { return fArray; } - void Accomodate(UInt32 count) + void Accomodate(uint32_t count) { if (count > fCount) { delete[] fArray; fCount = count; - fArray = TRACKED_NEW T[count]; + fArray = new T[count]; } } }; @@ -224,29 +224,29 @@ public: template class hsDynamicArray { private: - Int32 fCount; + int32_t fCount; T* fArray; hsDynamicArray& operator=(const hsDynamicArray&); // don't allow assignment public: enum { kMissingIndex = -1 }; - hsDynamicArray(Int32 count = 0); + hsDynamicArray(int32_t count = 0); virtual ~hsDynamicArray(); - Int32 GetCount() const { return fCount; } + int32_t GetCount() const { return fCount; } hsBool IsEmpty() const { return fCount == 0; } - const T& Get(Int32 index) const; - Int32 Get(Int32 index, Int32 count, T data[]) const; - Int32 Find(const T&) const; // returns kMissingIndex if not found - - void SetCount(Int32 count); - T& operator[]( Int32 index ); - Int32 Append(const T&); - Int32 InsertAtIndex(UInt32 index, const T& obj); - Int32 Push(const T&); - Int32 Pop(T*); - void Remove(Int32); + 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 ); + 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 T* AcquireArray() { return fArray; } @@ -254,9 +254,9 @@ public: void ReleaseArray(T*) {} hsDynamicArray* Copy(hsDynamicArray* dst = nil) const; - T* ForEach(Boolean (*proc)(T&)); - T* ForEach(Boolean (*proc)(T&, void* p1), void* p1); - T* ForEach(Boolean (*proc)(T&, void* p1, void* p2), void* p1, void* p2); + 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); }; // Use this for block of memory allocated with HSMemory::New() @@ -274,12 +274,12 @@ public: template - hsDynamicArray::hsDynamicArray(Int32 count) + hsDynamicArray::hsDynamicArray(int32_t count) { fCount = count; fArray = nil; if (count) - fArray = TRACKED_NEW T[ count ]; + fArray = new T[ count ]; } template @@ -289,13 +289,13 @@ hsDynamicArray::~hsDynamicArray() } template -void hsDynamicArray::SetCount(Int32 count) +void hsDynamicArray::SetCount(int32_t count) { if (fCount != count) { if (count == 0) this->Reset(); else - { T* newArray = TRACKED_NEW T[count]; + { T* newArray = new T[count]; if (fArray) { int copyCount = hsMinimum(count, fCount); @@ -310,26 +310,26 @@ void hsDynamicArray::SetCount(Int32 count) } } -template T& hsDynamicArray::operator[]( Int32 index ) +template T& hsDynamicArray::operator[]( int32_t index ) { - hsDebugCode(hsThrowIfBadParam((UInt32)index >= (UInt32)fCount);) + hsDebugCode(hsThrowIfBadParam((uint32_t)index >= (uint32_t)fCount);) return fArray[index]; } -template const T& hsDynamicArray::Get( Int32 index ) const +template const T& hsDynamicArray::Get( int32_t index ) const { - hsDebugCode(hsThrowIfBadParam((UInt32)index >= (UInt32)fCount);) + hsDebugCode(hsThrowIfBadParam((uint32_t)index >= (uint32_t)fCount);) return fArray[index]; } template -Int32 hsDynamicArray::Get(Int32 index, Int32 count, T data[]) const +int32_t hsDynamicArray::Get(int32_t index, int32_t count, T data[]) const { if (count > 0) { hsThrowIfNilParam(data); - hsThrowIfBadParam((UInt32)index >= fCount); + hsThrowIfBadParam((uint32_t)index >= fCount); if (index + count > fCount) count = fCount - index; @@ -340,7 +340,7 @@ Int32 hsDynamicArray::Get(Int32 index, Int32 count, T data[]) const } template -Int32 hsDynamicArray::Find(const T& obj) const +int32_t hsDynamicArray::Find(const T& obj) const { for (int i = 0; i < fCount; i++) if (fArray[i] == obj) @@ -349,16 +349,16 @@ Int32 hsDynamicArray::Find(const T& obj) const } template -void hsDynamicArray::Remove(Int32 index) +void hsDynamicArray::Remove(int32_t index) { - hsThrowIfBadParam((UInt32)index >= (UInt32)fCount); + hsThrowIfBadParam((uint32_t)index >= (uint32_t)fCount); T rVal = fArray[index]; if (--fCount > 0) { int i; - T* newList = TRACKED_NEW T[fCount]; + T* newList = new T[fCount]; for(i = 0 ; i < index;i++) newList[i] = fArray[i]; for (i = index; i < fCount; i++) @@ -373,7 +373,7 @@ void hsDynamicArray::Remove(Int32 index) } template -Int32 hsDynamicArray::Pop(T *obj) +int32_t hsDynamicArray::Pop(T *obj) { hsThrowIfBadParam(this->IsEmpty()); @@ -384,11 +384,11 @@ Int32 hsDynamicArray::Pop(T *obj) template -Int32 hsDynamicArray::Push(const T& obj) +int32_t hsDynamicArray::Push(const T& obj) { if (fArray) { - T* newList = TRACKED_NEW T[fCount+1]; + T* newList = new T[fCount+1]; for(int i = 0 ; i < fCount; i++) newList[i+1] = fArray[i]; newList[0] = obj; @@ -397,17 +397,17 @@ Int32 hsDynamicArray::Push(const T& obj) } else { hsAssert(fCount == 0, "mismatch"); - fArray = TRACKED_NEW T[1]; + fArray = new T[1]; fArray[0] = obj; } return ++fCount; } template -Int32 hsDynamicArray::Append(const T& obj) +int32_t hsDynamicArray::Append(const T& obj) { if (fArray) - { T* newList = TRACKED_NEW T[fCount + 1]; + { T* newList = new T[fCount + 1]; for (int i = 0; i < fCount; i++) newList[i] = fArray[i]; @@ -417,7 +417,7 @@ Int32 hsDynamicArray::Append(const T& obj) } else { hsAssert(fCount == 0, "mismatch"); - fArray = TRACKED_NEW T[1]; + fArray = new T[1]; fArray[0] = obj; } return ++fCount; @@ -425,17 +425,17 @@ Int32 hsDynamicArray::Append(const T& obj) template -Int32 hsDynamicArray::InsertAtIndex(UInt32 index, const T& obj) +int32_t hsDynamicArray::InsertAtIndex(uint32_t index, const T& obj) { if (fArray) { - hsAssert(UInt32(fCount) >= index, "Index too large for array"); - T* newList = TRACKED_NEW T[fCount + 1]; + hsAssert(uint32_t(fCount) >= index, "Index too large for array"); + T* newList = new T[fCount + 1]; unsigned i; for ( i = 0; i < index; i++) newList[i] = fArray[i]; newList[index] = obj; - for ( i = index; i < UInt32(fCount); i++) + for ( i = index; i < uint32_t(fCount); i++) newList[i+1] = fArray[i]; delete [] fArray; @@ -445,7 +445,7 @@ Int32 hsDynamicArray::InsertAtIndex(UInt32 index, const T& obj) { hsAssert(fCount == 0, "mismatch"); hsAssert(index ==0,"Can't insert at non zero index in empty array"); - fArray = TRACKED_NEW T[1]; + fArray = new T[1]; fArray[0] = obj; } return ++fCount; @@ -464,7 +464,7 @@ template hsDynamicArray* hsDynamicArray::Copy(hsDynamicArray* dst) const { if (dst == nil) - dst = TRACKED_NEW hsDynamicArray; + dst = new hsDynamicArray; else dst->Reset(); @@ -475,7 +475,7 @@ hsDynamicArray* hsDynamicArray::Copy(hsDynamicArray* dst) const return dst; } -template T* hsDynamicArray::ForEach(Boolean (*proc)(T&)) +template T* hsDynamicArray::ForEach(bool (*proc)(T&)) { for (int i = 0; i < fCount; i++) if (proc(fArray[i])) @@ -483,7 +483,7 @@ template T* hsDynamicArray::ForEach(Boolean (*proc)(T&)) return nil; } -template T* hsDynamicArray::ForEach(Boolean (*proc)(T&, void* p1), void * p1) +template T* hsDynamicArray::ForEach(bool (*proc)(T&, void* p1), void * p1) { for (int i = 0; i < fCount; i++) if (proc(fArray[i], p1)) @@ -491,7 +491,7 @@ template T* hsDynamicArray::ForEach(Boolean (*proc)(T&, void* p1), return nil; } -template T* hsDynamicArray::ForEach(Boolean (*proc)(T&, void* p1, void* p2), void *p1, void *p2) +template T* hsDynamicArray::ForEach(bool (*proc)(T&, void* p1, void* p2), void *p1, void *p2) { for (int i = 0; i < fCount; i++) if (proc(fArray[i], p1, p2)) @@ -504,10 +504,10 @@ template T* hsDynamicArray::ForEach(Boolean (*proc)(T&, void* p1, v class hsTArrayBase { protected: - UInt16 fUseCount; - UInt16 fTotalCount; + uint16_t fUseCount; + uint16_t fTotalCount; - void GrowArraySize(UInt16 nSize); + void GrowArraySize(uint16_t nSize); #ifdef HS_DEBUGTARRAY hsTArrayBase(); @@ -521,7 +521,7 @@ protected: #endif public: - UInt16 GetNumAlloc() const { return fTotalCount; } + uint16_t GetNumAlloc() const { return fTotalCount; } }; template void hsTArray_CopyForward(const T src[], T dst[], int count); @@ -659,7 +659,7 @@ template hsTArray::hsTArray(int count) : fArray(nil) hsTArray_ValidateCount(count); fUseCount = fTotalCount = count; if (count > 0) - fArray = TRACKED_NEW T[count]; + fArray = new T[count]; } template hsTArray::hsTArray(const hsTArray& src) : fArray(nil) @@ -669,7 +669,7 @@ template hsTArray::hsTArray(const hsTArray& src) : fArray(nil) if (count > 0) { - fArray = TRACKED_NEW T[count]; + fArray = new T[count]; hsTArray_CopyForward(src.fArray, fArray, count); } } @@ -708,7 +708,7 @@ bool hsTArray::operator==(const hsTArray& src) const template void hsTArray::Swap( hsTArray& src ) { - UInt16 use, tot; + uint16_t use, tot; T *array; @@ -759,7 +759,7 @@ template void hsTArray::SetCount(int count) { if (fArray) delete[] fArray; - fArray = TRACKED_NEW T[count]; + fArray = new T[count]; fUseCount = fTotalCount = count; } fUseCount = count; @@ -770,7 +770,7 @@ template void hsTArray::Expand(int NewCount) // New Count is Absolu hsTArray_ValidateCount(NewCount); if (NewCount > fTotalCount) // This is Expand not Shrink { - T* newArray = TRACKED_NEW T[NewCount]; + T* newArray = new T[NewCount]; if (fArray != nil) { hsTArray_CopyForward(fArray, newArray, fUseCount); @@ -846,7 +846,7 @@ template void hsTArray::IncCount(int index, int count) fTotalCount = newCount; GrowArraySize(newCount); // Sets new fTotalCount - T* newArray = TRACKED_NEW T[fTotalCount]; + T* newArray = new T[fTotalCount]; if (fArray != nil) { hsTArray_CopyForward(fArray, newArray, index); @@ -903,10 +903,10 @@ template T* hsTArray::ForEach(hsBool (*proc)(T&, void* p1, void* p2 class hsLargeArrayBase { protected: - UInt32 fUseCount; - UInt32 fTotalCount; + uint32_t fUseCount; + uint32_t fTotalCount; - void GrowArraySize(UInt32 nSize); + void GrowArraySize(uint32_t nSize); #ifdef HS_DEBUGTARRAY hsLargeArrayBase(); @@ -920,7 +920,7 @@ protected: #endif public: - UInt32 GetNumAlloc() const { return fTotalCount; } + uint32_t GetNumAlloc() const { return fTotalCount; } }; @@ -1056,7 +1056,7 @@ template hsLargeArray::hsLargeArray(int count) : fArray(nil) hsLargeArray_ValidateCount(count); fUseCount = fTotalCount = count; if (count > 0) - fArray = TRACKED_NEW T[count]; + fArray = new T[count]; } template hsLargeArray::hsLargeArray(const hsLargeArray& src) : fArray(nil) @@ -1066,7 +1066,7 @@ template hsLargeArray::hsLargeArray(const hsLargeArray& src) : f if (count > 0) { - fArray = TRACKED_NEW T[count]; + fArray = new T[count]; hsLargeArray_CopyForward(src.fArray, fArray, count); } } @@ -1081,7 +1081,7 @@ template hsLargeArray& hsLargeArray::operator=(const hsLargeArra template void hsLargeArray::Swap( hsLargeArray& src ) { - UInt32 use, tot; + uint32_t use, tot; T *array; @@ -1128,7 +1128,7 @@ template void hsLargeArray::SetCount(int count) { if (fArray) delete[] fArray; - fArray = TRACKED_NEW T[count]; + fArray = new T[count]; fUseCount = fTotalCount = count; } fUseCount = count; @@ -1139,7 +1139,7 @@ template void hsLargeArray::Expand(int NewCount) // New Count is Ab hsLargeArray_ValidateCount(NewCount); if (NewCount > fTotalCount) // This is Expand not Shrink { - T* newArray = TRACKED_NEW T[NewCount]; + T* newArray = new T[NewCount]; if (fArray != nil) { hsLargeArray_CopyForward(fArray, newArray, fUseCount); @@ -1215,7 +1215,7 @@ template void hsLargeArray::IncCount(int index, int count) fTotalCount = newCount; GrowArraySize(newCount); // Sets new fTotalCount - T* newArray = TRACKED_NEW T[fTotalCount]; + T* newArray = new T[fTotalCount]; if (fArray != nil) { hsLargeArray_CopyForward(fArray, newArray, index); diff --git a/Sources/Plasma/CoreLib/hsThread.cpp b/Sources/Plasma/CoreLib/hsThread.cpp index 3db0ff7f..fe3cf8fa 100644 --- a/Sources/Plasma/CoreLib/hsThread.cpp +++ b/Sources/Plasma/CoreLib/hsThread.cpp @@ -43,7 +43,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #define CoreLib_Thread #include "hsThread.h" -#include "hsUtils.h" + ////////////////////////////////////////////////////////////////////////////// diff --git a/Sources/Plasma/CoreLib/hsThread.h b/Sources/Plasma/CoreLib/hsThread.h index 0997faf6..02f36a6a 100644 --- a/Sources/Plasma/CoreLib/hsThread.h +++ b/Sources/Plasma/CoreLib/hsThread.h @@ -42,14 +42,12 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #ifndef hsThread_Defined #define hsThread_Defined -#include "hsTypes.h" +#include "HeadSpin.h" -typedef UInt32 hsMilliseconds; +typedef uint32_t hsMilliseconds; -#if HS_BUILD_FOR_WIN32 - #include "hsWindows.h" -#elif HS_BUILD_FOR_UNIX +#ifdef HS_BUILD_FOR_UNIX #include #include // We can't wait with a timeout with semas @@ -71,7 +69,7 @@ public: #endif private: hsBool fQuit; - UInt32 fStackSize; + uint32_t fStackSize; #if HS_BUILD_FOR_WIN32 ThreadId fThreadId; HANDLE fThreadH; @@ -85,7 +83,7 @@ protected: hsBool GetQuit() const { return hsBool(fQuit); } void SetQuit(hsBool value) { fQuit = value; } public: - hsThread(UInt32 stackSize = 0); + hsThread(uint32_t stackSize = 0); virtual ~hsThread(); // calls Stop() #if HS_BUILD_FOR_WIN32 ThreadId GetThreadId() { return fThreadId; } @@ -155,7 +153,7 @@ class hsSemaphore { #else pthread_mutex_t fPMutex; pthread_cond_t fPCond; - Int32 fCounter; + int32_t fCounter; #endif #endif public: @@ -200,10 +198,10 @@ class hsSleep { public: #if HS_BUILD_FOR_UNIX - static void Sleep(UInt32 millis); + static void Sleep(uint32_t millis); #elif HS_BUILD_FOR_WIN32 - static void Sleep(UInt32 millis) { ::Sleep(millis); } + static void Sleep(uint32_t millis) { ::Sleep(millis); } #endif }; diff --git a/Sources/Plasma/CoreLib/hsThread_Mac.cpp b/Sources/Plasma/CoreLib/hsThread_Mac.cpp index 3a6e5c06..e4b3069b 100644 --- a/Sources/Plasma/CoreLib/hsThread_Mac.cpp +++ b/Sources/Plasma/CoreLib/hsThread_Mac.cpp @@ -49,7 +49,7 @@ extern "C" { } } -hsThread::hsThread(UInt32 stackSize) : fTaskId(0), fStackSize(stackSize), fQuit(false) +hsThread::hsThread(uint32_t stackSize) : fTaskId(0), fStackSize(stackSize), fQuit(false) { if (MPLibraryIsLoaded() == false) throw "MPLibraryIsLoaded() returned false"; diff --git a/Sources/Plasma/CoreLib/hsThread_Unix.cpp b/Sources/Plasma/CoreLib/hsThread_Unix.cpp index bc707c3b..8a25586b 100644 --- a/Sources/Plasma/CoreLib/hsThread_Unix.cpp +++ b/Sources/Plasma/CoreLib/hsThread_Unix.cpp @@ -79,9 +79,9 @@ extern "C" { } } -#define kInvalidStackSize UInt32(~0) +#define kInvalidStackSize uint32_t(~0) -hsThread::hsThread(UInt32 stackSize) : fStackSize(stackSize), fQuit(false) +hsThread::hsThread(uint32_t stackSize) : fStackSize(stackSize), fQuit(false) { fIsValid = false; pthread_mutex_init(&fMutex,nil); @@ -541,9 +541,9 @@ void hsEvent::Signal() #endif -void hsSleep::Sleep(UInt32 millis) +void hsSleep::Sleep(uint32_t millis) { - UInt32 secs = millis / 1000; + uint32_t secs = millis / 1000; if (secs > 0) { millis %= 1000; diff --git a/Sources/Plasma/CoreLib/hsThread_Win.cpp b/Sources/Plasma/CoreLib/hsThread_Win.cpp index fd37f976..53592484 100644 --- a/Sources/Plasma/CoreLib/hsThread_Win.cpp +++ b/Sources/Plasma/CoreLib/hsThread_Win.cpp @@ -58,7 +58,7 @@ static unsigned int __stdcall gEntryPointBT(void* param) return ((hsThread*)param)->WinRun(); } -hsThread::hsThread(UInt32 stackSize) : fStackSize(stackSize), fQuit(false), fThreadH(nil), fQuitSemaH(nil) +hsThread::hsThread(uint32_t stackSize) : fStackSize(stackSize), fQuit(false), fThreadH(nil), fQuitSemaH(nil) { } diff --git a/Sources/Plasma/CoreLib/hsTypes.h b/Sources/Plasma/CoreLib/hsTypes.h index d0f920ca..961cdd28 100644 --- a/Sources/Plasma/CoreLib/hsTypes.h +++ b/Sources/Plasma/CoreLib/hsTypes.h @@ -39,19 +39,17 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com Mead, WA 99021 *==LICENSE==*/ -#include "HeadSpin.h" -#ifndef hsTypes_Defined -#define hsTypes_Defined +#ifdef _HSTYPES_H +# error "Do not include hsTypes.h directly--use HeadSpin.h" +#endif // _HSTYPES_H +#define _HSTYPES_H /************************** Other Includes *****************************/ #include #include - -#if HS_CAN_USE_FLOAT - #include -#endif +#include /************************** Basic Macros *****************************/ @@ -62,63 +60,38 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #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 *****************************/ -#ifdef _MSC_VER - typedef signed __int8 int8_t; - typedef unsigned __int8 uint8_t; - typedef signed __int16 int16_t; - typedef unsigned __int16 uint16_t; - typedef signed __int32 int32_t; - typedef unsigned __int32 uint32_t; - typedef signed __int64 int64_t; - typedef unsigned __int64 uint64_t; +#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 #endif -typedef uint8_t byte; -typedef uint16_t word; -typedef uint32_t dword; -typedef uint64_t qword; - -typedef uintptr_t unsigned_ptr; - -typedef wchar_t wchar; - #define kPosInfinity16 (32767) #define kNegInfinity16 (-32768) #define kPosInfinity32 (0x7fffffff) #define kNegInfinity32 (0x80000000) -typedef int8_t Int8; -typedef int16_t Int16; -typedef int32_t Int32; -typedef int64_t Int64; - -typedef uint8_t UInt8; -typedef uint16_t UInt16; -typedef uint32_t UInt32; -typedef uint64_t UInt64; - -#ifndef Byte - typedef uint8_t Byte; -#endif - -#ifndef false - #define false 0 +#ifndef M_PI +# define M_PI 3.14159265358979323846 #endif -#ifndef true - #define true 1 -#endif -#ifndef Boolean - typedef uint8_t Boolean; -#endif - - -typedef Int32 hsFixed; -typedef Int32 hsFract; #ifdef __cplusplus @@ -126,18 +99,12 @@ typedef int hsBool; #endif -#include "hsScalar.h" - -#if HS_CAN_USE_FLOAT - #define HS_PI 3.1415927 -#endif - #ifndef nil #define nil (0) #endif -typedef Int32 hsError; -typedef UInt32 hsGSeedValue; +typedef int32_t hsError; +typedef uint32_t hsGSeedValue; #define hsOK 0 #define hsFail -1 @@ -153,24 +120,23 @@ typedef UInt32 hsGSeedValue; #define hsBitTst2Bool(value, mask) (((value) & (mask)) != 0) -#define hsFourByteTag(a, b, c, d) (((UInt32)(a) << 24) | ((UInt32)(b) << 16) | ((UInt32)(c) << 8) | (d)) +#define hsFourByteTag(a, b, c, d) (((uint32_t)(a) << 24) | ((uint32_t)(b) << 16) | ((uint32_t)(c) << 8) | (d)) /************************** Swap Macros *****************************/ -#ifdef __cplusplus - inline UInt16 hsSwapEndian16(UInt16 value) + inline uint16_t hsSwapEndian16(uint16_t value) { return (value >> 8) | (value << 8); } - inline UInt32 hsSwapEndian32(UInt32 value) + inline uint32_t hsSwapEndian32(uint32_t value) { return ((value) << 24) | ((value & 0x0000ff00) << 8) | ((value & 0x00ff0000) >> 8) | ((value) >> 24); } - inline UInt64 hsSwapEndian64(UInt64 value) + inline uint64_t hsSwapEndian64(uint64_t value) { return ((value) << 56) | ((value & 0x000000000000ff00) << 40) | @@ -181,20 +147,18 @@ typedef UInt32 hsGSeedValue; ((value & 0x00ff000000000000) >> 40) | ((value) >> 56); } - #if HS_CAN_USE_FLOAT inline float hsSwapEndianFloat(float fvalue) { - UInt32 value = *(UInt32*)&fvalue; + uint32_t value = *(uint32_t*)&fvalue; value = hsSwapEndian32(value); return *(float*)&value; } inline double hsSwapEndianDouble(double dvalue) { - UInt64 value = *(UInt64*)&dvalue; + uint64_t value = *(uint64_t*)&dvalue; value = hsSwapEndian64(value); return *(double*)&value; } - #endif #if LITTLE_ENDIAN #define hsToBE16(n) hsSwapEndian16(n) @@ -220,66 +184,53 @@ typedef UInt32 hsGSeedValue; #define hsToLEDouble(n) hsSwapEndianDouble(n) #endif - inline void hsSwap(Int32& a, Int32& b) + inline void hsSwap(int32_t& a, int32_t& b) { - Int32 c = a; + int32_t c = a; a = b; b = c; } - inline void hsSwap(UInt32& a, UInt32& b) + inline void hsSwap(uint32_t& a, uint32_t& b) { - UInt32 c = a; + uint32_t c = a; a = b; b = c; } - #if HS_CAN_USE_FLOAT inline void hsSwap(float& a, float& b) { float c = a; a = b; b = c; } - #endif -#endif /************************** Color32 Type *****************************/ struct hsColor32 { - UInt8 b, g, r, a; + uint8_t b, g, r, a; -#ifdef __cplusplus - void SetARGB(UInt8 aa, UInt8 rr, UInt8 gg, UInt8 bb) + 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 rr, UInt8 gg, UInt8 bb) + void Set(uint8_t rr, uint8_t gg, uint8_t bb) { this->r = rr; this->g = gg; this->b = bb; } - void Set(UInt8 aa, UInt8 rr, UInt8 gg, UInt8 bb) + void Set(uint8_t aa, uint8_t rr, uint8_t gg, uint8_t bb) { this->SetARGB(aa, rr, gg, bb); } -#if 0 - friend int operator==(const hsColor32& a, const hsColor32& b) - { - return *(UInt32*)&a == *(UInt32*)&b; - } - friend int operator!=(const hsColor32& a, const hsColor32& b) { return !(a == b); } -#else int operator==(const hsColor32& aa) const { - return *(UInt32*)&aa == *(UInt32*)this; + return *(uint32_t*)&aa == *(uint32_t*)this; } int operator!=(const hsColor32& aa) { return !(aa == *this); } -#endif -#endif }; hsCTypeDefStruct(hsColor32) @@ -298,7 +249,8 @@ typedef hsColor32 hsRGBAColor32; * ***/ -#if _MSC_VER >= 7 + +#ifdef _MSC_VER # define NULL_STMT __noop #else # define NULL_STMT ((void)0) @@ -427,23 +379,8 @@ void SWAP (T & a, T & b) { /**************************************************************************** * -* Calculate the address to the base of a structure given its type, and the -* address of a field within the structure. -* -* Example: -* -* CONTAINING_STRUCT(trans, INetTrans, m_trans); -* -***/ - -#define CONTAINING_STRUCT(a, t, f) ((t *) ((byte *)(a) - (unsigned_ptr)(&((t *)0)->f))) - - -/**************************************************************************** -* -* arrsize/marrsize +* arrsize * arrsize returns the number of elements in an array variable -* marrsize returns the number of elements in an array field in a structure * * Example: * @@ -452,54 +389,6 @@ void SWAP (T & a, T & b) { ***/ #define arrsize(a) (sizeof(a) / sizeof((a)[0])) -#define marrsize(c,a) (arrsize(((c *)0)->a)) - - -/**************************************************************************** -* -* offsetof/moffsetof -* offsetof returns the offset in bytes of a field inside a structure based on a type -* moffsetof returns the offset in bytes of a field inside a structure based on a variable -* -***/ - -#include - -#ifndef offsetof -#define offsetof(s,m) (size_t)&(((s *)0)->m) -#endif // ifndef offsetof - -#define moffsetof(v,f) (((byte *) &((v)->f)) - ((byte *) v)) - - -/**************************************************************************** -* -* msizeof -* Returns the size of a field in a structure -* -* Example: -* -* unsigned bufferSize = msizeof(CommandStruct, buffer); -* -***/ - -#define msizeof(c,a) (sizeof(((c *)0)->a)) - - -/**************************************************************************** -* -* ONCE -* Shortcut to create a 'for' loop that executes only once -* -* for (ONCE) { -* ... -* } -* -***/ - -#ifndef ONCE -#define ONCE bool UNIQUE_SYMBOL(ONCE) = true; UNIQUE_SYMBOL(ONCE); UNIQUE_SYMBOL(ONCE) = false -#endif /**************************************************************************** @@ -510,75 +399,6 @@ void SWAP (T & a, T & b) { #define IS_POW2(val) (!((val) & ((val) - 1))) - -/************************ Debug/Error Macros **************************/ - -#ifdef __cplusplus -extern "C" { -#endif - -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 CDECL ErrorAssert (int line, const char file[], const char fmt[], ...); -void CDECL ErrorFatal (int line, const char file[], const char fmt[], ...); -void ErrorMinimizeAppWindow (); - -enum EErrorOption { - kErrOptNonGuiAsserts, - kErrOptDisableMemLeakChecking, - kNumErrorOptions -}; -bool ErrorSetOption (EErrorOption option, bool on); -bool ErrorGetOption (EErrorOption option); - -bool DebugIsDebuggerPresent (); -void DebugBreakIfDebuggerPresent (); -void DebugMsg (const char fmt[], ...); -void DebugMsgV (const char fmt[], va_list args); - - -#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_MSGV DebugMsgV - #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 - - #ifdef PLASMA_EXTERNAL_RELEASE #define hsStatusMessage(x) NULL_STMT @@ -591,9 +411,3 @@ void DebugMsgV (const char fmt[], va_list args); #endif // PLASMA_EXTERNAL_RELEASE - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/Sources/Plasma/CoreLib/hsUtils.cpp b/Sources/Plasma/CoreLib/hsUtils.cpp index a7d8b66f..60a37f3f 100644 --- a/Sources/Plasma/CoreLib/hsUtils.cpp +++ b/Sources/Plasma/CoreLib/hsUtils.cpp @@ -39,22 +39,11 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com Mead, WA 99021 *==LICENSE==*/ -#include "hsUtils.h" -#if HS_BUILD_FOR_WIN32 -extern "C" { -#endif -#include -#include -#if HS_BUILD_FOR_WIN32 -}; -#endif -#if HS_BUILD_FOR_WIN32 -#include -#include -#endif +#include "HeadSpin.h" #include "hsStlUtils.h" #include "hsTemplates.h" +#include char * hsFormatStr(const char * fmt, ...) @@ -75,16 +64,9 @@ char * hsFormatStrV(const char * fmt, va_list args) static char hsStrBuf[100]; -char *hsScalarToStr(hsScalar s) +char *hsScalarToStr(float s) { - if (s == hsIntToScalar(hsScalarToInt(s))) - sprintf(hsStrBuf, "%d", hsScalarToInt(s)); - else - #if HS_CAN_USE_FLOAT - sprintf(hsStrBuf, "%f", hsScalarToFloat(s)); - #else - sprintf(hsStrBuf, "%d:%lu", hsFixedToInt(s), (UInt16)s); - #endif + sprintf(hsStrBuf, "%f", s); return hsStrBuf; } @@ -96,7 +78,7 @@ int hsMessageBoxWithOwner(void * owner, const char message[], const char caption return hsMBoxOk; #if HS_BUILD_FOR_WIN32 - UInt32 flags = 0; + uint32_t flags = 0; if (kind == hsMessageBoxNormal) flags |= MB_OK; @@ -150,7 +132,7 @@ int hsMessageBoxWithOwner(void * owner, const wchar_t message[], const wchar_t c return hsMBoxOk; #if HS_BUILD_FOR_WIN32 - UInt32 flags = 0; + uint32_t flags = 0; if (kind == hsMessageBoxNormal) flags |= MB_OK; @@ -216,6 +198,11 @@ int hsMessageBox(const wchar_t message[], const wchar_t caption[], int kind, int #endif } +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; @@ -250,13 +237,13 @@ char* hsStrcpy(char dst[], const char src[]) if (dst == nil) { int count = hsStrlen(src); - dst = (char *)ALLOC(count + 1); + dst = (char *)malloc(count + 1); memcpy(dst, src, count); dst[count] = 0; return dst; } - Int32 i; + int32_t i; for (i = 0; src[i] != 0; i++) dst[i] = src[i]; dst[i] = 0; @@ -265,7 +252,7 @@ char* hsStrcpy(char dst[], const char src[]) return dst; } -hsBool hsStrEQ(const char s1[], const char s2[]) +bool hsStrEQ(const char s1[], const char s2[]) { if (s1 && s2) { @@ -278,7 +265,7 @@ hsBool hsStrEQ(const char s1[], const char s2[]) return (!s1 && !s2); } -hsBool hsStrCaseEQ(const char* s1, const char* s2) +bool hsStrCaseEQ(const char* s1, const char* s2) { if (s1 && s2) { @@ -312,10 +299,10 @@ void hsStrLower(char *s) } } -char* hsP2CString(const UInt8 pstring[], char cstring[]) +char* hsP2CString(const uint8_t pstring[], char cstring[]) { char* cstr = cstring; - const UInt8* stop = &pstring[1] + pstring[0]; + const uint8_t* stop = &pstring[1] + pstring[0]; pstring += 1; // skip length byte while (pstring < stop) @@ -324,7 +311,7 @@ char* hsP2CString(const UInt8 pstring[], char cstring[]) return cstring; } -UInt8* hsC2PString(const char cstring[], UInt8 pstring[]) +uint8_t* hsC2PString(const char cstring[], uint8_t pstring[]) { int i; @@ -341,7 +328,7 @@ wchar_t *hsStringToWString( const char *str ) { // convert the char string to a wchar_t string int len = strlen(str); - wchar_t *wideString = TRACKED_NEW wchar_t[len+1]; + wchar_t *wideString = new wchar_t[len+1]; for (int i=0; i +#include "HeadSpin.h" #include #include int hsStrlen(const char src[]); char* hsStrcpy(char dstOrNil[], const char src[]); void hsStrcat(char dst[], const char src[]); -hsBool hsStrEQ(const char s1[], const char s2[]); -hsBool hsStrCaseEQ(const char* s1, const char* s2); -char* hsScalarToStr(hsScalar); +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); @@ -76,9 +77,9 @@ char * hsFormatStrV(const char * fmt, va_list args); // You are responsible f #endif -// A pstring has a length byte at the beginning, and no trailing 0 -char* hsP2CString(const UInt8 pstring[], char cstring[]); -UInt8* hsC2PString(const char cstring[], UInt8 pstring[]); +// 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[]) { @@ -127,10 +128,7 @@ int hsMessageBox(const wchar_t message[], const wchar_t caption[], int kind, int int hsMessageBoxWithOwner(void* owner, const char message[], const char caption[], int kind, int icon=hsMessageBoxIconAsterisk); int hsMessageBoxWithOwner(void* owner, const wchar_t message[], const wchar_t caption[], int kind, int icon=hsMessageBoxIconAsterisk); -inline hsBool hsCompare(hsScalar a, hsScalar b, hsScalar delta=0.0001) -{ - return (fabs(a - b) < delta); -} +inline hsBool hsCompare(float a, float b, float delta=0.0001); // flag testing / clearing #define hsCheckBits(f,c) ((f & c)==c) @@ -167,6 +165,13 @@ inline hsBool hsCompare(hsScalar a, hsScalar b, hsScalar delta=0.0001) # define hsWFopen(name, mode) fopen(hsWStringToString(name), hsWStringToString(mode)) #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 +#define NEWZERO(t) new(calloc(sizeof(t), 1)) t ///////////////////////////// // Physical memory functions @@ -178,7 +183,7 @@ enum MemSpec kOptimal // 256 or greater }; -UInt32 hsPhysicalMemory(); +uint32_t hsPhysicalMemory(); MemSpec hsMemorySpec(); inline int hsRandMax() { return 32767; } @@ -190,5 +195,54 @@ void hsRandSeed(int seed); char** DisplaySystemVersion(); -#endif // hsUtils_Defined - +/************************ 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[], ...); +void ErrorMinimizeAppWindow (); + +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 diff --git a/Sources/Plasma/CoreLib/hsWide.cpp b/Sources/Plasma/CoreLib/hsWide.cpp index 60cc9e58..f27e0110 100644 --- a/Sources/Plasma/CoreLib/hsWide.cpp +++ b/Sources/Plasma/CoreLib/hsWide.cpp @@ -43,7 +43,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com ///////////////////////////////////////////////////////////////////////// -inline hsBool OverflowAdd(UInt32* sum, UInt32 a, UInt32 b) +inline hsBool OverflowAdd(uint32_t* sum, uint32_t a, uint32_t b) { *sum = a + b; @@ -55,19 +55,19 @@ inline hsBool OverflowAdd(UInt32* sum, UInt32 a, UInt32 b) wide = (high << 32) + (middle << 16) + low */ -inline hsBool SetWide3(hsWide* target, Int32 high, UInt32 middle, UInt32 low) +inline hsBool SetWide3(hsWide* target, int32_t high, uint32_t middle, uint32_t low) { hsAssert(high >= 0, "high is neg"); target->fLo = low + (middle << 16); - target->fHi = high + (middle >> 16) + (((low >> 16) + (UInt16)middle) >> 16); + target->fHi = high + (middle >> 16) + (((low >> 16) + (uint16_t)middle) >> 16); return target->fHi < 0; // true if overflow } ///////////////////////////////////////////////////////////////////////// -hsWide* hsWide::Mul(Int32 src1, Int32 src2) +hsWide* hsWide::Mul(int32_t src1, int32_t src2) { int neg = 0; @@ -80,10 +80,10 @@ hsWide* hsWide::Mul(Int32 src1, Int32 src2) neg = ~neg; } - UInt32 a = src1 >> 16; - UInt32 b = (UInt16)src1; - UInt32 c = src2 >> 16; - UInt32 d = (UInt16)src2; + uint32_t a = src1 >> 16; + uint32_t b = (uint16_t)src1; + uint32_t c = src2 >> 16; + uint32_t d = (uint16_t)src2; (void)SetWide3(this, a * c, a * d + c * b, b * d); @@ -92,13 +92,13 @@ hsWide* hsWide::Mul(Int32 src1, Int32 src2) return this; } -hsWide* hsWide::Mul(Int32 A) +hsWide* hsWide::Mul(int32_t A) { int neg = 0; - UInt32 B = fLo; - Int32 C = fHi; - Int32 tmp; - UInt32 clo,blo,bhi,alo; + uint32_t B = fLo; + int32_t C = fHi; + int32_t tmp; + uint32_t clo,blo,bhi,alo; if (A < 0) { A = -A; @@ -109,37 +109,37 @@ hsWide* hsWide::Mul(Int32 A) neg = ~neg; } - UInt32 ahi = A >> 16; - UInt32 chi = C >> 16; + uint32_t ahi = A >> 16; + uint32_t chi = C >> 16; if (ahi != 0 && chi != 0) goto OVER_FLOW; - alo = (UInt16)A; + alo = (uint16_t)A; bhi = B >> 16; - blo = (UInt16)B; - clo = (UInt16)C; + blo = (uint16_t)B; + clo = (uint16_t)C; tmp = alo * clo; if (tmp < 0 || SetWide3(this, tmp, alo * bhi, alo * blo)) goto OVER_FLOW; if (chi != 0) - { UInt32 Vh = alo * chi; + { uint32_t Vh = alo * chi; if (Vh >> 15) goto OVER_FLOW; - if (((this->fHi >> 16) + (UInt16)Vh) >> 15) + if (((this->fHi >> 16) + (uint16_t)Vh) >> 15) goto OVER_FLOW; this->fHi += Vh << 16; } else // ahi != 0 && chi == 0 { hsWide w; - UInt32 Vh = ahi * clo; + uint32_t Vh = ahi * clo; if (Vh >> 16) goto OVER_FLOW; tmp = ahi * bhi; if (tmp < 0 || SetWide3(&w, tmp, ahi * blo, 0)) goto OVER_FLOW; - if (((w.fHi >> 16) + (UInt16)Vh) >> 15) + if (((w.fHi >> 16) + (uint16_t)Vh) >> 15) goto OVER_FLOW; w.fHi += Vh << 16; this->Add(&w); @@ -154,7 +154,7 @@ OVER_FLOW: return this; } -hsWide* hsWide::Div(Int32 denom) +hsWide* hsWide::Div(int32_t denom) { if (denom == 0) { if (this->IsNeg()) @@ -169,10 +169,10 @@ hsWide* hsWide::Div(Int32 denom) } int neg = 0; - Int32 resultH = 0; - UInt32 resultL = 0; - Int32 numerH = this->fHi; - UInt32 numerL = this->fLo; + int32_t resultH = 0; + uint32_t resultL = 0; + int32_t numerH = this->fHi; + uint32_t numerL = this->fLo; if (denom < 0) { denom = -denom; @@ -185,18 +185,18 @@ hsWide* hsWide::Div(Int32 denom) WIDE_ADDPOS(numerH, numerL, denom >> 1); // add denom/2 to get a round result - UInt32 curr = (UInt32)numerH >> 31; + uint32_t curr = (uint32_t)numerH >> 31; for (int i = 0; i < 64; i++) { WIDE_SHIFTLEFT(resultH, resultL, resultH, resultL, 1); - if (UInt32(denom) <= curr) + if (uint32_t(denom) <= curr) { resultL |= 1; curr -= denom; } WIDE_SHIFTLEFT(numerH, numerL, numerH, numerL, 1); - curr = (curr << 1) | ((UInt32)numerH >> 31); + curr = (curr << 1) | ((uint32_t)numerH >> 31); } if (neg) @@ -223,7 +223,7 @@ hsWide* hsWide::Div(const hsWide* denom) inline int MaxLeftShift(const hsWide* w) { - Int32 hi = w->fHi; + int32_t hi = w->fHi; if (hi == 0) return 31; @@ -240,7 +240,7 @@ inline int MaxLeftShift(const hsWide* w) } } -hsFixed hsWide::FixDiv(const hsWide* denom) const +int32_t hsWide::FixDiv(const hsWide* denom) const { hsWide num = *this; hsWide den = *denom; @@ -256,7 +256,7 @@ hsFixed hsWide::FixDiv(const hsWide* denom) const return num.Div(&den)->AsLong(); } -hsFract hsWide::FracDiv(const hsWide* denom) const +int32_t hsWide::FracDiv(const hsWide* denom) const { hsWide num = *this; hsWide den = *denom; @@ -274,15 +274,15 @@ hsFract hsWide::FracDiv(const hsWide* denom) const //////////////////////////////////////////////////////////////////////////////////// -Int32 hsWide::Sqrt() const +int32_t hsWide::Sqrt() const { int bits = 32; - UInt32 root = 0; - UInt32 valueH = (UInt32)fHi; - UInt32 valueL = fLo; - UInt32 currH = 0; - UInt32 currL = 0; - UInt32 guessH, guessL; + uint32_t root = 0; + uint32_t valueH = (uint32_t)fHi; + uint32_t valueL = fLo; + uint32_t currH = 0; + uint32_t currL = 0; + uint32_t guessH, guessL; do { WIDE_SHIFTLEFT(currH, currL, currH, currL, 2); @@ -297,21 +297,17 @@ Int32 hsWide::Sqrt() const } } while (--bits); -#if HS_PIN_MATH_OVERFLOW - if ((Int32)root < 0) - return kPosInfinity32; -#endif - return (Int32)root; + return (int32_t)root; } -Int32 hsWide::CubeRoot() const +int32_t hsWide::CubeRoot() const { int bits = 21; - UInt32 root = 0; - UInt32 valueH = (UInt32)fHi; - UInt32 valueL = fLo; - UInt32 currH, currL; - UInt32 guessH, guessL; + uint32_t root = 0; + uint32_t valueH = (uint32_t)fHi; + uint32_t valueL = fLo; + uint32_t currH, currL; + uint32_t guessH, guessL; hsBool neg = false; if (WIDE_ISNEG(valueH, valueL)) @@ -336,7 +332,7 @@ Int32 hsWide::CubeRoot() const hsWide w2 = w; w.ShiftLeft(1)->Add(&w2); #endif - guessH = (UInt32)w.fHi; + guessH = (uint32_t)w.fHi; guessL = w.fLo; if (WIDE_LESSTHAN(guessH, guessL, currH, currL)) @@ -347,7 +343,7 @@ Int32 hsWide::CubeRoot() const } while (--bits); if (neg) - root = -Int32(root); - return (Int32)root; + root = -int32_t(root); + return (int32_t)root; } diff --git a/Sources/Plasma/CoreLib/hsWide.h b/Sources/Plasma/CoreLib/hsWide.h index cfd3ca88..289cf2e1 100644 --- a/Sources/Plasma/CoreLib/hsWide.h +++ b/Sources/Plasma/CoreLib/hsWide.h @@ -42,14 +42,14 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #ifndef hsWideDefined #define hsWideDefined -#include "hsTypes.h" +#include "HeadSpin.h" struct hsWide { - Int32 fHi; - UInt32 fLo; + int32_t fHi; + uint32_t fLo; - hsWide* Set(Int32 lo) { fLo = lo; if (lo < 0) fHi = -1L; else fHi = 0; return this; } - hsWide* Set(Int32 hi, UInt32 lo) { fHi = hi; fLo = lo; return this; } + 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); } @@ -65,37 +65,35 @@ struct hsWide { hsBool operator>=(const hsWide& b) const { return !(*this < b); } inline hsWide* Negate(); - inline hsWide* Add(Int32 scaler); + inline hsWide* Add(int32_t scaler); inline hsWide* Add(const hsWide* a); inline hsWide* Sub(const hsWide* a); inline hsWide* ShiftLeft(unsigned shift); inline hsWide* ShiftRight(unsigned shift); inline hsWide* RoundRight(unsigned shift); - inline Int32 AsLong() const; // return bits 31-0, checking for over/under flow - inline hsFixed AsFixed() const; // return bits 47-16, checking for over/under flow - inline hsFract AsFract() const; // return bits 61-30, checking for over/under flow + inline int32_t AsLong() const; // return bits 31-0, checking for over/under flow + inline int32_t AsFixed() const; // return bits 47-16, checking for over/under flow + inline int32_t AsFract() const; // return bits 61-30, checking for over/under flow - hsWide* Mul(Int32 a); // this updates the wide - hsWide* Mul(Int32 a, Int32 b); // this sets the wide - hsWide* Div(Int32 denom); // this updates the wide + hsWide* Mul(int32_t a); // this updates the wide + hsWide* Mul(int32_t a, int32_t b); // this sets the wide + hsWide* Div(int32_t denom); // this updates the wide hsWide* Div(const hsWide* denom); // this updates the wide - hsFixed FixDiv(const hsWide* denom) const; - hsFract FracDiv(const hsWide* denom) const; + int32_t FixDiv(const hsWide* denom) const; + int32_t FracDiv(const hsWide* denom) const; - Int32 Sqrt() const; - Int32 CubeRoot() const; + int32_t Sqrt() const; + int32_t CubeRoot() const; -#if HS_CAN_USE_FLOAT double AsDouble() const { return fHi * double(65536) * double(65536) + fLo; } hsWide* Set(double d) { - Int32 hi = Int32(d / double(65536) / double(65536)); - Int32 lo = Int32(d - double(hi)); + int32_t hi = int32_t(d / double(65536) / double(65536)); + int32_t lo = int32_t(d - double(hi)); return Set(hi, lo); } -#endif }; @@ -104,22 +102,17 @@ const hsWide kNegInfinity64 = { kNegInfinity32, 0 }; /////////////////////// Inline implementations /////////////////////// -#define TOP2BITS(n) (UInt32(n) >> 30) -#define TOP3BITS(n) (UInt32(n) >> 29) +#define TOP2BITS(n) (uint32_t(n) >> 30) +#define TOP3BITS(n) (uint32_t(n) >> 29) -#if HS_PIN_MATH_OVERFLOW && HS_DEBUG_MATH_OVERFLOW - #define hsSignalMathOverflow() hsDebugMessage("Math overflow", 0) - #define hsSignalMathUnderflow() hsDebugMessage("Math underflow", 0) -#else #define hsSignalMathOverflow() #define hsSignalMathUnderflow() -#endif -#define WIDE_ISNEG(hi, lo) (Int32(hi) < 0) +#define WIDE_ISNEG(hi, lo) (int32_t(hi) < 0) #define WIDE_LESSTHAN(hi, lo, hi2, lo2) ((hi) < (hi2) || (hi) == (hi2) && (lo) < (lo2)) #define WIDE_SHIFTLEFT(outH, outL, inH, inL, shift) do { (outH) = ((inH) << (shift)) | ((inL) >> (32 - (shift))); (outL) = (inL) << (shift); } while (0) -#define WIDE_NEGATE(hi, lo) do { (hi) = ~(hi); if (((lo) = -Int32(lo)) == 0) (hi) += 1; } while (0) -#define WIDE_ADDPOS(hi, lo, scaler) do { UInt32 tmp = (lo) + (scaler); if (tmp < (lo)) (hi) += 1; (lo) = tmp; } while (0) +#define WIDE_NEGATE(hi, lo) do { (hi) = ~(hi); if (((lo) = -int32_t(lo)) == 0) (hi) += 1; } while (0) +#define WIDE_ADDPOS(hi, lo, scaler) do { uint32_t tmp = (lo) + (scaler); if (tmp < (lo)) (hi) += 1; (lo) = tmp; } while (0) #define WIDE_SUBWIDE(hi, lo, subhi, sublo) do { (hi) -= (subhi); if ((lo) < (sublo)) (hi) -= 1; (lo) -= (sublo); } while (0) /////////////////////// Inline implementations /////////////////////// @@ -131,13 +124,13 @@ inline hsWide* hsWide::Negate() return this; } -inline hsWide* hsWide::Add(Int32 scaler) +inline hsWide* hsWide::Add(int32_t scaler) { if (scaler >= 0) WIDE_ADDPOS(fHi, fLo, scaler); else { scaler = -scaler; - if (fLo < UInt32(scaler)) + if (fLo < uint32_t(scaler)) fHi--; fLo -= scaler; } @@ -147,7 +140,7 @@ inline hsWide* hsWide::Add(Int32 scaler) inline hsWide* hsWide::Add(const hsWide* a) { - UInt32 newLo = fLo + a->fLo; + uint32_t newLo = fLo + a->fLo; fHi += a->fHi; if (newLo < (fLo | a->fLo)) @@ -184,34 +177,24 @@ inline hsWide* hsWide::RoundRight(unsigned shift) return this->Add(1L << (shift - 1))->ShiftRight(shift); } -inline Int32 hsWide::AsLong() const +inline int32_t hsWide::AsLong() const { -#if HS_PIN_MATH_OVERFLOW - if (fHi > 0 || (fHi == 0 && (Int32)fLo < 0)) - { hsSignalMathOverflow(); - return kPosInfinity32; - } - if (fHi < -1L || (fHi == -1L && (Int32)fLo >= 0)) - { hsSignalMathOverflow(); - return kNegInfinity32; - } -#endif - return (Int32)fLo; + return (int32_t)fLo; } inline hsBool hsWide::IsWide() const { - return (fHi > 0 || (fHi == 0 && (Int32)fLo < 0)) || (fHi < -1L || (fHi == -1L && (Int32)fLo >= 0)); + return (fHi > 0 || (fHi == 0 && (int32_t)fLo < 0)) || (fHi < -1L || (fHi == -1L && (int32_t)fLo >= 0)); } -inline hsFixed hsWide::AsFixed() const +inline int32_t hsWide::AsFixed() const { hsWide tmp = *this; return tmp.RoundRight(16)->AsLong(); } -inline hsFract hsWide::AsFract() const +inline int32_t hsWide::AsFract() const { hsWide tmp = *this; diff --git a/Sources/Plasma/CoreLib/hsWindowHndl.h b/Sources/Plasma/CoreLib/hsWindowHndl.h deleted file mode 100644 index b12090c8..00000000 --- a/Sources/Plasma/CoreLib/hsWindowHndl.h +++ /dev/null @@ -1,54 +0,0 @@ -/*==LICENSE==* - -CyanWorlds.com Engine - MMOG client, server and tools -Copyright (C) 2011 Cyan Worlds, Inc. - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . - -Additional permissions under GNU GPL version 3 section 7 - -If you modify this Program, or any covered work, by linking or -combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK, -NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent -JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK -(or a modified version of those libraries), -containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA, -PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG -JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the -licensors of this Program grant you additional -permission to convey the resulting work. Corresponding Source for a -non-source form of such a combination shall include the source code for -the parts of OpenSSL and IJG JPEG Library used as well as that of the covered -work. - -You can contact Cyan Worlds, Inc. by email legal@cyan.com - or by snail mail at: - Cyan Worlds, Inc. - 14617 N Newport Hwy - Mead, WA 99021 - -*==LICENSE==*/ -#ifndef HSWINDOWHNDL_inc -#define HSWINDOWHNDL_inc - -#include "HeadSpin.h" - -// decide what hsWindowHndl is -#if HS_BUILD_FOR_WIN32 -typedef struct HWND__ * hsWindowHndl; -#elif HS_BUILD_FOR_UNIX -typedef int* hsWindowHndl; -#endif - -#endif diff --git a/Sources/Plasma/CoreLib/hsWindows.h b/Sources/Plasma/CoreLib/hsWindows.h index 3a7ccd82..1fcbd83f 100644 --- a/Sources/Plasma/CoreLib/hsWindows.h +++ b/Sources/Plasma/CoreLib/hsWindows.h @@ -39,16 +39,35 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com Mead, WA 99021 *==LICENSE==*/ -#include "hsConfig.h" -#if HS_BUILD_FOR_WIN32 +#ifdef _HSWINDOWS_H +# error "Do not include hsWindows.h directly--use HeadSpin.h" +#endif // _HSWINDOWS_H +#define _HSWINDOWS_H -#ifndef __AFX_H__ // MFC apps won't let us include windows from here. =( -#ifndef MAXPLUGINCODE -#include -#endif // MAXPLUGINCODE +#if HS_BUILD_FOR_WIN32 -#include -#endif // __AFX_H__ + // 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 + // 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 +# include +# endif // MAXPLUGINCODE +# define WIN32_LEAN_AND_MEAN +# include + + typedef HWND hsWindowHndl; +#else + typedef int32_t* hsWindowHndl; #endif // HS_BUILD_FOR_WIN32 diff --git a/Sources/Plasma/CoreLib/pcSmallRect.cpp b/Sources/Plasma/CoreLib/pcSmallRect.cpp index e447dd1a..0c0d4288 100644 --- a/Sources/Plasma/CoreLib/pcSmallRect.cpp +++ b/Sources/Plasma/CoreLib/pcSmallRect.cpp @@ -41,7 +41,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ /////////////////////////////////////////////////////////////////////////////// // // -// pcSmallRect - A tiny Int16-based 2D rectangle class // +// pcSmallRect - A tiny int16_t-based 2D rectangle class // // // /////////////////////////////////////////////////////////////////////////////// diff --git a/Sources/Plasma/CoreLib/pcSmallRect.h b/Sources/Plasma/CoreLib/pcSmallRect.h index 498e40f8..0df5f366 100644 --- a/Sources/Plasma/CoreLib/pcSmallRect.h +++ b/Sources/Plasma/CoreLib/pcSmallRect.h @@ -41,7 +41,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ /////////////////////////////////////////////////////////////////////////////// // // -// pcSmallRect - A tiny Int16-based 2D rectangle class // +// pcSmallRect - A tiny int16_t-based 2D rectangle class // // // /////////////////////////////////////////////////////////////////////////////// @@ -53,27 +53,27 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #ifndef _pcSmallRect_h #define _pcSmallRect_h -#include "hsTypes.h" +#include "HeadSpin.h" class hsStream; class pcSmallRect { public: - Int16 fX, fY, fWidth, fHeight; + int16_t fX, fY, fWidth, fHeight; pcSmallRect() { Empty(); } - pcSmallRect( Int16 x, Int16 y, Int16 w, Int16 h ) { Set( x, y, w, h ); } + pcSmallRect( int16_t x, int16_t y, int16_t w, int16_t h ) { Set( x, y, w, h ); } - void Set( Int16 x, Int16 y, Int16 w, Int16 h ) { fX = x; fY = y; fWidth = w; fHeight = h; } + void Set( int16_t x, int16_t y, int16_t w, int16_t h ) { fX = x; fY = y; fWidth = w; fHeight = h; } void Empty( void ) { fX = fY = fWidth = fHeight = 0; } - Int16 GetRight( void ) const { return fX + fWidth; } - Int16 GetBottom( void ) const { return fY + fHeight; } + int16_t GetRight( void ) const { return fX + fWidth; } + int16_t GetBottom( void ) const { return fY + fHeight; } void Read( hsStream *s ); void Write( hsStream *s ); - hsBool Contains( Int16 x, Int16 y ) { if( x >= fX && x <= fX + fWidth && y >= fY && y <= fY + fHeight ) return true; return false; } + hsBool Contains( int16_t x, int16_t y ) { if( x >= fX && x <= fX + fWidth && y >= fY && y <= fY + fHeight ) return true; return false; } }; diff --git a/Sources/Plasma/CoreLib/plGeneric.cpp b/Sources/Plasma/CoreLib/plGeneric.cpp index 6c8b6817..a027477d 100644 --- a/Sources/Plasma/CoreLib/plGeneric.cpp +++ b/Sources/Plasma/CoreLib/plGeneric.cpp @@ -39,7 +39,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com Mead, WA 99021 *==LICENSE==*/ -#include "hsUtils.h" + #include "plGeneric.h" plGeneric::plGeneric(): fType(kNull), fBoolVal(false), fIntVal(0), fFloatVal(0.0) {} @@ -141,7 +141,7 @@ plGeneric& plGeneric::operator=(const std::wstring& val) int plGeneric::Write(hsStream* stream) { - stream->WriteByte((UInt8)fType); + stream->WriteByte((uint8_t)fType); switch (fType) { diff --git a/Sources/Plasma/CoreLib/plLoadMask.cpp b/Sources/Plasma/CoreLib/plLoadMask.cpp index 38821ab0..b00c9dd6 100644 --- a/Sources/Plasma/CoreLib/plLoadMask.cpp +++ b/Sources/Plasma/CoreLib/plLoadMask.cpp @@ -40,7 +40,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "plLoadMask.h" #include "hsStream.h" #include "hsTemplates.h" @@ -75,13 +75,13 @@ void plQuality::SetCapability(int c) const plLoadMask plLoadMask::kAlways; -UInt8 plLoadMask::fGlobalQuality = UInt8(1); -UInt8 plLoadMask::fGlobalCapability = UInt8(0); +uint8_t plLoadMask::fGlobalQuality = uint8_t(1); +uint8_t plLoadMask::fGlobalCapability = uint8_t(0); void plLoadMask::Read(hsStream* s) { // read as packed byte - UInt8 qc; + uint8_t qc; s->LogReadLE(&qc,"Quality|Capabilty"); fQuality[0] = (qc & 0xf0) >> 4; @@ -95,13 +95,13 @@ void plLoadMask::Read(hsStream* s) void plLoadMask::Write(hsStream* s) const { // write packed into 1 byte - UInt8 qc = (fQuality[0]<<4) | (fQuality[1] & 0xf); + uint8_t qc = (fQuality[0]<<4) | (fQuality[1] & 0xf); s->WriteLE(qc); } -UInt32 plLoadMask::ValidateReps(int num, const int quals[], const int caps[]) +uint32_t plLoadMask::ValidateReps(int num, const int quals[], const int caps[]) { - UInt32 retVal = 0; + uint32_t retVal = 0; int i; for( i = 1; i < num; i++ ) { @@ -118,9 +118,9 @@ UInt32 plLoadMask::ValidateReps(int num, const int quals[], const int caps[]) return retVal; } -UInt32 plLoadMask::ValidateMasks(int num, plLoadMask masks[]) +uint32_t plLoadMask::ValidateMasks(int num, plLoadMask masks[]) { - UInt32 retVal = 0; + uint32_t retVal = 0; int i; for( i = 0; i < num; i++ ) { @@ -160,12 +160,12 @@ hsBool plLoadMask::ComputeRepMasks( { // Q starts off the bits higher than or equal to 1 << qual. // I.e. we just turned off all lower quality bits. - UInt8 q = ~( (1 << quals[i]) - 1 ); + uint8_t q = ~( (1 << quals[i]) - 1 ); // For this cap level, if we require higher caps, // turn off our quality (i.e. we won't load at this // cap for any quality setting. - UInt8 c = caps[i] > kMaxCap ? kMaxCap : caps[i]; + uint8_t c = caps[i] > kMaxCap ? kMaxCap : caps[i]; if( c > k ) q = 0; diff --git a/Sources/Plasma/CoreLib/plLoadMask.h b/Sources/Plasma/CoreLib/plLoadMask.h index 0e20bbaa..58ac4f5b 100644 --- a/Sources/Plasma/CoreLib/plLoadMask.h +++ b/Sources/Plasma/CoreLib/plLoadMask.h @@ -43,7 +43,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #ifndef plLoadMask_inc #define plLoadMask_inc -#include "hsTypes.h" +#include "HeadSpin.h" template class hsTArray; class hsStream; @@ -55,30 +55,30 @@ public: kMaxCap = 1 }; protected: - static UInt8 fGlobalQuality; - static UInt8 fGlobalCapability; + static uint8_t fGlobalQuality; + static uint8_t fGlobalCapability; union { - UInt8 fQuality[kMaxCap+1]; - UInt16 fMask; + uint8_t fQuality[kMaxCap+1]; + uint16_t fMask; }; static void SetGlobalQuality(int q) { fGlobalQuality = IBitToMask(q); } static void SetGlobalCapability(int c) { if( c > kMaxCap ) c = kMaxCap; else if( c < 0 ) c = 0; fGlobalCapability = c; } - static UInt8 IBitToMask(int b) { hsAssert(b<8, "LoadMask: bit too large for byte"); return (1 << b); } + static uint8_t IBitToMask(int b) { hsAssert(b<8, "LoadMask: bit too large for uint8_t"); return (1 << b); } friend class plQuality; public: // Change this to a for loop on kMaxCap+1 if we ever get more caps. plLoadMask() { fQuality[0] = fQuality[1] = 0xff; } - plLoadMask(UInt8 qLo, UInt8 qHi) { fQuality[0] = qLo; fQuality[1] = qHi; } + plLoadMask(uint8_t qLo, uint8_t qHi) { fQuality[0] = qLo; fQuality[1] = qHi; } ~plLoadMask() {} hsBool DontLoad() const { return !(fQuality[fGlobalCapability] & fGlobalQuality); } hsBool NeverLoads() const { return !(fQuality[0] && fQuality[1]); } - hsBool IsUsed() const { return (fQuality[0] != UInt8(-1)) || (fQuality[1] != UInt8(-1)); } + hsBool 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; } @@ -88,11 +88,11 @@ public: hsBool MatchesCurrentCapability() const { return MatchesCapability(fGlobalCapability); } hsBool MatchesCurrent() const { return !DontLoad(); } - UInt8 GetQualityMask(int cap) const { return fQuality[cap]; } + uint8_t GetQualityMask(int cap) const { return fQuality[cap]; } - plLoadMask& SetMask(UInt8 lo, UInt8 hi) { fQuality[0] = lo; fQuality[1] = hi; return *this; } + plLoadMask& SetMask(uint8_t lo, uint8_t hi) { fQuality[0] = lo; fQuality[1] = hi; return *this; } plLoadMask& SetNever() { return SetMask(0,0); } - plLoadMask& SetAlways() { return SetMask(UInt8(-1), UInt8(-1)); } + plLoadMask& SetAlways() { return SetMask(uint8_t(-1), uint8_t(-1)); } plLoadMask& operator|=(const plLoadMask& m) { fMask |= m.fMask; return *this; } plLoadMask& operator&=(const plLoadMask& m) { fMask &= m.fMask; return *this; } @@ -128,8 +128,8 @@ public: // 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 UInt32 ValidateReps(int num, const int quals[], const int caps[]); - static UInt32 ValidateMasks(int num, plLoadMask masks[]); + static uint32_t ValidateReps(int num, const int quals[], const int caps[]); + static uint32_t ValidateMasks(int num, plLoadMask masks[]); }; #endif // plLoadMask_inc diff --git a/Sources/Plasma/CoreLib/plRefCnt.h b/Sources/Plasma/CoreLib/plRefCnt.h index a77198a9..11545415 100644 --- a/Sources/Plasma/CoreLib/plRefCnt.h +++ b/Sources/Plasma/CoreLib/plRefCnt.h @@ -42,12 +42,12 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #ifndef plRefCnt_Defined #define plRefCnt_Defined -#include "hsTypes.h" +#include "HeadSpin.h" // plRef count addes refcount abilities to any plCreatable class plRefCnt -{ UInt32 fRefCnt; +{ uint32_t fRefCnt; public: plRefCnt() : fRefCnt(1){} ~plRefCnt(){} @@ -63,12 +63,12 @@ public: /* class hsRefCnt { private: - Int32 fRefCnt; + int32_t fRefCnt; public: hsRefCnt() : fRefCnt(1) {} virtual ~hsRefCnt(); - Int32 RefCnt() const { return fRefCnt; } + int32_t RefCnt() const { return fRefCnt; } virtual void UnRef(); virtual void Ref(); }; diff --git a/Sources/Plasma/CoreLib/plRenderLevel.h b/Sources/Plasma/CoreLib/plRenderLevel.h index 3aa34d75..4c131292 100644 --- a/Sources/Plasma/CoreLib/plRenderLevel.h +++ b/Sources/Plasma/CoreLib/plRenderLevel.h @@ -79,8 +79,8 @@ public: }; public: plRenderLevel() { Set(kDefRendMajorLevel, kDefRendMinorLevel); } - plRenderLevel(UInt32 l) : fLevel(l) {} - plRenderLevel(UInt32 major, UInt32 minor) { Set(major, minor); } + plRenderLevel(uint32_t l) : fLevel(l) {} + plRenderLevel(uint32_t major, uint32_t minor) { Set(major, minor); } int operator==(const plRenderLevel& l) const { return fLevel == l.fLevel; } int operator!=(const plRenderLevel& l) const { return fLevel != l.fLevel; } @@ -89,15 +89,15 @@ public: int operator>=(const plRenderLevel& l) const { return fLevel >= l.fLevel; } int operator<=(const plRenderLevel& l) const { return fLevel <= l.fLevel; } - UInt32 Level() const { return fLevel; } + uint32_t Level() const { return fLevel; } - UInt32 Minor() const { return UInt32(fLevel & kMinorLevelMask); } - UInt32 Major() const { return UInt32(fLevel >> kMajorShift); } + uint32_t Minor() const { return uint32_t(fLevel & kMinorLevelMask); } + uint32_t Major() const { return uint32_t(fLevel >> kMajorShift); } - plRenderLevel& Set(UInt32 l) { fLevel = l; return *this; } - plRenderLevel& Set(UInt32 major, UInt32 minor) { fLevel = (UInt32(major) << kMajorShift) | UInt32(minor); return *this; } + plRenderLevel& Set(uint32_t l) { fLevel = l; return *this; } + plRenderLevel& Set(uint32_t major, uint32_t minor) { fLevel = (uint32_t(major) << kMajorShift) | uint32_t(minor); return *this; } - UInt32 fLevel; + uint32_t fLevel; static plRenderLevel OpaqueRenderLevel() { return plRenderLevel(kOpaqueMajorLevel, kOpaqueMinorLevel); } }; diff --git a/Sources/Plasma/CoreLib/plViewTransform.cpp b/Sources/Plasma/CoreLib/plViewTransform.cpp index 6b911418..674e1aa4 100644 --- a/Sources/Plasma/CoreLib/plViewTransform.cpp +++ b/Sources/Plasma/CoreLib/plViewTransform.cpp @@ -40,12 +40,12 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "hsBounds.h" #include "hsStream.h" #include "plViewTransform.h" -const hsScalar plViewTransform::kMinHither = 0.25f; +const float plViewTransform::kMinHither = 0.25f; plViewTransform::plViewTransform() : fFlags(kViewPortRelative), @@ -81,15 +81,15 @@ void plViewTransform::ISetCameraToNDC() const { hsPoint3 worldSizeInv; - worldSizeInv.fX = hsScalarInvert( fMax.fX - fMin.fX ) * 2.f; - worldSizeInv.fY = hsScalarInvert( fMax.fY - fMin.fY ) * 2.f; - worldSizeInv.fZ = hsScalarInvert( fMax.fZ - fMin.fZ ); + worldSizeInv.fX = hsInvert( fMax.fX - fMin.fX ) * 2.f; + worldSizeInv.fY = hsInvert( fMax.fY - fMin.fY ) * 2.f; + worldSizeInv.fZ = hsInvert( fMax.fZ - fMin.fZ ); fCameraToNDC.fMap[0][0] = worldSizeInv.fX; - fCameraToNDC.fMap[0][3] = -fMin.fX * worldSizeInv.fX - hsScalar1; + fCameraToNDC.fMap[0][3] = -fMin.fX * worldSizeInv.fX - 1.f; fCameraToNDC.fMap[1][1] = worldSizeInv.fY; - fCameraToNDC.fMap[1][3] = -fMin.fY * worldSizeInv.fY - hsScalar1; + fCameraToNDC.fMap[1][3] = -fMin.fY * worldSizeInv.fY - 1.f; // Map Screen Z to range 0 (at hither) to 1 (at yon) fCameraToNDC.fMap[2][2] = worldSizeInv.fZ; @@ -152,7 +152,7 @@ hsScalarTriple plViewTransform::NDCToScreen(const hsScalarTriple& ndc) const hsScalarTriple plViewTransform::NDCToCamera(const hsScalarTriple& ndc) const { hsPoint3 camP; - hsScalar w = ndc.fZ; + float w = ndc.fZ; const hsMatrix44& c2NDC = GetCameraToNDC(); @@ -188,7 +188,7 @@ hsScalarTriple plViewTransform::CameraToNDC(const hsScalarTriple& camP) const } else { - hsScalar invW = 1.f / camP.fZ; + float invW = 1.f / camP.fZ; ndc.fX = c2NDC.fMap[0][0] * camP.fX * invW + c2NDC.fMap[0][2]; @@ -203,7 +203,7 @@ hsScalarTriple plViewTransform::CameraToNDC(const hsScalarTriple& camP) const hsPoint3 ndc = c2NDC * hsPoint3(camP); if( !GetOrthogonal() ) { - hsScalar invW = 1.f / camP.fZ; + float invW = 1.f / camP.fZ; ndc *= invW; } #endif // MF_FLIP_SPARSE @@ -299,18 +299,18 @@ hsBool plViewTransform::Union(const plViewTransform& view) return true; } -hsScalar plViewTransform::GetFovX() const +float plViewTransform::GetFovX() const { - hsScalar minAng = hsATan2(fMin.fX, 1.f); - hsScalar maxAng = hsATan2(fMax.fX, 1.f); + float minAng = atan2(fMin.fX, 1.f); + float maxAng = atan2(fMax.fX, 1.f); return maxAng - minAng; } -hsScalar plViewTransform::GetFovY() const +float plViewTransform::GetFovY() const { - hsScalar minAng = hsATan2(fMin.fY, 1.f); - hsScalar maxAng = hsATan2(fMax.fY, 1.f); + float minAng = atan2(fMin.fY, 1.f); + float maxAng = atan2(fMax.fY, 1.f); return maxAng - minAng; } diff --git a/Sources/Plasma/CoreLib/plViewTransform.h b/Sources/Plasma/CoreLib/plViewTransform.h index 2595ef91..0853df7a 100644 --- a/Sources/Plasma/CoreLib/plViewTransform.h +++ b/Sources/Plasma/CoreLib/plViewTransform.h @@ -110,8 +110,8 @@ public: hsVector3 GetUp() const { return *((hsVector3*)&GetWorldToCamera().fMap[1]); } hsVector3 GetAcross() const { return *((hsVector3*)&GetWorldToCamera().fMap[0]); } - UInt16 GetScreenWidth() const { return fWidth; } - UInt16 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,15 +130,15 @@ public: hsPoint3 GetMapMax() const { return fMapMax; } void GetMapping(hsPoint3& mapMin, hsPoint3& mapMax) const { mapMin = fMapMin; mapMax = fMapMax; } - hsScalar GetFovX() const; - hsScalar GetFovY() const; - hsScalar GetFovXDeg() const { return hsScalarRadToDeg(GetFovX()); } - hsScalar GetFovYDeg() const { return hsScalarRadToDeg(GetFovY()); } - hsScalar GetOrthoWidth() const { return fMax.fX - fMin.fX; } - hsScalar GetOrthoHeight() const { return fMax.fY - fMin.fY; } - hsScalar GetHither() const { return fMin.fZ; } - hsScalar GetYon() const { return fMax.fZ; } - void GetDepth(hsScalar& hither, hsScalar& yon) const { hither = GetHither(); yon = GetYon(); } + 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. // First, our world to camera and back again. @@ -149,16 +149,16 @@ public: void SetPerspective(hsBool on) { SetOrthogonal(!on); } // Next, setting the scree/window/rendertarget size - void SetWidth(UInt16 w) { fWidth = w; } - void SetHeight(UInt16 h) { fHeight = h; } - void SetScreenSize(UInt16 w, UInt16 h) { SetWidth(w); SetHeight(h); } + void SetWidth(uint16_t w) { fWidth = w; } + void SetHeight(uint16_t h) { fHeight = h; } + void SetScreenSize(uint16_t w, uint16_t h) { SetWidth(w); SetHeight(h); } // 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(UInt16 left, UInt16 top, UInt16 right, UInt16 bottom) { SetViewPort(hsScalar(left), hsScalar(top), hsScalar(right), hsScalar(bottom), false); } + 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); } void SetMapMin(const hsPoint3& mins) { fMapMin = mins; } @@ -166,35 +166,35 @@ public: // Next, variants on setting up our projection matrix. // Depth is pretty uniform. - void SetDepth(hsScalar hither, hsScalar yon) { fMin.fZ = hither; fMax.fZ = yon; InvalidateTransforms(); } + void SetDepth(float hither, float yon) { fMin.fZ = hither; fMax.fZ = yon; InvalidateTransforms(); } void SetDepth(const hsPoint2& d) { SetDepth(d.fX, d.fY); } - void SetHither(hsScalar hither) { fMin.fZ = hither; InvalidateTransforms(); } - void SetYon(hsScalar yon) { fMax.fZ = yon; InvalidateTransforms(); } + void SetHither(float hither) { fMin.fZ = hither; InvalidateTransforms(); } + void SetYon(float yon) { fMax.fZ = yon; InvalidateTransforms(); } // Garden variety symmetric fov uses either of this first batch. Unless you're doing some funky projection, you don't even // need to look through the rest. // Degrees - all are full angles, < 180 degrees void SetFovDeg(const hsPoint2& deg) { SetFovDeg(deg.fX, deg.fY); } - void SetFovDeg(hsScalar degX, hsScalar degY) { SetFovXDeg(degX); SetFovYDeg(degY); } - void SetFovXDeg(hsScalar deg) { SetFovX(hsScalarDegToRad(deg)); } - void SetFovYDeg(hsScalar deg) { SetFovY(hsScalarDegToRad(deg)); } + void SetFovDeg(float degX, float degY) { SetFovXDeg(degX); SetFovYDeg(degY); } + void SetFovXDeg(float deg) { SetFovX(hsDegreesToRadians(deg)); } + void SetFovYDeg(float deg) { SetFovY(hsDegreesToRadians(deg)); } // Radians - all are full angles, < PI void SetFov(const hsPoint2& rad) { SetFov(rad.fX, rad.fY); } - void SetFov(hsScalar radX, hsScalar radY) { SetFovX(radX); SetFovY(radY); } - void SetFovX(hsScalar rad) { SetHalfWidth(hsTan(rad * 0.5f)); } - void SetFovY(hsScalar rad) { SetHalfHeight(hsTan(rad * 0.5f)); } + void SetFov(float radX, float radY) { SetFovX(radX); SetFovY(radY); } + void SetFovX(float rad) { SetHalfWidth(tan(rad * 0.5f)); } + void SetFovY(float rad) { SetHalfHeight(tan(rad * 0.5f)); } - // For orthogonal projection, don't call SetWidth(hsTan(fovRads)), because hsTan(f)/2 != hsTan(f/2) + // For orthogonal projection, don't call SetWidth(tan(fovRads)), because tan(f)/2 != tan(f/2) // For non-centered, call SetWidths/Heights() directly. - void SetWidth(hsScalar w) { SetHalfWidth(w * 0.5f); } - void SetHeight(hsScalar h) { SetHalfHeight(h * 0.5f); } + void SetWidth(float w) { SetHalfWidth(w * 0.5f); } + void SetHeight(float h) { SetHalfHeight(h * 0.5f); } // The rest do no interpretation, just stuff the values passed in. - void SetHalfWidth(hsScalar hw) { SetWidths(-hw, hw); } - void SetHalfHeight(hsScalar hh) { SetHeights(-hh, hh); } - void SetWidths(hsScalar minW, hsScalar maxW) { fMin.fX = minW; fMax.fX = maxW; InvalidateTransforms(); } - void SetHeights(hsScalar minH, hsScalar maxH) { fMin.fY = minH; fMax.fY = maxH; InvalidateTransforms(); } + void SetHalfWidth(float hw) { SetWidths(-hw, hw); } + void SetHalfHeight(float hh) { SetHeights(-hh, hh); } + void SetWidths(float minW, float maxW) { fMin.fX = minW; fMax.fX = maxW; InvalidateTransforms(); } + void SetHeights(float minH, float maxH) { fMin.fY = minH; fMax.fY = maxH; InvalidateTransforms(); } void SetWidths(const hsPoint2& w) { SetWidths(w.fX, w.fY); } void SetHeights(const hsPoint2& h) { SetHeights(h.fX, h.fY); } void SetView(const hsPoint3& mins, const hsPoint3& maxs) { fMax = maxs; fMin = mins; InvalidateTransforms(); } @@ -292,7 +292,7 @@ protected: kViewPortRelative = 0x10 }; - mutable UInt32 fFlags; + mutable uint32_t fFlags; hsMatrix44 fCameraToWorld; hsMatrix44 fWorldToCamera; @@ -301,8 +301,8 @@ protected: hsPoint3 fMax; // maxTanX/X, maxTanY/Y, yon // Screen (or rendertarget) dimensions in pixels. - UInt16 fWidth; - UInt16 fHeight; + uint16_t fWidth; + uint16_t fHeight; // Viewport can be stored as fraction of screen size, so the view transform's viewport // can be set up independent of the size of the window it's applied to. @@ -319,7 +319,7 @@ protected: mutable hsMatrix44 fWorldToNDC; // Have to set a limit here on the smallest the hither plane can be. - static const hsScalar kMinHither; + static const float kMinHither; void ISetCameraToNDC() const; hsBool ICameraToNDCSet() const { return IHasFlag(kCameraToNDCSet); } @@ -334,8 +334,8 @@ protected: void InvalidateTransforms() { ISetFlag(kCameraToNDCSet|kWorldToNDCSet, false); } // Flags - generic - hsBool IHasFlag(UInt32 f) const { return 0 != (fFlags & f); } - void ISetFlag(UInt32 f, hsBool on=true) const { if(on) fFlags |= f; else fFlags &= ~f; } + 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; } }; diff --git a/Sources/Plasma/CoreLibExe/CMakeLists.txt b/Sources/Plasma/CoreLibExe/CMakeLists.txt deleted file mode 100644 index 30caf2bf..00000000 --- a/Sources/Plasma/CoreLibExe/CMakeLists.txt +++ /dev/null @@ -1,18 +0,0 @@ -add_definitions(-D_LIB) - -include_directories("../../Plasma/CoreLib") - -set(CoreLibExe_SOURCES - hsExeError.cpp - hsExeMalloc.cpp -) - -set(CoreLibExe_HEADERS - Intern.h - Pch.h -) - -add_library(CoreLibExe STATIC ${CoreLibExe_SOURCES} ${CoreLibExe_HEADERS}) - -source_group("Source Files" FILES ${CoreLibExe_SOURCES}) -source_group("Header Files" FILES ${CoreLibExe_HEADERS}) diff --git a/Sources/Plasma/CoreLibExe/Intern.h b/Sources/Plasma/CoreLibExe/Intern.h deleted file mode 100644 index 9042e677..00000000 --- a/Sources/Plasma/CoreLibExe/Intern.h +++ /dev/null @@ -1,65 +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 . - -Additional permissions under GNU GPL version 3 section 7 - -If you modify this Program, or any covered work, by linking or -combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK, -NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent -JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK -(or a modified version of those libraries), -containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA, -PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG -JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the -licensors of this Program grant you additional -permission to convey the resulting work. Corresponding Source for a -non-source form of such a combination shall include the source code for -the parts of OpenSSL and IJG JPEG Library used as well as that of the covered -work. - -You can contact Cyan Worlds, Inc. by email legal@cyan.com - or by snail mail at: - Cyan Worlds, Inc. - 14617 N Newport Hwy - Mead, WA 99021 - -*==LICENSE==*/ -/***************************************************************************** -* -* $/Plasma20/Sources/Plasma/CoreLibExe/Intern.h -* -***/ - -#ifdef PLASMA20_SOURCES_PLASMA_CORELIBEXE_INTERN_H -#error "Header $/Plasma20/Sources/Plasma/CoreLibExe/Intern.h included more than once" -#endif -#define PLASMA20_SOURCES_PLASMA_CORELIBEXE_INTERN_H - - -namespace ExeMalloc { -/***************************************************************************** -* -* hsExeMalloc -* -***/ - -void MemSetLeakChecking (bool on); - - - -} using namespace ExeMalloc; diff --git a/Sources/Plasma/CoreLibExe/Pch.h b/Sources/Plasma/CoreLibExe/Pch.h deleted file mode 100644 index 4bb74c97..00000000 --- a/Sources/Plasma/CoreLibExe/Pch.h +++ /dev/null @@ -1,72 +0,0 @@ -/*==LICENSE==* - -CyanWorlds.com Engine - MMOG client, server and tools -Copyright (C) 2011 Cyan Worlds, Inc. - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . - -Additional permissions under GNU GPL version 3 section 7 - -If you modify this Program, or any covered work, by linking or -combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK, -NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent -JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK -(or a modified version of those libraries), -containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA, -PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG -JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the -licensors of this Program grant you additional -permission to convey the resulting work. Corresponding Source for a -non-source form of such a combination shall include the source code for -the parts of OpenSSL and IJG JPEG Library used as well as that of the covered -work. - -You can contact Cyan Worlds, Inc. by email legal@cyan.com - or by snail mail at: - Cyan Worlds, Inc. - 14617 N Newport Hwy - Mead, WA 99021 - -*==LICENSE==*/ -/***************************************************************************** -* -* $/Plasma20/Sources/Plasma/CoreLibExe/Pch.h -* -***/ - -#ifdef PLASMA20_SOURCES_PLASMA_CORELIBEXE_PCH_H -#error "Header $/Plasma20/Sources/Plasma/CoreLibExe/Pch.h included more than once" -#endif -#define PLASMA20_SOURCES_PLASMA_CORELIBEXE_PCH_H - -#pragma warning(push, 3) - -#include "HeadSpin.h" -#include "hsConfig.h" -#include "hsTypes.h" -#include "hsWindows.h" -#include "hsMalloc.h" -#include "hsCritSect.h" -#include "hsUtils.h" -#include "hsWindows.h" - -#pragma warning(pop) - -#include "Intern.h" - -#include - -#if _MSC_VER -#include -#endif diff --git a/Sources/Plasma/CoreLibExe/hsExeError.cpp b/Sources/Plasma/CoreLibExe/hsExeError.cpp deleted file mode 100644 index ef31f3b7..00000000 --- a/Sources/Plasma/CoreLibExe/hsExeError.cpp +++ /dev/null @@ -1,266 +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 . - -Additional permissions under GNU GPL version 3 section 7 - -If you modify this Program, or any covered work, by linking or -combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK, -NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent -JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK -(or a modified version of those libraries), -containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA, -PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG -JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the -licensors of this Program grant you additional -permission to convey the resulting work. Corresponding Source for a -non-source form of such a combination shall include the source code for -the parts of OpenSSL and IJG JPEG Library used as well as that of the covered -work. - -You can contact Cyan Worlds, Inc. by email legal@cyan.com - or by snail mail at: - Cyan Worlds, Inc. - 14617 N Newport Hwy - Mead, WA 99021 - -*==LICENSE==*/ -/***************************************************************************** -* -* $/Plasma20/Sources/Plasma/CoreLibExe/hsExeError.cpp -* -***/ - -#include "Pch.h" -#pragma hdrstop - - -/***************************************************************************** -* -* Private -* -***/ - -static bool s_skipBreak; -#if HS_BUILD_FOR_WIN32 -static CCritSect * s_critsect; -#endif - -// User options -static bool s_options[kNumErrorOptions]; - - -/***************************************************************************** -* -* Internal functions -* -***/ - -//=========================================================================== -#if HS_BUILD_FOR_WIN32 -AUTO_INIT_FUNC(hsExeErrorInit) { - // The critical section has to be initialized - // before program startup and never freed - static byte rawMemory[sizeof(CCritSect)]; - s_critsect = new(rawMemory) CCritSect; -} -#endif - -//============================================================================ -static void DoAssert (int line, const char file[], const char msg[]) { - - ErrorMinimizeAppWindow(); - - #ifdef HS_BUILD_FOR_WIN32 - - if (!s_options[kErrOptNonGuiAsserts]) { - #ifdef HS_DEBUGGING - bool wasLeakChecking = ErrorSetOption(kErrOptDisableMemLeakChecking, true); - if (s_critsect) - s_critsect->Enter(); - if (_CrtDbgReport(_CRT_ASSERT, file, line, NULL, msg)) - DebugBreak(); - if (s_critsect) - s_critsect->Leave(); - (void) ErrorSetOption(kErrOptDisableMemLeakChecking, wasLeakChecking); - #else - DebugBreakIfDebuggerPresent(); - #endif - } - else { - DebugMsg(msg); - DebugBreakIfDebuggerPresent(); - } - - #else // !HS_BUILD_FOR_WIN32 - - DebugMsg(msg); - DebugBreakIfDebuggerPresent(); - - #endif -} - -/***************************************************************************** -* -* Exports -* -***/ - -//============================================================================ -#pragma auto_inline(off) -void CDECL ErrorFatal (int line, const char file[], const char fmt[], ...) { - char buffer[256]; - va_list args; - va_start(args, fmt); - hsVsnprintf(buffer, arrsize(buffer), fmt, args); - va_end(args); - - ErrorSetOption(kErrOptDisableMemLeakChecking, true); - DoAssert(line, file, buffer); - - // Ensure thread crashes immediately by writing to invalid memory - * (int *) 0 = 0; -} -#pragma auto_inline() - -//============================================================================ -#pragma auto_inline(off) -void CDECL ErrorAssert (int line, const char file[], const char fmt[], ...) { - char buffer[256]; - va_list args; - va_start(args, fmt); - hsVsnprintf(buffer, arrsize(buffer), fmt, args); - va_end(args); - - DoAssert(line, file, buffer); -} -#pragma auto_inline() - -//============================================================================ -void ErrorMinimizeAppWindow () { - #ifdef HS_BUILD_FOR_WIN32 - // If the application's topmost window is a fullscreen - // popup window, minimize it before displaying an error - HWND appWindow = GetActiveWindow(); - if ( ((GetWindowLong(appWindow, GWL_STYLE) & WS_POPUP) != 0) ) - SetWindowPos( - appWindow, - HWND_NOTOPMOST, - 0, 0, // position - 0, 0, // size - SWP_HIDEWINDOW | SWP_NOMOVE | SWP_NOSIZE - ); - #endif -} - -//============================================================================ -bool ErrorSetOption (EErrorOption option, bool on) { - SWAP(s_options[option], on); - if (option == kErrOptDisableMemLeakChecking) - MemSetLeakChecking(on); // reverse logic, so use prev value - return on; -} - -//============================================================================ -bool ErrorGetOption (EErrorOption option) { - return s_options[option]; -} - -//============================================================================ -bool DebugIsDebuggerPresent () { - bool status = false; - -#ifdef HS_BUILD_FOR_WIN32 - status = 0 != IsDebuggerPresent(); -#endif - - return status; -} - -//============================================================================ -void DebugBreakIfDebuggerPresent () { -#ifdef HS_DEBUGGING - // try breakpoint? - if (s_skipBreak) - return; - - __try { - // break into debugger - #ifdef _M_IX86 - __asm int 3 - #else - __debugbreak(); - #endif - } - __except(EXCEPTION_EXECUTE_HANDLER) { - // debugger not present, stop attempting breaks - s_skipBreak = true; - } -#endif -} - -//============================================================================ -void DebugMsgV (const char fmt[], va_list args) { -#ifdef HS_DEBUGGING - - // Don't bother with debug output if no debugger attached - if (!DebugIsDebuggerPresent()) - return; - - char msg[512]; - hsVsnprintf(msg, arrsize(msg), fmt, args); - - // MsDev trashes strings with colons in them; replace with period instead - for (char * ptr = msg; *ptr; ++ptr) { - if (*ptr == ':') - *ptr = '.'; - } - - // Too many threads printing to OutputDebugString causes bizarre - // results in developer studio; use critsect to serialize writes - if (s_critsect) - s_critsect->Enter(); - - #ifdef HS_BUILD_FOR_WIN32 - - OutputDebugStringA(msg); - OutputDebugStringA("\n"); - - #else - - fprintf(stdout, msg); - fprintf(stdout, "\n"); - - #endif - - if (s_critsect) - s_critsect->Leave(); - -#endif -} - -//============================================================================ -void CDECL DebugMsg (const char fmt[], ...) { -#ifdef HS_DEBUGGING - - va_list args; - va_start(args, fmt); - DebugMsgV(fmt, args); - va_end(args); - -#endif -} diff --git a/Sources/Plasma/CoreLibExe/hsExeMalloc.cpp b/Sources/Plasma/CoreLibExe/hsExeMalloc.cpp deleted file mode 100644 index cb905b1f..00000000 --- a/Sources/Plasma/CoreLibExe/hsExeMalloc.cpp +++ /dev/null @@ -1,638 +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 . - -Additional permissions under GNU GPL version 3 section 7 - -If you modify this Program, or any covered work, by linking or -combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK, -NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent -JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK -(or a modified version of those libraries), -containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA, -PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG -JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the -licensors of this Program grant you additional -permission to convey the resulting work. Corresponding Source for a -non-source form of such a combination shall include the source code for -the parts of OpenSSL and IJG JPEG Library used as well as that of the covered -work. - -You can contact Cyan Worlds, Inc. by email legal@cyan.com - or by snail mail at: - Cyan Worlds, Inc. - 14617 N Newport Hwy - Mead, WA 99021 - -*==LICENSE==*/ -/***************************************************************************** -* -* $/Plasma20/Sources/Plasma/CoreLibExe/hsExeMalloc.cpp -* -***/ - -#include "Pch.h" -#pragma hdrstop - - -/**************************************************************************** -* -* Local constants -* -***/ - -#if defined(NO_MEM_TRACKER) || !defined(HS_FIND_MEM_LEAKS) || !defined(HS_BUILD_FOR_WIN32) || !defined(_MSC_VER) - // no mem debugging -#else -# undef MEM_DEBUG -# define MEM_DEBUG -#endif - -const unsigned kMemReallocInPlaceOnly = 1<<0; -const unsigned kMemZero = 1<<1; -const unsigned kMemIgnoreBlock = 1<<2; // don't track this allocation - -#ifndef MEM_DEBUG - -# define _malloc_dbg(s, t, f, l) malloc(s) -# define _calloc_dbg(c, s, t, f, l) calloc(c, s) -# define _realloc_dbg(p, s, t, f, l) realloc(p, s) -# define _expand_dbg(p, s, t, f, l) _expand(p, s) -# define _free_dbg(p, t) free(p) -# define _msize_dbg(p, t) _msize(p) - -# ifndef _CLIENT_BLOCK -# define _CLIENT_BLOCK 0 -# endif - -# ifndef _IGNORE_BLOCK -# define _IGNORE_BLOCK 0 -# endif - -# ifndef _CRTDBG_ALLOC_MEM_DF -# define _CRTDBG_ALLOC_MEM_DF 0 -# endif - -# define SET_CRT_DEBUG_FIELD(a) -# define CLEAR_CRT_DEBUG_FIELD(a) - -#endif // !MEM_DEBUG - - -/***************************************************************************** -* -* Private data -* -***/ - -#ifdef MEM_DEBUG - #define SET_CRT_DEBUG_FIELD(a) \ - _CrtSetDbgFlag((a) | _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG)) - #define CLEAR_CRT_DEBUG_FIELD(a) \ - _CrtSetDbgFlag(~(a) & _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG)) - - // From dbgint.h - #define nNoMansLandSize 4 - typedef struct _CrtMemBlockHeader - { - struct _CrtMemBlockHeader * pBlockHeaderNext; - struct _CrtMemBlockHeader * pBlockHeaderPrev; - char * szFileName; - int nLine; - #ifdef _WIN64 - /* These items are reversed on Win64 to eliminate gaps in the struct - * and ensure that sizeof(struct)%16 == 0, so 16-byte alignment is - * maintained in the debug heap. - */ - int nBlockUse; - size_t nDataSize; - #else /* _WIN64 */ - size_t nDataSize; - int nBlockUse; - #endif /* _WIN64 */ - long lRequest; - unsigned char gap[nNoMansLandSize]; - /* followed by: - * unsigned char data[nDataSize]; - * unsigned char anotherGap[nNoMansLandSize]; - */ - } _CrtMemBlockHeader; - #define pbData(pblock) ((unsigned char *)((_CrtMemBlockHeader *)pblock + 1)) - #define pHdr(pbData) (((_CrtMemBlockHeader *)pbData)-1) - - - enum EMemFile { - kMemErr, - kMemLeaks, - kMemUsage, - kMemAllocs, - kNumMemFiles - }; - - static char * s_memFilename[kNumMemFiles] = { - "MemErr.log", - "MemLeaks.log", - "MemUsage.log", - "MemAllocs.log", - }; - - static char * s_memDlgTitle[kNumMemFiles] = { - "Memory error", - "Memory leak", - nil, - nil, - }; - - static HANDLE s_memFile[kNumMemFiles] = { - INVALID_HANDLE_VALUE, - INVALID_HANDLE_VALUE, - INVALID_HANDLE_VALUE, - INVALID_HANDLE_VALUE, - }; - - struct MemDumpParam { - EMemFile file; - bool showDialog; - }; - - static unsigned s_memColor; - static unsigned s_memCheckOff; - - static CCritSect * s_critsect; - -#endif // MEM_DEBUG - - - -namespace ExeMalloc { -/***************************************************************************** -* -* Internal functions -* -***/ - -//=========================================================================== -#ifdef MEM_DEBUG -static void ConvertFilename ( - const char src[], - unsigned chars, - char * dst -) { - - // Because the filename field may point into a DLL that has been - // unloaded, this code validates and converts the string into a - // reasonable value - __try { - unsigned pos = 0; - for (;;) { - // If the file name is too long then assume it is bogus - if (pos >= chars) { - pos = 0; - break; - } - - // Get the next character - unsigned chr = src[pos]; - if (!chr) - break; - - // If the character isn't valid low-ASCII - // then assume that the name is bogus - if ((chr < 32) || (chr > 127)) { - pos = 0; - break; - } - - // Store character - dst[pos++] = (char) chr; - } - - // Ensure that name is terminated - dst[pos] = 0; - } - __except(EXCEPTION_EXECUTE_HANDLER) { - dst[0] = 0; - } - - // Print the address of the filename; it may be of some - // use given the load address and the map file of the DLL - if (!dst[0]) - snprintf(dst, chars, "@%p", src); -} -#endif // MEM_DEBUG - -//=========================================================================== -#ifdef MEM_DEBUG -static void OpenErrorFile (EMemFile file) { - ASSERT(INVALID_HANDLE_VALUE == s_memFile[file]); - s_memFile[file] = CreateFile( - s_memFilename[file], - GENERIC_WRITE, - FILE_SHARE_READ, - (LPSECURITY_ATTRIBUTES) NULL, - CREATE_ALWAYS, - FILE_ATTRIBUTE_NORMAL, - NULL - ); -} -#endif // MEM_DEBUG - -//=========================================================================== -#ifdef MEM_DEBUG -static void __cdecl ReportMem (EMemFile file, bool showDialog, const char fmt[], ...) { - - if (s_memFile[file] == INVALID_HANDLE_VALUE) { - DebugBreakIfDebuggerPresent(); - OpenErrorFile(file); - ErrorMinimizeAppWindow(); - } - - char buffer[512]; - va_list args; - va_start(args, fmt); - DWORD length = hsVsnprintf(buffer, arrsize(buffer), fmt, args); - va_end(args); - - #ifdef HS_BUILD_FOR_WIN32 - - OutputDebugStringA(buffer); - - if (s_memFile[file] != INVALID_HANDLE_VALUE) - WriteFile(s_memFile[file], buffer, length, &length, NULL); - - static bool s_skip; - if (showDialog && !s_skip && !ErrorGetOption(kErrOptNonGuiAsserts)) { - s_skip = IDOK != MessageBox( - NULL, - buffer, - s_memDlgTitle[file], - MB_ICONSTOP | MB_SETFOREGROUND | MB_TASKMODAL | MB_OKCANCEL - ); - } - - #else - - fputs(buffer, stderr); - - #endif -} -#endif - -//============================================================================ -#ifdef MEM_DEBUG -static void __cdecl MemDumpCallback (void * mem, void * param) { - const _CrtMemBlockHeader * pHead = pHdr(mem); - MemDumpParam * dumpParam = (MemDumpParam *) param; - - char filename[MAX_PATH]; - ConvertFilename( - pHead->szFileName, - arrsize(filename), - filename - ); - - // HACK: Don't report array memory leaks since these underly the hash - // table type and may not be cleaned up until after the mem leak - // checker runs. =( - if (strstr(filename, "pnUtArray")) - return; - - ReportMem( - dumpParam->file, - dumpParam->showDialog, - "Offset %p size %u at %s:%d\r\n", - mem, - pHead->nDataSize, - filename, - pHead->nLine - ); -} -#endif // MEM_DEBUG - -//============================================================================ -#ifdef MEM_DEBUG -static void __cdecl OnExitMemDumpCallback (void * mem, size_t) { - static MemDumpParam param = { kMemLeaks, true }; - if (!ErrorGetOption(kErrOptDisableMemLeakChecking)) - MemDumpCallback(mem, ¶m); -} -#endif // MEM_DEBUG - -//=========================================================================== -#ifdef MEM_DEBUG -static void __cdecl CheckLeaksOnExit () { - if (!ErrorGetOption(kErrOptDisableMemLeakChecking)) { - MemDumpParam param; - param.file = kMemLeaks; - param.showDialog = true; - _CrtDoForAllClientObjects(MemDumpCallback, ¶m); - } -} -#endif // MEM_DEBUG - -//============================================================================ -#ifdef MEM_DEBUG -static int __cdecl CrtAllocHook ( - int method, - void * pUserData, - size_t nSize, - int nBlockUse, - long lRequest, - const unsigned char * szFileName, - int nLine -) { - if (nBlockUse == _NORMAL_BLOCK) { - int xx = 0; - } - - return 1; -} -#endif // MEM_DEBUG - -//=========================================================================== -#ifdef MEM_DEBUG -AUTO_INIT_FUNC(hsExeMallocInit) { - // The critical section has to be initialized - // before program startup and never freed - static byte rawMemory[sizeof CCritSect]; - s_critsect = new(rawMemory) CCritSect; - SET_CRT_DEBUG_FIELD(_CRTDBG_LEAK_CHECK_DF); - _CrtSetAllocHook(CrtAllocHook); - _CrtSetDumpClient(OnExitMemDumpCallback); -// atexit(CheckLeaksOnExit); -} -#endif // MEM_DEBUG - - -/***************************************************************************** -* -* Module functions -* -***/ - -//============================================================================ -void MemSetLeakChecking (bool on) { - if (on) - SET_CRT_DEBUG_FIELD(_CRTDBG_LEAK_CHECK_DF); - else - CLEAR_CRT_DEBUG_FIELD(_CRTDBG_LEAK_CHECK_DF); -} - - -} using namespace ExeMalloc; -/**************************************************************************** -* -* Exports -* -***/ - -//============================================================================ -void MemDumpAllocReport () { -#ifdef MEM_DEBUG - MemDumpParam param; - param.file = kMemAllocs; - param.showDialog = true; - _CrtDoForAllClientObjects(MemDumpCallback, ¶m); -#endif // MEM_DEBUG -} - -//============================================================================ -void MemDumpUsageReport () { -#ifdef MEM_DEBUG -#endif // MEM_DEBUG -} - -//============================================================================ -void MemValidateNow () { -#ifdef MEM_DEBUG -#endif // MEM_DEBUG -} - -//============================================================================ -void MemSetValidation (unsigned on) { -#ifdef MEM_DEBUG -#endif // MEM_DEBUG -} - -//============================================================================ -void MemPushDisableTracking () { - -#ifdef MEM_DEBUG - ++s_memCheckOff; -#endif // MEM_DEBUG -} - -//============================================================================ -void MemPopDisableTracking () { - -#ifdef MEM_DEBUG - ASSERT(s_memCheckOff); - --s_memCheckOff; -#endif // MEM_DEBUG -} - -//============================================================================ -void MemSetColor (unsigned short color) { -#ifdef MEM_DEBUG - s_memColor = color & 0xFFFF; -#endif // MEM_DEBUG -} - -//=========================================================================== -void * MemAlloc (unsigned bytes, unsigned flags, const char file[], int line) { - -#ifdef MEM_DEBUG - unsigned block; - if (flags & kMemIgnoreBlock || s_memCheckOff) - block = _IGNORE_BLOCK; - else - block = _CLIENT_BLOCK | (s_memColor << 16); -#endif // MEM_DEBUG - -#ifdef MEM_DEBUG - if (s_critsect) - s_critsect->Enter(); - if (block == _IGNORE_BLOCK) - CLEAR_CRT_DEBUG_FIELD(_CRTDBG_ALLOC_MEM_DF); -#endif - - void * ptr = (flags & kMemZero) - ? _calloc_dbg(bytes, 1, block, file, line) - : _malloc_dbg(bytes, block, file, line); - -#ifdef MEM_DEBUG - if (block == _IGNORE_BLOCK) - SET_CRT_DEBUG_FIELD(_CRTDBG_ALLOC_MEM_DF); - if (s_critsect) - s_critsect->Leave(); -#endif - - if (!ptr) - ErrorFatal(__LINE__, __FILE__, "Out of memory"); - - // In debug mode ensure that memory is initialized to some freaky value - #ifdef HS_DEBUGGING - if (! (flags & kMemZero)) - MemSet(ptr, (byte) ((unsigned_ptr)ptr >> 4), bytes); - #endif - -#ifdef _MSC_VER - // Compiler specific: - // Adding this line causes MSVC to stop assuming that memory allocation - // can fail thus producing more efficient assembler code. - __assume(ptr); -#endif - - // return the allocated buffer - return ptr; -} - -//============================================================================ -void MemFree (void * ptr, unsigned flags) { - if (!ptr) - return; - -#ifdef MEM_DEBUG - const _CrtMemBlockHeader * pHead = pHdr(ptr); - unsigned block = pHead->nBlockUse; -#endif // MEM_DEBUG - - _free_dbg(ptr, block); -} - -//=========================================================================== -void * MemRealloc (void * ptr, unsigned bytes, unsigned flags, const char file[], int line) { - #ifdef HS_DEBUGGING - unsigned oldBytes = ptr ? MemSize(ptr) : 0; - #endif - -#ifdef MEM_DEBUG - unsigned block; - if (flags & kMemIgnoreBlock || s_memCheckOff) - block = _IGNORE_BLOCK; - else - block = _CLIENT_BLOCK | (s_memColor << 16); -#endif - - void * newPtr = nil; - -#ifdef MEM_DEBUG - if (s_critsect) - s_critsect->Enter(); - if (block == _IGNORE_BLOCK) - CLEAR_CRT_DEBUG_FIELD(_CRTDBG_ALLOC_MEM_DF); -#endif - - for (;;) { - if (flags & kMemReallocInPlaceOnly) { -#ifndef MEM_DEBUG - break; -#else - newPtr = _expand_dbg(ptr, bytes, block, file, line); - - // expand can succeed without making the block big enough -- check for this case! - if (!newPtr || _msize_dbg(newPtr, block) < bytes) - break; -#endif // MEM_DEBUG - } - else if (!bytes) { - newPtr = _malloc_dbg(0, block, file, line); - _free_dbg(ptr, block); - } - else { - newPtr = _realloc_dbg(ptr, bytes, block, file, line); - } - - if (!newPtr) - ErrorFatal(__LINE__, __FILE__, "Out of memory"); - - break; - } - -#ifdef MEM_DEBUG - if (block == _IGNORE_BLOCK) - SET_CRT_DEBUG_FIELD(_CRTDBG_ALLOC_MEM_DF); - if (s_critsect) - s_critsect->Leave(); -#endif - - /* This code doesn't work because the memory manager may have "rounded" the size - * of a previous allocation upward to keep it aligned. Therefore, the tail of - * the memory block may be initialized with garbage instead of zeroes, and the - * realloc call actually copied that memory. - if ((bytes > oldBytes) && (flags & kMemZero)) - MemZero((byte *)newPtr + oldBytes, bytes - oldBytes); - */ - ASSERT(!(flags & kMemZero)); - - // In debug mode ensure that memory is initialized to some freaky value - #ifdef HS_DEBUGGING - if ((bytes > oldBytes) && !(flags & kMemZero)) - MemSet((byte *)newPtr + oldBytes, (byte) ((unsigned_ptr) newPtr >> 4), bytes - oldBytes); - #endif - - return newPtr; -} - -//=========================================================================== -unsigned MemSize (void * ptr) { - ASSERT(ptr); - unsigned result = 0; - -#ifdef MEM_DEBUG - const _CrtMemBlockHeader * pHead = pHdr(ptr); - unsigned block = pHead->nBlockUse; -#endif - -#if HS_BUILD_FOR_WIN32 - result = (unsigned)_msize_dbg(ptr, block); -#endif - return result; -} - - -//=========================================================================== -int MemCmp (const void * buf1, const void * buf2, unsigned bytes) { - return memcmp(buf1, buf2, bytes); -} - -//=========================================================================== -void MemCopy (void * dest, const void * source, unsigned bytes) { - memcpy(dest, source, bytes); -} - -//=========================================================================== -void MemMove (void * dest, const void * source, unsigned bytes) { - memmove(dest, source, bytes); -} - -//=========================================================================== -void MemSet (void * dest, unsigned value, unsigned bytes) { - memset(dest, value, bytes); -} - -//=========================================================================== -void MemZero (void * dest, unsigned bytes) { - memset(dest, 0, bytes); -} - -//=========================================================================== -void * MemDup (const void * ptr, unsigned bytes, unsigned flags, const char file[], int line) { - void * dst = MemAlloc(bytes, flags, file, line); - MemCopy(dst, ptr, bytes); - return dst; -} diff --git a/Sources/Plasma/FeatureLib/pfAnimation/pfObjectFlocker.cpp b/Sources/Plasma/FeatureLib/pfAnimation/pfObjectFlocker.cpp index 6ee677b3..63b45a86 100644 --- a/Sources/Plasma/FeatureLib/pfAnimation/pfObjectFlocker.cpp +++ b/Sources/Plasma/FeatureLib/pfAnimation/pfObjectFlocker.cpp @@ -39,7 +39,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com Mead, WA 99021 *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "hsStlUtils.h" #include "hsMatrix44.h" #include "hsGeometry3.h" @@ -496,7 +496,7 @@ pfBoid::~pfBoid() // delete this boid's token in the proximity database delete fProximityToken; - plLoadCloneMsg* msg = TRACKED_NEW plLoadCloneMsg(fObjKey, fFlockerPtr->GetKey(), 0, false); + plLoadCloneMsg* msg = new plLoadCloneMsg(fObjKey, fFlockerPtr->GetKey(), 0, false); msg->Send(); } @@ -790,7 +790,7 @@ fMaxForce(10.0f), fMaxSpeed(5.0f), fMinSpeed(4.0f) { - fDatabase = TRACKED_NEW pfBasicProximityDatabase(); + fDatabase = new pfBasicProximityDatabase(); } pfFlock::~pfFlock() @@ -886,7 +886,7 @@ void pfFlock::Update(plSceneObject *goal, float deltaTime) void pfFlock::AddBoid(pfObjectFlocker *flocker, plKey &key, hsPoint3 &pos) { - pfBoid *newBoid = TRACKED_NEW pfBoid(*fDatabase, flocker, key, pos); + pfBoid *newBoid = new pfBoid(*fDatabase, flocker, key, pos); newBoid->SetGoalWeight(fGoalWeight); newBoid->SetWanderWeight(fRandomWeight); @@ -924,7 +924,7 @@ pfObjectFlocker::~pfObjectFlocker() plgDispatch::Dispatch()->UnRegisterForExactType(plEvalMsg::Index(), GetKey()); } -void pfObjectFlocker::SetNumBoids(UInt8 val) +void pfObjectFlocker::SetNumBoids(uint8_t val) { fNumBoids = val; } @@ -934,7 +934,7 @@ hsBool pfObjectFlocker::MsgReceive(plMessage* msg) plInitialAgeStateLoadedMsg* loadMsg = plInitialAgeStateLoadedMsg::ConvertNoRef(msg); if (loadMsg) { - plEnableMsg* pMsg = TRACKED_NEW plEnableMsg; + plEnableMsg* pMsg = new plEnableMsg; pMsg->AddReceiver(fBoidKey); pMsg->SetCmd(plEnableMsg::kDrawable); pMsg->AddType(plEnableMsg::kDrawable); @@ -945,13 +945,13 @@ hsBool pfObjectFlocker::MsgReceive(plMessage* msg) hsPoint3 pos(fTarget->GetLocalToWorld().GetTranslate()); for (int i = 0; i < fNumBoids; i++) { - plLoadCloneMsg* cloneMsg = TRACKED_NEW plLoadCloneMsg(fBoidKey->GetUoid(), GetKey(), 0); + plLoadCloneMsg* cloneMsg = new plLoadCloneMsg(fBoidKey->GetUoid(), GetKey(), 0); plKey newKey = cloneMsg->GetCloneKey(); cloneMsg->Send(); - hsScalar xAdjust = (2 * RAND()) - 1; // produces a random number between -1 and 1 - hsScalar yAdjust = (2 * RAND()) - 1; - hsScalar zAdjust = (2 * RAND()) - 1; + float xAdjust = (2 * RAND()) - 1; // produces a random number between -1 and 1 + float yAdjust = (2 * RAND()) - 1; + float zAdjust = (2 * RAND()) - 1; hsPoint3 boidPos(pos.fX + xAdjust, pos.fY + yAdjust, pos.fZ + zAdjust); fFlock.AddBoid(this, newKey, boidPos); } @@ -966,7 +966,7 @@ hsBool pfObjectFlocker::MsgReceive(plMessage* msg) { if (fRandomizeAnimationStart) { - plAnimCmdMsg* pMsg = TRACKED_NEW plAnimCmdMsg; + plAnimCmdMsg* pMsg = new plAnimCmdMsg; pMsg->SetSender(GetKey()); pMsg->SetBCastFlag(plMessage::kPropagateToModifiers | plMessage::kPropagateToChildren); pMsg->AddReceiver( lcMsg->GetCloneKey() ); @@ -979,7 +979,7 @@ hsBool pfObjectFlocker::MsgReceive(plMessage* msg) return plSingleModifier::MsgReceive(msg); } -hsBool pfObjectFlocker::IEval(double secs, hsScalar del, UInt32 dirty) +hsBool pfObjectFlocker::IEval(double secs, float del, uint32_t dirty) { fFlock.Update(fTarget, del); diff --git a/Sources/Plasma/FeatureLib/pfAnimation/pfObjectFlocker.h b/Sources/Plasma/FeatureLib/pfAnimation/pfObjectFlocker.h index d072c359..abc1a0a4 100644 --- a/Sources/Plasma/FeatureLib/pfAnimation/pfObjectFlocker.h +++ b/Sources/Plasma/FeatureLib/pfAnimation/pfObjectFlocker.h @@ -126,7 +126,7 @@ public: virtual ~pfBasicProximityDatabase() {} // allocate a token to represent a given client object in this database - tokenType *MakeToken(T parentObject) {return TRACKED_NEW tokenType(parentObject, fGroup);} + tokenType *MakeToken(T parentObject) {return new tokenType(parentObject, fGroup);} // return the number of tokens currently in the database int Size(void) {return fGroup.size();} @@ -408,7 +408,7 @@ public: virtual void Read(hsStream* stream, hsResMgr* mgr); virtual void Write(hsStream* stream, hsResMgr* mgr); - void SetNumBoids(UInt8 val); + void SetNumBoids(uint8_t val); void SetBoidKey(plKey key) { fBoidKey = key; } float GoalWeight() const {return fFlock.GoalWeight();} @@ -448,7 +448,7 @@ protected: hsBool fUseTargetRotation; hsBool fRandomizeAnimationStart; - virtual hsBool IEval(double secs, hsScalar del, UInt32 dirty); + virtual hsBool IEval(double secs, float del, uint32_t dirty); }; #endif diff --git a/Sources/Plasma/FeatureLib/pfAnimation/plBlower.cpp b/Sources/Plasma/FeatureLib/pfAnimation/plBlower.cpp index 2c1c62a0..29338845 100644 --- a/Sources/Plasma/FeatureLib/pfAnimation/plBlower.cpp +++ b/Sources/Plasma/FeatureLib/pfAnimation/plBlower.cpp @@ -40,7 +40,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "plBlower.h" #include "plgDispatch.h" #include "hsFastMath.h" @@ -51,13 +51,13 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com plRandom plBlower::fRandom; -static const hsScalar kDefaultMasterPower = 20.f; -static const hsScalar kDefaultMasterFrequency = 2.f; -static const hsScalar kDefaultDirectRate = 1.f; -static const hsScalar kDefaultImpulseRate = 1.e2f; -static const hsScalar kDefaultSpringKonst = 20.f; -static const hsScalar kDefaultBias = 0.25f; -static const hsScalar kInitialMaxOffDist = 1.f; +static const float kDefaultMasterPower = 20.f; +static const float kDefaultMasterFrequency = 2.f; +static const float kDefaultDirectRate = 1.f; +static const float kDefaultImpulseRate = 1.e2f; +static const float kDefaultSpringKonst = 20.f; +static const float kDefaultBias = 0.25f; +static const float kInitialMaxOffDist = 1.f; plBlower::plBlower() : @@ -82,7 +82,7 @@ plBlower::~plBlower() { } -void plBlower::IBlow(double secs, hsScalar delSecs) +void plBlower::IBlow(double secs, float delSecs) { hsPoint3 worldPos = fTarget->GetLocalToWorld().GetTranslate(); hsPoint3 localPos = fTarget->GetLocalToParent().GetTranslate(); @@ -93,13 +93,13 @@ void plBlower::IBlow(double secs, hsScalar delSecs) // Strength = Strength + rnd01 * (MaxStrength - Strength) - hsScalar t = (fAccumTime += delSecs); + float t = (fAccumTime += delSecs); - hsScalar strength = 0; + float strength = 0; int i; for( i = 0; i < fOscillators.GetCount(); i++ ) { - hsScalar c, s; + float c, s; t *= fOscillators[i].fFrequency * fMasterFrequency; t += fOscillators[i].fPhase; hsFastMath::SinCosAppr(t, s, c); @@ -116,25 +116,25 @@ void plBlower::IBlow(double secs, hsScalar delSecs) hsFastMath::NormalizeAppr(fDirection); - hsScalar offDist = hsVector3(&fRestPos, &worldPos).Magnitude(); + float offDist = hsVector3(&fRestPos, &worldPos).Magnitude(); if( offDist > fMaxOffsetDist ) fMaxOffsetDist = offDist; hsVector3 force = fDirection * strength; - static hsScalar kOffsetDistFrac = 0.5f; // make me const + static float kOffsetDistFrac = 0.5f; // make me const if( offDist > fMaxOffsetDist * kOffsetDistFrac ) { offDist /= fMaxOffsetDist; offDist *= fMasterPower; - hsScalar impulse = offDist * delSecs * fImpulseRate; + float impulse = offDist * delSecs * fImpulseRate; force.fX += impulse * fRandom.RandMinusOneToOne(); force.fY += impulse * fRandom.RandMinusOneToOne(); force.fZ += impulse * fRandom.RandMinusOneToOne(); } - const hsScalar kOffsetDistDecay = 0.999f; + const float kOffsetDistDecay = 0.999f; fMaxOffsetDist *= kOffsetDistDecay; hsVector3 accel = force; @@ -145,9 +145,9 @@ void plBlower::IBlow(double secs, hsScalar delSecs) fCurrDel = del; } -hsBool plBlower::IEval(double secs, hsScalar delSecs, UInt32 dirty) +hsBool plBlower::IEval(double secs, float delSecs, uint32_t dirty) { - const hsScalar kMaxDelSecs = 0.1f; + const float kMaxDelSecs = 0.1f; if( delSecs > kMaxDelSecs ) delSecs = kMaxDelSecs; IBlow(secs, delSecs); @@ -212,20 +212,20 @@ void plBlower::Write(hsStream* s, hsResMgr* mgr) void plBlower::IInitOscillators() { - const hsScalar kBasePower = 5.f; + const float kBasePower = 5.f; fOscillators.SetCount(5); int i; for( i = 0; i < fOscillators.GetCount(); i++ ) { - hsScalar fi = hsScalar(i+1); - fOscillators[i].fFrequency = fi / hsScalarPI * fRandom.RandRangeF(0.75f, 1.25f); -// fOscillators[i].fFrequency = 1.f / hsScalarPI * fRandom.RandRangeF(0.5f, 1.5f); + float fi = float(i+1); + fOscillators[i].fFrequency = fi / M_PI * fRandom.RandRangeF(0.75f, 1.25f); +// fOscillators[i].fFrequency = 1.f / M_PI * fRandom.RandRangeF(0.5f, 1.5f); fOscillators[i].fPhase = fRandom.RandZeroToOne(); fOscillators[i].fPower = kBasePower * fRandom.RandRangeF(0.75f, 1.25f); } } -void plBlower::SetConstancy(hsScalar f) +void plBlower::SetConstancy(float f) { if( f < 0 ) f = 0; @@ -235,7 +235,7 @@ void plBlower::SetConstancy(hsScalar f) fBias = f; } -hsScalar plBlower::GetConstancy() const +float plBlower::GetConstancy() const { return fBias; } diff --git a/Sources/Plasma/FeatureLib/pfAnimation/plBlower.h b/Sources/Plasma/FeatureLib/pfAnimation/plBlower.h index 11892b3c..e8318e0b 100644 --- a/Sources/Plasma/FeatureLib/pfAnimation/plBlower.h +++ b/Sources/Plasma/FeatureLib/pfAnimation/plBlower.h @@ -58,21 +58,21 @@ protected: class Oscillator { public: - hsScalar fFrequency; - hsScalar fPhase; - hsScalar fPower; + float fFrequency; + float fPhase; + float fPower; }; static plRandom fRandom; // Parameters - hsScalar fMasterPower; - hsScalar fMasterFrequency; - hsScalar fDirectRate; - hsScalar fImpulseRate; - hsScalar fSpringKonst; - hsScalar fBias; - - hsScalar fAccumTime; + float fMasterPower; + float fMasterFrequency; + float fDirectRate; + float fImpulseRate; + float fSpringKonst; + float fBias; + + float fAccumTime; hsTArray fOscillators; // CurrentState @@ -80,13 +80,13 @@ protected: hsPoint3 fRestPos; hsPoint3 fLocalRestPos; hsVector3 fCurrDel; - hsScalar fMaxOffsetDist; + float fMaxOffsetDist; void IInitOscillators(); void ISetTargetTransform(); - void IBlow(double secs, hsScalar delSecs); + void IBlow(double secs, float delSecs); - virtual hsBool IEval(double secs, hsScalar del, UInt32 dirty); + virtual hsBool IEval(double secs, float del, uint32_t dirty); public: ~plBlower(); plBlower(); @@ -99,19 +99,19 @@ public: virtual void Read(hsStream* stream, hsResMgr* mgr); virtual void Write(hsStream* stream, hsResMgr* mgr); - void SetMasterPower(hsScalar f) { fMasterPower = f; } - void SetMasterFrequency(hsScalar f) { fMasterFrequency = f; } - void SetDirectRate(hsScalar f) { fDirectRate = f; } - void SetImpulseRate(hsScalar f) { fImpulseRate = f; } - void SetSpringKonst(hsScalar f) { fSpringKonst = f; } - void SetConstancy(hsScalar f); - - hsScalar GetMasterPower() const { return fMasterPower; } - hsScalar GetMasterFrequency() const { return fMasterFrequency; } - hsScalar GetDirectRate() const { return fDirectRate; } - hsScalar GetImpulseRate() const { return fImpulseRate; } - hsScalar GetSpringKonst() const { return fSpringKonst; } - hsScalar GetConstancy() const; + void SetMasterPower(float f) { fMasterPower = f; } + void SetMasterFrequency(float f) { fMasterFrequency = f; } + void SetDirectRate(float f) { fDirectRate = f; } + void SetImpulseRate(float f) { fImpulseRate = f; } + void SetSpringKonst(float f) { fSpringKonst = f; } + void SetConstancy(float f); + + float GetMasterPower() const { return fMasterPower; } + float GetMasterFrequency() const { return fMasterFrequency; } + float GetDirectRate() const { return fDirectRate; } + float GetImpulseRate() const { return fImpulseRate; } + float GetSpringKonst() const { return fSpringKonst; } + float GetConstancy() const; }; #endif // plBlower_inc diff --git a/Sources/Plasma/FeatureLib/pfAnimation/plFilterCoordInterface.cpp b/Sources/Plasma/FeatureLib/pfAnimation/plFilterCoordInterface.cpp index 1ec19ed5..71e922d2 100644 --- a/Sources/Plasma/FeatureLib/pfAnimation/plFilterCoordInterface.cpp +++ b/Sources/Plasma/FeatureLib/pfAnimation/plFilterCoordInterface.cpp @@ -40,7 +40,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "plFilterCoordInterface.h" #include "hsMatrix44.h" @@ -50,7 +50,7 @@ static hsMatrix44* InvTRS(const hsMatrix44& trs, hsMatrix44& inv) { inv.NotIdentity(); - hsScalar invSSq[3]; + float invSSq[3]; invSSq[0] = 1.f / (trs.fMap[0][0] * trs.fMap[0][0] + trs.fMap[1][0] * trs.fMap[1][0] + trs.fMap[2][0] * trs.fMap[2][0]); invSSq[1] = 1.f / (trs.fMap[0][1] * trs.fMap[0][1] + trs.fMap[1][1] * trs.fMap[1][1] + trs.fMap[2][1] * trs.fMap[2][1]); invSSq[2] = 1.f / (trs.fMap[0][2] * trs.fMap[0][2] + trs.fMap[1][2] * trs.fMap[1][2] + trs.fMap[2][2] * trs.fMap[2][2]); diff --git a/Sources/Plasma/FeatureLib/pfAnimation/plFilterCoordInterface.h b/Sources/Plasma/FeatureLib/pfAnimation/plFilterCoordInterface.h index 76147b34..5ffc2df3 100644 --- a/Sources/Plasma/FeatureLib/pfAnimation/plFilterCoordInterface.h +++ b/Sources/Plasma/FeatureLib/pfAnimation/plFilterCoordInterface.h @@ -58,7 +58,7 @@ public: kNoNothing = kNoRotation | kNoMove }; protected: - UInt32 fFilterMask; + uint32_t fFilterMask; hsMatrix44 fRefParentLocalToWorld; virtual void IRecalcTransforms(); @@ -73,8 +73,8 @@ public: virtual void Write(hsStream* stream, hsResMgr* mgr); - void SetFilterMask(UInt32 f) { fFilterMask = f; } - UInt32 GetFilterMask() const { return fFilterMask; } + void SetFilterMask(uint32_t f) { fFilterMask = f; } + uint32_t GetFilterMask() const { return fFilterMask; } void SetRefLocalToWorld(const hsMatrix44& m) { fRefParentLocalToWorld = m; } const hsMatrix44& GetRefLocalToWorld() const { return fRefParentLocalToWorld; } diff --git a/Sources/Plasma/FeatureLib/pfAnimation/plFollowMod.cpp b/Sources/Plasma/FeatureLib/pfAnimation/plFollowMod.cpp index c0b627cd..6856e095 100644 --- a/Sources/Plasma/FeatureLib/pfAnimation/plFollowMod.cpp +++ b/Sources/Plasma/FeatureLib/pfAnimation/plFollowMod.cpp @@ -40,7 +40,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "plFollowMod.h" #include "plgDispatch.h" #include "pnNetCommon/plNetApp.h" @@ -218,7 +218,7 @@ void plFollowMod::IMoveTarget() GetTarget()->SetTransform(l2w, w2l); } -hsBool plFollowMod::IEval(double secs, hsScalar del, UInt32 dirty) +hsBool plFollowMod::IEval(double secs, float del, uint32_t dirty) { if( ICheckLeader() ) IMoveTarget(); @@ -281,7 +281,7 @@ void plFollowMod::Read(hsStream* stream, hsResMgr* mgr) fLeaderType = FollowLeaderType(stream->ReadByte()); fMode = stream->ReadByte(); - mgr->ReadKeyNotifyMe(stream, TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnCreate, 0, kRefLeader), plRefFlags::kActiveRef); + mgr->ReadKeyNotifyMe(stream, new plGenRefMsg(GetKey(), plRefMsg::kOnCreate, 0, kRefLeader), plRefFlags::kActiveRef); // If active? Activate(); diff --git a/Sources/Plasma/FeatureLib/pfAnimation/plFollowMod.h b/Sources/Plasma/FeatureLib/pfAnimation/plFollowMod.h index ac4ab21d..fb24e08e 100644 --- a/Sources/Plasma/FeatureLib/pfAnimation/plFollowMod.h +++ b/Sources/Plasma/FeatureLib/pfAnimation/plFollowMod.h @@ -76,8 +76,8 @@ public: }; protected: FollowLeaderType fLeaderType; - UInt8 fMode; - UInt8 fLeaderSet; + uint8_t fMode; + uint8_t fLeaderSet; plSceneObject* fLeader; // may be nil if Leader isn't a sceneobject @@ -87,7 +87,7 @@ protected: hsBool ICheckLeader(); void IMoveTarget(); - virtual hsBool IEval(double secs, hsScalar del, UInt32 dirty); + virtual hsBool IEval(double secs, float del, uint32_t dirty); public: plFollowMod(); @@ -106,8 +106,8 @@ public: void SetType(FollowLeaderType t) { fLeaderType = t; } FollowLeaderType GetType() const { return fLeaderType; } - void SetMode(UInt8 m) { fMode = m; } - UInt8 GetMode() const { return fMode; } + void SetMode(uint8_t m) { fMode = m; } + uint8_t GetMode() const { return fMode; } void Activate(); void Deactivate(); diff --git a/Sources/Plasma/FeatureLib/pfAnimation/plLightModifier.cpp b/Sources/Plasma/FeatureLib/pfAnimation/plLightModifier.cpp index 0690a665..249650b5 100644 --- a/Sources/Plasma/FeatureLib/pfAnimation/plLightModifier.cpp +++ b/Sources/Plasma/FeatureLib/pfAnimation/plLightModifier.cpp @@ -40,7 +40,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "plLightModifier.h" #include "plGLight/plLightInfo.h" #include "plInterp/plController.h" @@ -141,7 +141,7 @@ void plLightModifier::IApplyDynamic() void plLightModifier::DefaultAnimation() { - hsScalar len = MaxAnimLength(0); + float len = MaxAnimLength(0); fTimeConvert.SetBegin(0); fTimeConvert.SetEnd(len); fTimeConvert.SetLoopPoints(0, len); @@ -149,7 +149,7 @@ void plLightModifier::DefaultAnimation() fTimeConvert.Start(); } -hsScalar plLightModifier::MaxAnimLength(hsScalar len) const +float plLightModifier::MaxAnimLength(float len) const { if( fColorCtl && (fColorCtl->GetLength() > len) ) len = fColorCtl->GetLength(); @@ -229,7 +229,7 @@ void plOmniModifier::IApplyDynamic() } } -hsScalar plOmniModifier::MaxAnimLength(hsScalar len) const +float plOmniModifier::MaxAnimLength(float len) const { len = plLightModifier::MaxAnimLength(len); if( fAttenCtl && (fAttenCtl->GetLength() > len) ) @@ -302,20 +302,20 @@ void plSpotModifier::IApplyDynamic() { plOmniModifier::IApplyDynamic(); - hsScalar f; + float f; if( fInnerCtl ) { fInnerCtl->Interp(fCurrentTime, &f); - fSpot->SetSpotInner(hsScalarDegToRad(f)*0.5f); + fSpot->SetSpotInner(hsDegreesToRadians(f)*0.5f); } if( fOuterCtl ) { fOuterCtl->Interp(fCurrentTime, &f); - fSpot->SetSpotOuter(hsScalarDegToRad(f)*0.5f); + fSpot->SetSpotOuter(hsDegreesToRadians(f)*0.5f); } } -hsScalar plSpotModifier::MaxAnimLength(hsScalar len) const +float plSpotModifier::MaxAnimLength(float len) const { len = plOmniModifier::MaxAnimLength(len); if( fInnerCtl && (fInnerCtl->GetLength() > len) ) @@ -397,7 +397,7 @@ void plLtdDirModifier::IApplyDynamic() { plLightModifier::IApplyDynamic(); - hsScalar f; + float f; if( fWidthCtl ) { fWidthCtl->Interp(fCurrentTime, &f); @@ -415,7 +415,7 @@ void plLtdDirModifier::IApplyDynamic() } } -hsScalar plLtdDirModifier::MaxAnimLength(hsScalar len) const +float plLtdDirModifier::MaxAnimLength(float len) const { len = plLightModifier::MaxAnimLength(len); if( fWidthCtl && (fWidthCtl->GetLength() > len) ) diff --git a/Sources/Plasma/FeatureLib/pfAnimation/plLightModifier.h b/Sources/Plasma/FeatureLib/pfAnimation/plLightModifier.h index 80d3edcd..540d8e7b 100644 --- a/Sources/Plasma/FeatureLib/pfAnimation/plLightModifier.h +++ b/Sources/Plasma/FeatureLib/pfAnimation/plLightModifier.h @@ -87,7 +87,7 @@ public: void SetSpecularCtl(plController* ctl) { fSpecularCtl = ctl; } virtual void DefaultAnimation(); - virtual hsScalar MaxAnimLength(hsScalar len) const; + virtual float MaxAnimLength(float len) const; }; class plOmniModifier : public plLightModifier @@ -121,7 +121,7 @@ public: void SetAttenCtl(plController* ctl) { fAttenCtl = ctl; } void SetInitAtten(const hsPoint3& p) { fInitAtten = p; } - virtual hsScalar MaxAnimLength(hsScalar len) const; + virtual float MaxAnimLength(float len) const; }; class plSpotModifier : public plOmniModifier @@ -155,7 +155,7 @@ public: void SetInnerCtl(plController* ctl) { fInnerCtl = ctl; } void SetOuterCtl(plController* ctl) { fOuterCtl = ctl; } - virtual hsScalar MaxAnimLength(hsScalar len) const; + virtual float MaxAnimLength(float len) const; }; class plLtdDirModifier : public plLightModifier @@ -191,7 +191,7 @@ public: void SetHeightCtl(plController* ctl) { fHeightCtl = ctl; } void SetDepthCtl(plController* ctl) { fDepthCtl = ctl; } - virtual hsScalar MaxAnimLength(hsScalar len) const; + virtual float MaxAnimLength(float len) const; }; #endif // plLightModifier_inc diff --git a/Sources/Plasma/FeatureLib/pfAnimation/plLineFollowMod.cpp b/Sources/Plasma/FeatureLib/pfAnimation/plLineFollowMod.cpp index 7bb48ac4..9633cc82 100644 --- a/Sources/Plasma/FeatureLib/pfAnimation/plLineFollowMod.cpp +++ b/Sources/Plasma/FeatureLib/pfAnimation/plLineFollowMod.cpp @@ -40,7 +40,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "plLineFollowMod.h" #include "plStereizer.h" #include "plInterp/plAnimPath.h" @@ -79,7 +79,7 @@ plLineFollowMod::~plLineFollowMod() delete fPath; } -void plLineFollowMod::SetSpeedClamp(hsScalar fps) +void plLineFollowMod::SetSpeedClamp(float fps) { fSpeedClamp = fps; if( fSpeedClamp > 0 ) @@ -93,7 +93,7 @@ void plLineFollowMod::SetSpeedClamp(hsScalar fps) } -void plLineFollowMod::SetOffsetFeet(hsScalar f) +void plLineFollowMod::SetOffsetFeet(float f) { fOffset = f; if( fOffset != 0 ) @@ -115,9 +115,9 @@ void plLineFollowMod::SetForceToLine(hsBool on) fFollowFlags &= ~kForceToLine; } -void plLineFollowMod::SetOffsetDegrees(hsScalar f) +void plLineFollowMod::SetOffsetDegrees(float f) { - fOffset = hsScalarDegToRad(f); + fOffset = hsDegreesToRadians(f); if( fOffset != 0 ) { fFollowFlags &= ~kOffsetFeet; @@ -130,7 +130,7 @@ void plLineFollowMod::SetOffsetDegrees(hsScalar f) } } -void plLineFollowMod::SetOffsetClamp(hsScalar f) +void plLineFollowMod::SetOffsetClamp(float f) { fOffsetClamp = f; if( fOffsetClamp > 0 ) @@ -155,20 +155,20 @@ void plLineFollowMod::Read(hsStream* stream, hsResMgr* mgr) fPath = plAnimPath::ConvertNoRef(mgr->ReadCreatable(stream)); - mgr->ReadKeyNotifyMe(stream, TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnCreate, 0, kRefParent), plRefFlags::kPassiveRef); + mgr->ReadKeyNotifyMe(stream, new plGenRefMsg(GetKey(), plRefMsg::kOnCreate, 0, kRefParent), plRefFlags::kPassiveRef); - mgr->ReadKeyNotifyMe(stream, TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnCreate, 0, kRefObject), plRefFlags::kPassiveRef); + mgr->ReadKeyNotifyMe(stream, new plGenRefMsg(GetKey(), plRefMsg::kOnCreate, 0, kRefObject), plRefFlags::kPassiveRef); int n = stream->ReadLE32(); while(n--) { - mgr->ReadKeyNotifyMe(stream, TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnCreate, 0, kRefStereizer), plRefFlags::kPassiveRef); + mgr->ReadKeyNotifyMe(stream, new plGenRefMsg(GetKey(), plRefMsg::kOnCreate, 0, kRefStereizer), plRefFlags::kPassiveRef); } - UInt32 f = stream->ReadLE32(); + uint32_t f = stream->ReadLE32(); SetFollowMode(FollowMode(f & 0xffff)); - fFollowFlags = (UInt16)((f >> 16) & 0xffff); + fFollowFlags = (uint16_t)((f >> 16) & 0xffff); if( fFollowFlags & kOffset ) { @@ -203,7 +203,7 @@ void plLineFollowMod::Write(hsStream* stream, hsResMgr* mgr) for( i = 0; i < fStereizers.GetCount(); i++ ) mgr->WriteKey(stream, fStereizers[i]->GetKey()); - UInt32 f = UInt32(fFollowMode) | (UInt32(fFollowFlags) << 16); + uint32_t f = uint32_t(fFollowMode) | (uint32_t(fFollowFlags) << 16); stream->WriteLE32(f); if( fFollowFlags & kOffset ) @@ -337,7 +337,7 @@ void plLineFollowMod::IRegister() } } -hsBool plLineFollowMod::IEval(double secs, hsScalar del, UInt32 dirty) +hsBool plLineFollowMod::IEval(double secs, float del, uint32_t dirty) { if( !fPath ) return false; @@ -366,7 +366,7 @@ hsBool plLineFollowMod::IOffsetTargetTransform(hsMatrix44& tgtXfm) hsPoint3 tgtPos = tgtXfm.GetTranslate(); hsVector3 tgt2src(&fSearchPos, &tgtPos); - hsScalar t2sLen = tgt2src.Magnitude(); + float t2sLen = tgt2src.Magnitude(); hsFastMath::NormalizeAppr(tgt2src); hsVector3 out; @@ -374,7 +374,7 @@ hsBool plLineFollowMod::IOffsetTargetTransform(hsMatrix44& tgtXfm) if( fFollowFlags & kOffsetAng ) { - hsScalar del = t2sLen * fTanOffset; + float del = t2sLen * fTanOffset; if( fFollowFlags & kOffsetClamp ) { if( del > fOffsetClamp ) @@ -409,7 +409,7 @@ hsBool plLineFollowMod::IOffsetTargetTransform(hsMatrix44& tgtXfm) hsBool plLineFollowMod::IGetTargetTransform(hsPoint3& searchPos, hsMatrix44& tgtXfm) { - hsScalar t = fPath->GetExtremePoint(searchPos); + float t = fPath->GetExtremePoint(searchPos); if( fFollowFlags & kFullMatrix ) { fPath->SetCurTime(t, plAnimPath::kNone); @@ -441,12 +441,12 @@ void plLineFollowMod::ICheckForPop(const hsPoint3& oldPos, const hsPoint3& newPo { hsVector3 del(&oldPos, &newPos); - hsScalar elapsed = hsTimer::GetDelSysSeconds(); - hsScalar speedSq = 0.f; + float elapsed = hsTimer::GetDelSysSeconds(); + float speedSq = 0.f; if (elapsed > 0.f) speedSq = del.MagnitudeSquared() / elapsed; - const hsScalar kMaxSpeedSq = 30.f * 30.f; // (feet per sec)^2 + const float kMaxSpeedSq = 30.f * 30.f; // (feet per sec)^2 if( speedSq > kMaxSpeedSq ) fFollowFlags |= kSearchPosPop; else @@ -497,7 +497,7 @@ hsBool plLineFollowMod::IGetSearchPos() return true; } -hsMatrix44 plLineFollowMod::IInterpMatrices(const hsMatrix44& m0, const hsMatrix44& m1, hsScalar parm) +hsMatrix44 plLineFollowMod::IInterpMatrices(const hsMatrix44& m0, const hsMatrix44& m1, float parm) { hsMatrix44 retVal; int i, j; @@ -524,14 +524,14 @@ hsMatrix44 plLineFollowMod::ISpeedClamp(plCoordinateInterface* ci, const hsMatri const hsPoint3 oldPos = currL2W.GetTranslate(); const hsPoint3 newPos = unclTgtXfm.GetTranslate(); const hsVector3 del(&newPos, &oldPos); - hsScalar elapsed = hsTimer::GetDelSysSeconds(); - hsScalar speed = 0.f; + float elapsed = hsTimer::GetDelSysSeconds(); + float speed = 0.f; if (elapsed > 0.f) speed = del.Magnitude() / elapsed; if( speed > fSpeedClamp ) { - hsScalar parm = fSpeedClamp / speed; + float parm = fSpeedClamp / speed; hsMatrix44 clTgtXfm = IInterpMatrices(currL2W, unclTgtXfm, parm); @@ -616,12 +616,12 @@ void plLineFollowMod::RemoveTarget(plSceneObject* so) void plLineFollowMod::AddStereizer(const plKey& key) { - hsgResMgr::ResMgr()->SendRef(plKey(key), TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnCreate, 0, kRefStereizer), plRefFlags::kPassiveRef); + hsgResMgr::ResMgr()->SendRef(plKey(key), new plGenRefMsg(GetKey(), plRefMsg::kOnCreate, 0, kRefStereizer), plRefFlags::kPassiveRef); } void plLineFollowMod::RemoveStereizer(const plKey& key) { - hsgResMgr::ResMgr()->SendRef(plKey(key), TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnRemove, 0, kRefStereizer), plRefFlags::kPassiveRef); + hsgResMgr::ResMgr()->SendRef(plKey(key), new plGenRefMsg(GetKey(), plRefMsg::kOnRemove, 0, kRefStereizer), plRefFlags::kPassiveRef); } // derived version of this class for rail cameras @@ -658,9 +658,9 @@ hsBool plRailCameraMod::IGetTargetTransform(hsPoint3& searchPos, hsMatrix44& tg return true; } -hsPoint3 plRailCameraMod::GetGoal(double secs, hsScalar speed) +hsPoint3 plRailCameraMod::GetGoal(double secs, float speed) { - hsScalar delTime; + float delTime; int dir; if (fTargetTime == fCurrentTime) return fGoal; @@ -681,7 +681,7 @@ hsPoint3 plRailCameraMod::GetGoal(double secs, hsScalar speed) if (delTime <= (secs * speed)) fCurrentTime = fTargetTime; else - fCurrentTime += (hsScalar)((secs * speed) * dir); + fCurrentTime += (float)((secs * speed) * dir); if (fPath->GetWrap()) { diff --git a/Sources/Plasma/FeatureLib/pfAnimation/plLineFollowMod.h b/Sources/Plasma/FeatureLib/pfAnimation/plLineFollowMod.h index af0445e3..e907d5e4 100644 --- a/Sources/Plasma/FeatureLib/pfAnimation/plLineFollowMod.h +++ b/Sources/Plasma/FeatureLib/pfAnimation/plLineFollowMod.h @@ -81,7 +81,7 @@ public: }; protected: FollowMode fFollowMode; - UInt16 fFollowFlags; + uint16_t fFollowFlags; plAnimPath* fPath; plSceneObject* fPathParent; @@ -92,12 +92,12 @@ protected: hsTArray fStereizers; - hsScalar fTanOffset; - hsScalar fOffset; - hsScalar fOffsetClamp; - hsScalar fSpeedClamp; + float fTanOffset; + float fOffset; + float fOffsetClamp; + float fSpeedClamp; - virtual hsBool IEval(double secs, hsScalar del, UInt32 dirty); + virtual hsBool IEval(double secs, float del, uint32_t dirty); virtual hsBool IGetSearchPos(); virtual void ISetTargetTransform(int iTarg, const hsMatrix44& tgtXfm); @@ -106,7 +106,7 @@ protected: virtual hsBool IGetTargetTransform(hsPoint3& searchPos, hsMatrix44& tgtXfm); virtual hsBool IOffsetTargetTransform(hsMatrix44& tgtXfm); virtual hsMatrix44 ISpeedClamp(plCoordinateInterface* ci, const hsMatrix44& unclTgtXfm); - hsMatrix44 IInterpMatrices(const hsMatrix44& m0, const hsMatrix44& m1, hsScalar parm); + hsMatrix44 IInterpMatrices(const hsMatrix44& m0, const hsMatrix44& m1, float parm); void ICheckForPop(const hsPoint3& oldPos, const hsPoint3& newPos); void ISetupStereizers(const plListenerMsg* listMsg); @@ -138,20 +138,20 @@ public: hsBool HasOffsetClamp() const { return 0 != (fFollowFlags & kOffsetClamp); } hsBool HasSpeedClamp() const { return 0 != (fFollowFlags & kSpeedClamp); } - void SetOffsetFeet(hsScalar f); - hsScalar GetOffsetFeet() const { return fOffset; } + void SetOffsetFeet(float f); + float GetOffsetFeet() const { return fOffset; } - void SetOffsetDegrees(hsScalar f); - hsScalar GetOffsetDegrees() const { return hsScalarRadToDeg(fOffset); } + void SetOffsetDegrees(float f); + float GetOffsetDegrees() const { return hsRadiansToDegrees(fOffset); } - void SetOffsetClamp(hsScalar f); - hsScalar GetOffsetClamp() const { return fOffsetClamp; } + void SetOffsetClamp(float f); + float GetOffsetClamp() const { return fOffsetClamp; } void SetForceToLine(hsBool on); hsBool GetForceToLine() const { return 0 != (fFollowFlags & kForceToLine); } - void SetSpeedClamp(hsScalar feetPerSec); - hsScalar GetSpeedClamp() const { return fSpeedClamp; } + void SetSpeedClamp(float feetPerSec); + float GetSpeedClamp() const { return fSpeedClamp; } hsBool MsgReceive(plMessage* msg); @@ -175,7 +175,7 @@ public: GETINTERFACE_ANY( plRailCameraMod, plLineFollowMod ); void Init() { fCurrentTime = -1; } // twiddle ourselves so we get ready to go... - hsPoint3 GetGoal(double secs, hsScalar speed); + hsPoint3 GetGoal(double secs, float speed); protected: @@ -183,8 +183,8 @@ protected: virtual hsBool IGetTargetTransform(hsPoint3& searchPos, hsMatrix44& tgtXfm); hsMatrix44 fDesiredMatrix; - hsScalar fCurrentTime; - hsScalar fTargetTime; + float fCurrentTime; + float fTargetTime; hsPoint3 fGoal; hsBool fFarthest; }; diff --git a/Sources/Plasma/FeatureLib/pfAnimation/plRandomCommandMod.cpp b/Sources/Plasma/FeatureLib/pfAnimation/plRandomCommandMod.cpp index 4ca722b2..3601316c 100644 --- a/Sources/Plasma/FeatureLib/pfAnimation/plRandomCommandMod.cpp +++ b/Sources/Plasma/FeatureLib/pfAnimation/plRandomCommandMod.cpp @@ -42,16 +42,16 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include -#include "hsTypes.h" +#include "HeadSpin.h" #include "plRandomCommandMod.h" #include "pnSceneObject/plSceneObject.h" #include "plMessage/plAnimCmdMsg.h" #include "pnMessage/plEventCallbackMsg.h" #include "plgDispatch.h" #include "hsTimer.h" -#include "hsUtils.h" -static const hsScalar kRandNormalize = 1.f / 32767.f; + +static const float kRandNormalize = 1.f / 32767.f; plRandomCommandMod::plRandomCommandMod() { @@ -126,11 +126,11 @@ int plRandomCommandMod::IExcludeSelections(int ncmds) return ncmds; } -hsScalar plRandomCommandMod::IGetDelay(hsScalar len) const +float plRandomCommandMod::IGetDelay(float len) const { - hsScalar r = float(hsRand() * kRandNormalize); + float r = float(hsRand() * kRandNormalize); - hsScalar delay = fMinDelay + (fMaxDelay - fMinDelay) * r; + float delay = fMinDelay + (fMaxDelay - fMinDelay) * r; if( fMode & kDelayFromEnd ) delay += len; @@ -156,7 +156,7 @@ hsBool plRandomCommandMod::ISelectNext(int ncmds) } return true; } - hsScalar r = float(hsRand() * kRandNormalize); + float r = float(hsRand() * kRandNormalize); int nSelect = ncmds; @@ -294,13 +294,13 @@ void plRandomCommandMod::Write(hsStream* s, hsResMgr* mgr) s->WriteLEScalar(fMaxDelay); } -void plRandomCommandMod::IRetry(hsScalar secs) +void plRandomCommandMod::IRetry(float secs) { IStop(); double t = hsTimer::GetSysSeconds() + secs; - plAnimCmdMsg* msg = TRACKED_NEW plAnimCmdMsg(nil, GetKey(), &t); + plAnimCmdMsg* msg = new plAnimCmdMsg(nil, GetKey(), &t); msg->SetCmd(plAnimCmdMsg::kContinue); plgDispatch::MsgSend(msg); } diff --git a/Sources/Plasma/FeatureLib/pfAnimation/plRandomCommandMod.h b/Sources/Plasma/FeatureLib/pfAnimation/plRandomCommandMod.h index 52b40949..9d2301c7 100644 --- a/Sources/Plasma/FeatureLib/pfAnimation/plRandomCommandMod.h +++ b/Sources/Plasma/FeatureLib/pfAnimation/plRandomCommandMod.h @@ -66,25 +66,25 @@ protected: // These are only lightly synched, the only synched state is whether // they are currently active. - UInt8 fState; + uint8_t fState; hsBitVector fExcluded; - Int8 fCurrent; - UInt8 fMode; // static, if it becomes dynamic, move to SynchedValue + int8_t fCurrent; + uint8_t fMode; // static, if it becomes dynamic, move to SynchedValue hsTArray fEndTimes; - hsScalar fMinDelay; - hsScalar fMaxDelay; + float fMinDelay; + float fMaxDelay; void IStart(); virtual void IStop(); hsBool IStopped() const; - void IRetry(hsScalar secs); + void IRetry(float secs); virtual void IPlayNextIfMaster(); void IReset(); - hsScalar IGetDelay(hsScalar len) const; + 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 @@ -94,7 +94,7 @@ protected: virtual void IPlayNext() = 0; // We only act in response to messages. - virtual hsBool IEval(double secs, hsScalar del, UInt32 dirty) { return false; } + virtual hsBool IEval(double secs, float del, uint32_t dirty) { return false; } public: plRandomCommandMod(); @@ -109,17 +109,17 @@ public: virtual void Write(hsStream* s, hsResMgr* mgr); // Export only - void SetMode(UInt8 m) { fMode = m; } - UInt8 GetMode() const { return fMode; } + void SetMode(uint8_t m) { fMode = m; } + uint8_t GetMode() const { return fMode; } - void SetState(UInt8 s) { fState = s; } - UInt8 GetState() const { return fState; } + void SetState(uint8_t s) { fState = s; } + uint8_t GetState() const { return fState; } - void SetMinDelay(hsScalar f) { fMinDelay = f; } - hsScalar GetMinDelay() const { return fMinDelay; } + void SetMinDelay(float f) { fMinDelay = f; } + float GetMinDelay() const { return fMinDelay; } - void SetMaxDelay(hsScalar f) { fMaxDelay = f; } - hsScalar GetMaxDelay() const { return fMaxDelay; } + void SetMaxDelay(float f) { fMaxDelay = f; } + float GetMaxDelay() const { return fMaxDelay; } }; diff --git a/Sources/Plasma/FeatureLib/pfAnimation/plStereizer.cpp b/Sources/Plasma/FeatureLib/pfAnimation/plStereizer.cpp index 3a1a0b89..1b488a1e 100644 --- a/Sources/Plasma/FeatureLib/pfAnimation/plStereizer.cpp +++ b/Sources/Plasma/FeatureLib/pfAnimation/plStereizer.cpp @@ -43,7 +43,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include -#include "hsTypes.h" +#include "HeadSpin.h" #include "plStereizer.h" #include "plLineFollowMod.h" @@ -119,7 +119,7 @@ hsBool plStereizer::MsgReceive(plMessage* msg) return plSingleModifier::MsgReceive(msg); } -hsBool plStereizer::IEval(double secs, hsScalar del, UInt32 dirty) +hsBool plStereizer::IEval(double secs, float del, uint32_t dirty) { return false; } @@ -135,7 +135,7 @@ hsBool plStereizer::Stereize() // Find distance to listener hsPoint3 pos = IGetUnStereoPos(); hsVector3 posToList(&fListPos, &pos); - hsScalar dist = posToList.Magnitude(); + float dist = posToList.Magnitude(); // If distance less than ambient distance // setup as pure ambient @@ -210,14 +210,14 @@ hsPoint3 plStereizer::IGetAmbientPos() const return pos; } -hsPoint3 plStereizer::IGetLocalizedPos(const hsVector3& posToList, hsScalar distToList) const +hsPoint3 plStereizer::IGetLocalizedPos(const hsVector3& posToList, float distToList) const { hsPoint3 pos = IGetUnStereoPos(); hsVector3 axOut(-posToList.fY, posToList.fX, 0); hsFastMath::NormalizeAppr(axOut); - hsScalar distOut = distToList * fTanAng; + float distOut = distToList * fTanAng; if( distOut > fMaxSepDist ) distOut = fMaxSepDist; else if( distOut < fMinSepDist ) @@ -232,12 +232,12 @@ hsPoint3 plStereizer::IGetLocalizedPos(const hsVector3& posToList, hsScalar dist return pos; } -void plStereizer::SetSepAngle(hsScalar rads) +void plStereizer::SetSepAngle(float rads) { - fTanAng = hsScalar(tan(rads)); + fTanAng = float(tan(rads)); } -hsScalar plStereizer::GetSepAngle() const +float plStereizer::GetSepAngle() const { return atan(fTanAng); } diff --git a/Sources/Plasma/FeatureLib/pfAnimation/plStereizer.h b/Sources/Plasma/FeatureLib/pfAnimation/plStereizer.h index 45ba38ae..63081a1c 100644 --- a/Sources/Plasma/FeatureLib/pfAnimation/plStereizer.h +++ b/Sources/Plasma/FeatureLib/pfAnimation/plStereizer.h @@ -67,13 +67,13 @@ protected: }; // Static properties - hsScalar fAmbientDist; - hsScalar fTransition; + float fAmbientDist; + float fTransition; - hsScalar fMaxSepDist; - hsScalar fMinSepDist; + float fMaxSepDist; + float fMinSepDist; - hsScalar fTanAng; + float fTanAng; hsPoint3 fInitPos; @@ -82,9 +82,9 @@ protected: hsVector3 fListDirection; hsVector3 fListUp; - virtual hsBool IEval(double secs, hsScalar del, UInt32 dirty); + virtual hsBool IEval(double secs, float del, uint32_t dirty); - hsPoint3 IGetLocalizedPos(const hsVector3& posToList, hsScalar distToList) const; + hsPoint3 IGetLocalizedPos(const hsVector3& posToList, float distToList) const; hsPoint3 IGetAmbientPos() const; void ISetNewPos(const hsPoint3& newPos); @@ -109,20 +109,20 @@ public: hsBool Stereize(); void SetFromListenerMsg(const plListenerMsg* listMsg); - void SetAmbientDist(hsScalar d) { fAmbientDist = d; } - hsScalar GetAmbientDist() const { return fAmbientDist; } + void SetAmbientDist(float d) { fAmbientDist = d; } + float GetAmbientDist() const { return fAmbientDist; } - void SetTransition(hsScalar d) { fTransition = d; } - hsScalar GetTransition() const { return fTransition; } + void SetTransition(float d) { fTransition = d; } + float GetTransition() const { return fTransition; } - void SetMaxSepDist(hsScalar d) { fMaxSepDist = d; } - hsScalar GetMaxSepDist() const { return fMaxSepDist; } + void SetMaxSepDist(float d) { fMaxSepDist = d; } + float GetMaxSepDist() const { return fMaxSepDist; } - void SetMinSepDist(hsScalar d) { fMinSepDist = d; } - hsScalar GetMinSepDist() const { return fMinSepDist; } + void SetMinSepDist(float d) { fMinSepDist = d; } + float GetMinSepDist() const { return fMinSepDist; } - void SetSepAngle(hsScalar rads); - hsScalar GetSepAngle() const; + void SetSepAngle(float rads); + float GetSepAngle() const; void SetAsLeftChannel(hsBool on) { if(on)SetFlag(kLeftChannel); else ClearFlag(kLeftChannel); } hsBool IsLeftChannel() const { return HasFlag(kLeftChannel); } diff --git a/Sources/Plasma/FeatureLib/pfAnimation/plViewFaceModifier.cpp b/Sources/Plasma/FeatureLib/pfAnimation/plViewFaceModifier.cpp index c96a543a..5cc1e872 100644 --- a/Sources/Plasma/FeatureLib/pfAnimation/plViewFaceModifier.cpp +++ b/Sources/Plasma/FeatureLib/pfAnimation/plViewFaceModifier.cpp @@ -40,7 +40,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "plViewFaceModifier.h" #include "plgDispatch.h" #include "pnSceneObject/plSceneObject.h" @@ -86,7 +86,7 @@ void plViewFaceModifier::Read(hsStream* s, hsResMgr* mgr) fOrigParentToLocal.Read(s); if( HasFlag(kFaceObj) ) - mgr->ReadKeyNotifyMe(s, TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnCreate, 0, kRefFaceObj), plRefFlags::kPassiveRef); + mgr->ReadKeyNotifyMe(s, new plGenRefMsg(GetKey(), plRefMsg::kOnCreate, 0, kRefFaceObj), plRefFlags::kPassiveRef); fOffset.Read(s); @@ -129,7 +129,7 @@ void plViewFaceModifier::SetTarget(plSceneObject* so) plgDispatch::Dispatch()->RegisterForExactType(plArmatureUpdateMsg::Index(), GetKey()); } -hsBool plViewFaceModifier::IEval(double secs, hsScalar del, UInt32 dirty) +hsBool plViewFaceModifier::IEval(double secs, float del, uint32_t dirty) { return false; } @@ -157,7 +157,7 @@ hsBool plViewFaceModifier::IFacePoint(plPipeline* pipe, const hsPoint3& at) } hsPoint3 localAt = worldToLocal * at; - hsScalar len = localAt.MagnitudeSquared(); + float len = localAt.MagnitudeSquared(); if( len <= 0 ) return false; len = -hsFastMath::InvSqrtAppr(len); @@ -220,7 +220,7 @@ hsBool plViewFaceModifier::IFacePoint(plPipeline* pipe, const hsPoint3& at) x.fMap[3][0] = x.fMap[3][1] = x.fMap[3][2] = 0; xInv.fMap[0][3] = xInv.fMap[1][3] = xInv.fMap[2][3] = 0; - xInv.fMap[3][3] = x.fMap[3][3] = hsScalar1; + xInv.fMap[3][3] = x.fMap[3][3] = 1.f; x.NotIdentity(); xInv.NotIdentity(); @@ -239,7 +239,7 @@ hsBool plViewFaceModifier::IFacePoint(plPipeline* pipe, const hsPoint3& at) x.fMap[2][1] *= fScale.fZ; x.fMap[2][2] *= fScale.fZ; - hsScalar inv = 1.f / fScale.fX; + float inv = 1.f / fScale.fX; xInv.fMap[0][0] *= inv; xInv.fMap[1][0] *= inv; xInv.fMap[2][0] *= inv; @@ -390,7 +390,7 @@ void plViewFaceModifier::IOnRemove(plGenRefMsg* refMsg) void plViewFaceModifier::ISetObject(plKey soKey) { - hsgResMgr::ResMgr()->SendRef(soKey, TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnRequest, 0, kRefFaceObj), plRefFlags::kPassiveRef); + hsgResMgr::ResMgr()->SendRef(soKey, new plGenRefMsg(GetKey(), plRefMsg::kOnRequest, 0, kRefFaceObj), plRefFlags::kPassiveRef); } void plViewFaceModifier::SetFollowMode(FollowMode m, plKey soKey) diff --git a/Sources/Plasma/FeatureLib/pfAnimation/plViewFaceModifier.h b/Sources/Plasma/FeatureLib/pfAnimation/plViewFaceModifier.h index 1dfe3e97..276cbf6a 100644 --- a/Sources/Plasma/FeatureLib/pfAnimation/plViewFaceModifier.h +++ b/Sources/Plasma/FeatureLib/pfAnimation/plViewFaceModifier.h @@ -84,7 +84,7 @@ protected: hsBounds3Ext fMaxBounds; virtual hsBool IFacePoint(plPipeline* pipe, const hsPoint3& at); - virtual hsBool IEval(double secs, hsScalar del, UInt32 dirty); + virtual hsBool IEval(double secs, float del, uint32_t dirty); enum RefType { diff --git a/Sources/Plasma/FeatureLib/pfAudio/plListener.cpp b/Sources/Plasma/FeatureLib/pfAudio/plListener.cpp index bd6de81b..1c160123 100644 --- a/Sources/Plasma/FeatureLib/pfAudio/plListener.cpp +++ b/Sources/Plasma/FeatureLib/pfAudio/plListener.cpp @@ -40,7 +40,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ #include "hsMatrix44.h" -#include "hsTypes.h" +#include "HeadSpin.h" #include "plListener.h" #include "plgDispatch.h" #include "plAudio/plAudioSystem.h" @@ -61,7 +61,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com hsBool plListener::fPrintDbgInfo = false; -hsBool plListener::IEval(double secs, hsScalar del, UInt32 dirty) +hsBool plListener::IEval(double secs, float del, uint32_t dirty) { // if (!plgAudioSys::Active()) // return true; @@ -69,7 +69,7 @@ hsBool plListener::IEval(double secs, hsScalar del, UInt32 dirty) int y = 16 + 12, x = 400; if( fPrintDbgInfo ) - plDebugText::Instance().DrawString( x, 16, "Listener:", (UInt32)0xffffffff, plDebugText::kStyleBold ); + plDebugText::Instance().DrawString( x, 16, "Listener:", (uint32_t)0xffffffff, plDebugText::kStyleBold ); // Get the avatar's SceneObject plKey key = plNetClientMgr::GetInstance()->GetLocalPlayerKey(); @@ -80,7 +80,7 @@ hsBool plListener::IEval(double secs, hsScalar del, UInt32 dirty) { // We don't have a position to init by, so do NOT eval yet!!! if( fPrintDbgInfo ) - plDebugText::Instance().DrawString( x, y, "Not eval-ing yet", (UInt32)0xffffffff ); + plDebugText::Instance().DrawString( x, y, "Not eval-ing yet", (uint32_t)0xffffffff ); return true; } @@ -165,12 +165,12 @@ hsBool plListener::IEval(double secs, hsScalar del, UInt32 dirty) if( facingType == kInvalid || posType == kInvalid || velType == kInvalid ) { if( fPrintDbgInfo ) - plDebugText::Instance().DrawString( x, y, "Not eval-ing: missing one or more parameter bases", (UInt32)0xff0000ff ); + plDebugText::Instance().DrawString( x, y, "Not eval-ing: missing one or more parameter bases", (uint32_t)0xff0000ff ); return true; } // Got the params, now construct and send out the message, as well as update the audio system - plListenerMsg* msg = TRACKED_NEW plListenerMsg; + plListenerMsg* msg = new plListenerMsg; msg->SetDirection( dir ); msg->SetUp( up ); msg->SetPosition( position ); @@ -184,19 +184,19 @@ hsBool plListener::IEval(double secs, hsScalar del, UInt32 dirty) { plString str; str = plString::Format( "Direction: (%3.2f,%3.2f,%3.2f) from %s", dir.fX, dir.fY, dir.fZ, ( facingType == kObject ) ? pRefObject->GetKey()->GetUoid().GetObjectName().c_str() : "VCam" ); - plDebugText::Instance().DrawString( x, y, str.c_str(), (UInt32)0xffffffff ); + plDebugText::Instance().DrawString( x, y, str.c_str(), (uint32_t)0xffffffff ); y += 12; str = plString::Format( "Up: (%3.2f,%3.2f,%3.2f) from %s", up.fX, up.fY, up.fZ, ( facingType == kObject ) ? pRefObject->GetKey()->GetUoid().GetObjectName().c_str() : "VCam" ); - plDebugText::Instance().DrawString( x, y, str.c_str(), (UInt32)0xffffffff ); + plDebugText::Instance().DrawString( x, y, str.c_str(), (uint32_t)0xffffffff ); y += 12; str = plString::Format( "Position: (%3.2f,%3.2f,%3.2f) from %s", position.fX, position.fY, position.fZ, ( posType == kObject ) ? pRefObject->GetKey()->GetUoid().GetObjectName().c_str() : "VCam" ); - plDebugText::Instance().DrawString( x, y, str.c_str(), (UInt32)0xffffffff ); + plDebugText::Instance().DrawString( x, y, str.c_str(), (uint32_t)0xffffffff ); y += 12; str = plString::Format( "Velocity: (%3.2f,%3.2f,%3.2f) from %s", velocity.fX, velocity.fY, velocity.fZ, ( velType == kObject ) ? pRefObject->GetKey()->GetUoid().GetObjectName().c_str() : "VCam" ); - plDebugText::Instance().DrawString( x, y, str.c_str(), (UInt32)0xffffffff ); + plDebugText::Instance().DrawString( x, y, str.c_str(), (uint32_t)0xffffffff ); y += 12; } plgDispatch::MsgSend( msg ); @@ -207,7 +207,7 @@ hsBool plListener::IEval(double secs, hsScalar del, UInt32 dirty) void plListener::ISetRef( const plKey &ref, hsBool binding, int type ) { if( binding ) - hsgResMgr::ResMgr()->AddViaNotify( ref, TRACKED_NEW plGenRefMsg( GetKey(), plGenRefMsg::kOnReplace, -1, type ), plRefFlags::kPassiveRef ); + hsgResMgr::ResMgr()->AddViaNotify( ref, new plGenRefMsg( GetKey(), plGenRefMsg::kOnReplace, -1, type ), plRefFlags::kPassiveRef ); else GetKey()->Release( ref ); } @@ -293,9 +293,9 @@ hsBool plListener::MsgReceive(plMessage* msg) if( fInitMe ) { // By default, position and orientation are camera based - plSetListenerMsg *set = TRACKED_NEW plSetListenerMsg( plSetListenerMsg::kVCam | plSetListenerMsg::kFacing, nil, true ); + plSetListenerMsg *set = new plSetListenerMsg( plSetListenerMsg::kVCam | plSetListenerMsg::kFacing, nil, true ); set->Send(); - set = TRACKED_NEW plSetListenerMsg( plSetListenerMsg::kVCam | plSetListenerMsg::kPosition, nil, true ); + set = new plSetListenerMsg( plSetListenerMsg::kVCam | plSetListenerMsg::kPosition, nil, true ); set->Send(); fInitMe = false; diff --git a/Sources/Plasma/FeatureLib/pfAudio/plListener.h b/Sources/Plasma/FeatureLib/pfAudio/plListener.h index 3cc7ee1e..131fec5a 100644 --- a/Sources/Plasma/FeatureLib/pfAudio/plListener.h +++ b/Sources/Plasma/FeatureLib/pfAudio/plListener.h @@ -63,9 +63,9 @@ public: static void ShowDebugInfo( hsBool s ) { fPrintDbgInfo = s; } // Get info for which object these things are attached to - camera or refObject - UInt8 GetAttachedPosType() { return (UInt8)fPosRatio; } - UInt8 GetAttachedFacingType() { return (UInt8)fFacingRatio; } - UInt8 GetAttachedVelType() { return (UInt8)fVelRatio; } + uint8_t GetAttachedPosType() { return (uint8_t)fPosRatio; } + uint8_t GetAttachedFacingType() { return (uint8_t)fFacingRatio; } + uint8_t GetAttachedVelType() { return (uint8_t)fVelRatio; } enum { @@ -83,12 +83,12 @@ protected: plVirtualCam1* fVCam; - hsScalar fPosRatio, fFacingRatio, fVelRatio; // 0 is vCam, 1 is refObject + float fPosRatio, fFacingRatio, fVelRatio; // 0 is vCam, 1 is refObject hsBool fInitMe; static hsBool fPrintDbgInfo; - virtual hsBool IEval(double secs, hsScalar del, UInt32 dirty); + virtual hsBool IEval(double secs, float del, uint32_t dirty); void ISetRef( const plKey &ref, hsBool binding, int type ); void ICheckAudio( void ) const; diff --git a/Sources/Plasma/FeatureLib/pfAudio/plRandomSoundMod.cpp b/Sources/Plasma/FeatureLib/pfAudio/plRandomSoundMod.cpp index b77c6bc9..5fd76452 100644 --- a/Sources/Plasma/FeatureLib/pfAudio/plRandomSoundMod.cpp +++ b/Sources/Plasma/FeatureLib/pfAudio/plRandomSoundMod.cpp @@ -40,7 +40,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "plRandomSoundMod.h" #include "pnSceneObject/plSceneObject.h" #include "pnSceneObject/plAudioInterface.h" @@ -66,7 +66,7 @@ void plRandomSoundModGroup::Read(hsStream *s) { fNumSounds = s->ReadLE16(); fGroupedIdx = s->ReadLE16(); - fIndices = TRACKED_NEW UInt16[fNumSounds]; + fIndices = new uint16_t[fNumSounds]; int i; for (i = 0; i < fNumSounds; i++) @@ -119,7 +119,7 @@ void plRandomSoundMod::IStop() if( fGroups != nil && fGroups[ fCurrentGroup ].fGroupedIdx != -1 ) { - plSoundMsg *msg = TRACKED_NEW plSoundMsg(); + plSoundMsg *msg = new plSoundMsg(); msg->SetCmd(plSoundMsg::kStop); msg->fIndex = fGroups[ fCurrentGroup ].fIndices[ fCurrent ]; plgDispatch::MsgSend(msg); @@ -127,8 +127,8 @@ void plRandomSoundMod::IStop() else { if(fCurrent == -1) return; - UInt16 currentSndIdx = ( fGroups != nil ) ? fGroups[fCurrentGroup].fIndices[fCurrent] : fActiveList[fCurrent]; - plSoundMsg* snd = TRACKED_NEW plSoundMsg(GetKey(), GetTarget()->GetKey(), nil); + uint16_t currentSndIdx = ( fGroups != nil ) ? fGroups[fCurrentGroup].fIndices[fCurrent] : fActiveList[fCurrent]; + plSoundMsg* snd = new plSoundMsg(GetKey(), GetTarget()->GetKey(), nil); snd->SetCmd(plSoundMsg::kStop); snd->fIndex = currentSndIdx; plgDispatch::MsgSend(snd); @@ -151,7 +151,7 @@ void plRandomSoundMod::IPlayNext() } int i; - UInt16 currentSndIdx; + uint16_t currentSndIdx; int nSounds = (fGroups == nil ? ai->GetNumSounds() : fGroups[fCurrentGroup].fNumSounds); fEndTimes.ExpandAndZero(nSounds); plSound *pSound = nil; @@ -185,10 +185,10 @@ void plRandomSoundMod::IPlayNext() fFirstTimePlay = false; if( !(fMode & kOneCmd) ) { - hsScalar delay = IGetDelay(0); + float delay = IGetDelay(0); double t = hsTimer::GetSysSeconds() + delay; - plAnimCmdMsg* anim = TRACKED_NEW plAnimCmdMsg(GetKey(), GetKey(), &t); + plAnimCmdMsg* anim = new plAnimCmdMsg(GetKey(), GetKey(), &t); anim->SetCmd(plAnimCmdMsg::kContinue); plgDispatch::MsgSend(anim); return; @@ -203,7 +203,7 @@ void plRandomSoundMod::IPlayNext() // We don't want random sounds to synch, since we don't synch the randomness. So force this next // sound to not synch - hsScalar currLen; + float currLen; if( fGroups != nil && fGroups[ fCurrentGroup ].fGroupedIdx != -1 ) { currentSndIdx = fGroups[ fCurrentGroup ].fIndices[ fCurrent ]; @@ -217,13 +217,13 @@ void plRandomSoundMod::IPlayNext() sound->SetLocalOnly(true); // Send msg to the grouped sound to switch sounds - plSoundMsg *snd = TRACKED_NEW plSoundMsg(); + plSoundMsg *snd = new plSoundMsg(); snd->SetCmd( plSoundMsg::kSelectFromGroup ); snd->fIndex = currentSndIdx; snd->Send( sound->GetKey() ); // Now tell the audio interface to play the sound (probably should change this....) - snd = TRACKED_NEW plSoundMsg(GetKey(), GetTarget()->GetKey(), nil); + snd = new plSoundMsg(GetKey(), GetTarget()->GetKey(), nil); snd->SetCmd(plSoundMsg::kGoToTime); snd->fTime = (0); snd->SetCmd(plSoundMsg::kStop); @@ -245,7 +245,7 @@ void plRandomSoundMod::IPlayNext() } if (ai->GetSound(currentSndIdx)) - currLen = (hsScalar)(ai->GetSound(currentSndIdx)->GetLength()); + currLen = (float)(ai->GetSound(currentSndIdx)->GetLength()); else currLen = 0; } @@ -262,11 +262,11 @@ void plRandomSoundMod::IPlayNext() if( !(fMode & kOneCmd) ) { - hsScalar delay = IGetDelay(currLen); + float delay = IGetDelay(currLen); double t = hsTimer::GetSysSeconds() + delay; - plAnimCmdMsg* anim = TRACKED_NEW plAnimCmdMsg(GetKey(), GetKey(), &t); + plAnimCmdMsg* anim = new plAnimCmdMsg(GetKey(), GetKey(), &t); anim->SetCmd(plAnimCmdMsg::kContinue); plgDispatch::MsgSend(anim); } @@ -276,7 +276,7 @@ void plRandomSoundMod::IPlayNext() } } -void plRandomSoundMod::SetCurrentGroup(UInt16 group) +void plRandomSoundMod::SetCurrentGroup(uint16_t group) { hsAssert(group < fNumGroups, "Setting an invalid group on a random sound modifier"); @@ -297,7 +297,7 @@ void plRandomSoundMod::Read(hsStream *s, hsResMgr *mgr) fNumGroups = s->ReadLE16(); if (fNumGroups > 0) { - fGroups = TRACKED_NEW plRandomSoundModGroup[fNumGroups]; + fGroups = new plRandomSoundModGroup[fNumGroups]; int i; for (i = 0; i < fNumGroups; i++) fGroups[i].Read(s); @@ -319,7 +319,7 @@ void plRandomSoundMod::Write(hsStream *s, hsResMgr *mgr) void plRandomSoundMod::ForceSoundLoadState( hsBool loaded ) { - UInt16 i, j; + uint16_t i, j; plAudioInterface* ai = IGetTargetAudioInterface(0); if( ai == nil ) @@ -386,7 +386,7 @@ hsBool plRandomSoundMod::MsgReceive(plMessage* msg) return plRandomCommandMod::MsgReceive(msg); } -void plRandomSoundMod::ISetVolume(hsScalar volume) +void plRandomSoundMod::ISetVolume(float volume) { plSound *pSound = nil; @@ -428,4 +428,4 @@ plSound *plRandomSoundMod::IGetSoundPtr() pSound = ai->GetSound( currentSndIdx ); return pSound; -} \ No newline at end of file +} diff --git a/Sources/Plasma/FeatureLib/pfAudio/plRandomSoundMod.h b/Sources/Plasma/FeatureLib/pfAudio/plRandomSoundMod.h index d50bace3..3611c75f 100644 --- a/Sources/Plasma/FeatureLib/pfAudio/plRandomSoundMod.h +++ b/Sources/Plasma/FeatureLib/pfAudio/plRandomSoundMod.h @@ -51,10 +51,10 @@ class plRandomSoundModGroup { public: hsBitVector fExcluded; - Int8 fCurrent; - UInt16 fNumSounds; - UInt16 *fIndices; - Int16 fGroupedIdx; // Only used if we point to a groupedSound, in which case fIndices are indices into + int8_t fCurrent; + uint16_t fNumSounds; + uint16_t *fIndices; + int16_t fGroupedIdx; // Only used if we point to a groupedSound, in which case fIndices are indices into // that sound. -1 if unused. plRandomSoundModGroup(); @@ -67,17 +67,17 @@ public: class plRandomSoundMod : public plRandomCommandMod { protected: - UInt16 fCurrentGroup; - UInt16 fNumGroups; + uint16_t fCurrentGroup; + uint16_t fNumGroups; plRandomSoundModGroup *fGroups; - std::vector fActiveList; // list of sounds we're allowed to choose + std::vector fActiveList; // list of sounds we're allowed to choose int fOldPriority; // old sound priority hsBool fFirstTimePlay; virtual void IPlayNext(); virtual void IPlayNextIfMaster(); virtual void IStop(); - void ISetVolume(hsScalar volume); + void ISetVolume(float volume); void ISetPosition(hsPoint3); plSound *IGetSoundPtr(); @@ -91,14 +91,14 @@ public: virtual void Read(hsStream* s, hsResMgr* mgr); virtual void Write(hsStream* s, hsResMgr* mgr); - void SetCurrentGroup(UInt16 group); + void SetCurrentGroup(uint16_t group); void ForceSoundLoadState( hsBool loaded ); hsBool MsgReceive(plMessage* msg); float GetVolume(); // EXPORT ONLY - void SetGroupInfo(UInt16 numGroups, plRandomSoundModGroup *groups) { fNumGroups = numGroups; fGroups = groups; } + void SetGroupInfo(uint16_t numGroups, plRandomSoundModGroup *groups) { fNumGroups = numGroups; fGroups = groups; } }; #endif // plRandomSoundMod_inc diff --git a/Sources/Plasma/FeatureLib/pfCCR/plCCRMgr.h b/Sources/Plasma/FeatureLib/pfCCR/plCCRMgr.h index 40d41b5d..2884d1e0 100644 --- a/Sources/Plasma/FeatureLib/pfCCR/plCCRMgr.h +++ b/Sources/Plasma/FeatureLib/pfCCR/plCCRMgr.h @@ -46,7 +46,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // Implementation for CCR commands // -#include "hsTypes.h" +#include "HeadSpin.h" // Error constants and conversion are outside of the CCR_RELEASE define, // So that non-CCR code can report CCR errors, and the plCCRMgr can diff --git a/Sources/Plasma/FeatureLib/pfCamera/pfCameraProxy.cpp b/Sources/Plasma/FeatureLib/pfCamera/pfCameraProxy.cpp index 25c18ca8..d5ec8a52 100644 --- a/Sources/Plasma/FeatureLib/pfCamera/pfCameraProxy.cpp +++ b/Sources/Plasma/FeatureLib/pfCamera/pfCameraProxy.cpp @@ -40,7 +40,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "pfCameraProxy.h" #include "plVirtualCamNeu.h" #include "plDrawable/plDrawableGenerator.h" @@ -74,7 +74,7 @@ plKey plCameraProxy::IGetNode() const return nil; } -plDrawableSpans* plCameraProxy::ICreateProxy(hsGMaterial* mat, hsTArray& idx, plDrawableSpans* addTo) +plDrawableSpans* plCameraProxy::ICreateProxy(hsGMaterial* mat, hsTArray& idx, plDrawableSpans* addTo) { if( fOwner ) { diff --git a/Sources/Plasma/FeatureLib/pfCamera/pfCameraProxy.h b/Sources/Plasma/FeatureLib/pfCamera/pfCameraProxy.h index 186a9340..6422c271 100644 --- a/Sources/Plasma/FeatureLib/pfCamera/pfCameraProxy.h +++ b/Sources/Plasma/FeatureLib/pfCamera/pfCameraProxy.h @@ -54,7 +54,7 @@ protected: plVirtualCam1* fOwner; - virtual plDrawableSpans* ICreateProxy(hsGMaterial* mat, hsTArray& idx, plDrawableSpans* addTo=nil); + virtual plDrawableSpans* ICreateProxy(hsGMaterial* mat, hsTArray& idx, plDrawableSpans* addTo=nil); virtual plKey IGetNode() const; public: plCameraProxy(); diff --git a/Sources/Plasma/FeatureLib/pfCamera/plCameraBrain.cpp b/Sources/Plasma/FeatureLib/pfCamera/plCameraBrain.cpp index 4fcc277f..38d00c63 100644 --- a/Sources/Plasma/FeatureLib/pfCamera/plCameraBrain.cpp +++ b/Sources/Plasma/FeatureLib/pfCamera/plCameraBrain.cpp @@ -73,12 +73,12 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "plNetClient/plNetClientMgr.h" hsBool plCameraBrain1_FirstPerson::fDontFade = false; -hsScalar plCameraBrain1::fFallAccel = 20.0f; -hsScalar plCameraBrain1::fFallDecel = 5.0f; -hsScalar plCameraBrain1::fFallVelocity = 50.0f; -hsScalar plCameraBrain1::fFallPOAAccel = 10.0f; -hsScalar plCameraBrain1::fFallPOADecel = 10.0f; -hsScalar plCameraBrain1::fFallPOAVelocity = 50.0f; +float plCameraBrain1::fFallAccel = 20.0f; +float plCameraBrain1::fFallDecel = 5.0f; +float plCameraBrain1::fFallVelocity = 50.0f; +float plCameraBrain1::fFallPOAAccel = 10.0f; +float plCameraBrain1::fFallPOADecel = 10.0f; +float plCameraBrain1::fFallPOAVelocity = 50.0f; // basic camera brain now is a fixed brain by default. // if it doesn't have a subject (an object) it will just look straight ahead. @@ -176,13 +176,13 @@ void plCameraBrain1::Pop() } // set the goal to which we want to animate the fov -void plCameraBrain1::SetFOVGoal(hsScalar h, double t) +void plCameraBrain1::SetFOVGoal(float h, double t) { if (fFOVGoal == h || h == fCamera->GetFOVh()) return; - hsScalar dif = h - fCamera->GetFOVh(); - fFOVAnimRate = dif / ((hsScalar)t); + float dif = h - fCamera->GetFOVh(); + fFOVAnimRate = dif / ((float)t); fFOVGoal = h; fFOVStartTime = hsTimer::GetSysSeconds(); @@ -192,7 +192,7 @@ void plCameraBrain1::SetFOVGoal(hsScalar h, double t) } // set parameters for how this camera zooms FOV based on user input (mostly for telescopes) -void plCameraBrain1::SetZoomParams(hsScalar max, hsScalar min, hsScalar rate) +void plCameraBrain1::SetZoomParams(float max, float min, float rate) { fZoomRate = rate; fZoomMax = max; @@ -240,7 +240,7 @@ void plCameraBrain1::Update(hsBool forced) // adjust FOV based on elapsed time void plCameraBrain1::IAnimateFOV(double time) { - hsScalar dH = fFOVAnimRate * hsTimer::GetDelSysSeconds(); + float dH = fFOVAnimRate * hsTimer::GetDelSysSeconds(); dH += fCamera->GetFOVh(); @@ -251,7 +251,7 @@ void plCameraBrain1::IAnimateFOV(double time) dH = fFOVGoal; } - fCamera->SetFOVw( (hsScalar)(dH * plVirtualCam1::Instance()->GetAspectRatio()) ); + fCamera->SetFOVw( (float)(dH * plVirtualCam1::Instance()->GetAspectRatio()) ); fCamera->SetFOVh( dH ); } @@ -274,13 +274,13 @@ void plCameraBrain1::IMoveTowardGoal(double elapsedTime) return; } hsVector3 dir(fGoal - fCamera->GetTargetPos()); - hsScalar distToGoal=dir.Magnitude(); + float distToGoal=dir.Magnitude(); //smooth out stoppage... - hsScalar adjMaxVel = fVelocity; + float adjMaxVel = fVelocity; if (distToGoal <= 5.0f && distToGoal > 0.1f) { - hsScalar mult = (distToGoal - 5.0f)*0.1f; + float mult = (distToGoal - 5.0f)*0.1f; adjMaxVel = fVelocity - hsABS(fVelocity*mult); } @@ -306,7 +306,7 @@ void plCameraBrain1::IMoveTowardGoal(double elapsedTime) fCurCamSpeed = vel.Magnitude(); - hsScalar distMoved; + float distMoved; if (fFlags.IsBitSet(kPanicVelocity)) distMoved = IClampVelocity(&vel, 1000.0f, elapsedTime); else @@ -350,16 +350,16 @@ void plCameraBrain1::IPointTowardGoal(double elapsedTime) hsVector3 dir(fPOAGoal - fCamera->GetTargetPOA()); - hsScalar distToGoal=dir.Magnitude(); + float distToGoal=dir.Magnitude(); if (distToGoal > 0.0f) dir.Normalize(); // smooth out stoppage - hsScalar adjMaxVel = fPOAVelocity; + float adjMaxVel = fPOAVelocity; if (distToGoal <= 5.0f && distToGoal > 0.1f) { - hsScalar mult = (distToGoal - 5.0f)*0.1f; + float mult = (distToGoal - 5.0f)*0.1f; adjMaxVel = fPOAVelocity - hsABS(fPOAVelocity*mult); } @@ -382,7 +382,7 @@ void plCameraBrain1::IPointTowardGoal(double elapsedTime) fCurViewSpeed = vel.Magnitude(); - hsScalar distMoved; + float distMoved; if (fFlags.IsBitSet(kPanicVelocity)) distMoved = IClampVelocity(&vel, 1000.0f, elapsedTime); else @@ -402,15 +402,15 @@ void plCameraBrain1::IPointTowardGoal(double elapsedTime) } -void plCameraBrain1::IAdjustVelocity(hsScalar adjAccelRate, hsScalar adjDecelRate, - hsVector3* dir, hsVector3* vel, hsScalar maxSpeed, - hsScalar distToGoal, double elapsedTime) +void plCameraBrain1::IAdjustVelocity(float adjAccelRate, float adjDecelRate, + hsVector3* dir, hsVector3* vel, float maxSpeed, + float distToGoal, double elapsedTime) { - hsScalar speed = vel->Magnitude(); // save current speed + float speed = vel->Magnitude(); // save current speed *vel = *dir * speed; // change vel to correct dir // compute accel/decel - hsScalar finalAccelRate; + float finalAccelRate; if (IShouldDecelerate(adjDecelRate, speed, distToGoal)) { @@ -425,7 +425,7 @@ void plCameraBrain1::IAdjustVelocity(hsScalar adjAccelRate, hsScalar adjDecelRat { // compute accel vector in the direction of the goal hsVector3 accelVec = *dir * finalAccelRate; - accelVec = accelVec * (hsScalar)elapsedTime; + accelVec = accelVec * (float)elapsedTime; // add acceleration to velocity *vel = *vel + accelVec; @@ -436,13 +436,13 @@ void plCameraBrain1::IAdjustVelocity(hsScalar adjAccelRate, hsScalar adjDecelRat } } -hsScalar plCameraBrain1::IClampVelocity(hsVector3* vel, hsScalar maxSpeed, double elapsedTime) +float plCameraBrain1::IClampVelocity(hsVector3* vel, float maxSpeed, double elapsedTime) { - *vel = *vel * (hsScalar)elapsedTime; - maxSpeed *= (hsScalar)elapsedTime; + *vel = *vel * (float)elapsedTime; + maxSpeed *= (float)elapsedTime; // clamp speed (clamp if going negative?) - hsScalar distMoved = vel->Magnitude(); + float distMoved = vel->Magnitude(); if (distMoved > maxSpeed) { vel->Normalize(); @@ -452,16 +452,16 @@ hsScalar plCameraBrain1::IClampVelocity(hsVector3* vel, hsScalar maxSpeed, doubl return distMoved; } -hsBool plCameraBrain1::IShouldDecelerate(hsScalar decelSpeed, hsScalar curSpeed, hsScalar distToGoal) +hsBool plCameraBrain1::IShouldDecelerate(float decelSpeed, float curSpeed, float distToGoal) { if (decelSpeed == 0) // no deceleration return false; // compute distance required to stop, given decel speed (in units/sec sq) - hsScalar stopTime = curSpeed / decelSpeed; - hsScalar avgSpeed = curSpeed * .5f; - hsScalar stopDist = avgSpeed * stopTime; + float stopTime = curSpeed / decelSpeed; + float avgSpeed = curSpeed * .5f; + float stopDist = avgSpeed * stopTime; return (hsABS(distToGoal) <= hsABS(stopDist)); // stopDist+avgSpeed? } @@ -476,7 +476,7 @@ void plCameraBrain1::AdjustForInput(double secs) if (fOffsetPct < 1.0f) { hsVector3 v(fPOAGoal - fGoal); - hsScalar len = v.Magnitude(); + float len = v.Magnitude(); len = len - (len * fOffsetPct); v.Normalize(); fGoal = fGoal + (v * len); @@ -487,10 +487,10 @@ void plCameraBrain1::Read(hsStream* stream, hsResMgr* mgr) { hsKeyedObject::Read(stream, mgr); fPOAOffset.Read(stream); - plGenRefMsg* msg = TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnRequest, 0, kSubject ); // SceneObject + plGenRefMsg* msg = new plGenRefMsg(GetKey(), plRefMsg::kOnRequest, 0, kSubject ); // SceneObject mgr->ReadKeyNotifyMe( stream, msg, plRefFlags::kActiveRef ); - plGenRefMsg* msg2 = TRACKED_NEW plGenRefMsg( GetKey(), plRefMsg::kOnRequest, 0, kRailComponent ); // SceneObject + plGenRefMsg* msg2 = new plGenRefMsg( GetKey(), plRefMsg::kOnRequest, 0, kRailComponent ); // SceneObject mgr->ReadKeyNotifyMe( stream, msg2, plRefFlags::kActiveRef ); fFlags.Read(stream); @@ -613,7 +613,7 @@ hsBool plCameraBrain1::MsgReceive(plMessage* msg) } else { - plGenRefMsg* msg = TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnRequest, 0, kSubject ); // SceneObject + plGenRefMsg* msg = new plGenRefMsg(GetKey(), plRefMsg::kOnRequest, 0, kSubject ); // SceneObject hsgResMgr::ResMgr()->AddViaNotify(pPMsg->fPlayer, msg, plRefFlags::kPassiveRef); fFlags.SetBit(kCutPosOnce); @@ -710,10 +710,10 @@ void plCameraBrain1::SetSubject(plSceneObject* sub) // -hsScalar plCameraBrain1_Drive::fTurnRate = 100.0f; -hsScalar plCameraBrain1_Drive::fAcceleration = 200.0f; -hsScalar plCameraBrain1_Drive::fDeceleration = 200.0f; -hsScalar plCameraBrain1_Drive::fMaxVelocity = 100.0f; +float plCameraBrain1_Drive::fTurnRate = 100.0f; +float plCameraBrain1_Drive::fAcceleration = 200.0f; +float plCameraBrain1_Drive::fDeceleration = 200.0f; +float plCameraBrain1_Drive::fMaxVelocity = 100.0f; // constructor @@ -764,7 +764,7 @@ void plCameraBrain1_Drive::Update(hsBool forced) // update our desired position: double time = hsTimer::GetSeconds(); - hsScalar eTime = (hsScalar)(time-fLastTime); + float eTime = (float)(time-fLastTime); if(eTime > 0.01f) eTime = 0.01f; fLastTime = time; @@ -772,7 +772,7 @@ void plCameraBrain1_Drive::Update(hsBool forced) hsVector3 view, up, right; fTargetMatrix.GetAxis(&view,&up,&right); - hsScalar delta = 5.0f * eTime; + float delta = 5.0f * eTime; // adjust speed if (HasMovementFlag(B_CAMERA_DRIVE_SPEED_UP)) @@ -805,8 +805,8 @@ void plCameraBrain1_Drive::Update(hsBool forced) fMaxVelocity = plVirtualCam1::Instance()->fVel; } - hsScalar speed = fMaxVelocity; - hsScalar turn = 1.0f; + float speed = fMaxVelocity; + float turn = 1.0f; if (HasMovementFlag(B_CONTROL_MODIFIER_FAST)) { @@ -973,7 +973,7 @@ plCameraBrain1_Avatar::~plCameraBrain1_Avatar() if (fFaded) { - plCameraTargetFadeMsg* pMsg = TRACKED_NEW plCameraTargetFadeMsg; + plCameraTargetFadeMsg* pMsg = new plCameraTargetFadeMsg; pMsg->SetFadeOut(false); pMsg->SetSubjectKey(plNetClientMgr::GetInstance()->GetLocalPlayerKey()); pMsg->SetBCastFlag(plMessage::kBCastByExactType); @@ -1102,7 +1102,7 @@ void plCameraBrain1_Avatar::CalculatePosition() // check LOS if (GetCamera()->GetKey() && fFlags.IsBitSet(kMaintainLOS) && (plVirtualCam1::Instance()->GetCurrentStackCamera() == GetCamera())) { - plLOSRequestMsg* pMsg = TRACKED_NEW plLOSRequestMsg( GetCamera()->GetKey(), fPOAGoal, fGoal, plSimDefs::kLOSDBCameraBlockers, + plLOSRequestMsg* pMsg = new plLOSRequestMsg( GetCamera()->GetKey(), fPOAGoal, fGoal, plSimDefs::kLOSDBCameraBlockers, plLOSRequestMsg::kTestClosest, plLOSRequestMsg::kReportHitOrMiss); plgDispatch::MsgSend( pMsg ); } @@ -1148,7 +1148,7 @@ void plCameraBrain1_Avatar::ISendFadeMsg(hsBool fade) else plVirtualCam1::AddMsgToLog("current camera sending Fade In message to Avatar"); - plCameraTargetFadeMsg* pMsg = TRACKED_NEW plCameraTargetFadeMsg; + plCameraTargetFadeMsg* pMsg = new plCameraTargetFadeMsg; pMsg->SetFadeOut(fade); pMsg->SetSubjectKey(GetSubject()->GetKey()); pMsg->SetBCastFlag(plMessage::kBCastByExactType); @@ -1397,7 +1397,7 @@ void plCameraBrain1_FirstPerson::CalculatePosition() // check LOS if (GetCamera()->GetKey() && fFlags.IsBitSet(kMaintainLOS) && (plVirtualCam1::Instance()->GetCurrentStackCamera() == GetCamera())) { - plLOSRequestMsg* pMsg = TRACKED_NEW plLOSRequestMsg( GetCamera()->GetKey(), fPOAGoal, fGoal, plSimDefs::kLOSDBCameraBlockers, + plLOSRequestMsg* pMsg = new plLOSRequestMsg( GetCamera()->GetKey(), fPOAGoal, fGoal, plSimDefs::kLOSDBCameraBlockers, plLOSRequestMsg::kTestClosest, plLOSRequestMsg::kReportHitOrMiss); plgDispatch::MsgSend( pMsg ); } @@ -1436,7 +1436,7 @@ void plCameraBrain1_FirstPerson::Push(hsBool recenter) if (plCameraBrain1_FirstPerson::fDontFade) return; - plEnableMsg* pMsg = TRACKED_NEW plEnableMsg; + plEnableMsg* pMsg = new plEnableMsg; pMsg->SetCmd(plEnableMsg::kDisable); pMsg->AddType(plEnableMsg::kDrawable); pMsg->SetBCastFlag(plMessage::kPropagateToModifiers); @@ -1481,7 +1481,7 @@ plCameraBrain1_Fixed::~plCameraBrain1_Fixed() void plCameraBrain1_Fixed::Read(hsStream* stream, hsResMgr* mgr) { plCameraBrain1::Read(stream, mgr); - mgr->ReadKeyNotifyMe( stream, TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnRequest, 0, 99), plRefFlags::kPassiveRef); + mgr->ReadKeyNotifyMe( stream, new plGenRefMsg(GetKey(), plRefMsg::kOnRequest, 0, 99), plRefFlags::kPassiveRef); } void plCameraBrain1_Fixed::Write(hsStream* stream, hsResMgr* mgr) @@ -1583,7 +1583,7 @@ hsBool plCameraBrain1_Fixed::MsgReceive(plMessage* msg) // // // circle camera crap -static const hsScalar kTwoPI = 2.0f*hsScalarPI; +static const float kTwoPI = 2.0f*M_PI; plCameraBrain1_Circle::plCameraBrain1_Circle() : plCameraBrain1_Fixed() { @@ -1656,17 +1656,17 @@ hsPoint3 plCameraBrain1_Circle::MoveTowardsFromGoal(const hsPoint3* fromGoal, do if (fCurRad != fGoalRad) { - hsScalar dist = hsABS(fGoalRad-fCurRad); + float dist = hsABS(fGoalRad-fCurRad); hsAssert(dist>=0 && dist<=kTwoPI, "illegal radian diff"); - hsBool mustWrap = (dist > hsScalarPI); // go opposite direction for shortcut and wrap + hsBool mustWrap = (dist > M_PI); // go opposite direction for shortcut and wrap // compute speed - hsScalar speed; + float speed; if (warp) - speed = (hsScalar)(kTwoPI * 100 * secs); + speed = (float)(kTwoPI * 100 * secs); else - speed = (hsScalar)(kTwoPI * fCirPerSec * secs); + speed = (float)(kTwoPI * fCirPerSec * secs); // move towards goalRad hsAssert(fCurRad>=0 && fCurRad<=kTwoPI, "illegal radian value"); @@ -1717,7 +1717,7 @@ hsPoint3 plCameraBrain1_Circle::MoveTowardsFromGoal(const hsPoint3* fromGoal, do hsAssert(fCurRad>=0 && fCurRad<=kTwoPI, "illegal radian value"); hsPoint3 x; - x = GetCenterPoint() + hsVector3((hsScalar)hsCosine(fCurRad)*fRadius, (hsScalar)hsSine(fCurRad)*fRadius, 0.0f); + x = GetCenterPoint() + hsVector3((float)cos(fCurRad)*fRadius, (float)sin(fCurRad)*fRadius, 0.0f); x.fZ = fCamera->GetTargetPos().fZ; return x; } @@ -1737,8 +1737,8 @@ hsPoint3 plCameraBrain1_Circle::IGetClosestPointOnCircle(const hsPoint3* toThis) v = hsVector3(¢er, &p); } v.Normalize(); - fGoalRad = (hsScalar)atan2(v.fY, v.fX); // -pi to pi - hsAssert(fGoalRad>=-hsScalarPI && fGoalRad<=hsScalarPI, "Illegal atan2 val"); + fGoalRad = (float)atan2(v.fY, v.fX); // -pi to pi + hsAssert(fGoalRad>=-M_PI && fGoalRad<=M_PI, "Illegal atan2 val"); if (fGoalRad<0) fGoalRad = kTwoPI + fGoalRad; // 0 to 2pi hsAssert(fGoalRad>=0 && fGoalRad<=kTwoPI, "Illegal atan2 val"); @@ -1783,9 +1783,9 @@ void plCameraBrain1_Circle::Read(hsStream* stream, hsResMgr* mgr) fCenter.Read(stream); SetRadius(stream->ReadLEScalar()); - plGenRefMsg* msg = TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnRequest, 0, kCircleTarget ); // SceneObject + plGenRefMsg* msg = new plGenRefMsg(GetKey(), plRefMsg::kOnRequest, 0, kCircleTarget ); // SceneObject mgr->ReadKeyNotifyMe( stream, msg, plRefFlags::kActiveRef ); - plGenRefMsg* msg2 = TRACKED_NEW plGenRefMsg( GetKey(), plRefMsg::kOnRequest, 0, kPOAObject ); // SceneObject + plGenRefMsg* msg2 = new plGenRefMsg( GetKey(), plRefMsg::kOnRequest, 0, kPOAObject ); // SceneObject mgr->ReadKeyNotifyMe( stream, msg2, plRefFlags::kActiveRef ); fCirPerSec = stream->ReadLEScalar(); plgDispatch::Dispatch()->RegisterForExactType(plEvalMsg::Index(), GetKey()); @@ -1842,7 +1842,7 @@ hsBool plCameraBrain1_Circle::MsgReceive(plMessage* msg) } if (fFlags.IsBitSet(kFollowLocalAvatar)) { - plGenRefMsg* msg = TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnRequest, 0, kSubject ); // SceneObject + plGenRefMsg* msg = new plGenRefMsg(GetKey(), plRefMsg::kOnRequest, 0, kSubject ); // SceneObject hsgResMgr::ResMgr()->AddViaNotify(pPMsg->fPlayer, msg, plRefFlags::kPassiveRef); fFlags.SetBit(kCutPosOnce); diff --git a/Sources/Plasma/FeatureLib/pfCamera/plCameraBrain.h b/Sources/Plasma/FeatureLib/pfCamera/plCameraBrain.h index bb00faab..dd26a85e 100644 --- a/Sources/Plasma/FeatureLib/pfCamera/plCameraBrain.h +++ b/Sources/Plasma/FeatureLib/pfCamera/plCameraBrain.h @@ -94,12 +94,12 @@ public: void SetCamera(plCameraModifier1* pMod) { fCamera = pMod; } - void SetAccel (hsScalar f) { fAccel = f; } - void SetDecel (hsScalar f) { fDecel = f; } - void SetVelocity (hsScalar f) { fVelocity = f; } - void SetPOAAccel (hsScalar f) { fPOAAccel = f; } - void SetPOADecel (hsScalar f) { fPOADecel = f; } - void SetPOAVelocity (hsScalar f) { fPOAVelocity = f; } + void SetAccel (float f) { fAccel = f; } + void SetDecel (float f) { fDecel = f; } + void SetVelocity (float f) { fVelocity = f; } + void SetPOAAccel (float f) { fPOAAccel = f; } + void SetPOADecel (float f) { fPOADecel = f; } + void SetPOAVelocity (float f) { fPOAVelocity = f; } const plCameraModifier1* GetCamera() { return fCamera; } @@ -128,13 +128,13 @@ public: void SetGoal(hsPoint3 pt) { fGoal = pt; } void SetPOAGoal(hsPoint3 pt) { fPOAGoal = pt; } - void SetFOVGoal(hsScalar h, double t); - void SetZoomParams(hsScalar max, hsScalar min, hsScalar rate); + void SetFOVGoal(float h, double t); + void SetZoomParams(float max, float min, float rate); - void SetXPanLimit(hsScalar x) {fXPanLimit = x;} - void SetZPanLimit(hsScalar y) {fZPanLimit = y;} - hsScalar GetXPanLimit() {return fXPanLimit;} - hsScalar GetZPanLimit() {return fZPanLimit;} + void SetXPanLimit(float x) {fXPanLimit = x;} + void SetZPanLimit(float y) {fZPanLimit = y;} + float GetXPanLimit() {return fXPanLimit;} + float GetZPanLimit() {return fZPanLimit;} void SetRail(plRailCameraMod* m) { fRail = m; } @@ -144,28 +144,28 @@ public: virtual void Push(hsBool recenter = true); virtual void Pop(); - hsScalar GetVelocity() { return fVelocity; } - hsScalar GetAccel() { return fAccel; } - hsScalar GetDecel() { return fDecel; } - hsScalar GetPOAAccel() { return fPOAAccel; } - hsScalar GetPOAVelocity() { return fPOAVelocity; } - hsScalar GetPOADecel() { return fPOADecel; } - - hsScalar GetCurrentCamSpeed() { return fCurCamSpeed; } - hsScalar GetCurrentViewSpeed() { return fCurViewSpeed; } - - void SetCurrentCamSpeed(hsScalar s) { fCurCamSpeed = s; } - void SetCurrentViewSpeed(hsScalar s) { fCurViewSpeed = s; } + float GetVelocity() { return fVelocity; } + float GetAccel() { return fAccel; } + float GetDecel() { return fDecel; } + float GetPOAAccel() { return fPOAAccel; } + float GetPOAVelocity() { return fPOAVelocity; } + float GetPOADecel() { return fPOADecel; } + + float GetCurrentCamSpeed() { return fCurCamSpeed; } + float GetCurrentViewSpeed() { return fCurViewSpeed; } + + void SetCurrentCamSpeed(float s) { fCurCamSpeed = s; } + void SetCurrentViewSpeed(float s) { fCurViewSpeed = s; } hsMatrix44 GetTargetMatrix() { return fTargetMatrix; } - static hsScalar fFallVelocity; - static hsScalar fFallAccel; - static hsScalar fFallDecel; + static float fFallVelocity; + static float fFallAccel; + static float fFallDecel; - static hsScalar fFallPOAVelocity; - static hsScalar fFallPOAAccel; - static hsScalar fFallPOADecel; + static float fFallPOAVelocity; + static float fFallPOAAccel; + static float fFallPOADecel; protected: @@ -173,48 +173,48 @@ protected: void IMoveTowardGoal(double time); void IPointTowardGoal(double time); void IAnimateFOV(double time); - void IAdjustVelocity(hsScalar adjAccelRate, - hsScalar adjDecelRate, + void IAdjustVelocity(float adjAccelRate, + float adjDecelRate, hsVector3* dir, hsVector3* vel, - hsScalar maxSpeed, - hsScalar distToGoal, + float maxSpeed, + float distToGoal, double elapsedTime); - hsScalar IClampVelocity(hsVector3* vel, hsScalar maxSpeed, double elapsedTime); - hsBool IShouldDecelerate(hsScalar decelSpeed, hsScalar curSpeed, hsScalar distToGoal); + float IClampVelocity(hsVector3* vel, float maxSpeed, double elapsedTime); + hsBool IShouldDecelerate(float decelSpeed, float curSpeed, float distToGoal); plCameraModifier1* fCamera; plKey fSubjectKey; plRailCameraMod* fRail; - hsScalar fCurCamSpeed; - hsScalar fCurViewSpeed; + float fCurCamSpeed; + float fCurViewSpeed; double fLastTime; - hsScalar fVelocity; - hsScalar fAccel; - hsScalar fDecel; - hsScalar fPOAVelocity; - hsScalar fPOAAccel; - hsScalar fPOADecel; + float fVelocity; + float fAccel; + float fDecel; + float fPOAVelocity; + float fPOAAccel; + float fPOADecel; hsVector3 fPOAOffset; hsPoint3 fGoal; hsPoint3 fPOAGoal; - hsScalar fXPanLimit; - hsScalar fZPanLimit; - hsScalar fPanSpeed; - hsScalar fFOVGoal; + float fXPanLimit; + float fZPanLimit; + float fPanSpeed; + float fFOVGoal; double fFOVStartTime; double fFOVEndTime; - hsScalar fFOVAnimRate; - hsScalar fZoomRate; - hsScalar fZoomMax; - hsScalar fZoomMin; + float fFOVAnimRate; + float fZoomRate; + float fZoomMax; + float fZoomMin; hsBitVector fMoveFlags; hsBitVector fFlags; hsMatrix44 fTargetMatrix; - hsScalar fOffsetLength; - hsScalar fOffsetPct; + float fOffsetLength; + float fOffsetPct; double fFallTimer; }; @@ -226,8 +226,8 @@ protected: hsPoint3 fDesiredPosition; hsPoint3 fFacingTarget; hsBool bUseDesiredFacing; - hsScalar deltaX; - hsScalar deltaY; + float deltaX; + float deltaY; hsBool bDisregardY; // these are here to prevent hsBool bDisregardX; // the camera from jumping when the mouse cursor recenters / wraps around. hsVector3 fUp; @@ -238,7 +238,7 @@ public: plCameraBrain1_Drive(plCameraModifier1* pMod); ~plCameraBrain1_Drive(); - static void SetSensitivity(hsScalar f) { fTurnRate = f; } + static void SetSensitivity(float f) { fTurnRate = f; } CLASSNAME_REGISTER( plCameraBrain1_Drive ); GETINTERFACE_ANY( plCameraBrain1_Drive, plCameraBrain1 ); @@ -248,10 +248,10 @@ public: virtual void Push(hsBool recenter = true); virtual void Pop(); - static hsScalar fAcceleration; - static hsScalar fDeceleration; - static hsScalar fMaxVelocity; - static hsScalar fTurnRate; + static float fAcceleration; + static float fDeceleration; + static float fMaxVelocity; + static float fTurnRate; }; @@ -362,13 +362,13 @@ public: kCircleLocalAvatar = 0x40, }; protected: - UInt32 fCircleFlags; + uint32_t fCircleFlags; hsPoint3 fCenter; plSceneObject* fCenterObject; // optional, use instead of fCenter - hsScalar fRadius; - hsScalar fCurRad, fGoalRad; // Radians + float fRadius; + float fCurRad, fGoalRad; // Radians plSceneObject* fPOAObj; // in this case the subject is who we stay close to/away from - hsScalar fCirPerSec; + float fCirPerSec; hsPoint3 IGetClosestPointOnCircle(const hsPoint3* toThisPt); public: @@ -386,16 +386,16 @@ public: virtual void Update(hsBool forced = false); virtual hsBool MsgReceive(plMessage* msg); - UInt32 GetCircleFlags() { return fCircleFlags; } + uint32_t GetCircleFlags() { return fCircleFlags; } hsPoint3* GetCenter() { return &fCenter; } // use GetCenterPoint hsPoint3 GetCenterPoint(); - hsScalar GetRadius() { return fRadius; } + float GetRadius() { return fRadius; } plSceneObject* GetCenterObject() { return fCenterObject; } - void SetCircumferencePerSec(hsScalar h) { fCirPerSec = h; } - void SetCircleFlags(UInt32 f) { fCircleFlags|=f; } + void SetCircumferencePerSec(float h) { fCirPerSec = h; } + void SetCircleFlags(uint32_t f) { fCircleFlags|=f; } void SetCenter(hsPoint3* ctr) { fCenter = *ctr; } // Circle lies in the plane z = ctr->z - void SetRadius(hsScalar radius) { fRadius = radius; } + void SetRadius(float radius) { fRadius = radius; } void SetFarCircleCam(hsBool farType) { if (farType) fCircleFlags |= kFarthest; else fCircleFlags &= ~kFarthest; } void SetCenterObjectKey(plKey k); void SetPOAObject(plSceneObject* pObj) { fPOAObj = pObj; } diff --git a/Sources/Plasma/FeatureLib/pfCamera/plCameraModifier.cpp b/Sources/Plasma/FeatureLib/pfCamera/plCameraModifier.cpp index 62563795..0e592c70 100644 --- a/Sources/Plasma/FeatureLib/pfCamera/plCameraModifier.cpp +++ b/Sources/Plasma/FeatureLib/pfCamera/plCameraModifier.cpp @@ -137,14 +137,14 @@ plSceneObject* plCameraModifier1::GetSubject() return fSubObj; } -void plCameraModifier1::SetFOVw(hsScalar f, hsBool fUpdateVCam) +void plCameraModifier1::SetFOVw(float f, hsBool fUpdateVCam) { fFOVw = f; if (plVirtualCam1::Instance() && fUpdateVCam) plVirtualCam1::SetFOV(fFOVw, fFOVh, this); } -void plCameraModifier1::SetFOVh(hsScalar f, hsBool fUpdateVCam) +void plCameraModifier1::SetFOVh(float f, hsBool fUpdateVCam) { fFOVh = f; if (plVirtualCam1::Instance() && fUpdateVCam) @@ -191,7 +191,7 @@ hsBool plCameraModifier1::MsgReceive(plMessage* msg) double time = (double)fFOVInstructions[pEventMsg->fIndex]->GetConfig()->fAccel; double time2 = (double)pEventMsg->fEventTime; time = hsABS(time - time2); - hsScalar h = fFOVInstructions[pEventMsg->fIndex]->GetConfig()->fFOVh; + float h = fFOVInstructions[pEventMsg->fIndex]->GetConfig()->fFOVh; if (GetBrain()) GetBrain()->SetFOVGoal(h, time); } @@ -323,7 +323,7 @@ void plCameraModifier1::Read(hsStream* stream, hsResMgr* mgr) { hsKeyedObject::Read(stream, mgr); fBrain = nil; - mgr->ReadKeyNotifyMe(stream, TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnCreate, 0, kRefBrain), plRefFlags::kActiveRef); + mgr->ReadKeyNotifyMe(stream, new plGenRefMsg(GetKey(), plRefMsg::kOnCreate, 0, kRefBrain), plRefFlags::kActiveRef); int count = stream->ReadLE32(); int i; for (i = 0; i < count; i++) @@ -333,14 +333,14 @@ void plCameraModifier1::Read(hsStream* stream, hsResMgr* mgr) hsBool cutpos = stream->ReadBool(); hsBool cutpoa = stream->ReadBool(); hsBool ignore = stream->ReadBool(); - hsScalar v = stream->ReadLEScalar(); - hsScalar a = stream->ReadLEScalar(); - hsScalar d = stream->ReadLEScalar(); - hsScalar pV = stream->ReadLEScalar(); - hsScalar pA = stream->ReadLEScalar(); - hsScalar pD = stream->ReadLEScalar(); - - CamTrans* camTrans = TRACKED_NEW CamTrans(key); + float v = stream->ReadLEScalar(); + float a = stream->ReadLEScalar(); + float d = stream->ReadLEScalar(); + float pV = stream->ReadLEScalar(); + float pA = stream->ReadLEScalar(); + float pD = stream->ReadLEScalar(); + + CamTrans* camTrans = new CamTrans(key); camTrans->fAccel = a; camTrans->fDecel = d; camTrans->fVelocity = v; @@ -364,7 +364,7 @@ void plCameraModifier1::Read(hsStream* stream, hsResMgr* mgr) } for(i = 0; i < n; i++ ) { - mgr->ReadKeyNotifyMe(stream, TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnCreate, i, kRefCallbackMsg), plRefFlags::kActiveRef); + mgr->ReadKeyNotifyMe(stream, new plGenRefMsg(GetKey(), plRefMsg::kOnCreate, i, kRefCallbackMsg), plRefFlags::kActiveRef); } n = stream->ReadLE32(); @@ -430,7 +430,7 @@ void plCameraModifier1::Push(hsBool recenter) { if (fStartAnimOnPush) { - plAnimCmdMsg* pMsg = TRACKED_NEW plAnimCmdMsg; + plAnimCmdMsg* pMsg = new plAnimCmdMsg; pMsg->SetCmd(plAnimCmdMsg::kRunForward); pMsg->SetBCastFlag(plMessage::kPropagateToModifiers); pMsg->AddReceiver(GetTarget()->GetKey()); @@ -455,7 +455,7 @@ void plCameraModifier1::Pop() { if (fStopAnimOnPop) { - plAnimCmdMsg* pMsg = TRACKED_NEW plAnimCmdMsg; + plAnimCmdMsg* pMsg = new plAnimCmdMsg; pMsg->SetCmd(plAnimCmdMsg::kStop); pMsg->SetBCastFlag(plMessage::kPropagateToModifiers); pMsg->AddReceiver(GetTarget()->GetKey()); @@ -465,7 +465,7 @@ void plCameraModifier1::Pop() } if (fResetAnimOnPop) { - plAnimCmdMsg* pMsg = TRACKED_NEW plAnimCmdMsg; + plAnimCmdMsg* pMsg = new plAnimCmdMsg; pMsg->SetCmd(plAnimCmdMsg::kGoToBegin); pMsg->SetBCastFlag(plMessage::kPropagateToModifiers); pMsg->AddReceiver(GetTarget()->GetKey()); diff --git a/Sources/Plasma/FeatureLib/pfCamera/plCameraModifier.h b/Sources/Plasma/FeatureLib/pfCamera/plCameraModifier.h index e9378182..267e8468 100644 --- a/Sources/Plasma/FeatureLib/pfCamera/plCameraModifier.h +++ b/Sources/Plasma/FeatureLib/pfCamera/plCameraModifier.h @@ -75,12 +75,12 @@ struct CamTrans hsBool fCutPos; hsBool fCutPOA; hsBool fIgnore; - hsScalar fAccel; - hsScalar fDecel; - hsScalar fVelocity; - hsScalar fPOAAccel; - hsScalar fPOADecel; - hsScalar fPOAVelocity; + float fAccel; + float fDecel; + float fVelocity; + float fPOAAccel; + float fPOADecel; + float fPOAVelocity; }; @@ -96,7 +96,7 @@ class plCameraModifier1 : public plSingleModifier protected: void Output(); - virtual hsBool IEval(double secs, hsScalar del, UInt32 dirty) { return true; } + virtual hsBool IEval(double secs, float del, uint32_t dirty) { return true; } public: @@ -128,10 +128,10 @@ public: void SetTargetPOA(hsPoint3 pos) { fAt = pos; } void SetSubworldPos(hsPoint3 pos) { fLastSubPos = pos; } void SetSubworldPOA(hsPoint3 pos) { fLastSubPOA = pos; } - hsScalar GetFOVw() { return fFOVw; } - hsScalar GetFOVh() { return fFOVh; } - void SetFOVw(hsScalar f, hsBool fUpdateVCam = true); - void SetFOVh(hsScalar f, hsBool fUpdateVCam = true); + 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; } virtual void Read(hsStream* stream, hsResMgr* mgr); @@ -157,8 +157,8 @@ private: plCameraBrain1* fBrain; // the 'logic' portion of the camera hsTArray fTrans; plSceneObject* fSubObj; - hsScalar fFOVw; - hsScalar fFOVh; + float fFOVw; + float fFOVh; hsTArray fMessageQueue; hsTArray fFOVInstructions; hsBool fAnimated, fStartAnimOnPush, fStopAnimOnPop, fResetAnimOnPop; diff --git a/Sources/Plasma/FeatureLib/pfCamera/plInterestingModifier.cpp b/Sources/Plasma/FeatureLib/pfCamera/plInterestingModifier.cpp index 8e953a99..09b69885 100644 --- a/Sources/Plasma/FeatureLib/pfCamera/plInterestingModifier.cpp +++ b/Sources/Plasma/FeatureLib/pfCamera/plInterestingModifier.cpp @@ -40,7 +40,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "hsGeometry3.h" #include "plgDispatch.h" #include "pnSceneObject/plDrawInterface.h" @@ -52,11 +52,11 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "pnKeyedObject/plKey.h" -hsScalar plInterestingModifier::fInterestRadius = 100.0f; -hsScalar plInterestingModifier::fInterestWeight = 1.0f; +float plInterestingModifier::fInterestRadius = 100.0f; +float plInterestingModifier::fInterestWeight = 1.0f; -hsBool plInterestingModifier::IEval(double secs, hsScalar del, UInt32 dirty) +hsBool plInterestingModifier::IEval(double secs, float del, uint32_t dirty) { for (int i=0; i < GetNumTargets(); i++) { @@ -65,7 +65,7 @@ hsBool plInterestingModifier::IEval(double secs, hsScalar del, UInt32 dirty) const hsBounds3Ext& targBnd = GetTarget(i)->GetDrawInterface()->GetWorldBounds(); if( targBnd.GetType() == kBoundsNormal ) { - plInterestingModMsg* pMsg = TRACKED_NEW plInterestingModMsg; + plInterestingModMsg* pMsg = new plInterestingModMsg; pMsg->fPos= GetTarget(i)->GetDrawInterface()->GetWorldBounds().GetCenter(); pMsg->fSize = GetTarget(i)->GetDrawInterface()->GetWorldBounds().GetMaxDim(); pMsg->fRadius = fInterestRadius; diff --git a/Sources/Plasma/FeatureLib/pfCamera/plInterestingModifier.h b/Sources/Plasma/FeatureLib/pfCamera/plInterestingModifier.h index 0a3fe067..1d9c1a1f 100644 --- a/Sources/Plasma/FeatureLib/pfCamera/plInterestingModifier.h +++ b/Sources/Plasma/FeatureLib/pfCamera/plInterestingModifier.h @@ -61,13 +61,13 @@ protected: kTypeLookAtMod, }; - UInt8 fType; - hsScalar fView; + uint8_t fType; + float fView; - static hsScalar fInterestRadius; - static hsScalar fInterestWeight; + static float fInterestRadius; + static float fInterestWeight; - virtual hsBool IEval(double secs, hsScalar del, UInt32 dirty); + virtual hsBool IEval(double secs, float del, uint32_t dirty); public: plInterestingModifier(){ fType = kTypeInteresting;} @@ -78,16 +78,16 @@ public: CLASSNAME_REGISTER( plInterestingModifier ); GETINTERFACE_ANY( plInterestingModifier, plSingleModifier ); - hsScalar GetInterestWeight() { return fInterestWeight; } - hsScalar GetInterestRadius() { return fInterestRadius; } + float GetInterestWeight() { return fInterestWeight; } + float GetInterestRadius() { return fInterestRadius; } - void SetInterestWeight(hsScalar _InterestRadius) { fInterestWeight =_InterestRadius; } - void SetInterestRadius(hsScalar _InterestWeight) { fInterestRadius =_InterestWeight; } + void SetInterestWeight(float _InterestRadius) { fInterestWeight =_InterestRadius; } + void SetInterestRadius(float _InterestWeight) { fInterestRadius =_InterestWeight; } virtual void AddTarget(plSceneObject* so); - void SetType(UInt8 type) { fType = type; } - UInt8 GetType() { return fType; } + void SetType(uint8_t type) { fType = type; } + uint8_t GetType() { return fType; } }; diff --git a/Sources/Plasma/FeatureLib/pfCamera/plVirtualCamNeu.cpp b/Sources/Plasma/FeatureLib/pfCamera/plVirtualCamNeu.cpp index 5dc81326..32febf18 100644 --- a/Sources/Plasma/FeatureLib/pfCamera/plVirtualCamNeu.cpp +++ b/Sources/Plasma/FeatureLib/pfCamera/plVirtualCamNeu.cpp @@ -40,6 +40,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ +#include "HeadSpin.h" #include "plVirtualCamNeu.h" #include "plCameraModifier.h" #include "plCameraBrain.h" @@ -83,24 +84,23 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "plAvatar/plAvatarMgr.h" #include "hsGeometry3.h" -#include "hsConfig.h" #include "hsQuat.h" -hsScalar plVirtualCam1::fFOVw = 45.0f; -hsScalar plVirtualCam1::fFOVh = 33.75f; -hsScalar plVirtualCam1::fHither = 0.3f; -hsScalar plVirtualCam1::fYon = 500.0f; +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; -//hsScalar plVirtualCam1::fAccel = 5.0f; -//hsScalar plVirtualCam1::fDecel = 5.0f; -//hsScalar plVirtualCam1::fVel = 10.0f; -hsScalar plVirtualCam1::fAccel = 50.0f; -hsScalar plVirtualCam1::fDecel = 50.0f; -hsScalar plVirtualCam1::fVel = 100.0f; -hsScalar plVirtualCam1::fPanResponseTime = 3.0f; -hsScalar plVirtualCam1::fFallTimerDelay = 0.25f; +//float plVirtualCam1::fAccel = 5.0f; +//float plVirtualCam1::fDecel = 5.0f; +//float plVirtualCam1::fVel = 10.0f; +float plVirtualCam1::fAccel = 50.0f; +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; @@ -148,7 +148,7 @@ plVirtualCam1::plVirtualCam1() fThirdPersonCam = nil; fTransPos = POS_TRANS_OFF; fPrevCam = nil; - fTransitionCamera = TRACKED_NEW plCameraModifier1; + fTransitionCamera = new plCameraModifier1; fTransitionCamera->RegisterAs(kTransitionCamera_KEY); // set initial view position fOutputPos.Set(100,100,100); @@ -164,8 +164,8 @@ plVirtualCam1::plVirtualCam1() fCameraDriveInterface = plDebugInputInterface::GetInstance(); hsRefCnt_SafeRef( fCameraDriveInterface ); - fDriveCamera = TRACKED_NEW plCameraModifier1; - plCameraBrain1* pDriveBrain = TRACKED_NEW plCameraBrain1_Drive(fDriveCamera); + fDriveCamera = new plCameraModifier1; + plCameraBrain1* pDriveBrain = new plCameraBrain1_Drive(fDriveCamera); PushCamera(fDriveCamera); fForceCutOnce=false; @@ -186,7 +186,7 @@ plVirtualCam1::plVirtualCam1() // only open log file if logging is on if ( !plStatusLog::fLoggingOff ) { - wchar fileAndPath[MAX_PATH]; + wchar_t fileAndPath[MAX_PATH]; PathGetLogDirectory(fileAndPath, arrsize(fileAndPath)); PathAddFilename(fileAndPath, fileAndPath, L"camLog.txt", arrsize(fileAndPath)); foutLog = _wfopen( fileAndPath, L"wt" ); @@ -262,7 +262,7 @@ void plVirtualCam1::RebuildStack(const plKey& key) } if (!HasFlags(kFirstPersonAtLinkOut)) { - plEnableMsg* pMsg = TRACKED_NEW plEnableMsg; + plEnableMsg* pMsg = new plEnableMsg; pMsg->SetSender(GetKey()); pMsg->SetCmd(plEnableMsg::kEnable); pMsg->AddType(plEnableMsg::kDrawable); @@ -287,7 +287,7 @@ void plVirtualCam1::SetOffset(float x, float y, float z) } // static function -void plVirtualCam1::SetFOV(hsScalar x, hsScalar y) +void plVirtualCam1::SetFOV(float x, float y) { float fovW = y * fAspectRatio; @@ -307,12 +307,12 @@ if (printFOV) } // static function -void plVirtualCam1::SetFOV(hsScalar x, hsScalar y, plCameraModifier1* pCam) +void plVirtualCam1::SetFOV(float x, float y, plCameraModifier1* pCam) { if (plVirtualCam1::Instance()->GetCurrentCamera() != pCam) return; - hsScalar diff = hsABS(fFOVw - x); + float diff = hsABS(fFOVw - x); if (diff > 10.0f) { #ifdef STATUS_LOG @@ -339,7 +339,7 @@ void plVirtualCam1::SetFOV(hsScalar x, hsScalar y, plCameraModifier1* pCam) // static function -void plVirtualCam1::SetDepth(hsScalar h, hsScalar y) +void plVirtualCam1::SetDepth(float h, float y) { return; fHither = h; @@ -490,7 +490,7 @@ void plVirtualCam1::ICreatePlate() plMipmap *ourMip = fEffectPlate->CreateMaterial( 16, 16, true ); for( y = 0; y < ourMip->GetHeight(); y++ ) { - UInt32 *pixels = ourMip->GetAddr32( 0, y ); + uint32_t *pixels = ourMip->GetAddr32( 0, y ); for( x = 0; x < ourMip->GetWidth(); x++ ) pixels[ x ] = 0xff000000; } @@ -684,17 +684,17 @@ void plVirtualCam1::AdjustForInput() UnPanIfNeeded(); - hsScalar panSpeed = 0.5f; + float panSpeed = 0.5f; double secs = hsTimer::GetDelSysSeconds(); if (HasMovementFlag(B_CAMERA_PAN_UP)) - fY -= (hsScalar)(panSpeed * secs); + fY -= (float)(panSpeed * secs); if (HasMovementFlag(B_CAMERA_PAN_DOWN)) - fY += (hsScalar)(panSpeed * secs); + fY += (float)(panSpeed * secs); if (HasMovementFlag(B_CAMERA_PAN_LEFT)) - fX -= (hsScalar)(panSpeed * secs); + fX -= (float)(panSpeed * secs); if (HasMovementFlag(B_CAMERA_PAN_RIGHT)) - fX += (hsScalar)(panSpeed * secs); + fX += (float)(panSpeed * secs); } if ((fY == 0.5f && fX == 0.5f) && fFirstPersonOverride == nil) @@ -725,17 +725,17 @@ void plVirtualCam1::AdjustForInput() // scale maximum angle by % mouse input - hsScalar scaledX; + float scaledX; if (fFirstPersonOverride) scaledX = 3.14159; else - scaledX = (hsScalar)(3.14159 - (fXPanLimit * ( (fX - 0.5f) / 0.5f))); + scaledX = (float)(3.14159 - (fXPanLimit * ( (fX - 0.5f) / 0.5f))); - hsScalar scaledZ; + float scaledZ; if (fFirstPersonOverride) - scaledZ = (hsScalar)(3.14159 - (0.872f * ( (fY - 0.5f) / 0.5f))); + scaledZ = (float)(3.14159 - (0.872f * ( (fY - 0.5f) / 0.5f))); else - scaledZ = (hsScalar)(3.14159 - (fZPanLimit * ( (fY - 0.5f) / 0.5f))); + scaledZ = (float)(3.14159 - (fZPanLimit * ( (fY - 0.5f) / 0.5f))); hsMatrix44 mX; hsMatrix44 mZ; @@ -824,7 +824,7 @@ void plVirtualCam1::Output() fFadeCounter-=1; if (fFadeCounter == 0 && fFirstPersonOverride == nil) { - plEnableMsg* pMsg = TRACKED_NEW plEnableMsg; + plEnableMsg* pMsg = new plEnableMsg; pMsg->SetSender(GetKey()); pMsg->SetCmd(plEnableMsg::kEnable); pMsg->AddType(plEnableMsg::kDrawable); @@ -888,7 +888,7 @@ void plVirtualCam1::Init() plgDispatch::Dispatch()->RegisterForExactType(plPlayerPageMsg::Index(), GetKey()); // register for control messages - plCmdIfaceModMsg* pModMsg = TRACKED_NEW plCmdIfaceModMsg; + plCmdIfaceModMsg* pModMsg = new plCmdIfaceModMsg; pModMsg->SetBCastFlag(plMessage::kBCastByExactType); pModMsg->SetSender(GetKey()); pModMsg->SetCmd(plCmdIfaceModMsg::kAdd); @@ -1068,8 +1068,8 @@ hsBool plVirtualCam1::MsgReceive(plMessage* msg) { if (!HasFlags(kFalling)) { - hsScalar dX = pMouseMsg->GetDX(); - hsScalar dY = pMouseMsg->GetDY(); + float dX = pMouseMsg->GetDX(); + float dY = pMouseMsg->GetDY(); if (plMouseDevice::GetInverted()) { dX *= -1.f; @@ -1238,7 +1238,7 @@ hsBool plVirtualCam1::MsgReceive(plMessage* msg) fPythonOverride->Push(!HasFlags(kAvatarWalking)); - CamTrans* pTrans = TRACKED_NEW CamTrans(fPythonOverride->GetKey()); + CamTrans* pTrans = new CamTrans(fPythonOverride->GetKey()); if (pCam->Cmd(plCameraMsg::kPythonOverridePushCut)) pTrans->fCutPOA = pTrans->fCutPos = true; StartTransition(pTrans); @@ -1302,7 +1302,7 @@ hsBool plVirtualCam1::MsgReceive(plMessage* msg) if (HasFlags(kJustLinkedIn)) { ClearFlags(kJustLinkedIn); - plCameraTargetFadeMsg* pMsg = TRACKED_NEW plCameraTargetFadeMsg; + plCameraTargetFadeMsg* pMsg = new plCameraTargetFadeMsg; pMsg->SetFadeOut(true); pMsg->SetSubjectKey(plNetClientMgr::GetInstance()->GetLocalPlayerKey()); pMsg->SetBCastFlag(plMessage::kBCastByExactType); @@ -1420,17 +1420,17 @@ void plVirtualCam1::CreateDefaultCamera(plSceneObject* subject) if (mod->GetSubject() == subject) return; - plGenRefMsg* msg = TRACKED_NEW plGenRefMsg(mod->GetKey(), plRefMsg::kOnReplace, 0, plCameraBrain1::kSubject ); + plGenRefMsg* msg = new plGenRefMsg(mod->GetKey(), plRefMsg::kOnReplace, 0, plCameraBrain1::kSubject ); msg->SetOldRef(mod->GetSubject()); hsgResMgr::ResMgr()->AddViaNotify(subject->GetKey(), msg, plRefFlags::kPassiveRef); } else { - plCameraModifier1* pMod = TRACKED_NEW plCameraModifier1; - plCameraBrain1_FirstPerson* pBrain = TRACKED_NEW plCameraBrain1_FirstPerson(pMod); + plCameraModifier1* pMod = new plCameraModifier1; + plCameraBrain1_FirstPerson* pBrain = new plCameraBrain1_FirstPerson(pMod); pMod->RegisterAs( kDefaultCameraMod1_KEY ); //pBrain->SetSubject(subject); - plGenRefMsg* msg = TRACKED_NEW plGenRefMsg(pMod->GetKey(), plRefMsg::kOnCreate, 0, plCameraBrain1::kSubject ); // SceneObject + plGenRefMsg* msg = new plGenRefMsg(pMod->GetKey(), plRefMsg::kOnCreate, 0, plCameraBrain1::kSubject ); // SceneObject hsgResMgr::ResMgr()->AddViaNotify(subject->GetKey(), msg, plRefFlags::kPassiveRef); plgDispatch::Dispatch()->RegisterForExactType(plEvalMsg::Index(), pMod->GetKey()); @@ -1459,16 +1459,16 @@ void plVirtualCam1::CreateDefaultCamera(plSceneObject* subject) if (mod->GetSubject() == subject) return; - plGenRefMsg* msg = TRACKED_NEW plGenRefMsg(mod->GetKey(), plRefMsg::kOnReplace, 0, plCameraBrain1::kSubject ); + plGenRefMsg* msg = new plGenRefMsg(mod->GetKey(), plRefMsg::kOnReplace, 0, plCameraBrain1::kSubject ); msg->SetOldRef(mod->GetSubject()); hsgResMgr::ResMgr()->AddViaNotify(subject->GetKey(), msg, plRefFlags::kPassiveRef); } else { - plCameraModifier1* pModx = TRACKED_NEW plCameraModifier1; - plCameraBrain1_Avatar* pBrainx = TRACKED_NEW plCameraBrain1_Avatar(pModx); + plCameraModifier1* pModx = new plCameraModifier1; + plCameraBrain1_Avatar* pBrainx = new plCameraBrain1_Avatar(pModx); pModx->RegisterAs( kBuiltIn3rdPersonCamera_KEY ); - plGenRefMsg* msgx = TRACKED_NEW plGenRefMsg(pModx->GetKey(), plRefMsg::kOnCreate, 0, plCameraBrain1::kSubject ); // SceneObject + plGenRefMsg* msgx = new plGenRefMsg(pModx->GetKey(), plRefMsg::kOnCreate, 0, plCameraBrain1::kSubject ); // SceneObject hsgResMgr::ResMgr()->AddViaNotify(subject->GetKey(), msgx, plRefFlags::kPassiveRef); plgDispatch::Dispatch()->RegisterForExactType(plEvalMsg::Index(), pModx->GetKey()); @@ -1503,7 +1503,7 @@ void plVirtualCam1::AddCameraToStack(plCameraModifier1* pCam) } if (pCam->GetKey()) - hsgResMgr::ResMgr()->AddViaNotify(pCam->GetKey(), TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnCreate, 0, kRefCamera), plRefFlags::kPassiveRef); + hsgResMgr::ResMgr()->AddViaNotify(pCam->GetKey(), new plGenRefMsg(GetKey(), plRefMsg::kOnCreate, 0, kRefCamera), plRefFlags::kPassiveRef); } void plVirtualCam1::PushCamera(plCameraModifier1* pCam, hsBool bDefault) @@ -1570,7 +1570,7 @@ void plVirtualCam1::PushCamera(plCameraModifier1* pCam, hsBool bDefault) if (!pCam->SetFaded(true)) { // new camera doesn't support fading, fade him back in - plCameraTargetFadeMsg* pMsg = TRACKED_NEW plCameraTargetFadeMsg; + plCameraTargetFadeMsg* pMsg = new plCameraTargetFadeMsg; pMsg->SetFadeOut(false); pMsg->SetSubjectKey(GetCurrentStackCamera()->GetBrain()->GetSubject()->GetKey()); pMsg->SetBCastFlag(plMessage::kBCastByExactType); @@ -1628,7 +1628,7 @@ void plVirtualCam1::PushCamera(plCameraModifier1* pCam, hsBool bDefault) // do a track transition here; fPrevCam = GetCurrentStackCamera(); AddCameraToStack(pCam); - pTrans = TRACKED_NEW CamTrans(pCam->GetKey()); + pTrans = new CamTrans(pCam->GetKey()); StartTransition(pTrans); delete(pTrans); #ifdef STATUS_LOG @@ -1639,7 +1639,7 @@ void plVirtualCam1::PushCamera(plCameraModifier1* pCam, hsBool bDefault) { // both fixed brains, cut between them AddCameraToStack(pCam); - pTrans = TRACKED_NEW CamTrans(pCam->GetKey()); + pTrans = new CamTrans(pCam->GetKey()); pTrans->fCutPOA = true; pTrans->fCutPos = true; StartTransition(pTrans); @@ -1747,7 +1747,7 @@ void plVirtualCam1::PopCamera(plCameraModifier1* pCam) if (!GetCurrentStackCamera()->SetFaded(true)) { // new camera doesn't support fading, fade him back in - plCameraTargetFadeMsg* pMsg = TRACKED_NEW plCameraTargetFadeMsg; + plCameraTargetFadeMsg* pMsg = new plCameraTargetFadeMsg; pMsg->SetFadeOut(false); pMsg->SetSubjectKey(pCam->GetBrain()->GetSubject()->GetKey()); pMsg->SetBCastFlag(plMessage::kBCastByExactType); @@ -1781,14 +1781,14 @@ void plVirtualCam1::PopCamera(plCameraModifier1* pCam) { // do a track transition here; fPrevCam = pCam; - pTrans = TRACKED_NEW CamTrans(GetCurrentStackCamera()->GetKey()); + pTrans = new CamTrans(GetCurrentStackCamera()->GetKey()); StartTransition(pTrans); delete(pTrans); } else { fPrevCam = pCam; - pTrans = TRACKED_NEW CamTrans(GetCurrentStackCamera()->GetKey()); + pTrans = new CamTrans(GetCurrentStackCamera()->GetKey()); pTrans->fCutPOA = true; pTrans->fCutPos = true; StartTransition(pTrans); @@ -1867,7 +1867,7 @@ void plVirtualCam1::StartTransition(CamTrans* transition) if ( (fPythonOverride && plCameraBrain1_Avatar::ConvertNoRef(fPythonOverride->GetBrain())) || (plCameraBrain1_Avatar::ConvertNoRef(pCam->GetBrain()) && !fPythonOverride) ) { - plCameraBrain1_Avatar* pAvBrain = TRACKED_NEW plCameraBrain1_Avatar; + plCameraBrain1_Avatar* pAvBrain = new plCameraBrain1_Avatar; pAvBrain->SetOffset(((plCameraBrain1_Avatar*)pCam->GetBrain())->GetOffset()); pAvBrain->SetPOAOffset(pCam->GetBrain()->GetPOAOffset()); @@ -1888,7 +1888,7 @@ void plVirtualCam1::StartTransition(CamTrans* transition) } else { - pBrain = TRACKED_NEW plCameraBrain1; + pBrain = new plCameraBrain1; } pBrain->SetFlags(plCameraBrain1::kIsTransitionCamera); @@ -1906,7 +1906,7 @@ void plVirtualCam1::StartTransition(CamTrans* transition) curVec.fZ = transVec.fZ = 0; transVec.Normalize(); curVec.Normalize(); - hsScalar dot = curVec * transVec; + float dot = curVec * transVec; if (dot <= 0.5f || transVec.MagnitudeSquared() != 0.0f) { pBrain->SetPOAAccel(100); @@ -1973,7 +1973,7 @@ void plVirtualCam1::StartTransition(CamTrans* transition) pBrain->SetCamera(fTransitionCamera); // deal with FOV - - hsScalar diffH = hsABS(pCam->GetFOVh() - fPrevCam->GetFOVh()); + float diffH = hsABS(pCam->GetFOVh() - fPrevCam->GetFOVh()); if ( diffH ) { double time = 0; @@ -2029,7 +2029,7 @@ void plVirtualCam1::RunTransition() plCameraBrain1_Avatar* pAvBr = plCameraBrain1_Avatar::ConvertNoRef(pBrain); if (pAvBr) { - hsScalar off = pAvBr->GetOffset().MagnitudeSquared(); + float off = pAvBr->GetOffset().MagnitudeSquared(); hsVector3 dist(pToCam->GetTargetPos() - fTransitionCamera->GetTargetPos()); if (dist.MagnitudeSquared() > off) fTransitionCamera->GetBrain()->SetFlags(plCameraBrain1::kPanicVelocity); diff --git a/Sources/Plasma/FeatureLib/pfCamera/plVirtualCamNeu.h b/Sources/Plasma/FeatureLib/pfCamera/plVirtualCamNeu.h index 12b08b69..015681b2 100644 --- a/Sources/Plasma/FeatureLib/pfCamera/plVirtualCamNeu.h +++ b/Sources/Plasma/FeatureLib/pfCamera/plVirtualCamNeu.h @@ -120,13 +120,13 @@ public: void Init(); virtual hsBool MsgReceive(plMessage* msg); - static void SetFOV(hsScalar w, hsScalar h); - static void SetFOV(hsScalar w, hsScalar h, plCameraModifier1* pCam); - static void SetDepth(hsScalar h, hsScalar y); - static hsScalar GetFOVw() { return fFOVw; } - static hsScalar GetFOVh() { return fFOVh; } - static hsScalar GetHither() { return fHither; } - static hsScalar GetYon() { return fYon; } + static void SetFOV(float w, float h); + static void SetFOV(float w, float h, plCameraModifier1* pCam); + static void SetDepth(float h, float y); + static float GetFOVw() { return fFOVw; } + static float GetFOVh() { return fFOVh; } + static float GetHither() { return fHither; } + static float GetYon() { return fYon; } static void SetOffset(float x, float y, float z); static void SetAspectRatio(float aspect) { fAspectRatio = aspect; } static float GetAspectRatio() { return fAspectRatio; } @@ -174,8 +174,8 @@ public: void StartUnPan(); // these are for console access static hsBool fUseAccelOverride, freeze, alwaysCutForColin, WalkPan3rdPerson,StayInFirstPersonForever; - static hsScalar fDecel, fAccel, fVel; - static hsScalar fFallTimerDelay; + static float fDecel, fAccel, fVel; + static float fFallTimerDelay; private: @@ -215,19 +215,19 @@ private: hsBitVector fFlags; hsTArray fCamerasLoaded; hsBitVector fMoveFlags; - hsScalar fX; - hsScalar fY; - hsScalar fXPanLimit; - hsScalar fZPanLimit; - hsScalar fXPanLimitGoal; - hsScalar fZPanLimitGoal; - hsScalar fXUnPanRate; - hsScalar fZUnPanRate; - hsScalar fXPanInterpRate; - hsScalar fZPanInterpRate; + float fX; + float fY; + float fXPanLimit; + float fZPanLimit; + float fXPanLimitGoal; + float fZPanLimitGoal; + float fXUnPanRate; + float fZUnPanRate; + float fXPanInterpRate; + float fZPanInterpRate; double fUnPanEndTime; double fInterpPanLimitTime; - hsScalar fRetainedFY; + float fRetainedFY; // built-in cameras plCameraModifier1* fDriveCamera; // for driving around @@ -237,11 +237,11 @@ private: plCameraModifier1* fPrevCam; // the last camera we were displaying plCameraModifier1* fThirdPersonCam; // built in third person cam for ccr's when they jump about - static hsScalar fFOVh, fFOVw; - static hsScalar fHither, fYon; + static float fFOVh, fFOVw; + static float fHither, fYon; static plVirtualCam1* fInstance; static hsBool printFOV; - static hsScalar fPanResponseTime; + static float fPanResponseTime; static float fAspectRatio; hsBool fForceCutOnce; diff --git a/Sources/Plasma/FeatureLib/pfCharacter/pfMarkerInfo.cpp b/Sources/Plasma/FeatureLib/pfCharacter/pfMarkerInfo.cpp index 28b27400..2b8175d3 100644 --- a/Sources/Plasma/FeatureLib/pfCharacter/pfMarkerInfo.cpp +++ b/Sources/Plasma/FeatureLib/pfCharacter/pfMarkerInfo.cpp @@ -67,7 +67,7 @@ void pfMarkerInfo::Init() plResManager* resMgr = (plResManager*)hsgResMgr::ResMgr(); // Force the client to keep the GlobalMarkers keys loaded, so we don't load them every time we clone - plClientMsg* loadAgeKeysMsg = TRACKED_NEW plClientMsg(plClientMsg::kLoadAgeKeys); + plClientMsg* loadAgeKeysMsg = new plClientMsg(plClientMsg::kLoadAgeKeys); loadAgeKeysMsg->SetAgeName("GlobalMarkers"); loadAgeKeysMsg->Send(resMgr->FindKey(kClient_KEY)); @@ -112,7 +112,7 @@ void pfMarkerInfo::Spawn(MarkerType type) fType = type; fLastChange = 0; - plLoadCloneMsg* cloneMsg = TRACKED_NEW plLoadCloneMsg(fMarkerUoid, pfMarkerMgr::Instance()->GetKey(), 0); + plLoadCloneMsg* cloneMsg = new plLoadCloneMsg(fMarkerUoid, pfMarkerMgr::Instance()->GetKey(), 0); cloneMsg->SetBCastFlag(plMessage::kNetPropagate, false); fKey = cloneMsg->GetCloneKey(); @@ -133,7 +133,7 @@ void pfMarkerInfo::InitSpawned(plKey markerKey) hsMatrix44 pos; pos.Reset(); pos.SetTranslate(&fPosition); - plWarpMsg* warpMsg = TRACKED_NEW plWarpMsg(pfMarkerMgr::Instance()->GetKey(), fKey, plWarpMsg::kFlushTransform, pos); + plWarpMsg* warpMsg = new plWarpMsg(pfMarkerMgr::Instance()->GetKey(), fKey, plWarpMsg::kFlushTransform, pos); warpMsg->Send(); // update its state @@ -148,7 +148,7 @@ void pfMarkerInfo::Show(bool show) fVisible = show; if (fSpawned) { - plEnableMsg* msg = TRACKED_NEW plEnableMsg; + plEnableMsg* msg = new plEnableMsg; msg->SetBCastFlag(plMessage::kPropagateToChildren); msg->SetCmd(plEnableMsg::kDrawable); msg->SetCmd(plEnableMsg::kPhysical); @@ -183,7 +183,7 @@ void pfMarkerInfo::Remove() { if (fKey) { - plLoadCloneMsg* cloneMsg = TRACKED_NEW plLoadCloneMsg(fKey, pfMarkerMgr::Instance()->GetKey(), 0, false); + plLoadCloneMsg* cloneMsg = new plLoadCloneMsg(fKey, pfMarkerMgr::Instance()->GetKey(), 0, false); cloneMsg->SetBCastFlag(plMessage::kNetPropagate, false); cloneMsg->Send(); @@ -210,7 +210,7 @@ void pfMarkerInfo::IPlayBounce(bool play) if (fMod && fSpawned) { // Send anim start/stop msg - plAnimCmdMsg* animMsg = TRACKED_NEW plAnimCmdMsg; + plAnimCmdMsg* animMsg = new plAnimCmdMsg; animMsg->SetCmd(play ? plAnimCmdMsg::kContinue : plAnimCmdMsg::kStop); animMsg->SetCmd(plAnimCmdMsg::kSetLooping); animMsg->SetCmd(plAnimCmdMsg::kGoToBegin); @@ -242,7 +242,7 @@ void pfMarkerInfo::IPlayColor(bool play) break; } - plAnimCmdMsg* animMsg = TRACKED_NEW plAnimCmdMsg; + plAnimCmdMsg* animMsg = new plAnimCmdMsg; animMsg->SetCmd(play ? plAnimCmdMsg::kContinue : plAnimCmdMsg::kStop); animMsg->SetCmd(plAnimCmdMsg::kSetLooping); animMsg->SetCmd(plAnimCmdMsg::kGoToBegin); @@ -258,7 +258,7 @@ void pfMarkerInfo::IPlaySound(bool place) { const plAudioInterface* ai = fMod->GetTarget()->GetAudioInterface(); - plSoundMsg* msg = TRACKED_NEW plSoundMsg; + plSoundMsg* msg = new plSoundMsg; msg->fIndex = place ? fMod->fPlaceSndIdx : fMod->fHitSndIdx; msg->SetCmd(plSoundMsg::kPlay); msg->SetSender(pfMarkerMgr::Instance()->GetKey()); diff --git a/Sources/Plasma/FeatureLib/pfCharacter/pfMarkerMgr.cpp b/Sources/Plasma/FeatureLib/pfCharacter/pfMarkerMgr.cpp index 33be9031..8ac17bc9 100644 --- a/Sources/Plasma/FeatureLib/pfCharacter/pfMarkerMgr.cpp +++ b/Sources/Plasma/FeatureLib/pfCharacter/pfMarkerMgr.cpp @@ -56,13 +56,13 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com //////////////////////////////////////////////////////////////////////////////// pfMarkerMgr* pfMarkerMgr::fInstance = nil; -const UInt32 pfMarkerMgr::kNoMarkerSelected = (UInt32)(-1); +const uint32_t pfMarkerMgr::kNoMarkerSelected = (uint32_t)(-1); pfMarkerMgr* pfMarkerMgr::Instance() { if (!pfMarkerMgr::fInstance) { - pfMarkerMgr::fInstance = TRACKED_NEW pfMarkerMgr; + pfMarkerMgr::fInstance = new pfMarkerMgr; pfMarkerMgr::fInstance->IInit(); } @@ -99,11 +99,11 @@ void pfMarkerMgr::IInit() void pfMarkerMgr::IShutdown() { - std::map::iterator curMarker = fMarkers.begin(); + std::map::iterator curMarker = fMarkers.begin(); while (curMarker != fMarkers.end()) { curMarker->second->Remove(); - DEL(curMarker->second); + delete curMarker->second; ++curMarker; } fMarkers.clear(); @@ -112,9 +112,9 @@ void pfMarkerMgr::IShutdown() UnRegisterAs(kMarkerMgr_KEY); } -pfMarkerInfo* pfMarkerMgr::IFindMarker(plKey markerKey, UInt32& id) +pfMarkerInfo* pfMarkerMgr::IFindMarker(plKey markerKey, uint32_t& id) { - std::map::iterator curMarker = fMarkers.begin(); + std::map::iterator curMarker = fMarkers.begin(); while (curMarker != fMarkers.end()) { if (curMarker->second->GetKey() == markerKey) @@ -131,7 +131,7 @@ pfMarkerInfo* pfMarkerMgr::IFindMarker(plKey markerKey, UInt32& id) void pfMarkerMgr::IUpdate() { // Update all markers - std::map::iterator curMarker = fMarkers.begin(); + std::map::iterator curMarker = fMarkers.begin(); while (curMarker != fMarkers.end()) { curMarker->second->Update(hsTimer::GetSeconds()); @@ -145,7 +145,7 @@ void pfMarkerMgr::IMarkerHit(plKey markerKey, plKey playerKey) return; // not the local player, abort // make sure the marker isn't frozen - UInt32 id; + uint32_t id; pfMarkerInfo* hitMarker = IFindMarker(markerKey, id); if (!hitMarker) return; // abort, something weird is going on @@ -153,42 +153,42 @@ void pfMarkerMgr::IMarkerHit(plKey markerKey, plKey playerKey) return; // marker frozen, abort // tell people about it - pfMarkerMsg* msg = TRACKED_NEW pfMarkerMsg; + pfMarkerMsg* msg = new pfMarkerMsg; msg->fType = pfMarkerMsg::kMarkerCaptured; msg->fMarkerID = id; msg->Send(); } -void pfMarkerMgr::AddMarker(double x, double y, double z, UInt32 id, bool justCreated) +void pfMarkerMgr::AddMarker(double x, double y, double z, uint32_t id, bool justCreated) { if (fMarkers.find(id) != fMarkers.end()) { // delete existing one if we're changing its location fMarkers[id]->Remove(); - DEL(fMarkers[id]); + delete fMarkers[id]; } - hsPoint3 pos((hsScalar)x, (hsScalar)y, (hsScalar)z); - fMarkers[id] = TRACKED_NEW pfMarkerInfo(pos, justCreated); + hsPoint3 pos((float)x, (float)y, (float)z); + fMarkers[id] = new pfMarkerInfo(pos, justCreated); fMarkers[id]->Spawn(pfMarkerInfo::kMarkerOpen); } -void pfMarkerMgr::RemoveMarker(UInt32 id) +void pfMarkerMgr::RemoveMarker(uint32_t id) { if (fMarkers.find(id) == fMarkers.end()) return; fMarkers[id]->Remove(); - DEL(fMarkers[id]); + delete fMarkers[id]; fMarkers.erase(id); } void pfMarkerMgr::RemoveAllMarkers() { - std::map::iterator curMarker = fMarkers.begin(); + std::map::iterator curMarker = fMarkers.begin(); while (curMarker != fMarkers.end()) { curMarker->second->Remove(); - DEL(curMarker->second); + delete curMarker->second; ++curMarker; } fMarkers.clear(); @@ -204,7 +204,7 @@ void pfMarkerMgr::ClearSelectedMarker() } } -void pfMarkerMgr::SetSelectedMarker(UInt32 id) +void pfMarkerMgr::SetSelectedMarker(uint32_t id) { ClearSelectedMarker(); @@ -218,13 +218,13 @@ void pfMarkerMgr::SetSelectedMarker(UInt32 id) } } -UInt32 pfMarkerMgr::GetSelectedMarker() +uint32_t pfMarkerMgr::GetSelectedMarker() { return fSelectedMarker; } // for QUEST games (no teams) -void pfMarkerMgr::CaptureMarker(UInt32 id, bool captured) +void pfMarkerMgr::CaptureMarker(uint32_t id, bool captured) { if (fMarkers.find(id) == fMarkers.end()) return; @@ -239,7 +239,7 @@ void pfMarkerMgr::CaptureMarker(UInt32 id, bool captured) } // for TEAM games (0 = not captured) -void pfMarkerMgr::CaptureMarker(UInt32 id, int team) +void pfMarkerMgr::CaptureMarker(uint32_t id, int team) { if (fMarkers.find(id) == fMarkers.end()) return; @@ -263,13 +263,13 @@ void pfMarkerMgr::LocalShowMarkers(bool show) fShowingLocalMarkers = show; if (show) { - std::map::iterator curMarker = fMarkers.begin(); + std::map::iterator curMarker = fMarkers.begin(); while (curMarker != fMarkers.end()) curMarker->second->Show(true); } else { - std::map::iterator curMarker = fMarkers.begin(); + std::map::iterator curMarker = fMarkers.begin(); while (curMarker != fMarkers.end()) curMarker->second->Show(false); } @@ -317,7 +317,7 @@ hsBool pfMarkerMgr::MsgReceive(plMessage* msg) plKey cloneKey = cloneMsg->GetCloneKey(); if (cloneMsg->GetIsLoading() && cloneKey) { - UInt32 id; + uint32_t id; pfMarkerInfo* marker = IFindMarker(cloneKey, id); marker->InitSpawned(cloneKey); } @@ -326,4 +326,4 @@ hsBool pfMarkerMgr::MsgReceive(plMessage* msg) } return hsKeyedObject::MsgReceive(msg); -} \ No newline at end of file +} diff --git a/Sources/Plasma/FeatureLib/pfCharacter/pfMarkerMgr.h b/Sources/Plasma/FeatureLib/pfCharacter/pfMarkerMgr.h index 7cf04967..f74137bd 100644 --- a/Sources/Plasma/FeatureLib/pfCharacter/pfMarkerMgr.h +++ b/Sources/Plasma/FeatureLib/pfCharacter/pfMarkerMgr.h @@ -68,14 +68,14 @@ protected: bool fShowingLocalMarkers; bool fMarkersRespawn; - UInt32 fSelectedMarker; - static const UInt32 kNoMarkerSelected; - std::map fMarkers; // key is marker id number + uint32_t fSelectedMarker; + static const uint32_t kNoMarkerSelected; + std::map fMarkers; // key is marker id number void IInit(); void IShutdown(); - pfMarkerInfo* IFindMarker(plKey markerKey, UInt32& id); + pfMarkerInfo* IFindMarker(plKey markerKey, uint32_t& id); void IUpdate(); void IMarkerHit(plKey markerKey, plKey playerKey); @@ -91,19 +91,19 @@ public: hsBool MsgReceive(plMessage* msg); - void AddMarker(double x, double y, double z, UInt32 id, bool justCreated); - void RemoveMarker(UInt32 id); + void AddMarker(double x, double y, double z, uint32_t id, bool justCreated); + void RemoveMarker(uint32_t id); void RemoveAllMarkers(); void ClearSelectedMarker(); - void SetSelectedMarker(UInt32 id); - UInt32 GetSelectedMarker(); + void SetSelectedMarker(uint32_t id); + uint32_t GetSelectedMarker(); void SetMarkersRespawn(bool respawn) {fMarkersRespawn = respawn;} bool GetMarkersRespawn() {return fMarkersRespawn;} - void CaptureMarker(UInt32 id, bool captured); // for QUEST games (no teams) - void CaptureMarker(UInt32 id, int team); // for TEAM games (0 = not captured) + void CaptureMarker(uint32_t id, bool captured); // for QUEST games (no teams) + void CaptureMarker(uint32_t id, int team); // for TEAM games (0 = not captured) // Shows your markers locally, so you can see where they are void LocalShowMarkers(bool show = true); diff --git a/Sources/Plasma/FeatureLib/pfCharacter/plPlayerModifier.cpp b/Sources/Plasma/FeatureLib/pfCharacter/plPlayerModifier.cpp index 8a99984e..bda6531f 100644 --- a/Sources/Plasma/FeatureLib/pfCharacter/plPlayerModifier.cpp +++ b/Sources/Plasma/FeatureLib/pfCharacter/plPlayerModifier.cpp @@ -47,7 +47,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com //#include // for havok Vertex // // -//#include "hsTypes.h" +//#include "HeadSpin.h" //#include "../plInterp/plController.h" //#include "plPlayerModifier.h" //#include "hsTimer.h" @@ -77,10 +77,10 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // //#include "../plHavok1/plHKPhysical.h" // -//hsScalar plPlayerModifier::fTurnRate = 1.0f; -//hsScalar plPlayerModifier::fAcceleration = 80.0f; -//hsScalar plPlayerModifier::fDeceleration = 80.0f; -//hsScalar plPlayerModifier::fMaxVelocity = 200.0f; +//float plPlayerModifier::fTurnRate = 1.0f; +//float plPlayerModifier::fAcceleration = 80.0f; +//float plPlayerModifier::fDeceleration = 80.0f; +//float plPlayerModifier::fMaxVelocity = 200.0f; // //plPlayerModifier::plPlayerModifier() : //bUseDesiredFacing(false), @@ -107,15 +107,15 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com //{ // if( fTarget && fTarget->IsLocallyOwned()==plSynchedObject::kYes ) // { -// plCameraMsg* pMsg = TRACKED_NEW plCameraMsg; +// plCameraMsg* pMsg = new plCameraMsg; // pMsg->SetCmd(plCameraMsg::kSetSubject); // pMsg->SetSubject(nil); // pMsg->SetBCastFlag( plMessage::kBCastByExactType ); // plgDispatch::MsgSend(pMsg); // -// plAudioSysMsg* pAudMsg1 = TRACKED_NEW plAudioSysMsg(plAudioSysMsg::kSetListenerCoordinateRefCamera); -// plAudioSysMsg* pAudMsg2 = TRACKED_NEW plAudioSysMsg(plAudioSysMsg::kSetListenerVelocityRefCamera); -// plAudioSysMsg* pAudMsg3 = TRACKED_NEW plAudioSysMsg(plAudioSysMsg::kSetListenerFacingRefCamera); +// plAudioSysMsg* pAudMsg1 = new plAudioSysMsg(plAudioSysMsg::kSetListenerCoordinateRefCamera); +// plAudioSysMsg* pAudMsg2 = new plAudioSysMsg(plAudioSysMsg::kSetListenerVelocityRefCamera); +// plAudioSysMsg* pAudMsg3 = new plAudioSysMsg(plAudioSysMsg::kSetListenerFacingRefCamera); // plgDispatch::MsgSend(pAudMsg1); // plgDispatch::MsgSend(pAudMsg2); // plgDispatch::MsgSend(pAudMsg3); @@ -152,14 +152,14 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // //void plPlayerModifier::IDoLocalSetup(plSceneObject* so) //{ -// plCameraMsg* pMsg = TRACKED_NEW plCameraMsg; +// plCameraMsg* pMsg = new plCameraMsg; // pMsg->SetCmd(plCameraMsg::kSetSubject); // pMsg->SetSubject(so); // pMsg->SetBCastFlag( plMessage::kBCastByExactType ); // plgDispatch::MsgSend(pMsg); // // // this is to solve the problem of physical vs nonphysical players... -//// plCameraMsg* pMsg2 = TRACKED_NEW plCameraMsg; +//// plCameraMsg* pMsg2 = new plCameraMsg; //// pMsg2->SetBCastFlag(plMessage::kBCastByExactType); //// pMsg2->SetCmd(plCameraMsg::kSetOffset); //// pMsg2->SetCmd(plCameraMsg::kEntering); @@ -172,11 +172,11 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com //void plPlayerModifier::IMakeUsListener( plSceneObject *so ) //{ // // set the listener to use us... -// plAudioSysMsg* pAudMsg1 = TRACKED_NEW plAudioSysMsg(plAudioSysMsg::kSetListenerFacingRef); +// plAudioSysMsg* pAudMsg1 = new plAudioSysMsg(plAudioSysMsg::kSetListenerFacingRef); // pAudMsg1->SetSceneObject(so->GetKey()); -// plAudioSysMsg* pAudMsg2 = TRACKED_NEW plAudioSysMsg(plAudioSysMsg::kSetListenerCoordinateRef); +// plAudioSysMsg* pAudMsg2 = new plAudioSysMsg(plAudioSysMsg::kSetListenerCoordinateRef); // pAudMsg2->SetSceneObject(so->GetKey()); -// plAudioSysMsg* pAudMsg3 = TRACKED_NEW plAudioSysMsg(plAudioSysMsg::kSetListenerVelocityRef); +// plAudioSysMsg* pAudMsg3 = new plAudioSysMsg(plAudioSysMsg::kSetListenerVelocityRef); // pAudMsg3->SetSceneObject(so->GetKey()); // plgDispatch::MsgSend(pAudMsg1); // plgDispatch::MsgSend(pAudMsg2); @@ -209,7 +209,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // plSpawnModMsg* pSpawn = plSpawnModMsg::ConvertNoRef(msg); // if (pSpawn && HasFlag(kWantsToSpawn)) // { -// spawnPt* pt = TRACKED_NEW spawnPt; +// spawnPt* pt = new spawnPt; // pt->pt = pSpawn->fPos; // // hsVector3 temp(fTarget->GetCoordinateInterface()->GetLocalToWorld().GetTranslate() - pt->pt); @@ -260,7 +260,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com //{ // if (b != bMoving) // { -// plPlayerMsg* pMsg = TRACKED_NEW plPlayerMsg; +// plPlayerMsg* pMsg = new plPlayerMsg; // // if (b) // pMsg->SetCmd( plPlayerMsg::kMovementStarted ); @@ -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, hsScalar del, UInt32 dirty) +//hsBool plPlayerModifier::IEval(double secs, float del, uint32_t dirty) //{ // // setup for local player if necessary // if (HasFlag(kNeedsLocalSetup)) @@ -330,7 +330,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // fSpawnPoints[fSpawnPoints.Count()-1]->pt : fSpawnPoints[netID]->pt; //#endif // // Send msg for net synchronization -// plWarpMsg* warpMsg = TRACKED_NEW plWarpMsg; +// plWarpMsg* warpMsg = new plWarpMsg; // warpMsg->fPos = warpPoint; // warpMsg->AddReceiver( fTarget->GetKey() ); // warpMsg->SetWarpFlags(warpMsg->GetWarpFlags() | plWarpMsg::kFlushTransform | plWarpMsg::kZeroVelocity ); @@ -350,7 +350,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // } // else // { -// plSpawnRequestMsg* pMsg = TRACKED_NEW plSpawnRequestMsg; +// plSpawnRequestMsg* pMsg = new plSpawnRequestMsg; // pMsg->SetSender(GetKey()); // plgDispatch::MsgSend( pMsg ); // } @@ -371,8 +371,8 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // return true; // // // update our desired position: -//// hsScalar eTime = secs - fLastTime; -// hsScalar eTime = hsTimer::GetDelSysSeconds(); +//// float eTime = secs - fLastTime; +// float eTime = hsTimer::GetDelSysSeconds(); // // hsPoint3 newLinearForce(0,0,0); // @@ -385,8 +385,8 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // hsVector3 view, up, right; // targetMatrix.GetAxis(&view, &up, &right); // -// hsScalar speed = fMaxVelocity; -// hsScalar turn = fTurnRate; +// float speed = fMaxVelocity; +// float turn = fTurnRate; // // if (HasMovementFlag(B_CONTROL_MODIFIER_FAST)) // { @@ -437,7 +437,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // hsPoint3 newPos; // // hsVector3 dir(fDesiredPosition - curPos); -// hsScalar distToGoal=dir.Magnitude(); +// float distToGoal=dir.Magnitude(); // // if (dir.MagnitudeSquared() > 0.0f) // dir.Normalize(); @@ -447,7 +447,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // IAdjustVelocity(fAcceleration, fDeceleration, &dir, &vel, fMaxVelocity, distToGoal, eTime); // fCurSpeed = vel.Magnitude(); // -// hsScalar distMoved = IClampVelocity(&vel, fMaxVelocity, eTime); +// float distMoved = IClampVelocity(&vel, fMaxVelocity, eTime); // // // compute final pos // if (distMoved > distToGoal) @@ -471,8 +471,8 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // // // compute degrees needed to turn left/right // hsVector3 cross = fPlayerViewGoal % view; -// hsScalar dot = fPlayerViewGoal * view; -// hsScalar rad = hsACosine(dot); +// float dot = fPlayerViewGoal * view; +// float rad = acos(dot); // fRotationScalar = 1.0f; // // if (cross.fZ<0) @@ -491,7 +491,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // } // } // -// hsScalar angle = 0; +// float angle = 0; // // if ( HasMovementFlag( B_CONTROL_ROTATE_RIGHT ) ) // { @@ -561,15 +561,15 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com //// //// vector version. dir vector should be normalized //// -//void plPlayerModifier::IAdjustVelocity(hsScalar adjAccelRate, hsScalar adjDecelRate, -// hsVector3* dir, hsVector3* vel, hsScalar maxSpeed, -// hsScalar distToGoal, double elapsedTime) +//void plPlayerModifier::IAdjustVelocity(float adjAccelRate, float adjDecelRate, +// hsVector3* dir, hsVector3* vel, float maxSpeed, +// float distToGoal, double elapsedTime) //{ -// hsScalar speed = vel->Magnitude(); // save current speed +// float speed = vel->Magnitude(); // save current speed // *vel = *dir * speed; // change vel to correct dir // // // compute accel/decel -// hsScalar finalAccelRate; +// float finalAccelRate; // if (IShouldDecelerate(adjDecelRate, speed, distToGoal)) // { // finalAccelRate = -adjDecelRate; @@ -594,13 +594,13 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // } //} // -//hsScalar plPlayerModifier::IClampVelocity(hsVector3* vel, hsScalar maxSpeed, double elapsedTime) +//float plPlayerModifier::IClampVelocity(hsVector3* vel, float maxSpeed, double elapsedTime) //{ // *vel = *vel * elapsedTime; // maxSpeed *= elapsedTime; // // // clamp speed (clamp if going negative?) -// hsScalar distMoved = vel->Magnitude(); +// float distMoved = vel->Magnitude(); // if (distMoved > maxSpeed) // { // vel->Normalize(); @@ -610,16 +610,16 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // return distMoved; //} // -//hsBool32 plPlayerModifier::IShouldDecelerate(hsScalar decelSpeed, hsScalar curSpeed, hsScalar distToGoal) +//hsBool32 plPlayerModifier::IShouldDecelerate(float decelSpeed, float curSpeed, float distToGoal) //{ // if (decelSpeed == 0) // // no deceleration // return false; // // // compute distance required to stop, given decel speed (in units/sec sq) -// hsScalar stopTime = curSpeed / decelSpeed; -// hsScalar avgSpeed = curSpeed * .5f; -// hsScalar stopDist = avgSpeed * stopTime; +// float stopTime = curSpeed / decelSpeed; +// float avgSpeed = curSpeed * .5f; +// float stopDist = avgSpeed * stopTime; // // return (hsABS(distToGoal) <= hsABS(stopDist)); // stopDist+avgSpeed? //} diff --git a/Sources/Plasma/FeatureLib/pfCharacter/plPlayerModifier.h b/Sources/Plasma/FeatureLib/pfCharacter/plPlayerModifier.h index 7fd780a8..a86e2e49 100644 --- a/Sources/Plasma/FeatureLib/pfCharacter/plPlayerModifier.h +++ b/Sources/Plasma/FeatureLib/pfCharacter/plPlayerModifier.h @@ -68,15 +68,15 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // struct spawnPt // { // hsPoint3 pt; -// hsScalar dist; +// float dist; // }; // -// static hsScalar fTurnRate; +// static float fTurnRate; // -// static hsScalar fAcceleration; -// static hsScalar fDeceleration; -// static hsScalar fMaxVelocity; -// hsScalar fCurSpeed; +// static float fAcceleration; +// static float fDeceleration; +// static float fMaxVelocity; +// float fCurSpeed; // // // double fLastTime; @@ -88,19 +88,19 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // bool bUseDesiredMatrix; // bool bIgnoreDesiredMatrix; // -// hsScalar fRotationScalar; +// float fRotationScalar; // hsTArray fSpawnPoints; // -// void IAdjustVelocity(hsScalar adjAccelRate, -// hsScalar adjDecelRate, +// void IAdjustVelocity(float adjAccelRate, +// float adjDecelRate, // hsVector3* dir, // hsVector3* vel, -// hsScalar maxSpeed, -// hsScalar distToGoal, +// float maxSpeed, +// float distToGoal, // double elapsedTime); // -// hsScalar IClampVelocity(hsVector3* vel, hsScalar maxSpeed, double elapsedTime); -// hsBool32 IShouldDecelerate(hsScalar decelSpeed, hsScalar curSpeed, hsScalar distToGoal); +// float IClampVelocity(hsVector3* vel, float maxSpeed, double elapsedTime); +// hsBool32 IShouldDecelerate(float decelSpeed, float curSpeed, float distToGoal); // // hsBool HasMovementFlag(int f) const { return fMoveFlags.IsBitSet(f); } // void SetMovementFlag(int f) { fMoveFlags.SetBit(f); } @@ -129,7 +129,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // virtual void RemoveTarget(plSceneObject* so); // // hsBool HandleControlInput(plControlEventMsg* pMsg); -// virtual hsBool IEval(double secs, hsScalar del, UInt32 dirty); +// virtual hsBool IEval(double secs, float del, uint32_t dirty); // // void SetMoving(hsBool b); // hsBool IsMoving() { return bMoving; } diff --git a/Sources/Plasma/FeatureLib/pfConditional/plANDConditionalObject.cpp b/Sources/Plasma/FeatureLib/pfConditional/plANDConditionalObject.cpp index 4c417f79..2ddd1273 100644 --- a/Sources/Plasma/FeatureLib/pfConditional/plANDConditionalObject.cpp +++ b/Sources/Plasma/FeatureLib/pfConditional/plANDConditionalObject.cpp @@ -39,7 +39,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com Mead, WA 99021 *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "plANDConditionalObject.h" #include "plPhysical/plDetectorModifier.h" #include "hsResMgr.h" @@ -107,7 +107,7 @@ void plANDConditionalObject::Read(hsStream* stream, hsResMgr* mgr) fChildren.SetCountAndZero(n); for(int i = 0; i < n; i++ ) { - refMsg = TRACKED_NEW plCondRefMsg(GetKey(), i); + refMsg = new plCondRefMsg(GetKey(), i); mgr->ReadKeyNotifyMe(stream,refMsg, plRefFlags::kActiveRef); } } diff --git a/Sources/Plasma/FeatureLib/pfConditional/plActivatorConditionalObject.cpp b/Sources/Plasma/FeatureLib/pfConditional/plActivatorConditionalObject.cpp index fc13adcd..d32ef7dd 100644 --- a/Sources/Plasma/FeatureLib/pfConditional/plActivatorConditionalObject.cpp +++ b/Sources/Plasma/FeatureLib/pfConditional/plActivatorConditionalObject.cpp @@ -39,7 +39,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com Mead, WA 99021 *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "plActivatorConditionalObject.h" #include "plPhysical/plDetectorModifier.h" #include "pnModifier/plLogicModBase.h" diff --git a/Sources/Plasma/FeatureLib/pfConditional/plAnimationEventConditionalObject.cpp b/Sources/Plasma/FeatureLib/pfConditional/plAnimationEventConditionalObject.cpp index f2113109..b5813439 100644 --- a/Sources/Plasma/FeatureLib/pfConditional/plAnimationEventConditionalObject.cpp +++ b/Sources/Plasma/FeatureLib/pfConditional/plAnimationEventConditionalObject.cpp @@ -39,7 +39,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com Mead, WA 99021 *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "plAnimationEventConditionalObject.h" #include "pnInputCore/plKeyDef.h" #include "plModifier/plSimpleModifier.h" @@ -67,13 +67,13 @@ hsBool plAnimationEventConditionalObject::MsgReceive(plMessage* msg) } -void plAnimationEventConditionalObject::SetEvent(const CallbackEvent b, hsScalar time) +void plAnimationEventConditionalObject::SetEvent(const CallbackEvent b, float time) { - plAnimCmdMsg* pMsg = TRACKED_NEW plAnimCmdMsg; + plAnimCmdMsg* pMsg = new plAnimCmdMsg; pMsg->AddReceiver(fTarget); pMsg->SetSender( GetKey() ); - plEventCallbackMsg* cb = TRACKED_NEW plEventCallbackMsg(GetKey(), b, 0, time); + plEventCallbackMsg* cb = new plEventCallbackMsg(GetKey(), b, 0, time); pMsg->AddCallback( cb ); hsRefCnt_SafeUnRef(cb); diff --git a/Sources/Plasma/FeatureLib/pfConditional/plAnimationEventConditionalObject.h b/Sources/Plasma/FeatureLib/pfConditional/plAnimationEventConditionalObject.h index e55256a2..a8be7ced 100644 --- a/Sources/Plasma/FeatureLib/pfConditional/plAnimationEventConditionalObject.h +++ b/Sources/Plasma/FeatureLib/pfConditional/plAnimationEventConditionalObject.h @@ -71,7 +71,7 @@ public: void Evaluate(){;} void Reset() { SetSatisfied(false); } - void SetEvent(const CallbackEvent b, hsScalar time = 0.0f); + void SetEvent(const CallbackEvent b, float time = 0.0f); }; diff --git a/Sources/Plasma/FeatureLib/pfConditional/plControlEventConditionalObject.cpp b/Sources/Plasma/FeatureLib/pfConditional/plControlEventConditionalObject.cpp index 2e89ca77..90d5152c 100644 --- a/Sources/Plasma/FeatureLib/pfConditional/plControlEventConditionalObject.cpp +++ b/Sources/Plasma/FeatureLib/pfConditional/plControlEventConditionalObject.cpp @@ -39,7 +39,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com Mead, WA 99021 *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "plControlEventConditionalObject.h" #include "plPhysical/plDetectorModifier.h" #include "pnModifier/plLogicModBase.h" @@ -78,7 +78,7 @@ void plControlEventConditionalObject::Read(hsStream* stream, hsResMgr* mgr) void plControlEventConditionalObject::Write(hsStream* stream, hsResMgr* mgr) { plConditionalObject::Write(stream, mgr); - stream->WriteLE32((UInt32)fControlEvent); + stream->WriteLE32((uint32_t)fControlEvent); } diff --git a/Sources/Plasma/FeatureLib/pfConditional/plFacingConditionalObject.cpp b/Sources/Plasma/FeatureLib/pfConditional/plFacingConditionalObject.cpp index 2c11b1a5..9e1ef04b 100644 --- a/Sources/Plasma/FeatureLib/pfConditional/plFacingConditionalObject.cpp +++ b/Sources/Plasma/FeatureLib/pfConditional/plFacingConditionalObject.cpp @@ -39,7 +39,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com Mead, WA 99021 *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "plFacingConditionalObject.h" #include "plgDispatch.h" #include "pnModifier/plLogicModBase.h" @@ -96,7 +96,7 @@ hsBool plFacingConditionalObject::Verify(plMessage* msg) ourView = v; ourView.Normalize(); } - hsScalar dot = playerView * ourView; + float dot = playerView * ourView; if (dot >= fTolerance) { fLogicMod->GetNotify()->AddFacingEvent( pActivateMsg->fHitterObj, fLogicMod->GetTarget()->GetKey(), dot, true); @@ -129,7 +129,7 @@ hsBool plFacingConditionalObject::Verify(plMessage* msg) ourView.fZ = playerView.fZ; ourView.Normalize(); } - hsScalar dot = playerView * ourView; + float dot = playerView * ourView; if (dot >= fTolerance) { return true; diff --git a/Sources/Plasma/FeatureLib/pfConditional/plFacingConditionalObject.h b/Sources/Plasma/FeatureLib/pfConditional/plFacingConditionalObject.h index 30a7a697..97380e6c 100644 --- a/Sources/Plasma/FeatureLib/pfConditional/plFacingConditionalObject.h +++ b/Sources/Plasma/FeatureLib/pfConditional/plFacingConditionalObject.h @@ -50,7 +50,7 @@ class plSceneObject; class plFacingConditionalObject : public plConditionalObject { protected: - hsScalar fTolerance; + float fTolerance; hsBool fDirectional; public: @@ -63,7 +63,7 @@ public: hsBool MsgReceive(plMessage* msg); - void SetTolerance(hsScalar d) { fTolerance = d; } + void SetTolerance(float d) { fTolerance = d; } void SetDirectional(hsBool d) { fDirectional = d; } virtual hsBool Verify(plMessage* msg); diff --git a/Sources/Plasma/FeatureLib/pfConditional/plKeyPressConditionalObject.cpp b/Sources/Plasma/FeatureLib/pfConditional/plKeyPressConditionalObject.cpp index f8ae7e2d..27734c8c 100644 --- a/Sources/Plasma/FeatureLib/pfConditional/plKeyPressConditionalObject.cpp +++ b/Sources/Plasma/FeatureLib/pfConditional/plKeyPressConditionalObject.cpp @@ -39,7 +39,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com Mead, WA 99021 *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "plKeyPressConditionalObject.h" #include "plPhysical/plDetectorModifier.h" #include "pnModifier/plLogicModBase.h" @@ -78,7 +78,7 @@ void plKeyPressConditionalObject::Read(hsStream* stream, hsResMgr* mgr) void plKeyPressConditionalObject::Write(hsStream* stream, hsResMgr* mgr) { plConditionalObject::Write(stream, mgr); - stream->WriteLE32((UInt32)fKeyEvent); + stream->WriteLE32((uint32_t)fKeyEvent); } diff --git a/Sources/Plasma/FeatureLib/pfConditional/plLocalPlayerInBoxConditionalObject.cpp b/Sources/Plasma/FeatureLib/pfConditional/plLocalPlayerInBoxConditionalObject.cpp index ae76ba8f..c93b9e86 100644 --- a/Sources/Plasma/FeatureLib/pfConditional/plLocalPlayerInBoxConditionalObject.cpp +++ b/Sources/Plasma/FeatureLib/pfConditional/plLocalPlayerInBoxConditionalObject.cpp @@ -39,7 +39,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com Mead, WA 99021 *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "plLocalPlayerInBoxConditionalObject.h" #include "plPhysical/plDetectorModifier.h" #include "pnModifier/plLogicModBase.h" diff --git a/Sources/Plasma/FeatureLib/pfConditional/plLocalPlayerIntersectPlaneConditionalObject.cpp b/Sources/Plasma/FeatureLib/pfConditional/plLocalPlayerIntersectPlaneConditionalObject.cpp index fa67b725..544867ad 100644 --- a/Sources/Plasma/FeatureLib/pfConditional/plLocalPlayerIntersectPlaneConditionalObject.cpp +++ b/Sources/Plasma/FeatureLib/pfConditional/plLocalPlayerIntersectPlaneConditionalObject.cpp @@ -39,7 +39,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com Mead, WA 99021 *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "plLocalPlayerIntersectPlaneConditionalObject.h" #include "plPhysical/plDetectorModifier.h" #include "pnModifier/plLogicModBase.h" diff --git a/Sources/Plasma/FeatureLib/pfConditional/plORConditionalObject.cpp b/Sources/Plasma/FeatureLib/pfConditional/plORConditionalObject.cpp index 79b08bf2..56ed738c 100644 --- a/Sources/Plasma/FeatureLib/pfConditional/plORConditionalObject.cpp +++ b/Sources/Plasma/FeatureLib/pfConditional/plORConditionalObject.cpp @@ -39,7 +39,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com Mead, WA 99021 *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "plORConditionalObject.h" #include "plPhysical/plDetectorModifier.h" #include "hsResMgr.h" @@ -112,7 +112,7 @@ void plORConditionalObject::Read(hsStream* stream, hsResMgr* mgr) fChildren.SetCountAndZero(n); for(int i = 0; i < n; i++ ) { - refMsg = TRACKED_NEW plCondRefMsg(GetKey(), i); + refMsg = new plCondRefMsg(GetKey(), i); mgr->ReadKeyNotifyMe(stream,refMsg, plRefFlags::kActiveRef); } } diff --git a/Sources/Plasma/FeatureLib/pfConditional/plObjectInBoxConditionalObject.cpp b/Sources/Plasma/FeatureLib/pfConditional/plObjectInBoxConditionalObject.cpp index d5d25b52..c8c93906 100644 --- a/Sources/Plasma/FeatureLib/pfConditional/plObjectInBoxConditionalObject.cpp +++ b/Sources/Plasma/FeatureLib/pfConditional/plObjectInBoxConditionalObject.cpp @@ -39,7 +39,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com Mead, WA 99021 *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "plObjectInBoxConditionalObject.h" #include "plPhysical/plDetectorModifier.h" #include "pnModifier/plLogicModBase.h" diff --git a/Sources/Plasma/FeatureLib/pfConditional/plObjectIntersectPlaneConditionalObject.cpp b/Sources/Plasma/FeatureLib/pfConditional/plObjectIntersectPlaneConditionalObject.cpp index 2806f328..0e9dd989 100644 --- a/Sources/Plasma/FeatureLib/pfConditional/plObjectIntersectPlaneConditionalObject.cpp +++ b/Sources/Plasma/FeatureLib/pfConditional/plObjectIntersectPlaneConditionalObject.cpp @@ -39,7 +39,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com Mead, WA 99021 *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "plObjectIntersectPlaneConditionalObject.h" #include "plPhysical/plDetectorModifier.h" #include "pnModifier/plLogicModBase.h" diff --git a/Sources/Plasma/FeatureLib/pfConditional/plPickedConditionalObject.cpp b/Sources/Plasma/FeatureLib/pfConditional/plPickedConditionalObject.cpp index 3e873b75..82173c4a 100644 --- a/Sources/Plasma/FeatureLib/pfConditional/plPickedConditionalObject.cpp +++ b/Sources/Plasma/FeatureLib/pfConditional/plPickedConditionalObject.cpp @@ -39,7 +39,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com Mead, WA 99021 *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "plPickedConditionalObject.h" #include "plPhysical/plDetectorModifier.h" #include "pnModifier/plLogicModBase.h" diff --git a/Sources/Plasma/FeatureLib/pfConsole/pfAvatarConsoleCommands.cpp b/Sources/Plasma/FeatureLib/pfConsole/pfAvatarConsoleCommands.cpp index 6a502831..f31f4553 100644 --- a/Sources/Plasma/FeatureLib/pfConsole/pfAvatarConsoleCommands.cpp +++ b/Sources/Plasma/FeatureLib/pfConsole/pfAvatarConsoleCommands.cpp @@ -358,14 +358,14 @@ PF_CONSOLE_CMD( Avatar_Multistage, Trigger, "string multiComp", "Triggers the na if (key) { - plNotifyMsg *msg = TRACKED_NEW plNotifyMsg; + plNotifyMsg *msg = new plNotifyMsg; msg->fType = plNotifyMsg::kActivator; msg->fState = 1; // Triggered // Setup the event data in case this is a OneShot responder that needs it plKey playerKey = plAvatarMgr::GetInstance()->GetLocalAvatar()->GetKey(); - proPickedEventData *ed = TRACKED_NEW proPickedEventData; + proPickedEventData *ed = new proPickedEventData; ed->fPicker = playerKey; ed->fPicked = key; // ??? msg->AddEvent(ed); @@ -385,7 +385,7 @@ PF_CONSOLE_CMD( Avatar_Multistage, Advance, "", "Advances the avatar's current m { plKey avKey = avatar->GetKey(); - plAvBrainGenericMsg *msg = TRACKED_NEW plAvBrainGenericMsg(nil, avKey, plAvBrainGenericMsg::kNextStage, 0, true, 0.5f); + plAvBrainGenericMsg *msg = new plAvBrainGenericMsg(nil, avKey, plAvBrainGenericMsg::kNextStage, 0, true, 0.5f); msg->Send(); } } @@ -399,7 +399,7 @@ PF_CONSOLE_CMD( Avatar_Multistage, Regress, "", "Regresses the avatar's current { plKey avKey = avatar->GetKey(); - plAvBrainGenericMsg *msg = TRACKED_NEW plAvBrainGenericMsg(nil, avKey, plAvBrainGenericMsg::kPrevStage, 0, true, 0.5f); + plAvBrainGenericMsg *msg = new plAvBrainGenericMsg(nil, avKey, plAvBrainGenericMsg::kPrevStage, 0, true, 0.5f); msg->Send(); } } @@ -502,8 +502,8 @@ PF_CONSOLE_CMD( Avatar, SeekPoint, "string seekpoint", "Move to the given seekpo plKey targetKey = seekTarget->GetKey(); plKey avKey = avatar->GetKey(); - hsScalar unused = 0.0f; - plAvSeekMsg *msg = TRACKED_NEW plAvSeekMsg(nil, avKey, targetKey, unused, false); + float unused = 0.0f; + plAvSeekMsg *msg = new plAvSeekMsg(nil, avKey, targetKey, unused, false); plgDispatch::MsgSend(msg); } @@ -525,7 +525,7 @@ PF_CONSOLE_CMD( Avatar, if (avMod) { - plArmatureEffectStateMsg *msg = TRACKED_NEW plArmatureEffectStateMsg(); + plArmatureEffectStateMsg *msg = new plArmatureEffectStateMsg(); msg->AddReceiver(avMod->GetArmatureEffects()->GetKey()); msg->fSurface = (int)params[0]; plgDispatch::MsgSend(msg); @@ -542,7 +542,7 @@ PF_CONSOLE_CMD( Avatar, SetStealthMode, "int mode", "Set the stealth mode of you int level = mode==plAvatarStealthModeMsg::kStealthVisible ? 0 : 1; // send msg to make myself invisible locally - plAvatarStealthModeMsg *msg = TRACKED_NEW plAvatarStealthModeMsg(); + plAvatarStealthModeMsg *msg = new plAvatarStealthModeMsg(); msg->SetSender(avKey); msg->fMode = mode; msg->fLevel = level; @@ -551,7 +551,7 @@ PF_CONSOLE_CMD( Avatar, SetStealthMode, "int mode", "Set the stealth mode of you // send net msg to other players to synch them up // the msg will go to their NetClientMgr who will decide whether they see // our avatar as total or semi-invisible based on the invis level. - plCCRInvisibleMsg *invisMsg = TRACKED_NEW plCCRInvisibleMsg; // ctor sets flags and receiver + plCCRInvisibleMsg *invisMsg = new plCCRInvisibleMsg; // ctor sets flags and receiver invisMsg->fInvisLevel=level; invisMsg->fAvKey=avKey; invisMsg->Send(); @@ -594,7 +594,7 @@ PF_CONSOLE_CMD( Avatar, FakeLinkToObj, "string objName", "Pseudo-Link the avatar PrintString("Can't find object with that name, fake link failed."); return; } - plPseudoLinkEffectMsg* msg = TRACKED_NEW plPseudoLinkEffectMsg; + plPseudoLinkEffectMsg* msg = new plPseudoLinkEffectMsg; msg->fAvatarKey = plNetClientMgr::GetInstance()->GetLocalPlayerKey(); msg->fLinkObjKey = seekKey; plgDispatch::MsgSend(msg); @@ -616,7 +616,7 @@ PF_CONSOLE_CMD( Avatar_Physics, TogglePhysical, "", "Disable/enable physics on t if(avatar) { - plControlEventMsg* pMsg = TRACKED_NEW plControlEventMsg; + plControlEventMsg* pMsg = new plControlEventMsg; pMsg->SetControlActivated(true); pMsg->SetControlCode(B_CONTROL_TOGGLE_PHYSICAL); @@ -779,7 +779,7 @@ PF_CONSOLE_CMD( Avatar_Climb, Start, "string direction", "Specify initial mount mode = plAvBrainClimb::kMountingLeft; else if(stricmp(dirStr, "right") == 0) mode = plAvBrainClimb::kMountingRight; - plAvBrainClimb *brain = TRACKED_NEW plAvBrainClimb(mode); + plAvBrainClimb *brain = new plAvBrainClimb(mode); avMod->PushBrain(brain); } } @@ -801,7 +801,7 @@ PF_CONSOLE_CMD( Avatar_Climb, EnableDismount, "string direction", "Let the avata dir = plClimbMsg::kLeft; else if(stricmp(dirStr, "right") == 0) dir = plClimbMsg::kRight; - plClimbMsg *msg = TRACKED_NEW plClimbMsg(mgr, avKey, plClimbMsg::kEnableDismount, dir, true); + plClimbMsg *msg = new plClimbMsg(mgr, avKey, plClimbMsg::kEnableDismount, dir, true); msg->Send(); } } @@ -824,7 +824,7 @@ PF_CONSOLE_CMD( Avatar_Climb, EnableClimb, "string direction, int onOff", "Allow else if(stricmp(dirStr, "right") == 0) dir = plClimbMsg::kRight; hsBool enable = static_cast(params[1]) ? true : false; - plClimbMsg *msg = TRACKED_NEW plClimbMsg(mgr, avKey, plClimbMsg::kEnableClimb, dir, enable); + plClimbMsg *msg = new plClimbMsg(mgr, avKey, plClimbMsg::kEnableClimb, dir, enable); msg->Send(); } } @@ -836,7 +836,7 @@ PF_CONSOLE_CMD( Avatar_Climb, Release, "", "") { plKey mgr = plAvatarMgr::GetInstance()->GetKey(); plKey avKey = avMod->GetKey(); - plClimbMsg *msg = TRACKED_NEW plClimbMsg(mgr, avKey, plClimbMsg::kRelease); + plClimbMsg *msg = new plClimbMsg(mgr, avKey, plClimbMsg::kRelease); msg->Send(); } } @@ -848,7 +848,7 @@ PF_CONSOLE_CMD( Avatar_Climb, FallOff, "", "") { plKey mgr = plAvatarMgr::GetInstance()->GetKey(); plKey avKey = avMod->GetKey(); - plClimbMsg *msg = TRACKED_NEW plClimbMsg(mgr, avKey, plClimbMsg::kFallOff); + plClimbMsg *msg = new plClimbMsg(mgr, avKey, plClimbMsg::kFallOff); msg->Send(); } } @@ -868,7 +868,7 @@ PF_CONSOLE_CMD( Avatar_Swim, Start, "", "") plArmatureMod *avMod = const_cast(plAvatarMgr::GetInstance()->GetLocalAvatar()); if(avMod) { - plAvBrainSwim * brayne = TRACKED_NEW plAvBrainSwim(); + plAvBrainSwim * brayne = new plAvBrainSwim(); avMod->PushBrain(brayne); } } @@ -880,7 +880,7 @@ PF_CONSOLE_CMD( Avatar_Swim, Start, "", "") // /////////////////////////////////////////////////////////////////////////////////////////////////// -// void WarpPlayerToAnother(hsBool iMove, UInt32 remoteID) +// void WarpPlayerToAnother(hsBool iMove, uint32_t remoteID) PF_CONSOLE_CMD( Avatar_Warp, WarpToPlayer, "int PlayerID", "Warp our player to the same position as another player.") { plAvatarMgr::WarpPlayerToAnother(true, (int)params[0]); diff --git a/Sources/Plasma/FeatureLib/pfConsole/pfConsole.cpp b/Sources/Plasma/FeatureLib/pfConsole/pfConsole.cpp index 33313010..0e7159d3 100644 --- a/Sources/Plasma/FeatureLib/pfConsole/pfConsole.cpp +++ b/Sources/Plasma/FeatureLib/pfConsole/pfConsole.cpp @@ -45,6 +45,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // // ////////////////////////////////////////////////////////////////////////////// +#include "HeadSpin.h" #include "pfConsole.h" #include "pfConsoleCore/pfConsoleEngine.h" #include "plPipeline/plDebugText.h" @@ -60,7 +61,6 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "hsTimer.h" #include "plgDispatch.h" #include "plPipeline.h" -#include "hsConfig.h" #include "pfPython/cyPythonInterface.h" #include "plNetClient/plNetClientMgr.h" @@ -73,7 +73,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com //// Static Class Stuff ////////////////////////////////////////////////////// pfConsole *pfConsole::fTheConsole = nil; -UInt32 pfConsole::fConsoleTextColor = 0xff00ff00; +uint32_t pfConsole::fConsoleTextColor = 0xff00ff00; plPipeline *pfConsole::fPipeline = nil; @@ -136,8 +136,8 @@ class pfConsoleInputInterface : public plInputInterface // RestoreDefaultKeyMappings()!!!! } - virtual UInt32 GetPriorityLevel( void ) const { return kConsolePriority; } - virtual UInt32 GetCurrentCursorID( void ) const { return kCursorHidden; } + virtual uint32_t GetPriorityLevel( void ) const { return kConsolePriority; } + virtual uint32_t GetCurrentCursorID( void ) const { return kCursorHidden; } virtual hsBool HasInterestingCursorID( void ) const { return false; } virtual hsBool InterpretInputEvent( plInputEventMsg *pMsg ) @@ -185,7 +185,7 @@ pfConsole::~pfConsole() { if( fInputInterface != nil ) { - plInputIfaceMgrMsg *msg = TRACKED_NEW plInputIfaceMgrMsg( plInputIfaceMgrMsg::kRemoveInterface ); + plInputIfaceMgrMsg *msg = new plInputIfaceMgrMsg( plInputIfaceMgrMsg::kRemoveInterface ); msg->SetIFace( fInputInterface ); plgDispatch::MsgSend( msg ); @@ -218,7 +218,7 @@ pfConsole * pfConsole::GetInstance () { void pfConsole::Init( pfConsoleEngine *engine ) { - fDisplayBuffer = TRACKED_NEW char[ fNumDisplayLines * kMaxCharsWide ]; + fDisplayBuffer = new char[ fNumDisplayLines * kMaxCharsWide ]; memset( fDisplayBuffer, 0, fNumDisplayLines * kMaxCharsWide ); memset( fWorkingLine, 0, sizeof( fWorkingLine ) ); @@ -239,8 +239,8 @@ void pfConsole::Init( pfConsoleEngine *engine ) memset( fLastHelpMsg, 0, sizeof( fLastHelpMsg ) ); fEngine = engine; - fInputInterface = TRACKED_NEW pfConsoleInputInterface( this ); - plInputIfaceMgrMsg *msg = TRACKED_NEW plInputIfaceMgrMsg( plInputIfaceMgrMsg::kAddInterface ); + fInputInterface = new pfConsoleInputInterface( this ); + plInputIfaceMgrMsg *msg = new plInputIfaceMgrMsg( plInputIfaceMgrMsg::kAddInterface ); msg->SetIFace( fInputInterface ); plgDispatch::MsgSend( msg ); @@ -255,7 +255,7 @@ void pfConsole::Init( pfConsoleEngine *engine ) //// ISetMode //////////////////////////////////////////////////////////////// -void pfConsole::ISetMode( UInt8 mode ) +void pfConsole::ISetMode( uint8_t mode ) { fMode = mode; fEffectCounter = ( fFXEnabled ? kEffectDivisions : 0 ); @@ -538,7 +538,7 @@ void pfConsole::IHandleKey( plKeyEventMsg *msg ) wchar_t key; int i,eol; static hsBool findAgain = false; - static UInt32 findCounter = 0; + static uint32_t findCounter = 0; if( !msg->GetKeyDown() ) @@ -1089,7 +1089,7 @@ void pfConsole::Draw( plPipeline *p ) HGLOBAL hdl = LoadResource( nil, rsrc ); if( hdl != nil ) { - UInt8 *ptr = (UInt8 *)LockResource( hdl ); + uint8_t *ptr = (uint8_t *)LockResource( hdl ); if( ptr != nil ) { for( i = 0; i < SizeofResource( nil, rsrc ); i++ ) diff --git a/Sources/Plasma/FeatureLib/pfConsole/pfConsole.h b/Sources/Plasma/FeatureLib/pfConsole/pfConsole.h index e185be7f..c1e9803d 100644 --- a/Sources/Plasma/FeatureLib/pfConsole/pfConsole.h +++ b/Sources/Plasma/FeatureLib/pfConsole/pfConsole.h @@ -55,7 +55,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #ifndef _pfConsole_h #define _pfConsole_h -#include "hsTypes.h" +#include "HeadSpin.h" #include "pnKeyedObject/hsKeyedObject.h" @@ -88,23 +88,23 @@ class pfConsole : public hsKeyedObject }; - UInt32 fNumDisplayLines; + uint32_t fNumDisplayLines; - Int32 fEffectCounter; + int32_t fEffectCounter; float fLastTime; - UInt32 fHelpTimer; + uint32_t fHelpTimer; char fLastHelpMsg[ kWorkingLineSize ]; - UInt8 fMode; // 0 - invisible, 1 - single line, 2 - full + uint8_t fMode; // 0 - invisible, 1 - single line, 2 - full hsBool fInited, fHelpMode, fPythonMode, fPythonFirstTime, fFXEnabled; - UInt32 fPythonMultiLines; + uint32_t fPythonMultiLines; short fCursorTicks; - UInt32 fMsgTimeoutTimer; + uint32_t fMsgTimeoutTimer; char fHistory[ kNumHistoryItems ][ kMaxCharsWide ]; - UInt32 fHistoryCursor, fHistoryRecallCursor; + uint32_t fHistoryCursor, fHistoryRecallCursor; char *fDisplayBuffer; char fWorkingLine[ kWorkingLineSize ]; - UInt32 fWorkingCursor; + uint32_t fWorkingCursor; pfConsoleInputInterface *fInputInterface; @@ -112,7 +112,7 @@ class pfConsole : public hsKeyedObject void IHandleKey( plKeyEventMsg *msg ); - static UInt32 fConsoleTextColor; + static uint32_t fConsoleTextColor; static pfConsole *fTheConsole; static void _cdecl IAddLineCallback( const char *string ); @@ -122,7 +122,7 @@ class pfConsole : public hsKeyedObject void IAddParagraph( const char *string, short margin = 0 ); void IClear( void ); - void ISetMode( UInt8 mode ); + void ISetMode( uint8_t mode ); void IEnableFX( hsBool e ) { fFXEnabled = e; } hsBool IFXEnabled( void ) { return fFXEnabled; } @@ -151,8 +151,8 @@ class pfConsole : public hsKeyedObject static void EnableEffects( hsBool enable ) { fTheConsole->IEnableFX( enable ); } static hsBool AreEffectsEnabled( void ) { return fTheConsole->IFXEnabled(); } - static void SetTextColor( UInt32 color ) { fConsoleTextColor = color; } - static UInt32 GetTextColor() { return fConsoleTextColor; } + static void SetTextColor( uint32_t color ) { fConsoleTextColor = color; } + static uint32_t GetTextColor() { return fConsoleTextColor; } static void SetPipeline( plPipeline *pipe ) { fPipeline = pipe; } static plPipeline *GetPipeline( void ) { return fPipeline; } diff --git a/Sources/Plasma/FeatureLib/pfConsole/pfConsoleCommands.cpp b/Sources/Plasma/FeatureLib/pfConsole/pfConsoleCommands.cpp index be242d4c..a53e5fd8 100644 --- a/Sources/Plasma/FeatureLib/pfConsole/pfConsoleCommands.cpp +++ b/Sources/Plasma/FeatureLib/pfConsole/pfConsoleCommands.cpp @@ -162,7 +162,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "hsStlUtils.h" #include "hsTemplates.h" -#include "hsUtils.h" + #include "pfPython/cyPythonInterface.h" #include "pfPython/plPythonSDLModifier.h" @@ -214,7 +214,7 @@ PF_CONSOLE_FILE_DUMMY(Main) // name isn't obvious (i.e. SetFogColor doesn't really need one) // // The actual C code prototype looks like: -// void pfConsoleCmd_groupName_functionName( UInt32 numParams, pfConsoleCmdParam *params, +// void pfConsoleCmd_groupName_functionName( uint32_t numParams, pfConsoleCmdParam *params, // void (*PrintString)( char * ) ); // // numParams is exactly what it sounds like. params is an array of console @@ -443,13 +443,13 @@ PF_CONSOLE_BASE_CMD( SampleCmd3, "int, ...", "Sample command #3" ) PF_CONSOLE_BASE_CMD( FadeIn, "float len, bool hold", "Sample command #1" ) { - plTransitionMsg *msg = TRACKED_NEW plTransitionMsg( plTransitionMsg::kFadeIn, (float)params[ 0 ], (bool)params[ 1 ] ); + plTransitionMsg *msg = new plTransitionMsg( plTransitionMsg::kFadeIn, (float)params[ 0 ], (bool)params[ 1 ] ); plgDispatch::MsgSend( msg ); } PF_CONSOLE_BASE_CMD( FadeOut, "float len, bool hold", "Sample command #1" ) { - plTransitionMsg *msg = TRACKED_NEW plTransitionMsg( plTransitionMsg::kFadeOut, (float)params[ 0 ], (bool)params[ 1 ] ); + plTransitionMsg *msg = new plTransitionMsg( plTransitionMsg::kFadeOut, (float)params[ 0 ], (bool)params[ 1 ] ); plgDispatch::MsgSend( msg ); } @@ -648,55 +648,6 @@ PF_CONSOLE_CMD(Stats, ProfileAllAgeLoads, "", "Turns on Registry.LogReadTimes an #endif // LIMIT_CONSOLE_COMMANDS -////////////////////////////////////////////////////////////////////////////// -//// Memory Commands //////////////////////////////////////////////////// -////////////////////////////////////////////////////////////////////////////// - -#ifndef LIMIT_CONSOLE_COMMANDS - - -PF_CONSOLE_GROUP( Memory ) - -#ifdef HS_FIND_MEM_LEAKS - -PF_CONSOLE_CMD( Memory, DumpAllocReport, // Group name, Function name - "", // Params - "Dump heap allocations to file." ) // Help string -{ - MemDumpAllocReport(); -} - - -PF_CONSOLE_CMD(Memory, - ValidateNow, - "", - "Validate all heap allocations") -{ - MemValidateNow(); -} - - -PF_CONSOLE_CMD(Memory, - SetValidation, - "bool on", - "Validate all heap allocations each time memory is alloced or freed.") -{ - MemSetValidation((bool)params[0]); -} - -PF_CONSOLE_CMD(Memory, - DumpUsage, - "", - "Dump heap usage to file") -{ - MemDumpUsageReport(); -} - - -#endif - -#endif // LIMIT_CONSOLE_COMMANDS - ////////////////////////////////////////////////////////////////////////////// //// Console Group Commands ////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////// @@ -723,7 +674,7 @@ PF_CONSOLE_CMD( Console, EnableFX, "bool enable", "Enables flashy console effect PF_CONSOLE_CMD( Console, SetTextColor, "int r, int g, int b", "Sets the color of normal console text" ) { - UInt32 color = 0xff000000 | ( (int)params[ 0 ] << 16 ) | ( (int)params[ 1 ] << 8 ) | ( (int)params[ 2 ] ); + uint32_t color = 0xff000000 | ( (int)params[ 0 ] << 16 ) | ( (int)params[ 1 ] << 8 ) | ( (int)params[ 2 ] ); pfConsole::SetTextColor( color ); } @@ -865,7 +816,7 @@ PF_CONSOLE_CMD( Console, PrintVar, "string name", "Prints the value of a given g { pfConsoleContext &ctx = pfConsoleContext::GetRootContext(); - Int32 idx = ctx.FindVar( params[ 0 ] ); + int32_t idx = ctx.FindVar( params[ 0 ] ); if( idx == -1 ) PrintString( "Variable not found" ); else @@ -878,7 +829,7 @@ PF_CONSOLE_CMD( Console, PrintAllVars, "", "Prints the values of all global cons { pfConsoleContext &ctx = pfConsoleContext::GetRootContext(); - UInt32 i; + uint32_t i; PrintString( "Global console variables:" ); for( i = 0; i < ctx.GetNumVars(); i++ ) @@ -896,13 +847,13 @@ PF_CONSOLE_CMD( Console, ClearAllVars, "", "Wipes the global console variable co PF_CONSOLE_CMD( Console, ExecuteFile, "string filename", "Runs the given file as if it were an .ini or .fni file" ) { - plConsoleMsg *cMsg = TRACKED_NEW plConsoleMsg( plConsoleMsg::kExecuteFile, params[ 0 ] ); + plConsoleMsg *cMsg = new plConsoleMsg( plConsoleMsg::kExecuteFile, params[ 0 ] ); cMsg->Send(); } PF_CONSOLE_CMD( Console, ExecuteFileDelayed, "string filename, float timeInSecs", "Runs the given file as if it were an .ini or .fni file, but at some given point in the future" ) { - plConsoleMsg *cMsg = TRACKED_NEW plConsoleMsg( plConsoleMsg::kExecuteFile, params[ 0 ] ); + plConsoleMsg *cMsg = new plConsoleMsg( plConsoleMsg::kExecuteFile, params[ 0 ] ); cMsg->SetTimeStamp( hsTimer::GetSysSeconds() + (float)params[ 1 ] ); cMsg->Send(); } @@ -958,14 +909,14 @@ PF_CONSOLE_CMD( Graphics, // Group name \tonlyProjLights - Turns off runtime non-projected lights\n\ \tnoFog - Disable all fog" ) // Help string { - UInt32 flag; + uint32_t flag; bool on; char string[ 128 ], name[ 64 ]; int i; struct { - char name[ 64 ]; UInt32 flag; + char name[ 64 ]; uint32_t flag; } flags[] = { { "reloadTextures", plPipeDbg::kFlagReload }, { "noPreShade", plPipeDbg::kFlagNoPreShade}, { "noMultitexture", plPipeDbg::kFlagNoMultitexture }, @@ -1081,7 +1032,7 @@ PF_CONSOLE_CMD( Graphics, AllowWBuffering, "", "Enables the use of w-buffering\n { PF_SANITY_CHECK( pfConsole::GetPipeline() == nil, "This command MUST be used in an .ini file (before pipeline initialization)" ); - extern UInt32 fDbgSetupInitFlags; + extern uint32_t fDbgSetupInitFlags; fDbgSetupInitFlags |= 0x00000001; @@ -1092,7 +1043,7 @@ PF_CONSOLE_CMD( Graphics, ForceGeForce2Quality, "", "Forces higher-level hardwar { PF_SANITY_CHECK( pfConsole::GetPipeline() == nil, "This command MUST be used in an .ini file (before pipeline initialization)" ); - extern UInt32 fDbgSetupInitFlags; + extern uint32_t fDbgSetupInitFlags; fDbgSetupInitFlags |= 0x00000004; @@ -1237,10 +1188,10 @@ PF_CONSOLE_CMD( Graphics_Shadow, "...", "Max shadowmap blur size." ) { - extern hsScalar blurScale; + extern float blurScale; if( numParams > 0 ) { - blurScale = (hsScalar)atof( params[ 0 ] ); + blurScale = (float)atof( params[ 0 ] ); } else { @@ -1262,7 +1213,7 @@ PF_CONSOLE_CMD( Graphics_DebugText, // Group name "string face, int size", // Params "Sets the font face and size used for drawing debug text" ) // Help string { - plDebugText::Instance().SetFont( params[ 0 ], (UInt16)(int)params[ 1 ] ); + plDebugText::Instance().SetFont( params[ 0 ], (uint16_t)(int)params[ 1 ] ); } PF_CONSOLE_CMD( Graphics_DebugText, // Group name @@ -1317,7 +1268,7 @@ PF_CONSOLE_CMD( Graphics_Renderer, Gamma, "float g, ...", "Set gamma value (g or { hsAssert( pfConsole::GetPipeline() != nil, "Cannot use this command before pipeline initialization" ); - hsScalar g = params[0]; + float g = params[0]; if( numParams == 1 ) { @@ -1329,9 +1280,9 @@ PF_CONSOLE_CMD( Graphics_Renderer, Gamma, "float g, ...", "Set gamma value (g or } else { - hsScalar eR = g; - hsScalar eG = g; - hsScalar eB = g; + float eR = g; + float eG = g; + float eB = g; if( numParams > 2 ) eB = params[2]; @@ -1349,24 +1300,24 @@ PF_CONSOLE_CMD( Graphics_Renderer, Gamma2, "float g", "Set gamma value (alternat { hsAssert( pfConsole::GetPipeline() != nil, "Cannot use this command before pipeline initialization" ); - hsTArray ramp; + hsTArray ramp; ramp.SetCount(256); - hsScalar g = params[0]; + float g = params[0]; int i; for( i = 0; i < 256; i++ ) { - hsScalar t = hsScalar(i) / 255.f; - hsScalar sinT = sin(t * hsScalarPI / 2.f); + float t = float(i) / 255.f; + float sinT = sin(t * M_PI / 2.f); - hsScalar remap = t + (sinT - t) * g; + float remap = t + (sinT - t) * g; if( remap < 0 ) remap = 0; else if( remap > 1.f ) remap = 1.f; - ramp[i] = UInt16(remap * hsScalar(UInt16(-1)) + 0.5f); + ramp[i] = uint16_t(remap * float(uint16_t(-1)) + 0.5f); } pfConsole::GetPipeline()->SetGamma(ramp.AcquireArray()); @@ -1405,7 +1356,7 @@ PF_CONSOLE_CMD( Graphics_Renderer, SetYon, "float yon, ...", "Sets the view yon" { hsAssert( pfConsole::GetPipeline() != nil, "Cannot use this command before pipeline initialization" ); - hsScalar hither, yon; + float hither, yon; pfConsole::GetPipeline()->GetDepth( hither, yon ); @@ -1424,7 +1375,7 @@ PF_CONSOLE_CMD( Graphics_Renderer, TweakZBiasScale, "float deltaScale", "Adjusts { hsAssert( pfConsole::GetPipeline() != nil, "Cannot use this command before pipeline initialization" ); - hsScalar scale; + float scale; scale = pfConsole::GetPipeline()->GetZBiasScale(); scale += (float)params[ 0 ]; @@ -1453,7 +1404,7 @@ PF_CONSOLE_CMD( Graphics_Renderer, Overwire, "...", "Turn on (off) overlay wire hsAssert( pfConsole::GetPipeline() != nil, "Cannot use this command before pipeline initialization" ); hsBool on = false; - UInt32 flag = plPipeDbg::kFlagOverlayWire; + uint32_t flag = plPipeDbg::kFlagOverlayWire; if( !numParams ) on = !pfConsole::GetPipeline()->IsDebugFlagSet( flag ); else @@ -1569,7 +1520,7 @@ PF_CONSOLE_CMD( Graphics_Renderer, ResetDevice, static bool MakeUniqueFileName(const char* prefix, const char* ext, char* fileName) { - for (UInt32 uniqueNumber = 1; uniqueNumber < 1000; uniqueNumber++) + for (uint32_t uniqueNumber = 1; uniqueNumber < 1000; uniqueNumber++) { sprintf(fileName, "%s%03d.%s", prefix, uniqueNumber, ext); @@ -1687,7 +1638,7 @@ PF_CONSOLE_CMD( Graphics_Renderer, TakeJPEGScreenshot, "...", "Takes a shot of t else { char str[ 512 ]; - UInt8 quality = 75; + uint8_t quality = 75; if( numParams == 2 ) @@ -1746,10 +1697,10 @@ PF_CONSOLE_CMD( Graphics_Renderer, GenerateReflectMaps, "string baseObject, stri hsAssert( pfConsole::GetPipeline() != nil, "Cannot use this command before pipeline initialization" ); // First, create the renderTarget for the renderRequests - plRenderTarget *target = TRACKED_NEW plRenderTarget( plRenderTarget::kIsProjected | plRenderTarget::kIsTexture, + plRenderTarget *target = new plRenderTarget( plRenderTarget::kIsProjected | plRenderTarget::kIsTexture, params[ 2 ], params[ 2 ], 32, 24, 0 ); -// plMipmap *newMip = TRACKED_NEW plMipmap( size, size, plMipmap::kARGB32Config, 1 ); +// plMipmap *newMip = new plMipmap( size, size, plMipmap::kARGB32Config, 1 ); c.Set( params[ 0 ], params[ 1 ], params[ 2 ], 1.0f ); @@ -1873,7 +1824,7 @@ PF_CONSOLE_CMD( Graphics_Show, Bounds, "", "Toggle object bounds display") PF_CONSOLE_CMD( Graphics_Show, Sound, "", "Toggle sound fields visible") { static hsBool on = false; - plProxyDrawMsg* msg = TRACKED_NEW plProxyDrawMsg(plProxyDrawMsg::kAudible | ((on = !on) ? plProxyDrawMsg::kCreate : plProxyDrawMsg::kDestroy)); + plProxyDrawMsg* msg = new plProxyDrawMsg(plProxyDrawMsg::kAudible | ((on = !on) ? plProxyDrawMsg::kCreate : plProxyDrawMsg::kDestroy)); plgDispatch::MsgSend(msg); if( on ) pfConsole::GetPipeline()->SetDrawableTypeMask(pfConsole::GetPipeline()->GetDrawableTypeMask() | plDrawableSpans::kAudibleProxy); @@ -1910,7 +1861,7 @@ PF_CONSOLE_CMD( Graphics_Show, SingleSound, } plKey aiKey = ai->GetKey(); - plProxyDrawMsg* msg = TRACKED_NEW plProxyDrawMsg( plProxyDrawMsg::kAudible | plProxyDrawMsg::kToggle ); + plProxyDrawMsg* msg = new plProxyDrawMsg( plProxyDrawMsg::kAudible | plProxyDrawMsg::kToggle ); msg->SetBCastFlag( plMessage::kBCastByExactType, false ); msg->AddReceiver( aiKey ); plgDispatch::MsgSend( msg ); @@ -1928,9 +1879,9 @@ PF_CONSOLE_CMD( Graphics_Show, SingleSound, PF_CONSOLE_CMD( Graphics_Show, SoundOnly, "", "Toggle only sound fields visible") { static hsBool on = false; - plProxyDrawMsg* msg = TRACKED_NEW plProxyDrawMsg(plProxyDrawMsg::kAudible | ((on = !on) ? plProxyDrawMsg::kCreate : plProxyDrawMsg::kDestroy)); + plProxyDrawMsg* msg = new plProxyDrawMsg(plProxyDrawMsg::kAudible | ((on = !on) ? plProxyDrawMsg::kCreate : plProxyDrawMsg::kDestroy)); plgDispatch::MsgSend(msg); - static UInt32 oldMask = plDrawableSpans::kNormal; + static uint32_t oldMask = plDrawableSpans::kNormal; if( on ) { oldMask = pfConsole::GetPipeline()->GetDrawableTypeMask(); @@ -1947,7 +1898,7 @@ PF_CONSOLE_CMD( Graphics_Show, SoundOnly, "", "Toggle only sound fields visible" PF_CONSOLE_CMD( Graphics_Show, OccSnap, "", "Take snapshot of current occlusion and render (or toggle)") { - UInt32 flag = plPipeDbg::kFlagOcclusionSnap; + uint32_t flag = plPipeDbg::kFlagOcclusionSnap; hsBool on = !pfConsole::GetPipeline()->IsDebugFlagSet(flag); pfConsole::GetPipeline()->SetDebugFlag( flag, on ); @@ -1963,10 +1914,10 @@ PF_CONSOLE_CMD( Graphics_Show, OccSnap, "", "Take snapshot of current occlusion PF_CONSOLE_CMD( Graphics_Show, OccSnapOnly, "", "Take snapshot of current occlusion and render (or toggle)") { - UInt32 flag = plPipeDbg::kFlagOcclusionSnap; + uint32_t flag = plPipeDbg::kFlagOcclusionSnap; hsBool on = !pfConsole::GetPipeline()->IsDebugFlagSet(flag); - static UInt32 oldMask = pfConsole::GetPipeline()->GetDrawableTypeMask(); + static uint32_t oldMask = pfConsole::GetPipeline()->GetDrawableTypeMask(); pfConsole::GetPipeline()->SetDebugFlag( flag, on ); if( on ) @@ -1982,7 +1933,7 @@ PF_CONSOLE_CMD( Graphics_Show, OccSnapOnly, "", "Take snapshot of current occlus PF_CONSOLE_CMD( Graphics_Show, Occluders, "", "Toggle occluder geometry visible") { static hsBool on = false; - plProxyDrawMsg* msg = TRACKED_NEW plProxyDrawMsg(plProxyDrawMsg::kOccluder | ((on = !on) ? plProxyDrawMsg::kCreate : plProxyDrawMsg::kDestroy)); + plProxyDrawMsg* msg = new plProxyDrawMsg(plProxyDrawMsg::kOccluder | ((on = !on) ? plProxyDrawMsg::kCreate : plProxyDrawMsg::kDestroy)); plgDispatch::MsgSend(msg); if( on ) @@ -1998,9 +1949,9 @@ PF_CONSOLE_CMD( Graphics_Show, Occluders, "", "Toggle occluder geometry visible" PF_CONSOLE_CMD( Graphics_Show, OccludersOnly, "", "Toggle only occluder geometry visible") { static hsBool on = false; - plProxyDrawMsg* msg = TRACKED_NEW plProxyDrawMsg(plProxyDrawMsg::kOccluder | ((on = !on) ? plProxyDrawMsg::kCreate : plProxyDrawMsg::kDestroy)); + plProxyDrawMsg* msg = new plProxyDrawMsg(plProxyDrawMsg::kOccluder | ((on = !on) ? plProxyDrawMsg::kCreate : plProxyDrawMsg::kDestroy)); plgDispatch::MsgSend(msg); - static UInt32 oldMask = plDrawableSpans::kNormal; + static uint32_t oldMask = plDrawableSpans::kNormal; if( on ) { oldMask = pfConsole::GetPipeline()->GetDrawableTypeMask(); @@ -2018,7 +1969,7 @@ PF_CONSOLE_CMD( Graphics_Show, OccludersOnly, "", "Toggle only occluder geometry PF_CONSOLE_CMD( Graphics_Show, Physicals, "", "Toggle Physical geometry visible") { static hsBool on = false; - plProxyDrawMsg* msg = TRACKED_NEW plProxyDrawMsg(plProxyDrawMsg::kPhysical | ((on = !on) ? plProxyDrawMsg::kCreate : plProxyDrawMsg::kDestroy)); + plProxyDrawMsg* msg = new plProxyDrawMsg(plProxyDrawMsg::kPhysical | ((on = !on) ? plProxyDrawMsg::kCreate : plProxyDrawMsg::kDestroy)); plgDispatch::MsgSend(msg); if( on ) pfConsole::GetPipeline()->SetDrawableTypeMask(pfConsole::GetPipeline()->GetDrawableTypeMask() | plDrawableSpans::kPhysicalProxy); @@ -2033,9 +1984,9 @@ PF_CONSOLE_CMD( Graphics_Show, Physicals, "", "Toggle Physical geometry visible" PF_CONSOLE_CMD( Graphics_Show, PhysicalsOnly, "", "Toggle only Physical geometry visible") { static hsBool on = false; - plProxyDrawMsg* msg = TRACKED_NEW plProxyDrawMsg(plProxyDrawMsg::kPhysical | ((on = !on) ? plProxyDrawMsg::kCreate : plProxyDrawMsg::kDestroy)); + plProxyDrawMsg* msg = new plProxyDrawMsg(plProxyDrawMsg::kPhysical | ((on = !on) ? plProxyDrawMsg::kCreate : plProxyDrawMsg::kDestroy)); plgDispatch::MsgSend(msg); - static UInt32 oldMask = plDrawableSpans::kNormal; + static uint32_t oldMask = plDrawableSpans::kNormal; if( on ) { oldMask = pfConsole::GetPipeline()->GetDrawableTypeMask(); @@ -2066,7 +2017,7 @@ PF_CONSOLE_CMD( Graphics_Show, Normal, "", "Toggle normal geometry visible") PF_CONSOLE_CMD( Graphics_Show, NormalOnly, "", "Toggle only normal geometry visible") { static hsBool on = false; - static UInt32 oldMask = plDrawableSpans::kNormal; + static uint32_t oldMask = plDrawableSpans::kNormal; if( on = !on ) { oldMask = pfConsole::GetPipeline()->GetDrawableTypeMask(); @@ -2084,7 +2035,7 @@ PF_CONSOLE_CMD( Graphics_Show, NormalOnly, "", "Toggle only normal geometry visi PF_CONSOLE_CMD( Graphics_Show, Lights, "", "Toggle visible proxies for lights") { static hsBool on = false; - plProxyDrawMsg* msg = TRACKED_NEW plProxyDrawMsg(plProxyDrawMsg::kLight | ((on = !on) ? plProxyDrawMsg::kCreate : plProxyDrawMsg::kDestroy)); + plProxyDrawMsg* msg = new plProxyDrawMsg(plProxyDrawMsg::kLight | ((on = !on) ? plProxyDrawMsg::kCreate : plProxyDrawMsg::kDestroy)); plgDispatch::MsgSend(msg); if( on ) pfConsole::GetPipeline()->SetDrawableTypeMask(pfConsole::GetPipeline()->GetDrawableTypeMask() | plDrawableSpans::kLightProxy); @@ -2099,9 +2050,9 @@ PF_CONSOLE_CMD( Graphics_Show, Lights, "", "Toggle visible proxies for lights") PF_CONSOLE_CMD( Graphics_Show, LightsOnly, "", "Toggle visible proxies for lights and everything else invisible") { static hsBool on = false; - plProxyDrawMsg* msg = TRACKED_NEW plProxyDrawMsg(plProxyDrawMsg::kLight | ((on = !on) ? plProxyDrawMsg::kCreate : plProxyDrawMsg::kDestroy)); + plProxyDrawMsg* msg = new plProxyDrawMsg(plProxyDrawMsg::kLight | ((on = !on) ? plProxyDrawMsg::kCreate : plProxyDrawMsg::kDestroy)); plgDispatch::MsgSend(msg); - static UInt32 oldMask = plDrawableSpans::kNormal; + static uint32_t oldMask = plDrawableSpans::kNormal; if( on ) { oldMask = pfConsole::GetPipeline()->GetDrawableTypeMask(); @@ -2119,7 +2070,7 @@ PF_CONSOLE_CMD( Graphics_Show, LightsOnly, "", "Toggle visible proxies for light PF_CONSOLE_CMD( Graphics_Show, Clicks, "", "Toggle visible proxies for clicks") { static hsBool on = false; - plProxyDrawMsg* msg = TRACKED_NEW plProxyDrawMsg(plProxyDrawMsg::kCamera | ((on = !on) ? plProxyDrawMsg::kCreate : plProxyDrawMsg::kDestroy)); + plProxyDrawMsg* msg = new plProxyDrawMsg(plProxyDrawMsg::kCamera | ((on = !on) ? plProxyDrawMsg::kCreate : plProxyDrawMsg::kDestroy)); plgDispatch::MsgSend(msg); if( on ) pfConsole::GetPipeline()->SetDrawableTypeMask(pfConsole::GetPipeline()->GetDrawableTypeMask() | plDrawableSpans::kCameraProxy); @@ -2135,9 +2086,9 @@ PF_CONSOLE_CMD( Graphics_Show, Clicks, "", "Toggle visible proxies for clicks") PF_CONSOLE_CMD( Graphics_Show, ClickOnly, "", "Toggle visible proxies for click points") { static hsBool on = false; - plProxyDrawMsg* msg = TRACKED_NEW plProxyDrawMsg(plProxyDrawMsg::kCamera | ((on = !on) ? plProxyDrawMsg::kCreate : plProxyDrawMsg::kDestroy)); + plProxyDrawMsg* msg = new plProxyDrawMsg(plProxyDrawMsg::kCamera | ((on = !on) ? plProxyDrawMsg::kCreate : plProxyDrawMsg::kDestroy)); plgDispatch::MsgSend(msg); - static UInt32 oldMask = plDrawableSpans::kNormal; + static uint32_t oldMask = plDrawableSpans::kNormal; if( on ) { oldMask = pfConsole::GetPipeline()->GetDrawableTypeMask(); @@ -2252,7 +2203,7 @@ PF_CONSOLE_CMD( App, return; } - plAnimCmdMsg* cmd = TRACKED_NEW plAnimCmdMsg; + plAnimCmdMsg* cmd = new plAnimCmdMsg; cmd->SetSender(plClient::GetInstance()->GetKey()); cmd->SetCmd(plAnimCmdMsg::kAddCallbacks); #if 1 @@ -2288,7 +2239,7 @@ PF_CONSOLE_CMD( App, } reps--; - plEventCallbackMsg* callback = TRACKED_NEW plEventCallbackMsg(plClient::GetInstance()->GetKey(), event, 0, secs, reps); + plEventCallbackMsg* callback = new plEventCallbackMsg(plClient::GetInstance()->GetKey(), event, 0, secs, reps); cmd->AddCallback(callback); hsRefCnt_SafeUnRef(callback); plgDispatch::MsgSend(cmd); @@ -2312,7 +2263,7 @@ PF_CONSOLE_CMD( App, PrintString(str); - plSoundMsg* cmd = TRACKED_NEW plSoundMsg; + plSoundMsg* cmd = new plSoundMsg; cmd->SetSender(plClient::GetInstance()->GetKey()); cmd->SetCmd(plSoundMsg::kAddCallbacks); cmd->AddReceiver(key); @@ -2343,7 +2294,7 @@ PF_CONSOLE_CMD( App, } reps--; - plEventCallbackMsg* callback = TRACKED_NEW plEventCallbackMsg(plClient::GetInstance()->GetKey(), event, 0, secs, reps); + plEventCallbackMsg* callback = new plEventCallbackMsg(plClient::GetInstance()->GetKey(), event, 0, secs, reps); cmd->AddCallback(callback); hsRefCnt_SafeUnRef(callback); plgDispatch::MsgSend(cmd); @@ -2385,7 +2336,7 @@ PF_CONSOLE_CMD( App, } strcpy(str, name.c_str()); - plAnimCmdMsg* cmd = TRACKED_NEW plAnimCmdMsg(nil, obj->GetModifier(i)->GetKey(), nil); + plAnimCmdMsg* cmd = new plAnimCmdMsg(nil, obj->GetModifier(i)->GetKey(), nil); if( numParams > 1 ) { @@ -2746,7 +2697,7 @@ PF_CONSOLE_CMD( Registry, SetLoggingLevel, "int level", "Sets the logging level return; } - plResMgrSettings::Get().SetLoggingLevel( (UInt8)newLevel ); + plResMgrSettings::Get().SetLoggingLevel( (uint8_t)newLevel ); { char msg[ 128 ]; sprintf( msg, "Registry logging set to %s", ( newLevel == 0 ) ? "none" : ( newLevel == 1 ) ? "basic" : @@ -2759,7 +2710,7 @@ PF_CONSOLE_CMD( Registry, SetLoggingLevel, "int level", "Sets the logging level class plActiveRefPeekerKey : public plKeyImp { public: - UInt16 PeekNumNotifies() { return GetNumNotifyCreated(); } + uint16_t PeekNumNotifies() { return GetNumNotifyCreated(); } plRefMsg* PeekNotifyCreated(int i) { return GetNotifyCreated(i); } hsBool PeekIsActiveRef(int i) const { return IsActiveRef(i); } }; @@ -2781,7 +2732,7 @@ void MyHandyPrintFunction( const plKey &obj, void (*PrintString)( const char if( peeker->PeekNumNotifies() == 0 ) return; - UInt32 a, i, j, limit = 30, count = 0; + uint32_t a, i, j, limit = 30, count = 0; for( a = 0; a < 2; a++ ) { PrintString( ( a == 0 ) ? " Active:" : " Passive:" ); @@ -2830,7 +2781,7 @@ PF_CONSOLE_CMD( Registry, ListRefs, "string keyType, string keyName", "For the g plActiveRefPeekerKey *peeker = (plActiveRefPeekerKey *)(plKeyImp *)obj; if( peeker->GetNumClones() > 0 ) { - UInt32 i; + uint32_t i; for( i = 0; i < peeker->GetNumClones(); i++ ) { MyHandyPrintFunction( peeker->GetCloneByIdx( i ), PrintString ); @@ -2862,7 +2813,7 @@ PF_CONSOLE_CMD( Camera, AvatarVisible1stPerson, "bool b", "turn avatar visibilit PF_CONSOLE_CMD( Camera, FallTimerDelay, "float b", "fall timer delay") { - hsScalar f = params[0]; + float f = params[0]; plVirtualCam1::fFallTimerDelay = f; } @@ -3000,7 +2951,7 @@ PF_CONSOLE_CMD( Camera, SwitchTo, "string cameraName", "Switch to the named came if (key) { - plCameraMsg* pMsg = TRACKED_NEW plCameraMsg; + plCameraMsg* pMsg = new plCameraMsg; pMsg->SetCmd(plCameraMsg::kResponderTrigger); pMsg->SetCmd(plCameraMsg::kRegionPushCamera); pMsg->SetNewCam(key); @@ -3159,7 +3110,7 @@ PF_CONSOLE_CMD(Logic, EnableDetector, "string detectorComp, bool enable", "Enabl plLogicModBase *mod = FindLogicMod(plString::FromUtf8(params[0])); if (mod) { - plEnableMsg* enableMsg = TRACKED_NEW plEnableMsg; + plEnableMsg* enableMsg = new plEnableMsg; enableMsg->SetCmd(params[1] ? plEnableMsg::kEnable : plEnableMsg::kDisable); enableMsg->SetCmd(plEnableMsg::kAll); enableMsg->Send(mod->GetKey()); @@ -3168,7 +3119,7 @@ PF_CONSOLE_CMD(Logic, EnableDetector, "string detectorComp, bool enable", "Enabl static void ResponderSendTrigger(plKey responderKey, int responderState, bool fastForward = false) { - plNotifyMsg *msg = TRACKED_NEW plNotifyMsg; + plNotifyMsg *msg = new plNotifyMsg; if (fastForward) { @@ -3379,7 +3330,7 @@ PF_CONSOLE_CMD( Audio, SetAllChannelVolumes, "float soundFX, float music, float for( i = 0; i < 5; i++ ) { - hsScalar vol = (hsScalar)(float)params[ i ]; + float vol = (float)(float)params[ i ]; if( vol > 1.f ) vol = 1.f; else if( vol < 0.f ) @@ -3413,7 +3364,7 @@ Valid channels are: SoundFX, BgndMusic, Voice, GUI, NPCVoice and Ambience.") return; } - hsScalar vol = (hsScalar)(float)params[ 1 ]; + float vol = (float)(float)params[ 1 ]; if( vol > 1.f ) vol = 1.f; else if( vol < 0.f ) @@ -3437,7 +3388,7 @@ Valid channels are: SoundFX, BgndMusic, Voice, GUI, NPCVoice and Ambience.") PF_CONSOLE_CMD( Audio, Set2D3DBias, "float bias", "Sets the 2D/3D bias when not using hardware acceleration.") { - hsScalar bias = (hsScalar)(float)params[ 0 ]; + float bias = (float)(float)params[ 0 ]; plgAudioSys::Set2D3DBias( bias ); } @@ -3578,7 +3529,7 @@ PF_CONSOLE_CMD( Audio, SetVolume, const plAudioInterface *ai = obj->GetAudioInterface(); plKey aiKey = ai->GetKey(); - plSoundMsg* cmd = TRACKED_NEW plSoundMsg; + plSoundMsg* cmd = new plSoundMsg; cmd->SetSender( plClient::GetInstance()->GetKey() ); cmd->SetCmd( plSoundMsg::kSetVolume ); cmd->fVolume = params[ 1 ]; @@ -3620,10 +3571,10 @@ PF_CONSOLE_CMD( Audio, IsolateSound, return; } - asMsg = TRACKED_NEW plAudioSysMsg( plAudioSysMsg::kMuteAll ); + asMsg = new plAudioSysMsg( plAudioSysMsg::kMuteAll ); plgDispatch::MsgSend( asMsg ); - asMsg = TRACKED_NEW plAudioSysMsg( plAudioSysMsg::kUnmuteAll ); + asMsg = new plAudioSysMsg( plAudioSysMsg::kUnmuteAll ); asMsg->AddReceiver( ai->GetKey() ); asMsg->SetBCastFlag( plMessage::kBCastByExactType, false ); plgDispatch::MsgSend( asMsg ); @@ -3701,19 +3652,19 @@ PF_CONSOLE_CMD( Listener, ShowDebugInfo, "bool show", "Shows or hides debugging PF_CONSOLE_CMD( Listener, UseCameraOrientation, "", "Use the camera's orientation to orient the listener") { - plSetListenerMsg *set = TRACKED_NEW plSetListenerMsg( plSetListenerMsg::kVCam | plSetListenerMsg::kFacing, nil, true ); + plSetListenerMsg *set = new plSetListenerMsg( plSetListenerMsg::kVCam | plSetListenerMsg::kFacing, nil, true ); set->Send(); } PF_CONSOLE_CMD( Listener, UseCameraPosition, "", "Use the canera's position to position the listener") { - plSetListenerMsg *set = TRACKED_NEW plSetListenerMsg( plSetListenerMsg::kVCam | plSetListenerMsg::kPosition, nil, true ); + plSetListenerMsg *set = new plSetListenerMsg( plSetListenerMsg::kVCam | plSetListenerMsg::kPosition, nil, true ); set->Send(); } PF_CONSOLE_CMD( Listener, UseCameraVelocity, "", "Use the camera's velocity to set the listener velocity") { - plSetListenerMsg *set = TRACKED_NEW plSetListenerMsg( plSetListenerMsg::kVCam | plSetListenerMsg::kVelocity, nil, true ); + plSetListenerMsg *set = new plSetListenerMsg( plSetListenerMsg::kVCam | plSetListenerMsg::kVelocity, nil, true ); set->Send(); } @@ -3722,7 +3673,7 @@ PF_CONSOLE_CMD( Listener, UsePlayerOrientation, "", "Use the player's orientatio plKey pKey = plNetClientMgr::GetInstance()->GetLocalPlayerKey(); if( pKey ) { - plSetListenerMsg *set = TRACKED_NEW plSetListenerMsg( plSetListenerMsg::kFacing, pKey, true ); + plSetListenerMsg *set = new plSetListenerMsg( plSetListenerMsg::kFacing, pKey, true ); set->Send(); } } @@ -3731,7 +3682,7 @@ PF_CONSOLE_CMD( Listener, UsePlayerPosition, "", "Use the player's position to p plKey pKey = plNetClientMgr::GetInstance()->GetLocalPlayerKey(); if (pKey) { - plSetListenerMsg *set = TRACKED_NEW plSetListenerMsg( plSetListenerMsg::kPosition, pKey, true ); + plSetListenerMsg *set = new plSetListenerMsg( plSetListenerMsg::kPosition, pKey, true ); set->Send(); } } @@ -3741,14 +3692,14 @@ PF_CONSOLE_CMD( Listener, UsePlayerVelocity, "", "Use the player's velocity to s plKey pKey = plNetClientMgr::GetInstance()->GetLocalPlayerKey(); if (pKey) { - plSetListenerMsg *set = TRACKED_NEW plSetListenerMsg( plSetListenerMsg::kVelocity, pKey, true ); + plSetListenerMsg *set = new plSetListenerMsg( plSetListenerMsg::kVelocity, pKey, true ); set->Send(); } } PF_CONSOLE_CMD( Listener, XMode, "bool b", "Sets velocity and position to avatar, and orientation to camera") { - static UInt32 oldPosType = 0, oldFacingType = 0, oldVelType = 0; + static uint32_t oldPosType = 0, oldFacingType = 0, oldVelType = 0; plSetListenerMsg *set = nil; plKey pKey = plNetClientMgr::GetInstance()->GetLocalPlayerKey(); @@ -3774,13 +3725,13 @@ PF_CONSOLE_CMD( Listener, XMode, "bool b", "Sets velocity and position to avatar plStatusLog::AddLineS("audio.log", "XMode on"); - plSetListenerMsg *set = TRACKED_NEW plSetListenerMsg( plSetListenerMsg::kVCam | plSetListenerMsg::kFacing, nil, true ); + plSetListenerMsg *set = new plSetListenerMsg( plSetListenerMsg::kVCam | plSetListenerMsg::kFacing, nil, true ); set->Send(); if (pKey) { - set = TRACKED_NEW plSetListenerMsg( plSetListenerMsg::kVelocity, pKey, true ); + set = new plSetListenerMsg( plSetListenerMsg::kVelocity, pKey, true ); set->Send(); - set = TRACKED_NEW plSetListenerMsg( plSetListenerMsg::kPosition, pKey, true ); + set = new plSetListenerMsg( plSetListenerMsg::kPosition, pKey, true ); set->Send(); } } @@ -3788,32 +3739,32 @@ PF_CONSOLE_CMD( Listener, XMode, "bool b", "Sets velocity and position to avatar { if(oldPosType == plListener::kCamera) { - plSetListenerMsg *set = TRACKED_NEW plSetListenerMsg( plSetListenerMsg::kVCam | plSetListenerMsg::kPosition, nil, true ); + plSetListenerMsg *set = new plSetListenerMsg( plSetListenerMsg::kVCam | plSetListenerMsg::kPosition, nil, true ); set->Send(); } else { - set = TRACKED_NEW plSetListenerMsg( plSetListenerMsg::kPosition, pKey, true ); + set = new plSetListenerMsg( plSetListenerMsg::kPosition, pKey, true ); set->Send(); } if(oldFacingType == plListener::kCamera) { - set = TRACKED_NEW plSetListenerMsg( plSetListenerMsg::kVCam | plSetListenerMsg::kFacing, nil, true ); + set = new plSetListenerMsg( plSetListenerMsg::kVCam | plSetListenerMsg::kFacing, nil, true ); set->Send(); } else { - set = TRACKED_NEW plSetListenerMsg( plSetListenerMsg::kFacing, pKey, true ); + set = new plSetListenerMsg( plSetListenerMsg::kFacing, pKey, true ); set->Send(); } if(oldVelType == plListener::kCamera) { - set = TRACKED_NEW plSetListenerMsg( plSetListenerMsg::kVCam | plSetListenerMsg::kVelocity, nil, true ); + set = new plSetListenerMsg( plSetListenerMsg::kVCam | plSetListenerMsg::kVelocity, nil, true ); set->Send(); } else { - set = TRACKED_NEW plSetListenerMsg( plSetListenerMsg::kVelocity, pKey, true ); + set = new plSetListenerMsg( plSetListenerMsg::kVelocity, pKey, true ); set->Send(); } plStatusLog::AddLineS("audio.log", "%s, %d, %d, %d", "XMode off", oldPosType, oldFacingType, oldVelType); @@ -3840,7 +3791,7 @@ PF_CONSOLE_CMD( DInput, UseDInput, "bool on", "Turns off DirectInput") PF_CONSOLE_CMD( DInput, Config, "", "Launch DInput configuration screen") { plgAudioSys::Activate(false); - plInputEventMsg* pMsg = TRACKED_NEW plInputEventMsg; + plInputEventMsg* pMsg = new plInputEventMsg; pMsg->fEvent = plInputEventMsg::kConfigure; pMsg->AddReceiver( plInputManager::GetInstance()->GetKey() ); pMsg->SetBCastFlag(plMessage::kBCastByType, false); @@ -3971,7 +3922,7 @@ PF_CONSOLE_CMD( Nav, PageInNode, // Group name, Function name "Pages in a scene node." ) // Help string { plSynchEnabler ps(false); // disable dirty tracking while paging in - plClientMsg* pMsg1 = TRACKED_NEW plClientMsg(plClientMsg::kLoadRoom); + plClientMsg* pMsg1 = new plClientMsg(plClientMsg::kLoadRoom); pMsg1->AddReceiver( plClient::GetInstance()->GetKey() ); pMsg1->AddRoomLoc(plKeyFinder::Instance().FindLocation(nil, params[0])); plgDispatch::MsgSend(pMsg1); @@ -3989,7 +3940,7 @@ PF_CONSOLE_CMD( Nav, PageInNodeList, // Group name, Function name pageInNodesStr += "*.prx"; hsFolderIterator pageInNodesIter(pageInNodesStr.data(), true); - plClientMsg* pMsg1 = TRACKED_NEW plClientMsg(plClientMsg::kLoadRoom); + plClientMsg* pMsg1 = new plClientMsg(plClientMsg::kLoadRoom); while (pageInNodesIter.NextFile()) { char nodeName[255]; @@ -4008,7 +3959,7 @@ PF_CONSOLE_CMD( Nav, PageOutNode, // Group name, Function name "pages out a scene node." ) // Help string { plSynchEnabler ps(false); // disable dirty tracking while paging out - plClientMsg* pMsg1 = TRACKED_NEW plClientMsg(plClientMsg::kUnloadRoom); + plClientMsg* pMsg1 = new plClientMsg(plClientMsg::kUnloadRoom); pMsg1->AddReceiver( plClient::GetInstance()->GetKey() ); pMsg1->AddRoomLoc(plKeyFinder::Instance().FindLocation(nil, params[0])); plgDispatch::MsgSend(pMsg1); @@ -4047,7 +3998,7 @@ PF_CONSOLE_CMD( Nav, MovePlayer, // Group name, Function name if( !nodeKey ) return; - plNodeChangeMsg* msg = TRACKED_NEW plNodeChangeMsg(nil, playerKey, nodeKey); + plNodeChangeMsg* msg = new plNodeChangeMsg(nil, playerKey, nodeKey); plgDispatch::MsgSend(msg); sprintf(str, "%s moved to %s", (char*)params[0], (char*)params[1]); PrintString(str); @@ -4082,11 +4033,11 @@ PF_CONSOLE_CMD( Movie, "Start of movie with this filename" ) { char* filename = params[0]; - plMovieMsg* mov = TRACKED_NEW plMovieMsg(filename, plMovieMsg::kStart); + plMovieMsg* mov = new plMovieMsg(filename, plMovieMsg::kStart); //#define MF_TEST_MOVIECALLBACKS #ifdef MF_TEST_MOVIECALLBACKS - plMovieMsg* cb = TRACKED_NEW plMovieMsg("avi/intro0.bik", plMovieMsg::kStart); + plMovieMsg* cb = new plMovieMsg("avi/intro0.bik", plMovieMsg::kStart); mov->AddCallback(cb); mov->SetCmd(mov->GetCmd() | plMovieMsg::kAddCallbacks); #endif // MF_TEST_MOVIECALLBACKS @@ -4102,7 +4053,7 @@ PF_CONSOLE_CMD( Movie, "Stop movie with this filename" ) { char* filename = params[0]; - plMovieMsg* mov = TRACKED_NEW plMovieMsg(filename, plMovieMsg::kStop); + plMovieMsg* mov = new plMovieMsg(filename, plMovieMsg::kStop); mov->Send(); PrintStringF(PrintString, "%s now stopping", filename); @@ -4114,7 +4065,7 @@ PF_CONSOLE_CMD( Movie, "Pause movie with this filename" ) { char* filename = params[0]; - plMovieMsg* mov = TRACKED_NEW plMovieMsg(filename, plMovieMsg::kPause); + plMovieMsg* mov = new plMovieMsg(filename, plMovieMsg::kPause); mov->Send(); PrintStringF(PrintString, "%s now pausing", filename); @@ -4126,7 +4077,7 @@ PF_CONSOLE_CMD( Movie, "Resume movie with this filename" ) { char* filename = params[0]; - plMovieMsg* mov = TRACKED_NEW plMovieMsg(filename, plMovieMsg::kResume); + plMovieMsg* mov = new plMovieMsg(filename, plMovieMsg::kResume); mov->Send(); PrintStringF(PrintString, "%s now resuming", filename); @@ -4138,7 +4089,7 @@ PF_CONSOLE_CMD( Movie, "Move center of movie with this filename to x,y" ) { char* filename = params[0]; - plMovieMsg* mov = TRACKED_NEW plMovieMsg(filename, plMovieMsg::kMove); + plMovieMsg* mov = new plMovieMsg(filename, plMovieMsg::kMove); float x = params[1]; float y = params[2]; mov->SetCenter(x, y); @@ -4153,7 +4104,7 @@ PF_CONSOLE_CMD( Movie, "Scale movie with this filename by x,y" ) { char* filename = params[0]; - plMovieMsg* mov = TRACKED_NEW plMovieMsg(filename, plMovieMsg::kScale); + plMovieMsg* mov = new plMovieMsg(filename, plMovieMsg::kScale); float x = params[1]; float y = params[2]; mov->SetScale(x, y); @@ -4168,7 +4119,7 @@ PF_CONSOLE_CMD( Movie, "Set opacity of movie with this filename to a" ) { char* filename = params[0]; - plMovieMsg* mov = TRACKED_NEW plMovieMsg(filename, plMovieMsg::kOpacity); + plMovieMsg* mov = new plMovieMsg(filename, plMovieMsg::kOpacity); float a = params[1]; mov->SetOpacity(a); mov->Send(); @@ -4182,7 +4133,7 @@ PF_CONSOLE_CMD( Movie, "Color movie with this filename as r,g,b" ) { char* filename = params[0]; - plMovieMsg* mov = TRACKED_NEW plMovieMsg(filename, plMovieMsg::kColor); + plMovieMsg* mov = new plMovieMsg(filename, plMovieMsg::kColor); float r = params[1]; float g = params[2]; float b = params[3]; @@ -4198,7 +4149,7 @@ PF_CONSOLE_CMD( Movie, "Set volume of movie with this filename to v" ) { char* filename = params[0]; - plMovieMsg* mov = TRACKED_NEW plMovieMsg(filename, plMovieMsg::kVolume); + plMovieMsg* mov = new plMovieMsg(filename, plMovieMsg::kVolume); float v = params[1]; mov->SetVolume(v); mov->Send(); @@ -4212,7 +4163,7 @@ PF_CONSOLE_CMD( Movie, "Fade in movie with this filename from r,g,b,a over secs seconds" ) { char* filename = params[0]; - plMovieMsg* mov = TRACKED_NEW plMovieMsg(filename, plMovieMsg::kFadeIn); + plMovieMsg* mov = new plMovieMsg(filename, plMovieMsg::kFadeIn); float secs = params[1]; float r = params[2]; float g = params[3]; @@ -4231,7 +4182,7 @@ PF_CONSOLE_CMD( Movie, "Fade out movie with this filename to r,g,b,a over secs seconds" ) { char* filename = params[0]; - plMovieMsg* mov = TRACKED_NEW plMovieMsg(filename, plMovieMsg::kFadeOut); + plMovieMsg* mov = new plMovieMsg(filename, plMovieMsg::kFadeOut); float secs = params[1]; float r = params[2]; float g = params[3]; @@ -4631,13 +4582,13 @@ PF_CONSOLE_CMD( Access, float fadeUp = params[1]; float fadeDown = params[2]; - plFadeOpacityMod* mod = TRACKED_NEW plFadeOpacityMod; + plFadeOpacityMod* mod = new plFadeOpacityMod; mod->SetFadeUp(fadeUp); mod->SetFadeDown(fadeDown); hsgResMgr::ResMgr()->NewKey(obj->GetKey()->GetName(), mod, obj->GetKey()->GetUoid().GetLocation()); - hsgResMgr::ResMgr()->AddViaNotify(mod->GetKey(), TRACKED_NEW plObjRefMsg(obj->GetKey(), plRefMsg::kOnCreate, -1, plObjRefMsg::kModifier), plRefFlags::kActiveRef); + hsgResMgr::ResMgr()->AddViaNotify(mod->GetKey(), new plObjRefMsg(obj->GetKey(), plRefMsg::kOnCreate, -1, plObjRefMsg::kModifier), plRefFlags::kActiveRef); } @@ -4701,8 +4652,8 @@ PF_CONSOLE_CMD( Access, hsPoint3 from = pfConsole::GetPipeline()->GetViewPositionWorld(); - Int32 sx = pfConsole::GetPipeline()->Width() / 2; - Int32 sy = pfConsole::GetPipeline()->Height() / 2; + int32_t sx = pfConsole::GetPipeline()->Width() / 2; + int32_t sy = pfConsole::GetPipeline()->Height() / 2; hsPoint3 targ; pfConsole::GetPipeline()->ScreenToWorldPoint(1, 0, &sx, &sy, dist, 0, &targ); @@ -4731,8 +4682,8 @@ PF_CONSOLE_CMD( Access, #include "plMessage/plBulletMsg.h" plSceneObject* gunObj = nil; -hsScalar gunRadius = 1.f; -hsScalar gunRange = 5000.f; +float gunRadius = 1.f; +float gunRange = 5000.f; PF_CONSOLE_CMD( Access, Gun, @@ -4774,11 +4725,11 @@ PF_CONSOLE_CMD( Access, dir.Normalize(); hsPoint3 pos = l2w.GetTranslate(); - hsScalar radius = gunRadius; + float radius = gunRadius; - hsScalar range = gunRange; + float range = gunRange; - plBulletMsg* bull = TRACKED_NEW plBulletMsg(nil, nil, nil); + plBulletMsg* bull = new plBulletMsg(nil, nil, nil); bull->FireShot(pos, dir, radius, range); bull->Send(); @@ -4803,11 +4754,11 @@ PF_CONSOLE_CMD( Access, dir.Normalize(); hsPoint3 pos = l2w.GetTranslate(); - hsScalar radius = gunRadius; + float radius = gunRadius; - hsScalar range = gunRange; + float range = gunRange; - plBulletMsg* bull = TRACKED_NEW plBulletMsg(nil, nil, nil); + plBulletMsg* bull = new plBulletMsg(nil, nil, nil); bull->FireShot(pos, dir, radius, range); bull->Send(); @@ -4835,7 +4786,7 @@ PF_CONSOLE_CMD( Access, PrintString("Psys not found"); return; } - hsgResMgr::ResMgr()->AddViaNotify(sysKey, TRACKED_NEW plGenRefMsg(bullKey, plRefMsg::kOnCreate, 0, plDynaBulletMgr::kRefPartyObject), plRefFlags::kPassiveRef); + hsgResMgr::ResMgr()->AddViaNotify(sysKey, new plGenRefMsg(bullKey, plRefMsg::kOnCreate, 0, plDynaBulletMgr::kRefPartyObject), plRefFlags::kPassiveRef); PrintString("sys added"); } @@ -4894,11 +4845,11 @@ namespace plWaveCmd { typedef void PrintFunk(const char* str); -static inline hsScalar FracToPercent(hsScalar f) { return (hsScalar)(1.e2 * f); } -static inline hsScalar PercentToFrac(hsScalar f) { return (hsScalar)(1.e-2 * f); } +static inline float FracToPercent(float f) { return (float)(1.e2 * f); } +static inline float PercentToFrac(float f) { return (float)(1.e-2 * f); } -static inline hsScalar RadToDeg(hsScalar r) { return r * 180.f / hsScalarPI; } -static inline hsScalar DegToRad(hsScalar d) { return d * hsScalarPI / 180.f; } +static inline float RadToDeg(float r) { return r * 180.f / M_PI; } +static inline float DegToRad(float d) { return d * M_PI / 180.f; } static void IDisplayWaveVal(PrintFunk PrintString, plWaveSet7* wave, plWaveCmd::Cmd cmd) { @@ -5058,7 +5009,7 @@ static plWaveSet7* ICheckWaveParams(PrintFunk PrintString, const plString& name, return waveSet; } -static hsScalar LimitVal(hsScalar val, hsScalar lo, hsScalar hi, PrintFunk PrintString) +static float LimitVal(float val, float lo, float hi, PrintFunk PrintString) { if( val < lo ) { @@ -5087,7 +5038,7 @@ static bool ISendWaveCmd1f(PrintFunk PrintString, pfConsoleCmdParam* params, int float val = params[1]; - hsScalar secs = ( numParams > 2 ) ? params[2] : 0.f; + float secs = ( numParams > 2 ) ? params[2] : 0.f; switch( cmd ) { @@ -5164,7 +5115,7 @@ static bool ISendWaveCmd2f(PrintFunk PrintString, pfConsoleCmdParam* params, int using namespace plWaveCmd; - hsScalar secs = ( numParams > 3 ) ? params[3] : 0.f; + float secs = ( numParams > 3 ) ? params[3] : 0.f; hsVector3 vec; plFixedWaterState7 state = wave->State(); @@ -5213,7 +5164,7 @@ static bool ISendWaveCmd3f(PrintFunk PrintString, pfConsoleCmdParam* params, int hsVector3 vec(x, y, z); hsPoint3 pos(x, y, z); - hsScalar secs = ( numParams > 4 ) ? params[4] : 0.f; + float secs = ( numParams > 4 ) ? params[4] : 0.f; switch( cmd ) { @@ -5249,7 +5200,7 @@ static bool ISendWaveCmd4c(PrintFunk PrintString, pfConsoleCmdParam* params, int float g = params[2]; float b = params[3]; - hsScalar secs = ( numParams > 4 ) ? params[4] : 0.f; + float secs = ( numParams > 4 ) ? params[4] : 0.f; hsColorRGBA col; col.Set(r / 255.f, g / 255.f, b / 255.f, 1.f); @@ -5517,7 +5468,7 @@ PF_CONSOLE_CMD( SceneObject_SetEnable, Drawable, // Group name, Function name bool enable = params[1]; - plEnableMsg* pEMsg = TRACKED_NEW plEnableMsg; + plEnableMsg* pEMsg = new plEnableMsg; pEMsg->SetCmd( enable ? plEnableMsg::kEnable : plEnableMsg::kDisable ); pEMsg->SetCmd( plEnableMsg::kDrawable ); pEMsg->AddReceiver( key ); @@ -5536,7 +5487,7 @@ PF_CONSOLE_CMD( SceneObject_SetEnable, Physical, // Group name, Function name bool enable = params[1]; - plEnableMsg* pEMsg = TRACKED_NEW plEnableMsg; + plEnableMsg* pEMsg = new plEnableMsg; pEMsg->SetCmd( enable ? plEnableMsg::kEnable : plEnableMsg::kDisable ); pEMsg->SetCmd( plEnableMsg::kPhysical ); pEMsg->AddReceiver( key ); @@ -5555,7 +5506,7 @@ PF_CONSOLE_CMD( SceneObject_SetEnable, PhysicalT, // Group name, Function name bool enable = params[1]; - plEventGroupEnableMsg* pMsg = TRACKED_NEW plEventGroupEnableMsg; + plEventGroupEnableMsg* pMsg = new plEventGroupEnableMsg; if( enable ) pMsg->SetFlags(plEventGroupEnableMsg::kCollideOn | plEventGroupEnableMsg::kReportOn); else @@ -5578,7 +5529,7 @@ PF_CONSOLE_CMD( SceneObject_SetEnable, Audible, // Group name, Function name bool enable = params[1]; - plEnableMsg* pEMsg = TRACKED_NEW plEnableMsg; + plEnableMsg* pEMsg = new plEnableMsg; pEMsg->SetCmd( enable ? plEnableMsg::kEnable : plEnableMsg::kDisable ); pEMsg->SetCmd( plEnableMsg::kAudible ); pEMsg->AddReceiver( key ); @@ -5597,7 +5548,7 @@ PF_CONSOLE_CMD( SceneObject_SetEnable, All, // Group name, Function name bool enable = params[1]; - plEnableMsg* pEMsg = TRACKED_NEW plEnableMsg; + plEnableMsg* pEMsg = new plEnableMsg; pEMsg->SetCmd( enable ? plEnableMsg::kEnable : plEnableMsg::kDisable ); pEMsg->SetCmd( plEnableMsg::kAll ); pEMsg->AddReceiver( key ); @@ -5634,7 +5585,7 @@ PF_CONSOLE_CMD( SceneObject, Attach, // Group name, Function name return; } - plAttachMsg* attMsg = TRACKED_NEW plAttachMsg(parentKey, child, plRefMsg::kOnRequest, nil); + plAttachMsg* attMsg = new plAttachMsg(parentKey, child, plRefMsg::kOnRequest, nil); plgDispatch::MsgSend(attMsg); sprintf(str, "%s now child of %s", childName.c_str(), parentName.c_str()); @@ -5670,7 +5621,7 @@ PF_CONSOLE_CMD( SceneObject, Detach, // Group name, Function name && child->GetCoordinateInterface()->GetParent()->GetOwner() ) { plKey parentKey = child->GetCoordinateInterface()->GetParent()->GetOwner()->GetKey(); - plAttachMsg* attMsg = TRACKED_NEW plAttachMsg(parentKey, child, plRefMsg::kOnRemove, nil); + plAttachMsg* attMsg = new plAttachMsg(parentKey, child, plRefMsg::kOnRemove, nil); plgDispatch::MsgSend(attMsg); sprintf(str, "%s detached from %s", childName.c_str(), parentKey->GetName().c_str()); @@ -5776,7 +5727,7 @@ PF_CONSOLE_CMD( Physics, ApplyForce, "string Object, float x, float y, float z", if(key) { hsVector3 force(params[1], params[2], params[3]); - plForceMsg *m = TRACKED_NEW plForceMsg(nil, key, force); + plForceMsg *m = new plForceMsg(nil, key, force); plgDispatch::MsgSend(m); } } @@ -5789,7 +5740,7 @@ PF_CONSOLE_CMD( Physics, ApplyForceAtPoint, "string Object, float forceX, float { hsVector3 force(params[1], params[2], params[3]); hsPoint3 point(params[4], params[5], params[6]); - plOffsetForceMsg *m = TRACKED_NEW plOffsetForceMsg(nil, key, force, point); + plOffsetForceMsg *m = new plOffsetForceMsg(nil, key, force, point); plgDispatch::MsgSend(m); } } @@ -5801,7 +5752,7 @@ PF_CONSOLE_CMD( Physics, ApplyTorque, "string Object, float axisX, float axisY, if(key) { hsVector3 torque(params[1], params[2], params[3]); - plTorqueMsg *m = TRACKED_NEW plTorqueMsg(nil, key, torque); + plTorqueMsg *m = new plTorqueMsg(nil, key, torque); plgDispatch::MsgSend(m); } } @@ -5813,7 +5764,7 @@ PF_CONSOLE_CMD( Physics, ApplyImpulse, "string Object, float x, float y, float z if(key) { hsVector3 impulse(params[1], params[2], params[3]); - plImpulseMsg *m = TRACKED_NEW plImpulseMsg(nil, key, impulse); + plImpulseMsg *m = new plImpulseMsg(nil, key, impulse); plgDispatch::MsgSend(m); } } @@ -5826,7 +5777,7 @@ PF_CONSOLE_CMD( Physics, ApplyImpulseAtPoint, "string Object, float impulseX, fl { hsVector3 impulse(params[1], params[2], params[3]); hsPoint3 point(params[4], params[5], params[6]); - plOffsetImpulseMsg *m = TRACKED_NEW plOffsetImpulseMsg(nil, key, impulse, point); + plOffsetImpulseMsg *m = new plOffsetImpulseMsg(nil, key, impulse, point); plgDispatch::MsgSend(m); } } @@ -5838,7 +5789,7 @@ PF_CONSOLE_CMD( Physics, ApplyAngularImpulse, "string Object, float x, float y, if(key) { hsVector3 impulse(params[1], params[2], params[3]); - plAngularImpulseMsg *m = TRACKED_NEW plAngularImpulseMsg(nil, key, impulse); + plAngularImpulseMsg *m = new plAngularImpulseMsg(nil, key, impulse); plgDispatch::MsgSend(m); } } @@ -5850,7 +5801,7 @@ PF_CONSOLE_CMD( Physics, ApplyDamping, "string Object, float dampFactor", "Reduc if(key) { float dampFactor = params[1]; - plDampMsg *m = TRACKED_NEW plDampMsg(nil, key, dampFactor); + plDampMsg *m = new plDampMsg(nil, key, dampFactor); plgDispatch::MsgSend(m); } } @@ -5862,7 +5813,7 @@ PF_CONSOLE_CMD( Physics, ShiftMass, "string Object, float x, float y, float z", if(key) { hsVector3 offset(params[1], params[2], params[3]); - plShiftMassMsg *m = TRACKED_NEW plShiftMassMsg(nil, key, offset); + plShiftMassMsg *m = new plShiftMassMsg(nil, key, offset); plgDispatch::MsgSend(m); } } @@ -5875,7 +5826,7 @@ PF_CONSOLE_CMD( Physics, Suppress, "string Object, int doSuppress", "Remove(true int iDoSuppress = params[1]; bool doSuppress = iDoSuppress ? true : false; - plSimSuppressMsg *msg = TRACKED_NEW plSimSuppressMsg(nil, key, doSuppress); + plSimSuppressMsg *msg = new plSimSuppressMsg(nil, key, doSuppress); msg->Send(); } } @@ -5887,7 +5838,7 @@ PF_CONSOLE_CMD( Physics, SetEventGroup, "string Object, int group, int status, i if(key) { int group = params[1], status = params[2], clearOthers = params[3]; - plEventGroupMsg *m = TRACKED_NEW plEventGroupMsg(nil, key, group, status, clearOthers); + plEventGroupMsg *m = new plEventGroupMsg(nil, key, group, status, clearOthers); plgDispatch::MsgSend(m); } } @@ -5900,7 +5851,7 @@ PF_CONSOLE_CMD( Physics, Freeze, "string Object, int status", "Immobilize the gi { int status = params[1]; - plFreezeMsg *m = TRACKED_NEW plFreezeMsg(nil, key, nil, status); + plFreezeMsg *m = new plFreezeMsg(nil, key, nil, status); plgDispatch::MsgSend(m); } @@ -6030,7 +5981,7 @@ PF_CONSOLE_CMD( Mouse, UnInvert, nil, "un-invert the mouse") PF_CONSOLE_CMD( Mouse, SetDeadZone, "float zone", "Sets the dead zone for the mouse - range is from 0.0 to 1.0") { - hsScalar f = params[0]; + float f = params[0]; } PF_CONSOLE_CMD( Mouse, Enable, nil, "Enable mouse input") @@ -6086,7 +6037,7 @@ PF_CONSOLE_CMD(Age, ShowSDL, "", "Prints the age SDL values") plStateDataRecord * rec = NEWZERO(plStateDataRecord); if (!VaultAgeGetAgeSDL(rec)) { PrintString("Age SDL not found"); - DEL(rec); + delete rec; return; } @@ -6102,14 +6053,14 @@ PF_CONSOLE_CMD(Age, ShowSDL, "", "Prints the age SDL values") char * str = simple->GetAsString(j); StrPack(line, str, arrsize(line)); StrPack(line, ",", arrsize(line)); - FREE(str); + free(str); } PrintString(line); plStatusLog::AddLineS("ShowSDL.log", "%s", line); } } - DEL(rec); + delete rec; } PF_CONSOLE_CMD( Age, GetElapsedDays, "string agedefnfile", "Gets the elapsed days and fractions" ) @@ -6234,7 +6185,7 @@ PF_CONSOLE_CMD( Age, SetSDLBool, "string varName, bool value, int index", "Set t PF_CONSOLE_GROUP( ParticleSystem ) // Defines a main command group -void UpdateParticleParam(const plString &objName, Int32 paramID, hsScalar value, void (*PrintString)(const char *)) +void UpdateParticleParam(const plString &objName, int32_t paramID, float value, void (*PrintString)(const char *)) { char str[256]; plKey key = FindSceneObjectByName(objName, nil, str); @@ -6250,7 +6201,7 @@ void UpdateParticleParam(const plString &objName, Int32 paramID, hsScalar value, const plParticleSystem *sys = plParticleSystem::ConvertNoRef(so->GetModifier(i)); if (sys != nil) { - plgDispatch::MsgSend(TRACKED_NEW plParticleUpdateMsg(nil, sys->GetKey(), nil, paramID, value)); + plgDispatch::MsgSend(new plParticleUpdateMsg(nil, sys->GetKey(), nil, paramID, value)); PrintString("Particle system successfully updated."); return; } @@ -6370,7 +6321,7 @@ PF_CONSOLE_CMD( ParticleSystem, plArmatureMod *avMod = plAvatarMgr::GetInstance()->GetLocalAvatar(); if (avMod) - (TRACKED_NEW plParticleTransferMsg(nil, avMod->GetKey(), 0, so->GetKey(), (int)params[1]))->Send(); + (new plParticleTransferMsg(nil, avMod->GetKey(), 0, so->GetKey(), (int)params[1]))->Send(); } PF_CONSOLE_CMD( ParticleSystem, @@ -6390,8 +6341,8 @@ PF_CONSOLE_CMD( ParticleSystem, const plParticleSystem *sys = plParticleSystem::ConvertNoRef(so->GetModifierByType(plParticleSystem::Index())); if (sys != nil) { - UInt8 flags = (params[3] ? plParticleKillMsg::kParticleKillPercentage : 0); - (TRACKED_NEW plParticleKillMsg(nil, sys->GetKey(), 0, params[2], params[1], flags))->Send(); + uint8_t flags = (params[3] ? plParticleKillMsg::kParticleKillPercentage : 0); + (new plParticleKillMsg(nil, sys->GetKey(), 0, params[2], params[1], flags))->Send(); } } @@ -6429,7 +6380,7 @@ PF_CONSOLE_CMD( ParticleSystem_Flock, plParticleEffect *flock = FindFlock(plString::FromUtf8(params[0])); if (flock) { - (TRACKED_NEW plParticleFlockMsg(nil, flock->GetKey(), 0, plParticleFlockMsg::kFlockCmdSetOffset, params[1], params[2], params[3]))->Send(); + (new plParticleFlockMsg(nil, flock->GetKey(), 0, plParticleFlockMsg::kFlockCmdSetOffset, params[1], params[2], params[3]))->Send(); } } @@ -6441,7 +6392,7 @@ PF_CONSOLE_CMD( ParticleSystem_Flock, plParticleEffect *flock = FindFlock(plString::FromUtf8(params[0])); if (flock) { - (TRACKED_NEW plParticleFlockMsg(nil, flock->GetKey(), 0, plParticleFlockMsg::kFlockCmdSetDissentPoint, params[1], params[2], params[3]))->Send(); + (new plParticleFlockMsg(nil, flock->GetKey(), 0, plParticleFlockMsg::kFlockCmdSetDissentPoint, params[1], params[2], params[3]))->Send(); } } @@ -6595,7 +6546,7 @@ PF_CONSOLE_CMD( Animation, // Group name "string objName, string animName", // Params "Start the animation" ) // Help string { - plAnimCmdMsg *msg = TRACKED_NEW plAnimCmdMsg(); + plAnimCmdMsg *msg = new plAnimCmdMsg(); msg->SetCmd(plAnimCmdMsg::kContinue); msg->SetAnimName(nil); msg->SetBCastFlag(plMessage::kPropagateToModifiers); @@ -6607,7 +6558,7 @@ PF_CONSOLE_CMD( Animation, // Group name "string objName, string animName", // Params "Stop the animation" ) // Help string { - plAnimCmdMsg *msg = TRACKED_NEW plAnimCmdMsg(); + plAnimCmdMsg *msg = new plAnimCmdMsg(); msg->SetCmd(plAnimCmdMsg::kStop); msg->SetAnimName(nil); msg->SetBCastFlag(plMessage::kPropagateToModifiers); @@ -6619,7 +6570,7 @@ PF_CONSOLE_CMD( Animation, // Group name "string objName, string animName, float blend, float rate", // Params "Set the animation's blend value and rate to change" ) // Help string { - plAGCmdMsg *msg = TRACKED_NEW plAGCmdMsg(); + plAGCmdMsg *msg = new plAGCmdMsg(); msg->SetCmd(plAGCmdMsg::kSetBlend); msg->fBlend = params[2]; msg->fBlendRate = params[3]; @@ -6633,7 +6584,7 @@ PF_CONSOLE_CMD( Animation, // Group name "string objName, string animName, float amp, float rate", // Params "Set the amplitude of this animation and rate to change" ) // Help string { - plAGCmdMsg *msg = TRACKED_NEW plAGCmdMsg(); + plAGCmdMsg *msg = new plAGCmdMsg(); msg->SetCmd(plAGCmdMsg::kSetAmp); msg->fAmp = params[2]; msg->fAmpRate = params[3]; @@ -6647,7 +6598,7 @@ PF_CONSOLE_CMD( Animation, // Group name "string objName, string animName, float speed, float rate", // Params "Set the speed of this animation and rate to change" ) // Help string { - plAnimCmdMsg *msg = TRACKED_NEW plAnimCmdMsg(); + plAnimCmdMsg *msg = new plAnimCmdMsg(); msg->SetCmd(plAnimCmdMsg::kSetSpeed); msg->fSpeed = params[2]; msg->fSpeedChangeRate = params[3]; @@ -6762,7 +6713,7 @@ PF_CONSOLE_CMD( Clothing, // Group name { plArmatureMod *avMod = plAvatarMgr::GetInstance()->GetLocalAvatar(); plClothingItem *item = plClothingMgr::GetClothingMgr()->FindItemByName(params[0]); - UInt8 layer; + uint8_t layer; if ((int)params[4] == 2) layer = plClothingElement::kLayerTint2; else @@ -6900,7 +6851,7 @@ PF_CONSOLE_CMD( KI, // Group name "Upgrade KI to new level." ) // Help string { // create the mesage to send - pfKIMsg *msg = TRACKED_NEW pfKIMsg( pfKIMsg::kUpgradeKILevel ); + pfKIMsg *msg = new pfKIMsg( pfKIMsg::kUpgradeKILevel ); msg->SetIntValue((int) params[0]); @@ -6914,7 +6865,7 @@ PF_CONSOLE_CMD( KI, // Group name "Downgrade KI level to next lower level." ) // Help string { // create the mesage to send - pfKIMsg *msg = TRACKED_NEW pfKIMsg( pfKIMsg::kDowngradeKILevel ); + pfKIMsg *msg = new pfKIMsg( pfKIMsg::kDowngradeKILevel ); msg->SetIntValue((int) params[0]); @@ -6928,7 +6879,7 @@ PF_CONSOLE_CMD( KI, // Group name "All the phased functionality turned on." ) // Help string { // create the mesage to send - pfKIMsg *msg = TRACKED_NEW pfKIMsg( pfKIMsg::kKIPhasedAllOn ); + pfKIMsg *msg = new pfKIMsg( pfKIMsg::kKIPhasedAllOn ); // send it off plgDispatch::MsgSend( msg ); @@ -6940,7 +6891,7 @@ PF_CONSOLE_CMD( KI, // Group name "All the phased functionality turned off." ) // Help string { // create the mesage to send - pfKIMsg *msg = TRACKED_NEW pfKIMsg( pfKIMsg::kKIPhasedAllOff ); + pfKIMsg *msg = new pfKIMsg( pfKIMsg::kKIPhasedAllOff ); // send it off plgDispatch::MsgSend( msg ); @@ -6952,7 +6903,7 @@ PF_CONSOLE_CMD( KI, // Group name "Add the journal to the Blackbar." ) // Help string { // create the message to send - pfKIMsg *msg = TRACKED_NEW pfKIMsg( pfKIMsg::kAddJournalBook ); + pfKIMsg *msg = new pfKIMsg( pfKIMsg::kAddJournalBook ); // send if off plgDispatch::MsgSend( msg ); @@ -6964,7 +6915,7 @@ PF_CONSOLE_CMD( KI, // Group name "Removes the journal from the Blackbar." ) // Help string { // create the message to send - pfKIMsg *msg = TRACKED_NEW pfKIMsg( pfKIMsg::kRemoveJournalBook ); + pfKIMsg *msg = new pfKIMsg( pfKIMsg::kRemoveJournalBook ); // send if off plgDispatch::MsgSend( msg ); @@ -7041,7 +6992,7 @@ PF_CONSOLE_CMD( Python, const char* extraParms = ""; if (numParams > 1) extraParms = params[1]; - pfBackdoorMsg *msg = TRACKED_NEW pfBackdoorMsg( params[0],extraParms ); + pfBackdoorMsg *msg = new pfBackdoorMsg( params[0],extraParms ); // send it off plgDispatch::MsgSend( msg ); } diff --git a/Sources/Plasma/FeatureLib/pfConsole/pfConsoleCommandsNet.cpp b/Sources/Plasma/FeatureLib/pfConsole/pfConsoleCommandsNet.cpp index 27f2ea12..3a96e8b3 100644 --- a/Sources/Plasma/FeatureLib/pfConsole/pfConsoleCommandsNet.cpp +++ b/Sources/Plasma/FeatureLib/pfConsole/pfConsoleCommandsNet.cpp @@ -143,7 +143,7 @@ PF_CONSOLE_FILE_DUMMY(Net) // name isn't obvious (i.e. SetFogColor doesn't really need one) // // The actual C code prototype looks like: -// void pfConsoleCmd_groupName_functionName( UInt32 numParams, pfConsoleCmdParam *params, +// void pfConsoleCmd_groupName_functionName( uint32_t numParams, pfConsoleCmdParam *params, // void (*PrintString)( char * ) ); // // numParams is exactly what it sounds like. params is an array of console @@ -237,7 +237,7 @@ PF_CONSOLE_CMD( Net, // groupName text += plString::FromUtf8( (char*)params[i] ); text += _TEMP_CONVERT_FROM_LITERAL(" "); } - plConsoleMsg *cMsg = TRACKED_NEW plConsoleMsg( plConsoleMsg::kAddLine, text.c_str() ); + plConsoleMsg *cMsg = new plConsoleMsg( plConsoleMsg::kAddLine, text.c_str() ); cMsg->SetBCastFlag(plMessage::kNetPropagate | plMessage::kNetForce); cMsg->SetBCastFlag(plMessage::kLocalPropagate, 0); plgDispatch::MsgSend( cMsg ); @@ -792,8 +792,8 @@ PF_CONSOLE_CMD( Net_Vault, "string stationName, string mtSpawnPt", "Register an MT Station with your Nexus" ) { - wchar wName[MAX_PATH]; - wchar wObj[MAX_PATH]; + wchar_t wName[MAX_PATH]; + wchar_t wObj[MAX_PATH]; StrToUnicode(wName, params[0], arrsize(wName)); StrToUnicode(wObj, params[1], arrsize(wObj)); VaultRegisterMTStationAndWait ( wName, wObj ); diff --git a/Sources/Plasma/FeatureLib/pfConsole/pfConsoleDirSrc.cpp b/Sources/Plasma/FeatureLib/pfConsole/pfConsoleDirSrc.cpp index bb7ed1fb..d94603d9 100644 --- a/Sources/Plasma/FeatureLib/pfConsole/pfConsoleDirSrc.cpp +++ b/Sources/Plasma/FeatureLib/pfConsole/pfConsoleDirSrc.cpp @@ -46,20 +46,11 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com ////////////////////////////////////////////////////////////////////////////// #include "pfConsoleDirSrc.h" - +#include "HeadSpin.h" #include "hsExceptions.h" #ifdef HS_BUILD_FOR_WIN32 -#define WIN32_EXTRA_LEAN -#define WIN32_LEAN_AND_MEAN -#ifndef _WINDOWS_H_ // redundant include guard to minimize compile times -#define _WINDOWS_H_ -#include -#endif // _WINDOWS_H_ - -#include - #include @@ -67,8 +58,8 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com hsBool pfConsoleDirSrc::ParseDirectory(const std::string& path, const std::string& mask /* = "*.*" */) { - wchar* wPath = hsStringToWString(path.c_str()); - wchar* wMask = hsStringToWString(mask.c_str()); + wchar_t* wPath = hsStringToWString(path.c_str()); + wchar_t* wMask = hsStringToWString(mask.c_str()); hsBool ret = ParseDirectory(wPath, wMask); delete [] wPath; delete [] wMask; @@ -104,8 +95,8 @@ hsBool pfConsoleDirSrc::ParseDirectory(const std::wstring& path, const std::wst // errors in the parsing std::wstringstream error; std::wstringstream caption; - wchar* errorMsg = hsStringToWString(fEngine->GetErrorMsg()); - wchar* errorLine = hsStringToWString(fEngine->GetLastErrorLine()); + wchar_t* errorMsg = hsStringToWString(fEngine->GetErrorMsg()); + wchar_t* errorLine = hsStringToWString(fEngine->GetLastErrorLine()); caption << L"Error parsing " << findInfo.cFileName; error << errorMsg << L":\n\nCommand: '" << errorLine << L"'\n\nPress OK to continue parsing files."; @@ -161,5 +152,5 @@ hsBool pfConsoleDirSrc::AlreadyProcessedFile(const std::wstring& path, const std void pfConsoleDirSrc::AddProcessedFile(const std::wstring& path, const std::wstring& file) { - fProcessedFiles.push_back(TRACKED_NEW FileName(path, file)); + fProcessedFiles.push_back(new FileName(path, file)); } diff --git a/Sources/Plasma/FeatureLib/pfConsole/pfConsoleDirSrc.h b/Sources/Plasma/FeatureLib/pfConsole/pfConsoleDirSrc.h index 395b2e34..fdb72d30 100644 --- a/Sources/Plasma/FeatureLib/pfConsole/pfConsoleDirSrc.h +++ b/Sources/Plasma/FeatureLib/pfConsole/pfConsoleDirSrc.h @@ -55,7 +55,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #ifndef _pfConsoleDirSrc_h #define _pfConsoleDirSrc_h -#include "hsTypes.h" +#include "HeadSpin.h" #include "hsStlUtils.h" #include "pfConsoleCore/pfConsoleEngine.h" diff --git a/Sources/Plasma/FeatureLib/pfConsole/pfDispatchLog.cpp b/Sources/Plasma/FeatureLib/pfConsole/pfDispatchLog.cpp index 9761f828..7a0b2f4c 100644 --- a/Sources/Plasma/FeatureLib/pfConsole/pfDispatchLog.cpp +++ b/Sources/Plasma/FeatureLib/pfConsole/pfDispatchLog.cpp @@ -44,7 +44,6 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "plStatusLog/plStatusLog.h" #include "pnMessage/plMessage.h" #include "pnKeyedObject/plKey.h" -#include "hsWindows.h" #include "plString.h" static bool DumpSpecificMsgInfo(plMessage* msg, std::string& info); @@ -80,7 +79,7 @@ void plDispatchLog::LogStatusBarChange(const char* name, const char* action) memset(&mbi, 0, sizeof(MEMORY_BASIC_INFORMATION)); // Note: this will return shared mem too on Win9x. There's a way to catch that, but it's too slow -Colin - UInt32 processMemUsed = 0; + uint32_t processMemUsed = 0; void* curAddress = 0; while (VirtualQuery(curAddress, &mbi, sizeof(MEMORY_BASIC_INFORMATION)) == sizeof(MEMORY_BASIC_INFORMATION)) { @@ -98,7 +97,7 @@ void plDispatchLog::LogStatusBarChange(const char* name, const char* action) #endif // HS_BUILD_FOR_WIN32 } -void plDispatchLog::LogLongReceive(const char* keyname, const char* className, UInt32 clonePlayerID, plMessage* msg, float ms) +void plDispatchLog::LogLongReceive(const char* keyname, const char* className, uint32_t clonePlayerID, plMessage* msg, float ms) { std::string info; if (DumpSpecificMsgInfo(msg, info)) @@ -107,7 +106,7 @@ void plDispatchLog::LogLongReceive(const char* keyname, const char* className, U fLog->AddLineF("%-30s[%7u](%-20s) took %6.1f ms to receive %s\n", keyname, clonePlayerID, className, ms, msg->ClassName()); } -void plDispatchLog::DumpMsg(plMessage* msg, int numReceivers, int sendTimeMs, Int32 indent) +void plDispatchLog::DumpMsg(plMessage* msg, int numReceivers, int sendTimeMs, int32_t indent) { if (!msg) return; @@ -120,8 +119,8 @@ void plDispatchLog::DumpMsg(plMessage* msg, int numReceivers, int sendTimeMs, In // it's an include list and we didn't find it return; - static hsScalar lastTime=0; - hsScalar curTime = (hsScalar)hsTimer::GetSysSeconds(); + static float lastTime=0; + float curTime = (float)hsTimer::GetSysSeconds(); if (lastTime!=curTime) { @@ -146,7 +145,7 @@ void plDispatchLog::DumpMsg(plMessage* msg, int numReceivers, int sendTimeMs, In lastTime=curTime; } -void plDispatchLog::AddFilterType(UInt16 hClass) +void plDispatchLog::AddFilterType(uint16_t hClass) { if (hClass>=plFactory::GetNumClasses()) return; @@ -159,13 +158,13 @@ void plDispatchLog::AddFilterType(UInt16 hClass) } } -void plDispatchLog::AddFilterExactType(UInt16 type) +void plDispatchLog::AddFilterExactType(uint16_t type) { if (type=plFactory::GetNumClasses()) return; @@ -178,7 +177,7 @@ void plDispatchLog::RemoveFilterType(UInt16 hClass) } } -void plDispatchLog::RemoveFilterExactType(UInt16 type) +void plDispatchLog::RemoveFilterExactType(uint16_t type) { if (type 1 ) @@ -167,7 +167,7 @@ PF_CONSOLE_CMD( Game, LoadDialog, "string dlgName", "Loads the given GUI dialog plKey mgrKey = hsgResMgr::ResMgr()->FindKey( lu ); if( mgrKey ) { - pfGameGUIMsg *msg = TRACKED_NEW pfGameGUIMsg( mgrKey, pfGameGUIMsg::kLoadDialog ); + pfGameGUIMsg *msg = new pfGameGUIMsg( mgrKey, pfGameGUIMsg::kLoadDialog ); msg->SetString( params[ 0 ] ); plgDispatch::MsgSend( msg ); } @@ -179,7 +179,7 @@ PF_CONSOLE_CMD( Game, LoadLocalDialog, "string ageName, string dlgName", "Loads plKey mgrKey = hsgResMgr::ResMgr()->FindKey( lu ); if( mgrKey ) { - pfGameGUIMsg *msg = TRACKED_NEW pfGameGUIMsg( mgrKey, pfGameGUIMsg::kLoadDialog ); + pfGameGUIMsg *msg = new pfGameGUIMsg( mgrKey, pfGameGUIMsg::kLoadDialog ); msg->SetString( params[ 1 ] ); msg->SetAge( params[ 0 ] ); plgDispatch::MsgSend( msg ); @@ -192,7 +192,7 @@ PF_CONSOLE_CMD( Game, ShowDialog, "string dlgName", "Shows the given GUI dialog" plKey mgrKey = hsgResMgr::ResMgr()->FindKey( lu ); if( mgrKey ) { - pfGameGUIMsg *msg = TRACKED_NEW pfGameGUIMsg( mgrKey, pfGameGUIMsg::kShowDialog ); + pfGameGUIMsg *msg = new pfGameGUIMsg( mgrKey, pfGameGUIMsg::kShowDialog ); msg->SetString( params[ 0 ] ); plgDispatch::MsgSend( msg ); } @@ -204,7 +204,7 @@ PF_CONSOLE_CMD( Game, HideDialog, "string dlgName", "Hides the given GUI dialog" plKey mgrKey = hsgResMgr::ResMgr()->FindKey( lu ); if( mgrKey ) { - pfGameGUIMsg *msg = TRACKED_NEW pfGameGUIMsg( mgrKey, pfGameGUIMsg::kHideDialog ); + pfGameGUIMsg *msg = new pfGameGUIMsg( mgrKey, pfGameGUIMsg::kHideDialog ); msg->SetString( params[ 0 ] ); plgDispatch::MsgSend( msg ); } @@ -218,11 +218,11 @@ PF_CONSOLE_CMD( Game, SwitchDialog, "string olddlgName, string newdlgName", "Hid plKey mgrKey = hsgResMgr::ResMgr()->FindKey( lu ); if( mgrKey ) { - pfGameGUIMsg *msg = TRACKED_NEW pfGameGUIMsg( mgrKey, pfGameGUIMsg::kHideDialog ); + pfGameGUIMsg *msg = new pfGameGUIMsg( mgrKey, pfGameGUIMsg::kHideDialog ); msg->SetString( params[ 0 ] ); plgDispatch::MsgSend( msg ); - pfGameGUIMsg *msg2 = TRACKED_NEW pfGameGUIMsg( mgrKey, pfGameGUIMsg::kShowDialog ); + pfGameGUIMsg *msg2 = new pfGameGUIMsg( mgrKey, pfGameGUIMsg::kShowDialog ); msg2->SetString( params[ 1 ] ); plgDispatch::MsgSend( msg2 ); } @@ -275,116 +275,116 @@ PF_CONSOLE_CMD( Game_GUI, CreateDialog, "string name", "" ) PF_CONSOLE_CMD( Game, EnterChatMode, "", "Enters in-game chat mode" ) { - pfKIMsg* msg = TRACKED_NEW pfKIMsg(pfKIMsg::kEnterChatMode); + pfKIMsg* msg = new pfKIMsg(pfKIMsg::kEnterChatMode); plgDispatch::MsgSend( msg ); } PF_CONSOLE_CMD( Game, KIToggleMini, "", "Toggle between mini and big KI" ) { - pfKIMsg* msg = TRACKED_NEW pfKIMsg(pfKIMsg::kMiniBigKIToggle); + pfKIMsg* msg = new pfKIMsg(pfKIMsg::kMiniBigKIToggle); plgDispatch::MsgSend( msg ); } PF_CONSOLE_CMD( Game, KIPutAway, "", "Put KI completely away" ) { - pfKIMsg* msg = TRACKED_NEW pfKIMsg(pfKIMsg::kKIPutAway); + pfKIMsg* msg = new pfKIMsg(pfKIMsg::kKIPutAway); plgDispatch::MsgSend( msg ); } PF_CONSOLE_CMD( Game, KIChatPageUp, "", "Scroll chat display one page up" ) { - pfKIMsg* msg = TRACKED_NEW pfKIMsg(pfKIMsg::kChatAreaPageUp); + pfKIMsg* msg = new pfKIMsg(pfKIMsg::kChatAreaPageUp); plgDispatch::MsgSend( msg ); } PF_CONSOLE_CMD( Game, KIChatPageDown, "", "Scroll chat display one page down" ) { - pfKIMsg* msg = TRACKED_NEW pfKIMsg(pfKIMsg::kChatAreaPageDown); + pfKIMsg* msg = new pfKIMsg(pfKIMsg::kChatAreaPageDown); plgDispatch::MsgSend( msg ); } PF_CONSOLE_CMD( Game, KIChatToStart, "", "Scroll chat display to top of buffer" ) { - pfKIMsg* msg = TRACKED_NEW pfKIMsg(pfKIMsg::kChatAreaGoToBegin); + pfKIMsg* msg = new pfKIMsg(pfKIMsg::kChatAreaGoToBegin); plgDispatch::MsgSend( msg ); } PF_CONSOLE_CMD( Game, KIChatToEnd, "", "Scroll chat display to bottom of buffer" ) { - pfKIMsg* msg = TRACKED_NEW pfKIMsg(pfKIMsg::kChatAreaGoToEnd); + pfKIMsg* msg = new pfKIMsg(pfKIMsg::kChatAreaGoToEnd); plgDispatch::MsgSend( msg ); } PF_CONSOLE_CMD( Game, KITakePicture, "", "Take picture with KI" ) { - pfKIMsg* msg = TRACKED_NEW pfKIMsg(pfKIMsg::kKITakePicture); + pfKIMsg* msg = new pfKIMsg(pfKIMsg::kKITakePicture); plgDispatch::MsgSend( msg ); } PF_CONSOLE_CMD( Game, KICreateJournal, "", "Create journal note entry" ) { - pfKIMsg* msg = TRACKED_NEW pfKIMsg(pfKIMsg::kKICreateJournalNote); + pfKIMsg* msg = new pfKIMsg(pfKIMsg::kKICreateJournalNote); plgDispatch::MsgSend( msg ); } PF_CONSOLE_CMD( Game, KIChatToggleFaded, "", "Toggle fade of chat display" ) { - pfKIMsg* msg = TRACKED_NEW pfKIMsg(pfKIMsg::kKIToggleFade); + pfKIMsg* msg = new pfKIMsg(pfKIMsg::kKIToggleFade); plgDispatch::MsgSend( msg ); } PF_CONSOLE_CMD( Game, KIChatToggleFadeEnable, "", "Toggle enable of chat fade" ) { - pfKIMsg* msg = TRACKED_NEW pfKIMsg(pfKIMsg::kKIToggleFadeEnable); + pfKIMsg* msg = new pfKIMsg(pfKIMsg::kKIToggleFadeEnable); plgDispatch::MsgSend( msg ); } PF_CONSOLE_CMD( Game, KIUpSizeFont, "", "Up size the KI font (chatarea)" ) { - pfKIMsg* msg = TRACKED_NEW pfKIMsg(pfKIMsg::kKIUpSizeFont); + pfKIMsg* msg = new pfKIMsg(pfKIMsg::kKIUpSizeFont); plgDispatch::MsgSend( msg ); } PF_CONSOLE_CMD( Game, KIDownSizeFont, "", "Down size the KI font (chatarea)" ) { - pfKIMsg* msg = TRACKED_NEW pfKIMsg(pfKIMsg::kKIDownSizeFont); + pfKIMsg* msg = new pfKIMsg(pfKIMsg::kKIDownSizeFont); plgDispatch::MsgSend( msg ); } PF_CONSOLE_CMD( Game, KIOpenYeeshaBook, "", "Open the player's Yeesha book" ) { - pfKIMsg* msg = TRACKED_NEW pfKIMsg(pfKIMsg::kKIOpenYeehsaBook); + pfKIMsg* msg = new pfKIMsg(pfKIMsg::kKIOpenYeehsaBook); plgDispatch::MsgSend( msg ); } PF_CONSOLE_CMD( Game, KIOpenKI, "", "Open the KI a little at a time" ) { - pfKIMsg* msg = TRACKED_NEW pfKIMsg(pfKIMsg::kKIOpenKI); + pfKIMsg* msg = new pfKIMsg(pfKIMsg::kKIOpenKI); plgDispatch::MsgSend( msg ); } PF_CONSOLE_CMD( Game, KIHelp, "", "Open the CCR help dialog" ) { - pfKIMsg* msg = TRACKED_NEW pfKIMsg(pfKIMsg::kKIShowCCRHelp); + pfKIMsg* msg = new pfKIMsg(pfKIMsg::kKIShowCCRHelp); plgDispatch::MsgSend( msg ); } PF_CONSOLE_CMD( Game, KICreateMarker, "", "Create marker in the working marker folder" ) { - pfKIMsg* msg = TRACKED_NEW pfKIMsg(pfKIMsg::kKICreateMarker); + pfKIMsg* msg = new pfKIMsg(pfKIMsg::kKICreateMarker); plgDispatch::MsgSend( msg ); } PF_CONSOLE_CMD( Game, KICreateMarkerFolder, "", "Create marker folder in current Age's journal folder" ) { - pfKIMsg* msg = TRACKED_NEW pfKIMsg(pfKIMsg::kKICreateMarkerFolder); + pfKIMsg* msg = new pfKIMsg(pfKIMsg::kKICreateMarkerFolder); plgDispatch::MsgSend( msg ); } PF_CONSOLE_CMD( Game, SetChatFadeDelay, "float delayInSecs", "Sets the time in seconds before the chat text disappears" ) { // pfKI::GetInstance()->SetChatFadeDelay( params[ 0 ] ); - pfKIMsg* msg = TRACKED_NEW pfKIMsg(pfKIMsg::kSetChatFadeDelay); + pfKIMsg* msg = new pfKIMsg(pfKIMsg::kSetChatFadeDelay); msg->SetDelay( params[0] ); plgDispatch::MsgSend( msg ); } @@ -448,7 +448,7 @@ PF_CONSOLE_CMD( Game_Emote, Sit, "", "") PF_CONSOLE_CMD( Game, SetLocalClientAsAdmin, "bool enable", "Makes chat messages from this client appear as admin messages" ) { // pfKI::GetInstance()->SetTextChatAdminMode( (bool)params[ 0 ] ); - pfKIMsg* msg = TRACKED_NEW pfKIMsg(pfKIMsg::kSetTextChatAdminMode); + pfKIMsg* msg = new pfKIMsg(pfKIMsg::kSetTextChatAdminMode); msg->SetFlags( params[0] ? pfKIMsg::kAdminMsg : 0 ); plgDispatch::MsgSend( msg ); } diff --git a/Sources/Plasma/FeatureLib/pfConsoleCore/pfConsoleCmd.cpp b/Sources/Plasma/FeatureLib/pfConsoleCore/pfConsoleCmd.cpp index 53e6b30c..6dda99d0 100644 --- a/Sources/Plasma/FeatureLib/pfConsoleCore/pfConsoleCmd.cpp +++ b/Sources/Plasma/FeatureLib/pfConsoleCore/pfConsoleCmd.cpp @@ -46,7 +46,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com ////////////////////////////////////////////////////////////////////////////// #include "pfConsoleCmd.h" -#include "hsUtils.h" + ////////////////////////////////////////////////////////////////////////////// @@ -54,7 +54,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com ////////////////////////////////////////////////////////////////////////////// pfConsoleCmdGroup *pfConsoleCmdGroup::fBaseCmdGroup = nil; -UInt32 pfConsoleCmdGroup::fBaseCmdGroupRef = 0; +uint32_t pfConsoleCmdGroup::fBaseCmdGroupRef = 0; //// Constructor & Destructor //////////////////////////////////////////////// @@ -106,7 +106,7 @@ pfConsoleCmdGroup *pfConsoleCmdGroup::GetBaseGroup( void ) if( fBaseCmdGroup == nil ) { /// Initialize base group - fBaseCmdGroup = TRACKED_NEW pfConsoleCmdGroup( nil, nil ); + fBaseCmdGroup = new pfConsoleCmdGroup( nil, nil ); } return fBaseCmdGroup; @@ -164,7 +164,7 @@ pfConsoleCmd *pfConsoleCmdGroup::FindCommand( char *name ) // how many matches it skips before returning a match. (That way you can // cycle through matches by sending 1 + the last counter every time). -pfConsoleCmd *pfConsoleCmdGroup::FindNestedPartialCommand( char *name, UInt32 *counter ) +pfConsoleCmd *pfConsoleCmdGroup::FindNestedPartialCommand( char *name, uint32_t *counter ) { pfConsoleCmd *cmd; pfConsoleCmdGroup *group; @@ -226,7 +226,7 @@ pfConsoleCmdGroup *pfConsoleCmdGroup::FindSubGroupRecurse( const char *name ) static char seps[] = " ._"; - string = TRACKED_NEW char[ strlen( name ) + 1 ]; + string = new char[ strlen( name ) + 1 ]; hsAssert( string != nil, "Cannot allocate string in FindSubGroupRecurse()" ); strcpy( string, name ); @@ -249,7 +249,7 @@ pfConsoleCmdGroup *pfConsoleCmdGroup::FindSubGroupRecurse( const char *name ) //// FindCommandNoCase /////////////////////////////////////////////////////// // Case-insensitive version of FindCommand. -pfConsoleCmd *pfConsoleCmdGroup::FindCommandNoCase( char *name, UInt8 flags, pfConsoleCmd *start ) +pfConsoleCmd *pfConsoleCmdGroup::FindCommandNoCase( char *name, uint8_t flags, pfConsoleCmd *start ) { pfConsoleCmd *cmd; @@ -284,7 +284,7 @@ pfConsoleCmd *pfConsoleCmdGroup::FindCommandNoCase( char *name, UInt8 flags, //// FindSubGroupNoCase ////////////////////////////////////////////////////// -pfConsoleCmdGroup *pfConsoleCmdGroup::FindSubGroupNoCase( char *name, UInt8 flags, pfConsoleCmdGroup *start ) +pfConsoleCmdGroup *pfConsoleCmdGroup::FindSubGroupNoCase( char *name, uint8_t flags, pfConsoleCmdGroup *start ) { pfConsoleCmdGroup *group; @@ -464,7 +464,7 @@ void pfConsoleCmd::ICreateSignature(const char *paramList ) { if( strcmp( fSigTypes[ i ], tok ) == 0 ) { - fSignature.Push( (UInt8)i ); + fSignature.Push( (uint8_t)i ); break; } } @@ -509,7 +509,7 @@ void pfConsoleCmd::Unregister( void ) //// Execute ///////////////////////////////////////////////////////////////// // Run da thing! -void pfConsoleCmd::Execute( Int32 numParams, pfConsoleCmdParam *params, void (*PrintFn)( const char * ) ) +void pfConsoleCmd::Execute( int32_t numParams, pfConsoleCmdParam *params, void (*PrintFn)( const char * ) ) { fFunction( numParams, params, PrintFn ); } @@ -538,7 +538,7 @@ void pfConsoleCmd::Unlink( void ) //// GetSigEntry ///////////////////////////////////////////////////////////// -UInt8 pfConsoleCmd::GetSigEntry( UInt8 i ) +uint8_t pfConsoleCmd::GetSigEntry( uint8_t i ) { if( fSignature.GetCount() == 0 ) return kNone; diff --git a/Sources/Plasma/FeatureLib/pfConsoleCore/pfConsoleCmd.h b/Sources/Plasma/FeatureLib/pfConsoleCore/pfConsoleCmd.h index 96730054..47a39ec7 100644 --- a/Sources/Plasma/FeatureLib/pfConsoleCore/pfConsoleCmd.h +++ b/Sources/Plasma/FeatureLib/pfConsoleCore/pfConsoleCmd.h @@ -48,7 +48,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #ifndef _pfConsoleCmd_h #define _pfConsoleCmd_h -#include "hsTypes.h" +#include "HeadSpin.h" #include "hsBiExpander.h" @@ -63,7 +63,7 @@ class pfConsoleCmdGroup protected: static pfConsoleCmdGroup *fBaseCmdGroup; - static UInt32 fBaseCmdGroupRef; + static uint32_t fBaseCmdGroupRef; char fName[ 128 ]; @@ -97,11 +97,11 @@ class pfConsoleCmdGroup static pfConsoleCmdGroup *GetBaseGroup( void ); pfConsoleCmd *FindCommand( char *name ); - pfConsoleCmd *FindCommandNoCase( char *name, UInt8 flags = 0, pfConsoleCmd *start = nil ); - pfConsoleCmd *FindNestedPartialCommand( char *name, UInt32 *counter ); + pfConsoleCmd *FindCommandNoCase( char *name, uint8_t flags = 0, pfConsoleCmd *start = nil ); + pfConsoleCmd *FindNestedPartialCommand( char *name, uint32_t *counter ); pfConsoleCmdGroup *FindSubGroup( char *name ); - pfConsoleCmdGroup *FindSubGroupNoCase( char *name, UInt8 flags = 0, pfConsoleCmdGroup *start = nil ); + pfConsoleCmdGroup *FindSubGroupNoCase( char *name, uint8_t flags = 0, pfConsoleCmdGroup *start = nil ); pfConsoleCmd *GetFirstCommand( void ) { return fCommands; } pfConsoleCmdGroup *GetFirstSubGroup( void ) { return fSubGroups; } @@ -118,7 +118,7 @@ class pfConsoleCmdParam { protected: - UInt8 fType; + uint8_t fType; typedef char *CharPtr; @@ -156,7 +156,7 @@ class pfConsoleCmdParam operator const CharPtr() const { return IToString(); } operator char() const { return IToChar(); } - UInt8 GetType( void ) { return fType; } + uint8_t GetType( void ) { return fType; } void SetInt( int i ) { fValue.i = i; fType = kInt; } void SetFloat( float f ) { fValue.f = f; fType = kFloat; } @@ -169,7 +169,7 @@ class pfConsoleCmdParam //// pfConsoleCmd Class Definition /////////////////////////////////////////// -typedef void (*pfConsoleCmdPtr)( Int32 numParams, pfConsoleCmdParam *params, void (*PrintString)( const char * ) ); +typedef void (*pfConsoleCmdPtr)( int32_t numParams, pfConsoleCmdParam *params, void (*PrintString)( const char * ) ); class pfConsoleCmd { @@ -185,7 +185,7 @@ class pfConsoleCmd pfConsoleCmdGroup *fParentGroup; - hsExpander fSignature; + hsExpander fSignature; hsExpander fSigLabels; void ICreateSignature(const char *paramList ); @@ -213,7 +213,7 @@ class pfConsoleCmd void Register(const char *group, const char *name ); void Unregister(); - void Execute( Int32 numParams, pfConsoleCmdParam *params, void (*PrintFn)( const char * ) = nil ); + void Execute( int32_t numParams, pfConsoleCmdParam *params, void (*PrintFn)( const char * ) = nil ); void Link( pfConsoleCmd **prevPtr ); void Unlink( void ); @@ -225,7 +225,7 @@ class pfConsoleCmd pfConsoleCmdGroup *GetParent( void ) { return fParentGroup; } - UInt8 GetSigEntry( UInt8 i ); + uint8_t GetSigEntry( uint8_t i ); }; @@ -254,19 +254,19 @@ public: #define PF_CONSOLE_BASE_CMD( name, p, help ) \ - void pfConsoleCmd_##name##_proc( Int32 numParams, pfConsoleCmdParam *params, void (*PrintString)( const char * ) ); \ + void pfConsoleCmd_##name##_proc( int32_t numParams, pfConsoleCmdParam *params, void (*PrintString)( const char * ) ); \ pfConsoleCmd conCmd_##name( nil, #name, p, help, pfConsoleCmd_##name##_proc ); \ - void pfConsoleCmd_##name##_proc( Int32 numParams, pfConsoleCmdParam *params, void (*PrintString)( const char * ) ) + void pfConsoleCmd_##name##_proc( int32_t numParams, pfConsoleCmdParam *params, void (*PrintString)( const char * ) ) #define PF_CONSOLE_CMD( grp, name, p, help ) \ - void pfConsoleCmd_##grp##_##name##_proc( Int32 numParams, pfConsoleCmdParam *params, void (*PrintString)( const char * ) ); \ + void pfConsoleCmd_##grp##_##name##_proc( int32_t numParams, pfConsoleCmdParam *params, void (*PrintString)( const char * ) ); \ pfConsoleCmd conCmd_##grp##_##name( #grp, #name, p, help, pfConsoleCmd_##grp##_##name##_proc ); \ - void pfConsoleCmd_##grp##_##name##_proc( Int32 numParams, pfConsoleCmdParam *params, void (*PrintString)( const char * ) ) + void pfConsoleCmd_##grp##_##name##_proc( int32_t numParams, pfConsoleCmdParam *params, void (*PrintString)( const char * ) ) #define PF_LOCAL_CONSOLE_CMD( grp, name, p, help ) \ - void pfConsoleCmd_##grp##_##name##_proc( Int32 numParams, pfConsoleCmdParam *params, void (*PrintString)( const char * ) ); \ + void pfConsoleCmd_##grp##_##name##_proc( int32_t numParams, pfConsoleCmdParam *params, void (*PrintString)( const char * ) ); \ pfConsoleCmd conCmd_##grp##_##name( #grp, #name, p, help, pfConsoleCmd_##grp##_##name##_proc, true ); \ - void pfConsoleCmd_##grp##_##name##_proc( Int32 numParams, pfConsoleCmdParam *params, void (*PrintString)( const char * ) ) + void pfConsoleCmd_##grp##_##name##_proc( int32_t numParams, pfConsoleCmdParam *params, void (*PrintString)( const char * ) ) //// pfConsoleCmdGroup Creation Macro //////////////////////////////////////// diff --git a/Sources/Plasma/FeatureLib/pfConsoleCore/pfConsoleContext.cpp b/Sources/Plasma/FeatureLib/pfConsoleCore/pfConsoleContext.cpp index d4eddadd..3b529f72 100644 --- a/Sources/Plasma/FeatureLib/pfConsoleCore/pfConsoleContext.cpp +++ b/Sources/Plasma/FeatureLib/pfConsoleCore/pfConsoleContext.cpp @@ -45,7 +45,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // // ////////////////////////////////////////////////////////////////////////////// -#include "hsTypes.h" +#include "HeadSpin.h" #include "pfConsoleContext.h" @@ -76,7 +76,7 @@ pfConsoleContext::~pfConsoleContext() void pfConsoleContext::Clear( void ) { - Int32 idx; + int32_t idx; for( idx = fVarValues.GetCount() - 1; idx >= 0; idx-- ) @@ -85,13 +85,13 @@ void pfConsoleContext::Clear( void ) //// Getters ///////////////////////////////////////////////////////////////// -UInt32 pfConsoleContext::GetNumVars( void ) const +uint32_t pfConsoleContext::GetNumVars( void ) const { hsAssert( fVarValues.GetCount() == fVarNames.GetCount(), "Mismatch in console var context arrays" ); return fVarValues.GetCount(); } -const char *pfConsoleContext::GetVarName( UInt32 idx ) const +const char *pfConsoleContext::GetVarName( uint32_t idx ) const { hsAssert( fVarValues.GetCount() == fVarNames.GetCount(), "Mismatch in console var context arrays" ); @@ -104,7 +104,7 @@ const char *pfConsoleContext::GetVarName( UInt32 idx ) const return fVarNames[ idx ]; } -pfConsoleCmdParam &pfConsoleContext::GetVarValue( UInt32 idx ) const +pfConsoleCmdParam &pfConsoleContext::GetVarValue( uint32_t idx ) const { hsAssert( fVarValues.GetCount() == fVarNames.GetCount(), "Mismatch in console var context arrays" ); hsAssert( idx < fVarValues.GetCount(), "GetVarValue() index out of range for console context" ); @@ -115,9 +115,9 @@ pfConsoleCmdParam &pfConsoleContext::GetVarValue( UInt32 idx ) const //// FindVar ///////////////////////////////////////////////////////////////// -Int32 pfConsoleContext::FindVar( const char *name ) const +int32_t pfConsoleContext::FindVar( const char *name ) const { - UInt32 idx; + uint32_t idx; hsAssert( fVarValues.GetCount() == fVarNames.GetCount(), "Mismatch in console var context arrays" ); @@ -126,7 +126,7 @@ Int32 pfConsoleContext::FindVar( const char *name ) const { if( stricmp( name, fVarNames[ idx ] ) == 0 ) { - return (Int32)idx; + return (int32_t)idx; } } @@ -135,7 +135,7 @@ Int32 pfConsoleContext::FindVar( const char *name ) const //// RemoveVar /////////////////////////////////////////////////////////////// -void pfConsoleContext::RemoveVar( UInt32 idx ) +void pfConsoleContext::RemoveVar( uint32_t idx ) { hsAssert( fVarValues.GetCount() == fVarNames.GetCount(), "Mismatch in console var context arrays" ); @@ -162,14 +162,14 @@ void pfConsoleContext::IAddVar( const char *name, const pfConsoleCmdParam &va fVarValues.Append( value ); // Remember, params won't know any better, since by default they don't own a copy of their string - UInt32 idx = fVarValues.GetCount() - 1; + uint32_t idx = fVarValues.GetCount() - 1; if( fVarValues[ idx ].GetType() == pfConsoleCmdParam::kString ) fVarValues[ idx ].SetString( hsStrcpy( fVarValues[ idx ] ) ); } void pfConsoleContext::AddVar( const char *name, const pfConsoleCmdParam &value ) { - Int32 idx = FindVar( name ); + int32_t idx = FindVar( name ); if( idx != -1 ) { hsAssert( false, "AddVar() failed because variable already in console context" ); @@ -216,7 +216,7 @@ void pfConsoleContext::AddVar( const char *name, bool value ) //// SetVar Variants ///////////////////////////////////////////////////////// -hsBool pfConsoleContext::SetVar( UInt32 idx, const pfConsoleCmdParam &value ) +hsBool pfConsoleContext::SetVar( uint32_t idx, const pfConsoleCmdParam &value ) { hsAssert( fVarValues.GetCount() == fVarNames.GetCount(), "Mismatch in console var context arrays" ); if( idx >= fVarValues.GetCount() ) @@ -240,7 +240,7 @@ hsBool pfConsoleContext::SetVar( UInt32 idx, const pfConsoleCmdParam &value ) hsBool pfConsoleContext::SetVar( const char *name, const pfConsoleCmdParam &value ) { - Int32 idx = FindVar( name ); + int32_t idx = FindVar( name ); if( idx == -1 ) { if( fAddWhenNotFound ) diff --git a/Sources/Plasma/FeatureLib/pfConsoleCore/pfConsoleContext.h b/Sources/Plasma/FeatureLib/pfConsoleCore/pfConsoleContext.h index 9b5f68e1..3aa42d1a 100644 --- a/Sources/Plasma/FeatureLib/pfConsoleCore/pfConsoleContext.h +++ b/Sources/Plasma/FeatureLib/pfConsoleCore/pfConsoleContext.h @@ -48,7 +48,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #ifndef _pfConsoleContext_h #define _pfConsoleContext_h -#include "hsTypes.h" +#include "HeadSpin.h" #include "pfConsoleCmd.h" @@ -76,12 +76,12 @@ class pfConsoleContext void Clear( void ); - UInt32 GetNumVars( void ) const; - const char *GetVarName( UInt32 idx ) const; - pfConsoleCmdParam &GetVarValue( UInt32 idx ) const; + uint32_t GetNumVars( void ) const; + const char *GetVarName( uint32_t idx ) const; + pfConsoleCmdParam &GetVarValue( uint32_t idx ) const; - Int32 FindVar( const char *name ) const; - void RemoveVar( UInt32 idx ); + int32_t FindVar( const char *name ) const; + void RemoveVar( uint32_t idx ); void AddVar( const char *name, const pfConsoleCmdParam &value ); void AddVar( const char *name, int value ); @@ -90,7 +90,7 @@ class pfConsoleContext void AddVar( const char *name, char value ); void AddVar( const char *name, bool value ); - hsBool SetVar( UInt32 idx, const pfConsoleCmdParam &value ); + hsBool SetVar( uint32_t idx, const pfConsoleCmdParam &value ); hsBool SetVar( const char *name, const pfConsoleCmdParam &value ); hsBool SetVar( const char *name, int value ); diff --git a/Sources/Plasma/FeatureLib/pfConsoleCore/pfConsoleEngine.cpp b/Sources/Plasma/FeatureLib/pfConsoleCore/pfConsoleEngine.cpp index f6327987..83bbe486 100644 --- a/Sources/Plasma/FeatureLib/pfConsoleCore/pfConsoleEngine.cpp +++ b/Sources/Plasma/FeatureLib/pfConsoleCore/pfConsoleEngine.cpp @@ -52,7 +52,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "plFile/plEncryptedStream.h" -const Int32 pfConsoleEngine::fMaxNumParams = 16; +const int32_t pfConsoleEngine::fMaxNumParams = 16; static const char kTokenSeparators[] = " =\r\n\t,"; static const char kTokenGrpSeps[] = " =\r\n._\t,"; @@ -125,7 +125,7 @@ hsBool pfConsoleEngine::PrintCmdHelp( char *name, void (*PrintFn)( const char * char *ptr; static char string[ 512 ]; static char tempString[ 512 ]; - UInt32 i; + uint32_t i; /// Scan for subgroups. This can be an empty loop @@ -249,13 +249,13 @@ void DummyPrintFn( const char *line ) hsBool pfConsoleEngine::ExecuteFile( const char *fileName ) { - wchar* wFilename = hsStringToWString(fileName); + wchar_t* wFilename = hsStringToWString(fileName); hsBool ret = ExecuteFile(wFilename); delete [] wFilename; return ret; } -hsBool pfConsoleEngine::ExecuteFile( const wchar *fileName ) +hsBool pfConsoleEngine::ExecuteFile( const wchar_t *fileName ) { char string[ 512 ]; int line; @@ -302,7 +302,7 @@ hsBool pfConsoleEngine::RunCommand( char *line, void (*PrintFn)( const char * ) { pfConsoleCmd *cmd; pfConsoleCmdGroup *group, *subGrp; - Int32 numParams, i, numQuotedParams = 0; + int32_t numParams, i, numQuotedParams = 0; pfConsoleCmdParam paramArray[ fMaxNumParams + 1 ]; char *ptr; hsBool valid = true; @@ -360,7 +360,7 @@ hsBool pfConsoleEngine::RunCommand( char *line, void (*PrintFn)( const char * ) pfConsoleContext &context = pfConsoleContext::GetRootContext(); // Potential variable, see if we can find it - Int32 idx = context.FindVar( ptr + 1 ); + int32_t idx = context.FindVar( ptr + 1 ); if( idx == -1 ) { ISetErrorMsg( "Invalid console variable name" ); @@ -375,13 +375,13 @@ hsBool pfConsoleEngine::RunCommand( char *line, void (*PrintFn)( const char * ) } if( !valid ) - valid = IConvertToParam( cmd->GetSigEntry( (UInt8)numParams ), ptr, ¶mArray[ numParams ] ); + valid = IConvertToParam( cmd->GetSigEntry( (uint8_t)numParams ), ptr, ¶mArray[ numParams ] ); } for( i = numParams; i < fMaxNumParams + 1; i++ ) paramArray[ i ].SetNone(); - if( !valid || ( cmd->GetSigEntry( (UInt8)numParams ) != pfConsoleCmd::kAny && - cmd->GetSigEntry( (UInt8)numParams ) != pfConsoleCmd::kNone ) ) + if( !valid || ( cmd->GetSigEntry( (uint8_t)numParams ) != pfConsoleCmd::kAny && + cmd->GetSigEntry( (uint8_t)numParams ) != pfConsoleCmd::kNone ) ) { // Print help string and return static char string[ 512 ]; @@ -402,7 +402,7 @@ hsBool pfConsoleEngine::RunCommand( char *line, void (*PrintFn)( const char * ) // Converts a null-terminated string representing a parameter to a // pfConsoleCmdParam argument. -hsBool pfConsoleEngine::IConvertToParam( UInt8 type, char *string, pfConsoleCmdParam *param ) +hsBool pfConsoleEngine::IConvertToParam( uint8_t type, char *string, pfConsoleCmdParam *param ) { char *c, expChars[] = "dDeE+-."; hsBool hasDecimal = false, hasLetters = false; @@ -561,7 +561,7 @@ hsBool pfConsoleEngine::FindPartialCmd( char *line, hsBool findAgain, hsBool pr // groups. numToSkip specifies how many matches to skip before returning one // (so if numToSkip = 1, then this will return the second match found). -hsBool pfConsoleEngine::FindNestedPartialCmd( char *line, UInt32 numToSkip, hsBool preserveParams ) +hsBool pfConsoleEngine::FindNestedPartialCmd( char *line, uint32_t numToSkip, hsBool preserveParams ) { pfConsoleCmd *cmd; diff --git a/Sources/Plasma/FeatureLib/pfConsoleCore/pfConsoleEngine.h b/Sources/Plasma/FeatureLib/pfConsoleCore/pfConsoleEngine.h index 6872e9b0..e9595971 100644 --- a/Sources/Plasma/FeatureLib/pfConsoleCore/pfConsoleEngine.h +++ b/Sources/Plasma/FeatureLib/pfConsoleCore/pfConsoleEngine.h @@ -55,8 +55,8 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #ifndef _pfConsoleEngine_h #define _pfConsoleEngine_h -#include "hsTypes.h" -#include "hsUtils.h" +#include "HeadSpin.h" + //// pfConsoleEngine Class Definition //////////////////////////////////////// @@ -67,9 +67,9 @@ class pfConsoleEngine { private: - static const Int32 fMaxNumParams; + static const int32_t fMaxNumParams; - hsBool IConvertToParam( UInt8 type, char *string, pfConsoleCmdParam *param ); + hsBool IConvertToParam( uint8_t type, char *string, pfConsoleCmdParam *param ); char fErrorMsg[ 128 ]; char fLastErrorLine[ 512 ]; @@ -95,7 +95,7 @@ class pfConsoleEngine // Executes the given file as a sequence of console commands hsBool ExecuteFile( const char *fileName ); - hsBool ExecuteFile( const wchar *fileName ); + hsBool ExecuteFile( const wchar_t *fileName ); // Get the last reported error const char *GetErrorMsg( void ) { return fErrorMsg; } @@ -107,7 +107,7 @@ class pfConsoleEngine hsBool FindPartialCmd( char *line, hsBool findAgain = false, hsBool perserveParams = false ); // Does command completion without restrictions to any group, skipping the number of matches given - hsBool FindNestedPartialCmd( char *line, UInt32 numToSkip, hsBool perserveParams = false ); + hsBool FindNestedPartialCmd( char *line, uint32_t numToSkip, hsBool perserveParams = false ); }; diff --git a/Sources/Plasma/FeatureLib/pfConsoleCore/pfUtilBase64.cpp b/Sources/Plasma/FeatureLib/pfConsoleCore/pfUtilBase64.cpp index 9ab44714..0baaada5 100644 --- a/Sources/Plasma/FeatureLib/pfConsoleCore/pfUtilBase64.cpp +++ b/Sources/Plasma/FeatureLib/pfConsoleCore/pfUtilBase64.cpp @@ -93,7 +93,7 @@ static const char kFillchar = '='; //============================================================================ unsigned Base64Encode ( unsigned srcChars, - const byte srcData[], + const uint8_t srcData[], unsigned dstChars, char * dstData ) { @@ -102,7 +102,7 @@ unsigned Base64Encode ( ASSERT(dstData); const char * dstBase = dstData; - const byte * srcTerm = srcData + srcChars; + const uint8_t * srcTerm = srcData + srcChars; for (;;) switch (srcTerm - srcData) { case 0: *dstData++ = 0; @@ -139,17 +139,17 @@ unsigned Base64Decode ( unsigned srcChars, const char srcData[], unsigned dstChars, - byte * dstData + uint8_t * dstData ) { ASSERT(srcData); ASSERT(dstChars >= Base64DecodeSize(srcChars, srcData)); ASSERT(dstData); - const byte * dstBase = dstData; + const uint8_t * dstBase = dstData; const char * srcTerm = srcData + srcChars; while (srcTerm - srcData >= 4) { - *dstData++ = (byte) ( + *dstData++ = (uint8_t) ( (kDecode64[srcData[0]] << 2 & 0xfc) +(kDecode64[srcData[1]] >> 4 & 0x03) ); @@ -157,7 +157,7 @@ unsigned Base64Decode ( if (kDecode64[srcData[2]] == kTerminator) break; - *dstData++ = (byte) ( + *dstData++ = (uint8_t) ( (kDecode64[srcData[1]] << 4 & 0xf0) +(kDecode64[srcData[2]] >> 2 & 0x0f) ); @@ -165,7 +165,7 @@ unsigned Base64Decode ( if (kDecode64[srcData[3]] == kTerminator) break; - *dstData++ = (byte) ( + *dstData++ = (uint8_t) ( (kDecode64[srcData[2]] << 6 & 0xc0) +(kDecode64[srcData[3]]) ); diff --git a/Sources/Plasma/FeatureLib/pfConsoleCore/pfUtilBase64.h b/Sources/Plasma/FeatureLib/pfConsoleCore/pfUtilBase64.h index 2e560715..7c928489 100644 --- a/Sources/Plasma/FeatureLib/pfConsoleCore/pfUtilBase64.h +++ b/Sources/Plasma/FeatureLib/pfConsoleCore/pfUtilBase64.h @@ -43,7 +43,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #ifndef pfUtilBase64_inc #define pfUtilBase64_inc -#include "hsTypes.h" +#include "HeadSpin.h" /***************************************************************************** * @@ -60,7 +60,7 @@ inline unsigned Base64EncodeSize (unsigned srcChars) { } unsigned Base64Encode ( unsigned srcChars, - const byte srcData[], + const uint8_t srcData[], unsigned dstChars, char * dstData ); @@ -74,7 +74,7 @@ unsigned Base64Decode ( unsigned srcChars, const char srcData[], unsigned dstChars, - byte * dstData + uint8_t * dstData ); #endif //pnUtilBase64_inc diff --git a/Sources/Plasma/FeatureLib/pfCsrSrv/pfCsrSrv.cpp b/Sources/Plasma/FeatureLib/pfCsrSrv/pfCsrSrv.cpp index 50ab2d3a..bf222139 100644 --- a/Sources/Plasma/FeatureLib/pfCsrSrv/pfCsrSrv.cpp +++ b/Sources/Plasma/FeatureLib/pfCsrSrv/pfCsrSrv.cpp @@ -115,7 +115,7 @@ static bool QueryAccept ( SimpleNetConn * , const NetAddress & addr ) { - wchar str[64]; + wchar_t str[64]; NetAddressToString(addr, str, arrsize(str), kNetAddressFormatAll); LogMsg(kLogPerf, L"pfCsrSrv: Accepted connection from %s", str); return channel == kSimpleNetChannelCsr; diff --git a/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIButtonMod.cpp b/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIButtonMod.cpp index c3aa690b..5225d19d 100644 --- a/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIButtonMod.cpp +++ b/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIButtonMod.cpp @@ -45,7 +45,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // // ////////////////////////////////////////////////////////////////////////////// -#include "hsTypes.h" +#include "HeadSpin.h" #include "pfGUIButtonMod.h" #include "pfGUIDraggableMod.h" #include "pfGameGUIMgr.h" @@ -93,7 +93,7 @@ class pfGUIButtonDragProc : public pfGUICtrlProcObject fParent->StopDragging( false ); } - virtual void HandleExtendedEvent( pfGUIControlMod *ctrl, UInt32 event ) + virtual void HandleExtendedEvent( pfGUIControlMod *ctrl, uint32_t event ) { if( event == pfGUIDraggableMod::kDragging ) { @@ -113,7 +113,7 @@ class pfGUIButtonDragProc : public pfGUICtrlProcObject fOrigProc->HandleExtendedEvent( ctrl, event ); } - virtual void UserCallback( UInt32 userValue ) + virtual void UserCallback( uint32_t userValue ) { if( fOrigProc != nil ) fOrigProc->UserCallback( userValue ); @@ -142,7 +142,7 @@ void pfGUIButtonMod::StartDragging( void ) fOrigHandler = fDraggable->GetHandler(); fDraggable->SetVisible( true ); - fDraggable->SetHandler( TRACKED_NEW pfGUIButtonDragProc( this, fDraggable, fOrigHandler, fOrigReportedDrag ) ); + fDraggable->SetHandler( new pfGUIButtonDragProc( this, fDraggable, fOrigHandler, fOrigReportedDrag ) ); fDraggable->HandleMouseDown( fOrigMouseDownPt, 0 ); } @@ -169,7 +169,7 @@ pfGUIButtonMod::~pfGUIButtonMod() //// IEval /////////////////////////////////////////////////////////////////// -hsBool pfGUIButtonMod::IEval( double secs, hsScalar del, UInt32 dirty ) +hsBool pfGUIButtonMod::IEval( double secs, float del, uint32_t dirty ) { return pfGUIControlMod::IEval( secs, del, dirty ); } @@ -201,7 +201,7 @@ void pfGUIButtonMod::Read( hsStream *s, hsResMgr *mgr ) pfGUIControlMod::Read(s, mgr); fAnimationKeys.Reset(); - UInt32 i, count = s->ReadLE32(); + uint32_t i, count = s->ReadLE32(); for( i = 0; i < count; i++ ) fAnimationKeys.Append( mgr->ReadKey( s ) ); fAnimName = s->ReadSafeString(); @@ -213,14 +213,14 @@ void pfGUIButtonMod::Read( hsStream *s, hsResMgr *mgr ) fMouseOverAnimName = s->ReadSafeString(); fNotifyType = s->ReadLE32(); - mgr->ReadKeyNotifyMe( s, TRACKED_NEW plGenRefMsg( GetKey(), plRefMsg::kOnCreate, -1, kRefDraggable ), plRefFlags::kActiveRef ); + mgr->ReadKeyNotifyMe( s, new plGenRefMsg( GetKey(), plRefMsg::kOnCreate, -1, kRefDraggable ), plRefFlags::kActiveRef ); } void pfGUIButtonMod::Write( hsStream *s, hsResMgr *mgr ) { pfGUIControlMod::Write( s, mgr ); - UInt32 i, count = fAnimationKeys.GetCount(); + uint32_t i, count = fAnimationKeys.GetCount(); s->WriteLE32( count ); for( i = 0; i < count; i++ ) mgr->WriteKey( s, fAnimationKeys[ i ] ); @@ -249,12 +249,12 @@ void pfGUIButtonMod::UpdateBounds( hsMatrix44 *invXformMatrix, hsBool force ) //// HandleMouseDown/Up ////////////////////////////////////////////////////// -void pfGUIButtonMod::HandleMouseDown( hsPoint3 &mousePt, UInt8 modifiers ) +void pfGUIButtonMod::HandleMouseDown( hsPoint3 &mousePt, uint8_t modifiers ) { fClicking = true; if( fAnimationKeys.GetCount() > 0 ) { - plAnimCmdMsg *msg = TRACKED_NEW plAnimCmdMsg(); + plAnimCmdMsg *msg = new plAnimCmdMsg(); msg->SetCmd( plAnimCmdMsg::kContinue ); msg->SetCmd( plAnimCmdMsg::kSetForewards ); msg->SetCmd( plAnimCmdMsg::kGoToBegin ); @@ -274,7 +274,7 @@ void pfGUIButtonMod::HandleMouseDown( hsPoint3 &mousePt, UInt8 modifiers ) } } -void pfGUIButtonMod::HandleMouseUp( hsPoint3 &mousePt, UInt8 modifiers ) +void pfGUIButtonMod::HandleMouseUp( hsPoint3 &mousePt, uint8_t modifiers ) { // make sure that we got the down click first @@ -284,7 +284,7 @@ void pfGUIButtonMod::HandleMouseUp( hsPoint3 &mousePt, UInt8 modifiers ) fClicking = false; if( fAnimationKeys.GetCount() > 0 ) { - plAnimCmdMsg *msg = TRACKED_NEW plAnimCmdMsg(); + plAnimCmdMsg *msg = new plAnimCmdMsg(); msg->SetCmd( plAnimCmdMsg::kContinue ); msg->SetCmd( plAnimCmdMsg::kSetBackwards ); msg->SetCmd( plAnimCmdMsg::kGoToEnd ); @@ -305,7 +305,7 @@ void pfGUIButtonMod::HandleMouseUp( hsPoint3 &mousePt, UInt8 modifiers ) fTriggering = false; } -void pfGUIButtonMod::HandleMouseDrag( hsPoint3 &mousePt, UInt8 modifiers ) +void pfGUIButtonMod::HandleMouseDrag( hsPoint3 &mousePt, uint8_t modifiers ) { if( !fClicking ) return; @@ -327,12 +327,12 @@ void pfGUIButtonMod::HandleMouseDrag( hsPoint3 &mousePt, UInt8 modifiers ) } } -void pfGUIButtonMod::SetNotifyType(Int32 kind) +void pfGUIButtonMod::SetNotifyType(int32_t kind) { fNotifyType = kind; } -Int32 pfGUIButtonMod::GetNotifyType() +int32_t pfGUIButtonMod::GetNotifyType() { return fNotifyType; } @@ -351,7 +351,7 @@ void pfGUIButtonMod::SetInteresting( hsBool i ) if( fMouseOverAnimKeys.GetCount() ) { - plAnimCmdMsg *msg = TRACKED_NEW plAnimCmdMsg(); + plAnimCmdMsg *msg = new plAnimCmdMsg(); msg->SetCmd( plAnimCmdMsg::kContinue ); msg->SetCmd( fInteresting ? plAnimCmdMsg::kSetForewards : plAnimCmdMsg::kSetBackwards ); msg->SetAnimName( fMouseOverAnimName ); @@ -372,7 +372,7 @@ void pfGUIButtonMod::SetAnimationKeys( hsTArray &keys, const char *nam delete [] fAnimName; if( name != nil ) { - fAnimName = TRACKED_NEW char[ strlen( name ) + 1 ]; + fAnimName = new char[ strlen( name ) + 1 ]; strcpy( fAnimName, name ); } else @@ -385,7 +385,7 @@ void pfGUIButtonMod::SetMouseOverAnimKeys( hsTArray &keys, const char delete [] fMouseOverAnimName; if( name != nil ) { - fMouseOverAnimName = TRACKED_NEW char[ strlen( name ) + 1 ]; + fMouseOverAnimName = new char[ strlen( name ) + 1 ]; strcpy( fMouseOverAnimName, name ); } else @@ -395,7 +395,7 @@ void pfGUIButtonMod::SetMouseOverAnimKeys( hsTArray &keys, const char //// IGetDesiredCursor /////////////////////////////////////////////////////// -UInt32 pfGUIButtonMod::IGetDesiredCursor( void ) const +uint32_t pfGUIButtonMod::IGetDesiredCursor( void ) const { if( fHandler == nil ) return 0; diff --git a/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIButtonMod.h b/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIButtonMod.h index c175cff9..faed9a1e 100644 --- a/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIButtonMod.h +++ b/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIButtonMod.h @@ -74,11 +74,11 @@ class pfGUIButtonMod : public pfGUIControlMod hsBool fOrigReportedDrag; - Int32 fNotifyType; + int32_t fNotifyType; - virtual hsBool IEval( double secs, hsScalar del, UInt32 dirty ); // called only by owner object's Eval() + virtual hsBool IEval( double secs, float del, uint32_t dirty ); // called only by owner object's Eval() - virtual UInt32 IGetDesiredCursor( void ) const; // As specified in plInputInterface.h + virtual uint32_t IGetDesiredCursor( void ) const; // As specified in plInputInterface.h public: @@ -96,14 +96,14 @@ class pfGUIButtonMod : public pfGUIControlMod virtual void SetInteresting( hsBool i ); - virtual void HandleMouseDown( hsPoint3 &mousePt, UInt8 modifiers ); - virtual void HandleMouseUp( hsPoint3 &mousePt, UInt8 modifiers ); - virtual void HandleMouseDrag( hsPoint3 &mousePt, UInt8 modifiers ); + virtual void HandleMouseDown( hsPoint3 &mousePt, uint8_t modifiers ); + virtual void HandleMouseUp( hsPoint3 &mousePt, uint8_t modifiers ); + virtual void HandleMouseDrag( hsPoint3 &mousePt, uint8_t modifiers ); virtual void UpdateBounds( hsMatrix44 *invXformMatrix = nil, hsBool force = false ); - virtual void SetNotifyType(Int32 kind); - virtual Int32 GetNotifyType(); + virtual void SetNotifyType(int32_t kind); + virtual int32_t GetNotifyType(); virtual hsBool IsButtonDown(); virtual hsBool IsTriggering() { return fTriggering; } enum SoundEvents diff --git a/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUICheckBoxCtrl.cpp b/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUICheckBoxCtrl.cpp index 8e814cbf..ac43b99b 100644 --- a/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUICheckBoxCtrl.cpp +++ b/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUICheckBoxCtrl.cpp @@ -48,7 +48,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // // ////////////////////////////////////////////////////////////////////////////// -#include "hsTypes.h" +#include "HeadSpin.h" #include "pfGUICheckBoxCtrl.h" #include "pfGameGUIMgr.h" @@ -79,7 +79,7 @@ pfGUICheckBoxCtrl::~pfGUICheckBoxCtrl() //// IEval /////////////////////////////////////////////////////////////////// -hsBool pfGUICheckBoxCtrl::IEval( double secs, hsScalar del, UInt32 dirty ) +hsBool pfGUICheckBoxCtrl::IEval( double secs, float del, uint32_t dirty ) { return pfGUIControlMod::IEval( secs, del, dirty ); } @@ -98,7 +98,7 @@ void pfGUICheckBoxCtrl::Read( hsStream *s, hsResMgr *mgr ) pfGUIControlMod::Read(s, mgr); fAnimationKeys.Reset(); - UInt32 i, count = s->ReadLE32(); + uint32_t i, count = s->ReadLE32(); for( i = 0; i < count; i++ ) fAnimationKeys.Append( mgr->ReadKey( s ) ); @@ -110,7 +110,7 @@ void pfGUICheckBoxCtrl::Write( hsStream *s, hsResMgr *mgr ) { pfGUIControlMod::Write( s, mgr ); - UInt32 i, count = fAnimationKeys.GetCount(); + uint32_t i, count = fAnimationKeys.GetCount(); s->WriteLE32( count ); for( i = 0; i < count; i++ ) mgr->WriteKey( s, fAnimationKeys[ i ] ); @@ -130,14 +130,14 @@ void pfGUICheckBoxCtrl::UpdateBounds( hsMatrix44 *invXformMatrix, hsBool forc //// HandleMouseDown/Up ////////////////////////////////////////////////////// -void pfGUICheckBoxCtrl::HandleMouseDown( hsPoint3 &mousePt, UInt8 modifiers ) +void pfGUICheckBoxCtrl::HandleMouseDown( hsPoint3 &mousePt, uint8_t modifiers ) { fClicking = true; if(fPlaySound) IPlaySound( kMouseDown ); } -void pfGUICheckBoxCtrl::HandleMouseUp( hsPoint3 &mousePt, UInt8 modifiers ) +void pfGUICheckBoxCtrl::HandleMouseUp( hsPoint3 &mousePt, uint8_t modifiers ) { if( fClicking ) { @@ -162,7 +162,7 @@ void pfGUICheckBoxCtrl::SetChecked( hsBool checked, hsBool immediate /*= fals fChecked = checked; if( fAnimationKeys.GetCount() > 0 ) { - plAnimCmdMsg *msg = TRACKED_NEW plAnimCmdMsg(); + plAnimCmdMsg *msg = new plAnimCmdMsg(); if( fChecked ) { // Moving to true @@ -203,7 +203,7 @@ void pfGUICheckBoxCtrl::SetAnimationKeys( hsTArray &keys, const char * delete [] fAnimName; if( name != nil ) { - fAnimName = TRACKED_NEW char[ strlen( name ) + 1 ]; + fAnimName = new char[ strlen( name ) + 1 ]; strcpy( fAnimName, name ); } else @@ -212,7 +212,7 @@ void pfGUICheckBoxCtrl::SetAnimationKeys( hsTArray &keys, const char * //// IGetDesiredCursor /////////////////////////////////////////////////////// -UInt32 pfGUICheckBoxCtrl::IGetDesiredCursor( void ) const +uint32_t pfGUICheckBoxCtrl::IGetDesiredCursor( void ) const { if( fClicking ) return plInputInterface::kCursorClicked; diff --git a/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUICheckBoxCtrl.h b/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUICheckBoxCtrl.h index e5873964..c4c3e38e 100644 --- a/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUICheckBoxCtrl.h +++ b/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUICheckBoxCtrl.h @@ -65,9 +65,9 @@ class pfGUICheckBoxCtrl : public pfGUIControlMod hsBool fChecked; hsBool fPlaySound; - virtual hsBool IEval( double secs, hsScalar del, UInt32 dirty ); // called only by owner object's Eval() + virtual hsBool IEval( double secs, float del, uint32_t dirty ); // called only by owner object's Eval() - virtual UInt32 IGetDesiredCursor( void ) const; // As specified in plInputInterface.h + virtual uint32_t IGetDesiredCursor( void ) const; // As specified in plInputInterface.h public: @@ -83,8 +83,8 @@ class pfGUICheckBoxCtrl : public pfGUIControlMod virtual void Read( hsStream* s, hsResMgr* mgr ); virtual void Write( hsStream* s, hsResMgr* mgr ); - virtual void HandleMouseDown( hsPoint3 &mousePt, UInt8 modifiers ); - virtual void HandleMouseUp( hsPoint3 &mousePt, UInt8 modifiers ); + virtual void HandleMouseDown( hsPoint3 &mousePt, uint8_t modifiers ); + virtual void HandleMouseUp( hsPoint3 &mousePt, uint8_t modifiers ); virtual void UpdateBounds( hsMatrix44 *invXformMatrix = nil, hsBool force = false ); diff --git a/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIClickMapCtrl.cpp b/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIClickMapCtrl.cpp index f334f1fd..b8991dd9 100644 --- a/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIClickMapCtrl.cpp +++ b/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIClickMapCtrl.cpp @@ -45,7 +45,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // // ////////////////////////////////////////////////////////////////////////////// -#include "hsTypes.h" +#include "HeadSpin.h" #include "pfGUIClickMapCtrl.h" #include "pfGameGUIMgr.h" #include "pfGUIDialogMod.h" @@ -72,7 +72,7 @@ pfGUIClickMapCtrl::~pfGUIClickMapCtrl() //// IEval /////////////////////////////////////////////////////////////////// -hsBool pfGUIClickMapCtrl::IEval( double secs, hsScalar del, UInt32 dirty ) +hsBool pfGUIClickMapCtrl::IEval( double secs, float del, uint32_t dirty ) { return pfGUIControlMod::IEval( secs, del, dirty ); } @@ -96,14 +96,14 @@ void pfGUIClickMapCtrl::Write( hsStream *s, hsResMgr *mgr ) pfGUIControlMod::Write( s, mgr ); } -void pfGUIClickMapCtrl::HandleMouseDown( hsPoint3 &mousePt, UInt8 modifiers ) +void pfGUIClickMapCtrl::HandleMouseDown( hsPoint3 &mousePt, uint8_t modifiers ) { IScreenToLocalPt( mousePt ); fLastMousePt = fLastMouseDragPt = mousePt; fTracking = true; } -void pfGUIClickMapCtrl::HandleMouseUp( hsPoint3 &mousePt, UInt8 modifiers ) +void pfGUIClickMapCtrl::HandleMouseUp( hsPoint3 &mousePt, uint8_t modifiers ) { if( fTracking ) { @@ -114,7 +114,7 @@ void pfGUIClickMapCtrl::HandleMouseUp( hsPoint3 &mousePt, UInt8 modifiers ) } } -void pfGUIClickMapCtrl::HandleMouseDrag( hsPoint3 &mousePt, UInt8 modifiers ) +void pfGUIClickMapCtrl::HandleMouseDrag( hsPoint3 &mousePt, uint8_t modifiers ) { if( fTracking ) { @@ -125,7 +125,7 @@ void pfGUIClickMapCtrl::HandleMouseDrag( hsPoint3 &mousePt, UInt8 modifiers ) } } -void pfGUIClickMapCtrl::HandleMouseHover( hsPoint3 &mousePt, UInt8 modifiers ) +void pfGUIClickMapCtrl::HandleMouseHover( hsPoint3 &mousePt, uint8_t modifiers ) { IScreenToLocalPt( mousePt ); fLastMousePt = mousePt; @@ -136,10 +136,10 @@ void pfGUIClickMapCtrl::HandleMouseHover( hsPoint3 &mousePt, UInt8 modifiers //// IGetDesiredCursor /////////////////////////////////////////////////////// -UInt32 pfGUIClickMapCtrl::IGetDesiredCursor( void ) const +uint32_t pfGUIClickMapCtrl::IGetDesiredCursor( void ) const { if( fCustomCursor != -1 ) - return (UInt32)fCustomCursor; + return (uint32_t)fCustomCursor; return plInputInterface::kCursorPoised; } diff --git a/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIClickMapCtrl.h b/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIClickMapCtrl.h index 9593858a..d18d0dcb 100644 --- a/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIClickMapCtrl.h +++ b/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIClickMapCtrl.h @@ -58,11 +58,11 @@ class pfGUIClickMapCtrl : public pfGUIControlMod hsPoint3 fLastMousePt, fLastMouseUpPt, fLastMouseDragPt; hsBool fTracking; - Int32 fCustomCursor; + int32_t fCustomCursor; - virtual hsBool IEval( double secs, hsScalar del, UInt32 dirty ); // called only by owner object's Eval() + virtual hsBool IEval( double secs, float del, uint32_t dirty ); // called only by owner object's Eval() - virtual UInt32 IGetDesiredCursor( void ) const; // As specified in plInputInterface.h + virtual uint32_t IGetDesiredCursor( void ) const; // As specified in plInputInterface.h public: @@ -85,10 +85,10 @@ class pfGUIClickMapCtrl : public pfGUIControlMod kMouseHovered }; - virtual void HandleMouseDown( hsPoint3 &mousePt, UInt8 modifiers ); - virtual void HandleMouseUp( hsPoint3 &mousePt, UInt8 modifiers ); - virtual void HandleMouseDrag( hsPoint3 &mousePt, UInt8 modifiers ); - virtual void HandleMouseHover( hsPoint3 &mousePt, UInt8 modifiers ); + virtual void HandleMouseDown( hsPoint3 &mousePt, uint8_t modifiers ); + virtual void HandleMouseUp( hsPoint3 &mousePt, uint8_t modifiers ); + virtual void HandleMouseDrag( hsPoint3 &mousePt, uint8_t modifiers ); + virtual void HandleMouseHover( hsPoint3 &mousePt, uint8_t modifiers ); virtual hsBool MsgReceive( plMessage* pMsg ); @@ -99,7 +99,7 @@ class pfGUIClickMapCtrl : public pfGUIControlMod const hsPoint3 &GetLastMouseUpPt( void ) const { return fLastMouseUpPt; } const hsPoint3 &GetLastMouseDragPt( void ) const { return fLastMouseDragPt; } - void SetCustomCursor( Int32 cursor = -1 ) { fCustomCursor = cursor; } + void SetCustomCursor( int32_t cursor = -1 ) { fCustomCursor = cursor; } }; #endif // _pfGUIClickMapCtrl_h diff --git a/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIControlHandlers.cpp b/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIControlHandlers.cpp index b5b0ea97..41fd0600 100644 --- a/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIControlHandlers.cpp +++ b/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIControlHandlers.cpp @@ -45,7 +45,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // // ////////////////////////////////////////////////////////////////////////////// -#include "hsTypes.h" +#include "HeadSpin.h" #include "pfGUIControlHandlers.h" #include "pfGUIControlMod.h" #include "pfGUIDialogMod.h" @@ -72,20 +72,20 @@ pfGUICtrlProcWriteableObject *pfGUICtrlProcWriteableObject::Read( hsStream *s ) { pfGUICtrlProcWriteableObject *obj; - UInt32 type = s->ReadLE32(); + uint32_t type = s->ReadLE32(); switch( type ) { case kConsoleCmd: - obj = TRACKED_NEW pfGUIConsoleCmdProc; + obj = new pfGUIConsoleCmdProc; break; case kPythonScript: - obj = TRACKED_NEW pfGUIPythonScriptProc; + obj = new pfGUIPythonScriptProc; break; case kCloseDlg: - obj = TRACKED_NEW pfGUICloseDlgProc; + obj = new pfGUICloseDlgProc; break; case kNull: @@ -128,7 +128,7 @@ void pfGUIConsoleCmdProc::IRead( hsStream *s ) int i = s->ReadLE32(); if( i > 0 ) { - fCommand = TRACKED_NEW char[ i + 1 ]; + fCommand = new char[ i + 1 ]; memset( fCommand, 0, i + 1 ); s->Read( i, fCommand ); } @@ -151,7 +151,7 @@ void pfGUIConsoleCmdProc::DoSomething( pfGUIControlMod *ctrl ) { if( fCommand != nil ) { - plConsoleMsg *cMsg = TRACKED_NEW plConsoleMsg( plConsoleMsg::kExecuteLine, fCommand ); + plConsoleMsg *cMsg = new plConsoleMsg( plConsoleMsg::kExecuteLine, fCommand ); plgDispatch::MsgSend( cMsg ); } } @@ -164,7 +164,7 @@ void pfGUIConsoleCmdProc::SetCommand( const char *cmd ) fCommand = nil; else { - fCommand = TRACKED_NEW char[ strlen( cmd ) + 1 ]; + fCommand = new char[ strlen( cmd ) + 1 ]; memset( fCommand, 0, strlen( cmd ) + 1 ); strcpy( fCommand, cmd ); } diff --git a/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIControlHandlers.h b/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIControlHandlers.h index b0c72b01..50e85317 100644 --- a/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIControlHandlers.h +++ b/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIControlHandlers.h @@ -81,7 +81,7 @@ class pfGUICtrlProcObject { protected: - UInt32 fRefCnt; + uint32_t fRefCnt; public: @@ -90,9 +90,9 @@ class pfGUICtrlProcObject virtual void DoSomething( pfGUIControlMod *ctrl ) = 0; - virtual void HandleExtendedEvent( pfGUIControlMod *ctrl, UInt32 event ) { ; } + virtual void HandleExtendedEvent( pfGUIControlMod *ctrl, uint32_t event ) { ; } - virtual void UserCallback( UInt32 userValue ) { ; } + virtual void UserCallback( uint32_t userValue ) { ; } // ONLY THE GUI SYSTEM SHOULD CALL THESE void IncRef( void ) { fRefCnt++; } @@ -110,7 +110,7 @@ class pfGUICtrlProcWriteableObject : public pfGUICtrlProcObject { protected: - UInt32 fType; + uint32_t fType; virtual void IRead( hsStream *s ) = 0; virtual void IWrite( hsStream *s ) = 0; @@ -126,7 +126,7 @@ class pfGUICtrlProcWriteableObject : public pfGUICtrlProcObject }; pfGUICtrlProcWriteableObject() { fType = kNull; } - pfGUICtrlProcWriteableObject( UInt32 type ) : fType( type ) { ; } + pfGUICtrlProcWriteableObject( uint32_t type ) : fType( type ) { ; } virtual ~pfGUICtrlProcWriteableObject() { ; } virtual void DoSomething( pfGUIControlMod *ctrl ) = 0; diff --git a/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIControlMod.cpp b/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIControlMod.cpp index 3b4ace00..62eac475 100644 --- a/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIControlMod.cpp +++ b/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIControlMod.cpp @@ -45,7 +45,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // // ////////////////////////////////////////////////////////////////////////////// -#include "hsTypes.h" +#include "HeadSpin.h" #include "pfGUIControlMod.h" #include "pfGameGUIMgr.h" #include "pfGUIDialogMod.h" @@ -107,7 +107,7 @@ pfGUIColorScheme::pfGUIColorScheme( hsColorRGBA &foreColor, hsColorRGBA &backCol fBackColor = backColor; } -pfGUIColorScheme::pfGUIColorScheme( const char *face, UInt8 size, UInt8 fontFlags ) +pfGUIColorScheme::pfGUIColorScheme( const char *face, uint8_t size, uint8_t fontFlags ) { IReset(); fFontFace = hsStrcpy( face ); @@ -180,7 +180,7 @@ pfGUIControlMod::~pfGUIControlMod() //// IEval /////////////////////////////////////////////////////////////////// -hsBool pfGUIControlMod::IEval( double secs, hsScalar del, UInt32 dirty ) +hsBool pfGUIControlMod::IEval( double secs, float del, uint32_t dirty ) { // UpdateBounds(); return false; @@ -205,13 +205,13 @@ void pfGUIControlMod::SetTransform( const hsMatrix44 &l2w, const hsMatrix44 & //// GetVectorAngle ////////////////////////////////////////////////////////// -static hsScalar GetVectorAngle( const hsPoint3 &basePt, const hsPoint3 &pointA, const hsPoint3 &pointB ) +static float GetVectorAngle( const hsPoint3 &basePt, const hsPoint3 &pointA, const hsPoint3 &pointB ) { hsVector3 vectorA( &pointA, &basePt ), vectorB( &pointB, &basePt ); - hsScalar dot = vectorA * vectorB; + float dot = vectorA * vectorB; hsVector3 cross = vectorA % vectorB; - hsScalar crossLen = cross.fZ; + float crossLen = cross.fZ; return atan2( crossLen, dot ); } @@ -225,7 +225,7 @@ static hsScalar GetVectorAngle( const hsPoint3 &basePt, const hsPoint3 &pointA, static hsBool CreateConvexHull( hsPoint3 *inPoints, int &numPoints ) { int i, j, pointA, pointB, pointC; - hsScalar *angles; + float *angles; if( numPoints < 3 ) return false; @@ -246,7 +246,7 @@ static hsBool CreateConvexHull( hsPoint3 *inPoints, int &numPoints ) // Step 2: Sort all the in points by the angle to the X axis (vector <1,0>). // Step A: Calculate all the angles - angles = TRACKED_NEW hsScalar[ numPoints ]; + angles = new float[ numPoints ]; hsPoint3 xAxisPoint( avgPoint.fX + 1, avgPoint.fY, avgPoint.fZ ); for( i = 0; i < numPoints; i++ ) angles[ i ] = GetVectorAngle( avgPoint, inPoints[ i ], xAxisPoint ); @@ -258,7 +258,7 @@ static hsBool CreateConvexHull( hsPoint3 *inPoints, int &numPoints ) { if( angles[ j ] < angles[ i ] ) { - hsScalar tempAngle = angles[ j ]; + float tempAngle = angles[ j ]; angles[ j ] = angles[ i ]; angles[ i ] = tempAngle; @@ -283,12 +283,12 @@ static hsBool CreateConvexHull( hsPoint3 *inPoints, int &numPoints ) pointB += numPoints; // For points A, B, and C, find the interior angle between them - hsScalar angle = GetVectorAngle( inPoints[ pointB ], inPoints[ pointA ], inPoints[ pointC ] ); + float angle = GetVectorAngle( inPoints[ pointB ], inPoints[ pointA ], inPoints[ pointC ] ); // If the angle is < 180, then it's a good angle and we can advance all our points by 1... // Note: we have a tolerance so that we don't get points that form edges that are pretty darned close... - const hsScalar tolerance = hsScalarPI / 90.f; - if( angle > tolerance && angle < hsScalarPI - tolerance ) + const float tolerance = M_PI / 90.f; + if( angle > tolerance && angle < M_PI - tolerance ) { pointA++; pointB++; @@ -336,7 +336,7 @@ static void GetObjectPoints( plSceneObject *so, hsTArray &outPoints ) return; // The following uses mf's spiffy plAccessGeometry/Spans stuff, which, in - // one word, kicksAss. + // one uint16_t, kicksAss. hsTArray spans; plAccessGeometry::Instance()->OpenRO( di, spans ); @@ -526,7 +526,7 @@ void pfGUIControlMod::UpdateBounds( hsMatrix44 *invXformMatrix, hsBool force // Given the x/y coordinates in 0..1 space, recalcs the sceneObject position // and moves the object to match, retaining the stored fCenterZ coordinate -void pfGUIControlMod::SetObjectCenter( hsScalar x, hsScalar y ) +void pfGUIControlMod::SetObjectCenter( float x, float y ) { hsMatrix44 xformMatrix, l2p, p2l; hsPoint3 center, corners[ 8 ]; @@ -656,7 +656,7 @@ hsBool pfGUIControlMod::ISetUpDynTextMap( plPipeline *pipe ) if( fDynTextLayer == nil || fInitialBounds.GetType() == kBoundsUninitialized )//|| fDialog == nil ) return false; - UInt32 scrnWidth, scrnHeight; + uint32_t scrnWidth, scrnHeight; if( !HasFlag( kScaleTextWithResolution ) ) { // Scale so that there is a 1:1 pixel:textel ratio @@ -677,12 +677,12 @@ hsBool pfGUIControlMod::ISetUpDynTextMap( plPipeline *pipe ) } const hsBounds3 &bounds = fInitialBounds;//GetBounds(); - UInt16 width = (UInt16)(( bounds.GetMaxs().fX - bounds.GetMins().fX ) * scrnWidth); - UInt16 height = (UInt16)(( bounds.GetMaxs().fY - bounds.GetMins().fY ) * scrnHeight); + uint16_t width = (uint16_t)(( bounds.GetMaxs().fX - bounds.GetMins().fX ) * scrnWidth); + uint16_t height = (uint16_t)(( bounds.GetMaxs().fY - bounds.GetMins().fY ) * scrnHeight); // Allow derived controls to allocate some extra scratch space if desired // (Do it this way so we can pass in our current calculated dimensions for them to play with) - UInt16 extraW = width, extraH = height; + uint16_t extraW = width, extraH = height; IGrowDTMDimsToDesiredSize( extraW, extraH ); extraW -= width; extraH -= height; @@ -737,8 +737,8 @@ void pfGUIControlMod::SetColorScheme( pfGUIColorScheme *newScheme ) void pfGUIControlMod::SetDynTextMap( plLayerInterface *layer, plDynamicTextMap *dynText ) { - hsgResMgr::ResMgr()->AddViaNotify( layer->GetKey(), TRACKED_NEW plGenRefMsg( GetKey(), plRefMsg::kOnCreate, -1, pfGUIControlMod::kRefDynTextLayer ), plRefFlags::kActiveRef ); - hsgResMgr::ResMgr()->AddViaNotify( dynText->GetKey(), TRACKED_NEW plGenRefMsg( GetKey(), plRefMsg::kOnCreate, -1, pfGUIControlMod::kRefDynTextMap ), plRefFlags::kActiveRef ); + hsgResMgr::ResMgr()->AddViaNotify( layer->GetKey(), new plGenRefMsg( GetKey(), plRefMsg::kOnCreate, -1, pfGUIControlMod::kRefDynTextLayer ), plRefFlags::kActiveRef ); + hsgResMgr::ResMgr()->AddViaNotify( dynText->GetKey(), new plGenRefMsg( GetKey(), plRefMsg::kOnCreate, -1, pfGUIControlMod::kRefDynTextMap ), plRefFlags::kActiveRef ); } //// SetEnabled ////////////////////////////////////////////////////////////// @@ -788,7 +788,7 @@ void pfGUIControlMod::SetVisible( hsBool vis ) fVisible = vis; if (fTarget) { - plEnableMsg *msg = TRACKED_NEW plEnableMsg(); + plEnableMsg *msg = new plEnableMsg(); msg->SetCmd( fVisible ? plEnableMsg::kEnable : plEnableMsg::kDisable ); msg->SetCmd( plEnableMsg::kDrawable ); msg->AddReceiver( fTarget->GetKey() ); @@ -818,8 +818,8 @@ void pfGUIControlMod::Read( hsStream *s, hsResMgr *mgr ) // Read in the dynTextMap if there is one if( s->ReadBool() ) { - mgr->ReadKeyNotifyMe( s, TRACKED_NEW plGenRefMsg( GetKey(), plRefMsg::kOnCreate, -1, kRefDynTextLayer ), plRefFlags::kActiveRef ); - mgr->ReadKeyNotifyMe( s, TRACKED_NEW plGenRefMsg( GetKey(), plRefMsg::kOnCreate, -1, kRefDynTextMap ), plRefFlags::kActiveRef ); + mgr->ReadKeyNotifyMe( s, new plGenRefMsg( GetKey(), plRefMsg::kOnCreate, -1, kRefDynTextLayer ), plRefFlags::kActiveRef ); + mgr->ReadKeyNotifyMe( s, new plGenRefMsg( GetKey(), plRefMsg::kOnCreate, -1, kRefDynTextMap ), plRefFlags::kActiveRef ); } else { @@ -830,12 +830,12 @@ void pfGUIControlMod::Read( hsStream *s, hsResMgr *mgr ) if( s->ReadBool() ) { SetColorScheme( nil ); - fColorScheme = TRACKED_NEW pfGUIColorScheme(); + fColorScheme = new pfGUIColorScheme(); fColorScheme->Read( s ); } // Read in our sound indices - UInt8 i, count = s->ReadByte(); + uint8_t i, count = s->ReadByte(); if( count == 0 ) fSoundIndices.Reset(); else @@ -846,9 +846,9 @@ void pfGUIControlMod::Read( hsStream *s, hsResMgr *mgr ) } if( HasFlag( kHasProxy ) ) - mgr->ReadKeyNotifyMe( s, TRACKED_NEW plGenRefMsg( GetKey(), plRefMsg::kOnCreate, -1, kRefProxy ), plRefFlags::kActiveRef ); + mgr->ReadKeyNotifyMe( s, new plGenRefMsg( GetKey(), plRefMsg::kOnCreate, -1, kRefProxy ), plRefFlags::kActiveRef ); - mgr->ReadKeyNotifyMe( s, TRACKED_NEW plGenRefMsg( GetKey(), plRefMsg::kOnCreate, -1, kRefSkin ), plRefFlags::kActiveRef ); + mgr->ReadKeyNotifyMe( s, new plGenRefMsg( GetKey(), plRefMsg::kOnCreate, -1, kRefSkin ), plRefFlags::kActiveRef ); } void pfGUIControlMod::Write( hsStream *s, hsResMgr *mgr ) @@ -883,7 +883,7 @@ void pfGUIControlMod::Write( hsStream *s, hsResMgr *mgr ) // Write out our sound indices s->WriteByte( fSoundIndices.GetCount() ); - UInt8 i; + uint8_t i; for( i = 0; i < fSoundIndices.GetCount(); i++ ) s->WriteLE32( fSoundIndices[ i ] ); @@ -895,12 +895,12 @@ void pfGUIControlMod::Write( hsStream *s, hsResMgr *mgr ) //// HandleKeyPress/Event //////////////////////////////////////////////////// -hsBool pfGUIControlMod::HandleKeyPress( wchar_t key, UInt8 modifiers ) +hsBool pfGUIControlMod::HandleKeyPress( wchar_t key, uint8_t modifiers ) { return false; } -hsBool pfGUIControlMod::HandleKeyEvent( pfGameGUIMgr::EventType event, plKeyDef key, UInt8 modifiers ) +hsBool pfGUIControlMod::HandleKeyEvent( pfGameGUIMgr::EventType event, plKeyDef key, uint8_t modifiers ) { return false; } @@ -942,7 +942,7 @@ void pfGUIControlMod::DoSomething( void ) //// HandleExtendedEvent ///////////////////////////////////////////////////// -void pfGUIControlMod::HandleExtendedEvent( UInt32 event ) +void pfGUIControlMod::HandleExtendedEvent( uint32_t event ) { if( fEnabled && fHandler != nil ) fHandler->HandleExtendedEvent( this, event ); @@ -964,7 +964,7 @@ void pfGUIControlMod::SetDropTargetHdlr( pfGUIDropTargetProc *h ) // Associates the given GUI event with an index of a sound on the target SO's // audioInterface. The guiCtrlEvent is specific to each type of control. -void pfGUIControlMod::SetSoundIndex( UInt8 guiCtrlEvent, int soundIndex ) +void pfGUIControlMod::SetSoundIndex( uint8_t guiCtrlEvent, int soundIndex ) { if( fSoundIndices.GetCount() < guiCtrlEvent + 1 ) fSoundIndices.ExpandAndZero( guiCtrlEvent + 1 ); @@ -976,7 +976,7 @@ void pfGUIControlMod::SetSoundIndex( UInt8 guiCtrlEvent, int soundIndex ) // Sends a sound play message with the soundIndex associated with the given // event. -void pfGUIControlMod::IPlaySound( UInt8 guiCtrlEvent, hsBool loop /* = false */ ) +void pfGUIControlMod::IPlaySound( uint8_t guiCtrlEvent, hsBool loop /* = false */ ) { if( guiCtrlEvent >= fSoundIndices.GetCount() || fSoundIndices[ guiCtrlEvent ] == 0 ) return; @@ -984,7 +984,7 @@ void pfGUIControlMod::IPlaySound( UInt8 guiCtrlEvent, hsBool loop /* = false if( GetTarget() == nil || GetTarget()->GetAudioInterface() == nil ) return; - plSoundMsg *msg = TRACKED_NEW plSoundMsg; + plSoundMsg *msg = new plSoundMsg; msg->fIndex = fSoundIndices[ guiCtrlEvent ] - 1; msg->SetCmd( plSoundMsg::kGoToTime ); msg->fTime = 0.f; @@ -997,7 +997,7 @@ void pfGUIControlMod::IPlaySound( UInt8 guiCtrlEvent, hsBool loop /* = false msg->Send( GetTarget()->GetAudioInterface()->GetKey() ); } -void pfGUIControlMod::IStopSound(UInt8 guiCtrlEvent) +void pfGUIControlMod::IStopSound(uint8_t guiCtrlEvent) { if (guiCtrlEvent >= fSoundIndices.GetCount() || fSoundIndices[guiCtrlEvent] == 0) return; @@ -1005,7 +1005,7 @@ void pfGUIControlMod::IStopSound(UInt8 guiCtrlEvent) if (GetTarget() == nil || GetTarget()->GetAudioInterface() == nil ) return; - plSoundMsg *msg = TRACKED_NEW plSoundMsg; + plSoundMsg *msg = new plSoundMsg; msg->fIndex = fSoundIndices[guiCtrlEvent] - 1; msg->SetCmd(plSoundMsg::kStop); msg->Send(GetTarget()->GetAudioInterface()->GetKey()); diff --git a/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIControlMod.h b/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIControlMod.h index 318ce5d4..2a7f257d 100644 --- a/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIControlMod.h +++ b/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIControlMod.h @@ -75,8 +75,8 @@ class pfGUIColorScheme : public hsRefCnt hsBool fTransparent; char *fFontFace; - UInt8 fFontSize; - UInt8 fFontFlags; + uint8_t fFontSize; + uint8_t fFontFlags; enum FontFlags { @@ -88,7 +88,7 @@ class pfGUIColorScheme : public hsRefCnt pfGUIColorScheme(); ~pfGUIColorScheme(); pfGUIColorScheme( hsColorRGBA &foreColor, hsColorRGBA &backColor ); - pfGUIColorScheme( const char *face, UInt8 size, UInt8 fontFlags ); + pfGUIColorScheme( const char *face, uint8_t size, uint8_t fontFlags ); void SetFontFace( const char *face ); @@ -113,13 +113,13 @@ class pfGUIControlMod : public plSingleModifier protected: - UInt32 fTagID; + uint32_t fTagID; hsBool fEnabled, fFocused, fVisible, fInteresting; hsBool fNotifyOnInteresting; pfGUIDialogMod *fDialog; hsBounds3 fBounds, fInitialBounds; // Z component is 0-1 - hsScalar fScreenMinZ; // Closest Z coordinate in screen space + float fScreenMinZ; // Closest Z coordinate in screen space hsPoint3 fScreenCenter; hsBool fBoundsValid, fCenterValid; hsMatrix44 fXformMatrix; // Only used for doing drag work, etc. @@ -142,9 +142,9 @@ class pfGUIControlMod : public plSingleModifier hsBool ISetUpDynTextMap( plPipeline *pipe ); virtual void IPostSetUpDynTextMap( void ) {} - virtual void IGrowDTMDimsToDesiredSize( UInt16 &width, UInt16 &height ) { } + virtual void IGrowDTMDimsToDesiredSize( uint16_t &width, uint16_t &height ) { } - virtual hsBool IEval( double secs, hsScalar del, UInt32 dirty ); // called only by owner object's Eval() + virtual hsBool IEval( double secs, float del, uint32_t dirty ); // called only by owner object's Eval() void ISetDialog( pfGUIDialogMod *mod ) { fDialog = mod; } void IScreenToLocalPt( hsPoint3 &pt ); @@ -152,10 +152,10 @@ class pfGUIControlMod : public plSingleModifier virtual void IUpdate( void ) {;} void ISetHandler( pfGUICtrlProcObject *h, hsBool clearInheritFlag = false ); - void IPlaySound( UInt8 guiCtrlEvent, hsBool loop = false ); - void IStopSound( UInt8 guiCtrlEvent ); + void IPlaySound( uint8_t guiCtrlEvent, hsBool loop = false ); + void IStopSound( uint8_t guiCtrlEvent ); - virtual UInt32 IGetDesiredCursor( void ) const { return 0; } // As specified in plInputInterface.h + virtual uint32_t IGetDesiredCursor( void ) const { return 0; } // As specified in plInputInterface.h public: @@ -171,7 +171,7 @@ class pfGUIControlMod : public plSingleModifier virtual void Read( hsStream* s, hsResMgr* mgr ); virtual void Write( hsStream* s, hsResMgr* mgr ); - UInt32 GetTagID( void ) { return fTagID; } + uint32_t GetTagID( void ) { return fTagID; } virtual void SetEnabled( hsBool e ); virtual hsBool IsEnabled( void ) { return fEnabled; } @@ -190,9 +190,9 @@ class pfGUIControlMod : public plSingleModifier virtual void Refresh( void ); virtual void UpdateBounds( hsMatrix44 *invXformMatrix = nil, hsBool force = false ); - void SetObjectCenter( hsScalar x, hsScalar y ); + void SetObjectCenter( float x, float y ); virtual hsPoint3 GetObjectCenter() { return fScreenCenter; } - hsScalar GetScreenMinZ( void ) { return fScreenMinZ; } + float GetScreenMinZ( void ) { return fScreenMinZ; } void CalcInitialBounds( void ); const hsBounds3 &GetBounds( void ); @@ -203,18 +203,18 @@ class pfGUIControlMod : public plSingleModifier // Return false if you actually DON'T want the mouse clicked at this point (should only be used for non-rectangular region rejection) virtual hsBool FilterMousePosition( hsPoint3 &mousePt ) { return true; } - virtual void HandleMouseDown( hsPoint3 &mousePt, UInt8 modifiers ) {;} - virtual void HandleMouseUp( hsPoint3 &mousePt, UInt8 modifiers ) {;} - virtual void HandleMouseDrag( hsPoint3 &mousePt, UInt8 modifiers ) {;} - virtual void HandleMouseHover( hsPoint3 &mousePt, UInt8 modifiers ) {;} - virtual void HandleMouseDblClick( hsPoint3 &mousePt, UInt8 modifiers ) {;} + virtual void HandleMouseDown( hsPoint3 &mousePt, uint8_t modifiers ) {;} + virtual void HandleMouseUp( hsPoint3 &mousePt, uint8_t modifiers ) {;} + virtual void HandleMouseDrag( hsPoint3 &mousePt, uint8_t modifiers ) {;} + virtual void HandleMouseHover( hsPoint3 &mousePt, uint8_t modifiers ) {;} + virtual void HandleMouseDblClick( hsPoint3 &mousePt, uint8_t modifiers ) {;} - virtual hsBool HandleKeyPress( wchar_t key, UInt8 modifiers ); - virtual hsBool HandleKeyEvent( pfGameGUIMgr::EventType event, plKeyDef key, UInt8 modifiers ); + virtual hsBool HandleKeyPress( wchar_t key, uint8_t modifiers ); + virtual hsBool HandleKeyEvent( pfGameGUIMgr::EventType event, plKeyDef key, uint8_t modifiers ); void SetHandler( pfGUICtrlProcObject *h ) { ISetHandler( h, true ); } void DoSomething( void ); // Will call the handler - void HandleExtendedEvent( UInt32 event ); // Will call the handler + void HandleExtendedEvent( uint32_t event ); // Will call the handler pfGUICtrlProcObject *GetHandler( void ) const { return fHandler; } @@ -254,13 +254,13 @@ class pfGUIControlMod : public plSingleModifier virtual void SetTransform(const hsMatrix44& l2w, const hsMatrix44& w2l); // Forces an immediate play of the given GUI control event sound - void PlaySound( UInt8 guiCtrlEvent, hsBool loop = false ) { IPlaySound( guiCtrlEvent, loop ); } - void StopSound( UInt8 guiCtrlEvent ) { IStopSound( guiCtrlEvent ); } + void PlaySound( uint8_t guiCtrlEvent, hsBool loop = false ) { IPlaySound( guiCtrlEvent, loop ); } + void StopSound( uint8_t guiCtrlEvent ) { IStopSound( guiCtrlEvent ); } // Export only - void SetTagID( UInt32 id ) { fTagID = id; } + void SetTagID( uint32_t id ) { fTagID = id; } void SetDynTextMap( plLayerInterface *layer, plDynamicTextMap *dynText ); - void SetSoundIndex( UInt8 guiCtrlEvent, int soundIndex ); + void SetSoundIndex( uint8_t guiCtrlEvent, int soundIndex ); }; #endif // _pfGUIControlMod_h diff --git a/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUICtrlGenerator.cpp b/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUICtrlGenerator.cpp index 58aff8dd..162f52e3 100644 --- a/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUICtrlGenerator.cpp +++ b/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUICtrlGenerator.cpp @@ -45,7 +45,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // // ////////////////////////////////////////////////////////////////////////////// -#include "hsTypes.h" +#include "HeadSpin.h" #include "pfGUICtrlGenerator.h" #include "pfGameGUIMgr.h" #include "pfGUIControlMod.h" @@ -124,7 +124,7 @@ pfGUICtrlGenerator &pfGUICtrlGenerator::Instance( void ) plString pfGUICtrlGenerator::IGetNextKeyName( const char *prefix ) { - static UInt32 keyCount = 0; + static uint32_t keyCount = 0; return plString::Format( "%s%d", prefix, keyCount++ ); } @@ -141,7 +141,7 @@ plKey pfGUICtrlGenerator::IAddKey( hsKeyedObject *ko, const char *prefix ) //// SetFont ///////////////////////////////////////////////////////////////// -void pfGUICtrlGenerator::SetFont( const char *face, UInt16 size ) +void pfGUICtrlGenerator::SetFont( const char *face, uint16_t size ) { strcpy( fFontFace, face ); fFontSize = size; @@ -156,7 +156,7 @@ hsGMaterial *pfGUICtrlGenerator::ICreateSolidMaterial( hsColorRGBA &color ) // Create a material with a simple blank layer, fully ambient - hsGMaterial *material = TRACKED_NEW hsGMaterial; + hsGMaterial *material = new hsGMaterial; IAddKey( material, "GUIMaterial" ); plLayer *lay = material->MakeBaseLayer(); @@ -175,22 +175,22 @@ hsGMaterial *pfGUICtrlGenerator::ICreateSolidMaterial( hsColorRGBA &color ) hsGMaterial *pfGUICtrlGenerator::ICreateTextMaterial( const char *text, hsColorRGBA &bgColor, hsColorRGBA &textColor, float objWidth, float objHeight ) { - UInt16 pixWidth, pixHeight, strWidth, strHeight; + uint16_t pixWidth, pixHeight, strWidth, strHeight; hsColorRGBA black, white; // Guess at some pixel width and heights we want. We're guessing b/c we want it to look reasonably // good on the screen, but we don't know exactly how big is big, so we guess - pixWidth = (UInt16)(objWidth * 64.f); - pixHeight = (UInt16)(objHeight * 64.f); + pixWidth = (uint16_t)(objWidth * 64.f); + pixHeight = (uint16_t)(objHeight * 64.f); // Create blank mipmap - plMipmap *bitmap = TRACKED_NEW plMipmap( 1, 1, plMipmap::kRGB32Config, 1 ); + plMipmap *bitmap = new plMipmap( 1, 1, plMipmap::kRGB32Config, 1 ); IAddKey( bitmap, "GUIMipmap" ); // Create textGen to write string with - plTextGenerator *textGen = TRACKED_NEW plTextGenerator( bitmap, pixWidth, pixHeight ); - textGen->SetFont( fFontFace, (UInt16)fFontSize ); + plTextGenerator *textGen = new plTextGenerator( bitmap, pixWidth, pixHeight ); + textGen->SetFont( fFontFace, (uint16_t)fFontSize ); textGen->ClearToColor( bgColor ); textGen->SetTextColor( textColor ); strWidth = textGen->CalcStringWidth( text, &strHeight ); @@ -199,7 +199,7 @@ hsGMaterial *pfGUICtrlGenerator::ICreateTextMaterial( const char *text, hsColorR fTextGens.Append( textGen ); // Create a material with a simple blank layer, fully ambient - hsGMaterial *material = TRACKED_NEW hsGMaterial; + hsGMaterial *material = new hsGMaterial; IAddKey( material, "GUIMaterial" ); plLayer *lay = material->MakeBaseLayer(); @@ -210,7 +210,7 @@ hsGMaterial *pfGUICtrlGenerator::ICreateTextMaterial( const char *text, hsColorR lay->SetPreshadeColor( black ); lay->SetAmbientColor( white ); - hsgResMgr::ResMgr()->AddViaNotify( bitmap->GetKey(), TRACKED_NEW plLayRefMsg( lay->GetKey(), plRefMsg::kOnCreate, 0, plLayRefMsg::kTexture ), plRefFlags::kActiveRef ); + hsgResMgr::ResMgr()->AddViaNotify( bitmap->GetKey(), new plLayRefMsg( lay->GetKey(), plRefMsg::kOnCreate, 0, plLayRefMsg::kTexture ), plRefFlags::kActiveRef ); // lay->SetTexture( bitmap ); lay->SetTransform( textGen->GetLayerTransform() ); @@ -233,20 +233,20 @@ plSceneObject *pfGUICtrlGenerator::IGenSceneObject( pfGUIDialogMod *dlg, plDra if( snKey == nil ) snKey = fDynDlgNodes.Peek()->GetKey(); - hsgResMgr::ResMgr()->SendRef( myDraw->GetKey(), TRACKED_NEW plNodeRefMsg( snKey, plRefMsg::kOnCreate, 0, plNodeRefMsg::kDrawable ), plRefFlags::kActiveRef ); + hsgResMgr::ResMgr()->SendRef( myDraw->GetKey(), new plNodeRefMsg( snKey, plRefMsg::kOnCreate, 0, plNodeRefMsg::kDrawable ), plRefFlags::kActiveRef ); - plDrawInterface *newDI = TRACKED_NEW plDrawInterface; + plDrawInterface *newDI = new plDrawInterface; IAddKey( newDI, "GUIDrawIFace" ); - plSceneObject *newObj = TRACKED_NEW plSceneObject; + plSceneObject *newObj = new plSceneObject; IAddKey( newObj, "GUISceneObject" ); - plCoordinateInterface *newCI = TRACKED_NEW plCoordinateInterface; + plCoordinateInterface *newCI = new plCoordinateInterface; IAddKey( newCI, "GUICoordIFace" ); - hsgResMgr::ResMgr()->SendRef( newCI->GetKey(), TRACKED_NEW plObjRefMsg( newObj->GetKey(), plRefMsg::kOnCreate, 0, plObjRefMsg::kInterface ), plRefFlags::kActiveRef ); - hsgResMgr::ResMgr()->SendRef( newDI->GetKey(), TRACKED_NEW plObjRefMsg( newObj->GetKey(), plRefMsg::kOnCreate, 0, plObjRefMsg::kInterface ), plRefFlags::kActiveRef ); - hsgResMgr::ResMgr()->SendRef( myDraw->GetKey(), TRACKED_NEW plIntRefMsg( newDI->GetKey(), plRefMsg::kOnCreate, 0, plIntRefMsg::kDrawable ), plRefFlags::kActiveRef ); + hsgResMgr::ResMgr()->SendRef( newCI->GetKey(), new plObjRefMsg( newObj->GetKey(), plRefMsg::kOnCreate, 0, plObjRefMsg::kInterface ), plRefFlags::kActiveRef ); + hsgResMgr::ResMgr()->SendRef( newDI->GetKey(), new plObjRefMsg( newObj->GetKey(), plRefMsg::kOnCreate, 0, plObjRefMsg::kInterface ), plRefFlags::kActiveRef ); + hsgResMgr::ResMgr()->SendRef( myDraw->GetKey(), new plIntRefMsg( newDI->GetKey(), plRefMsg::kOnCreate, 0, plIntRefMsg::kDrawable ), plRefFlags::kActiveRef ); if( parent == nil ) { @@ -256,8 +256,8 @@ plSceneObject *pfGUICtrlGenerator::IGenSceneObject( pfGUIDialogMod *dlg, plDra } if( parent != nil ) -// hsgResMgr::ResMgr()->SendRef( newCI->GetKey(), TRACKED_NEW plIntRefMsg( parent->GetKey(), plRefMsg::kOnCreate, 0, plIntRefMsg::kChild ), plRefFlags::kActiveRef ); - hsgResMgr::ResMgr()->SendRef( newCI->GetKey(), TRACKED_NEW plAttachMsg( parent->GetKey(), nil, plRefMsg::kOnRequest ), plRefFlags::kActiveRef ); +// hsgResMgr::ResMgr()->SendRef( newCI->GetKey(), new plIntRefMsg( parent->GetKey(), plRefMsg::kOnCreate, 0, plIntRefMsg::kChild ), plRefFlags::kActiveRef ); + hsgResMgr::ResMgr()->SendRef( newCI->GetKey(), new plAttachMsg( parent->GetKey(), nil, plRefMsg::kOnRequest ), plRefFlags::kActiveRef ); newObj->SetSceneNode( snKey ); @@ -287,7 +287,7 @@ pfGUIButtonMod *pfGUICtrlGenerator::GenerateRectButton( const char *title, floa pfGUIButtonMod *but = CreateRectButton( dlgToAddTo, title, x, y, width, height, material ); if( but != nil ) - but->SetHandler( TRACKED_NEW pfGUIConsoleCmdProc( consoleCmd ) ); + but->SetHandler( new pfGUIConsoleCmdProc( consoleCmd ) ); return but; } @@ -327,11 +327,11 @@ pfGUIButtonMod *pfGUICtrlGenerator::CreateRectButton( pfGUIDialogMod *parent, c plSceneObject *newObj = IGenSceneObject( parent, myDraw ); - pfGUIButtonMod *newBtn = asMenuItem ? TRACKED_NEW pfGUIMenuItem : TRACKED_NEW pfGUIButtonMod; + pfGUIButtonMod *newBtn = asMenuItem ? new pfGUIMenuItem : new pfGUIButtonMod; IAddKey( newBtn, "GUIButton" ); - hsgResMgr::ResMgr()->SendRef( newBtn->GetKey(), TRACKED_NEW plObjRefMsg( newObj->GetKey(), plRefMsg::kOnCreate, 0, plObjRefMsg::kModifier ), plRefFlags::kActiveRef ); + hsgResMgr::ResMgr()->SendRef( newBtn->GetKey(), new plObjRefMsg( newObj->GetKey(), plRefMsg::kOnCreate, 0, plObjRefMsg::kModifier ), plRefFlags::kActiveRef ); parent->AddControl( newBtn ); - hsgResMgr::ResMgr()->AddViaNotify( newBtn->GetKey(), TRACKED_NEW plGenRefMsg( parent->GetKey(), plRefMsg::kOnCreate, parent->GetNumControls() - 1, pfGUIDialogMod::kControlRef ), plRefFlags::kActiveRef ); + hsgResMgr::ResMgr()->AddViaNotify( newBtn->GetKey(), new plGenRefMsg( parent->GetKey(), plRefMsg::kOnCreate, parent->GetNumControls() - 1, pfGUIDialogMod::kControlRef ), plRefFlags::kActiveRef ); return newBtn; } @@ -371,10 +371,10 @@ pfGUIButtonMod *pfGUICtrlGenerator::GenerateSphereButton( float x, float y, flo plSceneObject *newObj = IGenSceneObject( dlgToAddTo, myDraw );//, nil, &l2w, &w2l ); - pfGUIButtonMod *newBtn = TRACKED_NEW pfGUIButtonMod; + pfGUIButtonMod *newBtn = new pfGUIButtonMod; IAddKey( newBtn, "GUIButton" ); - newBtn->SetHandler( TRACKED_NEW pfGUIConsoleCmdProc( consoleCmd ) ); - hsgResMgr::ResMgr()->AddViaNotify( newBtn->GetKey(), TRACKED_NEW plObjRefMsg( newObj->GetKey(), plRefMsg::kOnCreate, 0, plObjRefMsg::kModifier ), plRefFlags::kActiveRef ); + newBtn->SetHandler( new pfGUIConsoleCmdProc( consoleCmd ) ); + hsgResMgr::ResMgr()->AddViaNotify( newBtn->GetKey(), new plObjRefMsg( newObj->GetKey(), plRefMsg::kOnCreate, 0, plObjRefMsg::kModifier ), plRefFlags::kActiveRef ); dlgToAddTo->AddControl( newBtn ); return newBtn; @@ -418,9 +418,9 @@ pfGUIDragBarCtrl *pfGUICtrlGenerator::GenerateDragBar( float x, float y, float w fDynDragBars[ fDynDragBars.GetCount() - 1 ] = newObj; - pfGUIDragBarCtrl *newBtn = TRACKED_NEW pfGUIDragBarCtrl; + pfGUIDragBarCtrl *newBtn = new pfGUIDragBarCtrl; IAddKey( newBtn, "GUIDragBar" ); - hsgResMgr::ResMgr()->AddViaNotify( newBtn->GetKey(), TRACKED_NEW plObjRefMsg( newObj->GetKey(), plRefMsg::kOnCreate, 0, plObjRefMsg::kModifier ), plRefFlags::kActiveRef ); + hsgResMgr::ResMgr()->AddViaNotify( newBtn->GetKey(), new plObjRefMsg( newObj->GetKey(), plRefMsg::kOnCreate, 0, plObjRefMsg::kModifier ), plRefFlags::kActiveRef ); dlgToAddTo->AddControl( newBtn ); /* vec.Set( -x, y, 100 ); @@ -454,7 +454,7 @@ pfGUIDialogMod *pfGUICtrlGenerator::IGenerateDialog( const char *name, float sc // Create the rendermod - plPostEffectMod *renderMod = TRACKED_NEW plPostEffectMod; + plPostEffectMod *renderMod = new plPostEffectMod; IAddKey( renderMod, "GUIRenderMod" ); renderMod->SetHither( 0.5f ); @@ -464,31 +464,31 @@ pfGUIDialogMod *pfGUICtrlGenerator::IGenerateDialog( const char *name, float sc fovX = atan( scrnWidth / ( 2.f * 100.f ) ) * 2.f; fovY = fovX;// * 3.f / 4.f; - renderMod->SetFovX( fovX * 180.f / hsScalarPI ); - renderMod->SetFovY( fovY * 180.f / hsScalarPI ); + renderMod->SetFovX( fovX * 180.f / M_PI ); + renderMod->SetFovY( fovY * 180.f / M_PI ); // Create the sceneNode to go with it - node = TRACKED_NEW plSceneNode; + node = new plSceneNode; IAddKey( node, "GUISceneNode" ); node->GetKey()->RefObject(); fDynDlgNodes.Append( node ); fDynDragBars.Append( nil ); - hsgResMgr::ResMgr()->AddViaNotify( node->GetKey(), TRACKED_NEW plGenRefMsg( renderMod->GetKey(), plRefMsg::kOnCreate, 0, plPostEffectMod::kNodeRef ), plRefFlags::kPassiveRef ); + hsgResMgr::ResMgr()->AddViaNotify( node->GetKey(), new plGenRefMsg( renderMod->GetKey(), plRefMsg::kOnCreate, 0, plPostEffectMod::kNodeRef ), plRefFlags::kPassiveRef ); // Create the dialog - dialog = TRACKED_NEW pfGUIDialogMod; + dialog = new pfGUIDialogMod; IAddKey( dialog, "GUIDialog" ); dialog->SetRenderMod( renderMod ); dialog->SetName( name ); // Create the dummy scene object to hold the dialog - plSceneObject *newObj = TRACKED_NEW plSceneObject; + plSceneObject *newObj = new plSceneObject; IAddKey( newObj, "GUISceneObject" ); // *#&$(*@&#$ need a coordIface... - plCoordinateInterface *newCI = TRACKED_NEW plCoordinateInterface; + plCoordinateInterface *newCI = new plCoordinateInterface; IAddKey( newCI, "GUICoordIFace" ); hsMatrix44 l2w, w2l; @@ -499,13 +499,13 @@ pfGUIDialogMod *pfGUICtrlGenerator::IGenerateDialog( const char *name, float sc // Using SendRef here because AddViaNotify will queue the messages up, which doesn't do us any good // if we need these refs right away - hsgResMgr::ResMgr()->SendRef( dialog->GetKey(), TRACKED_NEW plObjRefMsg( newObj->GetKey(), plRefMsg::kOnCreate, 0, plObjRefMsg::kModifier ), plRefFlags::kActiveRef ); + hsgResMgr::ResMgr()->SendRef( dialog->GetKey(), new plObjRefMsg( newObj->GetKey(), plRefMsg::kOnCreate, 0, plObjRefMsg::kModifier ), plRefFlags::kActiveRef ); - hsgResMgr::ResMgr()->AddViaNotify( newCI->GetKey(), TRACKED_NEW plObjRefMsg( newObj->GetKey(), plRefMsg::kOnCreate, 0, plObjRefMsg::kInterface ), plRefFlags::kActiveRef ); - hsgResMgr::ResMgr()->AddViaNotify( renderMod->GetKey(), TRACKED_NEW plObjRefMsg( newObj->GetKey(), plRefMsg::kOnCreate, 0, plObjRefMsg::kModifier ), plRefFlags::kActiveRef ); + hsgResMgr::ResMgr()->AddViaNotify( newCI->GetKey(), new plObjRefMsg( newObj->GetKey(), plRefMsg::kOnCreate, 0, plObjRefMsg::kInterface ), plRefFlags::kActiveRef ); + hsgResMgr::ResMgr()->AddViaNotify( renderMod->GetKey(), new plObjRefMsg( newObj->GetKey(), plRefMsg::kOnCreate, 0, plObjRefMsg::kModifier ), plRefFlags::kActiveRef ); // Add the dialog to the GUI mgr - plGenRefMsg *refMsg = TRACKED_NEW plGenRefMsg( pfGameGUIMgr::GetInstance()->GetKey(), + plGenRefMsg *refMsg = new plGenRefMsg( pfGameGUIMgr::GetInstance()->GetKey(), plRefMsg::kOnCreate, 0, pfGameGUIMgr::kDlgModRef ); hsgResMgr::ResMgr()->AddViaNotify( dialog->GetKey(), refMsg, plRefFlags::kActiveRef ); diff --git a/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUICtrlGenerator.h b/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUICtrlGenerator.h index 628b5da6..c3502510 100644 --- a/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUICtrlGenerator.h +++ b/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUICtrlGenerator.h @@ -75,7 +75,7 @@ class pfGUICtrlGenerator protected: char fFontFace[ 256 ]; - UInt32 fFontSize; + uint32_t fFontSize; hsTArray fTextGens; @@ -104,7 +104,7 @@ class pfGUICtrlGenerator void Shutdown( void ); - void SetFont( const char *face, UInt16 size ); + void SetFont( const char *face, uint16_t size ); pfGUIButtonMod *GenerateRectButton( const char *title, float x, float y, float width, float height, diff --git a/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIDialogMod.cpp b/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIDialogMod.cpp index 7fd2abf8..0171f9a1 100644 --- a/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIDialogMod.cpp +++ b/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIDialogMod.cpp @@ -45,7 +45,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // // ////////////////////////////////////////////////////////////////////////////// -#include "hsTypes.h" +#include "HeadSpin.h" #include "pfGameGUIMgr.h" #include "pfGUIDialogMod.h" #include "pfGUIControlMod.h" @@ -88,7 +88,7 @@ pfGUIDialogMod::pfGUIDialogMod() : fRenderMod( nil ), fNext( nil ), fPrevPtr( ni fDragTarget = nil; fProcReceiver = nil; - fColorScheme = TRACKED_NEW pfGUIColorScheme(); + fColorScheme = new pfGUIColorScheme(); } pfGUIDialogMod::~pfGUIDialogMod() @@ -102,7 +102,7 @@ pfGUIDialogMod::~pfGUIDialogMod() plKey mgrKey = hsgResMgr::ResMgr()->FindKey( lu ); if( mgrKey ) { - plGenRefMsg *refMsg = TRACKED_NEW plGenRefMsg( mgrKey, plRefMsg::kOnRemove, 0, pfGameGUIMgr::kDlgModRef ); + plGenRefMsg *refMsg = new plGenRefMsg( mgrKey, plRefMsg::kOnRemove, 0, pfGameGUIMgr::kDlgModRef ); refMsg->SetRef( this ); plgDispatch::MsgSend( refMsg ); } @@ -117,7 +117,7 @@ pfGUIDialogMod::~pfGUIDialogMod() // Sometimes it just sucks not having access to the pipeline at just the // right time. -void pfGUIDialogMod::ScreenToWorldPoint( hsScalar x, hsScalar y, hsScalar z, hsPoint3 &outPt ) +void pfGUIDialogMod::ScreenToWorldPoint( float x, float y, float z, hsPoint3 &outPt ) { plViewTransform view = fRenderMod->GetViewTransform(); view.SetScreenSize( 1, 1 ); @@ -141,7 +141,7 @@ hsPoint3 pfGUIDialogMod::WorldToScreenPoint( const hsPoint3 &inPt ) //// IEval /////////////////////////////////////////////////////////////////// -hsBool pfGUIDialogMod::IEval( double secs, hsScalar del, UInt32 dirty ) +hsBool pfGUIDialogMod::IEval( double secs, float del, uint32_t dirty ) { return false; } @@ -163,14 +163,14 @@ hsBool pfGUIDialogMod::MsgReceive( plMessage *msg ) if( fEnabled ) { - plAnimCmdMsg *animMsg = TRACKED_NEW plAnimCmdMsg( GetKey(), fRenderMod->GetKey(), nil ); + plAnimCmdMsg *animMsg = new plAnimCmdMsg( GetKey(), fRenderMod->GetKey(), nil ); animMsg->SetCmd( plAnimCmdMsg::kContinue ); plgDispatch::MsgSend( animMsg ); } } else if( ref->GetContext() & ( plRefMsg::kOnRemove | plRefMsg::kOnDestroy ) ) { - plAnimCmdMsg *animMsg = TRACKED_NEW plAnimCmdMsg( GetKey(), fRenderMod->GetKey(), nil ); + plAnimCmdMsg *animMsg = new plAnimCmdMsg( GetKey(), fRenderMod->GetKey(), nil ); animMsg->SetCmd( plAnimCmdMsg::kStop ); plgDispatch::MsgSend( animMsg ); @@ -235,7 +235,7 @@ void pfGUIDialogMod::AddControl( pfGUIControlMod *ctrl ) void pfGUIDialogMod::AddControlOnExport( pfGUIControlMod *ctrl ) { fControls.Append( ctrl ); - hsgResMgr::ResMgr()->AddViaNotify( ctrl->GetKey(), TRACKED_NEW plGenRefMsg( GetKey(), plRefMsg::kOnCreate, fControls.GetCount() - 1, pfGUIDialogMod::kControlRef ), plRefFlags::kActiveRef ); + hsgResMgr::ResMgr()->AddViaNotify( ctrl->GetKey(), new plGenRefMsg( GetKey(), plRefMsg::kOnCreate, fControls.GetCount() - 1, pfGUIDialogMod::kControlRef ), plRefFlags::kActiveRef ); } //// SetEnabled ////////////////////////////////////////////////////////////// @@ -271,7 +271,7 @@ void pfGUIDialogMod::SetEnabled( hsBool e ) if( fRenderMod != nil ) { - plAnimCmdMsg *animMsg = TRACKED_NEW plAnimCmdMsg( GetKey(), fRenderMod->GetKey(), nil ); + plAnimCmdMsg *animMsg = new plAnimCmdMsg( GetKey(), fRenderMod->GetKey(), nil ); if( fEnabled ) { animMsg->SetCmd( plAnimCmdMsg::kContinue ); @@ -292,21 +292,21 @@ void pfGUIDialogMod::Read( hsStream *s, hsResMgr *mgr ) { plSingleModifier::Read(s, mgr); - mgr->ReadKeyNotifyMe( s, TRACKED_NEW plGenRefMsg( GetKey(), plRefMsg::kOnCreate, -1, kRenderModRef ), plRefFlags::kActiveRef ); + mgr->ReadKeyNotifyMe( s, new plGenRefMsg( GetKey(), plRefMsg::kOnCreate, -1, kRenderModRef ), plRefFlags::kActiveRef ); s->Read( sizeof( fName ), fName ); - UInt32 i, count = s->ReadLE32(); + uint32_t i, count = s->ReadLE32(); fControls.SetCountAndZero( count ); for( i = 0; i < count; i++ ) - mgr->ReadKeyNotifyMe( s, TRACKED_NEW plGenRefMsg( GetKey(), plRefMsg::kOnCreate, i, kControlRef ), plRefFlags::kActiveRef ); + mgr->ReadKeyNotifyMe( s, new plGenRefMsg( GetKey(), plRefMsg::kOnCreate, i, kControlRef ), plRefFlags::kActiveRef ); // Register us with the Game GUI manager plUoid lu( kGameGUIMgr_KEY ); plKey mgrKey = hsgResMgr::ResMgr()->FindKey( lu ); if( mgrKey ) { - plGenRefMsg *refMsg = TRACKED_NEW plGenRefMsg( mgrKey, plRefMsg::kOnCreate, 0, pfGameGUIMgr::kDlgModRef ); + plGenRefMsg *refMsg = new plGenRefMsg( mgrKey, plRefMsg::kOnCreate, 0, pfGameGUIMgr::kDlgModRef ); hsgResMgr::ResMgr()->AddViaNotify( GetKey(), refMsg, plRefFlags::kPassiveRef ); } @@ -314,7 +314,7 @@ void pfGUIDialogMod::Read( hsStream *s, hsResMgr *mgr ) fProcReceiver = mgr->ReadKey( s ); if( fProcReceiver != nil ) - SetHandler( TRACKED_NEW pfGUIDialogNotifyProc( fProcReceiver ) ); + SetHandler( new pfGUIDialogNotifyProc( fProcReceiver ) ); s->ReadLE( &fVersion ); @@ -325,7 +325,7 @@ void pfGUIDialogMod::Read( hsStream *s, hsResMgr *mgr ) void pfGUIDialogMod::Write( hsStream *s, hsResMgr *mgr ) { - UInt32 i; + uint32_t i; plSingleModifier::Write( s, mgr ); @@ -364,7 +364,7 @@ plKey pfGUIDialogMod::GetSceneNodeKey( void ) // Really. We go through and make sure every control marked as interesting // still has the mouse inside it and vice versa. -void pfGUIDialogMod::UpdateInterestingThings( hsScalar mouseX, hsScalar mouseY, UInt8 modifiers, hsBool modalPreset ) +void pfGUIDialogMod::UpdateInterestingThings( float mouseX, float mouseY, uint8_t modifiers, hsBool modalPreset ) { int i; hsPoint3 mousePoint; @@ -405,21 +405,21 @@ void pfGUIDialogMod::UpdateInterestingThings( hsScalar mouseX, hsScalar mouse #include "plPipeline/plDebugText.h" #endif -hsBool pfGUIDialogMod::HandleMouseEvent( pfGameGUIMgr::EventType event, hsScalar mouseX, hsScalar mouseY, - UInt8 modifiers ) +hsBool pfGUIDialogMod::HandleMouseEvent( pfGameGUIMgr::EventType event, float mouseX, float mouseY, + uint8_t modifiers ) { hsPoint3 mousePoint; - UInt32 i; + uint32_t i; pfGUIControlMod *oldInterestingCtrl = nil; - hsScalar smallestZ; + float smallestZ; #ifdef HS_DEBUGGING // Debugging bounds rects static bool showBounds = false; if( showBounds ) { - UInt32 sW, sH; + uint32_t sW, sH; plDebugText::Instance().GetScreenSize(&sW,&sH); for( i = 0; i < fControls.GetCount(); i++ ) { @@ -431,30 +431,30 @@ static bool showBounds = false; if( fControls[ i ]->fBoundsPoints.GetCount() > 0 ) { const hsBounds3 &bnds = fControls[ i ]->GetBounds(); - plDebugText::Instance().Draw3DBorder( (UInt16)(sW * bnds.GetMins().fX), - (UInt16)(sH * bnds.GetMins().fY), - (UInt16)(sW * bnds.GetMaxs().fX), - (UInt16)(sH * bnds.GetMaxs().fY), 0x3000ffff, 0x3000ffff ); + plDebugText::Instance().Draw3DBorder( (uint16_t)(sW * bnds.GetMins().fX), + (uint16_t)(sH * bnds.GetMins().fY), + (uint16_t)(sW * bnds.GetMaxs().fX), + (uint16_t)(sH * bnds.GetMaxs().fY), 0x3000ffff, 0x3000ffff ); - UInt32 color = 0xffff0000; + uint32_t color = 0xffff0000; for( int j = 0; j < fControls[ i ]->fBoundsPoints.GetCount(); j++ ) { // color = 0xff000000 | ( ( j * 16 ) << 16 ); float x = sW * fControls[ i ]->fBoundsPoints[ j ].fX; float y = sH * fControls[ i ]->fBoundsPoints[ j ].fY; - plDebugText::Instance().DrawRect( (UInt16)(x - 2), (UInt16)(y - 2), (UInt16)(x + 2), (UInt16)(y + 2), color ); + plDebugText::Instance().DrawRect( (uint16_t)(x - 2), (uint16_t)(y - 2), (uint16_t)(x + 2), (uint16_t)(y + 2), color ); char str[ 16 ]; snprintf(str, 16, "%d", j); - plDebugText::Instance().DrawString( (UInt16)(x + 8), (UInt16)(y - 8), str, color ); + plDebugText::Instance().DrawString( (uint16_t)(x + 8), (uint16_t)(y - 8), str, color ); } } else { const hsBounds3 &bnds = fControls[ i ]->GetBounds(); - plDebugText::Instance().Draw3DBorder( (UInt16)(sW * bnds.GetMins().fX), - (UInt16)(sH * bnds.GetMins().fY), - (UInt16)(sW * bnds.GetMaxs().fX), - (UInt16)(sH * bnds.GetMaxs().fY), 0x300000ff, 0x300000ff ); + plDebugText::Instance().Draw3DBorder( (uint16_t)(sW * bnds.GetMins().fX), + (uint16_t)(sH * bnds.GetMins().fY), + (uint16_t)(sW * bnds.GetMaxs().fX), + (uint16_t)(sH * bnds.GetMaxs().fY), 0x300000ff, 0x300000ff ); } } } @@ -498,7 +498,7 @@ static bool showBounds = false; if( showBounds ) { const hsBounds3 &bnds = fMousedCtrl->GetBounds(); - plDebugText::Instance().DrawString( (UInt16)(bnds.GetMins().fX), (UInt16)(bnds.GetMins().fY), fMousedCtrl->GetKeyName(), (UInt32)0xffffff00 ); + plDebugText::Instance().DrawString( (uint16_t)(bnds.GetMins().fX), (uint16_t)(bnds.GetMins().fY), fMousedCtrl->GetKeyName(), (uint32_t)0xffffff00 ); } #endif @@ -554,7 +554,7 @@ if( showBounds ) //// HandleKeyEvent ////////////////////////////////////////////////////////// -hsBool pfGUIDialogMod::HandleKeyEvent( pfGameGUIMgr::EventType event, plKeyDef key, UInt8 modifiers ) +hsBool pfGUIDialogMod::HandleKeyEvent( pfGameGUIMgr::EventType event, plKeyDef key, uint8_t modifiers ) { // Only process if a control has focus... if( fFocusCtrl != nil ) @@ -567,7 +567,7 @@ hsBool pfGUIDialogMod::HandleKeyEvent( pfGameGUIMgr::EventType event, plKey //// HandleKeyPress ////////////////////////////////////////////////////////// -hsBool pfGUIDialogMod::HandleKeyPress( wchar_t key, UInt8 modifiers ) +hsBool pfGUIDialogMod::HandleKeyPress( wchar_t key, uint8_t modifiers ) { // Same deal as HandleKeyPress. Only problem is, we needed the msg to translate // to a char, so it had to be done up at the mgr level (sadly) @@ -629,7 +629,7 @@ void pfGUIDialogMod::Hide( void ) //// GetControlFromTag /////////////////////////////////////////////////////// -pfGUIControlMod *pfGUIDialogMod::GetControlFromTag( UInt32 tagID ) +pfGUIControlMod *pfGUIDialogMod::GetControlFromTag( uint32_t tagID ) { int i; @@ -696,7 +696,7 @@ void pfGUIDialogMod::SetHandlerForAll( pfGUIDialogProc *hdlr ) //// SetControlHandler /////////////////////////////////////////////////////// -void pfGUIDialogMod::SetControlHandler( UInt32 tagID, pfGUIDialogProc *hdlr ) +void pfGUIDialogMod::SetControlHandler( uint32_t tagID, pfGUIDialogProc *hdlr ) { int i; for( i = 0; i < fControls.GetCount(); i++ ) @@ -784,10 +784,10 @@ void pfGUIDialogMod::EnterDragMode( pfGUIControlMod *source ) // up, if the control is indeed receptive, we call its drag handler for each // of our elements, and either way, exit drag mode. -void pfGUIDialogMod::IHandleDrag( hsPoint3 &mousePoint, pfGameGUIMgr::EventType event, UInt8 modifiers ) +void pfGUIDialogMod::IHandleDrag( hsPoint3 &mousePoint, pfGameGUIMgr::EventType event, uint8_t modifiers ) { int i; - hsScalar smallestZ; + float smallestZ; // First, see if our target control has changed @@ -838,7 +838,7 @@ void pfGUIDialogMod::IHandleDrag( hsPoint3 &mousePoint, pfGameGUIMgr::EventTy //// GetDesiredCursor //////////////////////////////////////////////////////// -UInt32 pfGUIDialogMod::GetDesiredCursor( void ) const +uint32_t pfGUIDialogMod::GetDesiredCursor( void ) const { if( fMousedCtrl != nil ) return fMousedCtrl->IGetDesiredCursor(); diff --git a/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIDialogMod.h b/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIDialogMod.h index f62c7fff..6fcf67ee 100644 --- a/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIDialogMod.h +++ b/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIDialogMod.h @@ -67,9 +67,9 @@ class pfGUIDialogMod : public plSingleModifier protected: - UInt32 fTagID; // 0 if none + uint32_t fTagID; // 0 if none - UInt32 fVersion; // Nice for syncing to C++ code + uint32_t fVersion; // Nice for syncing to C++ code plPostEffectMod *fRenderMod; hsBool fEnabled; @@ -91,9 +91,9 @@ class pfGUIDialogMod : public plSingleModifier plKey fSceneNodeKey; - virtual hsBool IEval( double secs, hsScalar del, UInt32 dirty ); // called only by owner object's Eval() + virtual hsBool IEval( double secs, float del, uint32_t dirty ); // called only by owner object's Eval() - void IHandleDrag( hsPoint3 &mousePt, pfGameGUIMgr::EventType event, UInt8 modifiers ); + void IHandleDrag( hsPoint3 &mousePt, pfGameGUIMgr::EventType event, uint8_t modifiers ); public: @@ -130,25 +130,25 @@ class pfGUIDialogMod : public plSingleModifier const char *GetName( void ) { return fName; } - void ScreenToWorldPoint( hsScalar x, hsScalar y, hsScalar z, hsPoint3 &outPt ); + void ScreenToWorldPoint( float x, float y, float z, hsPoint3 &outPt ); hsPoint3 WorldToScreenPoint( const hsPoint3 &inPt ); - virtual hsBool HandleMouseEvent( pfGameGUIMgr::EventType event, hsScalar mouseX, hsScalar mouseY, UInt8 modifiers ); - hsBool HandleKeyEvent( pfGameGUIMgr::EventType event, plKeyDef key, UInt8 modifiers ); - hsBool HandleKeyPress( wchar_t key, UInt8 modifiers ); - void UpdateInterestingThings( hsScalar mouseX, hsScalar mouseY, UInt8 modifiers, hsBool modalPreset ); + virtual hsBool HandleMouseEvent( pfGameGUIMgr::EventType event, float mouseX, float mouseY, uint8_t modifiers ); + hsBool HandleKeyEvent( pfGameGUIMgr::EventType event, plKeyDef key, uint8_t modifiers ); + hsBool HandleKeyPress( wchar_t key, uint8_t modifiers ); + void UpdateInterestingThings( float mouseX, float mouseY, uint8_t modifiers, hsBool modalPreset ); void SetControlOfInterest( pfGUIControlMod *c ); pfGUIControlMod *GetControlOfInterest( void ) const { return fControlOfInterest; } - UInt32 GetDesiredCursor( void ) const; + uint32_t GetDesiredCursor( void ) const; void UpdateAspectRatio( void ); void UpdateAllBounds( void ); void RefreshAllControls( void ); void AddControl( pfGUIControlMod *ctrl ); - UInt32 GetNumControls( void ) { return fControls.GetCount(); } - pfGUIControlMod *GetControl( UInt32 idx ) { return fControls[ idx ]; } + uint32_t GetNumControls( void ) { return fControls.GetCount(); } + pfGUIControlMod *GetControl( uint32_t idx ) { return fControls[ idx ]; } pfGUIColorScheme *GetColorScheme( void ) const { return fColorScheme; } @@ -180,8 +180,8 @@ class pfGUIDialogMod : public plSingleModifier pfGUIControlMod *GetFocus( void ) { return fFocusCtrl; } pfGUIDialogMod *GetNext( void ) { return fNext; } - UInt32 GetTagID( void ) { return fTagID; } - pfGUIControlMod *GetControlFromTag( UInt32 tagID ); + uint32_t GetTagID( void ) { return fTagID; } + pfGUIControlMod *GetControlFromTag( uint32_t tagID ); void SetHandler( pfGUIDialogProc *hdlr ); pfGUIDialogProc *GetHandler( void ) const { return fHandler; } @@ -192,7 +192,7 @@ class pfGUIDialogMod : public plSingleModifier void SetHandlerForAll( pfGUIDialogProc *hdlr ); // Just a little macro-type thing here - void SetControlHandler( UInt32 tagID, pfGUIDialogProc *hdlr ); + void SetControlHandler( uint32_t tagID, pfGUIDialogProc *hdlr ); /// Methods for doing drag & drop of listElements @@ -200,15 +200,15 @@ class pfGUIDialogMod : public plSingleModifier void AddToDragList( pfGUIListElement *e ); void EnterDragMode( pfGUIControlMod *source ); - UInt32 GetVersion( void ) const { return fVersion; } + uint32_t GetVersion( void ) const { return fVersion; } // Export only void SetRenderMod( plPostEffectMod *mod ) { fRenderMod = mod; } void SetName( const char *name ) { hsStrncpy( fName, name, sizeof( fName ) - 1 ); } void AddControlOnExport( pfGUIControlMod *ctrl ); - void SetTagID( UInt32 id ) { fTagID = id; } + void SetTagID( uint32_t id ) { fTagID = id; } void SetProcReceiver( plKey key ) { fProcReceiver = key; } - void SetVersion( UInt32 version ) { fVersion = version; } + void SetVersion( uint32_t version ) { fVersion = version; } }; #endif // _pfGUIDialogMod_h diff --git a/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIDialogNotifyProc.cpp b/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIDialogNotifyProc.cpp index aee255df..5c923bbe 100644 --- a/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIDialogNotifyProc.cpp +++ b/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIDialogNotifyProc.cpp @@ -51,7 +51,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "pfGUIDialogNotifyProc.h" -#include "hsTypes.h" +#include "HeadSpin.h" #include "pfGameGUIMgr.h" #include "pfGUIDialogMod.h" #include "pfGUIControlMod.h" @@ -73,9 +73,9 @@ pfGUIDialogNotifyProc::pfGUIDialogNotifyProc( plKey &r ) } -void pfGUIDialogNotifyProc::ISendNotify( plKey ctrlKey, UInt32 event ) +void pfGUIDialogNotifyProc::ISendNotify( plKey ctrlKey, uint32_t event ) { - pfGUINotifyMsg *notify = TRACKED_NEW pfGUINotifyMsg( fDialog->GetKey(), fReceiver, nil ); + pfGUINotifyMsg *notify = new pfGUINotifyMsg( fDialog->GetKey(), fReceiver, nil ); notify->SetEvent( ctrlKey, event ); plgDispatch::MsgSend( notify ); } diff --git a/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIDialogNotifyProc.h b/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIDialogNotifyProc.h index 9871c5b3..81927a10 100644 --- a/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIDialogNotifyProc.h +++ b/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIDialogNotifyProc.h @@ -63,7 +63,7 @@ class pfGUIDialogNotifyProc : public pfGUIDialogProc plKey fReceiver; - void ISendNotify( plKey ctrlKey, UInt32 event ); + void ISendNotify( plKey ctrlKey, uint32_t event ); public: diff --git a/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIDragBarCtrl.cpp b/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIDragBarCtrl.cpp index 0ed48d46..57a7c3c1 100644 --- a/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIDragBarCtrl.cpp +++ b/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIDragBarCtrl.cpp @@ -49,7 +49,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // // ////////////////////////////////////////////////////////////////////////////// -#include "hsTypes.h" +#include "HeadSpin.h" #include "pfGUIDragBarCtrl.h" #include "pfGameGUIMgr.h" #include "pfGUIDialogMod.h" @@ -78,7 +78,7 @@ pfGUIDragBarCtrl::~pfGUIDragBarCtrl() //// IEval /////////////////////////////////////////////////////////////////// -hsBool pfGUIDragBarCtrl::IEval( double secs, hsScalar del, UInt32 dirty ) +hsBool pfGUIDragBarCtrl::IEval( double secs, float del, uint32_t dirty ) { return pfGUIControlMod::IEval( secs, del, dirty ); } @@ -112,7 +112,7 @@ void pfGUIDragBarCtrl::UpdateBounds( hsMatrix44 *invXformMatrix, hsBool force //// HandleMouseDown/Up ////////////////////////////////////////////////////// -void pfGUIDragBarCtrl::HandleMouseDown( hsPoint3 &mousePt, UInt8 modifiers ) +void pfGUIDragBarCtrl::HandleMouseDown( hsPoint3 &mousePt, uint8_t modifiers ) { // if we are anchored then don't let it be moved if ( fAnchored ) @@ -128,7 +128,7 @@ void pfGUIDragBarCtrl::HandleMouseDown( hsPoint3 &mousePt, UInt8 modifiers ) fDialog->UpdateAllBounds(); } -void pfGUIDragBarCtrl::HandleMouseUp( hsPoint3 &mousePt, UInt8 modifiers ) +void pfGUIDragBarCtrl::HandleMouseUp( hsPoint3 &mousePt, uint8_t modifiers ) { // if we are anchored then don't let it be moved if ( fAnchored ) @@ -139,7 +139,7 @@ void pfGUIDragBarCtrl::HandleMouseUp( hsPoint3 &mousePt, UInt8 modifiers ) fDialog->UpdateAllBounds(); } -void pfGUIDragBarCtrl::HandleMouseDrag( hsPoint3 &mousePt, UInt8 modifiers ) +void pfGUIDragBarCtrl::HandleMouseDrag( hsPoint3 &mousePt, uint8_t modifiers ) { // if we are anchored then don't let it be moved if ( fAnchored ) @@ -151,7 +151,7 @@ void pfGUIDragBarCtrl::HandleMouseDrag( hsPoint3 &mousePt, UInt8 modifiers ) //// IGetDesiredCursor /////////////////////////////////////////////////////// -UInt32 pfGUIDragBarCtrl::IGetDesiredCursor( void ) const +uint32_t pfGUIDragBarCtrl::IGetDesiredCursor( void ) const { // if we are anchored, then no cursors that say we can move if ( fAnchored ) diff --git a/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIDragBarCtrl.h b/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIDragBarCtrl.h index 05bdaa99..31df6fb2 100644 --- a/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIDragBarCtrl.h +++ b/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIDragBarCtrl.h @@ -60,9 +60,9 @@ class pfGUIDragBarCtrl : public pfGUIControlMod hsBool fDragging; hsBool fAnchored; - virtual hsBool IEval( double secs, hsScalar del, UInt32 dirty ); // called only by owner object's Eval() + virtual hsBool IEval( double secs, float del, uint32_t dirty ); // called only by owner object's Eval() - virtual UInt32 IGetDesiredCursor( void ) const; // As specified in plInputInterface.h + virtual uint32_t IGetDesiredCursor( void ) const; // As specified in plInputInterface.h public: @@ -78,9 +78,9 @@ class pfGUIDragBarCtrl : public pfGUIControlMod virtual void Read( hsStream* s, hsResMgr* mgr ); virtual void Write( hsStream* s, hsResMgr* mgr ); - virtual void HandleMouseDown( hsPoint3 &mousePt, UInt8 modifiers ); - virtual void HandleMouseUp( hsPoint3 &mousePt, UInt8 modifiers ); - virtual void HandleMouseDrag( hsPoint3 &mousePt, UInt8 modifiers ); + virtual void HandleMouseDown( hsPoint3 &mousePt, uint8_t modifiers ); + virtual void HandleMouseUp( hsPoint3 &mousePt, uint8_t modifiers ); + virtual void HandleMouseDrag( hsPoint3 &mousePt, uint8_t modifiers ); virtual void SetAnchored( hsBool anchored ) { fAnchored = anchored; } virtual hsBool IsAnchored(void) { return fAnchored; } diff --git a/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIDraggableMod.cpp b/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIDraggableMod.cpp index 832ae9e7..4e614637 100644 --- a/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIDraggableMod.cpp +++ b/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIDraggableMod.cpp @@ -45,7 +45,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // // ////////////////////////////////////////////////////////////////////////////// -#include "hsTypes.h" +#include "HeadSpin.h" #include "pfGUIDraggableMod.h" #include "pfGameGUIMgr.h" @@ -72,7 +72,7 @@ pfGUIDraggableMod::~pfGUIDraggableMod() //// IEval /////////////////////////////////////////////////////////////////// -hsBool pfGUIDraggableMod::IEval( double secs, hsScalar del, UInt32 dirty ) +hsBool pfGUIDraggableMod::IEval( double secs, float del, uint32_t dirty ) { return pfGUIControlMod::IEval( secs, del, dirty ); } @@ -106,7 +106,7 @@ void pfGUIDraggableMod::UpdateBounds( hsMatrix44 *invXformMatrix, hsBool forc //// HandleMouseDown/Up ////////////////////////////////////////////////////// -void pfGUIDraggableMod::HandleMouseDown( hsPoint3 &mousePt, UInt8 modifiers ) +void pfGUIDraggableMod::HandleMouseDown( hsPoint3 &mousePt, uint8_t modifiers ) { if( !fDragging ) { @@ -122,7 +122,7 @@ void pfGUIDraggableMod::HandleMouseDown( hsPoint3 &mousePt, UInt8 modifiers ) } } -void pfGUIDraggableMod::HandleMouseUp( hsPoint3 &mousePt, UInt8 modifiers ) +void pfGUIDraggableMod::HandleMouseUp( hsPoint3 &mousePt, uint8_t modifiers ) { if( fDragging ) { @@ -137,7 +137,7 @@ void pfGUIDraggableMod::HandleMouseUp( hsPoint3 &mousePt, UInt8 modifiers ) } } -void pfGUIDraggableMod::HandleMouseDrag( hsPoint3 &mousePt, UInt8 modifiers ) +void pfGUIDraggableMod::HandleMouseDrag( hsPoint3 &mousePt, uint8_t modifiers ) { if( fDragging ) { @@ -152,7 +152,7 @@ void pfGUIDraggableMod::HandleMouseDrag( hsPoint3 &mousePt, UInt8 modifiers ) //// IGetDesiredCursor /////////////////////////////////////////////////////// -UInt32 pfGUIDraggableMod::IGetDesiredCursor( void ) const +uint32_t pfGUIDraggableMod::IGetDesiredCursor( void ) const { // if we are anchored, then no cursors that say we can move if( fDragging ) diff --git a/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIDraggableMod.h b/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIDraggableMod.h index 481925f5..d113db1b 100644 --- a/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIDraggableMod.h +++ b/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIDraggableMod.h @@ -61,9 +61,9 @@ class pfGUIDraggableMod : public pfGUIControlMod hsBool fDragging; - virtual hsBool IEval( double secs, hsScalar del, UInt32 dirty ); // called only by owner object's Eval() + virtual hsBool IEval( double secs, float del, uint32_t dirty ); // called only by owner object's Eval() - virtual UInt32 IGetDesiredCursor( void ) const; // As specified in plInputInterface.h + virtual uint32_t IGetDesiredCursor( void ) const; // As specified in plInputInterface.h public: @@ -93,9 +93,9 @@ class pfGUIDraggableMod : public pfGUIControlMod virtual void Read( hsStream* s, hsResMgr* mgr ); virtual void Write( hsStream* s, hsResMgr* mgr ); - virtual void HandleMouseDown( hsPoint3 &mousePt, UInt8 modifiers ); - virtual void HandleMouseUp( hsPoint3 &mousePt, UInt8 modifiers ); - virtual void HandleMouseDrag( hsPoint3 &mousePt, UInt8 modifiers ); + virtual void HandleMouseDown( hsPoint3 &mousePt, uint8_t modifiers ); + virtual void HandleMouseUp( hsPoint3 &mousePt, uint8_t modifiers ); + virtual void HandleMouseDrag( hsPoint3 &mousePt, uint8_t modifiers ); virtual void UpdateBounds( hsMatrix44 *invXformMatrix = nil, hsBool force = false ); diff --git a/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIDynDisplayCtrl.cpp b/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIDynDisplayCtrl.cpp index b243ed6e..ca12ac62 100644 --- a/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIDynDisplayCtrl.cpp +++ b/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIDynDisplayCtrl.cpp @@ -45,7 +45,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // // ////////////////////////////////////////////////////////////////////////////// -#include "hsTypes.h" +#include "HeadSpin.h" #include "pfGUIDynDisplayCtrl.h" #include "pfGameGUIMgr.h" @@ -72,7 +72,7 @@ pfGUIDynDisplayCtrl::~pfGUIDynDisplayCtrl() //// IEval /////////////////////////////////////////////////////////////////// -hsBool pfGUIDynDisplayCtrl::IEval( double secs, hsScalar del, UInt32 dirty ) +hsBool pfGUIDynDisplayCtrl::IEval( double secs, float del, uint32_t dirty ) { return pfGUIControlMod::IEval( secs, del, dirty ); } @@ -116,7 +116,7 @@ hsBool pfGUIDynDisplayCtrl::MsgReceive( plMessage *msg ) void pfGUIDynDisplayCtrl::Read( hsStream *s, hsResMgr *mgr ) { - UInt32 count, i; + uint32_t count, i; pfGUIControlMod::Read(s, mgr); @@ -124,22 +124,22 @@ void pfGUIDynDisplayCtrl::Read( hsStream *s, hsResMgr *mgr ) count = s->ReadLE32(); fTextMaps.SetCountAndZero( count ); for( i = 0; i < count; i++ ) - mgr->ReadKeyNotifyMe( s, TRACKED_NEW plGenRefMsg( GetKey(), plRefMsg::kOnCreate, i, kRefTextMap ), plRefFlags::kActiveRef ); + mgr->ReadKeyNotifyMe( s, new plGenRefMsg( GetKey(), plRefMsg::kOnCreate, i, kRefTextMap ), plRefFlags::kActiveRef ); count = s->ReadLE32(); fLayers.SetCountAndZero( count ); for( i = 0; i < count; i++ ) - mgr->ReadKeyNotifyMe( s, TRACKED_NEW plGenRefMsg( GetKey(), plRefMsg::kOnCreate, i, kRefLayer ), plRefFlags::kActiveRef ); + mgr->ReadKeyNotifyMe( s, new plGenRefMsg( GetKey(), plRefMsg::kOnCreate, i, kRefLayer ), plRefFlags::kActiveRef ); count = s->ReadLE32(); fMaterials.SetCountAndZero( count ); for( i = 0; i < count; i++ ) - mgr->ReadKeyNotifyMe( s, TRACKED_NEW plGenRefMsg( GetKey(), plRefMsg::kOnCreate, i, kRefMaterial ), plRefFlags::kActiveRef ); + mgr->ReadKeyNotifyMe( s, new plGenRefMsg( GetKey(), plRefMsg::kOnCreate, i, kRefMaterial ), plRefFlags::kActiveRef ); } void pfGUIDynDisplayCtrl::Write( hsStream *s, hsResMgr *mgr ) { - UInt32 i; + uint32_t i; pfGUIControlMod::Write( s, mgr ); @@ -163,7 +163,7 @@ void pfGUIDynDisplayCtrl::Write( hsStream *s, hsResMgr *mgr ) void pfGUIDynDisplayCtrl::AddMap( plDynamicTextMap *map ) { fTextMaps.Append( map ); - hsgResMgr::ResMgr()->AddViaNotify( map->GetKey(), TRACKED_NEW plGenRefMsg( GetKey(), plRefMsg::kOnCreate, fTextMaps.GetCount() - 1, kRefTextMap ), plRefFlags::kActiveRef ); + hsgResMgr::ResMgr()->AddViaNotify( map->GetKey(), new plGenRefMsg( GetKey(), plRefMsg::kOnCreate, fTextMaps.GetCount() - 1, kRefTextMap ), plRefFlags::kActiveRef ); } //// AddLayer //////////////////////////////////////////////////////////////// @@ -172,7 +172,7 @@ void pfGUIDynDisplayCtrl::AddMap( plDynamicTextMap *map ) void pfGUIDynDisplayCtrl::AddLayer( plLayerInterface *layer ) { fLayers.Append( layer ); - hsgResMgr::ResMgr()->AddViaNotify( layer->GetKey(), TRACKED_NEW plGenRefMsg( GetKey(), plRefMsg::kOnCreate, fLayers.GetCount() - 1, kRefLayer ), plRefFlags::kActiveRef ); + hsgResMgr::ResMgr()->AddViaNotify( layer->GetKey(), new plGenRefMsg( GetKey(), plRefMsg::kOnCreate, fLayers.GetCount() - 1, kRefLayer ), plRefFlags::kActiveRef ); } //// AddMaterial ///////////////////////////////////////////////////////////// @@ -181,5 +181,5 @@ void pfGUIDynDisplayCtrl::AddLayer( plLayerInterface *layer ) void pfGUIDynDisplayCtrl::AddMaterial( hsGMaterial *material ) { fMaterials.Append( material ); - hsgResMgr::ResMgr()->AddViaNotify( material->GetKey(), TRACKED_NEW plGenRefMsg( GetKey(), plRefMsg::kOnCreate, fMaterials.GetCount() - 1, kRefMaterial ), plRefFlags::kActiveRef ); + hsgResMgr::ResMgr()->AddViaNotify( material->GetKey(), new plGenRefMsg( GetKey(), plRefMsg::kOnCreate, fMaterials.GetCount() - 1, kRefMaterial ), plRefFlags::kActiveRef ); } diff --git a/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIDynDisplayCtrl.h b/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIDynDisplayCtrl.h index 68438f23..931875c1 100644 --- a/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIDynDisplayCtrl.h +++ b/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIDynDisplayCtrl.h @@ -79,7 +79,7 @@ class pfGUIDynDisplayCtrl : public pfGUIControlMod hsTArray fMaterials; - virtual hsBool IEval( double secs, hsScalar del, UInt32 dirty ); // called only by owner object's Eval() + virtual hsBool IEval( double secs, float del, uint32_t dirty ); // called only by owner object's Eval() public: @@ -95,14 +95,14 @@ class pfGUIDynDisplayCtrl : public pfGUIControlMod virtual void Read( hsStream* s, hsResMgr* mgr ); virtual void Write( hsStream* s, hsResMgr* mgr ); - UInt32 GetNumMaps( void ) const { return fTextMaps.GetCount(); } - plDynamicTextMap *GetMap( UInt32 i ) const { return fTextMaps[ i ]; } + uint32_t GetNumMaps( void ) const { return fTextMaps.GetCount(); } + plDynamicTextMap *GetMap( uint32_t i ) const { return fTextMaps[ i ]; } - UInt32 GetNumLayers( void ) const { return fLayers.GetCount(); } - plLayerInterface *GetLayer( UInt32 i ) const { return fLayers[ i ]; } + uint32_t GetNumLayers( void ) const { return fLayers.GetCount(); } + plLayerInterface *GetLayer( uint32_t i ) const { return fLayers[ i ]; } - UInt32 GetNumMaterials( void ) const { return fMaterials.GetCount(); } - hsGMaterial *GetMaterial( UInt32 i ) const { return fMaterials[ i ]; } + uint32_t GetNumMaterials( void ) const { return fMaterials.GetCount(); } + hsGMaterial *GetMaterial( uint32_t i ) const { return fMaterials[ i ]; } // Export only void AddMap( plDynamicTextMap *map ); diff --git a/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIEditBoxMod.cpp b/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIEditBoxMod.cpp index 3df383be..7b6e8880 100644 --- a/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIEditBoxMod.cpp +++ b/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIEditBoxMod.cpp @@ -49,7 +49,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com //#define LIMIT_VOICE_CHAT 1 #endif -#include "hsTypes.h" +#include "HeadSpin.h" #include "pfGUIEditBoxMod.h" #include "pfGameGUIMgr.h" @@ -86,7 +86,7 @@ pfGUIEditBoxMod::~pfGUIEditBoxMod() //// IEval /////////////////////////////////////////////////////////////////// -hsBool pfGUIEditBoxMod::IEval( double secs, hsScalar del, UInt32 dirty ) +hsBool pfGUIEditBoxMod::IEval( double secs, float del, uint32_t dirty ) { return pfGUIControlMod::IEval( secs, del, dirty ); } @@ -126,7 +126,7 @@ void pfGUIEditBoxMod::IUpdate( void ) if( fBuffer != nil ) { // First, calc the cursor position, so we can adjust the scrollPos as necessary - Int16 cursorPos, oldCursorPos; + int16_t cursorPos, oldCursorPos; if( fFocused && !fSpecialCaptureKeyEventMode ) { // Really cheap hack here to figure out where to draw the cursor @@ -136,7 +136,7 @@ void pfGUIEditBoxMod::IUpdate( void ) fBuffer[ fCursorPos ] = backup; oldCursorPos = cursorPos; - cursorPos -= (Int16)fScrollPos; + cursorPos -= (int16_t)fScrollPos; if( 4 + cursorPos > fDynTextMap->GetVisibleWidth() - 18 ) { @@ -149,7 +149,7 @@ void pfGUIEditBoxMod::IUpdate( void ) fScrollPos = 0; } - cursorPos = (Int16)(oldCursorPos - fScrollPos); + cursorPos = (int16_t)(oldCursorPos - fScrollPos); } if ( fFocused && fSpecialCaptureKeyEventMode ) @@ -159,7 +159,7 @@ void pfGUIEditBoxMod::IUpdate( void ) else fDynTextMap->SetTextColor( GetColorScheme()->fForeColor, GetColorScheme()->fTransparent && GetColorScheme()->fBackColor.a == 0.f ); - fDynTextMap->DrawClippedString( (Int16)(4 - fScrollPos), 4, fBuffer, + fDynTextMap->DrawClippedString( (int16_t)(4 - fScrollPos), 4, fBuffer, 4, 4, fDynTextMap->GetVisibleWidth() - 8, fDynTextMap->GetVisibleHeight() - 8 ); if( fFocused && !fSpecialCaptureKeyEventMode ) @@ -193,10 +193,10 @@ void pfGUIEditBoxMod::Write( hsStream *s, hsResMgr *mgr ) // (if any). Shift-click and ctrl-click avoids the deselect and toggles // the item clicked on. -void pfGUIEditBoxMod::HandleMouseDown( hsPoint3 &mousePt, UInt8 modifiers ) +void pfGUIEditBoxMod::HandleMouseDown( hsPoint3 &mousePt, uint8_t modifiers ) { wchar_t backup; - UInt16 width; + uint16_t width; if( fBuffer != nil && fDynTextMap != nil ) @@ -225,17 +225,17 @@ void pfGUIEditBoxMod::HandleMouseDown( hsPoint3 &mousePt, UInt8 modifiers ) //// HandleMouseUp /////////////////////////////////////////////////////////// -void pfGUIEditBoxMod::HandleMouseUp( hsPoint3 &mousePt, UInt8 modifiers ) +void pfGUIEditBoxMod::HandleMouseUp( hsPoint3 &mousePt, uint8_t modifiers ) { } //// HandleMouseDrag ///////////////////////////////////////////////////////// -void pfGUIEditBoxMod::HandleMouseDrag( hsPoint3 &mousePt, UInt8 modifiers ) +void pfGUIEditBoxMod::HandleMouseDrag( hsPoint3 &mousePt, uint8_t modifiers ) { } -hsBool pfGUIEditBoxMod::HandleKeyPress( wchar_t key, UInt8 modifiers ) +hsBool pfGUIEditBoxMod::HandleKeyPress( wchar_t key, uint8_t modifiers ) { if( fBuffer == nil ) return false; @@ -262,7 +262,7 @@ hsBool pfGUIEditBoxMod::HandleKeyPress( wchar_t key, UInt8 modifiers ) return true; } -hsBool pfGUIEditBoxMod::HandleKeyEvent( pfGameGUIMgr::EventType event, plKeyDef key, UInt8 modifiers ) +hsBool pfGUIEditBoxMod::HandleKeyEvent( pfGameGUIMgr::EventType event, plKeyDef key, uint8_t modifiers ) { if ( fSpecialCaptureKeyEventMode) { @@ -470,14 +470,14 @@ void pfGUIEditBoxMod::SetText( const wchar_t *str ) } } -void pfGUIEditBoxMod::SetBufferSize( UInt32 size ) +void pfGUIEditBoxMod::SetBufferSize( uint32_t size ) { delete [] fBuffer; fBufferSize = size; if( size > 0 ) { - fBuffer = TRACKED_NEW wchar_t[ size + 1 ]; + fBuffer = new wchar_t[ size + 1 ]; memset( fBuffer, 0, (size + 1) * sizeof(wchar_t) ); } else @@ -499,7 +499,7 @@ void pfGUIEditBoxMod::SetCursorToEnd( void ) fCursorPos = wcslen( fBuffer ); } -void pfGUIEditBoxMod::SetLastKeyCapture(UInt32 key, UInt8 modifiers) +void pfGUIEditBoxMod::SetLastKeyCapture(uint32_t key, uint8_t modifiers) { // capture the key fSavedKey = (plKeyDef)key; diff --git a/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIEditBoxMod.h b/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIEditBoxMod.h index 30eeece1..d0f1e609 100644 --- a/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIEditBoxMod.h +++ b/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIEditBoxMod.h @@ -64,17 +64,17 @@ class pfGUIEditBoxMod : public pfGUIControlMod protected: wchar_t *fBuffer; - UInt32 fBufferSize, fCursorPos; - Int32 fScrollPos; + uint32_t fBufferSize, fCursorPos; + int32_t fScrollPos; hsBool fIgnoreNextKey, fEscapedFlag; hsBool fFirstHalfExitKeyPushed; hsBool fSpecialCaptureKeyEventMode; plKeyDef fSavedKey; - UInt8 fSavedModifiers; + uint8_t fSavedModifiers; - virtual hsBool IEval( double secs, hsScalar del, UInt32 dirty ); // called only by owner object's Eval() + virtual hsBool IEval( double secs, float del, uint32_t dirty ); // called only by owner object's Eval() virtual void IPostSetUpDynTextMap( void ); virtual void IUpdate( void ); @@ -97,16 +97,16 @@ class pfGUIEditBoxMod : public pfGUIControlMod virtual void Read( hsStream* s, hsResMgr* mgr ); virtual void Write( hsStream* s, hsResMgr* mgr ); - virtual void HandleMouseDown( hsPoint3 &mousePt, UInt8 modifiers ); - virtual void HandleMouseUp( hsPoint3 &mousePt, UInt8 modifiers ); - virtual void HandleMouseDrag( hsPoint3 &mousePt, UInt8 modifiers ); + virtual void HandleMouseDown( hsPoint3 &mousePt, uint8_t modifiers ); + virtual void HandleMouseUp( hsPoint3 &mousePt, uint8_t modifiers ); + virtual void HandleMouseDrag( hsPoint3 &mousePt, uint8_t modifiers ); - virtual hsBool HandleKeyPress( wchar_t key, UInt8 modifiers ); - virtual hsBool HandleKeyEvent( pfGameGUIMgr::EventType event, plKeyDef key, UInt8 modifiers ); + virtual hsBool HandleKeyPress( wchar_t key, uint8_t modifiers ); + virtual hsBool HandleKeyEvent( pfGameGUIMgr::EventType event, plKeyDef key, uint8_t modifiers ); virtual void PurgeDynaTextMapImage(); - void SetBufferSize( UInt32 size ); + void SetBufferSize( uint32_t size ); std::string GetBuffer( void ); std::wstring GetBufferW( void ) { return fBuffer; } @@ -120,9 +120,9 @@ class pfGUIEditBoxMod : public pfGUIControlMod hsBool WasEscaped( void ) { hsBool e = fEscapedFlag; fEscapedFlag = false; return e; } void SetSpecialCaptureKeyMode(hsBool state) { fSpecialCaptureKeyEventMode = state; } - UInt32 GetLastKeyCaptured() { return (UInt32)fSavedKey; } - UInt8 GetLastModifiersCaptured() { return fSavedModifiers; } - void SetLastKeyCapture(UInt32 key, UInt8 modifiers); + uint32_t GetLastKeyCaptured() { return (uint32_t)fSavedKey; } + uint8_t GetLastModifiersCaptured() { return fSavedModifiers; } + void SetLastKeyCapture(uint32_t key, uint8_t modifiers); void SetChatMode(hsBool state) { plKeyboardDevice::IgnoreCapsLock(state); } diff --git a/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIKnobCtrl.cpp b/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIKnobCtrl.cpp index def6b884..45a2ca64 100644 --- a/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIKnobCtrl.cpp +++ b/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIKnobCtrl.cpp @@ -45,7 +45,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // // ////////////////////////////////////////////////////////////////////////////// -#include "hsTypes.h" +#include "HeadSpin.h" #include "pfGUIKnobCtrl.h" #include "pfGameGUIMgr.h" #include "pfGUIDialogMod.h" @@ -90,7 +90,7 @@ pfGUIKnobCtrl::~pfGUIKnobCtrl() //// IEval /////////////////////////////////////////////////////////////////// -hsBool pfGUIKnobCtrl::IEval( double secs, hsScalar del, UInt32 dirty ) +hsBool pfGUIKnobCtrl::IEval( double secs, float del, uint32_t dirty ) { return pfGUIValueCtrl::IEval( secs, del, dirty ); } @@ -109,7 +109,7 @@ void pfGUIKnobCtrl::Read( hsStream *s, hsResMgr *mgr ) pfGUIValueCtrl::Read(s, mgr); fAnimationKeys.Reset(); - UInt32 i, count = s->ReadLE32(); + uint32_t i, count = s->ReadLE32(); for( i = 0; i < count; i++ ) fAnimationKeys.Append( mgr->ReadKey( s ) ); fAnimName = s->ReadSafeString(); @@ -124,7 +124,7 @@ void pfGUIKnobCtrl::Write( hsStream *s, hsResMgr *mgr ) { pfGUIValueCtrl::Write( s, mgr ); - UInt32 i, count = fAnimationKeys.GetCount(); + uint32_t i, count = fAnimationKeys.GetCount(); s->WriteLE32( count ); for( i = 0; i < count; i++ ) mgr->WriteKey( s, fAnimationKeys[ i ] ); @@ -145,7 +145,7 @@ void pfGUIKnobCtrl::UpdateBounds( hsMatrix44 *invXformMatrix, hsBool force ) //// HandleMouseDown/Up ////////////////////////////////////////////////////// -void pfGUIKnobCtrl::HandleMouseDown( hsPoint3 &mousePt, UInt8 modifiers ) +void pfGUIKnobCtrl::HandleMouseDown( hsPoint3 &mousePt, uint8_t modifiers ) { fDragStart = mousePt; fDragValue = fValue; @@ -202,15 +202,15 @@ void pfGUIKnobCtrl::HandleMouseDown( hsPoint3 &mousePt, UInt8 modifiers ) fDragRangeMin = -1; } -void pfGUIKnobCtrl::HandleMouseUp( hsPoint3 &mousePt, UInt8 modifiers ) +void pfGUIKnobCtrl::HandleMouseUp( hsPoint3 &mousePt, uint8_t modifiers ) { fDragging = false; HandleMouseDrag( mousePt, modifiers ); } -void pfGUIKnobCtrl::HandleMouseDrag( hsPoint3 &mousePt, UInt8 modifiers ) +void pfGUIKnobCtrl::HandleMouseDrag( hsPoint3 &mousePt, uint8_t modifiers ) { - hsScalar oldValue = fValue, newValue = fDragValue; + float oldValue = fValue, newValue = fDragValue; if( fDragRangeMin != -1 ) { @@ -242,7 +242,7 @@ void pfGUIKnobCtrl::HandleMouseDrag( hsPoint3 &mousePt, UInt8 modifiers ) } else { - hsScalar diff; + float diff; if( HasFlag( kLeftRightOrientation ) ) diff = ( mousePt.fX - fDragStart.fX ) * 20.f; else @@ -268,7 +268,7 @@ void pfGUIKnobCtrl::SetAnimationKeys( hsTArray &keys, const char *name delete [] fAnimName; if( name != nil ) { - fAnimName = TRACKED_NEW char[ strlen( name ) + 1 ]; + fAnimName = new char[ strlen( name ) + 1 ]; strcpy( fAnimName, name ); } else @@ -284,7 +284,7 @@ hsBool pfGUIKnobCtrl::ICalcAnimTimes( void ) if( fAnimTimesCalced ) return true; - hsScalar tBegin = 1e30, tEnd = -1e30; + float tBegin = 1e30, tEnd = -1e30; bool foundOne = false; for( int i = 0; i < fAnimationKeys.GetCount(); i++ ) @@ -295,8 +295,8 @@ hsBool pfGUIKnobCtrl::ICalcAnimTimes( void ) { for( int j = 0; j < mod->GetNumAnimations(); j++ ) { - hsScalar begin = mod->GetAnimInstance( j )->GetTimeConvert()->GetBegin(); - hsScalar end = mod->GetAnimInstance( j )->GetTimeConvert()->GetEnd(); + float begin = mod->GetAnimInstance( j )->GetTimeConvert()->GetBegin(); + float end = mod->GetAnimInstance( j )->GetTimeConvert()->GetEnd(); if( begin < tBegin ) tBegin = begin; if( end > tEnd ) @@ -308,8 +308,8 @@ hsBool pfGUIKnobCtrl::ICalcAnimTimes( void ) plLayerAnimation *layer = plLayerAnimation::ConvertNoRef( fAnimationKeys[ i ]->ObjectIsLoaded() ); if( layer != nil ) { - hsScalar begin = layer->GetTimeConvert().GetBegin(); - hsScalar end = layer->GetTimeConvert().GetEnd(); + float begin = layer->GetTimeConvert().GetBegin(); + float end = layer->GetTimeConvert().GetEnd(); if( begin < tBegin ) tBegin = begin; if( end > tEnd ) @@ -331,7 +331,7 @@ hsBool pfGUIKnobCtrl::ICalcAnimTimes( void ) //// SetCurrValue //////////////////////////////////////////////////////////// -void pfGUIKnobCtrl::SetCurrValue( hsScalar v ) +void pfGUIKnobCtrl::SetCurrValue( float v ) { int old = (int)fValue; pfGUIValueCtrl::SetCurrValue( v ); @@ -343,8 +343,8 @@ void pfGUIKnobCtrl::SetCurrValue( hsScalar v ) { ICalcAnimTimes(); - hsScalar tLength = fAnimEnd - fAnimBegin; - hsScalar newTime = fMin; + float tLength = fAnimEnd - fAnimBegin; + float newTime = fMin; if (fMin != fMax) // Protect against div by zero { @@ -353,7 +353,7 @@ void pfGUIKnobCtrl::SetCurrValue( hsScalar v ) else newTime = ( ( fValue - fMin ) / ( fMax - fMin ) ) * tLength + fAnimBegin; } - plAnimCmdMsg *msg = TRACKED_NEW plAnimCmdMsg(); + plAnimCmdMsg *msg = new plAnimCmdMsg(); msg->SetCmd( plAnimCmdMsg::kGoToTime ); msg->SetAnimName( fAnimName ); msg->fTime = newTime; @@ -364,7 +364,7 @@ void pfGUIKnobCtrl::SetCurrValue( hsScalar v ) //// IGetDesiredCursor /////////////////////////////////////////////////////// -UInt32 pfGUIKnobCtrl::IGetDesiredCursor( void ) const +uint32_t pfGUIKnobCtrl::IGetDesiredCursor( void ) const { if( HasFlag( kLeftRightOrientation ) ) { diff --git a/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIKnobCtrl.h b/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIKnobCtrl.h index d9fcc44c..c58753c6 100644 --- a/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIKnobCtrl.h +++ b/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIKnobCtrl.h @@ -61,19 +61,19 @@ class pfGUIKnobCtrl : public pfGUIValueCtrl char *fAnimName; hsPoint3 fDragStart; - hsScalar fDragValue; + float fDragValue; hsBool fDragging; hsPoint3 fAnimStartPos, fAnimEndPos; // Calculated at export time for kMapToScreenRange - hsScalar fDragRangeMin, fDragRangeMax; + float fDragRangeMin, fDragRangeMax; // Computed once, once an anim is loaded that we can compute this with - hsScalar fAnimBegin, fAnimEnd; + float fAnimBegin, fAnimEnd; hsBool fAnimTimesCalced; - virtual hsBool IEval( double secs, hsScalar del, UInt32 dirty ); // called only by owner object's Eval() + virtual hsBool IEval( double secs, float del, uint32_t dirty ); // called only by owner object's Eval() - virtual UInt32 IGetDesiredCursor( void ) const; // As specified in plInputInterface.h + virtual uint32_t IGetDesiredCursor( void ) const; // As specified in plInputInterface.h hsBool ICalcAnimTimes( void ); @@ -100,13 +100,13 @@ class pfGUIKnobCtrl : public pfGUIValueCtrl virtual void Read( hsStream* s, hsResMgr* mgr ); virtual void Write( hsStream* s, hsResMgr* mgr ); - virtual void HandleMouseDown( hsPoint3 &mousePt, UInt8 modifiers ); - virtual void HandleMouseUp( hsPoint3 &mousePt, UInt8 modifiers ); - virtual void HandleMouseDrag( hsPoint3 &mousePt, UInt8 modifiers ); + virtual void HandleMouseDown( hsPoint3 &mousePt, uint8_t modifiers ); + virtual void HandleMouseUp( hsPoint3 &mousePt, uint8_t modifiers ); + virtual void HandleMouseDrag( hsPoint3 &mousePt, uint8_t modifiers ); virtual void UpdateBounds( hsMatrix44 *invXformMatrix = nil, hsBool force = false ); - virtual void SetCurrValue( hsScalar v ); + virtual void SetCurrValue( float v ); // Export only void SetAnimationKeys( hsTArray &keys, const char *name ); diff --git a/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIListBoxMod.cpp b/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIListBoxMod.cpp index 17d2ca6d..6cb1c5e2 100644 --- a/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIListBoxMod.cpp +++ b/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIListBoxMod.cpp @@ -45,7 +45,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // // ////////////////////////////////////////////////////////////////////////////// -#include "hsTypes.h" +#include "HeadSpin.h" #include "pfGUIListBoxMod.h" #include "pfGUIListElement.h" #include "pfGameGUIMgr.h" @@ -68,7 +68,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com //// plSmallRect Stuff /////////////////////////////////////////////////////// -void pfGUIListBoxMod::plSmallRect::Set( Int16 l, Int16 t, Int16 r, Int16 b ) +void pfGUIListBoxMod::plSmallRect::Set( int16_t l, int16_t t, int16_t r, int16_t b ) { fLeft = l; fTop = t; @@ -76,7 +76,7 @@ void pfGUIListBoxMod::plSmallRect::Set( Int16 l, Int16 t, Int16 r, Int16 b ) fBottom = b; } -hsBool pfGUIListBoxMod::plSmallRect::Contains( Int16 x, Int16 y ) +hsBool pfGUIListBoxMod::plSmallRect::Contains( int16_t x, int16_t y ) { if( x < fLeft || x > fRight || y < fTop || y > fBottom ) return false; @@ -140,7 +140,7 @@ pfGUIListBoxMod::~pfGUIListBoxMod() //// IEval /////////////////////////////////////////////////////////////////// -hsBool pfGUIListBoxMod::IEval( double secs, hsScalar del, UInt32 dirty ) +hsBool pfGUIListBoxMod::IEval( double secs, float del, uint32_t dirty ) { return pfGUIControlMod::IEval( secs, del, dirty ); } @@ -190,7 +190,7 @@ void pfGUIListBoxMod::IPostSetUpDynTextMap( void ) void pfGUIListBoxMod::IUpdate( void ) { int i, j; - UInt16 x, y, width, height, maxHeight; + uint16_t x, y, width, height, maxHeight; if( !fReadyToRoll ) @@ -242,7 +242,7 @@ void pfGUIListBoxMod::IUpdate( void ) { // Shit. Move the scrollPos up to this item at the very least fScrollPos = j; - fScrollControl->SetCurrValue( (hsScalar)( (int)fScrollControl->GetMax() - fScrollPos ) ); + fScrollControl->SetCurrValue( (float)( (int)fScrollControl->GetMax() - fScrollPos ) ); fCheckScroll = false; break; } @@ -345,7 +345,7 @@ void pfGUIListBoxMod::IUpdate( void ) if( anySelected ) { fScrollPos = j; - fScrollControl->SetCurrValue( (hsScalar)( (int)fScrollControl->GetMax() - fScrollPos ) ); + fScrollControl->SetCurrValue( (float)( (int)fScrollControl->GetMax() - fScrollPos ) ); IUpdate(); // Gotta update again, since we just changed the scrollPos after the fact return; } @@ -361,7 +361,7 @@ void pfGUIListBoxMod::IUpdate( void ) void pfGUIListBoxMod::ICalcWrapStarts( void ) { - UInt16 i, x, y, maxHeight, width, height; + uint16_t i, x, y, maxHeight, width, height; fWrapStartIdxs.Reset(); @@ -370,7 +370,7 @@ void pfGUIListBoxMod::ICalcWrapStarts( void ) { if( !HasFlag( kScrollLeftToRight ) ) { - for( i = 0, x = (UInt16)-1, y = 4, maxHeight = 0; i < fElements.GetCount(); i++ ) + for( i = 0, x = (uint16_t)-1, y = 4, maxHeight = 0; i < fElements.GetCount(); i++ ) { fElements[ i ]->GetSize( fDynTextMap, &width, &height ); @@ -387,7 +387,7 @@ void pfGUIListBoxMod::ICalcWrapStarts( void ) } else { - for( i = 0, y = (UInt16)-1, x = 4, maxHeight = 0; i < fElements.GetCount(); i++ ) + for( i = 0, y = (uint16_t)-1, x = 4, maxHeight = 0; i < fElements.GetCount(); i++ ) { fElements[ i ]->GetSize( fDynTextMap, &width, &height ); if( y + height >= fDynTextMap->GetVisibleHeight() ) @@ -419,7 +419,7 @@ void pfGUIListBoxMod::ICalcWrapStarts( void ) void pfGUIListBoxMod::ICalcScrollRange( void ) { - UInt16 ctrlHt, ctrlWd, height, width, maxHeight; + uint16_t ctrlHt, ctrlWd, height, width, maxHeight; int i, j, end; @@ -495,9 +495,9 @@ void pfGUIListBoxMod::ICalcScrollRange( void ) // Smaller than the viewing area, so we don't scroll at all fScrollControl->SetRange( 0.f, 0.f ); else - fScrollControl->SetRange( 0.f, (hsScalar)( i + 1 ) ); + fScrollControl->SetRange( 0.f, (float)( i + 1 ) ); - fScrollControl->SetCurrValue( (hsScalar)( (int)fScrollControl->GetMax() - fScrollPos ) ); + fScrollControl->SetCurrValue( (float)( (int)fScrollControl->GetMax() - fScrollPos ) ); } } @@ -516,9 +516,9 @@ void pfGUIListBoxMod::Read( hsStream *s, hsResMgr *mgr ) fScrollControl = nil; if( s->ReadBool() ) { - fScrollProc = TRACKED_NEW pfScrollProc( this ); + fScrollProc = new pfScrollProc( this ); fScrollProc->IncRef(); - mgr->ReadKeyNotifyMe( s, TRACKED_NEW plGenRefMsg( GetKey(), plRefMsg::kOnCreate, -1, kRefScrollCtrl ), plRefFlags::kActiveRef ); + mgr->ReadKeyNotifyMe( s, new plGenRefMsg( GetKey(), plRefMsg::kOnCreate, -1, kRefScrollCtrl ), plRefFlags::kActiveRef ); } if( HasFlag( kDisableSelection ) ) @@ -549,7 +549,7 @@ hsBool pfGUIListBoxMod::FilterMousePosition( hsPoint3 &mousePt ) if( !HasFlag( kAllowMousePassThrough ) ) return true; - Int32 hover = fCurrClick = IGetItemFromPoint( mousePt ); + int32_t hover = fCurrClick = IGetItemFromPoint( mousePt ); if( hover == -1 ) return false; @@ -561,9 +561,9 @@ hsBool pfGUIListBoxMod::FilterMousePosition( hsPoint3 &mousePt ) // (if any). Shift-click and ctrl-click avoids the deselect and toggles // the item clicked on. -void pfGUIListBoxMod::HandleMouseDown( hsPoint3 &mousePt, UInt8 modifiers ) +void pfGUIListBoxMod::HandleMouseDown( hsPoint3 &mousePt, uint8_t modifiers ) { - Int32 i; + int32_t i; int lastSelection = -1; if (HasFlag(kForbidNoSelection)) @@ -597,15 +597,15 @@ void pfGUIListBoxMod::HandleMouseDown( hsPoint3 &mousePt, UInt8 modifiers ) // Select our new range, deselect everything outside if( fCurrClick <= fMaxSel ) { - ISelectRange( 0, (Int8)(fCurrClick - 1), false ); - ISelectRange( (Int8)fCurrClick, (Int8)fMaxSel, true ); - ISelectRange( (Int8)(fMaxSel + 1), -1, false ); + ISelectRange( 0, (int8_t)(fCurrClick - 1), false ); + ISelectRange( (int8_t)fCurrClick, (int8_t)fMaxSel, true ); + ISelectRange( (int8_t)(fMaxSel + 1), -1, false ); } else if( fCurrClick >= fMinSel ) { - ISelectRange( 0, (Int8)(fMinSel - 1), false ); - ISelectRange( (Int8)fMinSel, (Int8)fCurrClick, true ); - ISelectRange( (Int8)(fCurrClick + 1), -1, false ); + ISelectRange( 0, (int8_t)(fMinSel - 1), false ); + ISelectRange( (int8_t)fMinSel, (int8_t)fCurrClick, true ); + ISelectRange( (int8_t)(fCurrClick + 1), -1, false ); } fElements[ fCurrClick ]->SetSelected( true ); } @@ -633,13 +633,13 @@ void pfGUIListBoxMod::HandleMouseDown( hsPoint3 &mousePt, UInt8 modifiers ) //// HandleMouseUp /////////////////////////////////////////////////////////// -void pfGUIListBoxMod::HandleMouseUp( hsPoint3 &mousePt, UInt8 modifiers ) +void pfGUIListBoxMod::HandleMouseUp( hsPoint3 &mousePt, uint8_t modifiers ) { fClicking = false; if( !( fModsAtDragTime & ( pfGameGUIMgr::kShiftDown | pfGameGUIMgr::kCtrlDown ) ) && !HasFlag( kHandsOffMultiSelect ) ) { // No modifiers--simply select whatever item we're on - Int32 item = IGetItemFromPoint( mousePt ); + int32_t item = IGetItemFromPoint( mousePt ); if( item != fCurrClick ) { if( fCurrClick >= 0 && fCurrClick < fElements.GetCount() ) @@ -665,8 +665,8 @@ void pfGUIListBoxMod::HandleMouseUp( hsPoint3 &mousePt, UInt8 modifiers ) hsPoint3 localPt = mousePt; IScreenToLocalPt( localPt ); - UInt16 lX = (UInt16)(( localPt.fX * ( fDynTextMap->GetVisibleWidth() - 1 ) ) - fElementBounds[ fCurrClick ].fLeft); - UInt16 lY = (UInt16)(( localPt.fY * ( fDynTextMap->GetVisibleHeight() - 1 ) )- fElementBounds[ fCurrClick ].fTop); + uint16_t lX = (uint16_t)(( localPt.fX * ( fDynTextMap->GetVisibleWidth() - 1 ) ) - fElementBounds[ fCurrClick ].fLeft); + uint16_t lY = (uint16_t)(( localPt.fY * ( fDynTextMap->GetVisibleHeight() - 1 ) )- fElementBounds[ fCurrClick ].fTop); if( fElements[ fCurrClick ]->MouseClicked( lX, lY ) ) { @@ -684,14 +684,14 @@ void pfGUIListBoxMod::HandleMouseUp( hsPoint3 &mousePt, UInt8 modifiers ) //// HandleMouseHover //////////////////////////////////////////////////////// // Just updates our currHover item so we can update the mouse appropriately -void pfGUIListBoxMod::HandleMouseHover( hsPoint3 &mousePt, UInt8 modifiers ) +void pfGUIListBoxMod::HandleMouseHover( hsPoint3 &mousePt, uint8_t modifiers ) { fCurrHover = IGetItemFromPoint( mousePt ); } //// HandleMouseDrag ///////////////////////////////////////////////////////// -void pfGUIListBoxMod::HandleMouseDrag( hsPoint3 &mousePt, UInt8 modifiers ) +void pfGUIListBoxMod::HandleMouseDrag( hsPoint3 &mousePt, uint8_t modifiers ) { int i; @@ -701,15 +701,15 @@ void pfGUIListBoxMod::HandleMouseDrag( hsPoint3 &mousePt, UInt8 modifiers ) // Select our new range, deselect everything outside if( fCurrClick <= fMaxSel ) { - ISelectRange( 0, (Int8)(fCurrClick - 1), false ); - ISelectRange( (Int8)fCurrClick, (Int8)fMaxSel, true ); - ISelectRange( (Int8)(fMaxSel + 1), -1, false ); + ISelectRange( 0, (int8_t)(fCurrClick - 1), false ); + ISelectRange( (int8_t)fCurrClick, (int8_t)fMaxSel, true ); + ISelectRange( (int8_t)(fMaxSel + 1), -1, false ); } else if( fCurrClick >= fMinSel ) { - ISelectRange( 0, (Int8)(fMinSel - 1), false ); - ISelectRange( (Int8)fMinSel, (Int8)fCurrClick, true ); - ISelectRange( (Int8)(fCurrClick + 1), -1, false ); + ISelectRange( 0, (int8_t)(fMinSel - 1), false ); + ISelectRange( (int8_t)fMinSel, (int8_t)fCurrClick, true ); + ISelectRange( (int8_t)(fCurrClick + 1), -1, false ); } IUpdate(); } @@ -731,7 +731,7 @@ void pfGUIListBoxMod::HandleMouseDrag( hsPoint3 &mousePt, UInt8 modifiers ) } else { - Int32 item = IGetItemFromPoint( mousePt ); + int32_t item = IGetItemFromPoint( mousePt ); if( item != fCurrClick ) { if( fCurrClick >= 0 && fCurrClick < fElements.GetCount() ) @@ -749,12 +749,12 @@ void pfGUIListBoxMod::HandleMouseDrag( hsPoint3 &mousePt, UInt8 modifiers ) //// HandleMouseDblClick ///////////////////////////////////////////////////// -void pfGUIListBoxMod::HandleMouseDblClick( hsPoint3 &mousePt, UInt8 modifiers ) +void pfGUIListBoxMod::HandleMouseDblClick( hsPoint3 &mousePt, uint8_t modifiers ) { if( !HasFlag( kGrowLeavesAndProcessOxygen ) ) return; // We only care about double clicks if we make oxygen - Int32 item = IGetItemFromPoint( mousePt ); + int32_t item = IGetItemFromPoint( mousePt ); if( item != -1 ) { if( fElements[ item ]->GetType() == pfGUIListElement::kTreeRoot ) @@ -774,20 +774,20 @@ void pfGUIListBoxMod::HandleMouseDblClick( hsPoint3 &mousePt, UInt8 modifiers //// IGetItemFromPoint /////////////////////////////////////////////////////// -Int32 pfGUIListBoxMod::IGetItemFromPoint( hsPoint3 &mousePt ) +int32_t pfGUIListBoxMod::IGetItemFromPoint( hsPoint3 &mousePt ) { if( !fBounds.IsInside( &mousePt ) ) return -1; hsPoint3 localPt = mousePt; // despite getting a ref to the point (why?) we do NOT want to modify it IScreenToLocalPt( localPt ); - UInt32 i; - Int16 clickItem = -1 , clickY = (Int16)( localPt.fY * ( fDynTextMap->GetVisibleHeight() - 1 ) ); - Int16 clickX = (Int16)( localPt.fX * ( fDynTextMap->GetVisibleWidth() - 1 ) ); + uint32_t i; + int16_t clickItem = -1 , clickY = (int16_t)( localPt.fY * ( fDynTextMap->GetVisibleHeight() - 1 ) ); + int16_t clickX = (int16_t)( localPt.fX * ( fDynTextMap->GetVisibleWidth() - 1 ) ); // We have a nice array that has the starting (top) Y's of each visible element. So we just // check against that. - UInt32 startAt = 0; + uint32_t startAt = 0; // make sure that we have a valid fScrollPos if ( fScrollPos != -1 ) { @@ -802,7 +802,7 @@ Int32 pfGUIListBoxMod::IGetItemFromPoint( hsPoint3 &mousePt ) { if( i= (int)fScrollControl->GetMin() && pos <= (int)fScrollControl->GetMax() ) { - fScrollControl->SetCurrValue( (hsScalar)pos ); + fScrollControl->SetCurrValue( (float)pos ); fScrollPos = (int)fScrollControl->GetMax() - pos; } IUpdate(); } -Int32 pfGUIListBoxMod::GetScrollPos( void ) +int32_t pfGUIListBoxMod::GetScrollPos( void ) { return (int)fScrollControl->GetCurrValue(); } -Int32 pfGUIListBoxMod::GetScrollRange( void ) +int32_t pfGUIListBoxMod::GetScrollRange( void ) { return (int)fScrollControl->GetMax() - (int)fScrollControl->GetMin(); } @@ -1065,9 +1065,9 @@ Int32 pfGUIListBoxMod::GetScrollRange( void ) //// Element Manipulation //////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////// -UInt16 pfGUIListBoxMod::AddElement( pfGUIListElement *el ) +uint16_t pfGUIListBoxMod::AddElement( pfGUIListElement *el ) { - UInt16 idx = fElements.GetCount(); + uint16_t idx = fElements.GetCount(); fElements.Append( el ); el->SetColorScheme( GetColorScheme() ); el->SetSkin( fSkin ); @@ -1081,10 +1081,10 @@ UInt16 pfGUIListBoxMod::AddElement( pfGUIListElement *el ) return idx; } -void pfGUIListBoxMod::RemoveElement( UInt16 index ) +void pfGUIListBoxMod::RemoveElement( uint16_t index ) { // Make sure no other elements care about this one - UInt16 i, j; + uint16_t i, j; for( i = 0; i < fElements.GetCount(); i++ ) { if( fElements[ i ]->GetType() == pfGUIListElement::kTreeRoot ) @@ -1118,7 +1118,7 @@ void pfGUIListBoxMod::RemoveElement( UInt16 index ) } } -Int16 pfGUIListBoxMod::FindElement( pfGUIListElement *toCompareTo ) +int16_t pfGUIListBoxMod::FindElement( pfGUIListElement *toCompareTo ) { int i; @@ -1129,7 +1129,7 @@ Int16 pfGUIListBoxMod::FindElement( pfGUIListElement *toCompareTo ) return i; } - return (Int16)-1; + return (int16_t)-1; } void pfGUIListBoxMod::ClearAllElements( void ) @@ -1152,34 +1152,34 @@ void pfGUIListBoxMod::ClearAllElements( void ) HandleExtendedEvent( pfGUIListBoxMod::kListCleared ); } -UInt16 pfGUIListBoxMod::AddString( const char *string ) +uint16_t pfGUIListBoxMod::AddString( const char *string ) { - return AddElement( TRACKED_NEW pfGUIListText( string ) ); + return AddElement( new pfGUIListText( string ) ); } -UInt16 pfGUIListBoxMod::AddString( const wchar_t *string ) +uint16_t pfGUIListBoxMod::AddString( const wchar_t *string ) { - return AddElement( TRACKED_NEW pfGUIListText( string ) ); + return AddElement( new pfGUIListText( string ) ); } -Int16 pfGUIListBoxMod::FindString( const char *toCompareTo ) +int16_t pfGUIListBoxMod::FindString( const char *toCompareTo ) { pfGUIListText text( toCompareTo ); return FindElement( &text ); } -Int16 pfGUIListBoxMod::FindString( const wchar_t *toCompareTo ) +int16_t pfGUIListBoxMod::FindString( const wchar_t *toCompareTo ) { pfGUIListText text( toCompareTo ); return FindElement( &text ); } -UInt16 pfGUIListBoxMod::GetNumElements( void ) +uint16_t pfGUIListBoxMod::GetNumElements( void ) { return fElements.GetCount(); } -pfGUIListElement *pfGUIListBoxMod::GetElement( UInt16 idx ) +pfGUIListElement *pfGUIListBoxMod::GetElement( uint16_t idx ) { return fElements[ idx ]; } @@ -1199,7 +1199,7 @@ void pfGUIListBoxMod::UnlockList( void ) //// IGetDesiredCursor /////////////////////////////////////////////////////// -UInt32 pfGUIListBoxMod::IGetDesiredCursor( void ) const +uint32_t pfGUIListBoxMod::IGetDesiredCursor( void ) const { if( fCurrHover == -1 ) return plInputInterface::kNullCursor; diff --git a/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIListBoxMod.h b/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIListBoxMod.h index e451e270..8b448ca8 100644 --- a/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIListBoxMod.h +++ b/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIListBoxMod.h @@ -65,10 +65,10 @@ class pfGUIListBoxMod : public pfGUIControlMod struct plSmallRect { - Int16 fLeft, fTop, fRight, fBottom; + int16_t fLeft, fTop, fRight, fBottom; - void Set( Int16 l, Int16 t, Int16 r, Int16 b ); - hsBool Contains( Int16 x, Int16 y ); + void Set( int16_t l, int16_t t, int16_t r, int16_t b ); + hsBool Contains( int16_t x, int16_t y ); plSmallRect& operator=(const int zero) { fLeft = fTop = fRight = fBottom = 0; return *this; } }; @@ -78,29 +78,29 @@ class pfGUIListBoxMod : public pfGUIControlMod pfScrollProc *fScrollProc; hsTArray fElements; - Int32 fCurrClick, fScrollPos, fCurrHover; - UInt8 fModsAtDragTime; - Int32 fMinSel, fMaxSel; + int32_t fCurrClick, fScrollPos, fCurrHover; + uint8_t fModsAtDragTime; + int32_t fMinSel, fMaxSel; hsBool fCheckScroll, fClicking; - Int32 fSingleSelElement; + int32_t fSingleSelElement; hsBool fScrollRangeUpdateDeferred; hsBool fLocked, fReadyToRoll; hsTArray fElementBounds; - hsTArray fWrapStartIdxs; + hsTArray fWrapStartIdxs; - virtual hsBool IEval( double secs, hsScalar del, UInt32 dirty ); // called only by owner object's Eval() + virtual hsBool IEval( double secs, float del, uint32_t dirty ); // called only by owner object's Eval() void ICalcScrollRange( void ); void ICalcWrapStarts( void ); virtual void IUpdate( void ); virtual void IPostSetUpDynTextMap( void ); - virtual UInt32 IGetDesiredCursor( void ) const; + virtual uint32_t IGetDesiredCursor( void ) const; - Int32 IGetItemFromPoint( hsPoint3 &mousePt ); - void IFindSelectionRange( Int32 *min, Int32 *max ); - void ISelectRange( Int8 min, Int8 max, hsBool select ); + int32_t IGetItemFromPoint( hsPoint3 &mousePt ); + void IFindSelectionRange( int32_t *min, int32_t *max ); + void ISelectRange( int8_t min, int8_t max, hsBool select ); public: @@ -143,30 +143,30 @@ class pfGUIListBoxMod : public pfGUIControlMod virtual void Read( hsStream* s, hsResMgr* mgr ); virtual void Write( hsStream* s, hsResMgr* mgr ); - virtual void HandleMouseDown( hsPoint3 &mousePt, UInt8 modifiers ); - virtual void HandleMouseUp( hsPoint3 &mousePt, UInt8 modifiers ); - virtual void HandleMouseDrag( hsPoint3 &mousePt, UInt8 modifiers ); - virtual void HandleMouseHover( hsPoint3 &mousePt, UInt8 modifiers ); - virtual void HandleMouseDblClick( hsPoint3 &mousePt, UInt8 modifiers ); + virtual void HandleMouseDown( hsPoint3 &mousePt, uint8_t modifiers ); + virtual void HandleMouseUp( hsPoint3 &mousePt, uint8_t modifiers ); + virtual void HandleMouseDrag( hsPoint3 &mousePt, uint8_t modifiers ); + virtual void HandleMouseHover( hsPoint3 &mousePt, uint8_t modifiers ); + virtual void HandleMouseDblClick( hsPoint3 &mousePt, uint8_t modifiers ); - virtual hsBool HandleKeyPress( wchar_t key, UInt8 modifiers ); - virtual hsBool HandleKeyEvent( pfGameGUIMgr::EventType event, plKeyDef key, UInt8 modifiers ); + virtual hsBool HandleKeyPress( wchar_t key, uint8_t modifiers ); + virtual hsBool HandleKeyEvent( pfGameGUIMgr::EventType event, plKeyDef key, uint8_t modifiers ); virtual hsBool FilterMousePosition( hsPoint3 &mousePt ); virtual void PurgeDynaTextMapImage(); // Returns selected element. Only valid for kSingleSelect list boxes - Int32 GetSelection( void ) { return fSingleSelElement; } - void SetSelection( Int32 item ); - void RemoveSelection( Int32 item ); - void AddSelection( Int32 item ); + int32_t GetSelection( void ) { return fSingleSelElement; } + void SetSelection( int32_t item ); + void RemoveSelection( int32_t item ); + void AddSelection( int32_t item ); virtual void ScrollToBegin( void ); virtual void ScrollToEnd( void ); - virtual void SetScrollPos( Int32 pos ); - virtual Int32 GetScrollPos( void ); - virtual Int32 GetScrollRange( void ); + virtual void SetScrollPos( int32_t pos ); + virtual int32_t GetScrollPos( void ); + virtual int32_t GetScrollRange( void ); void Refresh( void ) { IUpdate(); } @@ -175,21 +175,21 @@ class pfGUIListBoxMod : public pfGUIControlMod // Element manipulation - UInt16 AddElement( pfGUIListElement *el ); - void RemoveElement( UInt16 index ); - Int16 FindElement( pfGUIListElement *toCompareTo ); + uint16_t AddElement( pfGUIListElement *el ); + void RemoveElement( uint16_t index ); + int16_t FindElement( pfGUIListElement *toCompareTo ); void ClearAllElements( void ); void LockList( void ); void UnlockList( void ); - UInt16 GetNumElements( void ); - pfGUIListElement *GetElement( UInt16 idx ); + uint16_t GetNumElements( void ); + pfGUIListElement *GetElement( uint16_t idx ); - UInt16 AddString( const char *string ); - UInt16 AddString( const wchar_t *string ); - Int16 FindString( const char *toCompareTo ); - Int16 FindString( const wchar_t *toCompareTo ); + uint16_t AddString( const char *string ); + uint16_t AddString( const wchar_t *string ); + int16_t FindString( const char *toCompareTo ); + int16_t FindString( const wchar_t *toCompareTo ); // Export only void SetScrollCtrl( pfGUIValueCtrl *ctrl ) { fScrollControl = ctrl; } diff --git a/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIListElement.cpp b/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIListElement.cpp index 1a97d260..a8a7003a 100644 --- a/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIListElement.cpp +++ b/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIListElement.cpp @@ -45,7 +45,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // // ////////////////////////////////////////////////////////////////////////////// -#include "hsTypes.h" +#include "HeadSpin.h" #include "pfGUIListElement.h" #include "pfGameGUIMgr.h" @@ -91,7 +91,7 @@ pfGUIListText::pfGUIListText( const char *text ) : pfGUIListElement( kText ) pfGUIListText::pfGUIListText( const wchar_t *text ) : pfGUIListElement( kText ) { - fText = TRACKED_NEW wchar_t[ wcslen( text ) + 1 ]; + fText = new wchar_t[ wcslen( text ) + 1 ]; wcscpy( fText, text ); fJustify = kLeftJustify; } @@ -121,7 +121,7 @@ void pfGUIListText::Write( hsStream *s, hsResMgr *mgr ) delete [] text; } -hsBool pfGUIListText::Draw( plDynamicTextMap *textGen, UInt16 x, UInt16 y, UInt16 maxWidth, UInt16 maxHeight ) +hsBool pfGUIListText::Draw( plDynamicTextMap *textGen, uint16_t x, uint16_t y, uint16_t maxWidth, uint16_t maxHeight ) { textGen->SetJustify( (plDynamicTextMap::Justify)fJustify ); if( fSelected ) @@ -139,7 +139,7 @@ hsBool pfGUIListText::Draw( plDynamicTextMap *textGen, UInt16 x, UInt16 y, UInt return true; } -void pfGUIListText::GetSize( plDynamicTextMap *textGen, UInt16 *width, UInt16 *height ) +void pfGUIListText::GetSize( plDynamicTextMap *textGen, uint16_t *width, uint16_t *height ) { *width = textGen->CalcStringWidth( GetText(), height ); if( height != nil ) @@ -173,7 +173,7 @@ void pfGUIListText::SetText( const wchar_t *text ) delete [] fText; if( text != nil ) { - fText = TRACKED_NEW wchar_t[ wcslen( text ) + 1 ]; + fText = new wchar_t[ wcslen( text ) + 1 ]; wcscpy( fText, text ); } else @@ -247,7 +247,7 @@ void pfGUIListPicture::Write( hsStream *s, hsResMgr *mgr ) } -hsBool pfGUIListPicture::Draw( plDynamicTextMap *textGen, UInt16 x, UInt16 y, UInt16 maxWidth, UInt16 maxHeight ) +hsBool pfGUIListPicture::Draw( plDynamicTextMap *textGen, uint16_t x, uint16_t y, uint16_t maxWidth, uint16_t maxHeight ) { if( fSelected ) textGen->FillRect( x, y, maxWidth, maxHeight, fColors->fSelBackColor ); @@ -264,7 +264,7 @@ hsBool pfGUIListPicture::Draw( plDynamicTextMap *textGen, UInt16 x, UInt16 y, U return true; } -void pfGUIListPicture::GetSize( plDynamicTextMap *textGen, UInt16 *width, UInt16 *height ) +void pfGUIListPicture::GetSize( plDynamicTextMap *textGen, uint16_t *width, uint16_t *height ) { plMipmap *mip = plMipmap::ConvertNoRef( fMipmapKey->ObjectIsLoaded() ); if( mip == nil ) @@ -274,9 +274,9 @@ void pfGUIListPicture::GetSize( plDynamicTextMap *textGen, UInt16 *width, UIn *height = 16; } - *width = (UInt16)(mip->GetWidth() + fBorderSize + fBorderSize); + *width = (uint16_t)(mip->GetWidth() + fBorderSize + fBorderSize); if( height != nil ) - *height = (UInt16)(mip->GetHeight() + fBorderSize + fBorderSize); + *height = (uint16_t)(mip->GetHeight() + fBorderSize + fBorderSize); } int pfGUIListPicture::CompareTo( pfGUIListElement *rightSide ) @@ -308,7 +308,7 @@ pfGUIListTreeRoot::pfGUIListTreeRoot( const char *text ) : pfGUIListElement( kTr pfGUIListTreeRoot::pfGUIListTreeRoot( const wchar_t *text ) : pfGUIListElement( kTreeRoot ) { - fText = TRACKED_NEW wchar_t[ wcslen( text ) + 1 ]; + fText = new wchar_t[ wcslen( text ) + 1 ]; wcscpy( fText, text ); } @@ -337,7 +337,7 @@ void pfGUIListTreeRoot::Write( hsStream *s, hsResMgr *mgr ) delete [] temp; } -hsBool pfGUIListTreeRoot::Draw( plDynamicTextMap *textGen, UInt16 x, UInt16 y, UInt16 maxWidth, UInt16 maxHeight ) +hsBool pfGUIListTreeRoot::Draw( plDynamicTextMap *textGen, uint16_t x, uint16_t y, uint16_t maxWidth, uint16_t maxHeight ) { textGen->SetJustify( plDynamicTextMap::kLeftJustify ); if( fSelected ) @@ -355,7 +355,7 @@ hsBool pfGUIListTreeRoot::Draw( plDynamicTextMap *textGen, UInt16 x, UInt16 y, { const pfGUISkin::pfSRect &r = fSkin->GetElement( fShowChildren ? pfGUISkin::kTreeButtonOpen : pfGUISkin::kTreeButtonClosed ); - Int16 e = ( maxHeight - r.fHeight ); + int16_t e = ( maxHeight - r.fHeight ); if( e < 0 ) e = 0; e >>= 1; @@ -368,7 +368,7 @@ hsBool pfGUIListTreeRoot::Draw( plDynamicTextMap *textGen, UInt16 x, UInt16 y, return true; } -hsBool pfGUIListTreeRoot::MouseClicked( UInt16 localX, UInt16 localY ) +hsBool pfGUIListTreeRoot::MouseClicked( uint16_t localX, uint16_t localY ) { if( fSkin != nil ) { @@ -387,7 +387,7 @@ hsBool pfGUIListTreeRoot::MouseClicked( UInt16 localX, UInt16 localY ) return false; } -void pfGUIListTreeRoot::GetSize( plDynamicTextMap *textGen, UInt16 *width, UInt16 *height ) +void pfGUIListTreeRoot::GetSize( plDynamicTextMap *textGen, uint16_t *width, uint16_t *height ) { *width = textGen->CalcStringWidth( GetTitle(), height ); if( height != nil ) @@ -399,7 +399,7 @@ void pfGUIListTreeRoot::GetSize( plDynamicTextMap *textGen, UInt16 *width, UI if( fSkin != nil ) { - UInt16 h = fSkin->GetElement( pfGUISkin::kTreeButtonClosed ).fHeight; + uint16_t h = fSkin->GetElement( pfGUISkin::kTreeButtonClosed ).fHeight; if( *height < h ) *height = h; } @@ -431,7 +431,7 @@ void pfGUIListTreeRoot::SetTitle( const wchar_t *text ) delete [] fText; if( text != nil ) { - fText = TRACKED_NEW wchar_t[ wcslen( text ) + 1 ]; + fText = new wchar_t[ wcslen( text ) + 1 ]; wcscpy( fText, text ); } else @@ -445,14 +445,14 @@ void pfGUIListTreeRoot::AddChild( pfGUIListElement *el ) el->SetCollapsed( !fShowChildren ); } -void pfGUIListTreeRoot::RemoveChild( UInt32 idx ) +void pfGUIListTreeRoot::RemoveChild( uint32_t idx ) { fChildren.Remove( idx ); } void pfGUIListTreeRoot::ShowChildren( hsBool s ) { - UInt32 i; + uint32_t i; fShowChildren = s; @@ -462,7 +462,7 @@ void pfGUIListTreeRoot::ShowChildren( hsBool s ) void pfGUIListTreeRoot::SetCollapsed( hsBool c ) { - UInt32 i; + uint32_t i; pfGUIListElement::SetCollapsed( c ); diff --git a/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIListElement.h b/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIListElement.h index 319ae711..5d5ef54e 100644 --- a/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIListElement.h +++ b/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIListElement.h @@ -58,10 +58,10 @@ class pfGUIListElement protected: hsBool fSelected; - const UInt8 fType; + const uint8_t fType; hsBool fCollapsed; // For tree view support - UInt8 fIndentLevel; // Ditto + uint8_t fIndentLevel; // Ditto pfGUIColorScheme *fColors; pfGUISkin *fSkin; @@ -75,14 +75,14 @@ class pfGUIListElement kTreeRoot }; - pfGUIListElement( UInt8 type ) : fType( type ), fSelected( false ), fCollapsed( false ), fIndentLevel( 0 ) {} + pfGUIListElement( uint8_t type ) : fType( type ), fSelected( false ), fCollapsed( false ), fIndentLevel( 0 ) {} virtual ~pfGUIListElement() {} virtual void Read( hsStream *s, hsResMgr *mgr ); virtual void Write( hsStream *s, hsResMgr *mgr ); - virtual hsBool Draw( plDynamicTextMap *textGen, UInt16 x, UInt16 y, UInt16 maxWidth, UInt16 maxHeight ) = 0; - virtual void GetSize( plDynamicTextMap *textGen, UInt16 *width, UInt16 *height ) = 0; + virtual hsBool Draw( plDynamicTextMap *textGen, uint16_t x, uint16_t y, uint16_t maxWidth, uint16_t maxHeight ) = 0; + virtual void GetSize( plDynamicTextMap *textGen, uint16_t *width, uint16_t *height ) = 0; virtual int CompareTo( pfGUIListElement *rightSide ) = 0; virtual void SetSelected( hsBool sel ) { fSelected = sel; } @@ -91,9 +91,9 @@ class pfGUIListElement virtual hsBool CanBeDragged( void ) { return false; } // Return true here if you need the list refreshed - virtual hsBool MouseClicked( UInt16 localX, UInt16 localY ) { return false; } + virtual hsBool MouseClicked( uint16_t localX, uint16_t localY ) { return false; } - UInt8 GetType( void ) { return fType; } + uint8_t GetType( void ) { return fType; } void SetColorScheme( pfGUIColorScheme *scheme ) { fColors = scheme; } void SetSkin( pfGUISkin *skin ) { fSkin = skin; } @@ -101,8 +101,8 @@ class pfGUIListElement hsBool IsCollapsed( void ) const { return fCollapsed; } virtual void SetCollapsed( hsBool c ) { fCollapsed = c; } - UInt8 GetIndentLevel( void ) const { return fIndentLevel; } - void SetIndentLevel( UInt8 i ) { fIndentLevel = i; } + uint8_t GetIndentLevel( void ) const { return fIndentLevel; } + void SetIndentLevel( uint8_t i ) { fIndentLevel = i; } }; class pfGUIListText : public pfGUIListElement @@ -119,7 +119,7 @@ class pfGUIListText : public pfGUIListElement protected: wchar_t *fText; - UInt8 fJustify; // This is not our JustifyTypes, but from plDynamicTextMap + uint8_t fJustify; // This is not our JustifyTypes, but from plDynamicTextMap public: @@ -131,8 +131,8 @@ class pfGUIListText : public pfGUIListElement virtual void Read( hsStream *s, hsResMgr *mgr ); virtual void Write( hsStream *s, hsResMgr *mgr ); - virtual hsBool Draw( plDynamicTextMap *textGen, UInt16 x, UInt16 y, UInt16 maxWidth, UInt16 maxHeight ); - virtual void GetSize( plDynamicTextMap *textGen, UInt16 *width, UInt16 *height ); + virtual hsBool Draw( plDynamicTextMap *textGen, uint16_t x, uint16_t y, uint16_t maxWidth, uint16_t maxHeight ); + virtual void GetSize( plDynamicTextMap *textGen, uint16_t *width, uint16_t *height ); virtual int CompareTo( pfGUIListElement *rightSide ); virtual hsBool CanBeDragged( void ) { return true; } @@ -149,7 +149,7 @@ class pfGUIListPicture : public pfGUIListElement protected: plKey fMipmapKey; - UInt8 fBorderSize; // Defaults to 2 + uint8_t fBorderSize; // Defaults to 2 hsBool fRespectAlpha; public: @@ -161,13 +161,13 @@ class pfGUIListPicture : public pfGUIListElement virtual void Read( hsStream *s, hsResMgr *mgr ); virtual void Write( hsStream *s, hsResMgr *mgr ); - virtual hsBool Draw( plDynamicTextMap *textGen, UInt16 x, UInt16 y, UInt16 maxWidth, UInt16 maxHeight ); - virtual void GetSize( plDynamicTextMap *textGen, UInt16 *width, UInt16 *height ); + virtual hsBool Draw( plDynamicTextMap *textGen, uint16_t x, uint16_t y, uint16_t maxWidth, uint16_t maxHeight ); + virtual void GetSize( plDynamicTextMap *textGen, uint16_t *width, uint16_t *height ); virtual int CompareTo( pfGUIListElement *rightSide ); virtual hsBool CanBeDragged( void ) { return false; } - void SetBorderSize( UInt32 size ) { fBorderSize = (UInt8)size; } + void SetBorderSize( uint32_t size ) { fBorderSize = (uint8_t)size; } void SetRespectAlpha( hsBool r ) { fRespectAlpha = r; } }; @@ -191,21 +191,21 @@ class pfGUIListTreeRoot : public pfGUIListElement virtual void Read( hsStream *s, hsResMgr *mgr ); virtual void Write( hsStream *s, hsResMgr *mgr ); - virtual hsBool Draw( plDynamicTextMap *textGen, UInt16 x, UInt16 y, UInt16 maxWidth, UInt16 maxHeight ); - virtual void GetSize( plDynamicTextMap *textGen, UInt16 *width, UInt16 *height ); + virtual hsBool Draw( plDynamicTextMap *textGen, uint16_t x, uint16_t y, uint16_t maxWidth, uint16_t maxHeight ); + virtual void GetSize( plDynamicTextMap *textGen, uint16_t *width, uint16_t *height ); virtual int CompareTo( pfGUIListElement *rightSide ); - virtual hsBool MouseClicked( UInt16 localX, UInt16 localY ); + virtual hsBool MouseClicked( uint16_t localX, uint16_t localY ); const wchar_t *GetTitle( void ) { return fText; } void SetTitle( const char *text ); void SetTitle( const wchar_t *text ); - UInt32 GetNumChildren( void ) const { return fChildren.GetCount(); } - pfGUIListElement *GetChild( UInt32 i ) const { return fChildren[ i ]; } + uint32_t GetNumChildren( void ) const { return fChildren.GetCount(); } + pfGUIListElement *GetChild( uint32_t i ) const { return fChildren[ i ]; } void AddChild( pfGUIListElement *el ); - void RemoveChild( UInt32 idx ); + void RemoveChild( uint32_t idx ); virtual void SetCollapsed( hsBool c ); @@ -227,7 +227,7 @@ class pfGUIDropTargetProc { protected: - UInt32 fRefCnt; + uint32_t fRefCnt; public: diff --git a/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIMenuItem.cpp b/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIMenuItem.cpp index 9248390e..f0f62a84 100644 --- a/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIMenuItem.cpp +++ b/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIMenuItem.cpp @@ -47,7 +47,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // // ////////////////////////////////////////////////////////////////////////////// -#include "hsTypes.h" +#include "HeadSpin.h" #include "pfGUIMenuItem.h" #include "pfGameGUIMgr.h" #include "pfGUIControlHandlers.h" @@ -89,7 +89,7 @@ void pfGUIMenuItem::SetName( const wchar_t *name ) delete [] fName; if (name != nil) { - fName = TRACKED_NEW wchar_t[wcslen(name)+1]; + fName = new wchar_t[wcslen(name)+1]; wcscpy(fName,name); } else @@ -107,7 +107,7 @@ void pfGUIMenuItem::SetSkin( pfGUISkin *skin, HowToSkin s ) GetKey()->Release( fSkin->GetKey() ); if( skin != nil ) - hsgResMgr::ResMgr()->SendRef( skin->GetKey(), TRACKED_NEW plGenRefMsg( GetKey(), plRefMsg::kOnCreate, -1, kRefSkin ), plRefFlags::kActiveRef ); + hsgResMgr::ResMgr()->SendRef( skin->GetKey(), new plGenRefMsg( GetKey(), plRefMsg::kOnCreate, -1, kRefSkin ), plRefFlags::kActiveRef ); fHowToSkin = s; @@ -126,7 +126,7 @@ void pfGUIMenuItem::IPostSetUpDynTextMap( void ) // Overridden so we can enlarge our DTMap by 3 vertically, to use the extra // space as basically a double buffer for our skinning -void pfGUIMenuItem::IGrowDTMDimsToDesiredSize( UInt16 &width, UInt16 &height ) +void pfGUIMenuItem::IGrowDTMDimsToDesiredSize( uint16_t &width, uint16_t &height ) { height *= 3; } @@ -147,7 +147,7 @@ void pfGUIMenuItem::IUpdateSkinBuffers( void ) if( fSkin->GetTexture() == nil ) return; - UInt16 y = fDynTextMap->GetVisibleHeight(); + uint16_t y = fDynTextMap->GetVisibleHeight(); IUpdateSingleSkinBuffer( y, false ); IUpdateSingleSkinBuffer( y << 1, true ); @@ -158,14 +158,14 @@ void pfGUIMenuItem::IUpdateSkinBuffers( void ) //// IUpdateSingleSkinBuffer ///////////////////////////////////////////////// // Broken down functionality for the above function -void pfGUIMenuItem::IUpdateSingleSkinBuffer( UInt16 y, hsBool sel ) +void pfGUIMenuItem::IUpdateSingleSkinBuffer( uint16_t y, hsBool sel ) { hsAssert( fSkin != nil && fDynTextMap != nil, "Invalid pointers in IUpdateSingleSkinBuffer()" ); // Note: add 1 to the visible height so we get enough overlap to take care of mipmapping issues - UInt16 x = 0, totWidth = fDynTextMap->GetVisibleWidth(); - UInt16 totHeight = y + fDynTextMap->GetVisibleHeight(); + uint16_t x = 0, totWidth = fDynTextMap->GetVisibleWidth(); + uint16_t totHeight = y + fDynTextMap->GetVisibleHeight(); pfGUISkin::pfSRect element; @@ -180,7 +180,7 @@ void pfGUIMenuItem::IUpdateSingleSkinBuffer( UInt16 y, hsBool sel ) element = fSkin->GetElement( pfGUISkin::kTopSpan ); for( ; x < totWidth; ) { - UInt16 wid = element.fWidth; + uint16_t wid = element.fWidth; if( x + wid > totWidth ) wid = totWidth - x; fDynTextMap->DrawClippedImage( x, y, fSkin->GetTexture(), element.fX, element.fY, wid, element.fHeight, plDynamicTextMap::kImgSprite ); @@ -199,12 +199,12 @@ void pfGUIMenuItem::IUpdateSingleSkinBuffer( UInt16 y, hsBool sel ) } // Group drawing by skin elements for caching performance - UInt16 startY = y; + uint16_t startY = y; x = 0; element = fSkin->GetElement( pfGUISkin::kLeftSpan ); for( ; y < totHeight; ) { - UInt16 ht = element.fHeight; + uint16_t ht = element.fHeight; if( y + ht > totHeight ) ht = totHeight - y; fDynTextMap->DrawClippedImage( x, y, fSkin->GetTexture(), element.fX, element.fY, element.fWidth, ht, plDynamicTextMap::kImgSprite ); @@ -218,13 +218,13 @@ void pfGUIMenuItem::IUpdateSingleSkinBuffer( UInt16 y, hsBool sel ) element = fSkin->GetElement( pfGUISkin::kMiddleFill ); for( ; x < totWidth; ) { - UInt16 wid = element.fWidth; + uint16_t wid = element.fWidth; if( x + wid > totWidth ) wid = totWidth - x; for( y = startY; y < totHeight; ) { - UInt16 ht = element.fHeight; + uint16_t ht = element.fHeight; if( y + ht > totHeight ) ht = totHeight - y; fDynTextMap->DrawClippedImage( x, y, fSkin->GetTexture(), element.fX, element.fY, wid, ht, plDynamicTextMap::kImgSprite ); @@ -237,7 +237,7 @@ void pfGUIMenuItem::IUpdateSingleSkinBuffer( UInt16 y, hsBool sel ) element = fSkin->GetElement( pfGUISkin::kRightSpan ); for( y = startY; y < totHeight; ) { - UInt16 ht = element.fHeight; + uint16_t ht = element.fHeight; if( y + ht > totHeight ) ht = totHeight - y; fDynTextMap->DrawClippedImage( x, y, fSkin->GetTexture(), element.fX, element.fY, element.fWidth, ht, plDynamicTextMap::kImgSprite ); @@ -256,7 +256,7 @@ void pfGUIMenuItem::IUpdateSingleSkinBuffer( UInt16 y, hsBool sel ) element = fSkin->GetElement( pfGUISkin::kBottomSpan ); for( ; x < totWidth; ) { - UInt16 wid = element.fWidth; + uint16_t wid = element.fWidth; if( x + wid > totWidth ) wid = totWidth - x; fDynTextMap->DrawClippedImage( x, y, fSkin->GetTexture(), element.fX, element.fY, wid, element.fHeight, plDynamicTextMap::kImgSprite ); @@ -285,7 +285,7 @@ void pfGUIMenuItem::IUpdate( void ) return; // Copy now from our skin buffer, plus set our text color - UInt16 y = fDynTextMap->GetVisibleHeight(); + uint16_t y = fDynTextMap->GetVisibleHeight(); if( IsInteresting() ) { @@ -316,10 +316,10 @@ void pfGUIMenuItem::IUpdate( void ) if( fName != nil ) { - UInt16 ht; + uint16_t ht; fDynTextMap->CalcStringWidth( fName, &ht ); - Int16 x = 0, y = ( fDynTextMap->GetVisibleHeight() - ht ) >> 1; + int16_t x = 0, y = ( fDynTextMap->GetVisibleHeight() - ht ) >> 1; if( fHowToSkin == kTop && fSkin != nil ) y += fSkin->GetElement( pfGUISkin::kTopSpan ).fHeight >> 1; else if( fHowToSkin == kBottom && fSkin != nil ) @@ -376,7 +376,7 @@ void pfGUIMenuItem::PurgeDynaTextMapImage() //// GetTextExtents ////////////////////////////////////////////////////////// // Calculate the size of the drawn text. -void pfGUIMenuItem::GetTextExtents( UInt16 &width, UInt16 &height ) +void pfGUIMenuItem::GetTextExtents( uint16_t &width, uint16_t &height ) { if( fName == nil ) width = height = 0; @@ -405,19 +405,19 @@ void pfGUIMenuItem::Write( hsStream *s, hsResMgr *mgr ) //// HandleMouseDown/Up ////////////////////////////////////////////////////// -void pfGUIMenuItem::HandleMouseDown( hsPoint3 &mousePt, UInt8 modifiers ) +void pfGUIMenuItem::HandleMouseDown( hsPoint3 &mousePt, uint8_t modifiers ) { pfGUIButtonMod::HandleMouseDown( mousePt, modifiers ); IUpdate(); } -void pfGUIMenuItem::HandleMouseUp( hsPoint3 &mousePt, UInt8 modifiers ) +void pfGUIMenuItem::HandleMouseUp( hsPoint3 &mousePt, uint8_t modifiers ) { pfGUIButtonMod::HandleMouseUp( mousePt, modifiers ); IUpdate(); } -void pfGUIMenuItem::HandleMouseDrag( hsPoint3 &mousePt, UInt8 modifiers ) +void pfGUIMenuItem::HandleMouseDrag( hsPoint3 &mousePt, uint8_t modifiers ) { /* if( !fClicking ) return; @@ -441,7 +441,7 @@ void pfGUIMenuItem::HandleMouseDrag( hsPoint3 &mousePt, UInt8 modifiers ) pfGUIButtonMod::HandleMouseDrag( mousePt, modifiers ); } -void pfGUIMenuItem::HandleMouseHover( hsPoint3 &mousePt, UInt8 modifiers ) +void pfGUIMenuItem::HandleMouseHover( hsPoint3 &mousePt, uint8_t modifiers ) { pfGUIButtonMod::HandleMouseHover( mousePt, modifiers ); if( HasFlag( kReportHovers ) ) diff --git a/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIMenuItem.h b/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIMenuItem.h index 75003d6d..9ef87b29 100644 --- a/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIMenuItem.h +++ b/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIMenuItem.h @@ -73,12 +73,12 @@ class pfGUIMenuItem : public pfGUIButtonMod HowToSkin fHowToSkin; hsBool fSkinBuffersUpdated; - virtual void IGrowDTMDimsToDesiredSize( UInt16 &width, UInt16 &height ); + virtual void IGrowDTMDimsToDesiredSize( uint16_t &width, uint16_t &height ); virtual void IPostSetUpDynTextMap( void ); virtual void IUpdate( void ); void IUpdateSkinBuffers( void ); - void IUpdateSingleSkinBuffer( UInt16 y, hsBool sel ); + void IUpdateSingleSkinBuffer( uint16_t y, hsBool sel ); public: @@ -108,10 +108,10 @@ class pfGUIMenuItem : public pfGUIButtonMod virtual void SetInteresting( hsBool i ); - virtual void HandleMouseDown( hsPoint3 &mousePt, UInt8 modifiers ); - virtual void HandleMouseUp( hsPoint3 &mousePt, UInt8 modifiers ); - virtual void HandleMouseDrag( hsPoint3 &mousePt, UInt8 modifiers ); - virtual void HandleMouseHover( hsPoint3 &mousePt, UInt8 modifiers ); + virtual void HandleMouseDown( hsPoint3 &mousePt, uint8_t modifiers ); + virtual void HandleMouseUp( hsPoint3 &mousePt, uint8_t modifiers ); + virtual void HandleMouseDrag( hsPoint3 &mousePt, uint8_t modifiers ); + virtual void HandleMouseHover( hsPoint3 &mousePt, uint8_t modifiers ); virtual void PurgeDynaTextMapImage(); @@ -120,7 +120,7 @@ class pfGUIMenuItem : public pfGUIButtonMod void SetName( const wchar_t *name ); const wchar_t *GetName( void ) const { return fName; } - void GetTextExtents( UInt16 &width, UInt16 &height ); + void GetTextExtents( uint16_t &width, uint16_t &height ); void SetSkin( pfGUISkin *skin, HowToSkin s ); }; diff --git a/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIMultiLineEditCtrl.cpp b/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIMultiLineEditCtrl.cpp index 0d5a06ae..1db3a13e 100644 --- a/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIMultiLineEditCtrl.cpp +++ b/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIMultiLineEditCtrl.cpp @@ -45,7 +45,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // // ////////////////////////////////////////////////////////////////////////////// -#include "hsTypes.h" +#include "HeadSpin.h" #include "pfGUIMultiLineEditCtrl.h" #include "pfGameGUIMgr.h" #include "pfGUIUpDownPairMod.h" @@ -68,12 +68,12 @@ class plStringSlicer { wchar_t *fString; wchar_t fTempChar; - UInt32 fStart, fEnd; + uint32_t fStart, fEnd; typedef wchar_t *CharPtr; public: - plStringSlicer( wchar_t *string, UInt32 start, UInt32 end ) + plStringSlicer( wchar_t *string, uint32_t start, uint32_t end ) { fString = string; fTempChar = string[ end ]; @@ -82,7 +82,7 @@ class plStringSlicer fEnd = end; } - plStringSlicer( hsTArray &string, UInt32 start, UInt32 end ) + plStringSlicer( hsTArray &string, uint32_t start, uint32_t end ) { fString = string.AcquireArray(); fStart = start; @@ -137,8 +137,8 @@ class pfMLScrollProc : public pfGUICtrlProcObject wchar_t pfGUIMultiLineEditCtrl::fColorCodeChar = (wchar_t)1; wchar_t pfGUIMultiLineEditCtrl::fStyleCodeChar = (wchar_t)2; -UInt32 pfGUIMultiLineEditCtrl::fColorCodeSize = (wchar_t)5; -UInt32 pfGUIMultiLineEditCtrl::fStyleCodeSize = (wchar_t)3; +uint32_t pfGUIMultiLineEditCtrl::fColorCodeSize = (wchar_t)5; +uint32_t pfGUIMultiLineEditCtrl::fStyleCodeSize = (wchar_t)3; //// Constructor/Destructor ////////////////////////////////////////////////// @@ -189,7 +189,7 @@ pfGUIMultiLineEditCtrl::~pfGUIMultiLineEditCtrl() //// IEval /////////////////////////////////////////////////////////////////// -hsBool pfGUIMultiLineEditCtrl::IEval( double secs, hsScalar del, UInt32 dirty ) +hsBool pfGUIMultiLineEditCtrl::IEval( double secs, float del, uint32_t dirty ) { return pfGUIControlMod::IEval( secs, del, dirty ); } @@ -221,7 +221,7 @@ hsBool pfGUIMultiLineEditCtrl::MsgReceive( plMessage *msg ) //// SetScrollPosition /////////////////////////////////////////////////////// -void pfGUIMultiLineEditCtrl::SetScrollPosition( Int32 topLine ) +void pfGUIMultiLineEditCtrl::SetScrollPosition( int32_t topLine ) { if( topLine < 0 ) topLine = 0; @@ -240,7 +240,7 @@ void pfGUIMultiLineEditCtrl::SetScrollPosition( Int32 topLine ) if( fScrollControl != nil ) // Scroll control values are reversed - fScrollControl->SetCurrValue( fScrollControl->GetMax() - (hsScalar)fScrollPos ); + fScrollControl->SetCurrValue( fScrollControl->GetMax() - (float)fScrollPos ); HandleExtendedEvent( pfGUIMultiLineEditCtrl::kScrollPosChanged ); @@ -267,16 +267,16 @@ void pfGUIMultiLineEditCtrl::IUpdateScrollRange( void ) { // +1 here because the last visible line is only a partial, but we want to be able to view // full lines all the way to the end. - hsScalar newMax = (hsScalar)( fLineStarts.GetCount() - ICalcNumVisibleLines() + 1 ); + float newMax = (float)( fLineStarts.GetCount() - ICalcNumVisibleLines() + 1 ); if( newMax != fScrollControl->GetMax() ) { - fScrollControl->SetRange( 0, (hsScalar)(fLineStarts.GetCount() - ICalcNumVisibleLines() + 1) ); + fScrollControl->SetRange( 0, (float)(fLineStarts.GetCount() - ICalcNumVisibleLines() + 1) ); fScrollControl->SetEnabled( true ); if( fScrollPos > fLineStarts.GetCount() - ICalcNumVisibleLines() + 1 ) { fScrollPos = fLineStarts.GetCount() - ICalcNumVisibleLines() + 1; - fScrollControl->SetCurrValue( fScrollControl->GetMax() - (hsScalar)fScrollPos ); + fScrollControl->SetCurrValue( fScrollControl->GetMax() - (float)fScrollPos ); } // All bets are off on scrolling, so refresh the whole area @@ -354,11 +354,11 @@ void pfGUIMultiLineEditCtrl::IPostSetUpDynTextMap( void ) //// ICalcNumVisibleLines //////////////////////////////////////////////////// -Int32 pfGUIMultiLineEditCtrl::ICalcNumVisibleLines( void ) const +int32_t pfGUIMultiLineEditCtrl::ICalcNumVisibleLines( void ) const { if (fDynTextMap == nil || fLineHeight == 0) return 0; - Int32 numLines = 0; + int32_t numLines = 0; numLines = (fDynTextMap->GetVisibleHeight() + fLineHeight - (fTopMargin+fBottomMargin+1))/fLineHeight; return numLines; } @@ -366,13 +366,13 @@ Int32 pfGUIMultiLineEditCtrl::ICalcNumVisibleLines( void ) const //// IUpdate ///////////////////////////////////////////////////////////////// // Ranged version -void pfGUIMultiLineEditCtrl::IUpdate( Int32 startLine, Int32 endLine ) +void pfGUIMultiLineEditCtrl::IUpdate( int32_t startLine, int32_t endLine ) { hsColorRGBA c; static int testingFlip = 0; bool clearEachLine = true; - UInt32 line, x, y = 0; - Int32 numVisibleLines, lastVisibleLine; + uint32_t line, x, y = 0; + int32_t numVisibleLines, lastVisibleLine; if( !fReadyToRender ) @@ -427,41 +427,41 @@ void pfGUIMultiLineEditCtrl::IUpdate( Int32 startLine, Int32 endLine ) // Clear this line if( clearEachLine ) { - fDynTextMap->FillRect( 0, (UInt16)y, fDynTextMap->GetVisibleWidth(), fLineHeight, + fDynTextMap->FillRect( 0, (uint16_t)y, fDynTextMap->GetVisibleWidth(), fLineHeight, GetColorScheme()->fBackColor ); } - UInt32 start = fLineStarts[ line ], end; + uint32_t start = fLineStarts[ line ], end; if( line == fLineStarts.GetCount() - 1 ) end = fBuffer.GetCount(); else end = fLineStarts[ line + 1 ]; // Render the actual text - IRenderLine( fLeftMargin, (UInt16)y, start, end ); + IRenderLine( fLeftMargin, (uint16_t)y, start, end ); // Render the cursor if( fCursorPos >= start && fCursorPos < end && IsFocused() ) { if( fCursorPos > start ) - x = IRenderLine( fLeftMargin, (UInt16)y, start, fCursorPos, true ); + x = IRenderLine( fLeftMargin, (uint16_t)y, start, fCursorPos, true ); else x = fLeftMargin; - fDynTextMap->FrameRect( (UInt16)x, (UInt16)y, 2, fLineHeight, GetColorScheme()->fSelForeColor ); + fDynTextMap->FrameRect( (uint16_t)x, (uint16_t)y, 2, fLineHeight, GetColorScheme()->fSelForeColor ); // Store the cursor X,Y pair. Go figure, the ONLY time we actually need this is // to move up or down one line, and even then it's only because we want to keep // the same approximate horizontal position (versus same character offset) - fCurrCursorX = (UInt16)x; - fCurrCursorY = (UInt16)y; + fCurrCursorX = (uint16_t)x; + fCurrCursorY = (uint16_t)y; } y += fLineHeight; } if( clearEachLine && line >= fLineStarts.GetCount() && y < fDynTextMap->GetVisibleHeight()-fBottomMargin ) { // No lines left, so clear the rest of the visible area - fDynTextMap->FillRect( 0, (UInt16)y, fDynTextMap->GetVisibleWidth(), (UInt16)(fDynTextMap->GetVisibleHeight() - y), + fDynTextMap->FillRect( 0, (uint16_t)y, fDynTextMap->GetVisibleWidth(), (uint16_t)(fDynTextMap->GetVisibleHeight() - y), GetColorScheme()->fBackColor ); } fDynTextMap->FlushToHost(); @@ -471,17 +471,17 @@ void pfGUIMultiLineEditCtrl::IUpdate( Int32 startLine, Int32 endLine ) // Reads a color code from the given position and advances the given position // appropriately -void pfGUIMultiLineEditCtrl::IReadColorCode( Int32 &pos, hsColorRGBA &color ) const +void pfGUIMultiLineEditCtrl::IReadColorCode( int32_t &pos, hsColorRGBA &color ) const { - UInt16 *buffer = (UInt16 *)fBuffer.AcquireArray() + pos; - UInt8 r, g, b; + uint16_t *buffer = (uint16_t *)fBuffer.AcquireArray() + pos; + uint8_t r, g, b; hsAssert( buffer[ 0 ] == fColorCodeChar, "Invalid position in IReadColorCode()" ); buffer++; - r = (UInt8)buffer[ 0 ]; - g = (UInt8)buffer[ 1 ]; - b = (UInt8)buffer[ 2 ]; + r = (uint8_t)buffer[ 0 ]; + g = (uint8_t)buffer[ 1 ]; + b = (uint8_t)buffer[ 2 ]; pos += fColorCodeSize; // We have a duplicate code at the end of this block, for searching backwards color.Set( r / 255.f, g / 255.f, b / 255.f, fFontColor.a ); } @@ -490,13 +490,13 @@ void pfGUIMultiLineEditCtrl::IReadColorCode( Int32 &pos, hsColorRGBA &color ) // Reads a style code from the given position and advances the given position // appropriately -void pfGUIMultiLineEditCtrl::IReadStyleCode( Int32 &pos, UInt8 &fontFlags ) const +void pfGUIMultiLineEditCtrl::IReadStyleCode( int32_t &pos, uint8_t &fontFlags ) const { - UInt16 *buffer = (UInt16 *)fBuffer.AcquireArray() + pos; + uint16_t *buffer = (uint16_t *)fBuffer.AcquireArray() + pos; hsAssert( buffer[ 0 ] == fStyleCodeChar, "Invalid position in IReadStyleCode()" ); - fontFlags = (UInt8)buffer[ 1 ]; + fontFlags = (uint8_t)buffer[ 1 ]; pos += fStyleCodeSize; // We have a duplicate code at the end of this block, for searching backwards } @@ -516,7 +516,7 @@ inline bool pfGUIMultiLineEditCtrl::IIsCodeChar( const wchar_t c ) // type. If none is found, they set the given parameter to the default value // and return false. -hsBool pfGUIMultiLineEditCtrl::IFindLastColorCode( Int32 pos, hsColorRGBA &color, hsBool ignoreFirstCharacter ) const +hsBool pfGUIMultiLineEditCtrl::IFindLastColorCode( int32_t pos, hsColorRGBA &color, hsBool ignoreFirstCharacter ) const { for( ; pos >= 0; pos -= IOffsetToNextCharFromPos( pos - 1 ) ) { @@ -531,7 +531,7 @@ hsBool pfGUIMultiLineEditCtrl::IFindLastColorCode( Int32 pos, hsColorRGBA &colo return false; } -hsBool pfGUIMultiLineEditCtrl::IFindLastStyleCode( Int32 pos, UInt8 &style, hsBool ignoreFirstCharacter ) const +hsBool pfGUIMultiLineEditCtrl::IFindLastStyleCode( int32_t pos, uint8_t &style, hsBool ignoreFirstCharacter ) const { for( ; pos >= 0; pos -= IOffsetToNextCharFromPos( pos - 1 ) ) { @@ -552,11 +552,11 @@ hsBool pfGUIMultiLineEditCtrl::IFindLastStyleCode( Int32 pos, UInt8 &style, hsB // given. Takes into account style codes and special characters (like returns // and tabs). Returns the final X value after rendering. -UInt32 pfGUIMultiLineEditCtrl::IRenderLine( UInt16 x, UInt16 y, Int32 start, Int32 end, hsBool dontRender ) +uint32_t pfGUIMultiLineEditCtrl::IRenderLine( uint16_t x, uint16_t y, int32_t start, int32_t end, hsBool dontRender ) { - Int32 pos; + int32_t pos; hsColorRGBA currColor = fFontColor; - UInt8 currStyle; + uint8_t currStyle; const wchar_t *buffer = fBuffer.AcquireArray(); // First, gotta go back from our starting position and find a color and style code to use @@ -649,9 +649,9 @@ void pfGUIMultiLineEditCtrl::Read( hsStream *s, hsResMgr *mgr ) fScrollControl = nil; if( s->ReadBool() ) { - fScrollProc = TRACKED_NEW pfMLScrollProc( this ); + fScrollProc = new pfMLScrollProc( this ); fScrollProc->IncRef(); - mgr->ReadKeyNotifyMe( s, TRACKED_NEW plGenRefMsg( GetKey(), plRefMsg::kOnCreate, -1, kRefScrollCtrl ), plRefFlags::kActiveRef ); + mgr->ReadKeyNotifyMe( s, new plGenRefMsg( GetKey(), plRefMsg::kOnCreate, -1, kRefScrollCtrl ), plRefFlags::kActiveRef ); } } @@ -671,11 +671,11 @@ void pfGUIMultiLineEditCtrl::Write( hsStream *s, hsResMgr *mgr ) //// IPointToPosition //////////////////////////////////////////////////////// // Translates a 2D point on the visible texture surface to a cursor position. -Int32 pfGUIMultiLineEditCtrl::IPointToPosition( Int16 ptX, Int16 ptY, hsBool searchOutsideBounds ) +int32_t pfGUIMultiLineEditCtrl::IPointToPosition( int16_t ptX, int16_t ptY, hsBool searchOutsideBounds ) { // Find our line - Int32 line, start, pos, end, lastVisibleLine; - Int16 x, y; + int32_t line, start, pos, end, lastVisibleLine; + int16_t x, y; if (fPrevCtrl) fScrollPos = GetFirstVisibleLine(); // update the scroll position if we are linked @@ -690,7 +690,7 @@ Int32 pfGUIMultiLineEditCtrl::IPointToPosition( Int16 ptX, Int16 ptY, hsBool s } line = searchOutsideBounds ? 0 : fScrollPos; - y = (Int16)(-( fScrollPos - line ) * fLineHeight); + y = (int16_t)(-( fScrollPos - line ) * fLineHeight); y += fTopMargin; for( ; line < lastVisibleLine; line++, y += fLineHeight ) { @@ -705,7 +705,7 @@ Int32 pfGUIMultiLineEditCtrl::IPointToPosition( Int16 ptX, Int16 ptY, hsBool s for( pos = start; pos < end; pos++ ) { - x = (Int16)IRenderLine( fLeftMargin, 0, start, pos, true ); + x = (int16_t)IRenderLine( fLeftMargin, 0, start, pos, true ); if( x > ptX ) break; } @@ -729,7 +729,7 @@ inline bool IIsWordBreaker( const wchar_t c ) //// IOffsetToNextChar /////////////////////////////////////////////////////// -inline Int32 pfGUIMultiLineEditCtrl::IOffsetToNextChar( wchar_t stringChar ) +inline int32_t pfGUIMultiLineEditCtrl::IOffsetToNextChar( wchar_t stringChar ) { if( stringChar == fColorCodeChar ) return fColorCodeSize; @@ -739,7 +739,7 @@ inline Int32 pfGUIMultiLineEditCtrl::IOffsetToNextChar( wchar_t stringChar ) return 1; } -inline Int32 pfGUIMultiLineEditCtrl::IOffsetToNextCharFromPos( Int32 position ) const +inline int32_t pfGUIMultiLineEditCtrl::IOffsetToNextCharFromPos( int32_t position ) const { if( position >= 0 ) return IOffsetToNextChar( fBuffer[ position ] ); @@ -748,7 +748,7 @@ inline Int32 pfGUIMultiLineEditCtrl::IOffsetToNextCharFromPos( Int32 position } //// IRecalcLineStarts /////////////////////////////////////////////////////// -// Recalculates all the word wrapping/line start values, starting at the +// Recalculates all the uint16_t wrapping/line start values, starting at the // given line. If not forced, recalc will stop once a calculated line start // matches one already stored (this implying that everything after will be // the same as well, assuming contents are the same). If this assumption can't @@ -758,11 +758,11 @@ inline Int32 pfGUIMultiLineEditCtrl::IOffsetToNextCharFromPos( Int32 position // changed, so we assume as a hint that every line before the starting line // is still valid. If startingLine = 0, we recalc 'em all. -Int32 pfGUIMultiLineEditCtrl::IRecalcLineStarts( Int32 startingLine, hsBool force, hsBool dontUpdate ) +int32_t pfGUIMultiLineEditCtrl::IRecalcLineStarts( int32_t startingLine, hsBool force, hsBool dontUpdate ) { - UInt16 wrapWidth, widthCounter; - UInt32 charPos = 0, nextPos, startPos, lastStartPos; - Int32 currLine, realStartingLine; + uint16_t wrapWidth, widthCounter; + uint32_t charPos = 0, nextPos, startPos, lastStartPos; + int32_t currLine, realStartingLine; bool firstLine; wchar_t *buffer; const wchar_t wordBreaks[] = L" \t,."; @@ -805,7 +805,7 @@ Int32 pfGUIMultiLineEditCtrl::IRecalcLineStarts( Int32 startingLine, hsBool fo wrapWidth = fDynTextMap->GetVisibleWidth() - fRightMargin; buffer = fBuffer.AcquireArray(); firstLine = true; - lastStartPos = (UInt32)-1; + lastStartPos = (uint32_t)-1; for( ; charPos < fBuffer.GetCount(); currLine++ ) { @@ -831,7 +831,7 @@ Int32 pfGUIMultiLineEditCtrl::IRecalcLineStarts( Int32 startingLine, hsBool fo firstLine = false; - //// We do a walk where we find the start of the next word (i.e. the end of this word plus + //// We do a walk where we find the start of the next uint16_t (i.e. the end of this uint16_t plus //// any "white space"), and then see if we can fit everything up to that point. If we can, //// keep walking, if not, stop at whatever we had as a starting point. nextPos = charPos; @@ -855,7 +855,7 @@ Int32 pfGUIMultiLineEditCtrl::IRecalcLineStarts( Int32 startingLine, hsBool fo nextPos += IOffsetToNextChar( buffer[ nextPos ] ); // Now see how much width this is - widthCounter = (UInt16)IRenderLine( fLeftMargin, 0, startPos, nextPos, true ); + widthCounter = (uint16_t)IRenderLine( fLeftMargin, 0, startPos, nextPos, true ); // Now we loop. If wrapWidth is too much, we'll break the loop with charPos pointing to the // end of our line. If not, charPos will advance to start the search again @@ -869,7 +869,7 @@ Int32 pfGUIMultiLineEditCtrl::IRecalcLineStarts( Int32 startingLine, hsBool fo while( widthCounter >= wrapWidth && nextPos > startPos ) { nextPos -= IOffsetToNextChar( buffer[ nextPos - 1 ] ); - widthCounter = (UInt16)IRenderLine( fLeftMargin, 0, startPos, nextPos, true ); + widthCounter = (uint16_t)IRenderLine( fLeftMargin, 0, startPos, nextPos, true ); } charPos = nextPos; @@ -900,7 +900,7 @@ Int32 pfGUIMultiLineEditCtrl::IRecalcLineStarts( Int32 startingLine, hsBool fo //// IStoreLineStart ///////////////////////////////////////////////////////// // Stores a single line start, expanding the array if necessary. -hsBool pfGUIMultiLineEditCtrl::IStoreLineStart( UInt32 line, Int32 start ) +hsBool pfGUIMultiLineEditCtrl::IStoreLineStart( uint32_t line, int32_t start ) { if( fLineStarts.GetCount() <= line ) { @@ -918,9 +918,9 @@ hsBool pfGUIMultiLineEditCtrl::IStoreLineStart( UInt32 line, Int32 start ) //// IFindCursorLine ///////////////////////////////////////////////////////// // Calculates the line the cursor is sitting on -Int32 pfGUIMultiLineEditCtrl::IFindCursorLine( Int32 cursorPos ) const +int32_t pfGUIMultiLineEditCtrl::IFindCursorLine( int32_t cursorPos ) const { - Int32 line; + int32_t line; if( cursorPos == -1 ) @@ -951,9 +951,9 @@ void pfGUIMultiLineEditCtrl::IRecalcFromCursor( hsBool force ) // doing this, we are inserting into (and offseting inside) a selection, // so we don't want the start moving around. -void pfGUIMultiLineEditCtrl::IOffsetLineStarts( UInt32 position, Int32 offset, hsBool offsetSelectionEnd ) +void pfGUIMultiLineEditCtrl::IOffsetLineStarts( uint32_t position, int32_t offset, hsBool offsetSelectionEnd ) { - Int32 line; + int32_t line; // Check our first line and make sure offsetting it won't make it invalid. // If it will, we need to recalc the line starts entirely (which is fine, @@ -990,7 +990,7 @@ void pfGUIMultiLineEditCtrl::IOffsetLineStarts( UInt32 position, Int32 offset //// HandleMouseDown ///////////////////////////////////////////////////////// -void pfGUIMultiLineEditCtrl::HandleMouseDown( hsPoint3 &mousePt, UInt8 modifiers ) +void pfGUIMultiLineEditCtrl::HandleMouseDown( hsPoint3 &mousePt, uint8_t modifiers ) { if( fDynTextMap == nil || !fBounds.IsInside( &mousePt ) ) return; @@ -999,12 +999,12 @@ void pfGUIMultiLineEditCtrl::HandleMouseDown( hsPoint3 &mousePt, UInt8 modifi mousePt.fX *= fDynTextMap->GetVisibleWidth(); mousePt.fY *= fDynTextMap->GetVisibleHeight(); - IMoveCursorTo( IPointToPosition( (Int16)(mousePt.fX), (Int16)(mousePt.fY) ) ); + IMoveCursorTo( IPointToPosition( (int16_t)(mousePt.fX), (int16_t)(mousePt.fY) ) ); } //// HandleMouseUp /////////////////////////////////////////////////////////// -void pfGUIMultiLineEditCtrl::HandleMouseUp( hsPoint3 &mousePt, UInt8 modifiers ) +void pfGUIMultiLineEditCtrl::HandleMouseUp( hsPoint3 &mousePt, uint8_t modifiers ) { if( fDynTextMap == nil || !fBounds.IsInside( &mousePt ) ) return; @@ -1013,12 +1013,12 @@ void pfGUIMultiLineEditCtrl::HandleMouseUp( hsPoint3 &mousePt, UInt8 modifier mousePt.fX *= fDynTextMap->GetVisibleWidth(); mousePt.fY *= fDynTextMap->GetVisibleHeight(); - IMoveCursorTo( IPointToPosition( (Int16)(mousePt.fX), (Int16)(mousePt.fY) ) ); + IMoveCursorTo( IPointToPosition( (int16_t)(mousePt.fX), (int16_t)(mousePt.fY) ) ); } //// HandleMouseDrag ///////////////////////////////////////////////////////// -void pfGUIMultiLineEditCtrl::HandleMouseDrag( hsPoint3 &mousePt, UInt8 modifiers ) +void pfGUIMultiLineEditCtrl::HandleMouseDrag( hsPoint3 &mousePt, uint8_t modifiers ) { if( fDynTextMap == nil || !fBounds.IsInside( &mousePt ) ) return; @@ -1027,10 +1027,10 @@ void pfGUIMultiLineEditCtrl::HandleMouseDrag( hsPoint3 &mousePt, UInt8 modifi mousePt.fX *= fDynTextMap->GetVisibleWidth(); mousePt.fY *= fDynTextMap->GetVisibleHeight(); - IMoveCursorTo( IPointToPosition( (Int16)(mousePt.fX), (Int16)(mousePt.fY) ) ); + IMoveCursorTo( IPointToPosition( (int16_t)(mousePt.fX), (int16_t)(mousePt.fY) ) ); } -hsBool pfGUIMultiLineEditCtrl::HandleKeyPress( wchar_t key, UInt8 modifiers ) +hsBool pfGUIMultiLineEditCtrl::HandleKeyPress( wchar_t key, uint8_t modifiers ) { if ((fPrevCtrl || fNextCtrl) && (fLineStarts.GetCount() <= GetFirstVisibleLine())) return true; // we're ignoring if we can't actually edit our visible frame (and we're linked) @@ -1062,7 +1062,7 @@ hsBool pfGUIMultiLineEditCtrl::HandleKeyPress( wchar_t key, UInt8 modifiers ) return true; } -hsBool pfGUIMultiLineEditCtrl::HandleKeyEvent( pfGameGUIMgr::EventType event, plKeyDef key, UInt8 modifiers ) +hsBool pfGUIMultiLineEditCtrl::HandleKeyEvent( pfGameGUIMgr::EventType event, plKeyDef key, uint8_t modifiers ) { if( key == KEY_CAPSLOCK ) return false; @@ -1136,11 +1136,11 @@ hsBool pfGUIMultiLineEditCtrl::HandleKeyEvent( pfGameGUIMgr::EventType event, p // should probably call IMoveCursorTo() unless you really know what you're // doing and don't want the current selection updated. -void pfGUIMultiLineEditCtrl::ISetCursor( Int32 newPosition ) +void pfGUIMultiLineEditCtrl::ISetCursor( int32_t newPosition ) { fCursorPos = newPosition; - Int32 newLine = IFindCursorLine(); + int32_t newLine = IFindCursorLine(); // Rescroll if necessary if( fLastCursorLine != newLine ) @@ -1161,7 +1161,7 @@ void pfGUIMultiLineEditCtrl::ISetCursor( Int32 newPosition ) { // -2 here for a reason: 1 because we want the last fully visible line, not partially visible, // and 1 because we want the actual last visible line index, which is of course start + len - 1 - Int32 delta = newLine - ( fScrollPos + ICalcNumVisibleLines() - 2 ); + int32_t delta = newLine - ( fScrollPos + ICalcNumVisibleLines() - 2 ); if( delta > 0 ) { if (fNextCtrl) // we are linked @@ -1190,7 +1190,7 @@ void pfGUIMultiLineEditCtrl::ISetCursor( Int32 newPosition ) void pfGUIMultiLineEditCtrl::IMoveCursor( pfGUIMultiLineEditCtrl::Direction dir ) { - Int32 cursor = fCursorPos, line, offset, end; + int32_t cursor = fCursorPos, line, offset, end; switch( dir ) @@ -1299,7 +1299,7 @@ void pfGUIMultiLineEditCtrl::IMoveCursor( pfGUIMultiLineEditCtrl::Direction d // Moves the cursor to the given absolute position and updates the selection // area accordingly and if necessary. -void pfGUIMultiLineEditCtrl::IMoveCursorTo( Int32 position ) +void pfGUIMultiLineEditCtrl::IMoveCursorTo( int32_t position ) { ISetCursor( position ); } @@ -1387,14 +1387,14 @@ void pfGUIMultiLineEditCtrl::InsertColor( hsColorRGBA &color ) // insertion of this code changes appearance of following characters } -void pfGUIMultiLineEditCtrl::IActuallyInsertColor( Int32 pos, hsColorRGBA &color ) +void pfGUIMultiLineEditCtrl::IActuallyInsertColor( int32_t pos, hsColorRGBA &color ) { if ( fBufferLimit == -1 || fBuffer.GetCount()+4 < fBufferLimit-1 ) { fBuffer.Insert( pos, fColorCodeChar ); - fBuffer.Insert( pos + 1, (UInt8)( color.r * 255.f ) ); - fBuffer.Insert( pos + 2, (UInt8)( color.g * 255.f ) ); - fBuffer.Insert( pos + 3, (UInt8)( color.b * 255.f ) ); + fBuffer.Insert( pos + 1, (uint8_t)( color.r * 255.f ) ); + fBuffer.Insert( pos + 2, (uint8_t)( color.g * 255.f ) ); + fBuffer.Insert( pos + 3, (uint8_t)( color.b * 255.f ) ); fBuffer.Insert( pos + 4, fColorCodeChar ); } } @@ -1402,7 +1402,7 @@ void pfGUIMultiLineEditCtrl::IActuallyInsertColor( Int32 pos, hsColorRGBA &co //// InsertStyle ///////////////////////////////////////////////////////////// // Same thing as InsertColor(), only with a style code (or two). -void pfGUIMultiLineEditCtrl::InsertStyle( UInt8 fontStyle ) +void pfGUIMultiLineEditCtrl::InsertStyle( uint8_t fontStyle ) { IActuallyInsertStyle( fCursorPos, fontStyle ); @@ -1412,7 +1412,7 @@ void pfGUIMultiLineEditCtrl::InsertStyle( UInt8 fontStyle ) // insertion of this code changes appearance of following characters } -void pfGUIMultiLineEditCtrl::IActuallyInsertStyle( Int32 pos, UInt8 style ) +void pfGUIMultiLineEditCtrl::IActuallyInsertStyle( int32_t pos, uint8_t style ) { if ( fBufferLimit == -1 || fBuffer.GetCount() + 3 < fBufferLimit-1 ) { @@ -1431,7 +1431,7 @@ void pfGUIMultiLineEditCtrl::DeleteChar( void ) { if( fCursorPos < fBuffer.GetCount() - 1 ) { - Int32 offset = IOffsetToNextChar( fBuffer[ fCursorPos ] ); + int32_t offset = IOffsetToNextChar( fBuffer[ fCursorPos ] ); bool forceUpdate = IIsCodeChar( fBuffer[ fCursorPos ] ); fBuffer.Remove( fCursorPos, offset ); @@ -1446,9 +1446,9 @@ void pfGUIMultiLineEditCtrl::DeleteChar( void ) // Generic coded-to-non-coded conversion. Returns a copy of the string that // the caller must free. -wchar_t *pfGUIMultiLineEditCtrl::ICopyRange( Int32 start, Int32 end ) const +wchar_t *pfGUIMultiLineEditCtrl::ICopyRange( int32_t start, int32_t end ) const { - Int32 stringSize, pos; + int32_t stringSize, pos; wchar_t *string; @@ -1460,7 +1460,7 @@ wchar_t *pfGUIMultiLineEditCtrl::ICopyRange( Int32 start, Int32 end ) const } // Our string... - string = TRACKED_NEW wchar_t[ stringSize + 1 ]; + string = new wchar_t[ stringSize + 1 ]; // Now actually copy the characters for( stringSize = 0, pos = start; pos < end; pos = pos + IOffsetToNextChar( fBuffer[ pos ] ) ) @@ -1493,29 +1493,29 @@ void pfGUIMultiLineEditCtrl::ClearBuffer( void ) void pfGUIMultiLineEditCtrl::SetBuffer( const char *asciiText ) { - SetBuffer( (const UInt8 *)asciiText, (UInt32)strlen( asciiText ) ); + SetBuffer( (const uint8_t *)asciiText, (uint32_t)strlen( asciiText ) ); } void pfGUIMultiLineEditCtrl::SetBuffer( const wchar_t *asciiText ) { - SetBuffer( (const UInt16 *)asciiText, (UInt32)wcslen( asciiText ) ); + SetBuffer( (const uint16_t *)asciiText, (uint32_t)wcslen( asciiText ) ); } //// SetBuffer /////////////////////////////////////////////////////////////// // The non-0-terminated-string version that can handle buffers with style // codes in them. -void pfGUIMultiLineEditCtrl::SetBuffer( const UInt8 *codedText, UInt32 length ) +void pfGUIMultiLineEditCtrl::SetBuffer( const uint8_t *codedText, uint32_t length ) { - // convert to UInt16 and set - UInt16 *convertedText = TRACKED_NEW UInt16[ length ]; - for( Int32 curChar = 0; curChar < length; curChar++ ) - convertedText[ curChar ] = (UInt16)codedText[ curChar ]; + // convert to uint16_t and set + uint16_t *convertedText = new uint16_t[ length ]; + for( int32_t curChar = 0; curChar < length; curChar++ ) + convertedText[ curChar ] = (uint16_t)codedText[ curChar ]; SetBuffer(convertedText,length); delete [] convertedText; } -void pfGUIMultiLineEditCtrl::SetBuffer( const UInt16 *codedText, UInt32 length ) +void pfGUIMultiLineEditCtrl::SetBuffer( const uint16_t *codedText, uint32_t length ) { // recursively call back to the first control and set it if (fPrevCtrl) @@ -1574,7 +1574,7 @@ wchar_t *pfGUIMultiLineEditCtrl::GetNonCodedBufferW( void ) const // Basically does a blanket copy of the entire buffer and returns it and // the length. The caller is responsible for freeing the buffer. -UInt8 *pfGUIMultiLineEditCtrl::GetCodedBuffer( UInt32 &length ) const +uint8_t *pfGUIMultiLineEditCtrl::GetCodedBuffer( uint32_t &length ) const { // recursively search back to the first control in the linked list and grab its buffer if (fPrevCtrl) @@ -1583,24 +1583,24 @@ UInt8 *pfGUIMultiLineEditCtrl::GetCodedBuffer( UInt32 &length ) const { length = fBuffer.GetCount() - 1; - // convert to UInt8 and return - UInt8 *buffer = TRACKED_NEW UInt8[ length ]; + // convert to uint8_t and return + uint8_t *buffer = new uint8_t[ length ]; - for (Int32 curChar = 0; curChar < length; curChar++) + for (int32_t curChar = 0; curChar < length; curChar++) { if (fBuffer[ curChar ] > (wchar_t)0xFF) { // char doesn't fit, fake it with a space - buffer[ curChar ] = (UInt8)(L' '); + buffer[ curChar ] = (uint8_t)(L' '); } else - buffer[ curChar ] = (UInt8)fBuffer[ curChar ]; + buffer[ curChar ] = (uint8_t)fBuffer[ curChar ]; } return buffer; } } -UInt16 *pfGUIMultiLineEditCtrl::GetCodedBufferW( UInt32 &length ) const +uint16_t *pfGUIMultiLineEditCtrl::GetCodedBufferW( uint32_t &length ) const { // recursively search back to the first control in the linked list and grab its buffer if (fPrevCtrl) @@ -1609,16 +1609,16 @@ UInt16 *pfGUIMultiLineEditCtrl::GetCodedBufferW( UInt32 &length ) const { length = fBuffer.GetCount() - 1; - UInt16 *buffer = TRACKED_NEW UInt16[ length ]; + uint16_t *buffer = new uint16_t[ length ]; // AcquireArray() isn't const... - memcpy( buffer, &fBuffer[ 0 ], length * sizeof(UInt16) ); + memcpy( buffer, &fBuffer[ 0 ], length * sizeof(uint16_t) ); return buffer; } } -UInt32 pfGUIMultiLineEditCtrl::GetBufferSize() +uint32_t pfGUIMultiLineEditCtrl::GetBufferSize() { return fBuffer.GetCount() - 1; } @@ -1627,9 +1627,9 @@ UInt32 pfGUIMultiLineEditCtrl::GetBufferSize() // Given a character position (i.e. a buffer position if we didn't have // control codes), returns the actual buffer pos. -Int32 pfGUIMultiLineEditCtrl::ICharPosToBufferPos( Int32 charPos ) const +int32_t pfGUIMultiLineEditCtrl::ICharPosToBufferPos( int32_t charPos ) const { - Int32 pos; + int32_t pos; for( pos = 0; charPos > 0 && pos < fBuffer.GetCount() - 1; pos += IOffsetToNextCharFromPos( pos ), charPos-- ); @@ -1720,7 +1720,7 @@ void pfGUIMultiLineEditCtrl::ClearEventProc() } } -Int32 pfGUIMultiLineEditCtrl::GetFirstVisibleLine() +int32_t pfGUIMultiLineEditCtrl::GetFirstVisibleLine() { // recursively search back to the first control and work our way forwards to where we are supposed to be if (fPrevCtrl) @@ -1728,13 +1728,13 @@ Int32 pfGUIMultiLineEditCtrl::GetFirstVisibleLine() return fScrollPos; // we're the first control, so we show the first part of the buffer } -Int32 pfGUIMultiLineEditCtrl::GetLastVisibleLine() +int32_t pfGUIMultiLineEditCtrl::GetLastVisibleLine() { // simply add our number of lines to our first visible line return GetFirstVisibleLine()+ICalcNumVisibleLines()-1; } -void pfGUIMultiLineEditCtrl::SetGlobalStartLine(Int32 line) +void pfGUIMultiLineEditCtrl::SetGlobalStartLine(int32_t line) { // recursively call back to the first control and set it if (fPrevCtrl) @@ -1762,8 +1762,8 @@ void pfGUIMultiLineEditCtrl::IUpdateBuffer() if (fPrevCtrl) { // copy the buffer from our global one - UInt32 length; - UInt16 *codedText = GetCodedBufferW(length); + uint32_t length; + uint16_t *codedText = GetCodedBufferW(length); fBuffer.Reset(); fBuffer.Insert( 0, length, (wchar_t *)codedText ); fBuffer.Append( 0 ); @@ -1783,7 +1783,7 @@ void pfGUIMultiLineEditCtrl::ISetGlobalBuffer() } } -void pfGUIMultiLineEditCtrl::ISetLineStarts(hsTArray lineStarts) +void pfGUIMultiLineEditCtrl::ISetLineStarts(hsTArray lineStarts) { if (fNextCtrl) fNextCtrl->ISetLineStarts(lineStarts); // pass it on down @@ -1803,7 +1803,7 @@ void pfGUIMultiLineEditCtrl::SetMargins(int top, int left, int bottom, int right IRecalcLineStarts(0,false); } -void pfGUIMultiLineEditCtrl::IHitEndOfControlList(Int32 cursorPos) +void pfGUIMultiLineEditCtrl::IHitEndOfControlList(int32_t cursorPos) { if (fPrevCtrl) fPrevCtrl->IHitEndOfControlList(cursorPos); @@ -1814,7 +1814,7 @@ void pfGUIMultiLineEditCtrl::IHitEndOfControlList(Int32 cursorPos) } } -void pfGUIMultiLineEditCtrl::IHitBeginningOfControlList(Int32 cursorPos) +void pfGUIMultiLineEditCtrl::IHitBeginningOfControlList(int32_t cursorPos) { if (fPrevCtrl) fPrevCtrl->IHitBeginningOfControlList(cursorPos); @@ -1834,7 +1834,7 @@ void pfGUIMultiLineEditCtrl::SetFontFace(std::string fontFace) fDynTextMap->CalcStringWidth( "The quick brown fox jumped over the lazy dog.", &fLineHeight ); } -void pfGUIMultiLineEditCtrl::SetFontSize(UInt8 fontSize) +void pfGUIMultiLineEditCtrl::SetFontSize(uint8_t fontSize) { fFontSize = fontSize; fFontFlagsSet |= kFontSizeSet; @@ -1867,8 +1867,8 @@ void pfGUIMultiLineEditCtrl::DeleteLinesFromTop(int numLines) if (fPrevCtrl || fNextCtrl) return; // don't do anything - UInt32 bufferLen = 0; - UInt16* buffer = GetCodedBufferW(bufferLen); + uint32_t bufferLen = 0; + uint16_t* buffer = GetCodedBufferW(bufferLen); if (bufferLen == 0) { @@ -1883,7 +1883,7 @@ void pfGUIMultiLineEditCtrl::DeleteLinesFromTop(int numLines) // search for the first newline and nuke it and everything before it bool skippingColor = false, skippingStyle = false; int curColorPos = 0, curStylePos = 0; - for (UInt32 curChar = 0; curChar < bufferLen - 1; ++curChar) + for (uint32_t curChar = 0; curChar < bufferLen - 1; ++curChar) { // we need to skip the crappy color and style "tags" so non-character values inside them // don't trigger our newline check @@ -1925,10 +1925,10 @@ void pfGUIMultiLineEditCtrl::DeleteLinesFromTop(int numLines) if ((buffer[curChar] == L'\n') || (buffer[curChar] == L'\r')) { hitEnd = false; - UInt32 newBufferStart = curChar + 1; // +1 so we eat the newline as well - UInt32 newBufferLen = bufferLen - newBufferStart; - MemCopy(buffer, buffer + newBufferStart, newBufferLen * sizeof(UInt16)); // copy all bytes after the newline to the beginning - MemSet(buffer + newBufferLen, 0, (bufferLen - newBufferLen) * sizeof(UInt16)); // fill out the rest of the buffer with null chars + uint32_t newBufferStart = curChar + 1; // +1 so we eat the newline as well + uint32_t newBufferLen = bufferLen - newBufferStart; + memcpy(buffer, buffer + newBufferStart, newBufferLen * sizeof(uint16_t)); // copy all bytes after the newline to the beginning + memset(buffer + newBufferLen, 0, (bufferLen - newBufferLen) * sizeof(uint16_t)); // fill out the rest of the buffer with null chars bufferLen = newBufferLen; break; } diff --git a/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIMultiLineEditCtrl.h b/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIMultiLineEditCtrl.h index d9d0f46a..c73f5f85 100644 --- a/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIMultiLineEditCtrl.h +++ b/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIMultiLineEditCtrl.h @@ -68,10 +68,10 @@ public: virtual ~pfGUIMultiLineEditProc() {} // we've hit the end of the control list (by moving the cursor) - virtual void OnEndOfControlList(Int32 cursorPos) {} + virtual void OnEndOfControlList(int32_t cursorPos) {} // we've hit the beginning of the control ist (by moving the cursor) - virtual void OnBeginningOfControlList(Int32 cursorPos) {} + virtual void OnBeginningOfControlList(int32_t cursorPos) {} }; class pfGUIMultiLineEditCtrl : public pfGUIControlMod @@ -97,32 +97,32 @@ class pfGUIMultiLineEditCtrl : public pfGUIControlMod mutable hsTArray fBuffer; // Because AcquireArray() isn't const - hsTArray fLineStarts; - UInt16 fLineHeight, fCurrCursorX, fCurrCursorY; - Int32 fCursorPos, fLastCursorLine; + hsTArray fLineStarts; + uint16_t fLineHeight, fCurrCursorX, fCurrCursorY; + int32_t fCursorPos, fLastCursorLine; hsBool fIgnoreNextKey, fReadyToRender; hsBounds3Ext fLastP2PArea; - Int8 fLockCount; - UInt8 fCalcedFontSize; // The font size that we calced our line height at + int8_t fLockCount; + uint8_t fCalcedFontSize; // The font size that we calced our line height at - UInt8 fLastKeyModifiers; + uint8_t fLastKeyModifiers; wchar_t fLastKeyPressed; static wchar_t fColorCodeChar, fStyleCodeChar; - static UInt32 fColorCodeSize, fStyleCodeSize; + static uint32_t fColorCodeSize, fStyleCodeSize; - virtual hsBool IEval( double secs, hsScalar del, UInt32 dirty ); // called only by owner object's Eval() + virtual hsBool IEval( double secs, float del, uint32_t dirty ); // called only by owner object's Eval() virtual void IPostSetUpDynTextMap( void ); virtual void IUpdate( void ); - void IUpdate( Int32 startLine, Int32 endLine ); + void IUpdate( int32_t startLine, int32_t endLine ); friend class pfMLScrollProc; pfGUIValueCtrl *fScrollControl; pfMLScrollProc *fScrollProc; - Int32 fScrollPos; - Int32 fBufferLimit; + int32_t fScrollPos; + int32_t fBufferLimit; pfGUIMultiLineEditCtrl *fNextCtrl; // used for linking multiple controls together to share a buffer pfGUIMultiLineEditCtrl *fPrevCtrl; @@ -131,8 +131,8 @@ class pfGUIMultiLineEditCtrl : public pfGUIControlMod std::string fFontFace; hsColorRGBA fFontColor; - UInt8 fFontSize; - UInt8 fFontStyle; + uint8_t fFontSize; + uint8_t fFontStyle; enum flagsSet { kFontFaceSet = 1, @@ -140,49 +140,49 @@ class pfGUIMultiLineEditCtrl : public pfGUIControlMod kFontSizeSet = 4, kFontStyleSet = 8 }; - UInt8 fFontFlagsSet; + uint8_t fFontFlagsSet; int fTopMargin,fLeftMargin,fBottomMargin,fRightMargin; void IMoveCursor( Direction dir ); - void IMoveCursorTo( Int32 position ); // Updates selection - void ISetCursor( Int32 newPosition ); // Doesn't update selection + void IMoveCursorTo( int32_t position ); // Updates selection + void ISetCursor( int32_t newPosition ); // Doesn't update selection - Int32 IRecalcLineStarts( Int32 startingLine, hsBool force, hsBool dontUpdate = false ); + int32_t IRecalcLineStarts( int32_t startingLine, hsBool force, hsBool dontUpdate = false ); void IRecalcFromCursor( hsBool forceUpdate = false ); - Int32 IFindCursorLine( Int32 cursorPos = -1 ) const; - hsBool IStoreLineStart( UInt32 line, Int32 start ); - void IOffsetLineStarts( UInt32 position, Int32 offset, hsBool offsetSelectionEnd = false ); - Int32 IPointToPosition( Int16 x, Int16 y, hsBool searchOutsideBounds = false ); - Int32 ICalcNumVisibleLines( void ) const; - - void IReadColorCode( Int32 &pos, hsColorRGBA &color ) const; - void IReadStyleCode( Int32 &pos, UInt8 &fontStyle ) const; - UInt32 IRenderLine( UInt16 x, UInt16 y, Int32 start, Int32 end, hsBool dontRender = false ); - hsBool IFindLastColorCode( Int32 pos, hsColorRGBA &color, hsBool ignoreFirstCharacter = false ) const; - hsBool IFindLastStyleCode( Int32 pos, UInt8 &style, hsBool ignoreFirstCharacter = false ) const; + int32_t IFindCursorLine( int32_t cursorPos = -1 ) const; + hsBool IStoreLineStart( uint32_t line, int32_t start ); + void IOffsetLineStarts( uint32_t position, int32_t offset, hsBool offsetSelectionEnd = false ); + int32_t IPointToPosition( int16_t x, int16_t y, hsBool searchOutsideBounds = false ); + int32_t ICalcNumVisibleLines( void ) const; + + void IReadColorCode( int32_t &pos, hsColorRGBA &color ) const; + void IReadStyleCode( int32_t &pos, uint8_t &fontStyle ) const; + uint32_t IRenderLine( uint16_t x, uint16_t y, int32_t start, int32_t end, hsBool dontRender = false ); + hsBool IFindLastColorCode( int32_t pos, hsColorRGBA &color, hsBool ignoreFirstCharacter = false ) const; + hsBool IFindLastStyleCode( int32_t pos, uint8_t &style, hsBool ignoreFirstCharacter = false ) const; inline static bool IIsCodeChar( const wchar_t c ); inline static bool IIsRenderable( const wchar_t c ); - inline static Int32 IOffsetToNextChar( wchar_t stringChar ); - inline Int32 IOffsetToNextCharFromPos( Int32 pos ) const; + inline static int32_t IOffsetToNextChar( wchar_t stringChar ); + inline int32_t IOffsetToNextCharFromPos( int32_t pos ) const; - void IActuallyInsertColor( Int32 pos, hsColorRGBA &color ); - void IActuallyInsertStyle( Int32 pos, UInt8 style ); + void IActuallyInsertColor( int32_t pos, hsColorRGBA &color ); + void IActuallyInsertStyle( int32_t pos, uint8_t style ); void IUpdateScrollRange( void ); - wchar_t *ICopyRange( Int32 start, Int32 end ) const; + wchar_t *ICopyRange( int32_t start, int32_t end ) const; - Int32 ICharPosToBufferPos( Int32 charPos ) const; + int32_t ICharPosToBufferPos( int32_t charPos ) const; void IUpdateBuffer(); void IUpdateLineStarts(); void ISetGlobalBuffer(); - void ISetLineStarts(hsTArray lineStarts); + void ISetLineStarts(hsTArray lineStarts); - void IHitEndOfControlList(Int32 cursorPos); - void IHitBeginningOfControlList(Int32 cursorPos); + void IHitEndOfControlList(int32_t cursorPos); + void IHitBeginningOfControlList(int32_t cursorPos); public: @@ -202,12 +202,12 @@ class pfGUIMultiLineEditCtrl : public pfGUIControlMod virtual void Read( hsStream* s, hsResMgr* mgr ); virtual void Write( hsStream* s, hsResMgr* mgr ); - virtual void HandleMouseDown( hsPoint3 &mousePt, UInt8 modifiers ); - virtual void HandleMouseUp( hsPoint3 &mousePt, UInt8 modifiers ); - virtual void HandleMouseDrag( hsPoint3 &mousePt, UInt8 modifiers ); + virtual void HandleMouseDown( hsPoint3 &mousePt, uint8_t modifiers ); + virtual void HandleMouseUp( hsPoint3 &mousePt, uint8_t modifiers ); + virtual void HandleMouseDrag( hsPoint3 &mousePt, uint8_t modifiers ); - virtual hsBool HandleKeyPress( wchar_t key, UInt8 modifiers ); - virtual hsBool HandleKeyEvent( pfGameGUIMgr::EventType event, plKeyDef key, UInt8 modifiers ); + virtual hsBool HandleKeyPress( wchar_t key, uint8_t modifiers ); + virtual hsBool HandleKeyEvent( pfGameGUIMgr::EventType event, plKeyDef key, uint8_t modifiers ); virtual void PurgeDynaTextMapImage(); @@ -219,7 +219,7 @@ class pfGUIMultiLineEditCtrl : public pfGUIControlMod kKeyPressedEvent }; - void SetScrollPosition( Int32 topLine ); + void SetScrollPosition( int32_t topLine ); void MoveCursor( Direction dir ); void InsertChar( char c ); @@ -227,23 +227,23 @@ class pfGUIMultiLineEditCtrl : public pfGUIControlMod void InsertString( const char *string ); void InsertString( const wchar_t *string ); void InsertColor( hsColorRGBA &color ); - void InsertStyle( UInt8 fontStyle ); + void InsertStyle( uint8_t fontStyle ); void DeleteChar( void ); void ClearBuffer( void ); void SetBuffer( const char *asciiText ); void SetBuffer( const wchar_t *asciiText ); - void SetBuffer( const UInt8 *codedText, UInt32 length ); - void SetBuffer( const UInt16 *codedText, UInt32 length ); + void SetBuffer( const uint8_t *codedText, uint32_t length ); + void SetBuffer( const uint16_t *codedText, uint32_t length ); char *GetNonCodedBuffer( void ) const; wchar_t *GetNonCodedBufferW( void ) const; - UInt8 *GetCodedBuffer( UInt32 &length ) const; - UInt16 *GetCodedBufferW( UInt32 &length ) const; - UInt32 GetBufferSize(); + uint8_t *GetCodedBuffer( uint32_t &length ) const; + uint16_t *GetCodedBufferW( uint32_t &length ) const; + uint32_t GetBufferSize(); - void SetBufferLimit(Int32 limit) { fBufferLimit = limit; } - Int32 GetBufferLimit() { return fBufferLimit; } + void SetBufferLimit(int32_t limit) { fBufferLimit = limit; } + int32_t GetBufferLimit() { return fBufferLimit; } - void GetThisKeyPressed( char &key, UInt8 &modifiers ) const { key = (char)fLastKeyPressed; modifiers = fLastKeyModifiers; } + void GetThisKeyPressed( char &key, uint8_t &modifiers ) const { key = (char)fLastKeyPressed; modifiers = fLastKeyModifiers; } void Lock( void ); void Unlock( void ); @@ -259,21 +259,21 @@ class pfGUIMultiLineEditCtrl : public pfGUIControlMod void ClearPrev(); void SetEventProc( pfGUIMultiLineEditProc *eventProc ); void ClearEventProc(); - Int32 GetFirstVisibleLine(); - Int32 GetLastVisibleLine(); - Int32 GetNumVisibleLines() {return ICalcNumVisibleLines();} - void SetGlobalStartLine(Int32 line); + int32_t GetFirstVisibleLine(); + int32_t GetLastVisibleLine(); + int32_t GetNumVisibleLines() {return ICalcNumVisibleLines();} + void SetGlobalStartLine(int32_t line); - void SetCursorToLoc(Int32 loc) {ISetCursor(loc);} + void SetCursorToLoc(int32_t loc) {ISetCursor(loc);} void SetMargins(int top, int left, int bottom, int right); - UInt8 GetFontSize() {return fFontSize;} // because we're too cool to use the color scheme crap + uint8_t GetFontSize() {return fFontSize;} // because we're too cool to use the color scheme crap void SetFontFace(std::string fontFace); void SetFontColor(hsColorRGBA fontColor) {fFontColor = fontColor; fFontFlagsSet |= kFontColorSet;} - void SetFontSize(UInt8 fontSize); - void SetFontStyle(UInt8 fontStyle) {fFontStyle = fontStyle; fFontFlagsSet |= kFontStyleSet;} + void SetFontSize(uint8_t fontSize); + void SetFontStyle(uint8_t fontStyle) {fFontStyle = fontStyle; fFontFlagsSet |= kFontStyleSet;} hsBool ShowingBeginningOfBuffer(); hsBool ShowingEndOfBuffer(); diff --git a/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIPopUpMenu.cpp b/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIPopUpMenu.cpp index 7efd73c6..b51ec9de 100644 --- a/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIPopUpMenu.cpp +++ b/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIPopUpMenu.cpp @@ -49,7 +49,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // // ////////////////////////////////////////////////////////////////////////////// -#include "hsTypes.h" +#include "HeadSpin.h" #include "pfGameGUIMgr.h" #include "pfGUIPopUpMenu.h" #include "pfGUIMenuItem.h" @@ -86,7 +86,7 @@ class pfPopUpKeyGenerator { public: char fPrefix[ 128 ]; - UInt32 fKeyCount; + uint32_t fKeyCount; plLocation fLoc; pfPopUpKeyGenerator( const char *p, const plLocation &loc ) @@ -110,11 +110,11 @@ class pfGUIMenuItemProc : public pfGUICtrlProcObject protected: pfGUIPopUpMenu *fParent; - UInt32 fIndex; + uint32_t fIndex; public: - pfGUIMenuItemProc( pfGUIPopUpMenu *parent, UInt32 idx ) + pfGUIMenuItemProc( pfGUIPopUpMenu *parent, uint32_t idx ) { fParent = parent; fIndex = idx; @@ -125,9 +125,9 @@ class pfGUIMenuItemProc : public pfGUICtrlProcObject fParent->IHandleMenuSomething( fIndex, ctrl ); } - virtual void HandleExtendedEvent( pfGUIControlMod *ctrl, UInt32 event ) + virtual void HandleExtendedEvent( pfGUIControlMod *ctrl, uint32_t event ) { - fParent->IHandleMenuSomething( fIndex, ctrl, (Int32)event ); + fParent->IHandleMenuSomething( fIndex, ctrl, (int32_t)event ); } }; @@ -235,13 +235,13 @@ void pfGUIPopUpMenu::Read( hsStream *s, hsResMgr *mgr ) pfGUIDialogMod::Read( s, mgr ); // In case we need it... - fKeyGen = TRACKED_NEW pfPopUpKeyGenerator( GetName(), GetKey()->GetUoid().GetLocation() ); + fKeyGen = new pfPopUpKeyGenerator( GetName(), GetKey()->GetUoid().GetLocation() ); fOriginX = fOriginY = -1.f; fMargin = s->ReadLE16(); - UInt32 i, count = s->ReadLE32(); + uint32_t i, count = s->ReadLE32(); fMenuItems.SetCountAndZero( count ); for( i = 0; i < count; i++ ) { @@ -253,12 +253,12 @@ void pfGUIPopUpMenu::Read( hsStream *s, hsResMgr *mgr ) fMenuItems[ i ].fHandler = pfGUICtrlProcWriteableObject::Read( s ); - mgr->ReadKeyNotifyMe( s, TRACKED_NEW plGenRefMsg( GetKey(), plRefMsg::kOnCreate, i, kRefSubMenu ), plRefFlags::kActiveRef ); + mgr->ReadKeyNotifyMe( s, new plGenRefMsg( GetKey(), plRefMsg::kOnCreate, i, kRefSubMenu ), plRefFlags::kActiveRef ); } - mgr->ReadKeyNotifyMe( s, TRACKED_NEW plGenRefMsg( GetKey(), plRefMsg::kOnCreate, -1, kRefSkin ), plRefFlags::kActiveRef ); - mgr->ReadKeyNotifyMe( s, TRACKED_NEW plGenRefMsg( GetKey(), plRefMsg::kOnCreate, -1, kRefOriginAnchor ), plRefFlags::kPassiveRef ); - mgr->ReadKeyNotifyMe( s, TRACKED_NEW plGenRefMsg( GetKey(), plRefMsg::kOnCreate, -1, kRefOriginContext ), plRefFlags::kPassiveRef ); + mgr->ReadKeyNotifyMe( s, new plGenRefMsg( GetKey(), plRefMsg::kOnCreate, -1, kRefSkin ), plRefFlags::kActiveRef ); + mgr->ReadKeyNotifyMe( s, new plGenRefMsg( GetKey(), plRefMsg::kOnCreate, -1, kRefOriginAnchor ), plRefFlags::kPassiveRef ); + mgr->ReadKeyNotifyMe( s, new plGenRefMsg( GetKey(), plRefMsg::kOnCreate, -1, kRefOriginContext ), plRefFlags::kPassiveRef ); fAlignment = (Alignment)s->ReadByte(); @@ -273,7 +273,7 @@ void pfGUIPopUpMenu::Write( hsStream *s, hsResMgr *mgr ) s->WriteLE16( fMargin ); s->WriteLE32( fMenuItems.GetCount() ); - UInt32 i; + uint32_t i; for( i = 0; i < fMenuItems.GetCount(); i++ ) { char writeTemp[ 256 ]; @@ -298,15 +298,15 @@ void pfGUIPopUpMenu::Write( hsStream *s, hsResMgr *mgr ) mgr->WriteKey( s, fOriginAnchor ); mgr->WriteKey( s, fOriginContext ); - s->WriteByte( (UInt8)fAlignment ); + s->WriteByte( (uint8_t)fAlignment ); } void pfGUIPopUpMenu::SetOriginAnchor( plSceneObject *anchor, pfGUIDialogMod *context ) { fOriginAnchor = anchor; fOriginContext = context; - hsgResMgr::ResMgr()->AddViaNotify( fOriginAnchor->GetKey(), TRACKED_NEW plGenRefMsg( GetKey(), plRefMsg::kOnCreate, -1, kRefOriginAnchor ), plRefFlags::kPassiveRef ); - hsgResMgr::ResMgr()->AddViaNotify( fOriginContext->GetKey(), TRACKED_NEW plGenRefMsg( GetKey(), plRefMsg::kOnCreate, -1, kRefOriginContext ), plRefFlags::kPassiveRef ); + hsgResMgr::ResMgr()->AddViaNotify( fOriginAnchor->GetKey(), new plGenRefMsg( GetKey(), plRefMsg::kOnCreate, -1, kRefOriginAnchor ), plRefFlags::kPassiveRef ); + hsgResMgr::ResMgr()->AddViaNotify( fOriginContext->GetKey(), new plGenRefMsg( GetKey(), plRefMsg::kOnCreate, -1, kRefOriginContext ), plRefFlags::kPassiveRef ); } //// SetEnabled ////////////////////////////////////////////////////////////// @@ -335,7 +335,7 @@ void pfGUIPopUpMenu::SetEnabled( hsBool e ) pfGUIDialogMod::SetEnabled( e ); } -void pfGUIPopUpMenu::Show( hsScalar x, hsScalar y ) +void pfGUIPopUpMenu::Show( float x, float y ) { fOriginX = x; fOriginY = y; @@ -346,7 +346,7 @@ void pfGUIPopUpMenu::Show( hsScalar x, hsScalar y ) void pfGUIPopUpMenu::ISeekToOrigin( void ) { #if 0 - UInt32 i; + uint32_t i; float x = 0.5f/*fOriginX*/, y = fOriginY; for( i = 0; i < fControls.GetCount(); i++ ) @@ -379,7 +379,7 @@ void pfGUIPopUpMenu::ISeekToOrigin( void ) //// IHandleMenuSomething //////////////////////////////////////////////////// // Handles a normal event from one of the item controls. -void pfGUIPopUpMenu::IHandleMenuSomething( UInt32 idx, pfGUIControlMod *ctrl, Int32 extended ) +void pfGUIPopUpMenu::IHandleMenuSomething( uint32_t idx, pfGUIControlMod *ctrl, int32_t extended ) { if( extended != -1 ) { @@ -437,7 +437,7 @@ hsBool pfGUIPopUpMenu::IBuildMenu( void ) if( fWaitingForSkin && fSkin == nil ) return false; // Still waiting to get our skin before building - pfGUIColorScheme *scheme = TRACKED_NEW pfGUIColorScheme(); + pfGUIColorScheme *scheme = new pfGUIColorScheme(); scheme->fForeColor.Set( 0, 0, 0, 1 ); scheme->fBackColor.Set( 1, 1, 1, 1 ); @@ -472,11 +472,11 @@ hsBool pfGUIPopUpMenu::IBuildMenu( void ) // The PROBLEM is that we can't do that unless we have a friggin surface on // which to calculate the text extents! So sadly, we're going to have to create // a whole new DTMap and use it to calculate some stuff - plDynamicTextMap *scratch = TRACKED_NEW plDynamicTextMap( 8, 8, false ); + plDynamicTextMap *scratch = new plDynamicTextMap( 8, 8, false ); scratch->SetFont( scheme->fFontFace, scheme->fFontSize, scheme->fFontFlags, true ); for( i = 0; i < fMenuItems.GetCount(); i++ ) { - UInt16 thisW, thisH; + uint16_t thisW, thisH; thisW = scratch->CalcStringWidth( fMenuItems[ i ].fName.c_str(), &thisH ); if( fMenuItems[ i ].fSubMenu != nil ) { @@ -504,7 +504,7 @@ hsBool pfGUIPopUpMenu::IBuildMenu( void ) width += 4; // give us a little space, just in case - UInt32 scrnWidth, scrnHeight; + uint32_t scrnWidth, scrnHeight; // A cheat here, I know, but I'm lazy plDebugText::Instance().GetScreenSize( &scrnWidth, &scrnHeight ); @@ -560,7 +560,7 @@ hsBool pfGUIPopUpMenu::IBuildMenu( void ) { button->SetColorScheme( scheme ); button->SetName( fMenuItems[ i ].fName.c_str() ); - button->SetHandler( TRACKED_NEW pfGUIMenuItemProc( this, i ) ); + button->SetHandler( new pfGUIMenuItemProc( this, i ) ); // make the tag ID the position in the menu list button->SetTagID(i); button->SetDynTextMap( mat->GetLayer( 0 ), plDynamicTextMap::ConvertNoRef( mat->GetLayer( 0 )->GetTexture() ) ); @@ -621,8 +621,8 @@ void pfGUIPopUpMenu::ITearDownMenu( void ) //// HandleMouseEvent //////////////////////////////////////////////////////// -hsBool pfGUIPopUpMenu::HandleMouseEvent( pfGameGUIMgr::EventType event, hsScalar mouseX, hsScalar mouseY, - UInt8 modifiers ) +hsBool pfGUIPopUpMenu::HandleMouseEvent( pfGameGUIMgr::EventType event, float mouseX, float mouseY, + uint8_t modifiers ) { hsBool r = pfGUIDialogMod::HandleMouseEvent( event, mouseX, mouseY, modifiers ); if( r == false && event == pfGameGUIMgr::kMouseUp ) @@ -703,11 +703,11 @@ hsGMaterial *pfGUIPopUpMenu::ICreateDynMaterial( void ) // Create the new dynTextMap - plDynamicTextMap *textMap = TRACKED_NEW plDynamicTextMap(); + plDynamicTextMap *textMap = new plDynamicTextMap(); fKeyGen->CreateKey( textMap ); // Create the material - hsGMaterial *material = TRACKED_NEW hsGMaterial; + hsGMaterial *material = new hsGMaterial; fKeyGen->CreateKey( material ); // Create the layer and attach @@ -721,7 +721,7 @@ hsGMaterial *pfGUIPopUpMenu::ICreateDynMaterial( void ) lay->SetClampFlags( hsGMatState::kClampTexture ); // Do sendRef here, since we're going to need it set pretty darned quick - hsgResMgr::ResMgr()->SendRef( textMap->GetKey(), TRACKED_NEW plLayRefMsg( lay->GetKey(), plRefMsg::kOnCreate, 0, plLayRefMsg::kTexture ), plRefFlags::kActiveRef ); + hsgResMgr::ResMgr()->SendRef( textMap->GetKey(), new plLayRefMsg( lay->GetKey(), plRefMsg::kOnCreate, 0, plLayRefMsg::kTexture ), plRefFlags::kActiveRef ); return material; @@ -732,14 +732,14 @@ hsGMaterial *pfGUIPopUpMenu::ICreateDynMaterial( void ) #include "plJPEG/plJPEG.h" -pfGUIPopUpMenu *pfGUIPopUpMenu::Build( const char *name, pfGUIDialogMod *parent, hsScalar x, hsScalar y, const plLocation &destLoc ) +pfGUIPopUpMenu *pfGUIPopUpMenu::Build( const char *name, pfGUIDialogMod *parent, float x, float y, const plLocation &destLoc ) { float fovX, fovY; // Create the menu and give it a key gen - pfGUIPopUpMenu *menu = TRACKED_NEW pfGUIPopUpMenu(); - menu->fKeyGen = TRACKED_NEW pfPopUpKeyGenerator( name, destLoc ); + pfGUIPopUpMenu *menu = new pfGUIPopUpMenu(); + menu->fKeyGen = new pfPopUpKeyGenerator( name, destLoc ); menu->fKeyGen->CreateKey( menu ); menu->fOriginX = x; @@ -749,7 +749,7 @@ pfGUIPopUpMenu *pfGUIPopUpMenu::Build( const char *name, pfGUIDialogMod *parent if( parent != nil && ( (pfGUIPopUpMenu *)parent )->fSkin != nil ) { menu->fWaitingForSkin = true; - hsgResMgr::ResMgr()->SendRef( ( (pfGUIPopUpMenu *)parent )->fSkin->GetKey(), TRACKED_NEW plGenRefMsg( menu->GetKey(), plRefMsg::kOnCreate, -1, pfGUIPopUpMenu::kRefSkin ), plRefFlags::kActiveRef ); + hsgResMgr::ResMgr()->SendRef( ( (pfGUIPopUpMenu *)parent )->fSkin->GetKey(), new plGenRefMsg( menu->GetKey(), plRefMsg::kOnCreate, -1, pfGUIPopUpMenu::kRefSkin ), plRefFlags::kActiveRef ); } // HACK for now: create us a temp skin to use @@ -760,12 +760,12 @@ pfGUIPopUpMenu *pfGUIPopUpMenu::Build( const char *name, pfGUIDialogMod *parent loc.Set( 0x1425 ); plKey skinKey = hsgResMgr::ResMgr()->FindKey( plUoid( loc, pfGUISkin::Index(), "GUISkin01_GUISkin" ) ); menu->fWaitingForSkin = true; - hsgResMgr::ResMgr()->AddViaNotify( skinKey, TRACKED_NEW plGenRefMsg( menu->GetKey(), plRefMsg::kOnCreate, -1, pfGUIPopUpMenu::kRefSkin ), plRefFlags::kActiveRef ); + hsgResMgr::ResMgr()->AddViaNotify( skinKey, new plGenRefMsg( menu->GetKey(), plRefMsg::kOnCreate, -1, pfGUIPopUpMenu::kRefSkin ), plRefFlags::kActiveRef ); } */ // Create the rendermod - plPostEffectMod *renderMod = TRACKED_NEW plPostEffectMod; + plPostEffectMod *renderMod = new plPostEffectMod; menu->fKeyGen->CreateKey( renderMod ); renderMod->SetHither( 0.5f ); @@ -777,26 +777,26 @@ pfGUIPopUpMenu *pfGUIPopUpMenu::Build( const char *name, pfGUIDialogMod *parent fovX = atan( scrnWidth / ( 2.f * 100.f ) ) * 2.f; fovY = fovX;// * 3.f / 4.f; - renderMod->SetFovX( fovX * 180.f / hsScalarPI ); - renderMod->SetFovY( fovY * 180.f / hsScalarPI ); + renderMod->SetFovX( fovX * 180.f / M_PI ); + renderMod->SetFovY( fovY * 180.f / M_PI ); // Create the sceneNode to go with it - menu->fParentNode= TRACKED_NEW plSceneNode; + menu->fParentNode= new plSceneNode; menu->fKeyGen->CreateKey( menu->fParentNode ); // menu->fParentNode->GetKey()->RefObject(); - hsgResMgr::ResMgr()->SendRef( menu->fParentNode->GetKey(), TRACKED_NEW plGenRefMsg( menu->GetKey(), plRefMsg::kOnCreate, 0, kRefParentNode ), plRefFlags::kActiveRef ); + hsgResMgr::ResMgr()->SendRef( menu->fParentNode->GetKey(), new plGenRefMsg( menu->GetKey(), plRefMsg::kOnCreate, 0, kRefParentNode ), plRefFlags::kActiveRef ); - hsgResMgr::ResMgr()->AddViaNotify( menu->fParentNode->GetKey(), TRACKED_NEW plGenRefMsg( renderMod->GetKey(), plRefMsg::kOnCreate, 0, plPostEffectMod::kNodeRef ), plRefFlags::kPassiveRef ); + hsgResMgr::ResMgr()->AddViaNotify( menu->fParentNode->GetKey(), new plGenRefMsg( renderMod->GetKey(), plRefMsg::kOnCreate, 0, plPostEffectMod::kNodeRef ), plRefFlags::kPassiveRef ); menu->SetRenderMod( renderMod ); menu->SetName( name ); // Create the dummy scene object to hold the menu - plSceneObject *newObj = TRACKED_NEW plSceneObject; + plSceneObject *newObj = new plSceneObject; menu->fKeyGen->CreateKey( newObj ); // *#&$(*@&#$ need a coordIface... - plCoordinateInterface *newCI = TRACKED_NEW plCoordinateInterface; + plCoordinateInterface *newCI = new plCoordinateInterface; menu->fKeyGen->CreateKey( newCI ); hsMatrix44 l2w, w2l; @@ -805,15 +805,15 @@ pfGUIPopUpMenu *pfGUIPopUpMenu::Build( const char *name, pfGUIDialogMod *parent // Using SendRef here because AddViaNotify will queue the messages up, which doesn't do us any good // if we need these refs right away - hsgResMgr::ResMgr()->SendRef( newCI->GetKey(), TRACKED_NEW plObjRefMsg( newObj->GetKey(), plRefMsg::kOnCreate, 0, plObjRefMsg::kInterface ), plRefFlags::kActiveRef ); - hsgResMgr::ResMgr()->SendRef( renderMod->GetKey(), TRACKED_NEW plObjRefMsg( newObj->GetKey(), plRefMsg::kOnCreate, 0, plObjRefMsg::kModifier ), plRefFlags::kActiveRef ); + hsgResMgr::ResMgr()->SendRef( newCI->GetKey(), new plObjRefMsg( newObj->GetKey(), plRefMsg::kOnCreate, 0, plObjRefMsg::kInterface ), plRefFlags::kActiveRef ); + hsgResMgr::ResMgr()->SendRef( renderMod->GetKey(), new plObjRefMsg( newObj->GetKey(), plRefMsg::kOnCreate, 0, plObjRefMsg::kModifier ), plRefFlags::kActiveRef ); newObj->SetSceneNode( menu->fParentNode->GetKey() ); newObj->SetTransform( l2w, w2l ); - hsgResMgr::ResMgr()->SendRef( menu->GetKey(), TRACKED_NEW plObjRefMsg( newObj->GetKey(), plRefMsg::kOnCreate, 0, plObjRefMsg::kModifier ), plRefFlags::kActiveRef ); + hsgResMgr::ResMgr()->SendRef( menu->GetKey(), new plObjRefMsg( newObj->GetKey(), plRefMsg::kOnCreate, 0, plObjRefMsg::kModifier ), plRefFlags::kActiveRef ); // Add the menu to the GUI mgr - plGenRefMsg *refMsg = TRACKED_NEW plGenRefMsg( pfGameGUIMgr::GetInstance()->GetKey(), + plGenRefMsg *refMsg = new plGenRefMsg( pfGameGUIMgr::GetInstance()->GetKey(), plRefMsg::kOnCreate, 0, pfGameGUIMgr::kDlgModRef ); hsgResMgr::ResMgr()->AddViaNotify( menu->GetKey(), refMsg, plRefFlags::kActiveRef ); @@ -832,7 +832,7 @@ void pfGUIPopUpMenu::SetSkin( pfGUISkin *skin ) if( skin != nil ) { - hsgResMgr::ResMgr()->SendRef( skin->GetKey(), TRACKED_NEW plGenRefMsg( GetKey(), plRefMsg::kOnCreate, -1, kRefSkin ), plRefFlags::kActiveRef ); + hsgResMgr::ResMgr()->SendRef( skin->GetKey(), new plGenRefMsg( GetKey(), plRefMsg::kOnCreate, -1, kRefSkin ), plRefFlags::kActiveRef ); fWaitingForSkin = true; } else @@ -879,7 +879,7 @@ void pfGUISkin::SetTexture( plMipmap *tex ) } } -void pfGUISkin::SetElement( UInt32 idx, UInt16 x, UInt16 y, UInt16 w, UInt16 h ) +void pfGUISkin::SetElement( uint32_t idx, uint16_t x, uint16_t y, uint16_t w, uint16_t h ) { fElements[ idx ].fX = x; fElements[ idx ].fY = y; @@ -894,7 +894,7 @@ void pfGUISkin::Read( hsStream *s, hsResMgr *mgr ) s->ReadLE( &fItemMargin ); s->ReadLE( &fBorderMargin ); - UInt32 i, count; + uint32_t i, count; s->ReadLE( &count ); for( i = 0; i < count; i++ ) @@ -903,7 +903,7 @@ void pfGUISkin::Read( hsStream *s, hsResMgr *mgr ) for( ; i < kNumElements; i++ ) fElements[ i ].Empty(); - mgr->ReadKeyNotifyMe( s, TRACKED_NEW plGenRefMsg( GetKey(), plRefMsg::kOnCreate, -1, kRefMipmap ), plRefFlags::kActiveRef ); + mgr->ReadKeyNotifyMe( s, new plGenRefMsg( GetKey(), plRefMsg::kOnCreate, -1, kRefMipmap ), plRefFlags::kActiveRef ); } void pfGUISkin::Write( hsStream *s, hsResMgr *mgr ) @@ -913,7 +913,7 @@ void pfGUISkin::Write( hsStream *s, hsResMgr *mgr ) s->WriteLE( fItemMargin ); s->WriteLE( fBorderMargin ); - UInt32 i = kNumElements; + uint32_t i = kNumElements; s->WriteLE( i ); for( i = 0; i < kNumElements; i++ ) diff --git a/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIPopUpMenu.h b/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIPopUpMenu.h index f0b7e69b..7328806a 100644 --- a/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIPopUpMenu.h +++ b/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIPopUpMenu.h @@ -100,10 +100,10 @@ class pfGUIPopUpMenu : public pfGUIDialogMod // Array of info to rebuild our menu from. Note that this is ONLY used when rebuilding hsBool fNeedsRebuilding, fWaitingForSkin; - hsScalar fOriginX, fOriginY; - UInt16 fMargin; + float fOriginX, fOriginY; + uint16_t fMargin; hsTArray fMenuItems; - Int32 fSubMenuOpen; + int32_t fSubMenuOpen; pfGUISkin *fSkin; @@ -118,7 +118,7 @@ class pfGUIPopUpMenu : public pfGUIDialogMod hsGMaterial *ICreateDynMaterial( void ); - void IHandleMenuSomething( UInt32 idx, pfGUIControlMod *ctrl, Int32 extended = -1 ); + void IHandleMenuSomething( uint32_t idx, pfGUIControlMod *ctrl, int32_t extended = -1 ); void ISeekToOrigin( void ); @@ -153,9 +153,9 @@ class pfGUIPopUpMenu : public pfGUIDialogMod virtual void Write( hsStream* s, hsResMgr* mgr ); virtual void SetEnabled( hsBool e ); - virtual hsBool HandleMouseEvent( pfGameGUIMgr::EventType event, hsScalar mouseX, hsScalar mouseY, UInt8 modifiers ); + virtual hsBool HandleMouseEvent( pfGameGUIMgr::EventType event, float mouseX, float mouseY, uint8_t modifiers ); - void Show( hsScalar x, hsScalar y ); + void Show( float x, float y ); void SetOriginAnchor( plSceneObject *anchor, pfGUIDialogMod *context ); void SetAlignment( Alignment a ) { fAlignment = a; } @@ -164,7 +164,7 @@ class pfGUIPopUpMenu : public pfGUIDialogMod void AddItem( const wchar_t *name, pfGUICtrlProcObject *handler, pfGUIPopUpMenu *subMenu = nil ); void SetSkin( pfGUISkin *skin ); - static pfGUIPopUpMenu *Build( const char *name, pfGUIDialogMod *parent, hsScalar x, hsScalar y, const plLocation &destLoc = plLocation::kGlobalFixedLoc ); + static pfGUIPopUpMenu *Build( const char *name, pfGUIDialogMod *parent, float x, float y, const plLocation &destLoc = plLocation::kGlobalFixedLoc ); }; @@ -195,7 +195,7 @@ class pfGUISkin : public hsKeyedObject class pfSRect { public: - UInt16 fX, fY, fWidth, fHeight; + uint16_t fX, fY, fWidth, fHeight; void Empty( void ) { fX = fY = fWidth = fHeight = 0; } void Read( hsStream *s ); @@ -206,7 +206,7 @@ class pfGUISkin : public hsKeyedObject plMipmap *fTexture; pfSRect fElements[ kNumElements ]; - UInt16 fItemMargin, fBorderMargin; + uint16_t fItemMargin, fBorderMargin; public: @@ -229,13 +229,13 @@ class pfGUISkin : public hsKeyedObject plMipmap *GetTexture( void ) const { return fTexture; } void SetTexture( plMipmap *tex ); - const pfSRect &GetElement( UInt32 idx ) const { return fElements[ idx ]; } - hsBool IsElementSet( UInt32 idx ) const { return ( fElements[ idx ].fWidth > 0 && fElements[ idx ].fHeight > 0 ); } - void SetElement( UInt32 idx, UInt16 x, UInt16 y, UInt16 w, UInt16 h ); + const pfSRect &GetElement( uint32_t idx ) const { return fElements[ idx ]; } + hsBool IsElementSet( uint32_t idx ) const { return ( fElements[ idx ].fWidth > 0 && fElements[ idx ].fHeight > 0 ); } + void SetElement( uint32_t idx, uint16_t x, uint16_t y, uint16_t w, uint16_t h ); - void SetMargins( UInt16 item, UInt16 border ) { fItemMargin = item; fBorderMargin = border; } - UInt16 GetItemMargin( void ) const { return fItemMargin; } - UInt16 GetBorderMargin( void ) const { return fBorderMargin; } + void SetMargins( uint16_t item, uint16_t border ) { fItemMargin = item; fBorderMargin = border; } + uint16_t GetItemMargin( void ) const { return fItemMargin; } + uint16_t GetBorderMargin( void ) const { return fBorderMargin; } }; #endif // _pfGUIPopUpMenu_h diff --git a/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIProgressCtrl.cpp b/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIProgressCtrl.cpp index a8d3982c..dc0ac095 100644 --- a/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIProgressCtrl.cpp +++ b/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIProgressCtrl.cpp @@ -45,7 +45,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // // ////////////////////////////////////////////////////////////////////////////// -#include "hsTypes.h" +#include "HeadSpin.h" #include "pfGUIProgressCtrl.h" #include "pfGameGUIMgr.h" #include "pfGUIDialogMod.h" @@ -83,7 +83,7 @@ pfGUIProgressCtrl::~pfGUIProgressCtrl() //// IEval /////////////////////////////////////////////////////////////////// -hsBool pfGUIProgressCtrl::IEval( double secs, hsScalar del, UInt32 dirty ) +hsBool pfGUIProgressCtrl::IEval( double secs, float del, uint32_t dirty ) { return pfGUIValueCtrl::IEval( secs, del, dirty ); } @@ -111,7 +111,7 @@ void pfGUIProgressCtrl::Read( hsStream *s, hsResMgr *mgr ) pfGUIValueCtrl::Read(s, mgr); fAnimationKeys.Reset(); - UInt32 i, count = s->ReadLE32(); + uint32_t i, count = s->ReadLE32(); for( i = 0; i < count; i++ ) fAnimationKeys.Append( mgr->ReadKey( s ) ); fAnimName = s->ReadSafeString(); @@ -123,7 +123,7 @@ void pfGUIProgressCtrl::Write( hsStream *s, hsResMgr *mgr ) { pfGUIValueCtrl::Write( s, mgr ); - UInt32 i, count = fAnimationKeys.GetCount(); + uint32_t i, count = fAnimationKeys.GetCount(); s->WriteLE32( count ); for( i = 0; i < count; i++ ) mgr->WriteKey( s, fAnimationKeys[ i ] ); @@ -147,7 +147,7 @@ void pfGUIProgressCtrl::SetAnimationKeys( hsTArray &keys, const char * delete [] fAnimName; if( name != nil ) { - fAnimName = TRACKED_NEW char[ strlen( name ) + 1 ]; + fAnimName = new char[ strlen( name ) + 1 ]; strcpy( fAnimName, name ); } else @@ -163,7 +163,7 @@ hsBool pfGUIProgressCtrl::ICalcAnimTimes( void ) if( fAnimTimesCalced ) return true; - hsScalar tBegin = 1e30, tEnd = -1e30; + float tBegin = 1e30, tEnd = -1e30; bool foundOne = false; for( int i = 0; i < fAnimationKeys.GetCount(); i++ ) @@ -174,8 +174,8 @@ hsBool pfGUIProgressCtrl::ICalcAnimTimes( void ) { for( int j = 0; j < mod->GetNumAnimations(); j++ ) { - hsScalar begin = mod->GetAnimInstance( j )->GetTimeConvert()->GetBegin(); - hsScalar end = mod->GetAnimInstance( j )->GetTimeConvert()->GetEnd(); + float begin = mod->GetAnimInstance( j )->GetTimeConvert()->GetBegin(); + float end = mod->GetAnimInstance( j )->GetTimeConvert()->GetEnd(); if( begin < tBegin ) tBegin = begin; if( end > tEnd ) @@ -187,8 +187,8 @@ hsBool pfGUIProgressCtrl::ICalcAnimTimes( void ) plLayerAnimation *layer = plLayerAnimation::ConvertNoRef( fAnimationKeys[ i ]->ObjectIsLoaded() ); if( layer != nil ) { - hsScalar begin = layer->GetTimeConvert().GetBegin(); - hsScalar end = layer->GetTimeConvert().GetEnd(); + float begin = layer->GetTimeConvert().GetBegin(); + float end = layer->GetTimeConvert().GetEnd(); if( begin < tBegin ) tBegin = begin; if( end > tEnd ) @@ -210,7 +210,7 @@ hsBool pfGUIProgressCtrl::ICalcAnimTimes( void ) //// SetCurrValue //////////////////////////////////////////////////////////// -void pfGUIProgressCtrl::SetCurrValue( hsScalar v ) +void pfGUIProgressCtrl::SetCurrValue( float v ) { int old = (int)fValue; @@ -223,15 +223,15 @@ void pfGUIProgressCtrl::SetCurrValue( hsScalar v ) { ICalcAnimTimes(); - hsScalar tLength = fAnimEnd - fAnimBegin; - hsScalar newTime; + float tLength = fAnimEnd - fAnimBegin; + float newTime; if( HasFlag( kReverseValues ) ) newTime = ( ( fMax - fValue ) / ( fMax - fMin ) ) * tLength + fAnimBegin; else newTime = ( ( fValue - fMin ) / ( fMax - fMin ) ) * tLength + fAnimBegin; - plAnimCmdMsg *msg = TRACKED_NEW plAnimCmdMsg(); + plAnimCmdMsg *msg = new plAnimCmdMsg(); msg->SetCmd( plAnimCmdMsg::kGoToTime ); msg->SetAnimName( fAnimName ); msg->fTime = newTime; @@ -240,7 +240,7 @@ void pfGUIProgressCtrl::SetCurrValue( hsScalar v ) } } -void pfGUIProgressCtrl::AnimateToPercentage( hsScalar percent ) +void pfGUIProgressCtrl::AnimateToPercentage( float percent ) { // percent should be a value in range 0.0 to 1.0 if (percent >= 0.0f && percent <= 1.0f) @@ -249,7 +249,7 @@ void pfGUIProgressCtrl::AnimateToPercentage( hsScalar percent ) if( fAnimationKeys.GetCount() > 0 ) { - plAnimCmdMsg *msg = TRACKED_NEW plAnimCmdMsg(); + plAnimCmdMsg *msg = new plAnimCmdMsg(); msg->SetCmd( plAnimCmdMsg::kPlayToPercentage ); msg->SetAnimName( fAnimName ); msg->fTime = percent; @@ -262,8 +262,8 @@ void pfGUIProgressCtrl::AnimateToPercentage( hsScalar percent ) PlaySound(kAnimateSound, true); // setup a timer to call back when we finish animating - hsScalar elapsedTime = (fAnimEnd - fAnimBegin) * percent; - plTimerCallbackMsg *timerMsg = TRACKED_NEW plTimerCallbackMsg(GetKey(), fStopSoundTimer); + float elapsedTime = (fAnimEnd - fAnimBegin) * percent; + plTimerCallbackMsg *timerMsg = new plTimerCallbackMsg(GetKey(), fStopSoundTimer); plgTimerCallbackMgr::NewTimer(elapsedTime, timerMsg); } } diff --git a/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIProgressCtrl.h b/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIProgressCtrl.h index 97ecd4cd..18c7c50a 100644 --- a/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIProgressCtrl.h +++ b/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIProgressCtrl.h @@ -61,15 +61,15 @@ class pfGUIProgressCtrl : public pfGUIValueCtrl char *fAnimName; // Computed once, once an anim is loaded that we can compute this with - hsScalar fAnimBegin, fAnimEnd; + float fAnimBegin, fAnimEnd; hsBool fAnimTimesCalced; hsBool fPlaySound; - virtual hsBool IEval( double secs, hsScalar del, UInt32 dirty ); // called only by owner object's Eval() + virtual hsBool IEval( double secs, float del, uint32_t dirty ); // called only by owner object's Eval() hsBool ICalcAnimTimes( void ); - const UInt32 fStopSoundTimer; + const uint32_t fStopSoundTimer; public: @@ -92,8 +92,8 @@ class pfGUIProgressCtrl : public pfGUIValueCtrl virtual void UpdateBounds( hsMatrix44 *invXformMatrix = nil, hsBool force = false ); - virtual void SetCurrValue( hsScalar v ); - virtual void AnimateToPercentage( hsScalar percent ); + virtual void SetCurrValue( float v ); + virtual void AnimateToPercentage( float percent ); enum SoundEvents { diff --git a/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIRadioGroupCtrl.cpp b/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIRadioGroupCtrl.cpp index d343f6d2..79bfaf3a 100644 --- a/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIRadioGroupCtrl.cpp +++ b/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIRadioGroupCtrl.cpp @@ -45,7 +45,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // // ////////////////////////////////////////////////////////////////////////////// -#include "hsTypes.h" +#include "HeadSpin.h" #include "pfGUIRadioGroupCtrl.h" #include "pfGameGUIMgr.h" #include "pfGUICheckBoxCtrl.h" @@ -73,7 +73,7 @@ class pfGroupProc : public pfGUICtrlProcObject virtual void DoSomething( pfGUIControlMod *ctrl ) { - Int32 newIdx; + int32_t newIdx; // So one of our controls got clicked. That means that we change our value @@ -124,7 +124,7 @@ class pfGroupProc : public pfGUICtrlProcObject pfGUIRadioGroupCtrl::pfGUIRadioGroupCtrl() { - fButtonProc = TRACKED_NEW pfGroupProc( this ); + fButtonProc = new pfGroupProc( this ); fButtonProc->IncRef(); SetFlag( kIntangible ); } @@ -137,7 +137,7 @@ pfGUIRadioGroupCtrl::~pfGUIRadioGroupCtrl() //// IEval /////////////////////////////////////////////////////////////////// -hsBool pfGUIRadioGroupCtrl::IEval( double secs, hsScalar del, UInt32 dirty ) +hsBool pfGUIRadioGroupCtrl::IEval( double secs, float del, uint32_t dirty ) { return pfGUIControlMod::IEval( secs, del, dirty ); } @@ -175,12 +175,12 @@ void pfGUIRadioGroupCtrl::Read( hsStream *s, hsResMgr *mgr ) { pfGUIControlMod::Read(s, mgr); - UInt32 i, count = s->ReadLE32(); + uint32_t i, count = s->ReadLE32(); fControls.SetCountAndZero( count ); for( i = 0; i < count; i++ ) { - mgr->ReadKeyNotifyMe( s, TRACKED_NEW plGenRefMsg( GetKey(), plRefMsg::kOnCreate, i, kRefControl ), plRefFlags::kActiveRef ); + mgr->ReadKeyNotifyMe( s, new plGenRefMsg( GetKey(), plRefMsg::kOnCreate, i, kRefControl ), plRefFlags::kActiveRef ); } fValue = fDefaultValue = s->ReadLE16(); @@ -190,7 +190,7 @@ void pfGUIRadioGroupCtrl::Read( hsStream *s, hsResMgr *mgr ) void pfGUIRadioGroupCtrl::Write( hsStream *s, hsResMgr *mgr ) { - UInt32 i; + uint32_t i; pfGUIControlMod::Write( s, mgr ); @@ -199,12 +199,12 @@ void pfGUIRadioGroupCtrl::Write( hsStream *s, hsResMgr *mgr ) for( i = 0; i < fControls.GetCount(); i++ ) mgr->WriteKey( s, fControls[ i ]->GetKey() ); - s->WriteLE16( (UInt16)fDefaultValue ); + s->WriteLE16( (uint16_t)fDefaultValue ); } //// SetValue //////////////////////////////////////////////////////////////// -void pfGUIRadioGroupCtrl::SetValue( Int32 value ) +void pfGUIRadioGroupCtrl::SetValue( int32_t value ) { if( value != fValue && ( value != -1 || HasFlag( kAllowNoSelection ) ) ) { diff --git a/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIRadioGroupCtrl.h b/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIRadioGroupCtrl.h index ae326836..e30439d7 100644 --- a/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIRadioGroupCtrl.h +++ b/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIRadioGroupCtrl.h @@ -70,9 +70,9 @@ class pfGUIRadioGroupCtrl : public pfGUIControlMod hsTArray fControls; pfGroupProc *fButtonProc; - Int32 fValue, fDefaultValue; + int32_t fValue, fDefaultValue; - virtual hsBool IEval( double secs, hsScalar del, UInt32 dirty ); // called only by owner object's Eval() + virtual hsBool IEval( double secs, float del, uint32_t dirty ); // called only by owner object's Eval() public: @@ -92,8 +92,8 @@ class pfGUIRadioGroupCtrl : public pfGUIControlMod virtual void Read( hsStream* s, hsResMgr* mgr ); virtual void Write( hsStream* s, hsResMgr* mgr ); - Int32 GetValue( void ) { return fValue; } - void SetValue( Int32 value ); + int32_t GetValue( void ) { return fValue; } + void SetValue( int32_t value ); virtual void SetEnabled( hsBool e ); virtual void SetInteresting( hsBool e ); @@ -104,7 +104,7 @@ class pfGUIRadioGroupCtrl : public pfGUIControlMod /// Export ONLY void ClearControlList( void ); void AddControl( pfGUICheckBoxCtrl *ctrl ); - void SetDefaultValue( Int32 value ) { fDefaultValue = value; } + void SetDefaultValue( int32_t value ) { fDefaultValue = value; } }; #endif // _pfGUIRadioGroupCtrl_h diff --git a/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUITagDefs.cpp b/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUITagDefs.cpp index d4c084f6..dfe21abb 100644 --- a/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUITagDefs.cpp +++ b/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUITagDefs.cpp @@ -52,7 +52,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com //// Tag List //////////////////////////////////////////////////////////////// // Here's the actual list of tags. It's basically a list of konstants, but // they get translated into two things: -// 1. An enum, to send as a UInt32 to the GetDialogFromTag() and +// 1. An enum, to send as a uint32_t to the GetDialogFromTag() and // GetControlFromTag() functions. // 2. A string, which gets put in a dropdown box in the appropriate // MAX component, which sets the given control's tag ID to the diff --git a/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUITagDefs.h b/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUITagDefs.h index fb93d217..de3cd8da 100644 --- a/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUITagDefs.h +++ b/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUITagDefs.h @@ -54,7 +54,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com //// Tag List //////////////////////////////////////////////////////////////// // Here's the actual list of tags. It's basically a list of konstants, but // they get translated into two things: -// 1. An enum, to send as a UInt32 to the GetDialogFromTag() and +// 1. An enum, to send as a uint32_t to the GetDialogFromTag() and // GetControlFromTag() functions. // 2. A string, which gets put in a dropdown box in the appropriate // MAX component, which sets the given control's tag ID to the diff --git a/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUITextBoxMod.cpp b/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUITextBoxMod.cpp index c6992ed2..9578b6b4 100644 --- a/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUITextBoxMod.cpp +++ b/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUITextBoxMod.cpp @@ -45,7 +45,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // // ////////////////////////////////////////////////////////////////////////////// -#include "hsTypes.h" +#include "HeadSpin.h" #include "hsStlUtils.h" #include "pfGUITextBoxMod.h" #include "pfGameGUIMgr.h" @@ -80,7 +80,7 @@ pfGUITextBoxMod::~pfGUITextBoxMod() //// IEval /////////////////////////////////////////////////////////////////// -hsBool pfGUITextBoxMod::IEval( double secs, hsScalar del, UInt32 dirty ) +hsBool pfGUITextBoxMod::IEval( double secs, float del, uint32_t dirty ) { return pfGUIControlMod::IEval( secs, del, dirty ); } @@ -154,10 +154,10 @@ void pfGUITextBoxMod::Read( hsStream *s, hsResMgr *mgr ) { pfGUIControlMod::Read(s, mgr); - UInt32 len = s->ReadLE32(); + uint32_t len = s->ReadLE32(); if( len > 0 ) { - char *text = TRACKED_NEW char[ len + 1 ]; + char *text = new char[ len + 1 ]; s->Read( len, text ); text[ len ] = 0; @@ -201,15 +201,15 @@ void pfGUITextBoxMod::Write( hsStream *s, hsResMgr *mgr ) //// HandleMouseDown/Up ////////////////////////////////////////////////////// -void pfGUITextBoxMod::HandleMouseDown( hsPoint3 &mousePt, UInt8 modifiers ) +void pfGUITextBoxMod::HandleMouseDown( hsPoint3 &mousePt, uint8_t modifiers ) { } -void pfGUITextBoxMod::HandleMouseUp( hsPoint3 &mousePt, UInt8 modifiers ) +void pfGUITextBoxMod::HandleMouseUp( hsPoint3 &mousePt, uint8_t modifiers ) { } -void pfGUITextBoxMod::HandleMouseDrag( hsPoint3 &mousePt, UInt8 modifiers ) +void pfGUITextBoxMod::HandleMouseDrag( hsPoint3 &mousePt, uint8_t modifiers ) { } @@ -232,7 +232,7 @@ void pfGUITextBoxMod::SetText( const wchar_t *text ) delete [] fText; if (text) { - fText = TRACKED_NEW wchar_t[wcslen(text)+1]; + fText = new wchar_t[wcslen(text)+1]; wcscpy(fText,text); } else diff --git a/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUITextBoxMod.h b/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUITextBoxMod.h index ca376d8e..109bc514 100644 --- a/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUITextBoxMod.h +++ b/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUITextBoxMod.h @@ -63,7 +63,7 @@ class pfGUITextBoxMod : public pfGUIControlMod bool fUseLocalizationPath; - virtual hsBool IEval( double secs, hsScalar del, UInt32 dirty ); // called only by owner object's Eval() + virtual hsBool IEval( double secs, float del, uint32_t dirty ); // called only by owner object's Eval() virtual void IUpdate( void ); virtual void IPostSetUpDynTextMap( void ); @@ -87,9 +87,9 @@ class pfGUITextBoxMod : public pfGUIControlMod virtual void Read( hsStream* s, hsResMgr* mgr ); virtual void Write( hsStream* s, hsResMgr* mgr ); - virtual void HandleMouseDown( hsPoint3 &mousePt, UInt8 modifiers ); - virtual void HandleMouseUp( hsPoint3 &mousePt, UInt8 modifiers ); - virtual void HandleMouseDrag( hsPoint3 &mousePt, UInt8 modifiers ); + virtual void HandleMouseDown( hsPoint3 &mousePt, uint8_t modifiers ); + virtual void HandleMouseUp( hsPoint3 &mousePt, uint8_t modifiers ); + virtual void HandleMouseDrag( hsPoint3 &mousePt, uint8_t modifiers ); virtual void PurgeDynaTextMapImage(); diff --git a/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIUpDownPairMod.cpp b/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIUpDownPairMod.cpp index 9d2e07b2..77f9d957 100644 --- a/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIUpDownPairMod.cpp +++ b/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIUpDownPairMod.cpp @@ -45,7 +45,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // // ////////////////////////////////////////////////////////////////////////////// -#include "hsTypes.h" +#include "HeadSpin.h" #include "pfGUIUpDownPairMod.h" #include "pfGameGUIMgr.h" #include "pfGUIButtonMod.h" @@ -106,7 +106,7 @@ pfGUIUpDownPairMod::pfGUIUpDownPairMod() fDownControl = nil; fValue = fMin = fMax = fStep = 0.f; - fButtonProc = TRACKED_NEW pfUpDownBtnProc( nil, nil, this ); + fButtonProc = new pfUpDownBtnProc( nil, nil, this ); fButtonProc->IncRef(); SetFlag( kIntangible ); } @@ -119,7 +119,7 @@ pfGUIUpDownPairMod::~pfGUIUpDownPairMod() //// IEval /////////////////////////////////////////////////////////////////// -hsBool pfGUIUpDownPairMod::IEval( double secs, hsScalar del, UInt32 dirty ) +hsBool pfGUIUpDownPairMod::IEval( double secs, float del, uint32_t dirty ) { return pfGUIValueCtrl::IEval( secs, del, dirty ); } @@ -205,8 +205,8 @@ void pfGUIUpDownPairMod::Read( hsStream *s, hsResMgr *mgr ) fUpControl = nil; fDownControl = nil; - mgr->ReadKeyNotifyMe( s, TRACKED_NEW plGenRefMsg( GetKey(), plRefMsg::kOnCreate, -1, kRefUpControl ), plRefFlags::kActiveRef ); - mgr->ReadKeyNotifyMe( s, TRACKED_NEW plGenRefMsg( GetKey(), plRefMsg::kOnCreate, -1, kRefDownControl ), plRefFlags::kActiveRef ); + mgr->ReadKeyNotifyMe( s, new plGenRefMsg( GetKey(), plRefMsg::kOnCreate, -1, kRefUpControl ), plRefFlags::kActiveRef ); + mgr->ReadKeyNotifyMe( s, new plGenRefMsg( GetKey(), plRefMsg::kOnCreate, -1, kRefDownControl ), plRefFlags::kActiveRef ); s->ReadLE( &fMin ); s->ReadLE( &fMax ); @@ -228,13 +228,13 @@ void pfGUIUpDownPairMod::Write( hsStream *s, hsResMgr *mgr ) } -void pfGUIUpDownPairMod::SetRange( hsScalar min, hsScalar max ) +void pfGUIUpDownPairMod::SetRange( float min, float max ) { pfGUIValueCtrl::SetRange( min, max ); IUpdate(); } -void pfGUIUpDownPairMod::SetCurrValue( hsScalar v ) +void pfGUIUpDownPairMod::SetCurrValue( float v ) { pfGUIValueCtrl::SetCurrValue( v ); IUpdate(); diff --git a/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIUpDownPairMod.h b/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIUpDownPairMod.h index e820637b..5374cbff 100644 --- a/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIUpDownPairMod.h +++ b/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIUpDownPairMod.h @@ -70,7 +70,7 @@ class pfGUIUpDownPairMod : public pfGUIValueCtrl pfUpDownBtnProc *fButtonProc; - virtual hsBool IEval( double secs, hsScalar del, UInt32 dirty ); // called only by owner object's Eval() + virtual hsBool IEval( double secs, float del, uint32_t dirty ); // called only by owner object's Eval() virtual void IUpdate( void ); public: @@ -89,8 +89,8 @@ class pfGUIUpDownPairMod : public pfGUIValueCtrl virtual void Read( hsStream* s, hsResMgr* mgr ); virtual void Write( hsStream* s, hsResMgr* mgr ); - virtual void SetRange( hsScalar min, hsScalar max ); - virtual void SetCurrValue( hsScalar v ); + virtual void SetRange( float min, float max ); + virtual void SetCurrValue( float v ); /// Export ONLY diff --git a/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIValueCtrl.cpp b/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIValueCtrl.cpp index 186ba4b7..9b3ff371 100644 --- a/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIValueCtrl.cpp +++ b/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIValueCtrl.cpp @@ -45,7 +45,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // // ////////////////////////////////////////////////////////////////////////////// -#include "hsTypes.h" +#include "HeadSpin.h" #include "pfGUIValueCtrl.h" #include "pfGameGUIMgr.h" @@ -66,7 +66,7 @@ pfGUIValueCtrl::~pfGUIValueCtrl() //// SetCurrValue //////////////////////////////////////////////////////////// -void pfGUIValueCtrl::SetCurrValue( hsScalar v ) +void pfGUIValueCtrl::SetCurrValue( float v ) { fValue = v; if( fValue < fMin ) @@ -77,7 +77,7 @@ void pfGUIValueCtrl::SetCurrValue( hsScalar v ) //// SetRange //////////////////////////////////////////////////////////////// -void pfGUIValueCtrl::SetRange( hsScalar min, hsScalar max ) +void pfGUIValueCtrl::SetRange( float min, float max ) { fMin = min; fMax = max; diff --git a/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIValueCtrl.h b/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIValueCtrl.h index 9c3b296d..4d49e2c5 100644 --- a/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIValueCtrl.h +++ b/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIValueCtrl.h @@ -55,7 +55,7 @@ class pfGUIValueCtrl : public pfGUIControlMod { protected: - hsScalar fValue, fMin, fMax, fStep; + float fValue, fMin, fMax, fStep; public: @@ -69,15 +69,15 @@ class pfGUIValueCtrl : public pfGUIControlMod virtual void Read( hsStream* s, hsResMgr* mgr ); virtual void Write( hsStream* s, hsResMgr* mgr ); - virtual hsScalar GetCurrValue( void ) { return fValue; } - virtual void SetCurrValue( hsScalar v ); + virtual float GetCurrValue( void ) { return fValue; } + virtual void SetCurrValue( float v ); - virtual hsScalar GetMin( void ) { return fMin; } - virtual hsScalar GetMax( void ) { return fMax; } - virtual hsScalar GetStep( void ) { return fStep; } + virtual float GetMin( void ) { return fMin; } + virtual float GetMax( void ) { return fMax; } + virtual float GetStep( void ) { return fStep; } - virtual void SetRange( hsScalar min, hsScalar max ); - virtual void SetStep( hsScalar step ) { fStep = step; } + virtual void SetRange( float min, float max ); + virtual void SetStep( float step ) { fStep = step; } }; diff --git a/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGameGUIMgr.cpp b/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGameGUIMgr.cpp index 87def15e..19010b66 100644 --- a/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGameGUIMgr.cpp +++ b/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGameGUIMgr.cpp @@ -51,7 +51,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include #include "hsTimer.h" -#include "hsTypes.h" +#include "HeadSpin.h" #include "pfGameGUIMgr.h" #include "pfGUIDialogMod.h" #include "pfGUIDialogHandlers.h" @@ -87,10 +87,10 @@ class pfGameUIInputInterface : public plInputInterface protected: pfGameGUIMgr * const fGUIManager; - UInt8 fModifiers; - UInt8 fButtonState; + uint8_t fModifiers; + uint8_t fButtonState; hsBool fHaveInterestingCursor; - UInt32 fCurrentCursor; + uint32_t fCurrentCursor; virtual hsBool IHandleCtrlCmd( plCtrlCmd *cmd ); virtual hsBool IControlCodeEnabled( ControlEventCode code ); @@ -99,10 +99,10 @@ class pfGameUIInputInterface : public plInputInterface pfGameUIInputInterface( pfGameGUIMgr * const mgr ); - virtual UInt32 GetPriorityLevel( void ) const { return kGUISystemPriority; } + virtual uint32_t GetPriorityLevel( void ) const { return kGUISystemPriority; } virtual hsBool InterpretInputEvent( plInputEventMsg *pMsg ); - virtual UInt32 GetCurrentCursorID( void ) const; - virtual hsScalar GetCurrentCursorOpacity( void ) const; + virtual uint32_t GetCurrentCursorID( void ) const; + virtual float GetCurrentCursorOpacity( void ) const; virtual hsBool HasInterestingCursorID( void ) const { return fHaveInterestingCursor; } virtual hsBool SwitchInterpretOrder( void ) const { return true; } @@ -324,7 +324,7 @@ void pfGameGUIMgr::LoadDialog( const char *name, plKey recvrKey, const char * } if (!alreadyLoaded) { - pfDialogNameSetKey* pDNSK = TRACKED_NEW pfDialogNameSetKey(name,recvrKey); + pfDialogNameSetKey* pDNSK = new pfDialogNameSetKey(name,recvrKey); fDialogToSetKeyOf.Append(pDNSK); } } @@ -333,13 +333,13 @@ void pfGameGUIMgr::LoadDialog( const char *name, plKey recvrKey, const char * plKey clientKey = hsgResMgr::ResMgr()->FindKey( kClient_KEY ); - plClientMsg *msg = TRACKED_NEW plClientMsg( plClientMsg::kLoadRoomHold ); + plClientMsg *msg = new plClientMsg( plClientMsg::kLoadRoomHold ); msg->AddReceiver( clientKey ); msg->AddRoomLoc(plKeyFinder::Instance().FindLocation(ageName ? ageName : "GUI", name)); msg->Send(); // Now add this dialog to a list of pending loads (will remove it once it's fully loaded) -// fDlgsPendingLoad.Append( TRACKED_NEW pfDialogNameSetKey( name, nil ) ); +// fDlgsPendingLoad.Append( new pfDialogNameSetKey( name, nil ) ); } //// IShowDialog ///////////////////////////////////////////////////////////// @@ -434,7 +434,7 @@ void pfGameGUIMgr::UnloadDialog( pfGUIDialogMod *dlg ) // IRemoveDlgFromList( dlg ); // Add the name to our list of dialogs pending unload -// fDlgsPendingUnload.Append( TRACKED_NEW pfDialogNameSetKey( dlg->GetName(), nil ) ); +// fDlgsPendingUnload.Append( new pfDialogNameSetKey( dlg->GetName(), nil ) ); plKey sceneNodeKey = dlg->GetSceneNodeKey(); if( sceneNodeKey == nil ) @@ -448,7 +448,7 @@ void pfGameGUIMgr::UnloadDialog( pfGUIDialogMod *dlg ) { plKey clientKey = hsgResMgr::ResMgr()->FindKey( kClient_KEY ); - plClientMsg *msg = TRACKED_NEW plClientMsg( plClientMsg::kUnloadRoom ); + plClientMsg *msg = new plClientMsg( plClientMsg::kUnloadRoom ); msg->AddReceiver( clientKey ); // msg->SetProgressBarSuppression( true ); msg->AddRoomLoc(sceneNodeKey->GetUoid().GetLocation()); @@ -523,7 +523,7 @@ void pfGameGUIMgr::SetDialogToNotify(const char *name, plKey recvrKey) // void pfGameGUIMgr::SetDialogToNotify(pfGUIDialogMod *dlg, plKey recvrKey) { - pfGUIDialogNotifyProc* handler = TRACKED_NEW pfGUIDialogNotifyProc(recvrKey); + pfGUIDialogNotifyProc* handler = new pfGUIDialogNotifyProc(recvrKey); dlg->SetHandler(handler); handler->OnInit(); } @@ -540,14 +540,14 @@ void pfGameGUIMgr::IActivateGUI( hsBool activate ) if( activate ) { - fInputConfig = TRACKED_NEW pfGameUIInputInterface( this ); - plInputIfaceMgrMsg *msg = TRACKED_NEW plInputIfaceMgrMsg( plInputIfaceMgrMsg::kAddInterface ); + fInputConfig = new pfGameUIInputInterface( this ); + plInputIfaceMgrMsg *msg = new plInputIfaceMgrMsg( plInputIfaceMgrMsg::kAddInterface ); msg->SetIFace( fInputConfig ); plgDispatch::MsgSend( msg ); } else { - plInputIfaceMgrMsg *msg = TRACKED_NEW plInputIfaceMgrMsg( plInputIfaceMgrMsg::kRemoveInterface ); + plInputIfaceMgrMsg *msg = new plInputIfaceMgrMsg( plInputIfaceMgrMsg::kRemoveInterface ); msg->SetIFace( fInputConfig ); plgDispatch::MsgSend( msg ); @@ -561,7 +561,7 @@ void pfGameGUIMgr::IActivateGUI( hsBool activate ) //// IHandleMouse //////////////////////////////////////////////////////////// // Distributes mouse events to the dialogs currently active -hsBool pfGameGUIMgr::IHandleMouse( EventType event, hsScalar mouseX, hsScalar mouseY, UInt8 modifiers, UInt32 *desiredCursor ) +hsBool pfGameGUIMgr::IHandleMouse( EventType event, float mouseX, float mouseY, uint8_t modifiers, uint32_t *desiredCursor ) { pfGUIDialogMod *dlg; @@ -592,7 +592,7 @@ hsBool pfGameGUIMgr::IHandleMouse( EventType event, hsScalar mouseX, hsScalar m //// IHandleKeyEvt /////////////////////////////////////////////////////////// // Distributes mouse events to the dialogs currently active -hsBool pfGameGUIMgr::IHandleKeyEvt( EventType event, plKeyDef key, UInt8 modifiers ) +hsBool pfGameGUIMgr::IHandleKeyEvt( EventType event, plKeyDef key, uint8_t modifiers ) { pfGUIDialogMod *dlg; @@ -610,7 +610,7 @@ hsBool pfGameGUIMgr::IHandleKeyEvt( EventType event, plKeyDef key, UInt8 modifi // Like IHandleKeyPress, but takes in a char for distributing actual // characters typed. -hsBool pfGameGUIMgr::IHandleKeyPress( wchar_t key, UInt8 modifiers ) +hsBool pfGameGUIMgr::IHandleKeyPress( wchar_t key, uint8_t modifiers ) { pfGUIDialogMod *dlg; @@ -837,7 +837,7 @@ hsBool pfGameUIInputInterface::InterpretInputEvent( plInputEventMsg *pMsg ) return false; } -UInt32 pfGameUIInputInterface::GetCurrentCursorID( void ) const +uint32_t pfGameUIInputInterface::GetCurrentCursorID( void ) const { if( fCurrentCursor == 0 ) { @@ -850,7 +850,7 @@ UInt32 pfGameUIInputInterface::GetCurrentCursorID( void ) const return fCurrentCursor; } -hsScalar pfGameUIInputInterface::GetCurrentCursorOpacity( void ) const +float pfGameUIInputInterface::GetCurrentCursorOpacity( void ) const { if ( pfGameGUIMgr::GetInstance() ) return pfGameGUIMgr::GetInstance()->GetCursorOpacity(); @@ -866,7 +866,7 @@ extern pfGUITag gGUITags[]; // From pfGUITagDefs.cpp //// GetDialogFromTag //////////////////////////////////////////////////////// -pfGUIDialogMod *pfGameGUIMgr::GetDialogFromTag( UInt32 tagID ) +pfGUIDialogMod *pfGameGUIMgr::GetDialogFromTag( uint32_t tagID ) { int i; @@ -898,16 +898,16 @@ pfGUIDialogMod *pfGameGUIMgr::GetDialogFromString( const char *name ) //// GetControlFromTag /////////////////////////////////////////////////////// -pfGUIControlMod *pfGameGUIMgr::GetControlFromTag( pfGUIDialogMod *dlg, UInt32 tagID ) +pfGUIControlMod *pfGameGUIMgr::GetControlFromTag( pfGUIDialogMod *dlg, uint32_t tagID ) { return dlg->GetControlFromTag( tagID ); } //// GetNumTags ////////////////////////////////////////////////////////////// -UInt32 pfGameGUIMgr::GetNumTags( void ) +uint32_t pfGameGUIMgr::GetNumTags( void ) { - UInt32 count; + uint32_t count; for( count = 0; gGUITags[ count ].fID != 0; count++ ); @@ -916,9 +916,9 @@ UInt32 pfGameGUIMgr::GetNumTags( void ) //// GetTag ////////////////////////////////////////////////////////////////// -pfGUITag *pfGameGUIMgr::GetTag( UInt32 tagIndex ) +pfGUITag *pfGameGUIMgr::GetTag( uint32_t tagIndex ) { - UInt32 count; + uint32_t count; for( count = 0; gGUITags[ count ].fID != 0; count++ ); @@ -927,9 +927,9 @@ pfGUITag *pfGameGUIMgr::GetTag( UInt32 tagIndex ) return &gGUITags[ tagIndex ]; } -UInt32 pfGameGUIMgr::GetHighestTag( void ) +uint32_t pfGameGUIMgr::GetHighestTag( void ) { - UInt32 i, id = 1; + uint32_t i, id = 1; for( i = 0; gGUITags[ i ].fID != 0; i++ ) @@ -942,12 +942,12 @@ UInt32 pfGameGUIMgr::GetHighestTag( void ) } -void pfGameGUIMgr::SetAspectRatio(hsScalar aspectratio) +void pfGameGUIMgr::SetAspectRatio(float aspectratio) { - hsScalar oldAspectRatio = fAspectRatio; + float oldAspectRatio = fAspectRatio; // don't allow the aspectratio below 4:3 - hsScalar fourThree = 4.0f/3.0f; + float fourThree = 4.0f/3.0f; fAspectRatio = aspectratio < fourThree ? fourThree : aspectratio; if (fAspectRatio != oldAspectRatio) diff --git a/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGameGUIMgr.h b/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGameGUIMgr.h index 292ca666..f31ef37a 100644 --- a/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGameGUIMgr.h +++ b/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGameGUIMgr.h @@ -54,7 +54,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #ifndef _pfGameGUIMgr_h #define _pfGameGUIMgr_h -#include "hsTypes.h" +#include "HeadSpin.h" #include "hsTemplates.h" #include "pnInputCore/plKeyDef.h" #include "pnKeyedObject/hsKeyedObject.h" @@ -79,7 +79,7 @@ class plPostEffectMod; class pfGUITag { public: - UInt32 fID; + uint32_t fID; char fName[ 128 ]; }; @@ -142,14 +142,14 @@ class pfGameGUIMgr : public hsKeyedObject hsTArray fDlgsPendingUnload; hsBool fActivated; - UInt32 fActiveDlgCount; + uint32_t fActiveDlgCount; pfGameUIInputInterface *fInputConfig; - UInt32 fInputCtlIndex; + uint32_t fInputCtlIndex; - UInt32 fDefaultCursor; - hsScalar fCursorOpacity; - hsScalar fAspectRatio; + uint32_t fDefaultCursor; + float fCursorOpacity; + float fAspectRatio; // This is an array of the dialogs (by name) that need their // receiver key set once they are loaded. @@ -167,9 +167,9 @@ class pfGameGUIMgr : public hsKeyedObject void IActivateGUI( hsBool activate ); - hsBool IHandleMouse( EventType event, hsScalar mouseX, hsScalar mouseY, UInt8 modifiers, UInt32 *desiredCursor ); - hsBool IHandleKeyEvt( EventType event, plKeyDef key, UInt8 modifiers ); - hsBool IHandleKeyPress( wchar_t key, UInt8 modifiers ); + hsBool IHandleMouse( EventType event, float mouseX, float mouseY, uint8_t modifiers, uint32_t *desiredCursor ); + hsBool IHandleKeyEvt( EventType event, plKeyDef key, uint8_t modifiers ); + hsBool IHandleKeyPress( wchar_t key, uint8_t modifiers ); hsBool IModalBlocking( void ); @@ -210,10 +210,10 @@ class pfGameGUIMgr : public hsKeyedObject void SetDialogToNotify(const char *name, plKey recvrKey); void SetDialogToNotify(pfGUIDialogMod *dlg, plKey recvrKey); - void SetDefaultCursor(UInt32 defaultCursor) { fDefaultCursor = defaultCursor; } - UInt32 GetDefaultCursor() { return fDefaultCursor; } - void SetCursorOpacity(hsScalar opacity) { fCursorOpacity = opacity; } - hsScalar GetCursorOpacity() { return fCursorOpacity; } + void SetDefaultCursor(uint32_t defaultCursor) { fDefaultCursor = defaultCursor; } + uint32_t GetDefaultCursor() { return fDefaultCursor; } + void SetCursorOpacity(float opacity) { fCursorOpacity = opacity; } + float GetCursorOpacity() { return fCursorOpacity; } pfGUIPopUpMenu *FindPopUpMenu( const char *name ); @@ -221,14 +221,14 @@ class pfGameGUIMgr : public hsKeyedObject hsBool IsModalBlocking( void ) {return IModalBlocking();} // Tag ID stuff - pfGUIDialogMod *GetDialogFromTag( UInt32 tagID ); - pfGUIControlMod *GetControlFromTag( pfGUIDialogMod *dlg, UInt32 tagID ); - - static UInt32 GetNumTags( void ); - static pfGUITag *GetTag( UInt32 tagIndex ); - static UInt32 GetHighestTag( void ); - void SetAspectRatio(hsScalar aspectratio); - hsScalar GetAspectRatio() { return fAspectRatio; } + pfGUIDialogMod *GetDialogFromTag( uint32_t tagID ); + pfGUIControlMod *GetControlFromTag( pfGUIDialogMod *dlg, uint32_t tagID ); + + static uint32_t GetNumTags( void ); + static pfGUITag *GetTag( uint32_t tagIndex ); + static uint32_t GetHighestTag( void ); + void SetAspectRatio(float aspectratio); + float GetAspectRatio() { return fAspectRatio; } static pfGameGUIMgr *GetInstance( void ) { return fInstance; } }; diff --git a/Sources/Plasma/FeatureLib/pfGameMgr/BlueSpiral/pfGmBlueSpiral.cpp b/Sources/Plasma/FeatureLib/pfGameMgr/BlueSpiral/pfGmBlueSpiral.cpp index 7a23ecf6..3121767e 100644 --- a/Sources/Plasma/FeatureLib/pfGameMgr/BlueSpiral/pfGmBlueSpiral.cpp +++ b/Sources/Plasma/FeatureLib/pfGameMgr/BlueSpiral/pfGmBlueSpiral.cpp @@ -203,7 +203,7 @@ pfGmBlueSpiral::pfGmBlueSpiral ( //============================================================================ pfGmBlueSpiral::~pfGmBlueSpiral () { - DEL(internal); + delete internal; } //============================================================================ @@ -269,7 +269,7 @@ void pfGmBlueSpiral::HitCloth (int clothNum) { msg.messageBytes = sizeof(msg); msg.recvGameId = GetGameId(); // send to GameSrv on server msg.transId = 0; - msg.clothNum = (byte)clothNum; + msg.clothNum = (uint8_t)clothNum; GameMgrSend(&msg); } diff --git a/Sources/Plasma/FeatureLib/pfGameMgr/ClimbingWall/pfGmClimbingWall.cpp b/Sources/Plasma/FeatureLib/pfGameMgr/ClimbingWall/pfGmClimbingWall.cpp index 933613bf..d367aaf1 100644 --- a/Sources/Plasma/FeatureLib/pfGameMgr/ClimbingWall/pfGmClimbingWall.cpp +++ b/Sources/Plasma/FeatureLib/pfGameMgr/ClimbingWall/pfGmClimbingWall.cpp @@ -211,7 +211,7 @@ pfGmClimbingWall::pfGmClimbingWall ( //============================================================================ pfGmClimbingWall::~pfGmClimbingWall () { - DEL(internal); + delete internal; } //============================================================================ @@ -279,8 +279,8 @@ void pfGmClimbingWall::Ready (unsigned readyType, unsigned teamNumber) { msg.messageBytes = sizeof(msg); msg.recvGameId = GetGameId(); // send to GameSrv on server msg.transId = 0; - msg.readyType = (byte)readyType; - msg.teamNumber = (byte)teamNumber; + msg.readyType = (uint8_t)readyType; + msg.teamNumber = (uint8_t)teamNumber; GameMgrSend(&msg); } @@ -293,8 +293,8 @@ void pfGmClimbingWall::ChangeBlocker (unsigned teamNumber, unsigned blockerNumbe msg.messageBytes = sizeof(msg); msg.recvGameId = GetGameId(); // send to GameSrv on server msg.transId = 0; - msg.teamNumber = (byte)teamNumber; - msg.blockerNumber = (byte)blockerNumber; + msg.teamNumber = (uint8_t)teamNumber; + msg.blockerNumber = (uint8_t)blockerNumber; msg.added = added; GameMgrSend(&msg); @@ -320,7 +320,7 @@ void pfGmClimbingWall::PlayerEntered (unsigned teamNumber) { msg.messageBytes = sizeof(msg); msg.recvGameId = GetGameId(); // send to GameSrv on server msg.transId = 0; - msg.teamNumber = (byte)teamNumber; + msg.teamNumber = (uint8_t)teamNumber; GameMgrSend(&msg); } @@ -347,4 +347,4 @@ void pfGmClimbingWall::Panic () { msg.transId = 0; GameMgrSend(&msg); -} \ No newline at end of file +} diff --git a/Sources/Plasma/FeatureLib/pfGameMgr/Heek/pfGmHeek.cpp b/Sources/Plasma/FeatureLib/pfGameMgr/Heek/pfGmHeek.cpp index cbd65082..348a1e50 100644 --- a/Sources/Plasma/FeatureLib/pfGameMgr/Heek/pfGmHeek.cpp +++ b/Sources/Plasma/FeatureLib/pfGameMgr/Heek/pfGmHeek.cpp @@ -245,7 +245,7 @@ pfGmHeek::pfGmHeek ( //============================================================================ pfGmHeek::~pfGmHeek () { - DEL(internal); + delete internal; } //============================================================================ @@ -294,14 +294,14 @@ void pfGmHeek::OnOwnerChange (const Srv2Cli_Game_OwnerChange & msg) { } //============================================================================ -void pfGmHeek::PlayGame (unsigned position, dword points, const wchar name[]) { +void pfGmHeek::PlayGame (unsigned position, uint32_t points, const wchar_t name[]) { Cli2Srv_Heek_PlayGame msg; msg.messageId = kCli2Srv_Heek_PlayGame; msg.messageBytes = sizeof(msg); msg.recvGameId = GetGameId(); // send to GameSrv on server msg.transId = 0; - msg.position = (byte)position; + msg.position = (uint8_t)position; msg.points = points; StrCopy(msg.name, name, arrsize(msg.name)); @@ -327,7 +327,7 @@ void pfGmHeek::Choose (EHeekChoice choice) { msg.recvGameId = GetGameId(); // send to GameSrv on server msg.transId = 0; - msg.choice = (byte)choice; + msg.choice = (uint8_t)choice; GameMgrSend(&msg); } @@ -340,7 +340,7 @@ void pfGmHeek::SequenceFinished (EHeekSeqFinished seq) { msg.recvGameId = GetGameId(); // send to GameSrv on server msg.transId = 0; - msg.seqFinished = (byte)seq; + msg.seqFinished = (uint8_t)seq; GameMgrSend(&msg); -} \ No newline at end of file +} diff --git a/Sources/Plasma/FeatureLib/pfGameMgr/Heek/pfGmHeek.h b/Sources/Plasma/FeatureLib/pfGameMgr/Heek/pfGmHeek.h index 14e403e2..074fc1e7 100644 --- a/Sources/Plasma/FeatureLib/pfGameMgr/Heek/pfGmHeek.h +++ b/Sources/Plasma/FeatureLib/pfGameMgr/Heek/pfGmHeek.h @@ -86,7 +86,7 @@ public: //======================================================================== // Game methods //------------- - void PlayGame (unsigned position, dword points, const wchar name[]); + void PlayGame (unsigned position, uint32_t points, const wchar_t name[]); void LeaveGame (); void Choose (EHeekChoice choice); void SequenceFinished (EHeekSeqFinished seq); diff --git a/Sources/Plasma/FeatureLib/pfGameMgr/Intern.h b/Sources/Plasma/FeatureLib/pfGameMgr/Intern.h index 8dc050af..d154dd2a 100644 --- a/Sources/Plasma/FeatureLib/pfGameMgr/Intern.h +++ b/Sources/Plasma/FeatureLib/pfGameMgr/Intern.h @@ -66,7 +66,7 @@ typedef pfGameCli * (*FGameCliFactory)( struct GameTypeReg { FGameCliFactory create; Uuid typeId; - const wchar * name; + const wchar_t * name; }; void GameMgrRegisterGameType (const GameTypeReg & reg); diff --git a/Sources/Plasma/FeatureLib/pfGameMgr/Marker/pfGmMarker.cpp b/Sources/Plasma/FeatureLib/pfGameMgr/Marker/pfGmMarker.cpp index f1d6ec43..46d8459d 100644 --- a/Sources/Plasma/FeatureLib/pfGameMgr/Marker/pfGmMarker.cpp +++ b/Sources/Plasma/FeatureLib/pfGameMgr/Marker/pfGmMarker.cpp @@ -229,7 +229,7 @@ void IMarker::RecvGameDeleted (const Srv2Cli_Marker_GameDeleted & msg, void * pa gameCliMsg->Send(gameCli->GetReceiver()); if (!msg.failed) - DEL(gameCli); // we're done + delete gameCli; // we're done } //============================================================================ @@ -280,7 +280,7 @@ pfGmMarker::pfGmMarker ( //============================================================================ pfGmMarker::~pfGmMarker () { - DEL(internal); + delete internal; } //============================================================================ @@ -372,7 +372,7 @@ void pfGmMarker::ResetGame () { } //============================================================================ -void pfGmMarker::ChangeGameName (const wchar name[]) { +void pfGmMarker::ChangeGameName (const wchar_t name[]) { Cli2Srv_Marker_ChangeGameName msg; msg.messageId = kCli2Srv_Marker_ChangeGameName; @@ -410,7 +410,7 @@ void pfGmMarker::DeleteGame () { } //============================================================================ -void pfGmMarker::AddMarker (double x, double y, double z, const wchar name[], const wchar age[]) { +void pfGmMarker::AddMarker (double x, double y, double z, const wchar_t name[], const wchar_t age[]) { Cli2Srv_Marker_AddMarker msg; msg.messageId = kCli2Srv_Marker_AddMarker; @@ -440,7 +440,7 @@ void pfGmMarker::DeleteMarker (unsigned long markerID) { } //============================================================================ -void pfGmMarker::ChangeMarkerName (unsigned long markerID, const wchar name[]) { +void pfGmMarker::ChangeMarkerName (unsigned long markerID, const wchar_t name[]) { Cli2Srv_Marker_ChangeMarkerName msg; msg.messageId = kCli2Srv_Marker_ChangeMarkerName; @@ -464,4 +464,4 @@ void pfGmMarker::CaptureMarker (unsigned long markerID) { msg.markerID = markerID; GameMgrSend(&msg); -} \ No newline at end of file +} diff --git a/Sources/Plasma/FeatureLib/pfGameMgr/Marker/pfGmMarker.h b/Sources/Plasma/FeatureLib/pfGameMgr/Marker/pfGmMarker.h index c6fe480a..b0bc6b4c 100644 --- a/Sources/Plasma/FeatureLib/pfGameMgr/Marker/pfGmMarker.h +++ b/Sources/Plasma/FeatureLib/pfGameMgr/Marker/pfGmMarker.h @@ -89,12 +89,12 @@ public: void StartGame (); void PauseGame (); void ResetGame (); - void ChangeGameName (const wchar name[]); + void ChangeGameName (const wchar_t name[]); void ChangeTimeLimit (unsigned long timeLimit); void DeleteGame (); - void AddMarker (double x, double y, double z, const wchar name[], const wchar age[]); + void AddMarker (double x, double y, double z, const wchar_t name[], const wchar_t age[]); void DeleteMarker (unsigned long markerID); - void ChangeMarkerName (unsigned long markerID, const wchar name[]); + void ChangeMarkerName (unsigned long markerID, const wchar_t name[]); void CaptureMarker (unsigned long markerID); //======================================================================== }; diff --git a/Sources/Plasma/FeatureLib/pfGameMgr/TicTacToe/pfGmTicTacToe.cpp b/Sources/Plasma/FeatureLib/pfGameMgr/TicTacToe/pfGmTicTacToe.cpp index 98be181a..1ae046d8 100644 --- a/Sources/Plasma/FeatureLib/pfGameMgr/TicTacToe/pfGmTicTacToe.cpp +++ b/Sources/Plasma/FeatureLib/pfGameMgr/TicTacToe/pfGmTicTacToe.cpp @@ -116,7 +116,7 @@ ITicTacToe::ITicTacToe (pfGmTicTacToe * gameCli) : gameCli(gameCli) { // Fill the board with space chars - MemSet(board, ' ', sizeof(board)); + memset(board, ' ', sizeof(board)); } //============================================================================ @@ -174,7 +174,7 @@ void ITicTacToe::RecvGameOver (const Srv2Cli_TTT_GameOver & msg, void * param) { gameCliMsg->Set(gameCli, msg); gameCliMsg->Send(gameCli->GetReceiver()); - DEL(gameCli); // we're done + delete gameCli; // we're done } //============================================================================ @@ -210,7 +210,7 @@ pfGmTicTacToe::pfGmTicTacToe ( //============================================================================ pfGmTicTacToe::~pfGmTicTacToe () { - DEL(internal); + delete internal; } //============================================================================ @@ -262,8 +262,8 @@ void pfGmTicTacToe::MakeMove (unsigned row, unsigned col) { msg.messageBytes = sizeof(msg); msg.recvGameId = GetGameId(); // send to GameSrv on server msg.transId = 0; - msg.row = (byte)row; - msg.col = (byte)col; + msg.row = (uint8_t)row; + msg.col = (uint8_t)col; GameMgrSend(&msg); } diff --git a/Sources/Plasma/FeatureLib/pfGameMgr/VarSync/pfGmVarSync.cpp b/Sources/Plasma/FeatureLib/pfGameMgr/VarSync/pfGmVarSync.cpp index db1ee303..9a8d9530 100644 --- a/Sources/Plasma/FeatureLib/pfGameMgr/VarSync/pfGmVarSync.cpp +++ b/Sources/Plasma/FeatureLib/pfGameMgr/VarSync/pfGmVarSync.cpp @@ -202,7 +202,7 @@ pfGmVarSync::pfGmVarSync ( //============================================================================ pfGmVarSync::~pfGmVarSync () { - DEL(internal); + delete internal; } //============================================================================ @@ -249,7 +249,7 @@ void pfGmVarSync::OnOwnerChange (const Srv2Cli_Game_OwnerChange & msg) { } //============================================================================ -void pfGmVarSync::SetStringVar (unsigned long id, const wchar* val) { +void pfGmVarSync::SetStringVar (unsigned long id, const wchar_t* val) { Cli2Srv_VarSync_SetStringVar msg; msg.messageId = kCli2Srv_VarSync_SetStringVar; @@ -289,7 +289,7 @@ void pfGmVarSync::RequestAllVars () { } //============================================================================ -void pfGmVarSync::CreateStringVar (const wchar* name, const wchar* val) { +void pfGmVarSync::CreateStringVar (const wchar_t* name, const wchar_t* val) { Cli2Srv_VarSync_CreateStringVar msg; msg.messageId = kCli2Srv_VarSync_CreateStringVar; @@ -303,7 +303,7 @@ void pfGmVarSync::CreateStringVar (const wchar* name, const wchar* val) { } //============================================================================ -void pfGmVarSync::CreateNumericVar (const wchar* name, double val) { +void pfGmVarSync::CreateNumericVar (const wchar_t* name, double val) { Cli2Srv_VarSync_CreateNumericVar msg; msg.messageId = kCli2Srv_VarSync_CreateNumericVar; diff --git a/Sources/Plasma/FeatureLib/pfGameMgr/VarSync/pfGmVarSync.h b/Sources/Plasma/FeatureLib/pfGameMgr/VarSync/pfGmVarSync.h index cef5c597..81520aca 100644 --- a/Sources/Plasma/FeatureLib/pfGameMgr/VarSync/pfGmVarSync.h +++ b/Sources/Plasma/FeatureLib/pfGameMgr/VarSync/pfGmVarSync.h @@ -86,11 +86,11 @@ public: //======================================================================== // Game methods //------------- - void SetStringVar (unsigned long id, const wchar* val); + void SetStringVar (unsigned long id, const wchar_t* val); void SetNumericVar (unsigned long id, double val); void RequestAllVars (); - void CreateStringVar (const wchar* name, const wchar* val); - void CreateNumericVar (const wchar* name, double val); + void CreateStringVar (const wchar_t* name, const wchar_t* val); + void CreateNumericVar (const wchar_t* name, double val); //======================================================================== }; diff --git a/Sources/Plasma/FeatureLib/pfGameMgr/pfGameMgr.cpp b/Sources/Plasma/FeatureLib/pfGameMgr/pfGameMgr.cpp index a802c201..27bf67d2 100644 --- a/Sources/Plasma/FeatureLib/pfGameMgr/pfGameMgr.cpp +++ b/Sources/Plasma/FeatureLib/pfGameMgr/pfGameMgr.cpp @@ -148,7 +148,7 @@ static ARRAYOBJ(plKey) s_receivers; static void ShutdownFactories () { while (Factory * factory = s_factories.Head()) - DEL(factory); + delete factory; } //============================================================================ @@ -200,7 +200,7 @@ void IGameMgr::RecvGameInstance (const Srv2Cli_GameMgr_GameInstance & msg, void cli = internal->gameCli; } - DEL(state); + delete state; } //============================================================================ @@ -228,7 +228,7 @@ void IGameMgr::Recv (GameMsgHeader * msg) { void * param; if (TransState * trans = s_trans.Find(msg->transId)) { param = trans->param; - DEL(trans); + delete trans; } else { param = nil; @@ -280,14 +280,14 @@ pfGameMgrMsg::pfGameMgrMsg () { //============================================================================ pfGameMgrMsg::~pfGameMgrMsg () { - FREE(netMsg); + free(netMsg); } //============================================================================ void pfGameMgrMsg::Set (const GameMsgHeader & msg) { - netMsg = (GameMsgHeader *)ALLOC(msg.messageBytes); - MemCopy(netMsg, &msg, msg.messageBytes); + netMsg = (GameMsgHeader *)malloc(msg.messageBytes); + memcpy(netMsg, &msg, msg.messageBytes); } @@ -307,14 +307,14 @@ pfGameCliMsg::pfGameCliMsg () { //============================================================================ pfGameCliMsg::~pfGameCliMsg () { - FREE(netMsg); + free(netMsg); } //============================================================================ void pfGameCliMsg::Set (pfGameCli * cli, const GameMsgHeader & msg) { - netMsg = (GameMsgHeader *)ALLOC(msg.messageBytes); - MemCopy(netMsg, &msg, msg.messageBytes); + netMsg = (GameMsgHeader *)malloc(msg.messageBytes); + memcpy(netMsg, &msg, msg.messageBytes); gameCli = cli; } @@ -351,7 +351,7 @@ pfGameCli * pfGameMgr::GetGameCli (unsigned gameId) const { } //============================================================================ -const wchar * pfGameMgr::GetGameNameByTypeId (const Uuid & gameTypeId) const { +const wchar_t * pfGameMgr::GetGameNameByTypeId (const Uuid & gameTypeId) const { if (Factory * factory = s_factories.Find(gameTypeId)) return factory->reg.name; @@ -382,7 +382,7 @@ void pfGameMgr::JoinGame ( unsigned gameId ) { Cli2Srv_GameMgr_JoinGame msg; - ZERO(msg); + memset(&msg, 0, sizeof(msg)); msg.messageId = kCli2Srv_GameMgr_JoinGame; msg.recvGameId = 0; // send to GameMgr on server @@ -415,7 +415,7 @@ void pfGameMgr::CreateGame ( - sizeof(msg->createData) + initBytes; - msg = (Cli2Srv_GameMgr_CreateGame *)_alloca(msgBytes); + msg = (Cli2Srv_GameMgr_CreateGame *)malloc(msgBytes); msg->messageId = kCli2Srv_GameMgr_CreateGame; msg->recvGameId = 0; // send to GameMgr on server @@ -423,9 +423,11 @@ void pfGameMgr::CreateGame ( msg->createOptions = createOptions; msg->messageBytes = msgBytes; msg->createDataBytes = initBytes; - MemCopy(msg->createData, initData, initBytes); + memcpy(msg->createData, initData, initBytes); GameMgrSend(msg, NEWZERO(JoinTransState)(receiver)); + + free(msg); } //============================================================================ @@ -443,7 +445,7 @@ void pfGameMgr::JoinCommonGame ( - sizeof(msg->createData) + initBytes; - msg = (Cli2Srv_GameMgr_JoinGame *)_alloca(msgBytes); + msg = (Cli2Srv_GameMgr_JoinGame *)malloc(msgBytes); msg->messageId = kCli2Srv_GameMgr_JoinGame; msg->recvGameId = 0; // send to GameMgr on server @@ -452,9 +454,11 @@ void pfGameMgr::JoinCommonGame ( msg->createOptions = kGameJoinCommon; msg->messageBytes = msgBytes; msg->createDataBytes = initBytes; - MemCopy(msg->createData, initData, initBytes); + memcpy(msg->createData, initData, initBytes); GameMgrSend(msg, NEWZERO(JoinTransState)(receiver)); + + free(msg); } @@ -475,7 +479,7 @@ pfGameCli::pfGameCli ( //============================================================================ pfGameCli::~pfGameCli () { - DEL(internal); + delete internal; } //============================================================================ @@ -491,7 +495,7 @@ const Uuid & pfGameCli::GetGameTypeId () const { } //============================================================================ -const wchar * pfGameCli::GetName () const { +const wchar_t * pfGameCli::GetName () const { return internal->factory->reg.name; } @@ -651,7 +655,7 @@ void GameMgrSend (GameMsgHeader * msg, void * param) { if (param) { msg->transId = INextTransId(); - (void)NEW(TransState)(msg->transId, param); + (void)new TransState(msg->transId, param); } else { msg->transId = 0; diff --git a/Sources/Plasma/FeatureLib/pfGameMgr/pfGameMgr.h b/Sources/Plasma/FeatureLib/pfGameMgr/pfGameMgr.h index 245dfd2d..c6a996c2 100644 --- a/Sources/Plasma/FeatureLib/pfGameMgr/pfGameMgr.h +++ b/Sources/Plasma/FeatureLib/pfGameMgr/pfGameMgr.h @@ -156,7 +156,7 @@ public: // Return interface to the specified game pfGameCli * GetGameCli (unsigned gameId) const; // Get the name of a game by its typeid - const wchar * GetGameNameByTypeId (const Uuid & gameTypeId) const; + const wchar_t * GetGameNameByTypeId (const Uuid & gameTypeId) const; //======================================================================== //======================================================================== @@ -228,7 +228,7 @@ public: //----------------------- unsigned GetGameId () const; const Uuid & GetGameTypeId () const; - const wchar * GetName () const; + const wchar_t * GetName () const; plKey GetReceiver () const; unsigned GetPlayerCount () const; //======================================================================== @@ -250,7 +250,7 @@ public: // @@@: FUTURE WORK //----------------- // "Publish" this game, adding it to the age's the matchmaking service. - // void PublishGame (const wchar desc[]); + // void PublishGame (const wchar_t desc[]); // void UnpublishGame (); //======================================================================== }; diff --git a/Sources/Plasma/FeatureLib/pfGameScoreMgr/pfGameScoreMgr.cpp b/Sources/Plasma/FeatureLib/pfGameScoreMgr/pfGameScoreMgr.cpp index 777538f9..03cf37d6 100644 --- a/Sources/Plasma/FeatureLib/pfGameScoreMgr/pfGameScoreMgr.cpp +++ b/Sources/Plasma/FeatureLib/pfGameScoreMgr/pfGameScoreMgr.cpp @@ -58,7 +58,7 @@ pfGameScore::~pfGameScore() void pfGameScore::Init( unsigned sid, unsigned oid, - UInt32 createTime, + uint32_t createTime, const char gname[], unsigned gType, int val @@ -101,7 +101,7 @@ void pfGameScoreMgr::AddCachedScore(pfGameScore * score) GameScoreLink * scoreLink = fScores.Find(score->scoreId); if (scoreLink == nil) { - GameScoreLink * link = TRACKED_NEW GameScoreLink(score); + GameScoreLink * link = new GameScoreLink(score); fScores.Add(link); } else @@ -112,7 +112,7 @@ void pfGameScoreMgr::RemoveCachedScore(unsigned scoreId) { if (GameScoreLink * link = fScores.Find(scoreId)) { - DEL(link); + delete link; } } @@ -145,7 +145,7 @@ static void CreateScoreCallback( ENetError result, void * param, unsigned scoreId, - UInt32 createdTime, + uint32_t createdTime, unsigned ownerId, const char* gameName, unsigned gameType, @@ -178,7 +178,7 @@ ENetError pfGameScoreMgr::CreateScore( pfGameScore& score ) { CreateScoreOp param; - MemZero(¶m, sizeof(CreateScoreOp)); + memset(¶m, 0, sizeof(CreateScoreOp)); param.score = &score; NetCliAuthScoreCreate( @@ -205,7 +205,7 @@ ENetError pfGameScoreMgr::DeleteScore( unsigned scoreId ) { NetWaitOp param; - MemZero(¶m, sizeof(NetWaitOp)); + memset(¶m, 0, sizeof(NetWaitOp)); NetCliAuthScoreDelete( scoreId, @@ -240,11 +240,11 @@ static void GetScoresCallback( op->result = result; if (IS_NET_SUCCESS(result)) { - *(op->scores) = TRACKED_NEW pfGameScore*[scoreCount]; + *(op->scores) = new pfGameScore*[scoreCount]; *(op->scoreCount) = scoreCount; for (int i = 0; i < scoreCount; ++i) { - pfGameScore* score = TRACKED_NEW pfGameScore(); + pfGameScore* score = new pfGameScore(); score->IncRef(); char tempGameName[kMaxGameScoreNameLength]; @@ -277,7 +277,7 @@ ENetError pfGameScoreMgr::GetScoresIncRef( int& outScoreListCount ) { GetScoresOp param; - MemZero(¶m, sizeof(GetScoresOp)); + memset(¶m, 0, sizeof(GetScoresOp)); param.scores = &outScoreList; param.scoreCount = &outScoreListCount; @@ -304,7 +304,7 @@ ENetError pfGameScoreMgr::AddPoints( int numPoints ) { NetWaitOp param; - MemZero(¶m, sizeof(NetWaitOp)); + memset(¶m, 0, sizeof(NetWaitOp)); NetCliAuthScoreAddPoints( scoreId, @@ -336,7 +336,7 @@ ENetError pfGameScoreMgr::TransferPoints( int numPoints ) { NetWaitOp param; - MemZero(¶m, sizeof(NetWaitOp)); + memset(¶m, 0, sizeof(NetWaitOp)); NetCliAuthScoreTransferPoints( srcScoreId, @@ -371,7 +371,7 @@ ENetError pfGameScoreMgr::SetPoints( int numPoints ) { NetWaitOp param; - MemZero(¶m, sizeof(NetWaitOp)); + memset(¶m, 0, sizeof(NetWaitOp)); NetCliAuthScoreSetPoints( scoreId, @@ -414,11 +414,11 @@ static void GetRanksCallback( op->result = result; if (IS_NET_SUCCESS(result)) { - *(op->ranks) = TRACKED_NEW NetGameRank*[rankCount]; + *(op->ranks) = new NetGameRank*[rankCount]; *(op->rankCount) = rankCount; for (int i = 0; i < rankCount; ++i) { - NetGameRank * rank = TRACKED_NEW NetGameRank; + NetGameRank * rank = new NetGameRank; rank->rank = ranks[i].rank; rank->score = ranks[i].score; @@ -448,7 +448,7 @@ ENetError pfGameScoreMgr::GetRankList( int& outRankListCount ) { GetRanksOp param; - MemZero(¶m, sizeof(GetRanksOp)); + memset(¶m, 0, sizeof(GetRanksOp)); param.ranks = &outRankList; param.rankCount = &outRankListCount; diff --git a/Sources/Plasma/FeatureLib/pfGameScoreMgr/pfGameScoreMgr.h b/Sources/Plasma/FeatureLib/pfGameScoreMgr/pfGameScoreMgr.h index 452bb020..dab1e061 100644 --- a/Sources/Plasma/FeatureLib/pfGameScoreMgr/pfGameScoreMgr.h +++ b/Sources/Plasma/FeatureLib/pfGameScoreMgr/pfGameScoreMgr.h @@ -48,7 +48,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #ifndef PLASMA20_SOURCES_PLASMA_FEATURELIB_PFGAMESCOREMGR_PFGAMESCOREMGR_H #define PLASMA20_SOURCES_PLASMA_FEATURELIB_PFGAMESCOREMGR_PFGAMESCOREMGR_H -#include "hsTypes.h" +#include "HeadSpin.h" #include "pnNetBase/pnNetBase.h" #include "pnUtils/pnUtils.h" @@ -58,7 +58,7 @@ struct pfGameScore : AtomicRef { unsigned scoreId; unsigned ownerId; - UInt32 createdTime; + uint32_t createdTime; char gameName[kMaxGameScoreNameLength]; unsigned gameType; int value; @@ -69,7 +69,7 @@ struct pfGameScore : AtomicRef void Init( unsigned sid, unsigned oid, - UInt32 createTime, + uint32_t createTime, const char gname[], unsigned gType, int val diff --git a/Sources/Plasma/FeatureLib/pfJournalBook/pfJournalBook.cpp b/Sources/Plasma/FeatureLib/pfJournalBook/pfJournalBook.cpp index de0fae63..2d6a4698 100644 --- a/Sources/Plasma/FeatureLib/pfJournalBook/pfJournalBook.cpp +++ b/Sources/Plasma/FeatureLib/pfJournalBook/pfJournalBook.cpp @@ -48,10 +48,9 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // // ////////////////////////////////////////////////////////////////////////////// +#include "pfJournalBook.h" #include -#include "pfJournalBook.h" -#include "hsUtils.h" #include "hsStlUtils.h" #include "hsResMgr.h" #include "pcSmallRect.h" @@ -112,30 +111,30 @@ class pfEsHTMLChunk std::wstring fText; // Paragraph text, or face name plKey fImageKey; // Key of image - UInt8 fFontSize; - UInt32 fFlags; - UInt8 fType; - UInt32 fEventID; + uint8_t fFontSize; + uint32_t fFlags; + uint8_t fType; + uint32_t fEventID; pcSmallRect fLinkRect; // Used only for image chunks, and only when stored in the fVisibleLinks array hsColorRGBA fColor; - UInt16 fAbsoluteX, fAbsoluteY; + uint16_t fAbsoluteX, fAbsoluteY; - hsScalar fCurrOpacity; // For SFX images - hsScalar fSFXTime; // For SFX images - hsScalar fMinOpacity, fMaxOpacity; + float fCurrOpacity; // For SFX images + float fSFXTime; // For SFX images + float fMinOpacity, fMaxOpacity; hsColorRGBA fCurrColor; hsColorRGBA fOffColor, fOnColor; bool fNoResizeImg; - Int16 fLineSpacing; + int16_t fLineSpacing; bool fTintDecal; bool fLoopMovie; bool fOnCover; // if true, the movie is on the cover - UInt8 fMovieIndex; // the index of the movie in the source code, used for identification + uint8_t fMovieIndex; // the index of the movie in the source code, used for identification enum Flags { @@ -204,7 +203,7 @@ class pfEsHTMLChunk } // Image constructor (used for decals and movies too) - pfEsHTMLChunk( plKey imageKey, UInt32 alignFlags ) + pfEsHTMLChunk( plKey imageKey, uint32_t alignFlags ) { fType = kImage; fText = L""; @@ -248,7 +247,7 @@ class pfEsHTMLChunk } // Font change constructor - pfEsHTMLChunk( const wchar_t *face, UInt8 size, UInt32 fontFlags ) + pfEsHTMLChunk( const wchar_t *face, uint8_t size, uint32_t fontFlags ) { fType = kFontChange; if (face) @@ -384,7 +383,7 @@ class pfJournalDlgProc : public pfGUIDialogProc } } - virtual void HandleExtendedEvent( pfGUIControlMod *ctrl, UInt32 event ) + virtual void HandleExtendedEvent( pfGUIControlMod *ctrl, uint32_t event ) { if (fBook) { @@ -395,7 +394,7 @@ class pfJournalDlgProc : public pfGUIDialogProc if (fBook->fCurrBook) { // Update our custom cursor on the map - Int32 idx = fBook->fCurrBook->IFindCurrVisibleLink( false, true ); + int32_t idx = fBook->fCurrBook->IFindCurrVisibleLink( false, true ); if( idx != -1 ) fBook->fLeftPageMap->SetCustomCursor( plInputInterface::kCursorPoised/*Hand*/ ); else if(( fBook->fCurrBook->fCurrentPage > 1 )&&( fBook->fCurrBook->fAllowTurning )) @@ -414,7 +413,7 @@ class pfJournalDlgProc : public pfGUIDialogProc if (fBook->fCurrBook) { // Update our custom cursor on the map - Int32 idx = fBook->fCurrBook->IFindCurrVisibleLink( true, true ); + int32_t idx = fBook->fCurrBook->IFindCurrVisibleLink( true, true ); if( idx != -1 ) fBook->fRightPageMap->SetCustomCursor( plInputInterface::kCursorPoised/*Hand*/ ); else if((fBook->fCurrBook->fAreWeShowing) && ( fBook->fCurrBook->fCurrentPage + 2 <= fBook->fCurrBook->fLastPage )&&( fBook->fCurrBook->fAllowTurning )) @@ -440,8 +439,8 @@ public: pfBookMultiLineEditProc(pfBookData *owner) { bookData = owner; } virtual ~pfBookMultiLineEditProc() {} - virtual void OnEndOfControlList(Int32 cursorPos) { bookData->HitEndOfControlList(cursorPos); } - virtual void OnBeginningOfControlList(Int32 cursorPos) { bookData->HitBeginningOfControlList(cursorPos); } + virtual void OnEndOfControlList(int32_t cursorPos) { bookData->HitEndOfControlList(cursorPos); } + virtual void OnBeginningOfControlList(int32_t cursorPos) { bookData->HitBeginningOfControlList(cursorPos); } }; //// Book data class ///////////////////////////////////////////////////////// @@ -454,7 +453,7 @@ pfBookData::pfBookData(const plString &guiName /* = nil */) fLeftPageMap = fRightPageMap = nil; fCoverLayer = nil; fCoverMaterial = nil; - UInt16 i; + uint16_t i; for (i=0; i<4; i++) fPageMaterials[i] = nil; fLeftCorner = fRightCorner = nil; @@ -563,7 +562,7 @@ hsBool pfBookData::MsgReceive(plMessage *pMsg) plTimeMsg *time = plTimeMsg::ConvertNoRef( pMsg ); if( time != nil && fCurrSFXPages != kNoSides && !fCurrentlyTurning && fCurrentlyOpen ) { - IHandleSFX( (hsScalar)time->DSeconds() ); + IHandleSFX( (float)time->DSeconds() ); return true; } @@ -590,10 +589,10 @@ void pfBookData::IInitTemplate(pfGUIDialogMod *templateDlg) hsAssert(templateDlg != nil, "Nil template in pfBookData::IInitTemplate()!"); // Init and ref our fDialog pointer - hsgResMgr::ResMgr()->SendRef(templateDlg->GetKey(), TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnCreate, -1, kRefDialog), plRefFlags::kPassiveRef); + hsgResMgr::ResMgr()->SendRef(templateDlg->GetKey(), new plGenRefMsg(GetKey(), plRefMsg::kOnCreate, -1, kRefDialog), plRefFlags::kPassiveRef); // Hijack the dialog proc with our own - templateDlg->SetHandlerForAll(TRACKED_NEW pfJournalDlgProc(this)); + templateDlg->SetHandlerForAll(new pfJournalDlgProc(this)); // Find our animation keys @@ -621,7 +620,7 @@ void pfBookData::IInitTemplate(pfGUIDialogMod *templateDlg) // Grab and ref the default cover mipmap plLayer *lay = plLayer::ConvertNoRef(fCoverLayer); if((lay != nil)&&(lay->GetTexture() != nil)) - hsgResMgr::ResMgr()->AddViaNotify(lay->GetTexture()->GetKey(), TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnCreate, -1, kRefDefaultCover), plRefFlags::kPassiveRef); + hsgResMgr::ResMgr()->AddViaNotify(lay->GetTexture()->GetKey(), new plGenRefMsg(GetKey(), plRefMsg::kOnCreate, -1, kRefDefaultCover), plRefFlags::kPassiveRef); fLeftPageMap->SetFlag(pfGUIClickMapCtrl::kReportHovering); fRightPageMap->SetFlag(pfGUIClickMapCtrl::kReportHovering); @@ -657,7 +656,7 @@ void pfBookData::IInitTemplate(pfGUIDialogMod *templateDlg) { fEditable = true; fLeftEditCtrl->SetNext(fRightEditCtrl); - fLeftEditCtrl->SetEventProc(TRACKED_NEW pfBookMultiLineEditProc(this)); + fLeftEditCtrl->SetEventProc(new pfBookMultiLineEditProc(this)); fTurnFrontEditCtrl->SetNext(fTurnBackEditCtrl); // these are always back to back } } @@ -665,7 +664,7 @@ void pfBookData::IInitTemplate(pfGUIDialogMod *templateDlg) //// IGetDTMap /////////////////////////////////////////////////////////////// // Just a quick helper -plDynamicTextMap *pfBookData::GetDTMap(UInt32 which) +plDynamicTextMap *pfBookData::GetDTMap(uint32_t which) { pfGUIDynDisplayCtrl *display = pfGUIDynDisplayCtrl::ConvertNoRef(fDialog->GetControlFromTag(which)); return display->GetMap(0); @@ -673,7 +672,7 @@ plDynamicTextMap *pfBookData::GetDTMap(UInt32 which) //// GetEditCtrl ///////////////////////////////////////////////////////////// -pfGUIMultiLineEditCtrl *pfBookData::GetEditCtrl(UInt32 which) +pfGUIMultiLineEditCtrl *pfBookData::GetEditCtrl(uint32_t which) { switch (which) { @@ -714,7 +713,7 @@ void pfBookData::RegisterForSFX(WhichSide whichPages) // calced, pointers bad, etc) just bail, since the SFX are just for visual // flair and not really needed. -void pfBookData::IHandleSFX(hsScalar currTime, WhichSide whichSide /*= kNoSides*/) +void pfBookData::IHandleSFX(float currTime, WhichSide whichSide /*= kNoSides*/) { if(fCurrBook == nil) return; @@ -737,9 +736,9 @@ void pfBookData::IHandleSFX(hsScalar currTime, WhichSide whichSide /*= kNoSides* } // Update all SFX images for this page first - hsScalar deltaT = currTime - fBaseSFXTime; + float deltaT = currTime - fBaseSFXTime; - UInt32 idx, inc = (whichSide == kLeftSide) ? 0 : 1; + uint32_t idx, inc = (whichSide == kLeftSide) ? 0 : 1; if(fCurrBook->fPageStarts.GetCount() <= fCurrBook->fCurrentPage + inc + 1) return; @@ -751,8 +750,8 @@ void pfBookData::IHandleSFX(hsScalar currTime, WhichSide whichSide /*= kNoSides* if(chunk->fFlags & pfEsHTMLChunk::kGlowing) { // Glow SFX: animate opacity based on time offset - UInt8 isOdd = 0; - hsScalar newDelta = deltaT; + uint8_t isOdd = 0; + float newDelta = deltaT; while(newDelta > chunk->fSFXTime) { isOdd = ~isOdd; @@ -845,7 +844,7 @@ void pfBookData::IFillUncoveringPage(hsBool rightSide) } // create a timer so we can hide the old left or right turn page right before the animation finishes to prevent flicker - plTimerCallbackMsg* pTimerMsg = TRACKED_NEW plTimerCallbackMsg(GetKey(),id); + plTimerCallbackMsg* pTimerMsg = new plTimerCallbackMsg(GetKey(),id); plgTimerCallbackMgr::NewTimer( .5, pTimerMsg ); // .5 found by trial and error return; // the gui controls render everything for us, so ignoring this request } @@ -870,7 +869,7 @@ void pfBookData::ITriggerPageFlip(hsBool flipBackwards, hsBool immediate) const hsTArray &keys = fTurnPageButton->GetAnimationKeys(); const char *animName = fTurnPageButton->GetAnimationName(); - plAnimCmdMsg *msg = TRACKED_NEW plAnimCmdMsg(); + plAnimCmdMsg *msg = new plAnimCmdMsg(); if (immediate) { msg->SetCmd(plAnimCmdMsg::kGoToEnd); @@ -885,7 +884,7 @@ void pfBookData::ITriggerPageFlip(hsBool flipBackwards, hsBool immediate) // Here's the whole reason why we're not just checking the checkbox: so we can attach a callback // so we know when the animation completes. Pretty sad, huh? Poor checkbox. - plEventCallbackMsg *eventMsg = TRACKED_NEW plEventCallbackMsg; + plEventCallbackMsg *eventMsg = new plEventCallbackMsg; eventMsg->AddReceiver(GetKey()); eventMsg->fRepeats = 0; if (immediate) @@ -906,7 +905,7 @@ void pfBookData::ITriggerPageFlip(hsBool flipBackwards, hsBool immediate) // We want a second callback to tell us when, indeed, the page has started turning // and is thus visible and thus we can actually, really, honestly, safely fill in the // page behind it - eventMsg = TRACKED_NEW plEventCallbackMsg; + eventMsg = new plEventCallbackMsg; eventMsg->AddReceiver(GetKey()); eventMsg->fRepeats = 0; eventMsg->fUser = !flipBackwards ? (0x04 | 0x01) : 0x04; @@ -957,7 +956,7 @@ void pfBookData::IFinishTriggeredFlip(hsBool wasBackwards) if (!wasBackwards) { // adjust the starting point of the control (not needed if we weren't backwards since that was done when we started turning - Int32 newStart = fRightEditCtrl->GetLastVisibleLine(); + int32_t newStart = fRightEditCtrl->GetLastVisibleLine(); fLeftEditCtrl->SetGlobalStartLine(newStart); } if (fAdjustCursorTo >= 0) @@ -1080,7 +1079,7 @@ void pfBookData::UpdatePageCorners(WhichSide which) //// SetCurrSize //////////////////////////////////////////////////////////// // Seeks the width and height animations to set the desired book size. Sizes are in % across the animation -void pfBookData::SetCurrSize(hsScalar w, hsScalar h) +void pfBookData::SetCurrSize(float w, float h) { fWidthCtrl->SetCurrValue(w); fHeightCtrl->SetCurrValue(h); @@ -1106,14 +1105,14 @@ void pfBookData::PlayBookCloseAnim(hsBool closeIt /*= true*/, hsBool immediate / //// Event routines from a linked multi-line edit control //////////////////// -void pfBookData::HitEndOfControlList(Int32 cursorPos) +void pfBookData::HitEndOfControlList(int32_t cursorPos) { fAdjustCursorTo = cursorPos; if (fCurrBook) fCurrBook->NextPage(); } -void pfBookData::HitBeginningOfControlList(Int32 cursorPos) +void pfBookData::HitBeginningOfControlList(int32_t cursorPos) { fAdjustCursorTo = cursorPos; if (fCurrBook) @@ -1141,7 +1140,7 @@ std::map pfJournalBook::fBookGUIs; void pfJournalBook::SingletonInit( void ) { - fBookGUIs[_TEMP_CONVERT_FROM_LITERAL("BkBook")] = TRACKED_NEW pfBookData(); // load the default book data object + fBookGUIs[_TEMP_CONVERT_FROM_LITERAL("BkBook")] = new pfBookData(); // load the default book data object hsgResMgr::ResMgr()->NewKey(_TEMP_CONVERT_FROM_LITERAL("BkBook"),fBookGUIs[_TEMP_CONVERT_FROM_LITERAL("BkBook")],pfGameGUIMgr::GetInstance()->GetKey()->GetUoid().GetLocation()); fBookGUIs[_TEMP_CONVERT_FROM_LITERAL("BkBook")]->LoadGUI(); } @@ -1163,7 +1162,7 @@ void pfJournalBook::LoadGUI( const plString &guiName ) { if (fBookGUIs.find(guiName) == fBookGUIs.end()) // is it already loaded? { // nope, load it - fBookGUIs[guiName] = TRACKED_NEW pfBookData(guiName); + fBookGUIs[guiName] = new pfBookData(guiName); hsgResMgr::ResMgr()->NewKey(guiName,fBookGUIs[guiName],pfGameGUIMgr::GetInstance()->GetKey()->GetUoid().GetLocation()); fBookGUIs[guiName]->LoadGUI(); } @@ -1211,7 +1210,7 @@ pfJournalBook::pfJournalBook( const char *esHTMLSource, plKey coverImageKey, plK fCurBookGUI = _TEMP_CONVERT_FROM_LITERAL("BkBook"); if (fBookGUIs.find(fCurBookGUI) == fBookGUIs.end()) { - fBookGUIs[fCurBookGUI] = TRACKED_NEW pfBookData(fCurBookGUI); + fBookGUIs[fCurBookGUI] = new pfBookData(fCurBookGUI); hsgResMgr::ResMgr()->NewKey(fCurBookGUI,fBookGUIs[fCurBookGUI],pfGameGUIMgr::GetInstance()->GetKey()->GetUoid().GetLocation()); fBookGUIs[fCurBookGUI]->LoadGUI(); } @@ -1247,7 +1246,7 @@ pfJournalBook::pfJournalBook( const wchar_t *esHTMLSource, plKey coverImageKey, fCurBookGUI = _TEMP_CONVERT_FROM_LITERAL("BkBook"); if (fBookGUIs.find(fCurBookGUI) == fBookGUIs.end()) { - fBookGUIs[fCurBookGUI] = TRACKED_NEW pfBookData(fCurBookGUI); + fBookGUIs[fCurBookGUI] = new pfBookData(fCurBookGUI); hsgResMgr::ResMgr()->NewKey(fCurBookGUI,fBookGUIs[fCurBookGUI],pfGameGUIMgr::GetInstance()->GetKey()->GetUoid().GetLocation()); fBookGUIs[fCurBookGUI]->LoadGUI(); } @@ -1330,7 +1329,7 @@ void pfJournalBook::Show( hsBool startOpened /*= false */) { // it's a cover movie, not a decal, so we make a layer, thinking it's at 0,0 and a left map (which gives us the results we want) plLayerBink *movieLayer = IMakeMovieLayer(fCoverDecals[i],0,0,mip,pfJournalDlgProc::kTagLeftDTMap,false); - loadedMovie *movie = TRACKED_NEW loadedMovie; + loadedMovie *movie = new loadedMovie; movie->movieLayer = movieLayer; movie->movieChunk = fCoverDecals[i]; fLoadedMovies.Append(movie); @@ -1412,7 +1411,7 @@ void pfJournalBook::Hide( void ) //// Open //////////////////////////////////////////////////////////////////// // Opens the book, optionally to the given page -void pfJournalBook::Open( UInt32 startingPage /*= 0 */) +void pfJournalBook::Open( uint32_t startingPage /*= 0 */) { if( !fBookGUIs[fCurBookGUI]->CurrentlyOpen() ) { @@ -1477,7 +1476,7 @@ void pfJournalBook::ITriggerCloseWithNotify( hsBool closeNotOpen, hsBool imme const hsTArray &keys = fBookGUIs[fCurBookGUI]->CoverButton()->GetAnimationKeys(); const char *animName = fBookGUIs[fCurBookGUI]->CoverButton()->GetAnimationName(); - plAnimCmdMsg *msg = TRACKED_NEW plAnimCmdMsg(); + plAnimCmdMsg *msg = new plAnimCmdMsg(); if( !immediate ) { msg->SetCmd( plAnimCmdMsg::kContinue ); @@ -1491,7 +1490,7 @@ void pfJournalBook::ITriggerCloseWithNotify( hsBool closeNotOpen, hsBool imme msg->SetAnimName( animName ); msg->AddReceivers( keys ); - plEventCallbackMsg *eventMsg = TRACKED_NEW plEventCallbackMsg; + plEventCallbackMsg *eventMsg = new plEventCallbackMsg; eventMsg->AddReceiver( fBookGUIs[fCurBookGUI]->GetKey() ); eventMsg->fRepeats = 0; eventMsg->fUser = 0x08 | ( closeNotOpen ? 0x00 : 0x01 ); // So we know which this is for @@ -1584,7 +1583,7 @@ void pfJournalBook::PreviousPage( void ) pfGUIMultiLineEditCtrl *turnFront = fBookGUIs[fCurBookGUI]->GetEditCtrl(pfJournalDlgProc::kTagTurnFrontEditCtrl); pfGUIMultiLineEditCtrl *turnBack = fBookGUIs[fCurBookGUI]->GetEditCtrl(pfJournalDlgProc::kTagTurnBackEditCtrl); // adjust the starting position of the left control to the new start - Int32 newStartLine = left->GetFirstVisibleLine() - ((left->GetNumVisibleLines()-1)*2); + int32_t newStartLine = left->GetFirstVisibleLine() - ((left->GetNumVisibleLines()-1)*2); left->SetGlobalStartLine(newStartLine); // re-link the controls with the turn page in the middle left->SetNext(turnFront); @@ -1639,7 +1638,7 @@ void pfJournalBook::PreviousPage( void ) //// IFindCurrVisibleLink //////////////////////////////////////////////////// // Find the current moused link, if any -Int32 pfJournalBook::IFindCurrVisibleLink( hsBool rightNotLeft, hsBool hoverNotUp ) +int32_t pfJournalBook::IFindCurrVisibleLink( hsBool rightNotLeft, hsBool hoverNotUp ) { pfGUIClickMapCtrl *ctrl = ( rightNotLeft ) ? fBookGUIs[fCurBookGUI]->RightPageMap() : fBookGUIs[fCurBookGUI]->LeftPageMap(); @@ -1647,8 +1646,8 @@ Int32 pfJournalBook::IFindCurrVisibleLink( hsBool rightNotLeft, hsBool hoverNo // This should be 0-1 in the context of the control, so scale to our DTMap size plDynamicTextMap *dtMap = fBookGUIs[fCurBookGUI]->GetDTMap( rightNotLeft ? pfJournalDlgProc::kTagRightDTMap : pfJournalDlgProc::kTagLeftDTMap ); - pt.fX *= (hsScalar)dtMap->GetWidth(); - pt.fY *= (hsScalar)dtMap->GetHeight(); + pt.fX *= (float)dtMap->GetWidth(); + pt.fY *= (float)dtMap->GetHeight(); if( rightNotLeft ) { // Clicks on the right side are offsetted in x by the left side's width @@ -1657,13 +1656,13 @@ Int32 pfJournalBook::IFindCurrVisibleLink( hsBool rightNotLeft, hsBool hoverNo } // Search through the list of visible hotspots - UInt32 i; + uint32_t i; for( i = 0; i < fVisibleLinks.GetCount(); i++ ) { - if( fVisibleLinks[ i ]->fLinkRect.Contains( (Int16)pt.fX, (Int16)pt.fY ) ) + if( fVisibleLinks[ i ]->fLinkRect.Contains( (int16_t)pt.fX, (int16_t)pt.fY ) ) { // Found a visible link - return (Int32)i; + return (int32_t)i; } } @@ -1677,7 +1676,7 @@ void pfJournalBook::IHandleLeftSideClick( void ) if( fBookGUIs[fCurBookGUI]->CurrentlyTurning() ) return; - Int32 idx = IFindCurrVisibleLink( false, false ); + int32_t idx = IFindCurrVisibleLink( false, false ); if( idx != -1 ) { if( fVisibleLinks[ idx ]->fFlags & pfEsHTMLChunk::kActAsCB ) @@ -1696,7 +1695,7 @@ void pfJournalBook::IHandleRightSideClick( void ) if( fBookGUIs[fCurBookGUI]->CurrentlyTurning() ) return; - Int32 idx = IFindCurrVisibleLink( true, false ); + int32_t idx = IFindCurrVisibleLink( true, false ); if( idx != -1 ) { if( fVisibleLinks[ idx ]->fFlags & pfEsHTMLChunk::kActAsCB ) @@ -1713,7 +1712,7 @@ void pfJournalBook::IHandleRightSideClick( void ) //// IHandleCheckClick /////////////////////////////////////////////////////// // Process a click on the given "check box" image -void pfJournalBook::IHandleCheckClick( UInt32 idx, pfBookData::WhichSide which ) +void pfJournalBook::IHandleCheckClick( uint32_t idx, pfBookData::WhichSide which ) { // Special processing for checkboxes--toggle our state, switch our opacity // and then send a notify about our new state @@ -1741,13 +1740,11 @@ void pfJournalBook::IHandleCheckClick( UInt32 idx, pfBookData::WhichSide whic //// GoToPage //////////////////////////////////////////////////////////////// // For completeness... -void pfJournalBook::GoToPage( UInt32 pageNumber ) +void pfJournalBook::GoToPage( uint32_t pageNumber ) { // Put us here, but only on an even page (odd pages go on the right, y'know) - if (pageNumber < fPageStarts.Count()) - fCurrentPage = pageNumber & ~0x00000001; - else - fCurrentPage = 0; + // (no need for a range check, going past the end simply puts you on a blank page, able to go backward but not forward) + fCurrentPage = pageNumber & ~0x00000001; fVisibleLinks.Reset(); IRenderPage( fCurrentPage, pfJournalDlgProc::kTagLeftDTMap ); IRenderPage( fCurrentPage + 1, pfJournalDlgProc::kTagRightDTMap ); @@ -1779,9 +1776,9 @@ void pfJournalBook::ForceCacheCalculations( void ) } // Tiny helper to convert hex values the *right* way -static UInt32 IConvertHex( const wchar_t *str ) +static uint32_t IConvertHex( const wchar_t *str ) { - UInt32 value = 0; + uint32_t value = 0; while( *str != 0 ) { value <<= 4; @@ -1818,11 +1815,11 @@ hsBool pfJournalBook::ICompileSource( const wchar_t *source, const plLocation & IFreeSource(); - pfEsHTMLChunk *chunk, *lastParChunk = TRACKED_NEW pfEsHTMLChunk( nil ); + pfEsHTMLChunk *chunk, *lastParChunk = new pfEsHTMLChunk( nil ); const wchar_t *c, *start; wchar_t name[ 128 ], option[ 256 ]; float bookWidth=1.0, bookHeight=1.0; - UInt8 movieIndex = 0; // the index of a movie in the source (used for id purposes) + uint8_t movieIndex = 0; // the index of a movie in the source (used for id purposes) plKey anotherKey; @@ -1831,7 +1828,7 @@ hsBool pfJournalBook::ICompileSource( const wchar_t *source, const plLocation & for( start = c = source; *c != 0; ) { // Are we on a tag? - UInt8 type = IGetTagType( c ); + uint8_t type = IGetTagType( c ); if( type != pfEsHTMLChunk::kEmpty ) { // First, end the current paragraph chunk, which is a special case 'cause its @@ -1844,9 +1841,9 @@ hsBool pfJournalBook::ICompileSource( const wchar_t *source, const plLocation & } else if( lastParChunk != nil ) { - UInt32 count = ((UInt32)c - (UInt32)start)/2; // wchar_t is 2 bytes + uint32_t count = ((uint32_t)c - (uint32_t)start)/2; // wchar_t is 2 bytes - wchar_t *temp = TRACKED_NEW wchar_t[ count + 1 ]; + wchar_t *temp = new wchar_t[ count + 1 ]; wcsncpy( temp, start, count ); temp[count] = L'\0'; lastParChunk->fText = temp; @@ -1864,7 +1861,7 @@ hsBool pfJournalBook::ICompileSource( const wchar_t *source, const plLocation & { case pfEsHTMLChunk::kParagraph: c += 2; - chunk = TRACKED_NEW pfEsHTMLChunk( nil ); + chunk = new pfEsHTMLChunk( nil ); chunk->fFlags = IFindLastAlignment(); while( IGetNextOption( c, name, option ) ) { @@ -1884,7 +1881,7 @@ hsBool pfJournalBook::ICompileSource( const wchar_t *source, const plLocation & case pfEsHTMLChunk::kImage: c += 4; - chunk = TRACKED_NEW pfEsHTMLChunk( nil, 0 ); + chunk = new pfEsHTMLChunk( nil, 0 ); while( IGetNextOption( c, name, option ) ) { if( wcsicmp( name, L"align" ) == 0 ) @@ -1937,20 +1934,20 @@ hsBool pfJournalBook::ICompileSource( const wchar_t *source, const plLocation & char *comma2 = strchr( comma + 1, ',' ); if( comma2 != nil ) { - chunk->fMaxOpacity = (hsScalar)atof( comma2 + 1 ); + chunk->fMaxOpacity = (float)atof( comma2 + 1 ); *comma2 = 0; } - chunk->fMinOpacity = (hsScalar)atof( comma + 1 ); + chunk->fMinOpacity = (float)atof( comma + 1 ); *comma = 0; } - chunk->fSFXTime = (hsScalar)atof( cOption ); + chunk->fSFXTime = (float)atof( cOption ); delete [] cOption; } else if( wcsicmp( name, L"opacity" ) == 0 ) { chunk->fFlags |= pfEsHTMLChunk::kTranslucent; char *cOption = hsWStringToString(option); - chunk->fCurrOpacity = (hsScalar)atof( cOption ); + chunk->fCurrOpacity = (float)atof( cOption ); delete [] cOption; } else if( wcsicmp( name, L"check" ) == 0 ) @@ -1968,13 +1965,13 @@ hsBool pfJournalBook::ICompileSource( const wchar_t *source, const plLocation & chunk->fFlags |= pfEsHTMLChunk::kChecked; *comma2 = 0; } - UInt32 c = IConvertHex( comma + 1 ); + uint32_t c = IConvertHex( comma + 1 ); if( wcslen( comma + 1 ) <= 6 ) c |= 0xff000000; // Add in full alpha if none specified chunk->fOffColor.FromARGB32( c ); *comma = 0; } - UInt32 c = IConvertHex( option ); + uint32_t c = IConvertHex( option ); if( wcslen( option ) <= 6 ) c |= 0xff000000; // Add in full alpha if none specified chunk->fOnColor.FromARGB32( c ); @@ -1995,7 +1992,7 @@ hsBool pfJournalBook::ICompileSource( const wchar_t *source, const plLocation & else delete chunk; // Start new paragraph chunk after this one - lastParChunk = TRACKED_NEW pfEsHTMLChunk( nil ); + lastParChunk = new pfEsHTMLChunk( nil ); lastParChunk->fFlags = IFindLastAlignment(); break; @@ -2027,30 +2024,30 @@ hsBool pfJournalBook::ICompileSource( const wchar_t *source, const plLocation & } } // Still gotta create a new par chunk - lastParChunk = TRACKED_NEW pfEsHTMLChunk( nil ); + lastParChunk = new pfEsHTMLChunk( nil ); lastParChunk->fFlags = IFindLastAlignment(); break; case pfEsHTMLChunk::kPageBreak: c += 3; - chunk = TRACKED_NEW pfEsHTMLChunk(); + chunk = new pfEsHTMLChunk(); while( IGetNextOption( c, name, option ) ) { } fHTMLSource.Append( chunk ); // Start new paragraph chunk after this one - lastParChunk = TRACKED_NEW pfEsHTMLChunk( nil ); + lastParChunk = new pfEsHTMLChunk( nil ); lastParChunk->fFlags = IFindLastAlignment(); break; case pfEsHTMLChunk::kFontChange: c += 5; - chunk = TRACKED_NEW pfEsHTMLChunk( nil, 0, 0 ); + chunk = new pfEsHTMLChunk( nil, 0, 0 ); while( IGetNextOption( c, name, option ) ) { if( wcsicmp( name, L"style" ) == 0 ) { - UInt8 guiFlags = 0; + uint8_t guiFlags = 0; if( wcsicmp( option, L"b" ) == 0 ) { chunk->fFlags = pfEsHTMLChunk::kFontBold; @@ -2121,7 +2118,7 @@ hsBool pfJournalBook::ICompileSource( const wchar_t *source, const plLocation & } fHTMLSource.Append( chunk ); // Start new paragraph chunk after this one - lastParChunk = TRACKED_NEW pfEsHTMLChunk( nil ); + lastParChunk = new pfEsHTMLChunk( nil ); lastParChunk->fFlags = IFindLastAlignment(); break; @@ -2147,7 +2144,7 @@ hsBool pfJournalBook::ICompileSource( const wchar_t *source, const plLocation & fBookGUIs[fCurBookGUI]->GetEditCtrl(pfJournalDlgProc::kTagTurnBackEditCtrl)->SetMargins(fPageTMargin,fPageLMargin,fPageBMargin,fPageRMargin); } // Start a new paragraph chunk after this one - lastParChunk = TRACKED_NEW pfEsHTMLChunk(nil); + lastParChunk = new pfEsHTMLChunk(nil); lastParChunk->fFlags = IFindLastAlignment(); break; @@ -2173,13 +2170,13 @@ hsBool pfJournalBook::ICompileSource( const wchar_t *source, const plLocation & fWidthScale = 1.f - bookWidth; // Still gotta create a new par chunk - lastParChunk = TRACKED_NEW pfEsHTMLChunk( nil ); + lastParChunk = new pfEsHTMLChunk( nil ); lastParChunk->fFlags = IFindLastAlignment(); break; case pfEsHTMLChunk::kDecal: c += 6; - chunk = TRACKED_NEW pfEsHTMLChunk( nil, 0 ); + chunk = new pfEsHTMLChunk( nil, 0 ); chunk->fType = pfEsHTMLChunk::kDecal; while( IGetNextOption( c, name, option ) ) { @@ -2228,13 +2225,13 @@ hsBool pfJournalBook::ICompileSource( const wchar_t *source, const plLocation & else delete chunk; // Start new paragraph chunk after this one - lastParChunk = TRACKED_NEW pfEsHTMLChunk( nil ); + lastParChunk = new pfEsHTMLChunk( nil ); lastParChunk->fFlags = IFindLastAlignment(); break; case pfEsHTMLChunk::kMovie: c += 6; - chunk = TRACKED_NEW pfEsHTMLChunk( nil, 0 ); + chunk = new pfEsHTMLChunk( nil, 0 ); chunk->fType = pfEsHTMLChunk::kMovie; while( IGetNextOption( c, name, option ) ) { @@ -2303,20 +2300,20 @@ hsBool pfJournalBook::ICompileSource( const wchar_t *source, const plLocation & delete chunk; } // Start new paragraph chunk after this one - lastParChunk = TRACKED_NEW pfEsHTMLChunk( nil ); + lastParChunk = new pfEsHTMLChunk( nil ); lastParChunk->fFlags = IFindLastAlignment(); break; case pfEsHTMLChunk::kEditable: c += 9; SetEditable(true); - chunk = TRACKED_NEW pfEsHTMLChunk(); + chunk = new pfEsHTMLChunk(); while( IGetNextOption( c, name, option ) ) { } fHTMLSource.Append( chunk ); // Start new paragraph chunk after this one - lastParChunk = TRACKED_NEW pfEsHTMLChunk( nil ); + lastParChunk = new pfEsHTMLChunk( nil ); lastParChunk->fFlags = IFindLastAlignment(); break; } @@ -2339,9 +2336,9 @@ hsBool pfJournalBook::ICompileSource( const wchar_t *source, const plLocation & } else if( lastParChunk != nil ) { - UInt32 count = (UInt32)c - (UInt32)start; + uint32_t count = (uint32_t)c - (uint32_t)start; - wchar_t *temp = TRACKED_NEW wchar_t[ count + 1 ]; + wchar_t *temp = new wchar_t[ count + 1 ]; wcsncpy( temp, start, count + 1 ); lastParChunk->fText = temp; delete [] temp; @@ -2364,7 +2361,7 @@ hsBool pfJournalBook::ICompileSource( const wchar_t *source, const plLocation & return true; } -UInt8 pfJournalBook::IGetTagType( const wchar_t *string ) +uint8_t pfJournalBook::IGetTagType( const wchar_t *string ) { if( string[ 0 ] != '<' ) return pfEsHTMLChunk::kEmpty; @@ -2372,7 +2369,7 @@ UInt8 pfJournalBook::IGetTagType( const wchar_t *string ) struct TagRec { const wchar_t *fTag; - UInt8 fType; + uint8_t fType; } tags[] = { { L"p", pfEsHTMLChunk::kParagraph }, { L"img", pfEsHTMLChunk::kImage }, { L"pb", pfEsHTMLChunk::kPageBreak }, @@ -2386,7 +2383,7 @@ UInt8 pfJournalBook::IGetTagType( const wchar_t *string ) { nil, pfEsHTMLChunk::kEmpty } }; - UInt32 i; + uint32_t i; for( i = 0; tags[ i ].fTag != nil; i++ ) { if( wcsnicmp( string + 1, tags[ i ].fTag, wcslen( tags[ i ].fTag ) ) == 0 ) @@ -2425,7 +2422,7 @@ hsBool pfJournalBook::IGetNextOption( const wchar_t *&string, wchar_t *name, wc return false; // Copy name - UInt32 len = ((UInt32)string - (UInt32)c)/2; // divide length by 2 because each character is two bytes + uint32_t len = ((uint32_t)string - (uint32_t)c)/2; // divide length by 2 because each character is two bytes wcsncpy( name, c, len ); name[len] = L'\0'; @@ -2445,7 +2442,7 @@ hsBool pfJournalBook::IGetNextOption( const wchar_t *&string, wchar_t *name, wc while( *string != L'>' && *string != L'\"' && *string != L'\0' ) string++; - len = ((UInt32)string - (UInt32)c)/2; // divide length by 2 because each character is two bytes + len = ((uint32_t)string - (uint32_t)c)/2; // divide length by 2 because each character is two bytes wcsncpy( option, c, len ); option[len] = L'\0'; @@ -2460,7 +2457,7 @@ hsBool pfJournalBook::IGetNextOption( const wchar_t *&string, wchar_t *name, wc while( *string != L' ' && *string != L'>' && *string != L'\0' ) string++; - len = ((UInt32)string - (UInt32)c)/2; // divide length by 2 because each character is two bytes + len = ((uint32_t)string - (uint32_t)c)/2; // divide length by 2 because each character is two bytes wcsncpy( option, c, len ); option[len] = L'\0'; @@ -2469,7 +2466,7 @@ hsBool pfJournalBook::IGetNextOption( const wchar_t *&string, wchar_t *name, wc void pfJournalBook::IFreeSource( void ) { - UInt32 i; + uint32_t i; for( i = 0; i < fHTMLSource.GetCount(); i++ ) delete fHTMLSource[ i ]; @@ -2558,7 +2555,7 @@ plKey pfJournalBook::IGetMipmapKey( const wchar_t *name, const plLocation &loc // DTMap (by GUI tag ID). If no page is cached after this one, also updates // the various cached info about page endings, etc. -void pfJournalBook::IRenderPage( UInt32 page, UInt32 whichDTMap, hsBool suppressRendering /*= false*/ ) +void pfJournalBook::IRenderPage( uint32_t page, uint32_t whichDTMap, hsBool suppressRendering /*= false*/ ) { if (fAreEditing) return; // we don't render if we are editing the book @@ -2599,23 +2596,23 @@ void pfJournalBook::IRenderPage( UInt32 page, UInt32 whichDTMap, hsBool suppr plLayerBink *bink = plLayerBink::ConvertNoRef(matLayer); if (bink) // if it was a bink layer { - plMatRefMsg* refMsg = TRACKED_NEW plMatRefMsg(material->GetKey(), plRefMsg::kOnRemove, i, plMatRefMsg::kLayer); // remove it + plMatRefMsg* refMsg = new plMatRefMsg(material->GetKey(), plRefMsg::kOnRemove, i, plMatRefMsg::kLayer); // remove it hsgResMgr::ResMgr()->SendRef(material->GetLayer(i)->GetKey(), refMsg, plRefFlags::kActiveRef); } } } - hsAssert(page < fPageStarts.GetCount(), "UnInitialized page start!"); + hsAssert(page < fPageStarts.GetCount() || page > fLastPage, "UnInitialized page start!"); if( page <= fLastPage && page < fPageStarts.GetCount()) // Added this as a crash-prevention bandaid - MT { - UInt32 idx; - UInt16 width, height, y, x, ascent, lastX, lastY; + uint32_t idx; + uint16_t width, height, y, x, ascent, lastX, lastY; - UInt8 fontFlags, fontSize; + uint8_t fontFlags, fontSize; const wchar_t *fontFace; hsColorRGBA fontColor; - Int16 fontSpacing; + int16_t fontSpacing; hsBool needSFX = false; // Find and set initial font properties @@ -2624,8 +2621,8 @@ void pfJournalBook::IRenderPage( UInt32 page, UInt32 whichDTMap, hsBool suppr dtMap->SetTextColor( fontColor, true ); dtMap->SetLineSpacing(fontSpacing); - for( idx = fPageStarts[ page ], x = (UInt16)fPageLMargin, y = (UInt16)fPageTMargin; - y < (UInt16)(512 - fPageTMargin - fPageBMargin) && idx < fHTMLSource.GetCount(); idx++ ) + for( idx = fPageStarts[ page ], x = (uint16_t)fPageLMargin, y = (uint16_t)fPageTMargin; + y < (uint16_t)(512 - fPageTMargin - fPageBMargin) && idx < fHTMLSource.GetCount(); idx++ ) { if( fPageStarts.GetCount() > page + 1 && idx == fPageStarts[ page + 1 ] ) break; // Just go ahead and break at the start of the next page, since we already found it @@ -2638,27 +2635,27 @@ void pfJournalBook::IRenderPage( UInt32 page, UInt32 whichDTMap, hsBool suppr if( ( chunk->fFlags & pfEsHTMLChunk::kAlignMask ) == pfEsHTMLChunk::kLeft ) { dtMap->SetJustify( plDynamicTextMap::kLeftJustify ); - x = (UInt16)fPageLMargin; // reset X if our justification changes + x = (uint16_t)fPageLMargin; // reset X if our justification changes } else if( ( chunk->fFlags & pfEsHTMLChunk::kAlignMask ) == pfEsHTMLChunk::kRight ) { dtMap->SetJustify( plDynamicTextMap::kRightJustify ); - x = (UInt16)fPageLMargin; // reset X if our justification changes + x = (uint16_t)fPageLMargin; // reset X if our justification changes } else if( ( chunk->fFlags & pfEsHTMLChunk::kAlignMask ) == pfEsHTMLChunk::kCenter ) { dtMap->SetJustify( plDynamicTextMap::kCenter ); - x = (UInt16)fPageLMargin; // reset X if our justification changes + x = (uint16_t)fPageLMargin; // reset X if our justification changes } - dtMap->SetFirstLineIndent( (Int16)(x - fPageLMargin) ); - width = (UInt16)(512 - fPageLMargin - fPageRMargin); - height = (UInt16)(512 - fPageBMargin - y); - UInt32 lastChar; + dtMap->SetFirstLineIndent( (int16_t)(x - fPageLMargin) ); + width = (uint16_t)(512 - fPageLMargin - fPageRMargin); + height = (uint16_t)(512 - fPageBMargin - y); + uint32_t lastChar; dtMap->CalcWrappedStringSize( chunk->fText.c_str(), &width, &height, &lastChar, &ascent, &lastX, &lastY ); - width = (UInt16)(512 - fPageLMargin - fPageRMargin); + width = (uint16_t)(512 - fPageLMargin - fPageRMargin); if( !suppressRendering ) - dtMap->DrawWrappedString( (UInt16)fPageLMargin, y, chunk->fText.c_str(), width, (UInt16)(512 - fPageBMargin - y), &lastX, &lastY ); + dtMap->DrawWrappedString( (uint16_t)fPageLMargin, y, chunk->fText.c_str(), width, (uint16_t)(512 - fPageBMargin - y), &lastX, &lastY ); if( lastChar == 0 ) { @@ -2677,12 +2674,12 @@ void pfJournalBook::IRenderPage( UInt32 page, UInt32 whichDTMap, hsBool suppr // cache, but that's ok 'cause if we're doing this, it's probably invalid (or empty) // anyway int fTextLen = chunk->fText.length(); - wchar_t *s = TRACKED_NEW wchar_t[fTextLen+1]; + wchar_t *s = new wchar_t[fTextLen+1]; wcscpy(s,chunk->fText.c_str()); s[fTextLen] = L'\0'; // Note: Makes a copy of the string - pfEsHTMLChunk *c2 = TRACKED_NEW pfEsHTMLChunk( &s[ lastChar ] ); + pfEsHTMLChunk *c2 = new pfEsHTMLChunk( &s[ lastChar ] ); c2->fFlags = chunk->fFlags; fHTMLSource.Insert( idx + 1, c2 ); @@ -2700,12 +2697,12 @@ void pfJournalBook::IRenderPage( UInt32 page, UInt32 whichDTMap, hsBool suppr } x = lastX; - y = (UInt16)(lastY - dtMap->GetCurrFont()->GetAscent()); // Since our text is top-justified + y = (uint16_t)(lastY - dtMap->GetCurrFont()->GetAscent()); // Since our text is top-justified if( ( chunk->fFlags & pfEsHTMLChunk::kAlignMask ) != pfEsHTMLChunk::kLeft ) { // Ending X is not guaranteed to be anything useful if we're not left justified - x = (UInt16)fPageLMargin; + x = (uint16_t)fPageLMargin; } break; @@ -2739,7 +2736,7 @@ void pfJournalBook::IRenderPage( UInt32 page, UInt32 whichDTMap, hsBool suppr // end up marking the page break here (note that, unlike paragraphs, we // can't really break the mipmap into two...well, OK, we could, but it // wouldn't make much sense :) - y += (UInt16)(mip->GetHeight()); + y += (uint16_t)(mip->GetHeight()); // Wonderful, the break breaks us from the switch(), which means the for() // loops runs once more and increments idx. So this is to counter that. @@ -2750,16 +2747,16 @@ void pfJournalBook::IRenderPage( UInt32 page, UInt32 whichDTMap, hsBool suppr break; } if( ( chunk->fFlags & pfEsHTMLChunk::kAlignMask ) == pfEsHTMLChunk::kLeft ) - x = (UInt16)fPageLMargin; + x = (uint16_t)fPageLMargin; else if( ( chunk->fFlags & pfEsHTMLChunk::kAlignMask ) == pfEsHTMLChunk::kRight ) - x = (UInt16)(512 - fPageRMargin - mip->GetWidth()); + x = (uint16_t)(512 - fPageRMargin - mip->GetWidth()); else if( ( chunk->fFlags & pfEsHTMLChunk::kAlignMask ) == pfEsHTMLChunk::kCenter ) - x = (UInt16)(256 - ( mip->GetWidth() >> 1 )); + x = (uint16_t)(256 - ( mip->GetWidth() >> 1 )); IDrawMipmap( chunk, x, y, mip, dtMap, whichDTMap, suppressRendering ); - y += (UInt16)(mip->GetHeight()); - x = (UInt16)fPageLMargin; + y += (uint16_t)(mip->GetHeight()); + x = (uint16_t)fPageLMargin; } } } @@ -2779,8 +2776,8 @@ void pfJournalBook::IRenderPage( UInt32 page, UInt32 whichDTMap, hsBool suppr continue; } } - y = (UInt16)(512 - fPageTMargin - fPageBMargin); - x = (UInt16)fPageLMargin; + y = (uint16_t)(512 - fPageTMargin - fPageBMargin); + x = (uint16_t)fPageLMargin; break; case pfEsHTMLChunk::kFontChange: @@ -2796,7 +2793,7 @@ void pfJournalBook::IRenderPage( UInt32 page, UInt32 whichDTMap, hsBool suppr if (movieLayer) { // adjust the starting height of the movie if we are keeping it inline with the text - UInt32 movieHeight = 0, movieWidth = 0; + uint32_t movieHeight = 0, movieWidth = 0; movieHeight = movieLayer->GetHeight(); movieWidth = movieLayer->GetWidth(); if(!(chunk->fFlags & pfEsHTMLChunk::kFloating )) @@ -2806,7 +2803,7 @@ void pfJournalBook::IRenderPage( UInt32 page, UInt32 whichDTMap, hsBool suppr // Movie overlaps the bottom of this page, so forcibly break so we'll // end up marking the page break here (note that, unlike paragraphs, we // can't really break the Movie into two) - y += (UInt16)movieHeight; + y += (uint16_t)movieHeight; // Wonderful, the break breaks us from the switch(), which means the for() // loops runs once more and increments idx. So this is to counter that. @@ -2816,12 +2813,12 @@ void pfJournalBook::IRenderPage( UInt32 page, UInt32 whichDTMap, hsBool suppr idx--; break; } - y += (UInt16)movieHeight; - x = (UInt16)fPageLMargin; + y += (uint16_t)movieHeight; + x = (uint16_t)fPageLMargin; } if (!movieAlreadyLoaded) // if the movie wasn't already cached, cache it { - movie = TRACKED_NEW loadedMovie; + movie = new loadedMovie; movie->movieLayer = movieLayer; // save the layer and chunk data movie->movieChunk = chunk; fLoadedMovies.Append(movie); @@ -2868,7 +2865,7 @@ void pfJournalBook::IMoveMovies( hsGMaterial *source, hsGMaterial *dest ) plLayerBink *bink = plLayerBink::ConvertNoRef(matLayer); if (bink) // if it was a bink layer { - plMatRefMsg* refMsg = TRACKED_NEW plMatRefMsg(source->GetKey(), plRefMsg::kOnRemove, i, plMatRefMsg::kLayer); // remove it + plMatRefMsg* refMsg = new plMatRefMsg(source->GetKey(), plRefMsg::kOnRemove, i, plMatRefMsg::kLayer); // remove it hsgResMgr::ResMgr()->SendRef(source->GetLayer(i)->GetKey(), refMsg, plRefFlags::kActiveRef); moviesOnPage.Append(bink); } @@ -2880,7 +2877,7 @@ void pfJournalBook::IMoveMovies( hsGMaterial *source, hsGMaterial *dest ) plLayerBink *bink = plLayerBink::ConvertNoRef(matLayer); if (bink) // if it was a bink layer { - plMatRefMsg* refMsg = TRACKED_NEW plMatRefMsg(dest->GetKey(), plRefMsg::kOnRemove, i, plMatRefMsg::kLayer); // remove it + plMatRefMsg* refMsg = new plMatRefMsg(dest->GetKey(), plRefMsg::kOnRemove, i, plMatRefMsg::kLayer); // remove it hsgResMgr::ResMgr()->SendRef(dest->GetLayer(i)->GetKey(), refMsg, plRefFlags::kActiveRef); } } @@ -2894,9 +2891,9 @@ void pfJournalBook::IMoveMovies( hsGMaterial *source, hsGMaterial *dest ) //// IDrawMipmap ///////////////////////////////////////////////////////////// -void pfJournalBook::IDrawMipmap( pfEsHTMLChunk *chunk, UInt16 x, UInt16 y, plMipmap *mip, plDynamicTextMap *dtMap, UInt32 whichDTMap, hsBool dontRender ) +void pfJournalBook::IDrawMipmap( pfEsHTMLChunk *chunk, uint16_t x, uint16_t y, plMipmap *mip, plDynamicTextMap *dtMap, uint32_t whichDTMap, hsBool dontRender ) { - plMipmap *copy = TRACKED_NEW plMipmap(); + plMipmap *copy = new plMipmap(); copy->CopyFrom(mip); if (chunk->fNoResizeImg) { @@ -2905,25 +2902,25 @@ void pfJournalBook::IDrawMipmap( pfEsHTMLChunk *chunk, UInt16 x, UInt16 y, pl float xScale = (fWidthScale == 0) ? 1 : 1/(1-fWidthScale); float yScale = (fHeightScale == 0) ? 1 : 1/(1-fHeightScale); yScale *= 0.7; // adjust because the book isn't square - UInt32 width = (UInt32)(mip->GetWidth()*xScale); - UInt32 height = (UInt32)(mip->GetHeight()*yScale); - UInt16 xShift; - UInt16 yShift; + uint32_t width = (uint32_t)(mip->GetWidth()*xScale); + uint32_t height = (uint32_t)(mip->GetHeight()*yScale); + uint16_t xShift; + uint16_t yShift; if (dtMap->GetWidth() < width) width = dtMap->GetWidth(); if (dtMap->GetHeight() < height) height = dtMap->GetHeight(); if (height < mip->GetHeight()) { - yShift = (UInt16)((mip->GetHeight()-height)/2); + yShift = (uint16_t)((mip->GetHeight()-height)/2); if (y+yShift+height > dtMap->GetHeight()) - y = (UInt16)(dtMap->GetHeight()-height); + y = (uint16_t)(dtMap->GetHeight()-height); else y += yShift; } else { - yShift = (UInt16)((height-mip->GetHeight())/2); + yShift = (uint16_t)((height-mip->GetHeight())/2); if (yShift > y) y = 0; else @@ -2932,15 +2929,15 @@ void pfJournalBook::IDrawMipmap( pfEsHTMLChunk *chunk, UInt16 x, UInt16 y, pl if (width < mip->GetWidth()) { - xShift = (UInt16)((mip->GetWidth()-width)/2); + xShift = (uint16_t)((mip->GetWidth()-width)/2); if (x+xShift+width > dtMap->GetWidth()) - x = (UInt16)(dtMap->GetWidth()-width); + x = (uint16_t)(dtMap->GetWidth()-width); else x += xShift; } else { - xShift = (UInt16)((width-mip->GetWidth())/2); + xShift = (uint16_t)((width-mip->GetWidth())/2); if (xShift > x) x = 0; else @@ -2948,7 +2945,7 @@ void pfJournalBook::IDrawMipmap( pfEsHTMLChunk *chunk, UInt16 x, UInt16 y, pl } copy->SetCurrLevel(0); // resize the image so it will look unchanged when rendered on the altered book - copy->ResizeNicely((UInt16)width,(UInt16)height,plMipmap::kDefaultFilter); + copy->ResizeNicely((uint16_t)width,(uint16_t)height,plMipmap::kDefaultFilter); } if( !dontRender ) { @@ -2959,7 +2956,7 @@ void pfJournalBook::IDrawMipmap( pfEsHTMLChunk *chunk, UInt16 x, UInt16 y, pl opts.fRedTint = chunk->fCurrColor.r; opts.fGreenTint = chunk->fCurrColor.g; opts.fBlueTint = chunk->fCurrColor.b; - opts.fOpacity = (UInt8)(chunk->fCurrColor.a * 255.f); + opts.fOpacity = (uint8_t)(chunk->fCurrColor.a * 255.f); } else { @@ -2969,7 +2966,7 @@ void pfJournalBook::IDrawMipmap( pfEsHTMLChunk *chunk, UInt16 x, UInt16 y, pl opts.fFlags = plMipmap::kMaskSrcAlpha; else opts.fFlags = ( chunk->fFlags & pfEsHTMLChunk::kBlendAlpha ) ? plMipmap::kCopySrcAlpha : plMipmap::kForceOpaque; - opts.fOpacity = (UInt8)(chunk->fCurrOpacity * 255.f); + opts.fOpacity = (uint8_t)(chunk->fCurrOpacity * 255.f); } dtMap->Composite( copy, x, y, &opts ); } @@ -2977,12 +2974,12 @@ void pfJournalBook::IDrawMipmap( pfEsHTMLChunk *chunk, UInt16 x, UInt16 y, pl if( chunk->fFlags & pfEsHTMLChunk::kCanLink ) { if( whichDTMap == pfJournalDlgProc::kTagRightDTMap || whichDTMap == pfJournalDlgProc::kTagTurnFrontDTMap ) - x += (UInt16)(dtMap->GetWidth()); // Right page rects are offsetted to differentiate + x += (uint16_t)(dtMap->GetWidth()); // Right page rects are offsetted to differentiate if (dontRender) // if we aren't rendering then this link isn't visible, but the index still needs to be valid, so give it a rect of 0,0,0,0 chunk->fLinkRect.Set(0,0,0,0); else - chunk->fLinkRect.Set( x, y, (Int16)(copy->GetWidth()), (Int16)(copy->GetHeight()) ); + chunk->fLinkRect.Set( x, y, (int16_t)(copy->GetWidth()), (int16_t)(copy->GetHeight()) ); fVisibleLinks.Append( chunk ); } delete copy; @@ -2999,7 +2996,7 @@ pfJournalBook::loadedMovie *pfJournalBook::IMovieAlreadyLoaded(pfEsHTMLChunk *ch return nil; } -plKey pfJournalBook::GetMovie(UInt8 index) +plKey pfJournalBook::GetMovie(uint8_t index) { loadedMovie *movie = IGetMovieByIndex(index); if (movie) @@ -3007,7 +3004,7 @@ plKey pfJournalBook::GetMovie(UInt8 index) return plKey(nil); } -pfJournalBook::loadedMovie *pfJournalBook::IGetMovieByIndex(UInt8 index) +pfJournalBook::loadedMovie *pfJournalBook::IGetMovieByIndex(uint8_t index) { int i; for (i=0; imovieLayer; @@ -3041,11 +3038,11 @@ plLayerBink *pfJournalBook::IMakeMovieLayer(pfEsHTMLChunk *chunk, UInt16 x, UInt plString buff; buff = plString::Format("%s_%d_ml", GetKey()->GetName().c_str(), uniqueSuffix); - layer = TRACKED_NEW plLayer; + layer = new plLayer; hsgResMgr::ResMgr()->NewKey(buff, layer, GetKey()->GetUoid().GetLocation()); buff = plString::Format("%s_%d_m", GetKey()->GetName().c_str(), uniqueSuffix++); - movieLayer = TRACKED_NEW plLayerBink; + movieLayer = new plLayerBink; hsgResMgr::ResMgr()->NewKey(buff, movieLayer, GetKey()->GetUoid().GetLocation()); movieLayer->GetKey()->RefObject(); // we want to own a ref so we can nuke it at will @@ -3100,11 +3097,11 @@ plLayerBink *pfJournalBook::IMakeMovieLayer(pfEsHTMLChunk *chunk, UInt16 x, UInt } if( ( chunk->fFlags & pfEsHTMLChunk::kAlignMask ) == pfEsHTMLChunk::kLeft ) - x = (UInt16)fPageLMargin; + x = (uint16_t)fPageLMargin; else if( ( chunk->fFlags & pfEsHTMLChunk::kAlignMask ) == pfEsHTMLChunk::kRight ) - x = (UInt16)(baseMipmap->GetWidth() - fPageRMargin - movieWidth); + x = (uint16_t)(baseMipmap->GetWidth() - fPageRMargin - movieWidth); else if( ( chunk->fFlags & pfEsHTMLChunk::kAlignMask ) == pfEsHTMLChunk::kCenter ) - x = (UInt16)((baseMipmap->GetWidth() >> 1) - (movieWidth >> 1)); + x = (uint16_t)((baseMipmap->GetWidth() >> 1) - (movieWidth >> 1)); // x and y are in pixels, need to convert to a range of 0 to 1 float xRel = (float)x/(float)baseMipmap->GetWidth(); @@ -3159,7 +3156,7 @@ plLayerBink *pfJournalBook::IMakeMovieLayer(pfEsHTMLChunk *chunk, UInt16 x, UInt if( chunk->fFlags & pfEsHTMLChunk::kCanLink ) { if( whichDTMap == pfJournalDlgProc::kTagRightDTMap || whichDTMap == pfJournalDlgProc::kTagTurnFrontDTMap ) - x += (UInt16)(baseMipmap->GetWidth()); // Right page rects are offsetted to differentiate + x += (uint16_t)(baseMipmap->GetWidth()); // Right page rects are offsetted to differentiate if (dontRender) // if we aren't rendering then this link isn't visible, but the index still needs to be valid, so give it a rect of 0,0,0,0 chunk->fLinkRect.Set(0,0,0,0); @@ -3189,7 +3186,7 @@ plLayerInterface *pfJournalBook::IMakeBaseLayer(plMipmap *image) static int uniqueSuffix = 0; plString buff = plString::Format("%s_%d", GetKey()->GetName().c_str(), uniqueSuffix++); - plLayer* layer = TRACKED_NEW plLayer; + plLayer* layer = new plLayer; hsgResMgr::ResMgr()->NewKey(buff, layer, GetKey()->GetUoid().GetLocation()); // Initialize it. @@ -3229,7 +3226,7 @@ plLayerInterface *pfJournalBook::IMakeBaseLayer(plMipmap *image) layer->SetTransform(xfm); // Set the texture (assumes mipmap is non-nil). - plLayRefMsg* refMsg = TRACKED_NEW plLayRefMsg(layer->GetKey(), plRefMsg::kOnCreate, 0, plLayRefMsg::kTexture); + plLayRefMsg* refMsg = new plLayRefMsg(layer->GetKey(), plRefMsg::kOnCreate, 0, plLayRefMsg::kTexture); hsgResMgr::ResMgr()->SendRef(image->GetKey(), refMsg, plRefFlags::kActiveRef); return plLayerInterface::ConvertNoRef(layer); @@ -3243,7 +3240,7 @@ plLayerInterface *pfJournalBook::IMakeDecalLayer(pfEsHTMLChunk *decalChunk, plMi static int uniqueSuffix = 0; plString buff = plString::Format("%s_%d_d", GetKey()->GetName().c_str(), uniqueSuffix++); - plLayer* layer = TRACKED_NEW plLayer; + plLayer* layer = new plLayer; hsgResMgr::ResMgr()->NewKey(buff, layer, GetKey()->GetUoid().GetLocation()); // Initialize it. @@ -3274,16 +3271,16 @@ plLayerInterface *pfJournalBook::IMakeDecalLayer(pfEsHTMLChunk *decalChunk, plMi layer->SetUVWSrc(0); // Set up the transform. - UInt16 x,y; + uint16_t x,y; x = decalChunk->fAbsoluteX; y = decalChunk->fAbsoluteY; if((decalChunk->fFlags & pfEsHTMLChunk::kAlignMask) == pfEsHTMLChunk::kLeft) - x = (UInt16)fPageLMargin; + x = (uint16_t)fPageLMargin; else if((decalChunk->fFlags & pfEsHTMLChunk::kAlignMask) == pfEsHTMLChunk::kRight) - x = (UInt16)(baseMipmap->GetWidth() - decal->GetWidth()); + x = (uint16_t)(baseMipmap->GetWidth() - decal->GetWidth()); else if((decalChunk->fFlags & pfEsHTMLChunk::kAlignMask) == pfEsHTMLChunk::kCenter) - x = (UInt16)((baseMipmap->GetWidth() >> 1) - (decal->GetWidth() >> 1)); + x = (uint16_t)((baseMipmap->GetWidth() >> 1) - (decal->GetWidth() >> 1)); // x and y are in pixels, need to convert to a range of 0 to 1 float xRel = (float)x/(float)baseMipmap->GetWidth(); @@ -3316,7 +3313,7 @@ plLayerInterface *pfJournalBook::IMakeDecalLayer(pfEsHTMLChunk *decalChunk, plMi layer->SetTransform(xfm); // Set the texture (assumes mipmap is non-nil). - plLayRefMsg* refMsg = TRACKED_NEW plLayRefMsg(layer->GetKey(), plRefMsg::kOnCreate, 0, plLayRefMsg::kTexture); + plLayRefMsg* refMsg = new plLayRefMsg(layer->GetKey(), plRefMsg::kOnCreate, 0, plLayRefMsg::kTexture); hsgResMgr::ResMgr()->SendRef(decal->GetKey(), refMsg, plRefFlags::kActiveRef); return plLayerInterface::ConvertNoRef(layer); @@ -3328,7 +3325,7 @@ void pfJournalBook::ISetDecalLayers(hsGMaterial *material,hsTArrayGetNumLayers()-1; i >= 0; i-- ) { - plMatRefMsg* refMsg = TRACKED_NEW plMatRefMsg(material->GetKey(), plRefMsg::kOnRemove, i, plMatRefMsg::kLayer); + plMatRefMsg* refMsg = new plMatRefMsg(material->GetKey(), plRefMsg::kOnRemove, i, plMatRefMsg::kLayer); hsgResMgr::ResMgr()->SendRef(material->GetLayer(i)->GetKey(), refMsg, plRefFlags::kActiveRef); } @@ -3343,7 +3340,7 @@ void pfJournalBook::ISetDecalLayers(hsGMaterial *material,hsTArray= 0; idx-- ) { if( fHTMLSource[ idx ]->fType == pfEsHTMLChunk::kParagraph && fHTMLSource[ idx ]->fFlags != 0 ) - return (UInt8)(fHTMLSource[ idx ]->fFlags); + return (uint8_t)(fHTMLSource[ idx ]->fFlags); } return pfEsHTMLChunk::kLeft; @@ -3438,9 +3435,9 @@ UInt8 pfJournalBook::IFindLastAlignment( void ) const //// IRecalcPageStarts /////////////////////////////////////////////////////// // Ensures that all the page starts are calced up to the given page (but not including it) -void pfJournalBook::IRecalcPageStarts( UInt32 upToPage ) +void pfJournalBook::IRecalcPageStarts( uint32_t upToPage ) { - UInt32 page; + uint32_t page; // Well, sadly, we can't really calc the page starts without at least a DTMap @@ -3457,7 +3454,7 @@ void pfJournalBook::IRecalcPageStarts( UInt32 upToPage ) // actually draw them all (even in large journals), we're just going to do it IRenderPage( page, pfJournalDlgProc::kTagTurnBackDTMap, false ); // Reset any "visible" links since they aren't really visible - UInt16 i; + uint16_t i; for (i=0; ifLinkRect.Set(0,0,0,0); @@ -3468,11 +3465,11 @@ void pfJournalBook::IRecalcPageStarts( UInt32 upToPage ) //// ISendNotify ///////////////////////////////////////////////////////////// // Just sends out a notify to our currently set receiver key -void pfJournalBook::ISendNotify( UInt32 type, UInt32 linkID ) +void pfJournalBook::ISendNotify( uint32_t type, uint32_t linkID ) { if( fCallbackKey != nil ) { - plNotifyMsg *pMsg = TRACKED_NEW plNotifyMsg; + plNotifyMsg *pMsg = new plNotifyMsg; pMsg->AddBookEvent( type, linkID ); pMsg->SetBCastFlag( plMessage::kNetPropagate, false ); // don't deliver networked! pMsg->Send( fCallbackKey ); @@ -3484,7 +3481,7 @@ void pfJournalBook::ISendNotify( UInt32 type, UInt32 linkID ) // Note: internally we store these as the seek positions on our animations, // so the incoming parameters are actually inverse of what we finally want -void pfJournalBook::SetBookSize( hsScalar width, hsScalar height ) +void pfJournalBook::SetBookSize( float width, float height ) { fWidthScale = 1.f - width; fHeightScale = 1.f - height; @@ -3498,7 +3495,7 @@ void pfJournalBook::SetBookSize( hsScalar width, hsScalar height ) void pfJournalBook::ILoadAllImages( hsBool unload ) { - UInt32 i; + uint32_t i; // load the cover if( fCoverFromHTML && fCoverMipKey != nil ) @@ -3507,7 +3504,7 @@ void pfJournalBook::ILoadAllImages( hsBool unload ) fBookGUIs[fCurBookGUI]->GetKey()->Release( fCoverMipKey ); else { - plGenRefMsg *ref = TRACKED_NEW plGenRefMsg( fBookGUIs[fCurBookGUI]->GetKey(), plRefMsg::kOnCreate, -1, kRefImage ); + plGenRefMsg *ref = new plGenRefMsg( fBookGUIs[fCurBookGUI]->GetKey(), plRefMsg::kOnCreate, -1, kRefImage ); hsgResMgr::ResMgr()->AddViaNotify( fCoverMipKey, ref, plRefFlags::kActiveRef ); } } @@ -3520,7 +3517,7 @@ void pfJournalBook::ILoadAllImages( hsBool unload ) fBookGUIs[fCurBookGUI]->GetKey()->Release( fHTMLSource[ i ]->fImageKey ); else { - plGenRefMsg *ref = TRACKED_NEW plGenRefMsg( fBookGUIs[fCurBookGUI]->GetKey(), plRefMsg::kOnCreate, -1, kRefImage ); + plGenRefMsg *ref = new plGenRefMsg( fBookGUIs[fCurBookGUI]->GetKey(), plRefMsg::kOnCreate, -1, kRefImage ); hsgResMgr::ResMgr()->AddViaNotify( fHTMLSource[ i ]->fImageKey, ref, plRefFlags::kActiveRef ); } } diff --git a/Sources/Plasma/FeatureLib/pfJournalBook/pfJournalBook.h b/Sources/Plasma/FeatureLib/pfJournalBook/pfJournalBook.h index affa289a..bfc52958 100644 --- a/Sources/Plasma/FeatureLib/pfJournalBook/pfJournalBook.h +++ b/Sources/Plasma/FeatureLib/pfJournalBook/pfJournalBook.h @@ -164,7 +164,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // // ////////////////////////////////////////////////////////////////////////////// -#include "hsTypes.h" +#include "HeadSpin.h" #include "hsStlUtils.h" #include "hsTemplates.h" #include "hsColorRGBA.h" @@ -248,11 +248,11 @@ public: void CurBook(pfJournalBook *curBook) {fCurrBook = curBook;} // Quick helper - plDynamicTextMap *GetDTMap(UInt32 which); - pfGUIMultiLineEditCtrl *GetEditCtrl(UInt32 which); + plDynamicTextMap *GetDTMap(uint32_t which); + pfGUIMultiLineEditCtrl *GetEditCtrl(uint32_t which); // Seeks the width and height animations to set the desired book size. Sizes are in % across the animation - void SetCurrSize(hsScalar w, hsScalar h); + void SetCurrSize(float w, float h); // Enables or disables the left and right page corners, to indicate current turnage state void UpdatePageCorners(WhichSide which); @@ -269,8 +269,8 @@ public: // Registers (or unregisters) for time messages so we can process special FX if we need to void RegisterForSFX(WhichSide whichSides); - void HitEndOfControlList(Int32 cursorPos); - void HitBeginningOfControlList(Int32 cursorPos); + void HitEndOfControlList(int32_t cursorPos); + void HitBeginningOfControlList(int32_t cursorPos); void EnableEditGUI(hsBool enable=true); void DisableEditGUI() {EnableEditGUI(false);} @@ -317,7 +317,7 @@ protected: WhichSide fCurrSFXPages; // Base time to calc SFX anim positions from - hsScalar fBaseSFXTime; + float fBaseSFXTime; hsBool fResetSFXFlag; hsBool fSFXUpdateFlip; // So we only update alternating pages every frame, to save processor time @@ -325,13 +325,13 @@ protected: hsBool fCurrentlyTurning, fCurrentlyOpen, fStartedOpen; hsBool fEditable; - Int32 fAdjustCursorTo; + int32_t fAdjustCursorTo; // Inits our dialog template void IInitTemplate(pfGUIDialogMod *templateDlg); // Process SFX for this frame - void IHandleSFX(hsScalar currTime, WhichSide whichSide = kNoSides); + void IHandleSFX(float currTime, WhichSide whichSide = kNoSides); // Yet another step in the page flip, to make SURE we're already showing the turning page before we fill in the page behind it void IFillUncoveringPage(hsBool rightSide); @@ -403,7 +403,7 @@ class pfJournalBook : public hsKeyedObject void Hide( void ); // Opens the book, optionally to the given page - void Open( UInt32 startingPage = 0 ); + void Open( uint32_t startingPage = 0 ); // Closes the book. void Close( void ); @@ -415,7 +415,7 @@ class pfJournalBook : public hsKeyedObject void PreviousPage( void ); // For completeness... - void GoToPage( UInt32 pageNumber ); + void GoToPage( uint32_t pageNumber ); // See below. Just forces a full calc of the cached info void ForceCacheCalculations( void ); @@ -424,19 +424,19 @@ class pfJournalBook : public hsKeyedObject void CloseAndHide( void ); // Sets the book size scaling. 1,1 would be full size, 0,0 is the smallest size possible - void SetBookSize( hsScalar width, hsScalar height ); + void SetBookSize( float width, float height ); // What page are we on? - UInt32 GetCurrentPage( void ) const { return fCurrentPage; } + uint32_t GetCurrentPage( void ) const { return fCurrentPage; } // Set the margin (defaults to 16 pixels) - void SetPageMargin( UInt32 margin ) { fPageTMargin = fPageLMargin = fPageBMargin = fPageRMargin = margin; } + void SetPageMargin( uint32_t margin ) { fPageTMargin = fPageLMargin = fPageBMargin = fPageRMargin = margin; } // Turns on or off page turning void AllowPageTurning( hsBool allow ) { fAllowTurning = allow; } // grabs a certain movie based on it's index in the source file - plKey GetMovie( UInt8 index ); + plKey GetMovie( uint8_t index ); // turns on and off editing of the book void SetEditable( hsBool editable=true ); @@ -476,13 +476,13 @@ class pfJournalBook : public hsKeyedObject bool fCoverFromHTML; // Cached array of page starts in the esHTML source. Generated as we flip through // the book, so that going backwards can be done efficiently. - hsTArray fPageStarts; + hsTArray fPageStarts; // is the book done showing and ready for more page calculations hsBool fAreWeShowing; // Our current page - UInt32 fCurrentPage; + uint32_t fCurrentPage; // are we editing this book? (adjusts how we draw and flip pages) hsBool fAreEditing; @@ -491,13 +491,13 @@ class pfJournalBook : public hsKeyedObject hsBool fAllowTurning; // do we allow the user to turn pages? // The ending page. -1 until calculated by flipping to it - UInt32 fLastPage; + uint32_t fLastPage; // Per book size - hsScalar fWidthScale, fHeightScale; + float fWidthScale, fHeightScale; // Per book margin around the edge (defaults to 16 pixels) - UInt32 fPageTMargin, fPageLMargin, fPageBMargin, fPageRMargin; + uint32_t fPageTMargin, fPageLMargin, fPageBMargin, fPageRMargin; // Some animation keys we use plKey fPageTurnAnimKey; @@ -520,30 +520,30 @@ class pfJournalBook : public hsKeyedObject void IFreeSource( void ); // Compile helpers - UInt8 IGetTagType( const wchar_t *string ); + uint8_t IGetTagType( const wchar_t *string ); hsBool IGetNextOption( const wchar_t *&string, wchar_t *name, wchar_t *option ); plKey IGetMipmapKey( const wchar_t *name, const plLocation &loc ); // Renders one (1) page into the given DTMap - void IRenderPage( UInt32 page, UInt32 whichDTMap, hsBool suppressRendering = false ); + void IRenderPage( uint32_t page, uint32_t whichDTMap, hsBool suppressRendering = false ); // moves the movie layers from one material onto another void IMoveMovies( hsGMaterial *source, hsGMaterial *dest); // Starting at the given chunk, works backwards to determine the full set of current // font properties at that point, or assigns defaults if none were specified - void IFindFontProps( UInt32 chunkIdx, const wchar_t *&face, UInt8 &size, UInt8 &flags, hsColorRGBA &color, Int16 &spacing ); + void IFindFontProps( uint32_t chunkIdx, const wchar_t *&face, uint8_t &size, uint8_t &flags, hsColorRGBA &color, int16_t &spacing ); // Find the last paragraph chunk and thus the last par alignment settings - UInt8 IFindLastAlignment( void ) const; + uint8_t IFindLastAlignment( void ) const; // Handle clicks on either side of the book void IHandleLeftSideClick( void ); void IHandleRightSideClick( void ); // Just sends out a notify to our currently set receiver key - void ISendNotify( UInt32 type, UInt32 linkID = 0 ); + void ISendNotify( uint32_t type, uint32_t linkID = 0 ); // Close with a notify void ITriggerCloseWithNotify( hsBool closeNotOpen, hsBool immediate ); @@ -552,10 +552,10 @@ class pfJournalBook : public hsKeyedObject void IFinishShow( hsBool startOpened ); // Find the current moused link, if any - Int32 IFindCurrVisibleLink( hsBool rightNotLeft, hsBool hoverNotUp ); + int32_t IFindCurrVisibleLink( hsBool rightNotLeft, hsBool hoverNotUp ); // Ensures that all the page starts are calced up to the given page (but not including it) - void IRecalcPageStarts( UInt32 upToPage ); + void IRecalcPageStarts( uint32_t upToPage ); // Load (or unload) all the images for the book void ILoadAllImages( hsBool unload ); @@ -564,15 +564,15 @@ class pfJournalBook : public hsKeyedObject void IPurgeDynaTextMaps( ); // Process a click on the given "check box" image - void IHandleCheckClick( UInt32 idx, pfBookData::WhichSide which ); + void IHandleCheckClick( uint32_t idx, pfBookData::WhichSide which ); // Draw me an image! - void IDrawMipmap( pfEsHTMLChunk *chunk, UInt16 x, UInt16 y, plMipmap *mip, plDynamicTextMap *dtMap, UInt32 whichDTMap, hsBool dontRender ); + void IDrawMipmap( pfEsHTMLChunk *chunk, uint16_t x, uint16_t y, plMipmap *mip, plDynamicTextMap *dtMap, uint32_t whichDTMap, hsBool dontRender ); // Movie functions loadedMovie *IMovieAlreadyLoaded(pfEsHTMLChunk *chunk); - loadedMovie *IGetMovieByIndex(UInt8 index); - plLayerBink *IMakeMovieLayer(pfEsHTMLChunk *chunk, UInt16 x, UInt16 y, plMipmap *baseMipmap, UInt32 whichDTMap, hsBool dontRender); + loadedMovie *IGetMovieByIndex(uint8_t index); + plLayerBink *IMakeMovieLayer(pfEsHTMLChunk *chunk, uint16_t x, uint16_t y, plMipmap *baseMipmap, uint32_t whichDTMap, hsBool dontRender); // Cover functions plLayerInterface *IMakeBaseLayer(plMipmap *image); diff --git a/Sources/Plasma/FeatureLib/pfKI/pfKI.cpp b/Sources/Plasma/FeatureLib/pfKI/pfKI.cpp index 8ba90809..3e69c83e 100644 --- a/Sources/Plasma/FeatureLib/pfKI/pfKI.cpp +++ b/Sources/Plasma/FeatureLib/pfKI/pfKI.cpp @@ -102,7 +102,7 @@ class plKIYesNoBox : public pfGUIDialogProc protected: pfGUICtrlProcObject *fCBProc; - UInt32 fNoCBValue, fYesCBValue; + uint32_t fNoCBValue, fYesCBValue; public: @@ -110,7 +110,7 @@ class plKIYesNoBox : public pfGUIDialogProc virtual void DoSomething( pfGUIControlMod *ctrl ) { - UInt32 cbValue = 0; + uint32_t cbValue = 0; if( ctrl->GetTagID() == kKIYesBtn ) { @@ -133,7 +133,7 @@ class plKIYesNoBox : public pfGUIDialogProc ctrl->SetText( msg ); } - void Ask( const char *msg, pfGUICtrlProcObject *callbackProc, UInt32 noCBValue, UInt32 yesCBValue ) + void Ask( const char *msg, pfGUICtrlProcObject *callbackProc, uint32_t noCBValue, uint32_t yesCBValue ) { SetMessage( msg ); fCBProc = callbackProc; @@ -232,7 +232,7 @@ class plKIMainProc : public pfGUIDialogProc virtual void DoSomething( pfGUIControlMod *ctrl ); virtual void OnHide( void ); - virtual void UserCallback( UInt32 userValue ); + virtual void UserCallback( uint32_t userValue ); virtual void OnInit( void ); virtual void OnShow( void ); @@ -433,7 +433,7 @@ void plKIMainProc::OnHide( void ) plBlackBarProc::ClearKIButtons(); } -void plKIMainProc::UserCallback( UInt32 userValue ) +void plKIMainProc::UserCallback( uint32_t userValue ) { if( userValue == 1 ) { @@ -456,7 +456,7 @@ void plKIMainProc::OnShow( void ) void plKIMainProc::GrabVaultFolder( void ) { - Int16 sel = -1; + int16_t sel = -1; plKI *kiVault = plNetClientMgr::GetInstance()->GetPlayerKI(); @@ -470,7 +470,7 @@ void plKIMainProc::GrabVaultFolder( void ) plKIFolderVec * folders = kiVault->GetFolders(); for( plKIFolderVec::const_iterator folderIter = folders->begin(); folderIter != folders->end(); ++folderIter ) { - UInt16 id = listsList->AddElement( new pfKIListItemElement( *folderIter ) ); + uint16_t id = listsList->AddElement( new pfKIListItemElement( *folderIter ) ); if( *folderIter == fKIFolder ) sel = id; } @@ -542,7 +542,7 @@ class pfKIChatElement : public pfGUIListElement plKITextNoteElement *fDataItem; hsColorRGBA fTextColor; char *fString; - UInt32 fFlags; + uint32_t fFlags; public: @@ -557,7 +557,7 @@ class pfKIChatElement : public pfGUIListElement sprintf( fString, "%s: %s", source->GetTitle(), source->GetText() ); } - pfKIChatElement( const char *user, const char *msg, UInt32 flags ) : pfGUIListElement( 0 ) + pfKIChatElement( const char *user, const char *msg, uint32_t flags ) : pfGUIListElement( 0 ) { fDataItem = nil; fFlags = flags; @@ -582,7 +582,7 @@ class pfKIChatElement : public pfGUIListElement virtual ~pfKIChatElement() { delete [] fString; } - virtual void Draw( plDynamicTextMap *textGen, UInt16 x, UInt16 y, UInt16 maxWidth, UInt16 maxHeight ) + virtual void Draw( plDynamicTextMap *textGen, uint16_t x, uint16_t y, uint16_t maxWidth, uint16_t maxHeight ) { if( fFlags & kHackFlagLocalMsg ) fTextColor.a = fColors->fSelForeColor.a; @@ -594,7 +594,7 @@ class pfKIChatElement : public pfGUIListElement textGen->DrawWrappedString( x + 2, y, fString, maxWidth - 4, maxHeight ); } - virtual void GetSize( plDynamicTextMap *textGen, UInt16 *width, UInt16 *height ) + virtual void GetSize( plDynamicTextMap *textGen, uint16_t *width, uint16_t *height ) { *width = textGen->GetVisibleWidth() - 4; textGen->CalcWrappedStringSize( fString, width, height ); @@ -840,7 +840,7 @@ class plKIMiniProc : public pfGUIDialogProc } } - virtual void HandleExtendedEvent( pfGUIControlMod *ctrl, UInt32 event ) + virtual void HandleExtendedEvent( pfGUIControlMod *ctrl, uint32_t event ) { // The only controls that will trigger a HandleExtendedEvent() are the ones that we want // to have force the text to show @@ -922,7 +922,7 @@ class plKIMiniProc : public pfGUIDialogProc fChatList->ScrollToBegin(); } */ - void ReceivedChatItem( const char *user, const char *msg, UInt32 flags ) + void ReceivedChatItem( const char *user, const char *msg, uint32_t flags ) { if( fChatList == nil ) return; @@ -952,7 +952,7 @@ class plKIMiniProc : public pfGUIDialogProc pfGUIListBoxMod *userList = pfGUIListBoxMod::ConvertNoRef( fDialog->GetControlFromTag( kKITempID_PlayerList ) ); pfKIListPlayerItem *currPlayer = nil; int mbrIndex = -1; - UInt32 msgFlags; + uint32_t msgFlags; if( userList != nil && userList->GetNumElements() > 0 && userList->GetSelection() != -1 ) currPlayer = (pfKIListPlayerItem *)userList->GetElement( userList->GetSelection() ); diff --git a/Sources/Plasma/FeatureLib/pfKI/pfKI.h b/Sources/Plasma/FeatureLib/pfKI/pfKI.h index 11359c3c..d4d38c7b 100644 --- a/Sources/Plasma/FeatureLib/pfKI/pfKI.h +++ b/Sources/Plasma/FeatureLib/pfKI/pfKI.h @@ -48,7 +48,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #ifndef _pfKI_h #define _pfKI_h -#include "hsTypes.h" +#include "HeadSpin.h" #include "../pnKeyedObject/hsKeyedObject.h" diff --git a/Sources/Plasma/FeatureLib/pfKI/pfPlayerBookMod.cpp b/Sources/Plasma/FeatureLib/pfKI/pfPlayerBookMod.cpp index 7929f0e7..10b14339 100644 --- a/Sources/Plasma/FeatureLib/pfKI/pfPlayerBookMod.cpp +++ b/Sources/Plasma/FeatureLib/pfKI/pfPlayerBookMod.cpp @@ -45,7 +45,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // // ////////////////////////////////////////////////////////////////////////////// -#include "hsTypes.h" +#include "HeadSpin.h" #include "pfPlayerBookMod.h" #include "../pfGameGUIMgr/pfGameGUIMgr.h" #include "../pfGameGUIMgr/pfGUIButtonMod.h" @@ -81,7 +81,7 @@ pfPlayerBookMod::~pfPlayerBookMod() //// IEval /////////////////////////////////////////////////////////////////// -hsBool pfPlayerBookMod::IEval( double secs, hsScalar del, UInt32 dirty ) +hsBool pfPlayerBookMod::IEval( double secs, hsScalar del, uint32_t dirty ) { return false; } diff --git a/Sources/Plasma/FeatureLib/pfKI/pfPlayerBookMod.h b/Sources/Plasma/FeatureLib/pfKI/pfPlayerBookMod.h index d186c61f..89ffe1f5 100644 --- a/Sources/Plasma/FeatureLib/pfKI/pfPlayerBookMod.h +++ b/Sources/Plasma/FeatureLib/pfKI/pfPlayerBookMod.h @@ -79,7 +79,7 @@ class pfPlayerBookMod : public plSingleModifier kRefSaveButton }; - virtual hsBool IEval( double secs, hsScalar del, UInt32 dirty ); // called only by owner object's Eval() + virtual hsBool IEval( double secs, hsScalar del, uint32_t dirty ); // called only by owner object's Eval() public: diff --git a/Sources/Plasma/FeatureLib/pfLocalizationMgr/pfLocalizationDataMgr.cpp b/Sources/Plasma/FeatureLib/pfLocalizationMgr/pfLocalizationDataMgr.cpp index d1ccd693..f1cf30d1 100644 --- a/Sources/Plasma/FeatureLib/pfLocalizationMgr/pfLocalizationDataMgr.cpp +++ b/Sources/Plasma/FeatureLib/pfLocalizationMgr/pfLocalizationDataMgr.cpp @@ -46,8 +46,8 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // ////////////////////////////////////////////////////////////////////// -#include "hsTypes.h" -#include "hsUtils.h" +#include "HeadSpin.h" + #include "plResMgr/plLocalization.h" #include "plFile/hsFiles.h" @@ -155,15 +155,15 @@ struct LocAgeInfo ////////////////////////////////////////////////////////////////////// static void * XMLCALL XmlMalloc (size_t size) { - return ALLOC(size); + return malloc(size); } static void * XMLCALL XmlRealloc (void * ptr, size_t size) { - return REALLOC(ptr, size); + return realloc(ptr, size); } static void XMLCALL XmlFree (void * ptr) { - FREE(ptr); + free(ptr); } XML_Memory_Handling_Suite gHeapAllocator = { @@ -939,13 +939,13 @@ std::vector pfLocalizationDataMgr::IGetAllLanguageNames() void pfLocalizationDataMgr::IConvertElement(LocElementInfo *elementInfo, const std::wstring & curPath) { pfLocalizationDataMgr::localizedElement newElement; - Int16 numArgs = -1; + int16_t numArgs = -1; LocalizationXMLFile::element::iterator curTranslation; for (curTranslation = elementInfo->fElement.begin(); curTranslation != elementInfo->fElement.end(); curTranslation++) { newElement[curTranslation->first].FromXML(curTranslation->second); - UInt16 argCount = newElement[curTranslation->first].GetArgumentCount(); + uint16_t argCount = newElement[curTranslation->first].GetArgumentCount(); if (numArgs == -1) // just started numArgs = argCount; else if (argCount != numArgs) @@ -990,24 +990,24 @@ void pfLocalizationDataMgr::IConvertAge(LocAgeInfo *ageInfo, const std::wstring //// IConvertToByteStream //////////////////////////////////////////// -char *pfLocalizationDataMgr::IConvertToByteStream(const std::wstring & data, UInt32 &len) +char *pfLocalizationDataMgr::IConvertToByteStream(const std::wstring & data, uint32_t &len) { len = data.length() * 2 + 2; // each wchar_t is two chars and add two bytes for the header - char *retVal = TRACKED_NEW char[len]; // we don't add an extra byte for the 0 because the parser doesn't need it - char lowbyte = 0, highbyte = 0; + char *retVal = new char[len]; // we don't add an extra byte for the 0 because the parser doesn't need it + char lowByte = 0, highByte = 0; retVal[0] = (char)0xFF; // insert FFFE for little-endian UTF-16 (big-endian would be FEFF) retVal[1] = (char)0xFE; int curByteStreamPos = 2; for (int curLoc = 0; curLoc < data.length(); curLoc++) { wchar_t curChar = data[curLoc]; - lowbyte = (char)(curChar & 0x00FF); - highbyte = (char)((curChar & 0xFF00) >> 8); + lowByte = (char)(curChar & 0x00FF); + highByte = (char)((curChar & 0xFF00) >> 8); - // since the data is AABBCCDD, we need to put in in our byte stream as BBAADDCC + // since the data is AABBCCDD, we need to put in in our uint8_t stream as BBAADDCC // (so it kinda looks backward because we're storing this as little-endian) - retVal[curByteStreamPos + 1] = highbyte; - retVal[curByteStreamPos] = lowbyte; + retVal[curByteStreamPos + 1] = highByte; + retVal[curByteStreamPos] = lowByte; curByteStreamPos += 2; } return retVal; @@ -1063,7 +1063,7 @@ void pfLocalizationDataMgr::IWriteText(const std::string & filename, const std:: if (weWroteData) { // now spit the results out to the file - UInt32 numBytes; + uint32_t numBytes; char *byteStream = IConvertToByteStream(fileData, numBytes); hsStream *xmlStream = plEncryptedStream::OpenEncryptedFileWrite(filename.c_str()); xmlStream->Write(numBytes, byteStream); @@ -1080,7 +1080,7 @@ void pfLocalizationDataMgr::Initialize(const std::string & path) if (fInstance) return; - fInstance = TRACKED_NEW pfLocalizationDataMgr(path); + fInstance = new pfLocalizationDataMgr(path); fLog = plStatusLogMgr::GetInstance().CreateStatusLog(30, "LocalizationDataMgr.log", plStatusLog::kFilledBackground | plStatusLog::kAlignToTop | plStatusLog::kTimestamp); fInstance->SetupData(); @@ -1110,7 +1110,7 @@ void pfLocalizationDataMgr::SetupData() if (fDatabase) delete fDatabase; - fDatabase = TRACKED_NEW LocalizationDatabase(); + fDatabase = new LocalizationDatabase(); fDatabase->Parse(fDataPath); char *temp = hsWStringToString(fDatabase->GetOutput().c_str()); diff --git a/Sources/Plasma/FeatureLib/pfLocalizationMgr/pfLocalizationDataMgr.h b/Sources/Plasma/FeatureLib/pfLocalizationMgr/pfLocalizationDataMgr.h index 99923436..83a41512 100644 --- a/Sources/Plasma/FeatureLib/pfLocalizationMgr/pfLocalizationDataMgr.h +++ b/Sources/Plasma/FeatureLib/pfLocalizationMgr/pfLocalizationDataMgr.h @@ -49,7 +49,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #ifndef _pfLocalizationDataMgr_h #define _pfLocalizationDataMgr_h -#include "hsTypes.h" +#include "HeadSpin.h" #include "hsStlUtils.h" #include "pfLocalizedString.h" @@ -113,7 +113,7 @@ protected: void IConvertSet(LocSetInfo *setInfo, const std::wstring & curPath); void IConvertAge(LocAgeInfo *ageInfo, const std::wstring & curPath); - char *IConvertToByteStream(const std::wstring & data, UInt32 &len); // converts the wstring data to a string of bytes for file writing + char *IConvertToByteStream(const std::wstring & data, uint32_t &len); // converts the wstring data to a string of bytes for file writing void IWriteText(const std::string & filename, const std::wstring & ageName, const std::wstring & languageName); // Write localization text to the specified file pfLocalizationDataMgr(const std::string & path); diff --git a/Sources/Plasma/FeatureLib/pfLocalizationMgr/pfLocalizationMgr.cpp b/Sources/Plasma/FeatureLib/pfLocalizationMgr/pfLocalizationMgr.cpp index 53117446..a91eaa89 100644 --- a/Sources/Plasma/FeatureLib/pfLocalizationMgr/pfLocalizationMgr.cpp +++ b/Sources/Plasma/FeatureLib/pfLocalizationMgr/pfLocalizationMgr.cpp @@ -46,7 +46,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // ////////////////////////////////////////////////////////////////////// -#include "hsTypes.h" +#include "HeadSpin.h" #include "pfLocalizedString.h" #include "pfLocalizationDataMgr.h" @@ -78,7 +78,7 @@ void pfLocalizationMgr::Initialize(const std::string & dataPath) if (fInstance) return; - fInstance = TRACKED_NEW pfLocalizationMgr(); + fInstance = new pfLocalizationMgr(); pfLocalizationDataMgr::Initialize(dataPath); // set up the data manager } diff --git a/Sources/Plasma/FeatureLib/pfLocalizationMgr/pfLocalizationMgr.h b/Sources/Plasma/FeatureLib/pfLocalizationMgr/pfLocalizationMgr.h index f6528f2c..889b4ba9 100644 --- a/Sources/Plasma/FeatureLib/pfLocalizationMgr/pfLocalizationMgr.h +++ b/Sources/Plasma/FeatureLib/pfLocalizationMgr/pfLocalizationMgr.h @@ -49,7 +49,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #ifndef _pfLocalizationMgr_h #define _pfLocalizationMgr_h -#include "hsTypes.h" +#include "HeadSpin.h" #include "hsStlUtils.h" class pfLocalizationMgr diff --git a/Sources/Plasma/FeatureLib/pfLocalizationMgr/pfLocalizedString.cpp b/Sources/Plasma/FeatureLib/pfLocalizationMgr/pfLocalizedString.cpp index e560c3c9..ccf6ece6 100644 --- a/Sources/Plasma/FeatureLib/pfLocalizationMgr/pfLocalizedString.cpp +++ b/Sources/Plasma/FeatureLib/pfLocalizationMgr/pfLocalizedString.cpp @@ -47,8 +47,8 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // ////////////////////////////////////////////////////////////////////// -#include "hsTypes.h" -#include "hsUtils.h" +#include "HeadSpin.h" + #include "pfLocalizedString.h" @@ -131,7 +131,7 @@ void pfLocalizedString::IConvertFromPlainText(const std::wstring & plainText) curTextBlock.fText = L""; std::wstring number = plainText.substr(curIndex + 1, (endArgPos - (curIndex + 1))); - curTextBlock.fParamIndex = (UInt8)wcstol(number.c_str(), NULL, 10) - 1; // args are 1-based, vectors are 0-based + curTextBlock.fParamIndex = (uint8_t)wcstol(number.c_str(), NULL, 10) - 1; // args are 1-based, vectors are 0-based fText.push_back(curTextBlock); curTextBlock.fIsParam = false; @@ -240,7 +240,7 @@ void pfLocalizedString::IConvertFromXML(const std::wstring & xml) curTextBlock.fText = L""; std::wstring number = xml.substr(curIndex + 1, (endArgPos - (curIndex + 1))); - curTextBlock.fParamIndex = (UInt8)wcstol(number.c_str(), nil, 10) - 1; // args are 1-based, vectors are 0-based + curTextBlock.fParamIndex = (uint8_t)wcstol(number.c_str(), nil, 10) - 1; // args are 1-based, vectors are 0-based fText.push_back(curTextBlock); curTextBlock.fIsParam = false; diff --git a/Sources/Plasma/FeatureLib/pfLocalizationMgr/pfLocalizedString.h b/Sources/Plasma/FeatureLib/pfLocalizationMgr/pfLocalizedString.h index 8b031de7..5448d3d0 100644 --- a/Sources/Plasma/FeatureLib/pfLocalizationMgr/pfLocalizedString.h +++ b/Sources/Plasma/FeatureLib/pfLocalizationMgr/pfLocalizedString.h @@ -50,7 +50,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #ifndef _pfLocalizedString_h #define _pfLocalizedString_h -#include "hsTypes.h" +#include "HeadSpin.h" #include "hsStlUtils.h" @@ -67,7 +67,7 @@ protected: { bool fIsParam; // if true, then this is a parameter, not a string std::wstring fText; - UInt8 fParamIndex; + uint8_t fParamIndex; textBlock() : fIsParam(false), fParamIndex(0) {} }; @@ -75,7 +75,7 @@ protected: std::vector fText; // the individual text elements that make up this string std::wstring fXMLRep; // the XML representation of this string std::wstring fPlainTextRep; // the plain text representation of this string - UInt16 fNumArguments; // number of arguments this string has + uint16_t fNumArguments; // number of arguments this string has void IConvertFromPlainText(const std::wstring & plainText); void IUpdatePlainText(); // from the internal representation @@ -91,7 +91,7 @@ public: void FromXML(const std::wstring & xml); std::wstring ToXML() {return fXMLRep;} - UInt16 GetArgumentCount() {return fNumArguments;} + uint16_t GetArgumentCount() {return fNumArguments;} // Various operators, they all work pretty much the same as the standard string or wstring operators // but note that the all work on the plain text representation (not the XML representation) diff --git a/Sources/Plasma/FeatureLib/pfMessage/pfBackdoorMsg.h b/Sources/Plasma/FeatureLib/pfMessage/pfBackdoorMsg.h index b06d86b1..836eecd0 100644 --- a/Sources/Plasma/FeatureLib/pfMessage/pfBackdoorMsg.h +++ b/Sources/Plasma/FeatureLib/pfMessage/pfBackdoorMsg.h @@ -48,7 +48,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #ifndef _pfBackdoorMsg_h #define _pfBackdoorMsg_h -#include "hsTypes.h" +#include "HeadSpin.h" #include "hsStream.h" #include "pnMessage/plMessage.h" diff --git a/Sources/Plasma/FeatureLib/pfMessage/pfGUINotifyMsg.h b/Sources/Plasma/FeatureLib/pfMessage/pfGUINotifyMsg.h index 826b4372..82afa406 100644 --- a/Sources/Plasma/FeatureLib/pfMessage/pfGUINotifyMsg.h +++ b/Sources/Plasma/FeatureLib/pfMessage/pfGUINotifyMsg.h @@ -45,7 +45,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "pnMessage/plMessage.h" #include "hsResMgr.h" #include "pnModifier/plSingleModifier.h" -#include "hsUtils.h" +#include "HeadSpin.h" @@ -62,7 +62,7 @@ class pfGUINotifyMsg : public plMessage { protected: plKey fControlKey; // who start this mess - UInt32 fEvent; // what was the event that happened + uint32_t fEvent; // what was the event that happened public: pfGUINotifyMsg() : plMessage() {} @@ -112,14 +112,14 @@ public: // kTextBox // kDragBar - void SetEvent( plKey &key, UInt32 event) + void SetEvent( plKey &key, uint32_t event) { fControlKey = key; fEvent = event; } plKey GetControlKey() { return fControlKey; } - UInt32 GetEvent() { return fEvent; } + uint32_t GetEvent() { return fEvent; } // IO void Read(hsStream* stream, hsResMgr* mgr) diff --git a/Sources/Plasma/FeatureLib/pfMessage/pfGameGUIMsg.h b/Sources/Plasma/FeatureLib/pfMessage/pfGameGUIMsg.h index 9b6c8edf..cac66bd8 100644 --- a/Sources/Plasma/FeatureLib/pfMessage/pfGameGUIMsg.h +++ b/Sources/Plasma/FeatureLib/pfMessage/pfGameGUIMsg.h @@ -48,7 +48,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #ifndef _pfGameGUIMsg_h #define _pfGameGUIMsg_h -#include "hsTypes.h" +#include "HeadSpin.h" #include "hsStream.h" #include "pnMessage/plMessage.h" @@ -56,7 +56,7 @@ class pfGameGUIMsg : public plMessage { protected: - UInt8 fCommand; + uint8_t fCommand; char fString[ 128 ]; char *fAge; @@ -69,7 +69,7 @@ class pfGameGUIMsg : public plMessage }; pfGameGUIMsg() : plMessage( nil, nil, nil ) { SetBCastFlag( kBCastByExactType ); fAge = nil; } - pfGameGUIMsg( plKey &receiver, UInt8 command ) : plMessage( nil, nil, nil ) { AddReceiver( receiver ); fCommand = command; fAge = nil; } + pfGameGUIMsg( plKey &receiver, uint8_t command ) : plMessage( nil, nil, nil ) { AddReceiver( receiver ); fCommand = command; fAge = nil; } ~pfGameGUIMsg() { delete [] fAge; } CLASSNAME_REGISTER( pfGameGUIMsg ); @@ -91,7 +91,7 @@ class pfGameGUIMsg : public plMessage s->WriteSafeString( fAge ); } - UInt8 GetCommand( void ) { return fCommand; } + uint8_t GetCommand( void ) { return fCommand; } void SetString( const char *str ) { hsStrncpy( fString, str, sizeof( fString ) - 1 ); } const char *GetString( void ) { return fString; } diff --git a/Sources/Plasma/FeatureLib/pfMessage/pfKIMsg.h b/Sources/Plasma/FeatureLib/pfMessage/pfKIMsg.h index 737c1e53..190dcdd4 100644 --- a/Sources/Plasma/FeatureLib/pfMessage/pfKIMsg.h +++ b/Sources/Plasma/FeatureLib/pfMessage/pfKIMsg.h @@ -48,7 +48,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #ifndef _pfKIMsg_h #define _pfKIMsg_h -#include "hsTypes.h" +#include "HeadSpin.h" #include "hsStlUtils.h" #include "hsStream.h" #include "pnMessage/plMessage.h" @@ -61,19 +61,19 @@ class pfKIMsg : public plMessage #ifndef KI_CONSTANTS_ONLY protected: - UInt8 fCommand; - UInt32 fFlags; + uint8_t fCommand; + uint32_t fFlags; // for the hack chat message thingy char *fUser; - UInt32 fPlayerID; + uint32_t fPlayerID; std::wstring fString; // for the SetChatFadeDelay - hsScalar fDelay; + float fDelay; // other values - Int32 fValue; + int32_t fValue; void IInit() { @@ -179,8 +179,8 @@ class pfKIMsg : public plMessage #ifndef KI_CONSTANTS_ONLY pfKIMsg() : plMessage( nil, nil, nil ) { SetBCastFlag( kBCastByExactType ); IInit(); } - pfKIMsg( UInt8 command ) : plMessage( nil, nil, nil ) { SetBCastFlag( kBCastByExactType ); IInit(); fCommand = command; } - pfKIMsg( plKey &receiver, UInt8 command ) : plMessage( nil, nil, nil ) { AddReceiver( receiver ); IInit(); fCommand = command; } + pfKIMsg( uint8_t command ) : plMessage( nil, nil, nil ) { SetBCastFlag( kBCastByExactType ); IInit(); fCommand = command; } + pfKIMsg( plKey &receiver, uint8_t command ) : plMessage( nil, nil, nil ) { AddReceiver( receiver ); IInit(); fCommand = command; } ~pfKIMsg() { delete [] fUser; } CLASSNAME_REGISTER( pfKIMsg ); @@ -217,25 +217,25 @@ class pfKIMsg : public plMessage s->WriteLE32( fValue ); } - UInt8 GetCommand( void ) const { return fCommand; } + uint8_t GetCommand( void ) const { return fCommand; } void SetString( const char *str ); void SetString( const wchar_t *str ) { fString = str; } std::string GetString( void ); std::wstring GetStringU( void ) { return fString; } - void SetUser( const char *str, UInt32 pid=0 ) { fUser = hsStrcpy( str ); fPlayerID = pid; } + void SetUser( const char *str, uint32_t pid=0 ) { fUser = hsStrcpy( str ); fPlayerID = pid; } const char *GetUser( void ) { return fUser; } - UInt32 GetPlayerID( void ) { return fPlayerID; } + uint32_t GetPlayerID( void ) { return fPlayerID; } - void SetFlags( UInt32 flags ) { fFlags = flags; } - UInt32 GetFlags( void ) const { return fFlags; } + void SetFlags( uint32_t flags ) { fFlags = flags; } + uint32_t GetFlags( void ) const { return fFlags; } - void SetDelay( hsScalar delay ) { fDelay = delay; } - hsScalar GetDelay( void ) { return fDelay; } + void SetDelay( float delay ) { fDelay = delay; } + float GetDelay( void ) { return fDelay; } - void SetIntValue( Int32 value ) { fValue = value; } - Int32 GetIntValue( void ) { return fValue; } + void SetIntValue( int32_t value ) { fValue = value; } + int32_t GetIntValue( void ) { return fValue; } #endif // def KI_CONSTANTS_ONLY }; diff --git a/Sources/Plasma/FeatureLib/pfMessage/pfMarkerMsg.h b/Sources/Plasma/FeatureLib/pfMessage/pfMarkerMsg.h index 965ca56e..858b1de5 100644 --- a/Sources/Plasma/FeatureLib/pfMessage/pfMarkerMsg.h +++ b/Sources/Plasma/FeatureLib/pfMessage/pfMarkerMsg.h @@ -56,7 +56,7 @@ public: }; Type fType; - UInt32 fMarkerID; + uint32_t fMarkerID; pfMarkerMsg(); virtual ~pfMarkerMsg(); diff --git a/Sources/Plasma/FeatureLib/pfMessage/plArmatureEffectMsg.h b/Sources/Plasma/FeatureLib/pfMessage/plArmatureEffectMsg.h index c93a4eea..b3017136 100644 --- a/Sources/Plasma/FeatureLib/pfMessage/plArmatureEffectMsg.h +++ b/Sources/Plasma/FeatureLib/pfMessage/plArmatureEffectMsg.h @@ -48,7 +48,7 @@ class plArmatureEffectMsg : public plEventCallbackMsg { public: plArmatureEffectMsg() : plEventCallbackMsg(), fTriggerIdx(-1) {} - plArmatureEffectMsg(const plKey &receiver, CallbackEvent e, int idx=0, hsScalar t=0, Int16 repeats=-1, UInt16 user=0) : + plArmatureEffectMsg(const plKey &receiver, CallbackEvent e, int idx=0, float t=0, int16_t repeats=-1, uint16_t user=0) : plEventCallbackMsg(receiver, e, idx, t, repeats, user), fTriggerIdx(-1) {} CLASSNAME_REGISTER( plArmatureEffectMsg ); @@ -58,7 +58,7 @@ public: void Read(hsStream* stream, hsResMgr* mgr) {} void Write(hsStream* stream, hsResMgr* mgr) {} - Int8 fTriggerIdx; + int8_t fTriggerIdx; }; class plArmatureEffectStateMsg : public plMessage @@ -73,7 +73,7 @@ public: virtual void Read(hsStream* stream, hsResMgr* mgr); virtual void Write(hsStream* stream, hsResMgr* mgr); - Int8 fSurface; + int8_t fSurface; hsBool fAddSurface; }; diff --git a/Sources/Plasma/FeatureLib/pfMessage/plClothingMsg.h b/Sources/Plasma/FeatureLib/pfMessage/plClothingMsg.h index a8596c6c..e71a2428 100644 --- a/Sources/Plasma/FeatureLib/pfMessage/plClothingMsg.h +++ b/Sources/Plasma/FeatureLib/pfMessage/plClothingMsg.h @@ -51,14 +51,14 @@ class hsResMgr; class plClothingMsg : public plMessage { protected: - UInt32 fCommands; + uint32_t fCommands; public: plKey fItemKey; hsColorRGBA fColor; - UInt8 fLayer; - UInt8 fDelta; - hsScalar fWeight; + uint8_t fLayer; + uint8_t fDelta; + float fWeight; plClothingMsg() : fCommands(0), fItemKey(nil), fLayer(0), fDelta(0), fWeight(0) { fColor.Set(1.f, 1.f, 1.f, 1.f); } ~plClothingMsg() {} @@ -79,8 +79,8 @@ public: kSaveCustomizations = 0x0100, }; - hsBool GetCommand(UInt32 command) { return fCommands & command; } - void AddCommand(UInt32 command) { fCommands |= command; } + hsBool GetCommand(uint32_t command) { return fCommands & command; } + void AddCommand(uint32_t command) { fCommands |= command; } hsBool ResendUpdate() { return fCommands != kUpdateTexture; } // IO @@ -97,10 +97,10 @@ class plElementRefMsg : public plGenRefMsg { public: char *fElementName; - UInt32 fLayer; + uint32_t fLayer; plElementRefMsg() : plGenRefMsg(), fElementName(nil), fLayer(1) {} - plElementRefMsg(const plKey &r, UInt8 c, int which, int type, char *name, UInt8 layer) : plGenRefMsg(r, c, which, type) + plElementRefMsg(const plKey &r, uint8_t c, int which, int type, char *name, uint8_t layer) : plGenRefMsg(r, c, which, type) { fLayer = layer; fElementName = hsStrcpy(name); diff --git a/Sources/Plasma/FeatureLib/pfPython/Games/BlueSpiral/pyBlueSpiralGameGlue.cpp b/Sources/Plasma/FeatureLib/pfPython/Games/BlueSpiral/pyBlueSpiralGameGlue.cpp index 148c1374..579777ca 100644 --- a/Sources/Plasma/FeatureLib/pfPython/Games/BlueSpiral/pyBlueSpiralGameGlue.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/Games/BlueSpiral/pyBlueSpiralGameGlue.cpp @@ -67,7 +67,7 @@ PYTHON_GLOBAL_METHOD_DEFINITION(PtIsBlueSpiralGame, args, "Params: typeID\nRetur if (PyUnicode_Check(textObj)) { int strLen = PyUnicode_GetSize(textObj); - wchar_t* text = TRACKED_NEW wchar_t[strLen + 1]; + wchar_t* text = new wchar_t[strLen + 1]; PyUnicode_AsWideChar((PyUnicodeObject*)textObj, text, strLen); text[strLen] = L'\0'; bool retVal = pyBlueSpiralGame::IsBlueSpiralGame(text); diff --git a/Sources/Plasma/FeatureLib/pfPython/Games/ClimbingWall/pyClimbingWallGameGlue.cpp b/Sources/Plasma/FeatureLib/pfPython/Games/ClimbingWall/pyClimbingWallGameGlue.cpp index 0faa1734..a364f59c 100644 --- a/Sources/Plasma/FeatureLib/pfPython/Games/ClimbingWall/pyClimbingWallGameGlue.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/Games/ClimbingWall/pyClimbingWallGameGlue.cpp @@ -67,7 +67,7 @@ PYTHON_GLOBAL_METHOD_DEFINITION(PtIsClimbingWallGame, args, "Params: typeID\nRet if (PyUnicode_Check(textObj)) { int strLen = PyUnicode_GetSize(textObj); - wchar_t* text = TRACKED_NEW wchar_t[strLen + 1]; + wchar_t* text = new wchar_t[strLen + 1]; PyUnicode_AsWideChar((PyUnicodeObject*)textObj, text, strLen); text[strLen] = L'\0'; bool retVal = pyClimbingWallGame::IsClimbingWallGame(text); diff --git a/Sources/Plasma/FeatureLib/pfPython/Games/Heek/pyHeekGame.cpp b/Sources/Plasma/FeatureLib/pfPython/Games/Heek/pyHeekGame.cpp index 3c6a0f9e..f8e74a8f 100644 --- a/Sources/Plasma/FeatureLib/pfPython/Games/Heek/pyHeekGame.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/Games/Heek/pyHeekGame.cpp @@ -65,12 +65,12 @@ void pyHeekGame::JoinCommonHeekGame(pyKey& callbackKey, unsigned gameID) pfGameMgr::GetInstance()->JoinCommonGame(callbackKey.getKey(), kGameTypeId_Heek, gameID, 0, NULL); } -void pyHeekGame::PlayGame(int position, UInt32 points, std::wstring name) +void pyHeekGame::PlayGame(int position, uint32_t points, std::wstring name) { if (gameClient) { pfGmHeek* heek = pfGmHeek::ConvertNoRef(gameClient); - heek->PlayGame((unsigned)position, (dword)points, name.c_str()); + heek->PlayGame((unsigned)position, (uint32_t)points, name.c_str()); } } diff --git a/Sources/Plasma/FeatureLib/pfPython/Games/Heek/pyHeekGame.h b/Sources/Plasma/FeatureLib/pfPython/Games/Heek/pyHeekGame.h index 3a6d4f91..c028b320 100644 --- a/Sources/Plasma/FeatureLib/pfPython/Games/Heek/pyHeekGame.h +++ b/Sources/Plasma/FeatureLib/pfPython/Games/Heek/pyHeekGame.h @@ -76,7 +76,7 @@ public: static bool IsHeekGame(std::wstring guid); static void JoinCommonHeekGame(pyKey& callbackKey, unsigned gameID); - void PlayGame(int position, UInt32 points, std::wstring name); + void PlayGame(int position, uint32_t points, std::wstring name); void LeaveGame(); void Choose(int choice); void SequenceFinished(int seq); diff --git a/Sources/Plasma/FeatureLib/pfPython/Games/Heek/pyHeekGameGlue.cpp b/Sources/Plasma/FeatureLib/pfPython/Games/Heek/pyHeekGameGlue.cpp index b6fd40f5..3dd23419 100644 --- a/Sources/Plasma/FeatureLib/pfPython/Games/Heek/pyHeekGameGlue.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/Games/Heek/pyHeekGameGlue.cpp @@ -67,7 +67,7 @@ PYTHON_GLOBAL_METHOD_DEFINITION(PtIsHeekGame, args, "Params: typeID\nReturns tru if (PyUnicode_Check(textObj)) { int strLen = PyUnicode_GetSize(textObj); - wchar_t* text = TRACKED_NEW wchar_t[strLen + 1]; + wchar_t* text = new wchar_t[strLen + 1]; PyUnicode_AsWideChar((PyUnicodeObject*)textObj, text, strLen); text[strLen] = L'\0'; bool retVal = pyHeekGame::IsHeekGame(text); @@ -122,7 +122,7 @@ PYTHON_METHOD_DEFINITION(ptHeekGame, playGame, args) if (PyUnicode_Check(textObj)) { int strLen = PyUnicode_GetSize(textObj); - wchar_t* temp = TRACKED_NEW wchar_t[strLen + 1]; + wchar_t* temp = new wchar_t[strLen + 1]; PyUnicode_AsWideChar((PyUnicodeObject*)textObj, temp, strLen); temp[strLen] = L'\0'; self->fThis->PlayGame(position, points, temp); diff --git a/Sources/Plasma/FeatureLib/pfPython/Games/Marker/pyMarkerGameGlue.cpp b/Sources/Plasma/FeatureLib/pfPython/Games/Marker/pyMarkerGameGlue.cpp index 4d507be0..7f7fd702 100644 --- a/Sources/Plasma/FeatureLib/pfPython/Games/Marker/pyMarkerGameGlue.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/Games/Marker/pyMarkerGameGlue.cpp @@ -67,7 +67,7 @@ PYTHON_GLOBAL_METHOD_DEFINITION(PtIsMarkerGame, args, "Params: typeID\nReturns t if (PyUnicode_Check(textObj)) { int strLen = PyUnicode_GetSize(textObj); - wchar_t* text = TRACKED_NEW wchar_t[strLen + 1]; + wchar_t* text = new wchar_t[strLen + 1]; PyUnicode_AsWideChar((PyUnicodeObject*)textObj, text, strLen); text[strLen] = L'\0'; bool retVal = pyMarkerGame::IsMarkerGame(text); @@ -117,7 +117,7 @@ PYTHON_GLOBAL_METHOD_DEFINITION_WKEY(PtCreateMarkerGame, args, keywords, "Params if (PyUnicode_Check(gameNameObj)) { int strLen = PyUnicode_GetSize(gameNameObj); - wchar_t* text = TRACKED_NEW wchar_t[strLen + 1]; + wchar_t* text = new wchar_t[strLen + 1]; PyUnicode_AsWideChar((PyUnicodeObject*)gameNameObj, text, strLen); text[strLen] = L'\0'; name = text; @@ -142,7 +142,7 @@ PYTHON_GLOBAL_METHOD_DEFINITION_WKEY(PtCreateMarkerGame, args, keywords, "Params if (PyUnicode_Check(templateIdObj)) { int strLen = PyUnicode_GetSize(templateIdObj); - wchar_t* text = TRACKED_NEW wchar_t[strLen + 1]; + wchar_t* text = new wchar_t[strLen + 1]; PyUnicode_AsWideChar((PyUnicodeObject*)templateIdObj, text, strLen); text[strLen] = L'\0'; templateId = text; @@ -181,7 +181,7 @@ PYTHON_METHOD_DEFINITION(ptMarkerGame, changeGameName, args) if (PyUnicode_Check(textObj)) { int strLen = PyUnicode_GetSize(textObj); - wchar_t* text = TRACKED_NEW wchar_t[strLen + 1]; + wchar_t* text = new wchar_t[strLen + 1]; PyUnicode_AsWideChar((PyUnicodeObject*)textObj, text, strLen); text[strLen] = L'\0'; self->fThis->ChangeGameName(text); @@ -236,7 +236,7 @@ PYTHON_METHOD_DEFINITION_WKEY(ptMarkerGame, addMarker, args, keywords) if (PyUnicode_Check(nameObj)) { int strLen = PyUnicode_GetSize(nameObj); - wchar_t* text = TRACKED_NEW wchar_t[strLen + 1]; + wchar_t* text = new wchar_t[strLen + 1]; PyUnicode_AsWideChar((PyUnicodeObject*)nameObj, text, strLen); text[strLen] = L'\0'; name = text; @@ -261,7 +261,7 @@ PYTHON_METHOD_DEFINITION_WKEY(ptMarkerGame, addMarker, args, keywords) if (PyUnicode_Check(ageObj)) { int strLen = PyUnicode_GetSize(ageObj); - wchar_t* text = TRACKED_NEW wchar_t[strLen + 1]; + wchar_t* text = new wchar_t[strLen + 1]; PyUnicode_AsWideChar((PyUnicodeObject*)ageObj, text, strLen); text[strLen] = L'\0'; age = text; @@ -309,7 +309,7 @@ PYTHON_METHOD_DEFINITION(ptMarkerGame, changeMarkerName, args) if (PyUnicode_Check(nameObj)) { int strLen = PyUnicode_GetSize(nameObj); - wchar_t* text = TRACKED_NEW wchar_t[strLen + 1]; + wchar_t* text = new wchar_t[strLen + 1]; PyUnicode_AsWideChar((PyUnicodeObject*)nameObj, text, strLen); text[strLen] = L'\0'; self->fThis->ChangeMarkerName(markerId, text); diff --git a/Sources/Plasma/FeatureLib/pfPython/Games/TicTacToe/pyTTTGameGlue.cpp b/Sources/Plasma/FeatureLib/pfPython/Games/TicTacToe/pyTTTGameGlue.cpp index fb11e6db..74ad5b98 100644 --- a/Sources/Plasma/FeatureLib/pfPython/Games/TicTacToe/pyTTTGameGlue.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/Games/TicTacToe/pyTTTGameGlue.cpp @@ -67,7 +67,7 @@ PYTHON_GLOBAL_METHOD_DEFINITION(PtIsTTTGame, args, "Params: typeID\nReturns true if (PyUnicode_Check(textObj)) { int strLen = PyUnicode_GetSize(textObj); - wchar_t* text = TRACKED_NEW wchar_t[strLen + 1]; + wchar_t* text = new wchar_t[strLen + 1]; PyUnicode_AsWideChar((PyUnicodeObject*)textObj, text, strLen); text[strLen] = L'\0'; bool retVal = pyTTTGame::IsTTTGame(text); diff --git a/Sources/Plasma/FeatureLib/pfPython/Games/VarSync/pyVarSyncGameGlue.cpp b/Sources/Plasma/FeatureLib/pfPython/Games/VarSync/pyVarSyncGameGlue.cpp index 45210078..d0bc4080 100644 --- a/Sources/Plasma/FeatureLib/pfPython/Games/VarSync/pyVarSyncGameGlue.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/Games/VarSync/pyVarSyncGameGlue.cpp @@ -67,7 +67,7 @@ PYTHON_GLOBAL_METHOD_DEFINITION(PtIsVarSyncGame, args, "Params: typeID\nReturns if (PyUnicode_Check(textObj)) { int strLen = PyUnicode_GetSize(textObj); - wchar_t* text = TRACKED_NEW wchar_t[strLen + 1]; + wchar_t* text = new wchar_t[strLen + 1]; PyUnicode_AsWideChar((PyUnicodeObject*)textObj, text, strLen); text[strLen] = L'\0'; bool retVal = pyVarSyncGame::IsVarSyncGame(text); @@ -121,7 +121,7 @@ PYTHON_METHOD_DEFINITION(ptVarSyncGame, setStringVar, args) if (PyUnicode_Check(valueObj)) { int strLen = PyUnicode_GetSize(valueObj); - wchar_t* text = TRACKED_NEW wchar_t[strLen + 1]; + wchar_t* text = new wchar_t[strLen + 1]; PyUnicode_AsWideChar((PyUnicodeObject*)valueObj, text, strLen); text[strLen] = L'\0'; self->fThis->SetStringVar(id, text); @@ -187,7 +187,7 @@ PYTHON_METHOD_DEFINITION(ptVarSyncGame, createStringVar, args) if (PyUnicode_Check(varNameObj)) { int strLen = PyUnicode_GetSize(varNameObj); - wchar_t* text = TRACKED_NEW wchar_t[strLen + 1]; + wchar_t* text = new wchar_t[strLen + 1]; PyUnicode_AsWideChar((PyUnicodeObject*)varNameObj, text, strLen); text[strLen] = L'\0'; varName = text; @@ -211,7 +211,7 @@ PYTHON_METHOD_DEFINITION(ptVarSyncGame, createStringVar, args) if (PyUnicode_Check(valueObj)) { int strLen = PyUnicode_GetSize(valueObj); - wchar_t* text = TRACKED_NEW wchar_t[strLen + 1]; + wchar_t* text = new wchar_t[strLen + 1]; PyUnicode_AsWideChar((PyUnicodeObject*)valueObj, text, strLen); text[strLen] = L'\0'; val = text; @@ -249,7 +249,7 @@ PYTHON_METHOD_DEFINITION(ptVarSyncGame, createNumericVar, args) if (PyUnicode_Check(varNameObj)) { int strLen = PyUnicode_GetSize(varNameObj); - wchar_t* text = TRACKED_NEW wchar_t[strLen + 1]; + wchar_t* text = new wchar_t[strLen + 1]; PyUnicode_AsWideChar((PyUnicodeObject*)varNameObj, text, strLen); text[strLen] = L'\0'; varName = text; diff --git a/Sources/Plasma/FeatureLib/pfPython/Games/pyGameCliGlue.cpp b/Sources/Plasma/FeatureLib/pfPython/Games/pyGameCliGlue.cpp index c0b5ad06..c71a73bd 100644 --- a/Sources/Plasma/FeatureLib/pfPython/Games/pyGameCliGlue.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/Games/pyGameCliGlue.cpp @@ -87,7 +87,7 @@ PYTHON_GLOBAL_METHOD_DEFINITION(PtGetGameNameByTypeID, args, "Params: guid\nRetu if (PyUnicode_Check(textObj)) { int strLen = PyUnicode_GetSize(textObj); - wchar_t* text = TRACKED_NEW wchar_t[strLen + 1]; + wchar_t* text = new wchar_t[strLen + 1]; PyUnicode_AsWideChar((PyUnicodeObject*)textObj, text, strLen); text[strLen] = L'\0'; std::wstring retVal = pyGameCli::GetGameNameByTypeID(text); diff --git a/Sources/Plasma/FeatureLib/pfPython/cyAccountManagement.cpp b/Sources/Plasma/FeatureLib/pfPython/cyAccountManagement.cpp index 6f0a4ca1..738dca11 100644 --- a/Sources/Plasma/FeatureLib/pfPython/cyAccountManagement.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/cyAccountManagement.cpp @@ -135,7 +135,7 @@ void cyAccountManagement::UpgradeVisitorToExplorer(unsigned playerId) void cyAccountManagement::ChangePassword(const char* password) { - wchar* wpassword = StrDupToUnicode(password); + wchar_t* wpassword = StrDupToUnicode(password); NetCommChangeMyPassword(wpassword); - FREE(wpassword); + free(wpassword); } diff --git a/Sources/Plasma/FeatureLib/pfPython/cyAccountManagement.h b/Sources/Plasma/FeatureLib/pfPython/cyAccountManagement.h index 90eca344..fbc87968 100644 --- a/Sources/Plasma/FeatureLib/pfPython/cyAccountManagement.h +++ b/Sources/Plasma/FeatureLib/pfPython/cyAccountManagement.h @@ -50,7 +50,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // #include -#include "hsTypes.h" +#include "HeadSpin.h" #include "hsStlUtils.h" class cyAccountManagement diff --git a/Sources/Plasma/FeatureLib/pfPython/cyAccountManagementGlue.cpp b/Sources/Plasma/FeatureLib/pfPython/cyAccountManagementGlue.cpp index 31f50857..a3deab97 100644 --- a/Sources/Plasma/FeatureLib/pfPython/cyAccountManagementGlue.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/cyAccountManagementGlue.cpp @@ -93,7 +93,7 @@ PYTHON_GLOBAL_METHOD_DEFINITION(PtCreatePlayerW, args, "Params: playerName, avat if (PyUnicode_Check(playerNameObj)) { int strLen = PyUnicode_GetSize(playerNameObj); - wchar_t* text = TRACKED_NEW wchar_t[strLen + 1]; + wchar_t* text = new wchar_t[strLen + 1]; PyUnicode_AsWideChar((PyUnicodeObject*)playerNameObj, text, strLen); text[strLen] = L'\0'; playerName = text; @@ -116,7 +116,7 @@ PYTHON_GLOBAL_METHOD_DEFINITION(PtCreatePlayerW, args, "Params: playerName, avat if (PyUnicode_Check(avatarShapeObj)) { int strLen = PyUnicode_GetSize(avatarShapeObj); - wchar_t* text = TRACKED_NEW wchar_t[strLen + 1]; + wchar_t* text = new wchar_t[strLen + 1]; PyUnicode_AsWideChar((PyUnicodeObject*)avatarShapeObj, text, strLen); text[strLen] = L'\0'; avatarShape = text; @@ -139,7 +139,7 @@ PYTHON_GLOBAL_METHOD_DEFINITION(PtCreatePlayerW, args, "Params: playerName, avat if (PyUnicode_Check(invitationObj)) { int strLen = PyUnicode_GetSize(invitationObj); - wchar_t* text = TRACKED_NEW wchar_t[strLen + 1]; + wchar_t* text = new wchar_t[strLen + 1]; PyUnicode_AsWideChar((PyUnicodeObject*)invitationObj, text, strLen); text[strLen] = L'\0'; invitation = text; diff --git a/Sources/Plasma/FeatureLib/pfPython/cyAnimation.cpp b/Sources/Plasma/FeatureLib/pfPython/cyAnimation.cpp index a21eb29f..71efed9e 100644 --- a/Sources/Plasma/FeatureLib/pfPython/cyAnimation.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/cyAnimation.cpp @@ -131,7 +131,7 @@ void cyAnimation::Play() if ( fRecvr.Count() > 0 ) { // create message - plAnimCmdMsg* pMsg = TRACKED_NEW plAnimCmdMsg; + plAnimCmdMsg* pMsg = new plAnimCmdMsg; // check if this needs to be network forced to all clients if (fNetForce ) { @@ -174,7 +174,7 @@ void cyAnimation::Stop() if ( fRecvr.Count() > 0 ) { // create message - plAnimCmdMsg* pMsg = TRACKED_NEW plAnimCmdMsg; + plAnimCmdMsg* pMsg = new plAnimCmdMsg; // check if this needs to be network forced to all clients if (fNetForce ) { @@ -212,7 +212,7 @@ void cyAnimation::Resume() if ( fRecvr.Count() > 0 ) { // create message - plAnimCmdMsg* pMsg = TRACKED_NEW plAnimCmdMsg; + plAnimCmdMsg* pMsg = new plAnimCmdMsg; // check if this needs to be network forced to all clients if (fNetForce ) { @@ -245,7 +245,7 @@ void cyAnimation::Resume() // // PURPOSE : Play an animation only from specific time start to end // -void cyAnimation::PlayRange(hsScalar start, hsScalar end) +void cyAnimation::PlayRange(float start, float end) { SkipToTime(start); PlayToTime(end); @@ -258,13 +258,13 @@ void cyAnimation::PlayRange(hsScalar start, hsScalar end) // // PURPOSE : Play (continue) an animation until the specified time is reached // -void cyAnimation::PlayToTime(hsScalar time) +void cyAnimation::PlayToTime(float time) { // must have a receiver! if ( fRecvr.Count() > 0 ) { // create message - plAnimCmdMsg* pMsg = TRACKED_NEW plAnimCmdMsg; + plAnimCmdMsg* pMsg = new plAnimCmdMsg; // check if this needs to be network forced to all clients if (fNetForce ) { @@ -297,13 +297,13 @@ void cyAnimation::PlayToTime(hsScalar time) // // PURPOSE : Play (continue) an animation until the specified point is reached // -void cyAnimation::PlayToPercentage(hsScalar zeroToOne) +void cyAnimation::PlayToPercentage(float zeroToOne) { // must have a receiver! if ( fRecvr.Count() > 0 ) { // create message - plAnimCmdMsg* pMsg = TRACKED_NEW plAnimCmdMsg; + plAnimCmdMsg* pMsg = new plAnimCmdMsg; // check if this needs to be network forced to all clients if (fNetForce ) { @@ -337,13 +337,13 @@ void cyAnimation::PlayToPercentage(hsScalar zeroToOne) // PURPOSE : Jump the animation to the specified time // : Doesn't start or stop playing of animation // -void cyAnimation::SkipToTime(hsScalar time) +void cyAnimation::SkipToTime(float time) { // must have a receiver! if ( fRecvr.Count() > 0 ) { // create message - plAnimCmdMsg* pMsg = TRACKED_NEW plAnimCmdMsg; + plAnimCmdMsg* pMsg = new plAnimCmdMsg; // check if this needs to be network forced to all clients if (fNetForce ) { @@ -382,7 +382,7 @@ void cyAnimation::Looped(hsBool looped) if ( fRecvr.Count() > 0 ) { // create message - plAnimCmdMsg* pMsg = TRACKED_NEW plAnimCmdMsg; + plAnimCmdMsg* pMsg = new plAnimCmdMsg; // check if this needs to be network forced to all clients if (fNetForce ) { @@ -423,7 +423,7 @@ void cyAnimation::Backwards(hsBool backwards) if ( fRecvr.Count() > 0 ) { // create message - plAnimCmdMsg* pMsg = TRACKED_NEW plAnimCmdMsg; + plAnimCmdMsg* pMsg = new plAnimCmdMsg; // check if this needs to be network forced to all clients if (fNetForce ) { @@ -458,13 +458,13 @@ void cyAnimation::Backwards(hsBool backwards) // Function : SetLoopStart and SetLoopEnd // PARAMETERS : value - sets the start or the end of the animation // -void cyAnimation::SetLoopStart(hsScalar start) +void cyAnimation::SetLoopStart(float start) { // must have a receiver! if ( fRecvr.Count() > 0 ) { // create message - plAnimCmdMsg* pMsg = TRACKED_NEW plAnimCmdMsg; + plAnimCmdMsg* pMsg = new plAnimCmdMsg; // check if this needs to be network forced to all clients if (fNetForce ) { @@ -490,13 +490,13 @@ void cyAnimation::SetLoopStart(hsScalar start) } } -void cyAnimation::SetLoopEnd(hsScalar end) +void cyAnimation::SetLoopEnd(float end) { // must have a receiver! if ( fRecvr.Count() > 0 ) { // create message - plAnimCmdMsg* pMsg = TRACKED_NEW plAnimCmdMsg; + plAnimCmdMsg* pMsg = new plAnimCmdMsg; // check if this needs to be network forced to all clients if (fNetForce ) { @@ -532,13 +532,13 @@ void cyAnimation::SetLoopEnd(hsScalar end) // PURPOSE : Sets the speed of the animation // : Doesn't start or stop playing animation // -void cyAnimation::Speed(hsScalar speed) +void cyAnimation::Speed(float speed) { // must have a receiver! if ( fRecvr.Count() > 0 ) { // create message - plAnimCmdMsg* pMsg = TRACKED_NEW plAnimCmdMsg; + plAnimCmdMsg* pMsg = new plAnimCmdMsg; // check if this needs to be network forced to all clients if (fNetForce ) { @@ -571,7 +571,7 @@ void cyAnimation::IRunOneCmd(int cmd) if ( fRecvr.Count() > 0 ) { // create message - plAnimCmdMsg* pMsg = TRACKED_NEW plAnimCmdMsg; + plAnimCmdMsg* pMsg = new plAnimCmdMsg; // check if this needs to be network forced to all clients if (fNetForce ) { diff --git a/Sources/Plasma/FeatureLib/pfPython/cyAnimation.h b/Sources/Plasma/FeatureLib/pfPython/cyAnimation.h index ed9e9e7e..9734c39c 100644 --- a/Sources/Plasma/FeatureLib/pfPython/cyAnimation.h +++ b/Sources/Plasma/FeatureLib/pfPython/cyAnimation.h @@ -109,20 +109,20 @@ public: // Play an animation only from specific time start to end // - virtual void PlayRange(hsScalar start, hsScalar end); + virtual void PlayRange(float start, float end); // Play (continue) an animation until the specified time is reached // - virtual void PlayToTime(hsScalar time); + virtual void PlayToTime(float time); // Play (continue) an animation until the specified point is reached // - virtual void PlayToPercentage(hsScalar zeroToOne); + virtual void PlayToPercentage(float zeroToOne); // Jump the animation to the specified time // Doesn't start or stop playing of animation // - virtual void SkipToTime(hsScalar time); + virtual void SkipToTime(float time); // Set whether the animation is to be looped or not // @@ -135,13 +135,13 @@ public: // Sets the start and end of the looping points in the animation // - virtual void SetLoopStart(hsScalar start); - virtual void SetLoopEnd(hsScalar end); + virtual void SetLoopStart(float start); + virtual void SetLoopEnd(float end); // Sets the speed of the animation // Doesn't start or stop playing animation // - virtual void Speed(hsScalar speed); + virtual void Speed(float speed); // Jump the animation to the specified time diff --git a/Sources/Plasma/FeatureLib/pfPython/cyAnimationGlue.cpp b/Sources/Plasma/FeatureLib/pfPython/cyAnimationGlue.cpp index ba7fbfa8..0d7e8def 100644 --- a/Sources/Plasma/FeatureLib/pfPython/cyAnimationGlue.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/cyAnimationGlue.cpp @@ -40,7 +40,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ #include "cyAnimation.h" -#include "hsUtils.h" + #include diff --git a/Sources/Plasma/FeatureLib/pfPython/cyAvatar.cpp b/Sources/Plasma/FeatureLib/pfPython/cyAvatar.cpp index 1e7d8398..6751e1bd 100644 --- a/Sources/Plasma/FeatureLib/pfPython/cyAvatar.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/cyAvatar.cpp @@ -179,7 +179,7 @@ void cyAvatar::OneShot(pyKey &seekKey, float duration, hsBool usePhysics, if ( fRecvr.Count() > 0 ) { // create message - plAvOneShotMsg* pMsg = TRACKED_NEW plAvOneShotMsg( + plAvOneShotMsg* pMsg = new plAvOneShotMsg( (plKey )fSender, nil, seekKey.getKey(), // Mark D told me to do it ...paulg @@ -226,7 +226,7 @@ void cyAvatar::RunBehavior(pyKey &behKey, hsBool netForce, hsBool netProp) if ( plOneShotMod::ConvertNoRef(behKey.getKey()->GetObjectPtr()) != nil ) { // create a message OneShotMessage - plOneShotMsg* pMsg = TRACKED_NEW plOneShotMsg; + plOneShotMsg* pMsg = new plOneShotMsg; // check if this needs to be network forced to all clients if (netProp) { @@ -267,7 +267,7 @@ void cyAvatar::RunBehavior(pyKey &behKey, hsBool netForce, hsBool netProp) { // its a multistage thingy... need to send it a plNotifyMsg // create new notify message to do the actual send with - plNotifyMsg* pNMsg = TRACKED_NEW plNotifyMsg; + plNotifyMsg* pNMsg = new plNotifyMsg; // set whether this should be forced over the network (ignoring net-cascading) if (netProp) @@ -320,7 +320,7 @@ void cyAvatar::RunBehaviorAndReply(pyKey& behKey, pyKey& replyKey, hsBool netFor { // its a multistage thingy... need to send it a plNotifyMsg // create new notify message to do the actual send with - plNotifyMsg* pNMsg = TRACKED_NEW plNotifyMsg; + plNotifyMsg* pNMsg = new plNotifyMsg; // set whether this should be forced over the network (ignoring net-cascading) if (netProp) @@ -372,7 +372,7 @@ void cyAvatar::RunBehaviorAndReply(pyKey& behKey, pyKey& replyKey, hsBool netFor // // NOTE: only works with multi-stage behaviors // -void cyAvatar::NextStage(pyKey &behKey, hsScalar transTime, hsBool setTime, hsScalar newTime, +void cyAvatar::NextStage(pyKey &behKey, float transTime, hsBool setTime, float newTime, hsBool setDirection, bool isForward, hsBool netForce) { // first there is someone to send to and make sure that we an avatar to send this to @@ -385,7 +385,7 @@ void cyAvatar::NextStage(pyKey &behKey, hsScalar transTime, hsBool setTime, hsSc if ( avKey ) { // create the message - plAvBrainGenericMsg* pMsg = TRACKED_NEW plAvBrainGenericMsg((plKey)fSender, avKey, + plAvBrainGenericMsg* pMsg = new plAvBrainGenericMsg((plKey)fSender, avKey, plAvBrainGenericMsg::kNextStage, 0, setTime, newTime, setDirection, (bool)isForward, transTime); @@ -411,7 +411,7 @@ void cyAvatar::NextStage(pyKey &behKey, hsScalar transTime, hsBool setTime, hsSc // // NOTE: only works with multi-stage behaviors // -void cyAvatar::PreviousStage(pyKey &behKey, hsScalar transTime, hsBool setTime, hsScalar newTime, +void cyAvatar::PreviousStage(pyKey &behKey, float transTime, hsBool setTime, float newTime, hsBool setDirection, bool isForward, hsBool netForce) { // first there is someone to send to and make sure that we an avatar to send this to @@ -424,7 +424,7 @@ void cyAvatar::PreviousStage(pyKey &behKey, hsScalar transTime, hsBool setTime, if ( avKey ) { // create the message - plAvBrainGenericMsg* pMsg = TRACKED_NEW plAvBrainGenericMsg((plKey)fSender, avKey, + plAvBrainGenericMsg* pMsg = new plAvBrainGenericMsg((plKey)fSender, avKey, plAvBrainGenericMsg::kPrevStage, 0, setTime, newTime, setDirection, (bool)isForward, transTime); @@ -451,7 +451,7 @@ void cyAvatar::PreviousStage(pyKey &behKey, hsScalar transTime, hsBool setTime, // // NOTE: only works with multi-stage behaviors // -void cyAvatar::GoToStage(pyKey &behKey, Int32 stage, hsScalar transTime, hsBool setTime, hsScalar newTime, +void cyAvatar::GoToStage(pyKey &behKey, int32_t stage, float transTime, hsBool setTime, float newTime, hsBool setDirection, bool isForward, hsBool netForce) { // first there is someone to send to and make sure that we an avatar to send this to @@ -464,7 +464,7 @@ void cyAvatar::GoToStage(pyKey &behKey, Int32 stage, hsScalar transTime, hsBool if ( avKey ) { // create the message - plAvBrainGenericMsg* pMsg = TRACKED_NEW plAvBrainGenericMsg((plKey)fSender, avKey, + plAvBrainGenericMsg* pMsg = new plAvBrainGenericMsg((plKey)fSender, avKey, plAvBrainGenericMsg::kGotoStage, stage, setTime, newTime, setDirection, isForward, transTime); @@ -479,15 +479,15 @@ void cyAvatar::GoToStage(pyKey &behKey, Int32 stage, hsScalar transTime, hsBool } -void cyAvatar::SetLoopCount(pyKey &behKey, Int32 stage, Int32 loopCount, hsBool netForce) +void cyAvatar::SetLoopCount(pyKey &behKey, int32_t stage, int32_t loopCount, hsBool netForce) { // if it is a Multistage guy if ( plMultistageBehMod::ConvertNoRef(behKey.getKey()->GetObjectPtr()) != nil ) { - plMultistageModMsg* pMsg = TRACKED_NEW plMultistageModMsg((plKey)nil, behKey.getKey()); + plMultistageModMsg* pMsg = new plMultistageModMsg((plKey)nil, behKey.getKey()); pMsg->SetCommand(plMultistageModMsg::kSetLoopCount); - pMsg->fStageNum = (UInt8)stage; - pMsg->fNumLoops = (UInt8)loopCount; + pMsg->fStageNum = (uint8_t)stage; + pMsg->fNumLoops = (uint8_t)loopCount; if ( netForce ) pMsg->SetBCastFlag(plMessage::kNetForce | plMessage::kNetPropagate); @@ -513,7 +513,7 @@ void cyAvatar::Seek(pyKey &seekKey, float duration, hsBool usePhysics) if ( fRecvr.Count() > 0 ) { // create message - plAvSeekMsg* pMsg = TRACKED_NEW plAvSeekMsg( + plAvSeekMsg* pMsg = new plAvSeekMsg( (plKey)fSender,nil, seekKey.getKey(),duration,usePhysics); // check if this needs to be network forced to all clients @@ -543,7 +543,7 @@ void cyAvatar::Seek(pyKey &seekKey, float duration, hsBool usePhysics) // // PURPOSE : Return what clothing group the avatar is in // -Int32 cyAvatar::GetAvatarClothingGroup() +int32_t cyAvatar::GetAvatarClothingGroup() { // find the avatar's armature modifier const plArmatureMod *avMod = nil; @@ -572,7 +572,7 @@ Int32 cyAvatar::GetAvatarClothingGroup() // // PURPOSE : Return a list of the wearable items for this avatar of that clothing_type // -std::vector cyAvatar::GetEntireClothingList(Int32 clothing_type) +std::vector cyAvatar::GetEntireClothingList(int32_t clothing_type) { // Currently, just all the clothing available will be returned hsTArray clothingList = plClothingMgr::GetClothingMgr()->GetItemList(); @@ -594,7 +594,7 @@ std::vector cyAvatar::GetEntireClothingList(Int32 clothing_type) // // PURPOSE : Return a list of the wearable items for this avatar of that clothing_type // -std::vector cyAvatar::GetClosetClothingList(Int32 clothing_type) +std::vector cyAvatar::GetClosetClothingList(int32_t clothing_type) { std::vector retVal; @@ -816,7 +816,7 @@ void cyAvatar::AddWardrobeClothingItem(const char* clothing_name,pyColor& tint1, // PURPOSE : Return a list of unique clothing items (each has a different mesh) // : that belong to the specific type // -std::vector cyAvatar::GetUniqueMeshList(Int32 clothing_type) +std::vector cyAvatar::GetUniqueMeshList(int32_t clothing_type) { std::vector retVal; @@ -1049,7 +1049,7 @@ hsBool cyAvatar::TintClothingItem(const char* clothing_name, pyColor& tint) // // PURPOSE : Tint a clothing item, i.e. change the color of it // -hsBool cyAvatar::TintClothingItemLayer(const char* clothing_name, pyColor& tint, UInt8 layer) +hsBool cyAvatar::TintClothingItemLayer(const char* clothing_name, pyColor& tint, uint8_t layer) { return TintClothingItemLayerU(clothing_name,tint,layer,true); } @@ -1164,7 +1164,7 @@ hsBool cyAvatar::TintClothingItemU(const char* clothing_name, pyColor& tint, hsB // // PURPOSE : Tint a clothing item, i.e. change the color of it // -hsBool cyAvatar::TintClothingItemLayerU(const char* clothing_name, pyColor& tint, UInt8 layer, hsBool update) +hsBool cyAvatar::TintClothingItemLayerU(const char* clothing_name, pyColor& tint, uint8_t layer, hsBool update) { const plArmatureMod *avMod = nil; // we can really only talk to one avatar, so just get the first one (which is probably the only one) @@ -1246,7 +1246,7 @@ PyObject* cyAvatar::GetTintClothingItem(const char* clothing_name) // // PURPOSE : Get the tint a clothing item, i.e. change the color of it // -PyObject* cyAvatar::GetTintClothingItemL(const char* clothing_name, UInt8 layer) +PyObject* cyAvatar::GetTintClothingItemL(const char* clothing_name, uint8_t layer) { const plArmatureMod *avMod = nil; // we can really only talk to one avatar, so just get the first one (which is probably the only one) @@ -1379,7 +1379,7 @@ plMorphSequence* cyAvatar::LocalMorphSequence() // // PURPOSE : Set the morph value of a specific layer of clothing // -void cyAvatar::SetMorph(const char* clothing_name, UInt8 layer, float value) +void cyAvatar::SetMorph(const char* clothing_name, uint8_t layer, float value) { plClothingItem *item = plClothingMgr::GetClothingMgr()->FindItemByName(clothing_name); if( !item ) @@ -1430,7 +1430,7 @@ void cyAvatar::SetMorph(const char* clothing_name, UInt8 layer, float value) // // PURPOSE : Returns the current morph value of the specific layer of clothing // -float cyAvatar::GetMorph(const char* clothing_name, UInt8 layer) +float cyAvatar::GetMorph(const char* clothing_name, uint8_t layer) { plMorphSequence* seq = LocalMorphSequence(); if( !seq ) @@ -1474,7 +1474,7 @@ float cyAvatar::GetMorph(const char* clothing_name, UInt8 layer) // // PURPOSE : Set the skin blend for the specified layer // -void cyAvatar::SetSkinBlend(UInt8 layer, float value) +void cyAvatar::SetSkinBlend(uint8_t layer, float value) { if (value < 0.0) value = 0.0; if (value > 1.0) value = 1.0; @@ -1494,7 +1494,7 @@ void cyAvatar::SetSkinBlend(UInt8 layer, float value) // // PURPOSE : Returns the current layer's skin blend // -float cyAvatar::GetSkinBlend(UInt8 layer) +float cyAvatar::GetSkinBlend(uint8_t layer) { plArmatureMod *avMod = plAvatarMgr::GetInstance()->GetLocalAvatar(); @@ -1546,7 +1546,7 @@ void cyAvatar::EnterSubWorld(pySceneObject& object) plKey subWorldKey = SOkey; plKey physKey = avatar->GetKey(); plKey nilKey; // sorry - plSubWorldMsg *swMsg = TRACKED_NEW plSubWorldMsg(nilKey, physKey, subWorldKey); + plSubWorldMsg *swMsg = new plSubWorldMsg(nilKey, physKey, subWorldKey); swMsg->Send(); } } @@ -1573,7 +1573,7 @@ void cyAvatar::ExitSubWorld() plKey subWorldKey; // we're going to the nil subworld plKey physKey = avatar->GetKey(); plKey nilKey; // sorry - plSubWorldMsg *swMsg = TRACKED_NEW plSubWorldMsg(nilKey, physKey, subWorldKey); + plSubWorldMsg *swMsg = new plSubWorldMsg(nilKey, physKey, subWorldKey); swMsg->Send(); } } @@ -1616,7 +1616,7 @@ void cyAvatar::ChangeAvatar(const char* genderName) #ifndef PLASMA_EXTERNAL_RELEASE plClothingMgr::ChangeAvatar((char*)genderName); - wchar wStr[MAX_PATH]; + wchar_t wStr[MAX_PATH]; StrToUnicode(wStr, genderName, arrsize(wStr)); RelVaultNode * rvnPlr = VaultGetPlayerNodeIncRef(); @@ -1637,7 +1637,7 @@ void cyAvatar::ChangeAvatar(const char* genderName) // void cyAvatar::ChangePlayerName(const char* playerName) { - wchar wStr[MAX_PATH]; + wchar_t wStr[MAX_PATH]; StrToUnicode(wStr, playerName, arrsize(wStr)); RelVaultNode * rvnPlr = VaultGetPlayerNodeIncRef(); @@ -1847,12 +1847,12 @@ bool cyAvatar::LocalAvatarIsMoving() return false; } -void cyAvatar::SetMouseTurnSensitivity(hsScalar val) +void cyAvatar::SetMouseTurnSensitivity(float val) { plArmatureMod::SetMouseTurnSensitivity(val); } -hsScalar cyAvatar::GetMouseTurnSensitivity() +float cyAvatar::GetMouseTurnSensitivity() { return plArmatureMod::GetMouseTurnSensitivity(); } @@ -1949,7 +1949,7 @@ bool IExitTopmostGenericMode() { plArmatureMod *avatar = plAvatarMgr::GetInstance()->GetLocalAvatar(); - plAvBrainGenericMsg* pMsg = TRACKED_NEW plAvBrainGenericMsg(nil, avatar->GetKey(), + plAvBrainGenericMsg* pMsg = new plAvBrainGenericMsg(nil, avatar->GetKey(), plAvBrainGenericMsg::kGotoStage, 2, false, 0.0, false, false, 0.0); diff --git a/Sources/Plasma/FeatureLib/pfPython/cyAvatar.h b/Sources/Plasma/FeatureLib/pfPython/cyAvatar.h index dd914419..ded3c41e 100644 --- a/Sources/Plasma/FeatureLib/pfPython/cyAvatar.h +++ b/Sources/Plasma/FeatureLib/pfPython/cyAvatar.h @@ -110,15 +110,15 @@ public: virtual void RunBehaviorAndReply(pyKey& behKey, pyKey& replyKey, hsBool netForce, hsBool netProp); // for the multistage behaviors - virtual void NextStage(pyKey &behKey, hsScalar transTime, hsBool setTime, hsScalar newTime, + virtual void NextStage(pyKey &behKey, float transTime, hsBool setTime, float newTime, hsBool setDirection, bool isForward, hsBool netForce); - virtual void PreviousStage(pyKey &behKey, hsScalar transTime, hsBool setTime, hsScalar newTime, + virtual void PreviousStage(pyKey &behKey, float transTime, hsBool setTime, float newTime, hsBool setDirection, bool isForward, hsBool netForce); - virtual void GoToStage(pyKey &behKey, Int32 stage, hsScalar transTime, hsBool setTime, hsScalar newTime, + virtual void GoToStage(pyKey &behKey, int32_t stage, float transTime, hsBool setTime, float newTime, hsBool setDirection, bool isForward, hsBool netForce); // static behavior functions: - static void SetLoopCount(pyKey &behKey, Int32 stage, Int32 loopCount, hsBool netForce); + static void SetLoopCount(pyKey &behKey, int32_t stage, int32_t loopCount, hsBool netForce); virtual void SetSenderKey(pyKey &pKey); @@ -132,7 +132,7 @@ public: // // PURPOSE : Return what clothing group the avatar is in // - virtual Int32 GetAvatarClothingGroup(); + virtual int32_t GetAvatarClothingGroup(); ///////////////////////////////////////////////////////////////////////////// // @@ -141,7 +141,7 @@ public: // // PURPOSE : Return a list of the wearable items for this avatar of that clothing_type // - virtual std::vector GetEntireClothingList(Int32 clothing_type); + virtual std::vector GetEntireClothingList(int32_t clothing_type); ///////////////////////////////////////////////////////////////////////////// // @@ -150,7 +150,7 @@ public: // // PURPOSE : Return a list of the wearable items for this avatar of that clothing_type // - virtual std::vector GetClosetClothingList(Int32 clothing_type); + virtual std::vector GetClosetClothingList(int32_t clothing_type); ///////////////////////////////////////////////////////////////////////////// // @@ -189,7 +189,7 @@ public: // PURPOSE : Return a list of unique clothing items (each has a different mesh) // : that belong to the specific type // - virtual std::vector GetUniqueMeshList(Int32 clothing_type); + virtual std::vector GetUniqueMeshList(int32_t clothing_type); ///////////////////////////////////////////////////////////////////////////// // @@ -248,7 +248,7 @@ public: // // PURPOSE : Tint a clothing item, i.e. change the color of it // - virtual hsBool TintClothingItemLayer(const char* clothing_name, pyColor& tint, UInt8 layer); + virtual hsBool TintClothingItemLayer(const char* clothing_name, pyColor& tint, uint8_t layer); ///////////////////////////////////////////////////////////////////////////// // @@ -288,7 +288,7 @@ public: // // PURPOSE : Tint a clothing item, i.e. change the color of it // - virtual hsBool TintClothingItemLayerU(const char* clothing_name, pyColor& tint, UInt8 layer, hsBool update); + virtual hsBool TintClothingItemLayerU(const char* clothing_name, pyColor& tint, uint8_t layer, hsBool update); ///////////////////////////////////////////////////////////////////////////// // @@ -315,7 +315,7 @@ public: // // PURPOSE : Get the tint a clothing item, i.e. change the color of it // - virtual PyObject* GetTintClothingItemL(const char* clothing_name, UInt8 layer); + virtual PyObject* GetTintClothingItemL(const char* clothing_name, uint8_t layer); ///////////////////////////////////////////////////////////////////////////// // @@ -354,7 +354,7 @@ public: // // PURPOSE : Set the morph value of a specific layer of clothing // - virtual void SetMorph(const char* clothing_name, UInt8 layer, float value); + virtual void SetMorph(const char* clothing_name, uint8_t layer, float value); ///////////////////////////////////////////////////////////////////////////// // @@ -364,7 +364,7 @@ public: // // PURPOSE : Returns the current morph value of the specific layer of clothing // - virtual float GetMorph(const char* clothing_name, UInt8 layer); + virtual float GetMorph(const char* clothing_name, uint8_t layer); ///////////////////////////////////////////////////////////////////////////// // @@ -374,7 +374,7 @@ public: // // PURPOSE : Set the skin blend for the specified layer // - virtual void SetSkinBlend(UInt8 layer, float value); + virtual void SetSkinBlend(uint8_t layer, float value); ///////////////////////////////////////////////////////////////////////////// // @@ -383,7 +383,7 @@ public: // // PURPOSE : Returns the current layer's skin blend // - virtual float GetSkinBlend(UInt8 layer); + virtual float GetSkinBlend(uint8_t layer); ///////////////////////////////////////////////////////////////////////////// // @@ -542,8 +542,8 @@ public: static bool LocalAvatarRunKeyDown(); static bool LocalAvatarIsMoving(); - static void SetMouseTurnSensitivity(hsScalar val); - static hsScalar GetMouseTurnSensitivity(); + static void SetMouseTurnSensitivity(float val); + static float GetMouseTurnSensitivity(); static void SpawnNext(); ///////////////////////////////////////////////////////////////////////////// diff --git a/Sources/Plasma/FeatureLib/pfPython/cyCamera.cpp b/Sources/Plasma/FeatureLib/pfPython/cyCamera.cpp index f42c06be..7b198cb8 100644 --- a/Sources/Plasma/FeatureLib/pfPython/cyCamera.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/cyCamera.cpp @@ -83,7 +83,7 @@ void cyCamera::SetSender(plKey &sender) void cyCamera::Push(pyKey& newCamKey) { // create message - plCameraMsg* pMsg = TRACKED_NEW plCameraMsg; + plCameraMsg* pMsg = new plCameraMsg; if ( fSender ) pMsg->SetSender(fSender); @@ -113,7 +113,7 @@ void cyCamera::Push(pyKey& newCamKey) void cyCamera::Pop(pyKey& oldCamKey) { // create message - plCameraMsg* pMsg = TRACKED_NEW plCameraMsg; + plCameraMsg* pMsg = new plCameraMsg; if ( fSender ) pMsg->SetSender(fSender); @@ -140,12 +140,12 @@ void cyCamera::Pop(pyKey& oldCamKey) // // PURPOSE : Send controlKey commands to the virtual camera (should be like a pass thru) // -void cyCamera::ControlKey(Int32 controlKey, hsBool activated) +void cyCamera::ControlKey(int32_t controlKey, hsBool activated) { // make sure that we have a virtual camera to send this to if ( fTheCam ) { - plControlEventMsg* pMsg = TRACKED_NEW plControlEventMsg; + plControlEventMsg* pMsg = new plControlEventMsg; // set sender if there is one if ( fSender ) pMsg->SetSender(fSender); @@ -173,7 +173,7 @@ void cyCamera::ControlKey(Int32 controlKey, hsBool activated) void cyCamera::TransitionTo(pyKey& newCamKey, double time, hsBool save) { // create message - plCameraMsg* pMsg = TRACKED_NEW plCameraMsg; + plCameraMsg* pMsg = new plCameraMsg; if ( fSender ) pMsg->SetSender(fSender); // must have a receiver! @@ -200,7 +200,7 @@ void cyCamera::SetEnableFirstPersonOverride(hsBool state) if ( fTheCam ) { // create message - plCameraMsg* pMsg = TRACKED_NEW plCameraMsg; + plCameraMsg* pMsg = new plCameraMsg; if ( fSender ) pMsg->SetSender(fSender); @@ -218,7 +218,7 @@ void cyCamera::SetEnableFirstPersonOverride(hsBool state) void cyCamera::UndoFirstPerson() { // create message - plCameraMsg* pMsg = TRACKED_NEW plCameraMsg; + plCameraMsg* pMsg = new plCameraMsg; if ( fSender ) pMsg->SetSender(fSender); // must have a receiver! @@ -233,7 +233,7 @@ void cyCamera::UndoFirstPerson() } -hsScalar cyCamera::GetFOV() +float cyCamera::GetFOV() { if ( fTheCam ) { @@ -250,7 +250,7 @@ hsScalar cyCamera::GetFOV() return 0.0; } -void cyCamera::SetFOV(hsScalar fov, double t) +void cyCamera::SetFOV(float fov, double t) { if ( fTheCam ) { diff --git a/Sources/Plasma/FeatureLib/pfPython/cyCamera.h b/Sources/Plasma/FeatureLib/pfPython/cyCamera.h index b5c191ad..209429ad 100644 --- a/Sources/Plasma/FeatureLib/pfPython/cyCamera.h +++ b/Sources/Plasma/FeatureLib/pfPython/cyCamera.h @@ -48,7 +48,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // // PURPOSE: Class wrapper to map camera functions to plasma2 message // -#include "hsTypes.h" +#include "HeadSpin.h" #include "pnKeyedObject/plKey.h" class pyKey; @@ -83,7 +83,7 @@ public: virtual void Pop(pyKey& oldCamKey); // Send controlKey commands to the virtual camera (should be like a pass thru) - virtual void ControlKey(Int32 controlKey, hsBool activated); + virtual void ControlKey(int32_t controlKey, hsBool activated); ///////////////////////////////////////////////////////////////////////////// @@ -102,8 +102,8 @@ public: virtual void UndoFirstPerson(); - virtual hsScalar GetFOV(); - virtual void SetFOV(hsScalar fov, double t); + virtual float GetFOV(); + virtual void SetFOV(float fov, double t); virtual void SetSmootherCam(hsBool state); virtual hsBool IsSmootherCam(); diff --git a/Sources/Plasma/FeatureLib/pfPython/cyDraw.cpp b/Sources/Plasma/FeatureLib/pfPython/cyDraw.cpp index 1b93e7f7..c1eb50f4 100644 --- a/Sources/Plasma/FeatureLib/pfPython/cyDraw.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/cyDraw.cpp @@ -78,7 +78,7 @@ void cyDraw::EnableT(hsBool state) if ( fRecvr.Count() > 0 ) { // create message - plEnableMsg* pMsg = TRACKED_NEW plEnableMsg; + plEnableMsg* pMsg = new plEnableMsg; // check if this needs to be network forced to all clients if (fNetForce ) { diff --git a/Sources/Plasma/FeatureLib/pfPython/cyInputInterface.cpp b/Sources/Plasma/FeatureLib/pfPython/cyInputInterface.cpp index 01e0131d..d98d5856 100644 --- a/Sources/Plasma/FeatureLib/pfPython/cyInputInterface.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/cyInputInterface.cpp @@ -70,8 +70,8 @@ void cyInputInterface::PushTelescopeInterface() { if (!fTelescopeInterface) { - fTelescopeInterface = TRACKED_NEW plTelescopeInputInterface; - plInputIfaceMgrMsg* pMsg = TRACKED_NEW plInputIfaceMgrMsg(plInputIfaceMgrMsg::kAddInterface); + fTelescopeInterface = new plTelescopeInputInterface; + plInputIfaceMgrMsg* pMsg = new plInputIfaceMgrMsg(plInputIfaceMgrMsg::kAddInterface); pMsg->SetIFace(fTelescopeInterface); pMsg->Send(); } @@ -88,7 +88,7 @@ void cyInputInterface::PopTelescope() { if (fTelescopeInterface) { - plInputIfaceMgrMsg* pMsg = TRACKED_NEW plInputIfaceMgrMsg(plInputIfaceMgrMsg::kRemoveInterface); + plInputIfaceMgrMsg* pMsg = new plInputIfaceMgrMsg(plInputIfaceMgrMsg::kRemoveInterface); pMsg->SetIFace(fTelescopeInterface); pMsg->Send(); hsRefCnt_SafeUnRef( fTelescopeInterface ); diff --git a/Sources/Plasma/FeatureLib/pfPython/cyMisc.cpp b/Sources/Plasma/FeatureLib/pfPython/cyMisc.cpp index a48ce09e..378aabf5 100644 --- a/Sources/Plasma/FeatureLib/pfPython/cyMisc.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/cyMisc.cpp @@ -109,12 +109,12 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com //// Static Class Stuff ////////////////////////////////////////////////////// plPipeline* cyMisc::fPipeline = nil; -UInt32 cyMisc::fUniqueNumber = 0; +uint32_t cyMisc::fUniqueNumber = 0; #ifdef PLASMA_EXTERNAL_RELEASE -UInt32 cyMisc::fPythonLoggingLevel = cyMisc::kErrorLevel; +uint32_t cyMisc::fPythonLoggingLevel = cyMisc::kErrorLevel; #else -UInt32 cyMisc::fPythonLoggingLevel = cyMisc::kWarningLevel; +uint32_t cyMisc::fPythonLoggingLevel = cyMisc::kWarningLevel; #endif ///////////////////////////////////////////////////////////////////////////// @@ -137,11 +137,11 @@ void cyMisc::Update( double secs ) // // PURPOSE : gets and sets the python debug print level // -UInt32 cyMisc::GetPythonLoggingLevel() +uint32_t cyMisc::GetPythonLoggingLevel() { return fPythonLoggingLevel; } -void cyMisc::SetPythonLoggingLevel(UInt32 new_level) +void cyMisc::SetPythonLoggingLevel(uint32_t new_level) { fPythonLoggingLevel = new_level; } @@ -158,7 +158,7 @@ void cyMisc::Console(const char* command) if ( command != nil ) { // create message to send to the console - plControlEventMsg* pMsg = TRACKED_NEW plControlEventMsg; + plControlEventMsg* pMsg = new plControlEventMsg; pMsg->SetBCastFlag(plMessage::kBCastByType); pMsg->SetControlCode(B_CONTROL_CONSOLE_COMMAND); pMsg->SetControlActivated(true); @@ -172,7 +172,7 @@ void cyMisc::ConsoleNet(const char* command, hsBool netForce) if ( command != nil ) { // create message to send to the console - plControlEventMsg* pMsg = TRACKED_NEW plControlEventMsg; + plControlEventMsg* pMsg = new plControlEventMsg; pMsg->SetBCastFlag(plMessage::kBCastByType); pMsg->SetBCastFlag(plMessage::kNetPropagate); if ( netForce ) @@ -249,13 +249,13 @@ void cyMisc::PopUpConsole(const char* command) if ( command != nil ) { // create message to send to the console - plControlEventMsg* pMsg1 = TRACKED_NEW plControlEventMsg; + plControlEventMsg* pMsg1 = new plControlEventMsg; pMsg1->SetBCastFlag(plMessage::kBCastByType); pMsg1->SetControlCode(B_SET_CONSOLE_MODE); pMsg1->SetControlActivated(true); plgDispatch::MsgSend( pMsg1 ); // whoosh... off it goes // create message to send to the console - plControlEventMsg* pMsg2 = TRACKED_NEW plControlEventMsg; + plControlEventMsg* pMsg2 = new plControlEventMsg; pMsg2->SetBCastFlag(plMessage::kBCastByType); pMsg2->SetControlCode(B_CONTROL_CONSOLE_COMMAND); pMsg2->SetControlActivated(true); @@ -271,10 +271,10 @@ void cyMisc::PopUpConsole(const char* command) // // PURPOSE : Execute a console command from a python script // -void cyMisc::TimerCallback(pyKey& selfkey, hsScalar time, UInt32 id) +void cyMisc::TimerCallback(pyKey& selfkey, float time, uint32_t id) { // setup the message to come back to whoever the pyKey is pointing to - plTimerCallbackMsg* pTimerMsg = TRACKED_NEW plTimerCallbackMsg(selfkey.getKey(),id); + plTimerCallbackMsg* pTimerMsg = new plTimerCallbackMsg(selfkey.getKey(),id); plgTimerCallbackMgr::NewTimer( time, pTimerMsg ); } @@ -307,7 +307,7 @@ void cyMisc::AttachObject(pyKey& ckey, pyKey& pkey) if ( childKey ) { // create the attach message to attach the child - plAttachMsg* pMsg = TRACKED_NEW plAttachMsg(parentKey, childKey->GetObjectPtr(), plRefMsg::kOnRequest); + plAttachMsg* pMsg = new plAttachMsg(parentKey, childKey->GetObjectPtr(), plRefMsg::kOnRequest); plgDispatch::MsgSend( pMsg ); } } @@ -320,7 +320,7 @@ void cyMisc::AttachObjectSO(pySceneObject& cobj, pySceneObject& pobj) if ( childKey ) { // create the attach message to attach the child - plAttachMsg* pMsg = TRACKED_NEW plAttachMsg(parentKey, childKey->GetObjectPtr(), plRefMsg::kOnRequest); + plAttachMsg* pMsg = new plAttachMsg(parentKey, childKey->GetObjectPtr(), plRefMsg::kOnRequest); plgDispatch::MsgSend( pMsg ); } } @@ -343,7 +343,7 @@ void cyMisc::DetachObject(pyKey& ckey, pyKey& pkey) if ( childKey ) { // create the attach message to detach the child - plAttachMsg* pMsg = TRACKED_NEW plAttachMsg(parentKey, childKey->GetObjectPtr(), plRefMsg::kOnRemove); + plAttachMsg* pMsg = new plAttachMsg(parentKey, childKey->GetObjectPtr(), plRefMsg::kOnRemove); plgDispatch::MsgSend( pMsg ); } } @@ -356,7 +356,7 @@ void cyMisc::DetachObjectSO(pySceneObject& cobj, pySceneObject& pobj) if ( childKey ) { // create the attach message to detach the child - plAttachMsg* pMsg = TRACKED_NEW plAttachMsg(parentKey, childKey->GetObjectPtr(), plRefMsg::kOnRemove); + plAttachMsg* pMsg = new plAttachMsg(parentKey, childKey->GetObjectPtr(), plRefMsg::kOnRemove); plgDispatch::MsgSend( pMsg ); } } @@ -396,7 +396,7 @@ void cyMisc::DetachObjectSO(pySceneObject& cobj, pySceneObject& pobj) // // PURPOSE : set the Python modifier to be dirty and asked to be saved out // -void cyMisc::SetDirtySyncState(pyKey &selfkey, const char* SDLStateName, UInt32 sendFlags) +void cyMisc::SetDirtySyncState(pyKey &selfkey, const char* SDLStateName, uint32_t sendFlags) { selfkey.DirtySynchState(SDLStateName, sendFlags); } @@ -408,7 +408,7 @@ void cyMisc::SetDirtySyncState(pyKey &selfkey, const char* SDLStateName, UInt32 // // PURPOSE : set the Python modifier to be dirty and asked to be saved out // -void cyMisc::SetDirtySyncStateWithClients(pyKey &selfkey, const char* SDLStateName, UInt32 sendFlags) +void cyMisc::SetDirtySyncStateWithClients(pyKey &selfkey, const char* SDLStateName, uint32_t sendFlags) { selfkey.DirtySynchState(SDLStateName, sendFlags|plSynchedObject::kBCastToClients); } @@ -610,7 +610,7 @@ PyObject* cyMisc::GetPrevAgeInfo() } // current time in current age -UInt32 cyMisc::GetAgeTime( void ) +uint32_t cyMisc::GetAgeTime( void ) { return VaultAgeGetAgeTime(); } @@ -637,9 +637,9 @@ float cyMisc::GetAgeTimeOfDayPercent(void) return plNetClientMgr::GetInstance()->GetCurrentAgeTimeOfDayPercent(); } -#define kMST (UInt32)25200 -#define kOneHour (UInt32)3600 -#define kOneDay (UInt32)86400 +#define kMST (uint32_t)25200 +#define kOneHour (uint32_t)3600 +#define kOneDay (uint32_t)86400 time_t cyMisc::ConvertGMTtoDni(time_t gtime) { @@ -684,9 +684,9 @@ time_t cyMisc::ConvertGMTtoDni(time_t gtime) // // PURPOSE : Sets the state of an exclude region // -void cyMisc::ExcludeRegionSet(pyKey& sender, pyKey& exKey, UInt16 state) +void cyMisc::ExcludeRegionSet(pyKey& sender, pyKey& exKey, uint16_t state) { - plExcludeRegionMsg *msg = TRACKED_NEW plExcludeRegionMsg; + plExcludeRegionMsg *msg = new plExcludeRegionMsg; switch (state) { @@ -702,9 +702,9 @@ void cyMisc::ExcludeRegionSet(pyKey& sender, pyKey& exKey, UInt16 state) plgDispatch::MsgSend( msg ); // whoosh... off it goes } -void cyMisc::ExcludeRegionSetNow(pyKey& sender, pyKey& exKey, UInt16 state) +void cyMisc::ExcludeRegionSetNow(pyKey& sender, pyKey& exKey, uint16_t state) { - plExcludeRegionMsg *msg = TRACKED_NEW plExcludeRegionMsg; + plExcludeRegionMsg *msg = new plExcludeRegionMsg; switch (state) { @@ -755,7 +755,7 @@ double cyMisc::GetSysSeconds() // // PURPOSE : Return the frame delta seconds // -hsScalar cyMisc::GetDelSysSeconds() +float cyMisc::GetDelSysSeconds() { return hsTimer::GetDelSysSeconds(); } @@ -870,7 +870,7 @@ void cyMisc::HideDialog(const char* name) // // PURPOSE : Return the frame delta seconds // -PyObject* cyMisc::GetDialogFromTagID(UInt32 tag) +PyObject* cyMisc::GetDialogFromTagID(uint32_t tag) { pfGameGUIMgr *mgr = pfGameGUIMgr::GetInstance(); if ( mgr ) @@ -1054,12 +1054,12 @@ std::vector cyMisc::GetPlayerListDistanceSorted() return pyPL; } -UInt32 cyMisc::GetMaxListenListSize() +uint32_t cyMisc::GetMaxListenListSize() { return plNetListenList::kMaxListenListSize; } -hsScalar cyMisc::GetMaxListenDistSq() +float cyMisc::GetMaxListenDistSq() { return plNetListenList::kMaxListenDistSq; } @@ -1078,10 +1078,10 @@ hsScalar cyMisc::GetMaxListenDistSq() // // RETURNS : the flags that were sent with the message (may be modified) // -UInt32 cyMisc::SendRTChat(pyPlayer& from, const std::vector & tolist, const char* message, UInt32 flags) +uint32_t cyMisc::SendRTChat(pyPlayer& from, const std::vector & tolist, const char* message, uint32_t flags) { // create the messge that will contain the chat message - pfKIMsg *msg = TRACKED_NEW pfKIMsg( pfKIMsg::kHACKChatMsg ); + pfKIMsg *msg = new pfKIMsg( pfKIMsg::kHACKChatMsg ); msg->SetString( message ); msg->SetUser( from.GetPlayerName(), from.GetPlayerID() ); msg->SetFlags( flags ); @@ -1104,7 +1104,7 @@ UInt32 cyMisc::SendRTChat(pyPlayer& from, const std::vector & tolist, } } - UInt32 msgFlags = msg->GetFlags(); + uint32_t msgFlags = msg->GetFlags(); if (tolist.size() == 0 || (msg->GetNetReceivers() && msg->GetNetReceivers()->size() > 0)) msg->Send(); @@ -1112,10 +1112,10 @@ UInt32 cyMisc::SendRTChat(pyPlayer& from, const std::vector & tolist, return msgFlags; } -UInt32 cyMisc::SendRTChat(pyPlayer& from, const std::vector & tolist, const wchar_t* message, UInt32 flags) +uint32_t cyMisc::SendRTChat(pyPlayer& from, const std::vector & tolist, const wchar_t* message, uint32_t flags) { // create the messge that will contain the chat message - pfKIMsg *msg = TRACKED_NEW pfKIMsg( pfKIMsg::kHACKChatMsg ); + pfKIMsg *msg = new pfKIMsg( pfKIMsg::kHACKChatMsg ); msg->SetString( message ); msg->SetUser( from.GetPlayerName(), from.GetPlayerID() ); msg->SetFlags( flags ); @@ -1137,7 +1137,7 @@ UInt32 cyMisc::SendRTChat(pyPlayer& from, const std::vector & tolist, } } - UInt32 msgFlags = msg->GetFlags(); + uint32_t msgFlags = msg->GetFlags(); if (tolist.size() == 0 || (msg->GetNetReceivers() && msg->GetNetReceivers()->size() > 0)) msg->Send(); @@ -1155,10 +1155,10 @@ UInt32 cyMisc::SendRTChat(pyPlayer& from, const std::vector & tolist, // // RETURNS : nothing // -void cyMisc::SendKIMessage(UInt32 command, hsScalar value) +void cyMisc::SendKIMessage(uint32_t command, float value) { // create the mesage to send - pfKIMsg *msg = TRACKED_NEW pfKIMsg( (UInt8)command ); + pfKIMsg *msg = new pfKIMsg( (uint8_t)command ); // check to see if the value makes any sense if ( command == pfKIMsg::kSetChatFadeDelay ) @@ -1183,10 +1183,10 @@ void cyMisc::SendKIMessage(UInt32 command, hsScalar value) // // RETURNS : nothing // -void cyMisc::SendKIMessageS(UInt32 command, const wchar_t* value) +void cyMisc::SendKIMessageS(uint32_t command, const wchar_t* value) { // create the mesage to send - pfKIMsg *msg = TRACKED_NEW pfKIMsg( (UInt8)command ); + pfKIMsg *msg = new pfKIMsg( (uint8_t)command ); msg->SetString( value ); @@ -1198,16 +1198,16 @@ void cyMisc::SendKIMessageS(UInt32 command, const wchar_t* value) // // Function : SendKIMessageI // PARAMETERS : command - the command type -// : value - extra value as an Int32 +// : value - extra value as an int32_t // // PURPOSE : Send message to the KI, to tell it things to do // // RETURNS : nothing // -void cyMisc::SendKIMessageI(UInt32 command, Int32 value) +void cyMisc::SendKIMessageI(uint32_t command, int32_t value) { // create the mesage to send - pfKIMsg *msg = TRACKED_NEW pfKIMsg( (UInt8)command ); + pfKIMsg *msg = new pfKIMsg( (uint8_t)command ); msg->SetIntValue(value); @@ -1219,16 +1219,16 @@ void cyMisc::SendKIMessageI(UInt32 command, Int32 value) // // Function : SendKIMessageIReply // PARAMETERS : command - the command type -// : value - extra value as an Int32 +// : value - extra value as an int32_t // // PURPOSE : Send message to the KI, to tell it things to do // // RETURNS : nothing // -void cyMisc::SendKIGZMarkerMsg(Int32 markerNumber, pyKey& sender) +void cyMisc::SendKIGZMarkerMsg(int32_t markerNumber, pyKey& sender) { // create the mesage to send - pfKIMsg *msg = TRACKED_NEW pfKIMsg( pfKIMsg::kGZInRange ); + pfKIMsg *msg = new pfKIMsg( pfKIMsg::kGZInRange ); msg->SetIntValue(markerNumber); msg->SetSender(sender.getKey()); @@ -1239,7 +1239,7 @@ void cyMisc::SendKIGZMarkerMsg(Int32 markerNumber, pyKey& sender) void cyMisc::SendKIRegisterImagerMsg(const char* imagerName, pyKey& sender) { - pfKIMsg *msg = TRACKED_NEW pfKIMsg(pfKIMsg::kRegisterImager); + pfKIMsg *msg = new pfKIMsg(pfKIMsg::kRegisterImager); msg->SetString(imagerName); msg->SetSender(sender.getKey()); @@ -1261,7 +1261,7 @@ void cyMisc::SendKIRegisterImagerMsg(const char* imagerName, pyKey& sender) void cyMisc::YesNoDialog(pyKey& sender, const char* thestring) { // create the mesage to send - pfKIMsg *msg = TRACKED_NEW pfKIMsg( pfKIMsg::kYesNoDialog ); + pfKIMsg *msg = new pfKIMsg( pfKIMsg::kYesNoDialog ); msg->SetSender(sender.getKey()); msg->SetString(thestring); @@ -1290,7 +1290,7 @@ void cyMisc::YesNoDialog(pyKey& sender, std::wstring thestring) void cyMisc::RateIt(const char* chronicleName, const char* thestring, hsBool onceFlag) { // create the mesage to send - pfKIMsg *msg = TRACKED_NEW pfKIMsg( pfKIMsg::kRateIt ); + pfKIMsg *msg = new pfKIMsg( pfKIMsg::kRateIt ); msg->SetUser(chronicleName,0); msg->SetString(thestring); @@ -1313,7 +1313,7 @@ void cyMisc::SetPrivateChatList(const std::vector & tolist) { if (tolist.size() > 0) { - plNetVoiceListMsg* pMsg = TRACKED_NEW plNetVoiceListMsg(plNetVoiceListMsg::kForcedListenerMode); + plNetVoiceListMsg* pMsg = new plNetVoiceListMsg(plNetVoiceListMsg::kForcedListenerMode); for (int i=0 ; iGetClientList()->Append(tolist[i]->GetPlayerID()); @@ -1333,7 +1333,7 @@ void cyMisc::SetPrivateChatList(const std::vector & tolist) // void cyMisc::ClearPrivateChatList(pyKey& member) { - plNetVoiceListMsg* pMsg = TRACKED_NEW plNetVoiceListMsg(plNetVoiceListMsg::kDistanceMode); + plNetVoiceListMsg* pMsg = new plNetVoiceListMsg(plNetVoiceListMsg::kDistanceMode); pMsg->SetRemovedKey( member.getKey() ); pMsg->Send(); } @@ -1366,10 +1366,10 @@ void cyMisc::SendPetitionToCCR(const char* message) { SendPetitionToCCRI(message,plNetCommon::PetitionTypes::kGeneralHelp,nil); } -void cyMisc::SendPetitionToCCRI(const char* message, UInt8 reason,const char* title) +void cyMisc::SendPetitionToCCRI(const char* message, uint8_t reason,const char* title) { // create the mesage to send - plCCRPetitionMsg *msg = TRACKED_NEW plCCRPetitionMsg(); + plCCRPetitionMsg *msg = new plCCRPetitionMsg(); msg->SetNote(message); msg->SetType(reason); if (title) @@ -1386,10 +1386,10 @@ void cyMisc::SendPetitionToCCRI(const char* message, UInt8 reason,const char* ti // // PURPOSE : Send a chat message to the CCR for help or questions // -void cyMisc::SendChatToCCR(const char* message,Int32 CCRPlayerID) +void cyMisc::SendChatToCCR(const char* message,int32_t CCRPlayerID) { // create the mesage to send - plCCRCommunicationMsg *msg = TRACKED_NEW plCCRCommunicationMsg(); + plCCRCommunicationMsg *msg = new plCCRCommunicationMsg(); msg->SetMessage(message); msg->SetType(plCCRCommunicationMsg::kReturnChatMsg); msg->SetBCastFlag(plMessage::kNetAllowInterAge); @@ -1424,7 +1424,7 @@ void cyMisc::PageInNodes(const std::vector & nodeNames, const char* if (hsgResMgr::ResMgr()) { plSynchEnabler ps(false); // disable dirty tracking while paging in - plClientMsg* msg = TRACKED_NEW plClientMsg(plClientMsg::kLoadRoom); + plClientMsg* msg = new plClientMsg(plClientMsg::kLoadRoom); plKey clientKey = hsgResMgr::ResMgr()->FindKey(kClient_KEY); msg->AddReceiver(clientKey); @@ -1441,7 +1441,7 @@ void cyMisc::PageOutNode(const char* nodeName) if ( hsgResMgr::ResMgr() ) { plSynchEnabler ps(false); // disable dirty tracking while paging out - plClientMsg* pMsg1 = TRACKED_NEW plClientMsg(plClientMsg::kUnloadRoom); + plClientMsg* pMsg1 = new plClientMsg(plClientMsg::kUnloadRoom); plKey clientKey = hsgResMgr::ResMgr()->FindKey( kClient_KEY ); pMsg1->AddReceiver( clientKey ); pMsg1->AddRoomLoc(plKeyFinder::Instance().FindLocation(nil, nodeName)); @@ -1524,7 +1524,7 @@ void cyMisc::SetClearColor(float red, float green, float blue) char command[256]; sprintf(command,"Graphics.Renderer.SetClearColor %f %f %f",red,green,blue); // create message to send to the console - plControlEventMsg* pMsg = TRACKED_NEW plControlEventMsg; + plControlEventMsg* pMsg = new plControlEventMsg; pMsg->SetBCastFlag(plMessage::kBCastByType); pMsg->SetControlCode(B_CONTROL_CONSOLE_COMMAND); pMsg->SetControlActivated(true); @@ -1545,7 +1545,7 @@ void cyMisc::EnableAvatarCursorFade() plNetClientMgr* nmgr = plNetClientMgr::GetInstance(); if (nmgr) { - plIfaceFadeAvatarMsg* iMsg = TRACKED_NEW plIfaceFadeAvatarMsg; + plIfaceFadeAvatarMsg* iMsg = new plIfaceFadeAvatarMsg; iMsg->SetSubjectKey(nmgr->GetLocalPlayerKey()); iMsg->SetBCastFlag(plMessage::kBCastByExactType); iMsg->SetBCastFlag(plMessage::kNetPropagate, FALSE); @@ -1559,7 +1559,7 @@ void cyMisc::DisableAvatarCursorFade() plNetClientMgr* nmgr = plNetClientMgr::GetInstance(); if (nmgr) { - plIfaceFadeAvatarMsg* iMsg = TRACKED_NEW plIfaceFadeAvatarMsg; + plIfaceFadeAvatarMsg* iMsg = new plIfaceFadeAvatarMsg; iMsg->SetSubjectKey(nmgr->GetLocalPlayerKey()); iMsg->SetBCastFlag(plMessage::kBCastByExactType); iMsg->SetBCastFlag(plMessage::kNetPropagate, FALSE); @@ -1573,7 +1573,7 @@ void cyMisc::FadeLocalPlayer(hsBool fade) plNetClientMgr* nmgr = plNetClientMgr::GetInstance(); if (nmgr) { - plCameraTargetFadeMsg* pMsg = TRACKED_NEW plCameraTargetFadeMsg; + plCameraTargetFadeMsg* pMsg = new plCameraTargetFadeMsg; pMsg->SetFadeOut(fade); pMsg->SetSubjectKey(nmgr->GetLocalPlayerKey()); pMsg->SetBCastFlag(plMessage::kBCastByExactType); @@ -1593,7 +1593,7 @@ void cyMisc::FadeLocalPlayer(hsBool fade) void cyMisc::EnableOfferBookMode(pyKey& selfkey, const char* ageFilename, const char* ageInstanceName) { - plInputIfaceMgrMsg* pMsg = TRACKED_NEW plInputIfaceMgrMsg(plInputIfaceMgrMsg::kSetOfferBookMode); + plInputIfaceMgrMsg* pMsg = new plInputIfaceMgrMsg(plInputIfaceMgrMsg::kSetOfferBookMode); pMsg->SetSender(selfkey.getKey()); pMsg->SetAgeFileName(ageFilename); pMsg->SetAgeName(ageInstanceName); @@ -1602,13 +1602,13 @@ void cyMisc::EnableOfferBookMode(pyKey& selfkey, const char* ageFilename, const void cyMisc::DisableOfferBookMode() { - plInputIfaceMgrMsg* pMsg = TRACKED_NEW plInputIfaceMgrMsg(plInputIfaceMgrMsg::kClearOfferBookMode); + plInputIfaceMgrMsg* pMsg = new plInputIfaceMgrMsg(plInputIfaceMgrMsg::kClearOfferBookMode); pMsg->Send(); } -void cyMisc::NotifyOffererPublicLinkCompleted(UInt32 offerer) +void cyMisc::NotifyOffererPublicLinkCompleted(uint32_t offerer) { - plInputIfaceMgrMsg* pMsg = TRACKED_NEW plInputIfaceMgrMsg(plInputIfaceMgrMsg::kNotifyOfferCompleted, plNetClientMgr::GetInstance()->GetPlayerID()); + plInputIfaceMgrMsg* pMsg = new plInputIfaceMgrMsg(plInputIfaceMgrMsg::kNotifyOfferCompleted, plNetClientMgr::GetInstance()->GetPlayerID()); pMsg->SetSender(plNetClientMgr::GetInstance()->GetLocalPlayerKey()); if (offerer != plNetClientMgr::GetInstance()->GetPlayerID()) { @@ -1621,9 +1621,9 @@ void cyMisc::NotifyOffererPublicLinkCompleted(UInt32 offerer) pMsg->Send(); } -void cyMisc::NotifyOffererPublicLinkRejected(UInt32 offerer) +void cyMisc::NotifyOffererPublicLinkRejected(uint32_t offerer) { - plInputIfaceMgrMsg* pMsg = TRACKED_NEW plInputIfaceMgrMsg(plInputIfaceMgrMsg::kNotifyOfferRejected); + plInputIfaceMgrMsg* pMsg = new plInputIfaceMgrMsg(plInputIfaceMgrMsg::kNotifyOfferRejected); pMsg->SetSender(plNetClientMgr::GetInstance()->GetLocalPlayerKey()); if (offerer != plNetClientMgr::GetInstance()->GetPlayerID()) { @@ -1637,9 +1637,9 @@ void cyMisc::NotifyOffererPublicLinkRejected(UInt32 offerer) ToggleAvatarClickability(true); } -void cyMisc::NotifyOffererPublicLinkAccepted(UInt32 offerer) +void cyMisc::NotifyOffererPublicLinkAccepted(uint32_t offerer) { - plInputIfaceMgrMsg* pMsg = TRACKED_NEW plInputIfaceMgrMsg(plInputIfaceMgrMsg::kNotifyOfferAccepted); + plInputIfaceMgrMsg* pMsg = new plInputIfaceMgrMsg(plInputIfaceMgrMsg::kNotifyOfferAccepted); pMsg->SetSender(plNetClientMgr::GetInstance()->GetLocalPlayerKey()); if (offerer != plNetClientMgr::GetInstance()->GetPlayerID()) { @@ -1656,9 +1656,9 @@ void cyMisc::ToggleAvatarClickability(hsBool on) { plInputIfaceMgrMsg* pMsg = 0; if (on) - pMsg = TRACKED_NEW plInputIfaceMgrMsg(plInputIfaceMgrMsg::kGUIEnableAvatarClickable); + pMsg = new plInputIfaceMgrMsg(plInputIfaceMgrMsg::kGUIEnableAvatarClickable); else - pMsg = TRACKED_NEW plInputIfaceMgrMsg(plInputIfaceMgrMsg::kGUIDisableAvatarClickable); + pMsg = new plInputIfaceMgrMsg(plInputIfaceMgrMsg::kGUIDisableAvatarClickable); pMsg->SetAvKey(plNetClientMgr::GetInstance()->GetLocalPlayerKey()); pMsg->SetBCastFlag(plMessage::kNetPropagate); pMsg->SetBCastFlag(plMessage::kNetForce); @@ -1668,7 +1668,7 @@ void cyMisc::ToggleAvatarClickability(hsBool on) void cyMisc::SetShareSpawnPoint(const char* spawnPoint) { - plInputIfaceMgrMsg* pMsg = TRACKED_NEW plInputIfaceMgrMsg(plInputIfaceMgrMsg::kSetShareSpawnPoint); + plInputIfaceMgrMsg* pMsg = new plInputIfaceMgrMsg(plInputIfaceMgrMsg::kSetShareSpawnPoint); pMsg->SetSender(plNetClientMgr::GetInstance()->GetLocalPlayerKey()); pMsg->SetSpawnPoint(spawnPoint); pMsg->Send(); @@ -1676,7 +1676,7 @@ void cyMisc::SetShareSpawnPoint(const char* spawnPoint) void cyMisc::SetShareAgeInstanceGuid(const Uuid& guid) { - plInputIfaceMgrMsg* pMsg = TRACKED_NEW plInputIfaceMgrMsg(plInputIfaceMgrMsg::kSetShareAgeInstanceGuid); + plInputIfaceMgrMsg* pMsg = new plInputIfaceMgrMsg(plInputIfaceMgrMsg::kSetShareAgeInstanceGuid); pMsg->SetSender(plNetClientMgr::GetInstance()->GetLocalPlayerKey()); pMsg->SetAgeInstanceGuid(guid); pMsg->Send(); @@ -1776,7 +1776,7 @@ void cyMisc::TransferParticlesToKey(pyKey& fromKey, pyKey& toKey, int numParticl plArmatureMod *avMod = plAvatarMgr::GetInstance()->GetLocalAvatar(); - plParticleTransferMsg* pMsg = TRACKED_NEW plParticleTransferMsg(nil, avMod->GetKey(), 0, frKey, numParticles); + plParticleTransferMsg* pMsg = new plParticleTransferMsg(nil, avMod->GetKey(), 0, frKey, numParticles); pMsg->SetBCastFlag(plMessage::kNetPropagate); pMsg->SetBCastFlag(plMessage::kNetForce); pMsg->Send(); @@ -1811,7 +1811,7 @@ void cyMisc::SetParticleDissentPoint(float x, float y, float z, pyKey& particles plParticleEffect *flock = sys->GetEffect(plParticleFlockEffect::Index()); if (flock) { - (TRACKED_NEW plParticleFlockMsg(nil, flock->GetKey(), 0, plParticleFlockMsg::kFlockCmdSetDissentPoint, x, y, z))->Send(); + (new plParticleFlockMsg(nil, flock->GetKey(), 0, plParticleFlockMsg::kFlockCmdSetDissentPoint, x, y, z))->Send(); } } @@ -1845,7 +1845,7 @@ void cyMisc::SetParticleOffset(float x, float y, float z, pyKey& particles) plParticleEffect *flock = sys->GetEffect(plParticleFlockEffect::Index()); if (flock) { - (TRACKED_NEW plParticleFlockMsg(nil, flock->GetKey(), 0, plParticleFlockMsg::kFlockCmdSetOffset, x, y, z))->Send(); + (new plParticleFlockMsg(nil, flock->GetKey(), 0, plParticleFlockMsg::kFlockCmdSetOffset, x, y, z))->Send(); } } @@ -1878,7 +1878,7 @@ void cyMisc::KillParticles(float time, float pct, pyKey& particles) plParticleEffect *flock = sys->GetEffect(plParticleFlockEffect::Index()); if (flock) { - plParticleKillMsg* pMsg = TRACKED_NEW plParticleKillMsg(nil, frKey, 0, pct, time, plParticleKillMsg::kParticleKillPercentage | plParticleKillMsg::kParticleKillImmortalOnly); + plParticleKillMsg* pMsg = new plParticleKillMsg(nil, frKey, 0, pct, time, plParticleKillMsg::kParticleKillPercentage | plParticleKillMsg::kParticleKillImmortalOnly); pMsg->SetBCastFlag(plMessage::kNetPropagate); pMsg->SetBCastFlag(plMessage::kNetForce); pMsg->SetBCastFlag(plMessage::kPropagateToChildren); @@ -1909,7 +1909,7 @@ int cyMisc::GetNumParticles(pyKey& host) } -void cyMisc::SetLightColorValue(pyKey& light, const plString& lightName, hsScalar r, hsScalar g, hsScalar b, hsScalar a) +void cyMisc::SetLightColorValue(pyKey& light, const plString& lightName, float r, float g, float b, float a) { // lightName is the name of the light object attached to the light that we want to talk to // for the bug lights, this would be "RTOmni-BugLightTest" @@ -1995,12 +1995,12 @@ void cyMisc::SetLightAnimationOn(pyKey& light, const plString& lightName, hsBool } if (pIface) { - plEnableMsg* enableMsg = TRACKED_NEW plEnableMsg; + plEnableMsg* enableMsg = new plEnableMsg; enableMsg->AddReceiver(pIface->GetKey()); enableMsg->SetBCastFlag(plMessage::kNetPropagate); enableMsg->SetBCastFlag(plMessage::kNetForce); - plAnimCmdMsg* animMsg = TRACKED_NEW plAnimCmdMsg; + plAnimCmdMsg* animMsg = new plAnimCmdMsg; animMsg->AddReceiver(pIface->GetOwnerKey()); animMsg->SetBCastFlag(plMessage::kPropagateToModifiers); animMsg->SetBCastFlag(plMessage::kNetPropagate); @@ -2032,7 +2032,7 @@ void cyMisc::SetLightAnimationOn(pyKey& light, const plString& lightName, hsBool void cyMisc::RegisterForControlEventMessages(hsBool on, pyKey& k) { - plCmdIfaceModMsg* pMsg = TRACKED_NEW plCmdIfaceModMsg; + plCmdIfaceModMsg* pMsg = new plCmdIfaceModMsg; pMsg->SetSender(k.getKey()); if (on) pMsg->SetCmd(plCmdIfaceModMsg::kAdd); @@ -2050,13 +2050,13 @@ void cyMisc::RegisterForControlEventMessages(hsBool on, pyKey& k) // PURPOSE : To request an LOS from a point on the screen // #include "plMessage/plLOSRequestMsg.h" -bool cyMisc::RequestLOSScreen(pyKey &selfkey, Int32 ID, hsScalar xPos, hsScalar yPos, hsScalar distance, int what, int reportType) +bool cyMisc::RequestLOSScreen(pyKey &selfkey, int32_t ID, float xPos, float yPos, float distance, int what, int reportType) { plPipeline* pipe = selfkey.GetPipeline(); if (pipe) { - Int32 x=(Int32) ( xPos * pipe->Width() ); - Int32 y=(Int32) ( yPos * pipe->Height() ); + int32_t x=(int32_t) ( xPos * pipe->Width() ); + int32_t y=(int32_t) ( yPos * pipe->Height() ); hsPoint3 endPos, startPos; @@ -2072,17 +2072,17 @@ bool cyMisc::RequestLOSScreen(pyKey &selfkey, Int32 ID, hsScalar xPos, hsScalar switch (what) { case kClickables: - pMsg = TRACKED_NEW plLOSRequestMsg( selfkey.getKey(), startPos, endPos, plSimDefs::kLOSDBUIItems, plLOSRequestMsg::kTestClosest ); + pMsg = new plLOSRequestMsg( selfkey.getKey(), startPos, endPos, plSimDefs::kLOSDBUIItems, plLOSRequestMsg::kTestClosest ); pMsg->SetCullDB(plSimDefs::kLOSDBUIBlockers); break; case kCameraBlockers: - pMsg = TRACKED_NEW plLOSRequestMsg( selfkey.getKey(), startPos, endPos, plSimDefs::kLOSDBCameraBlockers, plLOSRequestMsg::kTestClosest ); + pMsg = new plLOSRequestMsg( selfkey.getKey(), startPos, endPos, plSimDefs::kLOSDBCameraBlockers, plLOSRequestMsg::kTestClosest ); break; case kCustom: - pMsg = TRACKED_NEW plLOSRequestMsg( selfkey.getKey(), startPos, endPos, plSimDefs::kLOSDBCustom, plLOSRequestMsg::kTestClosest ); + pMsg = new plLOSRequestMsg( selfkey.getKey(), startPos, endPos, plSimDefs::kLOSDBCustom, plLOSRequestMsg::kTestClosest ); break; case kShootable: - pMsg = TRACKED_NEW plLOSRequestMsg( selfkey.getKey(), startPos, endPos, plSimDefs::kLOSDBShootableItems, plLOSRequestMsg::kTestClosest ); + pMsg = new plLOSRequestMsg( selfkey.getKey(), startPos, endPos, plSimDefs::kLOSDBShootableItems, plLOSRequestMsg::kTestClosest ); break; } @@ -2201,13 +2201,13 @@ bool cyMisc::IsEnterChatModeKeyBound() // PURPOSE : Shoots from screen coordinates, a bullet and makes a mark on objects that know about bullet holes // #include "plMessage/plBulletMsg.h" -void cyMisc::ShootBulletFromScreen(pyKey &selfkey, hsScalar xPos, hsScalar yPos, hsScalar radius, hsScalar range) +void cyMisc::ShootBulletFromScreen(pyKey &selfkey, float xPos, float yPos, float radius, float range) { plPipeline* pipe = selfkey.GetPipeline(); if (pipe) { - Int32 x=(Int32) ( xPos * pipe->Width() ); - Int32 y=(Int32) ( yPos * pipe->Height() ); + int32_t x=(int32_t) ( xPos * pipe->Width() ); + int32_t y=(int32_t) ( yPos * pipe->Height() ); hsPoint3 endPos, startPos; @@ -2219,7 +2219,7 @@ void cyMisc::ShootBulletFromScreen(pyKey &selfkey, hsScalar xPos, hsScalar yPos, view.Normalize(); startPos = startPos + (view * 1.5f); - plBulletMsg* bull = TRACKED_NEW plBulletMsg( selfkey.getKey(), nil, nil ); + plBulletMsg* bull = new plBulletMsg( selfkey.getKey(), nil, nil ); bull->FireShot(startPos, view, radius, range); bull->Send(); } @@ -2232,7 +2232,7 @@ void cyMisc::ShootBulletFromScreen(pyKey &selfkey, hsScalar xPos, hsScalar yPos, // // PURPOSE : Shoots from an object, a bullet and makes a mark on objects that know about bullet holes // -void cyMisc::ShootBulletFromObject(pyKey &selfkey, pySceneObject* sobj, hsScalar radius, hsScalar range) +void cyMisc::ShootBulletFromObject(pyKey &selfkey, pySceneObject* sobj, float radius, float range) { plSceneObject* so = plSceneObject::ConvertNoRef(sobj->getObjKey()->ObjectIsLoaded()); if( so ) @@ -2244,7 +2244,7 @@ void cyMisc::ShootBulletFromObject(pyKey &selfkey, pySceneObject* sobj, hsScalar dir.Normalize(); hsPoint3 pos = l2w.GetTranslate(); - plBulletMsg* bull = TRACKED_NEW plBulletMsg(selfkey.getKey(), nil, nil); + plBulletMsg* bull = new plBulletMsg(selfkey.getKey(), nil, nil); bull->FireShot(pos, dir, radius, range); bull->Send(); @@ -2274,9 +2274,9 @@ public: { Py_XDECREF( fPyObject ); } - void OperationStarted( UInt32 context ) + void OperationStarted( uint32_t context ) {} - void OperationComplete( UInt32 context, int resultCode ) + void OperationComplete( uint32_t context, int resultCode ) { if ( !fPyObject ) return; @@ -2299,10 +2299,10 @@ public: if ( ageInfoStream && nPlayersStream ) { - UInt16 nAgeInfoEntries; + uint16_t nAgeInfoEntries; ageInfoStream->GetStream()->ReadLE( &nAgeInfoEntries ); - UInt16 nPlayerCountEntries; + uint16_t nPlayerCountEntries; nPlayersStream->GetStream()->ReadLE( &nPlayerCountEntries ); hsAssert( nAgeInfoEntries==nPlayerCountEntries, "huh?" ); @@ -2313,7 +2313,7 @@ public: for ( int i=0; iGetStream(), nil ); nPlayersStream->GetStream()->ReadLE( &nPlayers ); PyObject* t = PyTuple_New(2); @@ -2421,7 +2421,7 @@ int cyMisc::GetKILevel() { int result = pfKIMsg::kNanoKI; - wchar wStr[MAX_PATH]; + wchar_t wStr[MAX_PATH]; StrToUnicode(wStr, pfKIMsg::kChronicleKILevel, arrsize(wStr)); if (RelVaultNode * rvn = VaultFindChronicleEntryIncRef(wStr)) { VaultChronicleNode chron(rvn); @@ -2515,7 +2515,7 @@ void cyMisc::PyClearCameraStack() void cyMisc::RecenterCamera() { - plCameraMsg* pCam = TRACKED_NEW plCameraMsg; + plCameraMsg* pCam = new plCameraMsg; pCam->SetBCastFlag(plMessage::kBCastByExactType); pCam->SetCmd(plCameraMsg::kResetPanning); pCam->Send(); @@ -2525,19 +2525,19 @@ void cyMisc::RecenterCamera() void cyMisc::FadeIn(float lenTime, bool holdFlag, bool noSound) { - plTransitionMsg *msg = TRACKED_NEW plTransitionMsg( noSound ? plTransitionMsg::kFadeInNoSound : plTransitionMsg::kFadeIn, lenTime, holdFlag ); + plTransitionMsg *msg = new plTransitionMsg( noSound ? plTransitionMsg::kFadeInNoSound : plTransitionMsg::kFadeIn, lenTime, holdFlag ); plgDispatch::MsgSend( msg ); } void cyMisc::FadeOut(float lenTime, bool holdFlag, bool noSound) { - plTransitionMsg *msg = TRACKED_NEW plTransitionMsg( noSound ? plTransitionMsg::kFadeOutNoSound : plTransitionMsg::kFadeOut, lenTime, holdFlag ); + plTransitionMsg *msg = new plTransitionMsg( noSound ? plTransitionMsg::kFadeOutNoSound : plTransitionMsg::kFadeOut, lenTime, holdFlag ); plgDispatch::MsgSend( msg ); } void cyMisc::SetClickability(hsBool b) { - plInputIfaceMgrMsg* msg = TRACKED_NEW plInputIfaceMgrMsg(b ? plInputIfaceMgrMsg::kEnableClickables : plInputIfaceMgrMsg::kDisableClickables ); + plInputIfaceMgrMsg* msg = new plInputIfaceMgrMsg(b ? plInputIfaceMgrMsg::kEnableClickables : plInputIfaceMgrMsg::kDisableClickables ); plgDispatch::MsgSend(msg); } @@ -2558,7 +2558,7 @@ void cyMisc::DebugAssert( bool cond, const char * msg ) // // PURPOSE : script can trigger itself over time w/o having to specify it in the dataset. // -void cyMisc::SetAlarm( float secs, PyObject * cb, UInt32 cbContext ) +void cyMisc::SetAlarm( float secs, PyObject * cb, uint32_t cbContext ) { pyAlarmMgr::GetInstance()->SetAlarm( secs, cb, cbContext ); } @@ -2598,7 +2598,7 @@ void cyMisc::StartScreenCapture(pyKey& selfkey) cyMisc::StartScreenCaptureWH(selfkey, 800, 600); } -void cyMisc::StartScreenCaptureWH(pyKey& selfkey, UInt16 width, UInt16 height) +void cyMisc::StartScreenCaptureWH(pyKey& selfkey, uint16_t width, uint16_t height) { plCaptureRender::Capture(selfkey.getKey(), width, height); } @@ -2636,7 +2636,7 @@ void cyMisc::WearDefaultClothing(pyKey& key) } } -void cyMisc::WearDefaultClothingType(pyKey& key, UInt32 type) +void cyMisc::WearDefaultClothingType(pyKey& key, uint32_t type) { if (key.getKey() != plNetClientMgr::GetInstance()->GetLocalPlayerKey()) return; @@ -2659,7 +2659,7 @@ void cyMisc::WearDefaultClothingType(pyKey& key, UInt32 type) void cyMisc::FakeLinkToObject(pyKey& avatar, pyKey& object) { - plPseudoLinkEffectMsg* msg = TRACKED_NEW plPseudoLinkEffectMsg; + plPseudoLinkEffectMsg* msg = new plPseudoLinkEffectMsg; msg->fAvatarKey = avatar.getKey(); msg->fLinkObjKey = object.getKey(); plgDispatch::MsgSend(msg); @@ -2675,7 +2675,7 @@ void cyMisc::FakeLinkToObjectNamed(const plString& name) if (!key) return; - plPseudoLinkEffectMsg* msg = TRACKED_NEW plPseudoLinkEffectMsg; + plPseudoLinkEffectMsg* msg = new plPseudoLinkEffectMsg; msg->fAvatarKey = plNetClientMgr::GetInstance()->GetLocalPlayerKey(); msg->fLinkObjKey = key; plgDispatch::MsgSend(msg); @@ -2752,7 +2752,7 @@ void cyMisc::SetGraphicsOptions(int Width, int Height, int ColorDepth, hsBool Wi // This has to send a message to plClient because python is loaded in the max plugins plKey clientKey = hsgResMgr::ResMgr()->FindKey( kClient_KEY ); - plClientMsg* clientMsg = TRACKED_NEW plClientMsg(plClientMsg::kResetGraphicsDevice); + plClientMsg* clientMsg = new plClientMsg(plClientMsg::kResetGraphicsDevice); clientMsg->AddReceiver(clientKey); //clientMsg->SetBCastFlag(plMessage::kBCastByType); clientMsg->fGraphicsSettings.fWidth = Width; @@ -2808,7 +2808,7 @@ void cyMisc::SetBehaviorNetFlags(pyKey & behKey, hsBool netForce, hsBool netProp } } -void cyMisc::SendFriendInvite(const wchar email[], const wchar toName[]) +void cyMisc::SendFriendInvite(const wchar_t email[], const wchar_t toName[]) { if (RelVaultNode* pNode = VaultGetPlayerNodeIncRef()) { diff --git a/Sources/Plasma/FeatureLib/pfPython/cyMisc.h b/Sources/Plasma/FeatureLib/pfPython/cyMisc.h index 706a70a6..2d1c25f6 100644 --- a/Sources/Plasma/FeatureLib/pfPython/cyMisc.h +++ b/Sources/Plasma/FeatureLib/pfPython/cyMisc.h @@ -58,7 +58,7 @@ class pyAgeInfoStruct; class pyPoint3; #include -#include "hsTypes.h" +#include "HeadSpin.h" #include "hsStlUtils.h" #include "pnUtils/pnUtils.h" @@ -74,8 +74,8 @@ class cyMisc // this is only for the C++ side // The pipeline is set in the plClient static plPipeline* fPipeline; - static UInt32 fUniqueNumber; - static UInt32 fPythonLoggingLevel; + static uint32_t fUniqueNumber; + static uint32_t fPythonLoggingLevel; public: // periodically do things @@ -119,8 +119,8 @@ public: kShootable }; - static UInt32 GetPythonLoggingLevel(); - static void SetPythonLoggingLevel(UInt32 new_level); + static uint32_t GetPythonLoggingLevel(); + static void SetPythonLoggingLevel(uint32_t new_level); ///////////////////////////////////////////////////////////////////////////// // @@ -161,7 +161,7 @@ public: // // PURPOSE : Execute a console command from a python script // - static void TimerCallback(pyKey& selfkey, hsScalar time, UInt32 id); + static void TimerCallback(pyKey& selfkey, float time, uint32_t id); ///////////////////////////////////////////////////////////////////////////// // @@ -212,7 +212,7 @@ public: // // PURPOSE : set the Python modifier to be dirty and asked to be saved out // - static void SetDirtySyncState(pyKey &selfkey, const char* SDLStateName, UInt32 sendFlags); + static void SetDirtySyncState(pyKey &selfkey, const char* SDLStateName, uint32_t sendFlags); ///////////////////////////////////////////////////////////////////////////// // @@ -222,7 +222,7 @@ public: // PURPOSE : set the Python modifier to be dirty and asked to be saved out // specifies that state should be sent to other clients as well as server // - static void SetDirtySyncStateWithClients(pyKey &selfkey, const char* SDLStateName, UInt32 sendFlags); + static void SetDirtySyncStateWithClients(pyKey &selfkey, const char* SDLStateName, uint32_t sendFlags); ///////////////////////////////////////////////////////////////////////////// // @@ -289,7 +289,7 @@ public: static const char* GetPrevAgeName(); static PyObject* GetPrevAgeInfo(); // current time in current age - static UInt32 GetAgeTime( void ); + static uint32_t GetAgeTime( void ); static time_t GetDniTime(void); static time_t ConvertGMTtoDni(time_t time); static time_t GetServerTime( void ); // returns the current server time in GMT @@ -308,8 +308,8 @@ public: kExRegRelease = 0, kExRegClear = 1, }; - static void ExcludeRegionSet(pyKey& sender, pyKey& exKey, UInt16 state); - static void ExcludeRegionSetNow(pyKey& sender, pyKey& exKey, UInt16 state); + static void ExcludeRegionSet(pyKey& sender, pyKey& exKey, uint16_t state); + static void ExcludeRegionSetNow(pyKey& sender, pyKey& exKey, uint16_t state); ///////////////////////////////////////////////////////////////////////////// @@ -335,7 +335,7 @@ public: // // PURPOSE : Return the frame delta seconds // - static hsScalar GetDelSysSeconds(); + static float GetDelSysSeconds(); ///////////////////////////////////////////////////////////////////////////// @@ -387,7 +387,7 @@ public: // // PURPOSE : Return the frame delta seconds // - static PyObject* GetDialogFromTagID(UInt32 tag); // returns pyGUIDialog + static PyObject* GetDialogFromTagID(uint32_t tag); // returns pyGUIDialog static PyObject* GetDialogFromString(const char* name); // returns pyGUIDialog ///////////////////////////////////////////////////////////////////////////// @@ -423,8 +423,8 @@ public: static std::vector GetPlayerList(); // list of pyPlayer static std::vector GetPlayerListDistanceSorted(); // list of pyPlayer - static UInt32 GetMaxListenListSize(); - static hsScalar GetMaxListenDistSq(); + static uint32_t GetMaxListenListSize(); + static float GetMaxListenDistSq(); ///////////////////////////////////////////////////////////////////////////// // @@ -439,8 +439,8 @@ public: // // RETURNS : the flags that were sent with the message (may be modified) // - static UInt32 SendRTChat(pyPlayer& from, const std::vector & tolist, const char* message, UInt32 flags); - static UInt32 SendRTChat(pyPlayer& from, const std::vector & tolist, const wchar_t* message, UInt32 flags); + static uint32_t SendRTChat(pyPlayer& from, const std::vector & tolist, const char* message, uint32_t flags); + static uint32_t SendRTChat(pyPlayer& from, const std::vector & tolist, const wchar_t* message, uint32_t flags); ///////////////////////////////////////////////////////////////////////////// // @@ -452,7 +452,7 @@ public: // // RETURNS : nothing // - static void SendKIMessage(UInt32 command, hsScalar value); + static void SendKIMessage(uint32_t command, float value); ///////////////////////////////////////////////////////////////////////////// // @@ -464,20 +464,20 @@ public: // // RETURNS : nothing // - static void SendKIMessageS(UInt32 command, const wchar_t* value); + static void SendKIMessageS(uint32_t command, const wchar_t* value); ///////////////////////////////////////////////////////////////////////////// // // Function : SendKIMessageI // PARAMETERS : command - the command type - // : value - extra value as an Int32 + // : value - extra value as an int32_t // // PURPOSE : Send message to the KI, to tell it things to do // // RETURNS : nothing // - static void SendKIMessageI(UInt32 command, Int32 value); - static void SendKIGZMarkerMsg(Int32 markerNumber, pyKey& sender); + static void SendKIMessageI(uint32_t command, int32_t value); + static void SendKIGZMarkerMsg(int32_t markerNumber, pyKey& sender); static void SendKIRegisterImagerMsg(const char* imagerName, pyKey& sender); ///////////////////////////////////////////////////////////////////////////// @@ -545,7 +545,7 @@ public: // PURPOSE : Send a petition to the CCR for help or questions // static void SendPetitionToCCR(const char* message); - static void SendPetitionToCCRI(const char* message, UInt8 reason,const char* title); + static void SendPetitionToCCRI(const char* message, uint8_t reason,const char* title); ///////////////////////////////////////////////////////////////////////////// // @@ -554,7 +554,7 @@ public: // // PURPOSE : Send a petition to the CCR for help or questions // - static void SendChatToCCR(const char* message,Int32 CCRPlayerID); + static void SendChatToCCR(const char* message,int32_t CCRPlayerID); ///////////////////////////////////////////////////////////////////////////// // @@ -617,9 +617,9 @@ public: // static void EnableOfferBookMode(pyKey& selfkey, const char* ageFileName, const char* ageInstanceName); static void DisableOfferBookMode(); - static void NotifyOffererPublicLinkAccepted(UInt32 offerer); - static void NotifyOffererPublicLinkRejected(UInt32 offerer); - static void NotifyOffererPublicLinkCompleted(UInt32 offerer); + static void NotifyOffererPublicLinkAccepted(uint32_t offerer); + static void NotifyOffererPublicLinkRejected(uint32_t offerer); + static void NotifyOffererPublicLinkCompleted(uint32_t offerer); static void ToggleAvatarClickability(hsBool on); static void SetShareSpawnPoint(const char* spawnPoint); static void SetShareAgeInstanceGuid(const Uuid& guid); @@ -676,7 +676,7 @@ public: // // PURPOSE : To request an LOS from a point on the screen // - static bool RequestLOSScreen(pyKey &selfkey, Int32 ID, hsScalar xPos, hsScalar yPos, hsScalar distance, int what, int reportType); + static bool RequestLOSScreen(pyKey &selfkey, int32_t ID, float xPos, float yPos, float distance, int what, int reportType); ////////////////////////////////////////////////////////////////////////////// // @@ -697,7 +697,7 @@ public: static void SetParticleOffset(float x, float y, float z, pyKey& particles); static void KillParticles(float time, float pct, pyKey& particles); static int GetNumParticles(pyKey& host); - static void SetLightColorValue(pyKey& light, const plString& lightName, hsScalar r, hsScalar g, hsScalar b, hsScalar a); + static void SetLightColorValue(pyKey& light, const plString& lightName, float r, float g, float b, float a); static void SetLightAnimationOn(pyKey& light, const plString& lightName, hsBool start); ////////////////////////////////////////////////////////////////////////////// // @@ -745,7 +745,7 @@ public: // // PURPOSE : Shoots from screen coordinates, a bullet and makes a mark on objects that know about bullet holes // - static void ShootBulletFromScreen(pyKey &selfkey, hsScalar xPos, hsScalar yPos, hsScalar radius, hsScalar range); + static void ShootBulletFromScreen(pyKey &selfkey, float xPos, float yPos, float radius, float range); ////////////////////////////////////////////////////////////////////////////// // @@ -754,7 +754,7 @@ public: // // PURPOSE : Shoots from an object, a bullet and makes a mark on objects that know about bullet holes // - static void ShootBulletFromObject(pyKey &selfkey, pySceneObject* sobj, hsScalar radius, hsScalar range); + static void ShootBulletFromObject(pyKey &selfkey, pySceneObject* sobj, float radius, float range); ////////////////////////////////////////////////////////////////////////////// // @@ -839,7 +839,7 @@ public: // // PURPOSE : script can trigger itself over time w/o having to specify it in the dataset. // - static void SetAlarm( float secs, PyObject * cb, UInt32 cbContext ); + static void SetAlarm( float secs, PyObject * cb, uint32_t cbContext ); ////////////////////////////////////////////////////////////////////////////// // @@ -857,7 +857,7 @@ public: // update and a plCaptureRenderMsg when its ready // static void StartScreenCapture(pyKey& selfkey); - static void StartScreenCaptureWH(pyKey& selfkey, UInt16 width, UInt16 height); + static void StartScreenCaptureWH(pyKey& selfkey, uint16_t width, uint16_t height); ////////////////////////////////////////////////////////////////////////////// // @@ -868,7 +868,7 @@ public: static void WearMaintainerSuit(pyKey& key, hsBool wear); static void WearDefaultClothing(pyKey& key); - static void WearDefaultClothingType(pyKey& key, UInt32 type); + static void WearDefaultClothingType(pyKey& key, uint32_t type); ////////////////////////////////////////////////////////////////////////////// // @@ -927,7 +927,7 @@ public: static std::wstring GetInitPath(); static void SetBehaviorNetFlags(pyKey & behKey, hsBool netForce, hsBool netProp); - static void SendFriendInvite(const wchar email[], const wchar toName[]); + static void SendFriendInvite(const wchar_t email[], const wchar_t toName[]); static PyObject* PyGuidGenerate(); static PyObject* GetAIAvatarsByModelName(const char* name); static void ForceVaultNodeUpdate(unsigned nodeId); diff --git a/Sources/Plasma/FeatureLib/pfPython/cyMiscGlue.cpp b/Sources/Plasma/FeatureLib/pfPython/cyMiscGlue.cpp index 2ff81a00..57740e98 100644 --- a/Sources/Plasma/FeatureLib/pfPython/cyMiscGlue.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/cyMiscGlue.cpp @@ -44,7 +44,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "pyKey.h" #include "pyPlayer.h" -#include "hsUtils.h" + #include @@ -256,10 +256,10 @@ PYTHON_GLOBAL_METHOD_DEFINITION(PtSendRTChat, args, "Params: fromPlayer,toPlayer else if (PyUnicode_Check(message)) { int size = PyUnicode_GetSize(message); - wchar_t* msg = TRACKED_NEW wchar_t[size + 1]; msg[size] = 0; + wchar_t* msg = new wchar_t[size + 1]; msg[size] = 0; PyUnicode_AsWideChar((PyUnicodeObject*)message, msg, size); - UInt32 retval = cyMisc::SendRTChat(*fromPlayer, toPlayerList, msg, msgFlags); - DEL(msg); + uint32_t retval = cyMisc::SendRTChat(*fromPlayer, toPlayerList, msg, msgFlags); + delete msg; return PyLong_FromUnsignedLong(retval); } else @@ -289,7 +289,7 @@ PYTHON_GLOBAL_METHOD_DEFINITION(PtSendKIMessage, args, "Params: command,value\nS else if (PyUnicode_Check(val)) { int len = PyUnicode_GetSize(val); - wchar_t* buffer = TRACKED_NEW wchar_t[len + 1]; + wchar_t* buffer = new wchar_t[len + 1]; PyUnicode_AsWideChar((PyUnicodeObject*)val, buffer, len); buffer[len] = L'\0'; cyMisc::SendKIMessageS(command, buffer); @@ -314,7 +314,7 @@ PYTHON_GLOBAL_METHOD_DEFINITION(PtSendKIMessage, args, "Params: command,value\nS PYTHON_RETURN_NONE; } -PYTHON_GLOBAL_METHOD_DEFINITION(PtSendKIMessageInt, args, "Params: command,value\nSame as PtSendKIMessage except the value is guaranteed to be a UInt32\n" +PYTHON_GLOBAL_METHOD_DEFINITION(PtSendKIMessageInt, args, "Params: command,value\nSame as PtSendKIMessage except the value is guaranteed to be a uint32_t\n" "(for things like player IDs)") { unsigned long command; @@ -352,7 +352,7 @@ PYTHON_GLOBAL_METHOD_DEFINITION(PtLoadAvatarModel, args, "Params: modelName, spa if (PyUnicode_Check(userStrObj)) { int len = PyUnicode_GetSize(userStrObj); - wchar_t* buffer = TRACKED_NEW wchar_t[len + 1]; + wchar_t* buffer = new wchar_t[len + 1]; PyUnicode_AsWideChar((PyUnicodeObject*)userStrObj, buffer, len); buffer[len] = L'\0'; char* temp = hsWStringToString(buffer); @@ -412,7 +412,7 @@ PYTHON_GLOBAL_METHOD_DEFINITION(PtGetLocalizedString, args, "Params: name, argum if (PyUnicode_Check(nameObj)) { int len = PyUnicode_GetSize(nameObj); - wchar_t* buffer = TRACKED_NEW wchar_t[len + 1]; + wchar_t* buffer = new wchar_t[len + 1]; PyUnicode_AsWideChar((PyUnicodeObject*)nameObj, buffer, len); buffer[len] = L'\0'; name = buffer; @@ -450,7 +450,7 @@ PYTHON_GLOBAL_METHOD_DEFINITION(PtGetLocalizedString, args, "Params: name, argum else if (PyUnicode_Check(item)) { int strLen = PyUnicode_GetSize(item); - wchar_t* buffer = TRACKED_NEW wchar_t[strLen + 1]; + wchar_t* buffer = new wchar_t[strLen + 1]; PyUnicode_AsWideChar((PyUnicodeObject*)item, buffer, strLen); buffer[strLen] = L'\0'; arg = buffer; @@ -485,7 +485,7 @@ PYTHON_GLOBAL_METHOD_DEFINITION(PtDumpLogs, args, "Params: folder\nDumps all cur if (PyUnicode_Check(folderObj)) { int len = PyUnicode_GetSize(folderObj); - wchar_t* buffer = TRACKED_NEW wchar_t[len + 1]; + wchar_t* buffer = new wchar_t[len + 1]; PyUnicode_AsWideChar((PyUnicodeObject*)folderObj, buffer, len); buffer[len] = L'\0'; bool retVal = cyMisc::DumpLogs(buffer); @@ -553,4 +553,4 @@ void cyMisc::AddPlasmaMethods(std::vector &methods) AddPlasmaMethods2(methods); AddPlasmaMethods3(methods); AddPlasmaMethods4(methods); -} \ No newline at end of file +} diff --git a/Sources/Plasma/FeatureLib/pfPython/cyMiscGlue2.cpp b/Sources/Plasma/FeatureLib/pfPython/cyMiscGlue2.cpp index d56bc254..348931cc 100644 --- a/Sources/Plasma/FeatureLib/pfPython/cyMiscGlue2.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/cyMiscGlue2.cpp @@ -73,7 +73,7 @@ PYTHON_GLOBAL_METHOD_DEFINITION(PtYesNoDialog, args, "Params: selfkey,dialogMess if (PyUnicode_Check(dialogMsgObj)) { int len = PyUnicode_GetSize(dialogMsgObj); - wchar_t* text = TRACKED_NEW wchar_t[len + 1]; + wchar_t* text = new wchar_t[len + 1]; PyUnicode_AsWideChar((PyUnicodeObject*)dialogMsgObj, text, len); text[len] = L'\0'; cyMisc::YesNoDialog(*key, text); diff --git a/Sources/Plasma/FeatureLib/pfPython/cyMiscGlue3.cpp b/Sources/Plasma/FeatureLib/pfPython/cyMiscGlue3.cpp index 1cf5b4bd..1c85c139 100644 --- a/Sources/Plasma/FeatureLib/pfPython/cyMiscGlue3.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/cyMiscGlue3.cpp @@ -629,7 +629,7 @@ PYTHON_GLOBAL_METHOD_DEFINITION(PtFileExists, args, "Params: filename\nReturns t if (PyUnicode_Check(filenameObj)) { int strLen = PyUnicode_GetSize(filenameObj); - wchar_t* text = TRACKED_NEW wchar_t[strLen + 1]; + wchar_t* text = new wchar_t[strLen + 1]; PyUnicode_AsWideChar((PyUnicodeObject*)filenameObj, text, strLen); text[strLen] = L'\0'; bool retVal = cyMisc::FileExists(text); @@ -664,7 +664,7 @@ PYTHON_GLOBAL_METHOD_DEFINITION(PtCreateDir, args, "Params: directory\nCreates t if (PyUnicode_Check(directoryObj)) { int strLen = PyUnicode_GetSize(directoryObj); - wchar_t* text = TRACKED_NEW wchar_t[strLen + 1]; + wchar_t* text = new wchar_t[strLen + 1]; PyUnicode_AsWideChar((PyUnicodeObject*)directoryObj, text, strLen); text[strLen] = L'\0'; bool retVal = cyMisc::CreateDir(text); diff --git a/Sources/Plasma/FeatureLib/pfPython/cyMiscGlue4.cpp b/Sources/Plasma/FeatureLib/pfPython/cyMiscGlue4.cpp index 3897bc3e..561af055 100644 --- a/Sources/Plasma/FeatureLib/pfPython/cyMiscGlue4.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/cyMiscGlue4.cpp @@ -666,11 +666,11 @@ PYTHON_GLOBAL_METHOD_DEFINITION(PtSendFriendInvite, args, "Params: emailAddress, PYTHON_RETURN_ERROR; } - wchar emailAddr[kMaxEmailAddressLength]; - MemSet(emailAddr, 0, sizeof(emailAddr)); + wchar_t emailAddr[kMaxEmailAddressLength]; + memset(emailAddr, 0, sizeof(emailAddr)); - wchar toName[kMaxPlayerNameLength]; - MemSet(toName, 0, sizeof(toName)); + wchar_t toName[kMaxPlayerNameLength]; + memset(toName, 0, sizeof(toName)); // Check and see if the email address is ok int origStrLen = 0; diff --git a/Sources/Plasma/FeatureLib/pfPython/cyParticleSys.cpp b/Sources/Plasma/FeatureLib/pfPython/cyParticleSys.cpp index 0914d013..cdf617dd 100644 --- a/Sources/Plasma/FeatureLib/pfPython/cyParticleSys.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/cyParticleSys.cpp @@ -79,9 +79,9 @@ void cyParticleSys::SetNetForce(hsBool state) // // PURPOSE : send the message to the Particle System // -void cyParticleSys::ISendParticleSysMsg(UInt32 param, hsScalar value) +void cyParticleSys::ISendParticleSysMsg(uint32_t param, float value) { - plParticleUpdateMsg* pMsg = TRACKED_NEW plParticleUpdateMsg(fSender, nil, nil, param, value); + plParticleUpdateMsg* pMsg = new plParticleUpdateMsg(fSender, nil, nil, param, value); // check if this needs to be network forced to all clients if (fNetForce ) { @@ -103,62 +103,62 @@ void cyParticleSys::ISendParticleSysMsg(UInt32 param, hsScalar value) // // All these methods just call the IsendParticleSysMsg to do the real work // -void cyParticleSys::SetParticlesPerSecond(hsScalar value) +void cyParticleSys::SetParticlesPerSecond(float value) { ISendParticleSysMsg(plParticleUpdateMsg::kParamParticlesPerSecond,value); } -void cyParticleSys::SetInitPitchRange(hsScalar value) +void cyParticleSys::SetInitPitchRange(float value) { ISendParticleSysMsg(plParticleUpdateMsg::kParamInitPitchRange,value); } -void cyParticleSys::SetInitYawRange(hsScalar value) +void cyParticleSys::SetInitYawRange(float value) { ISendParticleSysMsg(plParticleUpdateMsg::kParamInitYawRange,value); } -void cyParticleSys::SetVelMin(hsScalar value) +void cyParticleSys::SetVelMin(float value) { ISendParticleSysMsg(plParticleUpdateMsg::kParamVelMin,value); } -void cyParticleSys::SetVelMax(hsScalar value) +void cyParticleSys::SetVelMax(float value) { ISendParticleSysMsg(plParticleUpdateMsg::kParamVelMax,value); } -void cyParticleSys::SetXSize(hsScalar value) +void cyParticleSys::SetXSize(float value) { ISendParticleSysMsg(plParticleUpdateMsg::kParamXSize,value); } -void cyParticleSys::SetYSize(hsScalar value) +void cyParticleSys::SetYSize(float value) { ISendParticleSysMsg(plParticleUpdateMsg::kParamYSize,value); } -void cyParticleSys::SetScaleMin(hsScalar value) +void cyParticleSys::SetScaleMin(float value) { ISendParticleSysMsg(plParticleUpdateMsg::kParamScaleMin,value); } -void cyParticleSys::SetScaleMax(hsScalar value) +void cyParticleSys::SetScaleMax(float value) { ISendParticleSysMsg(plParticleUpdateMsg::kParamScaleMax,value); } -void cyParticleSys::SetGenLife(hsScalar value) +void cyParticleSys::SetGenLife(float value) { ISendParticleSysMsg(plParticleUpdateMsg::kParamGenLife,value); } -void cyParticleSys::SetPartLifeMin(hsScalar value) +void cyParticleSys::SetPartLifeMin(float value) { ISendParticleSysMsg(plParticleUpdateMsg::kParamPartLifeMin,value); } -void cyParticleSys::SetPartLifeMax(hsScalar value) +void cyParticleSys::SetPartLifeMax(float value) { ISendParticleSysMsg(plParticleUpdateMsg::kParamPartLifeMax,value); } diff --git a/Sources/Plasma/FeatureLib/pfPython/cyParticleSys.h b/Sources/Plasma/FeatureLib/pfPython/cyParticleSys.h index d59ca25c..4065a6a2 100644 --- a/Sources/Plasma/FeatureLib/pfPython/cyParticleSys.h +++ b/Sources/Plasma/FeatureLib/pfPython/cyParticleSys.h @@ -63,7 +63,7 @@ protected: hsTArray fRecvr; hsBool fNetForce; - virtual void ISendParticleSysMsg(UInt32 param, hsScalar value); + virtual void ISendParticleSysMsg(uint32_t param, float value); cyParticleSys(const plKey sender=nil,const plKey recvr=nil); @@ -81,18 +81,18 @@ public: virtual void AddRecvr(plKey &recvr); virtual void SetNetForce(hsBool state); - virtual void SetParticlesPerSecond(hsScalar value); - virtual void SetInitPitchRange(hsScalar value); - virtual void SetInitYawRange(hsScalar value); - virtual void SetVelMin(hsScalar value); - virtual void SetVelMax(hsScalar value); - virtual void SetXSize(hsScalar value); - virtual void SetYSize(hsScalar value); - virtual void SetScaleMin(hsScalar value); - virtual void SetScaleMax(hsScalar value); - virtual void SetGenLife(hsScalar value); - virtual void SetPartLifeMin(hsScalar value); - virtual void SetPartLifeMax(hsScalar value); + virtual void SetParticlesPerSecond(float value); + virtual void SetInitPitchRange(float value); + virtual void SetInitYawRange(float value); + virtual void SetVelMin(float value); + virtual void SetVelMax(float value); + virtual void SetXSize(float value); + virtual void SetYSize(float value); + virtual void SetScaleMin(float value); + virtual void SetScaleMax(float value); + virtual void SetGenLife(float value); + virtual void SetPartLifeMin(float value); + virtual void SetPartLifeMax(float value); }; diff --git a/Sources/Plasma/FeatureLib/pfPython/cyPhysics.cpp b/Sources/Plasma/FeatureLib/pfPython/cyPhysics.cpp index b21b9d07..5a5d2588 100644 --- a/Sources/Plasma/FeatureLib/pfPython/cyPhysics.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/cyPhysics.cpp @@ -95,7 +95,7 @@ void cyPhysics::EnableT(hsBool state) if ( fRecvr.Count() > 0 ) { // create message - plEnableMsg* pMsg = TRACKED_NEW plEnableMsg; + plEnableMsg* pMsg = new plEnableMsg; // check if this needs to be network forced to all clients if (fNetForce ) { @@ -150,7 +150,7 @@ void cyPhysics::EnableCollision() // must have a receiver! if ( fRecvr.Count() > 0 ) { - plEventGroupEnableMsg* pMsg = TRACKED_NEW plEventGroupEnableMsg; + plEventGroupEnableMsg* pMsg = new plEventGroupEnableMsg; if (fNetForce ) { // set the network propagate flag to make sure it gets to the other clients @@ -179,7 +179,7 @@ void cyPhysics::DisableCollision() // must have a receiver! if ( fRecvr.Count() > 0 ) { - plEventGroupEnableMsg* pMsg = TRACKED_NEW plEventGroupEnableMsg; + plEventGroupEnableMsg* pMsg = new plEventGroupEnableMsg; if (fNetForce ) { // set the network propagate flag to make sure it gets to the other clients @@ -251,7 +251,7 @@ void cyPhysics::WarpMat(pyMatrix44& mat) if ( fRecvr.Count() > 0 ) { // create message - plWarpMsg* pMsg = TRACKED_NEW plWarpMsg(mat.fMatrix); + plWarpMsg* pMsg = new plWarpMsg(mat.fMatrix); pMsg->SetWarpFlags(plWarpMsg::kFlushTransform); // check if this needs to be network forced to all clients if (fNetForce ) @@ -283,7 +283,7 @@ void cyPhysics::WarpMat(pyMatrix44& mat) // : if the object is physical then warp it // : otherwise just use the coordinate interface and set the transform // -void cyPhysics::Move(pyVector3& direction, hsScalar distance) +void cyPhysics::Move(pyVector3& direction, float distance) { //move each receiver (object) separately int i; @@ -310,7 +310,7 @@ void cyPhysics::Move(pyVector3& direction, hsScalar distance) if ( si ) { // create message for each receiver - plWarpMsg* pMsg = TRACKED_NEW plWarpMsg(target_matrix); + plWarpMsg* pMsg = new plWarpMsg(target_matrix); // check if this needs to be network forced to all clients if (fNetForce ) { @@ -352,7 +352,7 @@ void cyPhysics::Move(pyVector3& direction, hsScalar distance) // : if the object is physical then warp it // : otherwise just use the coordinate interface and set the transform // -void cyPhysics::Rotate(hsScalar rad, pyVector3& axis) +void cyPhysics::Rotate(float rad, pyVector3& axis) { // rotate each receiver (object) separately int i; @@ -380,7 +380,7 @@ void cyPhysics::Rotate(hsScalar rad, pyVector3& axis) if ( si ) { // create message for each receiver - plWarpMsg* pMsg = TRACKED_NEW plWarpMsg(target_matrix); + plWarpMsg* pMsg = new plWarpMsg(target_matrix); // check if this needs to be network forced to all clients if (fNetForce ) { @@ -427,7 +427,7 @@ void cyPhysics::Force(pyVector3& force) /* if ( fRecvr.Count() > 0 ) { // create message - plForceMsg* pMsg = TRACKED_NEW plForceMsg; + plForceMsg* pMsg = new plForceMsg; // check if this needs to be network forced to all clients if (fNetForce ) { @@ -466,7 +466,7 @@ void cyPhysics::ForceWithOffset(pyVector3& force, pyPoint3& offset) /* if ( fRecvr.Count() > 0 ) { // create message - plOffsetForceMsg* pMsg = TRACKED_NEW plOffsetForceMsg; + plOffsetForceMsg* pMsg = new plOffsetForceMsg; // check if this needs to be network forced to all clients if (fNetForce ) { @@ -506,7 +506,7 @@ void cyPhysics::Torque(pyVector3& torque) /* if ( fRecvr.Count() > 0 ) { // create message - plTorqueMsg* pMsg = TRACKED_NEW plTorqueMsg; + plTorqueMsg* pMsg = new plTorqueMsg; // check if this needs to be network forced to all clients if (fNetForce ) { @@ -544,7 +544,7 @@ void cyPhysics::Impulse(pyVector3& impulse) /* if ( fRecvr.Count() > 0 ) { // create message - plImpulseMsg* pMsg = TRACKED_NEW plImpulseMsg; + plImpulseMsg* pMsg = new plImpulseMsg; // check if this needs to be network forced to all clients if (fNetForce ) { @@ -583,7 +583,7 @@ void cyPhysics::ImpulseWithOffset(pyVector3& impulse, pyPoint3& offset) /* if ( fRecvr.Count() > 0 ) { // create message - plOffsetImpulseMsg* pMsg = TRACKED_NEW plOffsetImpulseMsg; + plOffsetImpulseMsg* pMsg = new plOffsetImpulseMsg; // check if this needs to be network forced to all clients if (fNetForce ) { @@ -622,7 +622,7 @@ void cyPhysics::AngularImpulse(pyVector3& impulse) /* if ( fRecvr.Count() > 0 ) { // create message - plAngularImpulseMsg* pMsg = TRACKED_NEW plAngularImpulseMsg; + plAngularImpulseMsg* pMsg = new plAngularImpulseMsg; // check if this needs to be network forced to all clients if (fNetForce ) { @@ -655,14 +655,14 @@ void cyPhysics::AngularImpulse(pyVector3& impulse) // : A damp factor of 1 leaves them alone. // // -void cyPhysics::Damp(hsScalar damp) +void cyPhysics::Damp(float damp) { hsAssert(0, "Who uses this?"); // must have a receiver! /* if ( fRecvr.Count() > 0 ) { // create message - plDampMsg* pMsg = TRACKED_NEW plDampMsg; + plDampMsg* pMsg = new plDampMsg; // check if this needs to be network forced to all clients if (fNetForce ) { @@ -701,7 +701,7 @@ void cyPhysics::ShiftMass(pyVector3& offset) /* if ( fRecvr.Count() > 0 ) { // create message - plShiftMassMsg* pMsg = TRACKED_NEW plShiftMassMsg; + plShiftMassMsg* pMsg = new plShiftMassMsg; // check if this needs to be network forced to all clients if (fNetForce ) { @@ -752,7 +752,7 @@ void cyPhysics::SetLinearVelocity(pyVector3& velocity) if ( fRecvr.Count() > 0 ) { // create message - plLinearVelocityMsg* pMsg = TRACKED_NEW plLinearVelocityMsg; + plLinearVelocityMsg* pMsg = new plLinearVelocityMsg; // check if this needs to be network forced to all clients if (fNetForce ) { @@ -779,7 +779,7 @@ void cyPhysics::SetAngularVelocity(pyVector3& angVel) if ( fRecvr.Count() > 0 ) { // create message - plAngularVelocityMsg* pMsg = TRACKED_NEW plAngularVelocityMsg; + plAngularVelocityMsg* pMsg = new plAngularVelocityMsg; // check if this needs to be network forced to all clients if (fNetForce ) { diff --git a/Sources/Plasma/FeatureLib/pfPython/cyPhysics.h b/Sources/Plasma/FeatureLib/pfPython/cyPhysics.h index e23275ed..b1e61a16 100644 --- a/Sources/Plasma/FeatureLib/pfPython/cyPhysics.h +++ b/Sources/Plasma/FeatureLib/pfPython/cyPhysics.h @@ -102,12 +102,12 @@ public: // Move the object in a direction and distance // if the object is physical then warp it // otherwise just use the coordinate interface and set the transform - virtual void Move(pyVector3& direction, hsScalar distance); + virtual void Move(pyVector3& direction, float distance); // Rotate the object // if the object is physical then warp it // otherwise just use the coordinate interface and set the transform - virtual void Rotate(hsScalar rad, pyVector3& axis); + virtual void Rotate(float rad, pyVector3& axis); // apply a force to the center of mass of the receiver virtual void Force(pyVector3& force); @@ -133,7 +133,7 @@ public: // Decrease all velocities on the given object. // A damp factor of 0 nulls them all entirely; // A damp factor of 1 leaves them alone. - virtual void Damp(hsScalar damp); + virtual void Damp(float damp); // Shift the center of mass of the given object by the given // amount in the given direction. diff --git a/Sources/Plasma/FeatureLib/pfPython/cyPythonInterface.cpp b/Sources/Plasma/FeatureLib/pfPython/cyPythonInterface.cpp index 401ee4c2..a5fcf5f7 100644 --- a/Sources/Plasma/FeatureLib/pfPython/cyPythonInterface.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/cyPythonInterface.cpp @@ -176,7 +176,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "Games/VarSync/pyVarSyncMsg.h" #include "Games/VarSync/pyVarSyncGame.h" -Int32 PythonInterface::initialized = 0; // only need to initialize all of Python once +int32_t PythonInterface::initialized = 0; // only need to initialize all of Python once hsBool PythonInterface::FirstTimeInit = true; // start with "this is the first time" hsBool PythonInterface::IsInShutdown = false; // whether we are _really_ in shutdown mode @@ -661,7 +661,7 @@ PYTHON_METHOD_DEFINITION(ptOutputRedirector, write, args) if (PyUnicode_Check(textObj)) { int strLen = PyUnicode_GetSize(textObj); - wchar_t* text = TRACKED_NEW wchar_t[strLen + 1]; + wchar_t* text = new wchar_t[strLen + 1]; PyUnicode_AsWideChar((PyUnicodeObject*)textObj, text, strLen); text[strLen] = L'\0'; self->fThis->Write(text); @@ -754,7 +754,7 @@ public: PyErr_Display(except, val, tb); // Send to the log server - wchar* wdata = hsStringToWString(fData.c_str()); + wchar_t* wdata = hsStringToWString(fData.c_str()); NetCliAuthLogPythonTraceback(wdata); delete [] wdata; @@ -787,7 +787,7 @@ PYTHON_METHOD_DEFINITION(ptErrorRedirector, write, args) if (PyUnicode_Check(textObj)) { int strLen = PyUnicode_GetSize(textObj); - wchar_t* text = TRACKED_NEW wchar_t[strLen + 1]; + wchar_t* text = new wchar_t[strLen + 1]; PyUnicode_AsWideChar((PyUnicodeObject*)textObj, text, strLen); text[strLen] = L'\0'; self->fThis->Write(text); @@ -1164,7 +1164,7 @@ void PythonInterface::initPython() AddPlasmaMethods(methods); // now copy the data to our real method definition structure - plasmaMethods = TRACKED_NEW PyMethodDef[methods.size() + 1]; + plasmaMethods = new PyMethodDef[methods.size() + 1]; for (int curMethod = 0; curMethod < methods.size(); curMethod++) plasmaMethods[curMethod] = methods[curMethod]; PyMethodDef terminator = {NULL}; @@ -1290,7 +1290,7 @@ void PythonInterface::initPython() AddPlasmaGameMethods(methods); // now copy the data to our real method definition structure - plasmaGameMethods = TRACKED_NEW PyMethodDef[methods.size() + 1]; + plasmaGameMethods = new PyMethodDef[methods.size() + 1]; for (int curMethod = 0; curMethod < methods.size(); curMethod++) plasmaGameMethods[curMethod] = methods[curMethod]; plasmaGameMethods[methods.size()] = terminator; // add the terminator @@ -2126,7 +2126,7 @@ PyObject* PythonInterface::CompileString(char *command, char* filename) // // PURPOSE : marshals an object into a char string // -hsBool PythonInterface::DumpObject(PyObject* pyobj, char** pickle, Int32* size) +hsBool 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 @@ -2160,7 +2160,7 @@ hsBool PythonInterface::DumpObject(PyObject* pyobj, char** pickle, Int32* size) // // PURPOSE : Load a python object from a pickled object // -PyObject* PythonInterface::LoadObject(char* pickle, Int32 size) +PyObject* PythonInterface::LoadObject(char* pickle, int32_t size) { return PyMarshal_ReadObjectFromString(pickle, size); } diff --git a/Sources/Plasma/FeatureLib/pfPython/cyPythonInterface.h b/Sources/Plasma/FeatureLib/pfPython/cyPythonInterface.h index 506e8ebc..7078705c 100644 --- a/Sources/Plasma/FeatureLib/pfPython/cyPythonInterface.h +++ b/Sources/Plasma/FeatureLib/pfPython/cyPythonInterface.h @@ -46,7 +46,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // NOTE: Eventually, this will be made into a separate dll, because there should // only be one instance of this interface. // -#include "hsTypes.h" +#include "HeadSpin.h" #include "hsStlUtils.h" #include @@ -60,7 +60,7 @@ class pyKey; class PythonInterface { private: - static Int32 initialized; // count how many times we initialize + static int32_t initialized; // count how many times we initialize // and make sure that many finalize on the way out static hsBool FirstTimeInit; static hsBool IsInShutdown; // whether we are _really_ in shutdown mode @@ -173,7 +173,7 @@ public: // // PURPOSE : marshals an object into a char string // - static hsBool DumpObject(PyObject* pyobj, char** pickle, Int32* size); + static hsBool DumpObject(PyObject* pyobj, char** pickle, int32_t* size); ///////////////////////////////////////////////////////////////////////////// // @@ -183,7 +183,7 @@ public: // // PURPOSE : Load a python object from a pickled object // - static PyObject* LoadObject(char* pickle, Int32 size); + static PyObject* LoadObject(char* pickle, int32_t size); ///////////////////////////////////////////////////////////////////////////// diff --git a/Sources/Plasma/FeatureLib/pfPython/plPythonFileMod.cpp b/Sources/Plasma/FeatureLib/pfPython/plPythonFileMod.cpp index 360e05f6..156c6475 100644 --- a/Sources/Plasma/FeatureLib/pfPython/plPythonFileMod.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/plPythonFileMod.cpp @@ -47,7 +47,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // ////////////////////////////////////////////////////////////////////////// -#include "hsTypes.h" +#include "HeadSpin.h" #include "hsStream.h" #include "plgDispatch.h" #include "hsResMgr.h" @@ -434,7 +434,7 @@ bool plPythonFileMod::ILoadPythonCode() // see if the file exists first before trying to import it char pathandfile[256]; sprintf(pathandfile, ".\\python\\%s.py",fPythonFile); - wchar *wPathandfile = hsStringToWString(pathandfile); + wchar_t *wPathandfile = hsStringToWString(pathandfile); hsBool exists = PathDoesFileExist(wPathandfile); delete [] wPathandfile; if (exists) @@ -553,7 +553,7 @@ void plPythonFileMod::AddTarget(plSceneObject* sobj) if (sceneObj) { hsAssert(!fSDLMod, "Python SDL modifier already created"); - fSDLMod = TRACKED_NEW plPythonSDLModifier(this); + fSDLMod = new plPythonSDLModifier(this); sceneObj->AddModifier(fSDLMod); } } @@ -604,7 +604,7 @@ void plPythonFileMod::AddTarget(plSceneObject* sobj) case plPythonParameter::kFloat: value = PyFloat_FromDouble(parameter.datarecord.fFloatNumber); break; - case plPythonParameter::kBoolean: + case plPythonParameter::kbool: value = PyInt_FromLong(parameter.datarecord.fBool); break; case plPythonParameter::kString: @@ -773,7 +773,7 @@ void plPythonFileMod::AddTarget(plSceneObject* sobj) { // create the callback object // Set the callback for the vault thingy - fVaultCallback = TRACKED_NEW PythonVaultCallback( this, kfunc_VaultEvent ); + fVaultCallback = new PythonVaultCallback( this, kfunc_VaultEvent ); VaultRegisterCallback(fVaultCallback); } @@ -781,7 +781,7 @@ void plPythonFileMod::AddTarget(plSceneObject* sobj) if ( fPyFunctionInstances[kfunc_OnDefaultKeyCaught] != nil ) { // Make us a key catcher - fKeyCatcher = TRACKED_NEW pfPythonKeyCatcher( this ); + fKeyCatcher = new pfPythonKeyCatcher( this ); // Tell the input interface manager to use our catcher plInputInterfaceMgr::GetInstance()->SetDefaultKeyCatcher( fKeyCatcher ); @@ -957,8 +957,8 @@ plString plPythonFileMod::IMakeModuleName(plSceneObject* sobj) const char* pKeyName = pKey->GetName().c_str(); const char* pSobjName = sKey->GetName().c_str(); - UInt16 len = pKey->GetName().GetSize(); - UInt16 slen = sKey->GetName().GetSize(); + uint16_t len = pKey->GetName().GetSize(); + uint16_t slen = sKey->GetName().GetSize(); hsAssert(len+slen < 256, "Warning: String length exceeds 256 characters."); char modulename[256]; @@ -987,7 +987,7 @@ plString plPythonFileMod::IMakeModuleName(plSceneObject* sobj) // we have an owner... so we must be a clone. // add the cloneID to the end of the module name // and set the fIAmAClone flag - UInt32 cloneID = pKeyImp->GetUoid().GetCloneID(); + uint32_t cloneID = pKeyImp->GetUoid().GetCloneID(); name += plString::Format("%d", cloneID); fAmIAttachedToClone = true; } @@ -996,7 +996,7 @@ plString plPythonFileMod::IMakeModuleName(plSceneObject* sobj) if ( !PythonInterface::IsModuleNameUnique(modulename) ) { // if not unique then add the sequence number to the end of the modulename - UInt32 seqID = pKeyImp->GetUoid().GetLocation().GetSequenceNumber(); + uint32_t seqID = pKeyImp->GetUoid().GetLocation().GetSequenceNumber(); name += plString::Format("%d", seqID); } @@ -1011,7 +1011,7 @@ plString plPythonFileMod::IMakeModuleName(plSceneObject* sobj) // PURPOSE : set the param in the python file // : so named stuff works // -void plPythonFileMod::ISetKeyValue(const plKey& key, Int32 id) +void plPythonFileMod::ISetKeyValue(const plKey& key, int32_t id) { PyObject* setParams = PythonInterface::GetModuleItem("glue_setParam",fModule); @@ -1045,7 +1045,7 @@ void plPythonFileMod::ISetKeyValue(const plKey& key, Int32 id) // PURPOSE : find a responder by name in all age and page locations // : and add to the Parameter list // -void plPythonFileMod::IFindResponderAndAdd(const plString &responderName, Int32 id) +void plPythonFileMod::IFindResponderAndAdd(const plString &responderName, int32_t id) { if ( !responderName.IsNull() ) { @@ -1073,7 +1073,7 @@ void plPythonFileMod::IFindResponderAndAdd(const plString &responderName, Int32 // PURPOSE : find a responder by name in all age and page locations // : and add to the Parameter list // -void plPythonFileMod::IFindActivatorAndAdd(const plString &activatorName, Int32 id) +void plPythonFileMod::IFindActivatorAndAdd(const plString &activatorName, int32_t id) { if ( !activatorName.IsNull() ) { @@ -1110,7 +1110,7 @@ void plPythonFileMod::IFindActivatorAndAdd(const plString &activatorName, Int32 { // setup a ref notify when it does get loaded hsgResMgr::ResMgr()->AddViaNotify(keylist[i], - TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnCreate, kAddNotify, 0), + new plGenRefMsg(GetKey(), plRefMsg::kOnCreate, kAddNotify, 0), plRefFlags::kPassiveRef); } } @@ -1129,7 +1129,7 @@ void plPythonFileMod::IFindActivatorAndAdd(const plString &activatorName, Int32 // Tasks: // - Call the Python code's Update function (if there) // -hsBool plPythonFileMod::IEval(double secs, hsScalar del, UInt32 dirty) +hsBool plPythonFileMod::IEval(double secs, float del, uint32_t dirty) { if ( fModule ) { @@ -1263,7 +1263,7 @@ hsBool plPythonFileMod::MsgReceive(plMessage* msg) // create a list for the event records PyObject* levents = PyList_New(0); // start with a list of no elements // loop thought the event records to get the data and transform into python objects - Int32 num_records = pNtfyMsg->GetEventCount(); + int32_t num_records = pNtfyMsg->GetEventCount(); int j; for ( j=0; jGetSender() != nil ) { // loop throught the parameters and set them by id @@ -1621,7 +1621,7 @@ hsBool plPythonFileMod::MsgReceive(plMessage* msg) { // now create the control... but first we need to find out what it is PyObject* pyCtrlKey = pyKey::New(pGUIMsg->GetControlKey()); - UInt32 control_type = pyGUIDialog::WhatControlType(*(pyKey::ConvertFrom(pyCtrlKey))); + uint32_t control_type = pyGUIDialog::WhatControlType(*(pyKey::ConvertFrom(pyCtrlKey))); Py_DECREF(pyCtrlKey); switch (control_type) @@ -1684,7 +1684,7 @@ hsBool plPythonFileMod::MsgReceive(plMessage* msg) } // Need to determine which of the GUIDialogs sent this plGUINotifyMsg // and set the ID appropriately - Int32 id = -1; // assume that none was found + int32_t id = -1; // assume that none was found if ( pGUIMsg->GetSender() != nil ) { // loop throught the parameters and set them by id @@ -2339,7 +2339,7 @@ hsBool plPythonFileMod::MsgReceive(plMessage* msg) PyObject* retVal = PyObject_CallMethod( fPyFunctionInstances[kfunc_OnMarkerMsg], (char*)fFunctionNames[kfunc_OnMarkerMsg], - "lO", (UInt32)markermsg->fType, ptuple); + "lO", (uint32_t)markermsg->fType, ptuple); if (retVal == nil) { #ifndef PLASMA_EXTERNAL_RELEASE @@ -2497,7 +2497,7 @@ hsBool plPythonFileMod::MsgReceive(plMessage* msg) PyObject* retVal = PyObject_CallMethod( fPyFunctionInstances[kfunc_OnMovieEvent], (char*)fFunctionNames[kfunc_OnMovieEvent], - "si", moviemsg->fMovieName, (UInt32)moviemsg->fReason); + "si", moviemsg->fMovieName, (uint32_t)moviemsg->fReason); if ( retVal == nil ) { #ifndef PLASMA_EXTERNAL_RELEASE @@ -2897,7 +2897,7 @@ void plPythonFileMod::EnableControlKeyEvents() if ( fPyFunctionInstances[kfunc_OnKeyEvent] != nil ) { // register for key events - plCmdIfaceModMsg* pModMsg = TRACKED_NEW plCmdIfaceModMsg; + plCmdIfaceModMsg* pModMsg = new plCmdIfaceModMsg; pModMsg->SetBCastFlag(plMessage::kBCastByExactType); pModMsg->SetSender(GetKey()); pModMsg->SetCmd(plCmdIfaceModMsg::kAdd); @@ -2916,7 +2916,7 @@ void plPythonFileMod::EnableControlKeyEvents() void plPythonFileMod::DisableControlKeyEvents() { // unregister for key events - plCmdIfaceModMsg* pModMsg = TRACKED_NEW plCmdIfaceModMsg; + plCmdIfaceModMsg* pModMsg = new plCmdIfaceModMsg; pModMsg->SetBCastFlag(plMessage::kBCastByExactType); pModMsg->SetSender(GetKey()); pModMsg->SetCmd(plCmdIfaceModMsg::kRemove); diff --git a/Sources/Plasma/FeatureLib/pfPython/plPythonFileMod.h b/Sources/Plasma/FeatureLib/pfPython/plPythonFileMod.h index 7a0a36a5..dd6512dc 100644 --- a/Sources/Plasma/FeatureLib/pfPython/plPythonFileMod.h +++ b/Sources/Plasma/FeatureLib/pfPython/plPythonFileMod.h @@ -72,7 +72,7 @@ protected: plPythonSDLModifier* fSDLMod; - hsBool IEval(double secs, hsScalar del, UInt32 dirty); + hsBool IEval(double secs, float del, uint32_t dirty); plString IMakeModuleName(plSceneObject* sobj); @@ -105,15 +105,15 @@ protected: struct NamedComponent { plString name; - Int32 id; + int32_t id; bool isActivator; }; hsTArray fNamedCompQueue; - virtual void IFindResponderAndAdd(const plString &responderName, Int32 id); - virtual void IFindActivatorAndAdd(const plString &activatorName, Int32 id); - void ISetKeyValue(const plKey& key, Int32 id); + virtual void IFindResponderAndAdd(const plString &responderName, int32_t id); + virtual void IFindActivatorAndAdd(const plString &activatorName, int32_t id); + void ISetKeyValue(const plKey& key, int32_t id); bool ILoadPythonCode(); @@ -142,12 +142,12 @@ public: virtual hsBool AmIAttachedToClone() { return fAmIAttachedToClone; } virtual void AddToNotifyList(plKey pKey) { fReceivers.Append(pKey); } - virtual Int32 NotifyListCount() { return fReceivers.Count(); } - virtual plKey GetNotifyListItem(Int32 i) { return fReceivers[i]; } + virtual int32_t NotifyListCount() { return fReceivers.Count(); } + virtual plKey GetNotifyListItem(int32_t i) { return fReceivers[i]; } virtual void AddParameter(plPythonParameter param) { fParameters.Append(param); } - virtual Int32 GetParameterListCount() { return fParameters.Count(); } - virtual plPythonParameter GetParameterItem(Int32 i) { return fParameters[i]; } + virtual int32_t GetParameterListCount() { return fParameters.Count(); } + virtual plPythonParameter GetParameterItem(int32_t i) { return fParameters[i]; } virtual void AddTarget(plSceneObject* sobj); virtual void RemoveTarget(plSceneObject* so); diff --git a/Sources/Plasma/FeatureLib/pfPython/plPythonPack.cpp b/Sources/Plasma/FeatureLib/pfPython/plPythonPack.cpp index b7a69eda..d44cd821 100644 --- a/Sources/Plasma/FeatureLib/pfPython/plPythonPack.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/plPythonPack.cpp @@ -39,7 +39,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com Mead, WA 99021 *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "hsStlUtils.h" #include "plPythonPack.h" #include "hsStream.h" @@ -53,8 +53,8 @@ static const char* kPackFilePath = ".\\Python\\"; struct plPackOffsetInfo { - UInt32 fOffset; - UInt32 fStreamIndex; // index of the stream object in the plPythonPack object that the file resides in + uint32_t fOffset; + uint32_t fStreamIndex; // index of the stream object in the plPythonPack object that the file resides in }; class plPythonPack @@ -145,14 +145,14 @@ bool plPythonPack::Open() // read the index data int numFiles = fPackStream->ReadLE32(); - UInt32 streamIndex = (UInt32)(fPackStreams.size()); + uint32_t streamIndex = (uint32_t)(fPackStreams.size()); for (int i = 0; i < numFiles; i++) { // and pack the index into our own data structure char* buf = fPackStream->ReadSafeString(); std::string pythonName = buf; // reading a "string" from a hsStream directly into a stl string causes memory loss delete [] buf; - UInt32 offset = fPackStream->ReadLE32(); + uint32_t offset = fPackStream->ReadLE32(); plPackOffsetInfo offsetInfo; offsetInfo.fOffset = offset; @@ -160,7 +160,7 @@ bool plPythonPack::Open() if (fFileOffsets.find(pythonName) != fFileOffsets.end()) { - UInt32 index = fFileOffsets[pythonName].fStreamIndex; + uint32_t index = fFileOffsets[pythonName].fStreamIndex; if (modTimes[index] < curModTime) // is the existing file older then the new one? fFileOffsets[pythonName] = offsetInfo; // yup, so replace it with the new info } @@ -209,11 +209,11 @@ PyObject* plPythonPack::OpenPacked(const char* fileName) fPackStream->SetPosition(offsetInfo.fOffset); - Int32 size = fPackStream->ReadLE32(); + int32_t size = fPackStream->ReadLE32(); if (size > 0) { - char *buf = TRACKED_NEW char[size]; - UInt32 readSize = fPackStream->Read(size, buf); + char *buf = new char[size]; + uint32_t readSize = fPackStream->Read(size, buf); hsAssert(readSize <= size, xtl::format("Python PackFile %s: Incorrect amount of data, read %d instead of %d", fileName, readSize, size).c_str()); diff --git a/Sources/Plasma/FeatureLib/pfPython/plPythonPack.h b/Sources/Plasma/FeatureLib/pfPython/plPythonPack.h index 5fc4b183..b1a98cd5 100644 --- a/Sources/Plasma/FeatureLib/pfPython/plPythonPack.h +++ b/Sources/Plasma/FeatureLib/pfPython/plPythonPack.h @@ -43,7 +43,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #define plPythonPack_h_inc #include "Python.h" -#include "hsTypes.h" +#include "HeadSpin.h" namespace PythonPack { diff --git a/Sources/Plasma/FeatureLib/pfPython/plPythonParameter.h b/Sources/Plasma/FeatureLib/pfPython/plPythonParameter.h index bd30f9b6..d77db84f 100644 --- a/Sources/Plasma/FeatureLib/pfPython/plPythonParameter.h +++ b/Sources/Plasma/FeatureLib/pfPython/plPythonParameter.h @@ -58,7 +58,7 @@ typedef struct plPythonParameter { public: // this is a unique (within one Python mod) id for this parameter - Int32 fID; + int32_t fID; // then comes the value, which is a type followed by the data @@ -66,7 +66,7 @@ public: { kInt=1, kFloat, - kBoolean, + kbool, kString, kSceneObject, kSceneObjectList, @@ -89,14 +89,14 @@ public: kNone }; - Int32 fValueType; // what type of value (dataType enum) + int32_t fValueType; // what type of value (dataType enum) // the data of the value union { - Int32 fIntNumber; + int32_t fIntNumber; - hsScalar fFloatNumber; + float fFloatNumber; hsBool fBool; @@ -113,7 +113,7 @@ public: fValueType = kNone; } - plPythonParameter(Int32 id) + plPythonParameter(int32_t id) { fID = id; fValueType = kNone; @@ -143,8 +143,8 @@ public: case kFloat: SetToFloat(other.datarecord.fFloatNumber); break; - case kBoolean: - SetToBoolean(other.datarecord.fBool); + case kbool: + SetTobool(other.datarecord.fBool); break; case kString: SetToString(other.datarecord.fString); @@ -221,22 +221,22 @@ public: fValueType = kNone; } - void SetToInt(Int32 number) + void SetToInt(int32_t number) { SetToNone(); fValueType = kInt; datarecord.fIntNumber = number; } - void SetToFloat(hsScalar number) + void SetToFloat(float number) { SetToNone(); fValueType = kFloat; datarecord.fFloatNumber = number; } - void SetToBoolean(hsBool state) + void SetTobool(hsBool state) { SetToNone(); - fValueType = kBoolean; + fValueType = kbool; datarecord.fBool = state; } void SetToString(const char* string) @@ -371,7 +371,7 @@ public: stream->ReadLE(&datarecord.fFloatNumber); break; - case kBoolean: + case kbool: datarecord.fBool = stream->ReadLE32(); break; @@ -380,7 +380,7 @@ public: count = stream->ReadLE32(); if ( count != 0 ) { - datarecord.fString = TRACKED_NEW char[count+1]; + datarecord.fString = new char[count+1]; stream->ReadLE(count,datarecord.fString); } else @@ -424,7 +424,7 @@ public: stream->WriteLE(datarecord.fFloatNumber); break; - case kBoolean: + case kbool: stream->WriteLE32(datarecord.fBool); break; diff --git a/Sources/Plasma/FeatureLib/pfPython/plPythonSDLModifier.cpp b/Sources/Plasma/FeatureLib/pfPython/plPythonSDLModifier.cpp index d814b0c8..e846f49b 100644 --- a/Sources/Plasma/FeatureLib/pfPython/plPythonSDLModifier.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/plPythonSDLModifier.cpp @@ -39,7 +39,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com Mead, WA 99021 *==LICENSE==*/ -#include "hsConfig.h" +#include "HeadSpin.h" #include "plPythonSDLModifier.h" #include "cyPythonInterface.h" @@ -341,7 +341,7 @@ void plPythonSDLModifier::IDirtySynchState(const char* name, hsBool sendImmediat SDLMap::iterator it = fMap.find(name); if (it != fMap.end()) { - UInt32 flags = 0; + uint32_t flags = 0; if (it->second.sendToClients) flags |= kBCastToClients; if (it->second.sendImmediate) diff --git a/Sources/Plasma/FeatureLib/pfPython/pyAgeInfoStruct.cpp b/Sources/Plasma/FeatureLib/pfPython/pyAgeInfoStruct.cpp index d7aa3e49..4ded3087 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyAgeInfoStruct.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/pyAgeInfoStruct.cpp @@ -137,29 +137,29 @@ void pyAgeInfoStruct::SetAgeInstanceGuid( const char * guid ) fAgeInfo.SetAgeInstanceGuid( &plUUID( guid ) ); } -Int32 pyAgeInfoStruct::GetAgeSequenceNumber() const +int32_t pyAgeInfoStruct::GetAgeSequenceNumber() const { return fAgeInfo.GetAgeSequenceNumber(); } -void pyAgeInfoStruct::SetAgeSequenceNumber( Int32 v ) +void pyAgeInfoStruct::SetAgeSequenceNumber( int32_t v ) { fAgeInfo.SetAgeSequenceNumber( v ); } -Int32 pyAgeInfoStruct::GetAgeLanguage() const +int32_t pyAgeInfoStruct::GetAgeLanguage() const { return fAgeInfo.GetAgeLanguage(); } -void pyAgeInfoStruct::SetAgeLanguage( Int32 v ) +void pyAgeInfoStruct::SetAgeLanguage( int32_t v ) { fAgeInfo.SetAgeLanguage( v ); } const char * pyAgeInfoStruct::GetDisplayName() const { - Int32 seq = GetAgeSequenceNumber(); + int32_t seq = GetAgeSequenceNumber(); if ( seq>0 ) fDisplayName = plString::Format( "%s (%d) %s", GetAgeUserDefinedName(), seq, GetAgeInstanceName() ); else @@ -223,19 +223,19 @@ void pyAgeInfoStructRef::SetAgeInstanceGuid( const char * guid ) fAgeInfo.SetAgeInstanceGuid( &plUUID( guid ) ); } -Int32 pyAgeInfoStructRef::GetAgeSequenceNumber() const +int32_t pyAgeInfoStructRef::GetAgeSequenceNumber() const { return fAgeInfo.GetAgeSequenceNumber(); } -void pyAgeInfoStructRef::SetAgeSequenceNumber( Int32 v ) +void pyAgeInfoStructRef::SetAgeSequenceNumber( int32_t v ) { fAgeInfo.SetAgeSequenceNumber( v ); } const char * pyAgeInfoStructRef::GetDisplayName() const { - Int32 seq = GetAgeSequenceNumber(); + int32_t seq = GetAgeSequenceNumber(); if ( seq>0 ) fDisplayName = plString::Format( "%s (%d) %s", GetAgeUserDefinedName(), seq, GetAgeInstanceName() ); else diff --git a/Sources/Plasma/FeatureLib/pfPython/pyAgeInfoStruct.h b/Sources/Plasma/FeatureLib/pfPython/pyAgeInfoStruct.h index 37834c5b..cca3fbbb 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyAgeInfoStruct.h +++ b/Sources/Plasma/FeatureLib/pfPython/pyAgeInfoStruct.h @@ -42,7 +42,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #ifndef pyAgeInfoStruct_h_inc #define pyAgeInfoStruct_h_inc -#include "hsTypes.h" +#include "HeadSpin.h" #include "hsStlUtils.h" #include "plNetCommon/plNetServerSessionInfo.h" @@ -100,10 +100,10 @@ public: void SetAgeDescription( const char * v ); const char * GetAgeInstanceGuid() const; void SetAgeInstanceGuid( const char * guid ); - Int32 GetAgeSequenceNumber() const; - void SetAgeSequenceNumber( Int32 v ); - Int32 GetAgeLanguage() const; - void SetAgeLanguage( Int32 v ); + int32_t GetAgeSequenceNumber() const; + void SetAgeSequenceNumber( int32_t v ); + int32_t GetAgeLanguage() const; + void SetAgeLanguage( int32_t v ); const char * GetDisplayName() const; }; @@ -143,8 +143,8 @@ public: void SetAgeUserDefinedName( const char * v ); const char * GetAgeInstanceGuid() const; void SetAgeInstanceGuid( const char * guid ); - Int32 GetAgeSequenceNumber() const; - void SetAgeSequenceNumber( Int32 v ); + int32_t GetAgeSequenceNumber() const; + void SetAgeSequenceNumber( int32_t v ); const char * GetDisplayName() const; }; diff --git a/Sources/Plasma/FeatureLib/pfPython/pyAgeLinkStruct.h b/Sources/Plasma/FeatureLib/pfPython/pyAgeLinkStruct.h index be3329e3..f21e554d 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyAgeLinkStruct.h +++ b/Sources/Plasma/FeatureLib/pfPython/pyAgeLinkStruct.h @@ -42,7 +42,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #ifndef pyAgeLinkStruct_h_inc #define pyAgeLinkStruct_h_inc -#include "hsTypes.h" +#include "HeadSpin.h" #include "hsStlUtils.h" #include "plNetCommon/plNetServerSessionInfo.h" #include "pyAgeInfoStruct.h" diff --git a/Sources/Plasma/FeatureLib/pfPython/pyAgeVault.cpp b/Sources/Plasma/FeatureLib/pfPython/pyAgeVault.cpp index a01b60b2..64f429e7 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyAgeVault.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/pyAgeVault.cpp @@ -200,7 +200,7 @@ const char* pyAgeVault::GetAgeGuid( void ) // Chronicle PyObject* pyAgeVault::FindChronicleEntry( const char * entryName ) { - wchar wEntryName[kMaxVaultNodeStringLength]; + wchar_t wEntryName[kMaxVaultNodeStringLength]; StrToUnicode(wEntryName, entryName, arrsize(wEntryName)); if (RelVaultNode * rvn = VaultFindAgeChronicleEntryIncRef(wEntryName)) { @@ -213,25 +213,25 @@ PyObject* pyAgeVault::FindChronicleEntry( const char * entryName ) PYTHON_RETURN_NONE; } -void pyAgeVault::AddChronicleEntry( const char * name, UInt32 type, const char * value ) +void pyAgeVault::AddChronicleEntry( const char * name, uint32_t type, const char * value ) { - wchar * wEntryName = StrDupToUnicode(name); - wchar * wEntryValue = StrDupToUnicode(value); + wchar_t * wEntryName = StrDupToUnicode(name); + wchar_t * wEntryValue = StrDupToUnicode(value); VaultAddAgeChronicleEntry(wEntryName, type, wEntryValue); - FREE(wEntryName); - FREE(wEntryValue); + free(wEntryName); + free(wEntryValue); } // AGE DEVICES. AKA IMAGERS, WHATEVER. // Add a new device. -void pyAgeVault::AddDevice( const char * deviceName, PyObject * cbObject, UInt32 cbContext ) +void pyAgeVault::AddDevice( const char * deviceName, PyObject * cbObject, uint32_t cbContext ) { pyVaultNode::pyVaultNodeOperationCallback * cb = NEWZERO(pyVaultNode::pyVaultNodeOperationCallback)( cbObject ); cb->VaultOperationStarted( cbContext ); - wchar wStr[MAX_PATH]; + wchar_t wStr[MAX_PATH]; StrToUnicode(wStr, deviceName, arrsize(wStr)); if (RelVaultNode * rvn = VaultAgeAddDeviceAndWaitIncRef(wStr)) { @@ -245,7 +245,7 @@ void pyAgeVault::AddDevice( const char * deviceName, PyObject * cbObject, UInt32 // Remove a device. void pyAgeVault::RemoveDevice( const char * deviceName ) { - wchar wStr[MAX_PATH]; + wchar_t wStr[MAX_PATH]; StrToUnicode(wStr, deviceName, arrsize(wStr)); VaultAgeRemoveDevice(wStr); @@ -254,7 +254,7 @@ void pyAgeVault::RemoveDevice( const char * deviceName ) // True if device exists in age. bool pyAgeVault::HasDevice( const char * deviceName ) { - wchar wStr[MAX_PATH]; + wchar_t wStr[MAX_PATH]; StrToUnicode(wStr, deviceName, arrsize(wStr)); return VaultAgeHasDevice(wStr); @@ -262,7 +262,7 @@ bool pyAgeVault::HasDevice( const char * deviceName ) PyObject * pyAgeVault::GetDevice( const char * deviceName ) { - wchar wStr[MAX_PATH]; + wchar_t wStr[MAX_PATH]; StrToUnicode(wStr, deviceName, arrsize(wStr)); if (RelVaultNode * rvn = VaultAgeGetDeviceIncRef(wStr)) { @@ -275,14 +275,14 @@ PyObject * pyAgeVault::GetDevice( const char * deviceName ) } // Sets the inbox associated with a device. -void pyAgeVault::SetDeviceInbox( const char * deviceName, const char * inboxName, PyObject * cbObject, UInt32 cbContext ) +void pyAgeVault::SetDeviceInbox( const char * deviceName, const char * inboxName, PyObject * cbObject, uint32_t cbContext ) { pyVaultNode::pyVaultNodeOperationCallback * cb = NEWZERO(pyVaultNode::pyVaultNodeOperationCallback)( cbObject ); cb->VaultOperationStarted( cbContext ); - wchar wDev[MAX_PATH]; + wchar_t wDev[MAX_PATH]; StrToUnicode(wDev, deviceName, arrsize(wDev)); - wchar wInb[MAX_PATH]; + wchar_t wInb[MAX_PATH]; StrToUnicode(wInb, inboxName, arrsize(wInb)); if (RelVaultNode * rvn = VaultAgeSetDeviceInboxAndWaitIncRef(wDev, wInb)) { @@ -295,7 +295,7 @@ void pyAgeVault::SetDeviceInbox( const char * deviceName, const char * inboxName PyObject * pyAgeVault::GetDeviceInbox( const char * deviceName ) { - wchar wStr[MAX_PATH]; + wchar_t wStr[MAX_PATH]; StrToUnicode(wStr, deviceName, arrsize(wStr)); if (RelVaultNode * rvn = VaultAgeGetDeviceInboxIncRef(wStr)) { @@ -311,7 +311,7 @@ PyObject * pyAgeVault::GetAgeSDL() const { plStateDataRecord * rec = NEWZERO(plStateDataRecord); if (!VaultAgeGetAgeSDL(rec)) { - DEL(rec); + delete rec; PYTHON_RETURN_NONE; } else { diff --git a/Sources/Plasma/FeatureLib/pfPython/pyAgeVault.h b/Sources/Plasma/FeatureLib/pfPython/pyAgeVault.h index 8802584f..d2d40a8a 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyAgeVault.h +++ b/Sources/Plasma/FeatureLib/pfPython/pyAgeVault.h @@ -52,7 +52,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // ////////////////////////////////////////////////////////////////////// -#include "hsTypes.h" +#include "HeadSpin.h" #include "hsStlUtils.h" #include @@ -98,7 +98,7 @@ public: PyObject* GetChronicleFolder( void ); // returns pyVaultFolderNode // Age chronicle (not the player chronicle!) PyObject* FindChronicleEntry( const char * entryName ); // returns pyVaultChronicleNode - void AddChronicleEntry( const char * name, UInt32 type, const char * value ); + void AddChronicleEntry( const char * name, uint32_t type, const char * value ); // Players who have published to devices in this age PyObject* GetPeopleIKnowAboutFolder( void ); // returns pyVaultPlayerInfoListNode // PERSONAL AGE SPECIFIC @@ -108,7 +108,7 @@ public: PyObject* GetSubAgeLink( const pyAgeInfoStruct & info ); // returns pyVaultAgeLinkNode // AGE DEVICES. AKA IMAGERS, WHATEVER. // Add a new device. - void AddDevice( const char * deviceName, PyObject * cb=nil, UInt32 cbContext=0 ); + void AddDevice( const char * deviceName, PyObject * cb=nil, uint32_t cbContext=0 ); // Remove a device. void RemoveDevice( const char * deviceName ); // True if device exists in age. @@ -116,7 +116,7 @@ public: // Get the device node by name. PyObject * GetDevice( const char * deviceName ); // returns pyVaultTextNoteNode // Sets the inbox associated with a device. - void SetDeviceInbox( const char * deviceName, const char * inboxName, PyObject * cb=nil, UInt32 cbContext=0 ); + void SetDeviceInbox( const char * deviceName, const char * inboxName, PyObject * cb=nil, uint32_t cbContext=0 ); // Get the inbox associated with a device. PyObject * GetDeviceInbox( const char * deviceName ); // returns pyVaultFolderNode // find matching node diff --git a/Sources/Plasma/FeatureLib/pfPython/pyAlarm.cpp b/Sources/Plasma/FeatureLib/pfPython/pyAlarm.cpp index 37009c10..27d14185 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyAlarm.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/pyAlarm.cpp @@ -50,8 +50,8 @@ struct pyAlarm double fStart; float fSecs; PyObject * fCb; - UInt32 fCbContext; - pyAlarm( double start, float secs, PyObject * cb, UInt32 cbContext ) + uint32_t fCbContext; + pyAlarm( double start, float secs, PyObject * cb, uint32_t cbContext ) : fStart( start ) , fSecs( secs ) , fCb( cb ) @@ -127,10 +127,10 @@ void pyAlarmMgr::Update( double secs ) } } -void pyAlarmMgr::SetAlarm( float secs, PyObject * cb, UInt32 cbContext ) +void pyAlarmMgr::SetAlarm( float secs, PyObject * cb, uint32_t cbContext ) { double start = hsTimer::GetSysSeconds(); - fAlarms.push_back( TRACKED_NEW pyAlarm( start, secs, cb, cbContext ) ); + fAlarms.push_back( new pyAlarm( start, secs, cb, cbContext ) ); } void pyAlarmMgr::Clear() diff --git a/Sources/Plasma/FeatureLib/pfPython/pyAlarm.h b/Sources/Plasma/FeatureLib/pfPython/pyAlarm.h index 2ca9a2e6..e0d3a30f 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyAlarm.h +++ b/Sources/Plasma/FeatureLib/pfPython/pyAlarm.h @@ -42,7 +42,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #ifndef pyAlarm_h_inc #define pyAlarm_h_inc -#include "hsTypes.h" +#include "HeadSpin.h" #include "hsStlUtils.h" #include @@ -55,7 +55,7 @@ public: ~pyAlarmMgr(); static pyAlarmMgr * GetInstance(); void Update( double secs ); - void SetAlarm( float secs, PyObject * cb, UInt32 cbContext ); + void SetAlarm( float secs, PyObject * cb, uint32_t cbContext ); void Clear(); }; diff --git a/Sources/Plasma/FeatureLib/pfPython/pyAudioControl.cpp b/Sources/Plasma/FeatureLib/pfPython/pyAudioControl.cpp index 9a1ce91b..92c70f0f 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyAudioControl.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/pyAudioControl.cpp @@ -54,7 +54,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "plAudio/plAudioCaps.h" // Sets the master volume of a given audio channel -void pyAudioControl::SetSoundFXVolume( hsScalar volume ) +void pyAudioControl::SetSoundFXVolume( float volume ) { plgAudioSys::ASChannel chan; chan = plgAudioSys::kSoundFX; @@ -68,7 +68,7 @@ void pyAudioControl::SetSoundFXVolume( hsScalar volume ) plgAudioSys::SetChannelVolume( chan, volume ); } -void pyAudioControl::SetMusicVolume( hsScalar volume ) +void pyAudioControl::SetMusicVolume( float volume ) { plgAudioSys::ASChannel chan; chan = plgAudioSys::kBgndMusic; @@ -82,7 +82,7 @@ void pyAudioControl::SetMusicVolume( hsScalar volume ) plgAudioSys::SetChannelVolume( chan, volume ); } -void pyAudioControl::SetVoiceVolume( hsScalar volume ) +void pyAudioControl::SetVoiceVolume( float volume ) { plgAudioSys::ASChannel chan; chan = plgAudioSys::kVoice; @@ -96,7 +96,7 @@ void pyAudioControl::SetVoiceVolume( hsScalar volume ) plgAudioSys::SetChannelVolume( chan, volume ); } -void pyAudioControl::SetAmbienceVolume( hsScalar volume ) +void pyAudioControl::SetAmbienceVolume( float volume ) { plgAudioSys::ASChannel chan; chan = plgAudioSys::kAmbience; @@ -110,7 +110,7 @@ void pyAudioControl::SetAmbienceVolume( hsScalar volume ) plgAudioSys::SetChannelVolume( chan, volume ); } -void pyAudioControl::SetGUIVolume( hsScalar volume ) +void pyAudioControl::SetGUIVolume( float volume ) { plgAudioSys::ASChannel chan; chan = plgAudioSys::kGUI; @@ -124,7 +124,7 @@ void pyAudioControl::SetGUIVolume( hsScalar volume ) plgAudioSys::SetChannelVolume( chan, volume ); } -void pyAudioControl::SetNPCVoiceVolume( hsScalar volume ) +void pyAudioControl::SetNPCVoiceVolume( float volume ) { plgAudioSys::ASChannel chan; chan = plgAudioSys::kNPCVoice; @@ -138,42 +138,42 @@ void pyAudioControl::SetNPCVoiceVolume( hsScalar volume ) plgAudioSys::SetChannelVolume( chan, volume ); } -hsScalar pyAudioControl::GetSoundFXVolume() +float pyAudioControl::GetSoundFXVolume() { plgAudioSys::ASChannel chan; chan = plgAudioSys::kSoundFX; return plgAudioSys::GetChannelVolume(chan); } -hsScalar pyAudioControl::GetMusicVolume() +float pyAudioControl::GetMusicVolume() { plgAudioSys::ASChannel chan; chan = plgAudioSys::kBgndMusic; return plgAudioSys::GetChannelVolume(chan); } -hsScalar pyAudioControl::GetVoiceVolume() +float pyAudioControl::GetVoiceVolume() { plgAudioSys::ASChannel chan; chan = plgAudioSys::kVoice; return plgAudioSys::GetChannelVolume(chan); } -hsScalar pyAudioControl::GetAmbienceVolume() +float pyAudioControl::GetAmbienceVolume() { plgAudioSys::ASChannel chan; chan = plgAudioSys::kAmbience; return plgAudioSys::GetChannelVolume(chan); } -hsScalar pyAudioControl::GetGUIVolume() +float pyAudioControl::GetGUIVolume() { plgAudioSys::ASChannel chan; chan = plgAudioSys::kGUI; return plgAudioSys::GetChannelVolume(chan); } -hsScalar pyAudioControl::GetNPCVoiceVolume() +float pyAudioControl::GetNPCVoiceVolume() { plgAudioSys::ASChannel chan; chan = plgAudioSys::kNPCVoice; @@ -271,7 +271,7 @@ hsBool pyAudioControl::CanSetMicLevel() return plWinMicLevel::CanSetLevel(); } -void pyAudioControl::SetMicLevel( hsScalar level ) +void pyAudioControl::SetMicLevel( float level ) { // make sure the volume is within range if( level > 1.f ) @@ -282,7 +282,7 @@ void pyAudioControl::SetMicLevel( hsScalar level ) plWinMicLevel::SetLevel( level ); } -hsScalar pyAudioControl::GetMicLevel() +float pyAudioControl::GetMicLevel() { return plWinMicLevel::GetLevel(); } @@ -348,29 +348,29 @@ void pyAudioControl::PushToTalk( hsBool state ) } // Set the squelch level -void pyAudioControl::SquelchLevel( hsScalar level ) +void pyAudioControl::SquelchLevel( float level ) { plVoiceRecorder::SetSquelch(level); } // Adjust voice packet frame size -void pyAudioControl::RecordFrame( Int32 size ) +void pyAudioControl::RecordFrame( int32_t size ) { } // Set the sample rate for recording -void pyAudioControl::RecordSampleRate( Int32 sample_rate ) +void pyAudioControl::RecordSampleRate( int32_t sample_rate ) { } -UInt8 pyAudioControl::GetPriorityCutoff( void ) +uint8_t pyAudioControl::GetPriorityCutoff( void ) { return plgAudioSys::GetPriorityCutoff(); } -void pyAudioControl::SetPriorityCutoff( UInt8 cut ) +void pyAudioControl::SetPriorityCutoff( uint8_t cut ) { plgAudioSys::SetPriorityCutoff( cut ); } diff --git a/Sources/Plasma/FeatureLib/pfPython/pyAudioControl.h b/Sources/Plasma/FeatureLib/pfPython/pyAudioControl.h index d8db8830..4a0edf63 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyAudioControl.h +++ b/Sources/Plasma/FeatureLib/pfPython/pyAudioControl.h @@ -48,7 +48,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // ////////////////////////////////////////////////////////////////////// -#include "hsTypes.h" +#include "HeadSpin.h" #include #include "pyGlueHelpers.h" @@ -71,18 +71,18 @@ public: // Audio settings // Sets the master volume of a given audio channel - virtual void SetSoundFXVolume( hsScalar volume ); - virtual void SetMusicVolume( hsScalar volume ); - virtual void SetVoiceVolume( hsScalar volume ); - virtual void SetAmbienceVolume( hsScalar volume ); - virtual void SetGUIVolume( hsScalar volume ); - virtual void SetNPCVoiceVolume( hsScalar volume ); - virtual hsScalar GetSoundFXVolume(); - virtual hsScalar GetMusicVolume(); - virtual hsScalar GetVoiceVolume(); - virtual hsScalar GetAmbienceVolume(); - virtual hsScalar GetGUIVolume(); - virtual hsScalar GetNPCVoiceVolume(); + virtual void SetSoundFXVolume( float volume ); + virtual void SetMusicVolume( float volume ); + virtual void SetVoiceVolume( float volume ); + virtual void SetAmbienceVolume( float volume ); + virtual void SetGUIVolume( float volume ); + virtual void SetNPCVoiceVolume( float volume ); + virtual float GetSoundFXVolume(); + virtual float GetMusicVolume(); + virtual float GetVoiceVolume(); + virtual float GetAmbienceVolume(); + virtual float GetGUIVolume(); + virtual float GetNPCVoiceVolume(); // Switch DirectX Audio on or off at runtime virtual void Enable(); @@ -124,8 +124,8 @@ public: // Sets the microphone volume, in the range of 0 to 1 virtual hsBool CanSetMicLevel(); - virtual void SetMicLevel( hsScalar level ); - virtual hsScalar GetMicLevel(); + virtual void SetMicLevel( float level ); + virtual float GetMicLevel(); // turn voice recording on or off virtual void EnableVoiceRecording( hsBool state ); @@ -149,16 +149,16 @@ public: virtual void PushToTalk( hsBool state ); // Set the squelch level - virtual void SquelchLevel( hsScalar level ); + virtual void SquelchLevel( float level ); // Adjust voice packet frame size - virtual void RecordFrame( Int32 size ); + virtual void RecordFrame( int32_t size ); // Set the sample rate for recording - virtual void RecordSampleRate( Int32 sample_rate ); + virtual void RecordSampleRate( int32_t sample_rate ); - virtual UInt8 GetPriorityCutoff( void ); - virtual void SetPriorityCutoff( UInt8 cut ); + virtual uint8_t GetPriorityCutoff( void ); + virtual void SetPriorityCutoff( uint8_t cut ); // does the device specified support EAX virtual hsBool SupportEAX(const char *deviceName); diff --git a/Sources/Plasma/FeatureLib/pfPython/pyCCRMgr.h b/Sources/Plasma/FeatureLib/pfPython/pyCCRMgr.h index 54de3406..8d060696 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyCCRMgr.h +++ b/Sources/Plasma/FeatureLib/pfPython/pyCCRMgr.h @@ -48,7 +48,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // ////////////////////////////////////////////////////////////////////// -#include "hsTypes.h" +#include "HeadSpin.h" #include "hsStlUtils.h" #include "pfCCR/plCCRMgr.h" diff --git a/Sources/Plasma/FeatureLib/pfPython/pyColor.cpp b/Sources/Plasma/FeatureLib/pfPython/pyColor.cpp index ca44acf2..06f68e84 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyColor.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/pyColor.cpp @@ -41,7 +41,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ #include "pyColor.h" -pyColor::pyColor(hsScalar r, hsScalar g, hsScalar b, hsScalar a) +pyColor::pyColor(float r, float g, float b, float a) { fColor.Set(r, g, b ,a); } diff --git a/Sources/Plasma/FeatureLib/pfPython/pyColor.h b/Sources/Plasma/FeatureLib/pfPython/pyColor.h index c4e36439..9b311e85 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyColor.h +++ b/Sources/Plasma/FeatureLib/pfPython/pyColor.h @@ -59,14 +59,14 @@ private: hsColorRGBA fColor; protected: - pyColor(hsScalar r=0.0f, hsScalar g=0.0f, hsScalar b=0.0f, hsScalar a=0.0f); + pyColor(float r=0.0f, float g=0.0f, float b=0.0f, float a=0.0f); pyColor(hsColorRGBA color); public: // required functions for PyObject interoperability PYTHON_CLASS_NEW_FRIEND(ptColor); PYTHON_CLASS_NEW_DEFINITION; - static PyObject *New(hsScalar red, hsScalar green, hsScalar blue, hsScalar alpha = 0.0f); + static PyObject *New(float red, float green, float blue, float alpha = 0.0f); static PyObject *New(const hsColorRGBA & color); PYTHON_CLASS_CHECK_DEFINITION; // returns true if the PyObject is a pyColor object PYTHON_CLASS_CONVERT_FROM_DEFINITION(pyColor); // converts a PyObject to a pyColor (throws error if not correct type) @@ -78,16 +78,16 @@ public: void setColor(hsColorRGBA color) { fColor = color; } // python get attributes helpers - hsScalar getRed() const { return fColor.r; } - hsScalar getGreen() const { return fColor.g; } - hsScalar getBlue() const { return fColor.b; } - hsScalar getAlpha() const { return fColor.a; } + float getRed() const { return fColor.r; } + float getGreen() const { return fColor.g; } + float getBlue() const { return fColor.b; } + float getAlpha() const { return fColor.a; } // python set attributes helpers - void setRed(hsScalar red) { fColor.r = red; } - void setGreen(hsScalar green) { fColor.g = green; } - void setBlue(hsScalar blue) { fColor.b = blue; } - void setAlpha(hsScalar alpha) { fColor.a = alpha; } + void setRed(float red) { fColor.r = red; } + void setGreen(float green) { fColor.g = green; } + void setBlue(float blue) { fColor.b = blue; } + void setAlpha(float alpha) { fColor.a = alpha; } // override the equals to operator hsBool operator==(const pyColor &color) const diff --git a/Sources/Plasma/FeatureLib/pfPython/pyColorGlue.cpp b/Sources/Plasma/FeatureLib/pfPython/pyColorGlue.cpp index 9ef3d9db..9c95fe1a 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyColorGlue.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/pyColorGlue.cpp @@ -280,7 +280,7 @@ PLASMA_CUSTOM_TYPE(ptColor, "Params: red=0, green=0, blue=0, alpha=0\nPlasma col // required functions for PyObject interoperability PYTHON_CLASS_NEW_IMPL(ptColor, pyColor) -PyObject *pyColor::New(hsScalar red, hsScalar green, hsScalar blue, hsScalar alpha) +PyObject *pyColor::New(float red, float green, float blue, float alpha) { ptColor *newObj = (ptColor*)ptColor_type.tp_new(&ptColor_type, NULL, NULL); newObj->fThis->setRed(red); diff --git a/Sources/Plasma/FeatureLib/pfPython/pyCritterBrain.cpp b/Sources/Plasma/FeatureLib/pfPython/pyCritterBrain.cpp index f5c961ca..b4883bdf 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyCritterBrain.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/pyCritterBrain.cpp @@ -172,56 +172,56 @@ bool pyCritterBrain::AtGoal() const return fBrain->AtGoal(); } -void pyCritterBrain::StopDistance(hsScalar stopDistance) +void pyCritterBrain::StopDistance(float stopDistance) { if (!fBrain) return; fBrain->StopDistance(stopDistance); } -hsScalar pyCritterBrain::StopDistance() const +float pyCritterBrain::StopDistance() const { if (!fBrain) return 0; return fBrain->StopDistance(); } -void pyCritterBrain::SightCone(hsScalar coneRad) +void pyCritterBrain::SightCone(float coneRad) { if (!fBrain) return; fBrain->SightCone(coneRad); } -hsScalar pyCritterBrain::SightCone() const +float pyCritterBrain::SightCone() const { if (!fBrain) return 0; return fBrain->SightCone(); } -void pyCritterBrain::SightDistance(hsScalar sightDis) +void pyCritterBrain::SightDistance(float sightDis) { if (!fBrain) return; fBrain->SightDistance(sightDis); } -hsScalar pyCritterBrain::SightDistance() const +float pyCritterBrain::SightDistance() const { if (!fBrain) return 0; return fBrain->SightDistance(); } -void pyCritterBrain::HearingDistance(hsScalar hearDis) +void pyCritterBrain::HearingDistance(float hearDis) { if (!fBrain) return; fBrain->HearingDistance(hearDis); } -hsScalar pyCritterBrain::HearingDistance() const +float pyCritterBrain::HearingDistance() const { if (!fBrain) return 0; diff --git a/Sources/Plasma/FeatureLib/pfPython/pyCritterBrain.h b/Sources/Plasma/FeatureLib/pfPython/pyCritterBrain.h index b60cc849..8f211ae9 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyCritterBrain.h +++ b/Sources/Plasma/FeatureLib/pfPython/pyCritterBrain.h @@ -104,15 +104,15 @@ public: bool AvoidingAvatars() const; bool AtGoal() const; - void StopDistance(hsScalar stopDistance); - hsScalar StopDistance() const; - - void SightCone(hsScalar coneRad); - hsScalar SightCone() const; - void SightDistance(hsScalar sightDis); - hsScalar SightDistance() const; - void HearingDistance(hsScalar hearDis); - hsScalar HearingDistance() const; + void StopDistance(float stopDistance); + float StopDistance() const; + + void SightCone(float coneRad); + float SightCone() const; + void SightDistance(float sightDis); + float SightDistance() const; + void HearingDistance(float hearDis); + float HearingDistance() const; bool CanSeeAvatar(unsigned long id) const; bool CanHearAvatar(unsigned long id) const; diff --git a/Sources/Plasma/FeatureLib/pfPython/pyCritterBrainGlue.cpp b/Sources/Plasma/FeatureLib/pfPython/pyCritterBrainGlue.cpp index cf4594a4..da1435a6 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyCritterBrainGlue.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/pyCritterBrainGlue.cpp @@ -173,7 +173,7 @@ PYTHON_METHOD_DEFINITION_WKEY(ptCritterBrain, addBehavior, args, keywords) if (PyUnicode_Check(animNameObj)) { int strLen = PyUnicode_GetSize(animNameObj); - wchar_t* text = TRACKED_NEW wchar_t[strLen + 1]; + wchar_t* text = new wchar_t[strLen + 1]; PyUnicode_AsWideChar((PyUnicodeObject*)animNameObj, text, strLen); text[strLen] = L'\0'; char* cText = hsWStringToString(text); @@ -193,7 +193,7 @@ PYTHON_METHOD_DEFINITION_WKEY(ptCritterBrain, addBehavior, args, keywords) if (PyUnicode_Check(behNameObj)) { int strLen = PyUnicode_GetSize(behNameObj); - wchar_t* text = TRACKED_NEW wchar_t[strLen + 1]; + wchar_t* text = new wchar_t[strLen + 1]; PyUnicode_AsWideChar((PyUnicodeObject*)behNameObj, text, strLen); text[strLen] = L'\0'; char* cText = hsWStringToString(text); @@ -228,7 +228,7 @@ PYTHON_METHOD_DEFINITION_WKEY(ptCritterBrain, startBehavior, args, keywords) if (PyUnicode_Check(behNameObj)) { int strLen = PyUnicode_GetSize(behNameObj); - wchar_t* text = TRACKED_NEW wchar_t[strLen + 1]; + wchar_t* text = new wchar_t[strLen + 1]; PyUnicode_AsWideChar((PyUnicodeObject*)behNameObj, text, strLen); text[strLen] = L'\0'; char* cText = hsWStringToString(text); @@ -260,7 +260,7 @@ PYTHON_METHOD_DEFINITION(ptCritterBrain, runningBehavior, args) if (PyUnicode_Check(behNameObj)) { int strLen = PyUnicode_GetSize(behNameObj); - wchar_t* text = TRACKED_NEW wchar_t[strLen + 1]; + wchar_t* text = new wchar_t[strLen + 1]; PyUnicode_AsWideChar((PyUnicodeObject*)behNameObj, text, strLen); text[strLen] = L'\0'; char* cText = hsWStringToString(text); diff --git a/Sources/Plasma/FeatureLib/pfPython/pyDniCoordinates.cpp b/Sources/Plasma/FeatureLib/pfPython/pyDniCoordinates.cpp index 0b44b225..c3f30e19 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyDniCoordinates.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/pyDniCoordinates.cpp @@ -48,7 +48,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com pyDniCoordinates::pyDniCoordinates(plDniCoordinateInfo* coord) { - fCoords = TRACKED_NEW plDniCoordinateInfo; + fCoords = new plDniCoordinateInfo; if (coord) { // copy their coords into our copy fCoords->SetTorans(coord->GetTorans()); @@ -60,7 +60,7 @@ pyDniCoordinates::pyDniCoordinates(plDniCoordinateInfo* coord) pyDniCoordinates::pyDniCoordinates() { - fCoords = TRACKED_NEW plDniCoordinateInfo; + fCoords = new plDniCoordinateInfo; fCoords->SetTorans(0); fCoords->SetHSpans(0); fCoords->SetVSpans(0); diff --git a/Sources/Plasma/FeatureLib/pfPython/pyDniCoordinates.h b/Sources/Plasma/FeatureLib/pfPython/pyDniCoordinates.h index 79b752e7..8fe5a383 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyDniCoordinates.h +++ b/Sources/Plasma/FeatureLib/pfPython/pyDniCoordinates.h @@ -48,7 +48,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // ////////////////////////////////////////////////////////////////////// -#include "hsTypes.h" +#include "HeadSpin.h" #include "hsGeometry3.h" #include diff --git a/Sources/Plasma/FeatureLib/pfPython/pyDniInfoSource.cpp b/Sources/Plasma/FeatureLib/pfPython/pyDniInfoSource.cpp index 97a60626..a761e26c 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyDniInfoSource.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/pyDniInfoSource.cpp @@ -51,7 +51,7 @@ pyDniInfoSource::pyDniInfoSource() {} pyDniInfoSource::~pyDniInfoSource() { - FREE(fAgeName); + free(fAgeName); } PyObject* pyDniInfoSource::GetAgeCoords( void ) @@ -65,16 +65,16 @@ PyObject* pyDniInfoSource::GetAgeCoords( void ) PYTHON_RETURN_NONE; } -UInt32 pyDniInfoSource::GetAgeTime( void ) const +uint32_t pyDniInfoSource::GetAgeTime( void ) const { RelVaultNode * node = VaultGetAgeInfoNodeIncRef(); if (!node) return 0; - UInt32 result; + uint32_t result; VaultAgeInfoNode ageInfo(node); if (const plUnifiedTime * utime = ageInfo.GetAgeTime()) - result = (UInt32)utime->GetSecs(); + result = (uint32_t)utime->GetSecs(); else result = 0; node->DecRef(); diff --git a/Sources/Plasma/FeatureLib/pfPython/pyDniInfoSource.h b/Sources/Plasma/FeatureLib/pfPython/pyDniInfoSource.h index dffb3a32..9fe1881f 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyDniInfoSource.h +++ b/Sources/Plasma/FeatureLib/pfPython/pyDniInfoSource.h @@ -42,7 +42,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #ifndef pyDniInfoSource_h_inc #define pyDniInfoSource_h_inc -#include "hsTypes.h" +#include "HeadSpin.h" #include "hsStlUtils.h" @@ -74,7 +74,7 @@ public: // current coords of the player in current age as a pyDniCoordinates PyObject* GetAgeCoords( void ); // returns pyDniCoordinates // current time in current age (tbd) - UInt32 GetAgeTime( void ) const; + uint32_t GetAgeTime( void ) const; // name of current age const char * GetAgeName( void ) const; // unique identifier for this age instance diff --git a/Sources/Plasma/FeatureLib/pfPython/pyDrawControl.cpp b/Sources/Plasma/FeatureLib/pfPython/pyDrawControl.cpp index d27330a8..9c9ec3c8 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyDrawControl.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/pyDrawControl.cpp @@ -58,13 +58,13 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "plAvatar/plArmatureMod.h" #endif -void pyDrawControl::SetGamma2(hsScalar gamma) +void pyDrawControl::SetGamma2(float gamma) { #ifndef BUILDING_PYPLASMA char command[256]; sprintf(command,"Graphics.Renderer.Gamma2 %f",gamma); // create message to send to the console - plControlEventMsg* pMsg = TRACKED_NEW plControlEventMsg; + plControlEventMsg* pMsg = new plControlEventMsg; pMsg->SetBCastFlag(plMessage::kBCastByType); pMsg->SetControlCode(B_CONTROL_CONSOLE_COMMAND); pMsg->SetControlActivated(true); @@ -77,14 +77,14 @@ void pyDrawControl::SetGamma2(hsScalar gamma) #include "plGLight/plShadowMaster.h" #endif -void pyDrawControl::SetShadowVisDistance(hsScalar distance) +void pyDrawControl::SetShadowVisDistance(float distance) { #ifndef BUILDING_PYPLASMA plShadowMaster::SetGlobalShadowQuality(distance); #endif } -hsScalar pyDrawControl::GetShadowVisDistance() +float pyDrawControl::GetShadowVisDistance() { #ifndef BUILDING_PYPLASMA return plShadowMaster::GetGlobalShadowQuality(); @@ -131,7 +131,7 @@ void pyDrawControl::DisableRenderScene() { #ifndef BUILDING_PYPLASMA plKey clientKey = hsgResMgr::ResMgr()->FindKey( kClient_KEY ); - plClientMsg* msg = TRACKED_NEW plClientMsg(plClientMsg::kDisableRenderScene); + plClientMsg* msg = new plClientMsg(plClientMsg::kDisableRenderScene); msg->AddReceiver( clientKey ); msg->Send(); #endif @@ -141,7 +141,7 @@ void pyDrawControl::EnableRenderScene() { #ifndef BUILDING_PYPLASMA plKey clientKey = hsgResMgr::ResMgr()->FindKey( kClient_KEY ); - plClientMsg* msg = TRACKED_NEW plClientMsg(plClientMsg::kEnableRenderScene); + plClientMsg* msg = new plClientMsg(plClientMsg::kEnableRenderScene); msg->AddReceiver( clientKey ); msg->Send(); #endif diff --git a/Sources/Plasma/FeatureLib/pfPython/pyDrawControl.h b/Sources/Plasma/FeatureLib/pfPython/pyDrawControl.h index d271744e..29ce034f 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyDrawControl.h +++ b/Sources/Plasma/FeatureLib/pfPython/pyDrawControl.h @@ -48,7 +48,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // ////////////////////////////////////////////////////////////////////// -#include "hsTypes.h" +#include "HeadSpin.h" #include "hsStlUtils.h" @@ -65,9 +65,9 @@ public: //static void AddPlasmaConstantsClasses(PyObject* m); // static python functions - static void SetGamma2(hsScalar gamma); - static void SetShadowVisDistance(hsScalar distance); - static hsScalar GetShadowVisDistance(); + static void SetGamma2(float gamma); + static void SetShadowVisDistance(float distance); + static float GetShadowVisDistance(); static void EnableShadows(); static void DisableShadows(); static hsBool IsShadowsEnabled(); diff --git a/Sources/Plasma/FeatureLib/pfPython/pyDynamicText.cpp b/Sources/Plasma/FeatureLib/pfPython/pyDynamicText.cpp index 65a9ff52..63b48590 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyDynamicText.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/pyDynamicText.cpp @@ -120,7 +120,7 @@ plDynamicTextMsg* pyDynamicText::ICreateDTMsg() // must have a receiver! if ( fReceivers.Count() > 0 ) { - plDynamicTextMsg* pMsg = TRACKED_NEW plDynamicTextMsg; + plDynamicTextMsg* pMsg = new plDynamicTextMsg; if ( fSenderKey ) pMsg->SetSender(fSenderKey); if ( fNetPropagate ) @@ -198,7 +198,7 @@ void pyDynamicText::SetTextColor2( pyColor& color, bool blockRGB ) } } -void pyDynamicText::SetFont( const char *facename, Int16 size ) +void pyDynamicText::SetFont( const char *facename, int16_t size ) { // create message plDynamicTextMsg* pMsg = ICreateDTMsg(); @@ -209,7 +209,7 @@ void pyDynamicText::SetFont( const char *facename, Int16 size ) } } -void pyDynamicText::FillRect( UInt16 left, UInt16 top, UInt16 right, UInt16 bottom, pyColor& color ) +void pyDynamicText::FillRect( uint16_t left, uint16_t top, uint16_t right, uint16_t bottom, pyColor& color ) { // create message plDynamicTextMsg* pMsg = ICreateDTMsg(); @@ -220,7 +220,7 @@ void pyDynamicText::FillRect( UInt16 left, UInt16 top, UInt16 right, UInt16 bott } } -void pyDynamicText::FrameRect( UInt16 left, UInt16 top, UInt16 right, UInt16 bottom, pyColor& color ) +void pyDynamicText::FrameRect( uint16_t left, uint16_t top, uint16_t right, uint16_t bottom, pyColor& color ) { // create message plDynamicTextMsg* pMsg = ICreateDTMsg(); @@ -231,7 +231,7 @@ void pyDynamicText::FrameRect( UInt16 left, UInt16 top, UInt16 right, UInt16 bot } } -void pyDynamicText::SetClipping( UInt16 clipLeft, UInt16 clipTop, UInt16 clipRight, UInt16 clipBottom) +void pyDynamicText::SetClipping( uint16_t clipLeft, uint16_t clipTop, uint16_t clipRight, uint16_t clipBottom) { fClip = true; fClipLeft = clipLeft; @@ -245,7 +245,7 @@ void pyDynamicText::UnsetClipping() fClip = false; } -void pyDynamicText::SetWrapping( UInt16 wrapWidth, UInt16 wrapHeight ) +void pyDynamicText::SetWrapping( uint16_t wrapWidth, uint16_t wrapHeight ) { fWrap = true; fWrapWidth = wrapWidth; @@ -260,7 +260,7 @@ void pyDynamicText::UnsetWrapping() // // Draw text paying attention to Clipping and Wrapping if user wanted it // -void pyDynamicText::DrawText( Int16 x, Int16 y, const char *text ) +void pyDynamicText::DrawText( int16_t x, int16_t y, const char *text ) { // create message plDynamicTextMsg* pMsg = ICreateDTMsg(); @@ -281,7 +281,7 @@ void pyDynamicText::DrawText( Int16 x, Int16 y, const char *text ) } } -void pyDynamicText::DrawTextW( Int16 x, Int16 y, std::wstring text ) +void pyDynamicText::DrawTextW( int16_t x, int16_t y, std::wstring text ) { // create message plDynamicTextMsg* pMsg = ICreateDTMsg(); @@ -305,7 +305,7 @@ void pyDynamicText::DrawTextW( Int16 x, Int16 y, std::wstring text ) // // Draw an image on the DynamicMap // -void pyDynamicText::DrawImage( UInt16 x, UInt16 y, pyImage& image, hsBool respectAlpha ) +void pyDynamicText::DrawImage( uint16_t x, uint16_t y, pyImage& image, hsBool respectAlpha ) { // create message plDynamicTextMsg* pMsg = ICreateDTMsg(); @@ -319,7 +319,7 @@ void pyDynamicText::DrawImage( UInt16 x, UInt16 y, pyImage& image, hsBool respec // // Draw an image on the DynamicMap // -void pyDynamicText::DrawImageClipped( UInt16 x, UInt16 y, pyImage& image, UInt16 cx, UInt16 cy, UInt16 cw, UInt16 ch, +void pyDynamicText::DrawImageClipped( uint16_t x, uint16_t y, pyImage& image, uint16_t cx, uint16_t cy, uint16_t cw, uint16_t ch, hsBool respectAlpha ) { // create message @@ -332,7 +332,7 @@ void pyDynamicText::DrawImageClipped( UInt16 x, UInt16 y, pyImage& image, UInt16 } -UInt16 pyDynamicText::GetWidth( void ) +uint16_t pyDynamicText::GetWidth( void ) { // We better just pick our first key. Note that the ONLY time we should be getting multiple receivers // is if the export process ends up creating multiple copies of the material. Now, WHY you'd be wanting @@ -344,10 +344,10 @@ UInt16 pyDynamicText::GetWidth( void ) if( dtMap == nil ) return 0; - return (UInt16)dtMap->GetWidth(); + return (uint16_t)dtMap->GetWidth(); } -UInt16 pyDynamicText::GetHeight( void ) +uint16_t pyDynamicText::GetHeight( void ) { // We better just pick our first key. Note that the ONLY time we should be getting multiple receivers // is if the export process ends up creating multiple copies of the material. Now, WHY you'd be wanting @@ -359,7 +359,7 @@ UInt16 pyDynamicText::GetHeight( void ) if( dtMap == nil ) return 0; - return (UInt16)dtMap->GetHeight(); + return (uint16_t)dtMap->GetHeight(); } void pyDynamicText::CalcTextExtents( std::wstring text, unsigned &width, unsigned &height ) @@ -374,10 +374,10 @@ void pyDynamicText::CalcTextExtents( std::wstring text, unsigned &width, unsigne if (!dtMap) return; - width = dtMap->CalcStringWidth(text.c_str(), (UInt16*)&height); + width = dtMap->CalcStringWidth(text.c_str(), (uint16_t*)&height); } -void pyDynamicText::SetJustify(UInt8 justify) +void pyDynamicText::SetJustify(uint8_t justify) { plDynamicTextMsg* pMsg = ICreateDTMsg(); if (pMsg) @@ -387,7 +387,7 @@ void pyDynamicText::SetJustify(UInt8 justify) } } -void pyDynamicText::SetLineSpacing(Int16 spacing) +void pyDynamicText::SetLineSpacing(int16_t spacing) { plDynamicTextMsg* pMsg = ICreateDTMsg(); if (pMsg) diff --git a/Sources/Plasma/FeatureLib/pfPython/pyDynamicText.h b/Sources/Plasma/FeatureLib/pfPython/pyDynamicText.h index 08333cfc..0088f6bb 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyDynamicText.h +++ b/Sources/Plasma/FeatureLib/pfPython/pyDynamicText.h @@ -72,15 +72,15 @@ private: // clipping hsBool fClip; - UInt16 fClipLeft; - UInt16 fClipTop; - UInt16 fClipRight; - UInt16 fClipBottom; + uint16_t fClipLeft; + uint16_t fClipTop; + uint16_t fClipRight; + uint16_t fClipBottom; // wrapping hsBool fWrap; - UInt16 fWrapWidth; - UInt16 fWrapHeight; + uint16_t fWrapWidth; + uint16_t fWrapHeight; virtual plDynamicTextMsg* ICreateDTMsg(); virtual void IInit(); @@ -115,27 +115,27 @@ public: virtual void Flush( void ); virtual void SetTextColor( pyColor& color ); virtual void SetTextColor2( pyColor& color, bool blockRGB ); - virtual void SetFont( const char *facename, Int16 size ); - virtual void FillRect( UInt16 left, UInt16 top, UInt16 right, UInt16 bottom, pyColor& color ); - virtual void FrameRect( UInt16 left, UInt16 top, UInt16 right, UInt16 bottom, pyColor& color ); - virtual void SetClipping( UInt16 clipLeft, UInt16 clipTop, UInt16 clipRight, UInt16 clipBottom); + virtual void SetFont( const char *facename, int16_t size ); + virtual void FillRect( uint16_t left, uint16_t top, uint16_t right, uint16_t bottom, pyColor& color ); + virtual void FrameRect( uint16_t left, uint16_t top, uint16_t right, uint16_t bottom, pyColor& color ); + virtual void SetClipping( uint16_t clipLeft, uint16_t clipTop, uint16_t clipRight, uint16_t clipBottom); virtual void UnsetClipping(); - virtual void SetWrapping( UInt16 wrapWidth, UInt16 wrapHeight ); + virtual void SetWrapping( uint16_t wrapWidth, uint16_t wrapHeight ); virtual void UnsetWrapping(); - virtual void DrawText( Int16 x, Int16 y, const char *text ); - virtual void DrawTextW( Int16 x, Int16 y, std::wstring text ); - virtual void DrawImage( UInt16 x, UInt16 y, pyImage& image, hsBool respectAlpha ); - virtual void DrawImageClipped( UInt16 x, UInt16 y, pyImage& image, UInt16 cx, UInt16 cy, UInt16 cw, UInt16 ch, + virtual void DrawText( int16_t x, int16_t y, const char *text ); + virtual void DrawTextW( int16_t x, int16_t y, std::wstring text ); + virtual void DrawImage( uint16_t x, uint16_t y, pyImage& image, hsBool respectAlpha ); + virtual void DrawImageClipped( uint16_t x, uint16_t y, pyImage& image, uint16_t cx, uint16_t cy, uint16_t cw, uint16_t ch, hsBool respectAlpha ); virtual void PurgeImage( void ); // Actually return the visible width and height, since that's what you want to be drawing to - virtual UInt16 GetWidth( void ); - virtual UInt16 GetHeight( void ); + virtual uint16_t GetWidth( void ); + virtual uint16_t GetHeight( void ); virtual void CalcTextExtents( std::wstring text, unsigned &width, unsigned &height ); - virtual void SetJustify(UInt8 justify); - virtual void SetLineSpacing(Int16 spacing); + virtual void SetJustify(uint8_t justify); + virtual void SetLineSpacing(int16_t spacing); virtual plKey GetImage(); }; diff --git a/Sources/Plasma/FeatureLib/pfPython/pyDynamicTextGlue.cpp b/Sources/Plasma/FeatureLib/pfPython/pyDynamicTextGlue.cpp index 66fc3a2b..83c42c49 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyDynamicTextGlue.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/pyDynamicTextGlue.cpp @@ -345,7 +345,7 @@ PYTHON_METHOD_DEFINITION(ptDynamicMap, calcTextExtents, args) if (PyUnicode_Check(textObj)) { int strLen = PyUnicode_GetSize(textObj); - wchar_t* text = TRACKED_NEW wchar_t[strLen + 1]; + wchar_t* text = new wchar_t[strLen + 1]; PyUnicode_AsWideChar((PyUnicodeObject*)textObj, text, strLen); text[strLen] = L'\0'; wText = text; diff --git a/Sources/Plasma/FeatureLib/pfPython/pyEnum.cpp b/Sources/Plasma/FeatureLib/pfPython/pyEnum.cpp index 39d68cd8..3d3e3762 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyEnum.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/pyEnum.cpp @@ -76,7 +76,7 @@ static PyObject *EnumValue_new(PyTypeObject *type, PyObject *args, PyObject *) if (nameTemp) // copy the value if it was passed { - self->name = TRACKED_NEW char[strlen(nameTemp) + 1]; + self->name = new char[strlen(nameTemp) + 1]; strcpy(self->name, nameTemp); self->name[strlen(nameTemp)] = '\0'; } diff --git a/Sources/Plasma/FeatureLib/pfPython/pyEnum.h b/Sources/Plasma/FeatureLib/pfPython/pyEnum.h index 77699e7f..bba0a0aa 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyEnum.h +++ b/Sources/Plasma/FeatureLib/pfPython/pyEnum.h @@ -51,7 +51,6 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // #include -#include "hsConfig.h" #include "hsStlUtils.h" #include "pyGlueHelpers.h" diff --git a/Sources/Plasma/FeatureLib/pfPython/pyGUIControl.cpp b/Sources/Plasma/FeatureLib/pfPython/pyGUIControl.cpp index aacd131f..7baee232 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyGUIControl.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/pyGUIControl.cpp @@ -108,7 +108,7 @@ PyObject* pyGUIControl::getObjPyKey() // interface functions -UInt32 pyGUIControl::GetTagID() +uint32_t pyGUIControl::GetTagID() { if ( fGCkey ) { @@ -334,7 +334,7 @@ PyObject* pyGUIControl::GetBackSelColor() PYTHON_RETURN_NONE; } -UInt32 pyGUIControl::GetFontSize() +uint32_t pyGUIControl::GetFontSize() { if ( fGCkey ) { @@ -351,7 +351,7 @@ UInt32 pyGUIControl::GetFontSize() // set color scheme -void pyGUIControl::SetForeColor( hsScalar r, hsScalar g, hsScalar b, hsScalar a ) +void pyGUIControl::SetForeColor( float r, float g, float b, float a ) { if ( fGCkey ) { @@ -371,7 +371,7 @@ void pyGUIControl::SetForeColor( hsScalar r, hsScalar g, hsScalar b, hsScalar a } } -void pyGUIControl::SetSelColor( hsScalar r, hsScalar g, hsScalar b, hsScalar a ) +void pyGUIControl::SetSelColor( float r, float g, float b, float a ) { if ( fGCkey ) { @@ -391,7 +391,7 @@ void pyGUIControl::SetSelColor( hsScalar r, hsScalar g, hsScalar b, hsScalar a ) } } -void pyGUIControl::SetBackColor( hsScalar r, hsScalar g, hsScalar b, hsScalar a ) +void pyGUIControl::SetBackColor( float r, float g, float b, float a ) { if ( fGCkey ) { @@ -411,7 +411,7 @@ void pyGUIControl::SetBackColor( hsScalar r, hsScalar g, hsScalar b, hsScalar a } } -void pyGUIControl::SetBackSelColor( hsScalar r, hsScalar g, hsScalar b, hsScalar a ) +void pyGUIControl::SetBackSelColor( float r, float g, float b, float a ) { if ( fGCkey ) { @@ -432,7 +432,7 @@ void pyGUIControl::SetBackSelColor( hsScalar r, hsScalar g, hsScalar b, hsScalar } -void pyGUIControl::SetFontSize(UInt32 fontsize) +void pyGUIControl::SetFontSize(uint32_t fontsize) { if ( fGCkey ) { @@ -440,7 +440,7 @@ void pyGUIControl::SetFontSize(UInt32 fontsize) if ( pdmod ) { pfGUIColorScheme* color = pdmod->GetColorScheme(); - color->fFontSize = (UInt8)fontsize; + color->fFontSize = (uint8_t)fontsize; } } } diff --git a/Sources/Plasma/FeatureLib/pfPython/pyGUIControl.h b/Sources/Plasma/FeatureLib/pfPython/pyGUIControl.h index db714b2f..d2d854d7 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyGUIControl.h +++ b/Sources/Plasma/FeatureLib/pfPython/pyGUIControl.h @@ -95,7 +95,7 @@ public: virtual PyObject* getObjPyKey(); // returns pyKey // interface functions - virtual UInt32 GetTagID(); + virtual uint32_t GetTagID(); virtual void SetEnabled( hsBool e ); virtual void Enable() { SetEnabled(true); } virtual void Disable() { SetEnabled(false); } @@ -120,13 +120,13 @@ public: virtual PyObject* GetSelColor(); // returns pyColor virtual PyObject* GetBackColor(); // returns pyColor virtual PyObject* GetBackSelColor(); // returns pyColor - virtual UInt32 GetFontSize(); + virtual uint32_t GetFontSize(); // set color scheme - virtual void SetForeColor( hsScalar r, hsScalar g, hsScalar b, hsScalar a ); - virtual void SetSelColor( hsScalar r, hsScalar g, hsScalar b, hsScalar a ); - virtual void SetBackColor( hsScalar r, hsScalar g, hsScalar b, hsScalar a ); - virtual void SetBackSelColor( hsScalar r, hsScalar g, hsScalar b, hsScalar a ); - virtual void SetFontSize(UInt32 fontsize); + virtual void SetForeColor( float r, float g, float b, float a ); + virtual void SetSelColor( float r, float g, float b, float a ); + virtual void SetBackColor( float r, float g, float b, float a ); + virtual void SetBackSelColor( float r, float g, float b, float a ); + virtual void SetFontSize(uint32_t fontsize); }; diff --git a/Sources/Plasma/FeatureLib/pfPython/pyGUIControlButton.cpp b/Sources/Plasma/FeatureLib/pfPython/pyGUIControlButton.cpp index 7d2cd51e..5150559e 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyGUIControlButton.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/pyGUIControlButton.cpp @@ -64,7 +64,7 @@ hsBool pyGUIControlButton::IsGUIControlButton(pyKey& gckey) return false; } -void pyGUIControlButton::SetNotifyType(Int32 kind) +void pyGUIControlButton::SetNotifyType(int32_t kind) { if ( fGCkey ) { @@ -75,7 +75,7 @@ void pyGUIControlButton::SetNotifyType(Int32 kind) } } -Int32 pyGUIControlButton::GetNotifyType() +int32_t pyGUIControlButton::GetNotifyType() { if ( fGCkey ) { diff --git a/Sources/Plasma/FeatureLib/pfPython/pyGUIControlButton.h b/Sources/Plasma/FeatureLib/pfPython/pyGUIControlButton.h index 4aec0fd9..2c504714 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyGUIControlButton.h +++ b/Sources/Plasma/FeatureLib/pfPython/pyGUIControlButton.h @@ -77,8 +77,8 @@ public: static hsBool IsGUIControlButton(pyKey& gckey); - virtual void SetNotifyType(Int32 kind); - virtual Int32 GetNotifyType(); + virtual void SetNotifyType(int32_t kind); + virtual int32_t GetNotifyType(); virtual hsBool IsButtonDown(); }; diff --git a/Sources/Plasma/FeatureLib/pfPython/pyGUIControlDynamicText.cpp b/Sources/Plasma/FeatureLib/pfPython/pyGUIControlDynamicText.cpp index 18263223..35ab6ab6 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyGUIControlDynamicText.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/pyGUIControlDynamicText.cpp @@ -70,7 +70,7 @@ hsBool pyGUIControlDynamicText::IsGUIControlDynamicText(pyKey& gckey) //specific interface functions -UInt32 pyGUIControlDynamicText::GetNumMaps() +uint32_t pyGUIControlDynamicText::GetNumMaps() { if ( fGCkey ) { @@ -83,7 +83,7 @@ UInt32 pyGUIControlDynamicText::GetNumMaps() } -PyObject* pyGUIControlDynamicText::GetMap(UInt32 i) +PyObject* pyGUIControlDynamicText::GetMap(uint32_t i) { if ( fGCkey ) { diff --git a/Sources/Plasma/FeatureLib/pfPython/pyGUIControlDynamicText.h b/Sources/Plasma/FeatureLib/pfPython/pyGUIControlDynamicText.h index 1f7a1093..86afe0b1 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyGUIControlDynamicText.h +++ b/Sources/Plasma/FeatureLib/pfPython/pyGUIControlDynamicText.h @@ -78,8 +78,8 @@ public: static hsBool IsGUIControlDynamicText(pyKey& gckey); //specific interface functions - virtual UInt32 GetNumMaps(); - virtual PyObject* GetMap(UInt32 i); // returns pyDynamicText + virtual uint32_t GetNumMaps(); + virtual PyObject* GetMap(uint32_t i); // returns pyDynamicText }; #endif // _pyGUIControlButton_h_ diff --git a/Sources/Plasma/FeatureLib/pfPython/pyGUIControlEditBox.cpp b/Sources/Plasma/FeatureLib/pfPython/pyGUIControlEditBox.cpp index 4e5dfb0a..6db5506d 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyGUIControlEditBox.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/pyGUIControlEditBox.cpp @@ -67,7 +67,7 @@ hsBool pyGUIControlEditBox::IsGUIControlEditBox(pyKey& gckey) return false; } -void pyGUIControlEditBox::SetBufferSize( UInt32 size ) +void pyGUIControlEditBox::SetBufferSize( uint32_t size ) { if ( fGCkey ) { @@ -211,7 +211,7 @@ void pyGUIControlEditBox::SetSpecialCaptureKeyMode(hsBool state) } } -UInt32 pyGUIControlEditBox::GetLastKeyCaptured() +uint32_t pyGUIControlEditBox::GetLastKeyCaptured() { if ( fGCkey ) { @@ -223,26 +223,26 @@ UInt32 pyGUIControlEditBox::GetLastKeyCaptured() return 0; } -UInt32 pyGUIControlEditBox::GetLastModifiersCaptured() +uint32_t pyGUIControlEditBox::GetLastModifiersCaptured() { if ( fGCkey ) { // get the pointer to the modifier pfGUIEditBoxMod* pebmod = pfGUIEditBoxMod::ConvertNoRef(fGCkey->ObjectIsLoaded()); if ( pebmod ) - return (UInt32)(pebmod->GetLastModifiersCaptured()); + return (uint32_t)(pebmod->GetLastModifiersCaptured()); } return 0; } -void pyGUIControlEditBox::SetLastKeyCapture(UInt32 key, UInt32 modifiers) +void pyGUIControlEditBox::SetLastKeyCapture(uint32_t key, uint32_t modifiers) { if ( fGCkey ) { // get the pointer to the modifier pfGUIEditBoxMod* pebmod = pfGUIEditBoxMod::ConvertNoRef(fGCkey->ObjectIsLoaded()); if ( pebmod ) - pebmod->SetLastKeyCapture(key,(UInt8)modifiers); + pebmod->SetLastKeyCapture(key,(uint8_t)modifiers); } } diff --git a/Sources/Plasma/FeatureLib/pfPython/pyGUIControlEditBox.h b/Sources/Plasma/FeatureLib/pfPython/pyGUIControlEditBox.h index 05be9e80..c3bd31fa 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyGUIControlEditBox.h +++ b/Sources/Plasma/FeatureLib/pfPython/pyGUIControlEditBox.h @@ -78,7 +78,7 @@ public: static hsBool IsGUIControlEditBox(pyKey& gckey); - virtual void SetBufferSize( UInt32 size ); + virtual void SetBufferSize( uint32_t size ); virtual std::string GetBuffer( void ); virtual std::wstring GetBufferW( void ); virtual void ClearBuffer( void ); @@ -92,9 +92,9 @@ public: virtual hsBool WasEscaped(); virtual void SetSpecialCaptureKeyMode(hsBool state); - virtual UInt32 GetLastKeyCaptured(); - virtual UInt32 GetLastModifiersCaptured(); - virtual void SetLastKeyCapture(UInt32 key, UInt32 modifiers); + virtual uint32_t GetLastKeyCaptured(); + virtual uint32_t GetLastModifiersCaptured(); + virtual void SetLastKeyCapture(uint32_t key, uint32_t modifiers); virtual void SetChatMode(hsBool state); diff --git a/Sources/Plasma/FeatureLib/pfPython/pyGUIControlEditBoxGlue.cpp b/Sources/Plasma/FeatureLib/pfPython/pyGUIControlEditBoxGlue.cpp index dec6fbd5..67e1f387 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyGUIControlEditBoxGlue.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/pyGUIControlEditBoxGlue.cpp @@ -118,7 +118,7 @@ PYTHON_METHOD_DEFINITION(ptGUIControlEditBox, setStringW, args) if (PyUnicode_Check(textObj)) { int strLen = PyUnicode_GetSize(textObj); - wchar_t* text = TRACKED_NEW wchar_t[strLen + 1]; + wchar_t* text = new wchar_t[strLen + 1]; PyUnicode_AsWideChar((PyUnicodeObject*)textObj, text, strLen); text[strLen] = L'\0'; self->fThis->SetTextW(text); diff --git a/Sources/Plasma/FeatureLib/pfPython/pyGUIControlListBox.cpp b/Sources/Plasma/FeatureLib/pfPython/pyGUIControlListBox.cpp index 1d523fa8..113480b8 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyGUIControlListBox.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/pyGUIControlListBox.cpp @@ -65,8 +65,8 @@ class pfColorListElement : public pfGUIListText hsColorRGBA fTextColor2; wchar_t *fString1; wchar_t *fString2; - UInt32 fInheritAlpha; - Int32 fOverrideFontSize; // size of font to use (if -1 then just use scheme setting) + uint32_t fInheritAlpha; + int32_t fOverrideFontSize; // size of font to use (if -1 then just use scheme setting) public: enum InheritTypes @@ -78,7 +78,7 @@ class pfColorListElement : public pfGUIListText kSelectUseGUIColor, }; - pfColorListElement( const char *string1, hsColorRGBA color1, const char *string2, hsColorRGBA color2, UInt32 inheritalpha, Int32 fontsize=-1 ) + pfColorListElement( const char *string1, hsColorRGBA color1, const char *string2, hsColorRGBA color2, uint32_t inheritalpha, int32_t fontsize=-1 ) { if ( string1 ) { @@ -101,11 +101,11 @@ class pfColorListElement : public pfGUIListText fOverrideFontSize = fontsize; } - pfColorListElement( const wchar_t *string1, hsColorRGBA color1, const wchar_t *string2, hsColorRGBA color2, UInt32 inheritalpha, Int32 fontsize=-1 ) + pfColorListElement( const wchar_t *string1, hsColorRGBA color1, const wchar_t *string2, hsColorRGBA color2, uint32_t inheritalpha, int32_t fontsize=-1 ) { if ( string1 ) { - fString1 = TRACKED_NEW wchar_t[wcslen(string1)+1]; + fString1 = new wchar_t[wcslen(string1)+1]; wcscpy(fString1,string1); fText = nil; } @@ -117,7 +117,7 @@ class pfColorListElement : public pfGUIListText fTextColor1 = color1; if (string2) { - fString2 = TRACKED_NEW wchar_t[wcslen(string2)+1]; + fString2 = new wchar_t[wcslen(string2)+1]; wcscpy(fString2,string2); } else @@ -158,14 +158,14 @@ class pfColorListElement : public pfGUIListText if( text != nil ) { - fString1 = TRACKED_NEW wchar_t[wcslen(text)+1]; + fString1 = new wchar_t[wcslen(text)+1]; wcscpy(fString1,text); } else fString1 = nil; } - virtual hsBool Draw( plDynamicTextMap *textGen, UInt16 x, UInt16 y, UInt16 maxWidth, UInt16 maxHeight ) + virtual hsBool Draw( plDynamicTextMap *textGen, uint16_t x, uint16_t y, uint16_t maxWidth, uint16_t maxHeight ) { hsColorRGBA textColor1; textColor1 = fTextColor1; @@ -220,10 +220,10 @@ class pfColorListElement : public pfGUIListText if (fString1) { if ( fOverrideFontSize != -1 ) - textGen->SetFont( fColors->fFontFace, (UInt16)fOverrideFontSize, fColors->fFontFlags ); + textGen->SetFont( fColors->fFontFace, (uint16_t)fOverrideFontSize, fColors->fFontFlags ); textGen->SetTextColor( textColor1, fColors->fTransparent && fColors->fBackColor.a == 0.f ); textGen->DrawWrappedString( x + 2, y, fString1, maxWidth - 4, maxHeight ); - UInt16 width, height; + uint16_t width, height; textGen->CalcWrappedStringSize(fString1,&width,&height); x += 2 + width; if ( fString2 == nil ) @@ -242,14 +242,14 @@ class pfColorListElement : public pfGUIListText return true; } - virtual void GetSize( plDynamicTextMap *textGen, UInt16 *width, UInt16 *height ) + virtual void GetSize( plDynamicTextMap *textGen, uint16_t *width, uint16_t *height ) { hsBool wemade_string = false; wchar_t* thestring; if ( fString1 && fString2 ) { size_t length = wcslen( fString1 ) + wcslen( fString2 ) + 3; - thestring = TRACKED_NEW wchar_t[ length ]; + thestring = new wchar_t[ length ]; snwprintf( thestring, length, L"%s %s", fString1, fString2 ); wemade_string = true; } @@ -262,7 +262,7 @@ class pfColorListElement : public pfGUIListText *width = textGen->GetVisibleWidth() - 4; if ( fOverrideFontSize != -1 ) - textGen->SetFont( fColors->fFontFace, (UInt16)fOverrideFontSize, fColors->fFontFlags ); + textGen->SetFont( fColors->fFontFace, (uint16_t)fOverrideFontSize, fColors->fFontFlags ); textGen->CalcWrappedStringSize( thestring, width, height ); if ( fOverrideFontSize != -1 ) textGen->SetFont( fColors->fFontFace, fColors->fFontSize, fColors->fFontFlags ); @@ -285,29 +285,29 @@ class pfColorListElement : public pfGUIListText class pfListTextInBox : public pfGUIListText { protected: - UInt32 fMinWidth; - UInt32 fMinHeight; + uint32_t fMinWidth; + uint32_t fMinHeight; public: - pfListTextInBox( const char *text, UInt32 min_width=0, UInt32 min_height=0 ) : pfGUIListText( text ) + pfListTextInBox( const char *text, uint32_t min_width=0, uint32_t min_height=0 ) : pfGUIListText( text ) { fMinWidth = min_width; fMinHeight = min_height; fJustify = pfGUIListText::kCenter; } - pfListTextInBox( const wchar_t *text, UInt32 min_width=0, UInt32 min_height=0 ) : pfGUIListText( text ) + pfListTextInBox( const wchar_t *text, uint32_t min_width=0, uint32_t min_height=0 ) : pfGUIListText( text ) { fMinWidth = min_width; fMinHeight = min_height; fJustify = pfGUIListText::kCenter; } - virtual void GetSize( plDynamicTextMap *textGen, UInt16 *width, UInt16 *height ) + virtual void GetSize( plDynamicTextMap *textGen, uint16_t *width, uint16_t *height ) { *width = textGen->CalcStringWidth( GetText(), height ); if ( *width < fMinWidth ) - *width = (UInt16)fMinWidth; + *width = (uint16_t)fMinWidth; if( height != nil ) { if( *height == 0 ) @@ -315,7 +315,7 @@ class pfListTextInBox : public pfGUIListText else *height += 0; // Add one pixel on each side for padding (or not, 3.21.02 mcn) if ( *height < fMinHeight ) - *height = (UInt16)fMinHeight; + *height = (uint16_t)fMinHeight; } } }; @@ -323,13 +323,13 @@ class pfListTextInBox : public pfGUIListText class pfListPictureInBox : public pfGUIListPicture { protected: - UInt32 fSrcX; - UInt32 fSrcY; - UInt32 fSrcWidth; - UInt32 fSrcHeight; + uint32_t fSrcX; + uint32_t fSrcY; + uint32_t fSrcWidth; + uint32_t fSrcHeight; public: - pfListPictureInBox( plKey mipKey, UInt32 x, UInt32 y, UInt32 width, UInt32 height, hsBool respectAlpha ) : pfGUIListPicture( mipKey,respectAlpha ) + pfListPictureInBox( plKey mipKey, uint32_t x, uint32_t y, uint32_t width, uint32_t height, hsBool respectAlpha ) : pfGUIListPicture( mipKey,respectAlpha ) { fSrcX = x; fSrcY = y; @@ -337,7 +337,7 @@ class pfListPictureInBox : public pfGUIListPicture fSrcHeight = height; } - virtual hsBool Draw( plDynamicTextMap *textGen, UInt16 x, UInt16 y, UInt16 maxWidth, UInt16 maxHeight ) + virtual hsBool Draw( plDynamicTextMap *textGen, uint16_t x, uint16_t y, uint16_t maxWidth, uint16_t maxHeight ) { plMipmap *mip = plMipmap::ConvertNoRef( fMipmapKey->ObjectIsLoaded() ); if( mip != nil ) @@ -346,7 +346,7 @@ class pfListPictureInBox : public pfGUIListPicture return false; if( fSelected ) - textGen->FillRect( x, y, (UInt16)fSrcWidth, (UInt16)fSrcHeight, fColors->fSelForeColor ); + textGen->FillRect( x, y, (uint16_t)fSrcWidth, (uint16_t)fSrcHeight, fColors->fSelForeColor ); // hack!!!! This is to get the non-selected items to show up.... // ... they need some kinda background to alpha to else @@ -355,19 +355,19 @@ class pfListPictureInBox : public pfGUIListPicture { hsColorRGBA backcolor = fColors->fBackColor; backcolor.a = 1.0; - textGen->FillRect( x, y, (UInt16)fSrcWidth, (UInt16)fSrcHeight, backcolor ); + textGen->FillRect( x, y, (uint16_t)fSrcWidth, (uint16_t)fSrcHeight, backcolor ); } } // end of hack - textGen->DrawClippedImage( x + fBorderSize, y + fBorderSize, mip, (UInt16)fSrcX, (UInt16)fSrcY, (UInt16)fSrcWidth, (UInt16)fSrcHeight, + textGen->DrawClippedImage( x + fBorderSize, y + fBorderSize, mip, (uint16_t)fSrcX, (uint16_t)fSrcY, (uint16_t)fSrcWidth, (uint16_t)fSrcHeight, fRespectAlpha ? plDynamicTextMap::kImgBlend : plDynamicTextMap::kImgNoAlpha ); } return true; } - virtual void GetSize( plDynamicTextMap *textGen, UInt16 *width, UInt16 *height ) + virtual void GetSize( plDynamicTextMap *textGen, uint16_t *width, uint16_t *height ) { plMipmap *mip = plMipmap::ConvertNoRef( fMipmapKey->ObjectIsLoaded() ); if( mip == nil ) @@ -378,9 +378,9 @@ class pfListPictureInBox : public pfGUIListPicture } else { - *width = (UInt16)(fSrcWidth + fBorderSize + fBorderSize); + *width = (uint16_t)(fSrcWidth + fBorderSize + fBorderSize); if( height != nil ) - *height = (UInt16)(fSrcHeight + fBorderSize + fBorderSize); + *height = (uint16_t)(fSrcHeight + fBorderSize + fBorderSize); } } }; @@ -392,10 +392,10 @@ class pfListPictureInBoxWithSwatches : public pfListPictureInBox public: - static UInt16 fSwatchSize, fSwatchOffset; + static uint16_t fSwatchSize, fSwatchOffset; - pfListPictureInBoxWithSwatches( plKey mipKey, UInt32 x, UInt32 y, - UInt32 width, UInt32 height, + pfListPictureInBoxWithSwatches( plKey mipKey, uint32_t x, uint32_t y, + uint32_t width, uint32_t height, hsBool respectAlpha, const hsColorRGBA &primaryColor, const hsColorRGBA &secondaryColor ) : pfListPictureInBox( mipKey, x, y, width, height, respectAlpha ) @@ -404,7 +404,7 @@ class pfListPictureInBoxWithSwatches : public pfListPictureInBox fSColor = secondaryColor; } - virtual hsBool Draw( plDynamicTextMap *textGen, UInt16 x, UInt16 y, UInt16 maxWidth, UInt16 maxHeight ) + virtual hsBool Draw( plDynamicTextMap *textGen, uint16_t x, uint16_t y, uint16_t maxWidth, uint16_t maxHeight ) { if( !pfListPictureInBox::Draw( textGen, x, y, maxWidth, maxHeight ) ) return false; @@ -424,8 +424,8 @@ class pfListPictureInBoxWithSwatches : public pfListPictureInBox return true; } }; -UInt16 pfListPictureInBoxWithSwatches::fSwatchSize = 16; -UInt16 pfListPictureInBoxWithSwatches::fSwatchOffset = 5; +uint16_t pfListPictureInBoxWithSwatches::fSwatchSize = 16; +uint16_t pfListPictureInBoxWithSwatches::fSwatchOffset = 5; @@ -444,7 +444,7 @@ hsBool pyGUIControlListBox::IsGUIControlListBox(pyKey& gckey) return false; } -Int32 pyGUIControlListBox::GetSelection( void ) +int32_t pyGUIControlListBox::GetSelection( void ) { if ( fGCkey ) { @@ -456,7 +456,7 @@ Int32 pyGUIControlListBox::GetSelection( void ) return -1; } -void pyGUIControlListBox::SetSelection( Int32 item ) +void pyGUIControlListBox::SetSelection( int32_t item ) { if ( fGCkey ) { @@ -478,7 +478,7 @@ void pyGUIControlListBox::Refresh( void ) } } -void pyGUIControlListBox::RemoveElement( UInt16 index ) +void pyGUIControlListBox::RemoveElement( uint16_t index ) { if ( fGCkey ) { @@ -500,7 +500,7 @@ void pyGUIControlListBox::ClearAllElements( void ) } } -UInt16 pyGUIControlListBox::GetNumElements( void ) +uint16_t pyGUIControlListBox::GetNumElements( void ) { if ( fGCkey ) { @@ -512,14 +512,14 @@ UInt16 pyGUIControlListBox::GetNumElements( void ) return 0; } -void pyGUIControlListBox::SetElement( UInt16 idx, const char* text ) +void pyGUIControlListBox::SetElement( uint16_t idx, const char* text ) { wchar_t *wText = hsStringToWString(text); SetElementW(idx,wText); delete [] wText; } -void pyGUIControlListBox::SetElementW( UInt16 idx, std::wstring text ) +void pyGUIControlListBox::SetElementW( uint16_t idx, std::wstring text ) { if ( fGCkey ) { @@ -541,7 +541,7 @@ void pyGUIControlListBox::SetElementW( UInt16 idx, std::wstring text ) } } -void pyGUIControlListBox::SetStringJustify( UInt16 idx, UInt32 justify) +void pyGUIControlListBox::SetStringJustify( uint16_t idx, uint32_t justify) { if ( fGCkey ) { @@ -564,7 +564,7 @@ void pyGUIControlListBox::SetStringJustify( UInt16 idx, UInt32 justify) } -std::string pyGUIControlListBox::GetElement( UInt16 idx ) +std::string pyGUIControlListBox::GetElement( uint16_t idx ) { std::wstring wRetVal = GetElementW(idx); char *temp = hsWStringToString(wRetVal.c_str()); @@ -573,7 +573,7 @@ std::string pyGUIControlListBox::GetElement( UInt16 idx ) return retVal; } -std::wstring pyGUIControlListBox::GetElementW( UInt16 idx ) +std::wstring pyGUIControlListBox::GetElementW( uint16_t idx ) { if ( fGCkey ) { @@ -601,15 +601,15 @@ std::wstring pyGUIControlListBox::GetElementW( UInt16 idx ) return L""; } -Int16 pyGUIControlListBox::AddString( const char *string ) +int16_t pyGUIControlListBox::AddString( const char *string ) { wchar_t *wString = hsStringToWString(string); - Int16 retVal = AddStringW(wString); + int16_t retVal = AddStringW(wString); delete [] wString; return retVal; } -Int16 pyGUIControlListBox::AddStringW( std::wstring string ) +int16_t pyGUIControlListBox::AddStringW( std::wstring string ) { if ( fGCkey ) { @@ -617,7 +617,7 @@ Int16 pyGUIControlListBox::AddStringW( std::wstring string ) pfGUIListBoxMod* plbmod = pfGUIListBoxMod::ConvertNoRef(fGCkey->ObjectIsLoaded()); if ( plbmod ) { - pfGUIListText *element = TRACKED_NEW pfGUIListText( string.c_str() ); + pfGUIListText *element = new pfGUIListText( string.c_str() ); if( fBuildRoots.GetCount() > 0 ) fBuildRoots[ fBuildRoots.GetCount() - 1 ]->AddChild( element ); return plbmod->AddElement( element ); @@ -626,7 +626,7 @@ Int16 pyGUIControlListBox::AddStringW( std::wstring string ) return -1; } -Int16 pyGUIControlListBox::AddImage( pyImage& image, hsBool respectAlpha ) +int16_t pyGUIControlListBox::AddImage( pyImage& image, hsBool respectAlpha ) { if ( fGCkey ) { @@ -634,7 +634,7 @@ Int16 pyGUIControlListBox::AddImage( pyImage& image, hsBool respectAlpha ) pfGUIListBoxMod* plbmod = pfGUIListBoxMod::ConvertNoRef(fGCkey->ObjectIsLoaded()); if ( plbmod ) { - pfGUIListPicture *element = TRACKED_NEW pfGUIListPicture(image.GetKey(),respectAlpha); + pfGUIListPicture *element = new pfGUIListPicture(image.GetKey(),respectAlpha); if( fBuildRoots.GetCount() > 0 ) fBuildRoots[ fBuildRoots.GetCount() - 1 ]->AddChild( element ); return plbmod->AddElement( element ); @@ -644,15 +644,15 @@ Int16 pyGUIControlListBox::AddImage( pyImage& image, hsBool respectAlpha ) } -Int16 pyGUIControlListBox::FindString( const char *toCompareTo ) +int16_t pyGUIControlListBox::FindString( const char *toCompareTo ) { wchar_t *wToCompareTo = hsStringToWString(toCompareTo); - Int16 retVal = FindStringW(wToCompareTo); + int16_t retVal = FindStringW(wToCompareTo); delete [] wToCompareTo; return retVal; } -Int16 pyGUIControlListBox::FindStringW( std::wstring toCompareTo ) +int16_t pyGUIControlListBox::FindStringW( std::wstring toCompareTo ) { if ( fGCkey ) { @@ -664,15 +664,15 @@ Int16 pyGUIControlListBox::FindStringW( std::wstring toCompareTo ) return -1; } -Int16 pyGUIControlListBox::AddTextWColor( const char *str, pyColor& textcolor, UInt32 inheritalpha) +int16_t pyGUIControlListBox::AddTextWColor( const char *str, pyColor& textcolor, uint32_t inheritalpha) { wchar_t *wStr = hsStringToWString(str); - Int16 retVal = AddTextWColorW(wStr,textcolor,inheritalpha); + int16_t retVal = AddTextWColorW(wStr,textcolor,inheritalpha); delete [] wStr; return retVal; } -Int16 pyGUIControlListBox::AddTextWColorW( std::wstring str, pyColor& textcolor, UInt32 inheritalpha) +int16_t pyGUIControlListBox::AddTextWColorW( std::wstring str, pyColor& textcolor, uint32_t inheritalpha) { if ( fGCkey ) { @@ -680,7 +680,7 @@ Int16 pyGUIControlListBox::AddTextWColorW( std::wstring str, pyColor& textcolor, pfGUIListBoxMod* plbmod = pfGUIListBoxMod::ConvertNoRef(fGCkey->ObjectIsLoaded()); if ( plbmod ) { - pfColorListElement *element = TRACKED_NEW pfColorListElement( str.c_str(), textcolor.getColor(),nil,hsColorRGBA(),inheritalpha ); + pfColorListElement *element = new pfColorListElement( str.c_str(), textcolor.getColor(),nil,hsColorRGBA(),inheritalpha ); if( fBuildRoots.GetCount() > 0 ) fBuildRoots[ fBuildRoots.GetCount() - 1 ]->AddChild( element ); return plbmod->AddElement( element ); @@ -689,15 +689,15 @@ Int16 pyGUIControlListBox::AddTextWColorW( std::wstring str, pyColor& textcolor, return -1; } -Int16 pyGUIControlListBox::AddTextWColorWSize( const char *str, pyColor& textcolor, UInt32 inheritalpha, Int32 fontsize) +int16_t pyGUIControlListBox::AddTextWColorWSize( const char *str, pyColor& textcolor, uint32_t inheritalpha, int32_t fontsize) { wchar_t *wStr = hsStringToWString(str); - Int16 retVal = AddTextWColorWSizeW(wStr,textcolor,inheritalpha,fontsize); + int16_t retVal = AddTextWColorWSizeW(wStr,textcolor,inheritalpha,fontsize); delete [] wStr; return retVal; } -Int16 pyGUIControlListBox::AddTextWColorWSizeW( std::wstring str, pyColor& textcolor, UInt32 inheritalpha, Int32 fontsize) +int16_t pyGUIControlListBox::AddTextWColorWSizeW( std::wstring str, pyColor& textcolor, uint32_t inheritalpha, int32_t fontsize) { if ( fGCkey ) { @@ -705,7 +705,7 @@ Int16 pyGUIControlListBox::AddTextWColorWSizeW( std::wstring str, pyColor& textc pfGUIListBoxMod* plbmod = pfGUIListBoxMod::ConvertNoRef(fGCkey->ObjectIsLoaded()); if ( plbmod ) { - pfColorListElement *element = TRACKED_NEW pfColorListElement( str.c_str(), textcolor.getColor(),nil,hsColorRGBA(),inheritalpha, fontsize ); + pfColorListElement *element = new pfColorListElement( str.c_str(), textcolor.getColor(),nil,hsColorRGBA(),inheritalpha, fontsize ); if( fBuildRoots.GetCount() > 0 ) fBuildRoots[ fBuildRoots.GetCount() - 1 ]->AddChild( element ); return plbmod->AddElement( element ); @@ -714,7 +714,7 @@ Int16 pyGUIControlListBox::AddTextWColorWSizeW( std::wstring str, pyColor& textc return -1; } -void pyGUIControlListBox::Add2TextWColor( const char *str1, pyColor& textcolor1,const char *str2, pyColor& textcolor2, UInt32 inheritalpha) +void pyGUIControlListBox::Add2TextWColor( const char *str1, pyColor& textcolor1,const char *str2, pyColor& textcolor2, uint32_t inheritalpha) { wchar_t *wStr1 = hsStringToWString(str1); wchar_t *wStr2 = hsStringToWString(str2); @@ -723,7 +723,7 @@ void pyGUIControlListBox::Add2TextWColor( const char *str1, pyColor& textcolor1, delete [] wStr1; } -void pyGUIControlListBox::Add2TextWColorW( std::wstring str1, pyColor& textcolor1, std::wstring str2, pyColor& textcolor2, UInt32 inheritalpha) +void pyGUIControlListBox::Add2TextWColorW( std::wstring str1, pyColor& textcolor1, std::wstring str2, pyColor& textcolor2, uint32_t inheritalpha) { if ( fGCkey ) { @@ -731,7 +731,7 @@ void pyGUIControlListBox::Add2TextWColorW( std::wstring str1, pyColor& textcolor pfGUIListBoxMod* plbmod = pfGUIListBoxMod::ConvertNoRef(fGCkey->ObjectIsLoaded()); if ( plbmod ) { - pfColorListElement *element = TRACKED_NEW pfColorListElement(str1.c_str(),textcolor1.getColor(),str2.c_str(),textcolor2.getColor(),inheritalpha ); + pfColorListElement *element = new pfColorListElement(str1.c_str(),textcolor1.getColor(),str2.c_str(),textcolor2.getColor(),inheritalpha ); if( fBuildRoots.GetCount() > 0 ) fBuildRoots[ fBuildRoots.GetCount() - 1 ]->AddChild( element ); plbmod->AddElement( element ); @@ -739,7 +739,7 @@ void pyGUIControlListBox::Add2TextWColorW( std::wstring str1, pyColor& textcolor } } -Int16 pyGUIControlListBox::AddStringInBox( const char *string, UInt32 min_width, UInt32 min_height ) +int16_t pyGUIControlListBox::AddStringInBox( const char *string, uint32_t min_width, uint32_t min_height ) { if ( fGCkey ) { @@ -747,7 +747,7 @@ Int16 pyGUIControlListBox::AddStringInBox( const char *string, UInt32 min_width, pfGUIListBoxMod* plbmod = pfGUIListBoxMod::ConvertNoRef(fGCkey->ObjectIsLoaded()); if ( plbmod ) { - pfListTextInBox *element = TRACKED_NEW pfListTextInBox( string, min_width, min_height ); + pfListTextInBox *element = new pfListTextInBox( string, min_width, min_height ); if( fBuildRoots.GetCount() > 0 ) fBuildRoots[ fBuildRoots.GetCount() - 1 ]->AddChild( element ); return plbmod->AddElement( element ); @@ -756,7 +756,7 @@ Int16 pyGUIControlListBox::AddStringInBox( const char *string, UInt32 min_width, return -1; } -Int16 pyGUIControlListBox::AddStringInBoxW( std::wstring string, UInt32 min_width, UInt32 min_height ) +int16_t pyGUIControlListBox::AddStringInBoxW( std::wstring string, uint32_t min_width, uint32_t min_height ) { if ( fGCkey ) { @@ -764,7 +764,7 @@ Int16 pyGUIControlListBox::AddStringInBoxW( std::wstring string, UInt32 min_widt pfGUIListBoxMod* plbmod = pfGUIListBoxMod::ConvertNoRef(fGCkey->ObjectIsLoaded()); if ( plbmod ) { - pfListTextInBox *element = TRACKED_NEW pfListTextInBox( string.c_str(), min_width, min_height ); + pfListTextInBox *element = new pfListTextInBox( string.c_str(), min_width, min_height ); if( fBuildRoots.GetCount() > 0 ) fBuildRoots[ fBuildRoots.GetCount() - 1 ]->AddChild( element ); return plbmod->AddElement( element ); @@ -773,7 +773,7 @@ Int16 pyGUIControlListBox::AddStringInBoxW( std::wstring string, UInt32 min_widt return -1; } -Int16 pyGUIControlListBox::AddImageInBox( pyImage& image, UInt32 x, UInt32 y, UInt32 width, UInt32 height, hsBool respectAlpha ) +int16_t pyGUIControlListBox::AddImageInBox( pyImage& image, uint32_t x, uint32_t y, uint32_t width, uint32_t height, hsBool respectAlpha ) { if ( fGCkey ) { @@ -781,7 +781,7 @@ Int16 pyGUIControlListBox::AddImageInBox( pyImage& image, UInt32 x, UInt32 y, pfGUIListBoxMod* plbmod = pfGUIListBoxMod::ConvertNoRef(fGCkey->ObjectIsLoaded()); if ( plbmod ) { - pfListPictureInBox *element = TRACKED_NEW pfListPictureInBox(image.GetKey(),x,y,width,height,respectAlpha); + pfListPictureInBox *element = new pfListPictureInBox(image.GetKey(),x,y,width,height,respectAlpha); if( fBuildRoots.GetCount() > 0 ) fBuildRoots[ fBuildRoots.GetCount() - 1 ]->AddChild( element ); return plbmod->AddElement( element ); @@ -790,7 +790,7 @@ Int16 pyGUIControlListBox::AddImageInBox( pyImage& image, UInt32 x, UInt32 y, return -1; } -Int16 pyGUIControlListBox::AddImageAndSwatchesInBox( pyImage& image, UInt32 x, UInt32 y, UInt32 width, UInt32 height, hsBool respectAlpha, +int16_t pyGUIControlListBox::AddImageAndSwatchesInBox( pyImage& image, uint32_t x, uint32_t y, uint32_t width, uint32_t height, hsBool respectAlpha, pyColor &primary, pyColor &secondary ) { if ( fGCkey ) @@ -799,7 +799,7 @@ Int16 pyGUIControlListBox::AddImageAndSwatchesInBox( pyImage& image, UInt32 x, pfGUIListBoxMod* plbmod = pfGUIListBoxMod::ConvertNoRef(fGCkey->ObjectIsLoaded()); if ( plbmod ) { - pfListPictureInBoxWithSwatches *element = TRACKED_NEW pfListPictureInBoxWithSwatches( image.GetKey(),x,y, + pfListPictureInBoxWithSwatches *element = new pfListPictureInBoxWithSwatches( image.GetKey(),x,y, width,height,respectAlpha, primary.getColor(), secondary.getColor() ); if( fBuildRoots.GetCount() > 0 ) @@ -810,14 +810,14 @@ Int16 pyGUIControlListBox::AddImageAndSwatchesInBox( pyImage& image, UInt32 x, return -1; } -void pyGUIControlListBox::SetSwatchSize( UInt32 size ) +void pyGUIControlListBox::SetSwatchSize( uint32_t size ) { - pfListPictureInBoxWithSwatches::fSwatchSize = (UInt16)size; + pfListPictureInBoxWithSwatches::fSwatchSize = (uint16_t)size; } -void pyGUIControlListBox::SetSwatchEdgeOffset( UInt32 set ) +void pyGUIControlListBox::SetSwatchEdgeOffset( uint32_t set ) { - pfListPictureInBoxWithSwatches::fSwatchOffset = (UInt16)set; + pfListPictureInBoxWithSwatches::fSwatchOffset = (uint16_t)set; } @@ -846,7 +846,7 @@ void pyGUIControlListBox::ScrollToEnd( void ) } -void pyGUIControlListBox::SetScrollPos( Int32 pos ) +void pyGUIControlListBox::SetScrollPos( int32_t pos ) { if ( fGCkey ) { @@ -858,7 +858,7 @@ void pyGUIControlListBox::SetScrollPos( Int32 pos ) } -Int32 pyGUIControlListBox::GetScrollPos( void ) +int32_t pyGUIControlListBox::GetScrollPos( void ) { if ( fGCkey ) { @@ -871,7 +871,7 @@ Int32 pyGUIControlListBox::GetScrollPos( void ) } -Int32 pyGUIControlListBox::GetScrollRange( void ) +int32_t pyGUIControlListBox::GetScrollRange( void ) { if ( fGCkey ) { @@ -944,7 +944,7 @@ void pyGUIControlListBox::AddBranchW( std::wstring name, hsBool initiallyOpen pfGUIListBoxMod* plbmod = pfGUIListBoxMod::ConvertNoRef(fGCkey->ObjectIsLoaded()); if ( plbmod ) { - pfGUIListTreeRoot *root = TRACKED_NEW pfGUIListTreeRoot( name.c_str() ); + pfGUIListTreeRoot *root = new pfGUIListTreeRoot( name.c_str() ); root->ShowChildren( initiallyOpen ); if( fBuildRoots.GetCount() > 0 ) @@ -970,7 +970,7 @@ void pyGUIControlListBox::CloseBranch( void ) } } -void pyGUIControlListBox::RemoveSelection( Int32 item ) +void pyGUIControlListBox::RemoveSelection( int32_t item ) { if ( fGCkey ) { @@ -981,7 +981,7 @@ void pyGUIControlListBox::RemoveSelection( Int32 item ) } } -void pyGUIControlListBox::AddSelection( Int32 item ) +void pyGUIControlListBox::AddSelection( int32_t item ) { if ( fGCkey ) { @@ -1004,7 +1004,7 @@ PyObject* pyGUIControlListBox::GetSelectionList() if ( plbmod ) { int numItems = plbmod->GetNumElements(); - UInt16 i; + uint16_t i; for ( i=0; iGetElement(i); @@ -1032,7 +1032,7 @@ PyObject* pyGUIControlListBox::GetBranchList() if ( plbmod ) { int numItems = plbmod->GetNumElements(); - UInt16 i; + uint16_t i; for ( i=0; iGetElement(i); @@ -1041,7 +1041,7 @@ PyObject* pyGUIControlListBox::GetBranchList() if ( element->GetType() == pfGUIListElement::kTreeRoot ) { pfGUIListTreeRoot* elroot = (pfGUIListTreeRoot*)element; - UInt16 showing = elroot->IsShowingChildren(); + uint16_t showing = elroot->IsShowingChildren(); PyObject* element = PyTuple_New(2); PyTuple_SetItem(element, 0, PyInt_FromLong(i)); PyTuple_SetItem(element, 1, PyInt_FromLong(showing)); diff --git a/Sources/Plasma/FeatureLib/pfPython/pyGUIControlListBox.h b/Sources/Plasma/FeatureLib/pfPython/pyGUIControlListBox.h index 5f9c74d3..8b8f8d97 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyGUIControlListBox.h +++ b/Sources/Plasma/FeatureLib/pfPython/pyGUIControlListBox.h @@ -89,40 +89,40 @@ public: // ...this allows the listbox to be used without being selectable virtual void Clickable( void ); virtual void Unclickable( void ); - virtual Int32 GetSelection( void ); - virtual void SetSelection( Int32 item ); + virtual int32_t GetSelection( void ); + virtual void SetSelection( int32_t item ); virtual void Refresh( void ); - virtual void SetElement( UInt16 idx, const char* text ); - virtual void SetElementW( UInt16 idx, std::wstring text ); - virtual void RemoveElement( UInt16 index ); + virtual void SetElement( uint16_t idx, const char* text ); + virtual void SetElementW( uint16_t idx, std::wstring text ); + virtual void RemoveElement( uint16_t index ); virtual void ClearAllElements( void ); - virtual UInt16 GetNumElements( void ); - virtual std::string GetElement( UInt16 idx ); - virtual std::wstring GetElementW( UInt16 idx ); - virtual Int16 AddString( const char *string ); - virtual Int16 AddStringW( std::wstring string ); - virtual Int16 AddImage( pyImage& image, hsBool respectAlpha ); - virtual Int16 AddImageInBox( pyImage& image, UInt32 x, UInt32 y, UInt32 width, UInt32 height, hsBool respectAlpha ); - virtual Int16 AddImageAndSwatchesInBox( pyImage& image, UInt32 x, UInt32 y, UInt32 width, UInt32 height, hsBool respectAlpha, + virtual uint16_t GetNumElements( void ); + virtual std::string GetElement( uint16_t idx ); + virtual std::wstring GetElementW( uint16_t idx ); + virtual int16_t AddString( const char *string ); + virtual int16_t AddStringW( std::wstring string ); + virtual int16_t AddImage( pyImage& image, hsBool respectAlpha ); + virtual int16_t AddImageInBox( pyImage& image, uint32_t x, uint32_t y, uint32_t width, uint32_t height, hsBool respectAlpha ); + virtual int16_t AddImageAndSwatchesInBox( pyImage& image, uint32_t x, uint32_t y, uint32_t width, uint32_t height, hsBool respectAlpha, pyColor &primary, pyColor &secondary ); - virtual void SetSwatchSize( UInt32 size ); - virtual void SetSwatchEdgeOffset( UInt32 size ); - virtual void SetStringJustify( UInt16 idx, UInt32 justify); - virtual Int16 FindString( const char *toCompareTo ); - virtual Int16 FindStringW( std::wstring toCompareTo ); - virtual Int16 AddTextWColor( const char *str, pyColor& textcolor, UInt32 inheritalpha); - virtual Int16 AddTextWColorW( std::wstring str, pyColor& textcolor, UInt32 inheritalpha); - virtual Int16 AddTextWColorWSize( const char *str, pyColor& textcolor, UInt32 inheritalpha, Int32 fontsize); - virtual Int16 AddTextWColorWSizeW( std::wstring str, pyColor& textcolor, UInt32 inheritalpha, Int32 fontsize); - virtual void Add2TextWColor( const char *str1, pyColor& textcolor1,const char *str2, pyColor& textcolor2, UInt32 inheritalpha); - virtual void Add2TextWColorW( std::wstring str1, pyColor& textcolor1, std::wstring str2, pyColor& textcolor2, UInt32 inheritalpha); - virtual Int16 AddStringInBox( const char *string, UInt32 min_width, UInt32 min_height ); - virtual Int16 AddStringInBoxW( std::wstring string, UInt32 min_width, UInt32 min_height ); + virtual void SetSwatchSize( uint32_t size ); + virtual void SetSwatchEdgeOffset( uint32_t size ); + virtual void SetStringJustify( uint16_t idx, uint32_t justify); + virtual int16_t FindString( const char *toCompareTo ); + virtual int16_t FindStringW( std::wstring toCompareTo ); + virtual int16_t AddTextWColor( const char *str, pyColor& textcolor, uint32_t inheritalpha); + virtual int16_t AddTextWColorW( std::wstring str, pyColor& textcolor, uint32_t inheritalpha); + virtual int16_t AddTextWColorWSize( const char *str, pyColor& textcolor, uint32_t inheritalpha, int32_t fontsize); + virtual int16_t AddTextWColorWSizeW( std::wstring str, pyColor& textcolor, uint32_t inheritalpha, int32_t fontsize); + virtual void Add2TextWColor( const char *str1, pyColor& textcolor1,const char *str2, pyColor& textcolor2, uint32_t inheritalpha); + virtual void Add2TextWColorW( std::wstring str1, pyColor& textcolor1, std::wstring str2, pyColor& textcolor2, uint32_t inheritalpha); + virtual int16_t AddStringInBox( const char *string, uint32_t min_width, uint32_t min_height ); + virtual int16_t AddStringInBoxW( std::wstring string, uint32_t min_width, uint32_t min_height ); virtual void ScrollToBegin( void ); virtual void ScrollToEnd( void ); - virtual void SetScrollPos( Int32 pos ); - virtual Int32 GetScrollPos( void ); - virtual Int32 GetScrollRange( void ); + virtual void SetScrollPos( int32_t pos ); + virtual int32_t GetScrollPos( void ); + virtual int32_t GetScrollRange( void ); virtual void LockList( void ); virtual void UnlockList( void ); @@ -133,8 +133,8 @@ public: void AddBranchW( std::wstring name, hsBool initiallyOpen ); void CloseBranch( void ); - void RemoveSelection( Int32 item ); - void AddSelection( Int32 item ); + void RemoveSelection( int32_t item ); + void AddSelection( int32_t item ); PyObject* GetSelectionList(); PyObject* GetBranchList(); diff --git a/Sources/Plasma/FeatureLib/pfPython/pyGUIControlListBoxGlue.cpp b/Sources/Plasma/FeatureLib/pfPython/pyGUIControlListBoxGlue.cpp index cf8de4c1..cdafecd6 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyGUIControlListBoxGlue.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/pyGUIControlListBoxGlue.cpp @@ -381,7 +381,7 @@ PYTHON_METHOD_DEFINITION(ptGUIControlListBox, addBranchW, args) if (PyUnicode_Check(textObj)) { int strLen = PyUnicode_GetSize(textObj); - wchar_t* name = TRACKED_NEW wchar_t[strLen + 1]; + wchar_t* name = new wchar_t[strLen + 1]; PyUnicode_AsWideChar((PyUnicodeObject*)textObj, name, strLen); name[strLen] = L'\0'; self->fThis->AddBranchW(name, initiallyOpen != 0); diff --git a/Sources/Plasma/FeatureLib/pfPython/pyGUIControlMultiLineEdit.cpp b/Sources/Plasma/FeatureLib/pfPython/pyGUIControlMultiLineEdit.cpp index f322c963..561fa415 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyGUIControlMultiLineEdit.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/pyGUIControlMultiLineEdit.cpp @@ -67,7 +67,7 @@ hsBool pyGUIControlMultiLineEdit::IsGUIControlMultiLineEdit(pyKey& gckey) } -void pyGUIControlMultiLineEdit::SetScrollPosition( Int32 topLine ) +void pyGUIControlMultiLineEdit::SetScrollPosition( int32_t topLine ) { if ( fGCkey ) { @@ -80,7 +80,7 @@ void pyGUIControlMultiLineEdit::SetScrollPosition( Int32 topLine ) } } -void pyGUIControlMultiLineEdit::MoveCursor( Int32 dir) +void pyGUIControlMultiLineEdit::MoveCursor( int32_t dir) { if ( fGCkey ) { @@ -181,13 +181,13 @@ void pyGUIControlMultiLineEdit::SetEncodedBuffer( PyObject* buffer_object ) if ( pbmod ) { // something to do here... later - UInt8* daBuffer = nil; + uint8_t* daBuffer = nil; int length; PyObject_AsReadBuffer( buffer_object, (const void**)&daBuffer, &length); if ( daBuffer != nil ) { // don't alter the user's buffer... but into a copy of our own - UInt8* altBuffer = TRACKED_NEW UInt8[length]; + uint8_t* altBuffer = new uint8_t[length]; // =====> temp>> change 0xFEs back into '\0's int i; for ( i=0 ; i temp>> change 0xFFFEs back into '\0's int i; for ( i=0 ; iObjectIsLoaded()); if ( pbmod ) { - UInt32 length; - UInt8* daBuffer = pbmod->GetCodedBuffer( length ); + uint32_t length; + uint8_t* daBuffer = pbmod->GetCodedBuffer( length ); if ( daBuffer ) { - UInt8* altBuffer = TRACKED_NEW UInt8[length+1]; + uint8_t* altBuffer = new uint8_t[length+1]; // =====> temp>> to get rid of '\0's (change into 0xFEs) int i; for ( i=0 ; iObjectIsLoaded()); if ( pbmod ) { - UInt32 length; - UInt16* daBuffer = pbmod->GetCodedBufferW( length ); + uint32_t length; + uint16_t* daBuffer = pbmod->GetCodedBufferW( length ); if ( daBuffer ) { - UInt16* altBuffer = TRACKED_NEW UInt16[length+1]; + uint16_t* altBuffer = new uint16_t[length+1]; // =====> temp>> to get rid of '\0's (change into 0xFFFEs) int i; for ( i=0 ; iObjectIsLoaded()); if ( pbmod ) - pbmod->SetFontSize((UInt8)fontsize); + pbmod->SetFontSize((uint8_t)fontsize); } } diff --git a/Sources/Plasma/FeatureLib/pfPython/pyGUIControlMultiLineEdit.h b/Sources/Plasma/FeatureLib/pfPython/pyGUIControlMultiLineEdit.h index ff5a152c..1db5213f 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyGUIControlMultiLineEdit.h +++ b/Sources/Plasma/FeatureLib/pfPython/pyGUIControlMultiLineEdit.h @@ -79,8 +79,8 @@ public: virtual void Clickable( void ); virtual void Unclickable( void ); - virtual void SetScrollPosition( Int32 topLine ); - virtual void MoveCursor( Int32 dir ); + virtual void SetScrollPosition( int32_t topLine ); + virtual void MoveCursor( int32_t dir ); virtual void ClearBuffer( void ); virtual void SetText( const char *asciiText ); virtual void SetTextW( const wchar_t *asciiText ); @@ -90,17 +90,17 @@ public: virtual void SetEncodedBufferW( PyObject* buffer_object ); virtual const char* GetEncodedBuffer(); virtual const wchar_t* GetEncodedBufferW(); - virtual UInt32 GetBufferSize(); + virtual uint32_t GetBufferSize(); - virtual void SetBufferLimit(Int32 limit); - virtual Int32 GetBufferLimit(); + virtual void SetBufferLimit(int32_t limit); + virtual int32_t GetBufferLimit(); virtual void InsertChar( char c ); virtual void InsertCharW( wchar_t c ); virtual void InsertString( const char *string ); virtual void InsertStringW( const wchar_t *string ); virtual void InsertColor( pyColor& color ); - virtual void InsertStyle( UInt8 fontStyle ); + virtual void InsertStyle( uint8_t fontStyle ); virtual void DeleteChar( void ); virtual void Lock( void ); @@ -112,8 +112,8 @@ public: virtual void DeleteLinesFromTop( int lines ); - virtual UInt32 GetFontSize(); - virtual void SetFontSize( UInt32 fontsize ); + virtual uint32_t GetFontSize(); + virtual void SetFontSize( uint32_t fontsize ); }; #endif // _pyGUIControlMultiLineEdit_h_ diff --git a/Sources/Plasma/FeatureLib/pfPython/pyGUIControlMultiLineEditGlue.cpp b/Sources/Plasma/FeatureLib/pfPython/pyGUIControlMultiLineEditGlue.cpp index 05955062..deb8b542 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyGUIControlMultiLineEditGlue.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/pyGUIControlMultiLineEditGlue.cpp @@ -124,7 +124,7 @@ PYTHON_METHOD_DEFINITION(ptGUIControlMultiLineEdit, setStringW, args) if (PyUnicode_Check(textObj)) { int strLen = PyUnicode_GetSize(textObj); - wchar_t* temp = TRACKED_NEW wchar_t[strLen + 1]; + wchar_t* temp = new wchar_t[strLen + 1]; PyUnicode_AsWideChar((PyUnicodeObject*)textObj, temp, strLen); temp[strLen] = L'\0'; self->fThis->SetTextW(temp); @@ -230,7 +230,7 @@ PYTHON_METHOD_DEFINITION(ptGUIControlMultiLineEdit, insertCharW, args) PYTHON_RETURN_ERROR; } - wchar_t* temp = TRACKED_NEW wchar_t[strLen + 1]; + wchar_t* temp = new wchar_t[strLen + 1]; PyUnicode_AsWideChar((PyUnicodeObject*)textObj, temp, strLen); temp[strLen] = L'\0'; self->fThis->InsertCharW(temp[0]); @@ -279,7 +279,7 @@ PYTHON_METHOD_DEFINITION(ptGUIControlMultiLineEdit, insertStringW, args) if (PyUnicode_Check(textObj)) { int strLen = PyUnicode_GetSize(textObj); - wchar_t* temp = TRACKED_NEW wchar_t[strLen + 1]; + wchar_t* temp = new wchar_t[strLen + 1]; PyUnicode_AsWideChar((PyUnicodeObject*)textObj, temp, strLen); temp[strLen] = L'\0'; self->fThis->InsertStringW(temp); diff --git a/Sources/Plasma/FeatureLib/pfPython/pyGUIControlRadioGroup.cpp b/Sources/Plasma/FeatureLib/pfPython/pyGUIControlRadioGroup.cpp index 08511a25..7799c033 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyGUIControlRadioGroup.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/pyGUIControlRadioGroup.cpp @@ -65,7 +65,7 @@ hsBool pyGUIControlRadioGroup::IsGUIControlRadioGroup(pyKey& gckey) return false; } -Int32 pyGUIControlRadioGroup::GetValue( void ) +int32_t pyGUIControlRadioGroup::GetValue( void ) { if ( fGCkey ) { @@ -77,7 +77,7 @@ Int32 pyGUIControlRadioGroup::GetValue( void ) return -1; } -void pyGUIControlRadioGroup::SetValue( Int32 value ) +void pyGUIControlRadioGroup::SetValue( int32_t value ) { if ( fGCkey ) { diff --git a/Sources/Plasma/FeatureLib/pfPython/pyGUIControlRadioGroup.h b/Sources/Plasma/FeatureLib/pfPython/pyGUIControlRadioGroup.h index 48a903d9..a5a6c63f 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyGUIControlRadioGroup.h +++ b/Sources/Plasma/FeatureLib/pfPython/pyGUIControlRadioGroup.h @@ -74,8 +74,8 @@ public: static hsBool IsGUIControlRadioGroup(pyKey& gckey); - virtual Int32 GetValue( void ); - virtual void SetValue( Int32 value ); + virtual int32_t GetValue( void ); + virtual void SetValue( int32_t value ); }; diff --git a/Sources/Plasma/FeatureLib/pfPython/pyGUIControlTextBox.cpp b/Sources/Plasma/FeatureLib/pfPython/pyGUIControlTextBox.cpp index 653fbcf5..113cd096 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyGUIControlTextBox.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/pyGUIControlTextBox.cpp @@ -116,7 +116,7 @@ void pyGUIControlTextBox::SetTextW( std::wstring text ) } } -void pyGUIControlTextBox::SetFontSize( UInt8 size ) +void pyGUIControlTextBox::SetFontSize( uint8_t size ) { if ( fGCkey ) { @@ -178,7 +178,7 @@ void pyGUIControlTextBox::SetBackColor( pyColor& color ) } -void pyGUIControlTextBox::SetJustify( UInt8 justify ) +void pyGUIControlTextBox::SetJustify( uint8_t justify ) { if ( fGCkey ) { @@ -198,7 +198,7 @@ void pyGUIControlTextBox::SetJustify( UInt8 justify ) } } -UInt8 pyGUIControlTextBox::GetJustify() +uint8_t pyGUIControlTextBox::GetJustify() { if ( fGCkey ) { diff --git a/Sources/Plasma/FeatureLib/pfPython/pyGUIControlTextBox.h b/Sources/Plasma/FeatureLib/pfPython/pyGUIControlTextBox.h index b0a33a45..53436613 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyGUIControlTextBox.h +++ b/Sources/Plasma/FeatureLib/pfPython/pyGUIControlTextBox.h @@ -84,11 +84,11 @@ public: virtual void SetTextW( std::wstring text ); virtual std::string GetText(); virtual std::wstring GetTextW(); - virtual void SetFontSize( UInt8 size ); + virtual void SetFontSize( uint8_t size ); virtual void SetForeColor( pyColor& color ); virtual void SetBackColor( pyColor& color ); - virtual void SetJustify( UInt8 justify ); - virtual UInt8 GetJustify(); + virtual void SetJustify( uint8_t justify ); + virtual uint8_t GetJustify(); virtual PyObject* GetForeColor(); // returns pyColor }; diff --git a/Sources/Plasma/FeatureLib/pfPython/pyGUIControlTextBoxGlue.cpp b/Sources/Plasma/FeatureLib/pfPython/pyGUIControlTextBoxGlue.cpp index 9511ae16..bd5d49ff 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyGUIControlTextBoxGlue.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/pyGUIControlTextBoxGlue.cpp @@ -93,7 +93,7 @@ PYTHON_METHOD_DEFINITION(ptGUIControlTextBox, setStringW, args) if (PyUnicode_Check(textObj)) { int strLen = PyUnicode_GetSize(textObj); - wchar_t* temp = TRACKED_NEW wchar_t[strLen + 1]; + wchar_t* temp = new wchar_t[strLen + 1]; PyUnicode_AsWideChar((PyUnicodeObject*)textObj, temp, strLen); temp[strLen] = L'\0'; self->fThis->SetTextW(temp); diff --git a/Sources/Plasma/FeatureLib/pfPython/pyGUIControlValue.cpp b/Sources/Plasma/FeatureLib/pfPython/pyGUIControlValue.cpp index 6a9dd86d..8af06942 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyGUIControlValue.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/pyGUIControlValue.cpp @@ -69,7 +69,7 @@ hsBool pyGUIControlValue::IsGUIControlValue(pyKey& gckey) } -hsScalar pyGUIControlValue::GetValue() +float pyGUIControlValue::GetValue() { if ( fGCkey ) { @@ -81,7 +81,7 @@ hsScalar pyGUIControlValue::GetValue() return 0.0; } -void pyGUIControlValue::SetValue( hsScalar v ) +void pyGUIControlValue::SetValue( float v ) { if ( fGCkey ) { @@ -92,7 +92,7 @@ void pyGUIControlValue::SetValue( hsScalar v ) } } -hsScalar pyGUIControlValue::GetMin( void ) +float pyGUIControlValue::GetMin( void ) { if ( fGCkey ) { @@ -104,7 +104,7 @@ hsScalar pyGUIControlValue::GetMin( void ) return 0.0; } -hsScalar pyGUIControlValue::GetMax( void ) +float pyGUIControlValue::GetMax( void ) { if ( fGCkey ) { @@ -116,7 +116,7 @@ hsScalar pyGUIControlValue::GetMax( void ) return 0.0; } -hsScalar pyGUIControlValue::GetStep( void ) +float pyGUIControlValue::GetStep( void ) { if ( fGCkey ) { @@ -128,7 +128,7 @@ hsScalar pyGUIControlValue::GetStep( void ) return 0.0; } -void pyGUIControlValue::SetRange( hsScalar min, hsScalar max ) +void pyGUIControlValue::SetRange( float min, float max ) { if ( fGCkey ) { @@ -139,7 +139,7 @@ void pyGUIControlValue::SetRange( hsScalar min, hsScalar max ) } } -void pyGUIControlValue::SetStep( hsScalar step ) +void pyGUIControlValue::SetStep( float step ) { if ( fGCkey ) { diff --git a/Sources/Plasma/FeatureLib/pfPython/pyGUIControlValue.h b/Sources/Plasma/FeatureLib/pfPython/pyGUIControlValue.h index 3226d8b6..01290ec8 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyGUIControlValue.h +++ b/Sources/Plasma/FeatureLib/pfPython/pyGUIControlValue.h @@ -75,13 +75,13 @@ public: static hsBool IsGUIControlValue(pyKey& gckey); - virtual hsScalar GetValue(); - virtual void SetValue( hsScalar v ); - virtual hsScalar GetMin( void ); - virtual hsScalar GetMax( void ); - virtual hsScalar GetStep( void ); - virtual void SetRange( hsScalar min, hsScalar max ); - virtual void SetStep( hsScalar step ); + virtual float GetValue(); + virtual void SetValue( float v ); + virtual float GetMin( void ); + virtual float GetMax( void ); + virtual float GetStep( void ); + virtual void SetRange( float min, float max ); + virtual void SetStep( float step ); }; class pyGUIControlKnob : public pyGUIControlValue diff --git a/Sources/Plasma/FeatureLib/pfPython/pyGUIDialog.cpp b/Sources/Plasma/FeatureLib/pfPython/pyGUIDialog.cpp index cefe7b9e..71ecf7b6 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyGUIDialog.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/pyGUIDialog.cpp @@ -95,7 +95,7 @@ hsBool pyGUIDialog::IsGUIDialog(pyKey& gckey) } -UInt32 pyGUIDialog::WhatControlType(pyKey& gckey) +uint32_t pyGUIDialog::WhatControlType(pyKey& gckey) { // Do the pop-up menu test first, since it's derived from dialog if ( pyGUIPopUpMenu::IsGUIPopUpMenu(gckey) ) @@ -163,7 +163,7 @@ PyObject* pyGUIDialog::getObjPyKey() // interface functions -UInt32 pyGUIDialog::GetTagID() +uint32_t pyGUIDialog::GetTagID() { if ( fGCkey ) { @@ -208,7 +208,7 @@ const char* pyGUIDialog::GetName( void ) } -UInt32 pyGUIDialog::GetVersion(void) +uint32_t pyGUIDialog::GetVersion(void) { if ( fGCkey ) { @@ -220,7 +220,7 @@ UInt32 pyGUIDialog::GetVersion(void) } -UInt32 pyGUIDialog::GetNumControls( void ) +uint32_t pyGUIDialog::GetNumControls( void ) { if ( fGCkey ) { @@ -231,7 +231,7 @@ UInt32 pyGUIDialog::GetNumControls( void ) return 0; } -PyObject* pyGUIDialog::GetControl( UInt32 idx ) +PyObject* pyGUIDialog::GetControl( uint32_t idx ) { if ( fGCkey ) { @@ -298,7 +298,7 @@ void pyGUIDialog::Hide( void ) } } -PyObject* pyGUIDialog::GetControlFromTag( UInt32 tagID ) +PyObject* pyGUIDialog::GetControlFromTag( uint32_t tagID ) { if ( fGCkey ) { @@ -375,7 +375,7 @@ PyObject* pyGUIDialog::GetBackSelColor() PYTHON_RETURN_NONE; } -UInt32 pyGUIDialog::GetFontSize() +uint32_t pyGUIDialog::GetFontSize() { if ( fGCkey ) { @@ -392,7 +392,7 @@ UInt32 pyGUIDialog::GetFontSize() // set color scheme -void pyGUIDialog::SetForeColor( hsScalar r, hsScalar g, hsScalar b, hsScalar a ) +void pyGUIDialog::SetForeColor( float r, float g, float b, float a ) { if ( fGCkey ) { @@ -412,7 +412,7 @@ void pyGUIDialog::SetForeColor( hsScalar r, hsScalar g, hsScalar b, hsScalar a ) } } -void pyGUIDialog::SetSelColor( hsScalar r, hsScalar g, hsScalar b, hsScalar a ) +void pyGUIDialog::SetSelColor( float r, float g, float b, float a ) { if ( fGCkey ) { @@ -432,7 +432,7 @@ void pyGUIDialog::SetSelColor( hsScalar r, hsScalar g, hsScalar b, hsScalar a ) } } -void pyGUIDialog::SetBackColor( hsScalar r, hsScalar g, hsScalar b, hsScalar a ) +void pyGUIDialog::SetBackColor( float r, float g, float b, float a ) { if ( fGCkey ) { @@ -452,7 +452,7 @@ void pyGUIDialog::SetBackColor( hsScalar r, hsScalar g, hsScalar b, hsScalar a ) } } -void pyGUIDialog::SetBackSelColor( hsScalar r, hsScalar g, hsScalar b, hsScalar a ) +void pyGUIDialog::SetBackSelColor( float r, float g, float b, float a ) { if ( fGCkey ) { @@ -473,7 +473,7 @@ void pyGUIDialog::SetBackSelColor( hsScalar r, hsScalar g, hsScalar b, hsScalar } -void pyGUIDialog::SetFontSize(UInt32 fontsize) +void pyGUIDialog::SetFontSize(uint32_t fontsize) { if ( fGCkey ) { @@ -481,7 +481,7 @@ void pyGUIDialog::SetFontSize(UInt32 fontsize) if ( pdmod ) { pfGUIColorScheme* color = pdmod->GetColorScheme(); - color->fFontSize = (UInt8)fontsize; + color->fFontSize = (uint8_t)fontsize; } } } diff --git a/Sources/Plasma/FeatureLib/pfPython/pyGUIDialog.h b/Sources/Plasma/FeatureLib/pfPython/pyGUIDialog.h index f9891892..5e2689b9 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyGUIDialog.h +++ b/Sources/Plasma/FeatureLib/pfPython/pyGUIDialog.h @@ -103,7 +103,7 @@ public: kPopUpMenu=14, kClickMap=15, }; - static UInt32 WhatControlType(pyKey& gckey); + static uint32_t WhatControlType(pyKey& gckey); static void GUICursorOff(); static void GUICursorOn(); static void GUICursorDimmed(); @@ -117,36 +117,36 @@ public: virtual PyObject* getObjPyKey(); // returns pyKey // interface functions - virtual UInt32 GetTagID(); + virtual uint32_t GetTagID(); virtual void SetEnabled( hsBool e ); virtual void Enable() { SetEnabled(true); } virtual void Disable() { SetEnabled(false); } virtual hsBool IsEnabled( void ); virtual const char *GetName( void ); - virtual UInt32 GetVersion(void); + virtual uint32_t GetVersion(void); - virtual UInt32 GetNumControls( void ); - virtual PyObject* GetControl( UInt32 idx ); // returns pyKey + virtual uint32_t GetNumControls( void ); + virtual PyObject* GetControl( uint32_t idx ); // returns pyKey virtual void SetFocus( pyKey& gcKey ); virtual void NoFocus( ); virtual void Show( void ); virtual void ShowNoReset( void ); virtual void Hide( void ); - virtual PyObject* GetControlFromTag( UInt32 tagID ); // returns pyKey + virtual PyObject* GetControlFromTag( uint32_t tagID ); // returns pyKey // get color schemes virtual PyObject* GetForeColor(); // returns pyColor virtual PyObject* GetSelColor(); // returns pyColor virtual PyObject* GetBackColor(); // returns pyColor virtual PyObject* GetBackSelColor(); // returns pyColor - virtual UInt32 GetFontSize(); + virtual uint32_t GetFontSize(); // set color scheme - virtual void SetForeColor( hsScalar r, hsScalar g, hsScalar b, hsScalar a ); - virtual void SetSelColor( hsScalar r, hsScalar g, hsScalar b, hsScalar a ); - virtual void SetBackColor( hsScalar r, hsScalar g, hsScalar b, hsScalar a ); - virtual void SetBackSelColor( hsScalar r, hsScalar g, hsScalar b, hsScalar a ); - virtual void SetFontSize(UInt32 fontsize); + virtual void SetForeColor( float r, float g, float b, float a ); + virtual void SetSelColor( float r, float g, float b, float a ); + virtual void SetBackColor( float r, float g, float b, float a ); + virtual void SetBackSelColor( float r, float g, float b, float a ); + virtual void SetFontSize(uint32_t fontsize); virtual void UpdateAllBounds( void ); virtual void RefreshAllControls( void ); diff --git a/Sources/Plasma/FeatureLib/pfPython/pyGUIPopUpMenu.cpp b/Sources/Plasma/FeatureLib/pfPython/pyGUIPopUpMenu.cpp index d34e2f2e..93a186a3 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyGUIPopUpMenu.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/pyGUIPopUpMenu.cpp @@ -89,7 +89,7 @@ pyGUIPopUpMenu::pyGUIPopUpMenu() fBuiltMenu = nil; } -pyGUIPopUpMenu::pyGUIPopUpMenu( const char *name, hsScalar screenOriginX, hsScalar screenOriginY, const plLocation &destLoc/* = plLocation::kGlobalFixedLoc */) +pyGUIPopUpMenu::pyGUIPopUpMenu( const char *name, float screenOriginX, float screenOriginY, const plLocation &destLoc/* = plLocation::kGlobalFixedLoc */) { fBuiltMenu = pfGUIPopUpMenu::Build( name, nil, screenOriginX, screenOriginY, destLoc ); if( fBuiltMenu != nil ) @@ -101,7 +101,7 @@ pyGUIPopUpMenu::pyGUIPopUpMenu( const char *name, hsScalar screenOriginX, hsScal fGCkey = nil; } -pyGUIPopUpMenu::pyGUIPopUpMenu( const char *name, pyGUIPopUpMenu &parent, hsScalar screenOriginX, hsScalar screenOriginY ) +pyGUIPopUpMenu::pyGUIPopUpMenu( const char *name, pyGUIPopUpMenu &parent, float screenOriginX, float screenOriginY ) { pfGUIPopUpMenu *parentMenu = pfGUIPopUpMenu::ConvertNoRef( parent.fGCkey->ObjectIsLoaded() ); @@ -140,7 +140,7 @@ void pyGUIPopUpMenu::setup(plKey objkey) fGCkey = objkey; } -void pyGUIPopUpMenu::setup(const char *name, hsScalar screenOriginX, hsScalar screenOriginY, const plLocation &destLoc /* = plLocation::kGlobalFixedLoc */) +void pyGUIPopUpMenu::setup(const char *name, float screenOriginX, float screenOriginY, const plLocation &destLoc /* = plLocation::kGlobalFixedLoc */) { // kill any previous menu if( fBuiltMenu != nil ) @@ -160,7 +160,7 @@ void pyGUIPopUpMenu::setup(const char *name, hsScalar screenOriginX, hsScalar sc fGCkey = nil; } -void pyGUIPopUpMenu::setup(const char *name, pyGUIPopUpMenu &parent, hsScalar screenOriginX, hsScalar screenOriginY) +void pyGUIPopUpMenu::setup(const char *name, pyGUIPopUpMenu &parent, float screenOriginX, float screenOriginY) { // kill any previous menu if( fBuiltMenu != nil ) @@ -220,7 +220,7 @@ PyObject* pyGUIPopUpMenu::getObjPyKey() // interface functions -UInt32 pyGUIPopUpMenu::GetTagID() +uint32_t pyGUIPopUpMenu::GetTagID() { kGetMenuPtr( 0 ); return menu->GetTagID(); @@ -246,7 +246,7 @@ const char* pyGUIPopUpMenu::GetName( void ) } -UInt32 pyGUIPopUpMenu::GetVersion(void) +uint32_t pyGUIPopUpMenu::GetVersion(void) { kGetMenuPtr( 0 ); return menu->GetVersion(); @@ -299,7 +299,7 @@ PyObject* pyGUIPopUpMenu::GetBackSelColor() } // set color scheme -void pyGUIPopUpMenu::SetForeColor( hsScalar r, hsScalar g, hsScalar b, hsScalar a ) +void pyGUIPopUpMenu::SetForeColor( float r, float g, float b, float a ) { kGetMenuPtr( ; ); @@ -314,7 +314,7 @@ void pyGUIPopUpMenu::SetForeColor( hsScalar r, hsScalar g, hsScalar b, hsScalar color->fForeColor.a = a; } -void pyGUIPopUpMenu::SetSelColor( hsScalar r, hsScalar g, hsScalar b, hsScalar a ) +void pyGUIPopUpMenu::SetSelColor( float r, float g, float b, float a ) { kGetMenuPtr( ; ); @@ -329,7 +329,7 @@ void pyGUIPopUpMenu::SetSelColor( hsScalar r, hsScalar g, hsScalar b, hsScalar a color->fSelForeColor.a = a; } -void pyGUIPopUpMenu::SetBackColor( hsScalar r, hsScalar g, hsScalar b, hsScalar a ) +void pyGUIPopUpMenu::SetBackColor( float r, float g, float b, float a ) { kGetMenuPtr( ; ); @@ -344,7 +344,7 @@ void pyGUIPopUpMenu::SetBackColor( hsScalar r, hsScalar g, hsScalar b, hsScalar color->fBackColor.a = a; } -void pyGUIPopUpMenu::SetBackSelColor( hsScalar r, hsScalar g, hsScalar b, hsScalar a ) +void pyGUIPopUpMenu::SetBackSelColor( float r, float g, float b, float a ) { kGetMenuPtr( ; ); @@ -369,7 +369,7 @@ void pyGUIPopUpMenu::AddConsoleCmdItem( const char *name, const char *console void pyGUIPopUpMenu::AddConsoleCmdItemW( std::wstring name, const char *consoleCmd ) { kGetMenuPtr( ; ); - menu->AddItem( name.c_str(), TRACKED_NEW pfGUIConsoleCmdProc( consoleCmd ), nil ); + menu->AddItem( name.c_str(), new pfGUIConsoleCmdProc( consoleCmd ), nil ); } void pyGUIPopUpMenu::AddNotifyItem( const char *name ) diff --git a/Sources/Plasma/FeatureLib/pfPython/pyGUIPopUpMenu.h b/Sources/Plasma/FeatureLib/pfPython/pyGUIPopUpMenu.h index c791ec38..4f453ba5 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyGUIPopUpMenu.h +++ b/Sources/Plasma/FeatureLib/pfPython/pyGUIPopUpMenu.h @@ -70,8 +70,8 @@ protected: pyGUIPopUpMenu(plKey objkey); pyGUIPopUpMenu(); // For creating new menus on the fly - pyGUIPopUpMenu( const char *name, hsScalar screenOriginX, hsScalar screenOriginY, const plLocation &destLoc = plLocation::kGlobalFixedLoc ); - pyGUIPopUpMenu( const char *name, pyGUIPopUpMenu &parent, hsScalar screenOriginX, hsScalar screenOriginY ); + pyGUIPopUpMenu( const char *name, float screenOriginX, float screenOriginY, const plLocation &destLoc = plLocation::kGlobalFixedLoc ); + pyGUIPopUpMenu( const char *name, pyGUIPopUpMenu &parent, float screenOriginX, float screenOriginY ); public: virtual ~pyGUIPopUpMenu(); @@ -81,8 +81,8 @@ public: PYTHON_CLASS_NEW_DEFINITION; static PyObject *New(pyKey& gckey); static PyObject *New(plKey objkey); - static PyObject *New(const char *name, hsScalar screenOriginX, hsScalar screenOriginY, const plLocation &destLoc = plLocation::kGlobalFixedLoc); - static PyObject *New(const char *name, pyGUIPopUpMenu &parent, hsScalar screenOriginX, hsScalar screenOriginY); + static PyObject *New(const char *name, float screenOriginX, float screenOriginY, const plLocation &destLoc = plLocation::kGlobalFixedLoc); + static PyObject *New(const char *name, pyGUIPopUpMenu &parent, float screenOriginX, float screenOriginY); PYTHON_CLASS_CHECK_DEFINITION; // returns true if the PyObject is a pyGUIPopUpMenu object PYTHON_CLASS_CONVERT_FROM_DEFINITION(pyGUIPopUpMenu); // converts a PyObject to a pyGUIPopUpMenu (throws error if not correct type) @@ -90,8 +90,8 @@ public: // these three are for the python glue only, do NOT call void setup(plKey objkey); - void setup(const char *name, hsScalar screenOriginX, hsScalar screenOriginY, const plLocation &destLoc = plLocation::kGlobalFixedLoc); - void setup(const char *name, pyGUIPopUpMenu &parent, hsScalar screenOriginX, hsScalar screenOriginY); + void setup(const char *name, float screenOriginX, float screenOriginY, const plLocation &destLoc = plLocation::kGlobalFixedLoc); + void setup(const char *name, pyGUIPopUpMenu &parent, float screenOriginX, float screenOriginY); static hsBool IsGUIPopUpMenu(pyKey& gckey); @@ -104,14 +104,14 @@ public: virtual PyObject* getObjPyKey(); // returns pyKey // interface functions - virtual UInt32 GetTagID(); + virtual uint32_t GetTagID(); virtual void SetEnabled( hsBool e ); virtual void Enable() { SetEnabled(true); } virtual void Disable() { SetEnabled(false); } virtual hsBool IsEnabled( void ); virtual const char *GetName( void ); - virtual UInt32 GetVersion(void); + virtual uint32_t GetVersion(void); virtual void Show( void ); virtual void Hide( void ); @@ -122,10 +122,10 @@ public: virtual PyObject* GetBackColor(); // returns pyColor virtual PyObject* GetBackSelColor(); // returns pyColor // set color scheme - virtual void SetForeColor( hsScalar r, hsScalar g, hsScalar b, hsScalar a ); - virtual void SetSelColor( hsScalar r, hsScalar g, hsScalar b, hsScalar a ); - virtual void SetBackColor( hsScalar r, hsScalar g, hsScalar b, hsScalar a ); - virtual void SetBackSelColor( hsScalar r, hsScalar g, hsScalar b, hsScalar a ); + virtual void SetForeColor( float r, float g, float b, float a ); + virtual void SetSelColor( float r, float g, float b, float a ); + virtual void SetBackColor( float r, float g, float b, float a ); + virtual void SetBackSelColor( float r, float g, float b, float a ); // Menu item functions virtual void AddConsoleCmdItem( const char *name, const char *consoleCmd ); diff --git a/Sources/Plasma/FeatureLib/pfPython/pyGUIPopUpMenuGlue.cpp b/Sources/Plasma/FeatureLib/pfPython/pyGUIPopUpMenuGlue.cpp index 801936d6..fac7ba72 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyGUIPopUpMenuGlue.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/pyGUIPopUpMenuGlue.cpp @@ -417,14 +417,14 @@ PyObject *pyGUIPopUpMenu::New(plKey objkey) return (PyObject*)newObj; } -PyObject *pyGUIPopUpMenu::New(const char *name, hsScalar screenOriginX, hsScalar screenOriginY, const plLocation &destLoc /* = plLocation::kGlobalFixedLoc */) +PyObject *pyGUIPopUpMenu::New(const char *name, float screenOriginX, float screenOriginY, const plLocation &destLoc /* = plLocation::kGlobalFixedLoc */) { ptGUIPopUpMenu *newObj = (ptGUIPopUpMenu*)ptGUIPopUpMenu_type.tp_new(&ptGUIPopUpMenu_type, NULL, NULL); newObj->fThis->setup(name, screenOriginX, screenOriginY, destLoc); return (PyObject*)newObj; } -PyObject *pyGUIPopUpMenu::New(const char *name, pyGUIPopUpMenu &parent, hsScalar screenOriginX, hsScalar screenOriginY) +PyObject *pyGUIPopUpMenu::New(const char *name, pyGUIPopUpMenu &parent, float screenOriginX, float screenOriginY) { ptGUIPopUpMenu *newObj = (ptGUIPopUpMenu*)ptGUIPopUpMenu_type.tp_new(&ptGUIPopUpMenu_type, NULL, NULL); newObj->fThis->setup(name, parent, screenOriginX, screenOriginY); diff --git a/Sources/Plasma/FeatureLib/pfPython/pyGameScore.cpp b/Sources/Plasma/FeatureLib/pfPython/pyGameScore.cpp index 66d636c5..c454a589 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyGameScore.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/pyGameScore.cpp @@ -66,7 +66,7 @@ int pyGameScore::GetScoreID() return 0; } -UInt32 pyGameScore::GetCreatedTime() +uint32_t pyGameScore::GetCreatedTime() { if (fScore) return fScore->createdTime; diff --git a/Sources/Plasma/FeatureLib/pfPython/pyGameScore.h b/Sources/Plasma/FeatureLib/pfPython/pyGameScore.h index 4a7e4117..b0112dfc 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyGameScore.h +++ b/Sources/Plasma/FeatureLib/pfPython/pyGameScore.h @@ -49,7 +49,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // PURPOSE: a wrapper class to provide access to a game score // -#include "hsTypes.h" +#include "HeadSpin.h" #include "hsStlUtils.h" #include @@ -76,7 +76,7 @@ public: static void AddPlasmaClasses(PyObject *m); int GetScoreID(); - UInt32 GetCreatedTime(); + uint32_t GetCreatedTime(); int GetOwnerID(); int GetGameType(); int GetValue(); diff --git a/Sources/Plasma/FeatureLib/pfPython/pyGeometry3.h b/Sources/Plasma/FeatureLib/pfPython/pyGeometry3.h index 7db09072..92df489b 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyGeometry3.h +++ b/Sources/Plasma/FeatureLib/pfPython/pyGeometry3.h @@ -57,7 +57,7 @@ class pyPoint3 { protected: pyPoint3() : fPoint(0,0,0) {} - pyPoint3(hsScalar x, hsScalar y, hsScalar z) : fPoint(x,y,z) {} + pyPoint3(float x, float y, float z) : fPoint(x,y,z) {} pyPoint3(hsPoint3 pt) : fPoint(pt.fX,pt.fY,pt.fZ) {} public: @@ -73,20 +73,20 @@ public: hsPoint3 fPoint; // python get attributes helpers - hsScalar getX() { return fPoint.fX; } - hsScalar getY() { return fPoint.fY; } - hsScalar getZ() { return fPoint.fZ; } + float getX() { return fPoint.fX; } + float getY() { return fPoint.fY; } + float getZ() { return fPoint.fZ; } // python set attributes helpers - void setX(hsScalar x) { fPoint.fX = x; } - void setY(hsScalar y) { fPoint.fY = y; } - void setZ(hsScalar z) { fPoint.fZ = z; } + void setX(float x) { fPoint.fX = x; } + void setY(float y) { fPoint.fY = y; } + void setZ(float z) { fPoint.fZ = z; } // methods to manipulate point3's void Zero() { fPoint.fX=0; fPoint.fY=0; fPoint.fZ=0; } PyObject* Copy() { return pyPoint3::New(fPoint); } - hsScalar Distance(pyPoint3 other) { return hsVector3(&fPoint,&other.fPoint).Magnitude(); } - hsScalar DistanceSquared(pyPoint3 other) { return hsVector3(&fPoint,&other.fPoint).MagnitudeSquared(); } + float Distance(pyPoint3 other) { return hsVector3(&fPoint,&other.fPoint).Magnitude(); } + float DistanceSquared(pyPoint3 other) { return hsVector3(&fPoint,&other.fPoint).MagnitudeSquared(); } }; @@ -94,7 +94,7 @@ class pyVector3 { protected: pyVector3() : fVector(0,0,0) {} - pyVector3(hsScalar x, hsScalar y, hsScalar z) : fVector(x,y,z) {} + pyVector3(float x, float y, float z) : fVector(x,y,z) {} pyVector3(hsVector3 v) : fVector(v.fX,v.fY,v.fZ) {} public: @@ -110,14 +110,14 @@ public: hsVector3 fVector; // python get attributes helpers - hsScalar getX() { return fVector.fX; } - hsScalar getY() { return fVector.fY; } - hsScalar getZ() { return fVector.fZ; } + float getX() { return fVector.fX; } + float getY() { return fVector.fY; } + float getZ() { return fVector.fZ; } // python set attributes helpers - void setX(hsScalar x) { fVector.fX = x; } - void setY(hsScalar y) { fVector.fY = y; } - void setZ(hsScalar z) { fVector.fZ = z; } + void setX(float x) { fVector.fX = x; } + void setY(float y) { fVector.fY = y; } + void setZ(float z) { fVector.fZ = z; } // operator methods PyObject* operator+(const pyVector3& b) const { return pyVector3::New(fVector + b.fVector); } @@ -125,12 +125,12 @@ public: // methods to manipulate vectors void Normalize() { fVector.Normalize(); } - hsScalar Dot(pyVector3 other) { return fVector*other.fVector;} + float Dot(pyVector3 other) { return fVector*other.fVector;} PyObject* Cross(pyVector3 other) {return pyVector3::New(fVector%other.fVector); } - hsScalar Magnitude() { return fVector.Magnitude(); } - hsScalar MagnitudeSquared() { return fVector.MagnitudeSquared(); } + float Magnitude() { return fVector.Magnitude(); } + float MagnitudeSquared() { return fVector.MagnitudeSquared(); } void Zero() { fVector.fX=0; fVector.fY=0; fVector.fZ=0; } - PyObject* Scale(hsScalar scale) { return pyVector3::New(fVector * scale); } + PyObject* Scale(float scale) { return pyVector3::New(fVector * scale); } PyObject* Add(pyVector3& other) { return pyVector3::New(fVector + other.fVector); } PyObject* Subtract(pyVector3& other) { return pyVector3::New(fVector - other.fVector); } PyObject* Copy() { return pyVector3::New(fVector); } diff --git a/Sources/Plasma/FeatureLib/pfPython/pyGlueHelpers.h b/Sources/Plasma/FeatureLib/pfPython/pyGlueHelpers.h index f9ab4090..1184c1ce 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyGlueHelpers.h +++ b/Sources/Plasma/FeatureLib/pfPython/pyGlueHelpers.h @@ -112,7 +112,7 @@ PyObject *pythonClassName##_new(PyTypeObject *type, PyObject *, PyObject *) \ self = (pythonClassName*)type->tp_alloc(type, 0); \ if (self != NULL) \ { \ - self->fThis = TRACKED_NEW glueClassName(); \ + self->fThis = new glueClassName(); \ if (self->fThis == NULL) \ { \ Py_DECREF(self); \ diff --git a/Sources/Plasma/FeatureLib/pfPython/pyGrassShader.cpp b/Sources/Plasma/FeatureLib/pfPython/pyGrassShader.cpp index 95050610..daf22061 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyGrassShader.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/pyGrassShader.cpp @@ -66,7 +66,7 @@ void pyGrassShader::SetKey(plKey key) // Setter functions ////////////////////////////////////////////////////////////////////// -void pyGrassShader::SetWaveDistortion(int waveNum, const std::vector & distortion) +void pyGrassShader::SetWaveDistortion(int waveNum, const std::vector & distortion) { if ((waveNum < 0)||(waveNum >= plGrassShaderMod::kNumWaves)) { @@ -95,7 +95,7 @@ void pyGrassShader::SetWaveDistortion(int waveNum, const std::vector & } } -void pyGrassShader::SetWaveDirection(int waveNum, const std::vector & direction) +void pyGrassShader::SetWaveDirection(int waveNum, const std::vector & direction) { if ((waveNum < 0)||(waveNum >= plGrassShaderMod::kNumWaves)) { @@ -123,7 +123,7 @@ void pyGrassShader::SetWaveDirection(int waveNum, const std::vector & } } -void pyGrassShader::SetWaveSpeed(int waveNum, hsScalar speed) +void pyGrassShader::SetWaveSpeed(int waveNum, float speed) { if ((waveNum < 0)||(waveNum >= plGrassShaderMod::kNumWaves)) { @@ -147,9 +147,9 @@ void pyGrassShader::SetWaveSpeed(int waveNum, hsScalar speed) // Getter functions ////////////////////////////////////////////////////////////////////// -std::vector pyGrassShader::GetWaveDistortion(int waveNum) const +std::vector pyGrassShader::GetWaveDistortion(int waveNum) const { - std::vector retVal; + std::vector retVal; retVal.push_back(-1); retVal.push_back(-1); retVal.push_back(-1); @@ -174,9 +174,9 @@ std::vector pyGrassShader::GetWaveDistortion(int waveNum) const return retVal; } -std::vector pyGrassShader::GetWaveDirection(int waveNum) const +std::vector pyGrassShader::GetWaveDirection(int waveNum) const { - std::vector retVal; + std::vector retVal; retVal.push_back(-1); retVal.push_back(-1); if ((waveNum < 0)||(waveNum >= plGrassShaderMod::kNumWaves)) @@ -199,7 +199,7 @@ std::vector pyGrassShader::GetWaveDirection(int waveNum) const return retVal; } -hsScalar pyGrassShader::GetWaveSpeed(int waveNum) const +float pyGrassShader::GetWaveSpeed(int waveNum) const { if ((waveNum < 0)||(waveNum >= plGrassShaderMod::kNumWaves)) { diff --git a/Sources/Plasma/FeatureLib/pfPython/pyGrassShader.h b/Sources/Plasma/FeatureLib/pfPython/pyGrassShader.h index a32fee43..195c014f 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyGrassShader.h +++ b/Sources/Plasma/FeatureLib/pfPython/pyGrassShader.h @@ -77,13 +77,13 @@ public: void SetKey(plKey key); - void SetWaveDistortion(int waveNum, const std::vector & distortion); - void SetWaveDirection(int waveNum, const std::vector & direction); - void SetWaveSpeed(int waveNum, hsScalar speed); + void SetWaveDistortion(int waveNum, const std::vector & distortion); + void SetWaveDirection(int waveNum, const std::vector & direction); + void SetWaveSpeed(int waveNum, float speed); - std::vector GetWaveDistortion(int waveNum) const; - std::vector GetWaveDirection(int waveNum) const; - hsScalar GetWaveSpeed(int waveNum) const; + std::vector GetWaveDistortion(int waveNum) const; + std::vector GetWaveDirection(int waveNum) const; + float GetWaveSpeed(int waveNum) const; void ResetWaves(); }; diff --git a/Sources/Plasma/FeatureLib/pfPython/pyGrassShaderGlue.cpp b/Sources/Plasma/FeatureLib/pfPython/pyGrassShaderGlue.cpp index 88723cd5..876a32be 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyGrassShaderGlue.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/pyGrassShaderGlue.cpp @@ -85,7 +85,7 @@ PYTHON_METHOD_DEFINITION(ptGrassShader, setWaveDistortion, args) } int len = PyTuple_Size(tupleObject); - std::vector vecArgs; + std::vector vecArgs; for (int curArg = 0; curArg < len; curArg++) { PyObject *arg = PyTuple_GetItem(tupleObject, curArg); @@ -94,7 +94,7 @@ PYTHON_METHOD_DEFINITION(ptGrassShader, setWaveDistortion, args) PyErr_SetString(PyExc_TypeError, "setWaveDistortion expects a integer and tuple of floats"); PYTHON_RETURN_ERROR; } - vecArgs.push_back((hsScalar)PyFloat_AsDouble(arg)); + vecArgs.push_back((float)PyFloat_AsDouble(arg)); } self->fThis->SetWaveDistortion(waveNum, vecArgs); @@ -117,7 +117,7 @@ PYTHON_METHOD_DEFINITION(ptGrassShader, setWaveDirection, args) } int len = PyTuple_Size(tupleObject); - std::vector vecArgs; + std::vector vecArgs; for (int curArg = 0; curArg < len; curArg++) { PyObject *arg = PyTuple_GetItem(tupleObject, curArg); @@ -126,7 +126,7 @@ PYTHON_METHOD_DEFINITION(ptGrassShader, setWaveDirection, args) PyErr_SetString(PyExc_TypeError, "setWaveDirection expects a integer and tuple of floats"); PYTHON_RETURN_ERROR; } - vecArgs.push_back((hsScalar)PyFloat_AsDouble(arg)); + vecArgs.push_back((float)PyFloat_AsDouble(arg)); } self->fThis->SetWaveDirection(waveNum, vecArgs); @@ -155,7 +155,7 @@ PYTHON_METHOD_DEFINITION(ptGrassShader, getWaveDistortion, args) PYTHON_RETURN_ERROR; } - std::vector vecArgs = self->fThis->GetWaveDistortion(waveNum); + std::vector vecArgs = self->fThis->GetWaveDistortion(waveNum); PyObject *retVal = PyTuple_New(vecArgs.size()); for (int curArg = 0; curArg < vecArgs.size(); curArg++) PyTuple_SetItem(retVal, curArg, PyFloat_FromDouble((double)vecArgs[curArg])); @@ -171,7 +171,7 @@ PYTHON_METHOD_DEFINITION(ptGrassShader, getWaveDirection, args) PYTHON_RETURN_ERROR; } - std::vector vecArgs = self->fThis->GetWaveDirection(waveNum); + std::vector vecArgs = self->fThis->GetWaveDirection(waveNum); PyObject *retVal = PyTuple_New(vecArgs.size()); for (int curArg = 0; curArg < vecArgs.size(); curArg++) PyTuple_SetItem(retVal, curArg, PyFloat_FromDouble((double)vecArgs[curArg])); diff --git a/Sources/Plasma/FeatureLib/pfPython/pyImage.cpp b/Sources/Plasma/FeatureLib/pfPython/pyImage.cpp index e78dab5d..5b0fcfbc 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyImage.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/pyImage.cpp @@ -71,13 +71,13 @@ PyObject* pyImage::GetPixelColor(float x, float y) image = plMipmap::ConvertNoRef(fMipMapKey->ObjectIsLoaded()); if (image) { - UInt32 height = image->GetHeight(); - UInt32 width = image->GetWidth(); - UInt32 iX = (UInt32)((float)width * x); - UInt32 iY = (UInt32)((float)height * y); + uint32_t height = image->GetHeight(); + uint32_t width = image->GetWidth(); + uint32_t iX = (uint32_t)((float)width * x); + uint32_t iY = (uint32_t)((float)height * y); hsColorRGBA pixColor; image->SetCurrLevel(0); - UInt32 *color = image->GetAddr32(iX,iY); + uint32_t *color = image->GetAddr32(iX,iY); pixColor.FromARGB32(*color); return pyColor::New(pixColor); } @@ -97,8 +97,8 @@ PyObject* pyImage::GetColorLoc(const pyColor &color) image = plMipmap::ConvertNoRef(fMipMapKey->ObjectIsLoaded()); if (image) { - UInt32 height = image->GetHeight(); - UInt32 width = image->GetWidth(); + uint32_t height = image->GetHeight(); + uint32_t width = image->GetWidth(); double minSqrDist = 9999999; hsPoint3 closestMatch; image->SetCurrLevel(0); @@ -138,7 +138,7 @@ PyObject* pyImage::GetColorLoc(const pyColor &color) // GetWidth // returns the width of the image -UInt32 pyImage::GetWidth() +uint32_t pyImage::GetWidth() { plMipmap* image; if (fMipmap) @@ -152,7 +152,7 @@ UInt32 pyImage::GetWidth() // GetHeight // returns the height of the image -UInt32 pyImage::GetHeight() +uint32_t pyImage::GetHeight() { plMipmap* image; if (fMipmap) @@ -165,7 +165,7 @@ UInt32 pyImage::GetHeight() } #include "plJPEG/plJPEG.h" -void pyImage::SaveAsJPEG(const wchar* fileName, UInt8 quality) +void pyImage::SaveAsJPEG(const wchar_t* fileName, uint8_t quality) { if (quality <= 0 || quality > 100) { @@ -177,7 +177,7 @@ void pyImage::SaveAsJPEG(const wchar* fileName, UInt8 quality) } #include "plGImage/plPNG.h" -void pyImage::SaveAsPNG(const wchar* fileName) +void pyImage::SaveAsPNG(const wchar_t* fileName) { plPNG::Instance().WriteToFile( fileName, this->GetImage() ); @@ -185,7 +185,7 @@ void pyImage::SaveAsPNG(const wchar* fileName) #include "hsResMgr.h" #include "pnKeyedObject/plUoid.h" -PyObject* pyImage::LoadJPEGFromDisk(const wchar* filename, UInt16 width, UInt16 height) +PyObject* pyImage::LoadJPEGFromDisk(const wchar_t* filename, uint16_t width, uint16_t height) { plMipmap* theMipmap = plJPEG::Instance().ReadFromFile(filename); if (theMipmap) @@ -201,7 +201,7 @@ PyObject* pyImage::LoadJPEGFromDisk(const wchar* filename, UInt16 width, UInt16 // let's create a nice name for this thing based on the filename plString name = _TEMP_CONVERT_FROM_LITERAL("PtImageFromDisk_"); - const wchar* i = filename; + const wchar_t* i = filename; int charsChecked = 0; while (*i != '\\' && *i != '\0' && charsChecked < 1024) diff --git a/Sources/Plasma/FeatureLib/pfPython/pyImage.h b/Sources/Plasma/FeatureLib/pfPython/pyImage.h index 632faf60..f5791847 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyImage.h +++ b/Sources/Plasma/FeatureLib/pfPython/pyImage.h @@ -163,11 +163,11 @@ public: // for python access PyObject *GetPixelColor(float x, float y); // returns the color at a specific x,y position (x and y from 0 to 1) - returns pyColor PyObject *GetColorLoc(const pyColor &color); // returns the x,y position of a color (x and y from 0 to 1) - returns pyPoint3 - UInt32 GetWidth(); // returns the width of the image - UInt32 GetHeight(); // returns the height of the image - void SaveAsJPEG(const wchar* fileName, UInt8 quality = 75); - void SaveAsPNG(const wchar* fileName); - static PyObject* LoadJPEGFromDisk(const wchar* filename, UInt16 width, UInt16 height); // returns pyImage + uint32_t GetWidth(); // returns the width of the image + uint32_t GetHeight(); // returns the height of the image + void SaveAsJPEG(const wchar_t* fileName, uint8_t quality = 75); + void SaveAsPNG(const wchar_t* fileName); + static PyObject* LoadJPEGFromDisk(const wchar_t* filename, uint16_t width, uint16_t height); // returns pyImage #endif }; diff --git a/Sources/Plasma/FeatureLib/pfPython/pyImageGlue.cpp b/Sources/Plasma/FeatureLib/pfPython/pyImageGlue.cpp index db47477f..bf0c1c01 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyImageGlue.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/pyImageGlue.cpp @@ -152,7 +152,7 @@ PYTHON_METHOD_DEFINITION(ptImage, saveAsJPEG, args) if (PyUnicode_Check(filenameObj)) { int strLen = PyUnicode_GetSize(filenameObj); - wchar_t* text = TRACKED_NEW wchar_t[strLen + 1]; + wchar_t* text = new wchar_t[strLen + 1]; PyUnicode_AsWideChar((PyUnicodeObject*)filenameObj, text, strLen); text[strLen] = L'\0'; self->fThis->SaveAsJPEG(text, quality); @@ -187,7 +187,7 @@ PYTHON_METHOD_DEFINITION(ptImage, saveAsPNG, args) if (PyUnicode_Check(filenameObj)) { int strLen = PyUnicode_GetSize(filenameObj); - wchar_t* text = TRACKED_NEW wchar_t[strLen + 1]; + wchar_t* text = new wchar_t[strLen + 1]; PyUnicode_AsWideChar((PyUnicodeObject*)filenameObj, text, strLen); text[strLen] = L'\0'; self->fThis->SaveAsPNG(text); @@ -288,7 +288,7 @@ PYTHON_GLOBAL_METHOD_DEFINITION(PtLoadJPEGFromDisk, args, "Params: filename,widt if (PyUnicode_Check(filenameObj)) { int strLen = PyUnicode_GetSize(filenameObj); - wchar_t* text = TRACKED_NEW wchar_t[strLen + 1]; + wchar_t* text = new wchar_t[strLen + 1]; PyUnicode_AsWideChar((PyUnicodeObject*)filenameObj, text, strLen); text[strLen] = L'\0'; PyObject* ret = pyImage::LoadJPEGFromDisk(text, width, height); diff --git a/Sources/Plasma/FeatureLib/pfPython/pyJournalBook.cpp b/Sources/Plasma/FeatureLib/pfPython/pyJournalBook.cpp index d526ba6b..e1e86f57 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyJournalBook.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/pyJournalBook.cpp @@ -54,7 +54,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "hsResMgr.h" #include "pnKeyedObject/plUoid.h" -UInt32 pyJournalBook::fNextKeyID = 0; +uint32_t pyJournalBook::fNextKeyID = 0; void pyJournalBook::IMakeNewKey( void ) { @@ -71,47 +71,47 @@ pyJournalBook::pyJournalBook() pyJournalBook::pyJournalBook( const char *esHTMLSource ) { - fBook = TRACKED_NEW pfJournalBook( esHTMLSource ); + fBook = new pfJournalBook( esHTMLSource ); IMakeNewKey(); } pyJournalBook::pyJournalBook( std::wstring esHTMLSource ) { - fBook = TRACKED_NEW pfJournalBook( esHTMLSource.c_str() ); + fBook = new pfJournalBook( esHTMLSource.c_str() ); IMakeNewKey(); } pyJournalBook::pyJournalBook( const char *esHTMLSource, pyImage &coverImage, pyKey callbackKey ) { - fBook = TRACKED_NEW pfJournalBook( esHTMLSource, coverImage.GetKey(), callbackKey.getKey(), + fBook = new pfJournalBook( esHTMLSource, coverImage.GetKey(), callbackKey.getKey(), callbackKey.getKey() != nil ? callbackKey.getKey()->GetUoid().GetLocation() : plLocation::kGlobalFixedLoc ); IMakeNewKey(); } pyJournalBook::pyJournalBook( std::wstring esHTMLSource, pyImage &coverImage, pyKey callbackKey ) { - fBook = TRACKED_NEW pfJournalBook( esHTMLSource.c_str(), coverImage.GetKey(), callbackKey.getKey(), + fBook = new pfJournalBook( esHTMLSource.c_str(), coverImage.GetKey(), callbackKey.getKey(), callbackKey.getKey() != nil ? callbackKey.getKey()->GetUoid().GetLocation() : plLocation::kGlobalFixedLoc ); IMakeNewKey(); } pyJournalBook::pyJournalBook( const char *esHTMLSource, pyImage &coverImage, pyKey callbackKey, const plString &guiName ) { - fBook = TRACKED_NEW pfJournalBook( esHTMLSource, coverImage.GetKey(), callbackKey.getKey(), + fBook = new pfJournalBook( esHTMLSource, coverImage.GetKey(), callbackKey.getKey(), callbackKey.getKey() != nil ? callbackKey.getKey()->GetUoid().GetLocation() : plLocation::kGlobalFixedLoc, guiName ); IMakeNewKey(); } pyJournalBook::pyJournalBook( std::wstring esHTMLSource, pyImage &coverImage, pyKey callbackKey, const plString &guiName ) { - fBook = TRACKED_NEW pfJournalBook( esHTMLSource.c_str(), coverImage.GetKey(), callbackKey.getKey(), + fBook = new pfJournalBook( esHTMLSource.c_str(), coverImage.GetKey(), callbackKey.getKey(), callbackKey.getKey() != nil ? callbackKey.getKey()->GetUoid().GetLocation() : plLocation::kGlobalFixedLoc, guiName ); IMakeNewKey(); } pyJournalBook::pyJournalBook( const char *esHTMLSource, pyKey callbackKey ) { - fBook = TRACKED_NEW pfJournalBook( esHTMLSource, nil, callbackKey.getKey(), + fBook = new pfJournalBook( esHTMLSource, nil, callbackKey.getKey(), callbackKey.getKey() != nil ? callbackKey.getKey()->GetUoid().GetLocation() : plLocation::kGlobalFixedLoc ); IMakeNewKey(); @@ -119,7 +119,7 @@ pyJournalBook::pyJournalBook( const char *esHTMLSource, pyKey callbackKey ) pyJournalBook::pyJournalBook( std::wstring esHTMLSource, pyKey callbackKey ) { - fBook = TRACKED_NEW pfJournalBook( esHTMLSource.c_str(), nil, callbackKey.getKey(), + fBook = new pfJournalBook( esHTMLSource.c_str(), nil, callbackKey.getKey(), callbackKey.getKey() != nil ? callbackKey.getKey()->GetUoid().GetLocation() : plLocation::kGlobalFixedLoc ); IMakeNewKey(); @@ -143,7 +143,7 @@ void pyJournalBook::MakeBook(std::string esHTMLSource, plKey coverImageKey /* = if (callbackKey != nil) loc = callbackKey->GetUoid().GetLocation(); - fBook = TRACKED_NEW pfJournalBook(esHTMLSource.c_str(), coverImageKey, callbackKey, loc, guiName); + fBook = new pfJournalBook(esHTMLSource.c_str(), coverImageKey, callbackKey, loc, guiName); IMakeNewKey(); } @@ -156,7 +156,7 @@ void pyJournalBook::MakeBook(std::wstring esHTMLSource, plKey coverImageKey /* = if (callbackKey != nil) loc = callbackKey->GetUoid().GetLocation(); - fBook = TRACKED_NEW pfJournalBook(esHTMLSource.c_str(), coverImageKey, callbackKey, loc, guiName); + fBook = new pfJournalBook(esHTMLSource.c_str(), coverImageKey, callbackKey, loc, guiName); IMakeNewKey(); } @@ -172,7 +172,7 @@ void pyJournalBook::Hide( void ) fBook->Hide(); } -void pyJournalBook::Open( UInt32 startingPage ) +void pyJournalBook::Open( uint32_t startingPage ) { if( fBook != nil ) fBook->Open( startingPage ); @@ -202,19 +202,19 @@ void pyJournalBook::PreviousPage( void ) fBook->PreviousPage(); } -void pyJournalBook::GoToPage( UInt32 page ) +void pyJournalBook::GoToPage( uint32_t page ) { if( fBook != nil ) fBook->GoToPage( page ); } -void pyJournalBook::SetSize( hsScalar width, hsScalar height ) +void pyJournalBook::SetSize( float width, float height ) { if( fBook != nil ) fBook->SetBookSize( width, height ); } -UInt32 pyJournalBook::GetCurrentPage( void ) const +uint32_t pyJournalBook::GetCurrentPage( void ) const { if( fBook != nil ) return fBook->GetCurrentPage(); @@ -222,7 +222,7 @@ UInt32 pyJournalBook::GetCurrentPage( void ) const return 0; } -void pyJournalBook::SetPageMargin( UInt32 margin ) +void pyJournalBook::SetPageMargin( uint32_t margin ) { if( fBook != nil ) fBook->SetPageMargin( margin ); @@ -255,7 +255,7 @@ void pyJournalBook::UnloadAllGUIs() pfJournalBook::UnloadAllGUIs(); } -PyObject *pyJournalBook::GetMovie(UInt8 index) +PyObject *pyJournalBook::GetMovie(uint8_t index) { if (fBook != nil) { diff --git a/Sources/Plasma/FeatureLib/pfPython/pyJournalBook.h b/Sources/Plasma/FeatureLib/pfPython/pyJournalBook.h index 0ae43332..5c17b721 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyJournalBook.h +++ b/Sources/Plasma/FeatureLib/pfPython/pyJournalBook.h @@ -67,7 +67,7 @@ protected: pfJournalBook *fBook; - static UInt32 fNextKeyID; + static uint32_t fNextKeyID; void IMakeNewKey( void ); @@ -104,18 +104,18 @@ public: // Interface functions per book virtual void Show( hsBool startOpened ); virtual void Hide( void ); - virtual void Open( UInt32 startingPage ); + virtual void Open( uint32_t startingPage ); virtual void Close( void ); virtual void CloseAndHide( void ); virtual void NextPage( void ); virtual void PreviousPage( void ); - virtual void GoToPage( UInt32 page ); - virtual UInt32 GetCurrentPage( void ) const; - virtual void SetPageMargin( UInt32 margin ); + virtual void GoToPage( uint32_t page ); + virtual uint32_t GetCurrentPage( void ) const; + virtual void SetPageMargin( uint32_t margin ); virtual void AllowPageTurning( bool allow ); - virtual void SetSize( hsScalar width, hsScalar height ); + virtual void SetSize( float width, float height ); virtual void SetGUI( const plString &guiName ); @@ -123,7 +123,7 @@ public: static void UnloadGUI( const plString &guiName ); static void UnloadAllGUIs(); - virtual PyObject *GetMovie( UInt8 index ); // returns cyAnimation + virtual PyObject *GetMovie( uint8_t index ); // returns cyAnimation virtual void SetEditable( hsBool editable ); virtual std::string GetEditableText( void ) const; diff --git a/Sources/Plasma/FeatureLib/pfPython/pyJournalBookGlue.cpp b/Sources/Plasma/FeatureLib/pfPython/pyJournalBookGlue.cpp index 03c058cd..02e5b995 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyJournalBookGlue.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/pyJournalBookGlue.cpp @@ -109,7 +109,7 @@ PYTHON_INIT_DEFINITION(ptBook, args, keywords) if (PyUnicode_Check(sourceObj)) { int len = PyUnicode_GetSize(sourceObj); - wchar_t* temp = TRACKED_NEW wchar_t[len + 1]; + wchar_t* temp = new wchar_t[len + 1]; PyUnicode_AsWideChar((PyUnicodeObject*)sourceObj, temp, len); temp[len] = L'\0'; diff --git a/Sources/Plasma/FeatureLib/pfPython/pyKey.cpp b/Sources/Plasma/FeatureLib/pfPython/pyKey.cpp index 1708c01f..ca9a79ab 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyKey.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/pyKey.cpp @@ -134,7 +134,7 @@ PyObject* pyKey::GetPySceneObject() void pyKey::IEnable(hsBool state) { // create message - plEnableMsg* pMsg = TRACKED_NEW plEnableMsg; + plEnableMsg* pMsg = new plEnableMsg; if (fNetForce ) { // set the network propagate flag to make sure it gets to the other clients @@ -198,7 +198,7 @@ plPipeline* pyKey::GetPipeline() } // get the notify list count -Int32 pyKey::NotifyListCount() +int32_t pyKey::NotifyListCount() { // see if we have a PythonFileModifier pointer if ( fPyFileMod ) @@ -208,7 +208,7 @@ Int32 pyKey::NotifyListCount() } // get a notify list item -plKey pyKey::GetNotifyListItem(Int32 i) +plKey pyKey::GetNotifyListItem(int32_t i) { // see if we have a PythonFileModifier pointer if ( fPyFileMod ) @@ -219,7 +219,7 @@ plKey pyKey::GetNotifyListItem(Int32 i) // Set the dirty state on the PythonModifier -void pyKey::DirtySynchState(const char* SDLStateName, UInt32 sendFlags) +void pyKey::DirtySynchState(const char* SDLStateName, uint32_t sendFlags) { // see if we have a PythonFileModifier pointer if ( fPyFileMod ) diff --git a/Sources/Plasma/FeatureLib/pfPython/pyKey.h b/Sources/Plasma/FeatureLib/pfPython/pyKey.h index 3e84e7e4..43d0e50a 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyKey.h +++ b/Sources/Plasma/FeatureLib/pfPython/pyKey.h @@ -122,12 +122,12 @@ public: virtual hsBool IsAttachedToClone(); // (old style - Used in pyNotify) // get the notify list count - virtual Int32 NotifyListCount(); + virtual int32_t NotifyListCount(); // (old style - Used in pyNotify) // get a notify list item - virtual plKey GetNotifyListItem(Int32 i); + virtual plKey GetNotifyListItem(int32_t i); // Set the dirty state on the PythonModifier - virtual void DirtySynchState(const char* SDLStateName, UInt32 sendFlags); + virtual void DirtySynchState(const char* SDLStateName, uint32_t sendFlags); // register and unregister for control key envents virtual void EnableControlKeyEvents(); diff --git a/Sources/Plasma/FeatureLib/pfPython/pyKeyMap.cpp b/Sources/Plasma/FeatureLib/pfPython/pyKeyMap.cpp index fc0feb51..a5717d26 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyKeyMap.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/pyKeyMap.cpp @@ -52,7 +52,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "pnInputCore/plKeyMap.h" // conversion functions -const char* pyKeyMap::ConvertVKeyToChar( UInt32 vk, UInt32 flags ) +const char* pyKeyMap::ConvertVKeyToChar( uint32_t vk, uint32_t flags ) { const char *key = plKeyMap::ConvertVKeyToChar( vk ); static char shortKey[ 2 ]; @@ -78,7 +78,7 @@ const char* pyKeyMap::ConvertVKeyToChar( UInt32 vk, UInt32 flags ) return newKey; } -UInt32 pyKeyMap::ConvertCharToVKey( const char* charVKey ) +uint32_t pyKeyMap::ConvertCharToVKey( const char* charVKey ) { char str[ 16 ]; int i; @@ -96,13 +96,13 @@ UInt32 pyKeyMap::ConvertCharToVKey( const char* charVKey ) return plKeyMap::ConvertCharToVKey( str ); } -UInt32 pyKeyMap::ConvertCharToFlags( const char *charVKey ) +uint32_t pyKeyMap::ConvertCharToFlags( const char *charVKey ) { char str[ 16 ]; strcpy( str, charVKey ); // Find modifiers to set flags with - UInt32 keyFlags = 0; + uint32_t keyFlags = 0; if( strstr( str, "_S" ) || strstr( str, "_s" ) ) keyFlags |= plKeyCombo::kShift; if( strstr( str, "_C" ) || strstr( str, "_c" ) ) @@ -112,13 +112,13 @@ UInt32 pyKeyMap::ConvertCharToFlags( const char *charVKey ) } -UInt32 pyKeyMap::ConvertCharToControlCode(const char* charCode) +uint32_t pyKeyMap::ConvertCharToControlCode(const char* charCode) { ControlEventCode code = plInputMap::ConvertCharToControlCode(charCode); - return (UInt32)code; + return (uint32_t)code; } -const char* pyKeyMap::ConvertControlCodeToString( UInt32 code ) +const char* pyKeyMap::ConvertControlCodeToString( uint32_t code ) { return plInputMap::ConvertControlCodeToString((ControlEventCode)code); } @@ -193,7 +193,7 @@ plKeyCombo pyKeyMap::IBindKeyToVKey( const char *keyStr ) return combo; } -UInt32 pyKeyMap::GetBindingKey1(UInt32 code) +uint32_t pyKeyMap::GetBindingKey1(uint32_t code) { if( plInputInterfaceMgr::GetInstance() != nil ) { @@ -201,13 +201,13 @@ UInt32 pyKeyMap::GetBindingKey1(UInt32 code) if ( keymap ) { plKeyCombo key = keymap->GetKey1(); - return (UInt32)(key.fKey); + return (uint32_t)(key.fKey); } } return 0; } -UInt32 pyKeyMap::GetBindingFlags1(UInt32 code) +uint32_t pyKeyMap::GetBindingFlags1(uint32_t code) { if( plInputInterfaceMgr::GetInstance() != nil ) { @@ -215,13 +215,13 @@ UInt32 pyKeyMap::GetBindingFlags1(UInt32 code) if ( keymap ) { plKeyCombo key = keymap->GetKey1(); - return (UInt32)(key.fFlags); + return (uint32_t)(key.fFlags); } } return 0; } -UInt32 pyKeyMap::GetBindingKey2(UInt32 code) +uint32_t pyKeyMap::GetBindingKey2(uint32_t code) { if( plInputInterfaceMgr::GetInstance() != nil ) { @@ -229,13 +229,13 @@ UInt32 pyKeyMap::GetBindingKey2(UInt32 code) if ( keymap ) { plKeyCombo key = keymap->GetKey2(); - return (UInt32)(key.fKey); + return (uint32_t)(key.fKey); } } return 0; } -UInt32 pyKeyMap::GetBindingFlags2(UInt32 code) +uint32_t pyKeyMap::GetBindingFlags2(uint32_t code) { if( plInputInterfaceMgr::GetInstance() != nil ) { @@ -243,13 +243,13 @@ UInt32 pyKeyMap::GetBindingFlags2(UInt32 code) if ( keymap ) { plKeyCombo key = keymap->GetKey2(); - return (UInt32)(key.fFlags); + return (uint32_t)(key.fFlags); } } return 0; } -UInt32 pyKeyMap::GetBindingKeyConsole(const char* command) +uint32_t pyKeyMap::GetBindingKeyConsole(const char* command) { if( plInputInterfaceMgr::GetInstance() != nil ) { @@ -257,13 +257,13 @@ UInt32 pyKeyMap::GetBindingKeyConsole(const char* command) if ( keymap ) { plKeyCombo key = keymap->GetKey1(); - return (UInt32)(key.fKey); + return (uint32_t)(key.fKey); } } return 0; } -UInt32 pyKeyMap::GetBindingFlagsConsole(const char* command) +uint32_t pyKeyMap::GetBindingFlagsConsole(const char* command) { if( plInputInterfaceMgr::GetInstance() != nil ) { @@ -271,7 +271,7 @@ UInt32 pyKeyMap::GetBindingFlagsConsole(const char* command) if ( keymap ) { plKeyCombo key = keymap->GetKey1(); - return (UInt32)(key.fFlags); + return (uint32_t)(key.fFlags); } } return 0; diff --git a/Sources/Plasma/FeatureLib/pfPython/pyKeyMap.h b/Sources/Plasma/FeatureLib/pfPython/pyKeyMap.h index c5d1b0c1..b0f295f0 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyKeyMap.h +++ b/Sources/Plasma/FeatureLib/pfPython/pyKeyMap.h @@ -48,7 +48,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // ////////////////////////////////////////////////////////////////////// -#include "hsTypes.h" +#include "HeadSpin.h" #include "pnInputCore/plKeyMap.h" #include @@ -79,25 +79,25 @@ public: static void AddPlasmaClasses(PyObject *m); // conversion functions - const char* ConvertVKeyToChar( UInt32 vk, UInt32 flags ); - UInt32 ConvertCharToVKey( const char *charVKey ); - UInt32 ConvertCharToFlags( const char *charVKey ); + const char* ConvertVKeyToChar( uint32_t vk, uint32_t flags ); + uint32_t ConvertCharToVKey( const char *charVKey ); + uint32_t ConvertCharToFlags( const char *charVKey ); - UInt32 ConvertCharToControlCode(const char* charCode); - const char* ConvertControlCodeToString( UInt32 code ); + uint32_t ConvertCharToControlCode(const char* charCode); + const char* ConvertControlCodeToString( uint32_t code ); // bind a key to an action void BindKey( const char* keyStr1, const char* keyStr2, const char* act); void BindKeyToConsoleCommand( const char* keyStr1, const char* command); - UInt32 GetBindingKey1(UInt32 code); - UInt32 GetBindingFlags1(UInt32 code); - UInt32 GetBindingKey2(UInt32 code); - UInt32 GetBindingFlags2(UInt32 code); + uint32_t GetBindingKey1(uint32_t code); + uint32_t GetBindingFlags1(uint32_t code); + uint32_t GetBindingKey2(uint32_t code); + uint32_t GetBindingFlags2(uint32_t code); - UInt32 GetBindingKeyConsole(const char* command); - UInt32 GetBindingFlagsConsole(const char* command); + uint32_t GetBindingKeyConsole(const char* command); + uint32_t GetBindingFlagsConsole(const char* command); void WriteKeyMap(); diff --git a/Sources/Plasma/FeatureLib/pfPython/pyMarkerMgr.cpp b/Sources/Plasma/FeatureLib/pfPython/pyMarkerMgr.cpp index 32b10b27..7b23247f 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyMarkerMgr.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/pyMarkerMgr.cpp @@ -49,14 +49,14 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "pfCharacter/pfMarkerMgr.h" -void pyMarkerMgr::AddMarker(double x, double y, double z, UInt32 id, bool justCreated) +void pyMarkerMgr::AddMarker(double x, double y, double z, uint32_t id, bool justCreated) { pfMarkerMgr* mmi = pfMarkerMgr::Instance(); if (mmi) mmi->AddMarker(x, y, z, id, justCreated); } -void pyMarkerMgr::RemoveMarker(UInt32 id) +void pyMarkerMgr::RemoveMarker(uint32_t id) { pfMarkerMgr* mmi = pfMarkerMgr::Instance(); if (mmi) @@ -70,14 +70,14 @@ void pyMarkerMgr::RemoveAllMarkers() mmi->RemoveAllMarkers(); } -void pyMarkerMgr::SetSelectedMarker(UInt32 markerID) +void pyMarkerMgr::SetSelectedMarker(uint32_t markerID) { pfMarkerMgr* mmi = pfMarkerMgr::Instance(); if (mmi) mmi->SetSelectedMarker(markerID); } -UInt32 pyMarkerMgr::GetSelectedMarker() +uint32_t pyMarkerMgr::GetSelectedMarker() { pfMarkerMgr* mmi = pfMarkerMgr::Instance(); if (mmi) @@ -107,14 +107,14 @@ bool pyMarkerMgr::GetMarkersRespawn() return false; } -void pyMarkerMgr::CaptureQuestMarker(UInt32 id, bool captured) +void pyMarkerMgr::CaptureQuestMarker(uint32_t id, bool captured) { pfMarkerMgr* mmi = pfMarkerMgr::Instance(); if (mmi) mmi->CaptureMarker(id, captured); } -void pyMarkerMgr::CaptureTeamMarker(UInt32 id, int team) +void pyMarkerMgr::CaptureTeamMarker(uint32_t id, int team) { pfMarkerMgr* mmi = pfMarkerMgr::Instance(); if (mmi) diff --git a/Sources/Plasma/FeatureLib/pfPython/pyMarkerMgr.h b/Sources/Plasma/FeatureLib/pfPython/pyMarkerMgr.h index 9d06ae8e..c6e470f7 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyMarkerMgr.h +++ b/Sources/Plasma/FeatureLib/pfPython/pyMarkerMgr.h @@ -48,7 +48,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // ////////////////////////////////////////////////////////////////////// -#include "hsTypes.h" +#include "HeadSpin.h" #include #include "pyGlueHelpers.h" @@ -68,19 +68,19 @@ public: static void AddPlasmaClasses(PyObject *m); static void AddPlasmaConstantsClasses(PyObject *m); - void AddMarker(double x, double y, double z, UInt32 id, bool justCreated); - void RemoveMarker(UInt32 id); + void AddMarker(double x, double y, double z, uint32_t id, bool justCreated); + void RemoveMarker(uint32_t id); void RemoveAllMarkers(); - void SetSelectedMarker(UInt32 markerID); - UInt32 GetSelectedMarker(); + void SetSelectedMarker(uint32_t markerID); + uint32_t GetSelectedMarker(); void ClearSelectedMarker(); void SetMarkersRespawn(bool respawn); bool GetMarkersRespawn(); - void CaptureQuestMarker(UInt32 id, bool captured); // for QUEST games (no teams) - void CaptureTeamMarker(UInt32 id, int team); // for TEAM games (0 = not captured) + void CaptureQuestMarker(uint32_t id, bool captured); // for QUEST games (no teams) + void CaptureTeamMarker(uint32_t id, int team); // for TEAM games (0 = not captured) // Shows your markers locally, so you can see where they are void ShowMarkersLocal(); diff --git a/Sources/Plasma/FeatureLib/pfPython/pyMarkerMgrGlue.cpp b/Sources/Plasma/FeatureLib/pfPython/pyMarkerMgrGlue.cpp index f114cd65..35cbb025 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyMarkerMgrGlue.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/pyMarkerMgrGlue.cpp @@ -60,7 +60,7 @@ PYTHON_METHOD_DEFINITION(ptMarkerMgr, addMarker, args) { double x, y, z; unsigned long id; - byte justCreated; + uint8_t justCreated; if (!PyArg_ParseTuple(args, "dddlb", &x, &y, &z, &id, &justCreated)) { PyErr_SetString(PyExc_TypeError, "addMarker expects three doubles, an unsigned long, and a bool"); @@ -105,7 +105,7 @@ PYTHON_BASIC_METHOD_DEFINITION(ptMarkerMgr, clearSelectedMarker, ClearSelectedMa PYTHON_METHOD_DEFINITION(ptMarkerMgr, setMarkersRespawn, args) { - byte respawn; + uint8_t respawn; if (!PyArg_ParseTuple(args, "b", &respawn)) { PyErr_SetString(PyExc_TypeError, "setMarkersRespawn expects a boolean"); @@ -123,7 +123,7 @@ PYTHON_METHOD_DEFINITION_NOARGS(ptMarkerMgr, getMarkersRespawn) PYTHON_METHOD_DEFINITION(ptMarkerMgr, captureQuestMarker, args) { unsigned long id; - byte captured; + uint8_t captured; if (!PyArg_ParseTuple(args, "lb", &id, &captured)) { PyErr_SetString(PyExc_TypeError, "captureQuestMarker expects an unsigned long and a bool"); diff --git a/Sources/Plasma/FeatureLib/pfPython/pyMatrix44.cpp b/Sources/Plasma/FeatureLib/pfPython/pyMatrix44.cpp index 60976819..62793f3e 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyMatrix44.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/pyMatrix44.cpp @@ -83,9 +83,9 @@ PyObject* pyMatrix44::GetTranslate(PyObject* pt) return pt; } -hsScalar* pyMatrix44::GetData() +float* pyMatrix44::GetData() { - hsScalar *res = new hsScalar[4*4]; + float *res = new float[4*4]; res[0] = fMatrix.fMap[0][0]; res[1] = fMatrix.fMap[0][1]; res[2] = fMatrix.fMap[0][2]; res[3] = fMatrix.fMap[0][3]; res[4] = fMatrix.fMap[1][0]; res[5] = fMatrix.fMap[1][1]; res[6] = fMatrix.fMap[1][2]; res[7] = fMatrix.fMap[1][3]; res[8] = fMatrix.fMap[2][0]; res[9] = fMatrix.fMap[2][1]; res[10] = fMatrix.fMap[2][2]; res[11] = fMatrix.fMap[2][3]; @@ -94,7 +94,7 @@ hsScalar* pyMatrix44::GetData() return res; } -void pyMatrix44::SetData(const hsScalar mat[]) +void pyMatrix44::SetData(const float mat[]) { fMatrix.fMap[0][0] = mat[0]; fMatrix.fMap[0][1] = mat[1]; diff --git a/Sources/Plasma/FeatureLib/pfPython/pyMatrix44.h b/Sources/Plasma/FeatureLib/pfPython/pyMatrix44.h index 11a8b4a9..05382273 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyMatrix44.h +++ b/Sources/Plasma/FeatureLib/pfPython/pyMatrix44.h @@ -78,15 +78,15 @@ public: PyObject* Copy() { return pyMatrix44::New(fMatrix); } // returns pyMatrix44 void Translate(pyVector3 v) { fMatrix.Translate(&v.fVector); } void Scale(pyVector3 v) { fMatrix.Scale(&v.fVector); } - void Rotate(int axis, hsScalar radians) { fMatrix.Rotate(axis,radians); } + void Rotate(int axis, float radians) { fMatrix.Rotate(axis,radians); } void Reset() { fMatrix.Reset(); } void MakeTranslateMat(pyVector3 trans) { fMatrix.MakeTranslateMat(&trans.fVector); } void MakeScaleMat(pyVector3 scale) { fMatrix.MakeScaleMat(&scale.fVector); } - void MakeRotateMat(int axis, hsScalar radians) { fMatrix.MakeRotateMat(axis,radians); } + void MakeRotateMat(int axis, float radians) { fMatrix.MakeRotateMat(axis,radians); } void Make(pyPoint3 from,pyPoint3 at,pyVector3 up) { fMatrix.Make(&from.fPoint,&at.fPoint,&up.fVector); } void MakeUpPreserving(pyPoint3 from,pyPoint3 at,pyVector3 up) { fMatrix.MakeUpPreserving(&from.fPoint,&at.fPoint,&up.fVector); } hsBool GetParity() { return fMatrix.GetParity(); } - hsScalar GetDeterminant() { return fMatrix.GetDeterminant(); } + float GetDeterminant() { return fMatrix.GetDeterminant(); } PyObject* GetInverse(PyObject* inverse); // returns (and accepts) pyMatrix44 PyObject* GetTranspose(PyObject* inverse); // returns (and accepts) pyMatrix44 PyObject* GetAdjoint(PyObject* adjoint); // returns (and accepts) pyMatrix44 @@ -95,8 +95,8 @@ public: PyObject* GetUpAxis() { return pyVector3::New(fMatrix.GetAxis(hsMatrix44::kUp)); } // returns pyVector3 PyObject* GetRightAxis() { return pyVector3::New(fMatrix.GetAxis(hsMatrix44::kRight)); } // returns pyVector3 - hsScalar* GetData(); - void SetData(const hsScalar mat[]); + float* GetData(); + void SetData(const float mat[]); }; diff --git a/Sources/Plasma/FeatureLib/pfPython/pyMatrix44Glue.cpp b/Sources/Plasma/FeatureLib/pfPython/pyMatrix44Glue.cpp index f6705629..df040509 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyMatrix44Glue.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/pyMatrix44Glue.cpp @@ -300,7 +300,7 @@ PYTHON_METHOD_DEFINITION_NOARGS(ptMatrix44, right) PYTHON_METHOD_DEFINITION_NOARGS(ptMatrix44, getData) { - hsScalar *mat = self->fThis->GetData(); + float *mat = self->fThis->GetData(); PyObject *retVal = Py_BuildValue("(ffff)(ffff)(ffff)(ffff)", mat[0], mat[1], mat[2], mat[3], @@ -320,7 +320,7 @@ PYTHON_METHOD_DEFINITION_NOARGS(ptMatrix44, getData) PYTHON_METHOD_DEFINITION(ptMatrix44, setData, args) { - hsScalar mat[4*4]; + float mat[4*4]; if (!PyArg_ParseTuple(args, "((ffff)(ffff)(ffff)(ffff))", &mat[0], &mat[1], &mat[2], &mat[3], diff --git a/Sources/Plasma/FeatureLib/pfPython/pyMoviePlayer.cpp b/Sources/Plasma/FeatureLib/pfPython/pyMoviePlayer.cpp index f2dbddee..cd63a0f2 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyMoviePlayer.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/pyMoviePlayer.cpp @@ -57,9 +57,9 @@ pyMoviePlayer::pyMoviePlayer(const char* movieName,pyKey& selfKey) // make the movie if ( fMovieName) { - plMovieMsg* mov = TRACKED_NEW plMovieMsg(fMovieName, plMovieMsg::kMake | plMovieMsg::kAddCallbacks); + plMovieMsg* mov = new plMovieMsg(fMovieName, plMovieMsg::kMake | plMovieMsg::kAddCallbacks); mov->SetSender(fSelfKey); - pfMovieEventMsg* movCallback = TRACKED_NEW pfMovieEventMsg(fMovieName); + pfMovieEventMsg* movCallback = new pfMovieEventMsg(fMovieName); movCallback->AddReceiver(fSelfKey); mov->AddCallback(movCallback); mov->Send(); @@ -83,9 +83,9 @@ void pyMoviePlayer::MakeMovie(const char* movieName, pyKey& selfKey) fSelfKey = selfKey.getKey(); if (fMovieName) { - plMovieMsg* mov = TRACKED_NEW plMovieMsg(fMovieName, plMovieMsg::kMake | plMovieMsg::kAddCallbacks); + plMovieMsg* mov = new plMovieMsg(fMovieName, plMovieMsg::kMake | plMovieMsg::kAddCallbacks); mov->SetSender(fSelfKey); - pfMovieEventMsg* movCallback = TRACKED_NEW pfMovieEventMsg(fMovieName); + pfMovieEventMsg* movCallback = new pfMovieEventMsg(fMovieName); movCallback->AddReceiver(fSelfKey); mov->AddCallback(movCallback); mov->Send(); @@ -93,11 +93,11 @@ void pyMoviePlayer::MakeMovie(const char* movieName, pyKey& selfKey) } } -void pyMoviePlayer::SetCenter(hsScalar x, hsScalar y) +void pyMoviePlayer::SetCenter(float x, float y) { if ( fMovieName) { - plMovieMsg* mov = TRACKED_NEW plMovieMsg(fMovieName, plMovieMsg::kMove); + plMovieMsg* mov = new plMovieMsg(fMovieName, plMovieMsg::kMove); mov->SetSender(fSelfKey); mov->SetCenterX(x); mov->SetCenterY(y); @@ -105,11 +105,11 @@ void pyMoviePlayer::SetCenter(hsScalar x, hsScalar y) } } -void pyMoviePlayer::SetScale(hsScalar width, hsScalar height) +void pyMoviePlayer::SetScale(float width, float height) { if ( fMovieName) { - plMovieMsg* mov = TRACKED_NEW plMovieMsg(fMovieName, plMovieMsg::kScale); + plMovieMsg* mov = new plMovieMsg(fMovieName, plMovieMsg::kScale); mov->SetSender(fSelfKey); mov->SetScaleX(width); mov->SetScaleY(height); @@ -121,29 +121,29 @@ void pyMoviePlayer::SetColor(pyColor color) { if ( fMovieName) { - plMovieMsg* mov = TRACKED_NEW plMovieMsg(fMovieName, plMovieMsg::kColor); + plMovieMsg* mov = new plMovieMsg(fMovieName, plMovieMsg::kColor); mov->SetSender(fSelfKey); mov->SetColor(color.getColor()); mov->Send(); } } -void pyMoviePlayer::SetVolume(hsScalar volume) +void pyMoviePlayer::SetVolume(float volume) { if ( fMovieName) { - plMovieMsg* mov = TRACKED_NEW plMovieMsg(fMovieName, plMovieMsg::kVolume); + plMovieMsg* mov = new plMovieMsg(fMovieName, plMovieMsg::kVolume); mov->SetSender(fSelfKey); mov->SetVolume(volume); mov->Send(); } } -void pyMoviePlayer::SetOpacity(hsScalar opacity) +void pyMoviePlayer::SetOpacity(float opacity) { if ( fMovieName) { - plMovieMsg* mov = TRACKED_NEW plMovieMsg(fMovieName, plMovieMsg::kOpacity); + plMovieMsg* mov = new plMovieMsg(fMovieName, plMovieMsg::kOpacity); mov->SetSender(fSelfKey); mov->SetOpacity(opacity); mov->Send(); @@ -155,7 +155,7 @@ void pyMoviePlayer::Play() { if ( fMovieName) { - plMovieMsg* mov = TRACKED_NEW plMovieMsg(fMovieName, plMovieMsg::kStart); + plMovieMsg* mov = new plMovieMsg(fMovieName, plMovieMsg::kStart); mov->SetSender(fSelfKey); mov->Send(); } @@ -165,7 +165,7 @@ void pyMoviePlayer::PlayPaused() { if ( fMovieName) { - plMovieMsg* mov = TRACKED_NEW plMovieMsg(fMovieName, plMovieMsg::kStart | plMovieMsg::kPause); + plMovieMsg* mov = new plMovieMsg(fMovieName, plMovieMsg::kStart | plMovieMsg::kPause); mov->SetSender(fSelfKey); mov->Send(); } @@ -175,7 +175,7 @@ void pyMoviePlayer::Pause() { if ( fMovieName) { - plMovieMsg* mov = TRACKED_NEW plMovieMsg(fMovieName, plMovieMsg::kPause); + plMovieMsg* mov = new plMovieMsg(fMovieName, plMovieMsg::kPause); mov->SetSender(fSelfKey); mov->Send(); } @@ -185,7 +185,7 @@ void pyMoviePlayer::Resume() { if ( fMovieName) { - plMovieMsg* mov = TRACKED_NEW plMovieMsg(fMovieName, plMovieMsg::kResume); + plMovieMsg* mov = new plMovieMsg(fMovieName, plMovieMsg::kResume); mov->SetSender(fSelfKey); mov->Send(); } @@ -195,7 +195,7 @@ void pyMoviePlayer::Stop() { if ( fMovieName) { - plMovieMsg* mov = TRACKED_NEW plMovieMsg(fMovieName, plMovieMsg::kStop); + plMovieMsg* mov = new plMovieMsg(fMovieName, plMovieMsg::kStop); mov->SetSender(fSelfKey); mov->Send(); } diff --git a/Sources/Plasma/FeatureLib/pfPython/pyMoviePlayer.h b/Sources/Plasma/FeatureLib/pfPython/pyMoviePlayer.h index 38a53253..0e6a0faf 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyMoviePlayer.h +++ b/Sources/Plasma/FeatureLib/pfPython/pyMoviePlayer.h @@ -77,11 +77,11 @@ public: void MakeMovie(const char* movieName, pyKey& selfKey); // only used by python glue, do NOT call // getters and setters - virtual void SetCenter(hsScalar x, hsScalar y); - virtual void SetScale(hsScalar width, hsScalar height); + virtual void SetCenter(float x, float y); + virtual void SetScale(float width, float height); virtual void SetColor(pyColor color); - virtual void SetVolume(hsScalar volume); - virtual void SetOpacity(hsScalar opacity); + virtual void SetVolume(float volume); + virtual void SetOpacity(float opacity); // actions virtual void Play(); // kStart diff --git a/Sources/Plasma/FeatureLib/pfPython/pyNetLinkingMgr.cpp b/Sources/Plasma/FeatureLib/pfPython/pyNetLinkingMgr.cpp index 239401cb..67b227f8 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyNetLinkingMgr.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/pyNetLinkingMgr.cpp @@ -86,17 +86,17 @@ void pyNetLinkingMgr::LinkToMyNeighborhoodAge() plNetLinkingMgr::GetInstance()->LinkToMyNeighborhoodAge(); } -void pyNetLinkingMgr::LinkPlayerHere( UInt32 playerID ) +void pyNetLinkingMgr::LinkPlayerHere( uint32_t playerID ) { plNetLinkingMgr::GetInstance()->LinkPlayerHere( playerID ); } -void pyNetLinkingMgr::LinkPlayerToAge( pyAgeLinkStruct & link, UInt32 playerID ) +void pyNetLinkingMgr::LinkPlayerToAge( pyAgeLinkStruct & link, uint32_t playerID ) { plNetLinkingMgr::GetInstance()->LinkPlayerToAge( link.GetAgeLink(), playerID ); } -void pyNetLinkingMgr::LinkToPlayersAge( UInt32 playerID ) +void pyNetLinkingMgr::LinkToPlayersAge( uint32_t playerID ) { plNetLinkingMgr::GetInstance()->LinkToPlayersAge( playerID ); } diff --git a/Sources/Plasma/FeatureLib/pfPython/pyNetLinkingMgr.h b/Sources/Plasma/FeatureLib/pfPython/pyNetLinkingMgr.h index 953914d7..271f8f72 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyNetLinkingMgr.h +++ b/Sources/Plasma/FeatureLib/pfPython/pyNetLinkingMgr.h @@ -42,7 +42,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #ifndef pyNetLinkingMgr_h_inc #define pyNetLinkingMgr_h_inc -#include "hsTypes.h" +#include "HeadSpin.h" #include "hsStlUtils.h" #include @@ -91,11 +91,11 @@ public: // Link to my Neighborhood Age void LinkToMyNeighborhoodAge(); // Link player to my current age - void LinkPlayerHere( UInt32 playerID ); + void LinkPlayerHere( uint32_t playerID ); // Link player to specified age - void LinkPlayerToAge( pyAgeLinkStruct & link, UInt32 playerID ); + void LinkPlayerToAge( pyAgeLinkStruct & link, uint32_t playerID ); // Link to player's current age - void LinkToPlayersAge( UInt32 playerID ); + void LinkToPlayersAge( uint32_t playerID ); PyObject* GetCurrAgeLink(); // returns pyAgeLinkStructRef PyObject* GetPrevAgeLink(); // returns pyAgeLinkStructRef diff --git a/Sources/Plasma/FeatureLib/pfPython/pyNetServerSessionInfo.cpp b/Sources/Plasma/FeatureLib/pfPython/pyNetServerSessionInfo.cpp index 945dd1c8..eea09404 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyNetServerSessionInfo.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/pyNetServerSessionInfo.cpp @@ -39,7 +39,6 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com Mead, WA 99021 *==LICENSE==*/ -#include "hsConfig.h" #include "pyNetServerSessionInfo.h" diff --git a/Sources/Plasma/FeatureLib/pfPython/pyNetServerSessionInfo.h b/Sources/Plasma/FeatureLib/pfPython/pyNetServerSessionInfo.h index ebe01c10..12e8da8e 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyNetServerSessionInfo.h +++ b/Sources/Plasma/FeatureLib/pfPython/pyNetServerSessionInfo.h @@ -42,7 +42,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #ifndef pyNetServerSessionInfo_h_inc #define pyNetServerSessionInfo_h_inc -#include "hsTypes.h" +#include "HeadSpin.h" #include "plNetCommon/plNetServerSessionInfo.h" #include "pnUUID/pnUUID.h" @@ -79,9 +79,9 @@ public: plNetServerSessionInfo & ServerInfo() { return fInfo; } void SetServerName(const char * val) { fInfo.SetServerName( val ); } - void SetServerType(UInt8 val) { fInfo.SetServerType( val ); } + void SetServerType(uint8_t val) { fInfo.SetServerType( val ); } void SetServerAddr(const char * val) { fInfo.SetServerAddr( val ); } - void SetServerPort(UInt16 val) { fInfo.SetServerPort( val ); } + void SetServerPort(uint16_t val) { fInfo.SetServerPort( val ); } void SetServerGuid(const char * val) { fServerGuid.FromString( val ); fInfo.SetServerGuid( &fServerGuid ); } bool HasServerName() const { return fInfo.HasServerName(); } bool HasServerType() const { return fInfo.HasServerType(); } @@ -89,9 +89,9 @@ public: bool HasServerPort() const { return fInfo.HasServerPort(); } bool HasServerGuid() const { return fInfo.HasServerGuid(); } const char * GetServerName() const { return fInfo.GetServerName(); } - UInt8 GetServerType() const { return fInfo.GetServerType(); } + uint8_t GetServerType() const { return fInfo.GetServerType(); } const char * GetServerAddr() const { return fInfo.GetServerAddr(); } - UInt16 GetServerPort() const { return fInfo.GetServerPort(); } + uint16_t GetServerPort() const { return fInfo.GetServerPort(); } const char * GetServerGuid() const { fServerGuid.CopyFrom( fInfo.GetServerGuid() ); return fServerGuid.AsString().c_str(); } }; @@ -119,9 +119,9 @@ public: static void AddPlasmaClasses(PyObject *m); void SetServerName(const char * val) { fInfo.SetServerName( val ); } - void SetServerType(UInt8 val) { fInfo.SetServerType( val ); } + void SetServerType(uint8_t val) { fInfo.SetServerType( val ); } void SetServerAddr(const char * val) { fInfo.SetServerAddr( val ); } - void SetServerPort(UInt16 val) { fInfo.SetServerPort( val ); } + void SetServerPort(uint16_t val) { fInfo.SetServerPort( val ); } void SetServerGuid(const char * val) { fServerGuid.FromString( val ); fInfo.SetServerGuid( &fServerGuid ); } bool HasServerName() const { return fInfo.HasServerName(); } bool HasServerType() const { return fInfo.HasServerType(); } @@ -129,9 +129,9 @@ public: bool HasServerPort() const { return fInfo.HasServerPort(); } bool HasServerGuid() const { return fInfo.HasServerGuid(); } const char * GetServerName() const { return fInfo.GetServerName(); } - UInt8 GetServerType() const { return fInfo.GetServerType(); } + uint8_t GetServerType() const { return fInfo.GetServerType(); } const char * GetServerAddr() const { return fInfo.GetServerAddr(); } - UInt16 GetServerPort() const { return fInfo.GetServerPort(); } + uint16_t GetServerPort() const { return fInfo.GetServerPort(); } const char * GetServerGuid() const { fServerGuid.CopyFrom( fInfo.GetServerGuid() ); return fServerGuid.AsString().c_str(); } }; diff --git a/Sources/Plasma/FeatureLib/pfPython/pyNotify.cpp b/Sources/Plasma/FeatureLib/pfPython/pyNotify.cpp index 58ff77e4..9352eeaf 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyNotify.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/pyNotify.cpp @@ -112,12 +112,12 @@ void pyNotify::SetNetForce(hsBool state) } -void pyNotify::SetActivateState(hsScalar state) +void pyNotify::SetActivateState(float state) { fBuildMsg.SetState(state); } -void pyNotify::SetType(Int32 type) +void pyNotify::SetType(int32_t type) { fBuildMsg.fType = type; } @@ -141,12 +141,12 @@ void pyNotify::AddPickEvent( hsBool enabled, pyKey* other, pyKey* self, pyPoint3 hitPoint.fPoint ); } -void pyNotify::AddControlKeyEvent( Int32 key, hsBool down ) +void pyNotify::AddControlKeyEvent( int32_t key, hsBool down ) { fBuildMsg.AddControlKeyEvent(key,down); } -void pyNotify::AddVarNumber(const char* name, hsScalar number) +void pyNotify::AddVarNumber(const char* name, float number) { fBuildMsg.AddVariableEvent(name,number); } @@ -156,7 +156,7 @@ void pyNotify::AddVarKey(const char* name, pyKey* key) fBuildMsg.AddVariableEvent(name, key ? key->getKey() : plKey() ); } -void pyNotify::AddFacingEvent( hsBool enabled, pyKey* other, pyKey* self, hsScalar dot) +void pyNotify::AddFacingEvent( hsBool enabled, pyKey* other, pyKey* self, float dot) { fBuildMsg.AddFacingEvent( other ? other->getKey() : plKey(), self ? self->getKey() : plKey(), @@ -175,12 +175,12 @@ void pyNotify::AddActivateEvent( hsBool active, hsBool activate ) fBuildMsg.AddActivateEvent(activate); } -void pyNotify::AddCallbackEvent( Int32 event ) +void pyNotify::AddCallbackEvent( int32_t event ) { fBuildMsg.AddCallbackEvent(event); } -void pyNotify::AddResponderState(Int32 state) +void pyNotify::AddResponderState(int32_t state) { fBuildMsg.AddResponderStateEvent(state); } @@ -191,7 +191,7 @@ void pyNotify::Send() return; // create new notify message to do the actual send with - plNotifyMsg* pNMsg = TRACKED_NEW plNotifyMsg; + plNotifyMsg* pNMsg = new plNotifyMsg; if ( fNetPropagate ) pNMsg->SetBCastFlag(plMessage::kNetPropagate); diff --git a/Sources/Plasma/FeatureLib/pfPython/pyNotify.h b/Sources/Plasma/FeatureLib/pfPython/pyNotify.h index 8e26798b..72eb86c7 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyNotify.h +++ b/Sources/Plasma/FeatureLib/pfPython/pyNotify.h @@ -92,20 +92,20 @@ public: virtual void AddReceiver(pyKey* key); virtual void SetNetPropagate(hsBool propagate); virtual void SetNetForce(hsBool state); - virtual void SetActivateState(hsScalar state); - virtual void SetType(Int32 type); + virtual void SetActivateState(float state); + virtual void SetType(int32_t type); // add event record helpers virtual void AddCollisionEvent( hsBool enter, pyKey* other, pyKey* self ); virtual void AddPickEvent(hsBool enabled, pyKey* other, pyKey* self, pyPoint3 hitPoint); - virtual void AddControlKeyEvent( Int32 key, hsBool down ); - virtual void AddVarNumber(const char* name, hsScalar number); + virtual void AddControlKeyEvent( int32_t key, hsBool down ); + virtual void AddVarNumber(const char* name, float number); virtual void AddVarKey(const char* name, pyKey* key); - virtual void AddFacingEvent( hsBool enabled, pyKey* other, pyKey* self, hsScalar dot); + virtual void AddFacingEvent( hsBool enabled, pyKey* other, pyKey* self, float dot); virtual void AddContainerEvent( hsBool entering, pyKey* container, pyKey* contained); virtual void AddActivateEvent( hsBool active, hsBool activate ); - virtual void AddCallbackEvent( Int32 event ); - virtual void AddResponderState(Int32 state); + virtual void AddCallbackEvent( int32_t event ); + virtual void AddResponderState(int32_t state); virtual void Send(); diff --git a/Sources/Plasma/FeatureLib/pfPython/pyPlayer.cpp b/Sources/Plasma/FeatureLib/pfPython/pyPlayer.cpp index 84195fac..e12d329a 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyPlayer.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/pyPlayer.cpp @@ -51,7 +51,7 @@ pyPlayer::pyPlayer() // only used by python glue, do NOT call fIsServer = false; } -pyPlayer::pyPlayer(pyKey& avKey, const char* pname, UInt32 pid, hsScalar distsq) +pyPlayer::pyPlayer(pyKey& avKey, const char* pname, uint32_t pid, float distsq) { fAvatarKey = avKey.getKey(); fPlayerName = pname; @@ -61,7 +61,7 @@ pyPlayer::pyPlayer(pyKey& avKey, const char* pname, UInt32 pid, hsScalar distsq) fIsServer = false; } -pyPlayer::pyPlayer(plKey avKey, const char* pname, UInt32 pid, hsScalar distsq) +pyPlayer::pyPlayer(plKey avKey, const char* pname, uint32_t pid, float distsq) { fAvatarKey = avKey; fPlayerName = pname; @@ -72,7 +72,7 @@ pyPlayer::pyPlayer(plKey avKey, const char* pname, UInt32 pid, hsScalar distsq) } // another way to create a player with just a name and number -pyPlayer::pyPlayer(const char* pname, UInt32 pid) +pyPlayer::pyPlayer(const char* pname, uint32_t pid) { fAvatarKey = nil; fPlayerName = pname; @@ -82,7 +82,7 @@ pyPlayer::pyPlayer(const char* pname, UInt32 pid) fIsServer = false; } -void pyPlayer::Init(plKey avKey, const char* pname, UInt32 pid, hsScalar distsq) // used by python glue, do NOT call +void pyPlayer::Init(plKey avKey, const char* pname, uint32_t pid, float distsq) // used by python glue, do NOT call { fAvatarKey = avKey; fPlayerName = pname; diff --git a/Sources/Plasma/FeatureLib/pfPython/pyPlayer.h b/Sources/Plasma/FeatureLib/pfPython/pyPlayer.h index 55c11185..a90c716e 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyPlayer.h +++ b/Sources/Plasma/FeatureLib/pfPython/pyPlayer.h @@ -62,24 +62,24 @@ class pyPlayer protected: plKey fAvatarKey; std::string fPlayerName; - UInt32 fPlayerID; - hsScalar fDistSq; // from local player, temp + uint32_t fPlayerID; + float fDistSq; // from local player, temp hsBool fIsCCR; hsBool fIsServer; pyPlayer(); // only used by python glue, do NOT call - pyPlayer(pyKey& avKey, const char* pname, UInt32 pid, hsScalar distsq); - pyPlayer(plKey avKey, const char* pname, UInt32 pid, hsScalar distsq); + pyPlayer(pyKey& avKey, const char* pname, uint32_t pid, float distsq); + pyPlayer(plKey avKey, const char* pname, uint32_t pid, float distsq); // another way to create a player with just a name and number - pyPlayer(const char* pname, UInt32 pid); + pyPlayer(const char* pname, uint32_t pid); public: - void Init(plKey avKey, const char* pname, UInt32 pid, hsScalar distsq); // used by python glue, do NOT call + void Init(plKey avKey, const char* pname, uint32_t pid, float distsq); // used by python glue, do NOT call // required functions for PyObject interoperability PYTHON_CLASS_NEW_FRIEND(ptPlayer); - static PyObject *New(pyKey& avKey, const char* pname, UInt32 pid, hsScalar distsq); - static PyObject *New(plKey avKey, const char* pname, UInt32 pid, hsScalar distsq); - static PyObject *New(const char* pname, UInt32 pid); + static PyObject *New(pyKey& avKey, const char* pname, uint32_t pid, float distsq); + static PyObject *New(plKey avKey, const char* pname, uint32_t pid, float distsq); + static PyObject *New(const char* pname, uint32_t pid); PYTHON_CLASS_CHECK_DEFINITION; // returns true if the PyObject is a pyPlayer object PYTHON_CLASS_CONVERT_FROM_DEFINITION(pyPlayer); // converts a PyObject to a pyPlayer (throws error if not correct type) @@ -101,12 +101,12 @@ public: // for python access const char * GetPlayerName() const { return fPlayerName.c_str();} - UInt32 GetPlayerID() const + uint32_t GetPlayerID() const { return fPlayerID; } - hsScalar GetDistSq() const { return fDistSq; } + float GetDistSq() const { return fDistSq; } void SetCCRFlag(hsBool state); hsBool IsCCR(); diff --git a/Sources/Plasma/FeatureLib/pfPython/pyPlayerGlue.cpp b/Sources/Plasma/FeatureLib/pfPython/pyPlayerGlue.cpp index df238cb7..dced2f27 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyPlayerGlue.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/pyPlayerGlue.cpp @@ -52,12 +52,12 @@ PYTHON_DEFAULT_DEALLOC_DEFINITION(ptPlayer) PYTHON_INIT_DEFINITION(ptPlayer, args, keywords) { // we have two sets of arguments we can use, hence the generic PyObject* pointers - // argument set 1: pyKey, string, UInt32, hsScalar - // argument set 2: string, UInt32 + // argument set 1: pyKey, string, uint32_t, float + // argument set 2: string, uint32_t PyObject* firstObj = NULL; // can be a pyKey or a string - PyObject* secondObj = NULL; // can be a string or a UInt32 - PyObject* thirdObj = NULL; // UInt32 - PyObject* fourthObj = NULL; // hsScalar + PyObject* secondObj = NULL; // can be a string or a uint32_t + PyObject* thirdObj = NULL; // uint32_t + PyObject* fourthObj = NULL; // float if (!PyArg_ParseTuple(args, "OO|OO", &firstObj, &secondObj, &thirdObj, &fourthObj)) { PyErr_SetString(PyExc_TypeError, "__init__ expects one of two argument lists: (ptKey, string, unsigned long, float) or (string, unsigned long)"); @@ -193,21 +193,21 @@ PYTHON_END_METHODS_TABLE; PLASMA_CUSTOM_TYPE(ptPlayer, "Params: avkey,name,playerID,distanceSq\nAnd optionally __init__(name,playerID)"); // required functions for PyObject interoperability -PyObject *pyPlayer::New(pyKey& avKey, const char* pname, UInt32 pid, hsScalar distsq) +PyObject *pyPlayer::New(pyKey& avKey, const char* pname, uint32_t pid, float distsq) { ptPlayer *newObj = (ptPlayer*)ptPlayer_type.tp_new(&ptPlayer_type, NULL, NULL); newObj->fThis->Init(avKey.getKey(), pname, pid, distsq); return (PyObject*)newObj; } -PyObject *pyPlayer::New(plKey avKey, const char* pname, UInt32 pid, hsScalar distsq) +PyObject *pyPlayer::New(plKey avKey, const char* pname, uint32_t pid, float distsq) { ptPlayer *newObj = (ptPlayer*)ptPlayer_type.tp_new(&ptPlayer_type, NULL, NULL); newObj->fThis->Init(avKey, pname, pid, distsq); return (PyObject*)newObj; } -PyObject *pyPlayer::New(const char* pname, UInt32 pid) +PyObject *pyPlayer::New(const char* pname, uint32_t pid) { ptPlayer *newObj = (ptPlayer*)ptPlayer_type.tp_new(&ptPlayer_type, NULL, NULL); newObj->fThis->Init(nil, pname, pid, -1); diff --git a/Sources/Plasma/FeatureLib/pfPython/pySDL.cpp b/Sources/Plasma/FeatureLib/pfPython/pySDL.cpp index b681ef97..92bdc663 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pySDL.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/pySDL.cpp @@ -56,7 +56,7 @@ pySDLStateDataRecord::pySDLStateDataRecord( plStateDataRecord * rec ) } pySDLStateDataRecord::~pySDLStateDataRecord() { - DEL(fRec); + delete fRec; } plStateDataRecord * pySDLStateDataRecord::GetRec() const @@ -125,7 +125,7 @@ plSimpleStateVariable * pySimpleStateVariable::GetVar() const return fVar; } -bool pySimpleStateVariable::SetByte( byte v, int idx ) +bool pySimpleStateVariable::SetByte( uint8_t v, int idx ) { if ( !fVar ) return false; @@ -174,9 +174,9 @@ bool pySimpleStateVariable::SetBool( bool v, int idx ) return fVar->Set( v, idx ); } -byte pySimpleStateVariable::GetByte( int idx ) const +uint8_t pySimpleStateVariable::GetByte( int idx ) const { - byte v = 0; + uint8_t v = 0; if ( fVar ) fVar->Get( &v, idx ); return v; diff --git a/Sources/Plasma/FeatureLib/pfPython/pySDL.h b/Sources/Plasma/FeatureLib/pfPython/pySDL.h index 921efac3..17e1ec49 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pySDL.h +++ b/Sources/Plasma/FeatureLib/pfPython/pySDL.h @@ -48,7 +48,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // ////////////////////////////////////////////////////////////////////// -#include "hsTypes.h" +#include "HeadSpin.h" #include "hsStlUtils.h" #include @@ -98,7 +98,6 @@ public: void SetFromDefaults(bool timeStampNow); }; -typedef unsigned char byte; // pySimpleStateVariable class pySimpleStateVariable { @@ -123,14 +122,14 @@ public: plSimpleStateVariable * GetVar() const; ///////////////////// - bool SetByte( byte v, int idx=0 ); + bool SetByte( uint8_t v, int idx=0 ); bool SetShort( short v, int idx=0 ); bool SetFloat( float v, int idx=0 ); bool SetDouble( double v, int idx=0 ); bool SetInt( int v, int idx=0 ); bool SetString( const char * v, int idx=0 ); bool SetBool(bool v, int idx=0 ); - byte GetByte( int idx=0 ) const; + uint8_t GetByte( int idx=0 ) const; short GetShort( int idx=0 ) const; int GetInt( int idx=0 ) const; float GetFloat( int idx=0 ) const; diff --git a/Sources/Plasma/FeatureLib/pfPython/pySDLGlue.cpp b/Sources/Plasma/FeatureLib/pfPython/pySDLGlue.cpp index e09098aa..59d1eca9 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pySDLGlue.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/pySDLGlue.cpp @@ -197,7 +197,7 @@ PYTHON_METHOD_DEFINITION(ptSimpleStateVariable, funcName, args) \ return pythonReturnFunc(self->fThis->cFuncName(idx)); \ } -STATEVAR_SET(setByte, SetByte, byte, char, b) +STATEVAR_SET(setByte, SetByte, uint8_t, uint8_t, b) STATEVAR_SET(setShort, SetShort, short, short, h) STATEVAR_SET(setFloat, SetFloat, float, float, f) STATEVAR_SET(setDouble, SetDouble, double, double, d) diff --git a/Sources/Plasma/FeatureLib/pfPython/pySceneObject.cpp b/Sources/Plasma/FeatureLib/pfPython/pySceneObject.cpp index 7f3acac9..46d3e915 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pySceneObject.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/pySceneObject.cpp @@ -39,7 +39,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com Mead, WA 99021 *==LICENSE==*/ -#include "hsTypes.h" // TEMP, for STL warnings +#include "HeadSpin.h" // TEMP, for STL warnings #include "pySceneObject.h" #include "pnKeyedObject/plKey.h" @@ -632,7 +632,7 @@ void pySceneObject::PushCutsceneCamera(hsBool cut, pyKey& avKey) const plCameraModifier1* pCam = plCameraModifier1::ConvertNoRef(obj->GetModifier(i)); if (pCam) { - plCameraMsg* pMsg = TRACKED_NEW plCameraMsg; + plCameraMsg* pMsg = new plCameraMsg; pMsg->SetSender(pCam->GetKey()); pMsg->SetBCastFlag(plMessage::kBCastByType); // set command to do the transition @@ -666,7 +666,7 @@ void pySceneObject::PopCutsceneCamera(pyKey& avKey) const plCameraModifier1* pCam = plCameraModifier1::ConvertNoRef(obj->GetModifier(i)); if (pCam) { - plCameraMsg* pMsg = TRACKED_NEW plCameraMsg; + plCameraMsg* pMsg = new plCameraMsg; pMsg->SetSender(pCam->GetKey()); pMsg->SetBCastFlag(plMessage::kBCastByType); // set command to do the transition @@ -695,7 +695,7 @@ void pySceneObject::PushCamera(pyKey& avKey) { // create message - plCameraMsg* pMsg = TRACKED_NEW plCameraMsg; + plCameraMsg* pMsg = new plCameraMsg; pMsg->SetSender(pCam->GetKey()); pMsg->SetBCastFlag(plMessage::kBCastByType); @@ -724,7 +724,7 @@ void pySceneObject::PushCameraCut(pyKey& avKey) { // create message - plCameraMsg* pMsg = TRACKED_NEW plCameraMsg; + plCameraMsg* pMsg = new plCameraMsg; pMsg->SetSender(pCam->GetKey()); pMsg->SetBCastFlag(plMessage::kBCastByType); @@ -762,7 +762,7 @@ void pySceneObject::PopCamera(pyKey& avKey) { // create message - plCameraMsg* pMsg = TRACKED_NEW plCameraMsg; + plCameraMsg* pMsg = new plCameraMsg; pMsg->SetSender(pCam->GetKey()); pMsg->SetBCastFlag(plMessage::kBCastByType); @@ -832,7 +832,7 @@ void pySceneObject::Animate() plSceneObject* obj = plSceneObject::ConvertNoRef(fSceneObjects[0]->ObjectIsLoaded()); if ( obj ) { - plAnimCmdMsg* pMsg = TRACKED_NEW plAnimCmdMsg; + plAnimCmdMsg* pMsg = new plAnimCmdMsg; pMsg->AddReceiver(obj->GetKey()); pMsg->SetCmd(plAnimCmdMsg::kGoToBegin); pMsg->SetCmd(plAnimCmdMsg::kContinue); @@ -841,7 +841,7 @@ void pySceneObject::Animate() } } -Int8 pySceneObject::GetResponderState() +int8_t pySceneObject::GetResponderState() { plSceneObject* obj = plSceneObject::ConvertNoRef(fSceneObjects[0]->ObjectIsLoaded()); if ( obj ) @@ -861,7 +861,7 @@ void pySceneObject::RewindAnim(const char* animName) plSceneObject* obj = plSceneObject::ConvertNoRef(fSceneObjects[0]->ObjectIsLoaded()); if ( obj ) { - plAnimCmdMsg* pMsg = TRACKED_NEW plAnimCmdMsg; + plAnimCmdMsg* pMsg = new plAnimCmdMsg; pMsg->AddReceiver(obj->GetKey()); pMsg->SetAnimName(animName); pMsg->SetCmd(plAnimCmdMsg::kGoToBegin); @@ -875,7 +875,7 @@ void pySceneObject::PlayAnim(const char* animName) plSceneObject* obj = plSceneObject::ConvertNoRef(fSceneObjects[0]->ObjectIsLoaded()); if ( obj ) { - plAnimCmdMsg* pMsg = TRACKED_NEW plAnimCmdMsg; + plAnimCmdMsg* pMsg = new plAnimCmdMsg; pMsg->AddReceiver(obj->GetKey()); pMsg->SetAnimName(animName); pMsg->SetCmd(plAnimCmdMsg::kContinue); @@ -889,7 +889,7 @@ void pySceneObject::StopAnim(const char* animName) plSceneObject* obj = plSceneObject::ConvertNoRef(fSceneObjects[0]->ObjectIsLoaded()); if ( obj ) { - plAnimCmdMsg* pMsg = TRACKED_NEW plAnimCmdMsg; + plAnimCmdMsg* pMsg = new plAnimCmdMsg; pMsg->AddReceiver(obj->GetKey()); pMsg->SetAnimName(animName); pMsg->SetCmd(plAnimCmdMsg::kStop); @@ -906,13 +906,13 @@ void pySceneObject::RunResponder(int state) const plModifier* pMod = obj->GetModifierByType(plResponderModifier::Index()); if (pMod) { - plNotifyMsg* pMsg = TRACKED_NEW plNotifyMsg; + plNotifyMsg* pMsg = new plNotifyMsg; pMsg->fType = plNotifyMsg::kResponderChangeState; pMsg->AddResponderStateEvent(state); pMsg->AddReceiver(pMod->GetKey()); pMsg->Send(); - plNotifyMsg* pMsg0 = TRACKED_NEW plNotifyMsg; + plNotifyMsg* pMsg0 = new plNotifyMsg; pMsg0->fState = true; pMsg0->AddReceiver(pMod->GetKey()); pMsg0->Send(); @@ -929,7 +929,7 @@ void pySceneObject::FFResponder(int state) const plModifier* pMod = obj->GetModifierByType(plResponderModifier::Index()); if (pMod) { - plNotifyMsg* pMsg = TRACKED_NEW plNotifyMsg; + plNotifyMsg* pMsg = new plNotifyMsg; pMsg->fType = plNotifyMsg::kResponderFF; pMsg->AddResponderStateEvent(state); pMsg->AddReceiver(pMod->GetKey()); diff --git a/Sources/Plasma/FeatureLib/pfPython/pySceneObject.h b/Sources/Plasma/FeatureLib/pfPython/pySceneObject.h index 8bbe0760..be6d4f63 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pySceneObject.h +++ b/Sources/Plasma/FeatureLib/pfPython/pySceneObject.h @@ -184,7 +184,7 @@ public: void Animate(); // return responder state (if responder modifier found) - Int8 GetResponderState(); + int8_t GetResponderState(); // some animation commands for s.o.'s w/ multiple animations attached diff --git a/Sources/Plasma/FeatureLib/pfPython/pyScoreMgr.h b/Sources/Plasma/FeatureLib/pfPython/pyScoreMgr.h index 17597deb..970a24c4 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyScoreMgr.h +++ b/Sources/Plasma/FeatureLib/pfPython/pyScoreMgr.h @@ -49,7 +49,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // PURPOSE: a wrapper class to provide an interface to the scoring system // -#include "hsTypes.h" +#include "HeadSpin.h" #include "hsStlUtils.h" #include diff --git a/Sources/Plasma/FeatureLib/pfPython/pySpawnPointInfo.cpp b/Sources/Plasma/FeatureLib/pfPython/pySpawnPointInfo.cpp index 9017fd68..3ad5e405 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pySpawnPointInfo.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/pySpawnPointInfo.cpp @@ -39,7 +39,6 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com Mead, WA 99021 *==LICENSE==*/ -#include "hsConfig.h" #include "pySpawnPointInfo.h" diff --git a/Sources/Plasma/FeatureLib/pfPython/pySpawnPointInfo.h b/Sources/Plasma/FeatureLib/pfPython/pySpawnPointInfo.h index 9e43ae2d..c12e9d70 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pySpawnPointInfo.h +++ b/Sources/Plasma/FeatureLib/pfPython/pySpawnPointInfo.h @@ -42,7 +42,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #ifndef pySpawnPointInfo_h_inc #define pySpawnPointInfo_h_inc -#include "hsTypes.h" +#include "HeadSpin.h" #include "hsStlUtils.h" #include "plNetCommon/plSpawnPointInfo.h" diff --git a/Sources/Plasma/FeatureLib/pfPython/pyStatusLog.cpp b/Sources/Plasma/FeatureLib/pfPython/pyStatusLog.cpp index ffea88d8..502c64a2 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyStatusLog.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/pyStatusLog.cpp @@ -62,14 +62,14 @@ pyStatusLog::~pyStatusLog() } -hsBool pyStatusLog::Open(const char* logName, UInt32 numLines, UInt32 flags) +hsBool pyStatusLog::Open(const char* logName, uint32_t numLines, uint32_t flags) { // make sure its closed first Close(); // create a status log guy for this fICreatedLog = true; - fLog = plStatusLogMgr::GetInstance().CreateStatusLog( (UInt8)numLines, logName, flags ); + fLog = plStatusLogMgr::GetInstance().CreateStatusLog( (uint8_t)numLines, logName, flags ); if (fLog) { fLog->SetForceLog(true); @@ -93,10 +93,10 @@ hsBool pyStatusLog::WriteColor(const char* text, pyColor& color) { if (fLog) { - UInt32 st_color = ((UInt32)(color.getAlpha()*255)<<24) + - ((UInt32)(color.getRed()*255)<<16) + - ((UInt32)(color.getGreen()*255)<<8) + - ((UInt32)(color.getBlue()*255)); + uint32_t st_color = ((uint32_t)(color.getAlpha()*255)<<24) + + ((uint32_t)(color.getRed()*255)<<16) + + ((uint32_t)(color.getGreen()*255)<<8) + + ((uint32_t)(color.getBlue()*255)); fLog->AddLine( text, st_color ); return true; } diff --git a/Sources/Plasma/FeatureLib/pfPython/pyStatusLog.h b/Sources/Plasma/FeatureLib/pfPython/pyStatusLog.h index 4bb23b35..60b59c4e 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyStatusLog.h +++ b/Sources/Plasma/FeatureLib/pfPython/pyStatusLog.h @@ -49,7 +49,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // and interface to the ChatLog (ptChatStatusLog) ////////////////////////////////////////////////////////////////////// -#include "hsTypes.h" +#include "HeadSpin.h" #include #include "pyGlueHelpers.h" @@ -80,7 +80,7 @@ public: static void AddPlasmaClasses(PyObject *m); static void AddPlasmaConstantsClasses(PyObject *m); - virtual hsBool Open(const char* logName, UInt32 numLines, UInt32 flags); + virtual hsBool Open(const char* logName, uint32_t numLines, uint32_t flags); virtual hsBool Write(const char* text); virtual hsBool WriteColor(const char* text, pyColor& color); virtual void Close(); diff --git a/Sources/Plasma/FeatureLib/pfPython/pyStream.cpp b/Sources/Plasma/FeatureLib/pfPython/pyStream.cpp index d5058084..55b11a84 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyStream.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/pyStream.cpp @@ -60,7 +60,7 @@ pyStream::~pyStream() } -hsBool pyStream::Open(const wchar* fileName, const wchar* flags) +hsBool pyStream::Open(const wchar_t* fileName, const wchar_t* flags) { // make sure its closed first Close(); @@ -88,7 +88,7 @@ hsBool pyStream::Open(const wchar* fileName, const wchar* flags) // force encryption? if (encryptflag) { - fStream = TRACKED_NEW plEncryptedStream; + fStream = new plEncryptedStream; fStream->Open(fileName, L"wb"); } else diff --git a/Sources/Plasma/FeatureLib/pfPython/pyStream.h b/Sources/Plasma/FeatureLib/pfPython/pyStream.h index d8a910d8..7da64f6d 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyStream.h +++ b/Sources/Plasma/FeatureLib/pfPython/pyStream.h @@ -48,7 +48,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // ////////////////////////////////////////////////////////////////////// -#include "hsTypes.h" +#include "HeadSpin.h" #include "hsStlUtils.h" #include @@ -76,7 +76,7 @@ public: static void AddPlasmaClasses(PyObject *m); - virtual hsBool Open(const wchar* fileName, const wchar* flags); + virtual hsBool Open(const wchar_t* fileName, const wchar_t* flags); virtual std::vector ReadLines(); virtual hsBool WriteLines(const std::vector & lines); virtual void Close(); diff --git a/Sources/Plasma/FeatureLib/pfPython/pyStreamGlue.cpp b/Sources/Plasma/FeatureLib/pfPython/pyStreamGlue.cpp index 0e3a7945..c46e1e05 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyStreamGlue.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/pyStreamGlue.cpp @@ -68,7 +68,7 @@ PYTHON_METHOD_DEFINITION(ptStream, open, args) if (PyUnicode_Check(filenameObj)) { int strLen = PyUnicode_GetSize(filenameObj); - wchar_t* text = TRACKED_NEW wchar_t[strLen + 1]; + wchar_t* text = new wchar_t[strLen + 1]; PyUnicode_AsWideChar((PyUnicodeObject*)filenameObj, text, strLen); text[strLen] = L'\0'; filename = text; @@ -92,7 +92,7 @@ PYTHON_METHOD_DEFINITION(ptStream, open, args) if (PyUnicode_Check(flagsObj)) { int strLen = PyUnicode_GetSize(flagsObj); - wchar_t* text = TRACKED_NEW wchar_t[strLen + 1]; + wchar_t* text = new wchar_t[strLen + 1]; PyUnicode_AsWideChar((PyUnicodeObject*)flagsObj, text, strLen); text[strLen] = L'\0'; flags = text; diff --git a/Sources/Plasma/FeatureLib/pfPython/pySwimCurrentInterface.cpp b/Sources/Plasma/FeatureLib/pfPython/pySwimCurrentInterface.cpp index 9f85c8a9..a522697b 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pySwimCurrentInterface.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/pySwimCurrentInterface.cpp @@ -52,7 +52,7 @@ pySwimCurrentInterface::pySwimCurrentInterface(pyKey& key) fSwimCurrentKey = key.getKey(); } -hsScalar pySwimCurrentInterface::getNearDist() +float pySwimCurrentInterface::getNearDist() { hsKeyedObject* obj = fSwimCurrentKey->ObjectIsLoaded(); @@ -70,7 +70,7 @@ hsScalar pySwimCurrentInterface::getNearDist() } } -void pySwimCurrentInterface::setNearDist(hsScalar val) +void pySwimCurrentInterface::setNearDist(float val) { hsKeyedObject* obj = fSwimCurrentKey->ObjectIsLoaded(); @@ -84,7 +84,7 @@ void pySwimCurrentInterface::setNearDist(hsScalar val) } } -hsScalar pySwimCurrentInterface::getFarDist() +float pySwimCurrentInterface::getFarDist() { hsKeyedObject* obj = fSwimCurrentKey->ObjectIsLoaded(); @@ -102,7 +102,7 @@ hsScalar pySwimCurrentInterface::getFarDist() } } -void pySwimCurrentInterface::setFarDist(hsScalar val) +void pySwimCurrentInterface::setFarDist(float val) { hsKeyedObject* obj = fSwimCurrentKey->ObjectIsLoaded(); @@ -116,7 +116,7 @@ void pySwimCurrentInterface::setFarDist(hsScalar val) } } -hsScalar pySwimCurrentInterface::getNearVel() +float pySwimCurrentInterface::getNearVel() { hsKeyedObject* obj = fSwimCurrentKey->ObjectIsLoaded(); @@ -134,7 +134,7 @@ hsScalar pySwimCurrentInterface::getNearVel() } } -void pySwimCurrentInterface::setNearVel(hsScalar val) +void pySwimCurrentInterface::setNearVel(float val) { hsKeyedObject* obj = fSwimCurrentKey->ObjectIsLoaded(); @@ -148,7 +148,7 @@ void pySwimCurrentInterface::setNearVel(hsScalar val) } } -hsScalar pySwimCurrentInterface::getFarVel() +float pySwimCurrentInterface::getFarVel() { hsKeyedObject* obj = fSwimCurrentKey->ObjectIsLoaded(); @@ -166,7 +166,7 @@ hsScalar pySwimCurrentInterface::getFarVel() } } -void pySwimCurrentInterface::setFarVel(hsScalar val) +void pySwimCurrentInterface::setFarVel(float val) { hsKeyedObject* obj = fSwimCurrentKey->ObjectIsLoaded(); @@ -180,7 +180,7 @@ void pySwimCurrentInterface::setFarVel(hsScalar val) } } -hsScalar pySwimCurrentInterface::getRotation() +float pySwimCurrentInterface::getRotation() { hsKeyedObject* obj = fSwimCurrentKey->ObjectIsLoaded(); @@ -194,7 +194,7 @@ hsScalar pySwimCurrentInterface::getRotation() } } -void pySwimCurrentInterface::setRotation(hsScalar val) +void pySwimCurrentInterface::setRotation(float val) { hsKeyedObject* obj = fSwimCurrentKey->ObjectIsLoaded(); diff --git a/Sources/Plasma/FeatureLib/pfPython/pySwimCurrentInterface.h b/Sources/Plasma/FeatureLib/pfPython/pySwimCurrentInterface.h index 70fe7564..385ca669 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pySwimCurrentInterface.h +++ b/Sources/Plasma/FeatureLib/pfPython/pySwimCurrentInterface.h @@ -69,20 +69,20 @@ public: void setKey(pyKey& key) {fSwimCurrentKey = key.getKey();} // for python glue only, do NOT call - hsScalar getNearDist(); - void setNearDist(hsScalar val); + float getNearDist(); + void setNearDist(float val); - hsScalar getFarDist(); - void setFarDist(hsScalar val); + float getFarDist(); + void setFarDist(float val); - hsScalar getNearVel(); - void setNearVel(hsScalar val); + float getNearVel(); + void setNearVel(float val); - hsScalar getFarVel(); - void setFarVel(hsScalar val); + float getFarVel(); + void setFarVel(float val); - hsScalar getRotation(); - void setRotation(hsScalar val); + float getRotation(); + void setRotation(float val); void enable(); void disable(); diff --git a/Sources/Plasma/FeatureLib/pfPython/pyVault.cpp b/Sources/Plasma/FeatureLib/pfPython/pyVault.cpp index 85ac40c1..c944e2d9 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyVault.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/pyVault.cpp @@ -201,9 +201,9 @@ PyObject* pyVault::GetAgeJournalsFolder( void ) // ...such as how many pictures, notes and markers they have PyObject* pyVault::GetKIUsage(void) { - UInt32 pictures = 0; - UInt32 notes = 0; - UInt32 markerGames = 0; + uint32_t pictures = 0; + uint32_t notes = 0; + uint32_t markerGames = 0; for (;;) { RelVaultNode * rvnPlr = VaultGetPlayerNodeIncRef(); @@ -346,7 +346,7 @@ PyObject* pyVault::GetVisitAgeLink( const pyAgeInfoStruct & info) // Chronicle PyObject* pyVault::FindChronicleEntry( const char * entryName ) { - wchar wEntryName[kMaxVaultNodeStringLength]; + wchar_t wEntryName[kMaxVaultNodeStringLength]; StrToUnicode(wEntryName, entryName, arrsize(wEntryName)); if (RelVaultNode * rvn = VaultFindChronicleEntryIncRef(wEntryName)) { @@ -359,18 +359,18 @@ PyObject* pyVault::FindChronicleEntry( const char * entryName ) PYTHON_RETURN_NONE; } -void pyVault::AddChronicleEntry( const char * name, UInt32 type, const char * value ) +void pyVault::AddChronicleEntry( const char * name, uint32_t type, const char * value ) { - wchar * wEntryName = StrDupToUnicode(name); - wchar * wEntryValue = StrDupToUnicode(value); + wchar_t * wEntryName = StrDupToUnicode(name); + wchar_t * wEntryValue = StrDupToUnicode(value); // FIXME: We should ideally not block, but for now, the Python assumes that when // we return, the chronicle exists and can be found with findChronicleEntry. // Maybe we should insert a dummy into the tree? (currently hard) VaultAddChronicleEntryAndWait(wEntryName, type, wEntryValue); - FREE(wEntryName); - FREE(wEntryValue); + free(wEntryName); + free(wEntryValue); } @@ -379,7 +379,7 @@ void pyVault::SendToDevice( pyVaultNode& node, const char * deviceName ) if (!node.GetNode()) return; - wchar wDevName[256]; + wchar_t wDevName[256]; StrToUnicode(wDevName, deviceName, arrsize(wDevName)); // Note: This actually blocks (~Hoikas) @@ -437,7 +437,7 @@ PyObject* pyVault::GetPsnlAgeSDL() const templateNode->fieldFlags = 0; templateNode->SetNodeType(plVault::kNodeType_AgeInfo); VaultAgeInfoNode ageInfo(templateNode); - wchar str[MAX_PATH]; + wchar_t str[MAX_PATH]; StrToUnicode(str, kPersonalAgeFilename, arrsize(str)); ageInfo.SetAgeFilename(str); @@ -452,7 +452,7 @@ PyObject* pyVault::GetPsnlAgeSDL() const if (sdl.GetStateDataRecord(rec, plSDL::kKeepDirty)) result = pySDLStateDataRecord::New(rec); else - DEL(rec); + delete rec; rvnSdl->DecRef(); } rvnInfo->DecRef(); @@ -482,7 +482,7 @@ void pyVault::UpdatePsnlAgeSDL( pySDLStateDataRecord & pyrec ) templateNode->fieldFlags = 0; templateNode->SetNodeType(plVault::kNodeType_AgeInfo); VaultAgeInfoNode ageInfo(templateNode); - wchar str[MAX_PATH]; + wchar_t str[MAX_PATH]; StrToUnicode(str, kPersonalAgeFilename, arrsize(str)); ageInfo.SetAgeFilename(str); @@ -544,8 +544,8 @@ bool pyVault::AmAgeCzar( const pyAgeInfoStruct * ageInfo ) void pyVault::RegisterMTStation( const char * stationName, const char * backLinkSpawnPtObjName ) { - wchar wStationName[256]; - wchar wSpawnPt[256]; + wchar_t wStationName[256]; + wchar_t wSpawnPt[256]; StrToUnicode(wStationName, stationName, arrsize(wStationName)); StrToUnicode(wSpawnPt, backLinkSpawnPtObjName, arrsize(wSpawnPt)); @@ -583,10 +583,10 @@ void pyVault::UnRegisterVisitAge( const char * guidstr ) void _InvitePlayerToAge(ENetError result, void* state, void* param, RelVaultNode* node) { if (result == kNetSuccess) - VaultSendNode(node, (UInt32)param); + VaultSendNode(node, (uint32_t)param); } -void pyVault::InvitePlayerToAge( const pyAgeLinkStruct & link, UInt32 playerID ) +void pyVault::InvitePlayerToAge( const pyAgeLinkStruct & link, uint32_t playerID ) { NetVaultNode * templateNode = NEWZERO(NetVaultNode); templateNode->IncRef(); @@ -602,10 +602,10 @@ void pyVault::InvitePlayerToAge( const pyAgeLinkStruct & link, UInt32 playerID ) void _UninvitePlayerToAge(ENetError result, void* state, void* param, RelVaultNode* node) { if (result == kNetSuccess) - VaultSendNode(node, (UInt32)param); + VaultSendNode(node, (uint32_t)param); } -void pyVault::UnInvitePlayerToAge( const char * str, UInt32 playerID ) +void pyVault::UnInvitePlayerToAge( const char * str, uint32_t playerID ) { plAgeInfoStruct info; info.SetAgeInstanceGuid(&plUUID(str)); @@ -631,7 +631,7 @@ void pyVault::UnInvitePlayerToAge( const char * str, UInt32 playerID ) } //============================================================================ -void pyVault::OfferLinkToPlayer( const pyAgeLinkStruct & link, UInt32 playerID ) +void pyVault::OfferLinkToPlayer( const pyAgeLinkStruct & link, uint32_t playerID ) { hsAssert(false, "eric, port me"); } diff --git a/Sources/Plasma/FeatureLib/pfPython/pyVault.h b/Sources/Plasma/FeatureLib/pfPython/pyVault.h index d5ea10c9..ec67026d 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyVault.h +++ b/Sources/Plasma/FeatureLib/pfPython/pyVault.h @@ -48,7 +48,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // ////////////////////////////////////////////////////////////////////// -#include "hsTypes.h" +#include "HeadSpin.h" #include #include "pyGlueHelpers.h" @@ -130,7 +130,7 @@ public: /////////////// // Chronicle PyObject* FindChronicleEntry( const char * entryName ); // returns pyVaultChronicleNode - void AddChronicleEntry( const char * name, UInt32 type, const char * value ); + void AddChronicleEntry( const char * name, uint32_t type, const char * value ); /////////////// // publishing void SendToDevice( pyVaultNode& node, const char * deviceName ); @@ -165,10 +165,10 @@ public: /////////////// // Invite player to visit an age. - void InvitePlayerToAge( const pyAgeLinkStruct & link, UInt32 playerID ); - void UnInvitePlayerToAge( const char * guid, UInt32 playerID ); + void InvitePlayerToAge( const pyAgeLinkStruct & link, uint32_t playerID ); + void UnInvitePlayerToAge( const char * guid, uint32_t playerID ); // Offer link to player - void OfferLinkToPlayer( const pyAgeLinkStruct & link, UInt32 playerID ); + void OfferLinkToPlayer( const pyAgeLinkStruct & link, uint32_t playerID ); /////////////// // Creates neighborhood and joins the player to it as the mayor/czar. diff --git a/Sources/Plasma/FeatureLib/pfPython/pyVaultAgeInfoListNode.cpp b/Sources/Plasma/FeatureLib/pfPython/pyVaultAgeInfoListNode.cpp index 2d998b65..d9988efb 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyVaultAgeInfoListNode.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/pyVaultAgeInfoListNode.cpp @@ -67,7 +67,7 @@ pyVaultAgeInfoListNode::pyVaultAgeInfoListNode(int n) //================================================================== // class RelVaultNode : public plVaultFolderNode // -hsBool pyVaultAgeInfoListNode::HasAge(UInt32 ageID) +hsBool pyVaultAgeInfoListNode::HasAge(uint32_t ageID) { if (!fNode) return false; @@ -76,7 +76,7 @@ hsBool pyVaultAgeInfoListNode::HasAge(UInt32 ageID) return false; } -hsBool pyVaultAgeInfoListNode::AddAge( UInt32 ageID ) +hsBool pyVaultAgeInfoListNode::AddAge( uint32_t ageID ) { if (!fNode) return false; @@ -85,7 +85,7 @@ hsBool pyVaultAgeInfoListNode::AddAge( UInt32 ageID ) return false; } -void pyVaultAgeInfoListNode::RemoveAge( UInt32 ageID ) +void pyVaultAgeInfoListNode::RemoveAge( uint32_t ageID ) { if (!fNode) return; diff --git a/Sources/Plasma/FeatureLib/pfPython/pyVaultAgeInfoListNode.h b/Sources/Plasma/FeatureLib/pfPython/pyVaultAgeInfoListNode.h index 3f1f1549..231a96c9 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyVaultAgeInfoListNode.h +++ b/Sources/Plasma/FeatureLib/pfPython/pyVaultAgeInfoListNode.h @@ -48,7 +48,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // ////////////////////////////////////////////////////////////////////// -#include "hsTypes.h" +#include "HeadSpin.h" #include "hsStlUtils.h" #include @@ -81,9 +81,9 @@ public: //================================================================== // class RelVaultNode : public plVaultFolderNode // - hsBool HasAge( UInt32 ageID ); - hsBool AddAge( UInt32 ageID ); - void RemoveAge( UInt32 ageID ); + hsBool HasAge( uint32_t ageID ); + hsBool AddAge( uint32_t ageID ); + void RemoveAge( uint32_t ageID ); }; #endif // _pyVaultAgeInfoListNode_h_ diff --git a/Sources/Plasma/FeatureLib/pfPython/pyVaultAgeInfoNode.cpp b/Sources/Plasma/FeatureLib/pfPython/pyVaultAgeInfoNode.cpp index 700990b3..11e6f81c 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyVaultAgeInfoNode.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/pyVaultAgeInfoNode.cpp @@ -257,7 +257,7 @@ void pyVaultAgeInfoNode::SetAgeDescription( const char * v ) { } -Int32 pyVaultAgeInfoNode::GetSequenceNumber() const +int32_t pyVaultAgeInfoNode::GetSequenceNumber() const { if (!fNode) return -1; @@ -266,11 +266,11 @@ Int32 pyVaultAgeInfoNode::GetSequenceNumber() const return access.ageSequenceNumber; } -void pyVaultAgeInfoNode::SetSequenceNumber( Int32 v ) +void pyVaultAgeInfoNode::SetSequenceNumber( int32_t v ) { } -Int32 pyVaultAgeInfoNode::GetAgeLanguage() const +int32_t pyVaultAgeInfoNode::GetAgeLanguage() const { if (!fNode) return -1; @@ -279,20 +279,20 @@ Int32 pyVaultAgeInfoNode::GetAgeLanguage() const return access.ageLanguage; } -void pyVaultAgeInfoNode::SetAgeLanguage( Int32 v ) +void pyVaultAgeInfoNode::SetAgeLanguage( int32_t v ) { } -UInt32 pyVaultAgeInfoNode::GetAgeID() const +uint32_t pyVaultAgeInfoNode::GetAgeID() const { return 0; } -void pyVaultAgeInfoNode::SetAgeID( UInt32 v ) +void pyVaultAgeInfoNode::SetAgeID( uint32_t v ) { } -UInt32 pyVaultAgeInfoNode::GetCzarID() const +uint32_t pyVaultAgeInfoNode::GetCzarID() const { hsAssert(false, "eric, port me"); return 0; diff --git a/Sources/Plasma/FeatureLib/pfPython/pyVaultAgeInfoNode.h b/Sources/Plasma/FeatureLib/pfPython/pyVaultAgeInfoNode.h index bac8a0e0..0e01f9ac 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyVaultAgeInfoNode.h +++ b/Sources/Plasma/FeatureLib/pfPython/pyVaultAgeInfoNode.h @@ -48,7 +48,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // ////////////////////////////////////////////////////////////////////// -#include "hsTypes.h" +#include "HeadSpin.h" #include "hsStlUtils.h" #include @@ -114,16 +114,16 @@ public: const char * GetAgeDescription() const; void SetAgeDescription( const char * v ); - Int32 GetSequenceNumber() const; - void SetSequenceNumber( Int32 v ); + int32_t GetSequenceNumber() const; + void SetSequenceNumber( int32_t v ); - Int32 GetAgeLanguage() const; - void SetAgeLanguage( Int32 v ); + int32_t GetAgeLanguage() const; + void SetAgeLanguage( int32_t v ); - UInt32 GetAgeID() const; - void SetAgeID( UInt32 v ); + uint32_t GetAgeID() const; + void SetAgeID( uint32_t v ); - UInt32 GetCzarID() const; + uint32_t GetCzarID() const; bool IsPublic() const; diff --git a/Sources/Plasma/FeatureLib/pfPython/pyVaultAgeLinkNode.h b/Sources/Plasma/FeatureLib/pfPython/pyVaultAgeLinkNode.h index 2b83fd94..db713571 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyVaultAgeLinkNode.h +++ b/Sources/Plasma/FeatureLib/pfPython/pyVaultAgeLinkNode.h @@ -48,7 +48,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // ////////////////////////////////////////////////////////////////////// -#include "hsTypes.h" +#include "HeadSpin.h" #include "hsStlUtils.h" #include diff --git a/Sources/Plasma/FeatureLib/pfPython/pyVaultChronicleNode.cpp b/Sources/Plasma/FeatureLib/pfPython/pyVaultChronicleNode.cpp index 4fa43361..48c45c34 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyVaultChronicleNode.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/pyVaultChronicleNode.cpp @@ -70,8 +70,8 @@ pyVaultChronicleNode::pyVaultChronicleNode(int n) } pyVaultChronicleNode::~pyVaultChronicleNode () { - FREE(ansiName); - FREE(ansiValue); + free(ansiName); + free(ansiValue); } @@ -83,10 +83,10 @@ void pyVaultChronicleNode::Chronicle_SetName( const char * text ) if (!fNode) return; - wchar * wStr = StrDupToUnicode(text); + wchar_t * wStr = StrDupToUnicode(text); VaultChronicleNode chron(fNode); chron.SetEntryName(wStr); - FREE(wStr); + free(wStr); } const char * pyVaultChronicleNode::Chronicle_GetName( void ) @@ -94,7 +94,7 @@ const char * pyVaultChronicleNode::Chronicle_GetName( void ) if (!fNode) return ""; - FREE(ansiName); + free(ansiName); VaultChronicleNode chron(fNode); ansiName = StrDupToAnsi(chron.entryName); @@ -106,10 +106,10 @@ void pyVaultChronicleNode::Chronicle_SetValue( const char * text ) if (!fNode) return; - wchar * wStr = StrDupToUnicode(text); + wchar_t * wStr = StrDupToUnicode(text); VaultChronicleNode chron(fNode); chron.SetEntryValue(wStr); - FREE(wStr); + free(wStr); } const char * pyVaultChronicleNode::Chronicle_GetValue( void ) @@ -117,7 +117,7 @@ const char * pyVaultChronicleNode::Chronicle_GetValue( void ) if (!fNode) return ""; - FREE(ansiValue); + free(ansiValue); ansiValue = nil; VaultChronicleNode chron(fNode); @@ -129,7 +129,7 @@ const char * pyVaultChronicleNode::Chronicle_GetValue( void ) return ansiValue; } -void pyVaultChronicleNode::Chronicle_SetType( UInt32 type ) +void pyVaultChronicleNode::Chronicle_SetType( uint32_t type ) { if (!fNode) return; @@ -138,7 +138,7 @@ void pyVaultChronicleNode::Chronicle_SetType( UInt32 type ) chron.SetEntryType(type); } -UInt32 pyVaultChronicleNode::Chronicle_GetType( void ) +uint32_t pyVaultChronicleNode::Chronicle_GetType( void ) { if (!fNode) return 0; diff --git a/Sources/Plasma/FeatureLib/pfPython/pyVaultChronicleNode.h b/Sources/Plasma/FeatureLib/pfPython/pyVaultChronicleNode.h index dbb3d45f..e1b262a4 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyVaultChronicleNode.h +++ b/Sources/Plasma/FeatureLib/pfPython/pyVaultChronicleNode.h @@ -48,7 +48,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // ////////////////////////////////////////////////////////////////////// -#include "hsTypes.h" +#include "HeadSpin.h" #include "hsStlUtils.h" #include @@ -90,8 +90,8 @@ public: const char * Chronicle_GetName( void ); void Chronicle_SetValue( const char * text ); const char * Chronicle_GetValue( void ); - void Chronicle_SetType( UInt32 type ); - UInt32 Chronicle_GetType( void ); + void Chronicle_SetType( uint32_t type ); + uint32_t Chronicle_GetType( void ); }; #endif // _pyVaultChronicleNode_h_ diff --git a/Sources/Plasma/FeatureLib/pfPython/pyVaultFolderNode.cpp b/Sources/Plasma/FeatureLib/pfPython/pyVaultFolderNode.cpp index c831f8c5..a7381fac 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyVaultFolderNode.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/pyVaultFolderNode.cpp @@ -47,7 +47,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "pyVaultFolderNode.h" -#include "hsUtils.h" + #include "plVault/plVault.h" // should only be created from C++ side diff --git a/Sources/Plasma/FeatureLib/pfPython/pyVaultFolderNode.h b/Sources/Plasma/FeatureLib/pfPython/pyVaultFolderNode.h index d0851596..50d123d2 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyVaultFolderNode.h +++ b/Sources/Plasma/FeatureLib/pfPython/pyVaultFolderNode.h @@ -48,7 +48,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // ////////////////////////////////////////////////////////////////////// -#include "hsTypes.h" +#include "HeadSpin.h" #include "hsStlUtils.h" #include diff --git a/Sources/Plasma/FeatureLib/pfPython/pyVaultFolderNodeGlue.cpp b/Sources/Plasma/FeatureLib/pfPython/pyVaultFolderNodeGlue.cpp index ee72795b..48dfffa4 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyVaultFolderNodeGlue.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/pyVaultFolderNodeGlue.cpp @@ -136,7 +136,7 @@ PYTHON_METHOD_DEFINITION(ptVaultFolderNode, setFolderNameW, args) if (PyUnicode_Check(textObj)) { int strLen = PyUnicode_GetSize(textObj); - wchar_t* name = TRACKED_NEW wchar_t[strLen + 1]; + wchar_t* name = new wchar_t[strLen + 1]; PyUnicode_AsWideChar((PyUnicodeObject*)textObj, name, strLen); name[strLen] = L'\0'; self->fThis->Folder_SetNameW(name); diff --git a/Sources/Plasma/FeatureLib/pfPython/pyVaultImageNode.cpp b/Sources/Plasma/FeatureLib/pfPython/pyVaultImageNode.cpp index 44a5cb44..ed3f947d 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyVaultImageNode.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/pyVaultImageNode.cpp @@ -70,7 +70,7 @@ static plKey CreateAndRefImageKey (unsigned nodeId, plMipmap * mipmap) { hsgResMgr::ResMgr()->AddViaNotify( key, - NEW(plGenRefMsg)( + new plGenRefMsg( plNetClientMgr::GetInstance()->GetKey(), plRefMsg::kOnCreate, 0, @@ -113,7 +113,7 @@ void pyVaultImageNode::Image_SetTitle( const char * text ) if (!fNode) return; - wchar * wStr = hsStringToWString(text); + wchar_t * wStr = hsStringToWString(text); VaultImageNode image(fNode); image.SetImageTitle(wStr); @@ -209,7 +209,7 @@ void pyVaultImageNode::SetImageFromBuf( PyObject * pybuf ) fMipmap = nil; } - byte * buffer = nil; + uint8_t * buffer = nil; int bytes; PyObject_AsReadBuffer(pybuf, (const void **)&buffer, &bytes); if (buffer) { @@ -232,7 +232,7 @@ void pyVaultImageNode::SetImageFromScrShot() if (cyMisc::GetPipeline()) { VaultImageNode access(fNode); - fMipmap = NEW(plMipmap); + fMipmap = new plMipmap(); if (cyMisc::GetPipeline()->CaptureScreen(fMipmap, false, 800, 600)) { fMipmapKey = fMipmap->GetKey(); if (!fMipmapKey) @@ -244,7 +244,7 @@ void pyVaultImageNode::SetImageFromScrShot() else { access.SetImageData(nil, 0); access.SetImageType(VaultImageNode::kNone); - DEL(fMipmap); + delete fMipmap; fMipmap = nil; } } diff --git a/Sources/Plasma/FeatureLib/pfPython/pyVaultImageNode.h b/Sources/Plasma/FeatureLib/pfPython/pyVaultImageNode.h index 8755f667..8e13f539 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyVaultImageNode.h +++ b/Sources/Plasma/FeatureLib/pfPython/pyVaultImageNode.h @@ -48,7 +48,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // ////////////////////////////////////////////////////////////////////// -#include "hsTypes.h" +#include "HeadSpin.h" #include "hsStlUtils.h" #include diff --git a/Sources/Plasma/FeatureLib/pfPython/pyVaultImageNodeGlue.cpp b/Sources/Plasma/FeatureLib/pfPython/pyVaultImageNodeGlue.cpp index 58b53376..758a53d4 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyVaultImageNodeGlue.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/pyVaultImageNodeGlue.cpp @@ -126,7 +126,7 @@ PYTHON_METHOD_DEFINITION(ptVaultImageNode, setTitleW, args) if (PyUnicode_Check(textObj)) { int strLen = PyUnicode_GetSize(textObj); - wchar_t* title = TRACKED_NEW wchar_t[strLen + 1]; + wchar_t* title = new wchar_t[strLen + 1]; PyUnicode_AsWideChar((PyUnicodeObject*)textObj, title, strLen); title[strLen] = L'\0'; self->fThis->Image_SetTitleW(title); diff --git a/Sources/Plasma/FeatureLib/pfPython/pyVaultMarkerGameNode.cpp b/Sources/Plasma/FeatureLib/pfPython/pyVaultMarkerGameNode.cpp index ade34106..b2f60bcb 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyVaultMarkerGameNode.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/pyVaultMarkerGameNode.cpp @@ -83,7 +83,7 @@ void pyVaultMarkerGameNode::SetGameName (const char v[]) { if (fNode) { VaultMarkerGameNode access(fNode); - wchar unicode[kMaxVaultNodeStringLength]; + wchar_t unicode[kMaxVaultNodeStringLength]; StrToUnicode(unicode, v, arrsize(unicode)); access.SetGameName(unicode); } diff --git a/Sources/Plasma/FeatureLib/pfPython/pyVaultMarkerGameNode.h b/Sources/Plasma/FeatureLib/pfPython/pyVaultMarkerGameNode.h index ed185be8..183ab7bd 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyVaultMarkerGameNode.h +++ b/Sources/Plasma/FeatureLib/pfPython/pyVaultMarkerGameNode.h @@ -48,7 +48,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // ////////////////////////////////////////////////////////////////////// -#include "hsTypes.h" +#include "HeadSpin.h" #include #include "pyGlueHelpers.h" diff --git a/Sources/Plasma/FeatureLib/pfPython/pyVaultNode.cpp b/Sources/Plasma/FeatureLib/pfPython/pyVaultNode.cpp index a412e8ed..d030a55d 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyVaultNode.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/pyVaultNode.cpp @@ -84,7 +84,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com static void __cdecl LogDumpProc ( void * , - const wchar fmt[], + const wchar_t fmt[], ... ) { va_list args; @@ -106,7 +106,7 @@ pyVaultNode::pyVaultNodeOperationCallback::~pyVaultNodeOperationCallback() Py_XDECREF( fCbObject ); } -void pyVaultNode::pyVaultNodeOperationCallback::VaultOperationStarted( UInt32 context ) +void pyVaultNode::pyVaultNodeOperationCallback::VaultOperationStarted( uint32_t context ) { fContext = context; if ( fCbObject ) @@ -129,7 +129,7 @@ void pyVaultNode::pyVaultNodeOperationCallback::VaultOperationStarted( UInt32 co } -void pyVaultNode::pyVaultNodeOperationCallback::VaultOperationComplete( UInt32 context, int resultCode ) +void pyVaultNode::pyVaultNodeOperationCallback::VaultOperationComplete( uint32_t context, int resultCode ) { if ( fCbObject ) { @@ -154,7 +154,7 @@ void pyVaultNode::pyVaultNodeOperationCallback::VaultOperationComplete( UInt32 c } } - DEL(this); // commit hara-kiri + delete this; // commit hara-kiri } void pyVaultNode::pyVaultNodeOperationCallback::SetNode (RelVaultNode * rvn) { @@ -191,8 +191,8 @@ pyVaultNode::~pyVaultNode() { if (fNode) fNode->DecRef("pyVaultNode"); - FREE(fCreateAgeGuid); - FREE(fCreateAgeName); + free(fCreateAgeGuid); + free(fCreateAgeName); } @@ -217,21 +217,21 @@ bool pyVaultNode::operator==(const pyVaultNode &vaultNode) const } // public getters -UInt32 pyVaultNode::GetID( void ) +uint32_t pyVaultNode::GetID( void ) { if (fNode) return fNode->nodeId; return 0; } -UInt32 pyVaultNode::GetType( void ) +uint32_t pyVaultNode::GetType( void ) { if (fNode) return fNode->nodeType; return 0; } -UInt32 pyVaultNode::GetOwnerNodeID( void ) +uint32_t pyVaultNode::GetOwnerNodeID( void ) { hsAssert(false, "eric, port?"); // if (fNode) @@ -254,14 +254,14 @@ PyObject* pyVaultNode::GetOwnerNode( void ) PYTHON_RETURN_NONE; } -UInt32 pyVaultNode::GetModifyTime( void ) +uint32_t pyVaultNode::GetModifyTime( void ) { if (fNode) return fNode->modifyTime; return 0; } -UInt32 pyVaultNode::GetCreatorNodeID( void ) +uint32_t pyVaultNode::GetCreatorNodeID( void ) { if (fNode) return fNode->creatorId; @@ -293,14 +293,14 @@ PyObject* pyVaultNode::GetCreatorNode( void ) PYTHON_RETURN_NONE; } -UInt32 pyVaultNode::GetCreateTime( void ) +uint32_t pyVaultNode::GetCreateTime( void ) { if (fNode) return fNode->createTime; return 0; } -UInt32 pyVaultNode::GetCreateAgeTime( void ) +uint32_t pyVaultNode::GetCreateAgeTime( void ) { hsAssert(false, "eric, port?"); @@ -335,7 +335,7 @@ const char * pyVaultNode::GetCreateAgeGuid( void ) return fCreateAgeGuid; if (fNode) { - fCreateAgeGuid = (char*)ALLOC(64); + fCreateAgeGuid = (char*)malloc(64); GuidToString(fNode->createAgeUuid, fCreateAgeGuid, 64); } @@ -349,7 +349,7 @@ PyObject* pyVaultNode::GetCreateAgeCoords () { return pyDniCoordinates::New(nil); } -void pyVaultNode::SetID( UInt32 v ) +void pyVaultNode::SetID( uint32_t v ) { hsAssert(false, "Why are you changing the node id?"); } @@ -365,12 +365,12 @@ void pyVaultNode::SetType( int v ) fNode->SetNodeType(v); } -void pyVaultNode::SetOwnerNodeID( UInt32 v ) +void pyVaultNode::SetOwnerNodeID( uint32_t v ) { hsAssert(false, "eric, implement me."); } -void pyVaultNode::SetCreatorNodeID( UInt32 v ) +void pyVaultNode::SetCreatorNodeID( uint32_t v ) { ASSERT(fNode); if (fNode->nodeId) { @@ -383,18 +383,18 @@ void pyVaultNode::SetCreatorNodeID( UInt32 v ) void pyVaultNode::SetCreateAgeName( const char * v ) { - FREE(fCreateAgeName); + free(fCreateAgeName); fCreateAgeName = nil; ASSERT(fNode); - wchar str[MAX_PATH]; + wchar_t str[MAX_PATH]; StrToUnicode(str, v, arrsize(str)); fNode->SetCreateAgeName(str); } void pyVaultNode::SetCreateAgeGuid( const char * v ) { - FREE(fCreateAgeGuid); + free(fCreateAgeGuid); fCreateAgeGuid = nil; ASSERT(fNode); @@ -416,7 +416,7 @@ void _AddNodeCallback(ENetError result, void* param) { cb->VaultOperationComplete(hsFail); } -PyObject* pyVaultNode::AddNode(pyVaultNode* pynode, PyObject* cbObject, UInt32 cbContext) +PyObject* pyVaultNode::AddNode(pyVaultNode* pynode, PyObject* cbObject, uint32_t cbContext) { pyVaultNodeOperationCallback * cb = NEWZERO(pyVaultNodeOperationCallback)(cbObject); @@ -473,7 +473,7 @@ PyObject* pyVaultNode::AddNode(pyVaultNode* pynode, PyObject* cbObject, UInt32 c } // Link a node to this one -void pyVaultNode::LinkToNode(int nodeID, PyObject* cbObject, UInt32 cbContext) +void pyVaultNode::LinkToNode(int nodeID, PyObject* cbObject, uint32_t cbContext) { pyVaultNodeOperationCallback * cb = NEWZERO(pyVaultNodeOperationCallback)( cbObject ); @@ -504,7 +504,7 @@ void pyVaultNode::LinkToNode(int nodeID, PyObject* cbObject, UInt32 cbContext) } // Remove child node -hsBool pyVaultNode::RemoveNode( pyVaultNode& pynode, PyObject* cbObject, UInt32 cbContext ) +hsBool pyVaultNode::RemoveNode( pyVaultNode& pynode, PyObject* cbObject, uint32_t cbContext ) { pyVaultNodeOperationCallback * cb = NEWZERO(pyVaultNodeOperationCallback)( cbObject ); @@ -543,7 +543,7 @@ void pyVaultNode::RemoveAllNodes( void ) } // Add/Save this node to vault -void pyVaultNode::Save(PyObject* cbObject, UInt32 cbContext) +void pyVaultNode::Save(PyObject* cbObject, uint32_t cbContext) { // If the node doesn't have an id, then use it as a template to create the node in the vault, // otherwise just ignore the save request since vault nodes are now auto-saved. @@ -561,7 +561,7 @@ void pyVaultNode::Save(PyObject* cbObject, UInt32 cbContext) } // Save this node and all child nodes that need saving. -void pyVaultNode::SaveAll(PyObject* cbObject, UInt32 cbContext) +void pyVaultNode::SaveAll(PyObject* cbObject, uint32_t cbContext) { // Nodes are now auto-saved pyVaultNodeOperationCallback * cb = NEWZERO(pyVaultNodeOperationCallback)( cbObject ); @@ -583,7 +583,7 @@ void pyVaultNode::ForceSave() } // Send this node to the destination client node. will be received in it's inbox folder. -void pyVaultNode::SendTo(UInt32 destClientNodeID, PyObject* cbObject, UInt32 cbContext ) +void pyVaultNode::SendTo(uint32_t destClientNodeID, PyObject* cbObject, uint32_t cbContext ) { pyVaultNodeOperationCallback * cb = NEWZERO(pyVaultNodeOperationCallback)( cbObject ); @@ -651,21 +651,21 @@ int pyVaultNode::GetChildNodeCount() } // Get the client ID from my Vault client. -UInt32 pyVaultNode::GetClientID() +uint32_t pyVaultNode::GetClientID() { hsAssert(false, "eric, port me"); return 0; } -bool pyVaultNode::HasNode( UInt32 nodeID ) +bool pyVaultNode::HasNode( uint32_t nodeID ) { if ( fNode ) return fNode->IsParentOf( nodeID, 1 ); return false; } -PyObject * pyVaultNode::GetNode2( UInt32 nodeID ) const +PyObject * pyVaultNode::GetNode2( uint32_t nodeID ) const { PyObject * result = nil; if ( fNode ) diff --git a/Sources/Plasma/FeatureLib/pfPython/pyVaultNode.h b/Sources/Plasma/FeatureLib/pfPython/pyVaultNode.h index c3533305..1d770781 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyVaultNode.h +++ b/Sources/Plasma/FeatureLib/pfPython/pyVaultNode.h @@ -47,7 +47,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // pyVaultNode - a wrapper class to provide interface to the RelVaultNode // ////////////////////////////////////////////////////////////////////// -#include "hsTypes.h" +#include "HeadSpin.h" #include "hsStlUtils.h" #include @@ -85,13 +85,13 @@ public: PyObject * fCbObject; RelVaultNode * fNode; PyObject * fPyNodeRef; - UInt32 fContext; + uint32_t fContext; pyVaultNodeOperationCallback(PyObject * cbObject); ~pyVaultNodeOperationCallback(); - void VaultOperationStarted(UInt32 context); - void VaultOperationComplete(UInt32 context, int resultCode); + void VaultOperationStarted(uint32_t context); + void VaultOperationComplete(uint32_t context, int resultCode); void VaultOperationComplete(int resultCode) { VaultOperationComplete(fContext, resultCode); } void SetNode (RelVaultNode * rvn); @@ -127,27 +127,27 @@ public: bool operator!=(const pyVaultNode &vaultNode) const { return !(vaultNode == *this); } // public getters - UInt32 GetID( void ); - virtual UInt32 GetType( void ); - UInt32 GetPermissions( void ); - UInt32 GetOwnerNodeID( void ); + uint32_t GetID( void ); + virtual uint32_t GetType( void ); + uint32_t GetPermissions( void ); + uint32_t GetOwnerNodeID( void ); PyObject* GetOwnerNode( void ); // returns pyVaultPlayerInfoNode - UInt32 GetGroupNodeID( void ); + uint32_t GetGroupNodeID( void ); PyObject* GetGroupNode( void ); // returns pyVaultNode - UInt32 GetModifyTime( void ); - UInt32 GetCreatorNodeID( void ); + uint32_t GetModifyTime( void ); + uint32_t GetCreatorNodeID( void ); PyObject* GetCreatorNode( void ); // returns pyVaultPlayerInfoNode - UInt32 GetCreateTime( void ); - UInt32 GetCreateAgeTime( void ); + uint32_t GetCreateTime( void ); + uint32_t GetCreateAgeTime( void ); const char * GetCreateAgeName( void ); const char * GetCreateAgeGuid( void ); PyObject* GetCreateAgeCoords (); // public setters - void SetID( UInt32 v ); + void SetID( uint32_t v ); void SetType( int v ); - void SetOwnerNodeID( UInt32 v ); - void SetCreatorNodeID( UInt32 v ); + void SetOwnerNodeID( uint32_t v ); + void SetCreatorNodeID( uint32_t v ); void SetCreateAgeName( const char * v ); void SetCreateAgeGuid( const char * v ); @@ -156,28 +156,28 @@ public: // Vault Node API // Add child node - PyObject* AddNode(pyVaultNode* pynode, PyObject* cbObject=nil, UInt32 cbContext=0 ); + PyObject* AddNode(pyVaultNode* pynode, PyObject* cbObject=nil, uint32_t cbContext=0 ); // Link node to this one - void LinkToNode(int nodeID, PyObject* cbObject=nil, UInt32 cbContext=0 ); + void LinkToNode(int nodeID, PyObject* cbObject=nil, uint32_t cbContext=0 ); // Remove child node - hsBool RemoveNode( pyVaultNode& pynode, PyObject* cbObject=nil, UInt32 cbContext=0 ); + hsBool RemoveNode( pyVaultNode& pynode, PyObject* cbObject=nil, uint32_t cbContext=0 ); // Remove all child nodes void RemoveAllNodes( void ); // Add/Save this node to vault - void Save( PyObject* cbObject=nil, UInt32 cbContext=0 ); + void Save( PyObject* cbObject=nil, uint32_t cbContext=0 ); // Save this node and all child nodes that need saving. // NOTE: Currently, the cb object is called back for // each node saved. - void SaveAll( PyObject* cbObject=nil, UInt32 cbContext=0 ); + void SaveAll( PyObject* cbObject=nil, uint32_t cbContext=0 ); // Force a save on this node because currently Save doesn't do anything because dirty // nodes are periodically saved automatically - call this to force a save immediately void ForceSave(); // Send this node to the destination client node. will be received in it's inbox folder. - void SendTo(UInt32 destClientNodeID, PyObject* cbObject=nil, UInt32 cbContext=0 ); + void SendTo(uint32_t destClientNodeID, PyObject* cbObject=nil, uint32_t cbContext=0 ); // Returns true if is a child node of ours. - bool HasNode( UInt32 nodeID ); + bool HasNode( uint32_t nodeID ); // Returns a ptVaultNodeRef or nil - PyObject* GetNode2( UInt32 nodeID ) const; // returns pyVaultNodeRef, for legacy compatibility + PyObject* GetNode2( uint32_t nodeID ) const; // returns pyVaultNodeRef, for legacy compatibility // Get child node matching template node PyObject* FindNode( pyVaultNode * templateNode ); // returns pyVaultNode @@ -188,7 +188,7 @@ public: virtual int GetChildNodeCount(); // Get the client ID from my Vault client. - UInt32 GetClientID( void ); + uint32_t GetClientID( void ); // all the upcasting stuff... PyObject* UpcastToFolderNode(); // returns pyVaultFolderNode diff --git a/Sources/Plasma/FeatureLib/pfPython/pyVaultNodeRef.h b/Sources/Plasma/FeatureLib/pfPython/pyVaultNodeRef.h index cb89020b..d93545f0 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyVaultNodeRef.h +++ b/Sources/Plasma/FeatureLib/pfPython/pyVaultNodeRef.h @@ -48,7 +48,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // ////////////////////////////////////////////////////////////////////// -#include "hsTypes.h" +#include "HeadSpin.h" #include #include "pyGlueHelpers.h" diff --git a/Sources/Plasma/FeatureLib/pfPython/pyVaultPlayerInfoListNode.cpp b/Sources/Plasma/FeatureLib/pfPython/pyVaultPlayerInfoListNode.cpp index a68875f9..0660b873 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyVaultPlayerInfoListNode.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/pyVaultPlayerInfoListNode.cpp @@ -73,7 +73,7 @@ pyVaultPlayerInfoListNode::pyVaultPlayerInfoListNode(int n) //================================================================== // class RelVaultNode : public plVaultFolderNode // -hsBool pyVaultPlayerInfoListNode::HasPlayer( UInt32 playerID ) +hsBool pyVaultPlayerInfoListNode::HasPlayer( uint32_t playerID ) { if (!fNode) return false; @@ -92,7 +92,7 @@ hsBool pyVaultPlayerInfoListNode::HasPlayer( UInt32 playerID ) return (rvn != nil); } -hsBool pyVaultPlayerInfoListNode::AddPlayer( UInt32 playerID ) +hsBool pyVaultPlayerInfoListNode::AddPlayer( uint32_t playerID ) { if (HasPlayer(playerID)) return true; @@ -119,7 +119,7 @@ hsBool pyVaultPlayerInfoListNode::AddPlayer( UInt32 playerID ) return nodeIds.Count() != 0; } -void pyVaultPlayerInfoListNode::RemovePlayer( UInt32 playerID ) +void pyVaultPlayerInfoListNode::RemovePlayer( uint32_t playerID ) { if (!fNode) return; @@ -138,7 +138,7 @@ void pyVaultPlayerInfoListNode::RemovePlayer( UInt32 playerID ) templateNode->DecRef(); } -PyObject * pyVaultPlayerInfoListNode::GetPlayer( UInt32 playerID ) +PyObject * pyVaultPlayerInfoListNode::GetPlayer( uint32_t playerID ) { if (!fNode) PYTHON_RETURN_NONE; diff --git a/Sources/Plasma/FeatureLib/pfPython/pyVaultPlayerInfoListNode.h b/Sources/Plasma/FeatureLib/pfPython/pyVaultPlayerInfoListNode.h index bba18c8e..25d72457 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyVaultPlayerInfoListNode.h +++ b/Sources/Plasma/FeatureLib/pfPython/pyVaultPlayerInfoListNode.h @@ -48,7 +48,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // ////////////////////////////////////////////////////////////////////// -#include "hsTypes.h" +#include "HeadSpin.h" #include "hsStlUtils.h" #include @@ -82,10 +82,10 @@ public: //================================================================== // class RelVaultNode : public plVaultFolderNode // - virtual hsBool HasPlayer( UInt32 playerID ); - hsBool AddPlayer( UInt32 playerID ); - void RemovePlayer( UInt32 playerID ); - PyObject * GetPlayer( UInt32 playerID ); // returns pyVaultPlayerInfoNode + virtual hsBool HasPlayer( uint32_t playerID ); + hsBool AddPlayer( uint32_t playerID ); + void RemovePlayer( uint32_t playerID ); + PyObject * GetPlayer( uint32_t playerID ); // returns pyVaultPlayerInfoNode void Sort(); diff --git a/Sources/Plasma/FeatureLib/pfPython/pyVaultPlayerInfoNode.cpp b/Sources/Plasma/FeatureLib/pfPython/pyVaultPlayerInfoNode.cpp index 5f86162b..5558939f 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyVaultPlayerInfoNode.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/pyVaultPlayerInfoNode.cpp @@ -70,14 +70,14 @@ pyVaultPlayerInfoNode::pyVaultPlayerInfoNode() } pyVaultPlayerInfoNode::~pyVaultPlayerInfoNode () { - FREE(ansiPlayerName); - FREE(ansiAgeInstName); + free(ansiPlayerName); + free(ansiAgeInstName); } //================================================================== // class RelVaultNode : public plVaultNode // -void pyVaultPlayerInfoNode::Player_SetPlayerID( UInt32 plyrid ) +void pyVaultPlayerInfoNode::Player_SetPlayerID( uint32_t plyrid ) { if (!fNode) return; @@ -86,7 +86,7 @@ void pyVaultPlayerInfoNode::Player_SetPlayerID( UInt32 plyrid ) playerInfo.SetPlayerId(plyrid); } -UInt32 pyVaultPlayerInfoNode::Player_GetPlayerID( void ) +uint32_t pyVaultPlayerInfoNode::Player_GetPlayerID( void ) { if (!fNode) return 0; @@ -100,10 +100,10 @@ void pyVaultPlayerInfoNode::Player_SetPlayerName( const char * name ) if (!fNode) return; - wchar * wStr = StrDupToUnicode(name); + wchar_t * wStr = StrDupToUnicode(name); VaultPlayerInfoNode playerInfo(fNode); playerInfo.SetPlayerName(wStr); - FREE(wStr); + free(wStr); } const char * pyVaultPlayerInfoNode::Player_GetPlayerName( void ) @@ -115,7 +115,7 @@ const char * pyVaultPlayerInfoNode::Player_GetPlayerName( void ) if (!playerInfo.playerName) return ""; - FREE(ansiPlayerName); + free(ansiPlayerName); ansiPlayerName = StrDupToAnsi(playerInfo.playerName); return ansiPlayerName; } @@ -126,10 +126,10 @@ void pyVaultPlayerInfoNode::Player_SetAgeInstanceName( const char * agename ) if (!fNode) return; - wchar * wStr = StrDupToUnicode(agename); + wchar_t * wStr = StrDupToUnicode(agename); VaultPlayerInfoNode playerInfo(fNode); playerInfo.SetAgeInstName(wStr); - FREE(wStr); + free(wStr); } const char * pyVaultPlayerInfoNode::Player_GetAgeInstanceName( void ) @@ -141,7 +141,7 @@ const char * pyVaultPlayerInfoNode::Player_GetAgeInstanceName( void ) if (!playerInfo.ageInstName) return ""; - FREE(ansiAgeInstName); + free(ansiAgeInstName); ansiAgeInstName = StrDupToAnsi(playerInfo.ageInstName); return ansiAgeInstName; } diff --git a/Sources/Plasma/FeatureLib/pfPython/pyVaultPlayerInfoNode.h b/Sources/Plasma/FeatureLib/pfPython/pyVaultPlayerInfoNode.h index e979e66c..1ba6b5fa 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyVaultPlayerInfoNode.h +++ b/Sources/Plasma/FeatureLib/pfPython/pyVaultPlayerInfoNode.h @@ -80,8 +80,8 @@ public: //================================================================== // class plVaultPlayerInfoNode : public plVaultNode // - void Player_SetPlayerID( UInt32 plyrid ); - UInt32 Player_GetPlayerID( void ); + void Player_SetPlayerID( uint32_t plyrid ); + uint32_t Player_GetPlayerID( void ); void Player_SetPlayerName( const char * name ); const char * Player_GetPlayerName( void ); diff --git a/Sources/Plasma/FeatureLib/pfPython/pyVaultPlayerNode.cpp b/Sources/Plasma/FeatureLib/pfPython/pyVaultPlayerNode.cpp index 6a1dbc90..20946203 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyVaultPlayerNode.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/pyVaultPlayerNode.cpp @@ -182,27 +182,27 @@ PyObject *pyVaultPlayerNode::GetPlayerInfo() PyObject *pyVaultPlayerNode::GetLinkToMyNeighborhood() { - plAgeLinkStruct * link = NEW(plAgeLinkStruct); + plAgeLinkStruct * link = new plAgeLinkStruct(); if (VaultGetLinkToMyNeighborhood(link)) { PyObject * result = pyAgeLinkStruct::New(link); return result; } - DEL(link); + delete link; PYTHON_RETURN_NONE; } PyObject *pyVaultPlayerNode::GetLinkToCity() { - plAgeLinkStruct * link = NEW(plAgeLinkStruct); + plAgeLinkStruct * link = new plAgeLinkStruct(); if (VaultGetLinkToCity(link)) { PyObject * result = pyAgeLinkStruct::New(link); return result; } - DEL(link); + delete link; PYTHON_RETURN_NONE; } @@ -244,7 +244,7 @@ void pyVaultPlayerNode::RemoveVisitAgeLink(const char *guidstr) PyObject *pyVaultPlayerNode::FindChronicleEntry(const char *entryName) { - wchar wStr[MAX_PATH]; + wchar_t wStr[MAX_PATH]; StrToUnicode(wStr, entryName, arrsize(wStr)); if (RelVaultNode * rvn = VaultFindChronicleEntryIncRef(wStr)) { PyObject * result = pyVaultChronicleNode::New(rvn); @@ -301,12 +301,12 @@ bool pyVaultPlayerNode::IsDisabled() return player.disabled; } -void pyVaultPlayerNode::SetOnlineTime(UInt32 value) +void pyVaultPlayerNode::SetOnlineTime(uint32_t value) { hsAssert(false, "python may not change a player's online time this way"); } -UInt32 pyVaultPlayerNode::GetOnlineTime() +uint32_t pyVaultPlayerNode::GetOnlineTime() { if (!fNode) return 0; diff --git a/Sources/Plasma/FeatureLib/pfPython/pyVaultPlayerNode.h b/Sources/Plasma/FeatureLib/pfPython/pyVaultPlayerNode.h index b43156ef..f319d06a 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyVaultPlayerNode.h +++ b/Sources/Plasma/FeatureLib/pfPython/pyVaultPlayerNode.h @@ -48,7 +48,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // ////////////////////////////////////////////////////////////////////// -#include "hsTypes.h" +#include "HeadSpin.h" #include "hsStlUtils.h" #include @@ -114,8 +114,8 @@ public: void SetDisabled(bool value); bool IsDisabled(); - void SetOnlineTime(UInt32 value); - UInt32 GetOnlineTime(); + void SetOnlineTime(uint32_t value); + uint32_t GetOnlineTime(); void SetExplorer (bool b); hsBool IsExplorer (); diff --git a/Sources/Plasma/FeatureLib/pfPython/pyVaultSDLNode.cpp b/Sources/Plasma/FeatureLib/pfPython/pyVaultSDLNode.cpp index c2b60f94..28a7700b 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyVaultSDLNode.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/pyVaultSDLNode.cpp @@ -97,7 +97,7 @@ PyObject * pyVaultSDLNode::GetStateDataRecord() const if (sdl.GetStateDataRecord(rec)) return pySDLStateDataRecord::New(rec); else - DEL(rec); + delete rec; PYTHON_RETURN_NONE; } @@ -107,7 +107,7 @@ void pyVaultSDLNode::InitStateDataRecord( const char* agename, int flags) if (!fNode) return; - wchar wStr[MAX_PATH]; + wchar_t wStr[MAX_PATH]; StrToUnicode(wStr, agename, arrsize(wStr)); VaultSDLNode sdl(fNode); sdl.InitStateDataRecord(wStr, flags); diff --git a/Sources/Plasma/FeatureLib/pfPython/pyVaultSDLNode.h b/Sources/Plasma/FeatureLib/pfPython/pyVaultSDLNode.h index c3abe1a5..ccf3523b 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyVaultSDLNode.h +++ b/Sources/Plasma/FeatureLib/pfPython/pyVaultSDLNode.h @@ -48,7 +48,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // ////////////////////////////////////////////////////////////////////// -#include "hsTypes.h" +#include "HeadSpin.h" #include "hsStlUtils.h" #include diff --git a/Sources/Plasma/FeatureLib/pfPython/pyVaultSystemNode.h b/Sources/Plasma/FeatureLib/pfPython/pyVaultSystemNode.h index 7d8132a5..3d8da8f4 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyVaultSystemNode.h +++ b/Sources/Plasma/FeatureLib/pfPython/pyVaultSystemNode.h @@ -48,7 +48,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // ////////////////////////////////////////////////////////////////////// -#include "hsTypes.h" +#include "HeadSpin.h" #include "hsStlUtils.h" #include diff --git a/Sources/Plasma/FeatureLib/pfPython/pyVaultTextNoteNode.cpp b/Sources/Plasma/FeatureLib/pfPython/pyVaultTextNoteNode.cpp index c31c3904..a1e924e6 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyVaultTextNoteNode.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/pyVaultTextNoteNode.cpp @@ -76,7 +76,7 @@ void pyVaultTextNoteNode::Note_SetTitle( const char * text ) if (!fNode) return; - wchar wStr[MAX_PATH] = L""; + wchar_t wStr[MAX_PATH] = L""; if (text) StrToUnicode(wStr, text, arrsize(wStr)); VaultTextNoteNode textNote(fNode); @@ -103,7 +103,7 @@ std::string pyVaultTextNoteNode::Note_GetTitle( void ) std::string result; aStr = StrDupToAnsi(textNote.noteTitle); result = aStr; - FREE(aStr); + free(aStr); return result; } return ""; @@ -125,12 +125,12 @@ void pyVaultTextNoteNode::Note_SetText( const char * text ) if (!fNode) return; - wchar * wStr = nil; + wchar_t * wStr = nil; if (text) wStr = StrDupToUnicode(text); VaultTextNoteNode textNote(fNode); textNote.SetNoteText(wStr); - FREE(wStr); + free(wStr); } void pyVaultTextNoteNode::Note_SetTextW( const wchar_t * text ) @@ -153,7 +153,7 @@ std::string pyVaultTextNoteNode::Note_GetText( void ) std::string result; aStr = StrDupToAnsi(textNote.noteText); result = aStr; - FREE(aStr); + free(aStr); return result; } return ""; @@ -170,7 +170,7 @@ std::wstring pyVaultTextNoteNode::Note_GetTextW( void ) return L""; } -void pyVaultTextNoteNode::Note_SetType( Int32 type ) +void pyVaultTextNoteNode::Note_SetType( int32_t type ) { if (!fNode) return; @@ -179,7 +179,7 @@ void pyVaultTextNoteNode::Note_SetType( Int32 type ) textNote.SetNoteType(type); } -Int32 pyVaultTextNoteNode::Note_GetType( void ) +int32_t pyVaultTextNoteNode::Note_GetType( void ) { if (!fNode) return 0; @@ -188,7 +188,7 @@ Int32 pyVaultTextNoteNode::Note_GetType( void ) return textNote.noteType; } -void pyVaultTextNoteNode::Note_SetSubType( Int32 type ) +void pyVaultTextNoteNode::Note_SetSubType( int32_t type ) { if (!fNode) return; @@ -197,7 +197,7 @@ void pyVaultTextNoteNode::Note_SetSubType( Int32 type ) textNote.SetNoteSubType(type); } -Int32 pyVaultTextNoteNode::Note_GetSubType( void ) +int32_t pyVaultTextNoteNode::Note_GetSubType( void ) { if (!fNode) return 0; @@ -215,7 +215,7 @@ PyObject * pyVaultTextNoteNode::GetDeviceInbox() const PYTHON_RETURN_NONE; } -void pyVaultTextNoteNode::SetDeviceInbox( const char * devName, PyObject * cbObject, UInt32 cbContext ) +void pyVaultTextNoteNode::SetDeviceInbox( const char * devName, PyObject * cbObject, uint32_t cbContext ) { if (!fNode) return; @@ -223,7 +223,7 @@ void pyVaultTextNoteNode::SetDeviceInbox( const char * devName, PyObject * cbObj pyVaultNode::pyVaultNodeOperationCallback * cb = NEWZERO(pyVaultNode::pyVaultNodeOperationCallback)( cbObject ); cb->VaultOperationStarted( cbContext ); - wchar wDev[MAX_PATH]; + wchar_t wDev[MAX_PATH]; StrToUnicode(wDev, devName, arrsize(wDev)); if (RelVaultNode * rvn = VaultAgeSetDeviceInboxAndWaitIncRef(wDev, DEFAULT_DEVICE_INBOX)) { diff --git a/Sources/Plasma/FeatureLib/pfPython/pyVaultTextNoteNode.h b/Sources/Plasma/FeatureLib/pfPython/pyVaultTextNoteNode.h index ac70e9d6..3a7bbd6a 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyVaultTextNoteNode.h +++ b/Sources/Plasma/FeatureLib/pfPython/pyVaultTextNoteNode.h @@ -48,7 +48,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // ////////////////////////////////////////////////////////////////////// -#include "hsTypes.h" +#include "HeadSpin.h" #include "hsStlUtils.h" #include #include "pyGlueHelpers.h" @@ -90,14 +90,14 @@ public: void Note_SetTextW( const wchar_t * text ); std::string Note_GetText( void ); std::wstring Note_GetTextW( void ); - void Note_SetType( Int32 type ); - Int32 Note_GetType( void ); + void Note_SetType( int32_t type ); + int32_t Note_GetType( void ); - void Note_SetSubType( Int32 type ); - Int32 Note_GetSubType( void ); + void Note_SetSubType( int32_t type ); + int32_t Note_GetSubType( void ); PyObject * GetDeviceInbox() const; // returns pyVaultFolderNode - void SetDeviceInbox( const char * devName, PyObject * cb=nil, UInt32 cbContext=0 ); + void SetDeviceInbox( const char * devName, PyObject * cb=nil, uint32_t cbContext=0 ); }; #endif // _pyVaultTextNoteNode_h_ diff --git a/Sources/Plasma/FeatureLib/pfPython/pyVaultTextNoteNodeGlue.cpp b/Sources/Plasma/FeatureLib/pfPython/pyVaultTextNoteNodeGlue.cpp index 4080c4ae..66028c3c 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyVaultTextNoteNodeGlue.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/pyVaultTextNoteNodeGlue.cpp @@ -146,7 +146,7 @@ PYTHON_METHOD_DEFINITION(ptVaultTextNoteNode, setTitleW, args) if (PyUnicode_Check(textObj)) { int strLen = PyUnicode_GetSize(textObj); - wchar_t* title = TRACKED_NEW wchar_t[strLen + 1]; + wchar_t* title = new wchar_t[strLen + 1]; PyUnicode_AsWideChar((PyUnicodeObject*)textObj, title, strLen); title[strLen] = L'\0'; self->fThis->Note_SetTitleW(title); @@ -198,7 +198,7 @@ PYTHON_METHOD_DEFINITION(ptVaultTextNoteNode, setTextW, args) if (PyUnicode_Check(textObj)) { int strLen = PyUnicode_GetSize(textObj); - wchar_t* text = TRACKED_NEW wchar_t[strLen + 1]; + wchar_t* text = new wchar_t[strLen + 1]; PyUnicode_AsWideChar((PyUnicodeObject*)textObj, text, strLen); text[strLen] = L'\0'; self->fThis->Note_SetTextW(text); diff --git a/Sources/Plasma/FeatureLib/pfPython/pyWaveSet.cpp b/Sources/Plasma/FeatureLib/pfPython/pyWaveSet.cpp index 5b625415..c52b9e7e 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyWaveSet.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/pyWaveSet.cpp @@ -56,7 +56,7 @@ pyWaveSet::pyWaveSet(pyKey& key) // Geometric wave parameters. These are all safe to twiddle at any time or speed. // The new settings take effect as new waves are spawned. -void pyWaveSet::SetGeoMaxLength(hsScalar s, hsScalar secs) +void pyWaveSet::SetGeoMaxLength(float s, float secs) { if (fWaterKey) { @@ -68,7 +68,7 @@ void pyWaveSet::SetGeoMaxLength(hsScalar s, hsScalar secs) } } -void pyWaveSet::SetGeoMinLength(hsScalar s, hsScalar secs) +void pyWaveSet::SetGeoMinLength(float s, float secs) { if (fWaterKey) { @@ -80,7 +80,7 @@ void pyWaveSet::SetGeoMinLength(hsScalar s, hsScalar secs) } } -void pyWaveSet::SetGeoAmpOverLen(hsScalar s, hsScalar secs) +void pyWaveSet::SetGeoAmpOverLen(float s, float secs) { if (fWaterKey) { @@ -92,7 +92,7 @@ void pyWaveSet::SetGeoAmpOverLen(hsScalar s, hsScalar secs) } } -void pyWaveSet::SetGeoChop(hsScalar s, hsScalar secs) +void pyWaveSet::SetGeoChop(float s, float secs) { if (fWaterKey) { @@ -104,7 +104,7 @@ void pyWaveSet::SetGeoChop(hsScalar s, hsScalar secs) } } -void pyWaveSet::SetGeoAngleDev(hsScalar s, hsScalar secs) +void pyWaveSet::SetGeoAngleDev(float s, float secs) { if (fWaterKey) { @@ -120,7 +120,7 @@ void pyWaveSet::SetGeoAngleDev(hsScalar s, hsScalar secs) // Texture wave parameters. Safe to twiddle any time or speed. // The new settings take effect as new waves are spawned. -void pyWaveSet::SetTexMaxLength(hsScalar s, hsScalar secs) +void pyWaveSet::SetTexMaxLength(float s, float secs) { if (fWaterKey) { @@ -132,7 +132,7 @@ void pyWaveSet::SetTexMaxLength(hsScalar s, hsScalar secs) } } -void pyWaveSet::SetTexMinLength(hsScalar s, hsScalar secs) +void pyWaveSet::SetTexMinLength(float s, float secs) { if (fWaterKey) { @@ -144,7 +144,7 @@ void pyWaveSet::SetTexMinLength(hsScalar s, hsScalar secs) } } -void pyWaveSet::SetTexAmpOverLen(hsScalar s, hsScalar secs) +void pyWaveSet::SetTexAmpOverLen(float s, float secs) { if (fWaterKey) { @@ -156,7 +156,7 @@ void pyWaveSet::SetTexAmpOverLen(hsScalar s, hsScalar secs) } } -void pyWaveSet::SetTexChop(hsScalar s, hsScalar secs) +void pyWaveSet::SetTexChop(float s, float secs) { if (fWaterKey) { @@ -168,7 +168,7 @@ void pyWaveSet::SetTexChop(hsScalar s, hsScalar secs) } } -void pyWaveSet::SetTexAngleDev(hsScalar s, hsScalar secs) +void pyWaveSet::SetTexAngleDev(float s, float secs) { if (fWaterKey) { @@ -183,7 +183,7 @@ void pyWaveSet::SetTexAngleDev(hsScalar s, hsScalar secs) // The size in feet of one tile of the ripple texture. If you change this (I don't // recommend it), you need to change it very slowly or it will look very stupid. -void pyWaveSet::SetRippleScale(hsScalar s, hsScalar secs) +void pyWaveSet::SetRippleScale(float s, float secs) { if (fWaterKey) { @@ -199,7 +199,7 @@ void pyWaveSet::SetRippleScale(hsScalar s, hsScalar secs) // The direction the wind is blowing (waves will be more or less perpindicular to wind dir). // Change somewhat slowly, like over 30 seconds. -void pyWaveSet::SetWindDir(const pyVector3& s, hsScalar secs) +void pyWaveSet::SetWindDir(const pyVector3& s, float secs) { if (fWaterKey) { @@ -214,7 +214,7 @@ void pyWaveSet::SetWindDir(const pyVector3& s, hsScalar secs) // -------------------------------------------------------------------------------- // Change these gently, effect is immediate. -void pyWaveSet::SetSpecularNoise(hsScalar s, hsScalar secs) +void pyWaveSet::SetSpecularNoise(float s, float secs) { if (fWaterKey) { @@ -226,7 +226,7 @@ void pyWaveSet::SetSpecularNoise(hsScalar s, hsScalar secs) } } -void pyWaveSet::SetSpecularStart(hsScalar s, hsScalar secs) +void pyWaveSet::SetSpecularStart(float s, float secs) { if (fWaterKey) { @@ -238,7 +238,7 @@ void pyWaveSet::SetSpecularStart(hsScalar s, hsScalar secs) } } -void pyWaveSet::SetSpecularEnd(hsScalar s, hsScalar secs) +void pyWaveSet::SetSpecularEnd(float s, float secs) { if (fWaterKey) { @@ -253,7 +253,7 @@ void pyWaveSet::SetSpecularEnd(hsScalar s, hsScalar secs) // -------------------------------------------------------------------------------- // Water Height is overriden if the ref object is animated. -void pyWaveSet::SetWaterHeight(hsScalar s, hsScalar secs) +void pyWaveSet::SetWaterHeight(float s, float secs) { if (fWaterKey) { @@ -268,7 +268,7 @@ void pyWaveSet::SetWaterHeight(hsScalar s, hsScalar secs) // -------------------------------------------------------------------------------- // Water Offset and DepthFalloff are complicated, and not immediately interesting to animate. -void pyWaveSet::SetWaterOffset(const pyVector3& s, hsScalar secs) +void pyWaveSet::SetWaterOffset(const pyVector3& s, float secs) { if (fWaterKey) { @@ -280,7 +280,7 @@ void pyWaveSet::SetWaterOffset(const pyVector3& s, hsScalar secs) } } -void pyWaveSet::SetOpacOffset(hsScalar s, hsScalar secs) +void pyWaveSet::SetOpacOffset(float s, float secs) { if (fWaterKey) { @@ -292,7 +292,7 @@ void pyWaveSet::SetOpacOffset(hsScalar s, hsScalar secs) } } -void pyWaveSet::SetReflOffset(hsScalar s, hsScalar secs) +void pyWaveSet::SetReflOffset(float s, float secs) { if (fWaterKey) { @@ -304,7 +304,7 @@ void pyWaveSet::SetReflOffset(hsScalar s, hsScalar secs) } } -void pyWaveSet::SetWaveOffset(hsScalar s, hsScalar secs) +void pyWaveSet::SetWaveOffset(float s, float secs) { if (fWaterKey) { @@ -316,7 +316,7 @@ void pyWaveSet::SetWaveOffset(hsScalar s, hsScalar secs) } } -void pyWaveSet::SetDepthFalloff(const pyVector3& s, hsScalar secs) +void pyWaveSet::SetDepthFalloff(const pyVector3& s, float secs) { if (fWaterKey) { @@ -328,7 +328,7 @@ void pyWaveSet::SetDepthFalloff(const pyVector3& s, hsScalar secs) } } -void pyWaveSet::SetOpacFalloff(hsScalar s, hsScalar secs) +void pyWaveSet::SetOpacFalloff(float s, float secs) { if (fWaterKey) { @@ -340,7 +340,7 @@ void pyWaveSet::SetOpacFalloff(hsScalar s, hsScalar secs) } } -void pyWaveSet::SetReflFalloff(hsScalar s, hsScalar secs) +void pyWaveSet::SetReflFalloff(float s, float secs) { if (fWaterKey) { @@ -352,7 +352,7 @@ void pyWaveSet::SetReflFalloff(hsScalar s, hsScalar secs) } } -void pyWaveSet::SetWaveFalloff(hsScalar s, hsScalar secs) +void pyWaveSet::SetWaveFalloff(float s, float secs) { if (fWaterKey) { @@ -367,7 +367,7 @@ void pyWaveSet::SetWaveFalloff(hsScalar s, hsScalar secs) // -------------------------------------------------------------------------------- // Max and Min Atten aren't very interesting, and will probably go away. -void pyWaveSet::SetMaxAtten(const pyVector3& s, hsScalar secs) +void pyWaveSet::SetMaxAtten(const pyVector3& s, float secs) { if (fWaterKey) { @@ -379,7 +379,7 @@ void pyWaveSet::SetMaxAtten(const pyVector3& s, hsScalar secs) } } -void pyWaveSet::SetMinAtten(const pyVector3& s, hsScalar secs) +void pyWaveSet::SetMinAtten(const pyVector3& s, float secs) { if (fWaterKey) { @@ -394,7 +394,7 @@ void pyWaveSet::SetMinAtten(const pyVector3& s, hsScalar secs) // -------------------------------------------------------------------------------- // Water colors, adjust slowly, effect is immediate. -void pyWaveSet::SetWaterTint(pyColor& s, hsScalar secs) +void pyWaveSet::SetWaterTint(pyColor& s, float secs) { if (fWaterKey) { @@ -406,7 +406,7 @@ void pyWaveSet::SetWaterTint(pyColor& s, hsScalar secs) } } -void pyWaveSet::SetWaterOpacity(hsScalar s, hsScalar secs) +void pyWaveSet::SetWaterOpacity(float s, float secs) { if (fWaterKey) { @@ -418,7 +418,7 @@ void pyWaveSet::SetWaterOpacity(hsScalar s, hsScalar secs) } } -void pyWaveSet::SetSpecularTint(pyColor& s, hsScalar secs) +void pyWaveSet::SetSpecularTint(pyColor& s, float secs) { if (fWaterKey) { @@ -430,7 +430,7 @@ void pyWaveSet::SetSpecularTint(pyColor& s, hsScalar secs) } } -void pyWaveSet::SetSpecularMute(hsScalar s, hsScalar secs) +void pyWaveSet::SetSpecularMute(float s, float secs) { if (fWaterKey) { @@ -447,7 +447,7 @@ void pyWaveSet::SetSpecularMute(hsScalar s, hsScalar secs) // the sphere north will move the reflections north, changing the radius of the // sphere effects parallax in the obvious way. -void pyWaveSet::SetEnvCenter(const pyPoint3& s, hsScalar secs) +void pyWaveSet::SetEnvCenter(const pyPoint3& s, float secs) { if (fWaterKey) { @@ -459,7 +459,7 @@ void pyWaveSet::SetEnvCenter(const pyPoint3& s, hsScalar secs) } } -void pyWaveSet::SetEnvRadius(hsScalar s, hsScalar secs) +void pyWaveSet::SetEnvRadius(float s, float secs) { if (fWaterKey) { @@ -478,7 +478,7 @@ void pyWaveSet::SetEnvRadius(hsScalar s, hsScalar secs) // ================================================================================ // -------------------------------------------------------------------------------- -hsScalar pyWaveSet::GetGeoMaxLength() const +float pyWaveSet::GetGeoMaxLength() const { if (fWaterKey) { @@ -492,7 +492,7 @@ hsScalar pyWaveSet::GetGeoMaxLength() const return -1; } -hsScalar pyWaveSet::GetGeoMinLength() const +float pyWaveSet::GetGeoMinLength() const { if (fWaterKey) { @@ -506,7 +506,7 @@ hsScalar pyWaveSet::GetGeoMinLength() const return -1; } -hsScalar pyWaveSet::GetGeoAmpOverLen() const +float pyWaveSet::GetGeoAmpOverLen() const { if (fWaterKey) { @@ -520,7 +520,7 @@ hsScalar pyWaveSet::GetGeoAmpOverLen() const return -1; } -hsScalar pyWaveSet::GetGeoChop() const +float pyWaveSet::GetGeoChop() const { if (fWaterKey) { @@ -534,7 +534,7 @@ hsScalar pyWaveSet::GetGeoChop() const return -1; } -hsScalar pyWaveSet::GetGeoAngleDev() const +float pyWaveSet::GetGeoAngleDev() const { if (fWaterKey) { @@ -550,7 +550,7 @@ hsScalar pyWaveSet::GetGeoAngleDev() const // -------------------------------------------------------------------------------- -hsScalar pyWaveSet::GetTexMaxLength() const +float pyWaveSet::GetTexMaxLength() const { if (fWaterKey) { @@ -564,7 +564,7 @@ hsScalar pyWaveSet::GetTexMaxLength() const return -1; } -hsScalar pyWaveSet::GetTexMinLength() const +float pyWaveSet::GetTexMinLength() const { if (fWaterKey) { @@ -578,7 +578,7 @@ hsScalar pyWaveSet::GetTexMinLength() const return -1; } -hsScalar pyWaveSet::GetTexAmpOverLen() const +float pyWaveSet::GetTexAmpOverLen() const { if (fWaterKey) { @@ -592,7 +592,7 @@ hsScalar pyWaveSet::GetTexAmpOverLen() const return -1; } -hsScalar pyWaveSet::GetTexChop() const +float pyWaveSet::GetTexChop() const { if (fWaterKey) { @@ -606,7 +606,7 @@ hsScalar pyWaveSet::GetTexChop() const return -1; } -hsScalar pyWaveSet::GetTexAngleDev() const +float pyWaveSet::GetTexAngleDev() const { if (fWaterKey) { @@ -622,7 +622,7 @@ hsScalar pyWaveSet::GetTexAngleDev() const // -------------------------------------------------------------------------------- -hsScalar pyWaveSet::GetRippleScale() const +float pyWaveSet::GetRippleScale() const { if (fWaterKey) { @@ -654,7 +654,7 @@ PyObject* pyWaveSet::GetWindDir() const // -------------------------------------------------------------------------------- -hsScalar pyWaveSet::GetSpecularNoise() const +float pyWaveSet::GetSpecularNoise() const { if (fWaterKey) { @@ -668,7 +668,7 @@ hsScalar pyWaveSet::GetSpecularNoise() const return -1; } -hsScalar pyWaveSet::GetSpecularStart() const +float pyWaveSet::GetSpecularStart() const { if (fWaterKey) { @@ -682,7 +682,7 @@ hsScalar pyWaveSet::GetSpecularStart() const return -1; } -hsScalar pyWaveSet::GetSpecularEnd() const +float pyWaveSet::GetSpecularEnd() const { if (fWaterKey) { @@ -698,7 +698,7 @@ hsScalar pyWaveSet::GetSpecularEnd() const // -------------------------------------------------------------------------------- -hsScalar pyWaveSet::GetWaterHeight() const +float pyWaveSet::GetWaterHeight() const { if (fWaterKey) { @@ -728,7 +728,7 @@ PyObject* pyWaveSet::GetWaterOffset() const PYTHON_RETURN_NONE; } -hsScalar pyWaveSet::GetOpacOffset() const +float pyWaveSet::GetOpacOffset() const { if (fWaterKey) { @@ -742,7 +742,7 @@ hsScalar pyWaveSet::GetOpacOffset() const return -1; } -hsScalar pyWaveSet::GetReflOffset() const +float pyWaveSet::GetReflOffset() const { if (fWaterKey) { @@ -756,7 +756,7 @@ hsScalar pyWaveSet::GetReflOffset() const return -1; } -hsScalar pyWaveSet::GetWaveOffset() const +float pyWaveSet::GetWaveOffset() const { if (fWaterKey) { @@ -784,7 +784,7 @@ PyObject* pyWaveSet::GetDepthFalloff() const PYTHON_RETURN_NONE; } -hsScalar pyWaveSet::GetOpacFalloff() const +float pyWaveSet::GetOpacFalloff() const { if (fWaterKey) { @@ -798,7 +798,7 @@ hsScalar pyWaveSet::GetOpacFalloff() const return -1; } -hsScalar pyWaveSet::GetReflFalloff() const +float pyWaveSet::GetReflFalloff() const { if (fWaterKey) { @@ -812,7 +812,7 @@ hsScalar pyWaveSet::GetReflFalloff() const return -1; } -hsScalar pyWaveSet::GetWaveFalloff() const +float pyWaveSet::GetWaveFalloff() const { if (fWaterKey) { @@ -872,7 +872,7 @@ PyObject* pyWaveSet::GetWaterTint() const PYTHON_RETURN_NONE; } -hsScalar pyWaveSet::GetWaterOpacity() const +float pyWaveSet::GetWaterOpacity() const { if (fWaterKey) { @@ -900,7 +900,7 @@ PyObject* pyWaveSet::GetSpecularTint() const PYTHON_RETURN_NONE; } -hsScalar pyWaveSet::GetSpecularMute() const +float pyWaveSet::GetSpecularMute() const { if (fWaterKey) { @@ -930,7 +930,7 @@ PyObject* pyWaveSet::GetEnvCenter() const PYTHON_RETURN_NONE; } -hsScalar pyWaveSet::GetEnvRadius() const +float pyWaveSet::GetEnvRadius() const { if (fWaterKey) { diff --git a/Sources/Plasma/FeatureLib/pfPython/pyWaveSet.h b/Sources/Plasma/FeatureLib/pfPython/pyWaveSet.h index 51d98f35..e9c095e3 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyWaveSet.h +++ b/Sources/Plasma/FeatureLib/pfPython/pyWaveSet.h @@ -111,108 +111,108 @@ public: // Geometric wave parameters. These are all safe to twiddle at any time or speed. // The new settings take effect as new waves are spawned. - void SetGeoMaxLength(hsScalar s, hsScalar secs=0); - void SetGeoMinLength(hsScalar s, hsScalar secs=0); - void SetGeoAmpOverLen(hsScalar s, hsScalar secs=0); - void SetGeoChop(hsScalar s, hsScalar secs=0); - void SetGeoAngleDev(hsScalar s, hsScalar secs=0); + void SetGeoMaxLength(float s, float secs=0); + void SetGeoMinLength(float s, float secs=0); + void SetGeoAmpOverLen(float s, float secs=0); + void SetGeoChop(float s, float secs=0); + void SetGeoAngleDev(float s, float secs=0); // Texture wave parameters. Safe to twiddle any time or speed. // The new settings take effect as new waves are spawned. - void SetTexMaxLength(hsScalar s, hsScalar secs=0); - void SetTexMinLength(hsScalar s, hsScalar secs=0); - void SetTexAmpOverLen(hsScalar s, hsScalar secs=0); - void SetTexChop(hsScalar s, hsScalar secs=0); - void SetTexAngleDev(hsScalar s, hsScalar secs=0); + void SetTexMaxLength(float s, float secs=0); + void SetTexMinLength(float s, float secs=0); + void SetTexAmpOverLen(float s, float secs=0); + void SetTexChop(float s, float secs=0); + void SetTexAngleDev(float s, float secs=0); // The size in feet of one tile of the ripple texture. If you change this (I don't // recommend it), you need to change it very slowly or it will look very stupid. - void SetRippleScale(hsScalar s, hsScalar secs=0); + void SetRippleScale(float s, float secs=0); // The direction the wind is blowing (waves will be more or less perpindicular to wind dir). // Change somewhat slowly, like over 30 seconds. - void SetWindDir(const pyVector3& s, hsScalar secs=0); + void SetWindDir(const pyVector3& s, float secs=0); // Change these gently, effect is immediate. - void SetSpecularNoise(hsScalar s, hsScalar secs=0); - void SetSpecularStart(hsScalar s, hsScalar secs=0); - void SetSpecularEnd(hsScalar s, hsScalar secs=0); + void SetSpecularNoise(float s, float secs=0); + void SetSpecularStart(float s, float secs=0); + void SetSpecularEnd(float s, float secs=0); // Water Height is overriden if the ref object is animated. - void SetWaterHeight(hsScalar s, hsScalar secs=0); + void SetWaterHeight(float s, float secs=0); // Water Offset and DepthFalloff are complicated, and not immediately interesting to animate. - void SetWaterOffset(const pyVector3& s, hsScalar secs=0); - void SetOpacOffset(hsScalar s, hsScalar secs=0); - void SetReflOffset(hsScalar s, hsScalar secs=0); - void SetWaveOffset(hsScalar s, hsScalar secs=0); - void SetDepthFalloff(const pyVector3& s, hsScalar secs=0); - void SetOpacFalloff(hsScalar s, hsScalar secs=0); - void SetReflFalloff(hsScalar s, hsScalar secs=0); - void SetWaveFalloff(hsScalar s, hsScalar secs=0); + void SetWaterOffset(const pyVector3& s, float secs=0); + void SetOpacOffset(float s, float secs=0); + void SetReflOffset(float s, float secs=0); + void SetWaveOffset(float s, float secs=0); + void SetDepthFalloff(const pyVector3& s, float secs=0); + void SetOpacFalloff(float s, float secs=0); + void SetReflFalloff(float s, float secs=0); + void SetWaveFalloff(float s, float secs=0); // Max and Min Atten aren't very interesting, and will probably go away. - void SetMaxAtten(const pyVector3& s, hsScalar secs=0); - void SetMinAtten(const pyVector3& s, hsScalar secs=0); + void SetMaxAtten(const pyVector3& s, float secs=0); + void SetMinAtten(const pyVector3& s, float secs=0); // Water colors, adjust slowly, effect is immediate. - void SetWaterTint(pyColor& s, hsScalar secs=0); - void SetWaterOpacity(hsScalar s, hsScalar secs=0); - void SetSpecularTint(pyColor& s, hsScalar secs=0); - void SetSpecularMute(hsScalar s, hsScalar secs=0); + void SetWaterTint(pyColor& s, float secs=0); + void SetWaterOpacity(float s, float secs=0); + void SetSpecularTint(pyColor& s, float secs=0); + void SetSpecularMute(float s, float secs=0); // The environment map is essentially projected onto a sphere. Moving the center of // the sphere north will move the reflections north, changing the radius of the // sphere effects parallax in the obvious way. - void SetEnvCenter(const pyPoint3& s, hsScalar secs=0); - void SetEnvRadius(hsScalar s, hsScalar secs=0); + void SetEnvCenter(const pyPoint3& s, float secs=0); + void SetEnvRadius(float s, float secs=0); // ============================================================================== // Get functions // ============================================================================== - hsScalar GetGeoMaxLength() const; - hsScalar GetGeoMinLength() const; - hsScalar GetGeoAmpOverLen() const; - hsScalar GetGeoChop() const; - hsScalar GetGeoAngleDev() const; + float GetGeoMaxLength() const; + float GetGeoMinLength() const; + float GetGeoAmpOverLen() const; + float GetGeoChop() const; + float GetGeoAngleDev() const; - hsScalar GetTexMaxLength() const; - hsScalar GetTexMinLength() const; - hsScalar GetTexAmpOverLen() const; - hsScalar GetTexChop() const; - hsScalar GetTexAngleDev() const; + float GetTexMaxLength() const; + float GetTexMinLength() const; + float GetTexAmpOverLen() const; + float GetTexChop() const; + float GetTexAngleDev() const; - hsScalar GetRippleScale() const; + float GetRippleScale() const; PyObject* GetWindDir() const; // returns pyVector3 - hsScalar GetSpecularNoise() const; - hsScalar GetSpecularStart() const; - hsScalar GetSpecularEnd() const; + float GetSpecularNoise() const; + float GetSpecularStart() const; + float GetSpecularEnd() const; - hsScalar GetWaterHeight() const; + float GetWaterHeight() const; PyObject* GetWaterOffset() const; // returns pyVector3 - hsScalar GetOpacOffset() const; - hsScalar GetReflOffset() const; - hsScalar GetWaveOffset() const; + float GetOpacOffset() const; + float GetReflOffset() const; + float GetWaveOffset() const; PyObject* GetDepthFalloff() const; // returns pyVector3 - hsScalar GetOpacFalloff() const; - hsScalar GetReflFalloff() const; - hsScalar GetWaveFalloff() const; + float GetOpacFalloff() const; + float GetReflFalloff() const; + float GetWaveFalloff() const; PyObject* GetMaxAtten() const; // returns pyVector3 PyObject* GetMinAtten() const; // returns pyVector3 PyObject* GetWaterTint() const; // returns pyColor - hsScalar GetWaterOpacity() const; + float GetWaterOpacity() const; PyObject* GetSpecularTint() const; // returns pyColor - hsScalar GetSpecularMute() const; + float GetSpecularMute() const; PyObject* GetEnvCenter() const; // returns pyPoint3 - hsScalar GetEnvRadius() const; + float GetEnvRadius() const; }; diff --git a/Sources/Plasma/FeatureLib/pfSecurePreloader/pfSecurePreloader.cpp b/Sources/Plasma/FeatureLib/pfSecurePreloader/pfSecurePreloader.cpp index 982d90d7..158069a4 100644 --- a/Sources/Plasma/FeatureLib/pfSecurePreloader/pfSecurePreloader.cpp +++ b/Sources/Plasma/FeatureLib/pfSecurePreloader/pfSecurePreloader.cpp @@ -77,7 +77,7 @@ void GotAuthSrvManifest( ENetError result, void* param, const NetCliAuthFileInfo infoArr[], - UInt32 infoCount + uint32_t infoCount ) { AuthRequestParams* arp = (AuthRequestParams*)param; if (IS_NET_ERROR(result)) @@ -96,7 +96,7 @@ void GotFileSrvManifest( void* param, const wchar_t group[], const NetCliFileManifestEntry manifest[], - UInt32 entryCount + uint32_t entryCount ) { pfSecurePreloader* sp = (pfSecurePreloader*)param; if (result == kNetErrFileNotFound) @@ -168,18 +168,18 @@ public: } hsBool AtEnd() { return fOutput->AtEnd(); } - UInt32 GetEOF() { return fOutput->GetEOF(); } - UInt32 GetPosition() const { return fOutput->GetPosition(); } - UInt32 GetSizeLeft() const { return fOutput->GetSizeLeft(); } - UInt32 Read(UInt32 count, void* buf) { return fOutput->Read(count, buf); } + uint32_t GetEOF() { return fOutput->GetEOF(); } + uint32_t GetPosition() const { return fOutput->GetPosition(); } + uint32_t GetSizeLeft() const { return fOutput->GetSizeLeft(); } + uint32_t Read(uint32_t count, void* buf) { return fOutput->Read(count, buf); } void Rewind() { fOutput->Rewind(); } - void SetPosition(UInt32 pos) { fOutput->SetPosition(pos); } - void Skip(UInt32 deltaByteCount) { fOutput->Skip(deltaByteCount); } + void SetPosition(uint32_t pos) { fOutput->SetPosition(pos); } + void Skip(uint32_t deltaByteCount) { fOutput->Skip(deltaByteCount); } - UInt32 Write(UInt32 count, const void* buf) + uint32_t Write(uint32_t count, const void* buf) { if (fProgress) - fProgress->Increment((hsScalar)count); + fProgress->Increment((float)count); if (fIsZipped) return plZlibStream::Write(count, buf); else @@ -217,9 +217,9 @@ hsRAMStream* pfSecurePreloader::LoadToMemory(const wchar_t* file) const hsRAMStream* ram = new hsRAMStream; s.Open(file); - UInt32 loadLen = 1024 * 1024; - UInt8* buf = new UInt8[loadLen]; - while (UInt32 read = s.Read(loadLen, buf)) + uint32_t loadLen = 1024 * 1024; + uint8_t* buf = new uint8_t[loadLen]; + while (uint32_t read = s.Read(loadLen, buf)) ram->Write(read, buf); delete[] buf; @@ -232,12 +232,12 @@ void pfSecurePreloader::SaveFile(hsStream* file, const wchar_t* name) const { hsUNIXStream s; s.Open(name, L"wb"); - UInt32 pos = file->GetPosition(); + uint32_t pos = file->GetPosition(); file->Rewind(); - UInt32 loadLen = 1024 * 1024; - UInt8* buf = new UInt8[loadLen]; - while (UInt32 read = file->Read(loadLen, buf)) + uint32_t loadLen = 1024 * 1024; + uint8_t* buf = new uint8_t[loadLen]; + while (uint32_t read = file->Read(loadLen, buf)) s.Write(read, buf); file->SetPosition(pos); s.Close(); @@ -326,14 +326,14 @@ void pfSecurePreloader::Shutdown() UnRegisterAs(kSecurePreloader_KEY); } -void pfSecurePreloader::PreloadManifest(const NetCliAuthFileInfo manifestEntries[], UInt32 entryCount) +void pfSecurePreloader::PreloadManifest(const NetCliAuthFileInfo manifestEntries[], uint32_t entryCount) { - UInt32 totalBytes = 0; + uint32_t totalBytes = 0; if (fProgress) - totalBytes = (UInt32)fProgress->GetMax(); + totalBytes = (uint32_t)fProgress->GetMax(); fLegacyMode = true; - for (UInt32 i = 0; i < entryCount; ++i) + for (uint32_t i = 0; i < entryCount; ++i) { const NetCliAuthFileInfo mfs = manifestEntries[i]; fDownloadEntries.push(wcsdup(mfs.filename)); @@ -351,15 +351,15 @@ void pfSecurePreloader::PreloadManifest(const NetCliAuthFileInfo manifestEntries if (fProgress) { - fProgress->SetLength((hsScalar)totalBytes); + fProgress->SetLength((float)totalBytes); fProgress->SetTitle("Downloading..."); } } -void pfSecurePreloader::PreloadManifest(const NetCliFileManifestEntry manifestEntries[], UInt32 entryCount) +void pfSecurePreloader::PreloadManifest(const NetCliFileManifestEntry manifestEntries[], uint32_t entryCount) { - UInt32 totalBytes = 0; - for (UInt32 i = 0; i < entryCount; ++i) + uint32_t totalBytes = 0; + for (uint32_t i = 0; i < entryCount; ++i) { const NetCliFileManifestEntry mfs = manifestEntries[i]; bool fetchMe = true; @@ -402,7 +402,7 @@ void pfSecurePreloader::PreloadManifest(const NetCliFileManifestEntry manifestEn if (totalBytes && fProgress) { - fProgress->SetLength((hsScalar)totalBytes); + fProgress->SetLength((float)totalBytes); fProgress->SetTitle("Downloading..."); } diff --git a/Sources/Plasma/FeatureLib/pfSecurePreloader/pfSecurePreloader.h b/Sources/Plasma/FeatureLib/pfSecurePreloader/pfSecurePreloader.h index 56c9d962..2dd33019 100644 --- a/Sources/Plasma/FeatureLib/pfSecurePreloader/pfSecurePreloader.h +++ b/Sources/Plasma/FeatureLib/pfSecurePreloader/pfSecurePreloader.h @@ -63,7 +63,7 @@ private: std::queue fManifestEntries; std::queue fDownloadEntries; plOperationProgress* fProgress; - UInt32 fEncryptionKey[4]; + uint32_t fEncryptionKey[4]; bool fLegacyMode; hsRAMStream* LoadToMemory(const wchar_t* file) const; @@ -83,8 +83,8 @@ public: void Finish(); void Shutdown(); - void PreloadManifest(const NetCliFileManifestEntry manifestEntries[], UInt32 entryCount); - void PreloadManifest(const NetCliAuthFileInfo manifestEntries[], UInt32 entryCount); + void PreloadManifest(const NetCliFileManifestEntry manifestEntries[], uint32_t entryCount); + void PreloadManifest(const NetCliAuthFileInfo manifestEntries[], uint32_t entryCount); void PreloadNextFile(); void FilePreloaded(const wchar_t* filename, hsStream* stream); diff --git a/Sources/Plasma/FeatureLib/pfStackTrace/pfArray.h b/Sources/Plasma/FeatureLib/pfStackTrace/pfArray.h index 523aebf5..173fd7d3 100644 --- a/Sources/Plasma/FeatureLib/pfStackTrace/pfArray.h +++ b/Sources/Plasma/FeatureLib/pfStackTrace/pfArray.h @@ -101,7 +101,7 @@ private: cap = m_cap*2; m_cap = cap; - T* data = TRACKED_NEW T[cap]; + T* data = new T[cap]; for ( int i = 0 ; i < m_len ; ++i ) data[i] = m_data[i]; delete[] m_data; diff --git a/Sources/Plasma/FeatureLib/pfStackTrace/pfMapFile.cpp b/Sources/Plasma/FeatureLib/pfStackTrace/pfMapFile.cpp index 8a714532..67ef6460 100644 --- a/Sources/Plasma/FeatureLib/pfStackTrace/pfMapFile.cpp +++ b/Sources/Plasma/FeatureLib/pfStackTrace/pfMapFile.cpp @@ -6,9 +6,6 @@ #include #include #include -#ifdef WIN32 -#include -#endif //----------------------------------------------------------------------------- @@ -226,7 +223,7 @@ private: MapFile::MapFile( const char* filename ) { - m_this = TRACKED_NEW MapFileImpl( filename ); + m_this = new MapFileImpl( filename ); } MapFile::~MapFile() diff --git a/Sources/Plasma/FeatureLib/pfStackTrace/pfTextFile.cpp b/Sources/Plasma/FeatureLib/pfStackTrace/pfTextFile.cpp index a353f4c2..1d69377a 100644 --- a/Sources/Plasma/FeatureLib/pfStackTrace/pfTextFile.cpp +++ b/Sources/Plasma/FeatureLib/pfStackTrace/pfTextFile.cpp @@ -192,7 +192,7 @@ private: TextFile::TextFile( const char* filename ) { - m_this = TRACKED_NEW TextFileImpl( filename ); + m_this = new TextFileImpl( filename ); } TextFile::~TextFile() diff --git a/Sources/Plasma/FeatureLib/pfSurface/plDistOpacityMod.cpp b/Sources/Plasma/FeatureLib/pfSurface/plDistOpacityMod.cpp index 3dd4bb7c..2bade2b5 100644 --- a/Sources/Plasma/FeatureLib/pfSurface/plDistOpacityMod.cpp +++ b/Sources/Plasma/FeatureLib/pfSurface/plDistOpacityMod.cpp @@ -41,7 +41,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "plDistOpacityMod.h" @@ -89,9 +89,9 @@ void plDistOpacityMod::SetKey(plKey k) } -hsScalar plDistOpacityMod::ICalcOpacity(const hsPoint3& targPos, const hsPoint3& refPos) const +float plDistOpacityMod::ICalcOpacity(const hsPoint3& targPos, const hsPoint3& refPos) const { - hsScalar dist = hsVector3(&targPos, &refPos).Magnitude(); + float dist = hsVector3(&targPos, &refPos).Magnitude(); if( dist > fDists[kFarTrans] ) return 0; @@ -129,7 +129,7 @@ void plDistOpacityMod::ISetOpacity() if( !fSetup ) ISetup(); - hsScalar opacity = ICalcOpacity(GetTarget()->GetLocalToWorld().GetTranslate(), fRefPos); + float opacity = ICalcOpacity(GetTarget()->GetLocalToWorld().GetTranslate(), fRefPos); const int num = fFadeLays.GetCount(); int i; @@ -209,7 +209,7 @@ void plDistOpacityMod::SetTarget(plSceneObject* so) fSetup = false; } -void plDistOpacityMod::SetFarDist(hsScalar opaque, hsScalar transparent) +void plDistOpacityMod::SetFarDist(float opaque, float transparent) { fDists[kFarOpaq] = opaque; fDists[kFarTrans] = transparent; @@ -217,7 +217,7 @@ void plDistOpacityMod::SetFarDist(hsScalar opaque, hsScalar transparent) ICheckDists(); } -void plDistOpacityMod::SetNearDist(hsScalar transparent, hsScalar opaque) +void plDistOpacityMod::SetNearDist(float transparent, float opaque) { fDists[kNearOpaq] = opaque; fDists[kNearTrans] = transparent; @@ -291,7 +291,7 @@ void plDistOpacityMod::ISetup() hsGMaterial* mat = todo[i].fMat; plLayerInterface* lay = todo[i].fLay; - plFadeOpacityLay* fade = TRACKED_NEW plFadeOpacityLay; + plFadeOpacityLay* fade = new plFadeOpacityLay; hsgResMgr::ResMgr()->NewKey(lay->GetKey()->GetName(), fade, lay->GetKey()->GetUoid().GetLocation()); @@ -300,11 +300,11 @@ void plDistOpacityMod::ISetup() // We should add a ref or something here if we're going to hold on to this (even though we created and "own" it). fFadeLays.Append(fade); - plMatRefMsg* msg = TRACKED_NEW plMatRefMsg(mat->GetKey(), plRefMsg::kOnReplace, i, plMatRefMsg::kLayer); + plMatRefMsg* msg = new plMatRefMsg(mat->GetKey(), plRefMsg::kOnReplace, i, plMatRefMsg::kLayer); msg->SetOldRef(lay); hsgResMgr::ResMgr()->SendRef(fade, msg, plRefFlags::kActiveRef); - plGenRefMsg* toMe = TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnRequest, 0, kRefFadeLay); + plGenRefMsg* toMe = new plGenRefMsg(GetKey(), plRefMsg::kOnRequest, 0, kRefFadeLay); hsgResMgr::ResMgr()->SendRef(fade, toMe, plRefFlags::kPassiveRef); } diff --git a/Sources/Plasma/FeatureLib/pfSurface/plDistOpacityMod.h b/Sources/Plasma/FeatureLib/pfSurface/plDistOpacityMod.h index b30ac1bc..61683bb6 100644 --- a/Sources/Plasma/FeatureLib/pfSurface/plDistOpacityMod.h +++ b/Sources/Plasma/FeatureLib/pfSurface/plDistOpacityMod.h @@ -67,7 +67,7 @@ protected: }; // Volatile flag, whether we're setup yet or not. - UInt8 fSetup; + uint8_t fSetup; enum { kNearTrans, @@ -77,16 +77,16 @@ protected: kNumDists }; - hsScalar fDists[kNumDists]; + float fDists[kNumDists]; hsPoint3 fRefPos; hsTArray fFadeLays; // We only act in response to messages. - virtual hsBool IEval(double secs, hsScalar del, UInt32 dirty) { return false; } + virtual hsBool IEval(double secs, float del, uint32_t dirty) { return false; } - hsScalar ICalcOpacity(const hsPoint3& targPos, const hsPoint3& refPos) const; + float ICalcOpacity(const hsPoint3& targPos, const hsPoint3& refPos) const; void ISetOpacity(); void ISetup(); @@ -116,13 +116,13 @@ public: // Rules are: // NearTrans <= NearOpaq <= FarOpaque <= FarTrans - void SetFarDist(hsScalar opaque, hsScalar transparent); - void SetNearDist(hsScalar transparent, hsScalar opaque); + void SetFarDist(float opaque, float transparent); + void SetNearDist(float transparent, float opaque); - hsScalar GetFarTransparent() const { return fDists[kFarTrans]; } - hsScalar GetNearTransparent() const { return fDists[kNearTrans]; } - hsScalar GetFarOpaque() const { return fDists[kFarOpaq]; } - hsScalar GetNearOpaque() const { return fDists[kNearOpaq]; } + float GetFarTransparent() const { return fDists[kFarTrans]; } + float GetNearTransparent() const { return fDists[kNearTrans]; } + float GetFarOpaque() const { return fDists[kFarOpaq]; } + float GetNearOpaque() const { return fDists[kNearOpaq]; } }; #endif // plDistOpacityMod_inc diff --git a/Sources/Plasma/FeatureLib/pfSurface/plFadeOpacityLay.cpp b/Sources/Plasma/FeatureLib/pfSurface/plFadeOpacityLay.cpp index aefb4f77..a94ae0dc 100644 --- a/Sources/Plasma/FeatureLib/pfSurface/plFadeOpacityLay.cpp +++ b/Sources/Plasma/FeatureLib/pfSurface/plFadeOpacityLay.cpp @@ -40,7 +40,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "plFadeOpacityLay.h" @@ -48,16 +48,16 @@ plFadeOpacityLay::plFadeOpacityLay() : fOpScale(1.f) { fOwnedChannels |= kOpacity; - fOpacity = TRACKED_NEW hsScalar; + fOpacity = new float; } plFadeOpacityLay::~plFadeOpacityLay() { } -UInt32 plFadeOpacityLay::Eval(double secs, UInt32 frame, UInt32 ignore) +uint32_t plFadeOpacityLay::Eval(double secs, uint32_t frame, uint32_t ignore) { - UInt32 ret = plLayerInterface::Eval(secs, frame, ignore); + uint32_t ret = plLayerInterface::Eval(secs, frame, ignore); if( fUnderLay ) { diff --git a/Sources/Plasma/FeatureLib/pfSurface/plFadeOpacityLay.h b/Sources/Plasma/FeatureLib/pfSurface/plFadeOpacityLay.h index b787a2fa..47d6cef0 100644 --- a/Sources/Plasma/FeatureLib/pfSurface/plFadeOpacityLay.h +++ b/Sources/Plasma/FeatureLib/pfSurface/plFadeOpacityLay.h @@ -50,7 +50,7 @@ class plFadeOpacityLay : public plLayerInterface { protected: - hsScalar fOpScale; + float fOpScale; public: plFadeOpacityLay(); @@ -59,13 +59,13 @@ public: CLASSNAME_REGISTER( plFadeOpacityLay ); GETINTERFACE_ANY( plFadeOpacityLay, plLayerInterface ); - virtual UInt32 Eval(double secs, UInt32 frame, UInt32 ignore); + virtual uint32_t Eval(double secs, uint32_t frame, uint32_t ignore); virtual void Read(hsStream* s, hsResMgr* mgr); virtual void Write(hsStream* s, hsResMgr* mgr); - void SetOpacity(hsScalar f) { fOpScale = f; } - hsScalar GetOpacity() const { return fOpScale; } + void SetOpacity(float f) { fOpScale = f; } + float GetOpacity() const { return fOpScale; } }; #endif // plFadeOpacityLay_inc diff --git a/Sources/Plasma/FeatureLib/pfSurface/plFadeOpacityMod.cpp b/Sources/Plasma/FeatureLib/pfSurface/plFadeOpacityMod.cpp index 306299ad..79e32e30 100644 --- a/Sources/Plasma/FeatureLib/pfSurface/plFadeOpacityMod.cpp +++ b/Sources/Plasma/FeatureLib/pfSurface/plFadeOpacityMod.cpp @@ -40,7 +40,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "plFadeOpacityMod.h" #include "plFadeOpacityLay.h" @@ -83,8 +83,8 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com hsBool plFadeOpacityMod::fLOSCheckDisabled = false; -const hsScalar kDefFadeUp(5.f); -const hsScalar kDefFadeDown(1.f); +const float kDefFadeUp(5.f); +const float kDefFadeDown(1.f); plFadeOpacityMod::plFadeOpacityMod() : fFadeUp(kDefFadeUp), @@ -178,7 +178,7 @@ void plFadeOpacityMod::IOnRenderMsg(plRenderMsg* rend) { // If we've moved more than 3 feet in a frame, we'll consider this a // camera cut. In that case, don't fade up or down, just go there. - const hsScalar kCutMagSquared = 3.f * 3.f; + const float kCutMagSquared = 3.f * 3.f; if( hsVector3(&eyePos, &fLastEye).MagnitudeSquared() > kCutMagSquared ) fFade = kImmediate; } @@ -237,7 +237,7 @@ void plFadeOpacityMod::ICalcOpacity() switch( fFade ) { case kFadeUp: - fOpCurrent = (hsScalar)(t - fStart); + fOpCurrent = (float)(t - fStart); if( fOpCurrent > fFadeUp ) { fOpCurrent = 1.f; @@ -249,7 +249,7 @@ void plFadeOpacityMod::ICalcOpacity() } break; case kFadeDown: - fOpCurrent = (hsScalar)(t - fStart); + fOpCurrent = (float)(t - fStart); if( fOpCurrent > fFadeDown ) { fOpCurrent = 0.f; @@ -366,7 +366,7 @@ void plFadeOpacityMod::ISetup(plSceneObject* so) plLayerInterface* lay = mat->GetLayer(j); if( !j || !(lay->GetZFlags() & hsGMatState::kZNoZWrite) || (lay->GetMiscFlags() & hsGMatState::kMiscRestartPassHere) ) { - plFadeOpacityLay* fade = NEW(plFadeOpacityLay); + plFadeOpacityLay* fade = new plFadeOpacityLay(); hsgResMgr::ResMgr()->NewKey(lay->GetKey()->GetName(), fade, lay->GetKey()->GetUoid().GetLocation()); @@ -375,11 +375,11 @@ void plFadeOpacityMod::ISetup(plSceneObject* so) // We should add a ref or something here if we're going to hold on to this (even though we created and "own" it). fFadeLays.Append(fade); - plMatRefMsg* msg = NEW(plMatRefMsg)(mat->GetKey(), plRefMsg::kOnReplace, i, plMatRefMsg::kLayer); + plMatRefMsg* msg = new plMatRefMsg(mat->GetKey(), plRefMsg::kOnReplace, i, plMatRefMsg::kLayer); msg->SetOldRef(lay); hsgResMgr::ResMgr()->SendRef(fade, msg, plRefFlags::kActiveRef); - plGenRefMsg* toMe = NEW(plGenRefMsg)(GetKey(), plRefMsg::kOnRequest, 0, kRefFadeLay); + plGenRefMsg* toMe = new plGenRefMsg(GetKey(), plRefMsg::kOnRequest, 0, kRefFadeLay); hsgResMgr::ResMgr()->SendRef(fade, toMe, plRefFlags::kPassiveRef); } } diff --git a/Sources/Plasma/FeatureLib/pfSurface/plFadeOpacityMod.h b/Sources/Plasma/FeatureLib/pfSurface/plFadeOpacityMod.h index 45559234..6693ae7d 100644 --- a/Sources/Plasma/FeatureLib/pfSurface/plFadeOpacityMod.h +++ b/Sources/Plasma/FeatureLib/pfSurface/plFadeOpacityMod.h @@ -65,8 +65,8 @@ protected: }; // Input parameters - hsScalar fFadeUp; - hsScalar fFadeDown; + float fFadeUp; + float fFadeDown; // Internal fade state enum FadeState { @@ -76,11 +76,11 @@ protected: kFadeDown = 3, kImmediate = 4 }; - hsScalar fOpCurrent; + float fOpCurrent; double fStart; FadeState fFade; - UInt8 fSetup; + uint8_t fSetup; hsPoint3 fLastEye; @@ -101,7 +101,7 @@ protected: void ISetup(plSceneObject* so); // We only act in response to messages. - virtual hsBool IEval(double secs, hsScalar del, UInt32 dirty) { return false; } + virtual hsBool IEval(double secs, float del, uint32_t dirty) { return false; } public: plFadeOpacityMod(); @@ -123,11 +123,11 @@ public: void FadeDown(); void Fade(hsBool up) { if( up ) FadeUp(); else FadeDown(); } - void SetFadeUp(hsScalar f) { fFadeUp = f; } - hsScalar GetFadeUp() const { return fFadeUp; } + void SetFadeUp(float f) { fFadeUp = f; } + float GetFadeUp() const { return fFadeUp; } - void SetFadeDown(hsScalar f) { fFadeDown = f; } - hsScalar GetFadeDown() const { return fFadeDown; } + void SetFadeDown(float f) { fFadeDown = f; } + float GetFadeDown() const { return fFadeDown; } static hsBool GetLOSCheckDisabled() { return fLOSCheckDisabled; } static void SetLOSCheckDisabled(hsBool on) { fLOSCheckDisabled = on; } diff --git a/Sources/Plasma/FeatureLib/pfSurface/plGrabCubeMap.cpp b/Sources/Plasma/FeatureLib/pfSurface/plGrabCubeMap.cpp index 7d6722c7..b03c156d 100644 --- a/Sources/Plasma/FeatureLib/pfSurface/plGrabCubeMap.cpp +++ b/Sources/Plasma/FeatureLib/pfSurface/plGrabCubeMap.cpp @@ -40,7 +40,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "plGrabCubeMap.h" @@ -87,7 +87,7 @@ void plGrabCubeRenderRequest::Render(plPipeline* pipe, plPageTreeMgr* pageMgr) } -void plGrabCubeMap::GrabCube(plPipeline* pipe, plSceneObject* obj, const char* pref, const hsColorRGBA& clearColor, UInt8 q) +void plGrabCubeMap::GrabCube(plPipeline* pipe, plSceneObject* obj, const char* pref, const hsColorRGBA& clearColor, uint8_t q) { hsPoint3 center; if( obj && !(obj->GetLocalToWorld().fFlags & hsMatrix44::kIsIdent) ) @@ -105,18 +105,18 @@ void plGrabCubeMap::GrabCube(plPipeline* pipe, plSceneObject* obj, const char* p ISetupRenderRequests(pipe, center, pref, clearColor, q); } -void plGrabCubeMap::GrabCube(plPipeline* pipe, const hsPoint3& center, const char* pref, const hsColorRGBA& clearColor, UInt8 q) +void plGrabCubeMap::GrabCube(plPipeline* pipe, const hsPoint3& center, const char* pref, const hsColorRGBA& clearColor, uint8_t q) { ISetupRenderRequests(pipe, center, pref, clearColor, q); } -void plGrabCubeMap::ISetupRenderRequests(plPipeline* pipe, const hsPoint3& center, const char* pref, const hsColorRGBA& clearColor, UInt8 q) const +void plGrabCubeMap::ISetupRenderRequests(plPipeline* pipe, const hsPoint3& center, const char* pref, const hsColorRGBA& clearColor, uint8_t q) const { hsMatrix44 worldToCameras[6]; hsMatrix44 cameraToWorlds[6]; hsMatrix44::MakeEnvMapMatrices(center, worldToCameras, cameraToWorlds); - UInt32 renderState + uint32_t renderState = plPipeline::kRenderNormal | plPipeline::kRenderClearColor | plPipeline::kRenderClearDepth; @@ -136,7 +136,7 @@ void plGrabCubeMap::ISetupRenderRequests(plPipeline* pipe, const hsPoint3& cente int i; for( i = 0; i < 6; i++ ) { - plGrabCubeRenderRequest* req = TRACKED_NEW plGrabCubeRenderRequest; + plGrabCubeRenderRequest* req = new plGrabCubeRenderRequest; req->SetRenderState(renderState); req->SetDrawableMask(plDrawable::kNormal); @@ -159,7 +159,7 @@ void plGrabCubeMap::ISetupRenderRequests(plPipeline* pipe, const hsPoint3& cente req->fQuality = q; sprintf(req->fFileName, "%s_%s.jpg", pref, suff[i]); - plRenderRequestMsg* reqMsg = TRACKED_NEW plRenderRequestMsg(nil, req); + plRenderRequestMsg* reqMsg = new plRenderRequestMsg(nil, req); reqMsg->Send(); hsRefCnt_SafeUnRef(req); } diff --git a/Sources/Plasma/FeatureLib/pfSurface/plGrabCubeMap.h b/Sources/Plasma/FeatureLib/pfSurface/plGrabCubeMap.h index d6273cd2..4879ed15 100644 --- a/Sources/Plasma/FeatureLib/pfSurface/plGrabCubeMap.h +++ b/Sources/Plasma/FeatureLib/pfSurface/plGrabCubeMap.h @@ -59,7 +59,7 @@ public: plGrabCubeRenderRequest(); char fFileName[256]; - UInt8 fQuality; + uint8_t fQuality; // This function is called after the render request is processed by the client virtual void Render(plPipeline* pipe, plPageTreeMgr* pageMgr); @@ -68,12 +68,12 @@ public: class plGrabCubeMap { protected: - void ISetupRenderRequests(plPipeline* pipe, const hsPoint3& center, const char* pref, const hsColorRGBA& clearColor, UInt8 q) const; + void ISetupRenderRequests(plPipeline* pipe, const hsPoint3& center, const char* pref, const hsColorRGBA& clearColor, uint8_t q) const; public: plGrabCubeMap() {} - void GrabCube(plPipeline* pipe, plSceneObject* obj, const char* pref, const hsColorRGBA& clearColor, UInt8 q=75); - void GrabCube(plPipeline* pipe, const hsPoint3& pos, const char* pref, const hsColorRGBA& clearColor, UInt8 q=75); + void GrabCube(plPipeline* pipe, plSceneObject* obj, const char* pref, const hsColorRGBA& clearColor, uint8_t q=75); + void GrabCube(plPipeline* pipe, const hsPoint3& pos, const char* pref, const hsColorRGBA& clearColor, uint8_t q=75); }; diff --git a/Sources/Plasma/FeatureLib/pfSurface/plLayerAVI.cpp b/Sources/Plasma/FeatureLib/pfSurface/plLayerAVI.cpp index 860b6e08..b8af5b07 100644 --- a/Sources/Plasma/FeatureLib/pfSurface/plLayerAVI.cpp +++ b/Sources/Plasma/FeatureLib/pfSurface/plLayerAVI.cpp @@ -40,19 +40,12 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ -#include "hsConfig.h" +#include "HeadSpin.h" #if HS_BUILD_FOR_WIN32 -#define WIN32_EXTRA_LEAN -#define WIN32_LEAN_AND_MEAN -#ifndef _WINDOWS_H_ // redundant include guard to minimize compile times -#define _WINDOWS_H_ -#include -#endif // _WINDOWS_H_ #include "vfw.h" #endif // HS_BUILD_FOR_WIN32 -#include "hsTypes.h" #include "plLayerAVI.h" #include "plGImage/plMipmap.h" @@ -79,7 +72,7 @@ static hsBool ICopySourceToTexture16(BITMAPINFO* bmi, plMi plLayerAVI::plLayerAVI() { - fAVIInfo = TRACKED_NEW plAVIFileInfo; + fAVIInfo = new plAVIFileInfo; } plLayerAVI::~plLayerAVI() @@ -114,8 +107,8 @@ hsBool plLayerAVI::IInit() return ISetFault("Can't get first frame"); ISetSize(bmi->bmiHeader.biWidth, bmi->bmiHeader.biHeight); - Int32 endFrame = fAVIInfo->fAVIStreamInfo.dwLength-1; - hsScalar length = float(endFrame) * float(fAVIInfo->fAVIStreamInfo.dwScale) + int32_t endFrame = fAVIInfo->fAVIStreamInfo.dwLength-1; + float length = float(endFrame) * float(fAVIInfo->fAVIStreamInfo.dwScale) / float(fAVIInfo->fAVIStreamInfo.dwRate); ISetLength(length); #endif @@ -123,14 +116,14 @@ hsBool plLayerAVI::IInit() return false; } -Int32 plLayerAVI::ISecsToFrame(hsScalar secs) +int32_t plLayerAVI::ISecsToFrame(float secs) { #if HS_BUILD_FOR_WIN32 float timeScale = float(fAVIInfo->fAVIStreamInfo.dwRate) / float(fAVIInfo->fAVIStreamInfo.dwScale); #else float timeScale = 1.0f; #endif - return Int32(secs * timeScale + 0.5f); + return int32_t(secs * timeScale + 0.5f); } hsBool plLayerAVI::IGetCurrentFrame() @@ -165,9 +158,9 @@ static hsBool ICopySourceToTexture16(BITMAPINFO* bmi, plMipmap* b) { hsAssert( b != nil, "nil mipmap passed to ICopySourceToTexture16()" ); - UInt16* pSrc = (UInt16*)( bmi->bmiHeader.biSize + (BYTE*)bmi ); + uint16_t* pSrc = (uint16_t*)( bmi->bmiHeader.biSize + (BYTE*)bmi ); - UInt32* pix = (UInt32*)b->GetImage(); + uint32_t* pix = (uint32_t*)b->GetImage(); pix += b->GetWidth() * b->GetHeight(); int width = bmi->bmiHeader.biWidth; @@ -178,11 +171,11 @@ static hsBool ICopySourceToTexture16(BITMAPINFO* bmi, plMipmap* b) int i; for( i = 0; i < useHeight; i++ ) { - UInt16* src = pSrc; + uint16_t* src = pSrc; pSrc += width; pix -= b->GetWidth(); - UInt32* tPix = pix; + uint32_t* tPix = pix; int j; for( j = 0; j < useWidth; j++ ) { diff --git a/Sources/Plasma/FeatureLib/pfSurface/plLayerAVI.h b/Sources/Plasma/FeatureLib/pfSurface/plLayerAVI.h index 3a421cd6..8fdab521 100644 --- a/Sources/Plasma/FeatureLib/pfSurface/plLayerAVI.h +++ b/Sources/Plasma/FeatureLib/pfSurface/plLayerAVI.h @@ -55,7 +55,7 @@ protected: hsBool ICloseMovie(); - virtual Int32 ISecsToFrame(hsScalar secs); + virtual int32_t ISecsToFrame(float secs); virtual hsBool IInit(); virtual hsBool IGetCurrentFrame(); virtual hsBool IRelease(); diff --git a/Sources/Plasma/FeatureLib/pfSurface/plLayerMovie.cpp b/Sources/Plasma/FeatureLib/pfSurface/plLayerMovie.cpp index 9f88a822..8a003f4b 100644 --- a/Sources/Plasma/FeatureLib/pfSurface/plLayerMovie.cpp +++ b/Sources/Plasma/FeatureLib/pfSurface/plLayerMovie.cpp @@ -40,11 +40,11 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "plLayerMovie.h" #include "hsStream.h" #include "hsResMgr.h" -#include "hsUtils.h" + #include "plMessage/plAnimCmdMsg.h" #include "plGImage/plMipmap.h" @@ -58,7 +58,7 @@ plLayerMovie::plLayerMovie() fHeight(32) { fOwnedChannels |= kTexture; - fTexture = TRACKED_NEW plBitmap*; + fTexture = new plBitmap*; *fTexture = nil; // fTimeConvert.SetOwner(this); @@ -82,7 +82,7 @@ hsBool plLayerMovie::ISetFault(const char* errStr) return true; } -hsBool plLayerMovie::ISetLength(hsScalar secs) +hsBool plLayerMovie::ISetLength(float secs) { fLength = secs; return false; @@ -111,7 +111,7 @@ hsBool plLayerMovie::ISetupBitmap() { if( !GetTexture() ) { - plMipmap* b = TRACKED_NEW plMipmap( fWidth, fHeight, plMipmap::kARGB32Config, 1 ); + plMipmap* b = new plMipmap( fWidth, fHeight, plMipmap::kARGB32Config, 1 ); memset(b->GetImage(), 0x10, b->GetHeight() * b->GetRowBytes() ); b->SetFlags( b->GetFlags() | plMipmap::kDontThrowAwayImage ); @@ -141,8 +141,8 @@ hsBool plLayerMovie::IMovieIsIdle() hsBool plLayerMovie::ICurrentFrameDirty(double wSecs) { - hsScalar secs = fTimeConvert.WorldToAnimTime(wSecs); - UInt32 frame = ISecsToFrame(secs); + float secs = fTimeConvert.WorldToAnimTime(wSecs); + uint32_t frame = ISecsToFrame(secs); if( frame == fCurrentFrame ) return false; fCurrentFrame = frame; @@ -150,9 +150,9 @@ hsBool plLayerMovie::ICurrentFrameDirty(double wSecs) return true; } -UInt32 plLayerMovie::Eval(double wSecs, UInt32 frame, UInt32 ignore) +uint32_t plLayerMovie::Eval(double wSecs, uint32_t frame, uint32_t ignore) { - UInt32 dirty = plLayerAnimation::Eval(wSecs, frame, ignore); + uint32_t dirty = plLayerAnimation::Eval(wSecs, frame, ignore); if( !IGetFault() && !(ignore & kTexture) ) { @@ -187,7 +187,7 @@ void plLayerMovie::Read(hsStream* s, hsResMgr* mgr) int len = s->ReadLE32(); if( len ) { - fMovieName = TRACKED_NEW char[len+1]; + fMovieName = new char[len+1]; s->Read(len, fMovieName); fMovieName[len] = 0; } diff --git a/Sources/Plasma/FeatureLib/pfSurface/plLayerMovie.h b/Sources/Plasma/FeatureLib/pfSurface/plLayerMovie.h index ebfeb91f..8778a592 100644 --- a/Sources/Plasma/FeatureLib/pfSurface/plLayerMovie.h +++ b/Sources/Plasma/FeatureLib/pfSurface/plLayerMovie.h @@ -57,11 +57,11 @@ protected: // plAnimTimeConvert fTimeConvert; - Int32 fCurrentFrame; - hsScalar fLength; - UInt32 fWidth, fHeight; + int32_t fCurrentFrame; + float fLength; + uint32_t fWidth, fHeight; - virtual Int32 ISecsToFrame(hsScalar secs) = 0; + virtual int32_t ISecsToFrame(float secs) = 0; hsBool IGetFault() const { return !(fMovieName && *fMovieName); } hsBool ISetFault(const char* errStr); @@ -69,7 +69,7 @@ protected: hsBool IMovieIsIdle(); // will call IRelease(); hsBool ISetupBitmap(); hsBool ISetSize(int w, int h); - hsBool ISetLength(hsScalar secs); + hsBool ISetLength(float secs); hsBool ICurrentFrameDirty(double wSecs); virtual hsBool IInit() = 0; // Load header etc, must call ISetSize(w, h), ISetLength(s) @@ -82,7 +82,7 @@ public: CLASSNAME_REGISTER( plLayerMovie ); GETINTERFACE_ANY( plLayerMovie, plLayerAnimation ); - virtual UInt32 Eval(double secs, UInt32 frame, UInt32 ignore); + virtual uint32_t Eval(double secs, uint32_t frame, uint32_t ignore); virtual void Read(hsStream* s, hsResMgr* mgr); virtual void Write(hsStream* s, hsResMgr* mgr); @@ -97,7 +97,7 @@ public: // Movie specific int GetWidth() const; int GetHeight() const; - hsScalar GetLength() const { return fLength; } + float GetLength() const { return fLength; } virtual void DefaultMovie(); }; diff --git a/Sources/Plasma/NucleusLib/inc/hsGMatState.h b/Sources/Plasma/NucleusLib/inc/hsGMatState.h index f890036f..df5ebf31 100644 --- a/Sources/Plasma/NucleusLib/inc/hsGMatState.h +++ b/Sources/Plasma/NucleusLib/inc/hsGMatState.h @@ -168,18 +168,18 @@ enum StateIdx { kZ, kMisc }; - UInt32 fBlendFlags; - UInt32 fClampFlags; - UInt32 fShadeFlags; - UInt32 fZFlags; - UInt32 fMiscFlags; + uint32_t fBlendFlags; + uint32_t fClampFlags; + uint32_t fShadeFlags; + uint32_t fZFlags; + uint32_t fMiscFlags; - static hsBool Differs(UInt32 mine, UInt32 hers, UInt32 mask) + static hsBool Differs(uint32_t mine, uint32_t hers, uint32_t mask) { return (mine & mask) ^ (hers & mask); } - static hsBool Differs(UInt32 mine, UInt32 hers) + static hsBool Differs(uint32_t mine, uint32_t hers) { return mine ^ hers; } @@ -192,7 +192,7 @@ enum StateIdx { | (fZFlags ^ other.fZFlags) | (fMiscFlags ^ other.fMiscFlags)); } - UInt32 Value(int i) const + uint32_t Value(int i) const { switch(i) { @@ -210,7 +210,7 @@ enum StateIdx { hsAssert(false, "Bad param"); return fBlendFlags; } - UInt32& operator[](const int i) + uint32_t& operator[](const int i) { switch(i) { @@ -254,7 +254,7 @@ enum StateIdx { inline void Read(hsStream* s); inline void Write(hsStream* s); - hsGMatState(UInt32 blend=0, UInt32 clamp=0, UInt32 shade=0, UInt32 z=0, UInt32 misc=0) + hsGMatState(uint32_t blend=0, uint32_t clamp=0, uint32_t shade=0, uint32_t z=0, uint32_t misc=0) : fBlendFlags(blend), fClampFlags(clamp), fShadeFlags(shade), diff --git a/Sources/Plasma/NucleusLib/inc/hsResMgr.h b/Sources/Plasma/NucleusLib/inc/hsResMgr.h index 9df9dfc4..b7f80d10 100644 --- a/Sources/Plasma/NucleusLib/inc/hsResMgr.h +++ b/Sources/Plasma/NucleusLib/inc/hsResMgr.h @@ -42,7 +42,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #ifndef hsResMgr_inc #define hsResMgr_inc -#include "hsTypes.h" +#include "HeadSpin.h" #include "hsRefCnt.h" #include "plLoadMask.h" #include "plRefFlags.h" diff --git a/Sources/Plasma/NucleusLib/inc/hsTimer.h b/Sources/Plasma/NucleusLib/inc/hsTimer.h index f85cd326..eb1cdcf6 100644 --- a/Sources/Plasma/NucleusLib/inc/hsTimer.h +++ b/Sources/Plasma/NucleusLib/inc/hsTimer.h @@ -43,11 +43,6 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #define hsTimer_Defined #include "hsWide.h" -#include "hsScalar.h" - -#if !HS_CAN_USE_FLOAT -#error "Unsupported without double's" -#endif // !HS_CAN_USE_FLOAT class plTimerShare { @@ -62,14 +57,14 @@ protected: double fSmoothBuff[kSmoothBuffLen]; int fCurrSlot; - hsScalar fSysTimeScale; + float fSysTimeScale; double fRealSeconds; double fSysSeconds; - hsScalar fDelSysSeconds; - hsScalar fFrameTimeInc; + float fDelSysSeconds; + float fFrameTimeInc; hsBool fRunningFrameTime; - hsScalar fTimeClampSecs; - hsScalar fSmoothingClampSecs; + float fTimeClampSecs; + float fSmoothingClampSecs; hsBool fClamping; hsWide* FactorInTimeZero(hsWide* ticks) const; @@ -82,21 +77,21 @@ protected: double RawTicksToDSeconds(const hsWide& ticks); hsWide DSecondsToRawTicks(double secs); - hsScalar GetDelSysSeconds() const { return fDelSysSeconds; } + float GetDelSysSeconds() const { return fDelSysSeconds; } double GetSysSeconds() const { return fSysSeconds; } double IncSysSeconds(); void SetRealTime(hsBool realTime); hsBool IsRealTime() const { return !fRunningFrameTime; } - void SetFrameTimeInc(hsScalar inc) { fFrameTimeInc = inc; } + void SetFrameTimeInc(float inc) { fFrameTimeInc = inc; } - void SetTimeScale(hsScalar s) { fSysTimeScale = s; } - hsScalar GetTimeScale() const { return fSysTimeScale; } + void SetTimeScale(float s) { fSysTimeScale = s; } + float GetTimeScale() const { return fSysTimeScale; } - void SetTimeClamp(hsScalar secs) { fTimeClampSecs = secs; } - void SetSmoothingCap(hsScalar secs) { fSmoothingClampSecs = secs; } - hsScalar GetTimeClamp() const { return fTimeClampSecs; } + void SetTimeClamp(float secs) { fTimeClampSecs = secs; } + void SetSmoothingCap(float secs) { fSmoothingClampSecs = secs; } + float GetTimeClamp() const { return fTimeClampSecs; } hsBool IsClamping() const { return fClamping; } friend class hsTimer; @@ -127,7 +122,7 @@ public: static double RawTicksToDSeconds(const hsWide& ticks) { return fTimer->RawTicksToDSeconds(ticks); } static hsWide DSecondsToRawTicks(double secs) { return fTimer->DSecondsToRawTicks(secs); } - static hsScalar GetDelSysSeconds() { return fTimer->GetDelSysSeconds(); } + static float GetDelSysSeconds() { return fTimer->GetDelSysSeconds(); } static double GetSysSeconds() { return fTimer->GetSysSeconds(); } static double IncSysSeconds() { return fTimer->IncSysSeconds(); } @@ -135,29 +130,29 @@ public: static void SetRealTime(hsBool realTime) { fTimer->SetRealTime(realTime); } static hsBool IsRealTime() { return fTimer->IsRealTime(); } - static void SetFrameTimeInc(hsScalar inc) { fTimer->SetFrameTimeInc(inc); } + static void SetFrameTimeInc(float inc) { fTimer->SetFrameTimeInc(inc); } - static void SetTimeScale(hsScalar s) { fTimer->SetTimeScale(s); } - static hsScalar GetTimeScale() { return fTimer->GetTimeScale(); } + static void SetTimeScale(float s) { fTimer->SetTimeScale(s); } + static float GetTimeScale() { return fTimer->GetTimeScale(); } - static void SetTimeClamp(hsScalar secs) { fTimer->SetTimeClamp(secs); } - static void SetTimeSmoothingClamp(hsScalar secs) { fTimer->SetSmoothingCap(secs); } - static hsScalar GetTimeClamp() { return fTimer->GetTimeClamp(); } + static void SetTimeClamp(float secs) { fTimer->SetTimeClamp(secs); } + static void SetTimeSmoothingClamp(float secs) { fTimer->SetSmoothingCap(secs); } + static float GetTimeClamp() { return fTimer->GetTimeClamp(); } static hsBool IsClamping() { return fTimer->IsClamping(); } /////////////////////////// // Precision timer routines - these are stateless and implemented as statics. /////////////////////////// - static UInt32 GetPrecTickCount(); + static uint32_t GetPrecTickCount(); static double GetPrecTicksPerSec(); - static UInt32 PrecSecsToTicks(hsScalar secs); - static double PrecTicksToSecs(UInt32 ticks); - static double PrecTicksToHz(UInt32 ticks); + static uint32_t PrecSecsToTicks(float secs); + static double PrecTicksToSecs(uint32_t ticks); + static double PrecTicksToHz(uint32_t ticks); // If you need to time something longer than 20 seconds, use this instead of // the precision timer. It works the same, it just gives you full resolution. - static UInt64 GetFullTickCount(); - static float FullTicksToMs(UInt64 ticks); + static uint64_t GetFullTickCount(); + static float FullTicksToMs(uint64_t ticks); // // Pass GetTheTimer() into other process space, and then call SetTheTimer() on it. diff --git a/Sources/Plasma/NucleusLib/inc/plAudible.h b/Sources/Plasma/NucleusLib/inc/plAudible.h index 55147155..2c9ac0a4 100644 --- a/Sources/Plasma/NucleusLib/inc/plAudible.h +++ b/Sources/Plasma/NucleusLib/inc/plAudible.h @@ -83,10 +83,10 @@ public: virtual void Stop(int index = -1) = 0; virtual void FastForwardPlay(int index = -1) = 0; virtual void FastForwardToggle( int index = -1) = 0; - virtual void SetMin(const hsScalar m,int index = -1) = 0; // sets minimum falloff distance - virtual void SetMax(const hsScalar m,int index = -1) = 0; // sets maximum falloff distance - virtual hsScalar GetMin(int index = -1) const = 0; - virtual hsScalar GetMax(int index = -1) const = 0; + virtual void SetMin(const float m,int index = -1) = 0; // sets minimum falloff distance + virtual void SetMax(const float m,int index = -1) = 0; // sets maximum falloff distance + virtual float GetMin(int index = -1) const = 0; + virtual float GetMax(int index = -1) const = 0; virtual void SetVelocity(const hsVector3 vel,int index = -1) = 0; virtual hsVector3 GetVelocity(int index = -1) const = 0; virtual hsPoint3 GetPosition(int index = -1) = 0; @@ -105,7 +105,7 @@ public: virtual void SetVolume(const float volume,int index = -1) = 0; virtual void SetMuted( hsBool muted, int index = -1 ) = 0; virtual void ToggleMuted( int index = -1 ) = 0; - virtual void SetTalkIcon(int index, UInt32 str) = 0; + virtual void SetTalkIcon(int index, uint32_t str) = 0; virtual void ClearTalkIcon() = 0; virtual void SetFilename(int index, const char *filename, hsBool isCompressed) = 0; // set filename for a streaming sound virtual void SetFadeIn( const int type, const float length, int index = -1 ) = 0; diff --git a/Sources/Plasma/NucleusLib/inc/plDrawable.h b/Sources/Plasma/NucleusLib/inc/plDrawable.h index f7fdbea1..d0131024 100644 --- a/Sources/Plasma/NucleusLib/inc/plDrawable.h +++ b/Sources/Plasma/NucleusLib/inc/plDrawable.h @@ -61,10 +61,10 @@ class plAccessSpan; class plDrawableCriteria { public: - plDrawableCriteria(UInt32 crit, const plRenderLevel& lev, const plLoadMask& m, UInt32 ty=1 /* Normal */ ) : fCriteria(crit), fLevel(lev), fType(ty), fLoadMask(m) {} - UInt32 fCriteria; + plDrawableCriteria(uint32_t crit, const plRenderLevel& lev, const plLoadMask& m, uint32_t ty=1 /* Normal */ ) : fCriteria(crit), fLevel(lev), fType(ty), fLoadMask(m) {} + uint32_t fCriteria; plRenderLevel fLevel; - UInt32 fType; + uint32_t fType; plLoadMask fLoadMask; }; @@ -146,38 +146,38 @@ public: virtual plDrawable& SetProperty( int prop, hsBool on ) = 0; virtual hsBool GetProperty( int prop ) const = 0; - virtual plDrawable& SetProperty( UInt32 index, int prop, hsBool on ) = 0; - virtual hsBool GetProperty( UInt32 index, int prop ) const = 0; + virtual plDrawable& SetProperty( uint32_t index, int prop, hsBool on ) = 0; + virtual hsBool GetProperty( uint32_t index, int prop ) const = 0; virtual plDrawable& SetNativeProperty( int prop, hsBool on ) = 0; virtual hsBool GetNativeProperty( int prop ) const = 0; - virtual plDrawable& SetNativeProperty( UInt32 index, int prop, hsBool on ) = 0; - virtual hsBool GetNativeProperty( UInt32 index, int prop ) const = 0; + virtual plDrawable& SetNativeProperty( uint32_t index, int prop, hsBool on ) = 0; + virtual hsBool GetNativeProperty( uint32_t index, int prop ) const = 0; - virtual plDrawable& SetSubType( UInt32 index, plSubDrawableType t, hsBool on ) = 0; - virtual UInt32 GetSubType( UInt32 index ) const = 0; // returns or of all spans with this index (index==-1 is all spans). + virtual plDrawable& SetSubType( uint32_t index, plSubDrawableType t, hsBool on ) = 0; + virtual uint32_t GetSubType( uint32_t index ) const = 0; // returns or of all spans with this index (index==-1 is all spans). - virtual UInt32 GetType( void ) const = 0; - virtual void SetType( UInt32 type ) = 0; + virtual uint32_t GetType( void ) const = 0; + virtual void SetType( uint32_t type ) = 0; virtual void SetRenderLevel(const plRenderLevel& l) = 0; virtual const plRenderLevel& GetRenderLevel() const = 0; - virtual plDrawable& SetTransform( UInt32 index, const hsMatrix44& l2w, const hsMatrix44& w2l ) = 0; - virtual const hsMatrix44& GetLocalToWorld( UInt32 span = (UInt32)-1 ) const = 0; - virtual const hsMatrix44& GetWorldToLocal( UInt32 span = (UInt32)-1 ) const = 0; + virtual plDrawable& SetTransform( uint32_t index, const hsMatrix44& l2w, const hsMatrix44& w2l ) = 0; + virtual const hsMatrix44& GetLocalToWorld( uint32_t span = (uint32_t)-1 ) const = 0; + virtual const hsMatrix44& GetWorldToLocal( uint32_t span = (uint32_t)-1 ) const = 0; - virtual const hsBounds3Ext& GetLocalBounds( UInt32 index = (UInt32)-1 ) const = 0; - virtual const hsBounds3Ext& GetWorldBounds( UInt32 index = (UInt32)-1 ) const = 0; - virtual const hsBounds3Ext& GetMaxWorldBounds( UInt32 index = (UInt32)-1 ) const = 0; + virtual const hsBounds3Ext& GetLocalBounds( uint32_t index = (uint32_t)-1 ) const = 0; + virtual const hsBounds3Ext& GetWorldBounds( uint32_t index = (uint32_t)-1 ) const = 0; + virtual const hsBounds3Ext& GetMaxWorldBounds( uint32_t index = (uint32_t)-1 ) const = 0; virtual plSpaceTree* GetSpaceTree() const = 0; - virtual void SetDISpanVisSet(UInt32 diIndex, hsKeyedObject* reg, hsBool on) = 0; + virtual void SetDISpanVisSet(uint32_t diIndex, hsKeyedObject* reg, hsBool on) = 0; // Taking span index. DI Index doesn't make sense here, because one object's DI can dereference into many materials etc. virtual hsGMaterial* GetSubMaterial(int index) const = 0; - virtual hsBool GetSubVisDists(int index, hsScalar& minDist, hsScalar& maxDist) const = 0; // return true if span invisible before minDist and/or after maxDist + virtual hsBool GetSubVisDists(int index, float& minDist, float& maxDist) const = 0; // return true if span invisible before minDist and/or after maxDist // Should implement hsKeyedObject Read/Write/Save/Load as well @@ -186,9 +186,9 @@ public: virtual plKey GetSceneNode() const = 0; /// Funky particle system functions - virtual UInt32 CreateParticleSystem( UInt32 maxNumEmitters, UInt32 maxNumParticles, hsGMaterial *material ) = 0; - virtual void ResetParticleSystem( UInt32 index ) = 0; - virtual void AssignEmitterToParticleSystem( UInt32 index, plParticleEmitter *emitter ) = 0; + virtual uint32_t CreateParticleSystem( uint32_t maxNumEmitters, uint32_t maxNumParticles, hsGMaterial *material ) = 0; + virtual void ResetParticleSystem( uint32_t index ) = 0; + virtual void AssignEmitterToParticleSystem( uint32_t index, plParticleEmitter *emitter ) = 0; /// EXPORT-ONLY diff --git a/Sources/Plasma/NucleusLib/inc/plPhysical.h b/Sources/Plasma/NucleusLib/inc/plPhysical.h index 94a82720..6239c457 100644 --- a/Sources/Plasma/NucleusLib/inc/plPhysical.h +++ b/Sources/Plasma/NucleusLib/inc/plPhysical.h @@ -98,10 +98,10 @@ public: virtual int GetGroup() const = 0; // Flags in plSimDefs::plLOSDB - virtual void AddLOSDB(UInt16 flag) = 0; - virtual void RemoveLOSDB(UInt16 flag) = 0; - virtual UInt16 GetAllLOSDBs() = 0; - virtual hsBool IsInLOSDB(UInt16 flag) = 0; + virtual void AddLOSDB(uint16_t flag) = 0; + virtual void RemoveLOSDB(uint16_t flag) = 0; + virtual uint16_t GetAllLOSDBs() = 0; + virtual hsBool IsInLOSDB(uint16_t flag) = 0; // Return the key of our subworld. May be a nil key. virtual plKey GetWorldKey() const = 0; @@ -121,12 +121,12 @@ public: virtual void GetSyncState(hsPoint3& pos, hsQuat& rot, hsVector3& linV, hsVector3& angV) = 0; virtual void SetSyncState(hsPoint3* pos, hsQuat* rot, hsVector3* linV, hsVector3* angV) = 0; - virtual hsScalar GetMass() = 0; + virtual float GetMass() = 0; // I wish I could think of a better way to do this, but this is how it's // going to be for now. virtual void ExcludeRegionHack(hsBool cleared) = 0; - virtual plDrawableSpans* CreateProxy(hsGMaterial* mat, hsTArray& idx, plDrawableSpans* addTo) = 0; + virtual plDrawableSpans* CreateProxy(hsGMaterial* mat, hsTArray& idx, plDrawableSpans* addTo) = 0; }; #endif // plPhysical_inc diff --git a/Sources/Plasma/NucleusLib/inc/plPipeline.h b/Sources/Plasma/NucleusLib/inc/plPipeline.h index f7212cb7..374b5393 100644 --- a/Sources/Plasma/NucleusLib/inc/plPipeline.h +++ b/Sources/Plasma/NucleusLib/inc/plPipeline.h @@ -152,12 +152,12 @@ public: // visList is write only. On output, visList is UNSORTED visible spans. // Called once per scene render (maybe multiple times per frame). // Returns true if rendering should proceed. - virtual hsBool PreRender(plDrawable* drawable, hsTArray& visList, plVisMgr* visMgr=nil) = 0; + virtual hsBool PreRender(plDrawable* drawable, hsTArray& visList, plVisMgr* visMgr=nil) = 0; // PrepForRender - perform any processing on the drawable data nessecary before rendering. // visList is read only. On input, visList is SORTED visible spans, and is ALL spans which will be drawn this render. // Called once per scene render. // Returns true if rendering should proceed. - virtual hsBool PrepForRender(plDrawable* drawable, hsTArray& visList, plVisMgr* visMgr=nil) = 0; + virtual hsBool PrepForRender(plDrawable* drawable, hsTArray& visList, plVisMgr* visMgr=nil) = 0; // Render - draw the drawable to the current render target. // visList is read only. On input, visList is SORTED visible spans. May not be the complete list of visible spans // for this drawable. @@ -165,17 +165,17 @@ public: // Render(drawable0, visList0) // visList0 contains furthest spans in drawable0 // Render(drawable1, visList1) // visList1 contains spans from drawable1 between drawable0's visList0 and visList2 // Render(drawable0, visList2) // visList2 contains closest spans in drawable0. - virtual void Render(plDrawable* d, const hsTArray& visList) = 0; + virtual void Render(plDrawable* d, const hsTArray& visList) = 0; // Draw - Convenience wrapper for standalone renders. Calls PreRender, PrepForRender, Render. Currently for internal // use only, but may prove useful for procedurals (render to texture). virtual void Draw(plDrawable* d) = 0; // Device-specific ref creation. Includes buffers and fonts - virtual plTextFont *MakeTextFont( char *face, UInt16 size ) = 0; + virtual plTextFont *MakeTextFont( char *face, uint16_t size ) = 0; // Create and/or Refresh geometry buffers - virtual void CheckVertexBufferRef(plGBufferGroup* owner, UInt32 idx) = 0; - virtual void CheckIndexBufferRef(plGBufferGroup* owner, UInt32 idx) = 0; + virtual void CheckVertexBufferRef(plGBufferGroup* owner, uint32_t idx) = 0; + virtual void CheckIndexBufferRef(plGBufferGroup* owner, uint32_t idx) = 0; virtual hsBool OpenAccess(plAccessSpan& dst, plDrawableSpans* d, const plVertexSpan* span, hsBool readOnly) = 0; virtual hsBool CloseAccess(plAccessSpan& acc) = 0; @@ -217,10 +217,10 @@ public: virtual void PopRenderRequest(plRenderRequest* req) = 0; virtual void ClearRenderTarget( plDrawable* d ) = 0; // nil d reverts to ClearRenderTarget(nil, nil). - virtual void ClearRenderTarget(const hsColorRGBA* col = nil, const hsScalar* depth = nil) = 0; // col/depth are overrides for current default. - virtual void SetClear(const hsColorRGBA* col=nil, const hsScalar* depth=nil) = 0; // sets the default clear for current render target. + virtual void ClearRenderTarget(const hsColorRGBA* col = nil, const float* depth = nil) = 0; // col/depth are overrides for current default. + virtual void SetClear(const hsColorRGBA* col=nil, const float* depth=nil) = 0; // sets the default clear for current render target. virtual hsColorRGBA GetClearColor() const = 0; - virtual hsScalar GetClearDepth() const = 0; + virtual float GetClearDepth() const = 0; virtual hsGDeviceRef *MakeRenderTargetRef( plRenderTarget *owner ) = 0; virtual void PushRenderTarget( plRenderTarget *target ) = 0; virtual plRenderTarget *PopRenderTarget( void ) = 0; @@ -236,21 +236,21 @@ public: virtual void EndVisMgr(plVisMgr* visMgr) = 0; virtual hsBool IsFullScreen() const = 0; - virtual UInt32 Width() const = 0; - virtual UInt32 Height() const = 0; - virtual UInt32 ColorDepth() const = 0; - virtual void Resize( UInt32 width, UInt32 height ) = 0; + virtual uint32_t Width() const = 0; + virtual uint32_t Height() const = 0; + virtual uint32_t ColorDepth() const = 0; + virtual void Resize( uint32_t width, uint32_t height ) = 0; // Culling. Might be used in Update before bothering to do any serious computation. virtual hsBool TestVisibleWorld(const hsBounds3Ext& wBnd) = 0; virtual hsBool TestVisibleWorld(const plSceneObject* sObj) = 0; - virtual hsBool HarvestVisible(plSpaceTree* space, hsTArray& visList) = 0; + virtual hsBool HarvestVisible(plSpaceTree* space, hsTArray& visList) = 0; virtual hsBool SubmitOccluders(const hsTArray& polyList) = 0; - virtual void SetDebugFlag( UInt32 flag, hsBool on ) = 0; - virtual hsBool IsDebugFlagSet( UInt32 flag ) const = 0; - virtual void SetMaxCullNodes(UInt16 n) = 0; // Debug/analysis only - virtual UInt16 GetMaxCullNodes() const = 0; // Debug/analysis only + virtual void SetDebugFlag( uint32_t flag, hsBool on ) = 0; + virtual hsBool IsDebugFlagSet( uint32_t flag ) const = 0; + virtual void SetMaxCullNodes(uint16_t n) = 0; // Debug/analysis only + virtual uint16_t GetMaxCullNodes() const = 0; // Debug/analysis only // Properties enum Properties @@ -262,15 +262,15 @@ public: virtual hsBool CheckResources() = 0; // Do we need to call LoadResources? virtual void LoadResources() = 0; - virtual void SetProperty( UInt32 prop, hsBool on ) = 0; - virtual hsBool GetProperty( UInt32 prop ) const = 0; - virtual UInt32 GetMaxLayersAtOnce() const = 0; + virtual void SetProperty( uint32_t prop, hsBool on ) = 0; + virtual hsBool GetProperty( uint32_t prop ) const = 0; + virtual uint32_t GetMaxLayersAtOnce() const = 0; // Drawable type mask - virtual void SetDrawableTypeMask( UInt32 mask ) = 0; - virtual UInt32 GetDrawableTypeMask( void ) const = 0; - virtual void SetSubDrawableTypeMask( UInt32 mask ) = 0; - virtual UInt32 GetSubDrawableTypeMask( void ) const = 0; + virtual void SetDrawableTypeMask( uint32_t mask ) = 0; + virtual uint32_t GetDrawableTypeMask( void ) const = 0; + virtual void SetSubDrawableTypeMask( uint32_t mask ) = 0; + virtual uint32_t GetSubDrawableTypeMask( void ) const = 0; // View state virtual hsPoint3 GetViewPositionWorld() const = 0; @@ -279,17 +279,17 @@ public: virtual hsVector3 GetViewDirWorld() const = 0; virtual void GetViewAxesWorld(hsVector3 axes[3] /* ac,up,at */ ) const = 0; - virtual void GetFOV(hsScalar& fovX, hsScalar& fovY) const = 0; - virtual void SetFOV(hsScalar fovX, hsScalar fovY) = 0; + virtual void GetFOV(float& fovX, float& fovY) const = 0; + virtual void SetFOV(float fovX, float fovY) = 0; - virtual void GetSize(hsScalar& width, hsScalar& height) const = 0; - virtual void SetSize(hsScalar width, hsScalar height) = 0; + virtual void GetSize(float& width, float& height) const = 0; + virtual void SetSize(float width, float height) = 0; - virtual void GetDepth(hsScalar& hither, hsScalar& yon) const = 0; - virtual void SetDepth(hsScalar hither, hsScalar yon) = 0; + virtual void GetDepth(float& hither, float& yon) const = 0; + virtual void SetDepth(float hither, float yon) = 0; - virtual void SetZBiasScale( hsScalar scale ) = 0; - virtual hsScalar GetZBiasScale( void ) const = 0; + virtual void SetZBiasScale( float scale ) = 0; + virtual float GetZBiasScale( void ) const = 0; virtual const hsMatrix44& GetWorldToCamera() const = 0; virtual const hsMatrix44& GetCameraToWorld() const = 0; @@ -300,8 +300,8 @@ public: virtual const plViewTransform& GetViewTransform() const = 0; - virtual void ScreenToWorldPoint( int n, UInt32 stride, Int32 *scrX, Int32 *scrY, - hsScalar dist, UInt32 strideOut, hsPoint3 *worldOut ) = 0; + virtual void ScreenToWorldPoint( int n, uint32_t stride, int32_t *scrX, int32_t *scrY, + float dist, uint32_t strideOut, hsPoint3 *worldOut ) = 0; virtual void RefreshMatrices( void ) = 0; virtual void RefreshScreenMatrices( void ) = 0; @@ -314,11 +314,11 @@ public: virtual plLayerInterface* AppendLayerInterface(plLayerInterface* li, hsBool onAllLayers = false) = 0; virtual plLayerInterface* RemoveLayerInterface(plLayerInterface* li, hsBool onAllLayers = false) = 0; - virtual UInt32 GetMaterialOverrideOn(hsGMatState::StateIdx category) const = 0; - virtual UInt32 GetMaterialOverrideOff(hsGMatState::StateIdx category) const = 0; + virtual uint32_t GetMaterialOverrideOn(hsGMatState::StateIdx category) const = 0; + virtual uint32_t GetMaterialOverrideOff(hsGMatState::StateIdx category) const = 0; virtual hsGMatState PushMaterialOverride(const hsGMatState& state, hsBool on) = 0; - virtual hsGMatState PushMaterialOverride(hsGMatState::StateIdx cat, UInt32 which, hsBool on) = 0; + virtual hsGMatState PushMaterialOverride(hsGMatState::StateIdx cat, uint32_t which, hsBool on) = 0; virtual void PopMaterialOverride(const hsGMatState& restore, hsBool on) = 0; virtual const hsGMatState& GetMaterialOverride(hsBool on) const = 0; @@ -330,13 +330,13 @@ public: virtual void SubmitClothingOutfit(plClothingOutfit* co) = 0; // These all return true if the gamma was successfully set. - virtual hsBool SetGamma(hsScalar eR, hsScalar eG, hsScalar eB) = 0; - virtual hsBool SetGamma(const UInt16* const tabR, const UInt16* const tabG, const UInt16* const tabB) = 0; // len table = 256. - virtual hsBool SetGamma(hsScalar e) { return SetGamma(e, e, e); } - virtual hsBool SetGamma(const UInt16* const table) { return SetGamma(table, table, table); } + virtual hsBool SetGamma(float eR, float eG, float eB) = 0; + virtual hsBool SetGamma(const uint16_t* const tabR, const uint16_t* const tabG, const uint16_t* const tabB) = 0; // len table = 256. + virtual hsBool SetGamma(float e) { return SetGamma(e, e, e); } + virtual hsBool SetGamma(const uint16_t* const table) { return SetGamma(table, table, table); } // flipVertical is for the AVI writer, which wants it's frames upside down - virtual hsBool CaptureScreen( plMipmap *dest, bool flipVertical = false, UInt16 desiredWidth = 0, UInt16 desiredHeight = 0 ) = 0; + virtual hsBool CaptureScreen( plMipmap *dest, bool flipVertical = false, uint16_t desiredWidth = 0, uint16_t desiredHeight = 0 ) = 0; // Returns an un-named (GetKey()==nil) mipmap same dimensions as targ. You are responsible for deleting said mipMap. virtual plMipmap* ExtractMipMap(plRenderTarget* targ) = 0; diff --git a/Sources/Plasma/NucleusLib/inc/plProfile.h b/Sources/Plasma/NucleusLib/inc/plProfile.h index 389c9631..aca56ad4 100644 --- a/Sources/Plasma/NucleusLib/inc/plProfile.h +++ b/Sources/Plasma/NucleusLib/inc/plProfile.h @@ -42,7 +42,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #ifndef plProfile_h_inc #define plProfile_h_inc -#include "hsTypes.h" +#include "HeadSpin.h" #ifndef PLASMA_EXTERNAL_RELEASE #define PL_PROFILE_ENABLED @@ -153,22 +153,22 @@ public: protected: const char* fName; // Name of timer - UInt32 fValue; + uint32_t fValue; - UInt32 fAvgCount; - UInt64 fAvgTotal; - UInt32 fLastAvg; - UInt32 fMax; + uint32_t fAvgCount; + uint64_t fAvgTotal; + uint32_t fLastAvg; + uint32_t fMax; hsBool fActive; hsBool fRunning; - UInt8 fDisplayFlags; + uint8_t fDisplayFlags; // Number of times EndTiming was called. Can be used to combine timing and counting in one timer - UInt32 fTimerSamples; + uint32_t fTimerSamples; void IAddAvg(); - void IPrintValue(UInt32 value, char* buf, hsBool printType); + void IPrintValue(uint32_t value, char* buf, hsBool printType); public: plProfileBase(); @@ -179,13 +179,13 @@ public: void UpdateAvg(); - UInt32 GetValue(); + uint32_t GetValue(); void PrintValue(char* buf, hsBool printType=true); void PrintAvg(char* buf, hsBool printType=true); void PrintMax(char* buf, hsBool printType=true); - UInt32 GetTimerSamples() const { return fTimerSamples; } + uint32_t GetTimerSamples() const { return fTimerSamples; } const char* GetName() { return fName; } @@ -194,7 +194,7 @@ public: void Stop() { fRunning = false; } void Start() { fRunning = true; } - UInt8 GetDisplayFlags() const { return fDisplayFlags; } + uint8_t GetDisplayFlags() const { return fDisplayFlags; } void ResetMax() { fMax = 0; } }; @@ -216,21 +216,21 @@ protected: public: // Name is the timer name. Each timer group gets its own plStatusLog - plProfileVar(const char *name, const char* group, UInt8 flags); + plProfileVar(const char *name, const char* group, uint8_t flags); ~plProfileVar(); // For timing void BeginTiming() { if (fActive && fRunning) IBeginTiming(); } void EndTiming() { if (fActive && fRunning) IEndTiming(); } - void NewMem(UInt32 memAmount) { fValue += memAmount; } - void DelMem(UInt32 memAmount) { fValue -= memAmount; } + void NewMem(uint32_t memAmount) { fValue += memAmount; } + void DelMem(uint32_t memAmount) { fValue -= memAmount; } // For Counting void Inc(int i = 1) { fValue += i;} void Dec(int i = 1) { fValue -= i;} - void Set(UInt32 value) { fValue = value; } + void Set(uint32_t value) { fValue = value; } // // For multiple timings per frame of the same thing ie. Each particle system diff --git a/Sources/Plasma/NucleusLib/inc/plProfileManager.cpp b/Sources/Plasma/NucleusLib/inc/plProfileManager.cpp index a38cfa46..fd2b4b62 100644 --- a/Sources/Plasma/NucleusLib/inc/plProfileManager.cpp +++ b/Sources/Plasma/NucleusLib/inc/plProfileManager.cpp @@ -43,9 +43,9 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "plProfile.h" #include "hsTimer.h" -#include "hsUtils.h" -static UInt32 gCyclesPerMS = 0; + +static uint32_t gCyclesPerMS = 0; #ifdef HS_BUILD_FOR_WIN32 #define USE_FAST_TIMER @@ -62,7 +62,7 @@ static UInt32 gCyclesPerMS = 0; #define forceinline inline #endif -forceinline UInt32 GetPentiumCounter() +forceinline uint32_t GetPentiumCounter() { #ifdef _MSC_VER __asm { @@ -79,9 +79,9 @@ forceinline UInt32 GetPentiumCounter() #pragma warning (pop) -#include "hsWindows.h" -static UInt32 GetProcSpeed() + +static uint32_t GetProcSpeed() { const char* keypath[] = { @@ -114,16 +114,16 @@ static UInt32 GetProcSpeed() return value*1000000; } -UInt32 GetProcSpeedAlt() +uint32_t GetProcSpeedAlt() { - const UInt32 kSamplePeriodMS = 250; + const uint32_t kSamplePeriodMS = 250; // Raise priority to avoid interference from other threads. int priority = GetThreadPriority(GetCurrentThread()); SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_TIME_CRITICAL); - UInt32 startTicks, endTicks; - UInt64 pcStart, pcEnd; + uint32_t startTicks, endTicks; + uint64_t pcStart, pcEnd; // Count number of processor cycles inside the specified interval QueryPerformanceCounter((LARGE_INTEGER*)&pcStart); @@ -136,17 +136,17 @@ UInt32 GetProcSpeedAlt() SetThreadPriority(GetCurrentThread(), priority); // Calculate Rdtsc/PerformanceCounter ratio; - UInt32 numTicks = endTicks - startTicks; - UInt64 pcDiff = pcEnd - pcStart; + uint32_t numTicks = endTicks - startTicks; + uint64_t pcDiff = pcEnd - pcStart; double ratio = double(numTicks) / double(pcDiff); - UInt64 pcFreq; + uint64_t pcFreq; QueryPerformanceFrequency((LARGE_INTEGER*)&pcFreq); // Calculate CPU frequency. - UInt64 cpuFreq = UInt64(pcFreq * ratio); + uint64_t cpuFreq = uint64_t(pcFreq * ratio); - return (UInt32)cpuFreq; + return (uint32_t)cpuFreq; } #define GetProfileTicks() GetPentiumCounter() @@ -189,9 +189,9 @@ void plProfileManager::AddTimer(plProfileVar* var) fVars.push_back(var); } -static UInt32 kAvgMilliseconds = 1000; +static uint32_t kAvgMilliseconds = 1000; -void plProfileManager::SetAvgTime(UInt32 avgMS) +void plProfileManager::SetAvgTime(uint32_t avgMS) { kAvgMilliseconds = avgMS; } @@ -251,7 +251,7 @@ void plProfileManager::EndFrame() } } -UInt32 plProfileManager::GetTime() +uint32_t plProfileManager::GetTime() { return GetProfileTicks(); } @@ -294,16 +294,16 @@ void plProfileBase::UpdateAvg() { if (fAvgCount > 0) { - fLastAvg = (UInt32)(fAvgTotal / fAvgCount); + fLastAvg = (uint32_t)(fAvgTotal / fAvgCount); fAvgCount = 0; fAvgTotal = 0; } } -UInt32 plProfileBase::GetValue() +uint32_t plProfileBase::GetValue() { if (hsCheckBits(fDisplayFlags, kDisplayTime)) - return (UInt32)TicksToMSec(fValue); + return (uint32_t)TicksToMSec(fValue); else return fValue; } @@ -334,7 +334,7 @@ static const char *insertCommas(unsigned int value) return str; } -void plProfileBase::IPrintValue(UInt32 value, char* buf, hsBool printType) +void plProfileBase::IPrintValue(uint32_t value, char* buf, hsBool printType) { if (hsCheckBits(fDisplayFlags, kDisplayCount)) { @@ -416,7 +416,7 @@ plProfileLaps::LapInfo* plProfileLaps::IFindLap(const char* lapName) return nil; } -void plProfileLaps::BeginLap(UInt32 curValue, const char* name) +void plProfileLaps::BeginLap(uint32_t curValue, const char* name) { LapInfo* lap = IFindLap(name); if (!lap) @@ -432,7 +432,7 @@ void plProfileLaps::BeginLap(UInt32 curValue, const char* name) lap->BeginTiming(curValue); } -void plProfileLaps::EndLap(UInt32 curValue, const char* name) +void plProfileLaps::EndLap(uint32_t curValue, const char* name) { LapInfo* lap = IFindLap(name); @@ -489,7 +489,7 @@ plProfileBase* plProfileLaps::GetLap(int i) /////////////////////////////////////////////////////////////////////////////// -plProfileVar::plProfileVar(const char *name, const char* group, UInt8 flags) : +plProfileVar::plProfileVar(const char *name, const char* group, uint8_t flags) : fGroup(group), fLaps(nil) { @@ -507,7 +507,7 @@ plProfileVar::~plProfileVar() void plProfileVar::IBeginLap(const char* lapName) { if (!fLaps) - fLaps = TRACKED_NEW plProfileLaps; + fLaps = new plProfileLaps; fDisplayFlags |= kDisplayLaps; if(fLapsActive) fLaps->BeginLap(fValue, lapName); diff --git a/Sources/Plasma/NucleusLib/inc/plProfileManager.h b/Sources/Plasma/NucleusLib/inc/plProfileManager.h index f43f073e..e36df329 100644 --- a/Sources/Plasma/NucleusLib/inc/plProfileManager.h +++ b/Sources/Plasma/NucleusLib/inc/plProfileManager.h @@ -42,7 +42,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #ifndef plProfileManager_h_inc #define plProfileManager_h_inc -#include "hsTypes.h" +#include "HeadSpin.h" #include "hsStlUtils.h" #include "plProfile.h" @@ -56,7 +56,7 @@ protected: double fLastAvgTime; - UInt32 fProcessorSpeed; + uint32_t fProcessorSpeed; plProfileManager(); @@ -70,12 +70,12 @@ public: void BeginFrame(); // Call begin frame on all timers void EndFrame(); // Call end frame on all timers - void SetAvgTime(UInt32 avgMS); + void SetAvgTime(uint32_t avgMS); - UInt32 GetProcessorSpeed() { return fProcessorSpeed; } + uint32_t GetProcessorSpeed() { return fProcessorSpeed; } // Backdoor for hack timers in calculated profiles - static UInt32 GetTime(); + static uint32_t GetTime(); }; class plProfileLaps @@ -90,16 +90,16 @@ protected: LapInfo(const char* name) { fName = name; fDisplayFlags = kDisplayTime; } bool operator<(const LapInfo& rhs) const { return fLastAvg < rhs.fLastAvg; } - void BeginTiming(UInt32 value) { fValue -= value; } - void EndTiming(UInt32 value) { fValue += value; fTimerSamples++; } + void BeginTiming(uint32_t value) { fValue -= value; } + void EndTiming(uint32_t value) { fValue += value; fTimerSamples++; } }; std::vector fLapTimes; LapInfo* IFindLap(const char* lapName); public: - void BeginLap(UInt32 curValue, const char* name); - void EndLap(UInt32 curValue, const char* name); + void BeginLap(uint32_t curValue, const char* name); + void EndLap(uint32_t curValue, const char* name); void BeginFrame(); void EndFrame(); diff --git a/Sources/Plasma/NucleusLib/inc/plgDispatch.h b/Sources/Plasma/NucleusLib/inc/plgDispatch.h index a4d3822e..611750d4 100644 --- a/Sources/Plasma/NucleusLib/inc/plgDispatch.h +++ b/Sources/Plasma/NucleusLib/inc/plgDispatch.h @@ -54,11 +54,11 @@ public: CLASSNAME_REGISTER( plDispatchBase ); GETINTERFACE_ANY( plDispatchBase, plCreatable ); - virtual void RegisterForType(UInt16 hClass, const plKey& receiver) = 0; - virtual void RegisterForExactType(UInt16 hClass, const plKey& receiver) = 0; + virtual void RegisterForType(uint16_t hClass, const plKey& receiver) = 0; + virtual void RegisterForExactType(uint16_t hClass, const plKey& receiver) = 0; - virtual void UnRegisterForType(UInt16 hClass, const plKey& receiver) = 0; - virtual void UnRegisterForExactType(UInt16 hClass, const plKey& receiver) = 0; + virtual void UnRegisterForType(uint16_t hClass, const plKey& receiver) = 0; + virtual void UnRegisterForExactType(uint16_t hClass, const plKey& receiver) = 0; virtual void UnRegisterAll(const plKey& receiver) = 0; diff --git a/Sources/Plasma/NucleusLib/pnAddrInfo/pnAddrInfo.cpp b/Sources/Plasma/NucleusLib/pnAddrInfo/pnAddrInfo.cpp index 905290bb..8d5801b8 100644 --- a/Sources/Plasma/NucleusLib/pnAddrInfo/pnAddrInfo.cpp +++ b/Sources/Plasma/NucleusLib/pnAddrInfo/pnAddrInfo.cpp @@ -42,7 +42,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #ifndef SERVER -#include "hsTypes.h" +#include "HeadSpin.h" #include "pnAddrInfo.h" #include diff --git a/Sources/Plasma/NucleusLib/pnAddrInfo/pnAddrInfo.h b/Sources/Plasma/NucleusLib/pnAddrInfo/pnAddrInfo.h index 7ee05140..6fb1112e 100644 --- a/Sources/Plasma/NucleusLib/pnAddrInfo/pnAddrInfo.h +++ b/Sources/Plasma/NucleusLib/pnAddrInfo/pnAddrInfo.h @@ -52,17 +52,11 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com # include # include # include -#elif HS_BUILD_FOR_WIN32 -# if (_WIN32_WINNT < 0x0501) -# define _WIN32_WINNT 0x0501 -# endif -# include -# include -#else +#elif !defined(HS_BUILD_FOR_WIN32) # error "pnAddrInfo Not Implemented!" #endif -#include "hsTypes.h" +#include "HeadSpin.h" #include "hsStlUtils.h" diff --git a/Sources/Plasma/NucleusLib/pnAsyncCore/Private/pnAcIo.h b/Sources/Plasma/NucleusLib/pnAsyncCore/Private/pnAcIo.h index 4688775c..56bd5b9b 100644 --- a/Sources/Plasma/NucleusLib/pnAsyncCore/Private/pnAcIo.h +++ b/Sources/Plasma/NucleusLib/pnAsyncCore/Private/pnAcIo.h @@ -76,7 +76,7 @@ enum EFileError { EFileError AsyncGetLastFileError (); -const wchar * FileErrorToString (EFileError error); +const wchar_t * FileErrorToString (EFileError error); /**************************************************************************** @@ -99,19 +99,19 @@ struct AsyncNotifyFile { }; struct AsyncNotifyFileConnect : AsyncNotifyFile { - qword fileSize; - qword fileLastWriteTime; + uint64_t fileSize; + uint64_t fileLastWriteTime; }; struct AsyncNotifyFileFlush : AsyncNotifyFile { EFileError error; - qword truncateSize; + uint64_t truncateSize; }; struct AsyncNotifyFileRead : AsyncNotifyFile { - qword offset; - byte * buffer; - unsigned bytes; + uint64_t offset; + uint8_t * buffer; + unsigned bytes; }; typedef AsyncNotifyFileRead AsyncNotifyFileWrite; @@ -147,19 +147,19 @@ const unsigned kAsyncFileShareRead = 0x00000001; const unsigned kAsyncFileShareWrite = 0x00000002; AsyncFile AsyncFileOpen ( - const wchar fullPath[], + const wchar_t fullPath[], FAsyncNotifyFileProc notifyProc, EFileError * error, unsigned desiredAccess, unsigned openMode, unsigned shareModeFlags, // optional void * userState, // optional - qword * fileSize, // optional - qword * fileLastWriteTime // optional + uint64_t * fileSize, // optional + uint64_t * fileLastWriteTime // optional ); // Use with AsyncFileDelete/AsyncFileFlushBuffers -const qword kAsyncFileDontTruncate = (qword) -1; +const uint64_t kAsyncFileDontTruncate = (uint64_t) -1; // This function may ONLY be called when there is no outstanding I/O against a file // and no more I/O will be initiated against it. This function guarantees that it @@ -167,23 +167,23 @@ const qword kAsyncFileDontTruncate = (qword) -1; // the same filename can succeed. void AsyncFileClose ( AsyncFile file, - qword truncateSize + uint64_t truncateSize ); void AsyncFileSetLastWriteTime ( AsyncFile file, - qword lastWriteTime + uint64_t lastWriteTime ); -qword AsyncFileGetLastWriteTime ( - const wchar fileName[] +uint64_t AsyncFileGetLastWriteTime ( + const wchar_t fileName[] ); // Truncation occurs atomically, any writes which occur after // AsyncFileFlushBuffers will be queued until the truncation completes AsyncId AsyncFileFlushBuffers ( AsyncFile file, - qword truncateSize, + uint64_t truncateSize, bool notify, void * param ); @@ -193,7 +193,7 @@ const unsigned kAsyncFileRwSync = 1<<1; AsyncId AsyncFileRead ( AsyncFile file, - qword offset, + uint64_t offset, void * buffer, unsigned bytes, unsigned flags, @@ -203,7 +203,7 @@ AsyncId AsyncFileRead ( // Buffer must stay valid until I/O is completed AsyncId AsyncFileWrite ( AsyncFile file, - qword offset, + uint64_t offset, const void * buffer, unsigned bytes, unsigned flags, @@ -227,7 +227,7 @@ enum EFileSeekFrom { bool AsyncFileSeek ( AsyncFile file, - qword distance, + uint64_t distance, EFileSeekFrom seekFrom ); @@ -240,11 +240,11 @@ bool AsyncFileSeek ( #include struct AsyncSocketConnectPacket { - byte connType; - word hdrBytes; - dword buildId; - dword buildType; - dword branchId; + uint8_t connType; + uint16_t hdrBytes; + uint32_t buildId; + uint32_t buildType; + uint32_t branchId; Uuid productId; }; #include @@ -282,13 +282,13 @@ struct AsyncNotifySocketListen : AsyncNotifySocketConnect { unsigned branchId; Uuid productId; NetAddress addr; - byte * buffer; + uint8_t * buffer; unsigned bytes; unsigned bytesProcessed; }; struct AsyncNotifySocketRead : AsyncNotifySocket { - byte * buffer; + uint8_t * buffer; unsigned bytes; unsigned bytesProcessed; }; @@ -344,7 +344,7 @@ COMPILER_ASSERT_HEADER(EConnType, kNumConnTypes < 256); void AsyncSocketRegisterNotifyProc ( - byte connType, + uint8_t connType, FAsyncNotifySocketProc notifyProc, unsigned buildId = 0, unsigned buildType = 0, @@ -353,7 +353,7 @@ void AsyncSocketRegisterNotifyProc ( ); void AsyncSocketUnregisterNotifyProc ( - byte connType, + uint8_t connType, FAsyncNotifySocketProc notifyProc, unsigned buildId = 0, unsigned buildType = 0, @@ -362,7 +362,7 @@ void AsyncSocketUnregisterNotifyProc ( ); FAsyncNotifySocketProc AsyncSocketFindNotifyProc ( - const byte buffer[], + const uint8_t buffer[], unsigned bytes, unsigned * bytesProcessed, unsigned * connType, @@ -465,7 +465,7 @@ void AsyncSocketEnableNagling ( typedef void (* FAsyncLookupProc) ( void * param, - const wchar name[], + const wchar_t name[], unsigned addrCount, const NetAddress addrs[] ); @@ -473,7 +473,7 @@ typedef void (* FAsyncLookupProc) ( void AsyncAddressLookupName ( AsyncCancelId * cancelId, FAsyncLookupProc lookupProc, - const wchar name[], + const wchar_t name[], unsigned port, void * param ); diff --git a/Sources/Plasma/NucleusLib/pnAsyncCore/Private/pnAcLog.cpp b/Sources/Plasma/NucleusLib/pnAsyncCore/Private/pnAcLog.cpp index d1cd4a22..e6e02354 100644 --- a/Sources/Plasma/NucleusLib/pnAsyncCore/Private/pnAcLog.cpp +++ b/Sources/Plasma/NucleusLib/pnAsyncCore/Private/pnAcLog.cpp @@ -67,7 +67,7 @@ static FLogHandler s_asyncHandlers[kMaxHandlers]; ***/ //=========================================================================== -static void Dispatch (ELogSeverity severity, const wchar msg[]) { +static void Dispatch (ELogSeverity severity, const wchar_t msg[]) { // Dispatch to default debug handler char dbg[1024]; @@ -132,7 +132,7 @@ void __cdecl LogMsg (ELogSeverity severity, const char format[], ...) { } //=========================================================================== -void __cdecl LogMsg (ELogSeverity severity, const wchar format[], ...) { +void __cdecl LogMsg (ELogSeverity severity, const wchar_t format[], ...) { ASSERT(format); va_list args; @@ -148,18 +148,18 @@ void LogMsgV (ELogSeverity severity, const char format[], va_list args) { char msg[1024]; StrPrintfV(msg, arrsize(msg), format, args); - wchar uniMsg[1024]; + wchar_t uniMsg[1024]; StrToUnicode(uniMsg, msg, arrsize(uniMsg)); Dispatch(severity, uniMsg); } //=========================================================================== -void LogMsgV (ELogSeverity severity, const wchar format[], va_list args) { +void LogMsgV (ELogSeverity severity, const wchar_t format[], va_list args) { ASSERT(format); ASSERT(args); - wchar msg[1024]; + wchar_t msg[1024]; StrPrintfV(msg, arrsize(msg), format, args); Dispatch(severity, msg); @@ -179,7 +179,7 @@ void LogMsgDebug (const char format[], ...) { //============================================================================ #ifdef HS_DEBUGGING -void LogMsgDebug (const wchar format[], ...) { +void LogMsgDebug (const wchar_t format[], ...) { ASSERT(format); va_list args; diff --git a/Sources/Plasma/NucleusLib/pnAsyncCore/Private/pnAcLog.h b/Sources/Plasma/NucleusLib/pnAsyncCore/Private/pnAcLog.h index ca0d5567..3489cb90 100644 --- a/Sources/Plasma/NucleusLib/pnAsyncCore/Private/pnAcLog.h +++ b/Sources/Plasma/NucleusLib/pnAsyncCore/Private/pnAcLog.h @@ -77,32 +77,32 @@ enum ELogSeverity { }; void LogMsg (ELogSeverity severity, const char format[], ...); -void LogMsg (ELogSeverity severity, const wchar format[], ...); +void LogMsg (ELogSeverity severity, const wchar_t format[], ...); void LogMsgV (ELogSeverity severity, const char format[], va_list args); -void LogMsgV (ELogSeverity severity, const wchar format[], va_list args); +void LogMsgV (ELogSeverity severity, const wchar_t format[], va_list args); void LogBreakOnErrors (bool breakOnErrors); void AsyncLogInitialize ( - const wchar logDirName[], + const wchar_t logDirName[], bool breakOnErrors ); void AsyncLogDestroy (); void AsyncLogFlush (); -void AsyncLogGetDirectory (wchar * dest, unsigned destChars); +void AsyncLogGetDirectory (wchar_t * dest, unsigned destChars); // Low(er) level log API; call this from your LogHander function // if you want to use the asynchronous log facility. void AsyncLogWriteMsg ( - const wchar facility[], + const wchar_t facility[], ELogSeverity severity, - const wchar msg[] + const wchar_t msg[] ); // FLogHandler must be capable of handling multiple threads and re-entrancy -typedef void (* FLogHandler) (ELogSeverity severity, const wchar msg[]); +typedef void (* FLogHandler) (ELogSeverity severity, const wchar_t msg[]); void LogRegisterHandler (FLogHandler callback); void LogUnregisterHandler (FLogHandler callback); @@ -117,11 +117,11 @@ void LogUnregisterHandler (FLogHandler callback); #ifdef HS_DEBUGGING void LogMsgDebug (const char format[], ...); - void LogMsgDebug (const wchar format[], ...); + void LogMsgDebug (const wchar_t format[], ...); #else inline void LogMsgDebug (const char *, ...) { } - inline void LogMsgDebug (const wchar *, ...) { } + inline void LogMsgDebug (const wchar_t *, ...) { } #endif diff --git a/Sources/Plasma/NucleusLib/pnAsyncCore/Private/pnAcThread.h b/Sources/Plasma/NucleusLib/pnAsyncCore/Private/pnAcThread.h index fa39ea5d..f81feac0 100644 --- a/Sources/Plasma/NucleusLib/pnAsyncCore/Private/pnAcThread.h +++ b/Sources/Plasma/NucleusLib/pnAsyncCore/Private/pnAcThread.h @@ -83,7 +83,7 @@ struct AsyncThread { void * handle; void * argument; unsigned workTimeMs; - wchar name[16]; + wchar_t name[16]; }; /***************************************************************************** @@ -95,7 +95,7 @@ struct AsyncThread { void * AsyncThreadCreate ( FAsyncThreadProc proc, void * argument, - const wchar name[] + const wchar_t name[] ); // This function should ONLY be called during shutdown while waiting for things to expire @@ -141,6 +141,6 @@ void AsyncThreadTaskAdd ( AsyncThreadTaskList * taskList, FAsyncThreadTask callback, void * param, - const wchar debugStr[], + const wchar_t debugStr[], EThreadTaskPriority priority = kThreadTaskPriorityNormal ); diff --git a/Sources/Plasma/NucleusLib/pnAsyncCoreExe/Private/Nt/pnAceNt.cpp b/Sources/Plasma/NucleusLib/pnAsyncCoreExe/Private/Nt/pnAceNt.cpp index 1dd13f40..bdf476f7 100644 --- a/Sources/Plasma/NucleusLib/pnAsyncCoreExe/Private/Nt/pnAceNt.cpp +++ b/Sources/Plasma/NucleusLib/pnAsyncCoreExe/Private/Nt/pnAceNt.cpp @@ -102,7 +102,7 @@ void CNtWaitHandle::IncRef () { //=========================================================================== void CNtWaitHandle::DecRef () { if (!InterlockedDecrement(&m_refCount)) - DEL(this); + delete this; } //=========================================================================== @@ -126,7 +126,7 @@ void CNtWaitHandle::SignalObject () const { static void INtOpDispatch ( NtObject * ntObj, Operation * op, - dword bytes + uint32_t bytes ) { for (;;) { switch (op->opType) { @@ -143,12 +143,12 @@ static void INtOpDispatch ( return; case kOpSocketRead: - ASSERT(bytes != (dword) -1); + ASSERT(bytes != (uint32_t) -1); INtSocketOpCompleteSocketRead((NtSock *) ntObj, bytes); return; case kOpSocketWrite: - ASSERT(bytes != (dword) -1); + ASSERT(bytes != (uint32_t) -1); INtSocketOpCompleteSocketWrite((NtSock *) ntObj, (NtOpSocketWrite *) op); break; @@ -161,7 +161,7 @@ static void INtOpDispatch ( case kOpFileRead: case kOpFileWrite: - ASSERT(bytes != (dword) -1); + ASSERT(bytes != (uint32_t) -1); if (!INtFileOpCompleteReadWrite((NtFile *) ntObj, (NtOpFileReadWrite *) op, bytes)) return; break; @@ -238,7 +238,7 @@ static void INtOpDispatch ( // can only be dispatched when they are completed normally. To ensure that // we're not accidentally processing an operation that shouldn't be executed, // set the bytes field to an invalid value. - bytes = (dword) -1; + bytes = (uint32_t) -1; } } @@ -374,11 +374,11 @@ void NtInitialize () { (LPCTSTR) nil // name ); if (!s_waitEvent) - ErrorFatal(__LINE__, __FILE__, "CreateEvent %#x", GetLastError()); + ErrorAssert(__LINE__, __FILE__, "CreateEvent %#x", GetLastError()); // create IO completion port if (0 == (s_ioPort = CreateIoCompletionPort(INVALID_HANDLE_VALUE, 0, 0, 0))) - ErrorFatal(__LINE__, __FILE__, "CreateIoCompletionPort %#x", GetLastError()); + ErrorAssert(__LINE__, __FILE__, "CreateIoCompletionPort %#x", GetLastError()); // calculate number of IO worker threads to create if (!s_pageSizeMask) { diff --git a/Sources/Plasma/NucleusLib/pnAsyncCoreExe/Private/Nt/pnAceNtFile.cpp b/Sources/Plasma/NucleusLib/pnAsyncCoreExe/Private/Nt/pnAceNtFile.cpp index 79166bd8..d717b69a 100644 --- a/Sources/Plasma/NucleusLib/pnAsyncCoreExe/Private/Nt/pnAceNtFile.cpp +++ b/Sources/Plasma/NucleusLib/pnAsyncCoreExe/Private/Nt/pnAceNtFile.cpp @@ -83,7 +83,7 @@ struct NtFile : NtObject { LINK(NtFile) pendLink; // protected by s_fileCrit unsigned queueWrites; unsigned sectorSizeMask; - wchar fullPath[MAX_PATH]; + wchar_t fullPath[MAX_PATH]; NtFile (); ~NtFile (); @@ -123,7 +123,7 @@ static void FatalOnNonRecoverableError ( } ASSERT((op.opType == kOpFileRead) || (op.opType == kOpFileWrite)); - ErrorFatal( + ErrorAssert( __LINE__, __FILE__, "Disk %s failed, error: %u", op.opType == kOpFileRead ? "read" : "write", @@ -177,10 +177,10 @@ static void HandleFailedOp ( // create sub-operations to read the rest of the buffer for (; position < op->rw.bytes; ++subOperations) { - NtOpFileReadWrite * childOp = NEW(NtOpFileReadWrite); + NtOpFileReadWrite * childOp = new NtOpFileReadWrite; childOp->overlapped.hEvent = op->overlapped.hEvent ? CreateEvent(nil, true, false, nil) : nil; - childOp->overlapped.Offset = (dword) ((op->rw.offset + position) & 0xffffffff); - childOp->overlapped.OffsetHigh = (dword) ((op->rw.offset + position) >> 32); + childOp->overlapped.Offset = (uint32_t) ((op->rw.offset + position) & 0xffffffff); + childOp->overlapped.OffsetHigh = (uint32_t) ((op->rw.offset + position) >> 32); childOp->opType = op->opType; childOp->asyncId = 0; childOp->notify = false; @@ -312,9 +312,9 @@ static void HandleFailedOp ( } //=========================================================================== -static void InternalFileSetSize (NtObject * file, qword size) { +static void InternalFileSetSize (NtObject * file, uint64_t size) { LONG sizeHigh = (long) (size >> 32); - DWORD seek = SetFilePointer(file->handle, (dword) size, &sizeHigh, FILE_BEGIN); + DWORD seek = SetFilePointer(file->handle, (uint32_t) size, &sizeHigh, FILE_BEGIN); if ((seek != (DWORD) -1) || (GetLastError() == NO_ERROR)) SetEndOfFile(file->handle); } @@ -384,7 +384,7 @@ void INtFileDelete ( } file->critsect.Leave(); - DEL(file); + delete file; } //=========================================================================== @@ -446,9 +446,9 @@ bool INtFileOpCompleteReadWrite ( // adjust outstanding bytes if (bytes != op->win32Bytes) { if (!file->sectorSizeMask) - ErrorFatal(__LINE__, __FILE__, "Disk %s failed", op->opType == kOpFileRead ? "read" : "write"); + ErrorAssert(__LINE__, __FILE__, "Disk %s failed", op->opType == kOpFileRead ? "read" : "write"); if (op->opType == kOpFileRead) - MemZero(op->rw.buffer + bytes, op->win32Bytes - bytes); + memset(op->rw.buffer + bytes, 0, op->win32Bytes - bytes); } if (op->masterOp) { @@ -547,15 +547,15 @@ void INtFileOpCompleteSequence ( //=========================================================================== AsyncFile NtFileOpen ( - const wchar fullPath[], + const wchar_t fullPath[], FAsyncNotifyFileProc notifyProc, EFileError * error, unsigned desiredAccess, unsigned openMode, unsigned shareModeFlags, void * userState, - qword * fileSize, - qword * fileLastWriteTime + uint64_t * fileSize, + uint64_t * fileLastWriteTime ) { unsigned attributeFlags = 0; attributeFlags |= FILE_FLAG_OVERLAPPED; @@ -590,9 +590,9 @@ AsyncFile NtFileOpen ( CloseHandle(handle); return nil; } - const qword size = ((qword) sizeHi << (qword) 32) | (qword) sizeLo; + const uint64_t size = ((uint64_t) sizeHi << (uint64_t) 32) | (uint64_t) sizeLo; - qword lastWriteTime; + uint64_t lastWriteTime; ASSERT(sizeof(lastWriteTime) >= sizeof(FILETIME)); GetFileTime(handle, nil, nil, (FILETIME *) &lastWriteTime); @@ -632,7 +632,7 @@ AsyncFile NtFileOpen ( //=========================================================================== AsyncId NtFileRead ( AsyncFile conn, - qword offset, + uint64_t offset, void * buffer, unsigned bytes, unsigned flags, @@ -644,7 +644,7 @@ AsyncId NtFileRead ( ASSERT((flags & (kAsyncFileRwNotify|kAsyncFileRwSync)) != (kAsyncFileRwNotify|kAsyncFileRwSync)); ASSERT(! (offset & file->sectorSizeMask)); ASSERT(! (bytes & file->sectorSizeMask)); - ASSERT(! ((unsigned_ptr) buffer & file->sectorSizeMask)); + ASSERT(! ((uintptr_t) buffer & file->sectorSizeMask)); // Normally, I/O events do not complete until both the WIN32 operation has completed // and the callback notification has occurred. A deadlock can occur if a thread attempts @@ -654,9 +654,9 @@ AsyncId NtFileRead ( // enable the sequential thread to perform a wait operation, we set the event field // into the Overlapped structure, because the event will be signaled prior to the // potentially deadlocking callback notification. - NtOpFileReadWrite * op = NEW(NtOpFileReadWrite); - op->overlapped.Offset = (dword) (offset & 0xffffffff); - op->overlapped.OffsetHigh = (dword) (offset >> 32); + NtOpFileReadWrite * op = new NtOpFileReadWrite; + op->overlapped.Offset = (uint32_t) (offset & 0xffffffff); + op->overlapped.OffsetHigh = (uint32_t) (offset >> 32); op->overlapped.hEvent = (flags & kAsyncFileRwSync) ? CreateEvent(nil, true, false, nil) : nil; op->opType = kOpFileRead; op->notify = (flags & kAsyncFileRwNotify) != 0; @@ -666,7 +666,7 @@ AsyncId NtFileRead ( op->win32Bytes = bytes; op->rw.param = param; op->rw.offset = offset; - op->rw.buffer = (byte *) buffer; + op->rw.buffer = (uint8_t *) buffer; op->rw.bytes = bytes; InterlockedIncrement(&file->ioCount); @@ -686,7 +686,7 @@ AsyncId NtFileRead ( // buffer must stay valid until I/O is completed AsyncId NtFileWrite ( AsyncFile conn, - qword offset, + uint64_t offset, const void * buffer, unsigned bytes, unsigned flags, @@ -698,7 +698,7 @@ AsyncId NtFileWrite ( ASSERT((flags & (kAsyncFileRwNotify|kAsyncFileRwSync)) != (kAsyncFileRwNotify|kAsyncFileRwSync)); ASSERT(! (offset & file->sectorSizeMask)); ASSERT(! (bytes & file->sectorSizeMask)); - ASSERT(! ((unsigned_ptr) buffer & file->sectorSizeMask)); + ASSERT(! ((uintptr_t) buffer & file->sectorSizeMask)); // Normally, I/O events do not complete until both the WIN32 operation has completed // and the callback notification has occurred. A deadlock can occur if a thread attempts @@ -708,9 +708,9 @@ AsyncId NtFileWrite ( // enable the sequential thread to perform a wait operation, we set the event field // into the Overlapped structure, because the event will be signaled prior to the // potentially deadlocking callback notification. - NtOpFileReadWrite * op = NEW(NtOpFileReadWrite); - op->overlapped.Offset = (dword) (offset & 0xffffffff); - op->overlapped.OffsetHigh = (dword) (offset >> 32); + NtOpFileReadWrite * op = new NtOpFileReadWrite; + op->overlapped.Offset = (uint32_t) (offset & 0xffffffff); + op->overlapped.OffsetHigh = (uint32_t) (offset >> 32); op->overlapped.hEvent = (flags & kAsyncFileRwSync) ? CreateEvent(nil, true, false, nil) : nil; op->opType = kOpFileWrite; op->notify = (flags & kAsyncFileRwNotify) != 0; @@ -720,7 +720,7 @@ AsyncId NtFileWrite ( op->win32Bytes = bytes; op->rw.param = param; op->rw.offset = offset; - op->rw.buffer = (byte *) buffer; + op->rw.buffer = (uint8_t *) buffer; op->rw.bytes = bytes; InterlockedIncrement(&file->ioCount); @@ -745,7 +745,7 @@ AsyncId NtFileWrite ( //=========================================================================== AsyncId NtFileFlushBuffers ( AsyncFile conn, - qword truncateSize, + uint64_t truncateSize, bool notify, void * param ) { @@ -756,7 +756,7 @@ AsyncId NtFileFlushBuffers ( ASSERT((truncateSize == kAsyncFileDontTruncate) || !(truncateSize & file->sectorSizeMask)); // create new operation - NtOpFileFlush * op = NEW(NtOpFileFlush); + NtOpFileFlush * op = new NtOpFileFlush; file->critsect.Enter(); // write operations cannot complete while a flush is in progress @@ -799,7 +799,7 @@ AsyncId NtFileFlushBuffers ( //=========================================================================== void NtFileClose ( AsyncFile conn, - qword truncateSize + uint64_t truncateSize ) { NtFile * file = (NtFile *) conn; ASSERT(file); @@ -853,7 +853,7 @@ void NtFileClose ( //=========================================================================== void NtFileSetLastWriteTime ( AsyncFile conn, - qword lastWriteTime + uint64_t lastWriteTime ) { NtFile * file = (NtFile *) conn; ASSERT(file); @@ -866,12 +866,12 @@ void NtFileSetLastWriteTime ( } //=========================================================================== -qword NtFileGetLastWriteTime ( - const wchar fileName[] +uint64_t NtFileGetLastWriteTime ( + const wchar_t fileName[] ) { WIN32_FILE_ATTRIBUTE_DATA info; bool f = GetFileAttributesExW(fileName, GetFileExInfoStandard, &info); - return f ? *((qword *) &info.ftLastWriteTime) : 0; + return f ? *((uint64_t *) &info.ftLastWriteTime) : 0; } //=========================================================================== @@ -887,7 +887,7 @@ AsyncId NtFileCreateSequence ( ASSERT(file->ioType == kNtFile); // create new operation - NtOpFileSequence * op = NEW(NtOpFileSequence); + NtOpFileSequence * op = new NtOpFileSequence; file->critsect.Enter(); // init Operation @@ -968,7 +968,7 @@ bool NtFileWaitId (AsyncFile conn, AsyncId asyncId, unsigned timeoutMs) { // create an object to wait on if (!op->signalComplete) - op->signalComplete = NEW(CNtWaitHandle); + op->signalComplete = new CNtWaitHandle; signalComplete = op->signalComplete; signalComplete->IncRef(); break; @@ -988,7 +988,7 @@ bool NtFileWaitId (AsyncFile conn, AsyncId asyncId, unsigned timeoutMs) { //============================================================================ bool NtFileSeek ( AsyncFile conn, - qword distance, + uint64_t distance, EFileSeekFrom from ) { COMPILER_ASSERT(kFileSeekFromBegin == FILE_BEGIN); @@ -998,8 +998,8 @@ bool NtFileSeek ( NtFile * file = (NtFile *) conn; LONG low = (LONG)(distance % 0x100000000ul); LONG high = (LONG)(distance / 0x100000000ul); - dword result = SetFilePointer(file->handle, low, &high, from); - if ((result == (dword)-1) && (GetLastError() != NO_ERROR)) { + uint32_t result = SetFilePointer(file->handle, low, &high, from); + if ((result == (uint32_t)-1) && (GetLastError() != NO_ERROR)) { LogMsg(kLogFatal, "failed: SetFilePointer"); return false; } diff --git a/Sources/Plasma/NucleusLib/pnAsyncCoreExe/Private/Nt/pnAceNtInt.h b/Sources/Plasma/NucleusLib/pnAsyncCoreExe/Private/Nt/pnAceNtInt.h index 35c7aa24..0d2bc7d4 100644 --- a/Sources/Plasma/NucleusLib/pnAsyncCoreExe/Private/Nt/pnAceNtInt.h +++ b/Sources/Plasma/NucleusLib/pnAsyncCoreExe/Private/Nt/pnAceNtInt.h @@ -229,36 +229,36 @@ void NtSignalShutdown (); void NtWaitForShutdown (); void NtSleep (unsigned sleepMs); AsyncFile NtFileOpen ( - const wchar fullPath[], + const wchar_t fullPath[], FAsyncNotifyFileProc notifyProc, EFileError * error, unsigned desiredAccess, unsigned openMode, unsigned shareModeFlags, void * userState, - qword * fileSize, - qword * fileLastWriteTime + uint64_t * fileSize, + uint64_t * fileLastWriteTime ); void NtFileClose ( AsyncFile file, - qword truncateSize + uint64_t truncateSize ); void NtFileSetLastWriteTime ( AsyncFile file, - qword lastWriteTime + uint64_t lastWriteTime ); -qword NtFileGetLastWriteTime ( - const wchar fileName[] +uint64_t NtFileGetLastWriteTime ( + const wchar_t fileName[] ); AsyncId NtFileFlushBuffers ( AsyncFile file, - qword truncateSize, + uint64_t truncateSize, bool notify, void * param ); AsyncId NtFileRead ( AsyncFile file, - qword offset, + uint64_t offset, void * buffer, unsigned bytes, unsigned flags, @@ -266,7 +266,7 @@ AsyncId NtFileRead ( ); AsyncId NtFileWrite ( AsyncFile file, - qword offset, + uint64_t offset, const void *buffer, unsigned bytes, unsigned flags, @@ -279,7 +279,7 @@ AsyncId NtFileCreateSequence ( ); bool NtFileSeek ( AsyncFile file, - qword distance, + uint64_t distance, EFileSeekFrom from ); void NtSocketConnect ( diff --git a/Sources/Plasma/NucleusLib/pnAsyncCoreExe/Private/Nt/pnAceNtSocket.cpp b/Sources/Plasma/NucleusLib/pnAsyncCoreExe/Private/Nt/pnAceNtSocket.cpp index f10fbba2..9d501063 100644 --- a/Sources/Plasma/NucleusLib/pnAsyncCoreExe/Private/Nt/pnAceNtSocket.cpp +++ b/Sources/Plasma/NucleusLib/pnAsyncCoreExe/Private/Nt/pnAceNtSocket.cpp @@ -97,7 +97,7 @@ struct NtOpConnAttempt : Operation { SOCKET hSocket; unsigned failTimeMs; unsigned sendBytes; - byte sendData[1]; // actually [sendBytes] + uint8_t sendData[1]; // actually [sendBytes] // no additional fields }; @@ -121,7 +121,7 @@ struct NtSock : NtObject { NtOpSocketRead opRead; unsigned backlogAlloc; unsigned initTimeMs; - byte buffer[kAsyncSocketBufferSize]; + uint8_t buffer[kAsyncSocketBufferSize]; NtSock (); ~NtSock (); @@ -196,8 +196,8 @@ static void SocketGetAddresses ( NetAddress * remoteAddr ) { // NetAddress may be bigger than sockaddr_in so start by zeroing the whole thing - ZEROPTR(localAddr); - ZEROPTR(remoteAddr); + memset(localAddr, 0, sizeof(*localAddr)); + memset(remoteAddr, 0, sizeof(*remoteAddr)); // don't have to enter critsect or validate socket before referencing it // because this routine is called before the user has a chance to close it @@ -291,7 +291,7 @@ static bool SocketDispatchRead (NtSock * sock) { //=========================================================================== static NtOpSocketWrite * SocketQueueAsyncWrite ( NtSock * sock, - const byte * data, + const uint8_t * data, unsigned bytes ) { // check for data backlog @@ -334,7 +334,7 @@ static NtOpSocketWrite * SocketQueueAsyncWrite ( bytesLeft = min(bytesLeft, bytes); if (bytesLeft) { PerfAddCounter(kAsyncPerfSocketBytesWaitQueued, bytesLeft); - MemCopy(lastQueuedWrite->write.buffer + lastQueuedWrite->write.bytes, data, bytesLeft); + memcpy(lastQueuedWrite->write.buffer + lastQueuedWrite->write.bytes, data, bytesLeft); lastQueuedWrite->write.bytes += bytesLeft; data += bytesLeft; if (0 == (bytes -= bytesLeft)) @@ -348,7 +348,7 @@ static NtOpSocketWrite * SocketQueueAsyncWrite ( // extra space in case more data needs to be queued later unsigned bytesAlloc = max(bytes, sock->backlogAlloc); bytesAlloc = max(bytesAlloc, kMinBacklogBytes); - NtOpSocketWrite * op = new(ALLOC(sizeof(NtOpSocketWrite) + bytesAlloc)) NtOpSocketWrite; + NtOpSocketWrite * op = new(malloc(sizeof(NtOpSocketWrite) + bytesAlloc)) NtOpSocketWrite; // init Operation const AsyncId asyncId = INtConnSequenceStart(sock); @@ -367,10 +367,10 @@ static NtOpSocketWrite * SocketQueueAsyncWrite ( op->bytesAlloc = bytesAlloc; op->write.param = nil; op->write.asyncId = asyncId; - op->write.buffer = (byte *) (op + 1); + op->write.buffer = (uint8_t *) (op + 1); op->write.bytes = bytes; op->write.bytesProcessed = bytes; - MemCopy(op->write.buffer, data, bytes); + memcpy(op->write.buffer, data, bytes); InterlockedIncrement(&sock->ioCount); PerfAddCounter(kAsyncPerfSocketBytesWaitQueued, bytes); @@ -517,7 +517,7 @@ static SOCKET ListenSocket (NetAddress * listenAddr) { return INVALID_SOCKET; } - for (;;) { // actually for (ONCE) + do { /* this code was an attempt to enable the server to close and then re-open the same port for listening. It doesn't appear to work, and moreover, it causes the bind to signal success even though the port cannot be opened (for example, because another application @@ -546,11 +546,11 @@ static SOCKET ListenSocket (NetAddress * listenAddr) { // bind socket to port sockaddr_in addr; addr.sin_family = AF_INET; - addr.sin_port = htons((word)port); + addr.sin_port = htons((uint16_t)port); addr.sin_addr.S_un.S_addr = htonl(node); - MemZero(addr.sin_zero, sizeof(addr.sin_zero)); + memset(addr.sin_zero, 0, sizeof(addr.sin_zero)); if (bind(s, (sockaddr *) &addr, sizeof(addr))) { - wchar str[32]; + wchar_t str[32]; NetAddressToString(*listenAddr, str, arrsize(str), kNetAddressFormatAll); LogMsg(kLogError, "bind to addr %s failed (err %u)", str, WSAGetLastError()); break; @@ -583,7 +583,7 @@ static SOCKET ListenSocket (NetAddress * listenAddr) { // success! NetAddressSetPort(port, listenAddr); return s; - } + } while (false); // failure! closesocket(s); @@ -600,7 +600,7 @@ static void ListenPrepareListeners (fd_set * readfds) { // destroy unused ports if (!port->listenCount) { - DEL(port); + delete port; continue; } @@ -620,7 +620,7 @@ static SOCKET ConnectSocket (unsigned localPort, const NetAddress & addr) { return INVALID_SOCKET; } - for (;;) { // actually for (ONCE) + do { // make socket non-blocking u_long nonBlocking = true; if (ioctlsocket(s, FIONBIO, &nonBlocking)) @@ -630,9 +630,9 @@ static SOCKET ConnectSocket (unsigned localPort, const NetAddress & addr) { if (localPort) { sockaddr_in addr; addr.sin_family = AF_INET; - addr.sin_port = htons((word) localPort); + addr.sin_port = htons((uint16_t) localPort); addr.sin_addr.S_un.S_addr = INADDR_ANY; - MemZero(addr.sin_zero, sizeof(addr.sin_zero)); + memset(addr.sin_zero, 0, sizeof(addr.sin_zero)); if (bind(s, (sockaddr *) &addr, sizeof(addr))) { LogMsg(kLogError, "bind(port %u) failed (%u)", localPort, WSAGetLastError()); break; @@ -648,7 +648,7 @@ static SOCKET ConnectSocket (unsigned localPort, const NetAddress & addr) { // success! return s; - } + } while (false); // failure! closesocket(s); @@ -800,13 +800,13 @@ static void StartListenThread () { #ifdef HS_DEBUGGING #include static void __cdecl DumpInvalidData ( - const wchar filename[], + const wchar_t filename[], unsigned bytes, - const byte data[], + const uint8_t data[], const char fmt[], ... ) { - wchar path[MAX_PATH]; + wchar_t path[MAX_PATH]; PathGetProgramDirectory(path, arrsize(path)); PathAddFilename(path, path, L"Log", arrsize(path)); PathAddFilename(path, path, filename, arrsize(path)); @@ -971,7 +971,7 @@ void INtSocketOpCompleteSocketConnect (NtOpConnAttempt * op) { failed.param = op->param; failed.connType = op->sendData[0]; failed.remoteAddr = op->remoteAddr; - ZERO(failed.localAddr); + memset(&failed.localAddr, 0, sizeof(failed.localAddr)); op->notifyProc(nil, kNotifySocketConnectFailed, &failed, nil); } @@ -980,7 +980,7 @@ void INtSocketOpCompleteSocketConnect (NtOpConnAttempt * op) { // and because connection attempts are not waitable ASSERT(!op->link.IsLinked()); ASSERT(!op->signalComplete); - DEL(op); + delete op; PerfSubCounter(kAsyncPerfSocketConnAttemptsOutCurr, 1); } @@ -992,7 +992,7 @@ void INtSocketOpCompleteSocketRead ( ) { ASSERT(sock->ioType == kNtSocket); - for (ONCE) { + do { // a zero-byte read means the socket is going // to shutdown, so don't start another read if (!bytes) @@ -1008,10 +1008,6 @@ void INtSocketOpCompleteSocketRead ( sock->opRead.read.bytes = sock->bytesLeft; sock->opRead.read.bytesProcessed = 0; - if (sock->connType == kConnTypeCliToAuth) { - int x = 0; - } - if (!SocketDispatchRead(sock)) break; @@ -1050,7 +1046,7 @@ void INtSocketOpCompleteSocketRead ( } if (sock->opRead.read.bytesProcessed) { - MemMove( + memmove( sock->buffer, sock->buffer + sock->opRead.read.bytesProcessed, sock->bytesLeft @@ -1063,7 +1059,7 @@ void INtSocketOpCompleteSocketRead ( } SocketStartAsyncRead(sock); - } + } while(false); INtConnCompleteOperation(sock); } @@ -1188,7 +1184,7 @@ void NtSocketConnect ( // create async connection record with enough extra bytes for sendData NtOpConnAttempt * op = - new(ALLOC(sizeof(NtOpConnAttempt) - sizeof(op->sendData) + sendBytes)) NtOpConnAttempt; + new(malloc(sizeof(NtOpConnAttempt) - sizeof(op->sendData) + sendBytes)) NtOpConnAttempt; // init Operation op->overlapped.Offset = 0; @@ -1209,7 +1205,7 @@ void NtSocketConnect ( op->hSocket = INVALID_SOCKET; op->failTimeMs = connectMs ? connectMs : kConnectTimeMs; if (0 != (op->sendBytes = sendBytes)) - MemCopy(op->sendData, sendData, sendBytes); + memcpy(op->sendData, sendData, sendBytes); else op->sendData[0] = kConnTypeNil; @@ -1259,7 +1255,7 @@ void NtSocketDelete (AsyncSocket conn) { return; } - DEL(sock); + delete sock; } //=========================================================================== @@ -1351,7 +1347,7 @@ bool NtSocketSend ( break; // subtract the data we already sent - data = (const byte *) data + bytesSent; + data = (const uint8_t *) data + bytesSent; bytes -= bytesSent; // and queue it below } @@ -1363,7 +1359,7 @@ bool NtSocketSend ( } } - NtOpSocketWrite * op = SocketQueueAsyncWrite(sock, (const byte *) data, bytes); + NtOpSocketWrite * op = SocketQueueAsyncWrite(sock, (const uint8_t *) data, bytes); if (op && !dataQueued) result = INtSocketOpCompleteQueuedSocketWrite(sock, op); else @@ -1399,7 +1395,7 @@ bool NtSocketWrite ( } // init Operation - NtOpSocketWrite * op = NEW(NtOpSocketWrite); + NtOpSocketWrite * op = new NtOpSocketWrite; op->overlapped.Offset = 0; op->overlapped.OffsetHigh = 0; op->overlapped.hEvent = nil; @@ -1415,7 +1411,7 @@ bool NtSocketWrite ( op->bytesAlloc = bytes; op->write.param = param; op->write.asyncId = op->asyncId; - op->write.buffer = (byte *) buffer; + op->write.buffer = (uint8_t *) buffer; op->write.bytes = bytes; op->write.bytesProcessed = bytes; PerfAddCounter(kAsyncPerfSocketBytesWaitQueued, bytes); diff --git a/Sources/Plasma/NucleusLib/pnAsyncCoreExe/Private/W9x/pnAceW9xFile.cpp b/Sources/Plasma/NucleusLib/pnAsyncCoreExe/Private/W9x/pnAceW9xFile.cpp index 08270f53..d35f9f8b 100644 --- a/Sources/Plasma/NucleusLib/pnAsyncCoreExe/Private/W9x/pnAceW9xFile.cpp +++ b/Sources/Plasma/NucleusLib/pnAsyncCoreExe/Private/W9x/pnAceW9xFile.cpp @@ -98,22 +98,22 @@ public: ~CFile (); void Read ( - qword offset, + uint64_t offset, void * buffer, unsigned bytes ); - void SetLastWriteTime (qword lastWriteTime); + void SetLastWriteTime (uint64_t lastWriteTime); - void Truncate (qword size); + void Truncate (uint64_t size); void Write ( - qword offset, + uint64_t offset, const void * buffer, unsigned bytes ); - bool Seek (qword offset, EFileSeekFrom from); + bool Seek (uint64_t offset, EFileSeekFrom from); }; //=========================================================================== @@ -190,12 +190,12 @@ void CFile::Complete (void * op, CCritSect * critSect, AsyncId asyncId) { //=========================================================================== void CFile::Delete (void * op) { FileOp * fileOp = (FileOp *)op; - DEL(fileOp); + delete fileOp; } //=========================================================================== void CFile::Read ( - qword offset, + uint64_t offset, void * buffer, unsigned bytes ) { @@ -215,7 +215,7 @@ void CFile::Read ( // Handle errors if (bytesRead != bytes) - MemZero((byte *)buffer + bytesRead, bytes - bytesRead); + memset((uint8_t *)buffer + bytesRead, 0, bytes - bytesRead); if ( (!result && (GetLastError() != ERROR_IO_PENDING)) || (bytesRead != bytes) ) LogMsg(kLogFatal, "failed: ReadFile"); @@ -223,15 +223,15 @@ void CFile::Read ( } //=========================================================================== -bool CFile::Seek (qword offset, EFileSeekFrom from) { +bool CFile::Seek (uint64_t offset, EFileSeekFrom from) { COMPILER_ASSERT(kFileSeekFromBegin == FILE_BEGIN); COMPILER_ASSERT(kFileSeekFromCurrent == FILE_CURRENT); COMPILER_ASSERT(kFileSeekFromEnd == FILE_END); LONG low = (LONG)(offset % 0x100000000ul); LONG high = (LONG)(offset / 0x100000000ul); - dword result = SetFilePointer(m_handle, low, &high, from); - if ((result == (dword)-1) && (GetLastError() != NO_ERROR)) { + uint32_t result = SetFilePointer(m_handle, low, &high, from); + if ((result == (uint32_t)-1) && (GetLastError() != NO_ERROR)) { LogMsg(kLogFatal, "failed: SetFilePointer"); return false; } @@ -240,13 +240,13 @@ bool CFile::Seek (qword offset, EFileSeekFrom from) { } //=========================================================================== -void CFile::SetLastWriteTime (qword lastWriteTime) { +void CFile::SetLastWriteTime (uint64_t lastWriteTime) { COMPILER_ASSERT(sizeof(lastWriteTime) == sizeof(FILETIME)); SetFileTime(m_handle, nil, nil, (const FILETIME *)&lastWriteTime); } //=========================================================================== -void CFile::Truncate (qword size) { +void CFile::Truncate (uint64_t size) { ASSERT(size != kAsyncFileDontTruncate); if (Seek(size, kFileSeekFromBegin) && !SetEndOfFile(m_handle)) @@ -255,7 +255,7 @@ void CFile::Truncate (qword size) { //=========================================================================== void CFile::Write ( - qword offset, + uint64_t offset, const void * buffer, unsigned bytes ) { @@ -296,7 +296,7 @@ void CFile::Write ( //=========================================================================== void W9xFileClose ( AsyncFile file, - qword truncateSize + uint64_t truncateSize ) { // Dereference the object @@ -322,7 +322,7 @@ AsyncId W9xFileCreateSequence ( CFile * object = (CFile *)file; // Queue an operation - FileOp * op = NEW(FileOp); + FileOp * op = new FileOp; op->code = kNotifyFileSequence; op->notify = notify; op->data.flush.param = param; @@ -333,7 +333,7 @@ AsyncId W9xFileCreateSequence ( //=========================================================================== AsyncId W9xFileFlushBuffers ( AsyncFile file, - qword truncateSize, + uint64_t truncateSize, bool notify, void * param ) { @@ -342,7 +342,7 @@ AsyncId W9xFileFlushBuffers ( CFile * object = (CFile *)file; // Queue an operation - FileOp * op = NEW(FileOp); + FileOp * op = new FileOp; op->code = kNotifyFileFlush; op->notify = notify; op->data.flush.param = param; @@ -354,15 +354,15 @@ AsyncId W9xFileFlushBuffers ( //=========================================================================== AsyncFile W9xFileOpen ( - const wchar fullPath[], + const wchar_t fullPath[], FAsyncNotifyFileProc notifyProc, EFileError * error, unsigned desiredAccess, unsigned openMode, unsigned shareModeFlags, void * userState, - qword * fileSize, - qword * fileLastWriteTime + uint64_t * fileSize, + uint64_t * fileLastWriteTime ) { HANDLE fileHandle = CreateFileW( fullPath, @@ -394,14 +394,14 @@ AsyncFile W9xFileOpen ( CloseHandle(fileHandle); return nil; } - const qword size = ((qword) sizeHi << (qword) 32) | (qword) sizeLo; + const uint64_t size = ((uint64_t) sizeHi << (uint64_t) 32) | (uint64_t) sizeLo; - qword lastWriteTime; + uint64_t lastWriteTime; ASSERT(sizeof(lastWriteTime) >= sizeof(FILETIME)); GetFileTime(fileHandle, nil, nil, (FILETIME *) &lastWriteTime); // Create a file object - CFile * object = NEW(CFile)( + CFile * object = new CFile( fileHandle, notifyProc, userState @@ -418,7 +418,7 @@ AsyncFile W9xFileOpen ( //=========================================================================== AsyncId W9xFileRead ( AsyncFile file, - qword offset, + uint64_t offset, void * buffer, unsigned bytes, unsigned flags, @@ -436,12 +436,12 @@ AsyncId W9xFileRead ( // Queue asynchronous operations else { - FileOp * op = NEW(FileOp); + FileOp * op = new FileOp; op->code = kNotifyFileRead; op->notify = (flags & kAsyncFileRwNotify) != 0; op->data.read.param = param; op->data.read.offset = offset; - op->data.read.buffer = (byte *)buffer; + op->data.read.buffer = (uint8_t *)buffer; op->data.read.bytes = bytes; return object->Queue(op); } @@ -451,7 +451,7 @@ AsyncId W9xFileRead ( //=========================================================================== void W9xFileSetLastWriteTime ( AsyncFile file, - qword lastWriteTime + uint64_t lastWriteTime ) { // Dereference the object @@ -463,18 +463,18 @@ void W9xFileSetLastWriteTime ( } //=========================================================================== -qword W9xFileGetLastWriteTime ( - const wchar fileName[] +uint64_t W9xFileGetLastWriteTime ( + const wchar_t fileName[] ) { WIN32_FILE_ATTRIBUTE_DATA info; bool f = GetFileAttributesExW(fileName, GetFileExInfoStandard, &info); - return f ? *((qword *) &info.ftLastWriteTime) : 0; + return f ? *((uint64_t *) &info.ftLastWriteTime) : 0; } //=========================================================================== AsyncId W9xFileWrite ( AsyncFile file, - qword offset, + uint64_t offset, const void * buffer, unsigned bytes, unsigned flags, @@ -492,12 +492,12 @@ AsyncId W9xFileWrite ( // Queue asynchronous operations else { - FileOp * op = NEW(FileOp); + FileOp * op = new FileOp; op->code = kNotifyFileWrite; op->notify = (flags & kAsyncFileRwNotify) != 0; op->data.write.param = param; op->data.write.offset = offset; - op->data.write.buffer = (byte *)buffer; + op->data.write.buffer = (uint8_t *)buffer; op->data.write.bytes = bytes; return object->Queue(op); } @@ -507,7 +507,7 @@ AsyncId W9xFileWrite ( //============================================================================ bool W9xFileSeek ( AsyncFile file, - qword distance, + uint64_t distance, EFileSeekFrom from ) { CFile * object = (CFile *)file; diff --git a/Sources/Plasma/NucleusLib/pnAsyncCoreExe/Private/W9x/pnAceW9xInt.h b/Sources/Plasma/NucleusLib/pnAsyncCoreExe/Private/W9x/pnAceW9xInt.h index 04e93d3a..f8668c1b 100644 --- a/Sources/Plasma/NucleusLib/pnAsyncCoreExe/Private/W9x/pnAceW9xInt.h +++ b/Sources/Plasma/NucleusLib/pnAsyncCoreExe/Private/W9x/pnAceW9xInt.h @@ -88,36 +88,36 @@ bool W9xThreadWaitId ( ); AsyncFile W9xFileOpen ( - const wchar fullPath[], + const wchar_t fullPath[], FAsyncNotifyFileProc notifyProc, EFileError * error, unsigned desiredAccess, unsigned openMode, unsigned shareModeFlags, void * userState, - qword * fileSize, - qword * fileLastWriteTime + uint64_t * fileSize, + uint64_t * fileLastWriteTime ); void W9xFileClose ( AsyncFile file, - qword truncateSize + uint64_t truncateSize ); void W9xFileSetLastWriteTime ( AsyncFile file, - qword lastWriteTime + uint64_t lastWriteTime ); -qword W9xFileGetLastWriteTime ( - const wchar fileName[] +uint64_t W9xFileGetLastWriteTime ( + const wchar_t fileName[] ); AsyncId W9xFileFlushBuffers ( AsyncFile file, - qword truncateSize, + uint64_t truncateSize, bool notify, void * param ); AsyncId W9xFileRead ( AsyncFile file, - qword offset, + uint64_t offset, void * buffer, unsigned bytes, unsigned flags, @@ -125,7 +125,7 @@ AsyncId W9xFileRead ( ); AsyncId W9xFileWrite ( AsyncFile file, - qword offset, + uint64_t offset, const void *buffer, unsigned bytes, unsigned flags, @@ -138,7 +138,7 @@ AsyncId W9xFileCreateSequence ( ); bool W9xFileSeek ( AsyncFile file, - qword distance, + uint64_t distance, EFileSeekFrom from ); void W9xSocketConnect ( diff --git a/Sources/Plasma/NucleusLib/pnAsyncCoreExe/Private/W9x/pnAceW9xSocket.cpp b/Sources/Plasma/NucleusLib/pnAsyncCoreExe/Private/W9x/pnAceW9xSocket.cpp index 201177d8..e94bd60c 100644 --- a/Sources/Plasma/NucleusLib/pnAsyncCoreExe/Private/W9x/pnAceW9xSocket.cpp +++ b/Sources/Plasma/NucleusLib/pnAsyncCoreExe/Private/W9x/pnAceW9xSocket.cpp @@ -194,7 +194,7 @@ private: void * param; union { struct { - byte connType; + uint8_t connType; } connect; struct { const void * data; // pointer to application's data @@ -206,7 +206,7 @@ private: // These variables are protected by the critical section CCritSect m_critSect; LISTDECL(Command, link) m_commandList; - ARRAY(byte) m_sendQueue; + ARRAY(uint8_t) m_sendQueue; // These variables are never modified outside the constructor and // destructor @@ -218,7 +218,7 @@ private: // These variables are only ever touched during a callback from the // window procedure, which is single threaded unsigned m_dispatched; - byte m_readBuffer[1460 * 2]; + uint8_t m_readBuffer[1460 * 2]; unsigned m_readBytes; void * m_userState; @@ -246,7 +246,7 @@ public: void ProcessQueue (); void QueueConnect ( void * param, - byte connType + uint8_t connType ); void QueueWrite ( void * param, @@ -430,8 +430,8 @@ void CSocket::OnConnect () { // Get addresses for the connection notification AsyncNotifySocketConnect notify; - ZERO(notify.localAddr); - ZERO(notify.remoteAddr); + memset(¬ify.localAddr, 0, sizeof(notify.localAddr)); + memset(¬ify.remoteAddr, 0, sizeof(notify.remoteAddr)); int nameLen = sizeof(notify.localAddr); if (getsockname(m_sock, (sockaddr *)¬ify.localAddr, &nameLen)) if (GetLastError() == WSAENOTCONN) @@ -457,13 +457,13 @@ void CSocket::OnConnect () { ); // Delete the connect command - DEL(command); + delete command; // Handle failure to connect if (error) { // Destroy the socket - DEL(this); + delete this; } @@ -528,7 +528,7 @@ void CSocket::OnReadReady () { if (notify.bytesProcessed >= m_readBytes) m_readBytes = 0; else if (notify.bytesProcessed) { - MemMove( + memmove( &m_readBuffer[0], &m_readBuffer[notify.bytesProcessed], m_readBytes - notify.bytesProcessed @@ -578,12 +578,12 @@ void CSocket::OnWriteReady () { if ((unsigned)result == m_sendQueue.Bytes()) m_sendQueue.Clear(); else if (result) { - MemMove( + memmove( &m_sendQueue[0], &m_sendQueue[result], m_sendQueue.Bytes() - result ); - COMPILER_ASSERT(sizeof(m_sendQueue[0]) == sizeof(byte)); + COMPILER_ASSERT(sizeof(m_sendQueue[0]) == sizeof(uint8_t)); m_sendQueue.SetCount(m_sendQueue.Count() - result); } @@ -625,7 +625,7 @@ void CSocket::ProcessQueue () { AsyncNotifySocketWrite notify; notify.param = command->param; notify.asyncId = 0; - notify.buffer = (byte *)command->write.data; + notify.buffer = (uint8_t *)command->write.data; notify.bytes = command->write.bytes; notify.bytesProcessed = 0; bool notifyResult = m_notifyProc( @@ -643,7 +643,7 @@ void CSocket::ProcessQueue () { } // Delete the command - DEL(command); + delete command; } @@ -652,11 +652,11 @@ void CSocket::ProcessQueue () { //=========================================================================== void CSocket::QueueConnect ( void * param, - byte connType + uint8_t connType ) { ASSERT(!IsConnected() && !IsDisconnected()); - Command * command = NEW(Command); + Command * command = new Command; command->code = command->CONNECT; command->param = param; command->connect.connType = connType; @@ -671,7 +671,7 @@ void CSocket::QueueWrite ( ) { ASSERT(!IsDisconnected()); - Command * command = NEW(Command); + Command * command = new Command; command->code = command->CONNECT; command->param = param; command->write.data = data; @@ -710,7 +710,7 @@ bool CSocket::Send ( // returns false if disconnected // If we were unable to send the entire message, queue the unsent portion if ((unsigned)result < bytes) { m_sendQueue.Add( - (const byte *)data + result, + (const uint8_t *)data + result, bytes - result ); } @@ -913,7 +913,7 @@ static unsigned THREADCALL W9xSocketThreadProc (AsyncThread *) { // Register the window class HINSTANCE instance = (HINSTANCE)GetModuleHandle(nil); WNDCLASS wndClass; - ZERO(wndClass); + memset(&wndClass, 0, sizeof(wndClass)); wndClass.lpfnWndProc = WndProc; wndClass.hInstance = instance; wndClass.lpszClassName = CLASS_NAME; @@ -1027,7 +1027,7 @@ void W9xSocketConnect ( UINT message = (s_message++ & 0x3fff) | WM_APP; // range 0x8000 - 0xbfff // Create a socket object - CSocket * object = NEW(CSocket)( + CSocket * object = new CSocket( sequence, message, sock, @@ -1037,7 +1037,7 @@ void W9xSocketConnect ( // Queue a connect notification for the socket object->QueueConnect( param, - sendBytes ? ((const byte *)sendData)[0] : (byte)0 + sendBytes ? ((const uint8_t *)sendData)[0] : (uint8_t)0 ); // Queue sending data @@ -1105,7 +1105,7 @@ void W9xSocketDelete ( // Delete the object s_critSect.Enter(); - DEL(object); + delete object; s_critSect.Leave(); } diff --git a/Sources/Plasma/NucleusLib/pnAsyncCoreExe/Private/W9x/pnAceW9xThread.cpp b/Sources/Plasma/NucleusLib/pnAsyncCoreExe/Private/W9x/pnAceW9xThread.cpp index cd32386d..e4ef0e54 100644 --- a/Sources/Plasma/NucleusLib/pnAsyncCoreExe/Private/W9x/pnAceW9xThread.cpp +++ b/Sources/Plasma/NucleusLib/pnAsyncCoreExe/Private/W9x/pnAceW9xThread.cpp @@ -206,7 +206,7 @@ void CThreadDispObject::Close () { //=========================================================================== AsyncId CThreadDispObject::Queue (void * op) { AsyncId asyncId = 0; - NEW(CThreadDispRec)(this, op, &asyncId); + new CThreadDispRec(this, op, &asyncId); SetEvent(s_signalEvent); return asyncId; } @@ -234,7 +234,7 @@ static unsigned CALLBACK W9xThreadProc (AsyncThread *) { if (rec) { s_dispInProcList.Link(rec); rec->Complete(&s_critSect); - DEL(rec); + delete rec; timeout = 0; } else { @@ -245,7 +245,7 @@ static unsigned CALLBACK W9xThreadProc (AsyncThread *) { // Consume events, check for destruction, and block if we have // nothing to do. HANDLE events[] = {s_destroyEvent, s_signalEvent}; - dword result = WaitForMultipleObjects( + uint32_t result = WaitForMultipleObjects( arrsize(events), events, FALSE, diff --git a/Sources/Plasma/NucleusLib/pnAsyncCoreExe/Private/Win32/pnAceW32Dns.cpp b/Sources/Plasma/NucleusLib/pnAsyncCoreExe/Private/Win32/pnAceW32Dns.cpp index c9d76c51..4b44f696 100644 --- a/Sources/Plasma/NucleusLib/pnAsyncCoreExe/Private/Win32/pnAceW32Dns.cpp +++ b/Sources/Plasma/NucleusLib/pnAsyncCoreExe/Private/Win32/pnAceW32Dns.cpp @@ -69,7 +69,7 @@ struct Lookup { FAsyncLookupProc lookupProc; unsigned port; void * param; - wchar name[kMaxLookupName]; + wchar_t name[kMaxLookupName]; char buffer[MAXGETHOSTSTRUCT]; }; @@ -90,41 +90,40 @@ static unsigned s_nextLookupCancelId = 1; static void LookupProcess (Lookup * lookup, unsigned error) { unsigned count = 0; NetAddress * addrs = nil; - for (ONCE) { - if (error) - break; - const HOSTENT & host = * (HOSTENT *) lookup->buffer; - if (host.h_addrtype != AF_INET) - break; - if (host.h_length != sizeof(in_addr)) - break; - if (!host.h_addr_list) - break; + if (error) + return; - in_addr const * const * const inAddr = (in_addr **) host.h_addr_list; + const HOSTENT & host = * (HOSTENT *) lookup->buffer; + if (host.h_addrtype != AF_INET) + return; + if (host.h_length != sizeof(in_addr)) + return; + if (!host.h_addr_list) + return; - // count the number of addresses - while (inAddr[count]) - ++count; + in_addr const * const * const inAddr = (in_addr **) host.h_addr_list; - // allocate a buffer large enough to hold all the addresses - addrs = (NetAddress *) _alloca(sizeof(*addrs) * count); - MemZero(addrs, sizeof(*addrs) * count); + // count the number of addresses + while (inAddr[count]) + ++count; - // fill in address data - const word port = htons((word) lookup->port); - for (unsigned i = 0; i < count; ++i) { - sockaddr_in * inetaddr = (sockaddr_in *) &addrs[i]; - inetaddr->sin_family = AF_INET; - inetaddr->sin_addr = *inAddr[i]; - inetaddr->sin_port = port; - } + // allocate a buffer large enough to hold all the addresses + addrs = (NetAddress *)malloc(sizeof(*addrs) * count); + memset(addrs, 0, sizeof(*addrs) * count); - if (host.h_name && host.h_name[0]) - StrToUnicode(lookup->name, host.h_name, arrsize(lookup->name)); + // fill in address data + const uint16_t port = htons((uint16_t) lookup->port); + for (unsigned i = 0; i < count; ++i) { + sockaddr_in * inetaddr = (sockaddr_in *) &addrs[i]; + inetaddr->sin_family = AF_INET; + inetaddr->sin_addr = *inAddr[i]; + inetaddr->sin_port = port; } + if (host.h_name && host.h_name[0]) + StrToUnicode(lookup->name, host.h_name, arrsize(lookup->name)); + if (lookup->lookupProc) lookup->lookupProc(lookup->param, lookup->name, count, addrs); @@ -132,8 +131,10 @@ static void LookupProcess (Lookup * lookup, unsigned error) { // section because it isn't linked into an ioConn opList // and because connection attempts are not waitable ASSERT(!lookup->link.IsLinked()); - DEL(lookup); + delete lookup; PerfSubCounter(kAsyncPerfNameLookupAttemptsCurr, 1); + + free(addrs); } //=========================================================================== @@ -157,7 +158,7 @@ static void LookupFindAndProcess (HANDLE cancelHandle, unsigned error) { static unsigned THREADCALL LookupThreadProc (AsyncThread * thread) { static const char WINDOW_CLASS[] = "AsyncLookupWnd"; WNDCLASS wc; - ZERO(wc); + memset(&wc, 0, sizeof(wc)); wc.lpfnWndProc = DefWindowProc; wc.hInstance = GetModuleHandle(0); wc.lpszClassName = WINDOW_CLASS; @@ -174,7 +175,7 @@ static unsigned THREADCALL LookupThreadProc (AsyncThread * thread) { 0 ); if (!s_lookupWindow) - ErrorFatal(__LINE__, __FILE__, "CreateWindow %#x", GetLastError()); + ErrorAssert(__LINE__, __FILE__, "CreateWindow %#x", GetLastError()); HANDLE lookupStartEvent = (HANDLE) thread->argument; SetEvent(lookupStartEvent); @@ -227,7 +228,7 @@ static void StartLookupThread () { (LPCTSTR) 0 // name ); if (!lookupStartEvent) - ErrorFatal(__LINE__, __FILE__, "CreateEvent %#x", GetLastError()); + ErrorAssert(__LINE__, __FILE__, "CreateEvent %#x", GetLastError()); // create a thread to perform lookups s_lookupThread = (HANDLE) AsyncThreadCreate( @@ -270,7 +271,7 @@ void DnsDestroy (unsigned exitThreadWaitMs) { void AsyncAddressLookupName ( AsyncCancelId * cancelId, // out FAsyncLookupProc lookupProc, - const wchar name[], + const wchar_t name[], unsigned port, void * param ) { @@ -290,7 +291,7 @@ void AsyncAddressLookupName ( } // Initialize lookup - Lookup * lookup = NEW(Lookup); + Lookup * lookup = new Lookup; lookup->lookupProc = lookupProc; lookup->port = port; lookup->param = param; @@ -335,7 +336,7 @@ void AsyncAddressLookupAddr ( PerfAddCounter(kAsyncPerfNameLookupAttemptsTotal, 1); // Initialize lookup - Lookup * lookup = NEW(Lookup); + Lookup * lookup = new Lookup; lookup->lookupProc = lookupProc; lookup->port = 1; lookup->param = param; diff --git a/Sources/Plasma/NucleusLib/pnAsyncCoreExe/Private/Win32/pnAceW32Thread.cpp b/Sources/Plasma/NucleusLib/pnAsyncCoreExe/Private/Win32/pnAceW32Thread.cpp index 352caa01..883b13a0 100644 --- a/Sources/Plasma/NucleusLib/pnAsyncCoreExe/Private/Win32/pnAceW32Thread.cpp +++ b/Sources/Plasma/NucleusLib/pnAsyncCoreExe/Private/Win32/pnAceW32Thread.cpp @@ -65,7 +65,7 @@ struct ThreadTask { AsyncThreadTaskList * taskList; FAsyncThreadTask callback; void * param; - wchar debugStr[256]; + wchar_t debugStr[256]; }; static HANDLE s_taskPort; @@ -148,7 +148,7 @@ static unsigned THREADCALL ThreadTaskProc (AsyncThread * thread) { #endif task->taskList->DecRef("task"); - DEL(task); + delete task; } } PerfSubCounter(kAsyncPerfThreadTaskThreadsActive, 1); @@ -234,7 +234,7 @@ void AsyncThreadTaskSetThreadCount (unsigned threads) { //=========================================================================== AsyncThreadTaskList * AsyncThreadTaskListCreate () { ASSERT(s_taskPort); - AsyncThreadTaskList * taskList = NEW(AsyncThreadTaskList); + AsyncThreadTaskList * taskList = new AsyncThreadTaskList; taskList->IncRef("TaskList"); return taskList; } @@ -257,7 +257,7 @@ void AsyncThreadTaskAdd ( AsyncThreadTaskList * taskList, FAsyncThreadTask callback, void * param, - const wchar debugStr[], + const wchar_t debugStr[], EThreadTaskPriority priority /* = kThreadTaskPriorityNormal */ ) { ASSERT(s_taskPort); @@ -266,7 +266,7 @@ void AsyncThreadTaskAdd ( ASSERT(priority == kThreadTaskPriorityNormal); // Allocate a new task record - ThreadTask * task = NEW(ThreadTask); + ThreadTask * task = new ThreadTask; task->taskList = taskList; task->callback = callback; task->param = param; diff --git a/Sources/Plasma/NucleusLib/pnAsyncCoreExe/Private/pnAceInt.h b/Sources/Plasma/NucleusLib/pnAsyncCoreExe/Private/pnAceInt.h index 79f53f42..3a2d274b 100644 --- a/Sources/Plasma/NucleusLib/pnAsyncCoreExe/Private/pnAceInt.h +++ b/Sources/Plasma/NucleusLib/pnAsyncCoreExe/Private/pnAceInt.h @@ -105,41 +105,41 @@ typedef void (* FSleep) (unsigned sleepMs); // Files typedef AsyncFile (* FAsyncFileOpen) ( - const wchar fullPath[], + const wchar_t fullPath[], FAsyncNotifyFileProc notifyProc, EFileError * error, unsigned desiredAccess, unsigned openMode, unsigned shareModeFlags, void * userState, - qword * fileSize, - qword * fileLastWriteTime + uint64_t * fileSize, + uint64_t * fileLastWriteTime ); typedef void (* FAsyncFileClose) ( AsyncFile file, - qword truncateSize + uint64_t truncateSize ); typedef void (* FAsyncFileSetLastWriteTime) ( AsyncFile file, - qword lastWriteTime + uint64_t lastWriteTime ); -typedef qword (* FAsyncFileGetLastWriteTime) ( - const wchar fileName[] +typedef uint64_t (* FAsyncFileGetLastWriteTime) ( + const wchar_t fileName[] ); typedef AsyncId (* FAsyncFileFlushBuffers) ( AsyncFile file, - qword truncateSize, + uint64_t truncateSize, bool notify, void * param ); typedef AsyncId (* FAsyncFileRead) ( AsyncFile file, - qword offset, + uint64_t offset, void * buffer, unsigned bytes, unsigned flags, @@ -148,7 +148,7 @@ typedef AsyncId (* FAsyncFileRead) ( typedef AsyncId (* FAsyncFileWrite) ( AsyncFile file, - qword offset, + uint64_t offset, const void * buffer, unsigned bytes, unsigned flags, @@ -163,7 +163,7 @@ typedef AsyncId (* FAsyncFileCreateSequence) ( typedef bool (* FAsyncFileSeek) ( AsyncFile file, - qword distance, + uint64_t distance, EFileSeekFrom from ); diff --git a/Sources/Plasma/NucleusLib/pnAsyncCoreExe/pnAceCore.cpp b/Sources/Plasma/NucleusLib/pnAsyncCoreExe/pnAceCore.cpp index 33fc5adb..04ac913c 100644 --- a/Sources/Plasma/NucleusLib/pnAsyncCoreExe/pnAceCore.cpp +++ b/Sources/Plasma/NucleusLib/pnAsyncCoreExe/pnAceCore.cpp @@ -94,7 +94,7 @@ static void IAsyncInitUseW9x () { #ifdef HS_BUILD_FOR_WIN32 W9xGetApi(&g_api); #else - ErrorFatal("W9x I/O Not supported on this platform"); + ErrorAssert("W9x I/O Not supported on this platform"); #endif } @@ -103,7 +103,7 @@ static void IAsyncInitUseNt () { #ifdef HS_BUILD_FOR_WIN32 NtGetApi(&g_api); #else - ErrorFatal("Nt I/O Not supported on this platform"); + ErrorAssert("Nt I/O Not supported on this platform"); #endif } @@ -113,7 +113,7 @@ static void IAsyncInitUseUnix () { #error Unix I/O not implemented yet UxGetApi(&g_api); #else - ErrorFatal(__LINE__, __FILE__, "Unix I/O Not supported on this platform"); + ErrorAssert(__LINE__, __FILE__, "Unix I/O Not supported on this platform"); #endif } @@ -130,7 +130,7 @@ static void IAsyncInitForClient () { #elif HS_BUILD_FOR_UNIX IAsyncInitUseUnix(); #else - ErrorFatal("AsyncCore: No default implementation for this platform"); + ErrorAssert("AsyncCore: No default implementation for this platform"); #endif } @@ -141,7 +141,7 @@ static void IAsyncInitForServer () { #elif HS_BUILD_FOR_UNIX IAsyncInitUseUnix(); #else - ErrorFatal("AsyncCore: No default implementation for this platform"); + ErrorAssert("AsyncCore: No default implementation for this platform"); #endif } @@ -185,9 +185,9 @@ void AsyncCoreInitialize () { // Initialize WinSock WSADATA wsaData; if (WSAStartup(0x101, &wsaData)) - ErrorFatal(__LINE__, __FILE__, "WSA startup failed"); + ErrorAssert(__LINE__, __FILE__, "WSA startup failed"); if (wsaData.wVersion != 0x101) - ErrorFatal(__LINE__, __FILE__, "WSA version failed"); + ErrorAssert(__LINE__, __FILE__, "WSA version failed"); #endif #ifdef CLIENT @@ -212,7 +212,7 @@ void AsyncCoreDestroy (unsigned waitMs) { TimerDestroy(waitMs); ThreadDestroy(waitMs); - ZERO(g_api); + memset(&g_api, 0, sizeof(g_api)); } //============================================================================ diff --git a/Sources/Plasma/NucleusLib/pnAsyncCoreExe/pnAceIo.cpp b/Sources/Plasma/NucleusLib/pnAsyncCoreExe/pnAceIo.cpp index 3b390fde..cf4d78c2 100644 --- a/Sources/Plasma/NucleusLib/pnAsyncCoreExe/pnAceIo.cpp +++ b/Sources/Plasma/NucleusLib/pnAsyncCoreExe/pnAceIo.cpp @@ -58,10 +58,10 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // socket notification procedures // connection data format: -// byte connType; -// dword buildId; [optional] -// dword branchId; [optional] -// dword buildType; [optional] +// uint8_t connType; +// uint32_t buildId; [optional] +// uint32_t branchId; [optional] +// uint32_t buildType; [optional] // Uuid productId; [optional] const unsigned kConnHashFlagsIgnore = 0x01; const unsigned kConnHashFlagsExactMatch = 0x02; @@ -160,7 +160,7 @@ bool ISocketConnHash::operator== (const ISocketConnHash & rhs) const { //=========================================================================== static unsigned GetConnHash ( ISocketConnHash * hash, - const byte buffer[], + const uint8_t buffer[], unsigned bytes ) { if (!bytes) @@ -174,7 +174,7 @@ static unsigned GetConnHash ( hash->productId = 0; hash->flags = 0; - // one byte consumed + // one uint8_t consumed return 1; } else { @@ -238,9 +238,9 @@ EFileError AsyncGetLastFileError () { } //============================================================================ -const wchar * FileErrorToString (EFileError error) { +const wchar_t * FileErrorToString (EFileError error) { - static wchar * s_fileErrorStrings[] = { + static wchar_t * s_fileErrorStrings[] = { L"FileSuccess", L"FileErrorInvalidParameter", L"FileErrorFileNotFound", @@ -255,15 +255,15 @@ const wchar * FileErrorToString (EFileError error) { //============================================================================ AsyncFile AsyncFileOpen ( - const wchar fullPath[], + const wchar_t fullPath[], FAsyncNotifyFileProc notifyProc, EFileError * error, unsigned desiredAccess, unsigned openMode, unsigned shareModeFlags, void * userState, - qword * fileSize, - qword * fileLastWriteTime + uint64_t * fileSize, + uint64_t * fileLastWriteTime ) { ASSERT(g_api.fileOpen); return g_api.fileOpen( @@ -282,7 +282,7 @@ AsyncFile AsyncFileOpen ( //============================================================================ void AsyncFileClose ( AsyncFile file, - qword truncateSize + uint64_t truncateSize ) { ASSERT(g_api.fileClose); g_api.fileClose(file, truncateSize); @@ -291,15 +291,15 @@ void AsyncFileClose ( //============================================================================ void AsyncFileSetLastWriteTime ( AsyncFile file, - qword lastWriteTime + uint64_t lastWriteTime ) { ASSERT(g_api.fileSetLastWriteTime); g_api.fileSetLastWriteTime(file, lastWriteTime); } //============================================================================ -qword AsyncFileGetLastWriteTime ( - const wchar fileName[] +uint64_t AsyncFileGetLastWriteTime ( + const wchar_t fileName[] ) { ASSERT(g_api.fileGetLastWriteTime); return g_api.fileGetLastWriteTime(fileName); @@ -308,7 +308,7 @@ qword AsyncFileGetLastWriteTime ( //============================================================================ AsyncId AsyncFileFlushBuffers ( AsyncFile file, - qword truncateSize, + uint64_t truncateSize, bool notify, void * param ) { @@ -319,7 +319,7 @@ AsyncId AsyncFileFlushBuffers ( //============================================================================ AsyncId AsyncFileRead ( AsyncFile file, - qword offset, + uint64_t offset, void * buffer, unsigned bytes, unsigned flags, @@ -339,7 +339,7 @@ AsyncId AsyncFileRead ( //============================================================================ AsyncId AsyncFileWrite ( AsyncFile file, - qword offset, + uint64_t offset, const void * buffer, unsigned bytes, unsigned flags, @@ -369,7 +369,7 @@ AsyncId AsyncFileCreateSequence ( //============================================================================ bool AsyncFileSeek ( AsyncFile file, - qword distance, + uint64_t distance, EFileSeekFrom seekFrom ) { ASSERT(g_api.fileSeek); @@ -493,7 +493,7 @@ void AsyncSocketEnableNagling ( //=========================================================================== void AsyncSocketRegisterNotifyProc ( - byte connType, + uint8_t connType, FAsyncNotifySocketProc notifyProc, unsigned buildId, unsigned buildType, @@ -504,7 +504,7 @@ void AsyncSocketRegisterNotifyProc ( ASSERT(notifyProc); // Perform memory allocation outside lock - ISocketConnType * ct = NEW(ISocketConnType); + ISocketConnType * ct = new ISocketConnType; ct->notifyProc = notifyProc; ct->connType = connType; ct->buildId = buildId; @@ -522,7 +522,7 @@ void AsyncSocketRegisterNotifyProc ( //=========================================================================== void AsyncSocketUnregisterNotifyProc ( - byte connType, + uint8_t connType, FAsyncNotifySocketProc notifyProc, unsigned buildId, unsigned buildType, @@ -553,12 +553,12 @@ void AsyncSocketUnregisterNotifyProc ( s_notifyProcLock.LeaveWrite(); // perform memory deallocation outside the lock - DEL(scan); + delete scan; } //=========================================================================== FAsyncNotifySocketProc AsyncSocketFindNotifyProc ( - const byte buffer[], + const uint8_t buffer[], unsigned bytes, unsigned * bytesProcessed, unsigned * connType, diff --git a/Sources/Plasma/NucleusLib/pnAsyncCoreExe/pnAceLog.cpp b/Sources/Plasma/NucleusLib/pnAsyncCoreExe/pnAceLog.cpp index 7f517692..dfb4584d 100644 --- a/Sources/Plasma/NucleusLib/pnAsyncCoreExe/pnAceLog.cpp +++ b/Sources/Plasma/NucleusLib/pnAsyncCoreExe/pnAceLog.cpp @@ -76,11 +76,11 @@ enum ELogType { }; static bool s_breakOnErrors; -static wchar s_directory[MAX_PATH]; +static wchar_t s_directory[MAX_PATH]; static CCritSect s_logCrit[kNumLogTypes]; static char * s_logBuf[kNumLogTypes]; static unsigned s_logPos[kNumLogTypes]; -static qword s_logWritePos[kNumLogTypes]; +static uint64_t s_logWritePos[kNumLogTypes]; static TimeDesc s_logTime[kNumLogTypes]; static unsigned s_logWriteMs[kNumLogTypes]; static AsyncFile s_logFile[kNumLogTypes]; @@ -98,7 +98,7 @@ static unsigned s_logSize[kNumLogTypes] = { #endif }; -static const wchar * s_logNameFmt[kNumLogTypes] = { +static const wchar_t * s_logNameFmt[kNumLogTypes] = { #ifdef SERVER L"Dbg%02u%02u%02u.log", L"Inf%02u%02u%02u.log", @@ -145,7 +145,7 @@ static void LogFileNotifyProc ( ) { switch (code) { case kNotifyFileWrite: - FREE(notify->param); + free(notify->param); AtomicAdd(&s_opsPending, -1); break; @@ -161,7 +161,7 @@ static void LogFileNotifyProc ( //============================================================================ static void AllocLogBuffer_CS (unsigned index) { ASSERT(!s_logBuf[index]); - s_logBuf[index] = (char *)ALLOC(s_logSize[index]); + s_logBuf[index] = (char *)malloc(s_logSize[index]); s_logPos[index] = 0; if (!s_logBuf[index]) @@ -171,7 +171,7 @@ static void AllocLogBuffer_CS (unsigned index) { //============================================================================ static void FreeLogBuffer_CS (unsigned index) { if (s_logBuf[index]) { - FREE(s_logBuf[index]); + free(s_logBuf[index]); s_logBuf[index] = nil; } } @@ -180,7 +180,7 @@ static void FreeLogBuffer_CS (unsigned index) { static void GetLogFilename ( unsigned index, TimeDesc timeDesc, - wchar * filename, + wchar_t * filename, unsigned chars ) { StrPrintf( @@ -203,7 +203,7 @@ static bool OpenLogFile_CS (unsigned index) { return true; // Build filename - wchar filename[MAX_PATH]; + wchar_t filename[MAX_PATH]; GetLogFilename( index, s_logTime[index], @@ -212,7 +212,7 @@ static bool OpenLogFile_CS (unsigned index) { ); // Open file - qword fileTime; + uint64_t fileTime; EFileError fileError; bool fileExist = PathDoesFileExist(filename); s_logFile[index] = AsyncFileOpen( @@ -236,7 +236,7 @@ static bool OpenLogFile_CS (unsigned index) { // Seek to end of file AsyncFileSeek(s_logFile[index], s_logWritePos[index], kFileSeekFromBegin); - // If this is a new file, write Byte Order Mark + // If this is a new file, write uint8_t Order Mark if (!fileExist) { static const char s_bom[] = "\xEF\xBB\xBF"; AsyncFileWrite( @@ -279,7 +279,7 @@ static void WriteLogFile_CS (unsigned index, bool close) { s_logBuf[index] ); if (flags == kAsyncFileRwSync) - DEL(s_logBuf[index]); + delete s_logBuf[index]; else AtomicAdd(&s_opsPending, 1); s_logWritePos[index] += s_logPos[index]; @@ -338,7 +338,7 @@ static unsigned FlushLogsTimerCallback (void *) { //============================================================================ void AsyncLogInitialize ( - const wchar logDirName[], + const wchar_t logDirName[], bool breakOnErrors ) { s_running = true; @@ -411,9 +411,9 @@ void LogBreakOnErrors (bool breakOnErrors) { //============================================================================ void AsyncLogWriteMsg ( - const wchar facility[], + const wchar_t facility[], ELogSeverity severity, - const wchar msg[] + const wchar_t msg[] ) { if (!s_running) return; @@ -453,7 +453,7 @@ void AsyncLogWriteMsg ( AllocLogBuffer_CS(index); // Add new data to the log buffer - MemCopy(s_logBuf[index] + s_logPos[index], buffer, chars); + memcpy(s_logBuf[index] + s_logPos[index], buffer, chars); s_logPos[index] += chars; // Write, flush and close file immediately if this is a fatal error @@ -472,7 +472,7 @@ void AsyncLogWriteMsg ( } //============================================================================ -void AsyncLogGetDirectory (wchar * dest, unsigned destChars) { +void AsyncLogGetDirectory (wchar_t * dest, unsigned destChars) { ASSERT(dest); StrCopy(dest, s_directory, destChars); } diff --git a/Sources/Plasma/NucleusLib/pnAsyncCoreExe/pnAceThread.cpp b/Sources/Plasma/NucleusLib/pnAsyncCoreExe/pnAceThread.cpp index 2002d03c..f32ff6ed 100644 --- a/Sources/Plasma/NucleusLib/pnAsyncCoreExe/pnAceThread.cpp +++ b/Sources/Plasma/NucleusLib/pnAsyncCoreExe/pnAceThread.cpp @@ -75,7 +75,7 @@ static unsigned CALLBACK CreateThreadProc (LPVOID param) { unsigned result = thread->proc(thread); // Cleanup thread - DEL(thread); + delete thread; PerfSubCounter(kAsyncPerfThreadsCurr, 1); return result; @@ -107,9 +107,9 @@ void ThreadDestroy (unsigned exitThreadWaitMs) { void * AsyncThreadCreate ( FAsyncThreadProc threadProc, void * argument, - const wchar name[] + const wchar_t name[] ) { - AsyncThread * thread = NEW(AsyncThread); + AsyncThread * thread = new AsyncThread; thread->proc = threadProc; thread->handle = nil; thread->argument = argument; @@ -128,7 +128,7 @@ void * AsyncThreadCreate ( ); if (!handle) { LogMsg(kLogFatal, "%s (%u)", __FILE__, GetLastError()); - ErrorFatal(__LINE__, __FILE__, "_beginthreadex failed"); + ErrorAssert(__LINE__, __FILE__, "_beginthreadex failed"); } thread->handle = handle; diff --git a/Sources/Plasma/NucleusLib/pnAsyncCoreExe/pnAceTimer.cpp b/Sources/Plasma/NucleusLib/pnAsyncCoreExe/pnAceTimer.cpp index f6d3aa1e..c3a168a4 100644 --- a/Sources/Plasma/NucleusLib/pnAsyncCoreExe/pnAceTimer.cpp +++ b/Sources/Plasma/NucleusLib/pnAsyncCoreExe/pnAceTimer.cpp @@ -133,7 +133,7 @@ static inline unsigned RunTimers () { while (AsyncTimer * t = s_timerDelete.Head()) { if (t->destroyProc) CallTimerProc(t, t->destroyProc); - DEL(t); + delete t; } // Get first timer to run @@ -187,7 +187,7 @@ static inline void InitializeTimer () { (LPCTSTR) nil ); if (!s_timerEvent) - ErrorFatal(__LINE__, __FILE__, "CreateEvent %u", GetLastError()); + ErrorAssert(__LINE__, __FILE__, "CreateEvent %u", GetLastError()); s_timerThread = (HANDLE) AsyncThreadCreate( TimerThreadProc, @@ -225,12 +225,12 @@ void TimerDestroy (unsigned exitThreadWaitMs) { while (AsyncTimer * t = s_timerDelete.Head()) { if (t->destroyProc) CallTimerProc(t, t->destroyProc); - DEL(t); + delete t; } s_timerCrit.Leave(); if (AsyncTimer * timer = s_timerProcs.Root()) - ErrorFatal(__LINE__, __FILE__, "TimerProc not destroyed: %p", timer->timerProc); + ErrorAssert(__LINE__, __FILE__, "TimerProc not destroyed: %p", timer->timerProc); } @@ -253,7 +253,7 @@ void AsyncTimerCreate ( ASSERT(timerProc); // Allocate timer outside critical section - AsyncTimer * t = NEW(AsyncTimer); + AsyncTimer * t = new AsyncTimer; t->timerProc = timerProc; t->destroyProc = nil; t->param = param; diff --git a/Sources/Plasma/NucleusLib/pnCrash/pnCrash.h b/Sources/Plasma/NucleusLib/pnCrash/pnCrash.h index 146f6a21..36e2ae81 100644 --- a/Sources/Plasma/NucleusLib/pnCrash/pnCrash.h +++ b/Sources/Plasma/NucleusLib/pnCrash/pnCrash.h @@ -67,11 +67,11 @@ void CrashSetEmailParameters ( ); void * CrashAddModule ( - unsigned_ptr address, + uintptr_t address, unsigned buildId, unsigned branchId, - const wchar name[], - const wchar buildString[] + const wchar_t name[], + const wchar_t buildString[] ); void CrashRemoveModule ( @@ -86,7 +86,7 @@ void CrashRemoveModule ( ***/ #ifdef SERVER -void * CrashAddDeadlockCheck (void * thread, const wchar debugstr[] ); +void * CrashAddDeadlockCheck (void * thread, const wchar_t debugstr[] ); void CrashRemoveDeadlockCheck (void * check); void CrashSetDeadlockCheckTimes (unsigned emailSec, unsigned terminateSec); // returns previous setting diff --git a/Sources/Plasma/NucleusLib/pnCrashExe/Win32/pnCreError.cpp b/Sources/Plasma/NucleusLib/pnCrashExe/Win32/pnCreError.cpp index 2d912ec8..5a1ecb25 100644 --- a/Sources/Plasma/NucleusLib/pnCrashExe/Win32/pnCreError.cpp +++ b/Sources/Plasma/NucleusLib/pnCrashExe/Win32/pnCreError.cpp @@ -59,13 +59,13 @@ namespace Crash { struct Module { LINK(Module) link; - unsigned_ptr address; + uintptr_t address; unsigned buildId; unsigned branchId; - wchar * name; - wchar * buildString; + wchar_t * name; + wchar_t * buildString; - ~Module () { FREE(name); FREE(buildString); } + ~Module () { free(name); free(buildString); } }; struct EmailParams : AtomicRef { @@ -77,18 +77,18 @@ struct EmailParams : AtomicRef { char * replyTo; ~EmailParams () { - FREE(smtp); - FREE(sender); - FREE(recipients); - FREE(username); - FREE(password); - FREE(replyTo); + free(smtp); + free(sender); + free(recipients); + free(username); + free(password); + free(replyTo); } }; struct ErrLog { unsigned pos; - wchar name[MAX_PATH]; + wchar_t name[MAX_PATH]; char buffer[512*1024]; char terminator; }; @@ -100,7 +100,7 @@ struct DeadlockCheck { unsigned deadlockTerminateMs; bool deadlocked; bool emailSent; - wchar debugStr[256]; + wchar_t debugStr[256]; }; @@ -334,7 +334,7 @@ static ErrLog * CreateErrLog () { log->terminator = 0; // Initialize log filename - wchar srcName[MAX_PATH]; + wchar_t srcName[MAX_PATH]; SYSTEMTIME currTime; GetLocalTime(&currTime); StrPrintf( @@ -442,7 +442,7 @@ static void LogThread ( ErrLog * const log, const CImageHelp & ih, HANDLE hThread, - const wchar name[], + const wchar_t name[], const CONTEXT & ctx ) { char threadName[256]; @@ -478,10 +478,10 @@ static void LogCrashInfo ( { LogSectionHeader(log, "Program"); - wchar productIdStr[64]; + wchar_t productIdStr[64]; GuidToString(ProductId(), productIdStr, arrsize(productIdStr)); - wchar productBuildTag[128]; + wchar_t productBuildTag[128]; ProductString(productBuildTag, arrsize(productBuildTag)); SYSTEMTIME currtime; @@ -538,7 +538,7 @@ static void LogCrashInfo ( if (WSAStartup(0x101, &wsaData) || (wsaData.wVersion != 0x101)) break; - wchar ipAddress[256]; + wchar_t ipAddress[256]; NetAddressNode addrNodes[16]; unsigned addrCount = NetAddressGetLocal(16, addrNodes); LogPrintf(log, "IpAddrs : "); @@ -871,7 +871,7 @@ static void pnCrashExeShutdown () { AUTO_INIT_FUNC(pnCrashExe) { // The critical section has to be initialized // before program startup and never freed - static byte rawMemory[sizeof CCritSect]; + static uint8_t rawMemory[sizeof CCritSect]; s_critsect = new(rawMemory) CCritSect; s_running = true; @@ -938,11 +938,11 @@ void CrashSetEmailParameters ( //============================================================================ void * CrashAddModule ( - unsigned_ptr address, + uintptr_t address, unsigned buildId, unsigned branchId, - const wchar name[], - const wchar buildString[] + const wchar_t name[], + const wchar_t buildString[] ) { ASSERT(name); Module * module = NEWZERO(Module); @@ -975,7 +975,7 @@ void CrashRemoveModule ( Module * module = (Module *) param; SAFE_CRITSECT_ENTER(); { - DEL(module); + delete module; } SAFE_CRITSECT_LEAVE(); } @@ -991,7 +991,7 @@ void CrashRemoveModule ( #ifdef SERVER void * CrashAddDeadlockCheck ( void * thread, - const wchar debugStr[] + const wchar_t debugStr[] ) { s_spareCrit.Enter(); DeadlockCheck * check = (DeadlockCheck *)s_deadlockSpares.Alloc(); diff --git a/Sources/Plasma/NucleusLib/pnCrashExe/Win32/pnCreMail.cpp b/Sources/Plasma/NucleusLib/pnCrashExe/Win32/pnCreMail.cpp index fe62c840..4061d16a 100644 --- a/Sources/Plasma/NucleusLib/pnCrashExe/Win32/pnCreMail.cpp +++ b/Sources/Plasma/NucleusLib/pnCrashExe/Win32/pnCreMail.cpp @@ -166,7 +166,7 @@ void CrashSendEmail ( // create process STARTUPINFO si; - ZERO(si); + memset(&si, 0, sizeof(si)); si.cb = sizeof(si); si.dwFlags = STARTF_USESHOWWINDOW | STARTF_USESTDHANDLES; si.wShowWindow = SW_HIDE; diff --git a/Sources/Plasma/NucleusLib/pnCrashExe/Win32/pnCreTools.cpp b/Sources/Plasma/NucleusLib/pnCrashExe/Win32/pnCreTools.cpp index e1f2b7b8..6179e26b 100644 --- a/Sources/Plasma/NucleusLib/pnCrashExe/Win32/pnCreTools.cpp +++ b/Sources/Plasma/NucleusLib/pnCrashExe/Win32/pnCreTools.cpp @@ -66,7 +66,7 @@ static BOOL MYIMAGEAPI iSymGetModuleInfo ( DWORD, IMAGEHLP_MODULE * ModuleInfo ) { - ZEROPTR(ModuleInfo); + memset(ModuleInfo, 0, sizeof(*ModuleInfo)); return false; } @@ -109,7 +109,7 @@ static BOOL MYIMAGEAPI iSymGetSymFromAddr ( PIMAGEHLP_SYMBOL Symbol ) { *Displacement = 0; - ZEROPTR(Symbol); + memset(Symbol, 0, sizeof(*Symbol)); return false; } diff --git a/Sources/Plasma/NucleusLib/pnCsrCli/pnCsrCli.cpp b/Sources/Plasma/NucleusLib/pnCsrCli/pnCsrCli.cpp index 04506fbb..de85ebf0 100644 --- a/Sources/Plasma/NucleusLib/pnCsrCli/pnCsrCli.cpp +++ b/Sources/Plasma/NucleusLib/pnCsrCli/pnCsrCli.cpp @@ -198,7 +198,7 @@ void CsrCliShutdown () { //============================================================================ void CsrCliStartConnecting ( - const wchar addr[], + const wchar_t addr[], FCsrCliOnConnect onConnect ) { ASSERT(s_running); diff --git a/Sources/Plasma/NucleusLib/pnCsrCli/pnCsrCli.h b/Sources/Plasma/NucleusLib/pnCsrCli/pnCsrCli.h index 04109115..2a123f07 100644 --- a/Sources/Plasma/NucleusLib/pnCsrCli/pnCsrCli.h +++ b/Sources/Plasma/NucleusLib/pnCsrCli/pnCsrCli.h @@ -68,7 +68,7 @@ void CsrCliShutdown (); typedef void (*FCsrCliOnConnect) (ENetError result); void CsrCliStartConnecting ( - const wchar addr[], + const wchar_t addr[], FCsrCliOnConnect onConnect ); void CsrCliDisconnect (); diff --git a/Sources/Plasma/NucleusLib/pnDispatch/plDispatch.cpp b/Sources/Plasma/NucleusLib/pnDispatch/plDispatch.cpp index d064d850..4b3a2b3d 100644 --- a/Sources/Plasma/NucleusLib/pnDispatch/plDispatch.cpp +++ b/Sources/Plasma/NucleusLib/pnDispatch/plDispatch.cpp @@ -40,7 +40,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "hsResMgr.h" #include "plDispatch.h" #define PLMESSAGE_PRIVATE @@ -81,10 +81,10 @@ public: fReceivers.Append(rcv); return *this; } const plKey& GetReceiver(int i) const { return fReceivers[i]; } - UInt32 GetNumReceivers() const { return fReceivers.GetCount(); } + uint32_t GetNumReceivers() const { return fReceivers.GetCount(); } }; -Int32 plDispatch::fNumBufferReq = 0; +int32_t plDispatch::fNumBufferReq = 0; hsBool plDispatch::fMsgActive = false; plMsgWrap* plDispatch::fMsgCurrent = nil; plMsgWrap* plDispatch::fMsgHead = nil; @@ -168,7 +168,7 @@ plMsgWrap* plDispatch::IDequeue(plMsgWrap** head, plMsgWrap** tail) hsBool plDispatch::ISortToDeferred(plMessage* msg) { - plMsgWrap* msgWrap = TRACKED_NEW plMsgWrap(msg); + plMsgWrap* msgWrap = new plMsgWrap(msg); if( !fFutureMsgQueue ) { if( IGetOwner() ) @@ -213,7 +213,7 @@ void plDispatch::ICheckDeferred(double secs) plgDispatch::Dispatch()->UnRegisterForExactType(plTimeMsg::Index(), IGetOwnerKey()); } -hsBool plDispatch::IListeningForExactType(UInt16 hClass) +hsBool plDispatch::IListeningForExactType(uint16_t hClass) { if( (hClass == plTimeMsg::Index()) && fFutureMsgQueue ) return true; @@ -305,7 +305,7 @@ void plDispatch::IMsgDispatch() } #endif // HS_DEBUGGING - static UInt64 startTicks = 0; + static uint64_t startTicks = 0; if (plDispatchLogBase::IsLogging()) startTicks = hsTimer::GetFullTickCount(); @@ -338,12 +338,12 @@ void plDispatch::IMsgDispatch() } #ifndef PLASMA_EXTERNAL_RELEASE - UInt32 rcvTicks = hsTimer::GetPrecTickCount(); + uint32_t rcvTicks = hsTimer::GetPrecTickCount(); // Object could be deleted by this message, so we need to log this stuff now plString keyname = _TEMP_CONVERT_FROM_LITERAL("(unknown)"); const char* className = "(unknown)"; - UInt32 clonePlayerID = 0; + uint32_t clonePlayerID = 0; if (plDispatchLogBase::IsLoggingLong()) { hsKeyedObject* ko = hsKeyedObject::ConvertNoRef(rcv); @@ -463,7 +463,7 @@ hsBool plDispatch::MsgSend(plMessage* msg, hsBool async) else if((timeMsg = plTimeMsg::ConvertNoRef(msg))) ICheckDeferred(timeMsg->DSeconds()); - plMsgWrap* msgWrap = TRACKED_NEW plMsgWrap(msg); + plMsgWrap* msgWrap = new plMsgWrap(msg); hsRefCnt_SafeUnRef(msg); // broadcast @@ -537,7 +537,7 @@ void plDispatch::MsgQueueProcess() } } -void plDispatch::RegisterForType(UInt16 hClass, const plKey& receiver) +void plDispatch::RegisterForType(uint16_t hClass, const plKey& receiver) { int i; for( i = 0; i < plFactory::GetNumClasses(); i++ ) @@ -547,14 +547,14 @@ void plDispatch::RegisterForType(UInt16 hClass, const plKey& receiver) } } -void plDispatch::RegisterForExactType(UInt16 hClass, const plKey& receiver) +void plDispatch::RegisterForExactType(uint16_t hClass, const plKey& receiver) { int idx = hClass; fRegisteredExactTypes.ExpandAndZero(idx+1); plTypeFilter* filt = fRegisteredExactTypes[idx]; if( !filt ) { - filt = TRACKED_NEW plTypeFilter; + filt = new plTypeFilter; fRegisteredExactTypes[idx] = filt; filt->fHClass = hClass; } @@ -563,7 +563,7 @@ void plDispatch::RegisterForExactType(UInt16 hClass, const plKey& receiver) filt->fReceivers.Append(receiver); } -void plDispatch::UnRegisterForType(UInt16 hClass, const plKey& receiver) +void plDispatch::UnRegisterForType(uint16_t hClass, const plKey& receiver) { int i; for( i = 0; i < fRegisteredExactTypes.GetCount(); i++ ) @@ -632,7 +632,7 @@ void plDispatch::UnRegisterAll(const plKey& receiver) } } -void plDispatch::UnRegisterForExactType(UInt16 hClass, const plKey& receiver) +void plDispatch::UnRegisterForExactType(uint16_t hClass, const plKey& receiver) { int idx = hClass; if( idx >= fRegisteredExactTypes.GetCount() ) diff --git a/Sources/Plasma/NucleusLib/pnDispatch/plDispatch.h b/Sources/Plasma/NucleusLib/pnDispatch/plDispatch.h index ac55e69e..01a9d28a 100644 --- a/Sources/Plasma/NucleusLib/pnDispatch/plDispatch.h +++ b/Sources/Plasma/NucleusLib/pnDispatch/plDispatch.h @@ -59,7 +59,7 @@ class plTypeFilter public: plTypeFilter() : fHClass(0) {} - UInt16 fHClass; + uint16_t fHClass; hsTArray fReceivers; }; @@ -74,7 +74,7 @@ protected: hsKeyedObject* fOwner; plMsgWrap* fFutureMsgQueue; - static Int32 fNumBufferReq; + static int32_t fNumBufferReq; static plMsgWrap* fMsgCurrent; static hsMutex fMsgCurrentMutex; // mutex for above static hsMutex fMsgDispatchLock; // mutex for IMsgDispatch @@ -91,7 +91,7 @@ protected: hsKeyedObject* IGetOwner() { return fOwner; } plKey IGetOwnerKey() { return IGetOwner() ? IGetOwner()->GetKey() : nil; } - int IFindType(UInt16 hClass); + int IFindType(uint16_t hClass); int IFindSender(const plKey& sender); hsBool IUnRegisterForExactType(int idx, const plKey& receiver); @@ -105,7 +105,7 @@ protected: hsBool ISortToDeferred(plMessage* msg); void ICheckDeferred(double stamp); - hsBool IListeningForExactType(UInt16 hClass); + hsBool IListeningForExactType(uint16_t hClass); void ITrashUndelivered(); // Just pitches them, doesn't try to deliver. @@ -116,11 +116,11 @@ public: CLASSNAME_REGISTER( plDispatch ); GETINTERFACE_ANY( plDispatch, plCreatable ); - virtual void RegisterForType(UInt16 hClass, const plKey& receiver); - virtual void RegisterForExactType(UInt16 hClass, const plKey& receiver); + virtual void RegisterForType(uint16_t hClass, const plKey& receiver); + virtual void RegisterForExactType(uint16_t hClass, const plKey& receiver); - virtual void UnRegisterForType(UInt16 hClass, const plKey& receiver); - virtual void UnRegisterForExactType(UInt16 hClass, const plKey& receiver); + virtual void UnRegisterForType(uint16_t hClass, const plKey& receiver); + virtual void UnRegisterForExactType(uint16_t hClass, const plKey& receiver); virtual void UnRegisterAll(const plKey& receiver); @@ -138,11 +138,11 @@ class plNullDispatch : public plDispatch { public: - virtual void RegisterForExactType(UInt16 hClass, const plKey& receiver) {} - virtual void RegisterForType(UInt16 hClass, const plKey& receiver) {} + virtual void RegisterForExactType(uint16_t hClass, const plKey& receiver) {} + virtual void RegisterForType(uint16_t hClass, const plKey& receiver) {} - virtual void UnRegisterForExactType(UInt16 hClass, const plKey& receiver) {} - virtual void UnRegisterForType(UInt16 hClass, const plKey& receiver) {} + virtual void UnRegisterForExactType(uint16_t hClass, const plKey& receiver) {} + virtual void UnRegisterForType(uint16_t hClass, const plKey& receiver) {} virtual hsBool MsgSend(plMessage* msg) { return true; } diff --git a/Sources/Plasma/NucleusLib/pnDispatch/plDispatchLogBase.cpp b/Sources/Plasma/NucleusLib/pnDispatch/plDispatchLogBase.cpp index 300d7f8e..f7c79f54 100644 --- a/Sources/Plasma/NucleusLib/pnDispatch/plDispatchLogBase.cpp +++ b/Sources/Plasma/NucleusLib/pnDispatch/plDispatchLogBase.cpp @@ -42,4 +42,4 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "plDispatchLogBase.h" plDispatchLogBase* plDispatchLogBase::fInstance = nil; -UInt32 plDispatchLogBase::fFlags = 0; +uint32_t plDispatchLogBase::fFlags = 0; diff --git a/Sources/Plasma/NucleusLib/pnDispatch/plDispatchLogBase.h b/Sources/Plasma/NucleusLib/pnDispatch/plDispatchLogBase.h index 2013244c..90fd21a6 100644 --- a/Sources/Plasma/NucleusLib/pnDispatch/plDispatchLogBase.h +++ b/Sources/Plasma/NucleusLib/pnDispatch/plDispatchLogBase.h @@ -42,7 +42,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #ifndef plDispatchLogBase_inc #define plDispatchLogBase_inc -#include "hsTypes.h" +#include "HeadSpin.h" // // For debugging messaging code. @@ -60,7 +60,7 @@ public: }; protected: - static UInt32 fFlags; + static uint32_t fFlags; static plDispatchLogBase* fInstance; public: @@ -68,22 +68,22 @@ public: virtual ~plDispatchLogBase() {} - static void SetFlags(UInt32 f) { fFlags=f; } - static UInt32 GetFlags() { return fFlags; } + static void SetFlags(uint32_t f) { fFlags=f; } + static uint32_t GetFlags() { return fFlags; } static bool IsLogging() { return fInstance != nil; } static bool IsLoggingLong() { return (fFlags & kLogLongReceives) != 0; } - virtual void AddFilterType(UInt16 type)=0; - virtual void AddFilterExactType(UInt16 type)=0; + virtual void AddFilterType(uint16_t type)=0; + virtual void AddFilterExactType(uint16_t type)=0; - virtual void RemoveFilterType(UInt16 type)=0; - virtual void RemoveFilterExactType(UInt16 type)=0; + virtual void RemoveFilterType(uint16_t type)=0; + virtual void RemoveFilterExactType(uint16_t type)=0; virtual void LogStatusBarChange(const char* name, const char* action)=0; - virtual void LogLongReceive(const char* keyname, const char* className, UInt32 clonePlayerID, plMessage* msg, float ms)=0; + virtual void LogLongReceive(const char* keyname, const char* className, uint32_t clonePlayerID, plMessage* msg, float ms)=0; - virtual void DumpMsg(plMessage* msg, int numReceivers, int sendTime, Int32 indent)=0; + virtual void DumpMsg(plMessage* msg, int numReceivers, int sendTime, int32_t indent)=0; }; #endif // plDispatchLogBase_inc diff --git a/Sources/Plasma/NucleusLib/pnFactory/plCreatable.h b/Sources/Plasma/NucleusLib/pnFactory/plCreatable.h index bf0683dd..d81d8e49 100644 --- a/Sources/Plasma/NucleusLib/pnFactory/plCreatable.h +++ b/Sources/Plasma/NucleusLib/pnFactory/plCreatable.h @@ -55,10 +55,10 @@ class plCreatable : public hsRefCnt { public: virtual const char* ClassName() const = 0; - virtual plCreatable* GetInterface(UInt16 hClass) { return nil; } - virtual const plCreatable* GetConstInterface(UInt16 hClass) const { return nil; } - static hsBool HasBaseClass(UInt16 hBase) { return false; } - virtual UInt16 ClassIndex() const = 0; + virtual plCreatable* GetInterface(uint16_t hClass) { return nil; } + virtual const plCreatable* GetConstInterface(uint16_t hClass) const { return nil; } + static hsBool HasBaseClass(uint16_t hBase) { return false; } + virtual uint16_t ClassIndex() const = 0; virtual void Read(hsStream* s, hsResMgr* mgr) {} virtual void Write(hsStream* s, hsResMgr* mgr) {} @@ -86,8 +86,8 @@ public: // // CLASSNAME_REGISTER( plClassName ) - Sets up identification for this // class. The exposed methods are -// static UInt16 Index() - returns the index for that class. -// virtual UInt16 ClassIndex() - returns index for this object's class. +// static uint16_t Index() - returns the index for that class. +// virtual uint16_t ClassIndex() - returns index for this object's class. // static plClassName* Convert(plCreatable* c) - if c exposes an interface // as plClassName, return that, else nil. Incs the ref count of the object. // static plClassName* ConvertNoRef(plCreatable* c) - Same as Convert(), but @@ -102,7 +102,7 @@ public: // exactly of type plClassName // GETINTERFACE_NONE - Never provide an interface as plClassName. // Instead of using these macros, the class can provide a method -// virtual plCreatable* GetInterface(UInt16 hClass) which returns an object of +// virtual plCreatable* GetInterface(uint16_t hClass) which returns an object of // type matching class handle hClass. // Insert into public section of class definition (like right after CLASSNAME_REGISTER). // @@ -163,15 +163,15 @@ public: public: \ virtual const char* ClassName() const { return #plClassName; } \ private: \ - static UInt16 plClassName##ClassIndex; \ - static void SetClassIndex(UInt16 hClass) { \ + static uint16_t plClassName##ClassIndex; \ + static void SetClassIndex(uint16_t hClass) { \ plClassName##ClassIndex = hClass; \ } \ public: \ - virtual UInt16 ClassIndex() const { \ + virtual uint16_t ClassIndex() const { \ return plClassName::Index(); \ } \ - static UInt16 Index() { \ + static uint16_t Index() { \ return plClassName##ClassIndex; \ } \ static plClassName * Create() { \ @@ -194,25 +194,25 @@ public: \ hsRefCnt_SafeRef(retVal); \ return retVal; \ } \ - static hsBool HasDerivedClass(UInt16 hDer) { \ + static hsBool HasDerivedClass(uint16_t hDer) { \ return plFactory::DerivesFrom(plClassName##ClassIndex, hDer); \ } \ friend class plClassName##__Creator; #define GETINTERFACE_ANY( plClassName, plBaseName ) \ -static hsBool HasBaseClass(UInt16 hBaseClass) { \ +static hsBool HasBaseClass(uint16_t hBaseClass) { \ if( hBaseClass == plClassName##ClassIndex ) \ return true; \ else \ return plBaseName::HasBaseClass(hBaseClass); \ } \ -virtual plCreatable* GetInterface(UInt16 hClass) { \ +virtual plCreatable* GetInterface(uint16_t hClass) { \ if( hClass == plClassName##ClassIndex ) \ return this; \ else \ return plBaseName::GetInterface(hClass); \ } \ -virtual const plCreatable* GetConstInterface(UInt16 hClass) const { \ +virtual const plCreatable* GetConstInterface(uint16_t hClass) const { \ if( hClass == plClassName##ClassIndex ) \ return this; \ else \ @@ -220,22 +220,22 @@ virtual const plCreatable* GetConstInterface(UInt16 hClass) const { \ } #define GETINTERFACE_EXACT( plClassName ) \ - static hsBool HasBaseClass(UInt16 hBaseClass) { \ + static hsBool HasBaseClass(uint16_t hBaseClass) { \ return hBaseClass == plClassName##ClassIndex; \ } \ -virtual plCreatable* GetInterface(UInt16 hClass) { \ +virtual plCreatable* GetInterface(uint16_t hClass) { \ return hClass == plClassName##ClassIndex ? this : nil; \ } \ -virtual const plCreatable* GetConstInterface(UInt16 hClass) const { \ +virtual const plCreatable* GetConstInterface(uint16_t hClass) const { \ return hClass == plClassName##ClassIndex ? this : nil; \ } #define GETINTERFACE_NONE( plClassName ) \ -static hsBool HasBaseClass(UInt16 hBaseClass) { return false; } \ -virtual plCreatable* GetInterface(UInt16 hClass) { \ +static hsBool HasBaseClass(uint16_t hBaseClass) { return false; } \ +virtual plCreatable* GetInterface(uint16_t hClass) { \ return nil; \ } \ -virtual const plCreatable* GetConstInterface(UInt16 hClass) const { \ +virtual const plCreatable* GetConstInterface(uint16_t hClass) const { \ return nil; \ } @@ -243,13 +243,13 @@ virtual const plCreatable* GetConstInterface(UInt16 hClass) const { \ // Macro for converting to base class OR a class member // #define GETINTERFACE_ANY_AUX( plClassName, plBaseName, plAuxClassName, plAuxClassMember ) \ -static hsBool HasBaseClass(UInt16 hBaseClass) { \ +static hsBool HasBaseClass(uint16_t hBaseClass) { \ if( hBaseClass == plClassName##ClassIndex ) \ return true; \ else \ return plBaseName::HasBaseClass(hBaseClass); \ } \ -virtual plCreatable* GetInterface(UInt16 hClass) { \ +virtual plCreatable* GetInterface(uint16_t hClass) { \ if( hClass == plClassName##ClassIndex ) \ return this; \ else \ @@ -258,7 +258,7 @@ virtual plCreatable* GetInterface(UInt16 hClass) { \ else \ return plBaseName::GetInterface(hClass); \ } \ -virtual const plCreatable* GetConstInterface(UInt16 hClass) const { \ +virtual const plCreatable* GetConstInterface(uint16_t hClass) const { \ if( hClass == plClassName##ClassIndex ) \ return this; \ else \ @@ -269,17 +269,17 @@ virtual const plCreatable* GetConstInterface(UInt16 hClass) const { \ } #define plBeginInterfaceMap( plClassName, plBaseName ) \ -static hsBool HasBaseClass(UInt16 hBaseClass) { \ +static hsBool HasBaseClass(uint16_t hBaseClass) { \ if( hBaseClass == plClassName##ClassIndex ) \ return true; \ else \ return plBaseName::HasBaseClass(hBaseClass); \ } \ -virtual plCreatable* GetInterface(UInt16 hClass) { \ +virtual plCreatable* GetInterface(uint16_t hClass) { \ /* NOTE: pulling const off the ptr should be ok, right? */ \ return const_cast( GetConstInterface( hClass ) ); \ } \ -virtual const plCreatable* GetConstInterface(UInt16 hClass) const { \ +virtual const plCreatable* GetConstInterface(uint16_t hClass) const { \ typedef plBaseName MyBaseClass; \ if( hClass == plClassName##ClassIndex ) \ return this diff --git a/Sources/Plasma/NucleusLib/pnFactory/plCreator.h b/Sources/Plasma/NucleusLib/pnFactory/plCreator.h index 1e25d462..7733bb86 100644 --- a/Sources/Plasma/NucleusLib/pnFactory/plCreator.h +++ b/Sources/Plasma/NucleusLib/pnFactory/plCreator.h @@ -59,9 +59,9 @@ public: virtual ~plCreator() { } virtual plCreatable* Create() const = 0; - virtual UInt16 ClassIndex() = 0; + virtual uint16_t ClassIndex() = 0; virtual const char* ClassName() const = 0; - virtual hsBool HasBaseClass(UInt16 hBase) = 0; + virtual hsBool HasBaseClass(uint16_t hBase) = 0; friend class plFactory; }; @@ -81,16 +81,16 @@ public: plFactory::UnRegister(CLASS_INDEX_SCOPED(plClassName), this); \ } \ \ - virtual hsBool HasBaseClass(UInt16 hBase) { return plClassName::HasBaseClass(hBase); } \ + virtual hsBool HasBaseClass(uint16_t hBase) { return plClassName::HasBaseClass(hBase); } \ \ - virtual UInt16 ClassIndex() { return CLASS_INDEX_SCOPED(plClassName); } \ + virtual uint16_t ClassIndex() { return CLASS_INDEX_SCOPED(plClassName); } \ virtual const char* ClassName() const { return #plClassName; } \ \ - virtual plCreatable* Create() const { return TRACKED_NEW plClassName; } \ + virtual plCreatable* Create() const { return new plClassName; } \ \ }; \ static plClassName##__Creator static##plClassName##__Creator; \ -UInt16 plClassName::plClassName##ClassIndex = 0; // +uint16_t plClassName::plClassName##ClassIndex = 0; // #define REGISTER_NONCREATABLE( plClassName ) \ \ @@ -107,16 +107,16 @@ public: plFactory::UnRegister(CLASS_INDEX_SCOPED(plClassName), this); \ } \ \ - virtual hsBool HasBaseClass(UInt16 hBase) { return plClassName::HasBaseClass(hBase); } \ + virtual hsBool HasBaseClass(uint16_t hBase) { return plClassName::HasBaseClass(hBase); } \ \ - virtual UInt16 ClassIndex() { return CLASS_INDEX_SCOPED(plClassName); } \ + virtual uint16_t ClassIndex() { return CLASS_INDEX_SCOPED(plClassName); } \ virtual const char* ClassName() const { return #plClassName; } \ \ virtual plCreatable* Create() const { return nil; } \ \ }; \ static plClassName##__Creator static##plClassName##__Creator; \ -UInt16 plClassName::plClassName##ClassIndex = 0; // +uint16_t plClassName::plClassName##ClassIndex = 0; // #define DECLARE_EXTERNAL_CREATABLE( plClassName ) \ \ @@ -140,16 +140,16 @@ public: plFactory::UnRegister(EXTERN_CLASS_INDEX_SCOPED(plClassName), this); \ } \ \ - virtual hsBool HasBaseClass(UInt16 hBase) { return plClassName::HasBaseClass(hBase); } \ + virtual hsBool HasBaseClass(uint16_t hBase) { return plClassName::HasBaseClass(hBase); } \ \ - virtual UInt16 ClassIndex() { return EXTERN_CLASS_INDEX_SCOPED(plClassName); } \ + virtual uint16_t ClassIndex() { return EXTERN_CLASS_INDEX_SCOPED(plClassName); } \ virtual const char* ClassName() const { return #plClassName; } \ \ - virtual plCreatable* Create() const { return TRACKED_NEW plClassName; } \ + virtual plCreatable* Create() const { return new plClassName; } \ \ }; \ static plClassName##__Creator static##plClassName##__Creator; \ -UInt16 plClassName::plClassName##ClassIndex = 0; // +uint16_t plClassName::plClassName##ClassIndex = 0; // #define REGISTER_EXTERNAL_CREATABLE(plClassName) \ static##plClassName##__Creator.Register(); // @@ -172,16 +172,16 @@ public: plFactory::UnRegister(EXTERN_CLASS_INDEX_SCOPED(plClassName), this); \ } \ \ - virtual hsBool HasBaseClass(UInt16 hBase) { return plClassName::HasBaseClass(hBase); } \ + virtual hsBool HasBaseClass(uint16_t hBase) { return plClassName::HasBaseClass(hBase); } \ \ - virtual UInt16 ClassIndex() { return EXTERN_CLASS_INDEX_SCOPED(plClassName); } \ + virtual uint16_t ClassIndex() { return EXTERN_CLASS_INDEX_SCOPED(plClassName); } \ virtual const char* ClassName() const { return #plClassName; } \ \ virtual plCreatable* Create() const { return nil; } \ \ }; \ static plClassName##__Creator static##plClassName##__Creator; \ -UInt16 plClassName::plClassName##ClassIndex = 0; // +uint16_t plClassName::plClassName##ClassIndex = 0; // #endif // plCreator_inc diff --git a/Sources/Plasma/NucleusLib/pnFactory/plFactory.cpp b/Sources/Plasma/NucleusLib/pnFactory/plFactory.cpp index 51df1e06..c9fab9f5 100644 --- a/Sources/Plasma/NucleusLib/pnFactory/plFactory.cpp +++ b/Sources/Plasma/NucleusLib/pnFactory/plFactory.cpp @@ -41,12 +41,12 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ #define PLFACTORY_PRIVATE -#include "hsTypes.h" +#include "HeadSpin.h" #include "plFactory.h" #include "hsStream.h" #include "plCreatable.h" #include "plCreator.h" -#include "hsUtils.h" + // For class names #include "plCreatableStrings.h" @@ -68,12 +68,12 @@ hsBool plFactory::ICreateTheFactory() if( theFactory ) return true; - theFactory = TRACKED_NEW plFactory; + theFactory = new plFactory; return theFactory != nil; } -UInt16 plFactory::IGetNumClasses() +uint16_t plFactory::IGetNumClasses() { return plCreatableIndex::plNumClassIndices; } @@ -97,7 +97,7 @@ void plFactory::IShutdown() theFactory = nil; } -UInt16 plFactory::IRegister(UInt16 hClass, plCreator* worker) +uint16_t plFactory::IRegister(uint16_t hClass, plCreator* worker) { delete fCreators[hClass]; fCreators[hClass] = worker; @@ -107,7 +107,7 @@ UInt16 plFactory::IRegister(UInt16 hClass, plCreator* worker) // // return true if creator exists // -bool plFactory::CanCreate(UInt16 hClass) +bool plFactory::CanCreate(uint16_t hClass) { if( hClass & 0x8000 ) // nil creatable return false; @@ -121,7 +121,7 @@ bool plFactory::CanCreate(UInt16 hClass) return ( theFactory->fCreators[ hClass ] != nil ); // check creator } -plCreatable* plFactory::ICreate(UInt16 hClass) +plCreatable* plFactory::ICreate(uint16_t hClass) { if (CanCreate(hClass)) { @@ -135,7 +135,7 @@ plCreatable* plFactory::ICreate(UInt16 hClass) return nil; } -void plFactory::UnRegister(UInt16 hClass, plCreator* worker) +void plFactory::UnRegister(uint16_t hClass, plCreator* worker) { if( theFactory ) { @@ -146,12 +146,12 @@ void plFactory::UnRegister(UInt16 hClass, plCreator* worker) } } -void plFactory::IUnRegister(UInt16 hClass) +void plFactory::IUnRegister(uint16_t hClass) { fCreators[hClass] = nil; } -UInt16 plFactory::Register(UInt16 hClass, plCreator* worker) +uint16_t plFactory::Register(uint16_t hClass, plCreator* worker) { if( !theFactory && !ICreateTheFactory() ) return nil; @@ -160,7 +160,7 @@ UInt16 plFactory::Register(UInt16 hClass, plCreator* worker) return theFactory->IRegister(hClass, worker); } -plCreatable* plFactory::Create(UInt16 hClass) +plCreatable* plFactory::Create(uint16_t hClass) { if( !theFactory && !ICreateTheFactory() ) return nil; @@ -170,7 +170,7 @@ plCreatable* plFactory::Create(UInt16 hClass) -UInt16 plFactory::GetNumClasses() +uint16_t plFactory::GetNumClasses() { if( !theFactory && !ICreateTheFactory() ) return 0; @@ -178,7 +178,7 @@ UInt16 plFactory::GetNumClasses() return theFactory->IGetNumClasses(); } -hsBool plFactory::IDerivesFrom(UInt16 hBase, UInt16 hDer) +hsBool plFactory::IDerivesFrom(uint16_t hBase, uint16_t hDer) { if( hDer >= fCreators.GetCount() ) return false; @@ -186,7 +186,7 @@ hsBool plFactory::IDerivesFrom(UInt16 hBase, UInt16 hDer) return fCreators[hDer] ? fCreators[hDer]->HasBaseClass(hBase) : false; } -hsBool plFactory::DerivesFrom(UInt16 hBase, UInt16 hDer) +hsBool plFactory::DerivesFrom(uint16_t hBase, uint16_t hDer) { if( !theFactory && !ICreateTheFactory() ) return 0; @@ -195,7 +195,7 @@ hsBool plFactory::DerivesFrom(UInt16 hBase, UInt16 hDer) } // slow lookup for things like console -UInt16 plFactory::FindClassIndex(const char* className) +uint16_t plFactory::FindClassIndex(const char* className) { int numClasses=GetNumClasses(); @@ -214,12 +214,12 @@ UInt16 plFactory::FindClassIndex(const char* className) } -hsBool plFactory::IIsValidClassIndex(UInt16 hClass) +hsBool plFactory::IIsValidClassIndex(uint16_t hClass) { return ( hClass < fCreators.GetCount() ); } -hsBool plFactory::IsValidClassIndex(UInt16 hClass) +hsBool plFactory::IsValidClassIndex(uint16_t hClass) { return theFactory->IIsValidClassIndex(hClass); } @@ -265,7 +265,7 @@ plFactory* plFactory::GetTheFactory() } // For my own nefarious purposes... hsStatusMessage plCreatableIndex -const char *plFactory::GetNameOfClass(UInt16 type) +const char *plFactory::GetNameOfClass(uint16_t type) { if( type < GetNumClasses() ) { @@ -311,7 +311,7 @@ const char *plFactory::GetNameOfClass(UInt16 type) ** */ -void plFactory::IValidate(UInt16 keyIndex) +void plFactory::IValidate(uint16_t keyIndex) { int FactoryIndex = GetNumClasses(); @@ -347,7 +347,7 @@ void plFactory::IValidate(UInt16 keyIndex) } -void plFactory::Validate(UInt16 keyIndex) +void plFactory::Validate(uint16_t keyIndex) { theFactory->IValidate(keyIndex); diff --git a/Sources/Plasma/NucleusLib/pnFactory/plFactory.h b/Sources/Plasma/NucleusLib/pnFactory/plFactory.h index 3bd71fc2..b55f26c1 100644 --- a/Sources/Plasma/NucleusLib/pnFactory/plFactory.h +++ b/Sources/Plasma/NucleusLib/pnFactory/plFactory.h @@ -47,7 +47,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "hsTemplates.h" #endif #include "hsRefCnt.h" -#include "hsTypes.h" +#include "HeadSpin.h" class plCreator; class plCreatable; @@ -61,13 +61,13 @@ private: hsTArray fCreators; void IForceShutdown(); - void IUnRegister(UInt16 hClass); - UInt16 IRegister(UInt16 hClass, plCreator* worker); + void IUnRegister(uint16_t hClass); + uint16_t IRegister(uint16_t hClass, plCreator* worker); hsBool IIsEmpty(); - UInt16 IGetNumClasses(); - plCreatable* ICreate(UInt16 hClass); - hsBool IDerivesFrom(UInt16 hBase, UInt16 hDer); - hsBool IIsValidClassIndex(UInt16 hClass); + uint16_t IGetNumClasses(); + plCreatable* ICreate(uint16_t hClass); + hsBool IDerivesFrom(uint16_t hBase, uint16_t hDer); + hsBool IIsValidClassIndex(uint16_t hClass); static hsBool ICreateTheFactory(); static void IShutdown(); @@ -82,28 +82,28 @@ public: static plFactory* GetTheFactory(); - static UInt16 Register(UInt16 hClass, plCreator* worker); // returns hClass - static void UnRegister(UInt16 hClass, plCreator* worker); + static uint16_t Register(uint16_t hClass, plCreator* worker); // returns hClass + static void UnRegister(uint16_t hClass, plCreator* worker); - static bool CanCreate(UInt16 hClass); // return true if creator exists. doesn't assert - static plCreatable* Create(UInt16 hClass); + static bool CanCreate(uint16_t hClass); // return true if creator exists. doesn't assert + static plCreatable* Create(uint16_t hClass); - static hsBool DerivesFrom(UInt16 hBase, UInt16 hDer); + static hsBool DerivesFrom(uint16_t hBase, uint16_t hDer); - static UInt16 GetNumClasses(); + static uint16_t GetNumClasses(); - static UInt16 FindClassIndex(const char* className); // slow lookup for things like console + static uint16_t FindClassIndex(const char* className); // slow lookup for things like console - static hsBool IsValidClassIndex(UInt16 hClass); + static hsBool IsValidClassIndex(uint16_t hClass); // Don't call this unless you're a DLL being initialized. static void SetTheFactory(plFactory* fac); - static const char *GetNameOfClass(UInt16 type); + static const char *GetNameOfClass(uint16_t type); #ifdef HS_DEBUGGING - void IValidate(UInt16 keyIndex); - static void Validate(UInt16 keyIndex); + void IValidate(uint16_t keyIndex); + static void Validate(uint16_t keyIndex); #endif }; diff --git a/Sources/Plasma/NucleusLib/pnGameMgr/BlueSpiral/pnGmBlueSpiral.h b/Sources/Plasma/NucleusLib/pnGameMgr/BlueSpiral/pnGmBlueSpiral.h index b0f5b8fa..1003a0ce 100644 --- a/Sources/Plasma/NucleusLib/pnGameMgr/BlueSpiral/pnGmBlueSpiral.h +++ b/Sources/Plasma/NucleusLib/pnGameMgr/BlueSpiral/pnGmBlueSpiral.h @@ -112,12 +112,12 @@ enum { // empty }; struct Cli2Srv_BlueSpiral_HitCloth : GameMsgHeader { - byte clothNum; // the cloth we hit, 0..6 + uint8_t clothNum; // the cloth we hit, 0..6 }; // Srv2Cli struct Srv2Cli_BlueSpiral_ClothOrder : GameMsgHeader { - byte order[7]; // each value is the cloth to hit, 0..6, the order is the order in the array + uint8_t order[7]; // each value is the cloth to hit, 0..6, the order is the order in the array }; struct Srv2Cli_BlueSpiral_SuccessfulHit : GameMsgHeader { // empty diff --git a/Sources/Plasma/NucleusLib/pnGameMgr/ClimbingWall/pnGmClimbingWall.h b/Sources/Plasma/NucleusLib/pnGameMgr/ClimbingWall/pnGmClimbingWall.h index fd795be4..6bf5a2de 100644 --- a/Sources/Plasma/NucleusLib/pnGameMgr/ClimbingWall/pnGmClimbingWall.h +++ b/Sources/Plasma/NucleusLib/pnGameMgr/ClimbingWall/pnGmClimbingWall.h @@ -125,19 +125,19 @@ enum { int amountToAdjust; // + or - value to adjust the number of blockers by }; struct Cli2Srv_ClimbingWall_Ready : GameMsgHeader { - byte readyType; // the type of ready this message represents (EClimbingWallReadyType) - byte teamNumber; // the team that you are saying is ready (1 or 2) + uint8_t readyType; // the type of ready this message represents (EClimbingWallReadyType) + uint8_t teamNumber; // the team that you are saying is ready (1 or 2) }; struct Cli2Srv_ClimbingWall_BlockerChanged : GameMsgHeader { - byte teamNumber; // the team that is adjusting their blockers - byte blockerNumber; // the number of the blocker that was added/removed + uint8_t teamNumber; // the team that is adjusting their blockers + uint8_t blockerNumber; // the number of the blocker that was added/removed bool added; // was the blocker added, or removed? }; struct Cli2Srv_ClimbingWall_Reset : GameMsgHeader { // }; struct Cli2Srv_ClimbingWall_PlayerEntered : GameMsgHeader { - byte teamNumber; // the team this player is playing for + uint8_t teamNumber; // the team this player is playing for }; struct Cli2Srv_ClimbingWall_FinishedGame : GameMsgHeader { // @@ -148,17 +148,17 @@ enum { // Srv2Cli struct Srv2Cli_ClimbingWall_NumBlockersChanged : GameMsgHeader { - byte newBlockerCount; // the new number of blocker we are playing with + uint8_t newBlockerCount; // the new number of blocker we are playing with bool localOnly; // only adjust your local display, don't net prop }; struct Srv2Cli_ClimbingWall_Ready : GameMsgHeader { - byte readyType; // the type of ready this message represents (EClimbingWallReadyType) + uint8_t readyType; // the type of ready this message represents (EClimbingWallReadyType) bool team1Ready; bool team2Ready; bool localOnly; // only adjust your local display, don't net prop }; struct Srv2Cli_ClimbingWall_BlockersChanged : GameMsgHeader { - byte teamNumber; // the team this set of blockers is for + uint8_t teamNumber; // the team this set of blockers is for int blockersSet[kClimbingWallMaxBlockers]; // which blockers are set bool localOnly; // only adjust your local display, don't net prop }; @@ -171,7 +171,7 @@ enum { bool localOnly; // only adjust your local display, don't net prop }; struct Srv2Cli_ClimbingWall_GameOver : GameMsgHeader { - byte teamWon; // which team won the game + uint8_t teamWon; // which team won the game int team1Blockers[kClimbingWallMaxBlockers]; int team2Blockers[kClimbingWallMaxBlockers]; bool localOnly; // only adjust your local display, don't net prop diff --git a/Sources/Plasma/NucleusLib/pnGameMgr/Heek/pnGmHeek.h b/Sources/Plasma/NucleusLib/pnGameMgr/Heek/pnGmHeek.h index 0eab49a1..d48304d8 100644 --- a/Sources/Plasma/NucleusLib/pnGameMgr/Heek/pnGmHeek.h +++ b/Sources/Plasma/NucleusLib/pnGameMgr/Heek/pnGmHeek.h @@ -138,18 +138,18 @@ enum { // Cli2Srv struct Cli2Srv_Heek_PlayGame : GameMsgHeader { - byte position; // 0...4 - dword points; - wchar name[256]; + uint8_t position; // 0...4 + uint32_t points; + wchar_t name[256]; }; struct Cli2Srv_Heek_LeaveGame : GameMsgHeader { // no extra data }; struct Cli2Srv_Heek_Choose : GameMsgHeader { - byte choice; // kHeekRock...kHeekScissors + uint8_t choice; // kHeekRock...kHeekScissors }; struct Cli2Srv_Heek_SeqFinished : GameMsgHeader { - byte seqFinished; // kHeekCountdownSeq...kHeekGameWinSeq + uint8_t seqFinished; // kHeekCountdownSeq...kHeekGameWinSeq }; // Srv2Cli @@ -162,39 +162,39 @@ enum { // no extra data }; struct Srv2Cli_Heek_Welcome : GameMsgHeader { - dword points; - dword rank; - wchar name[256]; + uint32_t points; + uint32_t rank; + wchar_t name[256]; }; struct Srv2Cli_Heek_Drop : GameMsgHeader { - byte position; // 0...4 + uint8_t position; // 0...4 }; struct Srv2Cli_Heek_Setup : GameMsgHeader { - byte position; // 0...4 + uint8_t position; // 0...4 bool buttonState; bool lightOn[6]; }; struct Srv2Cli_Heek_LightState : GameMsgHeader { - byte lightNum; - byte state; // kHeekLightOn...kHeekLightFlash + uint8_t lightNum; + uint8_t state; // kHeekLightOn...kHeekLightFlash }; struct Srv2Cli_Heek_InterfaceState : GameMsgHeader { bool buttonsEnabled; }; struct Srv2Cli_Heek_CountdownState : GameMsgHeader { - byte state; // kHeekCountdownStart...kHeekCountdownIdle + uint8_t state; // kHeekCountdownStart...kHeekCountdownIdle }; struct Srv2Cli_Heek_WinLose : GameMsgHeader { bool win; - byte choice; // kHeekRock...kHeekScissors + uint8_t choice; // kHeekRock...kHeekScissors }; struct Srv2Cli_Heek_GameWin : GameMsgHeader { - byte choice; // kHeekRock...kHeekScissors + uint8_t choice; // kHeekRock...kHeekScissors }; struct Srv2Cli_Heek_PointUpdate : GameMsgHeader { bool displayUpdate; - dword points; - dword rank; + uint32_t points; + uint32_t rank; }; //============================================================================ diff --git a/Sources/Plasma/NucleusLib/pnGameMgr/Marker/pnGmMarker.h b/Sources/Plasma/NucleusLib/pnGameMgr/Marker/pnGmMarker.h index ba547b29..78215554 100644 --- a/Sources/Plasma/NucleusLib/pnGameMgr/Marker/pnGmMarker.h +++ b/Sources/Plasma/NucleusLib/pnGameMgr/Marker/pnGmMarker.h @@ -124,10 +124,10 @@ enum { // Message parameters //======================================================================== struct Marker_CreateParam { - byte gameType; // member of EMarkerGameType - wchar gameName[256]; - dword timeLimit; - wchar templateID[80]; // empty if creating a new game, guid if a quest game and we need to grab the data from the state server + uint8_t gameType; // member of EMarkerGameType + wchar_t gameName[256]; + uint32_t timeLimit; + wchar_t templateID[80]; // empty if creating a new game, guid if a quest game and we need to grab the data from the state server }; //======================================================================== @@ -145,10 +145,10 @@ enum { // nothing }; struct Cli2Srv_Marker_ChangeGameName : GameMsgHeader { - wchar gameName[256]; + wchar_t gameName[256]; }; struct Cli2Srv_Marker_ChangeTimeLimit : GameMsgHeader { - dword timeLimit; + uint32_t timeLimit; }; struct Cli2Srv_Marker_DeleteGame : GameMsgHeader { // nothing @@ -157,35 +157,35 @@ enum { double x; double y; double z; - wchar name[256]; - wchar age[80]; + wchar_t name[256]; + wchar_t age[80]; }; struct Cli2Srv_Marker_DeleteMarker : GameMsgHeader { - dword markerID; + uint32_t markerID; }; struct Cli2Srv_Marker_ChangeMarkerName : GameMsgHeader { - dword markerID; - wchar markerName[256]; + uint32_t markerID; + wchar_t markerName[256]; }; struct Cli2Srv_Marker_CaptureMarker : GameMsgHeader { - dword markerID; + uint32_t markerID; }; // Srv2Cli struct Srv2Cli_Marker_TemplateCreated : GameMsgHeader { - wchar templateID[80]; + wchar_t templateID[80]; }; struct Srv2Cli_Marker_TeamAssigned : GameMsgHeader { - byte teamNumber; // 1 or 2 + uint8_t teamNumber; // 1 or 2 }; struct Srv2Cli_Marker_GameType : GameMsgHeader { - byte gameType; // member of EMarkerGameType + uint8_t gameType; // member of EMarkerGameType }; struct Srv2Cli_Marker_GameStarted : GameMsgHeader { // nothing }; struct Srv2Cli_Marker_GamePaused : GameMsgHeader { - dword timeLeft; // 0 if quest game, since they don't have a timer + uint32_t timeLeft; // 0 if quest game, since they don't have a timer }; struct Srv2Cli_Marker_GameReset : GameMsgHeader { // nothing @@ -194,10 +194,10 @@ enum { // nothing }; struct Srv2Cli_Marker_GameNameChanged : GameMsgHeader { - wchar newName[256]; + wchar_t newName[256]; }; struct Srv2Cli_Marker_TimeLimitChanged : GameMsgHeader { - dword newTimeLimit; + uint32_t newTimeLimit; }; struct Srv2Cli_Marker_GameDeleted : GameMsgHeader { bool failed; // did the delete fail? @@ -206,20 +206,20 @@ enum { double x; double y; double z; - dword markerID; - wchar name[256]; - wchar age[80]; + uint32_t markerID; + wchar_t name[256]; + wchar_t age[80]; }; struct Srv2Cli_Marker_MarkerDeleted : GameMsgHeader { - dword markerID; + uint32_t markerID; }; struct Srv2Cli_Marker_MarkerNameChanged : GameMsgHeader { - dword markerID; - wchar newName[256]; + uint32_t markerID; + wchar_t newName[256]; }; struct Srv2Cli_Marker_MarkerCaptured : GameMsgHeader { - dword markerID; - byte team; // 0 for no team, or for quest games + uint32_t markerID; + uint8_t team; // 0 for no team, or for quest games }; diff --git a/Sources/Plasma/NucleusLib/pnGameMgr/TicTacToe/pnGmTicTacToe.h b/Sources/Plasma/NucleusLib/pnGameMgr/TicTacToe/pnGmTicTacToe.h index 1ce022ef..a0643073 100644 --- a/Sources/Plasma/NucleusLib/pnGameMgr/TicTacToe/pnGmTicTacToe.h +++ b/Sources/Plasma/NucleusLib/pnGameMgr/TicTacToe/pnGmTicTacToe.h @@ -103,7 +103,7 @@ enum { // Message parameters //======================================================================== struct TTT_CreateParam { - byte playerCount; // 1 or 2 + uint8_t playerCount; // 1 or 2 }; //======================================================================== @@ -112,8 +112,8 @@ enum { // Cli2Srv struct Cli2Srv_TTT_MakeMove : GameMsgHeader { - byte row; // 1..3 - byte col; // 1..3 + uint8_t row; // 1..3 + uint8_t col; // 1..3 }; // Srv2Cli @@ -122,12 +122,12 @@ enum { }; struct Srv2Cli_TTT_GameOver : GameMsgHeader { ETTTGameResult result; - dword winnerId; + uint32_t winnerId; }; struct Srv2Cli_TTT_MoveMade : GameMsgHeader { - dword playerId; - byte row; // 1..3 - byte col; // 1..3 + uint32_t playerId; + uint8_t row; // 1..3 + uint8_t col; // 1..3 }; //============================================================================ diff --git a/Sources/Plasma/NucleusLib/pnGameMgr/VarSync/pnGmVarSync.h b/Sources/Plasma/NucleusLib/pnGameMgr/VarSync/pnGmVarSync.h index da7831d9..75c3de39 100644 --- a/Sources/Plasma/NucleusLib/pnGameMgr/VarSync/pnGmVarSync.h +++ b/Sources/Plasma/NucleusLib/pnGameMgr/VarSync/pnGmVarSync.h @@ -112,7 +112,7 @@ enum { // Cli2Srv struct Cli2Srv_VarSync_SetStringVar : GameMsgHeader { unsigned long varID; - wchar varValue[256]; + wchar_t varValue[256]; }; struct Cli2Srv_VarSync_SetNumericVar : GameMsgHeader { unsigned long varID; @@ -121,18 +121,18 @@ enum { struct Cli2Srv_VarSync_RequestAllVars : GameMsgHeader { }; struct Cli2Srv_VarSync_CreateStringVar : GameMsgHeader { - wchar varName[256]; - wchar varValue[256]; + wchar_t varName[256]; + wchar_t varValue[256]; }; struct Cli2Srv_VarSync_CreateNumericVar : GameMsgHeader { - wchar varName[256]; + wchar_t varName[256]; double varValue; }; // Srv2Cli struct Srv2Cli_VarSync_StringVarChanged : GameMsgHeader { unsigned long varID; - wchar varValue[256]; + wchar_t varValue[256]; }; struct Srv2Cli_VarSync_NumericVarChanged : GameMsgHeader { unsigned long varID; @@ -141,12 +141,12 @@ enum { struct Srv2Cli_VarSync_AllVarsSent : GameMsgHeader { }; struct Srv2Cli_VarSync_StringVarCreated : GameMsgHeader { - wchar varName[256]; + wchar_t varName[256]; unsigned long varID; - wchar varValue[256]; + wchar_t varValue[256]; }; struct Srv2Cli_VarSync_NumericVarCreated : GameMsgHeader { - wchar varName[256]; + wchar_t varName[256]; unsigned long varID; double varValue; }; diff --git a/Sources/Plasma/NucleusLib/pnGameMgr/pnGameMgr.h b/Sources/Plasma/NucleusLib/pnGameMgr/pnGameMgr.h index cb726f72..5797fd7e 100644 --- a/Sources/Plasma/NucleusLib/pnGameMgr/pnGameMgr.h +++ b/Sources/Plasma/NucleusLib/pnGameMgr/pnGameMgr.h @@ -169,10 +169,10 @@ enum { //============================================================================ struct GameMsgHeader { - dword messageId; - dword transId; - dword recvGameId; // 0 --> GameMgr, non-zero --> GameSrv - dword messageBytes; + uint32_t messageId; + uint32_t transId; + uint32_t recvGameId; // 0 --> GameMgr, non-zero --> GameSrv + uint32_t messageBytes; }; //======================================================================== @@ -182,35 +182,35 @@ enum { // Cli2Srv struct Cli2Srv_GameMgr_CreateGame : GameMsgHeader { Uuid gameTypeId; - dword createOptions; - dword createDataBytes; - byte createData[1]; // [createDataBytes] + uint32_t createOptions; + uint32_t createDataBytes; + uint8_t createData[1]; // [createDataBytes] }; struct Cli2Srv_GameMgr_JoinGame : GameMsgHeader { // Field ordering here is vitally important, see pfGameMgr::JoinGame for explanation - dword newGameId; - dword createOptions; + uint32_t newGameId; + uint32_t createOptions; Uuid gameTypeId; - dword createDataBytes; - byte createData[1]; // [createDataBytes] + uint32_t createDataBytes; + uint8_t createData[1]; // [createDataBytes] }; // Srv2Cli struct Srv2Cli_GameMgr_GameInstance : GameMsgHeader { EGameJoinError result; - dword ownerId; + uint32_t ownerId; Uuid gameTypeId; - dword newGameId; + uint32_t newGameId; }; struct Srv2Cli_GameMgr_InviteReceived : GameMsgHeader { - dword inviterId; + uint32_t inviterId; Uuid gameTypeId; - dword newGameId; + uint32_t newGameId; }; struct Srv2Cli_GameMgr_InviteRevoked : GameMsgHeader { - dword inviterId; + uint32_t inviterId; Uuid gameTypeId; - dword newGameId; + uint32_t newGameId; }; @@ -222,26 +222,26 @@ enum { struct Cli2Srv_Game_LeaveGame : GameMsgHeader { }; struct Cli2Srv_Game_Invite : GameMsgHeader { - dword playerId; + uint32_t playerId; }; struct Cli2Srv_Game_Uninvite : GameMsgHeader { - dword playerId; + uint32_t playerId; }; // Srv2Cli struct Srv2Cli_Game_PlayerJoined : GameMsgHeader { - dword playerId; + uint32_t playerId; }; struct Srv2Cli_Game_PlayerLeft : GameMsgHeader { - dword playerId; + uint32_t playerId; }; struct Srv2Cli_Game_InviteFailed : GameMsgHeader { - dword inviteeId; - dword operationId; + uint32_t inviteeId; + uint32_t operationId; EGameInviteError error; }; struct Srv2Cli_Game_OwnerChange : GameMsgHeader { - dword ownerId; + uint32_t ownerId; }; diff --git a/Sources/Plasma/NucleusLib/pnIni/Intern.h b/Sources/Plasma/NucleusLib/pnIni/Intern.h index b5cbd422..53a319cc 100644 --- a/Sources/Plasma/NucleusLib/pnIni/Intern.h +++ b/Sources/Plasma/NucleusLib/pnIni/Intern.h @@ -58,7 +58,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com ***/ struct IniValue { - ARRAY(wchar *) fArgs; + ARRAY(wchar_t *) fArgs; IniKey * fKey; unsigned fIndex; unsigned fLineNum; @@ -71,10 +71,10 @@ struct IniKey { HASHLINK(IniKey) fLink; ARRAY(IniValue *) fValues; IniSection * fSection; - wchar fName[1]; // variable length + wchar_t fName[1]; // variable length // no more fields - IniKey (IniSection * section, const wchar name[]); + IniKey (IniSection * section, const wchar_t name[]); ~IniKey (); unsigned GetHash () const; @@ -84,10 +84,10 @@ struct IniKey { struct IniSection { HASHTABLEDECL(IniKey, CHashKeyStrPtrI, fLink) fKeys; HASHLINK(IniSection) fLink; - wchar fName[1]; // variable length + wchar_t fName[1]; // variable length // no more fields - IniSection (const wchar name[]); + IniSection (const wchar_t name[]); ~IniSection (); unsigned GetHash () const; diff --git a/Sources/Plasma/NucleusLib/pnIni/Private/pnIniChange.h b/Sources/Plasma/NucleusLib/pnIni/Private/pnIniChange.h index 64f58343..1b8c7028 100644 --- a/Sources/Plasma/NucleusLib/pnIni/Private/pnIniChange.h +++ b/Sources/Plasma/NucleusLib/pnIni/Private/pnIniChange.h @@ -59,15 +59,15 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com struct IniChangeReg; -typedef void (* FIniFileChangeCallback)(const wchar fullPath[]); +typedef void (* FIniFileChangeCallback)(const wchar_t fullPath[]); void IniChangeInitialize ( - const wchar dir[] = L"Config" + const wchar_t dir[] = L"Config" ); void IniChangeDestroy (); void IniChangeAdd ( - const wchar filename[], // just filename, no path or extension + const wchar_t filename[], // just filename, no path or extension FIniFileChangeCallback callback, IniChangeReg ** reg ); diff --git a/Sources/Plasma/NucleusLib/pnIni/Private/pnIniCore.cpp b/Sources/Plasma/NucleusLib/pnIni/Private/pnIniCore.cpp index 25134067..bf969711 100644 --- a/Sources/Plasma/NucleusLib/pnIni/Private/pnIniCore.cpp +++ b/Sources/Plasma/NucleusLib/pnIni/Private/pnIniCore.cpp @@ -56,11 +56,11 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com ***/ //=========================================================================== -static wchar * TrimWhitespace (wchar * name) { +static wchar_t * TrimWhitespace (wchar_t * name) { while (isspace((char) *name)) ++name; - for (wchar * term = name; *term; ++term) { + for (wchar_t * term = name; *term; ++term) { if (isspace((char) *term)) { *term = 0; break; @@ -87,21 +87,23 @@ IniValue::IniValue (IniKey * key, unsigned lineNum) //=========================================================================== IniValue::~IniValue () { - wchar ** cur = fArgs.Ptr(); - wchar ** end = fArgs.Term(); + wchar_t ** cur = fArgs.Ptr(); + wchar_t ** end = fArgs.Term(); for (; cur < end; ++cur) - FREE(*cur); + free(*cur); } //=========================================================================== static void AddValueString ( IniValue * value, - const wchar src[] + const wchar_t src[] ) { unsigned chars = StrLen(src) + 1; - wchar * dst = ALLOCA(wchar, chars); + wchar_t * dst = (wchar_t*)malloc(sizeof(wchar_t) * chars); StrTokenize(&src, dst, chars, L" \t\r\n\""); value->fArgs.Add(StrDup(dst)); + + free(dst); } @@ -112,7 +114,7 @@ static void AddValueString ( ***/ //=========================================================================== -IniKey::IniKey (IniSection * section, const wchar name[]) +IniKey::IniKey (IniSection * section, const wchar_t name[]) : fSection(section) { StrCopy(fName, name, (unsigned) -1); @@ -124,7 +126,7 @@ IniKey::~IniKey () { IniValue ** cur = fValues.Ptr(); IniValue ** end = fValues.Term(); for (; cur < end; ++cur) - DEL(*cur); + delete *cur; } //=========================================================================== @@ -140,7 +142,7 @@ inline bool IniKey::operator== (const CHashKeyStrPtrI & rhs) const { //=========================================================================== static IniValue * AddKeyValue ( IniSection * section, - wchar * string, + wchar_t * string, unsigned lineNum ) { string = TrimWhitespace(string); @@ -148,13 +150,13 @@ static IniValue * AddKeyValue ( // Find or create the key IniKey * key = section->fKeys.Find(string); if (!key) { - key = new(ALLOC( + key = new(malloc( sizeof(*key) - sizeof(key->fName) + StrBytes(string) )) IniKey(section, string); } // Add a new value holder for the key - return NEW(IniValue)(key, lineNum); + return new IniValue(key, lineNum); } @@ -165,7 +167,7 @@ static IniValue * AddKeyValue ( ***/ //=========================================================================== -IniSection::IniSection (const wchar name[]) { +IniSection::IniSection (const wchar_t name[]) { StrCopy(fName, name, (unsigned) -1); } @@ -187,12 +189,12 @@ inline bool IniSection::operator== (const CHashKeyStrPtrI & rhs) const { //=========================================================================== static IniSection * AddSection ( Ini * ini, - wchar * string + wchar_t * string ) { // Find or create the section IniSection * section = ini->fSections.Find(string); if (!section) { - section = new(ALLOC( + section = new(malloc( sizeof(*section) - sizeof(section->fName) + StrBytes(string) )) IniSection(string); ini->fSections.Add(section); @@ -222,16 +224,16 @@ Ini::~Ini () { //=========================================================================== static void ParseBuffer ( Ini * ini, - const wchar buffer[] + const wchar_t buffer[] ) { - const wchar SECTION_OPEN_CHAR = '['; - const wchar SECTION_CLOSE_CHAR = ']'; - const wchar EQUIVALENCE_CHAR = '='; - const wchar VALUE_SEPARATOR = ','; - const wchar COMMENT_CHAR = ';'; - const wchar QUOTE_CHAR = '\"'; - const wchar NEWLINE = '\n'; + const wchar_t SECTION_OPEN_CHAR = '['; + const wchar_t SECTION_CLOSE_CHAR = ']'; + const wchar_t EQUIVALENCE_CHAR = '='; + const wchar_t VALUE_SEPARATOR = ','; + const wchar_t COMMENT_CHAR = ';'; + const wchar_t QUOTE_CHAR = '\"'; + const wchar_t NEWLINE = '\n'; enum { STATE_BEGIN, @@ -244,9 +246,9 @@ static void ParseBuffer ( IniSection * section = nil; IniValue * value = nil; - const wchar * start = nil; + const wchar_t * start = nil; bool valInQuotes = false; - wchar dst[512]; + wchar_t dst[512]; dst[0] = 0; for (unsigned lineNum = 1;; ++buffer) { @@ -374,11 +376,11 @@ static void IniFileNotifyProc ( //=========================================================================== static bool ParseFile ( Ini * ini, - const wchar fileName[] + const wchar_t fileName[] ) { // Open file - qword fileSize; - qword fileLastWriteTime; + uint64_t fileSize; + uint64_t fileLastWriteTime; EFileError error; AsyncFile file = AsyncFileOpen( fileName, @@ -402,19 +404,19 @@ static bool ParseFile ( result = true; } else { - // Read entire file into memory and NULL terminate wchar - byte * buffer = (byte *) ALLOC((unsigned) fileSize + sizeof(wchar)); + // Read entire file into memory and NULL terminate wchar_t + uint8_t * buffer = (uint8_t *) malloc((unsigned) fileSize + sizeof(wchar_t)); AsyncFileRead(file, 0, buffer, (unsigned) fileSize, kAsyncFileRwSync, nil); - * (wchar *) &buffer[fileSize] = 0; + * (wchar_t *) &buffer[fileSize] = 0; // Convert to unicode if necessary - if (* (wchar *) buffer != UNICODE_BOM) { - byte * src = buffer; + if (* (wchar_t *) buffer != UNICODE_BOM) { + uint8_t * src = buffer; // Allocate two extra spaces for UNICODE_BOM and terminator - unsigned newBufferSize = ((unsigned) fileSize + 2) * sizeof(wchar); + unsigned newBufferSize = ((unsigned) fileSize + 2) * sizeof(wchar_t); // Allocate new buffer - wchar * dst = (wchar *) ALLOC(newBufferSize); + wchar_t * dst = (wchar_t *) malloc(newBufferSize); // If it's UTF-8 file,convert to Unicode if (StrCmpI((char *)buffer, UTF8_BOM, StrLen(UTF8_BOM)) == 0) { @@ -430,12 +432,12 @@ static bool ParseFile ( } } - FREE(src); - buffer = (byte *) dst; + free(src); + buffer = (uint8_t *) dst; } - ParseBuffer(ini, (const wchar *) buffer); - FREE(buffer); + ParseBuffer(ini, (const wchar_t *) buffer); + free(buffer); result = true; } @@ -452,9 +454,9 @@ static bool ParseFile ( //=========================================================================== Ini * IniOpen ( - const wchar fileName[] + const wchar_t fileName[] ) { - Ini * ini = NEW(Ini); + Ini * ini = new Ini; if (!ParseFile(ini, fileName)) { IniClose(ini); return nil; @@ -464,13 +466,13 @@ Ini * IniOpen ( //=========================================================================== void IniClose (Ini * ini) { - DEL(ini); + delete ini; } //=========================================================================== const IniSection * IniGetFirstSection ( const Ini * ini, - wchar * name, + wchar_t * name, unsigned chars ) { if (chars) @@ -487,7 +489,7 @@ const IniSection * IniGetFirstSection ( //=========================================================================== const IniSection * IniGetNextSection ( const IniSection * section, - wchar * name, + wchar_t * name, unsigned chars ) { if (chars) @@ -504,7 +506,7 @@ const IniSection * IniGetNextSection ( //=========================================================================== const IniSection * IniGetSection ( const Ini * ini, - const wchar name[] + const wchar_t name[] ) { if (!ini) return nil; @@ -517,7 +519,7 @@ const IniSection * IniGetSection ( //=========================================================================== const IniKey * IniGetFirstKey ( const IniSection * section, - wchar * name, + wchar_t * name, unsigned chars ) { if (chars) @@ -534,8 +536,8 @@ const IniKey * IniGetFirstKey ( //============================================================================ const IniKey * IniGetFirstKey ( const Ini * ini, - const wchar sectionName[], - wchar * name, + const wchar_t sectionName[], + wchar_t * name, unsigned chars ) { if (const IniSection * section = IniGetSection(ini, sectionName)) @@ -547,7 +549,7 @@ const IniKey * IniGetFirstKey ( //=========================================================================== const IniKey * IniGetNextKey ( const IniKey * key, - wchar * name, + wchar_t * name, unsigned chars ) { if (chars) @@ -564,7 +566,7 @@ const IniKey * IniGetNextKey ( //=========================================================================== const IniKey * IniGetKey ( const IniSection * section, - const wchar name[] + const wchar_t name[] ) { if (!section) return nil; @@ -599,7 +601,7 @@ const IniValue * IniGetFirstValue ( //=========================================================================== const IniValue * IniGetFirstValue ( const IniSection * section, - const wchar keyName[], + const wchar_t keyName[], unsigned * lineNum ) { const IniValue * value = nil; @@ -623,8 +625,8 @@ const IniValue * IniGetFirstValue ( //=========================================================================== const IniValue * IniGetFirstValue ( const Ini * ini, - const wchar sectionName[], - const wchar keyName[], + const wchar_t sectionName[], + const wchar_t keyName[], unsigned * lineNum ) { const IniValue * value = nil; @@ -680,7 +682,7 @@ bool IniGetUnsigned ( if (!value) break; - wchar str[32]; + wchar_t str[32]; if (!IniGetString(value, str, arrsize(str), index, nil)) break; @@ -698,10 +700,10 @@ bool IniGetUnsigned ( //=========================================================================== bool IniGetString ( const IniValue * value, - wchar * result, + wchar_t * result, unsigned resultChars, unsigned index, - const wchar defaultValue[] + const wchar_t defaultValue[] ) { ASSERT(result); @@ -722,7 +724,7 @@ bool IniGetUuid ( unsigned index, const Uuid & defaultValue ) { - wchar str[128]; + wchar_t str[128]; if (IniGetString(value, str, arrsize(str), index, nil)) return GuidFromString(str, uuid); else @@ -734,8 +736,8 @@ bool IniGetUuid ( //=========================================================================== unsigned IniGetBoundedValue ( const IniValue * value, - const wchar section[], - const wchar key[], + const wchar_t section[], + const wchar_t key[], unsigned index, unsigned minVal, unsigned maxVal, @@ -756,8 +758,8 @@ unsigned IniGetBoundedValue ( //=========================================================================== unsigned IniGetBoundedValue ( const Ini * ini, - const wchar section[], - const wchar key[], + const wchar_t section[], + const wchar_t key[], unsigned index, unsigned minVal, unsigned maxVal, diff --git a/Sources/Plasma/NucleusLib/pnIni/Private/pnIniCore.h b/Sources/Plasma/NucleusLib/pnIni/Private/pnIniCore.h index f726a201..10ff2963 100644 --- a/Sources/Plasma/NucleusLib/pnIni/Private/pnIniCore.h +++ b/Sources/Plasma/NucleusLib/pnIni/Private/pnIniCore.h @@ -65,7 +65,7 @@ struct IniSection; // File Ini * IniOpen ( - const wchar filename[] + const wchar_t filename[] ); void IniClose ( Ini * ini @@ -74,39 +74,39 @@ void IniClose ( // Section const IniSection * IniGetFirstSection ( const Ini * ini, - wchar * name, + wchar_t * name, unsigned chars ); const IniSection * IniGetNextSection ( const IniSection * section, - wchar * name, + wchar_t * name, unsigned chars ); const IniSection * IniGetSection ( const Ini * ini, - const wchar name[] + const wchar_t name[] ); // Key const IniKey * IniGetFirstKey ( const IniSection * section, - wchar * name, + wchar_t * name, unsigned chars ); const IniKey * IniGetFirstKey ( const Ini * ini, - const wchar sectionName[], - wchar * name, + const wchar_t sectionName[], + wchar_t * name, unsigned chars ); const IniKey * IniGetNextKey ( const IniKey * key, - wchar * name, + wchar_t * name, unsigned chars ); const IniKey * IniGetKey ( const IniSection * ini, - const wchar name[] + const wchar_t name[] ); // Value @@ -116,13 +116,13 @@ const IniValue * IniGetFirstValue ( ); const IniValue * IniGetFirstValue ( const IniSection * section, - const wchar keyName[], + const wchar_t keyName[], unsigned * iter ); const IniValue * IniGetFirstValue ( const Ini * ini, - const wchar sectionName[], - const wchar keyName[], + const wchar_t sectionName[], + const wchar_t keyName[], unsigned * iter ); const IniValue * IniGetNextValue ( @@ -139,10 +139,10 @@ bool IniGetUnsigned ( ); bool IniGetString ( const IniValue * value, - wchar * result, + wchar_t * result, unsigned resultChars, unsigned index = 0, - const wchar defaultValue[] = nil + const wchar_t defaultValue[] = nil ); bool IniGetUuid ( const IniValue * value, @@ -154,8 +154,8 @@ bool IniGetUuid ( // Bounded values unsigned IniGetBoundedValue ( const Ini * ini, - const wchar sectionName[], - const wchar keyName[], + const wchar_t sectionName[], + const wchar_t keyName[], unsigned index, unsigned minVal, unsigned maxVal, diff --git a/Sources/Plasma/NucleusLib/pnIniExe/Private/Win32/pnW32IniChange.cpp b/Sources/Plasma/NucleusLib/pnIniExe/Private/Win32/pnW32IniChange.cpp index a0bc4a1d..d988aff8 100644 --- a/Sources/Plasma/NucleusLib/pnIniExe/Private/Win32/pnW32IniChange.cpp +++ b/Sources/Plasma/NucleusLib/pnIniExe/Private/Win32/pnW32IniChange.cpp @@ -62,8 +62,8 @@ struct IniChangeFile; struct IniChangeReg { LINK(IniChangeReg) fLink; FIniFileChangeCallback fNotify; - qword fLastWriteTime; - wchar fFileName[MAX_PATH]; + uint64_t fLastWriteTime; + wchar_t fFileName[MAX_PATH]; }; static CLock s_lock; @@ -73,7 +73,7 @@ static HANDLE s_thread; static HANDLE s_change; static bool s_running; static IniChangeReg * s_dispatch; -static wchar s_directory[MAX_PATH]; +static wchar_t s_directory[MAX_PATH]; static LISTDECL(IniChangeReg, fLink) s_callbacks; @@ -84,13 +84,13 @@ static LISTDECL(IniChangeReg, fLink) s_callbacks; ***/ //=========================================================================== -static qword GetFileTimestamp (const wchar fileName[]) { +static uint64_t GetFileTimestamp (const wchar_t fileName[]) { HANDLE find; WIN32_FIND_DATAW fd; - qword lastWriteTime; + uint64_t lastWriteTime; if (INVALID_HANDLE_VALUE != (find = FindFirstFileW(fileName, &fd))) { COMPILER_ASSERT(sizeof(lastWriteTime) == sizeof(fd.ftLastWriteTime)); - lastWriteTime = * (const qword *) &fd.ftLastWriteTime; + lastWriteTime = * (const uint64_t *) &fd.ftLastWriteTime; FindClose(find); } else { @@ -109,7 +109,7 @@ static void ChangeDispatch_WL (IniChangeReg * marker) { // If the file record time matches the file data time // then there's no need to reprocess the callbacks - qword lastWriteTime = GetFileTimestamp(s_dispatch->fFileName); + uint64_t lastWriteTime = GetFileTimestamp(s_dispatch->fFileName); if (s_dispatch->fLastWriteTime == lastWriteTime) continue; s_dispatch->fLastWriteTime = lastWriteTime; @@ -212,7 +212,7 @@ static unsigned THREADCALL IniSrvThreadProc (AsyncThread * thread) { ***/ //=========================================================================== -void IniChangeInitialize (const wchar dir[]) { +void IniChangeInitialize (const wchar_t dir[]) { ASSERT(!s_running); s_running = true; @@ -311,7 +311,7 @@ void IniChangeDestroy () { //=========================================================================== void IniChangeAdd ( - const wchar fileName[], + const wchar_t fileName[], FIniFileChangeCallback callback, IniChangeReg ** changePtr ) { @@ -321,7 +321,7 @@ void IniChangeAdd ( ASSERT(s_running); // Create a callback record - IniChangeReg * change = NEW(IniChangeReg); + IniChangeReg * change = new IniChangeReg; change->fNotify = callback; change->fLastWriteTime = 0; PathAddFilename( @@ -366,7 +366,7 @@ void IniChangeRemove ( s_lock.LeaveWrite(); // Delete object outside critical section - DEL(change); + delete change; } //=========================================================================== diff --git a/Sources/Plasma/NucleusLib/pnIniExe/Private/pnIniSrv.cpp b/Sources/Plasma/NucleusLib/pnIniExe/Private/pnIniSrv.cpp index 5f4173e4..ffe2f6c6 100644 --- a/Sources/Plasma/NucleusLib/pnIniExe/Private/pnIniSrv.cpp +++ b/Sources/Plasma/NucleusLib/pnIniExe/Private/pnIniSrv.cpp @@ -92,7 +92,7 @@ AUTO_INIT_FUNC(InitSrvRightsIni) { } //============================================================================ -static EServerRights GetServerRightsFromString(const wchar string[]) { +static EServerRights GetServerRightsFromString(const wchar_t string[]) { if (StrCmpI(string, L"Server") == 0) return kSrvRightsServer; else if (StrCmpI(string, L"Basic") == 0) @@ -102,7 +102,7 @@ static EServerRights GetServerRightsFromString(const wchar string[]) { } static void IAddAddressBlock(ADDRESS_BLOCK_TABLE & addrList, NetAddressNode startAddr, NetAddressNode endAddr, EServerRights srvRights) { - PrivilegedAddressBlock* addrBlock = NEW(PrivilegedAddressBlock); + PrivilegedAddressBlock* addrBlock = new PrivilegedAddressBlock; addrBlock->startAddress = startAddr; addrBlock->serverRights = srvRights; @@ -114,7 +114,7 @@ static void IAddAddressBlock(ADDRESS_BLOCK_TABLE & addrList, NetAddressNode star if ( (addrBlock->startAddress & CLASS_C_SUBNET_MASK) != (addrBlock->endAddress & CLASS_C_SUBNET_MASK) ) { LogMsg(kLogDebug, L"IniSrv: Error creating privileged address block - start address and end address aren't from the same subnet."); - DEL(addrBlock); + delete addrBlock; } else { addrBlock->SetValue(startAddr & CLASS_C_SUBNET_MASK); @@ -173,7 +173,7 @@ void SrvIniParseServerRights (Ini * ini) { // add ini file address blocks while (value) { - wchar valStr[20]; + wchar_t valStr[20]; NetAddressNode start; NetAddressNode end; EServerRights rights; diff --git a/Sources/Plasma/NucleusLib/pnInputCore/plControlDefinition.h b/Sources/Plasma/NucleusLib/pnInputCore/plControlDefinition.h index 1f3e4b5f..7f046db8 100644 --- a/Sources/Plasma/NucleusLib/pnInputCore/plControlDefinition.h +++ b/Sources/Plasma/NucleusLib/pnInputCore/plControlDefinition.h @@ -112,7 +112,7 @@ enum struct Win32keyConvert { - UInt32 fVKey; + uint32_t fVKey; const char* fKeyName; }; @@ -125,14 +125,14 @@ struct CommandConvert struct plMouseInfo { - plMouseInfo(ControlEventCode _code, UInt32 _flags, hsPoint4 _box, char* _desc) + plMouseInfo(ControlEventCode _code, uint32_t _flags, hsPoint4 _box, char* _desc) { fCode = _code; fControlFlags = _flags; fBox = _box; fControlDescription = _desc; } - plMouseInfo(ControlEventCode _code, UInt32 _flags, hsScalar pt1, hsScalar pt2, hsScalar pt3, hsScalar pt4, char* _desc) + plMouseInfo(ControlEventCode _code, uint32_t _flags, float pt1, float pt2, float pt3, float pt4, char* _desc) { fCode = _code; fControlFlags = _flags; @@ -140,7 +140,7 @@ struct plMouseInfo fControlDescription = _desc; } ControlEventCode fCode; - UInt32 fControlFlags; + uint32_t fControlFlags; hsPoint4 fBox; char* fControlDescription; }; diff --git a/Sources/Plasma/NucleusLib/pnInputCore/plInputMap.cpp b/Sources/Plasma/NucleusLib/pnInputCore/plInputMap.cpp index d0e5b3af..37196432 100644 --- a/Sources/Plasma/NucleusLib/pnInputCore/plInputMap.cpp +++ b/Sources/Plasma/NucleusLib/pnInputCore/plInputMap.cpp @@ -44,7 +44,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "plInputMap.h" #include "plKeyMap.h" -#include "hsUtils.h" + #include "plResMgr/plLocalization.h" ControlEventCode plInputMap::ConvertCharToControlCode(const char* c) @@ -125,7 +125,7 @@ plKeyBinding::plKeyBinding() fString = nil; } -plKeyBinding::plKeyBinding( ControlEventCode code, UInt32 codeFlags, const plKeyCombo &key1, const plKeyCombo &key2, const char *string /*= nil*/ ) +plKeyBinding::plKeyBinding( ControlEventCode code, uint32_t codeFlags, const plKeyCombo &key1, const plKeyCombo &key2, const char *string /*= nil*/ ) { fCode = code; fCodeFlags = codeFlags; @@ -184,7 +184,7 @@ plKeyMap::~plKeyMap() void plKeyMap::ClearAll( void ) { - UInt32 i; + uint32_t i; for( i = 0; i < fBindings.GetCount(); i++ ) @@ -196,12 +196,12 @@ void plKeyMap::ClearAll( void ) // Adds a given control code to the map. Once you add it, you can't change its flags. // Returns false if the code is already present -hsBool plKeyMap::AddCode( ControlEventCode code, UInt32 codeFlags ) +hsBool plKeyMap::AddCode( ControlEventCode code, uint32_t codeFlags ) { if( IFindBinding( code ) != nil ) return false; - fBindings.Append( TRACKED_NEW plKeyBinding( code, codeFlags, plKeyCombo::kUnmapped, plKeyCombo::kUnmapped ) ); + fBindings.Append( new plKeyBinding( code, codeFlags, plKeyCombo::kUnmapped, plKeyCombo::kUnmapped ) ); return true; } @@ -214,7 +214,7 @@ hsBool plKeyMap::AddConsoleCommand( const char *command ) if( IFindConsoleBinding( command ) != nil ) return false; - fBindings.Append( TRACKED_NEW plKeyBinding( B_CONTROL_CONSOLE_COMMAND, + fBindings.Append( new plKeyBinding( B_CONTROL_CONSOLE_COMMAND, kControlFlagDownEvent | kControlFlagNoRepeat | kControlFlagNoDeactivate, plKeyCombo::kUnmapped, plKeyCombo::kUnmapped, command ) ); @@ -226,7 +226,7 @@ hsBool plKeyMap::AddConsoleCommand( const char *command ) plKeyBinding *plKeyMap::IFindBinding( ControlEventCode code ) const { - UInt32 i; + uint32_t i; for( i = 0; i < fBindings.GetCount(); i++ ) @@ -243,7 +243,7 @@ plKeyBinding *plKeyMap::IFindBinding( ControlEventCode code ) const plKeyBinding *plKeyMap::IFindBindingByKey( const plKeyCombo &combo ) const { - UInt32 i; + uint32_t i; for( i = 0; i < fBindings.GetCount(); i++ ) @@ -261,8 +261,8 @@ plKeyBinding *plKeyMap::IFindBindingByKey( const plKeyCombo &combo ) const // We guarantee that the first binding in the result array is that one with priority. void plKeyMap::IFindAllBindingsByKey(const plKeyCombo &combo, hsTArray &result) const { - UInt32 i; - UInt8 bestScore = 0; + uint32_t i; + uint8_t bestScore = 0; for (i = 0; i < fBindings.GetCount(); i++) { hsBool s1, s2; @@ -270,7 +270,7 @@ void plKeyMap::IFindAllBindingsByKey(const plKeyCombo &combo, hsTArrayGetKey2().IsSatisfiedBy(combo); if (s1 || s2) { - UInt8 myScore = 0; + uint8_t myScore = 0; if (s1) myScore = fBindings[i]->GetKey1().fFlags; if (s2 && (fBindings[i]->GetKey2().fFlags > myScore)) @@ -289,7 +289,7 @@ void plKeyMap::IFindAllBindingsByKey(const plKeyCombo &combo, hsTArrayClearKeys(); @@ -502,7 +502,7 @@ void plKeyMap::UnmapAllBindings( void ) void plKeyMap::EraseBinding( ControlEventCode code ) { - UInt32 i; + uint32_t i; for( i = 0; i < fBindings.GetCount(); i++ ) @@ -517,7 +517,7 @@ void plKeyMap::EraseBinding( ControlEventCode code ) } -const char* plKeyMap::ConvertVKeyToChar( UInt32 vk ) +const char* plKeyMap::ConvertVKeyToChar( uint32_t vk ) { Win32keyConvert* keyConvert = &fKeyConversionEnglish[0]; switch (plLocalization::GetLanguage()) diff --git a/Sources/Plasma/NucleusLib/pnInputCore/plInputMap.h b/Sources/Plasma/NucleusLib/pnInputCore/plInputMap.h index 5e966d5c..7a781c98 100644 --- a/Sources/Plasma/NucleusLib/pnInputCore/plInputMap.h +++ b/Sources/Plasma/NucleusLib/pnInputCore/plInputMap.h @@ -44,7 +44,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #ifndef PL_INPUT_MAP_H #define PL_INPUT_MAP_H -#include "hsTypes.h" +#include "HeadSpin.h" #include "plControlDefinition.h" #include "hsTemplates.h" diff --git a/Sources/Plasma/NucleusLib/pnInputCore/plKeyDef.h b/Sources/Plasma/NucleusLib/pnInputCore/plKeyDef.h index 2da22cf6..9c638277 100644 --- a/Sources/Plasma/NucleusLib/pnInputCore/plKeyDef.h +++ b/Sources/Plasma/NucleusLib/pnInputCore/plKeyDef.h @@ -42,12 +42,10 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #ifndef plKeyDef_inc #define plKeyDef_inc -#include "hsConfig.h" +#include "HeadSpin.h" #if HS_BUILD_FOR_WIN32 -#include - #define VK_BACK_QUOTE 0xc0 // MinGW is missing these definitions: #ifndef VK_OEM_PLUS diff --git a/Sources/Plasma/NucleusLib/pnInputCore/plKeyMap.h b/Sources/Plasma/NucleusLib/pnInputCore/plKeyMap.h index 9f948701..2588024b 100644 --- a/Sources/Plasma/NucleusLib/pnInputCore/plKeyMap.h +++ b/Sources/Plasma/NucleusLib/pnInputCore/plKeyMap.h @@ -50,7 +50,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #define _plKeyMap_h -#include "hsTypes.h" +#include "HeadSpin.h" #include "plInputMap.h" #include "plControlEventCodes.h" @@ -64,7 +64,7 @@ class plKeyCombo { public: plKeyDef fKey; - UInt8 fFlags; + uint8_t fFlags; // The ordering of this lets us treat the flags as a priority number. // kCtrl + kShift > kCtrl > kShift > no flags @@ -77,7 +77,7 @@ class plKeyCombo static plKeyCombo kUnmapped; plKeyCombo(); - plKeyCombo( plKeyDef k, UInt8 flags = 0 ) : fKey( k ), fFlags( flags ) { } + plKeyCombo( plKeyDef k, uint8_t flags = 0 ) : fKey( k ), fFlags( flags ) { } hsBool IsSatisfiedBy(const plKeyCombo &combo) const; @@ -114,7 +114,7 @@ class plKeyBinding protected: ControlEventCode fCode; - UInt32 fCodeFlags; // Needed? + uint32_t fCodeFlags; // Needed? plKeyCombo fKey1; // KEY_UNMAPPED for not-used plKeyCombo fKey2; char *fString; @@ -122,11 +122,11 @@ class plKeyBinding public: plKeyBinding(); - plKeyBinding( ControlEventCode code, UInt32 codeFlags, const plKeyCombo &key1, const plKeyCombo &key2, const char *string = nil ); + plKeyBinding( ControlEventCode code, uint32_t codeFlags, const plKeyCombo &key1, const plKeyCombo &key2, const char *string = nil ); virtual ~plKeyBinding(); ControlEventCode GetCode( void ) const { return fCode; } - UInt32 GetCodeFlags( void ) const { return fCodeFlags; } + uint32_t GetCodeFlags( void ) const { return fCodeFlags; } const plKeyCombo &GetKey1( void ) const { return fKey1; } const plKeyCombo &GetKey2( void ) const { return fKey2; } const char *GetExtendedString( void ) const { return fString; } @@ -172,7 +172,7 @@ class plKeyMap : public plInputMap virtual ~plKeyMap(); // Adds a given control code to the map. Once you add it, you can't change its flags. Returns false if the code is already present - hsBool AddCode( ControlEventCode code, UInt32 codeFlags ); + hsBool AddCode( ControlEventCode code, uint32_t codeFlags ); // Same but for console commands. No flags b/c console commands always use the same flags hsBool AddConsoleCommand( const char *command ); @@ -220,11 +220,11 @@ class plKeyMap : public plInputMap static const char* GetStringUnmapped(); - UInt32 GetNumBindings( void ) const { return fBindings.GetCount(); } - const plKeyBinding &GetBinding( UInt32 i ) const { return *fBindings[ i ]; } + uint32_t GetNumBindings( void ) const { return fBindings.GetCount(); } + const plKeyBinding &GetBinding( uint32_t i ) const { return *fBindings[ i ]; } void HandleAutoDualBinding( plKeyDef key1, plKeyDef key2 ); - static const char* ConvertVKeyToChar( UInt32 vk ); + static const char* ConvertVKeyToChar( uint32_t vk ); static plKeyDef ConvertCharToVKey( const char *c ); static Win32keyConvert fKeyConversionEnglish[]; diff --git a/Sources/Plasma/NucleusLib/pnInputCore/plOSMsg.h b/Sources/Plasma/NucleusLib/pnInputCore/plOSMsg.h index 11eda1f5..4bc992be 100644 --- a/Sources/Plasma/NucleusLib/pnInputCore/plOSMsg.h +++ b/Sources/Plasma/NucleusLib/pnInputCore/plOSMsg.h @@ -42,7 +42,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #ifndef plOSMsg_inc #define plOSMsg_inc -#include "hsWindows.h" + // // This enum wraps all of the OS messages @@ -95,7 +95,7 @@ struct plMouseState }; float fX; float fY; - UInt32 fButtonState; + uint32_t fButtonState; }; diff --git a/Sources/Plasma/NucleusLib/pnKeyedObject/plFixedKey.cpp b/Sources/Plasma/NucleusLib/pnKeyedObject/plFixedKey.cpp index 4866da6f..4443099b 100644 --- a/Sources/Plasma/NucleusLib/pnKeyedObject/plFixedKey.cpp +++ b/Sources/Plasma/NucleusLib/pnKeyedObject/plFixedKey.cpp @@ -45,8 +45,8 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // ////////////////////////////////////////////////////////////////////////////// -#include "hsTypes.h" -#include "hsUtils.h" +#include "HeadSpin.h" + #include "plUoid.h" #include @@ -63,7 +63,7 @@ struct plKeySeed plFixedKeyId feFixedKey; // NOTE: The following fields are broken out to make adding to the fixed key list easier. // However, what they really are, are just the fields of plUoid (including plLocation) - UInt16 fType; + uint16_t fType; plString fObj; hsBool Match( plKeySeed *p ) diff --git a/Sources/Plasma/NucleusLib/pnKeyedObject/plKey.cpp b/Sources/Plasma/NucleusLib/pnKeyedObject/plKey.cpp index 1c76df13..d9266005 100644 --- a/Sources/Plasma/NucleusLib/pnKeyedObject/plKey.cpp +++ b/Sources/Plasma/NucleusLib/pnKeyedObject/plKey.cpp @@ -47,12 +47,11 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // ////////////////////////////////////////////////////////////////////////////// -#include "hsTypes.h" +#include "HeadSpin.h" #include "plKey.h" #include "plUoid.h" #include #include "hsResMgr.h" -#include "hsTypes.h" #define TRACK_REFS 0 // MEMLEAKFISH @@ -64,7 +63,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com int mlfTrack = 1; static const char* keyNameToLookFor = "AgeSDLHook"; -static const UInt16 CLASS_TO_TRACK = CLASS_INDEX_SCOPED(plSceneObject); +static const uint16_t CLASS_TO_TRACK = CLASS_INDEX_SCOPED(plSceneObject); static const int kCloneID = 0; static const int kClonePlayerID = 0; static plKeyData* lastData = nil; @@ -73,7 +72,7 @@ static const int kLocSeq = -1; class keyDataFriend : public plKeyData { public: - UInt16 RefCount() const { return fRefCount; } + uint16_t RefCount() const { return fRefCount; } }; static int IsTracked(const plKeyData* keyData) @@ -89,7 +88,7 @@ static int IsTracked(const plKeyData* keyData) if( (kLocSeq < 0) ||(kLocSeq == keyData->GetUoid().GetLocation().GetSequenceNumber()) ) { - plConst(UInt16) kMinRefCount(0); + plConst(uint16_t) kMinRefCount(0); const keyDataFriend* kdf = (keyDataFriend*)keyData; if( kdf->RefCount() > kMinRefCount ) { diff --git a/Sources/Plasma/NucleusLib/pnKeyedObject/plKey.h b/Sources/Plasma/NucleusLib/pnKeyedObject/plKey.h index f740db09..23360925 100644 --- a/Sources/Plasma/NucleusLib/pnKeyedObject/plKey.h +++ b/Sources/Plasma/NucleusLib/pnKeyedObject/plKey.h @@ -42,7 +42,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #ifndef plKey_h_inc #define plKey_h_inc -#include "hsTypes.h" +#include "HeadSpin.h" #include "plRefFlags.h" class hsKeyedObject; @@ -118,9 +118,9 @@ public: //---------------------- virtual void Release(plKey targetKey)=0; - virtual UInt16 GetActiveRefs() const = 0; + virtual uint16_t GetActiveRefs() const = 0; - virtual UInt16 GetNumNotifyCreated() const = 0; + virtual uint16_t GetNumNotifyCreated() const = 0; virtual plRefMsg* GetNotifyCreated(int i) const = 0; virtual const hsBitVector& GetActiveBits() const = 0; @@ -152,7 +152,7 @@ protected: friend class plKey; // Refcount--the number of plKeys that have pointers to us. - UInt16 fRefCount; + uint16_t fRefCount; }; #endif // plKey_h_inc diff --git a/Sources/Plasma/NucleusLib/pnKeyedObject/plKeyImp.cpp b/Sources/Plasma/NucleusLib/pnKeyedObject/plKeyImp.cpp index 80bc6555..b0fb1193 100644 --- a/Sources/Plasma/NucleusLib/pnKeyedObject/plKeyImp.cpp +++ b/Sources/Plasma/NucleusLib/pnKeyedObject/plKeyImp.cpp @@ -43,7 +43,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "hsStream.h" #include "hsKeyedObject.h" #include "hsResMgr.h" -#include "hsTypes.h" +#include "HeadSpin.h" #include "pnMessage/plRefMsg.h" #include "pnMessage/plSelfDestructMsg.h" #include "hsTimer.h" @@ -52,9 +52,9 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com plProfile_CreateMemCounter("Keys", "Memory", KeyMem); -static UInt32 CalcKeySize(plKeyImp* key) +static uint32_t CalcKeySize(plKeyImp* key) { - UInt32 nameLen = 0; + uint32_t nameLen = 0; if (!key->GetUoid().GetObjectName().IsNull()) nameLen = key->GetUoid().GetObjectName().GetSize() + 1; return sizeof(plKeyImp) + nameLen; @@ -64,8 +64,8 @@ static UInt32 CalcKeySize(plKeyImp* key) #ifdef LOG_ACTIVE_REFS #include "plCreatableIndex.h" static const char* kObjName = "GUI_District_OptionsMenuGUI"; -static UInt16 kClassType = CLASS_INDEX_SCOPED(plSceneNode); -static UInt32 kCloneID = 0; +static uint16_t kClassType = CLASS_INDEX_SCOPED(plSceneNode); +static uint32_t kCloneID = 0; hsBool IsTrackedKey(const plKeyImp* key) { return hsStrEQ(key->GetName(), kObjName) && key->GetUoid().GetClassType() == kClassType && key->GetUoid().GetCloneID() == kCloneID; @@ -86,7 +86,7 @@ plKeyImp::plKeyImp() : #endif } -plKeyImp::plKeyImp(plUoid u, UInt32 pos,UInt32 len): +plKeyImp::plKeyImp(plUoid u, uint32_t pos,uint32_t len): fUoid(u), fObjectPtr(nil), fStartPos(pos), @@ -159,7 +159,7 @@ hsKeyedObject* plKeyImp::ObjectIsLoaded() const } // Copy the contents of p for cloning process -void plKeyImp::CopyForClone(const plKeyImp *p, UInt32 playerID, UInt32 cloneID) +void plKeyImp::CopyForClone(const plKeyImp *p, uint32_t playerID, uint32_t cloneID) { fObjectPtr = nil; // the clone object start as nil fUoid = p->GetUoid(); // we will set the UOID the same to start @@ -213,7 +213,7 @@ void plKeyImp::Write(hsStream* s) fUoid.Write(s); s->WriteLE(fStartPos); s->WriteLE(fDataLen); - if (fStartPos == (UInt32)-1) + if (fStartPos == (uint32_t)-1) int foo = 0; } @@ -226,8 +226,8 @@ void plKeyImp::WriteObject(hsStream* stream) if (ko == nil) { // Mark the key as not written - fStartPos = (UInt32)-1; - fDataLen = (UInt32)-1; + fStartPos = (uint32_t)-1; + fDataLen = (uint32_t)-1; return; } @@ -289,7 +289,7 @@ void plKeyImp::UnRefObject(plRefFlags::Type flags) ClearNotifyCreated(); plKey key=plKey::Make( this ); // for linux build - plSelfDestructMsg* nuke = TRACKED_NEW plSelfDestructMsg( key ); + plSelfDestructMsg* nuke = new plSelfDestructMsg( key ); plgDispatch::Dispatch()->MsgSend(nuke); } } @@ -405,7 +405,7 @@ void plKeyImp::RemoveClone(plKeyImp* key) const } } -plKey plKeyImp::GetClone(UInt32 playerID, UInt32 cloneID) const +plKey plKeyImp::GetClone(uint32_t playerID, uint32_t cloneID) const { for (int i = 0; i < fClones.GetCount(); i++) { @@ -419,12 +419,12 @@ plKey plKeyImp::GetClone(UInt32 playerID, UInt32 cloneID) const return plKey(); } -UInt32 plKeyImp::GetNumClones() +uint32_t plKeyImp::GetNumClones() { return fClones.GetCount(); } -plKey plKeyImp::GetCloneByIdx(UInt32 idx) +plKey plKeyImp::GetCloneByIdx(uint32_t idx) { if (idx < fClones.GetCount()) return plKey::Make(fClones[idx]); @@ -444,7 +444,7 @@ void plKeyImp::SatisfyPending() const if (!--fPendingRefs) { #ifdef PL_SEND_SATISFIED - plSatisfiedMsg* msg = TRACKED_NEW plSatisfiedMsg(this); + plSatisfiedMsg* msg = new plSatisfiedMsg(this); plgDispatch::MsgSend(msg); #endif // PL_SEND_SATISFIED } @@ -645,7 +645,7 @@ void plKeyImp::IRelease(plKeyImp* iTargetKey) iTargetKey->ClearNotifyCreated(); plKey key = plKey::Make(iTargetKey); - plSelfDestructMsg* nuke = TRACKED_NEW plSelfDestructMsg(key); + plSelfDestructMsg* nuke = new plSelfDestructMsg(key); plgDispatch::Dispatch()->MsgSend(nuke); } else diff --git a/Sources/Plasma/NucleusLib/pnKeyedObject/plKeyImp.h b/Sources/Plasma/NucleusLib/pnKeyedObject/plKeyImp.h index 222c80df..c0f89655 100644 --- a/Sources/Plasma/NucleusLib/pnKeyedObject/plKeyImp.h +++ b/Sources/Plasma/NucleusLib/pnKeyedObject/plKeyImp.h @@ -55,7 +55,7 @@ class plKeyImp : public plKeyData { public: plKeyImp(); - plKeyImp(plUoid, UInt32 pos,UInt32 len); + plKeyImp(plUoid, uint32_t pos,uint32_t len); virtual ~plKeyImp(); virtual const plUoid& GetUoid() const { return fUoid; } @@ -66,7 +66,7 @@ public: virtual hsKeyedObject* VerifyLoaded(); // called before writing to disk so that static keys can have faster lookups (int compare instead of string compare) - void SetObjectID(UInt32 id) {fUoid.SetObjectID(id);} + void SetObjectID(uint32_t id) {fUoid.SetObjectID(id);} //---------------------- // I/O @@ -78,8 +78,8 @@ public: // For when you need to skip over a key in a stream static void SkipRead(hsStream* s); - UInt32 GetStartPos() const { return fStartPos; } // for ResMgr to read the Objects - UInt32 GetDataLen() const { return fDataLen; } // for ResMgr to read the Objects + uint32_t GetStartPos() const { return fStartPos; } // for ResMgr to read the Objects + uint32_t GetDataLen() const { return fDataLen; } // for ResMgr to read the Objects //---------------------- // Allow a keyed object to behave as if it has an active ref when in fact the object @@ -112,35 +112,35 @@ public: //---------------------- void AddClone(plKeyImp* c); void RemoveClone(plKeyImp* c) const; - plKey GetClone(UInt32 playerID, UInt32 cloneID) const; - void CopyForClone(const plKeyImp* p, UInt32 playerID, UInt32 cloneID); // Copy the contents of p for cloning process + plKey GetClone(uint32_t playerID, uint32_t cloneID) const; + void CopyForClone(const plKeyImp* p, uint32_t playerID, uint32_t cloneID); // Copy the contents of p for cloning process - UInt32 GetNumClones(); - plKey GetCloneByIdx(UInt32 idx); + uint32_t GetNumClones(); + plKey GetCloneByIdx(uint32_t idx); plKey GetCloneOwner() { return fCloneOwner; } void NotifyCreated(); void ISetupNotify(plRefMsg* msg, plRefFlags::Type flags); // Setup notifcations for reference, don't send anything. void AddRef(plKeyImp* key) const; - UInt16 GetNumRefs() const { return fRefs.GetCount(); } + uint16_t GetNumRefs() const { return fRefs.GetCount(); } plKeyImp* GetRef(int i) const { return fRefs[i]; } void RemoveRef(plKeyImp *key) const; - virtual UInt16 GetActiveRefs() const { return fNumActiveRefs; } - virtual UInt16 GetNumNotifyCreated() const { return fNotifyCreated.GetCount(); } + virtual uint16_t GetActiveRefs() const { return fNumActiveRefs; } + virtual uint16_t GetNumNotifyCreated() const { return fNotifyCreated.GetCount(); } virtual plRefMsg* GetNotifyCreated(int i) const { return fNotifyCreated[i]; } virtual const hsBitVector& GetActiveBits() const { return fActiveRefs; } protected: void AddNotifyCreated(plRefMsg* msg, plRefFlags::Type flags); void ClearNotifyCreated(); - UInt16 GetNumNotifyCreated() { return fNotifyCreated.GetCount(); } + uint16_t GetNumNotifyCreated() { return fNotifyCreated.GetCount(); } plRefMsg* GetNotifyCreated(int i) { return fNotifyCreated[i]; } void RemoveNotifyCreated(int i); - UInt16 IncActiveRefs() { return ++fNumActiveRefs; } - UInt16 DecActiveRefs() { return fNumActiveRefs ? --fNumActiveRefs : 0; } + uint16_t IncActiveRefs() { return ++fNumActiveRefs; } + uint16_t DecActiveRefs() { return fNumActiveRefs ? --fNumActiveRefs : 0; } hsBool IsActiveRef(int i) const { return fActiveRefs.IsBitSet(i) != 0; } void SetActiveRef(int i, hsBool on=true) { fActiveRefs.SetBit(i, on); } @@ -160,16 +160,16 @@ protected: // These fields are the ones actually saved to disk plUoid fUoid; - UInt32 fStartPos; // where I live in the Datafile - UInt32 fDataLen; // Length in the Datafile + uint32_t fStartPos; // where I live in the Datafile + uint32_t fDataLen; // Length in the Datafile // Following used by hsResMgr to notify on defered load or when a passive ref is destroyed. - UInt16 fNumActiveRefs; // num active refs on me + uint16_t fNumActiveRefs; // num active refs on me hsBitVector fActiveRefs; // Which of notify created are active refs hsBitVector fNotified; // which of notifycreated i've already notified. hsTArray fNotifyCreated; // people to notify when I'm created or destroyed mutable hsTArray fRefs; // refs I've made (to be released when I'm unregistered). - mutable Int16 fPendingRefs; // Outstanding requests I have out. + mutable int16_t fPendingRefs; // Outstanding requests I have out. mutable hsTArray fClones; // clones of me mutable plKey fCloneOwner; // pointer for clones back to the owning key }; diff --git a/Sources/Plasma/NucleusLib/pnKeyedObject/plMsgForwarder.cpp b/Sources/Plasma/NucleusLib/pnKeyedObject/plMsgForwarder.cpp index b8d9a7ed..d1b46e00 100644 --- a/Sources/Plasma/NucleusLib/pnKeyedObject/plMsgForwarder.cpp +++ b/Sources/Plasma/NucleusLib/pnKeyedObject/plMsgForwarder.cpp @@ -41,7 +41,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ #include "plMsgForwarder.h" #include "hsResMgr.h" -#include "hsTypes.h" +#include "HeadSpin.h" #include "pnMessage/plMessage.h" #include "pnKeyedObject/plKey.h" #include "pnNetCommon/plNetApp.h" @@ -124,7 +124,7 @@ hsBool plMsgForwarder::IForwardCallbackMsg(plMessage *msg) hsAssert(event, "Message forwarder only supports event callback messages"); if (event) { - plForwardCallback *fc = TRACKED_NEW plForwardCallback; + plForwardCallback *fc = new plForwardCallback; fc->fNumCallbacks = fForwardKeys.Count(); // Turn off net propagate the callbacks to us will all be local. Only the diff --git a/Sources/Plasma/NucleusLib/pnKeyedObject/plUoid.cpp b/Sources/Plasma/NucleusLib/pnKeyedObject/plUoid.cpp index 555633d4..9d15390d 100644 --- a/Sources/Plasma/NucleusLib/pnKeyedObject/plUoid.cpp +++ b/Sources/Plasma/NucleusLib/pnKeyedObject/plUoid.cpp @@ -41,7 +41,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ #include "plUoid.h" #include "hsStream.h" -#include "hsUtils.h" + //// plLocation ////////////////////////////////////////////////////////////// @@ -82,7 +82,7 @@ hsBool plLocation::operator==(const plLocation& u) const return (fSequenceNumber == u.fSequenceNumber) && ((fFlags & ~kItinerant) == (u.fFlags & ~kItinerant)); } -void plLocation::Set(UInt32 seqNum) +void plLocation::Set(uint32_t seqNum) { fSequenceNumber = seqNum; } @@ -123,19 +123,19 @@ plString plLocation::StringIze() const // Format to displayable string return plString::Format("S0x%xF0x%x", fSequenceNumber, int(fFlags)); } -plLocation plLocation::MakeReserved(UInt32 number) +plLocation plLocation::MakeReserved(uint32_t number) { return plLocation(kReservedLocAvailableStart + number, kReserved); } -plLocation plLocation::MakeNormal(UInt32 number) +plLocation plLocation::MakeNormal(uint32_t number) { return plLocation(kNormalLocStartIdx + number); } //// plUoid ////////////////////////////////////////////////////////////////// -plUoid::plUoid(const plLocation& location, UInt16 classType, const plString& objectName, const plLoadMask& m) +plUoid::plUoid(const plLocation& location, uint16_t classType, const plString& objectName, const plLoadMask& m) { Invalidate(); @@ -162,7 +162,7 @@ void plUoid::Read(hsStream* s) hsAssert(fObjectName == nil, "Reading over an old uoid? You're just asking for trouble, aren't you?"); // first read contents flags - UInt8 contents = s->ReadByte(); + uint8_t contents = s->ReadByte(); fLocation.Read(s); @@ -181,7 +181,7 @@ void plUoid::Read(hsStream* s) if (contents & kHasCloneIDs) { s->LogReadLE( &fCloneID ,"CloneID"); - UInt16 dummy; + uint16_t dummy; s->LogReadLE(&dummy, "dummy"); // To avoid breaking format s->LogReadLE( &fClonePlayerID ,"ClonePlayerID"); } @@ -195,7 +195,7 @@ void plUoid::Read(hsStream* s) void plUoid::Write(hsStream* s) const { // first write contents byte - UInt8 contents = IsClone() ? kHasCloneIDs : 0; + uint8_t contents = IsClone() ? kHasCloneIDs : 0; if (fLoadMask.IsUsed()) contents |= kHasLoadMask; s->WriteByte(contents); @@ -214,7 +214,7 @@ void plUoid::Write(hsStream* s) const if (contents & kHasCloneIDs) { s->WriteLE(fCloneID); - UInt16 dummy = 0; + uint16_t dummy = 0; s->WriteLE(dummy); // to avoid breaking format s->WriteLE(fClonePlayerID); } diff --git a/Sources/Plasma/NucleusLib/pnKeyedObject/plUoid.h b/Sources/Plasma/NucleusLib/pnKeyedObject/plUoid.h index c5458f00..b8213a84 100644 --- a/Sources/Plasma/NucleusLib/pnKeyedObject/plUoid.h +++ b/Sources/Plasma/NucleusLib/pnKeyedObject/plUoid.h @@ -54,7 +54,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #ifndef plUoid_h_inc #define plUoid_h_inc -#include "hsTypes.h" +#include "HeadSpin.h" #include "plFixedKey.h" #include "plLoadMask.h" #include "plString.h" @@ -76,8 +76,8 @@ public: }; protected: - UInt32 fSequenceNumber; - UInt16 fFlags; + uint32_t fSequenceNumber; + uint16_t fFlags; enum { @@ -98,7 +98,7 @@ protected: kInvalidLocIdx = 0xffffffff }; - plLocation(UInt32 seqNum, UInt16 flags=0) : fFlags(flags) { Set(seqNum); } + plLocation(uint32_t seqNum, uint16_t flags=0) : fFlags(flags) { Set(seqNum); } public: plLocation() { Invalidate(); } @@ -109,12 +109,12 @@ public: hsBool IsValid() const; hsBool IsReserved() const; hsBool IsItinerant() const; - void Set(UInt32 seqNum); - UInt32 GetSequenceNumber() const { return fSequenceNumber; } + void Set(uint32_t seqNum); + uint32_t GetSequenceNumber() const { return fSequenceNumber; } hsBool IsVirtual() const; - void SetFlags(UInt16 flags) { fFlags |= flags; } - UInt16 GetFlags() const { return fFlags; } + void SetFlags(uint16_t flags) { fFlags |= flags; } + uint16_t GetFlags() const { return fFlags; } void Read(hsStream* s); void Write(hsStream* s) const; @@ -127,8 +127,8 @@ public: // THIS SHOULD BE FOR DEBUGGING ONLY plString StringIze() const; // Format to displayable string. - static plLocation MakeReserved(UInt32 number); - static plLocation MakeNormal(UInt32 number); + static plLocation MakeReserved(uint32_t number); + static plLocation MakeNormal(uint32_t number); static const plLocation kGlobalFixedLoc; static const plLocation kSceneViewerLoc; @@ -145,13 +145,13 @@ class plUoid { public: plUoid() { Invalidate(); } - plUoid(const plLocation& location, UInt16 classType, const plString& objectName, const plLoadMask& m=plLoadMask::kAlways); + plUoid(const plLocation& location, uint16_t classType, const plString& objectName, const plLoadMask& m=plLoadMask::kAlways); plUoid(plFixedKeyId fixedKey); plUoid(const plUoid& src); ~plUoid(); const plLocation& GetLocation() const { return fLocation; } - UInt16 GetClassType() const { return fClassType; } + uint16_t GetClassType() const { return fClassType; } const plString& GetObjectName() const { return fObjectName; } const plLoadMask& GetLoadMask() const { return fLoadMask; } @@ -166,13 +166,13 @@ public: hsBool operator!=(const plUoid& u) const { return !operator==(u); } hsBool IsClone() const { return fCloneID != 0; } - UInt32 GetClonePlayerID() const { return fClonePlayerID; } - UInt32 GetCloneID() const { return fCloneID; } - void SetClone(UInt32 playerID, UInt32 cloneID) { hsAssert(cloneID < 0xffff, "Clone id too high"); fCloneID = UInt16(cloneID); fClonePlayerID = playerID; } + uint32_t GetClonePlayerID() const { return fClonePlayerID; } + uint32_t GetCloneID() const { return fCloneID; } + void SetClone(uint32_t playerID, uint32_t cloneID) { hsAssert(cloneID < 0xffff, "Clone id too high"); fCloneID = uint16_t(cloneID); fClonePlayerID = playerID; } - UInt32 GetObjectID() const { return fObjectID; } + uint32_t GetObjectID() const { return fObjectID; } // Export time only. Only plRegistryKeyList should call this. - void SetObjectID(UInt32 id) { fObjectID = id; } + void SetObjectID(uint32_t id) { fObjectID = id; } // THIS SHOULD BE FOR DEBUGGING ONLY plString StringIze() const; // Format to displayable string @@ -184,10 +184,10 @@ protected: kHasLoadMask = 0x2, }; - UInt32 fObjectID; - UInt32 fClonePlayerID; // The ID of the player who made this clone - UInt16 fCloneID; // The ID of this clone (unique per client) - UInt16 fClassType; + uint32_t fObjectID; + uint32_t fClonePlayerID; // The ID of the player who made this clone + uint16_t fCloneID; // The ID of this clone (unique per client) + uint16_t fClassType; plString fObjectName; plLocation fLocation; plLoadMask fLoadMask; diff --git a/Sources/Plasma/NucleusLib/pnMail/pnMail.cpp b/Sources/Plasma/NucleusLib/pnMail/pnMail.cpp index 4ef27498..30a36f4a 100644 --- a/Sources/Plasma/NucleusLib/pnMail/pnMail.cpp +++ b/Sources/Plasma/NucleusLib/pnMail/pnMail.cpp @@ -212,10 +212,12 @@ static bool AdvanceStep ( ++start; const char * term = StrChr(start, ';'); if (term) { - char * buffer = ALLOCA(char, term + 1 - start); + char * buffer = (char*)malloc(term + 1 - start); StrCopy(buffer, start, term + 1 - start); Send(sock, "rcpt to:<", buffer, ">\r\n", nil); transaction->subStep = term + 1 - transaction->recipient; + + free(buffer); } else { Send(sock, "rcpt to:<", start, ">\r\n", nil); @@ -353,13 +355,13 @@ static void DestroyTransaction (MailTransaction * transaction) { ); } - DEL(transaction); + delete transaction; } //=========================================================================== static void MailLookupProc ( void * param, - const wchar * , + const wchar_t * , unsigned addrCount, const NetAddress addrs[] ) { @@ -445,12 +447,7 @@ static void __cdecl Send ( } // Allocate string buffer - char * packed; - const unsigned kStackBufSize = 8 * 1024; - if (bytes > kStackBufSize) - packed = (char *) ALLOC(bytes); - else - packed = (char *) _alloca(bytes); + char* packed = (char *) malloc(bytes); // Pack the string { @@ -466,8 +463,7 @@ static void __cdecl Send ( AsyncSocketSend(sock, packed, bytes - 1); // Free the string - if (bytes > kStackBufSize) - FREE(packed); + free(packed); } //=========================================================================== @@ -518,7 +514,7 @@ static void IMail ( // Create a transaction record MailTransaction * transaction = new( - ALLOC(offsetof(MailTransaction, buffer) + bytes) + malloc(offsetof(MailTransaction, buffer) + bytes) ) MailTransaction; transaction->stepTable = stepTable; transaction->sock = nil; @@ -554,7 +550,7 @@ static void IMail ( // Start the transaction with a dns lookup const unsigned kSmtpPort = 25; - wchar smtpName[256]; + wchar_t smtpName[256]; StrToUnicode(smtpName, smtp, arrsize(smtpName)); // Add transaction to global list @@ -619,7 +615,7 @@ void MailEncodePassword ( // Encode data and move it back to the front of the array dstChars = Base64Encode( srcChars, - (const byte *) emailAuth->Ptr(), + (const uint8_t *) emailAuth->Ptr(), dstChars, dstData ); @@ -716,7 +712,7 @@ bool MailQueued () { } //============================================================================ -const wchar * MailErrorToString (EMailError error) { +const wchar_t * MailErrorToString (EMailError error) { switch (error) { case kMailSuccess: return L"kMailSuccess"; diff --git a/Sources/Plasma/NucleusLib/pnMail/pnMail.h b/Sources/Plasma/NucleusLib/pnMail/pnMail.h index df7ece6c..278d1dd4 100644 --- a/Sources/Plasma/NucleusLib/pnMail/pnMail.h +++ b/Sources/Plasma/NucleusLib/pnMail/pnMail.h @@ -77,7 +77,7 @@ typedef void (* FMailResult)(void * param, EMailError result); void MailStop (); bool MailQueued (); -const wchar * MailErrorToString (EMailError error); +const wchar_t * MailErrorToString (EMailError error); //============================================================================ diff --git a/Sources/Plasma/NucleusLib/pnMessage/plAttachMsg.h b/Sources/Plasma/NucleusLib/pnMessage/plAttachMsg.h index f9b93c75..0f52b443 100644 --- a/Sources/Plasma/NucleusLib/pnMessage/plAttachMsg.h +++ b/Sources/Plasma/NucleusLib/pnMessage/plAttachMsg.h @@ -56,7 +56,7 @@ public: // flags should be either: // plRefMsg::kOnRequest - I'm adding this child to the receiver // plRefMsg::kOnRemove - I'm detaching this child from the receiver - plAttachMsg(const plKey &rcv, hsKeyedObject* child, UInt8 context, const plKey snd=nil) : plRefMsg(rcv, context) { SetSender(snd); SetRef(child); } + plAttachMsg(const plKey &rcv, hsKeyedObject* child, uint8_t context, const plKey snd=nil) : plRefMsg(rcv, context) { SetSender(snd); SetRef(child); } CLASSNAME_REGISTER( plAttachMsg ); GETINTERFACE_ANY( plAttachMsg, plRefMsg ); diff --git a/Sources/Plasma/NucleusLib/pnMessage/plCameraMsg.cpp b/Sources/Plasma/NucleusLib/pnMessage/plCameraMsg.cpp index 5d091bd6..eb96635e 100644 --- a/Sources/Plasma/NucleusLib/pnMessage/plCameraMsg.cpp +++ b/Sources/Plasma/NucleusLib/pnMessage/plCameraMsg.cpp @@ -40,7 +40,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "plCameraMsg.h" #include "hsStream.h" #include "hsResMgr.h" diff --git a/Sources/Plasma/NucleusLib/pnMessage/plCameraMsg.h b/Sources/Plasma/NucleusLib/pnMessage/plCameraMsg.h index c62a4d9a..6b05d010 100644 --- a/Sources/Plasma/NucleusLib/pnMessage/plCameraMsg.h +++ b/Sources/Plasma/NucleusLib/pnMessage/plCameraMsg.h @@ -82,13 +82,13 @@ public: int fType; hsPoint3 fOffset; - hsScalar fAccel; - hsScalar fDecel; - hsScalar fVel; - hsScalar fFPAccel; - hsScalar fFPDecel; - hsScalar fFPVel; - hsScalar fFOVw, fFOVh; + float fAccel; + float fDecel; + float fVel; + float fFPAccel; + float fFPDecel; + float fFPVel; + float fFOVw, fFOVh; hsBool fWorldspace; void Read(hsStream* stream); diff --git a/Sources/Plasma/NucleusLib/pnMessage/plClientMsg.cpp b/Sources/Plasma/NucleusLib/pnMessage/plClientMsg.cpp index 0560c3e8..bf5ba078 100644 --- a/Sources/Plasma/NucleusLib/pnMessage/plClientMsg.cpp +++ b/Sources/Plasma/NucleusLib/pnMessage/plClientMsg.cpp @@ -40,7 +40,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ #include "plClientMsg.h" -#include "hsTypes.h" +#include "HeadSpin.h" void plClientMsg::IReset() { diff --git a/Sources/Plasma/NucleusLib/pnMessage/plClientMsg.h b/Sources/Plasma/NucleusLib/pnMessage/plClientMsg.h index c0acc4ac..b4932694 100644 --- a/Sources/Plasma/NucleusLib/pnMessage/plClientMsg.h +++ b/Sources/Plasma/NucleusLib/pnMessage/plClientMsg.h @@ -46,7 +46,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "pnMessage/plRefMsg.h" #include "hsStream.h" #include "hsResMgr.h" -#include "hsUtils.h" + #include "hsStlUtils.h" #include "pnKeyedObject/plUoid.h" @@ -139,15 +139,15 @@ public: plClientRefMsg(): fType(-1), fWhich(-1) {}; - plClientRefMsg(const plKey &r, UInt8 refMsgFlags, Int8 which , Int8 type) + plClientRefMsg(const plKey &r, uint8_t refMsgFlags, int8_t which , int8_t type) : plRefMsg(r, refMsgFlags), fType(type), fWhich(which) {} CLASSNAME_REGISTER( plClientRefMsg ); GETINTERFACE_ANY( plClientRefMsg, plRefMsg ); - Int8 fType; - Int8 fWhich; + int8_t fType; + int8_t fWhich; // IO - not really applicable to ref msgs, but anyway void Read(hsStream* stream, hsResMgr* mgr) diff --git a/Sources/Plasma/NucleusLib/pnMessage/plCmdIfaceModMsg.h b/Sources/Plasma/NucleusLib/pnMessage/plCmdIfaceModMsg.h index fd880efd..a422c2ea 100644 --- a/Sources/Plasma/NucleusLib/pnMessage/plCmdIfaceModMsg.h +++ b/Sources/Plasma/NucleusLib/pnMessage/plCmdIfaceModMsg.h @@ -80,7 +80,7 @@ public: hsBitVector fCmd; plControlConfig* fInterface; - UInt32 fControlCode; + uint32_t fControlCode; int fIndex; hsBool Cmd(int n) { return fCmd.IsBitSet(n); } diff --git a/Sources/Plasma/NucleusLib/pnMessage/plDISpansMsg.h b/Sources/Plasma/NucleusLib/pnMessage/plDISpansMsg.h index 9bd02f9e..0e1ad094 100644 --- a/Sources/Plasma/NucleusLib/pnMessage/plDISpansMsg.h +++ b/Sources/Plasma/NucleusLib/pnMessage/plDISpansMsg.h @@ -54,17 +54,17 @@ public: kAddingSpan, kRemovingSpan }; - UInt8 fType; + uint8_t fType; enum { kLeaveEmptyDrawable = 0x1 }; - UInt8 fFlags; + uint8_t fFlags; - Int32 fIndex; + int32_t fIndex; plDISpansMsg() : plMessage(), fType(0), fFlags(0), fIndex(-1) {} - plDISpansMsg(const plKey &r, UInt8 type, int index, int flags) : plMessage(nil, r, nil), fType(type), fIndex(index), fFlags(flags) {} + plDISpansMsg(const plKey &r, uint8_t type, int index, int flags) : plMessage(nil, r, nil), fType(type), fIndex(index), fFlags(flags) {} CLASSNAME_REGISTER( plDISpansMsg ); GETINTERFACE_ANY( plDISpansMsg, plMessage ); diff --git a/Sources/Plasma/NucleusLib/pnMessage/plEnableMsg.h b/Sources/Plasma/NucleusLib/pnMessage/plEnableMsg.h index 798d2ba7..f9a7a7f0 100644 --- a/Sources/Plasma/NucleusLib/pnMessage/plEnableMsg.h +++ b/Sources/Plasma/NucleusLib/pnMessage/plEnableMsg.h @@ -70,9 +70,9 @@ public: void SetCmd(int n) { fCmd.SetBit(n); } void ClearCmd() { fCmd.Clear(); } - void AddType(UInt16 t) { fTypes.SetBit(t); } - void RemoveType(UInt16 t) { fTypes.ClearBit(t); } - hsBool Type(UInt16 t) const { return fTypes.IsBitSet(t); } + void AddType(uint16_t t) { fTypes.SetBit(t); } + void RemoveType(uint16_t t) { fTypes.ClearBit(t); } + hsBool Type(uint16_t t) const { return fTypes.IsBitSet(t); } const hsBitVector& Types() const { return fTypes; } plEnableMsg() { } diff --git a/Sources/Plasma/NucleusLib/pnMessage/plEventCallbackMsg.h b/Sources/Plasma/NucleusLib/pnMessage/plEventCallbackMsg.h index dd937e92..56b862cc 100644 --- a/Sources/Plasma/NucleusLib/pnMessage/plEventCallbackMsg.h +++ b/Sources/Plasma/NucleusLib/pnMessage/plEventCallbackMsg.h @@ -65,12 +65,12 @@ class plEventCallbackMsg : public plMessage protected: public: - hsScalar fEventTime; // the time for time events + float fEventTime; // the time for time events CallbackEvent fEvent; // the event - Int16 fIndex; // the index of the object we want the event to come from + int16_t fIndex; // the index of the object we want the event to come from // (where applicable, required for sounds) - Int16 fRepeats; // -1 for infinite repeats, 0 for one call, no repeats - Int16 fUser; // User defined data, useful for keeping track of multiple callbacks + int16_t fRepeats; // -1 for infinite repeats, 0 for one call, no repeats + int16_t fUser; // User defined data, useful for keeping track of multiple callbacks plEventCallbackMsg() : fEventTime(0.0f), fEvent((CallbackEvent)0), fRepeats(-1), fUser(0), fIndex(0) {;} plEventCallbackMsg (const plKey &s, @@ -79,7 +79,7 @@ public: plMessage(s, r, t), fEventTime(0.0f), fEvent((CallbackEvent)0), fRepeats(-1), fUser(0), fIndex(0) {;} - plEventCallbackMsg(const plKey &receiver, CallbackEvent e, int idx=0, hsScalar t=0, Int16 repeats=-1, UInt16 user=0) : + plEventCallbackMsg(const plKey &receiver, CallbackEvent e, int idx=0, float t=0, int16_t repeats=-1, uint16_t user=0) : plMessage(nil, receiver, nil), fEvent(e), fIndex(idx), fEventTime(t), fRepeats(repeats), fUser(user) {} ~plEventCallbackMsg(){;} @@ -101,7 +101,7 @@ public: { plMessage::IMsgWrite(stream, mgr); stream->WriteLEFloat(fEventTime); - stream->WriteLE16((Int16)fEvent); + stream->WriteLE16((int16_t)fEvent); stream->WriteLE16(fIndex); stream->WriteLE16(fRepeats); stream->WriteLE16(fUser); diff --git a/Sources/Plasma/NucleusLib/pnMessage/plIntRefMsg.h b/Sources/Plasma/NucleusLib/pnMessage/plIntRefMsg.h index 3b43fce9..c21ba442 100644 --- a/Sources/Plasma/NucleusLib/pnMessage/plIntRefMsg.h +++ b/Sources/Plasma/NucleusLib/pnMessage/plIntRefMsg.h @@ -65,14 +65,14 @@ public: }; plIntRefMsg() : fType(-1), fWhich(-1), fIdx(-1) {} - plIntRefMsg(const plKey &r, UInt8 flags, Int32 which, Int8 type, Int8 idx=-1) : plRefMsg(r, flags), fWhich((Int16)which), fType(type), fIdx(idx) {} + plIntRefMsg(const plKey &r, uint8_t flags, int32_t which, int8_t type, int8_t idx=-1) : plRefMsg(r, flags), fWhich((int16_t)which), fType(type), fIdx(idx) {} CLASSNAME_REGISTER( plIntRefMsg ); GETINTERFACE_ANY( plIntRefMsg, plRefMsg ); - Int8 fType; - Int8 fIdx; - Int16 fWhich; + int8_t fType; + int8_t fIdx; + int16_t fWhich; // IO - not really applicable to ref msgs, but anyway void Read(hsStream* stream, hsResMgr* mgr) diff --git a/Sources/Plasma/NucleusLib/pnMessage/plMessage.cpp b/Sources/Plasma/NucleusLib/pnMessage/plMessage.cpp index 2eef2b1c..daa1395e 100644 --- a/Sources/Plasma/NucleusLib/pnMessage/plMessage.cpp +++ b/Sources/Plasma/NucleusLib/pnMessage/plMessage.cpp @@ -40,7 +40,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #define PLMESSAGE_PRIVATE #include "plMessage.h" #include "hsStream.h" @@ -84,7 +84,7 @@ plMessage::~plMessage() } plMessage& plMessage::SetNumReceivers(int n) { fReceivers.SetCount(n); return *this; } -UInt32 plMessage::GetNumReceivers() const { return fReceivers.GetCount(); } +uint32_t plMessage::GetNumReceivers() const { return fReceivers.GetCount(); } const plKey& plMessage::GetReceiver(int i) const { return fReceivers[i]; } plMessage& plMessage::RemoveReceiver(int i) { fReceivers.Remove(i); return *this; } @@ -200,24 +200,24 @@ void plMessage::IMsgWriteVersion(hsStream* s, hsResMgr* mgr) s->WriteLE32(fBCastFlags); } -void plMessage::AddNetReceiver( UInt32 plrID ) +void plMessage::AddNetReceiver( uint32_t plrID ) { if ( !fNetRcvrPlayerIDs ) - fNetRcvrPlayerIDs = TRACKED_NEW std::vector; + fNetRcvrPlayerIDs = new std::vector; fNetRcvrPlayerIDs->push_back( plrID ); } -void plMessage::AddNetReceivers( const std::vector & plrIDs ) +void plMessage::AddNetReceivers( const std::vector & plrIDs ) { if ( !fNetRcvrPlayerIDs ) - fNetRcvrPlayerIDs = TRACKED_NEW std::vector; + fNetRcvrPlayerIDs = new std::vector; std::copy( plrIDs.begin(), plrIDs.end(), std::back_inserter( *fNetRcvrPlayerIDs ) ); } ///////////////////////////////////////////////////////////////// // STATIC -int plMsgStdStringHelper::Poke(const std::string & stringref, hsStream* stream, const UInt32 peekOptions) +int plMsgStdStringHelper::Poke(const std::string & stringref, hsStream* stream, const uint32_t peekOptions) { plMessage::plStrLen strlen; hsAssert( stringref.length()<0xFFFF, "buf too big for plMsgStdStringHelper" ); @@ -228,16 +228,16 @@ int plMsgStdStringHelper::Poke(const std::string & stringref, hsStream* stream, return stream->GetPosition(); } -int plMsgStdStringHelper::PokeBig(const std::string & stringref, hsStream* stream, const UInt32 peekOptions) +int plMsgStdStringHelper::PokeBig(const std::string & stringref, hsStream* stream, const uint32_t peekOptions) { - UInt32 strlen = stringref.length(); + uint32_t strlen = stringref.length(); stream->WriteLE(strlen); if (strlen) stream->Write(strlen,stringref.data()); return stream->GetPosition(); } -int plMsgStdStringHelper::Poke(const char * buf, UInt32 bufsz, hsStream* stream, const UInt32 peekOptions) +int plMsgStdStringHelper::Poke(const char * buf, uint32_t bufsz, hsStream* stream, const uint32_t peekOptions) { plMessage::plStrLen strlen; hsAssert( bufsz<0xFFFF, "buf too big for plMsgStdStringHelper" ); @@ -248,7 +248,7 @@ int plMsgStdStringHelper::Poke(const char * buf, UInt32 bufsz, hsStream* stream, return stream->GetPosition(); } -int plMsgStdStringHelper::PokeBig(const char * buf, UInt32 bufsz, hsStream* stream, const UInt32 peekOptions) +int plMsgStdStringHelper::PokeBig(const char * buf, uint32_t bufsz, hsStream* stream, const uint32_t peekOptions) { stream->WriteLE(bufsz); if (bufsz) @@ -269,7 +269,7 @@ int plMsgStdStringHelper::PokeBig(const plString & stringref, hsStream* stream, } // STATIC -int plMsgStdStringHelper::Peek(std::string & stringref, hsStream* stream, const UInt32 peekOptions) +int plMsgStdStringHelper::Peek(std::string & stringref, hsStream* stream, const uint32_t peekOptions) { plMessage::plStrLen strlen; stream->LogSubStreamStart("push this"); @@ -291,9 +291,9 @@ int plMsgStdStringHelper::Peek(std::string & stringref, hsStream* stream, const return stream->GetPosition(); } -int plMsgStdStringHelper::PeekBig(std::string & stringref, hsStream* stream, const UInt32 peekOptions) +int plMsgStdStringHelper::PeekBig(std::string & stringref, hsStream* stream, const uint32_t peekOptions) { - UInt32 bufsz; + uint32_t bufsz; stream->LogSubStreamStart("push this"); stream->LogReadLE(&bufsz,"Bufsz"); stringref.erase(); @@ -332,7 +332,7 @@ int plMsgStdStringHelper::PeekBig(plString & stringref, hsStream* stream, const ///////////////////////////////////////////////////////////////// // STATIC -int plMsgXtlStringHelper::Poke(const xtl::istring & stringref, hsStream* stream, const UInt32 peekOptions) +int plMsgXtlStringHelper::Poke(const xtl::istring & stringref, hsStream* stream, const uint32_t peekOptions) { plMessage::plStrLen strlen; strlen = stringref.length(); @@ -343,7 +343,7 @@ int plMsgXtlStringHelper::Poke(const xtl::istring & stringref, hsStream* stream, } // STATIC -int plMsgXtlStringHelper::Peek(xtl::istring & stringref, hsStream* stream, const UInt32 peekOptions) +int plMsgXtlStringHelper::Peek(xtl::istring & stringref, hsStream* stream, const uint32_t peekOptions) { plMessage::plStrLen strlen; stream->LogSubStreamStart("push me"); @@ -365,7 +365,7 @@ int plMsgXtlStringHelper::Peek(xtl::istring & stringref, hsStream* stream, const ///////////////////////////////////////////////////////////////// // STATIC -int plMsgCStringHelper::Poke(const char * str, hsStream* stream, const UInt32 peekOptions) +int plMsgCStringHelper::Poke(const char * str, hsStream* stream, const uint32_t peekOptions) { plMessage::plStrLen strlen; strlen = (str)?hsStrlen(str):0; @@ -376,7 +376,7 @@ int plMsgCStringHelper::Poke(const char * str, hsStream* stream, const UInt32 pe } // STATIC -int plMsgCStringHelper::Peek(char *& str, hsStream* stream, const UInt32 peekOptions) +int plMsgCStringHelper::Peek(char *& str, hsStream* stream, const uint32_t peekOptions) { plMessage::plStrLen strlen; stream->LogSubStreamStart("push me"); @@ -387,7 +387,7 @@ int plMsgCStringHelper::Peek(char *& str, hsStream* stream, const UInt32 peekOpt { if (strlen) { - str = TRACKED_NEW char[strlen+1]; + str = new char[strlen+1]; str[strlen] = '\0'; if (strlen) { stream->LogRead(strlen,str,"CString"); @@ -417,14 +417,14 @@ int plMsgCStringHelper::Peek(plString & str, hsStream* stream, const UInt32 peek ///////////////////////////////////////////////////////////////// // STATIC -int plMsgCArrayHelper::Poke(const void * buf, UInt32 bufsz, hsStream* stream, const UInt32 peekOptions) +int plMsgCArrayHelper::Poke(const void * buf, uint32_t bufsz, hsStream* stream, const uint32_t peekOptions) { stream->Write(bufsz,buf); return stream->GetPosition(); } // STATIC -int plMsgCArrayHelper::Peek(void * buf, UInt32 bufsz, hsStream* stream, const UInt32 peekOptions) +int plMsgCArrayHelper::Peek(void * buf, uint32_t bufsz, hsStream* stream, const uint32_t peekOptions) { stream->LogSubStreamStart("push me"); stream->LogRead(bufsz,buf,"CArray"); diff --git a/Sources/Plasma/NucleusLib/pnMessage/plMessage.h b/Sources/Plasma/NucleusLib/pnMessage/plMessage.h index 0c602acb..a7e16290 100644 --- a/Sources/Plasma/NucleusLib/pnMessage/plMessage.h +++ b/Sources/Plasma/NucleusLib/pnMessage/plMessage.h @@ -57,7 +57,7 @@ class plString; class plMessage : public plCreatable { public: - typedef UInt16 plStrLen; + typedef uint16_t plStrLen; enum plBCastFlags { kBCastNone = 0x0, @@ -94,8 +94,8 @@ protected: hsTArray fReceivers; double fTimeStamp; - UInt32 fBCastFlags; - std::vector* fNetRcvrPlayerIDs; + uint32_t fBCastFlags; + std::vector* fNetRcvrPlayerIDs; void IMsgRead(hsStream* stream, hsResMgr* mgr); // default read implementation void IMsgWrite(hsStream* stream, hsResMgr* mgr); // default write implementation @@ -124,7 +124,7 @@ public: plMessage& SetSender(const plKey &s) { fSender = s; return *this; } plMessage& SetNumReceivers(int n); - UInt32 GetNumReceivers() const ; + uint32_t GetNumReceivers() const ; const plKey& GetReceiver(int i) const; plMessage& RemoveReceiver(int i); @@ -138,15 +138,15 @@ public: const double GetTimeStamp() const { return fTimeStamp; } plMessage& SetTimeStamp(double t) { fTimeStamp = t; return *this; } - hsBool HasBCastFlag(UInt32 f) const { return 0 != (fBCastFlags & f); } - plMessage& SetBCastFlag(UInt32 f, hsBool on=true) { if( on )fBCastFlags |= f; else fBCastFlags &= ~f; return *this; } + hsBool HasBCastFlag(uint32_t f) const { return 0 != (fBCastFlags & f); } + plMessage& SetBCastFlag(uint32_t f, hsBool on=true) { if( on )fBCastFlags |= f; else fBCastFlags &= ~f; return *this; } - void SetAllBCastFlags(UInt32 f) { fBCastFlags=f; } - UInt32 GetAllBCastFlags() const { return fBCastFlags; } + void SetAllBCastFlags(uint32_t f) { fBCastFlags=f; } + uint32_t GetAllBCastFlags() const { return fBCastFlags; } - void AddNetReceiver( UInt32 plrID ); - void AddNetReceivers( const std::vector & plrIDs ); - std::vector* GetNetReceivers() const { return fNetRcvrPlayerIDs; } + void AddNetReceiver( uint32_t plrID ); + void AddNetReceivers( const std::vector & plrIDs ); + std::vector* GetNetReceivers() const { return fNetRcvrPlayerIDs; } // just before dispatching this message, drop into debugger void SetBreakBeforeDispatch (bool on) { dispatchBreak = on; } @@ -168,16 +168,16 @@ public: struct plMsgStdStringHelper { - static int Poke(const std::string & stringref, hsStream* stream, const UInt32 peekOptions=0); - static int PokeBig(const std::string & stringref, hsStream* stream, const UInt32 peekOptions=0); - static int Poke(const char * buf, UInt32 bufsz, hsStream* stream, const UInt32 peekOptions=0); - static int PokeBig(const char * buf, UInt32 bufsz, hsStream* stream, const UInt32 peekOptions=0); - static int Poke(const plString & stringref, hsStream* stream, const UInt32 peekOptions=0); - static int PokeBig(const plString & stringref, hsStream* stream, const UInt32 peekOptions=0); - static int Peek(std::string & stringref, hsStream* stream, const UInt32 peekOptions=0); - static int PeekBig(std::string & stringref, hsStream* stream, const UInt32 peekOptions=0); - static int Peek(plString & stringref, hsStream* stream, const UInt32 peekOptions=0); - static int PeekBig(plString & stringref, hsStream* stream, const UInt32 peekOptions=0); + static int Poke(const std::string & stringref, hsStream* stream, const uint32_t peekOptions=0); + static int PokeBig(const std::string & stringref, hsStream* stream, const uint32_t peekOptions=0); + static int Poke(const char * buf, uint32_t bufsz, hsStream* stream, const uint32_t peekOptions=0); + static int PokeBig(const char * buf, uint32_t bufsz, hsStream* stream, const uint32_t peekOptions=0); + static int Poke(const plString & stringref, hsStream* stream, const uint32_t peekOptions=0); + static int PokeBig(const plString & stringref, hsStream* stream, const uint32_t peekOptions=0); + static int Peek(std::string & stringref, hsStream* stream, const uint32_t peekOptions=0); + static int PeekBig(std::string & stringref, hsStream* stream, const uint32_t peekOptions=0); + static int Peek(plString & stringref, hsStream* stream, const uint32_t peekOptions=0); + static int PeekBig(plString & stringref, hsStream* stream, const uint32_t peekOptions=0); }; ///////////////////////////////////////////////////////////////// @@ -185,8 +185,8 @@ struct plMsgStdStringHelper struct plMsgXtlStringHelper { - static int Poke(const xtl::istring & stringref, hsStream* stream, const UInt32 peekOptions=0); - static int Peek(xtl::istring & stringref, hsStream* stream, const UInt32 peekOptions=0); + static int Poke(const xtl::istring & stringref, hsStream* stream, const uint32_t peekOptions=0); + static int Peek(xtl::istring & stringref, hsStream* stream, const uint32_t peekOptions=0); }; ///////////////////////////////////////////////////////////////// @@ -194,23 +194,23 @@ struct plMsgXtlStringHelper struct plMsgCStringHelper { - static int Poke(const char * str, hsStream* stream, const UInt32 peekOptions=0); + static int Poke(const char * str, hsStream* stream, const uint32_t peekOptions=0); // deletes str and reallocates. you must delete [] str; - static int Peek(char *& str, hsStream* stream, const UInt32 peekOptions=0); + static int Peek(char *& str, hsStream* stream, const uint32_t peekOptions=0); - static int Poke(const plString & str, hsStream* stream, const UInt32 peekOptions=0); - static int Peek(plString & str, hsStream* stream, const UInt32 peekOptions=0); + static int Poke(const plString & str, hsStream* stream, const uint32_t peekOptions=0); + static int Peek(plString & str, hsStream* stream, const uint32_t peekOptions=0); }; ///////////////////////////////////////////////////////////////// // reads/writes your type [] field -// don't use with byte ordered types like Int16,32. -// fine for Int8, char, and IEEE formatted types like float, double. +// don't use with uint8_t ordered types like int16_t,32. +// fine for int8_t, char, and IEEE formatted types like float, double. struct plMsgCArrayHelper { - static int Poke(const void * buf, UInt32 bufsz, hsStream* stream, const UInt32 peekOptions=0); - static int Peek(void * buf, UInt32 bufsz, hsStream* stream, const UInt32 peekOptions=0); + static int Poke(const void * buf, uint32_t bufsz, hsStream* stream, const uint32_t peekOptions=0); + static int Peek(void * buf, uint32_t bufsz, hsStream* stream, const uint32_t peekOptions=0); }; diff --git a/Sources/Plasma/NucleusLib/pnMessage/plNodeChangeMsg.cpp b/Sources/Plasma/NucleusLib/pnMessage/plNodeChangeMsg.cpp index bc8e0edd..4789b8ac 100644 --- a/Sources/Plasma/NucleusLib/pnMessage/plNodeChangeMsg.cpp +++ b/Sources/Plasma/NucleusLib/pnMessage/plNodeChangeMsg.cpp @@ -40,7 +40,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "plNodeChangeMsg.h" #include "hsStream.h" #include "hsResMgr.h" diff --git a/Sources/Plasma/NucleusLib/pnMessage/plNodeRefMsg.h b/Sources/Plasma/NucleusLib/pnMessage/plNodeRefMsg.h index b2dd50c6..89864ed0 100644 --- a/Sources/Plasma/NucleusLib/pnMessage/plNodeRefMsg.h +++ b/Sources/Plasma/NucleusLib/pnMessage/plNodeRefMsg.h @@ -60,7 +60,7 @@ public: }; plNodeRefMsg() {} - plNodeRefMsg(const plKey &r, UInt8 flags, Int8 which, Int8 type) : plGenRefMsg(r, flags, which, type) {} + plNodeRefMsg(const plKey &r, uint8_t flags, int8_t which, int8_t type) : plGenRefMsg(r, flags, which, type) {} CLASSNAME_REGISTER( plNodeRefMsg ); GETINTERFACE_ANY( plNodeRefMsg, plGenRefMsg ); diff --git a/Sources/Plasma/NucleusLib/pnMessage/plNotifyMsg.cpp b/Sources/Plasma/NucleusLib/pnMessage/plNotifyMsg.cpp index c8553289..344da416 100644 --- a/Sources/Plasma/NucleusLib/pnMessage/plNotifyMsg.cpp +++ b/Sources/Plasma/NucleusLib/pnMessage/plNotifyMsg.cpp @@ -247,7 +247,7 @@ void plNotifyMsg::AddCollisionEvent( hsBool enter, const plKey &other, const plK } // create the collision event record - proCollisionEventData* pED = TRACKED_NEW proCollisionEventData; + proCollisionEventData* pED = new proCollisionEventData; pED->fEnter = enter; pED->fHitter = other; pED->fHittee = self; @@ -260,7 +260,7 @@ void plNotifyMsg::AddCollisionEvent( hsBool enter, const plKey &other, const plK // PARAMETERS : event - the event type, as enumerated in plEventCallbackMsg.h // // -void plNotifyMsg::AddCallbackEvent( Int32 event ) +void plNotifyMsg::AddCallbackEvent( int32_t event ) { // remove records that are like the one being added int num_recs = fEvents.GetCount(); @@ -283,7 +283,7 @@ void plNotifyMsg::AddCallbackEvent( Int32 event ) } // create the collision event record - proCallbackEventData* pED = TRACKED_NEW proCallbackEventData; + proCallbackEventData* pED = new proCallbackEventData; pED->fEventType = event; fEvents.Append(pED); // then add it to the list of event records } @@ -295,7 +295,7 @@ void plNotifyMsg::AddCallbackEvent( Int32 event ) // PARAMETERS : state - the state for the responder to switch to before triggering // // -void plNotifyMsg::AddResponderStateEvent( Int32 state ) +void plNotifyMsg::AddResponderStateEvent( int32_t state ) { // remove records that are like the one being added int num_recs = fEvents.GetCount(); @@ -318,7 +318,7 @@ void plNotifyMsg::AddResponderStateEvent( Int32 state ) } // create the collision event record - proResponderStateEventData* pED = TRACKED_NEW proResponderStateEventData; + proResponderStateEventData* pED = new proResponderStateEventData; pED->fState = state; fEvents.Append(pED); // then add it to the list of event records } @@ -331,20 +331,20 @@ void plNotifyMsg::AddResponderStateEvent( Int32 state ) // : event - what was the event that happened // // -void plNotifyMsg::AddMultiStageEvent( Int32 stage, Int32 event, const plKey& avatar ) +void plNotifyMsg::AddMultiStageEvent( int32_t stage, int32_t event, const plKey& avatar ) { // we can have multi events of this type // create the mutlistage event record - proMultiStageEventData* pED = TRACKED_NEW proMultiStageEventData; + proMultiStageEventData* pED = new proMultiStageEventData; pED->fStage = stage; pED->fEvent = event; pED->fAvatar = avatar; fEvents.Append(pED); // then add it to the list of event records } -void plNotifyMsg::AddCoopEvent(UInt32 id, UInt16 serial) +void plNotifyMsg::AddCoopEvent(uint32_t id, uint16_t serial) { - proCoopEventData *pED = TRACKED_NEW proCoopEventData; + proCoopEventData *pED = new proCoopEventData; pED->fID = id; pED->fSerial = serial; fEvents.Append(pED); @@ -352,7 +352,7 @@ void plNotifyMsg::AddCoopEvent(UInt32 id, UInt16 serial) void plNotifyMsg::AddSpawnedEvent (const plKey &spawner, const plKey &spawnee) { - proSpawnedEventData* pED = TRACKED_NEW proSpawnedEventData(); + proSpawnedEventData* pED = new proSpawnedEventData(); pED->fSpawner = spawner; pED->fSpawnee = spawnee; fEvents.Append(pED); @@ -393,7 +393,7 @@ void plNotifyMsg::AddActivateEvent( hsBool activate ) } // create the collision event record - proActivateEventData* pED = TRACKED_NEW proActivateEventData; + proActivateEventData* pED = new proActivateEventData; pED->fActive = true; pED->fActivate = activate; fEvents.Append(pED); // then add it to the list of event records @@ -435,7 +435,7 @@ void plNotifyMsg::AddPickEvent( const plKey &other, const plKey& self, hsBool en } // create the pick event record - proPickedEventData* pED = TRACKED_NEW proPickedEventData; + proPickedEventData* pED = new proPickedEventData; pED->fPicker = other; pED->fPicked = self; pED->fEnabled = enabled; @@ -480,7 +480,7 @@ void plNotifyMsg::AddContainerEvent( const plKey &container, const plKey &contai } // create the pick event record - proContainedEventData* pED = TRACKED_NEW proContainedEventData; + proContainedEventData* pED = new proContainedEventData; pED->fContained = contained; pED->fContainer = container; pED->fEntering = entering; @@ -502,7 +502,7 @@ void plNotifyMsg::AddContainerEvent( const plKey &container, const plKey &contai // NOTE: To test for duplicate record, it only checks for records of the same type // : Eventually, it might be wise to check if the same 'self' key also? // -void plNotifyMsg::AddFacingEvent( const plKey &other, const plKey &self, hsScalar dot, hsBool enabled ) +void plNotifyMsg::AddFacingEvent( const plKey &other, const plKey &self, float dot, hsBool enabled ) { // remove records that are like the one being added @@ -526,7 +526,7 @@ void plNotifyMsg::AddFacingEvent( const plKey &other, const plKey &self, hsScala } // create the pick event record - proFacingEventData* pED = TRACKED_NEW proFacingEventData; + proFacingEventData* pED = new proFacingEventData; pED->fFacer = other; pED->fFacee = self; pED->dot = dot; @@ -546,7 +546,7 @@ void plNotifyMsg::AddFacingEvent( const plKey &other, const plKey &self, hsScala // NOTE: To test for duplicate record, it only checks for records of the same type // : Eventually, it might be wise to check if the same 'self' key also? // -void plNotifyMsg::AddControlKeyEvent( Int32 key, hsBool down ) +void plNotifyMsg::AddControlKeyEvent( int32_t key, hsBool down ) { // remove records that are like the one being added int num_recs = fEvents.GetCount(); @@ -569,7 +569,7 @@ void plNotifyMsg::AddControlKeyEvent( Int32 key, hsBool down ) } // create the control key event record - proControlKeyEventData* pED = TRACKED_NEW proControlKeyEventData; + proControlKeyEventData* pED = new proControlKeyEventData; pED->fControlKey = key; pED->fDown = down; fEvents.Append(pED); // then add it to the list of event records @@ -583,10 +583,10 @@ void plNotifyMsg::AddControlKeyEvent( Int32 key, hsBool down ) // // PURPOSE : Add a variable event record to this notify message // -void plNotifyMsg::AddVariableEvent( const char* name, hsScalar number ) +void plNotifyMsg::AddVariableEvent( const char* name, float number ) { // create the control key event record - proVariableEventData* pED = TRACKED_NEW proVariableEventData; + proVariableEventData* pED = new proVariableEventData; pED->fName = hsStrcpy(nil,name); // pED->fName = (char*)name; pED->fDataType = proEventData::kNumber; @@ -606,7 +606,7 @@ void plNotifyMsg::AddVariableEvent( const char* name, hsScalar number ) void plNotifyMsg::AddVariableEvent( const char* name, const plKey &key ) { // create the control key event record - proVariableEventData* pED = TRACKED_NEW proVariableEventData; + proVariableEventData* pED = new proVariableEventData; pED->fName = hsStrcpy(nil,name); // pED->fName = (char*)name; pED->fDataType = proEventData::kKey; @@ -628,7 +628,7 @@ void plNotifyMsg::AddVariableEvent( const char* name, const plKey &key ) // NOTE: To test for duplicate record, it only checks for records of the same type // : Eventually, it might be wise to check if the same 'self' key also? // -void plNotifyMsg::AddClickDragEvent( const plKey& dragger, const plKey& dragee, hsScalar animPos ) +void plNotifyMsg::AddClickDragEvent( const plKey& dragger, const plKey& dragee, float animPos ) { // remove records that are like the one being added int num_recs = fEvents.GetCount(); @@ -651,7 +651,7 @@ void plNotifyMsg::AddClickDragEvent( const plKey& dragger, const plKey& dragee, } // create the control key event record - proClickDragEventData* pED = TRACKED_NEW proClickDragEventData; + proClickDragEventData* pED = new proClickDragEventData; pED->picked = dragee; pED->picker = dragger; pED->animPos = animPos; @@ -694,7 +694,7 @@ void plNotifyMsg::AddOfferBookEvent(const plKey& offerer, int targetAge, int off } // create the control key event record - proOfferLinkingBookEventData* pED = TRACKED_NEW proOfferLinkingBookEventData; + proOfferLinkingBookEventData* pED = new proOfferLinkingBookEventData; pED->offerer = offerer; pED->targetAge = targetAge; pED->offeree = offeree; @@ -713,7 +713,7 @@ void plNotifyMsg::AddOfferBookEvent(const plKey& offerer, int targetAge, int off // NOTE: To test for duplicate record, it only checks for records of the same type // : Eventually, it might be wise to check if the same 'self' key also? // -void plNotifyMsg::AddBookEvent( UInt32 event, UInt32 linkID /*=0*/) +void plNotifyMsg::AddBookEvent( uint32_t event, uint32_t linkID /*=0*/) { // remove records that are like the one being added int num_recs = fEvents.GetCount(); @@ -736,7 +736,7 @@ void plNotifyMsg::AddBookEvent( UInt32 event, UInt32 linkID /*=0*/) } // create the control key event record - proBookEventData* pED = TRACKED_NEW proBookEventData; + proBookEventData* pED = new proBookEventData; pED->fEvent = event; pED->fLinkID = linkID; fEvents.Append(pED); // then add it to the list of event records @@ -776,7 +776,7 @@ void plNotifyMsg::AddHitClimbingBlockerEvent(const plKey &blocker) } // create the control key event record - proClimbingBlockerHitEventData* pED = TRACKED_NEW proClimbingBlockerHitEventData; + proClimbingBlockerHitEventData* pED = new proClimbingBlockerHitEventData; pED->fBlockerKey = blocker; fEvents.Append(pED); // then add it to the list of event records } @@ -790,7 +790,7 @@ void plNotifyMsg::AddHitClimbingBlockerEvent(const plKey &blocker) // // PURPOSE : Find the first record in the event records that is of type eventtype // -proEventData* plNotifyMsg::FindEventRecord( Int32 eventtype ) +proEventData* plNotifyMsg::FindEventRecord( int32_t eventtype ) { // make sure that its a legal event type if ( eventtype >= 0 && eventtype < proEventData::kNone ) @@ -844,7 +844,7 @@ void plNotifyMsg::Read(hsStream* stream, hsResMgr* mgr) stream->ReadLE(&fState); fID = stream->ReadLE32(); // read in the variable part of the message - Int32 numberEDs = stream->ReadLE32(); + int32_t numberEDs = stream->ReadLE32(); fEvents.SetCountAndZero(numberEDs); if ( numberEDs > 0 ) { @@ -873,7 +873,7 @@ void plNotifyMsg::Write(hsStream* stream, hsResMgr* mgr) stream->WriteLE(fState); stream->WriteLE32(fID); // then write the variable data - Int32 numberEDs = fEvents.Count(); + int32_t numberEDs = fEvents.Count(); stream->WriteLE32(numberEDs); if ( numberEDs > 0 ) { @@ -914,7 +914,7 @@ void plNotifyMsg::ReadVersion(hsStream* s, hsResMgr* mgr) if (contentFlags.IsBitSet(kNotifyMsgEDs)) { // read in the variable part of the message - Int32 numberEDs = s->ReadLE32(); + int32_t numberEDs = s->ReadLE32(); fEvents.SetCountAndZero(numberEDs); if (numberEDs > 0) { @@ -955,7 +955,7 @@ void plNotifyMsg::WriteVersion(hsStream* s, hsResMgr* mgr) s->WriteLE32(fID); // kNotifyMsgEDs - Int32 numberEDs = fEvents.Count(); + int32_t numberEDs = fEvents.Count(); s->WriteLE32(numberEDs); if (numberEDs > 0) { @@ -998,25 +998,25 @@ plKey plNotifyMsg::GetAvatarKey() /////////////////////////////////////////////////////////////////////////////////////////// -proEventData* proEventData::ICreateEventDataType(Int32 type) +proEventData* proEventData::ICreateEventDataType(int32_t type) { switch (type) { - case kCollision: return TRACKED_NEW proCollisionEventData; - case kPicked: return TRACKED_NEW proPickedEventData; - case kControlKey: return TRACKED_NEW proControlKeyEventData; - case kVariable: return TRACKED_NEW proVariableEventData; - case kFacing: return TRACKED_NEW proFacingEventData; - case kContained: return TRACKED_NEW proContainedEventData; - case kActivate: return TRACKED_NEW proActivateEventData; - case kCallback: return TRACKED_NEW proCallbackEventData; - case kResponderState: return TRACKED_NEW proResponderStateEventData; - case kMultiStage: return TRACKED_NEW proMultiStageEventData; - case kCoop: return TRACKED_NEW proCoopEventData; - case kSpawned: return TRACKED_NEW proSpawnedEventData; - case kOfferLinkingBook: return TRACKED_NEW proOfferLinkingBookEventData; - case kBook: return TRACKED_NEW proBookEventData; - case kClimbingBlockerHit: return TRACKED_NEW proClimbingBlockerHitEventData; + case kCollision: return new proCollisionEventData; + case kPicked: return new proPickedEventData; + case kControlKey: return new proControlKeyEventData; + case kVariable: return new proVariableEventData; + case kFacing: return new proFacingEventData; + case kContained: return new proContainedEventData; + case kActivate: return new proActivateEventData; + case kCallback: return new proCallbackEventData; + case kResponderState: return new proResponderStateEventData; + case kMultiStage: return new proMultiStageEventData; + case kCoop: return new proCoopEventData; + case kSpawned: return new proSpawnedEventData; + case kOfferLinkingBook: return new proOfferLinkingBookEventData; + case kBook: return new proBookEventData; + case kClimbingBlockerHit: return new proClimbingBlockerHitEventData; } return nil; @@ -1028,7 +1028,7 @@ proEventData* proEventData::ICreateEventDataType(Int32 type) proEventData* proEventData::Read( hsStream *stream, hsResMgr *mgr ) { - Int32 evtType = stream->ReadLE32(); + int32_t evtType = stream->ReadLE32(); proEventData* data = ICreateEventDataType(evtType); @@ -1056,7 +1056,7 @@ proEventData* proEventData::ReadVersion(hsStream* s, hsResMgr* mgr) if (contentFlags.IsBitSet(kProEventDataType)) { - Int32 evtType = s->ReadLE32(); + int32_t evtType = s->ReadLE32(); proEventData* data = ICreateEventDataType(evtType); diff --git a/Sources/Plasma/NucleusLib/pnMessage/plNotifyMsg.h b/Sources/Plasma/NucleusLib/pnMessage/plNotifyMsg.h index 55c8728f..b629e472 100644 --- a/Sources/Plasma/NucleusLib/pnMessage/plNotifyMsg.h +++ b/Sources/Plasma/NucleusLib/pnMessage/plNotifyMsg.h @@ -45,7 +45,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "plMessage.h" #include "hsResMgr.h" #include "pnModifier/plSingleModifier.h" -#include "hsUtils.h" + #include "hsGeometry3.h" @@ -80,7 +80,7 @@ public: kNone }; - proEventData( Int32 evtType = kNone ) : fEventType( evtType ) + proEventData( int32_t evtType = kNone ) : fEventType( evtType ) { } virtual ~proEventData() {} @@ -102,9 +102,9 @@ public: kNothing }; - Int32 fEventType; // what type of event (evenType enum) + int32_t fEventType; // what type of event (evenType enum) - static proEventData* ICreateEventDataType(Int32 type); + static proEventData* ICreateEventDataType(int32_t type); static proEventData* Read(hsStream* stream, hsResMgr* mgr); void Write(hsStream* stream, hsResMgr* mgr); @@ -165,7 +165,7 @@ protected: }; proEventType(ControlKey) - Int32 fControlKey; // what control key was hit + int32_t fControlKey; // what control key was hit hsBool fDown; // was the key going down (false if going up) protected: @@ -178,10 +178,10 @@ protected: proEventType(Variable) char* fName; // name of variable - Int32 fDataType; // type of data + int32_t fDataType; // type of data // Can't be a union, sadly, but it isn't that much of a waste of space... - hsScalar fNumber; // if its a number + float fNumber; // if its a number plKey fKey; // if its a plKey (pointer to something) @@ -198,7 +198,7 @@ protected: proEventType(Facing) plKey fFacer; // what was facing plKey fFacee; // what was being faced - hsScalar dot; // the dot prod of their view vectors + float dot; // the dot prod of their view vectors hsBool enabled; // Now meets facing requirement (true) or no longer meets requirement (false) protected: @@ -235,7 +235,7 @@ protected: }; proEventType(Callback) - Int32 fEventType; // enumerated in plEventCallbackMsg.h + int32_t fEventType; // enumerated in plEventCallbackMsg.h protected: virtual void IRead(hsStream* stream, hsResMgr* mgr); @@ -246,7 +246,7 @@ protected: }; proEventType(ResponderState) - Int32 fState; // what state the responder should be switched to before triggering + int32_t fState; // what state the responder should be switched to before triggering protected: virtual void IRead(hsStream* stream, hsResMgr* mgr); @@ -257,8 +257,8 @@ protected: }; proEventType(MultiStage) - Int32 fStage; - Int32 fEvent; + int32_t fStage; + int32_t fEvent; plKey fAvatar; // who was running the stage protected: @@ -270,8 +270,8 @@ protected: }; proEventType(Coop) - UInt32 fID; // player ID of the initiator - UInt16 fSerial; // serial number for the initiator + uint32_t fID; // player ID of the initiator + uint16_t fSerial; // serial number for the initiator protected: virtual void IRead(hsStream* stream, hsResMgr* mgr); virtual void IWrite(hsStream* stream, hsResMgr* mgr); @@ -284,7 +284,7 @@ protected: proEventType(ClickDrag) plKey picker; // always the local avatar in this case plKey picked; - hsScalar animPos; // 0.0 to 1.0 animation percentage + float animPos; // 0.0 to 1.0 animation percentage }; proEventType(OfferLinkingBook) @@ -300,8 +300,8 @@ protected: }; proEventType(Book) - UInt32 fEvent; // The type of event. See pfJournalBook.h for enumsu - UInt32 fLinkID; // The link ID of the image clicked, if an image link event, otherwise unused + uint32_t fEvent; // The type of event. See pfJournalBook.h for enumsu + uint32_t fLinkID; // The link ID of the image clicked, if an image link event, otherwise unused protected: virtual void IRead(hsStream* stream, hsResMgr* mgr); virtual void IWrite(hsStream* stream, hsResMgr* mgr); @@ -354,36 +354,36 @@ public: kResponderFF, // Fast forward kResponderChangeState, // Change state without triggering }; - Int32 fType; // what type of notification - hsScalar fState; // state of the notifier 0.0=false, 1.0=true - Int32 fID; // special ID mostly for responder State transitions + int32_t fType; // what type of notification + float fState; // state of the notifier 0.0=false, 1.0=true + int32_t fID; // special ID mostly for responder State transitions hsTArray fEvents;// list of events with data void SetType(notificationType type) { fType = type; } - void SetState(hsScalar state) { fState = state; } + void SetState(float state) { fState = state; } // event records for the notify message void AddEvent( proEventData* ed); void AddCollisionEvent( hsBool enter, const plKey &other, const plKey &self, hsBool onlyOneCollision=true ); void AddPickEvent( const plKey &other, const plKey& self, hsBool enabled, hsPoint3 hitPoint ); - void AddControlKeyEvent( Int32 key, hsBool down ); - void AddVariableEvent( const char* name, hsScalar number ); + void AddControlKeyEvent( int32_t key, hsBool down ); + void AddVariableEvent( const char* name, float number ); void AddVariableEvent( const char *name, const plKey &key); - void AddFacingEvent( const plKey &other, const plKey &self, hsScalar dot, hsBool enabled); + void AddFacingEvent( const plKey &other, const plKey &self, float dot, hsBool enabled); void AddContainerEvent( const plKey &container, const plKey &contained, hsBool entering); void AddActivateEvent( hsBool activate ); - void AddCallbackEvent( Int32 event ); - void AddResponderStateEvent( Int32 state ); - void AddMultiStageEvent( Int32 stage, Int32 event, const plKey& avatar ); - void AddCoopEvent(UInt32 id, UInt16 serial); + void AddCallbackEvent( int32_t event ); + void AddResponderStateEvent( int32_t state ); + void AddMultiStageEvent( int32_t stage, int32_t event, const plKey& avatar ); + void AddCoopEvent(uint32_t id, uint16_t serial); void AddSpawnedEvent (const plKey &spawner, const plKey &spawned); - void AddClickDragEvent(const plKey& dragger, const plKey& dragee, hsScalar animPos); + void AddClickDragEvent(const plKey& dragger, const plKey& dragee, float animPos); void AddOfferBookEvent(const plKey& offerer, int targetAge, int offeree); - void AddBookEvent( UInt32 event, UInt32 linkID = 0 ); + void AddBookEvent( uint32_t event, uint32_t linkID = 0 ); void AddHitClimbingBlockerEvent(const plKey &blocker); - proEventData* FindEventRecord( Int32 eventtype ); - Int32 GetEventCount() { return fEvents.Count(); } - proEventData* GetEventRecord(Int32 i) { return fEvents[i]; } + proEventData* FindEventRecord( int32_t eventtype ); + int32_t GetEventCount() { return fEvents.Count(); } + proEventData* GetEventRecord(int32_t i) { return fEvents[i]; } void ClearEvents(); // Searches the event records for an event triggered by an avatar, and returns that key diff --git a/Sources/Plasma/NucleusLib/pnMessage/plObjRefMsg.h b/Sources/Plasma/NucleusLib/pnMessage/plObjRefMsg.h index d86c5c71..fb0b0ce4 100644 --- a/Sources/Plasma/NucleusLib/pnMessage/plObjRefMsg.h +++ b/Sources/Plasma/NucleusLib/pnMessage/plObjRefMsg.h @@ -60,15 +60,15 @@ public: plObjRefMsg(): fType(-1), fWhich(-1) {}; - plObjRefMsg(const plKey &r, UInt8 refMsgFlags, Int8 which , Int8 type) + plObjRefMsg(const plKey &r, uint8_t refMsgFlags, int8_t which , int8_t type) : plRefMsg(r, refMsgFlags), fType(type), fWhich(which) {} CLASSNAME_REGISTER( plObjRefMsg ); GETINTERFACE_ANY( plObjRefMsg, plRefMsg ); - Int8 fType; - Int8 fWhich; + int8_t fType; + int8_t fWhich; // IO - not really applicable to ref msgs, but anyway void Read(hsStream* stream, hsResMgr* mgr) diff --git a/Sources/Plasma/NucleusLib/pnMessage/plProxyDrawMsg.cpp b/Sources/Plasma/NucleusLib/pnMessage/plProxyDrawMsg.cpp index a7049254..486d7c2a 100644 --- a/Sources/Plasma/NucleusLib/pnMessage/plProxyDrawMsg.cpp +++ b/Sources/Plasma/NucleusLib/pnMessage/plProxyDrawMsg.cpp @@ -40,7 +40,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "plProxyDrawMsg.h" #include "hsStream.h" @@ -51,14 +51,14 @@ plProxyDrawMsg::plProxyDrawMsg() SetBCastFlag(plMessage::kBCastByExactType); } -plProxyDrawMsg::plProxyDrawMsg(UInt16 flags) +plProxyDrawMsg::plProxyDrawMsg(uint16_t flags) : plMessage(nil, nil, nil), fProxyFlags(flags) { SetBCastFlag(plMessage::kBCastByExactType); } -plProxyDrawMsg::plProxyDrawMsg(plKey &rcv, UInt16 flags) +plProxyDrawMsg::plProxyDrawMsg(plKey &rcv, uint16_t flags) : plMessage(rcv, rcv, nil), fProxyFlags(flags) { diff --git a/Sources/Plasma/NucleusLib/pnMessage/plProxyDrawMsg.h b/Sources/Plasma/NucleusLib/pnMessage/plProxyDrawMsg.h index fbcf532d..3dc13dc2 100644 --- a/Sources/Plasma/NucleusLib/pnMessage/plProxyDrawMsg.h +++ b/Sources/Plasma/NucleusLib/pnMessage/plProxyDrawMsg.h @@ -56,12 +56,12 @@ class hsResMgr; class plProxyDrawMsg : public plMessage { protected: - UInt16 fProxyFlags; + uint16_t fProxyFlags; public: plProxyDrawMsg(); - plProxyDrawMsg(UInt16 flags); // for broadcast - plProxyDrawMsg(plKey &rcv, UInt16 flags); // send yourself an ack + plProxyDrawMsg(uint16_t flags); // for broadcast + plProxyDrawMsg(plKey &rcv, uint16_t flags); // send yourself an ack ~plProxyDrawMsg(); CLASSNAME_REGISTER( plProxyDrawMsg ); @@ -88,8 +88,8 @@ public: | kCamera }; - UInt16 GetProxyFlags() const { return fProxyFlags; } - void SetProxyFlags(UInt16 f) { fProxyFlags = f; } + uint16_t GetProxyFlags() const { return fProxyFlags; } + void SetProxyFlags(uint16_t f) { fProxyFlags = f; } virtual void Read(hsStream* stream, hsResMgr* mgr); virtual void Write(hsStream* stream, hsResMgr* mgr); diff --git a/Sources/Plasma/NucleusLib/pnMessage/plRefMsg.cpp b/Sources/Plasma/NucleusLib/pnMessage/plRefMsg.cpp index bce5fdc7..82c29dd3 100644 --- a/Sources/Plasma/NucleusLib/pnMessage/plRefMsg.cpp +++ b/Sources/Plasma/NucleusLib/pnMessage/plRefMsg.cpp @@ -40,7 +40,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "plRefMsg.h" #include "hsStream.h" @@ -53,7 +53,7 @@ plRefMsg::plRefMsg() { } -plRefMsg::plRefMsg(const plKey &r, UInt8 c) +plRefMsg::plRefMsg(const plKey &r, uint8_t c) : plMessage(nil, r, nil), fRef(nil), fOldRef(nil), fContext(c) { if( !fContext ) diff --git a/Sources/Plasma/NucleusLib/pnMessage/plRefMsg.h b/Sources/Plasma/NucleusLib/pnMessage/plRefMsg.h index 82c9e80f..46f354db 100644 --- a/Sources/Plasma/NucleusLib/pnMessage/plRefMsg.h +++ b/Sources/Plasma/NucleusLib/pnMessage/plRefMsg.h @@ -63,10 +63,10 @@ protected: hsKeyedObject* fRef; hsKeyedObject* fOldRef; // on replace - UInt8 fContext; + uint8_t fContext; public: plRefMsg(); - plRefMsg(const plKey &r, UInt8 c); + plRefMsg(const plKey &r, uint8_t c); virtual ~plRefMsg(); @@ -79,8 +79,8 @@ public: plRefMsg& SetOldRef(hsKeyedObject* oldRef); hsKeyedObject* GetOldRef() { return fOldRef; } - plRefMsg& SetContext(UInt8 c) { fContext = c; return *this; } - UInt8 GetContext() { return fContext; } + plRefMsg& SetContext(uint8_t c) { fContext = c; return *this; } + uint8_t GetContext() { return fContext; } void Read(hsStream* stream, hsResMgr* mgr); void Write(hsStream* stream, hsResMgr* mgr); @@ -91,7 +91,7 @@ class plGenRefMsg : public plRefMsg { public: plGenRefMsg() : fType(-1), fWhich(-1) {} - plGenRefMsg(const plKey &r, UInt8 c, Int32 which, Int8 type) : plRefMsg(r, c), fWhich(which), fType(type) {} + plGenRefMsg(const plKey &r, uint8_t c, int32_t which, int8_t type) : plRefMsg(r, c), fWhich(which), fType(type) {} CLASSNAME_REGISTER(plGenRefMsg); GETINTERFACE_ANY(plGenRefMsg, plRefMsg); @@ -99,8 +99,8 @@ public: // User variables. You can put anything here, but the standard convention // is an enum telling what type of ref it is in fType, and an index in // fWhich, for keeping track of multiple refs of the same type. - Int8 fType; - Int32 fWhich; + int8_t fType; + int32_t fWhich; void Read(hsStream* stream, hsResMgr* mgr); void Write(hsStream* stream, hsResMgr* mgr); diff --git a/Sources/Plasma/NucleusLib/pnMessage/plSDLModifierMsg.h b/Sources/Plasma/NucleusLib/pnMessage/plSDLModifierMsg.h index 2e4559ae..7bf43c06 100644 --- a/Sources/Plasma/NucleusLib/pnMessage/plSDLModifierMsg.h +++ b/Sources/Plasma/NucleusLib/pnMessage/plSDLModifierMsg.h @@ -43,7 +43,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #define plSDLModifierMsg_INC #include "pnMessage/plMessage.h" -#include "hsUtils.h" + // // A msg sent to an SDL modifier to tell it send or recv state. @@ -67,8 +67,8 @@ protected: Action fAction; plStateDataRecord* fState; // for recving state bool fManageStateMem; // delete fState? - UInt32 fPlayerID; - UInt32 fFlags; + uint32_t fPlayerID; + uint32_t fFlags; public: plSDLModifierMsg(const char* sdlName=nil, Action a=kActionNone); @@ -77,8 +77,8 @@ public: CLASSNAME_REGISTER( plSDLModifierMsg ); GETINTERFACE_ANY( plSDLModifierMsg, plMessage ); - UInt32 GetFlags() const { return fFlags; } - void SetFlags(UInt32 f) { fFlags = f; } + uint32_t GetFlags() const { return fFlags; } + void SetFlags(uint32_t f) { fFlags = f; } Action GetAction() const { return fAction; } void SetAction(Action t) { fAction=t; } @@ -89,8 +89,8 @@ public: const char* GetSDLName() const { return fSDLName; } void SetSDLName(const char* s) { delete [] fSDLName; fSDLName=hsStrcpy(s); } - UInt32 GetPlayerID() const { return fPlayerID; } - void SetPlayerID(UInt32 p) { fPlayerID=p; } + uint32_t GetPlayerID() const { return fPlayerID; } + void SetPlayerID(uint32_t p) { fPlayerID=p; } // IO void Read(hsStream* stream, hsResMgr* mgr) { hsAssert(false, "local only msg"); } diff --git a/Sources/Plasma/NucleusLib/pnMessage/plSoundMsg.cpp b/Sources/Plasma/NucleusLib/pnMessage/plSoundMsg.cpp index c9ababec..b3c1bd01 100644 --- a/Sources/Plasma/NucleusLib/pnMessage/plSoundMsg.cpp +++ b/Sources/Plasma/NucleusLib/pnMessage/plSoundMsg.cpp @@ -40,7 +40,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "plSoundMsg.h" #include "hsStream.h" @@ -90,5 +90,5 @@ void plSoundMsg::Write(hsStream* stream, hsResMgr* mgr) stream->WriteLE(fRepeats); stream->WriteLE(fNameStr); stream->WriteLE(fVolume); - stream->WriteByte( (UInt8)fFadeType ); + stream->WriteByte( (uint8_t)fFadeType ); } diff --git a/Sources/Plasma/NucleusLib/pnMessage/plSoundMsg.h b/Sources/Plasma/NucleusLib/pnMessage/plSoundMsg.h index e205b119..4b7762ff 100644 --- a/Sources/Plasma/NucleusLib/pnMessage/plSoundMsg.h +++ b/Sources/Plasma/NucleusLib/pnMessage/plSoundMsg.h @@ -98,13 +98,13 @@ public: double fBegin; double fEnd; hsBool fLoop; - hsScalar fSpeed; + float fSpeed; double fTime; int fIndex; int fRepeats; hsBool fPlaying; - UInt32 fNameStr; - hsScalar fVolume; // Range: 0 - silence, 1.f - loudest + uint32_t fNameStr; + float fVolume; // Range: 0 - silence, 1.f - loudest enum FadeType { diff --git a/Sources/Plasma/NucleusLib/pnMessage/plTimeMsg.cpp b/Sources/Plasma/NucleusLib/pnMessage/plTimeMsg.cpp index 63b9a700..ab628de0 100644 --- a/Sources/Plasma/NucleusLib/pnMessage/plTimeMsg.cpp +++ b/Sources/Plasma/NucleusLib/pnMessage/plTimeMsg.cpp @@ -40,7 +40,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "plTimeMsg.h" #include "hsTimer.h" @@ -51,7 +51,7 @@ plTimeMsg::plTimeMsg() plTimeMsg::plTimeMsg(const plKey &s, const plKey &r, - const double* t, const hsScalar* d) + const double* t, const float* d) : plMessage(s, r, t) { fSeconds = t ? *t : hsTimer::GetSysSeconds(); @@ -70,7 +70,7 @@ plEvalMsg::plEvalMsg() plEvalMsg::plEvalMsg(const plKey &s, const plKey &r, - const double* t, const hsScalar* d) + const double* t, const float* d) : plTimeMsg(s, r, t, d) { } @@ -85,7 +85,7 @@ plTransformMsg::plTransformMsg() plTransformMsg::plTransformMsg(const plKey &s, const plKey &r, - const double* t, const hsScalar* d) + const double* t, const float* d) : plTimeMsg(s, r, t, d) { SetBCastFlag(plMessage::kClearAfterBCast); diff --git a/Sources/Plasma/NucleusLib/pnMessage/plTimeMsg.h b/Sources/Plasma/NucleusLib/pnMessage/plTimeMsg.h index 40516462..285bf7f2 100644 --- a/Sources/Plasma/NucleusLib/pnMessage/plTimeMsg.h +++ b/Sources/Plasma/NucleusLib/pnMessage/plTimeMsg.h @@ -50,23 +50,23 @@ class plTimeMsg : public plMessage { protected: double fSeconds; - hsScalar fDelSecs; + float fDelSecs; public: plTimeMsg(); plTimeMsg(const plKey &s, const plKey &r, - const double* t, const hsScalar* del); + const double* t, const float* del); ~plTimeMsg(); CLASSNAME_REGISTER( plTimeMsg ); GETINTERFACE_ANY( plTimeMsg, plMessage ); plTimeMsg& SetSeconds(double s) { fSeconds = s; return *this; } - plTimeMsg& SetDelSeconds(hsScalar d) { fDelSecs = d; return *this; } + plTimeMsg& SetDelSeconds(float d) { fDelSecs = d; return *this; } double DSeconds() { return fSeconds; } - hsScalar DelSeconds() { return fDelSecs; } + float DelSeconds() { return fDelSecs; } // IO void Read(hsStream* stream, hsResMgr* mgr) @@ -90,7 +90,7 @@ public: plEvalMsg(); plEvalMsg(const plKey &s, const plKey &r, - const double* t, const hsScalar* del); + const double* t, const float* del); ~plEvalMsg(); CLASSNAME_REGISTER( plEvalMsg ); @@ -107,7 +107,7 @@ public: plTransformMsg(); plTransformMsg(const plKey &s, const plKey &r, - const double* t, const hsScalar* del); + const double* t, const float* del); ~plTransformMsg(); CLASSNAME_REGISTER( plTransformMsg ); @@ -125,7 +125,7 @@ class plDelayedTransformMsg : public plTransformMsg { public: plDelayedTransformMsg() : plTransformMsg() {} - plDelayedTransformMsg(const plKey &s, const plKey &r, const double* t, const hsScalar* del) : plTransformMsg(s, r, t, del) {} + plDelayedTransformMsg(const plKey &s, const plKey &r, const double* t, const float* del) : plTransformMsg(s, r, t, del) {} CLASSNAME_REGISTER( plDelayedTransformMsg ); GETINTERFACE_ANY( plDelayedTransformMsg, plTransformMsg ); diff --git a/Sources/Plasma/NucleusLib/pnMessage/plWarpMsg.h b/Sources/Plasma/NucleusLib/pnMessage/plWarpMsg.h index 9c536fa0..29cb8226 100644 --- a/Sources/Plasma/NucleusLib/pnMessage/plWarpMsg.h +++ b/Sources/Plasma/NucleusLib/pnMessage/plWarpMsg.h @@ -50,7 +50,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com class plWarpMsg : public plMessage { private: - UInt32 fWarpFlags; + uint32_t fWarpFlags; hsMatrix44 fTransform; public: enum WarpFlags @@ -64,7 +64,7 @@ public: plWarpMsg(const plKey &s, const plKey &r, const double* t) { Clear(); } - plWarpMsg(const plKey &s, const plKey &r, UInt32 flags, const hsMatrix44 &mat) + plWarpMsg(const plKey &s, const plKey &r, uint32_t flags, const hsMatrix44 &mat) : fWarpFlags(flags), fTransform(mat), plMessage(s, r, nil) { }; @@ -75,8 +75,8 @@ public: void Clear() { fWarpFlags=0; } - UInt32 GetWarpFlags() { return fWarpFlags; } - void SetWarpFlags(UInt32 f) { fWarpFlags=f; } + uint32_t GetWarpFlags() { return fWarpFlags; } + void SetWarpFlags(uint32_t f) { fWarpFlags=f; } void SetTransform(const hsMatrix44& mat) { fTransform=mat; } hsMatrix44& GetTransform() { return fTransform; } diff --git a/Sources/Plasma/NucleusLib/pnModifier/plConditionalObject.cpp b/Sources/Plasma/NucleusLib/pnModifier/plConditionalObject.cpp index a0961cf7..77458ea0 100644 --- a/Sources/Plasma/NucleusLib/pnModifier/plConditionalObject.cpp +++ b/Sources/Plasma/NucleusLib/pnModifier/plConditionalObject.cpp @@ -39,7 +39,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com Mead, WA 99021 *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "plConditionalObject.h" #include "plLogicModBase.h" diff --git a/Sources/Plasma/NucleusLib/pnModifier/plLogicModBase.cpp b/Sources/Plasma/NucleusLib/pnModifier/plLogicModBase.cpp index 54e3a670..a28ef3d6 100644 --- a/Sources/Plasma/NucleusLib/pnModifier/plLogicModBase.cpp +++ b/Sources/Plasma/NucleusLib/pnModifier/plLogicModBase.cpp @@ -39,7 +39,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com Mead, WA 99021 *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "plLogicModBase.h" #include "plgDispatch.h" #include "hsResMgr.h" @@ -56,7 +56,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com void plLogicModBase::ConsoleTrigger(plKey playerKey) { // Setup the event data in case this is a OneShot responder that needs it - proPickedEventData *ed = TRACKED_NEW proPickedEventData; + proPickedEventData *ed = new proPickedEventData; ed->fPicker = playerKey; ed->fPicked = nil; fNotify->AddEvent(ed); @@ -80,7 +80,7 @@ fTimer(0.0f), fNotify(nil), fDisabled(false) { - fNotify = TRACKED_NEW plNotifyMsg; + fNotify = new plNotifyMsg; } plLogicModBase::~plLogicModBase() @@ -99,7 +99,7 @@ void plLogicModBase::AddTarget(plSceneObject* so) plSingleModifier::AddTarget(so); } -void plLogicModBase::RegisterForMessageType(UInt16 hClass) +void plLogicModBase::RegisterForMessageType(uint16_t hClass) { plgDispatch::Dispatch()->RegisterForExactType( hClass, GetKey() ); } @@ -113,7 +113,7 @@ void plLogicModBase::RegisterForMessageType(UInt16 hClass) void plLogicModBase::IUpdateSharedState(bool triggered) const { plNetSharedState ss("TrigState"); - plGenericVar* sv = TRACKED_NEW plGenericVar("Triggered"); + plGenericVar* sv = new plGenericVar("Triggered"); sv->Value().SetBool(triggered); // attempting to set trig state to true ss.AddVar(sv); @@ -304,7 +304,7 @@ void plLogicModBase::Reset(bool bCounterReset) void plLogicModBase::CreateNotifyMsg() { - fNotify = TRACKED_NEW plNotifyMsg; + fNotify = new plNotifyMsg; for (int i = 0; i < fReceiverList.Count(); i++) fNotify->AddReceiver(fReceiverList[i]); } diff --git a/Sources/Plasma/NucleusLib/pnModifier/plLogicModBase.h b/Sources/Plasma/NucleusLib/pnModifier/plLogicModBase.h index f37f546a..36eb346d 100644 --- a/Sources/Plasma/NucleusLib/pnModifier/plLogicModBase.h +++ b/Sources/Plasma/NucleusLib/pnModifier/plLogicModBase.h @@ -68,14 +68,14 @@ public: protected: hsTArray fCommandList; hsTArray fReceiverList; - UInt32 fCounterLimit; - hsScalar fTimer; + uint32_t fCounterLimit; + float fTimer; hsBitVector fFlags; - UInt32 fCounter; + uint32_t fCounter; plNotifyMsg* fNotify; bool fDisabled; - virtual hsBool IEval(double secs, hsScalar del, UInt32 dirty) {return false;} + virtual hsBool IEval(double secs, float del, uint32_t dirty) {return false;} void IUpdateSharedState(bool triggered) const; hsBool IEvalCounter(); virtual void PreTrigger(hsBool netRequest); @@ -107,7 +107,7 @@ public: void AddCommand(plMessage* msg) { fCommandList.Append(msg); } void SetOneShot(hsBool b) { if (b) SetFlag(kOneShot); else ClearFlag(kOneShot); } - void RegisterForMessageType(UInt16 hClass); + void RegisterForMessageType(uint16_t hClass); virtual void RequestTrigger(hsBool netRequest=false); virtual void RequestUnTrigger() { UnTrigger(); } diff --git a/Sources/Plasma/NucleusLib/pnModifier/plModifier.cpp b/Sources/Plasma/NucleusLib/pnModifier/plModifier.cpp index 501c39e6..08b73104 100644 --- a/Sources/Plasma/NucleusLib/pnModifier/plModifier.cpp +++ b/Sources/Plasma/NucleusLib/pnModifier/plModifier.cpp @@ -40,7 +40,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "plModifier.h" #include "pnSceneObject/plSceneObject.h" #include "pnSceneObject/plDrawInterface.h" @@ -77,9 +77,9 @@ plAudioInterface* plModifier::IGetTargetAudioInterface(int iTarg) const return GetTarget(iTarg) ? GetTarget(iTarg)->GetVolatileAudioInterface() : nil; } -plObjInterface* plModifier::IGetTargetGenericInterface(int iTarg, UInt32 classIdx) const +plObjInterface* plModifier::IGetTargetGenericInterface(int iTarg, uint32_t classIdx) const { - return GetTarget(iTarg) ? GetTarget(iTarg)->GetVolatileGenericInterface((UInt16)classIdx) : nil; + return GetTarget(iTarg) ? GetTarget(iTarg)->GetVolatileGenericInterface((uint16_t)classIdx) : nil; } plModifier* plModifier::IGetTargetModifier(int iTarg, int iMod) const @@ -92,7 +92,7 @@ hsBool plModifier::MsgReceive(plMessage* msg) plEvalMsg* eval = plEvalMsg::ConvertNoRef(msg); if( eval ) { - UInt32 dirty = ~0L; + uint32_t dirty = ~0L; IEval(eval->DSeconds(), eval->DelSeconds(), dirty); return true; } diff --git a/Sources/Plasma/NucleusLib/pnModifier/plModifier.h b/Sources/Plasma/NucleusLib/pnModifier/plModifier.h index 74054f0e..c1da9ede 100644 --- a/Sources/Plasma/NucleusLib/pnModifier/plModifier.h +++ b/Sources/Plasma/NucleusLib/pnModifier/plModifier.h @@ -64,10 +64,10 @@ protected: plSimulationInterface* IGetTargetSimulationInterface(int iTarg) const; plCoordinateInterface* IGetTargetCoordinateInterface(int iTarg) const; plAudioInterface* IGetTargetAudioInterface(int iTarg) const; - plObjInterface* IGetTargetGenericInterface(int iTarg, UInt32 classIdx) const; + plObjInterface* IGetTargetGenericInterface(int iTarg, uint32_t classIdx) const; plModifier* IGetTargetModifier(int iTarg, int iMod) const; - virtual hsBool IEval(double secs, hsScalar del, UInt32 dirty) = 0; // called only by owner object's Eval() + virtual hsBool IEval(double secs, float del, uint32_t dirty) = 0; // called only by owner object's Eval() friend class plSceneObject; public: diff --git a/Sources/Plasma/NucleusLib/pnModifier/plMultiModifier.cpp b/Sources/Plasma/NucleusLib/pnModifier/plMultiModifier.cpp index b4743d00..70100904 100644 --- a/Sources/Plasma/NucleusLib/pnModifier/plMultiModifier.cpp +++ b/Sources/Plasma/NucleusLib/pnModifier/plMultiModifier.cpp @@ -40,7 +40,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "plMultiModifier.h" #include "hsStream.h" diff --git a/Sources/Plasma/NucleusLib/pnModifier/plMultiModifier.h b/Sources/Plasma/NucleusLib/pnModifier/plMultiModifier.h index ff31f99c..36e7be5d 100644 --- a/Sources/Plasma/NucleusLib/pnModifier/plMultiModifier.h +++ b/Sources/Plasma/NucleusLib/pnModifier/plMultiModifier.h @@ -64,7 +64,7 @@ public: CLASSNAME_REGISTER( plMultiModifier ); GETINTERFACE_ANY( plMultiModifier, plModifier ); - virtual hsBool IEval(double secs, hsScalar del, UInt32 dirty) = 0; + virtual hsBool IEval(double secs, float del, uint32_t dirty) = 0; virtual void Read(hsStream* stream, hsResMgr* mgr); virtual void Write(hsStream* stream, hsResMgr* mgr); diff --git a/Sources/Plasma/NucleusLib/pnModifier/plSingleModifier.cpp b/Sources/Plasma/NucleusLib/pnModifier/plSingleModifier.cpp index b0b81db1..9b650966 100644 --- a/Sources/Plasma/NucleusLib/pnModifier/plSingleModifier.cpp +++ b/Sources/Plasma/NucleusLib/pnModifier/plSingleModifier.cpp @@ -40,7 +40,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "plSingleModifier.h" #include "hsStream.h" diff --git a/Sources/Plasma/NucleusLib/pnModifier/plSingleModifier.h b/Sources/Plasma/NucleusLib/pnModifier/plSingleModifier.h index 0a4d1276..67992828 100644 --- a/Sources/Plasma/NucleusLib/pnModifier/plSingleModifier.h +++ b/Sources/Plasma/NucleusLib/pnModifier/plSingleModifier.h @@ -56,7 +56,7 @@ protected: plSceneObject* fTarget; hsBitVector fFlags; - virtual hsBool IEval(double secs, hsScalar del, UInt32 dirty) = 0; + virtual hsBool IEval(double secs, float del, uint32_t dirty) = 0; public: plSingleModifier(); diff --git a/Sources/Plasma/NucleusLib/pnNetBase/pnNbError.cpp b/Sources/Plasma/NucleusLib/pnNetBase/pnNbError.cpp index 1a4942cb..b54431a4 100644 --- a/Sources/Plasma/NucleusLib/pnNetBase/pnNbError.cpp +++ b/Sources/Plasma/NucleusLib/pnNetBase/pnNbError.cpp @@ -52,9 +52,9 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com //============================================================================ // These errors should only be used in debugging. They should not be shown // in release clients because they are not localized -const wchar * NetErrorToString (ENetError code) { +const wchar_t * NetErrorToString (ENetError code) { - static const wchar* s_errors[] = { + static const wchar_t* s_errors[] = { L"Success", // kNetSuccess L"Internal Error", // kNetErrInternalError L"No Response From Server", // kNetErrTimeout @@ -119,9 +119,9 @@ const wchar * NetErrorToString (ENetError code) { //============================================================================ // These errors should only be used in debugging. They should not be shown // in release clients because they are not localized -const wchar * NetErrorAsString (ENetError code) { +const wchar_t * NetErrorAsString (ENetError code) { - static const wchar* s_errors[] = { + static const wchar_t* s_errors[] = { L"kNetSuccess", L"kNetErrInternalError", L"kNetErrTimeout", diff --git a/Sources/Plasma/NucleusLib/pnNetBase/pnNbError.h b/Sources/Plasma/NucleusLib/pnNetBase/pnNbError.h index 8fdd2129..4ef1a747 100644 --- a/Sources/Plasma/NucleusLib/pnNetBase/pnNbError.h +++ b/Sources/Plasma/NucleusLib/pnNetBase/pnNbError.h @@ -43,7 +43,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #ifndef pnNbError_inc #define pnNbError_inc -#include "hsTypes.h" +#include "HeadSpin.h" #include "pnNbConst.h" /***************************************************************************** @@ -113,17 +113,17 @@ enum ENetError { // (don't worry, the compiler will tell you if one is missing ;) kNumNetErrors, - // Net messages require ENetError to be sizeof(dword) - kNetErrorForceDword = (dword)(-1) + // Net messages require ENetError to be sizeof(uint32_t) + kNetErrorForceDword = (uint32_t)(-1) }; -//COMPILER_ASSERT_HEADER(pnNbError, sizeof(ENetError) == sizeof(dword)); +//COMPILER_ASSERT_HEADER(pnNbError, sizeof(ENetError) == sizeof(uint32_t)); #define IS_NET_ERROR(a) (((int)(a)) > kNetSuccess) #define IS_NET_SUCCESS(a) (((int)(a)) == kNetSuccess) -const wchar * NetErrorToString (ENetError code); // user-friendly string -const wchar * NetErrorAsString (ENetError code); // string version of enum identifier +const wchar_t * NetErrorToString (ENetError code); // user-friendly string +const wchar_t * NetErrorAsString (ENetError code); // string version of enum identifier #endif // pnNbError_inc diff --git a/Sources/Plasma/NucleusLib/pnNetBase/pnNbKeys.cpp b/Sources/Plasma/NucleusLib/pnNetBase/pnNbKeys.cpp index a6d24f5a..689013c2 100644 --- a/Sources/Plasma/NucleusLib/pnNetBase/pnNbKeys.cpp +++ b/Sources/Plasma/NucleusLib/pnNetBase/pnNbKeys.cpp @@ -43,17 +43,17 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "pnNbKeys.h" // Auth Server -byte kAuthDhNData[kNetDiffieHellmanKeyBits / 8] = {0}; -byte kAuthDhXData[kNetDiffieHellmanKeyBits / 8] = {0}; +uint8_t kAuthDhNData[kNetDiffieHellmanKeyBits / 8] = {0}; +uint8_t kAuthDhXData[kNetDiffieHellmanKeyBits / 8] = {0}; // CSR Server -byte kCsrDhNData[kNetDiffieHellmanKeyBits / 8] = {0}; -byte kCsrDhXData[kNetDiffieHellmanKeyBits / 8] = {0}; +uint8_t kCsrDhNData[kNetDiffieHellmanKeyBits / 8] = {0}; +uint8_t kCsrDhXData[kNetDiffieHellmanKeyBits / 8] = {0}; // Game Server -byte kGameDhNData[kNetDiffieHellmanKeyBits / 8] = {0}; -byte kGameDhXData[kNetDiffieHellmanKeyBits / 8] = {0}; +uint8_t kGameDhNData[kNetDiffieHellmanKeyBits / 8] = {0}; +uint8_t kGameDhXData[kNetDiffieHellmanKeyBits / 8] = {0}; // GateKeeper Server -byte kGateKeeperDhNData[kNetDiffieHellmanKeyBits / 8] = {0}; -byte kGateKeeperDhXData[kNetDiffieHellmanKeyBits / 8] = {0}; +uint8_t kGateKeeperDhNData[kNetDiffieHellmanKeyBits / 8] = {0}; +uint8_t kGateKeeperDhXData[kNetDiffieHellmanKeyBits / 8] = {0}; diff --git a/Sources/Plasma/NucleusLib/pnNetBase/pnNbKeys.h b/Sources/Plasma/NucleusLib/pnNetBase/pnNbKeys.h index 0619f414..f5dce58b 100644 --- a/Sources/Plasma/NucleusLib/pnNetBase/pnNbKeys.h +++ b/Sources/Plasma/NucleusLib/pnNetBase/pnNbKeys.h @@ -43,27 +43,27 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #ifndef pnNbKeys_inc #define pnNbKeys_inc -#include "hsTypes.h" +#include "HeadSpin.h" #include "pnNbConst.h" // Auth Server static const unsigned kAuthDhGValue = 41; -extern byte kAuthDhNData[kNetDiffieHellmanKeyBits / 8]; -extern byte kAuthDhXData[kNetDiffieHellmanKeyBits / 8]; +extern uint8_t kAuthDhNData[kNetDiffieHellmanKeyBits / 8]; +extern uint8_t kAuthDhXData[kNetDiffieHellmanKeyBits / 8]; // CSR Server static const unsigned kCsrDhGValue = 97; -extern byte kCsrDhNData[kNetDiffieHellmanKeyBits / 8]; -extern byte kCsrDhXData[kNetDiffieHellmanKeyBits / 8]; +extern uint8_t kCsrDhNData[kNetDiffieHellmanKeyBits / 8]; +extern uint8_t kCsrDhXData[kNetDiffieHellmanKeyBits / 8]; // Game Server static const unsigned kGameDhGValue = 73; -extern byte kGameDhNData[kNetDiffieHellmanKeyBits / 8]; -extern byte kGameDhXData[kNetDiffieHellmanKeyBits / 8]; +extern uint8_t kGameDhNData[kNetDiffieHellmanKeyBits / 8]; +extern uint8_t kGameDhXData[kNetDiffieHellmanKeyBits / 8]; // GateKeeper Server static const unsigned kGateKeeperDhGValue = 4; -extern byte kGateKeeperDhNData[kNetDiffieHellmanKeyBits / 8]; -extern byte kGateKeeperDhXData[kNetDiffieHellmanKeyBits / 8]; +extern uint8_t kGateKeeperDhNData[kNetDiffieHellmanKeyBits / 8]; +extern uint8_t kGateKeeperDhXData[kNetDiffieHellmanKeyBits / 8]; #endif // pnNbKeys_inc diff --git a/Sources/Plasma/NucleusLib/pnNetBase/pnNbProtocol.cpp b/Sources/Plasma/NucleusLib/pnNetBase/pnNbProtocol.cpp index 2ee52cc8..80b5955d 100644 --- a/Sources/Plasma/NucleusLib/pnNetBase/pnNbProtocol.cpp +++ b/Sources/Plasma/NucleusLib/pnNetBase/pnNbProtocol.cpp @@ -50,9 +50,9 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com ***/ //============================================================================ -const wchar * NetProtocolToString (ENetProtocol protocol) { +const wchar_t * NetProtocolToString (ENetProtocol protocol) { - static struct { ENetProtocol protocol; const wchar *name; } s_protocols[] = { + static struct { ENetProtocol protocol; const wchar_t *name; } s_protocols[] = { { kNetProtocolNil, L"kNetProtocolNil" }, // For test applications diff --git a/Sources/Plasma/NucleusLib/pnNetBase/pnNbProtocol.h b/Sources/Plasma/NucleusLib/pnNetBase/pnNbProtocol.h index 8220b6ef..63fa92cb 100644 --- a/Sources/Plasma/NucleusLib/pnNetBase/pnNbProtocol.h +++ b/Sources/Plasma/NucleusLib/pnNetBase/pnNbProtocol.h @@ -43,7 +43,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #ifndef pnNbProtocol_inc #define pnNbProtocol_inc -#include "hsTypes.h" +#include "HeadSpin.h" #include "pnNbConst.h" /***************************************************************************** @@ -84,6 +84,6 @@ enum ENetProtocol { // NetProtocolToString as well. Unfortunately, the compiler // cannot enforce this since the protocol values are not // numerically sequential. -const wchar * NetProtocolToString (ENetProtocol protocol); +const wchar_t * NetProtocolToString (ENetProtocol protocol); #endif // pnNbProtocol_inc diff --git a/Sources/Plasma/NucleusLib/pnNetBase/pnNbSrvs.cpp b/Sources/Plasma/NucleusLib/pnNetBase/pnNbSrvs.cpp index 6b49ab43..6e624224 100644 --- a/Sources/Plasma/NucleusLib/pnNetBase/pnNbSrvs.cpp +++ b/Sources/Plasma/NucleusLib/pnNetBase/pnNbSrvs.cpp @@ -53,26 +53,26 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com * ***/ -static wchar s_authAddrConsole[64] = {0}; -static const wchar * s_authAddrs[] = { +static wchar_t s_authAddrConsole[64] = {0}; +static const wchar_t * s_authAddrs[] = { s_authAddrConsole }; -static wchar s_fileAddrConsole[64] = {0}; -static const wchar * s_fileAddrs[] = { +static wchar_t s_fileAddrConsole[64] = {0}; +static const wchar_t * s_fileAddrs[] = { s_fileAddrConsole }; -static wchar s_csrAddrConsole[64] = {0}; -static const wchar * s_csrAddrs[] = { +static wchar_t s_csrAddrConsole[64] = {0}; +static const wchar_t * s_csrAddrs[] = { s_csrAddrConsole }; -static wchar s_gateKeeperAddrConsole[64] = {0}; -static const wchar * s_gateKeeperAddrs[] = { +static wchar_t s_gateKeeperAddrConsole[64] = {0}; +static const wchar_t * s_gateKeeperAddrs[] = { s_gateKeeperAddrConsole }; @@ -86,14 +86,14 @@ static const wchar * s_gateKeeperAddrs[] = { //============================================================================ // Auth //============================================================================ -unsigned GetAuthSrvHostnames (const wchar *** addrs) { +unsigned GetAuthSrvHostnames (const wchar_t *** addrs) { *addrs = s_authAddrs; return arrsize(s_authAddrs); } //============================================================================ -void SetAuthSrvHostname (const wchar addr[]) { +void SetAuthSrvHostname (const wchar_t addr[]) { wcsncpy(s_authAddrConsole, addr, arrsize(s_authAddrConsole)); } @@ -101,14 +101,14 @@ void SetAuthSrvHostname (const wchar addr[]) { //============================================================================ // File //============================================================================ -unsigned GetFileSrvHostnames (const wchar *** addrs) { +unsigned GetFileSrvHostnames (const wchar_t *** addrs) { *addrs = s_fileAddrs; return arrsize(s_fileAddrs); } //============================================================================ -void SetFileSrvHostname (const wchar addr[]) { +void SetFileSrvHostname (const wchar_t addr[]) { wcsncpy(s_fileAddrConsole, addr, arrsize(s_fileAddrConsole)); } @@ -116,14 +116,14 @@ void SetFileSrvHostname (const wchar addr[]) { //============================================================================ // Csr //============================================================================ -unsigned GetCsrSrvHostnames (const wchar *** addrs) { +unsigned GetCsrSrvHostnames (const wchar_t *** addrs) { *addrs = s_csrAddrs; return arrsize(s_csrAddrs); } //============================================================================ -void SetCsrSrvHostname (const wchar addr[]) { +void SetCsrSrvHostname (const wchar_t addr[]) { wcsncpy(s_csrAddrConsole, addr, arrsize(s_csrAddrConsole)); } @@ -132,14 +132,14 @@ void SetCsrSrvHostname (const wchar addr[]) { //============================================================================ // GateKeeper //============================================================================ -unsigned GetGateKeeperSrvHostnames (const wchar *** addrs) { +unsigned GetGateKeeperSrvHostnames (const wchar_t *** addrs) { *addrs = s_gateKeeperAddrs; return arrsize(s_gateKeeperAddrs); } //============================================================================ -void SetGateKeeperSrvHostname (const wchar addr[]) { +void SetGateKeeperSrvHostname (const wchar_t addr[]) { wcsncpy(s_gateKeeperAddrConsole, addr, arrsize(s_gateKeeperAddrConsole)); } @@ -147,36 +147,36 @@ void SetGateKeeperSrvHostname (const wchar addr[]) { //============================================================================ // User-visible Server //============================================================================ -static wchar s_serverStatusUrl[256] = {0}; -static wchar s_serverSignupUrl[256] = {0}; -static wchar s_serverName[256] = {0}; +static wchar_t s_serverStatusUrl[256] = {0}; +static wchar_t s_serverSignupUrl[256] = {0}; +static wchar_t s_serverName[256] = {0}; //============================================================================ -const wchar *GetServerStatusUrl () { +const wchar_t *GetServerStatusUrl () { return s_serverStatusUrl; } //============================================================================ -void SetServerStatusUrl (const wchar url[]) { +void SetServerStatusUrl (const wchar_t url[]) { wcsncpy(s_serverStatusUrl, url, arrsize(s_serverStatusUrl)); } //============================================================================ -const wchar *GetServerSignupUrl () { +const wchar_t *GetServerSignupUrl () { return s_serverSignupUrl; } //============================================================================ -void SetServerSignupUrl (const wchar url[]) { +void SetServerSignupUrl (const wchar_t url[]) { wcsncpy(s_serverSignupUrl, url, arrsize(s_serverSignupUrl)); } //============================================================================ -const wchar *GetServerDisplayName () { +const wchar_t *GetServerDisplayName () { return s_serverName; } //============================================================================ -void SetServerDisplayName (const wchar name[]) { +void SetServerDisplayName (const wchar_t name[]) { wcsncpy(s_serverName, name, arrsize(s_serverName)); } diff --git a/Sources/Plasma/NucleusLib/pnNetBase/pnNbSrvs.h b/Sources/Plasma/NucleusLib/pnNetBase/pnNbSrvs.h index c4a932f3..04ea2c9c 100644 --- a/Sources/Plasma/NucleusLib/pnNetBase/pnNbSrvs.h +++ b/Sources/Plasma/NucleusLib/pnNetBase/pnNbSrvs.h @@ -43,7 +43,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #ifndef pnNbSrvs_inc #define pnNbSrvs_inc -#include "hsTypes.h" +#include "HeadSpin.h" #include "pnNbConst.h" /***************************************************************************** @@ -84,25 +84,25 @@ enum ESrvType { * ***/ -unsigned GetAuthSrvHostnames (const wchar *** addrs); // returns addrCount -void SetAuthSrvHostname (const wchar addr[]); +unsigned GetAuthSrvHostnames (const wchar_t *** addrs); // returns addrCount +void SetAuthSrvHostname (const wchar_t addr[]); -unsigned GetFileSrvHostnames (const wchar *** addrs); // returns addrCount -void SetFileSrvHostname (const wchar addr[]); +unsigned GetFileSrvHostnames (const wchar_t *** addrs); // returns addrCount +void SetFileSrvHostname (const wchar_t addr[]); -unsigned GetCsrSrvHostnames (const wchar *** addrs); // returns addrCount -void SetCsrSrvHostname (const wchar addr[]); +unsigned GetCsrSrvHostnames (const wchar_t *** addrs); // returns addrCount +void SetCsrSrvHostname (const wchar_t addr[]); -unsigned GetGateKeeperSrvHostnames (const wchar *** addrs); // returns addrCount -void SetGateKeeperSrvHostname (const wchar addr[]); +unsigned GetGateKeeperSrvHostnames (const wchar_t *** addrs); // returns addrCount +void SetGateKeeperSrvHostname (const wchar_t addr[]); -const wchar *GetServerStatusUrl (); -void SetServerStatusUrl (const wchar url[]); +const wchar_t *GetServerStatusUrl (); +void SetServerStatusUrl (const wchar_t url[]); -const wchar *GetServerSignupUrl (); -void SetServerSignupUrl (const wchar url[]); +const wchar_t *GetServerSignupUrl (); +void SetServerSignupUrl (const wchar_t url[]); -const wchar *GetServerDisplayName (); -void SetServerDisplayName (const wchar name[]); +const wchar_t *GetServerDisplayName (); +void SetServerDisplayName (const wchar_t name[]); #endif // pnNbSrvs_inc diff --git a/Sources/Plasma/NucleusLib/pnNetCli/Intern.h b/Sources/Plasma/NucleusLib/pnNetCli/Intern.h index dd89e6e2..d18855af 100644 --- a/Sources/Plasma/NucleusLib/pnNetCli/Intern.h +++ b/Sources/Plasma/NucleusLib/pnNetCli/Intern.h @@ -94,7 +94,7 @@ void NetMsgChannelGetDhConstants ( void NetMsgCryptClientStart ( NetMsgChannel * channel, unsigned seedBytes, - const byte seedData[], + const uint8_t seedData[], BigNum * clientSeed, BigNum * serverSeed ); @@ -102,7 +102,7 @@ void NetMsgCryptClientStart ( void NetMsgCryptServerConnect ( NetMsgChannel * channel, unsigned seedBytes, - const byte seedData[], + const uint8_t seedData[], BigNum * clientSeed ); @@ -114,12 +114,12 @@ void NetMsgCryptServerConnect ( ***/ class CInputAccumulator { - ARRAY(byte) buffer; - byte * curr; + ARRAY(uint8_t) buffer; + uint8_t * curr; public: CInputAccumulator (); - void Add (unsigned count, const byte * data); + void Add (unsigned count, const uint8_t * data); bool Get (unsigned count, void * dest); // returns false if request cannot be fulfilled bool Eof () const; void Clear (); diff --git a/Sources/Plasma/NucleusLib/pnNetCli/pnNcChannel.cpp b/Sources/Plasma/NucleusLib/pnNetCli/pnNcChannel.cpp index 6c8517c3..0db62460 100644 --- a/Sources/Plasma/NucleusLib/pnNetCli/pnNcChannel.cpp +++ b/Sources/Plasma/NucleusLib/pnNetCli/pnNcChannel.cpp @@ -110,7 +110,7 @@ ChannelCrit::~ChannelCrit () { channel->DecRef("ChannelLink"); } - DEL(s_channels); + delete s_channels; s_channels = nil; } LeaveSafe(); @@ -129,7 +129,7 @@ static unsigned ValidateMsg (const NetMsg & msg) { ASSERT(msg.fields); ASSERT(msg.count); - unsigned maxBytes = sizeof(word); // for message id + unsigned maxBytes = sizeof(uint16_t); // for message id bool prevFieldWasVarCount = false; for (unsigned i = 0; i < msg.count; i++) { @@ -160,7 +160,7 @@ static unsigned ValidateMsg (const NetMsg & msg) { prevFieldWasVarCount = false; switch (field.type) { case kNetMsgFieldInteger: - maxBytes += sizeof(qword); + maxBytes += sizeof(uint64_t); break; case kNetMsgFieldReal: @@ -261,14 +261,14 @@ static NetMsgChannel * FindChannel_CS (unsigned protocol, bool server) { //=========================================================================== static NetMsgChannel * FindOrCreateChannel_CS (unsigned protocol, bool server) { if (!s_channels) { - s_channels = NEW(LIST(NetMsgChannel)); + s_channels = new LIST(NetMsgChannel); s_channels->SetLinkOffset(offsetof(NetMsgChannel, m_link)); } // find or create protocol NetMsgChannel * channel = FindChannel_CS(protocol, server); if (!channel) { - channel = NEW(NetMsgChannel); + channel = new NetMsgChannel(); channel->m_protocol = protocol; channel->m_server = server; channel->m_largestRecv = 0; diff --git a/Sources/Plasma/NucleusLib/pnNetCli/pnNcCli.cpp b/Sources/Plasma/NucleusLib/pnNetCli/pnNcCli.cpp index 63137468..8d557b9d 100644 --- a/Sources/Plasma/NucleusLib/pnNetCli/pnNcCli.cpp +++ b/Sources/Plasma/NucleusLib/pnNetCli/pnNcCli.cpp @@ -127,20 +127,20 @@ struct NetCli : THashKeyVal { const NetMsgField * recvField; unsigned recvFieldBytes; bool recvDispatch; - byte * sendCurr; // points into sendBuffer + uint8_t * sendCurr; // points into sendBuffer CInputAccumulator input; // Message encryption ENetCliMode mode; FNetCliEncrypt encryptFcn; - byte seed[kNetMaxSymmetricSeedBytes]; + uint8_t seed[kNetMaxSymmetricSeedBytes]; CryptKey * cryptIn; // nil if encrytpion is disabled CryptKey * cryptOut; // nil if encrytpion is disabled void * encryptParam; // Message buffers - byte sendBuffer[kAsyncSocketBufferSize]; - ARRAY(byte) recvBuffer; + uint8_t sendBuffer[kAsyncSocketBufferSize]; + ARRAY(uint8_t) recvBuffer; }; struct NetCliQueue { @@ -169,7 +169,7 @@ namespace pnNetCli { //============================================================================ static void PutBufferOnWire (NetCli * cli, void * data, unsigned bytes) { - byte * temp, * heap = NULL; + uint8_t * temp = NULL; #ifndef PLASMA_EXTERNAL_RELEASE // Write to the netlog @@ -189,15 +189,9 @@ static void PutBufferOnWire (NetCli * cli, void * data, unsigned bytes) { #endif // PLASMA_EXTERNAL_RELEASE if (cli->mode == kNetCliModeEncrypted && cli->cryptOut) { - // Encrypt data... - if (bytes <= 2048) - // byte count is small, use stack-based buffer - temp = ALLOCA(byte, bytes); - else - // byte count is large, use heap-based buffer - temp = heap = (byte *)ALLOC(bytes); - - MemCopy(temp, data, bytes); + temp = (uint8_t *)malloc(bytes); + + memcpy(temp, data, bytes); CryptEncrypt(cli->cryptOut, bytes, temp); data = temp; } @@ -205,7 +199,7 @@ static void PutBufferOnWire (NetCli * cli, void * data, unsigned bytes) { AsyncSocketSend(cli->sock, data, bytes); // free heap buffer (if any) - FREE(heap); + free(temp); } //============================================================================ @@ -222,15 +216,15 @@ static void AddToSendBuffer ( unsigned bytes, void const * const data ) { - byte const * src = (byte const *) data; + uint8_t const * src = (uint8_t const *) data; if (bytes > arrsize(cli->sendBuffer)) { // Let the OS fragment oversize buffers FlushSendBuffer(cli); - void * heap = ALLOC(bytes); - MemCopy(heap, data, bytes); + void * heap = malloc(bytes); + memcpy(heap, data, bytes); PutBufferOnWire(cli, heap, bytes); - FREE(heap); + free(heap); } else { for (;;) { @@ -260,7 +254,7 @@ static void AddToSendBuffer ( //============================================================================ static void BufferedSendData ( NetCli * cli, - const unsigned_ptr msg[], + const uintptr_t msg[], unsigned fieldCount ) { #define ASSERT_MSG_VALID(expr) \ @@ -273,21 +267,21 @@ static void BufferedSendData ( if (!cli->sock) return; - unsigned_ptr const * const msgEnd = msg + fieldCount; + uintptr_t const * const msgEnd = msg + fieldCount; const NetMsgInitSend * sendMsg = NetMsgChannelFindSendMessage(cli->channel, msg[0]); ASSERT(msg[0] == sendMsg->msg.messageId); ASSERT(fieldCount-1 == sendMsg->msg.count); // insert messageId into command stream - const word msgId = hsToLE16((word)msg[0]); - AddToSendBuffer(cli, sizeof(word), (const void*)&msgId); + const uint16_t msgId = hsToLE16((uint16_t)msg[0]); + AddToSendBuffer(cli, sizeof(uint16_t), (const void*)&msgId); ++msg; ASSERT_MSG_VALID(msg < msgEnd); // insert fields into command stream - dword varCount = 0; - dword varSize = 0; + uint32_t varCount = 0; + uint32_t varSize = 0; const NetMsgField * cmd = sendMsg->msg.fields; const NetMsgField * cmdEnd = cmd + sendMsg->msg.count; for (; cmd < cmdEnd; ++msg, ++cmd) { @@ -295,39 +289,41 @@ static void BufferedSendData ( case kNetMsgFieldInteger: { const unsigned count = cmd->count ? cmd->count : 1; const unsigned bytes = cmd->size * count; - void * temp = ALLOCA(byte, bytes); + void * temp = malloc(bytes); if (count == 1) { // Single values are passed by value - if (cmd->size == sizeof(byte)) { - *(byte*)temp = *(byte*)msg; - } else if (cmd->size == sizeof(word)) { - *(word*)temp = hsToLE16(*(word*)msg); - } else if (cmd->size == sizeof(dword)) { - *(dword*)temp = hsToLE32(*(dword*)msg); - } else if (cmd->size == sizeof(qword)) { - *(qword*)temp = hsToLE64(*(qword*)msg); + if (cmd->size == sizeof(uint8_t)) { + *(uint8_t*)temp = *(uint8_t*)msg; + } else if (cmd->size == sizeof(uint16_t)) { + *(uint16_t*)temp = hsToLE16(*(uint16_t*)msg); + } else if (cmd->size == sizeof(uint32_t)) { + *(uint32_t*)temp = hsToLE32(*(uint32_t*)msg); + } else if (cmd->size == sizeof(uint64_t)) { + *(uint64_t*)temp = hsToLE64(*(uint64_t*)msg); } } else { // Value arrays are passed in by ptr for (int i = 0; i < count; i++) { - if (cmd->size == sizeof(byte)) { - ((byte*)temp)[i] = ((byte*)*msg)[i]; - } else if (cmd->size == sizeof(word)) { - ((word*)temp)[i] = hsToLE16(((word*)*msg)[i]); - } else if (cmd->size == sizeof(dword)) { - ((dword*)temp)[i] = hsToLE32(((dword*)*msg)[i]); - } else if (cmd->size == sizeof(qword)) { - ((qword*)temp)[i] = hsToLE64(((qword*)*msg)[i]); + if (cmd->size == sizeof(uint8_t)) { + ((uint8_t*)temp)[i] = ((uint8_t*)*msg)[i]; + } else if (cmd->size == sizeof(uint16_t)) { + ((uint16_t*)temp)[i] = hsToLE16(((uint16_t*)*msg)[i]); + } else if (cmd->size == sizeof(uint32_t)) { + ((uint32_t*)temp)[i] = hsToLE32(((uint32_t*)*msg)[i]); + } else if (cmd->size == sizeof(uint64_t)) { + ((uint64_t*)temp)[i] = hsToLE64(((uint64_t*)*msg)[i]); } } } // Write values to send buffer AddToSendBuffer(cli, bytes, temp); + + free(temp); } break; @@ -347,13 +343,13 @@ static void BufferedSendData ( case kNetMsgFieldString: { // Use less-than instead of less-or-equal because // we reserve one space for the NULL terminator - const word length = (word) StrLen((const wchar *) *msg); + const uint16_t length = (uint16_t) StrLen((const wchar_t *) *msg); ASSERT_MSG_VALID(length < cmd->count); // Write actual string length - word size = hsToLE16(length); - AddToSendBuffer(cli, sizeof(word), (const void*)&size); + uint16_t size = hsToLE16(length); + AddToSendBuffer(cli, sizeof(uint16_t), (const void*)&size); // Write string data - AddToSendBuffer(cli, length * sizeof(wchar), (const void *) *msg); + AddToSendBuffer(cli, length * sizeof(wchar_t), (const void *) *msg); } break; @@ -370,8 +366,8 @@ static void BufferedSendData ( // remember the element size varSize = cmd->size; // write the actual element count - varCount = hsToLE32((dword)*msg); - AddToSendBuffer(cli, sizeof(dword), (const void*)&varCount); + varCount = hsToLE32((uint32_t)*msg); + AddToSendBuffer(cli, sizeof(uint32_t), (const void*)&varCount); } break; @@ -404,7 +400,7 @@ static void BufferedSendData ( //=========================================================================== static bool DispatchData (NetCli * cli, void * param) { - word msgId = 0; + uint16_t msgId = 0; while (!cli->input.Eof()) { // if we're not already decompressing a message, start new message if (!cli->recvMsg) { @@ -424,8 +420,8 @@ static bool DispatchData (NetCli * cli, void * param) { cli->recvBuffer.ZeroCount(); cli->recvBuffer.Reserve(kAsyncSocketBufferSize); - // store the message id as dword into the destination buffer - dword * recvMsgId = (dword *) cli->recvBuffer.New(sizeof(dword)); + // store the message id as uint32_t into the destination buffer + uint32_t * recvMsgId = (uint32_t *) cli->recvBuffer.New(sizeof(uint32_t)); *recvMsgId = msgId; } @@ -443,21 +439,21 @@ static bool DispatchData (NetCli * cli, void * param) { // Get integer values const unsigned bytes = count * cli->recvField->size; - byte * data = cli->recvBuffer.New(bytes); + uint8_t * data = cli->recvBuffer.New(bytes); if (!cli->input.Get(bytes, data)) { cli->recvBuffer.ShrinkBy(bytes); goto NEED_MORE_DATA; } - // Byte-swap integers + // byte-swap integers // This is so screwed up >.< for (int i = 0; i < count; i++) { - if (cli->recvField->size == sizeof(word)) { - ((word*)data)[i] = hsToLE16(((word*)data)[i]); - } else if (cli->recvField->size == sizeof(dword)) { - ((dword*)data)[i] = hsToLE32(((dword*)data)[i]); - } else if (cli->recvField->size == sizeof(qword)) { - ((qword*)data)[i] = hsToLE64(((qword*)data)[i]); + if (cli->recvField->size == sizeof(uint16_t)) { + ((uint16_t*)data)[i] = hsToLE16(((uint16_t*)data)[i]); + } else if (cli->recvField->size == sizeof(uint32_t)) { + ((uint32_t*)data)[i] = hsToLE32(((uint32_t*)data)[i]); + } else if (cli->recvField->size == sizeof(uint64_t)) { + ((uint64_t*)data)[i] = hsToLE64(((uint64_t*)data)[i]); } } @@ -473,7 +469,7 @@ static bool DispatchData (NetCli * cli, void * param) { // Get float values const unsigned bytes = count * cli->recvField->size; - byte * data = cli->recvBuffer.New(bytes); + uint8_t * data = cli->recvBuffer.New(bytes); if (!cli->input.Get(bytes, data)) { cli->recvBuffer.ShrinkBy(bytes); goto NEED_MORE_DATA; @@ -487,7 +483,7 @@ static bool DispatchData (NetCli * cli, void * param) { case kNetMsgFieldRawData: { // Read fixed-length data into destination buffer const unsigned bytes = cli->recvField->count * cli->recvField->size; - byte * data = cli->recvBuffer.New(bytes); + uint8_t * data = cli->recvBuffer.New(bytes); if (!cli->input.Get(bytes, data)) { cli->recvBuffer.ShrinkBy(bytes); goto NEED_MORE_DATA; @@ -499,15 +495,15 @@ static bool DispatchData (NetCli * cli, void * param) { case kNetMsgFieldVarCount: { // Read var count field into destination buffer - const unsigned bytes = sizeof(dword); - byte * data = cli->recvBuffer.New(bytes); + const unsigned bytes = sizeof(uint32_t); + uint8_t * data = cli->recvBuffer.New(bytes); if (!cli->input.Get(bytes, data)) { cli->recvBuffer.ShrinkBy(bytes); goto NEED_MORE_DATA; } - // Byte-swap value - dword val = hsToLE32(*(dword*)data); + // byte-swap value + uint32_t val = hsToLE32(*(uint32_t*)data); // Prepare to read var-length field cli->recvFieldBytes = val * cli->recvField->size; @@ -520,7 +516,7 @@ static bool DispatchData (NetCli * cli, void * param) { case kNetMsgFieldRawVarPtr: { // Read var-length data into destination buffer const unsigned bytes = cli->recvFieldBytes; - byte * data = cli->recvBuffer.New(bytes); + uint8_t * data = cli->recvBuffer.New(bytes); if (!cli->input.Get(bytes, data)) { cli->recvBuffer.ShrinkBy(bytes); goto NEED_MORE_DATA; @@ -534,10 +530,10 @@ static bool DispatchData (NetCli * cli, void * param) { case kNetMsgFieldString: { if (!cli->recvFieldBytes) { // Read string length - word length; - if (!cli->input.Get(sizeof(word), &length)) + uint16_t length; + if (!cli->input.Get(sizeof(uint16_t), &length)) goto NEED_MORE_DATA; - cli->recvFieldBytes = hsToLE16(length) * sizeof(wchar); + cli->recvFieldBytes = hsToLE16(length) * sizeof(wchar_t); // Validate size. Use >= instead of > to leave room for the NULL terminator. if (cli->recvFieldBytes >= cli->recvField->count * cli->recvField->size) @@ -545,7 +541,7 @@ static bool DispatchData (NetCli * cli, void * param) { } const unsigned bytes = cli->recvField->count * cli->recvField->size; - byte * data = cli->recvBuffer.New(bytes); + uint8_t * data = cli->recvBuffer.New(bytes); // Read compressed string data (less than full field length) if (!cli->input.Get(cli->recvFieldBytes, data)) { cli->recvBuffer.ShrinkBy(bytes); @@ -553,9 +549,9 @@ static bool DispatchData (NetCli * cli, void * param) { } // Insert NULL terminator - * (wchar *)(data + cli->recvFieldBytes) = 0; + * (wchar_t *)(data + cli->recvFieldBytes) = 0; - // IDEA: fill the remainder with a freaky byte pattern + // IDEA: fill the remainder with a freaky uint8_t pattern // Field complete cli->recvFieldBytes = 0; @@ -616,20 +612,20 @@ enum { }; struct NetCli_PacketHeader { - byte message; - byte length; + uint8_t message; + uint8_t length; }; struct NetCli_Cli2Srv_Connect : NetCli_PacketHeader { - byte dh_y_data[kNetDiffieHellmanKeyBits / 8]; + uint8_t dh_y_data[kNetDiffieHellmanKeyBits / 8]; }; struct NetCli_Srv2Cli_Encrypt : NetCli_PacketHeader { - byte serverSeed[kNetMaxSymmetricSeedBytes]; + uint8_t serverSeed[kNetMaxSymmetricSeedBytes]; }; struct NetCli_Srv2Cli_Error : NetCli_PacketHeader { - dword error; // ENetError + uint32_t error; // ENetError }; #include @@ -637,17 +633,17 @@ struct NetCli_Srv2Cli_Error : NetCli_PacketHeader { //=========================================================================== static void CreateSymmetricKey ( unsigned serverBytes, - const byte * serverSeed, + const uint8_t * serverSeed, unsigned clientBytes, - const byte * clientSeed, + const uint8_t * clientSeed, unsigned outputBytes, - byte * outputSeed + uint8_t * outputSeed ) { ASSERT(clientBytes == kNetMaxSymmetricSeedBytes); ASSERT(serverBytes == kNetMaxSymmetricSeedBytes); ASSERT(outputBytes == kNetMaxSymmetricSeedBytes); for (unsigned i = 0; i < outputBytes; ++i) - outputSeed[i] = (byte) (clientSeed[i] ^ serverSeed[i]); + outputSeed[i] = (uint8_t) (clientSeed[i] ^ serverSeed[i]); } //============================================================================ @@ -666,10 +662,10 @@ static void ClientConnect (NetCli * cli) { // Save client seed { - ZERO(cli->seed); + memset(&cli->seed, 0, sizeof(cli->seed)); unsigned bytes; unsigned char * data = clientSeed.GetData_LE(&bytes); - MemCopy(cli->seed, data, min(bytes, sizeof(cli->seed))); + memcpy(cli->seed, data, min(bytes, sizeof(cli->seed))); delete [] data; } @@ -680,8 +676,8 @@ static void ClientConnect (NetCli * cli) { unsigned char * data = serverSeed.GetData_LE(&bytes); // will be 0 if encryption is disabled, and thereby send an empty seed ASSERTMSG(bytes <= sizeof(msg.dh_y_data), "4"); msg.message = kNetCliCli2SrvConnect; - msg.length = (byte) (sizeof(msg) - sizeof(msg.dh_y_data) + bytes); - MemCopy(msg.dh_y_data, data, bytes); + msg.length = (uint8_t) (sizeof(msg) - sizeof(msg.dh_y_data) + bytes); + memcpy(msg.dh_y_data, data, bytes); AsyncSocketSend(cli->sock, &msg, msg.length); delete [] data; } @@ -708,7 +704,7 @@ static bool ServerRecvConnect ( NetCli_Srv2Cli_Encrypt reply; reply.message = kNetCliSrv2CliEncrypt; reply.length = seedLength == 0 ? 0 : sizeof(reply); // reply with empty seed if we got empty seed (this means: no encryption) - MemCopy(reply.serverSeed, cli->seed, sizeof(reply.serverSeed)); + memcpy(reply.serverSeed, cli->seed, sizeof(reply.serverSeed)); AsyncSocketSend(cli->sock, &reply, reply.length); } @@ -718,7 +714,7 @@ static bool ServerRecvConnect ( } else { // Compute client seed - byte clientSeed[kNetMaxSymmetricSeedBytes]; + uint8_t clientSeed[kNetMaxSymmetricSeedBytes]; BigNum clientSeedValue; { NetMsgCryptServerConnect( @@ -728,16 +724,16 @@ static bool ServerRecvConnect ( &clientSeedValue ); - ZERO(clientSeed); + memset(&clientSeed, 0, sizeof(clientSeed)); unsigned bytes; unsigned char * data = clientSeedValue.GetData_LE(&bytes); - MemCopy(clientSeed, data, min(bytes, sizeof(clientSeed))); + memcpy(clientSeed, data, min(bytes, sizeof(clientSeed))); delete [] data; } // Create the symmetric key from a combination // of the client seed and the server seed - byte sharedSeed[kNetMaxSymmetricSeedBytes]; + uint8_t sharedSeed[kNetMaxSymmetricSeedBytes]; CreateSymmetricKey( sizeof(cli->seed), cli->seed, // server seed sizeof(clientSeed), clientSeed, // client seed @@ -776,7 +772,7 @@ static bool ClientRecvEncrypt ( // Create the symmetric key from a combination // of the client seed and the server seed - byte sharedSeed[kNetMaxSymmetricSeedBytes]; + uint8_t sharedSeed[kNetMaxSymmetricSeedBytes]; CreateSymmetricKey( sizeof(msg.serverSeed), msg.serverSeed, // server seed sizeof(cli->seed), cli->seed, // client seed @@ -855,7 +851,7 @@ static const FNetCliPacket s_recvTbl[kNumNetCliMsgs] = { static unsigned DispatchPacket ( NetCli * cli, unsigned bytes, - const byte data[] + const uint8_t data[] ) { for (;;) { const NetCli_PacketHeader & pkt = * (const NetCli_PacketHeader *) data; @@ -953,10 +949,10 @@ static NetCli * ConnCreate ( static void SetConnSeed ( NetCli * cli, unsigned seedBytes, - const byte seedData[] + const uint8_t seedData[] ) { if (seedBytes) - MemCopy(cli->seed, seedData, min(sizeof(cli->seed), seedBytes)); + memcpy(cli->seed, seedData, min(sizeof(cli->seed), seedBytes)); else CryptCreateRandomSeed(sizeof(cli->seed), cli->seed); } @@ -977,7 +973,7 @@ NetCli * NetCliConnectAccept ( bool unbuffered, FNetCliEncrypt encryptFcn, unsigned seedBytes, - const byte seedData[], + const uint8_t seedData[], void * encryptParam ) { // Create connection @@ -1000,7 +996,7 @@ NetCli * NetCliListenAccept ( bool unbuffered, FNetCliEncrypt encryptFcn, unsigned seedBytes, - const byte seedData[], + const uint8_t seedData[], void * encryptParam ) { // Create connection @@ -1079,7 +1075,7 @@ void NetCliDelete ( cli->input.Clear(); cli->recvBuffer.Clear(); - DEL(cli); + delete cli; } //============================================================================ @@ -1093,7 +1089,7 @@ void NetCliFlush ( //============================================================================ void NetCliSend ( NetCli * cli, - const unsigned_ptr msg[], + const uintptr_t msg[], unsigned count ) { BufferedSendData(cli, msg, count); @@ -1102,7 +1098,7 @@ void NetCliSend ( //============================================================================ bool NetCliDispatch ( NetCli * cli, - const byte data[], + const uint8_t data[], unsigned bytes, void * param ) { @@ -1112,17 +1108,12 @@ bool NetCliDispatch ( do { if (cli->mode == kNetCliModeEncrypted) { // Decrypt data... - byte * temp, * heap = NULL; + uint8_t * temp = NULL; if (cli->cryptIn) { - if (bytes <= 2048) - // byte count is small, use stack-based buffer - temp = ALLOCA(byte, bytes); - else - // byte count is large, use heap-based buffer - temp = heap = (byte *)ALLOC(bytes); + temp = (uint8_t *)malloc(bytes); - MemCopy(temp, data, bytes); + memcpy(temp, data, bytes); CryptDecrypt(cli->cryptIn, bytes, temp); data = temp; } @@ -1153,7 +1144,7 @@ bool NetCliDispatch ( #endif // free heap buffer (if any) - FREE(heap); + free(temp); cli->input.Compact(); return cli->recvDispatch; diff --git a/Sources/Plasma/NucleusLib/pnNetCli/pnNcEncrypt.cpp b/Sources/Plasma/NucleusLib/pnNetCli/pnNcEncrypt.cpp index ef52e2bc..12daec21 100644 --- a/Sources/Plasma/NucleusLib/pnNetCli/pnNcEncrypt.cpp +++ b/Sources/Plasma/NucleusLib/pnNetCli/pnNcEncrypt.cpp @@ -116,7 +116,7 @@ static void GetCachedServerKey ( void NetMsgCryptClientStart ( NetMsgChannel * channel, unsigned seedBytes, - const byte seedData[], + const uint8_t seedData[], BigNum * clientSeed, BigNum * serverSeed ) { @@ -146,7 +146,7 @@ void NetMsgCryptClientStart ( void NetMsgCryptServerConnect ( NetMsgChannel * channel, unsigned seedBytes, - const byte seedData[], + const uint8_t seedData[], BigNum * clientSeed ) { // Server computes client key: ka = y^a mod n diff --git a/Sources/Plasma/NucleusLib/pnNetCli/pnNcUtils.cpp b/Sources/Plasma/NucleusLib/pnNetCli/pnNcUtils.cpp index cde1e868..dbd43f98 100644 --- a/Sources/Plasma/NucleusLib/pnNetCli/pnNcUtils.cpp +++ b/Sources/Plasma/NucleusLib/pnNetCli/pnNcUtils.cpp @@ -62,7 +62,7 @@ CInputAccumulator::CInputAccumulator () { } //============================================================================ -void CInputAccumulator::Add (unsigned count, const byte * data) { +void CInputAccumulator::Add (unsigned count, const uint8_t * data) { // LogMsg(kLogPerf, L"Adding %u bytes to accumulator %p", count, this); unsigned offset = curr - buffer.Ptr(); buffer.Add(data, count); @@ -74,7 +74,7 @@ bool CInputAccumulator::Get (unsigned count, void * dest) { if (curr + count > buffer.Term()) return false; // LogMsg(kLogPerf, L"Removing %u bytes from accumulator %p", count, this); - MemCopy(dest, curr, count); + memcpy(dest, curr, count); curr += count; return true; } diff --git a/Sources/Plasma/NucleusLib/pnNetCli/pnNetCli.h b/Sources/Plasma/NucleusLib/pnNetCli/pnNetCli.h index 24221bb0..47b706f6 100644 --- a/Sources/Plasma/NucleusLib/pnNetCli/pnNetCli.h +++ b/Sources/Plasma/NucleusLib/pnNetCli/pnNetCli.h @@ -70,26 +70,26 @@ How to create a message sender/receiver: #include struct MoveObject { - dword messageId; - dword objectId; + uint32_t messageId; + uint32_t objectId; float newPos[3]; }; struct PlayerJoin { - dword messageId; - dword playerId; - wchar name[kPlayerNameMaxLength]; - byte data[kPlayerDataMaxLength]; - dword vaultDataLen; - byte vaultData[1]; // vaultData[vaultDataLen], actually + uint32_t messageId; + uint32_t playerId; + wchar_t name[kPlayerNameMaxLength]; + uint8_t data[kPlayerDataMaxLength]; + uint32_t vaultDataLen; + uint8_t vaultData[1]; // vaultData[vaultDataLen], actually // no more fields after variable-length data }; struct Ping { - dword messageId; - dword pingTimeMs; + uint32_t messageId; + uint32_t pingTimeMs; }; struct PingReply { - dword messageId; - dword pingTimeMs; + uint32_t messageId; + uint32_t pingTimeMs; } #include @@ -170,16 +170,16 @@ How to create a message sender/receiver: 5. Send messages static void SendMoveObject (NetCli client, const Object * obj) { - const unsigned_ptr msgMoveObject[] = { + const uintptr_t msgMoveObject[] = { kMsgMoveObject, obj->id, - 3, (unsigned_ptr) &obj->pos, + 3, (uintptr_t) &obj->pos, }; NetCliSend(client, msgMoveObject, arrsize(msgMoveObject)); } static void SendPlayerJoin (NetCli client, const Player * player) { - const unsigned_ptr msgPlayerJoin[] = { + const uintptr_t msgPlayerJoin[] = { kMsgPlayerJoin, player->name, player->data, @@ -190,7 +190,7 @@ How to create a message sender/receiver: }; static void SendPing (NetCli player) { - const unsigned_ptr msgPing[] = { + const uintptr_t msgPing[] = { kMsgPing, TimeGetMs(), }; @@ -200,10 +200,10 @@ How to create a message sender/receiver: 6. Receive messages - bool RecvMsgPing (const byte msg[], NetCli * from, void * param) { + bool RecvMsgPing (const uint8_t msg[], NetCli * from, void * param) { Player * player = (Player *) param; const Ping * ping = (const Ping *) msg; - const unsigned_ptr msgPingReply[] = { + const uintptr_t msgPingReply[] = { kMsgPingReply, ping->pingTimeMs, }; @@ -233,12 +233,12 @@ enum ENetMsgFieldType { kNetMsgFieldInteger, kNetMsgFieldReal, kNetMsgFieldString, // variable length unicode string - kNetMsgFieldData, // data with length <= sizeof(dword) + kNetMsgFieldData, // data with length <= sizeof(uint32_t) kNetMsgFieldPtr, // pointer to fixed length data kNetMsgFieldVarPtr, // pointer to variable length data // Non-compressible fields (images, sounds, encrypted data, etc) - kNetMsgFieldRawData, // data with length <= sizeof(dword) + kNetMsgFieldRawData, // data with length <= sizeof(uint32_t) kNetMsgFieldRawPtr, // pointer to fixed length data kNetMsgFieldRawVarPtr, // pointer to variable length data @@ -276,21 +276,21 @@ struct NetCliQueue; #define NET_MSG_FIELD(type, count, size) { type, count, size } -#define NET_MSG_FIELD_BYTE() NET_MSG_FIELD(kNetMsgFieldInteger, 0, sizeof(byte)) -#define NET_MSG_FIELD_WORD() NET_MSG_FIELD(kNetMsgFieldInteger, 0, sizeof(word)) -#define NET_MSG_FIELD_DWORD() NET_MSG_FIELD(kNetMsgFieldInteger, 0, sizeof(dword)) -#define NET_MSG_FIELD_QWORD() NET_MSG_FIELD(kNetMsgFieldInteger, 0, sizeof(qword)) +#define NET_MSG_FIELD_BYTE() NET_MSG_FIELD(kNetMsgFieldInteger, 0, sizeof(uint8_t)) +#define NET_MSG_FIELD_WORD() NET_MSG_FIELD(kNetMsgFieldInteger, 0, sizeof(uint16_t)) +#define NET_MSG_FIELD_DWORD() NET_MSG_FIELD(kNetMsgFieldInteger, 0, sizeof(uint32_t)) +#define NET_MSG_FIELD_QWORD() NET_MSG_FIELD(kNetMsgFieldInteger, 0, sizeof(uint64_t)) #define NET_MSG_FIELD_FLOAT() NET_MSG_FIELD(kNetMsgFieldReal, 0, sizeof(float)) #define NET_MSG_FIELD_DOUBLE() NET_MSG_FIELD(kNetMsgFieldReal, 0, sizeof(double)) -#define NET_MSG_FIELD_BYTE_ARRAY(maxCount) NET_MSG_FIELD(kNetMsgFieldInteger, maxCount, sizeof(byte)) -#define NET_MSG_FIELD_WORD_ARRAY(maxCount) NET_MSG_FIELD(kNetMsgFieldInteger, maxCount, sizeof(word)) -#define NET_MSG_FIELD_DWORD_ARRAY(maxCount) NET_MSG_FIELD(kNetMsgFieldInteger, maxCount, sizeof(dword)) -#define NET_MSG_FIELD_QWORD_ARRAY(maxCount) NET_MSG_FIELD(kNetMsgFieldInteger, maxCount, sizeof(qword)) +#define NET_MSG_FIELD_BYTE_ARRAY(maxCount) NET_MSG_FIELD(kNetMsgFieldInteger, maxCount, sizeof(uint8_t)) +#define NET_MSG_FIELD_WORD_ARRAY(maxCount) NET_MSG_FIELD(kNetMsgFieldInteger, maxCount, sizeof(uint16_t)) +#define NET_MSG_FIELD_DWORD_ARRAY(maxCount) NET_MSG_FIELD(kNetMsgFieldInteger, maxCount, sizeof(uint32_t)) +#define NET_MSG_FIELD_QWORD_ARRAY(maxCount) NET_MSG_FIELD(kNetMsgFieldInteger, maxCount, sizeof(uint64_t)) #define NET_MSG_FIELD_FLOAT_ARRAY(maxCount) NET_MSG_FIELD(kNetMsgFieldReal, maxCount, sizeof(float)) #define NET_MSG_FIELD_DOUBLE_ARRAY(maxCount) NET_MSG_FIELD(kNetMsgFieldReal, maxCount, sizeof(double)) -#define NET_MSG_FIELD_STRING(maxLength) NET_MSG_FIELD(kNetMsgFieldString, maxLength, sizeof(wchar)) +#define NET_MSG_FIELD_STRING(maxLength) NET_MSG_FIELD(kNetMsgFieldString, maxLength, sizeof(wchar_t)) #define NET_MSG_FIELD_DATA(maxBytes) NET_MSG_FIELD(kNetMsgFieldData, maxBytes, 1) #define NET_MSG_FIELD_PTR(maxBytes) NET_MSG_FIELD(kNetMsgFieldPtr, maxBytes, 1) @@ -314,7 +314,7 @@ struct NetMsgInitSend { }; struct NetMsgInitRecv { NetMsg msg; - bool (* recv)(const byte msg[], unsigned bytes, void * param); + bool (* recv)(const uint8_t msg[], unsigned bytes, void * param); }; void NetMsgProtocolRegister ( @@ -376,7 +376,7 @@ NetCli * NetCliConnectAccept ( bool unbuffered, FNetCliEncrypt encryptFcn, unsigned seedBytes, // optional - const byte seedData[], // optional + const uint8_t seedData[], // optional void * encryptParam // optional ); @@ -387,7 +387,7 @@ NetCli * NetCliListenAccept ( bool unbuffered, FNetCliEncrypt encryptFcn, unsigned seedBytes, // optional - const byte seedData[], // optional + const uint8_t seedData[], // optional void * encryptParam // optional ); #endif @@ -424,13 +424,13 @@ void NetCliFlush ( void NetCliSend ( NetCli * cli, - const unsigned_ptr msg[], + const uintptr_t msg[], unsigned count ); bool NetCliDispatch ( NetCli * cli, - const byte buffer[], + const uint8_t buffer[], unsigned bytes, void * param ); diff --git a/Sources/Plasma/NucleusLib/pnNetCommon/plGenericVar.cpp b/Sources/Plasma/NucleusLib/pnNetCommon/plGenericVar.cpp index aa1ef349..9109c4a4 100644 --- a/Sources/Plasma/NucleusLib/pnNetCommon/plGenericVar.cpp +++ b/Sources/Plasma/NucleusLib/pnNetCommon/plGenericVar.cpp @@ -70,11 +70,11 @@ void plGenericType::CopyFrom(const plGenericType& c) //// Conversion Functions //////////////////////////////////////////////////// -const Int32 & plGenericType::IToInt( void ) const +const int32_t & plGenericType::IToInt( void ) const { hsAssert( fType == kInt || fType == kAny, "Trying to use a non-int parameter as an int!" ); - static Int32 i; + static int32_t i; if( fType == kAny ) { hsAssert( fS != nil, "Weird parameter during conversion" ); @@ -85,11 +85,11 @@ const Int32 & plGenericType::IToInt( void ) const return fI; } -const UInt32 & plGenericType::IToUInt( void ) const +const uint32_t & plGenericType::IToUInt( void ) const { hsAssert( fType == kUInt || fType == kAny, "Trying to use a non-int parameter as an int!" ); - static UInt32 i; + static uint32_t i; if( fType == kAny ) { hsAssert( fS != nil, "Weird parameter during conversion" ); @@ -183,7 +183,7 @@ void plGenericType::Read(hsStream* s) fS=s->ReadSafeString(); break; case kBool: - {Int8 b; + {int8_t b; s->ReadLE( &b ); fB = b?true:false;} break; @@ -218,7 +218,7 @@ void plGenericType::Write(hsStream* s) s->WriteSafeString(fS); break; case kBool: - {Int8 b = fB?1:0; + {int8_t b = fB?1:0; s->WriteLE( b );} break; case kChar: @@ -304,7 +304,7 @@ void plGenericType::SetVar(Types t, unsigned int size, void* val) case kString : { delete [] fS; - fS = TRACKED_NEW char[size+1]; + fS = new char[size+1]; memcpy(fS,val,size); fS[size] = 0; break; diff --git a/Sources/Plasma/NucleusLib/pnNetCommon/plGenericVar.h b/Sources/Plasma/NucleusLib/pnNetCommon/plGenericVar.h index ba7f3cb4..eb27db91 100644 --- a/Sources/Plasma/NucleusLib/pnNetCommon/plGenericVar.h +++ b/Sources/Plasma/NucleusLib/pnNetCommon/plGenericVar.h @@ -42,8 +42,8 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #ifndef plGenericVar_inc #define plGenericVar_inc -#include "hsTypes.h" -#include "hsUtils.h" +#include "HeadSpin.h" + #include "hsStlUtils.h" #include "pnFactory/plCreatable.h" @@ -60,8 +60,8 @@ public: protected: union { - Int32 fI; - UInt32 fU; + int32_t fI; + uint32_t fU; float fF; double fD; bool fB; @@ -85,10 +85,10 @@ public: }; protected: - UInt8 fType; + uint8_t fType; - const Int32 &IToInt( void ) const; - const UInt32 &IToUInt( void ) const; + const int32_t &IToInt( void ) const; + const uint32_t &IToUInt( void ) const; const float &IToFloat( void ) const; const double &IToDouble( void ) const; const bool &IToBool( void ) const; @@ -106,8 +106,8 @@ public: void CopyFrom(const plGenericType& c); virtual void Reset(); - operator Int32() const { return IToInt(); } - operator UInt32() const { return IToUInt(); } + operator int32_t() const { return IToInt(); } + operator uint32_t() const { return IToUInt(); } operator double() const { return IToDouble(); } operator float() const { return IToFloat(); } operator bool() const { return IToBool(); } @@ -115,13 +115,13 @@ public: operator char() const { return IToChar(); } void SetType(Types t) { fType=t; } - UInt8 GetType( void ) const { return fType; } + uint8_t GetType( void ) const { return fType; } std::string GetAsStdString() const; // implicit set - void Set( Int32 i ) { fI = i; fType = kInt; } - void Set( UInt32 i ) { fU = i; fType = kUInt; } + void Set( int32_t i ) { fI = i; fType = kInt; } + void Set( uint32_t i ) { fU = i; fType = kUInt; } void Set( float f ) { fF = f; fType = kFloat; } void Set( double d ) { fD = d; fType = kDouble; } void Set( bool b ) { fB = b; fType = kBool; } @@ -129,8 +129,8 @@ public: void Set( char c ) { fC = c; fType = kChar; } // explicit set - void SetInt( Int32 i ) { fI = i; fType = kInt; } - void SetUInt( UInt32 i ) { fU = i; fType = kUInt; } + void SetInt( int32_t i ) { fI = i; fType = kInt; } + void SetUInt( uint32_t i ) { fU = i; fType = kUInt; } void SetFloat( float f ) { fF = f; fType = kFloat; } void SetDouble( double d ) { fD = d; fType = kDouble; } void SetBool( bool b ) { fB = b; fType = kBool; } @@ -182,8 +182,8 @@ public: void Write(hsStream* s, hsResMgr* mgr) { fValue.Write(s);} plGenericType& Value() { return fValue; } const plGenericType& Value() const { return fValue; } - operator Int32() const { return (Int32)fValue; } - operator UInt32() const { return (UInt32)fValue; } + operator int32_t() const { return (int32_t)fValue; } + operator uint32_t() const { return (uint32_t)fValue; } operator float() const { return (float)fValue; } operator double() const { return (double)fValue; } operator bool() const { return (bool)fValue; } diff --git a/Sources/Plasma/NucleusLib/pnNetCommon/plNetAddress.cpp b/Sources/Plasma/NucleusLib/pnNetCommon/plNetAddress.cpp index 0743066a..b2af6ac6 100644 --- a/Sources/Plasma/NucleusLib/pnNetCommon/plNetAddress.cpp +++ b/Sources/Plasma/NucleusLib/pnNetCommon/plNetAddress.cpp @@ -51,7 +51,7 @@ plNetAddress::plNetAddress() } -plNetAddress::plNetAddress(UInt32 addr, int port) +plNetAddress::plNetAddress(uint32_t addr, int port) { Clear(); SetHost(addr); @@ -110,7 +110,7 @@ std::string plNetAddress::GetHostString() const return std::string(pnNetCommon::GetTextAddr(fAddr.sin_addr.s_addr)); } -UInt32 plNetAddress::GetHost() const +uint32_t plNetAddress::GetHost() const { return fAddr.sin_addr.s_addr; } @@ -132,7 +132,7 @@ bool plNetAddress::SetHost(const char * hostname) return true; } -bool plNetAddress::SetHost(UInt32 addr) +bool plNetAddress::SetHost(uint32_t addr) { memcpy(&fAddr.sin_addr, &addr,sizeof(addr)); fAddr.sin_family = AF_INET; @@ -149,14 +149,14 @@ std::string plNetAddress::AsString() const void plNetAddress::Read(hsStream * s) { - s->ReadLE((UInt32*)&fAddr.sin_addr.s_addr); + s->ReadLE((uint32_t*)&fAddr.sin_addr.s_addr); s->ReadLE(&fAddr.sin_port); s->ReadLE(&fAddr.sin_family); } void plNetAddress::Write(hsStream * s) { - s->WriteLE((UInt32)fAddr.sin_addr.s_addr); + s->WriteLE((uint32_t)fAddr.sin_addr.s_addr); s->WriteLE(fAddr.sin_port); s->WriteLE(fAddr.sin_family); } diff --git a/Sources/Plasma/NucleusLib/pnNetCommon/plNetAddress.h b/Sources/Plasma/NucleusLib/pnNetCommon/plNetAddress.h index 6232f1ba..dda04dc5 100644 --- a/Sources/Plasma/NucleusLib/pnNetCommon/plNetAddress.h +++ b/Sources/Plasma/NucleusLib/pnNetCommon/plNetAddress.h @@ -44,12 +44,12 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #ifndef plNetAddress_h_inc #define plNetAddress_h_inc -#include "hsUtils.h" + #include "hsStlUtils.h" #include "hsStream.h" #if defined(HS_BUILD_FOR_WIN32) -#include "hsWindows.h" + #elif defined( HS_BUILD_FOR_UNIX ) #include #include @@ -73,7 +73,7 @@ class plNetAddress public: plNetAddress(); - plNetAddress(UInt32 addr, int port); + plNetAddress(uint32_t addr, int port); plNetAddress(const char * addr, int port); virtual ~plNetAddress(){} @@ -82,10 +82,10 @@ public: bool SetAnyPort(); bool SetPort(int port); bool SetHost(const char * hostname); - bool SetHost(UInt32 ip4addr); + bool SetHost(uint32_t ip4addr); int GetPort() const; std::string GetHostString() const; - UInt32 GetHost() const; + uint32_t GetHost() const; std::string GetHostWithPort() const; const AddressType & GetAddressInfo() const { return fAddr; } AddressType & GetAddressInfo() { return fAddr; } diff --git a/Sources/Plasma/NucleusLib/pnNetCommon/plNetApp.cpp b/Sources/Plasma/NucleusLib/pnNetCommon/plNetApp.cpp index 534eb70a..774c6211 100644 --- a/Sources/Plasma/NucleusLib/pnNetCommon/plNetApp.cpp +++ b/Sources/Plasma/NucleusLib/pnNetCommon/plNetApp.cpp @@ -113,7 +113,7 @@ void plNetClientApp::InheritNetMsgFlags(const plMessage* parentMsg, plMessage* c { if (childMsg) { - UInt32 childMsgFlags = childMsg->GetAllBCastFlags(); + uint32_t childMsgFlags = childMsg->GetAllBCastFlags(); InheritNetMsgFlags(parentMsg ? parentMsg->GetAllBCastFlags() : 0, &childMsgFlags, startCascade); childMsg->SetAllBCastFlags(childMsgFlags); } @@ -125,7 +125,7 @@ void plNetClientApp::InheritNetMsgFlags(const plMessage* parentMsg, plMessage* c // Set startCasCascade=true if called from outside the dispatcher, so that // the dispatcher won't mess with the flags when it goes to send out the msg. // -void plNetClientApp::InheritNetMsgFlags(UInt32 parentMsgFlags, UInt32* childMsgFlags, bool startCascade) +void plNetClientApp::InheritNetMsgFlags(uint32_t parentMsgFlags, uint32_t* childMsgFlags, bool startCascade) { if (!(*childMsgFlags & plMessage::kNetStartCascade)) { diff --git a/Sources/Plasma/NucleusLib/pnNetCommon/plNetApp.h b/Sources/Plasma/NucleusLib/pnNetCommon/plNetApp.h index ea9cb586..6ac0bc3f 100644 --- a/Sources/Plasma/NucleusLib/pnNetCommon/plNetApp.h +++ b/Sources/Plasma/NucleusLib/pnNetCommon/plNetApp.h @@ -42,7 +42,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #ifndef plNetApp_h #define plNetApp_h -#include "hsTypes.h" +#include "HeadSpin.h" #include "hsStlUtils.h" #include "hsBitVector.h" #include "plNetGroup.h" @@ -75,7 +75,7 @@ class plKey; class plNetMessage; typedef std::vector plNetMemberList; -typedef std::vector plNetPlayerIDList; +typedef std::vector plNetPlayerIDList; // // Common baseclasses for client and server net apps @@ -172,18 +172,18 @@ public: static plNetClientApp* GetInstance() { return plNetClientApp::ConvertNoRef(fInstance); } static const plNetClientApp* GetConstInstance() { return plNetClientApp::ConvertNoRef(fInstance); } static void InheritNetMsgFlags(const plMessage* parentMsg, plMessage* childMsg, bool startCascade); - static void InheritNetMsgFlags(UInt32 parentMsgFlags, UInt32* childMsgFlags, bool startCascade); + static void InheritNetMsgFlags(uint32_t parentMsgFlags, uint32_t* childMsgFlags, bool startCascade); static void UnInheritNetMsgFlags(plMessage* msg); // functions that all net client apps should implement virtual int SendMsg(plNetMessage* msg) = 0; - virtual UInt32 GetPlayerID() const = 0; + virtual uint32_t GetPlayerID() const = 0; virtual plString GetPlayerName( const plKey avKey=nil ) const = 0; // commonly used net client app functions virtual float GetCurrentAgeTimeOfDayPercent() const { hsAssert(false, "stub"); return 0.; } virtual bool ObjectInLocalAge(const plSynchedObject* obj) const { hsAssert(false, "stub"); return false; } - virtual UInt8 GetJoinOrder() const { hsAssert(false, "stub"); return 0; } + virtual uint8_t GetJoinOrder() const { hsAssert(false, "stub"); return 0; } virtual hsBool IsRemotePlayerKey(const plKey p, int* idx=nil) { hsAssert(false, "stub"); return false; } virtual plKey GetLocalPlayerKey() const { hsAssert(false, "stub"); return nil; } virtual plSynchedObject* GetLocalPlayer(hsBool forceLoad=false) const { hsAssert(false, "stub"); return nil; } diff --git a/Sources/Plasma/NucleusLib/pnNetCommon/plNetGroup.h b/Sources/Plasma/NucleusLib/pnNetCommon/plNetGroup.h index 1b785055..cf1474b6 100644 --- a/Sources/Plasma/NucleusLib/pnNetCommon/plNetGroup.h +++ b/Sources/Plasma/NucleusLib/pnNetCommon/plNetGroup.h @@ -56,12 +56,12 @@ private: }; plLocation fId; - UInt8 fFlags; + uint8_t fFlags; std::string fDesc; // description of room public: plNetGroupId() : fFlags(0) {} - plNetGroupId(const plLocation& id, const UInt8 flags) : fId(id), fFlags(flags) { } + plNetGroupId(const plLocation& id, const uint8_t flags) : fId(id), fFlags(flags) { } plNetGroupId(const plLocation& id) : fId(id), fFlags(0) { } hsBool IsConstant() { return (fFlags & kNetGroupConstant) != 0; } diff --git a/Sources/Plasma/NucleusLib/pnNetCommon/plNetResManager.cpp b/Sources/Plasma/NucleusLib/pnNetCommon/plNetResManager.cpp index 6235e436..5b3610d1 100644 --- a/Sources/Plasma/NucleusLib/pnNetCommon/plNetResManager.cpp +++ b/Sources/Plasma/NucleusLib/pnNetCommon/plNetResManager.cpp @@ -78,7 +78,7 @@ plNetResManager::~plNetResManager() plCreatable* plNetResManager::IReadCreatable(hsStream* s) const { - UInt16 hClass = s->ReadLE16(); + uint16_t hClass = s->ReadLE16(); if (plFactory::CanCreate(hClass)) { plCreatable *pCre = plFactory::Create(hClass); diff --git a/Sources/Plasma/NucleusLib/pnNetCommon/plNetServers.cpp b/Sources/Plasma/NucleusLib/pnNetCommon/plNetServers.cpp index 4f8cb472..4ea2f410 100644 --- a/Sources/Plasma/NucleusLib/pnNetCommon/plNetServers.cpp +++ b/Sources/Plasma/NucleusLib/pnNetCommon/plNetServers.cpp @@ -119,7 +119,7 @@ const char* plNetServerConstants::GetServerName(int type) } } -UInt16 plNetServerConstants::GetPort(int type) +uint16_t plNetServerConstants::GetPort(int type) { switch(type) { diff --git a/Sources/Plasma/NucleusLib/pnNetCommon/plNetServers.h b/Sources/Plasma/NucleusLib/pnNetCommon/plNetServers.h index e7939800..c742822d 100644 --- a/Sources/Plasma/NucleusLib/pnNetCommon/plNetServers.h +++ b/Sources/Plasma/NucleusLib/pnNetCommon/plNetServers.h @@ -46,7 +46,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // Server Declarations and Constants // -#include "hsTypes.h" +#include "HeadSpin.h" // // Windows Class Name for All Servers @@ -79,7 +79,7 @@ private: public: static const char* GetServerExe(int type) { return (type > kInvalidLo && type < kInvalidHi)?ServerPrograms[type-1]:nil; } static const char* GetServerName(int type); - static UInt16 GetPort(int type); + static uint16_t GetPort(int type); static const char* GetServerTypeStr(int type) { switch(type) @@ -102,7 +102,7 @@ class plNetServerAgentConstants { public: static const char* GetName() { return "Server_Agent"; } - static const UInt16 GetPort() { return 4800; } + static const uint16_t GetPort() { return 4800; } static const plNetServerConstants::ServerTypes GetType() { return plNetServerConstants::kAgent; } }; @@ -111,7 +111,7 @@ class plNetLookupServerConstants { public: static const char* GetName() { return "Lookup_Server"; } - static const UInt16 GetPort() { return 2000; } + static const uint16_t GetPort() { return 2000; } static const plNetServerConstants::ServerTypes GetType() { return plNetServerConstants::kLookup; } }; @@ -120,7 +120,7 @@ class plNetLobbyServerConstants { public: static const char* GetName() { return "Generated_Lobby"; } - static const UInt16 GetPort() { return 5000; } + static const uint16_t GetPort() { return 5000; } static const plNetServerConstants::ServerTypes GetType() { return plNetServerConstants::kLobby; } }; @@ -129,7 +129,7 @@ class plNetVaultServerConstants { public: static const char* GetName() { return "Vault_Server"; } - static const UInt16 GetPort() { return 2001; } + static const uint16_t GetPort() { return 2001; } static const plNetServerConstants::ServerTypes GetType() { return plNetServerConstants::kVault; } }; @@ -138,7 +138,7 @@ class plNetAuthServerConstants { public: static const char* GetName() { return "Auth_Server"; } - static const UInt16 GetPort() { return 2002; } + static const uint16_t GetPort() { return 2002; } static const plNetServerConstants::ServerTypes GetType() { return plNetServerConstants::kAuth; } }; @@ -147,7 +147,7 @@ class plNetAdminServerConstants { public: static const char* GetName() { return "Admin_Server"; } - static const UInt16 GetPort() { return 2003; } + static const uint16_t GetPort() { return 2003; } static const plNetServerConstants::ServerTypes GetType() { return plNetServerConstants::kAdmin; } }; @@ -155,8 +155,8 @@ class plNetGameServerConstants { public: static const char* GetName() { return "Game_Server"; } - static const UInt16 GetLowPort() { return 5001;} - static const UInt16 GetHighPort() { return 6001;} + static const uint16_t GetLowPort() { return 5001;} + static const uint16_t GetHighPort() { return 6001;} static const plNetServerConstants::ServerTypes GetType() { return plNetServerConstants::kGame; } }; diff --git a/Sources/Plasma/NucleusLib/pnNetCommon/plNetSharedState.cpp b/Sources/Plasma/NucleusLib/pnNetCommon/plNetSharedState.cpp index a004b3c1..faa3278c 100644 --- a/Sources/Plasma/NucleusLib/pnNetCommon/plNetSharedState.cpp +++ b/Sources/Plasma/NucleusLib/pnNetCommon/plNetSharedState.cpp @@ -75,7 +75,7 @@ void plNetSharedState::Copy(plNetSharedState *ss) int i; for(i=0;iGetNumVars();i++) { - plGenericVar* sv = TRACKED_NEW plGenericVar; + plGenericVar* sv = new plGenericVar; *sv = *(ss->GetVar(i)); AddVar(sv); } @@ -86,14 +86,14 @@ void plNetSharedState::Read(hsStream* stream) Reset(); plMsgStdStringHelper::Peek(fName, stream); - Int32 num=stream->ReadLE32(); + int32_t num=stream->ReadLE32(); fServerMayDelete = stream->Readbool(); fVars.reserve(num); int i; for(i=0;iRead(stream); AddVar(v); } @@ -102,7 +102,7 @@ void plNetSharedState::Read(hsStream* stream) void plNetSharedState::Write(hsStream* stream) { plMsgStdStringHelper::Poke(fName, stream); - Int32 num=GetNumVars(); + int32_t num=GetNumVars(); stream->WriteLE32(num); stream->Writebool(fServerMayDelete); diff --git a/Sources/Plasma/NucleusLib/pnNetCommon/plNetSharedState.h b/Sources/Plasma/NucleusLib/pnNetCommon/plNetSharedState.h index 5ae6bae8..2733b05b 100644 --- a/Sources/Plasma/NucleusLib/pnNetCommon/plNetSharedState.h +++ b/Sources/Plasma/NucleusLib/pnNetCommon/plNetSharedState.h @@ -42,8 +42,8 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #ifndef plNetSharedState_inc #define plNetSharedState_inc -#include "hsTypes.h" -#include "hsUtils.h" +#include "HeadSpin.h" + #include "hsStlUtils.h" class hsStream; diff --git a/Sources/Plasma/NucleusLib/pnNetCommon/plSynchedObject.cpp b/Sources/Plasma/NucleusLib/pnNetCommon/plSynchedObject.cpp index 96d60f0f..5e650637 100644 --- a/Sources/Plasma/NucleusLib/pnNetCommon/plSynchedObject.cpp +++ b/Sources/Plasma/NucleusLib/pnNetCommon/plSynchedObject.cpp @@ -101,8 +101,8 @@ plSynchedValueBase* plSynchedObject::GetSynchedValue(int i) const void plSynchedObject::IAppendSynchedValueAddrOffset(AddrOffsetType synchedValueAddrOffset) { // copy to new larger array - AddrOffsetType* tmp = TRACKED_NEW AddrOffsetType[fNumSynchedValues+1]; - Int32 i; + AddrOffsetType* tmp = new AddrOffsetType[fNumSynchedValues+1]; + int32_t i; for(i=0;i>2; - hsAssert(hsABS(addrOff) < (UInt32)(1<<(sizeof(AddrOffsetType)<<3)), "address offset overflow"); + int32_t addrOff = ((int32_t)v - (int32_t)this)>>2; + hsAssert(hsABS(addrOff) < (uint32_t)(1<<(sizeof(AddrOffsetType)<<3)), "address offset overflow"); IAppendSynchedValueAddrOffset((AddrOffsetType)addrOff); - Int32 idx = fNumSynchedValues-1; + int32_t idx = fNumSynchedValues-1; hsAssert(idx<256, "index too big"); - return (UInt8)idx; + return (uint8_t)idx; } hsBool plSynchedObject::RemoveSynchedValue(plSynchedValueBase* v) @@ -155,7 +155,7 @@ hsBool plSynchedObject::RemoveSynchedValue(plSynchedValueBase* v) int idx=i; if (idxSetFlags(synchFlags); hsAssert(GetKey(), "nil key on synchedObject?"); @@ -203,7 +203,7 @@ void plSynchedObject::SendSDLStateMsg(const char* SDLStateName, UInt32 synchFlag // Tell an object to send an sdl state update. // The request will get queued (returns true) // -hsBool plSynchedObject::DirtySynchState(const char* SDLStateName, UInt32 synchFlags /*SendSDLStateFlags*/) +hsBool plSynchedObject::DirtySynchState(const char* SDLStateName, uint32_t synchFlags /*SendSDLStateFlags*/) { if (!IOKToDirty(SDLStateName)) { @@ -256,7 +256,7 @@ hsBool plSynchedObject::DirtySynchState(const char* SDLStateName, UInt32 synchFl // add state defn if not already there. // if there adjust flags if necessary // -void plSynchedObject::IAddDirtyState(plKey objKey, const char* sdlName, UInt32 sendFlags) +void plSynchedObject::IAddDirtyState(plKey objKey, const char* sdlName, uint32_t sendFlags) { bool found=false; std::vector::iterator it=fDirtyStates.begin(); @@ -336,7 +336,7 @@ void plSynchedObject::Read(hsStream* stream, hsResMgr* mgr) stream->ReadLE(&fSynchFlags); if (fSynchFlags & kExcludePersistentState) { - Int16 num; + int16_t num; stream->ReadLE(&num); fSDLExcludeList.clear(); int i; @@ -350,7 +350,7 @@ void plSynchedObject::Read(hsStream* stream, hsResMgr* mgr) if (fSynchFlags & kHasVolatileState) { - Int16 num; + int16_t num; stream->ReadLE(&num); fSDLVolatileList.clear(); int i; @@ -370,7 +370,7 @@ void plSynchedObject::Write(hsStream* stream, hsResMgr* mgr) if (fSynchFlags & kExcludePersistentState) { - Int16 num=fSDLExcludeList.size(); + int16_t num=fSDLExcludeList.size(); stream->WriteLE(num); SDLStateList::iterator it=fSDLExcludeList.begin(); @@ -382,7 +382,7 @@ void plSynchedObject::Write(hsStream* stream, hsResMgr* mgr) if (fSynchFlags & kHasVolatileState) { - Int16 num=fSDLVolatileList.size(); + int16_t num=fSDLVolatileList.size(); stream->WriteLE(num); SDLStateList::iterator it=fSDLVolatileList.begin(); @@ -471,7 +471,7 @@ bool plSynchedObject::IOKToDirty(const char* SDLStateName) const // // return true if this object should send his SDL msg (for persistence or synch) over the net // -bool plSynchedObject::IOKToNetwork(const char* sdlName, UInt32* synchFlags) const +bool plSynchedObject::IOKToNetwork(const char* sdlName, uint32_t* synchFlags) const { // determine destination bool dstServerOnly=false, dstClientsOnly=false, dstClientsAndServer=false; diff --git a/Sources/Plasma/NucleusLib/pnNetCommon/plSynchedObject.h b/Sources/Plasma/NucleusLib/pnNetCommon/plSynchedObject.h index b496d5a5..8a8eac08 100644 --- a/Sources/Plasma/NucleusLib/pnNetCommon/plSynchedObject.h +++ b/Sources/Plasma/NucleusLib/pnNetCommon/plSynchedObject.h @@ -42,7 +42,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #ifndef PLSYNCHOBJ_inc #define PLSYNCHOBJ_inc -#include "hsTypes.h" +#include "HeadSpin.h" #include "pnKeyedObject/hsKeyedObject.h" #include "pnKeyedObject/plKey.h" #include "hsStlUtils.h" @@ -91,19 +91,19 @@ public: struct StateDefn { plKey fObjKey; - UInt32 fSendFlags; + uint32_t fSendFlags; std::string fSDLName; plSynchedObject* GetObject() const { return plSynchedObject::ConvertNoRef(fObjKey->ObjectIsLoaded()); } StateDefn() : fObjKey(nil),fSendFlags(0) {} - StateDefn(plKey k, UInt32 f, const char* sdlName) : fObjKey(k),fSendFlags(f) { fSDLName=sdlName; } + StateDefn(plKey k, uint32_t f, const char* sdlName) : fObjKey(k),fSendFlags(f) { fSDLName=sdlName; } }; private: typedef std::vector SDLStateList; SDLStateList fSDLExcludeList; SDLStateList fSDLVolatileList; - UInt32 fSynchFlags; + uint32_t fSynchFlags; plNetGroupId fNetGroup; @@ -112,11 +112,11 @@ private: static std::vector fDirtyStates; static void IRemoveDirtyState(plKey o, const char* sdlName); - static void IAddDirtyState(plKey o, const char* sdlName, UInt32 sendFlags); + static void IAddDirtyState(plKey o, const char* sdlName, uint32_t sendFlags); bool IOKToDirty(const char* SDLStateName) const; SDLStateList::const_iterator IFindInSDLStateList(const SDLStateList& list, const char* sdlName) const; protected: - bool IOKToNetwork(const char* sdlName, UInt32* synchFlags) const; + bool IOKToNetwork(const char* sdlName, uint32_t* synchFlags) const; public: plSynchedObject(); virtual ~plSynchedObject(); @@ -132,23 +132,23 @@ public: plNetGroupId GetEffectiveNetGroup() const; // setters - void SetSynchFlagsBit(UInt32 f) { fSynchFlags |= f; } + void SetSynchFlagsBit(uint32_t f) { fSynchFlags |= f; } virtual void SetNetGroupConstant(plNetGroupId netGroup); virtual void SetNetGroup(plNetGroupId netGroup) { fNetGroup = netGroup; } plNetGroupId SelectNetGroup(plKey groupKey); - virtual hsBool DirtySynchState(const char* sdlName, UInt32 sendFlags); - void SendSDLStateMsg(const char* SDLStateName, UInt32 synchFlags); // don't use, only for net code + virtual hsBool DirtySynchState(const char* sdlName, uint32_t sendFlags); + void SendSDLStateMsg(const char* SDLStateName, uint32_t synchFlags); // don't use, only for net code - void ClearSynchFlagsBit(UInt32 f) { fSynchFlags &= ~f; } + void ClearSynchFlagsBit(uint32_t f) { fSynchFlags &= ~f; } // static static hsBool GetSynchDisabled() { return fSynchStateStack.size() ? fSynchStateStack.back() : true; } static void PushSynchDisabled(hsBool b) { fSynchStateStack.push_back(b); } static hsBool PopSynchDisabled(); static plSynchedObject* GetStaticSynchedObject() { return fStaticSynchedObj; } - static Int32 GetNumDirtyStates() { return fDirtyStates.size(); } - static plSynchedObject::StateDefn* GetDirtyState(Int32 i) { return &fDirtyStates[i]; } + static int32_t GetNumDirtyStates() { return fDirtyStates.size(); } + static plSynchedObject::StateDefn* GetDirtyState(int32_t i) { return &fDirtyStates[i]; } static void ClearDirtyState(std::vector& carryOver) { fDirtyStates=carryOver; } // IO @@ -184,13 +184,13 @@ public: // #ifdef USE_SYNCHED_VALUES public: - typedef UInt16 AddrOffsetType; - typedef UInt8 NumSynchedValuesType; - typedef UInt16 FlagsType; + typedef uint16_t AddrOffsetType; + typedef uint8_t NumSynchedValuesType; + typedef uint16_t FlagsType; friend class plSynchedValueBase; private: - AddrOffsetType* fSynchedValueAddrOffsets; // represent dwords offsets + AddrOffsetType* fSynchedValueAddrOffsets; // represent uint32_ts offsets NumSynchedValuesType fNumSynchedValues; // array of friends @@ -203,15 +203,15 @@ private: void IAppendSynchedValueAddrOffset(AddrOffsetType synchedValueAddrOffset); void IAppendSynchedValueFriend(plSynchedValueBase* v); plSynchedValueBase* IGetSynchedValue(NumSynchedValuesType i) const - { return (plSynchedValueBase*)((Int32)this + (fSynchedValueAddrOffsets[i]<<2)); } + { return (plSynchedValueBase*)((int32_t)this + (fSynchedValueAddrOffsets[i]<<2)); } plSynchedValueBase* IGetSynchedValueFriend(NumSynchedValuesType i) const { return fSynchedValueFriends[i]; } public: - Int32 GetNumSynchedValues() const { return fNumSynchedValues+fNumSynchedValueFriends; } + int32_t GetNumSynchedValues() const { return fNumSynchedValues+fNumSynchedValueFriends; } plSynchedValueBase* GetSynchedValue(int i) const; - UInt8 RegisterSynchedValue(plSynchedValueBase* v); + uint8_t RegisterSynchedValue(plSynchedValueBase* v); hsBool RemoveSynchedValue(plSynchedValueBase* v); // handles SVFriends too void RegisterSynchedValueFriend(plSynchedValueBase* v); #endif diff --git a/Sources/Plasma/NucleusLib/pnNetCommon/plSynchedValue.cpp b/Sources/Plasma/NucleusLib/pnNetCommon/plSynchedValue.cpp index 33e0211d..c5aca9c1 100644 --- a/Sources/Plasma/NucleusLib/pnNetCommon/plSynchedValue.cpp +++ b/Sources/Plasma/NucleusLib/pnNetCommon/plSynchedValue.cpp @@ -70,16 +70,16 @@ hsBitVector plSynchedValueBase::ISaveOrLoad(hsBitVector& v, hsBool32 save, hsStr return v; } -hsScalar plSynchedValueBase::ISaveOrLoad(hsScalar v, hsBool32 save, hsStream* stream, hsResMgr* mgr) +float plSynchedValueBase::ISaveOrLoad(float v, hsBool32 save, hsStream* stream, hsResMgr* mgr) ISaveOrLoadSimpleType(); double plSynchedValueBase::ISaveOrLoad(double v, hsBool32 save, hsStream* stream, hsResMgr* mgr) ISaveOrLoadSimpleType(); -Int32 plSynchedValueBase::ISaveOrLoad(Int32 v, hsBool32 save, hsStream* stream, hsResMgr* mgr) +int32_t plSynchedValueBase::ISaveOrLoad(int32_t v, hsBool32 save, hsStream* stream, hsResMgr* mgr) ISaveOrLoadSimpleType(); -UInt32 plSynchedValueBase::ISaveOrLoad(UInt32 v, hsBool32 save, hsStream* stream, hsResMgr* mgr) +uint32_t plSynchedValueBase::ISaveOrLoad(uint32_t v, hsBool32 save, hsStream* stream, hsResMgr* mgr) ISaveOrLoadSimpleType(); int plSynchedValueBase::ISaveOrLoad(int v, hsBool32 save, hsStream* stream, hsResMgr* mgr) @@ -100,7 +100,7 @@ const plKey plSynchedValueBase::ISaveOrLoad(const plKey key, hsBool32 save, hsSt stream->WriteByte(1); // I need to write a key to MY stream... #if 0 // DEBUG - Int32 len = hsStrlen(key->GetName()); + int32_t len = hsStrlen(key->GetName()); stream->WriteLE32(len); stream->Write(len, key->GetName()); #endif @@ -114,12 +114,12 @@ const plKey plSynchedValueBase::ISaveOrLoad(const plKey key, hsBool32 save, hsSt } else { - Int32 has=stream->ReadByte(); + int32_t has=stream->ReadByte(); if (has) { // read a key from MY stream #if 0 // DEBUG - Int32 len = stream->ReadLE32(); + int32_t len = stream->ReadLE32(); char tmp[256]; hsAssert(len<256, "key name overflow"); stream->Read(len, tmp); diff --git a/Sources/Plasma/NucleusLib/pnNetCommon/plSynchedValue.h b/Sources/Plasma/NucleusLib/pnNetCommon/plSynchedValue.h index fd238862..c3e18dab 100644 --- a/Sources/Plasma/NucleusLib/pnNetCommon/plSynchedValue.h +++ b/Sources/Plasma/NucleusLib/pnNetCommon/plSynchedValue.h @@ -45,7 +45,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "plSynchedObject.h" #ifdef USE_SYNCHED_VALUES -#include "hsTypes.h" +#include "HeadSpin.h" #include "hsStream.h" #include "hsBitVector.h" @@ -78,17 +78,17 @@ public: }; protected: - Int16 fSynchedObjectAddrOffset; // this could represent dwords instead of byte offsets - UInt16 fFlags; + int16_t fSynchedObjectAddrOffset; // this could represent uint32_ts instead of uint8_t offsets + uint16_t fFlags; void IConstruct() // too bad this can't be virtual (because it's called from ctor) { // The synchMgr for the class that owns us is constructed first and the staticMgr // is set to his address so we can automatically get at it during construction. fFlags=0; - Int32 off = (Int32)plSynchedObject::GetStaticSynchedObject() - (Int32)this; + int32_t off = (int32_t)plSynchedObject::GetStaticSynchedObject() - (int32_t)this; if ( hsABS(off) < (1<<(sizeof(fSynchedObjectAddrOffset)<<3)) ) - fSynchedObjectAddrOffset = (Int16)off; + fSynchedObjectAddrOffset = (int16_t)off; else fSynchedObjectAddrOffset=-1; } @@ -106,11 +106,11 @@ protected: hsKeyedObject* ISaveOrLoad(hsKeyedObject* obj, hsBool32 save, hsStream* stream, hsResMgr* mgr); plSceneNode* ISaveOrLoad(plSceneNode* obj, hsBool32 save, hsStream* stream, hsResMgr* mgr); plSceneObject* ISaveOrLoad(plSceneObject* obj, hsBool32 save, hsStream* stream, hsResMgr* mgr); - Int32 ISaveOrLoad(Int32 v, hsBool32 save, hsStream* stream, hsResMgr* mgr); - UInt32 ISaveOrLoad(UInt32 v, hsBool32 save, hsStream* stream, hsResMgr* mgr); + int32_t ISaveOrLoad(int32_t v, hsBool32 save, hsStream* stream, hsResMgr* mgr); + uint32_t ISaveOrLoad(uint32_t v, hsBool32 save, hsStream* stream, hsResMgr* mgr); bool ISaveOrLoad(bool v, hsBool32 save, hsStream* stream, hsResMgr* mgr); int ISaveOrLoad(int v, hsBool32 save, hsStream* stream, hsResMgr* mgr); // or hsBool32 - hsScalar ISaveOrLoad(hsScalar v, hsBool32 save, hsStream* stream, hsResMgr* mgr); + float ISaveOrLoad(float v, hsBool32 save, hsStream* stream, hsResMgr* mgr); double ISaveOrLoad(double v, hsBool32 save, hsStream* stream, hsResMgr* mgr); hsBitVector ISaveOrLoad(hsBitVector& v, hsBool32 save, hsStream* stream, hsResMgr* mgr); plCoordinateInterface* ISaveOrLoad(const plCoordinateInterface* cInt, hsBool32 save, hsStream* stream, hsResMgr* mgr); @@ -122,7 +122,7 @@ public: virtual plSynchedObject* GetSynchedObject() { hsAssert(fSynchedObjectAddrOffset!=-1, "invalid synchedObject address offset"); - plSynchedObject* so = fSynchedObjectAddrOffset == -1 ? nil : (plSynchedObject*)((Int32)this+fSynchedObjectAddrOffset); + plSynchedObject* so = fSynchedObjectAddrOffset == -1 ? nil : (plSynchedObject*)((int32_t)this+fSynchedObjectAddrOffset); if (!(fFlags & kRegistered) && so) { so->RegisterSynchedValue(this); @@ -130,10 +130,10 @@ public: } return so; } - UInt16 GetFlags() { return fFlags; } + uint16_t GetFlags() { return fFlags; } // setters - void SetFlags(UInt16 f) { fFlags=f; } + void SetFlags(uint16_t f) { fFlags=f; } void MakeDirty() { SetFlags(GetFlags() | kValueIsDirty); } void MakeClean() { SetFlags(GetFlags() & ~kValueIsDirty); } @@ -226,8 +226,8 @@ public: const T& GetValue() const { return fValue; } // for hsBitVector - hsBool32 IsBitSet(UInt32 which) const { return fValue.IsBitSet(which); } - hsBool32 SetBit(UInt32 which, hsBool32 on = true) + hsBool32 IsBitSet(uint32_t which) const { return fValue.IsBitSet(which); } + hsBool32 SetBit(uint32_t which, hsBool32 on = true) { hsBool32 bitSet = IsBitSet(which); if ( (on && !bitSet) || (!on && bitSet) ) DirtyIfNecessary(); @@ -236,10 +236,10 @@ public: void Read(hsStream* s) { fValue.Read(s); } void Write(hsStream* s) const { fValue.Write(s); } void Clear() { DirtyIfNecessary(); fValue.Clear(); } - hsBool32 ClearBit(UInt32 which) { if (fValue.IsBitSet(which)) DirtyIfNecessary(); return fValue.ClearBit(which); } + hsBool32 ClearBit(uint32_t which) { if (fValue.IsBitSet(which)) DirtyIfNecessary(); return fValue.ClearBit(which); } void Reset() { if (fValue.GetSize()!=0) DirtyIfNecessary(); fValue.Reset(); } - hsBool32 ToggleBit(UInt32 which) { DirtyIfNecessary(); return fValue.ToggleBit(which); } - UInt32 GetSize() { return fValue.GetSize(); } + hsBool32 ToggleBit(uint32_t which) { DirtyIfNecessary(); return fValue.ToggleBit(which); } + uint32_t GetSize() { return fValue.GetSize(); } }; ////////////////////////////////////// @@ -338,7 +338,7 @@ void plSynchedTArray::ISaveOrLoad(hsBool32 save, hsStream* stream, hsResMgr* if (save) { // write out size of array - Int32 i, num = fValueList.GetCount(); + int32_t i, num = fValueList.GetCount(); stream->WriteLE(num); for(i=0;i::ISaveOrLoad(hsBool32 save, hsStream* stream, hsResMgr* // clear array fValueList.Reset(); // read in size of array - Int32 i, num; + int32_t i, num; stream->ReadLE(&num); for(i=0;i # include # include # include # include // for memcpy -#else +#elif !defined(HS_BUILD_FOR_WIN32) #error "Not implemented for this platform" #endif @@ -59,7 +57,7 @@ namespace pnNetCommon #ifndef SERVER // NOTE: On Win32, WSAStartup() must be called before GetTextAddr() will work. -const char * GetTextAddr(UInt32 binAddr) +const char * GetTextAddr(uint32_t binAddr) { in_addr in; memcpy(&in,&binAddr,sizeof(binAddr)); @@ -67,9 +65,9 @@ const char * GetTextAddr(UInt32 binAddr) } // NOTE: On Win32, WSAStartup() must be called before GetBinAddr() will work. -UInt32 GetBinAddr(const char * textAddr) +uint32_t GetBinAddr(const char * textAddr) { - UInt32 addr = 0; + uint32_t addr = 0; if (!textAddr) return addr; @@ -100,7 +98,7 @@ void plCreatableStream::Write( hsStream* stream, hsResMgr* mgr ) { fStream.Rewind(); std::string buf; - UInt32 len = fStream.GetEOF(); + uint32_t len = fStream.GetEOF(); stream->WriteLE( len ); buf.resize( len ); fStream.Read( len, (void*)buf.data() ); @@ -112,7 +110,7 @@ void plCreatableStream::Read( hsStream* stream, hsResMgr* mgr ) { fStream.Rewind(); std::string buf; - UInt32 len; + uint32_t len; stream->LogReadLE( &len,"CreatableStream Len"); buf.resize( len ); stream->LogRead( len, (void*)buf.data(),"CreatableStream Data"); diff --git a/Sources/Plasma/NucleusLib/pnNetCommon/pnNetCommon.h b/Sources/Plasma/NucleusLib/pnNetCommon/pnNetCommon.h index 60849cab..a1c63f41 100644 --- a/Sources/Plasma/NucleusLib/pnNetCommon/pnNetCommon.h +++ b/Sources/Plasma/NucleusLib/pnNetCommon/pnNetCommon.h @@ -42,8 +42,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #ifndef pnNetCommon_h_inc #define pnNetCommon_h_inc -#include "hsConfig.h" -#include "hsTypes.h" +#include "HeadSpin.h" #include "hsStlUtils.h" #include "hsRefCnt.h" #include "hsStream.h" @@ -82,8 +81,8 @@ namespace pnNetCommon { #ifndef SERVER - UInt32 GetBinAddr(const char * textAddr); - const char * GetTextAddr(UInt32 binAddr); + uint32_t GetBinAddr(const char * textAddr); + const char * GetTextAddr(uint32_t binAddr); #endif // SERVER } diff --git a/Sources/Plasma/NucleusLib/pnNetDiag/Intern.h b/Sources/Plasma/NucleusLib/pnNetDiag/Intern.h index 70b1a044..f6b8fe36 100644 --- a/Sources/Plasma/NucleusLib/pnNetDiag/Intern.h +++ b/Sources/Plasma/NucleusLib/pnNetDiag/Intern.h @@ -54,7 +54,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com namespace ND { extern HMODULE g_lib; -extern const wchar g_version[]; +extern const wchar_t g_version[]; //============================================================================ @@ -75,7 +75,7 @@ inline unsigned NetProtocolToSrv (ENetProtocol protocol) { } //============================================================================ -inline const wchar * SrvToString (unsigned srv) { +inline const wchar_t * SrvToString (unsigned srv) { switch (srv) { case kDiagSrvAuth: return L"Auth"; @@ -92,13 +92,13 @@ struct NetDiag : AtomicRef { bool destroyed; CCritSect critsect; - wchar * hosts[kNumDiagSrvs]; + wchar_t * hosts[kNumDiagSrvs]; unsigned nodes[kNumDiagSrvs]; ~NetDiag (); void Destroy (); - void SetHost (unsigned srv, const wchar host[]); + void SetHost (unsigned srv, const wchar_t host[]); }; diff --git a/Sources/Plasma/NucleusLib/pnNetDiag/pnNdDns.cpp b/Sources/Plasma/NucleusLib/pnNetDiag/pnNdDns.cpp index 83d0613d..ff5a10f3 100644 --- a/Sources/Plasma/NucleusLib/pnNetDiag/pnNdDns.cpp +++ b/Sources/Plasma/NucleusLib/pnNetDiag/pnNdDns.cpp @@ -74,7 +74,7 @@ struct DNSParam { //============================================================================ static void LookupCallback ( void * param, - const wchar name[], + const wchar_t name[], unsigned addrCount, const NetAddress addrs[] ) { @@ -86,7 +86,7 @@ static void LookupCallback ( p->diag->nodes[p->srv] = node; } p->diag->critsect.Leave(); - wchar nodeStr[64]; + wchar_t nodeStr[64]; NetAddressNodeToString(p->diag->nodes[p->srv], nodeStr, arrsize(nodeStr)); p->dump(L"[DNS] Success. %s --> %s", name, nodeStr); p->callback( @@ -113,7 +113,7 @@ static void LookupCallback ( ); } p->diag->DecRef("DNS"); - DEL(p); + delete p; } @@ -157,7 +157,7 @@ void NetDiagDns ( return; } - wchar * host = nil; + wchar_t * host = nil; diag->critsect.Enter(); { if (diag->hosts[srv]) @@ -190,5 +190,5 @@ void NetDiagDns ( 0, dnsParam ); - FREE(host); + free(host); } diff --git a/Sources/Plasma/NucleusLib/pnNetDiag/pnNdIcmp.cpp b/Sources/Plasma/NucleusLib/pnNetDiag/pnNdIcmp.cpp index cc68ab16..b3a5ba30 100644 --- a/Sources/Plasma/NucleusLib/pnNetDiag/pnNdIcmp.cpp +++ b/Sources/Plasma/NucleusLib/pnNetDiag/pnNdIcmp.cpp @@ -90,7 +90,7 @@ static const unsigned kPayloadBytes = 32; static FIcmpCreateFile IcmpCreateFile; static FIcmpSendEcho IcmpSendEcho; -static byte s_payload[kPayloadBytes]; +static uint8_t s_payload[kPayloadBytes]; /***************************************************************************** @@ -100,7 +100,7 @@ static byte s_payload[kPayloadBytes]; ***/ //============================================================================ -static const wchar * IpStatusToString (ULONG status) { +static const wchar_t * IpStatusToString (ULONG status) { switch (status) { case IP_SUCCESS: return L"IP_SUCCESS"; @@ -140,13 +140,13 @@ static void __cdecl PingThreadProc (void * param) { } char addr[64]; - wchar waddr[64]; + wchar_t waddr[64]; NetAddressNodeToString(p->diag->nodes[p->srv], waddr, arrsize(waddr)); StrToAnsi(addr, waddr, arrsize(addr)); ENetError result = kNetSuccess; - byte reply[kPayloadBytes + sizeof(ICMP_ECHO_REPLY)]; + uint8_t reply[kPayloadBytes + sizeof(ICMP_ECHO_REPLY)]; for (unsigned i = 0; i < kPingCount; ++i) { DWORD retval = IcmpSendEcho( @@ -173,7 +173,7 @@ static void __cdecl PingThreadProc (void * param) { p->callback(p->diag, p->protocol, result, p->param); p->diag->DecRef("ICMP"); - DEL(p); + delete p; } @@ -190,7 +190,7 @@ void IcmpStartup () { IcmpCreateFile = (FIcmpCreateFile)GetProcAddress(g_lib, "IcmpCreateFile"); IcmpSendEcho = (FIcmpSendEcho)GetProcAddress(g_lib, "IcmpSendEcho"); } - MemSet(s_payload, (byte)((unsigned_ptr)&s_payload >> 4), arrsize(s_payload)); + memset(s_payload, (uint8_t)((uintptr_t)&s_payload >> 4), arrsize(s_payload)); } //============================================================================ @@ -245,7 +245,7 @@ void NetDiagIcmp ( return; } - wchar nodeStr[64]; + wchar_t nodeStr[64]; NetAddressNodeToString(node, nodeStr, arrsize(nodeStr)); dump(L"[ICMP] Pinging %s with %u bytes of data...", nodeStr, kPayloadBytes); diff --git a/Sources/Plasma/NucleusLib/pnNetDiag/pnNdTcp.cpp b/Sources/Plasma/NucleusLib/pnNetDiag/pnNdTcp.cpp index 38b686cf..6b240b50 100644 --- a/Sources/Plasma/NucleusLib/pnNetDiag/pnNdTcp.cpp +++ b/Sources/Plasma/NucleusLib/pnNetDiag/pnNdTcp.cpp @@ -86,7 +86,7 @@ struct FileConn : AtomicRef { void * param; AsyncSocket sock; AsyncCancelId cancelId; - ARRAY(byte) recvBuffer; + ARRAY(uint8_t) recvBuffer; long pingsInRoute; long pingsCompleted; bool done; @@ -121,7 +121,7 @@ static long s_authProtocolRegistered; static unsigned s_transId; static CCritSect s_critsect; static bool s_shutdown; -static byte s_payload[32]; +static uint8_t s_payload[32]; static AsyncTimer * s_timer; static HASHTABLEDECL( @@ -145,7 +145,7 @@ static HASHTABLEDECL( //============================================================================ static bool Recv_PingReply ( - const byte msg[], + const uint8_t msg[], unsigned bytes, void * ) { @@ -167,7 +167,7 @@ static bool Recv_PingReply ( if (trans) { unsigned replyAtMs = TimeGetMs(); trans->conn->dump(L"[TCP] Reply from SrvAuth. ms=%u", replyAtMs - trans->pingAtMs); - DEL(trans); + delete trans; return true; } else { @@ -209,7 +209,7 @@ static unsigned TimerCallback (void *) { if (!curr->conn->error) curr->conn->error = error; curr->conn->dump(L"[TCP] No reply from SrvAuth: %u, %s (ms=%u)", error, NetErrorToString(error), diff); - DEL(curr); + delete curr; } }} {for (FileTrans * next, * curr = s_fileTrans.Head(); curr; curr = next) { @@ -219,7 +219,7 @@ static unsigned TimerCallback (void *) { if (!curr->conn->error) curr->conn->error = error; curr->conn->dump(L"[TCP] No reply from SrvFile: %u, %s (ms=%u)", error, NetErrorToString(error), diff); - DEL(curr); + delete curr; } }} } @@ -237,14 +237,14 @@ static void AuthPingProc (void * param) { if (!conn->pingsInRoute) { - AuthTrans * trans = NEW(AuthTrans)(conn); + AuthTrans * trans = new AuthTrans(conn); trans->pingAtMs = TimeGetMs(); s_critsect.Enter(); for (;;) { if (conn->done) { conn->pingsCompleted = kMaxPings; - DEL(trans); + delete trans; break; } while (++s_transId == 0) @@ -252,12 +252,12 @@ static void AuthPingProc (void * param) { trans->SetValue(s_transId); s_authTrans.Add(trans); - const unsigned_ptr msg[] = { + const uintptr_t msg[] = { kCli2Auth_PingRequest, trans->pingAtMs, trans->GetValue(), sizeof(s_payload), - (unsigned_ptr) s_payload, + (uintptr_t) s_payload, }; NetCliSend(conn->cli, msg, arrsize(msg)); @@ -352,7 +352,7 @@ static void NotifyAuthConnSocketDisconnect (AuthConn * conn) { while (AuthTrans * trans = authTrans.Head()) { conn->dump(L"[TCP] No reply from SrvAuth: %u, %s", conn->error, NetErrorToString(conn->error)); - DEL(trans); + delete trans; } conn->DecRef("Connected"); @@ -419,7 +419,7 @@ static bool Recv_File2Cli_ManifestReply (FileConn * conn, const File2Cli_Manifes if (trans) { unsigned replyAtMs = TimeGetMs(); trans->conn->dump(L"[TCP] Reply from SrvFile. ms=%u", replyAtMs - trans->pingAtMs); - DEL(trans); + delete trans; return true; } else { @@ -436,14 +436,14 @@ static void FilePingProc (void * param) { if (!conn->pingsInRoute) { - FileTrans * trans = NEW(FileTrans)(conn); + FileTrans * trans = new FileTrans(conn); trans->pingAtMs = TimeGetMs(); s_critsect.Enter(); for (;;) { if (conn->done) { conn->pingsCompleted = kMaxPings; - DEL(trans); + delete trans; break; } while (++s_transId == 0) @@ -523,7 +523,7 @@ static void NotifyFileConnSocketDisconnect (FileConn * conn) { while (FileTrans * trans = fileTrans.Head()) { conn->dump(L"[TCP] No reply from SrvFile: %u, %s", conn->error, NetErrorToString(conn->error)); - DEL(trans); + delete trans; } conn->DecRef("Connected"); @@ -536,10 +536,10 @@ static bool NotifyFileConnSocketRead (FileConn * conn, AsyncNotifySocketRead * r read->bytesProcessed += read->bytes; for (;;) { - if (conn->recvBuffer.Count() < sizeof(dword)) + if (conn->recvBuffer.Count() < sizeof(uint32_t)) return true; - dword msgSize = *(dword *)conn->recvBuffer.Ptr(); + uint32_t msgSize = *(uint32_t *)conn->recvBuffer.Ptr(); if (conn->recvBuffer.Count() < msgSize) return true; @@ -605,9 +605,9 @@ static void StartAuthTcpTest ( void * param ) { if (0 == AtomicSet(&s_authProtocolRegistered, 1)) { - MemSet( + memset( s_payload, - (byte)((unsigned_ptr)&s_payload >> 4), + (uint8_t)((uintptr_t)&s_payload >> 4), sizeof(s_payload) ); NetMsgProtocolRegister( @@ -621,7 +621,7 @@ static void StartAuthTcpTest ( ); } - wchar addrStr[128]; + wchar_t addrStr[128]; NetAddressToString(addr, addrStr, arrsize(addrStr), kNetAddressFormatAll); dump(L"[TCP] Connecting to SrvAuth at %s...", addrStr); @@ -635,7 +635,7 @@ static void StartAuthTcpTest ( conn->IncRef("Connecting"); Cli2Auth_Connect connect; - connect.hdr.connType = (byte) kConnTypeCliToAuth; + connect.hdr.connType = (uint8_t) kConnTypeCliToAuth; connect.hdr.hdrBytes = sizeof(connect.hdr); connect.hdr.buildId = BuildId(); connect.hdr.buildType = BUILD_TYPE_LIVE; @@ -664,7 +664,7 @@ static void StartFileTcpTest ( FNetDiagTestCallback callback, void * param ) { - wchar addrStr[128]; + wchar_t addrStr[128]; NetAddressToString(addr, addrStr, arrsize(addrStr), kNetAddressFormatAll); dump(L"[TCP] Connecting to SrvFile at %s...", addrStr); diff --git a/Sources/Plasma/NucleusLib/pnNetDiag/pnNetDiag.cpp b/Sources/Plasma/NucleusLib/pnNetDiag/pnNetDiag.cpp index 9ee514e0..14a77572 100644 --- a/Sources/Plasma/NucleusLib/pnNetDiag/pnNetDiag.cpp +++ b/Sources/Plasma/NucleusLib/pnNetDiag/pnNetDiag.cpp @@ -65,9 +65,9 @@ namespace ND { ***/ HMODULE g_lib; -//const wchar g_version[] = L"miasma"; -//const wchar g_version[] = L"ectomorph"; -const wchar g_version[] = L"solvent"; +//const wchar_t g_version[] = L"miasma"; +//const wchar_t g_version[] = L"ectomorph"; +const wchar_t g_version[] = L"solvent"; } // namespace ND @@ -82,15 +82,15 @@ const wchar g_version[] = L"solvent"; NetDiag::~NetDiag () { for (unsigned srv = 0; srv < kNumDiagSrvs; ++srv) - FREE(hosts[srv]); + free(hosts[srv]); } //============================================================================ -void NetDiag::SetHost (unsigned srv, const wchar host[]) { +void NetDiag::SetHost (unsigned srv, const wchar_t host[]) { critsect.Enter(); { - FREE(hosts[srv]); + free(hosts[srv]); if (host) hosts[srv] = StrDup(host); @@ -155,7 +155,7 @@ void NetDiagDelete (NetDiag * diag) { void NetDiagSetHost ( NetDiag * diag, ENetProtocol protocol, - const wchar host[] + const wchar_t host[] ) { ASSERT(diag); diff --git a/Sources/Plasma/NucleusLib/pnNetDiag/pnNetDiag.h b/Sources/Plasma/NucleusLib/pnNetDiag/pnNetDiag.h index 6c9b0f81..00f59ac2 100644 --- a/Sources/Plasma/NucleusLib/pnNetDiag/pnNetDiag.h +++ b/Sources/Plasma/NucleusLib/pnNetDiag/pnNetDiag.h @@ -78,11 +78,11 @@ void NetDiagDelete (NetDiag * diag); void NetDiagSetHost ( NetDiag * diag, ENetProtocol protocol, - const wchar name[] + const wchar_t name[] ); typedef void ( __cdecl * FNetDiagDumpProc)( - const wchar fmt[], + const wchar_t fmt[], ... ); typedef void (*FNetDiagTestCallback)( diff --git a/Sources/Plasma/NucleusLib/pnNetDiag/pnNetSys.cpp b/Sources/Plasma/NucleusLib/pnNetDiag/pnNetSys.cpp index 2068fe5d..dc96362a 100644 --- a/Sources/Plasma/NucleusLib/pnNetDiag/pnNetSys.cpp +++ b/Sources/Plasma/NucleusLib/pnNetDiag/pnNetSys.cpp @@ -110,8 +110,8 @@ void NetDiagSys ( ASSERT(callback); { // Timestamp - wchar str[256]; - qword time = TimeGetTime(); + wchar_t str[256]; + uint64_t time = TimeGetTime(); TimePrettyPrint(time, arrsize(str), str); dump(L"[SYS] Time: %s UTC", str); } @@ -121,7 +121,7 @@ void NetDiagSys ( } { // Product - wchar product[128]; + wchar_t product[128]; ProductString(product, arrsize(product)); dump(L"[SYS] Product: %s", product); } @@ -139,9 +139,9 @@ void NetDiagSys ( } { // System - word cpuCaps; - dword cpuVendor[3]; - word cpuSignature; + uint16_t cpuCaps; + uint32_t cpuVendor[3]; + uint16_t cpuSignature; CpuGetInfo(&cpuCaps, cpuVendor, &cpuSignature); SYSTEM_INFO info; GetSystemInfo(&info); @@ -158,7 +158,7 @@ void NetDiagSys ( ULONG ulOutBufLen = 0; GetAdaptersInfo(nil, &ulOutBufLen); - PIP_ADAPTER_INFO pInfo = (PIP_ADAPTER_INFO)ALLOC(ulOutBufLen); + PIP_ADAPTER_INFO pInfo = (PIP_ADAPTER_INFO)malloc(ulOutBufLen); PIP_ADAPTER_INFO pAdapter; if (GetAdaptersInfo(pInfo, &ulOutBufLen) == NO_ERROR) { pAdapter = pInfo; @@ -172,6 +172,6 @@ void NetDiagSys ( dump(L"[SYS] Error getting adaper list"); callback(diag, kNetProtocolNil, kNetErrFileNotFound, param); } - FREE(pInfo); + free(pInfo); } } diff --git a/Sources/Plasma/NucleusLib/pnNetLog/pnNetLog.h b/Sources/Plasma/NucleusLib/pnNetLog/pnNetLog.h index dd4db18e..9ccd4a4d 100644 --- a/Sources/Plasma/NucleusLib/pnNetLog/pnNetLog.h +++ b/Sources/Plasma/NucleusLib/pnNetLog/pnNetLog.h @@ -72,28 +72,28 @@ enum ELogParamType { kLogParamUnsigned, // (unsigned) kLogParamFloat, // (float) kLogParamUuid, // Uuid - kLogParamStringW, // (const wchar *) - kLogParamLong, // (long) or (dword) - kLogParamLongLong, // (long long) or (qword) + kLogParamStringW, // (const wchar_t *) + kLogParamLong, // (long) or (uint32_t) + kLogParamLongLong, // (long long) or (uint64_t) kNumLogParamTypes }; struct NetLogField { ELogParamType type; // element type - wchar name[MAX_PATH]; + wchar_t name[MAX_PATH]; }; struct NetLogEvent { ESrvType srvType; unsigned logEventType; - const wchar * eventName; + const wchar_t * eventName; const NetLogField * fields; unsigned numFields; }; struct NetLogSrvField { - const wchar *name; - const wchar *data; + const wchar_t *name; + const wchar_t *data; }; #define NET_LOG_FIELD_INT(name) { kLogParamInt, name } @@ -157,7 +157,7 @@ enum { kNlSrvNumPerf }; -typedef void (*NlSrvCallback)(const NetLogEvent *event, const ARRAY(wchar) &, unsigned, NetAddressNode &, qword, unsigned, unsigned); +typedef void (*NlSrvCallback)(const NetLogEvent *event, const ARRAY(wchar_t) &, unsigned, NetAddressNode &, uint64_t, unsigned, unsigned); long NetLogSrvGetPerf (unsigned index); void NetLogSrvRegisterCallback(NlSrvCallback callback); void LogConnIncRef (LogConn * conn); diff --git a/Sources/Plasma/NucleusLib/pnNetLog/pnNlApi.cpp b/Sources/Plasma/NucleusLib/pnNetLog/pnNlApi.cpp index e8b65a58..aecc1868 100644 --- a/Sources/Plasma/NucleusLib/pnNetLog/pnNlApi.cpp +++ b/Sources/Plasma/NucleusLib/pnNetLog/pnNlApi.cpp @@ -64,7 +64,7 @@ struct EventHash { ESrvType srvType ); - inline dword GetHash () const; + inline uint32_t GetHash () const; inline bool operator== (const EventHash & rhs) const; }; @@ -117,7 +117,7 @@ inline EventHash::EventHash ( } //============================================================================ -inline dword EventHash::GetHash () const { +inline uint32_t EventHash::GetHash () const { CHashValue hash(this, sizeof(*this)); return hash.GetHash(); } @@ -189,7 +189,7 @@ void NetLogRegisterEvents (const NetLogEvent events[], unsigned count) { HASHTABLEDECL(NetLogEventHash, EventHash, link) tempHashTable; for(unsigned i = 0; i < count; ++i) { - hash = NEW(NetLogEventHash)(events[i].logEventType, events[i].srvType, &events[i]); + hash = new NetLogEventHash(events[i].logEventType, events[i].srvType, &events[i]); tempHashTable.Add(hash); } s_critsect.Enter(); diff --git a/Sources/Plasma/NucleusLib/pnNetLog/pnNlCli.cpp b/Sources/Plasma/NucleusLib/pnNetLog/pnNlCli.cpp index a3ce3155..f158a4e8 100644 --- a/Sources/Plasma/NucleusLib/pnNetLog/pnNlCli.cpp +++ b/Sources/Plasma/NucleusLib/pnNetLog/pnNlCli.cpp @@ -156,7 +156,7 @@ static void NetLogConnDisconnect () { //============================================================================ static void AddEventNode (Srv2Log_LogMsg *msg) { - LogConnEventNode *node = NEW(LogConnEventNode)(msg, TimeGetMs() + kIssueSaveMs); + LogConnEventNode *node = new LogConnEventNode(msg, TimeGetMs() + kIssueSaveMs); s_critsect.Enter(); { s_eventQueue.Link(node); @@ -181,7 +181,7 @@ static void ParseIni (Ini * ini) { ); if (value) { - wchar addrStr[32]; + wchar_t addrStr[32]; IniGetString(value, addrStr, arrsize(addrStr), 0, nil); NetAddress addr; NetAddressFromString(&addr, addrStr, kNetDefaultServerPort); @@ -190,7 +190,7 @@ static void ParseIni (Ini * ini) { } //============================================================================ -static void IniChangeCallback (const wchar fullPath[]) { +static void IniChangeCallback (const wchar_t fullPath[]) { Ini * ini = IniOpen(fullPath); ParseIni(ini); IniClose(ini); @@ -207,7 +207,7 @@ static unsigned TimerCallback (void *) { if(allowedNumTrans < 0) // this could be negative, if so set to zero allowedNumTrans = 0; - dword currTime = TimeGetMs(); + uint32_t currTime = TimeGetMs(); LogConnEventNode *hash; int timeDiff; @@ -310,7 +310,7 @@ static unsigned CalcArgsLength (const NetLogEvent &event, va_list args) { break; case kLogParamStringW: { - wchar *str = va_arg(args, wchar *); + wchar_t *str = va_arg(args, wchar_t *); if(!str) str = L""; length += StrBytes(str); @@ -416,7 +416,7 @@ bool LogMsgTrans::OnTransReply ( AddEventNode(msgBuffer); } else { - FREE(msgBuffer); + free(msgBuffer); } return true; } @@ -543,7 +543,7 @@ void NetLogCliSendEvent (const NetLogEvent &event, va_list args) { break; case kLogParamStringW: { - wchar *str = va_arg(args, wchar *); + wchar_t *str = va_arg(args, wchar_t *); if(!str) str = L""; pack.AddString(str); diff --git a/Sources/Plasma/NucleusLib/pnNetLog/pnNlSrv.cpp b/Sources/Plasma/NucleusLib/pnNetLog/pnNlSrv.cpp index 9b7729d4..903af940 100644 --- a/Sources/Plasma/NucleusLib/pnNetLog/pnNlSrv.cpp +++ b/Sources/Plasma/NucleusLib/pnNetLog/pnNlSrv.cpp @@ -64,7 +64,7 @@ struct EventHash { ESrvType srvType ); - inline dword GetHash () const; + inline uint32_t GetHash () const; inline bool operator== (const EventHash & rhs) const; }; @@ -117,7 +117,7 @@ static long s_perf[kNlSrvNumPerf]; static CCritSect s_critsect; static bool s_running; static LISTDECL(LogConn, link) s_conns; -void (*NetLogSrvCallback)(const NetLogEvent *event, const ARRAY(wchar) &, unsigned, NetAddressNode &, qword, unsigned, unsigned ) ; +void (*NetLogSrvCallback)(const NetLogEvent *event, const ARRAY(wchar_t) &, unsigned, NetAddressNode &, uint64_t, unsigned, unsigned ) ; /***************************************************************************** @@ -140,7 +140,7 @@ static void ParseIni (Ini * ini) { } //============================================================================ -static void IniChangeCallback (const wchar fullPath[]) { +static void IniChangeCallback (const wchar_t fullPath[]) { Ini * ini = IniOpen(fullPath); ParseIni(ini); IniClose(ini); @@ -269,8 +269,8 @@ bool LogConn::Recv_Srv2Log_LogMsg(const Srv2Log_LogMsg & msg ) { CSrvUnpackBuffer unpack(&msg, msg.messageBytes); (void)unpack.GetData(sizeof(msg)); unsigned length = 0; - ARRAY(wchar) databuf; - wchar data[256]; + ARRAY(wchar_t) databuf; + wchar_t data[256]; const void *pData = 0; SendReply(msg.transId, kNetSuccess); @@ -360,7 +360,7 @@ bool LogConn::Recv_Srv2Log_LogMsg(const Srv2Log_LogMsg & msg ) { break; case kLogParamStringW: { - const wchar *str = unpack.GetString(); + const wchar_t *str = unpack.GetString(); if(!str) { continue; } @@ -489,7 +489,7 @@ bool LogConn::Recv_Srv2Log_LogMsg(const Srv2Log_LogMsg & msg ) { break; case kLogParamStringW: { - const wchar *str = unpack.GetString(); + const wchar_t *str = unpack.GetString(); if(!str) { continue; } @@ -575,7 +575,7 @@ void NetLogSrvDestroy () { } //============================================================================ -void NetLogSrvRegisterCallback( void (*NlSrvCallback)(const NetLogEvent *, const ARRAY(wchar) &, unsigned, NetAddressNode &, qword, unsigned, unsigned )) { +void NetLogSrvRegisterCallback( void (*NlSrvCallback)(const NetLogEvent *, const ARRAY(wchar_t) &, unsigned, NetAddressNode &, uint64_t, unsigned, unsigned )) { NetLogSrvCallback = NlSrvCallback; } diff --git a/Sources/Plasma/NucleusLib/pnNetProtocol/Private/Protocols/Cli2Auth/pnNpCli2Auth.cpp b/Sources/Plasma/NucleusLib/pnNetProtocol/Private/Protocols/Cli2Auth/pnNpCli2Auth.cpp index d5652d5c..e8aeb8bb 100644 --- a/Sources/Plasma/NucleusLib/pnNetProtocol/Private/Protocols/Cli2Auth/pnNpCli2Auth.cpp +++ b/Sources/Plasma/NucleusLib/pnNetProtocol/Private/Protocols/Cli2Auth/pnNpCli2Auth.cpp @@ -454,7 +454,7 @@ static const NetMsgField kAcctActivateReplyFields[] = { static const NetMsgField kFileListReplyFields[] = { kNetMsgFieldTransId, // transId kNetMsgFieldENetError, // result - NET_MSG_FIELD_VAR_COUNT(sizeof(wchar), 1024 * 1024), // wcharCount + NET_MSG_FIELD_VAR_COUNT(sizeof(wchar_t), 1024 * 1024), // wchar_tCount NET_MSG_FIELD_VAR_PTR(), // fileData }; @@ -548,7 +548,7 @@ static const NetMsgField kVaultInitAgeReplyFields[] = { static const NetMsgField kVaultNodeFindReplyFields[] = { kNetMsgFieldTransId, // transId kNetMsgFieldENetError, // result - NET_MSG_FIELD_VAR_COUNT(sizeof(dword), 512), // nodeIdCount + NET_MSG_FIELD_VAR_COUNT(sizeof(uint32_t), 512), // nodeIdCount NET_MSG_FIELD_VAR_PTR(), // nodeIds }; diff --git a/Sources/Plasma/NucleusLib/pnNetProtocol/Private/Protocols/Cli2Auth/pnNpCli2Auth.h b/Sources/Plasma/NucleusLib/pnNetProtocol/Private/Protocols/Cli2Auth/pnNpCli2Auth.h index e5896f11..de66c9f7 100644 --- a/Sources/Plasma/NucleusLib/pnNetProtocol/Private/Protocols/Cli2Auth/pnNpCli2Auth.h +++ b/Sources/Plasma/NucleusLib/pnNetProtocol/Private/Protocols/Cli2Auth/pnNpCli2Auth.h @@ -51,7 +51,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #define PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNNETPROTOCOL_PRIVATE_PROTOCOLS_PNNPCLI2AUTH_H -// kNetProtocolCli2Auth messages (must be <= (word)-1) +// kNetProtocolCli2Auth messages (must be <= (uint16_t)-1) enum { // Global kCli2Auth_PingRequest, @@ -133,7 +133,7 @@ enum { kNumCli2AuthMessages }; -COMPILER_ASSERT_HEADER(Cli2Auth, kNumCli2AuthMessages <= (word)-1); +COMPILER_ASSERT_HEADER(Cli2Auth, kNumCli2AuthMessages <= (uint16_t)-1); enum { // Global @@ -212,7 +212,7 @@ enum { kNumAuth2CliMessages }; -COMPILER_ASSERT_HEADER(Cli2Auth, kNumAuth2CliMessages <= (word)-1); +COMPILER_ASSERT_HEADER(Cli2Auth, kNumAuth2CliMessages <= (uint16_t)-1); //============================================================================ @@ -228,7 +228,7 @@ COMPILER_ASSERT_HEADER(Cli2Auth, kNumAuth2CliMessages <= (word)-1); ***/ struct Cli2Auth_ConnData { - dword dataBytes; + uint32_t dataBytes; Uuid token; }; struct Cli2Auth_Connect { @@ -246,399 +246,399 @@ struct Cli2Auth_Connect { // PingRequest extern const NetMsg kNetMsg_Cli2Auth_PingRequest; struct Cli2Auth_PingRequest { - dword messageId; - dword pingTimeMs; - dword transId; - dword payloadBytes; - byte payload[1]; // [payloadBytes] + uint32_t messageId; + uint32_t pingTimeMs; + uint32_t transId; + uint32_t payloadBytes; + uint8_t payload[1]; // [payloadBytes] }; // ClientRegisterRequest extern const NetMsg kNetMsg_Cli2Auth_ClientRegisterRequest; struct Cli2Auth_ClientRegisterRequest { - dword messageId; - dword buildId; + uint32_t messageId; + uint32_t buildId; }; // AccountExists extern const NetMsg kNetMsg_Cli2Auth_AccountExistsRequest; struct Cli2Auth_AccountExistsRequest { - dword messageId; - dword transId; - wchar accountName[kMaxAccountNameLength]; + uint32_t messageId; + uint32_t transId; + wchar_t accountName[kMaxAccountNameLength]; }; // LoginRequest extern const NetMsg kNetMsg_Cli2Auth_AcctLoginRequest; struct Cli2Auth_AcctLoginRequest { - dword messageId; - dword transId; - dword clientChallenge; - wchar acctName[kMaxAccountNameLength]; + uint32_t messageId; + uint32_t transId; + uint32_t clientChallenge; + wchar_t acctName[kMaxAccountNameLength]; ShaDigest challengeHash; - wchar authToken[kMaxPublisherAuthKeyLength]; - wchar os[kMaxGTOSIdLength]; + wchar_t authToken[kMaxPublisherAuthKeyLength]; + wchar_t os[kMaxGTOSIdLength]; }; // AgeRequest extern const NetMsg kNetMsg_Cli2Auth_AgeRequest; struct Cli2Auth_AgeRequest { - dword messageId; - dword transId; - wchar ageName[kMaxAgeNameLength]; + uint32_t messageId; + uint32_t transId; + wchar_t ageName[kMaxAgeNameLength]; Uuid ageUuid; }; // AcctCreateRequest extern const NetMsg kNetMsg_Cli2Auth_AcctCreateRequest; struct Cli2Auth_AcctCreateRequest { - dword messageId; - dword transId; - wchar accountName[kMaxAccountNameLength]; + uint32_t messageId; + uint32_t transId; + wchar_t accountName[kMaxAccountNameLength]; ShaDigest namePassHash; - dword accountFlags; - dword billingType; + uint32_t accountFlags; + uint32_t billingType; }; // AcctCreateFromKeyRequest extern const NetMsg kNetMsg_Cli2Auth_AcctCreateFromKeyRequest; struct Cli2Auth_AcctCreateFromKeyRequest { - dword messageId; - dword transId; - wchar accountName[kMaxAccountNameLength]; + uint32_t messageId; + uint32_t transId; + wchar_t accountName[kMaxAccountNameLength]; ShaDigest namePassHash; Uuid key; - dword billingType; + uint32_t billingType; }; // CreatePlayerRequest extern const NetMsg kNetMsg_Cli2Auth_PlayerCreateRequest; struct Cli2Auth_PlayerCreateRequest { - dword messageId; - dword transId; - wchar playerName[kMaxPlayerNameLength]; - wchar avatarShape[MAX_PATH]; - wchar friendInvite[MAX_PATH]; + uint32_t messageId; + uint32_t transId; + wchar_t playerName[kMaxPlayerNameLength]; + wchar_t avatarShape[MAX_PATH]; + wchar_t friendInvite[MAX_PATH]; }; extern const NetMsg kNetMsg_Cli2Auth_PlayerDeleteRequest; struct Cli2Auth_PlayerDeleteRequest { - dword messageId; - dword transId; - dword playerId; + uint32_t messageId; + uint32_t transId; + uint32_t playerId; }; extern const NetMsg kNetMsg_Cli2Auth_UpgradeVisitorRequest; struct Cli2Auth_UpgradeVisitorRequest { - dword messageId; - dword transId; - dword playerId; + uint32_t messageId; + uint32_t transId; + uint32_t playerId; }; // SetPlayerRequest extern const NetMsg kNetMsg_Cli2Auth_AcctSetPlayerRequest; struct Cli2Auth_AcctSetPlayerRequest { - dword messageId; - dword transId; - dword playerInt; + uint32_t messageId; + uint32_t transId; + uint32_t playerInt; }; // ChangePasswordRequest extern const NetMsg kNetMsg_Cli2Auth_AcctChangePasswordRequest; struct Cli2Auth_AcctChangePasswordRequest { - dword messageId; - dword transId; - wchar accountName[kMaxAccountNameLength]; + uint32_t messageId; + uint32_t transId; + wchar_t accountName[kMaxAccountNameLength]; ShaDigest namePassHash; }; // AcctSetRolesRequest extern const NetMsg kNetMsg_Cli2Auth_AcctSetRolesRequest; struct Cli2Auth_AcctSetRolesRequest { - dword messageId; - dword transId; - wchar accountName[kMaxAccountNameLength]; - dword accountFlags; + uint32_t messageId; + uint32_t transId; + wchar_t accountName[kMaxAccountNameLength]; + uint32_t accountFlags; }; // AcctSetBillingTypeRequest extern const NetMsg kNetMsg_Cli2Auth_AcctSetBillingTypeRequest; struct Cli2Auth_AcctSetBillingTypeRequest { - dword messageId; - dword transId; - wchar accountName[kMaxAccountNameLength]; - dword billingType; + uint32_t messageId; + uint32_t transId; + wchar_t accountName[kMaxAccountNameLength]; + uint32_t billingType; }; // AcctActivateRequest extern const NetMsg kNetMsg_Cli2Auth_AcctActivateRequest; struct Cli2Auth_AcctActivateRequest { - dword messageId; - dword transId; + uint32_t messageId; + uint32_t transId; Uuid activationKey; }; // FileListRequest extern const NetMsg kNetMsg_Cli2Auth_FileListRequest; struct Cli2Auth_FileListRequest { - dword messageId; - dword transId; - wchar directory[MAX_PATH]; - wchar ext[MAX_EXT]; + uint32_t messageId; + uint32_t transId; + wchar_t directory[MAX_PATH]; + wchar_t ext[MAX_EXT]; }; // FileDownloadRequest extern const NetMsg kNetMsg_Cli2Auth_FileDownloadRequest; struct Cli2Auth_FileDownloadRequest { - dword messageId; - dword transId; - wchar filename[MAX_PATH]; + uint32_t messageId; + uint32_t transId; + wchar_t filename[MAX_PATH]; }; // FileDownloadChunkAck extern const NetMsg kNetMsg_Cli2Auth_FileDownloadChunkAck; struct Cli2Auth_FileDownloadChunkAck { - dword messageId; - dword transId; + uint32_t messageId; + uint32_t transId; }; // VaultFetchNodeRefs extern const NetMsg kNetMsg_Cli2Auth_VaultFetchNodeRefs; struct Cli2Auth_VaultFetchNodeRefs { - dword messageId; - dword transId; - dword nodeId; + uint32_t messageId; + uint32_t transId; + uint32_t nodeId; }; // VaultNodeAdd extern const NetMsg kNetMsg_Cli2Auth_VaultNodeAdd; struct Cli2Auth_VaultNodeAdd { - dword messageId; - dword transId; - dword parentId; - dword childId; - dword ownerId; + uint32_t messageId; + uint32_t transId; + uint32_t parentId; + uint32_t childId; + uint32_t ownerId; }; // VaultNodeRemove extern const NetMsg kNetMsg_Cli2Auth_VaultNodeRemove; struct Cli2Auth_VaultNodeRemove { - dword messageId; - dword transId; - dword parentId; - dword childId; + uint32_t messageId; + uint32_t transId; + uint32_t parentId; + uint32_t childId; }; // VaultNodeSave extern const NetMsg kNetMsg_Cli2Auth_VaultNodeSave; struct Cli2Auth_VaultNodeSave { - dword messageId; - dword transId; - dword nodeId; + uint32_t messageId; + uint32_t transId; + uint32_t nodeId; Uuid revisionId; - dword nodeBytes; - byte nodeBuffer[1]; + uint32_t nodeBytes; + uint8_t nodeBuffer[1]; }; // VaultNodeCreate extern const NetMsg kNetMsg_Cli2Auth_VaultNodeCreate; struct Cli2Auth_VaultNodeCreate { - dword messageId; - dword transId; - dword nodeBytes; - byte nodeBuffer[1]; + uint32_t messageId; + uint32_t transId; + uint32_t nodeBytes; + uint8_t nodeBuffer[1]; }; // VaultNodeFetch extern const NetMsg kNetMsg_Cli2Auth_VaultNodeFetch; struct Cli2Auth_VaultNodeFetch { - dword messageId; - dword transId; - dword nodeId; + uint32_t messageId; + uint32_t transId; + uint32_t nodeId; }; // VaultInitAgeRequest extern const NetMsg kNetMsg_Cli2Auth_VaultInitAgeRequest; struct Cli2Auth_VaultInitAgeRequest { - dword messageId; - dword transId; + uint32_t messageId; + uint32_t transId; Uuid ageInstId; Uuid parentAgeInstId; - wchar ageFilename[MAX_PATH]; - wchar ageInstName[MAX_PATH]; - wchar ageUserName[MAX_PATH]; - wchar ageDesc[1024]; - dword ageSequenceNumber; - dword ageLanguage; + wchar_t ageFilename[MAX_PATH]; + wchar_t ageInstName[MAX_PATH]; + wchar_t ageUserName[MAX_PATH]; + wchar_t ageDesc[1024]; + uint32_t ageSequenceNumber; + uint32_t ageLanguage; }; // VaultNodeFind extern const NetMsg kNetMsg_Cli2Auth_VaultNodeFind; struct Cli2Auth_VaultNodeFind { - dword messageId; - dword transId; - dword nodeBytes; - byte nodeBuffer[1]; + uint32_t messageId; + uint32_t transId; + uint32_t nodeBytes; + uint8_t nodeBuffer[1]; }; // VaultSetSeen extern const NetMsg kNetMsg_Cli2Auth_VaultSetSeen; struct Cli2Auth_VaultSetSeen { - dword messageId; - dword parentId; - dword childId; - byte seen; + uint32_t messageId; + uint32_t parentId; + uint32_t childId; + uint8_t seen; }; // VaultSendNode extern const NetMsg kNetMsg_Cli2Auth_VaultSendNode; struct Cli2Auth_VaultSendNode { - dword messageId; - dword srcNodeId; - dword dstPlayerId; + uint32_t messageId; + uint32_t srcNodeId; + uint32_t dstPlayerId; }; // GetPublicAgeList extern const NetMsg kNetMsg_Cli2Auth_GetPublicAgeList; struct Cli2Auth_GetPublicAgeList { - dword messageId; - dword transId; - wchar ageFilename[kMaxAgeNameLength]; + uint32_t messageId; + uint32_t transId; + wchar_t ageFilename[kMaxAgeNameLength]; }; extern const NetMsg kNetMsg_Cli2Auth_SetAgePublic; struct Cli2Auth_SetAgePublic { - dword messageId; - dword ageInfoId; - byte publicOrNot; + uint32_t messageId; + uint32_t ageInfoId; + uint8_t publicOrNot; }; // PropagateBuffer extern const NetMsg kNetMsg_Cli2Auth_PropagateBuffer; struct Cli2Auth_PropagateBuffer { - dword messageId; - dword type; - dword bytes; - byte buffer[1]; // [bytes], actually + uint32_t messageId; + uint32_t type; + uint32_t bytes; + uint8_t buffer[1]; // [bytes], actually // no more fields }; extern const NetMsg kNetMsg_Cli2Auth_ClientSetCCRLevel; struct Cli2Auth_ClientSetCCRLevel { - dword messageId; - dword ccrLevel; + uint32_t messageId; + uint32_t ccrLevel; }; extern const NetMsg kNetMsg_Cli2Auth_LogPythonTraceback; struct Cli2Auth_LogPythonTraceback { - dword messageId; - wchar traceback[1024]; + uint32_t messageId; + wchar_t traceback[1024]; }; extern const NetMsg kNetMsg_Cli2Auth_LogStackDump; struct Cli2Auth_LogStackDump { - dword messageId; - wchar stackdump[1024]; + uint32_t messageId; + wchar_t stackdump[1024]; }; extern const NetMsg kNetMsg_Cli2Auth_LogClientDebuggerConnect; struct Cli2Auth_LogClientDebuggerConnect { - dword messageId; + uint32_t messageId; }; extern const NetMsg kNetMsg_Cli2Auth_SetPlayerBanStatusRequest; struct Cli2Auth_SetPlayerBanStatusRequest { - dword messageId; - dword transId; - dword playerId; - dword banned; + uint32_t messageId; + uint32_t transId; + uint32_t playerId; + uint32_t banned; }; extern const NetMsg kNetMsg_Cli2Auth_KickPlayer; struct Cli2Auth_KickPlayer { - dword messageId; - dword playerId; + uint32_t messageId; + uint32_t playerId; }; extern const NetMsg kNetMsg_Cli2Auth_ChangePlayerNameRequest; struct Cli2Auth_ChangePlayerNameRequest { - dword messageId; - dword transId; - dword playerId; - wchar newName[kMaxPlayerNameLength]; + uint32_t messageId; + uint32_t transId; + uint32_t playerId; + wchar_t newName[kMaxPlayerNameLength]; }; extern const NetMsg kNetMsg_Cli2Auth_SendFriendInviteRequest; struct Cli2Auth_SendFriendInviteRequest { - dword messageId; - dword transId; + uint32_t messageId; + uint32_t transId; Uuid inviteUuid; - wchar emailAddress[kMaxEmailAddressLength]; - wchar toName[kMaxPlayerNameLength]; + wchar_t emailAddress[kMaxEmailAddressLength]; + wchar_t toName[kMaxPlayerNameLength]; }; extern const NetMsg kNetMsg_Cli2Auth_ScoreCreate; struct Cli2Auth_ScoreCreate { - dword messageId; - dword transId; - dword ownerId; - wchar gameName[kMaxGameScoreNameLength]; - dword gameType; - dword scoreValue; + uint32_t messageId; + uint32_t transId; + uint32_t ownerId; + wchar_t gameName[kMaxGameScoreNameLength]; + uint32_t gameType; + uint32_t scoreValue; }; extern const NetMsg kNetMsg_Cli2Auth_ScoreDelete; struct Cli2Auth_ScoreDelete { - dword messageId; - dword transId; - dword scoreId; + uint32_t messageId; + uint32_t transId; + uint32_t scoreId; }; extern const NetMsg kNetMsg_Cli2Auth_ScoreGetScores; struct Cli2Auth_ScoreGetScores { - dword messageId; - dword transId; - dword ownerId; - wchar gameName[kMaxGameScoreNameLength]; + uint32_t messageId; + uint32_t transId; + uint32_t ownerId; + wchar_t gameName[kMaxGameScoreNameLength]; }; extern const NetMsg kNetMsg_Cli2Auth_ScoreAddPoints; struct Cli2Auth_ScoreAddPoints { - dword messageId; - dword transId; - dword scoreId; - dword numPoints; + uint32_t messageId; + uint32_t transId; + uint32_t scoreId; + uint32_t numPoints; }; extern const NetMsg kNetMsg_Cli2Auth_ScoreTransferPoints; struct Cli2Auth_ScoreTransferPoints { - dword messageId; - dword transId; - dword srcScoreId; - dword destScoreId; - dword numPoints; + uint32_t messageId; + uint32_t transId; + uint32_t srcScoreId; + uint32_t destScoreId; + uint32_t numPoints; }; extern const NetMsg kNetMsg_Cli2Auth_ScoreSetPoints; struct Cli2Auth_ScoreSetPoints { - dword messageId; - dword transId; - dword scoreId; - dword numPoints; + uint32_t messageId; + uint32_t transId; + uint32_t scoreId; + uint32_t numPoints; }; extern const NetMsg kNetMsg_Cli2Auth_ScoreGetRanks; struct Cli2Auth_ScoreGetRanks { - dword messageId; - dword transId; - dword ownerId; - dword scoreGroup; - dword parentFolderId; - wchar gameName[kMaxGameScoreNameLength]; - dword timePeriod; - dword numResults; - dword pageNumber; - dword sortDesc; + uint32_t messageId; + uint32_t transId; + uint32_t ownerId; + uint32_t scoreGroup; + uint32_t parentFolderId; + wchar_t gameName[kMaxGameScoreNameLength]; + uint32_t timePeriod; + uint32_t numResults; + uint32_t pageNumber; + uint32_t sortDesc; }; @@ -651,82 +651,82 @@ struct Cli2Auth_ScoreGetRanks { // PingReply extern const NetMsg kNetMsg_Auth2Cli_PingReply; struct Auth2Cli_PingReply { - dword messageId; - dword pingTimeMs; - dword transId; - dword payloadBytes; - byte payload[1]; // [payloadBytes] + uint32_t messageId; + uint32_t pingTimeMs; + uint32_t transId; + uint32_t payloadBytes; + uint8_t payload[1]; // [payloadBytes] }; // ClientRegisterReply extern const NetMsg kNetMsg_Auth2Cli_ClientRegisterReply; struct Auth2Cli_ClientRegisterReply { - dword messageId; - dword serverChallenge; + uint32_t messageId; + uint32_t serverChallenge; }; // AccountExists extern const NetMsg kNetMsg_Auth2Cli_AccountExistsReply; struct Auth2Cli_AccountExistsReply { - dword messageId; - dword transId; + uint32_t messageId; + uint32_t transId; ENetError result; - byte exists; + uint8_t exists; }; // ServerAddr extern const NetMsg kNetMsg_Auth2Cli_ServerAddr; struct Auth2Cli_ServerAddr { - dword messageId; + uint32_t messageId; NetAddressNode srvAddr; Uuid token; }; extern const NetMsg kNetMsg_Auth2Cli_NotifyNewBuild; struct Auth2Cli_NotifyNewBuild { - dword foo; // msgs must have at least one field + uint32_t foo; // msgs must have at least one field }; // AcctPlayerInfo extern const NetMsg kNetMsg_Auth2Cli_AcctPlayerInfo; struct Auth2Cli_AcctPlayerInfo { - dword messageId; - dword transId; - dword playerInt; - wchar playerName[kMaxPlayerNameLength]; - wchar avatarShape[kMaxVaultNodeStringLength]; - dword explorer; + uint32_t messageId; + uint32_t transId; + uint32_t playerInt; + wchar_t playerName[kMaxPlayerNameLength]; + wchar_t avatarShape[kMaxVaultNodeStringLength]; + uint32_t explorer; }; // LoginReply extern const NetMsg kNetMsg_Auth2Cli_AcctLoginReply; struct Auth2Cli_AcctLoginReply { - dword messageId; - dword transId; + uint32_t messageId; + uint32_t transId; ENetError result; Uuid accountId; - dword accountFlags; - dword billingType; - dword encryptionKey[4]; + uint32_t accountFlags; + uint32_t billingType; + uint32_t encryptionKey[4]; }; // AgeReply extern const NetMsg kNetMsg_Auth2Cli_AgeReply; struct Auth2Cli_AgeReply { - dword messageId; - dword transId; + uint32_t messageId; + uint32_t transId; ENetError result; - dword ageMcpId; + uint32_t ageMcpId; Uuid ageInstId; - dword ageVaultId; + uint32_t ageVaultId; NetAddressNode gameSrvNode; }; // AcctCreateReply extern const NetMsg kNetMsg_Auth2Cli_AcctCreateReply; struct Auth2Cli_AcctCreateReply { - dword messageId; - dword transId; + uint32_t messageId; + uint32_t transId; ENetError result; Uuid accountId; }; @@ -734,8 +734,8 @@ struct Auth2Cli_AcctCreateReply { // AcctCreateFromKeyReply extern const NetMsg kNetMsg_Auth2Cli_AcctCreateFromKeyReply; struct Auth2Cli_AcctCreateFromKeyReply { - dword messageId; - dword transId; + uint32_t messageId; + uint32_t transId; ENetError result; Uuid accountId; Uuid activationKey; @@ -744,302 +744,302 @@ struct Auth2Cli_AcctCreateFromKeyReply { // CreatePlayerReply extern const NetMsg kNetMsg_Auth2Cli_PlayerCreateReply; struct Auth2Cli_PlayerCreateReply { - dword messageId; - dword transId; + uint32_t messageId; + uint32_t transId; ENetError result; - dword playerInt; - dword explorer; - wchar playerName[kMaxPlayerNameLength]; - wchar avatarShape[kMaxVaultNodeStringLength]; + uint32_t playerInt; + uint32_t explorer; + wchar_t playerName[kMaxPlayerNameLength]; + wchar_t avatarShape[kMaxVaultNodeStringLength]; }; // DeletePlayerReply extern const NetMsg kNetMsg_Auth2Cli_PlayerDeleteReply; struct Auth2Cli_PlayerDeleteReply { - dword messageId; - dword transId; + uint32_t messageId; + uint32_t transId; ENetError result; }; // DeletePlayerReply extern const NetMsg kNetMsg_Auth2Cli_UpgradeVisitorReply; struct Auth2Cli_UpgradeVisitorReply { - dword messageId; - dword transId; + uint32_t messageId; + uint32_t transId; ENetError result; }; // SetPlayerReply extern const NetMsg kNetMsg_Auth2Cli_AcctSetPlayerReply; struct Auth2Cli_AcctSetPlayerReply { - dword messageId; - dword transId; + uint32_t messageId; + uint32_t transId; ENetError result; }; // AcctChangePasswordReply extern const NetMsg kNetMsg_Auth2Cli_AcctChangePasswordReply; struct Auth2Cli_AcctChangePasswordReply { - dword messageId; - dword transId; + uint32_t messageId; + uint32_t transId; ENetError result; }; // AcctSetRolesReply extern const NetMsg kNetMsg_Auth2Cli_AcctSetRolesReply; struct Auth2Cli_AcctSetRolesReply { - dword messageId; - dword transId; + uint32_t messageId; + uint32_t transId; ENetError result; }; // AcctSetBillingTypeReply extern const NetMsg kNetMsg_Auth2Cli_AcctSetBillingTypeReply; struct Auth2Cli_AcctSetBillingTypeReply { - dword messageId; - dword transId; + uint32_t messageId; + uint32_t transId; ENetError result; }; // AcctActivateReply extern const NetMsg kNetMsg_Auth2Cli_AcctActivateReply; struct Auth2Cli_AcctActivateReply { - dword messageId; - dword transId; + uint32_t messageId; + uint32_t transId; ENetError result; }; // FileListReply extern const NetMsg kNetMsg_Auth2Cli_FileListReply; struct Auth2Cli_FileListReply { - dword messageId; - dword transId; + uint32_t messageId; + uint32_t transId; ENetError result; - dword wcharCount; - wchar fileData[1]; // [wcharCount], actually + uint32_t wchar_tCount; + wchar_t fileData[1]; // [wchar_tCount], actually // no more fields }; // FileDownloadChunk extern const NetMsg kNetMsg_Auth2Cli_FileDownloadChunk; struct Auth2Cli_FileDownloadChunk { - dword messageId; - dword transId; + uint32_t messageId; + uint32_t transId; ENetError result; - dword fileSize; - dword chunkOffset; - dword chunkSize; - byte chunkData[1]; // [chunkSize], actually + uint32_t fileSize; + uint32_t chunkOffset; + uint32_t chunkSize; + uint8_t chunkData[1]; // [chunkSize], actually // no more fields }; // KickedOff extern const NetMsg kNetMsg_Auth2Cli_KickedOff; struct Auth2Cli_KickedOff { - dword messageId; + uint32_t messageId; ENetError reason; }; extern const NetMsg kNetMsg_Auth2Cli_VaultNodeRefsFetched; struct Auth2Cli_VaultNodeRefsFetched { - dword messageId; - dword transId; + uint32_t messageId; + uint32_t transId; ENetError result; - dword refCount; + uint32_t refCount; NetVaultNodeRef refs[1]; }; extern const NetMsg kNetMsg_Auth2Cli_VaultNodeCreated; struct Auth2Cli_VaultNodeCreated { - dword messageId; - dword transId; + uint32_t messageId; + uint32_t transId; ENetError result; - dword nodeId; + uint32_t nodeId; }; extern const NetMsg kNetMsg_Auth2Cli_VaultNodeFetched; struct Auth2Cli_VaultNodeFetched { - dword messageId; - dword transId; + uint32_t messageId; + uint32_t transId; ENetError result; - dword nodeBytes; - byte nodeBuffer[1]; + uint32_t nodeBytes; + uint8_t nodeBuffer[1]; }; extern const NetMsg kNetMsg_Auth2Cli_VaultNodeChanged; struct Auth2Cli_VaultNodeChanged { - dword messageId; - dword nodeId; + uint32_t messageId; + uint32_t nodeId; Uuid revisionId; }; extern const NetMsg kNetMsg_Auth2Cli_VaultNodeAdded; struct Auth2Cli_VaultNodeAdded { - dword messageId; - dword parentId; - dword childId; - dword ownerId; + uint32_t messageId; + uint32_t parentId; + uint32_t childId; + uint32_t ownerId; }; extern const NetMsg kNetMsg_Auth2Cli_VaultNodeRemoved; struct Auth2Cli_VaultNodeRemoved { - dword messageId; - dword parentId; - dword childId; + uint32_t messageId; + uint32_t parentId; + uint32_t childId; }; extern const NetMsg kNetMsg_Auth2Cli_VaultNodeDeleted; struct Auth2Cli_VaultNodeDeleted { - dword messageId; - dword nodeId; + uint32_t messageId; + uint32_t nodeId; }; extern const NetMsg kNetMsg_Auth2Cli_VaultSaveNodeReply; struct Auth2Cli_VaultSaveNodeReply { - dword messageId; - dword transId; + uint32_t messageId; + uint32_t transId; ENetError result; }; extern const NetMsg kNetMsg_Auth2Cli_VaultAddNodeReply; struct Auth2Cli_VaultAddNodeReply { - dword messageId; - dword transId; + uint32_t messageId; + uint32_t transId; ENetError result; }; extern const NetMsg kNetMsg_Auth2Cli_VaultRemoveNodeReply; struct Auth2Cli_VaultRemoveNodeReply { - dword messageId; - dword transId; + uint32_t messageId; + uint32_t transId; ENetError result; }; extern const NetMsg kNetMsg_Auth2Cli_VaultInitAgeReply; struct Auth2Cli_VaultInitAgeReply { - dword messageId; - dword transId; + uint32_t messageId; + uint32_t transId; ENetError result; - dword ageVaultId; - dword ageInfoVaultId; + uint32_t ageVaultId; + uint32_t ageInfoVaultId; }; extern const NetMsg kNetMsg_Auth2Cli_VaultNodeFindReply; struct Auth2Cli_VaultNodeFindReply { - dword messageId; - dword transId; + uint32_t messageId; + uint32_t transId; ENetError result; - dword nodeIdCount; - dword nodeIds[1]; + uint32_t nodeIdCount; + uint32_t nodeIds[1]; }; // PublicAgeList extern const NetMsg kNetMsg_Auth2Cli_PublicAgeList; struct Auth2Cli_PublicAgeList { - dword messageId; - dword transId; + uint32_t messageId; + uint32_t transId; ENetError result; - dword ageCount; + uint32_t ageCount; NetAgeInfo ages[1]; // [ageCount], actually }; // PropagateBuffer extern const NetMsg kNetMsg_Auth2Cli_PropagateBuffer; struct Auth2Cli_PropagateBuffer { - dword messageId; - dword type; - dword bytes; - byte buffer[1]; // [bytes], actually + uint32_t messageId; + uint32_t type; + uint32_t bytes; + uint8_t buffer[1]; // [bytes], actually // no more fields }; // SetPlayerBanStatusReply extern const NetMsg kNetMsg_Auth2Cli_SetPlayerBanStatusReply; struct Auth2Cli_SetPlayerBanStatusReply { - dword messageId; - dword transId; + uint32_t messageId; + uint32_t transId; ENetError result; }; // ChangePlayerNameReply extern const NetMsg kNetMsg_Auth2Cli_ChangePlayerNameReply; struct Auth2Cli_ChangePlayerNameReply { - dword messageId; - dword transId; + uint32_t messageId; + uint32_t transId; ENetError result; }; // SendFriendInviteReply extern const NetMsg kNetMsg_Auth2Cli_SendFriendInviteReply; struct Auth2Cli_SendFriendInviteReply { - dword messageId; - dword transId; + uint32_t messageId; + uint32_t transId; ENetError result; }; // ScoreCreateReply extern const NetMsg kNetMsg_Auth2Cli_ScoreCreateReply; struct Auth2Cli_ScoreCreateReply { - dword messageId; - dword transId; + uint32_t messageId; + uint32_t transId; ENetError result; - dword scoreId; - dword createdTime; + uint32_t scoreId; + uint32_t createdTime; }; // ScoreDeleteReply extern const NetMsg kNetMsg_Auth2Cli_ScoreDeleteReply; struct Auth2Cli_ScoreDeleteReply { - dword messageId; - dword transId; + uint32_t messageId; + uint32_t transId; ENetError result; }; // ScoreGetScoresReply extern const NetMsg kNetMsg_Auth2Cli_ScoreGetScoresReply; struct Auth2Cli_ScoreGetScoresReply { - dword messageId; - dword transId; + uint32_t messageId; + uint32_t transId; ENetError result; - dword scoreCount; - dword byteCount; - byte buffer[1]; // [byteCount], actually + uint32_t scoreCount; + uint32_t byteCount; + uint8_t buffer[1]; // [byteCount], actually // no more fields }; // ScoreAddPoints extern const NetMsg kNetMsg_Auth2Cli_ScoreAddPointsReply; struct Auth2Cli_ScoreAddPointsReply { - dword messageId; - dword transId; + uint32_t messageId; + uint32_t transId; ENetError result; }; // ScoreTransferPoints extern const NetMsg kNetMsg_Auth2Cli_ScoreTransferPointsReply; struct Auth2Cli_ScoreTransferPointsReply { - dword messageId; - dword transId; + uint32_t messageId; + uint32_t transId; ENetError result; }; // ScoreSetPoints extern const NetMsg kNetMsg_Auth2Cli_ScoreSetPointsReply; struct Auth2Cli_ScoreSetPointsReply { - dword messageId; - dword transId; + uint32_t messageId; + uint32_t transId; ENetError result; }; // ScoreGetRanksReply extern const NetMsg kNetMsg_Auth2Cli_ScoreGetRanksReply; struct Auth2Cli_ScoreGetRanksReply { - dword messageId; - dword transId; + uint32_t messageId; + uint32_t transId; ENetError result; - dword rankCount; - dword byteCount; - byte buffer[1]; // [byteCount], actually + uint32_t rankCount; + uint32_t byteCount; + uint8_t buffer[1]; // [byteCount], actually // no more fields }; diff --git a/Sources/Plasma/NucleusLib/pnNetProtocol/Private/Protocols/Cli2Csr/pnNpCli2Csr.h b/Sources/Plasma/NucleusLib/pnNetProtocol/Private/Protocols/Cli2Csr/pnNpCli2Csr.h index 66112800..49986ec9 100644 --- a/Sources/Plasma/NucleusLib/pnNetProtocol/Private/Protocols/Cli2Csr/pnNpCli2Csr.h +++ b/Sources/Plasma/NucleusLib/pnNetProtocol/Private/Protocols/Cli2Csr/pnNpCli2Csr.h @@ -75,7 +75,7 @@ enum { kNumCli2CsrMessages }; -COMPILER_ASSERT_HEADER(Cli2Scr, kNumCli2CsrMessages <= (word)-1); +COMPILER_ASSERT_HEADER(Cli2Scr, kNumCli2CsrMessages <= (uint16_t)-1); //============================================================================ @@ -93,7 +93,7 @@ enum { kNumCsr2CliMessages }; -COMPILER_ASSERT_HEADER(Cli2Scr, kNumCsr2CliMessages <= (word)-1); +COMPILER_ASSERT_HEADER(Cli2Scr, kNumCsr2CliMessages <= (uint16_t)-1); /***************************************************************************** @@ -107,7 +107,7 @@ COMPILER_ASSERT_HEADER(Cli2Scr, kNumCsr2CliMessages <= (word)-1); // Connect packet struct Cli2Csr_ConnData { - dword dataBytes; + uint32_t dataBytes; }; struct Cli2Csr_Connect { AsyncSocketConnectPacket hdr; @@ -118,8 +118,8 @@ struct Cli2Csr_Connect { // Message header struct Cli2Csr_MsgHeader { - dword messageId; - dword transId; + uint32_t messageId; + uint32_t transId; }; //============================================================================ @@ -128,9 +128,9 @@ struct Cli2Csr_MsgHeader { // PingRequest extern const NetMsg kNetMsg_Cli2Csr_PingRequest; struct Cli2Csr_PingRequest : Cli2Csr_MsgHeader { - dword pingTimeMs; - dword payloadBytes; - byte payload[1]; // [payloadBytes] + uint32_t pingTimeMs; + uint32_t payloadBytes; + uint8_t payload[1]; // [payloadBytes] }; // RegisterRequest @@ -141,8 +141,8 @@ struct Cli2Csr_RegisterRequest : Cli2Csr_MsgHeader { // LoginRequest extern const NetMsg kNetMsg_Cli2Csr_LoginRequest; struct Cli2Csr_LoginRequest : Cli2Csr_MsgHeader { - dword clientChallenge; - wchar csrName[kMaxAccountNameLength]; + uint32_t clientChallenge; + wchar_t csrName[kMaxAccountNameLength]; ShaDigest challengeHash; }; @@ -153,16 +153,16 @@ struct Cli2Csr_LoginRequest : Cli2Csr_MsgHeader { // PingReply extern const NetMsg kNetMsg_Csr2Cli_PingReply; struct Csr2Cli_PingReply : Cli2Csr_MsgHeader { - dword pingTimeMs; - dword payloadBytes; - byte payload[1]; // [payloadBytes] + uint32_t pingTimeMs; + uint32_t payloadBytes; + uint8_t payload[1]; // [payloadBytes] }; // RegisterReply extern const NetMsg kNetMsg_Csr2Cli_RegisterReply; struct Csr2Cli_RegisterReply : Cli2Csr_MsgHeader { - dword serverChallenge; - dword csrBuildId; // buildId of the latest csr client + uint32_t serverChallenge; + uint32_t csrBuildId; // buildId of the latest csr client }; // LoginReply @@ -170,7 +170,7 @@ extern const NetMsg kNetMsg_Csr2Cli_LoginReply; struct Csr2Cli_LoginReply : Cli2Csr_MsgHeader { ENetError result; Uuid csrId; - dword csrFlags; + uint32_t csrFlags; }; diff --git a/Sources/Plasma/NucleusLib/pnNetProtocol/Private/Protocols/Cli2File/pnNpCli2File.h b/Sources/Plasma/NucleusLib/pnNetProtocol/Private/Protocols/Cli2File/pnNpCli2File.h index 8cd76178..2207db6a 100644 --- a/Sources/Plasma/NucleusLib/pnNetProtocol/Private/Protocols/Cli2File/pnNpCli2File.h +++ b/Sources/Plasma/NucleusLib/pnNetProtocol/Private/Protocols/Cli2File/pnNpCli2File.h @@ -107,8 +107,8 @@ static const unsigned kFileSrvBuildId = 0; ***/ struct Cli2File_ConnData { - dword dataBytes; - dword buildId; + uint32_t dataBytes; + uint32_t buildId; unsigned serverType; }; struct Cli2File_Connect { @@ -117,8 +117,8 @@ struct Cli2File_Connect { }; struct Cli2File_MsgHeader { - dword messageBytes; - dword messageId; + uint32_t messageBytes; + uint32_t messageId; }; @@ -130,34 +130,34 @@ struct Cli2File_MsgHeader { // PingRequest struct Cli2File_PingRequest : Cli2File_MsgHeader { - dword pingTimeMs; + uint32_t pingTimeMs; }; // BuildIdRequest struct Cli2File_BuildIdRequest : Cli2File_MsgHeader { - dword transId; + uint32_t transId; }; // ManifestRequest struct Cli2File_ManifestRequest : Cli2File_MsgHeader { - dword transId; - wchar group[MAX_PATH]; + uint32_t transId; + wchar_t group[MAX_PATH]; unsigned buildId; // 0 = newest }; struct Cli2File_ManifestEntryAck : Cli2File_MsgHeader { - dword transId; - dword readerId; + uint32_t transId; + uint32_t readerId; }; // FileDownloadRequest struct Cli2File_FileDownloadRequest : Cli2File_MsgHeader { - dword transId; - wchar filename[MAX_PATH]; + uint32_t transId; + wchar_t filename[MAX_PATH]; unsigned buildId; // 0 = newest }; struct Cli2File_FileDownloadChunkAck : Cli2File_MsgHeader { - dword transId; - dword readerId; + uint32_t transId; + uint32_t readerId; }; @@ -169,12 +169,12 @@ struct Cli2File_FileDownloadChunkAck : Cli2File_MsgHeader { // PingReply struct File2Cli_PingReply : Cli2File_MsgHeader { - dword pingTimeMs; + uint32_t pingTimeMs; }; // BuildIdReply struct File2Cli_BuildIdReply : Cli2File_MsgHeader { - dword transId; + uint32_t transId; ENetError result; unsigned buildId; }; @@ -186,22 +186,22 @@ struct File2Cli_BuildIdUpdate : Cli2File_MsgHeader { // ManifestReply struct File2Cli_ManifestReply : Cli2File_MsgHeader { - dword transId; + uint32_t transId; ENetError result; - dword readerId; - dword numFiles; // total number of files - dword wcharCount; // size of the buffer - wchar manifestData[1]; // manifestData[wcharCount], actually + uint32_t readerId; + uint32_t numFiles; // total number of files + uint32_t wchar_tCount; // size of the buffer + wchar_t manifestData[1]; // manifestData[wchar_tCount], actually }; // FileDownloadReply struct File2Cli_FileDownloadReply : Cli2File_MsgHeader { - dword transId; + uint32_t transId; ENetError result; - dword readerId; - dword totalFileSize; - dword byteCount; - byte fileData[1]; // fileData[byteCount], actually + uint32_t readerId; + uint32_t totalFileSize; + uint32_t byteCount; + uint8_t fileData[1]; // fileData[byteCount], actually }; diff --git a/Sources/Plasma/NucleusLib/pnNetProtocol/Private/Protocols/Cli2Game/pnNpCli2Game.h b/Sources/Plasma/NucleusLib/pnNetProtocol/Private/Protocols/Cli2Game/pnNpCli2Game.h index df52144f..80665418 100644 --- a/Sources/Plasma/NucleusLib/pnNetProtocol/Private/Protocols/Cli2Game/pnNpCli2Game.h +++ b/Sources/Plasma/NucleusLib/pnNetProtocol/Private/Protocols/Cli2Game/pnNpCli2Game.h @@ -65,7 +65,7 @@ enum { kNumCli2GameMessages }; -COMPILER_ASSERT_HEADER(Cli2Game, kNumCli2GameMessages <= (word)-1); +COMPILER_ASSERT_HEADER(Cli2Game, kNumCli2GameMessages <= (uint16_t)-1); enum { // Global @@ -80,7 +80,7 @@ enum { kNumGame2CliMessages }; -COMPILER_ASSERT_HEADER(Cli2Game, kNumGame2CliMessages <= (word)-1); +COMPILER_ASSERT_HEADER(Cli2Game, kNumGame2CliMessages <= (uint16_t)-1); //============================================================================ @@ -96,7 +96,7 @@ COMPILER_ASSERT_HEADER(Cli2Game, kNumGame2CliMessages <= (word)-1); ***/ struct Cli2Game_ConnData { - dword dataBytes; + uint32_t dataBytes; Uuid accountUuid; Uuid ageUuid; }; @@ -115,36 +115,36 @@ struct Cli2Game_Connect { // PingRequest extern const NetMsg kNetMsg_Cli2Game_PingRequest; struct Cli2Game_PingRequest { - dword messageId; - dword pingTimeMs; + uint32_t messageId; + uint32_t pingTimeMs; }; // JoinAgeRequest extern const NetMsg kNetMsg_Cli2Game_JoinAgeRequest; struct Cli2Game_JoinAgeRequest { - dword messageId; - dword transId; - dword ageMcpId; + uint32_t messageId; + uint32_t transId; + uint32_t ageMcpId; Uuid accountUuid; - dword playerInt; + uint32_t playerInt; }; // PropagateBuffer extern const NetMsg kNetMsg_Cli2Game_PropagateBuffer; struct Cli2Game_PropagateBuffer { - dword messageId; - dword type; - dword bytes; - byte buffer[1]; // actually, buffer[bytes] + uint32_t messageId; + uint32_t type; + uint32_t bytes; + uint8_t buffer[1]; // actually, buffer[bytes] // no more fields }; // GameMgrMsg extern const NetMsg kNetMsg_Cli2Game_GameMgrMsg; struct Cli2Game_GameMgrMsg { - dword messageId; - dword bytes; - byte buffer[1]; // actually: buffer[bytes] + uint32_t messageId; + uint32_t bytes; + uint8_t buffer[1]; // actually: buffer[bytes] }; @@ -157,34 +157,34 @@ struct Cli2Game_GameMgrMsg { // PingReply extern const NetMsg kNetMsg_Game2Cli_PingReply; struct Game2Cli_PingReply{ - dword messageId; - dword pingTimeMs; + uint32_t messageId; + uint32_t pingTimeMs; }; // JoinAgeReply extern const NetMsg kNetMsg_Game2Cli_JoinAgeReply; struct Game2Cli_JoinAgeReply { - dword messageId; - dword transId; + uint32_t messageId; + uint32_t transId; ENetError result; }; // PropagateBuffer extern const NetMsg kNetMsg_Game2Cli_PropagateBuffer; struct Game2Cli_PropagateBuffer { - dword messageId; - dword type; - dword bytes; - byte buffer[1]; // actually, buffer[bytes] + uint32_t messageId; + uint32_t type; + uint32_t bytes; + uint8_t buffer[1]; // actually, buffer[bytes] // no more fields }; // GameMgrMsg extern const NetMsg kNetMsg_Game2Cli_GameMgrMsg; struct Game2Cli_GameMgrMsg { - dword messageId; - dword bytes; - byte buffer[1]; // actually: buffer[bytes] + uint32_t messageId; + uint32_t bytes; + uint8_t buffer[1]; // actually: buffer[bytes] }; diff --git a/Sources/Plasma/NucleusLib/pnNetProtocol/Private/Protocols/Cli2GateKeeper/pnNpCli2GateKeeper.h b/Sources/Plasma/NucleusLib/pnNetProtocol/Private/Protocols/Cli2GateKeeper/pnNpCli2GateKeeper.h index cba2c314..69b7c71c 100644 --- a/Sources/Plasma/NucleusLib/pnNetProtocol/Private/Protocols/Cli2GateKeeper/pnNpCli2GateKeeper.h +++ b/Sources/Plasma/NucleusLib/pnNetProtocol/Private/Protocols/Cli2GateKeeper/pnNpCli2GateKeeper.h @@ -53,7 +53,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #define PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNNETPROTOCOL_PRIVATE_PROTOCOLS_PNNPCLI2GATEKEEPER_H -// kNetProtocolCli2GateKeeper messages (must be <= (word)-1) +// kNetProtocolCli2GateKeeper messages (must be <= (uint16_t)-1) enum { // Global kCli2GateKeeper_PingRequest, @@ -62,7 +62,7 @@ enum { kNumCli2GateKeeperMessages }; -COMPILER_ASSERT_HEADER(Cli2GateKeeper, kNumCli2GateKeeperMessages <= (word)-1); +COMPILER_ASSERT_HEADER(Cli2GateKeeper, kNumCli2GateKeeperMessages <= (uint16_t)-1); enum { // Global @@ -72,7 +72,7 @@ enum { kNumGateKeeper2CliMessages }; -COMPILER_ASSERT_HEADER(Cli2GateKeeper, kNumGateKeeper2CliMessages <= (word)-1); +COMPILER_ASSERT_HEADER(Cli2GateKeeper, kNumGateKeeper2CliMessages <= (uint16_t)-1); //============================================================================ @@ -88,7 +88,7 @@ COMPILER_ASSERT_HEADER(Cli2GateKeeper, kNumGateKeeper2CliMessages <= (word)-1); ***/ struct Cli2GateKeeper_ConnData { - dword dataBytes; + uint32_t dataBytes; Uuid token; }; @@ -103,26 +103,26 @@ struct Cli2GateKeeper_Connect { // PingRequest extern const NetMsg kNetMsg_Cli2GateKeeper_PingRequest; struct Cli2GateKeeper_PingRequest { - dword messageId; - dword transId; - dword pingTimeMs; - dword payloadBytes; - byte payload[1]; // [payloadBytes] + uint32_t messageId; + uint32_t transId; + uint32_t pingTimeMs; + uint32_t payloadBytes; + uint8_t payload[1]; // [payloadBytes] }; // FileSrvIpAddressRequest extern const NetMsg kNetMsg_Cli2GateKeeper_FileSrvIpAddressRequest; struct Cli2GateKeeper_FileSrvIpAddressRequest { - dword messageId; - dword transId; - byte isPatcher; + uint32_t messageId; + uint32_t transId; + uint8_t isPatcher; }; // AuthSrvIpAddressRequest extern const NetMsg kNetMsg_Cli2GateKeeper_AuthSrvIpAddressRequest; struct Cli2GateKeeper_AuthSrvIpAddressRequest { - dword messageId; - dword transId; + uint32_t messageId; + uint32_t transId; }; @@ -132,26 +132,26 @@ struct Cli2GateKeeper_AuthSrvIpAddressRequest { // PingReply extern const NetMsg kNetMsg_GateKeeper2Cli_PingReply; struct GateKeeper2Cli_PingReply { - dword messageId; - dword transId; - dword pingTimeMs; - dword payloadBytes; - byte payload[1]; // [payloadBytes] + uint32_t messageId; + uint32_t transId; + uint32_t pingTimeMs; + uint32_t payloadBytes; + uint8_t payload[1]; // [payloadBytes] }; // FileSrvIpAddressReply extern const NetMsg kNetMsg_GateKeeper2Cli_FileSrvIpAddressReply; struct GateKeeper2Cli_FileSrvIpAddressReply { - dword messageId; - dword transId; - wchar address[24]; + uint32_t messageId; + uint32_t transId; + wchar_t address[24]; }; // FileSrvIpAddressReply extern const NetMsg kNetMsg_GateKeeper2Cli_AuthSrvIpAddressReply; struct GateKeeper2Cli_AuthSrvIpAddressReply { - dword messageId; - dword transId; - wchar address[24]; + uint32_t messageId; + uint32_t transId; + wchar_t address[24]; }; \ No newline at end of file diff --git a/Sources/Plasma/NucleusLib/pnNetProtocol/Private/Protocols/Srv2Db/pnNpSrv2Db.cpp b/Sources/Plasma/NucleusLib/pnNetProtocol/Private/Protocols/Srv2Db/pnNpSrv2Db.cpp index 6b33c8ff..c9e99a27 100644 --- a/Sources/Plasma/NucleusLib/pnNetProtocol/Private/Protocols/Srv2Db/pnNpSrv2Db.cpp +++ b/Sources/Plasma/NucleusLib/pnNetProtocol/Private/Protocols/Srv2Db/pnNpSrv2Db.cpp @@ -67,7 +67,7 @@ bool Srv2DbValidateConnect ( const Srv2Db_ConnData & connect = * (const Srv2Db_ConnData *) listen->buffer; // Validate message size - const unsigned kMinStructSize = sizeof(dword) * 1; + const unsigned kMinStructSize = sizeof(uint32_t) * 1; if (listen->bytes < kMinStructSize) return false; if (listen->bytes < connect.dataBytes) @@ -83,8 +83,8 @@ bool Srv2DbValidateConnect ( return false; } - ZEROPTR(connectPtr); - MemCopy(connectPtr, &connect, min(sizeof(*connectPtr), connect.dataBytes)); + memset(connectPtr, 0, sizeof(*connectPtr)); + memcpy(connectPtr, &connect, min(sizeof(*connectPtr), connect.dataBytes)); listen->bytesProcessed += connect.dataBytes; return true; diff --git a/Sources/Plasma/NucleusLib/pnNetProtocol/Private/Protocols/Srv2Db/pnNpSrv2Db.h b/Sources/Plasma/NucleusLib/pnNetProtocol/Private/Protocols/Srv2Db/pnNpSrv2Db.h index 2a5fbb7e..e51a7bc7 100644 --- a/Sources/Plasma/NucleusLib/pnNetProtocol/Private/Protocols/Srv2Db/pnNpSrv2Db.h +++ b/Sources/Plasma/NucleusLib/pnNetProtocol/Private/Protocols/Srv2Db/pnNpSrv2Db.h @@ -170,8 +170,8 @@ enum { ***/ struct Srv2Db_ConnData { - dword dataBytes; - dword srvType; + uint32_t dataBytes; + uint32_t srvType; }; struct Srv2Db_Connect { AsyncSocketConnectPacket hdr; @@ -187,51 +187,51 @@ struct Srv2Db_Connect { struct Srv2Db_AccountExistsRequest : SrvMsgHeader { - wchar accountName[kMaxAccountNameLength]; + wchar_t accountName[kMaxAccountNameLength]; }; struct Srv2Db_AccountCreateRequest : SrvMsgHeader { - wchar accountName[kMaxAccountNameLength]; + wchar_t accountName[kMaxAccountNameLength]; ShaDigest namePassHash; - dword billingType; - dword accountFlags; - wchar foreignAcctId[kMaxPublisherAuthKeyLength]; + uint32_t billingType; + uint32_t accountFlags; + wchar_t foreignAcctId[kMaxPublisherAuthKeyLength]; }; struct Srv2Db_AccountCreateFromKeyRequest : SrvMsgHeader { - wchar accountName[kMaxAccountNameLength]; + wchar_t accountName[kMaxAccountNameLength]; ShaDigest namePassHash; Uuid key; - dword billingType; + uint32_t billingType; }; struct Srv2Db_AccountLoginRequest : SrvMsgHeader { - wchar accountName[kMaxAccountNameLength]; + wchar_t accountName[kMaxAccountNameLength]; }; struct Srv2Db_AccountLoginRequest2 : SrvMsgHeader { - wchar accountName[kMaxAccountNameLength]; - dword buildId; + wchar_t accountName[kMaxAccountNameLength]; + uint32_t buildId; }; struct Srv2Db_AccountLogout : SrvMsgHeader { Uuid accountUuid; - dword timeLoggedMins; + uint32_t timeLoggedMins; }; struct Srv2Db_AccountChangePasswordRequest : SrvMsgHeader { - wchar accountName[kMaxAccountNameLength]; + wchar_t accountName[kMaxAccountNameLength]; ShaDigest namePassHash; }; struct Srv2Db_AccountSetRolesRequest : SrvMsgHeader { - wchar accountName[kMaxAccountNameLength]; - dword accountFlags; + wchar_t accountName[kMaxAccountNameLength]; + uint32_t accountFlags; }; struct Srv2Db_AccountSetBillingTypeRequest : SrvMsgHeader { - wchar accountName[kMaxAccountNameLength]; - dword billingType; + wchar_t accountName[kMaxAccountNameLength]; + uint32_t billingType; }; struct Srv2Db_AccountActivateRequest : SrvMsgHeader { @@ -239,38 +239,38 @@ struct Srv2Db_AccountActivateRequest : SrvMsgHeader { }; struct Srv2Db_AccountLockPlayerNameRequest :SrvMsgHeader { - wchar playerName[kMaxPlayerNameLength]; + wchar_t playerName[kMaxPlayerNameLength]; Uuid accountUuid; }; struct Srv2Db_VaultNodeCreateRequest : SrvMsgHeader { Uuid accountUuid; - dword creatorId; - dword nodeBytes; - byte nodeBuffer[1]; + uint32_t creatorId; + uint32_t nodeBytes; + uint8_t nodeBuffer[1]; }; struct Srv2Db_VaultNodeFetchRequest : SrvMsgHeader { - dword nodeId; + uint32_t nodeId; }; struct Srv2Db_VaultNodeChanged : SrvMsgHeader { - dword nodeId; + uint32_t nodeId; Uuid revisionId; }; struct Srv2Db_VaultNodeSaveRequest : SrvMsgHeader { Uuid revisionId; - dword nodeId; + uint32_t nodeId; unsigned playerCheckId; unsigned isRequestFromAuth; - dword nodeBytes; - byte buffer[1]; // buffer[bytes], actually + uint32_t nodeBytes; + uint8_t buffer[1]; // buffer[bytes], actually // no more fields after var length alloc }; struct Srv2Db_VaultNodeDeleteRequest : SrvMsgHeader { - dword nodeId; + uint32_t nodeId; unsigned playerCheckId; unsigned isRequestFromAuth; }; @@ -278,19 +278,19 @@ struct Srv2Db_VaultNodeDeleteRequest : SrvMsgHeader { struct Srv2Db_VaultNodeFindRequest : SrvMsgHeader { // Template node to match - dword nodeBytes; - byte nodeBuffer[1]; // [nodeBytes], actually + uint32_t nodeBytes; + uint8_t nodeBuffer[1]; // [nodeBytes], actually // no more fields after var length alloc }; struct Srv2Db_VaultNodeAddRefs : SrvMsgHeader { - dword refCount; + uint32_t refCount; NetVaultNodeRef refs[1]; // no more fields after var length alloc }; struct Srv2Db_VaultNodeDelRefs : SrvMsgHeader { - dword refCount; + uint32_t refCount; unsigned playerCheckId; unsigned isRequestFromAuth; NetVaultNodeRef refs[1]; @@ -298,105 +298,105 @@ struct Srv2Db_VaultNodeDelRefs : SrvMsgHeader { }; struct Srv2Db_VaultNodeGetChildRefs : SrvMsgHeader { - dword nodeId; - dword maxDepth; + uint32_t nodeId; + uint32_t maxDepth; }; struct Srv2Db_VaultNodeGetParentRefs : SrvMsgHeader { - dword nodeId; - dword maxDepth; + uint32_t nodeId; + uint32_t maxDepth; }; struct Srv2Db_VaultSendNode : SrvMsgHeader { - dword srcPlayerId; // sender - dword srcNodeId; // sent item - dword dstPlayerId; // recipient + uint32_t srcPlayerId; // sender + uint32_t srcNodeId; // sent item + uint32_t dstPlayerId; // recipient }; struct Srv2Db_SetAgeSequenceNumRequest : SrvMsgHeader { - dword nodeId; - wchar ageInstName[kMaxAgeNameLength]; - wchar ageUserName[kMaxAgeNameLength]; + uint32_t nodeId; + wchar_t ageInstName[kMaxAgeNameLength]; + wchar_t ageUserName[kMaxAgeNameLength]; }; struct Srv2Db_StateSaveObject : SrvMsgHeader { - dword buildId; + uint32_t buildId; Uuid ownerId; - wchar objectName[kMaxStateObjectName]; - dword objectDataBytes; - byte objectData[1]; + wchar_t objectName[kMaxStateObjectName]; + uint32_t objectDataBytes; + uint8_t objectData[1]; // no more fields after var length alloc }; struct Srv2Db_StateDeleteObject : SrvMsgHeader { Uuid ownerId; - wchar objectName[kMaxStateObjectName]; + wchar_t objectName[kMaxStateObjectName]; }; struct Srv2Db_StateFetchObject : SrvMsgHeader { Uuid ownerId; - wchar objectName[kMaxStateObjectName]; + wchar_t objectName[kMaxStateObjectName]; }; struct Srv2Db_GetPublicAgeInfoIds : SrvMsgHeader { - wchar ageName[kMaxAgeNameLength]; + wchar_t ageName[kMaxAgeNameLength]; }; struct Srv2Db_SetAgePublic : SrvMsgHeader { - dword playerId; - dword ageInfoId; - byte publicOrNot; + uint32_t playerId; + uint32_t ageInfoId; + uint8_t publicOrNot; }; struct Srv2Db_SetPlayerBanStatusRequest : SrvMsgHeader { - dword playerId; - dword banned; + uint32_t playerId; + uint32_t banned; }; struct Srv2Db_ScoreCreate : SrvMsgHeader { - dword ownerId; - wchar gameName[kMaxGameScoreNameLength]; - dword gameType; - dword value; + uint32_t ownerId; + wchar_t gameName[kMaxGameScoreNameLength]; + uint32_t gameType; + uint32_t value; }; struct Srv2Db_ScoreDelete : SrvMsgHeader { - dword scoreId; + uint32_t scoreId; }; struct Srv2Db_ScoreFindScoreIds : SrvMsgHeader { - dword ownerId; - wchar gameName[kMaxGameScoreNameLength]; + uint32_t ownerId; + wchar_t gameName[kMaxGameScoreNameLength]; }; struct Srv2Db_ScoreFetchScores : SrvMsgHeader { - dword scoreCount; - dword scoreIds[1]; // [scoreCount], actually + uint32_t scoreCount; + uint32_t scoreIds[1]; // [scoreCount], actually // no more fields after var length alloc }; struct Srv2Db_ScoreSave : SrvMsgHeader { - dword scoreId; - dword value; + uint32_t scoreId; + uint32_t value; }; struct Srv2Db_ScoreGetRanks : SrvMsgHeader { - dword ownerId; - dword scoreGroup; - dword parentFolderId; - wchar gameName[kMaxGameScoreNameLength]; - dword timePeriod; - dword numResults; - dword pageNumber; - dword sortDesc; + uint32_t ownerId; + uint32_t scoreGroup; + uint32_t parentFolderId; + wchar_t gameName[kMaxGameScoreNameLength]; + uint32_t timePeriod; + uint32_t numResults; + uint32_t pageNumber; + uint32_t sortDesc; }; struct Srv2Db_PlayerOnline : SrvMsgHeader { - dword playerId; + uint32_t playerId; }; struct Srv2Db_PlayerOffline : SrvMsgHeader { - dword playerId; + uint32_t playerId; }; struct Srv2Db_AgeOnline : SrvMsgHeader { @@ -408,7 +408,7 @@ struct Srv2Db_AgeOffline : SrvMsgHeader { }; struct Srv2Db_CsrAcctInfoRequest : SrvMsgHeader { - wchar csrName[kMaxAccountNameLength]; + wchar_t csrName[kMaxAccountNameLength]; }; struct Srv2Db_FetchInviterInfo : SrvMsgHeader { @@ -423,7 +423,7 @@ struct Srv2Db_FetchInviterInfo : SrvMsgHeader { ***/ struct Db2Srv_AccountExistsReply : SrvMsgHeader { - byte exists; + uint8_t exists; }; struct Db2Srv_AccountCreateReply : SrvMsgHeader { @@ -437,36 +437,36 @@ struct Db2Srv_AccountCreateFromKeyReply : SrvMsgHeader { struct Db2Srv_AccountLoginReply : SrvMsgHeader { Uuid accountUuid; - dword accountFlags; - dword billingType; + uint32_t accountFlags; + uint32_t billingType; ShaDigest namePassHash; }; struct Db2Srv_VaultNodeCreateReply : SrvMsgHeader { - dword nodeId; + uint32_t nodeId; }; struct Db2Srv_VaultNodeFetchReply : SrvMsgHeader { - dword nodeBytes; - byte buffer[1]; + uint32_t nodeBytes; + uint8_t buffer[1]; // no more fields after var length alloc }; struct Db2Srv_VaultNodeFindReply : SrvMsgHeader { // out: ids of matching nodes - dword nodeIdCount; - dword nodeIds[1]; // [nodeIdCount], actually + uint32_t nodeIdCount; + uint32_t nodeIds[1]; // [nodeIdCount], actually // no more fields after var length alloc }; struct Db2Srv_VaultNodeRefs : SrvMsgHeader { - dword refCount; + uint32_t refCount; NetVaultNodeRef refs[1]; // no more fields after var length alloc }; struct Db2Srv_SetAgeSequenceNumReply : SrvMsgHeader { - dword sequenceNum; + uint32_t sequenceNum; }; struct Db2Srv_FetchInviterInfoReply : SrvMsgHeader { @@ -474,79 +474,79 @@ struct Db2Srv_FetchInviterInfoReply : SrvMsgHeader { }; struct Db2Srv_StateObjectFetched : SrvMsgHeader { - dword buildId; + uint32_t buildId; Uuid ownerId; - wchar objectName[kMaxStateObjectName]; - dword objectDataBytes; - byte objectData[1]; + wchar_t objectName[kMaxStateObjectName]; + uint32_t objectDataBytes; + uint8_t objectData[1]; // no more fields after var length alloc }; struct Db2Srv_NotifyVaultNodeChanged : SrvMsgHeader { - dword nodeId; + uint32_t nodeId; Uuid revId; - dword notifyIdCount; - dword notifyIds[1]; + uint32_t notifyIdCount; + uint32_t notifyIds[1]; }; struct Db2Srv_NotifyVaultNodeAdded : SrvMsgHeader { NetVaultNodeRef ref; - dword notifyIdCount; - dword notifyIds[1]; + uint32_t notifyIdCount; + uint32_t notifyIds[1]; }; struct Db2Srv_NotifyVaultNodeRemoved : SrvMsgHeader { - dword parentId; - dword childId; - dword notifyIdCount; - dword notifyIds[1]; + uint32_t parentId; + uint32_t childId; + uint32_t notifyIdCount; + uint32_t notifyIds[1]; }; struct Db2Srv_NotifyVaultNodeDeleted : SrvMsgHeader { - dword nodeId; - dword notifyIdCount; - dword notifyIds[1]; + uint32_t nodeId; + uint32_t notifyIdCount; + uint32_t notifyIds[1]; }; struct Db2Srv_PublicAgeInfoIds : SrvMsgHeader { - dword idCount; - dword ids[1]; // [idCount], actually + uint32_t idCount; + uint32_t ids[1]; // [idCount], actually // no more fields after var length alloc }; struct Db2Srv_ScoreCreateReply : SrvMsgHeader { - dword scoreId; - dword createdTime; + uint32_t scoreId; + uint32_t createdTime; }; struct Db2Srv_ScoreDeleteReply : SrvMsgHeader { - dword ownerId; - wchar gameName[kMaxGameScoreNameLength]; + uint32_t ownerId; + wchar_t gameName[kMaxGameScoreNameLength]; }; struct Db2Srv_ScoreFindScoreIdsReply : SrvMsgHeader { - dword idCount; - dword scoreIds[1]; // [idCount], actually + uint32_t idCount; + uint32_t scoreIds[1]; // [idCount], actually // no more fields after var length alloc }; struct Db2Srv_ScoreFetchScoresReply : SrvMsgHeader { - dword scoreCount; - dword byteCount; - byte buffer[1]; // [byteCount], actually + uint32_t scoreCount; + uint32_t byteCount; + uint8_t buffer[1]; // [byteCount], actually // no more fields after var length alloc }; struct Db2Srv_ScoreGetRanksReply : SrvMsgHeader { - dword rankCount; - dword byteCount; - byte buffer[1]; // [byteCount], actually + uint32_t rankCount; + uint32_t byteCount; + uint8_t buffer[1]; // [byteCount], actually // no more fields after var length alloc }; struct Db2Srv_CsrAcctInfoReply : SrvMsgHeader { Uuid csrId; - dword csrFlags; + uint32_t csrFlags; ShaDigest namePassHash; }; diff --git a/Sources/Plasma/NucleusLib/pnNetProtocol/Private/Protocols/Srv2Log/pnNpSrv2Log.cpp b/Sources/Plasma/NucleusLib/pnNetProtocol/Private/Protocols/Srv2Log/pnNpSrv2Log.cpp index faff68da..8fb697b4 100644 --- a/Sources/Plasma/NucleusLib/pnNetProtocol/Private/Protocols/Srv2Log/pnNpSrv2Log.cpp +++ b/Sources/Plasma/NucleusLib/pnNetProtocol/Private/Protocols/Srv2Log/pnNpSrv2Log.cpp @@ -68,7 +68,7 @@ bool Srv2LogValidateConnect ( const Srv2Log_ConnData & connect = * (const Srv2Log_ConnData *) listen->buffer; // Validate message size - const unsigned kMinStructSize = sizeof(dword) * 3; + const unsigned kMinStructSize = sizeof(uint32_t) * 3; if (listen->bytes < kMinStructSize) return false; if (listen->bytes < connect.dataBytes) @@ -79,8 +79,8 @@ bool Srv2LogValidateConnect ( connect.srvType == kSrvTypeMcp || connect.srvType == kSrvTypeState || connect.srvType == kSrvTypeFile || connect.srvType == kSrvTypeDll)) return false; - ZEROPTR(connectPtr); - MemCopy(connectPtr, &connect, min(sizeof(*connectPtr), connect.dataBytes)); + memset(connectPtr, 0, sizeof(*connectPtr)); + memcpy(connectPtr, &connect, min(sizeof(*connectPtr), connect.dataBytes)); listen->bytesProcessed += connect.dataBytes; return true; diff --git a/Sources/Plasma/NucleusLib/pnNetProtocol/Private/Protocols/Srv2Log/pnNpSrv2Log.h b/Sources/Plasma/NucleusLib/pnNetProtocol/Private/Protocols/Srv2Log/pnNpSrv2Log.h index 6bf0cfd6..b7ac0b01 100644 --- a/Sources/Plasma/NucleusLib/pnNetProtocol/Private/Protocols/Srv2Log/pnNpSrv2Log.h +++ b/Sources/Plasma/NucleusLib/pnNetProtocol/Private/Protocols/Srv2Log/pnNpSrv2Log.h @@ -74,11 +74,11 @@ enum { ***/ struct Srv2Log_ConnData { - dword dataBytes; - dword buildId; - dword srvType; - dword buildType; - dword productId; + uint32_t dataBytes; + uint32_t buildId; + uint32_t srvType; + uint32_t buildType; + uint32_t productId; }; struct Srv2Log_Connect { @@ -95,7 +95,7 @@ struct Srv2Log_Connect { struct Srv2Log_LogMsg : SrvMsgHeader { unsigned eventType; - qword timestamp; + uint64_t timestamp; }; diff --git a/Sources/Plasma/NucleusLib/pnNetProtocol/Private/Protocols/Srv2Mcp/pnNpSrv2Mcp.cpp b/Sources/Plasma/NucleusLib/pnNetProtocol/Private/Protocols/Srv2Mcp/pnNpSrv2Mcp.cpp index 97198c36..8b8dc764 100644 --- a/Sources/Plasma/NucleusLib/pnNetProtocol/Private/Protocols/Srv2Mcp/pnNpSrv2Mcp.cpp +++ b/Sources/Plasma/NucleusLib/pnNetProtocol/Private/Protocols/Srv2Mcp/pnNpSrv2Mcp.cpp @@ -67,7 +67,7 @@ bool Srv2McpValidateConnect ( const Srv2Mcp_ConnData & connect = * (const Srv2Mcp_ConnData *) listen->buffer; // Validate message size - const unsigned kMinStructSize = sizeof(dword) * 3; + const unsigned kMinStructSize = sizeof(uint32_t) * 3; if (listen->bytes < kMinStructSize) return false; if (listen->bytes < connect.dataBytes) @@ -77,8 +77,8 @@ bool Srv2McpValidateConnect ( if (!(connect.srvType == kSrvTypeAuth || connect.srvType == kSrvTypeGame)) return false; - ZEROPTR(connectPtr); - MemCopy(connectPtr, &connect, min(sizeof(*connectPtr), connect.dataBytes)); + memset(connectPtr, 0, sizeof(*connectPtr)); + memcpy(connectPtr, &connect, min(sizeof(*connectPtr), connect.dataBytes)); listen->bytesProcessed += connect.dataBytes; return true; diff --git a/Sources/Plasma/NucleusLib/pnNetProtocol/Private/Protocols/Srv2Mcp/pnNpSrv2Mcp.h b/Sources/Plasma/NucleusLib/pnNetProtocol/Private/Protocols/Srv2Mcp/pnNpSrv2Mcp.h index be713225..bcc59484 100644 --- a/Sources/Plasma/NucleusLib/pnNetProtocol/Private/Protocols/Srv2Mcp/pnNpSrv2Mcp.h +++ b/Sources/Plasma/NucleusLib/pnNetProtocol/Private/Protocols/Srv2Mcp/pnNpSrv2Mcp.h @@ -106,10 +106,10 @@ enum { ***/ struct Srv2Mcp_ConnData { - dword dataBytes; - dword buildId; - dword srvType; - dword publicAddr; + uint32_t dataBytes; + uint32_t buildId; + uint32_t srvType; + uint32_t publicAddr; }; struct Srv2Mcp_Connect { AsyncSocketConnectPacket hdr; @@ -124,41 +124,41 @@ struct Srv2Mcp_Connect { ***/ struct Srv2Mcp_AgeJoinRequest : SrvMsgHeader { - wchar ageName[kMaxAgeNameLength]; + wchar_t ageName[kMaxAgeNameLength]; Uuid ageUuid; Uuid accountUuid; - dword playerInt; - byte ccrLevel; - wchar playerName[kMaxPlayerNameLength]; - dword buildId; + uint32_t playerInt; + uint8_t ccrLevel; + wchar_t playerName[kMaxPlayerNameLength]; + uint32_t buildId; }; struct Srv2Mcp_PlayerLoggedIn : SrvMsgHeader { - dword ageMcpId; + uint32_t ageMcpId; Uuid ageUuid; Uuid accountUuid; - wchar playerName[kMaxPlayerNameLength]; - dword playerInt; + wchar_t playerName[kMaxPlayerNameLength]; + uint32_t playerInt; }; struct Srv2Mcp_PlayerLoggedOut : SrvMsgHeader { - dword ageMcpId; + uint32_t ageMcpId; Uuid accountUuid; - dword playerInt; + uint32_t playerInt; }; struct Srv2Mcp_AgeSpawned : SrvMsgHeader { - wchar ageName[kMaxAgeNameLength]; + wchar_t ageName[kMaxAgeNameLength]; Uuid ageUuid; - dword buildId; + uint32_t buildId; }; struct Srv2Mcp_AgeDied : SrvMsgHeader { - dword ageMcpId; + uint32_t ageMcpId; }; struct Srv2Mcp_AccountLoginRequest : SrvMsgHeader { - wchar accountName[kMaxAccountNameLength]; + wchar_t accountName[kMaxAccountNameLength]; Uuid accountUuid; }; @@ -168,20 +168,20 @@ struct Srv2Mcp_AccountLogout : SrvMsgHeader { struct Srv2Mcp_AccountSetPlayer : SrvMsgHeader { Uuid accountUuid; - dword playerInt; + uint32_t playerInt; }; struct Srv2Mcp_PropagateBuffer : SrvMsgHeader { - dword type; - dword bufferLength; - dword numRecvrs; + uint32_t type; + uint32_t bufferLength; + uint32_t numRecvrs; // packed data: - // byte netMessage[]; - // dword playerlist[]; + // uint8_t netMessage[]; + // uint32_t playerlist[]; }; struct Srv2Mcp_KickPlayer : SrvMsgHeader { - dword playerInt; + uint32_t playerInt; }; /***************************************************************************** @@ -191,60 +191,60 @@ struct Srv2Mcp_KickPlayer : SrvMsgHeader { ***/ struct Mcp2Srv_AgeJoinReply : SrvMsgHeader { - dword ageMcpId; + uint32_t ageMcpId; Uuid ageUuid; NetAddressNode gameSrvNode; }; struct Mcp2Srv_AgeSpawnRequest : SrvMsgHeader { - wchar ageName[kMaxAgeNameLength]; - dword ageMcpId; + wchar_t ageName[kMaxAgeNameLength]; + uint32_t ageMcpId; Uuid ageUuid; - dword buildId; + uint32_t buildId; }; struct Mcp2Srv_AgeUnspawn : SrvMsgHeader { - dword ageMcpId; + uint32_t ageMcpId; }; struct Mcp2Srv_AgeAddPlayerRequest : SrvMsgHeader { - dword ageMcpId; + uint32_t ageMcpId; Uuid accountUuid; - dword playerInt; - byte ccrLevel; - wchar playerName[kMaxPlayerNameLength]; + uint32_t playerInt; + uint8_t ccrLevel; + wchar_t playerName[kMaxPlayerNameLength]; }; struct Mcp2Srv_AgeRemovePlayerRequest : SrvMsgHeader { Uuid ageMcpId; Uuid accountUuid; - dword playerInt; + uint32_t playerInt; }; struct Mcp2Srv_AgeSpawnedReply : SrvMsgHeader { - dword ageMcpId; // assigns a new mcpId if age wasn't found (in case of a reconnect) + uint32_t ageMcpId; // assigns a new mcpId if age wasn't found (in case of a reconnect) }; struct Mcp2Srv_AccountLoginReply : SrvMsgHeader { - dword acctMcpId; + uint32_t acctMcpId; }; struct Mcp2Srv_AccountNotifyKicked : SrvMsgHeader { Uuid accountUuid; - dword acctMcpId; + uint32_t acctMcpId; ENetError reason; }; struct Mcp2Srv_NotifyAgeSDLChanged : SrvMsgHeader { - dword ageMcpId; - byte global; + uint32_t ageMcpId; + uint8_t global; }; struct Mcp2Srv_PropagateBuffer : SrvMsgHeader { - dword ageMcpId; - dword type; - dword bytes; - byte buffer[1]; // actually, buffer[bytes] + uint32_t ageMcpId; + uint32_t type; + uint32_t bytes; + uint8_t buffer[1]; // actually, buffer[bytes] // no more fields }; diff --git a/Sources/Plasma/NucleusLib/pnNetProtocol/Private/Protocols/Srv2Score/pnNpSrv2Score.cpp b/Sources/Plasma/NucleusLib/pnNetProtocol/Private/Protocols/Srv2Score/pnNpSrv2Score.cpp index f64a5de1..d7a376d0 100644 --- a/Sources/Plasma/NucleusLib/pnNetProtocol/Private/Protocols/Srv2Score/pnNpSrv2Score.cpp +++ b/Sources/Plasma/NucleusLib/pnNetProtocol/Private/Protocols/Srv2Score/pnNpSrv2Score.cpp @@ -68,7 +68,7 @@ bool Srv2ScoreValidateConnect ( const Srv2Score_ConnData & connect = * (const Srv2Score_ConnData *) listen->buffer; // Validate message size - const unsigned kMinStructSize = sizeof(dword) * 3; + const unsigned kMinStructSize = sizeof(uint32_t) * 3; if (listen->bytes < kMinStructSize) return false; if (listen->bytes < connect.dataBytes) @@ -78,8 +78,8 @@ bool Srv2ScoreValidateConnect ( if (!(connect.srvType == kSrvTypeAuth || connect.srvType == kSrvTypeGame)) return false; - ZEROPTR(connectPtr); - MemCopy(connectPtr, &connect, min(sizeof(*connectPtr), connect.dataBytes)); + memset(connectPtr, 0, sizeof(*connectPtr)); + memcpy(connectPtr, &connect, min(sizeof(*connectPtr), connect.dataBytes)); listen->bytesProcessed += connect.dataBytes; return true; diff --git a/Sources/Plasma/NucleusLib/pnNetProtocol/Private/Protocols/Srv2Score/pnNpSrv2Score.h b/Sources/Plasma/NucleusLib/pnNetProtocol/Private/Protocols/Srv2Score/pnNpSrv2Score.h index 3b16bea9..cfd69d80 100644 --- a/Sources/Plasma/NucleusLib/pnNetProtocol/Private/Protocols/Srv2Score/pnNpSrv2Score.h +++ b/Sources/Plasma/NucleusLib/pnNetProtocol/Private/Protocols/Srv2Score/pnNpSrv2Score.h @@ -82,9 +82,9 @@ enum { ***/ struct Srv2Score_ConnData { - dword dataBytes; - dword buildId; - dword srvType; + uint32_t dataBytes; + uint32_t buildId; + uint32_t srvType; }; struct Srv2Score_Connect { AsyncSocketConnectPacket hdr; @@ -99,46 +99,46 @@ struct Srv2Score_Connect { ***/ struct Srv2Score_ScoreCreate : SrvMsgHeader { - dword ownerId; - wchar gameName[kMaxGameScoreNameLength]; - dword gameType; - dword value; + uint32_t ownerId; + wchar_t gameName[kMaxGameScoreNameLength]; + uint32_t gameType; + uint32_t value; }; struct Srv2Score_ScoreDelete : SrvMsgHeader { - dword scoreId; + uint32_t scoreId; }; struct Srv2Score_ScoreGetScores : SrvMsgHeader { - dword ownerId; - wchar gameName[kMaxGameScoreNameLength]; + uint32_t ownerId; + wchar_t gameName[kMaxGameScoreNameLength]; }; struct Srv2Score_ScoreAddPoints : SrvMsgHeader { - dword scoreId; - dword numPoints; + uint32_t scoreId; + uint32_t numPoints; }; struct Srv2Score_ScoreTransferPoints : SrvMsgHeader { - dword srcScoreId; - dword destScoreId; - dword numPoints; + uint32_t srcScoreId; + uint32_t destScoreId; + uint32_t numPoints; }; struct Srv2Score_ScoreSetPoints : SrvMsgHeader { - dword scoreId; - dword numPoints; + uint32_t scoreId; + uint32_t numPoints; }; struct Srv2Score_ScoreGetRanks : SrvMsgHeader { - dword ownerId; - dword scoreGroup; - dword parentFolderId; - wchar gameName[kMaxGameScoreNameLength]; - dword timePeriod; - dword numResults; - dword pageNumber; - dword sortDesc; + uint32_t ownerId; + uint32_t scoreGroup; + uint32_t parentFolderId; + wchar_t gameName[kMaxGameScoreNameLength]; + uint32_t timePeriod; + uint32_t numResults; + uint32_t pageNumber; + uint32_t sortDesc; }; @@ -149,20 +149,20 @@ struct Srv2Score_ScoreGetRanks : SrvMsgHeader { ***/ struct Score2Srv_ScoreCreateReply : SrvMsgHeader { - dword scoreId; - dword createdTime; + uint32_t scoreId; + uint32_t createdTime; }; struct Score2Srv_ScoreGetScoresReply : SrvMsgHeader { - dword scoreCount; - dword byteCount; - byte buffer[1]; + uint32_t scoreCount; + uint32_t byteCount; + uint8_t buffer[1]; }; struct Score2Srv_ScoreGetRanksReply : SrvMsgHeader { - dword rankCount; - dword byteCount; - byte buffer[1]; + uint32_t rankCount; + uint32_t byteCount; + uint8_t buffer[1]; }; diff --git a/Sources/Plasma/NucleusLib/pnNetProtocol/Private/Protocols/Srv2State/pnNpSrv2State.cpp b/Sources/Plasma/NucleusLib/pnNetProtocol/Private/Protocols/Srv2State/pnNpSrv2State.cpp index 4a9808d9..7be85f8e 100644 --- a/Sources/Plasma/NucleusLib/pnNetProtocol/Private/Protocols/Srv2State/pnNpSrv2State.cpp +++ b/Sources/Plasma/NucleusLib/pnNetProtocol/Private/Protocols/Srv2State/pnNpSrv2State.cpp @@ -68,7 +68,7 @@ bool Srv2StateValidateConnect ( const Srv2State_ConnData & connect = * (const Srv2State_ConnData *) listen->buffer; // Validate message size - const unsigned kMinStructSize = sizeof(dword) * 3; + const unsigned kMinStructSize = sizeof(uint32_t) * 3; if (listen->bytes < kMinStructSize) return false; if (listen->bytes < connect.dataBytes) @@ -78,8 +78,8 @@ bool Srv2StateValidateConnect ( if (!(connect.srvType == kSrvTypeAuth || connect.srvType == kSrvTypeGame)) return false; - ZEROPTR(connectPtr); - MemCopy(connectPtr, &connect, min(sizeof(*connectPtr), connect.dataBytes)); + memset(connectPtr, 0, sizeof(*connectPtr)); + memcpy(connectPtr, &connect, min(sizeof(*connectPtr), connect.dataBytes)); listen->bytesProcessed += connect.dataBytes; return true; diff --git a/Sources/Plasma/NucleusLib/pnNetProtocol/Private/Protocols/Srv2State/pnNpSrv2State.h b/Sources/Plasma/NucleusLib/pnNetProtocol/Private/Protocols/Srv2State/pnNpSrv2State.h index b2995134..dfb4ab06 100644 --- a/Sources/Plasma/NucleusLib/pnNetProtocol/Private/Protocols/Srv2State/pnNpSrv2State.h +++ b/Sources/Plasma/NucleusLib/pnNetProtocol/Private/Protocols/Srv2State/pnNpSrv2State.h @@ -78,9 +78,9 @@ enum { ***/ struct Srv2State_ConnData { - dword dataBytes; - dword buildId; - dword srvType; + uint32_t dataBytes; + uint32_t buildId; + uint32_t srvType; }; struct Srv2State_Connect { AsyncSocketConnectPacket hdr; @@ -96,20 +96,20 @@ struct Srv2State_Connect { struct Srv2State_FetchObject : SrvMsgHeader { Uuid ownerId; - wchar objectName[kMaxStateObjectName]; + wchar_t objectName[kMaxStateObjectName]; }; struct Srv2State_SaveObject : SrvMsgHeader { Uuid ownerId; - wchar objectName[kMaxStateObjectName]; - dword objectDataBytes; - byte objectData[1]; // objectData[objectDataBytes], actually + wchar_t objectName[kMaxStateObjectName]; + uint32_t objectDataBytes; + uint8_t objectData[1]; // objectData[objectDataBytes], actually // no more fields after var length alloc }; struct Srv2State_DeleteObject : SrvMsgHeader { Uuid ownerId; - wchar objectName[kMaxStateObjectName]; + wchar_t objectName[kMaxStateObjectName]; }; @@ -120,8 +120,8 @@ struct Srv2State_DeleteObject : SrvMsgHeader { ***/ struct State2Srv_ObjectFetched : SrvMsgHeader { - dword objectDataBytes; - byte objectData[1]; + uint32_t objectDataBytes; + uint8_t objectData[1]; // no more fields after var length alloc }; diff --git a/Sources/Plasma/NucleusLib/pnNetProtocol/Private/Protocols/Srv2Vault/pnNpSrv2Vault.cpp b/Sources/Plasma/NucleusLib/pnNetProtocol/Private/Protocols/Srv2Vault/pnNpSrv2Vault.cpp index 2cb2e5ee..068a19e5 100644 --- a/Sources/Plasma/NucleusLib/pnNetProtocol/Private/Protocols/Srv2Vault/pnNpSrv2Vault.cpp +++ b/Sources/Plasma/NucleusLib/pnNetProtocol/Private/Protocols/Srv2Vault/pnNpSrv2Vault.cpp @@ -67,7 +67,7 @@ bool Srv2VaultValidateConnect ( const Srv2Vault_ConnData & connect = * (const Srv2Vault_ConnData *) listen->buffer; // Validate message size - const unsigned kMinStructSize = sizeof(dword) * 3; + const unsigned kMinStructSize = sizeof(uint32_t) * 3; if (listen->bytes < kMinStructSize) return false; if (listen->bytes < connect.dataBytes) @@ -77,8 +77,8 @@ bool Srv2VaultValidateConnect ( if (!(connect.srvType == kSrvTypeAuth || connect.srvType == kSrvTypeGame || connect.srvType == kSrvTypeMcp)) return false; - ZEROPTR(connectPtr); - MemCopy(connectPtr, &connect, min(sizeof(*connectPtr), connect.dataBytes)); + memset(connectPtr, 0, sizeof(*connectPtr)); + memcpy(connectPtr, &connect, min(sizeof(*connectPtr), connect.dataBytes)); listen->bytesProcessed += connect.dataBytes; return true; diff --git a/Sources/Plasma/NucleusLib/pnNetProtocol/Private/Protocols/Srv2Vault/pnNpSrv2Vault.h b/Sources/Plasma/NucleusLib/pnNetProtocol/Private/Protocols/Srv2Vault/pnNpSrv2Vault.h index a8744ccc..6c7f519d 100644 --- a/Sources/Plasma/NucleusLib/pnNetProtocol/Private/Protocols/Srv2Vault/pnNpSrv2Vault.h +++ b/Sources/Plasma/NucleusLib/pnNetProtocol/Private/Protocols/Srv2Vault/pnNpSrv2Vault.h @@ -152,9 +152,9 @@ enum { ***/ struct Srv2Vault_ConnData { - dword dataBytes; - dword buildId; - dword srvType; + uint32_t dataBytes; + uint32_t buildId; + uint32_t srvType; }; struct Srv2Vault_Connect { AsyncSocketConnectPacket hdr; @@ -170,20 +170,20 @@ struct Srv2Vault_Connect { struct Srv2Vault_PlayerCreateRequest : SrvMsgHeader { Uuid accountUuid; - wchar playerName[kMaxPlayerNameLength]; - wchar avatarShape[MAX_PATH]; - wchar friendInvite[MAX_PATH]; - byte explorer; + wchar_t playerName[kMaxPlayerNameLength]; + wchar_t avatarShape[MAX_PATH]; + wchar_t friendInvite[MAX_PATH]; + uint8_t explorer; }; struct Srv2Vault_PlayerDeleteRequest : SrvMsgHeader { Uuid accountId; - dword playerId; + uint32_t playerId; }; struct Srv2Vault_UpgradeVisitorRequest : SrvMsgHeader { Uuid accountId; - dword playerId; + uint32_t playerId; }; struct Srv2Vault_AccountLoginRequest : SrvMsgHeader { @@ -195,43 +195,43 @@ struct Srv2Vault_AccountLogout : SrvMsgHeader { }; struct Srv2Vault_FetchChildNodeRefs : SrvMsgHeader { - dword parentId; - dword maxDepth; + uint32_t parentId; + uint32_t maxDepth; }; struct Srv2Vault_NodeFetch : SrvMsgHeader { - dword nodeId; + uint32_t nodeId; }; struct Srv2Vault_CreateNodeRequest : SrvMsgHeader { Uuid accountId; - dword creatorId; - dword nodeBytes; - byte nodeBuffer[1]; + uint32_t creatorId; + uint32_t nodeBytes; + uint8_t nodeBuffer[1]; }; struct Srv2Vault_DeleteNodeRequest : SrvMsgHeader { - dword nodeId; + uint32_t nodeId; unsigned playerCheckId; unsigned isRequestFromAuth; }; struct Srv2Vault_NodeSave : SrvMsgHeader { - dword nodeId; + uint32_t nodeId; unsigned playerCheckId; unsigned isRequestFromAuth; Uuid revisionId; - dword nodeBytes; - byte nodeBuffer[1]; + uint32_t nodeBytes; + uint8_t nodeBuffer[1]; }; struct Srv2Vault_NodeSave2 : SrvMsgHeader { - dword nodeId; + uint32_t nodeId; unsigned playerCheckId; unsigned isRequestFromAuth; Uuid revisionId; - dword nodeBytes; - byte nodeBuffer[1]; + uint32_t nodeBytes; + uint8_t nodeBuffer[1]; }; struct Srv2Vault_NodeAdd : SrvMsgHeader { @@ -243,35 +243,35 @@ struct Srv2Vault_NodeAdd2 : SrvMsgHeader { }; struct Srv2Vault_NodeRemove : SrvMsgHeader { - dword parentId; - dword childId; + uint32_t parentId; + uint32_t childId; unsigned playerCheckId; unsigned isRequestFromAuth; }; struct Srv2Vault_NodeRemove2 : SrvMsgHeader { - dword parentId; - dword childId; + uint32_t parentId; + uint32_t childId; unsigned playerCheckId; unsigned isRequestFromAuth; }; struct Srv2Vault_NodeFindRequest : SrvMsgHeader { // Template node to match - dword nodeBytes; - byte nodeBuffer[1]; // [nodeBytes], actually + uint32_t nodeBytes; + uint8_t nodeBuffer[1]; // [nodeBytes], actually // no more fields after var length alloc }; struct Srv2Vault_SendNode : SrvMsgHeader { - dword srcPlayerId; // sender - dword srcNodeId; // sent item - dword dstPlayerId; // recipient + uint32_t srcPlayerId; // sender + uint32_t srcNodeId; // sent item + uint32_t dstPlayerId; // recipient }; struct Srv2Vault_RegisterPlayerVault : SrvMsgHeader { Uuid accountId; - dword playerId; + uint32_t playerId; }; struct Srv2Vault_UnregisterPlayerVault : SrvMsgHeader { @@ -280,7 +280,7 @@ struct Srv2Vault_UnregisterPlayerVault : SrvMsgHeader { struct Srv2Vault_RegisterAgeVault : SrvMsgHeader { Uuid accountId; - dword ageId; // age's vault node id + uint32_t ageId; // age's vault node id }; struct Srv2Vault_UnregisterAgeVault : SrvMsgHeader { @@ -289,82 +289,82 @@ struct Srv2Vault_UnregisterAgeVault : SrvMsgHeader { struct Srv2Vault_AgeInitRequest : SrvMsgHeader { Uuid accountId; - dword playerId; + uint32_t playerId; Uuid ageInstId; Uuid parentAgeInstId; - dword ageLanguage; - dword ageSequenceNumber; + uint32_t ageLanguage; + uint32_t ageSequenceNumber; // packed fields: - // wchar ageFilename[] - // wchar ageInstName[] - // wchar ageUserName[] - // wchar ageDesc[] + // wchar_t ageFilename[] + // wchar_t ageInstName[] + // wchar_t ageUserName[] + // wchar_t ageDesc[] }; struct Srv2Vault_GetPublicAgeList : SrvMsgHeader { - wchar ageName[kMaxAgeNameLength]; + wchar_t ageName[kMaxAgeNameLength]; }; struct Srv2Vault_SetAgePublic : SrvMsgHeader { - dword playerId; - dword ageInfoId; - byte publicOrNot; + uint32_t playerId; + uint32_t ageInfoId; + uint8_t publicOrNot; }; struct Srv2Vault_CurrentPopulationReply : SrvMsgHeader { - dword ageCount; + uint32_t ageCount; unsigned agePopulations[1]; // [ageCount], actually // no more fields after var length alloc }; struct Srv2Vault_ChangePlayerNameRequest : SrvMsgHeader { Uuid accountId; - dword playerId; - wchar newName[kMaxPlayerNameLength]; + uint32_t playerId; + wchar_t newName[kMaxPlayerNameLength]; }; struct Srv2Vault_AccountOnline : SrvMsgHeader { Uuid acctId; - dword buildId; - dword authNode; + uint32_t buildId; + uint32_t authNode; }; struct Srv2Vault_AccountOffline : SrvMsgHeader { Uuid acctId; - dword buildId; + uint32_t buildId; }; struct Srv2Vault_PlayerOnline : SrvMsgHeader { Uuid acctId; - dword buildId; - dword playerId; + uint32_t buildId; + uint32_t playerId; }; struct Srv2Vault_PlayerOffline : SrvMsgHeader { - dword playerId; - dword buildId; + uint32_t playerId; + uint32_t buildId; }; struct Srv2Vault_AgeOnline : SrvMsgHeader { Uuid ageInstId; - dword buildId; - dword gameNode; + uint32_t buildId; + uint32_t gameNode; }; struct Srv2Vault_AgeOffline : SrvMsgHeader { Uuid ageInstId; - dword buildId; + uint32_t buildId; }; struct Srv2Vault_PlayerJoinedAge : SrvMsgHeader { - dword playerId; + uint32_t playerId; Uuid ageInstId; - dword buildId; + uint32_t buildId; }; struct Srv2Vault_PlayerLeftAge : SrvMsgHeader { - dword playerId; - dword buildId; + uint32_t playerId; + uint32_t buildId; }; @@ -376,30 +376,30 @@ struct Srv2Vault_PlayerLeftAge : SrvMsgHeader { ***/ struct Vault2Srv_PlayerCreateReply : SrvMsgHeader { - dword playerId; + uint32_t playerId; }; struct Vault2Srv_AccountLoginReply : SrvMsgHeader { - dword playerInfoCount; + uint32_t playerInfoCount; SrvPlayerInfo playerInfos[1]; }; struct Vault2Srv_NodeRefsFetched : SrvMsgHeader { - dword refCount; + uint32_t refCount; NetVaultNodeRef refs[1]; }; struct Vault2Srv_NodeFetched : SrvMsgHeader { - dword nodeBytes; - byte nodeBuffer[1]; + uint32_t nodeBytes; + uint8_t nodeBuffer[1]; }; struct Vault2Srv_NodeCreated : SrvMsgHeader { - dword nodeId; + uint32_t nodeId; }; struct Vault2Srv_NodeChanged : SrvMsgHeader { - dword nodeId; + uint32_t nodeId; Uuid revisionId; Uuid accountId; // the notify target }; @@ -410,42 +410,42 @@ struct Vault2Srv_NodeAdded : SrvMsgHeader { }; struct Vault2Srv_NodeRemoved : SrvMsgHeader { - dword parentId; - dword childId; + uint32_t parentId; + uint32_t childId; Uuid accountId; // the notify target }; struct Vault2Srv_NodeDeleted : SrvMsgHeader { - dword nodeId; + uint32_t nodeId; Uuid accountId; // the notify target }; struct Vault2Srv_NodeFindReply : SrvMsgHeader { // out: ids of matching nodes - dword nodeIdCount; - dword nodeIds[1]; // [nodeIdCount], actually + uint32_t nodeIdCount; + uint32_t nodeIds[1]; // [nodeIdCount], actually // no more fields after var length alloc }; struct Vault2Srv_AgeInitReply : SrvMsgHeader { - dword ageNodeId; - dword ageInfoNodeId; + uint32_t ageNodeId; + uint32_t ageInfoNodeId; Uuid accountId; // the requestor }; struct Vault2Srv_PublicAgeList : SrvMsgHeader { - dword ageCount; + uint32_t ageCount; NetAgeInfo ages[1]; // [ageCount], actually // no more fields after var length alloc }; struct Vault2Srv_NotifyAgeSDLChanged : SrvMsgHeader { - wchar ageName[kMaxAgeNameLength]; + wchar_t ageName[kMaxAgeNameLength]; Uuid ageInstId; }; struct Vault2Srv_CurrentPopulationRequest : SrvMsgHeader { - dword ageCount; + uint32_t ageCount; Uuid ageInstIds[1]; // [ageCount], actually // no more fields after var length alloc }; diff --git a/Sources/Plasma/NucleusLib/pnNetProtocol/Private/pnNpCommon.cpp b/Sources/Plasma/NucleusLib/pnNetProtocol/Private/pnNpCommon.cpp index 113198df..96d7c649 100644 --- a/Sources/Plasma/NucleusLib/pnNetProtocol/Private/pnNpCommon.cpp +++ b/Sources/Plasma/NucleusLib/pnNetProtocol/Private/pnNpCommon.cpp @@ -52,7 +52,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com namespace pnNpCommon { -// Verify our qword constants were properly inited as such. +// Verify our uint64_t constants were properly inited as such. COMPILER_ASSERT(NetVaultNode::kBlob_2); @@ -74,7 +74,7 @@ const unsigned kNumBlobFields = 4; //============================================================================ template -static inline void IReadValue (T * value, byte ** buffer, unsigned * bufsz) { +static inline void IReadValue (T * value, uint8_t ** buffer, unsigned * bufsz) { ASSERT(*bufsz >= sizeof(T)); *value = *(T *)*buffer; *buffer += sizeof(T); @@ -83,22 +83,22 @@ static inline void IReadValue (T * value, byte ** buffer, unsigned * bufsz) { //============================================================================ template -static inline void IReadArray (T ** buf, unsigned * elems, byte ** buffer, unsigned * bufsz) { - dword bytes; +static inline void IReadArray (T ** buf, unsigned * elems, uint8_t ** buffer, unsigned * bufsz) { + uint32_t bytes; IReadValue(&bytes, buffer, bufsz); ASSERT(bytes % sizeof(T) == 0); *elems = bytes / sizeof(T); T * src = (T *)*buffer; - DEL(*buf); - *buf = (T *)ALLOC(bytes); - MemCopy(*buf, src, bytes); + delete *buf; + *buf = (T *)malloc(bytes); + memcpy(*buf, src, bytes); *buffer += bytes; *bufsz -= bytes; } //============================================================================ template -static inline void IReadString (T ** buf, byte ** buffer, unsigned * bufsz) { +static inline void IReadString (T ** buf, uint8_t ** buffer, unsigned * bufsz) { unsigned elems; IReadArray(buf, &elems, buffer, bufsz); // ensure the string is null-terminated @@ -108,23 +108,23 @@ static inline void IReadString (T ** buf, byte ** buffer, unsigned * bufsz) { //============================================================================ template -static inline void IWriteValue (const T & value, ARRAY(byte) * buffer) { +static inline void IWriteValue (const T & value, ARRAY(uint8_t) * buffer) { T * ptr = (T *) buffer->New(sizeof(T)); *ptr = value; } //============================================================================ template -static inline void IWriteArray (const T buf[], unsigned elems, ARRAY(byte) * buffer) { +static inline void IWriteArray (const T buf[], unsigned elems, ARRAY(uint8_t) * buffer) { unsigned bytes = elems * sizeof(T); IWriteValue(bytes, buffer); T * dst = (T *) buffer->New(bytes); - MemCopy(dst, buf, bytes); + memcpy(dst, buf, bytes); } //============================================================================ template -static inline void IWriteString (const T str[], ARRAY(byte) * buffer) { +static inline void IWriteString (const T str[], ARRAY(uint8_t) * buffer) { IWriteArray(str, StrLen(str) + 1, buffer); } @@ -155,7 +155,7 @@ static inline bool ICompareStringI (const T lhs[], const T rhs[]) { } //============================================================================ -static inline bool ICompareArray (const byte lhs[], const byte rhs[]) { +static inline bool ICompareArray (const uint8_t lhs[], const uint8_t rhs[]) { return false; } @@ -168,7 +168,7 @@ static inline void ICopyValue (T * plhs, const T & rhs) { //============================================================================ template static inline void ICopyString (T ** plhs, const T rhs[]) { - FREE(*plhs); + free(*plhs); if (rhs) *plhs = StrDup(rhs); else @@ -176,8 +176,8 @@ static inline void ICopyString (T ** plhs, const T rhs[]) { } //============================================================================ -static inline void ICopyString (wchar ** plhs, const wchar rhs[]) { - FREE(*plhs); +static inline void ICopyString (wchar_t ** plhs, const wchar_t rhs[]) { + free(*plhs); if (rhs) *plhs = StrDup(rhs); else @@ -235,12 +235,12 @@ static bool IStrSqlEscape (const T src[], T * dst, unsigned dstChars) { ***/ //============================================================================ -unsigned NetGameScore::Read(const byte inbuffer[], unsigned bufsz, byte** end) { +unsigned NetGameScore::Read(const uint8_t inbuffer[], unsigned bufsz, uint8_t** end) { - byte * buffer = const_cast(inbuffer); - byte * start = buffer; + uint8_t * buffer = const_cast(inbuffer); + uint8_t * start = buffer; - wchar* tempstr = nil; + wchar_t* tempstr = nil; IReadValue(&scoreId, &buffer, &bufsz); IReadValue(&ownerId, &buffer, &bufsz); @@ -250,7 +250,7 @@ unsigned NetGameScore::Read(const byte inbuffer[], unsigned bufsz, byte** end) { IReadString(&tempstr, &buffer, &bufsz); StrCopy(gameName, tempstr, arrsize(gameName)); - DEL(tempstr); + delete tempstr; if (end) *end = buffer; @@ -259,7 +259,7 @@ unsigned NetGameScore::Read(const byte inbuffer[], unsigned bufsz, byte** end) { } //============================================================================ -unsigned NetGameScore::Write(ARRAY(byte) * buffer) const { +unsigned NetGameScore::Write(ARRAY(uint8_t) * buffer) const { unsigned pos = buffer->Count(); @@ -290,19 +290,19 @@ void NetGameScore::CopyFrom(const NetGameScore & score) { ***/ //============================================================================ -unsigned NetGameRank::Read(const byte inbuffer[], unsigned bufsz, byte** end) { +unsigned NetGameRank::Read(const uint8_t inbuffer[], unsigned bufsz, uint8_t** end) { - byte * buffer = const_cast(inbuffer); - byte * start = buffer; + uint8_t * buffer = const_cast(inbuffer); + uint8_t * start = buffer; - wchar* tempstr = nil; + wchar_t* tempstr = nil; IReadValue(&rank, &buffer, &bufsz); IReadValue(&score, &buffer, &bufsz); IReadString(&tempstr, &buffer, &bufsz); StrCopy(name, tempstr, arrsize(name)); - DEL(tempstr); + delete tempstr; if (end) *end = buffer; @@ -311,7 +311,7 @@ unsigned NetGameRank::Read(const byte inbuffer[], unsigned bufsz, byte** end) { } //============================================================================ -unsigned NetGameRank::Write(ARRAY(byte) * buffer) const { +unsigned NetGameRank::Write(ARRAY(uint8_t) * buffer) const { unsigned pos = buffer->Count(); @@ -337,11 +337,11 @@ void NetGameRank::CopyFrom(const NetGameRank & fromRank) { //============================================================================ static void DeallocNodeFields (NetVaultNode * node) { - for (qword fieldFlag = 1; fieldFlag; fieldFlag <<= 1) { + for (uint64_t fieldFlag = 1; fieldFlag; fieldFlag <<= 1) { if (fieldFlag > node->fieldFlags) break; - #define DELFIELD(f, v) case (qword)(NetVaultNode::f): DEL(node->v); node->v = nil; break + #define DELFIELD(f, v) case (uint64_t)(NetVaultNode::f): delete node->v; node->v = nil; break switch (fieldFlag & node->fieldFlags) { DELFIELD(kCreateAgeName, createAgeName); DELFIELD(kString64_1, string64_1); @@ -372,16 +372,16 @@ NetVaultNode::~NetVaultNode () { } //============================================================================ -unsigned NetVaultNode::Read_LCS (const byte inbuffer[], unsigned bufsz, unsigned rwOpts) { +unsigned NetVaultNode::Read_LCS (const uint8_t inbuffer[], unsigned bufsz, unsigned rwOpts) { DeallocNodeFields(this); - byte * buffer = const_cast(inbuffer); - byte * start = buffer; + uint8_t * buffer = const_cast(inbuffer); + uint8_t * start = buffer; IReadValue(&fieldFlags, &buffer, &bufsz); - for (qword bit = 1; bit; bit <<= 1) { + for (uint64_t bit = 1; bit; bit <<= 1) { // if we've passed all fields on the node then bail if (bit > fieldFlags) @@ -441,11 +441,11 @@ unsigned NetVaultNode::Read_LCS (const byte inbuffer[], unsigned bufsz, unsigned } //============================================================================ -unsigned NetVaultNode::Write_LCS (ARRAY(byte) * buffer, unsigned rwOpts) { +unsigned NetVaultNode::Write_LCS (ARRAY(uint8_t) * buffer, unsigned rwOpts) { unsigned pos = buffer->Count(); - qword flags = fieldFlags; + uint64_t flags = fieldFlags; if (rwOpts & kRwDirtyOnly) flags &= dirtyFlags; @@ -455,7 +455,7 @@ unsigned NetVaultNode::Write_LCS (ARRAY(byte) * buffer, unsigned rwOpts) { IWriteValue(flags, buffer); - for (qword bit = 1; bit; bit <<= 1) { + for (uint64_t bit = 1; bit; bit <<= 1) { // if we've passed all fields on the node then bail if (bit > flags) @@ -515,7 +515,7 @@ unsigned NetVaultNode::Write_LCS (ARRAY(byte) * buffer, unsigned rwOpts) { //============================================================================ bool NetVaultNode::Matches (const NetVaultNode * other) { - for (qword bit = 1; bit; bit <<= 1) { + for (uint64_t bit = 1; bit; bit <<= 1) { // if bit has gone past all set fields on the other node without failing, return true if (bit > other->fieldFlags) return true; @@ -574,9 +574,9 @@ void NetVaultNode::CopyFrom (const NetVaultNode * other, unsigned copyOpts) { if (this == other) return; - qword origDirtyFlags = dirtyFlags; + uint64_t origDirtyFlags = dirtyFlags; - for (qword bit = 1; bit; bit <<= 1) { + for (uint64_t bit = 1; bit; bit <<= 1) { // we already have a value for this field... if (bit & fieldFlags) { if (!(copyOpts & kCopyOverwrite)) @@ -701,7 +701,7 @@ void NetVaultNode::SetModifyTime (unsigned v) { } //============================================================================ -void NetVaultNode::SetCreateAgeName (const wchar v[]) { +void NetVaultNode::SetCreateAgeName (const wchar_t v[]) { IVaultNodeSetString(kCreateAgeName, this, &createAgeName, v, kMaxVaultNodeStringLength); } @@ -786,67 +786,67 @@ void NetVaultNode::SetUuid_4 (const Uuid & v) { } //============================================================================ -void NetVaultNode::SetString64_1 (const wchar v[]) { +void NetVaultNode::SetString64_1 (const wchar_t v[]) { IVaultNodeSetString(kString64_1, this, &string64_1, v, kMaxVaultNodeStringLength); } //============================================================================ -void NetVaultNode::SetString64_2 (const wchar v[]) { +void NetVaultNode::SetString64_2 (const wchar_t v[]) { IVaultNodeSetString(kString64_2, this, &string64_2, v, kMaxVaultNodeStringLength); } //============================================================================ -void NetVaultNode::SetString64_3 (const wchar v[]) { +void NetVaultNode::SetString64_3 (const wchar_t v[]) { IVaultNodeSetString(kString64_3, this, &string64_3, v, kMaxVaultNodeStringLength); } //============================================================================ -void NetVaultNode::SetString64_4 (const wchar v[]) { +void NetVaultNode::SetString64_4 (const wchar_t v[]) { IVaultNodeSetString(kString64_4, this, &string64_4, v, kMaxVaultNodeStringLength); } //============================================================================ -void NetVaultNode::SetString64_5 (const wchar v[]) { +void NetVaultNode::SetString64_5 (const wchar_t v[]) { IVaultNodeSetString(kString64_5, this, &string64_5, v, kMaxVaultNodeStringLength); } //============================================================================ -void NetVaultNode::SetString64_6 (const wchar v[]) { +void NetVaultNode::SetString64_6 (const wchar_t v[]) { IVaultNodeSetString(kString64_6, this, &string64_6, v, kMaxVaultNodeStringLength); } //============================================================================ -void NetVaultNode::SetIString64_1 (const wchar v[]) { +void NetVaultNode::SetIString64_1 (const wchar_t v[]) { IVaultNodeSetString(kIString64_1, this, &istring64_1, v, kMaxVaultNodeStringLength); } //============================================================================ -void NetVaultNode::SetIString64_2 (const wchar v[]) { +void NetVaultNode::SetIString64_2 (const wchar_t v[]) { IVaultNodeSetString(kIString64_2, this, &istring64_2, v, kMaxVaultNodeStringLength); } //============================================================================ -void NetVaultNode::SetText_1 (const wchar v[]) { +void NetVaultNode::SetText_1 (const wchar_t v[]) { IVaultNodeSetString(kText_1, this, &text_1, v, (unsigned)-1); } //============================================================================ -void NetVaultNode::SetText_2 (const wchar v[]) { +void NetVaultNode::SetText_2 (const wchar_t v[]) { IVaultNodeSetString(kText_2, this, &text_2, v, (unsigned)-1); } //============================================================================ -void NetVaultNode::SetBlob_1 (const byte v[], unsigned len) { +void NetVaultNode::SetBlob_1 (const uint8_t v[], unsigned len) { IVaultNodeSetBlob(kBlob_1, this, &blob_1, &blob_1Length, v, len); } //============================================================================ -void NetVaultNode::SetBlob_2 (const byte v[], unsigned len) { +void NetVaultNode::SetBlob_2 (const uint8_t v[], unsigned len) { IVaultNodeSetBlob(kBlob_2, this, &blob_2, &blob_2Length, v, len); } //============================================================================ -void NetVaultNode::SetText (qword fieldFlag, const wchar v[]) { +void NetVaultNode::SetText (uint64_t fieldFlag, const wchar_t v[]) { switch (fieldFlag) { case kText_1: SetText_1(v); break; case kText_2: SetText_2(v); break; @@ -855,7 +855,7 @@ void NetVaultNode::SetText (qword fieldFlag, const wchar v[]) { } //============================================================================ -void NetVaultNode::SetBlob (qword fieldFlag, const byte v[], unsigned len) { +void NetVaultNode::SetBlob (uint64_t fieldFlag, const uint8_t v[], unsigned len) { switch (fieldFlag) { case kBlob_1: SetBlob_1(v, len); break; case kBlob_2: SetBlob_2(v, len); break; @@ -916,11 +916,11 @@ NetVaultNodeFieldArray::~NetVaultNodeFieldArray () { } //============================================================================ -void * NetVaultNodeFieldArray::GetFieldAddress (qword bit) { +void * NetVaultNodeFieldArray::GetFieldAddress (uint64_t bit) { ASSERT(bit); unsigned index = 0; - for (qword b = bit; b > 1; b >>= 1) + for (uint64_t b = bit; b > 1; b >>= 1) ++index; // do not return blob fields @@ -931,11 +931,11 @@ void * NetVaultNodeFieldArray::GetFieldAddress (qword bit) { } //============================================================================ -const wchar * NetVaultNodeFieldArray::GetFieldName (qword bit) { +const wchar_t * NetVaultNodeFieldArray::GetFieldName (uint64_t bit) { ASSERT(bit); unsigned index = 0; - for (qword b = bit; b > 1; b >>= 1) + for (uint64_t b = bit; b > 1; b >>= 1) ++index; ASSERT(index < fields.Count()); @@ -944,8 +944,8 @@ const wchar * NetVaultNodeFieldArray::GetFieldName (qword bit) { //============================================================================ void NetVaultNodeFieldArray::GetFieldValueString_LCS ( - qword bit, - wchar * dst, + uint64_t bit, + wchar_t * dst, unsigned dstChars ) { void * fieldAddr = GetFieldAddress(bit); @@ -976,7 +976,7 @@ void NetVaultNodeFieldArray::GetFieldValueString_LCS ( case NetVaultNode::kUuid_2: case NetVaultNode::kUuid_3: case NetVaultNode::kUuid_4: { - wchar tmp[64]; + wchar_t tmp[64]; GuidToHex(*(Uuid *)fieldAddr, tmp, arrsize(tmp)); StrPrintf(dst, dstChars, L"hextoraw('%s')", tmp); } @@ -991,9 +991,10 @@ void NetVaultNodeFieldArray::GetFieldValueString_LCS ( case NetVaultNode::kString64_6: case NetVaultNode::kIString64_1: case NetVaultNode::kIString64_2: { - wchar * tmp = ALLOCA(wchar, dstChars); - IStrSqlEscape(*(wchar **)fieldAddr, tmp, dstChars); + wchar_t * tmp = (wchar_t*)malloc(sizeof(wchar_t) * dstChars); + IStrSqlEscape(*(wchar_t **)fieldAddr, tmp, dstChars); StrPrintf(dst, dstChars, L"'%s'", tmp); + free(tmp); } break; @@ -1008,7 +1009,7 @@ void NetVaultNodeFieldArray::GetFieldValueString_LCS ( //============================================================================ void NetVaultNodeFieldArray::BuildWhereClause_LCS ( EWhereCondition condition, - wchar * dst, + wchar_t * dst, unsigned dstChars ) { if (!dstChars) @@ -1016,20 +1017,20 @@ void NetVaultNodeFieldArray::BuildWhereClause_LCS ( dst[0] = 0; - static const wchar * s_conditionStrs[] = { + static const wchar_t * s_conditionStrs[] = { L" AND ", L" OR " }; unsigned fieldCount = 0; - for (qword bit = 1; bit; bit <<= 1) { + for (uint64_t bit = 1; bit; bit <<= 1) { if (!(bit & node->fieldFlags)) continue; if (fieldCount++) StrPack(dst, s_conditionStrs[condition], dstChars); - wchar str[256]; + wchar_t str[256]; GetFieldValueString_LCS(bit, str, arrsize(str)); StrPack(dst, GetFieldName(bit), dstChars); @@ -1039,7 +1040,7 @@ void NetVaultNodeFieldArray::BuildWhereClause_LCS ( } //============================================================================ -NetVaultNodeFieldArray::ESqlType NetVaultNodeFieldArray::GetSqlType_LCS (qword bit) { +NetVaultNodeFieldArray::ESqlType NetVaultNodeFieldArray::GetSqlType_LCS (uint64_t bit) { switch (bit) { case NetVaultNode::kNodeId: case NetVaultNode::kCreatorId: @@ -1099,7 +1100,7 @@ NetVaultNodeFieldArray::ESqlType NetVaultNodeFieldArray::GetSqlType_LCS (qword b //============================================================================ CSrvPackBuffer::CSrvPackBuffer (unsigned bytes) { - m_data = (byte *)ALLOC(bytes); + m_data = (uint8_t *)malloc(bytes); m_pos = m_data; m_end = m_pos + bytes; } @@ -1109,23 +1110,23 @@ void * CSrvPackBuffer::Alloc (unsigned bytes) { ASSERT((signed) bytes >= 0); ASSERT(m_pos + bytes <= m_end); - byte * pos = m_pos; + uint8_t * pos = m_pos; m_pos += bytes; return pos; } //============================================================================ void CSrvPackBuffer::AddData (const void * ptr, unsigned bytes) { - MemCopy(Alloc(bytes), ptr, bytes); + memcpy(Alloc(bytes), ptr, bytes); } //============================================================================ -void CSrvPackBuffer::AddString (const wchar str[]) { +void CSrvPackBuffer::AddString (const wchar_t str[]) { AddData(str, StrBytes(str)); } //============================================================================ -void CSrvPackBuffer::AddDWordArray (const UInt32 * arr, unsigned count) { +void CSrvPackBuffer::AddDWordArray (const uint32_t * arr, unsigned count) { // Don't let large counts cause pointer wrap count &= 0x00ffffff; AddData(arr, count * sizeof(arr[0])); @@ -1145,14 +1146,14 @@ unsigned CSrvPackBuffer::Size () { //============================================================================ CSrvUnpackBuffer::CSrvUnpackBuffer (const void * buffer, unsigned count) { - m_pos = (const byte *) buffer; + m_pos = (const uint8_t *) buffer; m_end = m_pos + count; } //============================================================================ const void * CSrvUnpackBuffer::GetData (unsigned bytes) { for (;;) { - const byte * result = m_pos; + const uint8_t * result = m_pos; m_pos += bytes; if (m_pos < result) @@ -1168,16 +1169,16 @@ const void * CSrvUnpackBuffer::GetData (unsigned bytes) { } //============================================================================ -const wchar * CSrvUnpackBuffer::GetString () { +const wchar_t * CSrvUnpackBuffer::GetString () { if (m_end) { - const wchar * end = (const wchar *) (m_end - sizeof(wchar) + 1); - for (const wchar * cur = (const wchar *) m_pos; cur < end; ) { + const wchar_t * end = (const wchar_t *) (m_end - sizeof(wchar_t) + 1); + for (const wchar_t * cur = (const wchar_t *) m_pos; cur < end; ) { if (*cur++) continue; - const wchar * pos = (const wchar *) m_pos; - m_pos = (const byte *) cur; + const wchar_t * pos = (const wchar_t *) m_pos; + m_pos = (const uint8_t *) cur; return pos; } } @@ -1187,10 +1188,10 @@ const wchar * CSrvUnpackBuffer::GetString () { } //============================================================================ -const dword * CSrvUnpackBuffer::GetDWordArray (unsigned count) { +const uint32_t * CSrvUnpackBuffer::GetDWordArray (unsigned count) { // Don't let large counts cause pointer wrap if (count & 0x00ffffff) - return (const dword *)GetData(count * sizeof(dword)); + return (const uint32_t *)GetData(count * sizeof(uint32_t)); m_end = nil; return nil; diff --git a/Sources/Plasma/NucleusLib/pnNetProtocol/Private/pnNpCommon.h b/Sources/Plasma/NucleusLib/pnNetProtocol/Private/pnNpCommon.h index a461cf44..7666945d 100644 --- a/Sources/Plasma/NucleusLib/pnNetProtocol/Private/pnNpCommon.h +++ b/Sources/Plasma/NucleusLib/pnNetProtocol/Private/pnNpCommon.h @@ -82,8 +82,8 @@ const NetMsgField kNetMsgFieldBuildId = NET_MSG_FIELD_DWORD(); #include struct SrvPlayerInfo { unsigned playerInt; - wchar playerName[kMaxPlayerNameLength]; - wchar avatarShape[kMaxVaultNodeStringLength]; + wchar_t playerName[kMaxPlayerNameLength]; + wchar_t avatarShape[kMaxVaultNodeStringLength]; unsigned explorer; }; #include @@ -97,14 +97,14 @@ struct SrvPlayerInfo { struct NetAgeInfo { Uuid ageInstId; - wchar ageFilename[kMaxAgeNameLength]; - wchar ageInstName[kMaxAgeNameLength]; - wchar ageUserName[kMaxAgeNameLength]; - wchar ageDesc[1024]; - dword ageSequenceNumber; - dword ageLanguage; - dword population; // only used with GetPublicAgeList query results - dword currentPopulation; // only used with GetPublicAgeList query results + wchar_t ageFilename[kMaxAgeNameLength]; + wchar_t ageInstName[kMaxAgeNameLength]; + wchar_t ageUserName[kMaxAgeNameLength]; + wchar_t ageDesc[1024]; + uint32_t ageSequenceNumber; + uint32_t ageLanguage; + uint32_t population; // only used with GetPublicAgeList query results + uint32_t currentPopulation; // only used with GetPublicAgeList query results }; /***************************************************************************** @@ -116,13 +116,13 @@ struct NetAgeInfo { struct NetGameScore { unsigned scoreId; unsigned ownerId; - UInt32 createdTime; - wchar gameName[kMaxGameScoreNameLength]; + uint32_t createdTime; + wchar_t gameName[kMaxGameScoreNameLength]; unsigned gameType; int value; - unsigned Read (const byte inbuffer[], unsigned bufsz, byte** end = nil); // returns number of bytes read - unsigned Write (ARRAY(byte) * buffer) const; // returns number of bytes written + unsigned Read (const uint8_t inbuffer[], unsigned bufsz, uint8_t** end = nil); // returns number of bytes read + unsigned Write (ARRAY(uint8_t) * buffer) const; // returns number of bytes written void CopyFrom (const NetGameScore & score); }; @@ -136,10 +136,10 @@ struct NetGameScore { struct NetGameRank { unsigned rank; int score; - wchar name[kMaxPlayerNameLength]; + wchar_t name[kMaxPlayerNameLength]; - unsigned Read (const byte inbuffer[], unsigned bufsz, byte** end = nil); // returns number of bytes read - unsigned Write (ARRAY(byte) * buffer) const; // returns number of bytes written + unsigned Read (const uint8_t inbuffer[], unsigned bufsz, uint8_t** end = nil); // returns number of bytes read + unsigned Write (ARRAY(uint8_t) * buffer) const; // returns number of bytes written void CopyFrom (const NetGameRank & fromRank); }; @@ -170,44 +170,44 @@ struct NetVaultNode : AtomicRef { // These flag values must not change unless all servers are // simultaneously replaced, so basically forget it. - static const qword kNodeId = (qword)1<< 0; - static const qword kCreateTime = (qword)1<< 1; - static const qword kModifyTime = (qword)1<< 2; - static const qword kCreateAgeName = (qword)1<< 3; - static const qword kCreateAgeUuid = (qword)1<< 4; - static const qword kCreatorAcct = (qword)1<< 5; - static const qword kCreatorId = (qword)1<< 6; - static const qword kNodeType = (qword)1<< 7; - static const qword kInt32_1 = (qword)1<< 8; - static const qword kInt32_2 = (qword)1<< 9; - static const qword kInt32_3 = (qword)1<<10; - static const qword kInt32_4 = (qword)1<<11; - static const qword kUInt32_1 = (qword)1<<12; - static const qword kUInt32_2 = (qword)1<<13; - static const qword kUInt32_3 = (qword)1<<14; - static const qword kUInt32_4 = (qword)1<<15; - static const qword kUuid_1 = (qword)1<<16; - static const qword kUuid_2 = (qword)1<<17; - static const qword kUuid_3 = (qword)1<<18; - static const qword kUuid_4 = (qword)1<<19; - static const qword kString64_1 = (qword)1<<20; - static const qword kString64_2 = (qword)1<<21; - static const qword kString64_3 = (qword)1<<22; - static const qword kString64_4 = (qword)1<<23; - static const qword kString64_5 = (qword)1<<24; - static const qword kString64_6 = (qword)1<<25; - static const qword kIString64_1 = (qword)1<<26; - static const qword kIString64_2 = (qword)1<<27; + static const uint64_t kNodeId = (uint64_t)1<< 0; + static const uint64_t kCreateTime = (uint64_t)1<< 1; + static const uint64_t kModifyTime = (uint64_t)1<< 2; + static const uint64_t kCreateAgeName = (uint64_t)1<< 3; + static const uint64_t kCreateAgeUuid = (uint64_t)1<< 4; + static const uint64_t kCreatorAcct = (uint64_t)1<< 5; + static const uint64_t kCreatorId = (uint64_t)1<< 6; + static const uint64_t kNodeType = (uint64_t)1<< 7; + static const uint64_t kInt32_1 = (uint64_t)1<< 8; + static const uint64_t kInt32_2 = (uint64_t)1<< 9; + static const uint64_t kInt32_3 = (uint64_t)1<<10; + static const uint64_t kInt32_4 = (uint64_t)1<<11; + static const uint64_t kUInt32_1 = (uint64_t)1<<12; + static const uint64_t kUInt32_2 = (uint64_t)1<<13; + static const uint64_t kUInt32_3 = (uint64_t)1<<14; + static const uint64_t kUInt32_4 = (uint64_t)1<<15; + static const uint64_t kUuid_1 = (uint64_t)1<<16; + static const uint64_t kUuid_2 = (uint64_t)1<<17; + static const uint64_t kUuid_3 = (uint64_t)1<<18; + static const uint64_t kUuid_4 = (uint64_t)1<<19; + static const uint64_t kString64_1 = (uint64_t)1<<20; + static const uint64_t kString64_2 = (uint64_t)1<<21; + static const uint64_t kString64_3 = (uint64_t)1<<22; + static const uint64_t kString64_4 = (uint64_t)1<<23; + static const uint64_t kString64_5 = (uint64_t)1<<24; + static const uint64_t kString64_6 = (uint64_t)1<<25; + static const uint64_t kIString64_1 = (uint64_t)1<<26; + static const uint64_t kIString64_2 = (uint64_t)1<<27; // blobs always come last - static const qword kText_1 = (qword)1<<28; - static const qword kText_2 = (qword)1<<29; - static const qword kBlob_1 = (qword)1<<30; - static const qword kBlob_2 = (qword)1<<31; + static const uint64_t kText_1 = (uint64_t)1<<28; + static const uint64_t kText_2 = (uint64_t)1<<29; + static const uint64_t kBlob_1 = (uint64_t)1<<30; + static const uint64_t kBlob_2 = (uint64_t)1<<31; CCritSect critsect; - qword fieldFlags; - qword dirtyFlags; + uint64_t fieldFlags; + uint64_t dirtyFlags; Uuid revisionId; @@ -216,7 +216,7 @@ struct NetVaultNode : AtomicRef { unsigned nodeId; unsigned createTime; unsigned modifyTime; - wchar * createAgeName; + wchar_t * createAgeName; Uuid createAgeUuid; Uuid creatorAcct; // accountId of node creator unsigned creatorId; // playerId of node creator @@ -233,25 +233,25 @@ struct NetVaultNode : AtomicRef { Uuid uuid_2; Uuid uuid_3; Uuid uuid_4; - wchar * string64_1; - wchar * string64_2; - wchar * string64_3; - wchar * string64_4; - wchar * string64_5; - wchar * string64_6; - wchar * istring64_1; - wchar * istring64_2; - wchar * text_1; - wchar * text_2; - byte * blob_1; unsigned blob_1Length; - byte * blob_2; unsigned blob_2Length; + wchar_t * string64_1; + wchar_t * string64_2; + wchar_t * string64_3; + wchar_t * string64_4; + wchar_t * string64_5; + wchar_t * string64_6; + wchar_t * istring64_1; + wchar_t * istring64_2; + wchar_t * text_1; + wchar_t * text_2; + uint8_t * blob_1; uint32_t blob_1Length; + uint8_t * blob_2; uint32_t blob_2Length; NetVaultNode (); ~NetVaultNode (); // Threaded apps: Must be called with node->critsect locked - unsigned Read_LCS (const byte buffer[], unsigned bufsz, unsigned rwOpts); // returns number of bytes read - unsigned Write_LCS (ARRAY(byte) * buffer, unsigned rwOpts); // returns number of bytes written + unsigned Read_LCS (const uint8_t buffer[], unsigned bufsz, unsigned rwOpts); // returns number of bytes read + unsigned Write_LCS (ARRAY(uint8_t) * buffer, unsigned rwOpts); // returns number of bytes written bool Matches (const NetVaultNode * other); void CopyFrom (const NetVaultNode * other, unsigned copyOpts); @@ -260,7 +260,7 @@ struct NetVaultNode : AtomicRef { void SetNodeId (unsigned v); void SetCreateTime (unsigned v); void SetModifyTime (unsigned v); - void SetCreateAgeName (const wchar v[]); + void SetCreateAgeName (const wchar_t v[]); void SetCreateAgeUuid (const Uuid & v); void SetCreatorAcct (const Uuid & v); void SetCreatorId (unsigned v); @@ -277,27 +277,27 @@ struct NetVaultNode : AtomicRef { void SetUuid_2 (const Uuid & v); void SetUuid_3 (const Uuid & v); void SetUuid_4 (const Uuid & v); - void SetString64_1 (const wchar v[]); - void SetString64_2 (const wchar v[]); - void SetString64_3 (const wchar v[]); - void SetString64_4 (const wchar v[]); - void SetString64_5 (const wchar v[]); - void SetString64_6 (const wchar v[]); - void SetIString64_1 (const wchar v[]); - void SetIString64_2 (const wchar v[]); - void SetText_1 (const wchar v[]); - void SetText_2 (const wchar v[]); - void SetBlob_1 (const byte v[], unsigned len); - void SetBlob_2 (const byte v[], unsigned len); + void SetString64_1 (const wchar_t v[]); + void SetString64_2 (const wchar_t v[]); + void SetString64_3 (const wchar_t v[]); + void SetString64_4 (const wchar_t v[]); + void SetString64_5 (const wchar_t v[]); + void SetString64_6 (const wchar_t v[]); + void SetIString64_1 (const wchar_t v[]); + void SetIString64_2 (const wchar_t v[]); + void SetText_1 (const wchar_t v[]); + void SetText_2 (const wchar_t v[]); + void SetBlob_1 (const uint8_t v[], unsigned len); + void SetBlob_2 (const uint8_t v[], unsigned len); - void SetText (qword fieldFlag, const wchar v[]); - void SetBlob (qword fieldFlag, const byte v[], unsigned len); + void SetText (uint64_t fieldFlag, const wchar_t v[]); + void SetBlob (uint64_t fieldFlag, const uint8_t v[], unsigned len); // These are only here to aid macro expansions (naming case matches field flags) inline unsigned GetNodeId () const { return nodeId; } inline unsigned GetCreateTime () const { return createTime; } inline unsigned GetModifyTime () const { return modifyTime; } - inline wchar * GetCreateAgeName () const { return createAgeName; } + inline wchar_t * GetCreateAgeName () const { return createAgeName; } inline Uuid GetCreateAgeUuid () const { return createAgeUuid; } inline Uuid GetCreatorAcct () const { return creatorAcct; } inline unsigned GetCreatorId () const { return creatorId; } @@ -314,27 +314,27 @@ struct NetVaultNode : AtomicRef { inline Uuid GetUuid_2 () const { return uuid_2; } inline Uuid GetUuid_3 () const { return uuid_3; } inline Uuid GetUuid_4 () const { return uuid_4; } - inline wchar * GetString64_1 () const { return string64_1; } - inline wchar * GetString64_2 () const { return string64_2; } - inline wchar * GetString64_3 () const { return string64_3; } - inline wchar * GetString64_4 () const { return string64_4; } - inline wchar * GetString64_5 () const { return string64_5; } - inline wchar * GetString64_6 () const { return string64_6; } - inline wchar * GetIString64_1 () const { return istring64_1; } - inline wchar * GetIString64_2 () const { return istring64_2; } + inline wchar_t * GetString64_1 () const { return string64_1; } + inline wchar_t * GetString64_2 () const { return string64_2; } + inline wchar_t * GetString64_3 () const { return string64_3; } + inline wchar_t * GetString64_4 () const { return string64_4; } + inline wchar_t * GetString64_5 () const { return string64_5; } + inline wchar_t * GetString64_6 () const { return string64_6; } + inline wchar_t * GetIString64_1 () const { return istring64_1; } + inline wchar_t * GetIString64_2 () const { return istring64_2; } // no blob "getters" }; //============================================================================ inline void IVaultNodeSetString ( - qword bit, + uint64_t bit, NetVaultNode * node, char ** pdst, const char src[], unsigned chars ) { - FREE(*pdst); + free(*pdst); if (src && src[0]) *pdst = StrDupLen(src, chars); else @@ -345,13 +345,13 @@ inline void IVaultNodeSetString ( //============================================================================ inline void IVaultNodeSetString ( - qword bit, + uint64_t bit, NetVaultNode * node, - wchar ** pdst, - const wchar src[], + wchar_t ** pdst, + const wchar_t src[], unsigned chars ) { - FREE(*pdst); + free(*pdst); if (src && src[0]) *pdst = StrDupLen(src, chars); else @@ -363,7 +363,7 @@ inline void IVaultNodeSetString ( //============================================================================ template inline void IVaultNodeSetValue ( - qword bit, + uint64_t bit, NetVaultNode * node, T * pdst, const T & src @@ -375,16 +375,17 @@ inline void IVaultNodeSetValue ( //============================================================================ inline void IVaultNodeSetBlob ( - qword bit, + uint64_t bit, NetVaultNode * node, - byte ** pdst, + uint8_t ** pdst, unsigned * pdstLen, - const byte src[], + const uint8_t src[], unsigned srcLen ) { - FREE(*pdst); + free(*pdst); if (src) { - *pdst = (byte*)MEMDUP(src, srcLen); + *pdst = (uint8_t*)malloc(srcLen); + memcpy(*pdst, src, srcLen); *pdstLen = srcLen; } else { @@ -416,8 +417,8 @@ struct NetVaultNodeFieldArray { struct Field { void * addr; - const wchar * name; - Field (void * addr, const wchar name[]) + const wchar_t * name; + Field (void * addr, const wchar_t name[]) : addr(addr), name(name) { } }; @@ -427,13 +428,13 @@ struct NetVaultNodeFieldArray { NetVaultNodeFieldArray (NetVaultNode * node); ~NetVaultNodeFieldArray (); - void * GetFieldAddress (qword bit); - const wchar * GetFieldName (qword bit); + void * GetFieldAddress (uint64_t bit); + const wchar_t * GetFieldName (uint64_t bit); // client must lock node's local critical section before calling these. - void GetFieldValueString_LCS (qword bit, wchar * dst, unsigned dstChars); - void BuildWhereClause_LCS (EWhereCondition condition, wchar * dst, unsigned dstChars); - ESqlType GetSqlType_LCS (qword bit); + void GetFieldValueString_LCS (uint64_t bit, wchar_t * dst, unsigned dstChars); + void BuildWhereClause_LCS (EWhereCondition condition, wchar_t * dst, unsigned dstChars); + ESqlType GetSqlType_LCS (uint64_t bit); }; @@ -453,15 +454,15 @@ struct NetVaultNodeRef { // SrvPackBuffer //============================================================================ -// Allocate a CSrvPackBuffer on the heap with one extra dword to allow for padding +// Allocate a CSrvPackBuffer on the heap with one extra uint32_t to allow for padding #define SRV_ALLOC_BUFFER(bytes) \ - new(ALLOC(sizeof(CSrvPackBuffer) + (bytes) + sizeof(dword))) \ - CSrvPackBuffer(bytes + sizeof(dword)) + new(malloc(sizeof(CSrvPackBuffer) + (bytes) + sizeof(uint32_t))) \ + CSrvPackBuffer(bytes + sizeof(uint32_t)) -// Allocate a CSrvPackBuffer on the stack with one extra dword to allow for padding +// Allocate a CSrvPackBuffer on the stack with one extra uint32_t to allow for padding #define SRV_ALLOCA_BUFFER(bytes) \ - new(_alloca(sizeof(CSrvPackBuffer) + (bytes) + sizeof(dword))) \ - CSrvPackBuffer(bytes + sizeof(dword)) + new(_alloca(sizeof(CSrvPackBuffer) + (bytes) + sizeof(uint32_t))) \ + CSrvPackBuffer(bytes + sizeof(uint32_t)) class CSrvPackBuffer { public: @@ -469,16 +470,16 @@ public: void * Alloc (unsigned bytes); void AddData (const void * ptr, unsigned bytes); - void AddString (const wchar str[]); - void AddDWordArray (const UInt32 * arr, unsigned count); + void AddString (const wchar_t str[]); + void AddDWordArray (const uint32_t * arr, unsigned count); // add new "Add..." methods here as needed unsigned Size (); private: - byte * m_pos; - byte * m_end; - byte * m_data; + uint8_t * m_pos; + uint8_t * m_end; + uint8_t * m_data; }; class CSrvUnpackBuffer { @@ -486,13 +487,13 @@ public: CSrvUnpackBuffer (const void * buffer, unsigned count); const void * GetData (unsigned bytes); - const wchar * GetString (); - const dword * GetDWordArray (unsigned count); + const wchar_t * GetString (); + const uint32_t * GetDWordArray (unsigned count); unsigned BytesLeft (); bool ParseError (); private: - const byte * m_pos; - const byte * m_end; -}; \ No newline at end of file + const uint8_t * m_pos; + const uint8_t * m_end; +}; diff --git a/Sources/Plasma/NucleusLib/pnOraLib/pnOraLib.cpp b/Sources/Plasma/NucleusLib/pnOraLib/pnOraLib.cpp index 3af1d20c..50361e68 100644 --- a/Sources/Plasma/NucleusLib/pnOraLib/pnOraLib.cpp +++ b/Sources/Plasma/NucleusLib/pnOraLib/pnOraLib.cpp @@ -68,15 +68,15 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com struct OraInitData { unsigned OraStmtCacheSize; - wchar OraUsername[128]; - wchar OraPassword[128]; - wchar OraConnectString[256]; + wchar_t OraUsername[128]; + wchar_t OraPassword[128]; + wchar_t OraConnectString[256]; OraInitData( unsigned stmtCacheSize, - const wchar username[], - const wchar password[], - const wchar connectString[] + const wchar_t username[], + const wchar_t password[], + const wchar_t connectString[] ); }; @@ -97,13 +97,13 @@ struct OraConnPool { void ReInitialize_CS (); void Initialize ( - const wchar username[], - const wchar password[], - const wchar connectString[], + const wchar_t username[], + const wchar_t password[], + const wchar_t connectString[], unsigned stmtCacheSize ); void Shutdown (); - OraConn * GetConn (const wchar tag[]); + OraConn * GetConn (const wchar_t tag[]); void FreeConn (OraConn *& conn); long GetPerf (long index); @@ -144,9 +144,9 @@ static long s_perf[kNumPerf]; //============================================================================ OraInitData::OraInitData ( unsigned stmtCacheSize, - const wchar username[], - const wchar password[], - const wchar connectString[] + const wchar_t username[], + const wchar_t password[], + const wchar_t connectString[] ) { OraStmtCacheSize = stmtCacheSize; StrCopy(OraUsername, username, arrsize(OraUsername)); @@ -181,16 +181,12 @@ void OraConnPool::Initialize_CS () { const unsigned minConns = 0; const unsigned incConns = max(1, maxConns - 1); - // Some memory allocated by createEnvironment is leaked, - // so we disable memory tracking while calling it. - MemPushDisableTracking(); oraEnv.occiEnv = occi::Environment::createEnvironment( "OCCIUTF16", "OCCIUTF16", occi::Environment::THREADED_MUTEXED, nil ); - MemPopDisableTracking(); // Create the connection pool oraEnv.occiPool = oraEnv.occiEnv->createStatelessConnectionPool( @@ -237,12 +233,12 @@ void OraConnPool::Shutdown_CS () { //============================================================================ void OraConnPool::Initialize ( - const wchar username[], - const wchar password[], - const wchar connectString[], + const wchar_t username[], + const wchar_t password[], + const wchar_t connectString[], unsigned stmtCacheSize ) { - data = NEW(OraInitData)(stmtCacheSize, username, password, connectString); + data = new OraInitData(stmtCacheSize, username, password, connectString); critsect.Enter(); { @@ -260,11 +256,11 @@ void OraConnPool::Shutdown () { } critsect.Leave(); - DEL(data); + delete data; } //============================================================================ -OraConn * OraConnPool::GetConn (const wchar tag[]) { +OraConn * OraConnPool::GetConn (const wchar_t tag[]) { OraConn * oraConn = NEWZERO(OraConn); if (tag) @@ -298,7 +294,7 @@ OraConn * OraConnPool::GetConn (const wchar tag[]) { for (;;) { if (!oraConn || !oraConn->occiConn) { - DEL(oraConn); + delete oraConn; oraConn = nil; LogMsg(kLogError, L"OraConnPool::GetConn: Failed to aquire a database connection"); break; @@ -331,7 +327,7 @@ void OraConnPool::FreeConn (OraConn *& oraConn) { LogMsg(kLogPerf, L"OraFreeConn: %u, %p, %s", connCount, oraConn, oraConn->tag); #endif - DEL(oraConn); + delete oraConn; try { occiConn->commit(); @@ -373,14 +369,14 @@ long OraConnPool::GetPerf (long index) { ***/ //============================================================================ -void OraLogError (const wchar sql[], const exception & e) { +void OraLogError (const wchar_t sql[], const exception & e) { - wchar buffer[1024]; + wchar_t buffer[1024]; const char * tmp = e.what(); // Some exceptions we catch are actually unicode strings in a char buffer, but others aren't. if (tmp[0] && !tmp[1]) { - const wchar * wtmp = (const wchar *)tmp; + const wchar_t * wtmp = (const wchar_t *)tmp; StrCopy(buffer, wtmp, arrsize(buffer)); } else { @@ -398,7 +394,7 @@ void OraGetShaDigest ( occi::Bytes bytes = oraStmt->getBytes(index); const unsigned length = bytes.length(); ASSERT(length == msizeof(ShaDigest, data)); - bytes.getBytes((byte *)digest->data, length); + bytes.getBytes((uint8_t *)digest->data, length); } //============================================================================ @@ -407,7 +403,7 @@ void OraSetShaDigest ( unsigned index, const ShaDigest & digest ) { - occi::Bytes bytes((byte *)&digest, sizeof(digest)); + occi::Bytes bytes((uint8_t *)&digest, sizeof(digest)); oraStmt->setBytes(index, bytes); } @@ -415,7 +411,7 @@ void OraSetShaDigest ( void OraBindString ( occi::Statement * oraStmt, unsigned index, - wchar * buffer, + wchar_t * buffer, unsigned chars, ub2 * length, sb2 * indicator @@ -434,7 +430,7 @@ void OraBindString ( void OraBindString ( occi::ResultSet * rs, unsigned index, - wchar * buffer, + wchar_t * buffer, unsigned chars, ub2 * length, sb2 * indicator @@ -458,9 +454,11 @@ void OraGetUuid ( occi::Bytes bytes = oraStmt->getBytes(index); if (const unsigned length = bytes.length()) { ASSERT(length == msizeof(Uuid, data)); - byte * buf = ALLOCA(byte, length); + uint8_t * buf = malloc(length); bytes.getBytes(buf, length); GuidFromHex(buf, length, uuid); + + free(buf) } else { GuidClear(uuid); @@ -473,12 +471,12 @@ void OraSetUuid ( unsigned index, const Uuid & uuid ) { - occi::Bytes bytes((byte *)&uuid, sizeof(uuid)); + occi::Bytes bytes((uint8_t *)&uuid, sizeof(uuid)); oraStmt->setBytes(index, bytes); } //============================================================================ -OraConn * OraGetConn (const wchar tag[]) { +OraConn * OraGetConn (const wchar_t tag[]) { // grabs a cached connection if available, otherwise creates a new one on-the-fly return s_connPool.GetConn(tag); @@ -493,7 +491,7 @@ void OraFreeConn (OraConn *& oraConn) { //============================================================================ occi::Statement * OraGetStmt ( OraConn * oraConn, - const wchar sql[] + const wchar_t sql[] ) { occi::Statement * oraStmt = nil; try { @@ -538,9 +536,9 @@ occi::Statement * OraGetStmt ( //============================================================================ void OraInitialize ( - const wchar username[], - const wchar password[], - const wchar connectString[], + const wchar_t username[], + const wchar_t password[], + const wchar_t connectString[], unsigned stmtCacheSize ) { // Connect to the database diff --git a/Sources/Plasma/NucleusLib/pnOraLib/pnOraLib.h b/Sources/Plasma/NucleusLib/pnOraLib/pnOraLib.h index 0c22e254..05920d80 100644 --- a/Sources/Plasma/NucleusLib/pnOraLib/pnOraLib.h +++ b/Sources/Plasma/NucleusLib/pnOraLib/pnOraLib.h @@ -67,7 +67,7 @@ struct OraConn { // treat all fields as read-only OraEnv * oraEnv; occi::Connection * occiConn; - wchar tag[128]; + wchar_t tag[128]; }; @@ -77,7 +77,7 @@ struct OraConn { * ***/ -void OraLogError (const wchar sql[], const exception & e); +void OraLogError (const wchar_t sql[], const exception & e); void OraGetShaDigest ( occi::Statement * oraStmt, @@ -94,7 +94,7 @@ void OraSetShaDigest ( void OraBindString ( occi::Statement * oraStmt, unsigned index, - wchar * buffer, + wchar_t * buffer, unsigned chars, ub2 * length, sb2 * indicator @@ -103,7 +103,7 @@ void OraBindString ( void OraBindString ( occi::ResultSet * rs, unsigned index, - wchar * buffer, + wchar_t * buffer, unsigned chars, ub2 * length, sb2 * indicator @@ -121,21 +121,21 @@ void OraSetUuid ( const Uuid & uuid ); -OraConn * OraGetConn (const wchar tag[] = nil); +OraConn * OraGetConn (const wchar_t tag[] = nil); void OraFreeConn (OraConn *& oraConn); occi::Statement * OraGetStmt ( OraConn * oraConn, - const wchar sql[] + const wchar_t sql[] ); void OraFreeStmt (occi::Statement *& oraStmt); void OraInitialize ( - const wchar username[], - const wchar password[], - const wchar connectString[], + const wchar_t username[], + const wchar_t password[], + const wchar_t connectString[], unsigned stmtCacheSize ); void OraShutdown (); diff --git a/Sources/Plasma/NucleusLib/pnProduct/Private/pnPrBuildString.cpp b/Sources/Plasma/NucleusLib/pnProduct/Private/pnPrBuildString.cpp index f454aaf2..31a178bd 100644 --- a/Sources/Plasma/NucleusLib/pnProduct/Private/pnPrBuildString.cpp +++ b/Sources/Plasma/NucleusLib/pnProduct/Private/pnPrBuildString.cpp @@ -57,10 +57,10 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com ***/ //============================================================================ -const wchar * ProductBuildString () { +const wchar_t * ProductBuildString () { // This string is replaced by plMarkBuild.exe with the following string: // "date:YYMMDD time:HHMMSS user:%USERNAME%" - static const wchar PRODUCT_BUILD_STRING[64] = { + static const wchar_t PRODUCT_BUILD_STRING[64] = { L"PRODUCT_BUILD_STRING " }; return PRODUCT_BUILD_STRING; diff --git a/Sources/Plasma/NucleusLib/pnProduct/Private/pnPrBuildString.h b/Sources/Plasma/NucleusLib/pnProduct/Private/pnPrBuildString.h index 615fc1e5..8fecf1f9 100644 --- a/Sources/Plasma/NucleusLib/pnProduct/Private/pnPrBuildString.h +++ b/Sources/Plasma/NucleusLib/pnProduct/Private/pnPrBuildString.h @@ -58,4 +58,4 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com * ***/ -const wchar * ProductBuildString (); +const wchar_t * ProductBuildString (); diff --git a/Sources/Plasma/NucleusLib/pnProduct/Private/pnPrProductId.cpp b/Sources/Plasma/NucleusLib/pnProduct/Private/pnPrProductId.cpp index 92b9028e..d76b0fe9 100644 --- a/Sources/Plasma/NucleusLib/pnProduct/Private/pnPrProductId.cpp +++ b/Sources/Plasma/NucleusLib/pnProduct/Private/pnPrProductId.cpp @@ -58,9 +58,9 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com namespace Product { namespace Uru { - static const wchar kCoreName[] = L"UruLive"; - static const wchar kShortName[] = L"UruLive"; - static const wchar kLongName[] = L"Uru Live"; + static const wchar_t kCoreName[] = L"UruLive"; + static const wchar_t kShortName[] = L"UruLive"; + static const wchar_t kLongName[] = L"Uru Live"; static const plUUID kId("ea489821-6c35-4bd0-9dae-bb17c585e680"); } @@ -101,23 +101,23 @@ const plUUID& ProductId () { } //============================================================================ -const wchar * ProductCoreName () { +const wchar_t * ProductCoreName () { return PRODUCT_CORE_NAME; } //============================================================================ -const wchar * ProductShortName () { +const wchar_t * ProductShortName () { return PRODUCT_SHORT_NAME; } //============================================================================ -const wchar * ProductLongName () { +const wchar_t * ProductLongName () { return PRODUCT_LONG_NAME; } //============================================================================ -void ProductString (wchar * dest, unsigned destChars) { +void ProductString (wchar_t * dest, unsigned destChars) { // Example: "UruLive.2.214 - External.Release" swprintf( dest, diff --git a/Sources/Plasma/NucleusLib/pnProduct/Private/pnPrProductId.h b/Sources/Plasma/NucleusLib/pnProduct/Private/pnPrProductId.h index 1023fa63..c616da36 100644 --- a/Sources/Plasma/NucleusLib/pnProduct/Private/pnPrProductId.h +++ b/Sources/Plasma/NucleusLib/pnProduct/Private/pnPrProductId.h @@ -84,11 +84,11 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com ***/ const plUUID& ProductId (); -const wchar * ProductCoreName (); // e.g: L"Uru" -const wchar * ProductShortName (); // e.g: L"Uru" (filename/registry friendly) -const wchar * ProductLongName (); // e.g: L"Uru: Ages Beyond Myst" (human friendly) +const wchar_t * ProductCoreName (); // e.g: L"Uru" +const wchar_t * ProductShortName (); // e.g: L"Uru" (filename/registry friendly) +const wchar_t * ProductLongName (); // e.g: L"Uru: Ages Beyond Myst" (human friendly) // Returns: ".. - ." // Example: "Uru.3.204 - External.Release" -void ProductString (wchar * dest, unsigned destChars); +void ProductString (wchar_t * dest, unsigned destChars); diff --git a/Sources/Plasma/NucleusLib/pnSceneObject/plAudioInterface.cpp b/Sources/Plasma/NucleusLib/pnSceneObject/plAudioInterface.cpp index 241842f2..03a3d50a 100644 --- a/Sources/Plasma/NucleusLib/pnSceneObject/plAudioInterface.cpp +++ b/Sources/Plasma/NucleusLib/pnSceneObject/plAudioInterface.cpp @@ -40,7 +40,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "plAudioInterface.h" #include "plAudible.h" #include "pnMessage/plAudioSysMsg.h" @@ -159,7 +159,7 @@ void plAudioInterface::Read(hsStream* s, hsResMgr* mgr) { plObjInterface::Read(s, mgr); - plIntRefMsg* refMsg = TRACKED_NEW plIntRefMsg(GetKey(), plRefMsg::kOnCreate, 0, plIntRefMsg::kAudible); + plIntRefMsg* refMsg = new plIntRefMsg(GetKey(), plRefMsg::kOnCreate, 0, plIntRefMsg::kAudible); mgr->ReadKeyNotifyMe(s, refMsg, plRefFlags::kActiveRef); } @@ -180,7 +180,7 @@ void plAudioInterface::ISetAudible(plAudible* aud) fAudible->SetSceneObject(fOwner->GetKey()); } - plAudioSysMsg* pMsg = TRACKED_NEW plAudioSysMsg( plAudioSysMsg::kPing ); + plAudioSysMsg* pMsg = new plAudioSysMsg( plAudioSysMsg::kPing ); pMsg->SetSender(GetKey()); // pMsg->SetBCastFlag(plMessage::kBCastByExactType, false); plgDispatch::MsgSend( pMsg ); @@ -248,7 +248,7 @@ hsBool plAudioInterface::MsgReceive(plMessage* msg) } if (pSoundMsg->Cmd( plSoundMsg::kGetNumSounds ) ) { - plSoundMsg* pReply = TRACKED_NEW plSoundMsg; + plSoundMsg* pReply = new plSoundMsg; pReply->fIndex = fAudible->GetNumSounds(); pReply->AddReceiver(pSoundMsg->GetSender()); pReply->SetCmd( plSoundMsg::kGetNumSounds ); @@ -303,7 +303,7 @@ hsBool plAudioInterface::MsgReceive(plMessage* msg) if( !fAudibleInited ) { // Arrgh, can't activate yet, so attempt to re-activate some time in the near future - pASMsg = TRACKED_NEW plAudioSysMsg( plAudioSysMsg::kActivate ); + pASMsg = new plAudioSysMsg( plAudioSysMsg::kActivate ); pASMsg->SetBCastFlag( plMessage::kBCastByExactType, false ); pASMsg->SetBCastFlag( plMessage::kNetPropagate, false ); pASMsg->SetTimeStamp( hsTimer::GetSysSeconds() + 1.f ); diff --git a/Sources/Plasma/NucleusLib/pnSceneObject/plAudioInterface.h b/Sources/Plasma/NucleusLib/pnSceneObject/plAudioInterface.h index c323ad9d..d44a557a 100644 --- a/Sources/Plasma/NucleusLib/pnSceneObject/plAudioInterface.h +++ b/Sources/Plasma/NucleusLib/pnSceneObject/plAudioInterface.h @@ -87,7 +87,7 @@ public: virtual void Write(hsStream* stream, hsResMgr* mgr); void SetProperty(int prop, hsBool on); - Int32 GetNumProperties() const { return kNumProps; } + int32_t GetNumProperties() const { return kNumProps; } plSound* GetSound(int i) const; int GetNumSounds() const; diff --git a/Sources/Plasma/NucleusLib/pnSceneObject/plCoordinateInterface.cpp b/Sources/Plasma/NucleusLib/pnSceneObject/plCoordinateInterface.cpp index 9adddaf5..643834be 100644 --- a/Sources/Plasma/NucleusLib/pnSceneObject/plCoordinateInterface.cpp +++ b/Sources/Plasma/NucleusLib/pnSceneObject/plCoordinateInterface.cpp @@ -40,7 +40,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "plCoordinateInterface.h" #include "plDrawInterface.h" #include "plSimulationInterface.h" @@ -58,7 +58,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "plProfile.h" -UInt8 plCoordinateInterface::fTransformPhase = plCoordinateInterface::kTransformPhaseNormal; +uint8_t plCoordinateInterface::fTransformPhase = plCoordinateInterface::kTransformPhaseNormal; hsBool plCoordinateInterface::fDelayedTransformsEnabled = true; plCoordinateInterface::plCoordinateInterface() @@ -165,7 +165,7 @@ void plCoordinateInterface::IAddChild(plSceneObject* child) ISetChild(child, -1); } -void plCoordinateInterface::IAttachChild(plSceneObject* child, UInt8 flags) +void plCoordinateInterface::IAttachChild(plSceneObject* child, uint8_t flags) { hsAssert(child, "Attaching a nil child"); plCoordinateInterface* childCI = child->GetVolatileCoordinateInterface(); @@ -188,7 +188,7 @@ void plCoordinateInterface::IAttachChild(plSceneObject* child, UInt8 flags) childCI->WarpToWorld(l2w,w2l); } -void plCoordinateInterface::IDetachChild(plSceneObject* child, UInt8 flags) +void plCoordinateInterface::IDetachChild(plSceneObject* child, uint8_t flags) { hsAssert(child, "Detaching a nil child"); plCoordinateInterface* childCI = child->GetVolatileCoordinateInterface(); @@ -313,7 +313,7 @@ void plCoordinateInterface::SetTransformPhysical(const hsMatrix44& l2w, const hs // AND those public interfaces therefore have to set their own "reason" for the transform change // THEREFORE: we need to preserve the "reason" flags before we call the public interfaces // so that we don't get reasonPhysics + reasonUnknown, just reasonPhysics - UInt16 oldReason = fReason; + uint16_t oldReason = fReason; if( fParent ) { @@ -326,7 +326,7 @@ void plCoordinateInterface::SetTransformPhysical(const hsMatrix44& l2w, const hs fReason = oldReason | kReasonPhysics; } -UInt16 plCoordinateInterface::GetReasons() +uint16_t plCoordinateInterface::GetReasons() { return fReason; } @@ -463,7 +463,7 @@ void plCoordinateInterface::IRecalcTransforms() plProfile_EndTiming(CIRecalcT); } -void plCoordinateInterface::ITransformChanged(hsBool force, UInt16 reasons, hsBool checkForDelay) +void plCoordinateInterface::ITransformChanged(hsBool force, uint16_t reasons, hsBool checkForDelay) { plProfile_IncCount(CITrans, 1); plProfile_BeginTiming(CITransT); @@ -471,7 +471,7 @@ void plCoordinateInterface::ITransformChanged(hsBool force, UInt16 reasons, hsBo // inherit reasons for transform change from our parents fReason |= reasons; - UInt16 propagateReasons = fReason; + uint16_t propagateReasons = fReason; hsBool process = !(checkForDelay && GetProperty(kDelayedTransformEval)) || !fDelayedTransformsEnabled; @@ -561,7 +561,7 @@ void plCoordinateInterface::Read(hsStream* stream, hsResMgr* mgr) int i; for( i = 0; i < n; i++ ) { - plIntRefMsg* refMsg = TRACKED_NEW plIntRefMsg(GetKey(), plRefMsg::kOnCreate, -1, plIntRefMsg::kChildObject); + plIntRefMsg* refMsg = new plIntRefMsg(GetKey(), plRefMsg::kOnCreate, -1, plIntRefMsg::kChildObject); mgr->ReadKeyNotifyMe(stream,refMsg, plRefFlags::kPassiveRef); } } diff --git a/Sources/Plasma/NucleusLib/pnSceneObject/plCoordinateInterface.h b/Sources/Plasma/NucleusLib/pnSceneObject/plCoordinateInterface.h index 08187412..ac30d846 100644 --- a/Sources/Plasma/NucleusLib/pnSceneObject/plCoordinateInterface.h +++ b/Sources/Plasma/NucleusLib/pnSceneObject/plCoordinateInterface.h @@ -91,13 +91,13 @@ protected: // Set by the client in IUpdate(). This tells us where we are in the update loop so that we know // which transform message to register for when our transform is dirtied. - static UInt8 fTransformPhase; + static uint8_t fTransformPhase; // Temp debugging tool, so we can quickly (dis/en)able delayed transforms at runtime. static hsBool fDelayedTransformsEnabled; - UInt16 fState; - UInt16 fReason; // why we've changed position (if we have) + uint16_t fState; + uint16_t fReason; // why we've changed position (if we have) hsTArray fChildren; plCoordinateInterface* fParent; // if this changes, marks us as dirty @@ -122,12 +122,12 @@ protected: virtual void IAddChild(plSceneObject* child); // sets parent on child virtual void IRemoveChild(plSceneObject* child); // removes this as parent of child virtual void IRemoveChild(int i); // removes this as parent of child - virtual void IAttachChild(plSceneObject* child, UInt8 flags); // physically attaches child to us - virtual void IDetachChild(plSceneObject* child, UInt8 flags); // physically detach this child from us + virtual void IAttachChild(plSceneObject* child, uint8_t flags); // physically attaches child to us + virtual void IDetachChild(plSceneObject* child, uint8_t flags); // physically detach this child from us virtual void IUpdateDelayProp(); // Called whenever a child is added/removed virtual void IRecalcTransforms(); // Called by ITransformChanged when we need to re-examine our relationship with our parent. - virtual void ITransformChanged(hsBool force, UInt16 reasons, hsBool checkForDelay); // called by SceneObject on TransformChanged messsage + virtual void ITransformChanged(hsBool force, uint16_t reasons, hsBool checkForDelay); // called by SceneObject on TransformChanged messsage void IDirtyTransform(); void IRegisterForTransformMessage(hsBool delayed); @@ -188,12 +188,12 @@ public: virtual hsBool MsgReceive(plMessage* msg); - UInt16 GetReasons(); + uint16_t GetReasons(); void ClearReasons(); - Int32 GetNumProperties() const { return kNumProps; } - static UInt8 GetTransformPhase() { return fTransformPhase; } - static void SetTransformPhase(UInt8 phase) { fTransformPhase = phase; } + int32_t GetNumProperties() const { return kNumProps; } + static uint8_t GetTransformPhase() { return fTransformPhase; } + static void SetTransformPhase(uint8_t phase) { fTransformPhase = phase; } static hsBool GetDelayedTransformsEnabled() { return fDelayedTransformsEnabled; } static void SetDelayedTransformsEnabled(hsBool val) { fDelayedTransformsEnabled = val; } diff --git a/Sources/Plasma/NucleusLib/pnSceneObject/plDrawInterface.cpp b/Sources/Plasma/NucleusLib/pnSceneObject/plDrawInterface.cpp index d8a917a6..67649156 100644 --- a/Sources/Plasma/NucleusLib/pnSceneObject/plDrawInterface.cpp +++ b/Sources/Plasma/NucleusLib/pnSceneObject/plDrawInterface.cpp @@ -40,7 +40,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "plDrawInterface.h" #include "plDrawable.h" #include "hsBounds.h" @@ -61,7 +61,7 @@ plDrawInterface::~plDrawInterface() } -void plDrawInterface::SetDrawableMeshIndex( UInt8 which, UInt32 index ) +void plDrawInterface::SetDrawableMeshIndex( uint8_t which, uint32_t index ) { ICheckDrawableIndex(which); @@ -154,7 +154,7 @@ void plDrawInterface::Read(hsStream* s, hsResMgr* mgr) { fDrawableIndices[i] = s->ReadLE32(); - plIntRefMsg* refMsg = TRACKED_NEW plIntRefMsg(GetKey(), plRefMsg::kOnCreate, i, plIntRefMsg::kDrawable); + plIntRefMsg* refMsg = new plIntRefMsg(GetKey(), plRefMsg::kOnCreate, i, plIntRefMsg::kDrawable); mgr->ReadKeyNotifyMe(s,refMsg, plRefFlags::kActiveRef); } @@ -162,7 +162,7 @@ void plDrawInterface::Read(hsStream* s, hsResMgr* mgr) fRegions.SetCountAndZero(nReg); for( i = 0; i < nReg; i++ ) { - plGenRefMsg* refMsg = TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnCreate, -1, kRefVisRegion); + plGenRefMsg* refMsg = new plGenRefMsg(GetKey(), plRefMsg::kOnCreate, -1, kRefVisRegion); mgr->ReadKeyNotifyMe(s, refMsg, plRefFlags::kActiveRef); } } @@ -196,19 +196,19 @@ void plDrawInterface::ReleaseData( void ) int i; for( i = 0; i < fDrawables.GetCount(); i++ ) { - if( fDrawables[i] && (fDrawableIndices[i] != UInt32(-1)) ) + if( fDrawables[i] && (fDrawableIndices[i] != uint32_t(-1)) ) { - plDISpansMsg* diMsg = TRACKED_NEW plDISpansMsg(fDrawables[i]->GetKey(), plDISpansMsg::kRemovingSpan, fDrawableIndices[i], 0); + plDISpansMsg* diMsg = new plDISpansMsg(fDrawables[i]->GetKey(), plDISpansMsg::kRemovingSpan, fDrawableIndices[i], 0); diMsg->SetSender(GetKey()); diMsg->Send(); } - //fDrawableIndices[i] = UInt32(-1); + //fDrawableIndices[i] = uint32_t(-1); fDrawables.Reset(); fDrawableIndices.Reset(); } } -void plDrawInterface::ICheckDrawableIndex(UInt8 which) +void plDrawInterface::ICheckDrawableIndex(uint8_t which) { if( which >= fDrawableIndices.GetCount() ) { @@ -218,11 +218,11 @@ void plDrawInterface::ICheckDrawableIndex(UInt8 which) fDrawableIndices.ExpandAndZero(which+1); int i; for( i = n; i <= which; i++ ) - fDrawableIndices[i] = UInt32(-1); + fDrawableIndices[i] = uint32_t(-1); } } -void plDrawInterface::ISetDrawable(UInt8 which, plDrawable* dr) +void plDrawInterface::ISetDrawable(uint8_t which, plDrawable* dr) { ICheckDrawableIndex(which); fDrawables[which] = dr; @@ -235,9 +235,9 @@ void plDrawInterface::ISetDrawable(UInt8 which, plDrawable* dr) ISetVisRegions(which); #ifdef HS_DEBUGGING - if( fDrawableIndices[which] != (UInt32)-1 ) + if( fDrawableIndices[which] != (uint32_t)-1 ) { - plDISpansMsg* diMsg = TRACKED_NEW plDISpansMsg(dr->GetKey(), plDISpansMsg::kAddingSpan, fDrawableIndices[which], 0); + plDISpansMsg* diMsg = new plDISpansMsg(dr->GetKey(), plDISpansMsg::kAddingSpan, fDrawableIndices[which], 0); diMsg->SetSender(GetKey()); diMsg->Send(); } @@ -250,7 +250,7 @@ void plDrawInterface::IRemoveDrawable(plDrawable *dr) if( fDrawables.kMissingIndex != idx ) { fDrawables[idx] = nil; - fDrawableIndices[idx] = UInt32(-1); + fDrawableIndices[idx] = uint32_t(-1); } else { @@ -263,7 +263,7 @@ void plDrawInterface::ISetVisRegion(hsKeyedObject* reg, hsBool on) int i; for( i = 0; i < fDrawables.GetCount(); i++ ) { - if( fDrawables[i] && (fDrawableIndices[i] != UInt32(-1)) ) + if( fDrawables[i] && (fDrawableIndices[i] != uint32_t(-1)) ) { fDrawables[i]->SetDISpanVisSet(fDrawableIndices[i], reg, on); } @@ -284,7 +284,7 @@ void plDrawInterface::ISetVisRegion(hsKeyedObject* reg, hsBool on) void plDrawInterface::ISetVisRegions(int iDraw) { - if( fDrawables[iDraw] && (fDrawableIndices[iDraw] != UInt32(-1)) ) + if( fDrawables[iDraw] && (fDrawableIndices[iDraw] != uint32_t(-1)) ) { int i; for( i = 0; i < fRegions.GetCount(); i++ ) @@ -295,12 +295,12 @@ void plDrawInterface::ISetVisRegions(int iDraw) } // Export only. Use messages for runtime -void plDrawInterface::SetDrawable(UInt8 which, plDrawable *dr) +void plDrawInterface::SetDrawable(uint8_t which, plDrawable *dr) { if( dr ) { // This is a little convoluted, but it makes GCC happy and doesn't hurt anybody. - plIntRefMsg* intRefMsg = TRACKED_NEW plIntRefMsg(GetKey(), plRefMsg::kOnCreate, which, plIntRefMsg::kDrawable); + plIntRefMsg* intRefMsg = new plIntRefMsg(GetKey(), plRefMsg::kOnCreate, which, plIntRefMsg::kDrawable); plRefMsg* refMsg = intRefMsg; // hsgResMgr::ResMgr()->SendRef(dr->GetKey(), intRefMsg, plRefFlags::kActiveRef); // THIS WON'T COMPILE UNDER GCC hsgResMgr::ResMgr()->SendRef(dr, refMsg, plRefFlags::kActiveRef); @@ -325,7 +325,7 @@ hsBool plDrawInterface::MsgReceive(plMessage* msg) } else { - ISetDrawable((UInt8)intRefMsg->fWhich, plDrawable::ConvertNoRef(intRefMsg->GetRef())); + ISetDrawable((uint8_t)intRefMsg->fWhich, plDrawable::ConvertNoRef(intRefMsg->GetRef())); } return true; default: @@ -359,14 +359,14 @@ hsBool plDrawInterface::MsgReceive(plMessage* msg) return plObjInterface::MsgReceive(msg); } -void plDrawInterface::SetUpForParticleSystem( UInt32 maxNumEmitters, UInt32 maxNumParticles, hsGMaterial *material, hsTArray& lights ) +void plDrawInterface::SetUpForParticleSystem( uint32_t maxNumEmitters, uint32_t maxNumParticles, hsGMaterial *material, hsTArray& lights ) { hsAssert( fDrawables[0] != nil, "No drawable to use for particle system!" ); SetDrawableMeshIndex( 0, fDrawables[0]->CreateParticleSystem( maxNumEmitters, maxNumParticles, material ) ); int i; for( i = 0; i < lights.GetCount(); i++ ) { - hsgResMgr::ResMgr()->AddViaNotify(lights[i], TRACKED_NEW plGenRefMsg(fDrawables[0]->GetKey(), plRefMsg::kOnCreate, fDrawableIndices[0], plDrawable::kMsgPermaLightDI), plRefFlags::kPassiveRef); + hsgResMgr::ResMgr()->AddViaNotify(lights[i], new plGenRefMsg(fDrawables[0]->GetKey(), plRefMsg::kOnCreate, fDrawableIndices[0], plDrawable::kMsgPermaLightDI), plRefFlags::kPassiveRef); } ISetVisRegions(0); diff --git a/Sources/Plasma/NucleusLib/pnSceneObject/plDrawInterface.h b/Sources/Plasma/NucleusLib/pnSceneObject/plDrawInterface.h index a77aad9b..d3e5acd2 100644 --- a/Sources/Plasma/NucleusLib/pnSceneObject/plDrawInterface.h +++ b/Sources/Plasma/NucleusLib/pnSceneObject/plDrawInterface.h @@ -68,16 +68,16 @@ public: protected: hsTArray fDrawables; - hsTArray fDrawableIndices; + hsTArray fDrawableIndices; hsTArray fRegions; void ISetVisRegions(int iDraw); void ISetVisRegion(hsKeyedObject* ref, hsBool on); - void ISetDrawable(UInt8 which, plDrawable* dr); + void ISetDrawable(uint8_t which, plDrawable* dr); void IRemoveDrawable(plDrawable* dr); void ISetSceneNode(plKey newNode); - virtual void ICheckDrawableIndex(UInt8 which); + virtual void ICheckDrawableIndex(uint8_t which); friend class plSceneObject; @@ -92,7 +92,7 @@ public: virtual void Write(hsStream* stream, hsResMgr* mgr); void SetProperty(int prop, hsBool on); - Int32 GetNumProperties() const { return kNumProps; } + int32_t GetNumProperties() const { return kNumProps; } // Transform settable only, if you want it get it from the coordinate interface. void SetTransform(const hsMatrix44& l2w, const hsMatrix44& w2l); @@ -107,17 +107,17 @@ public: virtual void ReleaseData( void ); /// Funky particle system functions - void SetUpForParticleSystem( UInt32 maxNumEmitters, UInt32 maxNumParticles, hsGMaterial *material, hsTArray& lights ); + void SetUpForParticleSystem( uint32_t maxNumEmitters, uint32_t maxNumParticles, hsGMaterial *material, hsTArray& lights ); void ResetParticleSystem( void ); void AssignEmitterToParticleSystem( plParticleEmitter *emitter ); /// EXPORT-ONLY - void SetDrawable(UInt8 which, plDrawable* dr); - plDrawable* GetDrawable( UInt8 which ) const { return which < fDrawables.GetCount() ? fDrawables[which] : nil; } - UInt32 GetNumDrawables() const { return fDrawables.GetCount(); } + void SetDrawable(uint8_t which, plDrawable* dr); + plDrawable* GetDrawable( uint8_t which ) const { return which < fDrawables.GetCount() ? fDrawables[which] : nil; } + uint32_t GetNumDrawables() const { return fDrawables.GetCount(); } // Sets the triMesh index to be used when referring to our spans in the drawable - void SetDrawableMeshIndex( UInt8 which, UInt32 index ); - UInt32 GetDrawableMeshIndex( UInt8 which ) const { return which < fDrawableIndices.GetCount() ? fDrawableIndices[which] : UInt32(-1); } + void SetDrawableMeshIndex( uint8_t which, uint32_t index ); + uint32_t GetDrawableMeshIndex( uint8_t which ) const { return which < fDrawableIndices.GetCount() ? fDrawableIndices[which] : uint32_t(-1); } }; diff --git a/Sources/Plasma/NucleusLib/pnSceneObject/plObjInterface.cpp b/Sources/Plasma/NucleusLib/pnSceneObject/plObjInterface.cpp index f682a611..f773fbc0 100644 --- a/Sources/Plasma/NucleusLib/pnSceneObject/plObjInterface.cpp +++ b/Sources/Plasma/NucleusLib/pnSceneObject/plObjInterface.cpp @@ -40,7 +40,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "plObjInterface.h" #include "hsResMgr.h" #include "pnKeyedObject/plKey.h" @@ -72,7 +72,7 @@ void plObjInterface::Read(hsStream* s, hsResMgr* mgr) { plSynchedObject::Read(s, mgr); - mgr->ReadKeyNotifyMe(s, TRACKED_NEW plIntRefMsg(GetKey(), plRefMsg::kOnCreate, 0, plIntRefMsg::kOwner), plRefFlags::kPassiveRef); + mgr->ReadKeyNotifyMe(s, new plIntRefMsg(GetKey(), plRefMsg::kOnCreate, 0, plIntRefMsg::kOwner), plRefFlags::kPassiveRef); fProps.Read(s); } diff --git a/Sources/Plasma/NucleusLib/pnSceneObject/plObjInterface.h b/Sources/Plasma/NucleusLib/pnSceneObject/plObjInterface.h index 5bdf5585..bca30986 100644 --- a/Sources/Plasma/NucleusLib/pnSceneObject/plObjInterface.h +++ b/Sources/Plasma/NucleusLib/pnSceneObject/plObjInterface.h @@ -105,7 +105,7 @@ public: // shouldn't need to override GetProperty() hsBool GetProperty(int prop) const { return fProps.IsBitSet(prop); } - virtual Int32 GetNumProperties() const = 0; + virtual int32_t GetNumProperties() const = 0; virtual void SetTransform(const hsMatrix44& l2w, const hsMatrix44& w2l) = 0; diff --git a/Sources/Plasma/NucleusLib/pnSceneObject/plSceneObject.cpp b/Sources/Plasma/NucleusLib/pnSceneObject/plSceneObject.cpp index fe6091e5..52102af5 100644 --- a/Sources/Plasma/NucleusLib/pnSceneObject/plSceneObject.cpp +++ b/Sources/Plasma/NucleusLib/pnSceneObject/plSceneObject.cpp @@ -40,7 +40,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "plSceneObject.h" #include "plDrawInterface.h" #include "plSimulationInterface.h" @@ -111,16 +111,16 @@ void plSceneObject::Read(hsStream* stream, hsResMgr* mgr) // Interfaces will attach themselves to us on read. // DI - mgr->ReadKeyNotifyMe(stream, TRACKED_NEW plObjRefMsg(GetKey(), plRefMsg::kOnCreate, 0, plObjRefMsg::kInterface), plRefFlags::kActiveRef); + mgr->ReadKeyNotifyMe(stream, new plObjRefMsg(GetKey(), plRefMsg::kOnCreate, 0, plObjRefMsg::kInterface), plRefFlags::kActiveRef); // SI - mgr->ReadKeyNotifyMe(stream, TRACKED_NEW plObjRefMsg(GetKey(), plRefMsg::kOnCreate, 0, plObjRefMsg::kInterface), plRefFlags::kActiveRef); + mgr->ReadKeyNotifyMe(stream, new plObjRefMsg(GetKey(), plRefMsg::kOnCreate, 0, plObjRefMsg::kInterface), plRefFlags::kActiveRef); // CI - mgr->ReadKeyNotifyMe(stream, TRACKED_NEW plObjRefMsg(GetKey(), plRefMsg::kOnCreate, 0, plObjRefMsg::kInterface), plRefFlags::kActiveRef); + mgr->ReadKeyNotifyMe(stream, new plObjRefMsg(GetKey(), plRefMsg::kOnCreate, 0, plObjRefMsg::kInterface), plRefFlags::kActiveRef); // AI - mgr->ReadKeyNotifyMe(stream, TRACKED_NEW plObjRefMsg(GetKey(), plRefMsg::kOnCreate, 0, plObjRefMsg::kInterface), plRefFlags::kActiveRef); + mgr->ReadKeyNotifyMe(stream, new plObjRefMsg(GetKey(), plRefMsg::kOnCreate, 0, plObjRefMsg::kInterface), plRefFlags::kActiveRef); int i; @@ -128,7 +128,7 @@ void plSceneObject::Read(hsStream* stream, hsResMgr* mgr) fGenerics.SetCount(0); for( i = 0; i < nGen; i++ ) { - mgr->ReadKeyNotifyMe(stream, TRACKED_NEW plObjRefMsg(GetKey(), plRefMsg::kOnCreate, 0, plObjRefMsg::kInterface), plRefFlags::kActiveRef); + mgr->ReadKeyNotifyMe(stream, new plObjRefMsg(GetKey(), plRefMsg::kOnCreate, 0, plObjRefMsg::kInterface), plRefFlags::kActiveRef); } plObjRefMsg* refMsg; @@ -138,7 +138,7 @@ void plSceneObject::Read(hsStream* stream, hsResMgr* mgr) fModifiers.ExpandAndZero(nOldMods+nNewMods); // reserve space for new modifiers+existing modifiers for( i = nOldMods; i < nOldMods+nNewMods; i++ ) { - refMsg = TRACKED_NEW plObjRefMsg(GetKey(), plRefMsg::kOnCreate, i, plObjRefMsg::kModifier); + refMsg = new plObjRefMsg(GetKey(), plRefMsg::kOnCreate, i, plObjRefMsg::kModifier); mgr->ReadKeyNotifyMe(stream,refMsg, plRefFlags::kActiveRef); } @@ -226,7 +226,7 @@ void plSceneObject::ISetTransform(const hsMatrix44& l2w, const hsMatrix44& w2l) { if(fCoordinateInterface) { - UInt16 whyTransformed = fCoordinateInterface->GetReasons(); + uint16_t whyTransformed = fCoordinateInterface->GetReasons(); if(whyTransformed != plCoordinateInterface::kReasonPhysics) { // if we were transformed by anything but physics, let physics know @@ -357,7 +357,7 @@ void plSceneObject::ISetInterface(plObjInterface* iface) iface->ISetSceneNode(GetSceneNode()); } -void plSceneObject::IRemoveInterface(Int16 idx, plObjInterface* who) +void plSceneObject::IRemoveInterface(int16_t idx, plObjInterface* who) { if( plFactory::DerivesFrom(plDrawInterface::Index(), idx) ) ISetDrawInterface(nil); @@ -389,9 +389,9 @@ hsBool plSceneObject::IPropagateToModifiers(plMessage* msg) return retVal; } -hsBool plSceneObject::Eval(double secs, hsScalar delSecs) +hsBool plSceneObject::Eval(double secs, float delSecs) { - UInt32 dirty = ~0L; + uint32_t dirty = ~0L; hsBool retVal = false; int i; for( i = 0; i < fModifiers.GetCount(); i++ ) @@ -425,7 +425,7 @@ void plSceneObject::SetSceneNode(plKey newNode) if( newNode ) { - plNodeRefMsg* refMsg = TRACKED_NEW plNodeRefMsg(newNode, plNodeRefMsg::kOnRequest, -1, plNodeRefMsg::kObject); + plNodeRefMsg* refMsg = new plNodeRefMsg(newNode, plNodeRefMsg::kOnRequest, -1, plNodeRefMsg::kObject); plKey key = GetKey(); // for linux build hsgResMgr::ResMgr()->AddViaNotify(key, refMsg, plRefFlags::kActiveRef); } @@ -449,7 +449,7 @@ void plSceneObject::SetNetGroup(plNetGroupId netGroup) fCoordinateInterface->ISetNetGroupRecur(netGroup); } -const plModifier* plSceneObject::GetModifierByType(UInt16 classIdx) const +const plModifier* plSceneObject::GetModifierByType(uint16_t classIdx) const { int i; for (i = 0; i < fModifiers.GetCount(); i++) @@ -520,7 +520,7 @@ hsBool plSceneObject::MsgReceive(plMessage* msg) hsAssert(false, "Trying to attach a child who has no coordinateInterface"); return true; } - plIntRefMsg* intRefMsg = TRACKED_NEW plIntRefMsg(fCoordinateInterface->GetKey(), att->GetContext(), -1, plIntRefMsg::kChildObject); + plIntRefMsg* intRefMsg = new plIntRefMsg(fCoordinateInterface->GetKey(), att->GetContext(), -1, plIntRefMsg::kChildObject); intRefMsg->SetRef(child); hsgResMgr::ResMgr()->AddViaNotify(intRefMsg, plRefFlags::kPassiveRef); } @@ -740,7 +740,7 @@ void plSceneObject::IPropagateToGenerics(plMessage* msg) } } -plObjInterface* plSceneObject::GetVolatileGenericInterface(UInt16 classIdx) const +plObjInterface* plSceneObject::GetVolatileGenericInterface(uint16_t classIdx) const { int i; for( i = 0; i < fGenerics.GetCount(); i++ ) diff --git a/Sources/Plasma/NucleusLib/pnSceneObject/plSceneObject.h b/Sources/Plasma/NucleusLib/pnSceneObject/plSceneObject.h index 26c4d9a7..d3e7e373 100644 --- a/Sources/Plasma/NucleusLib/pnSceneObject/plSceneObject.h +++ b/Sources/Plasma/NucleusLib/pnSceneObject/plSceneObject.h @@ -76,7 +76,7 @@ private: plSimulationInterface* GetVolatileSimulationInterface() { return fSimulationInterface; } plCoordinateInterface* GetVolatileCoordinateInterface() { return fCoordinateInterface; } plAudioInterface* GetVolatileAudioInterface() { return fAudioInterface; } - plObjInterface* GetVolatileGenericInterface(UInt16 classIdx) const; + plObjInterface* GetVolatileGenericInterface(uint16_t classIdx) const; plModifier* GetVolatileModifier(int i) { return fModifiers[i]; } @@ -117,7 +117,7 @@ protected: void ISetInterface(plObjInterface* iface); void IRemoveInterface(plObjInterface* iface); - void IRemoveInterface(Int16 idx, plObjInterface* iface=nil); + void IRemoveInterface(int16_t idx, plObjInterface* iface=nil); void ISetTransform(const hsMatrix44& l2w, const hsMatrix44& w2l); @@ -140,14 +140,14 @@ public: int GetNumGenerics() const { return fGenerics.GetCount(); } const plObjInterface* GetGeneric(int i) const { return fGenerics[i]; } - plObjInterface* GetGenericInterface(UInt16 classIdx) const { return GetVolatileGenericInterface(classIdx); } + plObjInterface* GetGenericInterface(uint16_t classIdx) const { return GetVolatileGenericInterface(classIdx); } int GetNumModifiers() const { return fModifiers.GetCount(); } const plModifier* GetModifier(int i) const { return fModifiers[i]; } - const plModifier* GetModifierByType(UInt16 classIdx) const; + const plModifier* GetModifierByType(uint16_t classIdx) const; virtual hsBool MsgReceive(plMessage* msg); - virtual hsBool Eval(double secs, hsScalar del); + virtual hsBool Eval(double secs, float del); void SetSceneNode(plKey newNode); plKey GetSceneNode() const; diff --git a/Sources/Plasma/NucleusLib/pnSceneObject/plSimulationInterface.cpp b/Sources/Plasma/NucleusLib/pnSceneObject/plSimulationInterface.cpp index 3b111837..41915e81 100644 --- a/Sources/Plasma/NucleusLib/pnSceneObject/plSimulationInterface.cpp +++ b/Sources/Plasma/NucleusLib/pnSceneObject/plSimulationInterface.cpp @@ -99,7 +99,7 @@ void plSimulationInterface::Read(hsStream* s, hsResMgr* mgr) // Also unnecessary int poop = s->ReadLE32(); - plIntRefMsg* refMsg = TRACKED_NEW plIntRefMsg(GetKey(), plRefMsg::kOnCreate, 0, plIntRefMsg::kPhysical, 0); + plIntRefMsg* refMsg = new plIntRefMsg(GetKey(), plRefMsg::kOnCreate, 0, plIntRefMsg::kPhysical, 0); mgr->ReadKeyNotifyMe(s, refMsg, plRefFlags::kActiveRef); } diff --git a/Sources/Plasma/NucleusLib/pnSceneObject/plSimulationInterface.h b/Sources/Plasma/NucleusLib/pnSceneObject/plSimulationInterface.h index 88239492..c997a7ae 100644 --- a/Sources/Plasma/NucleusLib/pnSceneObject/plSimulationInterface.h +++ b/Sources/Plasma/NucleusLib/pnSceneObject/plSimulationInterface.h @@ -89,7 +89,7 @@ public: virtual void Write(hsStream* stream, hsResMgr* mgr); void SetProperty(int prop, hsBool on); - Int32 GetNumProperties() const { return kNumProps; } + int32_t GetNumProperties() const { return kNumProps; } // Transform settable only, if you want it get it from the coordinate interface. void SetTransform(const hsMatrix44& l2w, const hsMatrix44& w2l); diff --git a/Sources/Plasma/NucleusLib/pnSimpleNet/pnSimpleNet.cpp b/Sources/Plasma/NucleusLib/pnSimpleNet/pnSimpleNet.cpp index 41f4326a..0743b003 100644 --- a/Sources/Plasma/NucleusLib/pnSimpleNet/pnSimpleNet.cpp +++ b/Sources/Plasma/NucleusLib/pnSimpleNet/pnSimpleNet.cpp @@ -64,7 +64,7 @@ struct SimpleNetConn : AtomicRef { struct ConnectParam * connectParam; SimpleNet_MsgHeader * oversizeMsg; - ARRAY(byte) oversizeBuffer; + ARRAY(uint8_t) oversizeBuffer; ~SimpleNetConn () { ASSERT(!link.IsLinked()); @@ -135,7 +135,7 @@ static void NotifyConnSocketConnect (SimpleNetConn * conn) { kNetSuccess ); - DEL(conn->connectParam); + delete conn->connectParam; conn->connectParam = nil; } @@ -154,7 +154,7 @@ static void NotifyConnSocketConnectFailed (SimpleNetConn * conn) { kNetErrConnectFailed ); - DEL(conn->connectParam); + delete conn->connectParam; conn->connectParam = nil; conn->DecRef("Connecting"); @@ -199,8 +199,8 @@ static bool NotifyConnSocketRead (SimpleNetConn * conn, AsyncNotifySocketRead * bool result = true; - const byte * curr = read->buffer; - const byte * term = curr + read->bytes; + const uint8_t * curr = read->buffer; + const uint8_t * term = curr + read->bytes; while (curr < term) { // Reading oversize msg? @@ -249,7 +249,7 @@ static bool NotifyConnSocketRead (SimpleNetConn * conn, AsyncNotifySocketRead * } // Wait until we have received the entire message - const byte * msgTerm = (const byte *) curr + msg->messageBytes; + const uint8_t * msgTerm = (const uint8_t *) curr + msg->messageBytes; if (msgTerm > term) break; curr = msgTerm; @@ -401,14 +401,14 @@ static void Connect (const NetAddress & addr, ConnectParam * cp) { } s_critsect.Leave(); - DEL(conn); - DEL(cp); + delete conn; + delete cp; } //============================================================================ static void AsyncLookupCallback ( void * param, - const wchar name[], + const wchar_t name[], unsigned addrCount, const NetAddress addrs[] ) { @@ -417,7 +417,7 @@ static void AsyncLookupCallback ( if (!addrCount) { if (cp->callback) cp->callback(cp->param, nil, kNetErrNameLookupFailed); - DEL(cp); + delete cp; return; } @@ -558,14 +558,14 @@ void SimpleNetDestroyChannel (unsigned channelId) { //============================================================================ void SimpleNetStartConnecting ( unsigned channelId, - const wchar addr[], + const wchar_t addr[], FSimpleNetOnConnect onConnect, void * param ) { ASSERT(s_running); ASSERT(onConnect); - ConnectParam * cp = NEW(ConnectParam); + ConnectParam * cp = new ConnectParam; cp->callback = onConnect; cp->param = param; @@ -579,7 +579,7 @@ void SimpleNetStartConnecting ( ASSERT(cp->channel); // Do we need to lookup the address? - const wchar * name = addr; + const wchar_t * name = addr; while (unsigned ch = *name) { ++name; if (!(isdigit(ch) || ch == L'.' || ch == L':')) { @@ -633,7 +633,7 @@ void SimpleNetSend ( ) { ASSERT(s_running); ASSERT(msg); - ASSERT(msg->messageBytes != (dword)-1); + ASSERT(msg->messageBytes != (uint32_t)-1); ASSERT(conn); s_critsect.Enter(); diff --git a/Sources/Plasma/NucleusLib/pnSimpleNet/pnSimpleNet.h b/Sources/Plasma/NucleusLib/pnSimpleNet/pnSimpleNet.h index 5f3981a9..6690c09c 100644 --- a/Sources/Plasma/NucleusLib/pnSimpleNet/pnSimpleNet.h +++ b/Sources/Plasma/NucleusLib/pnSimpleNet/pnSimpleNet.h @@ -102,16 +102,16 @@ struct SimpleNet_Connect { struct SimpleNet_MsgHeader { private: - dword channelId; + uint32_t channelId; public: - dword messageId; - dword messageBytes; + uint32_t messageId; + uint32_t messageBytes; - SimpleNet_MsgHeader (dword channelId, dword messageId) + SimpleNet_MsgHeader (uint32_t channelId, uint32_t messageId) : channelId(channelId) , messageId(messageId) #ifdef HS_DEBUGGING - , messageBytes((dword)-1) + , messageBytes((uint32_t)-1) #endif { } }; @@ -168,7 +168,7 @@ void SimpleNetStopListening (); void SimpleNetStartConnecting ( unsigned channel, - const wchar addr[], + const wchar_t addr[], FSimpleNetOnConnect onConnect, void * param ); diff --git a/Sources/Plasma/NucleusLib/pnSqlLib/Private/pnSqlConn.cpp b/Sources/Plasma/NucleusLib/pnSqlLib/Private/pnSqlConn.cpp index 046e3c50..164bcfa1 100644 --- a/Sources/Plasma/NucleusLib/pnSqlLib/Private/pnSqlConn.cpp +++ b/Sources/Plasma/NucleusLib/pnSqlLib/Private/pnSqlConn.cpp @@ -74,7 +74,7 @@ struct SqlStmtHash { SqlStmtHash (); SqlStmtHash (FSqlBindPrepare prepare); - dword GetHash () const; + uint32_t GetHash () const; bool operator== (const SqlStmtHash & rhs) const; }; @@ -97,13 +97,13 @@ struct SqlStmt : SqlStmtHash { void * errHandlerParam; unsigned sequence; unsigned timeoutSecs; - byte * data; - wchar debug[128]; + uint8_t * data; + wchar_t debug[128]; SqlStmt (SqlConn * conn); ~SqlStmt (); SqlStmt & operator= (const SqlStmt &); // not impl. - bool Initialize (const wchar connectStr[]); + bool Initialize (const wchar_t connectStr[]); void Reset (); bool QueryDead (unsigned method); }; @@ -121,7 +121,7 @@ struct SqlConn { unsigned sequence; unsigned timeoutSecs; AsyncThreadTaskList * taskList; - wchar * connectStr; + wchar_t * connectStr; LISTDECL( SqlStmt, @@ -135,7 +135,7 @@ struct SqlConn { ) freeStmts; SqlConn ( - const wchar connectStr[], + const wchar_t connectStr[], SQLHENV henv ); ~SqlConn (); @@ -202,8 +202,8 @@ static void LogErr ( int result, SQLSMALLINT handleType, SQLHANDLE handle, - const wchar function[], - const wchar command[] + const wchar_t function[], + const wchar_t command[] ) { if (SQL_SUCCEEDED(result) && result != SQL_SUCCESS_WITH_INFO) return; @@ -243,7 +243,7 @@ static void LogErr ( static void LogStmtError ( int result, SqlStmt * stmt, - const wchar function[] + const wchar_t function[] ) { if (result == SQL_SUCCESS) return; @@ -315,8 +315,8 @@ inline SqlStmtHash::SqlStmtHash (FSqlBindPrepare prepare) {} //============================================================================ -inline dword SqlStmtHash::GetHash () const { - return (dword) prepare; +inline uint32_t SqlStmtHash::GetHash () const { + return (uint32_t) prepare; } //============================================================================ @@ -385,7 +385,7 @@ SqlStmt::~SqlStmt () { } //============================================================================ -bool SqlStmt::Initialize (const wchar connectStr[]) { +bool SqlStmt::Initialize (const wchar_t connectStr[]) { ASSERT(!hdbc); for (;;) { @@ -513,7 +513,7 @@ void SqlStmt::Reset () { } #endif // ORACLE_FREE_DRIVER - FREE(data); + free(data); data = nil; debug[0] = 0; } @@ -544,7 +544,7 @@ bool SqlStmt::QueryDead (unsigned method) { //============================================================================ SqlConn::SqlConn ( - const wchar connectStr[], + const wchar_t connectStr[], SQLHENV henv ) : henv(henv) , flags(0) @@ -562,7 +562,7 @@ SqlConn::SqlConn ( SqlConn::~SqlConn () { ASSERT(!freeStmts.Head()); ASSERT(!stmts.Head()); - DEL(connectStr); + delete connectStr; SQLFreeHandle(SQL_HANDLE_ENV, henv); AsyncThreadTaskListDestroy(taskList, kNetErrRemoteShutdown); AtomicAdd(&s_perf[kSqlConnPerfConnDesired], - (long) desiredConns); @@ -587,7 +587,7 @@ bool SqlConn::GrowConnections_CS (unsigned attempts) { break; // Leave the critical section to perform connection - SqlStmt * stmt = NEW(SqlStmt)(this); + SqlStmt * stmt = new SqlStmt(this); // Ensure that the connection string is valid // for the duration of the initialization by @@ -598,7 +598,7 @@ bool SqlConn::GrowConnections_CS (unsigned attempts) { // If the connection failed then bail if (!result) { - DEL(stmt); + delete stmt; return false; } @@ -695,7 +695,7 @@ void SqlConn::CheckDead_CS () { // Deallocate the statement if it's bogus if (dead) { - DEL(stmt); + delete stmt; AsyncGrowConnections_CS(); } else { @@ -751,7 +751,7 @@ void SqlConn::AsyncCheckDead_CS () { //============================================================================ SqlConn * SqlConnCreate ( - const wchar connectStr[], + const wchar_t connectStr[], unsigned maxConnections, unsigned transTimeoutSeconds ) { @@ -789,7 +789,7 @@ SqlConn * SqlConnCreate ( LogErr(result, SQL_HANDLE_ENV, henv, L"SQLSetEnvAttr(version)", L""); // Allocate a connection record - SqlConn * conn = NEW(SqlConn)(connectStr, henv); + SqlConn * conn = new SqlConn(connectStr, henv); // Update configuration options conn->critsect.Enter(); @@ -846,7 +846,7 @@ void SqlConnDestroy (SqlConn * conn) { break; } - DEL(conn); + delete conn; } //============================================================================ @@ -873,11 +873,11 @@ void SqlConnFreeStmt (SqlStmt * stmt) { conn->critsect.Enter(); { if (stmt->flags & kStmtFlagDelete) { - DEL(stmt); + delete stmt; conn->AsyncGrowConnections_CS(); } else if (dead) { - DEL(stmt); + delete stmt; conn->AsyncCheckDead_CS(); } else { @@ -915,7 +915,7 @@ SqlStmt * SqlConnAllocStmt (SqlConn * conn) { SqlStmt * SqlConnAllocStmt ( SqlConn * conn, FSqlBindPrepare prepare, - byte ** bindData // [OUT] + uint8_t ** bindData // [OUT] ) { ASSERT(prepare || !bindData); if (!conn) @@ -1026,7 +1026,7 @@ SqlStmt * SqlConnAllocStmt ( } if (prepare) { - ARRAY(byte) data; + ARRAY(uint8_t) data; prepare(stmt, &data); stmt->prepare = prepare; stmt->data = data.Detach(); @@ -1289,13 +1289,13 @@ void SqlConnBindParameterStringA ( //============================================================================ int SqlConnExecDirect ( SqlStmt * stmt, - const wchar string[] + const wchar_t string[] ) { #ifdef LOG_SQL_STMTS LogMsg(kLogDebug, L"SQL: %s", string); #endif StrCopy(stmt->debug, string, arrsize(stmt->debug)); - int result = SQLExecDirectW(stmt->hstmt, const_cast(string), SQL_NTS); + int result = SQLExecDirectW(stmt->hstmt, const_cast(string), SQL_NTS); LogStmtError(result, stmt, L"SqlExecute"); return result; } @@ -1303,7 +1303,7 @@ int SqlConnExecDirect ( //============================================================================ int SqlConnPrepare ( SqlStmt * stmt, - const wchar string[] + const wchar_t string[] ) { // Using {call ...} or {?= call ...} with SqlPrepare doesn't allow // the ODBC expression parser to perform escape sequence fixup for @@ -1314,7 +1314,7 @@ int SqlConnPrepare ( #endif StrCopy(stmt->debug, string, arrsize(stmt->debug)); - int result = SQLPrepareW(stmt->hstmt, const_cast(string), SQL_NTS); + int result = SQLPrepareW(stmt->hstmt, const_cast(string), SQL_NTS); LogStmtError(result, stmt, L"SqlPrepare"); return result; } diff --git a/Sources/Plasma/NucleusLib/pnSqlLib/Private/pnSqlConn.h b/Sources/Plasma/NucleusLib/pnSqlLib/Private/pnSqlConn.h index 2aa98a12..30cd78bb 100644 --- a/Sources/Plasma/NucleusLib/pnSqlLib/Private/pnSqlConn.h +++ b/Sources/Plasma/NucleusLib/pnSqlLib/Private/pnSqlConn.h @@ -63,7 +63,7 @@ struct SqlTrans; typedef void (* FSqlBindPrepare)( SqlStmt * stmt, - ARRAY(byte) * bindData + ARRAY(uint8_t) * bindData ); @@ -74,7 +74,7 @@ typedef void (* FSqlBindPrepare)( ***/ SqlConn * SqlConnCreate ( - const wchar connectStr[], + const wchar_t connectStr[], unsigned maxConnections, unsigned transTimeoutMs ); @@ -120,7 +120,7 @@ void SqlStmtSetAttr ( SqlStmt * SqlConnAllocStmt ( SqlConn * conn, FSqlBindPrepare prepare, - byte ** bindData // [OUT] + uint8_t ** bindData // [OUT] ); @@ -132,8 +132,8 @@ SqlStmt * SqlConnAllocStmt ( typedef void (* FSqlConnErrorHandler)( int result, - const wchar function[], - const wchar command[], + const wchar_t function[], + const wchar_t command[], const char diagnostics[], // double-null terminated void * userParam ); @@ -238,11 +238,11 @@ void SqlConnBindParameterStringA ( int SqlConnExecDirect ( SqlStmt * stmt, - const wchar string[] + const wchar_t string[] ); int SqlConnPrepare ( SqlStmt * stmt, - const wchar string[] + const wchar_t string[] ); int SqlConnExecute ( SqlStmt * stmt diff --git a/Sources/Plasma/NucleusLib/pnSqlLib/Private/pnSqlUtil.cpp b/Sources/Plasma/NucleusLib/pnSqlLib/Private/pnSqlUtil.cpp index 1e4b52c7..56ea468a 100644 --- a/Sources/Plasma/NucleusLib/pnSqlLib/Private/pnSqlUtil.cpp +++ b/Sources/Plasma/NucleusLib/pnSqlLib/Private/pnSqlUtil.cpp @@ -105,7 +105,7 @@ void SqlConnBindParameterBigInt ( inputOutputType, SQL_C_SBIGINT, SQL_BIGINT, - sizeof(qword), + sizeof(uint64_t), 0, parameterValuePtr, 0, @@ -117,7 +117,7 @@ void SqlConnBindParameterBigInt ( bool SqlConnGetBlobData ( SqlStmt * stmt, unsigned colIndex, - ARRAY(byte) * buffer, + ARRAY(uint8_t) * buffer, unsigned * bytesAdded ) { // Since a number of routines use this function, set the chunk size to be @@ -184,12 +184,12 @@ bool SqlConnGetBlobData ( int SqlConnPutBlobData ( SqlStmt * stmt, unsigned bytes, - const byte data[] + const uint8_t data[] ) { int result; SQLPOINTER putPtr; while (SQL_NEED_DATA == (result = SqlConnParamData(stmt, &putPtr))) { - if (!SqlConnPutData(stmt, const_cast(data), bytes)) + if (!SqlConnPutData(stmt, const_cast(data), bytes)) return SQL_ERROR; } return result; diff --git a/Sources/Plasma/NucleusLib/pnSqlLib/Private/pnSqlUtil.h b/Sources/Plasma/NucleusLib/pnSqlLib/Private/pnSqlUtil.h index 65095e62..09052018 100644 --- a/Sources/Plasma/NucleusLib/pnSqlLib/Private/pnSqlUtil.h +++ b/Sources/Plasma/NucleusLib/pnSqlLib/Private/pnSqlUtil.h @@ -76,11 +76,11 @@ void SqlConnBindParameterBigInt ( bool SqlConnGetBlobData ( SqlStmt * stmt, unsigned colIndex, - ARRAY(byte) * buffer, + ARRAY(uint8_t) * buffer, unsigned * bytesAdded ); int SqlConnPutBlobData ( SqlStmt * stmt, unsigned bytes, - const byte data[] + const uint8_t data[] ); diff --git a/Sources/Plasma/NucleusLib/pnTimer/hsTimer.cpp b/Sources/Plasma/NucleusLib/pnTimer/hsTimer.cpp index ead7aad1..7a5ef2a8 100644 --- a/Sources/Plasma/NucleusLib/pnTimer/hsTimer.cpp +++ b/Sources/Plasma/NucleusLib/pnTimer/hsTimer.cpp @@ -40,7 +40,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ #include "hsTimer.h" -#include "hsUtils.h" +#include "HeadSpin.h" #include "plTweak.h" @@ -85,8 +85,8 @@ hsWide plTimerShare::DSecondsToRawTicks(double secs) double ticks = secs * hsTimer::GetRawBase().AsDouble(); double hi = ticks / double(65536) / double(65536); ticks -= hi; - retVal.fHi = Int32(hi); - retVal.fLo = Int32(ticks); + retVal.fHi = int32_t(hi); + retVal.fLo = int32_t(ticks); return retVal; } @@ -123,7 +123,7 @@ double plTimerShare::IncSysSeconds() else if( fSmoothingClampSecs >= 0 ) { double t = GetSeconds(); - hsScalar delSys = hsScalar(t - fRealSeconds); + float delSys = float(t - fRealSeconds); fClamping = ( (fTimeClampSecs > 0) && (delSys > fTimeClampSecs) ); if (fClamping) { @@ -132,8 +132,8 @@ double plTimerShare::IncSysSeconds() delSys *= fSysTimeScale; if( fDelSysSeconds > 0 && fDelSysSeconds < fSmoothingClampSecs ) { - const hsScalar kFrac = 0.1f; - const hsScalar kOneMinusFrac = 1.f-kFrac; + const float kFrac = 0.1f; + const float kOneMinusFrac = 1.f-kFrac; delSys *= kFrac; delSys += fDelSysSeconds * kOneMinusFrac; } @@ -146,7 +146,7 @@ double plTimerShare::IncSysSeconds() { fRealSeconds = t; t = GetSeconds(); - delSys = hsScalar(t - fRealSeconds); + delSys = float(t - fRealSeconds); count--; } #endif @@ -182,12 +182,12 @@ double plTimerShare::IncSysSeconds() } avg /= double(kSmoothBuffUsed); - plCONST(hsScalar) kMaxSmoothable(0.15f); - fDelSysSeconds = hsScalar(avg - fRealSeconds) * fSysTimeScale; + plCONST(float) kMaxSmoothable(0.15f); + fDelSysSeconds = float(avg - fRealSeconds) * fSysTimeScale; if( fDelSysSeconds > kMaxSmoothable * fSysTimeScale ) { avg = t; - fDelSysSeconds = hsScalar(avg - fRealSeconds) * fSysTimeScale; + fDelSysSeconds = float(avg - fRealSeconds) * fSysTimeScale; fResetSmooth = true; } fSysSeconds += fDelSysSeconds; @@ -207,8 +207,6 @@ void plTimerShare::SetRealTime(hsBool realTime) #if HS_BUILD_FOR_WIN32 -#include - hsWide* plTimerShare::GetRawTicks(hsWide* ticks) const { LARGE_INTEGER large; @@ -242,7 +240,7 @@ hsWide hsTimer::IInitRawBase() #include #define kMicroSecondsUnit 1000000 -static UInt32 gBaseTime = 0; +static uint32_t gBaseTime = 0; hsWide* plTimerShare::GetRawTicks(hsWide* ticks) const { @@ -300,7 +298,7 @@ double hsTimer::GetPrecTicksPerSec() return 1; } -UInt32 hsTimer::GetPrecTickCount() +uint32_t hsTimer::GetPrecTickCount() { #if HS_BUILD_FOR_WIN32 LARGE_INTEGER ti; @@ -312,20 +310,20 @@ UInt32 hsTimer::GetPrecTickCount() return 1; #endif } -UInt32 hsTimer::PrecSecsToTicks(hsScalar secs) +uint32_t hsTimer::PrecSecsToTicks(float secs) { - return (UInt32)(((double)secs) * fPrecTicksPerSec); + return (uint32_t)(((double)secs) * fPrecTicksPerSec); } -double hsTimer::PrecTicksToSecs(UInt32 ticks) +double hsTimer::PrecTicksToSecs(uint32_t ticks) { return ((double)ticks) / fPrecTicksPerSec; } -double hsTimer::PrecTicksToHz(UInt32 ticks) +double hsTimer::PrecTicksToHz(uint32_t ticks) { return fPrecTicksPerSec / ((double)ticks); } -UInt64 hsTimer::GetFullTickCount() +uint64_t hsTimer::GetFullTickCount() { #if HS_BUILD_FOR_WIN32 LARGE_INTEGER ticks; @@ -336,10 +334,10 @@ UInt64 hsTimer::GetFullTickCount() #endif } -float hsTimer::FullTicksToMs(UInt64 ticks) +float hsTimer::FullTicksToMs(uint64_t ticks) { #ifdef HS_BUILD_FOR_WIN32 - static UInt64 ticksPerTenthMs = 0; + static uint64_t ticksPerTenthMs = 0; if (ticksPerTenthMs == 0) { diff --git a/Sources/Plasma/NucleusLib/pnTimer/plTimedValue.cpp b/Sources/Plasma/NucleusLib/pnTimer/plTimedValue.cpp index de052e56..fc025078 100644 --- a/Sources/Plasma/NucleusLib/pnTimer/plTimedValue.cpp +++ b/Sources/Plasma/NucleusLib/pnTimer/plTimedValue.cpp @@ -41,7 +41,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "hsTimer.h" #include "plTimedValue.h" diff --git a/Sources/Plasma/NucleusLib/pnTimer/plTimedValue.h b/Sources/Plasma/NucleusLib/pnTimer/plTimedValue.h index c55a32c3..fff0a67a 100644 --- a/Sources/Plasma/NucleusLib/pnTimer/plTimedValue.h +++ b/Sources/Plasma/NucleusLib/pnTimer/plTimedValue.h @@ -57,7 +57,7 @@ protected: T fGoal; T fInit; double fStart; - hsScalar fInvSecs; + float fInvSecs; public: plTimedValue() {} @@ -67,7 +67,7 @@ public: plTimedValue& operator=(const plTimedValue& o) { return Set(o, 0.f); } plTimedValue& operator=(const T& v) { return Set(v, 0.f); } - plTimedValue& Set(const T& v, hsScalar secs=0); + plTimedValue& Set(const T& v, float secs=0); operator T () const { return Value(); } @@ -83,7 +83,7 @@ public: plTimedSimple& operator=(const plTimedValue& o) { return Set(o, 0.f); } plTimedSimple& operator=(const T& v) { return Set(v, 0.f); } - plTimedSimple& Set(const T& v, hsScalar secs=0) { plTimedValue::Set(v, secs); return *this; } + plTimedSimple& Set(const T& v, float secs=0) { plTimedValue::Set(v, secs); return *this; } void Read(hsStream* s); void Write(hsStream* s) const; @@ -97,14 +97,14 @@ public: plTimedCompound& operator=(const plTimedValue& o) { return Set(o, 0.f); } plTimedCompound& operator=(const T& v) { return Set(v, 0.f); } - plTimedCompound& Set(const T& v, hsScalar secs=0) { plTimedValue::Set(v, secs); return *this; } + plTimedCompound& Set(const T& v, float secs=0) { plTimedValue::Set(v, secs); return *this; } void Read(hsStream* s); void Write(hsStream* s) const; }; template -plTimedValue& plTimedValue::Set(const T& v, hsScalar secs) +plTimedValue& plTimedValue::Set(const T& v, float secs) { if( secs <= 0 ) { @@ -126,7 +126,7 @@ T plTimedValue::Value() const { if( fInvSecs > 0 ) { - hsScalar t = (hsScalar)((hsTimer::GetSysSeconds() - fStart) * fInvSecs); + float t = (float)((hsTimer::GetSysSeconds() - fStart) * fInvSecs); hsAssert(t >= 0, "Moving back in time"); if( t < 1.f ) diff --git a/Sources/Plasma/NucleusLib/pnTimer/plTimerCallbackManager.cpp b/Sources/Plasma/NucleusLib/pnTimer/plTimerCallbackManager.cpp index 2392391f..39d9019e 100644 --- a/Sources/Plasma/NucleusLib/pnTimer/plTimerCallbackManager.cpp +++ b/Sources/Plasma/NucleusLib/pnTimer/plTimerCallbackManager.cpp @@ -40,7 +40,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "plTimerCallbackManager.h" #include "pnMessage/plTimeMsg.h" #include "plgDispatch.h" @@ -82,9 +82,9 @@ hsBool plTimerCallbackManager::MsgReceive(plMessage* msg) return hsKeyedObject::MsgReceive(msg); } -plTimerCallback* plTimerCallbackManager::NewTimer(hsScalar time, plMessage* pMsg) +plTimerCallback* plTimerCallbackManager::NewTimer(float time, plMessage* pMsg) { - plTimerCallback* t = TRACKED_NEW plTimerCallback( hsTimer::GetSysSeconds() + time, pMsg ); + plTimerCallback* t = new plTimerCallback( hsTimer::GetSysSeconds() + time, pMsg ); fCallbacks.Append(t); // sort them for (int i = 0; i < fCallbacks.Count(); i++) @@ -92,8 +92,8 @@ plTimerCallback* plTimerCallbackManager::NewTimer(hsScalar time, plMessage* pMsg for (int j = i + 1; j < fCallbacks.Count(); j++) { #if 0 - hsScalar a = fCallbacks[i]->fTime; - hsScalar b = fCallbacks[j]->fTime; + float a = fCallbacks[i]->fTime; + float b = fCallbacks[j]->fTime; #endif if (fCallbacks[i]->fTime < fCallbacks[j]->fTime) { @@ -176,7 +176,7 @@ plTimerCallbackManager* plgTimerCallbackMgr::fMgr = nil; void plgTimerCallbackMgr::Init() { - fMgr = TRACKED_NEW plTimerCallbackManager; + fMgr = new plTimerCallbackManager; fMgr->RegisterAs( kTimerCallbackManager_KEY ); // fixedKey from plFixedKey.h plgDispatch::Dispatch()->RegisterForExactType( plTimeMsg::Index(), fMgr->GetKey() ); } diff --git a/Sources/Plasma/NucleusLib/pnTimer/plTimerCallbackManager.h b/Sources/Plasma/NucleusLib/pnTimer/plTimerCallbackManager.h index 468ab1c8..52429caf 100644 --- a/Sources/Plasma/NucleusLib/pnTimer/plTimerCallbackManager.h +++ b/Sources/Plasma/NucleusLib/pnTimer/plTimerCallbackManager.h @@ -42,7 +42,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #ifndef plTimerCallbackManager_Defined #define plTimerCallbackManager_Defined -#include "hsScalar.h" + #include "pnKeyedObject/hsKeyedObject.h" #include "hsTemplates.h" @@ -72,7 +72,7 @@ public: CLASSNAME_REGISTER( plTimerCallbackManager ); GETINTERFACE_ANY( plTimerCallbackManager, hsKeyedObject ); - virtual plTimerCallback* NewTimer(hsScalar time, plMessage* pMsg); + virtual plTimerCallback* NewTimer(float time, plMessage* pMsg); hsBool CancelCallback(plTimerCallback* pTimer); hsBool CancelCallbacksToKey(const plKey& key); @@ -100,7 +100,7 @@ public: // External modifier use only static void SetTheTimerCallbackMgr(plTimerCallbackManager *mgr) { fMgr = mgr; } - static plTimerCallback* NewTimer(hsScalar time, plMessage* pMsg) { return (fMgr->NewTimer(time, pMsg)); } + static plTimerCallback* NewTimer(float time, plMessage* pMsg) { return (fMgr->NewTimer(time, pMsg)); } static hsBool CancelCallback(plTimerCallback* pTimer); static hsBool CancelCallbacksToKey(const plKey& key); }; diff --git a/Sources/Plasma/NucleusLib/pnTimer/pnBuildDates.cpp b/Sources/Plasma/NucleusLib/pnTimer/pnBuildDates.cpp index a5af5d3d..9289219a 100644 --- a/Sources/Plasma/NucleusLib/pnTimer/pnBuildDates.cpp +++ b/Sources/Plasma/NucleusLib/pnTimer/pnBuildDates.cpp @@ -51,7 +51,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // // ////////////////////////////////////////////////////////////////////////////// -#include "hsWindows.h" +#include "HeadSpin.h" #include "pnTimer/pnBuildDates.h" char pnBuildDates::fBuildDate[ 128 ] = __DATE__; diff --git a/Sources/Plasma/NucleusLib/pnUUID/pnUUID.h b/Sources/Plasma/NucleusLib/pnUUID/pnUUID.h index 4a580b0c..48afd3be 100644 --- a/Sources/Plasma/NucleusLib/pnUUID/pnUUID.h +++ b/Sources/Plasma/NucleusLib/pnUUID/pnUUID.h @@ -42,7 +42,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #ifndef pnUUID_h_inc #define pnUUID_h_inc -#include "hsTypes.h" +#include "HeadSpin.h" #include "hsStlUtils.h" #ifdef HS_BUILD_FOR_WIN32 #include "pnUtils/pnUtils.h" @@ -54,7 +54,7 @@ class plUUID { // must be first field in class public: - UInt8 fData[16]; + uint8_t fData[16]; struct Match { const plUUID * fGuid; diff --git a/Sources/Plasma/NucleusLib/pnUUID/pnUUID_Win32.cpp b/Sources/Plasma/NucleusLib/pnUUID/pnUUID_Win32.cpp index dce63a21..6cd665c4 100644 --- a/Sources/Plasma/NucleusLib/pnUUID/pnUUID_Win32.cpp +++ b/Sources/Plasma/NucleusLib/pnUUID/pnUUID_Win32.cpp @@ -43,15 +43,13 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #ifdef HS_BUILD_FOR_WIN32 -#include "hsUtils.h" -#include "hsWindows.h" -#include -COMPILER_ASSERT(msizeof(Uuid, data) == msizeof(plUUID, fData)); + +#include plUUID::plUUID( const Uuid & uuid ) { - MemCopy(fData, uuid.data, sizeof(fData)); + memcpy(fData, uuid.data, sizeof(fData)); } void plUUID::Clear() @@ -84,12 +82,12 @@ void plUUID::CopyFrom( const plUUID * v ) { } void plUUID::CopyFrom( const plUUID & v ) { - MemCopy(fData, v.fData, sizeof(fData)); + memcpy(fData, v.fData, sizeof(fData)); } plUUID::operator Uuid () const { Uuid uuid; - MemCopy(uuid.data, fData, sizeof(uuid.data)); + memcpy(uuid.data, fData, sizeof(uuid.data)); return uuid; } diff --git a/Sources/Plasma/NucleusLib/pnUtils/Intern.h b/Sources/Plasma/NucleusLib/pnUtils/Intern.h index f398c879..5c93109e 100644 --- a/Sources/Plasma/NucleusLib/pnUtils/Intern.h +++ b/Sources/Plasma/NucleusLib/pnUtils/Intern.h @@ -63,7 +63,7 @@ namespace Crypt { //============================================================================ class KeyBase { public: - virtual void Codec (bool encrypt, ARRAY(byte) * dest, unsigned sourceBytes, const void * sourceData) = 0; + virtual void Codec (bool encrypt, ARRAY(uint8_t) * dest, unsigned sourceBytes, const void * sourceData) = 0; virtual unsigned GetBlockSize () const = 0; }; diff --git a/Sources/Plasma/NucleusLib/pnUtils/Private/Win32/pnUtW32Addr.cpp b/Sources/Plasma/NucleusLib/pnUtils/Private/Win32/pnUtW32Addr.cpp index b04a5271..4e7c8545 100644 --- a/Sources/Plasma/NucleusLib/pnUtils/Private/Win32/pnUtW32Addr.cpp +++ b/Sources/Plasma/NucleusLib/pnUtils/Private/Win32/pnUtW32Addr.cpp @@ -55,7 +55,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com * ***/ -// hardcoded byte ordering -- Intel only +// hardcoded uint8_t ordering -- Intel only #ifdef _M_IX86 const unsigned kHostClassALoopbackAddr = 0x7f000001; // 127.0.0.1 @@ -136,17 +136,17 @@ static int NetAddressNodeSortValueHostOrder (NetAddressNode addr) { } //=========================================================================== -static NetAddressNode NodeFromString (const wchar * string[]) { +static NetAddressNode NodeFromString (const wchar_t * string[]) { // skip leading whitespace - const wchar * str = *string; + const wchar_t * str = *string; while (iswspace(*str)) ++str; // This function handles partial ip addresses (61.33) // as well as full dotted quads. The address can be // terminated by whitespace or ':' as well as '\0' - byte data[4]; - * (dword *) data = 0; + uint8_t data[4]; + * (uint32_t *) data = 0; for (unsigned i = sizeof(data); i--; ) { if (!iswdigit(*str)) return (unsigned)-1; @@ -154,12 +154,12 @@ static NetAddressNode NodeFromString (const wchar * string[]) { unsigned value = StrToUnsigned(str, &str, 10); if (value >= 256) return (unsigned)-1; - data[i] = (byte) value; + data[i] = (uint8_t) value; if (!*str || (*str == ':') || iswspace(*str)) break; - static const wchar s_separator[] = L"\0..."; + static const wchar_t s_separator[] = L"\0..."; if (*str++ != s_separator[i]) return (unsigned)-1; } @@ -202,13 +202,13 @@ unsigned NetAddressHash (const NetAddress & addr) { //=========================================================================== void NetAddressToString ( const NetAddress & addr, - wchar * str, + wchar_t * str, unsigned chars, ENetAddressFormat format ) { ASSERT(str); - static const wchar * s_fmts[] = { + static const wchar_t * s_fmts[] = { L"%S", // kNetAddressFormatNodeNumber L"%S:%u", // kNetAddressFormatAll }; @@ -224,12 +224,12 @@ void NetAddressToString ( } //=========================================================================== -bool NetAddressFromString (NetAddress * addr, const wchar str[], unsigned defaultPort) { +bool NetAddressFromString (NetAddress * addr, const wchar_t str[], unsigned defaultPort) { ASSERT(addr); ASSERT(str); // NetAddress is bigger than sockaddr_in so start by zeroing the whole thing - ZEROPTR(addr); + memset(addr, 0, sizeof(*addr)); for (;;) { NetAddressNode node = NodeFromString(&str); @@ -241,7 +241,7 @@ bool NetAddressFromString (NetAddress * addr, const wchar str[], unsigned defaul sockaddr_in * inetaddr = (sockaddr_in *) addr; inetaddr->sin_family = AF_INET; - inetaddr->sin_port = htons((word) defaultPort); + inetaddr->sin_port = htons((uint16_t) defaultPort); inetaddr->sin_addr.S_un.S_addr = htonl(node); // inetaddr->sin_zero already zeroed @@ -264,7 +264,7 @@ void NetAddressSetPort ( unsigned port, NetAddress * addr ) { - ((sockaddr_in *) addr)->sin_port = htons((word) port); + ((sockaddr_in *) addr)->sin_port = htons((uint16_t) port); } //============================================================================ @@ -278,17 +278,17 @@ void NetAddressFromNode ( unsigned port, NetAddress * addr ) { - ZEROPTR(addr); + memset(addr, 0, sizeof(*addr)); sockaddr_in * inetaddr = (sockaddr_in *) addr; inetaddr->sin_family = AF_INET; inetaddr->sin_addr.S_un.S_addr = htonl(node); - inetaddr->sin_port = htons((word) port); + inetaddr->sin_port = htons((uint16_t) port); } //=========================================================================== void NetAddressNodeToString ( NetAddressNode node, - wchar * str, + wchar_t * str, unsigned chars ) { in_addr addr; @@ -298,8 +298,8 @@ void NetAddressNodeToString ( //=========================================================================== NetAddressNode NetAddressNodeFromString ( - const wchar string[], - const wchar * endPtr[] + const wchar_t string[], + const wchar_t * endPtr[] ) { if (!endPtr) endPtr = &string; @@ -341,12 +341,12 @@ unsigned NetAddressGetLocal ( host = gethostbyname(host->h_name); if (!host) break; - if (host->h_length != sizeof(dword)) + if (host->h_length != sizeof(uint32_t)) break; // Count total number of addresses unsigned found = 0; - const dword ** addr = (const dword **) host->h_addr_list; + const uint32_t ** addr = (const uint32_t **) host->h_addr_list; for (; *addr; ++addr) ++found; if (!found) @@ -355,12 +355,12 @@ unsigned NetAddressGetLocal ( // Create a buffer to sort the addresses NetAddressNode * dst; if (found > count) - dst = ALLOCA(NetAddressNode, found); + dst = (NetAddressNode*)_alloca(found * sizeof(NetAddressNode)); else dst = addresses; // Fill address buffer - const dword * src = * (const dword **) host->h_addr_list; + const uint32_t * src = * (const uint32_t **) host->h_addr_list; for (unsigned index = 0; index < found; ++index) dst[index] = ntohl(src[index]); diff --git a/Sources/Plasma/NucleusLib/pnUtils/Private/Win32/pnUtW32Misc.cpp b/Sources/Plasma/NucleusLib/pnUtils/Private/Win32/pnUtW32Misc.cpp index 13a31c02..841fc7cf 100644 --- a/Sources/Plasma/NucleusLib/pnUtils/Private/Win32/pnUtW32Misc.cpp +++ b/Sources/Plasma/NucleusLib/pnUtils/Private/Win32/pnUtW32Misc.cpp @@ -62,12 +62,12 @@ static MEMORYSTATUSEX s_memstatus; ***/ //============================================================================ -const wchar * AppGetCommandLine () { +const wchar_t * AppGetCommandLine () { return GetCommandLineW(); } //============================================================================ -void MachineGetName (wchar *computerName, unsigned int length) { +void MachineGetName (wchar_t *computerName, unsigned int length) { DWORD len = length; GetComputerNameW(computerName, &len); } @@ -84,7 +84,7 @@ void MemoryGetStatus (MemoryStatus * status) { mem.dwLength = sizeof(mem); GlobalMemoryStatusEx(&mem); - const qword BYTES_PER_MB = 1024 * 1024; + const uint64_t BYTES_PER_MB = 1024 * 1024; status->totalPhysMB = unsigned(mem.ullTotalPhys / BYTES_PER_MB); status->availPhysMB = unsigned(mem.ullAvailPhys / BYTES_PER_MB); status->totalPageFileMB = unsigned(mem.ullTotalPageFile / BYTES_PER_MB); @@ -96,48 +96,50 @@ void MemoryGetStatus (MemoryStatus * status) { //============================================================================ void DiskGetStatus (ARRAY(DiskStatus) * disks) { - for (;;) { - DWORD length = GetLogicalDriveStrings(0, NULL); - if (!length || length > 2048) - break; - - wchar * buffer = ALLOCA(wchar, length + 1); - if (!GetLogicalDriveStringsW(length, buffer)) - break; - - for (; *buffer; buffer += StrLen(buffer) + 1) { - UINT driveType = GetDriveTypeW(buffer); - if (driveType != DRIVE_FIXED) - continue; - - ULARGE_INTEGER freeBytes; - ULARGE_INTEGER totalBytes; - if (!GetDiskFreeSpaceExW(buffer, &freeBytes, &totalBytes, NULL)) - continue; - - DiskStatus status; - StrCopy(status.name, buffer, arrsize(status.name)); - - const qword BYTES_PER_MB = 1024 * 1024; - status.totalSpaceMB = unsigned(totalBytes.QuadPart / BYTES_PER_MB); - status.freeSpaceMB = unsigned(freeBytes.QuadPart / BYTES_PER_MB); - - disks->Add(status); - } - break; + DWORD length = GetLogicalDriveStrings(0, NULL); + if (!length || length > 2048) + return; + + wchar_t* buffer = (wchar_t*)malloc((length + 1) * sizeof(wchar_t)); + wchar_t* origbuf = buffer; + if (!GetLogicalDriveStringsW(length, buffer)) + { + free(buffer); + return; } + + for (; *buffer; buffer += StrLen(buffer) + 1) { + UINT driveType = GetDriveTypeW(buffer); + if (driveType != DRIVE_FIXED) + continue; + + ULARGE_INTEGER freeBytes; + ULARGE_INTEGER totalBytes; + if (!GetDiskFreeSpaceExW(buffer, &freeBytes, &totalBytes, NULL)) + continue; + + DiskStatus status; + StrCopy(status.name, buffer, arrsize(status.name)); + + const uint64_t BYTES_PER_MB = 1024 * 1024; + status.totalSpaceMB = unsigned(totalBytes.QuadPart / BYTES_PER_MB); + status.freeSpaceMB = unsigned(freeBytes.QuadPart / BYTES_PER_MB); + + disks->Add(status); + } + free(origbuf); } //============================================================================ // Loosely taken from MS's cpuid code sample void CpuGetInfo ( - word * cpuCaps, - dword * cpuVendor, - word * cpuSignature + uint16_t * cpuCaps, + uint32_t * cpuVendor, + uint16_t * cpuSignature ) { - dword signature = 0; - dword extended = 0; - dword flags[2] = { 0, 0 }; + uint32_t signature = 0; + uint32_t extended = 0; + uint32_t flags[2] = { 0, 0 }; cpuVendor[0] = 0; _asm { @@ -189,9 +191,9 @@ DONE: // Decode capability flags const static struct CpuCap { - word cpuFlag; - byte field; - byte bit; + uint16_t cpuFlag; + uint8_t field; + uint8_t bit; } s_caps[] = { // feature field bit // ------- ----- --- @@ -212,11 +214,11 @@ DONE: } // Copy signature - *cpuSignature = word(signature & 0xfff); + *cpuSignature = uint16_t(signature & 0xfff); // If this is an AMD CPU, check for 3DNow support const char * vendorAmd = "AuthenticAMD"; - if (!MemCmp(vendorAmd, cpuVendor, 12)) { + if (!memcmp(vendorAmd, cpuVendor, 12)) { if (extended & (1 << 31)) *cpuCaps |= kCpuCap3dNow; } diff --git a/Sources/Plasma/NucleusLib/pnUtils/Private/Win32/pnUtW32Path.cpp b/Sources/Plasma/NucleusLib/pnUtils/Private/Win32/pnUtW32Path.cpp index e9e2106d..b81d199c 100644 --- a/Sources/Plasma/NucleusLib/pnUtils/Private/Win32/pnUtW32Path.cpp +++ b/Sources/Plasma/NucleusLib/pnUtils/Private/Win32/pnUtW32Path.cpp @@ -60,22 +60,22 @@ COMPILER_ASSERT(MAX_PATH >= _MAX_PATH); //=========================================================================== -static inline bool IsSlash (wchar c) { +static inline bool IsSlash (wchar_t c) { return (c == L'\\') || (c == L'/'); } //=========================================================================== -static inline wchar ConvertSlash (wchar c) { +static inline wchar_t ConvertSlash (wchar_t c) { return c != L'/' ? c : L'\\'; } //=========================================================================== -static inline bool IsUncPath (const wchar path[]) { +static inline bool IsUncPath (const wchar_t path[]) { return IsSlash(path[0]) && IsSlash(path[1]); } //=========================================================================== -static const wchar * SkipUncDrive (const wchar path[]) { +static const wchar_t * SkipUncDrive (const wchar_t path[]) { // UNC drive: "//server/share" // skip over leading "//" @@ -102,7 +102,7 @@ static const wchar * SkipUncDrive (const wchar path[]) { } //=========================================================================== -static wchar * PathSkipOverSeparator (wchar * path) { +static wchar_t * PathSkipOverSeparator (wchar_t * path) { for (; *path; ++path) { if (IsSlash(*path)) return path + 1; @@ -113,18 +113,18 @@ static wchar * PathSkipOverSeparator (wchar * path) { //=========================================================================== static unsigned CommonPrefixLength ( - const wchar src1[], - const wchar src2[] + const wchar_t src1[], + const wchar_t src2[] ) { ASSERT(src1); ASSERT(src2); - wchar const * const base = src1; - const wchar * common = nil; + wchar_t const * const base = src1; + const wchar_t * common = nil; for (;;) { // Are the next components equal in length? - const wchar * next1 = PathSkipOverSeparator(const_cast(src1)); - const wchar * next2 = PathSkipOverSeparator(const_cast(src2)); + const wchar_t * next1 = PathSkipOverSeparator(const_cast(src1)); + const wchar_t * next2 = PathSkipOverSeparator(const_cast(src2)); const int componentLen = next1 - src1; if (componentLen != (next2 - src2)) break; @@ -158,7 +158,7 @@ static unsigned CommonPrefixLength ( //=========================================================================== static void GetProgramName ( void * instance, - wchar * dst, + wchar_t * dst, unsigned dstChars ) { ASSERT(dst); @@ -179,7 +179,7 @@ static void GetProgramName ( //=========================================================================== void PathGetModuleName ( - wchar * dst, + wchar_t * dst, unsigned dstChars ) { GetProgramName(ModuleGetInstance(), dst, dstChars); @@ -187,7 +187,7 @@ void PathGetModuleName ( //=========================================================================== void PathGetProgramName ( - wchar * dst, + wchar_t * dst, unsigned dstChars ) { GetProgramName(nil, dst, dstChars); @@ -195,8 +195,8 @@ void PathGetProgramName ( //=========================================================================== bool PathFromString ( - wchar * dst, - const wchar src[], + wchar_t * dst, + const wchar_t src[], unsigned dstChars ) { ASSERT(dst); @@ -205,7 +205,7 @@ bool PathFromString ( for (;;) { // enable src and dst to be the same buffer - wchar temp[MAX_PATH]; + wchar_t temp[MAX_PATH]; if (dst == src) { StrCopy(temp, src, arrsize(temp)); src = temp; @@ -228,16 +228,16 @@ bool PathFromString ( //=========================================================================== bool PathFromString ( - wchar * dst, // ASSERT(dst); - const wchar src[], // ASSERT(src); + wchar_t * dst, // ASSERT(dst); + const wchar_t src[], // ASSERT(src); unsigned dstChars, // ASSERT(dstChars); - const wchar baseDir[] // ASSERT(baseDir); + const wchar_t baseDir[] // ASSERT(baseDir); ) { ASSERT(baseDir); ASSERT(dstChars); // Save current directory - wchar curr[MAX_PATH]; + wchar_t curr[MAX_PATH]; PathGetCurrentDirectory(curr, arrsize(curr)); // Perform string conversion from specified directory @@ -257,11 +257,11 @@ bool PathFromString ( // but has been updated to support UNC paths and to avoid blasting off the end // of the buffers. void PathSplitPath ( - const wchar path[], - wchar * drive, - wchar * dir, - wchar * fname, - wchar * ext + const wchar_t path[], + wchar_t * drive, + wchar_t * dir, + wchar_t * fname, + wchar_t * ext ) { ASSERT(path); ASSERT(path != drive); @@ -271,7 +271,7 @@ void PathSplitPath ( // check for UNC path if (IsUncPath(path)) { - const wchar * pathStart = path; + const wchar_t * pathStart = path; path = SkipUncDrive(path); if (drive) @@ -298,7 +298,7 @@ void PathSplitPath ( // '\' path separator character. If none is found, there is no path. // We will also note the last '.' character found, if any, to aid in // handling the extension. - const wchar *last_slash = nil, *last_dot = nil, *p = path; + const wchar_t *last_slash = nil, *last_dot = nil, *p = path; for (; *p; p++) { if (IsSlash(*p)) last_slash = p + 1; // point to one beyond for later copy @@ -335,12 +335,12 @@ void PathSplitPath ( //=========================================================================== void PathMakePath ( - wchar * path, + wchar_t * path, unsigned chars, - const wchar drive[], - const wchar dir[], - const wchar fname[], - const wchar ext[] + const wchar_t drive[], + const wchar_t dir[], + const wchar_t fname[], + const wchar_t ext[] ) { ASSERT(path); ASSERT(path != drive); @@ -400,11 +400,11 @@ void PathMakePath ( //=========================================================================== bool PathMakeRelative ( - wchar *dst, + wchar_t *dst, unsigned fromFlags, // 0 or kPathFlagDirectory - const wchar from[], + const wchar_t from[], unsigned toFlags, // 0 or kPathFlagDirectory - const wchar to[], + const wchar_t to[], unsigned dstChars ) { ASSERT(dst); @@ -417,26 +417,26 @@ bool PathMakeRelative ( if (!prefixLength) return false; - wchar fromBuf[MAX_PATH]; + wchar_t fromBuf[MAX_PATH]; if (fromFlags & kPathFlagDirectory) StrCopy(fromBuf, from, arrsize(fromBuf)); else PathRemoveFilename(fromBuf, from, arrsize(fromBuf)); - wchar toBuf[MAX_PATH]; + wchar_t toBuf[MAX_PATH]; if (toFlags & kPathFlagDirectory) StrCopy(toBuf, to, arrsize(toBuf)); else PathRemoveFilename(toBuf, to, arrsize(toBuf)); - const wchar * curr = fromBuf + prefixLength; + const wchar_t * curr = fromBuf + prefixLength; if (*curr) { // build ..\.. part of the path if (IsSlash(*curr)) curr++; // skip slash while (*curr) { - curr = PathSkipOverSeparator(const_cast(curr)); + curr = PathSkipOverSeparator(const_cast(curr)); StrPack(dst, *curr ? L"..\\" : L"..", dstChars); } } @@ -458,7 +458,7 @@ bool PathMakeRelative ( //=========================================================================== bool PathIsRelative ( - const wchar src[] + const wchar_t src[] ) { ASSERT(src); if (!src[0]) @@ -471,16 +471,16 @@ bool PathIsRelative ( } //=========================================================================== -const wchar * PathFindFilename ( - const wchar path[] +const wchar_t * PathFindFilename ( + const wchar_t path[] ) { ASSERT(path); if (IsUncPath(path)) path = SkipUncDrive(path); - const wchar * last_slash = path; - for (const wchar * p = path; *p; p++) { + const wchar_t * last_slash = path; + for (const wchar_t * p = path; *p; p++) { if ((*p == L'/') || (*p == L'\\') || (*p == L':')) last_slash = p + 1; } @@ -489,13 +489,13 @@ const wchar * PathFindFilename ( } //=========================================================================== -const wchar * PathFindExtension ( - const wchar path[] +const wchar_t * PathFindExtension ( + const wchar_t path[] ) { ASSERT(path); - const wchar * last_dot = 0; - const wchar * p = PathFindFilename(path); + const wchar_t * last_dot = 0; + const wchar_t * p = PathFindFilename(path); for ( ; *p; p++) { if (*p == L'.') last_dot = p; @@ -506,7 +506,7 @@ const wchar * PathFindExtension ( //=========================================================================== void PathGetCurrentDirectory ( - wchar * dst, + wchar_t * dst, unsigned dstChars ) { ASSERT(dst); @@ -521,7 +521,7 @@ void PathGetCurrentDirectory ( //=========================================================================== void PathGetTempDirectory ( - wchar * dst, + wchar_t * dst, unsigned dstChars ) { ASSERT(dst); @@ -534,13 +534,13 @@ void PathGetTempDirectory ( //============================================================================ void PathGetUserDirectory ( - wchar * dst, + wchar_t * dst, unsigned dstChars ) { ASSERT(dst); ASSERT(dstChars); - wchar temp[MAX_PATH]; // GetSpecialFolder path requires a buffer of MAX_PATH size or larger + wchar_t temp[MAX_PATH]; // GetSpecialFolder path requires a buffer of MAX_PATH size or larger if (SHGetSpecialFolderPathW(NULL, temp, CSIDL_LOCAL_APPDATA, TRUE) == FALSE) StrCopy(temp, L"C:\\", arrsize(temp)); @@ -554,7 +554,7 @@ void PathGetUserDirectory ( //============================================================================ void PathGetLogDirectory ( - wchar * dst, + wchar_t * dst, unsigned dstChars ) { ASSERT(dst); @@ -567,7 +567,7 @@ void PathGetLogDirectory ( //============================================================================ void PathGetInitDirectory ( - wchar * dst, + wchar_t * dst, unsigned dstChars ) { ASSERT(dst); @@ -580,7 +580,7 @@ void PathGetInitDirectory ( //=========================================================================== bool PathSetCurrentDirectory ( - const wchar path[] + const wchar_t path[] ) { ASSERT(path); return SetCurrentDirectoryW(path) != 0; @@ -588,7 +588,7 @@ bool PathSetCurrentDirectory ( //=========================================================================== void PathSetProgramDirectory () { - wchar dir[MAX_PATH]; + wchar_t dir[MAX_PATH]; PathGetProgramDirectory(dir, arrsize(dir)); PathSetCurrentDirectory(dir); } @@ -596,7 +596,7 @@ void PathSetProgramDirectory () { //=========================================================================== void PathFindFiles ( ARRAY(PathFind) * paths, - const wchar fileSpec[], + const wchar_t fileSpec[], unsigned pathFlags ) { ASSERT(paths); @@ -604,7 +604,7 @@ void PathFindFiles ( HANDLE find; WIN32_FIND_DATAW fd; - wchar directory[MAX_PATH]; + wchar_t directory[MAX_PATH]; PathRemoveFilename(directory, fileSpec, arrsize(directory)); if (INVALID_HANDLE_VALUE == (find = FindFirstFileW(fileSpec, &fd))) { DWORD err = GetLastError(); @@ -648,8 +648,8 @@ void PathFindFiles ( // add this one to the list of found files PathFind * pf = paths->New(); pf->flags = fileFlags; - pf->fileLength = ((qword) fd.nFileSizeHigh << 32) | fd.nFileSizeLow; - pf->lastWriteTime = * (const qword *) &fd.ftLastWriteTime; + pf->fileLength = ((uint64_t) fd.nFileSizeHigh << 32) | fd.nFileSizeLow; + pf->lastWriteTime = * (const uint64_t *) &fd.ftLastWriteTime; PathAddFilename(pf->name, directory, fd.cFileName, arrsize(pf->name)); } while (FindNextFileW(find, &fd)); FindClose(find); @@ -663,7 +663,7 @@ void PathFindFiles ( return; } - wchar dirSpec[MAX_PATH]; + wchar_t dirSpec[MAX_PATH]; PathAddFilename(dirSpec, directory, L"*", arrsize(dirSpec)); if (INVALID_HANDLE_VALUE == (find = FindFirstFileW(dirSpec, &fd))) { DWORD err = GetLastError(); @@ -673,7 +673,7 @@ void PathFindFiles ( } // find all the directories in the current directory - const wchar * spec = PathFindFilename(fileSpec); + const wchar_t * spec = PathFindFilename(fileSpec); do { if (! (fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) { continue; @@ -705,17 +705,17 @@ void PathFindFiles ( } //=========================================================================== -EPathCreateDirError PathCreateDirectory (const wchar path[], unsigned flags) { +EPathCreateDirError PathCreateDirectory (const wchar_t path[], unsigned flags) { ASSERT(path); // convert from relative path to full path - wchar dir[MAX_PATH]; + wchar_t dir[MAX_PATH]; if (!PathFromString(dir, path, arrsize(dir))) { return kPathCreateDirErrInvalidPath; } // are we going to build the entire directory tree? - wchar * dirEnd; + wchar_t * dirEnd; if (flags & kPathCreateDirFlagEntireTree) { dirEnd = dir; @@ -732,7 +732,7 @@ EPathCreateDirError PathCreateDirectory (const wchar path[], unsigned flags) { } bool result = true; - for (wchar saveChar = L' '; saveChar; *dirEnd++ = saveChar) { + for (wchar_t saveChar = L' '; saveChar; *dirEnd++ = saveChar) { // find the end of the current directory string and terminate it dirEnd = PathSkipOverSeparator(dirEnd); saveChar = *dirEnd; @@ -773,19 +773,19 @@ EPathCreateDirError PathCreateDirectory (const wchar path[], unsigned flags) { } //=========================================================================== -void PathDeleteDirectory (const wchar path[], unsigned flags) { +void PathDeleteDirectory (const wchar_t path[], unsigned flags) { ASSERT(path); // convert from relative path to full path - wchar dir[MAX_PATH]; + wchar_t dir[MAX_PATH]; if (!PathFromString(dir, path, arrsize(dir))) return; for (;;) { // Important: in order to ensure that we don't delete NTFS // partition links, we must ensure that this is a directory! - dword attributes = GetFileAttributesW(dir); - if (attributes == (dword) -1) + uint32_t attributes = GetFileAttributesW(dir); + if (attributes == (uint32_t) -1) break; if ((attributes & FILE_ATTRIBUTE_DIRECTORY) == 0) break; @@ -798,7 +798,7 @@ void PathDeleteDirectory (const wchar path[], unsigned flags) { if ((flags & kPathCreateDirFlagEntireTree) == 0) break; - wchar * filename = PathFindFilename(dir); + wchar_t * filename = PathFindFilename(dir); if (!filename) break; @@ -813,9 +813,9 @@ void PathDeleteDirectory (const wchar path[], unsigned flags) { } //=========================================================================== -bool PathDoesFileExist (const wchar fileName[]) { - dword attributes = GetFileAttributesW(fileName); - if (attributes == (dword) -1) +bool PathDoesFileExist (const wchar_t fileName[]) { + uint32_t attributes = GetFileAttributesW(fileName); + if (attributes == (uint32_t) -1) return false; if (attributes & FILE_ATTRIBUTE_DIRECTORY) return false; @@ -823,9 +823,9 @@ bool PathDoesFileExist (const wchar fileName[]) { } //============================================================================ -bool PathDoesDirectoryExist (const wchar directory[]) { - dword attributes = GetFileAttributesW(directory); - if (attributes == (dword) -1) +bool PathDoesDirectoryExist (const wchar_t directory[]) { + uint32_t attributes = GetFileAttributesW(directory); + if (attributes == (uint32_t) -1) return false; if (attributes & FILE_ATTRIBUTE_DIRECTORY) return true; @@ -834,23 +834,23 @@ bool PathDoesDirectoryExist (const wchar directory[]) { //=========================================================================== bool PathDeleteFile ( - const wchar file[] + const wchar_t file[] ) { return DeleteFileW(file) != 0; } //=========================================================================== bool PathMoveFile ( - const wchar src[], - const wchar dst[] + const wchar_t src[], + const wchar_t dst[] ) { return MoveFileW(src, dst) != 0; } //=========================================================================== bool PathCopyFile ( - const wchar src[], - const wchar dst[] + const wchar_t src[], + const wchar_t dst[] ) { return CopyFileW(src, dst, FALSE) != 0; } diff --git a/Sources/Plasma/NucleusLib/pnUtils/Private/Win32/pnUtW32Str.cpp b/Sources/Plasma/NucleusLib/pnUtils/Private/Win32/pnUtW32Str.cpp index a0d015b2..b7fc3b76 100644 --- a/Sources/Plasma/NucleusLib/pnUtils/Private/Win32/pnUtW32Str.cpp +++ b/Sources/Plasma/NucleusLib/pnUtils/Private/Win32/pnUtW32Str.cpp @@ -56,12 +56,12 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com ***/ //=========================================================================== -unsigned StrToAnsi (char * dest, const wchar source[], unsigned destChars) { +unsigned StrToAnsi (char * dest, const wchar_t source[], unsigned destChars) { return StrToAnsi(dest, source, destChars, CP_ACP); } //=========================================================================== -unsigned StrToAnsi (char * dest, const wchar source[], unsigned destChars, unsigned codePage) { +unsigned StrToAnsi (char * dest, const wchar_t source[], unsigned destChars, unsigned codePage) { ASSERT(destChars != (unsigned)-1); ASSERT(dest != nil); @@ -77,12 +77,12 @@ unsigned StrToAnsi (char * dest, const wchar source[], unsigned destChars, unsig } //=========================================================================== -unsigned StrToUnicode (wchar * dest, const char source[], unsigned destChars) { +unsigned StrToUnicode (wchar_t * dest, const char source[], unsigned destChars) { return StrToUnicode(dest, source, destChars, CP_ACP); } //=========================================================================== -unsigned StrToUnicode (wchar * dest, const char source[], unsigned destChars, unsigned codePage) { +unsigned StrToUnicode (wchar_t * dest, const char source[], unsigned destChars, unsigned codePage) { ASSERT(destChars != (unsigned)-1); ASSERT(dest != nil); diff --git a/Sources/Plasma/NucleusLib/pnUtils/Private/Win32/pnUtW32Sync.cpp b/Sources/Plasma/NucleusLib/pnUtils/Private/Win32/pnUtW32Sync.cpp index 0a59fac1..17c96136 100644 --- a/Sources/Plasma/NucleusLib/pnUtils/Private/Win32/pnUtW32Sync.cpp +++ b/Sources/Plasma/NucleusLib/pnUtils/Private/Win32/pnUtW32Sync.cpp @@ -166,7 +166,7 @@ CLockWaitSetAllocator::CLockWaitSetAllocator (CLockWaitSetAllocator * prev) { //=========================================================================== CLockWaitSetAllocator::~CLockWaitSetAllocator () { - DEL(m_prev); + delete m_prev; } //=========================================================================== @@ -178,7 +178,7 @@ CLockWaitSet * CLockWaitSetAllocator::Alloc () { if (!s_allocator || !s_allocator->m_spareList.Head()) { if (!s_allocator) atexit(Shutdown); - s_allocator = NEW(CLockWaitSetAllocator)(s_allocator); + s_allocator = new CLockWaitSetAllocator(s_allocator); } // Get an available wait set from the active allocator @@ -207,7 +207,7 @@ void CLockWaitSetAllocator::Shutdown () { // Free all allocators while (s_allocator) { CLockWaitSetAllocator * prev = s_allocator->m_prev; - DEL(s_allocator); + delete s_allocator; s_allocator = prev; } diff --git a/Sources/Plasma/NucleusLib/pnUtils/Private/Win32/pnUtW32Time.cpp b/Sources/Plasma/NucleusLib/pnUtils/Private/Win32/pnUtW32Time.cpp index 2b9e8a87..cd4eea61 100644 --- a/Sources/Plasma/NucleusLib/pnUtils/Private/Win32/pnUtW32Time.cpp +++ b/Sources/Plasma/NucleusLib/pnUtils/Private/Win32/pnUtW32Time.cpp @@ -57,13 +57,13 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com //============================================================================ static void FormatTime ( - qword time, - wchar const dateFmt[], - wchar const timeFmt[], + uint64_t time, + wchar_t const dateFmt[], + wchar_t const timeFmt[], unsigned chars, - wchar * buffer + wchar_t * buffer ) { - COMPILER_ASSERT(sizeof(FILETIME) == sizeof(qword)); + COMPILER_ASSERT(sizeof(FILETIME) == sizeof(uint64_t)); SYSTEMTIME sysTime; FileTimeToSystemTime((FILETIME *)&time, &sysTime); @@ -108,13 +108,13 @@ static void FormatTime ( //=========================================================================== void TimeGetDesc ( - qword time, + uint64_t time, TimeDesc * desc ) { ASSERT(desc); SYSTEMTIME sysTime; - COMPILER_ASSERT(sizeof(qword) == sizeof(FILETIME)); + COMPILER_ASSERT(sizeof(uint64_t) == sizeof(FILETIME)); FileTimeToSystemTime((FILETIME *) &time, &sysTime); desc->year = sysTime.wYear; @@ -127,17 +127,17 @@ void TimeGetDesc ( } //============================================================================ -qword TimeGetTime () { - qword time; - COMPILER_ASSERT(sizeof(qword) == sizeof(FILETIME)); +uint64_t TimeGetTime () { + uint64_t time; + COMPILER_ASSERT(sizeof(uint64_t) == sizeof(FILETIME)); GetSystemTimeAsFileTime((FILETIME *) &time); return time; } //============================================================================ -qword TimeGetLocalTime () { - qword time; - COMPILER_ASSERT(sizeof(qword) == sizeof(FILETIME)); +uint64_t TimeGetLocalTime () { + uint64_t time; + COMPILER_ASSERT(sizeof(uint64_t) == sizeof(FILETIME)); GetSystemTimeAsFileTime((FILETIME *) &time); FileTimeToLocalFileTime((FILETIME *) &time, (FILETIME *) &time); return time; @@ -145,9 +145,9 @@ qword TimeGetLocalTime () { //============================================================================ void TimePrettyPrint ( - qword time, + uint64_t time, unsigned chars, - wchar * buffer + wchar_t * buffer ) { FormatTime( time, diff --git a/Sources/Plasma/NucleusLib/pnUtils/Private/Win32/pnUtW32Uuid.cpp b/Sources/Plasma/NucleusLib/pnUtils/Private/Win32/pnUtW32Uuid.cpp index 3fb3e4a3..c5a734b0 100644 --- a/Sources/Plasma/NucleusLib/pnUtils/Private/Win32/pnUtW32Uuid.cpp +++ b/Sources/Plasma/NucleusLib/pnUtils/Private/Win32/pnUtW32Uuid.cpp @@ -134,9 +134,9 @@ void GuidClear (Uuid * uuid) { } //============================================================================ -bool GuidFromString (const wchar str[], Uuid * uuid) { +bool GuidFromString (const wchar_t str[], Uuid * uuid) { ASSERT(uuid); - COMPILER_ASSERT(sizeof(wchar) == sizeof(unsigned short)); + COMPILER_ASSERT(sizeof(wchar_t) == sizeof(unsigned short)); return RPC_S_OK == UuidFromStringW((unsigned short *) str, (GUID *) uuid); } @@ -159,8 +159,8 @@ bool GuidIsNil (const Uuid & uuid) { } //============================================================================ -const wchar * GuidToString (const Uuid & uuid, wchar * dst, unsigned chars) { - wchar * src; +const wchar_t * GuidToString (const Uuid & uuid, wchar_t * dst, unsigned chars) { + wchar_t * src; RPC_STATUS s; s = UuidToStringW( (GUID *) &uuid, (RPC_WSTR*)&src ); if (RPC_S_OK == s) @@ -173,7 +173,7 @@ const wchar * GuidToString (const Uuid & uuid, wchar * dst, unsigned chars) { //============================================================================ const char * GuidToString (const Uuid & uuid, char * dst, unsigned chars) { - byte * src; + uint8_t * src; RPC_STATUS s; s = UuidToStringA( (GUID *) &uuid, &src ); if (RPC_S_OK == s) diff --git a/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtAddr.h b/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtAddr.h index 8de88c80..c31756c5 100644 --- a/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtAddr.h +++ b/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtAddr.h @@ -59,7 +59,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com struct NetAddress { - byte data[24]; + uint8_t data[24]; }; typedef unsigned NetAddressNode; @@ -116,7 +116,7 @@ inline bool NetAddressEqual (const NetAddress & a1, const NetAddress & a2) { void NetAddressToString ( const NetAddress & addr, - wchar * str, + wchar_t * str, unsigned chars, ENetAddressFormat format ); @@ -125,7 +125,7 @@ void NetAddressToString ( // - names which require DNS lookup will cause the function to return false bool NetAddressFromString ( NetAddress * addr, - const wchar str[], + const wchar_t str[], unsigned defaultPort ); @@ -139,12 +139,12 @@ void NetAddressSetPort ( void NetAddressNodeToString ( NetAddressNode node, - wchar * str, + wchar_t * str, unsigned chars ); NetAddressNode NetAddressNodeFromString ( - const wchar string[], - const wchar * endPtr[] + const wchar_t string[], + const wchar_t * endPtr[] ); NetAddressNode NetAddressGetNode ( diff --git a/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtArray.cpp b/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtArray.cpp index 11ac920f..52a74857 100644 --- a/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtArray.cpp +++ b/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtArray.cpp @@ -95,7 +95,7 @@ unsigned CBaseArray::CalcAllocGrowth (unsigned newAlloc, unsigned oldAlloc, unsi void * CBaseArray::ReallocPtr (void * ptr, unsigned bytes) { void * newPtr = nil; if (bytes) { - newPtr = ALLOCFLAGS(bytes, ARR_MEMORY_FLAGS); + newPtr = malloc(bytes); } return newPtr; } diff --git a/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtArray.h b/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtArray.h index 04f4ed16..14d97a77 100644 --- a/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtArray.h +++ b/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtArray.h @@ -67,8 +67,6 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #define SORTARRAYTYPE(type) TSortArray< type, TArrayCopyBits< type >, type, 0> #define SORTARRAYTYPEOBJ(type) TSortArray< type, TArrayCopyObject< type >, type, 0> -#define ARR_MEMORY_FLAGS 0 /*| kMemIgnoreBlock*/ - /**************************************************************************** * @@ -97,7 +95,7 @@ public: inline void Clear (); inline unsigned Count () const; inline T * Detach (); - inline void Fill (byte value); + inline void Fill (uint8_t value); inline T * Ptr (); inline const T * Ptr () const; inline void Set (const T * source, unsigned count); @@ -142,7 +140,7 @@ TBuffer::TBuffer (const TBuffer & source) { template TBuffer::~TBuffer () { if (m_data) - FREEFLAGS(m_data, ARR_MEMORY_FLAGS); + free(m_data); } //=========================================================================== @@ -159,8 +157,8 @@ TBuffer & TBuffer::operator= (const TBuffer & source) { //=========================================================================== template bool TBuffer::operator== (const TBuffer & source) const { - unsigned size = MemSize(m_data); - return (size == MemSize(source.m_data)) && !MemCmp(m_data, source.m_data, size); + unsigned size = _m_size(m_data); + return (size == _m_size(source.m_data)) && !memcmp(m_data, source.m_data, size); } //=========================================================================== @@ -181,22 +179,22 @@ T TBuffer::operator[] (unsigned index) const { template void TBuffer::Attach (T * source, unsigned count) { if (m_data) - FREEFLAGS(m_data, ARR_MEMORY_FLAGS); + free(m_data); m_data = source; - ASSERT(MemSize(source) >= count * sizeof(T)); + ASSERT(_m_size(source) >= count * sizeof(T)); } //=========================================================================== template unsigned TBuffer::Bytes () const { - return m_data ? MemSize(m_data) : 0; + return m_data ? _m_size(m_data) : 0; } //=========================================================================== template void TBuffer::Clear () { if (m_data) { - FREEFLAGS(m_data, ARR_MEMORY_FLAGS); + free(m_data); m_data = nil; } } @@ -204,7 +202,7 @@ void TBuffer::Clear () { //=========================================================================== template unsigned TBuffer::Count () const { - return m_data ? (MemSize(m_data) / sizeof(T)) : 0; + return m_data ? (_m_size(m_data) / sizeof(T)) : 0; } //=========================================================================== @@ -217,9 +215,9 @@ T * TBuffer::Detach () { //=========================================================================== template -void TBuffer::Fill (byte value) { +void TBuffer::Fill (uint8_t value) { if (m_data) - MemSet(m_data, value, Bytes()); + memset(m_data, value, Bytes()); } //=========================================================================== @@ -245,9 +243,9 @@ void TBuffer::Set (const T * source, unsigned count) { template void TBuffer::SetBytes (unsigned bytes) { if (bytes) - m_data = (T *)REALLOCFLAGS(m_data, bytes, ARR_MEMORY_FLAGS); + m_data = (T *)realloc(m_data, bytes); else if (m_data) { - FREEFLAGS(m_data, ARR_MEMORY_FLAGS); + free(m_data); m_data = nil; } } @@ -262,10 +260,10 @@ void TBuffer::SetCount (unsigned count) { template void TBuffer::Zero () { if (m_data) - MemZero(m_data, Bytes()); + memset(m_data, 0, Bytes()); } -typedef TBuffer CBuffer; +typedef TBuffer CBuffer; /**************************************************************************** @@ -302,7 +300,7 @@ public: //=========================================================================== template void TArrayCopyBits::Assign (T * dest, const T source[], unsigned count) { - MemMove(dest, source, count * sizeof(T)); + memmove(dest, source, count * sizeof(T)); } //=========================================================================== @@ -420,7 +418,7 @@ public: inline void Clear (); inline unsigned Count () const; inline T * Detach (); - inline void Fill (byte value); + inline void Fill (uint8_t value); inline T * Ptr (); inline const T * Ptr () const; inline void Set (const T * source, unsigned count); @@ -449,7 +447,7 @@ template TFArray::TFArray (unsigned count) { m_alloc = m_count = count; if (count) { - m_data = (T *)ALLOCFLAGS(count * sizeof(T), ARR_MEMORY_FLAGS); + m_data = (T *)malloc(count * sizeof(T)); C::Construct(m_data, count); } else @@ -461,7 +459,7 @@ template TFArray::TFArray (const T * source, unsigned count) { m_alloc = m_count = count; if (count) { - m_data = (T *)ALLOCFLAGS(count * sizeof(T), ARR_MEMORY_FLAGS); + m_data = (T *)malloc(count * sizeof(T)); C::CopyConstruct(m_data, source, count); } else @@ -473,7 +471,7 @@ template TFArray::TFArray (const TFArray & source) { m_alloc = m_count = source.m_count; if (m_count) { - m_data = (T *)ALLOCFLAGS(m_count * sizeof(T), ARR_MEMORY_FLAGS); + m_data = (T *)malloc(m_count * sizeof(T)); C::CopyConstruct(m_data, source.m_data, m_count); } else @@ -539,7 +537,7 @@ void TFArray::AdjustSize (unsigned newAlloc, unsigned newCount) { C::CopyConstruct(newData, m_data, m_count); C::Destruct(m_data, m_count); if (m_data) - FREEFLAGS(m_data, ARR_MEMORY_FLAGS); + free(m_data); } m_alloc = newAlloc; m_data = newData; @@ -558,9 +556,9 @@ template void TFArray::Attach (T * source, unsigned count) { C::Destruct(m_data, m_count); if (m_data) - FREEFLAGS(m_data, ARR_MEMORY_FLAGS); + free(m_data); m_data = source; - m_alloc = MemSize(source) / sizeof(T); + m_alloc = _m_size(source) / sizeof(T); m_count = count; ASSERT(m_alloc >= m_count); } @@ -570,7 +568,7 @@ template void TFArray::AttachTemp (T * source, unsigned count) { C::Destruct(m_data, m_count); if (m_data) - FREEFLAGS(m_data, ARR_MEMORY_FLAGS); + free(m_data); m_data = source; m_alloc = count; m_count = count; @@ -587,7 +585,7 @@ template void TFArray::Clear () { C::Destruct(m_data, m_count); if (m_data) - FREEFLAGS(m_data, ARR_MEMORY_FLAGS); + free(m_data); m_data = nil; m_alloc = m_count = 0; } @@ -610,9 +608,9 @@ T * TFArray::Detach () { //=========================================================================== template -void TFArray::Fill (byte value) { +void TFArray::Fill (uint8_t value) { C::Destruct(m_data, m_count); - MemSet(m_data, value, m_count * sizeof(T)); + memset(m_data, value, m_count * sizeof(T)); C::Construct(m_data, m_count); } @@ -680,7 +678,7 @@ const T * TFArray::Top () const { template void TFArray::Zero () { C::Destruct(m_data, m_count); - MemZero(m_data, m_count * sizeof(T)); + memset(m_data, 0, m_count * sizeof(T)); C::Construct(m_data, m_count); } @@ -696,7 +694,7 @@ template void TFArray::ZeroRange (unsigned index, unsigned count) { ASSERT(index + count <= m_count); C::Destruct(m_data + index, count); - MemZero(m_data + index, count * sizeof(T)); + memset(m_data + index, 0, count * sizeof(T)); C::Construct(m_data + index, count); } @@ -991,8 +989,8 @@ void TArray::Trim () { template class TSortArray : public TArray { private: - inline static K & SortKey (T & rec) { return *(K *)((byte *)&rec + OFFSET); } - inline static const K & SortKey (const T & rec) { return *(const K *)((const byte *)&rec + OFFSET); } + inline static K & SortKey (T & rec) { return *(K *)((uint8_t *)&rec + OFFSET); } + inline static const K & SortKey (const T & rec) { return *(const K *)((const uint8_t *)&rec + OFFSET); } public: inline bool Delete (K sortKey); diff --git a/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtBase64.cpp b/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtBase64.cpp index 978b5629..5f2a5c2a 100644 --- a/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtBase64.cpp +++ b/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtBase64.cpp @@ -99,7 +99,7 @@ static const char kFillchar = '='; //============================================================================ unsigned Base64Encode ( unsigned srcChars, - const byte srcData[], + const uint8_t srcData[], unsigned dstChars, char * dstData ) { @@ -108,7 +108,7 @@ unsigned Base64Encode ( ASSERT(dstData); const char * dstBase = dstData; - const byte * srcTerm = srcData + srcChars; + const uint8_t * srcTerm = srcData + srcChars; for (;;) switch (srcTerm - srcData) { case 0: *dstData++ = 0; @@ -145,17 +145,17 @@ unsigned Base64Decode ( unsigned srcChars, const char srcData[], unsigned dstChars, - byte * dstData + uint8_t * dstData ) { ASSERT(srcData); ASSERT(dstChars >= Base64DecodeSize(srcChars, srcData)); ASSERT(dstData); - const byte * dstBase = dstData; + const uint8_t * dstBase = dstData; const char * srcTerm = srcData + srcChars; while (srcTerm - srcData >= 4) { - *dstData++ = (byte) ( + *dstData++ = (uint8_t) ( (kDecode64[srcData[0]] << 2 & 0xfc) +(kDecode64[srcData[1]] >> 4 & 0x03) ); @@ -163,7 +163,7 @@ unsigned Base64Decode ( if (kDecode64[srcData[2]] == kTerminator) break; - *dstData++ = (byte) ( + *dstData++ = (uint8_t) ( (kDecode64[srcData[1]] << 4 & 0xf0) +(kDecode64[srcData[2]] >> 2 & 0x0f) ); @@ -171,7 +171,7 @@ unsigned Base64Decode ( if (kDecode64[srcData[3]] == kTerminator) break; - *dstData++ = (byte) ( + *dstData++ = (uint8_t) ( (kDecode64[srcData[2]] << 6 & 0xc0) +(kDecode64[srcData[3]]) ); diff --git a/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtBase64.h b/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtBase64.h index b1fde35a..b2c49769 100644 --- a/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtBase64.h +++ b/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtBase64.h @@ -67,7 +67,7 @@ inline unsigned Base64EncodeSize (unsigned srcChars) { } unsigned Base64Encode ( unsigned srcChars, - const byte srcData[], + const uint8_t srcData[], unsigned dstChars, char * dstData ); @@ -81,5 +81,5 @@ unsigned Base64Decode ( unsigned srcChars, const char srcData[], unsigned dstChars, - byte * dstData + uint8_t * dstData ); diff --git a/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtBigNum.cpp b/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtBigNum.cpp index d7660aba..270e83e6 100644 --- a/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtBigNum.cpp +++ b/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtBigNum.cpp @@ -102,7 +102,7 @@ BigNum::~BigNum () } //=========================================================================== -int BigNum::Compare (dword a) const { +int BigNum::Compare (uint32_t a) const { // -1 if (this < a) // 0 if (this == a) // 1 if (this > a) @@ -110,7 +110,7 @@ int BigNum::Compare (dword a) const { if (BN_is_word(&m_number, a)) return 0; - // This returns 0xFFFFFFFFL if the number is bigger than one word, so + // This returns 0xFFFFFFFFL if the number is bigger than one uint16_t, so // it doesn't need any size check if (BN_get_word(&m_number) < a) return -1; @@ -122,7 +122,7 @@ int BigNum::Compare (dword a) const { //=========================================================================== void BigNum::FromData_LE (unsigned bytes, const void * data) { - unsigned char * buffer = TRACKED_NEW unsigned char[bytes]; + unsigned char * buffer = new unsigned char[bytes]; memcpy(buffer, data, bytes); byteswap(bytes, buffer); BN_bin2bn(buffer, bytes, &m_number); @@ -133,7 +133,7 @@ void BigNum::FromData_LE (unsigned bytes, const void * data) unsigned char * BigNum::GetData_BE (unsigned * bytes) const { *bytes = BN_num_bytes(&m_number); - unsigned char * data = TRACKED_NEW unsigned char[*bytes]; + unsigned char * data = new unsigned char[*bytes]; BN_bn2bin(&m_number, data); return data; } @@ -142,7 +142,7 @@ unsigned char * BigNum::GetData_BE (unsigned * bytes) const unsigned char * BigNum::GetData_LE (unsigned * bytes) const { *bytes = BN_num_bytes(&m_number); - unsigned char * data = TRACKED_NEW unsigned char[*bytes]; + unsigned char * data = new unsigned char[*bytes]; BN_bn2bin(&m_number, data); byteswap(*bytes, data); return data; @@ -153,9 +153,9 @@ void BigNum::Rand (unsigned bits, BigNum * seed) { // this = random number with bits or fewer bits - unsigned seedBytes; - unsigned char * seedData = seed->GetData_BE(&seedBytes); - RAND_seed(seedData, seedBytes); + unsigned seedbytes; + unsigned char * seedData = seed->GetData_BE(&seedbytes); + RAND_seed(seedData, seedbytes); BN_rand(&m_number, bits, 0, 0); delete [] seedData; } diff --git a/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtBigNum.h b/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtBigNum.h index 7ab5a16d..675ab4bd 100644 --- a/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtBigNum.h +++ b/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtBigNum.h @@ -75,7 +75,7 @@ public: BigNum (); BigNum (const BigNum & a); BigNum (unsigned a); - BigNum (unsigned bytes, const void * data, bool le=false); + BigNum (unsigned bytess, const void * data, bool le=false); ~BigNum (); BigNum & operator= (const BigNum & a) @@ -87,7 +87,7 @@ public: // Constant parameters need not be distinct from the destination or from // each other - void Add (const BigNum & a, dword b) + void Add (const BigNum & a, uint32_t b) { // this = a + b BN_copy(&m_number, &a.m_number); @@ -100,7 +100,7 @@ public: BN_add(&m_number, &a.m_number, &b.m_number); } - int Compare (dword a) const; + int Compare (uint32_t a) const; int Compare (const BigNum & a) const { return BN_cmp(&m_number, &a.m_number); @@ -110,11 +110,11 @@ public: return BN_is_zero(&m_number); } - void Div (const BigNum & a, dword b, dword * remainder) + void Div (const BigNum & a, uint32_t b, uint32_t * remainder) { // this = a / b, remainder = a % b BN_copy(&m_number, &a.m_number); - *remainder = (dword)BN_div_word(&m_number, b); + *remainder = (uint32_t)BN_div_word(&m_number, b); } void Div (const BigNum & a, const BigNum & b, BigNum * remainder) @@ -125,15 +125,15 @@ public: &a.m_number, &b.m_number, GetContext()); } - void FromData_BE (unsigned bytes, const void * data) + void FromData_BE (unsigned bytess, const void * data) { - BN_bin2bn((const unsigned char *)data, bytes, &m_number); + BN_bin2bn((const unsigned char *)data, bytess, &m_number); } - void FromData_LE (unsigned bytes, const void * data); + void FromData_LE (unsigned bytess, const void * data); - unsigned char * GetData_BE (unsigned * bytes) const; - unsigned char * GetData_LE (unsigned * bytes) const; + unsigned char * GetData_BE (unsigned * bytess) const; + unsigned char * GetData_LE (unsigned * bytess) const; bool IsPrime () const { @@ -148,7 +148,7 @@ public: BN_div(nil, &m_number, &a.m_number, &b.m_number, GetContext()); } - void Mul (const BigNum & a, dword b) + void Mul (const BigNum & a, uint32_t b) { // this = a * b BN_copy(&m_number, &a.m_number); @@ -161,7 +161,7 @@ public: BN_mul(&m_number, &a.m_number, &b.m_number, GetContext()); } - void PowMod (dword a, const BigNum & b, const BigNum & c) + void PowMod (uint32_t a, const BigNum & b, const BigNum & c) { // this = a ^ b % c PowMod(BigNum(a), b, c); @@ -176,7 +176,7 @@ public: void Rand (const BigNum & a, BigNum * seed) { // this = random number less than a - unsigned bits = BN_num_bits(&a.m_number); + int bits = BN_num_bits(&a.m_number); do Rand(bits, seed); while (Compare(a) >= 0); @@ -214,7 +214,7 @@ public: BN_rshift(&m_number, &a.m_number, b); } - void Sub (const BigNum & a, dword b) + void Sub (const BigNum & a, uint32_t b) { // this = a - b BN_copy(&m_number, &a.m_number); diff --git a/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtCmd.cpp b/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtCmd.cpp index 382c5158..214c7b8d 100644 --- a/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtCmd.cpp +++ b/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtCmd.cpp @@ -69,16 +69,16 @@ struct CmdArgData { bool boolVal; float floatVal; int intVal; - const wchar * strVal; + const wchar_t * strVal; unsigned unsignedVal; } val; - wchar * buffer; + wchar_t * buffer; unsigned nameChars; bool isSpecified; ~CmdArgData () { if (buffer) - FREE(buffer); + free(buffer); } }; @@ -96,18 +96,18 @@ private: FARRAY(unsigned) m_unflaggedArray; inline bool CheckFlag (unsigned flags, unsigned flag, unsigned mask) const; - void Error (const CmdTokState * state, ECmdError errorCode, const wchar arg[], const wchar value[]) const; - bool LookupFlagged (const wchar ** name, unsigned * lastIndex) const; - bool ProcessValue (CmdTokState * state, unsigned index, const wchar str[]); + void Error (const CmdTokState * state, ECmdError errorCode, const wchar_t arg[], const wchar_t value[]) const; + bool LookupFlagged (const wchar_t ** name, unsigned * lastIndex) const; + bool ProcessValue (CmdTokState * state, unsigned index, const wchar_t str[]); void SetDefaultValue (CmdArgData & arg); - bool TokenizeFlags (CmdTokState * state, const wchar str[]); + bool TokenizeFlags (CmdTokState * state, const wchar_t str[]); public: CICmdParser (const CmdArgDef def[], unsigned defCount); bool CheckAllRequiredArguments (CmdTokState * state); const CmdArgData * FindArgById (unsigned id) const; - const CmdArgData * FindArgByName (const wchar name[]) const; - bool Tokenize (CmdTokState * state, const wchar str[]); + const CmdArgData * FindArgByName (const wchar_t name[]) const; + bool Tokenize (CmdTokState * state, const wchar_t str[]); }; @@ -185,14 +185,14 @@ CICmdParser::CICmdParser (const CmdArgDef def[], unsigned defCount) { } //=========================================================================== -void CICmdParser::Error (const CmdTokState * state, ECmdError errorCode, const wchar arg[], const wchar value[]) const { +void CICmdParser::Error (const CmdTokState * state, ECmdError errorCode, const wchar_t arg[], const wchar_t value[]) const { // Compose the error text // (This text is only provided as a shortcut for trivial applications that // don't want to compose their own text. Normally, an application would // compose error text using its own localized strings.) unsigned chars = 256 + (arg ? StrLen(arg) : 0) + (value ? StrLen(value) : 0); - wchar * buffer = (wchar *)ALLOC(chars * sizeof(wchar)); + wchar_t * buffer = (wchar_t *)malloc(chars * sizeof(wchar_t)); switch (errorCode) { case kCmdErrorInvalidArg: @@ -218,7 +218,7 @@ void CICmdParser::Error (const CmdTokState * state, ECmdError errorCode, const w state->parser->OnError(buffer, errorCode, arg, value); // Free memory - FREE(buffer); + free(buffer); } @@ -245,7 +245,7 @@ const CmdArgData * CICmdParser::FindArgById (unsigned id) const { } //=========================================================================== -const CmdArgData * CICmdParser::FindArgByName (const wchar name[]) const { +const CmdArgData * CICmdParser::FindArgByName (const wchar_t name[]) const { // Search for an argument with this name unsigned index = (unsigned)-1; @@ -258,7 +258,7 @@ const CmdArgData * CICmdParser::FindArgByName (const wchar name[]) const { } //=========================================================================== -bool CICmdParser::LookupFlagged (const wchar ** name, unsigned * lastIndex) const { +bool CICmdParser::LookupFlagged (const wchar_t ** name, unsigned * lastIndex) const { unsigned argCount = m_argArray.Count(); unsigned chars = StrLen(*name); unsigned bestIndex = (unsigned)-1; @@ -313,7 +313,7 @@ bool CICmdParser::LookupFlagged (const wchar ** name, unsigned * lastIndex) cons } //=========================================================================== -bool CICmdParser::ProcessValue (CmdTokState * state, unsigned index, const wchar str[]) { +bool CICmdParser::ProcessValue (CmdTokState * state, unsigned index, const wchar_t str[]) { CmdArgData & arg = m_argArray[index]; arg.isSpecified = true; unsigned argType = arg.def.flags & kCmdMaskType; @@ -332,7 +332,7 @@ bool CICmdParser::ProcessValue (CmdTokState * state, unsigned index, const wchar case kCmdTypeFloat: { - const wchar * endPtr; + const wchar_t * endPtr; arg.val.floatVal = StrToFloat(str, &endPtr); if (*endPtr) Error(state, kCmdErrorInvalidValue, arg.def.name, str); @@ -341,7 +341,7 @@ bool CICmdParser::ProcessValue (CmdTokState * state, unsigned index, const wchar case kCmdTypeInt: { - const wchar * endPtr; + const wchar_t * endPtr; arg.val.intVal = StrToInt(str, &endPtr); if (*endPtr) Error(state, kCmdErrorInvalidValue, arg.def.name, str); @@ -350,14 +350,14 @@ bool CICmdParser::ProcessValue (CmdTokState * state, unsigned index, const wchar case kCmdTypeString: if (arg.buffer) - FREE(arg.buffer); + free(arg.buffer); arg.buffer = StrDup(str); arg.val.strVal = arg.buffer; break; case kCmdTypeUnsigned: { - const wchar * endPtr; + const wchar_t * endPtr; arg.val.unsignedVal = StrToUnsigned(str, &endPtr, 10); if (*endPtr) Error(state, kCmdErrorInvalidValue, arg.def.name, str); @@ -401,8 +401,8 @@ void CICmdParser::SetDefaultValue (CmdArgData & arg) { } //=========================================================================== -bool CICmdParser::Tokenize (CmdTokState * state, const wchar str[]) { - wchar buffer[kMaxTokenLength]; +bool CICmdParser::Tokenize (CmdTokState * state, const wchar_t str[]) { + wchar_t buffer[kMaxTokenLength]; bool result = true; while (result && StrTokenize(&str, buffer, arrsize(buffer), WHITESPACE)) { @@ -438,10 +438,10 @@ bool CICmdParser::Tokenize (CmdTokState * state, const wchar str[]) { } //=========================================================================== -bool CICmdParser::TokenizeFlags (CmdTokState * state, const wchar str[]) { +bool CICmdParser::TokenizeFlags (CmdTokState * state, const wchar_t str[]) { // Process each separately flagged token within the string - wchar buffer[kMaxTokenLength]; + wchar_t buffer[kMaxTokenLength]; bool result = true; while (result && StrTokenize(&str, buffer, arrsize(buffer), ALL)) { if (!buffer[0]) @@ -449,7 +449,7 @@ bool CICmdParser::TokenizeFlags (CmdTokState * state, const wchar str[]) { // Process each flag within the token unsigned lastIndex = (unsigned)-1; - const wchar * bufferPtr = buffer; + const wchar_t * bufferPtr = buffer; while (result) { // Lookup the argument name @@ -485,7 +485,7 @@ bool CICmdParser::TokenizeFlags (CmdTokState * state, const wchar str[]) { // Check for a value provided with a toggle if (*str && StrChr(TOGGLES, *str)) { - wchar tempStr[] = {*str, 0}; + wchar_t tempStr[] = {*str, 0}; result = ProcessValue(state, lastIndex, tempStr); ++str; continue; @@ -539,7 +539,7 @@ CCmdParser::CCmdParser (const CmdArgDef def[], unsigned defCount) { //=========================================================================== CCmdParser::~CCmdParser () { - DEL(fParser); + delete fParser; } //=========================================================================== @@ -548,7 +548,7 @@ bool CCmdParser::GetBool (unsigned id) const { } //=========================================================================== -bool CCmdParser::GetBool (const wchar name[]) const { +bool CCmdParser::GetBool (const wchar_t name[]) const { return fParser->FindArgByName(name)->val.boolVal; } @@ -558,7 +558,7 @@ float CCmdParser::GetFloat (unsigned id) const { } //=========================================================================== -float CCmdParser::GetFloat (const wchar name[]) const { +float CCmdParser::GetFloat (const wchar_t name[]) const { return fParser->FindArgByName(name)->val.floatVal; } @@ -568,17 +568,17 @@ int CCmdParser::GetInt (unsigned id) const { } //=========================================================================== -int CCmdParser::GetInt (const wchar name[]) const { +int CCmdParser::GetInt (const wchar_t name[]) const { return fParser->FindArgByName(name)->val.intVal; } //=========================================================================== -const wchar * CCmdParser::GetString (unsigned id) const { +const wchar_t * CCmdParser::GetString (unsigned id) const { return fParser->FindArgById(id)->val.strVal; } //=========================================================================== -const wchar * CCmdParser::GetString (const wchar name[]) const { +const wchar_t * CCmdParser::GetString (const wchar_t name[]) const { return fParser->FindArgByName(name)->val.strVal; } @@ -588,13 +588,13 @@ unsigned CCmdParser::GetUnsigned (unsigned id) const { } //=========================================================================== -unsigned CCmdParser::GetUnsigned (const wchar name[]) const { +unsigned CCmdParser::GetUnsigned (const wchar_t name[]) const { return fParser->FindArgByName(name)->val.unsignedVal; } //=========================================================================== void CCmdParser::Initialize (const CmdArgDef def[], unsigned defCount) { - fParser = NEW(CICmdParser)(def, defCount); + fParser = new CICmdParser(def, defCount); } //=========================================================================== @@ -605,23 +605,23 @@ bool CCmdParser::IsSpecified (unsigned id) const { } //=========================================================================== -bool CCmdParser::IsSpecified (const wchar name[]) const { +bool CCmdParser::IsSpecified (const wchar_t name[]) const { if (const CmdArgData * data = fParser->FindArgByName(name)) return data->isSpecified; return false; } //=========================================================================== -void CCmdParser::OnError (const wchar str[], ECmdError errorCode, const wchar arg[], const wchar value[]) { +void CCmdParser::OnError (const wchar_t str[], ECmdError errorCode, const wchar_t arg[], const wchar_t value[]) { } //=========================================================================== -bool CCmdParser::OnExtra (const wchar str[]) { +bool CCmdParser::OnExtra (const wchar_t str[]) { return false; } //=========================================================================== -bool CCmdParser::Parse (const wchar cmdLine[]) { +bool CCmdParser::Parse (const wchar_t cmdLine[]) { // If no command line was passed, use the application's command line, // skipping past the program name if (!cmdLine) { @@ -657,12 +657,12 @@ bool CCmdParser::Parse (const wchar cmdLine[]) { CCmdParserSimple::CCmdParserSimple ( unsigned requiredStringCount, unsigned optionalStringCount, - const wchar flaggedBoolNames[] // double null terminated if used + const wchar_t flaggedBoolNames[] // double null terminated if used ) { // Count the number of flagged arguments unsigned flaggedBoolCount = 0; - const wchar * curr; + const wchar_t * curr; if (flaggedBoolNames) for (curr = flaggedBoolNames; *curr; curr += StrLen(curr) + 1) ++flaggedBoolCount; diff --git a/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtCmd.h b/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtCmd.h index bc8501a2..59fadcf5 100644 --- a/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtCmd.h +++ b/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtCmd.h @@ -96,15 +96,15 @@ enum ECmdError { struct CmdArgDef { unsigned flags; - const wchar * name; // must be compile-time constant + const wchar_t * name; // must be compile-time constant unsigned id; }; class CCmdParser { class CICmdParser * fParser; - static void DispatchError (const wchar str[], ECmdError errorCode, const wchar arg[], const wchar value[], void * param); - static bool DispatchExtra (const wchar str[], void * param); + static void DispatchError (const wchar_t str[], ECmdError errorCode, const wchar_t arg[], const wchar_t value[], void * param); + static bool DispatchExtra (const wchar_t str[], void * param); protected: CCmdParser (); @@ -115,22 +115,22 @@ public: virtual ~CCmdParser (); bool GetBool (unsigned id) const; - bool GetBool (const wchar name[]) const; + bool GetBool (const wchar_t name[]) const; float GetFloat (unsigned id) const; - float GetFloat (const wchar name[]) const; + float GetFloat (const wchar_t name[]) const; int GetInt (unsigned id) const; - int GetInt (const wchar name[]) const; - const wchar * GetString (unsigned id) const; - const wchar * GetString (const wchar name[]) const; + int GetInt (const wchar_t name[]) const; + const wchar_t * GetString (unsigned id) const; + const wchar_t * GetString (const wchar_t name[]) const; unsigned GetUnsigned (unsigned id) const; - unsigned GetUnsigned (const wchar name[]) const; + unsigned GetUnsigned (const wchar_t name[]) const; bool IsSpecified (unsigned id) const; - bool IsSpecified (const wchar name[]) const; + bool IsSpecified (const wchar_t name[]) const; - virtual void OnError (const wchar str[], ECmdError errorCode, const wchar arg[], const wchar value[]); - virtual bool OnExtra (const wchar str[]); + virtual void OnError (const wchar_t str[], ECmdError errorCode, const wchar_t arg[], const wchar_t value[]); + virtual bool OnExtra (const wchar_t str[]); - bool Parse (const wchar cmdLine[] = nil); + bool Parse (const wchar_t cmdLine[] = nil); }; class CCmdParserSimple : public CCmdParser { @@ -138,7 +138,7 @@ public: CCmdParserSimple ( unsigned requiredStringCount, unsigned optionalStringCount, - const wchar flaggedBoolNames[] // double null terminated if used + const wchar_t flaggedBoolNames[] // double null terminated if used ); }; diff --git a/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtCoreLib.h b/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtCoreLib.h index d5dc0f0b..ff4a66f9 100644 --- a/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtCoreLib.h +++ b/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtCoreLib.h @@ -53,7 +53,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #pragma warning(push, 0) #include "HeadSpin.h" -#include "hsWindows.h" + #include "hsCritSect.h" #include "hsStream.h" diff --git a/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtCrypt.cpp b/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtCrypt.cpp index da4fb438..1ec4a4ff 100644 --- a/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtCrypt.cpp +++ b/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtCrypt.cpp @@ -149,7 +149,7 @@ void Sha1Process ( static void Rc4Codec ( CryptKey * key, bool encrypt, - ARRAY(byte) * dest, + ARRAY(uint8_t) * dest, unsigned sourceBytes, const void * sourceData ) { @@ -166,9 +166,11 @@ static void Rc4Codec ( void * data ) { // RC4 uses the same algorithm to both encrypt and decrypt - byte * temp = ALLOCA(byte, bytes); + uint8_t * temp = (uint8_t *)malloc(bytes); RC4((RC4_KEY *)key->handle, bytes, (const unsigned char *)data, temp); - MemCopy(data, temp, bytes); + memcpy(data, temp, bytes); + + free(temp); } } using namespace Crypt; @@ -230,9 +232,9 @@ CryptKey * CryptKeyCreate ( CryptKey * key = nil; switch (algorithm) { case kCryptRc4: { - RC4_KEY * rc4 = NEW(RC4_KEY); + RC4_KEY * rc4 = new RC4_KEY; RC4_set_key(rc4, bytes, (const unsigned char *)data); - key = NEW(CryptKey); + key = new CryptKey; key->algorithm = kCryptRc4; key->handle = rc4; } @@ -254,8 +256,8 @@ void CryptKeyClose ( if (!key) return; - DEL(key->handle); - DEL(key); + delete key->handle; + delete key; } //============================================================================ @@ -278,7 +280,7 @@ unsigned CryptKeyGetBlockSize ( //============================================================================ void CryptCreateRandomSeed ( unsigned bytes, - byte * data + uint8_t * data ) { COMPILER_ASSERT(SHA_DIGEST_LENGTH == 20); @@ -289,16 +291,16 @@ void CryptCreateRandomSeed ( unsigned cur = 0; unsigned end = max(bytes, sizeof(s_shaSeed)); for (; cur < end; ++cur) { - ((byte *) &s_shaSeed)[seedIndex] ^= data[dataIndex]; + ((uint8_t *) &s_shaSeed)[seedIndex] ^= data[dataIndex]; if (++seedIndex >= sizeof(s_shaSeed)) seedIndex = 0; if (++dataIndex >= bytes) dataIndex = 0; } - s_shaSeed.data[2] ^= (dword) &bytes; - s_shaSeed.data[3] ^= (dword) bytes; - s_shaSeed.data[4] ^= (dword) data; + s_shaSeed.data[2] ^= (uint32_t) &bytes; + s_shaSeed.data[3] ^= (uint32_t) bytes; + s_shaSeed.data[4] ^= (uint32_t) data; } // Hash seed @@ -312,7 +314,7 @@ void CryptCreateRandomSeed ( unsigned cur = 0; unsigned end = max(bytes, sizeof(digest)); for (; cur < end; ++cur) { - data[dst] ^= ((const byte *) &digest)[src]; + data[dst] ^= ((const uint8_t *) &digest)[src]; if (++src >= sizeof(digest)) src = 0; if (++dst >= bytes) @@ -330,14 +332,14 @@ void CryptCreateRandomSeed ( //============================================================================ void CryptHashPassword ( - const wchar username[], - const wchar password[], + const wchar_t username[], + const wchar_t password[], ShaDigest * namePassHash ) { unsigned passlen = StrLen(password); unsigned userlen = StrLen(username); - wchar * buffer = ALLOCA(wchar, passlen + userlen); + wchar_t * buffer = (wchar_t*)malloc(sizeof(wchar_t) * (passlen + userlen)); StrCopy(buffer, password, passlen); StrCopy(buffer + passlen, username, userlen); StrLower(buffer + passlen); // lowercase the username @@ -348,6 +350,8 @@ void CryptHashPassword ( (userlen + passlen) * sizeof(buffer[0]), buffer ); + + free(buffer); } //============================================================================ @@ -359,8 +363,8 @@ void CryptHashPasswordChallenge ( ) { #include struct { - dword clientChallenge; - dword serverChallenge; + uint32_t clientChallenge; + uint32_t serverChallenge; ShaDigest namePassHash; } buffer; #include @@ -393,7 +397,7 @@ void CryptCreateFastWeakChallenge ( //============================================================================ void CryptEncrypt ( CryptKey * key, - ARRAY(byte) * dest, + ARRAY(uint8_t) * dest, unsigned sourceBytes, const void * sourceData ) { @@ -436,7 +440,7 @@ void CryptEncrypt ( //============================================================================ void CryptDecrypt ( CryptKey * key, - ARRAY(byte) * dest, + ARRAY(uint8_t) * dest, unsigned sourceBytes, const void * sourceData ) { diff --git a/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtCrypt.h b/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtCrypt.h index 3151b87c..ea08772e 100644 --- a/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtCrypt.h +++ b/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtCrypt.h @@ -69,7 +69,7 @@ enum ECryptAlgorithm { }; struct ShaDigest { - dword data[5]; + uint32_t data[5]; }; @@ -116,8 +116,8 @@ void CryptKeyGenerate ( unsigned keyBits, // used for algorithms with variable key strength unsigned randomBytes, const void * randomData, - ARRAY(byte) * privateData, - ARRAY(byte) * publicData // only for public key cryptography + ARRAY(uint8_t) * privateData, + ARRAY(uint8_t) * publicData // only for public key cryptography ); unsigned CryptKeyGetBlockSize ( @@ -126,12 +126,12 @@ unsigned CryptKeyGetBlockSize ( void CryptCreateRandomSeed ( unsigned bytes, - byte * data + uint8_t * data ); void CryptHashPassword ( - const wchar username[], - const wchar password[], + const wchar_t username[], + const wchar_t password[], ShaDigest * namePassHash ); @@ -157,7 +157,7 @@ void CryptCreateFastWeakChallenge ( void CryptEncrypt ( CryptKey * key, - ARRAY(byte) * dest, + ARRAY(uint8_t) * dest, unsigned sourceBytes, const void * sourceData ); @@ -170,7 +170,7 @@ void CryptEncrypt ( void CryptDecrypt ( CryptKey * key, - ARRAY(byte) * dest, // padded out to the algorithm's block size + ARRAY(uint8_t) * dest, // padded out to the algorithm's block size unsigned sourceBytes, const void * sourceData ); diff --git a/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtHash.cpp b/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtHash.cpp index ad97460d..62cf25f6 100644 --- a/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtHash.cpp +++ b/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtHash.cpp @@ -57,7 +57,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // These random values were generated by the radioactive decay based // random number generator at www.fourmilab.ch -const dword CHashValue::s_hashTable[] = { +const uint32_t CHashValue::s_hashTable[] = { 0xe8fd2035, 0xaf1add63, 0x049fb872, 0xcf9bb8eb, 0xc30d2a72, 0x15efaec1, 0xd250c7d9, 0xaf3c60a8, 0x17ae32ff, 0x4089cd9e, 0x91dd6936, 0x093f880d, 0x9608ae8f, 0x452c0e11, 0xb6840ffd, 0x3e36c913, 0x393114fd, 0xa72556b2, 0x7c338fb7, 0x4e445027, 0x2864eace, 0x9b0a17d6, 0x108da74b, 0xf2c479c1, diff --git a/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtHash.h b/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtHash.h index 373ee1ab..b2237185 100644 --- a/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtHash.h +++ b/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtHash.h @@ -107,14 +107,14 @@ class TBaseHashTable; class CHashValue { private: - static const dword s_hashTable[]; + static const uint32_t s_hashTable[]; - dword m_result; + uint32_t m_result; inline void Construct () { m_result = 0x325d1eae; } public: - static dword LookupHashBits (unsigned value) { ASSERT(value < 0x100); return s_hashTable[value]; } + static uint32_t LookupHashBits (unsigned value) { ASSERT(value < 0x100); return s_hashTable[value]; } inline CHashValue () { Construct() ; } inline CHashValue (const CHashValue & source) { m_result = source.m_result; } @@ -122,7 +122,7 @@ public: inline CHashValue & operator= (const CHashValue & source) { m_result = source.m_result; return *this; } inline bool operator== (const CHashValue & source) const { return (m_result == source.m_result); } - inline dword GetHash () const { return m_result; } + inline uint32_t GetHash () const { return m_result; } forceinline void Hash (const void * data, unsigned bytes); forceinline void Hash8 (unsigned data); @@ -133,7 +133,7 @@ public: //=========================================================================== void CHashValue::Hash (const void * data, unsigned bytes) { - for (const byte * curr = (const byte *)data, * term = curr + bytes; curr != term; ++curr) + for (const uint8_t * curr = (const uint8_t *)data, * term = curr + bytes; curr != term; ++curr) Hash8(*curr); } @@ -341,7 +341,7 @@ void TBaseHashTable::Clear () { //=========================================================================== template void TBaseHashTable::Delete (T * object) { - DEL(object); + delete object; } //=========================================================================== @@ -359,13 +359,13 @@ unsigned & TBaseHashTable::GetHash (T * object) { //=========================================================================== template const THashLink & TBaseHashTable::GetLink (const T * object) const { - return *(const THashLink *)((const byte *)object + m_linkOffset); + return *(const THashLink *)((const uint8_t *)object + m_linkOffset); } //=========================================================================== template THashLink & TBaseHashTable::GetLink (T * object) { - return *(THashLink *)((byte *)object + m_linkOffset); + return *(THashLink *)((uint8_t *)object + m_linkOffset); } //=========================================================================== @@ -555,7 +555,7 @@ template T * THashTable::Unduplicate (T * object, const K & key) { T * existing = Find(key); if (existing) { - DEL(object); + delete object; return existing; } else { @@ -706,8 +706,8 @@ public: } }; -typedef THashKeyStrPtr< wchar, THashKeyStrCmp > CHashKeyStrPtr; -typedef THashKeyStrPtr< wchar, THashKeyStrCmpI > CHashKeyStrPtrI; +typedef THashKeyStrPtr< wchar_t, THashKeyStrCmp > CHashKeyStrPtr; +typedef THashKeyStrPtr< wchar_t, THashKeyStrCmpI > CHashKeyStrPtrI; typedef THashKeyStrPtr< char, THashKeyStrCmp > CHashKeyStrPtrChar; typedef THashKeyStrPtr< char, THashKeyStrCmpI > CHashKeyStrPtrCharI; @@ -730,7 +730,7 @@ public: } void SetString (const C str[]) { // deprecated if (this->m_str) - FREE(const_cast(this->m_str)); + free(const_cast(this->m_str)); if (str) this->m_str = StrDup(str); else @@ -738,7 +738,7 @@ public: } }; -typedef THashKeyStr< wchar, THashKeyStrCmp > CHashKeyStr; -typedef THashKeyStr< wchar, THashKeyStrCmpI > CHashKeyStrI; +typedef THashKeyStr< wchar_t, THashKeyStrCmp > CHashKeyStr; +typedef THashKeyStr< wchar_t, THashKeyStrCmpI > CHashKeyStrI; typedef THashKeyStr< char, THashKeyStrCmp > CHashKeyStrChar; typedef THashKeyStr< char, THashKeyStrCmpI > CHashKeyStrCharI; diff --git a/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtList.cpp b/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtList.cpp index 04cafb58..819dc6f2 100644 --- a/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtList.cpp +++ b/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtList.cpp @@ -56,7 +56,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com ***/ //=========================================================================== -void CBaseList::Link (CBaseList * list, byte * afterNode, byte * beforeNode, ELinkType linkType, byte * existingNode) { +void CBaseList::Link (CBaseList * list, uint8_t * afterNode, uint8_t * beforeNode, ELinkType linkType, uint8_t * existingNode) { // Verify that the two lists share a common link offset ASSERT(m_linkOffset != LINK_OFFSET_UNINIT); @@ -76,8 +76,8 @@ void CBaseList::Link (CBaseList * list, byte * afterNode, byte * beforeNode, ELi ASSERT(firstLink != beforeLink); // Store nodes for later use in linking - byte * firstNode = afterLink->m_next; - byte * lastNextNode = lastLink->m_next; + uint8_t * firstNode = afterLink->m_next; + uint8_t * lastNextNode = lastLink->m_next; ASSERT(firstNode); ASSERT(lastNextNode); diff --git a/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtList.h b/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtList.h index d3fb70d3..2abbbf8d 100644 --- a/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtList.h +++ b/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtList.h @@ -100,25 +100,25 @@ class TList; class CBaseLink { friend class CBaseList; - inline static bool TermCheck (byte * ptr); - inline static byte * TermMark (byte * ptr); - inline static byte * TermUnmarkAlways (byte * ptr); + inline static bool TermCheck (uint8_t * ptr); + inline static uint8_t * TermMark (uint8_t * ptr); + inline static uint8_t * TermUnmarkAlways (uint8_t * ptr); protected: CBaseLink * volatile m_prevLink; - byte * volatile m_next; + uint8_t * volatile m_next; inline int CalcLinkOffset () const; inline void InitializeLinks (); inline void InitializeLinksWithOffset (int linkOffset); - inline void InsertAfter (byte * node, CBaseLink * prevLink, int linkOffset); - inline void InsertBefore (byte * node, CBaseLink * nextLink); - inline byte * Next () const; - inline byte * NextIgnoreTerm () const; - inline byte * NextUnchecked () const; + inline void InsertAfter (uint8_t * node, CBaseLink * prevLink, int linkOffset); + inline void InsertBefore (uint8_t * node, CBaseLink * nextLink); + inline uint8_t * Next () const; + inline uint8_t * NextIgnoreTerm () const; + inline uint8_t * NextUnchecked () const; inline CBaseLink * NextLink () const; inline CBaseLink * NextLink (int linkOffset) const; - inline byte * Prev () const; + inline uint8_t * Prev () const; inline void UnlinkFromNeighbors (); public: @@ -160,24 +160,24 @@ CBaseLink & CBaseLink::operator= (const CBaseLink & source) { //=========================================================================== int CBaseLink::CalcLinkOffset () const { - return (int)((byte *)this - m_prevLink->NextIgnoreTerm()); + return (int)((uint8_t *)this - m_prevLink->NextIgnoreTerm()); } //=========================================================================== void CBaseLink::InitializeLinks () { - ASSERT(!((unsigned_ptr)this & 3)); + ASSERT(!((uintptr_t)this & 3)); m_prevLink = this; - m_next = TermMark((byte *)this); + m_next = TermMark((uint8_t *)this); } //=========================================================================== void CBaseLink::InitializeLinksWithOffset (int linkOffset) { m_prevLink = this; - m_next = TermMark((byte *)this - linkOffset); + m_next = TermMark((uint8_t *)this - linkOffset); } //=========================================================================== -void CBaseLink::InsertAfter (byte * node, CBaseLink * prevLink, int linkOffset) { +void CBaseLink::InsertAfter (uint8_t * node, CBaseLink * prevLink, int linkOffset) { UnlinkFromNeighbors(); m_prevLink = prevLink; m_next = prevLink->m_next; @@ -186,7 +186,7 @@ void CBaseLink::InsertAfter (byte * node, CBaseLink * prevLink, int linkOffset) } //=========================================================================== -void CBaseLink::InsertBefore (byte * node, CBaseLink * nextLink) { +void CBaseLink::InsertBefore (uint8_t * node, CBaseLink * nextLink) { UnlinkFromNeighbors(); m_prevLink = nextLink->m_prevLink; m_next = m_prevLink->m_next; @@ -200,17 +200,17 @@ bool CBaseLink::IsLinked () const { } //=========================================================================== -byte * CBaseLink::Next () const { +uint8_t * CBaseLink::Next () const { return TermCheck(m_next) ? nil : m_next; } //=========================================================================== -byte * CBaseLink::NextIgnoreTerm () const { +uint8_t * CBaseLink::NextIgnoreTerm () const { return TermUnmarkAlways(m_next); } //=========================================================================== -byte * CBaseLink::NextUnchecked () const { +uint8_t * CBaseLink::NextUnchecked () const { return m_next; } @@ -226,27 +226,27 @@ CBaseLink * CBaseLink::NextLink (int linkOffset) const { } //=========================================================================== -byte * CBaseLink::Prev () const { +uint8_t * CBaseLink::Prev () const { return m_prevLink->m_prevLink->Next(); } //=========================================================================== -bool CBaseLink::TermCheck (byte * ptr) { - return (unsigned_ptr)ptr & 1; +bool CBaseLink::TermCheck (uint8_t * ptr) { + return (uintptr_t)ptr & 1; } //=========================================================================== -byte * CBaseLink::TermMark (byte * ptr) { +uint8_t * CBaseLink::TermMark (uint8_t * ptr) { // Converts an unmarked pointer to a marked pointer ASSERT(!TermCheck(ptr)); - return (byte *)((unsigned_ptr)ptr + 1); + return (uint8_t *)((uintptr_t)ptr + 1); } //=========================================================================== -byte * CBaseLink::TermUnmarkAlways (byte * ptr) { +uint8_t * CBaseLink::TermUnmarkAlways (uint8_t * ptr) { // Returns an unmarked pointer regardless of whether the source pointer // was marked on unmarked - return (byte *)((unsigned_ptr)ptr & ~1); + return (uint8_t *)((uintptr_t)ptr & ~1); } //=========================================================================== @@ -333,16 +333,16 @@ private: CBaseLink m_terminator; protected: - inline CBaseLink * GetLink (const byte * node) const; - inline byte * Head () const; - inline bool IsLinked (const byte * node) const; - inline void Link (byte * node, ELinkType linkType, byte * existingNode); - void Link (CBaseList * list, byte * afterNode, byte * beforeNode, ELinkType linkType, byte * existingNode); - inline byte * Next (const byte * node) const; - inline byte * NextUnchecked (const byte * node) const; - inline byte * Prev (byte * node) const; - inline byte * Tail () const; - inline void Unlink (byte * node); + inline CBaseLink * GetLink (const uint8_t * node) const; + inline uint8_t * Head () const; + inline bool IsLinked (const uint8_t * node) const; + inline void Link (uint8_t * node, ELinkType linkType, uint8_t * existingNode); + void Link (CBaseList * list, uint8_t * afterNode, uint8_t * beforeNode, ELinkType linkType, uint8_t * existingNode); + inline uint8_t * Next (const uint8_t * node) const; + inline uint8_t * NextUnchecked (const uint8_t * node) const; + inline uint8_t * Prev (uint8_t * node) const; + inline uint8_t * Tail () const; + inline void Unlink (uint8_t * node); public: inline CBaseList (); @@ -376,23 +376,23 @@ CBaseList & CBaseList::operator= (const CBaseList & source) { } //=========================================================================== -CBaseLink * CBaseList::GetLink (const byte * node) const { +CBaseLink * CBaseList::GetLink (const uint8_t * node) const { return (CBaseLink *)(node + m_linkOffset); } //=========================================================================== -byte * CBaseList::Head () const { +uint8_t * CBaseList::Head () const { return m_terminator.Next(); } //=========================================================================== -bool CBaseList::IsLinked (const byte * node) const { +bool CBaseList::IsLinked (const uint8_t * node) const { ASSERT(node); return GetLink(node)->IsLinked(); } //=========================================================================== -void CBaseList::Link (byte * node, ELinkType linkType, byte * existingNode) { +void CBaseList::Link (uint8_t * node, ELinkType linkType, uint8_t * existingNode) { ASSERT(node != existingNode); ASSERT(m_linkOffset != LINK_OFFSET_UNINIT); ASSERT((linkType == kListLinkAfter) || (linkType == kListLinkBefore)); @@ -403,19 +403,19 @@ void CBaseList::Link (byte * node, ELinkType linkType, byte * existingNode) { } //=========================================================================== -byte * CBaseList::Next (const byte * node) const { +uint8_t * CBaseList::Next (const uint8_t * node) const { ASSERT(node); return GetLink(node)->Next(); } //=========================================================================== -byte * CBaseList::NextUnchecked (const byte * node) const { +uint8_t * CBaseList::NextUnchecked (const uint8_t * node) const { ASSERT(node); return GetLink(node)->NextUnchecked(); } //=========================================================================== -byte * CBaseList::Prev (byte * node) const { +uint8_t * CBaseList::Prev (uint8_t * node) const { ASSERT(node); return GetLink(node)->Prev(); } @@ -429,12 +429,12 @@ void CBaseList::SetLinkOffset (int linkOffset) { } //=========================================================================== -byte * CBaseList::Tail () const { +uint8_t * CBaseList::Tail () const { return m_terminator.Prev(); } //=========================================================================== -void CBaseList::Unlink (byte * node) { +void CBaseList::Unlink (uint8_t * node) { ASSERT(node); GetLink(node)->Unlink(); } @@ -485,7 +485,7 @@ void TList::Clear () { //=========================================================================== template void TList::Delete (T * node) { - DEL(node); + delete node; } //=========================================================================== @@ -503,49 +503,49 @@ const T * TList::Head () const { //=========================================================================== template bool TList::IsLinked (const T * node) const { - return CBaseList::IsLinked((const byte *)node); + return CBaseList::IsLinked((const uint8_t *)node); } //=========================================================================== template void TList::Link (T * node, ELinkType linkType, T * existingNode) { - CBaseList::Link((byte *)node, linkType, (byte *)existingNode); + CBaseList::Link((uint8_t *)node, linkType, (uint8_t *)existingNode); } //=========================================================================== template void TList::Link (TList * list, ELinkType linkType, T * existingNode) { - CBaseList::Link(list, nil, nil, linkType, (byte *)existingNode); + CBaseList::Link(list, nil, nil, linkType, (uint8_t *)existingNode); } //=========================================================================== template void TList::Link (TList * list, T * afterNode, T * beforeNode, ELinkType linkType, T * existingNode) { - CBaseList::Link(list, (byte *)afterNode, (byte *)beforeNode, linkType, (byte *)existingNode); + CBaseList::Link(list, (uint8_t *)afterNode, (uint8_t *)beforeNode, linkType, (uint8_t *)existingNode); } //=========================================================================== template inline T * TList::Next (const T * node) { - return (T *)CBaseList::Next((byte *)node); + return (T *)CBaseList::Next((uint8_t *)node); } //=========================================================================== template inline const T * TList::Next (const T * node) const { - return (const T *)CBaseList::Next((byte *)node); + return (const T *)CBaseList::Next((uint8_t *)node); } //=========================================================================== template inline T * TList::NextUnchecked (const T * node) { - return (T *)CBaseList::NextUnchecked((byte *)node); + return (T *)CBaseList::NextUnchecked((uint8_t *)node); } //=========================================================================== template inline const T * TList::NextUnchecked (const T * node) const { - return (const T *)CBaseList::NextUnchecked((byte *)node); + return (const T *)CBaseList::NextUnchecked((uint8_t *)node); } //=========================================================================== @@ -557,11 +557,7 @@ inline T * TList::New (ELinkType linkType, T * existingNode, const char file[ //=========================================================================== template inline T * TList::NewFlags (unsigned flags, ELinkType linkType, T * existingNode, const char file[], int line) { - if (!file) { - file = __FILE__; - line = __LINE__; - } - T * node = new(MemAlloc(sizeof(T), flags, file, line)) T; + T * node = new T(); if (linkType != kListUnlinked) Link(node, linkType, existingNode); return node; @@ -576,13 +572,13 @@ inline T * TList::NewZero (ELinkType linkType, T * existingNode, const char f //=========================================================================== template inline T * TList::Prev (const T * node) { - return (T *)CBaseList::Prev((byte *)node); + return (T *)CBaseList::Prev((uint8_t *)node); } //=========================================================================== template inline const T * TList::Prev (const T * node) const { - return (const T *)CBaseList::Prev((byte *)node); + return (const T *)CBaseList::Prev((uint8_t *)node); } //=========================================================================== @@ -600,7 +596,7 @@ inline const T * TList::Tail () const { //=========================================================================== template inline void TList::Unlink (T * node) { - CBaseList::Unlink((byte *)node); + CBaseList::Unlink((uint8_t *)node); } diff --git a/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtMath.cpp b/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtMath.cpp index 34696cce..8677abd6 100644 --- a/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtMath.cpp +++ b/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtMath.cpp @@ -58,15 +58,15 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com //=========================================================================== #ifndef _M_IX86 -unsigned MathHighBitPos (dword val) { +unsigned MathHighBitPos (uint32_t val) { ASSERT(val); double f = (double)val; - return (*((dword *)&f + 1) >> 20) - 1023; + return (*((uint32_t *)&f + 1) >> 20) - 1023; } #else -__declspec(naked) unsigned __fastcall MathHighBitPos (dword) { +__declspec(naked) unsigned __fastcall MathHighBitPos (uint32_t) { __asm { bsr eax, ecx ret 0 @@ -78,16 +78,16 @@ __declspec(naked) unsigned __fastcall MathHighBitPos (dword) { //=========================================================================== #ifndef _M_IX86 -unsigned MathLowBitPos (dword val) { +unsigned MathLowBitPos (uint32_t val) { val &= ~(val - 1); // clear all but the low bit ASSERT(val); double f = (double)val; - return (*((dword *)&f + 1) >> 20) - 1023; + return (*((uint32_t *)&f + 1) >> 20) - 1023; } #else -__declspec(naked) unsigned __fastcall MathLowBitPos (dword) { +__declspec(naked) unsigned __fastcall MathLowBitPos (uint32_t) { __asm { bsf eax, ecx ret 0 diff --git a/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtMath.h b/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtMath.h index db19d077..a73362af 100644 --- a/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtMath.h +++ b/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtMath.h @@ -70,11 +70,11 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com * ***/ -unsigned MATHCALL MathLowBitPos (dword val); -unsigned MATHCALL MathHighBitPos (dword val); +unsigned MATHCALL MathLowBitPos (uint32_t val); +unsigned MATHCALL MathHighBitPos (uint32_t val); //=========================================================================== -inline unsigned MathBitCount (dword val) { +inline unsigned MathBitCount (uint32_t val) { val = val - ((val >> 1) & 033333333333) - ((val >> 2) & 011111111111); val = ((val + (val >> 3)) & 030707070707); val = val + (val >> 6); @@ -89,7 +89,7 @@ inline unsigned MathBitMaskCreate (unsigned count) { } //=========================================================================== -inline dword MathHighBitValue (dword val) { +inline uint32_t MathHighBitValue (uint32_t val) { return val ? 1 << MathHighBitPos(val) : 0; } @@ -111,6 +111,6 @@ inline unsigned MathNextMultiplePow2 (unsigned val, unsigned multiple) { } //=========================================================================== -inline dword MathNextPow2 (dword val) { +inline uint32_t MathNextPow2 (uint32_t val) { return MathIsPow2(val) ? val : 1 << (MathHighBitPos(val) + 1); } diff --git a/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtMisc.h b/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtMisc.h index aaf27bfa..ea9d425f 100644 --- a/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtMisc.h +++ b/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtMisc.h @@ -57,7 +57,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com * ***/ -const wchar UNICODE_BOM = 0xfeff; // Unicode byte-order mark +const wchar_t UNICODE_BOM = 0xfeff; // Unicode byte-order mark const char UTF8_BOM[] = "\xef\xbb\xbf"; @@ -77,7 +77,7 @@ void * ModuleGetInstance (); * ***/ -const wchar * AppGetCommandLine (); +const wchar_t * AppGetCommandLine (); /***************************************************************************** @@ -85,7 +85,7 @@ const wchar * AppGetCommandLine (); * System info functions * ***/ -void MachineGetName (wchar * computerName, unsigned length = 32); +void MachineGetName (wchar_t * computerName, unsigned length = 32); /***************************************************************************** @@ -97,7 +97,7 @@ void MachineGetName (wchar * computerName, unsigned length = 32); // used to dump the internal state of a module typedef void (CDECL * FStateDump)( void * param, - const wchar fmt[], + const wchar_t fmt[], ... ); @@ -133,7 +133,7 @@ struct MemoryStatus { void MemoryGetStatus (MemoryStatus * status); struct DiskStatus { - wchar name[16]; + wchar_t name[16]; unsigned totalSpaceMB; unsigned freeSpaceMB; }; @@ -142,9 +142,9 @@ void DiskGetStatus (ARRAY(DiskStatus) * disks); void CpuGetInfo ( - word * cpuCaps, - dword * cpuVendor, - word * cpuSignature + uint16_t * cpuCaps, + uint32_t * cpuVendor, + uint16_t * cpuSignature ); // CPU capability flags diff --git a/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtPath.cpp b/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtPath.cpp index 125b6bb8..c7d3b96a 100644 --- a/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtPath.cpp +++ b/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtPath.cpp @@ -57,7 +57,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com //=========================================================================== void PathGetProgramDirectory ( - wchar *dst, + wchar_t *dst, unsigned dstChars ) { ASSERT(dst); @@ -69,15 +69,15 @@ void PathGetProgramDirectory ( //=========================================================================== void PathAddFilename ( - wchar *dst, - const wchar src[], - const wchar fname[], + wchar_t *dst, + const wchar_t src[], + const wchar_t fname[], unsigned dstChars ) { ASSERT(dst); ASSERT(dstChars); - wchar temp[MAX_PATH]; + wchar_t temp[MAX_PATH]; if (dst == src) { StrCopy(temp, src, arrsize(temp)); src = temp; @@ -92,42 +92,42 @@ void PathAddFilename ( //=========================================================================== void PathRemoveFilename ( - wchar *dst, - const wchar src[], + wchar_t *dst, + const wchar_t src[], unsigned dstChars ) { ASSERT(dst); ASSERT(src); ASSERT(dstChars); - wchar drive[MAX_DRIVE]; - wchar dir[MAX_DIR]; + wchar_t drive[MAX_DRIVE]; + wchar_t dir[MAX_DIR]; PathSplitPath(src, drive, dir, 0, 0); PathMakePath(dst, dstChars, drive, dir, 0, 0); } //=========================================================================== void PathRemoveExtension ( - wchar *dst, - const wchar src[], + wchar_t *dst, + const wchar_t src[], unsigned dstChars ) { ASSERT(dst); ASSERT(src); ASSERT(dstChars); - wchar drive[MAX_DRIVE]; - wchar dir[MAX_DIR]; - wchar fname[MAX_FNAME]; + wchar_t drive[MAX_DRIVE]; + wchar_t dir[MAX_DIR]; + wchar_t fname[MAX_FNAME]; PathSplitPath(src, drive, dir, fname, 0); PathMakePath(dst, dstChars, drive, dir, fname, 0); } //=========================================================================== void PathSetExtension ( - wchar *dst, - const wchar src[], - const wchar ext[], + wchar_t *dst, + const wchar_t src[], + const wchar_t ext[], unsigned dstChars ) { ASSERT(dst); @@ -135,18 +135,18 @@ void PathSetExtension ( ASSERT(dst != ext); ASSERT(dstChars); - wchar drive[MAX_DRIVE]; - wchar dir[MAX_DIR]; - wchar fname[MAX_FNAME]; + wchar_t drive[MAX_DRIVE]; + wchar_t dir[MAX_DIR]; + wchar_t fname[MAX_FNAME]; PathSplitPath(src, drive, dir, fname, 0); PathMakePath(dst, dstChars, drive, dir, fname, ext); } //=========================================================================== void PathAddExtension ( - wchar *dst, - const wchar src[], - const wchar ext[], + wchar_t *dst, + const wchar_t src[], + const wchar_t ext[], unsigned dstChars ) { ASSERT(dst); @@ -154,10 +154,10 @@ void PathAddExtension ( ASSERT(dst != ext); ASSERT(dstChars); - wchar drive[MAX_DRIVE]; - wchar dir[MAX_DIR]; - wchar fname[MAX_FNAME]; - wchar oldext[MAX_EXT]; + wchar_t drive[MAX_DRIVE]; + wchar_t dir[MAX_DIR]; + wchar_t fname[MAX_FNAME]; + wchar_t oldext[MAX_EXT]; PathSplitPath(src, drive, dir, fname, oldext); PathMakePath( dst, @@ -171,16 +171,16 @@ void PathAddExtension ( //=========================================================================== void PathRemoveDirectory ( - wchar *dst, - const wchar src[], + wchar_t *dst, + const wchar_t src[], unsigned dstChars ) { ASSERT(dst); ASSERT(src); ASSERT(dstChars); - wchar fname[MAX_FNAME]; - wchar ext[MAX_EXT]; + wchar_t fname[MAX_FNAME]; + wchar_t ext[MAX_EXT]; PathSplitPath(src, 0, 0, fname, ext); PathMakePath(dst, dstChars, 0, 0, fname, ext); } @@ -194,14 +194,14 @@ void PathRemoveDirectory ( //============================================================================ void PathSplitEmail ( - const wchar emailAddr[], - wchar * user, + const wchar_t emailAddr[], + wchar_t * user, unsigned userChars, - wchar * domain, + wchar_t * domain, unsigned domainChars, - wchar * tld, + wchar_t * tld, unsigned tldChars, - wchar * subDomains, + wchar_t * subDomains, unsigned subDomainChars, unsigned subDomainCount ) { @@ -234,12 +234,12 @@ void PathSplitEmail ( return; // copy email address so we can tokenize it - wchar * tmp = ALLOCA(wchar, len + 1); + wchar_t * tmp = (wchar_t*)malloc(sizeof(wchar_t) * (len + 1)); StrCopy(tmp, emailAddr, len + 1); - const wchar * work = tmp; + const wchar_t * work = tmp; // parse user - wchar token[MAX_PATH]; + wchar_t token[MAX_PATH]; if (!StrTokenize(&work, token, arrsize(token), L"@")) return; @@ -252,12 +252,14 @@ void PathSplitEmail ( return; // parse all domains - ARRAY(wchar *) arr; + ARRAY(wchar_t *) arr; while (StrTokenize(&work, token, arrsize(token), L".")) { unsigned toklen = StrLen(token); - wchar * str = ALLOCA(wchar, toklen + 1); + wchar_t * str = (wchar_t*)malloc(sizeof(wchar_t) * (toklen + 1)); StrCopy(str, token, toklen + 1); arr.Add(str); + + free(str); } // copy domains to output parameters @@ -285,6 +287,8 @@ void PathSplitEmail ( if (subDomains) StrCopy(&SUB_DOMAIN(index), arr[index], subDomainChars); } + + free(tmp); #undef SUB_DOMAIN } diff --git a/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtPath.h b/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtPath.h index 804c62aa..47da6567 100644 --- a/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtPath.h +++ b/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtPath.h @@ -76,9 +76,9 @@ const unsigned kPathFlagRecurse = 1<<4; // also set if "**" used in filesp struct PathFind { unsigned flags; - qword fileLength; - qword lastWriteTime; - wchar name[MAX_PATH]; + uint64_t fileLength; + uint64_t lastWriteTime; + wchar_t name[MAX_PATH]; }; @@ -90,49 +90,49 @@ struct PathFind { void PathFindFiles ( ARRAY(PathFind) * paths, - const wchar fileSpec[], + const wchar_t fileSpec[], unsigned pathFlags ); void PathGetProgramName ( - wchar * dst, + wchar_t * dst, unsigned dstChars ); void PathGetModuleName ( - wchar * dst, + wchar_t * dst, unsigned dstChars ); // this function will use the current directory if is a relative path // (see PathSetCurrentDirectory/PathGetCurrentDirectory) bool PathFromString ( - wchar * dst, - const wchar src[], + wchar_t * dst, + const wchar_t src[], unsigned dstChars ); bool PathFromString ( - wchar * dst, - const wchar src[], + wchar_t * dst, + const wchar_t src[], unsigned dstChars, - const wchar baseDir[] + const wchar_t baseDir[] ); bool PathDoesFileExist ( - const wchar fileName[] + const wchar_t fileName[] ); bool PathDoesDirectoryExist ( - const wchar directory[] + const wchar_t directory[] ); bool PathDeleteFile ( - const wchar file[] + const wchar_t file[] ); bool PathMoveFile ( - const wchar src[], - const wchar dst[] + const wchar_t src[], + const wchar_t dst[] ); bool PathCopyFile ( - const wchar src[], - const wchar dst[] + const wchar_t src[], + const wchar_t dst[] ); @@ -143,41 +143,41 @@ bool PathCopyFile ( ***/ void PathSplitPath ( - const wchar path[], - wchar * drive, - wchar * dir, - wchar * fname, - wchar * ext + const wchar_t path[], + wchar_t * drive, + wchar_t * dir, + wchar_t * fname, + wchar_t * ext ); void PathMakePath ( - wchar * path, + wchar_t * path, unsigned chars, - const wchar drive[], - const wchar dir[], - const wchar fname[], - const wchar ext[] + const wchar_t drive[], + const wchar_t dir[], + const wchar_t fname[], + const wchar_t ext[] ); // c:\dir1 + dir2\file.txt => c:\dir1\dir2\file.txt void PathAddFilename ( - wchar * dst, - const wchar src[], - const wchar fname[], + wchar_t * dst, + const wchar_t src[], + const wchar_t fname[], unsigned dstChars ); // c:\dir1\dir2\file.txt => c:\dir1\dir2\ * note trailing backslash void PathRemoveFilename ( - wchar * dst, - const wchar src[], + wchar_t * dst, + const wchar_t src[], unsigned dstChars ); // c:\file.txt => c:\dir1\dir2\file void PathRemoveExtension ( - wchar * dst, - const wchar src[], + wchar_t * dst, + const wchar_t src[], unsigned dstChars ); @@ -185,9 +185,9 @@ void PathRemoveExtension ( // c:\file. + .out => c:\file.out // c:\file.txt + .out => c:\file.out void PathSetExtension ( - wchar * dst, - const wchar src[], - const wchar ext[], + wchar_t * dst, + const wchar_t src[], + const wchar_t ext[], unsigned dstChars ); @@ -195,41 +195,41 @@ void PathSetExtension ( // c:\file. + .out => c:\file. // c:\file.txt + .out => c:\file.txt void PathAddExtension ( - wchar * dst, - const wchar src[], - const wchar ext[], + wchar_t * dst, + const wchar_t src[], + const wchar_t ext[], unsigned dstChars ); // c:\dir1\dir2\file.txt => file.txt void PathRemoveDirectory ( - wchar * dst, - const wchar src[], + wchar_t * dst, + const wchar_t src[], unsigned dstChars ); // c:\dir1\dir2\file.txt - c:\dir1 => .\dir2\file.txt // c:\dir1\dir2\file1.txt - c:\dir1\dir4\file2.txt => ..\dir4\file2.txt bool PathMakeRelative ( - wchar * dst, + wchar_t * dst, unsigned fromFlags, - const wchar from[], + const wchar_t from[], unsigned toFlags, - const wchar to[], + const wchar_t to[], unsigned dstChars ); bool PathIsRelative ( - const wchar src[] + const wchar_t src[] ); -const wchar * PathFindFilename (const wchar path[]); -inline wchar * PathFindFilename (wchar * path) { - return const_cast(PathFindFilename(const_cast(path))); +const wchar_t * PathFindFilename (const wchar_t path[]); +inline wchar_t * PathFindFilename (wchar_t * path) { + return const_cast(PathFindFilename(const_cast(path))); } -const wchar * PathFindExtension (const wchar path[]); -inline wchar * PathFindExtension (wchar * path) { - return const_cast(PathFindExtension(const_cast(path))); +const wchar_t * PathFindExtension (const wchar_t path[]); +inline wchar_t * PathFindExtension (wchar_t * path) { + return const_cast(PathFindExtension(const_cast(path))); } @@ -260,46 +260,46 @@ const unsigned kPathCreateDirFlagCreateNew = 1<<1; EPathCreateDirError PathCreateDirectory ( - const wchar path[], + const wchar_t path[], unsigned flags ); void PathDeleteDirectory ( - const wchar path[], + const wchar_t path[], unsigned flags ); // Set directory -bool PathSetCurrentDirectory (const wchar path[]); +bool PathSetCurrentDirectory (const wchar_t path[]); void PathSetProgramDirectory (); // Get directory void PathGetProgramDirectory ( - wchar * dst, + wchar_t * dst, unsigned dstChars ); void PathGetCurrentDirectory ( - wchar * dst, + wchar_t * dst, unsigned dstChars ); void PathGetTempDirectory ( - wchar * dst, + wchar_t * dst, unsigned dstChars ); // Product and user-specific common directory locations void PathGetUserDirectory ( - wchar * dst, + wchar_t * dst, unsigned dstChars ); void PathGetLogDirectory ( - wchar * dst, + wchar_t * dst, unsigned dstChars ); void PathGetInitDirectory ( - wchar * dst, + wchar_t * dst, unsigned dstChars ); @@ -312,14 +312,14 @@ void PathGetInitDirectory ( // you may send nil for any fields you don't care about void PathSplitEmail ( - const wchar emailAddr[], - wchar * user, + const wchar_t emailAddr[], + wchar_t * user, unsigned userChars, - wchar * domain, + wchar_t * domain, unsigned domainChars, - wchar * tld, + wchar_t * tld, unsigned tldChars, - wchar * subDomains, // (wchar *)&subs --> wchar subs[16][256]; + wchar_t * subDomains, // (wchar_t *)&subs --> wchar_t subs[16][256]; unsigned subDomainChars, // arrsize(subs[0]) --> 256 unsigned subDomainCount // arrsize(subs) --> 16 ); diff --git a/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtPriQ.h b/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtPriQ.h index 5988a704..a6852ac4 100644 --- a/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtPriQ.h +++ b/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtPriQ.h @@ -143,7 +143,7 @@ inline void TPriorityQueue::Clear () { // Deleting an object could cause other objects in the queue to be deleted // so we can't make any assumptions about indices or counts of items in the array while (C * head = Dequeue()) - DEL(head); + delete head; m_array.Clear(); } @@ -164,7 +164,7 @@ C * TPriorityQueue::Delete (C * object) { unsigned index = priority->GetIndex(); // delete the object - DEL(object); + delete object; // return the next object in that queue if (queue && (index < queue->Count())) @@ -234,14 +234,14 @@ inline void TPriorityQueue::Link (unsigned index) { template inline P * TPriorityQueue::Priority (C * object) { ASSERT(m_linkOffset != LINK_OFFSET_UNINIT); - return (P *)((byte *)object + m_linkOffset); + return (P *)((uint8_t *)object + m_linkOffset); } //=========================================================================== template inline P const * TPriorityQueue::Priority (C const * object) const { ASSERT(m_linkOffset != LINK_OFFSET_UNINIT); - return (P const *)((byte const *)object + m_linkOffset); + return (P const *)((uint8_t const *)object + m_linkOffset); } //=========================================================================== diff --git a/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtRand.cpp b/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtRand.cpp index dc5a788c..90fd78b2 100644 --- a/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtRand.cpp +++ b/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtRand.cpp @@ -56,8 +56,8 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com ***/ class RandomContext { - dword m_seed; - dword m_value; + uint32_t m_seed; + uint32_t m_value; void UpdateValue (); @@ -79,7 +79,7 @@ public: * ***/ -static const dword kDefaultRandomSeed = 0x075bd924; +static const uint32_t kDefaultRandomSeed = 0x075bd924; static RandomContext s_random; @@ -99,11 +99,11 @@ RandomContext::RandomContext () //============================================================================ void RandomContext::UpdateValue () { - const dword A = 0xbc8f; - const dword Q = 0xadc8; - const dword R = 0x0d47; + const uint32_t A = 0xbc8f; + const uint32_t Q = 0xadc8; + const uint32_t R = 0x0d47; - dword div = m_value / Q; + uint32_t div = m_value / Q; m_value = A * (m_value - Q * div) - R * div; if (m_value > kRandomMax) m_value -= kRandomMax + 1; diff --git a/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtRand.h b/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtRand.h index d172394a..437a8664 100644 --- a/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtRand.h +++ b/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtRand.h @@ -57,7 +57,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com * ***/ -const dword kRandomMax = 0x7fffffff; +const uint32_t kRandomMax = 0x7fffffff; void RandReset (); void RandSetSeed (unsigned seed); diff --git a/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtRef.h b/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtRef.h index d4f543db..2473c415 100644 --- a/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtRef.h +++ b/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtRef.h @@ -168,7 +168,7 @@ public: } inline virtual void OnZeroRef () { - DEL(this); + delete this; } protected: diff --git a/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtSkipList.h b/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtSkipList.h index 509f78cf..df4668dd 100644 --- a/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtSkipList.h +++ b/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtSkipList.h @@ -166,7 +166,7 @@ template typename TSkipList::Node* TSkipList::AllocNode (unsigned level) { unsigned size = offsetof(Node, next) + (level + 1) * sizeof(Node); - Node * node = (Node *)ALLOC(size); + Node * node = (Node *)malloc(size); node->level = level; return node; } @@ -175,7 +175,7 @@ typename TSkipList::Node* TSkipList::Alloc template void TSkipList::FreeNode (TNode * node) { - FREE(node); + free(node); } //============================================================================ @@ -243,7 +243,7 @@ void TSkipList::Clear () { Node * ptr = m_head->next[0]; while (ptr != m_stop) { Node * next = ptr->next[0]; - DEL(ptr->object); + delete ptr->object; FreeNode(ptr); ptr = next; } @@ -259,7 +259,7 @@ template void TSkipList::Delete (T * object) { Unlink(object); - DEL(object); + delete object; } //============================================================================ @@ -374,7 +374,7 @@ T * TSkipList::Tail (SkipListTag * tag) const { template void TSkipList::Link (T * object) { - const K * key = (const K *)((const byte *)object + keyOffset); + const K * key = (const K *)((const uint8_t *)object + keyOffset); // Find the node's insertion point m_stop->key = key; @@ -418,7 +418,7 @@ void TSkipList::Link (T * object) { template void TSkipList::Unlink (T * object) { - const K * key = (const K *)((const byte *)object + keyOffset); + const K * key = (const K *)((const uint8_t *)object + keyOffset); Node * node = m_head; Node * update[kMaxLevels]; diff --git a/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtSort.h b/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtSort.h index dcbd85c1..a26d8fb9 100644 --- a/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtSort.h +++ b/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtSort.h @@ -200,7 +200,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com * BSEARCH * * This macro binary searches a sorted array to find an existing entry or -* the position where a TRACKED_NEW entry should be placed. It returns the index of +* the position where a new entry should be placed. It returns the index of * the first entry for which the expression is false (zero or negative), or * count if the expression is true (positive) for all entries. * diff --git a/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtSpareList.cpp b/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtSpareList.cpp index 0b74fa0b..562bfafd 100644 --- a/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtSpareList.cpp +++ b/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtSpareList.cpp @@ -81,7 +81,7 @@ void * CBaseSpareList::Alloc (unsigned objectSize, const char typeName[]) { // initialize memory to a freaky value in debug mode #ifdef HS_DEBUGGING - MemSet(object, (byte) ((unsigned) object >> 4), objectSize); + memset(object, (uint8_t) ((unsigned) object >> 4), objectSize); #endif return object; @@ -91,7 +91,7 @@ void * CBaseSpareList::Alloc (unsigned objectSize, const char typeName[]) { void CBaseSpareList::Free (void * object, unsigned objectSize) { // initialize memory to a freaky value in debug mode #ifdef HS_DEBUGGING - MemSet(object, (byte) ((unsigned) object >> 4), objectSize); + memset(object, (uint8_t) ((unsigned) object >> 4), objectSize); #endif // link memory block onto head of spare list @@ -116,11 +116,8 @@ void CBaseSpareList::GrowSpareList (unsigned objectSize, const char typeName[]) // allocate a block of memory to hold a bunch // of T-objects, but allocate them as "raw" memory - AllocNode * allocNode = (AllocNode *) MemAlloc( - sizeof(AllocNode) + objectSize * m_chunkSize, - 0, // flags - typeName, // file - 0 // line + AllocNode * allocNode = (AllocNode *) malloc( + sizeof(AllocNode) + objectSize * m_chunkSize ); // link allocation onto head of allocation list @@ -129,11 +126,11 @@ void CBaseSpareList::GrowSpareList (unsigned objectSize, const char typeName[]) // chain newly created raw memory units together onto the spare list SpareNode * spareCurr = (SpareNode *) (allocNode + 1); - SpareNode * spareEnd = (SpareNode *) ((byte *) spareCurr + objectSize * m_chunkSize); + SpareNode * spareEnd = (SpareNode *) ((uint8_t *) spareCurr + objectSize * m_chunkSize); do { spareCurr->spareNext = m_spareHead; m_spareHead = spareCurr; - spareCurr = (SpareNode *) ((byte *) spareCurr + objectSize); + spareCurr = (SpareNode *) ((uint8_t *) spareCurr + objectSize); } while (spareCurr < spareEnd); } @@ -141,7 +138,7 @@ void CBaseSpareList::GrowSpareList (unsigned objectSize, const char typeName[]) void CBaseSpareList::CleanUp (const char typeName[]) { // warn of resource leaks #ifdef SPARELIST_TRACK_MEMORY - if (m_unfreedObjects && !ErrorGetOption(kErrOptDisableMemLeakChecking)) { + if (m_unfreedObjects) { #ifdef CLIENT { char buffer[256]; @@ -159,7 +156,7 @@ void CBaseSpareList::CleanUp (const char typeName[]) { // walk chain of AllocNodes and free each of them while (m_allocHead) { AllocNode * allocNext = m_allocHead->allocNext; - FREE(m_allocHead); + free(m_allocHead); m_allocHead = allocNext; } diff --git a/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtSpareList.h b/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtSpareList.h index 33617b61..280c4b1c 100644 --- a/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtSpareList.h +++ b/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtSpareList.h @@ -80,7 +80,7 @@ protected: private: union AllocNode { AllocNode * allocNext; - qword align; + uint64_t align; }; AllocNode * m_allocHead; unsigned m_chunkSize; diff --git a/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtStr.cpp b/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtStr.cpp index cb70c736..d75b6d7b 100644 --- a/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtStr.cpp +++ b/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtStr.cpp @@ -57,7 +57,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // These random values were generated by the radioactive decay based // random number generator at www.fourmilab.ch -static dword s_hashValue[] = { +static uint32_t s_hashValue[] = { 0xc30d2a72, 0x15efaec1, 0xd250c7d9, 0xaf3c60a8, 0x9608ae8f, 0x452c0e11, 0xb6840ffd, 0x3e36c913, 0x2864eace, 0x9b0a17d6, 0x108da74b, 0xf2c479c1, @@ -75,7 +75,7 @@ static dword s_hashValue[] = { template static chartype * IStrDup (const chartype str[]) { unsigned chars = IStrLen(str) + 1; - chartype * buffer = (chartype *)ALLOC(chars * sizeof(chartype)); + chartype * buffer = (chartype *)malloc(chars * sizeof(chartype)); IStrCopy(buffer, str, chars); return buffer; } @@ -86,7 +86,7 @@ static chartype * IStrDupLen (const chartype str[], unsigned chars) { unsigned len = IStrLen(str) + 1; if (len > chars) len = chars; - chartype * buffer = (chartype *)ALLOC(len * sizeof(chartype)); + chartype * buffer = (chartype *)malloc(len * sizeof(chartype)); IStrCopy(buffer, str, len); return buffer; } @@ -115,7 +115,7 @@ static chartype * IStrChrR (chartype * str, findchartype ch) { } //=========================================================================== -static inline bool ICharUnicodeToUtf8 (char ** dest, const wchar * source[], unsigned destChars) { +static inline bool ICharUnicodeToUtf8 (char ** dest, const wchar_t * source[], unsigned destChars) { unsigned ch = *(*source)++; bool result = false; if (ch < 0x80) { @@ -143,7 +143,7 @@ static inline bool ICharUnicodeToUtf8 (char ** dest, const wchar * source[], uns } //=========================================================================== -static inline void ICharUtf8ToUnicode (wchar ** dest, const char * source[]) { +static inline void ICharUtf8ToUnicode (wchar_t ** dest, const char * source[]) { unsigned result, remaining; if ((**source & 0xf0) == 0xe0) { result = *(*source)++ & 0x0f; @@ -165,7 +165,7 @@ static inline void ICharUtf8ToUnicode (wchar ** dest, const char * source[]) { for (; remaining-- && *source; ++*source) if ((**source & 0xc0) == 0x80) result = (result << 6) | (**source & 0x3f); - *(*dest)++ = (wchar)result; + *(*dest)++ = (wchar_t)result; } //=========================================================================== @@ -317,10 +317,10 @@ static void IStrLower (chartype * dest, const chartype source[], unsigned chars) //=========================================================================== template -static dword IStrHash (const chartype str[], unsigned chars) { - dword temp0 = 0xE2C15C9D; - dword temp1 = 0x2170A28A; - dword result = 0x325D1EAE; +static uint32_t IStrHash (const chartype str[], unsigned chars) { + uint32_t temp0 = 0xE2C15C9D; + uint32_t temp1 = 0x2170A28A; + uint32_t result = 0x325D1EAE; for (unsigned ch; chars-- && ((ch = (unsigned)*str) != 0); ++str) { temp0 = (temp0 << 3) ^ ch; temp1 += s_hashValue[temp0 & 0x0F]; @@ -331,10 +331,10 @@ static dword IStrHash (const chartype str[], unsigned chars) { //=========================================================================== template -static dword IStrHashI (const chartype str[], unsigned chars) { - dword temp0 = 0xE2C15C9D; - dword temp1 = 0x2170A28A; - dword result = 0x325D1EAE; +static uint32_t IStrHashI (const chartype str[], unsigned chars) { + uint32_t temp0 = 0xE2C15C9D; + uint32_t temp1 = 0x2170A28A; + uint32_t result = 0x325D1EAE; for (unsigned ch; chars-- && ((ch = (unsigned)*str) != 0); ++str) { if ((ch >= 'a') && (ch <= 'z')) ch = ch + 'A' - 'a'; @@ -438,7 +438,7 @@ char * StrDup (const char str[]) { } //=========================================================================== -wchar * StrDup (const wchar str[]) { +wchar_t * StrDup (const wchar_t str[]) { return IStrDup(str); } @@ -448,22 +448,22 @@ char * StrDupLen (const char str[], unsigned chars) { } //=========================================================================== -wchar * StrDupLen (const wchar str[], unsigned chars) { +wchar_t * StrDupLen (const wchar_t str[], unsigned chars) { return IStrDupLen(str, chars); } //============================================================================ -wchar * StrDupToUnicode (const char str[]) { - unsigned bytes = StrBytes(str) * sizeof(wchar); - wchar * dst = (wchar*)ALLOC(bytes); - StrToUnicode(dst, str, bytes / sizeof(wchar)); +wchar_t * StrDupToUnicode (const char str[]) { + unsigned bytes = StrBytes(str) * sizeof(wchar_t); + wchar_t * dst = (wchar_t*)malloc(bytes); + StrToUnicode(dst, str, bytes / sizeof(wchar_t)); return dst; } //============================================================================ -char * StrDupToAnsi (const wchar str[]) { - unsigned bytes = StrBytes(str) / sizeof(wchar); - char * dst = (char*)ALLOC(bytes); +char * StrDupToAnsi (const wchar_t str[]) { + unsigned bytes = StrBytes(str) / sizeof(wchar_t); + char * dst = (char*)malloc(bytes); StrToAnsi(dst, str, bytes); return dst; } @@ -474,7 +474,7 @@ unsigned StrBytes (const char str[]) { // includes space for terminator } //=========================================================================== -unsigned StrBytes (const wchar str[]) { // includes space for terminator +unsigned StrBytes (const wchar_t str[]) { // includes space for terminator return (IStrLen(str) + 1) * sizeof(str[0]); } @@ -484,7 +484,7 @@ char * StrChr (char * str, char ch, unsigned chars) { } //=========================================================================== -wchar * StrChr (wchar * str, wchar ch, unsigned chars) { +wchar_t * StrChr (wchar_t * str, wchar_t ch, unsigned chars) { return IStrChr(str, ch, chars); } @@ -494,7 +494,7 @@ const char * StrChr (const char str[], char ch, unsigned chars) { } //=========================================================================== -const wchar * StrChr (const wchar str[], wchar ch, unsigned chars) { +const wchar_t * StrChr (const wchar_t str[], wchar_t ch, unsigned chars) { return IStrChr(str, ch, chars); } @@ -504,7 +504,7 @@ char * StrChrR (char * str, char ch) { } //=========================================================================== -wchar * StrChrR (wchar * str, wchar ch) { +wchar_t * StrChrR (wchar_t * str, wchar_t ch) { return IStrChrR(str, ch); } @@ -514,7 +514,7 @@ const char * StrChrR (const char str[], char ch) { } //=========================================================================== -const wchar * StrChrR (const wchar str[], wchar ch) { +const wchar_t * StrChrR (const wchar_t str[], wchar_t ch) { return IStrChrR(str, ch); } @@ -528,7 +528,7 @@ unsigned StrPrintf (char * dest, unsigned count, const char format[], ...) { } //=========================================================================== -unsigned StrPrintf (wchar * dest, unsigned count, const wchar format[], ...) { +unsigned StrPrintf (wchar_t * dest, unsigned count, const wchar_t format[], ...) { va_list argList; va_start(argList, format); int result = _vsnwprintf(dest, count, format, argList); @@ -543,7 +543,7 @@ unsigned StrPrintfV (char * dest, unsigned count, const char format[], va_list a } //=========================================================================== -unsigned StrPrintfV (wchar * dest, unsigned count, const wchar format[], va_list args) { +unsigned StrPrintfV (wchar_t * dest, unsigned count, const wchar_t format[], va_list args) { int result = _vsnwprintf(dest, count, format, args); return IStrPrintfValidate(dest, count, result); } @@ -554,7 +554,7 @@ int StrCmp (const char str1[], const char str2[], unsigned chars) { } //=========================================================================== -int StrCmp (const wchar str1[], const wchar str2[], unsigned chars) { +int StrCmp (const wchar_t str1[], const wchar_t str2[], unsigned chars) { return IStrCmp(str1, str2, chars); } @@ -564,7 +564,7 @@ int StrCmpI (const char str1[], const char str2[], unsigned chars) { } //=========================================================================== -int StrCmpI (const wchar str1[], const wchar str2[], unsigned chars) { +int StrCmpI (const wchar_t str1[], const wchar_t str2[], unsigned chars) { return IStrCmpI(str1, str2, chars); } @@ -574,7 +574,7 @@ void StrCopy (char * dest, const char source[], unsigned chars) { } //=========================================================================== -void StrCopy (wchar * dest, const wchar source[], unsigned chars) { +void StrCopy (wchar_t * dest, const wchar_t source[], unsigned chars) { IStrCopy(dest, source, chars); } @@ -584,7 +584,7 @@ unsigned StrCopyLen (char * dest, const char source[], unsigned chars) { } //=========================================================================== -unsigned StrCopyLen (wchar * dest, const wchar source[], unsigned chars) { +unsigned StrCopyLen (wchar_t * dest, const wchar_t source[], unsigned chars) { return IStrCopyLen(dest, source, chars); } @@ -594,7 +594,7 @@ void StrPack (char * dest, const char source[], unsigned chars) { } //=========================================================================== -void StrPack (wchar * dest, const wchar source[], unsigned chars) { +void StrPack (wchar_t * dest, const wchar_t source[], unsigned chars) { IStrPack(dest, source, chars); } @@ -609,13 +609,13 @@ const char * StrStr (const char source[], const char match[]) { } //=========================================================================== -wchar * StrStr (wchar * source, const wchar match[]) { +wchar_t * StrStr (wchar_t * source, const wchar_t match[]) { return IStrStr(source, match); } //=========================================================================== -const wchar * StrStr (const wchar source[], const wchar match[]) { - return IStrStr(source, match); +const wchar_t * StrStr (const wchar_t source[], const wchar_t match[]) { + return IStrStr(source, match); } //=========================================================================== @@ -629,13 +629,13 @@ const char * StrStrI (const char source[], const char match[]) { } //=========================================================================== -wchar * StrStrI (wchar * source, const wchar match[]) { +wchar_t * StrStrI (wchar_t * source, const wchar_t match[]) { return IStrStrI(source, match); } //=========================================================================== -const wchar * StrStrI (const wchar source[], const wchar match[]) { - return IStrStrI(source, match); +const wchar_t * StrStrI (const wchar_t source[], const wchar_t match[]) { + return IStrStrI(source, match); } //=========================================================================== @@ -644,12 +644,12 @@ unsigned StrLen (const char str[]) { } //=========================================================================== -unsigned StrLen (const wchar str[]) { +unsigned StrLen (const wchar_t str[]) { return IStrLen(str); } //=========================================================================== -unsigned StrUnicodeToUtf8 (char * dest, const wchar source[], unsigned destChars) { +unsigned StrUnicodeToUtf8 (char * dest, const wchar_t source[], unsigned destChars) { char * destCurr = dest; char * destTerm = dest + destChars; while (*source && (destCurr + 1 < destTerm)) @@ -661,9 +661,9 @@ unsigned StrUnicodeToUtf8 (char * dest, const wchar source[], unsigned destChars } //=========================================================================== -unsigned StrUtf8ToUnicode (wchar * dest, const char source[], unsigned destChars) { - wchar * destCurr = dest; - wchar * destTerm = dest + destChars; +unsigned StrUtf8ToUnicode (wchar_t * dest, const char source[], unsigned destChars) { + wchar_t * destCurr = dest; + wchar_t * destTerm = dest + destChars; while (*source && (destCurr + 1 < destTerm)) ICharUtf8ToUnicode(&destCurr, &source); if (destCurr < destTerm) @@ -677,8 +677,8 @@ float StrToFloat (const char source[], const char ** endptr) { } //=========================================================================== -float StrToFloat (const wchar source[], const wchar ** endptr) { - return (float) wcstod(source, const_cast(endptr)); +float StrToFloat (const wchar_t source[], const wchar_t ** endptr) { + return (float) wcstod(source, const_cast(endptr)); } //=========================================================================== @@ -687,8 +687,8 @@ int StrToInt (const char source[], const char ** endptr) { } //=========================================================================== -int StrToInt (const wchar source[], const wchar ** endptr) { - return wcstol(source, const_cast(endptr), 0); +int StrToInt (const wchar_t source[], const wchar_t ** endptr) { + return wcstol(source, const_cast(endptr), 0); } //=========================================================================== @@ -697,8 +697,8 @@ unsigned StrToUnsigned (char source[], char ** endptr, int radix) { } //=========================================================================== -unsigned StrToUnsigned (wchar source[], wchar ** endptr, int radix) { - return wcstoul(source, const_cast(endptr), radix); +unsigned StrToUnsigned (wchar_t source[], wchar_t ** endptr, int radix) { + return wcstoul(source, const_cast(endptr), radix); } //=========================================================================== @@ -707,8 +707,8 @@ unsigned StrToUnsigned (const char source[], const char ** endptr, int radix) { } //=========================================================================== -unsigned StrToUnsigned (const wchar source[], const wchar ** endptr, int radix) { - return wcstoul(source, const_cast(endptr), radix); +unsigned StrToUnsigned (const wchar_t source[], const wchar_t ** endptr, int radix) { + return wcstoul(source, const_cast(endptr), radix); } //=========================================================================== @@ -717,7 +717,7 @@ void StrLower (char * dest, unsigned chars) { } //=========================================================================== -void StrLower (wchar * dest, unsigned chars) { +void StrLower (wchar_t * dest, unsigned chars) { IStrLower(dest, chars); } @@ -727,27 +727,27 @@ void StrLower (char * dest, const char source[], unsigned chars) { } //=========================================================================== -void StrLower (wchar * dest, const wchar source[], unsigned chars) { +void StrLower (wchar_t * dest, const wchar_t source[], unsigned chars) { IStrLower(dest, source, chars); } //============================================================================ -dword StrHash (const char str[], unsigned chars) { +uint32_t StrHash (const char str[], unsigned chars) { return IStrHash(str, chars); } //=========================================================================== -dword StrHash (const wchar str[], unsigned chars) { +uint32_t StrHash (const wchar_t str[], unsigned chars) { return IStrHash(str, chars); } //=========================================================================== -dword StrHashI (const char str[], unsigned chars) { +uint32_t StrHashI (const char str[], unsigned chars) { return IStrHashI(str, chars); } //=========================================================================== -dword StrHashI (const wchar str[], unsigned chars) { +uint32_t StrHashI (const wchar_t str[], unsigned chars) { return IStrHashI(str, chars); } @@ -757,7 +757,7 @@ bool StrTokenize (const char * source[], char * dest, unsigned chars, const char } //=========================================================================== -bool StrTokenize (const wchar * source[], wchar * dest, unsigned chars, const wchar whitespace[], unsigned maxWhitespaceSkipCount) { +bool StrTokenize (const wchar_t * source[], wchar_t * dest, unsigned chars, const wchar_t whitespace[], unsigned maxWhitespaceSkipCount) { return IStrTokenize(source, dest, chars, whitespace, maxWhitespaceSkipCount); } @@ -767,6 +767,6 @@ bool StrTokenize (const char * source[], ARRAY(char) * destArray, const char whi } //=========================================================================== -bool StrTokenize (const wchar * source[], ARRAY(wchar) * destArray, const wchar whitespace[], unsigned maxWhitespaceSkipCount) { +bool StrTokenize (const wchar_t * source[], ARRAY(wchar_t) * destArray, const wchar_t whitespace[], unsigned maxWhitespaceSkipCount) { return IStrTokenize(source, destArray, whitespace, maxWhitespaceSkipCount); } diff --git a/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtStr.h b/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtStr.h index 8729bcca..538f0437 100644 --- a/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtStr.h +++ b/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtStr.h @@ -58,99 +58,99 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com ***/ inline char CharLowerFast (char ch) { return ((ch >= 'A') && (ch <= 'Z')) ? (char )(ch + 'a' - 'A') : ch; } -inline wchar CharLowerFast (wchar ch) { return ((ch >= L'A') && (ch <= L'Z')) ? (wchar)(ch + L'a' - L'A') : ch; } +inline wchar_t CharLowerFast (wchar_t ch) { return ((ch >= L'A') && (ch <= L'Z')) ? (wchar_t)(ch + L'a' - L'A') : ch; } inline char CharUpperFast (char ch) { return ((ch >= 'a') && (ch <= 'z')) ? (char )(ch + 'A' - 'a') : ch; } -inline wchar CharUpperFast (wchar ch) { return ((ch >= L'a') && (ch <= L'z')) ? (wchar)(ch + L'A' - L'a') : ch; } +inline wchar_t CharUpperFast (wchar_t ch) { return ((ch >= L'a') && (ch <= L'z')) ? (wchar_t)(ch + L'A' - L'a') : ch; } unsigned StrBytes (const char str[]); // includes space for terminator -unsigned StrBytes (const wchar str[]); // includes space for terminator +unsigned StrBytes (const wchar_t str[]); // includes space for terminator char * StrChr (char * str, char ch, unsigned chars = (unsigned)-1); -wchar * StrChr (wchar * str, wchar ch, unsigned chars = (unsigned)-1); +wchar_t * StrChr (wchar_t * str, wchar_t ch, unsigned chars = (unsigned)-1); const char * StrChr (const char str[], char ch, unsigned chars = (unsigned)-1); -const wchar * StrChr (const wchar str[], wchar ch, unsigned chars = (unsigned)-1); +const wchar_t * StrChr (const wchar_t str[], wchar_t ch, unsigned chars = (unsigned)-1); unsigned StrPrintf (char * dest, unsigned count, const char format[], ...); -unsigned StrPrintf (wchar * dest, unsigned count, const wchar format[], ...); +unsigned StrPrintf (wchar_t * dest, unsigned count, const wchar_t format[], ...); unsigned StrPrintfV (char * dest, unsigned count, const char format[], va_list args); -unsigned StrPrintfV (wchar * dest, unsigned count, const wchar format[], va_list args); +unsigned StrPrintfV (wchar_t * dest, unsigned count, const wchar_t format[], va_list args); unsigned StrLen (const char str[]); -unsigned StrLen (const wchar str[]); +unsigned StrLen (const wchar_t str[]); char * StrDup (const char str[]); -wchar * StrDup (const wchar str[]); +wchar_t * StrDup (const wchar_t str[]); char * StrDupLen (const char str[], unsigned chars); -wchar * StrDupLen (const wchar str[], unsigned chars); +wchar_t * StrDupLen (const wchar_t str[], unsigned chars); -wchar * StrDupToUnicode (const char str[]); -char * StrDupToAnsi (const wchar str[]); +wchar_t * StrDupToUnicode (const char str[]); +char * StrDupToAnsi (const wchar_t str[]); int StrCmp (const char str1[], const char str2[], unsigned chars = (unsigned)-1); -int StrCmp (const wchar str1[], const wchar str2[], unsigned chars = (unsigned)-1); +int StrCmp (const wchar_t str1[], const wchar_t str2[], unsigned chars = (unsigned)-1); int StrCmpI (const char str1[], const char str2[], unsigned chars = (unsigned)-1); -int StrCmpI (const wchar str1[], const wchar str2[], unsigned chars = (unsigned)-1); +int StrCmpI (const wchar_t str1[], const wchar_t str2[], unsigned chars = (unsigned)-1); char * StrStr (char * source, const char match[]); const char * StrStr (const char source[], const char match[]); -wchar * StrStr (wchar * source, const wchar match[]); -const wchar * StrStr (const wchar source[], const wchar match[]); +wchar_t * StrStr (wchar_t * source, const wchar_t match[]); +const wchar_t * StrStr (const wchar_t source[], const wchar_t match[]); char * StrStrI (char * source, const char match[]); const char * StrStrI (const char source[], const char match[]); -wchar * StrStrI (wchar * source, const wchar match[]); -const wchar * StrStrI (const wchar source[], const wchar match[]); +wchar_t * StrStrI (wchar_t * source, const wchar_t match[]); +const wchar_t * StrStrI (const wchar_t source[], const wchar_t match[]); char * StrChrR (char * str, char ch); -wchar * StrChrR (wchar * str, wchar ch); +wchar_t * StrChrR (wchar_t * str, wchar_t ch); const char * StrChrR (const char str[], char ch); -const wchar * StrChrR (const wchar str[], wchar ch); +const wchar_t * StrChrR (const wchar_t str[], wchar_t ch); void StrCopy (char * dest, const char source[], unsigned chars); -void StrCopy (wchar * dest, const wchar source[], unsigned chars); +void StrCopy (wchar_t * dest, const wchar_t source[], unsigned chars); unsigned StrCopyLen (char * dest, const char source[], unsigned chars); -unsigned StrCopyLen (wchar * dest, const wchar source[], unsigned chars); +unsigned StrCopyLen (wchar_t * dest, const wchar_t source[], unsigned chars); void StrPack (char * dest, const char source[], unsigned chars); -void StrPack (wchar * dest, const wchar source[], unsigned chars); +void StrPack (wchar_t * dest, const wchar_t source[], unsigned chars); -unsigned StrToAnsi (char * dest, const wchar source[], unsigned destChars); -unsigned StrToAnsi (char * dest, const wchar source[], unsigned destChars, unsigned codePage); +unsigned StrToAnsi (char * dest, const wchar_t source[], unsigned destChars); +unsigned StrToAnsi (char * dest, const wchar_t source[], unsigned destChars, unsigned codePage); -unsigned StrToUnicode (wchar * dest, const char source[], unsigned destChars); -unsigned StrToUnicode (wchar * dest, const char source[], unsigned destChars, unsigned codePage); +unsigned StrToUnicode (wchar_t * dest, const char source[], unsigned destChars); +unsigned StrToUnicode (wchar_t * dest, const char source[], unsigned destChars, unsigned codePage); -unsigned StrUnicodeToUtf8 (char * dest, const wchar source[], unsigned destChars); -unsigned StrUtf8ToUnicode (wchar * dest, const char source[], unsigned destChars); +unsigned StrUnicodeToUtf8 (char * dest, const wchar_t source[], unsigned destChars); +unsigned StrUtf8ToUnicode (wchar_t * dest, const char source[], unsigned destChars); float StrToFloat (const char source[], const char ** endptr); -float StrToFloat (const wchar source[], const wchar ** endptr); +float StrToFloat (const wchar_t source[], const wchar_t ** endptr); int StrToInt (const char source[], const char ** endptr); -int StrToInt (const wchar source[], const wchar ** endptr); +int StrToInt (const wchar_t source[], const wchar_t ** endptr); unsigned StrToUnsigned (char source[], char ** endptr, int radix); -unsigned StrToUnsigned (wchar source[], wchar ** endptr, int radix); +unsigned StrToUnsigned (wchar_t source[], wchar_t ** endptr, int radix); unsigned StrToUnsigned (const char source[], const char ** endptr, int radix); -unsigned StrToUnsigned (const wchar source[], const wchar ** endptr, int radix); +unsigned StrToUnsigned (const wchar_t source[], const wchar_t ** endptr, int radix); void StrLower (char * dest, unsigned chars = (unsigned) -1); -void StrLower (wchar * dest, unsigned chars = (unsigned) -1); +void StrLower (wchar_t * dest, unsigned chars = (unsigned) -1); void StrLower (char * dest, const char source[], unsigned chars); -void StrLower (wchar * dest, const wchar source[], unsigned chars); +void StrLower (wchar_t * dest, const wchar_t source[], unsigned chars); -dword StrHash (const char str[], unsigned chars = (unsigned)-1); -dword StrHash (const wchar str[], unsigned chars = (unsigned)-1); +uint32_t StrHash (const char str[], unsigned chars = (unsigned)-1); +uint32_t StrHash (const wchar_t str[], unsigned chars = (unsigned)-1); -dword StrHashI (const char str[], unsigned chars = (unsigned)-1); -dword StrHashI (const wchar str[], unsigned chars = (unsigned)-1); +uint32_t StrHashI (const char str[], unsigned chars = (unsigned)-1); +uint32_t StrHashI (const wchar_t str[], unsigned chars = (unsigned)-1); bool StrTokenize (const char * source[], char * dest, unsigned chars, const char whitespace[], unsigned maxWhitespaceSkipCount = (unsigned)-1); -bool StrTokenize (const wchar * source[], wchar * dest, unsigned chars, const wchar whitespace[], unsigned maxWhitespaceSkipCount = (unsigned)-1); +bool StrTokenize (const wchar_t * source[], wchar_t * dest, unsigned chars, const wchar_t whitespace[], unsigned maxWhitespaceSkipCount = (unsigned)-1); bool StrTokenize (const char * source[], ARRAY(char) * destArray, const char whitespace[], unsigned maxWhitespaceSkipCount = (unsigned)-1); -bool StrTokenize (const wchar * source[], ARRAY(wchar) * destArray, const wchar whitespace[], unsigned maxWhitespaceSkipCount = (unsigned)-1); +bool StrTokenize (const wchar_t * source[], ARRAY(wchar_t) * destArray, const wchar_t whitespace[], unsigned maxWhitespaceSkipCount = (unsigned)-1); diff --git a/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtSubst.cpp b/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtSubst.cpp index f43aebac..9a671032 100644 --- a/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtSubst.cpp +++ b/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtSubst.cpp @@ -147,11 +147,11 @@ bool IParseForSubst ( // We've found a variable, copy the current data to a new object if (current != src) { int strLen = (current - src) - 1; - SUBST_BLOCK * block = NEW(SUBST_BLOCK); + SUBST_BLOCK * block = new SUBST_BLOCK; block->isVar = false; block->strLen = strLen; - block->data = (chartype*)ALLOCZERO((strLen + 1) * sizeof(chartype)); - MemCopy(block->data, src, strLen * sizeof(chartype)); + block->data = (chartype*)calloc((strLen + 1), sizeof(chartype)); + memcpy(block->data, src, strLen * sizeof(chartype)); dest->blocks.Add(block); } @@ -166,11 +166,11 @@ bool IParseForSubst ( // Copy variable name excluding trailing '%' int strLen = (varEnd - varStart); - SUBST_BLOCK * block = NEW(SUBST_BLOCK); + SUBST_BLOCK * block = new SUBST_BLOCK; block->isVar = true; block->strLen = strLen; - block->data = (chartype*)ALLOCZERO((strLen + 1) * sizeof(chartype)); - MemCopy(block->data, varStart, strLen * sizeof(chartype)); + block->data = (chartype*)calloc((strLen + 1), sizeof(chartype)); + memcpy(block->data, varStart, strLen * sizeof(chartype)); dest->blocks.Add(block); @@ -180,11 +180,11 @@ bool IParseForSubst ( // Check and see if there's any data remaining if (current != src) { int strLen = (current - src); - SUBST_BLOCK * block = NEW(SUBST_BLOCK); + SUBST_BLOCK * block = new SUBST_BLOCK; block->isVar = false; block->strLen = strLen; - block->data = (chartype*)ALLOCZERO((strLen + 1) * sizeof(chartype)); - MemCopy(block->data, src, strLen * sizeof(chartype)); + block->data = (chartype*)calloc((strLen + 1), sizeof(chartype)); + memcpy(block->data, src, strLen * sizeof(chartype)); dest->blocks.Add(block); } @@ -243,8 +243,8 @@ bool IVarSubstPreParsed ( //============================================================================ bool ParseForSubst ( - SubstParsedData * dest, - const wchar src[] + SubstParsedData * dest, + const wchar_t src[] ) { return IParseForSubst(dest, src); } @@ -259,11 +259,11 @@ bool ParseForSubst ( //============================================================================ bool VarSubstitute ( - ARRAY(wchar) * dst, - const wchar src[], + ARRAY(wchar_t) * dst, + const wchar_t src[], unsigned varCount, - const wchar * varNames[], // [varCount] - const wchar * varValues[] // [varCount] + const wchar_t * varNames[], // [varCount] + const wchar_t * varValues[] // [varCount] ) { return IVarSubstitute(dst, src, varCount, varNames, varValues); } @@ -281,11 +281,11 @@ bool VarSubstitute ( //============================================================================ bool VarSubstitute ( - ARRAY(wchar) * dst, - const SubstParsedData * src, + ARRAY(wchar_t) * dst, + const SubstParsedData * src, unsigned varCount, - const wchar * varNames[], // [varCount] - const wchar * varValues[] // [varCount] + const wchar_t * varNames[], // [varCount] + const wchar_t * varValues[] // [varCount] ) { return IVarSubstPreParsed(dst, src, varCount, varNames, varValues); } diff --git a/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtSubst.h b/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtSubst.h index dcdc67f0..0490e76c 100644 --- a/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtSubst.h +++ b/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtSubst.h @@ -65,7 +65,7 @@ struct SubstParsedData { } ~SubstBlock() { - FREE(data); + free(data); } }; @@ -74,14 +74,14 @@ struct SubstParsedData { ~SubstParsedData() { for (unsigned i = 0; i < blocks.Count(); ++i) { SubstBlock * block = blocks[i]; - DEL(block); + delete block; } } }; bool ParseForSubst ( - SubstParsedData * dest, - const wchar src[] + SubstParsedData * dest, + const wchar_t src[] ); bool ParseForSubst ( SubstParsedData * dest, @@ -90,11 +90,11 @@ bool ParseForSubst ( // Return value is for validation purposes only; it may be ignored bool VarSubstitute ( - ARRAY(wchar) * dst, - const wchar src[], + ARRAY(wchar_t) * dst, + const wchar_t src[], unsigned varCount, - const wchar * varNames[], // [varCount] - const wchar * varValues[] // [varCount] + const wchar_t * varNames[], // [varCount] + const wchar_t * varValues[] // [varCount] ); bool VarSubstitute ( ARRAY(char) * dst, @@ -104,11 +104,11 @@ bool VarSubstitute ( const char * varValues[] // [varCount] ); bool VarSubstitute ( - ARRAY(wchar) * dst, - const SubstParsedData * src, + ARRAY(wchar_t) * dst, + const SubstParsedData * src, unsigned varCount, - const wchar * varNames[], // [varCount] - const wchar * varValues[] // [varCount] + const wchar_t * varNames[], // [varCount] + const wchar_t * varValues[] // [varCount] ); bool VarSubstitute ( ARRAY(char) * dst, diff --git a/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtTime.cpp b/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtTime.cpp index 1dc3db3d..64f1104e 100644 --- a/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtTime.cpp +++ b/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtTime.cpp @@ -57,7 +57,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com //=========================================================================== void TimeGetElapsedDesc ( - dword minutesElapsed, + uint32_t minutesElapsed, TimeElapsedDesc * desc ) { @@ -67,7 +67,7 @@ void TimeGetElapsedDesc ( const unsigned kMinutesPerMonth = 43830; const unsigned kMinutesPerYear = 525960; - dword & elapsed = minutesElapsed; + uint32_t & elapsed = minutesElapsed; desc->years = (elapsed / kMinutesPerYear); elapsed -= desc->years * kMinutesPerYear; desc->months = (elapsed / kMinutesPerMonth); elapsed -= desc->months * kMinutesPerMonth; desc->weeks = (elapsed / kMinutesPerWeek); elapsed -= desc->weeks * kMinutesPerWeek; @@ -78,15 +78,15 @@ void TimeGetElapsedDesc ( } //============================================================================ -dword TimeGetSecondsSince2001Utc () { - qword time = TimeGetTime(); - dword seconds = (dword)((time - kTime1601To2001) / kTimeIntervalsPerSecond); +uint32_t TimeGetSecondsSince2001Utc () { + uint64_t time = TimeGetTime(); + uint32_t seconds = (uint32_t)((time - kTime1601To2001) / kTimeIntervalsPerSecond); return seconds; } //============================================================================ -dword TimeGetSecondsSince1970Utc () { - qword time = TimeGetTime(); - dword seconds = (dword)((time - kTime1601To1970) / kTimeIntervalsPerSecond); +uint32_t TimeGetSecondsSince1970Utc () { + uint64_t time = TimeGetTime(); + uint32_t seconds = (uint32_t)((time - kTime1601To1970) / kTimeIntervalsPerSecond); return seconds; } diff --git a/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtTime.h b/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtTime.h index ff8847de..6adebaef 100644 --- a/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtTime.h +++ b/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtTime.h @@ -77,19 +77,19 @@ struct TimeElapsedDesc { }; void TimeGetDesc ( - qword time, + uint64_t time, TimeDesc * desc ); void TimeGetElapsedDesc ( - dword minutesElapsed, + uint32_t minutesElapsed, TimeElapsedDesc * desc ); void TimePrettyPrint ( - qword time, + uint64_t time, unsigned chars, - wchar * buffer + wchar_t * buffer ); @@ -99,31 +99,31 @@ void TimePrettyPrint ( * ***/ -const qword kTimeIntervalsPerMs = 10000; -const qword kTimeIntervalsPerSecond = 1000 * kTimeIntervalsPerMs; -const qword kTimeIntervalsPerMinute = 60 * kTimeIntervalsPerSecond; -const qword kTimeIntervalsPerHour = 60 * kTimeIntervalsPerMinute; -const qword kTimeIntervalsPerDay = 24 * kTimeIntervalsPerHour; +const uint64_t kTimeIntervalsPerMs = 10000; +const uint64_t kTimeIntervalsPerSecond = 1000 * kTimeIntervalsPerMs; +const uint64_t kTimeIntervalsPerMinute = 60 * kTimeIntervalsPerSecond; +const uint64_t kTimeIntervalsPerHour = 60 * kTimeIntervalsPerMinute; +const uint64_t kTimeIntervalsPerDay = 24 * kTimeIntervalsPerHour; // millisecond timer; wraps ~49 days -dword TimeGetMs (); +uint32_t TimeGetMs (); // 100 nanosecond intervals; won't wrap in our lifetimes -qword TimeGetTime (); -qword TimeGetLocalTime (); +uint64_t TimeGetTime (); +uint64_t TimeGetLocalTime (); // Minutes elapsed since 2001 UTC -dword TimeGetMinutes (); +uint32_t TimeGetMinutes (); // Seconds elapsed since 00:00:00 January 1, 2001 UTC -dword TimeGetSecondsSince2001Utc (); +uint32_t TimeGetSecondsSince2001Utc (); // Seconds elapsed since 00:00:00 January 1, 1970 UTC (the Unix Epoch) -dword TimeGetSecondsSince1970Utc (); +uint32_t TimeGetSecondsSince1970Utc (); // These magic numbers taken from Microsoft's "Shared Source CLI implementation" source code. // http://msdn.microsoft.com/library/en-us/Dndotnet/html/mssharsourcecli.asp -static const qword kTime1601To1970 = 11644473600 * kTimeIntervalsPerSecond; -static const qword kTime1601To2001 = 12622780800 * kTimeIntervalsPerSecond; +static const uint64_t kTime1601To1970 = 11644473600 * kTimeIntervalsPerSecond; +static const uint64_t kTime1601To2001 = 12622780800 * kTimeIntervalsPerSecond; diff --git a/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtUuid.cpp b/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtUuid.cpp index 311813b6..d9997ffc 100644 --- a/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtUuid.cpp +++ b/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtUuid.cpp @@ -59,13 +59,13 @@ const Uuid kNilGuid; ***/ //============================================================================ -Uuid::Uuid (const wchar str[]) { +Uuid::Uuid (const wchar_t str[]) { GuidFromString(str, this); } //============================================================================ -Uuid::Uuid (const byte buf[], unsigned length) { +Uuid::Uuid (const uint8_t buf[], unsigned length) { GuidFromHex(buf, length, this); } @@ -78,11 +78,11 @@ unsigned GuidHash (const Uuid & uuid) { } //============================================================================ -static const wchar s_hexChars[] = L"0123456789ABCDEF"; -const wchar * GuidToHex (const Uuid & uuid, wchar * dst, unsigned chars) { +static const wchar_t s_hexChars[] = L"0123456789ABCDEF"; +const wchar_t * GuidToHex (const Uuid & uuid, wchar_t * dst, unsigned chars) { - wchar * str = ALLOCA(wchar, sizeof(uuid.data) * 2 + 1); - wchar * cur = str; + wchar_t * str = (wchar_t*)malloc((sizeof(uuid.data) * 2 + 1) * sizeof(wchar_t)); + wchar_t * cur = str; for (unsigned i = 0; i < sizeof(uuid.data); ++i) { *cur++ = s_hexChars[(uuid.data[i] >> 4) & 0x0f]; @@ -91,13 +91,15 @@ const wchar * GuidToHex (const Uuid & uuid, wchar * dst, unsigned chars) { *cur = 0; StrCopy(dst, str, chars); + + free(str); return dst; } //============================================================================ -bool GuidFromHex (const byte buf[], unsigned length, Uuid * uuid) { +bool GuidFromHex (const uint8_t buf[], unsigned length, Uuid * uuid) { - ASSERT(length == msizeof(Uuid, data)); - MemCopy(uuid->data, buf, msizeof(Uuid, data)); + ASSERT(length == sizeof(uuid->data)); + memcpy(uuid->data, buf, sizeof(uuid->data)); return true; -} \ No newline at end of file +} diff --git a/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtUuid.h b/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtUuid.h index 92f89a0c..ab58f1f1 100644 --- a/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtUuid.h +++ b/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtUuid.h @@ -78,16 +78,16 @@ extern const Uuid kNilGuid; Uuid GuidGenerate (); void GuidClear (Uuid * uuid); -bool GuidFromString (const wchar str[], Uuid * uuid); +bool GuidFromString (const wchar_t str[], Uuid * uuid); bool GuidFromString (const char str[], Uuid * uuid); int GuidCompare (const Uuid & a, const Uuid & b); inline bool GuidsAreEqual (const Uuid & a, const Uuid & b) { return 0 == GuidCompare(a, b); } bool GuidIsNil (const Uuid & uuid); unsigned GuidHash (const Uuid & uuid); -const wchar * GuidToString (const Uuid & uuid, wchar * dst, unsigned chars); // returns dst +const wchar_t * GuidToString (const Uuid & uuid, wchar_t * dst, unsigned chars); // returns dst const char * GuidToString (const Uuid & uuid, char * dst, unsigned chars); // returns dst -const wchar * GuidToHex (const Uuid & uuid, wchar * dst, unsigned chars); // returns dst -bool GuidFromHex (const byte buf[], unsigned length, Uuid * uuid); +const wchar_t * GuidToHex (const Uuid & uuid, wchar_t * dst, unsigned chars); // returns dst +bool GuidFromHex (const uint8_t buf[], unsigned length, Uuid * uuid); /***************************************************************************** @@ -99,13 +99,13 @@ bool GuidFromHex (const byte buf[], unsigned length, Uuid * uuid); #include struct Uuid { union { - dword dwords[4]; - byte data[16]; + uint32_t uint32_ts[4]; + uint8_t data[16]; }; Uuid () {} - Uuid (const wchar str[]); - Uuid (const byte buf[], unsigned length); + Uuid (const wchar_t str[]); + Uuid (const uint8_t buf[], unsigned length); operator bool () const { return !GuidIsNil(*this); } inline bool operator ! () const { return GuidIsNil(*this); } inline bool operator < (const Uuid & rhs) const { return GuidCompare(*this, rhs) < 0; } diff --git a/Sources/Plasma/NucleusLib/pnUtilsExe/Intern.h b/Sources/Plasma/NucleusLib/pnUtilsExe/Intern.h index aca311a4..5e0c8878 100644 --- a/Sources/Plasma/NucleusLib/pnUtilsExe/Intern.h +++ b/Sources/Plasma/NucleusLib/pnUtilsExe/Intern.h @@ -59,7 +59,7 @@ namespace pnUtilsExe { * ***/ -dword TimeGetTickCount (); +uint32_t TimeGetTickCount (); } // namespace pnUtilsExe diff --git a/Sources/Plasma/NucleusLib/pnUtilsExe/Private/Win32/pnUteW32Time.cpp b/Sources/Plasma/NucleusLib/pnUtilsExe/Private/Win32/pnUteW32Time.cpp index 042d3e94..42ab4ef6 100644 --- a/Sources/Plasma/NucleusLib/pnUtilsExe/Private/Win32/pnUteW32Time.cpp +++ b/Sources/Plasma/NucleusLib/pnUtilsExe/Private/Win32/pnUteW32Time.cpp @@ -59,7 +59,7 @@ namespace pnUtilsExe { ***/ //============================================================================ -dword TimeGetTickCount () { +uint32_t TimeGetTickCount () { return GetTickCount(); } diff --git a/Sources/Plasma/NucleusLib/pnUtilsExe/Private/pnUteTime.cpp b/Sources/Plasma/NucleusLib/pnUtilsExe/Private/pnUteTime.cpp index 5601267f..c28eda65 100644 --- a/Sources/Plasma/NucleusLib/pnUtilsExe/Private/pnUteTime.cpp +++ b/Sources/Plasma/NucleusLib/pnUtilsExe/Private/pnUteTime.cpp @@ -61,14 +61,14 @@ namespace pnUtilsExe { * ***/ -static dword s_adjustment; +static uint32_t s_adjustment; //=========================================================================== static void InitializeAdjustment () { ASSERT(!s_adjustment); - dword currTime = TimeGetTickCount(); - dword startBits = (currTime & 0x80) ? 0x7fff0000 : 0xffff0000; - dword startMask = 0xffff0000; + uint32_t currTime = TimeGetTickCount(); + uint32_t startBits = (currTime & 0x80) ? 0x7fff0000 : 0xffff0000; + uint32_t startMask = 0xffff0000; s_adjustment = (((currTime & ~startMask) | startBits) - currTime) | 1; ASSERT(s_adjustment); } @@ -89,7 +89,7 @@ AUTO_INIT_FUNC(AutoInitializeAdjustment) { ***/ //============================================================================ -dword TimeGetMs () { +uint32_t TimeGetMs () { #ifdef HS_DEBUGGING // For debug builds, return an adjusted timer value diff --git a/Sources/Plasma/PubUtilLib/plAgeDescription/plAgeDescription.cpp b/Sources/Plasma/PubUtilLib/plAgeDescription/plAgeDescription.cpp index 17dfb385..265af571 100644 --- a/Sources/Plasma/PubUtilLib/plAgeDescription/plAgeDescription.cpp +++ b/Sources/Plasma/PubUtilLib/plAgeDescription/plAgeDescription.cpp @@ -42,7 +42,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "hsStream.h" #include "plAgeDescription.h" -#include "hsUtils.h" + #include "hsStlUtils.h" #include "plFile/hsFiles.h" #include "plFile/plInitFileReader.h" @@ -52,9 +52,9 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include -const UInt32 plAgePage::kInvalidSeqSuffix = (UInt32)-1; +const uint32_t plAgePage::kInvalidSeqSuffix = (uint32_t)-1; -plAgePage::plAgePage( const char *name, UInt32 seqSuffix, Byte flags ) +plAgePage::plAgePage( const char *name, uint32_t seqSuffix, uint8_t flags ) { fName = name != nil ? hsStrcpy( name ) : nil; fSeqSuffix = seqSuffix; @@ -95,7 +95,7 @@ plAgePage &plAgePage::operator=( const plAgePage &src ) return *this; } -void plAgePage::SetFlags(Byte f, bool on) +void plAgePage::SetFlags(uint8_t f, bool on) { if (on) hsSetBits(fFlags, f); @@ -256,9 +256,9 @@ void plAgeDescription::ClearPageList() } -void plAgeDescription::AppendPage( const char *name, int seqSuffix, Byte flags ) +void plAgeDescription::AppendPage( const char *name, int seqSuffix, uint8_t flags ) { - fPages.Append( plAgePage( name, ( seqSuffix == -1 ) ? fPages.GetCount() : (UInt32)seqSuffix, flags ) ); + fPages.Append( plAgePage( name, ( seqSuffix == -1 ) ? fPages.GetCount() : (uint32_t)seqSuffix, flags ) ); } void plAgeDescription::SeekFirstPage( void ) @@ -315,23 +315,23 @@ plLocation plAgeDescription::CalcPageLocation( const char *page ) const if( ap != nil ) { // Combine our sequence # together - Int32 combined; - hsAssert(fSeqPrefix > -255 && fSeqPrefix <= 0xFEFF, "Age sequence prefex is out of range!"); // sequence prefix can NOT be larger or equal to 1-byte max value - UInt32 suffix = ap->GetSeqSuffix(); - hsAssert(suffix <= 0xFFFF, "Page sequence number is out of range!"); // page sequence number can NOT be larger then 2-byte max value + int32_t combined; + hsAssert(fSeqPrefix > -255 && fSeqPrefix <= 0xFEFF, "Age sequence prefex is out of range!"); // sequence prefix can NOT be larger or equal to 1-uint8_t max value + uint32_t suffix = ap->GetSeqSuffix(); + hsAssert(suffix <= 0xFFFF, "Page sequence number is out of range!"); // page sequence number can NOT be larger then 2-uint8_t max value if( fSeqPrefix < 0 ) // we are a global age - combined = -(Int32)( ( ( -fSeqPrefix ) << 16 ) + suffix ); + combined = -(int32_t)( ( ( -fSeqPrefix ) << 16 ) + suffix ); else combined = ( fSeqPrefix << 16 ) + suffix; // Now, our 32 bit number looks like the following: // 0xRRAAPPPP // - RR is FF when reserved, and 00-FE when normal - // - AA is the low byte of the age sequence prefix (FF not allowed on a negative prefix because 0xFFFFFFFFFF is reserved for invalid sequence number) + // - AA is the low uint8_t of the age sequence prefix (FF not allowed on a negative prefix because 0xFFFFFFFFFF is reserved for invalid sequence number) // - PPPP is the two bytes for page sequence number if( IsGlobalAge() ) - return plLocation::MakeReserved( (UInt32)combined ); + return plLocation::MakeReserved( (uint32_t)combined ); else { plLocation ret = plLocation::MakeNormal( combined ); @@ -396,7 +396,7 @@ const char *plAgeDescription::GetSectionName( void ) const return "AgeInfo"; } -hsBool plAgeDescription::IParseToken( const char *token, hsStringTokenizer *tokenizer, UInt32 userData ) +hsBool plAgeDescription::IParseToken( const char *token, hsStringTokenizer *tokenizer, uint32_t userData ) { char *tok; @@ -525,7 +525,7 @@ const char *plAgeDescription::GetCommonPage( int pageType ) void plAgeDescription::AppendCommonPages( void ) { - UInt32 startSuffix = 0xffff, i; + uint32_t startSuffix = 0xffff, i; if( IsGlobalAge() ) diff --git a/Sources/Plasma/PubUtilLib/plAgeDescription/plAgeDescription.h b/Sources/Plasma/PubUtilLib/plAgeDescription/plAgeDescription.h index 958ecbee..5858c4e4 100644 --- a/Sources/Plasma/PubUtilLib/plAgeDescription/plAgeDescription.h +++ b/Sources/Plasma/PubUtilLib/plAgeDescription/plAgeDescription.h @@ -42,9 +42,9 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #ifndef PL_AGE_DESCRIPTION_H #define PL_AGE_DESCRIPTION_H -#include "hsTypes.h" +#include "HeadSpin.h" #include "hsTemplates.h" -#include "hsUtils.h" + #include "plUnifiedTime/plUnifiedTime.h" #include "pnKeyedObject/plUoid.h" #include "plFile/plInitFileReader.h" @@ -58,12 +58,12 @@ class plAgePage { protected: char *fName; - UInt32 fSeqSuffix; - Byte fFlags; + uint32_t fSeqSuffix; + uint8_t fFlags; public: - static const UInt32 kInvalidSeqSuffix; + static const uint32_t kInvalidSeqSuffix; enum Flags { @@ -73,18 +73,18 @@ class plAgePage kIsVolatile = 0x08, }; - plAgePage( const char *name, UInt32 seqSuffix, Byte flags ); + plAgePage( const char *name, uint32_t seqSuffix, uint8_t flags ); plAgePage( char *stringFrom ); plAgePage( const plAgePage &src ); plAgePage(); ~plAgePage(); const char *GetName( void ) const { return fName; } - UInt32 GetSeqSuffix( void ) const { return fSeqSuffix; } - Byte GetFlags( void ) const { return fFlags; } + uint32_t GetSeqSuffix( void ) const { return fSeqSuffix; } + uint8_t GetFlags( void ) const { return fFlags; } - void SetSeqSuffix( UInt32 s ) { fSeqSuffix = s; } - void SetFlags(Byte f, bool on=true); + void SetSeqSuffix( uint32_t s ) { fSeqSuffix = s; } + void SetFlags(uint8_t f, bool on=true); hsBool SetFromString( const char *string ); char *GetAsString( void ) const; @@ -100,7 +100,7 @@ private: char *fName; - Int32 fPageIterator; + int32_t fPageIterator; hsTArray fPages; plUnifiedTime fStart; @@ -109,8 +109,8 @@ private: short fMaxCapacity; short fLingerTime; // seconds game instance should linger after last player leaves. -1 means never exit. - Int32 fSeqPrefix; - UInt32 fReleaseVersion; // 0 for pre-release, 1+ for actual released ages + int32_t fSeqPrefix; + uint32_t fReleaseVersion; // 0 for pre-release, 1+ for actual released ages static const char* fCommonPages[]; @@ -118,7 +118,7 @@ private: void IDeInit( void ); // Overload for plInitSectionTokenReader - virtual hsBool IParseToken( const char *token, hsStringTokenizer *tokenizer, UInt32 userData ); + virtual hsBool IParseToken( const char *token, hsStringTokenizer *tokenizer, uint32_t userData ); public: static char kAgeDescPath[]; @@ -146,7 +146,7 @@ public: // Page list void ClearPageList(); void RemovePage( const char *page ); - void AppendPage( const char *name, int seqSuffix = -1, Byte flags = 0 ); + void AppendPage( const char *name, int seqSuffix = -1, uint8_t flags = 0 ); void SeekFirstPage( void ); plAgePage *GetNextPage( void ); @@ -167,8 +167,8 @@ public: float GetDayLength() const { return fDayLength; } - Int32 GetSequencePrefix( void ) const { return fSeqPrefix; } - UInt32 GetReleaseVersion( void ) const { return fReleaseVersion; } + int32_t GetSequencePrefix( void ) const { return fSeqPrefix; } + uint32_t GetReleaseVersion( void ) const { return fReleaseVersion; } hsBool IsGlobalAge( void ) const { return ( fSeqPrefix < 0 ) ? true : false; } // Setters @@ -178,8 +178,8 @@ public: void SetDayLength(const float l) { fDayLength = l; } void SetMaxCapacity(const short m) { fMaxCapacity=m; } void SetLingerTime(const short v) { fLingerTime=v;} - void SetSequencePrefix( Int32 p ) { fSeqPrefix = p; } - void SetReleaseVersion( UInt32 v ) { fReleaseVersion = v; } + void SetSequencePrefix( int32_t p ) { fSeqPrefix = p; } + void SetReleaseVersion( uint32_t v ) { fReleaseVersion = v; } // calculations double GetAgeElapsedDays(plUnifiedTime earthCurrentTime) const; diff --git a/Sources/Plasma/PubUtilLib/plAgeDescription/plAgeManifest.cpp b/Sources/Plasma/PubUtilLib/plAgeDescription/plAgeManifest.cpp index e19e9d14..0e52e7b1 100644 --- a/Sources/Plasma/PubUtilLib/plAgeDescription/plAgeManifest.cpp +++ b/Sources/Plasma/PubUtilLib/plAgeDescription/plAgeManifest.cpp @@ -47,9 +47,9 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // // ////////////////////////////////////////////////////////////////////////////// -#include "hsTypes.h" +#include "HeadSpin.h" #include "plAgeManifest.h" -#include "hsUtils.h" + #include "plFile/hsFiles.h" #include "plFile/plFileUtils.h" @@ -59,7 +59,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com //// plManifestFile /////////////////////////////////////////////////////// -plManifestFile::plManifestFile(const char* name, const char* serverPath, const plMD5Checksum& check, UInt32 size, UInt32 zippedSize, UInt32 flags, bool md5Now) : +plManifestFile::plManifestFile(const char* name, const char* serverPath, const plMD5Checksum& check, uint32_t size, uint32_t zippedSize, uint32_t flags, bool md5Now) : fChecksum(check), fSize(size), fZippedSize(zippedSize), @@ -117,7 +117,7 @@ bool plManifestFile::LocalExists() ////////////////////////////////////////////////////////////////////////////// const char* plManifest::fTimeFormat = "%m/%d/%y %H:%M:%S"; -static const UInt32 kLatestFormatVersion = 5; +static const uint32_t kLatestFormatVersion = 5; plManifest::plManifest() { @@ -151,7 +151,7 @@ protected: virtual const char* GetSectionName() const { return "version"; } - virtual hsBool IParseToken(const char* token, hsStringTokenizer* tokenizer, UInt32 userData) + virtual hsBool IParseToken(const char* token, hsStringTokenizer* tokenizer, uint32_t userData) { if (stricmp(token, "format") == 0) fDest->SetFormatVersion(atoi(tokenizer->next())); @@ -170,22 +170,22 @@ protected: virtual void AddFile(plManifestFile* file) = 0; - plManifestFile* IReadManifestFile(const char* token, hsStringTokenizer* tokenizer, UInt32 userData, bool isPage) + plManifestFile* IReadManifestFile(const char* token, hsStringTokenizer* tokenizer, uint32_t userData, bool isPage) { char name[256]; strcpy(name, token); - UInt32 size = atoi(tokenizer->next()); + uint32_t size = atoi(tokenizer->next()); plMD5Checksum sum; sum.SetFromHexString(tokenizer->next()); - UInt32 flags = atoi(tokenizer->next()); - UInt32 zippedSize = 0; + uint32_t flags = atoi(tokenizer->next()); + uint32_t zippedSize = 0; if (hsCheckBits(flags, plManifestFile::kFlagZipped)) zippedSize = atoi(tokenizer->next()); - return TRACKED_NEW plManifestFile(name, "", sum, size, zippedSize, flags); + return new plManifestFile(name, "", sum, size, zippedSize, flags); } - virtual hsBool IParseToken(const char* token, hsStringTokenizer* tokenizer, UInt32 userData) + virtual hsBool IParseToken(const char* token, hsStringTokenizer* tokenizer, uint32_t userData) { plManifestFile* file = IReadManifestFile(token, tokenizer, userData, false); AddFile(file); diff --git a/Sources/Plasma/PubUtilLib/plAgeDescription/plAgeManifest.h b/Sources/Plasma/PubUtilLib/plAgeDescription/plAgeManifest.h index 98a58c95..6c5ef80a 100644 --- a/Sources/Plasma/PubUtilLib/plAgeDescription/plAgeManifest.h +++ b/Sources/Plasma/PubUtilLib/plAgeDescription/plAgeManifest.h @@ -50,9 +50,9 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #ifndef _plAgeManifest_h #define _plAgeManifest_h -#include "hsTypes.h" +#include "HeadSpin.h" #include "hsTemplates.h" -#include "hsUtils.h" + #include "plUnifiedTime/plUnifiedTime.h" #include "plFile/plInitFileReader.h" #include "plEncryption/plChecksum.h" @@ -66,9 +66,9 @@ protected: std::string fName; std::string fServerPath; plMD5Checksum fChecksum; - UInt32 fSize; - UInt32 fZippedSize; - UInt32 fFlags; + uint32_t fSize; + uint32_t fZippedSize; + uint32_t fFlags; bool fMd5Checked; bool fIsLocalUpToDate; @@ -86,15 +86,15 @@ public: kFlagZipped = 1<<3, }; - plManifestFile(const char* name, const char* serverPath, const plMD5Checksum& check, UInt32 size, UInt32 zippedSize, UInt32 flags, bool md5Now = true); + plManifestFile(const char* name, const char* serverPath, const plMD5Checksum& check, uint32_t size, uint32_t zippedSize, uint32_t flags, bool md5Now = true); virtual ~plManifestFile(); const char* GetName() const { return fName.c_str(); } const char* GetServerPath() const { return fServerPath.c_str(); } const plMD5Checksum& GetChecksum() const { return fChecksum; } - UInt32 GetDiskSize() const { return fSize; } - UInt32 GetDownloadSize() const { return hsCheckBits(fFlags, kFlagZipped) ? fZippedSize : fSize; } - UInt32 GetFlags() const { return fFlags; } + uint32_t GetDiskSize() const { return fSize; } + uint32_t GetDownloadSize() const { return hsCheckBits(fFlags, kFlagZipped) ? fZippedSize : fSize; } + uint32_t GetFlags() const { return fFlags; } void DoMd5Check(); bool IsLocalUpToDate(); @@ -106,7 +106,7 @@ public: class plManifest { protected: - UInt32 fFormatVersion; + uint32_t fFormatVersion; char* fAgeName; // Mostly just for debugging hsTArray fFiles; @@ -116,7 +116,7 @@ protected: public: static const char* fTimeFormat; // Standard string for the printed version of our timestamps - void SetFormatVersion(UInt32 v) { fFormatVersion = v; } + void SetFormatVersion(uint32_t v) { fFormatVersion = v; } void AddFile(plManifestFile* file); plManifest(); @@ -125,10 +125,10 @@ public: bool Read(const char* filename); bool Read(hsStream* stream); - UInt32 GetFormatVersion() const { return fFormatVersion; } + uint32_t GetFormatVersion() const { return fFormatVersion; } - UInt32 GetNumFiles() const { return fFiles.GetCount(); } - const plManifestFile& GetFile(UInt32 i) const { return *fFiles[i]; } + uint32_t GetNumFiles() const { return fFiles.GetCount(); } + const plManifestFile& GetFile(uint32_t i) const { return *fFiles[i]; } }; #endif //_plAgeManifest_h diff --git a/Sources/Plasma/PubUtilLib/plAgeLoader/plAgeLoader.cpp b/Sources/Plasma/PubUtilLib/plAgeLoader/plAgeLoader.cpp index fdbe432c..2cbd0119 100644 --- a/Sources/Plasma/PubUtilLib/plAgeLoader/plAgeLoader.cpp +++ b/Sources/Plasma/PubUtilLib/plAgeLoader/plAgeLoader.cpp @@ -193,7 +193,7 @@ void plAgeLoader::NotifyAgeLoaded( bool loaded ) else fFlags &= ~kUnLoadingAge; - plAgeLoadedMsg * msg = TRACKED_NEW plAgeLoadedMsg; + plAgeLoadedMsg * msg = new plAgeLoadedMsg; msg->fLoaded = loaded; msg->Send(); } @@ -212,11 +212,11 @@ bool plAgeLoader::ILoadAge(const char ageName[]) nc->DebugMsg( "Net: Loading age %s", fAgeName); if ((fFlags & kLoadMask) != 0) - ErrorFatal(__LINE__, __FILE__, "Fatal Error:\nAlready loading or unloading an age.\n%S will now exit.", ProductShortName()); + ErrorAssert(__LINE__, __FILE__, "Fatal Error:\nAlready loading or unloading an age.\n%S will now exit.", ProductShortName()); fFlags |= kLoadingAge; - plAgeBeginLoadingMsg* ageBeginLoading = TRACKED_NEW plAgeBeginLoadingMsg(); + plAgeBeginLoadingMsg* ageBeginLoading = new plAgeBeginLoadingMsg(); ageBeginLoading->Send(); /////////////////////////////////////////////////////// @@ -272,7 +272,7 @@ bool plAgeLoader::ILoadAge(const char ageName[]) // Tell the client to load-and-hold all the keys for this age, to make the loading process work better - plClientMsg *loadAgeKeysMsg = TRACKED_NEW plClientMsg( plClientMsg::kLoadAgeKeys ); + plClientMsg *loadAgeKeysMsg = new plClientMsg( plClientMsg::kLoadAgeKeys ); loadAgeKeysMsg->SetAgeName( fAgeName); loadAgeKeysMsg->Send( clientKey ); @@ -282,12 +282,12 @@ bool plAgeLoader::ILoadAge(const char ageName[]) plUoid oid=nc->GetAgeSDLObjectUoid(fAgeName); plKey ageSDLObjectKey = hsgResMgr::ResMgr()->FindKey(oid); if (ageSDLObjectKey) - hsgResMgr::ResMgr()->AddViaNotify(ageSDLObjectKey, TRACKED_NEW plGenRefMsg(nc->GetKey(), plRefMsg::kOnCreate, -1, + hsgResMgr::ResMgr()->AddViaNotify(ageSDLObjectKey, new plGenRefMsg(nc->GetKey(), plRefMsg::kOnCreate, -1, plNetClientMgr::kAgeSDLHook), plRefFlags::kActiveRef); int nPages = 0; - plClientMsg* pMsg1 = TRACKED_NEW plClientMsg(plClientMsg::kLoadRoom); + plClientMsg* pMsg1 = new plClientMsg(plClientMsg::kLoadRoom); pMsg1->SetAgeName(fAgeName); // Loop and ref! @@ -308,7 +308,7 @@ bool plAgeLoader::ILoadAge(const char ageName[]) pMsg1->Send(clientKey); // Send the client a message to let go of the extra keys it was holding on to - plClientMsg *dumpAgeKeys = TRACKED_NEW plClientMsg( plClientMsg::kReleaseAgeKeys ); + plClientMsg *dumpAgeKeys = new plClientMsg( plClientMsg::kReleaseAgeKeys ); dumpAgeKeys->SetAgeName( fAgeName); dumpAgeKeys->Send( clientKey ); @@ -358,7 +358,7 @@ bool plAgeLoader::IUnloadAge() hsAssert( (fFlags & kLoadMask)==0, "already loading or unloading an age?"); fFlags |= kUnLoadingAge; - plAgeBeginLoadingMsg* msg = TRACKED_NEW plAgeBeginLoadingMsg(); + plAgeBeginLoadingMsg* msg = new plAgeBeginLoadingMsg(); msg->fLoading = false; msg->Send(); @@ -395,7 +395,7 @@ bool plAgeLoader::IUnloadAge() // before any messages get processed for( i = 0; i < newPageOuts.size(); i++ ) { - plClientMsg *pMsg1 = TRACKED_NEW plClientMsg( plClientMsg::kUnloadRoom ); + plClientMsg *pMsg1 = new plClientMsg( plClientMsg::kUnloadRoom ); pMsg1->AddRoomLoc(newPageOuts[i]->GetUoid().GetLocation()); pMsg1->Send( clientKey ); } @@ -415,7 +415,7 @@ void plAgeLoader::ExecPendingAgeFniFiles() int i; for (i=0;iSetNetProtocol(kNetProtocolCli2Game); int i; for(i=0;iSend(); // join task will call NotifyAgeLoaded for us later } diff --git a/Sources/Plasma/PubUtilLib/plAgeLoader/plResPatcher.cpp b/Sources/Plasma/PubUtilLib/plAgeLoader/plResPatcher.cpp index 57154f9a..9a4d2352 100644 --- a/Sources/Plasma/PubUtilLib/plAgeLoader/plResPatcher.cpp +++ b/Sources/Plasma/PubUtilLib/plAgeLoader/plResPatcher.cpp @@ -66,9 +66,9 @@ public: fIsZipped = wcscmp(plFileUtils::GetFileExt(reqFile), L"gz") == 0; } - UInt32 Write(UInt32 count, const void* buf) + uint32_t Write(uint32_t count, const void* buf) { - fProgress->Increment((hsScalar)count); + fProgress->Increment((float)count); if (fIsZipped) return plZlibStream::Write(count, buf); else @@ -116,7 +116,7 @@ static void ManifestDownloaded( void* param, const wchar_t group[], const NetCliFileManifestEntry manifest[], - UInt32 entryCount) + uint32_t entryCount) { plResPatcher* patcher = (plResPatcher*)param; char* name = hsWStringToString(group); @@ -129,7 +129,7 @@ static void ManifestDownloaded( return; } - for (UInt32 i = 0; i < entryCount; ++i) + for (uint32_t i = 0; i < entryCount; ++i) { const NetCliFileManifestEntry mfs = manifest[i]; char* fileName = hsWStringToString(mfs.clientName); @@ -155,7 +155,7 @@ static void ManifestDownloaded( PatcherLog(kInfo, " Enqueueing %s: File Sizes Differ", fileName); // If we're still here, then we need to update the file. - patcher->GetProgress()->SetLength((hsScalar)mfs.fileSize + patcher->GetProgress()->GetMax()); + patcher->GetProgress()->SetLength((float)mfs.fileSize + patcher->GetProgress()->GetMax()); patcher->RequestFile(mfs.downloadName, mfs.clientName); } @@ -280,7 +280,7 @@ void plResPatcher::Start() void PatcherLog(PatcherLogType type, const char* format, ...) { - UInt32 color = 0; + uint32_t color = 0; switch (type) { case kHeader: color = plStatusLog::kWhite; break; diff --git a/Sources/Plasma/PubUtilLib/plAudible/plAudibleNull.cpp b/Sources/Plasma/PubUtilLib/plAudible/plAudibleNull.cpp index dfcf5060..e1208fdc 100644 --- a/Sources/Plasma/PubUtilLib/plAudible/plAudibleNull.cpp +++ b/Sources/Plasma/PubUtilLib/plAudible/plAudibleNull.cpp @@ -40,7 +40,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "hsGeometry3.h" #include "plAudibleNull.h" @@ -68,7 +68,7 @@ void plAudibleNull::SetSceneNode(plKey newNode) if( newNode ) { - plNodeRefMsg* refMsg = TRACKED_NEW plNodeRefMsg(newNode, plNodeRefMsg::kOnRequest, -1, plNodeRefMsg::kAudible); + plNodeRefMsg* refMsg = new plNodeRefMsg(newNode, plNodeRefMsg::kOnRequest, -1, plNodeRefMsg::kAudible); hsgResMgr::ResMgr()->AddViaNotify(GetKey(), refMsg, plRefFlags::kActiveRef); } if( oldNode ) diff --git a/Sources/Plasma/PubUtilLib/plAudible/plAudibleNull.h b/Sources/Plasma/PubUtilLib/plAudible/plAudibleNull.h index 3571b1b6..b6c7e1a3 100644 --- a/Sources/Plasma/PubUtilLib/plAudible/plAudibleNull.h +++ b/Sources/Plasma/PubUtilLib/plAudible/plAudibleNull.h @@ -71,11 +71,11 @@ public: void Stop(int index = -1){;} void FastForwardPlay(int index = -1){;} void FastForwardToggle(int index = -1){;} - void SetMin(const hsScalar m,int index = -1){;} // sets minimum falloff distance - void SetMax(const hsScalar m,int index = -1){;} // sets maximum falloff distance + void SetMin(const float m,int index = -1){;} // sets minimum falloff distance + void SetMax(const float m,int index = -1){;} // sets maximum falloff distance virtual plAudible& SetTransform(const hsMatrix44& l2w, const hsMatrix44& w2l, int index = -1){return *this;} - hsScalar GetMin(int index = -1) const{return 0;} - hsScalar GetMax(int index = -1) const{return 0;} + float GetMin(int index = -1) const{return 0;} + float GetMax(int index = -1) const{return 0;} void SetVelocity(const hsVector3 vel,int index = -1){;} hsVector3 GetVelocity(int index = -1) const; hsPoint3 GetPosition(int index = -1); @@ -96,7 +96,7 @@ public: virtual void SetMuted( hsBool muted, int index = -1 ) {;} virtual void ToggleMuted( int index = -1 ) {;} - virtual void SetTalkIcon(int index, UInt32 str){;} + virtual void SetTalkIcon(int index, uint32_t str){;} virtual void ClearTalkIcon(){;} virtual void SetFadeIn( const int type, const float length, int index = -1 ) {} diff --git a/Sources/Plasma/PubUtilLib/plAudible/plWinAudible.cpp b/Sources/Plasma/PubUtilLib/plAudible/plWinAudible.cpp index a9a655f4..07d4cf71 100644 --- a/Sources/Plasma/PubUtilLib/plAudible/plWinAudible.cpp +++ b/Sources/Plasma/PubUtilLib/plAudible/plWinAudible.cpp @@ -40,7 +40,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "hsGeometry3.h" #include "plWinAudible.h" #include "hsMatrix44.h" @@ -98,7 +98,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com plWinAudible::plWinAudible() : fSceneNode(nil), fSceneObj(nil), fSDLMod(nil) { - fProxyGen = TRACKED_NEW plWinAudibleProxy; + fProxyGen = new plWinAudibleProxy; fProxyGen->Init(this); fLocalToWorld.Reset(); @@ -142,7 +142,7 @@ void plWinAudible::SetSceneObject(plKey obj) { so->RemoveModifier(fSDLMod); delete fSDLMod; - fSDLMod=TRACKED_NEW plSoundSDLModifier; + fSDLMod=new plSoundSDLModifier; so->AddModifier(fSDLMod); } @@ -152,7 +152,7 @@ void plWinAudible::SetSceneObject(plKey obj) { if( obj != nil ) { - plGenRefMsg *replaceMsg = TRACKED_NEW plGenRefMsg( fSoundObjs[ i ]->GetKey(), plRefMsg::kOnReplace, 0, plSound::kRefParentSceneObject ); + plGenRefMsg *replaceMsg = new plGenRefMsg( fSoundObjs[ i ]->GetKey(), plRefMsg::kOnReplace, 0, plSound::kRefParentSceneObject ); hsgResMgr::ResMgr()->AddViaNotify( obj, replaceMsg, plRefFlags::kPassiveRef ); } else if( oldKey != nil ) @@ -172,7 +172,7 @@ void plWinAudible::SetSceneNode(plKey newNode) if( newNode ) { - plNodeRefMsg* refMsg = TRACKED_NEW plNodeRefMsg(newNode, plNodeRefMsg::kOnRequest, -1, plNodeRefMsg::kAudible); + plNodeRefMsg* refMsg = new plNodeRefMsg(newNode, plNodeRefMsg::kOnRequest, -1, plNodeRefMsg::kAudible); hsgResMgr::ResMgr()->AddViaNotify(GetKey(), refMsg, plRefFlags::kPassiveRef); } @@ -213,23 +213,23 @@ hsBool plWinAudible::AddSound( plSound *pSnd, int index, hsBool is3D ) hsAssert(pSnd->GetKey() != nil, "Adding a new sound with no key."); if (plgAudioSys::Active()) { - hsgResMgr::ResMgr()->AddViaNotify( pSnd->GetKey(), TRACKED_NEW plGenRefMsg( GetKey(), plRefMsg::kOnCreate, index, 0 ), plRefFlags::kActiveRef ); + hsgResMgr::ResMgr()->AddViaNotify( pSnd->GetKey(), new plGenRefMsg( GetKey(), plRefMsg::kOnCreate, index, 0 ), plRefFlags::kActiveRef ); return true; } else { pSnd->SetProperty( plSound::kPropIs3DSound, is3D ); - hsgResMgr::ResMgr()->AddViaNotify( pSnd->GetKey(), TRACKED_NEW plGenRefMsg( GetKey(), plRefMsg::kOnCreate, index, 0 ), plRefFlags::kActiveRef ); + hsgResMgr::ResMgr()->AddViaNotify( pSnd->GetKey(), new plGenRefMsg( GetKey(), plRefMsg::kOnCreate, index, 0 ), plRefFlags::kActiveRef ); return true; } } /* Unused -int plWinAudible::AddSoundFromResource(plSound *pSnd, void* addr, Int32 size, hsBool is3D ) +int plWinAudible::AddSoundFromResource(plSound *pSnd, void* addr, int32_t size, hsBool is3D ) { - //plWin32Sound* pSnd = TRACKED_NEW plWin32Sound; + //plWin32Sound* pSnd = new plWin32Sound; //IAssignSoundKey( pSnd, GetKey() ? GetKeyName() : "", fSoundObjs.Count() - 1 ); if (plgAudioSys::Active()) @@ -328,12 +328,12 @@ void plWinAudible::Stop(int index) SND_APPLY_LOOP( index, Stop(), ; ); } -void plWinAudible::SetMin(const hsScalar m,int index) +void plWinAudible::SetMin(const float m,int index) { SND_APPLY_LOOP( index, SetMin( (int)m ), ; ); } -void plWinAudible::SetMax(const hsScalar m,int index) +void plWinAudible::SetMax(const float m,int index) { SND_APPLY_LOOP( index, SetMax( (int)m ), ; ); } @@ -367,14 +367,14 @@ void plWinAudible::ToggleMuted( int index ) } } -hsScalar plWinAudible::GetMin(int index) const +float plWinAudible::GetMin(int index) const { - return (hsScalar)(fSoundObjs[index]->GetMin()); + return (float)(fSoundObjs[index]->GetMin()); } -hsScalar plWinAudible::GetMax(int index) const +float plWinAudible::GetMax(int index) const { - return (hsScalar)(fSoundObjs[index]->GetMax()); + return (float)(fSoundObjs[index]->GetMax()); } void plWinAudible::SetVelocity(const hsVector3 vel,int index) @@ -457,7 +457,7 @@ void plWinAudible::Read(hsStream* s, hsResMgr* mgr) fSoundObjs.SetCountAndZero(n); for(int i = 0; i < n; i++ ) { - plGenRefMsg* msg = TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnCreate, i, 0); + plGenRefMsg* msg = new plGenRefMsg(GetKey(), plRefMsg::kOnCreate, i, 0); mgr->ReadKeyNotifyMe(s, msg, plRefFlags::kActiveRef); //plSound* pSnd = plSound::ConvertNoRef(mgr->ReadCreatable(s)); //IAssignSoundKey( pSnd, GetKey() ? GetKeyName() : "", i ); @@ -467,11 +467,11 @@ void plWinAudible::Read(hsStream* s, hsResMgr* mgr) } plKey pSceneKey = mgr->ReadKey(s); - plNodeRefMsg* refMsg = TRACKED_NEW plNodeRefMsg(pSceneKey, plRefMsg::kOnCreate, -1, plNodeRefMsg::kAudible); + plNodeRefMsg* refMsg = new plNodeRefMsg(pSceneKey, plRefMsg::kOnCreate, -1, plNodeRefMsg::kAudible); mgr->AddViaNotify(GetKey(), refMsg, plRefFlags::kPassiveRef); } -void plWinAudible::IAssignSoundKey( plSound *sound, const char *name, UInt32 i ) +void plWinAudible::IAssignSoundKey( plSound *sound, const char *name, uint32_t i ) { plString keyName = plString::Format( "%s_%d", name, i ); hsgResMgr::ResMgr()->NewKey( keyName, sound, GetKey() ? GetKey()->GetUoid().GetLocation() : plLocation::kGlobalFixedLoc ); @@ -619,7 +619,7 @@ plSound* plWinAudible::GetSound(int i) const } // Visualization -plDrawableSpans* plWinAudible::CreateProxy(hsGMaterial* mat, hsTArray& idx, plDrawableSpans* addTo) +plDrawableSpans* plWinAudible::CreateProxy(hsGMaterial* mat, hsTArray& idx, plDrawableSpans* addTo) { plDrawableSpans* myDraw = addTo; int i; @@ -675,13 +675,13 @@ void pl2WayWinAudible::Init(hsBool isLocal) if (!fVoicePlayer) { if(!isLocal) - fVoicePlayer = TRACKED_NEW plVoicePlayer; + fVoicePlayer = new plVoicePlayer; } if(!fVoiceRecorder) { if(isLocal) { - fVoiceRecorder = TRACKED_NEW plVoiceRecorder; + fVoiceRecorder = new plVoiceRecorder; } } Activate(); @@ -700,7 +700,7 @@ void pl2WayWinAudible::Activate() } if (fVoiceRecorder) { - plCmdIfaceModMsg* pModMsg = TRACKED_NEW plCmdIfaceModMsg; + plCmdIfaceModMsg* pModMsg = new plCmdIfaceModMsg; pModMsg->SetBCastFlag(plMessage::kBCastByExactType); pModMsg->SetSender(GetKey()); pModMsg->SetCmd(plCmdIfaceModMsg::kAdd); @@ -722,7 +722,7 @@ void pl2WayWinAudible::DeActivate() } if (fVoiceRecorder) { - plCmdIfaceModMsg* pModMsg = TRACKED_NEW plCmdIfaceModMsg; + plCmdIfaceModMsg* pModMsg = new plCmdIfaceModMsg; pModMsg->SetBCastFlag(plMessage::kBCastByExactType); pModMsg->SetSender(GetKey()); pModMsg->SetCmd(plCmdIfaceModMsg::kRemove); @@ -737,14 +737,14 @@ void pl2WayWinAudible::Read(hsStream* s, hsResMgr* mgr) plgDispatch::Dispatch()->RegisterForExactType(plEvalMsg::Index(), GetKey()); } -void pl2WayWinAudible::PlayNetworkedSpeech(const char* addr, Int32 size, int numFrames, unsigned char flags) +void pl2WayWinAudible::PlayNetworkedSpeech(const char* addr, int32_t size, int numFrames, unsigned char flags) { if (fVoicePlayer) { if (!(flags & VOICE_ENCODED)) - fVoicePlayer->PlaybackUncompressedVoiceMessage((UInt8*)addr, size); + fVoicePlayer->PlaybackUncompressedVoiceMessage((uint8_t*)addr, size); else - fVoicePlayer->PlaybackVoiceMessage((UInt8*)addr, size, numFrames); + fVoicePlayer->PlaybackVoiceMessage((uint8_t*)addr, size, numFrames); } } @@ -771,7 +771,7 @@ void pl2WayWinAudible::SetVelocity(const hsVector3 vel,int index) fVoicePlayer->SetVelocity( vel ); } -void pl2WayWinAudible::SetTalkIcon(int index, UInt32 str) +void pl2WayWinAudible::SetTalkIcon(int index, uint32_t str) { if (fVoicePlayer) fVoicePlayer->SetTalkIcon(index,str); diff --git a/Sources/Plasma/PubUtilLib/plAudible/plWinAudible.h b/Sources/Plasma/PubUtilLib/plAudible/plWinAudible.h index b65cdc22..6daaf01f 100644 --- a/Sources/Plasma/PubUtilLib/plAudible/plWinAudible.h +++ b/Sources/Plasma/PubUtilLib/plAudible/plWinAudible.h @@ -82,11 +82,11 @@ public: void Stop(int index = -1); void FastForwardPlay(int index = -1); void FastForwardToggle(int index = -1); - void SetMin(const hsScalar m,int index = -1); // sets minimum falloff distance - void SetMax(const hsScalar m,int index = -1); // sets maximum falloff distance + void SetMin(const float m,int index = -1); // sets minimum falloff distance + void SetMax(const float m,int index = -1); // sets maximum falloff distance void SetPosition(const hsPoint3 p, int index = -1); - hsScalar GetMin(int index = -1) const; - hsScalar GetMax(int index = -1) const; + float GetMin(int index = -1) const; + float GetMax(int index = -1) const; virtual void SetVelocity(const hsVector3 vel,int index = -1); hsVector3 GetVelocity(int index = -1) const; hsPoint3 GetPosition(int index = -1); @@ -98,7 +98,7 @@ public: void RemoveCallbacks(plSoundMsg* pMsg); void AddCallbacks(plSoundMsg* pMsg); hsBool AddSound(plSound *pSnd, int index,hsBool is3D); - int AddSoundFromResource(plSound *pSnd, void* addr, Int32 size, hsBool is3D); + int AddSoundFromResource(plSound *pSnd, void* addr, int32_t size, hsBool is3D); virtual void GetStatus(plSoundMsg* pMsg); virtual int GetNumSounds() const {return fSoundObjs.Count();} virtual plSound* GetSound(int i) const; @@ -106,7 +106,7 @@ public: virtual void SetVolume(const float volume,int index = -1); virtual void SetMuted( hsBool muted, int index = -1 ); virtual void ToggleMuted( int index = -1 ); - virtual void SetTalkIcon(int index, UInt32 str){;} + virtual void SetTalkIcon(int index, uint32_t str){;} virtual void ClearTalkIcon(){;} void SetFilename(int index, const char *filename, hsBool isCompressed); @@ -122,7 +122,7 @@ public: virtual void Write(hsStream* s, hsResMgr* mgr); // Visualization - virtual plDrawableSpans* CreateProxy(hsGMaterial* mat, hsTArray& idx, plDrawableSpans* addTo); + virtual plDrawableSpans* CreateProxy(hsGMaterial* mat, hsTArray& idx, plDrawableSpans* addTo); private: hsTArray fSoundObjs; @@ -131,7 +131,7 @@ private: hsMatrix44 fLocalToWorld; plSoundSDLModifier* fSDLMod; plKey fSceneObj; - void IAssignSoundKey( plSound *sound, const char *name, UInt32 i ); + void IAssignSoundKey( plSound *sound, const char *name, uint32_t i ); }; @@ -150,11 +150,11 @@ public: virtual void Activate(); virtual void DeActivate(); virtual void Read(hsStream* s, hsResMgr* mgr); - virtual void PlayNetworkedSpeech(const char* addr, Int32 size, int numFrames, unsigned char flags); + virtual void PlayNetworkedSpeech(const char* addr, int32_t size, int numFrames, unsigned char flags); virtual plAudible& SetTransform(const hsMatrix44& l2w, const hsMatrix44& w2l, int index = -1); virtual void SetVelocity(const hsVector3 vel,int index = -1); - virtual void SetTalkIcon(int index, UInt32 str); + virtual void SetTalkIcon(int index, uint32_t str); virtual void ClearTalkIcon(); protected: diff --git a/Sources/Plasma/PubUtilLib/plAudible/plWinAudibleProxy.cpp b/Sources/Plasma/PubUtilLib/plAudible/plWinAudibleProxy.cpp index 67d316b1..63bc7db9 100644 --- a/Sources/Plasma/PubUtilLib/plAudible/plWinAudibleProxy.cpp +++ b/Sources/Plasma/PubUtilLib/plAudible/plWinAudibleProxy.cpp @@ -40,7 +40,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "plWinAudibleProxy.h" #include "plWinAudible.h" @@ -72,7 +72,7 @@ plKey plWinAudibleProxy::IGetNode() const return fOwner ? fOwner->GetSceneNode() : nil; } -plDrawableSpans* plWinAudibleProxy::ICreateProxy(hsGMaterial* mat, hsTArray& idx, plDrawableSpans* addTo) +plDrawableSpans* plWinAudibleProxy::ICreateProxy(hsGMaterial* mat, hsTArray& idx, plDrawableSpans* addTo) { if( fOwner ) { diff --git a/Sources/Plasma/PubUtilLib/plAudible/plWinAudibleProxy.h b/Sources/Plasma/PubUtilLib/plAudible/plWinAudibleProxy.h index 45dd6e53..b31decd8 100644 --- a/Sources/Plasma/PubUtilLib/plAudible/plWinAudibleProxy.h +++ b/Sources/Plasma/PubUtilLib/plAudible/plWinAudibleProxy.h @@ -56,7 +56,7 @@ public: protected: plWinAudible* fOwner; - virtual plDrawableSpans* ICreateProxy(hsGMaterial* mat, hsTArray& idx, plDrawableSpans* addTo=nil); + virtual plDrawableSpans* ICreateProxy(hsGMaterial* mat, hsTArray& idx, plDrawableSpans* addTo=nil); virtual plKey IGetNode() const; }; diff --git a/Sources/Plasma/PubUtilLib/plAudio/plAudioCaps.h b/Sources/Plasma/PubUtilLib/plAudio/plAudioCaps.h index a4135793..2102b5dc 100644 --- a/Sources/Plasma/PubUtilLib/plAudio/plAudioCaps.h +++ b/Sources/Plasma/PubUtilLib/plAudio/plAudioCaps.h @@ -48,7 +48,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #ifndef _plAudioCaps_h #define _plAudioCaps_h -#include "hsTypes.h" +#include "HeadSpin.h" #include "hsTemplates.h" class plAudioCapsDetector; diff --git a/Sources/Plasma/PubUtilLib/plAudio/plAudioSystem.cpp b/Sources/Plasma/PubUtilLib/plAudio/plAudioSystem.cpp index bd80bcde..6ed7adbb 100644 --- a/Sources/Plasma/PubUtilLib/plAudio/plAudioSystem.cpp +++ b/Sources/Plasma/PubUtilLib/plAudio/plAudioSystem.cpp @@ -88,7 +88,7 @@ class plSoftSoundNode { public: const plKey fSoundKey; - hsScalar fRank; + float fRank; plSoftSoundNode *fNext; plSoftSoundNode **fPrev; @@ -120,7 +120,7 @@ class plSoftSoundNode } } - void SortedLink( plSoftSoundNode **prev, hsScalar rank ) + void SortedLink( plSoftSoundNode **prev, float rank ) { fRank = rank; @@ -132,7 +132,7 @@ class plSoftSoundNode } // Larger values are first in the list - void AddToSortedLink( plSoftSoundNode *toAdd, hsScalar rank ) + void AddToSortedLink( plSoftSoundNode *toAdd, float rank ) { if( fRank > rank ) { @@ -162,8 +162,8 @@ class plSoftSoundNode // plAudioSystem ////////////////////////////////////////////////////////////////////////// -Int32 plAudioSystem::fMaxNumSounds = 16; -Int32 plAudioSystem::fNumSoundsSlop = 8; +int32_t plAudioSystem::fMaxNumSounds = 16; +int32_t plAudioSystem::fNumSoundsSlop = 8; plAudioSystem::plAudioSystem() : fStartTime(0), @@ -512,7 +512,7 @@ void plAudioSystem::SetDistanceModel(int i) // Set the number of active sounds the audio system is allowed to play, based on the priority cutoff void plAudioSystem::SetMaxNumberOfActiveSounds() { - UInt16 priorityCutoff = plgAudioSys::GetPriorityCutoff(); + uint16_t priorityCutoff = plgAudioSys::GetPriorityCutoff(); int maxNumSounds = 24; // Keep this to a reasonable amount based on the users hardware, since we want the sounds to be played in hardware @@ -553,7 +553,7 @@ void plAudioSystem::SetActive( hsBool b ) if( fActive ) { // Clear to send activate message (if listener not inited yet, delay until then) - plgDispatch::MsgSend( TRACKED_NEW plAudioSysMsg( plAudioSysMsg::kActivate ) ); + plgDispatch::MsgSend( new plAudioSysMsg( plAudioSysMsg::kActivate ) ); } } @@ -565,7 +565,7 @@ void plAudioSystem::SetActive( hsBool b ) // need to be recalced, just resorted. void plAudioSystem::RegisterSoftSound( const plKey soundKey ) { - plSoftSoundNode *node = TRACKED_NEW plSoftSoundNode( soundKey ); + plSoftSoundNode *node = new plSoftSoundNode( soundKey ); node->Link( &fSoftRegionSounds ); fCurrDebugSound = nil; @@ -632,9 +632,9 @@ void plAudioSystem::UnregisterSoftSound( const plKey soundKey ) void plAudioSystem::IUpdateSoftSounds( const hsPoint3 &newPosition ) { plSoftSoundNode *node, *myNode; - hsScalar distSquared, rank; + float distSquared, rank; plSoftSoundNode *sortedList = nil; - Int32 i; + int32_t i; plProfile_BeginTiming(SoundSoftUpdate); @@ -779,7 +779,7 @@ void plAudioSystem::IUpdateSoftSounds( const hsPoint3 &newPosition ) /// Notify sound that it really is still enabled sound->UpdateSoftVolume( true ); - UInt32 color = plStatusLog::kGreen; + uint32_t color = plStatusLog::kGreen; switch (sound->GetStreamType()) { case plSound::kStreamFromDisk: color = plStatusLog::kYellow; break; @@ -896,7 +896,7 @@ hsBool plAudioSystem::MsgReceive(plMessage* msg) } else { - plgAudioSys::SetGlobalFadeVolume( (hsScalar)((currTime-fStartFade) / fFadeLength) ); + plgAudioSys::SetGlobalFadeVolume( (float)((currTime-fStartFade) / fFadeLength) ); } } return true; @@ -906,7 +906,7 @@ hsBool plAudioSystem::MsgReceive(plMessage* msg) { if (pASMsg->GetAudFlag() == plAudioSysMsg::kPing && fListenerInit) { - plAudioSysMsg* pMsg = TRACKED_NEW plAudioSysMsg( plAudioSysMsg::kActivate ); + plAudioSysMsg* pMsg = new plAudioSysMsg( plAudioSysMsg::kActivate ); pMsg->AddReceiver( pASMsg->GetSender() ); pMsg->SetBCastFlag(plMessage::kBCastByExactType, false); plgDispatch::MsgSend( pMsg ); @@ -996,14 +996,14 @@ hsBool plgAudioSys::fMuted = true; hsBool plgAudioSys::fDelayedActivate = false; hsBool plgAudioSys::fEnableEAX = false; hsWindowHndl plgAudioSys::fWnd = nil; -hsScalar plgAudioSys::fChannelVolumes[ kNumChannels ] = { 1.f, 1.f, 1.f, 1.f, 1.f, 1.f }; -hsScalar plgAudioSys::f2D3DBias = 0.75f; -UInt32 plgAudioSys::fDebugFlags = 0; -hsScalar plgAudioSys::fStreamingBufferSize = 2.f; -hsScalar plgAudioSys::fStreamFromRAMCutoff = 10.f; -UInt8 plgAudioSys::fPriorityCutoff = 9; // We cut off sounds above this priority +float plgAudioSys::fChannelVolumes[ kNumChannels ] = { 1.f, 1.f, 1.f, 1.f, 1.f, 1.f }; +float plgAudioSys::f2D3DBias = 0.75f; +uint32_t plgAudioSys::fDebugFlags = 0; +float plgAudioSys::fStreamingBufferSize = 2.f; +float plgAudioSys::fStreamFromRAMCutoff = 10.f; +uint8_t plgAudioSys::fPriorityCutoff = 9; // We cut off sounds above this priority hsBool plgAudioSys::fEnableExtendedLogs = false; -hsScalar plgAudioSys::fGlobalFadeVolume = 1.f; +float plgAudioSys::fGlobalFadeVolume = 1.f; hsBool plgAudioSys::fLogStreamingUpdates = false; std::string plgAudioSys::fDeviceName; hsBool plgAudioSys::fRestarting = false; @@ -1011,7 +1011,7 @@ hsBool plgAudioSys::fMutedStateChange = false; void plgAudioSys::Init(hsWindowHndl hWnd) { - fSys = TRACKED_NEW plAudioSystem; + fSys = new plAudioSystem; fSys->RegisterAs( kAudioSystem_KEY ); plgDispatch::Dispatch()->RegisterForExactType( plAudioSysMsg::Index(), fSys->GetKey() ); plgDispatch::Dispatch()->RegisterForExactType( plRenderMsg::Index(), fSys->GetKey() ); @@ -1159,7 +1159,7 @@ void plgAudioSys::Activate(hsBool b) if( !IsMuted() ) { SetMuted( true ); - plAudioSysMsg *msg = TRACKED_NEW plAudioSysMsg( plAudioSysMsg::kUnmuteAll ); + plAudioSysMsg *msg = new plAudioSysMsg( plAudioSysMsg::kUnmuteAll ); msg->SetTimeStamp( hsTimer::GetSysSeconds() ); msg->AddReceiver( fSys->GetKey() ); msg->SetBCastFlag( plMessage::kBCastByExactType, false ); @@ -1171,11 +1171,11 @@ void plgAudioSys::Activate(hsBool b) fSys->SetActive( false ); plStatusLog::AddLineS( "audio.log", plStatusLog::kBlue, "ASYS: -- Sending deactivate/destroy messages --" ); - plgDispatch::MsgSend( TRACKED_NEW plAudioSysMsg( plAudioSysMsg::kDeActivate ) ); + plgDispatch::MsgSend( new plAudioSysMsg( plAudioSysMsg::kDeActivate ) ); // Send ourselves a shutdown message, so that the deactivates get processed first fSys->fWaitingForShutdown = true; - plAudioSysMsg *msg = TRACKED_NEW plAudioSysMsg( plAudioSysMsg::kDestroy ); + plAudioSysMsg *msg = new plAudioSysMsg( plAudioSysMsg::kDestroy ); msg->SetBCastFlag( plMessage::kBCastByExactType, false ); msg->Send( fSys->GetKey() ); // fSys->Shutdown(); @@ -1183,12 +1183,12 @@ void plgAudioSys::Activate(hsBool b) fInit = false; } -void plgAudioSys::SetChannelVolume( ASChannel chan, hsScalar vol ) +void plgAudioSys::SetChannelVolume( ASChannel chan, float vol ) { fChannelVolumes[ chan ] = vol; } -void plgAudioSys::SetGlobalFadeVolume( hsScalar vol ) +void plgAudioSys::SetGlobalFadeVolume( float vol ) { if(!fMuted) fGlobalFadeVolume = vol; @@ -1196,7 +1196,7 @@ void plgAudioSys::SetGlobalFadeVolume( hsScalar vol ) fGlobalFadeVolume = 0; } -hsScalar plgAudioSys::GetChannelVolume( ASChannel chan ) +float plgAudioSys::GetChannelVolume( ASChannel chan ) { return fChannelVolumes[ chan ]; } @@ -1206,12 +1206,12 @@ void plgAudioSys::NextDebugSound( void ) fSys->NextDebugSound(); } -void plgAudioSys::Set2D3DBias( hsScalar bias ) +void plgAudioSys::Set2D3DBias( float bias ) { f2D3DBias = bias; } -hsScalar plgAudioSys::Get2D3Dbias() +float plgAudioSys::Get2D3Dbias() { return f2D3DBias; } diff --git a/Sources/Plasma/PubUtilLib/plAudio/plAudioSystem.h b/Sources/Plasma/PubUtilLib/plAudio/plAudioSystem.h index 332ae85c..0f949acc 100644 --- a/Sources/Plasma/PubUtilLib/plAudio/plAudioSystem.h +++ b/Sources/Plasma/PubUtilLib/plAudio/plAudioSystem.h @@ -42,8 +42,8 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #ifndef plAudioSystem_h #define plAudioSystem_h +#include "HeadSpin.h" #include "hsStlUtils.h" -#include "hsWindowHndl.h" #include "hsTemplates.h" #include "hsGeometry3.h" #include "pnKeyedObject/hsKeyedObject.h" @@ -128,13 +128,13 @@ protected: plSoftSoundNode *fActiveSofts; plStatusLog *fDebugActiveSoundDisplay; - static Int32 fMaxNumSounds, fNumSoundsSlop; // max number of sounds the engine is allowed to audibly play. Different than fMaxNumSources. That is the max number of sounds the audio card can play + static int32_t fMaxNumSounds, fNumSoundsSlop; // max number of sounds the engine is allowed to audibly play. Different than fMaxNumSources. That is the max number of sounds the audio card can play plSoftSoundNode *fCurrDebugSound; hsTArray fPendingRegisters; hsPoint3 fCurrListenerPos;//, fCommittedListenerPos; hsBool fActive, fUsingEAX, fRestartOnDestruct, fWaitingForShutdown; - Int64 fStartTime; + int64_t fStartTime; hsTArray fMyRefs; hsTArray fEAXRegions; @@ -154,7 +154,7 @@ protected: void RegisterSoftSound( const plKey soundKey ); void UnregisterSoftSound( const plKey soundKey ); void IUpdateSoftSounds( const hsPoint3 &newPosition ); - UInt32 IScaleVolume(float volume); + uint32_t IScaleVolume(float volume); void IEnumerateDevices(); public: @@ -205,30 +205,30 @@ public: static void NextDebugSound( void ); - static void SetChannelVolume( ASChannel chan, hsScalar vol ); - static hsScalar GetChannelVolume( ASChannel chan ); + static void SetChannelVolume( ASChannel chan, float vol ); + static float GetChannelVolume( ASChannel chan ); - static void Set2D3DBias( hsScalar bias ); - static hsScalar Get2D3Dbias(); + static void Set2D3DBias( float bias ); + static float Get2D3Dbias(); - static void SetGlobalFadeVolume( hsScalar vol ); - static hsScalar GetGlobalFadeVolume( void ) { return fGlobalFadeVolume; } + static void SetGlobalFadeVolume( float vol ); + static float GetGlobalFadeVolume( void ) { return fGlobalFadeVolume; } - static void SetDebugFlag( UInt32 flag, hsBool set = true ) { if( set ) fDebugFlags |= flag; else fDebugFlags &= ~flag; } - static hsBool IsDebugFlagSet( UInt32 flag ) { return fDebugFlags & flag; } + static void SetDebugFlag( uint32_t flag, hsBool set = true ) { if( set ) fDebugFlags |= flag; else fDebugFlags &= ~flag; } + static hsBool IsDebugFlagSet( uint32_t flag ) { return fDebugFlags & flag; } static void ClearDebugFlags( void ) { fDebugFlags = 0; } - static hsScalar GetStreamingBufferSize( void ) { return fStreamingBufferSize; } - static void SetStreamingBufferSize( hsScalar size ) { fStreamingBufferSize = size; } + static float GetStreamingBufferSize( void ) { return fStreamingBufferSize; } + static void SetStreamingBufferSize( float size ) { fStreamingBufferSize = size; } - static UInt8 GetPriorityCutoff( void ) { return fPriorityCutoff; } - static void SetPriorityCutoff( UInt8 cut ) { fPriorityCutoff = cut; if(fSys) fSys->SetMaxNumberOfActiveSounds(); } + static uint8_t GetPriorityCutoff( void ) { return fPriorityCutoff; } + static void SetPriorityCutoff( uint8_t cut ) { fPriorityCutoff = cut; if(fSys) fSys->SetMaxNumberOfActiveSounds(); } static hsBool AreExtendedLogsEnabled( void ) { return fEnableExtendedLogs; } static void EnableExtendedLogs( hsBool e ) { fEnableExtendedLogs = e; } - static hsScalar GetStreamFromRAMCutoff( void ) { return fStreamFromRAMCutoff; } - static void SetStreamFromRAMCutoff( hsScalar c ) { fStreamFromRAMCutoff = c; } + static float GetStreamFromRAMCutoff( void ) { return fStreamFromRAMCutoff; } + static void SetStreamFromRAMCutoff( float c ) { fStreamFromRAMCutoff = c; } static void SetListenerPos(const hsPoint3 pos); static void SetListenerVelocity(const hsVector3 vel); @@ -261,15 +261,15 @@ private: static hsWindowHndl fWnd; static hsBool fUseHardware; static hsBool fDelayedActivate; - static hsScalar fChannelVolumes[ kNumChannels ]; - static hsScalar fGlobalFadeVolume; - static UInt32 fDebugFlags; + static float fChannelVolumes[ kNumChannels ]; + static float fGlobalFadeVolume; + static uint32_t fDebugFlags; static hsBool fEnableEAX; - static hsScalar fStreamingBufferSize; - static UInt8 fPriorityCutoff; + static float fStreamingBufferSize; + static uint8_t fPriorityCutoff; static hsBool fEnableExtendedLogs; - static hsScalar fStreamFromRAMCutoff; - static hsScalar f2D3DBias; + static float fStreamFromRAMCutoff; + static float f2D3DBias; static hsBool fLogStreamingUpdates; static std::string fDeviceName; static hsBool fRestarting; diff --git a/Sources/Plasma/PubUtilLib/plAudio/plDSoundBuffer.cpp b/Sources/Plasma/PubUtilLib/plAudio/plDSoundBuffer.cpp index bdd653cd..d246b948 100644 --- a/Sources/Plasma/PubUtilLib/plAudio/plDSoundBuffer.cpp +++ b/Sources/Plasma/PubUtilLib/plAudio/plDSoundBuffer.cpp @@ -47,7 +47,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // // ////////////////////////////////////////////////////////////////////////////// -#include "hsTypes.h" +#include "HeadSpin.h" #include "hsThread.h" #include "plDSoundBuffer.h" #include @@ -62,14 +62,14 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "plStatusLog/plStatusLog.h" -UInt32 plDSoundBuffer::fNumBuffers = 0; +uint32_t plDSoundBuffer::fNumBuffers = 0; plProfile_CreateCounterNoReset( "Playing", "Sound", SoundPlaying ); plProfile_CreateCounterNoReset( "Allocated", "Sound", NumAllocated ); //// Constructor/Destructor ////////////////////////////////////////////////// -plDSoundBuffer::plDSoundBuffer( UInt32 size, plWAVHeader &bufferDesc, hsBool enable3D, hsBool isLooping, hsBool tryStatic, bool streaming ) +plDSoundBuffer::plDSoundBuffer( uint32_t size, plWAVHeader &bufferDesc, hsBool enable3D, hsBool isLooping, hsBool tryStatic, bool streaming ) { fLooping = isLooping; fValid = false; @@ -100,10 +100,10 @@ plDSoundBuffer::~plDSoundBuffer() //// IAllocate /////////////////////////////////////////////////////////////// -void plDSoundBuffer::IAllocate( UInt32 size, plWAVHeader &bufferDesc, hsBool enable3D, hsBool tryStatic ) +void plDSoundBuffer::IAllocate( uint32_t size, plWAVHeader &bufferDesc, hsBool enable3D, hsBool tryStatic ) { // Create a DSound buffer description - fBufferDesc = TRACKED_NEW plWAVHeader; + fBufferDesc = new plWAVHeader; *fBufferDesc = bufferDesc; fBufferSize = size; @@ -317,7 +317,7 @@ bool plDSoundBuffer::SetupStreamingSource(void *data, unsigned bytes) if(!size) break; - MemCopy(bufferData, pData, size); + memcpy(bufferData, pData, size); pData += size; bytes-= size; numBuffersToQueue++; @@ -699,28 +699,28 @@ hsBool plDSoundBuffer::IsEAXAccelerated( void ) const return fEAXSource.IsValid(); } -//// BytePosToMSecs ////////////////////////////////////////////////////////// +//// bytePosToMSecs ////////////////////////////////////////////////////////// -UInt32 plDSoundBuffer::BytePosToMSecs( UInt32 bytePos ) const +uint32_t plDSoundBuffer::bytePosToMSecs( uint32_t bytePos ) const { - return (UInt32)(bytePos * 1000 / (hsScalar)fBufferDesc->fAvgBytesPerSec); + return (uint32_t)(bytePos * 1000 / (float)fBufferDesc->fAvgBytesPerSec); } //// GetBufferBytePos //////////////////////////////////////////////////////// -UInt32 plDSoundBuffer::GetBufferBytePos( hsScalar timeInSecs ) const +uint32_t plDSoundBuffer::GetBufferBytePos( float timeInSecs ) const { hsAssert( fBufferDesc != nil, "Nil buffer description when calling GetBufferBytePos()" ); - UInt32 byte = (UInt32)( timeInSecs * (hsScalar)fBufferDesc->fNumSamplesPerSec ); - byte *= fBufferDesc->fBlockAlign; + uint32_t uint8_t = (uint32_t)( timeInSecs * (float)fBufferDesc->fNumSamplesPerSec ); + uint8_t *= fBufferDesc->fBlockAlign; - return byte; + return uint8_t; } //// GetLengthInBytes //////////////////////////////////////////////////////// -UInt32 plDSoundBuffer::GetLengthInBytes( void ) const +uint32_t plDSoundBuffer::GetLengthInBytes( void ) const { return fBufferSize; } @@ -734,7 +734,7 @@ void plDSoundBuffer::SetEAXSettings( plEAXSourceSettings *settings, hsBool f //// GetBlockAlign /////////////////////////////////////////////////////////// -UInt8 plDSoundBuffer::GetBlockAlign( void ) const +uint8_t plDSoundBuffer::GetBlockAlign( void ) const { return ( fBufferDesc != nil ) ? fBufferDesc->fBlockAlign : 0; } @@ -742,7 +742,7 @@ UInt8 plDSoundBuffer::GetBlockAlign( void ) const //// SetScalarVolume ///////////////////////////////////////////////////////// // Sets the volume, but on a range from 0 to 1 -void plDSoundBuffer::SetScalarVolume( hsScalar volume ) +void plDSoundBuffer::SetScalarVolume( float volume ) { if(source) { diff --git a/Sources/Plasma/PubUtilLib/plAudio/plDSoundBuffer.h b/Sources/Plasma/PubUtilLib/plAudio/plDSoundBuffer.h index 57b91571..91d79f7a 100644 --- a/Sources/Plasma/PubUtilLib/plAudio/plDSoundBuffer.h +++ b/Sources/Plasma/PubUtilLib/plAudio/plDSoundBuffer.h @@ -68,15 +68,15 @@ class plAudioFileReader; class plDSoundBuffer { public: - plDSoundBuffer( UInt32 size, plWAVHeader &bufferDesc, hsBool enable3D, hsBool looping, hsBool tryStatic = false, bool streaming = false ); + plDSoundBuffer( uint32_t size, plWAVHeader &bufferDesc, hsBool enable3D, hsBool looping, hsBool tryStatic = false, bool streaming = false ); ~plDSoundBuffer(); void Play( void ); void Stop( void ); void Rewind() ; - UInt32 GetLengthInBytes( void ) const; - void SetScalarVolume( hsScalar volume ); // Sets the volume, but on a range from 0 to 1 + uint32_t GetLengthInBytes( void ) const; + void SetScalarVolume( float volume ); // Sets the volume, but on a range from 0 to 1 unsigned GetSource() { return source; } void SetPosition(float x, float y, float z); @@ -109,13 +109,13 @@ public: unsigned GetByteOffset(); - UInt32 GetBufferBytePos( hsScalar timeInSecs ) const; - UInt32 BytePosToMSecs( UInt32 bytePos ) const; + uint32_t GetBufferBytePos( float timeInSecs ) const; + uint32_t bytePosToMSecs( uint32_t bytePos ) const; void SetEAXSettings( plEAXSourceSettings *settings, hsBool force = false ); void SetTimeOffsetBytes(unsigned bytes); - UInt8 GetBlockAlign( void ) const; - static UInt32 GetNumBuffers() { return fNumBuffers; } + uint8_t GetBlockAlign( void ) const; + static uint32_t GetNumBuffers() { return fNumBuffers; } float GetDefaultMinDistance() { return fDefaultMinDistance; } bool GetAvailableBufferId(unsigned *bufferId); unsigned GetNumQueuedBuffers(){ return fNumQueuedBuffers;} // returns the max number of buffers queued on a source @@ -135,13 +135,13 @@ protected: BufferType fType; hsBool fValid, fLooping; - UInt32 fLockLength; + uint32_t fLockLength; void * fLockPtr; - hsTArray fPosNotifys; + hsTArray fPosNotifys; bool fStreaming; plWAVHeader* fBufferDesc; - UInt32 fBufferSize; + uint32_t fBufferSize; unsigned buffer; // used if this is not a streaming buffer unsigned streamingBuffers[STREAMING_BUFFERS]; // used if this is a streaming buffer @@ -152,13 +152,13 @@ protected: plEAXSource fEAXSource; - static UInt32 fNumBuffers; + static uint32_t fNumBuffers; static float fDefaultMinDistance; unsigned fNumQueuedBuffers; - hsScalar fPrevVolume; + float fPrevVolume; - void IAllocate( UInt32 size, plWAVHeader &bufferDesc, hsBool enable3D, hsBool tryStatic ); + void IAllocate( uint32_t size, plWAVHeader &bufferDesc, hsBool enable3D, hsBool tryStatic ); void IRelease( void ); int IGetALFormat(unsigned bitsPerSample, unsigned int numChannels); }; diff --git a/Sources/Plasma/PubUtilLib/plAudio/plEAXEffects.cpp b/Sources/Plasma/PubUtilLib/plAudio/plEAXEffects.cpp index c1578ca3..75a44c55 100644 --- a/Sources/Plasma/PubUtilLib/plAudio/plEAXEffects.cpp +++ b/Sources/Plasma/PubUtilLib/plAudio/plEAXEffects.cpp @@ -46,7 +46,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // // ////////////////////////////////////////////////////////////////////////////// -#include "hsTypes.h" +#include "HeadSpin.h" #include "hsThread.h" #ifndef EAX_SDK_AVAILABLE #include "plEAXStructures.h" @@ -251,13 +251,13 @@ void plEAXListener::IFail( const char *msg, hsBool major ) // Mutes the given properties, so if you have some props that you want // half strength, this function will do it for ya. -void plEAXListener::IMuteProperties( EAXREVERBPROPERTIES *props, hsScalar percent ) +void plEAXListener::IMuteProperties( EAXREVERBPROPERTIES *props, float percent ) { // We only mute the room, roomHF and roomLF, since those control the overall effect // application. All three are a direct linear blend as defined by eax-util.cpp, so // this should be rather easy - hsScalar invPercent = 1.f - percent; + float invPercent = 1.f - percent; // The old way, as dictated by EAX sample code... #ifdef EAX_SDK_AVAILABLE @@ -359,7 +359,7 @@ void plEAXListener::ProcessMods( hsTArray &modArray ) } else { - hsScalar scale = strength / ( totalStrength + strength ); + float scale = strength / ( totalStrength + strength ); EAX3ListenerInterpolate( &finalProps, modArray[ i ]->GetListenerProps(), scale, &finalProps, false ); totalStrength += strength; bMorphing = true; @@ -512,7 +512,7 @@ void plEAXSourceSettings::Write( hsStream *s ) } } -void plEAXSourceSettings::SetRoomParams( Int16 room, Int16 roomHF, hsBool roomAuto, hsBool roomHFAuto ) +void plEAXSourceSettings::SetRoomParams( int16_t room, int16_t roomHF, hsBool roomAuto, hsBool roomHFAuto ) { fRoom = room; fRoomHF = roomHF; @@ -551,13 +551,13 @@ void plEAXSourceSettings::Enable( hsBool e ) } } -void plEAXSourceSettings::SetOutsideVolHF( Int16 vol ) +void plEAXSourceSettings::SetOutsideVolHF( int16_t vol ) { fOutsideVolHF = vol; fDirtyParams |= kOutsideVolHF; } -void plEAXSourceSettings::SetFactors( hsScalar airAbsorption, hsScalar roomRolloff, hsScalar doppler, hsScalar rolloff ) +void plEAXSourceSettings::SetFactors( float airAbsorption, float roomRolloff, float doppler, float rolloff ) { fAirAbsorptionFactor = airAbsorption; fRoomRolloffFactor = roomRolloff; @@ -566,7 +566,7 @@ void plEAXSourceSettings::SetFactors( hsScalar airAbsorption, hsScalar roomRo fDirtyParams |= kFactors; } -void plEAXSourceSettings::SetOcclusionSoftValue( hsScalar value ) +void plEAXSourceSettings::SetOcclusionSoftValue( float value ) { if( fOcclusionSoftValue != value ) { @@ -576,19 +576,19 @@ void plEAXSourceSettings::SetOcclusionSoftValue( hsScalar value ) } } -void plEAXSourceSettings::IRecalcSofts( UInt8 whichOnes ) +void plEAXSourceSettings::IRecalcSofts( uint8_t whichOnes ) { - hsScalar percent, invPercent; + float percent, invPercent; if( whichOnes & kOcclusion ) { percent = fOcclusionSoftValue; invPercent = 1.f - percent; - Int16 occ = (Int16)( ( (float)fSoftStarts.GetOcclusion() * invPercent ) + ( (float)fSoftEnds.GetOcclusion() * percent ) ); - hsScalar lfRatio = (hsScalar)( ( fSoftStarts.GetOcclusionLFRatio() * invPercent ) + ( fSoftEnds.GetOcclusionLFRatio() * percent ) ); - hsScalar roomRatio = (hsScalar)( ( fSoftStarts.GetOcclusionRoomRatio() * invPercent ) + ( fSoftEnds.GetOcclusionRoomRatio() * percent ) ); - hsScalar directRatio = (hsScalar)( ( fSoftStarts.GetOcclusionDirectRatio() * invPercent ) + ( fSoftEnds.GetOcclusionDirectRatio() * percent ) ); + int16_t occ = (int16_t)( ( (float)fSoftStarts.GetOcclusion() * invPercent ) + ( (float)fSoftEnds.GetOcclusion() * percent ) ); + float lfRatio = (float)( ( fSoftStarts.GetOcclusionLFRatio() * invPercent ) + ( fSoftEnds.GetOcclusionLFRatio() * percent ) ); + float roomRatio = (float)( ( fSoftStarts.GetOcclusionRoomRatio() * invPercent ) + ( fSoftEnds.GetOcclusionRoomRatio() * percent ) ); + float directRatio = (float)( ( fSoftStarts.GetOcclusionDirectRatio() * invPercent ) + ( fSoftEnds.GetOcclusionDirectRatio() * percent ) ); fCurrSoftValues.SetOcclusion( occ, lfRatio, roomRatio, directRatio ); } @@ -623,7 +623,7 @@ void plEAXSourceSoftSettings::Write( hsStream *s ) s->WriteLE( fOcclusionDirectRatio ); } -void plEAXSourceSoftSettings::SetOcclusion( Int16 occ, hsScalar lfRatio, hsScalar roomRatio, hsScalar directRatio ) +void plEAXSourceSoftSettings::SetOcclusion( int16_t occ, float lfRatio, float roomRatio, float directRatio ) { fOcclusion = occ; fOcclusionLFRatio = lfRatio; @@ -668,7 +668,7 @@ hsBool plEAXSource::IsValid( void ) const void plEAXSource::SetFrom( plEAXSourceSettings *settings, unsigned source, hsBool force ) { - UInt32 dirtyParams; + uint32_t dirtyParams; if(source == 0 || !fInit) return; diff --git a/Sources/Plasma/PubUtilLib/plAudio/plEAXEffects.h b/Sources/Plasma/PubUtilLib/plAudio/plEAXEffects.h index 97a67531..2df41bc7 100644 --- a/Sources/Plasma/PubUtilLib/plAudio/plEAXEffects.h +++ b/Sources/Plasma/PubUtilLib/plAudio/plEAXEffects.h @@ -50,7 +50,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #define _plEAXEffects_h -#include "hsTypes.h" +#include "HeadSpin.h" #include "hsTemplates.h" @@ -90,14 +90,14 @@ protected: void IFail( const char *msg, hsBool major ); void IRelease( void ); - void IMuteProperties( EAXREVERBPROPERTIES *props, hsScalar percent ); + void IMuteProperties( EAXREVERBPROPERTIES *props, float percent ); hsBool fInited; // Cache info - Int32 fLastModCount; + int32_t fLastModCount; hsBool fLastWasEmpty; - hsScalar fLastSingleStrength; + float fLastSingleStrength; plEAXListenerMod *fLastBigRegion; }; @@ -110,17 +110,17 @@ class hsStream; class plEAXSourceSoftSettings { public: - Int16 fOcclusion; - hsScalar fOcclusionLFRatio, fOcclusionRoomRatio, fOcclusionDirectRatio; + int16_t fOcclusion; + float fOcclusionLFRatio, fOcclusionRoomRatio, fOcclusionDirectRatio; void Read( hsStream *s ); void Write( hsStream *s ); - void SetOcclusion( Int16 occ, hsScalar lfRatio, hsScalar roomRatio, hsScalar directRatio ); - Int16 GetOcclusion( void ) const { return fOcclusion; } - hsScalar GetOcclusionLFRatio( void ) const { return fOcclusionLFRatio; } - hsScalar GetOcclusionRoomRatio( void ) const { return fOcclusionRoomRatio; } - hsScalar GetOcclusionDirectRatio( void ) const { return fOcclusionDirectRatio; } + void SetOcclusion( int16_t occ, float lfRatio, float roomRatio, float directRatio ); + int16_t GetOcclusion( void ) const { return fOcclusion; } + float GetOcclusionLFRatio( void ) const { return fOcclusionLFRatio; } + float GetOcclusionRoomRatio( void ) const { return fOcclusionRoomRatio; } + float GetOcclusionDirectRatio( void ) const { return fOcclusionDirectRatio; } void Reset( void ); }; @@ -141,28 +141,28 @@ class plEAXSourceSettings void Enable( hsBool e ); hsBool IsEnabled( void ) const { return fEnabled; } - void SetRoomParams( Int16 room, Int16 roomHF, hsBool roomAuto, hsBool roomHFAuto ); - Int16 GetRoom( void ) const { return fRoom; } - Int16 GetRoomHF( void ) const { return fRoomHF; } + void SetRoomParams( int16_t room, int16_t roomHF, hsBool roomAuto, hsBool roomHFAuto ); + int16_t GetRoom( void ) const { return fRoom; } + int16_t GetRoomHF( void ) const { return fRoomHF; } hsBool GetRoomAuto( void ) const { return fRoomAuto; } hsBool GetRoomHFAuto( void ) const { return fRoomHFAuto; } - void SetOutsideVolHF( Int16 vol ); - Int16 GetOutsideVolHF( void ) const { return fOutsideVolHF; } + void SetOutsideVolHF( int16_t vol ); + int16_t GetOutsideVolHF( void ) const { return fOutsideVolHF; } - void SetFactors( hsScalar airAbsorption, hsScalar roomRolloff, hsScalar doppler, hsScalar rolloff ); - hsScalar GetAirAbsorptionFactor( void ) const { return fAirAbsorptionFactor; } - hsScalar GetRoomRolloffFactor( void ) const { return fRoomRolloffFactor; } - hsScalar GetDopplerFactor( void ) const { return fDopplerFactor; } - hsScalar GetRolloffFactor( void ) const { return fRolloffFactor; } + void SetFactors( float airAbsorption, float roomRolloff, float doppler, float rolloff ); + float GetAirAbsorptionFactor( void ) const { return fAirAbsorptionFactor; } + float GetRoomRolloffFactor( void ) const { return fRoomRolloffFactor; } + float GetDopplerFactor( void ) const { return fDopplerFactor; } + float GetRolloffFactor( void ) const { return fRolloffFactor; } plEAXSourceSoftSettings &GetSoftStarts( void ) { return fSoftStarts; } plEAXSourceSoftSettings &GetSoftEnds( void ) { return fSoftEnds; } plEAXSourceSoftSettings &GetCurrSofts( void ) { return fCurrSoftValues; } - void SetOcclusionSoftValue( hsScalar value ); - hsScalar GetOcclusionSoftValue( void ) const { return fOcclusionSoftValue; } + void SetOcclusionSoftValue( float value ); + float GetOcclusionSoftValue( void ) const { return fOcclusionSoftValue; } void ClearDirtyParams( void ) const { fDirtyParams = 0; } @@ -171,13 +171,13 @@ class plEAXSourceSettings friend class plEAXSourceSoftSettings; hsBool fEnabled; - Int16 fRoom, fRoomHF; + int16_t fRoom, fRoomHF; hsBool fRoomAuto, fRoomHFAuto; - Int16 fOutsideVolHF; - hsScalar fAirAbsorptionFactor, fRoomRolloffFactor, fDopplerFactor, fRolloffFactor; + int16_t fOutsideVolHF; + float fAirAbsorptionFactor, fRoomRolloffFactor, fDopplerFactor, fRolloffFactor; plEAXSourceSoftSettings fSoftStarts, fSoftEnds, fCurrSoftValues; - hsScalar fOcclusionSoftValue; - mutable UInt32 fDirtyParams; + float fOcclusionSoftValue; + mutable uint32_t fDirtyParams; enum ParamSets { @@ -188,7 +188,7 @@ class plEAXSourceSettings kAll = 0xff }; - void IRecalcSofts( UInt8 whichOnes ); + void IRecalcSofts( uint8_t whichOnes ); }; //// Source Class Definition ////////////////////////////////////////////////// diff --git a/Sources/Plasma/PubUtilLib/plAudio/plEAXListenerMod.cpp b/Sources/Plasma/PubUtilLib/plAudio/plEAXListenerMod.cpp index 5b6e2af2..cae75865 100644 --- a/Sources/Plasma/PubUtilLib/plAudio/plEAXListenerMod.cpp +++ b/Sources/Plasma/PubUtilLib/plAudio/plEAXListenerMod.cpp @@ -48,7 +48,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #ifndef EAX_SDK_AVAILABLE #include "plEAXStructures.h" #endif -#include "hsTypes.h" +#include "HeadSpin.h" #include "plEAXListenerMod.h" #include "plIntersect/plSoftVolume.h" #include "hsResMgr.h" @@ -63,7 +63,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com plEAXListenerMod::plEAXListenerMod() { - fListenerProps = TRACKED_NEW EAXREVERBPROPERTIES; + fListenerProps = new EAXREVERBPROPERTIES; fSoftRegion = nil; fRegistered = false; fGetsMessages = false; @@ -102,7 +102,7 @@ void plEAXListenerMod::IRegister( void ) plKey sysKey = hsgResMgr::ResMgr()->FindKey( plUoid( kAudioSystem_KEY ) ); if( sysKey != nil ) { - plGenRefMsg *refMsg = TRACKED_NEW plGenRefMsg( sysKey, plRefMsg::kOnCreate, 0, plAudioSystem::kRefEAXRegion ); + plGenRefMsg *refMsg = new plGenRefMsg( sysKey, plRefMsg::kOnCreate, 0, plAudioSystem::kRefEAXRegion ); hsgResMgr::ResMgr()->AddViaNotify( GetKey(), refMsg, plRefFlags::kPassiveRef ); fRegistered = true; } @@ -120,7 +120,7 @@ void plEAXListenerMod::IUnRegister( void ) fRegistered = false; } -hsBool plEAXListenerMod::IEval( double secs, hsScalar del, UInt32 dirty ) +hsBool plEAXListenerMod::IEval( double secs, float del, uint32_t dirty ) { IRegister(); return false; @@ -170,7 +170,7 @@ void plEAXListenerMod::Read( hsStream* s, hsResMgr* mgr ) plSingleModifier::Read( s, mgr ); // Read in the soft region - mgr->ReadKeyNotifyMe( s, TRACKED_NEW plGenRefMsg( GetKey(), plRefMsg::kOnCreate, 0, kRefSoftRegion ), plRefFlags::kActiveRef ); + mgr->ReadKeyNotifyMe( s, new plGenRefMsg( GetKey(), plRefMsg::kOnCreate, 0, kRefSoftRegion ), plRefFlags::kActiveRef ); // Read the listener params fListenerProps->ulEnvironment = s->ReadLE32(); @@ -237,7 +237,7 @@ void plEAXListenerMod::Write( hsStream* s, hsResMgr* mgr ) } -void plEAXListenerMod::SetFromPreset( UInt32 preset ) +void plEAXListenerMod::SetFromPreset( uint32_t preset ) { #ifdef EAX_SDK_AVAILABLE memcpy( fListenerProps, &REVERB_ORIGINAL_PRESETS[ preset ], sizeof( EAXREVERBPROPERTIES ) ); diff --git a/Sources/Plasma/PubUtilLib/plAudio/plEAXListenerMod.h b/Sources/Plasma/PubUtilLib/plAudio/plEAXListenerMod.h index 6fc17e4a..d898babb 100644 --- a/Sources/Plasma/PubUtilLib/plAudio/plEAXListenerMod.h +++ b/Sources/Plasma/PubUtilLib/plAudio/plEAXListenerMod.h @@ -78,7 +78,7 @@ public: float GetStrength( void ); EAXREVERBPROPERTIES * GetListenerProps( void ) { return fListenerProps; } - void SetFromPreset( UInt32 preset ); + void SetFromPreset( uint32_t preset ); protected: plSoftVolume *fSoftRegion; @@ -87,7 +87,7 @@ protected: void IRegister( void ); void IUnRegister( void ); - virtual hsBool IEval( double secs, hsScalar del, UInt32 dirty ); // called only by owner object's Eval() + virtual hsBool IEval( double secs, float del, uint32_t dirty ); // called only by owner object's Eval() }; #endif // _plEAXListenerMod_h diff --git a/Sources/Plasma/PubUtilLib/plAudio/plSound.cpp b/Sources/Plasma/PubUtilLib/plAudio/plSound.cpp index e63f29d8..6d019be9 100644 --- a/Sources/Plasma/PubUtilLib/plAudio/plSound.cpp +++ b/Sources/Plasma/PubUtilLib/plAudio/plSound.cpp @@ -39,8 +39,8 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com Mead, WA 99021 *==LICENSE==*/ -#include "hsTypes.h" -#include "hsUtils.h" +#include "HeadSpin.h" + #include "hsResMgr.h" #include "hsTimer.h" #include "hsGeometry3.h" @@ -168,10 +168,10 @@ void plSound::IUpdateDebugPlate( void ) } fDebugPlate->SetVisible( true ); - fDebugPlate->AddData( (Int32)( fDesiredVol * 100.f ), - (Int32)( fCurrVolume * 100.f ), - (Int32)( fSoftVolume * 100.f ), - (Int32)( fDistAttenuation * 100.f ) ); + fDebugPlate->AddData( (int32_t)( fDesiredVol * 100.f ), + (int32_t)( fCurrVolume * 100.f ), + (int32_t)( fSoftVolume * 100.f ), + (int32_t)( fDistAttenuation * 100.f ) ); } } @@ -311,7 +311,7 @@ void plSound::SynchedPlay(unsigned bytes ) // we're given, NOT the current time, 'cause, well, duh, that should be our // start time! // So think of it as "Play() but act as if you started at *this* time"... -void plSound::SynchedPlay( hsScalar virtualStartTime ) +void plSound::SynchedPlay( float virtualStartTime ) { if( fFading ) IStopFade(); @@ -432,7 +432,7 @@ void plSound::SetOuterVolume(const int v) fOuterVol = v; } -void plSound::SetConeOrientation( hsScalar x, hsScalar y, hsScalar z ) +void plSound::SetConeOrientation( float x, float y, float z ) { fConeOrientation.Set( x, y, z ); } @@ -561,9 +561,9 @@ void plSound::Update() } } -hsScalar plSound::IGetChannelVolume( void ) const +float plSound::IGetChannelVolume( void ) const { - hsScalar channelVol = plgAudioSys::GetChannelVolume( (plgAudioSys::ASChannel)fType ); + float channelVol = plgAudioSys::GetChannelVolume( (plgAudioSys::ASChannel)fType ); // if not using hardware acceleration then apply 2D/3D bias to non 3D sounds if( !plgAudioSys::Hardware() && !IsPropertySet( kPropIs3DSound ) ) @@ -575,7 +575,7 @@ hsScalar plSound::IGetChannelVolume( void ) const return channelVol * plgAudioSys::GetGlobalFadeVolume(); } -void plSound::IStartFade( plFadeParams *params, hsScalar offsetIntoFade ) +void plSound::IStartFade( plFadeParams *params, float offsetIntoFade ) { fFading = true; @@ -924,27 +924,27 @@ void plSound::ISetSoftOcclusionRegion( plSoftVolume *region ) ///////////////////////////////////////////////////////////////////////// // This function calculates our new softVolume value. Used both to update the // said value and so the audio system can rank us in importance. -hsScalar plSound::CalcSoftVolume( hsBool enable, hsScalar distToListenerSquared ) +float plSound::CalcSoftVolume( hsBool enable, float distToListenerSquared ) { // Do distance-based attenuation ourselves #if MCN_HACK_OUR_ATTEN if( IsPropertySet( kPropIs3DSound ) ) { - hsScalar minDist = (hsScalar)GetMin(); + float minDist = (float)GetMin(); if( distToListenerSquared <= minDist * minDist ) { fDistAttenuation = 1.f; } else { - hsScalar maxDist = (hsScalar)GetMax(); + float maxDist = (float)GetMax(); if( distToListenerSquared >= maxDist * maxDist ) { fDistAttenuation = 0.f; } else { - hsScalar d = (hsScalar)sqrt( distToListenerSquared ); + float d = (float)sqrt( distToListenerSquared ); fDistAttenuation = minDist / d; // The following line ramps it to 0 at the maxDistance. Kinda klunky, but good for now I guess... @@ -959,8 +959,8 @@ hsScalar plSound::CalcSoftVolume( hsBool enable, hsScalar distToListenerSquared // ramp down to 0 so we don't get annoying popping when we stop stuff if( IsPropertySet( kPropIs3DSound ) ) { - hsScalar maxDistSquared = (hsScalar)( GetMax() * GetMax() ); - hsScalar distToStartSquared = (hsScalar)(maxDistSquared * 0.50); + float maxDistSquared = (float)( GetMax() * GetMax() ); + float distToStartSquared = (float)(maxDistSquared * 0.50); if( maxDistSquared < 0.f ) // Happens when the max distance is REALLY big { @@ -999,21 +999,21 @@ hsScalar plSound::CalcSoftVolume( hsBool enable, hsScalar distToListenerSquared // Wee function for the audio system. This basically returns the effective // current volume of this sound. Useful for doing things like ranking all // sounds based on volume. -hsScalar plSound::GetVolumeRank( void ) +float plSound::GetVolumeRank( void ) { if( !IsPlaying() && !this->IActuallyPlaying() ) return 0.f; - hsScalar rank = fSoftVolume * fDesiredVol; + float rank = fSoftVolume * fDesiredVol; if( IsPropertySet( kPropIs3DSound ) ) { - hsScalar minDistSquared = (hsScalar)( GetMin() * GetMin() ); - hsScalar maxDistSquared = (hsScalar) (GetMax() * GetMax()); + float minDistSquared = (float)( GetMin() * GetMin() ); + float maxDistSquared = (float) (GetMax() * GetMax()); hsPoint3 listenerPos = plgAudioSys::Sys()->GetCurrListenerPos(); if( fDistToListenerSquared > minDistSquared ) { - hsScalar diff = maxDistSquared - minDistSquared; + float diff = maxDistSquared - minDistSquared; rank *= fabs((fDistToListenerSquared - maxDistSquared)) / diff; } } @@ -1036,7 +1036,7 @@ hsBool plSound::IWillBeAbleToPlay( void ) ///////////////////////////////////////////////////////////////////////// // Tests to see whether this sound is within range of the position given, // ignoring soft volumes. -hsBool plSound::IsWithinRange( const hsPoint3 &listenerPos, hsScalar *distSquared ) +hsBool plSound::IsWithinRange( const hsPoint3 &listenerPos, float *distSquared ) { if( !IsPropertySet( plSound::kPropIs3DSound ) ) { @@ -1056,7 +1056,7 @@ hsBool plSound::IsWithinRange( const hsPoint3 &listenerPos, hsScalar *distSquare if( GetMax() == 1000000000 ) return true; - hsScalar soundRadius = (hsScalar)( GetMax() * GetMax() ); + float soundRadius = (float)( GetMax() * GetMax() ); return ( distance.MagnitudeSquared() <= soundRadius ) ? true : false; } @@ -1107,7 +1107,7 @@ void plSound::UpdateSoftVolume( hsBool enable, hsBool firstTime ) // Note: we just do it as a fade because it makes it easier on us that way! fCoolSoftVolumeTrickParams.fCurrTime = 0.f; - fCoolSoftVolumeTrickParams.fLengthInSecs = firstTime ? 0.f : (hsScalar)fLength + ( (hsScalar)fLength - (hsScalar)GetTime() ); + fCoolSoftVolumeTrickParams.fLengthInSecs = firstTime ? 0.f : (float)fLength + ( (float)fLength - (float)GetTime() ); fCoolSoftVolumeTrickParams.fStopWhenDone = true; fCoolSoftVolumeTrickParams.fFadeSoftVol = true; fCoolSoftVolumeTrickParams.fType = plFadeParams::kLinear; @@ -1125,7 +1125,7 @@ void plSound::UpdateSoftVolume( hsBool enable, hsBool firstTime ) ///////////////////////////////////////////////////////////////////////// // Returns the current volume, attenuated -hsScalar plSound::QueryCurrVolume( void ) const +float plSound::QueryCurrVolume( void ) const { return IAttenuateActualVolume( fCurrVolume ) * IGetChannelVolume(); } @@ -1133,7 +1133,7 @@ hsScalar plSound::QueryCurrVolume( void ) const ///////////////////////////////////////////////////////////////////////// // Used by ISetActualVolume(). Does the final attenuation on a volume before // sending it to the sound processing. Only does soft regions for now. -hsScalar plSound::IAttenuateActualVolume( hsScalar volume ) const +float plSound::IAttenuateActualVolume( float volume ) const { if( fNotHighEnoughPriority ) return 0.f; @@ -1297,7 +1297,7 @@ void plSound::IRead( hsStream *s, hsResMgr *mgr ) fFadeOutParams.Read( s ); // Read in soft volume key - mgr->ReadKeyNotifyMe( s, TRACKED_NEW plGenRefMsg( GetKey(), plRefMsg::kOnCreate, 0, kRefSoftVolume ), plRefFlags::kActiveRef ); + mgr->ReadKeyNotifyMe( s, new plGenRefMsg( GetKey(), plRefMsg::kOnCreate, 0, kRefSoftVolume ), plRefFlags::kActiveRef ); // Read in the data buffer key fDataBufferKey = mgr->ReadKey( s ); @@ -1306,7 +1306,7 @@ void plSound::IRead( hsStream *s, hsResMgr *mgr ) fEAXSettings.Read( s ); // EAX soft keys - mgr->ReadKeyNotifyMe( s, TRACKED_NEW plGenRefMsg( GetKey(), plRefMsg::kOnCreate, 0, kRefSoftOcclusionRegion ), plRefFlags::kActiveRef ); + mgr->ReadKeyNotifyMe( s, new plGenRefMsg( GetKey(), plRefMsg::kOnCreate, 0, kRefSoftOcclusionRegion ), plRefFlags::kActiveRef ); } void plSound::IWrite( hsStream *s, hsResMgr *mgr ) @@ -1367,9 +1367,9 @@ void plSound::plFadeParams::Write( hsStream *s ) s->WriteLE( fFadeSoftVol ); } -hsScalar plSound::plFadeParams::InterpValue( void ) +float plSound::plFadeParams::InterpValue( void ) { - hsScalar val; + float val; switch( fType ) { @@ -1382,7 +1382,7 @@ hsScalar plSound::plFadeParams::InterpValue( void ) break; case kExponential: val = fCurrTime / fLengthInSecs; - val = ( (hsScalar)sqrt( val ) * ( fVolEnd - fVolStart ) ) + fVolStart; + val = ( (float)sqrt( val ) * ( fVolEnd - fVolStart ) ) + fVolStart; break; default: val = 0.f; @@ -1390,7 +1390,7 @@ hsScalar plSound::plFadeParams::InterpValue( void ) return val; } -void plSound::SetFadeInEffect( plSound::plFadeParams::Type type, hsScalar length ) +void plSound::SetFadeInEffect( plSound::plFadeParams::Type type, float length ) { fFadeInParams.fLengthInSecs = length; fFadeInParams.fType = type; @@ -1406,7 +1406,7 @@ void plSound::SetFadeInEffect( plSound::plFadeParams::Type type, hsScalar length fFading = false; } -void plSound::SetFadeOutEffect( plSound::plFadeParams::Type type, hsScalar length ) +void plSound::SetFadeOutEffect( plSound::plFadeParams::Type type, float length ) { fFadeOutParams.fLengthInSecs = length; fFadeOutParams.fType = type; @@ -1416,15 +1416,15 @@ void plSound::SetFadeOutEffect( plSound::plFadeParams::Type type, hsScalar lengt fFadeOutParams.fStopWhenDone = true; } -plDrawableSpans* plSound::CreateProxy(const hsMatrix44& l2w, hsGMaterial* mat, hsTArray& idx, plDrawableSpans* addTo) +plDrawableSpans* plSound::CreateProxy(const hsMatrix44& l2w, hsGMaterial* mat, hsTArray& idx, plDrawableSpans* addTo) { plDrawableSpans* myDraw = addTo; if( fOuterCone < 360 ) { - hsScalar len = (hsScalar)GetMax(); - hsScalar halfAng = hsScalarDegToRad(hsScalar(fInnerCone) * 0.5f); - hsScalar radius = len * tanf(halfAng); + float len = (float)GetMax(); + float halfAng = hsDegreesToRadians(float(fInnerCone) * 0.5f); + float radius = len * tanf(halfAng); if( fInnerCone < 180 ) len = -len; myDraw = plDrawableGenerator::GenerateConicalDrawable( @@ -1437,8 +1437,8 @@ plDrawableSpans* plSound::CreateProxy(const hsMatrix44& l2w, hsGMaterial* mat, h &idx, myDraw); - len = (hsScalar)GetMin(); - halfAng = hsScalarDegToRad(hsScalar(fOuterCone) * 0.5f); + len = (float)GetMin(); + halfAng = hsDegreesToRadians(float(fOuterCone) * 0.5f); radius = len * tanf(halfAng); if( fOuterCone < 180 ) len = -len; @@ -1457,7 +1457,7 @@ plDrawableSpans* plSound::CreateProxy(const hsMatrix44& l2w, hsGMaterial* mat, h { myDraw = plDrawableGenerator::GenerateSphericalDrawable( hsPoint3(0,0,0), - (hsScalar)GetMin(), + (float)GetMin(), mat, l2w, true, @@ -1467,7 +1467,7 @@ plDrawableSpans* plSound::CreateProxy(const hsMatrix44& l2w, hsGMaterial* mat, h myDraw = plDrawableGenerator::GenerateSphericalDrawable( hsPoint3(0,0,0), - (hsScalar)GetMax(), + (float)GetMax(), mat, l2w, true, @@ -1480,7 +1480,7 @@ plDrawableSpans* plSound::CreateProxy(const hsMatrix44& l2w, hsGMaterial* mat, h // call when state has changed -hsBool plSound::DirtySynchState(const char* sdlName /* kSDLSound */, UInt32 sendFlags) +hsBool plSound::DirtySynchState(const char* sdlName /* kSDLSound */, uint32_t sendFlags) { /* if( sdlName == nil ) @@ -1502,9 +1502,9 @@ void plSoundVolumeApplicator::IApply( const plAGModifier *mod, double time ) plScalarChannel *chan = plScalarChannel::ConvertNoRef( fChannel ); if(chan) { - hsScalar volume = chan->Value( time ); + float volume = chan->Value( time ); - hsScalar digitalVolume = (float)pow( 10.f, volume / 20.f ); + float digitalVolume = (float)pow( 10.f, volume / 20.f ); // Find the audio interface and thus the plSound from it plSceneObject *so = mod->GetTarget( 0 ); diff --git a/Sources/Plasma/PubUtilLib/plAudio/plSound.h b/Sources/Plasma/PubUtilLib/plAudio/plSound.h index 9599e344..810921c8 100644 --- a/Sources/Plasma/PubUtilLib/plAudio/plSound.h +++ b/Sources/Plasma/PubUtilLib/plAudio/plSound.h @@ -149,16 +149,16 @@ public: kExponential }; - hsScalar fLengthInSecs; // Time to take to fade - hsScalar fVolStart; // Set one of these two for fade in/out, - hsScalar fVolEnd; // the other becomes the current volume - UInt8 fType; + float fLengthInSecs; // Time to take to fade + float fVolStart; // Set one of these two for fade in/out, + float fVolEnd; // the other becomes the current volume + uint8_t fType; hsBool fStopWhenDone; // Actually stop the sound once the fade is complete hsBool fFadeSoftVol; // Fade the soft volume instead of fCurrVolume plFadeParams() { fLengthInSecs = 0.f; fCurrTime = -1.f; fStopWhenDone = false; fFadeSoftVol = false; fVolStart = fVolEnd = 0.f; fType = kLinear; } - plFadeParams( Type type, hsScalar len, hsScalar start, hsScalar end ) + plFadeParams( Type type, float len, float start, float end ) { fLengthInSecs = len; fVolStart = start; fVolEnd = end; fType = type; fStopWhenDone = false; @@ -168,18 +168,18 @@ public: void Read( hsStream *s ); void Write( hsStream *s ); - hsScalar InterpValue( void ); + float InterpValue( void ); protected: - hsScalar fCurrTime; // -1 if we aren't active, else it's how far we're into the animation + float fCurrTime; // -1 if we aren't active, else it's how far we're into the animation }; virtual hsBool LoadSound( hsBool is3D ) = 0; - hsScalar GetVirtualStartTime( void ) const { return (hsScalar)fVirtualStartTime; } + float GetVirtualStartTime( void ) const { return (float)fVirtualStartTime; } virtual void Play(); void SynchedPlay( unsigned bytes ); - void SynchedPlay( hsScalar virtualStartTime ); + void SynchedPlay( float virtualStartTime ); virtual void Stop(); virtual void FastForwardPlay(); virtual void FastForwardToggle(); @@ -189,7 +189,7 @@ public: virtual int GetMax() const; virtual void SetVolume(const float volume); virtual float GetVolume(void) const { return fCurrVolume; } - hsScalar GetMaxVolume() { return fMaxVolume; } + float GetMaxVolume() { return fMaxVolume; } virtual hsBool IsPlaying() { return fPlaying; } void SetTime(double t); virtual double GetTime( void ) { return 0.f; } @@ -200,7 +200,7 @@ public: virtual hsBool IsMuted( void ) { return fMuted; } void Disable() { fDistAttenuation = 0; } virtual plSoundMsg* GetStatus(plSoundMsg* pMsg){return NULL;} - virtual void SetConeOrientation(hsScalar x, hsScalar y, hsScalar z); + virtual void SetConeOrientation(float x, float y, float z); virtual void SetOuterVolume( const int v ); // volume for the outer cone (if applicable) virtual void SetConeAngles( int inner, int outer ); virtual void SetPosition(const hsPoint3 pos); @@ -211,7 +211,7 @@ public: virtual void Update(); plSoundBuffer * GetDataBuffer( void ) const { return (plSoundBuffer *)fDataBufferKey->ObjectIsLoaded(); } - hsScalar QueryCurrVolume( void ) const; // Returns the current volume, attenuated + float QueryCurrVolume( void ) const; // Returns the current volume, attenuated const char * GetFileName( void ) const; virtual double GetLength(); @@ -228,32 +228,32 @@ public: virtual void AddCallbacks(plSoundMsg* pMsg) = 0; virtual void RemoveCallbacks(plSoundMsg* pMsg) = 0; - virtual UInt8 GetChannelSelect( void ) const { return 0; } // Only defined on Win32Sound right now, should be here tho + virtual uint8_t GetChannelSelect( void ) const { return 0; } // Only defined on Win32Sound right now, should be here tho virtual void Read(hsStream* s, hsResMgr* mgr); virtual void Write(hsStream* s, hsResMgr* mgr); - virtual void SetFadeInEffect( plFadeParams::Type type, hsScalar length ); - virtual void SetFadeOutEffect( plFadeParams::Type type, hsScalar length ); - virtual hsScalar CalcSoftVolume( hsBool enable, hsScalar distToListenerSquared ); + virtual void SetFadeInEffect( plFadeParams::Type type, float length ); + virtual void SetFadeOutEffect( plFadeParams::Type type, float length ); + virtual float CalcSoftVolume( hsBool enable, float distToListenerSquared ); virtual void UpdateSoftVolume( hsBool enable, hsBool firstTime = false ); virtual hsBool MsgReceive( plMessage* pMsg ); - virtual hsBool DirtySynchState( const char *sdlName = nil, UInt32 sendFlags = 0 ); // call when state has changed + virtual hsBool DirtySynchState( const char *sdlName = nil, uint32_t sendFlags = 0 ); // call when state has changed // Tests whether this sound is within range of the given position, not counting soft regions - hsBool IsWithinRange( const hsPoint3 &listenerPos, hsScalar *distSquared ); + hsBool IsWithinRange( const hsPoint3 &listenerPos, float *distSquared ); // Type setting and getting, from the Types enum - void SetType( UInt8 type ) { fType = type; } - UInt8 GetType( void ) const { return fType; } + void SetType( uint8_t type ) { fType = type; } + uint8_t GetType( void ) const { return fType; } // Priority stuff - void SetPriority( UInt8 pri ) { fPriority = pri; } - UInt8 GetPriority( void ) const { return fPriority; } + void SetPriority( uint8_t pri ) { fPriority = pri; } + uint8_t GetPriority( void ) const { return fPriority; } // Visualization - virtual plDrawableSpans* CreateProxy(const hsMatrix44& l2w, hsGMaterial* mat, hsTArray& idx, plDrawableSpans* addTo); + virtual plDrawableSpans* CreateProxy(const hsMatrix44& l2w, hsGMaterial* mat, hsTArray& idx, plDrawableSpans* addTo); // Forced loading/unloading (for when the audio system's LOD just doesn't cut it) virtual void ForceLoad( ); @@ -266,7 +266,7 @@ public: void UnregisterOnAudioSys( void ); // Also only for the audio system - hsScalar GetVolumeRank( void ); + float GetVolumeRank( void ); void ForceUnregisterFromAudioSys( void ); static void SetLoadOnDemand( hsBool activate ) { fLoadOnDemandFlag = activate; } @@ -284,10 +284,10 @@ protected: double fTime; int fMaxFalloff; int fMinFalloff; - hsScalar fCurrVolume; - hsScalar fDesiredVol; // Equal to fCurrVolume except when we're fading or muted - hsScalar fFadedVolume; - hsScalar fMaxVolume; + float fCurrVolume; + float fDesiredVol; // Equal to fCurrVolume except when we're fading or muted + float fFadedVolume; + float fMaxVolume; int fOuterVol; int fInnerCone; @@ -295,8 +295,8 @@ protected: double fLength; int fProperties; - UInt8 fType; - UInt8 fPriority; + uint8_t fType; + uint8_t fPriority; hsBool fMuted, fFading, fRegisteredForTime, fPlayOnReactivate, fFreeData; hsBool fNotHighEnoughPriority; // Set whenever the audioSys calls UpdateSoftVolume() with enable=false, @@ -322,8 +322,8 @@ protected: plFadeParams *fCurrFadeParams; plSoftVolume *fSoftRegion; - hsScalar fSoftVolume; - hsScalar fDistAttenuation, fDistToListenerSquared; + float fSoftVolume; + float fDistAttenuation, fDistToListenerSquared; double fVirtualStartTime; hsBool fRegistered; static unsigned fIncidentalsPlaying; @@ -356,17 +356,17 @@ protected: virtual hsBool IActuallyLoaded( void ) = 0; virtual void IRefreshEAXSettings( hsBool force = false ) = 0; - virtual hsScalar IGetChannelVolume( void ) const; + virtual float IGetChannelVolume( void ) const; void ISynchToStartTime( void ); void ISynchedPlay( double virtualStartTime ); - void IStartFade( plFadeParams *params, hsScalar offsetIntoFade = 0.f ); + void IStartFade( plFadeParams *params, float offsetIntoFade = 0.f ); void IStopFade( hsBool shuttingDown = false, hsBool SetVolEnd = true); hsBool IWillBeAbleToPlay( void ); void ISetSoftRegion( plSoftVolume *region ); - hsScalar IAttenuateActualVolume( hsScalar volume ) const; + float IAttenuateActualVolume( float volume ) const; void ISetSoftOcclusionRegion( plSoftVolume *region ); // Override to make sure the buffer is available before the base class is called @@ -395,7 +395,7 @@ class plSoundVolumeApplicator : public plAGApplicator { public: plSoundVolumeApplicator() { } - plSoundVolumeApplicator( UInt32 index ) { fIndex = index; } + plSoundVolumeApplicator( uint32_t index ) { fIndex = index; } CLASSNAME_REGISTER( plSoundVolumeApplicator ); GETINTERFACE_ANY( plSoundVolumeApplicator, plAGApplicator ); @@ -405,7 +405,7 @@ public: virtual void Read( hsStream *s, hsResMgr *mgr ); protected: - UInt32 fIndex; + uint32_t fIndex; virtual void IApply( const plAGModifier *mod, double time ); }; diff --git a/Sources/Plasma/PubUtilLib/plAudio/plSoundEvent.cpp b/Sources/Plasma/PubUtilLib/plAudio/plSoundEvent.cpp index a009c883..e9d34c59 100644 --- a/Sources/Plasma/PubUtilLib/plAudio/plSoundEvent.cpp +++ b/Sources/Plasma/PubUtilLib/plAudio/plSoundEvent.cpp @@ -49,7 +49,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // // ////////////////////////////////////////////////////////////////////////////// -#include "hsTypes.h" +#include "HeadSpin.h" #include "plSoundEvent.h" #include "plgDispatch.h" @@ -66,7 +66,7 @@ plSoundEvent::plSoundEvent( Types type, plSound *owner ) fCallbackEndingFlags.Reset(); } -plSoundEvent::plSoundEvent( Types type, UInt32 bytePos, plSound *owner ) +plSoundEvent::plSoundEvent( Types type, uint32_t bytePos, plSound *owner ) { fType = type; fBytePosTime = bytePos; @@ -137,7 +137,7 @@ void plSoundEvent::SendCallbacks( void ) // Note: we get fancy here. We never want to remove the callback directly, // because the sound won't know about it. So instead, send it a message to // remove the callback for us - sMsg = TRACKED_NEW plSoundMsg(); + sMsg = new plSoundMsg(); sMsg->SetBCastFlag( plMessage::kLocalPropagate, true ); sMsg->AddReceiver( fOwner->GetKey() ); sMsg->SetCmd( plSoundMsg::kRemoveCallbacks ); @@ -165,7 +165,7 @@ void plSoundEvent::SendCallbacks( void ) } } -UInt32 plSoundEvent::GetNumCallbacks( void ) const +uint32_t plSoundEvent::GetNumCallbacks( void ) const { return fCallbacks.GetCount(); } @@ -180,7 +180,7 @@ void plSoundEvent::SetType( Types type ) fType = type; } -UInt32 plSoundEvent::GetTime( void ) const +uint32_t plSoundEvent::GetTime( void ) const { return fBytePosTime; } diff --git a/Sources/Plasma/PubUtilLib/plAudio/plSoundEvent.h b/Sources/Plasma/PubUtilLib/plAudio/plSoundEvent.h index 7abf17fe..0fc14e2e 100644 --- a/Sources/Plasma/PubUtilLib/plAudio/plSoundEvent.h +++ b/Sources/Plasma/PubUtilLib/plAudio/plSoundEvent.h @@ -69,17 +69,17 @@ public: }; plSoundEvent( Types type, plSound *owner ); - plSoundEvent( Types type, UInt32 bytePos, plSound *owner ); + plSoundEvent( Types type, uint32_t bytePos, plSound *owner ); plSoundEvent(); ~plSoundEvent(); void AddCallback( plEventCallbackMsg *msg ); hsBool RemoveCallback( plEventCallbackMsg *msg ); - UInt32 GetNumCallbacks( void ) const; + uint32_t GetNumCallbacks( void ) const; int GetType( void ) const; void SetType( Types type ); - UInt32 GetTime( void ) const; + uint32_t GetTime( void ) const; void SendCallbacks( void ); @@ -88,11 +88,11 @@ public: protected: Types fType; - UInt32 fBytePosTime; + uint32_t fBytePosTime; plSound *fOwner; hsTArray fCallbacks; - hsTArray fCallbackEndingFlags; + hsTArray fCallbackEndingFlags; }; diff --git a/Sources/Plasma/PubUtilLib/plAudio/plVoiceChat.cpp b/Sources/Plasma/PubUtilLib/plAudio/plVoiceChat.cpp index 4a806811..36c5c2df 100644 --- a/Sources/Plasma/PubUtilLib/plAudio/plVoiceChat.cpp +++ b/Sources/Plasma/PubUtilLib/plAudio/plVoiceChat.cpp @@ -39,8 +39,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com Mead, WA 99021 *==LICENSE==*/ -#include "hsTypes.h" -#include "hsWindows.h" +#include "HeadSpin.h" #include "hsTimer.h" #include "hsResMgr.h" #include @@ -55,7 +54,6 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "plAudible/plWinAudible.h" #include "plNetMessage/plNetMessage.h" #include "plPipeline/plPlates.h" -#include "hsConfig.h" #include "plAvatar/plAvatarMgr.h" #include "plAvatar/plArmatureMod.h" #include "hsQuat.h" @@ -76,7 +74,7 @@ hsBool plVoiceRecorder::fCompress = true; hsBool plVoiceRecorder::fRecording = true; hsBool plVoiceRecorder::fNetVoice = false; short plVoiceRecorder::fSampleRate = FREQUENCY; -hsScalar plVoiceRecorder::fRecordThreshhold = 200.0f; +float plVoiceRecorder::fRecordThreshhold = 200.0f; hsBool plVoiceRecorder::fShowIcons = true; hsBool plVoiceRecorder::fMicAlwaysOpen = false; hsBool plVoicePlayer::fEnabled = true; @@ -137,7 +135,7 @@ void plVoiceRecorder::SetQuality(int quality) char str[] = "Voice quality setting out of range. Must be between 1 and 10 inclusive"; if(quality < 1 || quality > 10) { - plConsoleMsg *cMsg = TRACKED_NEW plConsoleMsg( plConsoleMsg::kAddLine, str ); + plConsoleMsg *cMsg = new plConsoleMsg( plConsoleMsg::kAddLine, str ); plgDispatch::MsgSend( cMsg ); return; } @@ -166,11 +164,11 @@ void plVoiceRecorder::SetComplexity(int c) char str[] = "Voice quality setting out of range. Must be between 1 and 10 inclusive"; if(c < 1 || c > 10) { - plConsoleMsg *cMsg = TRACKED_NEW plConsoleMsg( plConsoleMsg::kAddLine, str ); + plConsoleMsg *cMsg = new plConsoleMsg( plConsoleMsg::kAddLine, str ); plgDispatch::MsgSend( cMsg ); return; } - plSpeex::GetInstance()->SetComplexity((UInt8) c); + plSpeex::GetInstance()->SetComplexity((uint8_t) c); } void plVoiceRecorder::SetENH(hsBool b) @@ -268,7 +266,7 @@ void plVoiceRecorder::Update(double time) totalSamples = MAX_DATA_SIZE; // convert to correct units: - short *buffer = TRACKED_NEW short[totalSamples]; + short *buffer = new short[totalSamples]; alcCaptureSamples(captureDevice, buffer, totalSamples); @@ -286,10 +284,10 @@ void plVoiceRecorder::Update(double time) } else // use the speex voice compression lib { - UInt8 *packet = TRACKED_NEW UInt8[totalSamples]; // packet to send encoded data in + uint8_t *packet = new uint8_t[totalSamples]; // packet to send encoded data in int packedLength = 0; // the size of the packet that will be sent hsRAMStream ram; // ram stream to hold output data from speex - UInt8 numFrames = totalSamples / EncoderFrameSize; // number of frames to be encoded + uint8_t numFrames = totalSamples / EncoderFrameSize; // number of frames to be encoded // encode the data using speex plSpeex::GetInstance()->Encode(buffer, numFrames, &packedLength, &ram); @@ -317,7 +315,7 @@ void plVoiceRecorder::Update(double time) } else if(!fMikeOpen) { - short *buffer = TRACKED_NEW short[samples]; + short *buffer = new short[samples]; // the mike has since closed, and there isn't enough data to meet our minimum, so throw this data out alcCaptureSamples(captureDevice, buffer, samples); delete[] buffer; @@ -351,18 +349,18 @@ void plVoicePlayer::PlaybackVoiceMessage(void* data, unsigned size, int numFrame { int numBytes; // the number of bytes that speex decompressed the data to. int bufferSize = numFramesInBuffer * plSpeex::GetInstance()->GetFrameSize(); - short *nBuff = TRACKED_NEW short[bufferSize]; + short *nBuff = new short[bufferSize]; memset(nBuff, 0, bufferSize); // Decode the encoded voice data using speex - if(!plSpeex::GetInstance()->Decode((UInt8 *)data, size, numFramesInBuffer, &numBytes, nBuff)) + if(!plSpeex::GetInstance()->Decode((uint8_t *)data, size, numFramesInBuffer, &numBytes, nBuff)) { delete[] nBuff; return; } - UInt8* newBuff; - newBuff = (UInt8*)nBuff; // Convert to byte data + uint8_t* newBuff; + newBuff = (uint8_t*)nBuff; // Convert to uint8_t data PlaybackUncompressedVoiceMessage(newBuff, numBytes); // playback uncompressed data delete[] nBuff; } @@ -437,7 +435,7 @@ hsBool plVoiceSound::LoadSound( hsBool is3D ) header.fBlockAlign = header.fNumChannels * header.fBitsPerSample / 2; header.fAvgBytesPerSec = header.fNumSamplesPerSec * header.fBlockAlign; - fDSoundBuffer = TRACKED_NEW plDSoundBuffer(0, header, true, false, false, true); + fDSoundBuffer = new plDSoundBuffer(0, header, true, false, false, true); if(!fDSoundBuffer) return false; fDSoundBuffer->SetupVoiceSource(); @@ -529,7 +527,7 @@ fComplexity(3), fENH(false), fInitialized(false) { - fBits = TRACKED_NEW SpeexBits; + fBits = new SpeexBits; Init(kNarrowband); // if no one initialized us initialize using a narrowband encoder } @@ -603,9 +601,9 @@ hsBool plSpeex::Encode(short *data, int numFrames, int *packedLength, hsRAMStrea *packedLength = 0; short *pData = data; // pointer to input data - float *input = TRACKED_NEW float[fFrameSize]; // input to speex - used as am intermediate array since speex requires float data - UInt8 frameLength; // number of bytes speex compressed frame to - UInt8 *frameData = TRACKED_NEW UInt8[fFrameSize]; // holds one frame of encoded data + float *input = new float[fFrameSize]; // input to speex - used as am intermediate array since speex requires float data + uint8_t frameLength; // number of bytes speex compressed frame to + uint8_t *frameData = new uint8_t[fFrameSize]; // holds one frame of encoded data // encode data for( int i = 0; i < numFrames; i++ ) @@ -636,18 +634,18 @@ hsBool plSpeex::Encode(short *data, int numFrames, int *packedLength, hsRAMStrea return true; } -hsBool plSpeex::Decode(UInt8 *data, int size, int numFrames, int *numOutputBytes, short *out) +hsBool plSpeex::Decode(uint8_t *data, int size, int numFrames, int *numOutputBytes, short *out) { if(!fInitialized) return false; *numOutputBytes = 0; hsReadOnlyStream stream( size, data ); - float *speexOutput = TRACKED_NEW float[fFrameSize]; // holds output from speex + float *speexOutput = new float[fFrameSize]; // holds output from speex short *pOut = out; // pointer to output short buffer // create buffer for input data - UInt8 *frameData = TRACKED_NEW UInt8[fFrameSize]; // holds the current frames data to be decoded - UInt8 frameLen; // holds the length of the current frame being decoded. + uint8_t *frameData = new uint8_t[fFrameSize]; // holds the current frames data to be decoded + uint8_t frameLen; // holds the length of the current frame being decoded. // Decode data @@ -687,14 +685,14 @@ void plSpeex::VBR(hsBool b) // Sets the average bit rate -void plSpeex::SetABR(UInt32 abr) +void plSpeex::SetABR(uint32_t abr) { fAverageBitrate = abr; speex_encoder_ctl(fEncoderState, SPEEX_SET_ABR, &fAverageBitrate); } // Sets the quality of encoding -void plSpeex::SetQuality(UInt32 quality) +void plSpeex::SetQuality(uint32_t quality) { fQuality = quality; speex_encoder_ctl(fEncoderState, SPEEX_SET_QUALITY, &fQuality); @@ -706,7 +704,7 @@ void plSpeex::SetENH(hsBool b) speex_decoder_ctl(fDecoderState, SPEEX_SET_ENH, &fENH); } -void plSpeex::SetComplexity(UInt8 c) +void plSpeex::SetComplexity(uint8_t c) { fComplexity = c; speex_encoder_ctl(fEncoderState, SPEEX_SET_COMPLEXITY, &fComplexity); diff --git a/Sources/Plasma/PubUtilLib/plAudio/plVoiceChat.h b/Sources/Plasma/PubUtilLib/plAudio/plVoiceChat.h index 82f97e89..26fe362e 100644 --- a/Sources/Plasma/PubUtilLib/plAudio/plVoiceChat.h +++ b/Sources/Plasma/PubUtilLib/plAudio/plVoiceChat.h @@ -97,7 +97,7 @@ public: void SetPosition(const hsPoint3 pos); void SetOrientation(const hsPoint3 pos); - void SetTalkIcon(int index, UInt32 str){} + void SetTalkIcon(int index, uint32_t str){} void ClearTalkIcon(){} plVoiceSound *GetSoundPtr() { return &fSound; } static void Enable(hsBool enable) { fEnabled = enable; } @@ -118,7 +118,7 @@ public: void DrawTalkIcon(hsBool b); void DrawDisabledIcon(hsBool b); - void SetTalkIcon(int index, UInt32 str); + void SetTalkIcon(int index, uint32_t str); void ClearTalkIcon(); static hsBool RecordingEnabled() { return fRecording; } @@ -130,7 +130,7 @@ public: static void EnableNetVoice(hsBool b) { fNetVoice = b; } static void EnableCompression(hsBool b) { fCompress = b; } static void SetSampleRate(short s) { fSampleRate = s; } - static void SetSquelch(hsScalar f) { fRecordThreshhold = f; } + static void SetSquelch(float f) { fRecordThreshhold = f; } static void IncreaseRecordingThreshhold(); static void DecreaseRecordingThreshhold(); @@ -154,7 +154,7 @@ private: static short fSampleRate; plPlate* fDisabledIcon; plPlate* fTalkIcon; - static hsScalar fRecordThreshhold; + static float fRecordThreshhold; }; @@ -179,17 +179,17 @@ public: hsBool Init(Mode mode); hsBool Shutdown(); hsBool Encode(short *data, int numFrames, int *packedLength, hsRAMStream *out); - hsBool Decode(UInt8 *data, int size, int numFrames, int *numOutputBytes, short *out); + hsBool Decode(uint8_t *data, int size, int numFrames, int *numOutputBytes, short *out); int GetFrameSize() { return fFrameSize; } void VBR(hsBool b); // turn variable bit rate on/off - void SetVBR(UInt32 vbr); // Set variable bit rate quality + void SetVBR(uint32_t vbr); // Set variable bit rate quality void ABR(hsBool b); // turn average bit rate on/off - void SetABR(UInt32 abr); // Set average bit rate quality - void SetQuality(UInt32 quality); // Set encoder quality + void SetABR(uint32_t abr); // Set average bit rate quality + void SetQuality(uint32_t quality); // Set encoder quality hsBool IsUsingVBR() { return fVBR; } int GetQuality() { return fQuality; } void SetENH(hsBool b); - void SetComplexity(UInt8 c); + void SetComplexity(uint8_t c); hsBool Initialized() { return fInitialized; } @@ -204,7 +204,7 @@ private: int fQuality; // 0-10 speex encode quality hsBool fVBR; // toggle variable bit rate int fAverageBitrate; // n-bits per second - UInt8 fComplexity; // 1-10 sets cpu resources allowed for encoder + uint8_t fComplexity; // 1-10 sets cpu resources allowed for encoder hsBool fENH; // perceptual enhancement hsBool fInitialized; }; diff --git a/Sources/Plasma/PubUtilLib/plAudio/plWin32GroupedSound.cpp b/Sources/Plasma/PubUtilLib/plAudio/plWin32GroupedSound.cpp index b24e8a2e..e7f3bb6c 100644 --- a/Sources/Plasma/PubUtilLib/plAudio/plWin32GroupedSound.cpp +++ b/Sources/Plasma/PubUtilLib/plAudio/plWin32GroupedSound.cpp @@ -48,7 +48,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // // ////////////////////////////////////////////////////////////////////////////// -#include "hsTypes.h" +#include "HeadSpin.h" #include "plWin32GroupedSound.h" #include "plDSoundBuffer.h" @@ -79,9 +79,9 @@ plWin32GroupedSound::~plWin32GroupedSound() DeActivate(); } -void plWin32GroupedSound::SetPositionArray( UInt16 numSounds, UInt32 *posArray, hsScalar *volumeArray ) +void plWin32GroupedSound::SetPositionArray( uint16_t numSounds, uint32_t *posArray, float *volumeArray ) { - UInt16 i; + uint16_t i; fStartPositions.SetCountAndZero( numSounds ); @@ -98,7 +98,7 @@ void plWin32GroupedSound::SetPositionArray( UInt16 numSounds, UInt32 *posArra void plWin32GroupedSound::IRead( hsStream *s, hsResMgr *mgr ) { plWin32StaticSound::IRead( s, mgr ); - UInt16 i, n = s->ReadLE16(); + uint16_t i, n = s->ReadLE16(); fStartPositions.SetCountAndZero( n ); fVolumes.SetCountAndZero( n ); for( i = 0; i < n; i++ ) @@ -113,7 +113,7 @@ void plWin32GroupedSound::IWrite( hsStream *s, hsResMgr *mgr ) plWin32StaticSound::IWrite( s, mgr ); s->WriteLE16( fStartPositions.GetCount() ); - UInt16 i; + uint16_t i; for( i = 0; i < fStartPositions.GetCount(); i++ ) { s->WriteLE32( fStartPositions[ i ] ); @@ -181,8 +181,8 @@ hsBool plWin32GroupedSound::LoadSound( hsBool is3D ) // Calculate the maximum size for our buffer. This will be the length of the longest sound we're going to // have to play. - UInt16 i; - UInt32 maxSoundSize, len; + uint16_t i; + uint32_t maxSoundSize, len; for( i = 1, maxSoundSize = 0; i < fStartPositions.GetCount(); i++ ) { len = fStartPositions[ i ] - fStartPositions[ i - 1 ]; @@ -194,7 +194,7 @@ hsBool plWin32GroupedSound::LoadSound( hsBool is3D ) maxSoundSize = len; // Based on that, allocate our buffer - UInt32 bufferSize = maxSoundSize - ( maxSoundSize % header.fBlockAlign ); + uint32_t bufferSize = maxSoundSize - ( maxSoundSize % header.fBlockAlign ); if( header.fNumChannels > 1 && is3D ) { @@ -204,11 +204,11 @@ hsBool plWin32GroupedSound::LoadSound( hsBool is3D ) header.fAvgBytesPerSec /= header.fNumChannels; header.fNumChannels = 1; } - fNumDestChannels = (UInt8)(header.fNumChannels); - fNumDestBytesPerSample = (UInt8)(header.fBlockAlign); + fNumDestChannels = (uint8_t)(header.fNumChannels); + fNumDestBytesPerSample = (uint8_t)(header.fBlockAlign); // Create our DSound buffer (or rather, the wrapper around it) - fDSoundBuffer = TRACKED_NEW plDSoundBuffer( bufferSize, header, is3D, IsPropertySet( kPropLooping ), true ); + fDSoundBuffer = new plDSoundBuffer( bufferSize, header, is3D, IsPropertySet( kPropLooping ), true ); if( !fDSoundBuffer->IsValid() ) { char str[256]; @@ -258,21 +258,21 @@ hsBool plWin32GroupedSound::LoadSound( hsBool is3D ) //// GetSoundLength ////////////////////////////////////////////////////////// // Gets the length (in seconds) of the given sound index from the group. -hsScalar plWin32GroupedSound::GetSoundLength( Int16 soundIndex ) +float plWin32GroupedSound::GetSoundLength( int16_t soundIndex ) { plSoundBuffer *buffer = (plSoundBuffer *)fDataBufferKey->ObjectIsLoaded(); if(buffer) { - return (hsScalar)IGetSoundByteLength( soundIndex ) / buffer->GetHeader().fAvgBytesPerSec; + return (float)IGetSoundbyteLength( soundIndex ) / buffer->GetHeader().fAvgBytesPerSec; } return 0; } -//// IGetSoundByteLength ///////////////////////////////////////////////////// -// Byte version of above. +//// IGetSoundbyteLength ///////////////////////////////////////////////////// +// uint8_t version of above. -UInt32 plWin32GroupedSound::IGetSoundByteLength( Int16 soundIndex ) +uint32_t plWin32GroupedSound::IGetSoundbyteLength( int16_t soundIndex ) { if( soundIndex == fStartPositions.GetCount() - 1 ) @@ -286,10 +286,10 @@ UInt32 plWin32GroupedSound::IGetSoundByteLength( Int16 soundIndex ) void *plWin32GroupedSound::IGetDataPointer( void ) const { - return ( fDataBufferKey->ObjectIsLoaded() ) ? (void *)( (UInt8 *)((plSoundBuffer *)fDataBufferKey->ObjectIsLoaded())->GetData() + fStartPositions[ fCurrentSound ] ) : nil; + return ( fDataBufferKey->ObjectIsLoaded() ) ? (void *)( (uint8_t *)((plSoundBuffer *)fDataBufferKey->ObjectIsLoaded())->GetData() + fStartPositions[ fCurrentSound ] ) : nil; } -UInt32 plWin32GroupedSound::IGetDataLength( void ) const +uint32_t plWin32GroupedSound::IGetDataLength( void ) const { return ( fDataBufferKey->ObjectIsLoaded() ) ? fCurrentSoundLength : 0; } @@ -298,10 +298,10 @@ UInt32 plWin32GroupedSound::IGetDataLength( void ) const // Fills the DSoundBuffer with data from the current sound from our sound // group, optionally switching what our current sound is. -void plWin32GroupedSound::IFillCurrentSound( Int16 newCurrent /*= -1*/ ) +void plWin32GroupedSound::IFillCurrentSound( int16_t newCurrent /*= -1*/ ) { //void *dataPtr; - //UInt32 dataLength; + //uint32_t dataLength; if( !fDSoundBuffer && plgAudioSys::Active() ) LoadSound( IsPropertySet( kPropIs3DSound ) ); @@ -313,7 +313,7 @@ void plWin32GroupedSound::IFillCurrentSound( Int16 newCurrent /*= -1*/ ) if( newCurrent != -1 ) { - fCurrentSound = (UInt16)newCurrent; + fCurrentSound = (uint16_t)newCurrent; if( fCurrentSound >= fStartPositions.GetCount() ) { @@ -324,7 +324,7 @@ void plWin32GroupedSound::IFillCurrentSound( Int16 newCurrent /*= -1*/ ) } // Set our length based on the current sound - fCurrentSoundLength = IGetSoundByteLength( fCurrentSound ); + fCurrentSoundLength = IGetSoundbyteLength( fCurrentSound ); if( fDataBufferKey->ObjectIsLoaded() ) SetLength( fCurrentSoundLength / ((plSoundBuffer *)fDataBufferKey->ObjectIsLoaded())->GetHeader().fAvgBytesPerSec ); @@ -341,8 +341,8 @@ void plWin32GroupedSound::IFillCurrentSound( Int16 newCurrent /*= -1*/ ) //if( fDataBuffer->GetHeader().fNumChannels == fNumDestChannels ) { // Just copy - //memcpy( dataPtr, (Byte *)fDataBuffer->GetData() + fStartPositions[ fCurrentSound ], fCurrentSoundLength ); - //dataPtr = (Byte *)dataPtr + fCurrentSoundLength; + //memcpy( dataPtr, (uint8_t *)fDataBuffer->GetData() + fStartPositions[ fCurrentSound ], fCurrentSoundLength ); + //dataPtr = (uint8_t *)dataPtr + fCurrentSoundLength; //dataLength -= fCurrentSoundLength; } //else @@ -351,12 +351,12 @@ void plWin32GroupedSound::IFillCurrentSound( Int16 newCurrent /*= -1*/ ) /*plProfile_BeginTiming( StaticSwizzleTime ); - plSoundDeswizzler deswiz( (Byte *)fDataBuffer->GetData() + fStartPositions[ fCurrentSound ], fCurrentSoundLength, - (UInt8)(fDataBuffer->GetHeader().fNumChannels), fNumDestBytesPerSample ); + plSoundDeswizzler deswiz( (uint8_t *)fDataBuffer->GetData() + fStartPositions[ fCurrentSound ], fCurrentSoundLength, + (uint8_t)(fDataBuffer->GetHeader().fNumChannels), fNumDestBytesPerSample ); deswiz.Extract( fChannelSelect, dataPtr ); - dataPtr = (Byte *)dataPtr + fCurrentSoundLength / fDataBuffer->GetHeader().fNumChannels; + dataPtr = (uint8_t *)dataPtr + fCurrentSoundLength / fDataBuffer->GetHeader().fNumChannels; dataLength -= fCurrentSoundLength / fDataBuffer->GetHeader().fNumChannels; plProfile_EndTiming( StaticSwizzleTime );*/ diff --git a/Sources/Plasma/PubUtilLib/plAudio/plWin32GroupedSound.h b/Sources/Plasma/PubUtilLib/plAudio/plWin32GroupedSound.h index 14b05acf..76e2d476 100644 --- a/Sources/Plasma/PubUtilLib/plAudio/plWin32GroupedSound.h +++ b/Sources/Plasma/PubUtilLib/plAudio/plWin32GroupedSound.h @@ -70,30 +70,30 @@ public: virtual hsBool LoadSound( hsBool is3D ); virtual hsBool MsgReceive( plMessage *pMsg ); - void SetPositionArray( UInt16 numSounds, UInt32 *posArray, hsScalar *volumeArray ); - hsScalar GetSoundLength( Int16 soundIndex ); + void SetPositionArray( uint16_t numSounds, uint32_t *posArray, float *volumeArray ); + float GetSoundLength( int16_t soundIndex ); virtual double GetLength() { return GetSoundLength( fCurrentSound ); } protected: - UInt16 fCurrentSound; - UInt32 fCurrentSoundLength; - hsTArray fStartPositions; // In bytes - hsTArray fVolumes; + uint16_t fCurrentSound; + uint32_t fCurrentSoundLength; + hsTArray fStartPositions; // In bytes + hsTArray fVolumes; // Some extra handy info for us - UInt8 fNumDestChannels, fNumDestBytesPerSample; + uint8_t fNumDestChannels, fNumDestBytesPerSample; virtual void IDerivedActuallyPlay( void ); virtual void IRead( hsStream *s, hsResMgr *mgr ); virtual void IWrite( hsStream *s, hsResMgr *mgr ); - UInt32 IGetSoundByteLength( Int16 soundIndex ); - void IFillCurrentSound( Int16 newCurrent = -1 ); + uint32_t IGetSoundbyteLength( int16_t soundIndex ); + void IFillCurrentSound( int16_t newCurrent = -1 ); // Abstracting a few things here for the incidentalMgr virtual void * IGetDataPointer( void ) const; - virtual UInt32 IGetDataLength( void ) const; + virtual uint32_t IGetDataLength( void ) const; }; #endif //plWin32GroupedSound_h diff --git a/Sources/Plasma/PubUtilLib/plAudio/plWin32Sound.cpp b/Sources/Plasma/PubUtilLib/plAudio/plWin32Sound.cpp index e64aaf31..e25190ff 100644 --- a/Sources/Plasma/PubUtilLib/plAudio/plWin32Sound.cpp +++ b/Sources/Plasma/PubUtilLib/plAudio/plWin32Sound.cpp @@ -134,7 +134,7 @@ void plWin32Sound::IActuallyPlay( void ) { // If we can't load (for ex., if audio is off), then we act like we played and then stopped // really fast. Thus, we need to send *all* of our callbacks off immediately and then Stop(). - UInt32 i; + uint32_t i; for( i = 0; i < fSoundEvents.GetCount(); i++ ) { fSoundEvents[ i ]->SendCallbacks(); @@ -185,7 +185,7 @@ void plWin32Sound::IActuallyStop() plSoundMsg* plWin32Sound::GetStatus(plSoundMsg* pMsg) { - plSoundMsg* pReply = TRACKED_NEW plSoundMsg; + plSoundMsg* pReply = new plSoundMsg; pReply->AddReceiver( pMsg->GetSender() ); pReply->SetCmd(plSoundMsg::kStatusReply); pReply->fLoop = IsPropertySet( kPropLooping ); @@ -229,7 +229,7 @@ void plWin32Sound::SetConeAngles( int inner, int outer ) } } -void plWin32Sound::SetConeOrientation( hsScalar x, hsScalar y, hsScalar z ) +void plWin32Sound::SetConeOrientation( float x, float y, float z ) { plSound::SetConeOrientation(x, y, z); if(fDSoundBuffer) @@ -290,7 +290,7 @@ void plWin32Sound::ISetActualVolume(const float volume) fAwaitingPosition = true; } } - IUpdateDebugPlate(); // Byte me. + IUpdateDebugPlate(); // uint8_t me. } ////////////////////////////////////////////////////////////// @@ -327,14 +327,14 @@ void plWin32Sound::IAddCallback( plEventCallbackMsg *pMsg ) if( type == plSoundEvent::kTime ) { - UInt32 byteTime = ( fDSoundBuffer != nil ) ? fDSoundBuffer->GetBufferBytePos( pMsg->fEventTime ) : 0; + uint32_t byteTime = ( fDSoundBuffer != nil ) ? fDSoundBuffer->GetBufferBytePos( pMsg->fEventTime ) : 0; event = IFindEvent( type, byteTime ); if( event == nil ) { // Add a new sound event for this guy - event = TRACKED_NEW plSoundEvent( type, byteTime, this ); + event = new plSoundEvent( type, byteTime, this ); //fDSoundBuffer->AddPosNotify( byteTime ); fSoundEvents.Append( event ); } @@ -346,7 +346,7 @@ void plWin32Sound::IAddCallback( plEventCallbackMsg *pMsg ) if( event == nil ) { // Add a new sound event for this guy - event = TRACKED_NEW plSoundEvent( type, this ); + event = new plSoundEvent( type, this ); fSoundEvents.Append( event ); } } @@ -378,7 +378,7 @@ void plWin32Sound::IRemoveCallback( plEventCallbackMsg *pMsg ) } } -plSoundEvent *plWin32Sound::IFindEvent( plSoundEvent::Types type, UInt32 bytePos ) +plSoundEvent *plWin32Sound::IFindEvent( plSoundEvent::Types type, uint32_t bytePos ) { for(int i = 0; i < fSoundEvents.GetCount(); ++i ) { diff --git a/Sources/Plasma/PubUtilLib/plAudio/plWin32Sound.h b/Sources/Plasma/PubUtilLib/plAudio/plWin32Sound.h index 7cc7a7bc..a9e92180 100644 --- a/Sources/Plasma/PubUtilLib/plAudio/plWin32Sound.h +++ b/Sources/Plasma/PubUtilLib/plAudio/plWin32Sound.h @@ -80,7 +80,7 @@ public: virtual void SetMin(const int m); // sets minimum falloff distance virtual void SetMax(const int m); // sets maximum falloff distance - virtual void SetConeOrientation(hsScalar x, hsScalar y, hsScalar z); + virtual void SetConeOrientation(float x, float y, float z); virtual void SetOuterVolume( const int v ); // volume for the outer cone (if applicable) virtual void SetConeAngles( int inner, int outer ); virtual void SetPosition(const hsPoint3 pos); @@ -93,8 +93,8 @@ public: }; // Selects a channel source from a multi-channel (stereo) file. Ignored if source is mono - void SetChannelSelect( ChannelSelect source ) { fChannelSelect = (UInt8)source; } - virtual UInt8 GetChannelSelect( void ) const { return fChannelSelect; } + void SetChannelSelect( ChannelSelect source ) { fChannelSelect = (uint8_t)source; } + virtual uint8_t GetChannelSelect( void ) const { return fChannelSelect; } protected: @@ -103,11 +103,11 @@ protected: hsBool fFailed; hsBool fPositionInited, fAwaitingPosition; hsBool fReallyPlaying; - UInt32 fTotalBytes; + uint32_t fTotalBytes; hsBool fWasPlaying; - UInt8 fChannelSelect; // For selecting a mono channel from a stereo file + uint8_t fChannelSelect; // For selecting a mono channel from a stereo file hsTArray fSoundEvents; @@ -125,7 +125,7 @@ protected: virtual void IAddCallback( plEventCallbackMsg *pMsg ); virtual void IRemoveCallback( plEventCallbackMsg *pMsg ); - plSoundEvent *IFindEvent( plSoundEvent::Types type, UInt32 bytePos = 0 ); + plSoundEvent *IFindEvent( plSoundEvent::Types type, uint32_t bytePos = 0 ); virtual void IRead( hsStream *s, hsResMgr *mgr ); virtual void IWrite( hsStream *s, hsResMgr *mgr ); diff --git a/Sources/Plasma/PubUtilLib/plAudio/plWin32StaticSound.cpp b/Sources/Plasma/PubUtilLib/plAudio/plWin32StaticSound.cpp index 77c4d7a9..527a02fd 100644 --- a/Sources/Plasma/PubUtilLib/plAudio/plWin32StaticSound.cpp +++ b/Sources/Plasma/PubUtilLib/plAudio/plWin32StaticSound.cpp @@ -132,7 +132,7 @@ hsBool plWin32StaticSound::LoadSound( hsBool is3D ) fFailed = true; return false; } - UInt32 bufferSize = buffer->GetDataLength(); + uint32_t bufferSize = buffer->GetDataLength(); if( header.fNumChannels > 1 && is3D ) { @@ -149,7 +149,7 @@ hsBool plWin32StaticSound::LoadSound( hsBool is3D ) tryStatic = false; // Create our DSound buffer (or rather, the wrapper around it) - fDSoundBuffer = TRACKED_NEW plDSoundBuffer( bufferSize, header, is3D, IsPropertySet( kPropLooping ), tryStatic ); + fDSoundBuffer = new plDSoundBuffer( bufferSize, header, is3D, IsPropertySet( kPropLooping ), tryStatic ); if( !fDSoundBuffer->IsValid() ) { char str[256]; @@ -181,7 +181,7 @@ hsBool plWin32StaticSound::LoadSound( hsBool is3D ) plProfile_NewMem(MemSounds, fTotalBytes); // get pertinent info - hsScalar length = (hsScalar)bufferSize / (hsScalar)header.fAvgBytesPerSec; + float length = (float)bufferSize / (float)header.fAvgBytesPerSec; SetLength(length); if( fLoadFromDiskOnDemand && !IsPropertySet( kPropLoadOnlyOnCall ) ) diff --git a/Sources/Plasma/PubUtilLib/plAudio/plWin32StreamingSound.cpp b/Sources/Plasma/PubUtilLib/plAudio/plWin32StreamingSound.cpp index 3e01bb80..3d22d128 100644 --- a/Sources/Plasma/PubUtilLib/plAudio/plWin32StreamingSound.cpp +++ b/Sources/Plasma/PubUtilLib/plAudio/plWin32StreamingSound.cpp @@ -273,7 +273,7 @@ hsBool plWin32StreamingSound::LoadSound( hsBool is3D ) SetProperty( kPropIs3DSound, is3D ); plWAVHeader header = fDataStream->GetHeader(); - UInt32 bufferSize = (UInt32)(fBufferLengthInSecs * header.fAvgBytesPerSec); + uint32_t bufferSize = (uint32_t)(fBufferLengthInSecs * header.fAvgBytesPerSec); // Debug flag #2 if( is3D && fChannelSelect == 0 && header.fNumChannels > 1 && plgAudioSys::IsDebugFlagSet( plgAudioSys::kDisableLeftSelect ) ) @@ -293,7 +293,7 @@ hsBool plWin32StreamingSound::LoadSound( hsBool is3D ) } // Actually create the buffer now (always looping) - fDSoundBuffer = TRACKED_NEW plDSoundBuffer( bufferSize, header, is3D, IsPropertySet(kPropLooping), false, true ); + fDSoundBuffer = new plDSoundBuffer( bufferSize, header, is3D, IsPropertySet(kPropLooping), false, true ); if( !fDSoundBuffer->IsValid() ) { fDataStream->Close(); @@ -310,7 +310,7 @@ hsBool plWin32StreamingSound::LoadSound( hsBool is3D ) return false; } - fTotalBytes = (UInt32)bufferSize; + fTotalBytes = (uint32_t)bufferSize; plProfile_NewMem(MemSounds, fTotalBytes); plSoundBuffer *buffer = (plSoundBuffer *)fDataBufferKey->ObjectIsLoaded(); @@ -364,13 +364,13 @@ hsBool plWin32StreamingSound::LoadSound( hsBool is3D ) plStatusLog::AddLineS( "audioTimes.log", 0xffffffff, "Streaming %4.2f secs of %s", fDataStream->GetLengthInSecs(), GetKey()->GetUoid().GetObjectName() ); // Get pertinent info - SetLength( (hsScalar)fDataStream->GetLengthInSecs() ); + SetLength( (float)fDataStream->GetLengthInSecs() ); // Set up our deswizzler, if necessary delete fDeswizzler; if( fDataStream->GetHeader().fNumChannels != header.fNumChannels ) - fDeswizzler = TRACKED_NEW plSoundDeswizzler( (UInt32)(fBufferLengthInSecs * fDataStream->GetHeader().fAvgBytesPerSec), - (UInt8)(fDataStream->GetHeader().fNumChannels), + fDeswizzler = new plSoundDeswizzler( (uint32_t)(fBufferLengthInSecs * fDataStream->GetHeader().fAvgBytesPerSec), + (uint8_t)(fDataStream->GetHeader().fNumChannels), header.fBitsPerSample / 8 ); else fDeswizzler = nil; @@ -475,7 +475,7 @@ unsigned plWin32StreamingSound::GetByteOffset() float plWin32StreamingSound::GetActualTimeSec() { if(fDataStream && fDSoundBuffer) - return fDSoundBuffer->BytePosToMSecs(fDataStream->NumBytesLeft()) / 1000.0f; + return fDSoundBuffer->bytePosToMSecs(fDataStream->NumBytesLeft()) / 1000.0f; return 0.0f; } diff --git a/Sources/Plasma/PubUtilLib/plAudio/plWin32StreamingSound.h b/Sources/Plasma/PubUtilLib/plAudio/plWin32StreamingSound.h index 47715de5..ea409cb5 100644 --- a/Sources/Plasma/PubUtilLib/plAudio/plWin32StreamingSound.h +++ b/Sources/Plasma/PubUtilLib/plAudio/plWin32StreamingSound.h @@ -70,10 +70,10 @@ public: virtual hsBool MsgReceive( plMessage *pMsg ); protected: - hsScalar fTimeAtBufferStart; + float fTimeAtBufferStart; plAudioFileReader *fDataStream; - hsScalar fBufferLengthInSecs; - UInt8 fBlankBufferFillCounter; + float fBufferLengthInSecs; + uint8_t fBlankBufferFillCounter; plSoundDeswizzler *fDeswizzler; char fSrcFilename[ 256 ]; StreamType fStreamType; @@ -86,7 +86,7 @@ protected: bool fPlayWhenStopped; unsigned fStartPos; - hsScalar IGetTimeAtBufferStart( void ) { return fTimeAtBufferStart; } + float IGetTimeAtBufferStart( void ) { return fTimeAtBufferStart; } virtual void SetStartPos(unsigned bytes); virtual void IDerivedActuallyPlay( void ); diff --git a/Sources/Plasma/PubUtilLib/plAudio/plWinMicLevel.cpp b/Sources/Plasma/PubUtilLib/plAudio/plWinMicLevel.cpp index 9eaabeb2..5faa122d 100644 --- a/Sources/Plasma/PubUtilLib/plAudio/plWinMicLevel.cpp +++ b/Sources/Plasma/PubUtilLib/plAudio/plWinMicLevel.cpp @@ -52,9 +52,9 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com ////////////////////////////////////////////////////////////////////////////// -#include "hsTypes.h" +#include "HeadSpin.h" #include "plWinMicLevel.h" -#include "hsWindows.h" + #if HS_BUILD_FOR_WIN32 #include @@ -86,7 +86,7 @@ MIXERLINE *IGetMixerSubLineByType( MIXERCONTROL *mux, DWORD type ); //// The Publics ///////////////////////////////////////////////////////////// -hsScalar plWinMicLevel::GetLevel( void ) +float plWinMicLevel::GetLevel( void ) { if( !CanSetLevel() ) return -1; @@ -96,13 +96,13 @@ hsScalar plWinMicLevel::GetLevel( void ) if( !IGetControlValue( rawValue ) ) return -1; - return (hsScalar)( rawValue - sMinValue ) / (hsScalar)( sMaxValue - sMinValue ); + return (float)( rawValue - sMinValue ) / (float)( sMaxValue - sMinValue ); #else return -1; #endif } -void plWinMicLevel::SetLevel( hsScalar level ) +void plWinMicLevel::SetLevel( float level ) { if( !CanSetLevel() ) return; @@ -361,7 +361,7 @@ MIXERLINE *IGetMixerSubLineByType( MIXERCONTROL *mux, DWORD type ) { // A mixer or MUX is really a combination of MORE lines. And beautifully, you can't // just ask for a single one off of it, you have to ask for them all and search through yourself - MIXERCONTROLDETAILS_LISTTEXT *lineInfo = TRACKED_NEW MIXERCONTROLDETAILS_LISTTEXT[ mux->cMultipleItems ]; + MIXERCONTROLDETAILS_LISTTEXT *lineInfo = new MIXERCONTROLDETAILS_LISTTEXT[ mux->cMultipleItems ]; if( lineInfo == nil ) return nil; diff --git a/Sources/Plasma/PubUtilLib/plAudio/plWinMicLevel.h b/Sources/Plasma/PubUtilLib/plAudio/plWinMicLevel.h index bd7baec9..07f088ca 100644 --- a/Sources/Plasma/PubUtilLib/plAudio/plWinMicLevel.h +++ b/Sources/Plasma/PubUtilLib/plAudio/plWinMicLevel.h @@ -63,10 +63,10 @@ public: ~plWinMicLevel(); // Gets the microphone volume, range 0-1, -1 if error - static hsScalar GetLevel( void ); + static float GetLevel( void ); // Sets the microphone volume, range 0-1 - static void SetLevel( hsScalar level ); + static void SetLevel( float level ); // Returns whether we can set the level static hsBool CanSetLevel( void ); diff --git a/Sources/Plasma/PubUtilLib/plAudioCore/plAudioCore.h b/Sources/Plasma/PubUtilLib/plAudioCore/plAudioCore.h index 57776c55..25a3a005 100644 --- a/Sources/Plasma/PubUtilLib/plAudioCore/plAudioCore.h +++ b/Sources/Plasma/PubUtilLib/plAudioCore/plAudioCore.h @@ -54,12 +54,12 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com class plWAVHeader { public: - UInt16 fFormatTag; - UInt16 fNumChannels; - UInt32 fNumSamplesPerSec; - UInt32 fAvgBytesPerSec; - UInt16 fBlockAlign; - UInt16 fBitsPerSample; + uint16_t fFormatTag; + uint16_t fNumChannels; + uint32_t fNumSamplesPerSec; + uint32_t fAvgBytesPerSec; + uint16_t fBlockAlign; + uint16_t fBitsPerSample; enum { diff --git a/Sources/Plasma/PubUtilLib/plAudioCore/plAudioFileReader.cpp b/Sources/Plasma/PubUtilLib/plAudioCore/plAudioFileReader.cpp index e9084c06..514fd583 100644 --- a/Sources/Plasma/PubUtilLib/plAudioCore/plAudioFileReader.cpp +++ b/Sources/Plasma/PubUtilLib/plAudioCore/plAudioFileReader.cpp @@ -50,11 +50,11 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com ////////////////////////////////////////////////////////////////////////////// #include -#include "hsTypes.h" +#include "HeadSpin.h" #include "plAudioFileReader.h" #include "plAudioCore.h" //#include "hsTimer.h" -#include "hsUtils.h" + #include "plFile/hsFiles.h" #include "plFile/plFileUtils.h" #include "plUnifiedTime/plUnifiedTime.h" @@ -90,24 +90,24 @@ plAudioFileReader* plAudioFileReader::CreateReader(const char* path, plAudioCore { char cachedPath[256]; IGetCachedPath(path, cachedPath, whichChan); - plAudioFileReader *r = TRACKED_NEW plCachedFileReader(cachedPath, plAudioCore::kAll); + plAudioFileReader *r = new plCachedFileReader(cachedPath, plAudioCore::kAll); if (!r->IsValid()) { // So we tried to play a cached file and it didn't exist // Oops... we should cache it now delete r; ICacheFile(path, true, whichChan); - r = TRACKED_NEW plCachedFileReader(cachedPath, plAudioCore::kAll); + r = new plCachedFileReader(cachedPath, plAudioCore::kAll); } return r; } - plAudioFileReader *r = TRACKED_NEW plFastWAV(path, whichChan); + plAudioFileReader *r = new plFastWAV(path, whichChan); return r; } else if (type == kStreamRAM) - return TRACKED_NEW plBufferedFileReader(path, whichChan); + return new plBufferedFileReader(path, whichChan); else if (type == kStreamNative) - return TRACKED_NEW plOGGCodec(path, whichChan); + return new plOGGCodec(path, whichChan); return nil; } @@ -116,7 +116,7 @@ plAudioFileReader* plAudioFileReader::CreateWriter(const char* path, plWAVHeader { const char* ext = plFileUtils::GetFileExt(path); - plAudioFileReader* writer = TRACKED_NEW plCachedFileReader(path, plAudioCore::kAll); + plAudioFileReader* writer = new plCachedFileReader(path, plAudioCore::kAll); writer->OpenForWriting(path, header); return writer; } @@ -164,11 +164,11 @@ void plAudioFileReader::ICacheFile(const char* path, bool noOverwrite, plAudioCo return; } - UInt8 buffer[4096]; - UInt32 numLeft; + uint8_t buffer[4096]; + uint32_t numLeft; while ((numLeft = reader->NumBytesLeft()) > 0) { - UInt32 toRead = (numLeft < sizeof(buffer)) ? numLeft : sizeof(buffer); + uint32_t toRead = (numLeft < sizeof(buffer)) ? numLeft : sizeof(buffer); reader->Read(toRead, buffer); writer->Write(toRead, buffer); } diff --git a/Sources/Plasma/PubUtilLib/plAudioCore/plAudioFileReader.h b/Sources/Plasma/PubUtilLib/plAudioCore/plAudioFileReader.h index 7daf6443..e067a38c 100644 --- a/Sources/Plasma/PubUtilLib/plAudioCore/plAudioFileReader.h +++ b/Sources/Plasma/PubUtilLib/plAudioCore/plAudioFileReader.h @@ -73,15 +73,15 @@ public: virtual void Open(){} virtual void Close( void ) = 0; - virtual UInt32 GetDataSize( void ) = 0; + virtual uint32_t GetDataSize( void ) = 0; virtual float GetLengthInSecs( void ) = 0; - virtual hsBool SetPosition( UInt32 numBytes ) = 0; - virtual hsBool Read( UInt32 numBytes, void *buffer ) = 0; - virtual UInt32 NumBytesLeft( void ) = 0; + virtual hsBool SetPosition( uint32_t numBytes ) = 0; + virtual hsBool Read( uint32_t numBytes, void *buffer ) = 0; + virtual uint32_t NumBytesLeft( void ) = 0; virtual hsBool OpenForWriting( const char *path, plWAVHeader &header ) { return false; } - virtual UInt32 Write( UInt32 bytes, void *buffer ) { return 0; } + virtual uint32_t Write( uint32_t bytes, void *buffer ) { return 0; } virtual hsBool IsValid( void ) = 0; diff --git a/Sources/Plasma/PubUtilLib/plAudioCore/plBufferedFileReader.cpp b/Sources/Plasma/PubUtilLib/plAudioCore/plBufferedFileReader.cpp index 410b1765..e3a12769 100644 --- a/Sources/Plasma/PubUtilLib/plAudioCore/plBufferedFileReader.cpp +++ b/Sources/Plasma/PubUtilLib/plAudioCore/plBufferedFileReader.cpp @@ -55,7 +55,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include #include #include -#include "hsTypes.h" +#include "HeadSpin.h" #include "plBufferedFileReader.h" //#include "plProfile.h" @@ -86,7 +86,7 @@ plBufferedFileReader::plBufferedFileReader( const char *path, plAudioCore::Chann fHeader = reader->GetHeader(); fBufferSize = reader->GetDataSize(); - fBuffer = TRACKED_NEW UInt8[ fBufferSize ]; + fBuffer = new uint8_t[ fBufferSize ]; //plProfile_NewMem( SndBufferedMem, fBufferSize ); if( fBuffer == nil ) { @@ -115,7 +115,7 @@ void plBufferedFileReader::Close( void ) { //plProfile_DelMem( SndBufferedMem, fBufferSize ); - DEL(fBuffer);; + delete fBuffer; fBuffer = nil; fBufferSize = 0; fCursor = 0; @@ -141,7 +141,7 @@ float plBufferedFileReader::GetLengthInSecs( void ) return (float)fBufferSize / (float)fHeader.fAvgBytesPerSec; } -hsBool plBufferedFileReader::SetPosition( UInt32 numBytes ) +hsBool plBufferedFileReader::SetPosition( uint32_t numBytes ) { hsAssert( IsValid(), "SetPosition() called on an invalid RAM buffer" ); @@ -155,7 +155,7 @@ hsBool plBufferedFileReader::SetPosition( UInt32 numBytes ) return true; } -hsBool plBufferedFileReader::Read( UInt32 numBytes, void *buffer ) +hsBool plBufferedFileReader::Read( uint32_t numBytes, void *buffer ) { hsAssert( IsValid(), "Read() called on an invalid RAM buffer" ); @@ -174,7 +174,7 @@ hsBool plBufferedFileReader::Read( UInt32 numBytes, void *buffer ) return valid; } -UInt32 plBufferedFileReader::NumBytesLeft( void ) +uint32_t plBufferedFileReader::NumBytesLeft( void ) { hsAssert( IsValid(), "NumBytesLeft() called on an invalid RAM buffer" ); diff --git a/Sources/Plasma/PubUtilLib/plAudioCore/plBufferedFileReader.h b/Sources/Plasma/PubUtilLib/plAudioCore/plBufferedFileReader.h index 056c14d9..b95e2756 100644 --- a/Sources/Plasma/PubUtilLib/plAudioCore/plBufferedFileReader.h +++ b/Sources/Plasma/PubUtilLib/plAudioCore/plBufferedFileReader.h @@ -64,18 +64,18 @@ public: virtual plWAVHeader &GetHeader( void ); virtual void Close( void ); - virtual UInt32 GetDataSize( void ) { return fBufferSize; } + virtual uint32_t GetDataSize( void ) { return fBufferSize; } virtual float GetLengthInSecs( void ); - virtual hsBool SetPosition( UInt32 numBytes ); - virtual hsBool Read( UInt32 numBytes, void *buffer ); - virtual UInt32 NumBytesLeft( void ); + virtual hsBool SetPosition( uint32_t numBytes ); + virtual hsBool Read( uint32_t numBytes, void *buffer ); + virtual uint32_t NumBytesLeft( void ); virtual hsBool IsValid( void ) { return ( fBuffer != nil ) ? true : false; } protected: - UInt32 fBufferSize; - UInt8 *fBuffer; + uint32_t fBufferSize; + uint8_t *fBuffer; plWAVHeader fHeader; - UInt32 fCursor; + uint32_t fCursor; void IError( const char *msg ); }; diff --git a/Sources/Plasma/PubUtilLib/plAudioCore/plCachedFileReader.cpp b/Sources/Plasma/PubUtilLib/plAudioCore/plCachedFileReader.cpp index 065ae7fb..2c218d06 100644 --- a/Sources/Plasma/PubUtilLib/plAudioCore/plCachedFileReader.cpp +++ b/Sources/Plasma/PubUtilLib/plAudioCore/plCachedFileReader.cpp @@ -50,7 +50,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // // ////////////////////////////////////////////////////////////////////////////// -#include "hsTypes.h" +#include "HeadSpin.h" #include "plCachedFileReader.h" //// Constructor/Destructor ////////////////////////////////////////////////// @@ -117,7 +117,7 @@ void plCachedFileReader::Close() } } -UInt32 plCachedFileReader::GetDataSize() +uint32_t plCachedFileReader::GetDataSize() { hsAssert(IsValid(), "GetDataSize() called on an invalid cache file"); @@ -131,7 +131,7 @@ float plCachedFileReader::GetLengthInSecs() return (float)fDataLength / (float)fHeader.fAvgBytesPerSec; } -hsBool plCachedFileReader::SetPosition(UInt32 numBytes) +hsBool plCachedFileReader::SetPosition(uint32_t numBytes) { hsAssert(IsValid(), "SetPosition() called on an invalid cache file"); @@ -142,7 +142,7 @@ hsBool plCachedFileReader::SetPosition(UInt32 numBytes) return !fseek(fFileHandle, sizeof(plWAVHeader) + fCurPosition, SEEK_SET); } -hsBool plCachedFileReader::Read(UInt32 numBytes, void *buffer) +hsBool plCachedFileReader::Read(uint32_t numBytes, void *buffer) { hsAssert(IsValid(), "Read() called on an invalid cache file"); @@ -154,7 +154,7 @@ hsBool plCachedFileReader::Read(UInt32 numBytes, void *buffer) return numRead >= numBytes; } -UInt32 plCachedFileReader::NumBytesLeft() +uint32_t plCachedFileReader::NumBytesLeft() { hsAssert(IsValid(), "NumBytesLeft() called on an invalid cache file"); hsAssert(fCurPosition <= fDataLength, "Invalid position while reading"); @@ -187,7 +187,7 @@ hsBool plCachedFileReader::OpenForWriting(const char *path, plWAVHeader &header) return fFileHandle != nil; } -UInt32 plCachedFileReader::Write(UInt32 bytes, void* buffer) +uint32_t plCachedFileReader::Write(uint32_t bytes, void* buffer) { hsAssert(IsValid(), "Write() called on an invalid cache file"); @@ -196,5 +196,5 @@ UInt32 plCachedFileReader::Write(UInt32 bytes, void* buffer) fCurPosition += written; fDataLength += written; - return (UInt32)written; + return (uint32_t)written; } diff --git a/Sources/Plasma/PubUtilLib/plAudioCore/plCachedFileReader.h b/Sources/Plasma/PubUtilLib/plAudioCore/plCachedFileReader.h index 4ac42b60..c857605e 100644 --- a/Sources/Plasma/PubUtilLib/plAudioCore/plCachedFileReader.h +++ b/Sources/Plasma/PubUtilLib/plAudioCore/plCachedFileReader.h @@ -68,15 +68,15 @@ public: virtual void Close(); - virtual UInt32 GetDataSize(); + virtual uint32_t GetDataSize(); virtual float GetLengthInSecs(); - virtual hsBool SetPosition(UInt32 numBytes); - virtual hsBool Read(UInt32 numBytes, void *buffer); - virtual UInt32 NumBytesLeft(); + virtual hsBool SetPosition(uint32_t numBytes); + virtual hsBool Read(uint32_t numBytes, void *buffer); + virtual uint32_t NumBytesLeft(); virtual hsBool OpenForWriting(const char *path, plWAVHeader &header); - virtual UInt32 Write(UInt32 bytes, void *buffer); + virtual uint32_t Write(uint32_t bytes, void *buffer); virtual hsBool IsValid() { return fFileHandle != nil; } @@ -89,8 +89,8 @@ protected: char fFilename[512]; FILE * fFileHandle; plWAVHeader fHeader; - UInt32 fDataLength; - UInt32 fCurPosition; + uint32_t fDataLength; + uint32_t fCurPosition; void IError(const char *msg); }; diff --git a/Sources/Plasma/PubUtilLib/plAudioCore/plFastWavReader.cpp b/Sources/Plasma/PubUtilLib/plAudioCore/plFastWavReader.cpp index 1787668d..a5661024 100644 --- a/Sources/Plasma/PubUtilLib/plAudioCore/plFastWavReader.cpp +++ b/Sources/Plasma/PubUtilLib/plAudioCore/plFastWavReader.cpp @@ -54,7 +54,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include #include #include -#include "hsTypes.h" +#include "HeadSpin.h" #include "plFastWavReader.h" @@ -64,12 +64,12 @@ class plRIFFChunk { public: char fID[ 4 ]; - UInt32 fSize; + uint32_t fSize; void Read( FILE *fp ) { fread( fID, 1, 4, fp ); - fread( &fSize, sizeof( UInt32 ), 1, fp ); + fread( &fSize, sizeof( uint32_t ), 1, fp ); } bool IsA( const char *type ) @@ -185,8 +185,8 @@ plFastWAV::plFastWAV( const char *path, plAudioCore::ChannelSelect whichChan ) : fFakeHeader = fHeader; fFakeHeader.fAvgBytesPerSec /= fChannelAdjust; - fFakeHeader.fNumChannels /= (UInt16)fChannelAdjust; - fFakeHeader.fBlockAlign /= (UInt16)fChannelAdjust; + fFakeHeader.fNumChannels /= (uint16_t)fChannelAdjust; + fFakeHeader.fBlockAlign /= (uint16_t)fChannelAdjust; SetPosition( 0 ); // fCurrDataPos = 0; @@ -265,7 +265,7 @@ float plFastWAV::GetLengthInSecs( void ) return (float)( fDataSize / fChannelAdjust ) / (float)fHeader.fAvgBytesPerSec; } -hsBool plFastWAV::SetPosition( UInt32 numBytes ) +hsBool plFastWAV::SetPosition( uint32_t numBytes ) { hsAssert( IsValid(), "GetHeader() called on an invalid WAV file" ); @@ -277,7 +277,7 @@ hsBool plFastWAV::SetPosition( UInt32 numBytes ) return ( fseek( fFileHandle, fDataStartPos + fCurrDataPos, SEEK_SET ) == 0 ) ? true : false; } -hsBool plFastWAV::Read( UInt32 numBytes, void *buffer ) +hsBool plFastWAV::Read( uint32_t numBytes, void *buffer ) { hsAssert( IsValid(), "GetHeader() called on an invalid WAV file" ); @@ -285,9 +285,9 @@ hsBool plFastWAV::Read( UInt32 numBytes, void *buffer ) if( fWhichChannel != plAudioCore::kAll ) { size_t numRead, sampleSize = fHeader.fBlockAlign / fChannelAdjust; - static UInt8 trashBuffer[ 32 ]; + static uint8_t trashBuffer[ 32 ]; - UInt32 numBytesFull = numBytes; + uint32_t numBytesFull = numBytes; if( fCurrDataPos + ( numBytes * fChannelAdjust ) > fDataSize ) numBytesFull -= sampleSize; @@ -302,7 +302,7 @@ hsBool plFastWAV::Read( UInt32 numBytes, void *buffer ) if( thisRead != sampleSize ) return false; - buffer = (void *)( (UInt8 *)buffer + sampleSize ); + buffer = (void *)( (uint8_t *)buffer + sampleSize ); fCurrDataPos += sampleSize * fChannelAdjust; } @@ -321,7 +321,7 @@ hsBool plFastWAV::Read( UInt32 numBytes, void *buffer ) if( thisRead != sampleSize ) return false; - buffer = (void *)( (UInt8 *)buffer + sampleSize ); + buffer = (void *)( (uint8_t *)buffer + sampleSize ); fCurrDataPos += sampleSize; } @@ -341,7 +341,7 @@ hsBool plFastWAV::Read( UInt32 numBytes, void *buffer ) return true; } -UInt32 plFastWAV::NumBytesLeft( void ) +uint32_t plFastWAV::NumBytesLeft( void ) { hsAssert( IsValid(), "GetHeader() called on an invalid WAV file" ); hsAssert( fCurrDataPos <= fDataSize, "Invalid current position while reading WAV file" ); diff --git a/Sources/Plasma/PubUtilLib/plAudioCore/plFastWavReader.h b/Sources/Plasma/PubUtilLib/plAudioCore/plFastWavReader.h index 6d40fa05..a0a1818e 100644 --- a/Sources/Plasma/PubUtilLib/plAudioCore/plFastWavReader.h +++ b/Sources/Plasma/PubUtilLib/plAudioCore/plFastWavReader.h @@ -68,12 +68,12 @@ public: virtual void Open(); virtual void Close( void ); - virtual UInt32 GetDataSize( void ) { return fDataSize / fChannelAdjust; } + virtual uint32_t GetDataSize( void ) { return fDataSize / fChannelAdjust; } virtual float GetLengthInSecs( void ); - virtual hsBool SetPosition( UInt32 numBytes ); - virtual hsBool Read( UInt32 numBytes, void *buffer ); - virtual UInt32 NumBytesLeft( void ); + virtual hsBool SetPosition( uint32_t numBytes ); + virtual hsBool Read( uint32_t numBytes, void *buffer ); + virtual uint32_t NumBytesLeft( void ); virtual hsBool IsValid( void ) { return ( fFileHandle != nil ) ? true : false; } @@ -86,10 +86,10 @@ protected: char fFilename[ 512 ]; FILE * fFileHandle; plWAVHeader fHeader, fFakeHeader; - UInt32 fDataStartPos, fCurrDataPos, fDataSize; - UInt32 fChunkStart; + uint32_t fDataStartPos, fCurrDataPos, fDataSize; + uint32_t fChunkStart; plAudioCore::ChannelSelect fWhichChannel; - UInt32 fChannelAdjust, fChannelOffset; + uint32_t fChannelAdjust, fChannelOffset; void IError( const char *msg ); bool ISeekToChunk( const char *type, plRIFFChunk *c ); diff --git a/Sources/Plasma/PubUtilLib/plAudioCore/plOGGCodec.cpp b/Sources/Plasma/PubUtilLib/plAudioCore/plOGGCodec.cpp index 2fdb5d89..d3230fc8 100644 --- a/Sources/Plasma/PubUtilLib/plAudioCore/plOGGCodec.cpp +++ b/Sources/Plasma/PubUtilLib/plAudioCore/plOGGCodec.cpp @@ -54,14 +54,14 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include #include -#include "hsTypes.h" +#include "HeadSpin.h" #include "plOGGCodec.h" #include "hsTimer.h" #include "pnNetCommon/plNetApp.h" plOGGCodec::DecodeFormat plOGGCodec::fDecodeFormat = plOGGCodec::k16bitSigned; -UInt8 plOGGCodec::fDecodeFlags = 0; +uint8_t plOGGCodec::fDecodeFlags = 0; //// Constructor/Destructor ////////////////////////////////////////////////// @@ -82,7 +82,7 @@ void plOGGCodec::BuildActualWaveHeader() int factdata = 0; int size = fDataSize+48; // size of data with header except for first four bytes - fHeadBuf = (UInt8 *) ALLOC(56); + fHeadBuf = (uint8_t *)malloc(56); memcpy(fHeadBuf, "RIFF", 4); memcpy(fHeadBuf+4, &size, 4); memcpy(fHeadBuf+8, "WAVE", 4); @@ -126,7 +126,7 @@ void plOGGCodec::IOpen( const char *path, plAudioCore::ChannelSelect whichCha if( fFileHandle != nil ) { /// Create the OGG data struct - fOggFile = TRACKED_NEW OggVorbis_File; + fOggFile = new OggVorbis_File; /// Open the OGG decompressor if( ov_open( fFileHandle, fOggFile, NULL, 0 ) < 0 ) @@ -155,7 +155,7 @@ void plOGGCodec::IOpen( const char *path, plAudioCore::ChannelSelect whichCha /// because we end up waiting for 1 more sample than we actually have. So, on the /// assumption that OGG is just slightly wrong sometimes, we just subtract 1 sample /// from what it tells us. As Brice put it, who's going to miss 1/40,000'ths of a second? - fDataSize = (UInt32)(( ov_pcm_total( fOggFile, -1 ) - 1 ) * fHeader.fBlockAlign); + fDataSize = (uint32_t)(( ov_pcm_total( fOggFile, -1 ) - 1 ) * fHeader.fBlockAlign); /// Channel select if( fWhichChannel != plAudioCore::kAll ) @@ -173,8 +173,8 @@ void plOGGCodec::IOpen( const char *path, plAudioCore::ChannelSelect whichCha /// Construct our fake header for channel adjustment fFakeHeader = fHeader; fFakeHeader.fAvgBytesPerSec /= fChannelAdjust; - fFakeHeader.fNumChannels /= (UInt16)fChannelAdjust; - fFakeHeader.fBlockAlign /= (UInt16)fChannelAdjust; + fFakeHeader.fNumChannels /= (uint16_t)fChannelAdjust; + fFakeHeader.fBlockAlign /= (uint16_t)fChannelAdjust; SetPosition( 0 ); } @@ -189,12 +189,12 @@ plOGGCodec::~plOGGCodec() void plOGGCodec::Close( void ) { // plNetClientApp::StaticDebugMsg("Ogg Close, t=%f, start", hsTimer::GetSeconds()); - FREE(fHeadBuf); + free(fHeadBuf); fHeadBuf = nil; if( fOggFile != nil ) { ov_clear( fOggFile ); - DEL(fOggFile); + delete fOggFile; fOggFile = nil; } @@ -227,7 +227,7 @@ float plOGGCodec::GetLengthInSecs( void ) return (float)ov_time_total( fOggFile, -1 ); } -hsBool plOGGCodec::SetPosition( UInt32 numBytes ) +hsBool plOGGCodec::SetPosition( uint32_t numBytes ) { hsAssert( IsValid(), "GetHeader() called on an invalid OGG file" ); @@ -263,7 +263,7 @@ hsBool plOGGCodec::SetPosition( UInt32 numBytes ) return true; } -hsBool plOGGCodec::Read( UInt32 numBytes, void *buffer ) +hsBool plOGGCodec::Read( uint32_t numBytes, void *buffer ) { hsAssert( IsValid(), "GetHeader() called on an invalid OGG file" ); // plNetClientApp::StaticDebugMsg("Ogg Read, t=%f, start", hsTimer::GetSeconds()); @@ -332,7 +332,7 @@ hsBool plOGGCodec::Read( UInt32 numBytes, void *buffer ) for (i = 0; i < thisRead; i += sampleSize * 2) { memcpy(buffer, &trashBuffer[i + sampleOffset], sampleSize); - buffer = (void*)((UInt8*)buffer + sampleSize); + buffer = (void*)((uint8_t*)buffer + sampleSize); numBytes -= sampleSize; } @@ -343,7 +343,7 @@ hsBool plOGGCodec::Read( UInt32 numBytes, void *buffer ) return true; } -UInt32 plOGGCodec::NumBytesLeft( void ) +uint32_t plOGGCodec::NumBytesLeft( void ) { if(!IsValid()) { @@ -351,5 +351,5 @@ UInt32 plOGGCodec::NumBytesLeft( void ) return 0; } - return (UInt32)(( fDataSize - ( ov_pcm_tell( fOggFile ) * fHeader.fBlockAlign ) ) / fChannelAdjust); + return (uint32_t)(( fDataSize - ( ov_pcm_tell( fOggFile ) * fHeader.fBlockAlign ) ) / fChannelAdjust); } diff --git a/Sources/Plasma/PubUtilLib/plAudioCore/plOGGCodec.h b/Sources/Plasma/PubUtilLib/plAudioCore/plOGGCodec.h index 535c273e..e83506cb 100644 --- a/Sources/Plasma/PubUtilLib/plAudioCore/plOGGCodec.h +++ b/Sources/Plasma/PubUtilLib/plAudioCore/plOGGCodec.h @@ -77,18 +77,18 @@ public: virtual void Close( void ); - virtual UInt32 GetDataSize( void ) { return fDataSize / fChannelAdjust; } + virtual uint32_t GetDataSize( void ) { return fDataSize / fChannelAdjust; } virtual float GetLengthInSecs( void ); - virtual hsBool SetPosition( UInt32 numBytes ); - virtual hsBool Read( UInt32 numBytes, void *buffer ); - virtual UInt32 NumBytesLeft( void ); + virtual hsBool SetPosition( uint32_t numBytes ); + virtual hsBool Read( uint32_t numBytes, void *buffer ); + virtual uint32_t NumBytesLeft( void ); virtual hsBool IsValid( void ) { return ( fOggFile != nil ) ? true : false; } static void SetDecodeFormat( DecodeFormat f ) { fDecodeFormat = f; } - static void SetDecodeFlag( UInt8 flag, hsBool on ) { if( on ) fDecodeFlags |= flag; else fDecodeFlags &= ~flag; } - static UInt8 GetDecodeFlags( void ) { return fDecodeFlags; } + static void SetDecodeFlag( uint8_t flag, hsBool on ) { if( on ) fDecodeFlags |= flag; else fDecodeFlags &= ~flag; } + static uint8_t GetDecodeFlags( void ) { return fDecodeFlags; } void ResetWaveHeaderRef() { fCurHeaderPos = 0; } void BuildActualWaveHeader(); bool ReadFromHeader(int numBytes, void *data); // read from Actual wave header @@ -105,14 +105,14 @@ protected: OggVorbis_File *fOggFile; plWAVHeader fHeader, fFakeHeader; - UInt32 fDataStartPos, fCurrDataPos, fDataSize; + uint32_t fDataStartPos, fCurrDataPos, fDataSize; plAudioCore::ChannelSelect fWhichChannel; - UInt32 fChannelAdjust, fChannelOffset; + uint32_t fChannelAdjust, fChannelOffset; static DecodeFormat fDecodeFormat; - static UInt8 fDecodeFlags; - UInt8 * fHeadBuf; + static uint8_t fDecodeFlags; + uint8_t * fHeadBuf; int fCurHeaderPos; void IError( const char *msg ); diff --git a/Sources/Plasma/PubUtilLib/plAudioCore/plSoundBuffer.cpp b/Sources/Plasma/PubUtilLib/plAudioCore/plSoundBuffer.cpp index 3aac30af..c944cb49 100644 --- a/Sources/Plasma/PubUtilLib/plAudioCore/plSoundBuffer.cpp +++ b/Sources/Plasma/PubUtilLib/plAudioCore/plSoundBuffer.cpp @@ -40,11 +40,11 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "plSoundBuffer.h" #include "hsStream.h" -#include "hsUtils.h" + #include "plgDispatch.h" #include "hsResMgr.h" @@ -166,7 +166,7 @@ plSoundBuffer::plSoundBuffer() IInitBuffer(); } -plSoundBuffer::plSoundBuffer( const char *fileName, UInt32 flags ) +plSoundBuffer::plSoundBuffer( const char *fileName, uint32_t flags ) { IInitBuffer(); SetFileName( fileName ); @@ -212,9 +212,9 @@ void plSoundBuffer::IInitBuffer() //// GetDataLengthInSecs ///////////////////////////////////////////////////// -hsScalar plSoundBuffer::GetDataLengthInSecs( void ) const +float plSoundBuffer::GetDataLengthInSecs( void ) const { - return (hsScalar)fDataLength / (hsScalar)fHeader.fAvgBytesPerSec; + return (float)fDataLength / (float)fHeader.fAvgBytesPerSec; } //// Read/Write ////////////////////////////////////////////////////////////// @@ -237,7 +237,7 @@ void plSoundBuffer::Read( hsStream *s, hsResMgr *mgr ) fValid = false; if( !( fFlags & kIsExternal ) ) { - fData = TRACKED_NEW UInt8[ fDataLength ]; + fData = new uint8_t[ fDataLength ]; if( fData == nil ) fFlags |= kIsExternal; else @@ -360,7 +360,7 @@ plSoundBuffer::ELoadReturnVal plSoundBuffer::AsyncLoad(plAudioFileReader::Stream fStreamType = type; if(fData == nil ) { - fData = TRACKED_NEW UInt8[ fAsyncLoadLength ? fAsyncLoadLength : fDataLength ]; + fData = new uint8_t[ fAsyncLoadLength ? fAsyncLoadLength : fDataLength ]; if( fData == nil ) return kError; } @@ -418,9 +418,9 @@ void plSoundBuffer::UnLoad( void ) //// IRoundDataPos /////////////////////////////////////////////////////////// -void plSoundBuffer::RoundDataPos( UInt32 &pos ) +void plSoundBuffer::RoundDataPos( uint32_t &pos ) { - UInt32 extra = pos & ( fHeader.fBlockAlign - 1 ); + uint32_t extra = pos & ( fHeader.fBlockAlign - 1 ); pos -= extra; } @@ -457,7 +457,7 @@ void plSoundBuffer::SetLoaded(bool loaded) //// SetInternalData ///////////////////////////////////////////////////////// -void plSoundBuffer::SetInternalData( plWAVHeader &header, UInt32 length, UInt8 *data ) +void plSoundBuffer::SetInternalData( plWAVHeader &header, uint32_t length, uint8_t *data ) { if(fLoading) return; fFileName = nil; @@ -465,7 +465,7 @@ void plSoundBuffer::SetInternalData( plWAVHeader &header, UInt32 length, UInt fFlags = 0; fDataLength = length; - fData = TRACKED_NEW UInt8[ length ]; + fData = new uint8_t[ length ]; memcpy( fData, data, length ); fValid = true; @@ -477,7 +477,7 @@ plSoundBuffer::ELoadReturnVal plSoundBuffer::EnsureInternal() { if( fData == nil ) { - fData = TRACKED_NEW UInt8[fDataLength ]; + fData = new uint8_t[fDataLength ]; if( fData == nil ) return kError; } diff --git a/Sources/Plasma/PubUtilLib/plAudioCore/plSoundBuffer.h b/Sources/Plasma/PubUtilLib/plAudioCore/plSoundBuffer.h index 02256f03..43920065 100644 --- a/Sources/Plasma/PubUtilLib/plAudioCore/plSoundBuffer.h +++ b/Sources/Plasma/PubUtilLib/plAudioCore/plSoundBuffer.h @@ -65,7 +65,7 @@ class plSoundBuffer : public hsKeyedObject { public: plSoundBuffer(); - plSoundBuffer( const char *fileName, UInt32 flags = 0 ); + plSoundBuffer( const char *fileName, uint32_t flags = 0 ); ~plSoundBuffer(); CLASSNAME_REGISTER( plSoundBuffer ); @@ -87,22 +87,22 @@ public: kPending, }; - void RoundDataPos( UInt32 &pos ); + void RoundDataPos( uint32_t &pos ); virtual void Read( hsStream *s, hsResMgr *mgr ); virtual void Write( hsStream *s, hsResMgr *mgr ); plWAVHeader &GetHeader( void ) { return fHeader; } - UInt32 GetDataLength( void ) const { return fDataLength; } + uint32_t GetDataLength( void ) const { return fDataLength; } void SetDataLength(unsigned length) { fDataLength = length; } void *GetData( void ) const { return fData; } const char *GetFileName( void ) const { return fFileName; } hsBool IsValid( void ) const { return fValid; } - hsScalar GetDataLengthInSecs( void ) const; + float GetDataLengthInSecs( void ) const; void SetFileName( const char *name ); - hsBool HasFlag( UInt32 flag ) { return ( fFlags & flag ) ? true : false; } - void SetFlag( UInt32 flag, hsBool yes = true ) { if( yes ) fFlags |= flag; else fFlags &= ~flag; } + hsBool HasFlag( uint32_t flag ) { return ( fFlags & flag ) ? true : false; } + void SetFlag( uint32_t flag, hsBool yes = true ) { if( yes ) fFlags |= flag; else fFlags &= ~flag; } // Must be called until return value is kSuccess. starts an asynchronous load first time called. returns kSuccess when finished. ELoadReturnVal AsyncLoad( plAudioFileReader::StreamType type, unsigned length = 0 ); @@ -121,7 +121,7 @@ public: unsigned GetAsyncLoadLength() { return fAsyncLoadLength ? fAsyncLoadLength : fDataLength; } // for plugins only - void SetInternalData( plWAVHeader &header, UInt32 length, UInt8 *data ); + void SetInternalData( plWAVHeader &header, uint32_t length, uint8_t *data ); ELoadReturnVal EnsureInternal( ); void SetError() { fError = true; } @@ -134,12 +134,12 @@ protected: void IInitBuffer(); hsBool IGrabHeaderInfo( void ); - void IAddBuffers( void *base, void *toAdd, UInt32 lengthInBytes, UInt8 bitsPerSample ); + void IAddBuffers( void *base, void *toAdd, uint32_t lengthInBytes, uint8_t bitsPerSample ); void IGetFullPath( char *destStr ); - UInt32 fFlags; + uint32_t fFlags; hsBool fValid; - UInt32 fDataRead; + uint32_t fDataRead; char *fFileName; bool fLoaded; @@ -147,10 +147,10 @@ protected: bool fError; plAudioFileReader * fReader; - UInt8 * fData; + uint8_t * fData; plWAVHeader fHeader; - UInt32 fDataLength; - UInt32 fAsyncLoadLength; + uint32_t fDataLength; + uint32_t fAsyncLoadLength; plAudioFileReader::StreamType fStreamType; // for plugins only diff --git a/Sources/Plasma/PubUtilLib/plAudioCore/plSoundDeswizzler.cpp b/Sources/Plasma/PubUtilLib/plAudioCore/plSoundDeswizzler.cpp index b2c54e0d..9ea85ea2 100644 --- a/Sources/Plasma/PubUtilLib/plAudioCore/plSoundDeswizzler.cpp +++ b/Sources/Plasma/PubUtilLib/plAudioCore/plSoundDeswizzler.cpp @@ -46,26 +46,26 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // // ////////////////////////////////////////////////////////////////////////////// -#include "hsTypes.h" +#include "HeadSpin.h" #include "plSoundDeswizzler.h" #include -plSoundDeswizzler::plSoundDeswizzler( void *srcPtr, UInt32 srcLength, UInt8 numChannels, UInt32 sampleSize ) +plSoundDeswizzler::plSoundDeswizzler( void *srcPtr, uint32_t srcLength, uint8_t numChannels, uint32_t sampleSize ) { fNumSamples = srcLength / sampleSize; fSampleSize = sampleSize; fStride = fSampleSize * numChannels; - fData = (UInt8 *)srcPtr; + fData = (uint8_t *)srcPtr; fOwnsData = false; } -plSoundDeswizzler::plSoundDeswizzler( UInt32 srcLength, UInt8 numChannels, UInt32 sampleSize ) +plSoundDeswizzler::plSoundDeswizzler( uint32_t srcLength, uint8_t numChannels, uint32_t sampleSize ) { fNumSamples = srcLength / sampleSize; fSampleSize = sampleSize; fStride = fSampleSize * numChannels; - fData = TRACKED_NEW UInt8[ srcLength ]; + fData = new uint8_t[ srcLength ]; fOwnsData = true; } @@ -75,11 +75,11 @@ plSoundDeswizzler::~plSoundDeswizzler() delete [] fData; } -void plSoundDeswizzler::Extract( UInt8 channelSelect, void *dest, UInt32 numBytesToProcess ) +void plSoundDeswizzler::Extract( uint8_t channelSelect, void *dest, uint32_t numBytesToProcess ) { - UInt8 *srcPtr = fData + channelSelect * fSampleSize; - UInt8 *destPtr = (UInt8 *)dest; - UInt32 i; + uint8_t *srcPtr = fData + channelSelect * fSampleSize; + uint8_t *destPtr = (uint8_t *)dest; + uint32_t i; if( numBytesToProcess == 0 ) diff --git a/Sources/Plasma/PubUtilLib/plAudioCore/plSoundDeswizzler.h b/Sources/Plasma/PubUtilLib/plAudioCore/plSoundDeswizzler.h index 1c0ec3c5..4c978324 100644 --- a/Sources/Plasma/PubUtilLib/plAudioCore/plSoundDeswizzler.h +++ b/Sources/Plasma/PubUtilLib/plAudioCore/plSoundDeswizzler.h @@ -49,7 +49,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #ifndef _plSoundDeswizzler_h #define _plSoundDeswizzler_h -#include "hsTypes.h" +#include "HeadSpin.h" //// Class Definition //////////////////////////////////////////////////////// @@ -57,16 +57,16 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com class plSoundDeswizzler { public: - plSoundDeswizzler( void *srcPtr, UInt32 srcLength, UInt8 numChannels, UInt32 sampleSize ); - plSoundDeswizzler( UInt32 srcLength, UInt8 numChannels, UInt32 sampleSize ); + plSoundDeswizzler( void *srcPtr, uint32_t srcLength, uint8_t numChannels, uint32_t sampleSize ); + plSoundDeswizzler( uint32_t srcLength, uint8_t numChannels, uint32_t sampleSize ); ~plSoundDeswizzler(); void *GetSourceBuffer( void ) const { return fData; } - void Extract( UInt8 channelSelect, void *destPtr, UInt32 numBytesToProcess = 0 ); + void Extract( uint8_t channelSelect, void *destPtr, uint32_t numBytesToProcess = 0 ); protected: - UInt8 *fData; - UInt32 fNumSamples, fSampleSize, fStride; + uint8_t *fData; + uint32_t fNumSamples, fSampleSize, fStride; hsBool fOwnsData; }; diff --git a/Sources/Plasma/PubUtilLib/plAudioCore/plWavFile.cpp b/Sources/Plasma/PubUtilLib/plAudioCore/plWavFile.cpp index 20b78642..1759c9b9 100644 --- a/Sources/Plasma/PubUtilLib/plAudioCore/plWavFile.cpp +++ b/Sources/Plasma/PubUtilLib/plAudioCore/plWavFile.cpp @@ -169,7 +169,7 @@ HRESULT CWaveFile::Open(const char *strFileName, WAVEFORMATEX* pwfx, DWORD dwFla if( NULL == ( pvRes = LockResource( hResData ) ) ) return DXTRACE_ERR( TEXT("LockResource"), E_FAIL ); - CHAR* pData = TRACKED_NEW CHAR[ dwSize ]; + CHAR* pData = new CHAR[ dwSize ]; memcpy( pData, pvRes, dwSize ); MMIOINFO mmioInfo; @@ -273,18 +273,18 @@ HRESULT CWaveFile::OpenFromMemory( BYTE* pbData, ULONG ulDataSize, (Actually, in the latter case, dwChunkStart is also set to 0, and only dwBlockStart is used). Again, I want to emphasize that you can avoid all of this unnecessary crap if you avoid hassling with compressed files, or Wave Lists, and instead stick to the sensible basics. - The dwChunkStart field specifies the byte offset of the start of the 'data' or 'slnt' chunk which actually contains the waveform data to - which this CuePoint refers. This offset is relative to the start of the first chunk within the Wave List. (ie, It's the byte offset, within + The dwChunkStart field specifies the uint8_t offset of the start of the 'data' or 'slnt' chunk which actually contains the waveform data to + which this CuePoint refers. This offset is relative to the start of the first chunk within the Wave List. (ie, It's the uint8_t offset, within the Wave List, of where the 'data' or 'slnt' chunk of interest appears. The first chunk within the List would be at an offset of 0). - The dwBlockStart field specifies the byte offset of the start of the block containing the position. This offset is relative to the start of + The dwBlockStart field specifies the uint8_t offset of the start of the block containing the position. This offset is relative to the start of the waveform data within the 'data' or 'slnt' chunk. The dwSampleOffset field specifies the sample offset of the cue point relative to the start of the block. In an uncompressed file, this equates to simply being the offset within the waveformData array. Unfortunately, the WAVE documentation is much too ambiguous, and doesn't - define what it means by the term "sample offset". This could mean a byte offset, or it could mean counting the sample points (for example, + define what it means by the term "sample offset". This could mean a uint8_t offset, or it could mean counting the sample points (for example, in a 16-bit wave, every 2 bytes would be 1 sample point), or it could even mean sample frames (as the loop offsets in AIFF are specified). - Who knows? The guy who conjured up the Cue chunk certainly isn't saying. I'm assuming that it's a byte offset, like the above 2 fields. + Who knows? The guy who conjured up the Cue chunk certainly isn't saying. I'm assuming that it's a uint8_t offset, like the above 2 fields. */ class CuePoint @@ -356,10 +356,10 @@ HRESULT CWaveFile::ReadMMIO() return DXTRACE_ERR( TEXT("mmioRead"), E_FAIL ); // Allocate the waveformatex, but if its not pcm format, read the next - // word, and thats how many extra bytes to allocate. + // uint16_t, and thats how many extra bytes to allocate. if( pcmWaveFormat.wf.wFormatTag == WAVE_FORMAT_PCM ) { - m_pwfx = (WAVEFORMATEX*)( TRACKED_NEW CHAR[ sizeof( WAVEFORMATEX ) ] ); + m_pwfx = (WAVEFORMATEX*)( new CHAR[ sizeof( WAVEFORMATEX ) ] ); if( NULL == m_pwfx ) return DXTRACE_ERR( TEXT("m_pwfx"), E_FAIL ); @@ -374,7 +374,7 @@ HRESULT CWaveFile::ReadMMIO() if( mmioRead( m_hmmio, (CHAR*)&cbExtraBytes, sizeof(WORD)) != sizeof(WORD) ) return DXTRACE_ERR( TEXT("mmioRead"), E_FAIL ); - m_pwfx = (WAVEFORMATEX*)( TRACKED_NEW CHAR[ sizeof(WAVEFORMATEX) + cbExtraBytes ] ); + m_pwfx = (WAVEFORMATEX*)( new CHAR[ sizeof(WAVEFORMATEX) + cbExtraBytes ] ); if( NULL == m_pwfx ) return DXTRACE_ERR( TEXT("new"), E_FAIL ); @@ -421,7 +421,7 @@ HRESULT CWaveFile::ReadMMIO() return DXTRACE_ERR( TEXT("sizeof(CueChunk)"), E_FAIL ); #endif - DWORD* CueBuff = TRACKED_NEW DWORD[ckIn.cksize]; + DWORD* CueBuff = new DWORD[ckIn.cksize]; DWORD Results; Read((BYTE*)CueBuff, ckIn.cksize, &Results); @@ -457,7 +457,7 @@ HRESULT CWaveFile::ReadMMIO() plSoundMarker *newMarker; - BYTE *labelBuf = TRACKED_NEW BYTE [ckIn.cksize]; + BYTE *labelBuf = new BYTE [ckIn.cksize]; // Read the entire lable chunk and then lets parse out the individual lables. Read(labelBuf, ckIn.cksize-4, &Results); @@ -468,7 +468,7 @@ HRESULT CWaveFile::ReadMMIO() { DWORD size = *(DWORD*)(bp + 4); DWORD id = *(DWORD*)(bp + 8); - newMarker = TRACKED_NEW plSoundMarker; // Grab a new label + newMarker = new plSoundMarker; // Grab a new label int i; @@ -483,8 +483,8 @@ HRESULT CWaveFile::ReadMMIO() newMarker->fOffset = myCueList[i].fOffset * fSecsPerSample; } } - int stringSize = size - sizeof(DWORD); // text string is size of chunck - size of the size word - newMarker->fName = TRACKED_NEW char[ stringSize]; + int stringSize = size - sizeof(DWORD); // text string is size of chunck - size of the size uint16_t + newMarker->fName = new char[ stringSize]; strcpy(newMarker->fName, (char*)(bp + 12)); @@ -979,7 +979,7 @@ void CWaveFile::Close( void ) IClose(); } -UInt32 CWaveFile::GetDataSize( void ) +uint32_t CWaveFile::GetDataSize( void ) { hsAssert( false, "Unsupported" ); return 0; @@ -991,29 +991,29 @@ float CWaveFile::GetLengthInSecs( void ) return 0.f; } -hsBool CWaveFile::SetPosition( UInt32 numBytes ) +hsBool CWaveFile::SetPosition( uint32_t numBytes ) { hsAssert( false, "Unsupported" ); return false; } -hsBool CWaveFile::Read( UInt32 numBytes, void *buffer ) +hsBool CWaveFile::Read( uint32_t numBytes, void *buffer ) { hsAssert( false, "Unsupported" ); return false; } -UInt32 CWaveFile::NumBytesLeft( void ) +uint32_t CWaveFile::NumBytesLeft( void ) { hsAssert( false, "Unsupported" ); return 0; } -UInt32 CWaveFile::Write( UInt32 bytes, void *buffer ) +uint32_t CWaveFile::Write( uint32_t bytes, void *buffer ) { UINT written; Write( (DWORD)bytes, (BYTE *)buffer, &written ); - return (UInt32)written; + return (uint32_t)written; } hsBool CWaveFile::IsValid( void ) @@ -1053,7 +1053,7 @@ public: chunkSize = ChunkSize; dwCuePoints = (ChunkSize - (sizeof(DWORD)*1))/(sizeof(CuePoint)); //points = NULL; - //points = TRACKED_NEW CuePoint[dwCuePoints]; + //points = new CuePoint[dwCuePoints]; } //Cue @@ -1066,14 +1066,14 @@ public: LabelChunk-- The ID is always 'labl'. chunkSize is the number of bytes in the chunk, not counting the 8 bytes used by ID and Size fields nor any possible - pad byte needed to make the chunk an even size (ie, chunkSize is the number of remaining bytes in the chunk after the chunkSize field, not + pad uint8_t needed to make the chunk an even size (ie, chunkSize is the number of remaining bytes in the chunk after the chunkSize field, not counting any trailing pad byte). The dwIdentifier field contains a unique number (ie, different than the ID number of any other Label chunk). This field should correspond with the dwIndentifier field of some CuePoint stored in the Cue chunk. In other words, this Label chunk contains the text label associated with that CuePoint structure with the same ID number. - The dwText array contains the text label. It should be a null-terminated string. (The null byte is included in the chunkSize, therefore the - length of the string, including the null byte, is chunkSize - 4). + The dwText array contains the text label. It should be a null-terminated string. (The null uint8_t is included in the chunkSize, therefore the + length of the string, including the null uint8_t, is chunkSize - 4). */ diff --git a/Sources/Plasma/PubUtilLib/plAudioCore/plWavFile.h b/Sources/Plasma/PubUtilLib/plAudioCore/plWavFile.h index 1d106d83..e1716a68 100644 --- a/Sources/Plasma/PubUtilLib/plAudioCore/plWavFile.h +++ b/Sources/Plasma/PubUtilLib/plAudioCore/plWavFile.h @@ -46,8 +46,8 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #define WAVEFILE_READ 1 #define WAVEFILE_WRITE 2 -#include "hsTypes.h" -#include "hsWindows.h" +#include "HeadSpin.h" + #include "hsStlUtils.h" #include #include "plAudioFileReader.h" @@ -96,13 +96,13 @@ public: virtual hsBool OpenForWriting( const char *path, plWAVHeader &header ); virtual plWAVHeader &GetHeader( void ); virtual void Close( void ); - virtual UInt32 GetDataSize( void ); + virtual uint32_t GetDataSize( void ); virtual float GetLengthInSecs( void ); - virtual hsBool SetPosition( UInt32 numBytes ); - virtual hsBool Read( UInt32 numBytes, void *buffer ); - virtual UInt32 NumBytesLeft( void ); - virtual UInt32 Write( UInt32 bytes, void *buffer ); + virtual hsBool SetPosition( uint32_t numBytes ); + virtual hsBool Read( uint32_t numBytes, void *buffer ); + virtual uint32_t NumBytesLeft( void ); + virtual uint32_t Write( uint32_t bytes, void *buffer ); virtual hsBool IsValid( void ); WAVEFORMATEX* m_pwfx; // Pointer to WAVEFORMATEX structure diff --git a/Sources/Plasma/PubUtilLib/plAvatar/plAGAnim.cpp b/Sources/Plasma/PubUtilLib/plAvatar/plAGAnim.cpp index 890b215d..00bb52db 100644 --- a/Sources/Plasma/PubUtilLib/plAvatar/plAGAnim.cpp +++ b/Sources/Plasma/PubUtilLib/plAvatar/plAGAnim.cpp @@ -82,13 +82,13 @@ plAGAnim::plAGAnim() // ctor ------------------------------------------------------ // ----- plAGAnim::plAGAnim(const char *name, double start, double end) -: fStart((hsScalar)start), - fEnd((hsScalar)end) +: fStart((float)start), + fEnd((float)end) { if (name == nil) name = ""; - fName = TRACKED_NEW char[strlen(name) + 1]; + fName = new char[strlen(name) + 1]; strcpy(fName, name); } @@ -197,7 +197,7 @@ hsBool plAGAnim::RemoveApplicator(int index) // ExtendToLength ---------------------------- // --------------- -void plAGAnim::ExtendToLength(hsScalar length) +void plAGAnim::ExtendToLength(float length) { if (length > GetEnd()) SetEnd(length); @@ -371,8 +371,8 @@ plATCAnim::plATCAnim(const char *name, double start, double end) : plAGAnim(name, start, end), fInitial(-1), fAutoStart(true), - fLoopStart((hsScalar)start), - fLoopEnd((hsScalar)end), + fLoopStart((float)start), + fLoopEnd((float)end), fLoop(false), fEaseInType(plAnimEaseTypes::kNoEase), fEaseOutType(plAnimEaseTypes::kNoEase), @@ -522,7 +522,7 @@ bool plATCAnim::GetLoop(const char *name, float &start, float &end) const // GetLoop -------------------------------------------------------- // -------- -bool plATCAnim::GetLoop(UInt32 num, float &start, float &end) const +bool plATCAnim::GetLoop(uint32_t num, float &start, float &end) const { if (num >= fLoops.size()) return false; @@ -542,7 +542,7 @@ bool plATCAnim::GetLoop(UInt32 num, float &start, float &end) const // GetNumLoops ---------------------- // ------------ -UInt32 plATCAnim::GetNumLoops() const +uint32_t plATCAnim::GetNumLoops() const { return fLoops.size(); } @@ -578,21 +578,21 @@ void plATCAnim::CopyMarkerNames(std::vector &out) // AddStopPoint --------------------------- // ------------- -void plATCAnim::AddStopPoint(hsScalar time) +void plATCAnim::AddStopPoint(float time) { fStopPoints.push_back(time); } // NumStopPoints ---------------- // -------------- -UInt32 plATCAnim::NumStopPoints() +uint32_t plATCAnim::NumStopPoints() { return fStopPoints.size(); } // GetStopPoint -------------------------- // ------------- -hsScalar plATCAnim::GetStopPoint(UInt32 i) +float plATCAnim::GetStopPoint(uint32_t i) { hsAssert(i < fStopPoints.size(), "Invalid index for GetStopPoint"); return fStopPoints[i]; @@ -642,7 +642,7 @@ void plEmoteAnim::Write(hsStream *stream, hsResMgr *mgr) plATCAnim::Write(stream, mgr); stream->WriteLEScalar(fFadeIn); stream->WriteLEScalar(fFadeOut); - stream->WriteByte(static_cast(fBodyUsage)); + stream->WriteByte(static_cast(fBodyUsage)); } // GetBodyUsage ---------------------------------------- diff --git a/Sources/Plasma/PubUtilLib/plAvatar/plAGAnim.h b/Sources/Plasma/PubUtilLib/plAvatar/plAGAnim.h index f79c43ff..ef75eced 100644 --- a/Sources/Plasma/PubUtilLib/plAvatar/plAGAnim.h +++ b/Sources/Plasma/PubUtilLib/plAvatar/plAGAnim.h @@ -144,22 +144,22 @@ public: virtual const char * GetName() const { return fName; } /** Return the length of the animation; end - start. */ - virtual hsScalar GetLength() const { return fEnd - fStart; } + virtual float GetLength() const { return fEnd - fStart; } /** Hacky function to extend the length of the animation to some minimum length. Does nothing if the animation is already longer than this. */ - void ExtendToLength(hsScalar length); + void ExtendToLength(float length); /** Return the start time for the beginning of the animation. The animation contains no data prior to this time. In practice, this always returns 0.0f and this function may be deprecated. */ - virtual hsScalar GetStart() const { return fStart; } - void SetStart(hsScalar start) { fStart = start; } + virtual float GetStart() const { return fStart; } + void SetStart(float start) { fStart = start; } /** Return the end time of the animation. Since start is typically 0, this usually serves as the length of the animation as well. */ - virtual hsScalar GetEnd() const { return fEnd; } - void SetEnd(hsScalar end) { fEnd = end; } + virtual float GetEnd() const { return fEnd; } + void SetEnd(float end) { fEnd = end; } /** Returns true if any applicator on the arg anim tries to use the @@ -199,8 +199,8 @@ protected: ApplicatorVec fApps; /// our animation channels float fBlend; /// requested blend factor - hsScalar fStart; /// the start time of the beginning of the animation (usually 0) - hsScalar fEnd; /// the end time of the animation + float fStart; /// the start time of the beginning of the animation (usually 0) + float fEnd; /// the end time of the animation char *fName; /// the name of our animation @@ -238,8 +238,8 @@ public: Animations are not required to start at their actual beginning but can, for instance, start in the middle, play to the end, and then loop to the beginning or to their loop start point. */ - virtual hsScalar GetInitial() const { return fInitial; } - void SetInitial(hsScalar initial) { fInitial = initial; } + virtual float GetInitial() const { return fInitial; } + void SetInitial(float initial) { fInitial = initial; } /** Does this animation start automatically when it's applied? */ virtual bool GetAutoStart() const { return fAutoStart; } @@ -247,13 +247,13 @@ public: /** If the animation loops, this is where it will restart the loop. Note that loops do not have to start at the beginning of the animation. */ - virtual hsScalar GetLoopStart() const { return fLoopStart; } - void SetLoopStart(hsScalar start) { fLoopStart = start; } + virtual float GetLoopStart() const { return fLoopStart; } + void SetLoopStart(float start) { fLoopStart = start; } /** If the animation loops, this is the end point of the loop. After passing this point, the animation will cycle around to GetLoopStart */ - virtual hsScalar GetLoopEnd() const { return fLoopEnd; } - void SetLoopEnd(hsScalar end) { fLoopEnd = end; } + virtual float GetLoopEnd() const { return fLoopEnd; } + void SetLoopEnd(float end) { fLoopEnd = end; } /** Does this animation loop?. Note that there may be multiple loop segments defined within a given animation. */ @@ -264,43 +264,43 @@ public: to make an animation slow down gradually when you stop it. The types are defined in plAnimEaseTypes.h */ - virtual UInt8 GetEaseInType() const { return fEaseInType; } - void SetEaseInType(UInt8 type) { fEaseInType = type; } + virtual uint8_t GetEaseInType() const { return fEaseInType; } + void SetEaseInType(uint8_t type) { fEaseInType = type; } /** Set the length of time the ease-in should take. */ - virtual hsScalar GetEaseInLength() const { return fEaseInLength; } + virtual float GetEaseInLength() const { return fEaseInLength; } /** Set the length of time the ease-in should take. */ - void SetEaseInLength(hsScalar length) { fEaseInLength = length; } + void SetEaseInLength(float length) { fEaseInLength = length; } /** The minimum value used at the start of the ease in. */ - virtual hsScalar GetEaseInMin() const { return fEaseInMin; } + virtual float GetEaseInMin() const { return fEaseInMin; } /** The minimum value used at the start of the ease in. */ - void SetEaseInMin(hsScalar length) { fEaseInMin = length; } + void SetEaseInMin(float length) { fEaseInMin = length; } /** The maximum value reached at the end of the ease in. */ - virtual hsScalar GetEaseInMax() const { return fEaseInMax; } + virtual float GetEaseInMax() const { return fEaseInMax; } /** The maximum value reached at the end of the ease in. */ - void SetEaseInMax(hsScalar length) { fEaseInMax = length; } + void SetEaseInMax(float length) { fEaseInMax = length; } /** The curve type for the ease out. */ - virtual UInt8 GetEaseOutType() const { return fEaseOutType; } + virtual uint8_t GetEaseOutType() const { return fEaseOutType; } /** The curve type for the ease out. */ - void SetEaseOutType(UInt8 type) { fEaseOutType = type; } + void SetEaseOutType(uint8_t type) { fEaseOutType = type; } /** The length of time for the ease out. */ - virtual hsScalar GetEaseOutLength() const { return fEaseOutLength; } + virtual float GetEaseOutLength() const { return fEaseOutLength; } /** The length of time for the ease out. */ - void SetEaseOutLength(hsScalar length) { fEaseOutLength = length; } + void SetEaseOutLength(float length) { fEaseOutLength = length; } /** Minimum value reached in ease-out */ - virtual hsScalar GetEaseOutMin() const { return fEaseOutMin; } + virtual float GetEaseOutMin() const { return fEaseOutMin; } /** Minimum value reached in ease-out */ - void SetEaseOutMin(hsScalar length) { fEaseOutMin = length; } + void SetEaseOutMin(float length) { fEaseOutMin = length; } /** Maximum value reached in ease-in */ - virtual hsScalar GetEaseOutMax() const { return fEaseOutMax; } + virtual float GetEaseOutMax() const { return fEaseOutMax; } /** Maximum value reached in ease-in */ - void SetEaseOutMax(hsScalar length) { fEaseOutMax = length; } + void SetEaseOutMax(float length) { fEaseOutMax = length; } /** Animations can have multiple defined loop segments; these are selected using animation control messages. @@ -311,9 +311,9 @@ public: \param end will hold the end time of the loop */ bool GetLoop(const char *name, float &start, float &end) const; /** Lets you get a loop by index instead of name. */ - bool GetLoop(UInt32 num, float &start, float &end) const; + bool GetLoop(uint32_t num, float &start, float &end) const; /** Returns the number of loops defined on this anim. */ - UInt32 GetNumLoops() const; + uint32_t GetNumLoops() const; /** Add a marker to the animation. Markers can be used for callbacks or for goto comands. A marker is a simple @@ -327,12 +327,12 @@ public: near a stop point and fading out, the stop point will override the fade, so that the animation stops precisely at the defined time. */ - void AddStopPoint(hsScalar time); + void AddStopPoint(float time); /** Return the number of stop points defined for this animation. */ - UInt32 NumStopPoints(); + uint32_t NumStopPoints(); /** Get the time corresponding to the given stop point. Stop points are numbered in the order they were added. */ - hsScalar GetStopPoint(UInt32 i); + float GetStopPoint(uint32_t i); /** Function to check for a zero-length loop, and set it to the anim's start/end instead */ void CheckLoop(); @@ -347,20 +347,20 @@ public: virtual void Write(hsStream* stream, hsResMgr* mgr); protected: - hsScalar fInitial; /// the position of the playback head + float fInitial; /// the position of the playback head bool fAutoStart; /// does the animation start automatically? - hsScalar fLoopStart; /// when wrapping a loop, start here - hsScalar fLoopEnd; /// when you reach this point, loop back + float fLoopStart; /// when wrapping a loop, start here + float fLoopEnd; /// when you reach this point, loop back bool fLoop; /// do we loop? - UInt8 fEaseInType; /// the type (none/linear/spline) of our ease-in curve, if any - UInt8 fEaseOutType; /// the type (none/linear/spline) of our ease-out curve, if any - hsScalar fEaseInLength; /// the length of time our ease-in curve takes - hsScalar fEaseInMin; /// minimum (initial) value of our ease-in - hsScalar fEaseInMax; /// maximum (final) value of our ease-in - hsScalar fEaseOutLength; /// the length of time our ease-out curve takes - hsScalar fEaseOutMin; /// minimum (final) value of our ease-out - hsScalar fEaseOutMax; /// maximum (initial) value of our ease-out + uint8_t fEaseInType; /// the type (none/linear/spline) of our ease-in curve, if any + uint8_t fEaseOutType; /// the type (none/linear/spline) of our ease-out curve, if any + float fEaseInLength; /// the length of time our ease-in curve takes + float fEaseInMin; /// minimum (initial) value of our ease-in + float fEaseInMax; /// maximum (final) value of our ease-in + float fEaseOutLength; /// the length of time our ease-out curve takes + float fEaseOutMin; /// minimum (final) value of our ease-out + float fEaseOutMax; /// maximum (initial) value of our ease-out // a map from segment names to times typedef std::map MarkerMap; @@ -369,7 +369,7 @@ protected: typedef std::map, stringSorter> LoopMap; LoopMap fLoops; - typedef std::vector ScalarMap; + typedef std::vector ScalarMap; ScalarMap fStopPoints; /// vector of stop points }; @@ -387,8 +387,8 @@ public: plEmoteAnim(const char *animName, double begin, double end, float fadeIn, float fadeOut, BodyUsage bodyUsage); BodyUsage GetBodyUsage() const; - hsScalar GetFadeIn() const; - hsScalar GetFadeOut() const; + float GetFadeIn() const; + float GetFadeOut() const; CLASSNAME_REGISTER( plEmoteAnim ); GETINTERFACE_ANY( plEmoteAnim, plATCAnim ); @@ -398,8 +398,8 @@ public: protected: BodyUsage fBodyUsage; // how much of the body is used by this emote? - hsScalar fFadeIn; // how fast to fade in the emote - hsScalar fFadeOut; // how fast to fade out the emote + float fFadeIn; // how fast to fade in the emote + float fFadeOut; // how fast to fade out the emote }; ////////////////// diff --git a/Sources/Plasma/PubUtilLib/plAvatar/plAGAnimInstance.cpp b/Sources/Plasma/PubUtilLib/plAvatar/plAGAnimInstance.cpp index f5111027..2ebd587e 100644 --- a/Sources/Plasma/PubUtilLib/plAvatar/plAGAnimInstance.cpp +++ b/Sources/Plasma/PubUtilLib/plAvatar/plAGAnimInstance.cpp @@ -91,7 +91,7 @@ extern const char *gGlobalChannelName = nil; // ctor ------------------------------------------------------------------- // ----- plAGAnimInstance::plAGAnimInstance(plAGAnim * anim, plAGMasterMod * master, - hsScalar blend, UInt16 blendPriority, hsBool cache, + float blend, uint16_t blendPriority, hsBool cache, bool useAmplitude) : fAnimation(anim), fMaster(master), @@ -108,13 +108,13 @@ plAGAnimInstance::plAGAnimInstance(plAGAnim * anim, plAGMasterMod * master, plATCAnim *atcAnim = plATCAnim::ConvertNoRef(anim); if (atcAnim) { - fTimeConvert = TRACKED_NEW plAnimTimeConvert(); + fTimeConvert = new plAnimTimeConvert(); fTimeConvert->Init(atcAnim, this, master); - timeChan = TRACKED_NEW plATCChannel(fTimeConvert); + timeChan = new plATCChannel(fTimeConvert); } else { - timeChan = TRACKED_NEW plScalarSDLChannel(anim->GetLength()); + timeChan = new plScalarSDLChannel(anim->GetLength()); fSDLChannels.push_back((plScalarSDLChannel *)timeChan); } @@ -214,7 +214,7 @@ void plAGAnimInstance::IRegisterDetach(const char *channelName, plAGChannel *cha // SetCurrentTime --------------------------------------------------------------- // --------------- -void plAGAnimInstance::SetCurrentTime(hsScalar localT, hsBool jump /* = false */) +void plAGAnimInstance::SetCurrentTime(float localT, hsBool jump /* = false */) { if (fTimeConvert) fTimeConvert->SetCurrentAnimTime(localT, jump); @@ -222,11 +222,11 @@ void plAGAnimInstance::SetCurrentTime(hsScalar localT, hsBool jump /* = false */ // SeekRelative ------------------------------------ // ------------- -void plAGAnimInstance::SeekRelative (hsScalar delta, hsBool jump) +void plAGAnimInstance::SeekRelative (float delta, hsBool jump) { if(fTimeConvert) { - hsScalar now = fTimeConvert->CurrentAnimTime(); + float now = fTimeConvert->CurrentAnimTime(); fTimeConvert->SetCurrentAnimTime (now + delta, jump); } } @@ -281,7 +281,7 @@ void plAGAnimInstance::DetachChannels() // SetBlend --------------------------------------- // --------- -hsScalar plAGAnimInstance::SetBlend(hsScalar blend) +float plAGAnimInstance::SetBlend(float blend) { float oldBlend = fBlend.Value(0.0, true); if(oldBlend != blend && @@ -298,14 +298,14 @@ hsScalar plAGAnimInstance::SetBlend(hsScalar blend) // GetBlend ------------------------- // --------- -hsScalar plAGAnimInstance::GetBlend() +float plAGAnimInstance::GetBlend() { return fBlend.Value(0); } // SetAmplitude ------------------------------------- // ------------- -hsScalar plAGAnimInstance::SetAmplitude(hsScalar amp) +float plAGAnimInstance::SetAmplitude(float amp) { if(fAmplitude.Get() != -1.0f) { @@ -316,7 +316,7 @@ hsScalar plAGAnimInstance::SetAmplitude(hsScalar amp) // GetAmplitude ------------------------- // ------------- -hsScalar plAGAnimInstance::GetAmplitude() +float plAGAnimInstance::GetAmplitude() { return fAmplitude.Value(0); } @@ -404,7 +404,7 @@ void plAGAnimInstance::AttachCallbacks(plOneShotCallbacks *callbacks) { plOneShotCallbacks::plOneShotCallback& cb = callbacks->GetCallback(i); - plEventCallbackMsg *eventMsg = TRACKED_NEW plEventCallbackMsg; + plEventCallbackMsg *eventMsg = new plEventCallbackMsg; eventMsg->AddReceiver(cb.fReceiver); eventMsg->fRepeats = 0; eventMsg->fUser = cb.fUser; @@ -431,10 +431,10 @@ void plAGAnimInstance::AttachCallbacks(plOneShotCallbacks *callbacks) // ProcessFade ------------------------------------- // ------------ -void plAGAnimInstance::ProcessFade(hsScalar elapsed) +void plAGAnimInstance::ProcessFade(float elapsed) { if (fFadeBlend) { - hsScalar newBlend = ICalcFade(fFadeBlend, GetBlend(), fFadeBlendGoal, fFadeBlendRate, elapsed); + float newBlend = ICalcFade(fFadeBlend, GetBlend(), fFadeBlendGoal, fFadeBlendRate, elapsed); SetBlend(newBlend); if(fFadeDetach && (newBlend == fFadeBlendGoal) && (fFadeBlendGoal == 0.0f) ) { @@ -444,19 +444,19 @@ void plAGAnimInstance::ProcessFade(hsScalar elapsed) } if (fFadeAmp && fAmplitude.Get() != -1.0f) { - hsScalar curAmp = GetAmplitude(); - hsScalar newAmp = ICalcFade(fFadeAmp, curAmp, fFadeAmpGoal, fFadeAmpRate, elapsed); + float curAmp = GetAmplitude(); + float newAmp = ICalcFade(fFadeAmp, curAmp, fFadeAmpGoal, fFadeAmpRate, elapsed); SetAmplitude(newAmp); } } // ICalcFade --------------------------------------------------------------------- // ---------- -hsScalar plAGAnimInstance::ICalcFade(hsBool &fade, hsScalar curVal, hsScalar goal, - hsScalar rate, hsScalar elapsed) +float plAGAnimInstance::ICalcFade(hsBool &fade, float curVal, float goal, + float rate, float elapsed) { - hsScalar newVal; - hsScalar curStep = rate * elapsed; + float newVal; + float curStep = rate * elapsed; if(rate > 0) { newVal = std::min(goal, curVal + curStep); } else { @@ -473,21 +473,21 @@ hsScalar plAGAnimInstance::ICalcFade(hsBool &fade, hsScalar curVal, hsScalar goa // FadeAndDetach ------------------------------------------------- // -------------- -void plAGAnimInstance::FadeAndDetach(hsScalar goal, hsScalar rate) +void plAGAnimInstance::FadeAndDetach(float goal, float rate) { ISetupFade(goal, rate, true, kFadeBlend); } // Fade -------------------------------------------------------------------------------- // ----- -void plAGAnimInstance::Fade(hsScalar goal, hsScalar rate, UInt8 type /* = kFadeBlend */) +void plAGAnimInstance::Fade(float goal, float rate, uint8_t type /* = kFadeBlend */) { ISetupFade(goal, rate, false, type); } // ISetupFade -------------------------------------------------------------------------- // ----------- -void plAGAnimInstance::ISetupFade(hsScalar goal, hsScalar rate, bool detach, UInt8 type) +void plAGAnimInstance::ISetupFade(float goal, float rate, bool detach, uint8_t type) { if (rate == 0) { @@ -509,7 +509,7 @@ void plAGAnimInstance::ISetupFade(hsScalar goal, hsScalar rate, bool detach, UIn rate = (rate > 0 ? rate : -rate); // For old code that sends negative values - hsScalar curVal = 0; + float curVal = 0; switch (type) { case kFadeBlend: @@ -542,7 +542,7 @@ void plAGAnimInstance::ISetupFade(hsScalar goal, hsScalar rate, bool detach, UIn class agAlloc { public: - agAlloc(plAGChannel *object, const char *chanName, const char *animName, UInt16 classIndex) + agAlloc(plAGChannel *object, const char *chanName, const char *animName, uint16_t classIndex) : fObject(object), fClassIndex(classIndex) { @@ -559,15 +559,15 @@ public: plAGChannel *fObject; char *fChannelName; char *fAnimName; - UInt16 fClassIndex; + uint16_t fClassIndex; }; typedef std::map agAllocMap; static agAllocMap gAGAllocs; -void RegisterAGAlloc(plAGChannel *object, const char *chanName, const char *animName, UInt16 classIndex) +void RegisterAGAlloc(plAGChannel *object, const char *chanName, const char *animName, uint16_t classIndex) { - gAGAllocs[object] = TRACKED_NEW agAlloc(object, chanName, animName, classIndex); + gAGAllocs[object] = new agAlloc(object, chanName, animName, classIndex); } void DumpAGAllocs() @@ -581,7 +581,7 @@ void DumpAGAllocs() { agAlloc * al = (*i).second; - UInt16 realClassIndex = al->fObject->ClassIndex(); + uint16_t realClassIndex = al->fObject->ClassIndex(); hsStatusMessageF("agAlloc: an: %s ch: %s, cl: %s", al->fAnimName, al->fChannelName, plFactory::GetNameOfClass(realClassIndex)); diff --git a/Sources/Plasma/PubUtilLib/plAvatar/plAGAnimInstance.h b/Sources/Plasma/PubUtilLib/plAvatar/plAGAnimInstance.h index 109df904..7c2ffd2d 100644 --- a/Sources/Plasma/PubUtilLib/plAvatar/plAGAnimInstance.h +++ b/Sources/Plasma/PubUtilLib/plAvatar/plAGAnimInstance.h @@ -98,7 +98,7 @@ public: This attaches the animation channels to the channels of the master modifier and creates all the bookkeeping structures necessary to undo it later. */ - plAGAnimInstance(plAGAnim * anim, plAGMasterMod * master, hsScalar blend, UInt16 blendPriority, hsBool cache, bool useAmplitude); + plAGAnimInstance(plAGAnim * anim, plAGMasterMod * master, float blend, uint16_t blendPriority, hsBool cache, bool useAmplitude); /** Destructor. Removes the animation from the scene objects it's attached to. */ virtual ~plAGAnimInstance(); @@ -112,7 +112,7 @@ public: /** Set the speed of the animation. This is expressed as a fraction of the speed with which the animation was defined. */ - void SetSpeed(hsScalar speed) { if (fTimeConvert) fTimeConvert->SetSpeed(speed); }; + void SetSpeed(float speed) { if (fTimeConvert) fTimeConvert->SetSpeed(speed); }; // \{ /** @@ -126,8 +126,8 @@ public: yet been seen to have any practical utility whatsoever. Note that even if an animation has a blend strength of 1.0, it may have another animation on top/downstream from it that is masking it completely. */ - hsScalar SetBlend(hsScalar blend); - hsScalar GetBlend(); + float SetBlend(float blend); + float GetBlend(); // \} /** Set the strength of the animation with respect to its 0th frame. @@ -135,9 +135,9 @@ public: Animations must be designed to use this: frame 0 of the animation must be a reasonable "default pose" as it will be blended with the current frame of the animation to produce the result. */ - hsScalar SetAmplitude(hsScalar amp); + float SetAmplitude(float amp); /** Get the current strength of the animation. */ - hsScalar GetAmplitude(); + float GetAmplitude(); /** Make this animation loop (or not.) Note that the instance can loop or not without regard to whether the plAGAnim it is based on loops. */ @@ -159,20 +159,20 @@ public: Note that this time is in animation local time, not global time. The "jump" parameter specifies whether or not to fire callbacks that occur between the current time and the target time. */ - void SetCurrentTime(hsScalar newLocalTime, hsBool jump = false); + void SetCurrentTime(float newLocalTime, hsBool jump = false); /** Move the playback head by the specified relative amount within the animation. This may cause looping. If the beginning or end of the animation is reached an looping is not on, the movement will pin. \param jump if true, don't look for callbacks between old time and TRACKED_NEW */ - void SeekRelative(hsScalar delta, hsBool jump); + void SeekRelative(float delta, hsBool jump); /** Gradually fade the blend strength or amplitude of the animation. \param goal is the desired blend strength \param rate is in blend units per second \type is either kFadeBlend or kFadeAmp */ - void Fade(hsScalar goal, hsScalar rate, UInt8 type = kFadeBlend); + void Fade(float goal, float rate, uint8_t type = kFadeBlend); /** Fade the animation and detach it after the fade is complete. Extremely useful for situations where the controlling logic @@ -180,7 +180,7 @@ public: out gradually. \deprecated */ - void FadeAndDetach(hsScalar goal, hsScalar rate); + void FadeAndDetach(float goal, float rate); /** Has the animation terminated of natural causes? Primarily used to see if an animation has played all the @@ -218,11 +218,11 @@ public: in the animation and will be sent when playback passes that time. */ void AttachCallbacks(plOneShotCallbacks *callbacks); - void ProcessFade(hsScalar elapsed); // process any outstanding fades + void ProcessFade(float elapsed); // process any outstanding fades void SearchForGlobals(); // Util function to setup SDL channels protected: /** Set up bookkeeping for a fade. */ - void ISetupFade(hsScalar goal, hsScalar rate, bool detach, UInt8 type); + void ISetupFade(float goal, float rate, bool detach, uint8_t type); void IRegisterDetach(const char *channelName, plAGChannel *channel); @@ -244,15 +244,15 @@ protected: plAnimTimeConvert *fTimeConvert; hsBool fFadeBlend; /// we are fading the blend - hsScalar fFadeBlendGoal; /// what blend level we're trying to reach - hsScalar fFadeBlendRate; /// how fast are we fading in blend units per second (1 blend unit = full) + float fFadeBlendGoal; /// what blend level we're trying to reach + float fFadeBlendRate; /// how fast are we fading in blend units per second (1 blend unit = full) hsBool fFadeDetach; /// detach after fade is finished? (only used for blend fades) hsBool fFadeAmp; /// we are fading the amplitude - hsScalar fFadeAmpGoal; /// amplitude we're trying to reach - hsScalar fFadeAmpRate; /// how faster we're fading in blend units per second + float fFadeAmpGoal; /// amplitude we're trying to reach + float fFadeAmpRate; /// how faster we're fading in blend units per second - hsScalar ICalcFade(hsBool &fade, hsScalar curVal, hsScalar goal, hsScalar rate, hsScalar elapsed); + float ICalcFade(hsBool &fade, float curVal, float goal, float rate, float elapsed); }; @@ -264,7 +264,7 @@ protected: extern const char *gGlobalAnimName; extern const char *gGlobalChannelName; -void RegisterAGAlloc(plAGChannel *object, const char *chanName, const char *animName, UInt16 classIndex); +void RegisterAGAlloc(plAGChannel *object, const char *chanName, const char *animName, uint16_t classIndex); void UnRegisterAGAlloc(plAGChannel *object); void DumpAGAllocs(); diff --git a/Sources/Plasma/PubUtilLib/plAvatar/plAGApplicator.cpp b/Sources/Plasma/PubUtilLib/plAvatar/plAGApplicator.cpp index 3260cca8..01e4eb0c 100644 --- a/Sources/Plasma/PubUtilLib/plAvatar/plAGApplicator.cpp +++ b/Sources/Plasma/PubUtilLib/plAvatar/plAGApplicator.cpp @@ -42,7 +42,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "plAGApplicator.h" #include "plAGModifier.h" #include "hsResMgr.h" -#include "hsUtils.h" + // ctor -------- // ----- @@ -117,8 +117,8 @@ plAGApplicator *plAGApplicator::CloneWithChannel(plAGChannel *channel) hsBool plAGApplicator::CanBlend(plAGApplicator *app) { - UInt16 ourClass = ClassIndex(); - UInt16 theirClass = app->ClassIndex(); + uint16_t ourClass = ClassIndex(); + uint16_t theirClass = app->ClassIndex(); return(ourClass == theirClass); @@ -175,7 +175,7 @@ plSimulationInterface * plAGApplicator::IGetSI(const plAGModifier * modifier) co return modifier->LeakSI(); } -plObjInterface * plAGApplicator::IGetGI(const plAGModifier * modifier, UInt16 classIdx) const +plObjInterface * plAGApplicator::IGetGI(const plAGModifier * modifier, uint16_t classIdx) const { return modifier->LeakGI(classIdx); } diff --git a/Sources/Plasma/PubUtilLib/plAvatar/plAGApplicator.h b/Sources/Plasma/PubUtilLib/plAvatar/plAGApplicator.h index 31cd43d6..cd346c5d 100644 --- a/Sources/Plasma/PubUtilLib/plAvatar/plAGApplicator.h +++ b/Sources/Plasma/PubUtilLib/plAvatar/plAGApplicator.h @@ -159,7 +159,7 @@ protected: plCoordinateInterface * IGetCI(const plAGModifier *modifier) const; plDrawInterface * IGetDI(const plAGModifier *modifier) const; plSimulationInterface * IGetSI(const plAGModifier *modifier) const; - plObjInterface * IGetGI(const plAGModifier *modifier, UInt16 classIdx) const; + plObjInterface * IGetGI(const plAGModifier *modifier, uint16_t classIdx) const; // Allow plAGModifier to declare IGet?? as friends friend class plAGModifier; diff --git a/Sources/Plasma/PubUtilLib/plAvatar/plAGChannel.cpp b/Sources/Plasma/PubUtilLib/plAvatar/plAGChannel.cpp index 140fcd07..ef369a75 100644 --- a/Sources/Plasma/PubUtilLib/plAvatar/plAGChannel.cpp +++ b/Sources/Plasma/PubUtilLib/plAvatar/plAGChannel.cpp @@ -46,7 +46,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "plAGModifier.h" // global -#include "hsTypes.h" +#include "HeadSpin.h" #include "hsResMgr.h" #include "plAGAnimInstance.h" diff --git a/Sources/Plasma/PubUtilLib/plAvatar/plAGMasterMod.cpp b/Sources/Plasma/PubUtilLib/plAvatar/plAGMasterMod.cpp index b1148b8a..8101dfac 100644 --- a/Sources/Plasma/PubUtilLib/plAvatar/plAGMasterMod.cpp +++ b/Sources/Plasma/PubUtilLib/plAvatar/plAGMasterMod.cpp @@ -112,7 +112,7 @@ void plAGMasterMod::Read(hsStream * stream, hsResMgr *mgr) ////////////////////////////////////////// int nameLength = stream->ReadLE32(); // Unused. Nuke next format change. - char *junk = TRACKED_NEW char[nameLength+1]; // + char *junk = new char[nameLength+1]; // stream->Read(nameLength, junk); // junk[nameLength] = 0; // delete [] junk; // @@ -123,14 +123,14 @@ void plAGMasterMod::Read(hsStream * stream, hsResMgr *mgr) int i; for (i = 0; i < numPrivateAnims; i++) { - plGenRefMsg* msg = TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnCreate, 0, kPrivateAnim); + plGenRefMsg* msg = new plGenRefMsg(GetKey(), plRefMsg::kOnCreate, 0, kPrivateAnim); mgr->ReadKeyNotifyMe(stream, msg, plRefFlags::kActiveRef); } fIsGrouped = stream->Readbool(); fIsGroupMaster = stream->Readbool(); if (fIsGroupMaster) { - plGenRefMsg* msg = TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnCreate, 0, 0); + plGenRefMsg* msg = new plGenRefMsg(GetKey(), plRefMsg::kOnCreate, 0, 0); mgr->ReadKeyNotifyMe(stream, msg, plRefFlags::kActiveRef); } @@ -183,7 +183,7 @@ void plAGMasterMod::AddTarget(plSceneObject * object) { // add sdl modifier delete fAGMasterSDLMod; - fAGMasterSDLMod = TRACKED_NEW plAGMasterSDLModifier; + fAGMasterSDLMod = new plAGMasterSDLModifier; object->AddModifier(fAGMasterSDLMod); } } @@ -218,7 +218,7 @@ plProfile_CreateTimer("AnimatingPhysicals", "Animation", AnimatingPhysicals); plProfile_CreateTimer("StoppedAnimPhysicals", "Animation", StoppedAnimPhysicals); // IEVAL -hsBool plAGMasterMod::IEval(double secs, hsScalar del, UInt32 dirty) +hsBool plAGMasterMod::IEval(double secs, float del, uint32_t dirty) { if (fFirstEval) { @@ -239,7 +239,7 @@ hsBool plAGMasterMod::IEval(double secs, hsScalar del, UInt32 dirty) } // APPLYANIMATIONS -void plAGMasterMod::ApplyAnimations(double time, hsScalar elapsed) +void plAGMasterMod::ApplyAnimations(double time, float elapsed) { plProfile_BeginLap(ApplyAnimation, this->GetKey()->GetUoid().GetObjectName().c_str()); @@ -347,7 +347,7 @@ plAGModifier * plAGMasterMod::GetChannelMod(const char * name, hsBool dontCache // CACHECHANNELMOD plAGModifier * plAGMasterMod::ICacheChannelMod(plAGModifier *mod) const { - plGenRefMsg* msg = TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnCreate, 0, 0); + plGenRefMsg* msg = new plGenRefMsg(GetKey(), plRefMsg::kOnCreate, 0, 0); hsgResMgr::ResMgr()->SendRef(mod, msg, plRefFlags::kActiveRef); return mod; @@ -387,8 +387,8 @@ plAGModifier * plAGMasterMod::IFindChannelMod(const plSceneObject *SO, const cha // ATTACHANIMATIONBLENDED(anim, blend) plAGAnimInstance * plAGMasterMod::AttachAnimationBlended(plAGAnim *anim, - hsScalar blendFactor /* = 0 */, - UInt16 blendPriority /* plAGMedBlendPriority */, + float blendFactor /* = 0 */, + uint16_t blendPriority /* plAGMedBlendPriority */, hsBool cache /* = false */) { plAGAnimInstance *instance = nil; @@ -403,10 +403,10 @@ plAGAnimInstance * plAGMasterMod::AttachAnimationBlended(plAGAnim *anim, } if (i == fPrivateAnims.end()) // Didn't find it. Ref it! { - plGenRefMsg* msg = TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnCreate, 0, kPublicAnim); + plGenRefMsg* msg = new plGenRefMsg(GetKey(), plRefMsg::kOnCreate, 0, kPublicAnim); hsgResMgr::ResMgr()->SendRef(anim, msg, plRefFlags::kActiveRef); } - instance = TRACKED_NEW plAGAnimInstance(anim, this, blendFactor, blendPriority, cache, false); + instance = new plAGAnimInstance(anim, this, blendFactor, blendPriority, cache, false); fAnimInstances.push_back(instance); plATCAnim *atcAnim = plATCAnim::ConvertNoRef(anim); @@ -421,7 +421,7 @@ plAGAnimInstance * plAGMasterMod::AttachAnimationBlended(plAGAnim *anim, } // ATTACHANIMATIONBLENDED(name, blend) -plAGAnimInstance * plAGMasterMod::AttachAnimationBlended(const char *name, hsScalar blendFactor /* = 0 */, UInt16 blendPriority, hsBool cache /* = false */) +plAGAnimInstance * plAGMasterMod::AttachAnimationBlended(const char *name, float blendFactor /* = 0 */, uint16_t blendPriority, hsBool cache /* = false */) { plAGAnimInstance *instance = nil; plAGAnim *anim = plAGAnim::FindAnim(name); @@ -442,7 +442,7 @@ void plAGMasterMod::PlaySimpleAnim(const char *name) if (FindAnimInstance(name)) return; - instance = AttachAnimationBlended(anim, 1.f, (UInt16)kAGMaxBlendPriority, false); + instance = AttachAnimationBlended(anim, 1.f, (uint16_t)kAGMaxBlendPriority, false); } if (instance) @@ -450,7 +450,7 @@ void plAGMasterMod::PlaySimpleAnim(const char *name) instance->SetLoop(false); instance->Start(); - plAGDetachCallbackMsg *msg = TRACKED_NEW plAGDetachCallbackMsg(GetKey(), kStop); + plAGDetachCallbackMsg *msg = new plAGDetachCallbackMsg(GetKey(), kStop); msg->SetAnimName(name); instance->GetTimeConvert()->AddCallback(msg); hsRefCnt_SafeUnRef(msg); @@ -482,7 +482,7 @@ plAGAnimInstance * plAGMasterMod::FindAnimInstance(const char *name) } // FINDORATTACHINSTANCE -plAGAnimInstance * plAGMasterMod::FindOrAttachInstance(const char *name, hsScalar blendFactor) +plAGAnimInstance * plAGMasterMod::FindOrAttachInstance(const char *name, float blendFactor) { plAGAnimInstance *result = FindAnimInstance(name); if(result) @@ -798,7 +798,7 @@ hsBool plAGMasterMod::HasRunningAnims() // // Send SDL sendState msg to object's plAGMasterSDLModifier // -hsBool plAGMasterMod::DirtySynchState(const char* SDLStateName, UInt32 synchFlags) +hsBool plAGMasterMod::DirtySynchState(const char* SDLStateName, uint32_t synchFlags) { if(GetNumTargets() > 0 && (!fIsGrouped || fIsGroupMaster)) { diff --git a/Sources/Plasma/PubUtilLib/plAvatar/plAGMasterMod.h b/Sources/Plasma/PubUtilLib/plAvatar/plAGMasterMod.h index b3e9506d..2ee35d87 100644 --- a/Sources/Plasma/PubUtilLib/plAvatar/plAGMasterMod.h +++ b/Sources/Plasma/PubUtilLib/plAvatar/plAGMasterMod.h @@ -106,14 +106,14 @@ public: /** Attach the given animation object with the given blend factor. If there's no animation already attached to blend with, the animation will be attached at full strength. */ - plAGAnimInstance *AttachAnimationBlended(plAGAnim *anim, hsScalar blendFactor = 0, - UInt16 blendPriority = kAGMedBlendPriority, + plAGAnimInstance *AttachAnimationBlended(plAGAnim *anim, float blendFactor = 0, + uint16_t blendPriority = kAGMedBlendPriority, hsBool cache = false); /** Look up the given animation by name and attach it with the given blend factor. */ - plAGAnimInstance *AttachAnimationBlended(const char *name, hsScalar blendFactor = 0, - UInt16 blendPriority = kAGMedBlendPriority, + plAGAnimInstance *AttachAnimationBlended(const char *name, float blendFactor = 0, + uint16_t blendPriority = kAGMedBlendPriority, hsBool cache = false); /** Play a simple anim (one that doesn't affect root) once and auto detach. @@ -152,7 +152,7 @@ public: attached, it could be anywhere, including buried under a bunch of other animations. If it's important that it be on top of the stack, you may need to detach it first. */ - plAGAnimInstance *FindOrAttachInstance(const char *name, hsScalar blendFactor); + plAGAnimInstance *FindOrAttachInstance(const char *name, float blendFactor); /** Return the number of animations available. */ int GetNumAnimations(); @@ -168,7 +168,7 @@ public: /** Apply all our animations to all our parts. \param timeNow is the current world time \param elapsed is the time since the previous frame */ - void ApplyAnimations(double timeNow, hsScalar elapsed); + void ApplyAnimations(double timeNow, float elapsed); /** Runs through our anims and applies them, without processing fades. This is used when we load in anim @@ -210,7 +210,7 @@ public: virtual void Read(hsStream * stream, hsResMgr *mgr); hsBool HasRunningAnims(); - hsBool DirtySynchState(const char* SDLStateName, UInt32 synchFlags); + hsBool DirtySynchState(const char* SDLStateName, uint32_t synchFlags); CLASSNAME_REGISTER( plAGMasterMod ); GETINTERFACE_ANY( plAGMasterMod, plModifier ); @@ -220,7 +220,7 @@ protected: plAGModifier * ICacheChannelMod(plAGModifier *mod) const; plAGModifier * IFindChannelMod(const plSceneObject *obj, const char *name) const; - virtual hsBool IEval(double secs, hsScalar del, UInt32 dirty); + virtual hsBool IEval(double secs, float del, uint32_t dirty); virtual void IApplyDynamic() {}; // dummy function required by base class diff --git a/Sources/Plasma/PubUtilLib/plAvatar/plAGMasterSDLModifier.cpp b/Sources/Plasma/PubUtilLib/plAvatar/plAGMasterSDLModifier.cpp index 3779e5d3..20de82a9 100644 --- a/Sources/Plasma/PubUtilLib/plAvatar/plAGMasterSDLModifier.cpp +++ b/Sources/Plasma/PubUtilLib/plAvatar/plAGMasterSDLModifier.cpp @@ -54,7 +54,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com char plAGMasterSDLModifier::AGMasterVarNames::kStrAtcs[]="atcs"; char plAGMasterSDLModifier::AGMasterVarNames::kStrBlends[]="blends"; -UInt32 plAGMasterSDLModifier::IApplyModFlags(UInt32 sendFlags) +uint32_t plAGMasterSDLModifier::IApplyModFlags(uint32_t sendFlags) { // ugly hack so bug light animation state isn't stored on the server if (GetTarget()->GetKeyName().Compare("RTOmni-BugLightTest", plString::kCaseInsensitive) == 0) @@ -80,7 +80,7 @@ void plAGMasterSDLModifier::IPutBlends(plStateDataRecord* state, plAGMasterMod* int i; for(i=0;iSet((UInt8)(agMaster->GetAnimInstance(i)->GetBlend() * 255), i); + blendsVar->Set((uint8_t)(agMaster->GetAnimInstance(i)->GetBlend() * 255), i); } } @@ -149,7 +149,7 @@ void plAGMasterSDLModifier::ISetCurrentBlends(const plStateDataRecord* state, pl for (i=0;iGetCount();i++) { - UInt8 blend; + uint8_t blend; blendsVar->Get(&blend, i); objAGMaster->GetAnimInstance(i)->SetBlend(blend / 255.f); } @@ -191,9 +191,9 @@ void plAGMasterSDLModifier::ISetCurrentStateFrom(const plStateDataRecord* srcSta if (objAGMaster->fIsGrouped && objAGMaster->fMsgForwarder) { - hsScalar animTimeFromWorldTime = (objAGMaster->GetNumATCAnimations() > 0) ? objAGMaster->GetATCAnimInstance(0)->GetTimeConvert()->WorldToAnimTimeNoUpdate(time) : 0.0f; + float animTimeFromWorldTime = (objAGMaster->GetNumATCAnimations() > 0) ? objAGMaster->GetATCAnimInstance(0)->GetTimeConvert()->WorldToAnimTimeNoUpdate(time) : 0.0f; - plAGCmdMsg *msg = TRACKED_NEW plAGCmdMsg(); + plAGCmdMsg *msg = new plAGCmdMsg(); msg->SetCmd(plAGCmdMsg::kSetAnimTime); msg->fAnimTime = animTimeFromWorldTime; msg->AddReceiver(objAGMaster->fMsgForwarder->GetKey()); diff --git a/Sources/Plasma/PubUtilLib/plAvatar/plAGMasterSDLModifier.h b/Sources/Plasma/PubUtilLib/plAvatar/plAGMasterSDLModifier.h index 4522195c..a9527ec6 100644 --- a/Sources/Plasma/PubUtilLib/plAvatar/plAGMasterSDLModifier.h +++ b/Sources/Plasma/PubUtilLib/plAvatar/plAGMasterSDLModifier.h @@ -70,7 +70,7 @@ protected: void IPutCurrentStateIn(plStateDataRecord* dstState); void ISetCurrentStateFrom(const plStateDataRecord* srcState); - UInt32 IApplyModFlags(UInt32 sendFlags); + uint32_t IApplyModFlags(uint32_t sendFlags); public: CLASSNAME_REGISTER( plAGMasterSDLModifier); diff --git a/Sources/Plasma/PubUtilLib/plAvatar/plAGModifier.cpp b/Sources/Plasma/PubUtilLib/plAvatar/plAGModifier.cpp index 51418c16..e72e96e2 100644 --- a/Sources/Plasma/PubUtilLib/plAvatar/plAGModifier.cpp +++ b/Sources/Plasma/PubUtilLib/plAvatar/plAGModifier.cpp @@ -133,7 +133,7 @@ void plAGModifier::Apply(double time) const // IEVAL // Apply our channels to our scene object -hsBool plAGModifier::IEval(double time, hsScalar delta, UInt32 dirty) +hsBool plAGModifier::IEval(double time, float delta, uint32_t dirty) { if(fAutoApply) { // Apply(time, delta); diff --git a/Sources/Plasma/PubUtilLib/plAvatar/plAGModifier.h b/Sources/Plasma/PubUtilLib/plAvatar/plAGModifier.h index edc39ff5..703ac05b 100644 --- a/Sources/Plasma/PubUtilLib/plAvatar/plAGModifier.h +++ b/Sources/Plasma/PubUtilLib/plAvatar/plAGModifier.h @@ -47,7 +47,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #ifndef PLAGMODIFIER_H #define PLAGMODIFIER_H -#include "hsTypes.h" // need for plSingleModifier +#include "HeadSpin.h" // need for plSingleModifier #include "pnModifier/plSingleModifier.h" // inherited // local @@ -103,7 +103,7 @@ public: channels attached to it that were intended for "Lamont." */ void SetChannelName(char * name); - /** Attach a TRACKED_NEW applicator to our modifier. Will arbitrate with existing + /** Attach a new applicator to our modifier. Will arbitrate with existing modifiers if necessary, based on pin type. May destruct existing applicators. */ plAGChannel *MergeChannel(plAGApplicator *app, plAGChannel *chan, plScalarChannel *blend, plAGAnimInstance *anim, int priority); @@ -144,7 +144,7 @@ protected: hsBool fEnabled; // if not enabled, we don't eval any of our anims // APPLYING THE ANIMATION - virtual hsBool IEval(double secs, hsScalar del, UInt32 dirty); + virtual hsBool IEval(double secs, float del, uint32_t dirty); virtual hsBool IHandleCmd(plAnimCmdMsg* modMsg) { return false; } // only plAGMasterMod should handle these virtual void IApplyDynamic() {}; // dummy function required by base class @@ -154,13 +154,13 @@ protected: plCoordinateInterface * LeakCI() const { return IGetTargetCoordinateInterface(0); }; plDrawInterface * LeakDI() const { return IGetTargetDrawInterface(0); }; plSimulationInterface * LeakSI() const { return IGetTargetSimulationInterface(0); }; - plObjInterface * LeakGI(UInt32 classIdx) const { return IGetTargetGenericInterface(0, classIdx); } + plObjInterface * LeakGI(uint32_t classIdx) const { return IGetTargetGenericInterface(0, classIdx); } friend plAudioInterface * plAGApplicator::IGetAI(const plAGModifier * modifier) const; friend plCoordinateInterface * plAGApplicator::IGetCI(const plAGModifier * modifier) const; friend plDrawInterface * plAGApplicator::IGetDI(const plAGModifier * modifier) const; friend plSimulationInterface * plAGApplicator::IGetSI(const plAGModifier * modifier) const; - friend plObjInterface * plAGApplicator::IGetGI(const plAGModifier * modifier, UInt16 classIdx) const; + friend plObjInterface * plAGApplicator::IGetGI(const plAGModifier * modifier, uint16_t classIdx) const; }; const plModifier * FindModifierByClass(const plSceneObject *obj, int classID); diff --git a/Sources/Plasma/PubUtilLib/plAvatar/plAnimStage.cpp b/Sources/Plasma/PubUtilLib/plAvatar/plAnimStage.cpp index 1e4032f5..d4408413 100644 --- a/Sources/Plasma/PubUtilLib/plAvatar/plAnimStage.cpp +++ b/Sources/Plasma/PubUtilLib/plAvatar/plAnimStage.cpp @@ -54,7 +54,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "plMultistageBehMod.h" // global -#include "hsUtils.h" + #include "hsStlUtils.h" #include "hsResMgr.h" #include "hsTimer.h" @@ -103,7 +103,7 @@ plAnimStage::plAnimStage() { } -plAnimStage::plAnimStage(const char *animName, UInt8 notify) +plAnimStage::plAnimStage(const char *animName, uint8_t notify) : fNotify(notify), fArmature(nil), fBrain(nil), @@ -132,7 +132,7 @@ plAnimStage::plAnimStage(const char *animName, UInt8 notify) // PLANIMSTAGE canonical ctor plAnimStage::plAnimStage(const char *animName, - UInt8 notify, + uint8_t notify, ForwardType forward, BackType back, AdvanceType advance, @@ -164,7 +164,7 @@ plAnimStage::plAnimStage(const char *animName, } plAnimStage::plAnimStage(const char *animName, - UInt8 notify, + uint8_t notify, ForwardType forward, BackType back, AdvanceType advance, @@ -288,7 +288,7 @@ plAGAnimInstance * plAnimStage::Attach(plArmatureMod *armature, plArmatureBrain } // SENDNOTIFY -hsBool plAnimStage::ISendNotify(UInt32 notifyMask, UInt32 notifyType, plArmatureMod *armature, plArmatureBrain *brain) +hsBool plAnimStage::ISendNotify(uint32_t notifyMask, uint32_t notifyType, plArmatureMod *armature, plArmatureBrain *brain) { // make sure the user has requested this type of notify if(fNotify & notifyMask) @@ -296,7 +296,7 @@ hsBool plAnimStage::ISendNotify(UInt32 notifyMask, UInt32 notifyType, plArmature plKey avKey = armature->GetTarget(0)->GetKey(); if (fMod) avKey = fMod->GetKey(); - plNotifyMsg *msg = TRACKED_NEW plNotifyMsg(); + plNotifyMsg *msg = new plNotifyMsg(); msg->SetSender(avKey); if (fMod) @@ -626,15 +626,15 @@ void plAnimStage::SetRegresstype(RegressType t) } // GETNOTIFYFLAGS -UInt32 plAnimStage::GetNotifyFlags() +uint32_t plAnimStage::GetNotifyFlags() { return fNotify; } // SETNOTIFYFLAGS -void plAnimStage::SetNotifyFlags(UInt32 newFlags) +void plAnimStage::SetNotifyFlags(uint32_t newFlags) { - fNotify = (UInt8)newFlags; + fNotify = (uint8_t)newFlags; } // GETNUMLOOPS diff --git a/Sources/Plasma/PubUtilLib/plAvatar/plAnimStage.h b/Sources/Plasma/PubUtilLib/plAvatar/plAnimStage.h index f9ab1efc..958d763d 100644 --- a/Sources/Plasma/PubUtilLib/plAvatar/plAnimStage.h +++ b/Sources/Plasma/PubUtilLib/plAvatar/plAnimStage.h @@ -159,7 +159,7 @@ public: channel attached to the avatar's handle. */ plAnimStage(const char *animName, - UInt8 notify, + uint8_t notify, ForwardType forward, BackType backward, AdvanceType advance, @@ -173,7 +173,7 @@ public: moving. */ plAnimStage(const char *animName, - UInt8 notify, + uint8_t notify, ForwardType forward, BackType back, AdvanceType advance, @@ -189,7 +189,7 @@ public: \param animName The name of the animation controlled by this stage. \param notify Flags for when to send notify messages */ - plAnimStage(const char *animName, UInt8 notify); + plAnimStage(const char *animName, uint8_t notify); virtual ~plAnimStage(); const plAnimStage& operator=(const plAnimStage& src); @@ -210,8 +210,8 @@ public: void SetAdvanceType(AdvanceType t); RegressType GetRegressType(); void SetRegresstype(RegressType t); - UInt32 GetNotifyFlags(); - void SetNotifyFlags(UInt32 newFlags); + uint32_t GetNotifyFlags(); + void SetNotifyFlags(uint32_t newFlags); int GetNumLoops(); void SetNumLoops(int loops); int GetLoopValue(); @@ -252,16 +252,16 @@ protected: bool ITryAdvance(plArmatureMod *avMod); bool ITryRegress(plArmatureMod *avMod); - hsBool ISendNotify(UInt32 notifyMask, UInt32 notifyType, plArmatureMod *armature, plArmatureBrain *brain); + hsBool ISendNotify(uint32_t notifyMask, uint32_t notifyType, plArmatureMod *armature, plArmatureBrain *brain); char *fAnimName; // the name of our animation - UInt8 fNotify; // flags for which events will cause notification events + uint8_t fNotify; // flags for which events will cause notification events int fLoops; // how many times will this animation loop (after initial playthrough?) bool fDoAdvanceTo; // advance to a specific stage instead of n + 1 - UInt32 fAdvanceTo; // the stage to advance to, provided fDoAdvanceTo is true + uint32_t fAdvanceTo; // the stage to advance to, provided fDoAdvanceTo is true bool fDoRegressTo; // regress to a specific stage instaed of n - 1 - UInt32 fRegressTo; // the stage to regress true, provided fDoRegressTo is true + uint32_t fRegressTo; // the stage to regress true, provided fDoRegressTo is true // --- these are derived & kept for bookkeeping plAGAnimInstance *fAnimInstance; @@ -273,7 +273,7 @@ protected: int fCurLoop; // which loop are we currently in? bool fAttached; // in the middle of reloading bool fAnimatedHandle; // this animation moves the handle - UInt8 fSentNotifies; // which notifies have we sent? + uint8_t fSentNotifies; // which notifies have we sent? bool fReverseOnIdle; // reverse our key interpretation if we stop. this is a special // case for down ladders, for which the forward button means "keep going down" // if you hold it down the whole time, but means "go up" if you press it diff --git a/Sources/Plasma/PubUtilLib/plAvatar/plAntiGravAction.cpp b/Sources/Plasma/PubUtilLib/plAvatar/plAntiGravAction.cpp index 79cdfa7d..d5b4da3c 100644 --- a/Sources/Plasma/PubUtilLib/plAvatar/plAntiGravAction.cpp +++ b/Sources/Plasma/PubUtilLib/plAvatar/plAntiGravAction.cpp @@ -84,9 +84,9 @@ void plAntiGravAction::apply(Havok::Subspace &space, Havok::hkTime time) fAnimPosVel.fZ = vel.fZ; hsVector3 linCurrent(0.f, 0.f, 0.f); - hsScalar angCurrent = 0.f; + float angCurrent = 0.f; if (fCurrentRegion != nil) - fCurrentRegion->GetCurrent(fPhysical, linCurrent, angCurrent, (hsScalar)elapsed); + fCurrentRegion->GetCurrent(fPhysical, linCurrent, angCurrent, (float)elapsed); int numContacts = fPhysical->GetNumContacts(); fHadContacts = (numContacts > 0); @@ -97,7 +97,7 @@ void plAntiGravAction::apply(Havok::Subspace &space, Havok::hkTime time) for (i = 0; i < numContacts; i++) { const Havok::ContactPoint *contact = fPhysical->GetContactPoint(i); - hsScalar dotUp = straightUp.dot(contact->m_normal); + float dotUp = straightUp.dot(contact->m_normal); if (dotUp > .5) { fOnGround = true; @@ -109,7 +109,7 @@ void plAntiGravAction::apply(Havok::Subspace &space, Havok::hkTime time) fPhysical->SetAngularVelocitySim(hsVector3(0.f, 0.f, fAnimAngVel + fTurnStr + angCurrent)); } -void plAntiGravAction::SetSurface(plSwimRegionInterface *region, hsScalar surfaceHeight) +void plAntiGravAction::SetSurface(plSwimRegionInterface *region, float surfaceHeight) { fCurrentRegion = region; if (region != nil) diff --git a/Sources/Plasma/PubUtilLib/plAvatar/plAntiGravAction.h b/Sources/Plasma/PubUtilLib/plAvatar/plAntiGravAction.h index 1f7afc8e..59db9ca1 100644 --- a/Sources/Plasma/PubUtilLib/plAvatar/plAntiGravAction.h +++ b/Sources/Plasma/PubUtilLib/plAvatar/plAntiGravAction.h @@ -59,8 +59,8 @@ public: /** Called by Havok at substep frequency. */ void apply(Havok::Subspace &s, Havok::hkTime time); - void SetSurface(plSwimRegionInterface *region, hsScalar surfaceHeight); - hsScalar GetBuoyancy() { return fBuoyancy; } + void SetSurface(plSwimRegionInterface *region, float surfaceHeight); + float GetBuoyancy() { return fBuoyancy; } hsBool IsOnGround() { return fOnGround; } hsBool HadContacts() { return fHadContacts; } @@ -69,8 +69,8 @@ protected: hsBool fOnGround; hsBool fHadContacts; - hsScalar fBuoyancy; - hsScalar fSurfaceHeight; + float fBuoyancy; + float fSurfaceHeight; plSwimRegionInterface *fCurrentRegion; }; diff --git a/Sources/Plasma/PubUtilLib/plAvatar/plArmatureEffects.cpp b/Sources/Plasma/PubUtilLib/plAvatar/plArmatureEffects.cpp index cbe8451e..9849dda8 100644 --- a/Sources/Plasma/PubUtilLib/plAvatar/plArmatureEffects.cpp +++ b/Sources/Plasma/PubUtilLib/plAvatar/plArmatureEffects.cpp @@ -86,7 +86,7 @@ void plArmatureEffectsMgr::Read(hsStream *s, hsResMgr *mgr) int numEffects = s->ReadLE32(); while (numEffects > 0) { - plRefMsg *msg = TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnCreate, -1, -1); + plRefMsg *msg = new plGenRefMsg(GetKey(), plRefMsg::kOnCreate, -1, -1); hsgResMgr::ResMgr()->ReadKeyNotifyMe(s, msg, plRefFlags::kActiveRef); numEffects--; } @@ -157,12 +157,12 @@ hsBool plArmatureEffectsMgr::MsgReceive(plMessage* msg) return hsKeyedObject::MsgReceive(msg); } -UInt32 plArmatureEffectsMgr::GetNumEffects() +uint32_t plArmatureEffectsMgr::GetNumEffects() { return fEffects.GetCount(); } -plArmatureEffect *plArmatureEffectsMgr::GetEffect(UInt32 num) +plArmatureEffect *plArmatureEffectsMgr::GetEffect(uint32_t num) { return fEffects[num]; } @@ -182,7 +182,7 @@ void plArmatureEffectsMgr::ResetEffects() plArmatureEffectFootSound::plArmatureEffectFootSound() { - plArmatureEffectFootSurface *surface = TRACKED_NEW plArmatureEffectFootSurface; + plArmatureEffectFootSurface *surface = new plArmatureEffectFootSurface; surface->fID = plArmatureEffectsMgr::kFootNoSurface; surface->fTrigger = nil; fSurfaces.Append(surface); @@ -209,14 +209,14 @@ void plArmatureEffectFootSound::Read(hsStream* s, hsResMgr* mgr) int i; for (i = 0; i < count; i++) { - plGenRefMsg *msg = TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnCreate, i, -1); + plGenRefMsg *msg = new plGenRefMsg(GetKey(), plRefMsg::kOnCreate, i, -1); mgr->ReadKeyNotifyMe(s, msg, plRefFlags::kActiveRef); } } -UInt32 plArmatureEffectFootSound::IFindSurfaceByTrigger(plKey trigger) +uint32_t plArmatureEffectFootSound::IFindSurfaceByTrigger(plKey trigger) { - UInt32 i; + uint32_t i; // Skip index 0. It's the special "NoSurface" that should always be at the stack bottom for (i = 1; i < fSurfaces.GetCount(); i++) @@ -265,14 +265,14 @@ hsBool plArmatureEffectFootSound::HandleTrigger(plMessage* msg) plArmatureEffectMsg *eMsg = plArmatureEffectMsg::ConvertNoRef(msg); if (eMsg) { - UInt32 curSurfaceIndex = fSurfaces[fSurfaces.GetCount() - 1]->fID; + uint32_t curSurfaceIndex = fSurfaces[fSurfaces.GetCount() - 1]->fID; if (curSurfaceIndex < plArmatureEffectsMgr::kMaxSurface && fMods[curSurfaceIndex] != nil) { if (plgAudioSys::Active() && fActiveSurfaces.IsBitSet(curSurfaceIndex)) { fMods[curSurfaceIndex]->SetCurrentGroup(eMsg->fTriggerIdx); - plAnimCmdMsg *animMsg = TRACKED_NEW plAnimCmdMsg; + plAnimCmdMsg *animMsg = new plAnimCmdMsg; animMsg->AddReceiver(fMods[curSurfaceIndex]->GetKey()); animMsg->SetCmd(plAnimCmdMsg::kContinue); plgDispatch::MsgSend(animMsg); @@ -294,7 +294,7 @@ hsBool plArmatureEffectFootSound::HandleTrigger(plMessage* msg) { plStatusLog::AddLineS("audio.log", "FTSP: Switching to surface - %s", plArmatureEffectsMgr::SurfaceStrings[sMsg->fSurface]); - plArmatureEffectFootSurface *surface = TRACKED_NEW plArmatureEffectFootSurface; + plArmatureEffectFootSurface *surface = new plArmatureEffectFootSurface; surface->fID = sMsg->fSurface; surface->fTrigger = sMsg->GetSender(); fSurfaces.Append(surface); @@ -302,7 +302,7 @@ hsBool plArmatureEffectFootSound::HandleTrigger(plMessage* msg) } else { - UInt32 index = IFindSurfaceByTrigger(sMsg->GetSender()); + uint32_t index = IFindSurfaceByTrigger(sMsg->GetSender()); if (index != -1) { if (index == fSurfaces.GetCount() - 1) // It's the top on the stack @@ -324,7 +324,7 @@ void plArmatureEffectFootSound::Reset() delete fSurfaces.Pop(); } -void plArmatureEffectFootSound::SetFootType(UInt8 type) +void plArmatureEffectFootSound::SetFootType(uint8_t type) { if (type == kFootTypeBare) { diff --git a/Sources/Plasma/PubUtilLib/plAvatar/plArmatureEffects.h b/Sources/Plasma/PubUtilLib/plAvatar/plArmatureEffects.h index f1eeae5b..37d2bfae 100644 --- a/Sources/Plasma/PubUtilLib/plAvatar/plArmatureEffects.h +++ b/Sources/Plasma/PubUtilLib/plAvatar/plArmatureEffects.h @@ -77,8 +77,8 @@ public: virtual hsBool MsgReceive(plMessage* msg); - UInt32 GetNumEffects(); - plArmatureEffect *GetEffect(UInt32 num); + uint32_t GetNumEffects(); + plArmatureEffect *GetEffect(uint32_t num); void ResetEffects(); plArmatureMod *fArmature; @@ -126,7 +126,7 @@ public: class plArmatureEffectFootSurface { public: - UInt8 fID; + uint8_t fID; plKey fTrigger; }; @@ -137,7 +137,7 @@ protected: hsBitVector fActiveSurfaces; plRandomSoundMod *fMods[plArmatureEffectsMgr::kMaxSurface]; - UInt32 IFindSurfaceByTrigger(plKey trigger); + uint32_t IFindSurfaceByTrigger(plKey trigger); public: plArmatureEffectFootSound(); @@ -152,7 +152,7 @@ public: virtual hsBool MsgReceive(plMessage* msg); virtual hsBool HandleTrigger(plMessage* msg); virtual void Reset(); - void SetFootType(UInt8); + void SetFootType(uint8_t); enum { diff --git a/Sources/Plasma/PubUtilLib/plAvatar/plArmatureMod.cpp b/Sources/Plasma/PubUtilLib/plAvatar/plArmatureMod.cpp index d10d43e4..5b480fd8 100644 --- a/Sources/Plasma/PubUtilLib/plAvatar/plArmatureMod.cpp +++ b/Sources/Plasma/PubUtilLib/plAvatar/plArmatureMod.cpp @@ -184,7 +184,7 @@ void plArmatureModBase::RemoveTarget(plSceneObject* so) plAGMasterMod::RemoveTarget(so); } -hsBool plArmatureModBase::IEval(double time, hsScalar elapsed, UInt32 dirty) +hsBool plArmatureModBase::IEval(double time, float elapsed, uint32_t dirty) { if (IsFinal()) { @@ -220,7 +220,7 @@ void plArmatureModBase::Read(hsStream * stream, hsResMgr *mgr) plKey meshKey = mgr->ReadKey(stream); fMeshKeys.push_back(meshKey); - plKeyVector *vec = TRACKED_NEW plKeyVector; + plKeyVector *vec = new plKeyVector; int boneCount = stream->ReadLE32(); for(int j = 0; j < boneCount; j++) vec->push_back(mgr->ReadKey(stream)); @@ -276,7 +276,7 @@ void plArmatureModBase::EnableDrawingTree(const plSceneObject *object, hsBool st if (!object) return; - plEnableMsg *msg = TRACKED_NEW plEnableMsg; + plEnableMsg *msg = new plEnableMsg; if (status) msg->SetCmd( plEnableMsg::kEnable ); else @@ -436,7 +436,7 @@ void plArmatureModBase::AdjustLOD() hsMatrix44 l2w = SO->GetLocalToWorld(); hsPoint3 ourPos = l2w.GetTranslate(); hsPoint3 delta = ourPos - camPos; - hsScalar distanceSquared = delta.MagnitudeSquared(); + float distanceSquared = delta.MagnitudeSquared(); if (distanceSquared < fLODDistance * fLODDistance) SetLOD(__max(0, fMinLOD)); else if (distanceSquared < fLODDistance * fLODDistance * 4.0) @@ -507,12 +507,12 @@ int plArmatureModBase::AppendBoneVec(plKeyVector *boneVec) return fUnusedBones.size() - 1; } -UInt8 plArmatureModBase::GetNumLOD() const +uint8_t plArmatureModBase::GetNumLOD() const { return fMeshKeys.size(); } -void plArmatureModBase::EnablePhysics(hsBool status, UInt16 reason /* = kDisableReasonUnknown */) +void plArmatureModBase::EnablePhysics(hsBool status, uint16_t reason /* = kDisableReasonUnknown */) { if (status) fDisabledPhysics &= ~reason; @@ -538,7 +538,7 @@ void plArmatureModBase::EnablePhysicsKinematic(hsBool status) fController->Kinematic(status); } -void plArmatureModBase::EnableDrawing(hsBool status, UInt16 reason /* = kDisableReasonUnknown */) +void plArmatureModBase::EnableDrawing(hsBool status, uint16_t reason /* = kDisableReasonUnknown */) { hsBool oldStatus = !fDisabledDraw; if (status) @@ -604,7 +604,7 @@ void plArmatureModBase::ICustomizeApplicator() } } plAGModifier *volAGMod = const_cast(agMod); - plMatrixDifferenceApp *differ = TRACKED_NEW plMatrixDifferenceApp(); + plMatrixDifferenceApp *differ = new plMatrixDifferenceApp(); fRootAnimator = differ; volAGMod->SetApplicator(differ); @@ -628,8 +628,8 @@ void plArmatureModBase::IEnableBones(int lod, hsBool enable) const char *plArmatureMod::BoneStrings[] = {"Male", "Female", "Critter", "Actor"}; -const hsScalar plArmatureMod::kAvatarInputSynchThreshold = 10.f; -hsScalar plArmatureMod::fMouseTurnSensitivity = 1.f; +const float plArmatureMod::kAvatarInputSynchThreshold = 10.f; +float plArmatureMod::fMouseTurnSensitivity = 1.f; hsBool plArmatureMod::fClickToTurn = true; void plArmatureMod::IInitDefaults() @@ -758,7 +758,7 @@ const plSceneObject *plArmatureMod::FindBone(const char * name) const return result; } -const plSceneObject *plArmatureMod::FindBone(UInt32 id) const +const plSceneObject *plArmatureMod::FindBone(uint32_t id) const { if(fBoneMap) return fBoneMap->FindBone(id); @@ -766,10 +766,10 @@ const plSceneObject *plArmatureMod::FindBone(UInt32 id) const return nil; } -void plArmatureMod::AddBoneMapping(UInt32 id, const plSceneObject *bone) +void plArmatureMod::AddBoneMapping(uint32_t id, const plSceneObject *bone) { if(!fBoneMap) - fBoneMap = TRACKED_NEW plAvBoneMap(); + fBoneMap = new plAvBoneMap(); fBoneMap->AddBoneMapping(id, bone); } @@ -885,7 +885,7 @@ void plArmatureMod::SpawnAt(int spawnNum, double time) } fWaitFlags &= ~kNeedSpawn; - plAvatarSpawnNotifyMsg *notify = TRACKED_NEW plAvatarSpawnNotifyMsg(); + plAvatarSpawnNotifyMsg *notify = new plAvatarSpawnNotifyMsg(); notify->SetTimeStamp(hsTimer::GetSysSeconds() + 0.1); notify->SetBCastFlag(plMessage::kBCastByExactType); notify->Send(); @@ -898,10 +898,10 @@ void plArmatureMod::SetFollowerParticleSystemSO(plSceneObject *follower) // TODO: Check for old one and clean up. hsPoint3 trans = GetTarget(0)->GetLocalToWorld().GetTranslate() - follower->GetLocalToWorld().GetTranslate(); - plWarpMsg *warp = TRACKED_NEW plWarpMsg(GetKey(), follower->GetKey(), plWarpMsg::kFlushTransform | plWarpMsg::kZeroVelocity, + plWarpMsg *warp = new plWarpMsg(GetKey(), follower->GetKey(), plWarpMsg::kFlushTransform | plWarpMsg::kZeroVelocity, GetTarget(0)->GetLocalToWorld()); warp->Send(); - hsgResMgr::ResMgr()->AddViaNotify(follower->GetKey(), TRACKED_NEW plAttachMsg(GetTarget(0)->GetKey(), nil, plRefMsg::kOnRequest), plRefFlags::kActiveRef); + hsgResMgr::ResMgr()->AddViaNotify(follower->GetKey(), new plAttachMsg(GetTarget(0)->GetKey(), nil, plRefMsg::kOnRequest), plRefFlags::kActiveRef); fFollowerParticleSystemSO = follower; plParticleSystem *sys = const_cast(plParticleSystem::ConvertNoRef(follower->GetModifierByType(plParticleSystem::Index()))); @@ -929,11 +929,11 @@ void plArmatureMod::UnRegisterForBehaviorNotify(plKey key) fNotifyKeys.RemoveItem(key); } -void plArmatureMod::IFireBehaviorNotify(UInt32 type, hsBool behaviorStart) +void plArmatureMod::IFireBehaviorNotify(uint32_t type, hsBool behaviorStart) { if (fNotifyKeys.GetCount() > 0) { - plAvatarBehaviorNotifyMsg *msg = TRACKED_NEW plAvatarBehaviorNotifyMsg(); + plAvatarBehaviorNotifyMsg *msg = new plAvatarBehaviorNotifyMsg(); msg->SetSender(GetKey()); msg->AddReceivers(fNotifyKeys); msg->fType = type; @@ -960,7 +960,7 @@ void plArmatureMod::EnterAge(hsBool reSpawn) if (sys) { // Need to tell other clients about this - plLoadCloneMsg *clone = TRACKED_NEW plLoadCloneMsg(GetFollowerParticleSystemSO()->GetKey(), plAvatarMgr::GetInstance()->GetKey(), GetKey()->GetUoid().GetClonePlayerID(), true); + plLoadCloneMsg *clone = new plLoadCloneMsg(GetFollowerParticleSystemSO()->GetKey(), plAvatarMgr::GetInstance()->GetKey(), GetKey()->GetUoid().GetClonePlayerID(), true); clone->SetBCastFlag(plMessage::kLocalPropagate, false); clone->Send(); @@ -995,7 +995,7 @@ void plArmatureMod::LeaveAge() if (GetFollowerParticleSystemSO()) { // Need to tell other clients to remove this - plLoadCloneMsg *clone = TRACKED_NEW plLoadCloneMsg(GetFollowerParticleSystemSO()->GetKey(), plAvatarMgr::GetInstance()->GetKey(), GetKey()->GetUoid().GetClonePlayerID(), false); + plLoadCloneMsg *clone = new plLoadCloneMsg(GetFollowerParticleSystemSO()->GetKey(), plAvatarMgr::GetInstance()->GetKey(), GetKey()->GetUoid().GetClonePlayerID(), false); clone->SetBCastFlag(plMessage::kLocalPropagate, false); clone->Send(); } @@ -1021,7 +1021,7 @@ void plArmatureMod::PanicLink(hsBool playLinkOutAnim /* = true */) plNetApp::StaticDebugMsg("plArmatureMod::PanicLink()"); // make the player book blink as they are linking out - pfKIMsg *msg = TRACKED_NEW pfKIMsg( pfKIMsg::kStartBookAlert ); + pfKIMsg *msg = new pfKIMsg( pfKIMsg::kStartBookAlert ); plgDispatch::MsgSend( msg ); // Can't depend on the anim to link if the human brain isn't ready to deal with it @@ -1032,13 +1032,13 @@ void plArmatureMod::PanicLink(hsBool playLinkOutAnim /* = true */) if (playLinkOutAnim) { - plAvOneShotLinkTask *task = TRACKED_NEW plAvOneShotLinkTask; + plAvOneShotLinkTask *task = new plAvOneShotLinkTask; char *animName = MakeAnimationName("FallingLinkOut"); task->SetAnimName(animName); task->SetMarkerName("touch"); - plAvTaskMsg *taskMsg = TRACKED_NEW plAvTaskMsg(GetKey(), GetKey(), task); + plAvTaskMsg *taskMsg = new plAvTaskMsg(GetKey(), GetKey(), task); taskMsg->Send(); delete [] animName; @@ -1058,13 +1058,13 @@ void plArmatureMod::PersonalLink() ILinkToPersonalAge(); else { - plAvOneShotLinkTask *task = TRACKED_NEW plAvOneShotLinkTask; + plAvOneShotLinkTask *task = new plAvOneShotLinkTask; char *animName = MakeAnimationName("PersonalLink"); task->SetAnimName(animName); task->SetMarkerName("touch"); delete [] animName; - plAvTaskMsg *taskMsg = TRACKED_NEW plAvTaskMsg(GetKey(), GetKey(), task); + plAvTaskMsg *taskMsg = new plAvTaskMsg(GetKey(), GetKey(), task); taskMsg->SetBCastFlag(plMessage::kNetPropagate); taskMsg->Send(); } @@ -1250,7 +1250,7 @@ hsBool plArmatureMod::MsgReceive(plMessage* msg) return true; // Only the local player can create the clone. // Clone is sent to all players. - plLoadCloneMsg *cloneMsg = TRACKED_NEW plLoadCloneMsg(partMsg->fSysSOKey->GetUoid(), plAvatarMgr::GetInstance()->GetKey(), GetKey()->GetUoid().GetClonePlayerID()); + plLoadCloneMsg *cloneMsg = new plLoadCloneMsg(partMsg->fSysSOKey->GetUoid(), plAvatarMgr::GetInstance()->GetKey(), GetKey()->GetUoid().GetClonePlayerID()); cloneMsg->SetTriggerMsg(partMsg); cloneMsg->SetBCastFlag(plMessage::kNetForce); cloneMsg->Send(); @@ -1299,7 +1299,7 @@ hsBool plArmatureMod::MsgReceive(plMessage* msg) if(spawnSO) { hsMatrix44 l2w = spawnSO->GetLocalToWorld(); - plWarpMsg *warpM = TRACKED_NEW plWarpMsg(nil, GetTarget(0)->GetKey(), plWarpMsg::kFlushTransform, l2w); + plWarpMsg *warpM = new plWarpMsg(nil, GetTarget(0)->GetKey(), plWarpMsg::kFlushTransform, l2w); warpM->Send(); fWaitFlags &= ~kNeedSpawn; } @@ -1492,7 +1492,7 @@ hsBool plArmatureMod::IHandleControlMsg(plControlEventMsg* pMsg) void plArmatureMod::IHandleInputStateMsg(plAvatarInputStateMsg *msg) { int i; - UInt32 curBit; + uint32_t curBit; for (i = 0, curBit = 0x1; i < plAvatarInputStateMsg::fMapSize; i++, curBit <<= 1) { SetInputFlag(msg->fCodeMap[i], msg->fState & curBit); @@ -1500,14 +1500,14 @@ void plArmatureMod::IHandleInputStateMsg(plAvatarInputStateMsg *msg) } -void plArmatureMod::SynchInputState(UInt32 rcvID /* = kInvalidPlayerID */) +void plArmatureMod::SynchInputState(uint32_t rcvID /* = kInvalidPlayerID */) { if (plAvatarMgr::GetInstance()->GetLocalAvatar() != this) return; - plAvatarInputStateMsg *msg = TRACKED_NEW plAvatarInputStateMsg(); + plAvatarInputStateMsg *msg = new plAvatarInputStateMsg(); int i; - UInt32 curBit; + uint32_t curBit; for (i = 0, curBit = 0x1; i < plAvatarInputStateMsg::fMapSize; i++, curBit <<= 1) { if (GetInputFlag(msg->fCodeMap[i])) @@ -1539,13 +1539,13 @@ void plArmatureMod::ILinkToPersonalAge() link.SetSpawnPoint(hutSpawnPoint); link.SetLinkingRules( plNetCommon::LinkingRules::kOriginalBook ); - plLinkToAgeMsg* pMsg = TRACKED_NEW plLinkToAgeMsg( &link ); + plLinkToAgeMsg* pMsg = new plLinkToAgeMsg( &link ); pMsg->SetLinkInAnimName("PersonalBookEnter"); pMsg->AddReceiver(nc->GetKey()); pMsg->Send(); } -hsBool plArmatureMod::IEval(double time, hsScalar elapsed, UInt32 dirty) +hsBool plArmatureMod::IEval(double time, float elapsed, uint32_t dirty) { if (IsFinal()) { @@ -1628,7 +1628,7 @@ hsBool plArmatureMod::IEval(double time, hsScalar elapsed, UInt32 dirty) hsPoint3 trans = GetTarget(0)->GetLocalToWorld().GetTranslate() - follower->GetLocalToWorld().GetTranslate(); if (trans.MagnitudeSquared() > 1) // we can be a bit fuzzy about this, since the particle system is rather large and people won't notice it being off { - plWarpMsg *warp = TRACKED_NEW plWarpMsg(GetKey(), follower->GetKey(), plWarpMsg::kFlushTransform | plWarpMsg::kZeroVelocity, + plWarpMsg *warp = new plWarpMsg(GetKey(), follower->GetKey(), plWarpMsg::kFlushTransform | plWarpMsg::kZeroVelocity, GetTarget(0)->GetLocalToWorld()); warp->Send(); @@ -1663,29 +1663,29 @@ void plArmatureMod::AddTarget(plSceneObject* so) // attach a clothingSDLModifier to handle clothing saveState delete fClothingSDLMod; - fClothingSDLMod = TRACKED_NEW plClothingSDLModifier; + fClothingSDLMod = new plClothingSDLModifier; fClothingSDLMod->SetClothingOutfit(GetClothingOutfit()); // ok if clothingOutfit is nil at this point so->AddModifier(fClothingSDLMod); // add avatar sdl modifier delete fAvatarSDLMod; - fAvatarSDLMod = TRACKED_NEW plAvatarSDLModifier; + fAvatarSDLMod = new plAvatarSDLModifier; so->AddModifier(fAvatarSDLMod); delete fAvatarPhysicalSDLMod; - fAvatarPhysicalSDLMod = TRACKED_NEW plAvatarPhysicalSDLModifier; + fAvatarPhysicalSDLMod = new plAvatarPhysicalSDLModifier; so->AddModifier(fAvatarPhysicalSDLMod); // At export time, this key will be nil. This is important, or else we'll overwrite the page the key comes from. if (fFootSoundSOKey != nil) - hsgResMgr::ResMgr()->AddViaNotify(fFootSoundSOKey, TRACKED_NEW plAttachMsg(so->GetKey(), nil, plRefMsg::kOnRequest), plRefFlags::kActiveRef); + hsgResMgr::ResMgr()->AddViaNotify(fFootSoundSOKey, new plAttachMsg(so->GetKey(), nil, plRefMsg::kOnRequest), plRefFlags::kActiveRef); if (fLinkSoundSOKey != nil) - hsgResMgr::ResMgr()->AddViaNotify(fLinkSoundSOKey, TRACKED_NEW plAttachMsg(so->GetKey(), nil, plRefMsg::kOnRequest), plRefFlags::kActiveRef); + hsgResMgr::ResMgr()->AddViaNotify(fLinkSoundSOKey, new plAttachMsg(so->GetKey(), nil, plRefMsg::kOnRequest), plRefFlags::kActiveRef); if (fUpdateMsg) fUpdateMsg->UnRef(); // delete an old one. - fUpdateMsg = TRACKED_NEW plArmatureUpdateMsg(GetKey(), so->IsLocallyOwned(), true, this); + fUpdateMsg = new plArmatureUpdateMsg(GetKey(), so->IsLocallyOwned(), true, this); } void plArmatureMod::RemoveTarget(plSceneObject* so) @@ -1769,7 +1769,7 @@ void plArmatureMod::Read(hsStream * stream, hsResMgr *mgr) } if( stream->ReadBool() ) - mgr->ReadKeyNotifyMe(stream, TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnCreate, -1, -1), plRefFlags::kActiveRef); // plClothingBase + mgr->ReadKeyNotifyMe(stream, new plGenRefMsg(GetKey(), plRefMsg::kOnCreate, -1, -1), plRefFlags::kActiveRef); // plClothingBase else fClothingOutfit = nil; @@ -1778,7 +1778,7 @@ void plArmatureMod::Read(hsStream * stream, hsResMgr *mgr) if( stream->ReadBool() ) { plKey effectMgrKey = mgr->ReadKey(stream); - mgr->AddViaNotify(effectMgrKey, TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnCreate, -1, -1), plRefFlags::kActiveRef); // plArmatureEffects + mgr->AddViaNotify(effectMgrKey, new plGenRefMsg(GetKey(), plRefMsg::kOnCreate, -1, -1), plRefFlags::kActiveRef); // plArmatureEffects // Attach the Footstep emitter scene object hsResMgr *mgr = hsgResMgr::ResMgr(); @@ -1807,7 +1807,7 @@ void plArmatureMod::Read(hsStream * stream, hsResMgr *mgr) effectKey = mgr->ReRegister(plString::Null, effectUoid); } if (effectKey != nil) - mgr->AddViaNotify(effectKey, TRACKED_NEW plGenRefMsg(effectMgrKey, plRefMsg::kOnCreate, -1, -1), plRefFlags::kActiveRef); + mgr->AddViaNotify(effectKey, new plGenRefMsg(effectMgrKey, plRefMsg::kOnCreate, -1, -1), plRefFlags::kActiveRef); // Get the linking sound plUoid LinkUoid(gLoc, plSceneObject::Index(), _TEMP_CONVERT_FROM_LITERAL("LinkSoundSource")); @@ -1840,7 +1840,7 @@ void plArmatureMod::Read(hsStream * stream, hsResMgr *mgr) plgDispatch::Dispatch()->RegisterForExactType(plAvatarStealthModeMsg::Index(), GetKey()); } -hsBool plArmatureMod::DirtySynchState(const char* SDLStateName, UInt32 synchFlags) +hsBool plArmatureMod::DirtySynchState(const char* SDLStateName, uint32_t synchFlags) { // skip requests to synch non-avatar state if (SDLStateName && stricmp(SDLStateName, kSDLAvatar)) @@ -1859,7 +1859,7 @@ hsBool plArmatureMod::DirtySynchState(const char* SDLStateName, UInt32 synchFlag return false; } -hsBool plArmatureMod::DirtyPhysicalSynchState(UInt32 synchFlags) +hsBool plArmatureMod::DirtyPhysicalSynchState(uint32_t synchFlags) { synchFlags |= plSynchedObject::kForceFullSend; // TEMP synchFlags |= plSynchedObject::kBCastToClients; @@ -1879,14 +1879,14 @@ void plArmatureMod::IFinalize() if (fWaitFlags & kNeedAudio) { - plSetListenerMsg *msg = TRACKED_NEW plSetListenerMsg( plSetListenerMsg::kVelocity, GetTarget(0)->GetKey(), true ); + plSetListenerMsg *msg = new plSetListenerMsg( plSetListenerMsg::kVelocity, GetTarget(0)->GetKey(), true ); msg->Send(); fWaitFlags &= ~kNeedAudio; } if (fWaitFlags & kNeedCamera) { - plCameraMsg* pMsg = TRACKED_NEW plCameraMsg; + plCameraMsg* pMsg = new plCameraMsg; pMsg->SetCmd(plCameraMsg::kCreateNewDefaultCam); pMsg->SetCmd(plCameraMsg::kSetSubject); pMsg->SetSubject(GetTarget(0)); @@ -1922,13 +1922,13 @@ void plArmatureMod::ICustomizeApplicator() } } plAGModifier *volAGMod = const_cast(agMod); - fBoneRootAnimator = TRACKED_NEW plMatrixDelayedCorrectionApplicator(); + fBoneRootAnimator = new plMatrixDelayedCorrectionApplicator(); volAGMod->SetApplicator(fBoneRootAnimator); fWaitFlags &= ~kNeedApplicator; } } -const plSceneObject *plArmatureMod::GetClothingSO(UInt8 lod) const +const plSceneObject *plArmatureMod::GetClothingSO(uint8_t lod) const { if (fClothToSOMap.GetCount() <= lod) return nil; @@ -1944,7 +1944,7 @@ void plArmatureMod::NetworkSynch(double timeNow, int force) { // make sure state change gets sent out over the network // avatar state should use relevance region filtering - UInt32 flags = kBCastToClients | kUseRelevanceRegions; + uint32_t flags = kBCastToClients | kUseRelevanceRegions; if (force) flags |= kForceFullSend; DirtyPhysicalSynchState(flags); @@ -2053,7 +2053,7 @@ hsBool plArmatureMod::ValidateMesh() // If we haven't created the mapping yet... if (fClothToSOMap.GetCount() <= i || fClothToSOMap[i] == nil) { - plGenRefMsg *refMsg = TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnRequest, i, 0); + plGenRefMsg *refMsg = new plGenRefMsg(GetKey(), plRefMsg::kOnRequest, i, 0); hsgResMgr::ResMgr()->SendRef(meshObj->GetKey(), refMsg, plRefFlags::kPassiveRef); } } @@ -2091,7 +2091,7 @@ int plArmatureMod::GetBrainCount() return fBrains.size(); } -plArmatureBrain * plArmatureMod::FindBrainByClass(UInt32 classID) const +plArmatureBrain * plArmatureMod::FindBrainByClass(uint32_t classID) const { int n = fBrains.size(); @@ -2282,12 +2282,12 @@ void plArmatureMod::SetJumpKeyDown() SetInputFlag(B_CONTROL_JUMP, true); } -hsScalar plArmatureMod::GetTurnStrength() const +float plArmatureMod::GetTurnStrength() const { return GetKeyTurnStrength() + GetAnalogTurnStrength(); } -hsScalar plArmatureMod::GetKeyTurnStrength() const +float plArmatureMod::GetKeyTurnStrength() const { if (StrafeKeyDown()) return 0.f; @@ -2295,12 +2295,12 @@ hsScalar plArmatureMod::GetKeyTurnStrength() const return (TurnLeftKeyDown() ? 1.f : 0.f) + (TurnRightKeyDown() ? -1.f: 0.f); } -hsScalar plArmatureMod::GetAnalogTurnStrength() const +float plArmatureMod::GetAnalogTurnStrength() const { if (StrafeKeyDown()) return 0.f; - hsScalar elapsed = hsTimer::GetDelSysSeconds(); + float elapsed = hsTimer::GetDelSysSeconds(); if (elapsed > 0) return fMouseFrameTurnStrength / elapsed; else @@ -2422,7 +2422,7 @@ void plArmatureMod::ISetupMarkerCallbacks(plATCAnim *anim, plAnimTimeConvert *at for (i = 0; i < markers.size(); i++) { - hsScalar time = -1; + float time = -1; hsBool isLeft = false; if (strstr(markers[i], "SndLeftFootDown") == markers[i]) { @@ -2436,11 +2436,11 @@ void plArmatureMod::ISetupMarkerCallbacks(plATCAnim *anim, plAnimTimeConvert *at { plEventCallbackInterceptMsg *iMsg; - plArmatureEffectMsg *msg = TRACKED_NEW plArmatureEffectMsg(fEffects->GetKey(), kTime); + plArmatureEffectMsg *msg = new plArmatureEffectMsg(fEffects->GetKey(), kTime); msg->fEventTime = time; msg->fTriggerIdx = AnimNameToIndex(anim->GetName()); - iMsg = TRACKED_NEW plEventCallbackInterceptMsg(); + iMsg = new plEventCallbackInterceptMsg(); iMsg->AddReceiver(fEffects->GetKey()); iMsg->fEventTime = time; iMsg->fEvent = kTime; @@ -2449,10 +2449,10 @@ void plArmatureMod::ISetupMarkerCallbacks(plATCAnim *anim, plAnimTimeConvert *at hsRefCnt_SafeUnRef(msg); hsRefCnt_SafeUnRef(iMsg); - plAvatarFootMsg* foot = TRACKED_NEW plAvatarFootMsg(GetKey(), this, isLeft); + plAvatarFootMsg* foot = new plAvatarFootMsg(GetKey(), this, isLeft); foot->fEventTime = time; - iMsg = TRACKED_NEW plEventCallbackInterceptMsg(); + iMsg = new plEventCallbackInterceptMsg(); iMsg->AddReceiver(fEffects->GetKey()); iMsg->fEventTime = time; iMsg->fEvent = kTime; @@ -2471,10 +2471,10 @@ const char *plArmatureMod::GetAnimRootName(const char *name) return name + fAnimationPrefix.length(); } -Int8 plArmatureMod::AnimNameToIndex(const char *name) +int8_t plArmatureMod::AnimNameToIndex(const char *name) { const char *rootName = GetAnimRootName(name); - Int8 result = -1; + int8_t result = -1; if (!strcmp(rootName, "Walk") || !strcmp(rootName, "WalkBack") || !strcmp(rootName, "LadderDown") || !strcmp(rootName, "LadderDownOn") || @@ -2611,7 +2611,7 @@ void plArmatureLODMod::Read(hsStream *stream, hsResMgr *mgr) plKey meshKey = mgr->ReadKey(stream); fMeshKeys.push_back(meshKey); - plKeyVector *vec = TRACKED_NEW plKeyVector; + plKeyVector *vec = new plKeyVector; int boneCount = stream->ReadLE32(); for(int j = 0; j < boneCount; j++) vec->push_back(mgr->ReadKey(stream)); @@ -2652,7 +2652,7 @@ int plArmatureMod::RefreshDebugDisplay() plDebugText &debugTxt = plDebugText::Instance(); char strBuf[ 2048 ]; int lineHeight = debugTxt.GetFontSize() + 4; - UInt32 scrnWidth, scrnHeight; + uint32_t scrnWidth, scrnHeight; debugTxt.GetScreenSize( &scrnWidth, &scrnHeight ); int y = 10; @@ -2781,13 +2781,13 @@ void plArmatureMod::DumpToDebugDisplay(int &x, int &y, int lineHeight, char *str class plAvBoneMap::BoneMapImp { public: - typedef std::map id2SceneObjectMap; + typedef std::map id2SceneObjectMap; id2SceneObjectMap fMap; }; plAvBoneMap::plAvBoneMap() { - fImp = TRACKED_NEW BoneMapImp; + fImp = new BoneMapImp; } plAvBoneMap::~plAvBoneMap() @@ -2795,7 +2795,7 @@ plAvBoneMap::~plAvBoneMap() delete fImp; } -const plSceneObject * plAvBoneMap::FindBone(UInt32 boneID) +const plSceneObject * plAvBoneMap::FindBone(uint32_t boneID) { BoneMapImp::id2SceneObjectMap::iterator i = fImp->fMap.find(boneID); const plSceneObject *result = nil; @@ -2807,7 +2807,7 @@ const plSceneObject * plAvBoneMap::FindBone(UInt32 boneID) return result; } -void plAvBoneMap::AddBoneMapping(UInt32 boneID, const plSceneObject *SO) +void plAvBoneMap::AddBoneMapping(uint32_t boneID, const plSceneObject *SO) { (fImp->fMap)[boneID] = SO; } diff --git a/Sources/Plasma/PubUtilLib/plAvatar/plArmatureMod.h b/Sources/Plasma/PubUtilLib/plAvatar/plArmatureMod.h index e46b09e7..c89fa1df 100644 --- a/Sources/Plasma/PubUtilLib/plAvatar/plArmatureMod.h +++ b/Sources/Plasma/PubUtilLib/plAvatar/plArmatureMod.h @@ -112,7 +112,7 @@ public: virtual hsBool MsgReceive(plMessage* msg); virtual void AddTarget(plSceneObject* so); virtual void RemoveTarget(plSceneObject* so); - virtual hsBool IEval(double secs, hsScalar del, UInt32 dirty); + virtual hsBool IEval(double secs, float del, uint32_t dirty); virtual void Read(hsStream *stream, hsResMgr *mgr); virtual void Write(hsStream *stream, hsResMgr *mgr); @@ -134,7 +134,7 @@ public: void RefreshTree(); // Resend an LOD update to all our nodes (for when geometry changes) int AppendMeshKey(plKey meshKey); int AppendBoneVec(plKeyVector *boneVec); - UInt8 GetNumLOD() const; + uint8_t GetNumLOD() const; // A collection of reasons (flags) that things might be disabled. When all flags are gone // The object is re-enabled. @@ -147,9 +147,9 @@ public: kDisableReasonVehicle = 0x0010, kDisableReasonGenericBrain = 0x0020, }; - void EnablePhysics(hsBool status, UInt16 reason = kDisableReasonUnknown); + void EnablePhysics(hsBool status, uint16_t reason = kDisableReasonUnknown); void EnablePhysicsKinematic(hsBool status); - void EnableDrawing(hsBool status, UInt16 reason = kDisableReasonUnknown); + void EnableDrawing(hsBool status, uint16_t reason = kDisableReasonUnknown); hsBool IsPhysicsEnabled() { return fDisabledPhysics == 0; } hsBool IsDrawEnabled() { return fDisabledDraw == 0; } @@ -177,7 +177,7 @@ protected: kNeedApplicator = 0x20, kNeedBrainActivation = 0x40, }; - UInt16 fWaitFlags; + uint16_t fWaitFlags; int fCurLOD; plPhysicalControllerCore* fController; @@ -185,8 +185,8 @@ protected: plBrainStack fBrains; plMatrixDifferenceApp *fRootAnimator; std::vector fUnusedBones; - UInt16 fDisabledPhysics; - UInt16 fDisabledDraw; + uint16_t fDisabledPhysics; + uint16_t fDisabledDraw; }; class plArmatureMod : public plArmatureModBase @@ -207,7 +207,7 @@ public: virtual hsBool MsgReceive(plMessage* msg); virtual void AddTarget(plSceneObject* so); virtual void RemoveTarget(plSceneObject* so); - virtual hsBool IEval(double secs, hsScalar del, UInt32 dirty); + virtual hsBool IEval(double secs, float del, uint32_t dirty); virtual void Read(hsStream *stream, hsResMgr *mgr); virtual void Write(hsStream *stream, hsResMgr *mgr); @@ -222,8 +222,8 @@ public: hsBool IsLocalAvatar(); hsBool IsLocalAI(); virtual const plSceneObject *FindBone(const char * name) const; - virtual const plSceneObject *FindBone(UInt32 id) const; // use an id from an appropriate taxonomy, such as plAvBrainHuman::BoneID - virtual void AddBoneMapping(UInt32 id, const plSceneObject *bone); + virtual const plSceneObject *FindBone(uint32_t id) const; // use an id from an appropriate taxonomy, such as plAvBrainHuman::BoneID + virtual void AddBoneMapping(uint32_t id, const plSceneObject *bone); plAGModifier *GetRootAGMod(); plAGAnim *FindCustomAnim(const char *baseName) const; @@ -239,13 +239,13 @@ public: int GetBrainCount(); plArmatureBrain *GetNextBrain(plArmatureBrain *brain); plArmatureBrain *GetBrain(int index) { if(index <= fBrains.size()) return fBrains.at(index); else return nil; } - plArmatureBrain *FindBrainByClass(UInt32 classID) const; + plArmatureBrain *FindBrainByClass(uint32_t classID) const; void TurnToPoint(hsPoint3 &point); void SuspendInput(); void ResumeInput(); - UInt8 IsInputSuspended() { return fSuspendInputCount; } + uint8_t IsInputSuspended() { return fSuspendInputCount; } void IProcessQueuedInput(); void PreserveInputState(); void RestoreInputState(); @@ -253,9 +253,9 @@ public: void SetInputFlag(int which, hsBool status); void ClearInputFlags(bool saveAlwaysRun, bool clearBackup); hsBool HasMovementFlag() const; // Is any *movement* input flag on? - hsScalar GetTurnStrength() const; - hsScalar GetKeyTurnStrength() const; - hsScalar GetAnalogTurnStrength() const; + float GetTurnStrength() const; + float GetKeyTurnStrength() const; + float GetAnalogTurnStrength() const; void SetReverseFBOnIdle(bool val); hsBool IsFBReversed(); @@ -281,12 +281,12 @@ public: void GetMoveKeyString(char *buff); void SynchIfLocal(double timeNow, int force); // Just physical state - void SynchInputState(UInt32 rcvID = kInvalidPlayerID); - hsBool DirtySynchState(const char* SDLStateName, UInt32 synchFlags ); - hsBool DirtyPhysicalSynchState(UInt32 synchFlags); + void SynchInputState(uint32_t rcvID = kInvalidPlayerID); + hsBool DirtySynchState(const char* SDLStateName, uint32_t synchFlags ); + hsBool DirtyPhysicalSynchState(uint32_t synchFlags); plClothingOutfit *GetClothingOutfit() const { return fClothingOutfit; } plClothingSDLModifier *GetClothingSDLMod() const { return fClothingSDLMod; } - const plSceneObject *GetClothingSO(UInt8 lod) const; + const plSceneObject *GetClothingSO(uint8_t lod) const; plArmatureEffectsMgr *GetArmatureEffects() const { return fEffects; } enum @@ -299,7 +299,7 @@ public: }; const char *GetAnimRootName(const char *name); - Int8 AnimNameToIndex(const char *name); + int8_t AnimNameToIndex(const char *name); void SetBodyType(int type) { fBodyType = type; } int GetBodyType(int type) { return fBodyType; } int GetCurrentGenericType(); @@ -321,11 +321,11 @@ public: bool IsMidLink(); hsBool ConsumeJump(); // returns true if the jump keypress was available to consume - void SendBehaviorNotify(UInt32 type, hsBool start = true) { IFireBehaviorNotify(type,start); } + void SendBehaviorNotify(uint32_t type, hsBool start = true) { IFireBehaviorNotify(type,start); } // Discovered a bug which makes these values horribly out of scale. So we do the rescale // in the Get/Set functions for backwards compatability. - static void SetMouseTurnSensitivity(hsScalar val) { fMouseTurnSensitivity = val / 150.f; } - static hsScalar GetMouseTurnSensitivity() { return fMouseTurnSensitivity * 150.f; } + static void SetMouseTurnSensitivity(float val) { fMouseTurnSensitivity = val / 150.f; } + static float GetMouseTurnSensitivity() { return fMouseTurnSensitivity * 150.f; } static void SetSpawnPointOverride( const char *overrideObjName ); static void WindowActivate(bool active); @@ -361,11 +361,11 @@ public: }; plMatrixDelayedCorrectionApplicator *fBoneRootAnimator; - static const hsScalar kAvatarInputSynchThreshold; + static const float kAvatarInputSynchThreshold; static hsBool fClickToTurn; static const char *BoneStrings[]; - void SetPhysicalDims(hsScalar height, hsScalar width) { fPhysHeight = height; fPhysWidth = width; } + void SetPhysicalDims(float height, float width) { fPhysHeight = height; fPhysWidth = width; } void SetBodyAgeName(const char* ageName) {if (ageName) fBodyAgeName = ageName; else fBodyAgeName = "";} void SetBodyFootstepSoundPage(const char* pageName) {if (pageName) fBodyFootstepSoundPage = pageName; else fBodyFootstepSoundPage = "";} @@ -381,7 +381,7 @@ protected: void NetworkSynch(double timeNow, int force = 0); hsBool IHandleControlMsg(plControlEventMsg* pMsg); - void IFireBehaviorNotify(UInt32 type, hsBool behaviorStart = true); + void IFireBehaviorNotify(uint32_t type, hsBool behaviorStart = true); void IHandleInputStateMsg(plAvatarInputStateMsg *msg); void ILinkToPersonalAge(); int IFindSpawnOverride(void); @@ -393,14 +393,14 @@ protected: hsBitVector fMoveFlagsBackup; // a copy of fMoveFlags typedef std::vector CtrlMessageVec; CtrlMessageVec fQueuedCtrlMessages; // input messages we haven't processed - hsScalar fMouseFrameTurnStrength; // Sum turnage from mouse delta messages since last eval. + float fMouseFrameTurnStrength; // Sum turnage from mouse delta messages since last eval. plKey fFootSoundSOKey; // The Scene Object we attach to targets for footstep sounds plKey fLinkSoundSOKey; // Same thing for linking... wwwwawAWAWAwawa... plKey fLinkInAnimKey; // Set when we link out, this is the anim to play (backwards) when we link in. - static hsScalar fMouseTurnSensitivity; + static float fMouseTurnSensitivity; plArmatureUpdateMsg *fUpdateMsg; - // Trying to be a good lad here and align all our bools and UInt8s... + // Trying to be a good lad here and align all our bools and bytes... bool fMidLink; // We're in between a LeaveAge and an EnterAge bool fAlreadyPanicLinking; // Cleared when you enter an age. Prevents spamming the server with panic link requests. bool fUnconsumedJump; // We've pressed the jump key, but haven't jumped yet @@ -408,8 +408,8 @@ protected: bool fPendingSynch; bool fDebugOn; bool fOpaque; - UInt8 fSuspendInputCount; - UInt8 fStealthMode; + uint8_t fSuspendInputCount; + uint8_t fStealthMode; int fStealthLevel; // you are invisible to other players/CCRs of lower stealthLevel double fLastInputSynch; @@ -473,14 +473,14 @@ public: plAvBoneMap(); virtual ~plAvBoneMap(); - const plSceneObject * FindBone(UInt32 boneID); // you probably want to use plAvBrainHuman::BoneID; - void AddBoneMapping(UInt32 boneID, const plSceneObject *SO); + const plSceneObject * FindBone(uint32_t boneID); // you probably want to use plAvBrainHuman::BoneID; + void AddBoneMapping(uint32_t boneID, const plSceneObject *SO); protected: class BoneMapImp; // forward declaration to keep the header clean: see .cpp for implementation BoneMapImp *fImp; // the thing that actually holds our map }; -#define TWO_PI (hsScalarPI * 2) +#define TWO_PI (M_PI * 2) #endif //plArmatureMod_inc diff --git a/Sources/Plasma/PubUtilLib/plAvatar/plAvBehaviors.cpp b/Sources/Plasma/PubUtilLib/plAvatar/plAvBehaviors.cpp index 74590b1d..cf6a7ff1 100644 --- a/Sources/Plasma/PubUtilLib/plAvatar/plAvBehaviors.cpp +++ b/Sources/Plasma/PubUtilLib/plAvatar/plAvBehaviors.cpp @@ -47,7 +47,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "plPipeline/plDebugText.h" -plArmatureBehavior::plArmatureBehavior() : fAnim(nil), fArmature(nil), fBrain(nil), fIndex((UInt8)-1), fFlags(0) {} +plArmatureBehavior::plArmatureBehavior() : fAnim(nil), fArmature(nil), fBrain(nil), fIndex((uint8_t)-1), fFlags(0) {} plArmatureBehavior::~plArmatureBehavior() { @@ -55,7 +55,7 @@ plArmatureBehavior::~plArmatureBehavior() fAnim->Detach(); } -void plArmatureBehavior::Init(plAGAnim *anim, hsBool loop, plArmatureBrain *brain, plArmatureModBase *armature, UInt8 index) +void plArmatureBehavior::Init(plAGAnim *anim, hsBool loop, plArmatureBrain *brain, plArmatureModBase *armature, uint8_t index) { fArmature = armature; fBrain = brain; @@ -72,9 +72,9 @@ void plArmatureBehavior::Process(double time, float elapsed) { } -void plArmatureBehavior::SetStrength(hsScalar val, hsScalar rate /* = 0.f */) +void plArmatureBehavior::SetStrength(float val, float rate /* = 0.f */) { - hsScalar oldStrength = GetStrength(); + float oldStrength = GetStrength(); if (rate == 0) fStrength.Set(val); else @@ -88,7 +88,7 @@ void plArmatureBehavior::SetStrength(hsScalar val, hsScalar rate /* = 0.f */) IStop(); } -hsScalar plArmatureBehavior::GetStrength() +float plArmatureBehavior::GetStrength() { return fStrength.Value(); } @@ -101,7 +101,7 @@ void plArmatureBehavior::Rewind() void plArmatureBehavior::DumpDebug(int &x, int &y, int lineHeight, char *strBuf, plDebugText &debugTxt) { - hsScalar strength = GetStrength(); + float strength = GetStrength(); const char *onOff = strength > 0 ? "on" : "off"; char blendBar[11] = "||||||||||"; int bars = (int)__min(10 * strength, 10); diff --git a/Sources/Plasma/PubUtilLib/plAvatar/plAvBehaviors.h b/Sources/Plasma/PubUtilLib/plAvatar/plAvBehaviors.h index 6c864f14..06a06da4 100644 --- a/Sources/Plasma/PubUtilLib/plAvatar/plAvBehaviors.h +++ b/Sources/Plasma/PubUtilLib/plAvatar/plAvBehaviors.h @@ -42,7 +42,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #ifndef PL_AV_BEHAVIORS_H #define PL_AV_BEHAVIORS_H -#include "hsTypes.h" +#include "HeadSpin.h" #include "hsTemplates.h" #include "pnKeyedObject/plKey.h" #include "pnTimer/plTimedValue.h" @@ -60,10 +60,10 @@ public: plArmatureBehavior(); virtual ~plArmatureBehavior(); - void Init(plAGAnim *anim, hsBool loop, plArmatureBrain *brain, plArmatureModBase *armature, UInt8 index); + void Init(plAGAnim *anim, hsBool loop, plArmatureBrain *brain, plArmatureModBase *armature, uint8_t index); virtual void Process(double time, float elapsed); - virtual void SetStrength(hsScalar val, hsScalar rate = 0.f); // default instant change - virtual hsScalar GetStrength(); + virtual void SetStrength(float val, float rate = 0.f); // default instant change + virtual float GetStrength(); virtual void Rewind(); void DumpDebug(int &x, int &y, int lineHeight, char *strBuf, plDebugText &debugTxt); @@ -71,14 +71,14 @@ public: { kBehaviorFlagNotifyOnStop = 0x01, }; - UInt32 fFlags; + uint32_t fFlags; protected: plAGAnimInstance *fAnim; plArmatureModBase *fArmature; plArmatureBrain *fBrain; - plTimedValue fStrength; - UInt8 fIndex; + plTimedValue fStrength; + uint8_t fIndex; virtual void IStart(); virtual void IStop(); diff --git a/Sources/Plasma/PubUtilLib/plAvatar/plAvBrain.cpp b/Sources/Plasma/PubUtilLib/plAvatar/plAvBrain.cpp index e81fefa2..e7cb7ab1 100644 --- a/Sources/Plasma/PubUtilLib/plAvatar/plAvBrain.cpp +++ b/Sources/Plasma/PubUtilLib/plAvatar/plAvBrain.cpp @@ -79,7 +79,7 @@ plArmatureBrain::~plArmatureBrain() delete fCurTask; } -hsBool plArmatureBrain::Apply(double timeNow, hsScalar elapsed) +hsBool plArmatureBrain::Apply(double timeNow, float elapsed) { IProcessTasks(timeNow, elapsed); fArmature->ApplyAnimations(timeNow, elapsed); @@ -167,7 +167,7 @@ hsBool plArmatureBrain::MsgReceive(plMessage * msg) return false; } -void plArmatureBrain::IProcessTasks(double time, hsScalar elapsed) +void plArmatureBrain::IProcessTasks(double time, float elapsed) { if (!fCurTask || !fCurTask->Process(plArmatureMod::ConvertNoRef(fArmature), this, time, elapsed)) { diff --git a/Sources/Plasma/PubUtilLib/plAvatar/plAvBrain.h b/Sources/Plasma/PubUtilLib/plAvatar/plAvBrain.h index 87fc1c18..6784f7f2 100644 --- a/Sources/Plasma/PubUtilLib/plAvatar/plAvBrain.h +++ b/Sources/Plasma/PubUtilLib/plAvatar/plAvBrain.h @@ -43,7 +43,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #define PLAVBRAIN_INC #include "plAGModifier.h" -#include "hsTypes.h" +#include "HeadSpin.h" #include "hsTemplates.h" #include "hsBitVector.h" #include "hsGeometry3.h" @@ -71,13 +71,13 @@ public: CLASSNAME_REGISTER( plArmatureBrain ); GETINTERFACE_ANY( plArmatureBrain, plCreatable ); - virtual hsBool Apply(double timeNow, hsScalar elapsed); + virtual hsBool Apply(double timeNow, float elapsed); virtual void Activate(plArmatureModBase *armature); virtual void Deactivate() {} virtual void Suspend() {} virtual void Resume() {} virtual void Spawn(double timeNow) {} - virtual void OnBehaviorStop(UInt8 index) {} + virtual void OnBehaviorStop(uint8_t index) {} virtual hsBool LeaveAge(); virtual hsBool IsRunningTask() const; virtual void QueueTask(plAvTask *task); @@ -88,7 +88,7 @@ public: virtual hsBool MsgReceive(plMessage *msg); protected: - virtual void IProcessTasks(double time, hsScalar elapsed); + virtual void IProcessTasks(double time, float elapsed); virtual hsBool IHandleTaskMsg(plAvTaskMsg *msg); typedef std::deque plAvTaskQueue; diff --git a/Sources/Plasma/PubUtilLib/plAvatar/plAvBrainClimb.cpp b/Sources/Plasma/PubUtilLib/plAvatar/plAvBrainClimb.cpp index 0317ef6b..802d5be3 100644 --- a/Sources/Plasma/PubUtilLib/plAvatar/plAvBrainClimb.cpp +++ b/Sources/Plasma/PubUtilLib/plAvatar/plAvBrainClimb.cpp @@ -210,7 +210,7 @@ void plAvBrainClimb::Deactivate() } // APPLY -hsBool plAvBrainClimb::Apply(double time, hsScalar elapsed) +hsBool plAvBrainClimb::Apply(double time, float elapsed) { hsBool result = true; @@ -284,7 +284,7 @@ hsBool plAvBrainClimb::IHandleClimbMsg(plClimbMsg *msg) && fCurMode != kFallingOff && fCurMode != kFinishing) { - plClimbEventMsg* pMsg = TRACKED_NEW plClimbEventMsg; + plClimbEventMsg* pMsg = new plClimbEventMsg; pMsg->SetSender(msg->fTarget); pMsg->SetBCastFlag(plMessage::kBCastByExactType); pMsg->SetBCastFlag(plMessage::kLocalPropagate); @@ -679,21 +679,21 @@ void plAvBrainClimb::IProbeEnvironment() plKey ourKey = fAvMod->GetKey(); // *** would be cool if we could hint that these should be batched for spatial coherence optimization - plLOSRequestMsg *upReq = TRACKED_NEW plLOSRequestMsg(ourKey, start, up, plSimDefs::kLOSDBCustom, plLOSRequestMsg::kTestAny, plLOSRequestMsg::kReportHit); - upReq->SetRequestID(static_cast(plClimbMsg::kUp)); + plLOSRequestMsg *upReq = new plLOSRequestMsg(ourKey, start, up, plSimDefs::kLOSDBCustom, plLOSRequestMsg::kTestAny, plLOSRequestMsg::kReportHit); + upReq->SetRequestID(static_cast(plClimbMsg::kUp)); upReq->Send(); - plLOSRequestMsg *downReq = TRACKED_NEW plLOSRequestMsg(ourKey, start, down, plSimDefs::kLOSDBCustom, plLOSRequestMsg::kTestAny, plLOSRequestMsg::kReportHit); - downReq->SetRequestID(static_cast(plClimbMsg::kDown)); + plLOSRequestMsg *downReq = new plLOSRequestMsg(ourKey, start, down, plSimDefs::kLOSDBCustom, plLOSRequestMsg::kTestAny, plLOSRequestMsg::kReportHit); + downReq->SetRequestID(static_cast(plClimbMsg::kDown)); downReq->Send(); - plLOSRequestMsg *leftReq = TRACKED_NEW plLOSRequestMsg(ourKey, start, left, plSimDefs::kLOSDBCustom, plLOSRequestMsg::kTestAny, plLOSRequestMsg::kReportHit); - leftReq->SetRequestID(static_cast(plClimbMsg::kLeft)); + plLOSRequestMsg *leftReq = new plLOSRequestMsg(ourKey, start, left, plSimDefs::kLOSDBCustom, plLOSRequestMsg::kTestAny, plLOSRequestMsg::kReportHit); + leftReq->SetRequestID(static_cast(plClimbMsg::kLeft)); leftReq->SetRequestType(plSimDefs::kLOSDBCustom); leftReq->Send(); - plLOSRequestMsg *rightReq = TRACKED_NEW plLOSRequestMsg(ourKey, start, right, plSimDefs::kLOSDBCustom, plLOSRequestMsg::kTestAny, plLOSRequestMsg::kReportHit); - rightReq->SetRequestID(static_cast(plClimbMsg::kRight)); + plLOSRequestMsg *rightReq = new plLOSRequestMsg(ourKey, start, right, plSimDefs::kLOSDBCustom, plLOSRequestMsg::kTestAny, plLOSRequestMsg::kReportHit); + rightReq->SetRequestID(static_cast(plClimbMsg::kRight)); rightReq->Send(); fOldPhysicallyBlockedDirections = fPhysicallyBlockedDirections; @@ -732,52 +732,52 @@ void plAvBrainClimb::ICalcProbeLengths() // --------------- hsBool plAvBrainClimb::IInitAnimations() { - fUp = TRACKED_NEW plAnimStage("WallClimbUp", + fUp = new plAnimStage("WallClimbUp", plAnimStage::kNotifyEnter, plAnimStage::kForwardAuto, plAnimStage::kBackNone, plAnimStage::kAdvanceAuto, plAnimStage::kRegressAuto, 0); - fDown = TRACKED_NEW plAnimStage("WallClimbDown", + fDown = new plAnimStage("WallClimbDown", plAnimStage::kNotifyEnter, plAnimStage::kForwardAuto, plAnimStage::kBackNone, plAnimStage::kAdvanceAuto, plAnimStage::kRegressAuto, 0); - fLeft = TRACKED_NEW plAnimStage("WallClimbLeft", + fLeft = new plAnimStage("WallClimbLeft", plAnimStage::kNotifyEnter, plAnimStage::kForwardAuto, plAnimStage::kBackNone, plAnimStage::kAdvanceAuto, plAnimStage::kRegressAuto, 0); - fRight = TRACKED_NEW plAnimStage("WallClimbRight", + fRight = new plAnimStage("WallClimbRight", plAnimStage::kNotifyEnter, plAnimStage::kForwardAuto, plAnimStage::kBackNone, plAnimStage::kAdvanceAuto, plAnimStage::kRegressAuto, 0); // the mounts - fMountUp = TRACKED_NEW plAnimStage("WallClimbMountUp", + fMountUp = new plAnimStage("WallClimbMountUp", plAnimStage::kNotifyEnter, plAnimStage::kForwardAuto, plAnimStage::kBackNone, plAnimStage::kAdvanceAuto, plAnimStage::kRegressNone, 0); - fMountDown = TRACKED_NEW plAnimStage("WallClimbMountDown", + fMountDown = new plAnimStage("WallClimbMountDown", plAnimStage::kNotifyEnter, plAnimStage::kForwardAuto, plAnimStage::kBackNone, plAnimStage::kAdvanceAuto, plAnimStage::kRegressNone, 0); - fMountLeft = TRACKED_NEW plAnimStage("WallClimbMountLeft", + fMountLeft = new plAnimStage("WallClimbMountLeft", plAnimStage::kNotifyEnter, plAnimStage::kForwardAuto, plAnimStage::kBackNone, plAnimStage::kAdvanceAuto, plAnimStage::kRegressNone, 0); - fMountRight = TRACKED_NEW plAnimStage("WallClimbMountRight", + fMountRight = new plAnimStage("WallClimbMountRight", plAnimStage::kNotifyEnter, plAnimStage::kForwardAuto, plAnimStage::kBackNone, plAnimStage::kAdvanceAuto, plAnimStage::kRegressNone, 0); // and here's the dismount - fDismountUp = TRACKED_NEW plAnimStage("WallClimbDismountUp", + fDismountUp = new plAnimStage("WallClimbDismountUp", plAnimStage::kNotifyEnter, plAnimStage::kForwardAuto, plAnimStage::kBackNone, plAnimStage::kAdvanceAuto, plAnimStage::kRegressNone, 0); - fDismountDown = TRACKED_NEW plAnimStage("WallClimbDismountDown", + fDismountDown = new plAnimStage("WallClimbDismountDown", plAnimStage::kNotifyEnter, plAnimStage::kForwardAuto, plAnimStage::kBackNone, plAnimStage::kAdvanceAuto, plAnimStage::kRegressNone, 0); - fDismountLeft = TRACKED_NEW plAnimStage("WallClimbDismountLeft", + fDismountLeft = new plAnimStage("WallClimbDismountLeft", plAnimStage::kNotifyEnter, plAnimStage::kForwardAuto, plAnimStage::kBackNone, plAnimStage::kAdvanceAuto, plAnimStage::kRegressNone, 0); - fDismountRight = TRACKED_NEW plAnimStage("WallClimbDismountUp", + fDismountRight = new plAnimStage("WallClimbDismountUp", plAnimStage::kNotifyEnter, plAnimStage::kForwardAuto, plAnimStage::kBackNone, plAnimStage::kAdvanceAuto, plAnimStage::kRegressNone, 0); // other - fIdle = TRACKED_NEW plAnimStage("WallClimbIdle", + fIdle = new plAnimStage("WallClimbIdle", plAnimStage::kNotifyEnter, plAnimStage::kForwardAuto, plAnimStage::kBackNone, plAnimStage::kAdvanceAuto, plAnimStage::kRegressNone, 0); - fRelease = TRACKED_NEW plAnimStage("WallClimbRelease", + fRelease = new plAnimStage("WallClimbRelease", plAnimStage::kNotifyEnter, plAnimStage::kForwardAuto, plAnimStage::kBackNone, plAnimStage::kAdvanceAuto, plAnimStage::kRegressNone, 0); - fFallOff = TRACKED_NEW plAnimStage("WallClimbFallOff", + fFallOff = new plAnimStage("WallClimbFallOff", plAnimStage::kNotifyEnter, plAnimStage::kForwardAuto, plAnimStage::kBackNone, plAnimStage::kAdvanceAuto, plAnimStage::kRegressNone, 0); return true; @@ -1049,4 +1049,4 @@ const char *plAvBrainClimb::ModeStr(Mode mode) default: return "WTF???!!!"; } -} \ No newline at end of file +} diff --git a/Sources/Plasma/PubUtilLib/plAvatar/plAvBrainClimb.h b/Sources/Plasma/PubUtilLib/plAvatar/plAvBrainClimb.h index de44ede3..ff149109 100644 --- a/Sources/Plasma/PubUtilLib/plAvatar/plAvBrainClimb.h +++ b/Sources/Plasma/PubUtilLib/plAvatar/plAvBrainClimb.h @@ -98,7 +98,7 @@ public: virtual void Activate(plArmatureModBase *avMod); virtual void Deactivate(); - virtual hsBool Apply(double timeNow, hsScalar elapsed); + virtual hsBool Apply(double timeNow, float elapsed); virtual void SaveToSDL(plStateDataRecord *sdl); virtual void LoadFromSDL(const plStateDataRecord *sdl); @@ -187,10 +187,10 @@ private: Mode fNextMode; plClimbMsg::Direction fDesiredDirection; // up / down / left / right float fControlDir; // 1.0 = move current stage forward -1.0 = move current stage back - UInt32 fAllowedDirections; - UInt32 fPhysicallyBlockedDirections; - UInt32 fOldPhysicallyBlockedDirections; // for debug display convenience - UInt32 fAllowedDismounts; + uint32_t fAllowedDirections; + uint32_t fPhysicallyBlockedDirections; + uint32_t fOldPhysicallyBlockedDirections; // for debug display convenience + uint32_t fAllowedDismounts; float fVerticalProbeLength; float fHorizontalProbeLength; diff --git a/Sources/Plasma/PubUtilLib/plAvatar/plAvBrainCoop.cpp b/Sources/Plasma/PubUtilLib/plAvatar/plAvBrainCoop.cpp index 6ce293e8..3728c72a 100644 --- a/Sources/Plasma/PubUtilLib/plAvatar/plAvBrainCoop.cpp +++ b/Sources/Plasma/PubUtilLib/plAvatar/plAvBrainCoop.cpp @@ -91,12 +91,12 @@ plAvBrainCoop::plAvBrainCoop() // plAvBrainCoop ---------------------------------------------------------- // -------------- -plAvBrainCoop::plAvBrainCoop(UInt32 exitFlags, float fadeIn, float fadeOut, +plAvBrainCoop::plAvBrainCoop(uint32_t exitFlags, float fadeIn, float fadeOut, MoveMode moveMode, plKey guestKey) : plAvBrainGeneric(exitFlags, fadeIn, fadeOut, moveMode), fGuestKey(guestKey) { - static UInt16 coopSerial = 0; + static uint16_t coopSerial = 0; // this particular constructor is only called by the initiator... fInitiatorID = plNetClientApp::GetInstance()->GetPlayerID(); @@ -105,8 +105,8 @@ plAvBrainCoop::plAvBrainCoop(UInt32 exitFlags, float fadeIn, float fadeOut, // plAvBrainCoop ---------------------------------------------------------- // -------------- -plAvBrainCoop::plAvBrainCoop(UInt32 exitFlags, float fadeIn, float fadeOut, - MoveMode moveMode, UInt32 initiatorID, UInt16 initiatorSerial, +plAvBrainCoop::plAvBrainCoop(uint32_t exitFlags, float fadeIn, float fadeOut, + MoveMode moveMode, uint32_t initiatorID, uint16_t initiatorSerial, plKey hostKey) : plAvBrainGeneric(exitFlags, fadeIn, fadeOut, moveMode), fInitiatorID(initiatorID), fInitiatorSerial(initiatorSerial), @@ -130,7 +130,7 @@ hsBool plAvBrainCoop::MsgReceive(plMessage *msg) if(localPlayer == fGuestKey) { - plAvCoopMsg *coopM = TRACKED_NEW plAvCoopMsg(plAvCoopMsg::kGuestAccepted, fInitiatorID, fInitiatorSerial); + plAvCoopMsg *coopM = new plAvCoopMsg(plAvCoopMsg::kGuestAccepted, fInitiatorID, fInitiatorSerial); coopM->SetBCastFlag(plMessage::kNetPropagate); coopM->Send(); @@ -181,14 +181,14 @@ void plAvBrainCoop::EnableGuestClick() // GetInitiatorID -------------------- // --------------- -UInt32 plAvBrainCoop::GetInitiatorID() +uint32_t plAvBrainCoop::GetInitiatorID() { return fInitiatorID; } // GetInitiatorSerial -------------------- // ------------------- -UInt16 plAvBrainCoop::GetInitiatorSerial() +uint16_t plAvBrainCoop::GetInitiatorSerial() { return fInitiatorSerial; } diff --git a/Sources/Plasma/PubUtilLib/plAvatar/plAvBrainCoop.h b/Sources/Plasma/PubUtilLib/plAvatar/plAvBrainCoop.h index 17e28d35..1d5848fe 100644 --- a/Sources/Plasma/PubUtilLib/plAvatar/plAvBrainCoop.h +++ b/Sources/Plasma/PubUtilLib/plAvatar/plAvBrainCoop.h @@ -57,11 +57,11 @@ public: plAvBrainCoop(); // use this constructor for a host brain; it sets up the unique ID - plAvBrainCoop(UInt32 exitFlags, float fadeIn, float fadeOut, MoveMode moveMode, plKey guestKey); + plAvBrainCoop(uint32_t exitFlags, float fadeIn, float fadeOut, MoveMode moveMode, plKey guestKey); // use this constructor for the guest brain, when you already have the unique ID - plAvBrainCoop(UInt32 exitFlags, float fadeIn, float fadeOut, MoveMode moveMode, - UInt32 initiatorID, UInt16 initiatorSerial, plKey hostKey); + plAvBrainCoop(uint32_t exitFlags, float fadeIn, float fadeOut, MoveMode moveMode, + uint32_t initiatorID, uint16_t initiatorSerial, plKey hostKey); hsBool MsgReceive(plMessage *msg); virtual bool RelayNotifyMsg(plNotifyMsg *msg); @@ -76,15 +76,15 @@ public: virtual void Write(hsStream *stream, hsResMgr *mgr); // stuff - UInt32 GetInitiatorID(); - UInt16 GetInitiatorSerial(); + uint32_t GetInitiatorID(); + uint16_t GetInitiatorSerial(); virtual plKey GetRecipient(); virtual void SetRecipient(plKey &recipient); private: - UInt32 fInitiatorID; - UInt16 fInitiatorSerial; + uint32_t fInitiatorID; + uint16_t fInitiatorSerial; plKey fGuestKey; // only filled out if we are the host plKey fHostKey; // only filled out if we are the guest diff --git a/Sources/Plasma/PubUtilLib/plAvatar/plAvBrainCritter.cpp b/Sources/Plasma/PubUtilLib/plAvatar/plAvBrainCritter.cpp index 7d5dc380..88003c14 100644 --- a/Sources/Plasma/PubUtilLib/plAvatar/plAvBrainCritter.cpp +++ b/Sources/Plasma/PubUtilLib/plAvatar/plAvBrainCritter.cpp @@ -39,8 +39,6 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com Mead, WA 99021 *==LICENSE==*/ -#include "hsConfig.h" -#include "hsWindows.h" #include "plAvCallbackAction.h" #include "plAvBrainCritter.h" @@ -83,7 +81,7 @@ public: fAvMod(nil), fCritterBrain(nil), fName(name), fRandomStartPoint(randomStart), fFadeInLength(fadeInLength), fFadeOutLength(fadeOutLength) {} virtual ~CritterBehavior() {} - void Init(plAGAnim* anim, hsBool loop, plAvBrainCritter* brain, plArmatureMod* body, UInt8 index) + void Init(plAGAnim* anim, hsBool loop, plAvBrainCritter* brain, plArmatureMod* body, uint8_t index) { plArmatureBehavior::Init(anim, loop, brain, body, index); fAvMod = body; @@ -93,8 +91,8 @@ public: virtual hsBool PreCondition(double time, float elapsed) {return true;} - hsScalar GetAnimLength() {return (fAnim->GetAnimation()->GetLength());} - void SetAnimTime(hsScalar time) {fAnim->SetCurrentTime(time, true);} + float GetAnimLength() {return (fAnim->GetAnimation()->GetLength());} + void SetAnimTime(float time) {fAnim->SetCurrentTime(time, true);} std::string Name() const {return fName;} std::string AnimName() const {return fAnimName;} @@ -131,7 +129,7 @@ plAvBrainCritter::plAvBrainCritter(): fCallbackAction(nil), fCurMode(kIdle), fNe fLocallyControlled(false), fAvoidingAvatars(false), fFinalGoalPos(0, 0, 0), fImmediateGoalPos(0, 0, 0), fDotGoal(0), fAngRight(0) { - SightCone(hsScalarPI/2); // 90deg + SightCone(M_PI/2); // 90deg StopDistance(1); SightDistance(10); HearingDistance(10); @@ -154,7 +152,7 @@ plAvBrainCritter::~plAvBrainCritter() /////////////////////////////////////////////////////////////////////////////// -hsBool plAvBrainCritter::Apply(double time, hsScalar elapsed) +hsBool plAvBrainCritter::Apply(double time, float elapsed) { // update internal pathfinding variables IEvalGoal(); @@ -195,12 +193,12 @@ void plAvBrainCritter::Activate(plArmatureModBase* avMod) plSceneObject* avObj = fArmature->GetTarget(0); plAGModifier* agMod = const_cast(plAGModifier::ConvertNoRef(FindModifierByClass(avObj, plAGModifier::Index()))); plPhysicalControllerCore* controller = avMod->GetController(); - fCallbackAction = TRACKED_NEW plWalkingController(avObj, agMod->GetApplicator(kAGPinTransform), controller); + fCallbackAction = new plWalkingController(avObj, agMod->GetApplicator(kAGPinTransform), controller); fCallbackAction->ActivateController(); } // tell people that care that we are good to go - plAIBrainCreatedMsg* brainCreated = TRACKED_NEW plAIBrainCreatedMsg(fArmature->GetKey()); + plAIBrainCreatedMsg* brainCreated = new plAIBrainCreatedMsg(fArmature->GetKey()); plgDispatch::MsgSend(brainCreated); } @@ -240,7 +238,7 @@ void plAvBrainCritter::AddBehavior(const std::string& animationName, const std:: return; // can't find it, die // create the behavior and set it up - CritterBehavior* behavior = TRACKED_NEW CritterBehavior(behaviorName, randomStartPos, fadeInLen, fadeOutLen); + CritterBehavior* behavior = new CritterBehavior(behaviorName, randomStartPos, fadeInLen, fadeOutLen); fBehaviors.Push(behavior); behavior->Init(anim, loop, this, fAvMod, fBehaviors.Count() - 1); fUserBehaviors[behaviorName].push_back(fBehaviors.Count() - 1); @@ -327,7 +325,7 @@ bool plAvBrainCritter::AtGoal() const return (finalGoalVec.MagnitudeSquared() <= fStopDistanceSquared); } -void plAvBrainCritter::SightCone(hsScalar coneRad) +void plAvBrainCritter::SightCone(float coneRad) { fSightConeAngle = coneRad; @@ -339,7 +337,7 @@ void plAvBrainCritter::SightCone(hsScalar coneRad) fSightConeDotMin = straightVector * viewVector; } -void plAvBrainCritter::HearingDistance(hsScalar hearDis) +void plAvBrainCritter::HearingDistance(float hearDis) { fHearingDistance = hearDis; fHearingDistanceSquared = fHearingDistance * fHearingDistance; @@ -461,14 +459,14 @@ hsBool plAvBrainCritter::IInitBaseAnimations() CritterBehavior* behavior; if (idle) { - fBehaviors[kIdle] = behavior = TRACKED_NEW CritterBehavior(kDefaultIdleBehName, true); // starts at a random start point each time + fBehaviors[kIdle] = behavior = new CritterBehavior(kDefaultIdleBehName, true); // starts at a random start point each time behavior->Init(idle, true, this, fAvMod, kIdle); fUserBehaviors[kDefaultIdleBehName].push_back(kIdle); } if (run) { - fBehaviors[kRun] = behavior = TRACKED_NEW CritterBehavior(kDefaultRunBehName); + fBehaviors[kRun] = behavior = new CritterBehavior(kDefaultRunBehName); behavior->Init(run, true, this, fAvMod, kRun); fUserBehaviors[kDefaultRunBehName].push_back(kRun); } @@ -533,7 +531,7 @@ void plAvBrainCritter::IStartBehavior() // if we start at a random point, do so if (behavior->RandomStartPoint()) { - hsScalar newStart = sRandom.RandZeroToOne() * behavior->GetAnimLength(); + float newStart = sRandom.RandZeroToOne() * behavior->GetAnimLength(); behavior->SetAnimTime(newStart); } @@ -584,7 +582,7 @@ void plAvBrainCritter::IEvalGoal() hsVector3 avVec(creaturePos - avPos); avVec.Normalize(); - hsScalar dotAv = avVec * goalVec; + float dotAv = avVec * goalVec; if (dotAv > 0.5f) // within a 45deg angle in front of us { // a player is in the way, so we will change our "goal" to a 90deg angle from the player @@ -608,7 +606,7 @@ void plAvBrainCritter::IEvalGoal() // tell everyone who cares that we have arrived for (unsigned i = 0; i < fReceivers.size(); ++i) { - plAIArrivedAtGoalMsg* msg = TRACKED_NEW plAIArrivedAtGoalMsg(fArmature->GetKey(), fReceivers[i]); + plAIArrivedAtGoalMsg* msg = new plAIArrivedAtGoalMsg(fArmature->GetKey(), fReceivers[i]); msg->Goal(fFinalGoalPos); msg->Send(); } @@ -616,7 +614,7 @@ void plAvBrainCritter::IEvalGoal() } } -hsScalar plAvBrainCritter::IGetTurnStrength(double time) const +float plAvBrainCritter::IGetTurnStrength(double time) const { if (!RunningBehavior(kDefaultRunBehName)) return 0.0f; @@ -673,7 +671,7 @@ bool plAvBrainCritter::ICanSeeAvatar(plArmatureMod* avatar) const const plSceneObject* creatureObj = fArmature->GetTarget(0); hsVector3 view(creatureObj->GetCoordinateInterface()->GetLocalToWorld().GetAxis(hsMatrix44::kView)); - hsScalar avDot = view * avVec; + float avDot = view * avVec; if (avDot < fSightConeDotMin) return false; // out of our cone of view return true; @@ -701,7 +699,7 @@ bool plAvBrainCritter::ICanHearAvatar(plArmatureMod* avatar) const fAvMod->GetPositionAndRotationSim(&creaturePos, &creatureRot); hsVector3 avVec(creaturePos - avPos); - hsScalar distSq = avVec.MagnitudeSquared(); + float distSq = avVec.MagnitudeSquared(); if (distSq <= fHearingDistanceSquared) return true; // within our normal hearing distance else if (isLoud && (distSq <= fLoudHearingDistanceSquared)) diff --git a/Sources/Plasma/PubUtilLib/plAvatar/plAvBrainCritter.h b/Sources/Plasma/PubUtilLib/plAvatar/plAvBrainCritter.h index afb2a369..96a0c5f0 100644 --- a/Sources/Plasma/PubUtilLib/plAvatar/plAvBrainCritter.h +++ b/Sources/Plasma/PubUtilLib/plAvatar/plAvBrainCritter.h @@ -75,7 +75,7 @@ public: CLASSNAME_REGISTER(plAvBrainCritter); GETINTERFACE_ANY(plAvBrainCritter, plArmatureBrain); - hsBool Apply(double time, hsScalar elapsed); + hsBool Apply(double time, float elapsed); hsBool MsgReceive(plMessage* msg); virtual void Activate(plArmatureModBase* avMod); @@ -104,15 +104,15 @@ public: bool AvoidingAvatars() const {return fAvoidingAvatars;} bool AtGoal() const; - void StopDistance(hsScalar stopDistance) {fStopDistance = stopDistance; fStopDistanceSquared = fStopDistance * fStopDistance;} - hsScalar StopDistance() const {return fStopDistance;} + void StopDistance(float stopDistance) {fStopDistance = stopDistance; fStopDistanceSquared = fStopDistance * fStopDistance;} + float StopDistance() const {return fStopDistance;} - void SightCone(hsScalar coneRad); - hsScalar SightCone() const {return fSightConeAngle;} - void SightDistance(hsScalar sightDis) {fSightDistance = sightDis; fSightDistanceSquared = fSightDistance * fSightDistance;} - hsScalar SightDistance() const {return fSightDistance;} - void HearingDistance(hsScalar hearDis); - hsScalar HearingDistance() const {return fHearingDistance;} + void SightCone(float coneRad); + float SightCone() const {return fSightConeAngle;} + void SightDistance(float sightDis) {fSightDistance = sightDis; fSightDistanceSquared = fSightDistance * fSightDistance;} + float SightDistance() const {return fSightDistance;} + void HearingDistance(float hearDis); + float HearingDistance() const {return fHearingDistance;} bool CanSeeAvatar(unsigned long id) const; bool CanHearAvatar(unsigned long id) const; @@ -142,7 +142,7 @@ protected: void IStartBehavior(); // fades in and initializes fNextMode, then sets fCurMode void IProcessBehavior(double time, float elapsed); // processes fCurMode void IEvalGoal(); - hsScalar IGetTurnStrength(double time) const; + float IGetTurnStrength(double time) const; std::vector IGetAgePlayerIDList() const; @@ -162,19 +162,19 @@ protected: bool fAvoidingAvatars; // are we avoiding avatars to the best of our ability when pathfinding? hsPoint3 fFinalGoalPos; // the location we are pathfinding to hsPoint3 fImmediateGoalPos; // the location of the point we are immediately going towards (not necessarily our final goal) - hsScalar fDotGoal; // dot product to our goal - hsScalar fAngRight; // dot product of our local right-hand vector to our goal - - hsScalar fStopDistance; // how close we need to get to our goal before stopping - hsScalar fStopDistanceSquared; // the above, squared, for faster calculation - - hsScalar fSightConeAngle; // in radians, the width of the cone we can see (/2 on each side of where we face, so 90deg cone is 45deg on each side) - hsScalar fSightConeDotMin; // the minimum dot-product of the cone we can see (1 - straight ahead only, 0 - 90deg either side, -1 - 180 behind, or full 360) - hsScalar fSightDistance; // how far away we can see (cone in front of us) - hsScalar fSightDistanceSquared; // the above, squared, for faster calculation - hsScalar fHearingDistance; // how far away we can hear (360 degrees) - hsScalar fHearingDistanceSquared; // the above, squared, for faster calculation - hsScalar fLoudHearingDistanceSquared; // how far away we can hear loud noises, squared, for faster calculation + float fDotGoal; // dot product to our goal + float fAngRight; // dot product of our local right-hand vector to our goal + + float fStopDistance; // how close we need to get to our goal before stopping + float fStopDistanceSquared; // the above, squared, for faster calculation + + float fSightConeAngle; // in radians, the width of the cone we can see (/2 on each side of where we face, so 90deg cone is 45deg on each side) + float fSightConeDotMin; // the minimum dot-product of the cone we can see (1 - straight ahead only, 0 - 90deg either side, -1 - 180 behind, or full 360) + float fSightDistance; // how far away we can see (cone in front of us) + float fSightDistanceSquared; // the above, squared, for faster calculation + float fHearingDistance; // how far away we can hear (360 degrees) + float fHearingDistanceSquared; // the above, squared, for faster calculation + float fLoudHearingDistanceSquared; // how far away we can hear loud noises, squared, for faster calculation std::map > fUserBehaviors; // string is behavior name, internal vector is the list of behaviors that are randomly picked from diff --git a/Sources/Plasma/PubUtilLib/plAvatar/plAvBrainDrive.cpp b/Sources/Plasma/PubUtilLib/plAvatar/plAvBrainDrive.cpp index fa2661e5..777b60ed 100644 --- a/Sources/Plasma/PubUtilLib/plAvatar/plAvBrainDrive.cpp +++ b/Sources/Plasma/PubUtilLib/plAvatar/plAvBrainDrive.cpp @@ -64,7 +64,7 @@ plAvBrainDrive::plAvBrainDrive() } // CTOR max velocity, turn rate -plAvBrainDrive::plAvBrainDrive(hsScalar maxVelocity, hsScalar turnRate) +plAvBrainDrive::plAvBrainDrive(float maxVelocity, float turnRate) : fMaxVelocity(maxVelocity), fTurnRate(turnRate) { } @@ -75,7 +75,7 @@ void plAvBrainDrive::Activate(plArmatureModBase *avMod) plArmatureBrain::Activate(avMod); IEnablePhysics(false, avMod->GetTarget(0)->GetKey()); - plCameraMsg* pMsg = TRACKED_NEW plCameraMsg; + plCameraMsg* pMsg = new plCameraMsg; pMsg->SetCmd(plCameraMsg::kNonPhysOn); pMsg->SetBCastFlag(plMessage::kBCastByExactType); pMsg->Send(); @@ -87,7 +87,7 @@ void plAvBrainDrive::Deactivate() if (fAvMod) { IEnablePhysics(true, fAvMod->GetTarget(0)->GetKey()); - plCameraMsg* pMsg = TRACKED_NEW plCameraMsg; + plCameraMsg* pMsg = new plCameraMsg; pMsg->SetCmd(plCameraMsg::kNonPhysOff); pMsg->SetBCastFlag(plMessage::kBCastByExactType); pMsg->Send(); @@ -100,17 +100,17 @@ void plAvBrainDrive::IEnablePhysics(bool enable, plKey avKey) } // APPLY -hsBool plAvBrainDrive::Apply(double timeNow, hsScalar elapsed) +hsBool plAvBrainDrive::Apply(double timeNow, float elapsed) { plSceneObject * avSO = fAvMod->GetTarget(0); - hsScalar eTime = hsTimer::GetDelSysSeconds(); + float eTime = hsTimer::GetDelSysSeconds(); hsMatrix44 targetMatrix = avSO->GetLocalToWorld(); hsPoint3 playerPos = targetMatrix.GetTranslate(); hsVector3 view, up, right; targetMatrix.GetAxis(&view, &up, &right); - hsScalar speed = fMaxVelocity; - hsScalar turn = fTurnRate; + float speed = fMaxVelocity; + float turn = fTurnRate; if (fAvMod->FastKeyDown()) { @@ -148,7 +148,7 @@ hsBool plAvBrainDrive::Apply(double timeNow, hsScalar elapsed) hsVector3 rotUp(0,0,1); hsVector3 rotRight(1,0,0); hsMatrix44 rot; - hsScalar angle = 0; + float angle = 0; if ( fAvMod->GetInputFlag( B_CONTROL_ROTATE_RIGHT ) || fAvMod->GetInputFlag( B_CONTROL_ROTATE_LEFT ) || fAvMod->GetInputFlag( A_CONTROL_TURN ) ) { diff --git a/Sources/Plasma/PubUtilLib/plAvatar/plAvBrainDrive.h b/Sources/Plasma/PubUtilLib/plAvatar/plAvBrainDrive.h index 335a7c17..25ded4c4 100644 --- a/Sources/Plasma/PubUtilLib/plAvatar/plAvBrainDrive.h +++ b/Sources/Plasma/PubUtilLib/plAvatar/plAvBrainDrive.h @@ -70,7 +70,7 @@ public: \param maxVelocity The highest speed this avatar can fly at. \param turnRate The speed at which we will turn, in radians per second. */ - plAvBrainDrive(hsScalar maxVelocity, hsScalar turnRate); + plAvBrainDrive(float maxVelocity, float turnRate); // BRAIN PROTOCOL @@ -81,7 +81,7 @@ public: virtual void Deactivate(); /** Look at the key states and figure out if and how we should move */ - virtual hsBool Apply(double timeNow, hsScalar elapsed); // main control loop. called by avatar eval() + virtual hsBool Apply(double timeNow, float elapsed); // main control loop. called by avatar eval() // the user brain base handles most of the details of control messages, // so this function just looks for the special command which gets us out @@ -94,8 +94,8 @@ public: protected: void IEnablePhysics(bool enable, plKey avKey); - hsScalar fMaxVelocity; - hsScalar fTurnRate; + float fMaxVelocity; + float fTurnRate; }; #endif // AVBRAINDRIVE_INC diff --git a/Sources/Plasma/PubUtilLib/plAvatar/plAvBrainGeneric.cpp b/Sources/Plasma/PubUtilLib/plAvatar/plAvBrainGeneric.cpp index 7535156c..37349445 100644 --- a/Sources/Plasma/PubUtilLib/plAvatar/plAvBrainGeneric.cpp +++ b/Sources/Plasma/PubUtilLib/plAvatar/plAvBrainGeneric.cpp @@ -76,14 +76,14 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #endif hsBool plAvBrainGeneric::fForce3rdPerson = true; -const hsScalar plAvBrainGeneric::kDefaultFadeIn = 6.f; // 1/6th of a second to fade in -const hsScalar plAvBrainGeneric::kDefaultFadeOut = 0.f; // instant fade out. +const float plAvBrainGeneric::kDefaultFadeIn = 6.f; // 1/6th of a second to fade in +const float plAvBrainGeneric::kDefaultFadeOut = 0.f; // instant fade out. // plAvBrainGeneric ---------------- // ----------------- plAvBrainGeneric::plAvBrainGeneric() : fRecipient(nil), - fStages(TRACKED_NEW plAnimStageVec), + fStages(new plAnimStageVec), fCurStage(0), fType(kGeneric), fExitFlags(kExitNormal), @@ -105,7 +105,7 @@ plAvBrainGeneric::plAvBrainGeneric(plAnimStageVec *stages, plMessage *startMessage, plMessage *endMessage, plKey recipient, - UInt32 exitFlags, + uint32_t exitFlags, float fadeIn, float fadeOut, MoveMode moveMode) @@ -128,7 +128,7 @@ plAvBrainGeneric::plAvBrainGeneric(plAnimStageVec *stages, } // plAvBrainGeneric -plAvBrainGeneric::plAvBrainGeneric(UInt32 exitFlags, float fadeIn, float fadeOut, MoveMode moveMode) +plAvBrainGeneric::plAvBrainGeneric(uint32_t exitFlags, float fadeIn, float fadeOut, MoveMode moveMode) : fRecipient(nil), fStages(nil), fCurStage(0), @@ -172,7 +172,7 @@ void plAvBrainGeneric::Activate(plArmatureModBase *avMod) if ((GetType() == kEmote || GetType() == kAFK || GetType() == kSitOnGround) && fAvMod->IsLocalAvatar()) { - plInputIfaceMgrMsg* msg = TRACKED_NEW plInputIfaceMgrMsg(plInputIfaceMgrMsg::kDisableClickables ); + plInputIfaceMgrMsg* msg = new plInputIfaceMgrMsg(plInputIfaceMgrMsg::kDisableClickables ); plgDispatch::MsgSend(msg); } @@ -208,7 +208,7 @@ void plAvBrainGeneric::Activate(plArmatureModBase *avMod) if (plAvBrainGeneric::fForce3rdPerson && fAvMod->IsLocalAvatar()) { // create message to force 3rd person mode - plCameraMsg* pMsg = TRACKED_NEW plCameraMsg; + plCameraMsg* pMsg = new plCameraMsg; pMsg->SetBCastFlag(plMessage::kBCastByExactType); pMsg->SetCmd(plCameraMsg::kResponderSetThirdPerson); pMsg->SetBCastFlag(plMessage::kNetPropagate, false); @@ -248,7 +248,7 @@ bool plAvBrainGeneric::MatchAnimNames(const char *names[], int count) // Apply ---------------------------------------------------- // ------ -hsBool plAvBrainGeneric::Apply(double time, hsScalar elapsed) +hsBool plAvBrainGeneric::Apply(double time, float elapsed) { hsBool result = false; @@ -307,7 +307,7 @@ void plAvBrainGeneric::Deactivate() if (plAvBrainGeneric::fForce3rdPerson && fAvMod->IsLocalAvatar()) { // create message to force 3rd person mode - plCameraMsg* pMsg = TRACKED_NEW plCameraMsg; + plCameraMsg* pMsg = new plCameraMsg; pMsg->SetBCastFlag(plMessage::kBCastByExactType); pMsg->SetBCastFlag(plMessage::kNetPropagate, false); pMsg->SetCmd(plCameraMsg::kResponderUndoThirdPerson); @@ -318,7 +318,7 @@ void plAvBrainGeneric::Deactivate() if ((GetType() == kEmote || GetType() == kAFK || GetType() == kSitOnGround) && fAvMod->IsLocalAvatar()) { - plInputIfaceMgrMsg* msg = TRACKED_NEW plInputIfaceMgrMsg(plInputIfaceMgrMsg::kEnableClickables ); + plInputIfaceMgrMsg* msg = new plInputIfaceMgrMsg(plInputIfaceMgrMsg::kEnableClickables ); plgDispatch::MsgSend(msg); } } @@ -491,7 +491,7 @@ hsBool plAvBrainGeneric::IProcessFadeOut(double time, float elapsed) // ISwitchStages --------------------------------------------------------------------------------------------------- // -------------- hsBool plAvBrainGeneric::ISwitchStages(int oldStageNum, int newStageNum, float delta, hsBool setTime, float newTime, - float fadeNew, hsScalar fadeOld, double worldTime) + float fadeNew, float fadeOld, double worldTime) { #ifdef DEBUG_MULTISTAGE char sbuf[256]; @@ -879,7 +879,7 @@ hsBool plAvBrainGeneric::LeaveAge() int plAvBrainGeneric::AddStage(plAnimStage *stage) { if(!fStages) - fStages = TRACKED_NEW plAnimStageVec; + fStages = new plAnimStageVec; fStages->push_back(stage); return fStages->size() - 1; } diff --git a/Sources/Plasma/PubUtilLib/plAvatar/plAvBrainGeneric.h b/Sources/Plasma/PubUtilLib/plAvatar/plAvBrainGeneric.h index 9ef43fa1..5677ee8e 100644 --- a/Sources/Plasma/PubUtilLib/plAvatar/plAvBrainGeneric.h +++ b/Sources/Plasma/PubUtilLib/plAvatar/plAvBrainGeneric.h @@ -118,8 +118,8 @@ public: kModeSize = 0xff } fMode; - static const hsScalar kDefaultFadeIn; - static const hsScalar kDefaultFadeOut; + static const float kDefaultFadeIn; + static const float kDefaultFadeOut; /** Default constructor for the class factory and descendants. */ plAvBrainGeneric(); @@ -133,14 +133,14 @@ public: \param recipient Callbacks from the brain *and* the stages is sent to this key. \param exitFlags A combination of exit conditions from the ExitFlag enum */ plAvBrainGeneric(plAnimStageVec *stages, plMessage *enterMessage, plMessage *exitMessage, - plKey recipient, UInt32 exitFlags, float fadeIn, float fadeOut, MoveMode moveMode); + plKey recipient, uint32_t exitFlags, float fadeIn, float fadeOut, MoveMode moveMode); /** Simplified constructor \param exitFlags Indicates which conditions will cause the brain to exit. \param fadeIn Rate (in blend units per second) of initial animation fade in. \param fadeOut Rate (in blend units per second) of final animation fade out. */ - plAvBrainGeneric(UInt32 exitFlags, float fadeIn, float fadeOut, MoveMode moveMode); + plAvBrainGeneric(uint32_t exitFlags, float fadeIn, float fadeOut, MoveMode moveMode); /** Virtual destructor */ virtual ~plAvBrainGeneric(); @@ -154,7 +154,7 @@ public: virtual void Activate(plArmatureModBase *avMod); /** Advance the current stage and swap in a new stage if necessary. */ - virtual hsBool Apply(double timeNow, hsScalar elapsed); + virtual hsBool Apply(double timeNow, float elapsed); /** Remove all our stages and release control of the armature. */ virtual void Deactivate(); @@ -239,7 +239,7 @@ public: /** Returns the bitvector holding our exit conditions. /sa plAvBrainGeneric::ExitFlags */ - UInt32 GetExitFlags() const { return fExitFlags; } + uint32_t GetExitFlags() const { return fExitFlags; } plAGAnim::BodyUsage GetBodyUsage(); void SetBodyUsage(plAGAnim::BodyUsage bodyUsage); @@ -283,8 +283,8 @@ protected: hsBool IProcessFadeIn(double time, float elapsed); hsBool IProcessFadeOut(double time, float elapsed); - hsBool ISwitchStages(int oldStage, int newStage, float delta, hsBool setTime, hsScalar newTime, - float fadeNew, hsScalar fadeOld, double worldTime); + hsBool ISwitchStages(int oldStage, int newStage, float delta, hsBool setTime, float newTime, + float fadeNew, float fadeOld, double worldTime); void IEnterMoveMode(double time); // we've just entered and we're about to begin animating. void IExitMoveMode(); // we're done animating; clean up @@ -299,7 +299,7 @@ protected: plAnimStageVec *fStages; // all the stages in our animation int fCurStage; // which stage are we playing? (zero-based) BrainType fType; // what type of brain are we? - UInt32 fExitFlags; // what will cause us to exit? + uint32_t fExitFlags; // what will cause us to exit? plHorizontalFreezeAction *fCallbackAction; bool fForward; // are we currently moving forward or backward through the stages? diff --git a/Sources/Plasma/PubUtilLib/plAvatar/plAvBrainHuman.cpp b/Sources/Plasma/PubUtilLib/plAvatar/plAvBrainHuman.cpp index e4a59f6c..0d1d292b 100644 --- a/Sources/Plasma/PubUtilLib/plAvatar/plAvBrainHuman.cpp +++ b/Sources/Plasma/PubUtilLib/plAvatar/plAvBrainHuman.cpp @@ -39,11 +39,9 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com Mead, WA 99021 *==LICENSE==*/ -#include "hsConfig.h" -#include "hsWindows.h" #include "plAvCallbackAction.h" // subclasses a havok object; must be in first include section - +#include "HeadSpin.h" #include "plAvBrainHuman.h" #include "plAvBrainClimb.h" @@ -64,7 +62,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "hsTimer.h" #include "hsGeometry3.h" -#include "float.h" + #include "plPipeline.h" #include "plgDispatch.h" #include "hsQuat.h" @@ -98,7 +96,7 @@ float plAvBrainHuman::fRunMaxTurnSpeed = 1.7; plAvBrainHuman::TurnCurve plAvBrainHuman::fWalkTurnCurve = plAvBrainHuman::kTurnExponential; plAvBrainHuman::TurnCurve plAvBrainHuman::fRunTurnCurve = plAvBrainHuman::kTurnExponential; -const hsScalar plAvBrainHuman::kAirTimePanicThreshold = 10; // seconds +const float plAvBrainHuman::kAirTimePanicThreshold = 10; // seconds void plAvBrainHuman::SetTimeToMaxTurn(float time, hsBool walk) { @@ -148,7 +146,7 @@ plAvBrainHuman::plAvBrainHuman(bool isActor /* = false */) : { } -hsBool plAvBrainHuman::Apply(double timeNow, hsScalar elapsed) +hsBool plAvBrainHuman::Apply(double timeNow, float elapsed) { #ifndef _DEBUG try @@ -184,7 +182,7 @@ void plAvBrainHuman::Activate(plArmatureModBase *avMod) plSceneObject* avObj = fArmature->GetTarget(0); plAGModifier* agMod = const_cast(plAGModifier::ConvertNoRef(FindModifierByClass(avObj, plAGModifier::Index()))); plPhysicalControllerCore* controller = avMod->GetController(); - fCallbackAction = TRACKED_NEW plWalkingController(avObj, agMod->GetApplicator(kAGPinTransform), controller); + fCallbackAction = new plWalkingController(avObj, agMod->GetApplicator(kAGPinTransform), controller); fCallbackAction->ActivateController(); } @@ -380,7 +378,7 @@ hsBool plAvBrainHuman::IHandleControlMsg(plControlEventMsg* msg) case B_CONTROL_TOGGLE_PHYSICAL: { #ifndef PLASMA_EXTERNAL_RELEASE // external clients can't go non-physical - plAvBrainDrive *driver = TRACKED_NEW plAvBrainDrive(20, 1); + plAvBrainDrive *driver = new plAvBrainDrive(20, 1); fAvMod->PushBrain(driver); #endif return true; @@ -453,7 +451,7 @@ hsBool plAvBrainHuman::MsgReceive(plMessage * msg) { if (swim->GetIsEntering()) { - plAvBrainSwim *swimBrain = TRACKED_NEW plAvBrainSwim(); + plAvBrainSwim *swimBrain = new plAvBrainSwim(); swimBrain->MsgReceive(swim); fAvMod->PushBrain(swimBrain); } @@ -468,13 +466,13 @@ hsBool plAvBrainHuman::MsgReceive(plMessage * msg) { if(ride->Entering()) { - //plAvBrainRideAnimatedPhysical *rideBrain = TRACKED_NEW plAvBrainRideAnimatedPhysical(); + //plAvBrainRideAnimatedPhysical *rideBrain = new plAvBrainRideAnimatedPhysical(); //fAvMod->PushBrain(rideBrain); delete fCallbackAction; plSceneObject* avObj = fArmature->GetTarget(0); plAGModifier* agMod = const_cast(plAGModifier::ConvertNoRef(FindModifierByClass(avObj, plAGModifier::Index()))); plPhysicalControllerCore* controller = fAvMod->GetController(); - fCallbackAction= TRACKED_NEW plRidingAnimatedPhysicalController(avObj, agMod->GetApplicator(kAGPinTransform), controller); + fCallbackAction= new plRidingAnimatedPhysicalController(avObj, agMod->GetApplicator(kAGPinTransform), controller); fCallbackAction->ActivateController(); } @@ -484,7 +482,7 @@ hsBool plAvBrainHuman::MsgReceive(plMessage * msg) plSceneObject* avObj = fArmature->GetTarget(0); plAGModifier* agMod = const_cast(plAGModifier::ConvertNoRef(FindModifierByClass(avObj, plAGModifier::Index()))); plPhysicalControllerCore* controller = fAvMod->GetController(); - fCallbackAction= TRACKED_NEW plWalkingController(avObj, agMod->GetApplicator(kAGPinTransform), controller); + fCallbackAction= new plWalkingController(avObj, agMod->GetApplicator(kAGPinTransform), controller); fCallbackAction->ActivateController(); //hsStatusMessage("Got an exiting ride animated physical message"); } @@ -500,7 +498,7 @@ hsBool plAvBrainHuman::IHandleClimbMsg(plClimbMsg *msg) { // let's build a seek task to get us to the attach point plKey seekTarget = msg->fTarget; - plAvTaskSeek *seekTask = TRACKED_NEW plAvTaskSeek(seekTarget); + plAvTaskSeek *seekTask = new plAvTaskSeek(seekTarget); QueueTask(seekTask); // now a brain task to start the actual climb. @@ -520,8 +518,8 @@ hsBool plAvBrainHuman::IHandleClimbMsg(plClimbMsg *msg) startMode = plAvBrainClimb::kMountingRight; break; } - plAvBrainClimb *brain = TRACKED_NEW plAvBrainClimb(startMode); - plAvTaskBrain *brainTask = TRACKED_NEW plAvTaskBrain(brain); + plAvBrainClimb *brain = new plAvBrainClimb(startMode); + plAvTaskBrain *brainTask = new plAvTaskBrain(brain); QueueTask(brainTask); } // ** potentially controversial: @@ -532,7 +530,7 @@ hsBool plAvBrainHuman::IHandleClimbMsg(plClimbMsg *msg) return true; } -hsScalar plAvBrainHuman::IGetTurnStrength(double timeNow) +float plAvBrainHuman::IGetTurnStrength(double timeNow) { float result = 0.f; float timeToMaxTurn, maxTurnSpeed; @@ -553,8 +551,8 @@ hsScalar plAvBrainHuman::IGetTurnStrength(double timeNow) plArmatureBehavior * turnLeft = fBehaviors.Count() >= kMovingTurnLeft ? fBehaviors[kMovingTurnLeft] : nil; plArmatureBehavior * turnRight = fBehaviors.Count() >= kMovingTurnRight ? fBehaviors[kMovingTurnRight] : nil; - hsScalar turnLeftStrength = turnLeft ? turnLeft->GetStrength() : 0.f; - hsScalar turnRightStrength = turnRight ? turnRight->GetStrength() : 0.f; + float turnLeftStrength = turnLeft ? turnLeft->GetStrength() : 0.f; + float turnRightStrength = turnRight ? turnRight->GetStrength() : 0.f; // Turning based on keypress @@ -607,14 +605,14 @@ hsBool plAvBrainHuman::IHandleTaskMsg(plAvTaskMsg *msg) if(seekM->fSmartSeek) { // use smart seek - plAvTaskSeek * seek = TRACKED_NEW plAvTaskSeek(seekM); + plAvTaskSeek * seek = new plAvTaskSeek(seekM); QueueTask(seek); } else if (!seekM->fNoSeek) { // use dumb seek - plAvSeekTask *seek = TRACKED_NEW plAvSeekTask(seekM->fSeekPoint, seekM->fAlignType, seekM->fAnimName); + plAvSeekTask *seek = new plAvSeekTask(seekM->fSeekPoint, seekM->fAlignType, seekM->fAnimName); QueueTask(seek); } // else don't seek at all. @@ -623,14 +621,14 @@ hsBool plAvBrainHuman::IHandleTaskMsg(plAvTaskMsg *msg) if(oneshotM) { // if it's a oneshot, add the oneshot task as well - plAvOneShotTask *oneshot = TRACKED_NEW plAvOneShotTask(oneshotM, fAvMod, this); + plAvOneShotTask *oneshot = new plAvOneShotTask(oneshotM, fAvMod, this); QueueTask(oneshot); } } else if (plAvPushBrainMsg *pushM = plAvPushBrainMsg::ConvertNoRef(msg)) { - plAvTaskBrain * push = TRACKED_NEW plAvTaskBrain(pushM->fBrain); + plAvTaskBrain * push = new plAvTaskBrain(pushM->fBrain); QueueTask(push); } else if (plAvPopBrainMsg *popM = plAvPopBrainMsg::ConvertNoRef(msg)) { - plAvTaskBrain * pop = TRACKED_NEW plAvTaskBrain(); + plAvTaskBrain * pop = new plAvTaskBrain(); QueueTask(pop); } else if (plAvTaskMsg *taskM = plAvTaskMsg::ConvertNoRef(msg)) { plAvTask *task = taskM->GetTask(); @@ -653,7 +651,7 @@ void plAvBrainHuman::IdleOnly(bool instantOff) if (!fCallbackAction) return; - hsScalar rate = instantOff ? 0.f : 1.f; + float rate = instantOff ? 0.f : 1.f; int i; for (i = kWalk; i < fBehaviors.GetCount(); i++) @@ -690,7 +688,7 @@ void plAvBrainHuman::TurnToPoint(hsPoint3 point) avPos = subworldCI->GetWorldToLocal() * avPos; } - plAvSeekMsg *msg = TRACKED_NEW plAvSeekMsg(nil, fAvMod->GetKey(), nil, 1.f, true); + plAvSeekMsg *msg = new plAvSeekMsg(nil, fAvMod->GetKey(), nil, 1.f, true); hsClearBits(msg->fFlags, plAvSeekMsg::kSeekFlagForce3rdPersonOnStart); hsSetBits(msg->fFlags, plAvSeekMsg::kSeekFlagNoWarpOnTimeout | plAvSeekMsg::kSeekFlagRotationOnly); msg->fTargetLookAt = point; @@ -707,10 +705,10 @@ void plAvBrainHuman::IChatOn() if (!fAvMod->FindAnimInstance(chatAnimName)) { plKey avKey = fAvMod->GetKey(); - plAvAnimTask *animTask = TRACKED_NEW plAvAnimTask(chatAnimName, 0.0, 1.0, 1.0, 0.0, true, true, true); + plAvAnimTask *animTask = new plAvAnimTask(chatAnimName, 0.0, 1.0, 1.0, 0.0, true, true, true); if (animTask) { - plAvTaskMsg *taskMsg = TRACKED_NEW plAvTaskMsg(avKey, avKey, animTask); + plAvTaskMsg *taskMsg = new plAvTaskMsg(avKey, avKey, animTask); taskMsg->SetBCastFlag(plMessage::kNetPropagate); taskMsg->Send(); } @@ -723,10 +721,10 @@ void plAvBrainHuman::IChatOff() { char *chatAnimName = fAvMod->MakeAnimationName("Talk"); plKey avKey = fAvMod->GetKey(); - plAvAnimTask *animTask = TRACKED_NEW plAvAnimTask(chatAnimName, -1.0); + plAvAnimTask *animTask = new plAvAnimTask(chatAnimName, -1.0); if (animTask) { - plAvTaskMsg *taskMsg = TRACKED_NEW plAvTaskMsg(avKey, avKey, animTask); + plAvTaskMsg *taskMsg = new plAvTaskMsg(avKey, avKey, animTask); taskMsg->SetBCastFlag(plMessage::kNetPropagate); taskMsg->Send(); } @@ -763,62 +761,62 @@ hsBool plAvBrainHuman::IInitAnimations() { plHBehavior *behavior; fBehaviors.SetCountAndZero(kHuBehaviorMax); - fBehaviors[kIdle] = behavior = TRACKED_NEW Idle; + fBehaviors[kIdle] = behavior = new Idle; behavior->Init(idle, true, this, fAvMod, kDefaultFade, kDefaultFade, kIdle, plHBehavior::kBehaviorTypeIdle); behavior->SetStrength(1.f, 0.f); - fBehaviors[kWalk] = behavior = TRACKED_NEW Walk; + fBehaviors[kWalk] = behavior = new Walk; behavior->Init(walk, true, this, fAvMod, kDefaultFade, 5.f, kWalk, plHBehavior::kBehaviorTypeWalk); - fBehaviors[kRun] = behavior = TRACKED_NEW Run; + fBehaviors[kRun] = behavior = new Run; behavior->Init(run, true, this, fAvMod, kDefaultFade, 2.0, kRun, plHBehavior::kBehaviorTypeRun); - fBehaviors[kWalkBack] = behavior = TRACKED_NEW WalkBack; + fBehaviors[kWalkBack] = behavior = new WalkBack; behavior->Init(walkBack, true, this, fAvMod, kDefaultFade, kDefaultFade, kWalkBack, plHBehavior::kBehaviorTypeWalkBack); - fBehaviors[kStandingTurnLeft] = behavior = TRACKED_NEW StandingTurnLeft; + fBehaviors[kStandingTurnLeft] = behavior = new StandingTurnLeft; behavior->Init(standingLeft, true, this, fAvMod, 3.0f, 6.0f, kStandingTurnLeft, plHBehavior::kBehaviorTypeTurnLeft); - fBehaviors[kStandingTurnRight] = behavior = TRACKED_NEW StandingTurnRight; + fBehaviors[kStandingTurnRight] = behavior = new StandingTurnRight; behavior->Init(standingRight, true, this, fAvMod, 3.0f, 6.0f, kStandingTurnRight, plHBehavior::kBehaviorTypeTurnRight); - fBehaviors[kStepLeft] = behavior = TRACKED_NEW StepLeft; + fBehaviors[kStepLeft] = behavior = new StepLeft; behavior->Init(stepLeft, true, this, fAvMod, kDefaultFade, kDefaultFade, kStepLeft, plHBehavior::kBehaviorTypeSidestepLeft); - fBehaviors[kStepRight] = behavior = TRACKED_NEW StepRight; + fBehaviors[kStepRight] = behavior = new StepRight; behavior->Init(stepRight, true, this, fAvMod, kDefaultFade, kDefaultFade, kStepRight, plHBehavior::kBehaviorTypeSidestepRight); // Warning: Changing the blend times of the jump animations will affect the path you take, because until we're fully blended, // we won't be using the full motion defined in the animation. This isn't an issue for standing jump, but you need to be // aware of it for the walk/run jumps. - fBehaviors[kFall] = behavior = TRACKED_NEW Fall; + fBehaviors[kFall] = behavior = new Fall; behavior->Init(fall, true, this, fAvMod, 1.0f, 10, kFall, plHBehavior::kBehaviorTypeFall); - fBehaviors[kStandingJump] = behavior = TRACKED_NEW StandingJump; + fBehaviors[kStandingJump] = behavior = new StandingJump; behavior->Init(standJump, false, this, fAvMod, kDefaultFade, kDefaultFade, kStandingJump, plHBehavior::kBehaviorTypeStandingJump); - fBehaviors[kWalkingJump] = behavior = TRACKED_NEW WalkingJump; + fBehaviors[kWalkingJump] = behavior = new WalkingJump; behavior->Init(walkJump, false, this, fAvMod, 10, 3.0, kWalkingJump, plHBehavior::kBehaviorTypeWalkingJump); - fBehaviors[kRunningJump] = behavior = TRACKED_NEW RunningJump; + fBehaviors[kRunningJump] = behavior = new RunningJump; behavior->Init(runJump, false, this, fAvMod, 10, 2.0, kRunningJump, plHBehavior::kBehaviorTypeRunningJump); - fBehaviors[kGroundImpact] = behavior = TRACKED_NEW GroundImpact; + fBehaviors[kGroundImpact] = behavior = new GroundImpact; behavior->Init(groundImpact, false, this, fAvMod, 6.0f, kDefaultFade, kGroundImpact, plHBehavior::kBehaviorTypeGroundImpact); - fBehaviors[kRunningImpact] = behavior = TRACKED_NEW RunningImpact; + fBehaviors[kRunningImpact] = behavior = new RunningImpact; behavior->Init(runningImpact, false, this, fAvMod, 6.0f, kDefaultFade, kRunningImpact, plHBehavior::kBehaviorTypeRunningImpact); - fBehaviors[kMovingTurnLeft] = behavior = TRACKED_NEW MovingTurnLeft; + fBehaviors[kMovingTurnLeft] = behavior = new MovingTurnLeft; behavior->Init(movingLeft, true, this, fAvMod, kDefaultFade, kDefaultFade, kMovingTurnLeft, plHBehavior::kBehaviorTypeMovingTurnLeft); - fBehaviors[kMovingTurnRight] = behavior = TRACKED_NEW MovingTurnRight; + fBehaviors[kMovingTurnRight] = behavior = new MovingTurnRight; behavior->Init(movingRight, true, this, fAvMod, kDefaultFade, kDefaultFade, kMovingTurnRight, plHBehavior::kBehaviorTypeMovingTurnRight); - fBehaviors[kPushWalk] = behavior = TRACKED_NEW PushWalk; + fBehaviors[kPushWalk] = behavior = new PushWalk; behavior->Init(pushWalk, true, this, fAvMod, kDefaultFade, kDefaultFade, kPushWalk, plHBehavior::kBehaviorTypePushWalk); - //fBehaviors[kPushIdle] = behavior = TRACKED_NEW PushIdle; + //fBehaviors[kPushIdle] = behavior = new PushIdle; //behavior->Init(pushIdle, true, this, fAvMod, kDefaultFade, kDefaultFade, kPushIdle, plHBehavior::kBehaviorTypePushIdle); result = true; @@ -881,7 +879,7 @@ hsBool plAvBrainHuman::LeaveAge() delete fCallbackAction; plSceneObject* avObj = fArmature->GetTarget(0); plAGModifier* agMod = const_cast(plAGModifier::ConvertNoRef(FindModifierByClass(avObj, plAGModifier::Index()))); - fCallbackAction= TRACKED_NEW plWalkingController(avObj, agMod->GetApplicator(kAGPinTransform), controller); + fCallbackAction= new plWalkingController(avObj, agMod->GetApplicator(kAGPinTransform), controller); fCallbackAction->ActivateController(); } plArmatureBrain::LeaveAge(); @@ -966,7 +964,7 @@ plHBehavior::~plHBehavior() void plHBehavior::Init(plAGAnim *anim, hsBool loop, plAvBrainHuman *brain, plArmatureMod *body, float fadeIn, float fadeOut, - UInt8 index, UInt32 type /* = 0 */) + uint8_t index, uint32_t type /* = 0 */) { plArmatureBehavior::Init(anim, loop, brain, body, index); fAvMod = body; @@ -1009,7 +1007,7 @@ void Idle::IStart() plHBehavior::IStart(); if (fAnim) { - hsScalar newStart = sRandom.RandZeroToOne() * fAnim->GetAnimation()->GetLength(); + float newStart = sRandom.RandZeroToOne() * fAnim->GetAnimation()->GetLength(); fAnim->SetCurrentTime(newStart, true); } } @@ -1329,12 +1327,12 @@ void Push::Process(double time, float elapsed) hsPoint3 lookAt; fHuBrain->fCallbackAction->GetPushingPhysical()->GetPositionSim(lookAt); hsVector3 up(0.f, 0.f, 1.f); - hsScalar angle = hsATan2(lookAt.fY - pos.fY, lookAt.fX - pos.fX) + hsScalarPI / 2; + float angle = atan2(lookAt.fY - pos.fY, lookAt.fX - pos.fX) + M_PI / 2; hsQuat targRot(angle, &up); - const hsScalar kTurnSpeed = 3.f; - hsScalar angDiff = QuatAngleDiff(rot, targRot); - hsScalar turnSpeed = (angDiff > elapsed * kTurnSpeed ? kTurnSpeed : angDiff / elapsed); + const float kTurnSpeed = 3.f; + float angDiff = QuatAngleDiff(rot, targRot); + float turnSpeed = (angDiff > elapsed * kTurnSpeed ? kTurnSpeed : angDiff / elapsed); hsQuat invRot = targRot.Conjugate(); hsPoint3 globFwd = invRot.Rotate(&kAvatarForward); @@ -1388,32 +1386,32 @@ bool PushSimpleMultiStage(plArmatureMod *avatar, const char *enterAnim, const ch // key. otherwise, we'll loop until someone sends a message telling us explicitly to advance plAnimStage::AdvanceType idleAdvance = autoExit ? plAnimStage::kAdvanceOnMove : plAnimStage::kAdvanceNone; - plAnimStageVec *v = TRACKED_NEW plAnimStageVec; - plAnimStage *s1 = TRACKED_NEW plAnimStage(enterAnim, + plAnimStageVec *v = new plAnimStageVec; + plAnimStage *s1 = new plAnimStage(enterAnim, 0, plAnimStage::kForwardAuto, plAnimStage::kBackNone, plAnimStage::kAdvanceAuto, plAnimStage::kRegressNone, 0); v->push_back(s1); - plAnimStage *s2 = TRACKED_NEW plAnimStage(idleAnim, 0, + plAnimStage *s2 = new plAnimStage(idleAnim, 0, plAnimStage::kForwardAuto, plAnimStage::kBackNone, idleAdvance, plAnimStage::kRegressNone, -1); v->push_back(s2); - plAnimStage *s3 = TRACKED_NEW plAnimStage(exitAnim, 0, + plAnimStage *s3 = new plAnimStage(exitAnim, 0, plAnimStage::kForwardAuto, plAnimStage::kBackNone, plAnimStage::kAdvanceAuto, plAnimStage::kRegressNone, 0); v->push_back(s3); - plAvBrainGeneric *b = TRACKED_NEW plAvBrainGeneric(v, nil, nil, nil, plAvBrainGeneric::kExitAnyTask | plAvBrainGeneric::kExitNewBrain, + plAvBrainGeneric *b = new plAvBrainGeneric(v, nil, nil, nil, plAvBrainGeneric::kExitAnyTask | plAvBrainGeneric::kExitNewBrain, 2.0f, 2.0f, plAvBrainGeneric::kMoveStandstill); b->SetBodyUsage(bodyUsage); b->SetType(type); - plAvTaskBrain *bt = TRACKED_NEW plAvTaskBrain(b); - plAvTaskMsg *btm = TRACKED_NEW plAvTaskMsg(plAvatarMgr::GetInstance()->GetKey(), avatar->GetKey(), bt); + plAvTaskBrain *bt = new plAvTaskBrain(b); + plAvTaskMsg *btm = new plAvTaskMsg(plAvatarMgr::GetInstance()->GetKey(), avatar->GetKey(), bt); if(netPropagate) btm->SetBCastFlag(plMessage::kNetPropagate); btm->Send(); @@ -1442,23 +1440,23 @@ bool AvatarEmote(plArmatureMod *avatar, const char *emoteName) plKey avKey = avatar->GetKey(); float fadeIn = emote->GetFadeIn(); float fadeOut = emote->GetFadeOut(); - plAnimStage *s1 = TRACKED_NEW plAnimStage(emoteName, + plAnimStage *s1 = new plAnimStage(emoteName, 0, plAnimStage::kForwardAuto, plAnimStage::kBackNone, plAnimStage::kAdvanceOnMove, plAnimStage::kRegressNone, 0); - plAnimStageVec *v = TRACKED_NEW plAnimStageVec; + plAnimStageVec *v = new plAnimStageVec; v->push_back(s1); - plAvBrainGeneric *b = TRACKED_NEW plAvBrainGeneric(v, nil, nil, nil, + plAvBrainGeneric *b = new plAvBrainGeneric(v, nil, nil, nil, plAvBrainGeneric::kExitAnyInput | plAvBrainGeneric::kExitNewBrain | plAvBrainGeneric::kExitAnyTask, 2.0f, 2.0f, huBrain->IsActor() ? plAvBrainGeneric::kMoveRelative : plAvBrainGeneric::kMoveStandstill); b->SetType(plAvBrainGeneric::kEmote); b->SetBodyUsage(emote->GetBodyUsage()); - plAvTaskBrain *bt = TRACKED_NEW plAvTaskBrain(b); - plAvTaskMsg *btm = TRACKED_NEW plAvTaskMsg(plAvatarMgr::GetInstance()->GetKey(), avKey, bt); + plAvTaskBrain *bt = new plAvTaskBrain(b); + plAvTaskMsg *btm = new plAvTaskMsg(plAvatarMgr::GetInstance()->GetKey(), avKey, bt); btm->SetBCastFlag(plMessage::kNetPropagate); btm->Send(); diff --git a/Sources/Plasma/PubUtilLib/plAvatar/plAvBrainHuman.h b/Sources/Plasma/PubUtilLib/plAvatar/plAvBrainHuman.h index c0473b36..2d093f8c 100644 --- a/Sources/Plasma/PubUtilLib/plAvatar/plAvBrainHuman.h +++ b/Sources/Plasma/PubUtilLib/plAvatar/plAvBrainHuman.h @@ -72,7 +72,7 @@ public: CLASSNAME_REGISTER( plAvBrainHuman ); GETINTERFACE_ANY( plAvBrainHuman, plArmatureBrain ); - virtual hsBool Apply(double timeNow, hsScalar elapsed); + virtual hsBool Apply(double timeNow, float elapsed); virtual void Activate(plArmatureModBase *avMod); virtual void Deactivate(); virtual void Suspend(); @@ -161,9 +161,9 @@ public: static void SetTurnCurve(TurnCurve curve, hsBool walk); static TurnCurve GetTurnCurve(hsBool walk); - static const hsScalar kControlledFlightThreshold; - static const hsScalar kAirTimeThreshold; - static const hsScalar kAirTimePanicThreshold; + static const float kControlledFlightThreshold; + static const float kAirTimeThreshold; + static const float kAirTimePanicThreshold; plWalkingController* fCallbackAction; protected: @@ -173,14 +173,14 @@ protected: virtual hsBool IHandleTaskMsg(plAvTaskMsg *msg); virtual hsBool IInitAnimations(); virtual void IInitBoneMap(); - hsScalar IGetTurnStrength(double timeNow); + float IGetTurnStrength(double timeNow); void IChatOn(); void IChatOff(); hsBool IValidateAnimations(); plAGModifier *fHandleAGMod; // the ag modifier that's attached to our top object double fStartedTurning; // when did we start turning? - UInt32 fPreconditions; + uint32_t fPreconditions; bool fIsActor; // are we an actor with special privileges? static float fWalkTimeToMaxTurn; static float fRunTimeToMaxTurn; @@ -237,9 +237,9 @@ public: ~plHBehavior(); void Init(plAGAnim *anim, hsBool loop, plAvBrainHuman *brain, plArmatureMod *body, - float fadeIn, float fadeOut, UInt8 index, UInt32 type = 0); + float fadeIn, float fadeOut, uint8_t index, uint32_t type = 0); virtual hsBool PreCondition(double time, float elapsed) { return true; } - UInt32 GetType() const { return fType; } + uint32_t GetType() const { return fType; } protected: virtual void IStart(); @@ -250,7 +250,7 @@ protected: float fFadeIn; // speed at which the animation fades in, in blend units per second float fFadeOut; // speed at which the animation fades out, in blend units per second float fMaxBlend; // the maximum blend the animation should reach - UInt32 fType; // (see the behaviorType enum) + uint32_t fType; // (see the behaviorType enum) bool fStartMsgSent; // flags to prevent multiple start and stop messages from being sent bool fStopMsgSent; diff --git a/Sources/Plasma/PubUtilLib/plAvatar/plAvBrainRideAnimatedPhysical.cpp b/Sources/Plasma/PubUtilLib/plAvatar/plAvBrainRideAnimatedPhysical.cpp index 5ec80cfc..f10bc7b8 100644 --- a/Sources/Plasma/PubUtilLib/plAvatar/plAvBrainRideAnimatedPhysical.cpp +++ b/Sources/Plasma/PubUtilLib/plAvatar/plAvBrainRideAnimatedPhysical.cpp @@ -57,7 +57,7 @@ void plAvBrainRideAnimatedPhysical::Activate(plArmatureModBase *avMod) plSceneObject* avObj = fArmature->GetTarget(0); plAGModifier* agMod = const_cast(plAGModifier::ConvertNoRef(FindModifierByClass(avObj, plAGModifier::Index()))); plPhysicalControllerCore* controller = avMod->GetController(); - fCallbackAction = TRACKED_NEW plRidingAnimatedPhysicalController(avObj, agMod->GetApplicator(kAGPinTransform), controller); + fCallbackAction = new plRidingAnimatedPhysicalController(avObj, agMod->GetApplicator(kAGPinTransform), controller); fCallbackAction->ActivateController(); } } @@ -118,62 +118,62 @@ hsBool plAvBrainRideAnimatedPhysical::IInitAnimations() { plHBehavior *behavior; fBehaviors.SetCountAndZero(kHuBehaviorMax); - fBehaviors[kIdle] = behavior = TRACKED_NEW Idle; + fBehaviors[kIdle] = behavior = new Idle; behavior->Init(idle, true, this, fAvMod, kDefaultFade, kDefaultFade, kIdle, plHBehavior::kBehaviorTypeIdle); behavior->SetStrength(1.f, 0.f); - fBehaviors[kWalk] = behavior = TRACKED_NEW Walk; + fBehaviors[kWalk] = behavior = new Walk; behavior->Init(walk, true, this, fAvMod, kDefaultFade, 5.f, kWalk, plHBehavior::kBehaviorTypeWalk); - fBehaviors[kRun] = behavior = TRACKED_NEW Run; + fBehaviors[kRun] = behavior = new Run; behavior->Init(run, true, this, fAvMod, kDefaultFade, 2.0, kRun, plHBehavior::kBehaviorTypeRun); - fBehaviors[kWalkBack] = behavior = TRACKED_NEW WalkBack; + fBehaviors[kWalkBack] = behavior = new WalkBack; behavior->Init(walkBack, true, this, fAvMod, kDefaultFade, kDefaultFade, kWalkBack, plHBehavior::kBehaviorTypeWalkBack); - fBehaviors[kStandingTurnLeft] = behavior = TRACKED_NEW StandingTurnLeft; + fBehaviors[kStandingTurnLeft] = behavior = new StandingTurnLeft; behavior->Init(standingLeft, true, this, fAvMod, 3.0f, 6.0f, kStandingTurnLeft, plHBehavior::kBehaviorTypeTurnLeft); - fBehaviors[kStandingTurnRight] = behavior = TRACKED_NEW StandingTurnRight; + fBehaviors[kStandingTurnRight] = behavior = new StandingTurnRight; behavior->Init(standingRight, true, this, fAvMod, 3.0f, 6.0f, kStandingTurnRight, plHBehavior::kBehaviorTypeTurnRight); - fBehaviors[kStepLeft] = behavior = TRACKED_NEW StepLeft; + fBehaviors[kStepLeft] = behavior = new StepLeft; behavior->Init(stepLeft, true, this, fAvMod, kDefaultFade, kDefaultFade, kStepLeft, plHBehavior::kBehaviorTypeSidestepLeft); - fBehaviors[kStepRight] = behavior = TRACKED_NEW StepRight; + fBehaviors[kStepRight] = behavior = new StepRight; behavior->Init(stepRight, true, this, fAvMod, kDefaultFade, kDefaultFade, kStepRight, plHBehavior::kBehaviorTypeSidestepRight); // Warning: Changing the blend times of the jump animations will affect the path you take, because until we're fully blended, // we won't be using the full motion defined in the animation. This isn't an issue for standing jump, but you need to be // aware of it for the walk/run jumps. - fBehaviors[kFall] = behavior = TRACKED_NEW Fall; + fBehaviors[kFall] = behavior = new Fall; behavior->Init(fall, true, this, fAvMod, 1.0f, 10, kFall, plHBehavior::kBehaviorTypeFall); - fBehaviors[kStandingJump] = behavior = TRACKED_NEW StandingJump; + fBehaviors[kStandingJump] = behavior = new StandingJump; behavior->Init(standJump, false, this, fAvMod, kDefaultFade, kDefaultFade, kStandingJump, plHBehavior::kBehaviorTypeStandingJump); - fBehaviors[kWalkingJump] = behavior = TRACKED_NEW WalkingJump; + fBehaviors[kWalkingJump] = behavior = new WalkingJump; behavior->Init(walkJump, false, this, fAvMod, 10, 3.0, kWalkingJump, plHBehavior::kBehaviorTypeWalkingJump); - fBehaviors[kRunningJump] = behavior = TRACKED_NEW RunningJump; + fBehaviors[kRunningJump] = behavior = new RunningJump; behavior->Init(runJump, false, this, fAvMod, 10, 2.0, kRunningJump, plHBehavior::kBehaviorTypeRunningJump); - fBehaviors[kGroundImpact] = behavior = TRACKED_NEW GroundImpact; + fBehaviors[kGroundImpact] = behavior = new GroundImpact; behavior->Init(groundImpact, false, this, fAvMod, 6.0f, kDefaultFade, kGroundImpact, plHBehavior::kBehaviorTypeGroundImpact); - fBehaviors[kRunningImpact] = behavior = TRACKED_NEW RunningImpact; + fBehaviors[kRunningImpact] = behavior = new RunningImpact; behavior->Init(runningImpact, false, this, fAvMod, 6.0f, kDefaultFade, kRunningImpact, plHBehavior::kBehaviorTypeRunningImpact); - fBehaviors[kMovingTurnLeft] = behavior = TRACKED_NEW MovingTurnLeft; + fBehaviors[kMovingTurnLeft] = behavior = new MovingTurnLeft; behavior->Init(movingLeft, true, this, fAvMod, kDefaultFade, kDefaultFade, kMovingTurnLeft, plHBehavior::kBehaviorTypeMovingTurnLeft); - fBehaviors[kMovingTurnRight] = behavior = TRACKED_NEW MovingTurnRight; + fBehaviors[kMovingTurnRight] = behavior = new MovingTurnRight; behavior->Init(movingRight, true, this, fAvMod, kDefaultFade, kDefaultFade, kMovingTurnRight, plHBehavior::kBehaviorTypeMovingTurnRight); - fBehaviors[kPushWalk] = behavior = TRACKED_NEW PushWalk; + fBehaviors[kPushWalk] = behavior = new PushWalk; behavior->Init(pushWalk, true, this, fAvMod, kDefaultFade, kDefaultFade, kPushWalk, plHBehavior::kBehaviorTypePushWalk); - //fBehaviors[kPushIdle] = behavior = TRACKED_NEW PushIdle; + //fBehaviors[kPushIdle] = behavior = new PushIdle; //behavior->Init(pushIdle, true, this, fAvMod, kDefaultFade, kDefaultFade, kPushIdle, plHBehavior::kBehaviorTypePushIdle); result = true; @@ -184,7 +184,7 @@ hsBool plAvBrainRideAnimatedPhysical::LeaveAge() { return plArmatureBrain::LeaveAge(); } -hsBool plAvBrainRideAnimatedPhysical::Apply(double timeNow, hsScalar elapsed) +hsBool plAvBrainRideAnimatedPhysical::Apply(double timeNow, float elapsed) { if(this->fMode==kAbort) return false; else return plAvBrainHuman::Apply(timeNow, elapsed); diff --git a/Sources/Plasma/PubUtilLib/plAvatar/plAvBrainRideAnimatedPhysical.h b/Sources/Plasma/PubUtilLib/plAvatar/plAvBrainRideAnimatedPhysical.h index b4e962b4..d3eb0817 100644 --- a/Sources/Plasma/PubUtilLib/plAvatar/plAvBrainRideAnimatedPhysical.h +++ b/Sources/Plasma/PubUtilLib/plAvatar/plAvBrainRideAnimatedPhysical.h @@ -58,7 +58,7 @@ public: virtual void Deactivate(); virtual hsBool MsgReceive(plMessage *msg); virtual hsBool LeaveAge(); - virtual hsBool Apply(double timeNow, hsScalar elapsed); + virtual hsBool Apply(double timeNow, float elapsed); protected: hsBool IInitAnimations(); mode fMode; diff --git a/Sources/Plasma/PubUtilLib/plAvatar/plAvBrainSwim.cpp b/Sources/Plasma/PubUtilLib/plAvatar/plAvBrainSwim.cpp index 27d71f91..884a0f68 100644 --- a/Sources/Plasma/PubUtilLib/plAvatar/plAvBrainSwim.cpp +++ b/Sources/Plasma/PubUtilLib/plAvatar/plAvBrainSwim.cpp @@ -91,7 +91,7 @@ public: plSwimBehavior() : fAvMod(nil), fSwimBrain(nil) {} virtual ~plSwimBehavior() {} - void Init(plAGAnim *anim, hsBool loop, plAvBrainSwim *brain, plArmatureMod *body, UInt8 index) + void Init(plAGAnim *anim, hsBool loop, plAvBrainSwim *brain, plArmatureMod *body, uint8_t index) { plArmatureBehavior::Init(anim, loop, brain, body, index); fAvMod = body; @@ -234,14 +234,14 @@ public: /////////////////////////////////////////////////////////////////////////////////////////// -const hsScalar plAvBrainSwim::kMinSwimDepth = 4.0f; +const float plAvBrainSwim::kMinSwimDepth = 4.0f; plAvBrainSwim::plAvBrainSwim() : fCallbackAction(nil), fMode(kWalking), fSurfaceDistance(0.f) { - fSurfaceProbeMsg = TRACKED_NEW plLOSRequestMsg(); + fSurfaceProbeMsg = new plLOSRequestMsg(); fSurfaceProbeMsg->SetReportType(plLOSRequestMsg::kReportHitOrMiss); fSurfaceProbeMsg->SetRequestType(plSimDefs::kLOSDBSwimRegion); fSurfaceProbeMsg->SetTestType(plLOSRequestMsg::kTestAny); @@ -263,7 +263,7 @@ plAvBrainSwim::~plAvBrainSwim() delete fBehaviors[i]; } -hsBool plAvBrainSwim::Apply(double time, hsScalar elapsed) +hsBool plAvBrainSwim::Apply(double time, float elapsed) { IProbeSurface(); if (fMode == kWalking) @@ -277,13 +277,13 @@ hsBool plAvBrainSwim::Apply(double time, hsScalar elapsed) if (huBrain && !huBrain->fCallbackAction->IsOnGround()) { // We're jumping in! Trigger splash effect (sound) - plArmatureEffectMsg *msg = TRACKED_NEW plArmatureEffectMsg(fAvMod->GetArmatureEffects()->GetKey(), kTime); - msg->fEventTime = (hsScalar)time; + plArmatureEffectMsg *msg = new plArmatureEffectMsg(fAvMod->GetArmatureEffects()->GetKey(), kTime); + msg->fEventTime = (float)time; msg->fTriggerIdx = plArmatureMod::kImpact; - plEventCallbackInterceptMsg *iMsg = TRACKED_NEW plEventCallbackInterceptMsg; + plEventCallbackInterceptMsg *iMsg = new plEventCallbackInterceptMsg; iMsg->AddReceiver(fAvMod->GetArmatureEffects()->GetKey()); - iMsg->fEventTime = (hsScalar)time; + iMsg->fEventTime = (float)time; iMsg->fEvent = kTime; iMsg->SetMessage(msg); iMsg->Send(); @@ -381,7 +381,7 @@ hsBool plAvBrainSwim::MsgReceive(plMessage *msg) if (!seekM->fNoSeek) { // use dumb seek - plAvSeekTask *seek = TRACKED_NEW plAvSeekTask(seekM->fSeekPoint, seekM->fAlignType, seekM->fAnimName); + plAvSeekTask *seek = new plAvSeekTask(seekM->fSeekPoint, seekM->fAlignType, seekM->fAnimName); QueueTask(seek); } // else don't seek at all. @@ -390,7 +390,7 @@ hsBool plAvBrainSwim::MsgReceive(plMessage *msg) if(oneshotM) { // if it's a oneshot, add the oneshot task as well - plAvOneShotTask *oneshot = TRACKED_NEW plAvOneShotTask(oneshotM, fAvMod, this); + plAvOneShotTask *oneshot = new plAvOneShotTask(oneshotM, fAvMod, this); QueueTask(oneshot); } return true; @@ -464,7 +464,7 @@ void plAvBrainSwim::IStartWading() if (fAvMod->IsLocalAvatar()) { - plCameraMsg* pMsg = TRACKED_NEW plCameraMsg; + plCameraMsg* pMsg = new plCameraMsg; pMsg->SetBCastFlag(plMessage::kBCastByExactType); pMsg->SetBCastFlag(plMessage::kNetPropagate, false); pMsg->SetCmd(plCameraMsg::kResponderUndoThirdPerson); @@ -487,7 +487,7 @@ void plAvBrainSwim::IStartSwimming(bool is2D) if (fAvMod->IsLocalAvatar()) { - plCameraMsg* pMsg = TRACKED_NEW plCameraMsg; + plCameraMsg* pMsg = new plCameraMsg; pMsg->SetBCastFlag(plMessage::kBCastByExactType); pMsg->SetBCastFlag(plMessage::kNetPropagate, false); pMsg->SetCmd(plCameraMsg::kResponderSetThirdPerson); @@ -535,34 +535,34 @@ hsBool plAvBrainSwim::IInitAnimations() static const float defaultFade = 2.0f; fBehaviors.SetCountAndZero(kSwimBehaviorMax); plSwimBehavior *behavior; - fBehaviors[kTreadWater] = behavior = TRACKED_NEW TreadWater; + fBehaviors[kTreadWater] = behavior = new TreadWater; behavior->Init(treadWater, true, this, fAvMod, kTreadWater); - fBehaviors[kSwimForward] = behavior = TRACKED_NEW SwimForward; + fBehaviors[kSwimForward] = behavior = new SwimForward; behavior->Init(swimForward, true, this, fAvMod, kSwimForward); - fBehaviors[kSwimForwardFast] = behavior = TRACKED_NEW SwimForwardFast; + fBehaviors[kSwimForwardFast] = behavior = new SwimForwardFast; behavior->Init(swimForwardFast, true, this, fAvMod, kSwimForwardFast); - fBehaviors[kSwimBack] = behavior = TRACKED_NEW SwimBack; + fBehaviors[kSwimBack] = behavior = new SwimBack; behavior->Init(swimBack, true, this, fAvMod, kSwimBack); - fBehaviors[kSwimLeft] = behavior = TRACKED_NEW SwimLeft; + fBehaviors[kSwimLeft] = behavior = new SwimLeft; behavior->Init(swimLeft, true, this, fAvMod, kSwimLeft); - fBehaviors[kSwimRight] = behavior = TRACKED_NEW SwimRight; + fBehaviors[kSwimRight] = behavior = new SwimRight; behavior->Init(swimRight, true, this, fAvMod, kSwimRight); - fBehaviors[kSwimTurnLeft] = behavior = TRACKED_NEW SwimTurnLeft; + fBehaviors[kSwimTurnLeft] = behavior = new SwimTurnLeft; behavior->Init(nil, true, this, fAvMod, kSwimTurnLeft); - fBehaviors[kSwimTurnRight] = behavior = TRACKED_NEW SwimTurnRight; + fBehaviors[kSwimTurnRight] = behavior = new SwimTurnRight; behavior->Init(nil, true, this, fAvMod, kSwimTurnRight); - fBehaviors[kTreadTurnLeft] = behavior = TRACKED_NEW TreadTurnLeft; + fBehaviors[kTreadTurnLeft] = behavior = new TreadTurnLeft; behavior->Init(treadWaterLeft, true, this, fAvMod, kTreadTurnLeft); - fBehaviors[kTreadTurnRight] = behavior = TRACKED_NEW TreadTurnRight; + fBehaviors[kTreadTurnRight] = behavior = new TreadTurnRight; behavior->Init(treadWaterRight, true, this, fAvMod, kTreadTurnRight); return true; @@ -641,7 +641,7 @@ hsBool plAvBrainSwim::IHandleControlMsg(plControlEventMsg* msg) case B_CONTROL_TOGGLE_PHYSICAL: { #ifndef PLASMA_EXTERNAL_RELEASE // external clients can't go non-physical - plAvBrainDrive *driver = TRACKED_NEW plAvBrainDrive(20, 1); + plAvBrainDrive *driver = new plAvBrainDrive(20, 1); fAvMod->PushBrain(driver); #endif return true; @@ -687,7 +687,7 @@ void plAvBrainSwim::DumpToDebugDisplay(int &x, int &y, int lineHeight, char *str // fAvMod->GetPhysical()->GetLinearVelocitySim(linV); // hsVector3 angV; // fAvMod->GetPhysical()->GetAngularVelocitySim(angV); -// hsScalar angle = angV.fZ > 0 ? angV.Magnitude() : -angV.Magnitude(); +// float angle = angV.fZ > 0 ? angV.Magnitude() : -angV.Magnitude(); // sprintf(strBuf, "Velocity: Linear (%5.2f, %5.2f, %5.2f), Angular %5.2f", linV.fX, linV.fY, linV.fZ, angle); // debugTxt.DrawString(x, y, strBuf); // y += lineHeight; diff --git a/Sources/Plasma/PubUtilLib/plAvatar/plAvBrainSwim.h b/Sources/Plasma/PubUtilLib/plAvatar/plAvBrainSwim.h index bd605a93..3d41dc5f 100644 --- a/Sources/Plasma/PubUtilLib/plAvatar/plAvBrainSwim.h +++ b/Sources/Plasma/PubUtilLib/plAvatar/plAvBrainSwim.h @@ -62,7 +62,7 @@ public: GETINTERFACE_ANY( plAvBrainSwim, plArmatureBrain ); virtual void Activate(plArmatureModBase *avMod); - hsBool Apply(double time, hsScalar elapsed); + hsBool Apply(double time, float elapsed); virtual void Deactivate(); virtual void Suspend(); virtual void Resume(); @@ -71,10 +71,10 @@ public: bool IsWalking(); bool IsWading(); bool IsSwimming(); - hsScalar GetSurfaceDistance() { return fSurfaceDistance; } + float GetSurfaceDistance() { return fSurfaceDistance; } plSwimmingController *fCallbackAction; - static const hsScalar kMinSwimDepth; + static const float kMinSwimDepth; protected: void IStartWading(); diff --git a/Sources/Plasma/PubUtilLib/plAvatar/plAvCallbackAction.cpp b/Sources/Plasma/PubUtilLib/plAvatar/plAvCallbackAction.cpp index 5a7e5191..946721a2 100644 --- a/Sources/Plasma/PubUtilLib/plAvatar/plAvCallbackAction.cpp +++ b/Sources/Plasma/PubUtilLib/plAvatar/plAvCallbackAction.cpp @@ -49,7 +49,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // Generic geom utils. hsBool LinearVelocity(hsVector3 &outputV, float elapsed, hsMatrix44 &prevMat, hsMatrix44 &curMat); -void AngularVelocity(hsScalar &outputV, float elapsed, hsMatrix44 &prevMat, hsMatrix44 &curMat); +void AngularVelocity(float &outputV, float elapsed, hsMatrix44 &prevMat, hsMatrix44 &curMat); float AngleRad2d (float x1, float y1, float x3, float y3); inline hsVector3 GetYAxis(hsMatrix44 &mat) { @@ -98,7 +98,7 @@ void plAnimatedController::RecalcVelocity(double timeNow, double timePrev, hsBoo /////////////////////////////////////////////////////////////////////////// -const hsScalar plWalkingController::kControlledFlightThreshold = 1.f; // seconds +const float plWalkingController::kControlledFlightThreshold = 1.f; // seconds plWalkingController::plWalkingController(plSceneObject* rootObject, plAGApplicator* rootApp, plPhysicalControllerCore* controller) : plAnimatedController(rootObject, rootApp, controller) @@ -113,7 +113,7 @@ plWalkingController::plWalkingController(plSceneObject* rootObject, plAGApplicat { if (fController) { - fWalkingStrategy= TRACKED_NEW plWalkingStrategy(fController); + fWalkingStrategy= new plWalkingStrategy(fController); fController->SetMovementSimulationInterface(fWalkingStrategy); } else @@ -178,7 +178,7 @@ void plWalkingController::Reset(bool newAge) } else { - fWalkingStrategy= TRACKED_NEW plWalkingStrategy(fController); + fWalkingStrategy= new plWalkingStrategy(fController); fWalkingStrategy->RefreshConnectionToControllerCore(); } @@ -227,7 +227,7 @@ void plWalkingController::Update() continue; // Physical no longer exists. Skip it. const Havok::ContactPoint *contact = fPhysical->GetContactPoint(i); - hsScalar dotUp = straightUp.dot(contact->m_normal); + float dotUp = straightUp.dot(contact->m_normal); if (dotUp > .5) ground = true; else if (contactPhys->GetProperty(plSimulationInterface::kAvAnimPushable)) @@ -258,7 +258,7 @@ void plWalkingController::Update() // has to overcome friction). I deal with that by making the threshold (360 - (180 - 60) = 240). I've // seen up to 220 reached in actual gameplay in a situation where we'd want this to take effect. // This is the same running into 2 walls where the angle between them is 60. - const hsScalar threshold = hsScalarDegToRad(240); + const float threshold = hsDegreesToRadians(240); if (!ground && numContacts >= 2) { // Can probably do a special case for exactly 2 contacts. Not sure if it's worth it... @@ -267,7 +267,7 @@ void plWalkingController::Update() for (i = 0; i < numContacts; i++) { const Havok::ContactPoint *contact = fPhysical->GetContactPoint(i); - fCollisionAngles[i] = hsATan2(contact->m_normal.y, contact->m_normal.x); + fCollisionAngles[i] = atan2(contact->m_normal.y, contact->m_normal.x); } // numContacts is rarely larger than 6, so let's do a simple bubble sort. @@ -277,7 +277,7 @@ void plWalkingController::Update() { if (fCollisionAngles[i] > fCollisionAngles[j]) { - hsScalar tempAngle = fCollisionAngles[i]; + float tempAngle = fCollisionAngles[i]; fCollisionAngles[i] = fCollisionAngles[j]; fCollisionAngles[j] = tempAngle; } @@ -294,7 +294,7 @@ void plWalkingController::Update() if (i == numContacts) { // We got to the end. Check the last with the first and make your decision. - if (!(fCollisionAngles[0] - fCollisionAngles[numContacts - 1] >= (threshold - 2 * hsScalarPI))) + if (!(fCollisionAngles[0] - fCollisionAngles[numContacts - 1] >= (threshold - 2 * M_PI))) ground = true; } } @@ -307,7 +307,7 @@ void plWalkingController::Update() fHitGroundInThisAge = true; // if we're not pinned and we're not in an age yet, we are now. if (IsControlledFlight()) - fControlledFlightTime += (hsScalar)elapsed; + fControlledFlightTime += (float)elapsed; if (fControlledFlightTime > kControlledFlightThreshold && numContacts > 0) EnableControlledFlight(false); @@ -321,7 +321,7 @@ void plWalkingController::Update() // hsVector3 vel; // fPhysical->GetLinearVelocitySim(vel); // fImpactVel = vel.fZ; -// fTimeInAirPeak = (hsScalar)(fTimeInAir + elapsed); +// fTimeInAirPeak = (float)(fTimeInAir + elapsed); // } fWaitingForGround = false; @@ -334,7 +334,7 @@ void plWalkingController::Update() // collisions, which could trick us into thinking we've just gone a long // time without hitting ground. So we only count the time if this wasn't // the case. - fTimeInAir += (hsScalar)elapsed; + fTimeInAir += (float)elapsed; } @@ -385,7 +385,7 @@ void plHorizontalFreezeAction::apply(Havok::Subspace &s, Havok::hkTime time) for(i = 0; i < numContacts; i++) { const Havok::ContactPoint *contact = fPhysical->GetContactPoint(i); - hsScalar dotUp = straightUp.dot(contact->m_normal); + float dotUp = straightUp.dot(contact->m_normal); if (dotUp > .5) ground = true; } @@ -404,7 +404,7 @@ plSwimmingController::plSwimmingController(plSceneObject* rootObject, plAGApplic :plAnimatedController(rootObject,rootApp,controller) { if (controller) - fSwimmingStrategy= TRACKED_NEW plSwimStrategy(controller); + fSwimmingStrategy= new plSwimStrategy(controller); else fSwimmingStrategy = nil; } @@ -417,7 +417,7 @@ plRidingAnimatedPhysicalController::plRidingAnimatedPhysicalController(plSceneOb : plWalkingController(rootObject, rootApp, controller) { if(controller) - fWalkingStrategy = TRACKED_NEW plRidingAnimatedPhysicalStrategy(controller); + fWalkingStrategy = new plRidingAnimatedPhysicalStrategy(controller); else fWalkingStrategy = nil; } @@ -540,22 +540,22 @@ static hsBool LinearVelocity(hsVector3 &outputV, float elapsed, hsMatrix44 &prev return result; } -static void AngularVelocity(hsScalar &outputV, float elapsed, hsMatrix44 &prevMat, hsMatrix44 &curMat) +static void AngularVelocity(float &outputV, float elapsed, hsMatrix44 &prevMat, hsMatrix44 &curMat) { outputV = 0.f; - hsScalar appliedVelocity = 0.0f; + float appliedVelocity = 0.0f; hsVector3 prevForward = GetYAxis(prevMat); hsVector3 curForward = GetYAxis(curMat); - hsScalar angleSincePrev = AngleRad2d(curForward.fX, curForward.fY, prevForward.fX, prevForward.fY); + float angleSincePrev = AngleRad2d(curForward.fX, curForward.fY, prevForward.fX, prevForward.fY); hsBool sincePrevSign = angleSincePrev > 0.0f; - if (angleSincePrev > hsScalarPI) + if (angleSincePrev > M_PI) angleSincePrev = angleSincePrev - TWO_PI; const hsVector3 startForward = hsVector3(0, -1.0, 0); // the Y orientation of a "resting" armature.... - hsScalar angleSinceStart = AngleRad2d(curForward.fX, curForward.fY, startForward.fX, startForward.fY); + float angleSinceStart = AngleRad2d(curForward.fX, curForward.fY, startForward.fX, startForward.fY); hsBool sinceStartSign = angleSinceStart > 0.0f; - if (angleSinceStart > hsScalarPI) + if (angleSinceStart > M_PI) angleSinceStart = angleSinceStart - TWO_PI; // HANDLING ANIMATION WRAPPING: diff --git a/Sources/Plasma/PubUtilLib/plAvatar/plAvCallbackAction.h b/Sources/Plasma/PubUtilLib/plAvatar/plAvCallbackAction.h index 0c6c5e0b..7c78dcf7 100644 --- a/Sources/Plasma/PubUtilLib/plAvatar/plAvCallbackAction.h +++ b/Sources/Plasma/PubUtilLib/plAvatar/plAvCallbackAction.h @@ -65,7 +65,7 @@ public: // some reason, just stub this function out. // // Pass in the key to the root sceneobject for the avatar - static plPhysicalController* Create(plKey ownerSO, hsScalar height, hsScalar width); + static plPhysicalController* Create(plKey ownerSO, float height, float width); virtual ~plPhysicalController() {} @@ -77,7 +77,7 @@ public: virtual void SetLOSDB(plSimDefs::plLOSDB losDB) = 0; // Call this once per frame with the velocities of the avatar in avatar space. - virtual void SetVelocities(const hsVector3& linearVel, hsScalar angVel) = 0; + virtual void SetVelocities(const hsVector3& linearVel, float angVel) = 0; // Gets the actual velocity we achieved in the last step (relative to our subworld) virtual const hsVector3& GetLinearVelocity() const = 0; @@ -92,7 +92,7 @@ public: // cases like when the avatar spawns into a new age. virtual bool IsOnGround() const = 0; virtual bool IsOnFalseGround() const = 0; - virtual hsScalar GetAirTime() const = 0; + virtual float GetAirTime() const = 0; virtual void ResetAirTime() = 0; virtual plPhysical* GetPushingPhysical() const = 0; @@ -133,16 +133,16 @@ public: plAnimatedController(plSceneObject* rootObject, plAGApplicator* rootApp, plPhysicalControllerCore* controller); virtual void RecalcVelocity(double timeNow, double timePrev, hsBool useAnim = true); - void SetTurnStrength(hsScalar val) { fTurnStr = val; } - hsScalar GetTurnStrength() { return fTurnStr; } + void SetTurnStrength(float val) { fTurnStr = val; } + float GetTurnStrength() { return fTurnStr; } virtual void ActivateController()=0; protected: plSceneObject* fRootObject; plPhysicalControllerCore* fController; plAGApplicator* fRootApp; - hsScalar fAnimAngVel; + float fAnimAngVel; hsVector3 fAnimPosVel; - hsScalar fTurnStr; // Explicit turning, separate from animations + float fTurnStr; // Explicit turning, separate from animations }; class plWalkingController : public plAnimatedController @@ -158,13 +158,13 @@ public: bool IsOnFalseGround() const { return fWalkingStrategy ? fWalkingStrategy->IsOnFalseGround() : true; } bool HitGroundInThisAge() const { return fHitGroundInThisAge; } bool EnableControlledFlight(bool status); - hsScalar GetAirTime() const { return fWalkingStrategy ? fWalkingStrategy->GetAirTime() : 0.f; } + float GetAirTime() const { return fWalkingStrategy ? fWalkingStrategy->GetAirTime() : 0.f; } void ResetAirTime() { if (fWalkingStrategy) fWalkingStrategy->ResetAirTime(); } - hsScalar GetForwardVelocity() const; + float GetForwardVelocity() const; void ActivateController(); // Check these after the avatar the avatar hits the ground for his total // hangtime and impact velocity. - hsScalar GetImpactTime() const { return fImpactTime; } + float GetImpactTime() const { return fImpactTime; } const hsVector3& GetImpactVelocity() const { return fImpactVelocity; } plPhysical* GetPushingPhysical() const @@ -181,24 +181,24 @@ public: protected: bool fHitGroundInThisAge; bool fWaitingForGround; // We've gone airborne. IsOnGround() returns false until we hit ground again. - hsScalar fControlledFlightTime; + float fControlledFlightTime; int fControlledFlight; // Count of how many are currently forcing flight plWalkingStrategy* fWalkingStrategy; - hsScalar fImpactTime; + float fImpactTime; hsVector3 fImpactVelocity; bool fClearImpact; bool fGroundLastFrame;//used for a test to pass the event of first getting air during a jump - static const hsScalar kControlledFlightThreshold; + static const float kControlledFlightThreshold; }; class plSwimmingController: public plAnimatedController { public : plSwimmingController(plSceneObject* rootObject, plAGApplicator* rootApp, plPhysicalControllerCore* controller); virtual ~plSwimmingController(); - void SetSurface(plSwimRegionInterface *region, hsScalar surfaceHeight){ + void SetSurface(plSwimRegionInterface *region, float surfaceHeight){ fSwimmingStrategy->SetSurface(region,surfaceHeight); } - hsScalar GetBuoyancy() { return fSwimmingStrategy->GetBuoyancy(); } + float GetBuoyancy() { return fSwimmingStrategy->GetBuoyancy(); } hsBool IsOnGround() { return fSwimmingStrategy->IsOnGround(); } hsBool HadContacts() { return fSwimmingStrategy->HadContacts();} void Enable(bool en){if (fController) fController->Enable(en);} diff --git a/Sources/Plasma/PubUtilLib/plAvatar/plAvLadderModifier.cpp b/Sources/Plasma/PubUtilLib/plAvatar/plAvLadderModifier.cpp index 5d7a3450..444991c4 100644 --- a/Sources/Plasma/PubUtilLib/plAvatar/plAvLadderModifier.cpp +++ b/Sources/Plasma/PubUtilLib/plAvatar/plAvLadderModifier.cpp @@ -41,7 +41,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ #include "plAvatar/plAvCallbackAction.h" -#include "hsTypes.h" +#include "HeadSpin.h" // singular #include "plAvLadderModifier.h" @@ -105,7 +105,7 @@ plAvLadderMod::plAvLadderMod(bool goingUp, int type, int loops, bool enabled, hs } // Must be facing within 45 degrees of the ladder -static const hsScalar kTolerance = hsCosine(hsScalarDegToRad(45)); +static const float kTolerance = cos(hsDegreesToRadians(45)); bool plAvLadderMod::IIsReadyToClimb() { @@ -120,7 +120,7 @@ bool plAvLadderMod::IIsReadyToClimb() playerView.fZ = 0; // Are we facing towards the ladder? - hsScalar dot = playerView * fLadderView; + float dot = playerView * fLadderView; bool movingForward = false; @@ -135,12 +135,12 @@ bool plAvLadderMod::IIsReadyToClimb() if (dot >= kTolerance && movingForward) { - DetectorLogSpecial("%s: Ladder starting climb (%f)", GetKeyName(), hsScalarRadToDeg(hsACosine(dot))); + DetectorLogSpecial("%s: Ladder starting climb (%f)", GetKeyName(), hsRadiansToDegrees(acos(dot))); return true; } else if (movingForward) { -// DetectorLog("%s: Ladder rejecting climb (%f)", GetKeyName(), hsScalarRadToDeg(hsACosine(dot))); +// DetectorLog("%s: Ladder rejecting climb (%f)", GetKeyName(), hsRadiansToDegrees(acos(dot))); return false; } } @@ -155,7 +155,7 @@ void plAvLadderMod::ITriggerSelf(plKey avKey) { plKey avPhysKey = avKey; // I'm going to lie and pretend it's from the avatar. the alternative is lengthy and unreadable. - plNotifyMsg *notifyMsg = TRACKED_NEW plNotifyMsg(avPhysKey, GetKey()); + plNotifyMsg *notifyMsg = new plNotifyMsg(avPhysKey, GetKey()); notifyMsg->fID = kNotifyTrigger; notifyMsg->Send(); fAvatarMounting = true; @@ -266,9 +266,9 @@ void plAvLadderMod::EmitCommand(const plKey receiver) traverseName = "LadderDown"; } - plAnimStageVec *v = TRACKED_NEW plAnimStageVec; + plAnimStageVec *v = new plAnimStageVec; - plAnimStage *s1 = TRACKED_NEW plAnimStage(mountName, + plAnimStage *s1 = new plAnimStage(mountName, 0, plAnimStage::kForwardAuto, plAnimStage::kBackAuto, @@ -282,7 +282,7 @@ void plAvLadderMod::EmitCommand(const plKey receiver) // if loops is zero, we don't need the traverse animation at all. if(fLoops) { - plAnimStage *s2 = TRACKED_NEW plAnimStage(traverseName, + plAnimStage *s2 = new plAnimStage(traverseName, 0, plAnimStage::kForwardKey, plAnimStage::kBackKey, @@ -296,7 +296,7 @@ void plAvLadderMod::EmitCommand(const plKey receiver) s2->SetReverseOnIdle(true); v->push_back(s2); } - plAnimStage *s3 = TRACKED_NEW plAnimStage(dismountName, + plAnimStage *s3 = new plAnimStage(dismountName, 0, plAnimStage::kForwardAuto, plAnimStage::kBackAuto, @@ -307,12 +307,12 @@ void plAvLadderMod::EmitCommand(const plKey receiver) s3->SetReverseOnIdle(true); v->push_back(s3); - plNotifyMsg* enterNotify = TRACKED_NEW plNotifyMsg(GetKey(), GetKey()); + plNotifyMsg* enterNotify = new plNotifyMsg(GetKey(), GetKey()); enterNotify->fID = kNotifyAvatarOnLadder; - UInt32 exitFlags = plAvBrainGeneric::kExitNormal; + uint32_t exitFlags = plAvBrainGeneric::kExitNormal; - plAvBrainGeneric *ladBrain = TRACKED_NEW plAvBrainGeneric(v, enterNotify, nil, nil, exitFlags, plAvBrainGeneric::kDefaultFadeIn, + plAvBrainGeneric *ladBrain = new plAvBrainGeneric(v, enterNotify, nil, nil, exitFlags, plAvBrainGeneric::kDefaultFadeIn, plAvBrainGeneric::kDefaultFadeOut, plAvBrainGeneric::kMoveRelative); ladBrain->SetType(plAvBrainGeneric::kLadder); ladBrain->SetReverseFBControlsOnRelease(!fGoingUp); @@ -321,9 +321,9 @@ void plAvLadderMod::EmitCommand(const plKey receiver) // Very important that we dumb seek here. Otherwise you can run off the edge of a ladder, and seek will be helpless // until you hit the ground, at which point you have no hope of successfully seeking. - plAvSeekMsg *seeker = TRACKED_NEW plAvSeekMsg(nil, avKey, seekKey, 1.0f, false); + plAvSeekMsg *seeker = new plAvSeekMsg(nil, avKey, seekKey, 1.0f, false); seeker->Send(); - plAvPushBrainMsg *brainer = TRACKED_NEW plAvPushBrainMsg(nil, avKey, ladBrain); + plAvPushBrainMsg *brainer = new plAvPushBrainMsg(nil, avKey, ladBrain); brainer->Send(); } } diff --git a/Sources/Plasma/PubUtilLib/plAvatar/plAvLadderModifier.h b/Sources/Plasma/PubUtilLib/plAvatar/plAvLadderModifier.h index 45056678..b63cfbf7 100644 --- a/Sources/Plasma/PubUtilLib/plAvatar/plAvLadderModifier.h +++ b/Sources/Plasma/PubUtilLib/plAvatar/plAvLadderModifier.h @@ -78,7 +78,7 @@ public: void SetEnabled(bool enabled) { fEnabled = enabled; } protected: - virtual hsBool IEval(double secs, hsScalar del, UInt32 dirty) {return true;} + virtual hsBool IEval(double secs, float del, uint32_t dirty) {return true;} bool IIsReadyToClimb(); void ITriggerSelf(plKey avKey); diff --git a/Sources/Plasma/PubUtilLib/plAvatar/plAvTask.h b/Sources/Plasma/PubUtilLib/plAvatar/plAvTask.h index 2381cfc7..4c051cc9 100644 --- a/Sources/Plasma/PubUtilLib/plAvatar/plAvTask.h +++ b/Sources/Plasma/PubUtilLib/plAvatar/plAvTask.h @@ -82,14 +82,14 @@ public: /** Start the task: set up initial conditions or wait for resources to become available. Start will be called repeatedly until it returns true, indicating the task has begun. */ - virtual hsBool Start(plArmatureMod *avatar, plArmatureBrain *brain, double time, hsScalar elapsed); + virtual hsBool Start(plArmatureMod *avatar, plArmatureBrain *brain, double time, float elapsed); /** Run the task. Start is guaranteed to have returned true before Process() is called even once. Returns false when the task has finished and epilogue code has been executed. */ - virtual hsBool Process(plArmatureMod *avatar, plArmatureBrain *brain, double time, hsScalar elapsed); + virtual hsBool Process(plArmatureMod *avatar, plArmatureBrain *brain, double time, float elapsed); /** Clean up the task. This is guaranteed to be called when Process returns false. */ - virtual void Finish(plArmatureMod *avatar, plArmatureBrain *brain, double time, hsScalar elapsed); + virtual void Finish(plArmatureMod *avatar, plArmatureBrain *brain, double time, float elapsed); virtual void LeaveAge(plArmatureMod *avatar) {} diff --git a/Sources/Plasma/PubUtilLib/plAvatar/plAvTaskBrain.cpp b/Sources/Plasma/PubUtilLib/plAvatar/plAvTaskBrain.cpp index 7e84424d..66704c98 100644 --- a/Sources/Plasma/PubUtilLib/plAvatar/plAvTaskBrain.cpp +++ b/Sources/Plasma/PubUtilLib/plAvatar/plAvTaskBrain.cpp @@ -75,7 +75,7 @@ plAvTaskBrain::~plAvTaskBrain() // Start ------------------------------------------------------------------------------------------ // ------ -hsBool plAvTaskBrain::Start(plArmatureMod *avatar, plArmatureBrain *brain, double time, hsScalar elapsed) +hsBool plAvTaskBrain::Start(plArmatureMod *avatar, plArmatureBrain *brain, double time, float elapsed) { if(fBrain) avatar->PushBrain(fBrain); @@ -87,7 +87,7 @@ hsBool plAvTaskBrain::Start(plArmatureMod *avatar, plArmatureBrain *brain, doubl return true; } -void plAvTaskBrain::Finish(plArmatureMod *avatar, plArmatureBrain *brain, double time, hsScalar elapsed) +void plAvTaskBrain::Finish(plArmatureMod *avatar, plArmatureBrain *brain, double time, float elapsed) { } diff --git a/Sources/Plasma/PubUtilLib/plAvatar/plAvTaskBrain.h b/Sources/Plasma/PubUtilLib/plAvatar/plAvTaskBrain.h index 608cf686..62571017 100644 --- a/Sources/Plasma/PubUtilLib/plAvatar/plAvTaskBrain.h +++ b/Sources/Plasma/PubUtilLib/plAvatar/plAvTaskBrain.h @@ -71,8 +71,8 @@ public: virtual ~plAvTaskBrain(); // task protocol - virtual hsBool Start(plArmatureMod *avatar, plArmatureBrain *brain, double time, hsScalar elapsed); - virtual void Finish(plArmatureMod *avatar, plArmatureBrain *brain, double time, hsScalar elapsed); + virtual hsBool Start(plArmatureMod *avatar, plArmatureBrain *brain, double time, float elapsed); + virtual void Finish(plArmatureMod *avatar, plArmatureBrain *brain, double time, float elapsed); /** dump descriptive stuff to the given debug text */ virtual void DumpDebug(const char *name, int &x, int&y, int lineHeight, char *strBuf, plDebugText &debugTxt); diff --git a/Sources/Plasma/PubUtilLib/plAvatar/plAvTaskSeek.cpp b/Sources/Plasma/PubUtilLib/plAvatar/plAvTaskSeek.cpp index 793c6c64..a720ab14 100644 --- a/Sources/Plasma/PubUtilLib/plAvatar/plAvTaskSeek.cpp +++ b/Sources/Plasma/PubUtilLib/plAvatar/plAvTaskSeek.cpp @@ -197,13 +197,13 @@ void plAvTaskSeek::SetTarget(hsPoint3 &pos, hsPoint3 &lookAt) { fSeekPos = pos; hsVector3 up(0.f, 0.f, 1.f); - hsScalar angle = hsATan2(lookAt.fY - pos.fY, lookAt.fX - pos.fX) + hsScalarPI / 2; + float angle = atan2(lookAt.fY - pos.fY, lookAt.fX - pos.fX) + M_PI / 2; fSeekRot.SetAngleAxis(angle, up); } // Start ----------------------------------------------------------------------------------------- // ------ -hsBool plAvTaskSeek::Start(plArmatureMod *avatar, plArmatureBrain *brain, double time, hsScalar elapsed) +hsBool plAvTaskSeek::Start(plArmatureMod *avatar, plArmatureBrain *brain, double time, float elapsed) { plAvBrainHuman *huBrain = plAvBrainHuman::ConvertNoRef(brain); hsAssert(huBrain, "Seek task only works on human brains"); @@ -224,7 +224,7 @@ hsBool plAvTaskSeek::Start(plArmatureMod *avatar, plArmatureBrain *brain, double if (plAvOneShotTask::fForce3rdPerson && avatar->IsLocalAvatar() && (fFlags & plAvSeekMsg::kSeekFlagForce3rdPersonOnStart)) { // create message - plCameraMsg* pMsg = TRACKED_NEW plCameraMsg; + plCameraMsg* pMsg = new plCameraMsg; pMsg->SetBCastFlag(plMessage::kBCastByExactType); pMsg->SetBCastFlag(plMessage::kNetPropagate, false); pMsg->SetCmd(plCameraMsg::kResponderSetThirdPerson); @@ -243,7 +243,7 @@ hsBool plAvTaskSeek::Start(plArmatureMod *avatar, plArmatureBrain *brain, double // Process ------------------------------------------------------------------------------------------- // -------- -hsBool plAvTaskSeek::Process(plArmatureMod *avatar, plArmatureBrain *brain, double time, hsScalar elapsed) +hsBool plAvTaskSeek::Process(plArmatureMod *avatar, plArmatureBrain *brain, double time, float elapsed) { if (fState == kSeekAbort) return false; @@ -268,7 +268,7 @@ hsBool plAvTaskSeek::Process(plArmatureMod *avatar, plArmatureBrain *brain, doub // Finish --------------------------------------------------------------------------------------- // ------- -void plAvTaskSeek::Finish(plArmatureMod *avatar, plArmatureBrain *brain, double time, hsScalar elapsed) +void plAvTaskSeek::Finish(plArmatureMod *avatar, plArmatureBrain *brain, double time, float elapsed) { plAvBrainHuman *huBrain = plAvBrainHuman::ConvertNoRef(brain); @@ -281,7 +281,7 @@ void plAvTaskSeek::Finish(plArmatureMod *avatar, plArmatureBrain *brain, double if (plAvOneShotTask::fForce3rdPerson && avatar->IsLocalAvatar() && (fFlags & plAvSeekMsg::kSeekFlagUnForce3rdPersonOnFinish)) { // create message - plCameraMsg* pMsg = TRACKED_NEW plCameraMsg; + plCameraMsg* pMsg = new plCameraMsg; pMsg->SetBCastFlag(plMessage::kBCastByExactType); pMsg->SetBCastFlag(plMessage::kNetPropagate, false); pMsg->SetCmd(plCameraMsg::kResponderUndoThirdPerson); @@ -293,7 +293,7 @@ void plAvTaskSeek::Finish(plArmatureMod *avatar, plArmatureBrain *brain, double if (fNotifyFinishedKey) { - plAvTaskSeekDoneMsg *msg = TRACKED_NEW plAvTaskSeekDoneMsg(avatar->GetKey(), fNotifyFinishedKey); + plAvTaskSeekDoneMsg *msg = new plAvTaskSeekDoneMsg(avatar->GetKey(), fNotifyFinishedKey); msg->fAborted = (fState == kSeekAbort); msg->Send(); } @@ -318,7 +318,7 @@ hsBool plAvTaskSeek::IAnalyze(plArmatureMod *avatar) hsVector3 normalizedGoalVec(fGoalVec); normalizedGoalVec.Normalize(); - fDistance = hsSquareRoot(fGoalVec.fX * fGoalVec.fX + fGoalVec.fY * fGoalVec.fY); + fDistance = sqrt(fGoalVec.fX * fGoalVec.fX + fGoalVec.fY * fGoalVec.fY); if(fDistance < 3.0f) { @@ -350,7 +350,7 @@ hsBool plAvTaskSeek::IAnalyze(plArmatureMod *avatar) // IMoveTowardsGoal -------------------------------------------------------------- // ----------------- hsBool plAvTaskSeek::IMoveTowardsGoal(plArmatureMod *avatar, plAvBrainHuman *brain, - double time, hsScalar elapsed) + double time, float elapsed) { bool stillRunning = true; avatar->ClearInputFlags(false, false); @@ -435,7 +435,7 @@ hsBool plAvTaskSeek::IMoveTowardsGoal(plArmatureMod *avatar, plAvBrainHuman *bra // ITRYFINISH -bool plAvTaskSeek::ITryFinish(plArmatureMod *avatar, plAvBrainHuman *brain, double time, hsScalar elapsed) +bool plAvTaskSeek::ITryFinish(plArmatureMod *avatar, plAvBrainHuman *brain, double time, float elapsed) { hsBool animsDone = brain->IsMovementZeroBlend(); @@ -458,7 +458,7 @@ bool plAvTaskSeek::ITryFinish(plArmatureMod *avatar, plAvBrainHuman *brain, doub hsBool plAvTaskSeek::IFinishPosition(hsPoint3 &newPosition, plArmatureMod *avatar, plAvBrainHuman *brain, - double time, hsScalar elapsed) + double time, float elapsed) { // While warping, we might be hovering just above the ground. Don't want that to // trigger any falling behavior. @@ -494,7 +494,7 @@ hsBool plAvTaskSeek::IFinishPosition(hsPoint3 &newPosition, // ---------------- hsBool plAvTaskSeek::IFinishRotation(hsQuat &newRotation, plArmatureMod *avatar, plAvBrainHuman *brain, - double time, hsScalar elapsed) + double time, float elapsed) { // we're pretty much done; just hop the rest of the way newRotation = fSeekRot; @@ -603,8 +603,8 @@ void plAvTaskSeek::DumpToAvatarLog(plArmatureMod *avatar) // -------------- float QuatAngleDiff(const hsQuat &a, const hsQuat &b) { - hsScalar theta; /* angle between A and B */ - hsScalar cos_t; /* sine, cosine of theta */ + float theta; /* angle between A and B */ + float cos_t; /* sine, cosine of theta */ /* cosine theta = dot product of A and B */ cos_t = a.Dot(b); @@ -616,11 +616,11 @@ float QuatAngleDiff(const hsQuat &a, const hsQuat &b) } // Calling acos on 1.0 is returning an undefined value. Need to check for it. - hsScalar epsilon = 0.00001; + float epsilon = 0.00001; if (hsABS(cos_t - 1.f) < epsilon) return 0; - theta = hsACosine(cos_t); + theta = acos(cos_t); return theta; } diff --git a/Sources/Plasma/PubUtilLib/plAvatar/plAvTaskSeek.h b/Sources/Plasma/PubUtilLib/plAvatar/plAvTaskSeek.h index 308c70d2..964c0456 100644 --- a/Sources/Plasma/PubUtilLib/plAvatar/plAvTaskSeek.h +++ b/Sources/Plasma/PubUtilLib/plAvatar/plAvTaskSeek.h @@ -62,7 +62,7 @@ public: kSeekRunNormal, kSeekAbort, }; - UInt8 fState; + uint8_t fState; enum { @@ -82,15 +82,15 @@ public: /** Initiate the task; make sure we're running on the right type of brain, save off user input state, and turn off any other running behaviors.*/ - virtual hsBool Start(plArmatureMod *avatar, plArmatureBrain *brain, double time, hsScalar elapsed); + virtual hsBool Start(plArmatureMod *avatar, plArmatureBrain *brain, double time, float elapsed); /** Progress towards the goal using a combination of walking and cheating-via-sliding. Returns true if we're still working on it; false if we're done. */ - virtual hsBool Process(plArmatureMod *avatar, plArmatureBrain *brain, double time, hsScalar elapsed); + virtual hsBool Process(plArmatureMod *avatar, plArmatureBrain *brain, double time, float elapsed); /** Restore user input state, etc. */ - virtual void Finish(plArmatureMod *avatar, plArmatureBrain *brain, double time, hsScalar elapsed); + virtual void Finish(plArmatureMod *avatar, plArmatureBrain *brain, double time, float elapsed); /** clear our target, and when we try to eval, we'll just finish */ virtual void LeaveAge(plArmatureMod *avatar); @@ -121,19 +121,19 @@ protected: /** Progress towards the goal. We get as close as we can by just pushing the same buttons as the user (forward, turn, etc.) when we're really close we slide around a bit so we can wind up on the *exact* initial orientation. */ - hsBool IMoveTowardsGoal(plArmatureMod *avatar, plAvBrainHuman *brain, double time, hsScalar elapsed); + hsBool IMoveTowardsGoal(plArmatureMod *avatar, plAvBrainHuman *brain, double time, float elapsed); /** Okay, we're in the pure cheating mode now. Try to wrap it up; returns true when it's finally there. */ - bool ITryFinish(plArmatureMod *avatar, plAvBrainHuman *brain, double time, hsScalar elapsed); + bool ITryFinish(plArmatureMod *avatar, plAvBrainHuman *brain, double time, float elapsed); /** Final cheating for position */ hsBool IFinishPosition(hsPoint3 &newPosition, plArmatureMod *avatar, plAvBrainHuman *brain, - double time, hsScalar elapsed); + double time, float elapsed); /** Final cheating for rotation */ hsBool IFinishRotation(hsQuat &newRotation, plArmatureMod *avatar, plAvBrainHuman *brain, - double time, hsScalar elapsed); + double time, float elapsed); /** If our target's moving, cache its new position and orientation for later math */ hsBool IUpdateObjective(plArmatureMod *avatar); @@ -170,20 +170,20 @@ protected: hsBool fStillRotating; // haven't yet reached the final orientation hsVector3 fGoalVec; // vec from us to the goal - hsScalar fDistance; // how far to the goal? - hsScalar fAngForward; // 1.0 = goal is forward; -1.0 = goal is backward - hsScalar fAngRight; // 1.0 = goal is directly right; -1.0 = goal is directly left - hsScalar fDistForward; // distance straight forward to goal plane - hsScalar fDistRight; // distance straight right to goal plane - - hsScalar fShuffleRange; - hsScalar fMaxSidleAngle; // in right . goal - hsScalar fMaxSidleRange; // in feet - hsScalar fMinFwdAngle; // in fwd . goal - hsScalar fMaxBackAngle; // in fwd . goal + float fDistance; // how far to the goal? + float fAngForward; // 1.0 = goal is forward; -1.0 = goal is backward + float fAngRight; // 1.0 = goal is directly right; -1.0 = goal is directly left + float fDistForward; // distance straight forward to goal plane + float fDistRight; // distance straight right to goal plane + + float fShuffleRange; + float fMaxSidleAngle; // in right . goal + float fMaxSidleRange; // in feet + float fMinFwdAngle; // in fwd . goal + float fMaxBackAngle; // in fwd . goal double fStartTime; - UInt8 fFlags; + uint8_t fFlags; plKey fNotifyFinishedKey; // Send a message to this key when we're done. }; diff --git a/Sources/Plasma/PubUtilLib/plAvatar/plAvatarClothing.cpp b/Sources/Plasma/PubUtilLib/plAvatar/plAvatarClothing.cpp index 1435a233..73b538ee 100644 --- a/Sources/Plasma/PubUtilLib/plAvatar/plAvatarClothing.cpp +++ b/Sources/Plasma/PubUtilLib/plAvatar/plAvatarClothing.cpp @@ -39,7 +39,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com Mead, WA 99021 *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "hsTemplates.h" #include "hsStream.h" #include "hsResMgr.h" @@ -178,7 +178,7 @@ void plClothingItem::Read(hsStream *s, hsResMgr *mgr) fCustomText = s->ReadSafeString(); fDescription = s->ReadSafeString(); if (s->ReadBool()) - mgr->ReadKeyNotifyMe(s, TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnCreate, -1, -1), plRefFlags::kActiveRef); // thumbnail + mgr->ReadKeyNotifyMe(s, new plGenRefMsg(GetKey(), plRefMsg::kOnCreate, -1, -1), plRefFlags::kActiveRef); // thumbnail int tileCount = s->ReadLE32(); int i, j; @@ -190,23 +190,23 @@ void plClothingItem::Read(hsStream *s, hsResMgr *mgr) for (j = 0; j < layerCount; j++) { int layer = s->ReadByte(); - mgr->ReadKeyNotifyMe(s, TRACKED_NEW plElementRefMsg(GetKey(), plRefMsg::kOnCreate, i, -1, nil, layer), plRefFlags::kActiveRef); // texture + mgr->ReadKeyNotifyMe(s, new plElementRefMsg(GetKey(), plRefMsg::kOnCreate, i, -1, nil, layer), plRefFlags::kActiveRef); // texture } } for (i = 0; i < kMaxNumLODLevels; i++) { if (s->ReadBool()) - mgr->ReadKeyNotifyMe(s, TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnCreate, i, -1), plRefFlags::kActiveRef); // shared mesh + mgr->ReadKeyNotifyMe(s, new plGenRefMsg(GetKey(), plRefMsg::kOnCreate, i, -1), plRefFlags::kActiveRef); // shared mesh } fElements.SetCountAndZero(tileCount); if (plClothingMgr::GetClothingMgr()) { - plGenRefMsg *msg = TRACKED_NEW plGenRefMsg(plClothingMgr::GetClothingMgr()->GetKey(), plRefMsg::kOnCreate, -1, -1); + plGenRefMsg *msg = new plGenRefMsg(plClothingMgr::GetClothingMgr()->GetKey(), plRefMsg::kOnCreate, -1, -1); hsgResMgr::ResMgr()->AddViaNotify(GetKey(), msg, plRefFlags::kActiveRef); } - mgr->ReadKeyNotifyMe(s, TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnCreate, -1, -1), plRefFlags::kActiveRef); // forced accessory + mgr->ReadKeyNotifyMe(s, new plGenRefMsg(GetKey(), plRefMsg::kOnCreate, -1, -1), plRefFlags::kActiveRef); // forced accessory for (i = 0; i < 3; i++) { @@ -232,7 +232,7 @@ void plClothingItem::Write(hsStream *s, hsResMgr *mgr) if (fThumbnail != nil) mgr->WriteKey(s, fThumbnail->GetKey()); - UInt32 texSkip = 0; + uint32_t texSkip = 0; for (i = 0; i < fTextures.GetCount(); i++) if (fTextures[i] == nil) texSkip++; @@ -312,7 +312,7 @@ hsBool plClothingItem::MsgReceive(plMessage* msg) fElementNames.Set(eMsg->fWhich, hsStrcpy(eMsg->fElementName)); if (fTextures.Get(eMsg->fWhich) == nil) { - plMipmap **layers = TRACKED_NEW plMipmap*[plClothingElement::kLayerMax]; + plMipmap **layers = new plMipmap*[plClothingElement::kLayerMax]; int i; for (i = 0; i < plClothingElement::kLayerMax; i++) layers[i] = nil; @@ -392,7 +392,7 @@ void plClothingBase::Read(hsStream* s, hsResMgr* mgr) fName = s->ReadSafeString(); if (s->ReadBool()) - mgr->ReadKeyNotifyMe(s, TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnCreate, -1, -1), plRefFlags::kActiveRef); + mgr->ReadKeyNotifyMe(s, new plGenRefMsg(GetKey(), plRefMsg::kOnCreate, -1, -1), plRefFlags::kActiveRef); fLayoutName = s->ReadSafeString(); } @@ -455,7 +455,7 @@ void plClothingOutfit::AddItem(plClothingItem *item, hsBool update /* = true */, if (fItems.Find(item) != fItems.kMissingIndex) return; - plClothingMsg *msg = TRACKED_NEW plClothingMsg(); + plClothingMsg *msg = new plClothingMsg(); msg->AddReceiver(GetKey()); msg->AddCommand(plClothingMsg::kAddItem); msg->fItemKey = item->GetKey(); @@ -476,7 +476,7 @@ void plClothingOutfit::AddItem(plClothingItem *item, hsBool update /* = true */, void plClothingOutfit::ForceUpdate(bool retry) { - plClothingMsg *msg = TRACKED_NEW plClothingMsg(); + plClothingMsg *msg = new plClothingMsg(); msg->AddCommand(plClothingMsg::kUpdateTexture); if (retry) msg->AddCommand(plClothingMsg::kRetry); // force a resend @@ -488,7 +488,7 @@ void plClothingOutfit::RemoveItem(plClothingItem *item, hsBool update /* = true if (fItems.Find(item) == fItems.kMissingIndex) return; - plClothingMsg *msg = TRACKED_NEW plClothingMsg(); + plClothingMsg *msg = new plClothingMsg(); msg->AddReceiver(GetKey()); msg->AddCommand(plClothingMsg::kRemoveItem); msg->SetBCastFlag(plMessage::kNetPropagate); @@ -501,11 +501,11 @@ void plClothingOutfit::RemoveItem(plClothingItem *item, hsBool update /* = true plgDispatch::MsgSend(msg); } -void plClothingOutfit::TintItem(plClothingItem *item, hsScalar red, hsScalar green, hsScalar blue, +void plClothingOutfit::TintItem(plClothingItem *item, float red, float green, float blue, hsBool update /* = true */, hsBool broadcast /* = true */, hsBool netForce /* = false */, - hsBool retry /* = true */, UInt8 layer /* = kLayerTint1 */) + hsBool retry /* = true */, uint8_t layer /* = kLayerTint1 */) { - plClothingMsg *msg = TRACKED_NEW plClothingMsg(); + plClothingMsg *msg = new plClothingMsg(); msg->AddReceiver(GetKey()); msg->AddCommand(plClothingMsg::kTintItem); msg->fItemKey = item->GetKey(); @@ -525,10 +525,10 @@ void plClothingOutfit::TintItem(plClothingItem *item, hsScalar red, hsScalar gre plgDispatch::MsgSend(msg); } -void plClothingOutfit::TintSkin(hsScalar red, hsScalar green, hsScalar blue, +void plClothingOutfit::TintSkin(float red, float green, float blue, hsBool update /* = true */, hsBool broadcast /* = true */) { - plClothingMsg *msg = TRACKED_NEW plClothingMsg(); + plClothingMsg *msg = new plClothingMsg(); msg->AddReceiver(GetKey()); msg->AddCommand(plClothingMsg::kTintSkin); msg->fColor.Set(red, green, blue, 1.f); @@ -540,10 +540,10 @@ void plClothingOutfit::TintSkin(hsScalar red, hsScalar green, hsScalar blue, plgDispatch::MsgSend(msg); } -void plClothingOutfit::MorphItem(plClothingItem *item, UInt8 layer, UInt8 delta, hsScalar weight, +void plClothingOutfit::MorphItem(plClothingItem *item, uint8_t layer, uint8_t delta, float weight, hsBool retry /* = true */) { - plClothingMsg *msg = TRACKED_NEW plClothingMsg(); + plClothingMsg *msg = new plClothingMsg(); msg->AddReceiver(GetKey()); msg->AddCommand(plClothingMsg::kMorphItem); msg->fItemKey = item->GetKey(); @@ -555,14 +555,14 @@ void plClothingOutfit::MorphItem(plClothingItem *item, UInt8 layer, UInt8 delta, plgDispatch::MsgSend(msg); } -void plClothingOutfit::SetAge(hsScalar age, hsBool update /* = true */, hsBool broadcast /* = true */) +void plClothingOutfit::SetAge(float age, hsBool update /* = true */, hsBool broadcast /* = true */) { SetSkinBlend(age, plClothingElement::kLayerSkinBlend1, update, broadcast); } -void plClothingOutfit::SetSkinBlend(hsScalar blend, UInt8 layer, hsBool update /* = true */, hsBool broadcast /* = true */) +void plClothingOutfit::SetSkinBlend(float blend, uint8_t layer, hsBool update /* = true */, hsBool broadcast /* = true */) { - plClothingMsg *msg = TRACKED_NEW plClothingMsg(); + plClothingMsg *msg = new plClothingMsg(); msg->AddReceiver(GetKey()); msg->AddCommand(plClothingMsg::kBlendSkin); msg->fLayer = layer; @@ -575,7 +575,7 @@ void plClothingOutfit::SetSkinBlend(hsScalar blend, UInt8 layer, hsBool update / plgDispatch::MsgSend(msg); } -hsScalar plClothingOutfit::GetSkinBlend(UInt8 layer) +float plClothingOutfit::GetSkinBlend(uint8_t layer) { if (layer >= plClothingElement::kLayerSkinBlend1 && layer <= plClothingElement::kLayerSkinLast) return fSkinBlends[layer - plClothingElement::kLayerSkinBlend1]; @@ -617,7 +617,7 @@ void plClothingOutfit::IAddItem(plClothingItem *item) break; } fItems.Insert(i, item); - plClothingItemOptions *op = TRACKED_NEW plClothingItemOptions; + plClothingItemOptions *op = new plClothingItemOptions; fOptions.Insert(i, op); IInstanceSharedMeshes(item); fDirtyItems.SetBit(item->fTileset); @@ -650,7 +650,7 @@ void plClothingOutfit::IAddItem(plClothingItem *item) void plClothingOutfit::IRemoveItem(plClothingItem *item) { // We may just be removing the ref... - UInt32 index = fItems.Find(item); + uint32_t index = fItems.Find(item); if (index != fItems.kMissingIndex) { fItems.Remove(index); @@ -661,9 +661,9 @@ void plClothingOutfit::IRemoveItem(plClothingItem *item) } } -hsBool plClothingOutfit::ITintItem(plClothingItem *item, hsColorRGBA color, UInt8 layer) +hsBool plClothingOutfit::ITintItem(plClothingItem *item, hsColorRGBA color, uint8_t layer) { - UInt32 index = fItems.Find(item); + uint32_t index = fItems.Find(item); if (index != fItems.kMissingIndex) { if (layer == plClothingElement::kLayerTint1) @@ -675,7 +675,7 @@ hsBool plClothingOutfit::ITintItem(plClothingItem *item, hsColorRGBA color, UInt if (fItems[index]->fAccessory) { plClothingItem *acc = fItems[index]->fAccessory; - UInt32 accIndex = fItems.Find(acc); + uint32_t accIndex = fItems.Find(acc); if (accIndex != fItems.kMissingIndex) { if (layer == plClothingElement::kLayerTint1) @@ -691,13 +691,13 @@ hsBool plClothingOutfit::ITintItem(plClothingItem *item, hsColorRGBA color, UInt return false; } -hsColorRGBA plClothingOutfit::GetItemTint(plClothingItem *item, UInt8 layer /* = kLayerTint1 */) const +hsColorRGBA plClothingOutfit::GetItemTint(plClothingItem *item, uint8_t layer /* = kLayerTint1 */) const { if (layer >= plClothingElement::kLayerSkinFirst && layer <= plClothingElement::kLayerSkinLast) return fSkinTint; - UInt32 index = fItems.Find(item); + uint32_t index = fItems.Find(item); if (index != fItems.kMissingIndex) { if (layer == plClothingElement::kLayerTint1) @@ -711,9 +711,9 @@ hsColorRGBA plClothingOutfit::GetItemTint(plClothingItem *item, UInt8 layer /* = return color; } -hsBool plClothingOutfit::IMorphItem(plClothingItem *item, UInt8 layer, UInt8 delta, hsScalar weight) +hsBool plClothingOutfit::IMorphItem(plClothingItem *item, uint8_t layer, uint8_t delta, float weight) { - UInt32 index = fItems.Find(item); + uint32_t index = fItems.Find(item); if (index != fItems.kMissingIndex) { int i; @@ -744,12 +744,12 @@ void plClothingOutfit::Read(hsStream* s, hsResMgr* mgr) plSynchedObject::Read(s, mgr); fGroup = s->ReadByte(); - mgr->ReadKeyNotifyMe(s, TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnCreate, -1, -1), plRefFlags::kActiveRef); // plClothingBase + mgr->ReadKeyNotifyMe(s, new plGenRefMsg(GetKey(), plRefMsg::kOnCreate, -1, -1), plRefFlags::kActiveRef); // plClothingBase if (fGroup != plClothingMgr::kClothingBaseNoOptions) { - mgr->ReadKeyNotifyMe(s, TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnCreate, -1, -1), plRefFlags::kActiveRef); // target layer - mgr->ReadKeyNotifyMe(s, TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnCreate, -1, -1), plRefFlags::kActiveRef); // material + mgr->ReadKeyNotifyMe(s, new plGenRefMsg(GetKey(), plRefMsg::kOnCreate, -1, -1), plRefFlags::kActiveRef); // target layer + mgr->ReadKeyNotifyMe(s, new plGenRefMsg(GetKey(), plRefMsg::kOnCreate, -1, -1), plRefFlags::kActiveRef); // material } plgDispatch::Dispatch()->RegisterForExactType(plPreResourceMsg::Index(), GetKey()); //ReadItems(s, mgr, false); @@ -789,7 +789,7 @@ void plClothingOutfit::IHandleMorphSDR(plStateDataRecord *sdr) if (!lodVar) return; - UInt8 lod; + uint8_t lod; lodVar->Get(&lod); const plSceneObject *so = fAvatar->GetClothingSO(lod); @@ -826,7 +826,7 @@ void plClothingOutfit::ReadFromVault() plStateDataRecord::ReadStreamHeader(&ram, &sdlRecName, &sdlRecVersion); plStateDescriptor * desc = plSDLMgr::GetInstance()->FindDescriptor(sdlRecName, sdlRecVersion); if (desc) { - plStateDataRecord * sdlDataRec = TRACKED_NEW plStateDataRecord(desc); + plStateDataRecord * sdlDataRec = new plStateDataRecord(desc); if (sdlDataRec->Read(&ram, 0)) { if (!strcmp(sdlRecName, kSDLMorphSequence)) IHandleMorphSDR(sdlDataRec); @@ -848,7 +848,7 @@ void plClothingOutfit::ReadFromVault() void plClothingOutfit::SaveCustomizations(hsBool retry /* = true */) { - plClothingMsg *msg = TRACKED_NEW plClothingMsg(); + plClothingMsg *msg = new plClothingMsg(); msg->AddReceiver(GetKey()); msg->AddCommand(plClothingMsg::kSaveCustomizations); if (retry) @@ -900,7 +900,7 @@ void plClothingOutfit::WriteToVault(const ARRAY(plStateDataRecord*) & SDRs) for (unsigned i = 0; i < morphsSDRs.GetCount(); ++i) { for (unsigned j = 0; j < fAvatar->GetNumLOD(); j++) { if (fAvatar->GetClothingSO(j) == morphsSDRs[i]->GetTarget(0)) { - plStateDataRecord * morphSDR = TRACKED_NEW plStateDataRecord(kSDLMorphSequence); + plStateDataRecord * morphSDR = new plStateDataRecord(kSDLMorphSequence); plSimpleStateVariable * lodVar = morphSDR->FindVar(plMorphSequenceSDLMod::kStrTargetID); if (lodVar) lodVar->Set((int)j); @@ -972,7 +972,7 @@ void plClothingOutfit::WriteToVault(const ARRAY(plStateDataRecord*) & SDRs) // Cleanup morph SDRs {for (unsigned i = 0; i < morphs.Count(); ++i) { - DEL(morphs[i]); + delete morphs[i]; }} rvn->DecRef(); @@ -996,7 +996,7 @@ void plClothingOutfit::IUpdate() if (avMod->GetClothingOutfit()==this) { // Let the GUI know we changed clothes - plClothingUpdateBCMsg *BCMsg = TRACKED_NEW plClothingUpdateBCMsg(); + plClothingUpdateBCMsg *BCMsg = new plClothingUpdateBCMsg(); BCMsg->SetSender(GetKey()); plgDispatch::MsgSend(BCMsg); } @@ -1011,7 +1011,7 @@ void plClothingOutfit::WearDefaultClothing() cMgr->GetItemsByGroup(fGroup, items); // Wear one thing of each type - UInt32 i, j; + uint32_t i, j; for (i = 0; i < plClothingMgr::kMaxType; i++) { if (i == plClothingMgr::kTypeAccessory) @@ -1042,13 +1042,13 @@ void plClothingOutfit::WearDefaultClothing() } } -void plClothingOutfit::WearDefaultClothingType(UInt32 clothingType) +void plClothingOutfit::WearDefaultClothingType(uint32_t clothingType) { plClothingMgr *cMgr = plClothingMgr::GetClothingMgr(); hsTArray items; cMgr->GetItemsByGroup(fGroup, items); - UInt32 i; + uint32_t i; for (i=0; ifType == clothingType) @@ -1148,22 +1148,22 @@ void plClothingOutfit::WearRandomOutfit() hsTArrayitems; // Wear one thing of each type - UInt32 i, j; + uint32_t i, j; for (i = 0; i < plClothingMgr::kMaxType; i++) { if (i == plClothingMgr::kTypeAccessory) continue; items.Reset(); - cMgr->GetItemsByGroupAndType(fGroup, (UInt8)i, items); - j = (UInt32)(sRandom.RandZeroToOne() * items.GetCount()); + cMgr->GetItemsByGroupAndType(fGroup, (uint8_t)i, items); + j = (uint32_t)(sRandom.RandZeroToOne() * items.GetCount()); - hsScalar r1 = sRandom.RandZeroToOne(); - hsScalar g1 = sRandom.RandZeroToOne(); - hsScalar b1 = sRandom.RandZeroToOne(); - hsScalar r2 = sRandom.RandZeroToOne(); - hsScalar g2 = sRandom.RandZeroToOne(); - hsScalar b2 = sRandom.RandZeroToOne(); + float r1 = sRandom.RandZeroToOne(); + float g1 = sRandom.RandZeroToOne(); + float b1 = sRandom.RandZeroToOne(); + float r2 = sRandom.RandZeroToOne(); + float g2 = sRandom.RandZeroToOne(); + float b2 = sRandom.RandZeroToOne(); AddItem(items[j], false, false); TintItem(items[j], r1, g1, b1, false, false, false, true, 1); @@ -1183,7 +1183,7 @@ void plClothingOutfit::WearRandomOutfit() hsBool plClothingOutfit::ReadItems(hsStream* s, hsResMgr* mgr, hsBool broadcast /* = true */) { hsBool result = true; - UInt32 numItems = s->ReadLE32(); + uint32_t numItems = s->ReadLE32(); int i; for (i = 0; i < numItems; i++) { @@ -1310,12 +1310,12 @@ hsBool plClothingOutfit::MsgReceive(plMessage* msg) { if (cMsg->GetCommand(plClothingMsg::kAddItem)) { - plGenRefMsg *msg = TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnCreate, -1, -1); + plGenRefMsg *msg = new plGenRefMsg(GetKey(), plRefMsg::kOnCreate, -1, -1); hsgResMgr::ResMgr()->AddViaNotify(cMsg->fItemKey, msg, plRefFlags::kActiveRef); plClothingItem *accessory = plClothingItem::ConvertNoRef(cMsg->fItemKey->GetObjectPtr())->fAccessory; if (accessory) { - plGenRefMsg *msg = TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnCreate, -1, -1); + plGenRefMsg *msg = new plGenRefMsg(GetKey(), plRefMsg::kOnCreate, -1, -1); hsgResMgr::ResMgr()->AddViaNotify(accessory->GetKey(), msg, plRefFlags::kActiveRef); } } @@ -1359,7 +1359,7 @@ hsBool plClothingOutfit::MsgReceive(plMessage* msg) if (cMsg->GetCommand(plClothingMsg::kBlendSkin)) { - hsScalar blend = cMsg->fColor.a; + float blend = cMsg->fColor.a; if (blend > 1.f) blend = 1.f; if (blend < 0.f) @@ -1391,7 +1391,7 @@ hsBool plClothingOutfit::MsgReceive(plMessage* msg) // as a solo command, so that it happens after any other AddViaNotify messages if (cMsg->ResendUpdate()) { - plClothingMsg *update = TRACKED_NEW plClothingMsg(); + plClothingMsg *update = new plClothingMsg(); update->AddReceiver(GetKey()); update->AddCommand(plClothingMsg::kUpdateTexture); plgDispatch::MsgSend(update); @@ -1409,7 +1409,7 @@ hsBool plClothingOutfit::MsgReceive(plMessage* msg) // TESTING SDL // Send clothing sendState msg to object's plClothingSDLModifier // -hsBool plClothingOutfit::DirtySynchState(const char* SDLStateName, UInt32 synchFlags) +hsBool plClothingOutfit::DirtySynchState(const char* SDLStateName, uint32_t synchFlags) { plSynchEnabler ps(true); // make sure synching is enabled, since this happens during load synchFlags |= plSynchedObject::kForceFullSend; // TEMP @@ -1420,7 +1420,7 @@ hsBool plClothingOutfit::DirtySynchState(const char* SDLStateName, UInt32 synchF return fAvatar->GetTarget(0)->DirtySynchState(SDLStateName, synchFlags); } -// Note: Currently the word "instance" is a lie. We just copy. In the future +// Note: Currently the uint16_t "instance" is a lie. We just copy. In the future // we'll be good about this, but I wanted to get it working first. void plClothingOutfit::IInstanceSharedMeshes(plClothingItem *item) { @@ -1613,7 +1613,7 @@ void plClothingMgr::GetClosetItems(hsTArray &out) plStateDataRecord * rec = NEWZERO(plStateDataRecord); if (sdl.GetStateDataRecord(rec, 0)) plClothingSDLModifier::HandleSingleSDR(rec, nil, &out[i]); - DEL(rec); + delete rec; } if (out.GetCount()) { @@ -1669,7 +1669,7 @@ plClothingItem *plClothingMgr::FindItemByName(const char *name) return nil; } -void plClothingMgr::GetItemsByGroup(UInt8 group, hsTArray &out) +void plClothingMgr::GetItemsByGroup(uint8_t group, hsTArray &out) { int i; for (i = 0; i < fItems.GetCount(); i++) @@ -1679,7 +1679,7 @@ void plClothingMgr::GetItemsByGroup(UInt8 group, hsTArray &out) } } -void plClothingMgr::GetItemsByGroupAndType(UInt8 group, UInt8 type, hsTArray &out) +void plClothingMgr::GetItemsByGroupAndType(uint8_t group, uint8_t type, hsTArray &out) { int i; for (i = 0; i < fItems.GetCount(); i++) @@ -1743,7 +1743,7 @@ hsBool plClothingMgr::IsLRMatch(plClothingItem *item1, plClothingItem *item2) void plClothingMgr::Init() { - fInstance = TRACKED_NEW plClothingMgr; + fInstance = new plClothingMgr; fInstance->RegisterAs(kClothingMgr_KEY); fInstance->IInit(); } @@ -1751,7 +1751,7 @@ void plClothingMgr::Init() void plClothingMgr::IInit() { plClothingElement::GetElements(fElements); - plClothingLayout *layout = TRACKED_NEW plClothingLayout("BasicHuman", 1024); + plClothingLayout *layout = new plClothingLayout("BasicHuman", 1024); layout->fElements.Append(FindElementByName("shirt-chest")); layout->fElements.Append(FindElementByName("shirt-sleeve")); layout->fElements.Append(FindElementByName("face")); diff --git a/Sources/Plasma/PubUtilLib/plAvatar/plAvatarClothing.h b/Sources/Plasma/PubUtilLib/plAvatar/plAvatarClothing.h index 120077f1..6f09c6f6 100644 --- a/Sources/Plasma/PubUtilLib/plAvatar/plAvatarClothing.h +++ b/Sources/Plasma/PubUtilLib/plAvatar/plAvatarClothing.h @@ -90,16 +90,16 @@ public: hsTArray fTextures; hsTArray fElementNames; hsTArray fElements; - UInt8 fGroup; // Each avatar can wear one of the available groups - UInt8 fType; // Each group has multiple types of clothes (shirt/pants/etc) - UInt8 fTileset; - UInt8 fSortOrder; + uint8_t fGroup; // Each avatar can wear one of the available groups + uint8_t fType; // Each group has multiple types of clothes (shirt/pants/etc) + uint8_t fTileset; + uint8_t fSortOrder; char *fDescription; char *fCustomText; plMipmap *fThumbnail; plClothingItem *fAccessory; // Forced accessory to always wear with this item. - UInt8 fDefaultTint1[3]; - UInt8 fDefaultTint2[3]; + uint8_t fDefaultTint1[3]; + uint8_t fDefaultTint2[3]; char *fAccessoryName; // Export only @@ -167,10 +167,10 @@ public: hsTArray fItems; hsTArray fOptions; plClothingBase *fBase; - UInt8 fGroup; + uint8_t fGroup; bool fSynchClients; // set true if the next synch should be bcast hsColorRGBA fSkinTint; - hsScalar fSkinBlends[plClothingElement::kLayerSkinLast - plClothingElement::kLayerSkinFirst]; // Controls the opacity between skin textures. + float fSkinBlends[plClothingElement::kLayerSkinLast - plClothingElement::kLayerSkinFirst]; // Controls the opacity between skin textures. plClothingOutfit(); ~plClothingOutfit(); @@ -181,26 +181,26 @@ public: void SaveCustomizations(hsBool retry = true); void AddItem(plClothingItem *item, hsBool update = true, hsBool broadcast = true, hsBool netForce=false); void RemoveItem(plClothingItem *item, hsBool update = true, hsBool netForce=false); - void TintItem(plClothingItem *item, hsScalar red, hsScalar green, hsScalar blue, hsBool update = true, hsBool broadcast = true, - hsBool netForce = false, hsBool retry = true, UInt8 fLayer = plClothingElement::kLayerTint1); - void TintSkin(hsScalar red, hsScalar green, hsScalar blue, + void TintItem(plClothingItem *item, float red, float green, float blue, hsBool update = true, hsBool broadcast = true, + hsBool netForce = false, hsBool retry = true, uint8_t fLayer = plClothingElement::kLayerTint1); + void TintSkin(float red, float green, float blue, hsBool update = true, hsBool broadcast = true); - void MorphItem(plClothingItem *item, UInt8 layer, UInt8 delta, hsScalar weight, hsBool retry = true); - void SetAge(hsScalar age, hsBool update = true, hsBool broadcast = true); - void SetSkinBlend(hsScalar blend, UInt8 layer, hsBool update = true, hsBool broadcast = true); - hsScalar GetSkinBlend(UInt8 layer); - hsColorRGBA GetItemTint(plClothingItem *item, UInt8 layer = 2) const; - hsScalar GetAge() const { return fSkinBlends[0]; } + void MorphItem(plClothingItem *item, uint8_t layer, uint8_t delta, float weight, hsBool retry = true); + void SetAge(float age, hsBool update = true, hsBool broadcast = true); + void SetSkinBlend(float blend, uint8_t layer, hsBool update = true, hsBool broadcast = true); + float GetSkinBlend(uint8_t layer); + hsColorRGBA GetItemTint(plClothingItem *item, uint8_t layer = 2) const; + float GetAge() const { return fSkinBlends[0]; } hsTArray &GetItemList() { return fItems; } hsTArray &GetOptionList() { return fOptions; } virtual void Read(hsStream* s, hsResMgr* mgr); virtual void Write(hsStream* s, hsResMgr* mgr); - hsBool DirtySynchState(const char* SDLStateName, UInt32 synchFlags); + hsBool DirtySynchState(const char* SDLStateName, uint32_t synchFlags); void StripAccessories(); void WearDefaultClothing(); - void WearDefaultClothingType(UInt32 clothingType); + void WearDefaultClothingType(uint32_t clothingType); void WearMaintainerOutfit(); void WearRandomOutfit(); void RemoveMaintainerOutfit(); @@ -231,8 +231,8 @@ protected: void IAddItem(plClothingItem *item); void IRemoveItem(plClothingItem *item); - hsBool ITintItem(plClothingItem *item, hsColorRGBA color, UInt8 layer); - hsBool IMorphItem(plClothingItem *item, UInt8 layer, UInt8 delta, hsScalar weight); + hsBool ITintItem(plClothingItem *item, hsColorRGBA color, uint8_t layer); + hsBool IMorphItem(plClothingItem *item, uint8_t layer, uint8_t delta, float weight); void IHandleMorphSDR(plStateDataRecord *sdr); void IUpdate(); @@ -269,8 +269,8 @@ public: // Functions that relate to all existing clothing plClothingItem *FindItemByName(const char *name); hsTArray& GetItemList() { return fItems; } - void GetItemsByGroup(UInt8 group, hsTArray &out); - void GetItemsByGroupAndType(UInt8 group, UInt8 type, hsTArray &out); + void GetItemsByGroup(uint8_t group, hsTArray &out); + void GetItemsByGroupAndType(uint8_t group, uint8_t type, hsTArray &out); void GetAllWithSameMesh(plClothingItem *item, hsTArray &out); // Give an array of items (from one of the above functions, for example) diff --git a/Sources/Plasma/PubUtilLib/plAvatar/plAvatarMgr.cpp b/Sources/Plasma/PubUtilLib/plAvatar/plAvatarMgr.cpp index 3c3655b1..557e7937 100644 --- a/Sources/Plasma/PubUtilLib/plAvatar/plAvatarMgr.cpp +++ b/Sources/Plasma/PubUtilLib/plAvatar/plAvatarMgr.cpp @@ -110,7 +110,7 @@ plAvatarMgr * plAvatarMgr::GetInstance() { if(!fInstance) { - fInstance = TRACKED_NEW plAvatarMgr; + fInstance = new plAvatarMgr; fInstance->RegisterAs(kAvatarMgr_KEY); fInstance->Ref(); } @@ -206,7 +206,7 @@ plKey plAvatarMgr::LoadAvatar(const char *name, const char *accountName, bool is if (loc.IsValid()) { plUoid uID(loc, plSceneObject::Index(), theName); - plLoadAvatarMsg *cloneMsg = TRACKED_NEW plLoadAvatarMsg (uID, requestor, 0, isPlayer, spawnPoint, initialTask, userStr); + plLoadAvatarMsg *cloneMsg = new plLoadAvatarMsg (uID, requestor, 0, isPlayer, spawnPoint, initialTask, userStr); result = cloneMsg->GetCloneKey(); // the clone message is automatically addressed to the net client manager @@ -220,7 +220,7 @@ plKey plAvatarMgr::LoadAvatar(const char *name, const char *accountName, bool is void plAvatarMgr::UnLoadAvatar(plKey avatarKey, bool isPlayer) { hsBool isLoading = false; - plLoadAvatarMsg *msg = TRACKED_NEW plLoadAvatarMsg(avatarKey, GetKey(), 0, isPlayer, isLoading); + plLoadAvatarMsg *msg = new plLoadAvatarMsg(avatarKey, GetKey(), 0, isPlayer, isLoading); msg->Send(); } @@ -234,7 +234,7 @@ void plAvatarMgr::PropagateLocalPlayer(int spawnPoint) plKey requestor = GetKey(); bool isPlayer = true; hsBool isLoading = true; - plLoadAvatarMsg *msg = TRACKED_NEW plLoadAvatarMsg(playerKey, requestor, 0, isPlayer, isLoading); + plLoadAvatarMsg *msg = new plLoadAvatarMsg(playerKey, requestor, 0, isPlayer, isLoading); if (spawnPoint >= 0) { @@ -263,7 +263,7 @@ bool plAvatarMgr::UnPropagateLocalPlayer() plKey requestor = GetKey(); bool isPlayer = true; hsBool isLoading = false; - plLoadAvatarMsg *msg = TRACKED_NEW plLoadAvatarMsg(playerKey, requestor, 0, isPlayer, isLoading); + plLoadAvatarMsg *msg = new plLoadAvatarMsg(playerKey, requestor, 0, isPlayer, isLoading); msg->SetBCastFlag(plMessage::kLocalPropagate, false); msg->Send(); return true; @@ -279,7 +279,7 @@ void plAvatarMgr::UnLoadRemotePlayer(plKey remotePlayer) plKey requestor = GetKey(); bool isPlayer = true; hsBool isLoading = false; - plLoadAvatarMsg * msg = TRACKED_NEW plLoadAvatarMsg(remotePlayer, requestor, 0, isPlayer, isLoading); + plLoadAvatarMsg * msg = new plLoadAvatarMsg(remotePlayer, requestor, 0, isPlayer, isLoading); // don't propagate over the network. this is just for removing our local version msg->SetBCastFlag(plMessage::kNetPropagate, false); @@ -296,7 +296,7 @@ void plAvatarMgr::UnLoadLocalPlayer() plKey mgrKey = GetKey(); bool isPlayer = true; hsBool isLoading = false; - plLoadAvatarMsg *msg = TRACKED_NEW plLoadAvatarMsg(playerKey, mgrKey, 0, isPlayer, isLoading); + plLoadAvatarMsg *msg = new plLoadAvatarMsg(playerKey, mgrKey, 0, isPlayer, isLoading); msg->Send(); } } @@ -368,8 +368,8 @@ hsBool plAvatarMgr::HandleCoopMsg(plAvCoopMsg *msg) { plAvCoopMsg::Command cmd = msg->fCommand; - UInt32 id = msg->fInitiatorID; - UInt16 serial = msg->fInitiatorSerial; + uint32_t id = msg->fInitiatorID; + uint16_t serial = msg->fInitiatorSerial; if(cmd == plAvCoopMsg::kStartNew) { @@ -403,14 +403,14 @@ hsBool plAvatarMgr::HandleNotifyMsg(plNotifyMsg *msg) proCoopEventData *ed = static_cast(msg->FindEventRecord(proEventData::kCoop)); if(ed) { - UInt32 id = ed->fID; - UInt16 serial = ed->fSerial; + uint32_t id = ed->fID; + uint16_t serial = ed->fSerial; return IPassMessageToActiveCoop(msg, id, serial); } return false; } -hsBool plAvatarMgr::IPassMessageToActiveCoop(plMessage *msg, UInt32 id, UInt16 serial) +hsBool plAvatarMgr::IPassMessageToActiveCoop(plMessage *msg, uint32_t id, uint16_t serial) { plCoopMap::iterator i = fActiveCoops.find(id); while(i != fActiveCoops.end() && (*i).first == id) @@ -467,7 +467,7 @@ void plAvatarMgr::IFinishLoadingAvatar(plLoadAvatarMsg *cloneMsg) // *** might want to move this to the human brain so we can make sure the // *** avatar is sufficiently initialized before anyone accesses him bool isLocal = cloneMsg->GetOriginatingPlayerID() == plNetClientMgr::GetInstance()->GetPlayerID(); - plPlayerPageMsg* pageM = TRACKED_NEW plPlayerPageMsg; + plPlayerPageMsg* pageM = new plPlayerPageMsg; pageM->SetBCastFlag(plMessage::kBCastByExactType); pageM->fLocallyOriginated = isLocal; pageM->fPlayer = avatarKey; @@ -478,7 +478,7 @@ void plAvatarMgr::IFinishLoadingAvatar(plLoadAvatarMsg *cloneMsg) // This can probably be replaced by the plPlayerPageMsg: // ...keeping for the moment for compatibility - plMemberUpdateMsg* mu = TRACKED_NEW plMemberUpdateMsg; + plMemberUpdateMsg* mu = new plMemberUpdateMsg; mu->Send(); } @@ -494,7 +494,7 @@ void plAvatarMgr::IFinishUnloadingAvatar(plLoadAvatarMsg *cloneMsg) plKey avatar = cloneMsg->GetCloneKey(); bool isLocal = cloneMsg->GetOriginatingPlayerID() == plNetClientMgr::GetInstance()->GetPlayerID(); - plPlayerPageMsg *pageM = TRACKED_NEW plPlayerPageMsg; + plPlayerPageMsg *pageM = new plPlayerPageMsg; pageM->SetBCastFlag(plMessage::kBCastByExactType); pageM->fLocallyOriginated = isLocal; pageM->fPlayer = avatar; @@ -506,7 +506,7 @@ void plAvatarMgr::IFinishUnloadingAvatar(plLoadAvatarMsg *cloneMsg) } // check on this...can it be subsumed by plPlayerPageMsg ? - plMemberUpdateMsg *mu = TRACKED_NEW plMemberUpdateMsg; + plMemberUpdateMsg *mu = new plMemberUpdateMsg; mu->Send(); } @@ -726,7 +726,7 @@ plArmatureMod* plAvatarMgr::FindAvatar(plKey& avatarKey) return nil; } -plArmatureMod* plAvatarMgr::FindAvatarByPlayerID(UInt32 pid) +plArmatureMod* plAvatarMgr::FindAvatarByPlayerID(uint32_t pid) { plAvatarVec::iterator it; for (it = fAvatars.begin(); it != fAvatars.end(); ++it) @@ -803,7 +803,7 @@ int plAvatarMgr::FindSpawnPoint( const char *name ) const return -1; } -int plAvatarMgr::WarpPlayerToAnother(hsBool iMove, UInt32 remoteID) +int plAvatarMgr::WarpPlayerToAnother(hsBool iMove, uint32_t remoteID) { plNetTransport &mgr = plNetClientMgr::GetInstance()->TransportMgr(); plNetTransportMember *mbr = mgr.GetMember(mgr.FindMember(remoteID)); @@ -822,7 +822,7 @@ int plAvatarMgr::WarpPlayerToAnother(hsBool iMove, UInt32 remoteID) if (!localSO) return plCCRError::kNilLocalAvatar; - plWarpMsg *warp = TRACKED_NEW plWarpMsg(nil, (iMove ? localSO->GetKey() : remoteSO->GetKey()), + plWarpMsg *warp = new plWarpMsg(nil, (iMove ? localSO->GetKey() : remoteSO->GetKey()), plWarpMsg::kFlushTransform, (iMove ? remoteSO->GetLocalToWorld() : localSO->GetLocalToWorld())); warp->SetBCastFlag(plMessage::kNetPropagate); @@ -831,7 +831,7 @@ int plAvatarMgr::WarpPlayerToAnother(hsBool iMove, UInt32 remoteID) return hsOK; } -int plAvatarMgr::WarpPlayerToXYZ(hsScalar x, hsScalar y, hsScalar z) +int plAvatarMgr::WarpPlayerToXYZ(float x, float y, float z) { plSceneObject *localSO = plSceneObject::ConvertNoRef(plNetClientMgr::GetInstance()->GetLocalPlayer()); if (!localSO) @@ -841,14 +841,14 @@ int plAvatarMgr::WarpPlayerToXYZ(hsScalar x, hsScalar y, hsScalar z) hsVector3 v(x, y, z); m.SetTranslate(&v); - plWarpMsg *warp = TRACKED_NEW plWarpMsg(nil, localSO->GetKey(), plWarpMsg::kFlushTransform, m); + plWarpMsg *warp = new plWarpMsg(nil, localSO->GetKey(), plWarpMsg::kFlushTransform, m); warp->SetBCastFlag(plMessage::kNetPropagate); plgDispatch::MsgSend(warp); return hsOK; } -int plAvatarMgr::WarpPlayerToXYZ(int pid, hsScalar x, hsScalar y, hsScalar z) +int plAvatarMgr::WarpPlayerToXYZ(int pid, float x, float y, float z) { plNetClientMgr* nc=plNetClientMgr::GetInstance(); plNetTransportMember* mbr=nc->TransportMgr().GetMember(nc->TransportMgr().FindMember(pid)); @@ -861,7 +861,7 @@ int plAvatarMgr::WarpPlayerToXYZ(int pid, hsScalar x, hsScalar y, hsScalar z) hsVector3 v(x, y, z); m.SetTranslate(&v); - plWarpMsg *warp = TRACKED_NEW plWarpMsg(nil, player->GetKey(), 0, m); + plWarpMsg *warp = new plWarpMsg(nil, player->GetKey(), 0, m); warp->SetBCastFlag(plMessage::kNetPropagate); plgDispatch::MsgSend(warp); @@ -887,7 +887,7 @@ void plAvatarMgr::RemoveMaintainersMarker(plMaintainersMarkerModifier *mm) void plAvatarMgr::PointToDniCoordinate(hsPoint3 pt, plDniCoordinateInfo* ret) { int count = fMaintainersMarkers.Count(); - // plDniCoordinateInfo ret = TRACKED_NEW plDniCoordinateInfo; + // plDniCoordinateInfo ret = new plDniCoordinateInfo; if (count > 0) { @@ -950,10 +950,10 @@ void plAvatarMgr::PointToDniCoordinate(hsPoint3 pt, plDniCoordinateInfo* ret) hsVector3 retVec(pt - retPoint); retVec.Normalize(); - hsScalar dotView = retVec * zeroVec; - hsScalar dotRight = retVec * zeroRight; + float dotView = retVec * zeroVec; + float dotRight = retVec * zeroRight; - hsScalar deg = acosf(dotView); + float deg = acosf(dotView); deg*=(180/3.141592); // account for being > 180 if (dotRight < 0.0f) @@ -995,37 +995,37 @@ void plAvatarMgr::OfferLinkingBook(plKey hostKey, plKey guestKey, plMessage *lin { // make the host brain - plAvBrainCoop * brainH = TRACKED_NEW plAvBrainCoop(plAvBrainGeneric::kExitNormal, 3.0, 3.0, plAvBrainGeneric::kMoveRelative, guestKey); + plAvBrainCoop * brainH = new plAvBrainCoop(plAvBrainGeneric::kExitNormal, 3.0, 3.0, plAvBrainGeneric::kMoveRelative, guestKey); - plAnimStage *hostOffer = TRACKED_NEW plAnimStage("BookOffer", plAnimStage::kNotifyAdvance); // autoforward, autoadvance + plAnimStage *hostOffer = new plAnimStage("BookOffer", plAnimStage::kNotifyAdvance); // autoforward, autoadvance // repeats until the guest brain tells us that it's done - plAnimStage *hostIdle = TRACKED_NEW plAnimStage("BookOfferIdle", plAnimStage::kNotifyEnter, plAnimStage::kForwardAuto, plAnimStage::kBackNone, + plAnimStage *hostIdle = new plAnimStage("BookOfferIdle", plAnimStage::kNotifyEnter, plAnimStage::kForwardAuto, plAnimStage::kBackNone, plAnimStage::kAdvanceNone, plAnimStage::kRegressNone, -1); - plAnimStage *hostFinish = TRACKED_NEW plAnimStage("BookOfferFinish", plAnimStage::kNotifyAdvance); // autoforward, autoadvance + plAnimStage *hostFinish = new plAnimStage("BookOfferFinish", plAnimStage::kNotifyAdvance); // autoforward, autoadvance brainH->AddStage(hostOffer); brainH->AddStage(hostIdle); brainH->AddStage(hostFinish); - UInt32 hostID = brainH->GetInitiatorID(); - UInt32 hostSerial = brainH->GetInitiatorSerial(); + uint32_t hostID = brainH->GetInitiatorID(); + uint32_t hostSerial = brainH->GetInitiatorSerial(); // make the guest brain - plAvBrainCoop * brainG = TRACKED_NEW plAvBrainCoop(plAvBrainGeneric::kExitNormal, 3.0, 3.0, plAvBrainGeneric::kMoveRelative, - hostID, (UInt16)hostSerial, hostKey); + plAvBrainCoop * brainG = new plAvBrainCoop(plAvBrainGeneric::kExitNormal, 3.0, 3.0, plAvBrainGeneric::kMoveRelative, + hostID, (uint16_t)hostSerial, hostKey); - plAnimStage *guestAccept = TRACKED_NEW plAnimStage("BookAccept", plAnimStage::kNotifyAdvance); - plAnimStage *guestAcceptIdle = TRACKED_NEW plAnimStage("BookAcceptIdle", plAnimStage::kNotifyEnter, plAnimStage::kForwardAuto, plAnimStage::kBackNone, + plAnimStage *guestAccept = new plAnimStage("BookAccept", plAnimStage::kNotifyAdvance); + plAnimStage *guestAcceptIdle = new plAnimStage("BookAcceptIdle", plAnimStage::kNotifyEnter, plAnimStage::kForwardAuto, plAnimStage::kBackNone, plAnimStage::kAdvanceNone, plAnimStage::kRegressNone, -1); brainG->AddStage(guestAccept); brainG->AddStage(guestAcceptIdle); - plCoopCoordinator *coord = TRACKED_NEW plCoopCoordinator(hostKey, guestKey, brainH, brainG, "Convergence", 1, 1, linkMsg, true); + plCoopCoordinator *coord = new plCoopCoordinator(hostKey, guestKey, brainH, brainG, "Convergence", 1, 1, linkMsg, true); - plAvCoopMsg *coMg = TRACKED_NEW plAvCoopMsg(hostKey, coord); + plAvCoopMsg *coMg = new plAvCoopMsg(hostKey, coord); coMg->SetBCastFlag(plMessage::kNetPropagate); coMg->SetBCastFlag(plMessage::kNetForce); diff --git a/Sources/Plasma/PubUtilLib/plAvatar/plAvatarMgr.h b/Sources/Plasma/PubUtilLib/plAvatar/plAvatarMgr.h index 8d2cb8a7..30539fe4 100644 --- a/Sources/Plasma/PubUtilLib/plAvatar/plAvatarMgr.h +++ b/Sources/Plasma/PubUtilLib/plAvatar/plAvatarMgr.h @@ -132,7 +132,7 @@ public: plArmatureMod *GetLocalAvatar(); plKey GetLocalAvatarKey(); static plArmatureMod *FindAvatar(plKey& avatarKey); // Key of the sceneObject - plArmatureMod *FindAvatarByPlayerID(UInt32 pid); + plArmatureMod *FindAvatarByPlayerID(uint32_t pid); plArmatureMod *FindAvatarByModelName(char *name); // Probably only useful for custom NPCs. All players are // either "Male" or "Female". void FindAllAvatarsByModelName(const char* name, plArmatureModPtrVec& outVec); @@ -149,9 +149,9 @@ public: int NumSpawnPoints() { return fSpawnPoints.size(); } int FindSpawnPoint( const char *name ) const; // \} - static int WarpPlayerToAnother(hsBool iMove, UInt32 remoteID); - static int WarpPlayerToXYZ(hsScalar x, hsScalar y, hsScalar z); - static int WarpPlayerToXYZ(int pid, hsScalar x, hsScalar y, hsScalar z); + static int WarpPlayerToAnother(hsBool iMove, uint32_t remoteID); + static int WarpPlayerToXYZ(float x, float y, float z); + static int WarpPlayerToXYZ(int pid, float x, float y, float z); static plAvatarMgr *GetInstance(); static void ShutDown(); @@ -160,7 +160,7 @@ public: hsBool MsgReceive(plMessage *msg); hsBool HandleCoopMsg(plAvCoopMsg *msg); hsBool HandleNotifyMsg(plNotifyMsg *msg); - hsBool IPassMessageToActiveCoop(plMessage *msg, UInt32 id, UInt16 serial); + hsBool IPassMessageToActiveCoop(plMessage *msg, uint32_t id, uint16_t serial); // similar to a spawn point, maintainers markers are used // to generate your position in Dni coordinates @@ -224,7 +224,7 @@ protected: // ID. By using a multimap, however, we can still handle a few different coops // for the same user by just iterating from the first match forward until // we run out of matches. - typedef std::multimap plCoopMap; + typedef std::multimap plCoopMap; plCoopMap fActiveCoops; hsTArray fCloneMsgQueue; diff --git a/Sources/Plasma/PubUtilLib/plAvatar/plAvatarSDLModifier.cpp b/Sources/Plasma/PubUtilLib/plAvatar/plAvatarSDLModifier.cpp index 51e2c2e2..2dd0ea8f 100644 --- a/Sources/Plasma/PubUtilLib/plAvatar/plAvatarSDLModifier.cpp +++ b/Sources/Plasma/PubUtilLib/plAvatar/plAvatarSDLModifier.cpp @@ -135,7 +135,7 @@ void plAvatarPhysicalSDLModifier::ISetCurrentStateFrom(const plStateDataRecord* if ((rotVar->IsDirty() || posVar->IsDirty()) && avMod->GetController()) { hsPoint3 pos; - hsScalar zRot; + float zRot; posVar->Get(&pos.fX); rotVar->Get(&zRot); avMod->GetController()->SetState(pos, zRot); @@ -155,7 +155,7 @@ void plAvatarPhysicalSDLModifier::IPutCurrentStateIn(plStateDataRecord* dstState if(avMod && avMod->GetController()) { hsPoint3 pos; - hsScalar zRot; + float zRot; avMod->GetController()->GetState(pos, zRot); dstState->FindVar(kStrRotation)->Set(zRot); dstState->FindVar(kStrPosition)->Set(&pos.fX); @@ -299,7 +299,7 @@ void plAvatarSDLModifier::IPutClimbBrainIn(plArmatureMod *avMod, plAvBrainClimb void plAvatarSDLModifier::ISetClimbBrainFrom(plArmatureMod *avMod, const plStateDataRecord* srcState) { - plAvBrainClimb *climbBrain = TRACKED_NEW plAvBrainClimb(); + plAvBrainClimb *climbBrain = new plAvBrainClimb(); avMod->PushBrain(climbBrain); climbBrain->LoadFromSDL(srcState); } @@ -311,7 +311,7 @@ void plAvatarSDLModifier::IPutDriveBrainIn(plArmatureMod *avMod, plAvBrainDrive void plAvatarSDLModifier::ISetDriveBrainFrom(plArmatureMod *avMod, const plStateDataRecord* src) { - plAvBrainDrive *driveBrain = TRACKED_NEW plAvBrainDrive(); + plAvBrainDrive *driveBrain = new plAvBrainDrive(); avMod->PushBrain(driveBrain); } @@ -357,7 +357,7 @@ bool plAvatarSDLModifier::ISetGenericBrainFrom(plArmatureMod *avMod, const plSta return false; } - plAnimStageVec * stages = TRACKED_NEW plAnimStageVec(); + plAnimStageVec * stages = new plAnimStageVec(); for (int j = 0; j < numStages; j++) { plStateDataRecord* stageState = stagesVar->GetStateDataRecord(j); @@ -418,7 +418,7 @@ bool plAvatarSDLModifier::ISetGenericBrainFrom(plArmatureMod *avMod, const plSta } plAvBrainGeneric *newBrain = - TRACKED_NEW plAvBrainGeneric(stages, + new plAvBrainGeneric(stages, nil, nil, callbackRcvr, exitFlags, @@ -437,7 +437,7 @@ bool plAvatarSDLModifier::ISetGenericBrainFrom(plArmatureMod *avMod, const plSta // IGetStageFrom ---------------------------------------------------------------------------------------- plAnimStage * plAvatarSDLModifier::IGetStageFrom(plArmatureMod *avMod, const plStateDataRecord* srcState) { - UInt32 notifyFlags=0; + uint32_t notifyFlags=0; bool notifyEnter, notifyLoop, notifyAdv, notifyRegress; if (srcState->FindVar(StandardStageVarNames::kStrNotifyEnter)->Get(¬ifyEnter)) @@ -499,8 +499,8 @@ plAnimStage * plAvatarSDLModifier::IGetStageFrom(plArmatureMod *avMod, const plS // ***!!! need to capture "advanceTo" and "regressTo" values!!! bool hackAdvanceToWrong = false, hackRegressToWrong = false; - plAnimStage *newStage = TRACKED_NEW plAnimStage(name, - (UInt8)notifyFlags, + plAnimStage *newStage = new plAnimStage(name, + (uint8_t)notifyFlags, static_cast(fwd), static_cast(bwd), static_cast(adv), @@ -526,7 +526,7 @@ bool plAvatarSDLModifier::IPutStageIn(plArmatureMod *avMod, plAnimStage *stage, dstState->FindVar(StandardStageVarNames::kStrStageAdvance)->Set((int)stage->GetAdvanceType()); dstState->FindVar(StandardStageVarNames::kStrStageRegress)->Set((int)stage->GetRegressType()); - UInt32 notifies = stage->GetNotifyFlags(); + uint32_t notifies = stage->GetNotifyFlags(); dstState->FindVar(StandardStageVarNames::kStrNotifyEnter)->Set((notifies & plAnimStage::kNotifyEnter) ? true : false); dstState->FindVar(StandardStageVarNames::kStrNotifyLoop)->Set((notifies & plAnimStage::kNotifyLoop) ? true : false); dstState->FindVar(StandardStageVarNames::kStrNotifyStageAdvance)->Set((notifies & plAnimStage::kNotifyAdvance) ? true : false); diff --git a/Sources/Plasma/PubUtilLib/plAvatar/plAvatarSDLModifier.h b/Sources/Plasma/PubUtilLib/plAvatar/plAvatarSDLModifier.h index 75993839..dfe1f969 100644 --- a/Sources/Plasma/PubUtilLib/plAvatar/plAvatarSDLModifier.h +++ b/Sources/Plasma/PubUtilLib/plAvatar/plAvatarSDLModifier.h @@ -42,7 +42,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #ifndef plAvatarSDLModifier_inc #define plAvatarSDLModifier_inc -#include "hsConfig.h" +#include "HeadSpin.h" #include "hsStlUtils.h" #include "plModifier/plSDLModifier.h" @@ -68,7 +68,7 @@ protected: void ISetCurrentStateFrom(const plStateDataRecord* srcState); void IPutCurrentStateIn(plStateDataRecord* dstState); - UInt32 IApplyModFlags(UInt32 sendFlags) { return (sendFlags | plSynchedObject::kDontPersistOnServer | plSynchedObject::kIsAvatarState); } + uint32_t IApplyModFlags(uint32_t sendFlags) { return (sendFlags | plSynchedObject::kDontPersistOnServer | plSynchedObject::kIsAvatarState); } public: CLASSNAME_REGISTER( plAvatarPhysicalSDLModifier ); @@ -150,7 +150,7 @@ protected: void IPutDriveBrainIn(plArmatureMod *avMod, plAvBrainDrive *brain, plStateDataRecord* dstState); bool IPutStageIn(plArmatureMod *avMod, plAnimStage *stage, plStateDataRecord* dstState); - UInt32 IApplyModFlags(UInt32 sendFlags) { return (sendFlags | plSynchedObject::kDontPersistOnServer | plSynchedObject::kIsAvatarState); } + uint32_t IApplyModFlags(uint32_t sendFlags) { return (sendFlags | plSynchedObject::kDontPersistOnServer | plSynchedObject::kIsAvatarState); } public: CLASSNAME_REGISTER( plAvatarSDLModifier ); diff --git a/Sources/Plasma/PubUtilLib/plAvatar/plAvatarTasks.cpp b/Sources/Plasma/PubUtilLib/plAvatar/plAvatarTasks.cpp index 62b2ff21..c614f849 100644 --- a/Sources/Plasma/PubUtilLib/plAvatar/plAvatarTasks.cpp +++ b/Sources/Plasma/PubUtilLib/plAvatar/plAvatarTasks.cpp @@ -39,8 +39,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com Mead, WA 99021 *==LICENSE==*/ -#include "hsConfig.h" -#include "hsWindows.h" +#include "HeadSpin.h" // singular #include "plAvatarTasks.h" @@ -57,7 +56,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "plAvatarMgr.h" // global -#include "hsUtils.h" + // other #include "plgDispatch.h" @@ -89,20 +88,20 @@ plAvTask::plAvTask() } // START -hsBool plAvTask::Start(plArmatureMod *avatar, plArmatureBrain *brain, double time, hsScalar elapsed) +hsBool plAvTask::Start(plArmatureMod *avatar, plArmatureBrain *brain, double time, float elapsed) { return true; // true indicates the task has started succesfully } // PROCESS -hsBool plAvTask::Process(plArmatureMod *avatar, plArmatureBrain *brain, double time, hsScalar elapsed) +hsBool plAvTask::Process(plArmatureMod *avatar, plArmatureBrain *brain, double time, float elapsed) { return false; } // Finish ----------------------------------------------------------------------------------- // ------- -void plAvTask::Finish(plArmatureMod *avatar, plArmatureBrain *brain, double time, hsScalar elapsed) +void plAvTask::Finish(plArmatureMod *avatar, plArmatureBrain *brain, double time, float elapsed) { } @@ -133,7 +132,7 @@ void plAvTask::ILimitPlayersInput(plArmatureMod *avatar) { plInputInterfaceMgr::GetInstance()->ForceCursorHidden(true); // tell the KI to be disabled while we are busy - pfKIMsg* msg = TRACKED_NEW pfKIMsg(pfKIMsg::kTempDisableKIandBB); + pfKIMsg* msg = new pfKIMsg(pfKIMsg::kTempDisableKIandBB); plgDispatch::MsgSend( msg ); } } @@ -145,7 +144,7 @@ void plAvTask::IUndoLimitPlayersInput(plArmatureMod *avatar) { plInputInterfaceMgr::GetInstance()->ForceCursorHidden(false); // tell the KI to be re-enabled - pfKIMsg* msg = TRACKED_NEW pfKIMsg(pfKIMsg::kTempEnableKIandBB); + pfKIMsg* msg = new pfKIMsg(pfKIMsg::kTempEnableKIandBB); plgDispatch::MsgSend( msg ); } } @@ -214,7 +213,7 @@ void GetPositionAndRotation(hsMatrix44 transform, hsScalarTriple *position, hsQu // START // Adjust our goal time based on our duration and the current time -hsBool plAvSeekTask::Start(plArmatureMod *avatar, plArmatureBrain *brain, double time, hsScalar elapsed) +hsBool plAvSeekTask::Start(plArmatureMod *avatar, plArmatureBrain *brain, double time, float elapsed) { fTargetTime = time + fDuration; // clock starts now.... fPhysicalAtStart = avatar->IsPhysicsEnabled(); @@ -281,7 +280,7 @@ void CalcHandleTargetPosition(hsMatrix44 &result, plSceneObject *insert, plScene // PROCESS // Move closer to the goal position and orientation -hsBool plAvSeekTask::Process(plArmatureMod *avatar, plArmatureBrain *brain, double time, hsScalar elapsed) +hsBool plAvSeekTask::Process(plArmatureMod *avatar, plArmatureBrain *brain, double time, float elapsed) { hsQuat rotation; hsPoint3 position; @@ -349,10 +348,10 @@ plAvAnimTask::plAvAnimTask() // CTOR animName, initialBlend, targetBlend, fadeSpeed, start, loop, attach plAvAnimTask::plAvAnimTask(const char *animName, - hsScalar initialBlend, - hsScalar targetBlend, - hsScalar fadeSpeed, - hsScalar setTime, + float initialBlend, + float targetBlend, + float fadeSpeed, + float setTime, hsBool start, hsBool loop, hsBool attach) @@ -370,7 +369,7 @@ plAvAnimTask::plAvAnimTask(const char *animName, } // CTOR animName, fadeSpeed, attach -plAvAnimTask::plAvAnimTask(const char *animName, hsScalar fadeSpeed, hsBool attach) +plAvAnimTask::plAvAnimTask(const char *animName, float fadeSpeed, hsBool attach) : fInitialBlend(0.0f), fTargetBlend(0.0f), fFadeSpeed(fadeSpeed), @@ -398,7 +397,7 @@ plAvAnimTask::~plAvAnimTask() } // START -hsBool plAvAnimTask::Start(plArmatureMod *avatar, plArmatureBrain *brain, double time, hsScalar elapsed) +hsBool plAvAnimTask::Start(plArmatureMod *avatar, plArmatureBrain *brain, double time, float elapsed) { hsBool result = false; if(fAttach) @@ -440,7 +439,7 @@ hsBool plAvAnimTask::Start(plArmatureMod *avatar, plArmatureBrain *brain, double } // PROCESS -hsBool plAvAnimTask::Process(plArmatureMod *avatar, plArmatureBrain *brain, double time, hsScalar elapsed) +hsBool plAvAnimTask::Process(plArmatureMod *avatar, plArmatureBrain *brain, double time, float elapsed) { // the only reason we need this function is to watch the animation until it fades out hsBool result = false; @@ -579,7 +578,7 @@ plAvOneShotTask::~plAvOneShotTask() // START -hsBool plAvOneShotTask::Start(plArmatureMod *avatar, plArmatureBrain *brain, double time, hsScalar elapsed) +hsBool plAvOneShotTask::Start(plArmatureMod *avatar, plArmatureBrain *brain, double time, float elapsed) { hsBool result = false; @@ -598,7 +597,7 @@ hsBool plAvOneShotTask::Start(plArmatureMod *avatar, plArmatureBrain *brain, dou { // Must do the physics re-enable through a callback so that it happens before the "done" callback and we don't // step over some script's attempt to disable physics again. - plAvatarPhysicsEnableCallbackMsg *epMsg = TRACKED_NEW plAvatarPhysicsEnableCallbackMsg(avatar->GetKey(), kStop, 0, 0, 0, 0); + plAvatarPhysicsEnableCallbackMsg *epMsg = new plAvatarPhysicsEnableCallbackMsg(avatar->GetKey(), kStop, 0, 0, 0, 0); fAnimInstance->GetTimeConvert()->AddCallback(epMsg); hsRefCnt_SafeUnRef(epMsg); } @@ -634,7 +633,7 @@ hsBool plAvOneShotTask::Start(plArmatureMod *avatar, plArmatureBrain *brain, dou if (plAvOneShotTask::fForce3rdPerson && avatar->IsLocalAvatar()) { // create message - plCameraMsg* pMsg = TRACKED_NEW plCameraMsg; + plCameraMsg* pMsg = new plCameraMsg; pMsg->SetBCastFlag(plMessage::kBCastByExactType); pMsg->SetBCastFlag(plMessage::kNetPropagate, false); pMsg->SetCmd(plCameraMsg::kResponderSetThirdPerson); @@ -664,7 +663,7 @@ hsBool plAvOneShotTask::Start(plArmatureMod *avatar, plArmatureBrain *brain, dou } // PROCESS -hsBool plAvOneShotTask::Process(plArmatureMod *avatar, plArmatureBrain *brain, double time, hsScalar elapsed) +hsBool plAvOneShotTask::Process(plArmatureMod *avatar, plArmatureBrain *brain, double time, float elapsed) { // *** if we are under mouse control, adjust it here @@ -675,7 +674,7 @@ hsBool plAvOneShotTask::Process(plArmatureMod *avatar, plArmatureBrain *brain, d { const plAGAnim * animation = fAnimInstance->GetAnimation(); double endTime = (fBackwards ? animation->GetStart() : animation->GetEnd()); - fAnimInstance->SetCurrentTime((hsScalar)endTime); + fAnimInstance->SetCurrentTime((float)endTime); avatar->ApplyAnimations(time, elapsed); if(--fWaitFrames == 0) @@ -702,9 +701,9 @@ hsBool plAvOneShotTask::Process(plArmatureMod *avatar, plArmatureBrain *brain, d avatar->GetPhysical()->CheckValidPosition(&overlaps); if (overlaps) { - char *buffy = TRACKED_NEW char[64 + strlen(overlaps)]; + char *buffy = new char[64 + strlen(overlaps)]; sprintf(buffy, "Oneshot ends overlapping %s", overlaps); - plConsoleMsg *showLine = TRACKED_NEW plConsoleMsg( plConsoleMsg::kAddLine, buffy ); + plConsoleMsg *showLine = new plConsoleMsg( plConsoleMsg::kAddLine, buffy ); showLine->Send(); delete[] overlaps; delete[] buffy; @@ -720,7 +719,7 @@ hsBool plAvOneShotTask::Process(plArmatureMod *avatar, plArmatureBrain *brain, d if (plAvOneShotTask::fForce3rdPerson && avatar->IsLocalAvatar()) { // create message - plCameraMsg* pMsg = TRACKED_NEW plCameraMsg; + plCameraMsg* pMsg = new plCameraMsg; pMsg->SetBCastFlag(plMessage::kBCastByExactType); pMsg->SetBCastFlag(plMessage::kNetPropagate, false); pMsg->SetCmd(plCameraMsg::kResponderUndoThirdPerson); @@ -778,7 +777,7 @@ plAvOneShotLinkTask::~plAvOneShotLinkTask() } // task protocol -hsBool plAvOneShotLinkTask::Start(plArmatureMod *avatar, plArmatureBrain *brain, double time, hsScalar elapsed) +hsBool plAvOneShotLinkTask::Start(plArmatureMod *avatar, plArmatureBrain *brain, double time, float elapsed) { hsBool result = plAvOneShotTask::Start(avatar, brain, time, elapsed); fStartTime = time; @@ -795,7 +794,7 @@ hsBool plAvOneShotLinkTask::Start(plArmatureMod *avatar, plArmatureBrain *brain, return result; } -hsBool plAvOneShotLinkTask::Process(plArmatureMod *avatar, plArmatureBrain *brain, double time, hsScalar elapsed) +hsBool plAvOneShotLinkTask::Process(plArmatureMod *avatar, plArmatureBrain *brain, double time, float elapsed) { hsBool result = plAvOneShotTask::Process(avatar, brain, time, elapsed); if (fIgnore) diff --git a/Sources/Plasma/PubUtilLib/plAvatar/plAvatarTasks.h b/Sources/Plasma/PubUtilLib/plAvatar/plAvatarTasks.h index 2caab5c1..79b206ea 100644 --- a/Sources/Plasma/PubUtilLib/plAvatar/plAvatarTasks.h +++ b/Sources/Plasma/PubUtilLib/plAvatar/plAvatarTasks.h @@ -84,19 +84,19 @@ public: \param loop Make the animation loop? \param attach Are we attaching or detaching the animation? */ - plAvAnimTask(const char *animName, hsScalar initialBlend, hsScalar targetBlend, hsScalar fadeSpeed, - hsScalar setTime, hsBool start, hsBool loop, hsBool attach); + plAvAnimTask(const char *animName, float initialBlend, float targetBlend, float fadeSpeed, + float setTime, hsBool start, hsBool loop, hsBool attach); /** Canonical constructor form form for detaching \param animName The name of the animation we're detaching \param fadeSpeed How fast to fade it out. */ - plAvAnimTask(const char *animName, hsScalar fadeSpeed, hsBool attach = false); + plAvAnimTask(const char *animName, float fadeSpeed, hsBool attach = false); virtual ~plAvAnimTask(); // task protocol - virtual hsBool Start(plArmatureMod *avatar, plArmatureBrain *brain, double time, hsScalar elapsed); - virtual hsBool Process(plArmatureMod *avatar, plArmatureBrain *brain, double time, hsScalar elapsed); + virtual hsBool Start(plArmatureMod *avatar, plArmatureBrain *brain, double time, float elapsed); + virtual hsBool Process(plArmatureMod *avatar, plArmatureBrain *brain, double time, float elapsed); virtual void LeaveAge(plArmatureMod *avatar); // plasma protocol @@ -109,10 +109,10 @@ public: protected: // public members char* fAnimName; // the animation we're operating on - hsScalar fInitialBlend; // the blend to establish (attaching only) - hsScalar fTargetBlend; // the blend to achieve eventually (attaching only) - hsScalar fFadeSpeed; // how fast to achieve the blend - hsScalar fSetTime; // set the animation to this time + float fInitialBlend; // the blend to establish (attaching only) + float fTargetBlend; // the blend to achieve eventually (attaching only) + float fFadeSpeed; // how fast to achieve the blend + float fSetTime; // set the animation to this time hsBool fStart; // start the animation playing? (attaching only) hsBool fLoop; // turn on looping? (attaching only) hsBool fAttach; // attach? (otherwise detach) @@ -137,8 +137,8 @@ public: plAvSeekTask(plKey target, plAvAlignment alignType, const char *animName); // task protocol - virtual hsBool Start(plArmatureMod *avatar, plArmatureBrain *brain, double time, hsScalar elapsed); - virtual hsBool Process(plArmatureMod *avatar, plArmatureBrain *brain, double time, hsScalar elapsed); + virtual hsBool Start(plArmatureMod *avatar, plArmatureBrain *brain, double time, float elapsed); + virtual hsBool Process(plArmatureMod *avatar, plArmatureBrain *brain, double time, float elapsed); virtual void LeaveAge(plArmatureMod *avatar); // plasma protocol @@ -193,8 +193,8 @@ public: virtual ~plAvOneShotTask(); // task protocol - virtual hsBool Start(plArmatureMod *avatar, plArmatureBrain *brain, double time, hsScalar elapsed); - virtual hsBool Process(plArmatureMod *avatar, plArmatureBrain *brain, double time, hsScalar elapsed); + virtual hsBool Start(plArmatureMod *avatar, plArmatureBrain *brain, double time, float elapsed); + virtual hsBool Process(plArmatureMod *avatar, plArmatureBrain *brain, double time, float elapsed); virtual void LeaveAge(plArmatureMod *avatar); void SetAnimName(char *name); @@ -246,8 +246,8 @@ public: virtual ~plAvOneShotLinkTask(); // task protocol - virtual hsBool Start(plArmatureMod *avatar, plArmatureBrain *brain, double time, hsScalar elapsed); - virtual hsBool Process(plArmatureMod *avatar, plArmatureBrain *brain, double time, hsScalar elapsed); + virtual hsBool Start(plArmatureMod *avatar, plArmatureBrain *brain, double time, float elapsed); + virtual hsBool Process(plArmatureMod *avatar, plArmatureBrain *brain, double time, float elapsed); CLASSNAME_REGISTER( plAvOneShotLinkTask ); GETINTERFACE_ANY( plAvOneShotLinkTask, plAvOneShotTask ); @@ -262,7 +262,7 @@ public: protected: char *fMarkerName; double fStartTime; - hsScalar fMarkerTime; + float fMarkerTime; hsBool fLinkFired; }; diff --git a/Sources/Plasma/PubUtilLib/plAvatar/plClothingLayout.h b/Sources/Plasma/PubUtilLib/plAvatar/plClothingLayout.h index b789a7ba..b1a9bf24 100644 --- a/Sources/Plasma/PubUtilLib/plAvatar/plClothingLayout.h +++ b/Sources/Plasma/PubUtilLib/plAvatar/plClothingLayout.h @@ -42,9 +42,9 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #ifndef PLCLOTHINGLAYOUT_INC #define PLCLOTHINGLAYOUT_INC -#include "hsTypes.h" +#include "HeadSpin.h" #include "hsTemplates.h" -#include "hsUtils.h" + // This file is intended to be an independent section so that plClothingMtl and plAvatarClothing // can both use these structures, without all the plCreatable/hsKeyedObject/plSynchedObject stuff @@ -72,12 +72,12 @@ public: }; char *fName; - UInt32 fXPos; - UInt32 fYPos; - UInt32 fWidth; - UInt32 fHeight; + uint32_t fXPos; + uint32_t fYPos; + uint32_t fWidth; + uint32_t fHeight; - plClothingElement(const char *name, UInt32 xPos, UInt32 yPos, UInt32 width, UInt32 height) + plClothingElement(const char *name, uint32_t xPos, uint32_t yPos, uint32_t width, uint32_t height) { fName = hsStrcpy(name); fXPos = xPos; @@ -90,36 +90,36 @@ public: static void GetElements(hsTArray &out) { /* - out.Append(TRACKED_NEW plClothingElement("shirt-chest", 768, 0, 256, 512)); - out.Append(TRACKED_NEW plClothingElement("shirt-sleeve", 512, 192, 256, 128)); - out.Append(TRACKED_NEW plClothingElement("face", 0, 0, 512, 512)); - out.Append(TRACKED_NEW plClothingElement("eyeball", 64, 512, 64, 64)); - out.Append(TRACKED_NEW plClothingElement("shoe-top", 0, 832, 128, 128)); - out.Append(TRACKED_NEW plClothingElement("shoe-bottom", 0, 768, 128, 64)); - out.Append(TRACKED_NEW plClothingElement("pants", 512, 512, 512, 512)); - out.Append(TRACKED_NEW plClothingElement("hand-LOD", 64, 576, 64, 64)); - out.Append(TRACKED_NEW plClothingElement("hand-square", 128, 512, 128, 128)); - out.Append(TRACKED_NEW plClothingElement("hand-wide", 0, 640, 256, 128)); - out.Append(TRACKED_NEW plClothingElement("playerbook", 512, 0, 256, 128)); - out.Append(TRACKED_NEW plClothingElement("backpack", 512, 256, 256, 256)); - out.Append(TRACKED_NEW plClothingElement("glasses-front", 256, 512, 256, 64)); - out.Append(TRACKED_NEW plClothingElement("glasses-side", 256, 576, 256, 32)); - out.Append(TRACKED_NEW plClothingElement("KI", 256, 640, 256, 128)); + out.Append(new plClothingElement("shirt-chest", 768, 0, 256, 512)); + out.Append(new plClothingElement("shirt-sleeve", 512, 192, 256, 128)); + out.Append(new plClothingElement("face", 0, 0, 512, 512)); + out.Append(new plClothingElement("eyeball", 64, 512, 64, 64)); + out.Append(new plClothingElement("shoe-top", 0, 832, 128, 128)); + out.Append(new plClothingElement("shoe-bottom", 0, 768, 128, 64)); + out.Append(new plClothingElement("pants", 512, 512, 512, 512)); + out.Append(new plClothingElement("hand-LOD", 64, 576, 64, 64)); + out.Append(new plClothingElement("hand-square", 128, 512, 128, 128)); + out.Append(new plClothingElement("hand-wide", 0, 640, 256, 128)); + out.Append(new plClothingElement("playerbook", 512, 0, 256, 128)); + out.Append(new plClothingElement("backpack", 512, 256, 256, 256)); + out.Append(new plClothingElement("glasses-front", 256, 512, 256, 64)); + out.Append(new plClothingElement("glasses-side", 256, 576, 256, 32)); + out.Append(new plClothingElement("KI", 256, 640, 256, 128)); */ - out.Append(TRACKED_NEW plClothingElement("Chest", 768, 0, 256, 512)); - out.Append(TRACKED_NEW plClothingElement("Arm", 512, 192, 256, 128)); - out.Append(TRACKED_NEW plClothingElement("Face", 0, 256, 512, 256)); - out.Append(TRACKED_NEW plClothingElement("Eye", 64, 704, 64, 64)); - out.Append(TRACKED_NEW plClothingElement("Extra Hair", 256, 0, 256, 256)); - out.Append(TRACKED_NEW plClothingElement("Hat", 0, 0, 256, 256)); - out.Append(TRACKED_NEW plClothingElement("Foot", 0, 768, 256, 256)); - out.Append(TRACKED_NEW plClothingElement("Legs", 512, 512, 512, 512)); - out.Append(TRACKED_NEW plClothingElement("LOD", 64, 640, 64, 64)); - out.Append(TRACKED_NEW plClothingElement("Finger", 128, 640, 128, 128)); - out.Append(TRACKED_NEW plClothingElement("Palm", 0, 512, 256, 128)); - out.Append(TRACKED_NEW plClothingElement("Player Book", 256, 512, 256, 128)); - out.Append(TRACKED_NEW plClothingElement("Glasses", 384, 640, 128, 128)); - out.Append(TRACKED_NEW plClothingElement("KI", 256, 640, 128, 128)); + out.Append(new plClothingElement("Chest", 768, 0, 256, 512)); + out.Append(new plClothingElement("Arm", 512, 192, 256, 128)); + out.Append(new plClothingElement("Face", 0, 256, 512, 256)); + out.Append(new plClothingElement("Eye", 64, 704, 64, 64)); + out.Append(new plClothingElement("Extra Hair", 256, 0, 256, 256)); + out.Append(new plClothingElement("Hat", 0, 0, 256, 256)); + out.Append(new plClothingElement("Foot", 0, 768, 256, 256)); + out.Append(new plClothingElement("Legs", 512, 512, 512, 512)); + out.Append(new plClothingElement("LOD", 64, 640, 64, 64)); + out.Append(new plClothingElement("Finger", 128, 640, 128, 128)); + out.Append(new plClothingElement("Palm", 0, 512, 256, 128)); + out.Append(new plClothingElement("Player Book", 256, 512, 256, 128)); + out.Append(new plClothingElement("Glasses", 384, 640, 128, 128)); + out.Append(new plClothingElement("KI", 256, 640, 128, 128)); } }; @@ -127,11 +127,11 @@ public: class plClothingLayout { public: - plClothingLayout(char *name, UInt32 origWidth) { fName = hsStrcpy(name); fOrigWidth = origWidth; } + plClothingLayout(char *name, uint32_t origWidth) { fName = hsStrcpy(name); fOrigWidth = origWidth; } ~plClothingLayout() { delete [] fName; } char *fName; - UInt32 fOrigWidth; + uint32_t fOrigWidth; hsTArray fElements; /* enum diff --git a/Sources/Plasma/PubUtilLib/plAvatar/plClothingSDLModifier.cpp b/Sources/Plasma/PubUtilLib/plAvatar/plClothingSDLModifier.cpp index 47d778c1..646ba07e 100644 --- a/Sources/Plasma/PubUtilLib/plAvatar/plClothingSDLModifier.cpp +++ b/Sources/Plasma/PubUtilLib/plAvatar/plClothingSDLModifier.cpp @@ -135,10 +135,10 @@ void plClothingSDLModifier::IPutCurrentStateIn(plStateDataRecord* dstState) // skin tint plSDStateVariable* appearanceStateDesc = dstState->FindSDVar(kStrAppearance); // for skin tint - UInt8 skinTint[3]; - skinTint[0] = (UInt8)(clothing->fSkinTint.r * 255); - skinTint[1] = (UInt8)(clothing->fSkinTint.g * 255); - skinTint[2] = (UInt8)(clothing->fSkinTint.b * 255); + uint8_t skinTint[3]; + skinTint[0] = (uint8_t)(clothing->fSkinTint.r * 255); + skinTint[1] = (uint8_t)(clothing->fSkinTint.g * 255); + skinTint[2] = (uint8_t)(clothing->fSkinTint.b * 255); appearanceStateDesc->GetStateDataRecord(0)->FindVar(kStrSkinTint)->Set(skinTint); plSimpleStateVariable* faceBlends = appearanceStateDesc->GetStateDataRecord(0)->FindVar(kStrFaceBlends); @@ -146,7 +146,7 @@ void plClothingSDLModifier::IPutCurrentStateIn(plStateDataRecord* dstState) if (faceBlends->GetCount() != numBlends) faceBlends->Alloc(numBlends); for(i = 0; i < numBlends; i++) - faceBlends->Set((UInt8)(clothing->fSkinBlends[i] * 255), i); + faceBlends->Set((uint8_t)(clothing->fSkinBlends[i] * 255), i); SDRs.Append(appearanceStateDesc->GetStateDataRecord(0)); @@ -165,14 +165,14 @@ void plClothingSDLModifier::PutSingleItemIntoSDR(plClosetItem *item, plStateData //hsColorRGBA c = item->fOptions.fTint1; //hsColorRGBA c2 = item->fOptions.fTint2; - UInt8 c[3]; - UInt8 c2[3]; - c[0] = (UInt8)(item->fOptions.fTint1.r * 255); - c[1] = (UInt8)(item->fOptions.fTint1.g * 255); - c[2] = (UInt8)(item->fOptions.fTint1.b * 255); - c2[0] = (UInt8)(item->fOptions.fTint2.r * 255); - c2[1] = (UInt8)(item->fOptions.fTint2.g * 255); - c2[2] = (UInt8)(item->fOptions.fTint2.b * 255); + uint8_t c[3]; + uint8_t c2[3]; + c[0] = (uint8_t)(item->fOptions.fTint1.r * 255); + c[1] = (uint8_t)(item->fOptions.fTint1.g * 255); + c[2] = (uint8_t)(item->fOptions.fTint1.b * 255); + c2[0] = (uint8_t)(item->fOptions.fTint2.r * 255); + c2[1] = (uint8_t)(item->fOptions.fTint2.g * 255); + c2[2] = (uint8_t)(item->fOptions.fTint2.b * 255); sdr->FindVar(kStrTint)->Set(c); sdr->FindVar(kStrTint2)->Set(c2); @@ -229,8 +229,8 @@ void plClothingSDLModifier::HandleSingleSDR(const plStateDataRecord *sdr, plClot return; int i; - UInt8 tint[3]; - hsScalar tintScalar[3]; + uint8_t tint[3]; + float tintScalar[3]; if (!strcmp(sdr->GetDescriptor()->GetName(), kStrClothingDescName)) { // get item from clothesItem @@ -300,9 +300,9 @@ void plClothingSDLModifier::HandleSingleSDR(const plStateDataRecord *sdr, plClot int numBlends = plClothingElement::kLayerSkinLast - plClothingElement::kLayerSkinFirst; for(i = 0; i < numBlends && i < faceBlends->GetCount(); i++) { - UInt8 blend; + uint8_t blend; faceBlends->Get(&blend, i); - clothing->fSkinBlends[i] = (hsScalar)blend / 255; + clothing->fSkinBlends[i] = (float)blend / 255; } } } diff --git a/Sources/Plasma/PubUtilLib/plAvatar/plClothingSDLModifier.h b/Sources/Plasma/PubUtilLib/plAvatar/plClothingSDLModifier.h index 523bbbef..551af57c 100644 --- a/Sources/Plasma/PubUtilLib/plAvatar/plClothingSDLModifier.h +++ b/Sources/Plasma/PubUtilLib/plAvatar/plClothingSDLModifier.h @@ -46,7 +46,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "hsColorRGBA.h" #include "hsTemplates.h" -#include "hsTypes.h" +#include "HeadSpin.h" // // This modifier is responsible for sending and recving @@ -66,7 +66,7 @@ protected: void IPutCurrentStateIn(plStateDataRecord* dstState); void ISetCurrentStateFrom(const plStateDataRecord* srcState); - UInt32 IApplyModFlags(UInt32 sendFlags) { return (sendFlags | plSynchedObject::kDontPersistOnServer | plSynchedObject::kIsAvatarState); } + uint32_t IApplyModFlags(uint32_t sendFlags) { return (sendFlags | plSynchedObject::kDontPersistOnServer | plSynchedObject::kIsAvatarState); } public: // var labels diff --git a/Sources/Plasma/PubUtilLib/plAvatar/plCoopCoordinator.cpp b/Sources/Plasma/PubUtilLib/plAvatar/plCoopCoordinator.cpp index f737ba04..9630e592 100644 --- a/Sources/Plasma/PubUtilLib/plAvatar/plCoopCoordinator.cpp +++ b/Sources/Plasma/PubUtilLib/plAvatar/plCoopCoordinator.cpp @@ -55,7 +55,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "plAvTaskSeek.h" // global -#include "hsUtils.h" + // other #include "plMessage/plAvCoopMsg.h" @@ -95,7 +95,7 @@ plCoopCoordinator::plCoopCoordinator() plCoopCoordinator::plCoopCoordinator(plKey host, plKey guest, plAvBrainCoop *hostBrain, plAvBrainCoop *guestBrain, const char *synchBone, - UInt32 hostOfferStage, UInt32 guestAcceptStage, + uint32_t hostOfferStage, uint32_t guestAcceptStage, plMessage *guestAcceptMsg, bool autoStartGuest) : fHostKey(host), @@ -128,7 +128,7 @@ plCoopCoordinator::plCoopCoordinator(plKey host, plKey guest, // disable our clickability here if we are the guest if (plNetClientMgr::GetInstance()->GetLocalPlayerKey() == guest) { - plInputIfaceMgrMsg* pMsg = TRACKED_NEW plInputIfaceMgrMsg(plInputIfaceMgrMsg::kGUIDisableAvatarClickable); + plInputIfaceMgrMsg* pMsg = new plInputIfaceMgrMsg(plInputIfaceMgrMsg::kGUIDisableAvatarClickable); pMsg->SetAvKey(guest); pMsg->SetBCastFlag(plMessage::kNetPropagate); pMsg->SetBCastFlag(plMessage::kNetForce); @@ -160,7 +160,7 @@ hsBool plCoopCoordinator::MsgReceive(plMessage *msg) if(mtevt) { int stageNum = mtevt->fStage; - UInt32 stageState = mtevt->fEvent; + uint32_t stageState = mtevt->fEvent; plKey noteSender = notify->GetSender(); bool isFromHost = (noteSender == fHostKey); @@ -245,7 +245,7 @@ hsBool plCoopCoordinator::MsgReceive(plMessage *msg) DebugMsg("COOP: Received avatar seek finished msg: aborted = %d", seekDone->fAborted ? 1 : 0); if ( seekDone->fAborted ) { - plAvCoopMsg *coopM = TRACKED_NEW plAvCoopMsg(plAvCoopMsg::kGuestSeekAbort,fInitiatorID,(UInt16)fInitiatorSerial); + plAvCoopMsg *coopM = new plAvCoopMsg(plAvCoopMsg::kGuestSeekAbort,fInitiatorID,(uint16_t)fInitiatorSerial); coopM->SetBCastFlag(plMessage::kNetPropagate); coopM->SetBCastFlag(plMessage::kNetForce); coopM->AddReceiver(GetKey()); @@ -254,7 +254,7 @@ hsBool plCoopCoordinator::MsgReceive(plMessage *msg) } else { - plAvCoopMsg *coopM = TRACKED_NEW plAvCoopMsg(plAvCoopMsg::kGuestSeeked,fInitiatorID,(UInt16)fInitiatorSerial); + plAvCoopMsg *coopM = new plAvCoopMsg(plAvCoopMsg::kGuestSeeked,fInitiatorID,(uint16_t)fInitiatorSerial); coopM->SetBCastFlag(plMessage::kNetPropagate); coopM->SetBCastFlag(plMessage::kNetForce); coopM->AddReceiver(GetKey()); @@ -285,15 +285,15 @@ bool plCoopCoordinator::IsActiveForReal() // GetInitiatorID ------------------------ // --------------- -UInt32 plCoopCoordinator::GetInitiatorID() +uint32_t plCoopCoordinator::GetInitiatorID() { return fInitiatorID; } // GetInitiatorSerial ------------------------ -UInt16 plCoopCoordinator::GetInitiatorSerial() +uint16_t plCoopCoordinator::GetInitiatorSerial() { - return (UInt16)fInitiatorSerial; + return (uint16_t)fInitiatorSerial; } // IStartHost ---------------------- @@ -305,7 +305,7 @@ void plCoopCoordinator::IStartHost() plArmatureMod *hostAv = plAvatarMgr::FindAvatar(fHostKey); if (guestAv && hostAv) { - plAvSeekMsg *msg = TRACKED_NEW plAvSeekMsg(nil, hostAv->GetKey(), nil, 1.f, true); + plAvSeekMsg *msg = new plAvSeekMsg(nil, hostAv->GetKey(), nil, 1.f, true); hsClearBits(msg->fFlags, plAvSeekMsg::kSeekFlagForce3rdPersonOnStart); guestAv->GetPositionAndRotationSim(&msg->fTargetLookAt, nil); hostAv->GetPositionAndRotationSim(&msg->fTargetPos, nil); @@ -313,8 +313,8 @@ void plCoopCoordinator::IStartHost() } // now tell the host to initiate the thing. - plAvTaskBrain *brainT = TRACKED_NEW plAvTaskBrain(fHostBrain); - plAvTaskMsg *brainM = TRACKED_NEW plAvTaskMsg(GetKey(), fHostKey, brainT); + plAvTaskBrain *brainT = new plAvTaskBrain(fHostBrain); + plAvTaskMsg *brainM = new plAvTaskMsg(GetKey(), fHostKey, brainT); brainM->SetBCastFlag(plMessage::kPropagateToModifiers); brainM->Send(); } @@ -334,9 +334,9 @@ void plCoopCoordinator::IStartGuest() const plSceneObject *targetBone = hostAv->FindBone(fSynchBone); if(targetBone) { - plAvSeekMsg *seekMsg = TRACKED_NEW plAvSeekMsg( nil, nil,targetBone->GetKey(), 0, true, kAlignHandle, nil, false, plAvSeekMsg::kSeekFlagNoWarpOnTimeout, GetKey()); - plAvTaskSeek *seekT = TRACKED_NEW plAvTaskSeek(seekMsg); - plAvTaskMsg *seekM = TRACKED_NEW plAvTaskMsg(GetKey(), fGuestKey, seekT); + plAvSeekMsg *seekMsg = new plAvSeekMsg( nil, nil,targetBone->GetKey(), 0, true, kAlignHandle, nil, false, plAvSeekMsg::kSeekFlagNoWarpOnTimeout, GetKey()); + plAvTaskSeek *seekT = new plAvTaskSeek(seekMsg); + plAvTaskMsg *seekM = new plAvTaskMsg(GetKey(), fGuestKey, seekT); seekM->SetBCastFlag(plMessage::kPropagateToModifiers); seekM->Send(); } @@ -348,8 +348,8 @@ void plCoopCoordinator::IStartGuest() void plCoopCoordinator::IContinueGuest() { DebugMsg("COOP: IContinueGuest()"); - plAvTaskBrain *brainT = TRACKED_NEW plAvTaskBrain(fGuestBrain); - plAvTaskMsg *brainM = TRACKED_NEW plAvTaskMsg(GetKey(), fGuestKey, brainT); + plAvTaskBrain *brainT = new plAvTaskBrain(fGuestBrain); + plAvTaskMsg *brainM = new plAvTaskMsg(GetKey(), fGuestKey, brainT); brainM->SetBCastFlag(plMessage::kPropagateToModifiers); brainM->Send(); fGuestBrain = nil; // the armature will destroy the brain when done. @@ -362,7 +362,7 @@ void plCoopCoordinator::IAdvanceParticipant(bool host) DebugMsg("COOP: IAdvanceParticipant(%d)", host ? 1 : 0); plKey &who = host ? fHostKey : fGuestKey; - plAvBrainGenericMsg* pMsg = TRACKED_NEW plAvBrainGenericMsg(nil, who, + plAvBrainGenericMsg* pMsg = new plAvBrainGenericMsg(nil, who, plAvBrainGenericMsg::kNextStage, 0, false, 0.0, false, false, 0.0); @@ -375,7 +375,7 @@ void plCoopCoordinator::IAdvanceParticipant(bool host) // -------------- void plCoopCoordinator::IStartTimeout() { - plTimerCallbackMsg* timerMsg = TRACKED_NEW plTimerCallbackMsg(GetKey(), kAbortTimer); + plTimerCallbackMsg* timerMsg = new plTimerCallbackMsg(GetKey(), kAbortTimer); plgTimerCallbackMgr::NewTimer(kAbortTimerDuration, timerMsg); } @@ -422,8 +422,8 @@ void plCoopCoordinator::Write(hsStream *stream, hsResMgr *mgr) mgr->WriteCreatable(stream, fHostBrain); mgr->WriteCreatable(stream, fGuestBrain); - stream->WriteByte((UInt8)fHostOfferStage); - stream->WriteByte((UInt8)fGuestAcceptStage); + stream->WriteByte((uint8_t)fHostOfferStage); + stream->WriteByte((uint8_t)fGuestAcceptStage); stream->Writebool(fGuestAcceptMsg != nil); if(fGuestAcceptMsg) diff --git a/Sources/Plasma/PubUtilLib/plAvatar/plCoopCoordinator.h b/Sources/Plasma/PubUtilLib/plAvatar/plCoopCoordinator.h index 4c84a501..6a176cc4 100644 --- a/Sources/Plasma/PubUtilLib/plAvatar/plCoopCoordinator.h +++ b/Sources/Plasma/PubUtilLib/plAvatar/plCoopCoordinator.h @@ -79,7 +79,7 @@ public: plCoopCoordinator(); plCoopCoordinator(plKey host, plKey guest, plAvBrainCoop *hostBrain, plAvBrainCoop *guestBrain, - const char *synchBone, UInt32 hostOfferStage, UInt32 guestAcceptStage, + const char *synchBone, uint32_t hostOfferStage, uint32_t guestAcceptStage, plMessage *guestAcceptMsg, bool autoStartGuest); ~plCoopCoordinator(); @@ -88,8 +88,8 @@ public: void Run(); - UInt32 GetInitiatorID(); - UInt16 GetInitiatorSerial(); + uint32_t GetInitiatorID(); + uint16_t GetInitiatorSerial(); bool IsActiveForReal(); @@ -116,11 +116,11 @@ protected: plAvBrainCoop *fHostBrain; plAvBrainCoop *fGuestBrain; - UInt32 fInitiatorID; - UInt32 fInitiatorSerial; + uint32_t fInitiatorID; + uint32_t fInitiatorSerial; - UInt32 fHostOfferStage; // when we enter this stage, the offer is ready - UInt32 fGuestAcceptStage; // when we enter this stage, the offer is accepted + uint32_t fHostOfferStage; // when we enter this stage, the offer is ready + uint32_t fGuestAcceptStage; // when we enter this stage, the offer is accepted plMessage *fGuestAcceptMsg; // send this when the guest accepts diff --git a/Sources/Plasma/PubUtilLib/plAvatar/plMatrixChannel.cpp b/Sources/Plasma/PubUtilLib/plAvatar/plMatrixChannel.cpp index ade8474d..e01d7457 100644 --- a/Sources/Plasma/PubUtilLib/plAvatar/plMatrixChannel.cpp +++ b/Sources/Plasma/PubUtilLib/plAvatar/plMatrixChannel.cpp @@ -142,7 +142,7 @@ plAGChannel * plMatrixChannel::MakeBlend(plAGChannel * channelB, if (matChanB) { - result = TRACKED_NEW plMatrixBlend(this, matChanB, channelBias, blendPriority); + result = new plMatrixBlend(this, matChanB, channelBias, blendPriority); } return result; } @@ -151,14 +151,14 @@ plAGChannel * plMatrixChannel::MakeBlend(plAGChannel * channelB, // -------------- plAGChannel * plMatrixChannel::MakeZeroState() { - return TRACKED_NEW plMatrixConstant(Value(0)); + return new plMatrixConstant(Value(0)); } // MakeTimeScale -------------------------------------------------------- // -------------- plAGChannel * plMatrixChannel::MakeTimeScale(plScalarChannel *timeSource) { - return TRACKED_NEW plMatrixTimeScale(this, timeSource); + return new plMatrixTimeScale(this, timeSource); } // Dump ------------------------------------------- @@ -370,13 +370,13 @@ plAGChannel * plMatrixBlend::MakeBlend(plAGChannel *newChannel, return result; } -UInt16 plMatrixBlend::GetPriority() { +uint16_t plMatrixBlend::GetPriority() { return fPriority; } hsBool plMatrixBlend::IsStoppedAt(double time) { - hsScalar blend = fChannelBias->Value(time); + float blend = fChannelBias->Value(time); if (blend == 0) return fChannelA->IsStoppedAt(time); if (blend == 1) @@ -401,7 +401,7 @@ const hsMatrix44 & plMatrixBlend::Value(double time, bool peek) // ------------ const hsAffineParts & plMatrixBlend::AffineValue(double time, bool peek) { - const hsScalar &blend = fChannelBias->Value(time); + const float &blend = fChannelBias->Value(time); if(blend == 0) { return fOptimizedA->AffineValue(time, peek); } else { @@ -452,7 +452,7 @@ plAGChannel *plMatrixBlend::Optimize(double time) { fOptimizedA = (plMatrixChannel *)fChannelA->Optimize(time); fOptimizedB = (plMatrixChannel *)fChannelB->Optimize(time); - hsScalar blend = fChannelBias->Value(time); + float blend = fChannelBias->Value(time); if(blend == 0.0f) return fOptimizedA; if(blend == 1.0f) @@ -526,7 +526,7 @@ const hsMatrix44 & plMatrixControllerChannel::Value(double time, bool peek, plControllerCacheInfo *cache) { plProfile_BeginTiming(AffineInterp); - fController->Interp((hsScalar)time, &fAP, cache); + fController->Interp((float)time, &fAP, cache); plProfile_EndTiming(AffineInterp); plProfile_BeginTiming(AffineCompose); @@ -548,7 +548,7 @@ const hsAffineParts & plMatrixControllerChannel::AffineValue(double time, bool p plControllerCacheInfo *cache) { plProfile_BeginTiming(AffineInterp); - fController->Interp((hsScalar)time, &fAP, cache); + fController->Interp((float)time, &fAP, cache); plProfile_EndTiming(AffineInterp); return fAP; } @@ -559,7 +559,7 @@ plAGChannel *plMatrixControllerChannel::MakeCacheChannel(plAnimTimeConvert *atc) { plControllerCacheInfo *cache = fController->CreateCache(); cache->SetATC(atc); - return TRACKED_NEW plMatrixControllerCacheChannel(this, cache); + return new plMatrixControllerCacheChannel(this, cache); } void plMatrixControllerChannel::Dump(int indent, bool optimized, double time) @@ -764,7 +764,7 @@ void plMatrixChannelApplicator::IApply(const plAGModifier *mod, double time) // /////////////////////////////////////////////////////////////////////////////////////////// -const hsScalar plMatrixDelayedCorrectionApplicator::fDelayLength = 1.f; // seconds +const float plMatrixDelayedCorrectionApplicator::fDelayLength = 1.f; // seconds void plMatrixDelayedCorrectionApplicator::SetCorrection(hsMatrix44 &cor) { @@ -822,7 +822,7 @@ void plMatrixDelayedCorrectionApplicator::IApply(const plAGModifier *mod, double hsAffineParts interpAP; hsMatrix44 interpResult; - hsScalar blend = (hsScalar)((time - fDelayStart) / fDelayLength); + float blend = (float)((time - fDelayStart) / fDelayLength); hsInterp::LinInterp(&fCorAP, &identAP, blend, &interpAP); interpAP.ComposeMatrix(&interpResult); diff --git a/Sources/Plasma/PubUtilLib/plAvatar/plMatrixChannel.h b/Sources/Plasma/PubUtilLib/plAvatar/plMatrixChannel.h index 5f27210c..4a381f77 100644 --- a/Sources/Plasma/PubUtilLib/plAvatar/plMatrixChannel.h +++ b/Sources/Plasma/PubUtilLib/plAvatar/plMatrixChannel.h @@ -46,7 +46,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "plScalarChannel.h" // global -#include "hsTypes.h" // you need types to include Matrix +#include "HeadSpin.h" // you need types to include Matrix #include "hsMatrix44.h" #include "plTransform/hsAffineParts.h" @@ -173,7 +173,7 @@ public: virtual plAGChannel * MakeBlend(plAGChannel *newChannel, plScalarChannel *channelBias, int blendPriority); // you cannot blend on top of a channel that has higher priority than you do. - virtual UInt16 GetPriority(); + virtual uint16_t GetPriority(); // SPECIFICS const plMatrixChannel * GetChannelA() const { return fChannelA; } @@ -348,7 +348,7 @@ public: virtual hsBool CanBlend(plAGApplicator *app); hsBool fIgnoreNextCorrection; - static const hsScalar fDelayLength; // static var for now. + static const float fDelayLength; // static var for now. }; // PLMATRIXDIFFERENCEAPP diff --git a/Sources/Plasma/PubUtilLib/plAvatar/plMultistageBehMod.cpp b/Sources/Plasma/PubUtilLib/plAvatar/plMultistageBehMod.cpp index cb02b8f2..f45f4943 100644 --- a/Sources/Plasma/PubUtilLib/plAvatar/plMultistageBehMod.cpp +++ b/Sources/Plasma/PubUtilLib/plAvatar/plMultistageBehMod.cpp @@ -136,14 +136,14 @@ hsBool plMultistageBehMod::MsgReceive(plMessage* msg) if(avObj) { // Create a copy of our reference anim stages to give to the brain - plAnimStageVec* stages = TRACKED_NEW plAnimStageVec; + plAnimStageVec* stages = new plAnimStageVec; int numStages = fStages->size(); stages->reserve(numStages); // hack hack hack hsBool ladder = false; for (int i = 0; i < numStages; i++) { - plAnimStage* stage = TRACKED_NEW plAnimStage; + plAnimStage* stage = new plAnimStage; *stage = *((*fStages)[i]); stages->push_back(stage); if (strstr(stage->GetAnimName(),"adder") != nil) @@ -164,14 +164,14 @@ hsBool plMultistageBehMod::MsgReceive(plMessage* msg) sprintf(sbuf,"plMultistageModMsg - starting multistage from %s",sender->GetName()); plAvatarMgr::GetInstance()->GetLog()->AddLine(sbuf); #endif - plAvSeekMsg *seeker = TRACKED_NEW plAvSeekMsg(nil, avModKey, seekKey, 1.0f, fSmartSeek); + plAvSeekMsg *seeker = new plAvSeekMsg(nil, avModKey, seekKey, 1.0f, fSmartSeek); seeker->Send(); // these (currently unused) callbacks are for the brain itself, not any of the stages plMessage *exitCallback = nil, *enterCallback = nil; - UInt32 exitFlags = plAvBrainGeneric::kExitNormal; + uint32_t exitFlags = plAvBrainGeneric::kExitNormal; - plAvBrainGeneric *brain = TRACKED_NEW plAvBrainGeneric(stages, exitCallback, enterCallback, sender, exitFlags, + plAvBrainGeneric *brain = new plAvBrainGeneric(stages, exitCallback, enterCallback, sender, exitFlags, plAvBrainGeneric::kDefaultFadeIn, plAvBrainGeneric::kDefaultFadeOut, plAvBrainGeneric::kMoveRelative); if (ladder) @@ -179,7 +179,7 @@ hsBool plMultistageBehMod::MsgReceive(plMessage* msg) brain->SetType(plAvBrainGeneric::kLadder); } brain->SetReverseFBControlsOnRelease(fReverseFBControlsOnRelease); - plAvPushBrainMsg* pushBrain = TRACKED_NEW plAvPushBrainMsg(GetKey(), avModKey, brain); + plAvPushBrainMsg* pushBrain = new plAvPushBrainMsg(GetKey(), avModKey, brain); pushBrain->Send(); } } @@ -210,14 +210,14 @@ void plMultistageBehMod::Read(hsStream *stream, hsResMgr *mgr) fReverseFBControlsOnRelease = stream->Readbool(); IDeleteStageVec(); - fStages = TRACKED_NEW plAnimStageVec; + fStages = new plAnimStageVec; int numStages = stream->ReadLE32(); fStages->reserve(numStages); int i; for (i = 0; i < numStages; i++) { - plAnimStage* stage = TRACKED_NEW plAnimStage; + plAnimStage* stage = new plAnimStage; stage->Read(stream, mgr); stage->SetMod(this); fStages->push_back(stage); diff --git a/Sources/Plasma/PubUtilLib/plAvatar/plMultistageBehMod.h b/Sources/Plasma/PubUtilLib/plAvatar/plMultistageBehMod.h index 3e48f0e0..ffd125c1 100644 --- a/Sources/Plasma/PubUtilLib/plAvatar/plMultistageBehMod.h +++ b/Sources/Plasma/PubUtilLib/plAvatar/plMultistageBehMod.h @@ -61,7 +61,7 @@ protected: std::vector fReceivers; void IDeleteStageVec(); - virtual hsBool IEval(double secs, hsScalar del, UInt32 dirty) { return true; } + virtual hsBool IEval(double secs, float del, uint32_t dirty) { return true; } public: plMultistageBehMod(); diff --git a/Sources/Plasma/PubUtilLib/plAvatar/plNPCSpawnMod.cpp b/Sources/Plasma/PubUtilLib/plAvatar/plNPCSpawnMod.cpp index 12387afe..6c7da6a6 100644 --- a/Sources/Plasma/PubUtilLib/plAvatar/plNPCSpawnMod.cpp +++ b/Sources/Plasma/PubUtilLib/plAvatar/plNPCSpawnMod.cpp @@ -175,7 +175,7 @@ void plNPCSpawnMod::Write(hsStream *stream, hsResMgr *mgr) // IEVAL // attack of the bogons -hsBool plNPCSpawnMod::IEval(double secs, hsScalar del, UInt32 dirty) +hsBool plNPCSpawnMod::IEval(double secs, float del, uint32_t dirty) { return true; } @@ -185,7 +185,7 @@ void plNPCSpawnMod::ISendNotify(plKey &avatarKey) { if(fNotify) { - proSpawnedEventData * event = TRACKED_NEW proSpawnedEventData; + proSpawnedEventData * event = new proSpawnedEventData; event->fSpawner = GetKey(); event->fSpawnee = avatarKey; fNotify->ClearEvents(); diff --git a/Sources/Plasma/PubUtilLib/plAvatar/plNPCSpawnMod.h b/Sources/Plasma/PubUtilLib/plAvatar/plNPCSpawnMod.h index 055c3da9..0e9003bf 100644 --- a/Sources/Plasma/PubUtilLib/plAvatar/plNPCSpawnMod.h +++ b/Sources/Plasma/PubUtilLib/plAvatar/plNPCSpawnMod.h @@ -65,7 +65,7 @@ public: virtual void Write(hsStream *stream, hsResMgr *mgr); protected: - virtual hsBool IEval(double secs, hsScalar del, UInt32 dirty); + virtual hsBool IEval(double secs, float del, uint32_t dirty); void ISendNotify(plKey &avatarKey); // send our notification message private: diff --git a/Sources/Plasma/PubUtilLib/plAvatar/plOneShotMod.cpp b/Sources/Plasma/PubUtilLib/plAvatar/plOneShotMod.cpp index 4efe5672..16a398b6 100644 --- a/Sources/Plasma/PubUtilLib/plAvatar/plOneShotMod.cpp +++ b/Sources/Plasma/PubUtilLib/plAvatar/plOneShotMod.cpp @@ -132,7 +132,7 @@ hsBool plOneShotMod::MsgReceive(plMessage* msg) { char *animName = avMod->MakeAnimationName(fAnimName); - plAvOneShotMsg *avOSmsg = TRACKED_NEW plAvOneShotMsg(myKey, oneShotMsg->fPlayerKey, objKey, + plAvOneShotMsg *avOSmsg = new plAvOneShotMsg(myKey, oneShotMsg->fPlayerKey, objKey, fSeekDuration, (hsBool)fSmartSeek, animName, fDrivable, fReversable); diff --git a/Sources/Plasma/PubUtilLib/plAvatar/plOneShotMod.h b/Sources/Plasma/PubUtilLib/plAvatar/plOneShotMod.h index a33521b6..5cf9c546 100644 --- a/Sources/Plasma/PubUtilLib/plAvatar/plOneShotMod.h +++ b/Sources/Plasma/PubUtilLib/plAvatar/plOneShotMod.h @@ -55,7 +55,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com class plOneShotMod : public plMultiModifier { protected: - virtual hsBool IEval(double secs, hsScalar del, UInt32 dirty) {return true;} + virtual hsBool IEval(double secs, float del, uint32_t dirty) {return true;} char * fAnimName; // the name of the animation associated with this one-shot hsBool fDrivable; // whether the user can control the position of the animation hsBool fReversable; // whether the user can back up the animation (fDrivable must be true as well) diff --git a/Sources/Plasma/PubUtilLib/plAvatar/plPhysicalControllerCore.cpp b/Sources/Plasma/PubUtilLib/plAvatar/plPhysicalControllerCore.cpp index 0f104b9f..8fcbc8c7 100644 --- a/Sources/Plasma/PubUtilLib/plAvatar/plPhysicalControllerCore.cpp +++ b/Sources/Plasma/PubUtilLib/plAvatar/plPhysicalControllerCore.cpp @@ -56,8 +56,8 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #define kGENERICCONTROLLERRADIUS 1.1f #define kGENERICCONTROLLERHEIGHT 2.8f -//#define kSWIMMINGCONTACTSLOPELIMIT (cosf(hsScalarDegToRad(80.f))) -const hsScalar plMovementStrategy::kAirTimeThreshold = .1f; // seconds +//#define kSWIMMINGCONTACTSLOPELIMIT (cosf(hsDegreesToRadians(80.f))) +const float plMovementStrategy::kAirTimeThreshold = .1f; // seconds bool CompareMatrices(const hsMatrix44 &matA, const hsMatrix44 &matB, float tolerance); bool operator<(const plControllerSweepRecord left, const plControllerSweepRecord right) { @@ -91,18 +91,18 @@ void plMovementStrategy::IApplyKinematic() plPhysicalControllerCore::~plPhysicalControllerCore() { } -void plPhysicalControllerCore::Apply(hsScalar delSecs) +void plPhysicalControllerCore::Apply(float delSecs) { fSimLength=delSecs; hsAssert(fMovementInterface, "plPhysicalControllerCore::Apply() missing a movement interface"); if(fMovementInterface)fMovementInterface->Apply(delSecs); } -void plPhysicalControllerCore::PostStep(hsScalar delSecs) +void plPhysicalControllerCore::PostStep(float delSecs) { hsAssert(fMovementInterface, "plPhysicalControllerCore::PostStep() missing a movement interface"); if(fMovementInterface)fMovementInterface->PostStep(delSecs); } -void plPhysicalControllerCore::Update(hsScalar delSecs) +void plPhysicalControllerCore::Update(float delSecs) { hsAssert(fMovementInterface, "plPhysicalControllerCore::Update() missing a movement interface"); if(fMovementInterface)fMovementInterface->Update(delSecs); @@ -111,7 +111,7 @@ void plPhysicalControllerCore::Update(hsScalar delSecs) void plPhysicalControllerCore::SendCorrectionMessages() { plSceneObject* so = plSceneObject::ConvertNoRef(fOwner->ObjectIsLoaded()); - plCorrectionMsg* corrMsg = TRACKED_NEW plCorrectionMsg; + plCorrectionMsg* corrMsg = new plCorrectionMsg; corrMsg->fLocalToWorld = fLastGlobalLoc; corrMsg->fLocalToWorld.GetInverse(&corrMsg->fWorldToLocal); corrMsg->fDirtySynch = true; @@ -122,7 +122,7 @@ void plPhysicalControllerCore::SendCorrectionMessages() corrMsg->AddReceiver(fOwner); corrMsg->Send(); } -plPhysicalControllerCore::plPhysicalControllerCore(plKey OwnerSceneObject, hsScalar height, hsScalar radius) +plPhysicalControllerCore::plPhysicalControllerCore(plKey OwnerSceneObject, float height, float radius) :fMovementInterface(nil) ,fOwner(OwnerSceneObject) ,fHeight(height) @@ -188,21 +188,21 @@ void plPhysicalControllerCore::MoveActorToSim() fAchievedLinearVelocity=fDisplacementThisStep/fSimLength; else fAchievedLinearVelocity.Set(0.0f,0.0f,0.0f); } -void plPhysicalControllerCore::IncrementAngle(hsScalar deltaAngle) +void plPhysicalControllerCore::IncrementAngle(float deltaAngle) { - hsScalar angle; + float angle; hsVector3 axis; fLocalRotation.NormalizeIfNeeded(); fLocalRotation.GetAngleAxis(&angle, &axis); // adjust it (quaternions are weird...) if (axis.fZ < 0) - angle = (2*hsScalarPI) - angle; // axis is backwards, so reverse the angle too + angle = (2*M_PI) - angle; // axis is backwards, so reverse the angle too angle += deltaAngle; // make sure we wrap around if (angle < 0) - angle = (2*hsScalarPI) + angle; // angle is -, so this works like a subtract - if (angle >= (2*hsScalarPI)) - angle = angle - (2*hsScalarPI); + angle = (2*M_PI) + angle; // angle is -, so this works like a subtract + if (angle >= (2*M_PI)) + angle = angle - (2*M_PI); // and set the new angle fLocalRotation.SetAngleAxis(angle, hsVector3(0,0,1)); } @@ -235,11 +235,11 @@ bool plPhysicalControllerCore::GetFacingPushingPhysical() } /////////////////////////// //Walking Strategy -void plWalkingStrategy::Apply(hsScalar delSecs) +void plWalkingStrategy::Apply(float delSecs) { //Apply Should Only be Called from a PhysicalControllerCore hsAssert(fCore,"No Core shouldn't be Applying"); - UInt32 collideFlags = + uint32_t collideFlags = 1< maxGrav) grav = maxGrav; LinearVelocity.fZ = prevZVel + grav; @@ -400,7 +400,7 @@ void plWalkingStrategy::Apply(hsScalar delSecs) //Did you hit your head on a dynamic? //with Physx's wonderful controller hit report vs flags issues we need to actually sweep to see std::multiset< plControllerSweepRecord > HitsDynamic; - UInt32 testFlag=1<GetPositionSim(startPos); @@ -447,23 +447,23 @@ void plWalkingStrategy::ICheckForFalseGround() // seen up to 220 reached in actual gameplay in a situation where we'd want this to take effect. // This is the same running into 2 walls where the angle between them is 60. int i, j; - const hsScalar threshold = hsScalarDegToRad(240.f); + const float threshold = hsDegreesToRadians(240.f); int numContacts = fContactNormals.GetCount() + fPrevSlidingNormals.GetCount(); if (numContacts >= 2) { // For extra fun... PhysX will actually report some collisions every other frame, as though // we're bouncing back and forth between the two (or more) objects blocking us. So it's not // enough to look at this frame's collisions, we have to check previous frames too. - hsTArray fCollisionAngles; + hsTArray fCollisionAngles; fCollisionAngles.SetCount(numContacts); int angleIdx = 0; for (i = 0; i < fContactNormals.GetCount(); i++, angleIdx++) { - fCollisionAngles[angleIdx] = hsATan2(fContactNormals[i].fY, fContactNormals[i].fX); + fCollisionAngles[angleIdx] = atan2(fContactNormals[i].fY, fContactNormals[i].fX); } for (i = 0; i < fPrevSlidingNormals.GetCount(); i++, angleIdx++) { - fCollisionAngles[angleIdx] = hsATan2(fPrevSlidingNormals[i].fY, fPrevSlidingNormals[i].fX); + fCollisionAngles[angleIdx] = atan2(fPrevSlidingNormals[i].fY, fPrevSlidingNormals[i].fX); } // numContacts is rarely larger than 6, so let's do a simple bubble sort. for (i = 0; i < numContacts; i++) @@ -472,7 +472,7 @@ void plWalkingStrategy::ICheckForFalseGround() { if (fCollisionAngles[i] > fCollisionAngles[j]) { - hsScalar tempAngle = fCollisionAngles[i]; + float tempAngle = fCollisionAngles[i]; fCollisionAngles[i] = fCollisionAngles[j]; fCollisionAngles[j] = tempAngle; } @@ -487,16 +487,16 @@ void plWalkingStrategy::ICheckForFalseGround() if (i == numContacts) { // We got to the end. Check the last with the first and make your decision. - if (!(fCollisionAngles[0] - fCollisionAngles[numContacts - 1] >= (threshold - 2 * hsScalarPI))) + if (!(fCollisionAngles[0] - fCollisionAngles[numContacts - 1] >= (threshold - 2 * M_PI))) fFalseGround = true; } } } -void plWalkingStrategy::Update(hsScalar delSecs) +void plWalkingStrategy::Update(float delSecs) { //Update Should Only be Called from a PhysicalControllerCore hsAssert(fCore,"Running Update: but have no Core"); - hsScalar AngularVelocity=fCore->GetAngularVelocity(); + float AngularVelocity=fCore->GetAngularVelocity(); hsVector3 LinearVelocity=fCore->GetLinearVelocity(); if (!fCore->IsEnabled() || fCore->IsKinematic()) @@ -515,7 +515,7 @@ void plWalkingStrategy::Update(hsScalar delSecs) fCore->MoveActorToSim(); if (AngularVelocity != 0.f) { - hsScalar deltaAngle=AngularVelocity*delSecs; + float deltaAngle=AngularVelocity*delSecs; fCore->IncrementAngle( deltaAngle); } // We can't only send updates when the physical position changes because the @@ -539,7 +539,7 @@ void plWalkingStrategy::Update(hsScalar delSecs) { //we have hit our head and we don't have anything beneath our feet //not really friction just a way to make it seem more realistic keep between 0 and 1 - hsScalar headFriction=0.0f; + float headFriction=0.0f; AchievedLinearVelocity.fX=(1.0f-headFriction)*LinearVelocity.fX; AchievedLinearVelocity.fY=(1.0f-headFriction)*LinearVelocity.fY; //only clamping when hitting head and going upwards, if going down leave it be @@ -565,7 +565,7 @@ void plWalkingStrategy::Update(hsScalar delSecs) void plWalkingStrategy::IAddContactNormals(hsVector3& vec) { //TODO: ADD in functionality to Adjust walkable slope for controller, also apply that in here - hsScalar dot = vec * kAvatarUp; + float dot = vec * kAvatarUp; if ( dot >= kSLOPELIMIT ) fGroundHit=true; else plMovementStrategySimulationInterface::IAddContactNormals(vec); } @@ -610,10 +610,10 @@ void plSwimStrategy::IAdjustBuoyancy() else fBuoyancy =(depth/surfaceDepth ); } -void plSwimStrategy::Apply(hsScalar delSecs) +void plSwimStrategy::Apply(float delSecs) { hsAssert(fCore,"PlSwimStrategy::Apply No Core shouldn't be Applying"); - UInt32 collideFlags = + uint32_t collideFlags = 1<GetWorldToLocal() * LinearVelocity; } IAdjustBuoyancy(); - hsScalar zacc; - hsScalar retardent=0.0f; - static hsScalar FinalBobSpeed=0.5f; + float zacc; + float retardent=0.0f; + static float FinalBobSpeed=0.5f; //trying to dampen the oscillations if((AchievedLinearVelocity.fZ>FinalBobSpeed)||(AchievedLinearVelocity.fZ<-FinalBobSpeed)) retardent=AchievedLinearVelocity.fZ *-.90f; zacc=(1-fBuoyancy)*-32.f + retardent; hsVector3 linCurrent(0.0f,0.0f,0.0f); - hsScalar angCurrent = 0.f; + float angCurrent = 0.f; if (fCurrentRegion != nil) { @@ -702,14 +702,14 @@ void plSwimStrategy::Apply(hsScalar delSecs) fContactNormals.SetCount(0); fCore->Move(displacement,collideFlags,colFlags); if((colFlags&kBottom)||(colFlags&kSides))fHadContacts=true; - hsScalar angvel=fCore->GetAngularVelocity(); + float angvel=fCore->GetAngularVelocity(); fCore->SetAngularVelocity(angvel +angCurrent); } } -void plSwimStrategy::Update(hsScalar delSecs) +void plSwimStrategy::Update(float delSecs) { hsAssert(fCore,"Running Update: but have no Core"); - hsScalar AngularVelocity=fCore->GetAngularVelocity(); + float AngularVelocity=fCore->GetAngularVelocity(); hsVector3 LinearVelocity=fCore->GetLinearVelocity(); if (!fCore->IsEnabled() || fCore->IsKinematic()) { @@ -724,7 +724,7 @@ void plSwimStrategy::Update(hsScalar delSecs) if (AngularVelocity != 0.f) { - hsScalar deltaAngle=AngularVelocity*delSecs; + float deltaAngle=AngularVelocity*delSecs; fCore->IncrementAngle( deltaAngle); } fCore->UpdateWorldRelativePos(); @@ -737,7 +737,7 @@ void plSwimStrategy::Update(hsScalar delSecs) void plSwimStrategy::IAddContactNormals(hsVector3& vec) { //TODO: ADD in functionality to Adjust walkable slope for controller, also apply that in here - hsScalar dot = vec * kAvatarUp; + float dot = vec * kAvatarUp; if ( dot >= kSLOPELIMIT ) { fOnGround=true; @@ -745,12 +745,12 @@ void plSwimStrategy::IAddContactNormals(hsVector3& vec) } else plMovementStrategySimulationInterface::IAddContactNormals(vec); } -void plSwimStrategy::SetSurface(plSwimRegionInterface *region, hsScalar surfaceHeight) +void plSwimStrategy::SetSurface(plSwimRegionInterface *region, float surfaceHeight) { fCurrentRegion=region; fSurfaceHeight=surfaceHeight; } -void plRidingAnimatedPhysicalStrategy::Apply(hsScalar delSecs) +void plRidingAnimatedPhysicalStrategy::Apply(float delSecs) { hsVector3 LinearVelocity=fCore->GetLinearVelocity(); hsVector3 AchievedLinearVelocity=fCore->GetAchievedLinearVelocity(); @@ -772,7 +772,7 @@ void plRidingAnimatedPhysicalStrategy::Apply(hsScalar delSecs) plSceneObject* so = plSceneObject::ConvertNoRef(fOwner->ObjectIsLoaded()); hsPoint3 startPos, desiredDestination, endPos; fCore->GetPositionSim(startPos); - UInt32 collideFlags = + uint32_t collideFlags = 1<IsEnabled() || fCore->IsKinematic()) { @@ -949,7 +949,7 @@ void plRidingAnimatedPhysicalStrategy::Update(hsScalar delSecs) } fCore->CheckAndHandleAnyStateChanges(); } -void plRidingAnimatedPhysicalStrategy::PostStep(hsScalar delSecs) +void plRidingAnimatedPhysicalStrategy::PostStep(float delSecs) { if(!(!fCore->IsEnabled() || fCore->IsKinematic())) { @@ -959,7 +959,7 @@ void plRidingAnimatedPhysicalStrategy::PostStep(hsScalar delSecs) fTimeInAir = 0.f; hsVector3 AchievedLinearVelocity, LinearVelocity; AchievedLinearVelocity = fCore->GetLinearVelocity(); - hsScalar AngularVelocity=fCore->GetAngularVelocity(); + float AngularVelocity=fCore->GetAngularVelocity(); fCore->OverrideAchievedVelocity(AchievedLinearVelocity); plSceneObject* so = plSceneObject::ConvertNoRef(fOwner->ObjectIsLoaded()); if (so) @@ -967,7 +967,7 @@ void plRidingAnimatedPhysicalStrategy::PostStep(hsScalar delSecs) fCore->UpdateControllerAndPhysicalRep(); if (AngularVelocity != 0.f) { - hsScalar deltaAngle=AngularVelocity*delSecs; + float deltaAngle=AngularVelocity*delSecs; fCore->IncrementAngle( deltaAngle); } fCore->UpdateWorldRelativePos(); diff --git a/Sources/Plasma/PubUtilLib/plAvatar/plPhysicalControllerCore.h b/Sources/Plasma/PubUtilLib/plAvatar/plPhysicalControllerCore.h index a8b5c01b..c8415ef1 100644 --- a/Sources/Plasma/PubUtilLib/plAvatar/plPhysicalControllerCore.h +++ b/Sources/Plasma/PubUtilLib/plAvatar/plPhysicalControllerCore.h @@ -50,7 +50,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "hsQuat.h" #define PHYSX_ONLY_TRIGGER_FROM_KINEMATIC 1 -#define kSLOPELIMIT (cosf(hsScalarDegToRad(55.f))) +#define kSLOPELIMIT (cosf(hsDegreesToRadians(55.f))) class plCoordinateInterface; class plPhysical; @@ -72,12 +72,12 @@ class plMovementStrategySimulationInterface { public: - virtual void Apply(hsScalar delSecs)=0; - virtual void Update(hsScalar delSecs)=0; + virtual void Apply(float delSecs)=0; + virtual void Update(float delSecs)=0; //most strategies don't require this. Only the ones that require behavior like a physical or need //something after the sim step. this used to be taken care of by Update, but this was moved to take care of //some of the frame lag - virtual void PostStep(hsScalar delSecs){}; + virtual void PostStep(float delSecs){}; virtual void IAddContactNormals(hsVector3& vec){fContactNormals.Append(vec);} virtual void AddOnTopOfObject(plPhysical* phys){ fOnTopOf.Append(phys);} virtual void LeaveAge() @@ -95,7 +95,7 @@ class plControllerSweepRecord public: plPhysical *ObjHit; hsPoint3 locHit;//World space - hsScalar TimeHit;//Normalized between 0 and 1 + float TimeHit;//Normalized between 0 and 1 hsVector3 Norm; }; bool operator<(const plControllerSweepRecord left, const plControllerSweepRecord right); @@ -105,9 +105,9 @@ public: virtual ~plPhysicalControllerCore(); virtual void Move(hsVector3 displacement, unsigned int collideWith, unsigned int &collisionResults)=0; virtual void SetMovementSimulationInterface(plMovementStrategySimulationInterface* strat){fMovementInterface=strat;} - virtual void Apply(hsScalar delSecs); - virtual void Update(hsScalar delSecs); - virtual void PostStep(hsScalar delSecs); + virtual void Apply(float delSecs); + virtual void Update(float delSecs); + virtual void PostStep(float delSecs); // A disabled avatar doesn't move or accumulate air time if he's off the ground. virtual void Enable(bool enable) = 0; virtual bool IsEnabled() {return fEnabled;} @@ -125,9 +125,9 @@ public: //when seeking no longer want to interact with exclusion regions virtual void SetSeek(bool seek){fSeeking=seek;} virtual bool IsSeeking(){return fSeeking;} - static plPhysicalControllerCore* Create(plKey ownerSO, hsScalar height, hsScalar radius); + static plPhysicalControllerCore* Create(plKey ownerSO, float height, float radius); virtual plMovementStrategySimulationInterface* GetMovementInterface(){return fMovementInterface;} - plPhysicalControllerCore(plKey ownerSceneObject, hsScalar height, hsScalar radius); + plPhysicalControllerCore(plKey ownerSceneObject, float height, float radius); virtual plKey GetOwner(){return fOwner;}; // Set the LOS DB this avatar will be in (only one) virtual void SetLOSDB(plSimDefs::plLOSDB losDB) { fLOSDB = losDB; } ; @@ -162,36 +162,36 @@ public: return vel/fSimLength; } void SendCorrectionMessages(); - void IncrementAngle(hsScalar deltaAngle); + void IncrementAngle(float deltaAngle); void UpdateWorldRelativePos(); virtual void SetLinearVelocity(const hsVector3& linearVel){fLinearVelocity=linearVel;} //should actually be a 3 vector but everywhere else it is assumed to be just around Z - virtual void SetAngularVelocity(const hsScalar angvel){ fAngularVelocity=angvel;} - virtual void SetVelocities(const hsVector3& linearVel, hsScalar angVel) + virtual void SetAngularVelocity(const float angvel){ fAngularVelocity=angvel;} + virtual void SetVelocities(const hsVector3& linearVel, float angVel) { fLinearVelocity=linearVel; fAngularVelocity=angVel; } virtual const hsVector3& GetLinearVelocity() ; - virtual hsScalar GetAngularVelocity(){return fAngularVelocity;} + virtual float GetAngularVelocity(){return fAngularVelocity;} virtual const hsVector3& GetAchievedLinearVelocity()const {return fAchievedLinearVelocity;} plPhysical* GetPushingPhysical(); bool GetFacingPushingPhysical(); virtual void SetPushingPhysical(plPhysical* pl){fPushingPhysical=pl;} virtual void SetFacingPushingPhysical(bool ans){fFacingPushingPhysical=ans;} //To be Used during runtime conversions, say to switch a tall controller to a ball for swimming - virtual void SetControllerDimensions(hsScalar radius, hsScalar height)=0; - virtual hsScalar GetControllerWidth(){return fRadius;} - virtual hsScalar GetControllerHeight(){return fHeight;} + virtual void SetControllerDimensions(float radius, float height)=0; + virtual float GetControllerWidth(){return fRadius;} + virtual float GetControllerHeight(){return fHeight;} virtual void ResetAchievedLinearVelocity() { fAchievedLinearVelocity.Set(0.f,0.f,0.f); } - virtual int SweepControllerPath(const hsPoint3& startPos,const hsPoint3& endPos, hsBool vsDynamics, hsBool vsStatics, UInt32& vsSimGroups, std::multiset< plControllerSweepRecord >& WhatWasHitOut)=0; + virtual int SweepControllerPath(const hsPoint3& startPos,const hsPoint3& endPos, hsBool vsDynamics, hsBool vsStatics, uint32_t& vsSimGroups, std::multiset< plControllerSweepRecord >& WhatWasHitOut)=0; //this should only be used to force a move it could place your head into a wall and that would be good - virtual hsScalar GetHeight() {return fHeight;} - virtual hsScalar GetRadius() {return fRadius;} + virtual float GetHeight() {return fHeight;} + virtual float GetRadius() {return fRadius;} //Wether the avatar thing has mass and forces things down or not, and changes the way things move //This is an attempt fix things like riding on an animated physical virtual void BehaveLikeAnimatedPhysical(hsBool actLikeAnAnimatedPhys)=0; @@ -199,8 +199,8 @@ public: protected: plKey fOwner; - hsScalar fHeight; - hsScalar fRadius; + float fHeight; + float fRadius; plKey fWorldKey; plSimDefs::plLOSDB fLOSDB; bool fSeeking; @@ -215,11 +215,11 @@ protected: hsQuat fLocalRotation; hsMatrix44 fPrevSubworldW2L; hsVector3 fDisplacementThisStep; - hsScalar fSimLength; + float fSimLength; //physical properties hsVector3 fLinearVelocity; - hsScalar fAngularVelocity; + float fAngularVelocity; hsVector3 fAchievedLinearVelocity; plPhysical* fPushingPhysical; bool fFacingPushingPhysical; @@ -251,7 +251,7 @@ public: if(fCore)fCore->OverrideAchievedVelocity(AchievedLinearVelocity); } //proxy functions for Controller Core - virtual hsScalar GetAirTime() const { return fTimeInAir; } + virtual float GetAirTime() const { return fTimeInAir; } virtual void ResetAirTime() { fTimeInAir = 0.f; } protected: @@ -259,12 +259,12 @@ protected: virtual void IApplyKinematic(); plPhysicalControllerCore* fCore; hsVector3 fLinearAcceleration; - hsScalar fAngularAcceleration; + float fAngularAcceleration; plKey fOwner; - static const hsScalar kAirTimeThreshold; - hsScalar fTimeInAir; - hsScalar fPreferedControllerWidth; - hsScalar fPreferedControllerHeight; + static const float kAirTimeThreshold; + float fTimeInAir; + float fPreferedControllerWidth; + float fPreferedControllerHeight; }; @@ -283,8 +283,8 @@ public: fOnTopOfAnimatedPhysLastFrame=false; } virtual ~plWalkingStrategy(){}; - virtual void Apply(hsScalar delSecs); - virtual void Update(hsScalar delSecs); + virtual void Apply(float delSecs); + virtual void Update(float delSecs); bool IsOnGround() const { return fTimeInAir < kAirTimeThreshold || fFalseGround; } bool IsOnFalseGround() const { return fFalseGround && !fGroundHit; } @@ -309,10 +309,10 @@ class plSwimStrategy: public plMovementStrategy public: plSwimStrategy(plPhysicalControllerCore *core); virtual ~plSwimStrategy(){}; - void SetSurface(plSwimRegionInterface *region, hsScalar surfaceHeight); - virtual void Apply(hsScalar delSecs); - virtual void Update(hsScalar delSecs); - hsScalar GetBuoyancy() { return fBuoyancy; } + void SetSurface(plSwimRegionInterface *region, float surfaceHeight); + virtual void Apply(float delSecs); + virtual void Update(float delSecs); + float GetBuoyancy() { return fBuoyancy; } hsBool IsOnGround() { return fOnGround; } hsBool HadContacts() { return fHadContacts; } virtual void IAddContactNormals(hsVector3& vec); @@ -320,10 +320,10 @@ protected: virtual hsBool IRequireBehaviourLikeAnAnimatedPhysical(){return true;} private: void IAdjustBuoyancy(); - hsScalar fBuoyancy; + float fBuoyancy; hsBool fOnGround; hsBool fHadContacts; - hsScalar fSurfaceHeight; + float fSurfaceHeight; plSwimRegionInterface *fCurrentRegion; }; class plRidingAnimatedPhysicalStrategy : public plWalkingStrategy @@ -332,9 +332,9 @@ public: plRidingAnimatedPhysicalStrategy(plPhysicalControllerCore *core ) : fNeedVelocityOverride(false),fStartJump(false),plWalkingStrategy(core){}; virtual ~plRidingAnimatedPhysicalStrategy(){}; - virtual void Apply(hsScalar delSecs); - virtual void Update(hsScalar delSecs); - virtual void PostStep(hsScalar delSecs); + virtual void Apply(float delSecs); + virtual void Update(float delSecs); + virtual void PostStep(float delSecs); bool IsOnGround() const { return fTimeInAir < kAirTimeThreshold || fFalseGround; } bool IsOnFalseGround() const { return fFalseGround && !fGroundHit; } void GroundHit() { fGroundHit = true; } diff --git a/Sources/Plasma/PubUtilLib/plAvatar/plPointChannel.cpp b/Sources/Plasma/PubUtilLib/plAvatar/plPointChannel.cpp index 0d6ec732..58b409d8 100644 --- a/Sources/Plasma/PubUtilLib/plAvatar/plPointChannel.cpp +++ b/Sources/Plasma/PubUtilLib/plAvatar/plPointChannel.cpp @@ -88,19 +88,19 @@ plAGChannel * plPointChannel::MakeCombine(plAGChannel *channelA) // MAKEBLEND plAGChannel * plPointChannel::MakeBlend(plAGChannel * channelB, plScalarChannel * channelBias, int blendPriority) { - return TRACKED_NEW plPointBlend(this, (plPointChannel *)channelB, channelBias); + return new plPointBlend(this, (plPointChannel *)channelB, channelBias); } // MAKEZEROSTATE plAGChannel * plPointChannel::MakeZeroState() { - return TRACKED_NEW plPointConstant(Value(0)); + return new plPointConstant(Value(0)); } // MAKETIMESCALE plAGChannel * plPointChannel::MakeTimeScale(plScalarChannel *timeSource) { - return TRACKED_NEW plPointTimeScale(this, timeSource); + return new plPointTimeScale(this, timeSource); } ///////////////////////////////////////////////////////////////////////////////////////// @@ -242,7 +242,7 @@ plPointBlend::~plPointBlend() // ------------ hsBool plPointBlend::IsStoppedAt(double time) { - hsScalar blend = fChannelBias->Value(time); + float blend = fChannelBias->Value(time); if (blend == 0) return fPointA->IsStoppedAt(time); if (blend == 1) @@ -257,7 +257,7 @@ const hsPoint3 &plPointBlend::Value(double time) { if (fPointA && fPointB) { - hsScalar curBlend = fChannelBias->Value(time); + float curBlend = fChannelBias->Value(time); if(curBlend == 0) { fPointA->Value(fResult, time); } else { @@ -360,7 +360,7 @@ const hsPoint3 & plPointControllerChannel::Value(double time) // VALUE(time) const hsPoint3 & plPointControllerChannel::Value(double time, plControllerCacheInfo *cache) { - fController->Interp((hsScalar)time, &fResult, cache); + fController->Interp((float)time, &fResult, cache); return fResult; } @@ -368,7 +368,7 @@ plAGChannel *plPointControllerChannel::MakeCacheChannel(plAnimTimeConvert *atc) { plControllerCacheInfo *cache = fController->CreateCache(); cache->SetATC(atc); - return TRACKED_NEW plPointControllerCacheChannel(this, cache); + return new plPointControllerCacheChannel(this, cache); } // WRITE(stream, mgr) diff --git a/Sources/Plasma/PubUtilLib/plAvatar/plQuatChannel.cpp b/Sources/Plasma/PubUtilLib/plAvatar/plQuatChannel.cpp index f346c793..929e70e3 100644 --- a/Sources/Plasma/PubUtilLib/plAvatar/plQuatChannel.cpp +++ b/Sources/Plasma/PubUtilLib/plAvatar/plQuatChannel.cpp @@ -96,7 +96,7 @@ plAGChannel * plQuatChannel::MakeCombine(plAGChannel *channelA) { if(plPointChannel::ConvertNoRef(channelA)) { - return TRACKED_NEW plQuatPointCombine(this, (plPointChannel *)channelA); + return new plQuatPointCombine(this, (plPointChannel *)channelA); } else { return nil; } @@ -109,7 +109,7 @@ plAGChannel *plQuatChannel::MakeBlend(plAGChannel *channelB, plScalarChannel *ch plScalarChannel *chanBias = plScalarChannel::ConvertNoRef(channelBias); if(chanB && chanBias) { - return TRACKED_NEW plQuatBlend(this, chanB, chanBias); + return new plQuatBlend(this, chanB, chanBias); } else { hsStatusMessageF("Blend operation failed."); return this; @@ -119,13 +119,13 @@ plAGChannel *plQuatChannel::MakeBlend(plAGChannel *channelB, plScalarChannel *ch // MAKEZEROSTATE plAGChannel * plQuatChannel::MakeZeroState() { - return TRACKED_NEW plQuatConstant(Value(0)); + return new plQuatConstant(Value(0)); } // MAKETIMESCALE plAGChannel * plQuatChannel::MakeTimeScale(plScalarChannel *timeSource) { - return TRACKED_NEW plQuatTimeScale(this, timeSource); + return new plQuatTimeScale(this, timeSource); } ///////////////// @@ -246,7 +246,7 @@ plQuatBlend::~plQuatBlend() hsBool plQuatBlend::IsStoppedAt(double time) { - hsScalar blend = fChannelBias->Value(time); + float blend = fChannelBias->Value(time); if (blend == 0) return fQuatA->IsStoppedAt(time); if (blend == 1) diff --git a/Sources/Plasma/PubUtilLib/plAvatar/plScalarChannel.cpp b/Sources/Plasma/PubUtilLib/plAvatar/plScalarChannel.cpp index 9b43428e..83c82e74 100644 --- a/Sources/Plasma/PubUtilLib/plAvatar/plScalarChannel.cpp +++ b/Sources/Plasma/PubUtilLib/plAvatar/plScalarChannel.cpp @@ -80,14 +80,14 @@ plScalarChannel::~plScalarChannel() // value -------------------------------------------------------- // ------ -const hsScalar & plScalarChannel::Value(double time, hsBool peek) +const float & plScalarChannel::Value(double time, hsBool peek) { return fResult; } // value -------------------------------------------------------------- // ------ -void plScalarChannel::Value(hsScalar &scalar, double time, hsBool peek) +void plScalarChannel::Value(float &scalar, double time, hsBool peek) { scalar = Value(time, peek); } @@ -111,7 +111,7 @@ plAGChannel * plScalarChannel::MakeBlend(plAGChannel * channelB, if (chanB) { - result = TRACKED_NEW plScalarBlend(this, chanB, chanBias); + result = new plScalarBlend(this, chanB, chanBias); } else { hsStatusMessage("Blend operation failed."); } @@ -122,14 +122,14 @@ plAGChannel * plScalarChannel::MakeBlend(plAGChannel * channelB, // -------------- plAGChannel * plScalarChannel::MakeZeroState() { - return TRACKED_NEW plScalarConstant(Value(0)); + return new plScalarConstant(Value(0)); } // MakeTimeScale -------------------------------------------------------- // -------------- plAGChannel * plScalarChannel::MakeTimeScale(plScalarChannel *timeSource) { - return TRACKED_NEW plScalarTimeScale(this, timeSource); + return new plScalarTimeScale(this, timeSource); } ///////////////////////////////////////////////////////////////////////////////////////// @@ -146,7 +146,7 @@ plScalarConstant::plScalarConstant() // ctor ------------------------------------------ // ----- -plScalarConstant::plScalarConstant(hsScalar value) +plScalarConstant::plScalarConstant(float value) { fResult = value; } @@ -202,7 +202,7 @@ hsBool plScalarTimeScale::IsStoppedAt(double time) } // VALUE -const hsScalar & plScalarTimeScale::Value(double time, hsBool peek) +const float & plScalarTimeScale::Value(double time, hsBool peek) { fResult = fChannelIn->Value(fTimeSource->Value(time, peek)); @@ -265,7 +265,7 @@ plScalarBlend::~plScalarBlend() // ------------ hsBool plScalarBlend::IsStoppedAt(double time) { - hsScalar blend = fChannelBias->Value(time); + float blend = fChannelBias->Value(time); if (blend == 0) return fChannelA->IsStoppedAt(time); if (blend == 1) @@ -276,17 +276,17 @@ hsBool plScalarBlend::IsStoppedAt(double time) // Value ------------------------------------------------------ // ------ -const hsScalar & plScalarBlend::Value(double time, hsBool peek) +const float & plScalarBlend::Value(double time, hsBool peek) { - hsScalar curBlend = fChannelBias->Value(time, peek); + float curBlend = fChannelBias->Value(time, peek); if(curBlend == 0) { fChannelA->Value(fResult, time, peek); } else { if(curBlend == 1) { fChannelB->Value(fResult, time, peek); } else { - const hsScalar &scalarA = fChannelA->Value(time, peek); - const hsScalar &scalarB = fChannelB->Value(time, peek); + const float &scalarA = fChannelA->Value(time, peek); + const float &scalarB = fChannelB->Value(time, peek); fResult = scalarA + curBlend * (scalarB - scalarA); } } @@ -353,17 +353,17 @@ plScalarControllerChannel::~plScalarControllerChannel() // Value ------------------------------------------------------------------ // ------ -const hsScalar & plScalarControllerChannel::Value(double time, hsBool peek) +const float & plScalarControllerChannel::Value(double time, hsBool peek) { return Value(time, peek, nil); } // Value ------------------------------------------------------------------ // ------ -const hsScalar & plScalarControllerChannel::Value(double time, hsBool peek, +const float & plScalarControllerChannel::Value(double time, hsBool peek, plControllerCacheInfo *cache) { - fController->Interp((hsScalar)time, &fResult, cache); + fController->Interp((float)time, &fResult, cache); return fResult; } @@ -373,7 +373,7 @@ plAGChannel *plScalarControllerChannel::MakeCacheChannel(plAnimTimeConvert *atc) { plControllerCacheInfo *cache = fController->CreateCache(); cache->SetATC(atc); - return TRACKED_NEW plScalarControllerCacheChannel(this, cache); + return new plScalarControllerCacheChannel(this, cache); } // Write ------------------------------------------------------------- @@ -428,7 +428,7 @@ plScalarControllerCacheChannel::~plScalarControllerCacheChannel() // Value --------------------------------------------------------------------- // ------ -const hsScalar & plScalarControllerCacheChannel::Value(double time, bool peek) +const float & plScalarControllerCacheChannel::Value(double time, bool peek) { return fControllerChannel->Value(time, peek, fCache); } @@ -486,7 +486,7 @@ hsBool plATCChannel::IsStoppedAt(double time) // Value ----------------------------------------------------- // ------ -const hsScalar & plATCChannel::Value(double time, hsBool peek) +const float & plATCChannel::Value(double time, hsBool peek) { fResult = (peek ? fConvert->WorldToAnimTimeNoUpdate(time) : fConvert->WorldToAnimTime(time)); return fResult; @@ -506,7 +506,7 @@ plScalarSDLChannel::plScalarSDLChannel() fResult = 0; } -plScalarSDLChannel::plScalarSDLChannel(hsScalar length) +plScalarSDLChannel::plScalarSDLChannel(float length) : fLength(length), fVar(nil) { fResult = 0; @@ -526,7 +526,7 @@ hsBool plScalarSDLChannel::IsStoppedAt(double time) // Value ----------------------------------------------------------- // ------ -const hsScalar & plScalarSDLChannel::Value(double time, hsBool peek) +const float & plScalarSDLChannel::Value(double time, hsBool peek) { if (fVar) fVar->Get(&fResult); @@ -557,8 +557,8 @@ void plSpotInnerApplicator::IApply(const plAGModifier *mod, double time) plSpotLightInfo *sli = plSpotLightInfo::ConvertNoRef(IGetGI(mod, plSpotLightInfo::Index())); - const hsScalar &scalar = scalarChan->Value(time); - sli->SetSpotInner(hsScalarDegToRad(scalar)*0.5f); + const float &scalar = scalarChan->Value(time); + sli->SetSpotInner(hsDegreesToRadians(scalar)*0.5f); } // IApply -------------------------------------------------------------- @@ -570,8 +570,8 @@ void plSpotOuterApplicator::IApply(const plAGModifier *mod, double time) plSpotLightInfo *sli = plSpotLightInfo::ConvertNoRef(IGetGI(mod, plSpotLightInfo::Index())); - const hsScalar &scalar = scalarChan->Value(time); - sli->SetSpotOuter(hsScalarDegToRad(scalar)*0.5f); + const float &scalar = scalarChan->Value(time); + sli->SetSpotOuter(hsDegreesToRadians(scalar)*0.5f); } diff --git a/Sources/Plasma/PubUtilLib/plAvatar/plScalarChannel.h b/Sources/Plasma/PubUtilLib/plAvatar/plScalarChannel.h index afe86367..6c4508a0 100644 --- a/Sources/Plasma/PubUtilLib/plAvatar/plScalarChannel.h +++ b/Sources/Plasma/PubUtilLib/plAvatar/plScalarChannel.h @@ -74,15 +74,15 @@ class plControllerCacheInfo; class plScalarChannel : public plAGChannel { protected: - hsScalar fResult; + float fResult; public: plScalarChannel(); virtual ~plScalarChannel(); // AG PROTOCOL - virtual const hsScalar & Value(double time, hsBool peek = false); - virtual void Value(hsScalar &result, double time, hsBool peek = false); + virtual const float & Value(double time, hsBool peek = false); + virtual void Value(float &result, double time, hsBool peek = false); // combine it (allocates combine object) virtual plAGChannel * MakeCombine(plAGChannel * channelB); @@ -109,11 +109,11 @@ class plScalarConstant : public plScalarChannel { public: plScalarConstant(); - plScalarConstant(hsScalar value); + plScalarConstant(float value); virtual ~plScalarConstant(); - void Set(hsScalar value) { fResult = value; } - hsScalar Get() { return fResult; } + void Set(float value) { fResult = value; } + float Get() { return fResult; } // PLASMA PROTOCOL CLASSNAME_REGISTER( plScalarConstant ); @@ -141,7 +141,7 @@ public: virtual ~plScalarTimeScale(); virtual hsBool IsStoppedAt(double time); - virtual const hsScalar & Value(double time, hsBool peek = false); + virtual const float & Value(double time, hsBool peek = false); virtual plAGChannel * Detach(plAGChannel * channel); // PLASMA PROTOCOL @@ -179,7 +179,7 @@ public: virtual hsBool IsStoppedAt(double time); // AG PROTOCOL - virtual const hsScalar & Value(double time, hsBool peek = false); + virtual const float & Value(double time, hsBool peek = false); // remove the specified channel from our graph virtual plAGChannel * Detach(plAGChannel * channel); @@ -205,8 +205,8 @@ public: virtual ~plScalarControllerChannel(); // AG PROTOCOL - virtual const hsScalar & Value(double time, hsBool peek = false); - virtual const hsScalar & Value(double time, hsBool peek, plControllerCacheInfo *cache); + virtual const float & Value(double time, hsBool peek = false); + virtual const float & Value(double time, hsBool peek, plControllerCacheInfo *cache); virtual plAGChannel *MakeCacheChannel(plAnimTimeConvert *atc); @@ -235,7 +235,7 @@ public: plScalarControllerCacheChannel(plScalarControllerChannel *channel, plControllerCacheInfo *cache); virtual ~plScalarControllerCacheChannel(); - virtual const hsScalar & Value(double time, bool peek = false); + virtual const float & Value(double time, bool peek = false); virtual plAGChannel * Detach(plAGChannel * channel); @@ -261,7 +261,7 @@ public: virtual ~plATCChannel(); virtual hsBool IsStoppedAt(double time); - virtual const hsScalar & Value(double time, hsBool peek = false); + virtual const float & Value(double time, hsBool peek = false); // PLASMA PROTOCOL CLASSNAME_REGISTER( plATCChannel ); @@ -276,15 +276,15 @@ class plScalarSDLChannel : public plScalarChannel { protected: plSimpleStateVariable *fVar; - hsScalar fLength; + float fLength; public: plScalarSDLChannel(); - plScalarSDLChannel(hsScalar length); + plScalarSDLChannel(float length); virtual ~plScalarSDLChannel(); virtual hsBool IsStoppedAt(double time); - virtual const hsScalar & Value(double time, hsBool peek = false); + virtual const float & Value(double time, hsBool peek = false); void SetVar(plSimpleStateVariable *var) { fVar = var; } diff --git a/Sources/Plasma/PubUtilLib/plAvatar/plSeekPointMod.cpp b/Sources/Plasma/PubUtilLib/plAvatar/plSeekPointMod.cpp index bc2bd205..086245ba 100644 --- a/Sources/Plasma/PubUtilLib/plAvatar/plSeekPointMod.cpp +++ b/Sources/Plasma/PubUtilLib/plAvatar/plSeekPointMod.cpp @@ -90,7 +90,7 @@ void plSeekPointMod::Read(hsStream *stream, hsResMgr *mgr) int length = stream->ReadLE32(); if(length > 0) { - fName = TRACKED_NEW char[length + 1]; + fName = new char[length + 1]; stream->Read(length, fName); fName[length] = 0; } diff --git a/Sources/Plasma/PubUtilLib/plAvatar/plSeekPointMod.h b/Sources/Plasma/PubUtilLib/plAvatar/plSeekPointMod.h index 44136e7b..9ab66861 100644 --- a/Sources/Plasma/PubUtilLib/plAvatar/plSeekPointMod.h +++ b/Sources/Plasma/PubUtilLib/plAvatar/plSeekPointMod.h @@ -52,7 +52,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com class plSeekPointMod : public plMultiModifier { protected: - virtual hsBool IEval(double secs, hsScalar del, UInt32 dirty) {return true;} + virtual hsBool IEval(double secs, float del, uint32_t dirty) {return true;} char * fName; // public because you can't change it public: diff --git a/Sources/Plasma/PubUtilLib/plAvatar/plSittingModifier.cpp b/Sources/Plasma/PubUtilLib/plAvatar/plSittingModifier.cpp index c03b648a..8fa88342 100644 --- a/Sources/Plasma/PubUtilLib/plAvatar/plSittingModifier.cpp +++ b/Sources/Plasma/PubUtilLib/plAvatar/plSittingModifier.cpp @@ -160,14 +160,14 @@ hsBool plSittingModifier::MsgReceive(plMessage *msg) plAvBrainHuman *brain = (avMod ? plAvBrainHuman::ConvertNoRef(avMod->GetCurrentBrain()) : nil); if (brain && !brain->IsRunningTask()) { - plNotifyMsg *notifyEnter = TRACKED_NEW plNotifyMsg(); // a message to send back when the brain starts + plNotifyMsg *notifyEnter = new plNotifyMsg(); // a message to send back when the brain starts notifyEnter->fState = 1.0f; // it's an "on" event ISetupNotify(notifyEnter, notifyMsg); // copy events and address to sender plNotifyMsg *notifyExit = nil; if (avatarKey == plNetClientApp::GetInstance()->GetLocalPlayerKey()) { - notifyExit = TRACKED_NEW plNotifyMsg(); // a new message to send back when the brain's done + notifyExit = new plNotifyMsg(); // a new message to send back when the brain's done notifyExit->fState = 0.0f; // it's an "off" event ISetupNotify(notifyExit, notifyMsg); // copy events and address to sender notifyExit->AddReceiver(GetKey()); // have this message come back to us as well @@ -198,7 +198,7 @@ hsBool plSittingModifier::MsgReceive(plMessage *msg) plSceneObject * obj = plSceneObject::ConvertNoRef(avatarKey->ObjectIsLoaded()); plArmatureMod * avMod = (plArmatureMod*)obj->GetModifierByType(plArmatureMod::Index()); - UInt32 flags = kBCastToClients | kUseRelevanceRegions | kForceFullSend; + uint32_t flags = kBCastToClients | kUseRelevanceRegions | kForceFullSend; avMod->DirtyPhysicalSynchState(flags); } } @@ -226,27 +226,27 @@ void plSittingModifier::Trigger(const plArmatureMod *avMod, plNotifyMsg *enterNo plAvBrainGeneric *brain = IBuildSitBrain(avModKey, seekKey, &animName, enterNotify, exitNotify); if(brain) { - plAvSeekMsg *seekMsg = TRACKED_NEW plAvSeekMsg(ourKey, avModKey, seekKey, 0.0f, true, kAlignHandleAnimEnd, animName); + plAvSeekMsg *seekMsg = new plAvSeekMsg(ourKey, avModKey, seekKey, 0.0f, true, kAlignHandleAnimEnd, animName); seekMsg->Send(); - plAvTaskBrain *brainTask = TRACKED_NEW plAvTaskBrain(brain); - plAvTaskMsg *brainMsg = TRACKED_NEW plAvTaskMsg(ourKey, avModKey, brainTask); + plAvTaskBrain *brainTask = new plAvTaskBrain(brain); + plAvTaskMsg *brainMsg = new plAvTaskMsg(ourKey, avModKey, brainTask); brainMsg->Send(); if (avModKey == plAvatarMgr::GetInstance()->GetLocalAvatarKey()) { - plCameraMsg* pCam = TRACKED_NEW plCameraMsg; + plCameraMsg* pCam = new plCameraMsg; pCam->SetBCastFlag(plMessage::kBCastByExactType); pCam->SetCmd(plCameraMsg::kResetPanning); pCam->Send(); - plCameraMsg* pCam2 = TRACKED_NEW plCameraMsg; + plCameraMsg* pCam2 = new plCameraMsg; pCam2->SetBCastFlag(plMessage::kBCastByExactType); pCam2->SetCmd(plCameraMsg::kPythonSetFirstPersonOverrideEnable); pCam2->SetActivated(false); pCam2->Send(); - plCameraMsg* pCam3 = TRACKED_NEW plCameraMsg; + plCameraMsg* pCam3 = new plCameraMsg; pCam3->SetBCastFlag(plMessage::kBCastByExactType); pCam3->SetCmd(plCameraMsg::kPythonUndoFirstPerson); pCam3->Send(); @@ -264,7 +264,7 @@ void plSittingModifier::Trigger(const plArmatureMod *avMod, plNotifyMsg *enterNo // IIsClosestAnim ------------------------------------------------------------------- // --------------- -bool IIsClosestAnim(const char *animName, hsMatrix44 &sitGoal, hsScalar &closestDist, +bool IIsClosestAnim(const char *animName, hsMatrix44 &sitGoal, float &closestDist, hsPoint3 curPosition, const plArmatureMod *avatar) { plAGAnim *anim = avatar->FindCustomAnim(animName); @@ -283,7 +283,7 @@ bool IIsClosestAnim(const char *animName, hsMatrix44 &sitGoal, hsScalar &closest hsMatrix44 candidateGoal = sitGoal * animEndToStart; hsPoint3 distP = candidateGoal.GetTranslate() - curPosition; hsVector3 distV(distP.fX, distP.fY, distP.fZ); - hsScalar dist = distP.Magnitude(); + float dist = distP.Magnitude(); if(closestDist == 0.0 || dist < closestDist) { closestDist = dist; @@ -307,8 +307,8 @@ plAvBrainGeneric *plSittingModifier::IBuildSitBrain(plKey avModKey, plKey seekKe hsMatrix44 animEndToStart; hsMatrix44 sitGoal = seekObj->GetLocalToWorld(); hsMatrix44 candidateGoal; - hsScalar closestDist = 0.0f; - UInt8 closestApproach = 0; + float closestDist = 0.0f; + uint8_t closestApproach = 0; hsPoint3 curPosition = avatar->GetTarget(0)->GetLocalToWorld().GetTranslate(); char * sitAnimName = nil; char * standAnimName = "StandUpFront"; // always prefer to stand facing front @@ -341,15 +341,15 @@ plAvBrainGeneric *plSittingModifier::IBuildSitBrain(plKey avModKey, plKey seekKe if(sitAnimName) { - UInt32 exitFlags = plAvBrainGeneric::kExitNormal; // SOME stages can be interrupted, but not the brain itself - brain = TRACKED_NEW plAvBrainGeneric(nil, enterNotify, exitNotify, nil, exitFlags, plAvBrainGeneric::kDefaultFadeIn, + uint32_t exitFlags = plAvBrainGeneric::kExitNormal; // SOME stages can be interrupted, but not the brain itself + brain = new plAvBrainGeneric(nil, enterNotify, exitNotify, nil, exitFlags, plAvBrainGeneric::kDefaultFadeIn, plAvBrainGeneric::kDefaultFadeOut, plAvBrainGeneric::kMoveRelative); - plAnimStage *sitStage = TRACKED_NEW plAnimStage(sitAnimName, 0, plAnimStage::kForwardAuto, plAnimStage::kBackNone, + plAnimStage *sitStage = new plAnimStage(sitAnimName, 0, plAnimStage::kForwardAuto, plAnimStage::kBackNone, plAnimStage::kAdvanceAuto, plAnimStage::kRegressNone, 0); - plAnimStage *idleStage = TRACKED_NEW plAnimStage("SitIdle", plAnimStage::kNotifyEnter, plAnimStage::kForwardAuto, plAnimStage::kBackNone, + plAnimStage *idleStage = new plAnimStage("SitIdle", plAnimStage::kNotifyEnter, plAnimStage::kForwardAuto, plAnimStage::kBackNone, plAnimStage::kAdvanceOnMove, plAnimStage::kRegressNone, -1); - plAnimStage *standStage = TRACKED_NEW plAnimStage(standAnimName, 0, plAnimStage::kForwardAuto, plAnimStage::kBackNone, + plAnimStage *standStage = new plAnimStage(standAnimName, 0, plAnimStage::kForwardAuto, plAnimStage::kBackNone, plAnimStage::kAdvanceAuto, plAnimStage::kRegressNone, 0); brain->AddStage(sitStage); @@ -370,12 +370,12 @@ void plSittingModifier::UnTrigger() { if (fTriggeredAvatarKey == plAvatarMgr::GetInstance()->GetLocalAvatarKey()) { - plCameraMsg* pCam = TRACKED_NEW plCameraMsg; + plCameraMsg* pCam = new plCameraMsg; pCam->SetBCastFlag(plMessage::kBCastByExactType); pCam->SetCmd(plCameraMsg::kResetPanning); pCam->Send(); - plCameraMsg* pCam2 = TRACKED_NEW plCameraMsg; + plCameraMsg* pCam2 = new plCameraMsg; pCam2->SetBCastFlag(plMessage::kBCastByExactType); pCam2->SetCmd(plCameraMsg::kPythonSetFirstPersonOverrideEnable); pCam2->SetActivated(true); diff --git a/Sources/Plasma/PubUtilLib/plAvatar/plSittingModifier.h b/Sources/Plasma/PubUtilLib/plAvatar/plSittingModifier.h index c02db942..ff6c66a5 100644 --- a/Sources/Plasma/PubUtilLib/plAvatar/plSittingModifier.h +++ b/Sources/Plasma/PubUtilLib/plAvatar/plSittingModifier.h @@ -80,7 +80,7 @@ public: kDisableForward = 0x10, }; - UInt8 fMiscFlags; + uint8_t fMiscFlags; plSittingModifier(); plSittingModifier(bool hasFront, bool hasLeft, bool hasRight); @@ -113,7 +113,7 @@ protected: plAvBrainGeneric * IBuildSitBrain(plKey avModKey, plKey seekKey,char **pAnimName, plNotifyMsg *enterNotify, plNotifyMsg *exitNotify); /** Unused. */ - virtual hsBool IEval(double secs, hsScalar del, UInt32 dirty) { return true; } + virtual hsBool IEval(double secs, float del, uint32_t dirty) { return true; } /** An array of keys to objects that are interested in receiving our sit messages. */ hsTArray fNotifyKeys; diff --git a/Sources/Plasma/PubUtilLib/plAvatar/plSwimRegion.cpp b/Sources/Plasma/PubUtilLib/plAvatar/plSwimRegion.cpp index 3edfaba8..30dd34df 100644 --- a/Sources/Plasma/PubUtilLib/plAvatar/plSwimRegion.cpp +++ b/Sources/Plasma/PubUtilLib/plAvatar/plSwimRegion.cpp @@ -64,7 +64,7 @@ void plSwimRegionInterface::Write(hsStream* s, hsResMgr* mgr) s->WriteLEScalar(fMaxUpwardVel); } -void plSwimRegionInterface::GetCurrent(plPhysicalControllerCore *physical, hsVector3 &linearResult, hsScalar &angularResult, hsScalar elapsed) +void plSwimRegionInterface::GetCurrent(plPhysicalControllerCore *physical, hsVector3 &linearResult, float &angularResult, float elapsed) { linearResult.Set(0.f, 0.f, 0.f); angularResult = 0.f; @@ -91,7 +91,7 @@ void plSwimCircularCurrentRegion::Read(hsStream* stream, hsResMgr* mgr) fPullNearVel = stream->ReadLEScalar(); fPullFarDistSq = stream->ReadLEScalar(); fPullFarVel = stream->ReadLEScalar(); - mgr->ReadKeyNotifyMe(stream, TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnCreate, -1, -1), plRefFlags::kActiveRef); // currentSO + mgr->ReadKeyNotifyMe(stream, new plGenRefMsg(GetKey(), plRefMsg::kOnCreate, -1, -1), plRefFlags::kActiveRef); // currentSO } void plSwimCircularCurrentRegion::Write(hsStream* stream, hsResMgr* mgr) @@ -126,7 +126,7 @@ hsBool plSwimCircularCurrentRegion::MsgReceive(plMessage* msg) return plSwimRegionInterface::MsgReceive(msg); } -void plSwimCircularCurrentRegion::GetCurrent(plPhysicalControllerCore *physical, hsVector3 &linearResult, hsScalar &angularResult, hsScalar elapsed) +void plSwimCircularCurrentRegion::GetCurrent(plPhysicalControllerCore *physical, hsVector3 &linearResult, float &angularResult, float elapsed) { if (elapsed <= 0.f || fCurrentSO == nil || GetProperty(kDisable)) { @@ -151,8 +151,8 @@ void plSwimCircularCurrentRegion::GetCurrent(plPhysicalControllerCore *physical, hsBool applyPull = true; hsVector3 pos2Center(center.fX - pos.fX, center.fY - pos.fY, 0.f); - hsScalar pullVel; - hsScalar distSq = pos2Center.MagnitudeSquared(); + float pullVel; + float distSq = pos2Center.MagnitudeSquared(); if (distSq < .5) { // Don't want to pull us too close to the center, or we @@ -176,12 +176,12 @@ void plSwimCircularCurrentRegion::GetCurrent(plPhysicalControllerCore *physical, hsVector3 v1 = linearResult * elapsed - pos2Center; hsVector3 v2 = -pos2Center; - hsScalar invCos = v1.InnerProduct(v2) / v1.Magnitude() / v2.Magnitude(); + float invCos = v1.InnerProduct(v2) / v1.Magnitude() / v2.Magnitude(); if (invCos > 1) invCos = 1; if (invCos < -1) invCos = -1; - angularResult = hsACosine(invCos) / elapsed; + angularResult = acos(invCos) / elapsed; // hsAssert(real_finite(linearResult.fX) && // real_finite(linearResult.fY) && @@ -208,7 +208,7 @@ void plSwimStraightCurrentRegion::Read(hsStream* stream, hsResMgr* mgr) fNearVel = stream->ReadLEScalar(); fFarDist = stream->ReadLEScalar(); fFarVel = stream->ReadLEScalar(); - mgr->ReadKeyNotifyMe(stream, TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnCreate, -1, -1), plRefFlags::kActiveRef); // currentSO + mgr->ReadKeyNotifyMe(stream, new plGenRefMsg(GetKey(), plRefMsg::kOnCreate, -1, -1), plRefFlags::kActiveRef); // currentSO } void plSwimStraightCurrentRegion::Write(hsStream* stream, hsResMgr* mgr) @@ -242,7 +242,7 @@ hsBool plSwimStraightCurrentRegion::MsgReceive(plMessage* msg) return plSwimRegionInterface::MsgReceive(msg); } -void plSwimStraightCurrentRegion::GetCurrent(plPhysicalControllerCore *physical, hsVector3 &linearResult, hsScalar &angularResult, hsScalar elapsed) +void plSwimStraightCurrentRegion::GetCurrent(plPhysicalControllerCore *physical, hsVector3 &linearResult, float &angularResult, float elapsed) { angularResult = 0.f; @@ -267,8 +267,8 @@ void plSwimStraightCurrentRegion::GetCurrent(plPhysicalControllerCore *physical, } hsVector3 pos2Center(center.fX - pos.fX, center.fY - pos.fY, 0.f); - hsScalar dist = current.InnerProduct(pos - center); - hsScalar pullVel; + float dist = current.InnerProduct(pos - center); + float pullVel; if (dist <= fNearDist) pullVel = fNearVel; diff --git a/Sources/Plasma/PubUtilLib/plAvatar/plSwimRegion.h b/Sources/Plasma/PubUtilLib/plAvatar/plSwimRegion.h index 2aacd408..5c071bc6 100644 --- a/Sources/Plasma/PubUtilLib/plAvatar/plSwimRegion.h +++ b/Sources/Plasma/PubUtilLib/plAvatar/plSwimRegion.h @@ -62,16 +62,16 @@ public: kNumProps // last }; - virtual Int32 GetNumProperties() const { return kNumProps; } + virtual int32_t GetNumProperties() const { return kNumProps; } virtual void SetTransform(const hsMatrix44& l2w, const hsMatrix44& w2l) {} virtual void Read(hsStream* stream, hsResMgr* mgr); virtual void Write(hsStream* stream, hsResMgr* mgr); - virtual void GetCurrent(plPhysicalControllerCore *physical, hsVector3 &linearResult, hsScalar &angularResult, hsScalar elapsed); + virtual void GetCurrent(plPhysicalControllerCore *physical, hsVector3 &linearResult, float &angularResult, float elapsed); - hsScalar fDownBuoyancy; - hsScalar fUpBuoyancy; - hsScalar fMaxUpwardVel; + float fDownBuoyancy; + float fUpBuoyancy; + float fMaxUpwardVel; }; class plSwimCircularCurrentRegion : public plSwimRegionInterface @@ -86,14 +86,14 @@ public: virtual void Read(hsStream* stream, hsResMgr* mgr); virtual void Write(hsStream* stream, hsResMgr* mgr); - virtual void GetCurrent(plPhysicalControllerCore *physical, hsVector3 &linearResult, hsScalar &angularResult, hsScalar elapsed); + virtual void GetCurrent(plPhysicalControllerCore *physical, hsVector3 &linearResult, float &angularResult, float elapsed); virtual hsBool MsgReceive(plMessage* msg); - hsScalar fRotation; - hsScalar fPullNearDistSq; - hsScalar fPullNearVel; - hsScalar fPullFarDistSq; - hsScalar fPullFarVel; + float fRotation; + float fPullNearDistSq; + float fPullNearVel; + float fPullFarDistSq; + float fPullFarVel; protected: plSceneObject *fCurrentSO; @@ -111,13 +111,13 @@ public: virtual void Read(hsStream* stream, hsResMgr* mgr); virtual void Write(hsStream* stream, hsResMgr* mgr); - virtual void GetCurrent(plPhysicalControllerCore *physical, hsVector3 &linearResult, hsScalar &angularResult, hsScalar elapsed); + virtual void GetCurrent(plPhysicalControllerCore *physical, hsVector3 &linearResult, float &angularResult, float elapsed); virtual hsBool MsgReceive(plMessage* msg); - hsScalar fNearDist; - hsScalar fNearVel; - hsScalar fFarDist; - hsScalar fFarVel; + float fNearDist; + float fNearVel; + float fFarDist; + float fFarVel; protected: plSceneObject *fCurrentSO; diff --git a/Sources/Plasma/PubUtilLib/plClientResMgr/plClientResMgr.cpp b/Sources/Plasma/PubUtilLib/plClientResMgr/plClientResMgr.cpp index adc8cff0..681fbbb9 100644 --- a/Sources/Plasma/PubUtilLib/plClientResMgr/plClientResMgr.cpp +++ b/Sources/Plasma/PubUtilLib/plClientResMgr/plClientResMgr.cpp @@ -40,8 +40,8 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ -#include "hsTypes.h" -#include "hsUtils.h" +#include "HeadSpin.h" + #include "hsStream.h" #include "hsResMgr.h" #include "plJPEG/plJPEG.h" @@ -61,7 +61,7 @@ plClientResMgr& plClientResMgr::Instance(void) plClientResMgr::plClientResMgr() { - this->ClientResources = TRACKED_NEW std::map; + this->ClientResources = new std::map; } plClientResMgr::~plClientResMgr() @@ -84,13 +84,13 @@ void plClientResMgr::ILoadResources(const char* resfile) return; } - wchar* wFilename = hsStringToWString(resfile); + wchar_t* wFilename = hsStringToWString(resfile); hsUNIXStream in; if (in.Open(wFilename, L"rb")) { - UInt32 header = in.ReadLE32(); - UInt32 version = in.ReadLE32(); - UInt32 num_resources = 0; + uint32_t header = in.ReadLE32(); + uint32_t version = in.ReadLE32(); + uint32_t num_resources = 0; switch (version) { case 1: @@ -98,7 +98,7 @@ void plClientResMgr::ILoadResources(const char* resfile) for (int i = 0; i < num_resources; i++) { plMipmap* res_data = NULL; - UInt32 res_size = 0; + uint32_t res_size = 0; char* tmp_name = in.ReadSafeStringLong(); std::string res_name = std::string(tmp_name); std::string res_type = res_name.substr(res_name.length() - 4, 4); diff --git a/Sources/Plasma/PubUtilLib/plCompression/plCompress.h b/Sources/Plasma/PubUtilLib/plCompression/plCompress.h index 128f9280..7992ab91 100644 --- a/Sources/Plasma/PubUtilLib/plCompression/plCompress.h +++ b/Sources/Plasma/PubUtilLib/plCompression/plCompress.h @@ -42,7 +42,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #ifndef plCompress_h #define plCompress_h -#include "hsTypes.h" +#include "HeadSpin.h" // // Abstract base class for compression code @@ -54,12 +54,12 @@ public: virtual ~plCompress() {} // return true if successful - virtual hsBool Uncompress(UInt8* bufOut, UInt32* bufLenOut, const UInt8* bufIn, UInt32 bufLenIn) = 0; - virtual hsBool Compress(UInt8* bufOut, UInt32* bufLenOut, const UInt8* bufIn, UInt32 bufLenIn) = 0; + virtual hsBool Uncompress(uint8_t* bufOut, uint32_t* bufLenOut, const uint8_t* bufIn, uint32_t bufLenIn) = 0; + virtual hsBool Compress(uint8_t* bufOut, uint32_t* bufLenOut, const uint8_t* bufIn, uint32_t bufLenIn) = 0; // in place versions - virtual hsBool Uncompress(UInt8** bufIn, UInt32* bufLenIn, UInt32 maxBufLenOut, int offset=0) = 0; - virtual hsBool Compress(UInt8** bufIn, UInt32* bufLenIn, int offset=0) = 0; + virtual hsBool Uncompress(uint8_t** bufIn, uint32_t* bufLenIn, uint32_t maxBufLenOut, int offset=0) = 0; + virtual hsBool Compress(uint8_t** bufIn, uint32_t* bufLenIn, int offset=0) = 0; }; diff --git a/Sources/Plasma/PubUtilLib/plCompression/plZlibCompress.cpp b/Sources/Plasma/PubUtilLib/plCompression/plZlibCompress.cpp index 93796669..b39823bc 100644 --- a/Sources/Plasma/PubUtilLib/plCompression/plZlibCompress.cpp +++ b/Sources/Plasma/PubUtilLib/plCompression/plZlibCompress.cpp @@ -44,7 +44,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "hsMemory.h" #include "hsStream.h" -hsBool plZlibCompress::Uncompress(UInt8* bufOut, UInt32* bufLenOut, const UInt8* bufIn, UInt32 bufLenIn) +hsBool plZlibCompress::Uncompress(uint8_t* bufOut, uint32_t* bufLenOut, const uint8_t* bufIn, uint32_t bufLenIn) { unsigned long buflen_out = *bufLenOut; bool result = (uncompress(bufOut, &buflen_out, bufIn, bufLenIn) == Z_OK); @@ -52,7 +52,7 @@ hsBool plZlibCompress::Uncompress(UInt8* bufOut, UInt32* bufLenOut, const UInt8* return result; } -hsBool plZlibCompress::Compress(UInt8* bufOut, UInt32* bufLenOut, const UInt8* bufIn, UInt32 bufLenIn) +hsBool plZlibCompress::Compress(uint8_t* bufOut, uint32_t* bufLenOut, const uint8_t* bufIn, uint32_t bufLenIn) { // according to compress doc, the bufOut buffer should be at least .1% larger than source buffer, plus 12 bytes. hsAssert(*bufLenOut>=(int)(bufLenIn*1.1+12), "bufOut compress buffer is not large enough"); @@ -65,12 +65,12 @@ hsBool plZlibCompress::Compress(UInt8* bufOut, UInt32* bufLenOut, const UInt8* b // // copy bufOut to bufIn, set bufLenIn=bufLenOut // -hsBool plZlibCompress::ICopyBuffers(UInt8** bufIn, UInt32* bufLenIn, char* bufOut, UInt32 bufLenOut, int offset, bool ok) +hsBool plZlibCompress::ICopyBuffers(uint8_t** bufIn, uint32_t* bufLenIn, char* bufOut, uint32_t bufLenOut, int offset, bool ok) { if (ok) { *bufLenIn = bufLenOut+offset; - UInt8* newBuf = TRACKED_NEW UInt8[*bufLenIn]; // alloc new buffer + uint8_t* newBuf = new uint8_t[*bufLenIn]; // alloc new buffer HSMemory::BlockMove(*bufIn, newBuf, offset); // copy offset (uncompressed) part delete [] *bufIn; // delete original buffer @@ -87,16 +87,16 @@ hsBool plZlibCompress::ICopyBuffers(UInt8** bufIn, UInt32* bufLenIn, char* bufOu // In place version // offset is how much to skip over when compressing // -hsBool plZlibCompress::Compress(UInt8** bufIn, UInt32* bufLenIn, int offset) +hsBool plZlibCompress::Compress(uint8_t** bufIn, uint32_t* bufLenIn, int offset) { - UInt32 adjBufLenIn = *bufLenIn - offset; - UInt8* adjBufIn = *bufIn + offset; + uint32_t adjBufLenIn = *bufLenIn - offset; + uint8_t* adjBufIn = *bufIn + offset; // according to compress doc, the bufOut buffer should be at least .1% larger than source buffer, plus 12 bytes. - UInt32 bufLenOut = (int)(adjBufLenIn*1.1+12); - char* bufOut = TRACKED_NEW char[bufLenOut]; + uint32_t bufLenOut = (int)(adjBufLenIn*1.1+12); + char* bufOut = new char[bufLenOut]; - bool ok=(Compress((UInt8*)bufOut, &bufLenOut, (UInt8*)adjBufIn, adjBufLenIn) && + bool ok=(Compress((uint8_t*)bufOut, &bufLenOut, (uint8_t*)adjBufIn, adjBufLenIn) && bufLenOut < adjBufLenIn); return ICopyBuffers(bufIn, bufLenIn, bufOut, bufLenOut, offset, ok); } @@ -104,14 +104,14 @@ hsBool plZlibCompress::Compress(UInt8** bufIn, UInt32* bufLenIn, int offset) // // In place version // -hsBool plZlibCompress::Uncompress(UInt8** bufIn, UInt32* bufLenIn, UInt32 bufLenOut, int offset) +hsBool plZlibCompress::Uncompress(uint8_t** bufIn, uint32_t* bufLenIn, uint32_t bufLenOut, int offset) { - UInt32 adjBufLenIn = *bufLenIn - offset; - UInt8* adjBufIn = *bufIn + offset; + uint32_t adjBufLenIn = *bufLenIn - offset; + uint8_t* adjBufIn = *bufIn + offset; - char* bufOut = TRACKED_NEW char[bufLenOut]; + char* bufOut = new char[bufLenOut]; - bool ok=Uncompress((UInt8*)bufOut, &bufLenOut, (UInt8*)adjBufIn, adjBufLenIn) ? true : false; + bool ok=Uncompress((uint8_t*)bufOut, &bufLenOut, (uint8_t*)adjBufIn, adjBufLenIn) ? true : false; return ICopyBuffers(bufIn, bufLenIn, bufOut, bufLenOut, offset, ok); } @@ -127,7 +127,7 @@ hsBool plZlibCompress::UncompressFile( const char *compressedPath, const char * hsBool worked = false; int length, err; - UInt8 buffer[ kGzBufferSize ]; + uint8_t buffer[ kGzBufferSize ]; outFile = fopen( destPath, "wb" ); @@ -169,7 +169,7 @@ hsBool plZlibCompress::CompressFile( const char *uncompressedPath, const char * hsBool worked = false; int length, err; - UInt8 buffer[ kGzBufferSize ]; + uint8_t buffer[ kGzBufferSize ]; inFile = fopen( uncompressedPath, "rb" ); @@ -213,7 +213,7 @@ hsBool plZlibCompress::UncompressToStream( const char * filename, hsStream * s hsBool worked = false; int length, err; - UInt8 buffer[ kGzBufferSize ]; + uint8_t buffer[ kGzBufferSize ]; inFile = gzopen( filename, "rb" ); @@ -248,7 +248,7 @@ hsBool plZlibCompress::CompressToFile( hsStream * s, const char * filename ) hsBool worked = false; int length, err; - UInt8 buffer[ kGzBufferSize ]; + uint8_t buffer[ kGzBufferSize ]; outFile = gzopen( filename, "wb" ); diff --git a/Sources/Plasma/PubUtilLib/plCompression/plZlibCompress.h b/Sources/Plasma/PubUtilLib/plCompression/plZlibCompress.h index c5d627be..b34f5a15 100644 --- a/Sources/Plasma/PubUtilLib/plCompression/plZlibCompress.h +++ b/Sources/Plasma/PubUtilLib/plCompression/plZlibCompress.h @@ -49,14 +49,14 @@ class hsStream; class plZlibCompress : public plCompress { protected: - hsBool ICopyBuffers(UInt8** bufIn, UInt32* bufLenIn, char* bufOut, UInt32 bufLenOut, int offset, bool ok ); + hsBool ICopyBuffers(uint8_t** bufIn, uint32_t* bufLenIn, char* bufOut, uint32_t bufLenOut, int offset, bool ok ); public: - hsBool Uncompress(UInt8* bufOut, UInt32* bufLenOut, const UInt8* bufIn, UInt32 bufLenIn); - hsBool Compress(UInt8* bufOut, UInt32* bufLenOut, const UInt8* bufIn, UInt32 bufLenIn); + hsBool Uncompress(uint8_t* bufOut, uint32_t* bufLenOut, const uint8_t* bufIn, uint32_t bufLenIn); + hsBool Compress(uint8_t* bufOut, uint32_t* bufLenOut, const uint8_t* bufIn, uint32_t bufLenIn); // in place versions - hsBool Uncompress(UInt8** bufIn, UInt32* bufLenIn, UInt32 maxBufLenOut, int offset=0); - hsBool Compress(UInt8** bufIn, UInt32* bufLenIn, int offset=0); + hsBool Uncompress(uint8_t** bufIn, uint32_t* bufLenIn, uint32_t maxBufLenOut, int offset=0); + hsBool Compress(uint8_t** bufIn, uint32_t* bufLenIn, int offset=0); // .gz versions static hsBool UncompressFile( const char *compressedPath, const char *destPath ); diff --git a/Sources/Plasma/PubUtilLib/plCompression/plZlibStream.cpp b/Sources/Plasma/PubUtilLib/plCompression/plZlibStream.cpp index 75c5af93..f8fcbb35 100644 --- a/Sources/Plasma/PubUtilLib/plCompression/plZlibStream.cpp +++ b/Sources/Plasma/PubUtilLib/plCompression/plZlibStream.cpp @@ -44,12 +44,12 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com voidpf ZlibAlloc(voidpf opaque, uInt items, uInt size) { - return ALLOC(items*size); + return malloc(items*size); } void ZlibFree(voidpf opaque, voidpf address) { - FREE(address); + free(address); } plZlibStream::plZlibStream() : fOutput(nil), fZStream(nil), fHeader(kNeedMoreData), fDecompressedOk(false) @@ -63,20 +63,20 @@ plZlibStream::~plZlibStream() hsBool plZlibStream::Open(const char* filename, const char* mode) { - wchar* wFilename = hsStringToWString(filename); - wchar* wMode = hsStringToWString(mode); + wchar_t* wFilename = hsStringToWString(filename); + wchar_t* wMode = hsStringToWString(mode); hsBool ret = Open(wFilename, wMode); delete [] wFilename; delete [] wMode; return ret; } -hsBool plZlibStream::Open(const wchar* filename, const wchar* mode) +hsBool plZlibStream::Open(const wchar_t* filename, const wchar_t* mode) { fFilename = filename; fMode = mode; - fOutput = NEW(hsUNIXStream); + fOutput = new hsUNIXStream; return fOutput->Open(filename, L"wb"); } @@ -85,23 +85,23 @@ hsBool plZlibStream::Close() if (fOutput) { fOutput->Close(); - DEL(fOutput); + delete fOutput; fOutput = nil; } if (fZStream) { z_streamp zstream = (z_streamp)fZStream; inflateEnd(zstream); - DEL(zstream); + delete zstream; fZStream = nil; } return true; } -UInt32 plZlibStream::Write(UInt32 byteCount, const void* buffer) +uint32_t plZlibStream::Write(uint32_t byteCount, const void* buffer) { - UInt8* byteBuf = (UInt8*)buffer; + uint8_t* byteBuf = (uint8_t*)buffer; // Check if we've read in the full gzip header yet if (fHeader == kNeedMoreData) @@ -132,9 +132,9 @@ UInt32 plZlibStream::Write(UInt32 byteCount, const void* buffer) while (zstream->avail_in != 0) { zstream->avail_out = sizeof(outBuf); - zstream->next_out = (UInt8*)outBuf; + zstream->next_out = (uint8_t*)outBuf; - UInt32 amtWritten = zstream->total_out; + uint32_t amtWritten = zstream->total_out; int ret = inflate(zstream, Z_NO_FLUSH); @@ -163,7 +163,7 @@ UInt32 plZlibStream::Write(UInt32 byteCount, const void* buffer) return byteCount; } -int plZlibStream::IValidateGzHeader(UInt32 byteCount, const void* buffer) +int plZlibStream::IValidateGzHeader(uint32_t byteCount, const void* buffer) { // Ripped from gzio.cpp #define HEAD_CRC 0x02 @@ -179,13 +179,13 @@ int plZlibStream::IValidateGzHeader(UInt32 byteCount, const void* buffer) int initCacheSize = fHeaderCache.size(); for (i = 0; i < byteCount; i++) - fHeaderCache.push_back(((UInt8*)buffer)[i]); + fHeaderCache.push_back(((uint8_t*)buffer)[i]); hsReadOnlyStream s(fHeaderCache.size(), &fHeaderCache[0]); // Check the gzip magic header for (i = 0; i < 2; i++) { - UInt8 c = s.ReadByte(); + uint8_t c = s.ReadByte(); if (c != gz_magic[i]) { CheckForEnd(); @@ -211,7 +211,7 @@ int plZlibStream::IValidateGzHeader(UInt32 byteCount, const void* buffer) if ((flags & EXTRA_FIELD) != 0) { // skip the extra field - UInt16 len = s.ReadLE16(); + uint16_t len = s.ReadLE16(); while (len-- != 0 && s.ReadByte()) { CheckForEnd(); @@ -247,17 +247,17 @@ int plZlibStream::IValidateGzHeader(UInt32 byteCount, const void* buffer) CheckForEnd(); - UInt32 headerSize = s.GetPosition(); - UInt32 clipBuffer = headerSize - initCacheSize; + uint32_t headerSize = s.GetPosition(); + uint32_t clipBuffer = headerSize - initCacheSize; // Initialize the zlib stream - z_streamp zstream = NEW(z_stream_s); + z_streamp zstream = new z_stream_s; memset(zstream, 0, sizeof(z_stream_s)); zstream->zalloc = ZlibAlloc; zstream->zfree = ZlibFree; zstream->opaque = nil; zstream->avail_in = byteCount - clipBuffer; - zstream->next_in = (UInt8*)&fHeaderCache[clipBuffer]; + zstream->next_in = (uint8_t*)&fHeaderCache[clipBuffer]; // Gotta use inflateInit2, because there's no header for zlib to look at. // The -15 tells it to not try and find a header bool initOk = (inflateInit2(zstream, -15) == Z_OK); @@ -283,13 +283,13 @@ hsBool plZlibStream::AtEnd() return true; } -UInt32 plZlibStream::Read(UInt32 byteCount, void* buffer) +uint32_t plZlibStream::Read(uint32_t byteCount, void* buffer) { hsAssert(0, "Read not supported"); return 0; } -void plZlibStream::Skip(UInt32 deltaByteCount) +void plZlibStream::Skip(uint32_t deltaByteCount) { hsAssert(0, "Skip not supported"); } @@ -308,7 +308,7 @@ void plZlibStream::FastFwd() hsAssert(0, "FastFwd not supported"); } -UInt32 plZlibStream::GetEOF() +uint32_t plZlibStream::GetEOF() { hsAssert(0, "GetEOF not supported"); return 0; diff --git a/Sources/Plasma/PubUtilLib/plCompression/plZlibStream.h b/Sources/Plasma/PubUtilLib/plCompression/plZlibStream.h index fa7c66b6..2c42153d 100644 --- a/Sources/Plasma/PubUtilLib/plCompression/plZlibStream.h +++ b/Sources/Plasma/PubUtilLib/plCompression/plZlibStream.h @@ -58,20 +58,20 @@ protected: enum Validate { kNeedMoreData, kInvalidHeader, kValidHeader }; Validate fHeader; - std::vector fHeaderCache; + std::vector fHeaderCache; std::wstring fFilename, fMode; // needed for rewind function - int IValidateGzHeader(UInt32 byteCount, const void* buffer); + int IValidateGzHeader(uint32_t byteCount, const void* buffer); public: plZlibStream(); virtual ~plZlibStream(); virtual hsBool Open(const char* filename, const char* mode); - virtual hsBool Open(const wchar* filename, const wchar* mode); + virtual hsBool Open(const wchar_t* filename, const wchar_t* mode); virtual hsBool Close(); - virtual UInt32 Write(UInt32 byteCount, const void* buffer); + virtual uint32_t Write(uint32_t byteCount, const void* buffer); // Since most functions don't check the return value from Write, you can // call this after you've passed in all your data to determine if it @@ -80,11 +80,11 @@ public: // You can't use these virtual hsBool AtEnd(); - virtual UInt32 Read(UInt32 byteCount, void* buffer); - virtual void Skip(UInt32 deltaByteCount); + virtual uint32_t Read(uint32_t byteCount, void* buffer); + virtual void Skip(uint32_t deltaByteCount); virtual void Rewind(); virtual void FastFwd(); - virtual UInt32 GetEOF(); + virtual uint32_t GetEOF(); }; #endif // plZlibStream_h_inc \ No newline at end of file diff --git a/Sources/Plasma/PubUtilLib/plContainer/hsStringTable.cpp b/Sources/Plasma/PubUtilLib/plContainer/hsStringTable.cpp index 9ac2357a..586bd057 100644 --- a/Sources/Plasma/PubUtilLib/plContainer/hsStringTable.cpp +++ b/Sources/Plasma/PubUtilLib/plContainer/hsStringTable.cpp @@ -78,7 +78,7 @@ hsStringTable::Node* hsStringTable::Find(const char* str) // at the first point where a unique path can not be determined // char* str is filled out with the matching path // -hsStringTable::Node* hsStringTable::FindPartial(char* str, Int32 len) const +hsStringTable::Node* hsStringTable::FindPartial(char* str, int32_t len) const { return (str && *str) ? FindPartialRecur(root.kid, str, len) : nil; } @@ -135,7 +135,7 @@ hsStringTable::Node* hsStringTable::FindRecur(Node* root, const char* str, hsBoo // // Recursively find the unique partial match // -hsStringTable::Node* hsStringTable::FindPartialRecur(Node* root, char* str, Int32 len) const +hsStringTable::Node* hsStringTable::FindPartialRecur(Node* root, char* str, int32_t len) const { if (!root || !str) { @@ -169,7 +169,7 @@ hsStringTable::Node* hsStringTable::FindPartialRecur(Node* root, char* str, Int3 // // Follow the current node as far as possible towards a unique leaf // -hsStringTable::Node* hsStringTable::FindLeafRecur(Node* root, char* str, Int32 len) const +hsStringTable::Node* hsStringTable::FindLeafRecur(Node* root, char* str, int32_t len) const { if (root->data || !root->kid || root->kid->sib) { @@ -195,7 +195,7 @@ hsStringTable::Node* hsStringTable::FindLeafRecur(Node* root, char* str, Int32 l // hsStringTable::Node* hsStringTable::AddRecur(Node* root, const char* str) { - Node* node = TRACKED_NEW Node(*str); + Node* node = new Node(*str); node->sib = root->kid; root->kid = node; if (*(str+1)) return AddRecur(node,str+1); diff --git a/Sources/Plasma/PubUtilLib/plContainer/hsStringTable.h b/Sources/Plasma/PubUtilLib/plContainer/hsStringTable.h index a69cb93a..4d8bd0d2 100644 --- a/Sources/Plasma/PubUtilLib/plContainer/hsStringTable.h +++ b/Sources/Plasma/PubUtilLib/plContainer/hsStringTable.h @@ -66,16 +66,16 @@ public: ~hsStringTable(); void Reset(); Node* Find(const char* str); - Node* FindPartial(char* str, Int32 len=0) const; + Node* FindPartial(char* str, int32_t len=0) const; void Register(const char* str, void* data); typedef hsBool (hsStringTableCallback)(Node*); hsBool Iterate(hsStringTableCallback* callback, Node* fromNode=nil); private: Node* FindRecur(Node* root, const char* str, hsBool createIfNeeded=false); - Node* FindPartialRecur(Node* root, char* str, Int32 len) const; + Node* FindPartialRecur(Node* root, char* str, int32_t len) const; Node* AddRecur(Node* root, const char* str); - Node* FindLeafRecur(Node* root, char* str, Int32 len) const; + Node* FindLeafRecur(Node* root, char* str, int32_t len) const; void RemoveNode(Node* root); hsBool IterateRecur(Node* root, hsStringTableCallback* callback); diff --git a/Sources/Plasma/PubUtilLib/plContainer/plConfigInfo.cpp b/Sources/Plasma/PubUtilLib/plContainer/plConfigInfo.cpp index 01901b0a..849a7a0d 100644 --- a/Sources/Plasma/PubUtilLib/plContainer/plConfigInfo.cpp +++ b/Sources/Plasma/PubUtilLib/plContainer/plConfigInfo.cpp @@ -41,7 +41,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ #include "plConfigInfo.h" -#include "hsTypes.h" +#include "HeadSpin.h" #include "hsStlUtils.h" #include #include diff --git a/Sources/Plasma/PubUtilLib/plContainer/plContainer.h b/Sources/Plasma/PubUtilLib/plContainer/plContainer.h index 007c936a..c59ff697 100644 --- a/Sources/Plasma/PubUtilLib/plContainer/plContainer.h +++ b/Sources/Plasma/PubUtilLib/plContainer/plContainer.h @@ -42,27 +42,27 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #ifndef plContainer_h_inc #define plContainer_h_inc -#include "hsTypes.h" +#include "HeadSpin.h" #include "hsStlUtils.h" template < class T > class plDataContainerT { - typedef std::map Items; + typedef std::map Items; Items fItems; - UInt32 fNextKey; + uint32_t fNextKey; public: plDataContainerT() : fNextKey( 1 ) {} - UInt32 Add( T* data ) + uint32_t Add( T* data ) { - UInt32 key = fNextKey; + uint32_t key = fNextKey; fItems[ key ] = data; fNextKey++; return key; } - bool Get( UInt32 key, T*& outItem, bool remove=true ) + bool Get( uint32_t key, T*& outItem, bool remove=true ) { outItem = nil; Items::iterator ii = fItems.find( key ); diff --git a/Sources/Plasma/PubUtilLib/plContainer/plKeysAndValues.cpp b/Sources/Plasma/PubUtilLib/plContainer/plKeysAndValues.cpp index 6be46c26..4335acca 100644 --- a/Sources/Plasma/PubUtilLib/plContainer/plKeysAndValues.cpp +++ b/Sources/Plasma/PubUtilLib/plContainer/plKeysAndValues.cpp @@ -174,7 +174,7 @@ std::string plKeysAndValues::GetValue(const std::string & key, const std::string return defval; } -UInt32 plKeysAndValues::GetValue(const std::string & key, UInt32 defval, bool * outFound) const +uint32_t plKeysAndValues::GetValue(const std::string & key, uint32_t defval, bool * outFound) const { char buf[20]; sprintf(buf, "%ul", defval); @@ -229,17 +229,17 @@ bool plKeysAndValues::GetValueIterators(const xtl::istring & key, Values::const_ void plKeysAndValues::Read(hsStream * s) { - UInt16 nkeys; + uint16_t nkeys; s->ReadLE(&nkeys); for (int ki=0; kiReadLE(&strlen); std::string key; key.assign(strlen+1,'\0'); s->Read(strlen,(void*)key.data()); key.resize(strlen); - UInt16 nvalues; + uint16_t nvalues; s->ReadLE(&nvalues); for (int vi=0; viWriteLE((UInt16)fKeys.size()); + s->WriteLE((uint16_t)fKeys.size()); // iterate through keys Keys::const_iterator ki,ke; GetKeyIterators(ki,ke); for (;ki!=ke;++ki) { // write key string - s->WriteLE((UInt16)ki->first.size()); + s->WriteLE((uint16_t)ki->first.size()); s->Write(ki->first.size(),ki->first.c_str()); // write nvalues for this key - s->WriteLE((UInt16)ki->second.size()); + s->WriteLE((uint16_t)ki->second.size()); // iterate through values for this key Values::const_iterator vi,ve; GetValueIterators(ki->first,vi,ve); for (;vi!=ve;++vi) { // write value string - s->WriteLE((UInt16)vi->size()); + s->WriteLE((uint16_t)vi->size()); s->Write(vi->size(),vi->c_str()); } } diff --git a/Sources/Plasma/PubUtilLib/plContainer/plKeysAndValues.h b/Sources/Plasma/PubUtilLib/plContainer/plKeysAndValues.h index 29133ffb..c35546f2 100644 --- a/Sources/Plasma/PubUtilLib/plContainer/plKeysAndValues.h +++ b/Sources/Plasma/PubUtilLib/plContainer/plKeysAndValues.h @@ -42,8 +42,8 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #ifndef plKeysAndValues_h_inc #define plKeysAndValues_h_inc -#include "hsConfig.h" -#include "hsUtils.h" +#include "HeadSpin.h" + #include "hsStlUtils.h" #include "hsStream.h" @@ -96,7 +96,7 @@ public: bool SetValue(const std::string & key, double value); // get single value std::string GetValue(const std::string & key, const std::string & defval="", bool * outFound=nil) const; - UInt32 GetValue(const std::string & key, UInt32 defval, bool * outFound=nil) const; + uint32_t GetValue(const std::string & key, uint32_t defval, bool * outFound=nil) const; int GetValue(const std::string & key, int defval, bool * outFound=nil) const; double GetValue(const std::string & key, double defval, bool * outFound=nil) const; std::vector GetAllValues(const std::string & key); @@ -108,7 +108,7 @@ public: void Read(hsStream * s); void Write(hsStream * s); // TODO: - UInt32 GetStreamSize() { return 0;} + uint32_t GetStreamSize() { return 0;} }; diff --git a/Sources/Plasma/PubUtilLib/plDeviceSelector/plDeviceSelector.cpp b/Sources/Plasma/PubUtilLib/plDeviceSelector/plDeviceSelector.cpp index 591852fa..1bd6e2aa 100644 --- a/Sources/Plasma/PubUtilLib/plDeviceSelector/plDeviceSelector.cpp +++ b/Sources/Plasma/PubUtilLib/plDeviceSelector/plDeviceSelector.cpp @@ -39,7 +39,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com Mead, WA 99021 *==LICENSE==*/ -#include "hsTypes.h" + #include "plDeviceSelector.h" #include "hsStream.h" #include "hsUtils.h" @@ -80,7 +80,7 @@ hsBool DeviceSelector::Enumerate(HWND hWnd, hsBool expertMode ) // Sort the modes hsTArray &recs = fSelector.GetDeviceRecords(); - for (Int32 i = 0; i < recs.Count(); i++) + for (int32_t i = 0; i < recs.Count(); i++) { hsTArray &modes = recs[i].GetModes(); std::sort(modes.FirstIter(), modes.StopIter()); @@ -163,11 +163,11 @@ int DeviceSelector::IFindFiltered( int realIndex ) return idx; } -hsBool DeviceSelector::CheckDeviceType(UInt32 type) +hsBool DeviceSelector::CheckDeviceType(uint32_t type) { hsTArray& records = fSelector.GetDeviceRecords(); - for (Int32 i = 0; i < records.Count(); i++) + for (int32_t i = 0; i < records.Count(); i++) { if (type == records[i].GetG3DDeviceType()) return true; @@ -216,9 +216,9 @@ void DeviceSelector::SetOpenGL() SetDeviceType(hsG3DDeviceSelector::kDevTypeOpenGL); } -void DeviceSelector::SetDeviceType (UInt32 type) +void DeviceSelector::SetDeviceType (uint32_t type) { - Int32 i; + int32_t i; for(i = 0; i < fRecords.GetCount(); i++) fRecords[i].Clear(); fRecords.Reset(); @@ -267,7 +267,7 @@ hsBool DeviceSelector::IsOpenGL() return false; } -hsBool DeviceSelector::SetDevice(UInt32 index) +hsBool DeviceSelector::SetDevice(uint32_t index) { if (index < fRecords.Count()) { @@ -283,7 +283,7 @@ hsBool DeviceSelector::SetDevice(UInt32 index) return false; } -hsBool DeviceSelector::SetMode(UInt32 index) +hsBool DeviceSelector::SetMode(uint32_t index) { if (fSelDev >= fRecords.Count()) return false; @@ -332,12 +332,12 @@ char* DeviceSelector::GetModeDescription( void ) return fStr; } -UInt32 DeviceSelector::GetNumModes() +uint32_t DeviceSelector::GetNumModes() { return fFilteredModes.GetCount(); } -void DeviceSelector::GetMode(UInt32 i, int& width, int& height, int& depth) +void DeviceSelector::GetMode(uint32_t i, int& width, int& height, int& depth) { if (i >= fFilteredModes.GetCount()) return; @@ -515,38 +515,38 @@ int DeviceSelector::GetModeNum(const hsG3DDeviceMode *pLoadMode) return -1; } -UInt8 DeviceSelector::CanAntiAlias() +uint8_t DeviceSelector::CanAntiAlias() { hsG3DDeviceMode *mode = fRecords[ fSelDev ].GetMode( fFilteredModes[ fSelMode ] ); return mode->GetNumFSAATypes(); } -UInt8 DeviceSelector::IsAntiAliased() +uint8_t DeviceSelector::IsAntiAliased() { return fSelRec.GetAASetting(); } -void DeviceSelector::SetAntiAlias(UInt8 numSamples) +void DeviceSelector::SetAntiAlias(uint8_t numSamples) { fSelRec.SetAASetting( numSamples ); } -UInt8 DeviceSelector::CanAnisotropicFilter() +uint8_t DeviceSelector::CanAnisotropicFilter() { - UInt8 hi = fRecords[ fSelDev ].GetMaxAnisotropicSamples(); + uint8_t hi = fRecords[ fSelDev ].GetMaxAnisotropicSamples(); if( hi > 1 ) return hi; return 0; } -UInt8 DeviceSelector::GetAnisotropicLevel() +uint8_t DeviceSelector::GetAnisotropicLevel() { return fSelRec.GetMaxAnisotropicSamples(); } -void DeviceSelector::SetAnisotropicLevel( UInt8 level ) +void DeviceSelector::SetAnisotropicLevel( uint8_t level ) { fSelRec.SetMaxAnisotropicSamples( level ); } @@ -581,7 +581,7 @@ void DeviceSelector::SetCompressed(hsBool state) fSelRec.SetCap(hsG3DDeviceSelector::kCapsCompressTextures, state); } -bool DeviceSelector::GetCap(UInt32 cap) +bool DeviceSelector::GetCap(uint32_t cap) { return fSelRec.GetCap(cap) != 0; } diff --git a/Sources/Plasma/PubUtilLib/plDeviceSelector/plDeviceSelector.h b/Sources/Plasma/PubUtilLib/plDeviceSelector/plDeviceSelector.h index f1a2173b..d88242c3 100644 --- a/Sources/Plasma/PubUtilLib/plDeviceSelector/plDeviceSelector.h +++ b/Sources/Plasma/PubUtilLib/plDeviceSelector/plDeviceSelector.h @@ -42,7 +42,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #ifndef DEVICESELECTOR_H #define DEVICESELECTOR_H -#include "hsTypes.h" +#include "HeadSpin.h" //#include "plRender.h" #include "../../PubUtilLib/plPipeline/hsG3DDeviceSelector.h" @@ -55,16 +55,16 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com class DeviceSelector { protected: - UInt32 fSelDevType; // Current type of driver. Set by the SetDirect3D/Glide/OpenGL functions - UInt32 fSelDev; // Index of selected device. Set by SetDevice() or - UInt32 fSelMode; // Index of selected mode for current device + uint32_t fSelDevType; // Current type of driver. Set by the SetDirect3D/Glide/OpenGL functions + uint32_t fSelDev; // Index of selected device. Set by SetDevice() or + uint32_t fSelMode; // Index of selected mode for current device int fDevDesc; // Used by GetDeviceDescription() to store index of current device int fModeDesc; // Used by GetModeDescription() to store index of current mode char fStr[1024]; // Used to return text - UInt16 fPerformance; // Performance level (0-100) + uint16_t fPerformance; // Performance level (0-100) int fFilterBPP, fFilterWidth, fFilterHeight; @@ -105,32 +105,32 @@ public: hsBool IsOpenGL(); // Gets and sets the current device or mode. - UInt32 GetSelectedDevice() { return fSelDev; } - UInt32 GetSelectedMode() { return fSelMode; } - hsBool SetDevice(UInt32 index); - hsBool SetMode(UInt32 index); + uint32_t GetSelectedDevice() { return fSelDev; } + uint32_t GetSelectedMode() { return fSelMode; } + hsBool SetDevice(uint32_t index); + hsBool SetMode(uint32_t index); // Returns the device or mode descriptions. Call repeatedly until nil is returned. char* GetDeviceDescription(); char* GetModeDescription( void ); - UInt32 GetNumModes(); - void GetMode(UInt32 i, int& width, int& height, int& depth); + uint32_t GetNumModes(); + void GetMode(uint32_t i, int& width, int& height, int& depth); void SetModeFilter( int bitDepth = 0, int minWidth = 0, int minHeight = 0 ); - void SetPerformance (UInt16 value) { fPerformance = value; } - UInt16 GetPerformance () { return fPerformance; } + void SetPerformance (uint16_t value) { fPerformance = value; } + uint16_t GetPerformance () { return fPerformance; } // Returns max number of samples allowed for AA - UInt8 CanAntiAlias (); + uint8_t CanAntiAlias (); // Returns current # of samples selected for AA, 0 if none - UInt8 IsAntiAliased (); - void SetAntiAlias (UInt8 numSamples); + uint8_t IsAntiAliased (); + void SetAntiAlias (uint8_t numSamples); - UInt8 CanAnisotropicFilter(); - UInt8 GetAnisotropicLevel(); - void SetAnisotropicLevel( UInt8 level ); + uint8_t CanAnisotropicFilter(); + uint8_t GetAnisotropicLevel(); + void SetAnisotropicLevel( uint8_t level ); bool CanWindow(); bool IsWindowed(); @@ -141,7 +141,7 @@ public: void SetCompressed (hsBool state); // Caps from hsG3DDeviceSelector - bool GetCap(UInt32 cap); + bool GetCap(uint32_t cap); // Save and load hsBool Save(); // Returns false if output file can't be opened @@ -149,8 +149,8 @@ public: hsBool SetDefault(); // Returns false if no suitable renderers are found protected: - hsBool CheckDeviceType(UInt32 type); // Used by the Is*Available() functions - void SetDeviceType(UInt32 type); // Used by SetDirect3D/Glide/OpenGL + hsBool CheckDeviceType(uint32_t type); // Used by the Is*Available() functions + void SetDeviceType(uint32_t type); // Used by SetDirect3D/Glide/OpenGL // Helpers for LoadDeviceMode() int GetDeviceNum(const hsG3DDeviceRecord *pLoadRec); // Returns index of passed in device diff --git a/Sources/Plasma/PubUtilLib/plDrawable/plAccMeshSmooth.cpp b/Sources/Plasma/PubUtilLib/plDrawable/plAccMeshSmooth.cpp index 76fade65..ac96e9bb 100644 --- a/Sources/Plasma/PubUtilLib/plDrawable/plAccMeshSmooth.cpp +++ b/Sources/Plasma/PubUtilLib/plDrawable/plAccMeshSmooth.cpp @@ -40,7 +40,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "plAccMeshSmooth.h" #include "plGeometrySpan.h" @@ -52,15 +52,15 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com class EdgeBin { public: - UInt16 fVtx; - UInt16 fCount; + uint16_t fVtx; + uint16_t fCount; EdgeBin() : fVtx(0), fCount(0) {} }; -void plAccMeshSmooth::FindEdges(UInt32 maxVtxIdx, UInt32 nTris, UInt16* idxList, hsTArray& edgeVerts) +void plAccMeshSmooth::FindEdges(uint32_t maxVtxIdx, uint32_t nTris, uint16_t* idxList, hsTArray& edgeVerts) { - hsTArray* bins = TRACKED_NEW hsTArray[maxVtxIdx+1]; + hsTArray* bins = new hsTArray[maxVtxIdx+1]; hsBitVector edgeVertBits; // For each vert pair (edge) in idxList @@ -138,7 +138,7 @@ void plAccMeshSmooth::FindEdges(UInt32 maxVtxIdx, UInt32 nTris, UInt16* idxList, delete [] bins; } -void plAccMeshSmooth::FindEdges(hsTArray& spans, hsTArray* edgeVerts) +void plAccMeshSmooth::FindEdges(hsTArray& spans, hsTArray* edgeVerts) { fSpans.SetCount(spans.GetCount()); @@ -151,9 +151,9 @@ void plAccMeshSmooth::FindEdges(hsTArray& spans, hsTArray& spans, hsTArray& spans) { - hsTArray* shareVtx = TRACKED_NEW hsTArray[spans.GetCount()]; - hsTArray* edgeVerts = TRACKED_NEW hsTArray[spans.GetCount()]; + hsTArray* shareVtx = new hsTArray[spans.GetCount()]; + hsTArray* edgeVerts = new hsTArray[spans.GetCount()]; FindEdges(spans, edgeVerts); int i; @@ -278,7 +278,7 @@ hsVector3 plAccMeshSmooth::INormalToLocal(plAccessSpan& span, const hsVector3& w return ret; } -void plAccMeshSmooth::FindSharedVerts(plAccessSpan& span, int numEdgeVerts, hsTArray& edgeVerts, hsTArray& shareVtx, VtxAccum& accum) +void plAccMeshSmooth::FindSharedVerts(plAccessSpan& span, int numEdgeVerts, hsTArray& edgeVerts, hsTArray& shareVtx, VtxAccum& accum) { plAccessTriSpan& triSpan = span.AccessTri(); int i; @@ -311,7 +311,7 @@ void plAccMeshSmooth::FindSharedVerts(plAccessSpan& span, int numEdgeVerts, hsTA } } -void plAccMeshSmooth::SetPositions(plAccessSpan& span, hsTArray& shareVtx, const hsPoint3& pos) const +void plAccMeshSmooth::SetPositions(plAccessSpan& span, hsTArray& shareVtx, const hsPoint3& pos) const { plAccessTriSpan& triSpan = span.AccessTri(); int i; @@ -319,7 +319,7 @@ void plAccMeshSmooth::SetPositions(plAccessSpan& span, hsTArray& shareVt triSpan.Position(shareVtx[i]) = IPositionToLocal(span, pos); } -void plAccMeshSmooth::SetNormals(plAccessSpan& span, hsTArray& shareVtx, const hsVector3& norm) const +void plAccMeshSmooth::SetNormals(plAccessSpan& span, hsTArray& shareVtx, const hsVector3& norm) const { plAccessTriSpan& triSpan = span.AccessTri(); int i; @@ -327,7 +327,7 @@ void plAccMeshSmooth::SetNormals(plAccessSpan& span, hsTArray& shareVtx, triSpan.Normal(shareVtx[i]) = INormalToLocal(span, norm); } -void plAccMeshSmooth::SetDiffuse(plAccessSpan& span, hsTArray& shareVtx, const hsColorRGBA& diff) const +void plAccMeshSmooth::SetDiffuse(plAccessSpan& span, hsTArray& shareVtx, const hsColorRGBA& diff) const { plAccessTriSpan& triSpan = span.AccessTri(); hsAssert(triSpan.HasDiffuse(), "Calling SetColors on data with no color"); @@ -336,22 +336,22 @@ void plAccMeshSmooth::SetDiffuse(plAccessSpan& span, hsTArray& shareVtx, triSpan.Diffuse32(shareVtx[i]) = diff.ToARGB32(); } -void plAccMeshSmooth::SetAngle(hsScalar degs) +void plAccMeshSmooth::SetAngle(float degs) { - fMinNormDot = hsCosine(hsScalarDegToRad(degs)); + fMinNormDot = cos(hsDegreesToRadians(degs)); } -hsScalar plAccMeshSmooth::GetAngle() const +float plAccMeshSmooth::GetAngle() const { - return hsScalarRadToDeg(hsACosine(fMinNormDot)); + return hsRadiansToDegrees(acos(fMinNormDot)); } -void plAccMeshSmooth::SetDistTol(hsScalar dist) +void plAccMeshSmooth::SetDistTol(float dist) { fDistTolSq = dist * dist; } -hsScalar plAccMeshSmooth::GetDistTol() const +float plAccMeshSmooth::GetDistTol() const { - return hsSquareRoot(fDistTolSq); -} \ No newline at end of file + return sqrt(fDistTolSq); +} diff --git a/Sources/Plasma/PubUtilLib/plDrawable/plAccMeshSmooth.h b/Sources/Plasma/PubUtilLib/plDrawable/plAccMeshSmooth.h index dd056946..1ee60da0 100644 --- a/Sources/Plasma/PubUtilLib/plDrawable/plAccMeshSmooth.h +++ b/Sources/Plasma/PubUtilLib/plDrawable/plAccMeshSmooth.h @@ -69,10 +69,10 @@ protected: hsColorRGBA fDiffuse; }; - UInt32 fFlags; + uint32_t fFlags; - hsScalar fMinNormDot; - hsScalar fDistTolSq; + float fMinNormDot; + float fDistTolSq; plAccessGeometry fAccGeom; hsTArray fSpans; @@ -82,26 +82,26 @@ protected: hsPoint3 IPositionToLocal(plAccessSpan& span, const hsPoint3& wPos) const; hsVector3 INormalToLocal(plAccessSpan& span, const hsVector3& wNorm) const; - void FindEdges(UInt32 maxVtxIdx, UInt32 nTris, UInt16* idxList, hsTArray& edgeVerts); - void FindEdges(hsTArray& sets, hsTArray* edgeVerts); - void FindSharedVerts(plAccessSpan& span, int numEdgeVerts, hsTArray& edgeVerts, hsTArray& shareVtx, VtxAccum& accum); - void SetNormals(plAccessSpan& span, hsTArray& shareVtx, const hsVector3& norm) const; - void SetPositions(plAccessSpan& span, hsTArray& shareVtx, const hsPoint3& pos) const; - void SetDiffuse(plAccessSpan& span, hsTArray& shareVtx, const hsColorRGBA& diff) const; + void FindEdges(uint32_t maxVtxIdx, uint32_t nTris, uint16_t* idxList, hsTArray& edgeVerts); + void FindEdges(hsTArray& sets, hsTArray* edgeVerts); + void FindSharedVerts(plAccessSpan& span, int numEdgeVerts, hsTArray& edgeVerts, hsTArray& shareVtx, VtxAccum& accum); + void SetNormals(plAccessSpan& span, hsTArray& shareVtx, const hsVector3& norm) const; + void SetPositions(plAccessSpan& span, hsTArray& shareVtx, const hsPoint3& pos) const; + void SetDiffuse(plAccessSpan& span, hsTArray& shareVtx, const hsColorRGBA& diff) const; public: plAccMeshSmooth() : fFlags(kSmoothNorm), fMinNormDot(0.25f), fDistTolSq(1.e-4f), fAccGeom() {} - void SetAngle(hsScalar degs); - hsScalar GetAngle() const; // returns degrees + void SetAngle(float degs); + float GetAngle() const; // returns degrees - void SetDistTol(hsScalar dist); - hsScalar GetDistTol() const; + void SetDistTol(float dist); + float GetDistTol() const; void Smooth(hsTArray& sets); - void SetFlags(UInt32 f) { fFlags = f; } - UInt32 GetFlags() const { return fFlags; } + void SetFlags(uint32_t f) { fFlags = f; } + uint32_t GetFlags() const { return fFlags; } }; #endif // plAccMeshSmooth_inc diff --git a/Sources/Plasma/PubUtilLib/plDrawable/plAccessGeometry.cpp b/Sources/Plasma/PubUtilLib/plDrawable/plAccessGeometry.cpp index d3bb5185..22eb711b 100644 --- a/Sources/Plasma/PubUtilLib/plDrawable/plAccessGeometry.cpp +++ b/Sources/Plasma/PubUtilLib/plDrawable/plAccessGeometry.cpp @@ -41,7 +41,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "plAccessGeometry.h" @@ -104,7 +104,7 @@ void plAccessGeometry::Init(plPipeline* pipe) { plAccessGeometry* oldAcc = fInstance; - fInstance = NEW(plAccessGeometry)(pipe); + fInstance = new plAccessGeometry(pipe); hsRefCnt_SafeUnRef(oldAcc); } @@ -194,7 +194,7 @@ void plAccessGeometry::Close(hsTArray& accs) const Close(accs[i]); } -void plAccessGeometry::TakeSnapShot(const plDrawInterface* di, UInt32 channels) const +void plAccessGeometry::TakeSnapShot(const plDrawInterface* di, uint32_t channels) const { int j; for( j = 0; j < di->GetNumDrawables(); j++ ) @@ -216,7 +216,7 @@ void plAccessGeometry::TakeSnapShot(const plDrawInterface* di, UInt32 channels) } } -void plAccessGeometry::RestoreSnapShot(const plDrawInterface* di, UInt32 channels) const +void plAccessGeometry::RestoreSnapShot(const plDrawInterface* di, uint32_t channels) const { int j; for( j = 0; j < di->GetNumDrawables(); j++ ) @@ -271,7 +271,7 @@ void plAccessGeometry::Close(plAccessSpan& acc) const fPipe->CloseAccess(acc); } -void plAccessGeometry::IOpen(plDrawable* d, UInt32 spanIdx, plAccessSpan& acc, hsBool useSnap, hsBool readOnly, hsBool idxToo) const +void plAccessGeometry::IOpen(plDrawable* d, uint32_t spanIdx, plAccessSpan& acc, hsBool useSnap, hsBool readOnly, hsBool idxToo) const { acc.SetType(plAccessSpan::kUndefined); @@ -304,12 +304,12 @@ void plAccessGeometry::IOpen(plDrawable* d, UInt32 spanIdx, plAccessSpan& acc, h } } -void plAccessGeometry::OpenRO(plDrawable* d, UInt32 spanIdx, plAccessSpan& acc, hsBool useSnap) const +void plAccessGeometry::OpenRO(plDrawable* d, uint32_t spanIdx, plAccessSpan& acc, hsBool useSnap) const { IOpen(d, spanIdx, acc, useSnap, true); } -void plAccessGeometry::OpenRW(plDrawable* drawable, UInt32 spanIdx, plAccessSpan& acc, hsBool idxToo) const +void plAccessGeometry::OpenRW(plDrawable* drawable, uint32_t spanIdx, plAccessSpan& acc, hsBool idxToo) const { IOpen(drawable, spanIdx, acc, false, false, idxToo); @@ -318,7 +318,7 @@ void plAccessGeometry::OpenRW(plDrawable* drawable, UInt32 spanIdx, plAccessSpan ////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////// -void plAccessGeometry::TakeSnapShot(plDrawable* drawable, UInt32 spanIdx, UInt32 channels) const +void plAccessGeometry::TakeSnapShot(plDrawable* drawable, uint32_t spanIdx, uint32_t channels) const { plDrawableSpans* ds = plDrawableSpans::ConvertNoRef(drawable); if( !ds ) @@ -326,7 +326,7 @@ void plAccessGeometry::TakeSnapShot(plDrawable* drawable, UInt32 spanIdx, UInt32 const plSpan* span = ds->GetSpan(spanIdx); if( !span->fSnapShot ) - span->fSnapShot = NEW(plAccessSnapShot); + span->fSnapShot = new plAccessSnapShot; plAccessSpan tmp; OpenRO(drawable, spanIdx, tmp, false); @@ -338,7 +338,7 @@ void plAccessGeometry::TakeSnapShot(plDrawable* drawable, UInt32 spanIdx, UInt32 } } -void plAccessGeometry::RestoreSnapShot(plDrawable* drawable, UInt32 spanIdx, UInt32 channels) const +void plAccessGeometry::RestoreSnapShot(plDrawable* drawable, uint32_t spanIdx, uint32_t channels) const { plDrawableSpans* ds = plDrawableSpans::ConvertNoRef(drawable); if( !ds ) @@ -355,7 +355,7 @@ void plAccessGeometry::RestoreSnapShot(plDrawable* drawable, UInt32 spanIdx, UIn span->fSnapShot->CopyTo(tmp.AccessVtx(), channels); } -void plAccessGeometry::ReleaseSnapShot(plDrawable* drawable, UInt32 spanIdx) const +void plAccessGeometry::ReleaseSnapShot(plDrawable* drawable, uint32_t spanIdx) const { plDrawableSpans* ds = plDrawableSpans::ConvertNoRef(drawable); if( !ds ) @@ -384,16 +384,16 @@ void plAccessGeometry::IAccessSpanFromSourceSpan(plAccessSpan& dst, const plGeom dst.SetMaterial(src->fMaterial); plAccessVtxSpan& acc = dst.AccessVtx(); - acc.fNumVerts = (UInt16)(src->fNumVerts); - UInt32 sz = src->GetVertexSize(src->fFormat); - UInt8* ptr = src->fVertexData; - acc.PositionStream(ptr, (UInt16)sz, 0); + acc.fNumVerts = (uint16_t)(src->fNumVerts); + uint32_t sz = src->GetVertexSize(src->fFormat); + uint8_t* ptr = src->fVertexData; + acc.PositionStream(ptr, (uint16_t)sz, 0); ptr += sizeof(hsPoint3); - acc.NormalStream(ptr, (UInt16)sz, 0); + acc.NormalStream(ptr, (uint16_t)sz, 0); ptr += sizeof(hsVector3); - acc.DiffuseStream(src->fDiffuseRGBA, sizeof(UInt32), 0); - acc.SpecularStream(src->fSpecularRGBA, sizeof(UInt32), 0); - acc.UVWStream(ptr, (UInt16)sz, 0); + acc.DiffuseStream(src->fDiffuseRGBA, sizeof(uint32_t), 0); + acc.SpecularStream(src->fSpecularRGBA, sizeof(uint32_t), 0); + acc.UVWStream(ptr, (uint16_t)sz, 0); acc.SetNumUVWs(src->CalcNumUVs(src->fFormat)); acc.fVtxDeviceRef = nil; @@ -446,33 +446,33 @@ void plAccessGeometry::IAccessSpanFromVertexSpan(plAccessSpan& dst, plDrawableSp return; } - acc.fNumVerts = (UInt16)(span->fVLength); + acc.fNumVerts = (uint16_t)(span->fVLength); plGBufferCell* cell = grp->GetCell(span->fVBufferIdx, span->fCellIdx); - UInt8* ptr = grp->GetVertBufferData(span->fVBufferIdx); + uint8_t* ptr = grp->GetVertBufferData(span->fVBufferIdx); // Interleaved - if( cell->fColorStart == UInt32(-1) ) + if( cell->fColorStart == uint32_t(-1) ) { - UInt32 stride = grp->GetVertexSize(); + uint32_t stride = grp->GetVertexSize(); ptr += cell->fVtxStart + span->fCellOffset * stride; - Int32 offset = (-(Int32)(span->fVStartIdx)) * (Int32)stride; + int32_t offset = (-(int32_t)(span->fVStartIdx)) * (int32_t)stride; - acc.PositionStream(ptr, (UInt16)stride, offset); + acc.PositionStream(ptr, (uint16_t)stride, offset); ptr += sizeof(hsPoint3); int numWgts = grp->GetNumWeights(); if( numWgts ) { acc.SetNumWeights(numWgts); - acc.WeightStream(ptr, (UInt16)stride, offset); - ptr += numWgts * sizeof(hsScalar); + acc.WeightStream(ptr, (uint16_t)stride, offset); + ptr += numWgts * sizeof(float); if( grp->GetVertexFormat() & plGBufferGroup::kSkinIndices ) { - acc.WgtIndexStream(ptr, (UInt16)stride, offset); - ptr += sizeof(UInt32); + acc.WgtIndexStream(ptr, (uint16_t)stride, offset); + ptr += sizeof(uint32_t); } else { @@ -484,40 +484,40 @@ void plAccessGeometry::IAccessSpanFromVertexSpan(plAccessSpan& dst, plDrawableSp acc.SetNumWeights(0); } - acc.NormalStream(ptr, (UInt16)stride, offset); + acc.NormalStream(ptr, (uint16_t)stride, offset); ptr += sizeof(hsVector3); - acc.DiffuseStream(ptr, (UInt16)stride, offset); - ptr += sizeof(UInt32); + acc.DiffuseStream(ptr, (uint16_t)stride, offset); + ptr += sizeof(uint32_t); - acc.SpecularStream(ptr, (UInt16)stride, offset); - ptr += sizeof(UInt32); + acc.SpecularStream(ptr, (uint16_t)stride, offset); + ptr += sizeof(uint32_t); - acc.UVWStream(ptr, (UInt16)stride, offset); + acc.UVWStream(ptr, (uint16_t)stride, offset); acc.SetNumUVWs(grp->GetNumUVs()); } else { - UInt32 stride = grp->GetVertexLiteStride(); + uint32_t stride = grp->GetVertexLiteStride(); ptr += cell->fVtxStart + span->fCellOffset * stride; - Int32 posOffset = (-(Int32)(span->fVStartIdx)) * (Int32)stride; + int32_t posOffset = (-(int32_t)(span->fVStartIdx)) * (int32_t)stride; - acc.PositionStream(ptr, (UInt16)stride, posOffset); + acc.PositionStream(ptr, (uint16_t)stride, posOffset); ptr += sizeof(hsPoint3); int numWgts = grp->GetNumWeights(); if( numWgts ) { acc.SetNumWeights(numWgts); - acc.WeightStream(ptr, (UInt16)stride, posOffset); - ptr += numWgts * sizeof(hsScalar); + acc.WeightStream(ptr, (uint16_t)stride, posOffset); + ptr += numWgts * sizeof(float); if( grp->GetVertexFormat() & plGBufferGroup::kSkinIndices ) { - acc.WgtIndexStream(ptr, (UInt16)stride, posOffset); - ptr += sizeof(UInt32); + acc.WgtIndexStream(ptr, (uint16_t)stride, posOffset); + ptr += sizeof(uint32_t); } else { @@ -529,19 +529,19 @@ void plAccessGeometry::IAccessSpanFromVertexSpan(plAccessSpan& dst, plDrawableSp acc.SetNumWeights(0); } - acc.NormalStream(ptr, (UInt16)stride, posOffset); + acc.NormalStream(ptr, (uint16_t)stride, posOffset); ptr += sizeof(hsVector3); plGBufferColor* col = grp->GetColorBufferData(span->fVBufferIdx) + cell->fColorStart; - Int16 colOffset = (Int16)((-(Int32)(span->fVStartIdx)) * (Int32)stride); - colOffset = (Int16)((-(Int32)(span->fVStartIdx)) * sizeof(*col)); + int16_t colOffset = (int16_t)((-(int32_t)(span->fVStartIdx)) * (int32_t)stride); + colOffset = (int16_t)((-(int32_t)(span->fVStartIdx)) * sizeof(*col)); acc.DiffuseStream(&col->fDiffuse, sizeof(*col), colOffset); acc.SpecularStream(&col->fSpecular, sizeof(*col), colOffset); - acc.UVWStream(ptr, (UInt16)stride, posOffset); + acc.UVWStream(ptr, (uint16_t)stride, posOffset); acc.SetNumUVWs(grp->GetNumUVs()); } diff --git a/Sources/Plasma/PubUtilLib/plDrawable/plAccessGeometry.h b/Sources/Plasma/PubUtilLib/plDrawable/plAccessGeometry.h index b571c43d..3fd891a0 100644 --- a/Sources/Plasma/PubUtilLib/plDrawable/plAccessGeometry.h +++ b/Sources/Plasma/PubUtilLib/plDrawable/plAccessGeometry.h @@ -108,8 +108,8 @@ public: // then take the snapshot if you are going to be performing more modifications. // In ALL MODIFICATION CASES, if the modified data is paged out, and the original paged back in, you will // need to perform your operation again - your modifications aren't saved anywhere. - void OpenRO(plDrawable* drawable, UInt32 spanIdx, plAccessSpan& acc, hsBool useSnapShot=true) const; - void OpenRW(plDrawable* drawable, UInt32 spanIdx, plAccessSpan& acc, hsBool idxToo=false) const; + void OpenRO(plDrawable* drawable, uint32_t spanIdx, plAccessSpan& acc, hsBool useSnapShot=true) const; + void OpenRW(plDrawable* drawable, uint32_t spanIdx, plAccessSpan& acc, hsBool idxToo=false) const; // What do we need to close up here? void Close(plAccessSpan& acc) const; @@ -147,12 +147,12 @@ public: // the state when the snapshot was taken. Note that channels not SnapShotted might have been modified // via OpenRW. // - void TakeSnapShot(plDrawable* drawable, UInt32 spanIdx, UInt32 channels) const; - void RestoreSnapShot(plDrawable* drawable, UInt32 spanIdx, UInt32 channels) const; - void ReleaseSnapShot(plDrawable* drawable, UInt32 spanIdx) const; + void TakeSnapShot(plDrawable* drawable, uint32_t spanIdx, uint32_t channels) const; + void RestoreSnapShot(plDrawable* drawable, uint32_t spanIdx, uint32_t channels) const; + void ReleaseSnapShot(plDrawable* drawable, uint32_t spanIdx) const; - void TakeSnapShot(const plDrawInterface* di, UInt32 channels) const; - void RestoreSnapShot(const plDrawInterface* di, UInt32 channels) const; + void TakeSnapShot(const plDrawInterface* di, uint32_t channels) const; + void RestoreSnapShot(const plDrawInterface* di, uint32_t channels) const; void ReleaseSnapShot(const plDrawInterface* di) const; // We often have geometry spans just sitting around devoid of any DI's, drawables or sceneobjects. @@ -169,7 +169,7 @@ protected: void IAccessSpanFromParticle(plAccessSpan& dst, plDrawableSpans* drawable, const plParticleSpan* span, hsBool readOnly) const; void IAccessSpanFromSnap(plAccessSpan& dst, plDrawableSpans* drawable, const plSpan* src) const; - void IOpen(plDrawable* d, UInt32 spanIdx, plAccessSpan& acc, hsBool useSnap, hsBool readOnly, hsBool idxToo=true) const; + void IOpen(plDrawable* d, uint32_t spanIdx, plAccessSpan& acc, hsBool useSnap, hsBool readOnly, hsBool idxToo=true) const; }; #endif // plAccessGeometry_inc diff --git a/Sources/Plasma/PubUtilLib/plDrawable/plAccessSnapShot.cpp b/Sources/Plasma/PubUtilLib/plDrawable/plAccessSnapShot.cpp index 6aa58543..a86dcd5f 100644 --- a/Sources/Plasma/PubUtilLib/plDrawable/plAccessSnapShot.cpp +++ b/Sources/Plasma/PubUtilLib/plDrawable/plAccessSnapShot.cpp @@ -40,7 +40,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "plAccessSnapShot.h" #include "hsGeometry3.h" @@ -74,7 +74,7 @@ void plAccessSnapShot::Release() } } -UInt32 plAccessSnapShot::ICheckAlloc(const plAccessVtxSpan& src, UInt32 chanMask, UInt32 chan, UInt16 chanSize) +uint32_t plAccessSnapShot::ICheckAlloc(const plAccessVtxSpan& src, uint32_t chanMask, uint32_t chan, uint16_t chanSize) { if( ((1 << chan) & chanMask) && src.fStrides[chan] ) { @@ -98,16 +98,16 @@ UInt32 plAccessSnapShot::ICheckAlloc(const plAccessVtxSpan& src, UInt32 chanMask return chanMask; } -void plAccessSnapShot::IRecordSizes(UInt16 sizes[]) const +void plAccessSnapShot::IRecordSizes(uint16_t sizes[]) const { int chan; for( chan = 0; chan < kNumValidChans; chan++ ) sizes[chan] = fChanSize[chan]; } -UInt16 plAccessSnapShot::IComputeStride() const +uint16_t plAccessSnapShot::IComputeStride() const { - UInt16 stride = 0; + uint16_t stride = 0; int chan; for( chan = 0; chan < kNumValidChans; chan++ ) stride += fChanSize[chan]; @@ -115,12 +115,12 @@ UInt16 plAccessSnapShot::IComputeStride() const return stride; } -void plAccessSnapShot::ICopyOldData(UInt8* data, const UInt16* const oldSizes, UInt16 oldStride, UInt16 newStride) +void plAccessSnapShot::ICopyOldData(uint8_t* data, const uint16_t* const oldSizes, uint16_t oldStride, uint16_t newStride) { - UInt32 oldOffset = 0; - UInt32 newOffset = 0; - UInt8* srcChannels[kNumValidChans]; - UInt8* dstChannels[kNumValidChans]; + uint32_t oldOffset = 0; + uint32_t newOffset = 0; + uint8_t* srcChannels[kNumValidChans]; + uint8_t* dstChannels[kNumValidChans]; int chan; for( chan = 0; chan < kNumValidChans; chan++ ) { @@ -152,9 +152,9 @@ void plAccessSnapShot::ICopyOldData(UInt8* data, const UInt16* const oldSizes, U } } -void plAccessSnapShot::ISetupPointers(UInt16 newStride) +void plAccessSnapShot::ISetupPointers(uint16_t newStride) { - fData = TRACKED_NEW UInt8[fNumVerts * newStride]; + fData = new uint8_t[fNumVerts * newStride]; int size = 0; int chan; @@ -169,33 +169,33 @@ void plAccessSnapShot::ISetupPointers(UInt16 newStride) } } -UInt32 plAccessSnapShot::CopyFrom(const plAccessVtxSpan& src, UInt32 chanMask) +uint32_t plAccessSnapShot::CopyFrom(const plAccessVtxSpan& src, uint32_t chanMask) { hsAssert(!fNumVerts || (fNumVerts == src.fNumVerts), "Copying from a different sized span"); fNumVerts = src.fNumVerts; - UInt16 oldSize[kNumValidChans]; - UInt8* oldData = fData; + uint16_t oldSize[kNumValidChans]; + uint8_t* oldData = fData; IRecordSizes(oldSize); - UInt16 oldStride = IComputeStride(); + uint16_t oldStride = IComputeStride(); // First, allocate any storage we need. Kill any requested channels out of the // mask that we already have. chanMask = ICheckAlloc(src, chanMask, kPosition, sizeof(hsPoint3)); - chanMask = ICheckAlloc(src, chanMask, kWeight, sizeof(hsScalar) * src.fNumWeights); + chanMask = ICheckAlloc(src, chanMask, kWeight, sizeof(float) * src.fNumWeights); if( fChanSize[kWeight] ) fNumWeights = src.fNumWeights; - chanMask = ICheckAlloc(src, chanMask, kWgtIndex, sizeof(UInt32)); + chanMask = ICheckAlloc(src, chanMask, kWgtIndex, sizeof(uint32_t)); chanMask = ICheckAlloc(src, chanMask, kNormal, sizeof(hsVector3)); - chanMask = ICheckAlloc(src, chanMask, kDiffuse, sizeof(UInt32)); + chanMask = ICheckAlloc(src, chanMask, kDiffuse, sizeof(uint32_t)); - chanMask = ICheckAlloc(src, chanMask, kSpecular, sizeof(UInt32)); + chanMask = ICheckAlloc(src, chanMask, kSpecular, sizeof(uint32_t)); chanMask = ICheckAlloc(src, chanMask, kUVW, sizeof(hsPoint3) * src.fNumUVWsPerVert); if( fChanSize[kUVW] ) @@ -206,14 +206,14 @@ UInt32 plAccessSnapShot::CopyFrom(const plAccessVtxSpan& src, UInt32 chanMask) if( !chanMask ) return 0; - UInt16 newStride = IComputeStride(); + uint16_t newStride = IComputeStride(); ISetupPointers(newStride); ICopyOldData(oldData, oldSize, oldStride, newStride); - UInt8* srcChannels[kNumValidChans]; - UInt8* dstChannels[kNumValidChans]; + uint8_t* srcChannels[kNumValidChans]; + uint8_t* dstChannels[kNumValidChans]; int chan; for( chan = 0; chan < kNumValidChans; chan++ ) { @@ -238,7 +238,7 @@ UInt32 plAccessSnapShot::CopyFrom(const plAccessVtxSpan& src, UInt32 chanMask) return chanMask; } -UInt32 plAccessSnapShot::CopyTo(const plAccessVtxSpan& dst, UInt32 chanMask) +uint32_t plAccessSnapShot::CopyTo(const plAccessVtxSpan& dst, uint32_t chanMask) { hsAssert(fNumVerts == dst.fNumVerts, "Vertex count mismatch, is this our real source?"); diff --git a/Sources/Plasma/PubUtilLib/plDrawable/plAccessSnapShot.h b/Sources/Plasma/PubUtilLib/plDrawable/plAccessSnapShot.h index ce83d6d2..2b8f8d37 100644 --- a/Sources/Plasma/PubUtilLib/plDrawable/plAccessSnapShot.h +++ b/Sources/Plasma/PubUtilLib/plDrawable/plAccessSnapShot.h @@ -55,23 +55,23 @@ public: protected: - UInt16 fRefCnt; + uint16_t fRefCnt; - UInt8* fData; + uint8_t* fData; - UInt16 fChanSize[kNumValidChans]; + uint16_t fChanSize[kNumValidChans]; - void ICopyOldData(UInt8* data, const UInt16* const oldSizes, UInt16 oldStride, UInt16 newStride); - UInt16 IComputeStride() const; - void IRecordSizes(UInt16 sizes[]) const; - UInt32 ICheckAlloc(const plAccessVtxSpan& src, UInt32 chanMask, UInt32 chan, UInt16 chanSize); + void ICopyOldData(uint8_t* data, const uint16_t* const oldSizes, uint16_t oldStride, uint16_t newStride); + uint16_t IComputeStride() const; + void IRecordSizes(uint16_t sizes[]) const; + uint32_t ICheckAlloc(const plAccessVtxSpan& src, uint32_t chanMask, uint32_t chan, uint16_t chanSize); - void ISetupPointers(UInt16 newStride); + void ISetupPointers(uint16_t newStride); void SetupChannels(plAccessVtxSpan& dst) const; - UInt32 CopyTo(const plAccessVtxSpan& dst, UInt32 chanMask); - UInt32 CopyFrom(const plAccessVtxSpan& src, UInt32 chanMask); + uint32_t CopyTo(const plAccessVtxSpan& dst, uint32_t chanMask); + uint32_t CopyFrom(const plAccessVtxSpan& src, uint32_t chanMask); void Release(); // Decrements refcnt, calls Destroy on zero void Clear(); // Initialize to zeros diff --git a/Sources/Plasma/PubUtilLib/plDrawable/plAccessSpan.h b/Sources/Plasma/PubUtilLib/plDrawable/plAccessSpan.h index 7244d635..1265b10a 100644 --- a/Sources/Plasma/PubUtilLib/plDrawable/plAccessSpan.h +++ b/Sources/Plasma/PubUtilLib/plDrawable/plAccessSpan.h @@ -80,7 +80,7 @@ private: hsBounds3Ext* fLocalBounds; hsBounds3Ext* fWorldBounds; - hsScalar* fWaterHeight; + float* fWaterHeight; hsGMaterial* fMaterial; @@ -119,7 +119,7 @@ public: void SetWorldBounds(const hsBounds3Ext& wBnd) { *fWorldBounds = wBnd; } hsBool HasWaterHeight() const { return nil != fWaterHeight; } - hsScalar GetWaterHeight() const { hsAssert(HasWaterHeight(), "Check before asking"); return *fWaterHeight; } + float GetWaterHeight() const { hsAssert(HasWaterHeight(), "Check before asking"); return *fWaterHeight; } }; inline plAccessVtxSpan& plAccessSpan::AccessVtx() diff --git a/Sources/Plasma/PubUtilLib/plDrawable/plAccessTriSpan.h b/Sources/Plasma/PubUtilLib/plDrawable/plAccessTriSpan.h index f5038f76..fff7b888 100644 --- a/Sources/Plasma/PubUtilLib/plDrawable/plAccessTriSpan.h +++ b/Sources/Plasma/PubUtilLib/plDrawable/plAccessTriSpan.h @@ -50,13 +50,13 @@ class plAccessTriSpan : public plAccessVtxSpan public: hsGDeviceRef* fIdxDeviceRef; - UInt16* fTris; // array length fNumTris*3 + uint16_t* fTris; // array length fNumTris*3 - UInt32 fNumTris; + uint32_t fNumTris; void ClearTris() { fTris = nil; fNumTris = 0; } - UInt32 TriCount() const { return fNumTris; } + uint32_t TriCount() const { return fNumTris; } void SetIdxDeviceRef(hsGDeviceRef* ref) { fIdxDeviceRef = ref; } hsGDeviceRef* GetIdxDeviceRef() const { return fIdxDeviceRef; } @@ -66,8 +66,8 @@ class plAccTriIterator { protected: - UInt16* fCurrIdx; - UInt16* fEndIdx; + uint16_t* fCurrIdx; + uint16_t* fEndIdx; plAccessTriSpan* fAccess; public: @@ -81,14 +81,14 @@ public: void SetTri(int i); hsBool More() const; - UInt32 NumTris() const { return fAccess->fNumTris; } + uint32_t NumTris() const { return fAccess->fNumTris; } - UInt16& RawIndex(int iVtx) const { return fCurrIdx[iVtx]; } + uint16_t& RawIndex(int iVtx) const { return fCurrIdx[iVtx]; } hsPoint3& Position(int iVtx) const { return fAccess->PositionOff(fCurrIdx[iVtx]); } hsVector3& Normal(int iVtx) const { return fAccess->NormalOff(fCurrIdx[iVtx]); } - UInt32 Diffuse32(int iVtx) const { return fAccess->Diffuse32Off(fCurrIdx[iVtx]); } - UInt32 Specular32(int iVtx) const { return fAccess->Specular32Off(fCurrIdx[iVtx]); } + uint32_t Diffuse32(int iVtx) const { return fAccess->Diffuse32Off(fCurrIdx[iVtx]); } + uint32_t Specular32(int iVtx) const { return fAccess->Specular32Off(fCurrIdx[iVtx]); } hsColorRGBA DiffuseRGBA(int iVtx) const { return fAccess->DiffuseRGBAOff(fCurrIdx[iVtx]); } hsColorRGBA SpecularRGBA(int iVtx) const { return fAccess->SpecularRGBAOff(fCurrIdx[iVtx]); } hsPoint3* UVWs(int iVtx) const { return fAccess->UVWsOff(fCurrIdx[iVtx]); } @@ -96,8 +96,8 @@ public: hsPoint3 InterpPosition(const hsPoint3& bary) const; hsVector3 InterpNormal(const hsPoint3& bary) const; - UInt32 InterpDiffuse32(const hsPoint3& bary) const; - UInt32 InterpSpecular32(const hsPoint3& bary) const; + uint32_t InterpDiffuse32(const hsPoint3& bary) const; + uint32_t InterpSpecular32(const hsPoint3& bary) const; hsColorRGBA InterpDiffuseRGBA(const hsPoint3& bary) const; hsColorRGBA InterpSpecularRGBA(const hsPoint3& bary) const; hsPoint3 InterpUVW(const hsPoint3& bary, int i) const; @@ -154,12 +154,12 @@ inline hsColorRGBA plAccTriIterator::InterpSpecularRGBA(const hsPoint3& bary) co + SpecularRGBA(2) * bary[2]; } -inline UInt32 plAccTriIterator::InterpDiffuse32(const hsPoint3& bary) const +inline uint32_t plAccTriIterator::InterpDiffuse32(const hsPoint3& bary) const { return InterpDiffuseRGBA(bary).ToARGB32(); } -inline UInt32 plAccTriIterator::InterpSpecular32(const hsPoint3& bary) const +inline uint32_t plAccTriIterator::InterpSpecular32(const hsPoint3& bary) const { return InterpSpecularRGBA(bary).ToARGB32(); } diff --git a/Sources/Plasma/PubUtilLib/plDrawable/plAccessVtxSpan.h b/Sources/Plasma/PubUtilLib/plDrawable/plAccessVtxSpan.h index 2bbd2ca8..ce7fd7b0 100644 --- a/Sources/Plasma/PubUtilLib/plDrawable/plAccessVtxSpan.h +++ b/Sources/Plasma/PubUtilLib/plDrawable/plAccessVtxSpan.h @@ -102,18 +102,18 @@ public: hsGDeviceRef* fVtxDeviceRef; - UInt8* fChannels[kNumValidChans]; - UInt16 fStrides[kNumValidChans]; - Int32 fOffsets[kNumValidChans]; + uint8_t* fChannels[kNumValidChans]; + uint16_t fStrides[kNumValidChans]; + int32_t fOffsets[kNumValidChans]; - UInt16 fNumWeights; - UInt16 fNumUVWsPerVert; - UInt16 fNumVerts; + uint16_t fNumWeights; + uint16_t fNumUVWsPerVert; + uint16_t fNumVerts; ////////////////////////////////// // QUERY SECTION // Queries on how much of what we got. - UInt32 VertCount() const { return fNumVerts; } + uint32_t VertCount() const { return fNumVerts; } hsBool HasChannel(Channel chan) const { return fStrides[chan] > 0; } hsBool HasPositions() const { return HasChannel(kPosition); } hsBool HasWeights() const { return HasChannel(kWeight); } @@ -131,13 +131,13 @@ public: hsPoint3& Position(int i) const { return *(hsPoint3*)(fChannels[kPosition] + i*fStrides[kPosition]); } hsVector3& Normal(int i) const { return *(hsVector3*)(fChannels[kNormal] + i*fStrides[kNormal]); } - hsScalar& Weight(int iVtx, int iWgt) const { return *(hsScalar*)(fChannels[kWeight] + iVtx*fStrides[kWeight] + iWgt*sizeof(hsScalar)); } - hsScalar* Weights(int i) const { return (hsScalar*)(fChannels[kWeight] + i*fStrides[kWeight]); } - UInt32& WgtIndices(int i) const { return *(UInt32*)(fChannels[kWgtIndex] + i * fStrides[kWgtIndex]); } - UInt8& WgtIndex(int iVtx, int iWgt) const { return *(fChannels[kWgtIndex] + iVtx*fStrides[kWgtIndex] + iWgt); } + float& Weight(int iVtx, int iWgt) const { return *(float*)(fChannels[kWeight] + iVtx*fStrides[kWeight] + iWgt*sizeof(float)); } + float* Weights(int i) const { return (float*)(fChannels[kWeight] + i*fStrides[kWeight]); } + uint32_t& WgtIndices(int i) const { return *(uint32_t*)(fChannels[kWgtIndex] + i * fStrides[kWgtIndex]); } + uint8_t& WgtIndex(int iVtx, int iWgt) const { return *(fChannels[kWgtIndex] + iVtx*fStrides[kWgtIndex] + iWgt); } - UInt32& Diffuse32(int i) const { return *(UInt32*)(fChannels[kDiffuse] + i*fStrides[kDiffuse]); } - UInt32& Specular32(int i) const { return *(UInt32*)(fChannels[kSpecular] + i*fStrides[kSpecular]); } + uint32_t& Diffuse32(int i) const { return *(uint32_t*)(fChannels[kDiffuse] + i*fStrides[kDiffuse]); } + uint32_t& Specular32(int i) const { return *(uint32_t*)(fChannels[kSpecular] + i*fStrides[kSpecular]); } hsColorRGBA DiffuseRGBA(int i) const { return hsColorRGBA().FromARGB32(Diffuse32(i)); } hsColorRGBA SpecularRGBA(int i) const { return hsColorRGBA().FromARGB32(Specular32(i)); } @@ -153,13 +153,13 @@ public: hsPoint3& PositionOff(int i) const { return *(hsPoint3*)(fChannels[kPosition] + i*fStrides[kPosition] + fOffsets[kPosition]); } hsVector3& NormalOff(int i) const { return *(hsVector3*)(fChannels[kNormal] + i*fStrides[kNormal] + fOffsets[kNormal]); } - hsScalar& WeightOff(int iVtx, int iWgt) const { return *(hsScalar*)(fChannels[kWeight] + iVtx*fStrides[kWeight] + fOffsets[kWeight] + iWgt*sizeof(hsScalar)); } - hsScalar* WeightsOff(int i) const { return (hsScalar*)(fChannels[kWeight] + i*fStrides[kWeight] + fOffsets[kWeight]); } - UInt32& WgtIndicesOff(int i) const { return *(UInt32*)(fChannels[kWgtIndex] + i * fStrides[kWgtIndex] + fOffsets[kWgtIndex]); } - UInt8& WgtIndexOff(int iVtx, int iWgt) const { return *(fChannels[kWgtIndex] + iVtx*fStrides[kWgtIndex] + fOffsets[kWgtIndex] + iWgt); } + float& WeightOff(int iVtx, int iWgt) const { return *(float*)(fChannels[kWeight] + iVtx*fStrides[kWeight] + fOffsets[kWeight] + iWgt*sizeof(float)); } + float* WeightsOff(int i) const { return (float*)(fChannels[kWeight] + i*fStrides[kWeight] + fOffsets[kWeight]); } + uint32_t& WgtIndicesOff(int i) const { return *(uint32_t*)(fChannels[kWgtIndex] + i * fStrides[kWgtIndex] + fOffsets[kWgtIndex]); } + uint8_t& WgtIndexOff(int iVtx, int iWgt) const { return *(fChannels[kWgtIndex] + iVtx*fStrides[kWgtIndex] + fOffsets[kWgtIndex] + iWgt); } - UInt32& Diffuse32Off(int i) const { return *(UInt32*)(fChannels[kDiffuse] + i*fStrides[kDiffuse] + fOffsets[kDiffuse]); } - UInt32& Specular32Off(int i) const { return *(UInt32*)(fChannels[kSpecular] + i*fStrides[kSpecular] + fOffsets[kSpecular]); } + uint32_t& Diffuse32Off(int i) const { return *(uint32_t*)(fChannels[kDiffuse] + i*fStrides[kDiffuse] + fOffsets[kDiffuse]); } + uint32_t& Specular32Off(int i) const { return *(uint32_t*)(fChannels[kSpecular] + i*fStrides[kSpecular] + fOffsets[kSpecular]); } hsColorRGBA DiffuseRGBAOff(int i) const { return hsColorRGBA().FromARGB32(Diffuse32Off(i)); } hsColorRGBA SpecularRGBAOff(int i) const { return hsColorRGBA().FromARGB32(Specular32Off(i)); } @@ -178,24 +178,24 @@ public: void ClearVerts(); // Must at least set a count and the valid channels. Note below on setting up for UVW access. - plAccessVtxSpan& SetVertCount(UInt16 c) { fNumVerts = c; return *this; } - plAccessVtxSpan& SetStream(void* p, UInt16 stride, Int32 offset, Channel chan) { fChannels[chan] = (UInt8*)p; fStrides[chan] = stride; fOffsets[chan] = offset; return *this; } + plAccessVtxSpan& SetVertCount(uint16_t c) { fNumVerts = c; return *this; } + plAccessVtxSpan& SetStream(void* p, uint16_t stride, int32_t offset, Channel chan) { fChannels[chan] = (uint8_t*)p; fStrides[chan] = stride; fOffsets[chan] = offset; return *this; } ////////////////////////////////// // Convenience versions. You get the idea. - plAccessVtxSpan& PositionStream(void* p, UInt16 stride, Int32 offset) { return SetStream(p, stride, offset, kPosition); } - plAccessVtxSpan& NormalStream(void* p, UInt16 stride, Int32 offset) { return SetStream(p, stride, offset, kNormal); } - plAccessVtxSpan& DiffuseStream(void* p, UInt16 stride, Int32 offset) { return SetStream(p, stride, offset, kDiffuse); } - plAccessVtxSpan& SpecularStream(void* p, UInt16 stride, Int32 offset) { return SetStream(p, stride, offset, kSpecular); } - plAccessVtxSpan& WeightStream(void* p, UInt16 stride, Int32 offset) { return SetStream(p, stride, offset, kWeight); } - plAccessVtxSpan& WgtIndexStream(void* p, UInt16 stride, Int32 offset) { return SetStream(p, stride, offset, kWgtIndex); } + plAccessVtxSpan& PositionStream(void* p, uint16_t stride, int32_t offset) { return SetStream(p, stride, offset, kPosition); } + plAccessVtxSpan& NormalStream(void* p, uint16_t stride, int32_t offset) { return SetStream(p, stride, offset, kNormal); } + plAccessVtxSpan& DiffuseStream(void* p, uint16_t stride, int32_t offset) { return SetStream(p, stride, offset, kDiffuse); } + plAccessVtxSpan& SpecularStream(void* p, uint16_t stride, int32_t offset) { return SetStream(p, stride, offset, kSpecular); } + plAccessVtxSpan& WeightStream(void* p, uint16_t stride, int32_t offset) { return SetStream(p, stride, offset, kWeight); } + plAccessVtxSpan& WgtIndexStream(void* p, uint16_t stride, int32_t offset) { return SetStream(p, stride, offset, kWgtIndex); } plAccessVtxSpan& SetNumWeights(int n) { if( !(fNumWeights = n) ) SetStream(nil, 0, 0, kWeight).SetStream(nil, 0, 0, kWgtIndex); return *this; } // Note on UVW access setup, you don't actually "have" to set the number of uvws per vertex, // but one way or another you'll need to know to access the uvws. If you're going to be setting // up the AccessSpan and passing it off for processing, you definitely better set it. But the // accessor and iterators don't ever use it. // Note that this means the UVWStream stride is from uvw[0][0] to uvw[1][0] in bytes. - plAccessVtxSpan& UVWStream(void* p, UInt16 stride, Int32 offset) { return SetStream(p, stride, offset, kUVW); } + plAccessVtxSpan& UVWStream(void* p, uint16_t stride, int32_t offset) { return SetStream(p, stride, offset, kUVW); } plAccessVtxSpan& SetNumUVWs(int n) { if( !(fNumUVWsPerVert = n) )SetStream(nil, 0, 0, kUVW); return *this; } ////////////////////////////////// @@ -224,9 +224,9 @@ private: union { T* fValue; - UInt8* fValueByte; + uint8_t* fValueByte; }; - UInt8* fValueEnd; + uint8_t* fValueEnd; plAccessVtxSpan* fAccess; plAccessVtxSpan::Channel fChan; @@ -355,7 +355,7 @@ public: class plAccDiffuseIterator { - plAccIterator fDiffuse; + plAccIterator fDiffuse; public: plAccDiffuseIterator(plAccessVtxSpan* acc) : fDiffuse(acc, plAccessVtxSpan::kDiffuse) {} @@ -367,7 +367,7 @@ public: return *this; } - UInt32* Diffuse32() const { return fDiffuse.Value(); } + uint32_t* Diffuse32() const { return fDiffuse.Value(); } hsColorRGBA DiffuseRGBA() const { return hsColorRGBA().FromARGB32(*Diffuse32()); } @@ -379,8 +379,8 @@ public: class plAccDiffSpecIterator { protected: - plAccIterator fDiffuse; - plAccIterator fSpecular; + plAccIterator fDiffuse; + plAccIterator fSpecular; public: plAccDiffSpecIterator(plAccessVtxSpan* acc) : fDiffuse(acc, plAccessVtxSpan::kDiffuse), @@ -394,8 +394,8 @@ public: return *this; } - UInt32* Diffuse32() const { return fDiffuse.Value(); } - UInt32* Specular32() const { return fSpecular.Value(); } + uint32_t* Diffuse32() const { return fDiffuse.Value(); } + uint32_t* Specular32() const { return fSpecular.Value(); } hsColorRGBA DiffuseRGBA() const { return hsColorRGBA().FromARGB32(*Diffuse32()); } hsColorRGBA SpecularRGBA() const { return hsColorRGBA().FromARGB32(*Specular32()); } @@ -410,11 +410,11 @@ class plAccVertexIterator { protected: plAccIterator fPosition; - plAccIterator fWeight; - plAccIterator fWgtIndex; + plAccIterator fWeight; + plAccIterator fWgtIndex; plAccIterator fNormal; - plAccIterator fDiffuse; - plAccIterator fSpecular; + plAccIterator fDiffuse; + plAccIterator fSpecular; plAccIterator fUVW; public: plAccVertexIterator(plAccessVtxSpan* acc) @@ -440,16 +440,16 @@ public: } hsPoint3* Position() const { return fPosition.Value(); } - hsScalar* Weights() const { return fWeight.Value(); } - hsScalar* Weight(int i) const { return fWeight.Value() + i; } - UInt32* WgtIndices() const { return (UInt32*)(fWgtIndex.Value()); } - UInt8* WgtIndex(int i) const { return fWgtIndex.Value() + i; } + float* Weights() const { return fWeight.Value(); } + float* Weight(int i) const { return fWeight.Value() + i; } + uint32_t* WgtIndices() const { return (uint32_t*)(fWgtIndex.Value()); } + uint8_t* WgtIndex(int i) const { return fWgtIndex.Value() + i; } hsVector3* Normal() const { return fNormal.Value(); } hsPoint3* UVWs() const { return fUVW.Value(); } hsPoint3* UVW(int i) const { return fUVW.Value() + i; } - UInt32* Diffuse32() const { return fDiffuse.Value(); } - UInt32* Specular32() const { return fSpecular.Value(); } + uint32_t* Diffuse32() const { return fDiffuse.Value(); } + uint32_t* Specular32() const { return fSpecular.Value(); } hsColorRGBA DiffuseRGBA() const { return hsColorRGBA().FromARGB32(*Diffuse32()); } hsColorRGBA SpecularRGBA() const { return hsColorRGBA().FromARGB32(*Specular32()); } diff --git a/Sources/Plasma/PubUtilLib/plDrawable/plActivePrintShape.cpp b/Sources/Plasma/PubUtilLib/plDrawable/plActivePrintShape.cpp index cec356fe..1d57ed1e 100644 --- a/Sources/Plasma/PubUtilLib/plDrawable/plActivePrintShape.cpp +++ b/Sources/Plasma/PubUtilLib/plDrawable/plActivePrintShape.cpp @@ -40,7 +40,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "plActivePrintShape.h" #include "plMessage/plRippleShapeMsg.h" @@ -65,7 +65,7 @@ void plActivePrintShape::Read(hsStream* stream, hsResMgr* mgr) { plPrintShape::Read(stream, mgr); - UInt32 n = stream->ReadLE32(); + uint32_t n = stream->ReadLE32(); fDecalMgrs.SetCount(n); int i; for( i = 0; i < n; i++ ) @@ -125,6 +125,6 @@ hsBool plActivePrintShape::INotify() plRippleShapeMsg* plActivePrintShape::ISetupShapeMsg() { - fShapeMsg = TRACKED_NEW plRippleShapeMsg(nil, this); + fShapeMsg = new plRippleShapeMsg(nil, this); return fShapeMsg; } \ No newline at end of file diff --git a/Sources/Plasma/PubUtilLib/plDrawable/plAuxSpan.h b/Sources/Plasma/PubUtilLib/plDrawable/plAuxSpan.h index cabe5d30..e47f227e 100644 --- a/Sources/Plasma/PubUtilLib/plDrawable/plAuxSpan.h +++ b/Sources/Plasma/PubUtilLib/plDrawable/plAuxSpan.h @@ -68,43 +68,43 @@ public: void* fOwner; plDrawableSpans* fDrawable; - UInt32 fBaseSpanIdx; + uint32_t fBaseSpanIdx; hsGMaterial* fMaterial; - UInt32 fFlags; + uint32_t fFlags; hsTArray fOrigPos; hsTArray fOrigUVW; plGBufferGroup* fGroup; // Which buffer group, i.e. which vertex format - UInt32 fVBufferIdx; // Which vertex buffer in group - UInt32 fCellIdx; // Cell index inside the vertex buffer - UInt32 fCellOffset; // Offset inside the cell - UInt32 fVStartIdx; // Start vertex # in the actual interlaced buffer - UInt32 fVLength; // Length of this span in the buffer + uint32_t fVBufferIdx; // Which vertex buffer in group + uint32_t fCellIdx; // Cell index inside the vertex buffer + uint32_t fCellOffset; // Offset inside the cell + uint32_t fVStartIdx; // Start vertex # in the actual interlaced buffer + uint32_t fVLength; // Length of this span in the buffer - UInt32 fVBufferInit; - UInt32 fVBufferLimit; + uint32_t fVBufferInit; + uint32_t fVBufferLimit; - UInt32 fIBufferIdx; // Which index buffer in group - UInt32 fIStartIdx; // Redundant, since all spans are contiguous. Here for debugging - UInt32 fILength; // Length of this span in the buffer + uint32_t fIBufferIdx; // Which index buffer in group + uint32_t fIStartIdx; // Redundant, since all spans are contiguous. Here for debugging + uint32_t fILength; // Length of this span in the buffer - UInt32 fIBufferInit; - UInt32 fIBufferLimit; + uint32_t fIBufferInit; + uint32_t fIBufferLimit; plDecalVtxFormat* GetBaseVtxPtr() const { plGBufferGroup* grp = fGroup; plGBufferCell* cell = grp->GetCell(fVBufferIdx, fCellIdx); - UInt8* ptr = grp->GetVertBufferData(fVBufferIdx); + uint8_t* ptr = grp->GetVertBufferData(fVBufferIdx); ptr += cell->fVtxStart + fCellOffset; return (plDecalVtxFormat*)ptr; } - UInt16* GetBaseIdxPtr() const + uint16_t* GetBaseIdxPtr() const { plGBufferGroup* grp = fGroup; diff --git a/Sources/Plasma/PubUtilLib/plDrawable/plAvMeshSmooth.cpp b/Sources/Plasma/PubUtilLib/plDrawable/plAvMeshSmooth.cpp index 44cf311a..9a53b44f 100644 --- a/Sources/Plasma/PubUtilLib/plDrawable/plAvMeshSmooth.cpp +++ b/Sources/Plasma/PubUtilLib/plDrawable/plAvMeshSmooth.cpp @@ -40,7 +40,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "plAvMeshSmooth.h" #include "plGeometrySpan.h" @@ -52,15 +52,15 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com class EdgeBin { public: - UInt16 fVtx; - UInt16 fCount; + uint16_t fVtx; + uint16_t fCount; EdgeBin() : fVtx(0), fCount(0) {} }; -void plAvMeshSmooth::FindEdges(UInt32 maxVtxIdx, UInt32 nTris, UInt16* idxList, hsTArray& edgeVerts) +void plAvMeshSmooth::FindEdges(uint32_t maxVtxIdx, uint32_t nTris, uint16_t* idxList, hsTArray& edgeVerts) { - hsTArray* bins = TRACKED_NEW hsTArray[maxVtxIdx+1]; + hsTArray* bins = new hsTArray[maxVtxIdx+1]; hsBitVector edgeVertBits; // For each vert pair (edge) in idxList @@ -138,7 +138,7 @@ void plAvMeshSmooth::FindEdges(UInt32 maxVtxIdx, UInt32 nTris, UInt16* idxList, delete [] bins; } -void plAvMeshSmooth::FindEdges(hsTArray& spans, hsTArray* edgeVerts) +void plAvMeshSmooth::FindEdges(hsTArray& spans, hsTArray* edgeVerts) { int i; for( i = 0; i < spans.GetCount(); i++ ) @@ -149,9 +149,9 @@ void plAvMeshSmooth::FindEdges(hsTArray& spans, hsTArray* edgeV plAccessTriSpan& triSpan = spans[i].fAccSpan.AccessTri(); - UInt32 nTris = triSpan.TriCount(); - UInt16* idxList = triSpan.fTris; - UInt32 maxVertIdx = triSpan.VertCount()-1; + uint32_t nTris = triSpan.TriCount(); + uint16_t* idxList = triSpan.fTris; + uint32_t maxVertIdx = triSpan.VertCount()-1; FindEdges(maxVertIdx, nTris, idxList, edgeVerts[i]); } @@ -171,10 +171,10 @@ void plAvMeshSmooth::FindEdges(hsTArray& spans, hsTArray* edgeV // morph target mesh's local space. Whatever. void plAvMeshSmooth::Smooth(hsTArray& srcSpans, hsTArray& dstSpans) { - hsTArray* dstEdgeVerts = TRACKED_NEW hsTArray[dstSpans.GetCount()]; + hsTArray* dstEdgeVerts = new hsTArray[dstSpans.GetCount()]; FindEdges(dstSpans, dstEdgeVerts); - hsTArray* srcEdgeVerts = TRACKED_NEW hsTArray[srcSpans.GetCount()]; + hsTArray* srcEdgeVerts = new hsTArray[srcSpans.GetCount()]; FindEdges(srcSpans, srcEdgeVerts); int i; @@ -194,7 +194,7 @@ void plAvMeshSmooth::Smooth(hsTArray& srcSpans, hsTArray& dstS else dstDiff.Set(1.f, 1.f, 1.f, 1.f); - hsScalar maxDot = fMinNormDot; + float maxDot = fMinNormDot; hsPoint3 smoothPos = dstPos; hsVector3 smoothNorm = dstNorm; @@ -209,12 +209,12 @@ void plAvMeshSmooth::Smooth(hsTArray& srcSpans, hsTArray& dstS hsPoint3 srcPos = IPositionToNeutral(srcSpans[k], srcEdgeVerts[k][m]); hsVector3 srcNorm = INormalToNeutral(srcSpans[k], srcEdgeVerts[k][m]); - hsScalar dist = hsVector3(&dstPos, &srcPos).MagnitudeSquared(); + float dist = hsVector3(&dstPos, &srcPos).MagnitudeSquared(); if( dist <= fDistTolSq ) { smoothPos = srcPos; - hsScalar currDot = srcNorm.InnerProduct(dstNorm); + float currDot = srcNorm.InnerProduct(dstNorm); if( currDot > maxDot ) { maxDot = currDot; @@ -265,22 +265,22 @@ hsVector3 plAvMeshSmooth::INormalToSpan(XfmSpan& span, const hsVector3& wNorm) c return ret; } -void plAvMeshSmooth::SetAngle(hsScalar degs) +void plAvMeshSmooth::SetAngle(float degs) { - fMinNormDot = hsCosine(hsScalarDegToRad(degs)); + fMinNormDot = cos(hsDegreesToRadians(degs)); } -hsScalar plAvMeshSmooth::GetAngle() const +float plAvMeshSmooth::GetAngle() const { - return hsScalarRadToDeg(hsACosine(fMinNormDot)); + return hsRadiansToDegrees(acos(fMinNormDot)); } -void plAvMeshSmooth::SetDistTol(hsScalar dist) +void plAvMeshSmooth::SetDistTol(float dist) { fDistTolSq = dist * dist; } -hsScalar plAvMeshSmooth::GetDistTol() const +float plAvMeshSmooth::GetDistTol() const { - return hsSquareRoot(fDistTolSq); -} \ No newline at end of file + return sqrt(fDistTolSq); +} diff --git a/Sources/Plasma/PubUtilLib/plDrawable/plAvMeshSmooth.h b/Sources/Plasma/PubUtilLib/plDrawable/plAvMeshSmooth.h index d16b7c4c..48f653d3 100644 --- a/Sources/Plasma/PubUtilLib/plDrawable/plAvMeshSmooth.h +++ b/Sources/Plasma/PubUtilLib/plDrawable/plAvMeshSmooth.h @@ -75,10 +75,10 @@ public: }; protected: - UInt32 fFlags; + uint32_t fFlags; - hsScalar fMinNormDot; - hsScalar fDistTolSq; + float fMinNormDot; + float fDistTolSq; plAccessGeometry fAccGeom; @@ -87,22 +87,22 @@ protected: hsPoint3 IPositionToSpan(XfmSpan& span, const hsPoint3& wPos) const; hsVector3 INormalToSpan(XfmSpan& span, const hsVector3& wNorm) const; - void FindEdges(UInt32 maxVtxIdx, UInt32 nTris, UInt16* idxList, hsTArray& edgeVerts); - void FindEdges(hsTArray& spans, hsTArray* edgeVerts); + void FindEdges(uint32_t maxVtxIdx, uint32_t nTris, uint16_t* idxList, hsTArray& edgeVerts); + void FindEdges(hsTArray& spans, hsTArray* edgeVerts); public: plAvMeshSmooth() : fFlags(kSmoothNorm), fMinNormDot(0.25f), fDistTolSq(1.e-4f), fAccGeom() {} - void SetAngle(hsScalar degs); - hsScalar GetAngle() const; // returns degrees + void SetAngle(float degs); + float GetAngle() const; // returns degrees - void SetDistTol(hsScalar dist); - hsScalar GetDistTol() const; + void SetDistTol(float dist); + float GetDistTol() const; void Smooth(hsTArray& srcSpans, hsTArray& dstSpans); - void SetFlags(UInt32 f) { fFlags = f; } - UInt32 GetFlags() const { return fFlags; } + void SetFlags(uint32_t f) { fFlags = f; } + uint32_t GetFlags() const { return fFlags; } }; #endif // plAvMeshSmooth_inc diff --git a/Sources/Plasma/PubUtilLib/plDrawable/plCluster.cpp b/Sources/Plasma/PubUtilLib/plDrawable/plCluster.cpp index 4d81bf09..a1e98c67 100644 --- a/Sources/Plasma/PubUtilLib/plDrawable/plCluster.cpp +++ b/Sources/Plasma/PubUtilLib/plDrawable/plCluster.cpp @@ -40,7 +40,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "hsStream.h" #include "plCluster.h" @@ -74,7 +74,7 @@ void plCluster::Read(hsStream* s, plClusterGroup* grp) int i; for( i = 0; i < numInst; i++ ) { - fInsts[i] = TRACKED_NEW plSpanInstance; + fInsts[i] = new plSpanInstance; fInsts[i]->Read(s, fEncoding, numVerts); } @@ -94,8 +94,8 @@ void plCluster::Write(hsStream* s) const } inline void inlTESTPOINT(const hsPoint3& destP, - hsScalar& minX, hsScalar& minY, hsScalar& minZ, - hsScalar& maxX, hsScalar& maxY, hsScalar& maxZ) + float& minX, float& minY, float& minZ, + float& maxX, float& maxY, float& maxZ) { if( destP.fX < minX ) minX = destP.fX; @@ -113,15 +113,15 @@ inline void inlTESTPOINT(const hsPoint3& destP, maxZ = destP.fZ; } -void plCluster::UnPack(UInt8* vDst, UInt16* iDst, int idxOffset, hsBounds3Ext& wBnd) const +void plCluster::UnPack(uint8_t* vDst, uint16_t* iDst, int idxOffset, hsBounds3Ext& wBnd) const { - hsScalar minX = 1.e33f; - hsScalar minY = 1.e33f; - hsScalar minZ = 1.e33f; + float minX = 1.e33f; + float minY = 1.e33f; + float minZ = 1.e33f; - hsScalar maxX = -1.e33f; - hsScalar maxY = -1.e33f; - hsScalar maxZ = -1.e33f; + float maxX = -1.e33f; + float maxY = -1.e33f; + float maxZ = -1.e33f; hsAssert(fGroup->GetTemplate(), "Can't unpack without a template"); const plSpanTemplate& templ = *fGroup->GetTemplate(); @@ -129,7 +129,7 @@ void plCluster::UnPack(UInt8* vDst, UInt16* iDst, int idxOffset, hsBounds3Ext& w for( i = 0; i < fInsts.GetCount(); i++ ) { // First, just copy our template, offsetting by prescribed amount. - const UInt16* iSrc = templ.IndexData(); + const uint16_t* iSrc = templ.IndexData(); int n = templ.NumIndices(); while( n-- ) { @@ -173,7 +173,7 @@ void plCluster::UnPack(UInt8* vDst, UInt16* iDst, int idxOffset, hsBounds3Ext& w *norm = w2l * *norm; hsFastMath::NormalizeAppr(*norm); - UInt32* color = (UInt32*)(vDst + colOff); + uint32_t* color = (uint32_t*)(vDst + colOff); *color = iter.Color(*color); vDst += stride; diff --git a/Sources/Plasma/PubUtilLib/plDrawable/plCluster.h b/Sources/Plasma/PubUtilLib/plDrawable/plCluster.h index cedce260..e62bf5f8 100644 --- a/Sources/Plasma/PubUtilLib/plDrawable/plCluster.h +++ b/Sources/Plasma/PubUtilLib/plDrawable/plCluster.h @@ -63,7 +63,7 @@ class plCluster public: enum { - kNoIdx = UInt8(-1) + kNoIdx = uint8_t(-1) }; protected: plClusterGroup* fGroup; @@ -83,10 +83,10 @@ public: void Read(hsStream* s, plClusterGroup* grp); void Write(hsStream* s) const; - UInt32 NumInsts() const { return fInsts.GetCount(); } + uint32_t NumInsts() const { return fInsts.GetCount(); } const plSpanInstance& GetInst(int i) const { return *fInsts[i]; } - void UnPack(UInt8* vDst, UInt16* iDst, int idxOffset, hsBounds3Ext& wBnd) const; + void UnPack(uint8_t* vDst, uint16_t* iDst, int idxOffset, hsBounds3Ext& wBnd) const; // Getters and setters, mostly for export construction. const plSpanTemplate* GetTemplate() const { return fGroup->GetTemplate(); } diff --git a/Sources/Plasma/PubUtilLib/plDrawable/plClusterGroup.cpp b/Sources/Plasma/PubUtilLib/plDrawable/plClusterGroup.cpp index 854ab339..893aef5e 100644 --- a/Sources/Plasma/PubUtilLib/plDrawable/plClusterGroup.cpp +++ b/Sources/Plasma/PubUtilLib/plDrawable/plClusterGroup.cpp @@ -40,7 +40,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "plClusterGroup.h" #include "plSpanTemplate.h" @@ -86,7 +86,7 @@ plClusterGroup::~plClusterGroup() plCluster* plClusterGroup::IAddCluster() { - plCluster* cluster = TRACKED_NEW plCluster; + plCluster* cluster = new plCluster; // Set the cluster's group. cluster->SetGroup(this); fClusters.Append(cluster); @@ -109,26 +109,26 @@ void plClusterGroup::Read(hsStream* stream, hsResMgr* mgr) int i; - fTemplate = TRACKED_NEW plSpanTemplate; + fTemplate = new plSpanTemplate; fTemplate->Read(stream); - mgr->ReadKeyNotifyMe(stream, TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnCreate, -1, kRefMaterial), plRefFlags::kActiveRef); + mgr->ReadKeyNotifyMe(stream, new plGenRefMsg(GetKey(), plRefMsg::kOnCreate, -1, kRefMaterial), plRefFlags::kActiveRef); const int numClust = stream->ReadLE32(); fClusters.SetCount(numClust); for( i = 0; i < numClust; i++ ) { - fClusters[i] = TRACKED_NEW plCluster; + fClusters[i] = new plCluster; fClusters[i]->Read(stream, this); } const int numRegions = stream->ReadLE32(); for( i = 0; i < numRegions; i++ ) - mgr->ReadKeyNotifyMe(stream, TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnCreate, -1, kRefRegion), plRefFlags::kActiveRef); + mgr->ReadKeyNotifyMe(stream, new plGenRefMsg(GetKey(), plRefMsg::kOnCreate, -1, kRefRegion), plRefFlags::kActiveRef); const int numLights = stream->ReadLE32(); for( i = 0; i < numLights; i++ ) - mgr->ReadKeyNotifyMe(stream, TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnCreate, -1, kRefLight), plRefFlags::kActiveRef); + mgr->ReadKeyNotifyMe(stream, new plGenRefMsg(GetKey(), plRefMsg::kOnCreate, -1, kRefLight), plRefFlags::kActiveRef); fLOD.Read(stream); @@ -172,7 +172,7 @@ void plClusterGroup::Write(hsStream* stream, hsResMgr* mgr) void plClusterGroup::ISendToSelf(RefType t, hsKeyedObject* ref) { hsAssert(ref, "Sending self a nil object"); - plGenRefMsg* refMsg = TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnCreate, -1, t); + plGenRefMsg* refMsg = new plGenRefMsg(GetKey(), plRefMsg::kOnCreate, -1, t); hsgResMgr::ResMgr()->SendRef(ref->GetKey(), refMsg, plRefFlags::kActiveRef); } @@ -299,7 +299,7 @@ hsBool plClusterGroup::MsgReceive(plMessage* msg) void plClusterGroup::UnPack() { - plDrawableSpans* drawable = TRACKED_NEW plDrawableSpans; + plDrawableSpans* drawable = new plDrawableSpans; fDrawable = hsgResMgr::ResMgr()->NewKey(GetKey()->GetName(), drawable, GetKey()->GetUoid().GetLocation()); drawable->UnPackCluster(this); @@ -316,9 +316,9 @@ void plClusterGroup::SetVisible(bool visible) } } -UInt32 plClusterGroup::NumInst() const +uint32_t plClusterGroup::NumInst() const { - UInt32 numInst = 0; + uint32_t numInst = 0; int i; for( i = 0; i < fClusters.GetCount(); i++ ) numInst += fClusters[i]->NumInsts(); diff --git a/Sources/Plasma/PubUtilLib/plDrawable/plClusterGroup.h b/Sources/Plasma/PubUtilLib/plDrawable/plClusterGroup.h index 16d20e59..7bd2546d 100644 --- a/Sources/Plasma/PubUtilLib/plDrawable/plClusterGroup.h +++ b/Sources/Plasma/PubUtilLib/plDrawable/plClusterGroup.h @@ -62,15 +62,15 @@ class plDrawableSpans; class plLODDist { public: - hsScalar fMinDist; - hsScalar fMaxDist; + float fMinDist; + float fMaxDist; - plLODDist(hsScalar minDist, hsScalar maxDist) : fMinDist(minDist), fMaxDist(maxDist) {} + plLODDist(float minDist, float maxDist) : fMinDist(minDist), fMaxDist(maxDist) {} plLODDist() : fMinDist(0), fMaxDist(0) {} plLODDist& Set(float minDist, float maxDist) { fMinDist = minDist; fMaxDist = maxDist; return *this; } - plLODDist& operator=(int d) { fMinDist = hsScalar(d); fMaxDist = hsScalar(d); return *this; } + plLODDist& operator=(int d) { fMinDist = float(d); fMaxDist = float(d); return *this; } int operator==(const plLODDist& d) const { return (fMinDist == d.fMinDist)&&(fMaxDist == d.fMaxDist); } @@ -101,7 +101,7 @@ protected: plLODDist fLOD; hsTArray fClusters; - UInt32 fUnPacked; + uint32_t fUnPacked; plKey fSceneNode; plKey fDrawable; @@ -144,7 +144,7 @@ public: const plCluster* GetCluster(int i) const; int GetNumClusters() const { return fClusters.GetCount(); } - UInt32 NumInst() const; + uint32_t NumInst() const; // The drawable needs us to be able to convert our data // into, well, drawable stuff. diff --git a/Sources/Plasma/PubUtilLib/plDrawable/plCutter.cpp b/Sources/Plasma/PubUtilLib/plDrawable/plCutter.cpp index 6dda26b6..5e68ce70 100644 --- a/Sources/Plasma/PubUtilLib/plDrawable/plCutter.cpp +++ b/Sources/Plasma/PubUtilLib/plDrawable/plCutter.cpp @@ -40,7 +40,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "plCutter.h" #include "plAccessSpan.h" #include "hsFastMath.h" @@ -134,7 +134,7 @@ void plCutter::Set(const hsPoint3& pos, const hsVector3& dir, const hsVector3& o } -inline void plCutter::ISetPosNorm(hsScalar parm, const plCutoutVtx& inVtx, const plCutoutVtx& outVtx, plCutoutVtx& dst) const +inline void plCutter::ISetPosNorm(float parm, const plCutoutVtx& inVtx, const plCutoutVtx& outVtx, plCutoutVtx& dst) const { dst.fPos = outVtx.fPos; dst.fPos += parm * (inVtx.fPos - outVtx.fPos); @@ -161,7 +161,7 @@ inline void plCutter::ISetPosNorm(hsScalar parm, const plCutoutVtx& inVtx, const inline void plCutter::ICutoutVtxLoU(const plCutoutVtx& inVtx, const plCutoutVtx& outVtx, plCutoutVtx& dst) const { - hsScalar parm = outVtx.fUVW.fX / (outVtx.fUVW.fX - inVtx.fUVW.fX); + float parm = outVtx.fUVW.fX / (outVtx.fUVW.fX - inVtx.fUVW.fX); ISetPosNorm(parm, inVtx, outVtx, dst); @@ -172,7 +172,7 @@ inline void plCutter::ICutoutVtxLoU(const plCutoutVtx& inVtx, const plCutoutVtx& inline void plCutter::ICutoutVtxLoV(const plCutoutVtx& inVtx, const plCutoutVtx& outVtx, plCutoutVtx& dst) const { - hsScalar parm = outVtx.fUVW.fY / (outVtx.fUVW.fY - inVtx.fUVW.fY); + float parm = outVtx.fUVW.fY / (outVtx.fUVW.fY - inVtx.fUVW.fY); ISetPosNorm(parm, inVtx, outVtx, dst); @@ -183,7 +183,7 @@ inline void plCutter::ICutoutVtxLoV(const plCutoutVtx& inVtx, const plCutoutVtx& inline void plCutter::ICutoutVtxLoW(const plCutoutVtx& inVtx, const plCutoutVtx& outVtx, plCutoutVtx& dst) const { - hsScalar parm = outVtx.fUVW.fZ / (outVtx.fUVW.fZ - inVtx.fUVW.fZ); + float parm = outVtx.fUVW.fZ / (outVtx.fUVW.fZ - inVtx.fUVW.fZ); ISetPosNorm(parm, inVtx, outVtx, dst); @@ -198,7 +198,7 @@ inline void plCutter::ICutoutVtxLoW(const plCutoutVtx& inVtx, const plCutoutVtx& // parm = (outVtx.fUVW - 1.f) / (outVtx.fUVW - inVtx.fUVW) inline void plCutter::ICutoutVtxHiU(const plCutoutVtx& inVtx, const plCutoutVtx& outVtx, plCutoutVtx& dst) const { - hsScalar parm = (outVtx.fUVW.fX - 1.f) / (outVtx.fUVW.fX - inVtx.fUVW.fX); + float parm = (outVtx.fUVW.fX - 1.f) / (outVtx.fUVW.fX - inVtx.fUVW.fX); ISetPosNorm(parm, inVtx, outVtx, dst); @@ -209,7 +209,7 @@ inline void plCutter::ICutoutVtxHiU(const plCutoutVtx& inVtx, const plCutoutVtx& inline void plCutter::ICutoutVtxHiV(const plCutoutVtx& inVtx, const plCutoutVtx& outVtx, plCutoutVtx& dst) const { - hsScalar parm = (outVtx.fUVW.fY - 1.f) / (outVtx.fUVW.fY - inVtx.fUVW.fY); + float parm = (outVtx.fUVW.fY - 1.f) / (outVtx.fUVW.fY - inVtx.fUVW.fY); ISetPosNorm(parm, inVtx, outVtx, dst); @@ -220,7 +220,7 @@ inline void plCutter::ICutoutVtxHiV(const plCutoutVtx& inVtx, const plCutoutVtx& inline void plCutter::ICutoutVtxHiW(const plCutoutVtx& inVtx, const plCutoutVtx& outVtx, plCutoutVtx& dst) const { - hsScalar parm = (outVtx.fUVW.fZ - 1.f) / (outVtx.fUVW.fZ - inVtx.fUVW.fZ); + float parm = (outVtx.fUVW.fZ - 1.f) / (outVtx.fUVW.fZ - inVtx.fUVW.fZ); ISetPosNorm(parm, inVtx, outVtx, dst); @@ -236,7 +236,7 @@ inline void plCutter::ICutoutVtxHiW(const plCutoutVtx& inVtx, const plCutoutVtx& // parm = (outVtx.fUVW - 0.5f) / (outVtx.fUVW - inVtx.fUVW) inline void plCutter::ICutoutVtxMidU(const plCutoutVtx& inVtx, const plCutoutVtx& outVtx, plCutoutVtx& dst) const { - hsScalar parm = (outVtx.fUVW.fX - 0.5f) / (outVtx.fUVW.fX - inVtx.fUVW.fX); + float parm = (outVtx.fUVW.fX - 0.5f) / (outVtx.fUVW.fX - inVtx.fUVW.fX); ISetPosNorm(parm, inVtx, outVtx, dst); @@ -249,7 +249,7 @@ inline void plCutter::ICutoutVtxMidU(const plCutoutVtx& inVtx, const plCutoutVtx inline void plCutter::ICutoutVtxMidV(const plCutoutVtx& inVtx, const plCutoutVtx& outVtx, plCutoutVtx& dst) const { - hsScalar parm = (outVtx.fUVW.fY - 0.5f) / (outVtx.fUVW.fY - inVtx.fUVW.fY); + float parm = (outVtx.fUVW.fY - 0.5f) / (outVtx.fUVW.fY - inVtx.fUVW.fY); ISetPosNorm(parm, inVtx, outVtx, dst); @@ -262,7 +262,7 @@ inline void plCutter::ICutoutVtxMidV(const plCutoutVtx& inVtx, const plCutoutVtx inline void plCutter::ICutoutVtxMidW(const plCutoutVtx& inVtx, const plCutoutVtx& outVtx, plCutoutVtx& dst) const { - hsScalar parm = (outVtx.fUVW.fZ - 0.5f) / (outVtx.fUVW.fZ - inVtx.fUVW.fZ); + float parm = (outVtx.fUVW.fZ - 0.5f) / (outVtx.fUVW.fZ - inVtx.fUVW.fZ); ISetPosNorm(parm, inVtx, outVtx, dst); @@ -721,7 +721,7 @@ hsBool plCutter::FindHitPoints(const hsTArray& src, hsTArray 0; } -hsBool plCutter::FindHitPointsConstHeight(const hsTArray& src, hsTArray& hits, hsScalar height) const +hsBool plCutter::FindHitPointsConstHeight(const hsTArray& src, hsTArray& hits, float height) const { if( FindHitPoints(src, hits) ) { @@ -933,14 +933,14 @@ hsBool plCutter::MakeGrid(int nWid, int nLen, const hsPoint3& center, const hsVe corner += -dux; corner += -dvx; - hsScalar sWid = 1.f / hsScalar(nWid-1); - hsScalar sLen = 1.f / hsScalar(nLen-1); + float sWid = 1.f / float(nWid-1); + float sLen = 1.f / float(nLen-1); dux *= 2.f * sWid; dvx *= 2.f * sLen; - hsScalar du = sWid; - hsScalar dv = sLen; + float du = sWid; + float dv = sLen; int j; for( j = 0; j < nLen; j++ ) { @@ -950,8 +950,8 @@ hsBool plCutter::MakeGrid(int nWid, int nLen, const hsPoint3& center, const hsVe plCutoutMiniVtx& vtx = grid.fVerts[j * nWid + i]; vtx.fPos = corner; - vtx.fPos += dux * (hsScalar)i; - vtx.fPos += dvx * (hsScalar)j; + vtx.fPos += dux * (float)i; + vtx.fPos += dvx * (float)j; vtx.fUVW.fX = du * i; vtx.fUVW.fY = dv * j; @@ -1043,7 +1043,7 @@ void TestCutter(const plKey& key, const hsVector3& size, const hsPoint3& pos) hsBool newDrawable = !drawable; hsBool haveNormal = true; - hsTArray retIndex; + hsTArray retIndex; hsTArray src; plAccessGeometry::Instance()->OpenRO(di, src); @@ -1168,7 +1168,7 @@ void TestCutter(const plKey& key, const hsVector3& size, const hsPoint3& pos) uvw[iv] = dst[iPoly].fVerts[iVert].fUVW; col[iv] = dst[iPoly].fVerts[iVert].fColor; - hsScalar opac = uvw[iv].fZ < 0.25f + float opac = uvw[iv].fZ < 0.25f ? uvw[iv].fZ * 4.f : uvw[iv].fZ > 0.75f ? (1.f - uvw[iv].fZ) * 4.f @@ -1190,12 +1190,12 @@ void TestCutter(const plKey& key, const hsVector3& size, const hsPoint3& pos) } } - hsTArray idx; + hsTArray idx; - UInt16 base = 0; + uint16_t base = 0; for( j = 0; j < dst.GetCount(); j++ ) { - UInt16 next = base+1; + uint16_t next = base+1; int k; for( k = 2; k < dst[j].fVerts.GetCount(); k++ ) { @@ -1249,7 +1249,7 @@ void TestCutter2(const plKey& key, const hsVector3& size, const hsPoint3& pos, h hsBool newDrawable = !drawable; hsBool haveNormal = true; - hsTArray retIndex; + hsTArray retIndex; hsTArray drawVis; node->Harvest(&cutter.GetIsect(), drawVis); @@ -1322,7 +1322,7 @@ void TestCutter2(const plKey& key, const hsVector3& size, const hsPoint3& pos, h uvw[iv] = dst[iPoly].fVerts[iVert].fUVW; col[iv] = dst[iPoly].fVerts[iVert].fColor; - hsScalar opac = uvw[iv].fZ < 0.25f + float opac = uvw[iv].fZ < 0.25f ? uvw[iv].fZ * 4.f : uvw[iv].fZ > 0.75f ? (1.f - uvw[iv].fZ) * 4.f @@ -1345,12 +1345,12 @@ void TestCutter2(const plKey& key, const hsVector3& size, const hsPoint3& pos, h } } - hsTArray idx; + hsTArray idx; - UInt16 base = 0; + uint16_t base = 0; for( j = 0; j < dst.GetCount(); j++ ) { - UInt16 next = base+1; + uint16_t next = base+1; int k; for( k = 2; k < dst[j].fVerts.GetCount(); k++ ) { diff --git a/Sources/Plasma/PubUtilLib/plDrawable/plCutter.h b/Sources/Plasma/PubUtilLib/plDrawable/plCutter.h index b652372e..3c5d326d 100644 --- a/Sources/Plasma/PubUtilLib/plDrawable/plCutter.h +++ b/Sources/Plasma/PubUtilLib/plDrawable/plCutter.h @@ -95,7 +95,7 @@ class plFlatGridMesh { public: hsTArray fVerts; - hsTArray fIdx; + hsTArray fIdx; void Reset() { fVerts.SetCount(0); fIdx.SetCount(0); } }; @@ -105,14 +105,14 @@ class plCutter : public plCreatable protected: // Permanent attributes - hsScalar fLengthU; - hsScalar fLengthV; - hsScalar fLengthW; + float fLengthU; + float fLengthV; + float fLengthW; // Internal cached stuff - hsScalar fDistU; - hsScalar fDistV; - hsScalar fDistW; + float fDistU; + float fDistV; + float fDistW; hsVector3 fDirU; hsVector3 fDirV; hsVector3 fDirW; @@ -136,7 +136,7 @@ protected: hsBool IFindHitPoint(const hsTArray& inPoly, plCutoutHit& hit) const; - inline void ISetPosNorm(hsScalar parm, const plCutoutVtx& inVtx, const plCutoutVtx& outVtx, plCutoutVtx& dst) const; + inline void ISetPosNorm(float parm, const plCutoutVtx& inVtx, const plCutoutVtx& outVtx, plCutoutVtx& dst) const; void ICutoutTransformed(plAccessSpan& src, hsTArray& dst) const; void ICutoutConstHeight(plAccessSpan& src, hsTArray& dst) const; @@ -155,7 +155,7 @@ public: virtual void Write(hsStream* stream, hsResMgr* mgr); hsBool FindHitPoints(const hsTArray& src, hsTArray& hits) const; - hsBool FindHitPointsConstHeight(const hsTArray& src, hsTArray& hits, hsScalar height) const; + hsBool FindHitPointsConstHeight(const hsTArray& src, hsTArray& hits, float height) const; void Set(const hsPoint3& pos, const hsVector3& dir, const hsVector3& out, hsBool flip=false); @@ -163,9 +163,9 @@ public: hsBool CutoutGrid(int nWid, int nLen, plFlatGridMesh& dst) const; void SetLength(const hsVector3& s) { fLengthU = s.fX; fLengthV = s.fY; fLengthW = s.fZ; } - hsScalar GetLengthU() const { return fLengthU; } - hsScalar GetLengthV() const { return fLengthV; } - hsScalar GetLengthW() const { return fLengthW; } + float GetLengthU() const { return fLengthU; } + float GetLengthV() const { return fLengthV; } + float GetLengthW() const { return fLengthW; } const hsBounds3Ext& GetWorldBounds() const { return fWorldBounds; } plBoundsIsect& GetIsect() { return fIsect; } diff --git a/Sources/Plasma/PubUtilLib/plDrawable/plDrawableGenerator.cpp b/Sources/Plasma/PubUtilLib/plDrawable/plDrawableGenerator.cpp index fb170bc2..2e7882bc 100644 --- a/Sources/Plasma/PubUtilLib/plDrawable/plDrawableGenerator.cpp +++ b/Sources/Plasma/PubUtilLib/plDrawable/plDrawableGenerator.cpp @@ -49,7 +49,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // // ////////////////////////////////////////////////////////////////////////////// -#include "hsTypes.h" +#include "HeadSpin.h" #include "plDrawableGenerator.h" #include "plDrawableSpans.h" #include "plGeometrySpan.h" @@ -80,7 +80,7 @@ void plDrawableGenerator::SetFauxLightColors( hsColorRGBA &lite, hsColorRGBA // Quickly shades vertices based on a fake directional light. Good for doing // faux shadings on proxy objects. -void plDrawableGenerator::IQuickShadeVerts( UInt32 count, hsVector3 *normals, hsColorRGBA *colors, hsColorRGBA* origColors, const hsColorRGBA* multColor ) +void plDrawableGenerator::IQuickShadeVerts( uint32_t count, hsVector3 *normals, hsColorRGBA *colors, hsColorRGBA* origColors, const hsColorRGBA* multColor ) { hsVector3 lightDir; float scale; @@ -94,7 +94,7 @@ void plDrawableGenerator::IQuickShadeVerts( UInt32 count, hsVector3 *normals, scale = ( normals[ count ] * lightDir ); // pretend there are two opposing directional lights, but the // one pointing downish is a little stronger. - const hsScalar kReverseLight = -0.8f; + const float kReverseLight = -0.8f; if( scale < 0 ) scale = kReverseLight * scale; colors[ count ] = fLiteColor * scale + fDarkColor * ( 1.f - scale ); @@ -105,10 +105,10 @@ void plDrawableGenerator::IQuickShadeVerts( UInt32 count, hsVector3 *normals, } } -void plDrawableGenerator::IFillSpan( UInt32 vertCount, hsPoint3 *positions, hsVector3 *normals, - hsPoint3 *uvws, UInt32 uvwsPerVtx, +void plDrawableGenerator::IFillSpan( uint32_t vertCount, hsPoint3 *positions, hsVector3 *normals, + hsPoint3 *uvws, uint32_t uvwsPerVtx, hsColorRGBA *origColors, hsBool fauxShade, const hsColorRGBA* multColor, - UInt32 numIndices, UInt16 *indices, + uint32_t numIndices, uint16_t *indices, hsGMaterial *material, const hsMatrix44 &localToWorld, hsBool blended, plGeometrySpan* span ) { @@ -144,7 +144,7 @@ void plDrawableGenerator::IFillSpan( UInt32 vertCount, hsPoint3 *positions, hsVe if( uvws == nil ) uvwsPerVtx = 0; - span->BeginCreate( material, localToWorld, plGeometrySpan::UVCountToFormat( (UInt8)uvwsPerVtx ) ); + span->BeginCreate( material, localToWorld, plGeometrySpan::UVCountToFormat( (uint8_t)uvwsPerVtx ) ); if( !origColors && !fauxShade ) span->AddVertexArray( vertCount, positions, normals, nil, uvws, uvwsPerVtx ); @@ -165,19 +165,19 @@ void plDrawableGenerator::IFillSpan( UInt32 vertCount, hsPoint3 *positions, hsVe } - hsTArray tempColors; + hsTArray tempColors; int i; - UInt8 a, r, g, b; + uint8_t a, r, g, b; tempColors.SetCount( vertCount ); for( i = 0; i < vertCount; i++ ) { hsColorRGBA *color = &colors[ i ]; - a = (UInt8)( color->a >= 1 ? 255 : color->a <= 0 ? 0 : color->a * 255.0 ); - r = (UInt8)( color->r >= 1 ? 255 : color->r <= 0 ? 0 : color->r * 255.0 ); - g = (UInt8)( color->g >= 1 ? 255 : color->g <= 0 ? 0 : color->g * 255.0 ); - b = (UInt8)( color->b >= 1 ? 255 : color->b <= 0 ? 0 : color->b * 255.0 ); + a = (uint8_t)( color->a >= 1 ? 255 : color->a <= 0 ? 0 : color->a * 255.0 ); + r = (uint8_t)( color->r >= 1 ? 255 : color->r <= 0 ? 0 : color->r * 255.0 ); + g = (uint8_t)( color->g >= 1 ? 255 : color->g <= 0 ? 0 : color->g * 255.0 ); + b = (uint8_t)( color->b >= 1 ? 255 : color->b <= 0 ? 0 : color->b * 255.0 ); tempColors[ i ] = ( a << 24 ) | ( r << 16 ) | ( g << 8 ) | ( b ); } @@ -196,12 +196,12 @@ void plDrawableGenerator::IFillSpan( UInt32 vertCount, hsPoint3 *positions, hsVe // data given. That data had better match the data the drawable was first filled // with (i.e. vertex/index count -hsBool plDrawableGenerator::RegenerateDrawable( UInt32 vertCount, hsPoint3 *positions, hsVector3 *normals, - hsPoint3 *uvws, UInt32 uvwsPerVtx, +hsBool plDrawableGenerator::RegenerateDrawable( uint32_t vertCount, hsPoint3 *positions, hsVector3 *normals, + hsPoint3 *uvws, uint32_t uvwsPerVtx, hsColorRGBA *origColors, hsBool fauxShade, const hsColorRGBA* multColor, - UInt32 numIndices, UInt16 *indices, + uint32_t numIndices, uint16_t *indices, hsGMaterial *material, const hsMatrix44 &localToWorld, hsBool blended, - UInt32 diIndex, plDrawableSpans *destDraw ) + uint32_t diIndex, plDrawableSpans *destDraw ) { plDISpanIndex spanList = destDraw->GetDISpans( diIndex ); if( spanList.GetCount() != 1 ) @@ -234,12 +234,12 @@ hsBool plDrawableGenerator::RegenerateDrawable( UInt32 vertCount, hsPoint3 *posi // Static function that creates a new drawable based on the vertex/index // data given. -plDrawableSpans *plDrawableGenerator::GenerateDrawable( UInt32 vertCount, hsPoint3 *positions, hsVector3 *normals, - hsPoint3 *uvws, UInt32 uvwsPerVtx, +plDrawableSpans *plDrawableGenerator::GenerateDrawable( uint32_t vertCount, hsPoint3 *positions, hsVector3 *normals, + hsPoint3 *uvws, uint32_t uvwsPerVtx, hsColorRGBA *origColors, hsBool fauxShade, const hsColorRGBA* multColor, - UInt32 numIndices, UInt16 *indices, + uint32_t numIndices, uint16_t *indices, hsGMaterial *material, const hsMatrix44 &localToWorld, hsBool blended, - hsTArray *retIndex, plDrawableSpans *toAddTo ) + hsTArray *retIndex, plDrawableSpans *toAddTo ) { plDrawableSpans *newDraw; hsTArray spanArray; @@ -250,7 +250,7 @@ plDrawableSpans *plDrawableGenerator::GenerateDrawable( UInt32 vertCount, hsPoin newDraw = toAddTo; else { - newDraw = TRACKED_NEW plDrawableSpans; + newDraw = new plDrawableSpans; // newDraw->SetNativeProperty( plDrawable::kPropVolatile, true ); if( blended ) { @@ -265,7 +265,7 @@ plDrawableSpans *plDrawableGenerator::GenerateDrawable( UInt32 vertCount, hsPoin // Create a temp plGeometrySpan spanArray.SetCount( 1 ); - span = spanArray[ 0 ] = TRACKED_NEW plGeometrySpan; + span = spanArray[ 0 ] = new plGeometrySpan; IFillSpan( vertCount, positions, normals, uvws, uvwsPerVtx, @@ -275,8 +275,8 @@ plDrawableSpans *plDrawableGenerator::GenerateDrawable( UInt32 vertCount, hsPoin span ); /// Now add the span to the new drawable, clear up the span's buffers and return! - UInt32 trash = UInt32(-1); - UInt32 idx = newDraw->AppendDISpans( spanArray, trash, false ); + uint32_t trash = uint32_t(-1); + uint32_t idx = newDraw->AppendDISpans( spanArray, trash, false ); if( retIndex != nil ) retIndex->Append(idx); @@ -285,15 +285,15 @@ plDrawableSpans *plDrawableGenerator::GenerateDrawable( UInt32 vertCount, hsPoin //// GenerateSphericalDrawable /////////////////////////////////////////////// -plDrawableSpans *plDrawableGenerator::GenerateSphericalDrawable( const hsPoint3& pos, hsScalar radius, hsGMaterial *material, +plDrawableSpans *plDrawableGenerator::GenerateSphericalDrawable( const hsPoint3& pos, float radius, hsGMaterial *material, const hsMatrix44 &localToWorld, hsBool blended, const hsColorRGBA* multColor, - hsTArray *retIndex, plDrawableSpans *toAddTo, - hsScalar qualityScalar ) + hsTArray *retIndex, plDrawableSpans *toAddTo, + float qualityScalar ) { hsTArray points; hsTArray normals; - hsTArray indices; + hsTArray indices; hsTArray colors; hsPoint3 point; hsVector3 normal; @@ -313,13 +313,13 @@ plDrawableSpans *plDrawableGenerator::GenerateSphericalDrawable( const hsPoi /// Generate points for( i = 0; i <= numDivisions; i++ ) { - angle = (float)i * ( hsScalarPI ) / (float)numDivisions; + angle = (float)i * ( M_PI ) / (float)numDivisions; hsFastMath::SinCosInRange( angle, internRad, z ); internRad *= radius; for( j = 0; j < numDivisions; j++ ) { - angle = (float)j * ( 2 * hsScalarPI ) / (float)numDivisions; + angle = (float)j * ( 2 * M_PI ) / (float)numDivisions; hsFastMath::SinCosInRange( angle, x, y ); point.Set( pos.fX + x * internRad, pos.fY + y * internRad, pos.fZ + z * radius ); @@ -366,10 +366,10 @@ plDrawableSpans *plDrawableGenerator::GenerateSphericalDrawable( const hsPoi //// GenerateBoxDrawable ///////////////////////////////////////////////////// -plDrawableSpans *plDrawableGenerator::GenerateBoxDrawable( hsScalar width, hsScalar height, hsScalar depth, +plDrawableSpans *plDrawableGenerator::GenerateBoxDrawable( float width, float height, float depth, hsGMaterial *material, const hsMatrix44 &localToWorld, hsBool blended, const hsColorRGBA* multColor, - hsTArray *retIndex, plDrawableSpans *toAddTo ) + hsTArray *retIndex, plDrawableSpans *toAddTo ) { hsVector3 xVec, yVec, zVec; hsPoint3 pt; @@ -392,11 +392,11 @@ plDrawableSpans *plDrawableGenerator::GenerateBoxDrawable( hsScalar width, h plDrawableSpans *plDrawableGenerator::GenerateBoxDrawable( const hsPoint3 &corner, const hsVector3 &xVec, const hsVector3 &yVec, const hsVector3 &zVec, hsGMaterial *material, const hsMatrix44 &localToWorld, hsBool blended, const hsColorRGBA* multColor, - hsTArray *retIndex, plDrawableSpans *toAddTo ) + hsTArray *retIndex, plDrawableSpans *toAddTo ) { hsTArray points; hsTArray normals; - hsTArray indices; + hsTArray indices; hsTArray colors; hsTArray uvws; hsPoint3 point; @@ -475,11 +475,11 @@ plDrawableSpans *plDrawableGenerator::GenerateBoxDrawable( const hsPoint3 &c plDrawableSpans *plDrawableGenerator::GenerateBoundsDrawable( hsBounds3Ext *bounds, hsGMaterial *material, const hsMatrix44 &localToWorld, hsBool blended, const hsColorRGBA* multColor, - hsTArray *retIndex, plDrawableSpans *toAddTo ) + hsTArray *retIndex, plDrawableSpans *toAddTo ) { hsTArray points; hsTArray normals; - hsTArray indices; + hsTArray indices; hsTArray colors; hsPoint3 point; hsVector3 normal; @@ -536,10 +536,10 @@ plDrawableSpans *plDrawableGenerator::GenerateBoundsDrawable( hsBounds3Ext * //// GenerateConicalDrawable ///////////////////////////////////////////////// -plDrawableSpans *plDrawableGenerator::GenerateConicalDrawable( hsScalar radius, hsScalar height, hsGMaterial *material, +plDrawableSpans *plDrawableGenerator::GenerateConicalDrawable( float radius, float height, hsGMaterial *material, const hsMatrix44 &localToWorld, hsBool blended, const hsColorRGBA* multColor, - hsTArray *retIndex, plDrawableSpans *toAddTo ) + hsTArray *retIndex, plDrawableSpans *toAddTo ) { hsVector3 direction; @@ -554,14 +554,14 @@ plDrawableSpans *plDrawableGenerator::GenerateConicalDrawable( hsScalar radi //// GenerateConicalDrawable ///////////////////////////////////////////////// -plDrawableSpans *plDrawableGenerator::GenerateConicalDrawable( hsPoint3 &apex, hsVector3 &direction, hsScalar radius, hsGMaterial *material, +plDrawableSpans *plDrawableGenerator::GenerateConicalDrawable( hsPoint3 &apex, hsVector3 &direction, float radius, hsGMaterial *material, const hsMatrix44 &localToWorld, hsBool blended, const hsColorRGBA* multColor, - hsTArray *retIndex, plDrawableSpans *toAddTo ) + hsTArray *retIndex, plDrawableSpans *toAddTo ) { hsTArray points; hsTArray normals; - hsTArray indices; + hsTArray indices; hsTArray colors; hsPoint3 point; hsVector3 normal; @@ -603,7 +603,7 @@ plDrawableSpans *plDrawableGenerator::GenerateConicalDrawable( hsPoint3 &ape normals.Append( -direction ); for( i = 0; i < numDivisions; i++ ) { - angle = (float)i * ( hsScalarPI * 2.f ) / (float)numDivisions; + angle = (float)i * ( M_PI * 2.f ) / (float)numDivisions; hsFastMath::SinCosInRange( angle, x, y ); points.Append( baseCenter + ( xVec * x * radius ) + ( yVec * y * radius ) ); @@ -644,12 +644,12 @@ plDrawableSpans *plDrawableGenerator::GenerateConicalDrawable( hsPoint3 &ape plDrawableSpans *plDrawableGenerator::GenerateAxesDrawable( hsGMaterial *material, const hsMatrix44 &localToWorld, hsBool blended, const hsColorRGBA* multColor, - hsTArray *retIndex, plDrawableSpans *toAddTo ) + hsTArray *retIndex, plDrawableSpans *toAddTo ) { hsTArray points; hsTArray normals; hsTArray colors; - hsTArray indices; + hsTArray indices; int i; float size = 15; @@ -715,11 +715,11 @@ plDrawableSpans *plDrawableGenerator::GenerateAxesDrawable( hsGMaterial *mat plDrawableSpans *plDrawableGenerator::GeneratePlanarDrawable( const hsPoint3 &corner, const hsVector3 &xVec, const hsVector3 &yVec, hsGMaterial *material, const hsMatrix44 &localToWorld, hsBool blended, const hsColorRGBA* multColor, - hsTArray *retIndex, plDrawableSpans *toAddTo ) + hsTArray *retIndex, plDrawableSpans *toAddTo ) { hsTArray points; hsTArray normals; - hsTArray indices; + hsTArray indices; hsTArray colors; hsTArray uvws; hsPoint3 point; diff --git a/Sources/Plasma/PubUtilLib/plDrawable/plDrawableGenerator.h b/Sources/Plasma/PubUtilLib/plDrawable/plDrawableGenerator.h index 10521fe0..f46d6a4e 100644 --- a/Sources/Plasma/PubUtilLib/plDrawable/plDrawableGenerator.h +++ b/Sources/Plasma/PubUtilLib/plDrawable/plDrawableGenerator.h @@ -76,76 +76,76 @@ class plDrawableGenerator // Refills a drawable previously created with GenerateDrawable with the new data. New data // must match previous data in counts. - hsBool RegenerateDrawable( UInt32 vertCount, hsPoint3 *positions, hsVector3 *normals, - hsPoint3 *uvws, UInt32 uvwsPerVtx, + hsBool RegenerateDrawable( uint32_t vertCount, hsPoint3 *positions, hsVector3 *normals, + hsPoint3 *uvws, uint32_t uvwsPerVtx, hsColorRGBA *origColors, hsBool fauxShade, const hsColorRGBA* multColor, - UInt32 numIndices, UInt16 *indices, + uint32_t numIndices, uint16_t *indices, hsGMaterial *material, const hsMatrix44 &localToWorld, hsBool blended, - UInt32 diIndex, plDrawableSpans *destDraw ); + uint32_t diIndex, plDrawableSpans *destDraw ); // Generates a drawable based on the vertex/index data given // uvws is an array vertCount*uvwsPerVtx long in order [uvw(s) for vtx0, uvw(s) for vtx1, ...], or is nil - static plDrawableSpans *GenerateDrawable( UInt32 vertCount, hsPoint3 *positions, hsVector3 *normals, - hsPoint3 *uvws, UInt32 uvwsPerVtx, + static plDrawableSpans *GenerateDrawable( uint32_t vertCount, hsPoint3 *positions, hsVector3 *normals, + hsPoint3 *uvws, uint32_t uvwsPerVtx, hsColorRGBA *origColors, hsBool fauxShade, const hsColorRGBA* multColor, - UInt32 numIndices, UInt16 *indices, + uint32_t numIndices, uint16_t *indices, hsGMaterial *material, const hsMatrix44 &localToWorld, hsBool blended = false, - hsTArray *retIndex = nil, plDrawableSpans *toAddTo = nil ); + hsTArray *retIndex = nil, plDrawableSpans *toAddTo = nil ); // Generates a spherical drawable - static plDrawableSpans *GenerateSphericalDrawable( const hsPoint3& localPos, hsScalar radius, hsGMaterial *material, + static plDrawableSpans *GenerateSphericalDrawable( const hsPoint3& localPos, float radius, hsGMaterial *material, const hsMatrix44 &localToWorld, hsBool blended = false, const hsColorRGBA* multColor = nil, - hsTArray *retIndex = nil, plDrawableSpans *toAddTo = nil, - hsScalar qualityScalar = 1.f ); + hsTArray *retIndex = nil, plDrawableSpans *toAddTo = nil, + float qualityScalar = 1.f ); // Generates a rectangular drawable - static plDrawableSpans *GenerateBoxDrawable( hsScalar width, hsScalar height, hsScalar depth, + static plDrawableSpans *GenerateBoxDrawable( float width, float height, float depth, hsGMaterial *material, const hsMatrix44 &localToWorld, hsBool blended = false, const hsColorRGBA* multColor = nil, - hsTArray *retIndex = nil, plDrawableSpans *toAddTo = nil ); + hsTArray *retIndex = nil, plDrawableSpans *toAddTo = nil ); // Generate a rectangular drawable based on a corner and three vectors static plDrawableSpans *GenerateBoxDrawable( const hsPoint3 &corner, const hsVector3 &xVec, const hsVector3 &yVec, const hsVector3 &zVec, hsGMaterial *material, const hsMatrix44 &localToWorld, hsBool blended = false, const hsColorRGBA* multColor = nil, - hsTArray *retIndex = nil, plDrawableSpans *toAddTo = nil ); + hsTArray *retIndex = nil, plDrawableSpans *toAddTo = nil ); // Generates a bounds-based drawable static plDrawableSpans *GenerateBoundsDrawable( hsBounds3Ext *bounds, hsGMaterial *material, const hsMatrix44 &localToWorld, hsBool blended = false, const hsColorRGBA* multColor = nil, - hsTArray *retIndex = nil, plDrawableSpans *toAddTo = nil ); + hsTArray *retIndex = nil, plDrawableSpans *toAddTo = nil ); // Generates a conical drawable - static plDrawableSpans *GenerateConicalDrawable( hsScalar radius, hsScalar height, hsGMaterial *material, + static plDrawableSpans *GenerateConicalDrawable( float radius, float height, hsGMaterial *material, const hsMatrix44 &localToWorld, hsBool blended = false, const hsColorRGBA* multColor = nil, - hsTArray *retIndex = nil, plDrawableSpans *toAddTo = nil ); + hsTArray *retIndex = nil, plDrawableSpans *toAddTo = nil ); // Generates a general conical drawable based on a center and direction - static plDrawableSpans *GenerateConicalDrawable( hsPoint3 &apex, hsVector3 &direction, hsScalar radius, hsGMaterial *material, + static plDrawableSpans *GenerateConicalDrawable( hsPoint3 &apex, hsVector3 &direction, float radius, hsGMaterial *material, const hsMatrix44 &localToWorld, hsBool blended = false, const hsColorRGBA* multColor = nil, - hsTArray *retIndex = nil, plDrawableSpans *toAddTo = nil ); + hsTArray *retIndex = nil, plDrawableSpans *toAddTo = nil ); // Generates a drawable representing 3 axes static plDrawableSpans *GenerateAxesDrawable( hsGMaterial *material, const hsMatrix44 &localToWorld, hsBool blended = false, const hsColorRGBA* multColor = nil, - hsTArray *retIndex = nil, plDrawableSpans *toAddTo = nil ); + hsTArray *retIndex = nil, plDrawableSpans *toAddTo = nil ); // Generate a planar drawable based on a corner and two vectors static plDrawableSpans *GeneratePlanarDrawable( const hsPoint3 &corner, const hsVector3 &xVec, const hsVector3 &yVec, hsGMaterial *material, const hsMatrix44 &localToWorld, hsBool blended = false, const hsColorRGBA* multColor = nil, - hsTArray *retIndex = nil, plDrawableSpans *toAddTo = nil ); + hsTArray *retIndex = nil, plDrawableSpans *toAddTo = nil ); protected: // Shade the vertices given based on a quick fake directional light. // If origColors is non-nil, it must be an array of length count. Each outColor[i] *= origColor[i]. // If multColor is non-nil, modulate the output by multColor. - static void IQuickShadeVerts( UInt32 count, hsVector3 *normals, + static void IQuickShadeVerts( uint32_t count, hsVector3 *normals, hsColorRGBA *colors, hsColorRGBA* origColors = nil, const hsColorRGBA* multColor = nil ); @@ -153,10 +153,10 @@ class plDrawableGenerator // Take the vertex and connectivity info supplied and fill out a geometry span with it. // Output span is ready to be added to a Drawable, or refreshed in a Drawable if it's // already in the SourceSpans. - static void IFillSpan( UInt32 vertCount, hsPoint3 *positions, hsVector3 *normals, - hsPoint3 *uvws, UInt32 uvwsPerVtx, + static void IFillSpan( uint32_t vertCount, hsPoint3 *positions, hsVector3 *normals, + hsPoint3 *uvws, uint32_t uvwsPerVtx, hsColorRGBA *origColors, hsBool fauxShade, const hsColorRGBA* multColor, - UInt32 numIndices, UInt16 *indices, + uint32_t numIndices, uint16_t *indices, hsGMaterial *material, const hsMatrix44 &localToWorld, hsBool blended, plGeometrySpan* span ); diff --git a/Sources/Plasma/PubUtilLib/plDrawable/plDrawableSpans.cpp b/Sources/Plasma/PubUtilLib/plDrawable/plDrawableSpans.cpp index 60ce5b17..a3199627 100644 --- a/Sources/Plasma/PubUtilLib/plDrawable/plDrawableSpans.cpp +++ b/Sources/Plasma/PubUtilLib/plDrawable/plDrawableSpans.cpp @@ -54,7 +54,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // // ////////////////////////////////////////////////////////////////////////////// -#include "hsTypes.h" +#include "HeadSpin.h" #include "plAccessSpan.h" #include "plAccessTriSpan.h" @@ -105,10 +105,10 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com //// Local Konstants ///////////////////////////////////////////////////////// -const UInt32 plDrawableSpans::kSpanTypeMask = 0xc0000000; -const UInt32 plDrawableSpans::kSpanIDMask = ~kSpanTypeMask; -const UInt32 plDrawableSpans::kSpanTypeIcicle = 0x00000000; -const UInt32 plDrawableSpans::kSpanTypeParticleSpan = 0xc0000000; +const uint32_t plDrawableSpans::kSpanTypeMask = 0xc0000000; +const uint32_t plDrawableSpans::kSpanIDMask = ~kSpanTypeMask; +const uint32_t plDrawableSpans::kSpanTypeIcicle = 0x00000000; +const uint32_t plDrawableSpans::kSpanTypeParticleSpan = 0xc0000000; //// Constructor & Destructor //////////////////////////////////////////////// @@ -204,7 +204,7 @@ void plDrawableSpans::SetSceneNode( plKey newNode ) return; if( newNode ) { - plNodeRefMsg* refMsg = TRACKED_NEW plNodeRefMsg(newNode, plNodeRefMsg::kOnRequest, -1, plNodeRefMsg::kDrawable); + plNodeRefMsg* refMsg = new plNodeRefMsg(newNode, plNodeRefMsg::kOnRequest, -1, plNodeRefMsg::kDrawable); hsgResMgr::ResMgr()->SendRef(GetKey(), refMsg, plRefFlags::kActiveRef); } if( curNode ) @@ -228,7 +228,7 @@ void plDrawableSpans::PrepForRender( plPipeline *p ) if( !fReadyToRender ) { - UInt32 i; + uint32_t i; for( i = 0; i < fGroups.GetCount(); i++ ) { @@ -241,7 +241,7 @@ void plDrawableSpans::PrepForRender( plPipeline *p ) if( fParticleSpans.GetCount() ) { - UInt32 i; + uint32_t i; #if 0 for( i = 0; i < fSpans.GetCount(); i++ ) { @@ -261,7 +261,7 @@ void plDrawableSpans::PrepForRender( plPipeline *p ) } } -void plDrawableSpans::SetDISpanVisSet(UInt32 diIndex, hsKeyedObject* ref, hsBool on) +void plDrawableSpans::SetDISpanVisSet(uint32_t diIndex, hsKeyedObject* ref, hsBool on) { // Could actually do something here to neutralize bones, but we're not. // Main thing is that if it's Matrix Only, then the indices are into @@ -273,7 +273,7 @@ void plDrawableSpans::SetDISpanVisSet(UInt32 diIndex, hsKeyedObject* ref, hsBool if( !reg ) return; hsBool isNot = reg->GetProperty(plVisRegion::kIsNot); - UInt32 visRegIndex = reg->GetIndex(); + uint32_t visRegIndex = reg->GetIndex(); if( isNot ) { @@ -405,7 +405,7 @@ hsBool plDrawableSpans::IBoundsInvalid(const hsBounds3Ext& bnd) const int i; for( i = 0; i < 3; i++ ) { - const hsScalar kLimit(1.e5f); + const float kLimit(1.e5f); if( bnd.GetMaxs()[i] > kLimit ) return true; @@ -490,14 +490,14 @@ plProfile_CreateTimer("DSBndTransT", "Update", DSBndTransT); #endif // MF_TEST_UPDATE -plDrawable& plDrawableSpans::SetTransform( UInt32 index, const hsMatrix44& l2w, const hsMatrix44& w2l ) +plDrawable& plDrawableSpans::SetTransform( uint32_t index, const hsMatrix44& l2w, const hsMatrix44& w2l ) { #ifdef MF_TEST_UPDATE plProfile_IncCount(DSSetTrans, 1); plProfile_BeginTiming(DSSetTransT); #endif // MF_TEST_UPDATE - if( index == (UInt32)-1 ) + if( index == (uint32_t)-1 ) { fLocalToWorld = l2w; fWorldToLocal = w2l; @@ -508,7 +508,7 @@ plDrawable& plDrawableSpans::SetTransform( UInt32 index, const hsMatrix44& l2w, else { int i; - UInt32 idx; + uint32_t idx; plDISpanIndex *spans = fDIIndices[ index ]; @@ -571,11 +571,11 @@ plDrawable& plDrawableSpans::SetTransform( UInt32 index, const hsMatrix44& l2w, if( IBoundsInvalid(mSpan->fWorldBounds) ) { mSpan->fProps |= kPropNoDraw; - GetSpaceTree()->SetLeafFlag((Int16)idx, plSpaceTreeNode::kDisabled, true); + GetSpaceTree()->SetLeafFlag((int16_t)idx, plSpaceTreeNode::kDisabled, true); } else { - GetSpaceTree()->MoveLeaf((Int16)((*spans)[i]), mSpan->fWorldBounds); + GetSpaceTree()->MoveLeaf((int16_t)((*spans)[i]), mSpan->fWorldBounds); } #ifdef MF_TEST_UPDATE plProfile_EndTiming(DSBndTransT); @@ -600,9 +600,9 @@ plDrawable& plDrawableSpans::SetTransform( UInt32 index, const hsMatrix44& l2w, return *this; } -void plDrawableSpans::SetNativeTransform(UInt32 idx, const hsMatrix44& l2w, const hsMatrix44& w2l) +void plDrawableSpans::SetNativeTransform(uint32_t idx, const hsMatrix44& l2w, const hsMatrix44& w2l) { - if( idx == UInt32(-1) ) + if( idx == uint32_t(-1) ) { hsAssert(false, "Invalid index to SetNativeTransform"); } @@ -627,24 +627,24 @@ void plDrawableSpans::SetNativeTransform(UInt32 idx, const hsMatrix44& l2w, cons } else { - GetSpaceTree()->MoveLeaf((Int16)idx, span->fWorldBounds); + GetSpaceTree()->MoveLeaf((int16_t)idx, span->fWorldBounds); } } } //// GetLocalToWorld & GetWorldToLocal /////////////////////////////////////// -const hsMatrix44& plDrawableSpans::GetLocalToWorld( UInt32 span ) const +const hsMatrix44& plDrawableSpans::GetLocalToWorld( uint32_t span ) const { - if( span == (UInt32)-1 ) + if( span == (uint32_t)-1 ) return fLocalToWorld; return fSpans[ span ]->fLocalToWorld; } -const hsMatrix44& plDrawableSpans::GetWorldToLocal( UInt32 span ) const +const hsMatrix44& plDrawableSpans::GetWorldToLocal( uint32_t span ) const { - if( span == (UInt32)-1 ) + if( span == (uint32_t)-1 ) return fWorldToLocal; return fSpans[ span ]->fWorldToLocal; @@ -653,12 +653,12 @@ const hsMatrix44& plDrawableSpans::GetWorldToLocal( UInt32 span ) const //// Set/GetNativeProperty /////////////////////////////////////////////////// -plDrawable& plDrawableSpans::SetNativeProperty( UInt32 index, int prop, hsBool on) +plDrawable& plDrawableSpans::SetNativeProperty( uint32_t index, int prop, hsBool on) { int i; - if( index == (UInt32)-1 ) + if( index == (uint32_t)-1 ) { hsAssert(false, "Invalid index to SetNativeProperty"); } @@ -681,7 +681,7 @@ plDrawable& plDrawableSpans::SetNativeProperty( UInt32 index, int prop, hsBool o if( (prop & kPropNoDraw) ) { for( i = 0; i < spans->GetCount(); i++ ) - GetSpaceTree()->SetLeafFlag((Int16)((*spans)[ i ]), plSpaceTreeNode::kDisabled, on); + GetSpaceTree()->SetLeafFlag((int16_t)((*spans)[ i ]), plSpaceTreeNode::kDisabled, on); } } } @@ -689,13 +689,13 @@ plDrawable& plDrawableSpans::SetNativeProperty( UInt32 index, int prop, hsBool o return *this; } -hsBool plDrawableSpans::GetNativeProperty( UInt32 index, int prop ) const +hsBool plDrawableSpans::GetNativeProperty( uint32_t index, int prop ) const { int i; - UInt32 ret = false; + uint32_t ret = false; - if( index == (UInt32)-1 ) + if( index == (uint32_t)-1 ) { for( i = 0; i < fSpans.GetCount(); i++ ) ret |= ( fSpans[ i ]->fProps & prop ); @@ -714,9 +714,9 @@ hsBool plDrawableSpans::GetNativeProperty( UInt32 index, int prop ) const return ret != 0; } -plDrawable& plDrawableSpans::SetSubType(UInt32 index, plSubDrawableType t, hsBool on) +plDrawable& plDrawableSpans::SetSubType(uint32_t index, plSubDrawableType t, hsBool on) { - if( UInt32(-1) == index ) + if( uint32_t(-1) == index ) { if( on ) { @@ -751,11 +751,11 @@ plDrawable& plDrawableSpans::SetSubType(UInt32 index, plSubDrawableType t, hsBoo return *this; } -UInt32 plDrawableSpans::GetSubType(UInt32 index) const +uint32_t plDrawableSpans::GetSubType(uint32_t index) const { - UInt32 retVal = 0; + uint32_t retVal = 0; - if( UInt32(-1) == index ) + if( uint32_t(-1) == index ) { int i; for( i = 0; i < fSpans.GetCount(); i++ ) @@ -775,9 +775,9 @@ UInt32 plDrawableSpans::GetSubType(UInt32 index) const //// IXlateSpanProps ///////////////////////////////////////////////////////// // Never used yet--just here in case we ever need it -UInt32 plDrawableSpans::IXlateSpanProps( UInt32 props, hsBool xlateToSpan ) +uint32_t plDrawableSpans::IXlateSpanProps( uint32_t props, hsBool xlateToSpan ) { - UInt32 retProps = 0; + uint32_t retProps = 0; if( xlateToSpan ) @@ -801,7 +801,7 @@ UInt32 plDrawableSpans::IXlateSpanProps( UInt32 props, hsBool xlateToSpan ) // flag taken in is from plDrawInterface, not our props flags. So we have to // translate... -plDrawable& plDrawableSpans::SetProperty( UInt32 index, int diProp, hsBool on ) +plDrawable& plDrawableSpans::SetProperty( uint32_t index, int diProp, hsBool on ) { switch( diProp ) { @@ -814,7 +814,7 @@ plDrawable& plDrawableSpans::SetProperty( UInt32 index, int diProp, hsBool on ) return *this; } -hsBool plDrawableSpans::GetProperty( UInt32 index, int diProp ) const +hsBool plDrawableSpans::GetProperty( uint32_t index, int diProp ) const { switch( diProp ) { @@ -866,13 +866,13 @@ hsBool plDrawableSpans::GetProperty( int prop ) const //// Get*Bounds ////////////////////////////////////////////////////////////// -const hsBounds3Ext& plDrawableSpans::GetLocalBounds( UInt32 index ) const +const hsBounds3Ext& plDrawableSpans::GetLocalBounds( uint32_t index ) const { int i; static hsBounds3Ext bnd; - if( index == (UInt32)-1 ) + if( index == (uint32_t)-1 ) return fLocalBounds; plDISpanIndex *spans = fDIIndices[ index ]; @@ -889,13 +889,13 @@ const hsBounds3Ext& plDrawableSpans::GetLocalBounds( UInt32 index ) const return bnd; } -const hsBounds3Ext& plDrawableSpans::GetWorldBounds( UInt32 index ) const +const hsBounds3Ext& plDrawableSpans::GetWorldBounds( uint32_t index ) const { int i; static hsBounds3Ext bnd; - if( index == (UInt32)-1 ) + if( index == (uint32_t)-1 ) return fWorldBounds; plDISpanIndex *spans = fDIIndices[ index ]; @@ -912,7 +912,7 @@ const hsBounds3Ext& plDrawableSpans::GetWorldBounds( UInt32 index ) const return bnd; } -const hsBounds3Ext& plDrawableSpans::GetMaxWorldBounds( UInt32 index ) const +const hsBounds3Ext& plDrawableSpans::GetMaxWorldBounds( uint32_t index ) const { return GetWorldBounds( index ); } @@ -926,7 +926,7 @@ const hsBounds3Ext& plDrawableSpans::GetMaxWorldBounds( UInt32 index ) const void plDrawableSpans::Read( hsStream* s, hsResMgr* mgr ) { - UInt32 i, j, count, count2; + uint32_t i, j, count, count2; hsBool gotSkin = false; plGBufferGroup *group; plRefMsg *refMsg; @@ -943,7 +943,7 @@ void plDrawableSpans::Read( hsStream* s, hsResMgr* mgr ) fMaterials.SetCountAndZero( count ); for( i = 0; i < count; i++ ) { - refMsg = TRACKED_NEW plGenRefMsg( GetKey(), plRefMsg::kOnCreate, i, kMsgMaterial ); + refMsg = new plGenRefMsg( GetKey(), plRefMsg::kOnCreate, i, kMsgMaterial ); mgr->ReadKeyNotifyMe( s, refMsg, plRefFlags::kActiveRef ); } @@ -991,7 +991,7 @@ void plDrawableSpans::Read( hsStream* s, hsResMgr* mgr ) for( i = 0; i < count; i++ ) { // Ref message for the fog environment - refMsg = TRACKED_NEW plGenRefMsg( GetKey(), plRefMsg::kOnCreate, i, kMsgFogEnviron ); + refMsg = new plGenRefMsg( GetKey(), plRefMsg::kOnCreate, i, kMsgFogEnviron ); mgr->ReadKeyNotifyMe( s, refMsg, plRefFlags::kActiveRef ); } @@ -1013,20 +1013,20 @@ void plDrawableSpans::Read( hsStream* s, hsResMgr* mgr ) { if( fSpans[i]->fProps & plSpan::kPropHasPermaLights ) { - UInt32 lcnt = s->ReadLE32(); + uint32_t lcnt = s->ReadLE32(); int j; for( j = 0; j < lcnt; j++ ) { - mgr->ReadKeyNotifyMe( s, TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnCreate, i, kMsgPermaLight), plRefFlags::kPassiveRef); + mgr->ReadKeyNotifyMe( s, new plGenRefMsg(GetKey(), plRefMsg::kOnCreate, i, kMsgPermaLight), plRefFlags::kPassiveRef); } } if( fSpans[i]->fProps & plSpan::kPropHasPermaProjs ) { - UInt32 lcnt = s->ReadLE32(); + uint32_t lcnt = s->ReadLE32(); int j; for( j = 0; j < lcnt; j++ ) { - mgr->ReadKeyNotifyMe( s, TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnCreate, i, kMsgPermaProj), plRefFlags::kPassiveRef); + mgr->ReadKeyNotifyMe( s, new plGenRefMsg(GetKey(), plRefMsg::kOnCreate, i, kMsgPermaProj), plRefFlags::kPassiveRef); } } } @@ -1038,7 +1038,7 @@ void plDrawableSpans::Read( hsStream* s, hsResMgr* mgr ) fSourceSpans.SetCount( count ); for( i = 0; i < count; i++ ) { - fSourceSpans[ i ] = TRACKED_NEW plGeometrySpan; + fSourceSpans[ i ] = new plGeometrySpan; fSourceSpans[ i ]->Read( s ); fSourceSpans[ i ]->fMaterial = GetMaterial( fSpans[ i ]->fMaterialIdx ); fSourceSpans[ i ]->fFogEnviron = fSpans[ i ]->fFogEnvironment; @@ -1068,9 +1068,9 @@ void plDrawableSpans::Read( hsStream* s, hsResMgr* mgr ) fDIIndices.SetCountAndZero( count ); for( i = 0; i < count; i++ ) { - fDIIndices[ i ] = TRACKED_NEW plDISpanIndex; + fDIIndices[ i ] = new plDISpanIndex; - fDIIndices[ i ]->fFlags = (UInt8)(s->ReadLE32()); + fDIIndices[ i ]->fFlags = (uint8_t)(s->ReadLE32()); count2 = s->ReadLE32(); fDIIndices[ i ]->SetCountAndZero( count2 ); for( j = 0; j < count2; j++ ) @@ -1081,7 +1081,7 @@ void plDrawableSpans::Read( hsStream* s, hsResMgr* mgr ) count = s->ReadLE32(); while( count-- ) { - group = TRACKED_NEW plGBufferGroup(0, fProps & kPropVolatile, fProps & kPropSortFaces); + group = new plGBufferGroup(0, fProps & kPropVolatile, fProps & kPropSortFaces); group->Read( s ); fGroups.Append( group ); @@ -1098,7 +1098,7 @@ void plDrawableSpans::Read( hsStream* s, hsResMgr* mgr ) fSpaceTree = plSpaceTree::ConvertNoRef(mgr->ReadCreatable(s)); fSceneNode = mgr->ReadKey(s); - plNodeRefMsg* nRefMsg = TRACKED_NEW plNodeRefMsg(fSceneNode, plRefMsg::kOnCreate, -1, plNodeRefMsg::kDrawable); + plNodeRefMsg* nRefMsg = new plNodeRefMsg(fSceneNode, plRefMsg::kOnCreate, -1, plNodeRefMsg::kDrawable); mgr->AddViaNotify(GetKey(), nRefMsg, plRefFlags::kActiveRef); if( GetNativeProperty(plDrawable::kPropCharacter) ) @@ -1193,7 +1193,7 @@ hsBool plDrawableSpans::MsgReceive( plMessage* msg ) } else if( refMsg->GetContext() & (plRefMsg::kOnDestroy|plRefMsg::kOnRemove) ) { - UInt32 i; + uint32_t i; plFogEnvironment *fog = plFogEnvironment::ConvertNoRef( refMsg->GetRef() ); for( i = 0; i < GetNumSpans(); i++ ) @@ -1354,14 +1354,14 @@ hsBool plDrawableSpans::MsgReceive( plMessage* msg ) } else /// plDrawInterface telling us to remove some spans { - RemoveDISpans( (Int32)diMsg->fIndex ); + RemoveDISpans( (int32_t)diMsg->fIndex ); } } #ifdef HS_DEBUGGING else if( diMsg->fType == plDISpansMsg::kAddingSpan ) { /// plDrawInterface telling us which spans it owns - Int32 i, spanIndex = (Int32)diMsg->fIndex; + int32_t i, spanIndex = (int32_t)diMsg->fIndex; if( spanIndex == -1 ) return true; @@ -1473,24 +1473,24 @@ void plDrawableSpans::SetSpaceTree( plSpaceTree *st ) const //// GetDISpans ////////////////////////////////////////////////////////////// -plDISpanIndex& plDrawableSpans::GetDISpans( UInt32 index ) const +plDISpanIndex& plDrawableSpans::GetDISpans( uint32_t index ) const { return *fDIIndices[index]; } //// GetVertex/IndexRef ////////////////////////////////////////////////////// -hsGDeviceRef *plDrawableSpans::GetVertexRef( UInt32 group, UInt32 idx ) +hsGDeviceRef *plDrawableSpans::GetVertexRef( uint32_t group, uint32_t idx ) { return fGroups[ group ]->GetVertexBufferRef( idx ); } -hsGDeviceRef *plDrawableSpans::GetIndexRef( UInt32 group, UInt32 idx ) +hsGDeviceRef *plDrawableSpans::GetIndexRef( uint32_t group, uint32_t idx ) { return fGroups[ group ]->GetIndexBufferRef( idx ); } -void plDrawableSpans::DirtyVertexBuffer(UInt32 group, UInt32 idx) +void plDrawableSpans::DirtyVertexBuffer(uint32_t group, uint32_t idx) { hsAssert(group < fGroups.GetCount(), "Dirtying vtx buffer I don't have"); GetBufferGroup(group)->DirtyVertexBuffer(idx); @@ -1498,7 +1498,7 @@ void plDrawableSpans::DirtyVertexBuffer(UInt32 group, UInt32 idx) SetNotReadyToRender(); } -void plDrawableSpans::DirtyIndexBuffer(UInt32 group, UInt32 idx) +void plDrawableSpans::DirtyIndexBuffer(uint32_t group, uint32_t idx) { hsAssert(group < fGroups.GetCount(), "Dirtying index buffer I don't have"); GetBufferGroup(group)->DirtyIndexBuffer(idx); @@ -1512,7 +1512,7 @@ hsGMaterial* plDrawableSpans::GetSubMaterial(int index) const } // return true if span invisible before minDist and/or after maxDist -hsBool plDrawableSpans::GetSubVisDists(int index, hsScalar& minDist, hsScalar& maxDist) const +hsBool plDrawableSpans::GetSubVisDists(int index, float& minDist, float& maxDist) const { return (minDist = fSpans[index]->GetMinDist()) < (maxDist = fSpans[index]->GetMaxDist()); } @@ -1529,7 +1529,7 @@ plProfile_CreateTimer("Face Sort", "Draw", FaceSort); plProfile_CreateCounter("Face Sort Calls", "Draw", FaceSortCalls); plProfile_CreateCounter("Faces Sorted", "Draw", FacesSorted); -void plDrawableSpans::SortSpan( UInt32 index, plPipeline *pipe ) +void plDrawableSpans::SortSpan( uint32_t index, plPipeline *pipe ) { plProfile_Inc(FaceSortCalls); @@ -1537,15 +1537,15 @@ void plDrawableSpans::SortSpan( UInt32 index, plPipeline *pipe ) plIcicle *span = (plIcicle *)fSpans[ index ]; plGBufferTriangle *list, temp; - UInt32 numTris; + uint32_t numTris; int i; hsMatrix44 w2cMatrix = pipe->GetWorldToCamera() * pipe->GetLocalToWorld(); - hsScalar dist; + float dist; ICheckSpanForSortable(index); static hsTArray sortList; - static hsTArray tempTriList; + static hsTArray tempTriList; hsRadixSort::Elem *elem; @@ -1566,7 +1566,7 @@ void plDrawableSpans::SortSpan( UInt32 index, plPipeline *pipe ) plProfile_BeginLap(FaceSort, "1"); hsVector3 vec(w2cMatrix.fMap[2][0], w2cMatrix.fMap[2][1], w2cMatrix.fMap[2][2]); - hsScalar trans = w2cMatrix.fMap[2][3]; + float trans = w2cMatrix.fMap[2][3]; // Fill out the radix sort elements with our data for( i = 0; i < numTris; i++ ) @@ -1588,7 +1588,7 @@ void plDrawableSpans::SortSpan( UInt32 index, plPipeline *pipe ) plProfile_EndLap(FaceSort, "2"); plProfile_BeginLap(FaceSort, "3"); - UInt16* indices = tempTriList.AcquireArray(); + uint16_t* indices = tempTriList.AcquireArray(); // Stuff into the temp array for( i = 0, elem = sortedList; i < numTris; i++ ) { @@ -1623,7 +1623,7 @@ void plDrawableSpans::SortSpan( UInt32 index, plPipeline *pipe ) // front display. // Updated 5.14.2001 mcn - Fixed so loops don't assume spans are icicles -void plDrawableSpans::SortVisibleSpans(const hsTArray& visList, plPipeline* pipe) +void plDrawableSpans::SortVisibleSpans(const hsTArray& visList, plPipeline* pipe) { #define MF_CHUNKSORT #ifndef MF_CHUNKSORT @@ -1635,9 +1635,9 @@ void plDrawableSpans::SortVisibleSpans(const hsTArray& visList, plPipelin static hsLargeArray sortScratch; - static hsLargeArray triList; - static hsTArray counters; - static hsTArray startIndex; + static hsLargeArray triList; + static hsTArray counters; + static hsTArray startIndex; int i; @@ -1720,7 +1720,7 @@ void plDrawableSpans::SortVisibleSpans(const hsTArray& visList, plPipelin int j; for( j = 0; j < nTris; j++ ) { - hsScalar dist = -(viewPos - list[j].fCenter).MagnitudeSquared(); + float dist = -(viewPos - list[j].fCenter).MagnitudeSquared(); elem[cnt].fKey.fFloat = dist; elem[cnt].fBody = &list[j]; elem[cnt].fNext = elem + cnt + 1; @@ -1747,7 +1747,7 @@ void plDrawableSpans::SortVisibleSpans(const hsTArray& visList, plPipelin plGBufferTriangle* data = (plGBufferTriangle*)sortedList->fBody; plIcicle* span = (plIcicle*)fSpans[data->fSpanIndex]; - UInt16* idx = &triList[startIndex[data->fSpanIndex] + counters[data->fSpanIndex]]; + uint16_t* idx = &triList[startIndex[data->fSpanIndex] + counters[data->fSpanIndex]]; *idx++ = data->fIndex1; *idx++ = data->fIndex2; *idx++ = data->fIndex3; @@ -1764,14 +1764,14 @@ void plDrawableSpans::SortVisibleSpans(const hsTArray& visList, plPipelin const int kMaxBufferGroups = 20; const int kMaxIndexBuffers = 20; - static Int16 newStarts[kMaxBufferGroups][kMaxIndexBuffers]; + static int16_t newStarts[kMaxBufferGroups][kMaxIndexBuffers]; // Temp hack stuff so we can switch back and forth (to see if it really does any good). static int oldWay = false; static int lastOldWay = oldWay; if( oldWay != lastOldWay ) { - memset(newStarts, 0, kMaxBufferGroups * kMaxIndexBuffers * sizeof(Int16)); + memset(newStarts, 0, kMaxBufferGroups * kMaxIndexBuffers * sizeof(int16_t)); for( i = 0; i < fSpans.GetCount(); i++ ) { @@ -1796,9 +1796,9 @@ void plDrawableSpans::SortVisibleSpans(const hsTArray& visList, plPipelin } else { - memset(newStarts, 0, kMaxBufferGroups * kMaxIndexBuffers * sizeof(Int16)); + memset(newStarts, 0, kMaxBufferGroups * kMaxIndexBuffers * sizeof(int16_t)); - UInt32 start = 0; + uint32_t start = 0; for( i = 0; i < visList.GetCount(); i++ ) { plIcicle* span = (plIcicle*)fSpans[visList[i]]; @@ -1827,9 +1827,9 @@ void plDrawableSpans::SortVisibleSpans(const hsTArray& visList, plPipelin plProfile_BeginTiming(FaceSort); static hsLargeArray sortScratch; - static hsLargeArray triList; - static hsTArray counters; - static hsTArray startIndex; + static hsLargeArray triList; + static hsTArray counters; + static hsTArray startIndex; int i; @@ -1919,7 +1919,7 @@ void plDrawableSpans::SortVisibleSpans(const hsTArray& visList, plPipelin int j; for( j = 0; j < nTris; j++ ) { - hsScalar dist = -(viewPos - list[j].fCenter).MagnitudeSquared(); + float dist = -(viewPos - list[j].fCenter).MagnitudeSquared(); elem[cnt].fKey.fFloat = dist; elem[cnt].fBody = &list[j]; elem[cnt].fNext = elem + cnt + 1; @@ -1947,7 +1947,7 @@ void plDrawableSpans::SortVisibleSpans(const hsTArray& visList, plPipelin plGBufferTriangle* data = (plGBufferTriangle*)sortedList->fBody; plIcicle* span = (plIcicle*)fSpans[data->fSpanIndex]; - UInt16* idx = &triList[startIndex[data->fSpanIndex] + counters[data->fSpanIndex]]; + uint16_t* idx = &triList[startIndex[data->fSpanIndex] + counters[data->fSpanIndex]]; *idx++ = data->fIndex1; *idx++ = data->fIndex2; *idx++ = data->fIndex3; @@ -1966,13 +1966,13 @@ void plDrawableSpans::SortVisibleSpans(const hsTArray& visList, plPipelin const int kMaxBufferGroups = 20; const int kMaxIndexBuffers = 20; - static Int16 newStarts[kMaxBufferGroups][kMaxIndexBuffers]; + static int16_t newStarts[kMaxBufferGroups][kMaxIndexBuffers]; hsAssert(kMaxBufferGroups >= GetNumBufferGroups(), "Bigger than we counted on num groups sort."); - memset(newStarts, 0, kMaxBufferGroups * kMaxIndexBuffers * sizeof(Int16)); + memset(newStarts, 0, kMaxBufferGroups * kMaxIndexBuffers * sizeof(int16_t)); - UInt32 start = 0; + uint32_t start = 0; for( i = 0; i < visList.GetCount(); i++ ) { plIcicle* span = (plIcicle*)fSpans[visList[i]]; @@ -1984,7 +1984,7 @@ void plDrawableSpans::SortVisibleSpans(const hsTArray& visList, plPipelin /// Now send them on to the buffer group span->fIPackedIdx = span->fIStartIdx = newStarts[span->fGroupIdx][span->fIBufferIdx]; - newStarts[span->fGroupIdx][span->fIBufferIdx] += (Int16)(span->fILength); + newStarts[span->fGroupIdx][span->fIBufferIdx] += (int16_t)(span->fILength); fGroups[ span->fGroupIdx ]->StuffFromTriList( span->fIBufferIdx, span->fIStartIdx, span->fILength / 3, triList.AcquireArray() + startIndex[visList[i]]); } @@ -2018,7 +2018,7 @@ struct buffTriCmpFrontToBack : public std::binary_function& visList, plPipeline* pipe) +void plDrawableSpans::SortVisibleSpansPartial(const hsTArray& visList, plPipeline* pipe) { plProfile_Inc(FaceSortCalls); @@ -2042,7 +2042,7 @@ void plDrawableSpans::SortVisibleSpansPartial(const hsTArray& visList, pl const int numTris = span->fILength/3; std::sort(span->fSortData, span->fSortData+numTris, buffTriCmpBackToFront(viewPos)); - UInt16* idx = fGroups[span->fGroupIdx]->GetIndexBufferData(span->fIBufferIdx) + span->fIStartIdx; + uint16_t* idx = fGroups[span->fGroupIdx]->GetIndexBufferData(span->fIBufferIdx) + span->fIStartIdx; plGBufferTriangle* iter = span->fSortData; int j; for( j = 0; j < numTris; j++ ) @@ -2063,7 +2063,7 @@ void plDrawableSpans::SortVisibleSpansPartial(const hsTArray& visList, pl #if 0 -void plDrawableSpans::SortVisibleSpansUnit(const hsTArray& visList, plPipeline* pipe) +void plDrawableSpans::SortVisibleSpansUnit(const hsTArray& visList, plPipeline* pipe) { plProfile_Inc(FaceSortCalls); @@ -2072,7 +2072,7 @@ void plDrawableSpans::SortVisibleSpansUnit(const hsTArray& visList, plPip plProfile_BeginTiming(FaceSort); - static hsLargeArray triList; + static hsLargeArray triList; int i; @@ -2110,10 +2110,10 @@ void plDrawableSpans::SortVisibleSpansUnit(const hsTArray& visList, plPip struct sortFace { - UInt16 fIndex0; - UInt16 fIndex1; - UInt16 fIndex2; - hsScalar fDist; + uint16_t fIndex0; + uint16_t fIndex1; + uint16_t fIndex2; + float fDist; }; static hsLargeArray sortList; @@ -2126,7 +2126,7 @@ void plDrawableSpans::SortVisibleSpansUnit(const hsTArray& visList, plPip }; hsPoint3 viewPos = fSpans[visList[0]]->fWorldToLocal * pipe->GetViewPositionWorld(); - hsScalar dist1 = (fViewPos - face1->fCenter).MagnitudeSquared(); + float dist1 = (fViewPos - face1->fCenter).MagnitudeSquared(); // First figure out the total number of tris to deal with. sortList.SetCount(0); @@ -2161,7 +2161,7 @@ void plDrawableSpans::SortVisibleSpansUnit(const hsTArray& visList, plPip triList.SetCount(sortList.GetCount()); - UInt16* pTri = triList.AcquireArray(); + uint16_t* pTri = triList.AcquireArray(); while( pBegin < pEnd ) { @@ -2176,7 +2176,7 @@ void plDrawableSpans::SortVisibleSpansUnit(const hsTArray& visList, plPip plProfile_EndLap(FaceSort, "0"); - UInt32 start = 0; + uint32_t start = 0; for( i = 0; i < visList.GetCount(); i++ ) { plIcicle* span = (plIcicle*)fSpans[visList[i]]; @@ -2208,13 +2208,13 @@ void plDrawableSpans::SetInitialBone(int i, const hsMatrix44& l2b, const hsMatri // whether it's setting the transform for some drawable data it owns, or just // setting one of the matrices which influence the drawable data someone else // owns. -UInt32 plDrawableSpans::AppendDIMatrixSpans(int n) +uint32_t plDrawableSpans::AppendDIMatrixSpans(int n) { /// Do garbage cleanup first if( fNeedCleanup ) IRemoveGarbage(); - UInt32 baseIdx = fLocalToWorlds.GetCount(); + uint32_t baseIdx = fLocalToWorlds.GetCount(); fLocalToWorlds.Expand(baseIdx + n); fLocalToWorlds.SetCount(baseIdx + n); fWorldToLocals.Expand(baseIdx + n); @@ -2245,7 +2245,7 @@ UInt32 plDrawableSpans::AppendDIMatrixSpans(int n) // and the transform of the object being skinned. In general, objects can only // share a palette set if they have been flattened into world space (the object's // transform is identity). Fortunately, this is a common case. -UInt32 plDrawableSpans::FindBoneBaseMatrix(const hsTArray& initL2B, hsBool searchAll) const +uint32_t plDrawableSpans::FindBoneBaseMatrix(const hsTArray& initL2B, hsBool searchAll) const { if (!searchAll) { @@ -2284,10 +2284,10 @@ UInt32 plDrawableSpans::FindBoneBaseMatrix(const hsTArray& initL2B, return i; } } - return UInt32(-1); + return uint32_t(-1); } -UInt32 plDrawableSpans::NewDIMatrixIndex() +uint32_t plDrawableSpans::NewDIMatrixIndex() { int index; /// Do we have a free lookup entry? @@ -2297,7 +2297,7 @@ UInt32 plDrawableSpans::NewDIMatrixIndex() break; } if( index == fDIIndices.GetCount() ) - fDIIndices.Append( TRACKED_NEW plDISpanIndex ); + fDIIndices.Append( new plDISpanIndex ); fDIIndices[index]->Reset(); fDIIndices[index]->fFlags = plDISpanIndex::kMatrixOnly; @@ -2309,13 +2309,13 @@ UInt32 plDrawableSpans::NewDIMatrixIndex() // Finds the given DIIndices array and returns a pointer to it, or creates // a new one if requested -plDISpanIndex *plDrawableSpans::IFindDIIndices( UInt32 &index ) +plDISpanIndex *plDrawableSpans::IFindDIIndices( uint32_t &index ) { plDISpanIndex *spanLookup; /// Do we have a free lookup entry? - if( index == (UInt32)-1 ) // new index + if( index == (uint32_t)-1 ) // new index { for( index = 0; index < fDIIndices.GetCount(); index++ ) { @@ -2323,7 +2323,7 @@ plDISpanIndex *plDrawableSpans::IFindDIIndices( UInt32 &index ) break; } if( index == fDIIndices.GetCount() ) - fDIIndices.Append( TRACKED_NEW plDISpanIndex ); + fDIIndices.Append( new plDISpanIndex ); spanLookup = fDIIndices[ index ]; spanLookup->fFlags = plDISpanIndex::kNone; @@ -2339,17 +2339,17 @@ plDISpanIndex *plDrawableSpans::IFindDIIndices( UInt32 &index ) // Note: AddDISpans() adds the spans to a list to be sorted, THEN put into // the buffers; this shoves them right in, bypassing the sorting altogether. -UInt32 plDrawableSpans::AppendDISpans( hsTArray &spans, UInt32 index, hsBool clearSpansAfterAdd, +uint32_t plDrawableSpans::AppendDISpans( hsTArray &spans, uint32_t index, hsBool clearSpansAfterAdd, hsBool doNotAddToSource, hsBool addToFront, int lod) { hsAssert(spans.GetCount(), "Adding no spans? Blow me."); int i, j; - UInt32 spanIdx; + uint32_t spanIdx; plSpan *span; hsBounds3Ext bounds; plDISpanIndex *spanLookup; - UInt32 numAddedIcicle = 0; + uint32_t numAddedIcicle = 0; // hsAssert( fProps & kPropVolatile, "Trying to add spans on a non-volatile drawable" ); @@ -2461,9 +2461,9 @@ UInt32 plDrawableSpans::AppendDISpans( hsTArray &spans, UInt3 //// IAddAMaterial /////////////////////////////////////////////////////////// -UInt32 plDrawableSpans::IAddAMaterial( hsGMaterial *material ) +uint32_t plDrawableSpans::IAddAMaterial( hsGMaterial *material ) { - UInt32 i; + uint32_t i; // Scan for if we already have it @@ -2498,12 +2498,12 @@ UInt32 plDrawableSpans::IAddAMaterial( hsGMaterial *material ) // Called if we already have a material index that we just want to use // again... -UInt32 plDrawableSpans::IRefMaterial( UInt32 index ) +uint32_t plDrawableSpans::IRefMaterial( uint32_t index ) { hsGMaterial *material = fMaterials[ index ]; if( GetKey() && material != nil && material->GetKey() != nil ) - hsgResMgr::ResMgr()->AddViaNotify( material->GetKey(), TRACKED_NEW plGenRefMsg( GetKey(), plRefMsg::kOnCreate, index, 0 ), plRefFlags::kActiveRef ); + hsgResMgr::ResMgr()->AddViaNotify( material->GetKey(), new plGenRefMsg( GetKey(), plRefMsg::kOnCreate, index, 0 ), plRefFlags::kActiveRef ); return index; } @@ -2512,7 +2512,7 @@ UInt32 plDrawableSpans::IRefMaterial( UInt32 index ) // Runs through the span array to see if the given material index is still // used. If not, Release()s it and nil's it. -void plDrawableSpans::ICheckToRemoveMaterial( UInt32 materialIdx ) +void plDrawableSpans::ICheckToRemoveMaterial( uint32_t materialIdx ) { int j; hsGMaterial *mat; @@ -2539,8 +2539,8 @@ void plDrawableSpans::ICheckToRemoveMaterial( UInt32 materialIdx ) hsBool plDrawableSpans::IConvertGeoSpanToVertexSpan( plGeometrySpan *geoSpan, plVertexSpan *span, int lod, plVertexSpan *instancedParent) { hsBounds3Ext bounds; - UInt8 groupIdx; - UInt32 vbIndex, cellIdx, cellOffset; + uint8_t groupIdx; + uint32_t vbIndex, cellIdx, cellOffset; span->fLocalToWorld = geoSpan->fLocalToWorld; @@ -2577,7 +2577,7 @@ hsBool plDrawableSpans::IConvertGeoSpanToVertexSpan( plGeometrySpan *geoSpan, p span->fBaseMatrix = geoSpan->fBaseMatrix; span->fLocalUVWChans = geoSpan->fLocalUVWChans; span->fMaxBoneIdx = geoSpan->fMaxBoneIdx; - span->fPenBoneIdx = (UInt16)(geoSpan->fPenBoneIdx); + span->fPenBoneIdx = (uint16_t)(geoSpan->fPenBoneIdx); span->fMinDist = geoSpan->fMinDist; span->fMaxDist = geoSpan->fMaxDist; @@ -2619,7 +2619,7 @@ hsBool plDrawableSpans::IConvertGeoSpanToVertexSpan( plGeometrySpan *geoSpan, p /// Boooring.... /// Append the colors, but the vertices themselves we don't use, rather we point /// to our parent's verts (or rather, the cell will take care of that for us) - groupIdx = (UInt8)(instancedParent->fGroupIdx); + groupIdx = (uint8_t)(instancedParent->fGroupIdx); fGroups[ groupIdx ]->AppendToColorStorage( geoSpan, &vbIndex, &cellIdx, &cellOffset, instancedParent->fCellIdx ); span->fGroupIdx = groupIdx; @@ -2665,7 +2665,7 @@ hsBool plDrawableSpans::IConvertGeoSpanToVertexSpan( plGeometrySpan *geoSpan, p hsBool plDrawableSpans::IConvertGeoSpanToIcicle(plGeometrySpan *geoSpan, plIcicle *icicle, int lod, plIcicle *instancedParent) { - UInt32 ibIndex, ibStart; + uint32_t ibIndex, ibStart; IConvertGeoSpanToVertexSpan(geoSpan, icicle, lod, instancedParent); @@ -2702,7 +2702,7 @@ hsBool plDrawableSpans::IConvertGeoSpanToIcicle(plGeometrySpan *geoSpan, plIcic // Nuke out a matrix only DI index set someone doesn't need anymore (cuz they're dead). // Since there's no data associated, there's not much to do, except mark the slot as // free and that some cleanup is in order some time. -void plDrawableSpans::RemoveDIMatrixSpans( UInt32 index ) +void plDrawableSpans::RemoveDIMatrixSpans( uint32_t index ) { plDISpanIndex* spanIndices = fDIIndices[ index ]; if( !spanIndices->IsMatrixOnly() ) @@ -2721,7 +2721,7 @@ void plDrawableSpans::RemoveDIMatrixSpans( UInt32 index ) // the spans, deletes the verts/indices associated with the deleted spans // and packs the vertex/index buffers as well. -void plDrawableSpans::RemoveDISpans( UInt32 index ) +void plDrawableSpans::RemoveDISpans( uint32_t index ) { plDISpanIndex *spanIndices = fDIIndices[ index ]; @@ -2730,12 +2730,12 @@ void plDrawableSpans::RemoveDISpans( UInt32 index ) RemoveDIMatrixSpans( index ); } - UInt32 i, j, k, idxRemoving, materialIdx; + uint32_t i, j, k, idxRemoving, materialIdx; // #define MF_RENDDEP #ifdef MF_RENDDEP - hsTArray spanInverseTable; + hsTArray spanInverseTable; spanInverseTable.SetCount(fSpans.GetCount()); for( i = 0; i < fSpans.GetCount(); i++ ) spanInverseTable[i] = i; @@ -2842,7 +2842,7 @@ void plDrawableSpans::RemoveDISpans( UInt32 index ) void plDrawableSpans::IRebuildSpanArray( void ) { - UInt32 j, i; + uint32_t j, i; plIcicle *icicle = nil; @@ -2857,7 +2857,7 @@ void plDrawableSpans::IRebuildSpanArray( void ) { // GOTTA RESET THE SPAN INDICES TOO!!! for( i = 0; i < icicle->fILength / 3; i++ ) - icicle->fSortData[ i ].fSpanIndex = (UInt16)j; + icicle->fSortData[ i ].fSpanIndex = (uint16_t)j; } break; case kSpanTypeParticleSpan: @@ -2947,14 +2947,14 @@ void plDrawableSpans::IRemoveGarbage( void ) for( i = 0; i < fGroups.GetCount(); i++ ) { hsAssert( fGroups[ i ]->GetNumVertexBuffers() == 1, "Cannot clean garbage on a non-volatile buffer group!" ); - usedFlags[ i ] = TRACKED_NEW hsTArray; + usedFlags[ i ] = new hsTArray; usedFlags[ i ]->SetCountAndZero( fGroups[ i ]->GetVertBufferCount( 0 ) ); - usedIdxFlags[ i ] = TRACKED_NEW hsTArray *>; + usedIdxFlags[ i ] = new hsTArray *>; usedIdxFlags[ i ]->SetCount( fGroups[ i ]->GetNumIndexBuffers() ); for( j = 0; j < fGroups[ i ]->GetNumIndexBuffers(); j++ ) { - (*usedIdxFlags[ i ])[ j ] = TRACKED_NEW hsTArray; + (*usedIdxFlags[ i ])[ j ] = new hsTArray; (*usedIdxFlags[ i ])[ j ]->SetCountAndZero( fGroups[ i ]->GetIndexBufferCount( j ) ); } } @@ -3005,7 +3005,7 @@ void plDrawableSpans::IRemoveGarbage( void ) // Adjust indices in this group for( ibIdx = 0; ibIdx < group->GetNumIndexBuffers(); ibIdx++ ) - group->AdjustIndicesInStorage( ibIdx, i, -(Int16)( j - i ) ); + group->AdjustIndicesInStorage( ibIdx, i, -(int16_t)( j - i ) ); // Adjust spans that use this vertex buffer for( k = 0; k < fIcicles.GetCount(); k++ ) @@ -3016,7 +3016,7 @@ void plDrawableSpans::IRemoveGarbage( void ) // Adjust sorting data, if necessary if( fIcicles[ k ].fSortData != nil ) - IAdjustSortData( fIcicles[ k ].fSortData, fIcicles[ k ].fILength / 3, i, -(Int16)( j - i ) ); + IAdjustSortData( fIcicles[ k ].fSortData, fIcicles[ k ].fILength / 3, i, -(int16_t)( j - i ) ); } for( k = 0; k < fParticleSpans.GetCount(); k++ ) { @@ -3026,7 +3026,7 @@ void plDrawableSpans::IRemoveGarbage( void ) // Adjust sorting data, if necessary if( fParticleSpans[ k ].fSortData != nil ) - IAdjustSortData( fParticleSpans[ k ].fSortData, fParticleSpans[ k ].fILength / 3, i, -(Int16)( j - i ) ); + IAdjustSortData( fParticleSpans[ k ].fSortData, fParticleSpans[ k ].fILength / 3, i, -(int16_t)( j - i ) ); } // Move the flags too, lest we start deleting the wrong vertices @@ -3156,19 +3156,19 @@ void plDrawableSpans::IRemoveGarbage( void ) // Adjusts the indices in the given sort data, using the delta and threshhold // given. -void plDrawableSpans::IAdjustSortData( plGBufferTriangle *triList, UInt32 count, UInt32 threshhold, Int32 delta ) +void plDrawableSpans::IAdjustSortData( plGBufferTriangle *triList, uint32_t count, uint32_t threshhold, int32_t delta ) { - UInt32 i; + uint32_t i; for( i = 0; i < count; i++ ) { if( triList[ i ].fIndex1 >= threshhold ) - triList[ i ].fIndex1 = (UInt16)( triList[ i ].fIndex1 + delta ); + triList[ i ].fIndex1 = (uint16_t)( triList[ i ].fIndex1 + delta ); if( triList[ i ].fIndex2 >= threshhold ) - triList[ i ].fIndex2 = (UInt16)( triList[ i ].fIndex2 + delta ); + triList[ i ].fIndex2 = (uint16_t)( triList[ i ].fIndex2 + delta ); if( triList[ i ].fIndex3 >= threshhold ) - triList[ i ].fIndex3 = (UInt16)( triList[ i ].fIndex3 + delta ); + triList[ i ].fIndex3 = (uint16_t)( triList[ i ].fIndex3 + delta ); } } @@ -3176,7 +3176,7 @@ void plDrawableSpans::IAdjustSortData( plGBufferTriangle *triList, UInt32 cou // Given an index of a span, flags it sortable and creates the sorting data // for that span. -void plDrawableSpans::IMakeSpanSortable( UInt32 index ) +void plDrawableSpans::IMakeSpanSortable( uint32_t index ) { plIcicle *span = (plIcicle *)fSpans[ index ]; plGBufferTriangle *list; @@ -3186,7 +3186,7 @@ void plDrawableSpans::IMakeSpanSortable( UInt32 index ) return; /// Create data for it - list = fGroups[ span->fGroupIdx ]->ConvertToTriList( (Int16)index, span->fIBufferIdx, span->fVBufferIdx, span->fCellIdx, + list = fGroups[ span->fGroupIdx ]->ConvertToTriList( (int16_t)index, span->fIBufferIdx, span->fVBufferIdx, span->fCellIdx, span->fIStartIdx, span->fILength / 3 ); if( list == nil ) return; @@ -3199,10 +3199,10 @@ void plDrawableSpans::IMakeSpanSortable( UInt32 index ) void plDrawableSpans::UnPackCluster(plClusterGroup* cluster) { - const UInt32 vertsPerInst = cluster->GetTemplate()->NumVerts(); - const UInt32 idxPerInst = cluster->GetTemplate()->NumIndices(); + const uint32_t vertsPerInst = cluster->GetTemplate()->NumVerts(); + const uint32_t idxPerInst = cluster->GetTemplate()->NumIndices(); - const UInt32 numClust = cluster->GetNumClusters(); + const uint32_t numClust = cluster->GetNumClusters(); fVisSet |= cluster->GetVisSet(); fVisNot |= cluster->GetVisNot(); @@ -3214,7 +3214,7 @@ void plDrawableSpans::UnPackCluster(plClusterGroup* cluster) fSpans[iSpan] = &fIcicles[iSpan]; iSpan = 0; - UInt32 vtxFormat = + uint32_t vtxFormat = cluster->GetTemplate()->NumUVWs() | cluster->GetTemplate()->NumWeights() << 4; if( cluster->GetTemplate()->NumWgtIdx() ) @@ -3248,24 +3248,24 @@ void plDrawableSpans::UnPackCluster(plClusterGroup* cluster) // Still in trouble here. We need to fake up that cell crap for each of // our clusters to make a span for it. Whoo-hoo. - UInt8 grpIdx = IFindBufferGroup((UInt8)vtxFormat, numVerts, 0, false, false); + uint8_t grpIdx = IFindBufferGroup((uint8_t)vtxFormat, numVerts, 0, false, false); - UInt32 vbufferIdx; - UInt32 cellIdx; - UInt32 cellOffset; + uint32_t vbufferIdx; + uint32_t cellIdx; + uint32_t cellOffset; fGroups[grpIdx]->ReserveVertStorage(numVerts, &vbufferIdx, &cellIdx, &cellOffset, plGBufferGroup::kReserveInterleaved | plGBufferGroup::kReserveIsolate); hsAssert(!cellOffset, "This should be our own personal group"); hsAssert(fGroups[grpIdx]->GetVertexSize() == cluster->GetTemplate()->Stride(), "Mismatch on src and dst sizes"); - UInt32 ibufferIdx; - UInt32 istartIdx; + uint32_t ibufferIdx; + uint32_t istartIdx; fGroups[grpIdx]->ReserveIndexStorage(numIdx, &ibufferIdx, &istartIdx); - UInt32 iOffset = 0; + uint32_t iOffset = 0; - UInt8* vData = fGroups[grpIdx]->GetVertBufferData(vbufferIdx); - UInt16* iData = fGroups[grpIdx]->GetIndexBufferData(ibufferIdx); - UInt8* pvData = vData; - UInt16* piData = iData; + uint8_t* vData = fGroups[grpIdx]->GetVertBufferData(vbufferIdx); + uint16_t* iData = fGroups[grpIdx]->GetIndexBufferData(ibufferIdx); + uint8_t* pvData = vData; + uint16_t* piData = iData; int i; for( i = iStart; i < iEnd; i++ ) { @@ -3307,19 +3307,19 @@ void plDrawableSpans::UnPackCluster(plClusterGroup* cluster) fIcicles[iSpan].fCellIdx = cellIdx; fIcicles[iSpan].fCellOffset = cellOffset; fIcicles[iSpan].fVStartIdx = cellOffset; - const UInt32 numVerts = cluster->GetCluster(i)->NumInsts() * vertsPerInst; + const uint32_t numVerts = cluster->GetCluster(i)->NumInsts() * vertsPerInst; fIcicles[iSpan].fVLength = numVerts; cellOffset += numVerts; fIcicles[iSpan].fIBufferIdx = ibufferIdx; fIcicles[iSpan].fIPackedIdx = fIcicles[iSpan].fIStartIdx = iOffset; - const UInt32 iLength = cluster->GetCluster(i)->NumInsts() * cluster->GetTemplate()->NumIndices(); + const uint32_t iLength = cluster->GetCluster(i)->NumInsts() * cluster->GetTemplate()->NumIndices(); fIcicles[iSpan].fILength = iLength; iOffset += iLength; iSpan++; - const UInt32 vSize = cluster->GetCluster(i)->NumInsts() * cluster->GetTemplate()->VertSize(); + const uint32_t vSize = cluster->GetCluster(i)->NumInsts() * cluster->GetTemplate()->VertSize(); pvData += vSize; piData += iLength; } @@ -3327,7 +3327,7 @@ void plDrawableSpans::UnPackCluster(plClusterGroup* cluster) iStart = iEnd; } fMaterials.SetCountAndZero(1); - plGenRefMsg* refMsg = TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnCreate, 0, kMsgMaterial); + plGenRefMsg* refMsg = new plGenRefMsg(GetKey(), plRefMsg::kOnCreate, 0, kMsgMaterial); hsgResMgr::ResMgr()->SendRef(cluster->GetMaterial()->GetKey(), refMsg, plRefFlags::kActiveRef); fRenderLevel = cluster->GetRenderLevel(); @@ -3336,7 +3336,7 @@ void plDrawableSpans::UnPackCluster(plClusterGroup* cluster) //// IFindBufferGroup //////////////////////////////////////////////////////// -UInt8 plDrawableSpans::IFindBufferGroup(UInt8 vtxFormat, UInt32 numVertsNeeded, int lod, hsBool vertVolatile, hsBool idxVolatile) +uint8_t plDrawableSpans::IFindBufferGroup(uint8_t vtxFormat, uint32_t numVertsNeeded, int lod, hsBool vertVolatile, hsBool idxVolatile) { int i; @@ -3361,7 +3361,7 @@ UInt8 plDrawableSpans::IFindBufferGroup(UInt8 vtxFormat, UInt32 numVertsNeeded } // Add a new one of the right format - fGroups.Append( TRACKED_NEW plGBufferGroup(vtxFormat, vertVolatile, idxVolatile, lod) ); + fGroups.Append( new plGBufferGroup(vtxFormat, vertVolatile, idxVolatile, lod) ); return i; } @@ -3386,7 +3386,7 @@ hsBitVector const &plDrawableSpans::GetBlendingSpanVector( void ) const // Could just make GetBlendingSpanVector() non-const, but this way it's harder // for the end user, thus I'm hoping to discourage them from doing it too much. -void plDrawableSpans::SetBlendingSpanVectorBit( UInt32 bitNumber, hsBool on ) +void plDrawableSpans::SetBlendingSpanVectorBit( uint32_t bitNumber, hsBool on ) { fFakeBlendingSpanVector.SetBit( bitNumber, on ); } @@ -3436,15 +3436,15 @@ void plDrawableSpans::IBuildVectors( void ) //// CreateParticleSystem //////////////////////////////////////////////////// -UInt32 plDrawableSpans::CreateParticleSystem( UInt32 maxNumSpans, UInt32 maxNumParticles, hsGMaterial *material ) +uint32_t plDrawableSpans::CreateParticleSystem( uint32_t maxNumSpans, uint32_t maxNumParticles, hsGMaterial *material ) { - UInt32 i, numVerts, numIndices; + uint32_t i, numVerts, numIndices; plParticleSet *set; plDISpanIndex *spanLookup; // Make a shiny new set - set = TRACKED_NEW plParticleSet; + set = new plParticleSet; set->fRefCount = 0; /// Fill out info @@ -3465,17 +3465,17 @@ UInt32 plDrawableSpans::CreateParticleSystem( UInt32 maxNumSpans, UInt32 ma set->fVLength = numVerts; set->fILength = numIndices; - UInt32 vIdx = set->fVStartIdx; - UInt16* idx = fGroups[set->fGroupIdx]->GetIndexBufferData(set->fIBufferIdx) + set->fIStartIdx; + uint32_t vIdx = set->fVStartIdx; + uint16_t* idx = fGroups[set->fGroupIdx]->GetIndexBufferData(set->fIBufferIdx) + set->fIStartIdx; for( i = 0; i < maxNumParticles; i++ ) { - *idx++ = (UInt16)vIdx; - *idx++ = (UInt16)(vIdx + 1); - *idx++ = (UInt16)(vIdx + 2); + *idx++ = (uint16_t)vIdx; + *idx++ = (uint16_t)(vIdx + 1); + *idx++ = (uint16_t)(vIdx + 2); - *idx++ = (UInt16)vIdx; - *idx++ = (UInt16)(vIdx + 2); - *idx++ = (UInt16)(vIdx + 3); + *idx++ = (uint16_t)vIdx; + *idx++ = (uint16_t)(vIdx + 2); + *idx++ = (uint16_t)(vIdx + 3); vIdx += 4; } @@ -3527,7 +3527,7 @@ void plDrawableSpans::IAssignMatIdxToSpan( plSpan *span, hsGMaterial *mtl ) plParticleSpan *plDrawableSpans::ICreateParticleIcicle( hsGMaterial *material, plParticleSet *set ) { - UInt32 spanIdx; + uint32_t spanIdx; hsMatrix44 ident; plDISpanIndex *spanLookup; @@ -3589,9 +3589,9 @@ plParticleSpan *plDrawableSpans::ICreateParticleIcicle( hsGMaterial *material, //// ResetParticleSystem ///////////////////////////////////////////////////// -void plDrawableSpans::ResetParticleSystem( UInt32 setIndex ) +void plDrawableSpans::ResetParticleSystem( uint32_t setIndex ) { - UInt32 i; + uint32_t i; plDISpanIndex *indices = IFindDIIndices( setIndex ); plParticleSet *set; plParticleSpan *span; @@ -3607,7 +3607,7 @@ void plDrawableSpans::ResetParticleSystem( UInt32 setIndex ) span->fILength = 0; span->fSource = nil; span->fProps |= plSpan::kPropNoDraw; - GetSpaceTree()->SetLeafFlag( (Int16)(span->fSrcSpanIdx), plSpaceTreeNode::kDisabled ); + GetSpaceTree()->SetLeafFlag( (int16_t)(span->fSrcSpanIdx), plSpaceTreeNode::kDisabled ); set = span->fParentSet; // To use at the end of the loop } @@ -3624,12 +3624,12 @@ void plDrawableSpans::ResetParticleSystem( UInt32 setIndex ) //// AssignEmitterToParticleSystem /////////////////////////////////////////// -void plDrawableSpans::AssignEmitterToParticleSystem( UInt32 setIndex, plParticleEmitter *emitter ) +void plDrawableSpans::AssignEmitterToParticleSystem( uint32_t setIndex, plParticleEmitter *emitter ) { plDISpanIndex *indices = IFindDIIndices( setIndex ); plParticleSet *set; plParticleSpan *icicle; - UInt32 i, index, numParticles = emitter->GetParticleCount(); + uint32_t i, index, numParticles = emitter->GetParticleCount(); plParticleCore *array = emitter->GetParticleArray(); hsMatrix44 ident; @@ -3647,7 +3647,7 @@ void plDrawableSpans::AssignEmitterToParticleSystem( UInt32 setIndex, plParti icicle->fILength = numParticles * 6; icicle->fSource = emitter; icicle->fProps &= ~plSpan::kPropNoDraw; - GetSpaceTree()->ClearLeafFlag( (Int16)(icicle->fSrcSpanIdx), plSpaceTreeNode::kDisabled ); + GetSpaceTree()->ClearLeafFlag( (int16_t)(icicle->fSrcSpanIdx), plSpaceTreeNode::kDisabled ); icicle->fNumParticles = numParticles; set->fNextVStartIdx += numParticles * 4; set->fNextIStartIdx += numParticles * 6; @@ -3666,7 +3666,7 @@ void plDrawableSpans::AssignEmitterToParticleSystem( UInt32 setIndex, plParti if( icicle->fSortData == nil || icicle->fSortCount < ( numParticles << 1 ) ) { delete [] icicle->fSortData; - icicle->fSortData = sortArray = TRACKED_NEW plGBufferTriangle[ numParticles << 1 ]; + icicle->fSortData = sortArray = new plGBufferTriangle[ numParticles << 1 ]; icicle->fSortCount = numParticles << 1; } else @@ -3676,17 +3676,17 @@ void plDrawableSpans::AssignEmitterToParticleSystem( UInt32 setIndex, plParti for( i = 0, index = icicle->fVStartIdx; i < numParticles; i++ ) { sortArray->fCenter = array[ i ].fPos; - sortArray->fIndex1 = (UInt16)index; - sortArray->fIndex2 = (UInt16)(index + 1); - sortArray->fIndex3 = (UInt16)(index + 2); - sortArray->fSpanIndex = (UInt16)(icicle->fSrcSpanIdx); + sortArray->fIndex1 = (uint16_t)index; + sortArray->fIndex2 = (uint16_t)(index + 1); + sortArray->fIndex3 = (uint16_t)(index + 2); + sortArray->fSpanIndex = (uint16_t)(icicle->fSrcSpanIdx); sortArray++; sortArray->fCenter = array[ i ].fPos; - sortArray->fIndex1 = (UInt16)index; - sortArray->fIndex2 = (UInt16)(index + 2); - sortArray->fIndex3 = (UInt16)(index + 3); - sortArray->fSpanIndex = (UInt16)(icicle->fSrcSpanIdx); + sortArray->fIndex1 = (uint16_t)index; + sortArray->fIndex2 = (uint16_t)(index + 2); + sortArray->fIndex3 = (uint16_t)(index + 3); + sortArray->fSpanIndex = (uint16_t)(icicle->fSrcSpanIdx); sortArray++; index += 4; @@ -3696,7 +3696,7 @@ void plDrawableSpans::AssignEmitterToParticleSystem( UInt32 setIndex, plParti icicle->fLocalBounds = emitter->GetBoundingBox(); icicle->fWorldBounds = icicle->fLocalBounds; - GetSpaceTree()->MoveLeaf( (Int16)(icicle->fSrcSpanIdx), icicle->fWorldBounds ); + GetSpaceTree()->MoveLeaf( (int16_t)(icicle->fSrcSpanIdx), icicle->fWorldBounds ); // Done for now, we'll fill on the pipeline side return; @@ -3713,16 +3713,16 @@ void plDrawableSpans::AssignEmitterToParticleSystem( UInt32 setIndex, plParti //MFREPACK // don't need to pass in spans, they're already in fSourceSpans. // clearSpansAfterRefresh is ignored anyway, nuke it. -UInt32 plDrawableSpans::RefreshDISpans( UInt32 index ) +uint32_t plDrawableSpans::RefreshDISpans( uint32_t index ) { int i; - UInt32 spanIdx; + uint32_t spanIdx; plSpan *span; hsBounds3Ext bounds; plDISpanIndex *spanLookup; // hsAssert( fProps & kPropVolatile, "Trying to add spans on a non-volatile drawable" ); - hsAssert( index != (UInt32)-1, "Invalid DI span index" ); + hsAssert( index != (uint32_t)-1, "Invalid DI span index" ); /// Do garbage cleanup first if( fNeedCleanup ) @@ -3762,9 +3762,9 @@ UInt32 plDrawableSpans::RefreshDISpans( UInt32 index ) } // Same as above, but takes an actual span index (not a DI Index). -UInt32 plDrawableSpans::RefreshSpan( UInt32 index ) +uint32_t plDrawableSpans::RefreshSpan( uint32_t index ) { - UInt32 spanIdx; + uint32_t spanIdx; plSpan *span; hsBounds3Ext bounds; @@ -3883,14 +3883,14 @@ hsVector3& plDrawableSpans::GetNormal(int spanIdx, int vtxIdx) return fGroups[span->fGroupIdx]->Normal(span->fVBufferIdx, span->fCellIdx, vtxIdx); } -UInt32 plDrawableSpans::GetNumTris(int spanIdx) +uint32_t plDrawableSpans::GetNumTris(int spanIdx) { hsAssert(fSpans[spanIdx]->fTypeMask & plSpan::kIcicleSpan, "Asking for index info on non-triangle based span"); plIcicle* span = (plIcicle*)fSpans[spanIdx]; return fGroups[span->fGroupIdx]->GetIndexBufferCount(span->fIBufferIdx) / 3; } -UInt16* plDrawableSpans::GetIndexList(int spanIdx) +uint16_t* plDrawableSpans::GetIndexList(int spanIdx) { hsAssert(fSpans[spanIdx]->fTypeMask & plSpan::kIcicleSpan, "Asking for index info on non-triangle based span"); plIcicle* span = (plIcicle*)fSpans[spanIdx]; @@ -3904,21 +3904,21 @@ hsPoint3& plDrawableSpans::CvtGetPosition(int spanIdx, int vtxIdx) hsVector3& plDrawableSpans::CvtGetNormal(int spanIdx, int vtxIdx) { - // Normal follows the position (+ 12bytes) + // Normal follows the position (+ 12Bytes) return *(hsVector3*)(fSourceSpans[spanIdx]->fVertexData + vtxIdx * plGeometrySpan::GetVertexSize(fSourceSpans[spanIdx]->fFormat) + 12); } -UInt32 plDrawableSpans::CvtGetNumTris(int spanIdx) +uint32_t plDrawableSpans::CvtGetNumTris(int spanIdx) { return fSourceSpans[spanIdx]->fNumIndices / 3; } -UInt16* plDrawableSpans::CvtGetIndexList(int spanIdx) +uint16_t* plDrawableSpans::CvtGetIndexList(int spanIdx) { return fSourceSpans[spanIdx]->fIndexData; } -UInt32 plDrawableSpans::CvtGetNumVerts(int spanIdx) const +uint32_t plDrawableSpans::CvtGetNumVerts(int spanIdx) const { return fSourceSpans[spanIdx]->fNumVerts; } @@ -3928,7 +3928,7 @@ plGeometrySpan* plDrawableSpans::GetGeometrySpan(int spanIdx) return fSourceSpans[spanIdx]; } -void plDrawableSpans::GetOrigGeometrySpans( UInt32 diIndex, hsTArray &arrayToFill ) +void plDrawableSpans::GetOrigGeometrySpans( uint32_t diIndex, hsTArray &arrayToFill ) { if( diIndex >= fDIIndices.GetCount() ) { @@ -3937,7 +3937,7 @@ void plDrawableSpans::GetOrigGeometrySpans( UInt32 diIndex, hsTArray fIndices; + uint8_t fFlags; + hsTArray fIndices; hsBool IsMatrixOnly() const { return 0 != (fFlags & kMatrixOnly); } hsBool DontTransform() const { return 0 != ( fFlags & kDontTransformSpans ); } - void Append(UInt32 i) { fIndices.Append(i); } + void Append(uint32_t i) { fIndices.Append(i); } void Reset() { fFlags = kNone; fIndices.Reset(); } void SetCountAndZero(int c) { fIndices.SetCountAndZero(c); } - UInt32 GetCount() const { return fIndices.GetCount(); } - UInt32& operator[](int i) const { return fIndices[i]; } + uint32_t GetCount() const { return fIndices.GetCount(); } + uint32_t& operator[](int i) const { return fIndices[i]; } }; struct hsColorRGBA; @@ -115,12 +115,12 @@ class plDrawableSpans : public plDrawable { protected: - static const UInt32 kSpanTypeMask; - static const UInt32 kSpanIDMask; - static const UInt32 kSpanTypeIcicle; - static const UInt32 kSpanTypeParticleSpan; + static const uint32_t kSpanTypeMask; + static const uint32_t kSpanIDMask; + static const uint32_t kSpanTypeIcicle; + static const uint32_t kSpanTypeParticleSpan; - UInt32 fType; + uint32_t fType; hsBool fReadyToRender; @@ -151,12 +151,12 @@ class plDrawableSpans : public plDrawable hsTArray fParticleSpans; hsTArray fSpans; // Pointers into the above two arrays - hsTArray fSpanSourceIndices; // For volatile drawables only + hsTArray fSpanSourceIndices; // For volatile drawables only hsTArray fGroups; hsTArray fDIIndices; - UInt32 fProps; - UInt32 fCriteria; + uint32_t fProps; + uint32_t fCriteria; plRenderLevel fRenderLevel; plLoadMask fLoadMask; @@ -171,7 +171,7 @@ class plDrawableSpans : public plDrawable hsBool fSettingMatIdxLock; - UInt32 fSkinTime; + uint32_t fSkinTime; /// Export-only members hsTArray fSourceSpans; @@ -184,7 +184,7 @@ class plDrawableSpans : public plDrawable void ICleanupMatrices(); void IRemoveGarbage( void ); - void IAdjustSortData( plGBufferTriangle *triList, UInt32 count, UInt32 threshhold, Int32 delta ); + void IAdjustSortData( plGBufferTriangle *triList, uint32_t count, uint32_t threshhold, int32_t delta ); // The following two functions return true if they create a new span, false if it's just an instance hsBool IConvertGeoSpanToVertexSpan( plGeometrySpan *geoSpan, plVertexSpan *span, int lod, plVertexSpan *instancedParent ); @@ -193,11 +193,11 @@ class plDrawableSpans : public plDrawable void IUpdateIcicleFromGeoSpan( plGeometrySpan *geoSpan, plIcicle *icicle ); void IUpdateVertexSpanFromGeoSpan( plGeometrySpan *geoSpan, plVertexSpan *span ); - UInt32 IXlateSpanProps( UInt32 props, hsBool xlateToSpan ); + uint32_t IXlateSpanProps( uint32_t props, hsBool xlateToSpan ); - UInt32 IAddAMaterial( hsGMaterial *material ); - UInt32 IRefMaterial( UInt32 index ); - void ICheckToRemoveMaterial( UInt32 materialIdx ); + uint32_t IAddAMaterial( hsGMaterial *material ); + uint32_t IRefMaterial( uint32_t index ); + void ICheckToRemoveMaterial( uint32_t materialIdx ); // Annoying to need this, but necessary until materials can test for properties on any of their layers (might add in the future) hsBool ITestMatForSpecularity( hsGMaterial *mat ); @@ -205,8 +205,8 @@ class plDrawableSpans : public plDrawable void IAssignMatIdxToSpan( plSpan *span, hsGMaterial *mtl ); // Create the sorting data for a given span and flag it as sortable - void ICheckSpanForSortable( UInt32 idx ) { if( !(fSpans[idx]->fProps & plSpan::kPropFacesSortable) )IMakeSpanSortable(idx); } - void IMakeSpanSortable( UInt32 index ); + void ICheckSpanForSortable( uint32_t idx ) { if( !(fSpans[idx]->fProps & plSpan::kPropFacesSortable) )IMakeSpanSortable(idx); } + void IMakeSpanSortable( uint32_t index ); /// Bit vector build thingies virtual void IBuildVectors( void ); @@ -221,13 +221,13 @@ class plDrawableSpans : public plDrawable // Compare two spans for sorting short ICompareSpans( plGeometrySpan *span1, plGeometrySpan *span2 ); // Find a buffer group of the given format (returns its index into fGroups) - UInt8 IFindBufferGroup( UInt8 vtxFormat, UInt32 numVertsNeeded, int lod, hsBool vertVolatile, hsBool idxVolatile); + uint8_t IFindBufferGroup( uint8_t vtxFormat, uint32_t numVertsNeeded, int lod, hsBool vertVolatile, hsBool idxVolatile); // Write a span to a stream void IWriteSpan( hsStream *s, plSpan *span ); /// EXPORT-ONLY FUNCTIONS /// DYNAMIC FUNCTIONS - plDISpanIndex *IFindDIIndices( UInt32 &index ); + plDISpanIndex *IFindDIIndices( uint32_t &index ); void IRebuildSpanArray( void ); plParticleSpan *ICreateParticleIcicle( hsGMaterial *material, plParticleSet *set ); @@ -240,13 +240,13 @@ class plDrawableSpans : public plDrawable CLASSNAME_REGISTER( plDrawableSpans ); GETINTERFACE_ANY( plDrawableSpans, plDrawable ); - virtual void SetNativeTransform(UInt32 idx, const hsMatrix44& l2w, const hsMatrix44& w2l); - virtual plDrawable& SetTransform( UInt32 index, const hsMatrix44& l2w, const hsMatrix44& w2l); - virtual const hsMatrix44& GetLocalToWorld( UInt32 index = (UInt32)-1 ) const; - virtual const hsMatrix44& GetWorldToLocal( UInt32 index = (UInt32)-1 ) const; + virtual void SetNativeTransform(uint32_t idx, const hsMatrix44& l2w, const hsMatrix44& w2l); + virtual plDrawable& SetTransform( uint32_t index, const hsMatrix44& l2w, const hsMatrix44& w2l); + virtual const hsMatrix44& GetLocalToWorld( uint32_t index = (uint32_t)-1 ) const; + virtual const hsMatrix44& GetWorldToLocal( uint32_t index = (uint32_t)-1 ) const; - virtual plDrawable& SetProperty( UInt32 index, int prop, hsBool on ); - virtual hsBool GetProperty( UInt32 index, int prop ) const; + virtual plDrawable& SetProperty( uint32_t index, int prop, hsBool on ); + virtual hsBool GetProperty( uint32_t index, int prop ) const; virtual plDrawable& SetProperty( int prop, hsBool on ); virtual hsBool GetProperty( int prop ) const; @@ -254,21 +254,21 @@ class plDrawableSpans : public plDrawable virtual plDrawable& SetNativeProperty( int prop, hsBool on ) { if( on ) fProps |= prop; else fProps &= ~prop; return *this; } virtual hsBool GetNativeProperty( int prop ) const { return ( fProps & prop ) ? true : false; } - virtual plDrawable& SetNativeProperty( UInt32 index, int prop, hsBool on ); - virtual hsBool GetNativeProperty( UInt32 index, int prop ) const; + virtual plDrawable& SetNativeProperty( uint32_t index, int prop, hsBool on ); + virtual hsBool GetNativeProperty( uint32_t index, int prop ) const; - virtual plDrawable& SetSubType( UInt32 index, plSubDrawableType t, hsBool on ); - virtual UInt32 GetSubType( UInt32 index ) const; // returns or of all spans with this index (index==-1 is all spans). + virtual plDrawable& SetSubType( uint32_t index, plSubDrawableType t, hsBool on ); + virtual uint32_t GetSubType( uint32_t index ) const; // returns or of all spans with this index (index==-1 is all spans). - virtual UInt32 GetType( void ) const { return fType; } - virtual void SetType( UInt32 type ) { fType = type; } + virtual uint32_t GetType( void ) const { return fType; } + virtual void SetType( uint32_t type ) { fType = type; } virtual void SetRenderLevel(const plRenderLevel& l); virtual const plRenderLevel& GetRenderLevel() const; - const hsBounds3Ext& GetLocalBounds( UInt32 index = (UInt32)-1 ) const; - const hsBounds3Ext& GetWorldBounds( UInt32 index = (UInt32)-1 ) const; - const hsBounds3Ext& GetMaxWorldBounds( UInt32 index = (UInt32)-1 ) const; + const hsBounds3Ext& GetLocalBounds( uint32_t index = (uint32_t)-1 ) const; + const hsBounds3Ext& GetWorldBounds( uint32_t index = (uint32_t)-1 ) const; + const hsBounds3Ext& GetMaxWorldBounds( uint32_t index = (uint32_t)-1 ) const; virtual void Read(hsStream* s, hsResMgr* mgr); virtual void Write(hsStream* s, hsResMgr* mgr); @@ -276,11 +276,11 @@ class plDrawableSpans : public plDrawable virtual plSpaceTree* GetSpaceTree() const { if(!fSpaceTree)IQuickSpaceTree(); return fSpaceTree; } virtual void SetSpaceTree(plSpaceTree* st) const; virtual void SetVisSet(plVisMgr* visMgr); - virtual void SetDISpanVisSet(UInt32 diIndex, hsKeyedObject* reg, hsBool on); + virtual void SetDISpanVisSet(uint32_t diIndex, hsKeyedObject* reg, hsBool on); - virtual const plSpan *GetSpan( UInt32 index ) const { return fSpans[ index ]; } - virtual const plSpan *GetSpan( UInt32 diIndex, UInt32 index ) const { return fSpans[ (*fDIIndices[ diIndex ])[ index ] ]; } - virtual const UInt32 GetNumSpans( void ) const { return fSpans.GetCount(); } + virtual const plSpan *GetSpan( uint32_t index ) const { return fSpans[ index ]; } + virtual const plSpan *GetSpan( uint32_t diIndex, uint32_t index ) const { return fSpans[ (*fDIIndices[ diIndex ])[ index ] ]; } + virtual const uint32_t GetNumSpans( void ) const { return fSpans.GetCount(); } virtual const hsTArray &GetSpanArray( void ) const { return fSpans; } hsMatrix44* GetMatrixPalette(int baseMatrix) const { return &fLocalToWorlds[baseMatrix]; } @@ -288,17 +288,17 @@ class plDrawableSpans : public plDrawable void SetInitialBone(int i, const hsMatrix44& l2b, const hsMatrix44& b2l); // Get the vertex buffer ref of a given group - hsGDeviceRef *GetVertexRef( UInt32 group, UInt32 idx ); + hsGDeviceRef *GetVertexRef( uint32_t group, uint32_t idx ); // Get the index buffer ref of a given group - hsGDeviceRef *GetIndexRef( UInt32 group, UInt32 idx ); + hsGDeviceRef *GetIndexRef( uint32_t group, uint32_t idx ); // BufferGroups accessed only by Pipeline and it's close personal acquaintances. - plGBufferGroup* GetBufferGroup(UInt32 i) const { return fGroups[i]; } - UInt32 GetNumBufferGroups() const { return fGroups.GetCount(); } + plGBufferGroup* GetBufferGroup(uint32_t i) const { return fGroups[i]; } + uint32_t GetNumBufferGroups() const { return fGroups.GetCount(); } const hsTArray& GetSourceSpans() const { return fSourceSpans; } - void DirtyVertexBuffer(UInt32 group, UInt32 idx); - void DirtyIndexBuffer(UInt32 group, UInt32 idx); + void DirtyVertexBuffer(uint32_t group, uint32_t idx); + void DirtyIndexBuffer(uint32_t group, uint32_t idx); // Prepare all internal data structures for rendering virtual void PrepForRender( plPipeline *p ); @@ -311,8 +311,8 @@ class plDrawableSpans : public plDrawable virtual void SetSceneNode(plKey newNode); // Lookup a material in the material array - hsGMaterial *GetMaterial( UInt32 index ) const { return ( ( index == (UInt32)-1 ) ? nil : fMaterials[ index ] ); } - UInt32 GetNumMaterials( void ) const { return fMaterials.GetCount(); } + hsGMaterial *GetMaterial( uint32_t index ) const { return ( ( index == (uint32_t)-1 ) ? nil : fMaterials[ index ] ); } + uint32_t GetNumMaterials( void ) const { return fMaterials.GetCount(); } // Convert intermediate data into export/run-time-ready data virtual void Optimize( void ); @@ -328,62 +328,62 @@ class plDrawableSpans : public plDrawable virtual hsBitVector const &GetBlendingSpanVector( void ) const; // Set a single bit in the bitVector of spans that are blending - virtual void SetBlendingSpanVectorBit( UInt32 bitNumber, hsBool on ); + virtual void SetBlendingSpanVectorBit( uint32_t bitNumber, hsBool on ); // Taking span index. DI Index doesn't make sense here, because one object's DI can dereference into many materials etc. virtual hsGMaterial* GetSubMaterial(int index) const; - virtual hsBool GetSubVisDists(int index, hsScalar& minDist, hsScalar& maxDist) const; // return true if span invisible before minDist and/or after maxDist + virtual hsBool GetSubVisDists(int index, float& minDist, float& maxDist) const; // return true if span invisible before minDist and/or after maxDist // Used by the pipeline to keep from reskinning on multiple renders per frame. - UInt32 GetSkinTime() const { return fSkinTime; } - void SetSkinTime(UInt32 t) { fSkinTime = t; } + uint32_t GetSkinTime() const { return fSkinTime; } + void SetSkinTime(uint32_t t) { fSkinTime = t; } void UnPackCluster(plClusterGroup* cluster); /// EXPORT-ONLY FUNCTIONS - virtual UInt32 AddDISpans( hsTArray &spans, UInt32 index = (UInt32)-1); - virtual plDISpanIndex& GetDISpans( UInt32 index ) const; + virtual uint32_t AddDISpans( hsTArray &spans, uint32_t index = (uint32_t)-1); + virtual plDISpanIndex& GetDISpans( uint32_t index ) const; // Data Access functions // Runtime hsPoint3& GetPosition(int spanIdx, int vtxIdx); hsVector3& GetNormal(int spanIdx, int vtxIdx); - UInt32 GetNumTris(int spanIdx); - UInt16* GetIndexList(int spanIdx); + uint32_t GetNumTris(int spanIdx); + uint16_t* GetIndexList(int spanIdx); // Conversion (before geometryspans get tossed (at write)). - UInt32 CvtGetNumVerts(int spanIdx) const; + uint32_t CvtGetNumVerts(int spanIdx) const; hsPoint3& CvtGetPosition(int spanIdx, int vtxIdx); hsVector3& CvtGetNormal(int spanIdx, int vtxIdx); - UInt32 CvtGetNumTris(int spanIdx); - UInt16* CvtGetIndexList(int spanIdx); + uint32_t CvtGetNumTris(int spanIdx); + uint16_t* CvtGetIndexList(int spanIdx); plGeometrySpan* GetGeometrySpan(int spanIdx); /// DYNAMIC FUNCTIONS - virtual void RemoveDISpans( UInt32 index ); - virtual UInt32 AppendDISpans( hsTArray &spans, UInt32 index = (UInt32)-1, hsBool clearSpansAfterAdd = true, hsBool doNotAddToSource = false, hsBool addToFront = false, int lod = 0 ); - virtual UInt32 RefreshDISpans( UInt32 diIndex ); - virtual UInt32 RefreshSpan( UInt32 srcSpanIndex ); - virtual void RemoveDIMatrixSpans(UInt32 index); - virtual UInt32 AppendDIMatrixSpans(int n); - virtual UInt32 FindBoneBaseMatrix(const hsTArray& initL2B, hsBool searchAll) const; - virtual UInt32 NewDIMatrixIndex(); - void SortSpan( UInt32 index, plPipeline *pipe ); - void SortVisibleSpans(const hsTArray& visList, plPipeline* pipe); - void SortVisibleSpansPartial(const hsTArray& visList, plPipeline* pipe); + virtual void RemoveDISpans( uint32_t index ); + virtual uint32_t AppendDISpans( hsTArray &spans, uint32_t index = (uint32_t)-1, hsBool clearSpansAfterAdd = true, hsBool doNotAddToSource = false, hsBool addToFront = false, int lod = 0 ); + virtual uint32_t RefreshDISpans( uint32_t diIndex ); + virtual uint32_t RefreshSpan( uint32_t srcSpanIndex ); + virtual void RemoveDIMatrixSpans(uint32_t index); + virtual uint32_t AppendDIMatrixSpans(int n); + virtual uint32_t FindBoneBaseMatrix(const hsTArray& initL2B, hsBool searchAll) const; + virtual uint32_t NewDIMatrixIndex(); + void SortSpan( uint32_t index, plPipeline *pipe ); + void SortVisibleSpans(const hsTArray& visList, plPipeline* pipe); + void SortVisibleSpansPartial(const hsTArray& visList, plPipeline* pipe); void CleanUpGarbage( void ) { IRemoveGarbage(); } /// Funky particle system functions - virtual UInt32 CreateParticleSystem( UInt32 maxNumEmitters, UInt32 maxNumParticles, hsGMaterial *material ); - virtual void ResetParticleSystem( UInt32 index ); - virtual void AssignEmitterToParticleSystem( UInt32 index, plParticleEmitter *emitter ); + virtual uint32_t CreateParticleSystem( uint32_t maxNumEmitters, uint32_t maxNumParticles, hsGMaterial *material ); + virtual void ResetParticleSystem( uint32_t index ); + virtual void AssignEmitterToParticleSystem( uint32_t index, plParticleEmitter *emitter ); /// SceneViewer only! - void GetOrigGeometrySpans( UInt32 diIndex, hsTArray &arrayToFill ); - void ClearAndSetMaterialCount(UInt32 count); + void GetOrigGeometrySpans( uint32_t diIndex, hsTArray &arrayToFill ); + void ClearAndSetMaterialCount(uint32_t count); }; diff --git a/Sources/Plasma/PubUtilLib/plDrawable/plDrawableSpansExport.cpp b/Sources/Plasma/PubUtilLib/plDrawable/plDrawableSpansExport.cpp index bd5866e5..4b690152 100644 --- a/Sources/Plasma/PubUtilLib/plDrawable/plDrawableSpansExport.cpp +++ b/Sources/Plasma/PubUtilLib/plDrawable/plDrawableSpansExport.cpp @@ -49,7 +49,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // // ////////////////////////////////////////////////////////////////////////////// -#include "hsTypes.h" +#include "HeadSpin.h" #include "plDrawableSpans.h" #include "hsStream.h" #include "hsResMgr.h" @@ -79,7 +79,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com void plDrawableSpans::Write( hsStream* s, hsResMgr* mgr ) { - UInt32 i, j, count; + uint32_t i, j, count; // Make sure we're optimized before we write (should be tho) // Optimize(); @@ -115,8 +115,8 @@ void plDrawableSpans::Write( hsStream* s, hsResMgr* mgr ) s->WriteLE32( count ); for( i = 0; i < count; i++ ) { - UInt8 *icicle = (UInt8 *)fSpans[ i ], *base = (UInt8 *)fIcicles.AcquireArray(); - j = (UInt32)( icicle - base ) / sizeof( plIcicle ); + uint8_t *icicle = (uint8_t *)fSpans[ i ], *base = (uint8_t *)fIcicles.AcquireArray(); + j = (uint32_t)( icicle - base ) / sizeof( plIcicle ); s->WriteLE32( j ); } @@ -139,7 +139,7 @@ void plDrawableSpans::Write( hsStream* s, hsResMgr* mgr ) { if( fSpans[i]->fProps & plSpan::kPropHasPermaLights ) { - UInt32 lcnt = fSpans[i]->fPermaLights.GetCount(); + uint32_t lcnt = fSpans[i]->fPermaLights.GetCount(); s->WriteLE32(lcnt); int j; for( j = 0; j < lcnt; j++ ) @@ -147,7 +147,7 @@ void plDrawableSpans::Write( hsStream* s, hsResMgr* mgr ) } if( fSpans[i]->fProps & plSpan::kPropHasPermaProjs ) { - UInt32 lcnt = fSpans[i]->fPermaProjs.GetCount(); + uint32_t lcnt = fSpans[i]->fPermaProjs.GetCount(); s->WriteLE32(lcnt); int j; for( j = 0; j < lcnt; j++ ) @@ -216,10 +216,10 @@ void plDrawableSpans::Write( hsStream* s, hsResMgr* mgr ) // Adds a drawInterface's geometry spans to the list to be collapsed into // buffers. -UInt32 plDrawableSpans::AddDISpans( hsTArray &spans, UInt32 index ) +uint32_t plDrawableSpans::AddDISpans( hsTArray &spans, uint32_t index ) { int i; - UInt32 spanIdx; + uint32_t spanIdx; plSpan *span; hsBounds3Ext bounds; @@ -228,11 +228,11 @@ UInt32 plDrawableSpans::AddDISpans( hsTArray &spans, UInt32 i if( fNeedCleanup ) IRemoveGarbage(); - if (index == (UInt32)-1) // need a new one + if (index == (uint32_t)-1) // need a new one { /// Create a lookup entry index = fDIIndices.GetCount(); - fDIIndices.Append( TRACKED_NEW plDISpanIndex ); + fDIIndices.Append( new plDISpanIndex ); fDIIndices[ index ]->fFlags = plDISpanIndex::kNone; } plDISpanIndex *spanLookup = fDIIndices[ index ]; @@ -276,7 +276,7 @@ UInt32 plDrawableSpans::AddDISpans( hsTArray &spans, UInt32 i span->fBaseMatrix = spans[ i ]->fBaseMatrix; span->fLocalUVWChans = spans[i]->fLocalUVWChans; span->fMaxBoneIdx = spans[i]->fMaxBoneIdx; - span->fPenBoneIdx = (UInt16)(spans[i]->fPenBoneIdx); + span->fPenBoneIdx = (uint16_t)(spans[i]->fPenBoneIdx); bounds = spans[ i ]->fLocalBounds; span->fLocalBounds = bounds; @@ -382,13 +382,13 @@ static void ILogSpan(plStatusLog* statusLog, plGeometrySpan* geo, plVertexSpan* if( geo->fProps & plGeometrySpan::kFirstInstance ) { plGBufferCell* cell = group->GetCell(span->fVBufferIdx, span->fCellIdx); - UInt32 stride = group->GetVertexSize(); - UInt32 ptr = cell->fVtxStart + span->fCellOffset * stride; + uint32_t stride = group->GetVertexSize(); + uint32_t ptr = cell->fVtxStart + span->fCellOffset * stride; statusLog->AddLineF("From obj <%s> mat <%s> size %d bytes grp=%d (%d offset)", geo->fMaxOwner ? geo->fMaxOwner : "", geo->fMaterial ? geo->fMaterial->GetKey()->GetName().c_str() : "", - geo->GetVertexSize(geo->fFormat) * geo->fNumVerts + sizeof(UInt16) * geo->fNumIndices, + geo->GetVertexSize(geo->fFormat) * geo->fNumVerts + sizeof(uint16_t) * geo->fNumIndices, span->fGroupIdx, ptr ); @@ -425,7 +425,7 @@ static void ILogSpan(plStatusLog* statusLog, plGeometrySpan* geo, plVertexSpan* statusLog->AddLineF("From obj <%s> mat <%s> size %d bytes grp=%d (%d/%d/%d/%d/%d)", geo->fMaxOwner ? geo->fMaxOwner : "", geo->fMaterial ? geo->fMaterial->GetKey()->GetName().c_str() : "", - geo->GetVertexSize(geo->fFormat) * geo->fNumVerts + sizeof(UInt16) * geo->fNumIndices, + geo->GetVertexSize(geo->fFormat) * geo->fNumVerts + sizeof(uint16_t) * geo->fNumIndices, span->fGroupIdx, span->fVBufferIdx, span->fCellIdx, @@ -611,10 +611,10 @@ void plDrawableSpans::IPackSourceSpans( void ) void plDrawableSpans::ISortSourceSpans( void ) { - hsTArray spanReorderTable, spanInverseTable; + hsTArray spanReorderTable, spanInverseTable; int i, j, idx; plGeometrySpan *tmpSpan; - UInt32 tmpIdx; + uint32_t tmpIdx; plSpan *tmpSpanPtr; diff --git a/Sources/Plasma/PubUtilLib/plDrawable/plDynaBulletMgr.cpp b/Sources/Plasma/PubUtilLib/plDrawable/plDynaBulletMgr.cpp index 7854d8e6..dd0a39bf 100644 --- a/Sources/Plasma/PubUtilLib/plDrawable/plDynaBulletMgr.cpp +++ b/Sources/Plasma/PubUtilLib/plDrawable/plDynaBulletMgr.cpp @@ -40,7 +40,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "plDynaBulletMgr.h" #include "plDynaDecal.h" @@ -65,7 +65,7 @@ static plRandom sRand; int plDynaBulletMgr::INewDecal() { int idx = fDecals.GetCount(); - fDecals.Append(TRACKED_NEW plDynaSplot()); + fDecals.Append(new plDynaSplot()); return idx; } @@ -103,7 +103,7 @@ hsBool plDynaBulletMgr::IHandleShot(plBulletMsg* bull) fCutter->SetLength(hsVector3(bull->Radius() * fScale.fX, bull->Radius() * fScale.fY, bull->Range())); fCutter->Set(pos, up, -bull->Dir()); - plDynaDecalInfo& info = IGetDecalInfo(unsigned_ptr(this), GetKey()); + plDynaDecalInfo& info = IGetDecalInfo(uintptr_t(this), GetKey()); if( bull->PartyTime() > 0 ) fPartyTime = bull->PartyTime(); diff --git a/Sources/Plasma/PubUtilLib/plDrawable/plDynaDecal.cpp b/Sources/Plasma/PubUtilLib/plDrawable/plDynaDecal.cpp index 136686cc..48dceaab 100644 --- a/Sources/Plasma/PubUtilLib/plDrawable/plDynaDecal.cpp +++ b/Sources/Plasma/PubUtilLib/plDrawable/plDynaDecal.cpp @@ -40,14 +40,14 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "plDynaDecal.h" #include "plAuxSpan.h" -hsBool plDynaSplot::Age(double t, hsScalar ramp, hsScalar decay, hsScalar life) +hsBool plDynaSplot::Age(double t, float ramp, float decay, float life) { - hsScalar age = hsScalar(t - fBirth); + float age = float(t - fBirth); if( age >= life ) return true; @@ -55,7 +55,7 @@ hsBool plDynaSplot::Age(double t, hsScalar ramp, hsScalar decay, hsScalar life) if( !n ) return true; - hsScalar atten = fInitAtten; + float atten = fInitAtten; if( age < ramp ) { atten *= age / ramp; @@ -83,7 +83,7 @@ hsBool plDynaSplot::Age(double t, hsScalar ramp, hsScalar decay, hsScalar life) while( n-- ) { - UInt32 diff = UInt32(origUVW->fZ * atten * 255.99f); + uint32_t diff = uint32_t(origUVW->fZ * atten * 255.99f); vtx->fDiffuse = 0xff000000 | (diff << 16) | (diff << 8) @@ -98,13 +98,13 @@ hsBool plDynaSplot::Age(double t, hsScalar ramp, hsScalar decay, hsScalar life) { const int stride = sizeof(plDecalVtxFormat); - hsScalar* sPtr = &origUVW->fZ; + float* sPtr = &origUVW->fZ; unsigned char* alpha = (unsigned char*)&fVtxBase->fDiffuse; alpha += 3; while( n-- ) { - hsScalar initOpac = *sPtr; + float initOpac = *sPtr; *alpha = (unsigned char)(initOpac * atten * 255.99f); alpha += stride; @@ -113,7 +113,7 @@ hsBool plDynaSplot::Age(double t, hsScalar ramp, hsScalar decay, hsScalar life) } else { - hsScalar* sPtr = &origUVW->fZ; + float* sPtr = &origUVW->fZ; char* oPtr = (char*)&fVtxBase->fUVW[1].fX; @@ -121,7 +121,7 @@ hsBool plDynaSplot::Age(double t, hsScalar ramp, hsScalar decay, hsScalar life) while( n-- ) { - (*(hsScalar*)oPtr) = *sPtr * atten; + (*(float*)oPtr) = *sPtr * atten; oPtr += stride; sPtr += 3; @@ -130,9 +130,9 @@ hsBool plDynaSplot::Age(double t, hsScalar ramp, hsScalar decay, hsScalar life) return false; } -hsBool plDynaRipple::Age(double t, hsScalar ramp, hsScalar decay, hsScalar life) +hsBool plDynaRipple::Age(double t, float ramp, float decay, float life) { - hsScalar age = hsScalar(t - fBirth); + float age = float(t - fBirth); if( age >= life ) return true; @@ -140,7 +140,7 @@ hsBool plDynaRipple::Age(double t, hsScalar ramp, hsScalar decay, hsScalar life) if( !n ) return true; - hsScalar atten = fInitAtten; + float atten = fInitAtten; if( age < ramp ) { atten *= age / ramp; @@ -150,8 +150,8 @@ hsBool plDynaRipple::Age(double t, hsScalar ramp, hsScalar decay, hsScalar life) atten *= (life - age) / (life - decay); } - hsScalar scaleU = fC1U / (age*fC2U + 1.f); - hsScalar scaleV = fC1V / (age*fC2V + 1.f); + float scaleU = fC1U / (age*fC2U + 1.f); + float scaleV = fC1V / (age*fC2V + 1.f); hsPoint3* origUVW = &fAuxSpan->fOrigUVW[fStartVtx]; @@ -161,7 +161,7 @@ hsBool plDynaRipple::Age(double t, hsScalar ramp, hsScalar decay, hsScalar life) while( n-- ) { - UInt32 diff = UInt32(origUVW->fZ * atten * 255.99f); + uint32_t diff = uint32_t(origUVW->fZ * atten * 255.99f); vtx->fDiffuse = 0xff000000 | (diff << 16) | (diff << 8) @@ -210,9 +210,9 @@ hsBool plDynaRipple::Age(double t, hsScalar ramp, hsScalar decay, hsScalar life) return false; } -hsBool plDynaWake::Age(double t, hsScalar ramp, hsScalar decay, hsScalar life) +hsBool plDynaWake::Age(double t, float ramp, float decay, float life) { - hsScalar age = hsScalar(t - fBirth); + float age = float(t - fBirth); if( age >= life ) return true; @@ -220,7 +220,7 @@ hsBool plDynaWake::Age(double t, hsScalar ramp, hsScalar decay, hsScalar life) if( !n ) return true; - hsScalar atten = fInitAtten; + float atten = fInitAtten; if( age < ramp ) { atten *= age / ramp; @@ -230,8 +230,8 @@ hsBool plDynaWake::Age(double t, hsScalar ramp, hsScalar decay, hsScalar life) atten *= (life - age) / (life - decay); } - hsScalar scaleU = fC1U / (age*fC2U + 1.f); - hsScalar scaleV = fC1V / (age*fC2V + 1.f); + float scaleU = fC1U / (age*fC2U + 1.f); + float scaleV = fC1V / (age*fC2V + 1.f); hsPoint3* origUVW = &fAuxSpan->fOrigUVW[fStartVtx]; @@ -241,7 +241,7 @@ hsBool plDynaWake::Age(double t, hsScalar ramp, hsScalar decay, hsScalar life) while( n-- ) { - UInt32 diff = UInt32(origUVW->fZ * atten * 255.99f); + uint32_t diff = uint32_t(origUVW->fZ * atten * 255.99f); vtx->fDiffuse = 0xff000000 | (diff << 16) | (diff << 8) @@ -290,9 +290,9 @@ hsBool plDynaWake::Age(double t, hsScalar ramp, hsScalar decay, hsScalar life) return false; } -hsBool plDynaWave::Age(double t, hsScalar ramp, hsScalar decay, hsScalar life) +hsBool plDynaWave::Age(double t, float ramp, float decay, float life) { - hsScalar age = hsScalar(t - fBirth); + float age = float(t - fBirth); if( age >= life ) return true; @@ -300,7 +300,7 @@ hsBool plDynaWave::Age(double t, hsScalar ramp, hsScalar decay, hsScalar life) if( !n ) return true; - hsScalar atten = fInitAtten; + float atten = fInitAtten; if( age < ramp ) { atten *= age / ramp; @@ -310,8 +310,8 @@ hsBool plDynaWave::Age(double t, hsScalar ramp, hsScalar decay, hsScalar life) atten *= (life - age) / (life - decay); } - hsScalar scale = 1.f + life * fScrollRate; - hsScalar scroll = -fScrollRate * age; + float scale = 1.f + life * fScrollRate; + float scroll = -fScrollRate * age; hsPoint3* origUVW = &fAuxSpan->fOrigUVW[fStartVtx]; @@ -321,7 +321,7 @@ hsBool plDynaWave::Age(double t, hsScalar ramp, hsScalar decay, hsScalar life) while( n-- ) { - UInt32 diff = UInt32(origUVW->fZ * atten * 255.99f); + uint32_t diff = uint32_t(origUVW->fZ * atten * 255.99f); vtx->fDiffuse = 0xff000000 | (diff << 16) | (diff << 8) @@ -370,9 +370,9 @@ hsBool plDynaWave::Age(double t, hsScalar ramp, hsScalar decay, hsScalar life) return false; } -hsBool plDynaRippleVS::Age(double t, hsScalar ramp, hsScalar decay, hsScalar life) +hsBool plDynaRippleVS::Age(double t, float ramp, float decay, float life) { - hsScalar age = hsScalar(t - fBirth); + float age = float(t - fBirth); if( age >= life ) return true; diff --git a/Sources/Plasma/PubUtilLib/plDrawable/plDynaDecal.h b/Sources/Plasma/PubUtilLib/plDrawable/plDynaDecal.h index 82e06395..81276b58 100644 --- a/Sources/Plasma/PubUtilLib/plDrawable/plDynaDecal.h +++ b/Sources/Plasma/PubUtilLib/plDrawable/plDynaDecal.h @@ -54,14 +54,14 @@ class plDecalVtxFormat public: hsPoint3 fPos; hsVector3 fNorm; - UInt32 fDiffuse; - UInt32 fSpecular; // Not used anywhere, carried around everywhere. + uint32_t fDiffuse; + uint32_t fSpecular; // Not used anywhere, carried around everywhere. hsPoint3 fUVW[2]; }; // UVW[0] is the currently used UVW. // UVW[1] is for the alpha hack (when necessary). -const UInt8 kDecalVtxFormat = 0x2; // Two UVW's, otherwise vanilla. +const uint8_t kDecalVtxFormat = 0x2; // Two UVW's, otherwise vanilla. class plDynaDecal @@ -78,14 +78,14 @@ protected: // StartVtx and StartIdx are relative to the start of the data // owned by this decal's span, not relative to the start of the // underlying buffers. - UInt16 fStartVtx; - UInt16 fNumVerts; + uint16_t fStartVtx; + uint16_t fNumVerts; - UInt16 fStartIdx; - UInt16 fNumIdx; + uint16_t fStartIdx; + uint16_t fNumIdx; double fBirth; - hsScalar fInitAtten; + float fInitAtten; hsBool fFlags; plDecalVtxFormat* fVtxBase; // Safe pointer, the buffer data will outlive this decal @@ -95,7 +95,7 @@ protected: friend class plDynaDecalMgr; public: - virtual hsBool Age(double t, hsScalar ramp, hsScalar decay, hsScalar life) = 0; + virtual hsBool Age(double t, float ramp, float decay, float life) = 0; }; // No expansion @@ -105,7 +105,7 @@ protected: public: - virtual hsBool Age(double t, hsScalar ramp, hsScalar decay, hsScalar life); + virtual hsBool Age(double t, float ramp, float decay, float life); }; // Expands radially from center @@ -113,13 +113,13 @@ class plDynaRipple : public plDynaDecal { public: - virtual hsBool Age(double t, hsScalar ramp, hsScalar decay, hsScalar life); + virtual hsBool Age(double t, float ramp, float decay, float life); - hsScalar fC1U; - hsScalar fC2U; + float fC1U; + float fC2U; - hsScalar fC1V; - hsScalar fC2V; + float fC1V; + float fC2V; }; @@ -128,13 +128,13 @@ class plDynaWake : public plDynaDecal { public: - virtual hsBool Age(double t, hsScalar ramp, hsScalar decay, hsScalar life); + virtual hsBool Age(double t, float ramp, float decay, float life); - hsScalar fC1U; - hsScalar fC2U; + float fC1U; + float fC2U; - hsScalar fC1V; - hsScalar fC2V; + float fC1V; + float fC2V; }; @@ -143,9 +143,9 @@ class plDynaWave : public plDynaDecal { public: - virtual hsBool Age(double t, hsScalar ramp, hsScalar decay, hsScalar life); + virtual hsBool Age(double t, float ramp, float decay, float life); - hsScalar fScrollRate; + float fScrollRate; }; // About the same as a DynaRipple, but implemented with vertex/pixel shaders. @@ -154,7 +154,7 @@ class plDynaRippleVS : public plDynaRipple { public: - virtual hsBool Age(double t, hsScalar ramp, hsScalar decay, hsScalar life); + virtual hsBool Age(double t, float ramp, float decay, float life); }; #endif // plDynaDecal_inc diff --git a/Sources/Plasma/PubUtilLib/plDrawable/plDynaDecalMgr.cpp b/Sources/Plasma/PubUtilLib/plDrawable/plDynaDecalMgr.cpp index c26edde4..a49ed294 100644 --- a/Sources/Plasma/PubUtilLib/plDrawable/plDynaDecalMgr.cpp +++ b/Sources/Plasma/PubUtilLib/plDrawable/plDynaDecalMgr.cpp @@ -40,7 +40,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "plDynaDecalMgr.h" #include "plDynaDecal.h" @@ -107,14 +107,14 @@ plProfile_CreateTimerNoReset("Callback", "DynaDecal", Callback); static plRandom sRand; static const int kBinBlockSize = 20; -static const UInt16 kDefMaxNumVerts = 1000; -static const UInt16 kDefMaxNumIdx = kDefMaxNumVerts; +static const uint16_t kDefMaxNumVerts = 1000; +static const uint16_t kDefMaxNumIdx = kDefMaxNumVerts; -static const hsScalar kDefLifeSpan = 30.f; -static const hsScalar kDefDecayStart = kDefLifeSpan * 0.5f; -static const hsScalar kDefRampEnd = kDefLifeSpan * 0.1f; +static const float kDefLifeSpan = 30.f; +static const float kDefDecayStart = kDefLifeSpan * 0.5f; +static const float kDefRampEnd = kDefLifeSpan * 0.1f; -static const hsScalar kInitAuxSpans = 5; +static const float kInitAuxSpans = 5; #define MF_NO_INIT_ALLOC #define MF_NEVER_RUN_OUT @@ -153,7 +153,7 @@ plDynaDecalMgr::plDynaDecalMgr() fScale(1.f, 1.f, 1.f), fPartyTime(1.f) { - fCutter = TRACKED_NEW plCutter; + fCutter = new plCutter; } plDynaDecalMgr::~plDynaDecalMgr() @@ -194,25 +194,25 @@ void plDynaDecalMgr::Read(hsStream* stream, hsResMgr* mgr) { plSynchedObject::Read(stream, mgr); - mgr->ReadKeyNotifyMe(stream, TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnCreate, 0, kRefMatPreShade), plRefFlags::kActiveRef); + mgr->ReadKeyNotifyMe(stream, new plGenRefMsg(GetKey(), plRefMsg::kOnCreate, 0, kRefMatPreShade), plRefFlags::kActiveRef); - mgr->ReadKeyNotifyMe(stream, TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnCreate, 0, kRefMatRTShade), plRefFlags::kActiveRef); + mgr->ReadKeyNotifyMe(stream, new plGenRefMsg(GetKey(), plRefMsg::kOnCreate, 0, kRefMatRTShade), plRefFlags::kActiveRef); int n = stream->ReadLE32(); int i; for( i = 0; i < n; i++ ) { - mgr->ReadKeyNotifyMe(stream, TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnCreate, 0, kRefTarget), plRefFlags::kPassiveRef); + mgr->ReadKeyNotifyMe(stream, new plGenRefMsg(GetKey(), plRefMsg::kOnCreate, 0, kRefTarget), plRefFlags::kPassiveRef); } // Associated slave particle systems. We read in the scene objects now, and find the associated systems on loaded message. n = stream->ReadLE32(); for( i = 0; i < n; i++ ) { - mgr->ReadKeyNotifyMe(stream, TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnCreate, 0, kRefPartyObject), plRefFlags::kPassiveRef); + mgr->ReadKeyNotifyMe(stream, new plGenRefMsg(GetKey(), plRefMsg::kOnCreate, 0, kRefPartyObject), plRefFlags::kPassiveRef); } - fMaxNumVerts = (UInt16)(stream->ReadLE32()); - fMaxNumIdx = (UInt16)(stream->ReadLE32()); + fMaxNumVerts = (uint16_t)(stream->ReadLE32()); + fMaxNumIdx = (uint16_t)(stream->ReadLE32()); fWaitOnEnable = stream->ReadLE32(); @@ -321,7 +321,7 @@ const plPrintShape* plDynaDecalMgr::IGetPrintShape(const plKey& objKey) const return shape; } -const plPrintShape* plDynaDecalMgr::IGetPrintShape(plArmatureMod* avMod, UInt32 id) const +const plPrintShape* plDynaDecalMgr::IGetPrintShape(plArmatureMod* avMod, uint32_t id) const { const plPrintShape* shape = nil; const plSceneObject* part = avMod->FindBone(id); @@ -348,12 +348,12 @@ hsBool plDynaDecalMgr::IWetParts(const plDynaDecalEnableMsg* enaMsg) const plPrintShape* shape = IGetPrintShape(enaMsg->GetShapeKey()); if( shape ) { - plDynaDecalInfo& info = IGetDecalInfo(unsigned_ptr(shape), shape->GetKey()); + plDynaDecalInfo& info = IGetDecalInfo(uintptr_t(shape), shape->GetKey()); IWetInfo(info, enaMsg); } } else - if( enaMsg->GetID() == UInt32(-1) ) + if( enaMsg->GetID() == uint32_t(-1) ) { plArmatureMod* avMod = plArmatureMod::ConvertNoRef(enaMsg->GetArmKey()->ObjectIsLoaded()); int i; @@ -362,7 +362,7 @@ hsBool plDynaDecalMgr::IWetParts(const plDynaDecalEnableMsg* enaMsg) const plPrintShape* shape = IGetPrintShape(avMod, fPartIDs[i]); if( shape ) { - plDynaDecalInfo& info = IGetDecalInfo(unsigned_ptr(shape), shape->GetKey()); + plDynaDecalInfo& info = IGetDecalInfo(uintptr_t(shape), shape->GetKey()); IWetInfo(info, enaMsg); } } @@ -374,14 +374,14 @@ hsBool plDynaDecalMgr::IWetParts(const plDynaDecalEnableMsg* enaMsg) return true; } -hsBool plDynaDecalMgr::IWetPart(UInt32 id, const plDynaDecalEnableMsg* enaMsg) +hsBool plDynaDecalMgr::IWetPart(uint32_t id, const plDynaDecalEnableMsg* enaMsg) { plArmatureMod* avMod = plArmatureMod::ConvertNoRef(enaMsg->GetArmKey()->ObjectIsLoaded()); const plPrintShape* shape = IGetPrintShape(avMod, id); if( shape ) { - plDynaDecalInfo& info = IGetDecalInfo(unsigned_ptr(shape), shape->GetKey()); + plDynaDecalInfo& info = IGetDecalInfo(uintptr_t(shape), shape->GetKey()); IWetInfo(info, enaMsg); } return true; @@ -484,7 +484,7 @@ hsBool plDynaDecalMgr::MsgReceive(plMessage* msg) return true; case kRefAvatar: if( refMsg->GetContext() & (plRefMsg::kOnRemove|plRefMsg::kOnDestroy) ) - IRemoveDecalInfo(unsigned_ptr(refMsg->GetRef())); + IRemoveDecalInfo(uintptr_t(refMsg->GetRef())); return true; } } @@ -494,7 +494,7 @@ hsBool plDynaDecalMgr::MsgReceive(plMessage* msg) ////////////////////////////////////////////////////////////////////////////////// // -void plDynaDecalMgr::INotifyActive(plDynaDecalInfo& info, const plKey& armKey, UInt32 id) const +void plDynaDecalMgr::INotifyActive(plDynaDecalInfo& info, const plKey& armKey, uint32_t id) const { if( !(info.fFlags & plDynaDecalInfo::kActive) ) { @@ -502,14 +502,14 @@ void plDynaDecalMgr::INotifyActive(plDynaDecalInfo& info, const plKey& armKey, U int i; for( i = 0; i < fNotifies.GetCount(); i++ ) { - plDynaDecalEnableMsg* enaMsg = TRACKED_NEW plDynaDecalEnableMsg(fNotifies[i], armKey, secs, fWetLength, false, id); + plDynaDecalEnableMsg* enaMsg = new plDynaDecalEnableMsg(fNotifies[i], armKey, secs, fWetLength, false, id); enaMsg->Send(); } info.fFlags |= plDynaDecalInfo::kActive; } } -void plDynaDecalMgr::INotifyInactive(plDynaDecalInfo& info, const plKey& armKey, UInt32 id) const +void plDynaDecalMgr::INotifyInactive(plDynaDecalInfo& info, const plKey& armKey, uint32_t id) const { if( info.fFlags & plDynaDecalInfo::kActive ) { @@ -517,7 +517,7 @@ void plDynaDecalMgr::INotifyInactive(plDynaDecalInfo& info, const plKey& armKey, int i; for( i = 0; i < fNotifies.GetCount(); i++ ) { - plDynaDecalEnableMsg* enaMsg = TRACKED_NEW plDynaDecalEnableMsg(fNotifies[i], armKey, secs, fWetLength, true, id); + plDynaDecalEnableMsg* enaMsg = new plDynaDecalEnableMsg(fNotifies[i], armKey, secs, fWetLength, true, id); enaMsg->Send(); } info.fFlags &= ~plDynaDecalInfo::kActive; @@ -537,14 +537,14 @@ plDynaDecalInfo& plDynaDecalInfo::Init(const plKey& key) return *this; } -plDynaDecalInfo& plDynaDecalMgr::IGetDecalInfo(unsigned_ptr id, const plKey& key) +plDynaDecalInfo& plDynaDecalMgr::IGetDecalInfo(uintptr_t id, const plKey& key) { plDynaDecalMap::iterator iter = fDecalMap.find(id); if( iter == fDecalMap.end() ) { plDynaDecalInfo decalInfo; decalInfo.Init(key); - plGenRefMsg* refMsg = TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnRequest, 0, kRefAvatar); + plGenRefMsg* refMsg = new plGenRefMsg(GetKey(), plRefMsg::kOnRequest, 0, kRefAvatar); hsgResMgr::ResMgr()->AddViaNotify(plKey(key), refMsg, plRefFlags::kPassiveRef); pair iterPair; @@ -555,7 +555,7 @@ plDynaDecalInfo& plDynaDecalMgr::IGetDecalInfo(unsigned_ptr id, const plKey& key return iter->second; } -void plDynaDecalMgr::IRemoveDecalInfo(UInt32 id) +void plDynaDecalMgr::IRemoveDecalInfo(uint32_t id) { plDynaDecalMap::iterator iter = fDecalMap.find(id); if( iter != fDecalMap.end() ) @@ -582,7 +582,7 @@ void plDynaDecalMgr::IRemoveDecalInfos(const plKey& key) } } -hsScalar plDynaDecalMgr::IHowWet(plDynaDecalInfo& info, double t) const +float plDynaDecalMgr::IHowWet(plDynaDecalInfo& info, double t) const { // We aren't playing this wet/dry/enable/disable thing. if( !fWaitOnEnable ) @@ -601,7 +601,7 @@ hsScalar plDynaDecalMgr::IHowWet(plDynaDecalInfo& info, double t) const return 0; // We're wet, let's see how wet. - hsScalar wet = (hsScalar)(1.f - (t - info.fWetTime) / info.fWetLength); + float wet = (float)(1.f - (t - info.fWetTime) / info.fWetLength); if( wet > 1.f ) // This should never happen. It means t < info.fWetTime (we get wet in the future). return fIntensity; if( wet < 0 ) @@ -613,7 +613,7 @@ hsScalar plDynaDecalMgr::IHowWet(plDynaDecalInfo& info, double t) const ////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////// -plAuxSpan* plDynaDecalMgr::IGetAuxSpan(plDrawableSpans* targ, int iSpan, hsGMaterial* mat, UInt16 numVerts, UInt16 numIdx) +plAuxSpan* plDynaDecalMgr::IGetAuxSpan(plDrawableSpans* targ, int iSpan, hsGMaterial* mat, uint16_t numVerts, uint16_t numIdx) { // Some of this code just assumes you get the number of verts you ask for. // Which was causing errors when you asked for more than the max and didn't @@ -688,7 +688,7 @@ plAuxSpan* plDynaDecalMgr::IGetAuxSpan(plDrawableSpans* targ, int iSpan, hsGMate #ifdef MF_NEVER_RUN_OUT // Okay, nothing there. Let's get a new one. - plAuxSpan* aux = TRACKED_NEW plAuxSpan; + plAuxSpan* aux = new plAuxSpan; fAuxSpans.Append(aux); IAllocAuxSpan(aux, numVerts, numIdx); @@ -712,16 +712,16 @@ void plDynaDecalMgr::InitAuxSpans() int i; for( i = 0; i < kInitAuxSpans; i++ ) { - plAuxSpan* aux = TRACKED_NEW plAuxSpan; + plAuxSpan* aux = new plAuxSpan; fAuxSpans.Append(aux); IAllocAuxSpan(aux, fMaxNumVerts, fMaxNumIdx); } } -void plDynaDecalMgr::IAllocAuxSpan(plAuxSpan* aux, UInt32 maxNumVerts, UInt32 maxNumIdx) +void plDynaDecalMgr::IAllocAuxSpan(plAuxSpan* aux, uint32_t maxNumVerts, uint32_t maxNumIdx) { int iGrp = fGroups.GetCount(); - plGBufferGroup* grp = TRACKED_NEW plGBufferGroup(kDecalVtxFormat, true, false); + plGBufferGroup* grp = new plGBufferGroup(kDecalVtxFormat, true, false); fGroups.Append(grp); grp->ReserveVertStorage(maxNumVerts, @@ -735,7 +735,7 @@ void plDynaDecalMgr::IAllocAuxSpan(plAuxSpan* aux, UInt32 maxNumVerts, UInt32 ma aux->fVStartIdx = grp->GetVertStartFromCell(aux->fVBufferIdx, aux->fCellIdx, aux->fCellOffset); aux->fVLength = 0; - UInt16* dataPtr = nil; + uint16_t* dataPtr = nil; grp->ReserveIndexStorage(maxNumIdx, &aux->fIBufferIdx, &aux->fIStartIdx, &dataPtr); aux->fIStartIdx; @@ -816,13 +816,13 @@ hsGMaterial* plDynaDecalMgr::ISetAuxMaterial(plAuxSpan* aux, hsGMaterial* mat, h ////////////////////////////////////////////////////////////////////////////////// -plDynaDecal* plDynaDecalMgr::IInitDecal(plAuxSpan* aux, double t, UInt16 numVerts, UInt16 numIdx) +plDynaDecal* plDynaDecalMgr::IInitDecal(plAuxSpan* aux, double t, uint16_t numVerts, uint16_t numIdx) { int idx = INewDecal(); - fDecals[idx]->fStartVtx = (UInt16)(aux->fVStartIdx + aux->fVLength); + fDecals[idx]->fStartVtx = (uint16_t)(aux->fVStartIdx + aux->fVLength); fDecals[idx]->fNumVerts = numVerts; - fDecals[idx]->fStartIdx = (UInt16)(aux->fIStartIdx + aux->fILength); + fDecals[idx]->fStartIdx = (uint16_t)(aux->fIStartIdx + aux->fILength); fDecals[idx]->fNumIdx = numIdx; fDecals[idx]->fBirth = t; @@ -931,7 +931,7 @@ void plDynaDecalMgr::IUpdateDecals(double t) ////////////////////////////////////////////////////////////////////////////////// -void plDynaDecalMgr::ICountIncoming(hsTArray& src, UInt16& numVerts, UInt16& numIdx) const +void plDynaDecalMgr::ICountIncoming(hsTArray& src, uint16_t& numVerts, uint16_t& numIdx) const { numVerts = 0; numIdx = 0; @@ -952,7 +952,7 @@ plDecalVtxFormat* plDynaDecalMgr::IGetBaseVtxPtr(const plAuxSpan* auxSpan) const plGBufferGroup* grp = auxSpan->fGroup; plGBufferCell* cell = grp->GetCell(auxSpan->fVBufferIdx, auxSpan->fCellIdx); - UInt8* ptr = grp->GetVertBufferData(auxSpan->fVBufferIdx); + uint8_t* ptr = grp->GetVertBufferData(auxSpan->fVBufferIdx); ptr += cell->fVtxStart + auxSpan->fCellOffset; @@ -960,7 +960,7 @@ plDecalVtxFormat* plDynaDecalMgr::IGetBaseVtxPtr(const plAuxSpan* auxSpan) const } -UInt16* plDynaDecalMgr::IGetBaseIdxPtr(const plAuxSpan* auxSpan) const +uint16_t* plDynaDecalMgr::IGetBaseIdxPtr(const plAuxSpan* auxSpan) const { plGBufferGroup* grp = auxSpan->fGroup; @@ -978,7 +978,7 @@ hsBool plDynaDecalMgr::IConvertFlatGrid(plAuxSpan* auxSpan, hsPoint3* origPos = &auxSpan->fOrigPos[decal->fStartVtx]; hsPoint3* origUVW = &auxSpan->fOrigUVW[decal->fStartVtx]; - UInt32 initColor = decal->fFlags & plDynaDecal::kAttenColor + uint32_t initColor = decal->fFlags & plDynaDecal::kAttenColor ? 0xff000000 : 0x00ffffff; int iv; @@ -1001,12 +1001,12 @@ hsBool plDynaDecalMgr::IConvertFlatGrid(plAuxSpan* auxSpan, origUVW++; } - UInt16* idx = IGetBaseIdxPtr(auxSpan); + uint16_t* idx = IGetBaseIdxPtr(auxSpan); idx += decal->fStartIdx; hsAssert(grid.fIdx.GetCount() == decal->fNumIdx, "Mismatch on dynamic indices"); - UInt16 base = decal->fStartVtx; + uint16_t base = decal->fStartVtx; int ii; for( ii = 0; ii < grid.fIdx.GetCount(); ii++ ) { @@ -1024,14 +1024,14 @@ hsBool plDynaDecalMgr::IConvertFlatGrid(plAuxSpan* auxSpan, void plDynaDecalMgr::ISetDepthFalloff() { - const hsScalar totalDepth = fCutter->GetLengthW(); + const float totalDepth = fCutter->GetLengthW(); // Currently all constants, but these could be set per DecalMgr. - plConst(hsScalar) kMinFeet(3.f); - plConst(hsScalar) kMaxFeet(10.f); + plConst(float) kMinFeet(3.f); + plConst(float) kMaxFeet(10.f); - plConst(hsScalar) kMinDepth(0.25f); - plConst(hsScalar) kMaxDepth(0.75f); + plConst(float) kMinDepth(0.25f); + plConst(float) kMaxDepth(0.75f); fMinDepth = kMinFeet / totalDepth; if( fMinDepth > kMinDepth ) @@ -1099,15 +1099,15 @@ hsBool plDynaDecalMgr::IConvertPolysAlpha(plAuxSpan* auxSpan, hsColorRGBA col = src[iPoly].fVerts[iVert].fColor; - hsScalar depth = vtx->fUVW[0].fZ; + float depth = vtx->fUVW[0].fZ; - hsScalar opac = depth < fMinDepth + float opac = depth < fMinDepth ? depth * fMinDepthRange : depth > fMaxDepth ? (1.f - depth) * fMaxDepthRange : 1.f; - hsScalar normOpac = 1.f - vtx->fNorm.InnerProduct(backDir); + float normOpac = 1.f - vtx->fNorm.InnerProduct(backDir); opac *= 1.f - normOpac * normOpac; if( opac < 0 ) opac = 0; @@ -1137,14 +1137,14 @@ hsBool plDynaDecalMgr::IConvertPolysAlpha(plAuxSpan* auxSpan, } hsAssert(vtx <= IGetBaseVtxPtr(auxSpan) + auxSpan->fVBufferLimit, "Vtx pointer gone wild"); - UInt16* idx = IGetBaseIdxPtr(auxSpan); + uint16_t* idx = IGetBaseIdxPtr(auxSpan); idx += decal->fStartIdx; - UInt16 base = decal->fStartVtx; + uint16_t base = decal->fStartVtx; int j; for( j = 0; j < src.GetCount(); j++ ) { - UInt16 next = base+1; + uint16_t next = base+1; int k; for( k = 2; k < src[j].fVerts.GetCount(); k++ ) { @@ -1197,14 +1197,14 @@ hsBool plDynaDecalMgr::IConvertPolysColor(plAuxSpan* auxSpan, else hiV = true; - hsScalar depth = vtx->fUVW[0].fZ; - hsScalar opac = depth < fMinDepth + float depth = vtx->fUVW[0].fZ; + float opac = depth < fMinDepth ? depth * fMinDepthRange : depth > fMaxDepth ? (1.f - depth) * fMaxDepthRange : 1.f; - hsScalar normOpac = 1.f - vtx->fNorm.InnerProduct(backDir); + float normOpac = 1.f - vtx->fNorm.InnerProduct(backDir); opac *= 1.f - normOpac * normOpac; if( opac < 0 ) opac = 0; @@ -1230,14 +1230,14 @@ hsBool plDynaDecalMgr::IConvertPolysColor(plAuxSpan* auxSpan, } hsAssert(vtx <= IGetBaseVtxPtr(auxSpan) + auxSpan->fVBufferLimit, "Vtx pointer gone wild"); - UInt16* idx = IGetBaseIdxPtr(auxSpan); + uint16_t* idx = IGetBaseIdxPtr(auxSpan); idx += decal->fStartIdx; - UInt16 base = decal->fStartVtx; + uint16_t base = decal->fStartVtx; int j; for( j = 0; j < src.GetCount(); j++ ) { - UInt16 next = base+1; + uint16_t next = base+1; int k; for( k = 2; k < src[j].fVerts.GetCount(); k++ ) { @@ -1292,7 +1292,7 @@ hsBool plDynaDecalMgr::IConvertPolysVS(plAuxSpan* auxSpan, origUVW->fX = vtx->fUVW[0].fX; origUVW->fY = vtx->fUVW[0].fY; - origUVW->fZ = vtx->fUVW[0].fZ = (hsScalar)decal->fBirth; + origUVW->fZ = vtx->fUVW[0].fZ = (float)decal->fBirth; vtx->fUVW[1].Set(0, 0, 0); @@ -1312,14 +1312,14 @@ hsBool plDynaDecalMgr::IConvertPolysVS(plAuxSpan* auxSpan, } hsAssert(vtx <= IGetBaseVtxPtr(auxSpan) + auxSpan->fVBufferLimit, "Vtx pointer gone wild"); - UInt16* idx = IGetBaseIdxPtr(auxSpan); + uint16_t* idx = IGetBaseIdxPtr(auxSpan); idx += decal->fStartIdx; - UInt16 base = decal->fStartVtx; + uint16_t base = decal->fStartVtx; int j; for( j = 0; j < src.GetCount(); j++ ) { - UInt16 next = base+1; + uint16_t next = base+1; int k; for( k = 2; k < src[j].fVerts.GetCount(); k++ ) { @@ -1371,7 +1371,7 @@ hsBool plDynaDecalMgr::IHitTestPolys(hsTArray& src) const hsBool plDynaDecalMgr::IProcessPolys(plDrawableSpans* targ, int iSpan, double t, hsTArray& src) { // Figure out how many verts and idxs are coming in. - UInt16 numVerts, numIdx; + uint16_t numVerts, numIdx; ICountIncoming(src, numVerts, numIdx); if( !numVerts ) return false; @@ -1577,11 +1577,11 @@ hsGMaterial* plDynaDecalMgr::IConvertToEnvMap(hsGMaterial* mat, plBitmap* envMap return mat; oldMip->SetCurrLevel(0); - hsGMaterial* newMat = TRACKED_NEW hsGMaterial; + hsGMaterial* newMat = new hsGMaterial; plString buff = plString::Format("%s_EnvMat", GetKey()->GetName().c_str()); hsgResMgr::ResMgr()->NewKey(buff, newMat, GetKey()->GetUoid().GetLocation()); - static plTweak kSmooth(1.f); + static plTweak kSmooth(1.f); plMipmap* bumpMap = plBumpMapGen::QikNormalMap(nil, oldMip, 0xffffffff, plBumpMapGen::kBubbleTest, kSmooth); // plMipmap* bumpMap = plBumpMapGen::QikNormalMap(nil, oldMip, 0xffffffff, plBumpMapGen::kNormalize, kSmooth); // plMipmap* bumpMap = plBumpMapGen::QikNormalMap(nil, oldMip, 0xffffffff, 0, 0); @@ -1590,7 +1590,7 @@ hsGMaterial* plDynaDecalMgr::IConvertToEnvMap(hsGMaterial* mat, plBitmap* envMap bumpMap->SetFlags(bumpMap->GetFlags() | plMipmap::kBumpEnvMap | plMipmap::kForceNonCompressed); - plLayer* bumpLay = TRACKED_NEW plLayer; + plLayer* bumpLay = new plLayer; buff = plString::Format("%s_BumpMap_0", GetKey()->GetName().c_str()); hsgResMgr::ResMgr()->NewKey(buff, bumpLay, GetKey()->GetUoid().GetLocation()); @@ -1607,12 +1607,12 @@ hsGMaterial* plDynaDecalMgr::IConvertToEnvMap(hsGMaterial* mat, plBitmap* envMap bumpLay->SetRuntimeColor(oldLay->GetRuntimeColor()); bumpLay->SetOpacity(1.f); - plLayRefMsg* refMsg = TRACKED_NEW plLayRefMsg(bumpLay->GetKey(), plRefMsg::kOnCreate, 0, plLayRefMsg::kTexture); + plLayRefMsg* refMsg = new plLayRefMsg(bumpLay->GetKey(), plRefMsg::kOnCreate, 0, plLayRefMsg::kTexture); hsgResMgr::ResMgr()->SendRef(bumpMap->GetKey(), refMsg, plRefFlags::kActiveRef); newMat->AddLayerViaNotify(bumpLay); - plLayer* envLay = TRACKED_NEW plLayer; + plLayer* envLay = new plLayer; buff = plString::Format("%s_EnvMap_0", GetKey()->GetName().c_str()); hsgResMgr::ResMgr()->NewKey(buff, envLay, GetKey()->GetUoid().GetLocation()); @@ -1627,7 +1627,7 @@ hsGMaterial* plDynaDecalMgr::IConvertToEnvMap(hsGMaterial* mat, plBitmap* envMap envLay->SetRuntimeColor(oldLay->GetRuntimeColor()); envLay->SetOpacity(1.f); - refMsg = TRACKED_NEW plLayRefMsg(envLay->GetKey(), plRefMsg::kOnCreate, 0, plLayRefMsg::kTexture); + refMsg = new plLayRefMsg(envLay->GetKey(), plRefMsg::kOnCreate, 0, plLayRefMsg::kTexture); hsgResMgr::ResMgr()->SendRef(envMap->GetKey(), refMsg, plRefFlags::kActiveRef); newMat->AddLayerViaNotify(envLay); @@ -1639,11 +1639,11 @@ void plDynaDecalMgr::ConvertToEnvMap(plBitmap* envMap) { hsGMaterial* newPreShade = IConvertToEnvMap(fMatPreShade, envMap); if( newPreShade && (newPreShade != fMatPreShade) ) - hsgResMgr::ResMgr()->SendRef(newPreShade->GetKey(), TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnCreate, 0, kRefMatPreShade), plRefFlags::kActiveRef); + hsgResMgr::ResMgr()->SendRef(newPreShade->GetKey(), new plGenRefMsg(GetKey(), plRefMsg::kOnCreate, 0, kRefMatPreShade), plRefFlags::kActiveRef); hsGMaterial* newRTShade = IConvertToEnvMap(fMatRTShade, envMap); if( newRTShade && (newRTShade != fMatRTShade) ) - hsgResMgr::ResMgr()->SendRef(newRTShade->GetKey(), TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnCreate, 0, kRefMatRTShade), plRefFlags::kActiveRef); + hsgResMgr::ResMgr()->SendRef(newRTShade->GetKey(), new plGenRefMsg(GetKey(), plRefMsg::kOnCreate, 0, kRefMatRTShade), plRefFlags::kActiveRef); } const plMipmap* plDynaDecalMgr::GetMipmap() const @@ -1675,11 +1675,11 @@ hsVector3 plDynaDecalMgr::IRandomUp(hsVector3 dir) const // Only problem here is that our random scalings might wind us up with // a zero vector. Unlikely, which means almost certain to happen. So // we keep trying till we get a non-zero vector. - hsScalar lenSq(-1.f); + float lenSq(-1.f); do { - hsScalar ranXx = sRand.RandMinusOneToOne(); - hsScalar ranXy = sRand.RandMinusOneToOne(); - hsScalar ranXz = sRand.RandMinusOneToOne(); + float ranXx = sRand.RandMinusOneToOne(); + float ranXy = sRand.RandMinusOneToOne(); + float ranXz = sRand.RandMinusOneToOne(); retVal.fX = -dir.fZ * ranXy + dir.fY * ranXz; retVal.fY = dir.fZ * ranXx + -dir.fX * ranXz; retVal.fZ = -dir.fY * ranXx + dir.fX * ranXy; @@ -1705,11 +1705,11 @@ hsVector3 plDynaDecalMgr::IReflectDir(hsVector3 dir) const // Simplifying gives (2*K*(N dot B) + (1-K)) * N + K*B // Or something. - plConst(hsScalar) parm(0.5f); + plConst(float) parm(0.5f); hsVector3 b = -fCutter->GetBackDir(); - hsScalar t = dir.InnerProduct(b); + float t = dir.InnerProduct(b); t *= -2.f * parm; t += (1.f - parm); @@ -1754,7 +1754,7 @@ hsMatrix44 plDynaDecalMgr::IL2WFromHit(hsPoint3 pos, hsVector3 dir) const return l2w; } -void plDynaDecalMgr::ICutoutCallback(const hsTArray& cutouts, hsBool hasWaterHeight, hsScalar waterHeight) +void plDynaDecalMgr::ICutoutCallback(const hsTArray& cutouts, hsBool hasWaterHeight, float waterHeight) { hsTArray hits; @@ -1795,7 +1795,7 @@ void plDynaDecalMgr::IGetParticles() // const_cast here is just to see if it's in our list, make Find happy. if( sys && (fParticles.kMissingIndex == fParticles.Find(const_cast(sys))) ) { - hsgResMgr::ResMgr()->AddViaNotify(sys->GetKey(), TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnCreate, 0, kRefParticles), plRefFlags::kPassiveRef); + hsgResMgr::ResMgr()->AddViaNotify(sys->GetKey(), new plGenRefMsg(GetKey(), plRefMsg::kOnCreate, 0, kRefParticles), plRefFlags::kPassiveRef); } } } diff --git a/Sources/Plasma/PubUtilLib/plDrawable/plDynaDecalMgr.h b/Sources/Plasma/PubUtilLib/plDrawable/plDynaDecalMgr.h index b8d54268..e5e03b03 100644 --- a/Sources/Plasma/PubUtilLib/plDrawable/plDynaDecalMgr.h +++ b/Sources/Plasma/PubUtilLib/plDrawable/plDynaDecalMgr.h @@ -98,13 +98,13 @@ public: double fLastTime; hsPoint3 fLastPos; double fWetTime; - hsScalar fWetLength; - UInt32 fFlags; + float fWetLength; + uint32_t fFlags; plDynaDecalInfo& Init(const plKey& key); }; -typedef std::map< unsigned_ptr, plDynaDecalInfo, std::less > plDynaDecalMap; +typedef std::map< uintptr_t, plDynaDecalInfo, std::less > plDynaDecalMap; // plDynaDecalMgr // Primary responsibilities: @@ -150,63 +150,63 @@ protected: hsTArray fPartyObjects; hsTArray fParticles; - hsScalar fPartyTime; + float fPartyTime; - UInt16 fMaxNumVerts; - UInt16 fMaxNumIdx; + uint16_t fMaxNumVerts; + uint16_t fMaxNumIdx; - UInt32 fWaitOnEnable; + uint32_t fWaitOnEnable; - hsScalar fWetLength; - hsScalar fRampEnd; - hsScalar fDecayStart; - hsScalar fLifeSpan; - hsScalar fIntensity; + float fWetLength; + float fRampEnd; + float fDecayStart; + float fLifeSpan; + float fIntensity; - hsScalar fGridSizeU; - hsScalar fGridSizeV; + float fGridSizeU; + float fGridSizeV; hsVector3 fScale; // some temp calculated stuff - hsScalar fInitAtten; + float fInitAtten; // These 4 are in normalized units [0..1], not feet. - hsScalar fMinDepth; - hsScalar fMinDepthRange; - hsScalar fMaxDepth; - hsScalar fMaxDepthRange; + float fMinDepth; + float fMinDepthRange; + float fMaxDepth; + float fMaxDepthRange; - hsTArray fPartIDs; + hsTArray fPartIDs; hsTArray fNotifies; const plPrintShape* IGetPrintShape(const plKey& objKey) const; - const plPrintShape* IGetPrintShape(plArmatureMod* avMod, UInt32 id) const; + const plPrintShape* IGetPrintShape(plArmatureMod* avMod, uint32_t id) const; virtual hsBool IHandleEnableMsg(const plDynaDecalEnableMsg* enaMsg); - void INotifyActive(plDynaDecalInfo& info, const plKey& armKey, UInt32 id) const; - void INotifyInactive(plDynaDecalInfo& info, const plKey& armKey, UInt32 id) const; + void INotifyActive(plDynaDecalInfo& info, const plKey& armKey, uint32_t id) const; + void INotifyInactive(plDynaDecalInfo& info, const plKey& armKey, uint32_t id) const; hsBool IWetParts(const plDynaDecalEnableMsg* enaMsg); - hsBool IWetPart(UInt32 id, const plDynaDecalEnableMsg* enaMsg); + hsBool IWetPart(uint32_t id, const plDynaDecalEnableMsg* enaMsg); void IWetInfo(plDynaDecalInfo& info, const plDynaDecalEnableMsg* enaMsg) const; - hsScalar IHowWet(plDynaDecalInfo& info, double t) const; - plDynaDecalInfo& IGetDecalInfo(unsigned_ptr id, const plKey& key); - void IRemoveDecalInfo(UInt32 id); + float IHowWet(plDynaDecalInfo& info, double t) const; + plDynaDecalInfo& IGetDecalInfo(uintptr_t id, const plKey& key); + void IRemoveDecalInfo(uint32_t id); void IRemoveDecalInfos(const plKey& key); hsGMaterial* ISetAuxMaterial(plAuxSpan* aux, hsGMaterial* mat, hsBool rtLit); - void IAllocAuxSpan(plAuxSpan* aux, UInt32 maxNumVerts, UInt32 maxNumIdx); - plAuxSpan* IGetAuxSpan(plDrawableSpans* targ, int iSpan, hsGMaterial* mat, UInt16 numVerts, UInt16 numIdx); + void IAllocAuxSpan(plAuxSpan* aux, uint32_t maxNumVerts, uint32_t maxNumIdx); + plAuxSpan* IGetAuxSpan(plDrawableSpans* targ, int iSpan, hsGMaterial* mat, uint16_t numVerts, uint16_t numIdx); hsBool IMakeAuxRefs(plPipeline* pipe); - UInt16* IGetBaseIdxPtr(const plAuxSpan* auxSpan) const; + uint16_t* IGetBaseIdxPtr(const plAuxSpan* auxSpan) const; plDecalVtxFormat* IGetBaseVtxPtr(const plAuxSpan* auxSpan) const; virtual int INewDecal() = 0; - plDynaDecal* IInitDecal(plAuxSpan* aux, double t, UInt16 numVerts, UInt16 numIdx); + plDynaDecal* IInitDecal(plAuxSpan* aux, double t, uint16_t numVerts, uint16_t numIdx); void IKillDecal(int i); void IUpdateDecals(double t); - void ICountIncoming(hsTArray& src, UInt16& numVerts, UInt16& numIdx) const; + void ICountIncoming(hsTArray& src, uint16_t& numVerts, uint16_t& numIdx) const; hsBool IConvertPolysColor(plAuxSpan* auxSpan, plDynaDecal* decal, hsTArray& src); hsBool IConvertPolysAlpha(plAuxSpan* auxSpan, plDynaDecal* decal, hsTArray& src); hsBool IConvertPolysVS(plAuxSpan* auxSpan, plDynaDecal* decal, hsTArray& src); @@ -225,7 +225,7 @@ protected: void ISetDepthFalloff(); // Sets from current cutter settings. - virtual void ICutoutCallback(const hsTArray& cutouts, hsBool hasWaterHeight=false, hsScalar waterHeight=0.f); + virtual void ICutoutCallback(const hsTArray& cutouts, hsBool hasWaterHeight=false, float waterHeight=0.f); hsGMaterial* IConvertToEnvMap(hsGMaterial* mat, plBitmap* envMap); @@ -259,25 +259,25 @@ public: void SetWaitOnEnable(hsBool on) { fWaitOnEnable = on; } hsBool GetWaitOnEnable() const { return fWaitOnEnable; } - void SetWetLength(hsScalar f) { fWetLength = f; } - void SetRampEnd(hsScalar f) { fRampEnd = f; } - void SetDecayStart(hsScalar f) { fDecayStart = f; } - void SetLifeSpan(hsScalar f) { fLifeSpan = f; } - void SetIntensity(hsScalar f) { fIntensity = f; } - hsScalar GetWetLength() const { return fWetLength; } - hsScalar GetRampEnd() const { return fRampEnd; } - hsScalar GetDecayStart() const { return fDecayStart; } - hsScalar GetLifeSpan() const { return fLifeSpan; } - hsScalar GetIntensity() const { return fIntensity; } + void SetWetLength(float f) { fWetLength = f; } + void SetRampEnd(float f) { fRampEnd = f; } + void SetDecayStart(float f) { fDecayStart = f; } + void SetLifeSpan(float f) { fLifeSpan = f; } + void SetIntensity(float f) { fIntensity = f; } + float GetWetLength() const { return fWetLength; } + float GetRampEnd() const { return fRampEnd; } + float GetDecayStart() const { return fDecayStart; } + float GetLifeSpan() const { return fLifeSpan; } + float GetIntensity() const { return fIntensity; } - void SetPartyTime(hsScalar secs) { fPartyTime = secs; } // Duration of particle spewage - hsScalar GetPartyTime() const { return fPartyTime; } + void SetPartyTime(float secs) { fPartyTime = secs; } // Duration of particle spewage + float GetPartyTime() const { return fPartyTime; } void ConvertToEnvMap(plBitmap* envMap); const plMipmap* GetMipmap() const; void AddNotify(const plKey& k) { fNotifies.Append(k); } - UInt32 GetNumNotifies() const { return fNotifies.GetCount(); } + uint32_t GetNumNotifies() const { return fNotifies.GetCount(); } const plKey& GetNotify(int i) const { return fNotifies[i]; } static void SetDisableAccumulate(hsBool on) { fDisableAccumulate = on; } diff --git a/Sources/Plasma/PubUtilLib/plDrawable/plDynaFootMgr.cpp b/Sources/Plasma/PubUtilLib/plDrawable/plDynaFootMgr.cpp index 2b68e621..776f6a10 100644 --- a/Sources/Plasma/PubUtilLib/plDrawable/plDynaFootMgr.cpp +++ b/Sources/Plasma/PubUtilLib/plDrawable/plDynaFootMgr.cpp @@ -40,7 +40,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "plDynaFootMgr.h" #include "plDynaDecal.h" @@ -63,8 +63,8 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "plMath/plRandom.h" static plRandom sRand; -static const UInt32 kNumPrintIDs = 2; -static const UInt32 kPrintIDs[kNumPrintIDs] = +static const uint32_t kNumPrintIDs = 2; +static const uint32_t kPrintIDs[kNumPrintIDs] = { plAvBrainHuman::RFootPrint, plAvBrainHuman::LFootPrint @@ -74,7 +74,7 @@ static const UInt32 kPrintIDs[kNumPrintIDs] = int plDynaFootMgr::INewDecal() { int idx = fDecals.GetCount(); - fDecals.Append(TRACKED_NEW plDynaSplot()); + fDecals.Append(new plDynaSplot()); return idx; } @@ -109,13 +109,13 @@ hsBool plDynaFootMgr::MsgReceive(plMessage* msg) plAvatarFootMsg* footMsg = plAvatarFootMsg::ConvertNoRef(msg); if( footMsg ) { - UInt32 id = footMsg->IsLeft() ? plAvBrainHuman::LFootPrint : plAvBrainHuman::RFootPrint; + uint32_t id = footMsg->IsLeft() ? plAvBrainHuman::LFootPrint : plAvBrainHuman::RFootPrint; plArmatureMod* armMod = footMsg->GetArmature(); const plPrintShape* shape = IGetPrintShape(armMod, id); if( shape ) { - plDynaDecalInfo& info = IGetDecalInfo(unsigned_ptr(shape), shape->GetKey()); + plDynaDecalInfo& info = IGetDecalInfo(uintptr_t(shape), shape->GetKey()); if( IPrintFromShape(shape, footMsg->IsLeft()) ) { INotifyActive(info, armMod->GetKey(), id); @@ -138,10 +138,10 @@ hsBool plDynaFootMgr::IPrintFromShape(const plPrintShape* shape, hsBool flip) if( shape ) { - plDynaDecalInfo& info = IGetDecalInfo(unsigned_ptr(shape), shape->GetKey()); + plDynaDecalInfo& info = IGetDecalInfo(uintptr_t(shape), shape->GetKey()); double secs = hsTimer::GetSysSeconds(); - hsScalar wetness = IHowWet(info, secs); + float wetness = IHowWet(info, secs); fInitAtten = wetness; if( wetness <= 0 ) diff --git a/Sources/Plasma/PubUtilLib/plDrawable/plDynaPuddleMgr.cpp b/Sources/Plasma/PubUtilLib/plDrawable/plDynaPuddleMgr.cpp index e389d7b0..868c6a4e 100644 --- a/Sources/Plasma/PubUtilLib/plDrawable/plDynaPuddleMgr.cpp +++ b/Sources/Plasma/PubUtilLib/plDrawable/plDynaPuddleMgr.cpp @@ -40,7 +40,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "plDynaPuddleMgr.h" #include "plPrintShape.h" @@ -55,8 +55,8 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "plAvatar/plAvBrainHuman.h" #include "plAvatar/plArmatureMod.h" -static const UInt32 kNumPrintIDs = 2; -static const UInt32 kPrintIDs[kNumPrintIDs] = +static const uint32_t kNumPrintIDs = 2; +static const uint32_t kPrintIDs[kNumPrintIDs] = { plAvBrainHuman::RFootPrint, plAvBrainHuman::LFootPrint @@ -94,7 +94,7 @@ hsBool plDynaPuddleMgr::MsgReceive(plMessage* msg) const plPrintShape* shape = IGetPrintShape(armMod, fPartIDs[i]); if( shape ) { - plDynaDecalInfo& info = IGetDecalInfo(unsigned_ptr(shape), shape->GetKey()); + plDynaDecalInfo& info = IGetDecalInfo(uintptr_t(shape), shape->GetKey()); if( IRippleFromShape(shape, true) ) { INotifyActive(info, armMod->GetKey(), fPartIDs[i]); diff --git a/Sources/Plasma/PubUtilLib/plDrawable/plDynaRippleMgr.cpp b/Sources/Plasma/PubUtilLib/plDrawable/plDynaRippleMgr.cpp index 209a7994..1f41a0d9 100644 --- a/Sources/Plasma/PubUtilLib/plDrawable/plDynaRippleMgr.cpp +++ b/Sources/Plasma/PubUtilLib/plDrawable/plDynaRippleMgr.cpp @@ -40,7 +40,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "plDynaRippleMgr.h" #include "plDynaDecal.h" @@ -66,8 +66,8 @@ static plRandom sRand; #include "plTweak.h" -static const UInt32 kNumPrintIDs = 5; -static const UInt32 kPrintIDs[kNumPrintIDs] = +static const uint32_t kNumPrintIDs = 5; +static const uint32_t kPrintIDs[kNumPrintIDs] = { plAvBrainHuman::TrunkPrint, plAvBrainHuman::LHandPrint, @@ -82,7 +82,7 @@ int plDynaRippleMgr::INewDecal() int idx = fDecals.GetCount(); #if 1 - plDynaRipple* rip = TRACKED_NEW plDynaRipple(); + plDynaRipple* rip = new plDynaRipple(); rip->fC1U = fInitUVW.fX; rip->fC2U = (fInitUVW.fX - fFinalUVW.fX) / (fLifeSpan * fFinalUVW.fX); @@ -91,8 +91,8 @@ int plDynaRippleMgr::INewDecal() fDecals.Append(rip); #else - plDynaWave* wave = TRACKED_NEW plDynaWave(); - static hsScalar kDefScrollRate = 0.1f; + plDynaWave* wave = new plDynaWave(); + static float kDefScrollRate = 0.1f; wave->fScrollRate = kDefScrollRate; fDecals.Append(wave); #endif @@ -146,7 +146,7 @@ hsBool plDynaRippleMgr::MsgReceive(plMessage* msg) const plPrintShape* shape = IGetPrintShape(armMsg->fArmature, fPartIDs[i]); if( shape ) { - plDynaDecalInfo& info = IGetDecalInfo(unsigned_ptr(shape), shape->GetKey()); + plDynaDecalInfo& info = IGetDecalInfo(uintptr_t(shape), shape->GetKey()); if( IRippleFromShape(shape, false) ) { INotifyActive(info, armMsg->fArmature->GetKey(), fPartIDs[i]); @@ -182,14 +182,14 @@ hsBool plDynaRippleMgr::IRippleFromShape(const plPrintShape* shape, hsBool force hsBool retVal = false; - plDynaDecalInfo& info = IGetDecalInfo(unsigned_ptr(shape), shape->GetKey()); + plDynaDecalInfo& info = IGetDecalInfo(uintptr_t(shape), shape->GetKey()); const hsMatrix44& shapeL2W = shape->GetOwner()->GetLocalToWorld(); - plConst(hsScalar) kMinDist(2.0f); - plConst(hsScalar) kMinTime(1.5f); + plConst(float) kMinDist(2.0f); + plConst(float) kMinTime(1.5f); double t = hsTimer::GetSysSeconds(); - hsScalar dt = hsScalar(t - info.fLastTime) * sRand.RandZeroToOne(); + float dt = float(t - info.fLastTime) * sRand.RandZeroToOne(); hsBool longEnough = (dt >= kMinTime); hsPoint3 xlate = shapeL2W.GetTranslate(); hsBool farEnough = (hsVector3(&info.fLastPos, &xlate).Magnitude() > kMinDist); @@ -203,12 +203,12 @@ hsBool plDynaRippleMgr::IRippleFromShape(const plPrintShape* shape, hsBool force randPert.Normalize(); if( !farEnough ) { - plConst(hsScalar) kRandPert = 0.5f; + plConst(float) kRandPert = 0.5f; randPert *= kRandPert; } else { - plConst(hsScalar) kRandPert = 0.15f; + plConst(float) kRandPert = 0.15f; randPert *= kRandPert; } pos += randPert; @@ -216,10 +216,10 @@ hsBool plDynaRippleMgr::IRippleFromShape(const plPrintShape* shape, hsBool force hsVector3 dir(0.f, 1.f, 0.f); hsVector3 up(0.f, 0.f, 1.f); - plConst(hsScalar) kHeightScale = 1.f; + plConst(float) kHeightScale = 1.f; pos.fZ += (shape->GetHeight() * fScale.fZ * kHeightScale) * 0.25f; - hsScalar wid = hsMaximum(shape->GetWidth(), shape->GetLength()); + float wid = hsMaximum(shape->GetWidth(), shape->GetLength()); hsVector3 size(wid * fScale.fX, wid * fScale.fY, shape->GetHeight() * fScale.fZ * kHeightScale); fCutter->SetLength(size); fCutter->Set(pos, dir, up); diff --git a/Sources/Plasma/PubUtilLib/plDrawable/plDynaRippleMgrVS.cpp b/Sources/Plasma/PubUtilLib/plDrawable/plDynaRippleMgrVS.cpp index 9c546208..a2bf1374 100644 --- a/Sources/Plasma/PubUtilLib/plDrawable/plDynaRippleMgrVS.cpp +++ b/Sources/Plasma/PubUtilLib/plDrawable/plDynaRippleMgrVS.cpp @@ -41,7 +41,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "plDynaRippleVSMgr.h" #include "plDynaDecal.h" @@ -77,7 +77,7 @@ int plDynaRippleVSMgr::INewDecal() { int idx = fDecals.GetCount(); - plDynaRippleVS* rip = TRACKED_NEW plDynaRippleVS(); + plDynaRippleVS* rip = new plDynaRippleVS(); rip->fC1U = fInitUVW.fX; rip->fC2U = (fInitUVW.fX - fFinalUVW.fX) / (fLifeSpan * fFinalUVW.fX); @@ -103,7 +103,7 @@ void plDynaRippleVSMgr::Read(hsStream* stream, hsResMgr* mgr) { plDynaRippleMgr::Read(stream, mgr); - mgr->ReadKeyNotifyMe(stream, TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnCreate, 0, kRefWaveSetBase), plRefFlags::kPassiveRef); + mgr->ReadKeyNotifyMe(stream, new plGenRefMsg(GetKey(), plRefMsg::kOnCreate, 0, kRefWaveSetBase), plRefFlags::kPassiveRef); } void plDynaRippleVSMgr::Write(hsStream* stream, hsResMgr* mgr) @@ -172,14 +172,14 @@ hsBool plDynaRippleVSMgr::IRippleFromShape(const plPrintShape* shape, hsBool for hsBool retVal = false; - plDynaDecalInfo& info = IGetDecalInfo(unsigned_ptr(shape), shape->GetKey()); + plDynaDecalInfo& info = IGetDecalInfo(uintptr_t(shape), shape->GetKey()); const hsMatrix44& shapeL2W = shape->GetOwner()->GetLocalToWorld(); - plConst(hsScalar) kMinDist(2.0f); - plConst(hsScalar) kMinTime(1.5f); + plConst(float) kMinDist(2.0f); + plConst(float) kMinTime(1.5f); double t = hsTimer::GetSysSeconds(); - hsScalar dt = hsScalar(t - info.fLastTime) * sRand.RandZeroToOne(); + float dt = float(t - info.fLastTime) * sRand.RandZeroToOne(); hsBool longEnough = (dt >= kMinTime); hsPoint3 xlate = shapeL2W.GetTranslate(); hsBool farEnough = (hsVector3(&info.fLastPos, &xlate).Magnitude() > kMinDist); @@ -193,18 +193,18 @@ hsBool plDynaRippleVSMgr::IRippleFromShape(const plPrintShape* shape, hsBool for randPert.Normalize(); if( !farEnough ) { - plConst(hsScalar) kRandPert = 0.5f; + plConst(float) kRandPert = 0.5f; randPert *= kRandPert; } else { - plConst(hsScalar) kRandPert = 0.15f; + plConst(float) kRandPert = 0.15f; randPert *= kRandPert; } pos += randPert; // Are we potentially touching the water? - hsScalar waterHeight = fWaveSetBase->GetHeight(); + float waterHeight = fWaveSetBase->GetHeight(); if( (pos.fZ - fScale.fZ * shape->GetHeight() < waterHeight) &&(pos.fZ + fScale.fZ * shape->GetHeight() > waterHeight) ) { @@ -212,9 +212,9 @@ hsBool plDynaRippleVSMgr::IRippleFromShape(const plPrintShape* shape, hsBool for hsVector3 dir(fWaveSetBase->GetWindDir()); hsVector3 up(0.f, 0.f, 1.f); - hsScalar wid = hsMaximum(shape->GetWidth(), shape->GetLength()); + float wid = hsMaximum(shape->GetWidth(), shape->GetLength()); - plConst(hsScalar) kMaxWaterDepth(1000.f); + plConst(float) kMaxWaterDepth(1000.f); hsVector3 size(wid * fScale.fX, wid * fScale.fY, kMaxWaterDepth); fCutter->SetLength(size); diff --git a/Sources/Plasma/PubUtilLib/plDrawable/plDynaTorpedoMgr.cpp b/Sources/Plasma/PubUtilLib/plDrawable/plDynaTorpedoMgr.cpp index 632b062e..4e567102 100644 --- a/Sources/Plasma/PubUtilLib/plDrawable/plDynaTorpedoMgr.cpp +++ b/Sources/Plasma/PubUtilLib/plDrawable/plDynaTorpedoMgr.cpp @@ -40,7 +40,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "plDynaTorpedoMgr.h" #include "plMessage/plBulletMsg.h" @@ -56,7 +56,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "plMath/plRandom.h" -static const UInt32 kNumPrintIDs = 0; +static const uint32_t kNumPrintIDs = 0; static plRandom sRand; @@ -78,7 +78,7 @@ void plDynaTorpedoMgr::Read(hsStream* stream, hsResMgr* mgr) hsBool plDynaTorpedoMgr::IHandleShot(plBulletMsg* bull) { - hsScalar partyTime = fPartyTime; + float partyTime = fPartyTime; plConst(int) kNumShots(3); int i; @@ -87,8 +87,8 @@ hsBool plDynaTorpedoMgr::IHandleShot(plBulletMsg* bull) hsVector3 up = IRandomUp(bull->Dir()); hsVector3 pert = bull->Dir() % up; - plConst(hsScalar) kMaxPert(1.f); - hsScalar maxPert = i ? kMaxPert * bull->Radius() : 0; + plConst(float) kMaxPert(1.f); + float maxPert = i ? kMaxPert * bull->Radius() : 0; pert *= sRand.RandMinusOneToOne() * maxPert * fScale.fX; pert += up * (sRand.RandMinusOneToOne() * maxPert * fScale.fY); @@ -96,26 +96,26 @@ hsBool plDynaTorpedoMgr::IHandleShot(plBulletMsg* bull) hsPoint3 pos = bull->From() + bull->Dir() * (bull->Range() * 0.5f); pos += pert; - hsScalar scaleX = bull->Radius() * fScale.fX * fInitUVW.fX; - hsScalar scaleY = bull->Radius() * fScale.fY * fInitUVW.fY; + float scaleX = bull->Radius() * fScale.fX * fInitUVW.fX; + float scaleY = bull->Radius() * fScale.fY * fInitUVW.fY; #if 0 - plConst(hsScalar) kMinScale(0.5f); + plConst(float) kMinScale(0.5f); if( i ) { scaleX *= sRand.RandRangeF(kMinScale, 1.f); scaleY *= sRand.RandRangeF(kMinScale, 1.f); } #elif 0 - hsScalar div = 1.f / (1.f + hsScalar(i)); + float div = 1.f / (1.f + float(i)); scaleX *= div; scaleY *= div; #else - plConst(hsScalar) kMinScale(0.25f); - plConst(hsScalar) kMaxScale(0.75f); + plConst(float) kMinScale(0.25f); + plConst(float) kMaxScale(0.75f); if( i ) { - hsScalar scale = sRand.RandRangeF(kMinScale, kMaxScale); + float scale = sRand.RandRangeF(kMinScale, kMaxScale); scaleX *= scale; scaleY *= scale; } @@ -124,7 +124,7 @@ hsBool plDynaTorpedoMgr::IHandleShot(plBulletMsg* bull) fCutter->SetLength(hsVector3(scaleX, scaleY, bull->Range())); fCutter->Set(pos, up, -bull->Dir()); - plDynaDecalInfo& info = IGetDecalInfo(unsigned_ptr(this), GetKey()); + plDynaDecalInfo& info = IGetDecalInfo(uintptr_t(this), GetKey()); if( bull->PartyTime() > 0 ) fPartyTime = bull->PartyTime(); diff --git a/Sources/Plasma/PubUtilLib/plDrawable/plDynaTorpedoVSMgr.cpp b/Sources/Plasma/PubUtilLib/plDrawable/plDynaTorpedoVSMgr.cpp index bf39ca98..ad8d35fb 100644 --- a/Sources/Plasma/PubUtilLib/plDrawable/plDynaTorpedoVSMgr.cpp +++ b/Sources/Plasma/PubUtilLib/plDrawable/plDynaTorpedoVSMgr.cpp @@ -40,7 +40,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "plDynaTorpedoVSMgr.h" #include "plDynaDecal.h" @@ -68,7 +68,7 @@ int plDynaTorpedoVSMgr::INewDecal() { int idx = fDecals.GetCount(); - plDynaRippleVS* rip = TRACKED_NEW plDynaRippleVS(); + plDynaRippleVS* rip = new plDynaRippleVS(); rip->fC1U = fInitUVW.fX; rip->fC2U = (fInitUVW.fX - fFinalUVW.fX) / (fLifeSpan * fFinalUVW.fX); @@ -148,7 +148,7 @@ void plDynaTorpedoVSMgr::Read(hsStream* stream, hsResMgr* mgr) { plDynaTorpedoMgr::Read(stream, mgr); - mgr->ReadKeyNotifyMe(stream, TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnCreate, 0, kRefWaveSetBase), plRefFlags::kPassiveRef); + mgr->ReadKeyNotifyMe(stream, new plGenRefMsg(GetKey(), plRefMsg::kOnCreate, 0, kRefWaveSetBase), plRefFlags::kPassiveRef); } void plDynaTorpedoVSMgr::Write(hsStream* stream, hsResMgr* mgr) diff --git a/Sources/Plasma/PubUtilLib/plDrawable/plDynaWakeMgr.cpp b/Sources/Plasma/PubUtilLib/plDrawable/plDynaWakeMgr.cpp index 6480f085..9751aa80 100644 --- a/Sources/Plasma/PubUtilLib/plDrawable/plDynaWakeMgr.cpp +++ b/Sources/Plasma/PubUtilLib/plDrawable/plDynaWakeMgr.cpp @@ -40,7 +40,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "plDynaWakeMgr.h" #include "plDynaDecal.h" @@ -72,7 +72,7 @@ int plDynaWakeMgr::INewDecal() { int idx = fDecals.GetCount(); - plDynaWake* wake = TRACKED_NEW plDynaWake(); + plDynaWake* wake = new plDynaWake(); wake->fC1U = fInitUVW.fX; wake->fC2U = (fInitUVW.fX - fFinalUVW.fX) / (fLifeSpan * fFinalUVW.fX); @@ -140,7 +140,7 @@ hsVector3 plDynaWakeMgr::IGetDirection(const plDynaDecalInfo& info, const hsPoin { hsVector3 animDir; hsPoint3 p = pos; - hsScalar t = fAnimPath->GetExtremePoint(p); + float t = fAnimPath->GetExtremePoint(p); fAnimPath->SetCurTime(t, plAnimPath::kNone); fAnimPath->GetVelocity(&animDir); @@ -151,8 +151,8 @@ hsVector3 plDynaWakeMgr::IGetDirection(const plDynaDecalInfo& info, const hsPoin } // Now if we want to factor in velocity, we can use (pos - info.fLastPos) / (hsTimer::GetSysSeconds() - info.fLastTime) - hsScalar dt = hsScalar(hsTimer::GetSysSeconds() - info.fLastTime); - const hsScalar kMinDt = 1.e-3f; + float dt = float(hsTimer::GetSysSeconds() - info.fLastTime); + const float kMinDt = 1.e-3f; if( (info.fFlags & plDynaDecalInfo::kImmersed) && (dt > kMinDt) ) { hsVector3 velDir(&pos, &info.fLastPos); @@ -173,14 +173,14 @@ hsBool plDynaWakeMgr::IRippleFromShape(const plPrintShape* shape, hsBool force) hsBool retVal = false; - plDynaDecalInfo& info = IGetDecalInfo(unsigned_ptr(shape), shape->GetKey()); + plDynaDecalInfo& info = IGetDecalInfo(uintptr_t(shape), shape->GetKey()); const hsMatrix44& shapeL2W = shape->GetOwner()->GetLocalToWorld(); - static hsScalar kMinDist = 1.0f; - static hsScalar kMinTime = 0.25f; + static float kMinDist = 1.0f; + static float kMinTime = 0.25f; double t = hsTimer::GetSysSeconds(); - hsScalar dt = hsScalar(t - info.fLastTime) * sRand.RandZeroToOne(); + float dt = float(t - info.fLastTime) * sRand.RandZeroToOne(); hsBool longEnough = (dt >= kMinTime); hsPoint3 xlate = shapeL2W.GetTranslate(); hsBool farEnough = (hsVector3(&info.fLastPos, &xlate).Magnitude() > kMinDist); @@ -197,19 +197,19 @@ hsBool plDynaWakeMgr::IRippleFromShape(const plPrintShape* shape, hsBool force) randPert.Normalize(); if( !farEnough ) { - static hsScalar kRandPert = 0.05f; + static float kRandPert = 0.05f; randPert *= kRandPert * shape->GetWidth(); } else { - static hsScalar kRandPert = 0.05f; + static float kRandPert = 0.05f; randPert *= kRandPert * shape->GetWidth(); } pos += randPert; hsVector3 up(0.f, 0.f, 1.f); - static hsScalar kHeightScale = 1.f; + static float kHeightScale = 1.f; pos.fZ += (shape->GetHeight() * fScale.fZ * kHeightScale) * 0.25f; pos += dir * shape->GetLength() * 0.5f * (1.f - fScale.fY); diff --git a/Sources/Plasma/PubUtilLib/plDrawable/plDynaWakeMgr.h b/Sources/Plasma/PubUtilLib/plDrawable/plDynaWakeMgr.h index f276ba53..191a4608 100644 --- a/Sources/Plasma/PubUtilLib/plDrawable/plDynaWakeMgr.h +++ b/Sources/Plasma/PubUtilLib/plDrawable/plDynaWakeMgr.h @@ -54,8 +54,8 @@ protected: hsVector3 fDefaultDir; plAnimPath* fAnimPath; - hsScalar fAnimWgt; - hsScalar fVelWgt; + float fAnimWgt; + float fVelWgt; virtual hsVector3 IGetDirection(const plDynaDecalInfo& info, const hsPoint3& pos) const; @@ -78,11 +78,11 @@ public: void SetDefaultDir(const hsVector3& v); const hsVector3& GetDefaultDir() const { return fDefaultDir; } - void SetAnimWeight(hsScalar f) { fAnimWgt = f; } - hsScalar GetAnimWeight() const { return fAnimWgt; } + void SetAnimWeight(float f) { fAnimWgt = f; } + float GetAnimWeight() const { return fAnimWgt; } - void SetVelocityWeight(hsScalar f) { fVelWgt = f; } - hsScalar GetVelocityWeight() const { return fVelWgt; } + void SetVelocityWeight(float f) { fVelWgt = f; } + float GetVelocityWeight() const { return fVelWgt; } }; diff --git a/Sources/Plasma/PubUtilLib/plDrawable/plFixedWaterState7.cpp b/Sources/Plasma/PubUtilLib/plDrawable/plFixedWaterState7.cpp index ac9c81e8..c2cfcb2b 100644 --- a/Sources/Plasma/PubUtilLib/plDrawable/plFixedWaterState7.cpp +++ b/Sources/Plasma/PubUtilLib/plDrawable/plFixedWaterState7.cpp @@ -40,12 +40,12 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "plFixedWaterState7.h" #include "hsStream.h" -void plFixedWaterState7::WaveState::Set(const plFixedWaterState7::WaveState& w, hsScalar secs) +void plFixedWaterState7::WaveState::Set(const plFixedWaterState7::WaveState& w, float secs) { fMaxLength.Set(w.fMaxLength, secs); fMinLength.Set(w.fMinLength, secs); @@ -54,7 +54,7 @@ void plFixedWaterState7::WaveState::Set(const plFixedWaterState7::WaveState& w, fAngleDev.Set(w.fAngleDev, secs); } -void plFixedWaterState7::Set(const plFixedWaterState7& t, hsScalar secs) +void plFixedWaterState7::Set(const plFixedWaterState7& t, float secs) { fWindDir.Set(t.fWindDir, secs); diff --git a/Sources/Plasma/PubUtilLib/plDrawable/plFixedWaterState7.h b/Sources/Plasma/PubUtilLib/plDrawable/plFixedWaterState7.h index 54ceae50..23540063 100644 --- a/Sources/Plasma/PubUtilLib/plDrawable/plFixedWaterState7.h +++ b/Sources/Plasma/PubUtilLib/plDrawable/plFixedWaterState7.h @@ -55,13 +55,13 @@ public: class WaveState { public: - plTimedSimple fMaxLength; - plTimedSimple fMinLength; - plTimedSimple fAmpOverLen; - plTimedSimple fChop; - plTimedSimple fAngleDev; + plTimedSimple fMaxLength; + plTimedSimple fMinLength; + plTimedSimple fAmpOverLen; + plTimedSimple fChop; + plTimedSimple fAngleDev; - void Set(const WaveState& w, hsScalar secs); + void Set(const WaveState& w, float secs); void Read(hsStream* s); void Write(hsStream* s) const; @@ -73,7 +73,7 @@ public: // Texture waves WaveState fTexState; - plTimedSimple fRippleScale; + plTimedSimple fRippleScale; // Geometric and Texture share wind direction plTimedCompound fWindDir; @@ -89,7 +89,7 @@ public: // Depth parameters. Affect how the depth of // the water vertex is interpreted into water // surface properties. - plTimedSimple fWaterHeight; + plTimedSimple fWaterHeight; plTimedCompound fWaterOffset; plTimedCompound fMaxAtten; plTimedCompound fMinAtten; @@ -98,17 +98,17 @@ public: // Shore parameters // Appearance - plTimedSimple fWispiness; + plTimedSimple fWispiness; plTimedCompound fShoreTint; // Next two only used in generation of bubble layer plTimedCompound fMaxColor; plTimedCompound fMinColor; - plTimedSimple fEdgeOpac; - plTimedSimple fEdgeRadius; + plTimedSimple fEdgeOpac; + plTimedSimple fEdgeRadius; // Simulation - plTimedSimple fPeriod; - plTimedSimple fFingerLength; + plTimedSimple fPeriod; + plTimedSimple fFingerLength; // The rest aren't really part of the state, that is they are normally controlled // by something exterior to the state. They are included here to allow a convenient @@ -119,10 +119,10 @@ public: plTimedCompound fSpecularTint; plTimedCompound fEnvCenter; - plTimedSimple fEnvRefresh; - plTimedSimple fEnvRadius; + plTimedSimple fEnvRefresh; + plTimedSimple fEnvRadius; - void Set(const plFixedWaterState7& s, hsScalar secs); + void Set(const plFixedWaterState7& s, float secs); void Read(hsStream* s); void Write(hsStream* s) const; diff --git a/Sources/Plasma/PubUtilLib/plDrawable/plGeoSpanDice.cpp b/Sources/Plasma/PubUtilLib/plDrawable/plGeoSpanDice.cpp index 3ec414d3..0eaa4ab7 100644 --- a/Sources/Plasma/PubUtilLib/plDrawable/plGeoSpanDice.cpp +++ b/Sources/Plasma/PubUtilLib/plDrawable/plGeoSpanDice.cpp @@ -42,7 +42,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include -#include "hsTypes.h" +#include "HeadSpin.h" #include "plGeoSpanDice.h" #include "plGeometrySpan.h" @@ -121,12 +121,12 @@ hsBool plGeoSpanDice::IHalf(plGeometrySpan* src, hsTArray& out, if( iAxis < 0 ) return false; - hsScalar midPoint = src->fLocalBounds.GetCenter()[iAxis]; + float midPoint = src->fLocalBounds.GetCenter()[iAxis]; - hsTArray loTris; - hsTArray hiTris; + hsTArray loTris; + hsTArray hiTris; - UInt16* indexData = src->fIndexData; + uint16_t* indexData = src->fIndexData; int numTris = src->fNumIndices / 3; @@ -170,7 +170,7 @@ hsBool plGeoSpanDice::IHalf(plGeometrySpan* src, hsTArray& out, int plGeoSpanDice::ISelectAxis(int exclAxis, plGeometrySpan* src) const { int iAxis = -1; - hsScalar maxDim = 0; + float maxDim = 0; int i; for( i = 0; i < 3; i++ ) @@ -179,7 +179,7 @@ int plGeoSpanDice::ISelectAxis(int exclAxis, plGeometrySpan* src) const if( exclAxis & (1 << i) ) continue; - hsScalar dim = src->fLocalBounds.GetMaxs()[i] - src->fLocalBounds.GetMins()[i]; + float dim = src->fLocalBounds.GetMaxs()[i] - src->fLocalBounds.GetMins()[i]; if( dim > maxDim ) { maxDim = dim; @@ -189,21 +189,21 @@ int plGeoSpanDice::ISelectAxis(int exclAxis, plGeometrySpan* src) const return iAxis; } -plGeometrySpan* plGeoSpanDice::IExtractTris(plGeometrySpan* src, hsTArray& tris) const +plGeometrySpan* plGeoSpanDice::IExtractTris(plGeometrySpan* src, hsTArray& tris) const { // First off, find out how many and which vers we're talking here. // Easiest way is while we're building the LUTs we'll want later anyway. - hsTArray fwdLUT; + hsTArray fwdLUT; fwdLUT.SetCount(src->fNumVerts); memset(fwdLUT.AcquireArray(), -1, src->fNumVerts * sizeof(*fwdLUT.AcquireArray())); - hsTArray bckLUT; + hsTArray bckLUT; bckLUT.SetCount(0); int i; for( i = 0; i < tris.GetCount(); i++ ) { - UInt16* idx = src->fIndexData + tris[i] * 3; + uint16_t* idx = src->fIndexData + tris[i] * 3; if( fwdLUT[*idx] < 0 ) { @@ -234,7 +234,7 @@ plGeometrySpan* plGeoSpanDice::IExtractTris(plGeometrySpan* src, hsTArrayfIndexData; + uint16_t* idxTrav = dst->fIndexData; for( i = 0; i < tris.GetCount(); i++ ) { *idxTrav++ = fwdLUT[src->fIndexData[ tris[i] * 3 + 0] ]; @@ -248,7 +248,7 @@ plGeometrySpan* plGeoSpanDice::IExtractTris(plGeometrySpan* src, hsTArrayfVertexData; + uint8_t* vtxTrav = dst->fVertexData; for( i = 0; i < numVerts; i++ ) { memcpy(vtxTrav, src->fVertexData + bckLUT[i] * stride, stride); @@ -299,7 +299,7 @@ plGeometrySpan* plGeoSpanDice::IExtractTris(plGeometrySpan* src, hsTArrayGetVertexSize(src->fFormat); dst->fNumIndices = numTris * 3; - dst->fIndexData = TRACKED_NEW UInt16[dst->fNumIndices]; + dst->fIndexData = new uint16_t[dst->fNumIndices]; dst->fNumVerts = numVerts; - dst->fVertexData = TRACKED_NEW UInt8[numVerts * stride]; + dst->fVertexData = new uint8_t[numVerts * stride]; if( src->fMultColor ) { - dst->fMultColor = TRACKED_NEW hsColorRGBA[numVerts]; + dst->fMultColor = new hsColorRGBA[numVerts]; } if( src->fAddColor ) { - dst->fAddColor = TRACKED_NEW hsColorRGBA[numVerts]; + dst->fAddColor = new hsColorRGBA[numVerts]; } if( src->fDiffuseRGBA ) { - dst->fDiffuseRGBA = TRACKED_NEW UInt32[numVerts]; + dst->fDiffuseRGBA = new uint32_t[numVerts]; } if( src->fSpecularRGBA ) { - dst->fSpecularRGBA = TRACKED_NEW UInt32[numVerts]; + dst->fSpecularRGBA = new uint32_t[numVerts]; } return dst; -} \ No newline at end of file +} diff --git a/Sources/Plasma/PubUtilLib/plDrawable/plGeoSpanDice.h b/Sources/Plasma/PubUtilLib/plDrawable/plGeoSpanDice.h index 3c78bbec..3f1ff8b2 100644 --- a/Sources/Plasma/PubUtilLib/plDrawable/plGeoSpanDice.h +++ b/Sources/Plasma/PubUtilLib/plDrawable/plGeoSpanDice.h @@ -51,13 +51,13 @@ class plGeometrySpan; class plGeoSpanDice { protected: - UInt32 fMinFaces; - UInt32 fMaxFaces; + uint32_t fMinFaces; + uint32_t fMaxFaces; hsPoint3 fMaxSize; hsBool INeedSplitting(plGeometrySpan* src) const; plGeometrySpan* IAllocSpace(plGeometrySpan* src, int numVerts, int numTris) const; - plGeometrySpan* IExtractTris(plGeometrySpan* src, hsTArray& tris) const; + plGeometrySpan* IExtractTris(plGeometrySpan* src, hsTArray& tris) const; int ISelectAxis(int exclAxis, plGeometrySpan* src) const; hsBool IHalf(plGeometrySpan* src, hsTArray& out, int exclAxis=0) const; diff --git a/Sources/Plasma/PubUtilLib/plDrawable/plGeometrySpan.cpp b/Sources/Plasma/PubUtilLib/plDrawable/plGeometrySpan.cpp index 1fe30601..b321337a 100644 --- a/Sources/Plasma/PubUtilLib/plDrawable/plGeometrySpan.cpp +++ b/Sources/Plasma/PubUtilLib/plDrawable/plGeometrySpan.cpp @@ -49,8 +49,8 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // // ////////////////////////////////////////////////////////////////////////////// -#include "hsWindows.h" -#include "hsTypes.h" + +#include "HeadSpin.h" #include "plGeometrySpan.h" #include "plSurface/hsGMaterial.h" #include "plSurface/plLayerInterface.h" @@ -60,7 +60,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com //// Static Data ///////////////////////////////////////////////////////////// hsBitVector plGeometrySpan::fInstanceGroupIDFlags; -UInt32 plGeometrySpan::fHighestReadInstanceGroup = 0; +uint32_t plGeometrySpan::fHighestReadInstanceGroup = 0; hsTArray *> plGeometrySpan::fInstanceGroups; @@ -108,7 +108,7 @@ void plGeometrySpan::IClearMembers( void ) fSpecularRGBA = nil; fInstanceRefs = nil; fInstanceGroupID = kNoGroupID; - fSpanRefIndex = (UInt32)-1; + fSpanRefIndex = (uint32_t)-1; fLocalToOBB.Reset(); fOBBToLocal.Reset(); @@ -193,7 +193,7 @@ void plGeometrySpan::MakeInstanceOf( const plGeometrySpan *instance ) // Go find a new groupID instance->fInstanceGroupID = IAllocateNewGroupID(); - instance->fInstanceRefs = array = TRACKED_NEW hsTArray; + instance->fInstanceRefs = array = new hsTArray; // Go figure, it won't append the const version to the array...this is a cheat, // but then, so is making fInstanceRefs mutable :) array->Append( (plGeometrySpan *)instance ); @@ -216,11 +216,11 @@ void plGeometrySpan::IUnShareData() { if( fVertexData ) { - UInt8* oldVtxData = fVertexData; + uint8_t* oldVtxData = fVertexData; - UInt32 size = GetVertexSize( fFormat ); + uint32_t size = GetVertexSize( fFormat ); - fVertexData = TRACKED_NEW UInt8[ size * fNumVerts ]; + fVertexData = new uint8_t[ size * fNumVerts ]; memcpy( fVertexData, oldVtxData, size * fNumVerts ); } @@ -228,7 +228,7 @@ void plGeometrySpan::IUnShareData() { hsColorRGBA* oldMult = fMultColor; - fMultColor = TRACKED_NEW hsColorRGBA[ fNumVerts ]; + fMultColor = new hsColorRGBA[ fNumVerts ]; memcpy( fMultColor, oldMult, sizeof(hsColorRGBA) * fNumVerts ); } @@ -236,7 +236,7 @@ void plGeometrySpan::IUnShareData() { hsColorRGBA* oldAdd = fAddColor; - fAddColor = TRACKED_NEW hsColorRGBA[ fNumVerts ]; + fAddColor = new hsColorRGBA[ fNumVerts ]; memcpy( fAddColor, oldAdd, sizeof(hsColorRGBA) * fNumVerts ); } } @@ -250,7 +250,7 @@ void plGeometrySpan::BreakInstance() hsAssert(fInstanceRefs->GetCount(), "Don't BreakInstance if I'm the last one, use UnInstance instead"); fInstanceGroupID = IAllocateNewGroupID(); - fInstanceRefs = TRACKED_NEW hsTArray; + fInstanceRefs = new hsTArray; fInstanceRefs->Append(this); IUnShareData(); @@ -303,9 +303,9 @@ void plGeometrySpan::UnInstance() // Static function that allocates a new groupID by finding an empty slot in // the bitVector, then marking it as used and returning that bit # -UInt32 plGeometrySpan::IAllocateNewGroupID( void ) +uint32_t plGeometrySpan::IAllocateNewGroupID( void ) { - UInt32 id; + uint32_t id; for( id = 0; id < fInstanceGroupIDFlags.GetSize(); id++ ) @@ -321,7 +321,7 @@ UInt32 plGeometrySpan::IAllocateNewGroupID( void ) //// IClearGroupID /////////////////////////////////////////////////////////// // Done with this groupID, so clear the entry in the bit table. -void plGeometrySpan::IClearGroupID( UInt32 groupID ) +void plGeometrySpan::IClearGroupID( uint32_t groupID ) { fInstanceGroupIDFlags.ClearBit( groupID - 1 ); } @@ -340,7 +340,7 @@ void plGeometrySpan::IClearGroupID( UInt32 groupID ) // we remove an entry, we decrement this ID until we hit a used pointer again; // if we don't find one, we reset the array. -hsTArray *plGeometrySpan::IGetInstanceGroup( UInt32 groupID, UInt32 expectedCount ) +hsTArray *plGeometrySpan::IGetInstanceGroup( uint32_t groupID, uint32_t expectedCount ) { hsTArray *array; @@ -350,7 +350,7 @@ hsTArray *plGeometrySpan::IGetInstanceGroup( UInt32 groupID, if( fInstanceGroups.GetCount() <= groupID || fInstanceGroups[ groupID ] == nil ) { // Not yet in the list--make a new hsTArray - array = TRACKED_NEW hsTArray; + array = new hsTArray; fInstanceGroupIDFlags.SetBit( groupID, true ); if( expectedCount > 1 ) @@ -416,24 +416,24 @@ void plGeometrySpan::IDuplicateUniqueData( const plGeometrySpan *source ) if( source->fIndexData != nil ) { - fIndexData = TRACKED_NEW UInt16[ fNumIndices ]; - memcpy( fIndexData, source->fIndexData, sizeof( UInt16 ) * fNumIndices ); + fIndexData = new uint16_t[ fNumIndices ]; + memcpy( fIndexData, source->fIndexData, sizeof( uint16_t ) * fNumIndices ); } else fIndexData = nil; if( source->fDiffuseRGBA ) { - fDiffuseRGBA = TRACKED_NEW UInt32[ fNumVerts ]; - memcpy( fDiffuseRGBA, source->fDiffuseRGBA, sizeof( UInt32 ) * fNumVerts ); + fDiffuseRGBA = new uint32_t[ fNumVerts ]; + memcpy( fDiffuseRGBA, source->fDiffuseRGBA, sizeof( uint32_t ) * fNumVerts ); } else fDiffuseRGBA = nil; if( source->fSpecularRGBA ) { - fSpecularRGBA = TRACKED_NEW UInt32[ fNumVerts ]; - memcpy( fSpecularRGBA, source->fSpecularRGBA, sizeof( UInt32 ) * fNumVerts ); + fSpecularRGBA = new uint32_t[ fNumVerts ]; + memcpy( fSpecularRGBA, source->fSpecularRGBA, sizeof( uint32_t ) * fNumVerts ); } else fSpecularRGBA = nil; @@ -447,7 +447,7 @@ void plGeometrySpan::IDuplicateUniqueData( const plGeometrySpan *source ) void plGeometrySpan::CopyFrom( const plGeometrySpan *source ) { - UInt32 size; + uint32_t size; // Just to make sure @@ -462,7 +462,7 @@ void plGeometrySpan::CopyFrom( const plGeometrySpan *source ) { size = GetVertexSize( fFormat ); - fVertexData = TRACKED_NEW UInt8[ size * fNumVerts ]; + fVertexData = new uint8_t[ size * fNumVerts ]; memcpy( fVertexData, source->fVertexData, size * fNumVerts ); } else @@ -470,7 +470,7 @@ void plGeometrySpan::CopyFrom( const plGeometrySpan *source ) if( source->fMultColor ) { - fMultColor = TRACKED_NEW hsColorRGBA[ fNumVerts ]; + fMultColor = new hsColorRGBA[ fNumVerts ]; memcpy( fMultColor, source->fMultColor, sizeof(hsColorRGBA) * fNumVerts ); } else @@ -480,7 +480,7 @@ void plGeometrySpan::CopyFrom( const plGeometrySpan *source ) if( source->fAddColor ) { - fAddColor = TRACKED_NEW hsColorRGBA[ fNumVerts ]; + fAddColor = new hsColorRGBA[ fNumVerts ]; memcpy( fAddColor, source->fAddColor, sizeof(hsColorRGBA) * fNumVerts ); } else @@ -493,7 +493,7 @@ void plGeometrySpan::CopyFrom( const plGeometrySpan *source ) void plGeometrySpan::Read( hsStream *stream ) { - UInt32 size, i; + uint32_t size, i; hsAssert( !fCreating, "Cannot read geometry span while creating" ); @@ -543,19 +543,19 @@ void plGeometrySpan::Read( hsStream *stream ) { size = GetVertexSize( fFormat ); - fVertexData = TRACKED_NEW UInt8[ size * fNumVerts ]; + fVertexData = new uint8_t[ size * fNumVerts ]; stream->Read( size * fNumVerts, fVertexData ); - fMultColor = TRACKED_NEW hsColorRGBA[ fNumVerts ]; - fAddColor = TRACKED_NEW hsColorRGBA[ fNumVerts ]; + fMultColor = new hsColorRGBA[ fNumVerts ]; + fAddColor = new hsColorRGBA[ fNumVerts ]; for( i = 0; i < fNumVerts; i++ ) { fMultColor[ i ].Read( stream ); fAddColor[ i ].Read( stream ); } - fDiffuseRGBA = TRACKED_NEW UInt32[ fNumVerts ]; - fSpecularRGBA = TRACKED_NEW UInt32[ fNumVerts ]; + fDiffuseRGBA = new uint32_t[ fNumVerts ]; + fSpecularRGBA = new uint32_t[ fNumVerts ]; stream->ReadLE32( fNumVerts, fDiffuseRGBA ); stream->ReadLE32( fNumVerts, fSpecularRGBA ); } @@ -570,7 +570,7 @@ void plGeometrySpan::Read( hsStream *stream ) if( fNumIndices > 0 ) { - fIndexData = TRACKED_NEW UInt16[ fNumIndices ]; + fIndexData = new uint16_t[ fNumIndices ]; stream->ReadLE16( fNumIndices, fIndexData ); } else @@ -580,7 +580,7 @@ void plGeometrySpan::Read( hsStream *stream ) fInstanceGroupID = stream->ReadLE32(); if( fInstanceGroupID != kNoGroupID ) { - UInt32 count = stream->ReadLE32(); + uint32_t count = stream->ReadLE32(); fInstanceRefs = IGetInstanceGroup( fInstanceGroupID, count ); fInstanceRefs->Append( this ); @@ -592,7 +592,7 @@ void plGeometrySpan::Read( hsStream *stream ) void plGeometrySpan::Write( hsStream *stream ) { - UInt32 size, i; + uint32_t size, i; hsAssert( !fCreating, "Cannot write geometry span while creating" ); @@ -611,7 +611,7 @@ void plGeometrySpan::Write( hsStream *stream ) stream->WriteByte( fNumMatrices ); stream->WriteLE16(fLocalUVWChans); stream->WriteLE16(fMaxBoneIdx); - stream->WriteLE16((UInt16)fPenBoneIdx); + stream->WriteLE16((uint16_t)fPenBoneIdx); stream->WriteLEScalar(fMinDist); stream->WriteLEScalar(fMaxDist); @@ -663,9 +663,9 @@ void plGeometrySpan::Write( hsStream *stream ) //// GetVertexSize /////////////////////////////////////////////////////////// -UInt32 plGeometrySpan::GetVertexSize( UInt8 format ) +uint32_t plGeometrySpan::GetVertexSize( uint8_t format ) { - UInt32 size; + uint32_t size; size = sizeof( float ) * ( 3 + 3 ); // pos + normal @@ -683,14 +683,14 @@ UInt32 plGeometrySpan::GetVertexSize( UInt8 format ) default: hsAssert( false, "Bad weight count in GetVertexSize()" ); } if( format & kSkinIndices ) - size += sizeof(UInt32); + size += sizeof(uint32_t); return size; } //// BeginCreate ////////////////////////////////////////////////////////////// -void plGeometrySpan::BeginCreate( hsGMaterial *material, const hsMatrix44 &l2wMatrix, UInt8 format ) +void plGeometrySpan::BeginCreate( hsGMaterial *material, const hsMatrix44 &l2wMatrix, uint8_t format ) { fCreating = true; @@ -705,8 +705,8 @@ void plGeometrySpan::BeginCreate( hsGMaterial *material, const hsMatrix44 &l2 // that UV channel (and all above them) are not used. The array of pointers // MUST be of size kMaxNumUVChannels. -UInt16 plGeometrySpan::AddVertex( hsPoint3 *position, hsPoint3 *normal, hsColorRGBA& multColor, hsColorRGBA& addColor, - hsPoint3 **uvPtrArray, float weight1, float weight2, float weight3, UInt32 indices ) +uint16_t plGeometrySpan::AddVertex( hsPoint3 *position, hsPoint3 *normal, hsColorRGBA& multColor, hsColorRGBA& addColor, + hsPoint3 **uvPtrArray, float weight1, float weight2, float weight3, uint32_t indices ) { AddVertex( position, normal, 0, 0, uvPtrArray, weight1, weight2, weight3, indices ); @@ -720,8 +720,8 @@ UInt16 plGeometrySpan::AddVertex( hsPoint3 *position, hsPoint3 *normal, hsColor return idx; } -UInt16 plGeometrySpan::AddVertex( hsPoint3 *position, hsPoint3 *normal, UInt32 hexColor, UInt32 specularColor, - hsPoint3 **uvPtrArray, float weight1, float weight2, float weight3, UInt32 indices ) +uint16_t plGeometrySpan::AddVertex( hsPoint3 *position, hsPoint3 *normal, uint32_t hexColor, uint32_t specularColor, + hsPoint3 **uvPtrArray, float weight1, float weight2, float weight3, uint32_t indices ) { TempVertex vert; int i, numWeights; @@ -782,14 +782,14 @@ UInt16 plGeometrySpan::AddVertex( hsPoint3 *position, hsPoint3 *normal, UInt32 //// AddIndex Variations ////////////////////////////////////////////////////// -void plGeometrySpan::AddIndex( UInt16 index ) +void plGeometrySpan::AddIndex( uint16_t index ) { hsAssert( fCreating, "Calling AddIndex() on a non-creating plGeometrySpan!" ); fIndexAccum.Append( index ); } -void plGeometrySpan::AddTriIndices( UInt16 index1, UInt16 index2, UInt16 index3 ) +void plGeometrySpan::AddTriIndices( uint16_t index1, uint16_t index2, uint16_t index3 ) { hsAssert( fCreating, "Calling AddTriIndices() on a non-creating plGeometrySpan!" ); @@ -800,7 +800,7 @@ void plGeometrySpan::AddTriIndices( UInt16 index1, UInt16 index2, UInt16 inde //// AddTriangle ////////////////////////////////////////////////////////////// -void plGeometrySpan::AddTriangle( hsPoint3 *vert1, hsPoint3 *vert2, hsPoint3 *vert3, UInt32 color ) +void plGeometrySpan::AddTriangle( hsPoint3 *vert1, hsPoint3 *vert2, hsPoint3 *vert3, uint32_t color ) { hsVector3 twoTo1, twoTo3, normal; hsPoint3 normalPt; @@ -823,12 +823,12 @@ void plGeometrySpan::AddTriangle( hsPoint3 *vert1, hsPoint3 *vert2, hsPoint3 //// AddVertexArray /////////////////////////////////////////////////////////// -void plGeometrySpan::AddVertexArray( UInt32 count, hsPoint3 *positions, hsVector3 *normals, UInt32 *colors, hsPoint3* uvws, int uvwsPerVtx ) +void plGeometrySpan::AddVertexArray( uint32_t count, hsPoint3 *positions, hsVector3 *normals, uint32_t *colors, hsPoint3* uvws, int uvwsPerVtx ) { hsAssert( fCreating, "Calling AddTriIndices() on a non-creating plGeometrySpan!" ); - UInt32 i, dest; + uint32_t i, dest; // This test actually does work, even if it's bad form... hsAssert( GetNumUVs() == uvwsPerVtx, "Calling wrong AddVertex() for plGeometrySpan format" ); @@ -866,12 +866,12 @@ void plGeometrySpan::AddVertexArray( UInt32 count, hsPoint3 *positions, hsVec //// AddIndexArray //////////////////////////////////////////////////////////// -void plGeometrySpan::AddIndexArray( UInt32 count, UInt16 *indices ) +void plGeometrySpan::AddIndexArray( uint32_t count, uint16_t *indices ) { hsAssert( fCreating, "Calling AddTriIndices() on a non-creating plGeometrySpan!" ); - UInt32 i, dest; + uint32_t i, dest; dest = fIndexAccum.GetCount(); @@ -885,8 +885,8 @@ void plGeometrySpan::AddIndexArray( UInt32 count, UInt16 *indices ) void plGeometrySpan::EndCreate( void ) { hsBounds3Ext bounds; - UInt32 i, size; - UInt8 *tempPtr; + uint32_t i, size; + uint8_t *tempPtr; hsAssert( fCreating, "Calling EndCreate() on a non-creating plGeometrySpan!" ); @@ -918,18 +918,18 @@ void plGeometrySpan::EndCreate( void ) delete [] fVertexData; fNumVerts = fVertAccum.GetCount(); - fVertexData = TRACKED_NEW UInt8[ size * fNumVerts ]; + fVertexData = new uint8_t[ size * fNumVerts ]; delete [] fMultColor; - fMultColor = TRACKED_NEW hsColorRGBA[ fNumVerts ]; + fMultColor = new hsColorRGBA[ fNumVerts ]; delete [] fAddColor; - fAddColor = TRACKED_NEW hsColorRGBA[ fNumVerts ]; + fAddColor = new hsColorRGBA[ fNumVerts ]; delete [] fDiffuseRGBA; delete [] fSpecularRGBA; - fDiffuseRGBA = TRACKED_NEW UInt32[ fNumVerts ]; - fSpecularRGBA = TRACKED_NEW UInt32[ fNumVerts ]; + fDiffuseRGBA = new uint32_t[ fNumVerts ]; + fSpecularRGBA = new uint32_t[ fNumVerts ]; } else fNumVerts = fVertAccum.GetCount(); @@ -963,8 +963,8 @@ void plGeometrySpan::EndCreate( void ) tempPtr += numWeights * sizeof(float); if( fFormat & kSkinIndices ) { - memcpy( tempPtr, &fVertAccum[ i ].fIndices, sizeof(UInt32) ); - tempPtr += sizeof(UInt32); + memcpy( tempPtr, &fVertAccum[ i ].fIndices, sizeof(uint32_t) ); + tempPtr += sizeof(uint32_t); } } @@ -1000,7 +1000,7 @@ void plGeometrySpan::EndCreate( void ) delete [] fIndexData; fNumIndices = fIndexAccum.GetCount(); - fIndexData = TRACKED_NEW UInt16[ fNumIndices ]; + fIndexData = new uint16_t[ fNumIndices ]; } else fNumIndices = fIndexAccum.GetCount(); @@ -1019,7 +1019,7 @@ void plGeometrySpan::AdjustBounds(hsBounds3Ext& bnd) const hsBounds3Ext wBnd = bnd; wBnd.Transform(&fLocalToWorld); - const hsScalar kMaxWaveHeight(5.f); + const float kMaxWaveHeight(5.f); hsBounds3Ext rebound; rebound.MakeEmpty(); hsPoint3 pos = wBnd.GetMins(); @@ -1033,7 +1033,7 @@ void plGeometrySpan::AdjustBounds(hsBounds3Ext& bnd) const } //// ExtractVertex //////////////////////////////////////////////////////////// -void plGeometrySpan::ExtractInitColor( UInt32 index, hsColorRGBA *multColor, hsColorRGBA *addColor) const +void plGeometrySpan::ExtractInitColor( uint32_t index, hsColorRGBA *multColor, hsColorRGBA *addColor) const { if( multColor ) *multColor = fMultColor[index]; @@ -1044,9 +1044,9 @@ void plGeometrySpan::ExtractInitColor( UInt32 index, hsColorRGBA *multColor, // Extracts the given vertex out of the vertex buffer and into the pointers // given. -void plGeometrySpan::ExtractVertex( UInt32 index, hsPoint3 *pos, hsVector3 *normal, hsColorRGBA *color, hsColorRGBA *specColor ) +void plGeometrySpan::ExtractVertex( uint32_t index, hsPoint3 *pos, hsVector3 *normal, hsColorRGBA *color, hsColorRGBA *specColor ) { - UInt32 hex, spec; + uint32_t hex, spec; ExtractVertex( index, pos, normal, &hex, &spec ); @@ -1067,9 +1067,9 @@ void plGeometrySpan::ExtractVertex( UInt32 index, hsPoint3 *pos, hsVector3 *n //// ExtractVertex //////////////////////////////////////////////////////////// // Hex-color version of ExtractVertex. -void plGeometrySpan::ExtractVertex( UInt32 index, hsPoint3 *pos, hsVector3 *normal, UInt32 *color, UInt32 *specColor ) +void plGeometrySpan::ExtractVertex( uint32_t index, hsPoint3 *pos, hsVector3 *normal, uint32_t *color, uint32_t *specColor ) { - UInt8 *basePtr; + uint8_t *basePtr; float *fPtr; @@ -1095,9 +1095,9 @@ void plGeometrySpan::ExtractVertex( UInt32 index, hsPoint3 *pos, hsVector3 *n //// ExtractUv //////////////////////////////////////////////////////////////// -void plGeometrySpan::ExtractUv( UInt32 vIdx, UInt8 uvIdx, hsPoint3 *uv ) +void plGeometrySpan::ExtractUv( uint32_t vIdx, uint8_t uvIdx, hsPoint3 *uv ) { - UInt8 *basePtr; + uint8_t *basePtr; float *fPtr; @@ -1119,11 +1119,11 @@ void plGeometrySpan::ExtractUv( UInt32 vIdx, UInt8 uvIdx, hsPoint3 *uv ) //// ExtractWeights /////////////////////////////////////////////////////////// // Gets the weights out of the vertex data. -void plGeometrySpan::ExtractWeights( UInt32 vIdx, float *weightArray, UInt32 *indices ) +void plGeometrySpan::ExtractWeights( uint32_t vIdx, float *weightArray, uint32_t *indices ) { - UInt8 *basePtr; + uint8_t *basePtr; float *fPtr; - UInt32 *dPtr; + uint32_t *dPtr; int numWeights; @@ -1149,7 +1149,7 @@ void plGeometrySpan::ExtractWeights( UInt32 vIdx, float *weightArray, UInt32 { fPtr += numWeights; - dPtr = (UInt32 *)fPtr; + dPtr = (uint32_t *)fPtr; *indices = *dPtr; } } @@ -1158,9 +1158,9 @@ void plGeometrySpan::ExtractWeights( UInt32 vIdx, float *weightArray, UInt32 // Stuffs the given vertex data into the vertex buffer. Vertex must already // exist! -void plGeometrySpan::StuffVertex( UInt32 index, hsPoint3 *pos, hsPoint3 *normal, hsColorRGBA *color, hsColorRGBA *specColor ) +void plGeometrySpan::StuffVertex( uint32_t index, hsPoint3 *pos, hsPoint3 *normal, hsColorRGBA *color, hsColorRGBA *specColor ) { - UInt8 *basePtr; + uint8_t *basePtr; float *fPtr; @@ -1183,27 +1183,27 @@ void plGeometrySpan::StuffVertex( UInt32 index, hsPoint3 *pos, hsPoint3 *norm StuffVertex( index, color, specColor ); } -void plGeometrySpan::StuffVertex( UInt32 index, hsColorRGBA *color, hsColorRGBA *specColor ) +void plGeometrySpan::StuffVertex( uint32_t index, hsColorRGBA *color, hsColorRGBA *specColor ) { - UInt8 r, g, b, a; + uint8_t r, g, b, a; /// Where? hsAssert( index < fNumVerts, "Invalid index passed to StuffVertex()" ); - a = (UInt8)( color->a >= 1 ? 255 : color->a <= 0 ? 0 : color->a * 255.0 ); - r = (UInt8)( color->r >= 1 ? 255 : color->r <= 0 ? 0 : color->r * 255.0 ); - g = (UInt8)( color->g >= 1 ? 255 : color->g <= 0 ? 0 : color->g * 255.0 ); - b = (UInt8)( color->b >= 1 ? 255 : color->b <= 0 ? 0 : color->b * 255.0 ); + a = (uint8_t)( color->a >= 1 ? 255 : color->a <= 0 ? 0 : color->a * 255.0 ); + r = (uint8_t)( color->r >= 1 ? 255 : color->r <= 0 ? 0 : color->r * 255.0 ); + g = (uint8_t)( color->g >= 1 ? 255 : color->g <= 0 ? 0 : color->g * 255.0 ); + b = (uint8_t)( color->b >= 1 ? 255 : color->b <= 0 ? 0 : color->b * 255.0 ); fDiffuseRGBA[ index ] = ( a << 24 ) | ( r << 16 ) | ( g << 8 ) | ( b ); if( specColor != nil ) { - a = (UInt8)( specColor->a >= 1 ? 255 : specColor->a <= 0 ? 0 : specColor->a * 255.0 ); - r = (UInt8)( specColor->r >= 1 ? 255 : specColor->r <= 0 ? 0 : specColor->r * 255.0 ); - g = (UInt8)( specColor->g >= 1 ? 255 : specColor->g <= 0 ? 0 : specColor->g * 255.0 ); - b = (UInt8)( specColor->b >= 1 ? 255 : specColor->b <= 0 ? 0 : specColor->b * 255.0 ); + a = (uint8_t)( specColor->a >= 1 ? 255 : specColor->a <= 0 ? 0 : specColor->a * 255.0 ); + r = (uint8_t)( specColor->r >= 1 ? 255 : specColor->r <= 0 ? 0 : specColor->r * 255.0 ); + g = (uint8_t)( specColor->g >= 1 ? 255 : specColor->g <= 0 ? 0 : specColor->g * 255.0 ); + b = (uint8_t)( specColor->b >= 1 ? 255 : specColor->b <= 0 ? 0 : specColor->b * 255.0 ); fSpecularRGBA[ index ] = ( a << 24 ) | ( r << 16 ) | ( g << 8 ) | ( b ); } diff --git a/Sources/Plasma/PubUtilLib/plDrawable/plGeometrySpan.h b/Sources/Plasma/PubUtilLib/plDrawable/plGeometrySpan.h index 2c6af105..f40615a8 100644 --- a/Sources/Plasma/PubUtilLib/plDrawable/plGeometrySpan.h +++ b/Sources/Plasma/PubUtilLib/plDrawable/plGeometrySpan.h @@ -136,40 +136,40 @@ class plGeometrySpan hsBounds3Ext fWorldBounds; plFogEnvironment *fFogEnviron; - UInt32 fBaseMatrix; - UInt8 fNumMatrices; - UInt16 fLocalUVWChans; - UInt16 fMaxBoneIdx; - UInt32 fPenBoneIdx; + uint32_t fBaseMatrix; + uint8_t fNumMatrices; + uint16_t fLocalUVWChans; + uint16_t fMaxBoneIdx; + uint32_t fPenBoneIdx; - hsScalar fMinDist; - hsScalar fMaxDist; + float fMinDist; + float fMaxDist; - hsScalar fWaterHeight; + float fWaterHeight; - UInt8 fFormat; - UInt32 fProps; - UInt32 fNumVerts, fNumIndices; + uint8_t fFormat; + uint32_t fProps; + uint32_t fNumVerts, fNumIndices; /// Current vertex format: /// float position[ 3 ]; /// float normal[ 3 ]; /// float uvCoords[ ][ 3 ]; /// float weights[]; // 0-3 blending weights - /// UInt32 weightIndices; // Only if there are >= 1 blending weights + /// uint32_t weightIndices; // Only if there are >= 1 blending weights - UInt8* fVertexData; - UInt16* fIndexData; - UInt32 fDecalLevel; + uint8_t* fVertexData; + uint16_t* fIndexData; + uint32_t fDecalLevel; hsColorRGBA* fMultColor; hsColorRGBA* fAddColor; - UInt32* fDiffuseRGBA; - UInt32* fSpecularRGBA; + uint32_t* fDiffuseRGBA; + uint32_t* fSpecularRGBA; mutable hsTArray* fInstanceRefs; - mutable UInt32 fInstanceGroupID; // For writing out/reading in instance refs + mutable uint32_t fInstanceGroupID; // For writing out/reading in instance refs // The following is only used for logging during export. It is never set // at runtime. Don't even think about using it for anything. @@ -177,7 +177,7 @@ class plGeometrySpan // The following is ONLY used during pack; it's so we can do a reverse lookup // from the instanceRefs list to the correct span in the drawable - UInt32 fSpanRefIndex; + uint32_t fSpanRefIndex; // These two matrices are inverses of each other (duh). They are only used on computing the local // bounds. fLocalBounds is always the bounds in the space defined by fWorldToLocal, but the bounds @@ -191,34 +191,34 @@ class plGeometrySpan ~plGeometrySpan(); /// UV stuff - UInt8 GetNumUVs( void ) const { return ( fFormat & kUVCountMask ); } - void SetNumUVs( UInt8 numUVs ) + uint8_t GetNumUVs( void ) const { return ( fFormat & kUVCountMask ); } + void SetNumUVs( uint8_t numUVs ) { hsAssert( numUVs < kMaxNumUVChannels, "Invalid UV count to plGeometrySpan" ); fFormat = ( fFormat & ~kUVCountMask ) | numUVs; } - static UInt8 CalcNumUVs( UInt8 format ) { return ( format & kUVCountMask ); } - static UInt8 UVCountToFormat( UInt8 numUVs ) { return numUVs & kUVCountMask; } + static uint8_t CalcNumUVs( uint8_t format ) { return ( format & kUVCountMask ); } + static uint8_t UVCountToFormat( uint8_t numUVs ) { return numUVs & kUVCountMask; } /// Creation functions - void BeginCreate( hsGMaterial *material, const hsMatrix44 &l2wMatrix, UInt8 format ); + void BeginCreate( hsGMaterial *material, const hsMatrix44 &l2wMatrix, uint8_t format ); // Phasing these in... // Note: uvArray should be a fixed array with enough pointers for the max # of uv channels. // Any unused UVs should be nil - UInt16 AddVertex( hsPoint3 *position, hsPoint3 *normal, hsColorRGBA& multColor, hsColorRGBA& addColor, - hsPoint3 **uvPtrArray, float weight1 = -1.0f, float weight2 = -1.0f, float weight3 = -1.0f, UInt32 weightIndices = 0 ); - UInt16 AddVertex( hsPoint3 *position, hsPoint3 *normal, UInt32 hexColor, UInt32 specularColor = 0, - hsPoint3 **uvPtrArray = nil, float weight1 = -1.0f, float weight2 = -1.0f, float weight3 = -1.0f, UInt32 weightIndices = 0 ); + uint16_t AddVertex( hsPoint3 *position, hsPoint3 *normal, hsColorRGBA& multColor, hsColorRGBA& addColor, + hsPoint3 **uvPtrArray, float weight1 = -1.0f, float weight2 = -1.0f, float weight3 = -1.0f, uint32_t weightIndices = 0 ); + uint16_t AddVertex( hsPoint3 *position, hsPoint3 *normal, uint32_t hexColor, uint32_t specularColor = 0, + hsPoint3 **uvPtrArray = nil, float weight1 = -1.0f, float weight2 = -1.0f, float weight3 = -1.0f, uint32_t weightIndices = 0 ); - void AddIndex( UInt16 index ); - void AddTriIndices( UInt16 index1, UInt16 index2, UInt16 index3 ); - void AddTriangle( hsPoint3 *vert1, hsPoint3 *vert2, hsPoint3 *vert3, UInt32 color ); + void AddIndex( uint16_t index ); + void AddTriIndices( uint16_t index1, uint16_t index2, uint16_t index3 ); + void AddTriangle( hsPoint3 *vert1, hsPoint3 *vert2, hsPoint3 *vert3, uint32_t color ); // uvws is an array count*uvwsPerVtx long in order [uvw(s) for vtx0, uvw(s) for vtx1, ...], or is nil - void AddVertexArray( UInt32 count, hsPoint3 *positions, hsVector3 *normals, UInt32 *colors, hsPoint3 *uvws=nil, int uvwsPerVtx=0 ); - void AddIndexArray( UInt32 count, UInt16 *indices ); + void AddVertexArray( uint32_t count, hsPoint3 *positions, hsVector3 *normals, uint32_t *colors, hsPoint3 *uvws=nil, int uvwsPerVtx=0 ); + void AddIndexArray( uint32_t count, uint16_t *indices ); void EndCreate( void ); @@ -226,13 +226,13 @@ class plGeometrySpan /// Manipulation--currently only used for applying static lighting, which of course needs individual vertices // Wrong. Also used for the interleaving of the multiple vertex data streams here into single vertex // stream within the plGBufferGroups. mf. - void ExtractInitColor( UInt32 index, hsColorRGBA *multColor, hsColorRGBA *addColor) const; - void ExtractVertex( UInt32 index, hsPoint3 *pos, hsVector3 *normal, hsColorRGBA *color, hsColorRGBA *specColor = nil ); - void ExtractVertex( UInt32 index, hsPoint3 *pos, hsVector3 *normal, UInt32 *color, UInt32 *specColor = nil ); - void ExtractUv( UInt32 vIdx, UInt8 uvIdx, hsPoint3* uv ); - void ExtractWeights( UInt32 vIdx, float *weightArray, UInt32 *indices ); - void StuffVertex( UInt32 index, hsPoint3 *pos, hsPoint3 *normal, hsColorRGBA *color, hsColorRGBA *specColor = nil ); - void StuffVertex( UInt32 index, hsColorRGBA *color, hsColorRGBA *specColor = nil ); + void ExtractInitColor( uint32_t index, hsColorRGBA *multColor, hsColorRGBA *addColor) const; + void ExtractVertex( uint32_t index, hsPoint3 *pos, hsVector3 *normal, hsColorRGBA *color, hsColorRGBA *specColor = nil ); + void ExtractVertex( uint32_t index, hsPoint3 *pos, hsVector3 *normal, uint32_t *color, uint32_t *specColor = nil ); + void ExtractUv( uint32_t vIdx, uint8_t uvIdx, hsPoint3* uv ); + void ExtractWeights( uint32_t vIdx, float *weightArray, uint32_t *indices ); + void StuffVertex( uint32_t index, hsPoint3 *pos, hsPoint3 *normal, hsColorRGBA *color, hsColorRGBA *specColor = nil ); + void StuffVertex( uint32_t index, hsColorRGBA *color, hsColorRGBA *specColor = nil ); // Clear out the buffers void ClearBuffers( void ); @@ -244,12 +244,12 @@ class plGeometrySpan void MakeInstanceOf( const plGeometrySpan *instance ); // Get the size of one vertex in a span, based on a format - static UInt32 GetVertexSize( UInt8 format ); + static uint32_t GetVertexSize( uint8_t format ); void Read( hsStream *stream ); void Write( hsStream *stream ); - static UInt32 AllocateNewGroupID() { return IAllocateNewGroupID(); } + static uint32_t AllocateNewGroupID() { return IAllocateNewGroupID(); } void BreakInstance(); void ChangeInstance(plGeometrySpan* newInstance); @@ -263,16 +263,16 @@ class plGeometrySpan { hsPoint3 fPosition; hsPoint3 fNormal; - UInt32 fColor, fSpecularColor; + uint32_t fColor, fSpecularColor; hsColorRGBA fMultColor, fAddColor; hsPoint3 fUVs[ kMaxNumUVChannels ]; float fWeights[ 3 ]; - UInt32 fIndices; + uint32_t fIndices; }; hsBool fCreating; hsTArray fVertAccum; - hsTArray fIndexAccum; + hsTArray fIndexAccum; void IUnShareData(); void IDuplicateUniqueData( const plGeometrySpan *source ); @@ -300,12 +300,12 @@ class plGeometrySpan // THIS is so we can clear fInstanceGroups as early and as efficiently as possible; see // the notes on IGetInstanceGroup(). - static UInt32 fHighestReadInstanceGroup; + static uint32_t fHighestReadInstanceGroup; - static UInt32 IAllocateNewGroupID( void ); - static void IClearGroupID( UInt32 groupID ); + static uint32_t IAllocateNewGroupID( void ); + static void IClearGroupID( uint32_t groupID ); - static hsTArray *IGetInstanceGroup( UInt32 groupID, UInt32 expectedCount ); + static hsTArray *IGetInstanceGroup( uint32_t groupID, uint32_t expectedCount ); }; diff --git a/Sources/Plasma/PubUtilLib/plDrawable/plInstanceDrawInterface.cpp b/Sources/Plasma/PubUtilLib/plDrawable/plInstanceDrawInterface.cpp index 7bd4d7c2..3c66d133 100644 --- a/Sources/Plasma/PubUtilLib/plDrawable/plInstanceDrawInterface.cpp +++ b/Sources/Plasma/PubUtilLib/plDrawable/plInstanceDrawInterface.cpp @@ -58,7 +58,7 @@ void plInstanceDrawInterface::Read(hsStream* stream, hsResMgr* mgr) plDrawInterface::Read(stream, mgr); fTargetID = stream->ReadLE32(); - plSwapSpansRefMsg *sMsg = TRACKED_NEW plSwapSpansRefMsg(GetKey(), plRefMsg::kOnCreate, -1, -1); + plSwapSpansRefMsg *sMsg = new plSwapSpansRefMsg(GetKey(), plRefMsg::kOnCreate, -1, -1); mgr->ReadKeyNotifyMe(stream, sMsg, plRefFlags::kActiveRef); } @@ -113,7 +113,7 @@ void plInstanceDrawInterface::AddSharedMesh(plSharedMesh *mesh, hsGMaterial *mat #ifdef MF_NOSHADOW_ACC // TESTHACKERY FOLLOWS - GlassesNoShadow - UInt32 noShadHack = 0; + uint32_t noShadHack = 0; if( mesh->GetKey() && (strstr(mesh->GetKey()->GetName(), "lasses") || strstr(mesh->GetKey()->GetName(), "oggles")) ) noShadHack = plGeometrySpan::kPropNoShadowCast; #endif // MF_NOSHADOW_ACC @@ -136,11 +136,11 @@ void plInstanceDrawInterface::AddSharedMesh(plSharedMesh *mesh, hsGMaterial *mat } // Add the spans to the drawable - UInt32 index = (UInt32)-1; + uint32_t index = (uint32_t)-1; index = fDrawable->AppendDISpans(mesh->fSpans, index, false, true, addToFront, lod); // Tell the drawInterface what drawable and index it wants. - UInt8 iDraw = (UInt8)GetNumDrawables(); + uint8_t iDraw = (uint8_t)GetNumDrawables(); ISetDrawable(iDraw, fDrawable); SetDrawableMeshIndex(iDraw, index); SetSharedMesh(iDraw, mesh); @@ -148,12 +148,12 @@ void plInstanceDrawInterface::AddSharedMesh(plSharedMesh *mesh, hsGMaterial *mat fDrawables[iDraw]->SetProperty(fDrawableIndices[iDraw], kDisable, true); #ifdef HS_DEBUGGING - plDISpansMsg* diMsg = TRACKED_NEW plDISpansMsg(fDrawable->GetKey(), plDISpansMsg::kAddingSpan, index, plDISpansMsg::kLeaveEmptyDrawable); + plDISpansMsg* diMsg = new plDISpansMsg(fDrawable->GetKey(), plDISpansMsg::kAddingSpan, index, plDISpansMsg::kLeaveEmptyDrawable); diMsg->SetSender(GetKey()); diMsg->Send(); #endif - plSharedMeshBCMsg *smMsg = TRACKED_NEW plSharedMeshBCMsg; + plSharedMeshBCMsg *smMsg = new plSharedMeshBCMsg; smMsg->SetSender(GetKey()); smMsg->fDraw = fDrawable; smMsg->fMesh = mesh; @@ -165,7 +165,7 @@ void plInstanceDrawInterface::AddSharedMesh(plSharedMesh *mesh, hsGMaterial *mat plMorphSequence *morph = const_cast(plMorphSequence::ConvertNoRef(fOwner->GetModifierByType(plMorphSequence::Index()))); if (morph) { - //hsgResMgr::ResMgr()->AddViaNotify(mesh->GetKey(), TRACKED_NEW plGenRefMsg(morph->GetKey(), plRefMsg::kOnCreate, -1, -1), plRefFlags::kPassiveRef); + //hsgResMgr::ResMgr()->AddViaNotify(mesh->GetKey(), new plGenRefMsg(morph->GetKey(), plRefMsg::kOnCreate, -1, -1), plRefFlags::kPassiveRef); morph->AddSharedMesh(mesh); } } @@ -173,12 +173,12 @@ void plInstanceDrawInterface::AddSharedMesh(plSharedMesh *mesh, hsGMaterial *mat void plInstanceDrawInterface::RemoveSharedMesh(plSharedMesh *mesh) { - UInt32 geoIndex = fMeshes.Find(mesh); + uint32_t geoIndex = fMeshes.Find(mesh); if (geoIndex != fMeshes.kMissingIndex) { - IClearIndex((UInt8)geoIndex); + IClearIndex((uint8_t)geoIndex); - plSharedMeshBCMsg *smMsg = TRACKED_NEW plSharedMeshBCMsg; + plSharedMeshBCMsg *smMsg = new plSharedMeshBCMsg; smMsg->SetSender(GetKey()); smMsg->fDraw = fDrawable; smMsg->fMesh = mesh; @@ -197,7 +197,7 @@ void plInstanceDrawInterface::RemoveSharedMesh(plSharedMesh *mesh) } } -void plInstanceDrawInterface::ICheckDrawableIndex(UInt8 which) +void plInstanceDrawInterface::ICheckDrawableIndex(uint8_t which) { if( which >= fMeshes.GetCount() ) { @@ -214,18 +214,18 @@ void plInstanceDrawInterface::ReleaseData() plDrawInterface::ReleaseData(); } -void plInstanceDrawInterface::SetSharedMesh(UInt8 which, plSharedMesh *mesh) +void plInstanceDrawInterface::SetSharedMesh(uint8_t which, plSharedMesh *mesh) { ICheckDrawableIndex(which); fMeshes[which] = mesh; } -void plInstanceDrawInterface::IClearIndex(UInt8 which) +void plInstanceDrawInterface::IClearIndex(uint8_t which) { plDrawableSpans *drawable = plDrawableSpans::ConvertNoRef(fDrawables[which]); if (drawable != nil) { - plDISpansMsg* diMsg = TRACKED_NEW plDISpansMsg(fDrawable->GetKey(), plDISpansMsg::kRemovingSpan, fDrawableIndices[which], plDISpansMsg::kLeaveEmptyDrawable); + plDISpansMsg* diMsg = new plDISpansMsg(fDrawable->GetKey(), plDISpansMsg::kRemovingSpan, fDrawableIndices[which], plDISpansMsg::kLeaveEmptyDrawable); diMsg->SetSender(GetKey()); diMsg->Send(); } @@ -236,7 +236,7 @@ void plInstanceDrawInterface::IClearIndex(UInt8 which) } // Temp testing - not really ideal. Check with Bob for real soln. -Int32 plInstanceDrawInterface::GetSharedMeshIndex(const plSharedMesh *mesh) const +int32_t plInstanceDrawInterface::GetSharedMeshIndex(const plSharedMesh *mesh) const { int i; for( i = 0; i < fMeshes.GetCount(); i++ ) diff --git a/Sources/Plasma/PubUtilLib/plDrawable/plInstanceDrawInterface.h b/Sources/Plasma/PubUtilLib/plDrawable/plInstanceDrawInterface.h index 828013f7..d1ff19aa 100644 --- a/Sources/Plasma/PubUtilLib/plDrawable/plInstanceDrawInterface.h +++ b/Sources/Plasma/PubUtilLib/plDrawable/plInstanceDrawInterface.h @@ -53,10 +53,10 @@ protected: plDrawableSpans *fDrawable; hsTArray fMeshes; - virtual void ICheckDrawableIndex(UInt8 which); + virtual void ICheckDrawableIndex(uint8_t which); public: - UInt32 fTargetID; + uint32_t fTargetID; plInstanceDrawInterface(); virtual ~plInstanceDrawInterface(); @@ -73,11 +73,11 @@ public: void RemoveSharedMesh(plSharedMesh *mesh); virtual void ReleaseData(); - virtual void SetSharedMesh(UInt8 which, plSharedMesh *mesh); - virtual void IClearIndex(UInt8 which); + virtual void SetSharedMesh(uint8_t which, plSharedMesh *mesh); + virtual void IClearIndex(uint8_t which); plDrawableSpans *GetInstanceDrawable() const { return fDrawable; } - Int32 GetSharedMeshIndex(const plSharedMesh *mesh) const; + int32_t GetSharedMeshIndex(const plSharedMesh *mesh) const; }; diff --git a/Sources/Plasma/PubUtilLib/plDrawable/plInterMeshSmooth.cpp b/Sources/Plasma/PubUtilLib/plDrawable/plInterMeshSmooth.cpp index 32768a9d..722a19f2 100644 --- a/Sources/Plasma/PubUtilLib/plDrawable/plInterMeshSmooth.cpp +++ b/Sources/Plasma/PubUtilLib/plDrawable/plInterMeshSmooth.cpp @@ -40,7 +40,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "plInterMeshSmooth.h" #include "plDrawableSpans.h" @@ -48,15 +48,15 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com class EdgeBin { public: - UInt16 fVtx; - UInt16 fCount; + uint16_t fVtx; + uint16_t fCount; EdgeBin() : fVtx(0), fCount(0) {} }; -void plInterMeshSmooth::FindEdges(UInt32 maxVtxIdx, UInt32 nTris, UInt16* idxList, hsTArray& edgeVerts) +void plInterMeshSmooth::FindEdges(uint32_t maxVtxIdx, uint32_t nTris, uint16_t* idxList, hsTArray& edgeVerts) { - hsTArray* bins = TRACKED_NEW hsTArray[maxVtxIdx+1]; + hsTArray* bins = new hsTArray[maxVtxIdx+1]; hsBitVector edgeVertBits; // For each vert pair (edge) in idxList @@ -134,7 +134,7 @@ void plInterMeshSmooth::FindEdges(UInt32 maxVtxIdx, UInt32 nTris, UInt16* idxLis delete [] bins; } -void plInterMeshSmooth::FindEdges(hsTArray& sets, hsTArray* edgeVerts) +void plInterMeshSmooth::FindEdges(hsTArray& sets, hsTArray* edgeVerts) { int i; for( i = 0; i < sets.GetCount(); i++ ) @@ -143,9 +143,9 @@ void plInterMeshSmooth::FindEdges(hsTArray& sets, hsTArray if( !(span->fTypeMask & plSpan::kIcicleSpan) ) continue; - UInt32 nTris = sets[i].fDrawable->CvtGetNumTris(sets[i].fSpanIdx); - UInt16* idxList = sets[i].fDrawable->CvtGetIndexList(sets[i].fSpanIdx); - UInt32 maxVertIdx = sets[i].fDrawable->CvtGetNumVerts(sets[i].fSpanIdx)-1; + uint32_t nTris = sets[i].fDrawable->CvtGetNumTris(sets[i].fSpanIdx); + uint16_t* idxList = sets[i].fDrawable->CvtGetIndexList(sets[i].fSpanIdx); + uint32_t maxVertIdx = sets[i].fDrawable->CvtGetNumVerts(sets[i].fSpanIdx)-1; FindEdges(maxVertIdx, nTris, idxList, edgeVerts[i]); } @@ -153,8 +153,8 @@ void plInterMeshSmooth::FindEdges(hsTArray& sets, hsTArray void plInterMeshSmooth::SmoothNormals(hsTArray& sets) { - hsTArray* shareVtx = TRACKED_NEW hsTArray[sets.GetCount()]; - hsTArray* edgeVerts = TRACKED_NEW hsTArray[sets.GetCount()]; + hsTArray* shareVtx = new hsTArray[sets.GetCount()]; + hsTArray* edgeVerts = new hsTArray[sets.GetCount()]; FindEdges(sets, edgeVerts); int i; @@ -202,7 +202,7 @@ void plInterMeshSmooth::SmoothNormals(hsTArray& sets) delete [] edgeVerts; } -void plInterMeshSmooth::FindSharedVerts(hsPoint3& searchPos, plSpanHandle& set, hsTArray& edgeVerts, hsTArray& shareVtx, hsVector3& normAccum) +void plInterMeshSmooth::FindSharedVerts(hsPoint3& searchPos, plSpanHandle& set, hsTArray& edgeVerts, hsTArray& shareVtx, hsVector3& normAccum) { int i; for( i = 0; i < edgeVerts.GetCount(); i++ ) @@ -220,29 +220,29 @@ void plInterMeshSmooth::FindSharedVerts(hsPoint3& searchPos, plSpanHandle& set, } } -void plInterMeshSmooth::SetNormals(plSpanHandle& set, hsTArray& shareVtx, hsVector3& norm) +void plInterMeshSmooth::SetNormals(plSpanHandle& set, hsTArray& shareVtx, hsVector3& norm) { int i; for( i = 0; i < shareVtx.GetCount(); i++ ) GetNormal(set, shareVtx[i]) = norm; } -hsPoint3& plInterMeshSmooth::GetPosition(plSpanHandle& set, UInt16 idx) +hsPoint3& plInterMeshSmooth::GetPosition(plSpanHandle& set, uint16_t idx) { return set.fDrawable->CvtGetPosition(set.fSpanIdx, idx); } -hsVector3& plInterMeshSmooth::GetNormal(plSpanHandle& set, UInt16 idx) +hsVector3& plInterMeshSmooth::GetNormal(plSpanHandle& set, uint16_t idx) { return set.fDrawable->CvtGetNormal(set.fSpanIdx, idx); } -void plInterMeshSmooth::SetAngle(hsScalar degs) +void plInterMeshSmooth::SetAngle(float degs) { - fMinNormDot = hsCosine(hsScalarDegToRad(degs)); + fMinNormDot = cos(hsDegreesToRadians(degs)); } -hsScalar plInterMeshSmooth::GetAngle() const +float plInterMeshSmooth::GetAngle() const { - return hsScalarRadToDeg(hsACosine(fMinNormDot)); -} \ No newline at end of file + return hsRadiansToDegrees(acos(fMinNormDot)); +} diff --git a/Sources/Plasma/PubUtilLib/plDrawable/plInterMeshSmooth.h b/Sources/Plasma/PubUtilLib/plDrawable/plInterMeshSmooth.h index c65017be..d1a02652 100644 --- a/Sources/Plasma/PubUtilLib/plDrawable/plInterMeshSmooth.h +++ b/Sources/Plasma/PubUtilLib/plDrawable/plInterMeshSmooth.h @@ -53,26 +53,26 @@ class plSpanHandle { public: plDrawableSpans* fDrawable; - UInt32 fSpanIdx; + uint32_t fSpanIdx; }; class plInterMeshSmooth { protected: - hsScalar fMinNormDot; + float fMinNormDot; - void FindEdges(UInt32 maxVtxIdx, UInt32 nTris, UInt16* idxList, hsTArray& edgeVerts); - void FindEdges(hsTArray& sets, hsTArray* edgeVerts); - void FindSharedVerts(hsPoint3& searchPos, plSpanHandle& set, hsTArray& edgeVerts, hsTArray& shareVtx, hsVector3& normAccum); - void SetNormals(plSpanHandle& set, hsTArray& shareVtx, hsVector3& norm); - hsPoint3& GetPosition(plSpanHandle& set, UInt16 idx); - hsVector3& GetNormal(plSpanHandle& set, UInt16 idx); + void FindEdges(uint32_t maxVtxIdx, uint32_t nTris, uint16_t* idxList, hsTArray& edgeVerts); + void FindEdges(hsTArray& sets, hsTArray* edgeVerts); + void FindSharedVerts(hsPoint3& searchPos, plSpanHandle& set, hsTArray& edgeVerts, hsTArray& shareVtx, hsVector3& normAccum); + void SetNormals(plSpanHandle& set, hsTArray& shareVtx, hsVector3& norm); + hsPoint3& GetPosition(plSpanHandle& set, uint16_t idx); + hsVector3& GetNormal(plSpanHandle& set, uint16_t idx); public: plInterMeshSmooth() : fMinNormDot(0.25f) {} - void SetAngle(hsScalar degs); - hsScalar GetAngle() const; // returns degrees + void SetAngle(float degs); + float GetAngle() const; // returns degrees void SmoothNormals(hsTArray& sets); }; diff --git a/Sources/Plasma/PubUtilLib/plDrawable/plMorphArray.cpp b/Sources/Plasma/PubUtilLib/plDrawable/plMorphArray.cpp index 6f062f51..c862f141 100644 --- a/Sources/Plasma/PubUtilLib/plDrawable/plMorphArray.cpp +++ b/Sources/Plasma/PubUtilLib/plDrawable/plMorphArray.cpp @@ -40,7 +40,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "plMorphArray.h" plMorphArray::plMorphArray() @@ -53,7 +53,7 @@ plMorphArray::~plMorphArray() // MorphArray - Apply -void plMorphArray::Apply(hsTArray& dst, hsTArray* weights /* = nil */) const +void plMorphArray::Apply(hsTArray& dst, hsTArray* weights /* = nil */) const { // Have our choice of cache thrashing here // We can for each delta/for each vert diff --git a/Sources/Plasma/PubUtilLib/plDrawable/plMorphArray.h b/Sources/Plasma/PubUtilLib/plDrawable/plMorphArray.h index 21f4c17d..468ed597 100644 --- a/Sources/Plasma/PubUtilLib/plDrawable/plMorphArray.h +++ b/Sources/Plasma/PubUtilLib/plDrawable/plMorphArray.h @@ -53,7 +53,7 @@ public: plMorphArray(); virtual ~plMorphArray(); - void Apply(hsTArray& dst, hsTArray* weights = nil) const; + void Apply(hsTArray& dst, hsTArray* weights = nil) const; void Read(hsStream* s, hsResMgr* mgr); void Write(hsStream* s, hsResMgr* mgr); @@ -62,8 +62,8 @@ public: void AddDelta(const plMorphDelta& delta); int GetNumDeltas() const { return fDeltas.GetCount(); } - hsScalar GetWeight(int iDel) { return fDeltas[iDel].GetWeight(); } - void SetWeight(int iDel, hsScalar w) { if( iDel < fDeltas.GetCount() )fDeltas[iDel].SetWeight(w); } + float GetWeight(int iDel) { return fDeltas[iDel].GetWeight(); } + void SetWeight(int iDel, float w) { if( iDel < fDeltas.GetCount() )fDeltas[iDel].SetWeight(w); } }; #endif // plMorphArray_inc diff --git a/Sources/Plasma/PubUtilLib/plDrawable/plMorphDelta.cpp b/Sources/Plasma/PubUtilLib/plDrawable/plMorphDelta.cpp index c44309e7..61a4ab88 100644 --- a/Sources/Plasma/PubUtilLib/plDrawable/plMorphDelta.cpp +++ b/Sources/Plasma/PubUtilLib/plDrawable/plMorphDelta.cpp @@ -40,7 +40,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "plMorphDelta.h" #include "hsStream.h" @@ -53,7 +53,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "plTweak.h" -static const hsScalar kMinWeight = 1.e-2f; +static const float kMinWeight = 1.e-2f; plMorphSpan::plMorphSpan() : fUVWs(nil), @@ -91,7 +91,7 @@ plMorphDelta& plMorphDelta::operator=(const plMorphDelta& src) return *this; } -void plMorphDelta::Apply(hsTArray& dst, hsScalar weight /* = -1.f */) const +void plMorphDelta::Apply(hsTArray& dst, float weight /* = -1.f */) const { if( weight == -1.f) weight = fWeight; // None passed in, use our stored value @@ -189,7 +189,7 @@ void plMorphDelta::ComputeDeltas(const hsTArray& base, const hs plMorphSpan& dst = fSpans[iSpan]; - const UInt16 numUVWs = baseAcc.AccessVtx().NumUVWs(); + const uint16_t numUVWs = baseAcc.AccessVtx().NumUVWs(); hsTArray deltas; hsTArray uvws; @@ -213,12 +213,12 @@ void plMorphDelta::ComputeDeltas(const hsTArray& base, const hs hsBool nonZero = false; // These are actually min del SQUARED. - plConst(hsScalar) kMinDelPos(1.e-4f); // From Budtpueller's Handbook of Constants - plConst(hsScalar) kMinDelNorm(3.e-2f); // About 10 degrees - plConst(hsScalar) kMinDelUVW(1.e-4f); // From BHC + plConst(float) kMinDelPos(1.e-4f); // From Budtpueller's Handbook of Constants + plConst(float) kMinDelNorm(3.e-2f); // About 10 degrees + plConst(float) kMinDelUVW(1.e-4f); // From BHC hsPoint3 mPos = d2b * *movedIter.Position(); hsVector3 delPos( &mPos, baseIter.Position()); - hsScalar delPosSq = delPos.MagnitudeSquared(); + float delPosSq = delPos.MagnitudeSquared(); if( delPosSq > kMinDelPos ) nonZero = true; else @@ -226,7 +226,7 @@ void plMorphDelta::ComputeDeltas(const hsTArray& base, const hs hsVector3 delNorm = (d2bTInv * *movedIter.Normal()) - *baseIter.Normal(); - hsScalar delNormSq = delNorm.MagnitudeSquared(); + float delNormSq = delNorm.MagnitudeSquared(); if( delNormSq > kMinDelNorm ) nonZero = true; else @@ -236,7 +236,7 @@ void plMorphDelta::ComputeDeltas(const hsTArray& base, const hs for( i = 0; i < numUVWs; i++ ) { delUVWs[i] = *movedIter.UVW(i) - *baseIter.UVW(i); - hsScalar delUVWSq = delUVWs[i].MagnitudeSquared(); + float delUVWSq = delUVWs[i].MagnitudeSquared(); if( delUVWSq > kMinDelUVW ) nonZero = true; else @@ -282,7 +282,7 @@ void plMorphDelta::AllocDeltas(int iSpan, int nDel, int nUVW) int uvwCnt = nDel * nUVW; if( uvwCnt ) - fSpans[iSpan].fUVWs = TRACKED_NEW hsPoint3[uvwCnt]; + fSpans[iSpan].fUVWs = new hsPoint3[uvwCnt]; else fSpans[iSpan].fUVWs = nil; } diff --git a/Sources/Plasma/PubUtilLib/plDrawable/plMorphDelta.h b/Sources/Plasma/PubUtilLib/plDrawable/plMorphDelta.h index 0c7bbb5d..759e80f4 100644 --- a/Sources/Plasma/PubUtilLib/plDrawable/plMorphDelta.h +++ b/Sources/Plasma/PubUtilLib/plDrawable/plMorphDelta.h @@ -52,8 +52,8 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com class plVertDelta { public: - UInt16 fIdx; - UInt16 fPadding; + uint16_t fIdx; + uint16_t fPadding; hsVector3 fPos; hsVector3 fNorm; }; @@ -66,7 +66,7 @@ public: hsTArray fDeltas; - UInt16 fNumUVWChans; + uint16_t fNumUVWChans; hsPoint3* fUVWs; // Length is fUVWChans*fDeltas.GetCount() (*sizeof(hsPoint3) in bytes). }; @@ -75,7 +75,7 @@ class plMorphDelta : public plCreatable protected: hsTArray fSpans; - hsScalar fWeight; + float fWeight; public: plMorphDelta(); virtual ~plMorphDelta(); @@ -86,15 +86,15 @@ public: CLASSNAME_REGISTER( plMorphDelta ); GETINTERFACE_ANY( plMorphDelta, plCreatable ); - void SetWeight(hsScalar w) { fWeight = w; } - hsScalar GetWeight() const { return fWeight; } + void SetWeight(float w) { fWeight = w; } + float GetWeight() const { return fWeight; } - void Apply(hsTArray& dst, hsScalar weight = -1.f) const; + void Apply(hsTArray& dst, float weight = -1.f) const; void ComputeDeltas(const hsTArray& base, const hsTArray& moved); void ComputeDeltas(const hsTArray& base, const hsTArray& moved, const hsMatrix44& d2b, const hsMatrix44& d2bTInv); - UInt32 GetNumSpans() const { return fSpans.GetCount(); } + uint32_t GetNumSpans() const { return fSpans.GetCount(); } void SetNumSpans(int n); void SetDeltas(int iSpan, const hsTArray& deltas, int numUVWChans, const hsPoint3* uvws); // len uvws is deltas.GetCount() * numUVWChans diff --git a/Sources/Plasma/PubUtilLib/plDrawable/plMorphSequence.cpp b/Sources/Plasma/PubUtilLib/plDrawable/plMorphSequence.cpp index ce85e477..2edd72fb 100644 --- a/Sources/Plasma/PubUtilLib/plDrawable/plMorphSequence.cpp +++ b/Sources/Plasma/PubUtilLib/plDrawable/plMorphSequence.cpp @@ -40,7 +40,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "plMorphSequence.h" #include "plMorphSequenceSDLMod.h" @@ -89,7 +89,7 @@ void plMorphDataSet::Write(hsStream* s, hsResMgr* mgr) /////////////////////////////////////////////////////////////////////////// -const UInt32 kChanMask = plAccessVtxSpan::kPositionMask +const uint32_t kChanMask = plAccessVtxSpan::kPositionMask | plAccessVtxSpan::kNormalMask | plAccessVtxSpan::kUVWMask; @@ -98,14 +98,14 @@ const UInt32 kChanMask = plAccessVtxSpan::kPositionMask // that's what got loaded from disk. // Use Access RW. That might already be handled in the customization stuff. -plConst(hsScalar) kMorphTime(0.5); +plConst(float) kMorphTime(0.5); class plMorphTarget { public: - UInt16 fLayer; - UInt16 fDelta; - hsScalar fWeight; + uint16_t fLayer; + uint16_t fDelta; + float fWeight; }; hsTArray fTgtWgts; @@ -131,11 +131,11 @@ hsBool plMorphSequence::MsgReceive(plMessage* msg) // Can always add it in later if desired. if( fTgtWgts.GetCount() ) { - hsScalar delWgt = hsTimer::GetDelSysSeconds() / (kMorphTime > 0 ? kMorphTime : 1.e-3f); + float delWgt = hsTimer::GetDelSysSeconds() / (kMorphTime > 0 ? kMorphTime : 1.e-3f); int i; for( i = 0; i < fTgtWgts.GetCount(); i++ ) { - hsScalar currWgt = GetWeight(fTgtWgts[i].fLayer, fTgtWgts[i].fDelta); + float currWgt = GetWeight(fTgtWgts[i].fLayer, fTgtWgts[i].fDelta); if( fTgtWgts[i].fWeight < currWgt ) { if( fTgtWgts[i].fWeight >= (currWgt -= delWgt) ) @@ -233,7 +233,7 @@ int plMorphSequence::GetNumDeltas(int iLay, plKey meshKey /* = nil */) const return fSharedMeshes[index].fMesh->fMorphSet->fMorphs[iLay].GetNumDeltas(); } -hsScalar plMorphSequence::GetWeight(int iLay, int iDel, plKey meshKey /* = nil */) const +float plMorphSequence::GetWeight(int iLay, int iDel, plKey meshKey /* = nil */) const { int index = IFindSharedMeshIndex(meshKey); if (index == -1) @@ -242,7 +242,7 @@ hsScalar plMorphSequence::GetWeight(int iLay, int iDel, plKey meshKey /* = nil * return fSharedMeshes[index].fArrayWeights[iLay].fDeltaWeights[iDel]; } -void plMorphSequence::SetWeight(int iLay, int iDel, hsScalar w, plKey meshKey /* = nil */) +void plMorphSequence::SetWeight(int iLay, int iDel, float w, plKey meshKey /* = nil */) { int index = IFindSharedMeshIndex(meshKey); @@ -462,7 +462,7 @@ void plMorphSequence::AddTarget(plSceneObject* so) if (!fMorphSDLMod) { - fMorphSDLMod = TRACKED_NEW plMorphSequenceSDLMod; + fMorphSDLMod = new plMorphSequenceSDLMod; so->AddModifier(fMorphSDLMod); } } @@ -493,7 +493,7 @@ void plMorphSequence::Read(hsStream* s, hsResMgr* mgr) n = s->ReadLE32(); for( i = 0; i < n; i++) - mgr->ReadKeyNotifyMe(s, TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnCreate, -1, -1), plRefFlags::kActiveRef); + mgr->ReadKeyNotifyMe(s, new plGenRefMsg(GetKey(), plRefMsg::kOnCreate, -1, -1), plRefFlags::kActiveRef); } void plMorphSequence::Write(hsStream* s, hsResMgr* mgr) @@ -642,17 +642,17 @@ hsBool plMorphSequence::IFindIndices(int iShare) if( !di ) return false; - Int32 meshIdx = di->GetSharedMeshIndex(mInfo.fMesh); + int32_t meshIdx = di->GetSharedMeshIndex(mInfo.fMesh); if( meshIdx < 0 ) return false; - plDrawableSpans* dr = plDrawableSpans::ConvertNoRef(di->GetDrawable((UInt8)meshIdx)); + plDrawableSpans* dr = plDrawableSpans::ConvertNoRef(di->GetDrawable((uint8_t)meshIdx)); if( !dr ) return false; mInfo.fCurrDraw = dr; - plDISpanIndex& diIndex = dr->GetDISpans(di->GetDrawableMeshIndex((UInt8)meshIdx)); + plDISpanIndex& diIndex = dr->GetDISpans(di->GetDrawableMeshIndex((uint8_t)meshIdx)); hsAssert(mInfo.fMesh->fSpans.GetCount() == diIndex.GetCount(), "Mismatch between geometry and indices"); @@ -671,7 +671,7 @@ void plMorphSequence::IReleaseIndices(int iShare) mInfo.fCurrDraw = nil; } -Int32 plMorphSequence::IFindSharedMeshIndex(plKey meshKey) const +int32_t plMorphSequence::IFindSharedMeshIndex(plKey meshKey) const { int i; for( i = 0; i < fSharedMeshes.GetCount(); i++ ) @@ -683,7 +683,7 @@ Int32 plMorphSequence::IFindSharedMeshIndex(plKey meshKey) const return -1; } -Int32 plMorphSequence::IFindPendingStateIndex(plKey meshKey) const +int32_t plMorphSequence::IFindPendingStateIndex(plKey meshKey) const { int i; for( i = 0; i < fPendingStates.GetCount(); i++ ) diff --git a/Sources/Plasma/PubUtilLib/plDrawable/plMorphSequence.h b/Sources/Plasma/PubUtilLib/plDrawable/plMorphSequence.h index 433ffc51..1c4da5fb 100644 --- a/Sources/Plasma/PubUtilLib/plDrawable/plMorphSequence.h +++ b/Sources/Plasma/PubUtilLib/plDrawable/plMorphSequence.h @@ -54,7 +54,7 @@ class plMorphSequenceSDLMod; class plMorphArrayWeights { public: - hsTArray fDeltaWeights; + hsTArray fDeltaWeights; }; class plSharedMeshInfo @@ -66,10 +66,10 @@ public: }; plSharedMesh* fMesh; - hsTArray fCurrIdx; + hsTArray fCurrIdx; plDrawable* fCurrDraw; hsTArray fArrayWeights; - UInt8 fFlags; + uint8_t fFlags; plSharedMeshInfo() : fMesh(nil), fCurrDraw(nil), fFlags(0) {} }; @@ -109,19 +109,19 @@ protected: kHaveShared = 0x4, kDirtyIndices = 0x8 }; - UInt32 fMorphFlags; + uint32_t fMorphFlags; hsTArray fMorphs; - //Int32 fActiveMesh; // Doesn't appear to be used. + //int32_t fActiveMesh; // Doesn't appear to be used. hsTArray fSharedMeshes; hsTArray fPendingStates; plMorphSequenceSDLMod* fMorphSDLMod; - Int8 fGlobalLayerRef; + int8_t fGlobalLayerRef; const plDrawInterface* IGetDrawInterface() const; - virtual hsBool IEval(double secs, hsScalar del, UInt32 dirty) { return false; } + virtual hsBool IEval(double secs, float del, uint32_t dirty) { return false; } void ISetHaveSnap(hsBool on) { if(on)fMorphFlags |= kHaveSnap; else fMorphFlags &= ~kHaveSnap; } void ISetDirty(hsBool on); @@ -138,8 +138,8 @@ protected: void IFindIndices(); // Refresh Indicies void IApplyShared(); // Apply whatever morphs are active - Int32 IFindPendingStateIndex(plKey meshKey) const; // Do we have pending state for this mesh? - Int32 IFindSharedMeshIndex(plKey meshKey) const; // What's this mesh's index in our array? + int32_t IFindPendingStateIndex(plKey meshKey) const; // Do we have pending state for this mesh? + int32_t IFindSharedMeshIndex(plKey meshKey) const; // What's this mesh's index in our array? hsBool IIsUsingDrawable(plDrawable *draw); // Are we actively looking at spans in this drawable? // Internal functions for maintaining that all meshes share the same global weight(s) (fGlobalLayerRef) @@ -173,8 +173,8 @@ public: void AddLayer(const plMorphArray& ma) { fMorphs.Append(ma); } int GetNumDeltas(int iLay, plKey meshKey = nil) const; - hsScalar GetWeight(int iLay, int iDel, plKey meshKey = nil) const; - void SetWeight(int iLay, int iDel, hsScalar w, plKey meshKey = nil); + float GetWeight(int iLay, int iDel, plKey meshKey = nil) const; + void SetWeight(int iLay, int iDel, float w, plKey meshKey = nil); hsBool GetHaveSnap() const { return 0 != (fMorphFlags & kHaveSnap); } hsBool GetDirty() const { return 0 != (fMorphFlags & kDirty); } diff --git a/Sources/Plasma/PubUtilLib/plDrawable/plMorphSequenceSDLMod.cpp b/Sources/Plasma/PubUtilLib/plDrawable/plMorphSequenceSDLMod.cpp index 629ce0df..41ae8c3f 100644 --- a/Sources/Plasma/PubUtilLib/plDrawable/plMorphSequenceSDLMod.cpp +++ b/Sources/Plasma/PubUtilLib/plDrawable/plMorphSequenceSDLMod.cpp @@ -117,7 +117,7 @@ void plMorphSequenceSDLMod::IPutCurrentStateIn(plStateDataRecord* dstState) // store both in a single byte // Translate the range [-1.0, 1.0] into a 0-255 byte - UInt8 weight = (UInt8)((1.f + morphMod->GetWeight(j, 0, meshKey) - morphMod->GetWeight(j, 1, meshKey)) * 255 / 2); + uint8_t weight = (uint8_t)((1.f + morphMod->GetWeight(j, 0, meshKey) - morphMod->GetWeight(j, 1, meshKey)) * 255 / 2); weights->Set(&weight, j); } @@ -159,7 +159,7 @@ void plMorphSequenceSDLMod::ISetCurrentStateFrom(const plStateDataRecord* srcSta // meshKey will be nil when dealing with non-sharedMesh data if (meshKey) - hsgResMgr::ResMgr()->AddViaNotify(meshKey, TRACKED_NEW plGenRefMsg(morphMod->GetKey(), plRefMsg::kOnCreate, -1, -1), plRefFlags::kPassiveRef); + hsgResMgr::ResMgr()->AddViaNotify(meshKey, new plGenRefMsg(morphMod->GetKey(), plRefMsg::kOnCreate, -1, -1), plRefFlags::kPassiveRef); plSimpleStateVariable *weights = morphSD->GetStateDataRecord(i)->FindVar(kStrWeights); @@ -167,10 +167,10 @@ void plMorphSequenceSDLMod::ISetCurrentStateFrom(const plStateDataRecord* srcSta // of plMorphSequence only has to resize the array once. for (j = weights->GetCount() - 1; j >= 0; j--) { - UInt8 weight; + uint8_t weight; weights->Get(&weight, j); - hsScalar posWeight = weight * 2.f / 255.f - 1.f; - hsScalar negWeight = 0; + float posWeight = weight * 2.f / 255.f - 1.f; + float negWeight = 0; if (posWeight < 0) { diff --git a/Sources/Plasma/PubUtilLib/plDrawable/plMorphSequenceSDLMod.h b/Sources/Plasma/PubUtilLib/plDrawable/plMorphSequenceSDLMod.h index 93fcee8a..5c6b164b 100644 --- a/Sources/Plasma/PubUtilLib/plDrawable/plMorphSequenceSDLMod.h +++ b/Sources/Plasma/PubUtilLib/plDrawable/plMorphSequenceSDLMod.h @@ -44,7 +44,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "plModifier/plSDLModifier.h" -#include "hsTypes.h" +#include "HeadSpin.h" // // This modifier is responsible for sending and recving @@ -57,7 +57,7 @@ protected: void IPutCurrentStateIn(plStateDataRecord* dstState); void ISetCurrentStateFrom(const plStateDataRecord* srcState); - UInt32 IApplyModFlags(UInt32 sendFlags) + uint32_t IApplyModFlags(uint32_t sendFlags) { if (fIsAvatar) return (sendFlags | plSynchedObject::kDontPersistOnServer | plSynchedObject::kIsAvatarState); diff --git a/Sources/Plasma/PubUtilLib/plDrawable/plParticleFiller.cpp b/Sources/Plasma/PubUtilLib/plDrawable/plParticleFiller.cpp index 45dd04a7..0c113d94 100644 --- a/Sources/Plasma/PubUtilLib/plDrawable/plParticleFiller.cpp +++ b/Sources/Plasma/PubUtilLib/plDrawable/plParticleFiller.cpp @@ -40,7 +40,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "plParticleFiller.h" @@ -62,7 +62,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "plParticleSystem/plParticleEmitter.h" #include "plParticleSystem/plParticle.h" -static hsScalar sInvDelSecs; +static float sInvDelSecs; //// Local Static Stuff /////////////////////////////////////////////////////// @@ -71,8 +71,8 @@ static hsScalar sInvDelSecs; fPtr[ 0 ] = point.fX; fPtr[ 1 ] = point.fY; fPtr[ 2 ] = point.fZ; \ ptr += sizeof( float ) * 3; } -#define STUFF_UINT32( ptr, uint ) { UInt32 *dPtr = (UInt32 *)ptr; \ - dPtr[ 0 ] = uint; ptr += sizeof( UInt32 ); } +#define STUFF_UINT32( ptr, uint ) { uint32_t *dPtr = (uint32_t *)ptr; \ + dPtr[ 0 ] = uint; ptr += sizeof( uint32_t ); } #define EXTRACT_POINT( ptr, pt ) { float *fPtr = (float *)ptr; \ pt.fX = fPtr[ 0 ]; pt.fY = fPtr[ 1 ]; pt.fZ = fPtr[ 2 ]; \ @@ -81,11 +81,11 @@ static hsScalar sInvDelSecs; f = fPtr[ 0 ]; \ ptr += sizeof( float ); } -#define EXTRACT_UINT32( ptr, uint ) { UInt32 *dPtr = (UInt32 *)ptr; \ - uint = dPtr[ 0 ]; ptr += sizeof( UInt32 ); } +#define EXTRACT_UINT32( ptr, uint ) { uint32_t *dPtr = (uint32_t *)ptr; \ + uint = dPtr[ 0 ]; ptr += sizeof( uint32_t ); } -static hsScalar sCurrMinWidth = 0; +static float sCurrMinWidth = 0; /////////////////////////////////////////////////////////////////////////////// //// Particles //////////////////////////////////////////////////////////////// @@ -155,7 +155,7 @@ void inline IInlSetParticlePathStretch( const plParticleCore &particle, const hs hsPoint3 xlate = viewToWorld.GetTranslate(); hsVector3 viewDir(&particle.fPos, &xlate); - hsScalar invD = hsFastMath::InvSqrtAppr(viewDir.MagnitudeSquared()); + float invD = hsFastMath::InvSqrtAppr(viewDir.MagnitudeSquared()); viewDir *= invD; zVec = viewDir; @@ -172,12 +172,12 @@ void inline IInlSetParticlePathStretch( const plParticleCore &particle, const hs xVec = yVec % viewDir; // cross product of two orthonormal vectors, no need to normalize. - hsScalar xLen = particle.fHSize; + float xLen = particle.fHSize; if( xLen * invD < sCurrMinWidth ) xLen = sCurrMinWidth / invD; xVec *= xLen; - hsScalar len = yVec.InnerProduct(orientation); + float len = yVec.InnerProduct(orientation); // Might want to give it a little boost to overlap itself (and compensate for the massive // transparent border the artists love). But they can do that themselves with the VSize. // len *= 1.5f; @@ -195,7 +195,7 @@ void inline IInlSetParticlePathFlow( const plParticleCore &particle, const hsMat hsPoint3 xlate = viewToWorld.GetTranslate(); hsVector3 viewDir(&particle.fPos, &xlate); - hsScalar invD = hsFastMath::InvSqrtAppr(viewDir.MagnitudeSquared()); + float invD = hsFastMath::InvSqrtAppr(viewDir.MagnitudeSquared()); viewDir *= invD; zVec = viewDir; @@ -212,9 +212,9 @@ void inline IInlSetParticlePathFlow( const plParticleCore &particle, const hsMat xVec = yVec % viewDir; // cross product of two orthonormal vectors, no need to normalize. - hsScalar len = yVec.InnerProduct(orientation); + float len = yVec.InnerProduct(orientation); - hsScalar xLen = particle.fHSize * hsFastMath::InvSqrtAppr(1.f + len * sInvDelSecs); + float xLen = particle.fHSize * hsFastMath::InvSqrtAppr(1.f + len * sInvDelSecs); if( xLen * invD < sCurrMinWidth ) xLen = sCurrMinWidth / invD; xVec *= xLen; @@ -259,7 +259,7 @@ void inline IInlSetParticleExplicit( const hsMatrix44 &viewToWorld, const plPart } void inline IInlSetParticlePoints( const hsVector3 &xVec, const hsVector3 &yVec, const plParticleCore &particle, - hsPoint3 *partPts, UInt32 &partColor ) + hsPoint3 *partPts, uint32_t &partColor ) { /// Do the 4 verts for this particle partPts[ 0 ] = partPts[ 1 ] = partPts[ 2 ] = partPts[ 3 ] = particle.fPos; @@ -272,7 +272,7 @@ void inline IInlSetParticlePoints( const hsVector3 &xVec, const hsVector3 &yVec, } void inline IInlSetParticlePointsStretch( const hsVector3 &xVec, const hsVector3 &yVec, const plParticleCore &particle, - hsPoint3 *partPts, UInt32 &partColor ) + hsPoint3 *partPts, uint32_t &partColor ) { /// Do the 4 verts for this particle partPts[ 0 ] = partPts[ 1 ] = partPts[ 2 ] = partPts[ 3 ] = particle.fPos; @@ -284,10 +284,10 @@ void inline IInlSetParticlePointsStretch( const hsVector3 &xVec, const hsVector3 partColor = particle.fColor; } -void inline IInlStuffParticle1UV( UInt8 *&destPtr, const hsPoint3 *partPts, const hsVector3 &partNorm, - const UInt32 &partColor, const plParticleCore &particle ) +void inline IInlStuffParticle1UV( uint8_t *&destPtr, const hsPoint3 *partPts, const hsVector3 &partNorm, + const uint32_t &partColor, const plParticleCore &particle ) { - UInt8 j; + uint8_t j; for( j = 0; j < 4; j++ ) @@ -300,10 +300,10 @@ void inline IInlStuffParticle1UV( UInt8 *&destPtr, const hsPoint3 *partPts, cons } } -void inline IInlStuffParticleNoUVs( UInt8 *&destPtr, const hsPoint3 *partPts, const hsVector3 &partNorm, - const UInt32 &partColor ) +void inline IInlStuffParticleNoUVs( uint8_t *&destPtr, const hsPoint3 *partPts, const hsVector3 &partNorm, + const uint32_t &partColor ) { - UInt8 j; + uint8_t j; for( j = 0; j < 4; j++ ) @@ -352,12 +352,12 @@ void inline IInlSetNormalExplicit( hsVector3 &partNorm, const plParticleCore &pa // or NExp (for explicit) #define IIPL_PROLOG \ - UInt32 i, partColor; \ + uint32_t i, partColor; \ hsVector3 xVec, yVec, zVec, partNorm; \ hsPoint3 partPts[ 4 ]; \ for( i = 0; i < numParticles; i++ ) -void inline IIPL_1UV_OVel_NViewFace( const UInt32 &numParticles, const plParticleCore *particles, const hsMatrix44& viewToWorld, UInt8 *&destPtr ) +void inline IIPL_1UV_OVel_NViewFace( const uint32_t &numParticles, const plParticleCore *particles, const hsMatrix44& viewToWorld, uint8_t *&destPtr ) { IIPL_PROLOG { @@ -368,7 +368,7 @@ void inline IIPL_1UV_OVel_NViewFace( const UInt32 &numParticles, const plParticl } } -void inline IIPL_1UV_OVel_NLite( const UInt32 &numParticles, const plParticleCore *particles, const hsMatrix44& viewToWorld, UInt8 *&destPtr, +void inline IIPL_1UV_OVel_NLite( const uint32_t &numParticles, const plParticleCore *particles, const hsMatrix44& viewToWorld, uint8_t *&destPtr, const plOmniLightInfo *omniLight, const plDirectionalLightInfo *directionLight ) { IIPL_PROLOG @@ -380,7 +380,7 @@ void inline IIPL_1UV_OVel_NLite( const UInt32 &numParticles, const plParticleCor } } -void inline IIPL_1UV_OVel_NExp( const UInt32 &numParticles, const plParticleCore *particles, const hsMatrix44& viewToWorld, UInt8 *&destPtr ) +void inline IIPL_1UV_OVel_NExp( const uint32_t &numParticles, const plParticleCore *particles, const hsMatrix44& viewToWorld, uint8_t *&destPtr ) { IIPL_PROLOG { @@ -391,7 +391,7 @@ void inline IIPL_1UV_OVel_NExp( const UInt32 &numParticles, const plParticleCore } } -void inline IIPL_1UV_OStr_NViewFace( const UInt32 &numParticles, const plParticleCore *particles, const hsMatrix44& viewToWorld, UInt8 *&destPtr ) +void inline IIPL_1UV_OStr_NViewFace( const uint32_t &numParticles, const plParticleCore *particles, const hsMatrix44& viewToWorld, uint8_t *&destPtr ) { IIPL_PROLOG { @@ -402,7 +402,7 @@ void inline IIPL_1UV_OStr_NViewFace( const UInt32 &numParticles, const plParticl } } -void inline IIPL_1UV_OStr_NLite( const UInt32 &numParticles, const plParticleCore *particles, const hsMatrix44& viewToWorld, UInt8 *&destPtr, +void inline IIPL_1UV_OStr_NLite( const uint32_t &numParticles, const plParticleCore *particles, const hsMatrix44& viewToWorld, uint8_t *&destPtr, const plOmniLightInfo *omniLight, const plDirectionalLightInfo *directionLight ) { IIPL_PROLOG @@ -414,7 +414,7 @@ void inline IIPL_1UV_OStr_NLite( const UInt32 &numParticles, const plParticleCor } } -void inline IIPL_1UV_OStr_NExp( const UInt32 &numParticles, const plParticleCore *particles, const hsMatrix44& viewToWorld, UInt8 *&destPtr ) +void inline IIPL_1UV_OStr_NExp( const uint32_t &numParticles, const plParticleCore *particles, const hsMatrix44& viewToWorld, uint8_t *&destPtr ) { IIPL_PROLOG { @@ -425,7 +425,7 @@ void inline IIPL_1UV_OStr_NExp( const UInt32 &numParticles, const plParticleCore } } -void inline IIPL_1UV_OFlo_NViewFace( const UInt32 &numParticles, const plParticleCore *particles, const hsMatrix44& viewToWorld, UInt8 *&destPtr ) +void inline IIPL_1UV_OFlo_NViewFace( const uint32_t &numParticles, const plParticleCore *particles, const hsMatrix44& viewToWorld, uint8_t *&destPtr ) { IIPL_PROLOG { @@ -436,7 +436,7 @@ void inline IIPL_1UV_OFlo_NViewFace( const UInt32 &numParticles, const plParticl } } -void inline IIPL_1UV_OFlo_NLite( const UInt32 &numParticles, const plParticleCore *particles, const hsMatrix44& viewToWorld, UInt8 *&destPtr, +void inline IIPL_1UV_OFlo_NLite( const uint32_t &numParticles, const plParticleCore *particles, const hsMatrix44& viewToWorld, uint8_t *&destPtr, const plOmniLightInfo *omniLight, const plDirectionalLightInfo *directionLight ) { IIPL_PROLOG @@ -448,7 +448,7 @@ void inline IIPL_1UV_OFlo_NLite( const UInt32 &numParticles, const plParticleCor } } -void inline IIPL_1UV_OFlo_NExp( const UInt32 &numParticles, const plParticleCore *particles, const hsMatrix44& viewToWorld, UInt8 *&destPtr ) +void inline IIPL_1UV_OFlo_NExp( const uint32_t &numParticles, const plParticleCore *particles, const hsMatrix44& viewToWorld, uint8_t *&destPtr ) { IIPL_PROLOG { @@ -459,7 +459,7 @@ void inline IIPL_1UV_OFlo_NExp( const UInt32 &numParticles, const plParticleCore } } -void inline IIPL_1UV_OExp_NViewFace( const UInt32 &numParticles, const plParticleCore *particles, const hsMatrix44& viewToWorld, UInt8 *&destPtr ) +void inline IIPL_1UV_OExp_NViewFace( const uint32_t &numParticles, const plParticleCore *particles, const hsMatrix44& viewToWorld, uint8_t *&destPtr ) { IIPL_PROLOG { @@ -470,7 +470,7 @@ void inline IIPL_1UV_OExp_NViewFace( const UInt32 &numParticles, const plParticl } } -void inline IIPL_1UV_OExp_NLite( const UInt32 &numParticles, const plParticleCore *particles, const hsMatrix44& viewToWorld, UInt8 *&destPtr, +void inline IIPL_1UV_OExp_NLite( const uint32_t &numParticles, const plParticleCore *particles, const hsMatrix44& viewToWorld, uint8_t *&destPtr, const plOmniLightInfo *omniLight, const plDirectionalLightInfo *directionLight ) { IIPL_PROLOG @@ -482,7 +482,7 @@ void inline IIPL_1UV_OExp_NLite( const UInt32 &numParticles, const plParticleCor } } -void inline IIPL_1UV_OExp_NExp( const UInt32 &numParticles, const plParticleCore *particles, const hsMatrix44& viewToWorld, UInt8 *&destPtr ) +void inline IIPL_1UV_OExp_NExp( const uint32_t &numParticles, const plParticleCore *particles, const hsMatrix44& viewToWorld, uint8_t *&destPtr ) { IIPL_PROLOG { @@ -493,7 +493,7 @@ void inline IIPL_1UV_OExp_NExp( const UInt32 &numParticles, const plParticleCore } } -void inline IIPL_0UV_OVel_NViewFace( const UInt32 &numParticles, const plParticleCore *particles, const hsMatrix44& viewToWorld, UInt8 *&destPtr ) +void inline IIPL_0UV_OVel_NViewFace( const uint32_t &numParticles, const plParticleCore *particles, const hsMatrix44& viewToWorld, uint8_t *&destPtr ) { IIPL_PROLOG { @@ -504,7 +504,7 @@ void inline IIPL_0UV_OVel_NViewFace( const UInt32 &numParticles, const plParticl } } -void inline IIPL_0UV_OVel_NLite( const UInt32 &numParticles, const plParticleCore *particles, const hsMatrix44& viewToWorld, UInt8 *&destPtr, +void inline IIPL_0UV_OVel_NLite( const uint32_t &numParticles, const plParticleCore *particles, const hsMatrix44& viewToWorld, uint8_t *&destPtr, const plOmniLightInfo *omniLight, const plDirectionalLightInfo *directionLight ) { IIPL_PROLOG @@ -516,7 +516,7 @@ void inline IIPL_0UV_OVel_NLite( const UInt32 &numParticles, const plParticleCor } } -void inline IIPL_0UV_OVel_NExp( const UInt32 &numParticles, const plParticleCore *particles, const hsMatrix44& viewToWorld, UInt8 *&destPtr ) +void inline IIPL_0UV_OVel_NExp( const uint32_t &numParticles, const plParticleCore *particles, const hsMatrix44& viewToWorld, uint8_t *&destPtr ) { IIPL_PROLOG { @@ -527,7 +527,7 @@ void inline IIPL_0UV_OVel_NExp( const UInt32 &numParticles, const plParticleCore } } -void inline IIPL_0UV_OStr_NViewFace( const UInt32 &numParticles, const plParticleCore *particles, const hsMatrix44& viewToWorld, UInt8 *&destPtr ) +void inline IIPL_0UV_OStr_NViewFace( const uint32_t &numParticles, const plParticleCore *particles, const hsMatrix44& viewToWorld, uint8_t *&destPtr ) { IIPL_PROLOG { @@ -538,7 +538,7 @@ void inline IIPL_0UV_OStr_NViewFace( const UInt32 &numParticles, const plParticl } } -void inline IIPL_0UV_OStr_NLite( const UInt32 &numParticles, const plParticleCore *particles, const hsMatrix44& viewToWorld, UInt8 *&destPtr, +void inline IIPL_0UV_OStr_NLite( const uint32_t &numParticles, const plParticleCore *particles, const hsMatrix44& viewToWorld, uint8_t *&destPtr, const plOmniLightInfo *omniLight, const plDirectionalLightInfo *directionLight ) { IIPL_PROLOG @@ -550,7 +550,7 @@ void inline IIPL_0UV_OStr_NLite( const UInt32 &numParticles, const plParticleCor } } -void inline IIPL_0UV_OStr_NExp( const UInt32 &numParticles, const plParticleCore *particles, const hsMatrix44& viewToWorld, UInt8 *&destPtr ) +void inline IIPL_0UV_OStr_NExp( const uint32_t &numParticles, const plParticleCore *particles, const hsMatrix44& viewToWorld, uint8_t *&destPtr ) { IIPL_PROLOG { @@ -561,7 +561,7 @@ void inline IIPL_0UV_OStr_NExp( const UInt32 &numParticles, const plParticleCore } } -void inline IIPL_0UV_OFlo_NViewFace( const UInt32 &numParticles, const plParticleCore *particles, const hsMatrix44& viewToWorld, UInt8 *&destPtr ) +void inline IIPL_0UV_OFlo_NViewFace( const uint32_t &numParticles, const plParticleCore *particles, const hsMatrix44& viewToWorld, uint8_t *&destPtr ) { IIPL_PROLOG { @@ -572,7 +572,7 @@ void inline IIPL_0UV_OFlo_NViewFace( const UInt32 &numParticles, const plParticl } } -void inline IIPL_0UV_OFlo_NLite( const UInt32 &numParticles, const plParticleCore *particles, const hsMatrix44& viewToWorld, UInt8 *&destPtr, +void inline IIPL_0UV_OFlo_NLite( const uint32_t &numParticles, const plParticleCore *particles, const hsMatrix44& viewToWorld, uint8_t *&destPtr, const plOmniLightInfo *omniLight, const plDirectionalLightInfo *directionLight ) { IIPL_PROLOG @@ -584,7 +584,7 @@ void inline IIPL_0UV_OFlo_NLite( const UInt32 &numParticles, const plParticleCor } } -void inline IIPL_0UV_OFlo_NExp( const UInt32 &numParticles, const plParticleCore *particles, const hsMatrix44& viewToWorld, UInt8 *&destPtr ) +void inline IIPL_0UV_OFlo_NExp( const uint32_t &numParticles, const plParticleCore *particles, const hsMatrix44& viewToWorld, uint8_t *&destPtr ) { IIPL_PROLOG { @@ -595,7 +595,7 @@ void inline IIPL_0UV_OFlo_NExp( const UInt32 &numParticles, const plParticleCore } } -void inline IIPL_0UV_OExp_NViewFace( const UInt32 &numParticles, const plParticleCore *particles, const hsMatrix44& viewToWorld, UInt8 *&destPtr ) +void inline IIPL_0UV_OExp_NViewFace( const uint32_t &numParticles, const plParticleCore *particles, const hsMatrix44& viewToWorld, uint8_t *&destPtr ) { IIPL_PROLOG { @@ -606,7 +606,7 @@ void inline IIPL_0UV_OExp_NViewFace( const UInt32 &numParticles, const plParticl } } -void inline IIPL_0UV_OExp_NLite( const UInt32 &numParticles, const plParticleCore *particles, const hsMatrix44& viewToWorld, UInt8 *&destPtr, +void inline IIPL_0UV_OExp_NLite( const uint32_t &numParticles, const plParticleCore *particles, const hsMatrix44& viewToWorld, uint8_t *&destPtr, const plOmniLightInfo *omniLight, const plDirectionalLightInfo *directionLight ) { IIPL_PROLOG @@ -618,7 +618,7 @@ void inline IIPL_0UV_OExp_NLite( const UInt32 &numParticles, const plParticleCor } } -void inline IIPL_0UV_OExp_NExp( const UInt32 &numParticles, const plParticleCore *particles, const hsMatrix44& viewToWorld, UInt8 *&destPtr ) +void inline IIPL_0UV_OExp_NExp( const uint32_t &numParticles, const plParticleCore *particles, const hsMatrix44& viewToWorld, uint8_t *&destPtr ) { IIPL_PROLOG { @@ -647,11 +647,11 @@ void plParticleFiller::FillParticles(plPipeline* pipe, plDrawableSpans* drawable sInvDelSecs = 1.f / sInvDelSecs; const plParticleCore* particles = span->fSource->GetParticleArray(); - const UInt32 numParticles = span->fNumParticles; + const uint32_t numParticles = span->fNumParticles; plGBufferGroup* group = drawable->GetBufferGroup(span->fGroupIdx); - UInt8* destPtr = group->GetVertBufferData(span->fVBufferIdx); + uint8_t* destPtr = group->GetVertBufferData(span->fVBufferIdx); destPtr += span->fVStartIdx * group->GetVertexSize(); @@ -798,14 +798,14 @@ void plParticleFiller::FillParticlePolys(plPipeline* pipe, plDrawInterface* di) // Currently, the di always points to exactly 1 drawable with 1 span index. If // that changes, this would just become a loop. - UInt32 diIndex = di->GetDrawableMeshIndex(0); + uint32_t diIndex = di->GetDrawableMeshIndex(0); hsAssert(diIndex >= 0, "Bogus input to fill particles"); const plDISpanIndex& diSpans = drawable->GetDISpans(diIndex); int i; for( i = 0; i < diSpans.GetCount(); i++ ) { - UInt32 spanIdx = diSpans[i]; + uint32_t spanIdx = diSpans[i]; hsAssert(drawable->GetSpan(spanIdx), "Bogus input to fill particles"); hsAssert(drawable->GetSpan(spanIdx)->fTypeMask & plSpan::kParticleSpan, "Bogus input to fill particles"); diff --git a/Sources/Plasma/PubUtilLib/plDrawable/plPrintShape.cpp b/Sources/Plasma/PubUtilLib/plDrawable/plPrintShape.cpp index 39785226..12dfaf0e 100644 --- a/Sources/Plasma/PubUtilLib/plDrawable/plPrintShape.cpp +++ b/Sources/Plasma/PubUtilLib/plDrawable/plPrintShape.cpp @@ -40,7 +40,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "plPrintShape.h" #include "hsStream.h" diff --git a/Sources/Plasma/PubUtilLib/plDrawable/plPrintShape.h b/Sources/Plasma/PubUtilLib/plDrawable/plPrintShape.h index 6bcac180..1021bc65 100644 --- a/Sources/Plasma/PubUtilLib/plDrawable/plPrintShape.h +++ b/Sources/Plasma/PubUtilLib/plDrawable/plPrintShape.h @@ -48,9 +48,9 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com class plPrintShape : public plObjInterface { protected: - hsScalar fWidth; - hsScalar fLength; - hsScalar fHeight; + float fWidth; + float fLength; + float fHeight; public: plPrintShape(); virtual ~plPrintShape(); @@ -59,19 +59,19 @@ public: GETINTERFACE_ANY( plPrintShape, plObjInterface ); - virtual Int32 GetNumProperties() const { return 1; } + virtual int32_t GetNumProperties() const { return 1; } virtual void SetTransform(const hsMatrix44& l2w, const hsMatrix44& w2l) {} virtual void Read(hsStream* stream, hsResMgr* mgr); virtual void Write(hsStream* stream, hsResMgr* mgr); - hsScalar GetWidth() const { return fWidth; } - hsScalar GetLength() const { return fLength; } - hsScalar GetHeight() const { return fHeight; } + float GetWidth() const { return fWidth; } + float GetLength() const { return fLength; } + float GetHeight() const { return fHeight; } - void SetWidth(hsScalar f) { fWidth = f; } - void SetLength(hsScalar f) { fLength = f; } - void SetHeight(hsScalar f) { fHeight = f; } + void SetWidth(float f) { fWidth = f; } + void SetLength(float f) { fLength = f; } + void SetHeight(float f) { fHeight = f; } }; #endif // plPrintShape_inc diff --git a/Sources/Plasma/PubUtilLib/plDrawable/plProxyGen.cpp b/Sources/Plasma/PubUtilLib/plDrawable/plProxyGen.cpp index 09ba523d..1a87bd6d 100644 --- a/Sources/Plasma/PubUtilLib/plDrawable/plProxyGen.cpp +++ b/Sources/Plasma/PubUtilLib/plDrawable/plProxyGen.cpp @@ -40,7 +40,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "plProxyGen.h" #include "plSurface/hsGMaterial.h" @@ -56,9 +56,9 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com static hsTArray fProxyDrawables; static hsTArray fProxyMaterials; -static UInt32 fProxyKeyCounter = 0; +static uint32_t fProxyKeyCounter = 0; -plProxyGen::plProxyGen(const hsColorRGBA& amb, const hsColorRGBA& dif, hsScalar opac) +plProxyGen::plProxyGen(const hsColorRGBA& amb, const hsColorRGBA& dif, float opac) : fProxyMsgType(0), fProxyDraw(nil), fProxyMat(nil) @@ -100,7 +100,7 @@ void plProxyGen::Init(const hsKeyedObject* owner) } -UInt32 plProxyGen::IGetDrawableType() const +uint32_t plProxyGen::IGetDrawableType() const { switch( fProxyMsgType & plProxyDrawMsg::kAllTypes ) { @@ -121,10 +121,10 @@ UInt32 plProxyGen::IGetDrawableType() const return plDrawable::kGenericProxy; } -UInt32 plProxyGen::IGetProxyIndex() const +uint32_t plProxyGen::IGetProxyIndex() const { plKey sceneNode = IGetNode(); - UInt32 drawType = IGetDrawableType(); + uint32_t drawType = IGetDrawableType(); int firstNil = -1; int firstMatch = -1; @@ -153,9 +153,9 @@ hsGMaterial* plProxyGen::IMakeProxyMaterial() const { const hsColorRGBA& amb = fAmbient; const hsColorRGBA& dif = fColor; - hsScalar opac = fAmbient.a; + float opac = fAmbient.a; - hsGMaterial* retVal = TRACKED_NEW hsGMaterial(); + hsGMaterial* retVal = new hsGMaterial(); plString buff; if( !GetKey()->GetName().IsNull() ) @@ -220,7 +220,7 @@ void plProxyGen::IGenerateProxy() if( !IGetNode() ) return; - UInt32 idx = IGetProxyIndex(); + uint32_t idx = IGetProxyIndex(); hsGMaterial* mat = IGetProxyMaterial(); hsAssert(mat, "Failed to create proxy material"); @@ -247,11 +247,11 @@ void plProxyGen::IGenerateProxy() IApplyProxy(idx); - plGenRefMsg* msg = TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnRequest, idx, 0); + plGenRefMsg* msg = new plGenRefMsg(GetKey(), plRefMsg::kOnRequest, idx, 0); hsgResMgr::ResMgr()->AddViaNotify(mat->GetKey(), msg, plRefFlags::kActiveRef); fProxyMat = mat; - plNodeRefMsg* refMsg = TRACKED_NEW plNodeRefMsg( GetKey(), plNodeRefMsg::kOnRequest, (Int8)idx, plNodeRefMsg::kDrawable ); + plNodeRefMsg* refMsg = new plNodeRefMsg( GetKey(), plNodeRefMsg::kOnRequest, (int8_t)idx, plNodeRefMsg::kDrawable ); hsgResMgr::ResMgr()->AddViaNotify(fProxyDrawables[idx]->GetKey(), refMsg, plRefFlags::kActiveRef); fProxyDraw = fProxyDrawables[idx]; } @@ -259,7 +259,7 @@ void plProxyGen::IGenerateProxy() //// IApplyProxy // Add our proxy to our scenenode for rendering. -void plProxyGen::IApplyProxy(UInt32 idx) const +void plProxyGen::IApplyProxy(uint32_t idx) const { if( fProxyDrawables[idx] && IGetNode() && (fProxyDrawables[idx]->GetSceneNode() != IGetNode()) ) { @@ -269,7 +269,7 @@ void plProxyGen::IApplyProxy(UInt32 idx) const //// IRemoveProxy // Remove our proxy from our scenenode. -void plProxyGen::IRemoveProxy(UInt32 idx) const +void plProxyGen::IRemoveProxy(uint32_t idx) const { if( fProxyDrawables[idx] ) { @@ -347,7 +347,7 @@ hsBool plProxyGen::MsgReceive(plMessage* msg) void plProxyGen::SetTransform(const hsMatrix44& l2w, const hsMatrix44& w2l) { - UInt32 idx = IGetProxyIndex(); + uint32_t idx = IGetProxyIndex(); if( fProxyDrawables[idx] ) { int i; @@ -358,7 +358,7 @@ void plProxyGen::SetTransform(const hsMatrix44& l2w, const hsMatrix44& w2l) void plProxyGen::SetDisable(hsBool on) { - UInt32 idx = IGetProxyIndex(); + uint32_t idx = IGetProxyIndex(); if( fProxyDrawables[idx] ) { int i; diff --git a/Sources/Plasma/PubUtilLib/plDrawable/plProxyGen.h b/Sources/Plasma/PubUtilLib/plDrawable/plProxyGen.h index 2f2c5f8c..44ba0248 100644 --- a/Sources/Plasma/PubUtilLib/plDrawable/plProxyGen.h +++ b/Sources/Plasma/PubUtilLib/plDrawable/plProxyGen.h @@ -92,31 +92,31 @@ protected: plDrawableSpans* fProxyDraw; hsGMaterial* fProxyMat; - UInt32 fProxyMsgType; + uint32_t fProxyMsgType; - hsTArray fProxyIndex; + hsTArray fProxyIndex; // These must be implemented by the specific type, so we know what to draw. - virtual plDrawableSpans* ICreateProxy(hsGMaterial* mat, hsTArray& idx, plDrawableSpans* addTo=nil) = 0; // called by IGenerate + virtual plDrawableSpans* ICreateProxy(hsGMaterial* mat, hsTArray& idx, plDrawableSpans* addTo=nil) = 0; // called by IGenerate virtual plKey IGetNode() const = 0; // Derived type should set fProxyMsgType as one of plProxyDrawMsg::types - UInt32 IGetProxyMsgType() const { return fProxyMsgType; } + uint32_t IGetProxyMsgType() const { return fProxyMsgType; } // These are all fine by default. - UInt32 IGetProxyIndex() const; - UInt32 IGetDrawableType() const; + uint32_t IGetProxyIndex() const; + uint32_t IGetDrawableType() const; virtual hsGMaterial* IMakeProxyMaterial() const; virtual hsGMaterial* IGetProxyMaterial() const; // will make material if needed. hsGMaterial* IFindProxyMaterial() const; virtual void IGenerateProxy(); - virtual void IApplyProxy(UInt32 drawIdx) const; // called by IGenerate - virtual void IRemoveProxy(UInt32 drawIdx) const; + virtual void IApplyProxy(uint32_t drawIdx) const; // called by IGenerate + virtual void IRemoveProxy(uint32_t drawIdx) const; virtual void IDestroyProxy(); public: - plProxyGen(const hsColorRGBA& amb, const hsColorRGBA& dif, hsScalar opac); + plProxyGen(const hsColorRGBA& amb, const hsColorRGBA& dif, float opac); virtual ~plProxyGen(); virtual void SetTransform(const hsMatrix44& l2w, const hsMatrix44& w2l); diff --git a/Sources/Plasma/PubUtilLib/plDrawable/plRipVSConsts.h b/Sources/Plasma/PubUtilLib/plDrawable/plRipVSConsts.h index b1560537..fb9c558d 100644 --- a/Sources/Plasma/PubUtilLib/plDrawable/plRipVSConsts.h +++ b/Sources/Plasma/PubUtilLib/plDrawable/plRipVSConsts.h @@ -46,16 +46,16 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com class plRipVSConsts { public: - hsScalar fC1U; - hsScalar fC2U; - hsScalar fC1V; - hsScalar fC2V; + float fC1U; + float fC2U; + float fC1V; + float fC2V; - hsScalar fInitAtten; - hsScalar fLife; - hsScalar fDecay; + float fInitAtten; + float fLife; + float fDecay; - hsScalar fRamp; + float fRamp; }; diff --git a/Sources/Plasma/PubUtilLib/plDrawable/plSharedMesh.cpp b/Sources/Plasma/PubUtilLib/plDrawable/plSharedMesh.cpp index 611fc672..42502009 100644 --- a/Sources/Plasma/PubUtilLib/plDrawable/plSharedMesh.cpp +++ b/Sources/Plasma/PubUtilLib/plDrawable/plSharedMesh.cpp @@ -59,7 +59,7 @@ plSharedMesh::~plSharedMesh() delete fSpans.Pop(); } /* -void plSharedMesh::CreateInstance(plSceneObject *so, UInt8 boneIndex) +void plSharedMesh::CreateInstance(plSceneObject *so, uint8_t boneIndex) { plDrawInterface *di = so->GetVolatileDrawInterface(); @@ -111,11 +111,11 @@ void plSharedMesh::Read(hsStream* s, hsResMgr* mgr) fSpans.SetCount(s->ReadLE32()); for (i = 0; i < fSpans.GetCount(); i++) { - fSpans[i] = TRACKED_NEW plGeometrySpan; + fSpans[i] = new plGeometrySpan; fSpans[i]->Read(s); } - mgr->ReadKeyNotifyMe(s, TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnCreate, -1, -1), plRefFlags::kActiveRef); + mgr->ReadKeyNotifyMe(s, new plGenRefMsg(GetKey(), plRefMsg::kOnCreate, -1, -1), plRefFlags::kActiveRef); fFlags = s->ReadByte(); } diff --git a/Sources/Plasma/PubUtilLib/plDrawable/plSharedMesh.h b/Sources/Plasma/PubUtilLib/plDrawable/plSharedMesh.h index 78b53d78..60c463f9 100644 --- a/Sources/Plasma/PubUtilLib/plDrawable/plSharedMesh.h +++ b/Sources/Plasma/PubUtilLib/plDrawable/plSharedMesh.h @@ -65,12 +65,12 @@ public: hsTArrayfSpans; hsTArray fActiveInstances; plMorphDataSet *fMorphSet; - UInt8 fFlags; + uint8_t fFlags; plSharedMesh(); ~plSharedMesh(); - void CreateInstance(plSceneObject *so, UInt8 boneIndex); + void CreateInstance(plSceneObject *so, uint8_t boneIndex); void RemoveInstance(plSceneObject *so); CLASSNAME_REGISTER( plSharedMesh ); diff --git a/Sources/Plasma/PubUtilLib/plDrawable/plSpaceTree.cpp b/Sources/Plasma/PubUtilLib/plDrawable/plSpaceTree.cpp index 88d95dcc..6a013b2f 100644 --- a/Sources/Plasma/PubUtilLib/plDrawable/plSpaceTree.cpp +++ b/Sources/Plasma/PubUtilLib/plDrawable/plSpaceTree.cpp @@ -40,7 +40,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "plSpaceTree.h" #include "hsStream.h" #include "hsBitVector.h" @@ -51,7 +51,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com static hsBitVector scratchTotVec; static hsBitVector scratchBitVec; -static hsTArray scratchList; +static hsTArray scratchList; static hsTArray scratchSort; plProfile_CreateCounter("Harvest Leaves", "Draw", HarvestLeaves); @@ -92,7 +92,7 @@ plSpaceTree::~plSpaceTree() { } -void plSpaceTree::IRefreshRecur(Int16 which) +void plSpaceTree::IRefreshRecur(int16_t which) { plSpaceTreeNode& sub = fTree[which]; @@ -123,7 +123,7 @@ void plSpaceTree::Refresh() IRefreshRecur(fRoot); } -void plSpaceTree::SetTreeFlag(UInt16 f, hsBool on) +void plSpaceTree::SetTreeFlag(uint16_t f, hsBool on) { if( IsEmpty() ) return; @@ -139,7 +139,7 @@ void plSpaceTree::SetTreeFlag(UInt16 f, hsBool on) fTree[i].fFlags |= f; } -void plSpaceTree::ClearTreeFlag(UInt16 f) +void plSpaceTree::ClearTreeFlag(uint16_t f) { if( IsEmpty() ) return; @@ -149,7 +149,7 @@ void plSpaceTree::ClearTreeFlag(UInt16 f) fTree[i].fFlags &= ~f; } -void plSpaceTree::SetLeafFlag(Int16 idx, UInt16 f, hsBool on) +void plSpaceTree::SetLeafFlag(int16_t idx, uint16_t f, hsBool on) { if( IsEmpty() ) return; @@ -181,7 +181,7 @@ void plSpaceTree::SetLeafFlag(Int16 idx, UInt16 f, hsBool on) } } -void plSpaceTree::ClearLeafFlag(Int16 idx, UInt16 f) +void plSpaceTree::ClearLeafFlag(int16_t idx, uint16_t f) { hsAssert(idx == fTree[idx].fLeafIndex, "Some scrambling of indices"); @@ -200,7 +200,7 @@ void plSpaceTree::ClearLeafFlag(Int16 idx, UInt16 f) } -inline void plSpaceTree::IEnableLeaf(Int16 idx, hsBitVector& cache) const +inline void plSpaceTree::IEnableLeaf(int16_t idx, hsBitVector& cache) const { cache.SetBit(idx); @@ -221,12 +221,12 @@ inline void plSpaceTree::IEnableLeaf(Int16 idx, hsBitVector& cache) const } } -void plSpaceTree::EnableLeaf(Int16 idx, hsBitVector& cache) const +void plSpaceTree::EnableLeaf(int16_t idx, hsBitVector& cache) const { IEnableLeaf(idx, cache); } -void plSpaceTree::EnableLeaves(const hsTArray& list, hsBitVector& cache) const +void plSpaceTree::EnableLeaves(const hsTArray& list, hsBitVector& cache) const { if( IsEmpty() ) return; @@ -237,7 +237,7 @@ void plSpaceTree::EnableLeaves(const hsTArray& list, hsBitVector& cache) } } -void plSpaceTree::IHarvestAndCullEnabledLeaves(Int16 subIdx, const hsBitVector& cache, hsTArray& list) const +void plSpaceTree::IHarvestAndCullEnabledLeaves(int16_t subIdx, const hsBitVector& cache, hsTArray& list) const { if( !cache.IsBitSet(subIdx) ) return; @@ -267,7 +267,7 @@ void plSpaceTree::IHarvestAndCullEnabledLeaves(Int16 subIdx, const hsBitVector& } } -void plSpaceTree::IHarvestEnabledLeaves(Int16 subIdx, const hsBitVector& cache, hsTArray& list) const +void plSpaceTree::IHarvestEnabledLeaves(int16_t subIdx, const hsBitVector& cache, hsTArray& list) const { if( !cache.IsBitSet(subIdx) ) return; @@ -286,7 +286,7 @@ void plSpaceTree::IHarvestEnabledLeaves(Int16 subIdx, const hsBitVector& cache, } } -void plSpaceTree::HarvestEnabledLeaves(plVolumeIsect* cull, const hsBitVector& cache, hsTArray& list) const +void plSpaceTree::HarvestEnabledLeaves(plVolumeIsect* cull, const hsBitVector& cache, hsTArray& list) const { if( IsEmpty() ) return; @@ -297,7 +297,7 @@ void plSpaceTree::HarvestEnabledLeaves(plVolumeIsect* cull, const hsBitVector& c IHarvestEnabledLeaves(fRoot, cache, list); } -void plSpaceTree::IHarvestEnabledLeaves(Int16 subIdx, const hsBitVector& cache, hsBitVector& totList, hsBitVector& list) const +void plSpaceTree::IHarvestEnabledLeaves(int16_t subIdx, const hsBitVector& cache, hsBitVector& totList, hsBitVector& list) const { if( IsDisabled(subIdx) ) return; @@ -320,7 +320,7 @@ void plSpaceTree::IHarvestEnabledLeaves(Int16 subIdx, const hsBitVector& cache, } } -void plSpaceTree::MoveLeaf(Int16 idx, const hsBounds3Ext& bnd) +void plSpaceTree::MoveLeaf(int16_t idx, const hsBounds3Ext& bnd) { hsAssert(idx == fTree[idx].fLeafIndex, "Some scrambling of indices"); @@ -340,7 +340,7 @@ void plSpaceTree::MoveLeaf(Int16 idx, const hsBounds3Ext& bnd) } } -void plSpaceTree::HarvestLeaves(Int16 subRoot, hsBitVector& totList, hsBitVector& list) const +void plSpaceTree::HarvestLeaves(int16_t subRoot, hsBitVector& totList, hsBitVector& list) const { if( !IsEmpty() ) { @@ -380,13 +380,13 @@ void plSpaceTree::HarvestLeaves(plVolumeIsect* cull, hsBitVector& list) const scratchTotVec.Clear(); } -void plSpaceTree::HarvestLeaves(Int16 subRoot, hsBitVector& list) const +void plSpaceTree::HarvestLeaves(int16_t subRoot, hsBitVector& list) const { IHarvestLeaves(GetNode(subRoot), scratchTotVec, list); scratchTotVec.Clear(); } -void plSpaceTree::HarvestLeaves(plVolumeIsect* cull, hsTArray& list) const +void plSpaceTree::HarvestLeaves(plVolumeIsect* cull, hsTArray& list) const { if( !IsEmpty() ) { @@ -397,7 +397,7 @@ void plSpaceTree::HarvestLeaves(plVolumeIsect* cull, hsTArray& list) cons } } -void plSpaceTree::HarvestLeaves(hsTArray& list) const +void plSpaceTree::HarvestLeaves(hsTArray& list) const { if( !IsEmpty() ) { @@ -408,7 +408,7 @@ void plSpaceTree::HarvestLeaves(hsTArray& list) const } } -void plSpaceTree::HarvestLeaves(Int16 subRoot, hsTArray& list) const +void plSpaceTree::HarvestLeaves(int16_t subRoot, hsTArray& list) const { if( !IsEmpty() ) { @@ -420,7 +420,7 @@ void plSpaceTree::HarvestLeaves(Int16 subRoot, hsTArray& list) const } } -void plSpaceTree::BitVectorToList(hsTArray& list, const hsBitVector& bitVec) const +void plSpaceTree::BitVectorToList(hsTArray& list, const hsBitVector& bitVec) const { #if 0 // added func to bitvector int i; @@ -472,7 +472,7 @@ void plSpaceTree::IHarvestAndCullLeaves(const plSpaceTreeNode& subRoot, hsBitVec } } -void plSpaceTree::IHarvestAndCullLeaves(const plSpaceTreeNode& subRoot, hsTArray& list) const +void plSpaceTree::IHarvestAndCullLeaves(const plSpaceTreeNode& subRoot, hsTArray& list) const { if( subRoot.fFlags & plSpaceTreeNode::kDisabled ) return; @@ -525,7 +525,7 @@ void plSpaceTree::IHarvestLeaves(const plSpaceTreeNode& subRoot, hsBitVector& to } } -void plSpaceTree::IHarvestLeaves(const plSpaceTreeNode& subRoot, hsTArray& list) const +void plSpaceTree::IHarvestLeaves(const plSpaceTreeNode& subRoot, hsTArray& list) const { if( subRoot.fFlags & plSpaceTreeNode::kDisabled ) return; @@ -547,9 +547,9 @@ void plSpaceTree::Read(hsStream* s, hsResMgr* mgr) fRoot = s->ReadLE16(); - fNumLeaves = UInt16(s->ReadLE32()); + fNumLeaves = uint16_t(s->ReadLE32()); - UInt32 n = s->ReadLE32(); + uint32_t n = s->ReadLE32(); fTree.SetCount(n); int i; for( i = 0; i < n; i++ ) @@ -574,7 +574,7 @@ void plSpaceTree::Write(hsStream* s, hsResMgr* mgr) // Some debug only stuff -void plSpaceTree::HarvestLevel(int level, hsTArray& list) const +void plSpaceTree::HarvestLevel(int level, hsTArray& list) const { if( !IsEmpty() ) { @@ -582,7 +582,7 @@ void plSpaceTree::HarvestLevel(int level, hsTArray& list) const } } -void plSpaceTree::IHarvestLevel(Int16 subRoot, int level, int currLevel, hsTArray& list) const +void plSpaceTree::IHarvestLevel(int16_t subRoot, int level, int currLevel, hsTArray& list) const { if( level == currLevel ) { diff --git a/Sources/Plasma/PubUtilLib/plDrawable/plSpaceTree.h b/Sources/Plasma/PubUtilLib/plDrawable/plSpaceTree.h index 568103e1..4e70d2d8 100644 --- a/Sources/Plasma/PubUtilLib/plDrawable/plSpaceTree.h +++ b/Sources/Plasma/PubUtilLib/plDrawable/plSpaceTree.h @@ -66,16 +66,16 @@ public: hsBounds3Ext fWorldBounds; - UInt16 fFlags; // mostly for alignment; - Int16 fParent; + uint16_t fFlags; // mostly for alignment; + int16_t fParent; union { - Int16 fChildren[2]; // Children are actually in same array as parent - Int16 fLeafIndex; + int16_t fChildren[2]; // Children are actually in same array as parent + int16_t fLeafIndex; }; - Int16 GetChild(int w) const { hsAssert(!(fFlags & kIsLeaf), "Getting Child of leaf node"); return fChildren[w]; } - Int16 GetParent() const { return fParent; } - Int16 GetLeaf() const { hsAssert(fFlags & kIsLeaf, "Getting leaf idx off interior node"); return fLeafIndex; } + int16_t GetChild(int w) const { hsAssert(!(fFlags & kIsLeaf), "Getting Child of leaf node"); return fChildren[w]; } + int16_t GetParent() const { return fParent; } + int16_t GetLeaf() const { hsAssert(fFlags & kIsLeaf, "Getting leaf idx off interior node"); return fLeafIndex; } hsBool IsLeaf() const { return 0 != (fFlags & kIsLeaf); } const hsBounds3Ext& GetWorldBounds() const { return fWorldBounds; } @@ -101,30 +101,30 @@ private: hsTArray fTree; const hsBitVector* fCache; - Int16 fRoot; - Int16 fNumLeaves; + int16_t fRoot; + int16_t fNumLeaves; - UInt16 fHarvestFlags; + uint16_t fHarvestFlags; mutable plVolumeIsect* fCullFunc; hsPoint3 fViewPos; - void IRefreshRecur(Int16 which); + void IRefreshRecur(int16_t which); - void IHarvestAndCullLeaves(const plSpaceTreeNode& subRoot, hsTArray& list) const; - void IHarvestLeaves(const plSpaceTreeNode& subRoot, hsTArray& list) const; + void IHarvestAndCullLeaves(const plSpaceTreeNode& subRoot, hsTArray& list) const; + void IHarvestLeaves(const plSpaceTreeNode& subRoot, hsTArray& list) const; void IHarvestAndCullLeaves(const plSpaceTreeNode& subRoot, hsBitVector& totList, hsBitVector& list) const; void IHarvestLeaves(const plSpaceTreeNode& subRoot, hsBitVector& totList, hsBitVector& list) const; - void IHarvestLevel(Int16 subRoot, int level, int currLevel, hsTArray& list) const; + void IHarvestLevel(int16_t subRoot, int level, int currLevel, hsTArray& list) const; - void IHarvestAndCullEnabledLeaves(Int16 subRoot, const hsBitVector& cache, hsTArray& list) const; - void IHarvestEnabledLeaves(Int16 subRoot, const hsBitVector& cache, hsTArray& list) const; - void IHarvestEnabledLeaves(Int16 subIdx, const hsBitVector& cache, hsBitVector& totList, hsBitVector& list) const; + void IHarvestAndCullEnabledLeaves(int16_t subRoot, const hsBitVector& cache, hsTArray& list) const; + void IHarvestEnabledLeaves(int16_t subRoot, const hsBitVector& cache, hsTArray& list) const; + void IHarvestEnabledLeaves(int16_t subIdx, const hsBitVector& cache, hsBitVector& totList, hsBitVector& list) const; - void IEnableLeaf(Int16 idx, hsBitVector& cache) const; + void IEnableLeaf(int16_t idx, hsBitVector& cache) const; public: plSpaceTree(); @@ -136,54 +136,54 @@ public: void SetViewPos(const hsPoint3& p) { fViewPos = p; } const hsPoint3& GetViewPos() const { return fViewPos; } - const plSpaceTreeNode& GetNode(Int16 w) const { return fTree[w]; } - Int16 GetRoot() const { return fRoot; } - hsBool IsRoot(Int16 w) const { return fRoot == w; } - hsBool IsLeaf(Int16 w) const { return GetNode(w).IsLeaf(); } + const plSpaceTreeNode& GetNode(int16_t w) const { return fTree[w]; } + int16_t GetRoot() const { return fRoot; } + hsBool IsRoot(int16_t w) const { return fRoot == w; } + hsBool IsLeaf(int16_t w) const { return GetNode(w).IsLeaf(); } void HarvestLeaves(hsBitVector& totList, hsBitVector& list) const; void HarvestLeaves(hsBitVector& list) const; void HarvestLeaves(plVolumeIsect* cullFunc, hsBitVector& list) const; - void HarvestLeaves(Int16 subRoot, hsBitVector& list) const; - void HarvestLeaves(Int16 subRoot, hsBitVector& totList, hsBitVector& list) const; + void HarvestLeaves(int16_t subRoot, hsBitVector& list) const; + void HarvestLeaves(int16_t subRoot, hsBitVector& totList, hsBitVector& list) const; - void HarvestLeaves(hsTArray& list) const; - void HarvestLeaves(plVolumeIsect* cullFunc, hsTArray& list) const; - void HarvestLeaves(Int16 subRoot, hsTArray& list) const; + void HarvestLeaves(hsTArray& list) const; + void HarvestLeaves(plVolumeIsect* cullFunc, hsTArray& list) const; + void HarvestLeaves(int16_t subRoot, hsTArray& list) const; - void EnableLeaf(Int16 idx, hsBitVector& cache) const; - void EnableLeaves(const hsTArray& list, hsBitVector& cache) const; - void HarvestEnabledLeaves(plVolumeIsect* cullFunc, const hsBitVector& cache, hsTArray& list) const; + void EnableLeaf(int16_t idx, hsBitVector& cache) const; + void EnableLeaves(const hsTArray& list, hsBitVector& cache) const; + void HarvestEnabledLeaves(plVolumeIsect* cullFunc, const hsBitVector& cache, hsTArray& list) const; void SetCache(const hsBitVector* cache) { fCache = cache; } - void BitVectorToList(hsTArray& list, const hsBitVector& bitVec) const; + void BitVectorToList(hsTArray& list, const hsBitVector& bitVec) const; void SetHarvestFlags(plHarvestFlags f) { fHarvestFlags = f; } - UInt16 GetHarvestFlags() const { return fHarvestFlags; } + uint16_t GetHarvestFlags() const { return fHarvestFlags; } - UInt16 HasLeafFlag(Int16 w, UInt16 f) const { return GetNode(w).fFlags & f; } - void SetLeafFlag(Int16 w, UInt16 f, hsBool on=true); - void ClearLeafFlag(Int16 w, UInt16 f); - void ClearTreeFlag(UInt16 f); - void SetTreeFlag(UInt16 f, hsBool on=true); + uint16_t HasLeafFlag(int16_t w, uint16_t f) const { return GetNode(w).fFlags & f; } + void SetLeafFlag(int16_t w, uint16_t f, hsBool on=true); + void ClearLeafFlag(int16_t w, uint16_t f); + void ClearTreeFlag(uint16_t f); + void SetTreeFlag(uint16_t f, hsBool on=true); - hsBool IsDisabled(UInt16 w) const { return (GetNode(w).fFlags & plSpaceTreeNode::kDisabled) || (fCache && !fCache->IsBitSet(w)); } + hsBool IsDisabled(uint16_t w) const { return (GetNode(w).fFlags & plSpaceTreeNode::kDisabled) || (fCache && !fCache->IsBitSet(w)); } // Should GetWorldBounds check and refresh if needed? const hsBounds3Ext& GetWorldBounds() const { return GetNode(GetRoot()).fWorldBounds; } - void MoveLeaf(Int16 idx, const hsBounds3Ext& newWorldBnd); + void MoveLeaf(int16_t idx, const hsBounds3Ext& newWorldBnd); void Refresh(); hsBool IsEmpty() const { return 0 != (GetNode(GetRoot()).fFlags & plSpaceTreeNode::kEmpty); } hsBool IsDirty() const { return 0 != (GetNode(GetRoot()).fFlags & plSpaceTreeNode::kDirty); } void MakeDirty() { fTree[GetRoot()].fFlags |= plSpaceTreeNode::kDirty; } - Int16 GetNumLeaves() const { return fNumLeaves; } + int16_t GetNumLeaves() const { return fNumLeaves; } virtual void Read(hsStream* s, hsResMgr* mgr); virtual void Write(hsStream* s, hsResMgr* mgr); - void HarvestLevel(int level, hsTArray& list) const; + void HarvestLevel(int level, hsTArray& list) const; friend class plSpaceTreeMaker; }; diff --git a/Sources/Plasma/PubUtilLib/plDrawable/plSpaceTreeMaker.cpp b/Sources/Plasma/PubUtilLib/plDrawable/plSpaceTreeMaker.cpp index 932bced2..c5d8c47c 100644 --- a/Sources/Plasma/PubUtilLib/plDrawable/plSpaceTreeMaker.cpp +++ b/Sources/Plasma/PubUtilLib/plDrawable/plSpaceTreeMaker.cpp @@ -40,12 +40,12 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "plSpaceTreeMaker.h" #include "plMath/hsRadixSort.h" #include "plDrawable/plSpaceTree.h" -#include "hsUtils.h" // for testing, get hsRand() + // for testing, get hsRand() #include "hsTimer.h" #include "plIntersect/plVolumeIsect.h" @@ -129,7 +129,7 @@ void plSpaceTreeMaker::ISortList(hsTArray& nodes, const hsVect hsRadixSort::Elem* list = fSortScratch; hsRadixSort::Elem* listTrav = list; - Int32 n = nodes.GetCount(); + int32_t n = nodes.GetCount(); while( n-- ) { listTrav->fKey.fFloat = axis.InnerProduct(nodes[n]->fWorldBounds.GetCenter()); @@ -138,7 +138,7 @@ void plSpaceTreeMaker::ISortList(hsTArray& nodes, const hsVect listTrav++; } list[nodes.GetCount()-1].fNext = nil; - UInt32 sortFlags = 0; + uint32_t sortFlags = 0; hsRadixSort rad; hsRadixSort::Elem* sortedList = rad.Sort(list, sortFlags); listTrav = sortedList; @@ -172,7 +172,7 @@ void plSpaceTreeMaker::ISplitList(hsTArray& nodes, const hsVec upper[i] = nodes[i + lowerCount]; } -hsBounds3Ext plSpaceTreeMaker::IFindDistToCenterAxis(hsTArray& nodes, hsScalar& length, hsVector3& axis) +hsBounds3Ext plSpaceTreeMaker::IFindDistToCenterAxis(hsTArray& nodes, float& length, hsVector3& axis) { hsBounds3Ext bnd; bnd.MakeEmpty(); @@ -189,14 +189,14 @@ hsBounds3Ext plSpaceTreeMaker::IFindDistToCenterAxis(hsTArray& { hsVector3 sep; sep.Set(&bnd.GetCenter(), &nodes[i]->fWorldBounds.GetCenter()); - hsScalar len = sep.MagnitudeSquared(); + float len = sep.MagnitudeSquared(); if( len > length ) { axis = sep; length = len; } } - length = hsSquareRoot(length); + length = sqrt(length); if( length > 1.e-3f ) axis /= length; else @@ -212,7 +212,7 @@ plSpacePrepNode* plSpaceTreeMaker::IMakeFatTreeRecur(hsTArray& StartTimer(kMakeFatTree); - plSpacePrepNode* subRoot = TRACKED_NEW plSpacePrepNode; + plSpacePrepNode* subRoot = new plSpacePrepNode; fTreeSize++; if( nodes.GetCount() == 1 ) @@ -231,7 +231,7 @@ plSpacePrepNode* plSpaceTreeMaker::IMakeFatTreeRecur(hsTArray& // Find the maximum length vector from nodes[i] center to list center. // If that length is zero, just use the maximum dimension of overall bounds. - hsScalar length; + float length; hsVector3 axis; hsBounds3Ext bnd = IFindDistToCenterAxis(nodes, length, axis); @@ -249,7 +249,7 @@ plSpacePrepNode* plSpaceTreeMaker::IMakeFatTreeRecur(hsTArray& return subRoot; } -hsBounds3Ext plSpaceTreeMaker::IFindSplitAxis(hsTArray& nodes, hsScalar& length, hsVector3& axis) +hsBounds3Ext plSpaceTreeMaker::IFindSplitAxis(hsTArray& nodes, float& length, hsVector3& axis) { hsBounds3Ext bnd; bnd.MakeEmpty(); @@ -258,7 +258,7 @@ hsBounds3Ext plSpaceTreeMaker::IFindSplitAxis(hsTArray& nodes, { bnd.Union(&nodes[i]->fWorldBounds); } - hsScalar maxLen = bnd.GetMaxs()[0] - bnd.GetMins()[0]; + float maxLen = bnd.GetMaxs()[0] - bnd.GetMins()[0]; int maxAxis = 0; if( bnd.GetMaxs()[1] - bnd.GetMins()[1] > maxLen ) @@ -290,9 +290,9 @@ hsBounds3Ext plSpaceTreeMaker::IFindSplitAxis(hsTArray& nodes, return bnd; } -void plSpaceTreeMaker::IFindBigList(hsTArray& nodes, hsScalar length, const hsVector3& axis, hsTArray& giants, hsTArray& strimps) +void plSpaceTreeMaker::IFindBigList(hsTArray& nodes, float length, const hsVector3& axis, hsTArray& giants, hsTArray& strimps) { - const hsScalar kCutoffFrac = 0.5f; + const float kCutoffFrac = 0.5f; giants.SetCount(0); strimps.SetCount(0); @@ -310,8 +310,8 @@ void plSpaceTreeMaker::IFindBigList(hsTArray& nodes, hsScalar plSpacePrepNode* plSpaceTreeMaker::INewSubRoot(const hsBounds3Ext& bnd) { - plSpacePrepNode* subRoot = TRACKED_NEW plSpacePrepNode; - subRoot->fDataIndex = Int16(-1); + plSpacePrepNode* subRoot = new plSpacePrepNode; + subRoot->fDataIndex = int16_t(-1); fTreeSize++; subRoot->fWorldBounds = bnd; @@ -332,7 +332,7 @@ plSpacePrepNode* plSpaceTreeMaker::IMakeTreeRecur(hsTArray& no StartTimer(kMakeTree); // Find the maximum bounds dimension - hsScalar length; + float length; hsVector3 axis; hsBounds3Ext bnd = IFindSplitAxis(nodes, length, axis); @@ -372,7 +372,7 @@ plSpacePrepNode* plSpaceTreeMaker::IMakeTreeRecur(hsTArray& no void plSpaceTreeMaker::IMakeTree() { - fSortScratch = TRACKED_NEW hsRadixSort::Elem[fLeaves.GetCount()]; + fSortScratch = new hsRadixSort::Elem[fLeaves.GetCount()]; fPrepTree = IMakeTreeRecur(fLeaves); @@ -411,9 +411,9 @@ void plSpaceTreeMaker::Cleanup() fDisabled.Reset(); } -Int32 plSpaceTreeMaker::AddLeaf(const hsBounds3Ext& worldBnd, hsBool disable) +int32_t plSpaceTreeMaker::AddLeaf(const hsBounds3Ext& worldBnd, hsBool disable) { - plSpacePrepNode* leaf = TRACKED_NEW plSpacePrepNode; + plSpacePrepNode* leaf = new plSpacePrepNode; fLeaves.Append(leaf); leaf->fDataIndex = fLeaves.GetCount()-1; leaf->fChildren[0] = nil; @@ -487,7 +487,7 @@ void plSpaceTreeMaker::TestTree() tree->SetViewPos(*hsPoint3().Set(0,0,0)); plConeIsect cone; - cone.SetAngle(hsScalarPI*0.25f); + cone.SetAngle(M_PI*0.25f); cone.SetTransform(liX, invLiX); StartTimer(kHarvestCone); @@ -498,7 +498,7 @@ void plSpaceTreeMaker::TestTree() StopTimer(kHarvestCone); plConeIsect capped; - capped.SetAngle(hsScalarPI*0.25f); + capped.SetAngle(M_PI*0.25f); capped.SetLength(0.5f); capped.SetTransform(liX, invLiX); @@ -548,7 +548,7 @@ plSpaceTree* plSpaceTreeMaker::MakeTree() plSpaceTree* plSpaceTreeMaker::IMakeEmptyTree() { - plSpaceTree* tree = TRACKED_NEW plSpaceTree; + plSpaceTree* tree = new plSpaceTree; tree->fTree.SetCount(1); hsPoint3 zero(0, 0, 0); @@ -564,7 +564,7 @@ plSpaceTree* plSpaceTreeMaker::IMakeEmptyTree() plSpaceTree* plSpaceTreeMaker::IMakeDegenerateTree() { - plSpaceTree* tree = TRACKED_NEW plSpaceTree; + plSpaceTree* tree = new plSpaceTree; tree->fTree.Push(); @@ -600,7 +600,7 @@ plSpaceTree* plSpaceTreeMaker::IMakeSpaceTree() { StartTimer(kMakeSpaceTree); - plSpaceTree* tree = TRACKED_NEW plSpaceTree; + plSpaceTree* tree = new plSpaceTree; plSpacePrepNode* head = fPrepTree; @@ -631,11 +631,11 @@ plSpaceTree* plSpaceTreeMaker::IMakeSpaceTree() // The following goofy cache-friendly tree set up slows down the tree build by 10%, but speeds up the runtime by 9%. // Sounds fair. #if 0 // Leaves first -Int16 plSpaceTreeMaker::IMakeSpaceTreeRecur(plSpacePrepNode* sub, plSpaceTree* tree, const int targetLevel, int currLevel) +int16_t plSpaceTreeMaker::IMakeSpaceTreeRecur(plSpacePrepNode* sub, plSpaceTree* tree, const int targetLevel, int currLevel) { if( currLevel == targetLevel ) { - Int16 nodeIdx = tree->fTree.GetCount(); + int16_t nodeIdx = tree->fTree.GetCount(); tree->fTree.Push(); tree->fTree[nodeIdx].fWorldBounds = sub->fWorldBounds; @@ -659,7 +659,7 @@ Int16 plSpaceTreeMaker::IMakeSpaceTreeRecur(plSpacePrepNode* sub, plSpaceTree* t return nodeIdx; } - Int16 nodeIdx = sub->fIndex; + int16_t nodeIdx = sub->fIndex; if( !sub->fChildren[0] ) { @@ -686,7 +686,7 @@ void plSpaceTreeMaker::IGatherLeavesRecur(plSpacePrepNode* sub, plSpaceTree* tre hsAssert(!sub->fChildren[1], "Unsupported unbalance of tree"); plSpaceTreeNode& leaf = tree->fTree[sub->fDataIndex]; - Int16 nodeIdx = sub->fDataIndex; + int16_t nodeIdx = sub->fDataIndex; leaf.fWorldBounds = sub->fWorldBounds; sub->fIndex = nodeIdx; leaf.fFlags = plSpaceTreeNode::kIsLeaf; @@ -713,7 +713,7 @@ void plSpaceTreeMaker::IMakeSpaceTreeRecur(plSpacePrepNode* sub, plSpaceTree* tr if( currLevel == targetLevel ) { - Int16 nodeIdx = tree->fTree.GetCount(); + int16_t nodeIdx = tree->fTree.GetCount(); tree->fTree.Push(); tree->fTree[nodeIdx].fWorldBounds = sub->fWorldBounds; diff --git a/Sources/Plasma/PubUtilLib/plDrawable/plSpaceTreeMaker.h b/Sources/Plasma/PubUtilLib/plDrawable/plSpaceTreeMaker.h index 1be62f01..02adbdaa 100644 --- a/Sources/Plasma/PubUtilLib/plDrawable/plSpaceTreeMaker.h +++ b/Sources/Plasma/PubUtilLib/plDrawable/plSpaceTreeMaker.h @@ -55,8 +55,8 @@ class plSpacePrepNode public: hsBounds3Ext fWorldBounds; - Int16 fIndex; - Int16 fDataIndex; + int16_t fIndex; + int16_t fDataIndex; plSpacePrepNode* fChildren[2]; }; @@ -71,15 +71,15 @@ protected: hsBitVector fDisabled; plSpacePrepNode* fPrepTree; - Int16 fTreeSize; + int16_t fTreeSize; plSpacePrepNode* INewSubRoot(const hsBounds3Ext& bnd); - void IFindBigList(hsTArray& nodes, hsScalar length, const hsVector3& axis, hsTArray& giants, hsTArray& strimp); + void IFindBigList(hsTArray& nodes, float length, const hsVector3& axis, hsTArray& giants, hsTArray& strimp); void ISortList(hsTArray& nodes, const hsVector3& axis); void ISplitList(hsTArray& nodes, const hsVector3& axis, hsTArray& lower, hsTArray& upper); - hsBounds3Ext IFindDistToCenterAxis(hsTArray& nodes, hsScalar& length, hsVector3& axis); + hsBounds3Ext IFindDistToCenterAxis(hsTArray& nodes, float& length, hsVector3& axis); plSpacePrepNode* IMakeFatTreeRecur(hsTArray& nodes); - hsBounds3Ext IFindSplitAxis(hsTArray& nodes, hsScalar& length, hsVector3& axis); + hsBounds3Ext IFindSplitAxis(hsTArray& nodes, float& length, hsVector3& axis); plSpacePrepNode* IMakeTreeRecur(hsTArray& nodes); void IMakeTree(); @@ -98,7 +98,7 @@ public: void Cleanup(); void Reset(); - Int32 AddLeaf(const hsBounds3Ext& worldBnd, hsBool disable=false); + int32_t AddLeaf(const hsBounds3Ext& worldBnd, hsBool disable=false); plSpaceTree* MakeTree(); void TestTree(); // development only - NUKE ME mf horse diff --git a/Sources/Plasma/PubUtilLib/plDrawable/plSpanInstance.cpp b/Sources/Plasma/PubUtilLib/plDrawable/plSpanInstance.cpp index 70020c53..b372f148 100644 --- a/Sources/Plasma/PubUtilLib/plDrawable/plSpanInstance.cpp +++ b/Sources/Plasma/PubUtilLib/plDrawable/plSpanInstance.cpp @@ -40,7 +40,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "plSpanInstance.h" #include "hsGeometry3.h" @@ -54,7 +54,7 @@ void plSpanEncoding::Read(hsStream* s) void plSpanEncoding::Write(hsStream* s) const { - s->WriteByte((UInt8)fCode); + s->WriteByte((uint8_t)fCode); s->WriteLEScalar(fPosScale); } @@ -82,23 +82,23 @@ void plSpanInstance::DeAlloc() fCol = nil; } -void plSpanInstance::Alloc(const plSpanEncoding& encoding, UInt32 numVerts) +void plSpanInstance::Alloc(const plSpanEncoding& encoding, uint32_t numVerts) { DeAlloc(); - UInt32 posStride = PosStrideFromEncoding(encoding); + uint32_t posStride = PosStrideFromEncoding(encoding); if( posStride ) - fPosDelta = TRACKED_NEW UInt8[numVerts * posStride]; + fPosDelta = new uint8_t[numVerts * posStride]; - UInt32 colStride = ColStrideFromEncoding(encoding); + uint32_t colStride = ColStrideFromEncoding(encoding); if( colStride ) - fCol = TRACKED_NEW UInt8[numVerts * colStride]; + fCol = new uint8_t[numVerts * colStride]; } -void plSpanInstance::Read(hsStream* stream, const plSpanEncoding& encoding, UInt32 numVerts) +void plSpanInstance::Read(hsStream* stream, const plSpanEncoding& encoding, uint32_t numVerts) { Alloc(encoding, numVerts); - stream->Read(12 * sizeof(hsScalar), fL2W[0]); + stream->Read(12 * sizeof(float), fL2W[0]); if( fPosDelta ) { stream->Read(numVerts * PosStrideFromEncoding(encoding), fPosDelta); @@ -110,9 +110,9 @@ void plSpanInstance::Read(hsStream* stream, const plSpanEncoding& encoding, UInt } } -void plSpanInstance::Write(hsStream* stream, const plSpanEncoding& encoding, UInt32 numVerts) const +void plSpanInstance::Write(hsStream* stream, const plSpanEncoding& encoding, uint32_t numVerts) const { - stream->Write(12 * sizeof(hsScalar), fL2W[0]); + stream->Write(12 * sizeof(float), fL2W[0]); if( fPosDelta ) { stream->Write(numVerts * PosStrideFromEncoding(encoding), fPosDelta); @@ -165,7 +165,7 @@ void plSpanInstance::SetLocalToWorld(const hsMatrix44& l2w) } } -void plSpanInstance::Encode(const plSpanEncoding& encoding, UInt32 numVerts, const hsVector3* delPos, const UInt32* color) +void plSpanInstance::Encode(const plSpanEncoding& encoding, uint32_t numVerts, const hsVector3* delPos, const uint32_t* color) { Alloc(encoding, numVerts); @@ -176,42 +176,42 @@ void plSpanInstance::Encode(const plSpanEncoding& encoding, UInt32 numVerts, con if( !(fPosDelta || fCol) ) return; - Int8* pos888 = (Int8*)fPosDelta; - Int16* pos161616 = (Int16*)fPosDelta; - UInt32* pos101010 = (UInt32*)fPosDelta; + int8_t* pos888 = (int8_t*)fPosDelta; + int16_t* pos161616 = (int16_t*)fPosDelta; + uint32_t* pos101010 = (uint32_t*)fPosDelta; - UInt8* col8 = (UInt8*)fCol; - UInt16* col16 = (UInt16*)fCol; - UInt32* col32 = (UInt32*)fCol; + uint8_t* col8 = (uint8_t*)fCol; + uint16_t* col16 = (uint16_t*)fCol; + uint32_t* col32 = (uint32_t*)fCol; int i; for( i = 0; i < numVerts; i++ ) { switch(encoding.fCode & plSpanEncoding::kPosMask) { case plSpanEncoding::kPos888: - pos888[0] = Int8(delPos->fX / encoding.fPosScale); - pos888[1] = Int8(delPos->fY / encoding.fPosScale); - pos888[2] = Int8(delPos->fZ / encoding.fPosScale); + pos888[0] = int8_t(delPos->fX / encoding.fPosScale); + pos888[1] = int8_t(delPos->fY / encoding.fPosScale); + pos888[2] = int8_t(delPos->fZ / encoding.fPosScale); pos888 += 3; delPos++; break; case plSpanEncoding::kPos161616: - pos161616[0] = Int16(delPos->fX / encoding.fPosScale); - pos161616[1] = Int16(delPos->fY / encoding.fPosScale); - pos161616[2] = Int16(delPos->fZ / encoding.fPosScale); + pos161616[0] = int16_t(delPos->fX / encoding.fPosScale); + pos161616[1] = int16_t(delPos->fY / encoding.fPosScale); + pos161616[2] = int16_t(delPos->fZ / encoding.fPosScale); pos161616 += 3; delPos++; break; case plSpanEncoding::kPos101010: *pos101010 = - ((UInt32(delPos->fX / encoding.fPosScale) & 0x3f) << 0) - | ((UInt32(delPos->fY / encoding.fPosScale) & 0x3f) << 10) - | ((UInt32(delPos->fZ / encoding.fPosScale) & 0x3f) << 20); + ((uint32_t(delPos->fX / encoding.fPosScale) & 0x3f) << 0) + | ((uint32_t(delPos->fY / encoding.fPosScale) & 0x3f) << 10) + | ((uint32_t(delPos->fZ / encoding.fPosScale) & 0x3f) << 20); pos101010++; delPos++; break; case plSpanEncoding::kPos008: - *pos888 = Int8(delPos->fZ / encoding.fPosScale); + *pos888 = int8_t(delPos->fZ / encoding.fPosScale); pos888++; delPos++; break; @@ -222,24 +222,24 @@ void plSpanInstance::Encode(const plSpanEncoding& encoding, UInt32 numVerts, con switch(encoding.fCode & plSpanEncoding::kColMask) { case plSpanEncoding::kColA8: - *col8 = (UInt8)((*color) >> 24); + *col8 = (uint8_t)((*color) >> 24); col8++; color++; break; case plSpanEncoding::kColI8: - *col8 = (UInt8)((*color) & 0xff); + *col8 = (uint8_t)((*color) & 0xff); col8++; color++; break; case plSpanEncoding::kColAI88: - *col16 = (UInt16)(((*color) >> 16) & 0xffff); + *col16 = (uint16_t)(((*color) >> 16) & 0xffff); col16++; color++; break; case plSpanEncoding::kColRGB888: - *col8++ = (UInt8)((*color >> 16) & 0xff); - *col8++ = (UInt8)((*color >> 8) & 0xff); - *col8++ = (UInt8)((*color >> 0) & 0xff); + *col8++ = (uint8_t)((*color >> 16) & 0xff); + *col8++ = (uint8_t)((*color >> 8) & 0xff); + *col8++ = (uint8_t)((*color >> 0) & 0xff); color++; break; case plSpanEncoding::kColARGB8888: diff --git a/Sources/Plasma/PubUtilLib/plDrawable/plSpanInstance.h b/Sources/Plasma/PubUtilLib/plDrawable/plSpanInstance.h index d4ed803c..197502a2 100644 --- a/Sources/Plasma/PubUtilLib/plDrawable/plSpanInstance.h +++ b/Sources/Plasma/PubUtilLib/plDrawable/plSpanInstance.h @@ -112,14 +112,14 @@ public: | kColARGB8888, }; - UInt32 fCode; - hsScalar fPosScale; + uint32_t fCode; + float fPosScale; plSpanEncoding() : fCode(kPosNone|kColNone), fPosScale(0) {} - plSpanEncoding(UInt32 c, hsScalar s) : fCode(c), fPosScale(s) {} + plSpanEncoding(uint32_t c, float s) : fCode(c), fPosScale(s) {} - UInt32 Code() const { return fCode; } - hsScalar Scale() const { return fPosScale; } + uint32_t Code() const { return fCode; } + float Scale() const { return fPosScale; } void Read(hsStream* s); void Write(hsStream* s) const; @@ -128,22 +128,22 @@ public: class plSpanInstance { protected: - UInt8* fPosDelta; - UInt8* fCol; + uint8_t* fPosDelta; + uint8_t* fCol; - hsScalar fL2W[3][4]; + float fL2W[3][4]; friend class plSpanInstanceIter; public: plSpanInstance(); ~plSpanInstance(); - void Read(hsStream* s, const plSpanEncoding& encoding, UInt32 numVerts); - void Write(hsStream* s, const plSpanEncoding& encoding, UInt32 numVerts) const; + void Read(hsStream* s, const plSpanEncoding& encoding, uint32_t numVerts); + void Write(hsStream* s, const plSpanEncoding& encoding, uint32_t numVerts) const; - void Encode(const plSpanEncoding& encoding, UInt32 numVerts, const hsVector3* delPos, const UInt32* color); + void Encode(const plSpanEncoding& encoding, uint32_t numVerts, const hsVector3* delPos, const uint32_t* color); - void Alloc(const plSpanEncoding& encoding, UInt32 numVerts); + void Alloc(const plSpanEncoding& encoding, uint32_t numVerts); void DeAlloc(); hsMatrix44 LocalToWorld() const; @@ -154,7 +154,7 @@ public: hsBool HasPosDelta() const { return fPosDelta != nil; } hsBool HasColor() const { return fCol != nil; } - static UInt16 PosStrideFromEncoding(const plSpanEncoding& encoding) + static uint16_t PosStrideFromEncoding(const plSpanEncoding& encoding) { switch(encoding.fCode & plSpanEncoding::kPosMask) { @@ -169,7 +169,7 @@ public: } return 0; } - static UInt16 ColStrideFromEncoding(const plSpanEncoding& encoding) + static uint16_t ColStrideFromEncoding(const plSpanEncoding& encoding) { switch(encoding.fCode & plSpanEncoding::kPosMask) { @@ -195,29 +195,29 @@ class plSpanInstanceIter protected: plSpanInstance* fInst; plSpanEncoding fEncoding; - UInt32 fNumVerts; - Int32 fNumVertsLeft; - UInt16 fPosStride; - UInt16 fColStride; + uint32_t fNumVerts; + int32_t fNumVertsLeft; + uint16_t fPosStride; + uint16_t fColStride; union { - Int8* fPos888; - Int16* fPos161616; - UInt32* fPos101010; + int8_t* fPos888; + int16_t* fPos161616; + uint32_t* fPos101010; }; union { - UInt8* fA8; - UInt8* fI8; - UInt16* fAI88; - UInt8* fRGB888; - UInt32* fARGB8888; + uint8_t* fA8; + uint8_t* fI8; + uint16_t* fAI88; + uint8_t* fRGB888; + uint32_t* fARGB8888; }; public: plSpanInstanceIter(); - plSpanInstanceIter(plSpanInstance* inst, const plSpanEncoding& encoding, UInt32 numVerts) { Init(inst, encoding, numVerts); } + plSpanInstanceIter(plSpanInstance* inst, const plSpanEncoding& encoding, uint32_t numVerts) { Init(inst, encoding, numVerts); } - void Init(plSpanInstance* inst, const plSpanEncoding& encoding, UInt32 numVerts) + void Init(plSpanInstance* inst, const plSpanEncoding& encoding, uint32_t numVerts) { fInst = inst; fEncoding = encoding; @@ -229,7 +229,7 @@ public: void Begin() { - fPos888 = (Int8*)fInst->fPosDelta; + fPos888 = (int8_t*)fInst->fPosDelta; fA8 = fInst->fCol; fNumVertsLeft = fNumVerts; @@ -270,7 +270,7 @@ public: pos += DelPos(); return pos; }; - UInt32 Color(UInt32 c) const + uint32_t Color(uint32_t c) const { switch(fEncoding.fCode & plSpanEncoding::kColMask) { @@ -283,7 +283,7 @@ public: | (*fI8 << 0); case plSpanEncoding::kColAI88: { - const UInt32 col = *fAI88 & 0xff; + const uint32_t col = *fAI88 & 0xff; return ((*fAI88 & 0xff00) << 24) | (col << 16) | (col << 8) diff --git a/Sources/Plasma/PubUtilLib/plDrawable/plSpanTemplate.cpp b/Sources/Plasma/PubUtilLib/plDrawable/plSpanTemplate.cpp index ac70b007..6c1f0963 100644 --- a/Sources/Plasma/PubUtilLib/plDrawable/plSpanTemplate.cpp +++ b/Sources/Plasma/PubUtilLib/plDrawable/plSpanTemplate.cpp @@ -40,7 +40,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "plSpanTemplate.h" #include "plSpanInstance.h" @@ -58,7 +58,7 @@ plSpanTemplate::plSpanTemplate() { } -UInt32 plSpanTemplate::CalcStride() +uint32_t plSpanTemplate::CalcStride() { fStride = 0; if( NumPos() ) @@ -66,31 +66,31 @@ UInt32 plSpanTemplate::CalcStride() if( NumNorm() ) fStride += sizeof(hsVector3); if( NumColor() ) - fStride += sizeof(UInt32); + fStride += sizeof(uint32_t); if( NumColor2() ) - fStride += sizeof(UInt32); + fStride += sizeof(uint32_t); if( NumWgtIdx() ) - fStride += sizeof(UInt32); + fStride += sizeof(uint32_t); if( NumUVWs() ) - fStride += (UInt8)(sizeof(hsPoint3) * NumUVWs()); + fStride += (uint8_t)(sizeof(hsPoint3) * NumUVWs()); if( NumWeights() ) - fStride += (UInt8)(sizeof(hsScalar) * NumWeights()); + fStride += (uint8_t)(sizeof(float) * NumWeights()); - return UInt32(fStride); + return uint32_t(fStride); } -void plSpanTemplate::Alloc(UInt16 format, UInt32 numVerts, UInt32 numTris) +void plSpanTemplate::Alloc(uint16_t format, uint32_t numVerts, uint32_t numTris) { DeAlloc(); - fNumVerts = (UInt16)numVerts; + fNumVerts = (uint16_t)numVerts; fFormat = format; CalcStride(); - fNumTris = (UInt16)numTris; + fNumTris = (uint16_t)numTris; - fData = TRACKED_NEW UInt8[VertSize()]; + fData = new uint8_t[VertSize()]; - fIndices = TRACKED_NEW UInt16[NumIndices()]; + fIndices = new uint16_t[NumIndices()]; } void plSpanTemplate::DeAlloc() @@ -139,8 +139,8 @@ void plSpanTemplateB::ComputeBounds() void plSpanTemplateB::AllocColors() { - fMultColors = TRACKED_NEW hsColorRGBA[NumVerts()]; - fAddColors = TRACKED_NEW hsColorRGBA[NumVerts()]; + fMultColors = new hsColorRGBA[NumVerts()]; + fAddColors = new hsColorRGBA[NumVerts()]; } void plSpanTemplateB::DeAllocColors() diff --git a/Sources/Plasma/PubUtilLib/plDrawable/plSpanTemplate.h b/Sources/Plasma/PubUtilLib/plDrawable/plSpanTemplate.h index 2199731c..0482b49f 100644 --- a/Sources/Plasma/PubUtilLib/plDrawable/plSpanTemplate.h +++ b/Sources/Plasma/PubUtilLib/plDrawable/plSpanTemplate.h @@ -58,7 +58,7 @@ class plSpanTemplate public: // 99% of the time, the defaults are fine. Just tell me // how many UVWs, and whether you've got color. - static UInt16 MakeFormat(hsBool hasColor, int numUVWs, + static uint16_t MakeFormat(hsBool hasColor, int numUVWs, hsBool hasWgtIdx = false, int numWgts = 0, hsBool hasNorm = true, @@ -101,10 +101,10 @@ public: }; protected: - UInt16 fNumVerts; - UInt16 fFormat; - UInt8 fStride; - UInt16 fNumTris; + uint16_t fNumVerts; + uint16_t fFormat; + uint8_t fStride; + uint16_t fNumTris; // Data stored interleaved. Any channels may be omitted, but // existing channels are in exactly the following order: @@ -115,57 +115,57 @@ protected: // Color // Color2 // UVWs - UInt8* fData; + uint8_t* fData; - UInt16* fIndices; + uint16_t* fIndices; friend class plClusterUtil; public: plSpanTemplate(); virtual ~plSpanTemplate() { DeAlloc(); } - const UInt8* VertData() const { return fData; } + const uint8_t* VertData() const { return fData; } - const UInt16* IndexData() const { return fIndices; } + const uint16_t* IndexData() const { return fIndices; } - UInt32 NumVerts() const { return fNumVerts; } - UInt32 Stride() const { return UInt32(fStride); } - UInt32 CalcStride(); - UInt32 VertSize() const { return NumVerts() * Stride(); } + uint32_t NumVerts() const { return fNumVerts; } + uint32_t Stride() const { return uint32_t(fStride); } + uint32_t CalcStride(); + uint32_t VertSize() const { return NumVerts() * Stride(); } - UInt32 NumTris() const { return fNumTris; } - UInt32 NumIndices() const { return NumTris() * 3; } - UInt32 IndexSize() const { return NumIndices() * sizeof(UInt16); } + uint32_t NumTris() const { return fNumTris; } + uint32_t NumIndices() const { return NumTris() * 3; } + uint32_t IndexSize() const { return NumIndices() * sizeof(uint16_t); } - UInt8 PositionOffset() const { return UInt8(0); } - UInt8 WgtIdxOffset() const { return UInt8(PositionOffset() + NumPos() * sizeof(hsPoint3)); } - UInt8 WeightOffset() const { return UInt8(WgtIdxOffset() + NumWgtIdx() * sizeof(UInt32)); } - UInt8 NormalOffset() const { return UInt8(WeightOffset() + NumWeights() * sizeof(hsScalar)); } - UInt8 ColorOffset() const { return UInt8(NormalOffset() + NumNorm() * sizeof(hsVector3)); } - UInt8 Color2Offset() const { return UInt8(ColorOffset() + NumColor() * sizeof(UInt32)); } - UInt8 UVWOffset() const { return UInt8(Color2Offset() + NumColor2() * sizeof(UInt32)); } - - UInt32 NumUVWs() const { return (fFormat & kUVWMask) >> 4; } - UInt32 NumWeights() const { return (fFormat & kWeightMask) >> 8; } - - UInt32 NumPos() const { return (fFormat & kPosMask) >> 0; } - UInt32 NumNorm() const { return (fFormat & kNormMask) >> 1; } - UInt32 NumColor() const { return (fFormat & kColorMask) >> 2; } - UInt32 NumColor2() const { return (fFormat & kColor2Mask) >> 10; } - UInt32 NumWgtIdx() const { return (fFormat & kWgtIdxMask) >> 3; } + uint8_t PositionOffset() const { return uint8_t(0); } + uint8_t WgtIdxOffset() const { return uint8_t(PositionOffset() + NumPos() * sizeof(hsPoint3)); } + uint8_t WeightOffset() const { return uint8_t(WgtIdxOffset() + NumWgtIdx() * sizeof(uint32_t)); } + uint8_t NormalOffset() const { return uint8_t(WeightOffset() + NumWeights() * sizeof(float)); } + uint8_t ColorOffset() const { return uint8_t(NormalOffset() + NumNorm() * sizeof(hsVector3)); } + uint8_t Color2Offset() const { return uint8_t(ColorOffset() + NumColor() * sizeof(uint32_t)); } + uint8_t UVWOffset() const { return uint8_t(Color2Offset() + NumColor2() * sizeof(uint32_t)); } + + uint32_t NumUVWs() const { return (fFormat & kUVWMask) >> 4; } + uint32_t NumWeights() const { return (fFormat & kWeightMask) >> 8; } + + uint32_t NumPos() const { return (fFormat & kPosMask) >> 0; } + uint32_t NumNorm() const { return (fFormat & kNormMask) >> 1; } + uint32_t NumColor() const { return (fFormat & kColorMask) >> 2; } + uint32_t NumColor2() const { return (fFormat & kColor2Mask) >> 10; } + uint32_t NumWgtIdx() const { return (fFormat & kWgtIdxMask) >> 3; } hsPoint3* Position(int i) const { return (hsPoint3*)GetData(kPosition, i); } hsVector3* Normal(int i) const { return (hsVector3*)GetData(kNormal, i); } - UInt32* Color(int i) const { return (UInt32*)GetData(kColor, i); } - UInt32* Color2(int i) const { return (UInt32*)GetData(kColor2, i); } - UInt32* WgtIdx(int i) const { return (UInt32*)GetData(kWgtIdx, i); } + uint32_t* Color(int i) const { return (uint32_t*)GetData(kColor, i); } + uint32_t* Color2(int i) const { return (uint32_t*)GetData(kColor2, i); } + uint32_t* WgtIdx(int i) const { return (uint32_t*)GetData(kWgtIdx, i); } hsPoint3* UVWs(int iv, int iuv) const { return (hsPoint3*)GetData(kUVW, iv, iuv); } - hsScalar* Weight(int iv, int iw) const { return (hsScalar*)GetData(kWeight, iv, iw); } + float* Weight(int iv, int iw) const { return (float*)GetData(kWeight, iv, iw); } - UInt8* GetData(Channel chan, int i, int j=0) const + uint8_t* GetData(Channel chan, int i, int j=0) const { ValidateInput(chan, i, j); - UInt8* base = fData + i * fStride; + uint8_t* base = fData + i * fStride; switch(chan) { case kPosition: @@ -173,37 +173,37 @@ public: case kWeight: return base + NumPos() * sizeof(hsPoint3) - + j * sizeof(hsScalar); + + j * sizeof(float); case kWgtIdx: return base + NumPos() * sizeof(hsPoint3) - + NumWeights() * sizeof(hsScalar); + + NumWeights() * sizeof(float); case kNormal: return base + NumPos() * sizeof(hsPoint3) - + NumWeights() * sizeof(hsScalar) - + NumWgtIdx() * sizeof(UInt32); + + NumWeights() * sizeof(float) + + NumWgtIdx() * sizeof(uint32_t); case kColor: return base + NumPos() * sizeof(hsPoint3) - + NumWeights() * sizeof(hsScalar) - + NumWgtIdx() * sizeof(UInt32) + + NumWeights() * sizeof(float) + + NumWgtIdx() * sizeof(uint32_t) + NumNorm() * sizeof(hsVector3); case kColor2: return base + NumPos() * sizeof(hsPoint3) - + NumWeights() * sizeof(hsScalar) - + NumWgtIdx() * sizeof(UInt32) + + NumWeights() * sizeof(float) + + NumWgtIdx() * sizeof(uint32_t) + NumNorm() * sizeof(hsVector3) - + NumColor() * sizeof(UInt32); + + NumColor() * sizeof(uint32_t); case kUVW: return base + NumPos() * sizeof(hsPoint3) - + NumWeights() * sizeof(hsScalar) - + NumWgtIdx() * sizeof(UInt32) + + NumWeights() * sizeof(float) + + NumWgtIdx() * sizeof(uint32_t) + NumNorm() * sizeof(hsVector3) - + NumColor() * sizeof(UInt32) - + NumColor2() * sizeof(UInt32) + + NumColor() * sizeof(uint32_t) + + NumColor2() * sizeof(uint32_t) + j * sizeof(hsPoint3); } hsAssert(false, "Unrecognized vertex channel"); @@ -240,7 +240,7 @@ public: return false; } - void Alloc(UInt16 format, UInt32 numVerts, UInt32 numTris); + void Alloc(uint16_t format, uint32_t numVerts, uint32_t numTris); void DeAlloc(); void Read(hsStream* s); diff --git a/Sources/Plasma/PubUtilLib/plDrawable/plSpanTypes.cpp b/Sources/Plasma/PubUtilLib/plDrawable/plSpanTypes.cpp index 1bd75b70..7d628af0 100644 --- a/Sources/Plasma/PubUtilLib/plDrawable/plSpanTypes.cpp +++ b/Sources/Plasma/PubUtilLib/plDrawable/plSpanTypes.cpp @@ -49,7 +49,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // // ////////////////////////////////////////////////////////////////////////////// -#include "hsTypes.h" +#include "HeadSpin.h" #include "plSpanTypes.h" #include "hsStream.h" #include "pnKeyedObject/plKey.h" @@ -68,7 +68,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com void plSpan::Read( hsStream *stream ) { - fSubType = (UInt16)(stream->ReadLE32()); + fSubType = (uint16_t)(stream->ReadLE32()); fFogEnvironment = nil; fMaterialIdx = stream->ReadLE32(); @@ -78,7 +78,7 @@ void plSpan::Read( hsStream *stream ) fLocalBounds.Read( stream ); fWorldBounds.Read( stream ); - fNumMatrices = (UInt8)(stream->ReadLE32()); + fNumMatrices = (uint8_t)(stream->ReadLE32()); fBaseMatrix = stream->ReadLE32(); fLocalUVWChans = stream->ReadLE16(); @@ -172,11 +172,11 @@ void plSpan::RemovePermaLight(plLightInfo* li, hsBool proj) //// AddLight //////////////////////////////////////////////////////////////// // Smart function for maintaining the sorted list of lights for a plSpan. -void plSpan::AddLight( plLightInfo *li, hsScalar strength, hsScalar scale, hsBool proj ) const +void plSpan::AddLight( plLightInfo *li, float strength, float scale, hsBool proj ) const { hsTArray& lights = proj ? fProjectors : fLights; - hsTArray& strengths = proj ? fProjStrengths : fLightStrengths; - hsTArray& scales = proj ? fProjScales : fLightScales; + hsTArray& strengths = proj ? fProjStrengths : fLightStrengths; + hsTArray& scales = proj ? fProjScales : fLightScales; int i; @@ -187,7 +187,7 @@ void plSpan::AddLight( plLightInfo *li, hsScalar strength, hsScalar scale, hs } lights.Insert(i, li); strengths.Insert(i, strength); - scales.Insert(i, hsScalar(UInt32(scale * 127.9f)) / 127.f); + scales.Insert(i, float(uint32_t(scale * 127.9f)) / 127.f); } void plSpan::ClearLights() const @@ -266,14 +266,14 @@ hsBool plSpan::CanMergeInto( plSpan *other ) { if( !HSMemory::EqualBlocks(fLights.AcquireArray(), other->fLights.AcquireArray(), fLights.GetCount() * sizeof(plLightInfo*)) ) return false; - if( !HSMemory::EqualBlocks(fLightScales.AcquireArray(), other->fLightScales.AcquireArray(), fLights.GetCount() * sizeof(hsScalar)) ) + if( !HSMemory::EqualBlocks(fLightScales.AcquireArray(), other->fLightScales.AcquireArray(), fLights.GetCount() * sizeof(float)) ) return false; } if( fProjectors.GetCount() ) { if( !HSMemory::EqualBlocks(fProjectors.AcquireArray(), other->fProjectors.AcquireArray(), fProjectors.GetCount() * sizeof(plLightInfo*)) ) return false; - if( !HSMemory::EqualBlocks(fProjScales.AcquireArray(), other->fProjScales.AcquireArray(), fProjectors.GetCount() * sizeof(hsScalar)) ) + if( !HSMemory::EqualBlocks(fProjScales.AcquireArray(), other->fProjScales.AcquireArray(), fProjectors.GetCount() * sizeof(float)) ) return false; } @@ -301,7 +301,7 @@ plSpan::plSpan() { fTypeMask = kSpan; fSubType = plDrawable::kSubNormal; - fMaterialIdx = (UInt32)-1; + fMaterialIdx = (uint32_t)-1; fFogEnvironment = nil; fProps = 0; @@ -345,10 +345,10 @@ void plSpan::Destroy() plVertexSpan::plVertexSpan() { fTypeMask |= kVertexSpan; - fGroupIdx = (UInt32)-1; - fVBufferIdx = (UInt32)-1; - fCellIdx = (UInt32)-1; - fCellOffset = (UInt32)-1; + fGroupIdx = (uint32_t)-1; + fVBufferIdx = (uint32_t)-1; + fCellIdx = (uint32_t)-1; + fCellOffset = (uint32_t)-1; } void plVertexSpan::Read( hsStream* stream ) @@ -432,7 +432,7 @@ void plIcicle::Read( hsStream *stream ) int i; - fSortData = TRACKED_NEW plGBufferTriangle[ fILength / 3 ]; + fSortData = new plGBufferTriangle[ fILength / 3 ]; for( i = 0; i < fILength / 3; i++ ) fSortData[ i ].Read( stream ); } diff --git a/Sources/Plasma/PubUtilLib/plDrawable/plSpanTypes.h b/Sources/Plasma/PubUtilLib/plDrawable/plSpanTypes.h index c824ee7e..fbb46aad 100644 --- a/Sources/Plasma/PubUtilLib/plDrawable/plSpanTypes.h +++ b/Sources/Plasma/PubUtilLib/plDrawable/plSpanTypes.h @@ -121,26 +121,26 @@ class plSpan kParticleSet = 0x10 }; - UInt16 fTypeMask; // For safe casting. Or it with the type you want to cast to, don't check equality - UInt16 fSubType; // Or'ed from plDrawable::plDrawableSubType - UInt32 fMaterialIdx; // Index into drawable's material array + uint16_t fTypeMask; // For safe casting. Or it with the type you want to cast to, don't check equality + uint16_t fSubType; // Or'ed from plDrawable::plDrawableSubType + uint32_t fMaterialIdx; // Index into drawable's material array hsMatrix44 fLocalToWorld; hsMatrix44 fWorldToLocal; - UInt32 fBaseMatrix; - UInt8 fNumMatrices; - UInt16 fLocalUVWChans; - UInt16 fMaxBoneIdx; - UInt16 fPenBoneIdx; - UInt32 fProps; + uint32_t fBaseMatrix; + uint8_t fNumMatrices; + uint16_t fLocalUVWChans; + uint16_t fMaxBoneIdx; + uint16_t fPenBoneIdx; + uint32_t fProps; hsBounds3Ext fLocalBounds; hsBounds3Ext fWorldBounds; plFogEnvironment *fFogEnvironment; // Use setter/getters below. - hsScalar fMinDist; - hsScalar fMaxDist; + float fMinDist; + float fMaxDist; - hsScalar fWaterHeight; + float fWaterHeight; hsBitVector fVisSet; hsBitVector fVisNot; @@ -149,11 +149,11 @@ class plSpan // mutable hsBitVector fLightBits; mutable hsTArray fLights; - mutable hsTArray fLightStrengths; - mutable hsTArray fLightScales; + mutable hsTArray fLightStrengths; + mutable hsTArray fLightScales; mutable hsTArray fProjectors; - mutable hsTArray fProjStrengths; - mutable hsTArray fProjScales; + mutable hsTArray fProjStrengths; + mutable hsTArray fProjScales; mutable hsBitVector fShadowBits; mutable hsBitVector fShadowSlaveBits; @@ -172,27 +172,27 @@ class plSpan const hsBitVector& GetShadowSlaves() const { return fShadowSlaveBits; } void AddShadowSlave(int iSlave) const { fShadowSlaveBits.SetBit(iSlave); } - void SetShadowBit(UInt32 idx) const { fShadowBits.SetBit(idx); } + void SetShadowBit(uint32_t idx) const { fShadowBits.SetBit(idx); } void ClearShadowBits() const { fShadowBits.Clear(); } - hsBool IsShadowBitSet(UInt32 idx) const { return fShadowBits.IsBitSet(idx); } + hsBool IsShadowBitSet(uint32_t idx) const { return fShadowBits.IsBitSet(idx); } void ClearLights() const; - void AddLight( plLightInfo* li, hsScalar strength, hsScalar scale, hsBool proj ) const; + void AddLight( plLightInfo* li, float strength, float scale, hsBool proj ) const; hsTArray& GetLightList(hsBool proj) const { return proj ? fProjectors : fLights; } - UInt32 GetNumLights(hsBool proj) const { return proj ? fProjectors.GetCount() : fLights.GetCount(); } + uint32_t GetNumLights(hsBool proj) const { return proj ? fProjectors.GetCount() : fLights.GetCount(); } plLightInfo* GetLight(int i, hsBool proj) const { return proj ? fProjectors[i] : fLights[i]; } - hsScalar GetLightStrength(int i, hsBool proj) const { return proj ? fProjStrengths[i] : fLightStrengths[i]; } - hsScalar GetLightScale(int i, hsBool proj) const { return proj ? fProjScales[i] : fLightScales[i]; } + float GetLightStrength(int i, hsBool proj) const { return proj ? fProjStrengths[i] : fLightStrengths[i]; } + float GetLightScale(int i, hsBool proj) const { return proj ? fProjScales[i] : fLightScales[i]; } void AddPermaLight(plLightInfo* li, hsBool proj); void RemovePermaLight(plLightInfo* li, hsBool proj); const hsBitVector& GetVisSet() const { return fVisSet; } const hsBitVector& GetVisNot() const { return fVisNot; } - void SetVisBit(UInt32 w, hsBool on) { fVisSet.SetBit(w, on); } - void SetVisNot(UInt32 w, hsBool on) { fVisNot.SetBit(w, on); } + void SetVisBit(uint32_t w, hsBool on) { fVisSet.SetBit(w, on); } + void SetVisNot(uint32_t w, hsBool on) { fVisNot.SetBit(w, on); } void RemoveAuxSpan(plAuxSpan* aux); void AddAuxSpan(plAuxSpan* aux); @@ -206,10 +206,10 @@ class plSpan virtual void MergeInto( plSpan* other ); virtual void Destroy( void ); - void SetMinDist(hsScalar minDist) { fMinDist = minDist; } - void SetMaxDist(hsScalar maxDist) { fMaxDist = maxDist; } - hsScalar GetMinDist() const { return fMinDist; } - hsScalar GetMaxDist() const { return fMaxDist; } + void SetMinDist(float minDist) { fMinDist = minDist; } + void SetMaxDist(float maxDist) { fMaxDist = maxDist; } + float GetMinDist() const { return fMinDist; } + float GetMaxDist() const { return fMaxDist; } }; //// plVertexSpan Definition @@ -220,13 +220,13 @@ class plVertexSpan : public plSpan public: // Stuff internal - UInt32 fGroupIdx; // Which buffer group, i.e. which vertex format + uint32_t fGroupIdx; // Which buffer group, i.e. which vertex format - UInt32 fVBufferIdx; // Which vertex buffer in group - UInt32 fCellIdx; // Cell index inside the vertex buffer - UInt32 fCellOffset; // Offset inside the cell - UInt32 fVStartIdx; // Start vertex # in the actual interlaced buffer - UInt32 fVLength; // Length of this span in the buffer + uint32_t fVBufferIdx; // Which vertex buffer in group + uint32_t fCellIdx; // Cell index inside the vertex buffer + uint32_t fCellOffset; // Offset inside the cell + uint32_t fVStartIdx; // Start vertex # in the actual interlaced buffer + uint32_t fVLength; // Length of this span in the buffer plVertexSpan(); @@ -244,13 +244,13 @@ class plIcicle : public plVertexSpan { public: - UInt32 fIBufferIdx; // Which index buffer in group - UInt32 fIStartIdx; // Redundant, since all spans are contiguous. Here for debugging - UInt32 fILength; // Length of this span in the buffer + uint32_t fIBufferIdx; // Which index buffer in group + uint32_t fIStartIdx; // Redundant, since all spans are contiguous. Here for debugging + uint32_t fILength; // Length of this span in the buffer // The index into the indexbuffer ref. This can be different from fIStartIdx if spans get // culled, then we pack the non-culled index spans into the beginning of the index buffer ref, // so we can still put them all out with a single DIP call. - mutable UInt32 fIPackedIdx; + mutable uint32_t fIPackedIdx; // Run-time-only stuff plGBufferTriangle *fSortData; // Indices & center points for sorting tris in this span (optional) @@ -277,9 +277,9 @@ class plParticleSpan : public plIcicle public: plParticleEmitter* fSource; // Source emitter, used to get array of plParticleCores - UInt32 fNumParticles; - UInt32 fSortCount; - UInt32 fSrcSpanIdx; + uint32_t fNumParticles; + uint32_t fSortCount; + uint32_t fSrcSpanIdx; plParticleSet* fParentSet; @@ -301,27 +301,27 @@ class plParticleSet { public: - UInt32 fRefCount; // Delete if this gets to 0 - UInt32 fDIEntry; // Our false DIIndices entry index + uint32_t fRefCount; // Delete if this gets to 0 + uint32_t fDIEntry; // Our false DIIndices entry index - UInt32 fGroupIdx; // Which buffer group, i.e. which vertex format - UInt8 fFormat; + uint32_t fGroupIdx; // Which buffer group, i.e. which vertex format + uint8_t fFormat; - UInt32 fVBufferIdx; - UInt32 fCellIdx; - UInt32 fCellOffset; - UInt32 fVStartIdx; - UInt32 fVLength; // Total v.b. length that all the icicles can take up UInt32 fIBufferIdx; - UInt32 fIBufferIdx; - UInt32 fIStartIdx; // Start index buffer position - UInt32 fILength; // Total i.b. length that all the icicles can take up + uint32_t fVBufferIdx; + uint32_t fCellIdx; + uint32_t fCellOffset; + uint32_t fVStartIdx; + uint32_t fVLength; // Total v.b. length that all the icicles can take up uint32_t fIBufferIdx; + uint32_t fIBufferIdx; + uint32_t fIStartIdx; // Start index buffer position + uint32_t fILength; // Total i.b. length that all the icicles can take up - UInt32 fNumSpans; + uint32_t fNumSpans; hsGMaterial* fMaterial; - UInt32 fNextVStartIdx; - UInt32 fNextCellOffset; - UInt32 fNextIStartIdx; + uint32_t fNextVStartIdx; + uint32_t fNextCellOffset; + uint32_t fNextIStartIdx; plParticleSet(); ~plParticleSet(); diff --git a/Sources/Plasma/PubUtilLib/plDrawable/plTimedInterp.h b/Sources/Plasma/PubUtilLib/plDrawable/plTimedInterp.h index ddebde35..a0a5ba3c 100644 --- a/Sources/Plasma/PubUtilLib/plDrawable/plTimedInterp.h +++ b/Sources/Plasma/PubUtilLib/plDrawable/plTimedInterp.h @@ -57,7 +57,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // Requires class T to have the following members // T& operator+=(const class T& t); // T& operator-=(const class T& t); -// T& operator*=(hsScalar scale); +// T& operator*=(float scale); // T& operator=(const class T&); // unless builtin = is adequate. // template class plTimedInterp @@ -72,7 +72,7 @@ protected: const T& IEnd(); const T& IBegin(); - const T& IEval(hsScalar parm); + const T& IEval(float parm); public: plTimedInterp(); plTimedInterp(const T& t); @@ -110,7 +110,7 @@ plTimedInterp::Update(double t) if( fDuration <= 0 ) return IEnd(); - hsScalar parm = hsScalar((fEnd - t) / fDuration); + float parm = float((fEnd - t) / fDuration); if( parm <= 0 ) return IEnd(); else if( parm >= 1.f ) @@ -150,7 +150,7 @@ plTimedInterp::IBegin() template const T& -plTimedInterp::IEval(hsScalar parm) +plTimedInterp::IEval(float parm) { fCurr = fInit; fCurr -= fTarg; diff --git a/Sources/Plasma/PubUtilLib/plDrawable/plVisLOSMgr.cpp b/Sources/Plasma/PubUtilLib/plDrawable/plVisLOSMgr.cpp index 2da834f9..45b81ee2 100644 --- a/Sources/Plasma/PubUtilLib/plDrawable/plVisLOSMgr.cpp +++ b/Sources/Plasma/PubUtilLib/plDrawable/plVisLOSMgr.cpp @@ -40,7 +40,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "hsBounds.h" #include "hsFastMath.h" @@ -84,7 +84,7 @@ hsBool plVisLOSMgr::ICheckSpaceTreeRecur(plSpaceTree* space, int which, hsTArray if( node.fFlags & plSpaceTreeNode::kDisabled ) return false; - hsScalar closest; + float closest; // If it's a hit if( ICheckBound(node.fWorldBounds, closest) ) { @@ -149,7 +149,7 @@ hsBool plVisLOSMgr::ISetup(const hsPoint3& pStart, const hsPoint3& pEnd) fMaxDist = hsVector3(&fCurrTarg, &fCurrFrom).Magnitude(); - const hsScalar kMinMaxDist(0); + const float kMinMaxDist(0); return fMaxDist > kMinMaxDist; } @@ -245,7 +245,7 @@ hsBool plVisLOSMgr::ICheckDrawable(plDrawable* d, plVisHit& hit) return retVal; } -hsBool plVisLOSMgr::ICheckSpan(plDrawableSpans* dr, UInt32 spanIdx, plVisHit& hit) +hsBool plVisLOSMgr::ICheckSpan(plDrawableSpans* dr, uint32_t spanIdx, plVisHit& hit) { if( !(dr->GetSpan(spanIdx)->fTypeMask & plSpan::kIcicleSpan) ) return false; @@ -263,7 +263,7 @@ hsBool plVisLOSMgr::ICheckSpan(plDrawableSpans* dr, UInt32 spanIdx, plVisHit& hi hsPoint3 currTarg = src.GetWorldToLocal() * fCurrTarg; hsVector3 currDir(&currTarg, &currFrom); - hsScalar maxDist = currDir.Magnitude(); + float maxDist = currDir.Magnitude(); currDir /= maxDist; @@ -272,9 +272,9 @@ hsBool plVisLOSMgr::ICheckSpan(plDrawableSpans* dr, UInt32 spanIdx, plVisHit& hi { // Project the current ray onto the tri plane hsVector3 norm = hsVector3(&tri.Position(1), &tri.Position(0)) % hsVector3(&tri.Position(2), &tri.Position(0)); - hsScalar dotNorm = norm.InnerProduct(currDir); + float dotNorm = norm.InnerProduct(currDir); - const hsScalar kMinDotNorm = 1.e-3f; + const float kMinDotNorm = 1.e-3f; if( dotNorm >= -kMinDotNorm ) { if( !twoSided ) @@ -282,7 +282,7 @@ hsBool plVisLOSMgr::ICheckSpan(plDrawableSpans* dr, UInt32 spanIdx, plVisHit& hi if( dotNorm <= kMinDotNorm ) continue; } - hsScalar dist = hsVector3(&tri.Position(0), &currFrom).InnerProduct(norm); + float dist = hsVector3(&tri.Position(0), &currFrom).InnerProduct(norm); if( dist > 0 ) continue; dist /= dotNorm; @@ -295,13 +295,13 @@ hsBool plVisLOSMgr::ICheckSpan(plDrawableSpans* dr, UInt32 spanIdx, plVisHit& hi // Find the 3 cross products (v[i+1]-v[i]) X (proj - v[i]) dotted with current ray hsVector3 cross0 = hsVector3(&tri.Position(1), &tri.Position(0)) % hsVector3(&projPt, &tri.Position(0)); - hsScalar dot0 = cross0.InnerProduct(currDir); + float dot0 = cross0.InnerProduct(currDir); hsVector3 cross1 = hsVector3(&tri.Position(2), &tri.Position(1)) % hsVector3(&projPt, &tri.Position(1)); - hsScalar dot1 = cross1.InnerProduct(currDir); + float dot1 = cross1.InnerProduct(currDir); hsVector3 cross2 = hsVector3(&tri.Position(0), &tri.Position(2)) % hsVector3(&projPt, &tri.Position(2)); - hsScalar dot2 = cross2.InnerProduct(currDir); + float dot2 = cross2.InnerProduct(currDir); // If all 3 are negative, projPt is a hit // If all 3 are positive and we're two sided, projPt is a hit @@ -330,7 +330,7 @@ hsBool plVisLOSMgr::ICheckSpan(plDrawableSpans* dr, UInt32 spanIdx, plVisHit& hi return retVal; } -hsBool plVisLOSMgr::ICheckBound(const hsBounds3Ext& bnd, hsScalar& closest) +hsBool plVisLOSMgr::ICheckBound(const hsBounds3Ext& bnd, float& closest) { if( bnd.GetType() != kBoundsNormal ) return false; @@ -360,7 +360,7 @@ hsBool plVisLOSMgr::ICheckBound(const hsBounds3Ext& bnd, hsScalar& closest) const hsPoint3& currTarg = fCurrTarg; hsVector3 currDir(&currTarg, &currFrom); - const hsScalar maxDistSq = currDir.MagnitudeSquared(); + const float maxDistSq = currDir.MagnitudeSquared(); currDir *= hsFastMath::InvSqrt(maxDistSq); @@ -374,14 +374,14 @@ hsBool plVisLOSMgr::ICheckBound(const hsBounds3Ext& bnd, hsScalar& closest) // Project the current ray onto the tri plane hsVector3 norm = hsVector3(&p1, &p0) % hsVector3(&p2, &p0); - hsScalar dotNorm = norm.InnerProduct(currDir); + float dotNorm = norm.InnerProduct(currDir); - const hsScalar kMinDotNorm = 1.e-3f; + const float kMinDotNorm = 1.e-3f; if( dotNorm >= -kMinDotNorm ) { continue; } - hsScalar dist = hsVector3(&p0, &currFrom).InnerProduct(norm); + float dist = hsVector3(&p0, &currFrom).InnerProduct(norm); if( dist >= 0 ) continue; dist /= dotNorm; @@ -395,16 +395,16 @@ hsBool plVisLOSMgr::ICheckBound(const hsBounds3Ext& bnd, hsScalar& closest) // Find the 3 cross products (v[i+1]-v[i]) X (proj - v[i]) dotted with current ray hsVector3 cross0 = hsVector3(&p1, &p0) % hsVector3(&projPt, &p0); - hsScalar dot0 = cross0.InnerProduct(currDir); + float dot0 = cross0.InnerProduct(currDir); hsVector3 cross1 = hsVector3(&p2, &p1) % hsVector3(&projPt, &p1); - hsScalar dot1 = cross1.InnerProduct(currDir); + float dot1 = cross1.InnerProduct(currDir); hsVector3 cross2 = hsVector3(&p3, &p2) % hsVector3(&projPt, &p2); - hsScalar dot2 = cross2.InnerProduct(currDir); + float dot2 = cross2.InnerProduct(currDir); hsVector3 cross3 = hsVector3(&p0, &p3) % hsVector3(&projPt, &p3); - hsScalar dot3 = cross3.InnerProduct(currDir); + float dot3 = cross3.InnerProduct(currDir); // If all 4 are negative, projPt is a hit if( (dot0 <= 0) && (dot1 <= 0) && (dot2 <= 0) && (dot3 <= 0) ) @@ -418,11 +418,11 @@ hsBool plVisLOSMgr::ICheckBound(const hsBounds3Ext& bnd, hsScalar& closest) hsBool plVisLOSMgr::CursorCheck(plVisHit& hit) { - Int32 sx= Int32(plMouseDevice::Instance()->GetCursorX() * fPipe->Width()); - Int32 sy= Int32(plMouseDevice::Instance()->GetCursorY() * fPipe->Height()); + int32_t sx= int32_t(plMouseDevice::Instance()->GetCursorX() * fPipe->Width()); + int32_t sy= int32_t(plMouseDevice::Instance()->GetCursorY() * fPipe->Height()); hsPoint3 from = fPipe->GetViewPositionWorld(); - plConst(hsScalar) dist(1.e5f); + plConst(float) dist(1.e5f); hsPoint3 targ; fPipe->ScreenToWorldPoint(1, 0, &sx, &sy, dist, 0, &targ); diff --git a/Sources/Plasma/PubUtilLib/plDrawable/plVisLOSMgr.h b/Sources/Plasma/PubUtilLib/plDrawable/plVisLOSMgr.h index 994d17f9..ec76ce52 100644 --- a/Sources/Plasma/PubUtilLib/plDrawable/plVisLOSMgr.h +++ b/Sources/Plasma/PubUtilLib/plDrawable/plVisLOSMgr.h @@ -65,7 +65,7 @@ class plSpaceHit { public: int fIdx; - hsScalar fClosest; + float fClosest; }; class plVisLOSMgr @@ -74,18 +74,18 @@ protected: plPageTreeMgr* fPageMgr; plPipeline* fPipe; - hsScalar fMaxDist; + float fMaxDist; hsPoint3 fCurrFrom; hsPoint3 fCurrTarg; hsBool ISetup(const hsPoint3& pStart, const hsPoint3& pEnd); - hsBool ICheckBound(const hsBounds3Ext& bnd, hsScalar& closest); + hsBool ICheckBound(const hsBounds3Ext& bnd, float& closest); hsBool ICheckSpaceTreeRecur(plSpaceTree* space, int which, hsTArray& hits); hsBool ICheckSpaceTree(plSpaceTree* space, hsTArray& hits); hsBool ICheckSceneNode(plSceneNode* node, plVisHit& hit); hsBool ICheckDrawable(plDrawable* d, plVisHit& hit); - hsBool ICheckSpan(plDrawableSpans* dr, UInt32 spanIdx, plVisHit& hit); + hsBool ICheckSpan(plDrawableSpans* dr, uint32_t spanIdx, plVisHit& hit); public: hsBool Check(const hsPoint3& pStart, const hsPoint3& pEnd, plVisHit& hit); diff --git a/Sources/Plasma/PubUtilLib/plDrawable/plWaveSet7.cpp b/Sources/Plasma/PubUtilLib/plDrawable/plWaveSet7.cpp index 3928916b..e24c137a 100644 --- a/Sources/Plasma/PubUtilLib/plDrawable/plWaveSet7.cpp +++ b/Sources/Plasma/PubUtilLib/plDrawable/plWaveSet7.cpp @@ -40,7 +40,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "hsFastMath.h" #include "hsTimer.h" @@ -115,29 +115,29 @@ using namespace plShaderID; // #define TEST_UVWS -static const hsScalar kPiOverTwo = hsScalarPI * 0.5f; +static const float kPiOverTwo = M_PI * 0.5f; -static const hsScalar kGravConst = 30.f; +static const float kGravConst = 30.f; -static const hsScalar kOOEightNsqPI = 1.f / (8.f * hsScalarPI * 4.f * 4.f); -static hsScalar currOOEightNsqPI = kOOEightNsqPI; +static const float kOOEightNsqPI = 1.f / (8.f * M_PI * 4.f * 4.f); +static float currOOEightNsqPI = kOOEightNsqPI; -static inline hsScalar FreqToLen(hsScalar f) { return 2.f * hsScalarPI / f; } -static inline hsScalar LenToFreq(hsScalar l) { return 2.f * hsScalarPI / l; } +static inline float FreqToLen(float f) { return 2.f * M_PI / f; } +static inline float LenToFreq(float l) { return 2.f * M_PI / l; } -static inline hsScalar MPH2FPS(hsScalar f) { return f * 5280.f / 3600.f; } -static inline hsScalar FPS2MPH(hsScalar f) { return f / 5280.f * 3600.f; } +static inline float MPH2FPS(float f) { return f * 5280.f / 3600.f; } +static inline float FPS2MPH(float f) { return f / 5280.f * 3600.f; } -plCONST(hsScalar) kTimeClamp(0.3f); +plCONST(float) kTimeClamp(0.3f); inline void plWorldWave7::Accumulate(hsPoint3& accumPos, hsVector3& accumNorm) const { - hsScalar dist = accumPos.fX * fDir.fX + accumPos.fY * fDir.fY; + float dist = accumPos.fX * fDir.fX + accumPos.fY * fDir.fY; dist *= fFreq; dist += fPhase; - hsScalar s, c; + float s, c; hsFastMath::SinCosAppr(dist, s, c); // s += 1.f; @@ -153,12 +153,12 @@ inline void plWorldWave7::Accumulate(hsPoint3& accumPos, hsVector3& accumNorm) c } #ifndef PLASMA_EXTERNAL_RELEASE -inline void plWaveSet7::GraphLen(hsScalar len) const +inline void plWaveSet7::GraphLen(float len) const { if( fStatusGraph ) { - hsScalar maxLen = TexState().fMaxLength * kCompositeSize / State().fRippleScale; - Int32 val = Int32(len / maxLen * 100.f); + float maxLen = TexState().fMaxLength * kCompositeSize / State().fRippleScale; + int32_t val = int32_t(len / maxLen * 100.f); fStatusGraph->AddData(val); } } @@ -196,7 +196,7 @@ inline void plWaveSet7::LogF(const char *format, ...) const } } -inline void plWaveSet7::LogF(UInt32 color, const char *format, ...) const +inline void plWaveSet7::LogF(uint32_t color, const char *format, ...) const { if( fStatusLog ) { @@ -226,7 +226,7 @@ void plWaveSet7::StopLog() fStatusLog = nil; } #else // PLASMA_EXTERNAL_RELEASE -inline void plWaveSet7::GraphLen(hsScalar len) const +inline void plWaveSet7::GraphLen(float len) const { } @@ -246,7 +246,7 @@ inline void plWaveSet7::LogF(const char *format, ...) const { } -inline void plWaveSet7::LogF(UInt32 color, const char *format, ...) const +inline void plWaveSet7::LogF(uint32_t color, const char *format, ...) const { } @@ -375,18 +375,18 @@ void plWaveSet7::Read(hsStream* stream, hsResMgr* mgr) int i; for( i = 0; i < n; i++ ) { - mgr->ReadKeyNotifyMe(stream, TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnCreate, -1, kRefShore), plRefFlags::kPassiveRef); + mgr->ReadKeyNotifyMe(stream, new plGenRefMsg(GetKey(), plRefMsg::kOnCreate, -1, kRefShore), plRefFlags::kPassiveRef); } n = stream->ReadLE32(); for( i = 0; i < n; i++ ) { - mgr->ReadKeyNotifyMe(stream, TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnCreate, -1, kRefDecal), plRefFlags::kPassiveRef); + mgr->ReadKeyNotifyMe(stream, new plGenRefMsg(GetKey(), plRefMsg::kOnCreate, -1, kRefDecal), plRefFlags::kPassiveRef); } - mgr->ReadKeyNotifyMe(stream, TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnCreate, -1, kRefEnvMap), plRefFlags::kActiveRef); + mgr->ReadKeyNotifyMe(stream, new plGenRefMsg(GetKey(), plRefMsg::kOnCreate, -1, kRefEnvMap), plRefFlags::kActiveRef); if( HasFlag(kHasRefObject) ) { - mgr->ReadKeyNotifyMe(stream, TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnCreate, -1, kRefRefObj), plRefFlags::kPassiveRef); + mgr->ReadKeyNotifyMe(stream, new plGenRefMsg(GetKey(), plRefMsg::kOnCreate, -1, kRefRefObj), plRefFlags::kPassiveRef); } ISetupTextureWaves(); @@ -456,7 +456,7 @@ hsBool plWaveSet7::MsgReceive(plMessage* msg) } } - hsScalar dt = update->DelSeconds(); + float dt = update->DelSeconds(); if( dt > kTimeClamp ) dt = kTimeClamp; @@ -474,7 +474,7 @@ hsBool plWaveSet7::MsgReceive(plMessage* msg) fCurrTime = hsTimer::GetSysSeconds(); // Can't just use GetDelSysSeconds() or else we lose time if we skip a frame render because of high FPS. - hsScalar dt = fLastTime > 0 ? hsScalar(fCurrTime - fLastTime) : hsTimer::GetDelSysSeconds(); + float dt = fLastTime > 0 ? float(fCurrTime - fLastTime) : hsTimer::GetDelSysSeconds(); if( dt > kTimeClamp ) dt = kTimeClamp; @@ -753,7 +753,7 @@ hsBool plWaveSet7::IOnRemove(plGenRefMsg* refMsg) return false; } -void plWaveSet7::SetState(const plFixedWaterState7& state, hsScalar dur) +void plWaveSet7::SetState(const plFixedWaterState7& state, float dur) { fState.Set(state, dur); @@ -764,7 +764,7 @@ void plWaveSet7::SetState(const plFixedWaterState7& state, hsScalar dur) } } -void plWaveSet7::IUpdateWaves(hsScalar dt) +void plWaveSet7::IUpdateWaves(float dt) { ITransition(dt); ITransTex(dt); @@ -786,9 +786,9 @@ void plWaveSet7::IUpdateWaves(hsScalar dt) } // return true if we've finished this transition. -hsBool plWaveSet7::ITransContinue(hsScalar dt) +hsBool plWaveSet7::ITransContinue(float dt) { - hsScalar currFade = (fFreqMod[fTransistor] += fTransDel * dt); + float currFade = (fFreqMod[fTransistor] += fTransDel * dt); if( currFade <= 0 ) { @@ -814,24 +814,24 @@ hsBool plWaveSet7::ITransContinue(hsScalar dt) return false; } -void plWaveSet7::IStartTransition(hsScalar dt) +void plWaveSet7::IStartTransition(float dt) { // select the next wave for transitioning if( ++fTransistor >= kNumWaves ) fTransistor = 0; // set the transFade to be fading down. - plCONST(hsScalar) kTransDel(0.5f); + plCONST(float) kTransDel(0.5f); fTransDel = -kTransDel; } -hsScalar plWaveSet7::ITransitionDelay() const +float plWaveSet7::ITransitionDelay() const { - plCONST(hsScalar) kTransDelay(2.f); + plCONST(float) kTransDelay(2.f); return kTransDelay; } -void plWaveSet7::ITransition(hsScalar dt) +void plWaveSet7::ITransition(float dt) { // If we're in a transition, keep transitioning till it's done. if( fTransDel != 0 ) @@ -847,9 +847,9 @@ void plWaveSet7::ITransition(hsScalar dt) } -hsBool plWaveSet7::ITransTexContinue(hsScalar dt) +hsBool plWaveSet7::ITransTexContinue(float dt) { - hsScalar currFade = (fTexWaveFade[fTexTrans] += fTexTransDel * dt); + float currFade = (fTexWaveFade[fTexTrans] += fTexTransDel * dt); if( currFade <= 0 ) { @@ -875,22 +875,22 @@ hsBool plWaveSet7::ITransTexContinue(hsScalar dt) return false; } -void plWaveSet7::IStartTexTransition(hsScalar dt) +void plWaveSet7::IStartTexTransition(float dt) { if( ++fTexTrans >= kNumTexWaves ) fTexTrans = 0; - plConst(hsScalar) kTexTransDel(4.f); + plConst(float) kTexTransDel(4.f); fTexTransDel = -kTexTransDel; } -void plWaveSet7::ITransTex(hsScalar dt) +void plWaveSet7::ITransTex(float dt) { // If we're in a transition, keep with it. if( fTexTransDel != 0 ) { - plConst(hsScalar) kTexTransDelay(0); + plConst(float) kTexTransDelay(0); if( ITransTexContinue(dt) ) fTexTransCountDown = kTexTransDelay; } @@ -905,20 +905,20 @@ void plWaveSet7::ICalcScale() { } -void plWaveSet7::IUpdateWave(hsScalar dt, int i) +void plWaveSet7::IUpdateWave(float dt, int i) { plWorldWave7& wave = fWorldWaves[i]; - hsScalar len = FreqToLen(wave.fFreq); + float len = FreqToLen(wave.fFreq); - hsScalar speed = hsFastMath::InvSqrtAppr(len / (2.f * hsScalarPI * kGravConst)); + float speed = hsFastMath::InvSqrtAppr(len / (2.f * M_PI * kGravConst)); - static hsScalar speedHack = 1.f; + static float speedHack = 1.f; speed *= speedHack; wave.fPhase += speed * dt; -// wave.fPhase = fmod( speed * t, 2.f * hsScalarPI); +// wave.fPhase = fmod( speed * t, 2.f * M_PI); - hsScalar amp = GeoState().fAmpOverLen * len / hsScalar(kNumWaves); + float amp = GeoState().fAmpOverLen * len / float(kNumWaves); amp *= fFreqMod[i] * fFreqScale; @@ -945,7 +945,7 @@ void plWaveSet7::IInitWave(int i) wave.fLength = GeoState().fMinLength + fRand.RandZeroToOne() * (GeoState().fMaxLength - GeoState().fMinLength); - hsScalar len = wave.fLength; + float len = wave.fLength; wave.fFreq = LenToFreq(len); @@ -956,18 +956,18 @@ void plWaveSet7::IInitWave(int i) // Figure out the direction based on wind direction. // Even waves go in the wind direction, // odd waves go opposite direction - plConst(hsScalar) kMinRotDeg(15.f); - plConst(hsScalar) kMaxRotDeg(180.f); + plConst(float) kMinRotDeg(15.f); + plConst(float) kMaxRotDeg(180.f); hsVector3 dir = fWindDir; - hsScalar rotBase = GeoState().fAngleDev; + float rotBase = GeoState().fAngleDev; - hsScalar rads = rotBase * fRand.RandMinusOneToOne(); - hsScalar rx = hsScalar(cosf(rads)); - hsScalar ry = hsScalar(sinf(rads)); + float rads = rotBase * fRand.RandMinusOneToOne(); + float rx = float(cosf(rads)); + float ry = float(sinf(rads)); - hsScalar x = dir.fX; - hsScalar y = dir.fY; + float x = dir.fX; + float y = dir.fY; dir.fX = x * rx + y * ry; dir.fY = x * -ry + y * rx; @@ -985,7 +985,7 @@ inline void plWaveSet7::IScrunch(hsPoint3& pos, hsVector3& norm) const hsFastMath::NormalizeAppr(norm); } -hsScalar plWaveSet7::EvalPoint(hsPoint3& pos, hsVector3& norm) +float plWaveSet7::EvalPoint(hsPoint3& pos, hsVector3& norm) { hsPoint3 accumPos; hsVector3 accumNorm; @@ -1003,7 +1003,7 @@ hsScalar plWaveSet7::EvalPoint(hsPoint3& pos, hsVector3& norm) IScrunch(accumPos, accumNorm); // Project original pos along Z onto the plane tangent at accumPos with norm accumNorm - hsScalar t = hsVector3(&accumPos, &pos).InnerProduct(accumNorm); + float t = hsVector3(&accumPos, &pos).InnerProduct(accumNorm); t /= accumNorm.fZ; pos.fZ += t; @@ -1013,7 +1013,7 @@ hsScalar plWaveSet7::EvalPoint(hsPoint3& pos, hsVector3& norm) return pos.fZ; } -void plWaveSet7::IUpdateWindDir(hsScalar dt) +void plWaveSet7::IUpdateWindDir(float dt) { fWindDir = -State().fWindDir; hsFastMath::NormalizeAppr(fWindDir); @@ -1025,10 +1025,10 @@ void plWaveSet7::IUpdateRefObject() { hsMatrix44 l2w = fRefObj->GetLocalToWorld(); - hsScalar h = l2w.fMap[2][3]; + float h = l2w.fMap[2][3]; - hsScalar x = -l2w.fMap[0][1]; - hsScalar y = -l2w.fMap[1][1]; + float x = -l2w.fMap[0][1]; + float y = -l2w.fMap[1][1]; fState.fWaterHeight = h; @@ -1036,7 +1036,7 @@ void plWaveSet7::IUpdateRefObject() } } -void plWaveSet7::IFloatBuoy(hsScalar dt, plSceneObject* so) +void plWaveSet7::IFloatBuoy(float dt, plSceneObject* so) { // Compute force based on world bounds hsBounds3Ext wBnd = so->GetDrawInterface()->GetWorldBounds(); @@ -1052,8 +1052,8 @@ void plWaveSet7::IFloatBuoy(hsScalar dt, plSceneObject* so) // (in an approximation lazy hackish way). hsPoint2 boxDepth; wBnd.TestPlane(surfNorm, boxDepth); - hsScalar surfDepth = surfNorm.InnerProduct(surfPos); - hsScalar depth = surfDepth - boxDepth.fX; + float surfDepth = surfNorm.InnerProduct(surfPos); + float depth = surfDepth - boxDepth.fX; if( depth < 0 ) return; @@ -1063,12 +1063,12 @@ void plWaveSet7::IFloatBuoy(hsScalar dt, plSceneObject* so) // We really want the cross section area as facing into the water, // but life is full of little disappointments. - hsScalar area = (wBnd.GetMaxs().fX - wBnd.GetMins().fX) * (wBnd.GetMaxs().fY - wBnd.GetMins().fY); + float area = (wBnd.GetMaxs().fX - wBnd.GetMins().fX) * (wBnd.GetMaxs().fY - wBnd.GetMins().fY); - hsScalar volume = area * depth; + float volume = area * depth; - plCONST(hsScalar) kWaterDensity(1.0f); - hsScalar forceMag = volume * kWaterDensity; + plCONST(float) kWaterDensity(1.0f); + float forceMag = volume * kWaterDensity; // surfNorm is now the impulse vector. But where to apply it. // Don't currently have anything informative from the physical to use. @@ -1076,33 +1076,33 @@ void plWaveSet7::IFloatBuoy(hsScalar dt, plSceneObject* so) plKey physKey = so->GetSimulationInterface()->GetPhysical()->GetKey(); -// plImpulseMsg* iMsg = TRACKED_NEW plImpulseMsg(GetKey(), physKey, hsVector3(0, 0, 1.f) * forceMag * dt); +// plImpulseMsg* iMsg = new plImpulseMsg(GetKey(), physKey, hsVector3(0, 0, 1.f) * forceMag * dt); // iMsg->Send(); #if 0 - plCONST(hsScalar) kRotScale(1.f); + plCONST(float) kRotScale(1.f); hsVector3 rotAx = hsVector3(0, 0, 1.f) % surfNorm; rotAx *= kRotScale * dt * volume; - plAngularImpulseMsg* aMsg = TRACKED_NEW plAngularImpulseMsg(GetKey(), physKey, rotAx); + plAngularImpulseMsg* aMsg = new plAngularImpulseMsg(GetKey(), physKey, rotAx); aMsg->Send(); #endif - plCONST(hsScalar) kDampener(0.1f); - plCONST(hsScalar) kBaseDamp(0.1f); + plCONST(float) kDampener(0.1f); + plCONST(float) kBaseDamp(0.1f); if( wBnd.GetMaxs().fZ > wBnd.GetMins().fZ ) { // Remember, we've already limited depth to be <= Max.fZ - Min.fZ; - hsScalar damp = depth / (wBnd.GetMaxs().fZ - wBnd.GetMins().fZ); + float damp = depth / (wBnd.GetMaxs().fZ - wBnd.GetMins().fZ); damp *= kDampener; damp += kBaseDamp; -// plDampMsg* dMsg = TRACKED_NEW plDampMsg(GetKey(), physKey, damp); +// plDampMsg* dMsg = new plDampMsg(GetKey(), physKey, damp); // dMsg->Send(); } } -void plWaveSet7::IFloatBuoys(hsScalar dt) +void plWaveSet7::IFloatBuoys(float dt) { int i; for( i = 0; i < fBuoys.GetCount(); i++ ) @@ -1122,7 +1122,7 @@ void plWaveSet7::IShiftCenter(plSceneObject* so) const hsPoint3 center = so->GetDrawInterface()->GetWorldBounds().GetCenter(); hsPoint3 pos = so->GetLocalToWorld().GetTranslate(); hsVector3 offset(&pos, ¢er); -// plShiftMassMsg* msg = TRACKED_NEW plShiftMassMsg(GetKey(), so->GetSimulationInterface()->GetPhysical()->GetKey(), offset); +// plShiftMassMsg* msg = new plShiftMassMsg(GetKey(), so->GetSimulationInterface()->GetPhysical()->GetKey(), offset); // msg->Send(); } } @@ -1171,7 +1171,7 @@ void plWaveSet7::ICheckTargetMaterials() if( !fTargBnds.GetCount() ) fTargBnds.SetCount(1); - plConst(hsScalar) kMaxWaveHeight(5.f); + plConst(float) kMaxWaveHeight(5.f); hsPoint3 p; p = targBnd.GetMins(); @@ -1186,13 +1186,13 @@ void plWaveSet7::ICheckTargetMaterials() void plWaveSet7::IAddTarget(const plKey& key) { - plObjRefMsg* refMsg = TRACKED_NEW plObjRefMsg(key, plRefMsg::kOnRequest, -1, plObjRefMsg::kModifier); + plObjRefMsg* refMsg = new plObjRefMsg(key, plRefMsg::kOnRequest, -1, plObjRefMsg::kModifier); hsgResMgr::ResMgr()->AddViaNotify( GetKey(), refMsg, plRefFlags::kActiveRef); } void plWaveSet7::IRemoveTarget(const plKey& key) { - plObjRefMsg* refMsg = TRACKED_NEW plObjRefMsg(key, plRefMsg::kOnRemove, -1, plObjRefMsg::kModifier); + plObjRefMsg* refMsg = new plObjRefMsg(key, plRefMsg::kOnRemove, -1, plObjRefMsg::kModifier); refMsg->SetRef(this); refMsg->Send(); } @@ -1211,19 +1211,19 @@ void plWaveSet7::SetRefObject(plSceneObject* refObj) { fFlags.SetBit(kHasRefObject, refObj != nil); - plGenRefMsg* msg = TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnRequest, 0, kRefRefObj); + plGenRefMsg* msg = new plGenRefMsg(GetKey(), plRefMsg::kOnRequest, 0, kRefRefObj); hsgResMgr::ResMgr()->SendRef(refObj, msg, plRefFlags::kPassiveRef); } void plWaveSet7::AddBuoy(plKey soKey) { - plGenRefMsg* msg = TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnRequest, 0, kRefBuoy); + plGenRefMsg* msg = new plGenRefMsg(GetKey(), plRefMsg::kOnRequest, 0, kRefBuoy); hsgResMgr::ResMgr()->AddViaNotify(soKey, msg, plRefFlags::kPassiveRef); } void plWaveSet7::RemoveBuoy(plKey soKey) { - plGenRefMsg* msg = TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnRemove, 0, kRefBuoy); + plGenRefMsg* msg = new plGenRefMsg(GetKey(), plRefMsg::kOnRemove, 0, kRefBuoy); msg->SetRef(soKey->ObjectIsLoaded()); msg->Send(); } @@ -1239,39 +1239,39 @@ class plFilterMask { protected: int fExt; - hsScalar **fMask; + float **fMask; public: - plFilterMask( hsScalar sig ); + plFilterMask( float sig ); virtual ~plFilterMask(); int Begin() const { return -fExt; } int End() const { return fExt; } - hsScalar Mask( int i, int j ) const { return fMask[ i ][ j ]; } + float Mask( int i, int j ) const { return fMask[ i ][ j ]; } }; // End evil. void plWaveSet7::IInitState() { - plConst(hsScalar) kWaterTable(-10.f); - plConst(hsScalar) kWaterOffset[3] = { 3.f, 3.f, 0.f }; - plConst(hsScalar) kMaxAtten[3] = { 1.f, 1.f, 1.f }; - plConst(hsScalar) kMinAtten[3] = { 0.f, 0.f, 0.f }; - plConst(hsScalar) kDepthFalloff[3] = { 4.f, 4.f, 6.f }; + plConst(float) kWaterTable(-10.f); + plConst(float) kWaterOffset[3] = { 3.f, 3.f, 0.f }; + plConst(float) kMaxAtten[3] = { 1.f, 1.f, 1.f }; + plConst(float) kMinAtten[3] = { 0.f, 0.f, 0.f }; + plConst(float) kDepthFalloff[3] = { 4.f, 4.f, 6.f }; - plConst(hsScalar) kGeoMinLen(3.f); - plConst(hsScalar) kGeoMaxLen(8.f); - plConst(hsScalar) kGeoAmpOverLen(0.1f); - plConst(hsScalar) kGeoAngleDev(30.f * hsScalarPI / 180.f); - plConst(hsScalar) kGeoChop(1.f); + plConst(float) kGeoMinLen(3.f); + plConst(float) kGeoMaxLen(8.f); + plConst(float) kGeoAmpOverLen(0.1f); + plConst(float) kGeoAngleDev(30.f * M_PI / 180.f); + plConst(float) kGeoChop(1.f); - plConst(hsScalar) kTexMinLen(4.f); - plConst(hsScalar) kTexMaxLen(30.f); - plConst(hsScalar) kTexAmpOverLen(0.1f); - plConst(hsScalar) kTexAngleDev(30.f * hsScalarPI / 180.f); - plConst(hsScalar) kTexChop(1.f); + plConst(float) kTexMinLen(4.f); + plConst(float) kTexMaxLen(30.f); + plConst(float) kTexAmpOverLen(0.1f); + plConst(float) kTexAngleDev(30.f * M_PI / 180.f); + plConst(float) kTexChop(1.f); plFixedWaterState7 state; @@ -1291,9 +1291,9 @@ void plWaveSet7::IInitState() state.fRippleScale = 25.f; - plConst(hsScalar) kNoise(1.f); - plConst(hsScalar) kSpecStart(50.f); - plConst(hsScalar) kSpecEnd(10000.f); + plConst(float) kNoise(1.f); + plConst(float) kSpecStart(50.f); + plConst(float) kSpecEnd(10000.f); hsVector3 spec; spec[state.kNoise] = kNoise; @@ -1405,20 +1405,20 @@ void plWaveSet7::ISetupTextureWaves() void plWaveSet7::IInitTexWave(int i) { - hsScalar rads = fRand.RandMinusOneToOne() * TexState().fAngleDev; - hsScalar dx = sin(rads); - hsScalar dy = cos(rads); + float rads = fRand.RandMinusOneToOne() * TexState().fAngleDev; + float dx = sin(rads); + float dy = cos(rads); - hsScalar tx = dx; + float tx = dx; dx = fWindDir.fY * dx - fWindDir.fX * dy; dy = fWindDir.fX * tx + fWindDir.fY * dy; - hsScalar maxLen = TexState().fMaxLength * kCompositeSize / State().fRippleScale; - hsScalar minLen = TexState().fMinLength * kCompositeSize / State().fRippleScale; - hsScalar len = hsScalar(i) / hsScalar(kNumTexWaves-1) * (maxLen - minLen) + minLen; + float maxLen = TexState().fMaxLength * kCompositeSize / State().fRippleScale; + float minLen = TexState().fMinLength * kCompositeSize / State().fRippleScale; + float len = float(i) / float(kNumTexWaves-1) * (maxLen - minLen) + minLen; - hsScalar reps = hsScalar(kCompositeSize) / len; + float reps = float(kCompositeSize) / len; dx *= reps; dy *= reps; @@ -1428,9 +1428,9 @@ void plWaveSet7::IInitTexWave(int i) fTexWaves[i].fRotScale00 = dx; fTexWaves[i].fRotScale01 = dy; - hsScalar effK = hsFastMath::InvSqrt(dx*dx + dy*dy); - fTexWaves[i].fLen = hsScalar(kCompositeSize) * effK; - fTexWaves[i].fFreq = hsScalarPI * 2.f / fTexWaves[i].fLen; + float effK = hsFastMath::InvSqrt(dx*dx + dy*dy); + fTexWaves[i].fLen = float(kCompositeSize) * effK; + fTexWaves[i].fFreq = M_PI * 2.f / fTexWaves[i].fLen; fTexWaves[i].fAmp = fTexWaves[i].fLen * TexState().fAmpOverLen; fTexWaves[i].fPhase = fRand.RandZeroToOne(); @@ -1448,20 +1448,20 @@ void plWaveSet7::SetSceneNode(const plKey& key) void plWaveSet7::AddDynaDecalMgr(plKey& key) { - plGenRefMsg* msg = TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnRequest, 0, kRefDynaDecalMgr); + plGenRefMsg* msg = new plGenRefMsg(GetKey(), plRefMsg::kOnRequest, 0, kRefDynaDecalMgr); hsgResMgr::ResMgr()->AddViaNotify(key, msg, plRefFlags::kPassiveRef); - msg = TRACKED_NEW plGenRefMsg(key, plRefMsg::kOnRequest, 0, plDynaRippleVSMgr::kRefWaveSetBase); + msg = new plGenRefMsg(key, plRefMsg::kOnRequest, 0, plDynaRippleVSMgr::kRefWaveSetBase); hsgResMgr::ResMgr()->AddViaNotify(GetKey(), msg, plRefFlags::kPassiveRef); } void plWaveSet7::RemoveDynaDecalMgr(plKey& key) { - plGenRefMsg* msg = TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnRemove, 0, kRefDynaDecalMgr); + plGenRefMsg* msg = new plGenRefMsg(GetKey(), plRefMsg::kOnRemove, 0, kRefDynaDecalMgr); msg->SetRef(key->ObjectIsLoaded()); msg->Send(); - msg = TRACKED_NEW plGenRefMsg(key, plRefMsg::kOnRemove, 0, plDynaRippleVSMgr::kRefWaveSetBase); + msg = new plGenRefMsg(key, plRefMsg::kOnRemove, 0, plDynaRippleVSMgr::kRefWaveSetBase); msg->SetRef(this); msg->Send(); } @@ -1470,20 +1470,20 @@ void plWaveSet7::RemoveDynaDecalMgr(plKey& key) ////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////// -void plWaveSet7::IUpdateLayers(hsScalar dt) +void plWaveSet7::IUpdateLayers(float dt) { IUpdateBumpLayers(dt); ISubmitRenderRequests(); } -void plWaveSet7::IUpdateBumpLayers(hsScalar dt) +void plWaveSet7::IUpdateBumpLayers(float dt) { - plCONST(hsScalar) speedHack(1.f / 3.f); + plCONST(float) speedHack(1.f / 3.f); int i; for( i = 0; i < kNumTexWaves; i++ ) { - hsScalar speed = hsFastMath::InvSqrtAppr(fTexWaves[i].fLen / (2.f * hsScalarPI * kGravConst)) * speedHack; + float speed = hsFastMath::InvSqrtAppr(fTexWaves[i].fLen / (2.f * M_PI * kGravConst)) * speedHack; fTexWaves[i].fPhase -= dt * speed; fTexWaves[i].fPhase -= int(fTexWaves[i].fPhase); @@ -1518,7 +1518,7 @@ void plWaveSet7::ISubmitRenderRequests() } } -plMipmap* plWaveSet7::ICreateBumpBitmapFFP(hsScalar amp, hsScalar dx, hsScalar dy) const +plMipmap* plWaveSet7::ICreateBumpBitmapFFP(float amp, float dx, float dy) const { return nil; } @@ -1610,7 +1610,7 @@ hsGMaterial* plWaveSet7::ICreateBumpLayersFFP() plMipmap* plWaveSet7::ICreateBiasNoiseMap() { const int size = kCompositeSize >> 2; - plMipmap* mipMap = TRACKED_NEW plMipmap( + plMipmap* mipMap = new plMipmap( size, size, plMipmap::kARGB32Config, 1, @@ -1626,15 +1626,15 @@ plMipmap* plWaveSet7::ICreateBiasNoiseMap() int j; for( j = 0; j < size; j++ ) { - hsScalar x = fRand.RandMinusOneToOne(); - hsScalar y = fRand.RandMinusOneToOne(); + float x = fRand.RandMinusOneToOne(); + float y = fRand.RandMinusOneToOne(); - UInt8 r = UInt8((x * 0.5f + 0.5f) * 255.999f); - UInt8 g = UInt8((y * 0.5f + 0.5f) * 255.999f); + uint8_t r = uint8_t((x * 0.5f + 0.5f) * 255.999f); + uint8_t g = uint8_t((y * 0.5f + 0.5f) * 255.999f); // r = g = 0xff; // SATURATE - UInt32* val = mipMap->GetAddr32(i, j); + uint32_t* val = mipMap->GetAddr32(i, j); *val = (0xff << 24) | (r << 16) | (g << 8) @@ -1655,7 +1655,7 @@ plMipmap* plWaveSet7::ICreateBumpMipmapPS() if( !fCosineLUT ) { - plMipmap* mipMap = TRACKED_NEW plMipmap( + plMipmap* mipMap = new plMipmap( kCompositeSize, sizeV, plMipmap::kARGB32Config, kNumLevels, @@ -1665,7 +1665,7 @@ plMipmap* plWaveSet7::ICreateBumpMipmapPS() plString buff = plString::Format("%s_BumpBitPS", GetKey()->GetName().c_str()); hsgResMgr::ResMgr()->NewKey(buff, mipMap, GetKey()->GetUoid().GetLocation()); - hsgResMgr::ResMgr()->SendRef(mipMap->GetKey(), TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnRequest, 0, kRefCosineLUT), plRefFlags::kActiveRef); + hsgResMgr::ResMgr()->SendRef(mipMap->GetKey(), new plGenRefMsg(GetKey(), plRefMsg::kOnRequest, 0, kRefCosineLUT), plRefFlags::kActiveRef); } hsAssert(fCosineLUT, "Failed to make cosine lookup table"); @@ -1679,19 +1679,19 @@ plMipmap* plWaveSet7::ICreateBumpMipmapPS() int i; for( i = 0; i < sizeU; i++ ) { - hsScalar y = hsScalar(i); - hsScalar dist = hsScalar(i) / hsScalar(sizeU-1) * 2.f * hsScalarPI; - hsScalar c = cos(dist); - hsScalar s = sin(dist); + float y = float(i); + float dist = float(i) / float(sizeU-1) * 2.f * M_PI; + float c = cos(dist); + float s = sin(dist); s *= 0.5f; s += 0.5f; - s = hsScalar(pow(s, TexState().fChop)); + s = float(pow(s, TexState().fChop)); c *= s; - UInt8 cosDist = UInt8((c * 0.5 + 0.5) * 255.999f); + uint8_t cosDist = uint8_t((c * 0.5 + 0.5) * 255.999f); int j; for( j = 0; j < sizeV; j++ ) { - UInt32* val = fCosineLUT->GetAddr32(i, j); + uint32_t* val = fCosineLUT->GetAddr32(i, j); *val = (0xff << 24) | (cosDist << 16) | (cosDist << 8) @@ -1713,7 +1713,7 @@ void plWaveSet7::IAddBumpBiasLayer(hsGMaterial* mat) int i; for( i = 0; i < 2; i++ ) { - plLayer* layer = TRACKED_NEW plLayer; + plLayer* layer = new plLayer; plString buff = plString::Format("%s_Bias_%d", GetKey()->GetName().c_str(), i); hsgResMgr::ResMgr()->NewKey(buff, layer, GetKey()->GetUoid().GetLocation()); @@ -1732,7 +1732,7 @@ void plWaveSet7::IAddBumpBiasLayer(hsGMaterial* mat) layer->SetUVWSrc(0); - plLayRefMsg* refMsg = TRACKED_NEW plLayRefMsg(layer->GetKey(), plRefMsg::kOnCreate, 0, plLayRefMsg::kTexture); + plLayRefMsg* refMsg = new plLayRefMsg(layer->GetKey(), plRefMsg::kOnCreate, 0, plLayRefMsg::kTexture); hsgResMgr::ResMgr()->SendRef(mipMap->GetKey(), refMsg, plRefFlags::kActiveRef); IAddBumpBiasShaders(layer); @@ -1748,7 +1748,7 @@ void plWaveSet7::IAddBumpBiasLayer(hsGMaterial* mat) plLayer* plWaveSet7::ICreateBumpLayerPS(plMipmap* mipMap, hsGMaterial* bumpMat, int which) { - plLayer* layer = TRACKED_NEW plLayer; + plLayer* layer = new plLayer; plString buff = plString::Format("%s_BumpLayerPS_%d", GetKey()->GetName().c_str(), which); hsgResMgr::ResMgr()->NewKey(buff, layer, GetKey()->GetUoid().GetLocation()); @@ -1782,7 +1782,7 @@ plLayer* plWaveSet7::ICreateBumpLayerPS(plMipmap* mipMap, hsGMaterial* bumpMat, bumpMat->AddLayerViaNotify(layer); - plLayRefMsg* refMsg = TRACKED_NEW plLayRefMsg(layer->GetKey(), plRefMsg::kOnCreate, 0, plLayRefMsg::kTexture); + plLayRefMsg* refMsg = new plLayRefMsg(layer->GetKey(), plRefMsg::kOnCreate, 0, plLayRefMsg::kTexture); hsgResMgr::ResMgr()->SendRef(mipMap->GetKey(), refMsg, plRefFlags::kActiveRef); return layer; @@ -1805,7 +1805,7 @@ hsGMaterial* plWaveSet7::ICreateBumpLayersPS() // // Create a blank material - hsGMaterial* bumpMat = TRACKED_NEW hsGMaterial; + hsGMaterial* bumpMat = new hsGMaterial; plString buff = plString::Format("%s_BumpMatPS", GetKey()->GetName()); hsgResMgr::ResMgr()->NewKey(buff, bumpMat, GetKey()->GetUoid().GetLocation()); @@ -1834,7 +1834,7 @@ hsGMaterial* plWaveSet7::ICreateBumpLayersPS() // Need to add this via notify to ourselves. - hsgResMgr::ResMgr()->SendRef(bumpMat->GetKey(), TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnRequest, 0, kRefBumpMat), plRefFlags::kActiveRef); + hsgResMgr::ResMgr()->SendRef(bumpMat->GetKey(), new plGenRefMsg(GetKey(), plRefMsg::kOnRequest, 0, kRefBumpMat), plRefFlags::kActiveRef); ICreateBumpDrawable(); @@ -1845,7 +1845,7 @@ void plWaveSet7::IAddBumpBiasShaders(plLayer* layer) { if( !fBiasVShader ) { - plShader* vShader = TRACKED_NEW plShader; + plShader* vShader = new plShader; plString buff = plString::Format("%s_BiasVS", GetKey()->GetName().c_str()); hsgResMgr::ResMgr()->NewKey(buff, vShader, GetKey()->GetUoid().GetLocation()); @@ -1882,7 +1882,7 @@ void plWaveSet7::IAddBumpBiasShaders(plLayer* layer) 2.f); hsVector3 specVec = State().fSpecVec; - hsScalar biasScale = 0.5f * specVec[State().kNoise] / (hsScalar(kNumBumpShaders) + specVec[State().kNoise]); + float biasScale = 0.5f * specVec[State().kNoise] / (float(kNumBumpShaders) + specVec[State().kNoise]); vShader->SetVector(plBiasVS::kScaleBias, biasScale, biasScale, @@ -1896,19 +1896,19 @@ void plWaveSet7::IAddBumpBiasShaders(plLayer* layer) // vShader->SetDecl(&vDecl); vShader->SetDecl(plShaderTable::Decl(vs_BiasNormals)); - hsgResMgr::ResMgr()->SendRef(vShader->GetKey(), TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnRequest, 0, kRefBiasVShader), plRefFlags::kActiveRef); + hsgResMgr::ResMgr()->SendRef(vShader->GetKey(), new plGenRefMsg(GetKey(), plRefMsg::kOnRequest, 0, kRefBiasVShader), plRefFlags::kActiveRef); fBiasVShader = vShader; } - plLayRefMsg* refMsg = TRACKED_NEW plLayRefMsg(layer->GetKey(), plRefMsg::kOnCreate, 0, plLayRefMsg::kVertexShader); + plLayRefMsg* refMsg = new plLayRefMsg(layer->GetKey(), plRefMsg::kOnCreate, 0, plLayRefMsg::kVertexShader); hsgResMgr::ResMgr()->SendRef(fBiasVShader->GetKey(), refMsg, plRefFlags::kActiveRef); if( !fBiasPShader ) { - plShader* pShader = TRACKED_NEW plShader; + plShader* pShader = new plShader; plString buff = plString::Format("%s_BiasPS", GetKey()->GetName().c_str()); hsgResMgr::ResMgr()->NewKey(buff, pShader, GetKey()->GetUoid().GetLocation()); @@ -1923,12 +1923,12 @@ void plWaveSet7::IAddBumpBiasShaders(plLayer* layer) // pShader->SetDecl(&pDecl); pShader->SetDecl(plShaderTable::Decl(ps_BiasNormals)); - hsgResMgr::ResMgr()->SendRef(pShader->GetKey(), TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnRequest, 0, kRefBiasPShader), plRefFlags::kActiveRef); + hsgResMgr::ResMgr()->SendRef(pShader->GetKey(), new plGenRefMsg(GetKey(), plRefMsg::kOnRequest, 0, kRefBiasPShader), plRefFlags::kActiveRef); fBiasPShader = pShader; } - refMsg = TRACKED_NEW plLayRefMsg(layer->GetKey(), plRefMsg::kOnCreate, 0, plLayRefMsg::kPixelShader); + refMsg = new plLayRefMsg(layer->GetKey(), plRefMsg::kOnCreate, 0, plLayRefMsg::kPixelShader); hsgResMgr::ResMgr()->SendRef(fBiasPShader->GetKey(), refMsg, plRefFlags::kActiveRef); } @@ -1942,7 +1942,7 @@ void plWaveSet7::IAddBumpVertexShader(hsGMaterial* mat, int iShader, int iFirst, { int iShader = iBase / kBumpPerPass; - plShader* vShader = TRACKED_NEW plShader; + plShader* vShader = new plShader; plString buff = plString::Format("%s_BumpVS_%d", GetKey()->GetName().c_str(), iShader); hsgResMgr::ResMgr()->NewKey(buff, vShader, GetKey()->GetUoid().GetLocation()); vShader->SetIsPixelShader(false); @@ -1967,7 +1967,7 @@ void plWaveSet7::IAddBumpVertexShader(hsGMaterial* mat, int iShader, int iFirst, vShader->SetDecl(plShaderTable::Decl(vs_CompCosines)); - hsgResMgr::ResMgr()->SendRef(vShader->GetKey(), TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnRequest, iShader, kRefBumpVShader), plRefFlags::kActiveRef); + hsgResMgr::ResMgr()->SendRef(vShader->GetKey(), new plGenRefMsg(GetKey(), plRefMsg::kOnRequest, iShader, kRefBumpVShader), plRefFlags::kActiveRef); fBumpVShader[iShader] = vShader; @@ -1987,7 +1987,7 @@ void plWaveSet7::IAddBumpPixelShader(hsGMaterial* mat, int iShader, int iFirst, { int iShader = iBase / kBumpPerPass; - plShader* pShader = TRACKED_NEW plShader; + plShader* pShader = new plShader; plString buff = plString::Format("%s_BumpPS_%d", GetKey()->GetName().c_str(), iShader); hsgResMgr::ResMgr()->NewKey(buff, pShader, GetKey()->GetUoid().GetLocation()); pShader->SetIsPixelShader(true); @@ -1998,8 +1998,8 @@ void plWaveSet7::IAddBumpPixelShader(hsGMaterial* mat, int iShader, int iFirst, for( iLay = 0; iLay < kBumpPerPass; iLay++ ) { pShader->SetVector(plBumpPS::kWave0, - -fTexWaves[iBase + iLay].fDirX * (1.f / hsScalar(kBumpPerPass)), - -fTexWaves[iBase + iLay].fDirY * (1.f / hsScalar(kBumpPerPass)), + -fTexWaves[iBase + iLay].fDirX * (1.f / float(kBumpPerPass)), + -fTexWaves[iBase + iLay].fDirY * (1.f / float(kBumpPerPass)), 1.f, 1.f); } @@ -2016,7 +2016,7 @@ void plWaveSet7::IAddBumpPixelShader(hsGMaterial* mat, int iShader, int iFirst, pShader->SetVector(plBumpPS::kHalfOne, 0.25f, 0.25f, 0.25f, 1.f); - hsgResMgr::ResMgr()->SendRef(pShader->GetKey(), TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnRequest, iShader, kRefBumpPShader), plRefFlags::kActiveRef); + hsgResMgr::ResMgr()->SendRef(pShader->GetKey(), new plGenRefMsg(GetKey(), plRefMsg::kOnRequest, iShader, kRefBumpPShader), plRefFlags::kActiveRef); fBumpPShader[iShader] = pShader; @@ -2029,13 +2029,13 @@ void plWaveSet7::IAddBumpPixelShader(hsGMaterial* mat, int iShader, int iFirst, plDrawableSpans* plWaveSet7::ICreateBumpDrawable() { - fBumpDraw = TRACKED_NEW plDrawableSpans; + fBumpDraw = new plDrawableSpans; plString buff = plString::Format("%s_BumpDraw", GetKey()->GetName().c_str()); hsgResMgr::ResMgr()->NewKey(buff, fBumpDraw, GetKey()->GetUoid().GetLocation()); ICreateClearDrawable(fBumpDraw, fBumpMat); - hsgResMgr::ResMgr()->SendRef(fBumpDraw->GetKey(), TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnRequest, 0, kRefBumpDraw), plRefFlags::kActiveRef); + hsgResMgr::ResMgr()->SendRef(fBumpDraw->GetKey(), new plGenRefMsg(GetKey(), plRefMsg::kOnRequest, 0, kRefBumpDraw), plRefFlags::kActiveRef); return fBumpDraw; } @@ -2087,7 +2087,7 @@ plDrawableSpans* plWaveSet7::ICreateClearDrawable(plDrawableSpans* drawable, hsG uvw[3] = uvw[0]; uvw[3].fX += 1.f; - UInt16 idx[6]; + uint16_t idx[6]; idx[0] = 1; idx[1] = 0; idx[2] = 2; @@ -2110,9 +2110,9 @@ plDrawableSpans* plWaveSet7::ICreateClearDrawable(plDrawableSpans* drawable, hsG return drawable; } -plRenderRequest* plWaveSet7::ICreateRenderRequest(plRenderTarget* rt, plDrawableSpans* draw, hsScalar pri) +plRenderRequest* plWaveSet7::ICreateRenderRequest(plRenderTarget* rt, plDrawableSpans* draw, float pri) { - plRenderRequest* req = TRACKED_NEW plRenderRequest; + plRenderRequest* req = new plRenderRequest; static plPageTreeMgr emptyMgr; req->SetPageTreeMgr(&emptyMgr); @@ -2138,12 +2138,12 @@ plRenderRequest* plWaveSet7::ICreateRenderRequest(plRenderTarget* rt, plDrawable plRenderTarget* plWaveSet7::ICreateTransferRenderTarget(const char* name, int size) { - UInt16 flags = plRenderTarget::kIsTexture | plRenderTarget::kIsOrtho; - UInt8 bitDepth = 32; - UInt8 zDepth = 0; - UInt8 stencilDepth = 0; + uint16_t flags = plRenderTarget::kIsTexture | plRenderTarget::kIsOrtho; + uint8_t bitDepth = 32; + uint8_t zDepth = 0; + uint8_t stencilDepth = 0; - plRenderTarget* rt = TRACKED_NEW plRenderTarget(flags, size, size, bitDepth, zDepth, stencilDepth); + plRenderTarget* rt = new plRenderTarget(flags, size, size, bitDepth, zDepth, stencilDepth); plString buff = plString::Format("%s_%s", GetKey()->GetName().c_str(), name); hsgResMgr::ResMgr()->NewKey(buff, rt, GetKey()->GetUoid().GetLocation()); @@ -2156,7 +2156,7 @@ plLayer* plWaveSet7::ICreateTotalLayer(plBitmap* bm, hsGMaterial* mat, int which plLayer* layer = mat->GetNumLayers() > which ? plLayer::ConvertNoRef(mat->GetLayer(which)->BottomOfStack()) : nil; if( !layer ) { - layer = TRACKED_NEW plLayer; + layer = new plLayer; plString buff = plString::Format("%s_%sLayerPS_%d", GetKey()->GetName().c_str(), suff, which); hsgResMgr::ResMgr()->NewKey(buff, layer, GetKey()->GetUoid().GetLocation()); @@ -2182,7 +2182,7 @@ plLayer* plWaveSet7::ICreateTotalLayer(plBitmap* bm, hsGMaterial* mat, int which layer->SetTransform(xfm); - plLayRefMsg* refMsg = TRACKED_NEW plLayRefMsg(layer->GetKey(), plRefMsg::kOnCreate, 0, plLayRefMsg::kTexture); + plLayRefMsg* refMsg = new plLayRefMsg(layer->GetKey(), plRefMsg::kOnCreate, 0, plLayRefMsg::kTexture); hsgResMgr::ResMgr()->SendRef(bm->GetKey(), refMsg, plRefFlags::kActiveRef); return layer; @@ -2190,7 +2190,7 @@ plLayer* plWaveSet7::ICreateTotalLayer(plBitmap* bm, hsGMaterial* mat, int which plLayer* plWaveSet7::ICreateTotalEnvLayer(plBitmap* envMap, hsGMaterial* mat, int which, const char* pref) { - plLayer* layer = TRACKED_NEW plLayer; + plLayer* layer = new plLayer; plString buff = plString::Format("%s_%s_EnvLayerPS_%d", GetKey()->GetName().c_str(), pref, which); hsgResMgr::ResMgr()->NewKey(buff, layer, GetKey()->GetUoid().GetLocation()); @@ -2213,7 +2213,7 @@ plLayer* plWaveSet7::ICreateTotalEnvLayer(plBitmap* envMap, hsGMaterial* mat, in layer->SetTransform(xfm); - plLayRefMsg* refMsg = TRACKED_NEW plLayRefMsg(layer->GetKey(), plRefMsg::kOnCreate, 0, plLayRefMsg::kTexture); + plLayRefMsg* refMsg = new plLayRefMsg(layer->GetKey(), plRefMsg::kOnCreate, 0, plLayRefMsg::kTexture); hsgResMgr::ResMgr()->SendRef(envMap->GetKey(), refMsg, plRefFlags::kActiveRef); mat->AddLayerViaNotify(layer); @@ -2235,7 +2235,7 @@ hsGMaterial* plWaveSet7::ICreateFixedMatPS(hsGMaterial* mat, const int numUVWs) int i; for( i = mat->GetNumLayers()-1; i > 0; i-- ) { - plMatRefMsg* refMsg = TRACKED_NEW plMatRefMsg(mat->GetKey(), plRefMsg::kOnRemove, i, plMatRefMsg::kLayer); + plMatRefMsg* refMsg = new plMatRefMsg(mat->GetKey(), plRefMsg::kOnRemove, i, plMatRefMsg::kLayer); hsgResMgr::ResMgr()->SendRef(mat->GetLayer(i)->GetKey(), refMsg, plRefFlags::kActiveRef); } @@ -2253,7 +2253,7 @@ hsGMaterial* plWaveSet7::ICreateFixedMatPS(hsGMaterial* mat, const int numUVWs) fBumpReq = ICreateRenderRequest(rt, fBumpDraw, -100.f); - fBumpReqMsg = TRACKED_NEW plRenderRequestMsg(GetKey(), fBumpReq); + fBumpReqMsg = new plRenderRequestMsg(GetKey(), fBumpReq); IAddFixedVertexShader(mat, numUVWs); IAddFixedPixelShader(mat); @@ -2268,7 +2268,7 @@ void plWaveSet7::ICreateFixedMat(hsGMaterial* mat, const int numUVWs) if( !fEnvMap ) { - plDynamicEnvMap* env = TRACKED_NEW plDynamicEnvMap((UInt16)fEnvSize, (UInt16)fEnvSize, 32); + plDynamicEnvMap* env = new plDynamicEnvMap((uint16_t)fEnvSize, (uint16_t)fEnvSize, 32); hsgResMgr::ResMgr()->NewKey(GetKey()->GetName(), env, GetKey()->GetUoid().GetLocation()); fEnvMap = env; env->SetPosition(hsPoint3(0, 0, 50.f)); @@ -2289,7 +2289,7 @@ void plWaveSet7::IAddShoreVertexShader(hsGMaterial* mat) if( !fShoreVShader ) { - plShader* vShader = TRACKED_NEW plShader; + plShader* vShader = new plShader; plString buff = plString::Format("%s_ShoreVS", GetKey()->GetName().c_str()); hsgResMgr::ResMgr()->NewKey(buff, vShader, GetKey()->GetUoid().GetLocation()); @@ -2302,12 +2302,12 @@ void plWaveSet7::IAddShoreVertexShader(hsGMaterial* mat) vShader->SetVector(plShoreVS::kSinConsts, 1.f, -1.f/6.f, 1.f/120.f, -1.f/5040.f); vShader->SetVector(plShoreVS::kCosConsts, 1.f, -1.f/2.f, 1.f/24.f, -1.f/720.f); - vShader->SetVector(plShoreVS::kPiConsts, 1.f / (8.f*hsScalarPI*4.f*4.f), hsScalarPI/2.f, hsScalarPI, hsScalarPI*2.f); + vShader->SetVector(plShoreVS::kPiConsts, 1.f / (8.f*M_PI*4.f*4.f), M_PI/2.f, M_PI, M_PI*2.f); vShader->SetVector(plShoreVS::kNumericConsts, 0, 0.5f, 1.f, 2.f); - plConst(hsScalar) kK1(0.5f); - plConst(hsScalar) kK2(1.5f); - hsScalar negK1OverK2Sq = -kK1 / (kK2 * kK2); + plConst(float) kK1(0.5f); + plConst(float) kK2(1.5f); + float negK1OverK2Sq = -kK1 / (kK2 * kK2); vShader->SetVector(plShoreVS::kIncline, negK1OverK2Sq, kK1, 0.f, 0.f); vShader->SetNumPipeConsts(5); @@ -2328,7 +2328,7 @@ void plWaveSet7::IAddShoreVertexShader(hsGMaterial* mat) // vShader->SetDecl(&decl); vShader->SetDecl(plShaderTable::Decl(vs_ShoreLeave7)); - hsgResMgr::ResMgr()->SendRef(vShader->GetKey(), TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnRequest, 0, kRefShoreVShader), plRefFlags::kActiveRef); + hsgResMgr::ResMgr()->SendRef(vShader->GetKey(), new plGenRefMsg(GetKey(), plRefMsg::kOnRequest, 0, kRefShoreVShader), plRefFlags::kActiveRef); fShoreVShader = vShader; @@ -2342,7 +2342,7 @@ void plWaveSet7::IAddShorePixelShader(hsGMaterial* mat) { if( !fShorePShader ) { - plShader* pShader = TRACKED_NEW plShader; + plShader* pShader = new plShader; plString buff = plString::Format("%s_ShorePS", GetKey()->GetName().c_str()); hsgResMgr::ResMgr()->NewKey(buff, pShader, GetKey()->GetUoid().GetLocation()); @@ -2352,7 +2352,7 @@ void plWaveSet7::IAddShorePixelShader(hsGMaterial* mat) // pShader->SetShaderFileName("sha/ps_ShoreLeave6.inl"); pShader->SetDecl(plShaderTable::Decl(ps_ShoreLeave6)); - hsgResMgr::ResMgr()->SendRef(pShader->GetKey(), TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnRequest, 0, kRefShorePShader), plRefFlags::kActiveRef); + hsgResMgr::ResMgr()->SendRef(pShader->GetKey(), new plGenRefMsg(GetKey(), plRefMsg::kOnRequest, 0, kRefShorePShader), plRefFlags::kActiveRef); fShorePShader = pShader; } @@ -2365,7 +2365,7 @@ void plWaveSet7::IAddFixedVertexShader(hsGMaterial* mat, const int numUVWs) if( !fFixedVShader ) { - plShader* vShader = TRACKED_NEW plShader; + plShader* vShader = new plShader; plString buff = plString::Format("%s_FixedVS", GetKey()->GetName().c_str()); hsgResMgr::ResMgr()->NewKey(buff, vShader, GetKey()->GetUoid().GetLocation()); @@ -2378,7 +2378,7 @@ void plWaveSet7::IAddFixedVertexShader(hsGMaterial* mat, const int numUVWs) vShader->SetVector(plFixedVS7::kSinConsts, 1.f, -1.f/6.f, 1.f/120.f, -1.f/5040.f); vShader->SetVector(plFixedVS7::kCosConsts, 1.f, -1.f/2.f, 1.f/24.f, -1.f/720.f); - vShader->SetVector(plFixedVS7::kPiConsts, 1.f / (8.f*hsScalarPI*4.f*4.f), hsScalarPI/2.f, hsScalarPI, hsScalarPI*2.f); + vShader->SetVector(plFixedVS7::kPiConsts, 1.f / (8.f*M_PI*4.f*4.f), M_PI/2.f, M_PI, M_PI*2.f); vShader->SetVector(plFixedVS7::kNumericConsts, 0, 0.5f, 1.f, 2.f); vShader->SetNumPipeConsts(5); @@ -2398,7 +2398,7 @@ void plWaveSet7::IAddFixedVertexShader(hsGMaterial* mat, const int numUVWs) // vShader->SetShaderFileName("sha/vs_WaveFixedFin.inl"); // vShader->SetShaderFileName("sha/vs_TestPos.inl"); - hsgResMgr::ResMgr()->SendRef(vShader->GetKey(), TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnRequest, 0, kRefFixedVShader), plRefFlags::kActiveRef); + hsgResMgr::ResMgr()->SendRef(vShader->GetKey(), new plGenRefMsg(GetKey(), plRefMsg::kOnRequest, 0, kRefFixedVShader), plRefFlags::kActiveRef); fFixedVShader = vShader; @@ -2409,11 +2409,11 @@ void plWaveSet7::IAddFixedVertexShader(hsGMaterial* mat, const int numUVWs) } // type is either plLayRefMsg::kVertexShader or plLayRefMsg::kPixelShader. -void plWaveSet7::IAddShaderToLayers(hsGMaterial* mat, int iFirst, int iLast, UInt8 type, plShader* shader) +void plWaveSet7::IAddShaderToLayers(hsGMaterial* mat, int iFirst, int iLast, uint8_t type, plShader* shader) { if( iFirst < 0 ) iFirst = 0; - if( UInt32(iLast) >= mat->GetNumLayers() ) + if( uint32_t(iLast) >= mat->GetNumLayers() ) iLast = mat->GetNumLayers()-1; int i; for( i = iFirst; i <= iLast; i++ ) @@ -2423,7 +2423,7 @@ void plWaveSet7::IAddShaderToLayers(hsGMaterial* mat, int iFirst, int iLast, UIn && (layer->GetVertexShader() != shader) && (layer->GetPixelShader() != shader) ) { - plLayRefMsg* refMsg = TRACKED_NEW plLayRefMsg(layer->GetKey(), plRefMsg::kOnCreate, 0, type); + plLayRefMsg* refMsg = new plLayRefMsg(layer->GetKey(), plRefMsg::kOnCreate, 0, type); hsgResMgr::ResMgr()->SendRef(shader->GetKey(), refMsg, plRefFlags::kActiveRef); // layer->SetShadeFlags(layer->GetShadeFlags() | hsGMatState::kShadeReallyNoFog); @@ -2435,7 +2435,7 @@ void plWaveSet7::IAddFixedPixelShader(hsGMaterial* mat) { if( !fFixedPShader ) { - plShader* pShader = TRACKED_NEW plShader; + plShader* pShader = new plShader; plString buff = plString::Format("%s_FixedPS", GetKey()->GetName().c_str()); hsgResMgr::ResMgr()->NewKey(buff, pShader, GetKey()->GetUoid().GetLocation()); pShader->SetIsPixelShader(true); @@ -2450,7 +2450,7 @@ void plWaveSet7::IAddFixedPixelShader(hsGMaterial* mat) // pShader->SetShaderFileName("sha/ps_TestPos.inl"); pShader->SetDecl(plShaderTable::Decl(ps_WaveFixed)); - hsgResMgr::ResMgr()->SendRef(pShader->GetKey(), TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnRequest, 0, kRefFixedPShader), plRefFlags::kActiveRef); + hsgResMgr::ResMgr()->SendRef(pShader->GetKey(), new plGenRefMsg(GetKey(), plRefMsg::kOnRequest, 0, kRefFixedPShader), plRefFlags::kActiveRef); fFixedPShader = pShader; } @@ -2463,7 +2463,7 @@ void plWaveSet7::IAddRipVertexShader(hsGMaterial* mat, const plRipVSConsts& ripC { if( !fRipVShader ) { - plShader* vShader = TRACKED_NEW plShader; + plShader* vShader = new plShader; plString buff = plString::Format("%s_RipVS", GetKey()->GetName().c_str()); hsgResMgr::ResMgr()->NewKey(buff, vShader, GetKey()->GetUoid().GetLocation()); vShader->SetIsPixelShader(false); @@ -2475,7 +2475,7 @@ void plWaveSet7::IAddRipVertexShader(hsGMaterial* mat, const plRipVSConsts& ripC vShader->SetVector(plRipVS::kSinConsts, 1.f, -1.f/6.f, 1.f/120.f, -1.f/5040.f); vShader->SetVector(plRipVS::kCosConsts, 1.f, -1.f/2.f, 1.f/24.f, -1.f/720.f); - vShader->SetVector(plRipVS::kPiConsts, 1.f / (8.f*hsScalarPI*4.f*4.f), hsScalarPI/2.f, hsScalarPI, hsScalarPI*2.f); + vShader->SetVector(plRipVS::kPiConsts, 1.f / (8.f*M_PI*4.f*4.f), M_PI/2.f, M_PI, M_PI*2.f); vShader->SetVector(plRipVS::kNumericConsts, 0, 0.5f, 1.f, 2.f); hsVector3 waterOffset = State().fWaterOffset; @@ -2515,7 +2515,7 @@ void plWaveSet7::IAddRipVertexShader(hsGMaterial* mat, const plRipVSConsts& ripC ripConsts.fLife, 1.f / (ripConsts.fLife - ripConsts.fDecay)); - plConst(hsScalar) kRipBias(0.1); + plConst(float) kRipBias(0.1); vShader->SetVector(plRipVS::kRampBias, ripConsts.fRamp, 1.f / ripConsts.fRamp, @@ -2535,7 +2535,7 @@ void plWaveSet7::IAddRipVertexShader(hsGMaterial* mat, const plRipVSConsts& ripC // vShader->SetDecl(&decl); vShader->SetDecl(plShaderTable::Decl(vs_WaveRip7)); - hsgResMgr::ResMgr()->SendRef(vShader->GetKey(), TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnRequest, 0, kRefRipVShader), plRefFlags::kActiveRef); + hsgResMgr::ResMgr()->SendRef(vShader->GetKey(), new plGenRefMsg(GetKey(), plRefMsg::kOnRequest, 0, kRefRipVShader), plRefFlags::kActiveRef); hsAssert(vShader == fRipVShader, "Should have been set by SendRef"); } @@ -2548,7 +2548,7 @@ void plWaveSet7::IAddRipPixelShader(hsGMaterial* mat, const plRipVSConsts& ripCo { if( !fRipPShader ) { - plShader* pShader = TRACKED_NEW plShader; + plShader* pShader = new plShader; plString buff = plString::Format("%s_RipPS", GetKey()->GetName().c_str()); hsgResMgr::ResMgr()->NewKey(buff, pShader, GetKey()->GetUoid().GetLocation()); pShader->SetIsPixelShader(true); @@ -2561,7 +2561,7 @@ void plWaveSet7::IAddRipPixelShader(hsGMaterial* mat, const plRipVSConsts& ripCo // pShader->SetShaderFileName("sha/ps_WaveRip.inl"); pShader->SetDecl(plShaderTable::Decl(ps_WaveRip)); - hsgResMgr::ResMgr()->SendRef(pShader->GetKey(), TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnRequest, 0, kRefRipPShader), plRefFlags::kActiveRef); + hsgResMgr::ResMgr()->SendRef(pShader->GetKey(), new plGenRefMsg(GetKey(), plRefMsg::kOnRequest, 0, kRefRipPShader), plRefFlags::kActiveRef); hsAssert(pShader == fRipPShader, "Should have been set by SendRef"); } @@ -2607,7 +2607,7 @@ plShader* plWaveSet7::ICreateDecalVShader(DecalVType t) }; - plShader* vShader = TRACKED_NEW plShader; + plShader* vShader = new plShader; plString buff = plString::Format("%s_%s", GetKey()->GetName().c_str(), fname[t]); hsgResMgr::ResMgr()->NewKey(buff, vShader, GetKey()->GetUoid().GetLocation()); vShader->SetIsPixelShader(false); @@ -2619,7 +2619,7 @@ plShader* plWaveSet7::ICreateDecalVShader(DecalVType t) vShader->SetVector(plWaveDecVS::kSinConsts, 1.f, -1.f/6.f, 1.f/120.f, -1.f/5040.f); vShader->SetVector(plWaveDecVS::kCosConsts, 1.f, -1.f/2.f, 1.f/24.f, -1.f/720.f); - vShader->SetVector(plWaveDecVS::kPiConsts, 1.f / (8.f*hsScalarPI*4.f*4.f), hsScalarPI/2.f, hsScalarPI, hsScalarPI*2.f); + vShader->SetVector(plWaveDecVS::kPiConsts, 1.f / (8.f*M_PI*4.f*4.f), M_PI/2.f, M_PI, M_PI*2.f); vShader->SetVector(plWaveDecVS::kNumericConsts, 0, 0.5f, 1.f, 2.f); hsVector3 waterOffset = State().fWaterOffset; @@ -2645,7 +2645,7 @@ plShader* plWaveSet7::ICreateDecalVShader(DecalVType t) 0.f ); - plConst(hsScalar) kBias(0.1); + plConst(float) kBias(0.1); vShader->SetVector(plWaveDecVS::kBias, kBias, 0, @@ -2668,7 +2668,7 @@ plShader* plWaveSet7::ICreateDecalVShader(DecalVType t) // vShader->SetDecl(&shaderDecls[t]); vShader->SetDecl(plShaderTable::Decl(shaderIDs[t])); - hsgResMgr::ResMgr()->SendRef(vShader->GetKey(), TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnRequest, t, kRefDecVShader), plRefFlags::kActiveRef); + hsgResMgr::ResMgr()->SendRef(vShader->GetKey(), new plGenRefMsg(GetKey(), plRefMsg::kOnRequest, t, kRefDecVShader), plRefFlags::kActiveRef); hsAssert(vShader == fDecalVShaders[t], "Should have been set by SendRef"); } @@ -2734,7 +2734,7 @@ plShader* plWaveSet7::ICreateDecalPShader(DecalPType t) ps_WaveDecEnv }; - plShader* pShader = TRACKED_NEW plShader; + plShader* pShader = new plShader; plString buff = plString::Format("%s_%s", GetKey()->GetName().c_str(), fname[t]); hsgResMgr::ResMgr()->NewKey(buff, pShader, GetKey()->GetUoid().GetLocation()); @@ -2744,7 +2744,7 @@ plShader* plWaveSet7::ICreateDecalPShader(DecalPType t) // pShader->SetShaderFileName(buff); pShader->SetDecl(plShaderTable::Decl(shaderIDs[t])); - hsgResMgr::ResMgr()->SendRef(pShader->GetKey(), TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnRequest, t, kRefDecPShader), plRefFlags::kActiveRef); + hsgResMgr::ResMgr()->SendRef(pShader->GetKey(), new plGenRefMsg(GetKey(), plRefMsg::kOnRequest, t, kRefDecPShader), plRefFlags::kActiveRef); hsAssert(fDecalPShaders[t] == pShader, "Should have been set by SendRef"); } @@ -2829,7 +2829,7 @@ void plWaveSet7::IUpdateShaders(plPipeline* pipe, const hsMatrix44& l2w, const h void plWaveSet7::IUpdateBumpPShader(plPipeline* pipe, const hsMatrix44& l2w, const hsMatrix44& w2l) { - plCONST(Int32) skip(0); + plCONST(int32_t) skip(0); int i; for( i = 0; i < kNumBumpShaders; i++ ) { @@ -2840,16 +2840,16 @@ void plWaveSet7::IUpdateBumpPShader(plPipeline* pipe, const hsMatrix44& l2w, con int iTex = i*kBumpPerPass + j; hsVector3 specVec = State().fSpecVec; - hsScalar scale = 1.f / (hsScalar(kNumBumpShaders) + specVec[State().kNoise]); + float scale = 1.f / (float(kNumBumpShaders) + specVec[State().kNoise]); - hsScalar maxLen = TexState().fMaxLength * kCompositeSize / State().fRippleScale; - hsScalar rescale = fTexWaves[iTex].fLen / maxLen; + float maxLen = TexState().fMaxLength * kCompositeSize / State().fRippleScale; + float rescale = fTexWaves[iTex].fLen / maxLen; - hsScalar bias = 0.5f * scale; + float bias = 0.5f * scale; fBumpPShader[i]->SetVector(plBumpPS::kHalfOne, scale, scale, 1.f, 1.f); fBumpPShader[i]->SetVector(plBumpPS::kBias, bias, bias, 1.f, 1.f); - hsScalar layScale = skip & (1 << iTex) ? 0.f : (1.f / hsScalar(kBumpPerPass)); + float layScale = skip & (1 << iTex) ? 0.f : (1.f / float(kBumpPerPass)); layScale *= fTexWaveFade[iTex]; fBumpPShader[i]->SetVector(plBumpPS::kWave0 + j, @@ -2866,9 +2866,9 @@ void plWaveSet7::IUpdateBumpVShader(plPipeline* pipe, const hsMatrix44& l2w, con { } -static inline hsScalar IRound(hsScalar f) +static inline float IRound(float f) { - return hsScalar(int(f + (f > 0 ? 0.5f : -0.5f))); + return float(int(f + (f > 0 ? 0.5f : -0.5f))); } void plWaveSet7::IUpdateBiasVShader() @@ -2877,24 +2877,24 @@ void plWaveSet7::IUpdateBiasVShader() if( fBiasVShader ) { // Can't just use GetDelSysSeconds() or else we lose time if we skip a frame render because of high FPS. - hsScalar dt = fLastTime > 0 ? hsScalar(fCurrTime - fLastTime) : hsTimer::GetDelSysSeconds(); - plConst(hsScalar) kRate(-0.1f); - hsScalar tx = kRate * dt; - hsScalar ty = kRate * dt; - plConst(hsScalar) kScaleU(4.f); - plConst(hsScalar) kScaleV(1.f); + float dt = fLastTime > 0 ? float(fCurrTime - fLastTime) : hsTimer::GetDelSysSeconds(); + plConst(float) kRate(-0.1f); + float tx = kRate * dt; + float ty = kRate * dt; + plConst(float) kScaleU(4.f); + plConst(float) kScaleV(1.f); tx += fBiasVShader->GetFloat(plBiasVS::kTexU0, 3); - tx -= hsScalar(int(tx)); + tx -= float(int(tx)); ty += fBiasVShader->GetFloat(plBiasVS::kTexV0, 3); - ty -= hsScalar(int(ty)); + ty -= float(int(ty)); - hsScalar scale = 1.f + (4.f - 1.f) * TexState().fAngleDev/hsScalarPI; + float scale = 1.f + (4.f - 1.f) * TexState().fAngleDev/M_PI; - hsScalar m00 = IRound(fWindDir.fY * scale); - hsScalar m01 = IRound(fWindDir.fX * scale); - hsScalar m10 = IRound(-fWindDir.fX * 4.f); - hsScalar m11 = IRound(fWindDir.fY * 4.f); + float m00 = IRound(fWindDir.fY * scale); + float m01 = IRound(fWindDir.fX * scale); + float m10 = IRound(-fWindDir.fX * 4.f); + float m11 = IRound(fWindDir.fY * 4.f); fBiasVShader->SetVector(plBiasVS::kTexU0, m00, @@ -2907,8 +2907,8 @@ void plWaveSet7::IUpdateBiasVShader() 0, ty); - plConst(hsScalar) kUpperNoiseOffU(0.f); - plConst(hsScalar) kUpperNoiseOffV(0.3f); + plConst(float) kUpperNoiseOffU(0.f); + plConst(float) kUpperNoiseOffV(0.3f); fBiasVShader->SetVector(plBiasVS::kTexU1, m00, m01, @@ -2921,7 +2921,7 @@ void plWaveSet7::IUpdateBiasVShader() ty + kUpperNoiseOffV); hsVector3 specVec = State().fSpecVec; - hsScalar biasScale = 0.5f * specVec[State().kNoise] / (hsScalar(kNumBumpShaders) + specVec[State().kNoise]); + float biasScale = 0.5f * specVec[State().kNoise] / (float(kNumBumpShaders) + specVec[State().kNoise]); fBiasVShader->SetVector(plBiasVS::kScaleBias, biasScale, biasScale, @@ -2990,7 +2990,7 @@ void plWaveSet7::IUpdateRipVShader(plPipeline* pipe, const hsMatrix44& l2w, cons int i; for( i = 0; i < kNumWaves; i++ ) { - normQ[i] = GeoState().fChop / (2.f*hsScalarPI * GeoState().fAmpOverLen * kNumWaves); + normQ[i] = GeoState().fChop / (2.f*M_PI * GeoState().fAmpOverLen * kNumWaves); } fRipVShader->SetVector(plRipVS::kQADirX, @@ -3062,10 +3062,10 @@ void plWaveSet7::IUpdateDecVShader(int t, plPipeline* pipe) hsPoint3 envCenter(State().fEnvCenter); - hsScalar envRadius = State().fEnvRadius; + float envRadius = State().fEnvRadius; hsVector3 camToCen(&envCenter, &worldCam); - hsScalar G = camToCen.MagnitudeSquared() - envRadius * envRadius; + float G = camToCen.MagnitudeSquared() - envRadius * envRadius; shader->SetVectorW(plWaveDecVS::kEnvAdjust, camToCen, G); } @@ -3074,7 +3074,7 @@ void plWaveSet7::IUpdateDecVShader(int t, plPipeline* pipe) int i; for( i = 0; i < kNumWaves; i++ ) { - normQ[i] = GeoState().fChop / (2.f*hsScalarPI * GeoState().fAmpOverLen * kNumWaves); + normQ[i] = GeoState().fChop / (2.f*M_PI * GeoState().fAmpOverLen * kNumWaves); } shader->SetVector(plWaveDecVS::kQADirX, @@ -3192,16 +3192,16 @@ void plWaveSet7::IUpdateShoreVShader(plPipeline* pipe, const hsMatrix44& l2w, co fWorldWaves[2].fLength, fWorldWaves[3].fLength); - plConst(hsScalar) kK1(2.f); - plConst(hsScalar) kK2(5.f); - hsScalar negK1OverK2Sq = -kK1 / (kK2 * kK2); + plConst(float) kK1(2.f); + plConst(float) kK2(5.f); + float negK1OverK2Sq = -kK1 / (kK2 * kK2); fShoreVShader->SetVector(plShoreVS::kIncline, negK1OverK2Sq, kK1, 0.f, 0.f); float normQ[kNumWaves]; int i; for( i = 0; i < kNumWaves; i++ ) { - normQ[i] = GeoState().fChop / (2.f*hsScalarPI * GeoState().fAmpOverLen * kNumWaves); + normQ[i] = GeoState().fChop / (2.f*M_PI * GeoState().fAmpOverLen * kNumWaves); } fShoreVShader->SetVector(plShoreVS::kQADirX, @@ -3258,18 +3258,18 @@ void plWaveSet7::IUpdateFixedVShader(plPipeline* pipe, const hsMatrix44& l2w, co fWorldWaves[2].fDir.fY, fWorldWaves[3].fDir.fY); - plCONST(hsScalar) kEnvRadius(500.f); - hsScalar envRadius = State().fEnvRadius; + plCONST(float) kEnvRadius(500.f); + float envRadius = State().fEnvRadius; hsPoint3 worldCam = pipe->GetViewTransform().GetCameraToWorld().GetTranslate(); hsPoint3 envCenter(State().fEnvCenter); hsVector3 camToCen(&envCenter, &worldCam); - hsScalar G = camToCen.MagnitudeSquared() - envRadius * envRadius; + float G = camToCen.MagnitudeSquared() - envRadius * envRadius; fFixedVShader->SetVectorW(plFixedVS7::kEnvAdjust, camToCen, G); - hsScalar texScale = 1.f / State().fRippleScale; + float texScale = 1.f / State().fRippleScale; fFixedVShader->SetVector(plFixedVS7::kUVScale, texScale, @@ -3277,21 +3277,21 @@ void plWaveSet7::IUpdateFixedVShader(plPipeline* pipe, const hsMatrix44& l2w, co 0, 0); - hsScalar specAtten = State().fTexState.fAmpOverLen * hsScalarPI * 2.f; + float specAtten = State().fTexState.fAmpOverLen * M_PI * 2.f; - plCONST(hsScalar) kScaleHack(0.1f); - hsScalar baseScale = kScaleHack; -// baseScale *= hsScalar(kBumpPerPass) * (hsScalar(kNumBumpShaders) + State().fSpecVec[State().kNoise]); + plCONST(float) kScaleHack(0.1f); + float baseScale = kScaleHack; +// baseScale *= float(kBumpPerPass) * (float(kNumBumpShaders) + State().fSpecVec[State().kNoise]); // Not sure what's right here. but we are currently scaling down by 1/(numBumpShaders + noise), // so I guess we want to scale up by that amount here. Not sure we shouldn't figuring in bumpperpass // on both, but at least now we're consistent. hsVector3 specVec = State().fSpecVec; - baseScale *= (hsScalar(kNumBumpShaders) + specVec[State().kNoise]); + baseScale *= (float(kNumBumpShaders) + specVec[State().kNoise]); baseScale *= (TexState().fChop + 1.f); - hsScalar specStart = specVec[State().kSpecStart]; - hsScalar specEnd = specVec[State().kSpecEnd]; + float specStart = specVec[State().kSpecStart]; + float specEnd = specVec[State().kSpecEnd]; if( specStart > specEnd ) specEnd = specStart + 1.f; fFixedVShader->SetVector(plFixedVS7::kSpecAtten, @@ -3349,7 +3349,7 @@ void plWaveSet7::IUpdateFixedVShader(plPipeline* pipe, const hsMatrix44& l2w, co int i; for( i = 0; i < kNumWaves; i++ ) { - normQ[i] = GeoState().fChop / (2.f*hsScalarPI * GeoState().fAmpOverLen * kNumWaves); + normQ[i] = GeoState().fChop / (2.f*M_PI * GeoState().fAmpOverLen * kNumWaves); } fFixedVShader->SetVector(plFixedVS7::kDirXK, @@ -3511,14 +3511,14 @@ void plWaveSet7::ICheckDecalEnvLayers(hsGMaterial* mat) } else { - refMsg = TRACKED_NEW plMatRefMsg(mat->GetKey(), plRefMsg::kOnRequest, i+1, plMatRefMsg::kLayer | plMatRefMsg::kInsert); + refMsg = new plMatRefMsg(mat->GetKey(), plRefMsg::kOnRequest, i+1, plMatRefMsg::kLayer | plMatRefMsg::kInsert); hsgResMgr::ResMgr()->SendRef(lay3->GetKey(), refMsg, plRefFlags::kActiveRef); } - refMsg = TRACKED_NEW plMatRefMsg(mat->GetKey(), plRefMsg::kOnRequest, i+2, plMatRefMsg::kLayer | plMatRefMsg::kInsert); + refMsg = new plMatRefMsg(mat->GetKey(), plRefMsg::kOnRequest, i+2, plMatRefMsg::kLayer | plMatRefMsg::kInsert); hsgResMgr::ResMgr()->SendRef(lay3->GetKey(), refMsg, plRefFlags::kActiveRef); - refMsg = TRACKED_NEW plMatRefMsg(mat->GetKey(), plRefMsg::kOnRequest, i+3, plMatRefMsg::kLayer | plMatRefMsg::kInsert); + refMsg = new plMatRefMsg(mat->GetKey(), plRefMsg::kOnRequest, i+3, plMatRefMsg::kLayer | plMatRefMsg::kInsert); hsgResMgr::ResMgr()->SendRef(lay3->GetKey(), refMsg, plRefFlags::kActiveRef); } } @@ -3556,7 +3556,7 @@ void plWaveSet7::ISetupDecal(hsGMaterial* mat) void plWaveSet7::AddShoreTest(plKey& key) { - hsgResMgr::ResMgr()->SendRef(key, TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnCreate, -1, kRefShore), plRefFlags::kPassiveRef); + hsgResMgr::ResMgr()->SendRef(key, new plGenRefMsg(GetKey(), plRefMsg::kOnCreate, -1, kRefShore), plRefFlags::kPassiveRef); plSceneObject* so = plSceneObject::ConvertNoRef(key->ObjectIsLoaded()); ICheckShoreMaterial(so); @@ -3610,7 +3610,7 @@ plDrawableSpans* plWaveSet7::ICreateGraphDrawable(plDrawableSpans* drawable, hsG int iDn = i << 1; int iUp = iDn + 1; - hsScalar delX = hsScalar(i) / hsScalar(nWid-1); + float delX = float(i) / float(nWid-1); pos[iDn].fX = delX * 2.f - 1.f; pos[iDn].fY = -1.f; @@ -3639,10 +3639,10 @@ plDrawableSpans* plWaveSet7::ICreateGraphDrawable(plDrawableSpans* drawable, hsG const int nTris = (nWid-1) * 2; - hsTArray idxArr; + hsTArray idxArr; idxArr.SetCount(nTris * 3); - UInt16* idx = idxArr.AcquireArray(); + uint16_t* idx = idxArr.AcquireArray(); int iBase = 0; for( i = 0; i < nTris; i += 2 ) @@ -3674,41 +3674,41 @@ plDrawableSpans* plWaveSet7::ICreateGraphDrawable(plDrawableSpans* drawable, hsG return drawable; } -plDrawableSpans* plWaveSet7::ICreateEmptyGraphDrawable(const char* name, UInt32 ref, int which) +plDrawableSpans* plWaveSet7::ICreateEmptyGraphDrawable(const char* name, uint32_t ref, int which) { - plDrawableSpans* drawable = TRACKED_NEW plDrawableSpans; + plDrawableSpans* drawable = new plDrawableSpans; plString buff = plString::Format("%s_%s_%d", GetKey()->GetName().c_str(), name, which); hsgResMgr::ResMgr()->NewKey(buff, drawable, GetKey()->GetUoid().GetLocation()); - hsgResMgr::ResMgr()->SendRef(drawable->GetKey(), TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnRequest, which, (Int8)ref), plRefFlags::kActiveRef); + hsgResMgr::ResMgr()->SendRef(drawable->GetKey(), new plGenRefMsg(GetKey(), plRefMsg::kOnRequest, which, (int8_t)ref), plRefFlags::kActiveRef); return drawable; } -hsGMaterial* plWaveSet7::ICreateEmptyMaterial(const char* name, UInt32 ref, int which) +hsGMaterial* plWaveSet7::ICreateEmptyMaterial(const char* name, uint32_t ref, int which) { - hsGMaterial* mat = TRACKED_NEW hsGMaterial; + hsGMaterial* mat = new hsGMaterial; plString buff = plString::Format("%s_%s_%d", GetKey()->GetName().c_str(), name, which); hsgResMgr::ResMgr()->NewKey(buff, mat, GetKey()->GetUoid().GetLocation()); - hsgResMgr::ResMgr()->SendRef(mat->GetKey(), TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnRequest, which, (Int8)ref), plRefFlags::kActiveRef); + hsgResMgr::ResMgr()->SendRef(mat->GetKey(), new plGenRefMsg(GetKey(), plRefMsg::kOnRequest, which, (int8_t)ref), plRefFlags::kActiveRef); return mat; } plLayer* plWaveSet7::ICreateBlankLayer(const char* name, int suff) { - plLayer* lay = TRACKED_NEW plLayer; + plLayer* lay = new plLayer; plString buff = plString::Format("%s_%s_%d", GetKey()->GetName().c_str(), name, suff); hsgResMgr::ResMgr()->NewKey(buff, lay, GetKey()->GetUoid().GetLocation()); return lay; } -plMipmap* plWaveSet7::ICreateBlankTex(const char* name, int width, int height, UInt32 ref) +plMipmap* plWaveSet7::ICreateBlankTex(const char* name, int width, int height, uint32_t ref) { - plMipmap* mipMap = TRACKED_NEW plMipmap( + plMipmap* mipMap = new plMipmap( width, height, plMipmap::kARGB32Config, 1, @@ -3718,7 +3718,7 @@ plMipmap* plWaveSet7::ICreateBlankTex(const char* name, int width, int height, U plString buff = plString::Format("%s_%s", GetKey()->GetName().c_str(), name); hsgResMgr::ResMgr()->NewKey(buff, mipMap, GetKey()->GetUoid().GetLocation()); - hsgResMgr::ResMgr()->SendRef(mipMap->GetKey(), TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnRequest, 0, (Int8)ref), plRefFlags::kActiveRef); + hsgResMgr::ResMgr()->SendRef(mipMap->GetKey(), new plGenRefMsg(GetKey(), plRefMsg::kOnRequest, 0, (int8_t)ref), plRefFlags::kActiveRef); return mipMap; } @@ -3737,8 +3737,8 @@ plMipmap* plWaveSet7::ICreateGraphShoreTex(int width, int height) { plMipmap* mipMap = ICreateBlankTex("Graph", width, height, kRefGraphShoreTex); - plConst(hsScalar) kRampFrac(0.4f); - plConst(hsScalar) kTruncFrac(0.8f); + plConst(float) kRampFrac(0.4f); + plConst(float) kTruncFrac(0.8f); const int rampEnd = int(kRampFrac * height + 0.5f); int truncEnd = int(kTruncFrac * height); if( truncEnd >= (height-1) ) @@ -3746,7 +3746,7 @@ plMipmap* plWaveSet7::ICreateGraphShoreTex(int width, int height) int j; for( j = 0; j < height; j++ ) { - UInt32 alpha = 255; + uint32_t alpha = 255; plConst(int) kRampStart(4); if( j <= kRampStart ) { @@ -3761,7 +3761,7 @@ plMipmap* plWaveSet7::ICreateGraphShoreTex(int width, int height) { alpha = 0; } - UInt32 color = (alpha << 24) + uint32_t color = (alpha << 24) | (0xff << 16) | (0xff << 8) | 0xff; @@ -3769,7 +3769,7 @@ plMipmap* plWaveSet7::ICreateGraphShoreTex(int width, int height) int i; for( i = 0; i < width; i++ ) { - UInt32* val = mipMap->GetAddr32(i, j); + uint32_t* val = mipMap->GetAddr32(i, j); *val = color; } } @@ -3787,7 +3787,7 @@ void plWaveSet7::IRefillBubbleShoreTex() const int height = mipMap->GetHeight(); // Initialize to white opaque. - memset(mipMap->GetAddr32(0,0), 0xff, width*height*sizeof(UInt32)); + memset(mipMap->GetAddr32(0,0), 0xff, width*height*sizeof(uint32_t)); plConst(int) kMinNumBub(1024); plConst(int) kMaxNumBub(6000); @@ -3800,10 +3800,10 @@ void plWaveSet7::IRefillBubbleShoreTex() int jLoc = (int)(fRand.RandZeroToOne() * height); // Select a random radius - plConst(hsScalar) kMinRad(2.f); - plConst(hsScalar) kMaxRad(5.0f); + plConst(float) kMinRad(2.f); + plConst(float) kMaxRad(5.0f); int radius = int(kMinRad + fRand.RandZeroToOne() * (kMaxRad - kMinRad)); - hsScalar invRadiusSq = 1.f / hsScalar(radius*radius); + float invRadiusSq = 1.f / float(radius*radius); // Carve out a hole. int j; @@ -3824,17 +3824,17 @@ void plWaveSet7::IRefillBubbleShoreTex() else if( ii >= width ) ii -= width; - hsScalar f = hsScalar(i*i + j*j) * invRadiusSq; + float f = float(i*i + j*j) * invRadiusSq; if( f > 1.f ) f = 1.f; - plConst(hsScalar) kMinAlpha(0.8f); - plConst(hsScalar) kMaxAlpha(1.f); + plConst(float) kMinAlpha(0.8f); + plConst(float) kMaxAlpha(1.f); f *= (kMaxAlpha - kMinAlpha); f += kMinAlpha; - UInt32* val = mipMap->GetAddr32(ii, jj); - UInt32 alpha = (*val) >> 24; - alpha = UInt32(hsScalar(alpha) * f); + uint32_t* val = mipMap->GetAddr32(ii, jj); + uint32_t alpha = (*val) >> 24; + alpha = uint32_t(float(alpha) * f); *val &= 0x00ffffff; *val |= (alpha << 24); } @@ -3849,10 +3849,10 @@ void plWaveSet7::IRefillBubbleShoreTex() int i; for( i = 0; i < width; i++ ) { - UInt32* val = mipMap->GetAddr32(i, j); + uint32_t* val = mipMap->GetAddr32(i, j); hsColorRGBA col; col.FromARGB32(*val); - hsScalar alpha = col.a; + float alpha = col.a; col = maxColor - minColor; col *= alpha; col += minColor; @@ -3890,8 +3890,8 @@ void plWaveSet7::IRefillEdgeShoreTex() const int width = mipMap->GetWidth(); const int height = mipMap->GetHeight(); - plConst(hsScalar) kCenter(0.8f); - plConst(hsScalar) kRadius(0.025f); + plConst(float) kCenter(0.8f); + plConst(float) kRadius(0.025f); const int center = int(kCenter * height); @@ -3899,45 +3899,45 @@ void plWaveSet7::IRefillEdgeShoreTex() const int top = center + radius; const int bot = center - radius; - const hsScalar invRadiusSq = 1.f / hsScalar(radius*radius); + const float invRadiusSq = 1.f / float(radius*radius); hsAssert(top < height-1, "Center too high or radius too big"); - const hsScalar maxAlpha = State().fEdgeOpac * 255.9f; + const float maxAlpha = State().fEdgeOpac * 255.9f; int j; for( j = 0; j < height; j++ ) { - UInt32 alpha = 0; + uint32_t alpha = 0; if( (j > bot)&&(j < top) ) { #if 0 // like x^2 - hsScalar a = hsScalar(j-center); + float a = float(j-center); a *= a; a *= invRadiusSq; a = 1.f - a; #elif 1 // like 1/x^2 - hsScalar a = hsScalar(j-center); + float a = float(j-center); if( a < 0 ) a = -a; - a /= hsScalar(radius); + a /= float(radius); a = 1.f - a; a *= a; #else // like cos - hsScalar a = hsScalar(j - center); - a /= hsScalar(radius); - a *= hsScalarPI; + float a = float(j - center); + a /= float(radius); + a *= M_PI; a = hsFastMath::CosInRange(a); a += 1.f; a *= 0.5f; #endif - alpha = UInt32(a * maxAlpha); + alpha = uint32_t(a * maxAlpha); } int i; for( i = 0; i < width; i++ ) { - UInt32* val = mipMap->GetAddr32(i, j); + uint32_t* val = mipMap->GetAddr32(i, j); *val = (alpha << 24) | (alpha << 16) | (alpha << 8) @@ -3971,7 +3971,7 @@ plMipmap* plWaveSet7::ICreateEdgeShoreTex(int width, int height) void plWaveSet7::ISetAsTexture(plLayer* lay, plBitmap* tex) { hsAssert(lay && tex, "Trying to set nil texture or nil layer"); - plLayRefMsg* refMsg = TRACKED_NEW plLayRefMsg(lay->GetKey(), plRefMsg::kOnRequest, 0, plLayRefMsg::kTexture); + plLayRefMsg* refMsg = new plLayRefMsg(lay->GetKey(), plRefMsg::kOnRequest, 0, plLayRefMsg::kTexture); hsgResMgr::ResMgr()->SendRef(tex->GetKey(), refMsg, plRefFlags::kActiveRef); } @@ -4120,7 +4120,7 @@ void plWaveSet7::IAddGraphVShader(hsGMaterial* mat, int iPass) { if( !fGraphVShader[iPass] ) { - plShader* vShader = TRACKED_NEW plShader; + plShader* vShader = new plShader; plString buff = plString::Format("%s_GraphVS_%d", GetKey()->GetName().c_str(), iPass); hsgResMgr::ResMgr()->NewKey(buff, vShader, GetKey()->GetUoid().GetLocation()); vShader->SetIsPixelShader(false); @@ -4128,7 +4128,7 @@ void plWaveSet7::IAddGraphVShader(hsGMaterial* mat, int iPass) vShader->SetNumConsts(plGraphVS::kNumConsts); vShader->SetVector(plGraphVS::kNumericConsts, 0, 0.5f, 1.f, 2.f); - vShader->SetVector(plGraphVS::kPiConsts, 1.f / (2.f*hsScalarPI), hsScalarPI/2.f, hsScalarPI, hsScalarPI*2.f); + vShader->SetVector(plGraphVS::kPiConsts, 1.f / (2.f*M_PI), M_PI/2.f, M_PI, M_PI*2.f); vShader->SetVector(plGraphVS::kCosConsts, 1.f, -1.f/2.f, 1.f/24.f, -1.f/720.f); #ifndef TEST_UVWS @@ -4142,7 +4142,7 @@ void plWaveSet7::IAddGraphVShader(hsGMaterial* mat, int iPass) // vShader->SetShaderFileName("sha/vs_WaveGraph2.inl"); vShader->SetDecl(plShaderTable::Decl(vs_WaveGraph2)); - hsgResMgr::ResMgr()->SendRef(vShader->GetKey(), TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnRequest, iPass, kRefGraphVShader), plRefFlags::kActiveRef); + hsgResMgr::ResMgr()->SendRef(vShader->GetKey(), new plGenRefMsg(GetKey(), plRefMsg::kOnRequest, iPass, kRefGraphVShader), plRefFlags::kActiveRef); hsAssert(fGraphVShader[iPass] == vShader, "SendRef should have set shader"); } @@ -4154,7 +4154,7 @@ void plWaveSet7::IAddGraphPShader(hsGMaterial* mat, int iPass) { if( !fGraphPShader[iPass] ) { - plShader* pShader = TRACKED_NEW plShader; + plShader* pShader = new plShader; plString buff = plString::Format("%s_GraphPS_%d", GetKey()->GetName().c_str(), iPass); hsgResMgr::ResMgr()->NewKey(buff, pShader, GetKey()->GetUoid().GetLocation()); pShader->SetIsPixelShader(true); @@ -4167,7 +4167,7 @@ void plWaveSet7::IAddGraphPShader(hsGMaterial* mat, int iPass) // pShader->SetShaderFileName("sha/ps_WaveGraph.inl"); pShader->SetDecl(plShaderTable::Decl(ps_WaveGraph)); - hsgResMgr::ResMgr()->SendRef(pShader->GetKey(), TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnRequest, iPass, kRefGraphPShader), plRefFlags::kActiveRef); + hsgResMgr::ResMgr()->SendRef(pShader->GetKey(), new plGenRefMsg(GetKey(), plRefMsg::kOnRequest, iPass, kRefGraphPShader), plRefFlags::kActiveRef); hsAssert(fGraphPShader[iPass] == pShader, "SendRef should have set shader"); } @@ -4182,10 +4182,10 @@ plRenderTarget* plWaveSet7::ISetupGraphShoreRenderReq(int which) sprintf(name, "Graph_%d", which); plRenderTarget* rt = ICreateTransferRenderTarget(name, kGraphSize); - hsgResMgr::ResMgr()->SendRef(rt->GetKey(), TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnRequest, which, kRefGraphShoreRT), plRefFlags::kActiveRef); + hsgResMgr::ResMgr()->SendRef(rt->GetKey(), new plGenRefMsg(GetKey(), plRefMsg::kOnRequest, which, kRefGraphShoreRT), plRefFlags::kActiveRef); fGraphReq[which] = ICreateRenderRequest(rt, fGraphShoreDraw[which], -100.f); - fGraphReqMsg[which] = TRACKED_NEW plRenderRequestMsg(GetKey(), fGraphReq[which]); + fGraphReqMsg[which] = new plRenderRequestMsg(GetKey(), fGraphReq[which]); return rt; } @@ -4228,7 +4228,7 @@ void plWaveSet7::IMakeShoreLayer(hsGMaterial* mat, int which) plString name; if( which >= mat->GetNumLayers() ) { - plLayer* lay = TRACKED_NEW plLayer; + plLayer* lay = new plLayer; name = plString::Format("%s_lay_%d", mat->GetKey()->GetName().c_str(), which); hsgResMgr::ResMgr()->NewKey(name, lay, GetKey()->GetUoid().GetLocation()); @@ -4306,9 +4306,9 @@ void plWaveSet7::IInitGraph(int iPass) static int lastOne = 0; - plConst(hsScalar) kBasePeriod(3.f); - hsScalar life = State().fPeriod * kBasePeriod * (1.f + fRand.RandZeroToOne()); - gs.fInvLife = (1.f + hsScalar(lastOne)/hsScalar(kGraphShorePasses-1)) / life; + plConst(float) kBasePeriod(3.f); + float life = State().fPeriod * kBasePeriod * (1.f + fRand.RandZeroToOne()); + gs.fInvLife = (1.f + float(lastOne)/float(kGraphShorePasses-1)) / life; lastOne = !lastOne; @@ -4321,7 +4321,7 @@ void plWaveSet7::IInitGraph(int iPass) { // Okay, phase we don't have to think too hard about, // it doesn't matter as long as it's random. - gs.fPhase[i] = fRand.RandZeroToOne() * 2.f * hsScalarPI; + gs.fPhase[i] = fRand.RandZeroToOne() * 2.f * M_PI; // Next up is frequency, but frequency is the hard one. // Remember frequency has to preserve tiling, so freq = k * 2 * PI. @@ -4342,16 +4342,16 @@ void plWaveSet7::IInitGraph(int iPass) } // Input will be in range [0..2], so we'll omit the customary 2*PI here. - gs.fFreq[i] = k * hsScalarPI; + gs.fFreq[i] = k * M_PI; // Amplitude depends on freqency, or roughly inversely proportional // to frequency (randomized about linear on period). // Divide by 4 because that's how many oscillators we have, and they // are summed. - hsScalar period = 1.f / hsScalar(k); - plConst(hsScalar) kAmpScale(1.f / 4.f / 2.f); - plConst(hsScalar) kMinPeriodFrac(1.f); - plConst(hsScalar) kMaxPeriodFrac(2.f); + float period = 1.f / float(k); + plConst(float) kAmpScale(1.f / 4.f / 2.f); + plConst(float) kMinPeriodFrac(1.f); + plConst(float) kMaxPeriodFrac(2.f); period *= kMinPeriodFrac + fRand.RandZeroToOne() * (kMaxPeriodFrac - kMinPeriodFrac); period *= kAmpScale; gs.fAmp[i] = period; @@ -4383,7 +4383,7 @@ void plWaveSet7::IShuffleDownGraphs(int iPass) IInitGraph(kGraphShorePasses-1); } -void plWaveSet7::IUpdateGraphShader(hsScalar dt, int iPass) +void plWaveSet7::IUpdateGraphShader(float dt, int iPass) { if( fGraphShoreDraw[iPass] ) { @@ -4391,15 +4391,15 @@ void plWaveSet7::IUpdateGraphShader(hsScalar dt, int iPass) plShader* shader = fGraphVShader[iPass]; gs.fAge += dt; - hsScalar rads = gs.fAge * gs.fInvLife; - if( rads >= hsScalarPI ) + float rads = gs.fAge * gs.fInvLife; + if( rads >= M_PI ) { // Recycle this one and restart the upper. IShuffleDownGraphs(iPass); } else { - hsScalar sinAge = hsFastMath::SinInRange(rads); + float sinAge = hsFastMath::SinInRange(rads); shader->SetVector(plGraphVS::kAmplitude, gs.fAmp[0] * sinAge, @@ -4413,11 +4413,11 @@ void plWaveSet7::IUpdateGraphShader(hsScalar dt, int iPass) tint.a *= sinAge; shader->SetColor(plGraphVS::kColor, tint); - plConst(hsScalar) kCMax(1.f); - plConst(hsScalar) kCMin(3.f); - hsScalar cMin = kCMax + (kCMin - kCMax) * State().fFingerLength; - plConst(hsScalar) k2ndLayerScale(2.f); - plConst(hsScalar) k2ndLayerVoff(1.5f); + plConst(float) kCMax(1.f); + plConst(float) kCMin(3.f); + float cMin = kCMax + (kCMin - kCMax) * State().fFingerLength; + plConst(float) k2ndLayerScale(2.f); + plConst(float) k2ndLayerVoff(1.5f); shader->SetVector(plGraphVS::kUVWConsts, (kCMax - cMin) * sinAge + cMin, gs.fUOff, @@ -4427,7 +4427,7 @@ void plWaveSet7::IUpdateGraphShader(hsScalar dt, int iPass) } } -void plWaveSet7::IUpdateGraphShaders(plPipeline* pipe, hsScalar dt) +void plWaveSet7::IUpdateGraphShaders(plPipeline* pipe, float dt) { if( fGraphShoreDraw[0] ) { diff --git a/Sources/Plasma/PubUtilLib/plDrawable/plWaveSet7.h b/Sources/Plasma/PubUtilLib/plDrawable/plWaveSet7.h index 4d11644d..90207cf8 100644 --- a/Sources/Plasma/PubUtilLib/plDrawable/plWaveSet7.h +++ b/Sources/Plasma/PubUtilLib/plDrawable/plWaveSet7.h @@ -81,11 +81,11 @@ class plWorldWaveData7 { public: hsPoint3 fDir; - hsScalar fLength; + float fLength; - hsScalar fFreq; - hsScalar fPhase; - hsScalar fAmplitude; + float fFreq; + float fPhase; + float fAmplitude; }; class plWorldWave7 : public plWorldWaveData7 @@ -180,30 +180,30 @@ protected: plStatusLog* fStatusLog; plGraphPlate* fStatusGraph; - UInt32 fTrialUpdate; + uint32_t fTrialUpdate; plFixedWaterState7 fState; - hsScalar fScrunchLen; - hsScalar fScrunchScale; + float fScrunchLen; + float fScrunchScale; hsVector3 fWindDir; - hsScalar fMinLen; - hsScalar fMaxLen; - hsScalar fFreqScale; + float fMinLen; + float fMaxLen; + float fFreqScale; - hsScalar fTransCountDown; + float fTransCountDown; int fTransistor; - hsScalar fTransDel; + float fTransDel; - hsScalar fTexTransCountDown; + float fTexTransCountDown; int fTexTrans; - hsScalar fTexTransDel; - hsScalar fTexWaveFade[kNumTexWaves]; + float fTexTransDel; + float fTexWaveFade[kNumTexWaves]; plWorldWave7 fWorldWaves[kNumWaves]; - hsScalar fFreqMod[kNumWaves]; + float fFreqMod[kNumWaves]; plRandom fRand; @@ -233,8 +233,8 @@ protected: plShader* fBiasPShader; plBitmap* fEnvMap; - UInt32 fEnvSize; - hsScalar fEnvRefresh; + uint32_t fEnvSize; + float fEnvRefresh; plLayer* fFixedLayers[4]; @@ -321,24 +321,24 @@ protected: class TexWaveDesc { public: - hsScalar fPhase; - hsScalar fAmp; - hsScalar fLen; - hsScalar fFreq; - hsScalar fDirX; - hsScalar fDirY; - hsScalar fRotScale00; - hsScalar fRotScale01; + float fPhase; + float fAmp; + float fLen; + float fFreq; + float fDirX; + float fDirY; + float fRotScale00; + float fRotScale01; }; TexWaveDesc fTexWaves[kNumTexWaves]; class TexWaveWindDep { public: - hsScalar fWindSpeed; + float fWindSpeed; - hsScalar fHeight; - hsScalar fSpecular; + float fHeight; + float fSpecular; }; TexWaveWindDep fWindDeps[kNumWindDep]; @@ -348,47 +348,47 @@ protected: inline void IScrunch(hsPoint3& pos, hsVector3& norm) const; - void ICalcWindow(hsScalar dt); + void ICalcWindow(float dt); void ICalcScale(); - void IUpdateWaves(hsScalar dt); - void IUpdateWave(hsScalar dt, int i); + void IUpdateWaves(float dt); + void IUpdateWave(float dt, int i); hsBool IAnyBoundsVisible(plPipeline* pipe) const; void IInitWave(int i); void IReInitWaves(); void IUpdateRefObject(); - void IUpdateWindDir(hsScalar dt); + void IUpdateWindDir(float dt); void IShiftCenter(plSceneObject* so) const; - void IFloatBuoys(hsScalar dt); - void IFloatBuoy(hsScalar dt, plSceneObject* so); + void IFloatBuoys(float dt); + void IFloatBuoy(float dt, plSceneObject* so); // Bookkeeping void IAddTarget(const plKey& key); void IRemoveTarget(const plKey& key); - void ISetWindSpeed(hsScalar s); + void ISetWindSpeed(float s); hsBool IOnReceive(plGenRefMsg* refMsg); hsBool IOnRemove(plGenRefMsg* refMsg); - hsBool ITransContinue(hsScalar dt); - void IStartTransition(hsScalar dt); - hsScalar ITransitionDelay() const; - void ITransition(hsScalar dt); + hsBool ITransContinue(float dt); + void IStartTransition(float dt); + float ITransitionDelay() const; + void ITransition(float dt); - hsBool ITransTexContinue(hsScalar dt); - void IStartTexTransition(hsScalar dt); - void ITransTex(hsScalar dt); + hsBool ITransTexContinue(float dt); + void IStartTexTransition(float dt); + void ITransTex(float dt); void IInitTexWave(int i); void ISetupTextureWaves(); - void IUpdateLayers(hsScalar dt); - void IUpdateBumpLayers(hsScalar dt); + void IUpdateLayers(float dt); + void IUpdateBumpLayers(float dt); - plRenderRequest* ICreateRenderRequest(plRenderTarget* rt, plDrawableSpans* draw, hsScalar pri); + plRenderRequest* ICreateRenderRequest(plRenderTarget* rt, plDrawableSpans* draw, float pri); void ISubmitRenderRequests(); plRenderTarget* ICreateTransferRenderTarget(const char* name, int size); @@ -398,7 +398,7 @@ protected: plMipmap* ICreateBiasNoiseMap(); void IAddBumpBiasLayer(hsGMaterial* mat); - plMipmap* ICreateBumpBitmapFFP(hsScalar amp, hsScalar dx, hsScalar dy) const; + plMipmap* ICreateBumpBitmapFFP(float amp, float dx, float dy) const; hsGMaterial* ICreateBumpLayersFFP(); plMipmap* ICreateBumpMipmapPS(); plLayer* ICreateBumpLayerPS(plMipmap* mipMap, hsGMaterial* bumpMat, int which); @@ -413,10 +413,10 @@ protected: void ICheckTargetMaterials(); plDrawableSpans* ICreateGraphDrawable(plDrawableSpans* drawable, hsGMaterial* mat, int nWid); - plDrawableSpans* ICreateEmptyGraphDrawable(const char* name, UInt32 ref, int wich); - hsGMaterial* ICreateEmptyMaterial(const char* name, UInt32 ref, int which); + plDrawableSpans* ICreateEmptyGraphDrawable(const char* name, uint32_t ref, int wich); + hsGMaterial* ICreateEmptyMaterial(const char* name, uint32_t ref, int which); plLayer* ICreateBlankLayer(const char* name, int suff); - plMipmap* ICreateBlankTex(const char* name, int width, int height, UInt32 ref); + plMipmap* ICreateBlankTex(const char* name, int width, int height, uint32_t ref); plMipmap* ICreateGraphShoreTex(int width, int height); plMipmap* ICreateBubbleShoreTex(int width, int height); void IRefillBubbleShoreTex(); @@ -440,12 +440,12 @@ protected: void IAddGraphPShader(hsGMaterial* mat, int iPass); void IAddGraphVShader(hsGMaterial* mat, int iPass); - void IUpdateGraphShader(hsScalar dt, int iPass); + void IUpdateGraphShader(float dt, int iPass); void IInitGraph(int iPass); void IShuffleDownGraphs(int iPass); // type is either plLayRefMsg::kVertexShader or plLayRefMsg::kPixelShader. - void IAddShaderToLayers(hsGMaterial* mat, int iFirst, int iLast, UInt8 type, plShader* shader); + void IAddShaderToLayers(hsGMaterial* mat, int iFirst, int iLast, uint8_t type, plShader* shader); void IAddBumpPixelShader(hsGMaterial* mat, int iShader, int iFirst, int iLast); void IAddBumpVertexShader(hsGMaterial* mat, int iShader, int iFirst, int iLast); @@ -474,7 +474,7 @@ protected: void IUpdateShoreVShader(plPipeline* pipe, const hsMatrix44& l2w, const hsMatrix44& w2l); void IUpdateFixedVShader(plPipeline* pipe, const hsMatrix44& l2w, const hsMatrix44& w2l); void IUpdateFixedPShader(plPipeline* pipe, const hsMatrix44& l2w, const hsMatrix44& w2l); - void IUpdateGraphShaders(plPipeline* pipe, hsScalar dt); + void IUpdateGraphShaders(plPipeline* pipe, float dt); void IUpdateDecVShader(int t, plPipeline* pipe); void IUpdateDecVShaders(plPipeline* pipe, const hsMatrix44& l2w, const hsMatrix44& w2l); @@ -482,9 +482,9 @@ protected: virtual int IDecalRef() const { return kRefDecal; } inline void LogF(const char *format, ...) const; - inline void LogF(UInt32 color, const char *format, ...) const; + inline void LogF(uint32_t color, const char *format, ...) const; inline void IRestartLog() const; - inline void GraphLen(hsScalar len) const; + inline void GraphLen(float len) const; inline void IRestartGraph() const; public: @@ -496,14 +496,14 @@ public: virtual hsBool MsgReceive(plMessage* msg); - virtual hsBool IEval(double secs, hsScalar del, UInt32 dirty) { return false; } + virtual hsBool IEval(double secs, float del, uint32_t dirty) { return false; } - Int32 GetNumProperties() const { return kNumProps; } + int32_t GetNumProperties() const { return kNumProps; } virtual void Read(hsStream* stream, hsResMgr* mgr); virtual void Write(hsStream* stream, hsResMgr* mgr); - hsScalar EvalPoint(hsPoint3& pos, hsVector3& norm); + float EvalPoint(hsPoint3& pos, hsVector3& norm); // Getters and Setters for Python twiddling // @@ -512,112 +512,112 @@ public: // // Geometric wave parameters. These are all safe to twiddle at any time or speed. // The new settings take effect as new waves are spawned. - void SetGeoMaxLength(hsScalar s, hsScalar secs=0) { fState.fGeoState.fMaxLength.Set(s, secs); } - void SetGeoMinLength(hsScalar s, hsScalar secs=0) { fState.fGeoState.fMinLength.Set(s, secs); } - void SetGeoAmpOverLen(hsScalar s, hsScalar secs=0) { fState.fGeoState.fAmpOverLen.Set(s, secs); } - void SetGeoChop(hsScalar s, hsScalar secs=0) { fState.fGeoState.fChop.Set(s, secs); } - void SetGeoAngleDev(hsScalar s, hsScalar secs=0) { fState.fGeoState.fAngleDev.Set(s, secs); } + void SetGeoMaxLength(float s, float secs=0) { fState.fGeoState.fMaxLength.Set(s, secs); } + void SetGeoMinLength(float s, float secs=0) { fState.fGeoState.fMinLength.Set(s, secs); } + void SetGeoAmpOverLen(float s, float secs=0) { fState.fGeoState.fAmpOverLen.Set(s, secs); } + void SetGeoChop(float s, float secs=0) { fState.fGeoState.fChop.Set(s, secs); } + void SetGeoAngleDev(float s, float secs=0) { fState.fGeoState.fAngleDev.Set(s, secs); } // Texture wave parameters. Safe to twiddle any time or speed. // The new settings take effect as new waves are spawned. - void SetTexMaxLength(hsScalar s, hsScalar secs=0) { fState.fTexState.fMaxLength.Set(s, secs); } - void SetTexMinLength(hsScalar s, hsScalar secs=0) { fState.fTexState.fMinLength.Set(s, secs); } - void SetTexAmpOverLen(hsScalar s, hsScalar secs=0) { fState.fTexState.fAmpOverLen.Set(s, secs); } - void SetTexChop(hsScalar s, hsScalar secs=0) { fState.fTexState.fChop.Set(s, secs); } - void SetTexAngleDev(hsScalar s, hsScalar secs=0) { fState.fTexState.fAngleDev.Set(s, secs); } + void SetTexMaxLength(float s, float secs=0) { fState.fTexState.fMaxLength.Set(s, secs); } + void SetTexMinLength(float s, float secs=0) { fState.fTexState.fMinLength.Set(s, secs); } + void SetTexAmpOverLen(float s, float secs=0) { fState.fTexState.fAmpOverLen.Set(s, secs); } + void SetTexChop(float s, float secs=0) { fState.fTexState.fChop.Set(s, secs); } + void SetTexAngleDev(float s, float secs=0) { fState.fTexState.fAngleDev.Set(s, secs); } // The size in feet of one tile of the ripple texture. If you change this (I don't // recommend it), you need to change it very slowly or it will look very stupid. - void SetRippleScale(hsScalar s, hsScalar secs=0) { fState.fRippleScale.Set(s, secs); } + void SetRippleScale(float s, float secs=0) { fState.fRippleScale.Set(s, secs); } // The direction the wind is blowing (waves will be more or less perpindicular to wind dir). // Change somewhat slowly, like over 30 seconds. - void SetWindDir(const hsVector3& s, hsScalar secs=0) { fState.fWindDir.Set(s, secs); } + void SetWindDir(const hsVector3& s, float secs=0) { fState.fWindDir.Set(s, secs); } // Change these gently, effect is immediate. - void SetSpecularNoise(hsScalar s, hsScalar secs=0) { hsVector3 spec = fState.fSpecVec; spec[plFixedWaterState7::kNoise] = s; fState.fSpecVec.Set(spec, secs); } - void SetSpecularStart(hsScalar s, hsScalar secs=0) { hsVector3 spec = fState.fSpecVec; spec[plFixedWaterState7::kSpecStart] = s; fState.fSpecVec.Set(spec, secs); } - void SetSpecularEnd(hsScalar s, hsScalar secs=0) { hsVector3 spec = fState.fSpecVec; spec[plFixedWaterState7::kSpecEnd] = s; fState.fSpecVec.Set(spec, secs); } + void SetSpecularNoise(float s, float secs=0) { hsVector3 spec = fState.fSpecVec; spec[plFixedWaterState7::kNoise] = s; fState.fSpecVec.Set(spec, secs); } + void SetSpecularStart(float s, float secs=0) { hsVector3 spec = fState.fSpecVec; spec[plFixedWaterState7::kSpecStart] = s; fState.fSpecVec.Set(spec, secs); } + void SetSpecularEnd(float s, float secs=0) { hsVector3 spec = fState.fSpecVec; spec[plFixedWaterState7::kSpecEnd] = s; fState.fSpecVec.Set(spec, secs); } // Water Height is overriden if the ref object is animated. - void SetWaterHeight(hsScalar s, hsScalar secs=0) { fState.fWaterHeight.Set(s, secs); } + void SetWaterHeight(float s, float secs=0) { fState.fWaterHeight.Set(s, secs); } // Water Offset and DepthFalloff are complicated, and not immediately interesting to animate. - void SetWaterOffset(const hsVector3& s, hsScalar secs=0) { fState.fWaterOffset.Set(s, secs); } - void SetOpacOffset(hsScalar s, hsScalar secs=0) { hsVector3 off = fState.fWaterOffset; off.fX = s; fState.fWaterOffset.Set(off, secs); } - void SetReflOffset(hsScalar s, hsScalar secs=0) { hsVector3 off = fState.fWaterOffset; off.fY = s; fState.fWaterOffset.Set(off, secs); } - void SetWaveOffset(hsScalar s, hsScalar secs=0) { hsVector3 off = fState.fWaterOffset; off.fZ = s; fState.fWaterOffset.Set(off, secs); } - void SetDepthFalloff(const hsVector3& s, hsScalar secs=0) { fState.fDepthFalloff.Set(s, secs); } - void SetOpacFalloff(hsScalar s, hsScalar secs=0) { hsVector3 off = fState.fDepthFalloff; off.fX = s; fState.fDepthFalloff.Set(off, secs); } - void SetReflFalloff(hsScalar s, hsScalar secs=0) { hsVector3 off = fState.fDepthFalloff; off.fY = s; fState.fDepthFalloff.Set(off, secs); } - void SetWaveFalloff(hsScalar s, hsScalar secs=0) { hsVector3 off = fState.fDepthFalloff; off.fZ = s; fState.fDepthFalloff.Set(off, secs); } + void SetWaterOffset(const hsVector3& s, float secs=0) { fState.fWaterOffset.Set(s, secs); } + void SetOpacOffset(float s, float secs=0) { hsVector3 off = fState.fWaterOffset; off.fX = s; fState.fWaterOffset.Set(off, secs); } + void SetReflOffset(float s, float secs=0) { hsVector3 off = fState.fWaterOffset; off.fY = s; fState.fWaterOffset.Set(off, secs); } + void SetWaveOffset(float s, float secs=0) { hsVector3 off = fState.fWaterOffset; off.fZ = s; fState.fWaterOffset.Set(off, secs); } + void SetDepthFalloff(const hsVector3& s, float secs=0) { fState.fDepthFalloff.Set(s, secs); } + void SetOpacFalloff(float s, float secs=0) { hsVector3 off = fState.fDepthFalloff; off.fX = s; fState.fDepthFalloff.Set(off, secs); } + void SetReflFalloff(float s, float secs=0) { hsVector3 off = fState.fDepthFalloff; off.fY = s; fState.fDepthFalloff.Set(off, secs); } + void SetWaveFalloff(float s, float secs=0) { hsVector3 off = fState.fDepthFalloff; off.fZ = s; fState.fDepthFalloff.Set(off, secs); } // Max and Min Atten aren't very interesting, and will probably go away. - void SetMaxAtten(const hsVector3& s, hsScalar secs=0) { fState.fMaxAtten.Set(s, secs); } - void SetMinAtten(const hsVector3& s, hsScalar secs=0) { fState.fMinAtten.Set(s, secs); } + void SetMaxAtten(const hsVector3& s, float secs=0) { fState.fMaxAtten.Set(s, secs); } + void SetMinAtten(const hsVector3& s, float secs=0) { fState.fMinAtten.Set(s, secs); } // Skipping the shore parameters, because they are never used. // Water colors, adjust slowly, effect is immediate. - void SetWaterTint(const hsColorRGBA& s, hsScalar secs=0) { fState.fWaterTint.Set(s, secs); } - void SetWaterRGB(const hsVector3& col, hsScalar secs=0) { hsColorRGBA rgb; rgb.Set(col.fX, col.fY, col.fZ, GetWaterOpacity()); SetWaterTint(rgb, secs); } - void SetWaterOpacity(hsScalar s, hsScalar secs=0) { hsColorRGBA col = GetWaterTint(); col.a = s; SetWaterTint(col, secs); } - void SetSpecularTint(const hsColorRGBA& s, hsScalar secs=0) { fState.fSpecularTint.Set(s, secs); } - void SetSpecularRGB(const hsVector3& col, hsScalar secs=0) { hsColorRGBA rgb; rgb.Set(col.fX, col.fY, col.fZ, GetSpecularMute()); SetSpecularTint(rgb, secs); } - void SetSpecularMute(hsScalar s, hsScalar secs=0) { hsColorRGBA col = GetSpecularTint(); col.a = s; SetSpecularTint(col, secs); } + void SetWaterTint(const hsColorRGBA& s, float secs=0) { fState.fWaterTint.Set(s, secs); } + void SetWaterRGB(const hsVector3& col, float secs=0) { hsColorRGBA rgb; rgb.Set(col.fX, col.fY, col.fZ, GetWaterOpacity()); SetWaterTint(rgb, secs); } + void SetWaterOpacity(float s, float secs=0) { hsColorRGBA col = GetWaterTint(); col.a = s; SetWaterTint(col, secs); } + void SetSpecularTint(const hsColorRGBA& s, float secs=0) { fState.fSpecularTint.Set(s, secs); } + void SetSpecularRGB(const hsVector3& col, float secs=0) { hsColorRGBA rgb; rgb.Set(col.fX, col.fY, col.fZ, GetSpecularMute()); SetSpecularTint(rgb, secs); } + void SetSpecularMute(float s, float secs=0) { hsColorRGBA col = GetSpecularTint(); col.a = s; SetSpecularTint(col, secs); } // The environment map is essentially projected onto a sphere. Moving the center of // the sphere north will move the reflections north, changing the radius of the // sphere effects parallax in the obvious way. - void SetEnvCenter(const hsPoint3& s, hsScalar secs=0) { fState.fEnvCenter.Set(s, secs); } - void SetEnvRadius(hsScalar s, hsScalar secs=0) { fState.fEnvRadius.Set(s, secs); } + void SetEnvCenter(const hsPoint3& s, float secs=0) { fState.fEnvCenter.Set(s, secs); } + void SetEnvRadius(float s, float secs=0) { fState.fEnvRadius.Set(s, secs); } // Now a way to get current values. See the accompanying Setter for notes on // what the parameter means. // - hsScalar GetGeoMaxLength() const { return fState.fGeoState.fMaxLength; } - hsScalar GetGeoMinLength() const { return fState.fGeoState.fMinLength; } - hsScalar GetGeoAmpOverLen() const { return fState.fGeoState.fAmpOverLen; } - hsScalar GetGeoChop() const { return fState.fGeoState.fChop; } - hsScalar GetGeoAngleDev() const { return fState.fGeoState.fAngleDev; } + float GetGeoMaxLength() const { return fState.fGeoState.fMaxLength; } + float GetGeoMinLength() const { return fState.fGeoState.fMinLength; } + float GetGeoAmpOverLen() const { return fState.fGeoState.fAmpOverLen; } + float GetGeoChop() const { return fState.fGeoState.fChop; } + float GetGeoAngleDev() const { return fState.fGeoState.fAngleDev; } - hsScalar GetTexMaxLength() const { return fState.fTexState.fMaxLength; } - hsScalar GetTexMinLength() const { return fState.fTexState.fMinLength; } - hsScalar GetTexAmpOverLen() const { return fState.fTexState.fAmpOverLen; } - hsScalar GetTexChop() const { return fState.fTexState.fChop; } - hsScalar GetTexAngleDev() const { return fState.fTexState.fAngleDev; } + float GetTexMaxLength() const { return fState.fTexState.fMaxLength; } + float GetTexMinLength() const { return fState.fTexState.fMinLength; } + float GetTexAmpOverLen() const { return fState.fTexState.fAmpOverLen; } + float GetTexChop() const { return fState.fTexState.fChop; } + float GetTexAngleDev() const { return fState.fTexState.fAngleDev; } - hsScalar GetRippleScale() const { return fState.fRippleScale; } + float GetRippleScale() const { return fState.fRippleScale; } hsVector3 GetWindDir() const { return fState.fWindDir; } - hsScalar GetSpecularNoise() const { hsVector3 spec = fState.fSpecVec; return spec[plFixedWaterState7::kNoise]; } - hsScalar GetSpecularStart() const { hsVector3 spec = fState.fSpecVec; return spec[plFixedWaterState7::kSpecStart]; } - hsScalar GetSpecularEnd() const { hsVector3 spec = fState.fSpecVec; return spec[plFixedWaterState7::kSpecEnd]; } + float GetSpecularNoise() const { hsVector3 spec = fState.fSpecVec; return spec[plFixedWaterState7::kNoise]; } + float GetSpecularStart() const { hsVector3 spec = fState.fSpecVec; return spec[plFixedWaterState7::kSpecStart]; } + float GetSpecularEnd() const { hsVector3 spec = fState.fSpecVec; return spec[plFixedWaterState7::kSpecEnd]; } - hsScalar GetWaterHeight() const { return fState.fWaterHeight; } + float GetWaterHeight() const { return fState.fWaterHeight; } hsVector3 GetWaterOffset() const { return fState.fWaterOffset; } - hsScalar GetOpacOffset() const { hsVector3 off = fState.fWaterOffset; return off.fX; } - hsScalar GetReflOffset() const { hsVector3 off = fState.fWaterOffset; return off.fY; } - hsScalar GetWaveOffset() const { hsVector3 off = fState.fWaterOffset; return off.fZ; } + float GetOpacOffset() const { hsVector3 off = fState.fWaterOffset; return off.fX; } + float GetReflOffset() const { hsVector3 off = fState.fWaterOffset; return off.fY; } + float GetWaveOffset() const { hsVector3 off = fState.fWaterOffset; return off.fZ; } hsVector3 GetDepthFalloff() const { return fState.fDepthFalloff; } - hsScalar GetOpacFalloff() const { hsVector3 off = fState.fDepthFalloff; return off.fX; } - hsScalar GetReflFalloff() const { hsVector3 off = fState.fDepthFalloff; return off.fY; } - hsScalar GetWaveFalloff() const { hsVector3 off = fState.fDepthFalloff; return off.fZ; } + float GetOpacFalloff() const { hsVector3 off = fState.fDepthFalloff; return off.fX; } + float GetReflFalloff() const { hsVector3 off = fState.fDepthFalloff; return off.fY; } + float GetWaveFalloff() const { hsVector3 off = fState.fDepthFalloff; return off.fZ; } hsVector3 GetMaxAtten() const { return fState.fMaxAtten; } hsVector3 GetMinAtten() const { return fState.fMinAtten; } hsColorRGBA GetWaterTint() const { return fState.fWaterTint; } hsVector3 GetWaterRGB() const { hsColorRGBA col = GetWaterTint(); return hsVector3(col.r, col.g, col.b); } - hsScalar GetWaterOpacity() const { return GetWaterTint().a; } + float GetWaterOpacity() const { return GetWaterTint().a; } hsColorRGBA GetSpecularTint() const { return fState.fSpecularTint; } hsVector3 GetSpecularRGB() const { hsColorRGBA col = GetSpecularTint(); return hsVector3(col.r, col.g, col.b); } - hsScalar GetSpecularMute() const { return GetSpecularTint().a; } + float GetSpecularMute() const { return GetSpecularTint().a; } hsPoint3 GetEnvCenter() const { return fState.fEnvCenter; } - hsScalar GetEnvRadius() const { return fState.fEnvRadius; } + float GetEnvRadius() const { return fState.fEnvRadius; } // Export/debugging functions. For runtime, use message interface (plGenRefMsg, plWaveMsg). void AddTarget(const plKey& key); @@ -637,15 +637,15 @@ public: virtual hsBool SetupRippleMat(hsGMaterial* mat, const plRipVSConsts& ripConsts); - virtual hsScalar GetHeight() const { return State().fWaterHeight; } + virtual float GetHeight() const { return State().fWaterHeight; } const plFixedWaterState7::WaveState& GeoState() const { return State().fGeoState; } const plFixedWaterState7::WaveState& TexState() const { return State().fTexState; } const plFixedWaterState7& State() const { return fState; } - void SetState(const plFixedWaterState7& state, hsScalar dur); + void SetState(const plFixedWaterState7& state, float dur); - void SetEnvSize(UInt32 s) { fEnvSize = s; } - UInt32 GetEnvSize() const { return fEnvSize; } + void SetEnvSize(uint32_t s) { fEnvSize = s; } + uint32_t GetEnvSize() const { return fEnvSize; } void StopLog(); void StartLog(); diff --git a/Sources/Plasma/PubUtilLib/plDrawable/plWaveSetBase.cpp b/Sources/Plasma/PubUtilLib/plDrawable/plWaveSetBase.cpp index a128b195..42ab3cc0 100644 --- a/Sources/Plasma/PubUtilLib/plDrawable/plWaveSetBase.cpp +++ b/Sources/Plasma/PubUtilLib/plDrawable/plWaveSetBase.cpp @@ -40,7 +40,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "plWaveSetBase.h" #include "hsResMgr.h" @@ -56,11 +56,11 @@ plWaveSetBase::~plWaveSetBase() void plWaveSetBase::AddShore(plKey key) { - hsgResMgr::ResMgr()->SendRef(key, TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnCreate, -1, IShoreRef()), plRefFlags::kPassiveRef); + hsgResMgr::ResMgr()->SendRef(key, new plGenRefMsg(GetKey(), plRefMsg::kOnCreate, -1, IShoreRef()), plRefFlags::kPassiveRef); } void plWaveSetBase::AddDecal(plKey key) { - hsgResMgr::ResMgr()->SendRef(key, TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnCreate, -1, IDecalRef()), plRefFlags::kPassiveRef); + hsgResMgr::ResMgr()->SendRef(key, new plGenRefMsg(GetKey(), plRefMsg::kOnCreate, -1, IDecalRef()), plRefFlags::kPassiveRef); } diff --git a/Sources/Plasma/PubUtilLib/plDrawable/plWaveSetBase.h b/Sources/Plasma/PubUtilLib/plDrawable/plWaveSetBase.h index b782750f..9c78c452 100644 --- a/Sources/Plasma/PubUtilLib/plDrawable/plWaveSetBase.h +++ b/Sources/Plasma/PubUtilLib/plDrawable/plWaveSetBase.h @@ -61,12 +61,12 @@ public: CLASSNAME_REGISTER( plWaveSetBase ); GETINTERFACE_ANY( plWaveSetBase, plMultiModifier ); - virtual hsBool IEval(double secs, hsScalar del, UInt32 dirty) { return false; } + virtual hsBool IEval(double secs, float del, uint32_t dirty) { return false; } - Int32 GetNumProperties() const { return 0; } + int32_t GetNumProperties() const { return 0; } virtual hsBool SetupRippleMat(hsGMaterial* mat, const plRipVSConsts& ripConsts) = 0; - virtual hsScalar GetHeight() const = 0; + virtual float GetHeight() const = 0; virtual hsVector3 GetWindDir() const = 0; diff --git a/Sources/Plasma/PubUtilLib/plEncryption/plChecksum.cpp b/Sources/Plasma/PubUtilLib/plEncryption/plChecksum.cpp index 1da87266..81db5419 100644 --- a/Sources/Plasma/PubUtilLib/plEncryption/plChecksum.cpp +++ b/Sources/Plasma/PubUtilLib/plEncryption/plChecksum.cpp @@ -67,7 +67,7 @@ plChecksum::plChecksum(unsigned int bufsize, const char* buffer) fSum+= hsToLE32(last); } -plMD5Checksum::plMD5Checksum( UInt32 size, UInt8 *buffer ) +plMD5Checksum::plMD5Checksum( uint32_t size, uint8_t *buffer ) { fValid = false; Start(); @@ -116,11 +116,11 @@ void plMD5Checksum::CalcFromFile( const char *fileName ) void plMD5Checksum::CalcFromStream( hsStream* stream ) { - UInt32 sPos = stream->GetPosition(); + uint32_t sPos = stream->GetPosition(); unsigned loadLen = 1024 * 1024; Start(); - UInt8 *buf = TRACKED_NEW UInt8[loadLen]; + uint8_t *buf = new uint8_t[loadLen]; while(int read = stream->Read(loadLen, buf)) AddTo( read, buf ); @@ -136,7 +136,7 @@ void plMD5Checksum::Start( void ) fValid = false; } -void plMD5Checksum::AddTo( UInt32 size, const UInt8 *buffer ) +void plMD5Checksum::AddTo( uint32_t size, const uint8_t *buffer ) { MD5_Update( &fContext, buffer, size ); } @@ -166,7 +166,7 @@ const char *plMD5Checksum::GetAsHexString( void ) const return tempString; } -UInt8 plMD5Checksum::IHexCharToInt( char c ) const +uint8_t plMD5Checksum::IHexCharToInt( char c ) const { switch( c ) { @@ -214,7 +214,7 @@ void plMD5Checksum::SetFromHexString( const char *string ) fValid = true; } -void plMD5Checksum::SetValue(UInt8* checksum) +void plMD5Checksum::SetValue(uint8_t* checksum) { fValid = true; memcpy(fChecksum, checksum, sizeof(fChecksum)); diff --git a/Sources/Plasma/PubUtilLib/plEncryption/plChecksum.h b/Sources/Plasma/PubUtilLib/plEncryption/plChecksum.h index 04d3290e..e4f62990 100644 --- a/Sources/Plasma/PubUtilLib/plEncryption/plChecksum.h +++ b/Sources/Plasma/PubUtilLib/plEncryption/plChecksum.h @@ -42,13 +42,13 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #ifndef PL_CHECKSUM_H #define PL_CHECKSUM_H -#include "hsTypes.h" +#include "HeadSpin.h" #include class plChecksum { public: - typedef UInt32 SumStorage; + typedef uint32_t SumStorage; private: SumStorage fSum; public: @@ -66,13 +66,13 @@ class plMD5Checksum hsBool fValid; MD5_CTX fContext; - UInt8 fChecksum[ MD5_DIGEST_LENGTH ]; + uint8_t fChecksum[ MD5_DIGEST_LENGTH ]; - UInt8 IHexCharToInt( char c ) const; + uint8_t IHexCharToInt( char c ) const; public: - plMD5Checksum( UInt32 size, UInt8 *buffer ); + plMD5Checksum( uint32_t size, uint8_t *buffer ); plMD5Checksum(); plMD5Checksum( const plMD5Checksum &rhs ); plMD5Checksum( const char *fileName ); @@ -85,14 +85,14 @@ class plMD5Checksum void CalcFromStream( hsStream* stream ); void Start( void ); - void AddTo( UInt32 size, const UInt8 *buffer ); + void AddTo( uint32_t size, const uint8_t *buffer ); void Finish( void ); - const UInt8 *GetValue( void ) const { return fChecksum; } - UInt32 GetSize( void ) const { return sizeof( fChecksum ); } + const uint8_t *GetValue( void ) const { return fChecksum; } + uint32_t GetSize( void ) const { return sizeof( fChecksum ); } // Backdoor for cached checksums (ie, if you loaded it off disk) - void SetValue(UInt8* checksum); + void SetValue(uint8_t* checksum); // Note: GetAsHexString() returns a pointer to a static string; do not rely on the contents of this string between calls! const char *GetAsHexString( void ) const; diff --git a/Sources/Plasma/PubUtilLib/plFile/hsFiles.cpp b/Sources/Plasma/PubUtilLib/plFile/hsFiles.cpp index 9bc2fb04..d7b7e1e9 100644 --- a/Sources/Plasma/PubUtilLib/plFile/hsFiles.cpp +++ b/Sources/Plasma/PubUtilLib/plFile/hsFiles.cpp @@ -41,7 +41,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ #include "hsFiles.h" #include -#include "hsUtils.h" + #include "hsExceptions.h" @@ -121,7 +121,7 @@ hsStream* hsFile::OpenStream(const char mode[], hsBool throwIfFailure) FILE* file = this->OpenFILE(mode, throwIfFailure); if (file) - { hsUNIXStream* stream = TRACKED_NEW hsUNIXStream; + { hsUNIXStream* stream = new hsUNIXStream; stream->SetFILE(file); return stream; } diff --git a/Sources/Plasma/PubUtilLib/plFile/hsFiles.h b/Sources/Plasma/PubUtilLib/plFile/hsFiles.h index 2d4a9a18..63293bcd 100644 --- a/Sources/Plasma/PubUtilLib/plFile/hsFiles.h +++ b/Sources/Plasma/PubUtilLib/plFile/hsFiles.h @@ -127,27 +127,27 @@ public: #ifdef HS_BUILD_FOR_WIN32 // only implemented on Win32 for now class hsWFolderIterator { - wchar fPath[kFolderIterator_MaxPath]; + wchar_t fPath[kFolderIterator_MaxPath]; struct hsWFolderIterator_Data* fData; bool fCustomFilter; public: - hsWFolderIterator(const wchar path[] = nil, bool useCustomFilter=false); + hsWFolderIterator(const wchar_t path[] = nil, bool useCustomFilter=false); virtual ~hsWFolderIterator(); - const wchar* GetPath() const { return fPath; } - void SetPath(const wchar path[]); + const wchar_t* GetPath() const { return fPath; } + void SetPath(const wchar_t path[]); void Reset(); hsBool NextFile(); - hsBool NextFileSuffix(const wchar suffix[]); - const wchar* GetFileName() const; - int GetPathAndName(wchar pathandname[] = nil); + hsBool NextFileSuffix(const wchar_t suffix[]); + const wchar_t* GetFileName() const; + int GetPathAndName(wchar_t pathandname[] = nil); hsBool IsDirectory( void ) const; - FILE* OpenFILE(const wchar mode[]); + FILE* OpenFILE(const wchar_t mode[]); - void SetWinSystemDir(const wchar subdir[]); // e.g. "Fonts" - void SetFileFilterStr(const wchar filterStr[]); // e.g. "*.*" + void SetWinSystemDir(const wchar_t subdir[]); // e.g. "Fonts" + void SetFileFilterStr(const wchar_t filterStr[]); // e.g. "*.*" }; #endif diff --git a/Sources/Plasma/PubUtilLib/plFile/hsFiles_Mac.cpp b/Sources/Plasma/PubUtilLib/plFile/hsFiles_Mac.cpp index 46c5f498..7ba0689c 100644 --- a/Sources/Plasma/PubUtilLib/plFile/hsFiles_Mac.cpp +++ b/Sources/Plasma/PubUtilLib/plFile/hsFiles_Mac.cpp @@ -136,7 +136,7 @@ hsBool hsMacFile::Create(OSType creator, OSType fileType, ScriptCode scriptCode) #define kFileNotFound_Err -43 -hsBool hsMacFile::OpenDataFork(SInt8 perm, Int16* refnum) +hsBool hsMacFile::OpenDataFork(Sint8_t perm, int16_t* refnum) { this->Close(); @@ -177,7 +177,7 @@ hsStream* hsMacFile::OpenStream(const char mode[], hsBool throwIfFailure) hsThrowIfNilParam(mode); short refnum; - SInt8 perm = 0; + Sint8_t perm = 0; if (::strchr(mode, 'r')) perm |= fsRdPerm; @@ -185,7 +185,7 @@ hsStream* hsMacFile::OpenStream(const char mode[], hsBool throwIfFailure) perm |= fsWrPerm; if (this->OpenDataFork(perm, &refnum)) - { hsFileStream* stream = TRACKED_NEW hsFileStream; + { hsFileStream* stream = new hsFileStream; stream->SetFileRef(refnum); return stream; } @@ -212,13 +212,13 @@ struct hsFolderIterator_Data { OSType fFileType; OSType fCreator; char fCName[_MAX_PATH]; - Int16 fCurrIndex; + int16_t fCurrIndex; hsBool fValid; }; hsFolderIterator::hsFolderIterator(const char path[]) { - fData = TRACKED_NEW hsFolderIterator_Data; + fData = new hsFolderIterator_Data; fData->fCurrIndex = 0; fData->fValid = false; @@ -231,7 +231,7 @@ hsFolderIterator::hsFolderIterator(const char path[]) hsFolderIterator::hsFolderIterator(const struct FSSpec* spec) // Alt Constructor - pass in FSSpec from OpenDlg() { - fData = TRACKED_NEW hsFolderIterator_Data; + fData = new hsFolderIterator_Data; fData->fCurrIndex = 0; fData->fValid = false; @@ -266,7 +266,7 @@ void hsFolderIterator::SetMacFolder(OSType folderType) this->Reset(); } -void hsFolderIterator::SetMacFolder(Int16 vRefNum, Int32 dirID) +void hsFolderIterator::SetMacFolder(int16_t vRefNum, int32_t dirID) { fData->fSpec.vRefNum = vRefNum; fData->fSpec.parID = dirID; diff --git a/Sources/Plasma/PubUtilLib/plFile/hsFiles_Unix.cpp b/Sources/Plasma/PubUtilLib/plFile/hsFiles_Unix.cpp index b16307c8..9564eec3 100644 --- a/Sources/Plasma/PubUtilLib/plFile/hsFiles_Unix.cpp +++ b/Sources/Plasma/PubUtilLib/plFile/hsFiles_Unix.cpp @@ -64,7 +64,7 @@ struct hsFolderIterator_Data { hsFolderIterator::hsFolderIterator(const char path[], bool) { - fData = TRACKED_NEW hsFolderIterator_Data; + fData = new hsFolderIterator_Data; this->SetPath(path); } diff --git a/Sources/Plasma/PubUtilLib/plFile/hsFiles_Win.cpp b/Sources/Plasma/PubUtilLib/plFile/hsFiles_Win.cpp index 8e538223..5d1be0fe 100644 --- a/Sources/Plasma/PubUtilLib/plFile/hsFiles_Win.cpp +++ b/Sources/Plasma/PubUtilLib/plFile/hsFiles_Win.cpp @@ -40,24 +40,23 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ #include "hsFiles.h" +#include "HeadSpin.h" #if HS_BUILD_FOR_WIN32 -#include - #include "hsExceptions.h" struct hsFolderIterator_Data { HANDLE fSearchHandle; WIN32_FIND_DATA fFindData; - Boolean fValid; + bool fValid; }; hsFolderIterator::hsFolderIterator(const char path[], bool useCustomFilter) { fCustomFilter = useCustomFilter; - fData = TRACKED_NEW hsFolderIterator_Data; + fData = new hsFolderIterator_Data; fData->fSearchHandle = nil; fData->fValid = true; @@ -185,14 +184,14 @@ const char* hsFolderIterator::GetFileName() const struct hsWFolderIterator_Data { HANDLE fSearchHandle; WIN32_FIND_DATAW fFindData; - Boolean fValid; + bool fValid; }; -hsWFolderIterator::hsWFolderIterator(const wchar path[], bool useCustomFilter) +hsWFolderIterator::hsWFolderIterator(const wchar_t path[], bool useCustomFilter) { fCustomFilter = useCustomFilter; - fData = TRACKED_NEW hsWFolderIterator_Data; + fData = new hsWFolderIterator_Data; fData->fSearchHandle = nil; fData->fValid = true; @@ -207,7 +206,7 @@ hsWFolderIterator::~hsWFolderIterator() delete fData; } -void hsWFolderIterator::SetPath(const wchar path[]) +void hsWFolderIterator::SetPath(const wchar_t path[]) { fCustomFilter = false; fPath[0] = 0; @@ -216,7 +215,7 @@ void hsWFolderIterator::SetPath(const wchar path[]) wcscpy(fPath, path); // Make sure the dir ends with a slash - wchar lastchar = fPath[wcslen(fPath)-1]; + wchar_t lastchar = fPath[wcslen(fPath)-1]; if (lastchar != L'\\' && lastchar != L'/') wcscat(fPath, L"\\"); } @@ -224,7 +223,7 @@ void hsWFolderIterator::SetPath(const wchar path[]) Reset(); } -void hsWFolderIterator::SetWinSystemDir(const wchar subdir[]) +void hsWFolderIterator::SetWinSystemDir(const wchar_t subdir[]) { int ret = GetWindowsDirectoryW(fPath, _MAX_PATH); hsAssert(ret != 0, "Error getting windows directory in UseWindowsFontsPath"); @@ -238,7 +237,7 @@ void hsWFolderIterator::SetWinSystemDir(const wchar subdir[]) Reset(); } -void hsWFolderIterator::SetFileFilterStr(const wchar filterStr[]) +void hsWFolderIterator::SetFileFilterStr(const wchar_t filterStr[]) { fPath[0] = 0; if (filterStr) @@ -309,7 +308,7 @@ hsBool hsWFolderIterator::IsDirectory( void ) const return false; } -const wchar* hsWFolderIterator::GetFileName() const +const wchar_t* hsWFolderIterator::GetFileName() const { if (fData->fValid == false) hsThrow( "end of folder"); diff --git a/Sources/Plasma/PubUtilLib/plFile/plBrowseFolder.h b/Sources/Plasma/PubUtilLib/plFile/plBrowseFolder.h index eecb4a20..9c7ad37a 100644 --- a/Sources/Plasma/PubUtilLib/plFile/plBrowseFolder.h +++ b/Sources/Plasma/PubUtilLib/plFile/plBrowseFolder.h @@ -42,10 +42,9 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #ifndef plBrowseFolder_h_inc #define plBrowseFolder_h_inc -#include "hsConfig.h" +#include "HeadSpin.h" #ifdef HS_BUILD_FOR_WIN32 -#include "hsWindows.h" // // Gets a directory using the "Browse for Folder" dialog. diff --git a/Sources/Plasma/PubUtilLib/plFile/plEncryptedStream.cpp b/Sources/Plasma/PubUtilLib/plFile/plEncryptedStream.cpp index ae44d88a..8350bc87 100644 --- a/Sources/Plasma/PubUtilLib/plFile/plEncryptedStream.cpp +++ b/Sources/Plasma/PubUtilLib/plFile/plEncryptedStream.cpp @@ -40,24 +40,24 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ #include "plEncryptedStream.h" -#include "hsUtils.h" + #include "plFileUtils.h" #include "hsSTLStream.h" #include -static const UInt32 kDefaultKey[4] = { 0x6c0a5452, 0x3827d0f, 0x3a170b92, 0x16db7fc2 }; +static const uint32_t kDefaultKey[4] = { 0x6c0a5452, 0x3827d0f, 0x3a170b92, 0x16db7fc2 }; static const int kEncryptChunkSize = 8; static const char* kOldMagicString = "BriceIsSmart"; static const char* kMagicString = "whatdoyousee"; static const int kMagicStringLen = 12; -static const int kFileStartOffset = kMagicStringLen + sizeof(UInt32); +static const int kFileStartOffset = kMagicStringLen + sizeof(uint32_t); static const int kMaxBufferedFileSize = 10*1024; -plEncryptedStream::plEncryptedStream(UInt32* key) : +plEncryptedStream::plEncryptedStream(uint32_t* key) : fRef(nil), fActualFileSize(0), fBufferedStream(false), @@ -86,9 +86,9 @@ plEncryptedStream::~plEncryptedStream() // but frankly, who cares. No one is going to break the encryption, they'll just get the // key out of the exe or memory. // -void plEncryptedStream::IEncipher(UInt32* const v) +void plEncryptedStream::IEncipher(uint32_t* const v) { - register UInt32 y=v[0], z=v[1], sum=0, delta=0x9E3779B9, n=32; + register uint32_t y=v[0], z=v[1], sum=0, delta=0x9E3779B9, n=32; while (n-- > 0) { @@ -100,9 +100,9 @@ void plEncryptedStream::IEncipher(UInt32* const v) v[0]=y; v[1]=z; } -void plEncryptedStream::IDecipher(UInt32* const v) +void plEncryptedStream::IDecipher(uint32_t* const v) { - register UInt32 y=v[0], z=v[1], sum=0xC6EF3720, delta=0x9E3779B9, n=32; + register uint32_t y=v[0], z=v[1], sum=0xC6EF3720, delta=0x9E3779B9, n=32; // sum = delta<<5, in general sum = delta * n @@ -118,15 +118,15 @@ void plEncryptedStream::IDecipher(UInt32* const v) hsBool plEncryptedStream::Open(const char* name, const char* mode) { - wchar* wName = hsStringToWString(name); - wchar* wMode = hsStringToWString(mode); + wchar_t* wName = hsStringToWString(name); + wchar_t* wMode = hsStringToWString(mode); hsBool ret = Open(wName, wMode); delete [] wName; delete [] wMode; return ret; } -hsBool plEncryptedStream::Open(const wchar* name, const wchar* mode) +hsBool plEncryptedStream::Open(const wchar_t* name, const wchar_t* mode) { if (wcscmp(mode, L"rb") == 0) { @@ -143,7 +143,7 @@ hsBool plEncryptedStream::Open(const wchar* name, const wchar* mode) return false; } - fread(&fActualFileSize, sizeof(UInt32), 1, fRef); + fread(&fActualFileSize, sizeof(uint32_t), 1, fRef); // The encrypted stream is inefficient if you do reads smaller than // 8 bytes. Since we do a lot of those, any file under a size threshold @@ -157,8 +157,8 @@ hsBool plEncryptedStream::Open(const wchar* name, const wchar* mode) } else if (wcscmp(mode, L"wb") == 0) { - fRAMStream = TRACKED_NEW hsVectorStream; - fWriteFileName = TRACKED_NEW wchar[wcslen(name) + 1]; + fRAMStream = new hsVectorStream; + fWriteFileName = new wchar_t[wcslen(name) + 1]; wcscpy(fWriteFileName, name); fPosition = 0; @@ -209,7 +209,7 @@ hsBool plEncryptedStream::Close() return rtn; } -UInt32 plEncryptedStream::IRead(UInt32 bytes, void* buffer) +uint32_t plEncryptedStream::IRead(uint32_t bytes, void* buffer) { if (!fRef) return 0; @@ -232,11 +232,11 @@ UInt32 plEncryptedStream::IRead(UInt32 bytes, void* buffer) void plEncryptedStream::IBufferFile() { - fRAMStream = TRACKED_NEW hsVectorStream; + fRAMStream = new hsVectorStream; char buf[1024]; while (!AtEnd()) { - UInt32 numRead = Read(1024, buf); + uint32_t numRead = Read(1024, buf); fRAMStream->Write(numRead, buf); } fRAMStream->Rewind(); @@ -255,7 +255,7 @@ hsBool plEncryptedStream::AtEnd() return (GetPosition() == fActualFileSize); } -void plEncryptedStream::Skip(UInt32 delta) +void plEncryptedStream::Skip(uint32_t delta) { if (fBufferedStream) { @@ -299,31 +299,31 @@ void plEncryptedStream::FastFwd() } } -UInt32 plEncryptedStream::GetEOF() +uint32_t plEncryptedStream::GetEOF() { return fActualFileSize; } -UInt32 plEncryptedStream::Read(UInt32 bytes, void* buffer) +uint32_t plEncryptedStream::Read(uint32_t bytes, void* buffer) { if (fBufferedStream) { - UInt32 numRead = fRAMStream->Read(bytes, buffer); + uint32_t numRead = fRAMStream->Read(bytes, buffer); fPosition = fRAMStream->GetPosition(); return numRead; } - UInt32 startPos = fPosition; + uint32_t startPos = fPosition; // Offset into the first buffer (0 if we are aligned on a chunk, which means no extra block read) - UInt32 startChunkPos = startPos % kEncryptChunkSize; + uint32_t startChunkPos = startPos % kEncryptChunkSize; // Amount of data in the partial first chunk (0 if we're aligned) - UInt32 startAmt = (startChunkPos != 0) ? hsMinimum(kEncryptChunkSize - startChunkPos, bytes) : 0; + uint32_t startAmt = (startChunkPos != 0) ? hsMinimum(kEncryptChunkSize - startChunkPos, bytes) : 0; - UInt32 totalNumRead = IRead(bytes, buffer); + uint32_t totalNumRead = IRead(bytes, buffer); - UInt32 numMidChunks = (totalNumRead - startAmt) / kEncryptChunkSize; - UInt32 endAmt = (totalNumRead - startAmt) % kEncryptChunkSize; + uint32_t numMidChunks = (totalNumRead - startAmt) / kEncryptChunkSize; + uint32_t endAmt = (totalNumRead - startAmt) % kEncryptChunkSize; // If the start position is in the middle of a chunk we need to rewind and // read that whole chunk in and decrypt it. @@ -334,8 +334,8 @@ UInt32 plEncryptedStream::Read(UInt32 bytes, void* buffer) // Read in the chunk and decrypt it char buf[kEncryptChunkSize]; - UInt32 numRead = IRead(kEncryptChunkSize, &buf); - IDecipher((UInt32*)&buf); + uint32_t numRead = IRead(kEncryptChunkSize, &buf); + IDecipher((uint32_t*)&buf); // Copy the relevant portion to the output buffer memcpy(buffer, &buf[startChunkPos], startAmt); @@ -345,12 +345,12 @@ UInt32 plEncryptedStream::Read(UInt32 bytes, void* buffer) if (numMidChunks != 0) { - UInt32* bufferPos = (UInt32*)(((char*)buffer)+startAmt); + uint32_t* bufferPos = (uint32_t*)(((char*)buffer)+startAmt); for (int i = 0; i < numMidChunks; i++) { // Decrypt chunk IDecipher(bufferPos); - bufferPos += (kEncryptChunkSize / sizeof(UInt32)); + bufferPos += (kEncryptChunkSize / sizeof(uint32_t)); } } @@ -359,8 +359,8 @@ UInt32 plEncryptedStream::Read(UInt32 bytes, void* buffer) // Read in the final chunk and decrypt it char buf[kEncryptChunkSize]; SetPosition(startPos + startAmt + numMidChunks*kEncryptChunkSize); - UInt32 numRead = IRead(kEncryptChunkSize, &buf); - IDecipher((UInt32*)&buf); + uint32_t numRead = IRead(kEncryptChunkSize, &buf); + IDecipher((uint32_t*)&buf); memcpy(((char*)buffer)+totalNumRead-endAmt, &buf, endAmt); @@ -377,7 +377,7 @@ UInt32 plEncryptedStream::Read(UInt32 bytes, void* buffer) return totalNumRead; } -UInt32 plEncryptedStream::Write(UInt32 bytes, const void* buffer) +uint32_t plEncryptedStream::Write(uint32_t bytes, const void* buffer) { if (fOpenMode != kOpenWrite) { @@ -388,7 +388,7 @@ UInt32 plEncryptedStream::Write(UInt32 bytes, const void* buffer) return fRAMStream->Write(bytes, buffer); } -bool plEncryptedStream::IWriteEncypted(hsStream* sourceStream, const wchar* outputFile) +bool plEncryptedStream::IWriteEncypted(hsStream* sourceStream, const wchar_t* outputFile) { hsUNIXStream outputStream; @@ -402,10 +402,10 @@ bool plEncryptedStream::IWriteEncypted(hsStream* sourceStream, const wchar* outp // Write out all the full size encrypted blocks we can char buf[kEncryptChunkSize]; - UInt32 amtRead; + uint32_t amtRead; while ((amtRead = sourceStream->Read(kEncryptChunkSize, &buf)) == kEncryptChunkSize) { - IEncipher((UInt32*)&buf); + IEncipher((uint32_t*)&buf); outputStream.Write(kEncryptChunkSize, &buf); } @@ -422,13 +422,13 @@ bool plEncryptedStream::IWriteEncypted(hsStream* sourceStream, const wchar* outp for (int i = amtRead; i < kEncryptChunkSize; i++) buf[i] = rand(); - IEncipher((UInt32*)&buf); + IEncipher((uint32_t*)&buf); outputStream.Write(kEncryptChunkSize, &buf); } // Write the original file size at the start - UInt32 actualSize = sourceStream->GetPosition(); + uint32_t actualSize = sourceStream->GetPosition(); outputStream.Rewind(); outputStream.Skip(kMagicStringLen); outputStream.WriteLE32(actualSize); @@ -440,13 +440,13 @@ bool plEncryptedStream::IWriteEncypted(hsStream* sourceStream, const wchar* outp bool plEncryptedStream::FileEncrypt(const char* fileName) { - wchar* wFilename = hsStringToWString(fileName); + wchar_t* wFilename = hsStringToWString(fileName); bool ret = FileEncrypt(wFilename); delete [] wFilename; return ret; } -bool plEncryptedStream::FileEncrypt(const wchar* fileName) +bool plEncryptedStream::FileEncrypt(const wchar_t* fileName) { hsUNIXStream sIn; if (!sIn.Open(fileName)) @@ -477,13 +477,13 @@ bool plEncryptedStream::FileEncrypt(const wchar* fileName) bool plEncryptedStream::FileDecrypt(const char* fileName) { - wchar* wFilename = hsStringToWString(fileName); + wchar_t* wFilename = hsStringToWString(fileName); bool ret = FileDecrypt(wFilename); delete [] wFilename; return ret; } -bool plEncryptedStream::FileDecrypt(const wchar* fileName) +bool plEncryptedStream::FileDecrypt(const wchar_t* fileName) { plEncryptedStream sIn; if (!sIn.Open(fileName)) @@ -500,7 +500,7 @@ bool plEncryptedStream::FileDecrypt(const wchar* fileName) while (!sIn.AtEnd()) { - UInt32 numRead = sIn.Read(sizeof(buf), buf); + uint32_t numRead = sIn.Read(sizeof(buf), buf); sOut.Write(numRead, buf); } @@ -523,13 +523,13 @@ bool plEncryptedStream::ICheckMagicString(FILE* fp) bool plEncryptedStream::IsEncryptedFile(const char* fileName) { - wchar* wFilename = hsStringToWString(fileName); + wchar_t* wFilename = hsStringToWString(fileName); bool ret = IsEncryptedFile(wFilename); delete [] wFilename; return ret; } -bool plEncryptedStream::IsEncryptedFile(const wchar* fileName) +bool plEncryptedStream::IsEncryptedFile(const wchar_t* fileName) { FILE* fp = hsWFopen(fileName, L"rb"); if (!fp) @@ -542,15 +542,15 @@ bool plEncryptedStream::IsEncryptedFile(const wchar* fileName) return isEncrypted; } -hsStream* plEncryptedStream::OpenEncryptedFile(const char* fileName, bool requireEncrypted, UInt32* cryptKey) +hsStream* plEncryptedStream::OpenEncryptedFile(const char* fileName, bool requireEncrypted, uint32_t* cryptKey) { - wchar* wFilename = hsStringToWString(fileName); + wchar_t* wFilename = hsStringToWString(fileName); hsStream* ret = OpenEncryptedFile(wFilename, requireEncrypted, cryptKey); delete [] wFilename; return ret; } -hsStream* plEncryptedStream::OpenEncryptedFile(const wchar* fileName, bool requireEncrypted, UInt32* cryptKey) +hsStream* plEncryptedStream::OpenEncryptedFile(const wchar_t* fileName, bool requireEncrypted, uint32_t* cryptKey) { #ifndef PLASMA_EXTERNAL_RELEASE requireEncrypted = false; @@ -560,32 +560,32 @@ hsStream* plEncryptedStream::OpenEncryptedFile(const wchar* fileName, bool requi hsStream* s = nil; if (isEncrypted) - s = TRACKED_NEW plEncryptedStream(cryptKey); + s = new plEncryptedStream(cryptKey); // If this isn't an external release, let them use unencrypted data else if (!requireEncrypted) - s = TRACKED_NEW hsUNIXStream; + s = new hsUNIXStream; if (s) s->Open(fileName, L"rb"); return s; } -hsStream* plEncryptedStream::OpenEncryptedFileWrite(const char* fileName, UInt32* cryptKey) +hsStream* plEncryptedStream::OpenEncryptedFileWrite(const char* fileName, uint32_t* cryptKey) { - wchar* wFilename = hsStringToWString(fileName); + wchar_t* wFilename = hsStringToWString(fileName); hsStream* ret = OpenEncryptedFileWrite(wFilename, cryptKey); delete [] wFilename; return ret; } -hsStream* plEncryptedStream::OpenEncryptedFileWrite(const wchar* fileName, UInt32* cryptKey) +hsStream* plEncryptedStream::OpenEncryptedFileWrite(const wchar_t* fileName, uint32_t* cryptKey) { hsStream* s = nil; #ifdef PLASMA_EXTERNAL_RELEASE - s = TRACKED_NEW plEncryptedStream(cryptKey); + s = new plEncryptedStream(cryptKey); #else - s = TRACKED_NEW hsUNIXStream; + s = new hsUNIXStream; #endif s->Open(fileName, L"wb"); diff --git a/Sources/Plasma/PubUtilLib/plFile/plEncryptedStream.h b/Sources/Plasma/PubUtilLib/plFile/plEncryptedStream.h index ebfdbee9..29067168 100644 --- a/Sources/Plasma/PubUtilLib/plFile/plEncryptedStream.h +++ b/Sources/Plasma/PubUtilLib/plFile/plEncryptedStream.h @@ -53,64 +53,64 @@ class plEncryptedStream : public hsStream { protected: FILE* fRef; - UInt32 fKey[4]; + uint32_t fKey[4]; - UInt32 fActualFileSize; + uint32_t fActualFileSize; bool fBufferedStream; hsStream* fRAMStream; - wchar* fWriteFileName; + wchar_t* fWriteFileName; enum OpenMode { kOpenRead, kOpenWrite, kOpenFail }; OpenMode fOpenMode; void IBufferFile(); - UInt32 IRead(UInt32 bytes, void* buffer); + uint32_t IRead(uint32_t bytes, void* buffer); - void IEncipher(UInt32* const v); - void IDecipher(UInt32* const v); + void IEncipher(uint32_t* const v); + void IDecipher(uint32_t* const v); - bool IWriteEncypted(hsStream* sourceStream, const wchar* outputFile); + bool IWriteEncypted(hsStream* sourceStream, const wchar_t* outputFile); static bool ICheckMagicString(FILE* fp); public: - // If you don't pass in a key (4 UInt32's), the default one will be used - plEncryptedStream(UInt32* key=nil); + // If you don't pass in a key (4 uint32_t's), the default one will be used + plEncryptedStream(uint32_t* key=nil); ~plEncryptedStream(); virtual hsBool Open(const char* name, const char* mode = "rb"); - virtual hsBool Open(const wchar* name, const wchar* mode = L"rb"); + virtual hsBool Open(const wchar_t* name, const wchar_t* mode = L"rb"); virtual hsBool Close(); - virtual UInt32 Read(UInt32 byteCount, void* buffer); - virtual UInt32 Write(UInt32 byteCount, const void* buffer); + virtual uint32_t Read(uint32_t byteCount, void* buffer); + virtual uint32_t Write(uint32_t byteCount, const void* buffer); virtual hsBool AtEnd(); - virtual void Skip(UInt32 deltaByteCount); + virtual void Skip(uint32_t deltaByteCount); virtual void Rewind(); virtual void FastFwd(); - virtual UInt32 GetEOF(); + virtual uint32_t GetEOF(); - UInt32 GetActualFileSize() const { return fActualFileSize;} + uint32_t GetActualFileSize() const { return fActualFileSize;} static bool FileEncrypt(const char* fileName); - static bool FileEncrypt(const wchar* fileName); + static bool FileEncrypt(const wchar_t* fileName); static bool FileDecrypt(const char* fileName); - static bool FileDecrypt(const wchar* fileName); + static bool FileDecrypt(const wchar_t* fileName); static bool IsEncryptedFile(const char* fileName); - static bool IsEncryptedFile(const wchar* fileName); + static bool IsEncryptedFile(const wchar_t* fileName); // Attempts to create a read-binary stream for the requested file. If it's // encrypted, you'll get a plEncryptedStream, otherwise just a standard // hsUNIXStream. Remember to delete the stream when you're done with it. - static hsStream* OpenEncryptedFile(const char* fileName, bool requireEncrypted = true, UInt32* cryptKey = nil); - static hsStream* OpenEncryptedFile(const wchar* fileName, bool requireEncrypted = true, UInt32* cryptKey = nil); - static hsStream* OpenEncryptedFileWrite(const char* fileName, UInt32* cryptKey = nil); - static hsStream* OpenEncryptedFileWrite(const wchar* fileName, UInt32* cryptKey = nil); + static hsStream* OpenEncryptedFile(const char* fileName, bool requireEncrypted = true, uint32_t* cryptKey = nil); + static hsStream* OpenEncryptedFile(const wchar_t* fileName, bool requireEncrypted = true, uint32_t* cryptKey = nil); + static hsStream* OpenEncryptedFileWrite(const char* fileName, uint32_t* cryptKey = nil); + static hsStream* OpenEncryptedFileWrite(const wchar_t* fileName, uint32_t* cryptKey = nil); }; #endif // plEncryptedStream_h_inc diff --git a/Sources/Plasma/PubUtilLib/plFile/plFileUtils.cpp b/Sources/Plasma/PubUtilLib/plFile/plFileUtils.cpp index a1e9d96d..55240ee3 100644 --- a/Sources/Plasma/PubUtilLib/plFile/plFileUtils.cpp +++ b/Sources/Plasma/PubUtilLib/plFile/plFileUtils.cpp @@ -50,12 +50,12 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // ////////////////////////////////////////////////////////////////////////////// -#include "hsTypes.h" +#include "HeadSpin.h" #include "hsStlUtils.h" #include "plFileUtils.h" #include "hsFiles.h" #include "hsStringTokenizer.h" -#include "hsWindows.h" + #include "plUnifiedTime/plUnifiedTime.h" @@ -97,7 +97,7 @@ hsBool plFileUtils::CreateDir( const char *path ) #endif } -hsBool plFileUtils::CreateDir( const wchar *path ) +hsBool plFileUtils::CreateDir( const wchar_t *path ) { // Create our directory #if HS_BUILD_FOR_WIN32 @@ -150,7 +150,7 @@ bool plFileUtils::RemoveFile(const char* filename, bool delReadOnly) return (unlink(filename) == 0); } -bool plFileUtils::RemoveFile(const wchar* filename, bool delReadOnly) +bool plFileUtils::RemoveFile(const wchar_t* filename, bool delReadOnly) { #ifdef HS_BUILD_FOR_WIN32 if (delReadOnly) @@ -167,15 +167,15 @@ bool plFileUtils::RemoveFile(const wchar* filename, bool delReadOnly) bool plFileUtils::FileCopy(const char* existingFile, const char* newFile) { - wchar* wExisting = hsStringToWString(existingFile); - wchar* wNew = hsStringToWString(newFile); + wchar_t* wExisting = hsStringToWString(existingFile); + wchar_t* wNew = hsStringToWString(newFile); bool ret = FileCopy(wExisting, wNew); delete [] wExisting; delete [] wNew; return ret; } -bool plFileUtils::FileCopy(const wchar* existingFile, const wchar* newFile) +bool plFileUtils::FileCopy(const wchar_t* existingFile, const wchar_t* newFile) { #if HS_BUILD_FOR_WIN32 return (::CopyFileW(existingFile, newFile, FALSE) != 0); @@ -223,7 +223,7 @@ bool plFileUtils::FileMove(const char* existingFile, const char* newFile) #endif } -bool plFileUtils::FileMove(const wchar* existingFile, const wchar* newFile) +bool plFileUtils::FileMove(const wchar_t* existingFile, const wchar_t* newFile) { #if HS_BUILD_FOR_WIN32 return (::MoveFileW(existingFile, newFile) != 0); @@ -236,7 +236,7 @@ bool plFileUtils::FileMove(const wchar* existingFile, const wchar* newFile) #endif } -bool plFileUtils::FileExists(const wchar* file) +bool plFileUtils::FileExists(const wchar_t* file) { FILE* fp = hsWFopen(file, L"rb"); bool retVal = (fp != nil); @@ -259,18 +259,18 @@ bool plFileUtils::FileExists(const char* file) hsBool plFileUtils::EnsureFilePathExists( const char *filename ) { - wchar* wFilename = hsStringToWString(filename); + wchar_t* wFilename = hsStringToWString(filename); hsBool ret = EnsureFilePathExists(wFilename); delete [] wFilename; return ret; } -hsBool plFileUtils::EnsureFilePathExists( const wchar *filename ) +hsBool plFileUtils::EnsureFilePathExists( const wchar_t *filename ) { hsWStringTokenizer izer( filename, L"\\/" ); hsBool lastWorked = false; - wchar token[ kFolderIterator_MaxPath ]; + wchar_t token[ kFolderIterator_MaxPath ]; while( izer.Next( token, arrsize( token ) ) && izer.HasMoreTokens() ) @@ -378,9 +378,9 @@ const char* plFileUtils::GetFileName(const char* path) return c; } -const wchar* plFileUtils::GetFileName(const wchar* path) +const wchar_t* plFileUtils::GetFileName(const wchar_t* path) { - const wchar* c = wcsrchr(path, L'/'); + const wchar_t* c = wcsrchr(path, L'/'); if (c == nil) c = wcsrchr(path, L'\\'); @@ -399,9 +399,9 @@ void plFileUtils::StripFile(char* pathAndName) *fileName = '\0'; } -void plFileUtils::StripFile(wchar* pathAndName) +void plFileUtils::StripFile(wchar_t* pathAndName) { - wchar* fileName = (wchar*)GetFileName(pathAndName); + wchar_t* fileName = (wchar_t*)GetFileName(pathAndName); if (fileName != pathAndName) *fileName = L'\0'; } @@ -413,9 +413,9 @@ void plFileUtils::StripExt(char* fileName) *(ext-1) = '\0'; } -void plFileUtils::StripExt(wchar* fileName) +void plFileUtils::StripExt(wchar_t* fileName) { - wchar* ext = (wchar*)GetFileExt(fileName); + wchar_t* ext = (wchar_t*)GetFileExt(fileName); if (ext) *(ext-1) = L'\0'; } @@ -433,12 +433,12 @@ const char* plFileUtils::GetFileExt(const char* pathAndName) return nil; } -const wchar* plFileUtils::GetFileExt(const wchar* pathAndName) +const wchar_t* plFileUtils::GetFileExt(const wchar_t* pathAndName) { - const wchar* fileName = GetFileName(pathAndName); + const wchar_t* fileName = GetFileName(pathAndName); if (fileName) { - const wchar* ext = wcsrchr(fileName, L'.'); + const wchar_t* ext = wcsrchr(fileName, L'.'); if (ext) return ext+1; } @@ -457,9 +457,9 @@ void plFileUtils::AddSlash(char* path) #endif } -void plFileUtils::AddSlash(wchar* path) +void plFileUtils::AddSlash(wchar_t* path) { - wchar lastChar = path[wcslen(path)-1]; + wchar_t lastChar = path[wcslen(path)-1]; if (lastChar != L'\\' && lastChar != L'/') #if HS_BUILD_FOR_WIN32 wcscat(path, L"\\"); @@ -474,7 +474,7 @@ void plFileUtils::ConcatFileName(char* path, const char* fileName) strcat(path, fileName); } -void plFileUtils::ConcatFileName(wchar* path, const wchar* fileName) +void plFileUtils::ConcatFileName(wchar_t* path, const wchar_t* fileName) { AddSlash(path); wcscat(path, fileName); @@ -482,17 +482,17 @@ void plFileUtils::ConcatFileName(wchar* path, const wchar* fileName) //// GetFileSize ///////////////////////////////////////////////////////////// -UInt32 plFileUtils::GetFileSize( const char *path ) +uint32_t plFileUtils::GetFileSize( const char *path ) { - wchar* wPath = hsStringToWString(path); - UInt32 ret = GetFileSize(wPath); + wchar_t* wPath = hsStringToWString(path); + uint32_t ret = GetFileSize(wPath); delete [] wPath; return ret; } -UInt32 plFileUtils::GetFileSize( const wchar *path ) +uint32_t plFileUtils::GetFileSize( const wchar_t *path ) { - UInt32 len = 0; + uint32_t len = 0; hsUNIXStream str; if (str.Open(path, L"rb")) @@ -506,15 +506,15 @@ UInt32 plFileUtils::GetFileSize( const wchar *path ) //// GetSecureEncryptionKey ////////////////////////////////////////////////// -bool plFileUtils::GetSecureEncryptionKey(const char* filename, UInt32* key, unsigned length) +bool plFileUtils::GetSecureEncryptionKey(const char* filename, uint32_t* key, unsigned length) { - wchar* wFilename = hsStringToWString(filename); + wchar_t* wFilename = hsStringToWString(filename); bool ret = GetSecureEncryptionKey(wFilename, key, length); delete [] wFilename; return ret; } -bool plFileUtils::GetSecureEncryptionKey(const wchar* filename, UInt32* key, unsigned length) +bool plFileUtils::GetSecureEncryptionKey(const wchar_t* filename, uint32_t* key, unsigned length) { // looks for an encryption key file in the same directory, and reads it std::wstring sFilename = filename; @@ -541,22 +541,22 @@ bool plFileUtils::GetSecureEncryptionKey(const wchar* filename, UInt32* key, uns hsUNIXStream file; file.Open(keyFile.c_str(), L"rb"); - unsigned bytesToRead = length * sizeof(UInt32); - byte* buffer = (byte*)ALLOC(bytesToRead); + unsigned bytesToRead = length * sizeof(uint32_t); + uint8_t* buffer = (uint8_t*)malloc(bytesToRead); unsigned bytesRead = file.Read(bytesToRead, buffer); file.Close(); unsigned memSize = min(bytesToRead, bytesRead); memcpy(key, buffer, memSize); - FREE(buffer); + free(buffer); return true; } // file doesn't exist, use default key unsigned memSize = min(length, arrsize(plSecureStream::kDefaultKey)); - memSize *= sizeof(UInt32); + memSize *= sizeof(uint32_t); memcpy(key, plSecureStream::kDefaultKey, memSize); return false; diff --git a/Sources/Plasma/PubUtilLib/plFile/plFileUtils.h b/Sources/Plasma/PubUtilLib/plFile/plFileUtils.h index ff4ce5a6..e7806b62 100644 --- a/Sources/Plasma/PubUtilLib/plFile/plFileUtils.h +++ b/Sources/Plasma/PubUtilLib/plFile/plFileUtils.h @@ -57,29 +57,29 @@ class plUnifiedTime; namespace plFileUtils { static const char kKeyFilename[] = "encryption.key"; - static const wchar kWKeyFilename[] = L"encryption.key"; + static const wchar_t kWKeyFilename[] = L"encryption.key"; // Creates the directory specified. Returns false if unsuccessful or directory already exists hsBool CreateDir( const char *path ); - hsBool CreateDir( const wchar *path ); + hsBool CreateDir( const wchar_t *path ); hsBool RemoveDir(const char* path); hsBool RemoveDirTree(const char * path); // delete file from disk bool RemoveFile(const char* filename, bool delReadOnly=false); - bool RemoveFile(const wchar* filename, bool delReadOnly=false); + bool RemoveFile(const wchar_t* filename, bool delReadOnly=false); bool FileCopy(const char* existingFile, const char* newFile); - bool FileCopy(const wchar* existingFile, const wchar* newFile); + bool FileCopy(const wchar_t* existingFile, const wchar_t* newFile); bool FileMove(const char* existingFile, const char* newFile); - bool FileMove(const wchar* existingFile, const wchar* newFile); + bool FileMove(const wchar_t* existingFile, const wchar_t* newFile); bool FileExists(const char* file); - bool FileExists(const wchar* file); + bool FileExists(const wchar_t* file); // Given a filename with path, makes sure the file's path exists hsBool EnsureFilePathExists( const char *filename ); - hsBool EnsureFilePathExists( const wchar *filename ); + hsBool EnsureFilePathExists( const wchar_t *filename ); // Gets the creation and modification dates of the file specified. Returns false if unsuccessful hsBool GetFileTimes( const char *path, plUnifiedTime *createTimeOut, plUnifiedTime *modifyTimeOut ); @@ -91,34 +91,34 @@ namespace plFileUtils // Return a pointer into the given string at the start of the actual filename (i.e. past any path info) const char* GetFileName(const char* pathAndName); - const wchar* GetFileName(const wchar* pathAndName); + const wchar_t* GetFileName(const wchar_t* pathAndName); // Get the file extension (without the .), or nil if it doesn't have one const char* GetFileExt(const char* pathAndName); - const wchar* GetFileExt(const wchar* pathAndName); + const wchar_t* GetFileExt(const wchar_t* pathAndName); // Strips the filename off the given full path void StripFile(char* pathAndName); - void StripFile(wchar* pathAndName); + void StripFile(wchar_t* pathAndName); void StripExt(char* fileName); - void StripExt(wchar* fileName); + void StripExt(wchar_t* fileName); // Get the size of the given file in bytes - UInt32 GetFileSize( const char *path ); - UInt32 GetFileSize( const wchar *path ); + uint32_t GetFileSize( const char *path ); + uint32_t GetFileSize( const wchar_t *path ); // Adds a slash to the end of a filename (or does nothing if it's already there) void AddSlash(char* path); - void AddSlash(wchar* path); + void AddSlash(wchar_t* path); // Concatenates fileName onto path, making sure to add a slash if necessary void ConcatFileName(char* path, const char* fileName); - void ConcatFileName(wchar* path, const wchar* fileName); + void ConcatFileName(wchar_t* path, const wchar_t* fileName); // searches the parent directory of filename for the encryption key file, and reads it // into the key passed in. Returns false if the key file didn't exist (and sets key to // the default key) - bool GetSecureEncryptionKey(const char* filename, UInt32* key, unsigned length); - bool GetSecureEncryptionKey(const wchar* filename, UInt32* key, unsigned length); + bool GetSecureEncryptionKey(const char* filename, uint32_t* key, unsigned length); + bool GetSecureEncryptionKey(const wchar_t* filename, uint32_t* key, unsigned length); }; diff --git a/Sources/Plasma/PubUtilLib/plFile/plInitFileReader.cpp b/Sources/Plasma/PubUtilLib/plFile/plInitFileReader.cpp index a1ae43d2..55fc6e1a 100644 --- a/Sources/Plasma/PubUtilLib/plFile/plInitFileReader.cpp +++ b/Sources/Plasma/PubUtilLib/plFile/plInitFileReader.cpp @@ -47,11 +47,11 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // // ////////////////////////////////////////////////////////////////////////////// -#include "hsTypes.h" +#include "HeadSpin.h" #include "plInitFileReader.h" #include "hsStream.h" -#include "hsUtils.h" + #include "hsStringTokenizer.h" #include "plEncryptedStream.h" @@ -60,7 +60,7 @@ plInitSectionTokenReader::plInitSectionTokenReader( const char *separators ) : f { } -hsBool plInitSectionTokenReader::ParseLine( const char *line, UInt32 userData ) +hsBool plInitSectionTokenReader::ParseLine( const char *line, uint32_t userData ) { hsStringTokenizer izer( line, fSeparators ); @@ -70,7 +70,7 @@ hsBool plInitSectionTokenReader::ParseLine( const char *line, UInt32 userDa void plInitFileReader::IInitReaders( plInitSectionReader **readerArray ) { - UInt32 i; + uint32_t i; for( i = 0; readerArray[ i ] != nil; i++ ) @@ -81,7 +81,7 @@ void plInitFileReader::IInitReaders( plInitSectionReader **readerArray ) fCurrSection = fSections[ 0 ]; } -plInitFileReader::plInitFileReader( plInitSectionReader **readerArray, UInt16 lineSize ) +plInitFileReader::plInitFileReader( plInitSectionReader **readerArray, uint16_t lineSize ) { fRequireEncrypted = true; fCurrLine = nil; @@ -91,7 +91,7 @@ plInitFileReader::plInitFileReader( plInitSectionReader **readerArray, UInt16 li fUnhandledSection = nil; } -plInitFileReader::plInitFileReader( const char *fileName, plInitSectionReader **readerArray, UInt16 lineSize ) +plInitFileReader::plInitFileReader( const char *fileName, plInitSectionReader **readerArray, uint16_t lineSize ) { fRequireEncrypted = true; fCurrLine = nil; @@ -103,7 +103,7 @@ plInitFileReader::plInitFileReader( const char *fileName, plInitSectionReader ** fUnhandledSection = nil; } -plInitFileReader::plInitFileReader( hsStream *stream, plInitSectionReader **readerArray, UInt16 lineSize ) +plInitFileReader::plInitFileReader( hsStream *stream, plInitSectionReader **readerArray, uint16_t lineSize ) { fRequireEncrypted = true; fCurrLine = nil; @@ -151,12 +151,12 @@ hsBool plInitFileReader::Open( hsStream *stream ) return true; } -hsBool plInitFileReader::Parse( UInt32 userData ) +hsBool plInitFileReader::Parse( uint32_t userData ) { hsAssert( fStream != nil, "Nil stream in initFileReader::Parse(); file not yet open?" ); if( fCurrLine == nil ) - fCurrLine = TRACKED_NEW char[ fLineSize + 1 ]; + fCurrLine = new char[ fLineSize + 1 ]; // Start parsing lines while( fStream->ReadLn( fCurrLine, fLineSize ) ) @@ -171,7 +171,7 @@ hsBool plInitFileReader::Parse( UInt32 userData ) if( end != nil ) *end = 0; - UInt32 i; + uint32_t i; bool foundSection = false; for( i = 0; i < fSections.GetCount(); i++ ) diff --git a/Sources/Plasma/PubUtilLib/plFile/plInitFileReader.h b/Sources/Plasma/PubUtilLib/plFile/plInitFileReader.h index 2759d560..1bd15492 100644 --- a/Sources/Plasma/PubUtilLib/plFile/plInitFileReader.h +++ b/Sources/Plasma/PubUtilLib/plFile/plInitFileReader.h @@ -54,7 +54,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // reader, and ending with a nil pointer (see below). Finally, create // // a plInitFileReader with the array you created and it'll parse the // // given file (or stream) and call your readers as needed. You can also // -// optionally pass in a UInt32 for userData that will be passed on to each // +// optionally pass in a uint32_t for userData that will be passed on to each // // reader in turn. // // // ////////////////////////////////////////////////////////////////////////////// @@ -62,7 +62,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #ifndef _plInitFileReader_h #define _plInitFileReader_h -#include "hsTypes.h" +#include "HeadSpin.h" #include "hsStream.h" #include "hsTemplates.h" @@ -77,7 +77,7 @@ class plInitSectionReader virtual const char *GetSectionName( void ) const = 0; // Override this to parse each line in your section. Return false to abort parsing - virtual hsBool ParseLine( const char *line, UInt32 userData ) = 0; + virtual hsBool ParseLine( const char *line, uint32_t userData ) = 0; // Override this if you're defining an unhandled section reader virtual void SetSectionName(const char* section) {} @@ -96,14 +96,14 @@ class plInitSectionTokenReader : public plInitSectionReader const char *fSeparators; // Override this to parse each token in your section. Return false to abort parsing - virtual hsBool IParseToken( const char *token, hsStringTokenizer *tokenizer, UInt32 userData ) = 0; + virtual hsBool IParseToken( const char *token, hsStringTokenizer *tokenizer, uint32_t userData ) = 0; public: plInitSectionTokenReader( const char *separators = ",=\t" ); // Overridden for you. Override IParseToken() - virtual hsBool ParseLine( const char *line, UInt32 userData ); + virtual hsBool ParseLine( const char *line, uint32_t userData ); }; //// Main Reader Class /////////////////////////////////////////////////////// @@ -117,7 +117,7 @@ class plInitFileReader hsStream *fStream; hsStream *fOurStream; char *fCurrLine; - UInt32 fLineSize; + uint32_t fLineSize; bool fRequireEncrypted; plInitSectionReader *fCurrSection; @@ -133,9 +133,9 @@ class plInitFileReader // element of the array will be the "default" section--i.e. if there is no section // header at the top of the file, that reader will be used. - plInitFileReader( plInitSectionReader **readerArray, UInt16 lineSize = 256 ); - plInitFileReader( const char *fileName, plInitSectionReader **readerArray, UInt16 lineSize = 256 ); - plInitFileReader( hsStream *stream, plInitSectionReader **readerArray, UInt16 lineSize = 256 ); + plInitFileReader( plInitSectionReader **readerArray, uint16_t lineSize = 256 ); + plInitFileReader( const char *fileName, plInitSectionReader **readerArray, uint16_t lineSize = 256 ); + plInitFileReader( hsStream *stream, plInitSectionReader **readerArray, uint16_t lineSize = 256 ); virtual ~plInitFileReader(); void SetRequireEncrypted(bool require) { fRequireEncrypted = require; } @@ -144,7 +144,7 @@ class plInitFileReader hsBool Open( const char *fileName ); hsBool Open( hsStream *stream ); - hsBool Parse( UInt32 userData = 0 ); + hsBool Parse( uint32_t userData = 0 ); void Close( void ); hsBool IsOpen( void ) const { return fStream != nil; } diff --git a/Sources/Plasma/PubUtilLib/plFile/plSecureStream.cpp b/Sources/Plasma/PubUtilLib/plFile/plSecureStream.cpp index 335b1bc7..dabb390c 100644 --- a/Sources/Plasma/PubUtilLib/plFile/plSecureStream.cpp +++ b/Sources/Plasma/PubUtilLib/plFile/plSecureStream.cpp @@ -40,7 +40,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ #include "plSecureStream.h" -#include "hsUtils.h" + #include "plFileUtils.h" #include "hsSTLStream.h" @@ -51,18 +51,18 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #endif // our default encryption key -const UInt32 plSecureStream::kDefaultKey[4] = { 0x6c0a5452, 0x3827d0f, 0x3a170b92, 0x16db7fc2 }; +const uint32_t plSecureStream::kDefaultKey[4] = { 0x6c0a5452, 0x3827d0f, 0x3a170b92, 0x16db7fc2 }; static const int kEncryptChunkSize = 8; static const char* kMagicString = "notthedroids"; static const int kMagicStringLen = 12; -static const int kFileStartOffset = kMagicStringLen + sizeof(UInt32); +static const int kFileStartOffset = kMagicStringLen + sizeof(uint32_t); static const int kMaxBufferedFileSize = 10*1024; -plSecureStream::plSecureStream(hsBool deleteOnExit, UInt32* key) : +plSecureStream::plSecureStream(hsBool deleteOnExit, uint32_t* key) : fRef(INVALID_HANDLE_VALUE), fActualFileSize(0), fBufferedStream(false), @@ -77,7 +77,7 @@ fDeleteOnExit(deleteOnExit) memcpy(&fKey, &kDefaultKey, sizeof(kDefaultKey)); } -plSecureStream::plSecureStream(hsStream* base, UInt32* key) : +plSecureStream::plSecureStream(hsStream* base, uint32_t* key) : fRef(INVALID_HANDLE_VALUE), fActualFileSize(0), fBufferedStream(false), @@ -107,7 +107,7 @@ plSecureStream::~plSecureStream() #define MX (z>>5 ^ y<<2) + (y>>3 ^ z<<4) ^ (sum^y) + (fKey[p&3^e]^z) -void plSecureStream::IEncipher(UInt32* const v, UInt32 n) +void plSecureStream::IEncipher(uint32_t* const v, uint32_t n) { register unsigned long y=v[0], z=v[n-1], e, delta=0x9E3779B9; register unsigned long q = 6 + 52/n, p, sum = 0; @@ -128,7 +128,7 @@ void plSecureStream::IEncipher(UInt32* const v, UInt32 n) } } -void plSecureStream::IDecipher(UInt32* const v, UInt32 n) +void plSecureStream::IDecipher(uint32_t* const v, uint32_t n) { register unsigned long y=v[0], z=v[n-1], e, delta=0x9E3779B9; register unsigned long q = 6 + 52/n, p, sum = q * delta; @@ -151,15 +151,15 @@ void plSecureStream::IDecipher(UInt32* const v, UInt32 n) hsBool plSecureStream::Open(const char* name, const char* mode) { - wchar* wName = hsStringToWString(name); - wchar* wMode = hsStringToWString(mode); + wchar_t* wName = hsStringToWString(name); + wchar_t* wMode = hsStringToWString(mode); hsBool ret = Open(wName, wMode); delete [] wName; delete [] wMode; return ret; } -hsBool plSecureStream::Open(const wchar* name, const wchar* mode) +hsBool plSecureStream::Open(const wchar_t* name, const wchar_t* mode) { if (wcscmp(mode, L"rb") == 0) { @@ -199,7 +199,7 @@ hsBool plSecureStream::Open(const wchar* name, const wchar* mode) } DWORD numBytesRead; - ReadFile(fRef, &fActualFileSize, sizeof(UInt32), &numBytesRead, NULL); + ReadFile(fRef, &fActualFileSize, sizeof(uint32_t), &numBytesRead, NULL); #elif HS_BUILD_FOR_UNIX const char* cname = hsWStringToString(name); fRef = fopen(cname, "rb"); @@ -230,8 +230,8 @@ hsBool plSecureStream::Open(const wchar* name, const wchar* mode) } else if (wcscmp(mode, L"wb") == 0) { - fRAMStream = TRACKED_NEW hsVectorStream; - fWriteFileName = TRACKED_NEW wchar[wcslen(name) + 1]; + fRAMStream = new hsVectorStream; + fWriteFileName = new wchar_t[wcslen(name) + 1]; wcscpy(fWriteFileName, name); fPosition = 0; @@ -250,26 +250,26 @@ hsBool plSecureStream::Open(const wchar* name, const wchar* mode) hsBool plSecureStream::Open(hsStream* stream) { - UInt32 pos = stream->GetPosition(); + uint32_t pos = stream->GetPosition(); stream->Rewind(); if (!ICheckMagicString(stream)) return false; fActualFileSize = stream->ReadLE32(); - UInt32 trimSize = kMagicStringLen + sizeof(UInt32) + fActualFileSize; + uint32_t trimSize = kMagicStringLen + sizeof(uint32_t) + fActualFileSize; fRAMStream = new hsRAMStream; while (!stream->AtEnd()) { // Don't write out any garbage - UInt32 size; + uint32_t size; if ((trimSize - stream->GetPosition()) < kEncryptChunkSize) size = (trimSize - stream->GetPosition()); else size = kEncryptChunkSize; - UInt8 buf[kEncryptChunkSize]; + uint8_t buf[kEncryptChunkSize]; stream->Read(kEncryptChunkSize, &buf); - IDecipher((UInt32*)&buf, kEncryptChunkSize / sizeof(UInt32)); + IDecipher((uint32_t*)&buf, kEncryptChunkSize / sizeof(uint32_t)); fRAMStream->Write(size, &buf); } @@ -319,11 +319,11 @@ hsBool plSecureStream::Close() return rtn; } -UInt32 plSecureStream::IRead(UInt32 bytes, void* buffer) +uint32_t plSecureStream::IRead(uint32_t bytes, void* buffer) { if (fRef == INVALID_HANDLE_VALUE) return 0; - UInt32 numItems; + uint32_t numItems; #if HS_BUILD_FOR_WIN32 bool success = (ReadFile(fRef, buffer, bytes, (LPDWORD)&numItems, NULL) != 0); #elif HS_BUILD_FOR_UNIX @@ -351,11 +351,11 @@ UInt32 plSecureStream::IRead(UInt32 bytes, void* buffer) void plSecureStream::IBufferFile() { - fRAMStream = TRACKED_NEW hsVectorStream; + fRAMStream = new hsVectorStream; char buf[1024]; while (!AtEnd()) { - UInt32 numRead = Read(1024, buf); + uint32_t numRead = Read(1024, buf); fRAMStream->Write(numRead, buf); } fRAMStream->Rewind(); @@ -378,7 +378,7 @@ hsBool plSecureStream::AtEnd() return (GetPosition() == fActualFileSize); } -void plSecureStream::Skip(UInt32 delta) +void plSecureStream::Skip(uint32_t delta) { if (fBufferedStream) { @@ -433,31 +433,31 @@ void plSecureStream::FastFwd() } } -UInt32 plSecureStream::GetEOF() +uint32_t plSecureStream::GetEOF() { return fActualFileSize; } -UInt32 plSecureStream::Read(UInt32 bytes, void* buffer) +uint32_t plSecureStream::Read(uint32_t bytes, void* buffer) { if (fBufferedStream) { - UInt32 numRead = fRAMStream->Read(bytes, buffer); + uint32_t numRead = fRAMStream->Read(bytes, buffer); fPosition = fRAMStream->GetPosition(); return numRead; } - UInt32 startPos = fPosition; + uint32_t startPos = fPosition; // Offset into the first buffer (0 if we are aligned on a chunk, which means no extra block read) - UInt32 startChunkPos = startPos % kEncryptChunkSize; + uint32_t startChunkPos = startPos % kEncryptChunkSize; // Amount of data in the partial first chunk (0 if we're aligned) - UInt32 startAmt = (startChunkPos != 0) ? hsMinimum(kEncryptChunkSize - startChunkPos, bytes) : 0; + uint32_t startAmt = (startChunkPos != 0) ? hsMinimum(kEncryptChunkSize - startChunkPos, bytes) : 0; - UInt32 totalNumRead = IRead(bytes, buffer); + uint32_t totalNumRead = IRead(bytes, buffer); - UInt32 numMidChunks = (totalNumRead - startAmt) / kEncryptChunkSize; - UInt32 endAmt = (totalNumRead - startAmt) % kEncryptChunkSize; + uint32_t numMidChunks = (totalNumRead - startAmt) / kEncryptChunkSize; + uint32_t endAmt = (totalNumRead - startAmt) % kEncryptChunkSize; // If the start position is in the middle of a chunk we need to rewind and // read that whole chunk in and decrypt it. @@ -468,8 +468,8 @@ UInt32 plSecureStream::Read(UInt32 bytes, void* buffer) // Read in the chunk and decrypt it char buf[kEncryptChunkSize]; - UInt32 numRead = IRead(kEncryptChunkSize, &buf); - IDecipher((UInt32*)&buf, kEncryptChunkSize / sizeof(UInt32)); + uint32_t numRead = IRead(kEncryptChunkSize, &buf); + IDecipher((uint32_t*)&buf, kEncryptChunkSize / sizeof(uint32_t)); // Copy the relevant portion to the output buffer memcpy(buffer, &buf[startChunkPos], startAmt); @@ -479,12 +479,12 @@ UInt32 plSecureStream::Read(UInt32 bytes, void* buffer) if (numMidChunks != 0) { - UInt32* bufferPos = (UInt32*)(((char*)buffer)+startAmt); + uint32_t* bufferPos = (uint32_t*)(((char*)buffer)+startAmt); for (int i = 0; i < numMidChunks; i++) { // Decrypt chunk - IDecipher(bufferPos, kEncryptChunkSize / sizeof(UInt32)); - bufferPos += (kEncryptChunkSize / sizeof(UInt32)); + IDecipher(bufferPos, kEncryptChunkSize / sizeof(uint32_t)); + bufferPos += (kEncryptChunkSize / sizeof(uint32_t)); } } @@ -493,8 +493,8 @@ UInt32 plSecureStream::Read(UInt32 bytes, void* buffer) // Read in the final chunk and decrypt it char buf[kEncryptChunkSize]; SetPosition(startPos + startAmt + numMidChunks*kEncryptChunkSize); - UInt32 numRead = IRead(kEncryptChunkSize, &buf); - IDecipher((UInt32*)&buf, kEncryptChunkSize / sizeof(UInt32)); + uint32_t numRead = IRead(kEncryptChunkSize, &buf); + IDecipher((uint32_t*)&buf, kEncryptChunkSize / sizeof(uint32_t)); memcpy(((char*)buffer)+totalNumRead-endAmt, &buf, endAmt); @@ -511,7 +511,7 @@ UInt32 plSecureStream::Read(UInt32 bytes, void* buffer) return totalNumRead; } -UInt32 plSecureStream::Write(UInt32 bytes, const void* buffer) +uint32_t plSecureStream::Write(uint32_t bytes, const void* buffer) { if (fOpenMode != kOpenWrite) { @@ -522,7 +522,7 @@ UInt32 plSecureStream::Write(UInt32 bytes, const void* buffer) return fRAMStream->Write(bytes, buffer); } -bool plSecureStream::IWriteEncrypted(hsStream* sourceStream, const wchar* outputFile) +bool plSecureStream::IWriteEncrypted(hsStream* sourceStream, const wchar_t* outputFile) { hsUNIXStream outputStream; @@ -536,10 +536,10 @@ bool plSecureStream::IWriteEncrypted(hsStream* sourceStream, const wchar* output // Write out all the full size encrypted blocks we can char buf[kEncryptChunkSize]; - UInt32 amtRead; + uint32_t amtRead; while ((amtRead = sourceStream->Read(kEncryptChunkSize, &buf)) == kEncryptChunkSize) { - IEncipher((UInt32*)&buf, kEncryptChunkSize / sizeof(UInt32)); + IEncipher((uint32_t*)&buf, kEncryptChunkSize / sizeof(uint32_t)); outputStream.Write(kEncryptChunkSize, &buf); } @@ -556,13 +556,13 @@ bool plSecureStream::IWriteEncrypted(hsStream* sourceStream, const wchar* output for (int i = amtRead; i < kEncryptChunkSize; i++) buf[i] = rand(); - IEncipher((UInt32*)&buf, kEncryptChunkSize / sizeof(UInt32)); + IEncipher((uint32_t*)&buf, kEncryptChunkSize / sizeof(uint32_t)); outputStream.Write(kEncryptChunkSize, &buf); } // Write the original file size at the start - UInt32 actualSize = sourceStream->GetPosition(); + uint32_t actualSize = sourceStream->GetPosition(); outputStream.Rewind(); outputStream.Skip(kMagicStringLen); outputStream.WriteLE32(actualSize); @@ -572,15 +572,15 @@ bool plSecureStream::IWriteEncrypted(hsStream* sourceStream, const wchar* output return true; } -bool plSecureStream::FileEncrypt(const char* fileName, UInt32* key /* = nil */) +bool plSecureStream::FileEncrypt(const char* fileName, uint32_t* key /* = nil */) { - wchar* wFilename = hsStringToWString(fileName); + wchar_t* wFilename = hsStringToWString(fileName); bool ret = FileEncrypt(wFilename, key); delete [] wFilename; return ret; } -bool plSecureStream::FileEncrypt(const wchar* fileName, UInt32* key /* = nil */) +bool plSecureStream::FileEncrypt(const wchar_t* fileName, uint32_t* key /* = nil */) { hsUNIXStream sIn; if (!sIn.Open(fileName)) @@ -609,15 +609,15 @@ bool plSecureStream::FileEncrypt(const wchar* fileName, UInt32* key /* = nil */) return true; } -bool plSecureStream::FileDecrypt(const char* fileName, UInt32* key /* = nil */) +bool plSecureStream::FileDecrypt(const char* fileName, uint32_t* key /* = nil */) { - wchar* wFilename = hsStringToWString(fileName); + wchar_t* wFilename = hsStringToWString(fileName); bool ret = FileDecrypt(wFilename, key); delete [] wFilename; return ret; } -bool plSecureStream::FileDecrypt(const wchar* fileName, UInt32* key /* = nil */) +bool plSecureStream::FileDecrypt(const wchar_t* fileName, uint32_t* key /* = nil */) { plSecureStream sIn(false, key); if (!sIn.Open(fileName)) @@ -634,7 +634,7 @@ bool plSecureStream::FileDecrypt(const wchar* fileName, UInt32* key /* = nil */) while (!sIn.AtEnd()) { - UInt32 numRead = sIn.Read(sizeof(buf), buf); + uint32_t numRead = sIn.Read(sizeof(buf), buf); sOut.Write(numRead, buf); } @@ -670,13 +670,13 @@ bool plSecureStream::ICheckMagicString(hsFD fp) bool plSecureStream::IsSecureFile(const char* fileName) { - wchar* wFilename = hsStringToWString(fileName); + wchar_t* wFilename = hsStringToWString(fileName); bool ret = IsSecureFile(wFilename); delete [] wFilename; return ret; } -bool plSecureStream::IsSecureFile(const wchar* fileName) +bool plSecureStream::IsSecureFile(const wchar_t* fileName) { hsFD fp = INVALID_HANDLE_VALUE; @@ -708,15 +708,15 @@ bool plSecureStream::IsSecureFile(const wchar* fileName) return isEncrypted; } -hsStream* plSecureStream::OpenSecureFile(const char* fileName, const UInt32 flags /* = kRequireEncryption */, UInt32* key /* = nil */) +hsStream* plSecureStream::OpenSecureFile(const char* fileName, const uint32_t flags /* = kRequireEncryption */, uint32_t* key /* = nil */) { - wchar* wFilename = hsStringToWString(fileName); + wchar_t* wFilename = hsStringToWString(fileName); hsStream* ret = OpenSecureFile(wFilename, flags, key); delete [] wFilename; return ret; } -hsStream* plSecureStream::OpenSecureFile(const wchar* fileName, const UInt32 flags /* = kRequireEncryption */, UInt32* key /* = nil */) +hsStream* plSecureStream::OpenSecureFile(const wchar_t* fileName, const uint32_t flags /* = kRequireEncryption */, uint32_t* key /* = nil */) { bool requireEncryption = flags & kRequireEncryption; #ifndef PLASMA_EXTERNAL_RELEASE @@ -728,30 +728,30 @@ hsStream* plSecureStream::OpenSecureFile(const wchar* fileName, const UInt32 fla hsStream* s = nil; if (isEncrypted) - s = TRACKED_NEW plSecureStream(deleteOnExit, key); + s = new plSecureStream(deleteOnExit, key); else if (!requireEncryption) // If this isn't an external release, let them use unencrypted data - s = TRACKED_NEW hsUNIXStream; + s = new hsUNIXStream; if (s) s->Open(fileName, L"rb"); return s; } -hsStream* plSecureStream::OpenSecureFileWrite(const char* fileName, UInt32* key /* = nil */) +hsStream* plSecureStream::OpenSecureFileWrite(const char* fileName, uint32_t* key /* = nil */) { - wchar* wFilename = hsStringToWString(fileName); + wchar_t* wFilename = hsStringToWString(fileName); hsStream* ret = OpenSecureFileWrite(wFilename, key); delete [] wFilename; return ret; } -hsStream* plSecureStream::OpenSecureFileWrite(const wchar* fileName, UInt32* key /* = nil */) +hsStream* plSecureStream::OpenSecureFileWrite(const wchar_t* fileName, uint32_t* key /* = nil */) { hsStream* s = nil; #ifdef PLASMA_EXTERNAL_RELEASE - s = TRACKED_NEW plSecureStream(false, key); + s = new plSecureStream(false, key); #else - s = TRACKED_NEW hsUNIXStream; + s = new hsUNIXStream; #endif s->Open(fileName, L"wb"); diff --git a/Sources/Plasma/PubUtilLib/plFile/plSecureStream.h b/Sources/Plasma/PubUtilLib/plFile/plSecureStream.h index f2f5a846..26c414a1 100644 --- a/Sources/Plasma/PubUtilLib/plFile/plSecureStream.h +++ b/Sources/Plasma/PubUtilLib/plFile/plSecureStream.h @@ -42,10 +42,10 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #ifndef plSecureStream_h_inc #define plSecureStream_h_inc +#include "HeadSpin.h" #include "hsStream.h" #if HS_BUILD_FOR_WIN32 -# include # define hsFD HANDLE #else # define hsFD FILE* @@ -60,15 +60,15 @@ class plSecureStream: public hsStream { protected: hsFD fRef; - UInt32 fKey[4]; + uint32_t fKey[4]; - UInt32 fActualFileSize; + uint32_t fActualFileSize; bool fBufferedStream; hsStream* fRAMStream; - wchar* fWriteFileName; + wchar_t* fWriteFileName; enum OpenMode {kOpenRead, kOpenWrite, kOpenFail}; OpenMode fOpenMode; @@ -77,40 +77,40 @@ protected: void IBufferFile(); - UInt32 IRead(UInt32 bytes, void* buffer); + uint32_t IRead(uint32_t bytes, void* buffer); - void IEncipher(UInt32* const v, UInt32 n); - void IDecipher(UInt32* const v, UInt32 n); + void IEncipher(uint32_t* const v, uint32_t n); + void IDecipher(uint32_t* const v, uint32_t n); - bool IWriteEncrypted(hsStream* sourceStream, const wchar* outputFile); + bool IWriteEncrypted(hsStream* sourceStream, const wchar_t* outputFile); static bool ICheckMagicString(hsFD fp); static bool ICheckMagicString(hsStream* s); public: - plSecureStream(hsBool deleteOnExit = false, UInt32* key = nil); // uses default key if you don't pass one in - plSecureStream(hsStream* base, UInt32* key = nil); + plSecureStream(hsBool deleteOnExit = false, uint32_t* key = nil); // uses default key if you don't pass one in + plSecureStream(hsStream* base, uint32_t* key = nil); ~plSecureStream(); virtual hsBool Open(const char* name, const char* mode = "rb"); - virtual hsBool Open(const wchar* name, const wchar* mode = L"rb"); + virtual hsBool Open(const wchar_t* name, const wchar_t* mode = L"rb"); hsBool Open(hsStream* stream); virtual hsBool Close(); - virtual UInt32 Read(UInt32 byteCount, void* buffer); - virtual UInt32 Write(UInt32 byteCount, const void* buffer); + virtual uint32_t Read(uint32_t byteCount, void* buffer); + virtual uint32_t Write(uint32_t byteCount, const void* buffer); virtual hsBool AtEnd(); - virtual void Skip(UInt32 deltaByteCount); + virtual void Skip(uint32_t deltaByteCount); virtual void Rewind(); virtual void FastFwd(); - virtual UInt32 GetEOF(); + virtual uint32_t GetEOF(); - UInt32 GetActualFileSize() const {return fActualFileSize;} + uint32_t GetActualFileSize() const {return fActualFileSize;} - static bool FileEncrypt(const char* fileName, UInt32* key = nil); - static bool FileEncrypt(const wchar* fileName, UInt32* key = nil); - static bool FileDecrypt(const char* fileName, UInt32* key = nil); - static bool FileDecrypt(const wchar* fileName, UInt32* key = nil); + static bool FileEncrypt(const char* fileName, uint32_t* key = nil); + static bool FileEncrypt(const wchar_t* fileName, uint32_t* key = nil); + static bool FileDecrypt(const char* fileName, uint32_t* key = nil); + static bool FileDecrypt(const wchar_t* fileName, uint32_t* key = nil); enum OpenSecureFileFlags { @@ -119,18 +119,18 @@ public: }; static bool IsSecureFile(const char* fileName); - static bool IsSecureFile(const wchar* fileName); + static bool IsSecureFile(const wchar_t* fileName); // Attempts to create a read-binary stream for the requested file (delete the stream // when you are done with it!) - static hsStream* OpenSecureFile(const char* fileName, const UInt32 flags = kRequireEncryption, UInt32* key = nil); - static hsStream* OpenSecureFile(const wchar* fileName, const UInt32 flags = kRequireEncryption, UInt32* key = nil); + static hsStream* OpenSecureFile(const char* fileName, const uint32_t flags = kRequireEncryption, uint32_t* key = nil); + static hsStream* OpenSecureFile(const wchar_t* fileName, const uint32_t flags = kRequireEncryption, uint32_t* key = nil); // Attempts to create a write-binary stream for the requested file (delete the stream // when you are done with it!) - static hsStream* OpenSecureFileWrite(const char* fileName, UInt32* key = nil); - static hsStream* OpenSecureFileWrite(const wchar* fileName, UInt32* key = nil); + static hsStream* OpenSecureFileWrite(const char* fileName, uint32_t* key = nil); + static hsStream* OpenSecureFileWrite(const wchar_t* fileName, uint32_t* key = nil); - static const UInt32 kDefaultKey[4]; // our default encryption key + static const uint32_t kDefaultKey[4]; // our default encryption key }; #endif // plSecureStream_h_inc diff --git a/Sources/Plasma/PubUtilLib/plFile/plStreamSource.cpp b/Sources/Plasma/PubUtilLib/plFile/plStreamSource.cpp index e6a21c5a..4ec95793 100644 --- a/Sources/Plasma/PubUtilLib/plFile/plStreamSource.cpp +++ b/Sources/Plasma/PubUtilLib/plFile/plStreamSource.cpp @@ -39,7 +39,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com Mead, WA 99021 *==LICENSE==*/ -#include "hsUtils.h" + #include "hsFiles.h" #include "plStreamSource.h" #include "plSecureStream.h" @@ -56,7 +56,7 @@ void ToLower(std::wstring& str) str[i] = towlower(str[i]); } -void ReplaceSlashes(std::wstring& path, wchar replaceWith) +void ReplaceSlashes(std::wstring& path, wchar_t replaceWith) { for (unsigned i = 0; i < path.length(); i++) { @@ -127,7 +127,7 @@ hsStream* plStreamSource::GetFile(std::wstring filename) fFileData[filename].fExt = ext; if (plSecureStream::IsSecureFile(sFilename.c_str())) { - UInt32 encryptionKey[4]; + uint32_t encryptionKey[4]; if (!plFileUtils::GetSecureEncryptionKey(sFilename.c_str(), encryptionKey, 4)) { FATAL("Hey camper... You need an NTD key file!"); diff --git a/Sources/Plasma/PubUtilLib/plGImage/CMakeLists.txt b/Sources/Plasma/PubUtilLib/plGImage/CMakeLists.txt index 992e5853..176be87e 100644 --- a/Sources/Plasma/PubUtilLib/plGImage/CMakeLists.txt +++ b/Sources/Plasma/PubUtilLib/plGImage/CMakeLists.txt @@ -29,7 +29,6 @@ set(plGImage_HEADERS hsCodecManager.h hsDXTDirectXCodec.h hsDXTSoftwareCodec.h - hsRect.h plAVIWriter.h plBitmap.h plBumpMapGen.h diff --git a/Sources/Plasma/PubUtilLib/plGImage/HS_RECT.inc b/Sources/Plasma/PubUtilLib/plGImage/HS_RECT.inc deleted file mode 100644 index c5df1315..00000000 --- a/Sources/Plasma/PubUtilLib/plGImage/HS_RECT.inc +++ /dev/null @@ -1,235 +0,0 @@ - -struct HS_RECT_NAME { - HS_RECT_TYPE fLeft, fTop, fRight, fBottom; - - HS_RECT_TYPE Width() const { return fRight - fLeft; } - HS_RECT_TYPE Height() const { return fBottom - fTop; } - hsBool IsEmpty() const { return fLeft >= fRight || fTop >= fBottom; } - - void SetEmpty() { fLeft = fTop = fRight = fBottom = 0; } - HS_RECT_NAME* Set(HS_RECT_TYPE left, HS_RECT_TYPE top, HS_RECT_TYPE right, HS_RECT_TYPE bottom) - { - fLeft = left; fTop = top; fRight = right; fBottom = bottom; - return this; - } - HS_RECT_NAME* Set(const HS_RECT_POINT* p1, const HS_RECT_POINT* p2) - { - if (p1->fX < p2->fX) - { fLeft = p1->fX; - fRight = p2->fX; - } else - { fLeft = p2->fX; - fRight = p1->fX; - } - - if (p1->fY < p2->fY) - { fTop = p1->fY; - fBottom = p2->fY; - } else - { fTop = p2->fY; - fBottom = p1->fY; - } - return this; - } - HS_RECT_NAME* Set(UInt32 count, const HS_RECT_POINT pts[]) - { - if (count > 0) - { fLeft = fRight = pts[0].fX; - fTop = fBottom = pts[0].fY; - (void)this->Union(count - 1, &pts[1]); - } - return this; - } - - hsBool Contains(HS_RECT_TYPE x, HS_RECT_TYPE y) const - { - return x >= fLeft && x < fRight && y >= fTop && y < fBottom; - } - hsBool Contains(const HS_RECT_POINT* p) const - { - return this->Contains(p->fX, p->fY); - } - hsBool Contains(const HS_RECT_NAME* r) const - { - return fLeft <= r->fLeft && fTop <= r->fTop && fRight >= r->fRight && fBottom >= r->fBottom; - } - hsBool Contains(HS_RECT_TYPE left, HS_RECT_TYPE top, HS_RECT_TYPE right, HS_RECT_TYPE bottom) const - { - return fLeft <= left && fTop <= top && fRight >= right && fBottom >= bottom; - } - HS_RECT_NAME* Offset(HS_RECT_TYPE dx, HS_RECT_TYPE dy) - { - fLeft += dx; fTop += dy; fRight += dx; fBottom += dy; - return this; - } - HS_RECT_NAME* MoveTo(HS_RECT_TYPE x, HS_RECT_TYPE y) - { - this->fRight += x - this->fLeft; - this->fBottom += y - this->fTop; - this->fLeft = x; - this->fTop = y; - return this; - } - HS_RECT_NAME* Inset(HS_RECT_TYPE dx, HS_RECT_TYPE dy) - { - fLeft += dx; fRight -= dx; - fTop += dy; fBottom -= dy; - return this; - } - - HS_RECT_NAME* UnionX(HS_RECT_TYPE x) - { - if (x < fLeft) fLeft = x; else - if (x > fRight) fRight = x; - return this; - } - HS_RECT_NAME* UnionY(HS_RECT_TYPE y) - { - if (y < fTop) fTop = y; else - if (y > fBottom) fBottom = y; - return this; - } - HS_RECT_NAME* Union(const HS_RECT_NAME* r) - { - if (r->fLeft < fLeft) fLeft = r->fLeft; - if (r->fTop < fTop) fTop = r->fTop; - if (r->fRight > fRight) fRight = r->fRight; - if (r->fBottom > fBottom) fBottom = r->fBottom; - return this; - } - HS_RECT_NAME* Union(const HS_RECT_POINT* p) - { - if (p->fX < fLeft) fLeft = p->fX; - if (p->fX > fRight) fRight = p->fX; - if (p->fY < fTop) fTop = p->fY; - if (p->fY> fBottom) fBottom = p->fY; - return this; - } - HS_RECT_NAME* Union(UInt32 count, const HS_RECT_POINT p[]) - { - HS_RECT_TYPE left = this->fLeft; - HS_RECT_TYPE top = this->fTop; - HS_RECT_TYPE right = this->fRight; - HS_RECT_TYPE bottom = this->fBottom; - - for (; count > 0; ++p, --count) - { HS_RECT_TYPE value = p->fX; - if (value < left) left = value; - else if (value > right) right = value; - - value = p->fY; - if (value < top) top = value; - else if (value > bottom) bottom = value; - } - return this->Set(left, top, right, bottom); - } - -#if 0 // Havok reeks - friend int operator==(const HS_RECT_NAME& a, const HS_RECT_NAME& b) - { - return a.fLeft == b.fLeft && a.fTop == b.fTop && - a.fRight == b.fRight && a.fBottom == b.fBottom; - } - friend int operator!=(const HS_RECT_NAME& a, const HS_RECT_NAME& b) - { - return !(a == b); - } -#else // Havok reeks - int operator==(const HS_RECT_NAME& aa) const - { - return aa.fLeft == fLeft && aa.fTop == fTop && - aa.fRight == fRight && aa.fBottom == fBottom; - } - int operator!=(const HS_RECT_NAME& aa) const - { - return !(aa == *this); - } -#endif // Havok reeks - - // Intersect Test - friend int operator&&(const HS_RECT_NAME& a, const HS_RECT_NAME& b) - { - return a.fLeft < b.fRight && a.fRight > b.fLeft && - a.fTop < b.fBottom && a.fBottom > b.fTop; - } - - hsBool Intersect(const HS_RECT_NAME* r) - { - return this->Intersect(r->fLeft, r->fTop, r->fRight, r->fBottom); - } - hsBool Intersect(HS_RECT_TYPE left, HS_RECT_TYPE top, HS_RECT_TYPE right, HS_RECT_TYPE bottom) - { - if (left < fRight && top < fBottom && fLeft < right && fTop < bottom) - { if (left > fLeft) fLeft = left; - if (top > fTop) fTop = top; - if (right < fRight) fRight = right; - if (bottom < fBottom) fBottom = bottom; - return true; - } - return false; - } - hsBool Intersect(const HS_RECT_NAME* a, const HS_RECT_NAME* b) - { - if (a->fLeft < b->fRight && a->fTop < b->fBottom && b->fLeft < a->fRight && b->fTop < a->fBottom) - { *this = *b; - if (a->fLeft > fLeft) fLeft = a->fLeft; - if (a->fTop > fTop) fTop = a->fTop; - if (a->fRight < fRight) fRight = a->fRight; - if (a->fBottom < fBottom) fBottom = a->fBottom; - return true; - } - return false; // "this" is not changed - } - - HS_RECT_POINT* ToQuad(HS_RECT_POINT quad[4]) const - { - quad[0].fX = fLeft; quad[0].fY = fTop; - quad[1].fX = fRight; quad[1].fY = fTop; - quad[2].fX = fRight; quad[2].fY = fBottom; - quad[3].fX = fLeft; quad[3].fY = fBottom; - return quad; - } - - hsBool CornerTest(const HS_RECT_NAME* area, - HS_RECT_POINT* hitPt = nil, HS_RECT_POINT* oppositePt = nil) const - { - if (area->Contains(fLeft, fTop)) - { if (hitPt) hitPt->Set(fLeft, fTop); - if (oppositePt) oppositePt->Set(fRight, fBottom); - return true; - } - if (area->Contains(fLeft, fBottom)) - { if (hitPt) hitPt->Set(fLeft, fBottom); - if (oppositePt) oppositePt->Set(fRight, fTop); - return true; - } - if (area->Contains(fRight, fTop)) - { if (hitPt) hitPt->Set(fRight, fTop); - if (oppositePt) oppositePt->Set(fLeft, fBottom); - return true; - } - if (area->Contains(fRight, fBottom)) - { if (hitPt) hitPt->Set(fRight, fBottom); - if (oppositePt) oppositePt->Set(fLeft, fTop); - return true; - } - return false; - } - hsBool CornerTest(HS_RECT_POINT* pt, HS_RECT_TYPE tolerance, - HS_RECT_POINT* hitPt = nil, HS_RECT_POINT* oppositePt = nil) const - { - HS_RECT_NAME area = { pt->fX - tolerance, pt->fY - tolerance, - pt->fX + tolerance, pt->fY + tolerance }; - - return this->CornerTest(&area, hitPt, oppositePt); - } - -#if !(HS_RECT_EXTEND) -}; -#endif - -#undef HS_RECT_NAME -#undef HS_RECT_POINT -#undef HS_RECT_TYPE -#undef HS_RECT_EXTEND - diff --git a/Sources/Plasma/PubUtilLib/plGImage/hsCodec.h b/Sources/Plasma/PubUtilLib/plGImage/hsCodec.h index 60a4ded3..5529dffa 100644 --- a/Sources/Plasma/PubUtilLib/plGImage/hsCodec.h +++ b/Sources/Plasma/PubUtilLib/plGImage/hsCodec.h @@ -48,8 +48,8 @@ class hsCodec { public: virtual plMipmap *CreateCompressedMipmap( plMipmap *uncompressed ) = 0; - virtual plMipmap *CreateUncompressedMipmap( plMipmap *compressed, UInt8 bitDepth = 0 ) = 0; - virtual hsBool ColorizeCompMipmap( plMipmap *bMap, const UInt8 *colorMask ) = 0; + virtual plMipmap *CreateUncompressedMipmap( plMipmap *compressed, uint8_t bitDepth = 0 ) = 0; + virtual hsBool ColorizeCompMipmap( plMipmap *bMap, const uint8_t *colorMask ) = 0; }; #endif // hsCodec_inc diff --git a/Sources/Plasma/PubUtilLib/plGImage/hsCodecManager.cpp b/Sources/Plasma/PubUtilLib/plGImage/hsCodecManager.cpp index b95ecb66..31d7e1db 100644 --- a/Sources/Plasma/PubUtilLib/plGImage/hsCodecManager.cpp +++ b/Sources/Plasma/PubUtilLib/plGImage/hsCodecManager.cpp @@ -69,9 +69,9 @@ hsCodecManager::hsCodecManager() { } -plMipmap *hsCodecManager::CreateCompressedMipmap(UInt32 compressionFormat, plMipmap *uncompressed) +plMipmap *hsCodecManager::CreateCompressedMipmap(uint32_t compressionFormat, plMipmap *uncompressed) { - Int32 i, j; + int32_t i, j; for (i = 0; i < fCodecTable.Count(); i++) { if (fCodecTable[i].fCompressionFormat == compressionFormat) @@ -97,9 +97,9 @@ plMipmap *hsCodecManager::CreateCompressedMipmap(UInt32 compressionFormat, plMip return nil; } -plMipmap *hsCodecManager::CreateUncompressedMipmap(plMipmap *compressed, UInt8 bitDepth) +plMipmap *hsCodecManager::CreateUncompressedMipmap(plMipmap *compressed, uint8_t bitDepth) { - Int32 i, j; + int32_t i, j; for (i = 0; i < fCodecTable.Count(); i++) { if( fCodecTable[i].fCompressionFormat == compressed->fCompressionType ) @@ -125,9 +125,9 @@ plMipmap *hsCodecManager::CreateUncompressedMipmap(plMipmap *compressed, UInt8 b return nil; } -hsBool hsCodecManager::ColorizeCompMipmap( plMipmap *bMap, const UInt8 *colorMask ) +hsBool hsCodecManager::ColorizeCompMipmap( plMipmap *bMap, const uint8_t *colorMask ) { - Int32 i, j; + int32_t i, j; for( i = 0; i < fCodecTable.Count(); i++ ) @@ -148,9 +148,9 @@ hsBool hsCodecManager::ColorizeCompMipmap( plMipmap *bMap, const UInt8 *colorMas return false; } -hsBool hsCodecManager::Register(hsCodec *codec, UInt32 compressionFormat, hsScalar priority) +hsBool hsCodecManager::Register(hsCodec *codec, uint32_t compressionFormat, float priority) { - Int32 i, j; + int32_t i, j; for (i = 0; i < fCodecTable.Count(); i++) { if (fCodecTable[i].fCompressionFormat == compressionFormat) diff --git a/Sources/Plasma/PubUtilLib/plGImage/hsCodecManager.h b/Sources/Plasma/PubUtilLib/plGImage/hsCodecManager.h index 6e049555..fc762a77 100644 --- a/Sources/Plasma/PubUtilLib/plGImage/hsCodecManager.h +++ b/Sources/Plasma/PubUtilLib/plGImage/hsCodecManager.h @@ -67,11 +67,11 @@ public: ~hsCodecManager() { } static hsCodecManager& Instance(); - plMipmap *CreateCompressedMipmap( UInt32 compressionFormat, plMipmap *uncompressed ); - plMipmap *CreateUncompressedMipmap( plMipmap *compressed, UInt8 bitDepth = 0 ); - hsBool ColorizeCompMipmap( plMipmap *bMap, const UInt8 *colorMask ); + plMipmap *CreateCompressedMipmap( uint32_t compressionFormat, plMipmap *uncompressed ); + plMipmap *CreateUncompressedMipmap( plMipmap *compressed, uint8_t bitDepth = 0 ); + hsBool ColorizeCompMipmap( plMipmap *bMap, const uint8_t *colorMask ); - hsBool Register(hsCodec *codec, UInt32 compressionFormat, hsScalar priority); + hsBool Register(hsCodec *codec, uint32_t compressionFormat, float priority); /// Decompression flags enum { @@ -83,7 +83,7 @@ public: k16BitDepth = 0x0001, k32BitDepth = 0x0002 }; - enum { /// Byte orders + enum { /// uint8_t orders kNormalCompOrder = 0x0000, // DirectX, Glide kWeirdCompOrder = 0x0004 // OpenGL }; @@ -92,18 +92,18 @@ private: struct hsCodecEntry { hsCodecEntry() : fPriority(0), fCodec(nil) { } - hsCodecEntry(hsScalar p, hsCodec *c) : fPriority(p), fCodec(c) { } + hsCodecEntry(float p, hsCodec *c) : fPriority(p), fCodec(c) { } - hsScalar fPriority; + float fPriority; hsCodec *fCodec; }; struct hsCodecList { hsCodecList() : fCompressionFormat(0) { } - hsCodecList(UInt32 f) : fCompressionFormat(f) { } + hsCodecList(uint32_t f) : fCompressionFormat(f) { } - UInt32 fCompressionFormat; + uint32_t fCompressionFormat; hsTArray fCodecList; }; diff --git a/Sources/Plasma/PubUtilLib/plGImage/hsDXTDirectXCodec.cpp b/Sources/Plasma/PubUtilLib/plGImage/hsDXTDirectXCodec.cpp index 3f68ba44..5f0afd1c 100644 --- a/Sources/Plasma/PubUtilLib/plGImage/hsDXTDirectXCodec.cpp +++ b/Sources/Plasma/PubUtilLib/plGImage/hsDXTDirectXCodec.cpp @@ -51,16 +51,13 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // // /////////////////////////////////////////////////////////////////////////////// - -#include "hsConfig.h" -#include "hsWindows.h" +#include "HeadSpin.h" #if HS_BUILD_FOR_WIN32 #include #include #endif -#include "hsTypes.h" #include "hsDXTDirectXCodec.h" #include "plMipmap.h" #include "hsCodecManager.h" @@ -180,9 +177,9 @@ plMipmap *hsDXTDirectXCodec::CreateCompressedMipmap( plMipmap *uncompressed ) const plMipmap *b = uncompressed; plMipmap *compressed = nil; - UInt32 numLevels = 1, numCompLevels; - UInt32 compFormat, totalSize, compSize; - Int32 width, height, blockSize, i; + uint32_t numLevels = 1, numCompLevels; + uint32_t compFormat, totalSize, compSize; + int32_t width, height, blockSize, i; /// Sanity checks, initialization, etc. @@ -236,7 +233,7 @@ plMipmap *hsDXTDirectXCodec::CreateCompressedMipmap( plMipmap *uncompressed ) numLevels = numCompLevels; for( ; i < uncompressed->GetNumLevels(); i++ ) { - totalSize += uncompressed->GetLevelSize( (UInt8)i ); + totalSize += uncompressed->GetLevelSize( (uint8_t)i ); width >>= 1; height >>= 1; @@ -260,7 +257,7 @@ plMipmap *hsDXTDirectXCodec::CreateCompressedMipmap( plMipmap *uncompressed ) /// Now set up the data structures - compressed = TRACKED_NEW plMipmap( uncompressed->GetWidth(), uncompressed->GetHeight(), plMipmap::kARGB32Config, + compressed = new plMipmap( uncompressed->GetWidth(), uncompressed->GetHeight(), plMipmap::kARGB32Config, uncompressed->GetNumLevels(), plMipmap::kDirectXCompression, ( compFormat == D3DTEXTURE_FMT_FOURCC_DXT1 ) ? plMipmap::DirectXInfo::kDXT1 : plMipmap::DirectXInfo::kDXT5 ); @@ -274,8 +271,8 @@ plMipmap *hsDXTDirectXCodec::CreateCompressedMipmap( plMipmap *uncompressed ) /// Now copy the rest straight over for( i = numCompLevels; i < numLevels; i++ ) { - memcpy( compressed->GetLevelPtr( (UInt8)i ), uncompressed->GetLevelPtr( (UInt8)i ), - uncompressed->GetLevelSize( (UInt8)i ) ); + memcpy( compressed->GetLevelPtr( (uint8_t)i ), uncompressed->GetLevelPtr( (uint8_t)i ), + uncompressed->GetLevelSize( (uint8_t)i ) ); } } @@ -292,15 +289,15 @@ plMipmap *hsDXTDirectXCodec::CreateCompressedMipmap( plMipmap *uncompressed ) // clean it ALL up) plMipmap *hsDXTDirectXCodec::CreateUncompressedMipmap( plMipmap *compressed, - UInt8 bitDepth ) + uint8_t bitDepth ) { /// Use software decompression ALWAYS return nil; /* plMipmap *uncompressed = nil; - UInt32 mmlvs, formatType, numCompLevels; - Int32 totalSize, width, height, i; + uint32_t mmlvs, formatType, numCompLevels; + int32_t totalSize, width, height, i; /// Check bit depth--if it's 16 bit, we don't support it (for now) @@ -367,12 +364,12 @@ plMipmap *hsDXTDirectXCodec::CreateUncompressedMipmap( plMipmap *compressed, /// Set up the uncompressed data structure if( compressed->fFlags & hsGMipmap::kMipMap ) { - mmUncompressed = TRACKED_NEW hsGMipmapClass; + mmUncompressed = new hsGMipmapClass; uncompressed = mmUncompressed; } else { - uncompressed = TRACKED_NEW plMipmap; + uncompressed = new plMipmap; mmUncompressed = nil; } @@ -430,7 +427,7 @@ plMipmap *hsDXTDirectXCodec::CreateUncompressedMipmap( plMipmap *compressed, } #if HS_BUILD_FOR_WIN32 -UInt32 hsDXTDirectXCodec::ICompressedFormat(const plMipmap *uncompressed) +uint32_t hsDXTDirectXCodec::ICompressedFormat(const plMipmap *uncompressed) { if( uncompressed->GetFlags() & plMipmap::kAlphaChannelFlag ) return D3DTEXTURE_FMT_FOURCC_DXT5; @@ -442,7 +439,7 @@ UInt32 hsDXTDirectXCodec::ICompressedFormat(const plMipmap *uncompressed) // Changed to a local function 6.8.2001 to avoid certain annoying problems // with headers and the compiler. -DDPIXELFORMAT IFindTextureFormat(UInt32 formatType) +DDPIXELFORMAT IFindTextureFormat(uint32_t formatType) { DDPIXELFORMAT ddPixelFormat; memset( &ddPixelFormat, 0x00, sizeof(DDPIXELFORMAT) ); @@ -473,8 +470,8 @@ DDPIXELFORMAT IFindTextureFormat(UInt32 formatType) } } -IDirectDrawSurface7 *hsDXTDirectXCodec::IMakeDirect3DSurface(UInt32 formatType, UInt32 mipMapLevels, - UInt32 width, UInt32 height) +IDirectDrawSurface7 *hsDXTDirectXCodec::IMakeDirect3DSurface(uint32_t formatType, uint32_t mipMapLevels, + uint32_t width, uint32_t height) { DDSURFACEDESC2 ddsd2; memset( &ddsd2, 0x00, sizeof(DDSURFACEDESC2) ); @@ -500,10 +497,10 @@ IDirectDrawSurface7 *hsDXTDirectXCodec::IMakeDirect3DSurface(UInt32 formatType, return lpDDsTex; } -void hsDXTDirectXCodec::IFillSurface(hsRGBAColor32* src, UInt32 mmlvs, IDirectDrawSurface7 *pddsDest) +void hsDXTDirectXCodec::IFillSurface(hsRGBAColor32* src, uint32_t mmlvs, IDirectDrawSurface7 *pddsDest) { - UInt8 *pTexDat = (UInt8*)src; - UInt32 cap = 0; + uint8_t *pTexDat = (uint8_t*)src; + uint32_t cap = 0; HRESULT hr; DDSCAPS2 ddsCaps2; @@ -517,7 +514,7 @@ void hsDXTDirectXCodec::IFillSurface(hsRGBAColor32* src, UInt32 mmlvs, IDirectDr hr = pddsDest->Lock( NULL, &ddsd2, DDLOCK_WAIT | DDLOCK_WRITEONLY | DDLOCK_DISCARDCONTENTS, NULL ); if (ddsd2.ddpfPixelFormat.dwFlags == DDPF_FOURCC) { - Int32 blockSize = (ddsd2.ddpfPixelFormat.dwFourCC == FOURCC_DXT1) ? 8 : 16; + int32_t blockSize = (ddsd2.ddpfPixelFormat.dwFourCC == FOURCC_DXT1) ? 8 : 16; cap = ddsd2.dwHeight * ddsd2.dwWidth * blockSize >> 4; memcpy( (char*)ddsd2.lpSurface, pTexDat, cap ); pTexDat += cap; @@ -526,9 +523,9 @@ void hsDXTDirectXCodec::IFillSurface(hsRGBAColor32* src, UInt32 mmlvs, IDirectDr { hsAssert(ddsd2.ddpfPixelFormat.dwRGBBitCount == 32, "Format not supported."); - Int32* dest = (Int32*)ddsd2.lpSurface; - Int32 pixelCount = ddsd2.dwHeight * ddsd2.dwWidth; - Int32 j; + int32_t* dest = (int32_t*)ddsd2.lpSurface; + int32_t pixelCount = ddsd2.dwHeight * ddsd2.dwWidth; + int32_t j; for (j = 0; j < pixelCount; ++j) { dest[j] = ( ( src->a << 24 ) | ( src->r << 16 ) | ( src->g << 8 ) | src->b ); @@ -544,10 +541,10 @@ void hsDXTDirectXCodec::IFillSurface(hsRGBAColor32* src, UInt32 mmlvs, IDirectDr } } -void hsDXTDirectXCodec::IFillFromSurface(hsRGBAColor32* dest, UInt32 mmlvs, IDirectDrawSurface7 *pddsSrc) +void hsDXTDirectXCodec::IFillFromSurface(hsRGBAColor32* dest, uint32_t mmlvs, IDirectDrawSurface7 *pddsSrc) { - UInt8 *pTexDat = (UInt8 *)dest; - UInt32 cap = 0; + uint8_t *pTexDat = (uint8_t *)dest; + uint32_t cap = 0; HRESULT hr; DDSCAPS2 ddsCaps2; @@ -564,7 +561,7 @@ void hsDXTDirectXCodec::IFillFromSurface(hsRGBAColor32* dest, UInt32 mmlvs, IDir if( ddsd2.ddpfPixelFormat.dwFlags == DDPF_FOURCC ) { - Int32 blockSize = ( ddsd2.ddpfPixelFormat.dwFourCC == FOURCC_DXT1 ) ? 8 : 16; + int32_t blockSize = ( ddsd2.ddpfPixelFormat.dwFourCC == FOURCC_DXT1 ) ? 8 : 16; cap = ddsd2.dwHeight * ddsd2.dwWidth * blockSize >> 4; memcpy( pTexDat, (char*)ddsd2.lpSurface, cap ); @@ -574,15 +571,15 @@ void hsDXTDirectXCodec::IFillFromSurface(hsRGBAColor32* dest, UInt32 mmlvs, IDir { hsAssert( ddsd2.ddpfPixelFormat.dwRGBBitCount == 32, "Format not supported." ); - Int32* src = (Int32*)ddsd2.lpSurface; - Int32 pixelCount = ddsd2.dwHeight * ddsd2.dwWidth; - Int32 j; + int32_t* src = (int32_t*)ddsd2.lpSurface; + int32_t pixelCount = ddsd2.dwHeight * ddsd2.dwWidth; + int32_t j; for (j = 0; j < pixelCount; ++j) { - dest->a = (UInt8)((src[j] >> 24) & 0xff); - dest->r = (UInt8)((src[j] >> 16) & 0xff); - dest->g = (UInt8)((src[j] >> 8) & 0xff); - dest->b = (UInt8)((src[j]) & 0xff); + dest->a = (uint8_t)((src[j] >> 24) & 0xff); + dest->r = (uint8_t)((src[j] >> 16) & 0xff); + dest->g = (uint8_t)((src[j] >> 8) & 0xff); + dest->b = (uint8_t)((src[j]) & 0xff); dest++; } } @@ -596,7 +593,7 @@ void hsDXTDirectXCodec::IFillFromSurface(hsRGBAColor32* dest, UInt32 mmlvs, IDir } } -void hsDXTDirectXCodec::ICopySurface(IDirectDrawSurface7 *dest, IDirectDrawSurface7 *src, Int32 mipMapLevels) +void hsDXTDirectXCodec::ICopySurface(IDirectDrawSurface7 *dest, IDirectDrawSurface7 *src, int32_t mipMapLevels) { DDSURFACEDESC2 ddsd2; memset( &ddsd2, 0x00, sizeof(DDSURFACEDESC2) ); @@ -1250,7 +1247,7 @@ void hsDXTDirectXCodec::CheckErrorCode(HRESULT res) } #endif -hsBool hsDXTDirectXCodec::ColorizeCompMipmap( plMipmap *bMap, const UInt8 *colorMask ) +hsBool hsDXTDirectXCodec::ColorizeCompMipmap( plMipmap *bMap, const uint8_t *colorMask ) { return false; } \ No newline at end of file diff --git a/Sources/Plasma/PubUtilLib/plGImage/hsDXTDirectXCodec.h b/Sources/Plasma/PubUtilLib/plGImage/hsDXTDirectXCodec.h index 5157e8fc..ceb7682f 100644 --- a/Sources/Plasma/PubUtilLib/plGImage/hsDXTDirectXCodec.h +++ b/Sources/Plasma/PubUtilLib/plGImage/hsDXTDirectXCodec.h @@ -55,7 +55,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #define hsDXTDirectXCodec_inc -#include "hsWindows.h" + #include "hsCodec.h" class plMipmap; @@ -76,10 +76,10 @@ public: static void Init() { fRegistered = Register(); } plMipmap *CreateCompressedMipmap(plMipmap *uncompressed); - plMipmap *CreateUncompressedMipmap(plMipmap *compressed, UInt8 bitDepth = 0); + plMipmap *CreateUncompressedMipmap(plMipmap *compressed, uint8_t bitDepth = 0); // Colorize a compressed mipmap - hsBool ColorizeCompMipmap( plMipmap *bMap, const UInt8 *colorMask ); + hsBool ColorizeCompMipmap( plMipmap *bMap, const uint8_t *colorMask ); #if HS_BUILD_FOR_WIN32 void Initialize( IDirect3DDevice8 *directDraw ); @@ -88,11 +88,11 @@ public: #if HS_BUILD_FOR_WIN32 private: - UInt32 ICompressedFormat(const plMipmap *uncompressed); - IDirectDrawSurface7 *IMakeDirect3DSurface( UInt32 formatType, UInt32 mipMapLevels, UInt32 width, UInt32 height ); - void IFillSurface( hsRGBAColor32* src, UInt32 mmlvs, IDirectDrawSurface7 *pddsDest ); - void IFillFromSurface( hsRGBAColor32* dest, UInt32 mmlvs, IDirectDrawSurface7 *pddsSrc ); - void ICopySurface( IDirectDrawSurface7 *dest, IDirectDrawSurface7 *src, Int32 mipMapLevels ); + uint32_t ICompressedFormat(const plMipmap *uncompressed); + IDirectDrawSurface7 *IMakeDirect3DSurface( uint32_t formatType, uint32_t mipMapLevels, uint32_t width, uint32_t height ); + void IFillSurface( hsRGBAColor32* src, uint32_t mmlvs, IDirectDrawSurface7 *pddsDest ); + void IFillFromSurface( hsRGBAColor32* dest, uint32_t mmlvs, IDirectDrawSurface7 *pddsSrc ); + void ICopySurface( IDirectDrawSurface7 *dest, IDirectDrawSurface7 *src, int32_t mipMapLevels ); void CheckErrorCode(HRESULT res); hsBool IInitialize(); #endif @@ -104,7 +104,7 @@ private: void* fDirectDraw; void* fDDLibraryInstance; #endif - UInt32 fFlags; + uint32_t fFlags; enum { diff --git a/Sources/Plasma/PubUtilLib/plGImage/hsDXTSoftwareCodec.cpp b/Sources/Plasma/PubUtilLib/plGImage/hsDXTSoftwareCodec.cpp index ed158881..07967fb1 100644 --- a/Sources/Plasma/PubUtilLib/plGImage/hsDXTSoftwareCodec.cpp +++ b/Sources/Plasma/PubUtilLib/plGImage/hsDXTSoftwareCodec.cpp @@ -40,7 +40,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ #include -#include "hsTypes.h" +#include "HeadSpin.h" #include "hsDXTSoftwareCodec.h" #include "plMipmap.h" #include "hsCodecManager.h" @@ -75,9 +75,9 @@ hsDXTSoftwareCodec::~hsDXTSoftwareCodec() plMipmap *hsDXTSoftwareCodec::CreateCompressedMipmap( plMipmap *uncompressed ) { - UInt8 format; + uint8_t format; plMipmap *compressed = nil; - UInt8 i; + uint8_t i; /// Sanity checks @@ -94,7 +94,7 @@ plMipmap *hsDXTSoftwareCodec::CreateCompressedMipmap( plMipmap *uncompressed ) /// Set up structure - compressed = TRACKED_NEW plMipmap( uncompressed->GetWidth(), uncompressed->GetHeight(), plMipmap::kARGB32Config, + compressed = new plMipmap( uncompressed->GetWidth(), uncompressed->GetHeight(), plMipmap::kARGB32Config, uncompressed->GetNumLevels(), plMipmap::kDirectXCompression, format ); { @@ -131,12 +131,12 @@ plMipmap *hsDXTSoftwareCodec::CreateCompressedMipmap( plMipmap *uncompressed ) // (i.e. they're not compressed). See CreateCompressedMipmap(). // 8.18.2000 mcn - Updated to handle new flags instead of just a bit depth -plMipmap *hsDXTSoftwareCodec::CreateUncompressedMipmap( plMipmap *compressed, UInt8 flags ) +plMipmap *hsDXTSoftwareCodec::CreateUncompressedMipmap( plMipmap *compressed, uint8_t flags ) { plMipmap *uncompressed = nil; - Int32 totalSize; - Int32 width, height; - UInt8 i; + int32_t totalSize; + int32_t width, height; + uint8_t i; /// Sanity checks @@ -190,7 +190,7 @@ plMipmap *hsDXTSoftwareCodec::CreateUncompressedMipmap( plMipmap *compressed, UI uncompressed->SetCurrLevel( i ); compressed->SetCurrLevel( i ); - IXlateColorBlock( (plMipmap *)uncompressed, (UInt32 *)compressed->GetLevelPtr( i ), flags ); + IXlateColorBlock( (plMipmap *)uncompressed, (uint32_t *)compressed->GetLevelPtr( i ), flags ); } /// Reset @@ -204,11 +204,11 @@ plMipmap *hsDXTSoftwareCodec::CreateUncompressedMipmap( plMipmap *compressed, UI //// IXlateColorBlock ///////////////////////////////////////////////////////// // Converts a block from ARGB 8888 to the given format of the bitmap. -void hsDXTSoftwareCodec::IXlateColorBlock( plMipmap *destBMap, UInt32 *srcBlock, UInt8 flags ) +void hsDXTSoftwareCodec::IXlateColorBlock( plMipmap *destBMap, uint32_t *srcBlock, uint8_t flags ) { - UInt8 *bytePtr; - UInt16 *wordPtr, tempVal; - UInt32 i; + uint8_t *bytePtr; + uint16_t *wordPtr, tempVal; + uint32_t i; if( destBMap->fUncompressedInfo.fType == plMipmap::UncompressedInfo::kRGB8888 ) @@ -218,31 +218,31 @@ void hsDXTSoftwareCodec::IXlateColorBlock( plMipmap *destBMap, UInt32 *srcBlo if( destBMap->fUncompressedInfo.fType == plMipmap::UncompressedInfo::kAInten88 ) { /// Upper 8 bits from alpha, lower 8 bits from blue - wordPtr = (UInt16 *)destBMap->GetCurrLevelPtr(); + wordPtr = (uint16_t *)destBMap->GetCurrLevelPtr(); for( i = 0; i < destBMap->GetCurrWidth() * destBMap->GetCurrHeight(); i++ ) { - wordPtr[ i ] = (UInt16)( ( ( srcBlock[ i ] >> 16 ) & 0xff00 ) | ( srcBlock[ i ] & 0x00ff ) ); + wordPtr[ i ] = (uint16_t)( ( ( srcBlock[ i ] >> 16 ) & 0xff00 ) | ( srcBlock[ i ] & 0x00ff ) ); } } else if( destBMap->fUncompressedInfo.fType == plMipmap::UncompressedInfo::kInten8 ) { /// 8 bits from blue - bytePtr = (UInt8 *)destBMap->GetCurrLevelPtr(); + bytePtr = (uint8_t *)destBMap->GetCurrLevelPtr(); for( i = 0; i < destBMap->GetCurrWidth() * destBMap->GetCurrHeight(); i++ ) { - bytePtr[ i ] = (UInt8)( srcBlock[ i ] & 0x00ff ); + bytePtr[ i ] = (uint8_t)( srcBlock[ i ] & 0x00ff ); } } else if( destBMap->fUncompressedInfo.fType == plMipmap::UncompressedInfo::kRGB1555 ) { - wordPtr = (UInt16 *)destBMap->GetCurrLevelPtr(); + wordPtr = (uint16_t *)destBMap->GetCurrLevelPtr(); if( ( flags & hsCodecManager::kCompOrderMask ) == hsCodecManager::kWeirdCompOrder ) { /// Really do 5551 for( i = 0; i < destBMap->GetCurrWidth() * destBMap->GetCurrHeight(); i++ ) { - tempVal = (UInt16)( ( ( srcBlock[ i ] & 0x000000f8 ) >> 2 ) | + tempVal = (uint16_t)( ( ( srcBlock[ i ] & 0x000000f8 ) >> 2 ) | ( ( ( srcBlock[ i ] & 0x0000f800 ) >> 5 ) ) | ( ( ( srcBlock[ i ] & 0x00f80000 ) >> 8 ) ) | ( ( srcBlock[ i ] & 0x80000000 ) >> 31 ) ); @@ -255,7 +255,7 @@ void hsDXTSoftwareCodec::IXlateColorBlock( plMipmap *destBMap, UInt32 *srcBlo /// Normal 1555 for( i = 0; i < destBMap->GetCurrWidth() * destBMap->GetCurrHeight(); i++ ) { - tempVal = (UInt16)( ( ( srcBlock[ i ] & 0x000000f8 ) >> 3 ) | + tempVal = (uint16_t)( ( ( srcBlock[ i ] & 0x000000f8 ) >> 3 ) | ( ( ( srcBlock[ i ] & 0x0000f800 ) >> 6 ) ) | ( ( ( srcBlock[ i ] & 0x00f80000 ) >> 9 ) ) | ( ( srcBlock[ i ] & 0x80000000 ) >> 16 ) ); @@ -266,14 +266,14 @@ void hsDXTSoftwareCodec::IXlateColorBlock( plMipmap *destBMap, UInt32 *srcBlo } else if( destBMap->fUncompressedInfo.fType == plMipmap::UncompressedInfo::kRGB4444 ) { - wordPtr = (UInt16 *)destBMap->GetCurrLevelPtr(); + wordPtr = (uint16_t *)destBMap->GetCurrLevelPtr(); if( ( flags & hsCodecManager::kCompOrderMask ) == hsCodecManager::kWeirdCompOrder ) { /// Really do 4444 reversed (switch red and blue) for( i = 0; i < destBMap->GetCurrWidth() * destBMap->GetCurrHeight(); i++ ) { - tempVal = (UInt16)( ( ( srcBlock[ i ] & 0x000000f0 ) << 4 ) | + tempVal = (uint16_t)( ( ( srcBlock[ i ] & 0x000000f0 ) << 4 ) | ( ( ( srcBlock[ i ] & 0x0000f000 ) >> 8 ) ) | ( ( ( srcBlock[ i ] & 0x00f00000 ) >> 20 ) ) | ( ( ( srcBlock[ i ] & 0xf0000000 ) >> 16 ) ) ); @@ -286,7 +286,7 @@ void hsDXTSoftwareCodec::IXlateColorBlock( plMipmap *destBMap, UInt32 *srcBlo /// Normal 4444 for( i = 0; i < destBMap->GetCurrWidth() * destBMap->GetCurrHeight(); i++ ) { - tempVal = (UInt16)( ( ( srcBlock[ i ] & 0x000000f0 ) >> 4 ) | + tempVal = (uint16_t)( ( ( srcBlock[ i ] & 0x000000f0 ) >> 4 ) | ( ( ( srcBlock[ i ] & 0x0000f000 ) >> 8 ) ) | ( ( ( srcBlock[ i ] & 0x00f00000 ) >> 12 ) ) | ( ( ( srcBlock[ i ] & 0xf0000000 ) >> 16 ) ) ); @@ -304,9 +304,9 @@ void hsDXTSoftwareCodec::IXlateColorBlock( plMipmap *destBMap, UInt32 *srcBlo // Sets the fields of an uncompressed bitmap according to the source // (compressed) bitmap and the given bit depth. -plMipmap *hsDXTSoftwareCodec::ICreateUncompressedMipmap( plMipmap *compressed, UInt8 flags ) +plMipmap *hsDXTSoftwareCodec::ICreateUncompressedMipmap( plMipmap *compressed, uint8_t flags ) { - UInt8 bitDepth, type; + uint8_t bitDepth, type; plMipmap *newMap; @@ -342,7 +342,7 @@ plMipmap *hsDXTSoftwareCodec::ICreateUncompressedMipmap( plMipmap *compressed type = plMipmap::UncompressedInfo::kRGB1555; } - newMap = TRACKED_NEW plMipmap( compressed->GetWidth(), compressed->GetHeight(), bitDepth, + newMap = new plMipmap( compressed->GetWidth(), compressed->GetHeight(), bitDepth, compressed->GetNumLevels(), plMipmap::kUncompressed, type ); newMap->SetFlags( compressed->GetFlags() ); @@ -358,22 +358,22 @@ plMipmap *hsDXTSoftwareCodec::ICreateUncompressedMipmap( plMipmap *compressed void hsDXTSoftwareCodec::UncompressMipmap(plMipmap *uncompressed, plMipmap *compressed) { - UInt32 *compressedImage = (UInt32 *)compressed->GetCurrLevelPtr(); - UInt32 *uncompressedImage = (UInt32 *)uncompressed->GetCurrLevelPtr(); - UInt32 blockSize = compressed->fDirectXInfo.fBlockSize; - Int32 x, y; - Int32 xMax = compressed->GetCurrWidth() >> 2; - Int32 yMax = compressed->GetCurrHeight() >> 2; + uint32_t *compressedImage = (uint32_t *)compressed->GetCurrLevelPtr(); + uint32_t *uncompressedImage = (uint32_t *)uncompressed->GetCurrLevelPtr(); + uint32_t blockSize = compressed->fDirectXInfo.fBlockSize; + int32_t x, y; + int32_t xMax = compressed->GetCurrWidth() >> 2; + int32_t yMax = compressed->GetCurrHeight() >> 2; for (x = 0; x < xMax; ++x) { for (y = 0; y < yMax; ++y) { - UInt8 alpha[8]; - UInt16 color[4]; - UInt32 *block = &compressedImage[(x + xMax * y) * (blockSize >> 2)]; - UInt8 *charBlock = (UInt8 *)block; - UInt8 *alphaBlock = nil; - UInt8 *colorBlock = nil; + uint8_t alpha[8]; + uint16_t color[4]; + uint32_t *block = &compressedImage[(x + xMax * y) * (blockSize >> 2)]; + uint8_t *charBlock = (uint8_t *)block; + uint8_t *alphaBlock = nil; + uint8_t *colorBlock = nil; if (compressed->fDirectXInfo.fCompressionType == hsGBitmap::DirectXInfo::kDXT5) { @@ -414,7 +414,7 @@ void hsDXTSoftwareCodec::UncompressMipmap(plMipmap *uncompressed, plMipmap *comp hsAssert(false, "Unrecognized compression scheme."); } - UInt32 encoding; + uint32_t encoding; color[0] = (colorBlock[1] << 8) | colorBlock[0]; color[1] = (colorBlock[3] << 8) | colorBlock[2]; @@ -442,19 +442,19 @@ void hsDXTSoftwareCodec::UncompressMipmap(plMipmap *uncompressed, plMipmap *comp encoding = kThreeColorEncoding; } - UInt8 r, g, b, a; - Int32 xx, yy; + uint8_t r, g, b, a; + int32_t xx, yy; for (xx = 0; xx < 4; ++xx) { for (yy = 0; yy < 4; ++yy) { if (alphaBlock) { - UInt32 alphaMask = 0x7; - UInt32 firstThreeBytes = (alphaBlock[4] << 16) + (alphaBlock[3] << 8) + alphaBlock[2]; - UInt32 secondThreeBytes = (alphaBlock[7] << 16) + (alphaBlock[6] << 8) + alphaBlock[5]; - UInt32 alphaIndex; - UInt32 alphaShift; + uint32_t alphaMask = 0x7; + uint32_t firstThreeBytes = (alphaBlock[4] << 16) + (alphaBlock[3] << 8) + alphaBlock[2]; + uint32_t secondThreeBytes = (alphaBlock[7] << 16) + (alphaBlock[6] << 8) + alphaBlock[5]; + uint32_t alphaIndex; + uint32_t alphaShift; if (yy < 2) { alphaShift = 3 * (4 * yy + xx); @@ -473,11 +473,11 @@ void hsDXTSoftwareCodec::UncompressMipmap(plMipmap *uncompressed, plMipmap *comp a = 255; } - UInt32 colorMask = 0x3; - UInt32 colorDWord = (colorBlock[7] << 24) | (colorBlock[6] << 16) | + uint32_t colorMask = 0x3; + uint32_t colorDWord = (colorBlock[7] << 24) | (colorBlock[6] << 16) | (colorBlock[5] << 8) | colorBlock[4]; - UInt32 colorShift = 2 * (4 * yy + xx); - UInt32 colorIndex = (colorDWord >> colorShift) & colorMask; + uint32_t colorShift = 2 * (4 * yy + xx); + uint32_t colorIndex = (colorDWord >> colorShift) & colorMask; if ((encoding == kThreeColorEncoding) && (colorIndex == 3)) { @@ -485,9 +485,9 @@ void hsDXTSoftwareCodec::UncompressMipmap(plMipmap *uncompressed, plMipmap *comp } else { - r = (UInt8)((color[colorIndex] >> 8) & 0xf8); - g = (UInt8)((color[colorIndex] >> 3) & 0xfc); - b = (UInt8)((color[colorIndex] << 3) & 0xf8); + r = (uint8_t)((color[colorIndex] >> 8) & 0xf8); + g = (uint8_t)((color[colorIndex] >> 3) & 0xfc); + b = (uint8_t)((color[colorIndex] << 3) & 0xf8); } hsRGBAColor32* pixel = (hsRGBAColor32*)uncompressed->GetAddr32(4 * x + xx, 4 * y + yy); @@ -514,7 +514,7 @@ void hsDXTSoftwareCodec::UncompressMipmap(plMipmap *uncompressed, plMipmap *comp // 7.31.2000 mcn - Created, based on old code (uncredited) // 8.18.2000 mcn - Updated to handle 'weird' formats and other flags. -void hsDXTSoftwareCodec::UncompressMipmap( plMipmap *destBMap, plMipmap *srcBMap, UInt8 flags ) +void hsDXTSoftwareCodec::UncompressMipmap( plMipmap *destBMap, plMipmap *srcBMap, uint8_t flags ) { if( destBMap->fUncompressedInfo.fType == plMipmap::UncompressedInfo::kRGB8888 ) { @@ -572,17 +572,17 @@ void hsDXTSoftwareCodec::UncompressMipmap( plMipmap *destBMap, plMipmap *srcB void hsDXTSoftwareCodec::IUncompressMipmapDXT5To16( plMipmap *destBMap, plMipmap *srcBMap ) { - UInt16 *srcData; - UInt16 *destData, destBlock[ 16 ]; - UInt32 blockSize; - UInt32 x, y, bMapStride; - UInt16 colors[ 4 ]; - Int32 numBlocks, i, j; - UInt8 *bytePtr; - UInt16 alphas[ 8 ], aTemp, a0, a1; + uint16_t *srcData; + uint16_t *destData, destBlock[ 16 ]; + uint32_t blockSize; + uint32_t x, y, bMapStride; + uint16_t colors[ 4 ]; + int32_t numBlocks, i, j; + uint8_t *bytePtr; + uint16_t alphas[ 8 ], aTemp, a0, a1; - UInt32 aBitSrc1, aBitSrc2; - UInt16 cBitSrc1, cBitSrc2; + uint32_t aBitSrc1, aBitSrc2; + uint16_t cBitSrc1, cBitSrc2; /// Setup some nifty stuff @@ -591,10 +591,10 @@ void hsDXTSoftwareCodec::IUncompressMipmapDXT5To16( plMipmap *destBMap, plMip numBlocks = ( srcBMap->GetCurrWidth() * srcBMap->GetCurrHeight() ) >> 4; blockSize = srcBMap->fDirectXInfo.fBlockSize >> 1; // In 16-bit words - srcData = (UInt16 *)srcBMap->GetCurrLevelPtr(); + srcData = (uint16_t *)srcBMap->GetCurrLevelPtr(); // Note our trick here to make sure nothing breaks if GetAddr16's // formula changes - bMapStride = (UInt32)( destBMap->GetAddr16( 0, 1 ) - destBMap->GetAddr16( 0, 0 ) ); + bMapStride = (uint32_t)( destBMap->GetAddr16( 0, 1 ) - destBMap->GetAddr16( 0, 0 ) ); x = y = 0; @@ -602,7 +602,7 @@ void hsDXTSoftwareCodec::IUncompressMipmapDXT5To16( plMipmap *destBMap, plMip for( i = 0; i < numBlocks; i++ ) { /// Per block--determine alpha compression type first - bytePtr = (UInt8 *)srcData; + bytePtr = (uint8_t *)srcData; alphas[ 0 ] = bytePtr[ 0 ]; alphas[ 1 ] = bytePtr[ 1 ]; @@ -651,12 +651,12 @@ void hsDXTSoftwareCodec::IUncompressMipmapDXT5To16( plMipmap *destBMap, plMip alphas[ 1 ] &= 0xf000; /// Now do the 16 pixels in 2 blocks, decompressing 3-bit lookups - aBitSrc1 = ( (UInt32)bytePtr[ 4 ] << 16 ) + - ( (UInt32)bytePtr[ 3 ] << 8 ) + - ( (UInt32)bytePtr[ 2 ] ); - aBitSrc2 = ( (UInt32)bytePtr[ 7 ] << 16 ) + - ( (UInt32)bytePtr[ 6 ] << 8 ) + - ( (UInt32)bytePtr[ 5 ] ); + aBitSrc1 = ( (uint32_t)bytePtr[ 4 ] << 16 ) + + ( (uint32_t)bytePtr[ 3 ] << 8 ) + + ( (uint32_t)bytePtr[ 2 ] ); + aBitSrc2 = ( (uint32_t)bytePtr[ 7 ] << 16 ) + + ( (uint32_t)bytePtr[ 6 ] << 8 ) + + ( (uint32_t)bytePtr[ 5 ] ); /// Now decompress color data srcData += 4; // Alpha was 4 16-bit words worth @@ -729,17 +729,17 @@ void hsDXTSoftwareCodec::IUncompressMipmapDXT5To16( plMipmap *destBMap, plMip void hsDXTSoftwareCodec::IUncompressMipmapDXT5To16Weird( plMipmap *destBMap, plMipmap *srcBMap ) { - UInt16 *srcData; - UInt16 *destData, destBlock[ 16 ]; - UInt32 blockSize; - UInt32 x, y, bMapStride; - UInt16 colors[ 4 ]; - Int32 numBlocks, i, j; - UInt8 *bytePtr; - UInt16 alphas[ 8 ], aTemp, a0, a1; + uint16_t *srcData; + uint16_t *destData, destBlock[ 16 ]; + uint32_t blockSize; + uint32_t x, y, bMapStride; + uint16_t colors[ 4 ]; + int32_t numBlocks, i, j; + uint8_t *bytePtr; + uint16_t alphas[ 8 ], aTemp, a0, a1; - UInt32 aBitSrc1, aBitSrc2; - UInt16 cBitSrc1, cBitSrc2; + uint32_t aBitSrc1, aBitSrc2; + uint16_t cBitSrc1, cBitSrc2; /// Setup some nifty stuff @@ -748,10 +748,10 @@ void hsDXTSoftwareCodec::IUncompressMipmapDXT5To16Weird( plMipmap *destBMap, numBlocks = ( srcBMap->GetCurrWidth() * srcBMap->GetCurrHeight() ) >> 4; blockSize = srcBMap->fDirectXInfo.fBlockSize >> 1; // In 16-bit words - srcData = (UInt16 *)srcBMap->GetCurrLevelPtr(); + srcData = (uint16_t *)srcBMap->GetCurrLevelPtr(); // Note our trick here to make sure nothing breaks if GetAddr16's // formula changes - bMapStride = (UInt32)( destBMap->GetAddr16( 0, 1 ) - destBMap->GetAddr16( 0, 0 ) ); + bMapStride = (uint32_t)( destBMap->GetAddr16( 0, 1 ) - destBMap->GetAddr16( 0, 0 ) ); x = y = 0; @@ -759,7 +759,7 @@ void hsDXTSoftwareCodec::IUncompressMipmapDXT5To16Weird( plMipmap *destBMap, for( i = 0; i < numBlocks; i++ ) { /// Per block--determine alpha compression type first - bytePtr = (UInt8 *)srcData; + bytePtr = (uint8_t *)srcData; alphas[ 0 ] = bytePtr[ 0 ]; alphas[ 1 ] = bytePtr[ 1 ]; @@ -808,12 +808,12 @@ void hsDXTSoftwareCodec::IUncompressMipmapDXT5To16Weird( plMipmap *destBMap, alphas[ 1 ] &= 0xf000; /// Now do the 16 pixels in 2 blocks, decompressing 3-bit lookups - aBitSrc1 = ( (UInt32)bytePtr[ 4 ] << 16 ) + - ( (UInt32)bytePtr[ 3 ] << 8 ) + - ( (UInt32)bytePtr[ 2 ] ); - aBitSrc2 = ( (UInt32)bytePtr[ 7 ] << 16 ) + - ( (UInt32)bytePtr[ 6 ] << 8 ) + - ( (UInt32)bytePtr[ 5 ] ); + aBitSrc1 = ( (uint32_t)bytePtr[ 4 ] << 16 ) + + ( (uint32_t)bytePtr[ 3 ] << 8 ) + + ( (uint32_t)bytePtr[ 2 ] ); + aBitSrc2 = ( (uint32_t)bytePtr[ 7 ] << 16 ) + + ( (uint32_t)bytePtr[ 6 ] << 8 ) + + ( (uint32_t)bytePtr[ 5 ] ); /// Now decompress color data srcData += 4; // Alpha was 4 16-bit words worth @@ -885,17 +885,17 @@ void hsDXTSoftwareCodec::IUncompressMipmapDXT5To16Weird( plMipmap *destBMap, void hsDXTSoftwareCodec::IUncompressMipmapDXT5To32( plMipmap *destBMap, plMipmap *srcBMap ) { - UInt16 *srcData; - UInt32 *destData, destBlock[ 16 ]; - UInt32 blockSize; - UInt32 x, y, bMapStride; - UInt32 colors[ 4 ]; - Int32 numBlocks, i, j; - UInt8 *bytePtr; - UInt32 alphas[ 8 ], aTemp, a0, a1; + uint16_t *srcData; + uint32_t *destData, destBlock[ 16 ]; + uint32_t blockSize; + uint32_t x, y, bMapStride; + uint32_t colors[ 4 ]; + int32_t numBlocks, i, j; + uint8_t *bytePtr; + uint32_t alphas[ 8 ], aTemp, a0, a1; - UInt32 aBitSrc1, aBitSrc2; - UInt16 cBitSrc1, cBitSrc2; + uint32_t aBitSrc1, aBitSrc2; + uint16_t cBitSrc1, cBitSrc2; /// Setup some nifty stuff @@ -904,10 +904,10 @@ void hsDXTSoftwareCodec::IUncompressMipmapDXT5To32( plMipmap *destBMap, plMip numBlocks = ( srcBMap->GetCurrWidth() * srcBMap->GetCurrHeight() ) >> 4; blockSize = srcBMap->fDirectXInfo.fBlockSize >> 1; // In 16-bit words - srcData = (UInt16 *)srcBMap->GetCurrLevelPtr(); + srcData = (uint16_t *)srcBMap->GetCurrLevelPtr(); // Note our trick here to make sure nothing breaks if GetAddr32's // formula changes - bMapStride = (UInt32)( destBMap->GetAddr32( 0, 1 ) - destBMap->GetAddr32( 0, 0 ) ); + bMapStride = (uint32_t)( destBMap->GetAddr32( 0, 1 ) - destBMap->GetAddr32( 0, 0 ) ); x = y = 0; @@ -915,7 +915,7 @@ void hsDXTSoftwareCodec::IUncompressMipmapDXT5To32( plMipmap *destBMap, plMip for( i = 0; i < numBlocks; i++ ) { /// Per block--determine alpha compression type first - bytePtr = (UInt8 *)srcData; + bytePtr = (uint8_t *)srcData; alphas[ 0 ] = bytePtr[ 0 ]; alphas[ 1 ] = bytePtr[ 1 ]; @@ -972,12 +972,12 @@ void hsDXTSoftwareCodec::IUncompressMipmapDXT5To32( plMipmap *destBMap, plMip } /// Now do the 16 pixels in 2 blocks, decompressing 3-bit lookups - aBitSrc1 = ( (UInt32)bytePtr[ 4 ] << 16 ) + - ( (UInt32)bytePtr[ 3 ] << 8 ) + - ( (UInt32)bytePtr[ 2 ] ); - aBitSrc2 = ( (UInt32)bytePtr[ 7 ] << 16 ) + - ( (UInt32)bytePtr[ 6 ] << 8 ) + - ( (UInt32)bytePtr[ 5 ] ); + aBitSrc1 = ( (uint32_t)bytePtr[ 4 ] << 16 ) + + ( (uint32_t)bytePtr[ 3 ] << 8 ) + + ( (uint32_t)bytePtr[ 2 ] ); + aBitSrc2 = ( (uint32_t)bytePtr[ 7 ] << 16 ) + + ( (uint32_t)bytePtr[ 6 ] << 8 ) + + ( (uint32_t)bytePtr[ 5 ] ); /// Now decompress color data srcData += 4; // Alpha was 4 16-bit words worth @@ -1046,17 +1046,17 @@ void hsDXTSoftwareCodec::IUncompressMipmapDXT5To32( plMipmap *destBMap, plMip void hsDXTSoftwareCodec::IUncompressMipmapDXT5ToAInten( plMipmap *destBMap, plMipmap *srcBMap ) { - UInt16 *srcData; - UInt16 *destData, destBlock[ 16 ]; - UInt32 blockSize; - UInt32 x, y, bMapStride; - UInt8 colors[ 4 ]; - Int32 numBlocks, i, j; - UInt8 *bytePtr; - UInt16 alphas[ 8 ], aTemp, a0, a1; + uint16_t *srcData; + uint16_t *destData, destBlock[ 16 ]; + uint32_t blockSize; + uint32_t x, y, bMapStride; + uint8_t colors[ 4 ]; + int32_t numBlocks, i, j; + uint8_t *bytePtr; + uint16_t alphas[ 8 ], aTemp, a0, a1; - UInt32 aBitSrc1, aBitSrc2; - UInt16 cBitSrc1, cBitSrc2; + uint32_t aBitSrc1, aBitSrc2; + uint16_t cBitSrc1, cBitSrc2; /// Setup some nifty stuff @@ -1065,10 +1065,10 @@ void hsDXTSoftwareCodec::IUncompressMipmapDXT5ToAInten( plMipmap *destBMap, p numBlocks = ( srcBMap->GetCurrWidth() * srcBMap->GetCurrHeight() ) >> 4; blockSize = srcBMap->fDirectXInfo.fBlockSize >> 1; // In 16-bit words - srcData = (UInt16 *)srcBMap->GetCurrLevelPtr(); + srcData = (uint16_t *)srcBMap->GetCurrLevelPtr(); // Note our trick here to make sure nothing breaks if GetAddr32's // formula changes - bMapStride = (UInt32)( destBMap->GetAddr16( 0, 1 ) - destBMap->GetAddr16( 0, 0 ) ); + bMapStride = (uint32_t)( destBMap->GetAddr16( 0, 1 ) - destBMap->GetAddr16( 0, 0 ) ); x = y = 0; @@ -1076,7 +1076,7 @@ void hsDXTSoftwareCodec::IUncompressMipmapDXT5ToAInten( plMipmap *destBMap, p for( i = 0; i < numBlocks; i++ ) { /// Per block--determine alpha compression type first - bytePtr = (UInt8 *)srcData; + bytePtr = (uint8_t *)srcData; alphas[ 0 ] = bytePtr[ 0 ]; alphas[ 1 ] = bytePtr[ 1 ]; @@ -1121,17 +1121,17 @@ void hsDXTSoftwareCodec::IUncompressMipmapDXT5ToAInten( plMipmap *destBMap, p } /// Now do the 16 pixels in 2 blocks, decompressing 3-bit lookups - aBitSrc1 = ( (UInt32)bytePtr[ 4 ] << 16 ) + - ( (UInt32)bytePtr[ 3 ] << 8 ) + - ( (UInt32)bytePtr[ 2 ] ); - aBitSrc2 = ( (UInt32)bytePtr[ 7 ] << 16 ) + - ( (UInt32)bytePtr[ 6 ] << 8 ) + - ( (UInt32)bytePtr[ 5 ] ); + aBitSrc1 = ( (uint32_t)bytePtr[ 4 ] << 16 ) + + ( (uint32_t)bytePtr[ 3 ] << 8 ) + + ( (uint32_t)bytePtr[ 2 ] ); + aBitSrc2 = ( (uint32_t)bytePtr[ 7 ] << 16 ) + + ( (uint32_t)bytePtr[ 6 ] << 8 ) + + ( (uint32_t)bytePtr[ 5 ] ); /// Now decompress color data srcData += 4; // Alpha was 4 16-bit words worth - colors[ 0 ] = (UInt8)IRGB16To32Bit( srcData[ 0 ] ); - colors[ 1 ] = (UInt8)IRGB16To32Bit( srcData[ 1 ] ); + colors[ 0 ] = (uint8_t)IRGB16To32Bit( srcData[ 0 ] ); + colors[ 1 ] = (uint8_t)IRGB16To32Bit( srcData[ 1 ] ); colors[ 2 ] = IMixTwoThirdsInten( colors[ 0 ], colors[ 1 ] ); colors[ 3 ] = IMixTwoThirdsInten( colors[ 1 ], colors[ 0 ] ); @@ -1140,10 +1140,10 @@ void hsDXTSoftwareCodec::IUncompressMipmapDXT5ToAInten( plMipmap *destBMap, p for( j = 0; j < 8; j++ ) { - destBlock[ j ] = alphas[ aBitSrc1 & 0x07 ] | (UInt16)colors[ cBitSrc1 & 0x03 ]; + destBlock[ j ] = alphas[ aBitSrc1 & 0x07 ] | (uint16_t)colors[ cBitSrc1 & 0x03 ]; aBitSrc1 >>= 3; cBitSrc1 >>= 2; - destBlock[ j + 8 ] = alphas[ aBitSrc2 & 0x07 ] | (UInt16)colors[ cBitSrc2 & 0x03 ]; + destBlock[ j + 8 ] = alphas[ aBitSrc2 & 0x07 ] | (uint16_t)colors[ cBitSrc2 & 0x03 ]; aBitSrc2 >>= 3; cBitSrc2 >>= 2; @@ -1194,12 +1194,12 @@ void hsDXTSoftwareCodec::IUncompressMipmapDXT5ToAInten( plMipmap *destBMap, p void hsDXTSoftwareCodec::IUncompressMipmapDXT1To16( plMipmap *destBMap, plMipmap *srcBMap ) { - UInt16 *srcData, tempW1, tempW2; - UInt16 *destData, destBlock[ 16 ]; - UInt32 blockSize; - UInt32 bitSource, bitSource2, x, y, bMapStride; - UInt16 colors[ 4 ]; - Int32 numBlocks, i, j; + uint16_t *srcData, tempW1, tempW2; + uint16_t *destData, destBlock[ 16 ]; + uint32_t blockSize; + uint32_t bitSource, bitSource2, x, y, bMapStride; + uint16_t colors[ 4 ]; + int32_t numBlocks, i, j; /// Setup some nifty stuff @@ -1208,10 +1208,10 @@ void hsDXTSoftwareCodec::IUncompressMipmapDXT1To16( plMipmap *destBMap, plMip numBlocks = ( srcBMap->GetCurrWidth() * srcBMap->GetCurrHeight() ) >> 4; blockSize = srcBMap->fDirectXInfo.fBlockSize >> 1; // In 16-bit words - srcData = (UInt16 *)srcBMap->GetCurrLevelPtr(); + srcData = (uint16_t *)srcBMap->GetCurrLevelPtr(); // Note our trick here to make sure nothing breaks if GetAddr32's // formula changes - bMapStride = (UInt32)( destBMap->GetAddr16( 0, 1 ) - destBMap->GetAddr16( 0, 0 ) ); + bMapStride = (uint32_t)( destBMap->GetAddr16( 0, 1 ) - destBMap->GetAddr16( 0, 0 ) ); x = y = 0; @@ -1296,12 +1296,12 @@ void hsDXTSoftwareCodec::IUncompressMipmapDXT1To16( plMipmap *destBMap, plMip void hsDXTSoftwareCodec::IUncompressMipmapDXT1To16Weird( plMipmap *destBMap, plMipmap *srcBMap ) { - UInt16 *srcData, tempW1, tempW2; - UInt16 *destData, destBlock[ 16 ]; - UInt32 blockSize; - UInt32 bitSource, bitSource2, x, y, bMapStride; - UInt16 colors[ 4 ]; - Int32 numBlocks, i, j; + uint16_t *srcData, tempW1, tempW2; + uint16_t *destData, destBlock[ 16 ]; + uint32_t blockSize; + uint32_t bitSource, bitSource2, x, y, bMapStride; + uint16_t colors[ 4 ]; + int32_t numBlocks, i, j; /// Setup some nifty stuff @@ -1310,10 +1310,10 @@ void hsDXTSoftwareCodec::IUncompressMipmapDXT1To16Weird( plMipmap *destBMap, numBlocks = ( srcBMap->GetCurrWidth() * srcBMap->GetCurrHeight() ) >> 4; blockSize = srcBMap->fDirectXInfo.fBlockSize >> 1; // In 16-bit words - srcData = (UInt16 *)srcBMap->GetCurrLevelPtr(); + srcData = (uint16_t *)srcBMap->GetCurrLevelPtr(); // Note our trick here to make sure nothing breaks if GetAddr32's // formula changes - bMapStride = (UInt32)( destBMap->GetAddr16( 0, 1 ) - destBMap->GetAddr16( 0, 0 ) ); + bMapStride = (uint32_t)( destBMap->GetAddr16( 0, 1 ) - destBMap->GetAddr16( 0, 0 ) ); x = y = 0; @@ -1398,12 +1398,12 @@ void hsDXTSoftwareCodec::IUncompressMipmapDXT1To16Weird( plMipmap *destBMap, void hsDXTSoftwareCodec::IUncompressMipmapDXT1To32( plMipmap *destBMap, plMipmap *srcBMap ) { - UInt16 *srcData, tempW1, tempW2; - UInt32 *destData, destBlock[ 16 ]; - UInt32 blockSize; - UInt32 bitSource, bitSource2, x, y, bMapStride; - UInt32 colors[ 4 ]; - Int32 numBlocks, i, j; + uint16_t *srcData, tempW1, tempW2; + uint32_t *destData, destBlock[ 16 ]; + uint32_t blockSize; + uint32_t bitSource, bitSource2, x, y, bMapStride; + uint32_t colors[ 4 ]; + int32_t numBlocks, i, j; /// Setup some nifty stuff @@ -1412,10 +1412,10 @@ void hsDXTSoftwareCodec::IUncompressMipmapDXT1To32( plMipmap *destBMap, numBlocks = ( srcBMap->GetCurrWidth() * srcBMap->GetCurrHeight() ) >> 4; blockSize = srcBMap->fDirectXInfo.fBlockSize >> 1; // In 16-bit words - srcData = (UInt16 *)srcBMap->GetCurrLevelPtr(); + srcData = (uint16_t *)srcBMap->GetCurrLevelPtr(); // Note our trick here to make sure nothing breaks if GetAddr32's // formula changes - bMapStride = (UInt32)( destBMap->GetAddr32( 0, 1 ) - destBMap->GetAddr32( 0, 0 ) ); + bMapStride = (uint32_t)( destBMap->GetAddr32( 0, 1 ) - destBMap->GetAddr32( 0, 0 ) ); x = y = 0; @@ -1499,12 +1499,12 @@ void hsDXTSoftwareCodec::IUncompressMipmapDXT1To32( plMipmap *destBMap, void hsDXTSoftwareCodec::IUncompressMipmapDXT1ToInten( plMipmap *destBMap, plMipmap *srcBMap ) { - UInt16 *srcData, tempW1, tempW2; - UInt8 *destData, destBlock[ 16 ]; - UInt32 blockSize; - UInt32 bitSource, bitSource2, x, y, bMapStride; - UInt8 colors[ 4 ]; - Int32 numBlocks, i, j; + uint16_t *srcData, tempW1, tempW2; + uint8_t *destData, destBlock[ 16 ]; + uint32_t blockSize; + uint32_t bitSource, bitSource2, x, y, bMapStride; + uint8_t colors[ 4 ]; + int32_t numBlocks, i, j; /// Setup some nifty stuff @@ -1513,18 +1513,18 @@ void hsDXTSoftwareCodec::IUncompressMipmapDXT1ToInten( plMipmap *destBMap, numBlocks = ( srcBMap->GetCurrWidth() * srcBMap->GetCurrHeight() ) >> 4; blockSize = srcBMap->fDirectXInfo.fBlockSize >> 1; // In 16-bit words - srcData = (UInt16 *)srcBMap->GetCurrLevelPtr(); + srcData = (uint16_t *)srcBMap->GetCurrLevelPtr(); // Note our trick here to make sure nothing breaks if GetAddr8's // formula changes - bMapStride = (UInt32)( destBMap->GetAddr8( 0, 1 ) - destBMap->GetAddr8( 0, 0 ) ); + bMapStride = (uint32_t)( destBMap->GetAddr8( 0, 1 ) - destBMap->GetAddr8( 0, 0 ) ); x = y = 0; /// Loop through the # of blocks (width*height / 16-pixel-blocks) for( i = 0; i < numBlocks; i++ ) { /// Decompress color data block (cast will automatically truncate to blue) - colors[ 0 ] = (UInt8)IRGB16To32Bit( srcData[ 0 ] ); - colors[ 1 ] = (UInt8)IRGB16To32Bit( srcData[ 1 ] ); + colors[ 0 ] = (uint8_t)IRGB16To32Bit( srcData[ 0 ] ); + colors[ 1 ] = (uint8_t)IRGB16To32Bit( srcData[ 1 ] ); tempW1 = hsToLE16( srcData[ 0 ] ); tempW2 = hsToLE16( srcData[ 1 ] ); @@ -1593,9 +1593,9 @@ void hsDXTSoftwareCodec::IUncompressMipmapDXT1ToInten( plMipmap *destBMap, // bits) is 0. Will be optimized LATER. // -UInt32 hsDXTSoftwareCodec::IRGB16To32Bit( UInt16 color ) +uint32_t hsDXTSoftwareCodec::IRGB16To32Bit( uint16_t color ) { - UInt32 r, g, b; + uint32_t r, g, b; color = hsToLE16(color); @@ -1616,9 +1616,9 @@ UInt32 hsDXTSoftwareCodec::IRGB16To32Bit( UInt16 color ) // bits) is 0. // -UInt16 hsDXTSoftwareCodec::IRGB565To4444( UInt16 color ) +uint16_t hsDXTSoftwareCodec::IRGB565To4444( uint16_t color ) { - UInt16 r, g, b; + uint16_t r, g, b; color = hsToLE16( color ); @@ -1641,9 +1641,9 @@ UInt16 hsDXTSoftwareCodec::IRGB565To4444( UInt16 color ) // bits) is 0. This is the OpenGL-friendly version (B and R are swapped) // -UInt16 hsDXTSoftwareCodec::IRGB565To4444Rev( UInt16 color ) +uint16_t hsDXTSoftwareCodec::IRGB565To4444Rev( uint16_t color ) { - UInt16 r, g, b; + uint16_t r, g, b; color = hsToLE16( color ); @@ -1666,9 +1666,9 @@ UInt16 hsDXTSoftwareCodec::IRGB565To4444Rev( UInt16 color ) // bit) is 0. // -UInt16 hsDXTSoftwareCodec::IRGB565To1555( UInt16 color ) +uint16_t hsDXTSoftwareCodec::IRGB565To1555( uint16_t color ) { - UInt16 r, g, b; + uint16_t r, g, b; color = hsToLE16( color ); @@ -1691,9 +1691,9 @@ UInt16 hsDXTSoftwareCodec::IRGB565To1555( UInt16 color ) // bit) is 0. // -UInt16 hsDXTSoftwareCodec::IRGB565To5551( UInt16 color ) +uint16_t hsDXTSoftwareCodec::IRGB565To5551( uint16_t color ) { - UInt16 rg, b; + uint16_t rg, b; color = hsToLE16( color ); @@ -1710,9 +1710,9 @@ UInt16 hsDXTSoftwareCodec::IRGB565To5551( UInt16 color ) // first parameter and 1/3rd of the second. Will be optimized LATER. // -UInt32 hsDXTSoftwareCodec::IMixTwoThirdsRGB32( UInt32 twoThirds, UInt32 oneThird ) +uint32_t hsDXTSoftwareCodec::IMixTwoThirdsRGB32( uint32_t twoThirds, uint32_t oneThird ) { - UInt32 r, g, b; + uint32_t r, g, b; r = ( ( twoThirds & 0x00ff0000 ) + ( twoThirds & 0x00ff0000 ) @@ -1736,9 +1736,9 @@ UInt32 hsDXTSoftwareCodec::IMixTwoThirdsRGB32( UInt32 twoThirds, UInt32 oneThir // first parameter and 1/3rd of the second. Alpha is ignored. // -UInt16 hsDXTSoftwareCodec::IMixTwoThirdsRGB1555( UInt16 twoThirds, UInt16 oneThird ) +uint16_t hsDXTSoftwareCodec::IMixTwoThirdsRGB1555( uint16_t twoThirds, uint16_t oneThird ) { - UInt16 r, g, b; + uint16_t r, g, b; r = ( ( twoThirds & 0x7c00 ) + ( twoThirds & 0x7c00 ) @@ -1762,9 +1762,9 @@ UInt16 hsDXTSoftwareCodec::IMixTwoThirdsRGB1555( UInt16 twoThirds, UInt16 oneTh // first parameter and 1/3rd of the second. Alpha is ignored. // -UInt16 hsDXTSoftwareCodec::IMixTwoThirdsRGB5551( UInt16 twoThirds, UInt16 oneThird ) +uint16_t hsDXTSoftwareCodec::IMixTwoThirdsRGB5551( uint16_t twoThirds, uint16_t oneThird ) { - UInt16 r, g, b; + uint16_t r, g, b; r = ( ( twoThirds & 0xf800 ) + ( twoThirds & 0xf800 ) @@ -1788,9 +1788,9 @@ UInt16 hsDXTSoftwareCodec::IMixTwoThirdsRGB5551( UInt16 twoThirds, UInt16 oneTh // first parameter and 1/3rd of the second. Alpha is ignored. // -UInt16 hsDXTSoftwareCodec::IMixTwoThirdsRGB4444( UInt16 twoThirds, UInt16 oneThird ) +uint16_t hsDXTSoftwareCodec::IMixTwoThirdsRGB4444( uint16_t twoThirds, uint16_t oneThird ) { - UInt16 r, g, b; + uint16_t r, g, b; r = ( ( twoThirds & 0x0f00 ) + ( twoThirds & 0x0f00 ) @@ -1814,7 +1814,7 @@ UInt16 hsDXTSoftwareCodec::IMixTwoThirdsRGB4444( UInt16 twoThirds, UInt16 oneTh // first parameter and 1/3rd of the second. // -UInt8 hsDXTSoftwareCodec::IMixTwoThirdsInten( UInt8 twoThirds, UInt8 oneThird ) +uint8_t hsDXTSoftwareCodec::IMixTwoThirdsInten( uint8_t twoThirds, uint8_t oneThird ) { return( ( twoThirds + twoThirds + oneThird ) / 3 ); } @@ -1825,9 +1825,9 @@ UInt8 hsDXTSoftwareCodec::IMixTwoThirdsInten( UInt8 twoThirds, UInt8 oneThird // the two colors given. // -UInt32 hsDXTSoftwareCodec::IMixEqualRGB32( UInt32 color1, UInt32 color2 ) +uint32_t hsDXTSoftwareCodec::IMixEqualRGB32( uint32_t color1, uint32_t color2 ) { - UInt32 r, g, b; + uint32_t r, g, b; r = ( ( color1 & 0x00ff0000 ) + ( color2 & 0x00ff0000 ) ) >> 1; @@ -1848,9 +1848,9 @@ UInt32 hsDXTSoftwareCodec::IMixEqualRGB32( UInt32 color1, UInt32 color2 ) // the two colors given. // -UInt16 hsDXTSoftwareCodec::IMixEqualRGB1555( UInt16 color1, UInt16 color2 ) +uint16_t hsDXTSoftwareCodec::IMixEqualRGB1555( uint16_t color1, uint16_t color2 ) { - UInt16 r, g, b; + uint16_t r, g, b; r = ( ( color1 & 0x7c00 ) + ( color2 & 0x7c00 ) ) >> 1; @@ -1871,9 +1871,9 @@ UInt16 hsDXTSoftwareCodec::IMixEqualRGB1555( UInt16 color1, UInt16 color2 ) // the two colors given. // -UInt16 hsDXTSoftwareCodec::IMixEqualRGB5551( UInt16 color1, UInt16 color2 ) +uint16_t hsDXTSoftwareCodec::IMixEqualRGB5551( uint16_t color1, uint16_t color2 ) { - UInt16 r, g, b; + uint16_t r, g, b; r = ( ( color1 & 0xf800 ) + ( color2 & 0xf800 ) ) >> 1; @@ -1894,9 +1894,9 @@ UInt16 hsDXTSoftwareCodec::IMixEqualRGB5551( UInt16 color1, UInt16 color2 ) // the two colors given. // -UInt16 hsDXTSoftwareCodec::IMixEqualRGB4444( UInt16 color1, UInt16 color2 ) +uint16_t hsDXTSoftwareCodec::IMixEqualRGB4444( uint16_t color1, uint16_t color2 ) { - UInt16 r, g, b; + uint16_t r, g, b; r = ( ( color1 & 0x0f00 ) + ( color2 & 0x0f00 ) ) >> 1; @@ -1917,7 +1917,7 @@ UInt16 hsDXTSoftwareCodec::IMixEqualRGB4444( UInt16 color1, UInt16 color2 ) // the two colors given. // -UInt8 hsDXTSoftwareCodec::IMixEqualInten( UInt8 color1, UInt8 color2 ) +uint8_t hsDXTSoftwareCodec::IMixEqualInten( uint8_t color1, uint8_t color2 ) { return( ( color1 + color2 ) >> 1 ); } @@ -1926,31 +1926,31 @@ UInt8 hsDXTSoftwareCodec::IMixEqualInten( UInt8 color1, UInt8 color2 ) void hsDXTSoftwareCodec::CompressMipmapLevel( plMipmap *uncompressed, plMipmap *compressed ) { - UInt32 *compressedImage = (UInt32 *)compressed->GetCurrLevelPtr(); - UInt32 *uncompressedImage = (UInt32 *)uncompressed->GetCurrLevelPtr(); - Int32 x, y; - Int32 xMax = uncompressed->GetCurrWidth() >> 2; - Int32 yMax = uncompressed->GetCurrHeight() >> 2; + uint32_t *compressedImage = (uint32_t *)compressed->GetCurrLevelPtr(); + uint32_t *uncompressedImage = (uint32_t *)uncompressed->GetCurrLevelPtr(); + int32_t x, y; + int32_t xMax = uncompressed->GetCurrWidth() >> 2; + int32_t yMax = uncompressed->GetCurrHeight() >> 2; for (x = 0; x < xMax; ++x) { for (y = 0; y < yMax; ++y) { - UInt8 maxAlpha = 0; - UInt8 minAlpha = 255; - UInt8 oldMaxAlpha = 0; - UInt8 oldMinAlpha = 255; - UInt8 alpha[8]; - Int32 maxDistance = 0; + uint8_t maxAlpha = 0; + uint8_t minAlpha = 255; + uint8_t oldMaxAlpha = 0; + uint8_t oldMinAlpha = 255; + uint8_t alpha[8]; + int32_t maxDistance = 0; hsRGBAColor32 color[4]; hsBool hasTransparency = false; - Int32 xx, yy; + int32_t xx, yy; for (xx = 0; xx < 4; ++xx) { for (yy = 0; yy < 4; ++yy) { hsRGBAColor32* pixel = (hsRGBAColor32*)uncompressed->GetAddr32(4 * x + xx, 4 * y + yy); - UInt8 pixelAlpha = pixel->a; + uint8_t pixelAlpha = pixel->a; if (pixelAlpha != 255) { hasTransparency = true; @@ -1979,7 +1979,7 @@ void hsDXTSoftwareCodec::CompressMipmapLevel( plMipmap *uncompressed, plMipmap * } } - Int32 xx2, yy2; + int32_t xx2, yy2; for (xx2 = 0; xx2 < 4; ++xx2) { for (yy2 = 0; yy2 < 4; ++yy2) @@ -1987,7 +1987,7 @@ void hsDXTSoftwareCodec::CompressMipmapLevel( plMipmap *uncompressed, plMipmap * hsRGBAColor32* pixel1 = (hsRGBAColor32*)uncompressed->GetAddr32(4 * x + xx, 4 * y + yy); hsRGBAColor32* pixel2 = (hsRGBAColor32*)uncompressed->GetAddr32(4 * x + xx2, 4 * y + yy2); - Int32 distance = ColorDistanceARGBSquared(*pixel1, *pixel2); + int32_t distance = ColorDistanceARGBSquared(*pixel1, *pixel2); if (distance >= maxDistance) { maxDistance = distance; @@ -2045,8 +2045,8 @@ void hsDXTSoftwareCodec::CompressMipmapLevel( plMipmap *uncompressed, plMipmap * } } - UInt32 encoding; - UInt16 shortColor[2]; + uint32_t encoding; + uint16_t shortColor[2]; shortColor[0] = Color32To16(color[0]); shortColor[1] = Color32To16(color[1]); if ((shortColor[0] == shortColor[1]) || @@ -2057,7 +2057,7 @@ void hsDXTSoftwareCodec::CompressMipmapLevel( plMipmap *uncompressed, plMipmap * if (shortColor[0] > shortColor[1]) { - UInt16 temp = shortColor[1]; + uint16_t temp = shortColor[1]; shortColor[1] = shortColor[0]; shortColor[0] = temp; @@ -2079,7 +2079,7 @@ void hsDXTSoftwareCodec::CompressMipmapLevel( plMipmap *uncompressed, plMipmap * if (shortColor[0] < shortColor[1]) { - UInt16 temp = shortColor[1]; + uint16_t temp = shortColor[1]; shortColor[1] = shortColor[0]; shortColor[0] = temp; @@ -2093,15 +2093,15 @@ void hsDXTSoftwareCodec::CompressMipmapLevel( plMipmap *uncompressed, plMipmap * } // Process each pixel in block - UInt32 blockSize = compressed->fDirectXInfo.fBlockSize; - UInt32 *block = &compressedImage[(x + xMax * y) * (blockSize >> 2)]; - UInt8 *byteBlock = (UInt8 *)block; - UInt8 *alphaBlock = nil; - UInt16 *colorBlock = nil; + uint32_t blockSize = compressed->fDirectXInfo.fBlockSize; + uint32_t *block = &compressedImage[(x + xMax * y) * (blockSize >> 2)]; + uint8_t *byteBlock = (uint8_t *)block; + uint8_t *alphaBlock = nil; + uint16_t *colorBlock = nil; if (compressed->fDirectXInfo.fCompressionType == plMipmap::DirectXInfo::kDXT5) { alphaBlock = byteBlock; - colorBlock = (UInt16 *)(byteBlock + 8); + colorBlock = (uint16_t *)(byteBlock + 8); alphaBlock[0] = 0; alphaBlock[1] = 0; alphaBlock[2] = 0; @@ -2114,7 +2114,7 @@ void hsDXTSoftwareCodec::CompressMipmapLevel( plMipmap *uncompressed, plMipmap * else if (compressed->fDirectXInfo.fCompressionType == plMipmap::DirectXInfo::kDXT1) { alphaBlock = nil; - colorBlock = (UInt16 *)(byteBlock); + colorBlock = (uint16_t *)(byteBlock); } else { @@ -2130,16 +2130,16 @@ void hsDXTSoftwareCodec::CompressMipmapLevel( plMipmap *uncompressed, plMipmap * for (yy = 0; yy < 4; ++yy) { hsRGBAColor32* pixel = (hsRGBAColor32*)uncompressed->GetAddr32(4 * x + xx, 4 * y + yy); - UInt8 pixelAlpha = pixel->a; + uint8_t pixelAlpha = pixel->a; if (alphaBlock) { - UInt32 alphaIndex = 0; - UInt32 alphaDistance = abs(pixelAlpha - alpha[0]); + uint32_t alphaIndex = 0; + uint32_t alphaDistance = abs(pixelAlpha - alpha[0]); - Int32 i; + int32_t i; for (i = 1; i < 8; i++) { - UInt32 distance = abs(pixelAlpha - alpha[i]); + uint32_t distance = abs(pixelAlpha - alpha[i]); if (distance < alphaDistance) { alphaIndex = i; @@ -2149,25 +2149,25 @@ void hsDXTSoftwareCodec::CompressMipmapLevel( plMipmap *uncompressed, plMipmap * if (yy < 2) { - UInt32 alphaShift = 3 * (4 * yy + xx); - UInt32 threeAlphaBytes = alphaIndex << alphaShift; + uint32_t alphaShift = 3 * (4 * yy + xx); + uint32_t threeAlphaBytes = alphaIndex << alphaShift; alphaBlock[2] |= (threeAlphaBytes & 0xff); alphaBlock[3] |= ((threeAlphaBytes >> 8) & 0xff); alphaBlock[4] |= ((threeAlphaBytes >> 16) & 0xff); } else { - UInt32 alphaShift = 3 * (4 * (yy - 2) + xx); - UInt32 threeAlphaBytes = alphaIndex << alphaShift; + uint32_t alphaShift = 3 * (4 * (yy - 2) + xx); + uint32_t threeAlphaBytes = alphaIndex << alphaShift; alphaBlock[5] |= (threeAlphaBytes & 0xff); alphaBlock[6] |= ((threeAlphaBytes >> 8) & 0xff); alphaBlock[7] |= ((threeAlphaBytes >> 16) & 0xff); } } - UInt32 colorShift = 2 * (4 * yy + xx); - UInt32 colorIndex = 0; - UInt32 colorDistance = ColorDistanceARGBSquared(*pixel, color[0]); + uint32_t colorShift = 2 * (4 * yy + xx); + uint32_t colorIndex = 0; + uint32_t colorDistance = ColorDistanceARGBSquared(*pixel, color[0]); if ((encoding == kThreeColorEncoding) && (pixelAlpha == 0)) @@ -2176,11 +2176,11 @@ void hsDXTSoftwareCodec::CompressMipmapLevel( plMipmap *uncompressed, plMipmap * } else { - Int32 i; - Int32 colorMax = (encoding == kThreeColorEncoding) ? 3 : 4; + int32_t i; + int32_t colorMax = (encoding == kThreeColorEncoding) ? 3 : 4; for (i = 1; i < colorMax; i++) { - UInt32 distance = ColorDistanceARGBSquared(*pixel, color[i]); + uint32_t distance = ColorDistanceARGBSquared(*pixel, color[i]); if (distance < colorDistance) { colorIndex = i; @@ -2191,14 +2191,14 @@ void hsDXTSoftwareCodec::CompressMipmapLevel( plMipmap *uncompressed, plMipmap * if (yy < 2) { - UInt32 colorShift = 2 * (4 * yy + xx); - UInt16 colorWord = (UInt16)(colorIndex << colorShift); + uint32_t colorShift = 2 * (4 * yy + xx); + uint16_t colorWord = (uint16_t)(colorIndex << colorShift); colorBlock[2] |= colorWord; } else { - UInt32 colorShift = 2 * (4 * (yy - 2) + xx); - UInt16 colorWord = (UInt16)(colorIndex << colorShift); + uint32_t colorShift = 2 * (4 * (yy - 2) + xx); + uint16_t colorWord = (uint16_t)(colorIndex << colorShift); colorBlock[3] |= colorWord; } } // for yy @@ -2216,10 +2216,10 @@ void hsDXTSoftwareCodec::CompressMipmapLevel( plMipmap *uncompressed, plMipmap * } // for x } -UInt16 hsDXTSoftwareCodec::BlendColors16(UInt16 weight1, UInt16 color1, UInt16 weight2, UInt16 color2) +uint16_t hsDXTSoftwareCodec::BlendColors16(uint16_t weight1, uint16_t color1, uint16_t weight2, uint16_t color2) { - UInt16 r1, r2, g1, g2, b1, b2; - UInt16 r, g, b; + uint16_t r1, r2, g1, g2, b1, b2; + uint16_t r, g, b; r1 = (color1 >> 8) & 0xf8; g1 = (color1 >> 3) & 0xfc; @@ -2229,31 +2229,31 @@ UInt16 hsDXTSoftwareCodec::BlendColors16(UInt16 weight1, UInt16 color1, UInt16 w g2 = (color2 >> 3) & 0xfc; b2 = (color2 << 3) & 0xf8; - r = ((UInt16)r1 * weight1 + (UInt16)r2 * weight2)/(weight1 + weight2); - g = ((UInt16)g1 * weight1 + (UInt16)g2 * weight2)/(weight1 + weight2); - b = ((UInt16)b1 * weight1 + (UInt16)b2 * weight2)/(weight1 + weight2); + r = ((uint16_t)r1 * weight1 + (uint16_t)r2 * weight2)/(weight1 + weight2); + g = ((uint16_t)g1 * weight1 + (uint16_t)g2 * weight2)/(weight1 + weight2); + b = ((uint16_t)b1 * weight1 + (uint16_t)b2 * weight2)/(weight1 + weight2); return ((r & 0xf8) << 8) | ((g & 0xfc) << 3) | ((b & 0xf8) >> 3); } -hsRGBAColor32 hsDXTSoftwareCodec::BlendColors32(UInt32 weight1, hsRGBAColor32 color1, - UInt32 weight2, hsRGBAColor32 color2) +hsRGBAColor32 hsDXTSoftwareCodec::BlendColors32(uint32_t weight1, hsRGBAColor32 color1, + uint32_t weight2, hsRGBAColor32 color2) { hsRGBAColor32 result; - result.r = static_cast((color1.r * weight1 + color2.r * weight2)/(weight1 + weight2)); - result.g = static_cast((color1.g * weight1 + color2.g * weight2)/(weight1 + weight2)); - result.b = static_cast((color1.b * weight1 + color2.b * weight2)/(weight1 + weight2)); + result.r = static_cast((color1.r * weight1 + color2.r * weight2)/(weight1 + weight2)); + result.g = static_cast((color1.g * weight1 + color2.g * weight2)/(weight1 + weight2)); + result.b = static_cast((color1.b * weight1 + color2.b * weight2)/(weight1 + weight2)); return result; } -Int32 hsDXTSoftwareCodec::ColorDistanceARGBSquared(hsRGBAColor32 color1, hsRGBAColor32 color2) +int32_t hsDXTSoftwareCodec::ColorDistanceARGBSquared(hsRGBAColor32 color1, hsRGBAColor32 color2) { - Int32 r1, g1, b1; - Int32 r2, g2, b2; + int32_t r1, g1, b1; + int32_t r2, g2, b2; r1 = color1.r; r2 = color2.r; @@ -2265,11 +2265,11 @@ Int32 hsDXTSoftwareCodec::ColorDistanceARGBSquared(hsRGBAColor32 color1, hsRGBAC return (r1 - r2) * (r1 - r2) + (g1 - g2) * (g1 - g2) + (b1 - b2) * (b1 - b2); } -UInt16 hsDXTSoftwareCodec::Color32To16(hsRGBAColor32 color) +uint16_t hsDXTSoftwareCodec::Color32To16(hsRGBAColor32 color) { - UInt8 r = (UInt8)(color.r & 0xf8); - UInt8 g = (UInt8)(color.g & 0xfc); - UInt8 b = (UInt8)(color.b & 0xf8); + uint8_t r = (uint8_t)(color.r & 0xf8); + uint8_t g = (uint8_t)(color.g & 0xfc); + uint8_t b = (uint8_t)(color.b & 0xf8); return (r << 8) | (g << 3) | (b >> 3); } @@ -2282,7 +2282,7 @@ hsBool hsDXTSoftwareCodec::Register() //// ICalcCompressedFormat //////////////////////////////////////////////////// // Determine the DXT compression format based on a bitmap. -UInt8 hsDXTSoftwareCodec::ICalcCompressedFormat( plMipmap *bMap ) +uint8_t hsDXTSoftwareCodec::ICalcCompressedFormat( plMipmap *bMap ) { if( bMap->GetFlags() & plMipmap::kAlphaChannelFlag ) return plMipmap::DirectXInfo::kDXT5; @@ -2294,11 +2294,11 @@ UInt8 hsDXTSoftwareCodec::ICalcCompressedFormat( plMipmap *bMap ) //// ColorizeCompBitmap /////////////////////////////////////////////////////// // Colorizes a compressed bitmap according to the color mask given. -hsBool hsDXTSoftwareCodec::ColorizeCompMipmap( plMipmap *bMap, const UInt8 *colorMask ) +hsBool hsDXTSoftwareCodec::ColorizeCompMipmap( plMipmap *bMap, const uint8_t *colorMask ) { - UInt32 numBlocks, blockSize; - UInt16 *srcData, color1, color2, gray, grayDiv2, i; - UInt8 compMasks[ 3 ][ 2 ] = { { 0, 0 }, { 0, 0xff }, { 0xff, 0 } }; + uint32_t numBlocks, blockSize; + uint16_t *srcData, color1, color2, gray, grayDiv2, i; + uint8_t compMasks[ 3 ][ 2 ] = { { 0, 0 }, { 0, 0xff }, { 0xff, 0 } }; /// Sanity checks @@ -2311,7 +2311,7 @@ hsBool hsDXTSoftwareCodec::ColorizeCompMipmap( plMipmap *bMap, const UInt8 *colo numBlocks = ( bMap->GetCurrWidth() * bMap->GetCurrHeight() ) >> 4; blockSize = bMap->fDirectXInfo.fBlockSize >> 1; // In 16-bit words - srcData = (UInt16 *)bMap->GetCurrLevelPtr(); + srcData = (uint16_t *)bMap->GetCurrLevelPtr(); // If we're DXT5, we'll artificially advance srcData so it points to the start // of the first *color* block, not the first compressed block @@ -2375,7 +2375,7 @@ hsBool hsDXTSoftwareCodec::ColorizeCompMipmap( plMipmap *bMap, const UInt8 *colo srcData[ 2 ] ^= ( ( ~( srcData[ i ] >> 1 ) ) & 0x5555 ); srcData[ 3 ] ^= ( ( ~( srcData[ i ] >> 1 ) ) & 0x5555 ); - /// Spoiler for above: we shift the word right one bit, then + /// Spoiler for above: we shift the uint16_t right one bit, then /// not the bits, then mask off the lower bits of the pairs /// (which of course used to be the upper bits). Now any upper /// bits that were 0 are now lower bits of 1, and everything diff --git a/Sources/Plasma/PubUtilLib/plGImage/hsDXTSoftwareCodec.h b/Sources/Plasma/PubUtilLib/plGImage/hsDXTSoftwareCodec.h index caf4409f..fc569935 100644 --- a/Sources/Plasma/PubUtilLib/plGImage/hsDXTSoftwareCodec.h +++ b/Sources/Plasma/PubUtilLib/plGImage/hsDXTSoftwareCodec.h @@ -60,10 +60,10 @@ public: plMipmap *CreateCompressedMipmap(plMipmap *uncompressed); // Uncompresses the given source into a new destination mipmap - plMipmap *CreateUncompressedMipmap( plMipmap *compressed, UInt8 flags = 0 ); + plMipmap *CreateUncompressedMipmap( plMipmap *compressed, uint8_t flags = 0 ); // Colorize a compressed mipmap - hsBool ColorizeCompMipmap( plMipmap *bMap, const UInt8 *colorMask ); + hsBool ColorizeCompMipmap( plMipmap *bMap, const uint8_t *colorMask ); private: enum { @@ -73,23 +73,23 @@ private: void CompressMipmapLevel( plMipmap *uncompressed, plMipmap *compressed ); - UInt16 BlendColors16(UInt16 weight1, UInt16 color1, UInt16 weight2, UInt16 color2); - hsRGBAColor32 BlendColors32(UInt32 weight1, hsRGBAColor32 color1, UInt32 weight2, hsRGBAColor32 color2); - Int32 ColorDistanceARGBSquared(hsRGBAColor32 color1, hsRGBAColor32 color2); - UInt16 Color32To16(hsRGBAColor32 color); + uint16_t BlendColors16(uint16_t weight1, uint16_t color1, uint16_t weight2, uint16_t color2); + hsRGBAColor32 BlendColors32(uint32_t weight1, hsRGBAColor32 color1, uint32_t weight2, hsRGBAColor32 color2); + int32_t ColorDistanceARGBSquared(hsRGBAColor32 color1, hsRGBAColor32 color2); + uint16_t Color32To16(hsRGBAColor32 color); // Calculates the DXT format based on a mipmap - UInt8 ICalcCompressedFormat( plMipmap *bMap ); + uint8_t ICalcCompressedFormat( plMipmap *bMap ); // Copy over a block from a mipmap level to a destination mipmap, converting if necessary - void IXlateColorBlock( plMipmap *destBMap, UInt32 *srcBlock, UInt8 flags = 0 ); + void IXlateColorBlock( plMipmap *destBMap, uint32_t *srcBlock, uint8_t flags = 0 ); // Creates an uncompressed mipmap with the settings to match - plMipmap *ICreateUncompressedMipmap( plMipmap *compressed, UInt8 flags ); + plMipmap *ICreateUncompressedMipmap( plMipmap *compressed, uint8_t flags ); // Dispatcher for all the decompression functions void inline UncompressMipmap( plMipmap *uncompressed, plMipmap *compressed, - UInt8 flags = 0 ); + uint8_t flags = 0 ); // Decompresses a DXT5 compressed mipmap into a RGB4444 mipmap void IUncompressMipmapDXT5To16( plMipmap *destBMap, plMipmap *srcBMap ); @@ -111,40 +111,40 @@ private: void IUncompressMipmapDXT5ToAInten( plMipmap *destBMap, plMipmap *srcBMap ); // Mixes two RGB8888 colors equally - UInt32 inline IMixEqualRGB32( UInt32 color1, UInt32 color2 ); + uint32_t inline IMixEqualRGB32( uint32_t color1, uint32_t color2 ); // Mixes two-thirds of the first RGB8888 color and one-third of the second - UInt32 inline IMixTwoThirdsRGB32( UInt32 twoThirds, UInt32 oneThird ); + uint32_t inline IMixTwoThirdsRGB32( uint32_t twoThirds, uint32_t oneThird ); // Mixes two RGB1555 colors equally - UInt16 inline IMixEqualRGB1555( UInt16 color1, UInt16 color2 ); + uint16_t inline IMixEqualRGB1555( uint16_t color1, uint16_t color2 ); // Mixes two-thirds of the first RGB1555 color and one-third of the second - UInt16 inline IMixTwoThirdsRGB1555( UInt16 twoThirds, UInt16 oneThird ); + uint16_t inline IMixTwoThirdsRGB1555( uint16_t twoThirds, uint16_t oneThird ); // Mixes two RGB5551 colors equally - UInt16 inline IMixEqualRGB5551( UInt16 color1, UInt16 color2 ); + uint16_t inline IMixEqualRGB5551( uint16_t color1, uint16_t color2 ); // Mixes two-thirds of the first RGB5551 color and one-third of the second - UInt16 inline IMixTwoThirdsRGB5551( UInt16 twoThirds, UInt16 oneThird ); + uint16_t inline IMixTwoThirdsRGB5551( uint16_t twoThirds, uint16_t oneThird ); // Mixes two RGB4444 colors equally - UInt16 inline IMixEqualRGB4444( UInt16 color1, UInt16 color2 ); + uint16_t inline IMixEqualRGB4444( uint16_t color1, uint16_t color2 ); // Mixes two-thirds of the first RGB4444 color and one-third of the second - UInt16 inline IMixTwoThirdsRGB4444( UInt16 twoThirds, UInt16 oneThird ); + uint16_t inline IMixTwoThirdsRGB4444( uint16_t twoThirds, uint16_t oneThird ); // Mixes two intensity values equally - UInt8 inline IMixEqualInten( UInt8 color1, UInt8 color2 ); + uint8_t inline IMixEqualInten( uint8_t color1, uint8_t color2 ); // Mixes two-thirds of the first intensity and one-third of the second - UInt8 inline IMixTwoThirdsInten( UInt8 twoThirds, UInt8 oneThird ); + uint8_t inline IMixTwoThirdsInten( uint8_t twoThirds, uint8_t oneThird ); // Converts a color from RGB565 to RGB8888 format, with alpha=0 - UInt32 inline IRGB16To32Bit( UInt16 color ); + uint32_t inline IRGB16To32Bit( uint16_t color ); // Converts a color from RGB565 to RGB4444 format, with alpha=0 - UInt16 inline IRGB565To4444( UInt16 color ); + uint16_t inline IRGB565To4444( uint16_t color ); // Converts a color from RGB565 to RGB1555 format, with alpha=0 - UInt16 inline IRGB565To1555( UInt16 color ); + uint16_t inline IRGB565To1555( uint16_t color ); // Converts a color from RGB565 to RGB5551 format, with alpha=0 - UInt16 inline IRGB565To5551( UInt16 color ); + uint16_t inline IRGB565To5551( uint16_t color ); // Converts a color from RGB565 to RGB4444 reversed format, with alpha=0 - UInt16 inline IRGB565To4444Rev( UInt16 color ); + uint16_t inline IRGB565To4444Rev( uint16_t color ); static hsBool Register(); static hsBool fRegistered; diff --git a/Sources/Plasma/PubUtilLib/plGImage/hsRect.h b/Sources/Plasma/PubUtilLib/plGImage/hsRect.h deleted file mode 100644 index 73eb970e..00000000 --- a/Sources/Plasma/PubUtilLib/plGImage/hsRect.h +++ /dev/null @@ -1,147 +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 . - -Additional permissions under GNU GPL version 3 section 7 - -If you modify this Program, or any covered work, by linking or -combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK, -NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent -JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK -(or a modified version of those libraries), -containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA, -PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG -JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the -licensors of this Program grant you additional -permission to convey the resulting work. Corresponding Source for a -non-source form of such a combination shall include the source code for -the parts of OpenSSL and IJG JPEG Library used as well as that of the covered -work. - -You can contact Cyan Worlds, Inc. by email legal@cyan.com - or by snail mail at: - Cyan Worlds, Inc. - 14617 N Newport Hwy - Mead, WA 99021 - -*==LICENSE==*/ -#ifndef hsRect_Defined -#define hsRect_Defined - -#include "hsPoint2.h" - -#define HS_RECT_NAME hsIntRect -#define HS_RECT_POINT hsIntPoint2 -#define HS_RECT_TYPE Int32 -#define HS_RECT_EXTEND 1 -#include "HS_RECT.inc" - -#ifdef _WINDOWS_ - RECT* ToRECT(RECT* r) const - { - r->left = this->fLeft; - r->top = this->fTop; - r->right = this->fRight; - r->bottom = this->fBottom; - return r; - } - hsIntRect* Set(const RECT* r) - { - return this->Set(r->left, r->top, r->right, r->bottom); - } -#endif -}; - -#define HS_RECT_NAME hsFixedRect -#define HS_RECT_POINT hsFixedPoint2 -#define HS_RECT_TYPE hsFixed -#define HS_RECT_EXTEND 1 -#include "HS_RECT.inc" - - hsFixedRect* Set(const hsIntRect* src) - { - this->fLeft = hsIntToFixed(src->fLeft); - this->fTop = hsIntToFixed(src->fTop); - this->fRight = hsIntToFixed(src->fRight); - this->fBottom = hsIntToFixed(src->fBottom); - return this; - } - - hsFixed CenterX(void) const { return (fLeft + fRight) >> 1; } - hsFixed CenterY(void) const { return (fTop + fBottom) >> 1; } - hsFixedPoint2* Center(hsFixedPoint2* center) const - { - (void)center->Set(this->CenterX(), this->CenterY()); - return center; - } - hsIntRect* Truncate(hsIntRect* dst) const - { - return (hsIntRect*)dst->Set( hsFixedToInt(fLeft), hsFixedToInt(fTop), - hsFixedToInt(fRight), hsFixedToInt(fBottom)); - } - hsIntRect* Round(hsIntRect* dst) const - { - return (hsIntRect*)dst->Set( hsFixedRound(fLeft), hsFixedRound(fTop), - hsFixedRound(fRight), hsFixedRound(fBottom)); - } - hsIntRect* RoundOut(hsIntRect* dst) const - { - return (hsIntRect*)dst->Set( hsFixedToFloorInt(fLeft), - hsFixedToFloorInt(fTop), - hsFixedToCeilingInt(fRight), - hsFixedToCeilingInt(fBottom)); - } -}; - -#if HS_SCALAR_IS_FLOAT - #define HS_RECT_NAME hsFloatRect - #define HS_RECT_POINT hsFloatPoint2 - #define HS_RECT_TYPE float - #define HS_RECT_EXTEND 1 - #include "HS_RECT.inc" - - hsFloatRect* Set(const hsIntRect* src) - { - this->fLeft = float(src->fLeft); - this->fTop = float(src->fTop); - this->fRight = float(src->fRight); - this->fBottom = float(src->fBottom); - return this; - } - - float CenterX(void) const { return (fLeft + fRight) / float(2); } - float CenterY(void) const { return (fTop + fBottom) / float(2); } - hsFloatPoint2* Center(hsFloatPoint2* center) const - { - (void)center->Set(this->CenterX(), this->CenterY()); - return center; - } - float Area() const { return this->Width() * this->Height(); } - - hsIntRect* Round(hsIntRect* r) const; - hsIntRect* RoundOut(hsIntRect* r) const; - hsIntRect* Truncate(hsIntRect* r) const; - }; -#endif - -#if HS_SCALAR_IS_FIXED - typedef hsFixedRect hsRect; -#else - typedef hsFloatRect hsRect; -#endif - -#endif diff --git a/Sources/Plasma/PubUtilLib/plGImage/plAVIWriter.cpp b/Sources/Plasma/PubUtilLib/plGImage/plAVIWriter.cpp index 299535b3..6675a88f 100644 --- a/Sources/Plasma/PubUtilLib/plGImage/plAVIWriter.cpp +++ b/Sources/Plasma/PubUtilLib/plGImage/plAVIWriter.cpp @@ -42,9 +42,9 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "plAVIWriter.h" -#include "hsTypes.h" +#include "HeadSpin.h" + -#include "hsWindows.h" #if HS_BUILD_FOR_WIN32 #include #endif @@ -68,7 +68,7 @@ protected: BITMAPINFOHEADER fBitmapInfo; hsBool fOldRealTime; - hsScalar fOldFrameTimeInc; + float fOldFrameTimeInc; double fStartTime; diff --git a/Sources/Plasma/PubUtilLib/plGImage/plBitmap.cpp b/Sources/Plasma/PubUtilLib/plGImage/plBitmap.cpp index 29d54cff..a50d611c 100644 --- a/Sources/Plasma/PubUtilLib/plGImage/plBitmap.cpp +++ b/Sources/Plasma/PubUtilLib/plGImage/plBitmap.cpp @@ -52,7 +52,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // // /////////////////////////////////////////////////////////////////////////////// -#include "hsTypes.h" +#include "HeadSpin.h" #include "plBitmap.h" #include "hsResMgr.h" @@ -63,7 +63,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com //// Static Members /////////////////////////////////////////////////////////// -UInt8 plBitmap::fGlobalNumLevelsToChop = 0; +uint8_t plBitmap::fGlobalNumLevelsToChop = 0; //// Constructor & Destructor ///////////////////////////////////////////////// @@ -85,12 +85,12 @@ plBitmap::~plBitmap() hsRefCnt_SafeUnRef( fDeviceRef ); } -bool plBitmap::IsSameModifiedTime(UInt32 lowTime, UInt32 highTime) +bool plBitmap::IsSameModifiedTime(uint32_t lowTime, uint32_t highTime) { return (fLowModifiedTime == lowTime && fHighModifiedTime == highTime); } -void plBitmap::SetModifiedTime(UInt32 lowTime, UInt32 highTime) +void plBitmap::SetModifiedTime(uint32_t lowTime, uint32_t highTime) { fLowModifiedTime = lowTime; fHighModifiedTime = highTime; @@ -98,12 +98,12 @@ void plBitmap::SetModifiedTime(UInt32 lowTime, UInt32 highTime) //// Read ///////////////////////////////////////////////////////////////////// -static UInt8 sBitmapVersion = 2; +static uint8_t sBitmapVersion = 2; -UInt32 plBitmap::Read( hsStream *s ) +uint32_t plBitmap::Read( hsStream *s ) { - UInt8 version = s->ReadByte(); - UInt32 read = 6; + uint8_t version = s->ReadByte(); + uint32_t read = 6; hsAssert( version == sBitmapVersion, "Invalid bitamp version on Read()" ); @@ -133,9 +133,9 @@ UInt32 plBitmap::Read( hsStream *s ) //// Write //////////////////////////////////////////////////////////////////// -UInt32 plBitmap::Write( hsStream *s ) +uint32_t plBitmap::Write( hsStream *s ) { - UInt32 written = 6; + uint32_t written = 6; s->WriteByte( sBitmapVersion ); diff --git a/Sources/Plasma/PubUtilLib/plGImage/plBitmap.h b/Sources/Plasma/PubUtilLib/plGImage/plBitmap.h index 732a66a2..1715df00 100644 --- a/Sources/Plasma/PubUtilLib/plGImage/plBitmap.h +++ b/Sources/Plasma/PubUtilLib/plGImage/plBitmap.h @@ -119,8 +119,8 @@ class plBitmap : public hsKeyedObject kDXT5 = 0x5 }; - UInt8 fCompressionType; - UInt8 fBlockSize; // In bytes + uint8_t fCompressionType; + uint8_t fBlockSize; // In bytes }; struct UncompressedInfo @@ -134,12 +134,12 @@ class plBitmap : public hsKeyedObject kAInten88 = 0x04 /// 8-bit intensity channel w/ 8-bit alpha }; - UInt8 fType; + uint8_t fType; }; //// Public Data ///// - UInt8 fCompressionType; + uint8_t fCompressionType; union { DirectXInfo fDirectXInfo; @@ -156,16 +156,16 @@ class plBitmap : public hsKeyedObject GETINTERFACE_ANY( plBitmap, hsKeyedObject ); // Get the total size in bytes - virtual UInt32 GetTotalSize( void ) const = 0; + virtual uint32_t GetTotalSize( void ) const = 0; // Read and write virtual void Read( hsStream *s, hsResMgr *mgr ) { hsKeyedObject::Read( s, mgr ); this->Read( s ); } virtual void Write( hsStream *s, hsResMgr *mgr ) { hsKeyedObject::Write( s, mgr ); this->Write( s ); } - UInt16 GetFlags( void ) const { return fFlags; } - void SetFlags( UInt16 flags ) { fFlags = flags; } + uint16_t GetFlags( void ) const { return fFlags; } + void SetFlags( uint16_t flags ) { fFlags = flags; } - UInt8 GetPixelSize( void ) const { return fPixelSize; } + uint8_t GetPixelSize( void ) const { return fPixelSize; } hsBool IsCompressed( void ) const { return ( fCompressionType == kDirectXCompression ); } @@ -173,32 +173,32 @@ class plBitmap : public hsKeyedObject virtual hsGDeviceRef *GetDeviceRef( void ) const { return fDeviceRef; } virtual void SetDeviceRef( hsGDeviceRef *const devRef ); - static void SetGlobalLevelChopCount( UInt8 count ) { fGlobalNumLevelsToChop = count; } - static UInt8 GetGlobalLevelChopCount() { return fGlobalNumLevelsToChop; } + static void SetGlobalLevelChopCount( uint8_t count ) { fGlobalNumLevelsToChop = count; } + static uint8_t GetGlobalLevelChopCount() { return fGlobalNumLevelsToChop; } // Compares and sets the modified time for the source texture - bool IsSameModifiedTime(UInt32 lowTime, UInt32 highTime); - void SetModifiedTime(UInt32 lowTime, UInt32 highTime); + bool IsSameModifiedTime(uint32_t lowTime, uint32_t highTime); + void SetModifiedTime(uint32_t lowTime, uint32_t highTime); protected: //// Protected Members //// - UInt8 fPixelSize; // 1, 2, 4, 8, 16, (24), 32, 64 - UInt8 fSpace; // no, direct, gray, index - UInt16 fFlags; // alphachannel | alphabit + uint8_t fPixelSize; // 1, 2, 4, 8, 16, (24), 32, 64 + uint8_t fSpace; // no, direct, gray, index + uint16_t fFlags; // alphachannel | alphabit mutable hsGDeviceRef *fDeviceRef; - static UInt8 fGlobalNumLevelsToChop; + static uint8_t fGlobalNumLevelsToChop; // The modification time of the source texture. // Used to determine if we can reuse an already converted copy. - UInt32 fLowModifiedTime; - UInt32 fHighModifiedTime; + uint32_t fLowModifiedTime; + uint32_t fHighModifiedTime; - virtual UInt32 Read( hsStream *s ); - virtual UInt32 Write( hsStream *s ); + virtual uint32_t Read( hsStream *s ); + virtual uint32_t Write( hsStream *s ); }; #endif // _plBitmap_h diff --git a/Sources/Plasma/PubUtilLib/plGImage/plBumpMapGen.cpp b/Sources/Plasma/PubUtilLib/plGImage/plBumpMapGen.cpp index 38e28002..43d416c6 100644 --- a/Sources/Plasma/PubUtilLib/plGImage/plBumpMapGen.cpp +++ b/Sources/Plasma/PubUtilLib/plGImage/plBumpMapGen.cpp @@ -40,7 +40,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "plBumpMapGen.h" @@ -52,12 +52,12 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com plMipmap* plBumpMapGen::MakeCompatibleBlank(const plMipmap* src) { - return TRACKED_NEW plMipmap(src->GetWidth(), src->GetHeight(), plMipmap::kARGB32Config, 1, plMipmap::kUncompressed, plMipmap::UncompressedInfo::kRGB8888); + return new plMipmap(src->GetWidth(), src->GetHeight(), plMipmap::kARGB32Config, 1, plMipmap::kUncompressed, plMipmap::UncompressedInfo::kRGB8888); } plMipmap* plBumpMapGen::TwosCompToBias(plMipmap* dst) { - UInt8* pDst = (UInt8*)dst->GetAddr32(0, 0); + uint8_t* pDst = (uint8_t*)dst->GetAddr32(0, 0); const int width = dst->GetWidth(); const int height = dst->GetHeight(); @@ -77,7 +77,7 @@ plMipmap* plBumpMapGen::TwosCompToBias(plMipmap* dst) return dst; } -plMipmap* plBumpMapGen::QikBumpMap(plMipmap* dst, const plMipmap* origSrc, UInt32 mask, UInt32 flags) +plMipmap* plBumpMapGen::QikBumpMap(plMipmap* dst, const plMipmap* origSrc, uint32_t mask, uint32_t flags) { const plMipmap* src = origSrc; if( !dst ) @@ -91,7 +91,7 @@ plMipmap* plBumpMapGen::QikBumpMap(plMipmap* dst, const plMipmap* origSrc, UInt3 // as expensive a point sample as possible without using transcendental functions). // This might be correctable by calling plMipmap::Filter after the upscale. Or I // could just assert that dst dimensions match src dimensions. - newSrc->ResizeNicely((UInt16)(dst->GetWidth()), (UInt16)(dst->GetHeight()), plMipmap::kDefaultFilter); + newSrc->ResizeNicely((uint16_t)(dst->GetWidth()), (uint16_t)(dst->GetHeight()), plMipmap::kDefaultFilter); src = newSrc; } @@ -102,7 +102,7 @@ plMipmap* plBumpMapGen::QikBumpMap(plMipmap* dst, const plMipmap* origSrc, UInt3 } dst->SetCurrLevel(0); - const Int32 divis = ((mask >> 0) & 0xff) + const int32_t divis = ((mask >> 0) & 0xff) +((mask >> 8) & 0xff) +((mask >> 16) & 0xff); @@ -110,37 +110,37 @@ plMipmap* plBumpMapGen::QikBumpMap(plMipmap* dst, const plMipmap* origSrc, UInt3 const int height = src->GetHeight(); const int stride = src->GetRowBytes(); // Should be width * 4; - const UInt32 alphaOr = flags & kScaleHgtByAlpha ? 0 : 0xff; + const uint32_t alphaOr = flags & kScaleHgtByAlpha ? 0 : 0xff; - UInt32* pDst = dst->GetAddr32(0, 0); - UInt32* pBase = src->GetAddr32(0, 0); - UInt32* pSrc = pBase; + uint32_t* pDst = dst->GetAddr32(0, 0); + uint32_t* pBase = src->GetAddr32(0, 0); + uint32_t* pSrc = pBase; int i; int j; for( j = 0; j < height; j++ ) { - UInt32* pUp = j ? pSrc - width : pBase; - UInt32* pDn = j < height-1 ? pSrc + width : pBase; + uint32_t* pUp = j ? pSrc - width : pBase; + uint32_t* pDn = j < height-1 ? pSrc + width : pBase; for( i = 0; i < width; i++ ) { - UInt32* pLf = i ? pSrc - 1 : pSrc + width-1; - UInt32* pRt = i < width-1 ? pSrc + 1 : pSrc - width + 1; + uint32_t* pLf = i ? pSrc - 1 : pSrc + width-1; + uint32_t* pRt = i < width-1 ? pSrc + 1 : pSrc - width + 1; - UInt32 up = (((*pUp & mask) >> 0) & 0xff) + uint32_t up = (((*pUp & mask) >> 0) & 0xff) + (((*pUp & mask) >> 8) & 0xff) + (((*pUp & mask) >> 16) & 0xff); - UInt32 dn = (((*pDn & mask) >> 0) & 0xff) + uint32_t dn = (((*pDn & mask) >> 0) & 0xff) + (((*pDn & mask) >> 8) & 0xff) + (((*pDn & mask) >> 16) & 0xff); - UInt32 rt = (((*pRt & mask) >> 0) & 0xff) + uint32_t rt = (((*pRt & mask) >> 0) & 0xff) + (((*pRt & mask) >> 8) & 0xff) + (((*pRt & mask) >> 16) & 0xff); - UInt32 lf = (((*pLf & mask) >> 0) & 0xff) + uint32_t lf = (((*pLf & mask) >> 0) & 0xff) + (((*pLf & mask) >> 8) & 0xff) + (((*pLf & mask) >> 16) & 0xff); - UInt32 hgt = (((*pSrc & mask) >> 0) & 0xff) + uint32_t hgt = (((*pSrc & mask) >> 0) & 0xff) + (((*pSrc & mask) >> 8) & 0xff) + (((*pSrc & mask) >> 16) & 0xff); @@ -156,11 +156,11 @@ plMipmap* plBumpMapGen::QikBumpMap(plMipmap* dst, const plMipmap* origSrc, UInt3 // are on, so divis = 0xff+0xff+0xff = 3*255. // So we muliply by 255 and divide by divis, so in this example, // that means divide by 3. - Int32 delUpDn = dn - up; + int32_t delUpDn = dn - up; delUpDn *= 255; delUpDn /= divis; - Int32 delRtLf = lf - rt; + int32_t delRtLf = lf - rt; delRtLf *= 255; delRtLf /= divis; @@ -196,7 +196,7 @@ plMipmap* plBumpMapGen::QikBumpMap(plMipmap* dst, const plMipmap* origSrc, UInt3 return dst; } -plMipmap* plBumpMapGen::QikNormalMap(plMipmap* dst, const plMipmap* src, UInt32 mask, UInt32 flags, hsScalar smooth) +plMipmap* plBumpMapGen::QikNormalMap(plMipmap* dst, const plMipmap* src, uint32_t mask, uint32_t flags, float smooth) { dst = QikBumpMap(dst, src, mask, flags & ~kBias); @@ -205,9 +205,9 @@ plMipmap* plBumpMapGen::QikNormalMap(plMipmap* dst, const plMipmap* src, UInt32 if( flags & kBubbleTest ) { - Int8* pDst = (Int8*)dst->GetAddr32(0, 0); + int8_t* pDst = (int8_t*)dst->GetAddr32(0, 0); - Int32 nZ = Int32(smooth * 255.99f); + int32_t nZ = int32_t(smooth * 255.99f); int i; int j; @@ -215,12 +215,12 @@ plMipmap* plBumpMapGen::QikNormalMap(plMipmap* dst, const plMipmap* src, UInt32 { for( i = 0; i < width; i++ ) { - hsScalar x = hsScalar(i) / hsScalar(width-1) * 2.f - 1.f; - hsScalar y = hsScalar(j) / hsScalar(height-1) * 2.f - 1.f; + float x = float(i) / float(width-1) * 2.f - 1.f; + float y = float(j) / float(height-1) * 2.f - 1.f; - hsScalar z = 1.f - x*x - y*y; + float z = 1.f - x*x - y*y; if( z > 0 ) - z = hsSquareRoot(z); + z = sqrt(z); else { x = 0; @@ -228,12 +228,12 @@ plMipmap* plBumpMapGen::QikNormalMap(plMipmap* dst, const plMipmap* src, UInt32 z = 1.f; } z *= smooth; - hsScalar invLen = hsFastMath::InvSqrt(x*x + y*y + z*z) * 127.00f; + float invLen = hsFastMath::InvSqrt(x*x + y*y + z*z) * 127.00f; - pDst[2] = Int8(x * invLen); - pDst[1] = Int8(y * invLen); - pDst[0] = Int8(z * invLen); + pDst[2] = int8_t(x * invLen); + pDst[1] = int8_t(y * invLen); + pDst[0] = int8_t(z * invLen); pDst += 4; } @@ -242,9 +242,9 @@ plMipmap* plBumpMapGen::QikNormalMap(plMipmap* dst, const plMipmap* src, UInt32 else if( flags & kNormalize ) { - Int8* pDst = (Int8*)dst->GetAddr32(0, 0); + int8_t* pDst = (int8_t*)dst->GetAddr32(0, 0); - Int32 nZ = Int32(smooth * 127.00f); + int32_t nZ = int32_t(smooth * 127.00f); int i; int j; @@ -252,18 +252,18 @@ plMipmap* plBumpMapGen::QikNormalMap(plMipmap* dst, const plMipmap* src, UInt32 { for( i = 0; i < width; i++ ) { - Int32 x = pDst[2]; - Int32 y = pDst[1]; + int32_t x = pDst[2]; + int32_t y = pDst[1]; if( x ) x *= 1; if( y ) y *= 1; - hsScalar invLen = hsFastMath::InvSqrt((hsScalar)(x*x + y*y + nZ*nZ)) * 127.0f; - pDst[2] = Int8(x * invLen); - pDst[1] = Int8(y * invLen); - pDst[0] = Int8(nZ * invLen); + float invLen = hsFastMath::InvSqrt((float)(x*x + y*y + nZ*nZ)) * 127.0f; + pDst[2] = int8_t(x * invLen); + pDst[1] = int8_t(y * invLen); + pDst[0] = int8_t(nZ * invLen); pDst += 4; } @@ -271,17 +271,17 @@ plMipmap* plBumpMapGen::QikNormalMap(plMipmap* dst, const plMipmap* src, UInt32 } else if( smooth != 1.f ) { - Int32 divis = 127; - Int32 nZ = 127; + int32_t divis = 127; + int32_t nZ = 127; if( (smooth > 1.f) ) { - divis = (Int32)(smooth * 127); + divis = (int32_t)(smooth * 127); } else { - nZ = UInt32(smooth * 127.5f); + nZ = uint32_t(smooth * 127.5f); } - Int8* pDst = (Int8*)dst->GetAddr32(0, 0); + int8_t* pDst = (int8_t*)dst->GetAddr32(0, 0); int i; int j; @@ -289,18 +289,18 @@ plMipmap* plBumpMapGen::QikNormalMap(plMipmap* dst, const plMipmap* src, UInt32 { for( i = 0; i < width; i++ ) { - Int32 v; - *pDst = (Int8)nZ; + int32_t v; + *pDst = (int8_t)nZ; pDst++; v = *pDst * 127; v /= divis; - *pDst = (Int8)(v & 0xff); + *pDst = (int8_t)(v & 0xff); pDst++; v = *pDst * 127; v /= divis; - *pDst = (Int8)(v & 0xff); + *pDst = (int8_t)(v & 0xff); pDst += 2; } diff --git a/Sources/Plasma/PubUtilLib/plGImage/plBumpMapGen.h b/Sources/Plasma/PubUtilLib/plGImage/plBumpMapGen.h index 0327672b..085e414a 100644 --- a/Sources/Plasma/PubUtilLib/plGImage/plBumpMapGen.h +++ b/Sources/Plasma/PubUtilLib/plGImage/plBumpMapGen.h @@ -56,9 +56,9 @@ public: kScaleHgtByAlpha = 0x8, kBubbleTest = 0x10 }; - static plMipmap* QikBumpMap(plMipmap* dst, const plMipmap* src, UInt32 mask, UInt32 flags); + static plMipmap* QikBumpMap(plMipmap* dst, const plMipmap* src, uint32_t mask, uint32_t flags); - static plMipmap* QikNormalMap(plMipmap* dst, const plMipmap* src, UInt32 mask, UInt32 flags, hsScalar smooth=1.f); // higher smooth means less bumpy, valid range [0..inf]. + static plMipmap* QikNormalMap(plMipmap* dst, const plMipmap* src, uint32_t mask, uint32_t flags, float smooth=1.f); // higher smooth means less bumpy, valid range [0..inf]. static plMipmap* TwosCompToBias(plMipmap* dst); static plMipmap* MakeCompatibleBlank(const plMipmap* src); diff --git a/Sources/Plasma/PubUtilLib/plGImage/plCubicEnvironmap.cpp b/Sources/Plasma/PubUtilLib/plGImage/plCubicEnvironmap.cpp index 187d1a21..422674ab 100644 --- a/Sources/Plasma/PubUtilLib/plGImage/plCubicEnvironmap.cpp +++ b/Sources/Plasma/PubUtilLib/plGImage/plCubicEnvironmap.cpp @@ -52,7 +52,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // // /////////////////////////////////////////////////////////////////////////////// -#include "hsTypes.h" +#include "HeadSpin.h" #include "plCubicEnvironmap.h" #include "plMipmap.h" @@ -64,7 +64,7 @@ plCubicEnvironmap::plCubicEnvironmap() int i; for( i = 0; i < 6; i++ ) - fFaces[ i ] = TRACKED_NEW plMipmap; + fFaces[ i ] = new plMipmap; fInitialized = false; } @@ -80,9 +80,9 @@ plCubicEnvironmap::~plCubicEnvironmap() //// GetTotalSize ///////////////////////////////////////////////////////////// // Get the total size in bytes -UInt32 plCubicEnvironmap::GetTotalSize( void ) const +uint32_t plCubicEnvironmap::GetTotalSize( void ) const { - UInt32 size, i; + uint32_t size, i; for( size = 0, i = 0; i < 6; i++ ) @@ -96,9 +96,9 @@ UInt32 plCubicEnvironmap::GetTotalSize( void ) const //// Read ///////////////////////////////////////////////////////////////////// -UInt32 plCubicEnvironmap::Read( hsStream *s ) +uint32_t plCubicEnvironmap::Read( hsStream *s ) { - UInt32 i, tr = plBitmap::Read( s ); + uint32_t i, tr = plBitmap::Read( s ); for( i = 0; i < 6; i++ ) @@ -111,9 +111,9 @@ UInt32 plCubicEnvironmap::Read( hsStream *s ) //// Write //////////////////////////////////////////////////////////////////// -UInt32 plCubicEnvironmap::Write( hsStream *s ) +uint32_t plCubicEnvironmap::Write( hsStream *s ) { - UInt32 i, tw = plBitmap::Write( s ); + uint32_t i, tw = plBitmap::Write( s ); for( i = 0; i < 6; i++ ) @@ -125,7 +125,7 @@ UInt32 plCubicEnvironmap::Write( hsStream *s ) //// CopyToFace /////////////////////////////////////////////////////////////// // Export-only: Copy the mipmap given into a face -void plCubicEnvironmap::CopyToFace( plMipmap *mip, UInt8 face ) +void plCubicEnvironmap::CopyToFace( plMipmap *mip, uint8_t face ) { hsAssert( face < 6, "Invalid face index in CopyToFace()" ); hsAssert( fFaces[ face ] != nil, "nil face in CopyToFace()" ); diff --git a/Sources/Plasma/PubUtilLib/plGImage/plCubicEnvironmap.h b/Sources/Plasma/PubUtilLib/plGImage/plCubicEnvironmap.h index c579e48c..6a557c7f 100644 --- a/Sources/Plasma/PubUtilLib/plGImage/plCubicEnvironmap.h +++ b/Sources/Plasma/PubUtilLib/plGImage/plCubicEnvironmap.h @@ -88,15 +88,15 @@ class plCubicEnvironmap : public plBitmap // Get the total size in bytes - virtual UInt32 GetTotalSize( void ) const; + virtual uint32_t GetTotalSize( void ) const; virtual void Read( hsStream *s, hsResMgr *mgr ) { hsKeyedObject::Read( s, mgr ); this->Read( s ); } virtual void Write( hsStream *s, hsResMgr *mgr ) { hsKeyedObject::Write( s, mgr ); this->Write( s ); } - plMipmap *GetFace( UInt8 face ) const { return fFaces[ face ]; } + plMipmap *GetFace( uint8_t face ) const { return fFaces[ face ]; } // Export-only: Copy the mipmap given into a face - void CopyToFace( plMipmap *mip, UInt8 face ); + void CopyToFace( plMipmap *mip, uint8_t face ); protected: @@ -105,8 +105,8 @@ class plCubicEnvironmap : public plBitmap plMipmap *fFaces[ 6 ]; hsBool fInitialized; - virtual UInt32 Read( hsStream *s ); - virtual UInt32 Write( hsStream *s ); + virtual uint32_t Read( hsStream *s ); + virtual uint32_t Write( hsStream *s ); }; diff --git a/Sources/Plasma/PubUtilLib/plGImage/plDynSurfaceWriter.cpp b/Sources/Plasma/PubUtilLib/plGImage/plDynSurfaceWriter.cpp index d00ba302..95cf5311 100644 --- a/Sources/Plasma/PubUtilLib/plGImage/plDynSurfaceWriter.cpp +++ b/Sources/Plasma/PubUtilLib/plGImage/plDynSurfaceWriter.cpp @@ -54,13 +54,13 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // // /////////////////////////////////////////////////////////////////////////////// -#include "hsTypes.h" -#include "hsWindows.h" +#include "HeadSpin.h" + #include "plDynSurfaceWriter.h" #include "plDynamicTextMap.h" #include "hsExceptions.h" -#include "hsUtils.h" + #include "hsMatrix44.h" #include "plMessage/plDynamicTextMsg.h" #include "pnKeyedObject/plKey.h" @@ -73,8 +73,8 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #if HS_BUILD_FOR_WIN32 -static UInt32 sNumDCsAllocated; -static UInt32 sNumBitmapsAllocated; +static uint32_t sNumDCsAllocated; +static uint32_t sNumBitmapsAllocated; plDynSurfaceWriter::plWinSurface::plWinSurface() { @@ -98,7 +98,7 @@ plDynSurfaceWriter::plWinSurface::~plWinSurface() Release(); } -void plDynSurfaceWriter::plWinSurface::Allocate( UInt16 w, UInt16 h ) +void plDynSurfaceWriter::plWinSurface::Allocate( uint16_t w, uint16_t h ) { int i; BITMAPINFO *bmi; @@ -111,9 +111,9 @@ void plDynSurfaceWriter::plWinSurface::Allocate( UInt16 w, UInt16 h ) /// Initialize a bitmap info struct to describe our surface if( IBitsPerPixel() == 8 ) - bmi = (BITMAPINFO *)( TRACKED_NEW UInt8[ sizeof( BITMAPINFOHEADER ) + sizeof( RGBQUAD ) * 256 ] ); + bmi = (BITMAPINFO *)( new uint8_t[ sizeof( BITMAPINFOHEADER ) + sizeof( RGBQUAD ) * 256 ] ); else - bmi = TRACKED_NEW BITMAPINFO; + bmi = new BITMAPINFO; memset( &bmi->bmiHeader, 0, sizeof( BITMAPINFOHEADER ) ); bmi->bmiHeader.biSize = sizeof( BITMAPINFOHEADER ); @@ -215,7 +215,7 @@ void plDynSurfaceWriter::plWinSurface::Release( void ) fFontBlockedRGB = false; } -hsBool plDynSurfaceWriter::plWinSurface::WillFit( UInt16 w, UInt16 h ) +hsBool plDynSurfaceWriter::plWinSurface::WillFit( uint16_t w, uint16_t h ) { if( fWidth >= w && fHeight >= h ) return true; @@ -231,7 +231,7 @@ static int SafeStrCmp( const char *str1, const char *str2 ) return -1; } -hsBool plDynSurfaceWriter::plWinSurface::FontMatches( const char *face, UInt16 size, UInt8 flags, hsBool aaRGB ) +hsBool plDynSurfaceWriter::plWinSurface::FontMatches( const char *face, uint16_t size, uint8_t flags, hsBool aaRGB ) { if( SafeStrCmp( face, fFontFace ) == 0 && fFontSize == size && fFontFlags == flags && fFontAntiAliasRGB == aaRGB ) @@ -240,7 +240,7 @@ hsBool plDynSurfaceWriter::plWinSurface::FontMatches( const char *face, UInt16 return false; } -void plDynSurfaceWriter::plWinSurface::SetFont( const char *face, UInt16 size, UInt8 flags, hsBool aaRGB ) +void plDynSurfaceWriter::plWinSurface::SetFont( const char *face, uint16_t size, uint8_t flags, hsBool aaRGB ) { delete [] fFontFace; fFontFace = ( face != nil ) ? hsStrcpy( face ) : nil; @@ -372,7 +372,7 @@ plDynSurfaceWriter::~plDynSurfaceWriter() Reset(); } -plDynSurfaceWriter::plDynSurfaceWriter( plDynamicTextMap *target, UInt32 flags ) +plDynSurfaceWriter::plDynSurfaceWriter( plDynamicTextMap *target, uint32_t flags ) { IInit(); fFlags = flags; @@ -425,20 +425,20 @@ void plDynSurfaceWriter::FlushToTarget( void ) // Flush the GDI so we can grab the bits GdiFlush(); - UInt32 *destBits = (UInt32 *)fCurrTarget->GetImage(); + uint32_t *destBits = (uint32_t *)fCurrTarget->GetImage(); // Are we merging in the alpha bits? if( fFlags & kSupportAlpha ) { // Yup, munge 'em - UInt32 *srcRGBBits = fRGBSurface.GetBits(); - UInt8 *srcAlphaBits = fAlphaSurface.GetBits(); - UInt32 destWidth = fCurrTarget->GetWidth(); + uint32_t *srcRGBBits = fRGBSurface.GetBits(); + uint8_t *srcAlphaBits = fAlphaSurface.GetBits(); + uint32_t destWidth = fCurrTarget->GetWidth(); for( y = 0; y < fCurrTarget->GetHeight(); y++ ) { for( x = 0; x < destWidth; x++ ) - destBits[ x ] = ( srcRGBBits[ x ] & 0x00ffffff ) | ( (UInt32)srcAlphaBits[ x ] << 24 ); + destBits[ x ] = ( srcRGBBits[ x ] & 0x00ffffff ) | ( (uint32_t)srcAlphaBits[ x ] << 24 ); destBits += destWidth; srcRGBBits += fRGBSurface.fWidth; @@ -448,12 +448,12 @@ void plDynSurfaceWriter::FlushToTarget( void ) else { // Nope, just a 24-bit copy and set alphas to ff - UInt32 *srcBits = fRGBSurface.GetBits(); - UInt32 destWidth = fCurrTarget->GetWidth(); + uint32_t *srcBits = fRGBSurface.GetBits(); + uint32_t destWidth = fCurrTarget->GetWidth(); for( y = 0; y < fCurrTarget->GetHeight(); y++ ) { - memcpy( destBits, srcBits, destWidth * sizeof( UInt32 ) ); + memcpy( destBits, srcBits, destWidth * sizeof( uint32_t ) ); // Fill in 0xff for( x = 0; x < destWidth; x++ ) @@ -489,17 +489,17 @@ void plDynSurfaceWriter::SwitchTarget( plDynamicTextMap *target ) #if HS_BUILD_FOR_WIN32 if( target != nil ) { - if( !fRGBSurface.WillFit( (UInt16)(target->GetWidth()), (UInt16)(target->GetHeight()) ) ) + if( !fRGBSurface.WillFit( (uint16_t)(target->GetWidth()), (uint16_t)(target->GetHeight()) ) ) { - fRGBSurface.Allocate( (UInt16)(target->GetWidth()), (UInt16)(target->GetHeight()) ); + fRGBSurface.Allocate( (uint16_t)(target->GetWidth()), (uint16_t)(target->GetHeight()) ); hadToAllocate = true; } if( fFlags & kSupportAlpha ) { - if( !fAlphaSurface.WillFit( (UInt16)(target->GetWidth()), (UInt16)(target->GetHeight()) ) ) + if( !fAlphaSurface.WillFit( (uint16_t)(target->GetWidth()), (uint16_t)(target->GetHeight()) ) ) { - fAlphaSurface.Allocate( (UInt16)(target->GetWidth()), (UInt16)(target->GetHeight()) ); + fAlphaSurface.Allocate( (uint16_t)(target->GetWidth()), (uint16_t)(target->GetHeight()) ); hadToAllocate = true; } } @@ -526,7 +526,7 @@ void plDynSurfaceWriter::SwitchTarget( plDynamicTextMap *target ) void plDynSurfaceWriter::IEnsureSurfaceUpdated( void ) { - UInt32 x, y; + uint32_t x, y; // If we're flushed, then we haven't drawn since the last flush, @@ -535,23 +535,23 @@ void plDynSurfaceWriter::IEnsureSurfaceUpdated( void ) // to be copying over what we've already drawn if( fCurrTarget != nil && fFlushed ) { - UInt32 *srcBits = (UInt32 *)fCurrTarget->GetImage(); + uint32_t *srcBits = (uint32_t *)fCurrTarget->GetImage(); #if HS_BUILD_FOR_WIN32 // Are we merging in the alpha bits? if( fFlags & kSupportAlpha ) { // Yup, de-munge 'em - UInt32 *destRGBBits = fRGBSurface.GetBits(); - UInt8 *destAlphaBits = fAlphaSurface.GetBits(); - UInt32 srcWidth = fCurrTarget->GetWidth(); + uint32_t *destRGBBits = fRGBSurface.GetBits(); + uint8_t *destAlphaBits = fAlphaSurface.GetBits(); + uint32_t srcWidth = fCurrTarget->GetWidth(); for( y = 0; y < fCurrTarget->GetHeight(); y++ ) { for( x = 0; x < srcWidth; x++ ) { destRGBBits[ x ] = srcBits[ x ]; // Windows GDI probably doesn't care about the alpha bits here. Hopefully... - destAlphaBits[ x ] = (UInt8)(srcBits[ x ] >> 24); + destAlphaBits[ x ] = (uint8_t)(srcBits[ x ] >> 24); } srcBits += srcWidth; @@ -562,12 +562,12 @@ void plDynSurfaceWriter::IEnsureSurfaceUpdated( void ) else { // Nope, just do a straight memcopy - UInt32 *destBits = fRGBSurface.GetBits(); - UInt32 srcWidth = fCurrTarget->GetWidth(); + uint32_t *destBits = fRGBSurface.GetBits(); + uint32_t srcWidth = fCurrTarget->GetWidth(); for( y = 0; y < fCurrTarget->GetHeight(); y++ ) { - memcpy( destBits, srcBits, srcWidth * sizeof( UInt32 ) ); + memcpy( destBits, srcBits, srcWidth * sizeof( uint32_t ) ); srcBits += srcWidth; destBits += fRGBSurface.fWidth; @@ -609,11 +609,11 @@ hsBool plDynSurfaceWriter::IsValid( void ) const //// SetBitsFromBuffer //////////////////////////////////////////////////////// /* -void plDynSurfaceWriter::SetBitsFromBuffer( UInt32 *clearBuffer, UInt16 width, UInt16 height ) +void plDynSurfaceWriter::SetBitsFromBuffer( uint32_t *clearBuffer, uint16_t width, uint16_t height ) { int x, y; - UInt32 *data = (UInt32 *)fImage, *srcData = clearBuffer; - UInt8 *destAlpha = nil; + uint32_t *data = (uint32_t *)fImage, *srcData = clearBuffer; + uint8_t *destAlpha = nil; if( !IsValid() ) @@ -624,7 +624,7 @@ void plDynSurfaceWriter::SetBitsFromBuffer( UInt32 *clearBuffer, UInt16 width #endif // Clear *all* to zero - memset( data, 0, fWidth * fHeight * sizeof( UInt32 ) ); + memset( data, 0, fWidth * fHeight * sizeof( uint32_t ) ); if( fHasAlpha ) { #if HS_BUILD_FOR_WIN32 @@ -666,19 +666,19 @@ void plDynSurfaceWriter::ClearToColor( hsColorRGBA &color ) #if HS_BUILD_FOR_WIN32 - UInt32 i, hexColor = color.ToARGB32(); + uint32_t i, hexColor = color.ToARGB32(); // Flush the GDI first, so it doesn't decide to overwrite us later GdiFlush(); - UInt32 *rgbBits = fRGBSurface.GetBits(); + uint32_t *rgbBits = fRGBSurface.GetBits(); for( i = 0; i < fRGBSurface.fWidth * fRGBSurface.fHeight; i++ ) rgbBits[ i ] = hexColor; if( fFlags & kSupportAlpha ) { - UInt8 *alphaBits = fAlphaSurface.GetBits(), alpha = (UInt8)(hexColor >> 24); + uint8_t *alphaBits = fAlphaSurface.GetBits(), alpha = (uint8_t)(hexColor >> 24); for( i = 0; i < fAlphaSurface.fWidth * fAlphaSurface.fHeight; i++ ) alphaBits[ i ] = alpha; @@ -689,7 +689,7 @@ void plDynSurfaceWriter::ClearToColor( hsColorRGBA &color ) //// SetFont ////////////////////////////////////////////////////////////////// // OS-specific. Load the given font for drawing the text with. -void plDynSurfaceWriter::SetFont( const char *face, UInt16 size, UInt8 fontFlags, hsBool antiAliasRGB ) +void plDynSurfaceWriter::SetFont( const char *face, uint16_t size, uint8_t fontFlags, hsBool antiAliasRGB ) { if( !IsValid() ) return; @@ -701,7 +701,7 @@ void plDynSurfaceWriter::SetFont( const char *face, UInt16 size, UInt8 fontFl //// ISetFont ///////////////////////////////////////////////////////////////// -void plDynSurfaceWriter::ISetFont( const char *face, UInt16 size, UInt8 fontFlags, hsBool antiAliasRGB ) +void plDynSurfaceWriter::ISetFont( const char *face, uint16_t size, uint8_t fontFlags, hsBool antiAliasRGB ) { fFlags = ( fFlags & ~kFontShadowed ) | ( fontFlags & kFontShadowed ); @@ -782,7 +782,7 @@ void plDynSurfaceWriter::IRefreshOSJustify( void ) return; #if HS_BUILD_FOR_WIN32 - UInt32 justMode; + uint32_t justMode; switch( fJustify ) { case kLeftJustify: justMode = TA_LEFT; break; @@ -797,7 +797,7 @@ void plDynSurfaceWriter::IRefreshOSJustify( void ) //// DrawString /////////////////////////////////////////////////////////////// -void plDynSurfaceWriter::DrawString( UInt16 x, UInt16 y, const char *text ) +void plDynSurfaceWriter::DrawString( uint16_t x, uint16_t y, const char *text ) { if( !IsValid() ) return; @@ -833,7 +833,7 @@ void plDynSurfaceWriter::DrawString( UInt16 x, UInt16 y, const char *text ) //// DrawClippedString //////////////////////////////////////////////////////// -void plDynSurfaceWriter::DrawClippedString( Int16 x, Int16 y, const char *text, UInt16 width, UInt16 height ) +void plDynSurfaceWriter::DrawClippedString( int16_t x, int16_t y, const char *text, uint16_t width, uint16_t height ) { if( !IsValid() ) return; @@ -874,7 +874,7 @@ void plDynSurfaceWriter::DrawClippedString( Int16 x, Int16 y, const char *tex //// DrawClippedString //////////////////////////////////////////////////////// -void plDynSurfaceWriter::DrawClippedString( Int16 x, Int16 y, const char *text, UInt16 clipX, UInt16 clipY, UInt16 width, UInt16 height ) +void plDynSurfaceWriter::DrawClippedString( int16_t x, int16_t y, const char *text, uint16_t clipX, uint16_t clipY, uint16_t width, uint16_t height ) { if( !IsValid() ) return; @@ -910,7 +910,7 @@ void plDynSurfaceWriter::DrawClippedString( Int16 x, Int16 y, const char *tex //// DrawWrappedString //////////////////////////////////////////////////////// -void plDynSurfaceWriter::DrawWrappedString( UInt16 x, UInt16 y, const char *text, UInt16 width, UInt16 height ) +void plDynSurfaceWriter::DrawWrappedString( uint16_t x, uint16_t y, const char *text, uint16_t width, uint16_t height ) { if( !IsValid() ) return; @@ -952,7 +952,7 @@ void plDynSurfaceWriter::DrawWrappedString( UInt16 x, UInt16 y, const char *t //// CalcStringWidth ////////////////////////////////////////////////////////// -UInt16 plDynSurfaceWriter::CalcStringWidth( const char *text, UInt16 *height ) +uint16_t plDynSurfaceWriter::CalcStringWidth( const char *text, uint16_t *height ) { if( !IsValid() ) return 0; @@ -965,15 +965,15 @@ UInt16 plDynSurfaceWriter::CalcStringWidth( const char *text, UInt16 *heigh ::GetTextExtentPoint32( fRGBSurface.fDC, text, strlen( text ), &size ); if( height != nil ) - *height = (UInt16)size.cy; + *height = (uint16_t)size.cy; - return (UInt16)size.cx; + return (uint16_t)size.cx; #endif } //// CalcWrappedStringSize //////////////////////////////////////////////////// -void plDynSurfaceWriter::CalcWrappedStringSize( const char *text, UInt16 *width, UInt16 *height ) +void plDynSurfaceWriter::CalcWrappedStringSize( const char *text, uint16_t *width, uint16_t *height ) { if( !IsValid() ) return; @@ -995,15 +995,15 @@ void plDynSurfaceWriter::CalcWrappedStringSize( const char *text, UInt16 *wid ::DrawText( fRGBSurface.fDC, text, strlen( text ), &r, format ); - *width = (UInt16)(r.right); + *width = (uint16_t)(r.right); if( height != nil ) - *height = (UInt16)r.bottom; + *height = (uint16_t)r.bottom; #endif } //// FillRect ///////////////////////////////////////////////////////////////// -void plDynSurfaceWriter::FillRect( UInt16 x, UInt16 y, UInt16 width, UInt16 height, hsColorRGBA &color ) +void plDynSurfaceWriter::FillRect( uint16_t x, uint16_t y, uint16_t width, uint16_t height, hsColorRGBA &color ) { if( !IsValid() ) return; @@ -1036,7 +1036,7 @@ void plDynSurfaceWriter::FillRect( UInt16 x, UInt16 y, UInt16 width, UInt16 h //// FrameRect //////////////////////////////////////////////////////////////// -void plDynSurfaceWriter::FrameRect( UInt16 x, UInt16 y, UInt16 width, UInt16 height, hsColorRGBA &color ) +void plDynSurfaceWriter::FrameRect( uint16_t x, uint16_t y, uint16_t width, uint16_t height, hsColorRGBA &color ) { if( !IsValid() ) return; @@ -1070,7 +1070,7 @@ void plDynSurfaceWriter::FrameRect( UInt16 x, UInt16 y, UInt16 width, UInt16 /* //// DrawImage //////////////////////////////////////////////////////////////// -void plDynSurfaceWriter::DrawImage( UInt16 x, UInt16 y, plMipmap *image, hsBool respectAlpha ) +void plDynSurfaceWriter::DrawImage( uint16_t x, uint16_t y, plMipmap *image, hsBool respectAlpha ) { if( !IsValid() ) return; @@ -1100,9 +1100,9 @@ void plDynSurfaceWriter::DrawImage( UInt16 x, UInt16 y, plMipmap *image, hsBo //// DrawClippedImage ///////////////////////////////////////////////////////// -void plDynSurfaceWriter::DrawClippedImage( UInt16 x, UInt16 y, plMipmap *image, - UInt16 srcClipX, UInt16 srcClipY, - UInt16 srcClipWidth, UInt16 srcClipHeight, +void plDynSurfaceWriter::DrawClippedImage( uint16_t x, uint16_t y, plMipmap *image, + uint16_t srcClipX, uint16_t srcClipY, + uint16_t srcClipWidth, uint16_t srcClipHeight, hsBool respectAlpha ) { if( !IsValid() ) diff --git a/Sources/Plasma/PubUtilLib/plGImage/plDynSurfaceWriter.h b/Sources/Plasma/PubUtilLib/plGImage/plDynSurfaceWriter.h index 84686abd..4fdb3617 100644 --- a/Sources/Plasma/PubUtilLib/plGImage/plDynSurfaceWriter.h +++ b/Sources/Plasma/PubUtilLib/plGImage/plDynSurfaceWriter.h @@ -58,7 +58,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #define _plDynSurfaceWriter_h #include "hsColorRGBA.h" -#include "hsWindows.h" // EVIL + // EVIL struct hsMatrix44; @@ -97,32 +97,32 @@ class plDynSurfaceWriter plDynSurfaceWriter(); - plDynSurfaceWriter( plDynamicTextMap *target, UInt32 flags = 0 ); + plDynSurfaceWriter( plDynamicTextMap *target, uint32_t flags = 0 ); virtual ~plDynSurfaceWriter(); /// Operations to perform on the text block void ClearToColor( hsColorRGBA &color ); - void SetFont( const char *face, UInt16 size, UInt8 fontFlags = 0, hsBool antiAliasRGB = true ); + void SetFont( const char *face, uint16_t size, uint8_t fontFlags = 0, hsBool antiAliasRGB = true ); void SetTextColor( hsColorRGBA &color, hsBool blockRGB = false ); void SetJustify( Justify j ); - void DrawString( UInt16 x, UInt16 y, const char *text ); - void DrawClippedString( Int16 x, Int16 y, const char *text, UInt16 width, UInt16 height ); - void DrawClippedString( Int16 x, Int16 y, const char *text, UInt16 clipX, UInt16 clipY, UInt16 width, UInt16 height ); - void DrawWrappedString( UInt16 x, UInt16 y, const char *text, UInt16 width, UInt16 height ); - UInt16 CalcStringWidth( const char *text, UInt16 *height = nil ); - void CalcWrappedStringSize( const char *text, UInt16 *width, UInt16 *height ); - void FillRect( UInt16 x, UInt16 y, UInt16 width, UInt16 height, hsColorRGBA &color ); - void FrameRect( UInt16 x, UInt16 y, UInt16 width, UInt16 height, hsColorRGBA &color ); + void DrawString( uint16_t x, uint16_t y, const char *text ); + void DrawClippedString( int16_t x, int16_t y, const char *text, uint16_t width, uint16_t height ); + void DrawClippedString( int16_t x, int16_t y, const char *text, uint16_t clipX, uint16_t clipY, uint16_t width, uint16_t height ); + void DrawWrappedString( uint16_t x, uint16_t y, const char *text, uint16_t width, uint16_t height ); + uint16_t CalcStringWidth( const char *text, uint16_t *height = nil ); + void CalcWrappedStringSize( const char *text, uint16_t *width, uint16_t *height ); + void FillRect( uint16_t x, uint16_t y, uint16_t width, uint16_t height, hsColorRGBA &color ); + void FrameRect( uint16_t x, uint16_t y, uint16_t width, uint16_t height, hsColorRGBA &color ); -// void DrawImage( UInt16 x, UInt16 y, plMipmap *image, hsBool respectAlpha = false ); -// void DrawClippedImage( UInt16 x, UInt16 y, plMipmap *image, UInt16 srcClipX, UInt16 srcClipY, -// UInt16 srcClipWidth, UInt16 srcClipHeight, hsBool respectAlpha = false ); +// void DrawImage( uint16_t x, uint16_t y, plMipmap *image, hsBool respectAlpha = false ); +// void DrawClippedImage( uint16_t x, uint16_t y, plMipmap *image, uint16_t srcClipX, uint16_t srcClipY, +// uint16_t srcClipWidth, uint16_t srcClipHeight, hsBool respectAlpha = false ); // Copy the raw data from the given buffer. -// void SetBitsFromBuffer( UInt32 *clearBuffer, UInt16 width, UInt16 height ) +// void SetBitsFromBuffer( uint32_t *clearBuffer, uint16_t width, uint16_t height ) /// Target switching operations @@ -148,16 +148,16 @@ class plDynSurfaceWriter void IRefreshOSJustify( void ); void ISetTextColor( hsColorRGBA &color, hsBool blockRGB ); - void ISetFont( const char *face, UInt16 size, UInt8 fontFlags = 0, hsBool antiAliasRGB = true ); + void ISetFont( const char *face, uint16_t size, uint8_t fontFlags = 0, hsBool antiAliasRGB = true ); plDynamicTextMap *fCurrTarget; - UInt32 fFlags; + uint32_t fFlags; Justify fJustify; hsBool fFlushed; char *fFontFace; - UInt16 fFontSize; - UInt8 fFontFlags; + uint16_t fFontSize; + uint8_t fFontFlags; hsBool fFontAntiAliasRGB; hsBool fFontBlockedRGB; @@ -171,7 +171,7 @@ class plDynSurfaceWriter protected: void *fBits; - virtual UInt8 IBitsPerPixel( void ) const = 0; + virtual uint8_t IBitsPerPixel( void ) const = 0; public: HDC fDC; @@ -180,36 +180,36 @@ class plDynSurfaceWriter COLORREF fTextColor; int fSaveNum; - UInt16 fWidth, fHeight; + uint16_t fWidth, fHeight; char *fFontFace; - UInt16 fFontSize; - UInt8 fFontFlags; + uint16_t fFontSize; + uint8_t fFontFlags; hsBool fFontAntiAliasRGB, fFontBlockedRGB; plWinSurface(); ~plWinSurface(); - void Allocate( UInt16 w, UInt16 h ); + void Allocate( uint16_t w, uint16_t h ); void Release( void ); - hsBool WillFit( UInt16 w, UInt16 h ); - hsBool FontMatches( const char *face, UInt16 size, UInt8 flags, hsBool aaRGB ); - void SetFont( const char *face, UInt16 size, UInt8 flags, hsBool aaRGB ); + hsBool WillFit( uint16_t w, uint16_t h ); + hsBool FontMatches( const char *face, uint16_t size, uint8_t flags, hsBool aaRGB ); + void SetFont( const char *face, uint16_t size, uint8_t flags, hsBool aaRGB ); }; class plWinRGBSurface : public plWinSurface { - virtual UInt8 IBitsPerPixel( void ) const { return 32; } + virtual uint8_t IBitsPerPixel( void ) const { return 32; } public: - UInt32 *GetBits( void ) const { return (UInt32 *)fBits; } + uint32_t *GetBits( void ) const { return (uint32_t *)fBits; } }; class plWinAlphaSurface : public plWinSurface { - virtual UInt8 IBitsPerPixel( void ) const { return 8; } + virtual uint8_t IBitsPerPixel( void ) const { return 8; } public: - UInt8 *GetBits( void ) const { return (UInt8 *)fBits; } + uint8_t *GetBits( void ) const { return (uint8_t *)fBits; } }; plWinRGBSurface fRGBSurface; diff --git a/Sources/Plasma/PubUtilLib/plGImage/plDynamicTextMap.cpp b/Sources/Plasma/PubUtilLib/plGImage/plDynamicTextMap.cpp index 3e97bcf6..9d2010bd 100644 --- a/Sources/Plasma/PubUtilLib/plGImage/plDynamicTextMap.cpp +++ b/Sources/Plasma/PubUtilLib/plGImage/plDynamicTextMap.cpp @@ -51,12 +51,12 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // // /////////////////////////////////////////////////////////////////////////////// -#include "hsTypes.h" +#include "HeadSpin.h" #include "plDynamicTextMap.h" #include "hsStream.h" #include "hsExceptions.h" -#include "hsUtils.h" + #include "hsMatrix44.h" #include "plPipeline/hsGDeviceRef.h" #include "plMessage/plDynamicTextMsg.h" @@ -96,7 +96,7 @@ plDynamicTextMap::~plDynamicTextMap() Reset(); } -plDynamicTextMap::plDynamicTextMap( UInt32 width, UInt32 height, hsBool hasAlpha, UInt32 extraWidth, UInt32 extraHeight ) : plMipmap() +plDynamicTextMap::plDynamicTextMap( uint32_t width, uint32_t height, hsBool hasAlpha, uint32_t extraWidth, uint32_t extraHeight ) : plMipmap() { fInitBuffer = nil; fFontFace = nil; @@ -109,11 +109,11 @@ plDynamicTextMap::plDynamicTextMap( UInt32 width, UInt32 height, hsBool hasAlpha // instead, which does just that. It basically does all the setup work that // Create() does, or enough for us to write out later. -void plDynamicTextMap::SetNoCreate( UInt32 width, UInt32 height, hsBool hasAlpha ) +void plDynamicTextMap::SetNoCreate( uint32_t width, uint32_t height, hsBool hasAlpha ) { // OK, so it really isn't that much work... - fVisWidth = (UInt16)width; - fVisHeight = (UInt16)height; + fVisWidth = (uint16_t)width; + fVisHeight = (uint16_t)height; fHasAlpha = hasAlpha; fImage = nil; // So we know we haven't actually done anything yet delete [] fInitBuffer; @@ -122,13 +122,13 @@ void plDynamicTextMap::SetNoCreate( UInt32 width, UInt32 height, hsBool hasAl //// Create /////////////////////////////////////////////////////////////////// -void plDynamicTextMap::Create( UInt32 width, UInt32 height, hsBool hasAlpha, UInt32 extraWidth, UInt32 extraHeight ) +void plDynamicTextMap::Create( uint32_t width, uint32_t height, hsBool hasAlpha, uint32_t extraWidth, uint32_t extraHeight ) { SetConfig( hasAlpha ? kARGB32Config : kRGB32Config ); - fVisWidth = (UInt16)width; - fVisHeight = (UInt16)height; + fVisWidth = (uint16_t)width; + fVisHeight = (uint16_t)height; fHasAlpha = hasAlpha; for( fWidth = 1; fWidth < width + extraWidth; fWidth <<= 1 ); @@ -188,7 +188,7 @@ hsBool plDynamicTextMap::IIsValid( void ) if( GetImage() == nil && fHasCreateBeenCalled ) { // we are going to allocate the fImage at this point... when someone is looking for it - fImage = (void *)IAllocateOSSurface( (UInt16)fWidth, (UInt16)fHeight ); + fImage = (void *)IAllocateOSSurface( (uint16_t)fWidth, (uint16_t)fHeight ); hsColorRGBA color; if( fInitBuffer != nil ) { @@ -235,9 +235,9 @@ void plDynamicTextMap::PurgeImage() // OS-specific. Allocates a rectangular bitmap of the given dimensions that // the OS can draw text into. Returns a pointer to the pixels. -UInt32* plDynamicTextMap::IAllocateOSSurface( UInt16 width, UInt16 height ) +uint32_t* plDynamicTextMap::IAllocateOSSurface( uint16_t width, uint16_t height ) { - UInt32* pixels = TRACKED_NEW UInt32[ width * height ]; + uint32_t* pixels = new uint32_t[ width * height ]; return pixels; } @@ -248,10 +248,10 @@ void plDynamicTextMap::IDestroyOSSurface( void ) { #ifdef MEMORY_LEAK_TRACER if( fImage != nil ) - IRemoveFromMemRecord( (UInt8 *)fImage ); + IRemoveFromMemRecord( (uint8_t *)fImage ); #endif - delete[] (UInt32*)fImage; + delete[] (uint32_t*)fImage; fImage = nil; plProfile_Dec(DynaTexts); @@ -265,23 +265,23 @@ void plDynamicTextMap::IDestroyOSSurface( void ) //// Read ///////////////////////////////////////////////////////////////////// -UInt32 plDynamicTextMap::Read( hsStream *s ) +uint32_t plDynamicTextMap::Read( hsStream *s ) { - UInt32 totalRead = plBitmap::Read( s ); + uint32_t totalRead = plBitmap::Read( s ); // The funny thing is that we don't read anything like a mipmap; we just // keep the width and height and call Create() after we read those in - fVisWidth = (UInt16)(s->ReadLE32()); - fVisHeight = (UInt16)(s->ReadLE32()); + fVisWidth = (uint16_t)(s->ReadLE32()); + fVisHeight = (uint16_t)(s->ReadLE32()); fHasAlpha = s->ReadBool(); totalRead += 2 * 4; - UInt32 initSize = s->ReadLE32(); + uint32_t initSize = s->ReadLE32(); totalRead += 4; if( initSize > 0 ) { - fInitBuffer = TRACKED_NEW UInt32[ initSize ]; + fInitBuffer = new uint32_t[ initSize ]; s->ReadLE32( initSize, fInitBuffer ); totalRead += initSize * 4; @@ -299,15 +299,15 @@ UInt32 plDynamicTextMap::Read( hsStream *s ) //// Write //////////////////////////////////////////////////////////////////// -UInt32 plDynamicTextMap::Write( hsStream *s ) +uint32_t plDynamicTextMap::Write( hsStream *s ) { - UInt32 totalWritten = plBitmap::Write( s ); + uint32_t totalWritten = plBitmap::Write( s ); s->WriteLE32( fVisWidth ); s->WriteLE32( fVisHeight ); s->WriteBool( fHasAlpha ); - s->WriteLE32( fInitBuffer != nil ? fVisWidth * fVisHeight * sizeof( UInt32 ) : 0 ); + s->WriteLE32( fInitBuffer != nil ? fVisWidth * fVisHeight * sizeof( uint32_t ) : 0 ); if( fInitBuffer != nil ) { s->WriteLE32( fVisWidth * fVisHeight, fInitBuffer ); @@ -325,7 +325,7 @@ UInt32 plDynamicTextMap::Write( hsStream *s ) // initializing the color buffer upon creation. If not specified, we init to // black. ASSUMES the buffer is of dimensions fVisWidth x fVisHeight. -void plDynamicTextMap::SetInitBuffer( UInt32 *buffer ) +void plDynamicTextMap::SetInitBuffer( uint32_t *buffer ) { delete [] fInitBuffer; if( buffer == nil ) @@ -334,8 +334,8 @@ void plDynamicTextMap::SetInitBuffer( UInt32 *buffer ) return; } - fInitBuffer = TRACKED_NEW UInt32[ fVisWidth * fVisHeight ]; - memcpy( fInitBuffer, buffer, fVisWidth * fVisHeight * sizeof( UInt32 ) ); + fInitBuffer = new uint32_t[ fVisWidth * fVisHeight ]; + memcpy( fInitBuffer, buffer, fVisWidth * fVisHeight * sizeof( uint32_t ) ); } //// CopyFrom ///////////////////////////////////////////////////////////////// @@ -366,23 +366,23 @@ plMipmap *plDynamicTextMap::Clone( void ) //// IClearFromBuffer ///////////////////////////////////////////////////////// -void plDynamicTextMap::IClearFromBuffer( UInt32 *clearBuffer ) +void plDynamicTextMap::IClearFromBuffer( uint32_t *clearBuffer ) { int y; - UInt32 *data = (UInt32 *)fImage, *srcData = clearBuffer; - UInt8 *destAlpha = nil; + uint32_t *data = (uint32_t *)fImage, *srcData = clearBuffer; + uint8_t *destAlpha = nil; if( !IIsValid() ) return; // Clear *all* to zero - memset( data, 0, fWidth * fHeight * sizeof( UInt32 ) ); + memset( data, 0, fWidth * fHeight * sizeof( uint32_t ) ); // Buffer is of size fVisWidth x fVisHeight, so we need a bit of work to do this right for( y = 0; y < fVisHeight; y++ ) { - memcpy( data, srcData, fVisWidth * sizeof( UInt32 ) ); + memcpy( data, srcData, fVisWidth * sizeof( uint32_t ) ); data += fWidth; srcData += fVisWidth; } @@ -395,8 +395,8 @@ void plDynamicTextMap::ClearToColor( hsColorRGBA &color ) if( !IIsValid() ) return; - UInt32 i, hex = color.ToARGB32(); - UInt32 *data = (UInt32 *)fImage; + uint32_t i, hex = color.ToARGB32(); + uint32_t *data = (uint32_t *)fImage; // Buffer is of size fVisWidth x fVisHeight, so we need a bit of work to do this right for( i = 0; i < fHeight * fWidth; i++ ) @@ -422,7 +422,7 @@ void plDynamicTextMap::SetJustify( Justify j ) //// SetFont ////////////////////////////////////////////////////////////////// -void plDynamicTextMap::SetFont( const char *face, UInt16 size, UInt8 fontFlags, hsBool antiAliasRGB ) +void plDynamicTextMap::SetFont( const char *face, uint16_t size, uint8_t fontFlags, hsBool antiAliasRGB ) { // ===> Don't need to validate creation // if( !IIsValid() ) @@ -442,7 +442,7 @@ void plDynamicTextMap::SetFont( const char *face, UInt16 size, UInt8 fontFlag fFontFlags = fontFlags; fFontAntiAliasRGB = antiAliasRGB; - fCurrFont = plFontCache::GetInstance().GetFont( fFontFace, (UInt8)fFontSize, + fCurrFont = plFontCache::GetInstance().GetFont( fFontFace, (uint8_t)fFontSize, ( ( fFontFlags & kFontBold ) ? plFont::kFlagBold : 0 ) | ( ( fFontFlags & kFontItalic ) ? plFont::kFlagItalic : 0 ) ); if ( fCurrFont == nil ) @@ -454,7 +454,7 @@ void plDynamicTextMap::SetFont( const char *face, UInt16 size, UInt8 fontFlag delete [] fFontFace; fFontFace = hsStrcpy( "Arial" ); // lets try again with Arial - fCurrFont = plFontCache::GetInstance().GetFont( fFontFace, (UInt8)fFontSize, + fCurrFont = plFontCache::GetInstance().GetFont( fFontFace, (uint8_t)fFontSize, ( ( fFontFlags & kFontBold ) ? plFont::kFlagBold : 0 ) | ( ( fFontFlags & kFontItalic ) ? plFont::kFlagItalic : 0 ) ); } @@ -467,7 +467,7 @@ void plDynamicTextMap::SetFont( const char *face, UInt16 size, UInt8 fontFlag } } -void plDynamicTextMap::SetFont( const wchar_t *face, UInt16 size, UInt8 fontFlags , hsBool antiAliasRGB ) +void plDynamicTextMap::SetFont( const wchar_t *face, uint16_t size, uint8_t fontFlags , hsBool antiAliasRGB ) { char *sFace = hsWStringToString(face); SetFont(sFace,size,fontFlags,antiAliasRGB); @@ -476,7 +476,7 @@ void plDynamicTextMap::SetFont( const wchar_t *face, UInt16 size, UInt8 fontF //// SetLineSpacing /////////////////////////////////////////////////////////// -void plDynamicTextMap::SetLineSpacing( Int16 spacing ) +void plDynamicTextMap::SetLineSpacing( int16_t spacing ) { // ===> Don't need to validate creation // if( !IIsValid() ) @@ -503,14 +503,14 @@ void plDynamicTextMap::SetTextColor( hsColorRGBA &color, hsBool blockRGB ) //// DrawString /////////////////////////////////////////////////////////////// -void plDynamicTextMap::DrawString( UInt16 x, UInt16 y, const char *text ) +void plDynamicTextMap::DrawString( uint16_t x, uint16_t y, const char *text ) { wchar_t *wText = hsStringToWString(text); DrawString(x,y,wText); delete [] wText; } -void plDynamicTextMap::DrawString( UInt16 x, UInt16 y, const wchar_t *text ) +void plDynamicTextMap::DrawString( uint16_t x, uint16_t y, const wchar_t *text ) { if( !IIsValid() ) return; @@ -524,14 +524,14 @@ void plDynamicTextMap::DrawString( UInt16 x, UInt16 y, const wchar_t *text ) //// DrawClippedString //////////////////////////////////////////////////////// -void plDynamicTextMap::DrawClippedString( Int16 x, Int16 y, const char *text, UInt16 width, UInt16 height ) +void plDynamicTextMap::DrawClippedString( int16_t x, int16_t y, const char *text, uint16_t width, uint16_t height ) { wchar_t *wText = hsStringToWString(text); DrawClippedString(x,y,wText,width,height); delete [] wText; } -void plDynamicTextMap::DrawClippedString( Int16 x, Int16 y, const wchar_t *text, UInt16 width, UInt16 height ) +void plDynamicTextMap::DrawClippedString( int16_t x, int16_t y, const wchar_t *text, uint16_t width, uint16_t height ) { if( !IIsValid() ) return; @@ -545,14 +545,14 @@ void plDynamicTextMap::DrawClippedString( Int16 x, Int16 y, const wchar_t *te //// DrawClippedString //////////////////////////////////////////////////////// -void plDynamicTextMap::DrawClippedString( Int16 x, Int16 y, const char *text, UInt16 clipX, UInt16 clipY, UInt16 width, UInt16 height ) +void plDynamicTextMap::DrawClippedString( int16_t x, int16_t y, const char *text, uint16_t clipX, uint16_t clipY, uint16_t width, uint16_t height ) { wchar_t *wText = hsStringToWString(text); DrawClippedString(x,y,wText,clipX,clipY,width,height); delete [] wText; } -void plDynamicTextMap::DrawClippedString( Int16 x, Int16 y, const wchar_t *text, UInt16 clipX, UInt16 clipY, UInt16 width, UInt16 height ) +void plDynamicTextMap::DrawClippedString( int16_t x, int16_t y, const wchar_t *text, uint16_t clipX, uint16_t clipY, uint16_t width, uint16_t height ) { if( !IIsValid() ) return; @@ -565,14 +565,14 @@ void plDynamicTextMap::DrawClippedString( Int16 x, Int16 y, const wchar_t *te //// DrawWrappedString //////////////////////////////////////////////////////// -void plDynamicTextMap::DrawWrappedString( UInt16 x, UInt16 y, const char *text, UInt16 width, UInt16 height, UInt16 *lastX, UInt16 *lastY ) +void plDynamicTextMap::DrawWrappedString( uint16_t x, uint16_t y, const char *text, uint16_t width, uint16_t height, uint16_t *lastX, uint16_t *lastY ) { wchar_t *wText = hsStringToWString(text); DrawWrappedString(x,y,wText,width,height,lastX,lastY); delete [] wText; } -void plDynamicTextMap::DrawWrappedString( UInt16 x, UInt16 y, const wchar_t *text, UInt16 width, UInt16 height, UInt16 *lastX, UInt16 *lastY ) +void plDynamicTextMap::DrawWrappedString( uint16_t x, uint16_t y, const wchar_t *text, uint16_t width, uint16_t height, uint16_t *lastX, uint16_t *lastY ) { if( !IIsValid() ) return; @@ -586,23 +586,23 @@ void plDynamicTextMap::DrawWrappedString( UInt16 x, UInt16 y, const wchar_t * //// CalcStringWidth ////////////////////////////////////////////////////////// -UInt16 plDynamicTextMap::CalcStringWidth( const char *text, UInt16 *height ) +uint16_t plDynamicTextMap::CalcStringWidth( const char *text, uint16_t *height ) { wchar_t *wText = hsStringToWString(text); - UInt16 w = CalcStringWidth(wText,height); + uint16_t w = CalcStringWidth(wText,height); delete [] wText; return w; } -UInt16 plDynamicTextMap::CalcStringWidth( const wchar_t *text, UInt16 *height ) +uint16_t plDynamicTextMap::CalcStringWidth( const wchar_t *text, uint16_t *height ) { // ===> Don't need to validate creation // if( !IIsValid() ) // return 0; SetJustify( fJustify ); - UInt16 w, h, a, lastX, lastY; - UInt32 firstClipped; + uint16_t w, h, a, lastX, lastY; + uint32_t firstClipped; fCurrFont->SetRenderFlag( plFont::kRenderClip | plFont::kRenderWrap, false ); fCurrFont->CalcStringExtents( text, w, h, a, firstClipped, lastX, lastY ); if( height != nil ) @@ -612,7 +612,7 @@ UInt16 plDynamicTextMap::CalcStringWidth( const wchar_t *text, UInt16 *heig //// SetFirstLineIndent /////////////////////////////////////////////////////// -void plDynamicTextMap::SetFirstLineIndent( Int16 indent ) +void plDynamicTextMap::SetFirstLineIndent( int16_t indent ) { // ===> Don't need to validate creation // if( !IIsValid() ) @@ -623,22 +623,22 @@ void plDynamicTextMap::SetFirstLineIndent( Int16 indent ) //// CalcWrappedStringSize //////////////////////////////////////////////////// -void plDynamicTextMap::CalcWrappedStringSize( const char *text, UInt16 *width, UInt16 *height, UInt32 *firstClippedChar, UInt16 *maxAscent, UInt16 *lastX, UInt16 *lastY ) +void plDynamicTextMap::CalcWrappedStringSize( const char *text, uint16_t *width, uint16_t *height, uint32_t *firstClippedChar, uint16_t *maxAscent, uint16_t *lastX, uint16_t *lastY ) { wchar_t *wText = hsStringToWString(text); CalcWrappedStringSize(wText,width,height,firstClippedChar,maxAscent,lastX,lastY); delete [] wText; } -void plDynamicTextMap::CalcWrappedStringSize( const wchar_t *text, UInt16 *width, UInt16 *height, UInt32 *firstClippedChar, UInt16 *maxAscent, UInt16 *lastX, UInt16 *lastY ) +void plDynamicTextMap::CalcWrappedStringSize( const wchar_t *text, uint16_t *width, uint16_t *height, uint32_t *firstClippedChar, uint16_t *maxAscent, uint16_t *lastX, uint16_t *lastY ) { // ===> Don't need to validate creation // if( !IIsValid() ) // return; SetJustify( fJustify ); - UInt16 w, h, a, lX, lY; - UInt32 firstClipped; + uint16_t w, h, a, lX, lY; + uint32_t firstClipped; fCurrFont->SetRenderWrapping( 0, 0, *width, *height ); fCurrFont->CalcStringExtents( text, w, h, a, firstClipped, lX, lY ); *width = w; @@ -655,22 +655,22 @@ void plDynamicTextMap::CalcWrappedStringSize( const wchar_t *text, UInt16 *wi //// FillRect ///////////////////////////////////////////////////////////////// -void plDynamicTextMap::FillRect( UInt16 x, UInt16 y, UInt16 width, UInt16 height, hsColorRGBA &color ) +void plDynamicTextMap::FillRect( uint16_t x, uint16_t y, uint16_t width, uint16_t height, hsColorRGBA &color ) { if( !IIsValid() ) return; if( x + width > fWidth ) - width = (UInt16)(fWidth - x); + width = (uint16_t)(fWidth - x); // Gee, how hard can it REALLY be? - UInt32 i, hex = color.ToARGB32(); + uint32_t i, hex = color.ToARGB32(); height += y; if( height > fHeight ) - height = (UInt16)fHeight; + height = (uint16_t)fHeight; for( ; y < height; y++ ) { - UInt32 *destPtr = GetAddr32( x, y ); + uint32_t *destPtr = GetAddr32( x, y ); for( i = 0; i < width; i++ ) destPtr[ i ] = hex; } @@ -678,19 +678,19 @@ void plDynamicTextMap::FillRect( UInt16 x, UInt16 y, UInt16 width, UInt16 hei //// FrameRect //////////////////////////////////////////////////////////////// -void plDynamicTextMap::FrameRect( UInt16 x, UInt16 y, UInt16 width, UInt16 height, hsColorRGBA &color ) +void plDynamicTextMap::FrameRect( uint16_t x, uint16_t y, uint16_t width, uint16_t height, hsColorRGBA &color ) { if( !IIsValid() ) return; if( x + width > fWidth ) - width = (UInt16)(fWidth - x); + width = (uint16_t)(fWidth - x); if( y + height > fHeight ) - height = (UInt16)(fHeight - y); + height = (uint16_t)(fHeight - y); // Shouldn't be much harder - UInt32 i, hex = color.ToARGB32(); - UInt32 *dest1, *dest2; + uint32_t i, hex = color.ToARGB32(); + uint32_t *dest1, *dest2; dest1 = GetAddr32( x, y ); dest2 = GetAddr32( x, y + height - 1 ); @@ -706,7 +706,7 @@ void plDynamicTextMap::FrameRect( UInt16 x, UInt16 y, UInt16 width, UInt16 he //// DrawImage //////////////////////////////////////////////////////////////// -void plDynamicTextMap::DrawImage( UInt16 x, UInt16 y, plMipmap *image, DrawMethods method ) +void plDynamicTextMap::DrawImage( uint16_t x, uint16_t y, plMipmap *image, DrawMethods method ) { if( !IIsValid() ) return; @@ -741,9 +741,9 @@ void plDynamicTextMap::DrawImage( UInt16 x, UInt16 y, plMipmap *image, DrawMe //// DrawClippedImage ///////////////////////////////////////////////////////// -void plDynamicTextMap::DrawClippedImage( UInt16 x, UInt16 y, plMipmap *image, - UInt16 srcClipX, UInt16 srcClipY, - UInt16 srcClipWidth, UInt16 srcClipHeight, +void plDynamicTextMap::DrawClippedImage( uint16_t x, uint16_t y, plMipmap *image, + uint16_t srcClipX, uint16_t srcClipY, + uint16_t srcClipWidth, uint16_t srcClipHeight, DrawMethods method ) { if( !IIsValid() ) @@ -825,7 +825,7 @@ hsBool plDynamicTextMap::MsgReceive( plMessage *msg ) SetTextColor( textMsg->fColor, textMsg->fBlockRGB ); if( (textMsg->fCmd & plDynamicTextMsg::kSetFont ) && textMsg->fString) - SetFont( textMsg->fString, textMsg->fX, (UInt8)(textMsg->fFlags) ); + SetFont( textMsg->fString, textMsg->fX, (uint8_t)(textMsg->fFlags) ); if( textMsg->fCmd & plDynamicTextMsg::kSetLineSpacing ) SetLineSpacing( textMsg->fLineSpacing ); @@ -912,8 +912,8 @@ void plDynamicTextMap::Swap( plDynamicTextMap *other ) SWAP_ME( Justify, fJustify, other->fJustify ); SWAP_ME( char *, fFontFace, other->fFontFace ); - SWAP_ME( UInt16, fFontSize, other->fFontSize ); - SWAP_ME( UInt8, fFontFlags, other->fFontFlags ); + SWAP_ME( uint16_t, fFontSize, other->fFontSize ); + SWAP_ME( uint8_t, fFontFlags, other->fFontFlags ); SWAP_ME( hsBool, fFontAntiAliasRGB, other->fFontAntiAliasRGB ); SWAP_ME( hsColorRGBA, fFontColor, other->fFontColor ); SWAP_ME( hsBool, fFontBlockRGB, other->fFontBlockRGB ); @@ -923,5 +923,5 @@ void plDynamicTextMap::Swap( plDynamicTextMap *other ) SWAP_ME( hsBool, fFontBlockRGB, other->fFontBlockRGB ); SWAP_ME( plFont *, fCurrFont, other->fCurrFont ); - SWAP_ME( UInt32 *, fInitBuffer, other->fInitBuffer ); + SWAP_ME( uint32_t *, fInitBuffer, other->fInitBuffer ); } diff --git a/Sources/Plasma/PubUtilLib/plGImage/plDynamicTextMap.h b/Sources/Plasma/PubUtilLib/plGImage/plDynamicTextMap.h index 859747cf..964a255f 100644 --- a/Sources/Plasma/PubUtilLib/plGImage/plDynamicTextMap.h +++ b/Sources/Plasma/PubUtilLib/plGImage/plDynamicTextMap.h @@ -91,10 +91,10 @@ class plDynamicTextMap : public plMipmap { protected: - UInt16 fVisWidth, fVisHeight; + uint16_t fVisWidth, fVisHeight; - virtual UInt32 Read( hsStream *s ); - virtual UInt32 Write( hsStream *s ); + virtual uint32_t Read( hsStream *s ); + virtual uint32_t Write( hsStream *s ); public: //// Public Flags //// @@ -113,22 +113,22 @@ class plDynamicTextMap : public plMipmap plDynamicTextMap(); - plDynamicTextMap( UInt32 width, UInt32 height, hsBool hasAlpha = false, UInt32 extraWidth = 0, UInt32 extraHeight = 0 ); + plDynamicTextMap( uint32_t width, uint32_t height, hsBool hasAlpha = false, uint32_t extraWidth = 0, uint32_t extraHeight = 0 ); virtual ~plDynamicTextMap(); CLASSNAME_REGISTER( plDynamicTextMap ); GETINTERFACE_ANY( plDynamicTextMap, plMipmap ); - void Create( UInt32 width, UInt32 height, hsBool hasAlpha, UInt32 extraWidth = 0, UInt32 extraHeight = 0 ); - void SetNoCreate( UInt32 width, UInt32 height, hsBool hasAlpha ); + void Create( uint32_t width, uint32_t height, hsBool hasAlpha, uint32_t extraWidth = 0, uint32_t extraHeight = 0 ); + void SetNoCreate( uint32_t width, uint32_t height, hsBool hasAlpha ); virtual void Reset( void ); virtual void Read( hsStream *s, hsResMgr *mgr ) { hsKeyedObject::Read( s, mgr ); this->Read( s ); } virtual void Write( hsStream *s, hsResMgr *mgr ) { hsKeyedObject::Write( s, mgr ); this->Write( s ); } - virtual UInt8 GetNumLevels( void ) const { return 1; } + virtual uint8_t GetNumLevels( void ) const { return 1; } virtual void Colorize( void ) { ; } virtual plMipmap *Clone( void ); @@ -152,27 +152,27 @@ class plDynamicTextMap : public plMipmap kFontShadowed = 0x04 }; - void SetFont( const char *face, UInt16 size, UInt8 fontFlags = 0, hsBool antiAliasRGB = true ); - void SetFont( const wchar_t *face, UInt16 size, UInt8 fontFlags = 0, hsBool antiAliasRGB = true ); - void SetLineSpacing( Int16 spacing ); + void SetFont( const char *face, uint16_t size, uint8_t fontFlags = 0, hsBool antiAliasRGB = true ); + void SetFont( const wchar_t *face, uint16_t size, uint8_t fontFlags = 0, hsBool antiAliasRGB = true ); + void SetLineSpacing( int16_t spacing ); void SetTextColor( hsColorRGBA &color, hsBool blockRGB = false ); void SetJustify( Justify j ); - void DrawString( UInt16 x, UInt16 y, const char *text ); - void DrawString( UInt16 x, UInt16 y, const wchar_t *text ); - void DrawClippedString( Int16 x, Int16 y, const char *text, UInt16 width, UInt16 height ); - void DrawClippedString( Int16 x, Int16 y, const wchar_t *text, UInt16 width, UInt16 height ); - void DrawClippedString( Int16 x, Int16 y, const char *text, UInt16 clipX, UInt16 clipY, UInt16 width, UInt16 height ); - void DrawClippedString( Int16 x, Int16 y, const wchar_t *text, UInt16 clipX, UInt16 clipY, UInt16 width, UInt16 height ); - void DrawWrappedString( UInt16 x, UInt16 y, const char *text, UInt16 width, UInt16 height, UInt16 *lastX = nil, UInt16 *lastY = nil ); - void DrawWrappedString( UInt16 x, UInt16 y, const wchar_t *text, UInt16 width, UInt16 height, UInt16 *lastX = nil, UInt16 *lastY = nil ); - UInt16 CalcStringWidth( const char *text, UInt16 *height = nil ); - UInt16 CalcStringWidth( const wchar_t *text, UInt16 *height = nil ); - void CalcWrappedStringSize( const char *text, UInt16 *width, UInt16 *height, UInt32 *firstClippedChar = nil, UInt16 *maxAscent = nil, UInt16 *lastX = nil, UInt16 *lastY = nil ); - void CalcWrappedStringSize( const wchar_t *text, UInt16 *width, UInt16 *height, UInt32 *firstClippedChar = nil, UInt16 *maxAscent = nil, UInt16 *lastX = nil, UInt16 *lastY = nil ); - void FillRect( UInt16 x, UInt16 y, UInt16 width, UInt16 height, hsColorRGBA &color ); - void FrameRect( UInt16 x, UInt16 y, UInt16 width, UInt16 height, hsColorRGBA &color ); - void SetFirstLineIndent( Int16 indent ); + void DrawString( uint16_t x, uint16_t y, const char *text ); + void DrawString( uint16_t x, uint16_t y, const wchar_t *text ); + void DrawClippedString( int16_t x, int16_t y, const char *text, uint16_t width, uint16_t height ); + void DrawClippedString( int16_t x, int16_t y, const wchar_t *text, uint16_t width, uint16_t height ); + void DrawClippedString( int16_t x, int16_t y, const char *text, uint16_t clipX, uint16_t clipY, uint16_t width, uint16_t height ); + void DrawClippedString( int16_t x, int16_t y, const wchar_t *text, uint16_t clipX, uint16_t clipY, uint16_t width, uint16_t height ); + void DrawWrappedString( uint16_t x, uint16_t y, const char *text, uint16_t width, uint16_t height, uint16_t *lastX = nil, uint16_t *lastY = nil ); + void DrawWrappedString( uint16_t x, uint16_t y, const wchar_t *text, uint16_t width, uint16_t height, uint16_t *lastX = nil, uint16_t *lastY = nil ); + uint16_t CalcStringWidth( const char *text, uint16_t *height = nil ); + uint16_t CalcStringWidth( const wchar_t *text, uint16_t *height = nil ); + void CalcWrappedStringSize( const char *text, uint16_t *width, uint16_t *height, uint32_t *firstClippedChar = nil, uint16_t *maxAscent = nil, uint16_t *lastX = nil, uint16_t *lastY = nil ); + void CalcWrappedStringSize( const wchar_t *text, uint16_t *width, uint16_t *height, uint32_t *firstClippedChar = nil, uint16_t *maxAscent = nil, uint16_t *lastX = nil, uint16_t *lastY = nil ); + void FillRect( uint16_t x, uint16_t y, uint16_t width, uint16_t height, hsColorRGBA &color ); + void FrameRect( uint16_t x, uint16_t y, uint16_t width, uint16_t height, hsColorRGBA &color ); + void SetFirstLineIndent( int16_t indent ); enum DrawMethods { @@ -180,16 +180,16 @@ class plDynamicTextMap : public plMipmap kImgBlend, // Blend color onto dest using src alpha, keep dest alpha kImgSprite // Copy color data and alphas }; - void DrawImage( UInt16 x, UInt16 y, plMipmap *image, DrawMethods method = kImgNoAlpha ); - void DrawClippedImage( UInt16 x, UInt16 y, plMipmap *image, UInt16 srcClipX, UInt16 srcClipY, - UInt16 srcClipWidth, UInt16 srcClipHeight, DrawMethods method = kImgNoAlpha ); + void DrawImage( uint16_t x, uint16_t y, plMipmap *image, DrawMethods method = kImgNoAlpha ); + void DrawClippedImage( uint16_t x, uint16_t y, plMipmap *image, uint16_t srcClipX, uint16_t srcClipY, + uint16_t srcClipWidth, uint16_t srcClipHeight, DrawMethods method = kImgNoAlpha ); void FlushToHost( void ); hsBool MsgReceive( plMessage *msg ); - UInt16 GetVisibleWidth( void ) { return fVisWidth; } - UInt16 GetVisibleHeight( void ) { return fVisHeight; } + uint16_t GetVisibleWidth( void ) { return fVisWidth; } + uint16_t GetVisibleHeight( void ) { return fVisHeight; } // Since the dynamic text can actually create a texture bigger than you were expecting, // you want to be able to apply a layer texture transform that will compensate. This @@ -197,16 +197,16 @@ class plDynamicTextMap : public plMipmap hsMatrix44 GetLayerTransform( void ); - void SetInitBuffer( UInt32 *buffer ); + void SetInitBuffer( uint32_t *buffer ); // Gets for font values Justify GetFontJustify( void ) const { return fJustify; } const char *GetFontFace( void ) const { return fFontFace; } - UInt16 GetFontSize( void ) const { return fFontSize; } + uint16_t GetFontSize( void ) const { return fFontSize; } hsBool GetFontAARGB( void ) const { return fFontAntiAliasRGB; } hsColorRGBA GetFontColor( void ) const { return fFontColor; } hsBool GetFontBlockRGB( void ) const { return fFontBlockRGB; } - Int16 GetLineSpacing( void ) const { return fLineSpacing; } + int16_t GetLineSpacing( void ) const { return fLineSpacing; } plFont *GetCurrFont( void ) const { return fCurrFont; } @@ -217,25 +217,25 @@ class plDynamicTextMap : public plMipmap //// Protected Members //// hsBool IIsValid( void ); - void IClearFromBuffer( UInt32 *clearBuffer ); + void IClearFromBuffer( uint32_t *clearBuffer ); - UInt32 *IAllocateOSSurface( UInt16 width, UInt16 height ); + uint32_t *IAllocateOSSurface( uint16_t width, uint16_t height ); void IDestroyOSSurface( void ); hsBool fHasAlpha, fShadowed; Justify fJustify; char *fFontFace; - UInt16 fFontSize; - UInt8 fFontFlags; + uint16_t fFontSize; + uint8_t fFontFlags; hsBool fFontAntiAliasRGB; hsColorRGBA fFontColor; hsBool fFontBlockRGB; - Int16 fLineSpacing; + int16_t fLineSpacing; plFont *fCurrFont; - UInt32 *fInitBuffer; + uint32_t *fInitBuffer; hsBool fHasCreateBeenCalled; }; diff --git a/Sources/Plasma/PubUtilLib/plGImage/plFont.cpp b/Sources/Plasma/PubUtilLib/plGImage/plFont.cpp index ff18c047..99a90f23 100644 --- a/Sources/Plasma/PubUtilLib/plGImage/plFont.cpp +++ b/Sources/Plasma/PubUtilLib/plGImage/plFont.cpp @@ -56,13 +56,13 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com //// Version History ////////////////////////////////////////////////////////// // // // 3.4.2003 mcn - Created. // -// 4.3.2003 mcn - Updated. Casting a char to a UInt16 sign-extends it if // -// the char is > 128, but casting it to an UInt8 first works.// +// 4.3.2003 mcn - Updated. Casting a char to a uint16_t sign-extends it if // +// the char is > 128, but casting it to an uint8_t first works.// // Ugly as sin, but hey, so are you. // // // /////////////////////////////////////////////////////////////////////////////// -#include "hsTypes.h" +#include "HeadSpin.h" #include "hsStlUtils.h" #include "plFont.h" @@ -145,7 +145,7 @@ void plFont::SetFace( const char *face ) strncpy( fFace, face, sizeof( fFace ) ); } -void plFont::SetSize( UInt8 size ) +void plFont::SetSize( uint8_t size ) { fSize = size; } @@ -166,24 +166,24 @@ void plFont::Write( hsStream *s, hsResMgr *mgr ) //// Rendering //////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////// -void plFont::SetRenderColor( UInt32 color ) +void plFont::SetRenderColor( uint32_t color ) { fRenderInfo.fColor = color; } -void plFont::SetRenderClipRect( Int16 x, Int16 y, Int16 width, Int16 height ) +void plFont::SetRenderClipRect( int16_t x, int16_t y, int16_t width, int16_t height ) { fRenderInfo.fClipRect.Set( x, y, width, height ); } -void plFont::SetRenderClipping( Int16 x, Int16 y, Int16 width, Int16 height ) +void plFont::SetRenderClipping( int16_t x, int16_t y, int16_t width, int16_t height ) { SetRenderFlag( kRenderWrap, false ); SetRenderFlag( kRenderClip, true ); SetRenderClipRect( x, y, width, height ); } -void plFont::SetRenderWrapping( Int16 x, Int16 y, Int16 width, Int16 height ) +void plFont::SetRenderWrapping( int16_t x, int16_t y, int16_t width, int16_t height ) { SetRenderFlag( kRenderWrap, true ); SetRenderFlag( kRenderClip, false ); @@ -192,7 +192,7 @@ void plFont::SetRenderWrapping( Int16 x, Int16 y, Int16 width, Int16 height ) void plFont::ICalcFontAscent( void ) { - UInt32 i; + uint32_t i; // Hack for now, only calc the ascent for characters in the 127 character ASCII range @@ -201,7 +201,7 @@ void plFont::ICalcFontAscent( void ) if( i + fFirstChar < 128 && fFontAscent < fCharacters[ i ].fBaseline ) fFontAscent = fCharacters[ i ].fBaseline; - Int32 descent = fCharacters[ i ].fHeight - fCharacters[ i ].fBaseline; + int32_t descent = fCharacters[ i ].fHeight - fCharacters[ i ].fBaseline; if( fFontDescent < descent ) fFontDescent = descent; @@ -231,7 +231,7 @@ static inline bool IIsDrawableWordBreak( const char c ) // The base render function. Additional options are specified externally, // so that their effects can be cached for optimization -void plFont::RenderString( plMipmap *mip, UInt16 x, UInt16 y, const char *string, UInt16 *lastX, UInt16 *lastY ) +void plFont::RenderString( plMipmap *mip, uint16_t x, uint16_t y, const char *string, uint16_t *lastX, uint16_t *lastY ) { // convert the char string to a wchar_t string wchar_t *wideString = hsStringToWString(string); @@ -240,7 +240,7 @@ void plFont::RenderString( plMipmap *mip, UInt16 x, UInt16 y, const char *str } -void plFont::RenderString( plMipmap *mip, UInt16 x, UInt16 y, const wchar_t *string, UInt16 *lastX, UInt16 *lastY ) +void plFont::RenderString( plMipmap *mip, uint16_t x, uint16_t y, const wchar_t *string, uint16_t *lastX, uint16_t *lastY ) { if( mip->IsCompressed() ) { @@ -255,13 +255,13 @@ void plFont::RenderString( plMipmap *mip, UInt16 x, UInt16 y, const wchar_t * *lastY = fRenderInfo.fLastY; } -void plFont::IRenderString( plMipmap *mip, UInt16 x, UInt16 y, const wchar_t *string, hsBool justCalc ) +void plFont::IRenderString( plMipmap *mip, uint16_t x, uint16_t y, const wchar_t *string, hsBool justCalc ) { fRenderInfo.fMipmap = mip; fRenderInfo.fX = x; fRenderInfo.fY = y; - fRenderInfo.fNumCols = (Int16)(( fBPP <= 8 ) ? ( ( fWidth * fBPP ) >> 3 ) : 0); - fRenderInfo.fFloatWidth = (hsScalar)fWidth; + fRenderInfo.fNumCols = (int16_t)(( fBPP <= 8 ) ? ( ( fWidth * fBPP ) >> 3 ) : 0); + fRenderInfo.fFloatWidth = (float)fWidth; fRenderInfo.fFarthestX = x; fRenderInfo.fMaxAscent = 0; fRenderInfo.fVolatileStringPtr = string; @@ -269,18 +269,18 @@ void plFont::IRenderString( plMipmap *mip, UInt16 x, UInt16 y, const wchar_t switch( fRenderInfo.fFlags & kRenderJustYMask ) { case kRenderJustYTop: - fRenderInfo.fY += (Int16)fFontAscent; + fRenderInfo.fY += (int16_t)fFontAscent; break; case kRenderJustYBottom: if( fRenderInfo.fFlags & ( kRenderClip | kRenderWrap ) ) - fRenderInfo.fY = (Int16)(fRenderInfo.fClipRect.GetBottom() - 1 - fMaxCharHeight + fFontAscent); + fRenderInfo.fY = (int16_t)(fRenderInfo.fClipRect.GetBottom() - 1 - fMaxCharHeight + fFontAscent); else - fRenderInfo.fY = (Int16)(mip->GetHeight() - 1 - fMaxCharHeight + fFontAscent); + fRenderInfo.fY = (int16_t)(mip->GetHeight() - 1 - fMaxCharHeight + fFontAscent); break; case kRenderJustYCenter: - fRenderInfo.fY = (Int16)(( fRenderInfo.fFlags & ( kRenderClip | kRenderWrap ) ) ? fRenderInfo.fClipRect.GetBottom() - 1 : mip->GetHeight() - 1); - fRenderInfo.fY = (Int16)(( fRenderInfo.fY - fMaxCharHeight ) >> 1); - fRenderInfo.fY += (Int16)fFontAscent; + fRenderInfo.fY = (int16_t)(( fRenderInfo.fFlags & ( kRenderClip | kRenderWrap ) ) ? fRenderInfo.fClipRect.GetBottom() - 1 : mip->GetHeight() - 1); + fRenderInfo.fY = (int16_t)(( fRenderInfo.fY - fMaxCharHeight ) >> 1); + fRenderInfo.fY += (int16_t)fFontAscent; break; default: // Just the baseline ; @@ -288,8 +288,8 @@ void plFont::IRenderString( plMipmap *mip, UInt16 x, UInt16 y, const wchar_t if( justCalc ) { - plCharacter &ch = fCharacters[ (UInt16)string[ 0 ] - fFirstChar ]; - fRenderInfo.fX = fRenderInfo.fFarthestX = x - (Int16)ch.fLeftKern; + plCharacter &ch = fCharacters[ (uint16_t)string[ 0 ] - fFirstChar ]; + fRenderInfo.fX = fRenderInfo.fFarthestX = x - (int16_t)ch.fLeftKern; if( fRenderInfo.fX < 0 ) fRenderInfo.fX = 0; } @@ -302,8 +302,8 @@ void plFont::IRenderString( plMipmap *mip, UInt16 x, UInt16 y, const wchar_t break; case kRenderJustXForceLeft: { -// plCharacter &ch = fCharacters[ (UInt16)(UInt8)string[ 0 ] - fFirstChar ]; -// Int32 newX = x - (Int16)ch.fLeftKern; +// plCharacter &ch = fCharacters[ (uint16_t)(uint8_t)string[ 0 ] - fFirstChar ]; +// int32_t newX = x - (int16_t)ch.fLeftKern; // if( newX < 0 ) // newX = 0; // fRenderInfo.fX = fRenderInfo.fFarthestX = newX; @@ -311,14 +311,14 @@ void plFont::IRenderString( plMipmap *mip, UInt16 x, UInt16 y, const wchar_t break; case kRenderJustXCenter: { - UInt16 right = (UInt16)(( fRenderInfo.fFlags & ( kRenderClip | kRenderWrap ) ) ? fRenderInfo.fClipRect.GetRight() : mip->GetWidth()); -// UInt16 width = CalcStringWidth( string ); + uint16_t right = (uint16_t)(( fRenderInfo.fFlags & ( kRenderClip | kRenderWrap ) ) ? fRenderInfo.fClipRect.GetRight() : mip->GetWidth()); +// uint16_t width = CalcStringWidth( string ); fRenderInfo.fX = fRenderInfo.fFarthestX = ( ( x + right ) >> 1 );// - ( width >> 1 ); } break; case kRenderJustXRight: { - UInt16 width = 0, right = (UInt16)(( fRenderInfo.fFlags & ( kRenderClip | kRenderWrap ) ) ? fRenderInfo.fClipRect.GetRight() : mip->GetWidth()); + uint16_t width = 0, right = (uint16_t)(( fRenderInfo.fFlags & ( kRenderClip | kRenderWrap ) ) ? fRenderInfo.fClipRect.GetRight() : mip->GetWidth()); /* if( fRenderInfo.fFlags & kRenderClip ) { fRenderInfo.fFlags &= ~kRenderClip; @@ -366,43 +366,43 @@ void plFont::IRenderString( plMipmap *mip, UInt16 x, UInt16 y, const wchar_t { fRenderInfo.fDestStride = mip->GetRowBytes(); fRenderInfo.fDestBPP = mip->GetPixelSize() >> 3; - fRenderInfo.fDestPtr = (UInt8 *)mip->GetImage(); + fRenderInfo.fDestPtr = (uint8_t *)mip->GetImage(); fRenderInfo.fDestPtr += fRenderInfo.fY * fRenderInfo.fDestStride; fRenderInfo.fDestPtr += fRenderInfo.fX * fRenderInfo.fDestBPP; } if( fRenderInfo.fFlags & ( kRenderWrap | kRenderClip ) ) { - fRenderInfo.fMaxHeight = (Int16)( fRenderInfo.fClipRect.GetBottom() - fRenderInfo.fY ); - fRenderInfo.fMaxWidth = (Int16)( fRenderInfo.fClipRect.GetRight() - x ); + fRenderInfo.fMaxHeight = (int16_t)( fRenderInfo.fClipRect.GetBottom() - fRenderInfo.fY ); + fRenderInfo.fMaxWidth = (int16_t)( fRenderInfo.fClipRect.GetRight() - x ); } else if( justCalc ) { // Just calculating, no wrapping, so the max is as far as we can go // Note: 32767 isn't quite right, since we'll be adding the left kern in before we // calc the first character, so adjust so we make sure we don't underflow - plCharacter &ch = fCharacters[ (UInt16)(UInt8)string[ 0 ] - fFirstChar ]; + plCharacter &ch = fCharacters[ (uint16_t)(uint8_t)string[ 0 ] - fFirstChar ]; - fRenderInfo.fMaxHeight = (Int16)fMaxCharHeight; - fRenderInfo.fMaxWidth = (Int16)32767 + (Int16)ch.fLeftKern; + fRenderInfo.fMaxHeight = (int16_t)fMaxCharHeight; + fRenderInfo.fMaxWidth = (int16_t)32767 + (int16_t)ch.fLeftKern; } else { - fRenderInfo.fMaxHeight = (Int16)( mip->GetHeight() - fRenderInfo.fY ); - fRenderInfo.fMaxWidth = (Int16)( mip->GetWidth() - x ); + fRenderInfo.fMaxHeight = (int16_t)( mip->GetHeight() - fRenderInfo.fY ); + fRenderInfo.fMaxWidth = (int16_t)( mip->GetWidth() - x ); } fRenderInfo.fMaxDescent = 0; if( fRenderInfo.fFlags & kRenderWrap ) { - // Hell, gotta word wrap the text - // To avoid backtracking, we step forward in the string one word at a time until we hit a break, + // Hell, gotta uint16_t wrap the text + // To avoid backtracking, we step forward in the string one uint16_t at a time until we hit a break, // then render what we have and continue - Int32 lastWord = 0, i; + int32_t lastWord = 0, i; bool isFirstLine = true; x = 0; - Int16 firstMaxAscent = 0; - UInt32 lineHt, lineDelta; + int16_t firstMaxAscent = 0; + uint32_t lineHt, lineDelta; if( fRenderInfo.fFlags & kRenderScaleAA ) lineHt = fMaxCharHeight >> 1; else @@ -415,9 +415,9 @@ void plFont::IRenderString( plMipmap *mip, UInt16 x, UInt16 y, const wchar_t while( *string != 0 && fRenderInfo.fMaxHeight >= fFontDescent ) { - UInt8 *destStartPtr = fRenderInfo.fDestPtr; - UInt32 destStartX = fRenderInfo.fX; - Int16 destMaxWidth = fRenderInfo.fMaxWidth, thisIndent = 0; + uint8_t *destStartPtr = fRenderInfo.fDestPtr; + uint32_t destStartX = fRenderInfo.fX; + int16_t destMaxWidth = fRenderInfo.fMaxWidth, thisIndent = 0; if( isFirstLine ) { @@ -429,9 +429,9 @@ void plFont::IRenderString( plMipmap *mip, UInt16 x, UInt16 y, const wchar_t isFirstLine = false; } - std::string ellipsisTracker = ""; // keeps track of ellipsis, since there are three word break chars that can't be split + std::string ellipsisTracker = ""; // keeps track of ellipsis, since there are three uint16_t break chars that can't be split bool possibleEllipsis = false; - int preEllipsisLastWord = 0; // where the word break was before we started tracking an ellipsis + int preEllipsisLastWord = 0; // where the uint16_t break was before we started tracking an ellipsis // Iterate through the string, looking for the next line break for( lastWord = 0, i = 0; string[ i ] != 0; i++ ) @@ -445,12 +445,12 @@ void plFont::IRenderString( plMipmap *mip, UInt16 x, UInt16 y, const wchar_t // handle invalid chars discretely plCharacter* charToDraw = NULL; - if (fCharacters.Count() <= ((UInt16)string[i] - fFirstChar)) - charToDraw = &(fCharacters[(UInt16)L' ' - fFirstChar]); + if (fCharacters.Count() <= ((uint16_t)string[i] - fFirstChar)) + charToDraw = &(fCharacters[(uint16_t)L' ' - fFirstChar]); else - charToDraw = &(fCharacters[(UInt16)string[i] - fFirstChar]); + charToDraw = &(fCharacters[(uint16_t)string[i] - fFirstChar]); - Int16 leftKern = (Int16)charToDraw->fLeftKern; + int16_t leftKern = (int16_t)charToDraw->fLeftKern; if( fRenderInfo.fFlags & kRenderScaleAA ) x += leftKern / 2; else @@ -459,11 +459,11 @@ void plFont::IRenderString( plMipmap *mip, UInt16 x, UInt16 y, const wchar_t // Update our position and see if we're over // Note that our wrapping is slightly off, in that it doesn't take into account // the left kerning of characters. Hopefully that won't matter much... - UInt16 charWidth = (UInt16)(fWidth + (Int16)charToDraw->fRightKern); + uint16_t charWidth = (uint16_t)(fWidth + (int16_t)charToDraw->fRightKern); if( fRenderInfo.fFlags & kRenderScaleAA ) charWidth >>= 1; - UInt16 nonAdjustedX = (UInt16)(x + fWidth); // just in case the actual bitmap is too big to fit on page and we think the character can (because of right kern) + uint16_t nonAdjustedX = (uint16_t)(x + fWidth); // just in case the actual bitmap is too big to fit on page and we think the character can (because of right kern) x += charWidth; if(( x >= fRenderInfo.fMaxWidth ) || (nonAdjustedX >= fRenderInfo.fMaxWidth)) @@ -492,7 +492,7 @@ void plFont::IRenderString( plMipmap *mip, UInt16 x, UInt16 y, const wchar_t break; } - // Are we a word breaker? + // Are we a uint16_t breaker? if( IIsWordBreaker( (char)(string[ i ]) ) ) { if (string[i] == '.') // we might have an ellipsis here @@ -512,7 +512,7 @@ void plFont::IRenderString( plMipmap *mip, UInt16 x, UInt16 y, const wchar_t ellipsisTracker = ""; // no chance of an ellipsis, so kill it possibleEllipsis = false; } - // Yes, and we didn't go over, so store as the last successfully fit word and move on + // Yes, and we didn't go over, so store as the last successfully fit uint16_t and move on lastWord = i; } } @@ -520,7 +520,7 @@ void plFont::IRenderString( plMipmap *mip, UInt16 x, UInt16 y, const wchar_t if( string[ i ] == 0 ) lastWord = i; // Final catch for end-of-string else if( lastWord == 0 && string[ i ] != L'\n' && thisIndent == 0 ) - lastWord = i; // Catch for a single word that didn't fit (just go up as many chars as we can) + lastWord = i; // Catch for a single uint16_t that didn't fit (just go up as many chars as we can) // (but NOT if we have a first line indent, mind you :) // Got to the end of a line (somewhere), so render up to lastWord, then advance from that point @@ -532,8 +532,8 @@ void plFont::IRenderString( plMipmap *mip, UInt16 x, UInt16 y, const wchar_t lastWord++; // make sure we draw it if( ( fRenderInfo.fFlags & kRenderJustXMask ) == kRenderJustXRight ) { - UInt16 baseX = fRenderInfo.fX, baseMaxW = fRenderInfo.fMaxWidth; - UInt8 *baseDestPtr = fRenderInfo.fDestPtr; + uint16_t baseX = fRenderInfo.fX, baseMaxW = fRenderInfo.fMaxWidth; + uint8_t *baseDestPtr = fRenderInfo.fDestPtr; fRenderInfo.fX = 0; CharRenderFunc oldFunc = fRenderInfo.fRenderFunc; @@ -554,8 +554,8 @@ void plFont::IRenderString( plMipmap *mip, UInt16 x, UInt16 y, const wchar_t } else if( ( fRenderInfo.fFlags & kRenderJustXMask ) == kRenderJustXCenter ) { - UInt16 baseX = fRenderInfo.fX, baseMaxW = fRenderInfo.fMaxWidth; - UInt8 *baseDestPtr = fRenderInfo.fDestPtr; + uint16_t baseX = fRenderInfo.fX, baseMaxW = fRenderInfo.fMaxWidth; + uint8_t *baseDestPtr = fRenderInfo.fDestPtr; fRenderInfo.fX = 0; CharRenderFunc oldFunc = fRenderInfo.fRenderFunc; @@ -576,12 +576,12 @@ void plFont::IRenderString( plMipmap *mip, UInt16 x, UInt16 y, const wchar_t } else if( ( fRenderInfo.fFlags & kRenderJustXMask ) == kRenderJustXForceLeft ) { - Int16 baseX = fRenderInfo.fX; + int16_t baseX = fRenderInfo.fX; - plCharacter &ch = fCharacters[ (UInt16)string[ 0 ] - fFirstChar ]; + plCharacter &ch = fCharacters[ (uint16_t)string[ 0 ] - fFirstChar ]; - fRenderInfo.fX -= (Int16)ch.fLeftKern; - fRenderInfo.fDestPtr -= (Int16)ch.fLeftKern * fRenderInfo.fDestBPP; + fRenderInfo.fX -= (int16_t)ch.fLeftKern; + fRenderInfo.fDestPtr -= (int16_t)ch.fLeftKern * fRenderInfo.fDestBPP; IRenderLoop( string, lastWord ); @@ -608,7 +608,7 @@ void plFont::IRenderString( plMipmap *mip, UInt16 x, UInt16 y, const wchar_t firstMaxAscent = fRenderInfo.fMaxAscent; x = 0; - fRenderInfo.fX = (Int16)destStartX; + fRenderInfo.fX = (int16_t)destStartX; fRenderInfo.fDestPtr = destStartPtr; fRenderInfo.fMaxWidth = destMaxWidth; fRenderInfo.fMaxAscent = 0; @@ -618,8 +618,8 @@ void plFont::IRenderString( plMipmap *mip, UInt16 x, UInt16 y, const wchar_t // Advance down if( string[ i ] != 0 ) { - fRenderInfo.fY += (Int16)lineHt; - fRenderInfo.fMaxHeight -= (Int16)lineHt; + fRenderInfo.fY += (int16_t)lineHt; + fRenderInfo.fMaxHeight -= (int16_t)lineHt; fRenderInfo.fDestPtr += lineDelta; fRenderInfo.fLastX = fRenderInfo.fX; fRenderInfo.fLastY = fRenderInfo.fY; @@ -635,8 +635,8 @@ void plFont::IRenderString( plMipmap *mip, UInt16 x, UInt16 y, const wchar_t if( i > lastWord && string[ i ] == L'\n' ) { // Advance down - fRenderInfo.fY += (Int16)lineHt; - fRenderInfo.fMaxHeight -= (Int16)lineHt; + fRenderInfo.fY += (int16_t)lineHt; + fRenderInfo.fMaxHeight -= (int16_t)lineHt; fRenderInfo.fDestPtr += lineDelta; fRenderInfo.fLastY = fRenderInfo.fY; } @@ -648,7 +648,7 @@ void plFont::IRenderString( plMipmap *mip, UInt16 x, UInt16 y, const wchar_t fRenderInfo.fMaxAscent = firstMaxAscent; // Final y offset from the last line - fRenderInfo.fY += (Int16)fFontDescent; + fRenderInfo.fY += (int16_t)fFontDescent; fRenderInfo.fVolatileStringPtr = string; } @@ -671,11 +671,11 @@ void plFont::IRenderString( plMipmap *mip, UInt16 x, UInt16 y, const wchar_t if( ( fRenderInfo.fFlags & kRenderJustXMask ) == kRenderJustXForceLeft ) { // See note at top of file - plCharacter &ch = fCharacters[ (UInt16)string[ 0 ] - fFirstChar ]; - Int32 newX = x - (Int16)ch.fLeftKern; + plCharacter &ch = fCharacters[ (uint16_t)string[ 0 ] - fFirstChar ]; + int32_t newX = x - (int16_t)ch.fLeftKern; if( newX < 0 ) newX = 0; - fRenderInfo.fX = fRenderInfo.fFarthestX = (Int16)newX; + fRenderInfo.fX = fRenderInfo.fFarthestX = (int16_t)newX; } fRenderInfo.fVolatileStringPtr = string; // Just so we can keep track of when we clip @@ -684,12 +684,12 @@ void plFont::IRenderString( plMipmap *mip, UInt16 x, UInt16 y, const wchar_t } } -void plFont::IRenderLoop( const wchar_t *string, Int32 maxCount ) +void plFont::IRenderLoop( const wchar_t *string, int32_t maxCount ) { // Render the string straight across, one char at a time while( *string != 0 && maxCount != 0 ) // Note: if maxCount starts out -1, then it'll just keep { // decrementing...well ok, not for forever, but pretty close - UInt16 c = (UInt16)*string; + uint16_t c = (uint16_t)*string; if( c < fFirstChar ) ; // Invalid char else @@ -700,7 +700,7 @@ void plFont::IRenderLoop( const wchar_t *string, Int32 maxCount ) else { // First pass at supporting left kerning values, but only at the pixel level - Int16 leftKern = (Int16)fCharacters[ c ].fLeftKern; + int16_t leftKern = (int16_t)fCharacters[ c ].fLeftKern; if( leftKern != 0 ) { if( fRenderInfo.fFlags & kRenderScaleAA ) @@ -711,7 +711,7 @@ void plFont::IRenderLoop( const wchar_t *string, Int32 maxCount ) fRenderInfo.fDestPtr += leftKern * fRenderInfo.fDestBPP; } - UInt16 thisWidth = (UInt16)(fWidth + fCharacters[ c ].fRightKern); + uint16_t thisWidth = (uint16_t)(fWidth + fCharacters[ c ].fRightKern); if( fRenderInfo.fFlags & kRenderScaleAA ) thisWidth >>= 1; @@ -725,14 +725,14 @@ void plFont::IRenderLoop( const wchar_t *string, Int32 maxCount ) fRenderInfo.fDestPtr += thisWidth * fRenderInfo.fDestBPP; - Int16 baseline = (Int16)(fCharacters[ c ].fBaseline); + int16_t baseline = (int16_t)(fCharacters[ c ].fBaseline); if( fRenderInfo.fFlags & kRenderScaleAA ) baseline >>= 1; if( baseline > fRenderInfo.fMaxAscent ) fRenderInfo.fMaxAscent = baseline; - Int16 thisHt = (Int16)(fCharacters[ c ].fHeight - baseline); + int16_t thisHt = (int16_t)(fCharacters[ c ].fHeight - baseline); if( fRenderInfo.fMaxDescent < thisHt ) fRenderInfo.fMaxDescent = thisHt; } @@ -748,12 +748,12 @@ void plFont::IRenderLoop( const wchar_t *string, Int32 maxCount ) void plFont::IRenderChar1To32( const plFont::plCharacter &c ) { - UInt8 bitMask, *src = fBMapData + c.fBitmapOff; - UInt32 *destPtr, *destBasePtr = (UInt32 *)( fRenderInfo.fDestPtr - c.fBaseline * fRenderInfo.fDestStride ); - UInt16 x, y; + uint8_t bitMask, *src = fBMapData + c.fBitmapOff; + uint32_t *destPtr, *destBasePtr = (uint32_t *)( fRenderInfo.fDestPtr - c.fBaseline * fRenderInfo.fDestStride ); + uint16_t x, y; - if( (Int32)c.fHeight - (Int32)c.fBaseline >= fRenderInfo.fMaxHeight || c.fBaseline > fRenderInfo.fY ) + if( (int32_t)c.fHeight - (int32_t)c.fBaseline >= fRenderInfo.fMaxHeight || c.fBaseline > fRenderInfo.fY ) return; for( y = 0; y < c.fHeight; y++ ) @@ -775,18 +775,18 @@ void plFont::IRenderChar1To32( const plFont::plCharacter &c ) } src++; } - destBasePtr = (UInt32 *)( (UInt8 *)destBasePtr + fRenderInfo.fDestStride ); + destBasePtr = (uint32_t *)( (uint8_t *)destBasePtr + fRenderInfo.fDestStride ); } } void plFont::IRenderChar1To32AA( const plFont::plCharacter &c ) { - UInt8 bitMask, *src = fBMapData + c.fBitmapOff; - UInt32 *destPtr, *destBasePtr = (UInt32 *)( fRenderInfo.fDestPtr - ( c.fBaseline >> 1 ) * fRenderInfo.fDestStride ); - UInt16 x, y; + uint8_t bitMask, *src = fBMapData + c.fBitmapOff; + uint32_t *destPtr, *destBasePtr = (uint32_t *)( fRenderInfo.fDestPtr - ( c.fBaseline >> 1 ) * fRenderInfo.fDestStride ); + uint16_t x, y; - if( ( ( (Int32)c.fHeight - (Int32)c.fBaseline ) >> 1 ) >= fRenderInfo.fMaxHeight || ( c.fBaseline >> 1 ) > fRenderInfo.fY ) + if( ( ( (int32_t)c.fHeight - (int32_t)c.fBaseline ) >> 1 ) >= fRenderInfo.fMaxHeight || ( c.fBaseline >> 1 ) > fRenderInfo.fY ) return; for( y = 0; y < c.fHeight; y += 2 ) @@ -803,7 +803,7 @@ void plFont::IRenderChar1To32AA( const plFont::plCharacter &c ) for( bitMask = 0x80; bitMask != 0; bitMask >>= 2 ) { // Grab 4 bits and do 4-to-1 AA - UInt8 value = ( *src & bitMask ) ? 1 : 0; + uint8_t value = ( *src & bitMask ) ? 1 : 0; value += ( *src & ( bitMask >> 1 ) ) ? 1 : 0; value += ( src[ fRenderInfo.fNumCols ] & bitMask ) ? 1 : 0; value += ( src[ fRenderInfo.fNumCols ] & ( bitMask >> 1 ) ) ? 1 : 0; @@ -812,22 +812,22 @@ void plFont::IRenderChar1To32AA( const plFont::plCharacter &c ) { case 1: { - UInt32 src = ( fRenderInfo.fColor >> 2 ) & 0x3f3f3f3f; - UInt32 dst = ( (*destPtr) >> 2 ) & 0x3f3f3f3f; + uint32_t src = ( fRenderInfo.fColor >> 2 ) & 0x3f3f3f3f; + uint32_t dst = ( (*destPtr) >> 2 ) & 0x3f3f3f3f; *destPtr = src + dst + dst + dst; break; } case 2: { - UInt32 src = ( fRenderInfo.fColor >> 1 ) & 0x7f7f7f7f; - UInt32 dst = ( (*destPtr) >> 1 ) & 0x7f7f7f7f; + uint32_t src = ( fRenderInfo.fColor >> 1 ) & 0x7f7f7f7f; + uint32_t dst = ( (*destPtr) >> 1 ) & 0x7f7f7f7f; *destPtr = src + dst; break; } case 3: { - UInt32 src = ( fRenderInfo.fColor >> 2 ) & 0x3f3f3f3f; - UInt32 dst = ( (*destPtr) >> 2 ) & 0x3f3f3f3f; + uint32_t src = ( fRenderInfo.fColor >> 2 ) & 0x3f3f3f3f; + uint32_t dst = ( (*destPtr) >> 2 ) & 0x3f3f3f3f; *destPtr = src + src + src + dst; break; } @@ -839,18 +839,18 @@ void plFont::IRenderChar1To32AA( const plFont::plCharacter &c ) } src++; } - destBasePtr = (UInt32 *)( (UInt8 *)destBasePtr + fRenderInfo.fDestStride ); + destBasePtr = (uint32_t *)( (uint8_t *)destBasePtr + fRenderInfo.fDestStride ); src += fRenderInfo.fNumCols; } } void plFont::IRenderChar8To32( const plFont::plCharacter &c ) { - UInt8 *src = fBMapData + c.fBitmapOff; - UInt32 *destPtr, *destBasePtr = (UInt32 *)( fRenderInfo.fDestPtr - c.fBaseline * fRenderInfo.fDestStride ); - UInt16 x, y; - UInt32 srcAlpha, oneMinusAlpha, r, g, b, dR, dG, dB, destAlpha, thisWidth; - UInt8 srcR, srcG, srcB; + uint8_t *src = fBMapData + c.fBitmapOff; + uint32_t *destPtr, *destBasePtr = (uint32_t *)( fRenderInfo.fDestPtr - c.fBaseline * fRenderInfo.fDestStride ); + uint16_t x, y; + uint32_t srcAlpha, oneMinusAlpha, r, g, b, dR, dG, dB, destAlpha, thisWidth; + uint8_t srcR, srcG, srcB; // Unfortunately for some fonts, their right kern value actually is @@ -860,14 +860,14 @@ void plFont::IRenderChar8To32( const plFont::plCharacter &c ) // difference, especially since the dest pixels that we end up overlapping // should already be in the cache. If it does, time to upgrade the font // format (again) - thisWidth = fWidth;// + (Int32)c.fRightKern; + thisWidth = fWidth;// + (int32_t)c.fRightKern; - if( (Int32)c.fHeight - (Int32)c.fBaseline >= fRenderInfo.fMaxHeight || thisWidth >= fRenderInfo.fMaxWidth || c.fBaseline > fRenderInfo.fY ) + if( (int32_t)c.fHeight - (int32_t)c.fBaseline >= fRenderInfo.fMaxHeight || thisWidth >= fRenderInfo.fMaxWidth || c.fBaseline > fRenderInfo.fY ) return; - srcR = (UInt8)(( fRenderInfo.fColor >> 16 ) & 0x000000ff); - srcG = (UInt8)(( fRenderInfo.fColor >> 8 ) & 0x000000ff); - srcB = (UInt8)(( fRenderInfo.fColor ) & 0x000000ff); + srcR = (uint8_t)(( fRenderInfo.fColor >> 16 ) & 0x000000ff); + srcG = (uint8_t)(( fRenderInfo.fColor >> 8 ) & 0x000000ff); + srcB = (uint8_t)(( fRenderInfo.fColor ) & 0x000000ff); for( y = 0; y < c.fHeight; y++ ) { @@ -898,17 +898,17 @@ void plFont::IRenderChar8To32( const plFont::plCharacter &c ) destPtr[ x ] = ( ( r + dR ) << 16 ) | ( ( g + dG ) << 8 ) | ( b + dB ) | destAlpha; } } - destBasePtr = (UInt32 *)( (UInt8 *)destBasePtr + fRenderInfo.fDestStride ); + destBasePtr = (uint32_t *)( (uint8_t *)destBasePtr + fRenderInfo.fDestStride ); src += fWidth; } } void plFont::IRenderChar8To32FullAlpha( const plFont::plCharacter &c ) { - UInt8 *src = fBMapData + c.fBitmapOff; - UInt32 *destPtr, *destBasePtr = (UInt32 *)( fRenderInfo.fDestPtr - c.fBaseline * fRenderInfo.fDestStride ); - UInt16 x, y; - UInt32 destColorOnly, thisWidth; + uint8_t *src = fBMapData + c.fBitmapOff; + uint32_t *destPtr, *destBasePtr = (uint32_t *)( fRenderInfo.fDestPtr - c.fBaseline * fRenderInfo.fDestStride ); + uint16_t x, y; + uint32_t destColorOnly, thisWidth; // Unfortunately for some fonts, their right kern value actually is @@ -918,9 +918,9 @@ void plFont::IRenderChar8To32FullAlpha( const plFont::plCharacter &c ) // difference, especially since the dest pixels that we end up overlapping // should already be in the cache. If it does, time to upgrade the font // format (again) - thisWidth = fWidth;// + (Int32)c.fRightKern; + thisWidth = fWidth;// + (int32_t)c.fRightKern; - if( (Int32)c.fHeight - (Int32)c.fBaseline >= fRenderInfo.fMaxHeight || thisWidth >= fRenderInfo.fMaxWidth || c.fBaseline > fRenderInfo.fY ) + if( (int32_t)c.fHeight - (int32_t)c.fBaseline >= fRenderInfo.fMaxHeight || thisWidth >= fRenderInfo.fMaxWidth || c.fBaseline > fRenderInfo.fY ) return; destColorOnly = fRenderInfo.fColor & 0x00ffffff; @@ -933,17 +933,17 @@ void plFont::IRenderChar8To32FullAlpha( const plFont::plCharacter &c ) if( src[ x ] != 0 ) destPtr[ x ] = ( src[ x ] << 24 ) | destColorOnly; } - destBasePtr = (UInt32 *)( (UInt8 *)destBasePtr + fRenderInfo.fDestStride ); + destBasePtr = (uint32_t *)( (uint8_t *)destBasePtr + fRenderInfo.fDestStride ); src += fWidth; } } void plFont::IRenderChar8To32Alpha( const plFont::plCharacter &c ) { - UInt8 val, *src = fBMapData + c.fBitmapOff; - UInt32 *destPtr, *destBasePtr = (UInt32 *)( fRenderInfo.fDestPtr - c.fBaseline * fRenderInfo.fDestStride ); - UInt16 x, y; - UInt32 destColorOnly, alphaMult, fullAlpha, thisWidth; + uint8_t val, *src = fBMapData + c.fBitmapOff; + uint32_t *destPtr, *destBasePtr = (uint32_t *)( fRenderInfo.fDestPtr - c.fBaseline * fRenderInfo.fDestStride ); + uint16_t x, y; + uint32_t destColorOnly, alphaMult, fullAlpha, thisWidth; // Unfortunately for some fonts, their right kern value actually is @@ -953,9 +953,9 @@ void plFont::IRenderChar8To32Alpha( const plFont::plCharacter &c ) // difference, especially since the dest pixels that we end up overlapping // should already be in the cache. If it does, time to upgrade the font // format (again) - thisWidth = fWidth;// + (Int32)c.fRightKern; + thisWidth = fWidth;// + (int32_t)c.fRightKern; - if( (Int32)c.fHeight - (Int32)c.fBaseline >= fRenderInfo.fMaxHeight || thisWidth >= fRenderInfo.fMaxWidth || c.fBaseline > fRenderInfo.fY ) + if( (int32_t)c.fHeight - (int32_t)c.fBaseline >= fRenderInfo.fMaxHeight || thisWidth >= fRenderInfo.fMaxWidth || c.fBaseline > fRenderInfo.fY ) return; destColorOnly = fRenderInfo.fColor & 0x00ffffff; @@ -977,7 +977,7 @@ void plFont::IRenderChar8To32Alpha( const plFont::plCharacter &c ) destPtr[ x ] = ( ( alphaMult * val ) & 0xff000000 ) | destColorOnly; } } - destBasePtr = (UInt32 *)( (UInt8 *)destBasePtr + fRenderInfo.fDestStride ); + destBasePtr = (uint32_t *)( (uint8_t *)destBasePtr + fRenderInfo.fDestStride ); src += fWidth; } } @@ -989,23 +989,23 @@ void plFont::IRenderCharNull( const plCharacter &c ) //// CalcString Variations //////////////////////////////////////////////////// -UInt16 plFont::CalcStringWidth( const char *string ) +uint16_t plFont::CalcStringWidth( const char *string ) { - UInt16 w, h, a, lX, lY; - UInt32 s; + uint16_t w, h, a, lX, lY; + uint32_t s; CalcStringExtents( string, w, h, a, s, lX, lY ); return w; } -UInt16 plFont::CalcStringWidth( const wchar_t *string ) +uint16_t plFont::CalcStringWidth( const wchar_t *string ) { - UInt16 w, h, a, lX, lY; - UInt32 s; + uint16_t w, h, a, lX, lY; + uint32_t s; CalcStringExtents( string, w, h, a, s, lX, lY ); return w; } -void plFont::CalcStringExtents( const char *string, UInt16 &width, UInt16 &height, UInt16 &ascent, UInt32 &firstClippedChar, UInt16 &lastX, UInt16 &lastY ) +void plFont::CalcStringExtents( const char *string, uint16_t &width, uint16_t &height, uint16_t &ascent, uint32_t &firstClippedChar, uint16_t &lastX, uint16_t &lastY ) { // convert the char string to a wchar_t string wchar_t *wideString = hsStringToWString(string); @@ -1013,18 +1013,18 @@ void plFont::CalcStringExtents( const char *string, UInt16 &width, UInt16 &he delete [] wideString; } -void plFont::CalcStringExtents( const wchar_t *string, UInt16 &width, UInt16 &height, UInt16 &ascent, UInt32 &firstClippedChar, UInt16 &lastX, UInt16 &lastY ) +void plFont::CalcStringExtents( const wchar_t *string, uint16_t &width, uint16_t &height, uint16_t &ascent, uint32_t &firstClippedChar, uint16_t &lastX, uint16_t &lastY ) { IRenderString( nil, 0, 0, string, true ); width = fRenderInfo.fFarthestX; - height = (UInt16)(fRenderInfo.fY + fFontDescent);//fRenderInfo.fMaxDescent; + height = (uint16_t)(fRenderInfo.fY + fFontDescent);//fRenderInfo.fMaxDescent; ascent = fRenderInfo.fMaxAscent; lastX = fRenderInfo.fLastX; lastY = fRenderInfo.fLastY; // firstClippedChar is an index into the given string that points to the start of the part of the string // that got clipped (i.e. not rendered). - firstClippedChar = (unsigned_ptr)fRenderInfo.fVolatileStringPtr - (unsigned_ptr)string; + firstClippedChar = (uintptr_t)fRenderInfo.fVolatileStringPtr - (uintptr_t)string; firstClippedChar /= 2; // divide by 2 because a wchar_t is two bytes wide, instead of one (like a char) } @@ -1033,15 +1033,15 @@ void plFont::CalcStringExtents( const wchar_t *string, UInt16 &width, UInt16 // the first free space in our allocated font bitmap, based on the heights // and offsets of all the current characters -UInt8 *plFont::IGetFreeCharData( UInt32 &newOffset ) +uint8_t *plFont::IGetFreeCharData( uint32_t &newOffset ) { - Int32 i; + int32_t i; newOffset = 0; for( i = fCharacters.GetCount() - 1; i >= 0; i-- ) { - UInt32 thisOff = fCharacters[ i ].fBitmapOff + ( ( fCharacters[ i ].fHeight * fWidth * fBPP ) >> 3 ); + uint32_t thisOff = fCharacters[ i ].fBitmapOff + ( ( fCharacters[ i ].fHeight * fWidth * fBPP ) >> 3 ); if( newOffset < thisOff ) { newOffset = thisOff; @@ -1096,33 +1096,33 @@ hsBool plFont::LoadFromFNTStream( hsStream *stream ) // Note: hsUNIXStreams just happen to store in the same endian as Windows... struct FNTInfo { - UInt16 version; - UInt32 size; + uint16_t version; + uint32_t size; char copyright[ 60 ]; - UInt16 type; - UInt16 points; - UInt16 vertRes; - UInt16 horzRes; - UInt16 ascent; - UInt16 internalLeading; - UInt16 externalLeading; - UInt8 italic, underline, strikeout; - UInt16 weight; - UInt8 charSet; - UInt16 pixWidth; // 0 means variable width chars - UInt16 pixHeight; - UInt8 pitchFamily; - UInt16 avgWidth; - UInt16 maxWidth; - UInt8 firstChar, lastChar, defaultChar, breakChar; - UInt16 widthBytes; - UInt32 device, face; - UInt32 bitsPointer, bitsOffset; - UInt8 reserved; - UInt32 flags; - UInt16 aSpace, bSpace, cSpace; - UInt32 colorPointer; - UInt8 reserved1[ 16 ]; + uint16_t type; + uint16_t points; + uint16_t vertRes; + uint16_t horzRes; + uint16_t ascent; + uint16_t internalLeading; + uint16_t externalLeading; + uint8_t italic, underline, strikeout; + uint16_t weight; + uint8_t charSet; + uint16_t pixWidth; // 0 means variable width chars + uint16_t pixHeight; + uint8_t pitchFamily; + uint16_t avgWidth; + uint16_t maxWidth; + uint8_t firstChar, lastChar, defaultChar, breakChar; + uint16_t widthBytes; + uint32_t device, face; + uint32_t bitsPointer, bitsOffset; + uint8_t reserved; + uint32_t flags; + uint16_t aSpace, bSpace, cSpace; + uint32_t colorPointer; + uint8_t reserved1[ 16 ]; void Read( hsStream *s ) { @@ -1180,13 +1180,13 @@ hsBool plFont::LoadFromFNTStream( hsStream *stream ) struct charEntry { - UInt16 width; - UInt32 offset; + uint16_t width; + uint32_t offset; charEntry() { width = 0; offset = 0; } } *charEntries; int i, count = fntInfo.lastChar - fntInfo.firstChar + 2; - charEntries = TRACKED_NEW charEntry[ count ]; + charEntries = new charEntry[ count ]; for( i = 0; i < count; i++ ) { charEntries[ i ].width = stream->ReadLE16(); @@ -1218,7 +1218,7 @@ hsBool plFont::LoadFromFNTStream( hsStream *stream ) break; } } - fSize = (UInt8)(fntInfo.points); + fSize = (uint8_t)(fntInfo.points); // Figure out what we need to allocate our bitmap as fWidth = 0; @@ -1235,18 +1235,18 @@ hsBool plFont::LoadFromFNTStream( hsStream *stream ) // Since we're 1 bbp, make sure width is a multiple of 8 fWidth = ( ( fWidth + 7 ) >> 3 ) << 3; - UInt32 widthInBytes = ( fWidth * fBPP ) >> 3; + uint32_t widthInBytes = ( fWidth * fBPP ) >> 3; // Allocate our bitmap now - UInt32 size = widthInBytes * fHeight; - fBMapData = TRACKED_NEW UInt8[ size ]; + uint32_t size = widthInBytes * fHeight; + fBMapData = new uint8_t[ size ]; memset( fBMapData, 0, size ); fFirstChar = fntInfo.firstChar; fMaxCharHeight = 0; // Read the bitmap info - UInt32 destOff = 0; + uint32_t destOff = 0; for( i = 0; i < count; i++ ) { int numCols = ( charEntries[ i ].width + 7 ) >> 3; @@ -1258,7 +1258,7 @@ hsBool plFont::LoadFromFNTStream( hsStream *stream ) outChar.fHeight = ( charEntries[ i ].offset == 0 ) ? 0 : height; outChar.fBaseline = fntInfo.ascent; outChar.fLeftKern = 0.f; - outChar.fRightKern = (hsScalar)(charEntries[ i ].width - fWidth); + outChar.fRightKern = (float)(charEntries[ i ].width - fWidth); fCharacters.Append( outChar ); if( outChar.fHeight > fMaxCharHeight ) @@ -1273,10 +1273,10 @@ hsBool plFont::LoadFromFNTStream( hsStream *stream ) // Write the actual bitmap data. Note: FNTs store the bits one column at a time, // one col after another, whereas we want it plain row by row int col, y; - UInt8 *basePtr = fBMapData + destOff; + uint8_t *basePtr = fBMapData + destOff; for( col = 0; col < numCols; col++ ) { - UInt8 *yPtr = basePtr; + uint8_t *yPtr = basePtr; for( y = 0; y < height; y++ ) { *yPtr = stream->ReadByte(); @@ -1410,14 +1410,14 @@ class plLineParser return IGetNextToken( sDashTester ); } - Int32 GetInt( void ) + int32_t GetInt( void ) { return atoi( IGetNextToken() ); } - hsScalar GetFloat( void ) + float GetFloat( void ) { - return (hsScalar)atof( IGetNextToken() ); + return (float)atof( IGetNextToken() ); } }; @@ -1449,7 +1449,7 @@ class plBDFLookForEndCharParser : public plBDFSectParser virtual plBDFSectParser *ParseKeyword( const char *keyword, plLineParser &line ); }; -inline UInt8 iHexCharToByte( char c ) +inline uint8_t iHexCharToByte( char c ) { switch( c ) { @@ -1472,7 +1472,7 @@ inline UInt8 iHexCharToByte( char c ) default: return 0; } } -inline UInt8 iHexStringToByte( const char *str ) +inline uint8_t iHexStringToByte( const char *str ) { return ( iHexCharToByte( str[ 0 ] ) << 4 ) | iHexCharToByte( str[ 1 ] ); } @@ -1482,11 +1482,11 @@ class plBDFCharsParser : public plBDFSectParser protected: // Info about the current character we're translating - UInt16 fWhichChar, fRowsLeft; + uint16_t fWhichChar, fRowsLeft; plFont::plCharacter *fCharacter; - UInt8 *fBitmap; + uint8_t *fBitmap; hsBool fDoingData; - UInt32 fBytesWide, fBMapStride; + uint32_t fBytesWide, fBMapStride; inline void IReset( void ) { @@ -1497,7 +1497,7 @@ class plBDFCharsParser : public plBDFSectParser } public: - static UInt32 fResolution; + static uint32_t fResolution; plBDFCharsParser( plFont &myFont, plBDFConvertCallback *callback ) : plBDFSectParser( myFont, callback ), fDoingData( false ) {} @@ -1542,11 +1542,11 @@ class plBDFCharsParser : public plBDFSectParser if( ch == -1 ) { // Nonstandard encoding, skip the character entirely - return TRACKED_NEW plBDFLookForEndCharParser( fFont, fCallback ); + return new plBDFLookForEndCharParser( fFont, fCallback ); } else { - fWhichChar = (UInt16)(UInt8)ch; + fWhichChar = (uint16_t)(uint8_t)ch; // Set up our pointer. Note that since BDFs don't tell us the starting character, // we just make it 0 @@ -1601,7 +1601,7 @@ class plBDFCharsParser : public plBDFSectParser } // Set these now, since setting them before would've changed the IGetFreeCharData results - fCharacter->fLeftKern = (hsScalar)xOff; + fCharacter->fLeftKern = (float)xOff; fCharacter->fBaseline = yOff + pixH; fCharacter->fHeight = fRowsLeft = pixH; @@ -1625,7 +1625,7 @@ class plBDFCharsParser : public plBDFSectParser } }; -UInt32 plBDFCharsParser::fResolution = 72; +uint32_t plBDFCharsParser::fResolution = 72; plBDFSectParser *plBDFLookForEndCharParser::ParseKeyword( const char *keyword, plLineParser &line ) @@ -1633,7 +1633,7 @@ plBDFSectParser *plBDFLookForEndCharParser::ParseKeyword( const char *keyword, p if( strcmp( keyword, "ENDCHAR" ) == 0 ) { // Horray! - return TRACKED_NEW plBDFCharsParser( fFont, fCallback ); + return new plBDFCharsParser( fFont, fCallback ); } // Just gobble lines until we find the endchar section return this; @@ -1649,7 +1649,7 @@ class plBDFLookForCharParser : public plBDFSectParser if( strcmp( keyword, "CHARS" ) == 0 ) { // Horray! - return TRACKED_NEW plBDFCharsParser( fFont, fCallback ); + return new plBDFCharsParser( fFont, fCallback ); } // Just gobble lines until we find the chars section return this; @@ -1677,7 +1677,7 @@ class plBDFPropertiesParser : public plBDFSectParser else if( strcmp( keyword, "ENDPROPERTIES" ) == 0 ) { // Switch to waiting for the chars section - return TRACKED_NEW plBDFLookForCharParser( fFont, fCallback ); + return new plBDFLookForCharParser( fFont, fCallback ); } // All tokens are technically valid, even if we don't recognize them return this; @@ -1727,7 +1727,7 @@ class plBDFHeaderParser : public plBDFSectParser else if( strcmp( keyword, "SIZE" ) == 0 ) { // Point size and target resolution of this font - fFont.SetSize( (UInt8)(line.GetInt()) ); + fFont.SetSize( (uint8_t)(line.GetInt()) ); plBDFCharsParser::fResolution = line.GetInt(); } else if( strcmp( keyword, "FONTBOUNDINGBOX" ) == 0 ) @@ -1743,7 +1743,7 @@ class plBDFHeaderParser : public plBDFSectParser fFont.fWidth = ( ( fFont.fWidth + 7 ) >> 3 ) << 3; // Allocate our data now - fFont.fBMapData = TRACKED_NEW UInt8[ ( fFont.fWidth * fFont.fHeight * fFont.fBPP ) >> 3 ]; + fFont.fBMapData = new uint8_t[ ( fFont.fWidth * fFont.fHeight * fFont.fBPP ) >> 3 ]; memset( fFont.fBMapData, 0, ( fFont.fWidth * fFont.fHeight * fFont.fBPP ) >> 3 ); fFont.fMaxCharHeight = line.GetInt(); @@ -1755,7 +1755,7 @@ class plBDFHeaderParser : public plBDFSectParser else if( strcmp( keyword, "STARTPROPERTIES" ) == 0 ) { // Start of the properties section, switch to that - return TRACKED_NEW plBDFPropertiesParser( fFont, fCallback ); + return new plBDFPropertiesParser( fFont, fCallback ); } else if( strcmp( keyword, "CHARS" ) == 0 ) { @@ -1767,12 +1767,12 @@ class plBDFHeaderParser : public plBDFSectParser fFont.fWidth = ( ( fFont.fWidth + 7 ) >> 3 ) << 3; // Allocate our data now - fFont.fBMapData = TRACKED_NEW UInt8[ ( fFont.fWidth * fFont.fHeight * fFont.fBPP ) >> 3 ]; + fFont.fBMapData = new uint8_t[ ( fFont.fWidth * fFont.fHeight * fFont.fBPP ) >> 3 ]; memset( fFont.fBMapData, 0, ( fFont.fWidth * fFont.fHeight * fFont.fBPP ) >> 3 ); } // Start of the char section - return TRACKED_NEW plBDFCharsParser( fFont, fCallback ); + return new plBDFCharsParser( fFont, fCallback ); } else { @@ -1791,8 +1791,8 @@ class plBDFCheckDimsParser : public plBDFSectParser public: - UInt32 fMaxWidth, fMaxHeight, fNumChars, fTotalHeight; - UInt16 fMaxChar; + uint32_t fMaxWidth, fMaxHeight, fNumChars, fTotalHeight; + uint16_t fMaxChar; plBDFCheckDimsParser( plFont &myFont ) : plBDFSectParser( myFont, nil ) { fMaxWidth = fMaxHeight = fNumChars = fTotalHeight = 0; fSkipNext = false; fMaxChar = 0; } @@ -1882,13 +1882,13 @@ hsBool plFont::LoadFromBDF( const char *path, plBDFConvertCallback *callback ) fCharacters.SetCount( 0 ); if( callback != nil ) - callback->NumChars( (UInt16)(checkDims.fNumChars) ); + callback->NumChars( (uint16_t)(checkDims.fNumChars) ); // Rewind and continue normally fseek( fp, 0, SEEK_SET ); // Start with the header parser - plBDFSectParser *currParser = TRACKED_NEW plBDFHeaderParser( *this, callback ); + plBDFSectParser *currParser = new plBDFHeaderParser( *this, callback ); // Read from the stream one line at a time (don't want comments, and char #1 should be invalid for a BDF) while( fgets( line, sizeof( line ), fp ) && currParser != nil ) @@ -1934,10 +1934,10 @@ hsBool plFont::ReadRaw( hsStream *s ) fBPP = s->ReadByte(); - UInt32 size = ( fWidth * fHeight * fBPP ) >> 3; + uint32_t size = ( fWidth * fHeight * fBPP ) >> 3; if( size > 0 ) { - fBMapData = TRACKED_NEW UInt8[ size ]; + fBMapData = new uint8_t[ size ]; s->Read( size, fBMapData ); } else @@ -1945,7 +1945,7 @@ hsBool plFont::ReadRaw( hsStream *s ) s->ReadLE( &fFirstChar ); - UInt32 i; + uint32_t i; fCharacters.SetCountAndZero( s->ReadLE32() ); for( i = 0; i < fCharacters.GetCount(); i++ ) fCharacters[ i ].Read( s ); @@ -1967,13 +1967,13 @@ hsBool plFont::WriteRaw( hsStream *s ) s->WriteByte( fBPP ); - UInt32 size = ( fWidth * fHeight * fBPP ) >> 3; + uint32_t size = ( fWidth * fHeight * fBPP ) >> 3; if( size > 0 ) s->Write( size, fBMapData ); s->WriteLE( fFirstChar ); - UInt32 i; + uint32_t i; s->WriteLE32( fCharacters.GetCount() ); for( i = 0; i < fCharacters.GetCount(); i++ ) fCharacters[ i ].Write( s ); diff --git a/Sources/Plasma/PubUtilLib/plGImage/plFont.h b/Sources/Plasma/PubUtilLib/plGImage/plFont.h index 066722e4..8a8d511c 100644 --- a/Sources/Plasma/PubUtilLib/plGImage/plFont.h +++ b/Sources/Plasma/PubUtilLib/plGImage/plFont.h @@ -62,7 +62,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #ifndef _plFont_h #define _plFont_h -#include "hsTypes.h" +#include "HeadSpin.h" #include "hsColorRGBA.h" #include "hsTemplates.h" #include "pcSmallRect.h" @@ -74,7 +74,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com class plBDFConvertCallback { public: - virtual void NumChars( UInt16 chars ) {} + virtual void NumChars( uint16_t chars ) {} virtual void CharDone( void ) {} }; @@ -132,32 +132,32 @@ class plFont : public hsKeyedObject // Font face and size. This is just used for IDing purposes, not for rendering char fFace[ 256 ]; - UInt8 fSize; - UInt32 fFlags; + uint8_t fSize; + uint32_t fFlags; // Size of the whole font bitmap. Fonts are stored vertically, one // character at a time, so fWidth is really the max width of any one // character bitmap, with of course the proper padding - UInt32 fWidth, fHeight; + uint32_t fWidth, fHeight; // Bpp of our font bitmap. We're grayscale, remember... - UInt8 fBPP; + uint8_t fBPP; // Bitmap data! - UInt8 *fBMapData; + uint8_t *fBMapData; // Our character class, for per-char info class plCharacter { public: - UInt32 fBitmapOff; // Offset in the font bitmap in bytes - // to the first byte of the character - UInt32 fHeight; // Height in pixels of this character - Int32 fBaseline; // Number of pixels down from the top of + uint32_t fBitmapOff; // Offset in the font bitmap in bytes + // to the first uint8_t of the character + uint32_t fHeight; // Height in pixels of this character + int32_t fBaseline; // Number of pixels down from the top of // the char bitmap to the baseline. - hsScalar fLeftKern; // Kerning values for this char, in pixels - hsScalar fRightKern; // Note that the right kern is relative to + float fLeftKern; // Kerning values for this char, in pixels + float fRightKern; // Note that the right kern is relative to // the right side of the bitmap area, which // is the width of the font bitmap, so // basically each character is the same width, @@ -182,14 +182,14 @@ class plFont : public hsKeyedObject }; // First character we encode--everything below this we don't render - UInt16 fFirstChar; + uint16_t fFirstChar; // Our characters, stored in an hsTArray for easy construction hsTArray fCharacters; // Max character bitmap height and max ascent for any character - UInt32 fMaxCharHeight; - Int32 fFontAscent, fFontDescent; + uint32_t fMaxCharHeight; + int32_t fFontAscent, fFontDescent; typedef void (plFont::*CharRenderFunc)( const plCharacter &c ); @@ -197,18 +197,18 @@ class plFont : public hsKeyedObject class plRenderInfo { public: - Int16 fFirstLineIndent; - Int16 fX, fY, fNumCols, fFarthestX, fLastX, fLastY; - Int16 fMaxWidth, fMaxHeight, fMaxAscent, fMaxDescent; - Int16 fLineSpacing; - UInt8 *fDestPtr; - UInt32 fDestStride; - UInt8 fDestBPP; - UInt32 fColor; + int16_t fFirstLineIndent; + int16_t fX, fY, fNumCols, fFarthestX, fLastX, fLastY; + int16_t fMaxWidth, fMaxHeight, fMaxAscent, fMaxDescent; + int16_t fLineSpacing; + uint8_t *fDestPtr; + uint32_t fDestStride; + uint8_t fDestBPP; + uint32_t fColor; plMipmap *fMipmap; - UInt32 fFlags; + uint32_t fFlags; pcSmallRect fClipRect; - hsScalar fFloatWidth; + float fFloatWidth; const wchar_t *fVolatileStringPtr; // Just so we know where we clipped @@ -220,10 +220,10 @@ class plFont : public hsKeyedObject void IClear( bool onConstruct = false ); void ICalcFontAscent( void ); - UInt8 *IGetFreeCharData( UInt32 &newOffset ); + uint8_t *IGetFreeCharData( uint32_t &newOffset ); - void IRenderLoop( const wchar_t *string, Int32 maxCount ); - void IRenderString( plMipmap *mip, UInt16 x, UInt16 y, const wchar_t *string, hsBool justCalc ); + void IRenderLoop( const wchar_t *string, int32_t maxCount ); + void IRenderString( plMipmap *mip, uint16_t x, uint16_t y, const wchar_t *string, hsBool justCalc ); // Various render functions void IRenderChar1To32( const plCharacter &c ); @@ -245,43 +245,43 @@ class plFont : public hsKeyedObject virtual void Write( hsStream *s, hsResMgr *mgr ); const char *GetFace( void ) const { return fFace; } - UInt8 GetSize( void ) const { return fSize; } - UInt16 GetFirstChar( void ) const { return fFirstChar; } - UInt16 GetNumChars( void ) const { return fCharacters.GetCount(); } - UInt32 GetFlags( void ) const { return fFlags; } - hsScalar GetDescent( void ) const { return (hsScalar)fFontDescent; } - hsScalar GetAscent( void ) const { return (hsScalar)fFontAscent; } + uint8_t GetSize( void ) const { return fSize; } + uint16_t GetFirstChar( void ) const { return fFirstChar; } + uint16_t GetNumChars( void ) const { return fCharacters.GetCount(); } + uint32_t GetFlags( void ) const { return fFlags; } + float GetDescent( void ) const { return (float)fFontDescent; } + float GetAscent( void ) const { return (float)fFontAscent; } - UInt32 GetBitmapWidth( void ) const { return fWidth; } - UInt32 GetBitmapHeight( void ) const { return fHeight; } - UInt8 GetBitmapBPP( void ) const { return fBPP; } + uint32_t GetBitmapWidth( void ) const { return fWidth; } + uint32_t GetBitmapHeight( void ) const { return fHeight; } + uint8_t GetBitmapBPP( void ) const { return fBPP; } void SetFace( const char *face ); - void SetSize( UInt8 size ); - void SetFlags( UInt32 flags ) { fFlags = flags; } - void SetFlag( UInt32 flag, hsBool on ) { if( on ) fFlags |= flag; else fFlags &= ~flag; } - hsBool IsFlagSet( UInt32 flag ) { if( fFlags & flag ) return true; return false; } - - void SetRenderColor( UInt32 color ); - void SetRenderFlag( UInt32 flag, hsBool on ) { if( on ) fRenderInfo.fFlags |= flag; else fRenderInfo.fFlags &= ~flag; } - hsBool IsRenderFlagSet( UInt32 flag ) { return ( fRenderInfo.fFlags & flag ) ? true : false; } - void SetRenderClipRect( Int16 x, Int16 y, Int16 width, Int16 height ); - void SetRenderXJustify( UInt32 j ) { fRenderInfo.fFlags &= ~kRenderJustXMask; fRenderInfo.fFlags |= j; } - void SetRenderYJustify( UInt32 j ) { fRenderInfo.fFlags &= ~kRenderJustYMask; fRenderInfo.fFlags |= j; } - void SetRenderFirstLineIndent( Int16 indent ) { fRenderInfo.fFirstLineIndent = indent; } - void SetRenderLineSpacing( Int16 spacing ) { fRenderInfo.fLineSpacing = spacing; } + void SetSize( uint8_t size ); + void SetFlags( uint32_t flags ) { fFlags = flags; } + void SetFlag( uint32_t flag, hsBool on ) { if( on ) fFlags |= flag; else fFlags &= ~flag; } + hsBool IsFlagSet( uint32_t flag ) { if( fFlags & flag ) return true; return false; } + + void SetRenderColor( uint32_t color ); + void SetRenderFlag( uint32_t flag, hsBool on ) { if( on ) fRenderInfo.fFlags |= flag; else fRenderInfo.fFlags &= ~flag; } + hsBool IsRenderFlagSet( uint32_t flag ) { return ( fRenderInfo.fFlags & flag ) ? true : false; } + void SetRenderClipRect( int16_t x, int16_t y, int16_t width, int16_t height ); + void SetRenderXJustify( uint32_t j ) { fRenderInfo.fFlags &= ~kRenderJustXMask; fRenderInfo.fFlags |= j; } + void SetRenderYJustify( uint32_t j ) { fRenderInfo.fFlags &= ~kRenderJustYMask; fRenderInfo.fFlags |= j; } + void SetRenderFirstLineIndent( int16_t indent ) { fRenderInfo.fFirstLineIndent = indent; } + void SetRenderLineSpacing( int16_t spacing ) { fRenderInfo.fLineSpacing = spacing; } // Sets flags too - void SetRenderClipping( Int16 x, Int16 y, Int16 width, Int16 height ); - void SetRenderWrapping( Int16 x, Int16 y, Int16 width, Int16 height ); + void SetRenderClipping( int16_t x, int16_t y, int16_t width, int16_t height ); + void SetRenderWrapping( int16_t x, int16_t y, int16_t width, int16_t height ); - void RenderString( plMipmap *mip, UInt16 x, UInt16 y, const char *string, UInt16 *lastX = nil, UInt16 *lastY = nil ); - void RenderString( plMipmap *mip, UInt16 x, UInt16 y, const wchar_t *string, UInt16 *lastX = nil, UInt16 *lastY = nil ); + void RenderString( plMipmap *mip, uint16_t x, uint16_t y, const char *string, uint16_t *lastX = nil, uint16_t *lastY = nil ); + void RenderString( plMipmap *mip, uint16_t x, uint16_t y, const wchar_t *string, uint16_t *lastX = nil, uint16_t *lastY = nil ); - UInt16 CalcStringWidth( const char *string ); - UInt16 CalcStringWidth( const wchar_t *string ); - void CalcStringExtents( const char *string, UInt16 &width, UInt16 &height, UInt16 &ascent, UInt32 &firstClippedChar, UInt16 &lastX, UInt16 &lastY ); - void CalcStringExtents( const wchar_t *string, UInt16 &width, UInt16 &height, UInt16 &ascent, UInt32 &firstClippedChar, UInt16 &lastX, UInt16 &lastY ); + uint16_t CalcStringWidth( const char *string ); + uint16_t CalcStringWidth( const wchar_t *string ); + void CalcStringExtents( const char *string, uint16_t &width, uint16_t &height, uint16_t &ascent, uint32_t &firstClippedChar, uint16_t &lastX, uint16_t &lastY ); + void CalcStringExtents( const wchar_t *string, uint16_t &width, uint16_t &height, uint16_t &ascent, uint32_t &firstClippedChar, uint16_t &lastX, uint16_t &lastY ); hsBool LoadFromFNT( const char *path ); hsBool LoadFromFNTStream( hsStream *stream ); diff --git a/Sources/Plasma/PubUtilLib/plGImage/plFontCache.cpp b/Sources/Plasma/PubUtilLib/plGImage/plFontCache.cpp index 4cf08662..8f6b9a98 100644 --- a/Sources/Plasma/PubUtilLib/plGImage/plFontCache.cpp +++ b/Sources/Plasma/PubUtilLib/plGImage/plFontCache.cpp @@ -92,9 +92,9 @@ void plFontCache::Clear( void ) { } -plFont *plFontCache::GetFont( const char *face, UInt8 size, UInt32 fontFlags ) +plFont *plFontCache::GetFont( const char *face, uint8_t size, uint32_t fontFlags ) { - UInt32 i, currIdx = (UInt32)-1; + uint32_t i, currIdx = (uint32_t)-1; int currDeltaSize = 100000; char toFind[ 256 ]; @@ -121,7 +121,7 @@ plFont *plFontCache::GetFont( const char *face, UInt8 size, UInt32 fontFlags ) } } - if( currIdx != (UInt32)-1 ) + if( currIdx != (uint32_t)-1 ) { //if( currDeltaSize > 0 ) // plStatusLog::AddLineS( "pipeline.log", "Warning: plFontCache is matching %s %d (requested %s %d)", fCache[ currIdx ]->GetFace(), fCache[ currIdx ]->GetSize(), face, size ); @@ -129,7 +129,7 @@ plFont *plFontCache::GetFont( const char *face, UInt8 size, UInt32 fontFlags ) } // If we failed, it's possible we have a face saved as "Times", for example, and someone's - // asking for "Times New Roman", so strip all but the first word from our font and try the search again + // asking for "Times New Roman", so strip all but the first uint16_t from our font and try the search again char *c = strchr( toFind, ' ' ); if( c != nil ) { @@ -174,7 +174,7 @@ void plFontCache::ILoadCustomFonts( void ) { iter2.GetPathAndName( fileName ); - plFont *font = TRACKED_NEW plFont; + plFont *font = new plFont; if( !font->LoadFromP2FFile( fileName ) ) delete font; else @@ -187,7 +187,7 @@ void plFontCache::ILoadCustomFonts( void ) } hsgResMgr::ResMgr()->AddViaNotify( font->GetKey(), - TRACKED_NEW plGenRefMsg( GetKey(), plRefMsg::kOnCreate, 0, -1 ), + new plGenRefMsg( GetKey(), plRefMsg::kOnCreate, 0, -1 ), plRefFlags::kActiveRef ); //plStatusLog::AddLineS( "pipeline.log", "FontCache: Added custom font %s", keyName ); @@ -208,7 +208,7 @@ hsBool plFontCache::MsgReceive( plMessage* pMsg ) else { plFont *font = plFont::ConvertNoRef( ref->GetRef() ); - UInt32 idx = fCache.Find( font ); + uint32_t idx = fCache.Find( font ); if( idx != fCache.kMissingIndex ) fCache.Remove( idx ); } diff --git a/Sources/Plasma/PubUtilLib/plGImage/plFontCache.h b/Sources/Plasma/PubUtilLib/plGImage/plFontCache.h index 04dd6dc3..14ba7940 100644 --- a/Sources/Plasma/PubUtilLib/plGImage/plFontCache.h +++ b/Sources/Plasma/PubUtilLib/plGImage/plFontCache.h @@ -56,7 +56,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #ifndef _plFontCache_h #define _plFontCache_h -#include "hsTypes.h" +#include "HeadSpin.h" #include "hsTemplates.h" #include "pnKeyedObject/hsKeyedObject.h" @@ -90,9 +90,9 @@ class plFontCache : public hsKeyedObject static plFontCache &GetInstance( void ); - plFont *GetFont( const char *face, UInt8 size, UInt32 fontFlags ); + plFont *GetFont( const char *face, uint8_t size, uint32_t fontFlags ); -// HFONT GetMeAFont( const char *face, int height, int weight, hsBool italic, UInt32 quality ); +// HFONT GetMeAFont( const char *face, int height, int weight, hsBool italic, uint32_t quality ); // void FreeFont( HFONT font ); void Clear( void ); diff --git a/Sources/Plasma/PubUtilLib/plGImage/plLODMipmap.cpp b/Sources/Plasma/PubUtilLib/plGImage/plLODMipmap.cpp index ee1664b6..7c7809ac 100644 --- a/Sources/Plasma/PubUtilLib/plGImage/plLODMipmap.cpp +++ b/Sources/Plasma/PubUtilLib/plGImage/plLODMipmap.cpp @@ -40,7 +40,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "plLODMipmap.h" #include "hsResMgr.h" @@ -72,11 +72,11 @@ plLODMipmap::plLODMipmap(plMipmap* mip) // Need some kind of reffing assignment for the mipmap here fBase = mip; - fLevelSizes = TRACKED_NEW UInt32[fBase->GetNumLevels()]; + fLevelSizes = new uint32_t[fBase->GetNumLevels()]; ISetup(); - hsgResMgr::ResMgr()->AddViaNotify(mip->GetKey(), TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnCreate, -1, kRefBase), plRefFlags::kActiveRef); + hsgResMgr::ResMgr()->AddViaNotify(mip->GetKey(), new plGenRefMsg(GetKey(), plRefMsg::kOnCreate, -1, kRefBase), plRefFlags::kActiveRef); } @@ -152,7 +152,7 @@ void plLODMipmap::ISetup() fRowBytes = fBase->GetRowBytes(); if( !fLevelSizes ) - fLevelSizes = TRACKED_NEW UInt32[fBase->GetNumLevels()]; + fLevelSizes = new uint32_t[fBase->GetNumLevels()]; fNumLevels = fBase->GetNumLevels() - GetLOD(); fNumLevels = 1; @@ -173,7 +173,7 @@ void plLODMipmap::ISetup() void plLODMipmap::ISetupCurrLevel() { fCurrLevelPtr = fBase->GetCurrLevelPtr(); - fCurrLevel = (UInt8)(fBase->GetCurrLevel()); + fCurrLevel = (uint8_t)(fBase->GetCurrLevel()); fCurrLevelWidth = fBase->GetCurrWidth(); fCurrLevelHeight = fBase->GetCurrHeight(); fCurrLevelRowBytes = fBase->GetRowBytes(); @@ -227,7 +227,7 @@ void plLODMipmap::IMarkDirty() } } -void plLODMipmap::SetCurrLevel(UInt8 level) +void plLODMipmap::SetCurrLevel(uint8_t level) { fBase->SetCurrLevel(level + GetLOD()); @@ -240,13 +240,13 @@ void plLODMipmap::Reset() ISetup(); } -void plLODMipmap::ScaleNicely(UInt32 *destPtr, UInt16 destWidth, UInt16 destHeight, - UInt16 destStride, plMipmap::ScaleFilter filter) const +void plLODMipmap::ScaleNicely(uint32_t *destPtr, uint16_t destWidth, uint16_t destHeight, + uint16_t destStride, plMipmap::ScaleFilter filter) const { fBase->ScaleNicely(destPtr, destWidth, destHeight, destStride, filter); } -hsBool plLODMipmap::ResizeNicely(UInt16 newWidth, UInt16 newHeight, plMipmap::ScaleFilter filter) +hsBool plLODMipmap::ResizeNicely(uint16_t newWidth, uint16_t newHeight, plMipmap::ScaleFilter filter) { hsBool retVal = fBase->ResizeNicely(newWidth, newHeight, filter); ISetup(); @@ -259,7 +259,7 @@ void plLODMipmap::CopyFrom(const plMipmap *source) ISetup(); } -void plLODMipmap::Composite(plMipmap *source, UInt16 x, UInt16 y, CompositeOptions *options) +void plLODMipmap::Composite(plMipmap *source, uint16_t x, uint16_t y, CompositeOptions *options) { fBase->Composite(source, x, y, options); IMarkDirty(); @@ -290,7 +290,7 @@ void plLODMipmap::Read(hsStream *s, hsResMgr *mgr) { INilify(); hsKeyedObject::Read(s, mgr); - mgr->ReadKeyNotifyMe(s, TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnCreate, -1, kRefBase), plRefFlags::kActiveRef); // fBase + mgr->ReadKeyNotifyMe(s, new plGenRefMsg(GetKey(), plRefMsg::kOnCreate, -1, kRefBase), plRefFlags::kActiveRef); // fBase } void plLODMipmap::Write(hsStream *s, hsResMgr *mgr) diff --git a/Sources/Plasma/PubUtilLib/plGImage/plLODMipmap.h b/Sources/Plasma/PubUtilLib/plGImage/plLODMipmap.h index 793e33a6..a8bf1622 100644 --- a/Sources/Plasma/PubUtilLib/plGImage/plLODMipmap.h +++ b/Sources/Plasma/PubUtilLib/plGImage/plLODMipmap.h @@ -93,14 +93,14 @@ public: virtual plMipmap* Clone() const { return fBase->Clone(); } virtual void CopyFrom(const plMipmap *source); - virtual void Composite(plMipmap *source, UInt16 x, UInt16 y, CompositeOptions *options = nil); + virtual void Composite(plMipmap *source, uint16_t x, uint16_t y, CompositeOptions *options = nil); - virtual void ScaleNicely(UInt32 *destPtr, UInt16 destWidth, UInt16 destHeight, - UInt16 destStride, plMipmap::ScaleFilter filter) const; + virtual void ScaleNicely(uint32_t *destPtr, uint16_t destWidth, uint16_t destHeight, + uint16_t destStride, plMipmap::ScaleFilter filter) const; - virtual hsBool ResizeNicely(UInt16 newWidth, UInt16 newHeight, plMipmap::ScaleFilter filter); + virtual hsBool ResizeNicely(uint16_t newWidth, uint16_t newHeight, plMipmap::ScaleFilter filter); - virtual void SetCurrLevel(UInt8 level); + virtual void SetCurrLevel(uint8_t level); const plMipmap* GetBase() const { return fBase; } }; diff --git a/Sources/Plasma/PubUtilLib/plGImage/plMipmap.cpp b/Sources/Plasma/PubUtilLib/plGImage/plMipmap.cpp index d365dcfc..0db6ed19 100644 --- a/Sources/Plasma/PubUtilLib/plGImage/plMipmap.cpp +++ b/Sources/Plasma/PubUtilLib/plGImage/plMipmap.cpp @@ -51,15 +51,16 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // // /////////////////////////////////////////////////////////////////////////////// -#include "hsTypes.h" +#include "HeadSpin.h" #include "plMipmap.h" #include "hsStream.h" #include "hsExceptions.h" -#include "hsUtils.h" + #include "hsColorRGBA.h" #include "plPipeline/hsGDeviceRef.h" #include "plProfile.h" #include "plJPEG/plJPEG.h" +#include plProfile_CreateMemCounter("Mipmaps", "Memory", MemMipmaps); @@ -87,7 +88,7 @@ plMipmap::~plMipmap() #endif } -plMipmap::plMipmap( UInt32 width, UInt32 height, unsigned config, UInt8 numLevels, UInt8 compType, UInt8 format ) +plMipmap::plMipmap( uint32_t width, uint32_t height, unsigned config, uint8_t numLevels, uint8_t compType, uint8_t format ) { Create( width, height, config, numLevels, compType, format ); @@ -98,7 +99,7 @@ plMipmap::plMipmap( UInt32 width, UInt32 height, unsigned config, UInt8 numLevel //// Create /////////////////////////////////////////////////////////////////// -void plMipmap::Create( UInt32 width, UInt32 height, unsigned config, UInt8 numLevels, UInt8 compType, UInt8 format ) +void plMipmap::Create( uint32_t width, uint32_t height, unsigned config, uint8_t numLevels, uint8_t compType, uint8_t format ) { int i; @@ -155,7 +156,7 @@ void plMipmap::Create( UInt32 width, UInt32 height, unsigned config, UInt8 nu for( i = 0; i < fNumLevels; i++ ) fTotalSize += fLevelSizes[ i ]; - fImage = (void *)TRACKED_NEW UInt8[ fTotalSize ]; + fImage = (void *)new uint8_t[ fTotalSize ]; memset(fImage, 0, fTotalSize); SetCurrLevel( 0 ); @@ -177,10 +178,10 @@ void plMipmap::Reset() { #ifdef MEMORY_LEAK_TRACER if( fImage != nil ) - IRemoveFromMemRecord( (UInt8 *)fImage ); + IRemoveFromMemRecord( (uint8_t *)fImage ); #endif - delete[] (UInt8*)fImage; + delete[] (uint8_t*)fImage; plProfile_DelMem(MemMipmaps, fTotalSize); } fImage = nil; @@ -194,16 +195,16 @@ void plMipmap::Reset() //// GetTotalSize ///////////////////////////////////////////////////////////// // Get the total size in bytes -UInt32 plMipmap::GetTotalSize() const +uint32_t plMipmap::GetTotalSize() const { return fTotalSize; } //// Read ///////////////////////////////////////////////////////////////////// -UInt32 plMipmap::Read( hsStream *s ) +uint32_t plMipmap::Read( hsStream *s ) { - UInt32 totalRead = plBitmap::Read( s ); + uint32_t totalRead = plBitmap::Read( s ); // Decide to clamp if we were told to int clampBy = fGlobalNumLevelsToChop; @@ -214,7 +215,7 @@ UInt32 plMipmap::Read( hsStream *s ) clampBy = 0; else if( ( fFlags & kHalfSize ) && clampBy > 1 ) clampBy = 1; - UInt32 amtToSkip = 0; + uint32_t amtToSkip = 0; fWidth = s->ReadLE32(); fHeight = s->ReadLE32(); @@ -248,7 +249,7 @@ UInt32 plMipmap::Read( hsStream *s ) } } - fImage = (void *)TRACKED_NEW UInt8[ fTotalSize ]; + fImage = (void *)new uint8_t[ fTotalSize ]; #ifdef MEMORY_LEAK_TRACER IAddToMemRecord( this, plRecord::kViaRead ); #endif @@ -281,9 +282,9 @@ UInt32 plMipmap::Read( hsStream *s ) //// Write //////////////////////////////////////////////////////////////////// -UInt32 plMipmap::Write( hsStream *s ) +uint32_t plMipmap::Write( hsStream *s ) { - UInt32 totalWritten = plBitmap::Write( s ); + uint32_t totalWritten = plBitmap::Write( s ); s->WriteLE32( fWidth ); s->WriteLE32( fHeight ); @@ -328,8 +329,8 @@ UInt32 plMipmap::Write( hsStream *s ) void plMipmap::IReadRawImage( hsStream *stream ) { - UInt32 i; - UInt8 *data = (UInt8 *)fImage; + uint32_t i; + uint8_t *data = (uint8_t *)fImage; switch( fPixelSize ) @@ -337,7 +338,7 @@ void plMipmap::IReadRawImage( hsStream *stream ) case 32: for( i = 0; i < fNumLevels; i++ ) { - stream->ReadLE32( fLevelSizes[ i ] >> 2, (UInt32 *)data ); + stream->ReadLE32( fLevelSizes[ i ] >> 2, (uint32_t *)data ); data += fLevelSizes[ i ]; } break; @@ -345,7 +346,7 @@ void plMipmap::IReadRawImage( hsStream *stream ) case 16: for( i = 0; i < fNumLevels; i++ ) { - stream->ReadLE16( fLevelSizes[ i ] >> 1, (UInt16 *)data ); + stream->ReadLE16( fLevelSizes[ i ] >> 1, (uint16_t *)data ); data += fLevelSizes[ i ]; } break; @@ -359,8 +360,8 @@ void plMipmap::IReadRawImage( hsStream *stream ) void plMipmap::IWriteRawImage( hsStream *stream ) { - UInt32 i; - UInt8 *data = (UInt8 *)fImage; + uint32_t i; + uint8_t *data = (uint8_t *)fImage; switch( fPixelSize ) @@ -368,7 +369,7 @@ void plMipmap::IWriteRawImage( hsStream *stream ) case 32: for( i = 0; i < fNumLevels; i++ ) { - stream->WriteLE32( fLevelSizes[ i ] >> 2, (UInt32 *)data ); + stream->WriteLE32( fLevelSizes[ i ] >> 2, (uint32_t *)data ); data += fLevelSizes[ i ]; } break; @@ -376,7 +377,7 @@ void plMipmap::IWriteRawImage( hsStream *stream ) case 16: for( i = 0; i < fNumLevels; i++ ) { - stream->WriteLE16( fLevelSizes[ i ] >> 1, (UInt16 *)data ); + stream->WriteLE16( fLevelSizes[ i ] >> 1, (uint16_t *)data ); data += fLevelSizes[ i ]; } break; @@ -388,19 +389,19 @@ void plMipmap::IWriteRawImage( hsStream *stream ) plMipmap *plMipmap::ISplitAlpha() { - plMipmap *retVal = TRACKED_NEW plMipmap(); + plMipmap *retVal = new plMipmap(); retVal->CopyFrom(this); memset( retVal->fImage, 0, fTotalSize ); - UInt8 *curLoc = (UInt8 *)fImage; - UInt8 *destLoc = (UInt8 *)retVal->fImage; - UInt32 numBytes = fTotalSize; - UInt32 curByte = 0; + uint8_t *curLoc = (uint8_t *)fImage; + uint8_t *destLoc = (uint8_t *)retVal->fImage; + uint32_t numBytes = fTotalSize; + uint32_t curByte = 0; switch( fUncompressedInfo.fType ) { case UncompressedInfo::kRGB8888: - // first byte is the alpha channel, we will drop this byte into the red channel for compression + // first uint8_t is the alpha channel, we will drop this uint8_t into the red channel for compression while (curByte < numBytes) { curLoc += 3; @@ -420,15 +421,15 @@ plMipmap *plMipmap::ISplitAlpha() // alphaChannel must be in the format generated from ISplitAlpha, or strange things will happen void plMipmap::IRecombineAlpha( plMipmap *alphaChannel ) { - UInt8 *curLoc = (UInt8 *)alphaChannel->fImage; - UInt8 *destLoc = (UInt8 *)fImage; - UInt32 numBytes = fTotalSize; - UInt32 curByte = 0; + uint8_t *curLoc = (uint8_t *)alphaChannel->fImage; + uint8_t *destLoc = (uint8_t *)fImage; + uint32_t numBytes = fTotalSize; + uint32_t curByte = 0; switch( fUncompressedInfo.fType ) { case UncompressedInfo::kRGB8888: - // first byte is the alpha channel, we will grab this byte from the red channel for reconstitution + // first uint8_t is the alpha channel, we will grab this uint8_t from the red channel for reconstitution while (curByte < numBytes) { curLoc += 2; // pointer points at the red channel (where the alpha is stored) @@ -447,13 +448,13 @@ void plMipmap::IRecombineAlpha( plMipmap *alphaChannel ) plMipmap *plMipmap::IReadRLEImage( hsStream *stream ) { - UInt32 count,color; + uint32_t count,color; bool done = false; - plMipmap *retVal = TRACKED_NEW plMipmap(fWidth,fHeight,plMipmap::kARGB32Config,1); + plMipmap *retVal = new plMipmap(fWidth,fHeight,plMipmap::kARGB32Config,1); - UInt32 *curPos = (UInt32*)retVal->fImage; - UInt32 curLoc = 0; + uint32_t *curPos = (uint32_t*)retVal->fImage; + uint32_t curLoc = 0; while (!done) { @@ -463,7 +464,7 @@ plMipmap *plMipmap::IReadRLEImage( hsStream *stream ) done = true; else { - for (UInt32 i=0; ifLevelSizes[0]/4; // we only save the first mipmap level + uint32_t count=0,color=0,curColor=0; + uint32_t curPos = 0; + uint32_t totalSize = mipmap->fLevelSizes[0]/4; // we only save the first mipmap level - UInt32 *src = (UInt32*)mipmap->fImage; + uint32_t *src = (uint32_t*)mipmap->fImage; curColor = *src; curColor &= 0x00FFFFFF; // strip the alpha (if there is any) while (curPos < totalSize) @@ -512,7 +513,7 @@ void plMipmap::IWriteRLEImage( hsStream *stream, plMipmap *mipmap ) void plMipmap::IReadJPEGImage( hsStream *stream ) { - UInt8 flags = 0; + uint8_t flags = 0; flags = stream->ReadByte(); plMipmap *temp = nil; @@ -545,14 +546,14 @@ void plMipmap::IReadJPEGImage( hsStream *stream ) void plMipmap::IWriteJPEGImage( hsStream *stream ) { plMipmap *alpha = ISplitAlpha(); - UInt8 flags = 0; + uint8_t flags = 0; - hsNullStream *nullStream = TRACKED_NEW hsNullStream(); + hsNullStream *nullStream = new hsNullStream(); IWriteRLEImage(nullStream,this); if (nullStream->GetBytesWritten() < 5120) // we use RLE if it can get the image size under 5k, otherwise we use JPEG flags |= kColorDataRLE; delete nullStream; - nullStream = TRACKED_NEW hsNullStream(); + nullStream = new hsNullStream(); IWriteRLEImage(nullStream,alpha); if (nullStream->GetBytesWritten() < 5120) flags |= kAlphaDataRLE; @@ -579,7 +580,7 @@ void plMipmap::IWriteJPEGImage( hsStream *stream ) //// GetLevelSize ///////////////////////////////////////////////////////////// // Get the size of a single mipmap level (0 is the largest) -UInt32 plMipmap::GetLevelSize( UInt8 level ) +uint32_t plMipmap::GetLevelSize( uint8_t level ) { if( fLevelSizes == nil ) IBuildLevelSizes(); @@ -592,13 +593,13 @@ UInt32 plMipmap::GetLevelSize( UInt8 level ) void plMipmap::IBuildLevelSizes() { - UInt8 level; - UInt32 width, height, rowBytes; + uint8_t level; + uint32_t width, height, rowBytes; delete [] fLevelSizes; - fLevelSizes = TRACKED_NEW UInt32[ fNumLevels ]; - memset( fLevelSizes, 0, sizeof( UInt32 ) * fNumLevels ); + fLevelSizes = new uint32_t[ fNumLevels ]; + memset( fLevelSizes, 0, sizeof( uint32_t ) * fNumLevels ); for( level = 0, width = fWidth, height = fHeight, rowBytes = fRowBytes; level < fNumLevels; level++ ) { @@ -608,7 +609,7 @@ void plMipmap::IBuildLevelSizes() if( ( width | height ) & 0x03 ) fLevelSizes[ level ] = height * rowBytes; else - fLevelSizes[ level ] = ( height * width * (UInt32)fDirectXInfo.fBlockSize ) >> 4; + fLevelSizes[ level ] = ( height * width * (uint32_t)fDirectXInfo.fBlockSize ) >> 4; break; case kUncompressed: @@ -634,16 +635,16 @@ void plMipmap::IBuildLevelSizes() //// GetLevelPtr ////////////////////////////////////////////////////////////// -UInt8 *plMipmap::GetLevelPtr( UInt8 level, UInt32 *width, UInt32 *height, UInt32 *rowBytes ) +uint8_t *plMipmap::GetLevelPtr( uint8_t level, uint32_t *width, uint32_t *height, uint32_t *rowBytes ) { - UInt8 *data, i; - UInt32 w, h, r; + uint8_t *data, i; + uint32_t w, h, r; if( fLevelSizes == nil ) IBuildLevelSizes(); - for( i = 0, data = (UInt8 *)fImage, w = fWidth, h = fHeight, r = fRowBytes; i < level; i++ ) + for( i = 0, data = (uint8_t *)fImage, w = fWidth, h = fHeight, r = fRowBytes; i < level; i++ ) { data += fLevelSizes[ i ]; if( w > 1 ) @@ -668,7 +669,7 @@ UInt8 *plMipmap::GetLevelPtr( UInt8 level, UInt32 *width, UInt32 *height, UInt //// SetCurrLevel ///////////////////////////////////////////////////////////// // Sets the current level pointer for use with GetAddr* -void plMipmap::SetCurrLevel( UInt8 level ) +void plMipmap::SetCurrLevel( uint8_t level ) { fCurrLevel = level; fCurrLevelPtr = GetLevelPtr( level, &fCurrLevelWidth, &fCurrLevelHeight, &fCurrLevelRowBytes ); @@ -727,13 +728,13 @@ void plMipmap::SetConfig( unsigned config ) // a size of 256, when this function returns the mipmap will be 256x128 in // size. -void plMipmap::ClipToMaxSize( UInt32 maxDimension ) +void plMipmap::ClipToMaxSize( uint32_t maxDimension ) { - UInt8 *srcData, *destData, i; - UInt32 newSize; + uint8_t *srcData, *destData, i; + uint32_t newSize; - for( i = 0, newSize = fTotalSize, srcData = (UInt8 *)fImage; fWidth > maxDimension || fHeight > maxDimension; i++ ) + for( i = 0, newSize = fTotalSize, srcData = (uint8_t *)fImage; fWidth > maxDimension || fHeight > maxDimension; i++ ) { srcData += fLevelSizes[ i ]; newSize -= fLevelSizes[ i ]; @@ -751,14 +752,14 @@ void plMipmap::ClipToMaxSize( UInt32 maxDimension ) return; /// Create a new image pointer - destData = TRACKED_NEW UInt8[ newSize ]; + destData = new uint8_t[ newSize ]; hsAssert( destData != nil, "Out of memory in ClipToMaxSize()" ); memcpy( destData, srcData, newSize ); #ifdef MEMORY_LEAK_TRACER - IRemoveFromMemRecord( (UInt8 *)fImage ); + IRemoveFromMemRecord( (uint8_t *)fImage ); #endif - delete[] (UInt8*)fImage; + delete[] (uint8_t*)fImage; plProfile_DelMem(MemMipmaps, fTotalSize); fImage = destData; @@ -778,18 +779,18 @@ void plMipmap::ClipToMaxSize( UInt32 maxDimension ) void plMipmap::RemoveMipping() { - UInt8 *destData; + uint8_t *destData; /// Create a new image pointer - destData = TRACKED_NEW UInt8[ fLevelSizes[ 0 ] ]; + destData = new uint8_t[ fLevelSizes[ 0 ] ]; hsAssert( destData != nil, "Out of memory in ClipToMaxSize()" ); memcpy( destData, fImage, fLevelSizes[ 0 ] ); #ifdef MEMORY_LEAK_TRACER - IRemoveFromMemRecord( (UInt8 *)fImage ); + IRemoveFromMemRecord( (uint8_t *)fImage ); #endif - delete[] (UInt8*)fImage; + delete[] (uint8_t*)fImage; plProfile_DelMem(MemMipmaps, fTotalSize); fImage = destData; @@ -813,12 +814,12 @@ void plMipmap::RemoveMipping() namespace { - const UInt32 kVersion = 1; - const hsScalar kDefaultSigma = 1.f; - const UInt32 kDefaultDetailBias = 5; + const uint32_t kVersion = 1; + const float kDefaultSigma = 1.f; + const uint32_t kDefaultDetailBias = 5; // Color masks (out of 0-2) - const UInt8 fColorMasks[ 10 ][ 3 ] = { { 2, 0, 0 }, { 0, 2, 2 }, { 2, 0, 2 }, { 0, 2, 0 }, + const uint8_t fColorMasks[ 10 ][ 3 ] = { { 2, 0, 0 }, { 0, 2, 2 }, { 2, 0, 2 }, { 0, 2, 0 }, { 0, 0, 2 }, { 2, 2, 0 }, { 2, 2, 2 }, { 2, 0, 1 }, { 0, 2, 1 }, { 1, 0, 2 } }; } @@ -842,33 +843,33 @@ class plFilterMask { protected: int fExt; - hsScalar **fMask; + float **fMask; public: - plFilterMask( hsScalar sig ); + plFilterMask( float sig ); virtual ~plFilterMask(); int Begin() const { return -fExt; } int End() const { return fExt; } - hsScalar Mask( int i, int j ) const { return fMask[ i ][ j ]; } + float Mask( int i, int j ) const { return fMask[ i ][ j ]; } }; -plFilterMask::plFilterMask( hsScalar sig ) +plFilterMask::plFilterMask( float sig ) { fExt = (int)( sig * 2.f ); if( fExt < 1 ) fExt = 1; - hsScalar **m = TRACKED_NEW hsScalar *[ ( fExt << 1 ) + 1 ]; + float **m = new float *[ ( fExt << 1 ) + 1 ]; m += fExt; int i, j; - hsScalar ooSigSq = 1.f / ( sig * sig ); + float ooSigSq = 1.f / ( sig * sig ); for( i = -fExt; i <= fExt; i++ ) { - m[ i ] = ( TRACKED_NEW hsScalar[ ( fExt << 1 ) + 1] ) + fExt; + m[ i ] = ( new float[ ( fExt << 1 ) + 1] ) + fExt; for( j = -fExt; j <= fExt; j++ ) { m[ i ][ j ] = expf( -( i*i + j*j ) * ooSigSq ); @@ -890,9 +891,9 @@ plFilterMask::~plFilterMask() //// Some More Functions ////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////// -plMipmap::plMipmap( plMipmap *bm, hsScalar sig, UInt32 createFlags, - hsScalar detailDropoffStart, hsScalar detailDropoffStop, - hsScalar detailMax, hsScalar detailMin) +plMipmap::plMipmap( plMipmap *bm, float sig, uint32_t createFlags, + float detailDropoffStart, float detailDropoffStop, + float detailMax, float detailMin) { int i; @@ -909,7 +910,7 @@ plMipmap::plMipmap( plMipmap *bm, hsScalar sig, UInt32 createFlags, fImage = nil; fFlags = bm->GetFlags(); - UInt32 minDim = fHeight < fWidth ? fHeight : fWidth; + uint32_t minDim = fHeight < fWidth ? fHeight : fWidth; for( fNumLevels = 0; (minDim >> fNumLevels); fNumLevels++ ) /* empty */; fLevelSizes = nil; @@ -922,7 +923,7 @@ plMipmap::plMipmap( plMipmap *bm, hsScalar sig, UInt32 createFlags, fTotalSize += fLevelSizes[ i ]; fCurrLevel = 0; - fImage = (void *)TRACKED_NEW UInt8[ fTotalSize ]; + fImage = (void *)new uint8_t[ fTotalSize ]; memset(fImage, 0, fTotalSize); memcpy( fImage, bm->fImage, bm->GetLevelSize( 0 ) ); #ifdef MEMORY_LEAK_TRACER @@ -970,7 +971,7 @@ plMipmap::plMipmap( plMipmap *bm, hsScalar sig, UInt32 createFlags, } if( createFlags & (kCreateCarryWhite | kCreateCarryBlack) ) { - UInt32 col = createFlags & kCreateCarryWhite ? 0x00ffffff : 0x00000000; + uint32_t col = createFlags & kCreateCarryWhite ? 0x00ffffff : 0x00000000; for( i = 1; i < fNumLevels; i++ ) ICarryColor(i, col); } @@ -985,9 +986,9 @@ plMipmap::plMipmap( plMipmap *bm, hsScalar sig, UInt32 createFlags, // Given the detail range and the current level, returns the detail's alpha // value at that level. -hsScalar plMipmap::IGetDetailLevelAlpha( UInt8 level, hsScalar dropStart, hsScalar dropStop, hsScalar min, hsScalar max ) +float plMipmap::IGetDetailLevelAlpha( uint8_t level, float dropStart, float dropStop, float min, float max ) { - hsScalar detailAlpha; + float detailAlpha; detailAlpha = ( level - dropStart ) * ( min - max ) / ( dropStop - dropStart ) + max; @@ -1000,9 +1001,9 @@ hsScalar plMipmap::IGetDetailLevelAlpha( UInt8 level, hsScalar dropStart, hsScal return detailAlpha; } -void plMipmap::SetBitmapAsLevel(UInt8 iDst, plMipmap *bm, hsScalar sig, UInt32 createFlags, - hsScalar detailDropoffStart, hsScalar detailDropoffStop, - hsScalar detailMax, hsScalar detailMin) +void plMipmap::SetBitmapAsLevel(uint8_t iDst, plMipmap *bm, float sig, uint32_t createFlags, + float detailDropoffStart, float detailDropoffStop, + float detailMax, float detailMin) { SetCurrLevel( iDst ); @@ -1044,7 +1045,7 @@ void plMipmap::SetBitmapAsLevel(UInt8 iDst, plMipmap *bm, hsScalar sig, UInt32 c } if( createFlags & (kCreateCarryWhite | kCreateCarryBlack) ) { - UInt32 col = createFlags & kCreateCarryWhite ? 0x00ffffff : 0x00000000; + uint32_t col = createFlags & kCreateCarryWhite ? 0x00ffffff : 0x00000000; for( i = iDst+1; i < fNumLevels; i++ ) ICarryColor(i, col); } @@ -1056,7 +1057,7 @@ void plMipmap::SetBitmapAsLevel(UInt8 iDst, plMipmap *bm, hsScalar sig, UInt32 c // Creates one level of a mipmap based on a filter on the previous layer. // This version assumes no detail map fading. -void plMipmap::ICreateLevelNoDetail( UInt8 iDst, const plFilterMask& mask ) +void plMipmap::ICreateLevelNoDetail( uint8_t iDst, const plFilterMask& mask ) { hsAssert(fPixelSize == 32, "Only 32 bit implemented"); ASSERT_UNCOMPRESSED(); @@ -1067,24 +1068,24 @@ void plMipmap::ICreateLevelNoDetail( UInt8 iDst, const plFilterMask& mask ) { SetCurrLevel(iDst); - UInt8 *src = (UInt8 *)GetLevelPtr( iDst-1 ); - UInt8 *dst = (UInt8 *)GetLevelPtr(iDst); + uint8_t *src = (uint8_t *)GetLevelPtr( iDst-1 ); + uint8_t *dst = (uint8_t *)GetLevelPtr(iDst); - UInt32 srcRowBytes = fCurrLevelRowBytes << 1; - UInt32 srcHeight = fCurrLevelHeight << 1; - UInt32 srcWidth = fCurrLevelWidth << 1; + uint32_t srcRowBytes = fCurrLevelRowBytes << 1; + uint32_t srcHeight = fCurrLevelHeight << 1; + uint32_t srcWidth = fCurrLevelWidth << 1; for( i = 0; i < fCurrLevelHeight; i++ ) { for( j = 0; j < fCurrLevelWidth; j++ ) { - UInt8 *center = src + (i << 1) * srcRowBytes + (j << 3); + uint8_t *center = src + (i << 1) * srcRowBytes + (j << 3); - UInt32 chan; + uint32_t chan; for( chan = 0; chan < 4; chan++ ) { - hsScalar w = 0; - hsScalar a = 0; + float w = 0; + float a = 0; for( ii = mask.Begin(); ii <= mask.End(); ii++ ) { @@ -1094,20 +1095,20 @@ void plMipmap::ICreateLevelNoDetail( UInt8 iDst, const plFilterMask& mask ) &&(jj + (j << 1) >= 0)&&(jj + (j << 1) < srcWidth) ) { w += mask.Mask(ii, jj); - a += (hsScalar(center[ii*srcRowBytes + (jj<<2) + chan]) + 0.5f) * mask.Mask(ii, jj); + a += (float(center[ii*srcRowBytes + (jj<<2) + chan]) + 0.5f) * mask.Mask(ii, jj); } } } a /= w; - dst[i * fCurrLevelRowBytes + (j << 2) + chan] = (UInt8)a; + dst[i * fCurrLevelRowBytes + (j << 2) + chan] = (uint8_t)a; } } } } } -void plMipmap::ICarryZeroAlpha(UInt8 iDst) +void plMipmap::ICarryZeroAlpha(uint8_t iDst) { hsAssert(fPixelSize == 32, "Only 32 bit implemented"); ASSERT_UNCOMPRESSED(); @@ -1118,19 +1119,19 @@ void plMipmap::ICarryZeroAlpha(UInt8 iDst) { SetCurrLevel(iDst); - UInt8 *src = (UInt8 *)GetLevelPtr( iDst-1 ); - UInt8 *dst = (UInt8 *)GetLevelPtr(iDst); + uint8_t *src = (uint8_t *)GetLevelPtr( iDst-1 ); + uint8_t *dst = (uint8_t *)GetLevelPtr(iDst); - UInt32 srcRowBytes = fCurrLevelRowBytes << 1; - UInt32 srcHeight = fCurrLevelHeight << 1; - UInt32 srcWidth = fCurrLevelWidth << 1; + uint32_t srcRowBytes = fCurrLevelRowBytes << 1; + uint32_t srcHeight = fCurrLevelHeight << 1; + uint32_t srcWidth = fCurrLevelWidth << 1; - const UInt8 alphaOff = 3; + const uint8_t alphaOff = 3; for( i = 0; i < fCurrLevelHeight; i++ ) { for( j = 0; j < fCurrLevelWidth; j++ ) { - UInt8 *center = src + (i << 1) * srcRowBytes + (j << 3) + alphaOff; + uint8_t *center = src + (i << 1) * srcRowBytes + (j << 3) + alphaOff; if( !center[0] || !center[4] @@ -1144,7 +1145,7 @@ void plMipmap::ICarryZeroAlpha(UInt8 iDst) } } -void plMipmap::ICarryColor(UInt8 iDst, UInt32 col) +void plMipmap::ICarryColor(uint8_t iDst, uint32_t col) { hsAssert(fPixelSize == 32, "Only 32 bit implemented"); ASSERT_UNCOMPRESSED(); @@ -1155,18 +1156,18 @@ void plMipmap::ICarryColor(UInt8 iDst, UInt32 col) { SetCurrLevel(iDst); - UInt32* src = (UInt32*)GetLevelPtr( iDst-1 ); - UInt32* dst = (UInt32*)GetLevelPtr(iDst); + uint32_t* src = (uint32_t*)GetLevelPtr( iDst-1 ); + uint32_t* dst = (uint32_t*)GetLevelPtr(iDst); - UInt32 srcHeight = fCurrLevelHeight << 1; - UInt32 srcWidth = fCurrLevelWidth << 1; + uint32_t srcHeight = fCurrLevelHeight << 1; + uint32_t srcWidth = fCurrLevelWidth << 1; - const UInt8 alphaOff = 3; + const uint8_t alphaOff = 3; for( i = 0; i < fCurrLevelHeight; i++ ) { for( j = 0; j < fCurrLevelWidth; j++ ) { - UInt32* center = src + (i << 1) * srcWidth + (j << 1); + uint32_t* center = src + (i << 1) * srcWidth + (j << 1); if( ((center[0] & 0x00ffffff) == col) ||((center[1] & 0x00ffffff) == col) @@ -1185,32 +1186,32 @@ void plMipmap::ICarryColor(UInt8 iDst, UInt32 col) // Blends in the detail alpha for a given level. This version assumes // standard detail map blending. -void plMipmap::IBlendLevelDetailAlpha( UInt8 iDst, const plFilterMask& mask, - hsScalar detailDropoffStart, hsScalar detailDropoffStop, - hsScalar detailMax, hsScalar detailMin ) +void plMipmap::IBlendLevelDetailAlpha( uint8_t iDst, const plFilterMask& mask, + float detailDropoffStart, float detailDropoffStop, + float detailMax, float detailMin ) { hsAssert(fPixelSize == 32, "Only 32 bit implemented"); ASSERT_UNCOMPRESSED(); int i, j; - UInt32 offset; + uint32_t offset; SetCurrLevel(iDst); - UInt8 *dst = (UInt8 *)GetLevelPtr(iDst); + uint8_t *dst = (uint8_t *)GetLevelPtr(iDst); - hsScalar detailAlpha = IGetDetailLevelAlpha( iDst, detailDropoffStart, detailDropoffStop, detailMin, detailMax ); + float detailAlpha = IGetDetailLevelAlpha( iDst, detailDropoffStart, detailDropoffStop, detailMin, detailMax ); for( i = 0; i < fCurrLevelHeight; i++ ) { for( j = 0; j < fCurrLevelWidth; j++ ) { - UInt32 chan = 3; // Alpha channel only + uint32_t chan = 3; // Alpha channel only offset = i * fCurrLevelRowBytes + (j << 2) + chan; float a = (float)dst[ offset ] * detailAlpha; - dst[ offset ] = (UInt8)a; + dst[ offset ] = (uint8_t)a; } } } @@ -1219,28 +1220,28 @@ void plMipmap::IBlendLevelDetailAlpha( UInt8 iDst, const plFilterMask& mask, // Blends in the detail alpha for a given level. This version assumes additive // detail map blending. (Shesh, gotta hate C sometimes....) -void plMipmap::IBlendLevelDetailAdd( UInt8 iDst, const plFilterMask& mask, - hsScalar detailDropoffStart, hsScalar detailDropoffStop, - hsScalar detailMax, hsScalar detailMin ) +void plMipmap::IBlendLevelDetailAdd( uint8_t iDst, const plFilterMask& mask, + float detailDropoffStart, float detailDropoffStop, + float detailMax, float detailMin ) { hsAssert(fPixelSize == 32, "Only 32 bit implemented"); ASSERT_UNCOMPRESSED(); int i, j; - UInt32 offset; + uint32_t offset; SetCurrLevel(iDst); - UInt8 *dst = (UInt8 *)GetLevelPtr(iDst); + uint8_t *dst = (uint8_t *)GetLevelPtr(iDst); - hsScalar detailAlpha = IGetDetailLevelAlpha( iDst, detailDropoffStart, detailDropoffStop, detailMin, detailMax ); + float detailAlpha = IGetDetailLevelAlpha( iDst, detailDropoffStart, detailDropoffStop, detailMin, detailMax ); for( i = 0; i < fCurrLevelHeight; i++ ) { for( j = 0; j < fCurrLevelWidth; j++ ) { - UInt32 chan; + uint32_t chan; /// Blend all but the alpha channel, since we're doing additive blending for( chan = 0; chan < 3; chan++ ) @@ -1248,7 +1249,7 @@ void plMipmap::IBlendLevelDetailAdd( UInt8 iDst, const plFilterMask& mask, offset = i * fCurrLevelRowBytes + (j << 2) + chan; float a = (float)dst[ offset ] * detailAlpha; - dst[ offset ] = (UInt8)a; + dst[ offset ] = (uint8_t)a; } } } @@ -1258,29 +1259,29 @@ void plMipmap::IBlendLevelDetailAdd( UInt8 iDst, const plFilterMask& mask, // Blends in the detail alpha for a given level. This version assumes // multiplicitive detail map blending. (Shesh, gotta hate C sometimes....) -void plMipmap::IBlendLevelDetailMult( UInt8 iDst, const plFilterMask& mask, - hsScalar detailDropoffStart, hsScalar detailDropoffStop, - hsScalar detailMax, hsScalar detailMin ) +void plMipmap::IBlendLevelDetailMult( uint8_t iDst, const plFilterMask& mask, + float detailDropoffStart, float detailDropoffStop, + float detailMax, float detailMin ) { hsAssert(fPixelSize == 32, "Only 32 bit implemented"); ASSERT_UNCOMPRESSED(); int i, j; - UInt32 offset; + uint32_t offset; SetCurrLevel(iDst); - UInt8 *dst = (UInt8 *)GetLevelPtr(iDst); + uint8_t *dst = (uint8_t *)GetLevelPtr(iDst); - hsScalar detailAlpha = IGetDetailLevelAlpha( iDst, detailDropoffStart, detailDropoffStop, detailMin, detailMax ); - hsScalar invDetailAlpha = ( 1.f - detailAlpha ) * 255.f; + float detailAlpha = IGetDetailLevelAlpha( iDst, detailDropoffStart, detailDropoffStop, detailMin, detailMax ); + float invDetailAlpha = ( 1.f - detailAlpha ) * 255.f; for( i = 0; i < fCurrLevelHeight; i++ ) { for( j = 0; j < fCurrLevelWidth; j++ ) { - UInt32 chan; + uint32_t chan; for( chan = 0; chan < 4; chan++ ) { @@ -1291,7 +1292,7 @@ void plMipmap::IBlendLevelDetailMult( UInt8 iDst, const plFilterMask& mask, // Mult should fade to white, not black like with additive blending a = invDetailAlpha + a * detailAlpha; - dst[ offset ] = (UInt8)a; + dst[ offset ] = (uint8_t)a; } } } @@ -1314,7 +1315,7 @@ void plMipmap::EnsureKonstantBorder( hsBool clampU, hsBool clampV ) if( !clampU && !clampV ) return; // Um, exactly what are we supposed to do, again? - UInt32 uColor, vColor; + uint32_t uColor, vColor; int i; @@ -1342,15 +1343,15 @@ void plMipmap::EnsureKonstantBorder( hsBool clampU, hsBool clampV ) // Grabs the top level's border color, or returns false if not all pixels // on the border are the same color/alpha. -hsBool plMipmap::IGrabBorderColor( hsBool grabVNotU, UInt32 *color ) +hsBool plMipmap::IGrabBorderColor( hsBool grabVNotU, uint32_t *color ) { int i; - UInt32 *src1 = (UInt32 *)fImage, *src2, testColor; + uint32_t *src1 = (uint32_t *)fImage, *src2, testColor; if( !grabVNotU ) { - src2 = (UInt32 *)( (UInt8 *)fImage + fRowBytes * ( fHeight - 1 ) ); + src2 = (uint32_t *)( (uint8_t *)fImage + fRowBytes * ( fHeight - 1 ) ); testColor = *src1; for( i = 0; i < fWidth; i++ ) @@ -1382,13 +1383,13 @@ hsBool plMipmap::IGrabBorderColor( hsBool grabVNotU, UInt32 *color ) //// ISetCurrLevelUBorder ///////////////////////////////////////////////////// -void plMipmap::ISetCurrLevelUBorder( UInt32 color ) +void plMipmap::ISetCurrLevelUBorder( uint32_t color ) { int i; - UInt32 *src1 = (UInt32 *)fCurrLevelPtr, *src2; + uint32_t *src1 = (uint32_t *)fCurrLevelPtr, *src2; - src2 = (UInt32 *)( (UInt8 *)fCurrLevelPtr + fCurrLevelRowBytes * ( fCurrLevelHeight - 1 ) ); + src2 = (uint32_t *)( (uint8_t *)fCurrLevelPtr + fCurrLevelRowBytes * ( fCurrLevelHeight - 1 ) ); for( i = 0; i < fCurrLevelWidth; i++ ) { @@ -1399,10 +1400,10 @@ void plMipmap::ISetCurrLevelUBorder( UInt32 color ) //// ISetCurrLevelVBorder ///////////////////////////////////////////////////// -void plMipmap::ISetCurrLevelVBorder( UInt32 color ) +void plMipmap::ISetCurrLevelVBorder( uint32_t color ) { int i; - UInt32 *src1 = (UInt32 *)fCurrLevelPtr, *src2; + uint32_t *src1 = (uint32_t *)fCurrLevelPtr, *src2; src2 = src1 + ( fCurrLevelWidth - 1 ); @@ -1416,7 +1417,7 @@ void plMipmap::ISetCurrLevelVBorder( UInt32 color ) } } -void plMipmap::Filter(hsScalar sig) +void plMipmap::Filter(float sig) { hsAssert(fPixelSize == 32, "Only 32 bit implemented"); ASSERT_UNCOMPRESSED(); @@ -1425,9 +1426,9 @@ void plMipmap::Filter(hsScalar sig) if( 32 == fPixelSize ) { - UInt8 *dst = (UInt8 *)(fImage); + uint8_t *dst = (uint8_t *)(fImage); - UInt8* src = (UInt8*)HSMemory::New(fRowBytes * fHeight); + uint8_t* src = (uint8_t*)HSMemory::New(fRowBytes * fHeight); HSMemory::BlockMove(dst, src, fRowBytes * fHeight); if( sig <= 0 ) @@ -1435,21 +1436,21 @@ void plMipmap::Filter(hsScalar sig) plFilterMask mask(sig); - UInt32 srcRowBytes = fRowBytes; - UInt32 srcHeight = fHeight; - UInt32 srcWidth = fWidth; + uint32_t srcRowBytes = fRowBytes; + uint32_t srcHeight = fHeight; + uint32_t srcWidth = fWidth; for( i = 0; i < fHeight; i++ ) { for( j = 0; j < fWidth; j++ ) { - UInt8 *center = src + i * srcRowBytes + (j << 2); + uint8_t *center = src + i * srcRowBytes + (j << 2); - UInt32 chan; + uint32_t chan; for( chan = 0; chan < 4; chan++ ) { - hsScalar w = 0; - hsScalar a = 0; + float w = 0; + float a = 0; for( ii = mask.Begin(); ii <= mask.End(); ii++ ) { @@ -1459,13 +1460,13 @@ void plMipmap::Filter(hsScalar sig) &&(jj + j >= 0)&&(jj + j < srcWidth) ) { w += mask.Mask(ii, jj); - a += (hsScalar(center[ii*srcRowBytes + (jj<<2) + chan]) + 0.5f) * mask.Mask(ii, jj); + a += (float(center[ii*srcRowBytes + (jj<<2) + chan]) + 0.5f) * mask.Mask(ii, jj); } } } a /= w; - dst[i * fRowBytes + (j << 2) + chan] = (UInt8)(a); + dst[i * fRowBytes + (j << 2) + chan] = (uint8_t)(a); } } } @@ -1474,9 +1475,9 @@ void plMipmap::Filter(hsScalar sig) } } -static void CopyPixels(UInt32 srcWidth, UInt32 srcHeight,void *srcPixels, - UInt32 skipX, UInt32 skipY, UInt32 dstFormat, - void * &destPixels, UInt32 copyOptions) +static void CopyPixels(uint32_t srcWidth, uint32_t srcHeight,void *srcPixels, + uint32_t skipX, uint32_t skipY, uint32_t dstFormat, + void * &destPixels, uint32_t copyOptions) { int y; int xInc = skipX + 1; @@ -1487,8 +1488,8 @@ static void CopyPixels(UInt32 srcWidth, UInt32 srcHeight,void *srcPixels, int rowSkip = yInc * srcWidth; // Number of pixels to skip for each line const hsRGBAColor32 *p =(const hsRGBAColor32 *)srcPixels; - UInt16 *pixels16 = (UInt16*)destPixels; - UInt8 *pixels8 = (UInt8*)destPixels; + uint16_t *pixels16 = (uint16_t*)destPixels; + uint8_t *pixels8 = (uint8_t*)destPixels; for(y = 0; y < srcHeight; y += yInc, firstX += rowSkip) { @@ -1523,8 +1524,8 @@ static void CopyPixels(UInt32 srcWidth, UInt32 srcHeight,void *srcPixels, } -UInt32 plMipmap::CopyOutPixels(UInt32 destXSize, UInt32 destYSize, - UInt32 dstFormat, void *destPixels, UInt32 copyOptions) +uint32_t plMipmap::CopyOutPixels(uint32_t destXSize, uint32_t destYSize, + uint32_t dstFormat, void *destPixels, uint32_t copyOptions) { hsAssert(fPixelSize == 32, "Only 32 bit implemented"); @@ -1554,9 +1555,9 @@ void plMipmap::CopyFrom( const plMipmap *source ) plProfile_DelMem(MemMipmaps, fTotalSize); #ifdef MEMORY_LEAK_TRACER - IRemoveFromMemRecord( (UInt8 *)fImage ); + IRemoveFromMemRecord( (uint8_t *)fImage ); #endif - delete[] (UInt8*)fImage; + delete[] (uint8_t*)fImage; fWidth = source->fWidth; fHeight = source->fHeight; @@ -1567,7 +1568,7 @@ void plMipmap::CopyFrom( const plMipmap *source ) fCompressionType = source->fCompressionType; fTotalSize = source->fTotalSize; - fImage = (void *)TRACKED_NEW UInt8[ fTotalSize ]; + fImage = (void *)new uint8_t[ fTotalSize ]; memcpy( fImage, source->fImage, fTotalSize ); #ifdef MEMORY_LEAK_TRACER IAddToMemRecord( this, plRecord::kViaCopyFrom ); @@ -1605,7 +1606,7 @@ void plMipmap::CopyFrom( const plMipmap *source ) plMipmap *plMipmap::Clone() const { - plMipmap *newMap = TRACKED_NEW plMipmap; + plMipmap *newMap = new plMipmap; newMap->CopyFrom( this ); @@ -1616,14 +1617,14 @@ plMipmap *plMipmap::Clone() const // Compositing function. Take a (smaller) mipmap and composite it onto this one // at the given location -void plMipmap::Composite( plMipmap *source, UInt16 x, UInt16 y, plMipmap::CompositeOptions *options ) +void plMipmap::Composite( plMipmap *source, uint16_t x, uint16_t y, plMipmap::CompositeOptions *options ) { - UInt8 level, numLevels, srcNumLevels, srcLevelOffset, levelsToSkip; - UInt16 pX, pY; - UInt32 *srcLevelPtr, *dstLevelPtr, *srcPtr, *dstPtr; - UInt32 srcRowBytes, dstRowBytes, srcRowBytesToCopy, r, g, b, dR, dG, dB, srcWidth, srcHeight; - UInt32 srcAlpha, oneMinusAlpha, destAlpha; - UInt16 srcClipX, srcClipY; + uint8_t level, numLevels, srcNumLevels, srcLevelOffset, levelsToSkip; + uint16_t pX, pY; + uint32_t *srcLevelPtr, *dstLevelPtr, *srcPtr, *dstPtr; + uint32_t srcRowBytes, dstRowBytes, srcRowBytesToCopy, r, g, b, dR, dG, dB, srcWidth, srcHeight; + uint32_t srcAlpha, oneMinusAlpha, destAlpha; + uint16_t srcClipX, srcClipY; // Currently we only support 32 bit uncompressed mipmaps @@ -1648,7 +1649,7 @@ void plMipmap::Composite( plMipmap *source, UInt16 x, UInt16 y, plMipmap::Com // Src level skipping srcWidth = source->fWidth; srcHeight = source->fHeight; - srcLevelPtr = (UInt32 *)source->fImage; + srcLevelPtr = (uint32_t *)source->fImage; srcRowBytes = source->fRowBytes; srcNumLevels = source->fNumLevels; for( srcLevelOffset = 0, levelsToSkip = options->fSrcLevelsToSkip; levelsToSkip > 0; levelsToSkip--, srcLevelOffset++ ) @@ -1696,7 +1697,7 @@ void plMipmap::Composite( plMipmap *source, UInt16 x, UInt16 y, plMipmap::Com if( numLevels > srcNumLevels ) numLevels = srcNumLevels; - dstLevelPtr = (UInt32 *)fImage; + dstLevelPtr = (uint32_t *)fImage; dstRowBytes = fRowBytes; if( options->fFlags & kForceOpaque ) @@ -1709,7 +1710,7 @@ void plMipmap::Composite( plMipmap *source, UInt16 x, UInt16 y, plMipmap::Com // Clipping srcPtr += srcClipY * ( srcRowBytes >> 2 ) + srcClipX; - for( pY = (UInt16)srcHeight; pY > 0; pY-- ) + for( pY = (uint16_t)srcHeight; pY > 0; pY-- ) { memcpy( dstPtr, srcPtr, srcRowBytesToCopy ); for( pX = 0; pX < srcWidth; pX++ ) @@ -1742,7 +1743,7 @@ void plMipmap::Composite( plMipmap *source, UInt16 x, UInt16 y, plMipmap::Com // Clipping srcPtr += srcClipY * ( srcRowBytes >> 2 ) + srcClipX; - for( pY = (UInt16)srcHeight; pY > 0; pY-- ) + for( pY = (uint16_t)srcHeight; pY > 0; pY-- ) { memcpy( dstPtr, srcPtr, srcRowBytesToCopy ); dstPtr += dstRowBytes >> 2; @@ -1770,7 +1771,7 @@ void plMipmap::Composite( plMipmap *source, UInt16 x, UInt16 y, plMipmap::Com // Clipping srcPtr += srcClipY * ( srcRowBytes >> 2 ) + srcClipX; - for( pY = (UInt16)srcHeight; pY > 0; pY-- ) + for( pY = (uint16_t)srcHeight; pY > 0; pY-- ) { for( pX = 0; pX < srcWidth; pX++ ) { @@ -1803,10 +1804,10 @@ void plMipmap::Composite( plMipmap *source, UInt16 x, UInt16 y, plMipmap::Com // Clipping srcPtr += srcClipY * ( srcRowBytes >> 2 ) + srcClipX; - for( pY = (UInt16)srcHeight; pY > 0; pY-- ) + for( pY = (uint16_t)srcHeight; pY > 0; pY-- ) { // Reverse the loop so we can count downwards--slightly faster - pX = (UInt16)srcWidth; + pX = (uint16_t)srcWidth; do { pX--; @@ -1825,9 +1826,9 @@ void plMipmap::Composite( plMipmap *source, UInt16 x, UInt16 y, plMipmap::Com oneMinusAlpha = 256 - srcAlpha; destAlpha = dstPtr[ pX ] & 0xff000000; - r = (UInt32)((( srcPtr[ pX ] >> 16 ) & 0x000000ff) * options->fRedTint); - g = (UInt32)((( srcPtr[ pX ] >> 8 ) & 0x000000ff) * options->fGreenTint); - b = (UInt32)((( srcPtr[ pX ] ) & 0x000000ff) * options->fBlueTint); + r = (uint32_t)((( srcPtr[ pX ] >> 16 ) & 0x000000ff) * options->fRedTint); + g = (uint32_t)((( srcPtr[ pX ] >> 8 ) & 0x000000ff) * options->fGreenTint); + b = (uint32_t)((( srcPtr[ pX ] ) & 0x000000ff) * options->fBlueTint); dR = ( dstPtr[ pX ] >> 16 ) & 0x000000ff; dG = ( dstPtr[ pX ] >> 8 ) & 0x000000ff; dB = ( dstPtr[ pX ] ) & 0x000000ff; @@ -1877,8 +1878,8 @@ void plMipmap::Composite( plMipmap *source, UInt16 x, UInt16 y, plMipmap::Com void plMipmap::Colorize() { - UInt32 currColor, width, height; - UInt8 currLevel; + uint32_t currColor, width, height; + uint8_t currLevel; if( fPixelSize != 32 && fCompressionType != kDirectXCompression ) @@ -1934,13 +1935,13 @@ void plMipmap::Colorize() // Colorizes the current level of a mipmap according to the color mask given // (percentages of r, g & b in the range of 0-2). -void plMipmap::IColorLevel( UInt8 level, const UInt8 *colorMask ) +void plMipmap::IColorLevel( uint8_t level, const uint8_t *colorMask ) { - UInt32 index, max, color, gray, grayDiv2, *data, width, height; - UInt8 compMasks[ 3 ][ 2 ] = { { 0, 0 }, { 0, 0xff }, { 0xff, 0 } }; + uint32_t index, max, color, gray, grayDiv2, *data, width, height; + uint8_t compMasks[ 3 ][ 2 ] = { { 0, 0 }, { 0, 0xff }, { 0xff, 0 } }; - data = (UInt32 *)GetLevelPtr( level, &width, &height ); + data = (uint32_t *)GetLevelPtr( level, &width, &height ); max = fLevelSizes[ level ] >> 2; for( index = 0; index < max; index++ ) @@ -1975,16 +1976,16 @@ void plMipmap::IColorLevel( UInt8 level, const UInt8 *colorMask ) // Does a nice (smoothed) scaling of a 1-level mipmap onto another 1-level // mipmap. Works only for 32-bit mipmaps. -void plMipmap::ScaleNicely( UInt32 *destPtr, UInt16 destWidth, UInt16 destHeight, - UInt16 destStride, plMipmap::ScaleFilter filter ) const +void plMipmap::ScaleNicely( uint32_t *destPtr, uint16_t destWidth, uint16_t destHeight, + uint16_t destStride, plMipmap::ScaleFilter filter ) const { - UInt16 destX, destY, srcX, srcY; - Int16 srcStartX, srcEndX, srcStartY, srcEndY; + uint16_t destX, destY, srcX, srcY; + int16_t srcStartX, srcEndX, srcStartY, srcEndY; float srcPosX, srcPosY, destToSrcXScale, destToSrcYScale, filterWidth, filterHeight, weight; float totalWeight; hsColorRGBA color, accumColor; float whyWaits[ 16 ], whyWait, xWeights[ 16 ]; - UInt32 *srcPtr; + uint32_t *srcPtr; // Init @@ -2011,13 +2012,13 @@ void plMipmap::ScaleNicely( UInt32 *destPtr, UInt16 destWidth, UInt16 destHei // Calculate the span across this row srcPosY = destY * destToSrcYScale; - srcStartY = (Int16)( srcPosY - filterHeight ); + srcStartY = (int16_t)( srcPosY - filterHeight ); if( srcStartY < 0 ) srcStartY = 0; - srcEndY = (Int16)( srcPosY + filterHeight ); + srcEndY = (int16_t)( srcPosY + filterHeight ); if( srcEndY >= fHeight ) - srcEndY = (Int16)(fHeight - 1); + srcEndY = (int16_t)(fHeight - 1); // Precalc the y weights for( srcY = srcStartY; srcY <= srcEndY && ( srcY - srcStartY ) < 16; srcY++ ) @@ -2029,13 +2030,13 @@ void plMipmap::ScaleNicely( UInt32 *destPtr, UInt16 destWidth, UInt16 destHei srcPosX = destX * destToSrcXScale; // Range of pixels that the filter covers - srcStartX = (Int16)( srcPosX - filterWidth ); + srcStartX = (int16_t)( srcPosX - filterWidth ); if( srcStartX < 0 ) srcStartX = 0; - srcEndX = (Int16)( srcPosX + filterWidth ); + srcEndX = (int16_t)( srcPosX + filterWidth ); if( srcEndX >= fWidth ) - srcEndX = (Int16)(fWidth - 1); + srcEndX = (int16_t)(fWidth - 1); // Precalc the x weights for( srcX = srcStartX; srcX <= srcEndX && ( srcX - srcStartX ) < 16; srcX++ ) @@ -2086,10 +2087,10 @@ void plMipmap::ScaleNicely( UInt32 *destPtr, UInt16 destWidth, UInt16 destHei // Resizes us using the ScaleNicely function. Only works for 1-level, 32bpp // uncompressed mipmaps. -hsBool plMipmap::ResizeNicely( UInt16 newWidth, UInt16 newHeight, plMipmap::ScaleFilter filter ) +hsBool plMipmap::ResizeNicely( uint16_t newWidth, uint16_t newHeight, plMipmap::ScaleFilter filter ) { // Make a temp buffer - UInt32 *newData = TRACKED_NEW UInt32[ newWidth * newHeight ]; + uint32_t *newData = new uint32_t[ newWidth * newHeight ]; if( newData == nil ) return false; @@ -2120,11 +2121,11 @@ hsBool plMipmap::ResizeNicely( UInt16 newWidth, UInt16 newHeight, plMipmap::Sca //// Debug Mipmap Memory Leak Tracker ///////////////////////////////////////// plMipmap::plRecord *plMipmap::fRecords = nil; -UInt32 plMipmap::fNumMipmaps = 0; +uint32_t plMipmap::fNumMipmaps = 0; void plMipmap::IAddToMemRecord( plMipmap *mip, plRecord::Method method ) { - plRecord *newRecord = TRACKED_NEW plRecord; + plRecord *newRecord = new plRecord; newRecord->fCompressionType = mip->fCompressionType; @@ -2149,7 +2150,7 @@ void plMipmap::IAddToMemRecord( plMipmap *mip, plRecord::Method method ) newRecord->Link( &fRecords ); } -void plMipmap::IRemoveFromMemRecord( UInt8 *image ) +void plMipmap::IRemoveFromMemRecord( uint8_t *image ) { plRecord *record; @@ -2169,7 +2170,7 @@ void plMipmap::IReportLeaks() { plRecord *record, *next; static char msg[ 512 ], m2[ 128 ]; - UInt32 size; + uint32_t size; hsStatusMessage( "--- plMipmap Leaks ---\n" ); diff --git a/Sources/Plasma/PubUtilLib/plGImage/plMipmap.h b/Sources/Plasma/PubUtilLib/plGImage/plMipmap.h index a1e1c57e..64fd1b91 100644 --- a/Sources/Plasma/PubUtilLib/plGImage/plMipmap.h +++ b/Sources/Plasma/PubUtilLib/plGImage/plMipmap.h @@ -91,73 +91,73 @@ class plMipmap : public plBitmap plMipmap(); - plMipmap( UInt32 width, UInt32 height, unsigned config, UInt8 numLevels = 0, UInt8 compType = kUncompressed, UInt8 format = UncompressedInfo::kRGB8888 ); - plMipmap( plMipmap *bm, hsScalar sig, UInt32 createFlags, - hsScalar detailDropoffStart, hsScalar detailDropoffStop, - hsScalar detailMax, hsScalar detailMin ); + plMipmap( uint32_t width, uint32_t height, unsigned config, uint8_t numLevels = 0, uint8_t compType = kUncompressed, uint8_t format = UncompressedInfo::kRGB8888 ); + plMipmap( plMipmap *bm, float sig, uint32_t createFlags, + float detailDropoffStart, float detailDropoffStop, + float detailMax, float detailMin ); virtual ~plMipmap(); CLASSNAME_REGISTER( plMipmap ); GETINTERFACE_ANY( plMipmap, plBitmap ); - void Create( UInt32 width, UInt32 height, unsigned config, UInt8 numLevels, UInt8 compType = kUncompressed, UInt8 format = UncompressedInfo::kRGB8888 ); + void Create( uint32_t width, uint32_t height, unsigned config, uint8_t numLevels, uint8_t compType = kUncompressed, uint8_t format = UncompressedInfo::kRGB8888 ); virtual void Reset(); // Get the total size in bytes - virtual UInt32 GetTotalSize() const; + virtual uint32_t GetTotalSize() const; virtual void Read( hsStream *s, hsResMgr *mgr ) { hsKeyedObject::Read( s, mgr ); this->Read( s ); } virtual void Write( hsStream *s, hsResMgr *mgr ) { hsKeyedObject::Write( s, mgr ); this->Write( s ); } - virtual UInt8 GetNumLevels() const { return fNumLevels; } - virtual UInt32 GetLevelSize( UInt8 level ); // 0 is the largest + virtual uint8_t GetNumLevels() const { return fNumLevels; } + virtual uint32_t GetLevelSize( uint8_t level ); // 0 is the largest virtual void Colorize(); virtual plMipmap *Clone() const; virtual void CopyFrom( const plMipmap *source ); - inline UInt32 GetWidth() const { return fWidth; } - inline UInt32 GetHeight() const { return fHeight; } - inline UInt32 GetRowBytes() const { return fRowBytes; } + inline uint32_t GetWidth() const { return fWidth; } + inline uint32_t GetHeight() const { return fHeight; } + inline uint32_t GetRowBytes() const { return fRowBytes; } void *GetImage() const { return fImage; } void SetImagePtr( void *ptr ) { fImage = ptr; } - UInt8 *GetLevelPtr( UInt8 level, UInt32 *width = nil, UInt32 *height = nil, UInt32 *rowBytes = nil ); + uint8_t *GetLevelPtr( uint8_t level, uint32_t *width = nil, uint32_t *height = nil, uint32_t *rowBytes = nil ); // Sets the current level pointer for use with GetAddr* - virtual void SetCurrLevel(UInt8 level); + virtual void SetCurrLevel(uint8_t level); void *GetCurrLevelPtr() const { return fCurrLevelPtr; } - UInt32 GetCurrWidth() const { return fCurrLevelWidth; } - UInt32 GetCurrHeight() const { return fCurrLevelHeight; } - UInt32 GetCurrLevelSize() const { return fLevelSizes[ fCurrLevel ]; } - UInt32 GetCurrLevel() const { return fCurrLevel; } + uint32_t GetCurrWidth() const { return fCurrLevelWidth; } + uint32_t GetCurrHeight() const { return fCurrLevelHeight; } + uint32_t GetCurrLevelSize() const { return fLevelSizes[ fCurrLevel ]; } + uint32_t GetCurrLevel() const { return fCurrLevel; } // These methods return the address of the pixel specified by x and y // They are meant to be fast, therefore they are inlined and do not check // the fPixelSize field at runtime (except when debugging) - UInt8* GetAddr8(unsigned x, unsigned y) const + uint8_t* GetAddr8(unsigned x, unsigned y) const { ASSERT_PIXELSIZE(this, 8); ASSERT_XY(this, x, y); ASSERT_UNCOMPRESSED(); - return (UInt8*)((char*)fCurrLevelPtr + y * fCurrLevelRowBytes + x); + return (uint8_t*)((char*)fCurrLevelPtr + y * fCurrLevelRowBytes + x); } - UInt16* GetAddr16(unsigned x, unsigned y) const + uint16_t* GetAddr16(unsigned x, unsigned y) const { ASSERT_PIXELSIZE(this, 16); ASSERT_XY(this, x, y); ASSERT_UNCOMPRESSED(); - return (UInt16*)((char*)fCurrLevelPtr + y * fCurrLevelRowBytes + (x << 1)); + return (uint16_t*)((char*)fCurrLevelPtr + y * fCurrLevelRowBytes + (x << 1)); } - UInt32* GetAddr32(unsigned x, unsigned y) const + uint32_t* GetAddr32(unsigned x, unsigned y) const { ASSERT_PIXELSIZE(this, 32); ASSERT_XY(this, x, y); ASSERT_UNCOMPRESSED(); - return (UInt32*)((char*)fCurrLevelPtr + y * fCurrLevelRowBytes + (x << 2)); + return (uint32_t*)((char*)fCurrLevelPtr + y * fCurrLevelRowBytes + (x << 2)); } void* GetAddr64(unsigned x, unsigned y) const { @@ -210,23 +210,23 @@ class plMipmap : public plBitmap kAlphaDataRLE = 0x2 }; - void SetBitmapAsLevel(UInt8 iDst, plMipmap *bm, hsScalar sig, UInt32 createFlags, - hsScalar detailDropoffStart, hsScalar detailDropoffStop, - hsScalar detailMax, hsScalar detailMin); - void ICreateLevelNoDetail(UInt8 iDst, const plFilterMask& mask); - void IBlendLevelDetailAlpha(UInt8 iDst, const plFilterMask& mask, - hsScalar detailDropoffStart, hsScalar detailDropoffStop, - hsScalar detailMax, hsScalar detailMin); - void IBlendLevelDetailAdd(UInt8 iDst, const plFilterMask& mask, - hsScalar detailDropoffStart, hsScalar detailDropoffStop, - hsScalar detailMax, hsScalar detailMin); - void IBlendLevelDetailMult(UInt8 iDst, const plFilterMask& mask, - hsScalar detailDropoffStart, hsScalar detailDropoffStop, - hsScalar detailMax, hsScalar detailMin); - void Filter(hsScalar sig); - UInt32 CopyOutPixels(UInt32 destXSize, UInt32 destYSize, UInt32 dstFormat, void *destPixels, UInt32 copyOptions); - - void ClipToMaxSize( UInt32 maxDimension ); + void SetBitmapAsLevel(uint8_t iDst, plMipmap *bm, float sig, uint32_t createFlags, + float detailDropoffStart, float detailDropoffStop, + float detailMax, float detailMin); + void ICreateLevelNoDetail(uint8_t iDst, const plFilterMask& mask); + void IBlendLevelDetailAlpha(uint8_t iDst, const plFilterMask& mask, + float detailDropoffStart, float detailDropoffStop, + float detailMax, float detailMin); + void IBlendLevelDetailAdd(uint8_t iDst, const plFilterMask& mask, + float detailDropoffStart, float detailDropoffStop, + float detailMax, float detailMin); + void IBlendLevelDetailMult(uint8_t iDst, const plFilterMask& mask, + float detailDropoffStart, float detailDropoffStop, + float detailMax, float detailMin); + void Filter(float sig); + uint32_t CopyOutPixels(uint32_t destXSize, uint32_t destYSize, uint32_t dstFormat, void *destPixels, uint32_t copyOptions); + + void ClipToMaxSize( uint32_t maxDimension ); void RemoveMipping(); void EnsureKonstantBorder( hsBool clampU, hsBool clampV ); @@ -244,19 +244,19 @@ class plMipmap : public plBitmap { // Helper class for specifying options to Composite() public: - UInt16 fFlags; - UInt8 fSrcLevelsToSkip; - UInt8 fOpacity; - hsScalar fRedTint, fGreenTint, fBlueTint; - UInt16 fSrcClipX, fSrcClipY; // Clipping is applied AFTER levelSkip - UInt16 fSrcClipWidth, fSrcClipHeight; // 0 means max width/height + uint16_t fFlags; + uint8_t fSrcLevelsToSkip; + uint8_t fOpacity; + float fRedTint, fGreenTint, fBlueTint; + uint16_t fSrcClipX, fSrcClipY; // Clipping is applied AFTER levelSkip + uint16_t fSrcClipWidth, fSrcClipHeight; // 0 means max width/height CompositeOptions() { fFlags = 0; fSrcLevelsToSkip = 0; fRedTint = fGreenTint = fBlueTint = 1.f; fSrcClipX = fSrcClipY = fSrcClipWidth = fSrcClipHeight = 0; fOpacity = 255;} - CompositeOptions( UInt16 flags, UInt8 srcLevelsToSkip = 0, hsScalar red = 1.f, hsScalar green = 1.f, - hsScalar blue = 1.f, UInt16 srcClipX = 0, UInt16 srcClipY = 0, - UInt16 srcClipWidth = 0, UInt16 srcClipHeight = 0, UInt8 opacity = 255 ) + CompositeOptions( uint16_t flags, uint8_t srcLevelsToSkip = 0, float red = 1.f, float green = 1.f, + float blue = 1.f, uint16_t srcClipX = 0, uint16_t srcClipY = 0, + uint16_t srcClipWidth = 0, uint16_t srcClipHeight = 0, uint8_t opacity = 255 ) { fFlags = flags; fSrcLevelsToSkip = srcLevelsToSkip; @@ -272,7 +272,7 @@ class plMipmap : public plBitmap }; // Compositing function. Take a (smaller) mipmap and composite it onto this one at the given location. Nil options means use default - virtual void Composite( plMipmap *source, UInt16 x, UInt16 y, CompositeOptions *options = nil ); + virtual void Composite( plMipmap *source, uint16_t x, uint16_t y, CompositeOptions *options = nil ); // Scaling function enum ScaleFilter @@ -281,23 +281,23 @@ class plMipmap : public plBitmap kDefaultFilter = kBoxFilter }; - virtual void ScaleNicely( UInt32 *destPtr, UInt16 destWidth, UInt16 destHeight, - UInt16 destStride, plMipmap::ScaleFilter filter ) const; + virtual void ScaleNicely( uint32_t *destPtr, uint16_t destWidth, uint16_t destHeight, + uint16_t destStride, plMipmap::ScaleFilter filter ) const; - virtual hsBool ResizeNicely( UInt16 newWidth, UInt16 newHeight, plMipmap::ScaleFilter filter ); + virtual hsBool ResizeNicely( uint16_t newWidth, uint16_t newHeight, plMipmap::ScaleFilter filter ); protected: //// Protected Members //// void *fImage; - UInt32 fWidth, fHeight, fRowBytes, fTotalSize; - UInt8 fNumLevels; - UInt32 *fLevelSizes; + uint32_t fWidth, fHeight, fRowBytes, fTotalSize; + uint8_t fNumLevels; + uint32_t *fLevelSizes; void *fCurrLevelPtr; - UInt8 fCurrLevel; - UInt32 fCurrLevelWidth, fCurrLevelHeight, fCurrLevelRowBytes; + uint8_t fCurrLevel; + uint32_t fCurrLevelWidth, fCurrLevelHeight, fCurrLevelRowBytes; void IReadRawImage( hsStream *stream ); void IWriteRawImage( hsStream *stream ); @@ -309,19 +309,19 @@ class plMipmap : public plBitmap void IWriteJPEGImage( hsStream *stream ); void IBuildLevelSizes(); - void IColorLevel( UInt8 level, const UInt8 *colorMask ); + void IColorLevel( uint8_t level, const uint8_t *colorMask ); - hsScalar IGetDetailLevelAlpha( UInt8 level, hsScalar dropStart, hsScalar dropStop, hsScalar min, hsScalar max ); + float IGetDetailLevelAlpha( uint8_t level, float dropStart, float dropStop, float min, float max ); - void ICarryZeroAlpha(UInt8 iDst); - void ICarryColor(UInt8 iDst, UInt32 col); + void ICarryZeroAlpha(uint8_t iDst); + void ICarryColor(uint8_t iDst, uint32_t col); - hsBool IGrabBorderColor( hsBool grabVNotU, UInt32 *color ); - void ISetCurrLevelUBorder( UInt32 color ); - void ISetCurrLevelVBorder( UInt32 color ); + hsBool IGrabBorderColor( hsBool grabVNotU, uint32_t *color ); + void ISetCurrLevelUBorder( uint32_t color ); + void ISetCurrLevelVBorder( uint32_t color ); - virtual UInt32 Read( hsStream *s ); - virtual UInt32 Write( hsStream *s ); + virtual uint32_t Read( hsStream *s ); + virtual uint32_t Write( hsStream *s ); friend class plCubicEnvironmap; @@ -337,9 +337,9 @@ class plMipmap : public plBitmap char fKeyName[ 256 ]; void *fImage; - UInt32 fWidth, fHeight, fRowBytes; - UInt8 fNumLevels; - UInt8 fCompressionType; + uint32_t fWidth, fHeight, fRowBytes; + uint8_t fNumLevels; + uint8_t fCompressionType; union { DirectXInfo fDirectXInfo; @@ -373,10 +373,10 @@ class plMipmap : public plBitmap }; static plRecord *fRecords; - static UInt32 fNumMipmaps; + static uint32_t fNumMipmaps; static void IAddToMemRecord( plMipmap *mip, plRecord::Method method ); - static void IRemoveFromMemRecord( UInt8 *image ); + static void IRemoveFromMemRecord( uint8_t *image ); static void IReportLeaks(); #endif diff --git a/Sources/Plasma/PubUtilLib/plGImage/plPNG.cpp b/Sources/Plasma/PubUtilLib/plGImage/plPNG.cpp index d2b154dc..d0746ecb 100644 --- a/Sources/Plasma/PubUtilLib/plGImage/plPNG.cpp +++ b/Sources/Plasma/PubUtilLib/plGImage/plPNG.cpp @@ -40,10 +40,10 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "hsStream.h" #include "hsExceptions.h" -#include "hsUtils.h" + #include "plPNG.h" #include "plGImage/plMipmap.h" @@ -55,13 +55,13 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com void pngReadDelegate(png_structp png_ptr, png_bytep png_data, png_size_t length) { hsStream* inStream = (hsStream*)png_get_io_ptr(png_ptr); - inStream->Read(length, (UInt8*)png_data); + inStream->Read(length, (uint8_t*)png_data); } void pngWriteDelegate(png_structp png_ptr, png_bytep png_data, png_size_t length) { hsStream* outStream = (hsStream*)png_get_io_ptr(png_ptr); - outStream->Write(length, (UInt8*)png_data); + outStream->Write(length, (uint8_t*)png_data); } //// Singleton Instance /////////////////////////////////////////////////////// @@ -152,9 +152,9 @@ plMipmap* plPNG::IRead(hsStream* inStream) // Invert color byte-order as used by plMipmap for DirectX png_set_bgr(png_ptr); /// Construct a new mipmap to hold everything - newMipmap = TRACKED_NEW plMipmap(imgWidth, imgHeight, plMipmap::kARGB32Config, 1, plMipmap::kUncompressed); + newMipmap = new plMipmap(imgWidth, imgHeight, plMipmap::kARGB32Config, 1, plMipmap::kUncompressed); char* destp = (char*)newMipmap->GetImage(); - png_bytep* row_ptrs = TRACKED_NEW png_bytep[imgHeight]; + png_bytep* row_ptrs = new png_bytep[imgHeight]; const unsigned int stride = imgWidth * bitdepth * channels / 8; // Assign row pointers to the appropriate locations in the newly-created Mipmap @@ -180,13 +180,13 @@ plMipmap* plPNG::IRead(hsStream* inStream) plMipmap* plPNG::ReadFromFile(const char* fileName) { - wchar* wFilename = hsStringToWString(fileName); + wchar_t* wFilename = hsStringToWString(fileName); plMipmap* retVal = ReadFromFile(wFilename); delete [] wFilename; return retVal; } -plMipmap* plPNG::ReadFromFile(const wchar* fileName) +plMipmap* plPNG::ReadFromFile(const wchar_t* fileName) { hsUNIXStream in; @@ -220,7 +220,7 @@ hsBool plPNG::IWrite(plMipmap* source, hsStream* outStream) // Assign delegate function for writing to hsStream png_set_write_fn(png_ptr, (png_voidp)outStream, pngWriteDelegate, NULL); - UInt8 psize = source->GetPixelSize(); + uint8_t psize = source->GetPixelSize(); png_set_IHDR(png_ptr, info_ptr, source->GetWidth(), source->GetHeight(), 8, PNG_COLOR_TYPE_RGB_ALPHA, PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_DEFAULT, PNG_FILTER_TYPE_DEFAULT); // Invert color byte-order as used by plMipmap for DirectX @@ -228,7 +228,7 @@ hsBool plPNG::IWrite(plMipmap* source, hsStream* outStream) // Write out the image metadata png_write_info(png_ptr, info_ptr); char* srcp = (char*)source->GetImage(); - png_bytep* row_ptrs = TRACKED_NEW png_bytep[source->GetHeight()]; + png_bytep* row_ptrs = new png_bytep[source->GetHeight()]; const unsigned int stride = source->GetWidth() * source->GetPixelSize() / 8; // Assign row pointers to the appropriate locations in the newly-created Mipmap @@ -250,13 +250,13 @@ hsBool plPNG::IWrite(plMipmap* source, hsStream* outStream) hsBool plPNG::WriteToFile(const char* fileName, plMipmap* sourceData) { - wchar* wFilename = hsStringToWString(fileName); + wchar_t* wFilename = hsStringToWString(fileName); hsBool retVal = WriteToFile(wFilename, sourceData); delete [] wFilename; return retVal; } -hsBool plPNG::WriteToFile(const wchar* fileName, plMipmap* sourceData) +hsBool plPNG::WriteToFile(const wchar_t* fileName, plMipmap* sourceData) { hsUNIXStream out; diff --git a/Sources/Plasma/PubUtilLib/plGImage/plPNG.h b/Sources/Plasma/PubUtilLib/plGImage/plPNG.h index 411b9257..b7c6da09 100644 --- a/Sources/Plasma/PubUtilLib/plGImage/plPNG.h +++ b/Sources/Plasma/PubUtilLib/plGImage/plPNG.h @@ -59,11 +59,11 @@ public: plMipmap* ReadFromStream(hsStream* inStream) { return IRead(inStream); } plMipmap* ReadFromFile(const char* fileName); - plMipmap* ReadFromFile(const wchar* fileName); + plMipmap* ReadFromFile(const wchar_t* fileName); hsBool WriteToStream(hsStream* outStream, plMipmap* sourceData) { return IWrite(sourceData, outStream); } hsBool WriteToFile(const char* fileName, plMipmap* sourceData); - hsBool WriteToFile(const wchar* fileName, plMipmap* sourceData); + hsBool WriteToFile(const wchar_t* fileName, plMipmap* sourceData); static plPNG& Instance(void); }; diff --git a/Sources/Plasma/PubUtilLib/plGImage/plTGAWriter.cpp b/Sources/Plasma/PubUtilLib/plGImage/plTGAWriter.cpp index 0719e07b..becc96f5 100644 --- a/Sources/Plasma/PubUtilLib/plGImage/plTGAWriter.cpp +++ b/Sources/Plasma/PubUtilLib/plGImage/plTGAWriter.cpp @@ -51,7 +51,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // // /////////////////////////////////////////////////////////////////////////////// -#include "hsTypes.h" +#include "HeadSpin.h" #include "plTGAWriter.h" #include "plMipmap.h" #include "hsStream.h" @@ -87,8 +87,8 @@ void plTGAWriter::WriteMipmap( const char *fileName, plMipmap *mipmap ) stream.WriteLE16( 0 ); // xOrigin stream.WriteLE16( 0 ); // yOrigin - stream.WriteLE16( (UInt16)mipmap->GetWidth() ); - stream.WriteLE16( (UInt16)mipmap->GetHeight() ); + stream.WriteLE16( (uint16_t)mipmap->GetWidth() ); + stream.WriteLE16( (uint16_t)mipmap->GetHeight() ); stream.WriteByte( 24 ); stream.WriteByte( 0 ); diff --git a/Sources/Plasma/PubUtilLib/plGImage/plTGAWriter.h b/Sources/Plasma/PubUtilLib/plGImage/plTGAWriter.h index 3f38a68b..9a55e837 100644 --- a/Sources/Plasma/PubUtilLib/plGImage/plTGAWriter.h +++ b/Sources/Plasma/PubUtilLib/plGImage/plTGAWriter.h @@ -53,7 +53,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #ifndef _plTGAWriter_h #define _plTGAWriter_h -#include "hsTypes.h" +#include "HeadSpin.h" class plMipmap; diff --git a/Sources/Plasma/PubUtilLib/plGImage/plWinFontCache.cpp b/Sources/Plasma/PubUtilLib/plGImage/plWinFontCache.cpp index 87f7c65d..f64acfc7 100644 --- a/Sources/Plasma/PubUtilLib/plGImage/plWinFontCache.cpp +++ b/Sources/Plasma/PubUtilLib/plGImage/plWinFontCache.cpp @@ -58,8 +58,8 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // // /////////////////////////////////////////////////////////////////////////////// -#include "hsTypes.h" -#include "hsWindows.h" +#include "HeadSpin.h" + #include "plWinFontCache.h" #include "plStatusLog/plStatusLog.h" @@ -93,7 +93,7 @@ plWinFontCache &plWinFontCache::GetInstance( void ) return cache; } -HFONT plWinFontCache::IFindFont( const char *face, int height, int weight, hsBool italic, UInt32 quality ) +HFONT plWinFontCache::IFindFont( const char *face, int height, int weight, hsBool italic, uint32_t quality ) { int i; @@ -114,7 +114,7 @@ HFONT plWinFontCache::IFindFont( const char *face, int height, int weight, hsB return nil; } -HFONT plWinFontCache::IMakeFont( const char *face, int height, int weight, hsBool italic, UInt32 quality ) +HFONT plWinFontCache::IMakeFont( const char *face, int height, int weight, hsBool italic, uint32_t quality ) { plFontRecord myRec; int i; @@ -206,7 +206,7 @@ HFONT plWinFontCache::IMakeFont( const char *face, int height, int weight, hsB return myRec.fFont; } -HFONT plWinFontCache::GetMeAFont( const char *face, int height, int weight, hsBool italic, UInt32 quality ) +HFONT plWinFontCache::GetMeAFont( const char *face, int height, int weight, hsBool italic, uint32_t quality ) { HFONT font = IFindFont( face, height, weight, italic, quality ); if( font == nil ) @@ -287,7 +287,7 @@ void plWinFontCache::ILoadCustomFonts( void ) if( numAdded > 0 ) { plStatusLog::AddLineS( "pipeline.log", "WinFontCache: Added custom font %s, %d fonts", fileName, numAdded ); - fCustFonts.Append( TRACKED_NEW plCustFont( fileName ) ); + fCustFonts.Append( new plCustFont( fileName ) ); } else { diff --git a/Sources/Plasma/PubUtilLib/plGImage/plWinFontCache.h b/Sources/Plasma/PubUtilLib/plGImage/plWinFontCache.h index b01075e3..0ca1830f 100644 --- a/Sources/Plasma/PubUtilLib/plGImage/plWinFontCache.h +++ b/Sources/Plasma/PubUtilLib/plGImage/plWinFontCache.h @@ -63,7 +63,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "hsColorRGBA.h" -#include "hsWindows.h" // EVIL + // EVIL #include "hsTemplates.h" #if HS_BUILD_FOR_WIN32 @@ -84,7 +84,7 @@ class plWinFontCache int fHeight; int fWeight; hsBool fItalic; - UInt32 fQuality; + uint32_t fQuality; }; class plCustFont @@ -106,8 +106,8 @@ class plWinFontCache plWinFontCache(); - HFONT IFindFont( const char *face, int height, int weight, hsBool italic, UInt32 quality ); - HFONT IMakeFont( const char *face, int height, int weight, hsBool italic, UInt32 quality ); + HFONT IFindFont( const char *face, int height, int weight, hsBool italic, uint32_t quality ); + HFONT IMakeFont( const char *face, int height, int weight, hsBool italic, uint32_t quality ); void ILoadCustomFonts( void ); @@ -116,7 +116,7 @@ class plWinFontCache virtual ~plWinFontCache(); static plWinFontCache &GetInstance( void ); - HFONT GetMeAFont( const char *face, int height, int weight, hsBool italic, UInt32 quality ); + HFONT GetMeAFont( const char *face, int height, int weight, hsBool italic, uint32_t quality ); void FreeFont( HFONT font ); void Clear( void ); diff --git a/Sources/Plasma/PubUtilLib/plGLight/plDirectShadowMaster.cpp b/Sources/Plasma/PubUtilLib/plGLight/plDirectShadowMaster.cpp index d089c681..fb46fd45 100644 --- a/Sources/Plasma/PubUtilLib/plGLight/plDirectShadowMaster.cpp +++ b/Sources/Plasma/PubUtilLib/plGLight/plDirectShadowMaster.cpp @@ -40,7 +40,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "plDirectShadowMaster.h" #include "plShadowSlave.h" @@ -73,9 +73,9 @@ plDirectShadowMaster::~plDirectShadowMaster() plShadowSlave* plDirectShadowMaster::INewSlave(const plShadowCaster* caster) { if( caster->GetPerspective() ) - return TRACKED_NEW plPerspDirSlave; + return new plPerspDirSlave; - return TRACKED_NEW plDirectShadowSlave; + return new plDirectShadowSlave; } plShadowSlave* plDirectShadowMaster::INextSlave(const plShadowCaster* caster) @@ -172,7 +172,7 @@ void plDirectShadowMaster::IComputeISect(const hsBounds3Ext& casterBnd, plShadow fIsectPool.ExpandAndZero(iIsect+1); if( !fIsectPool[iIsect] ) { - fIsectPool[iIsect] = TRACKED_NEW plBoundsIsect; + fIsectPool[iIsect] = new plBoundsIsect; } plBoundsIsect* isect = fIsectPool[iIsect]; diff --git a/Sources/Plasma/PubUtilLib/plGLight/plLightInfo.cpp b/Sources/Plasma/PubUtilLib/plGLight/plLightInfo.cpp index 03896355..9b86ac3f 100644 --- a/Sources/Plasma/PubUtilLib/plGLight/plLightInfo.cpp +++ b/Sources/Plasma/PubUtilLib/plGLight/plLightInfo.cpp @@ -40,7 +40,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "plLightInfo.h" #include "plLightKonstants.h" #include "hsBounds.h" @@ -74,8 +74,8 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // heinous #include "plNetClient/plNetClientMgr.h" #include "pnMessage/plEnableMsg.h" -static hsScalar kMaxYon = 1000.f; -static hsScalar kMinHither = 1.f; +static float kMaxYon = 1000.f; +static float kMinHither = 1.f; #include "plLightProxy.h" @@ -102,7 +102,7 @@ plLightInfo::plLightInfo() fNextDevPtr = nil; fPrevDevPtr = nil; - fProxyGen = TRACKED_NEW plLightProxy; + fProxyGen = new plLightProxy; fProxyGen->Init(this); fRegisteredForRenderMsg = false; @@ -141,9 +141,9 @@ void plLightInfo::IRefresh() void plLightInfo::ICheckMaxStrength() { - hsScalar r = GetDiffuse().r >= 0 ? GetDiffuse().r : -GetDiffuse().r; - hsScalar g = GetDiffuse().g >= 0 ? GetDiffuse().g : -GetDiffuse().g; - hsScalar b = GetDiffuse().b >= 0 ? GetDiffuse().b : -GetDiffuse().b; + float r = GetDiffuse().r >= 0 ? GetDiffuse().r : -GetDiffuse().r; + float g = GetDiffuse().g >= 0 ? GetDiffuse().g : -GetDiffuse().g; + float b = GetDiffuse().b >= 0 ? GetDiffuse().b : -GetDiffuse().b; fMaxStrength = r > g ? ( @@ -157,11 +157,11 @@ void plLightInfo::ICheckMaxStrength() : b ); - const hsScalar kMinMaxStrength = 1.e-2f; + const float kMinMaxStrength = 1.e-2f; SetZero(fMaxStrength < kMinMaxStrength); } -void plLightInfo::GetStrengthAndScale(const hsBounds3Ext& bnd, hsScalar& strength, hsScalar& scale) const +void plLightInfo::GetStrengthAndScale(const hsBounds3Ext& bnd, float& strength, float& scale) const { if( IsIdle() ) { @@ -215,7 +215,7 @@ void plLightInfo::GetAffected(const plSpaceTree* space, hsBitVector& list, hsBoo } } -const hsTArray& plLightInfo::GetAffected(plSpaceTree* space, const hsTArray& visList, hsTArray& litList, hsBool charac) +const hsTArray& plLightInfo::GetAffected(plSpaceTree* space, const hsTArray& visList, hsTArray& litList, hsBool charac) { Refresh(); @@ -469,9 +469,9 @@ void plLightInfo::Read(hsStream* s, hsResMgr* mgr) fLocalToWorld = fLightToWorld * fLocalToLight; fWorldToLocal = fLightToLocal * fWorldToLight; - mgr->ReadKeyNotifyMe(s, TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnCreate, 0, kProjection), plRefFlags::kActiveRef); + mgr->ReadKeyNotifyMe(s, new plGenRefMsg(GetKey(), plRefMsg::kOnCreate, 0, kProjection), plRefFlags::kActiveRef); - mgr->ReadKeyNotifyMe(s, TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnCreate, 0, kSoftVolume), plRefFlags::kActiveRef); + mgr->ReadKeyNotifyMe(s, new plGenRefMsg(GetKey(), plRefMsg::kOnCreate, 0, kSoftVolume), plRefFlags::kActiveRef); // Let our sceneNode know we're here. plKey nodeKey = mgr->ReadKey(s); @@ -481,7 +481,7 @@ void plLightInfo::Read(hsStream* s, hsResMgr* mgr) fVisRegions.SetCountAndZero(n); int i; for( i = 0; i < n; i++ ) - mgr->ReadKeyNotifyMe(s, TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnCreate, 0, kVisRegion), plRefFlags::kActiveRef); + mgr->ReadKeyNotifyMe(s, new plGenRefMsg(GetKey(), plRefMsg::kOnCreate, 0, kVisRegion), plRefFlags::kActiveRef); SetDirty(true); } @@ -519,7 +519,7 @@ void plLightInfo::ISetSceneNode(plKey node) { if( node ) { - plNodeRefMsg* refMsg = TRACKED_NEW plNodeRefMsg(node, plRefMsg::kOnCreate, -1, plNodeRefMsg::kLight); + plNodeRefMsg* refMsg = new plNodeRefMsg(node, plRefMsg::kOnCreate, -1, plNodeRefMsg::kLight); hsgResMgr::ResMgr()->AddViaNotify(GetKey(), refMsg, plRefFlags::kPassiveRef); } if( fSceneNode ) @@ -592,7 +592,7 @@ plDirectionalLightInfo::~plDirectionalLightInfo() { } -void plDirectionalLightInfo::GetStrengthAndScale(const hsBounds3Ext& bnd, hsScalar& strength, hsScalar& scale) const +void plDirectionalLightInfo::GetStrengthAndScale(const hsBounds3Ext& bnd, float& strength, float& scale) const { plLightInfo::GetStrengthAndScale(bnd, strength, scale); } @@ -637,8 +637,8 @@ void plLimitedDirLightInfo::IRefresh() hsMatrix44 l2ndc; l2ndc.Reset(); - hsScalar width = fWidth; - hsScalar height = fHeight; + float width = fWidth; + float height = fHeight; l2ndc.fMap[0][0] = 1.f / width; l2ndc.fMap[0][3] = 0.5f; @@ -658,7 +658,7 @@ void plLimitedDirLightInfo::IRefresh() } } -void plLimitedDirLightInfo::GetStrengthAndScale(const hsBounds3Ext& bnd, hsScalar& strength, hsScalar& scale) const +void plLimitedDirLightInfo::GetStrengthAndScale(const hsBounds3Ext& bnd, float& strength, float& scale) const { // If we haven't culled the object, return that we're full strength. plLightInfo::GetStrengthAndScale(bnd, strength, scale); @@ -685,14 +685,14 @@ void plLimitedDirLightInfo::Write(hsStream* s, hsResMgr* mgr) void plLimitedDirLightInfo::IMakeIsect() { if( !fParPlanes ) - fParPlanes = TRACKED_NEW plParallelIsect; + fParPlanes = new plParallelIsect; fParPlanes->SetNumPlanes(3); hsPoint3 p0, p1; - hsScalar width = fWidth; - hsScalar height = fHeight; + float width = fWidth; + float height = fHeight; p0.Set(-width*0.5f, 0, 0); p1.Set(width*0.5f, 0, 0); fParPlanes->SetPlane(0, p0, p1); @@ -712,7 +712,7 @@ void plLimitedDirLightInfo::IMakeIsect() // Creates a new box drawable for showing the light's // influence. -plDrawableSpans* plLimitedDirLightInfo::CreateProxy(hsGMaterial* mat, hsTArray& idx, plDrawableSpans* addTo) +plDrawableSpans* plLimitedDirLightInfo::CreateProxy(hsGMaterial* mat, hsTArray& idx, plDrawableSpans* addTo) { hsPoint3 corner; corner.Set(-fWidth*0.5f, -fHeight*0.5f, -fDepth); @@ -752,11 +752,11 @@ plOmniLightInfo::~plOmniLightInfo() void plOmniLightInfo::IMakeIsect() { - fSphere = TRACKED_NEW plSphereIsect; + fSphere = new plSphereIsect; fSphere->SetTransform(fLightToWorld, fWorldToLight); } -void plOmniLightInfo::GetStrengthAndScale(const hsBounds3Ext& bnd, hsScalar& strength, hsScalar& scale) const +void plOmniLightInfo::GetStrengthAndScale(const hsBounds3Ext& bnd, float& strength, float& scale) const { plLightInfo::GetStrengthAndScale(bnd, strength, scale); @@ -764,7 +764,7 @@ void plOmniLightInfo::GetStrengthAndScale(const hsBounds3Ext& bnd, hsScalar& str const hsPoint3& pos = bnd.GetCenter(); hsPoint3 wpos = GetWorldPosition(); - hsScalar dist = hsVector3(&pos, &wpos).MagnitudeSquared(); + float dist = hsVector3(&pos, &wpos).MagnitudeSquared(); dist = 1.f / hsFastMath::InvSqrtAppr(dist); if( fAttenQuadratic > 0 ) { @@ -785,16 +785,16 @@ void plOmniLightInfo::GetStrengthAndScale(const hsBounds3Ext& bnd, hsScalar& str } } -hsScalar plOmniLightInfo::GetRadius() const +float plOmniLightInfo::GetRadius() const { - hsScalar radius = 0; + float radius = 0; if( fAttenQuadratic > 0 ) { - hsScalar mult = fDiffuse.a >= 0 ? fDiffuse.a : -fDiffuse.a; - hsScalar det = fAttenLinear*fAttenLinear - 4.f * fAttenQuadratic * fAttenConst * (1.f - mult * plSillyLightKonstants::GetFarPowerKonst()); + float mult = fDiffuse.a >= 0 ? fDiffuse.a : -fDiffuse.a; + float det = fAttenLinear*fAttenLinear - 4.f * fAttenQuadratic * fAttenConst * (1.f - mult * plSillyLightKonstants::GetFarPowerKonst()); if( det > 0 ) { - det = hsSquareRoot(det); + det = sqrt(det); radius = -fAttenLinear + det; radius /= fAttenQuadratic * 2.f; @@ -804,7 +804,7 @@ hsScalar plOmniLightInfo::GetRadius() const } else if( fAttenLinear > 0 ) { - hsScalar mult = fDiffuse.a >= 0 ? fDiffuse.a : -fDiffuse.a; + float mult = fDiffuse.a >= 0 ? fDiffuse.a : -fDiffuse.a; radius = (mult * plSillyLightKonstants::GetFarPowerKonst() - 1.f ) * fAttenConst / fAttenLinear; } else if( fAttenCutoff > 0 ) @@ -864,7 +864,7 @@ void plOmniLightInfo::Write(hsStream* s, hsResMgr* mgr) // Creates a new sphere drawable for showing the omnilight's // sphere (haha) of influence. -plDrawableSpans* plOmniLightInfo::CreateProxy(hsGMaterial* mat, hsTArray& idx, plDrawableSpans* addTo) +plDrawableSpans* plOmniLightInfo::CreateProxy(hsGMaterial* mat, hsTArray& idx, plDrawableSpans* addTo) { float rad = GetRadius(); if( rad == 0 ) @@ -887,8 +887,8 @@ plDrawableSpans* plOmniLightInfo::CreateProxy(hsGMaterial* mat, hsTArray // Spot plSpotLightInfo::plSpotLightInfo() : fFalloff(1.f), - fSpotInner(hsScalarPI * 0.125f), - fSpotOuter(hsScalarPI * 0.25f), + fSpotInner(M_PI * 0.125f), + fSpotOuter(M_PI * 0.25f), fCone(nil) { } @@ -898,7 +898,7 @@ plSpotLightInfo::~plSpotLightInfo() delete fCone; } -void plSpotLightInfo::GetStrengthAndScale(const hsBounds3Ext& bnd, hsScalar& strength, hsScalar& scale) const +void plSpotLightInfo::GetStrengthAndScale(const hsBounds3Ext& bnd, float& strength, float& scale) const { plOmniLightInfo::GetStrengthAndScale(bnd, strength, scale); @@ -908,13 +908,13 @@ void plSpotLightInfo::GetStrengthAndScale(const hsBounds3Ext& bnd, hsScalar& str hsVector3 del; hsPoint3 wpos = GetWorldPosition(); del.Set(&pos, &wpos); - hsScalar invDist = del.MagnitudeSquared(); + float invDist = del.MagnitudeSquared(); invDist = hsFastMath::InvSqrtAppr(invDist); - hsScalar dot = del.InnerProduct(GetWorldDirection()); + float dot = del.InnerProduct(GetWorldDirection()); dot *= invDist; - hsScalar cosInner, cosOuter, t; + float cosInner, cosOuter, t; hsFastMath::SinCosInRangeAppr(fSpotInner, t, cosInner); hsFastMath::SinCosInRangeAppr(fSpotOuter, t, cosOuter); if( dot < cosOuter ) @@ -925,7 +925,7 @@ void plSpotLightInfo::GetStrengthAndScale(const hsBounds3Ext& bnd, hsScalar& str void plSpotLightInfo::IMakeIsect() { - fCone = TRACKED_NEW plConeIsect; + fCone = new plConeIsect; fCone->SetTransform(fLightToWorld, fWorldToLight); } @@ -936,7 +936,7 @@ void plSpotLightInfo::IRefresh() if( !fCone ) IMakeIsect(); - hsScalar effFOV = fSpotOuter; + float effFOV = fSpotOuter; fCone->SetAngle(effFOV); @@ -948,12 +948,12 @@ void plSpotLightInfo::IRefresh() if( GetProjection() ) { - hsScalar yon = GetRadius(); + float yon = GetRadius(); if( yon < kMinHither ) yon = kMaxYon; - hsScalar hither = hsMinimum(kMinHither, yon * 0.5f); + float hither = hsMinimum(kMinHither, yon * 0.5f); - hsScalar sinFOV, cosFOV; + float sinFOV, cosFOV; hsFastMath::SinCos(effFOV, sinFOV, cosFOV); hsMatrix44 l2ndc; @@ -1000,7 +1000,7 @@ hsVector3 plSpotLightInfo::GetWorldDirection() const // Generates a new drawable for showing the spotlight's // sphere of influence. -plDrawableSpans* plSpotLightInfo::CreateProxy(hsGMaterial* mat, hsTArray& idx, plDrawableSpans* addTo) +plDrawableSpans* plSpotLightInfo::CreateProxy(hsGMaterial* mat, hsTArray& idx, plDrawableSpans* addTo) { float rad = GetRadius(); float x, y; diff --git a/Sources/Plasma/PubUtilLib/plGLight/plLightInfo.h b/Sources/Plasma/PubUtilLib/plGLight/plLightInfo.h index 573baa46..1edc397e 100644 --- a/Sources/Plasma/PubUtilLib/plGLight/plLightInfo.h +++ b/Sources/Plasma/PubUtilLib/plGLight/plLightInfo.h @@ -104,7 +104,7 @@ protected: kVolEmpty = 0x2, kVolZero = 0x4 }; - UInt8 fVolFlags; + uint8_t fVolFlags; hsBitVector fVisSet; hsBitVector fVisNot; @@ -136,7 +136,7 @@ protected: plSoftVolume* fSoftVolume; - hsScalar fMaxStrength; + float fMaxStrength; hsBool fRegisteredForRenderMsg; @@ -183,12 +183,12 @@ public: void SetShadowCaster(hsBool on) { SetProperty(kLPCastShadows, on); } void Refresh() { if( IsDirty() ) { IRefresh(); SetDirty(false); } } - virtual void GetStrengthAndScale(const hsBounds3Ext& bnd, hsScalar& strength, hsScalar& scale) const; + virtual void GetStrengthAndScale(const hsBounds3Ext& bnd, float& strength, float& scale) const; hsBool AffectsBound(const hsBounds3Ext& bnd) { return IGetIsect() ? IGetIsect()->Test(bnd) != kVolumeCulled : true; } void GetAffectedForced(const plSpaceTree* space, hsBitVector& list, hsBool charac); void GetAffected(const plSpaceTree* space, hsBitVector& list, hsBool charac); - const hsTArray& GetAffected(plSpaceTree* space, const hsTArray& visList, hsTArray& litList, hsBool charac); + const hsTArray& GetAffected(plSpaceTree* space, const hsTArray& visList, hsTArray& litList, hsBool charac); hsBool InVisSet(const hsBitVector& visSet) const { return fVisSet.Overlap(visSet); } hsBool InVisNot(const hsBitVector& visNot) const { return fVisNot.Overlap(visNot); } @@ -210,7 +210,7 @@ public: virtual const hsMatrix44& GetLightToWorld() const; virtual const hsMatrix44& GetWorldToLight() const; - virtual Int32 GetNumProperties() const { return kNumProps; } + virtual int32_t GetNumProperties() const { return kNumProps; } const plSoftVolume* GetSoftVolume() const { return fSoftVolume; } @@ -238,7 +238,7 @@ public: void SetLocalToLight(const hsMatrix44& l2lt, const hsMatrix44& lt2l); // Visualization - virtual plDrawableSpans* CreateProxy(hsGMaterial* mat, hsTArray& idx, plDrawableSpans* addTo) { return addTo; } + virtual plDrawableSpans* CreateProxy(hsGMaterial* mat, hsTArray& idx, plDrawableSpans* addTo) { return addTo; } }; @@ -256,7 +256,7 @@ public: CLASSNAME_REGISTER( plDirectionalLightInfo ); GETINTERFACE_ANY( plDirectionalLightInfo, plLightInfo ); - virtual void GetStrengthAndScale(const hsBounds3Ext& bnd, hsScalar& strength, hsScalar& scale) const; + virtual void GetStrengthAndScale(const hsBounds3Ext& bnd, float& strength, float& scale) const; hsVector3 GetWorldDirection() const; virtual hsVector3 GetNegativeWorldDirection(const hsPoint3& pos) const { return -GetWorldDirection(); } @@ -270,9 +270,9 @@ class plLimitedDirLightInfo : public plDirectionalLightInfo { protected: - hsScalar fWidth; - hsScalar fHeight; - hsScalar fDepth; + float fWidth; + float fHeight; + float fDepth; plParallelIsect* fParPlanes; @@ -288,31 +288,31 @@ public: CLASSNAME_REGISTER( plLimitedDirLightInfo ); GETINTERFACE_ANY( plLimitedDirLightInfo, plDirectionalLightInfo ); - virtual void GetStrengthAndScale(const hsBounds3Ext& bnd, hsScalar& strength, hsScalar& scale) const; + virtual void GetStrengthAndScale(const hsBounds3Ext& bnd, float& strength, float& scale) const; - hsScalar GetWidth() const { return fWidth; } - hsScalar GetHeight() const { return fHeight; } - hsScalar GetDepth() const { return fDepth; } + float GetWidth() const { return fWidth; } + float GetHeight() const { return fHeight; } + float GetDepth() const { return fDepth; } - void SetWidth(hsScalar w) { fWidth = w; } - void SetHeight(hsScalar h) { fHeight = h; } - void SetDepth(hsScalar d) { fDepth = d; } + void SetWidth(float w) { fWidth = w; } + void SetHeight(float h) { fHeight = h; } + void SetDepth(float d) { fDepth = d; } virtual void Read(hsStream* stream, hsResMgr* mgr); virtual void Write(hsStream* stream, hsResMgr* mgr); // Visualization - virtual plDrawableSpans* CreateProxy(hsGMaterial* mat, hsTArray& idx, plDrawableSpans* addTo); + virtual plDrawableSpans* CreateProxy(hsGMaterial* mat, hsTArray& idx, plDrawableSpans* addTo); }; class plOmniLightInfo : public plLightInfo { protected: // Omni and spot - hsScalar fAttenConst; - hsScalar fAttenLinear; - hsScalar fAttenQuadratic; - hsScalar fAttenCutoff; // Only for attenuate-but-not-really mode, 0 otherwise + float fAttenConst; + float fAttenLinear; + float fAttenQuadratic; + float fAttenCutoff; // Only for attenuate-but-not-really mode, 0 otherwise plSphereIsect* fSphere; @@ -329,29 +329,29 @@ public: CLASSNAME_REGISTER( plOmniLightInfo ); GETINTERFACE_ANY( plOmniLightInfo, plLightInfo ); - virtual void GetStrengthAndScale(const hsBounds3Ext& bnd, hsScalar& strength, hsScalar& scale) const; + virtual void GetStrengthAndScale(const hsBounds3Ext& bnd, float& strength, float& scale) const; virtual hsVector3 GetNegativeWorldDirection(const hsPoint3& pos) const; hsBool IsAttenuated() const { return (fAttenLinear != 0)||(fAttenQuadratic != 0) || ( fAttenCutoff != 0 ); } - hsScalar GetRadius() const; + float GetRadius() const; - hsScalar GetConstantAttenuation() const { return fAttenConst; } - hsScalar GetLinearAttenuation() const { return fAttenLinear; } - hsScalar GetQuadraticAttenuation() const { return fAttenQuadratic; } - hsScalar GetCutoffAttenuation() const { return fAttenCutoff; } + float GetConstantAttenuation() const { return fAttenConst; } + float GetLinearAttenuation() const { return fAttenLinear; } + float GetQuadraticAttenuation() const { return fAttenQuadratic; } + float GetCutoffAttenuation() const { return fAttenCutoff; } hsPoint3 GetWorldPosition() const { return fLightToWorld.GetTranslate(); } - void SetConstantAttenuation(hsScalar a) { fAttenConst = a; SetDirty(true); } - void SetLinearAttenuation(hsScalar a) { fAttenLinear = a; SetDirty(true); } - void SetQuadraticAttenuation(hsScalar a) { fAttenQuadratic = a; SetDirty(true); } - void SetCutoffAttenuation( hsScalar a ) { fAttenCutoff = a; SetDirty( true ); } + void SetConstantAttenuation(float a) { fAttenConst = a; SetDirty(true); } + void SetLinearAttenuation(float a) { fAttenLinear = a; SetDirty(true); } + void SetQuadraticAttenuation(float a) { fAttenQuadratic = a; SetDirty(true); } + void SetCutoffAttenuation( float a ) { fAttenCutoff = a; SetDirty( true ); } virtual void Read(hsStream* stream, hsResMgr* mgr); virtual void Write(hsStream* stream, hsResMgr* mgr); // Visualization - virtual plDrawableSpans* CreateProxy(hsGMaterial* mat, hsTArray& idx, plDrawableSpans* addTo); + virtual plDrawableSpans* CreateProxy(hsGMaterial* mat, hsTArray& idx, plDrawableSpans* addTo); }; @@ -359,13 +359,13 @@ class plSpotLightInfo : public plOmniLightInfo { protected: // Valid only for spot - hsScalar fFalloff; + float fFalloff; // Note - these are half angles, D3D wants whole angles, so fSpotInner*2 etc. - hsScalar fSpotInner; - hsScalar fSpotOuter; + float fSpotInner; + float fSpotOuter; - hsScalar fEffectiveFOV; + float fEffectiveFOV; plConeIsect* fCone; @@ -381,24 +381,24 @@ public: CLASSNAME_REGISTER( plSpotLightInfo ); GETINTERFACE_ANY( plSpotLightInfo, plOmniLightInfo ); - virtual void GetStrengthAndScale(const hsBounds3Ext& bnd, hsScalar& strength, hsScalar& scale) const; + virtual void GetStrengthAndScale(const hsBounds3Ext& bnd, float& strength, float& scale) const; hsVector3 GetWorldDirection() const; virtual hsVector3 GetNegativeWorldDirection(const hsPoint3& pos) const { return -GetWorldDirection(); } - void SetFalloff(hsScalar f) { fFalloff = f; SetDirty(true); } - void SetSpotInner(hsScalar rads) { fSpotInner = rads; SetDirty(true); } - void SetSpotOuter(hsScalar rads) { fSpotOuter = rads; SetDirty(true); } + void SetFalloff(float f) { fFalloff = f; SetDirty(true); } + void SetSpotInner(float rads) { fSpotInner = rads; SetDirty(true); } + void SetSpotOuter(float rads) { fSpotOuter = rads; SetDirty(true); } - hsScalar GetFalloff() const { return fFalloff; } - hsScalar GetSpotInner() const { return fSpotInner; } - hsScalar GetSpotOuter() const { return fSpotOuter; } + float GetFalloff() const { return fFalloff; } + float GetSpotInner() const { return fSpotInner; } + float GetSpotOuter() const { return fSpotOuter; } virtual void Read(hsStream* stream, hsResMgr* mgr); virtual void Write(hsStream* stream, hsResMgr* mgr); // Visualization - virtual plDrawableSpans* CreateProxy(hsGMaterial* mat, hsTArray& idx, plDrawableSpans* addTo); + virtual plDrawableSpans* CreateProxy(hsGMaterial* mat, hsTArray& idx, plDrawableSpans* addTo); }; diff --git a/Sources/Plasma/PubUtilLib/plGLight/plLightProxy.cpp b/Sources/Plasma/PubUtilLib/plGLight/plLightProxy.cpp index 387915c0..5accfcbe 100644 --- a/Sources/Plasma/PubUtilLib/plGLight/plLightProxy.cpp +++ b/Sources/Plasma/PubUtilLib/plGLight/plLightProxy.cpp @@ -40,7 +40,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "plLightProxy.h" #include "plLightInfo.h" #include "plDrawable/plDrawableSpans.h" @@ -72,7 +72,7 @@ plKey plLightProxy::IGetNode() const return fOwner ? fOwner->GetSceneNode() : nil; } -plDrawableSpans* plLightProxy::ICreateProxy(hsGMaterial* mat, hsTArray& idx, plDrawableSpans* addTo) +plDrawableSpans* plLightProxy::ICreateProxy(hsGMaterial* mat, hsTArray& idx, plDrawableSpans* addTo) { if( fOwner ) { diff --git a/Sources/Plasma/PubUtilLib/plGLight/plLightProxy.h b/Sources/Plasma/PubUtilLib/plGLight/plLightProxy.h index 6f2cbf2e..cebd35bb 100644 --- a/Sources/Plasma/PubUtilLib/plGLight/plLightProxy.h +++ b/Sources/Plasma/PubUtilLib/plGLight/plLightProxy.h @@ -53,7 +53,7 @@ protected: plLightInfo* fOwner; - virtual plDrawableSpans* ICreateProxy(hsGMaterial* mat, hsTArray& idx, plDrawableSpans* addTo=nil); + virtual plDrawableSpans* ICreateProxy(hsGMaterial* mat, hsTArray& idx, plDrawableSpans* addTo=nil); virtual plKey IGetNode() const; public: plLightProxy(); diff --git a/Sources/Plasma/PubUtilLib/plGLight/plLightSpace.cpp b/Sources/Plasma/PubUtilLib/plGLight/plLightSpace.cpp index c42005d1..e9a38a1e 100644 --- a/Sources/Plasma/PubUtilLib/plGLight/plLightSpace.cpp +++ b/Sources/Plasma/PubUtilLib/plGLight/plLightSpace.cpp @@ -40,7 +40,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "plLightSpace.h" #include "hsStream.h" #include "hsResMgr.h" @@ -58,8 +58,8 @@ hsBool plLightSpace::MsgReceive(plMessage* msg) // which is entering and leaving, and whether it is entering or leaving. plKey otherKey = nil; hsBool enter = true; - UInt8 ctx = enter ? plRefMsg::kOnRequest : plRefMsg::kOnRemove; - plLightRefMsg* liMsg = TRACKED_NEW plLightRefMsg(GetKey(), otherKey, IGetLightInfo(), ctx); + uint8_t ctx = enter ? plRefMsg::kOnRequest : plRefMsg::kOnRemove; + plLightRefMsg* liMsg = new plLightRefMsg(GetKey(), otherKey, IGetLightInfo(), ctx); plgDispatch::MsgSend(liMsg); return true; } @@ -80,7 +80,7 @@ void plLightSpace::Read(hsStream* s, hsResMgr* mgr) { plMultiModifier::Read(s, mgr); - mgr->ReadKeyNotifyMe(s, TRACKED_NEW plLightRefMsg(nil, GetKey(), nil, plRefMsg::kOnCreate), plRefFlags::kPassiveRef); + mgr->ReadKeyNotifyMe(s, new plLightRefMsg(nil, GetKey(), nil, plRefMsg::kOnCreate), plRefFlags::kPassiveRef); } void plLightSpace::Write(hsStream* s, hsResMgr* mgr) diff --git a/Sources/Plasma/PubUtilLib/plGLight/plLightSpace.h b/Sources/Plasma/PubUtilLib/plGLight/plLightSpace.h index 046a1580..d357ed7a 100644 --- a/Sources/Plasma/PubUtilLib/plGLight/plLightSpace.h +++ b/Sources/Plasma/PubUtilLib/plGLight/plLightSpace.h @@ -62,7 +62,7 @@ public: CLASSNAME_REGISTER( plLightSpace ); GETINTERFACE_ANY( plLightSpace, plMultiModifier ); - virtual hsBool IEval(double secs, hsScalar del, UInt32 dirty) { return false; } + virtual hsBool IEval(double secs, float del, uint32_t dirty) { return false; } virtual void Read(hsStream* s, hsResMgr* mgr); virtual void Write(hsStream* s, hsResMgr* mgr); diff --git a/Sources/Plasma/PubUtilLib/plGLight/plPerspDirSlave.cpp b/Sources/Plasma/PubUtilLib/plGLight/plPerspDirSlave.cpp index 97e2e318..52476bf5 100644 --- a/Sources/Plasma/PubUtilLib/plGLight/plPerspDirSlave.cpp +++ b/Sources/Plasma/PubUtilLib/plGLight/plPerspDirSlave.cpp @@ -40,7 +40,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "plPipeline.h" #include "plTweak.h" #include "hsFastMath.h" @@ -60,7 +60,7 @@ void plPerspDirSlave::Init() fFlags |= kCastInCameraSpace; } -hsPoint3 plPerspDirSlave::IProject(const hsMatrix44& world2NDC, const hsPoint3& pos, hsScalar w) const +hsPoint3 plPerspDirSlave::IProject(const hsMatrix44& world2NDC, const hsPoint3& pos, float w) const { hsPoint3 retVal; retVal.fX = world2NDC.fMap[0][0] * pos.fX @@ -78,7 +78,7 @@ hsPoint3 plPerspDirSlave::IProject(const hsMatrix44& world2NDC, const hsPoint3& + world2NDC.fMap[2][2] * pos.fZ + world2NDC.fMap[2][3] * w; - hsScalar invW = 1.f / ( + float invW = 1.f / ( world2NDC.fMap[3][0] * pos.fX + world2NDC.fMap[3][1] * pos.fY + world2NDC.fMap[3][2] * pos.fZ @@ -125,8 +125,8 @@ bool plPerspDirSlave::SetupViewTransform(plPipeline* pipe) { plViewTransform pipeView = pipe->GetViewTransform(); - plConst(hsScalar) kYon(100.f); - plConst(hsScalar) kHither(30.f); + plConst(float) kYon(100.f); + plConst(float) kHither(30.f); pipeView.SetHither(kHither); pipeView.SetYon(kYon); @@ -153,7 +153,7 @@ bool plPerspDirSlave::SetupViewTransform(plPipeline* pipe) } else if( kUseFrustCenter ) { - plConst(hsScalar) kDist(50.f); + plConst(float) kDist(50.f); hsPoint3 camFrustCenter(0.f, 0.f, kDist); lookAt = IProject(cam2NDC, camFrustCenter); } @@ -167,8 +167,8 @@ bool plPerspDirSlave::SetupViewTransform(plPipeline* pipe) hsMatrix44 li2CamNDC; IComputeCamNDCToLight(perspLiPos, lookAt, camNDC2Li, li2CamNDC); - hsScalar minZ, maxZ; - hsScalar cotX, cotY; + float minZ, maxZ; + float cotX, cotY; plConst(hsBool) kFixedPersp(true); if( !kFixedPersp ) @@ -197,13 +197,13 @@ bool plPerspDirSlave::SetupViewTransform(plPipeline* pipe) plConst(hsBool) kFakeDepth(false); if( kFakeDepth ) { - plConst(hsScalar) kMin(1.f); - plConst(hsScalar) kMax(30.f); + plConst(float) kMin(1.f); + plConst(float) kMax(30.f); minZ = kMin; maxZ = kMax; } - plConst(hsScalar) kMinMinZ(1.f); + plConst(float) kMinMinZ(1.f); if( minZ < kMinMinZ ) minZ = kMinMinZ; @@ -231,7 +231,7 @@ bool plPerspDirSlave::SetupViewTransform(plPipeline* pipe) } else { - plConst(hsScalar) kHi(1.f); + plConst(float) kHi(1.f); hsBounds3Ext bnd; const hsPoint3 lo(-1.f, -1.f, 0.f); const hsPoint3 hi(1.f, 1.f, kHi); @@ -254,7 +254,7 @@ bool plPerspDirSlave::SetupViewTransform(plPipeline* pipe) if (isnan(bnd.GetMaxs().fX) || isnan(bnd.GetMaxs().fY)) return false; - plConst(hsScalar) kMinMinZ(1.f); + plConst(float) kMinMinZ(1.f); if( minZ < kMinMinZ ) minZ = kMinMinZ; @@ -320,9 +320,9 @@ bool plPerspDirSlave::SetupViewTransform(plPipeline* pipe) cotX -= cotX / (fWidth * 0.5f); cotY -= cotY / (fHeight * 0.5f); - hsScalar tanX = 1.f / cotX; - hsScalar tanY = 1.f / cotY; - fView.SetScreenSize((UInt16)fWidth, (UInt16)fHeight); + float tanX = 1.f / cotX; + float tanY = 1.f / cotY; + fView.SetScreenSize((uint16_t)fWidth, (uint16_t)fHeight); fView.SetCameraTransform(pipe->GetViewTransform().GetWorldToCamera(), pipe->GetViewTransform().GetCameraToWorld()); fView.SetPerspective(true); fView.SetViewPort(0, 0, (float)fWidth, (float)fHeight, false); @@ -368,10 +368,10 @@ void plPerspDirSlave::IComputeCamNDCToLight(const hsPoint3& from, const hsPoint3 { hsVector3 atToFrom(&from, &at); - hsScalar distSq = atToFrom.MagnitudeSquared(); + float distSq = atToFrom.MagnitudeSquared(); atToFrom *= hsFastMath::InvSqrtAppr(distSq); - const hsScalar kMinMag = 0.5f; + const float kMinMag = 0.5f; hsVector3 up(0,0,1.f); if( CrossProd(up, (at - from)).MagnitudeSquared() < kMinMag ) { diff --git a/Sources/Plasma/PubUtilLib/plGLight/plPerspDirSlave.h b/Sources/Plasma/PubUtilLib/plGLight/plPerspDirSlave.h index 8bb8f6a6..a6d4a183 100644 --- a/Sources/Plasma/PubUtilLib/plGLight/plPerspDirSlave.h +++ b/Sources/Plasma/PubUtilLib/plGLight/plPerspDirSlave.h @@ -49,7 +49,7 @@ class plPerspDirSlave : public plShadowSlave { protected: hsBounds3Ext IGetPerspCasterBound(const hsMatrix44& world2NDC) const; - hsPoint3 IProject(const hsMatrix44& world2NDC, const hsPoint3& pos, hsScalar w=1.f) const; + hsPoint3 IProject(const hsMatrix44& world2NDC, const hsPoint3& pos, float w=1.f) const; void IComputeCamNDCToLight(const hsPoint3& from, const hsPoint3& at, hsMatrix44& camNDC2Li, hsMatrix44& li2CamNDC); public: diff --git a/Sources/Plasma/PubUtilLib/plGLight/plPointShadowMaster.cpp b/Sources/Plasma/PubUtilLib/plGLight/plPointShadowMaster.cpp index 162197df..fae5b86d 100644 --- a/Sources/Plasma/PubUtilLib/plGLight/plPointShadowMaster.cpp +++ b/Sources/Plasma/PubUtilLib/plGLight/plPointShadowMaster.cpp @@ -40,7 +40,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "plPointShadowMaster.h" #include "plShadowSlave.h" @@ -53,11 +53,11 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "hsBounds.h" #include "hsFastMath.h" -static const hsScalar kMinMinZ = 1.f; // totally random arbitrary number (has to be > 0). +static const float kMinMinZ = 1.f; // totally random arbitrary number (has to be > 0). -static inline void QuickNorm( hsVector3& a, hsScalar& b ) +static inline void QuickNorm( hsVector3& a, float& b ) { - hsScalar len = hsFastMath::InvSqrtAppr((a).MagnitudeSquared()); + float len = hsFastMath::InvSqrtAppr((a).MagnitudeSquared()); a *= len; b *= len; } @@ -107,7 +107,7 @@ plPointShadowMaster::~plPointShadowMaster() plShadowSlave* plPointShadowMaster::INewSlave(const plShadowCaster* caster) { - return TRACKED_NEW plPointShadowSlave; + return new plPointShadowSlave; } void plPointShadowMaster::IBeginRender() @@ -119,22 +119,22 @@ void plPointShadowMaster::IBeginRender() void plPointShadowMaster::IComputeWorldToLight(const hsBounds3Ext& bnd, plShadowSlave* slave) const { - const hsScalar kMinMag = 0.5f; + const float kMinMag = 0.5f; hsPoint3 from = fLightInfo->GetLightToWorld().GetTranslate(); hsPoint3 at = bnd.GetCenter(); hsVector3 atToFrom(&from, &at); - hsScalar distSq = atToFrom.MagnitudeSquared(); + float distSq = atToFrom.MagnitudeSquared(); atToFrom *= hsFastMath::InvSqrtAppr(distSq); hsPoint2 depth; bnd.TestPlane(atToFrom, depth); - hsScalar fromDepth = atToFrom.InnerProduct(from); + float fromDepth = atToFrom.InnerProduct(from); - hsScalar dist = fromDepth - depth.fY; + float dist = fromDepth - depth.fY; - static hsScalar kMinDist = 3.f; + static float kMinDist = 3.f; if( dist < kMinDist ) { atToFrom *= kMinDist - dist; @@ -175,7 +175,7 @@ void plPointShadowMaster::IComputeISect(const hsBounds3Ext& bnd, plShadowSlave* fIsectPool.ExpandAndZero(iIsect+1); if( !fIsectPool[iIsect] ) { - fIsectPool[iIsect] = TRACKED_NEW plBoundsIsect; + fIsectPool[iIsect] = new plBoundsIsect; } plBoundsIsect* isect = fIsectPool[iIsect]; @@ -199,10 +199,10 @@ void plPointShadowMaster::IComputeBounds(const hsBounds3Ext& wBnd, plShadowSlave hsBounds3Ext bnd = sBnd; - hsScalar dist = sBnd.GetCenter().fZ; + float dist = sBnd.GetCenter().fZ; dist += slave->fAttenDist; - hsScalar minZ = sBnd.GetMaxs().fZ; + float minZ = sBnd.GetMaxs().fZ; hsPoint3 p(sBnd.GetMins().fX * dist / minZ, sBnd.GetMins().fY * dist / minZ, dist); bnd.Union(&p); diff --git a/Sources/Plasma/PubUtilLib/plGLight/plShadowCaster.cpp b/Sources/Plasma/PubUtilLib/plGLight/plShadowCaster.cpp index 28cc7f5b..5f6e3980 100644 --- a/Sources/Plasma/PubUtilLib/plGLight/plShadowCaster.cpp +++ b/Sources/Plasma/PubUtilLib/plGLight/plShadowCaster.cpp @@ -40,7 +40,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "plShadowCaster.h" #include "plMessage/plShadowCastMsg.h" @@ -162,7 +162,7 @@ hsBool plShadowCaster::IOnRenderMsg(plRenderMsg* msg) if( ShadowCastDisabled() ) return true; - const UInt8 shadowQuality = UInt8(plShadowMaster::GetGlobalShadowQuality() * 3.9f); + const uint8_t shadowQuality = uint8_t(plShadowMaster::GetGlobalShadowQuality() * 3.9f); if( !GetKey()->GetUoid().GetLoadMask().MatchesQuality(shadowQuality) ) return true; @@ -198,7 +198,7 @@ hsBool plShadowCaster::IOnRenderMsg(plRenderMsg* msg) if( fMaxOpacity > 0 ) { - plShadowCastMsg* cast = TRACKED_NEW plShadowCastMsg(GetKey(), this, msg->Pipeline()); + plShadowCastMsg* cast = new plShadowCastMsg(GetKey(), this, msg->Pipeline()); cast->Send(); } diff --git a/Sources/Plasma/PubUtilLib/plGLight/plShadowCaster.h b/Sources/Plasma/PubUtilLib/plGLight/plShadowCaster.h index 7978cdfa..e37a6b2a 100644 --- a/Sources/Plasma/PubUtilLib/plGLight/plShadowCaster.h +++ b/Sources/Plasma/PubUtilLib/plGLight/plShadowCaster.h @@ -67,11 +67,11 @@ public: class DrawSpan { public: - DrawSpan& Set(plDrawableSpans* dr, const plSpan* sp, UInt32 idx) { fDraw = (dr); fSpan = (sp); fIndex = (idx); return *this; } + DrawSpan& Set(plDrawableSpans* dr, const plSpan* sp, uint32_t idx) { fDraw = (dr); fSpan = (sp); fIndex = (idx); return *this; } plDrawableSpans* fDraw; const plSpan* fSpan; - UInt32 fIndex; + uint32_t fIndex; }; protected: @@ -85,14 +85,14 @@ protected: // never expected to change. Anything that might be // triggered should go into plMultiModifier::fProps, // to be network synced. - UInt8 fCastFlags; + uint8_t fCastFlags; - hsScalar fBoost; - hsScalar fAttenScale; - hsScalar fBlurScale; + float fBoost; + float fAttenScale; + float fBlurScale; // Casting attributes calculated each frame. - hsScalar fMaxOpacity; + float fMaxOpacity; hsTArray fSpans; friend class plShadowMaster; @@ -110,14 +110,14 @@ public: CLASSNAME_REGISTER( plShadowCaster ); GETINTERFACE_ANY( plShadowCaster, plMultiModifier ); - virtual hsBool IEval(double secs, hsScalar del, UInt32 dirty) { return true; } + virtual hsBool IEval(double secs, float del, uint32_t dirty) { return true; } virtual hsBool MsgReceive(plMessage* msg); virtual void Read(hsStream* stream, hsResMgr* mgr); virtual void Write(hsStream* stream, hsResMgr* mgr); - hsScalar MaxOpacity() const { return fMaxOpacity; } + float MaxOpacity() const { return fMaxOpacity; } const hsTArray& Spans() const { return fSpans; } hsBool GetSelfShadow() const { return 0 != (fCastFlags & kSelfShadow); } @@ -129,14 +129,14 @@ public: hsBool GetLimitRes() const { return 0 != (fCastFlags & kLimitRes); } void SetLimitRes(hsBool on) { if(on) fCastFlags |= kLimitRes; else fCastFlags &= ~kLimitRes; } - hsScalar GetAttenScale() const { return fAttenScale; } - void SetAttenScale(hsScalar s) { fAttenScale = s; } + float GetAttenScale() const { return fAttenScale; } + void SetAttenScale(float s) { fAttenScale = s; } - hsScalar GetBlurScale() const { return fBlurScale; } - void SetBlurScale(hsScalar s) { fBlurScale = s; } + float GetBlurScale() const { return fBlurScale; } + void SetBlurScale(float s) { fBlurScale = s; } - hsScalar GetBoost() const { return fBoost; } - void SetBoost(hsScalar s) { fBoost = s; } + float GetBoost() const { return fBoost; } + void SetBoost(float s) { fBoost = s; } // These are usually handled internally, activating on read and deactivating // on destruct. Made public in case they need to be manually handled, like diff --git a/Sources/Plasma/PubUtilLib/plGLight/plShadowMaster.cpp b/Sources/Plasma/PubUtilLib/plGLight/plShadowMaster.cpp index 098d9f10..ab9e4043 100644 --- a/Sources/Plasma/PubUtilLib/plGLight/plShadowMaster.cpp +++ b/Sources/Plasma/PubUtilLib/plGLight/plShadowMaster.cpp @@ -40,7 +40,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "plShadowMaster.h" #include "plShadowSlave.h" @@ -62,12 +62,12 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "plTweak.h" -UInt32 plShadowMaster::fGlobalMaxSize = 512; -hsScalar plShadowMaster::fGlobalMaxDist = 160.f; // PERSPTEST -// hsScalar plShadowMaster::fGlobalMaxDist = 100000.f; // PERSPTEST -hsScalar plShadowMaster::fGlobalVisParm = 1.f; +uint32_t plShadowMaster::fGlobalMaxSize = 512; +float plShadowMaster::fGlobalMaxDist = 160.f; // PERSPTEST +// float plShadowMaster::fGlobalMaxDist = 100000.f; // PERSPTEST +float plShadowMaster::fGlobalVisParm = 1.f; -void plShadowMaster::SetGlobalShadowQuality(hsScalar s) +void plShadowMaster::SetGlobalShadowQuality(float s) { if( s < 0 ) s = 0; @@ -76,10 +76,10 @@ void plShadowMaster::SetGlobalShadowQuality(hsScalar s) fGlobalVisParm = s; } -void plShadowMaster::SetGlobalMaxSize(UInt32 s) +void plShadowMaster::SetGlobalMaxSize(uint32_t s) { - const UInt32 kMaxMaxGlobalSize = 512; - const UInt32 kMinMaxGlobalSize = 32; + const uint32_t kMaxMaxGlobalSize = 512; + const uint32_t kMinMaxGlobalSize = 32; // Make sure it's a power of two. if( ((s-1) & ~s) != (s-1) ) @@ -166,7 +166,7 @@ void plShadowMaster::Deactivate() const plgDispatch::Dispatch()->UnRegisterForExactType(plRenderMsg::Index(), GetKey()); } -void plShadowMaster::SetMaxDist(hsScalar f) +void plShadowMaster::SetMaxDist(float f) { fMaxDist = f; fMinDist = f * 0.75f; @@ -215,7 +215,7 @@ hsBool plShadowMaster::IOnCastMsg(plShadowCastMsg* castMsg) || fLightInfo->InVisNot(plGlobalVisMgr::Instance()->GetVisNot()) ) return false; - const UInt8 shadowQuality = UInt8(plShadowMaster::GetGlobalShadowQuality() * 3.9f); + const uint8_t shadowQuality = uint8_t(plShadowMaster::GetGlobalShadowQuality() * 3.9f); if( !GetKey()->GetUoid().GetLoadMask().MatchesQuality(shadowQuality) ) return false; @@ -227,11 +227,11 @@ hsBool plShadowMaster::IOnCastMsg(plShadowCastMsg* castMsg) hsBounds3Ext casterBnd; IComputeCasterBounds(caster, casterBnd); - hsScalar power = IComputePower(caster, casterBnd); + float power = IComputePower(caster, casterBnd); - static hsScalar kVisShadowPower = 1.e-1f; - static hsScalar kMinShadowPower = 2.e-1f; - static hsScalar kKneeShadowPower = 3.e-1f; + static float kVisShadowPower = 1.e-1f; + static float kMinShadowPower = 2.e-1f; + static float kKneeShadowPower = 3.e-1f; if( power < kMinShadowPower ) return false; if( power < kKneeShadowPower ) @@ -258,10 +258,10 @@ hsBool plShadowMaster::IOnCastMsg(plShadowCastMsg* castMsg) // That's the distance used for culling ShadowReceivers // The ShadowSlaveYon is used directly in the - slave->fIndex = UInt32(-1); + slave->fIndex = uint32_t(-1); castMsg->Pipeline()->SubmitShadowSlave(slave); - if( slave->fIndex == UInt32(-1) ) + if( slave->fIndex == uint32_t(-1) ) { IRecycleSlave(slave); return false; @@ -294,7 +294,7 @@ void plShadowMaster::IComputeCasterBounds(const plShadowCaster* caster, hsBounds for( i = 0; i < castSpans.GetCount(); i++ ) { plDrawableSpans* dr = castSpans[i].fDraw; - UInt32 index = castSpans[i].fIndex; + uint32_t index = castSpans[i].fIndex; // Right now, the generic world bounds seems close enough, even when skinned. // It gets a little off on the lower LODs, but, hey, they're the lower LODs. @@ -318,7 +318,7 @@ plShadowSlave* plShadowMaster::INextSlave(const plShadowCaster* caster) return slave; } -plShadowSlave* plShadowMaster::ICreateShadowSlave(plShadowCastMsg* castMsg, const hsBounds3Ext& casterBnd, hsScalar power) +plShadowSlave* plShadowMaster::ICreateShadowSlave(plShadowCastMsg* castMsg, const hsBounds3Ext& casterBnd, float power) { const plShadowCaster* caster = castMsg->Caster(); @@ -371,13 +371,13 @@ plShadowSlave* plShadowMaster::ILastChanceToBail(plShadowCastMsg* castMsg, plSha if( !castMsg->Pipeline()->TestVisibleWorld(wBnd) ) return IRecycleSlave(slave); - hsScalar maxDist = fMaxDist > 0 + float maxDist = fMaxDist > 0 ? (fGlobalMaxDist > 0 ? hsMinimum(fMaxDist, fGlobalMaxDist) : fMaxDist) : fGlobalMaxDist; - plConst(hsScalar) kMinFrac(0.6f); + plConst(float) kMinFrac(0.6f); maxDist *= kMinFrac + GetGlobalShadowQuality() * (1.f - kMinFrac); // If we haven't got a max distance at which the shadow stays visible @@ -385,10 +385,10 @@ plShadowSlave* plShadowMaster::ILastChanceToBail(plShadowCastMsg* castMsg, plSha if( maxDist <= 0 ) return slave; - plConst(hsScalar) kMinFadeFrac(0.90f); - plConst(hsScalar) kMaxFadeFrac(0.75f); - const hsScalar fadeFrac = kMinFadeFrac + GetGlobalShadowQuality() * (kMaxFadeFrac - kMinFadeFrac); - hsScalar minDist = maxDist * fadeFrac; + plConst(float) kMinFadeFrac(0.90f); + plConst(float) kMaxFadeFrac(0.75f); + const float fadeFrac = kMinFadeFrac + GetGlobalShadowQuality() * (kMaxFadeFrac - kMinFadeFrac); + float minDist = maxDist * fadeFrac; // So we want to fade out the shadow as it gets farther away, hopefully // pitching it in the distance when we couldn't see it anyway. @@ -400,16 +400,16 @@ plShadowSlave* plShadowMaster::ILastChanceToBail(plShadowCastMsg* castMsg, plSha // but at least nothing will change when you swing the camera around. #if 0 wBnd.TestPlane(castMsg->Pipeline()->GetViewDirWorld(), depth); - hsScalar eyeDist = castMsg->Pipeline()->GetViewDirWorld().InnerProduct(castMsg->Pipeline()->GetViewPositionWorld()); + float eyeDist = castMsg->Pipeline()->GetViewDirWorld().InnerProduct(castMsg->Pipeline()->GetViewPositionWorld()); #else hsPoint3 centre = wBnd.GetCenter(); hsPoint3 vpos = castMsg->Pipeline()->GetViewPositionWorld(); hsVector3 dir(¢re, &vpos); hsFastMath::NormalizeAppr(dir); wBnd.TestPlane(dir, depth); - hsScalar eyeDist = dir.InnerProduct(vpos); + float eyeDist = dir.InnerProduct(vpos); #endif - hsScalar dist = depth.fX - eyeDist; + float dist = depth.fX - eyeDist; // If it's not far enough to be fading, just go with it as is. dist -= minDist; @@ -429,13 +429,13 @@ plShadowSlave* plShadowMaster::ILastChanceToBail(plShadowCastMsg* castMsg, plSha } // compute ShadowSlave power influenced by SoftRegion, current light intensity, and ShadowCaster.fMaxOpacity; -hsScalar plShadowMaster::IComputePower(const plShadowCaster* caster, const hsBounds3Ext& casterBnd) const +float plShadowMaster::IComputePower(const plShadowCaster* caster, const hsBounds3Ext& casterBnd) const { - hsScalar power = 0; + float power = 0; if( fLightInfo && !fLightInfo->IsIdle() ) { power = caster->fMaxOpacity; - hsScalar strength, scale; + float strength, scale; fLightInfo->GetStrengthAndScale(casterBnd, strength, scale); power *= strength; } @@ -465,15 +465,15 @@ void plShadowMaster::IComputeWidthAndHeight(plShadowCastMsg* castMsg, plShadowSl hsPoint2 depth; wBnd.TestPlane(castMsg->Pipeline()->GetViewDirWorld(), depth); - hsScalar eyeDist = castMsg->Pipeline()->GetViewDirWorld().InnerProduct(castMsg->Pipeline()->GetViewPositionWorld()); - hsScalar dist = depth.fX - eyeDist; + float eyeDist = castMsg->Pipeline()->GetViewDirWorld().InnerProduct(castMsg->Pipeline()->GetViewPositionWorld()); + float dist = depth.fX - eyeDist; if( dist < 0 ) dist = 0; slave->fPriority = dist; // Might want to boost the local players priority. - plConst(hsScalar) kShiftDist = 50.f; // PERSPTEST -// plConst(hsScalar) kShiftDist = 5000.f; // PERSPTEST + plConst(float) kShiftDist = 50.f; // PERSPTEST +// plConst(float) kShiftDist = 5000.f; // PERSPTEST int iShift = int(dist / kShiftDist); slave->fWidth >>= iShift; slave->fHeight >>= iShift; @@ -507,8 +507,8 @@ void plShadowMaster::IComputeLUT(plShadowCastMsg* castMsg, plShadowSlave* slave) hsBounds3Ext bnd = slave->fCasterWorldBounds; bnd.Transform(&slave->fWorldToLight); - hsScalar farthest = bnd.GetCenter().fZ + slave->fAttenDist; - hsScalar closest = bnd.GetMins().fZ; + float farthest = bnd.GetCenter().fZ + slave->fAttenDist; + float closest = bnd.GetMins().fZ; // Shouldn't this always be negated? static hsMatrix44 lightToLut; // Static ensures initialized to all zeros. @@ -524,8 +524,8 @@ void plShadowMaster::IComputeLUT(plShadowCastMsg* castMsg, plShadowSlave* slave) // bias to ShadowSlave.LUTXfm.fMap[0][3]. Bias magnitude would probably be at // least 0.5f/256.f to compensate for quantization. - plConst(hsScalar) kSelfBias = 2.f / 256.f; - plConst(hsScalar) kOtherBias = -0.5 / 256.f; + plConst(float) kSelfBias = 2.f / 256.f; + plConst(float) kOtherBias = -0.5 / 256.f; #if 0 // MF_NOSELF lightToLut.fMap[0][3] += slave->HasFlag(plShadowSlave::kSelfShadow) ? kSelfBias : kOtherBias; #else // MF_NOSELF @@ -716,13 +716,13 @@ protected: public: plDrawableSpans* fDraw; plSpan* fSpan; - UInt32 fIndex; + uint32_t fIndex; }; hsTArray fSpans; hsBounds3Ext fTotalWorldBounds; - hsScalar fMaxOpacity; + float fMaxOpacity; On RenderMsg @@ -741,7 +741,7 @@ protected: //find max opacity of all spans //clear shadowBits of all spans - hsScalar fMaxOpacity = 0.f; + float fMaxOpacity = 0.f; int i; for( i = 0; i < fSpans.GetCount(); i++ ) { @@ -803,7 +803,7 @@ public: CLASSNAME_REGISTER( plShadowCaster ); GETINTERFACE_ANY( plShadowCaster, plMultiModifier ); - virtual hsBool IEval(double secs, hsScalar del, UInt32 dirty) {} + virtual hsBool IEval(double secs, float del, uint32_t dirty) {} virtual hsBool MsgReceive(plMessage* msg); @@ -818,7 +818,7 @@ protected: plVolumeIsect* fIsect; - hsScalar fAttenDist; + float fAttenDist; plSoftVolume* fSoftVolume; @@ -831,7 +831,7 @@ protected: // Override if you want to attenuate (e.g. dist for omni, cone angle for spot). // But make sure you factor in base class power. - virtual hsScalar IComputePower(const plShadowCaster* caster); + virtual float IComputePower(const plShadowCaster* caster); public: plVolumeIsect* GetIsect() const { return fIsect; } @@ -853,14 +853,14 @@ public: } } - virtual void CreateShadowSlave(const hsBounds3Ext& bnd, hsScalar power) + virtual void CreateShadowSlave(const hsBounds3Ext& bnd, float power) { int iSlave = fSlavePool.GetCount(); fSlavePool.ExpandAndZero(iSlave+1); plShadowSlave* slave = fSlavePool[iSlave]; if( !slave ) { - fSlavePool[iSlave] = slave = TRACKED_NEW plShadowSlave; + fSlavePool[iSlave] = slave = new plShadowSlave; fISectPool[iSlave] = INewISect(); } @@ -883,9 +883,9 @@ public: }; // compute ShadowSlave power influenced by SoftRegion and ShadowCaster.fMaxOpacity; -hsScalar plShadowMaster::ComputePower(const plShadowCaster* caster) +float plShadowMaster::ComputePower(const plShadowCaster* caster) { - hsScalar power = caster->fMaxOpacity; + float power = caster->fMaxOpacity; if( fSoftVolume ) { power *= fSoftVolume->GetStrength(caster->fTotalWorldBounds.GetCenter()); @@ -928,13 +928,13 @@ void plOmniShadowMaster::IComputeProjections(const hsBounds3Ext& wBnd, plShadowS hsBounds3Ext bnd = wBnd; bnd.Transform(slave->fWorldToLight); - hsScalar minZ = bnd.GetMins().fZ; - hsScalar maxZ = bnd.GetCenter().fZ + fAttenDist; + float minZ = bnd.GetMins().fZ; + float maxZ = bnd.GetCenter().fZ + fAttenDist; if( minZ < kMinMinZ ) minZ = kMinMinZ; - hsScalar cotX, cotY; + float cotX, cotY; if( -bnd.GetMins().fX > bnd.GetMaxs().fX ) { hsAssert(bnd.GetMins().fX < 0, "Empty shadow caster bounds?"); @@ -1011,12 +1011,12 @@ public: hsMatrix44 fCastLUT; hsMatrix44 fRcvLUT; - hsScalar fPower; + float fPower; plVolumeIsect* fISect; - UInt32 fWidth; - UInt32 fHeight; + uint32_t fWidth; + uint32_t fHeight; }; BeginScene (on EvalMsg?) @@ -1038,7 +1038,7 @@ Harvest if( !ShadowMaster.CanSee(ShadowCaster.fTotalWorldBounds) ) forget it; - hsScalar power = ComputePower(ShadowCaster); + float power = ComputePower(ShadowCaster); if( power == 0 ) forget it; diff --git a/Sources/Plasma/PubUtilLib/plGLight/plShadowMaster.h b/Sources/Plasma/PubUtilLib/plGLight/plShadowMaster.h index 4116ba6e..d7ed5b44 100644 --- a/Sources/Plasma/PubUtilLib/plGLight/plShadowMaster.h +++ b/Sources/Plasma/PubUtilLib/plGLight/plShadowMaster.h @@ -71,19 +71,19 @@ public: protected: // Global clamp on shadow map size and stuff - static UInt32 fGlobalMaxSize; - static hsScalar fGlobalMaxDist; - static hsScalar fGlobalVisParm; + static uint32_t fGlobalMaxSize; + static float fGlobalMaxDist; + static float fGlobalVisParm; // Constant parameter(s) for this master. - hsScalar fAttenDist; - hsScalar fMaxDist; - hsScalar fMinDist; + float fAttenDist; + float fMaxDist; + float fMinDist; - UInt32 fMaxSize; - UInt32 fMinSize; + uint32_t fMaxSize; + uint32_t fMinSize; - hsScalar fPower; + float fPower; // Temp data used for one frame and recycled. hsTArray fSlavePool; @@ -102,11 +102,11 @@ protected: virtual void IComputeCasterBounds(const plShadowCaster* caster, hsBounds3Ext& casterBnd); virtual void IComputeWidthAndHeight(plShadowCastMsg* castMsg, plShadowSlave* slave) const; virtual void IComputeLUT(plShadowCastMsg* castMsg, plShadowSlave* slave) const; - virtual hsScalar IComputePower(const plShadowCaster* caster, const hsBounds3Ext& casterBnd) const; + virtual float IComputePower(const plShadowCaster* caster, const hsBounds3Ext& casterBnd) const; virtual plShadowSlave* ILastChanceToBail(plShadowCastMsg* castMsg, plShadowSlave* slave); - virtual plShadowSlave* ICreateShadowSlave(plShadowCastMsg* castMsg, const hsBounds3Ext& casterBnd, hsScalar power); + virtual plShadowSlave* ICreateShadowSlave(plShadowCastMsg* castMsg, const hsBounds3Ext& casterBnd, float power); virtual plShadowSlave* INewSlave(const plShadowCaster* caster) = 0; virtual plShadowSlave* INextSlave(const plShadowCaster* caster); @@ -128,7 +128,7 @@ public: virtual void SetTransform(const hsMatrix44& l2w, const hsMatrix44& w2l) {} - Int32 GetNumProperties() const { return kNumProps; } + int32_t GetNumProperties() const { return kNumProps; } virtual void Read(hsStream* stream, hsResMgr* mgr); virtual void Write(hsStream* stream, hsResMgr* mgr); @@ -140,29 +140,29 @@ public: void Activate() const; // These should only be useful on scene conversion. - hsScalar GetAttenDist() const { return fAttenDist; } - void SetAttenDist(hsScalar d) { fAttenDist = d; } + float GetAttenDist() const { return fAttenDist; } + void SetAttenDist(float d) { fAttenDist = d; } - hsScalar GetMaxDist() const { return fMaxDist; } - hsScalar GetMinDist() const { return fMinDist; } - void SetMaxDist(hsScalar m); + float GetMaxDist() const { return fMaxDist; } + float GetMinDist() const { return fMinDist; } + void SetMaxDist(float m); - UInt32 GetMaxSize() const { return fMaxSize; } - UInt32 GetMinSize() const { return fMinSize; } - void SetMaxSize(UInt32 s) { fMaxSize = s; } - void SetMinSize(UInt32 s) { fMinSize = s; } + uint32_t GetMaxSize() const { return fMaxSize; } + uint32_t GetMinSize() const { return fMinSize; } + void SetMaxSize(uint32_t s) { fMaxSize = s; } + void SetMinSize(uint32_t s) { fMinSize = s; } - hsScalar GetPower() const { return fPower; } - void SetPower(hsScalar f) { fPower = f; } + float GetPower() const { return fPower; } + void SetPower(float f) { fPower = f; } - static void SetGlobalMaxSize(UInt32 s) ; - static UInt32 GetGlobalMaxSize() { return fGlobalMaxSize; } + static void SetGlobalMaxSize(uint32_t s) ; + static uint32_t GetGlobalMaxSize() { return fGlobalMaxSize; } - static void SetGlobalMaxDist(hsScalar s) { fGlobalMaxDist = s; } - static hsScalar GetGlobalMaxDist() { return fGlobalMaxDist; } + static void SetGlobalMaxDist(float s) { fGlobalMaxDist = s; } + static float GetGlobalMaxDist() { return fGlobalMaxDist; } - static void SetGlobalShadowQuality(hsScalar s); - static hsScalar GetGlobalShadowQuality() { return fGlobalVisParm; } + static void SetGlobalShadowQuality(float s); + static float GetGlobalShadowQuality() { return fGlobalVisParm; } }; diff --git a/Sources/Plasma/PubUtilLib/plGLight/plShadowSlave.cpp b/Sources/Plasma/PubUtilLib/plGLight/plShadowSlave.cpp index a5755f31..f98f93d1 100644 --- a/Sources/Plasma/PubUtilLib/plGLight/plShadowSlave.cpp +++ b/Sources/Plasma/PubUtilLib/plGLight/plShadowSlave.cpp @@ -40,7 +40,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "plShadowSlave.h" #include "plTweak.h" @@ -52,7 +52,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #define isnan _isnan #endif -static const hsScalar kMinMinZ = 1.f; // totally random arbitrary number (has to be > 0). +static const float kMinMinZ = 1.f; // totally random arbitrary number (has to be > 0). bool plShadowSlave::ISetupOrthoViewTransform() { @@ -60,14 +60,14 @@ bool plShadowSlave::ISetupOrthoViewTransform() bnd.Transform(&fWorldToLight); - hsScalar minZ = bnd.GetMins().fZ; - hsScalar maxZ = bnd.GetCenter().fZ + fAttenDist; + float minZ = bnd.GetMins().fZ; + float maxZ = bnd.GetCenter().fZ + fAttenDist; - hsScalar minX = bnd.GetMins().fX; - hsScalar maxX = bnd.GetMaxs().fX; + float minX = bnd.GetMins().fX; + float maxX = bnd.GetMaxs().fX; - hsScalar minY = bnd.GetMins().fY; - hsScalar maxY = bnd.GetMaxs().fY; + float minY = bnd.GetMins().fY; + float maxY = bnd.GetMaxs().fY; hsMatrix44 proj; @@ -82,7 +82,7 @@ bool plShadowSlave::ISetupOrthoViewTransform() // and an offset of zero works great. This could be a driver bug, or // hardware "dependency" (read IHV bug), but whatever, zero is working // now. Might need to adjust for new drivers or other hardware. - const hsScalar kAdjustBias = 0.0f; + const float kAdjustBias = 0.0f; proj.fMap[0][0] = 1.f / (maxX - minX); proj.fMap[0][3] = -minX / (maxX - minX) + kAdjustBias / fWidth; proj.fMap[1][1] = -1.f / (maxY - minY); @@ -98,20 +98,20 @@ bool plShadowSlave::ISetupOrthoViewTransform() // Like the adjust bias above, this part is correct in theory, but only // screws things up (increases Z-acne). #if 0 - hsScalar delX = maxX - minX; + float delX = maxX - minX; minX += delX / (fWidth * 0.5f); maxX -= delX / (fWidth * 0.5f); - hsScalar delY = maxY - minY; + float delY = maxY - minY; minY += delY / (fHeight * 0.5f); maxY -= delY / (fHeight * 0.5f); #endif fView.SetView(hsPoint3(minX, minY, minZ), hsPoint3(maxX, maxY, maxZ)); - fView.SetScreenSize((UInt16)fWidth, (UInt16)fHeight); + fView.SetScreenSize((uint16_t)fWidth, (uint16_t)fHeight); fView.SetCameraTransform(fWorldToLight, fLightToWorld); fView.SetPerspective(false); - fView.SetViewPort(0, 0, hsScalar(fWidth), hsScalar(fHeight), false); + fView.SetViewPort(0, 0, float(fWidth), float(fHeight), false); fLightDir = fLightToWorld.GetAxis(hsMatrix44::kUp); SetFlag(kPositional, false); @@ -126,8 +126,8 @@ bool plShadowSlave::ISetupPerspViewTransform() bnd.Transform(&fWorldToLight); - hsScalar minZ = bnd.GetMins().fZ; - hsScalar maxZ = bnd.GetCenter().fZ + fAttenDist; + float minZ = bnd.GetMins().fZ; + float maxZ = bnd.GetCenter().fZ + fAttenDist; if( minZ < kMinMinZ ) minZ = kMinMinZ; @@ -142,7 +142,7 @@ bool plShadowSlave::ISetupPerspViewTransform() if (isnan(bnd.GetMaxs().fX) || isnan(bnd.GetMaxs().fY)) return false; - hsScalar cotX, cotY; + float cotX, cotY; if( -bnd.GetMins().fX > bnd.GetMaxs().fX ) { hsAssert(bnd.GetMins().fX < 0, "Empty shadow caster bounds?"); @@ -180,11 +180,11 @@ bool plShadowSlave::ISetupPerspViewTransform() proj.fMap[1][1] = cotY * 0.5f; proj.fMap[1][2] = -0.5f * (1.f + 0.5f/fHeight); #else - plConst(hsScalar) kBiasScale(1.f); - plConst(hsScalar) kBiasTrans(1.f); - proj.fMap[0][0] = cotX * 0.5f * ( hsScalar(fWidth-2.f) / hsScalar(fWidth) ) * kBiasScale; + plConst(float) kBiasScale(1.f); + plConst(float) kBiasTrans(1.f); + proj.fMap[0][0] = cotX * 0.5f * ( float(fWidth-2.f) / float(fWidth) ) * kBiasScale; proj.fMap[0][2] = 0.5f * (1.f - kBiasTrans * 0.5f/fWidth); - proj.fMap[1][1] = -cotY * 0.5f * ( hsScalar(fHeight-2.f) / hsScalar(fHeight) ) * kBiasScale; + proj.fMap[1][1] = -cotY * 0.5f * ( float(fHeight-2.f) / float(fHeight) ) * kBiasScale; proj.fMap[1][2] = 0.5f * (1.f - kBiasTrans * 0.5f/fHeight); #endif @@ -206,13 +206,13 @@ bool plShadowSlave::ISetupPerspViewTransform() cotX -= cotX / (fWidth * 0.5f); cotY -= cotY / (fHeight * 0.5f); - hsScalar tanX = 1.f / cotX; - hsScalar tanY = 1.f / cotY; + float tanX = 1.f / cotX; + float tanY = 1.f / cotY; fView.SetView(hsPoint3(-tanX, -tanY, minZ), hsPoint3(tanX, tanY, maxZ)); - fView.SetScreenSize((UInt16)fWidth, (UInt16)fHeight); + fView.SetScreenSize((uint16_t)fWidth, (uint16_t)fHeight); fView.SetCameraTransform(fWorldToLight, fLightToWorld); fView.SetPerspective(true); - fView.SetViewPort(0, 0, hsScalar(fWidth), hsScalar(fHeight), false); + fView.SetViewPort(0, 0, float(fWidth), float(fHeight), false); fLightPos = fLightToWorld.GetTranslate(); SetFlag(kPositional, true); diff --git a/Sources/Plasma/PubUtilLib/plGLight/plShadowSlave.h b/Sources/Plasma/PubUtilLib/plGLight/plShadowSlave.h index a850d9e7..b3d0d4d2 100644 --- a/Sources/Plasma/PubUtilLib/plGLight/plShadowSlave.h +++ b/Sources/Plasma/PubUtilLib/plGLight/plShadowSlave.h @@ -56,7 +56,7 @@ class plShadowSlave { public: - UInt32 fIndex; + uint32_t fIndex; hsMatrix44 fWorldToLight; hsMatrix44 fLightToWorld; @@ -70,22 +70,22 @@ public: plViewTransform fView; - hsScalar fPower; - hsScalar fBlurScale; + float fPower; + float fBlurScale; hsBounds3Ext fCasterWorldBounds; hsBounds3Ext fWorldBounds; plVolumeIsect* fIsect; - UInt32 fWidth; - UInt32 fHeight; + uint32_t fWidth; + uint32_t fHeight; - hsScalar fAttenDist; + float fAttenDist; - hsScalar fPriority; + float fPriority; - UInt32 fFlags; + uint32_t fFlags; enum SlaveFlag { diff --git a/Sources/Plasma/PubUtilLib/plGRenderProcs/hsGRenderProcs.h b/Sources/Plasma/PubUtilLib/plGRenderProcs/hsGRenderProcs.h index 7d41dac3..e106997b 100644 --- a/Sources/Plasma/PubUtilLib/plGRenderProcs/hsGRenderProcs.h +++ b/Sources/Plasma/PubUtilLib/plGRenderProcs/hsGRenderProcs.h @@ -90,7 +90,7 @@ public: private: // Base class private stuff for managing the Queue of Procs on the device. - UInt32 fLinkCount; + uint32_t fLinkCount; hsGRenderProcs* fNext; hsGRenderProcs** fBack; @@ -100,7 +100,7 @@ private: protected: - UInt32 fFlags; + uint32_t fFlags; hsGColorizer fColorizer; @@ -189,7 +189,7 @@ public: // External object references. Individual RenderProc type responsible for what they're used for. void SetNumObjectRefs(int n); - UInt32 GetNumObjectRefs() { return fObjectRefs.GetCount(); } + uint32_t GetNumObjectRefs() { return fObjectRefs.GetCount(); } void AddObjectRef(plKey* key) { fObjectRefs.Append(key); fFlags |= kObjectRefs; } void SetObjectRef(plKey* key, int i=0); void InsertObjectRef(int i, plKey* key) { fObjectRefs.InsertAtIndex(i, key); fFlags |= kObjectRefs; } @@ -208,8 +208,8 @@ public: virtual const char* GetLabel() const = 0; virtual ProcType GetType() const = 0; - UInt32 GetFlags() { return fFlags; } - void SetFlags(UInt32 f) { fFlags = f; } + uint32_t GetFlags() { return fFlags; } + void SetFlags(uint32_t f) { fFlags = f; } CLASSNAME_REGISTER( hsGRenderProcs ); GETINTERFACE_ANY( hsGRenderProcs, plCreatable ); diff --git a/Sources/Plasma/PubUtilLib/plGRenderProcs/hsSfxAngleFade.cpp b/Sources/Plasma/PubUtilLib/plGRenderProcs/hsSfxAngleFade.cpp index 831982d5..bdcf98f6 100644 --- a/Sources/Plasma/PubUtilLib/plGRenderProcs/hsSfxAngleFade.cpp +++ b/Sources/Plasma/PubUtilLib/plGRenderProcs/hsSfxAngleFade.cpp @@ -204,7 +204,7 @@ void hsSfxAngleFade::Read(hsStream* s) { fTable.Reset(); - Int32 cnt = s->ReadSwap32(); + int32_t cnt = s->ReadSwap32(); if( cnt ) { diff --git a/Sources/Plasma/PubUtilLib/plGRenderProcs/hsSfxDistFade.cpp b/Sources/Plasma/PubUtilLib/plGRenderProcs/hsSfxDistFade.cpp index 8fe3a153..7b40e092 100644 --- a/Sources/Plasma/PubUtilLib/plGRenderProcs/hsSfxDistFade.cpp +++ b/Sources/Plasma/PubUtilLib/plGRenderProcs/hsSfxDistFade.cpp @@ -291,7 +291,7 @@ void hsSfxDistFade::Read(hsStream* s) fMaxIdle = s->ReadSwapScalar(); } - Int32 cnt = s->ReadSwap32(); + int32_t cnt = s->ReadSwap32(); if( cnt ) { diff --git a/Sources/Plasma/PubUtilLib/plGRenderProcs/hsSfxDistShade.cpp b/Sources/Plasma/PubUtilLib/plGRenderProcs/hsSfxDistShade.cpp index 54c1e6d8..3e70ec80 100644 --- a/Sources/Plasma/PubUtilLib/plGRenderProcs/hsSfxDistShade.cpp +++ b/Sources/Plasma/PubUtilLib/plGRenderProcs/hsSfxDistShade.cpp @@ -258,11 +258,11 @@ void hsSfxDistShade::Read(hsStream* s) fMinDist = s->ReadSwapScalar(); fMaxDist = s->ReadSwapScalar(); - Int32 cnt = s->ReadSwap32(); + int32_t cnt = s->ReadSwap32(); if( cnt ) { - hsSfxDfTableEntry* arr = TRACKED_NEW hsSfxDfTableEntry[cnt]; + hsSfxDfTableEntry* arr = new hsSfxDfTableEntry[cnt]; int i; for( i = 0; i < cnt; i++ ) { diff --git a/Sources/Plasma/PubUtilLib/plGRenderProcs/hsSfxGlobalShade.cpp b/Sources/Plasma/PubUtilLib/plGRenderProcs/hsSfxGlobalShade.cpp index 800da1db..8228ff7a 100644 --- a/Sources/Plasma/PubUtilLib/plGRenderProcs/hsSfxGlobalShade.cpp +++ b/Sources/Plasma/PubUtilLib/plGRenderProcs/hsSfxGlobalShade.cpp @@ -123,7 +123,7 @@ hsColorRGBA hsSfxGlobalShade::ISumLights(hsPoint3& pos) if( proj->IsPerspective() ) // spot { hsPoint4 ang; - UInt32 clips; + uint32_t clips; proj->GetNdcPoints(1, &pos, sizeof(pos), &ang, kClipAll, &clips); if( !clips diff --git a/Sources/Plasma/PubUtilLib/plGRenderProcs/hsSfxGlobalShade.h b/Sources/Plasma/PubUtilLib/plGRenderProcs/hsSfxGlobalShade.h index 117eaac6..a243ed8a 100644 --- a/Sources/Plasma/PubUtilLib/plGRenderProcs/hsSfxGlobalShade.h +++ b/Sources/Plasma/PubUtilLib/plGRenderProcs/hsSfxGlobalShade.h @@ -65,7 +65,7 @@ public: protected: // Constants from which to work. - UInt32 fGSFlags; + uint32_t fGSFlags; hsColorRGBA fAmbient; hsColorRGBA fDiffuse; @@ -103,8 +103,8 @@ public: void SetDiffuse(const hsColorRGBA& col) { fDiffuse = col; } hsColorRGBA GetDiffuse() const { return fDiffuse; } - void SetSource(UInt32 f) { fGSFlags &= ~kSourceMask; fGSFlags |= f; } - UInt32 GetSource() { return fGSFlags & kSourceMask; } + void SetSource(uint32_t f) { fGSFlags &= ~kSourceMask; fGSFlags |= f; } + uint32_t GetSource() { return fGSFlags & kSourceMask; } void SetScalar(hsBool32 on) { if(on)fGSFlags |= kScalarIntensity; else fGSFlags &= ~kScalarIntensity; } hsBool32 GetScalar() { return 0 != (fGSFlags & kScalarIntensity); } diff --git a/Sources/Plasma/PubUtilLib/plGRenderProcs/hsSfxObjDistFade.cpp b/Sources/Plasma/PubUtilLib/plGRenderProcs/hsSfxObjDistFade.cpp index d9083ea7..58a7f88c 100644 --- a/Sources/Plasma/PubUtilLib/plGRenderProcs/hsSfxObjDistFade.cpp +++ b/Sources/Plasma/PubUtilLib/plGRenderProcs/hsSfxObjDistFade.cpp @@ -280,7 +280,7 @@ void hsSfxObjDistFade::Read(hsStream* s) fMaxIdle = s->ReadSwapScalar(); } - Int32 cnt = s->ReadSwap32(); + int32_t cnt = s->ReadSwap32(); if( cnt ) { diff --git a/Sources/Plasma/PubUtilLib/plGRenderProcs/hsSfxObjDistFade.h b/Sources/Plasma/PubUtilLib/plGRenderProcs/hsSfxObjDistFade.h index f60c549e..e3e0d2a2 100644 --- a/Sources/Plasma/PubUtilLib/plGRenderProcs/hsSfxObjDistFade.h +++ b/Sources/Plasma/PubUtilLib/plGRenderProcs/hsSfxObjDistFade.h @@ -81,7 +81,7 @@ protected: hsScalar fMinIdle; hsScalar fMaxIdle; - Int32 fTreeCnt; + int32_t fTreeCnt; hsExpander fTable; diff --git a/Sources/Plasma/PubUtilLib/plGRenderProcs/hsSfxObjDistShade.cpp b/Sources/Plasma/PubUtilLib/plGRenderProcs/hsSfxObjDistShade.cpp index 9c9a8c12..ef3ed78f 100644 --- a/Sources/Plasma/PubUtilLib/plGRenderProcs/hsSfxObjDistShade.cpp +++ b/Sources/Plasma/PubUtilLib/plGRenderProcs/hsSfxObjDistShade.cpp @@ -183,7 +183,7 @@ void hsSfxObjDistShade::Read(hsStream* s) fMinDist = s->ReadSwapScalar(); fMaxDist = s->ReadSwapScalar(); - Int32 cnt = s->ReadSwap32(); + int32_t cnt = s->ReadSwap32(); if( cnt ) { diff --git a/Sources/Plasma/PubUtilLib/plGRenderProcs/hsSfxObjDistShade.h b/Sources/Plasma/PubUtilLib/plGRenderProcs/hsSfxObjDistShade.h index ac3a0a91..707eefc1 100644 --- a/Sources/Plasma/PubUtilLib/plGRenderProcs/hsSfxObjDistShade.h +++ b/Sources/Plasma/PubUtilLib/plGRenderProcs/hsSfxObjDistShade.h @@ -69,7 +69,7 @@ protected: hsScalar fMinIdle; hsScalar fMaxIdle; - Int32 fTreeCnt; + int32_t fTreeCnt; hsExpander fTable; diff --git a/Sources/Plasma/PubUtilLib/plGeometry/hsOscillator.cpp b/Sources/Plasma/PubUtilLib/plGeometry/hsOscillator.cpp index 9d984add..45c5874b 100644 --- a/Sources/Plasma/PubUtilLib/plGeometry/hsOscillator.cpp +++ b/Sources/Plasma/PubUtilLib/plGeometry/hsOscillator.cpp @@ -492,7 +492,7 @@ void hsOscillator::SetNumWaves(int n) fWaves[i].Kill(); } -void hsOscillator::Init(Int32 nParams, hsScalar* params) +void hsOscillator::Init(int32_t nParams, hsScalar* params) { // NumWaves = 1 // AttenScale = 2 diff --git a/Sources/Plasma/PubUtilLib/plGeometry/hsOscillator.h b/Sources/Plasma/PubUtilLib/plGeometry/hsOscillator.h index b4d607cb..c55ff2cd 100644 --- a/Sources/Plasma/PubUtilLib/plGeometry/hsOscillator.h +++ b/Sources/Plasma/PubUtilLib/plGeometry/hsOscillator.h @@ -137,7 +137,7 @@ public: virtual void AdjustWorldBounds(const hsMatrix44& l2w, const hsMatrix44& w2l, hsBounds3Ext& bnd) const; - virtual UInt32 GetType() const { return kTypeOscillator; } + virtual uint32_t GetType() const { return kTypeOscillator; } // Don't call these, use base class LabelAndWrite() and CreateAndRead() virtual void Read(hsStream* s); @@ -167,11 +167,11 @@ public: const hsBounds3Ext& GetWorldCenterBounds() const { return fWorldCenterBounds; } void SetNumWaves(int n); - UInt32 GetNumWaves() const { return fWaves.GetCount(); } + uint32_t GetNumWaves() const { return fWaves.GetCount(); } hsWave& GetWeakestWave(hsScalar secs); hsWave& GetTempWave(hsScalar secs); - virtual void Init(Int32 nParams, hsScalar* params); + virtual void Init(int32_t nParams, hsScalar* params); static hsGTriMesh* MakeWaveMesh(int nSpokes, const hsPoint3& center, hsScalar minRad, hsScalar maxRad, hsScalar uRange, hsScalar vRange, hsScalar attenStartFrac, hsBool32 stitch); diff --git a/Sources/Plasma/PubUtilLib/plGeometry/hsPerterber.cpp b/Sources/Plasma/PubUtilLib/plGeometry/hsPerterber.cpp index a0082cb5..761c8d0e 100644 --- a/Sources/Plasma/PubUtilLib/plGeometry/hsPerterber.cpp +++ b/Sources/Plasma/PubUtilLib/plGeometry/hsPerterber.cpp @@ -96,7 +96,7 @@ hsPerterber* hsPerterber::CreateAndRead(hsStream* s) { hsPerterber* retVal = nil; - UInt32 t = s->ReadSwap32(); + uint32_t t = s->ReadSwap32(); switch( t ) { case kTypeOscillator: @@ -203,8 +203,8 @@ struct hsPertDesc { char fName[256]; - UInt32 fType; - UInt32 fNumParams; + uint32_t fType; + uint32_t fNumParams; hsScalar fParams[kMaxPertParams]; }; diff --git a/Sources/Plasma/PubUtilLib/plGeometry/hsPerterber.h b/Sources/Plasma/PubUtilLib/plGeometry/hsPerterber.h index fad4dfef..0f0fee13 100644 --- a/Sources/Plasma/PubUtilLib/plGeometry/hsPerterber.h +++ b/Sources/Plasma/PubUtilLib/plGeometry/hsPerterber.h @@ -81,7 +81,7 @@ public: virtual void AdjustWorldBounds(const hsMatrix44& l2w, const hsMatrix44& w2l, hsBounds3Ext& bnd) const = 0; - virtual UInt32 GetType() const = 0; + virtual uint32_t GetType() const = 0; virtual void Write(hsStream* s) = 0; virtual void Read(hsStream* s) = 0; @@ -95,7 +95,7 @@ public: void LabelAndWrite(hsStream* s); static hsPerterber* CreateAndRead(hsStream* s); - virtual void Init(Int32 nParams, hsScalar* params) = 0; + virtual void Init(int32_t nParams, hsScalar* params) = 0; #if 0 // Used Registry...need to change paulg static void InitSystem(plResMgr* reg); diff --git a/Sources/Plasma/PubUtilLib/plInputCore/plAvatarInputInterface.cpp b/Sources/Plasma/PubUtilLib/plInputCore/plAvatarInputInterface.cpp index cfd3c803..37aceddd 100644 --- a/Sources/Plasma/PubUtilLib/plInputCore/plAvatarInputInterface.cpp +++ b/Sources/Plasma/PubUtilLib/plInputCore/plAvatarInputInterface.cpp @@ -49,9 +49,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com //#define LIMIT_VOICE_CHAT 1 #endif -#include "hsConfig.h" -#include "hsWindows.h" -#include "hsTypes.h" +#include "HeadSpin.h" #include "plAvatarInputInterface.h" #include "pnInputCore/plKeyMap.h" @@ -80,7 +78,6 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "hsResMgr.h" #include "plgDispatch.h" -#include "hsConfig.h" #include "hsMatrix44.h" #include "pnSceneObject/plSceneObject.h" #include "pnSceneObject/plCoordinateInterface.h" @@ -210,7 +207,7 @@ void plAvatarInputInterface::IDeactivateCommand(plMouseInfo *info) if (IHasControlFlag(info->fCode) && !(info->fControlFlags & (kControlFlagNoDeactivate | kControlFlagToggle))) { // The mapping is currently on, it's ok to deactivate, and it's not a toggle command - plCtrlCmd* pCmd = TRACKED_NEW plCtrlCmd( this ); + plCtrlCmd* pCmd = new plCtrlCmd( this ); pCmd->fNetPropagateToPlayers = info->fControlFlags & kControlFlagNetPropagate; pCmd->fControlActivated = false; pCmd->fControlCode = info->fCode; @@ -243,26 +240,26 @@ void plAvatarInputInterface::IChangeInputMaps( plAvatarInputMap *newMap ) void plAvatarInputInterface::ISetSuspendMovementMode() { - IChangeInputMaps(TRACKED_NEW plSuspendedMovementMap()); + IChangeInputMaps(new plSuspendedMovementMap()); fCurrentCursor = kCursorUp; } void plAvatarInputInterface::ISetLadderMap() { - IChangeInputMaps(TRACKED_NEW plLadderControlMap()); + IChangeInputMaps(new plLadderControlMap()); fCurrentCursor = kCursorUp; } void plAvatarInputInterface::ISetPreLadderMap() { - IChangeInputMaps(TRACKED_NEW plLadderMountMap()); + IChangeInputMaps(new plLadderMountMap()); fCurrentCursor = kCursorUp; } void plAvatarInputInterface::ISetPostLadderMap() { - IChangeInputMaps(TRACKED_NEW plLadderDismountMap()); + IChangeInputMaps(new plLadderDismountMap()); fCurrentCursor = kCursorUp; } @@ -270,9 +267,9 @@ void plAvatarInputInterface::ISetBasicMode() { plAvatarInputMap *map; if (!f3rdPerson) - map = TRACKED_NEW plBasicFirstPersonControlMap(); + map = new plBasicFirstPersonControlMap(); else - map = TRACKED_NEW plBasicThirdPersonControlMap(); + map = new plBasicThirdPersonControlMap(); IChangeInputMaps(map); fCurrentCursor = kCursorUp; @@ -281,11 +278,11 @@ void plAvatarInputInterface::ISetBasicMode() void plAvatarInputInterface::ISetMouseWalkMode(ControlEventCode code) { if (code == S_SET_WALK_BACK_MODE) - IChangeInputMaps(TRACKED_NEW pl3rdWalkBackwardMap()); + IChangeInputMaps(new pl3rdWalkBackwardMap()); else if (code == S_SET_WALK_BACK_LB_MODE) - IChangeInputMaps(TRACKED_NEW pl3rdWalkBackwardLBMap()); + IChangeInputMaps(new pl3rdWalkBackwardLBMap()); else - IChangeInputMaps(TRACKED_NEW pl3rdWalkForwardMap()); + IChangeInputMaps(new pl3rdWalkForwardMap()); fCurrentCursor = kCursorHidden; } @@ -416,7 +413,7 @@ void plAvatarInputInterface::EnableControl(hsBool val, ControlEventCode code) void plAvatarInputInterface::ForceAlwaysRun(hsBool val) { - plCtrlCmd *pCmd = TRACKED_NEW plCtrlCmd( this ); + plCtrlCmd *pCmd = new plCtrlCmd( this ); pCmd->fControlCode = B_CONTROL_ALWAYS_RUN; pCmd->fControlActivated = val; pCmd->fNetPropagateToPlayers = false; @@ -427,7 +424,7 @@ void plAvatarInputInterface::ForceAlwaysRun(hsBool val) //// IEval /////////////////////////////////////////////////////////////////// // Gets called once per IUpdate(), just like normal IEval()s -hsBool plAvatarInputInterface::IEval( double secs, hsScalar del, UInt32 dirty ) +hsBool plAvatarInputInterface::IEval( double secs, float del, uint32_t dirty ) { fCursorTimeout += del; if( fCursorTimeout > fCursorFadeDelay ) @@ -481,7 +478,7 @@ hsBool plAvatarInputInterface::IHandleCtrlCmd( plCtrlCmd *cmd ) #if 0 case S_SET_FIRST_PERSON_MODE: if( cmd->fControlActivated ) - IChangeInputMaps( TRACKED_NEW plFirstPersonControlMap() ); + IChangeInputMaps( new plFirstPersonControlMap() ); return true; #endif case S_SET_BASIC_MODE: @@ -489,7 +486,7 @@ hsBool plAvatarInputInterface::IHandleCtrlCmd( plCtrlCmd *cmd ) { ISetBasicMode(); #if 0 -plProxyDrawMsg* Dmsg = TRACKED_NEW plProxyDrawMsg(plProxyDrawMsg::kCamera | plProxyDrawMsg::kDestroy); +plProxyDrawMsg* Dmsg = new plProxyDrawMsg(plProxyDrawMsg::kCamera | plProxyDrawMsg::kDestroy); plgDispatch::MsgSend(Dmsg); plVirtualCam::Instance()->GetPipeline()->SetDrawableTypeMask(plVirtualCam::Instance()->GetPipeline()->GetDrawableTypeMask() & ~plDrawableSpans::kCameraProxy); #endif @@ -509,7 +506,7 @@ plVirtualCam::Instance()->GetPipeline()->SetDrawableTypeMask(plVirtualCam::Insta abort = true; #if 0 - plProxyDrawMsg* Dmsg = TRACKED_NEW plProxyDrawMsg(plProxyDrawMsg::kCamera | plProxyDrawMsg::kDestroy); + plProxyDrawMsg* Dmsg = new plProxyDrawMsg(plProxyDrawMsg::kCamera | plProxyDrawMsg::kDestroy); plgDispatch::MsgSend(Dmsg); plVirtualCam::Instance()->GetPipeline()->SetDrawableTypeMask(plVirtualCam::Instance()->GetPipeline()->GetDrawableTypeMask() & ~plDrawableSpans::kCameraProxy); #endif @@ -534,7 +531,7 @@ plVirtualCam::Instance()->GetPipeline()->SetDrawableTypeMask(plVirtualCam::Insta abort = true; #if 0 - plProxyDrawMsg* Dmsg = TRACKED_NEW plProxyDrawMsg(plProxyDrawMsg::kCamera | plProxyDrawMsg::kDestroy); + plProxyDrawMsg* Dmsg = new plProxyDrawMsg(plProxyDrawMsg::kCamera | plProxyDrawMsg::kDestroy); plgDispatch::MsgSend(Dmsg); plVirtualCam::Instance()->GetPipeline()->SetDrawableTypeMask(plVirtualCam::Instance()->GetPipeline()->GetDrawableTypeMask() & ~plDrawableSpans::kCameraProxy); #endif @@ -559,7 +556,7 @@ plVirtualCam::Instance()->GetPipeline()->SetDrawableTypeMask(plVirtualCam::Insta abort = true; #if 0 - plProxyDrawMsg* Dmsg = TRACKED_NEW plProxyDrawMsg(plProxyDrawMsg::kCamera | plProxyDrawMsg::kDestroy); + plProxyDrawMsg* Dmsg = new plProxyDrawMsg(plProxyDrawMsg::kCamera | plProxyDrawMsg::kDestroy); plgDispatch::MsgSend(Dmsg); plVirtualCam::Instance()->GetPipeline()->SetDrawableTypeMask(plVirtualCam::Instance()->GetPipeline()->GetDrawableTypeMask() & ~plDrawableSpans::kCameraProxy); #endif @@ -585,14 +582,14 @@ plVirtualCam::Instance()->GetPipeline()->SetDrawableTypeMask(plVirtualCam::Insta if (fMessageQueue[i]->fControlActivated) { // send a 'picked' message to the picked object - plPickedMsg* pPickedMsg = TRACKED_NEW plPickedMsg; + plPickedMsg* pPickedMsg = new plPickedMsg; pPickedMsg->AddReceiver(fCurrentClickable); plgDispatch::MsgSend(pPickedMsg); } else { // send an 'unpicked message' - plPickedMsg* pPickedMsg = TRACKED_NEW plPickedMsg; + plPickedMsg* pPickedMsg = new plPickedMsg; pPickedMsg->AddReceiver(fCurrentClickable); pPickedMsg->fPicked = false; plgDispatch::MsgSend(pPickedMsg); @@ -671,7 +668,7 @@ void plAvatarInputInterface::MissedInputEvent( plInputEventMsg *pMsg ) if( IHasKeyControlFlag( binding.GetCode() ) && binding.GetCode() != B_CONTROL_ALWAYS_RUN ) { - plCtrlCmd *pCmd = TRACKED_NEW plCtrlCmd( this ); + plCtrlCmd *pCmd = new plCtrlCmd( this ); pCmd->fControlCode = binding.GetCode(); pCmd->fControlActivated = false; pCmd->SetCmdString( binding.GetExtendedString() ); @@ -727,7 +724,7 @@ hsBool plAvatarInputInterface::InterpretInputEvent( plInputEventMsg *pMsg ) plMouseEventMsg* pMouseMsg = plMouseEventMsg::ConvertNoRef(pMsg); if (pMouseMsg) { - UInt32 oldButtonState = fInputMap->fButtonState; + uint32_t oldButtonState = fInputMap->fButtonState; // check for button presses... if (fInputMap->fButtonState & kLeftButtonDown) @@ -845,10 +842,10 @@ hsBool plAvatarInputInterface::InterpretInputEvent( plInputEventMsg *pMsg ) if ((mouseMap->fMap[i]->fControlFlags & kControlFlagRangePos) || (mouseMap->fMap[i]->fControlFlags & kControlFlagRangeNeg)) { - plCtrlCmd* pCmd = TRACKED_NEW plCtrlCmd( this ); + plCtrlCmd* pCmd = new plCtrlCmd( this ); pCmd->fControlActivated = true; pCmd->fControlCode = mouseMap->fMap[i]->fCode; - hsScalar pct = 0.0f; + float pct = 0.0f; if (mouseMap->fMap[i]->fControlFlags & kControlFlagRangePos) { if (mouseMap->fMap[i]->fControlFlags & kControlFlagXAxisEvent) @@ -875,10 +872,10 @@ hsBool plAvatarInputInterface::InterpretInputEvent( plInputEventMsg *pMsg ) } if (mouseMap->fMap[i]->fControlFlags & kControlFlagDelta) { - plCtrlCmd* pCmd = TRACKED_NEW plCtrlCmd( this ); + plCtrlCmd* pCmd = new plCtrlCmd( this ); pCmd->fControlActivated = true; pCmd->fControlCode = mouseMap->fMap[i]->fCode; - hsScalar pct = 0.0f; + float pct = 0.0f; if (mouseMap->fMap[i]->fControlFlags & kControlFlagXAxisEvent) pct = pMouseMsg->GetDX(); @@ -899,7 +896,7 @@ hsBool plAvatarInputInterface::InterpretInputEvent( plInputEventMsg *pMsg ) else // if it is an 'always if in box' command see if it's not in the box if ( (mouseMap->fMap[i]->fControlFlags & kControlFlagInBox) && (!CursorInBox(pMouseMsg, mouseMap->fMap[i]->fBox)) ) { - plCtrlCmd* pCmd = TRACKED_NEW plCtrlCmd( this ); + plCtrlCmd* pCmd = new plCtrlCmd( this ); pCmd->fControlActivated = false; pCmd->fControlCode = mouseMap->fMap[i]->fCode; pCmd->fNetPropagateToPlayers = mouseMap->fMap[i]->fControlFlags & kControlFlagNetPropagate; @@ -953,13 +950,13 @@ hsBool plAvatarInputInterface::InterpretInputEvent( plInputEventMsg *pMsg ) if (!(mouseMap->fMap[i]->fControlFlags & kControlFlagInBox)) SetControlFlag(mouseMap->fMap[i]->fCode); // issue the command - plCtrlCmd* pCmd = TRACKED_NEW plCtrlCmd( this ); + plCtrlCmd* pCmd = new plCtrlCmd( this ); pCmd->fControlActivated = true; pCmd->fControlCode = mouseMap->fMap[i]->fCode; pCmd->fNetPropagateToPlayers = mouseMap->fMap[i]->fControlFlags & kControlFlagNetPropagate; // figure out what percent (if any) - hsScalar pct = 0.0f; + float pct = 0.0f; if (mouseMap->fMap[i]->fControlFlags & kControlFlagRangePos) { if (mouseMap->fMap[i]->fControlFlags & kControlFlagXAxisEvent) @@ -1022,7 +1019,7 @@ hsBool plAvatarInputInterface::InterpretInputEvent( plInputEventMsg *pMsg ) plAvatarInputMap::plAvatarInputMap() { - fMouseMap = TRACKED_NEW plMouseMap; + fMouseMap = new plMouseMap; fButtonState = 0; fInterface = plAvatarInputInterface::GetInstance(); @@ -1035,50 +1032,50 @@ plAvatarInputMap::~plAvatarInputMap() plSuspendedMovementMap::plSuspendedMovementMap() : plAvatarInputMap() { - fMouseMap->AddMapping( TRACKED_NEW plMouseInfo(B_CONTROL_ACTION_MOUSE, kControlFlagLeftButtonEx, 0.0f, 1.0f, 0.0f, 1.0f, "The Picked key") ); - fMouseMap->AddMapping( TRACKED_NEW plMouseInfo(B_CONTROL_PICK, kControlFlagLeftButton, 0.0f, 1.0f, 0.0f, 1.0f, "The Picked key") ); + fMouseMap->AddMapping( new plMouseInfo(B_CONTROL_ACTION_MOUSE, kControlFlagLeftButtonEx, 0.0f, 1.0f, 0.0f, 1.0f, "The Picked key") ); + fMouseMap->AddMapping( new plMouseInfo(B_CONTROL_PICK, kControlFlagLeftButton, 0.0f, 1.0f, 0.0f, 1.0f, "The Picked key") ); } plBasicControlMap::plBasicControlMap() : plSuspendedMovementMap() { - fMouseMap->AddMapping( TRACKED_NEW plMouseInfo(B_CONTROL_ROTATE_RIGHT, kControlFlagLeftButton | kControlFlagBoxDisable, 0.95f, 1.0f, 0.0f, 1.0f, "Rotate Player Right") ); - fMouseMap->AddMapping( TRACKED_NEW plMouseInfo(B_CONTROL_ROTATE_LEFT, kControlFlagLeftButton | kControlFlagBoxDisable, 0.0f, 0.05f, 0.0f, 1.0f, "Rotate Player Left") ); + fMouseMap->AddMapping( new plMouseInfo(B_CONTROL_ROTATE_RIGHT, kControlFlagLeftButton | kControlFlagBoxDisable, 0.95f, 1.0f, 0.0f, 1.0f, "Rotate Player Right") ); + fMouseMap->AddMapping( new plMouseInfo(B_CONTROL_ROTATE_LEFT, kControlFlagLeftButton | kControlFlagBoxDisable, 0.0f, 0.05f, 0.0f, 1.0f, "Rotate Player Left") ); - fMouseMap->AddMapping( TRACKED_NEW plMouseInfo(B_CONTROL_TURN_TO, kControlFlagLeftButtonEx, 0.05f, 0.95f, 0.0f, 0.95f, "Turn to") ); - fMouseMap->AddMapping( TRACKED_NEW plMouseInfo(S_SET_WALK_MODE, kControlFlagLeftButton, 0.05f, 0.95f, 0.0f, 0.95f, "Set Walk Mode") ); - fMouseMap->AddMapping( TRACKED_NEW plMouseInfo(S_SET_WALK_BACK_LB_MODE, kControlFlagLeftButton, 0.05f, 0.95f, 0.95f, 1.0f, "Set Walk Back LB Mode") ); - fMouseMap->AddMapping( TRACKED_NEW plMouseInfo(S_SET_WALK_BACK_MODE, kControlFlagMiddleButton, 0.05f, 0.95f, 0.0f, 1.0f, "Set Walk Back Mode") ); - - fMouseMap->AddMapping( TRACKED_NEW plMouseInfo(S_SET_CURSOR_UP, kControlFlagNormal | kControlFlagInBox, 0.05f, 0.95f, 0.0f, 0.95f, "set cursor up") ); - fMouseMap->AddMapping( TRACKED_NEW plMouseInfo(S_SET_CURSOR_DOWN, kControlFlagNormal | kControlFlagInBox, 0.05f, 0.95f, 0.95f, 1.0f, "set cursor down") ); - fMouseMap->AddMapping( TRACKED_NEW plMouseInfo(S_SET_CURSOR_RIGHT, kControlFlagNormal | kControlFlagInBox, 0.95f, 1.0f, 0.0f, 1.0f, "set cursor right") ); - fMouseMap->AddMapping( TRACKED_NEW plMouseInfo(S_SET_CURSOR_LEFT, kControlFlagNormal | kControlFlagInBox, 0.0f, 0.05f, 0.0f, 1.0f, "set cursor left") ); + fMouseMap->AddMapping( new plMouseInfo(B_CONTROL_TURN_TO, kControlFlagLeftButtonEx, 0.05f, 0.95f, 0.0f, 0.95f, "Turn to") ); + fMouseMap->AddMapping( new plMouseInfo(S_SET_WALK_MODE, kControlFlagLeftButton, 0.05f, 0.95f, 0.0f, 0.95f, "Set Walk Mode") ); + fMouseMap->AddMapping( new plMouseInfo(S_SET_WALK_BACK_LB_MODE, kControlFlagLeftButton, 0.05f, 0.95f, 0.95f, 1.0f, "Set Walk Back LB Mode") ); + fMouseMap->AddMapping( new plMouseInfo(S_SET_WALK_BACK_MODE, kControlFlagMiddleButton, 0.05f, 0.95f, 0.0f, 1.0f, "Set Walk Back Mode") ); + + fMouseMap->AddMapping( new plMouseInfo(S_SET_CURSOR_UP, kControlFlagNormal | kControlFlagInBox, 0.05f, 0.95f, 0.0f, 0.95f, "set cursor up") ); + fMouseMap->AddMapping( new plMouseInfo(S_SET_CURSOR_DOWN, kControlFlagNormal | kControlFlagInBox, 0.05f, 0.95f, 0.95f, 1.0f, "set cursor down") ); + fMouseMap->AddMapping( new plMouseInfo(S_SET_CURSOR_RIGHT, kControlFlagNormal | kControlFlagInBox, 0.95f, 1.0f, 0.0f, 1.0f, "set cursor right") ); + fMouseMap->AddMapping( new plMouseInfo(S_SET_CURSOR_LEFT, kControlFlagNormal | kControlFlagInBox, 0.0f, 0.05f, 0.0f, 1.0f, "set cursor left") ); } plLadderControlMap::plLadderControlMap() : plSuspendedMovementMap() { - fMouseMap->AddMapping( TRACKED_NEW plMouseInfo(B_CONTROL_MOVE_FORWARD, kControlFlagLeftButton | kControlFlagBoxDisable, 0.0f, 1.0f, 0.0f, 0.5f, "Set Walk Mode") ); - fMouseMap->AddMapping( TRACKED_NEW plMouseInfo(B_CONTROL_MOVE_BACKWARD, kControlFlagLeftButton | kControlFlagBoxDisable, 0.0f, 1.0f, 0.5f, 1.0f, "Set Walk Back LB Mode") ); + fMouseMap->AddMapping( new plMouseInfo(B_CONTROL_MOVE_FORWARD, kControlFlagLeftButton | kControlFlagBoxDisable, 0.0f, 1.0f, 0.0f, 0.5f, "Set Walk Mode") ); + fMouseMap->AddMapping( new plMouseInfo(B_CONTROL_MOVE_BACKWARD, kControlFlagLeftButton | kControlFlagBoxDisable, 0.0f, 1.0f, 0.5f, 1.0f, "Set Walk Back LB Mode") ); - fMouseMap->AddMapping( TRACKED_NEW plMouseInfo(S_SET_CURSOR_UPWARD, kControlFlagNormal | kControlFlagInBox, 0.0f, 1.0f, 0.0f, 0.5f, "set cursor up") ); - fMouseMap->AddMapping( TRACKED_NEW plMouseInfo(S_SET_CURSOR_DOWN, kControlFlagNormal | kControlFlagInBox, 0.0f, 1.0f, 0.5f, 1.0f, "set cursor down") ); + fMouseMap->AddMapping( new plMouseInfo(S_SET_CURSOR_UPWARD, kControlFlagNormal | kControlFlagInBox, 0.0f, 1.0f, 0.0f, 0.5f, "set cursor up") ); + fMouseMap->AddMapping( new plMouseInfo(S_SET_CURSOR_DOWN, kControlFlagNormal | kControlFlagInBox, 0.0f, 1.0f, 0.5f, 1.0f, "set cursor down") ); - fMouseMap->AddMapping( TRACKED_NEW plMouseInfo(S_SET_FREELOOK, kControlFlagRightButton, 0.05f, 0.95f, 0.0f, 0.95f, "Set Camera first-person z-axis panning") ); + fMouseMap->AddMapping( new plMouseInfo(S_SET_FREELOOK, kControlFlagRightButton, 0.05f, 0.95f, 0.0f, 0.95f, "Set Camera first-person z-axis panning") ); } plLadderMountMap::plLadderMountMap() : plSuspendedMovementMap() { - fMouseMap->AddMapping( TRACKED_NEW plMouseInfo(S_SET_LADDER_CONTROL, kControlFlagLeftButtonUp, 0.0f, 1.0f, 0.0f, 1.0f, "Set Ladder Mode") ); - fMouseMap->AddMapping( TRACKED_NEW plMouseInfo(S_SET_LADDER_CONTROL, kControlFlagRightButtonUp, 0.0f, 1.0f, 0.0f, 1.0f, "Set Ladder Mode") ); - fMouseMap->AddMapping( TRACKED_NEW plMouseInfo(S_SET_LADDER_CONTROL, kControlFlagMiddleButtonUp, 0.0f, 1.0f, 0.0f, 1.0f, "Set Ladder Mode") ); + fMouseMap->AddMapping( new plMouseInfo(S_SET_LADDER_CONTROL, kControlFlagLeftButtonUp, 0.0f, 1.0f, 0.0f, 1.0f, "Set Ladder Mode") ); + fMouseMap->AddMapping( new plMouseInfo(S_SET_LADDER_CONTROL, kControlFlagRightButtonUp, 0.0f, 1.0f, 0.0f, 1.0f, "Set Ladder Mode") ); + fMouseMap->AddMapping( new plMouseInfo(S_SET_LADDER_CONTROL, kControlFlagMiddleButtonUp, 0.0f, 1.0f, 0.0f, 1.0f, "Set Ladder Mode") ); } plLadderDismountMap::plLadderDismountMap() : plSuspendedMovementMap() { - fMouseMap->AddMapping( TRACKED_NEW plMouseInfo(S_SET_BASIC_MODE, kControlFlagLeftButtonUp, 0.0f, 1.0f, 0.0f, 1.0f, "Set Basic Mode") ); - fMouseMap->AddMapping( TRACKED_NEW plMouseInfo(S_SET_BASIC_MODE, kControlFlagRightButtonUp, 0.0f, 1.0f, 0.0f, 1.0f, "Set Basic Mode") ); - fMouseMap->AddMapping( TRACKED_NEW plMouseInfo(S_SET_BASIC_MODE, kControlFlagMiddleButtonUp, 0.0f, 1.0f, 0.0f, 1.0f, "Set Basic Mode") ); + fMouseMap->AddMapping( new plMouseInfo(S_SET_BASIC_MODE, kControlFlagLeftButtonUp, 0.0f, 1.0f, 0.0f, 1.0f, "Set Basic Mode") ); + fMouseMap->AddMapping( new plMouseInfo(S_SET_BASIC_MODE, kControlFlagRightButtonUp, 0.0f, 1.0f, 0.0f, 1.0f, "Set Basic Mode") ); + fMouseMap->AddMapping( new plMouseInfo(S_SET_BASIC_MODE, kControlFlagMiddleButtonUp, 0.0f, 1.0f, 0.0f, 1.0f, "Set Basic Mode") ); } @@ -1086,22 +1083,22 @@ plLadderDismountMap::plLadderDismountMap() : plSuspendedMovementMap() plBasicThirdPersonControlMap::plBasicThirdPersonControlMap() : plBasicControlMap() { - fMouseMap->AddMapping( TRACKED_NEW plMouseInfo(S_SET_FREELOOK, kControlFlagRightButton, 0.0f, 1.0f, 0.0f, 1.0f, "Freelook Mode") ); + fMouseMap->AddMapping( new plMouseInfo(S_SET_FREELOOK, kControlFlagRightButton, 0.0f, 1.0f, 0.0f, 1.0f, "Freelook Mode") ); } plBasicFirstPersonControlMap::plBasicFirstPersonControlMap() : plBasicControlMap() { - fMouseMap->AddMapping( TRACKED_NEW plMouseInfo(A_CONTROL_TURN, kControlFlagRightButtonRepeat | kControlFlagXAxisEvent | kControlFlagDelta, 0.0f, 1.0f, 0.0f, 1.0f, "Rotate Player") ); - fMouseMap->AddMapping( TRACKED_NEW plMouseInfo(S_SET_FREELOOK, kControlFlagRightButton, 0.05f, 0.95f, 0.0f, 0.95f, "Set Camera first-person z-axis panning") ); - fMouseMap->AddMapping( TRACKED_NEW plMouseInfo(B_CONTROL_CAMERA_WALK_PAN, kControlFlagRightButton, 0.05f, 0.95f, 0.0f, 0.95f, "Set Camera first-person z-axis panning") ); + fMouseMap->AddMapping( new plMouseInfo(A_CONTROL_TURN, kControlFlagRightButtonRepeat | kControlFlagXAxisEvent | kControlFlagDelta, 0.0f, 1.0f, 0.0f, 1.0f, "Rotate Player") ); + fMouseMap->AddMapping( new plMouseInfo(S_SET_FREELOOK, kControlFlagRightButton, 0.05f, 0.95f, 0.0f, 0.95f, "Set Camera first-person z-axis panning") ); + fMouseMap->AddMapping( new plMouseInfo(B_CONTROL_CAMERA_WALK_PAN, kControlFlagRightButton, 0.05f, 0.95f, 0.0f, 0.95f, "Set Camera first-person z-axis panning") ); } // also used in 1st person walk mode pl3rdWalkMap::pl3rdWalkMap() : plAvatarInputMap() { // control special to this mode. - fMouseMap->AddMapping( TRACKED_NEW plMouseInfo(B_CONTROL_MODIFIER_FAST, kControlFlagRightButton, 0.0f, 1.0f, 0.0f, 1.0f, "Run Modifier" ) ); - fMouseMap->AddMapping( TRACKED_NEW plMouseInfo(A_CONTROL_TURN, kControlFlagXAxisEvent | kControlFlagDelta, 0.0f, 1.0f, 0.0f, 1.0f, "Rotate Player") ); + fMouseMap->AddMapping( new plMouseInfo(B_CONTROL_MODIFIER_FAST, kControlFlagRightButton, 0.0f, 1.0f, 0.0f, 1.0f, "Run Modifier" ) ); + fMouseMap->AddMapping( new plMouseInfo(A_CONTROL_TURN, kControlFlagXAxisEvent | kControlFlagDelta, 0.0f, 1.0f, 0.0f, 1.0f, "Rotate Player") ); plInputManager::SetRecenterMouse(true); plMouseDevice::HideCursor(); @@ -1117,22 +1114,22 @@ pl3rdWalkMap::~pl3rdWalkMap() pl3rdWalkForwardMap::pl3rdWalkForwardMap() : pl3rdWalkMap() { - fMouseMap->AddMapping( TRACKED_NEW plMouseInfo(S_SET_BASIC_MODE, kControlFlagLeftButtonUp, 0.0f, 1.0f, 0.0f, 1.0f, "Third Person") ); - fMouseMap->AddMapping( TRACKED_NEW plMouseInfo(B_CONTROL_MOVE_FORWARD, kControlFlagLeftButton, 0.0f, 1.0f, 0.0f, 1.0f, "Walk forward") ); - fMouseMap->AddMapping( TRACKED_NEW plMouseInfo(B_CONTROL_CAMERA_WALK_PAN, kControlFlagLeftButton, 0.0f, 1.0f, 0.0f, 1.0f, "Set Camera first-person z-axis panning") ); + fMouseMap->AddMapping( new plMouseInfo(S_SET_BASIC_MODE, kControlFlagLeftButtonUp, 0.0f, 1.0f, 0.0f, 1.0f, "Third Person") ); + fMouseMap->AddMapping( new plMouseInfo(B_CONTROL_MOVE_FORWARD, kControlFlagLeftButton, 0.0f, 1.0f, 0.0f, 1.0f, "Walk forward") ); + fMouseMap->AddMapping( new plMouseInfo(B_CONTROL_CAMERA_WALK_PAN, kControlFlagLeftButton, 0.0f, 1.0f, 0.0f, 1.0f, "Set Camera first-person z-axis panning") ); } pl3rdWalkBackwardMap::pl3rdWalkBackwardMap() : pl3rdWalkMap() { - fMouseMap->AddMapping( TRACKED_NEW plMouseInfo(S_SET_BASIC_MODE, kControlFlagMiddleButtonUp, 0.0f, 1.0f, 0.0f, 1.0f, "Third Person") ); - fMouseMap->AddMapping( TRACKED_NEW plMouseInfo(B_CONTROL_MOVE_BACKWARD, kControlFlagMiddleButton, 0.0f, 1.0f, 0.0f, 1.0f, "Walk backward") ); - fMouseMap->AddMapping( TRACKED_NEW plMouseInfo(B_CONTROL_CAMERA_WALK_PAN, kControlFlagMiddleButton, 0.0f, 1.0f, 0.0f, 1.0f, "Set Camera first-person z-axis panning") ); + fMouseMap->AddMapping( new plMouseInfo(S_SET_BASIC_MODE, kControlFlagMiddleButtonUp, 0.0f, 1.0f, 0.0f, 1.0f, "Third Person") ); + fMouseMap->AddMapping( new plMouseInfo(B_CONTROL_MOVE_BACKWARD, kControlFlagMiddleButton, 0.0f, 1.0f, 0.0f, 1.0f, "Walk backward") ); + fMouseMap->AddMapping( new plMouseInfo(B_CONTROL_CAMERA_WALK_PAN, kControlFlagMiddleButton, 0.0f, 1.0f, 0.0f, 1.0f, "Set Camera first-person z-axis panning") ); } // same as the other backward walk map, but this one is triggered by the left mouse button. pl3rdWalkBackwardLBMap::pl3rdWalkBackwardLBMap() : pl3rdWalkMap() { - fMouseMap->AddMapping( TRACKED_NEW plMouseInfo(S_SET_BASIC_MODE, kControlFlagLeftButtonUp, 0.0f, 1.0f, 0.0f, 1.0f, "Third Person") ); - fMouseMap->AddMapping( TRACKED_NEW plMouseInfo(B_CONTROL_MOVE_BACKWARD, kControlFlagLeftButton, 0.0f, 1.0f, 0.0f, 1.0f, "Walk backward") ); - fMouseMap->AddMapping( TRACKED_NEW plMouseInfo(B_CONTROL_CAMERA_WALK_PAN, kControlFlagLeftButton, 0.0f, 1.0f, 0.0f, 1.0f, "Set Camera first-person z-axis panning") ); + fMouseMap->AddMapping( new plMouseInfo(S_SET_BASIC_MODE, kControlFlagLeftButtonUp, 0.0f, 1.0f, 0.0f, 1.0f, "Third Person") ); + fMouseMap->AddMapping( new plMouseInfo(B_CONTROL_MOVE_BACKWARD, kControlFlagLeftButton, 0.0f, 1.0f, 0.0f, 1.0f, "Walk backward") ); + fMouseMap->AddMapping( new plMouseInfo(B_CONTROL_CAMERA_WALK_PAN, kControlFlagLeftButton, 0.0f, 1.0f, 0.0f, 1.0f, "Set Camera first-person z-axis panning") ); } \ No newline at end of file diff --git a/Sources/Plasma/PubUtilLib/plInputCore/plAvatarInputInterface.h b/Sources/Plasma/PubUtilLib/plInputCore/plAvatarInputInterface.h index 2652e940..2f65a781 100644 --- a/Sources/Plasma/PubUtilLib/plInputCore/plAvatarInputInterface.h +++ b/Sources/Plasma/PubUtilLib/plInputCore/plAvatarInputInterface.h @@ -54,7 +54,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "hsTemplates.h" #include "hsGeometry3.h" -#include "hsUtils.h" + //// Class Definition //////////////////////////////////////////////////////// @@ -86,7 +86,7 @@ class plAvatarInputMap virtual hsBool IsBasic() { return false; } plMouseMap *fMouseMap; - UInt32 fButtonState; + uint32_t fButtonState; }; // Basic avatar mappings, for when the avatar is in "suspended input" mode. @@ -178,8 +178,8 @@ class plAvatarInputInterface : public plInputInterface { protected: - UInt32 fCurrentCursor; - hsScalar fCursorOpacity, fCursorTimeout, fCursorFadeDelay; + uint32_t fCurrentCursor; + float fCursorOpacity, fCursorTimeout, fCursorFadeDelay; plAvatarInputMap *fInputMap; @@ -188,7 +188,7 @@ class plAvatarInputInterface : public plInputInterface virtual hsBool IHandleCtrlCmd( plCtrlCmd *cmd ); // Gets called once per IUpdate(), just like normal IEval()s - virtual hsBool IEval( double secs, hsScalar del, UInt32 dirty ); + virtual hsBool IEval( double secs, float del, uint32_t dirty ); void IDeactivateCommand(plMouseInfo *info); void IChangeInputMaps(plAvatarInputMap *newMap); @@ -209,7 +209,7 @@ class plAvatarInputInterface : public plInputInterface void Reset(); - void RequestCursorToWorldPos(hsScalar xPos, hsScalar yPos, int ID); + void RequestCursorToWorldPos(float xPos, float yPos, int ID); hsBitVector fControlFlags; hsBool fMouseDisabled; @@ -228,9 +228,9 @@ class plAvatarInputInterface : public plInputInterface // Always return true, since the cursor should be representing how we control the avatar virtual hsBool HasInterestingCursorID( void ) const { return true; } - virtual UInt32 GetPriorityLevel( void ) const { return kAvatarInputPriority; } - virtual UInt32 GetCurrentCursorID( void ) const { return fCurrentCursor; } - virtual hsScalar GetCurrentCursorOpacity( void ) const { return fCursorOpacity; } + virtual uint32_t GetPriorityLevel( void ) const { return kAvatarInputPriority; } + virtual uint32_t GetCurrentCursorID( void ) const { return fCurrentCursor; } + virtual float GetCurrentCursorOpacity( void ) const { return fCursorOpacity; } const char* GetInputMapName() { return fInputMap ? fInputMap->GetName() : ""; } virtual hsBool InterpretInputEvent( plInputEventMsg *pMsg ); @@ -256,7 +256,7 @@ class plAvatarInputInterface : public plInputInterface void SetControlFlag(int f, hsBool val = true) { fControlFlags.SetBit(f, val); } - void SetCursorFadeDelay( hsScalar delay ) { fCursorFadeDelay = delay; } + void SetCursorFadeDelay( float delay ) { fCursorFadeDelay = delay; } hsBool IsEnterChatModeBound(); diff --git a/Sources/Plasma/PubUtilLib/plInputCore/plDInputDevice.cpp b/Sources/Plasma/PubUtilLib/plInputCore/plDInputDevice.cpp index 57c3f270..2940a387 100644 --- a/Sources/Plasma/PubUtilLib/plInputCore/plDInputDevice.cpp +++ b/Sources/Plasma/PubUtilLib/plInputCore/plDInputDevice.cpp @@ -41,8 +41,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ // plDInputDevice.cpp -#include "hsConfig.h" -#include "hsWindows.h" +#include "HeadSpin.h" #include "plDInputDevice.h" #include "plgDispatch.h" @@ -75,7 +74,7 @@ void plDInputDevice::Update(DIDEVICEOBJECTDATA* js) int i = (int)(js->dwData); if (i <= -1) { - plControlEventMsg* pMsg = TRACKED_NEW plControlEventMsg; + plControlEventMsg* pMsg = new plControlEventMsg; pMsg->SetControlCode( B_CONTROL_MOVE_FORWARD ); pMsg->SetControlActivated( true ); plgDispatch::MsgSend( pMsg ); @@ -83,7 +82,7 @@ void plDInputDevice::Update(DIDEVICEOBJECTDATA* js) else if (i >= 1) { - plControlEventMsg* pMsg = TRACKED_NEW plControlEventMsg; + plControlEventMsg* pMsg = new plControlEventMsg; pMsg->SetControlCode( B_CONTROL_MOVE_BACKWARD ); pMsg->SetControlActivated( true ); plgDispatch::MsgSend( pMsg ); @@ -91,11 +90,11 @@ void plDInputDevice::Update(DIDEVICEOBJECTDATA* js) else if (i == 0) { - plControlEventMsg* pMsg = TRACKED_NEW plControlEventMsg; + plControlEventMsg* pMsg = new plControlEventMsg; pMsg->SetControlCode( B_CONTROL_MOVE_BACKWARD ); pMsg->SetControlActivated( false ); plgDispatch::MsgSend( pMsg ); - plControlEventMsg* pMsg2 = TRACKED_NEW plControlEventMsg; + plControlEventMsg* pMsg2 = new plControlEventMsg; pMsg2->SetControlCode( B_CONTROL_MOVE_FORWARD ); pMsg2->SetControlActivated( false ); plgDispatch::MsgSend( pMsg2 ); @@ -107,7 +106,7 @@ void plDInputDevice::Update(DIDEVICEOBJECTDATA* js) { int i = (int)(js->dwData); float f = ((float)i) * 0.001f; - plControlEventMsg* pMsg = TRACKED_NEW plControlEventMsg; + plControlEventMsg* pMsg = new plControlEventMsg; pMsg->SetControlCode( A_CONTROL_TURN ); if (f <= 0.02 && f >= -0.02) pMsg->SetControlActivated( false ); @@ -119,7 +118,7 @@ void plDInputDevice::Update(DIDEVICEOBJECTDATA* js) break; case B_CONTROL_ACTION: { - plControlEventMsg* pMsg = TRACKED_NEW plControlEventMsg; + plControlEventMsg* pMsg = new plControlEventMsg; pMsg->SetControlCode( B_CONTROL_ACTION ); pMsg->SetControlActivated(js->dwData & 0x80); plgDispatch::MsgSend(pMsg); @@ -127,7 +126,7 @@ void plDInputDevice::Update(DIDEVICEOBJECTDATA* js) break; case B_CONTROL_MODIFIER_FAST: { - plControlEventMsg* pMsg = TRACKED_NEW plControlEventMsg; + plControlEventMsg* pMsg = new plControlEventMsg; pMsg->SetControlCode( B_CONTROL_MODIFIER_FAST ); pMsg->SetControlActivated(js->dwData & 0x80); plgDispatch::MsgSend(pMsg); @@ -135,7 +134,7 @@ void plDInputDevice::Update(DIDEVICEOBJECTDATA* js) break; case B_CONTROL_JUMP: { - plControlEventMsg* pMsg = TRACKED_NEW plControlEventMsg; + plControlEventMsg* pMsg = new plControlEventMsg; pMsg->SetControlCode( B_CONTROL_JUMP ); pMsg->SetControlActivated(js->dwData & 0x80); plgDispatch::MsgSend(pMsg); @@ -143,7 +142,7 @@ void plDInputDevice::Update(DIDEVICEOBJECTDATA* js) break; case B_CONTROL_STRAFE_LEFT: { - plControlEventMsg* pMsg = TRACKED_NEW plControlEventMsg; + plControlEventMsg* pMsg = new plControlEventMsg; pMsg->SetControlCode( B_CONTROL_STRAFE_LEFT ); pMsg->SetControlActivated(js->dwData & 0x80); plgDispatch::MsgSend(pMsg); @@ -151,7 +150,7 @@ void plDInputDevice::Update(DIDEVICEOBJECTDATA* js) break; case B_CONTROL_STRAFE_RIGHT: { - plControlEventMsg* pMsg = TRACKED_NEW plControlEventMsg; + plControlEventMsg* pMsg = new plControlEventMsg; pMsg->SetControlCode( B_CONTROL_STRAFE_RIGHT); pMsg->SetControlActivated(js->dwData & 0x80); plgDispatch::MsgSend(pMsg); @@ -159,7 +158,7 @@ void plDInputDevice::Update(DIDEVICEOBJECTDATA* js) break; case B_CONTROL_EQUIP: { - plControlEventMsg* pMsg = TRACKED_NEW plControlEventMsg; + plControlEventMsg* pMsg = new plControlEventMsg; pMsg->SetControlCode( B_CONTROL_EQUIP ); pMsg->SetControlActivated(js->dwData & 0x80); plgDispatch::MsgSend(pMsg); @@ -167,7 +166,7 @@ void plDInputDevice::Update(DIDEVICEOBJECTDATA* js) break; case B_CONTROL_DROP: { - plControlEventMsg* pMsg = TRACKED_NEW plControlEventMsg; + plControlEventMsg* pMsg = new plControlEventMsg; pMsg->SetControlCode( B_CONTROL_DROP ); pMsg->SetControlActivated(js->dwData & 0x80); plgDispatch::MsgSend(pMsg); @@ -175,7 +174,7 @@ void plDInputDevice::Update(DIDEVICEOBJECTDATA* js) break; case B_CONTROL_MOVE_FORWARD: { - plControlEventMsg* pMsg = TRACKED_NEW plControlEventMsg; + plControlEventMsg* pMsg = new plControlEventMsg; pMsg->SetControlCode( B_CONTROL_MOVE_FORWARD ); pMsg->SetControlActivated(js->dwData & 0x80); plgDispatch::MsgSend(pMsg); @@ -183,7 +182,7 @@ void plDInputDevice::Update(DIDEVICEOBJECTDATA* js) break; case B_CONTROL_MOVE_BACKWARD: { - plControlEventMsg* pMsg = TRACKED_NEW plControlEventMsg; + plControlEventMsg* pMsg = new plControlEventMsg; pMsg->SetControlCode( B_CONTROL_MOVE_BACKWARD ); pMsg->SetControlActivated(js->dwData & 0x80); plgDispatch::MsgSend(pMsg); @@ -191,7 +190,7 @@ void plDInputDevice::Update(DIDEVICEOBJECTDATA* js) break; case B_CONTROL_ROTATE_RIGHT: { - plControlEventMsg* pMsg = TRACKED_NEW plControlEventMsg; + plControlEventMsg* pMsg = new plControlEventMsg; pMsg->SetControlCode( B_CONTROL_ROTATE_RIGHT); pMsg->SetControlActivated(js->dwData & 0x80); plgDispatch::MsgSend(pMsg); @@ -199,7 +198,7 @@ void plDInputDevice::Update(DIDEVICEOBJECTDATA* js) break; case B_CONTROL_ROTATE_LEFT: { - plControlEventMsg* pMsg = TRACKED_NEW plControlEventMsg; + plControlEventMsg* pMsg = new plControlEventMsg; pMsg->SetControlCode( B_CONTROL_ROTATE_LEFT ); pMsg->SetControlActivated(js->dwData & 0x80); plgDispatch::MsgSend(pMsg); @@ -207,7 +206,7 @@ void plDInputDevice::Update(DIDEVICEOBJECTDATA* js) break; case B_CONTROL_TURN_TO: { - plControlEventMsg* pMsg = TRACKED_NEW plControlEventMsg; + plControlEventMsg* pMsg = new plControlEventMsg; pMsg->SetControlCode( B_CONTROL_TURN_TO ); pMsg->SetControlActivated(js->dwData & 0x80); plgDispatch::MsgSend(pMsg); @@ -215,7 +214,7 @@ void plDInputDevice::Update(DIDEVICEOBJECTDATA* js) break; case B_CAMERA_RECENTER: { - plControlEventMsg* pMsg = TRACKED_NEW plControlEventMsg; + plControlEventMsg* pMsg = new plControlEventMsg; pMsg->SetControlCode( B_CAMERA_RECENTER ); pMsg->SetControlActivated(js->dwData & 0x80); plgDispatch::MsgSend(pMsg); @@ -228,12 +227,12 @@ void plDInputDevice::Update(DIDEVICEOBJECTDATA* js) float f = ((float)i) * 0.001f; if (f <= 0.02 && f >= -0.02) { - plControlEventMsg* pMsg = TRACKED_NEW plControlEventMsg; + plControlEventMsg* pMsg = new plControlEventMsg; pMsg->SetControlActivated( false ); pMsg->SetControlCode(B_CAMERA_ROTATE_DOWN); pMsg->SetControlPct(0); plgDispatch::MsgSend( pMsg ); - plControlEventMsg* pMsg2 = TRACKED_NEW plControlEventMsg; + plControlEventMsg* pMsg2 = new plControlEventMsg; pMsg2->SetControlActivated( false ); pMsg2->SetControlCode(B_CAMERA_ROTATE_UP); pMsg2->SetControlPct(0); @@ -241,7 +240,7 @@ void plDInputDevice::Update(DIDEVICEOBJECTDATA* js) } else { - plControlEventMsg* pMsg = TRACKED_NEW plControlEventMsg; + plControlEventMsg* pMsg = new plControlEventMsg; pMsg->SetControlActivated( true ); if (f < 0) pMsg->SetControlCode(B_CAMERA_ROTATE_DOWN); @@ -259,12 +258,12 @@ void plDInputDevice::Update(DIDEVICEOBJECTDATA* js) float f = ((float)i) * 0.001f; if (f <= 0.02 && f >= -0.02) { - plControlEventMsg* pMsg = TRACKED_NEW plControlEventMsg; + plControlEventMsg* pMsg = new plControlEventMsg; pMsg->SetControlActivated( false ); pMsg->SetControlCode(B_CAMERA_ROTATE_RIGHT); pMsg->SetControlPct(0); plgDispatch::MsgSend( pMsg ); - plControlEventMsg* pMsg2 = TRACKED_NEW plControlEventMsg; + plControlEventMsg* pMsg2 = new plControlEventMsg; pMsg2->SetControlActivated( false ); pMsg2->SetControlCode(B_CAMERA_ROTATE_LEFT); pMsg2->SetControlPct(0); @@ -272,7 +271,7 @@ void plDInputDevice::Update(DIDEVICEOBJECTDATA* js) } else { - plControlEventMsg* pMsg = TRACKED_NEW plControlEventMsg; + plControlEventMsg* pMsg = new plControlEventMsg; pMsg->SetControlActivated( true ); if (f < 0) pMsg->SetControlCode(B_CAMERA_ROTATE_RIGHT); diff --git a/Sources/Plasma/PubUtilLib/plInputCore/plDInputDevice.h b/Sources/Plasma/PubUtilLib/plInputCore/plDInputDevice.h index c60da7c3..4227e6e2 100644 --- a/Sources/Plasma/PubUtilLib/plInputCore/plDInputDevice.h +++ b/Sources/Plasma/PubUtilLib/plInputCore/plDInputDevice.h @@ -59,7 +59,7 @@ public: virtual void Update(DIDEVICEOBJECTDATA* js); protected: - hsScalar fX,fY; + float fX,fY; }; diff --git a/Sources/Plasma/PubUtilLib/plInputCore/plDebugInputInterface.cpp b/Sources/Plasma/PubUtilLib/plInputCore/plDebugInputInterface.cpp index ffde6ae8..c5e73d95 100644 --- a/Sources/Plasma/PubUtilLib/plInputCore/plDebugInputInterface.cpp +++ b/Sources/Plasma/PubUtilLib/plInputCore/plDebugInputInterface.cpp @@ -45,9 +45,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // // ////////////////////////////////////////////////////////////////////////////// -#include "hsConfig.h" -#include "hsWindows.h" -#include "hsTypes.h" +#include "HeadSpin.h" #include "plDebugInputInterface.h" #include "plInputInterfaceMgr.h" @@ -61,7 +59,6 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "plgDispatch.h" #include "plPipeline.h" -#include "hsConfig.h" plDebugInputInterface *plDebugInputInterface::fInstance = nil; @@ -139,7 +136,7 @@ void plDebugInputInterface::RestoreDefaultKeyMappings( void ) //// IEval /////////////////////////////////////////////////////////////////// -hsBool plDebugInputInterface::IEval( double secs, hsScalar del, UInt32 dirty ) +hsBool plDebugInputInterface::IEval( double secs, float del, uint32_t dirty ) { return true; } @@ -228,7 +225,7 @@ hsBool plDebugInputInterface::InterpretInputEvent( plInputEventMsg *pMsg ) if (disable) { - plCtrlCmd* pCmd = TRACKED_NEW plCtrlCmd( this ); + plCtrlCmd* pCmd = new plCtrlCmd( this ); pCmd->fNetPropagateToPlayers = fMouseMap.fMap[i]->fControlFlags & kControlFlagNetPropagate; pCmd->fControlActivated = false; pCmd->fControlCode = fMouseMap.fMap[i]->fCode; @@ -241,10 +238,10 @@ hsBool plDebugInputInterface::InterpretInputEvent( plInputEventMsg *pMsg ) if ((fMouseMap.fMap[i]->fControlFlags & kControlFlagRangePos) || (fMouseMap.fMap[i]->fControlFlags & kControlFlagRangeNeg)) { - plCtrlCmd* pCmd = TRACKED_NEW plCtrlCmd( this ); + plCtrlCmd* pCmd = new plCtrlCmd( this ); pCmd->fControlActivated = true; pCmd->fControlCode = fMouseMap.fMap[i]->fCode; - hsScalar pct = 0.0f; + float pct = 0.0f; if (fMouseMap.fMap[i]->fControlFlags & kControlFlagRangePos) { if (fMouseMap.fMap[i]->fControlFlags & kControlFlagXAxisEvent) @@ -273,7 +270,7 @@ hsBool plDebugInputInterface::InterpretInputEvent( plInputEventMsg *pMsg ) else // if it is an 'always if in box' command see if it's not in the box if ( (fMouseMap.fMap[i]->fControlFlags & kControlFlagInBox) && (!CursorInBox(pMouseMsg, fMouseMap.fMap[i]->fBox)) ) { - plCtrlCmd* pCmd = TRACKED_NEW plCtrlCmd( this ); + plCtrlCmd* pCmd = new plCtrlCmd( this ); pCmd->fControlActivated = false; pCmd->fControlCode = fMouseMap.fMap[i]->fCode; pCmd->fNetPropagateToPlayers = fMouseMap.fMap[i]->fControlFlags & kControlFlagNetPropagate; @@ -313,13 +310,13 @@ hsBool plDebugInputInterface::InterpretInputEvent( plInputEventMsg *pMsg ) if (!(fMouseMap.fMap[i]->fControlFlags & kControlFlagInBox)) fControlFlags.SetBit(fMouseMap.fMap[i]->fCode); // issue the command - plCtrlCmd* pCmd = TRACKED_NEW plCtrlCmd( this ); + plCtrlCmd* pCmd = new plCtrlCmd( this ); pCmd->fControlActivated = true; pCmd->fControlCode = fMouseMap.fMap[i]->fCode; pCmd->fNetPropagateToPlayers = fMouseMap.fMap[i]->fControlFlags & kControlFlagNetPropagate; // figure out what percent (if any) - hsScalar pct = 0.0f; + float pct = 0.0f; if (fMouseMap.fMap[i]->fControlFlags & kControlFlagRangePos) { if (fMouseMap.fMap[i]->fControlFlags & kControlFlagXAxisEvent) diff --git a/Sources/Plasma/PubUtilLib/plInputCore/plDebugInputInterface.h b/Sources/Plasma/PubUtilLib/plInputCore/plDebugInputInterface.h index 5f55e193..2c9b1ab2 100644 --- a/Sources/Plasma/PubUtilLib/plInputCore/plDebugInputInterface.h +++ b/Sources/Plasma/PubUtilLib/plInputCore/plDebugInputInterface.h @@ -60,11 +60,11 @@ class plDebugInputInterface : public plInputInterface { protected: - virtual hsBool IEval( double secs, hsScalar del, UInt32 dirty ); + virtual hsBool IEval( double secs, float del, uint32_t dirty ); hsBool CursorInBox(plMouseEventMsg* pMsg, hsPoint4 box); plMouseMap fMouseMap; - UInt32 fButtonState; + uint32_t fButtonState; hsBitVector fControlFlags; static plDebugInputInterface *fInstance; @@ -76,9 +76,9 @@ class plDebugInputInterface : public plInputInterface // Always return false, virtual hsBool HasInterestingCursorID( void ) const { return false; } - virtual UInt32 GetPriorityLevel( void ) const { return kDebugCmdPrioity; } + virtual uint32_t GetPriorityLevel( void ) const { return kDebugCmdPrioity; } virtual void RestoreDefaultKeyMappings( void ); - virtual UInt32 GetCurrentCursorID( void ) const { return 0; } + virtual uint32_t GetCurrentCursorID( void ) const { return 0; } virtual hsBool InterpretInputEvent( plInputEventMsg *pMsg ); diff --git a/Sources/Plasma/PubUtilLib/plInputCore/plInputDevice.cpp b/Sources/Plasma/PubUtilLib/plInputCore/plInputDevice.cpp index 96d5deb3..a5a96fd3 100644 --- a/Sources/Plasma/PubUtilLib/plInputCore/plInputDevice.cpp +++ b/Sources/Plasma/PubUtilLib/plInputCore/plInputDevice.cpp @@ -42,22 +42,21 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // plInputDevice.cpp //#include "STRING" -#include "hsConfig.h" -#include "hsWindows.h" +#include "HeadSpin.h" #include "plInputDevice.h" #include "plInputManager.h" #include "plAvatarInputInterface.h" #include "plMessage/plInputEventMsg.h" #include "pnMessage/plTimeMsg.h" -#include "hsUtils.h" + #include "plgDispatch.h" #include "plPipeline/plPlates.h" #include "plPipeline/plDebugText.h" #include "plGImage/plMipmap.h" -#include "hsWindows.h" + #include "plPipeline.h" // The resolution that uses the base size of the cursor. @@ -109,7 +108,7 @@ void plKeyboardDevice::ReleaseAllKeys() fKeyboardState[i] = false; // fake a key-up command - plKeyEventMsg* pMsg = TRACKED_NEW plKeyEventMsg; + plKeyEventMsg* pMsg = new plKeyEventMsg; pMsg->SetKeyCode( (plKeyDef)i ); pMsg->SetKeyDown( false ); pMsg->SetShiftKeyDown( fShiftKeyDown ); @@ -129,7 +128,7 @@ void plKeyboardDevice::ReleaseAllKeys() fKeyboardState[KEY_SHIFT] = false; fShiftKeyDown = false; - plKeyEventMsg* pMsg = TRACKED_NEW plKeyEventMsg; + plKeyEventMsg* pMsg = new plKeyEventMsg; pMsg->SetKeyCode( KEY_SHIFT ); pMsg->SetKeyDown( false ); pMsg->SetShiftKeyDown( false ); @@ -143,7 +142,7 @@ void plKeyboardDevice::ReleaseAllKeys() fKeyboardState[KEY_CTRL] = false; fCtrlKeyDown = false; - plKeyEventMsg* pMsg = TRACKED_NEW plKeyEventMsg; + plKeyEventMsg* pMsg = new plKeyEventMsg; pMsg->SetKeyCode( KEY_CTRL ); pMsg->SetKeyDown( false ); pMsg->SetShiftKeyDown( false ); @@ -188,7 +187,7 @@ void plKeyboardDevice::HandleKeyEvent(plOSMsg message, plKeyDef key, bool bKeyDo } // send a key event... - plKeyEventMsg* pMsg = TRACKED_NEW plKeyEventMsg; + plKeyEventMsg* pMsg = new plKeyEventMsg; pMsg->SetKeyChar( c ); pMsg->SetKeyCode( key ); pMsg->SetKeyDown( bKeyDown ); @@ -225,8 +224,8 @@ bool plMouseDevice::bMsgAlways = true; bool plMouseDevice::bCursorHidden = false; bool plMouseDevice::bCursorOverride = false; bool plMouseDevice::bInverted = false; -hsScalar plMouseDevice::fWidth = BASE_WIDTH; -hsScalar plMouseDevice::fHeight = BASE_HEIGHT; +float plMouseDevice::fWidth = BASE_WIDTH; +float plMouseDevice::fHeight = BASE_HEIGHT; plMouseDevice* plMouseDevice::fInstance = 0; plMouseDevice::plMouseDevice() @@ -259,7 +258,7 @@ plMouseDevice::~plMouseDevice() fCursor = nil; plMouseDevice::fInstance = nil; } -void plMouseDevice::SetDisplayResolution(hsScalar Width, hsScalar Height) +void plMouseDevice::SetDisplayResolution(float Width, float Height) { fWidth = Width; fHeight = Height; @@ -309,7 +308,7 @@ void plMouseDevice::AddCCRToCursor() txt.DrawString(fInstance->fWXPos + 12, fInstance->fWYPos - 17, "CCR"); } } -void plMouseDevice::AddIDNumToCursor(UInt32 idNum) +void plMouseDevice::AddIDNumToCursor(uint32_t idNum) { if (fInstance && idNum) { @@ -321,7 +320,7 @@ void plMouseDevice::AddIDNumToCursor(UInt32 idNum) } -void plMouseDevice::SetCursorX(hsScalar x) +void plMouseDevice::SetCursorX(float x) { /// Set the cursor position if( fCursor == nil && !plMouseDevice::bCursorHidden) @@ -335,7 +334,7 @@ void plMouseDevice::SetCursorX(hsScalar x) // txt.DrawString(fWXPos + 20,fWYPos - 5,"test"); } -void plMouseDevice::SetCursorY(hsScalar y) +void plMouseDevice::SetCursorY(float y) { /// Set the cursor position if( fCursor == nil && !plMouseDevice::bCursorHidden) @@ -387,7 +386,7 @@ void plMouseDevice::NewCursor(char* cursor) fInstance->fCursor->SetVisible( true ); } -void plMouseDevice::SetCursorOpacity( hsScalar opacity ) +void plMouseDevice::SetCursorOpacity( float opacity ) { fInstance->fOpacity = opacity; if( fInstance->fCursor != nil ) @@ -406,7 +405,7 @@ hsBool plMouseDevice::MsgReceive(plMessage* msg) } else { - plMouseEventMsg* pMsg = TRACKED_NEW plMouseEventMsg; + plMouseEventMsg* pMsg = new plMouseEventMsg; pMsg->SetXPos( fXPos ); pMsg->SetYPos( fYPos ); pMsg->SetDX(0); @@ -421,7 +420,7 @@ hsBool plMouseDevice::MsgReceive(plMessage* msg) } else { - plMouseEventMsg* pMsg = TRACKED_NEW plMouseEventMsg; + plMouseEventMsg* pMsg = new plMouseEventMsg; pMsg->SetXPos( fXPos ); pMsg->SetYPos( fYPos ); pMsg->SetDX(0); @@ -467,7 +466,7 @@ hsBool plMouseDevice::MsgReceive(plMessage* msg) if (pXMsg) { // send a mouse event - plMouseEventMsg* pMsg = TRACKED_NEW plMouseEventMsg; + plMouseEventMsg* pMsg = new plMouseEventMsg; if (pXMsg->fX == 999) pMsg->SetXPos( fXPos + 0.001f ); else @@ -505,7 +504,7 @@ hsBool plMouseDevice::MsgReceive(plMessage* msg) if (pYMsg) { // send a mouse event - plMouseEventMsg* pMsg = TRACKED_NEW plMouseEventMsg; + plMouseEventMsg* pMsg = new plMouseEventMsg; pMsg->SetXPos( fXPos ); if (pYMsg->fY == 999) pMsg->SetYPos( fYPos + 0.01f ); @@ -544,7 +543,7 @@ hsBool plMouseDevice::MsgReceive(plMessage* msg) { // send a mouse event - plMouseEventMsg* pMsg = TRACKED_NEW plMouseEventMsg; + plMouseEventMsg* pMsg = new plMouseEventMsg; pMsg->SetXPos( fXPos ); pMsg->SetYPos( fYPos ); pMsg->SetDX(0); @@ -604,7 +603,7 @@ hsBool plMouseDevice::MsgReceive(plMessage* msg) if (pBMsg->fButton & kRightButtonDblClk) { // right button dbl clicked, send TWO messages - plMouseEventMsg* pMsg2 = TRACKED_NEW plMouseEventMsg; + plMouseEventMsg* pMsg2 = new plMouseEventMsg; pMsg2->SetXPos( fXPos ); pMsg2->SetYPos( fYPos ); pMsg2->SetDX(0); @@ -622,7 +621,7 @@ hsBool plMouseDevice::MsgReceive(plMessage* msg) if (pBMsg->fButton & kLeftButtonDblClk) { // left button dbl clicked, send TWO messages - plMouseEventMsg* pMsg2 = TRACKED_NEW plMouseEventMsg; + plMouseEventMsg* pMsg2 = new plMouseEventMsg; pMsg2->SetXPos( fXPos ); pMsg2->SetYPos( fYPos ); pMsg2->SetDX(0); diff --git a/Sources/Plasma/PubUtilLib/plInputCore/plInputDevice.h b/Sources/Plasma/PubUtilLib/plInputCore/plInputDevice.h index 5dd26d57..b4887d2c 100644 --- a/Sources/Plasma/PubUtilLib/plInputCore/plInputDevice.h +++ b/Sources/Plasma/PubUtilLib/plInputCore/plInputDevice.h @@ -45,8 +45,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #define PL_INPUT_DEVICE_H #include "HeadSpin.h" -#include "hsWindows.h" -#include "hsWindowHndl.h" + //#include "pnInputCore/plControlDefinition.h" #include "pnInputCore/plOSMsg.h" #include "pnInputCore/plKeyDef.h" @@ -65,7 +64,7 @@ public: kDisabled = 0x1 }; protected: - UInt32 fFlags; + uint32_t fFlags; public: plInputDevice() {;} @@ -73,8 +72,8 @@ public: virtual const char* GetInputName() = 0; - UInt32 GetFlags() { return fFlags; } - void SetFlags(UInt32 f) { fFlags = f; } + uint32_t GetFlags() { return fFlags; } + void SetFlags(uint32_t f) { fFlags = f; } virtual void HandleKeyEvent(plOSMsg message, plKeyDef key, bool bKeyDown, hsBool bKeyRepeat, wchar_t c = nil) {;} virtual void HandleMouseEvent(plOSMsg message, plMouseState state) {;} virtual void HandleWindowActivate(bool bActive, hsWindowHndl hWnd) {;} @@ -169,13 +168,13 @@ public: fControlFlags.SetBit(f); } void ClearControlFlag(int which) { fControlFlags.ClearBit( which ); } - void SetCursorX(hsScalar x); - void SetCursorY(hsScalar y); - hsScalar GetCursorX() { return fXPos; } - hsScalar GetCursorY() { return fYPos; } - UInt32 GetButtonState() { return fButtonState; } - hsScalar GetCursorOpacity() { return fOpacity; } - void SetDisplayResolution(hsScalar Width, hsScalar Height); + void SetCursorX(float x); + void SetCursorY(float y); + float GetCursorX() { return fXPos; } + float GetCursorY() { return fYPos; } + uint32_t GetButtonState() { return fButtonState; } + float GetCursorOpacity() { return fOpacity; } + void SetDisplayResolution(float Width, float Height); virtual hsBool MsgReceive(plMessage* msg); @@ -186,12 +185,12 @@ public: static void NewCursor(char* cursor); static void HideCursor(hsBool override = false); static bool GetHideCursor() { return plMouseDevice::bCursorHidden; } - static void SetCursorOpacity( hsScalar opacity = 1.f ); + static void SetCursorOpacity( float opacity = 1.f ); static bool GetInverted() { return plMouseDevice::bInverted; } static void SetInverted(bool inverted) { plMouseDevice::bInverted = inverted; } static void AddNameToCursor(const char* name); static void AddNameToCursor(const plString& name) { AddNameToCursor(_TEMP_CONVERT_TO_CONST_CHAR(name)); } - static void AddIDNumToCursor(UInt32 idNum); + static void AddIDNumToCursor(uint32_t idNum); static void AddCCRToCursor(); protected: @@ -204,12 +203,12 @@ protected: plInputEventMsg* fRightBMsg[2]; plInputEventMsg* fMiddleBMsg[2]; - hsScalar fXPos; - hsScalar fYPos; + float fXPos; + float fYPos; int fWXPos; // the windows coordinates of the cursor int fWYPos; - UInt32 fButtonState; - hsScalar fOpacity; + uint32_t fButtonState; + float fOpacity; hsBitVector fControlFlags; @@ -224,7 +223,7 @@ protected: static bool bCursorHidden; static bool bCursorOverride; static bool bInverted; - static hsScalar fWidth, fHeight; + static float fWidth, fHeight; }; diff --git a/Sources/Plasma/PubUtilLib/plInputCore/plInputInterface.cpp b/Sources/Plasma/PubUtilLib/plInputCore/plInputInterface.cpp index 32ff34f5..bc96cfe9 100644 --- a/Sources/Plasma/PubUtilLib/plInputCore/plInputInterface.cpp +++ b/Sources/Plasma/PubUtilLib/plInputCore/plInputInterface.cpp @@ -49,9 +49,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // // ////////////////////////////////////////////////////////////////////////////// -#include "hsConfig.h" -#include "hsWindows.h" -#include "hsTypes.h" +#include "HeadSpin.h" #include "plInputInterface.h" #include "plInputInterfaceMgr.h" @@ -67,7 +65,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com plInputInterface::plInputInterface() { fEnabled = false; - fControlMap = TRACKED_NEW plKeyMap; + fControlMap = new plKeyMap; } plInputInterface::~plInputInterface() @@ -125,7 +123,7 @@ void plInputInterface::IDeactivateBinding(const plKeyBinding *binding) { if( !(binding->GetCodeFlags() & kControlFlagNoDeactivate) && !(binding->GetCodeFlags() & kControlFlagToggle) ) { - plCtrlCmd *pCmd = TRACKED_NEW plCtrlCmd( this ); + plCtrlCmd *pCmd = new plCtrlCmd( this ); pCmd->fControlCode = binding->GetCode(); pCmd->fControlActivated = false; pCmd->SetCmdString( binding->GetExtendedString() ); @@ -153,7 +151,7 @@ hsBool plInputInterface::ProcessKeyBindings( plInputEventMsg *msg ) /// We might have controls that are currently enabled that are triggered in part by /// modifiers (ctrl or shift)...if that is true, then we want to disable them if either /// of those modifiers are up, no matter what key this message is for - hsTArray enabledCtrls; + hsTArray enabledCtrls; fKeyControlFlags.Enumerate( enabledCtrls ); for( i = 0; i < enabledCtrls.GetCount(); i++ ) @@ -223,7 +221,7 @@ hsBool plInputInterface::ProcessKeyBindings( plInputEventMsg *msg ) if (!binding) return false; - UInt32 codeFlags = binding->GetCodeFlags(); + uint32_t codeFlags = binding->GetCodeFlags(); // Filter out no-repeat messages if( ( codeFlags & kControlFlagNoRepeat ) && keyMsg->GetRepeat() ) @@ -295,7 +293,7 @@ hsBool plInputInterface::ProcessKeyBindings( plInputEventMsg *msg ) return true; /// OK, generate the message to send - plCtrlCmd *pCmd = TRACKED_NEW plCtrlCmd( this ); + plCtrlCmd *pCmd = new plCtrlCmd( this ); pCmd->fControlCode = binding->GetCode(); pCmd->fControlActivated = activate; diff --git a/Sources/Plasma/PubUtilLib/plInputCore/plInputInterface.h b/Sources/Plasma/PubUtilLib/plInputCore/plInputInterface.h index 03cda55f..24aa7b4e 100644 --- a/Sources/Plasma/PubUtilLib/plInputCore/plInputInterface.h +++ b/Sources/Plasma/PubUtilLib/plInputCore/plInputInterface.h @@ -125,7 +125,7 @@ class plInputInterface : public hsRefCnt // Gets called once per IUpdate(), just like normal IEval()s - virtual hsBool IEval( double secs, hsScalar del, UInt32 dirty ) { return false; } + virtual hsBool IEval( double secs, float del, uint32_t dirty ) { return false; } // Override to handle special-cased control messages of your own (same as receiving them via a message, but if you process them, nobody else gets them). Return false if you don't handle it. virtual hsBool IHandleCtrlCmd( plCtrlCmd *cmd ) { return false; } @@ -175,16 +175,16 @@ class plInputInterface : public hsRefCnt virtual void Write( hsStream* s, hsResMgr* mgr ); // Returns the priority of this interface layer, based on the Priorities enum - virtual UInt32 GetPriorityLevel( void ) const = 0; + virtual uint32_t GetPriorityLevel( void ) const = 0; // Returns true if the message was handled, false if not and we want to pass it on to others in the stack virtual hsBool InterpretInputEvent( plInputEventMsg *pMsg ) = 0; // Returns the currently active mouse cursor for this layer, as defined in pnMessage/plCursorChangeMsg.h - virtual UInt32 GetCurrentCursorID( void ) const = 0; + virtual uint32_t GetCurrentCursorID( void ) const = 0; // Returns the current opacity that this layer wants the cursor to be, from 0 (xparent) to 1 (opaque) - virtual hsScalar GetCurrentCursorOpacity( void ) const { return 1.f; } + virtual float GetCurrentCursorOpacity( void ) const { return 1.f; } // Returns true if this layer is wanting to change the mouse, false if it isn't interested virtual hsBool HasInterestingCursorID( void ) const = 0; diff --git a/Sources/Plasma/PubUtilLib/plInputCore/plInputInterfaceMgr.cpp b/Sources/Plasma/PubUtilLib/plInputCore/plInputInterfaceMgr.cpp index f28f73ff..ee9af82e 100644 --- a/Sources/Plasma/PubUtilLib/plInputCore/plInputInterfaceMgr.cpp +++ b/Sources/Plasma/PubUtilLib/plInputCore/plInputInterfaceMgr.cpp @@ -49,9 +49,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // // ////////////////////////////////////////////////////////////////////////////// -#include "hsConfig.h" -#include "hsWindows.h" -#include "hsTypes.h" +#include "HeadSpin.h" #include "plInputInterfaceMgr.h" #include "plInputInterface.h" #include "plInputDevice.h" // For mouse device stuff @@ -160,15 +158,15 @@ void plInputInterfaceMgr::Init( void ) plgDispatch::Dispatch()->RegisterForExactType( plClientMsg::Index(), GetKey() ); /// Hacks (?) for now - plAvatarInputInterface *avatar = TRACKED_NEW plAvatarInputInterface(); + plAvatarInputInterface *avatar = new plAvatarInputInterface(); IAddInterface( avatar ); hsRefCnt_SafeUnRef( avatar ); - plSceneInputInterface *scene = TRACKED_NEW plSceneInputInterface(); + plSceneInputInterface *scene = new plSceneInputInterface(); IAddInterface( scene ); hsRefCnt_SafeUnRef( scene ); - plDebugInputInterface *camDrive = TRACKED_NEW plDebugInputInterface(); + plDebugInputInterface *camDrive = new plDebugInputInterface(); IAddInterface( camDrive ); hsRefCnt_SafeUnRef( camDrive ); @@ -249,7 +247,7 @@ void plInputInterfaceMgr::ResetClickableState() //// IUpdateCursor /////////////////////////////////////////////////////////// -void plInputInterfaceMgr::IUpdateCursor( Int32 newCursor ) +void plInputInterfaceMgr::IUpdateCursor( int32_t newCursor ) { char* mouseCursorResID; @@ -297,7 +295,7 @@ void plInputInterfaceMgr::IUpdateCursor( Int32 newCursor ) //// IEval /////////////////////////////////////////////////////////////////// // Inherited from plSingleModifier, gets called once per IUpdate() loop. -hsBool plInputInterfaceMgr::IEval( double secs, hsScalar del, UInt32 dirty ) +hsBool plInputInterfaceMgr::IEval( double secs, float del, uint32_t dirty ) { const char *inputEval = "Eval"; plProfile_BeginLap(Input, inputEval); @@ -315,7 +313,7 @@ hsBool plInputInterfaceMgr::IEval( double secs, hsScalar del, UInt32 dirty ) if( !fMessageQueue[ i ]->GetSource()->IHandleCtrlCmd( fMessageQueue[ i ] ) ) { // Nope, just dispatch it like normal - plControlEventMsg* pMsg = TRACKED_NEW plControlEventMsg; + plControlEventMsg* pMsg = new plControlEventMsg; for (int j = 0; j < fReceivers.Count(); j++) pMsg->AddReceiver( fReceivers[ j ] ); pMsg->SetControlActivated( fMessageQueue[i]->fControlActivated ); @@ -332,7 +330,7 @@ hsBool plInputInterfaceMgr::IEval( double secs, hsScalar del, UInt32 dirty ) if (fMessageQueue[i]->fNetPropagateToPlayers) { - pMsg = TRACKED_NEW plControlEventMsg; + pMsg = new plControlEventMsg; for (int j = 0; j < fReceivers.Count(); j++) if (fReceivers[j] == plNetClientApp::GetInstance()->GetLocalPlayerKey()) pMsg->AddReceiver( fReceivers[j] ); @@ -432,7 +430,7 @@ hsBool plInputInterfaceMgr::MsgReceive( plMessage *msg ) const char *inputIEM = "InputEventMsg"; plProfile_BeginLap(Input, inputIEM); hsBool handled = false; - UInt32 missedInputStartIdx = 0; + uint32_t missedInputStartIdx = 0; plInputInterface *oldCurrentFocus = fCurrentFocus; // Current focus (if there is one) gets first crack diff --git a/Sources/Plasma/PubUtilLib/plInputCore/plInputInterfaceMgr.h b/Sources/Plasma/PubUtilLib/plInputCore/plInputInterfaceMgr.h index 96d4e9aa..d6019399 100644 --- a/Sources/Plasma/PubUtilLib/plInputCore/plInputInterfaceMgr.h +++ b/Sources/Plasma/PubUtilLib/plInputCore/plInputInterfaceMgr.h @@ -83,24 +83,24 @@ class plInputInterfaceMgr : public plSingleModifier #ifdef MCN_DISABLE_OLD_WITH_NEW_HACK hsTArray fDisabledCodes; - hsTArray fDisabledKeys; + hsTArray fDisabledKeys; #endif hsBool fClickEnabled; - Int32 fCurrentCursor; - hsScalar fCursorOpacity; + int32_t fCurrentCursor; + float fCursorOpacity; hsBool fForceCursorHidden; - Int32 fForceCursorHiddenCount; + int32_t fForceCursorHiddenCount; plInputInterface *fCurrentFocus; plDefaultKeyCatcher *fDefaultCatcher; - virtual hsBool IEval( double secs, hsScalar del, UInt32 dirty ); + virtual hsBool IEval( double secs, float del, uint32_t dirty ); void IAddInterface( plInputInterface *iface ); void IRemoveInterface( plInputInterface *iface ); - void IUpdateCursor( Int32 newCursor ); + void IUpdateCursor( int32_t newCursor ); hsBool ICheckCursor(plInputInterface *iFace); // returns true if the iface changed cursor settings void IWriteConsoleCmdKeys( plKeyMap *keyMap, FILE *keyFile ); @@ -170,7 +170,7 @@ class plCtrlCmd ControlEventCode fControlCode; hsBool fControlActivated; hsPoint3 fPt; - hsScalar fPct; + float fPct; hsBool fNetPropagateToPlayers; diff --git a/Sources/Plasma/PubUtilLib/plInputCore/plInputManager.cpp b/Sources/Plasma/PubUtilLib/plInputCore/plInputManager.cpp index d81a3265..35145eaa 100644 --- a/Sources/Plasma/PubUtilLib/plInputCore/plInputManager.cpp +++ b/Sources/Plasma/PubUtilLib/plInputCore/plInputManager.cpp @@ -39,14 +39,11 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com Mead, WA 99021 *==LICENSE==*/ -#include "hsConfig.h" -#include "hsWindows.h" - +#include "HeadSpin.h" // plInputManager.cpp #define DIRECTINPUT_VERSION 0x0800 #include -#include "hsTypes.h" #include "plInputManager.h" #include "plPipeline.h" #include "plInputDevice.h" @@ -64,7 +61,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "pnMessage/plPlayerPageMsg.h" hsBool plInputManager::fUseDInput = false; -UInt8 plInputManager::bRecenterMouse = 0; +uint8_t plInputManager::bRecenterMouse = 0; HWND plInputManager::fhWnd = nil; #define NUM_ACTIONS 17 @@ -177,7 +174,7 @@ void plInputManager::RecenterCursor() } void plInputManager::CreateInterfaceMod(plPipeline* p) { - fInterfaceMgr = TRACKED_NEW plInputInterfaceMgr(); + fInterfaceMgr = new plInputInterfaceMgr(); fInterfaceMgr->Init(); } @@ -185,7 +182,7 @@ void plInputManager::InitDInput(HINSTANCE hInst, HWND hWnd) { if (fUseDInput) { - fDInputMgr = TRACKED_NEW plDInputMgr; + fDInputMgr = new plDInputMgr; fDInputMgr->Init(hInst, hWnd); } } @@ -208,7 +205,7 @@ void plInputManager::Update() fDInputMgr->Update(); } -void plInputManager::SetMouseScale( hsScalar s ) +void plInputManager::SetMouseScale( float s ) { /* RECT rect; POINT currPos; @@ -312,7 +309,7 @@ void plInputManager::HandleWin32ControlEvent(UINT message, WPARAM Wparam, LPARAM break; case MOUSEWHEEL: { - plMouseEventMsg* pMsg = TRACKED_NEW plMouseEventMsg; + plMouseEventMsg* pMsg = new plMouseEventMsg; int zDelta = GET_WHEEL_DELTA_WPARAM(Wparam); pMsg->SetWheelDelta((float)zDelta); if (zDelta < 0) @@ -342,9 +339,9 @@ void plInputManager::HandleWin32ControlEvent(UINT message, WPARAM Wparam, LPARAM RECT rect; GetClientRect(hWnd, &rect); - plIMouseXEventMsg* pXMsg = TRACKED_NEW plIMouseXEventMsg; - plIMouseYEventMsg* pYMsg = TRACKED_NEW plIMouseYEventMsg; - plIMouseBEventMsg* pBMsg = TRACKED_NEW plIMouseBEventMsg; + plIMouseXEventMsg* pXMsg = new plIMouseXEventMsg; + plIMouseYEventMsg* pYMsg = new plIMouseYEventMsg; + plIMouseBEventMsg* pBMsg = new plIMouseBEventMsg; pXMsg->fWx = LOWORD(Lparam); pXMsg->fX = (float)LOWORD(Lparam) / (float)rect.right; @@ -469,7 +466,7 @@ void plInputManager::AddInputDevice( plInputDevice *pDev ) plDInputMgr::plDInputMgr() : fDI(nil) { - fDI = TRACKED_NEW plDInput; + fDI = new plDInput; } plDInputMgr::~plDInputMgr() @@ -506,7 +503,7 @@ void plDInputMgr::Init(HINSTANCE hInst, HWND hWnd) // set up the action mapping - fDI->fActionFormat = TRACKED_NEW DIACTIONFORMAT; + fDI->fActionFormat = new DIACTIONFORMAT; fDI->fActionFormat->dwSize = sizeof(DIACTIONFORMAT); fDI->fActionFormat->dwActionSize = sizeof(DIACTION); fDI->fActionFormat->dwDataSize = NUM_ACTIONS * sizeof(DWORD); @@ -530,7 +527,7 @@ void plDInputMgr::Init(HINSTANCE hInst, HWND hWnd) for (i = 0; i < fDI->fSticks.Count(); i++) { - fDI->fSticks[i]->fCaps = TRACKED_NEW DIDEVCAPS; + fDI->fSticks[i]->fCaps = new DIDEVCAPS; fDI->fSticks[i]->fCaps->dwSize = sizeof(DIDEVCAPS); hr = fDI->fSticks[i]->fDevice->GetCapabilities(fDI->fSticks[i]->fCaps); hsAssert(!hr, "Unable to acquire devcaps in DInput Device!"); @@ -541,7 +538,7 @@ void plDInputMgr::Init(HINSTANCE hInst, HWND hWnd) fhWnd = hWnd; for (i = 0; i < fDI->fSticks.Count(); i++) - fInputDevice.Append( TRACKED_NEW plDInputDevice ); + fInputDevice.Append( new plDInputDevice ); } void plDInputMgr::Update() @@ -635,7 +632,7 @@ int __stdcall plDInputMgr::EnumGamepadCallback(const DIDEVICEINSTANCE* device, v if(!FAILED(hr)) { - pDI->fSticks.Append(TRACKED_NEW plDIDevice(fStick)); + pDI->fSticks.Append(new plDIDevice(fStick)); // the following code pertaining to the action map shouldn't be here. // in fact this shouldn't work at all according to MS, but this is diff --git a/Sources/Plasma/PubUtilLib/plInputCore/plInputManager.h b/Sources/Plasma/PubUtilLib/plInputCore/plInputManager.h index 4211f948..3ebde4e4 100644 --- a/Sources/Plasma/PubUtilLib/plInputCore/plInputManager.h +++ b/Sources/Plasma/PubUtilLib/plInputCore/plInputManager.h @@ -44,8 +44,8 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #ifndef PL_INPUT_MANAGER_H #define PL_INPUT_MANAGER_H -#include "hsWindows.h" -#include "hsTypes.h" + +#include "HeadSpin.h" #include "hsTemplates.h" #include "pnKeyedObject/hsKeyedObject.h" #include "pnInputCore/plInputMap.h" @@ -84,8 +84,8 @@ public: void Activate( bool activating ); - hsScalar GetMouseScale( void ) const { return fMouseScale; } - void SetMouseScale( hsScalar s ); + float GetMouseScale( void ) const { return fMouseScale; } + void SetMouseScale( float s ); static plKeyDef UntranslateKey(plKeyDef key, hsBool extended); @@ -96,8 +96,8 @@ protected: plInputInterfaceMgr *fInterfaceMgr; bool fActive, fFirstActivated; - hsScalar fMouseScale; - static UInt8 bRecenterMouse; + float fMouseScale; + static uint8_t bRecenterMouse; static HWND fhWnd; public: diff --git a/Sources/Plasma/PubUtilLib/plInputCore/plSceneInputInterface.cpp b/Sources/Plasma/PubUtilLib/plInputCore/plSceneInputInterface.cpp index c44be7b0..3baaa7f4 100644 --- a/Sources/Plasma/PubUtilLib/plInputCore/plSceneInputInterface.cpp +++ b/Sources/Plasma/PubUtilLib/plInputCore/plSceneInputInterface.cpp @@ -45,10 +45,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // // ////////////////////////////////////////////////////////////////////////////// -#include "hsConfig.h" -#include "hsWindows.h" - -#include "hsTypes.h" +#include "HeadSpin.h" #include "plSceneInputInterface.h" #include "plInputInterfaceMgr.h" @@ -152,7 +149,7 @@ void plSceneInputInterface::Init( plInputInterfaceMgr *manager ) fPendingLink = false; // register for control messages - plCmdIfaceModMsg* pModMsg = TRACKED_NEW plCmdIfaceModMsg; + plCmdIfaceModMsg* pModMsg = new plCmdIfaceModMsg; pModMsg->SetBCastFlag(plMessage::kBCastByExactType); pModMsg->SetSender(fManager->GetKey()); pModMsg->SetCmd(plCmdIfaceModMsg::kAdd); @@ -182,7 +179,7 @@ void plSceneInputInterface::ClearClickableMap() void plSceneInputInterface::IHalfFadeAvatar(hsBool out) { - plIfaceFadeAvatarMsg* pMsg = TRACKED_NEW plIfaceFadeAvatarMsg(); + plIfaceFadeAvatarMsg* pMsg = new plIfaceFadeAvatarMsg(); pMsg->SetSubjectKey(plNetClientMgr::GetInstance()->GetLocalPlayerKey()); pMsg->SetBCastFlag(plMessage::kBCastByExactType); pMsg->SetBCastFlag(plMessage::kNetPropagate, FALSE); @@ -207,7 +204,7 @@ void plSceneInputInterface::ResetClickableState() } //// IEval /////////////////////////////////////////////////////////////////// -hsBool plSceneInputInterface::IEval( double secs, hsScalar del, UInt32 dirty ) +hsBool plSceneInputInterface::IEval( double secs, float del, uint32_t dirty ) { // this needs to always go no matter what... // ...unless we have cliclability disabled (as in the case of certain multistage behaviors) @@ -227,7 +224,7 @@ hsBool plSceneInputInterface::IEval( double secs, hsScalar del, UInt32 dirty ) int i; for (i=0; i < fClickableMap.Count(); i++) { - plFakeOutMsg *pMsg = TRACKED_NEW plFakeOutMsg; + plFakeOutMsg *pMsg = new plFakeOutMsg; pMsg->SetSender( fManager->GetKey() ); pMsg->AddReceiver( fClickableMap[i]->key ); plgDispatch::MsgSend( pMsg ); @@ -298,7 +295,7 @@ hsBool plSceneInputInterface::MsgReceive( plMessage *msg ) fCurrentClickableLogicMod = pLogicMod->GetKey(); fCurrentClickPoint = pLOSMsg->fHitPoint; for (int x = 0; x < pMod->GetNumReferencedKeys(); x++) - fClickableMap.Append( TRACKED_NEW clickableTest(pMod->GetReferencedKey(x))); + fClickableMap.Append( new clickableTest(pMod->GetReferencedKey(x))); } else { @@ -395,10 +392,10 @@ hsBool plSceneInputInterface::MsgReceive( plMessage *msg ) { hsVector3 ourView = locPlayer->GetCoordinateInterface()->GetLocalToWorld().GetAxis(hsMatrix44::kView); hsVector3 theirView = pObj->GetCoordinateInterface()->GetLocalToWorld().GetAxis(hsMatrix44::kView); - hsScalar viewdot = ourView * theirView; + float viewdot = ourView * theirView; hsVector3 towards(locPlayer->GetCoordinateInterface()->GetLocalToWorld().GetTranslate() - pObj->GetCoordinateInterface()->GetLocalToWorld().GetTranslate()); towards.Normalize(); - hsScalar towardsdot = ourView * towards; + float towardsdot = ourView * towards; if (viewdot > SHARE_FACING_TOLERANCE || towardsdot > SHARE_FACING_TOLERANCE ) { ResetClickableState(); @@ -629,7 +626,7 @@ hsBool plSceneInputInterface::MsgReceive( plMessage *msg ) { // tell them to ignore us - plInputIfaceMgrMsg* pMsg = TRACKED_NEW plInputIfaceMgrMsg(plInputIfaceMgrMsg::kDisableAvatarClickable); + plInputIfaceMgrMsg* pMsg = new plInputIfaceMgrMsg(plInputIfaceMgrMsg::kDisableAvatarClickable); pMsg->SetAvKey(plNetClientMgr::GetInstance()->GetLocalPlayerKey()); pMsg->SetBCastFlag(plMessage::kNetPropagate); pMsg->SetBCastFlag(plMessage::kNetForce); @@ -639,7 +636,7 @@ hsBool plSceneInputInterface::MsgReceive( plMessage *msg ) // and tell them to ignore our victim - //plInputIfaceMgrMsg* pMsg2 = TRACKED_NEW plInputIfaceMgrMsg(plInputIfaceMgrMsg::kDisableAvatarClickable); + //plInputIfaceMgrMsg* pMsg2 = new plInputIfaceMgrMsg(plInputIfaceMgrMsg::kDisableAvatarClickable); //pMsg2->SetAvKey(fOffereeKey); //pMsg2->SetBCastFlag(plMessage::kNetPropagate); //pMsg2->SetBCastFlag(plMessage::kNetForce); @@ -653,7 +650,7 @@ hsBool plSceneInputInterface::MsgReceive( plMessage *msg ) { if (fGUIIgnoredAvatars[x] == plNetClientMgr::GetInstance()->GetLocalPlayerKey()) { - plInputIfaceMgrMsg* pMsg3 = TRACKED_NEW plInputIfaceMgrMsg(plInputIfaceMgrMsg::kGUIDisableAvatarClickable); + plInputIfaceMgrMsg* pMsg3 = new plInputIfaceMgrMsg(plInputIfaceMgrMsg::kGUIDisableAvatarClickable); pMsg3->SetAvKey(fGUIIgnoredAvatars[x]); pMsg3->SetBCastFlag(plMessage::kNetPropagate); pMsg3->SetBCastFlag(plMessage::kNetForce); @@ -919,14 +916,14 @@ void plSceneInputInterface::ISetLastClicked( plKey obj, hsPoint3 hitPoint ) // Send an "un-picked" message to it if( !fLastClickIsAvatar ) { - plPickedMsg *pPickedMsg = TRACKED_NEW plPickedMsg; + plPickedMsg *pPickedMsg = new plPickedMsg; pPickedMsg->AddReceiver( fLastClicked ); pPickedMsg->fPicked = false; plgDispatch::MsgSend( pPickedMsg ); } else { - plRemoteAvatarInfoMsg *pMsg = TRACKED_NEW plRemoteAvatarInfoMsg; + plRemoteAvatarInfoMsg *pMsg = new plRemoteAvatarInfoMsg; pMsg->SetAvatarKey( nil ); plgDispatch::MsgSend( pMsg ); } @@ -939,7 +936,7 @@ void plSceneInputInterface::ISetLastClicked( plKey obj, hsPoint3 hitPoint ) { #ifdef MATT_WAS_HERE // now we send pick messages to avatars as well... - plPickedMsg *pPickedMsg = TRACKED_NEW plPickedMsg; + plPickedMsg *pPickedMsg = new plPickedMsg; pPickedMsg->AddReceiver( fLastClicked ); pPickedMsg->fHitPoint = hitPoint; plgDispatch::MsgSend( pPickedMsg ); @@ -947,7 +944,7 @@ void plSceneInputInterface::ISetLastClicked( plKey obj, hsPoint3 hitPoint ) // if it's an avatar, we also send this thing if(fLastClickIsAvatar) { - plRemoteAvatarInfoMsg *pMsg = TRACKED_NEW plRemoteAvatarInfoMsg; + plRemoteAvatarInfoMsg *pMsg = new plRemoteAvatarInfoMsg; pMsg->SetAvatarKey( fLastClicked ); plgDispatch::MsgSend( pMsg ); } @@ -955,14 +952,14 @@ void plSceneInputInterface::ISetLastClicked( plKey obj, hsPoint3 hitPoint ) // Send a "picked" message to it if( !fLastClickIsAvatar ) { - plPickedMsg *pPickedMsg = TRACKED_NEW plPickedMsg; + plPickedMsg *pPickedMsg = new plPickedMsg; pPickedMsg->AddReceiver( fLastClicked ); pPickedMsg->fHitPoint = hitPoint; plgDispatch::MsgSend( pPickedMsg ); } else { - plRemoteAvatarInfoMsg *pMsg = TRACKED_NEW plRemoteAvatarInfoMsg; + plRemoteAvatarInfoMsg *pMsg = new plRemoteAvatarInfoMsg; pMsg->SetAvatarKey( fLastClicked ); plgDispatch::MsgSend( pMsg ); } @@ -1077,9 +1074,9 @@ void plSceneInputInterface::IManageIgnoredAvatars(plKey& offeree, hsBool add) // tell everyone else to be able to / not to be able to select this avatar plInputIfaceMgrMsg* pMsg = 0; if (!add) - pMsg = TRACKED_NEW plInputIfaceMgrMsg(plInputIfaceMgrMsg::kEnableAvatarClickable); + pMsg = new plInputIfaceMgrMsg(plInputIfaceMgrMsg::kEnableAvatarClickable); else - pMsg = TRACKED_NEW plInputIfaceMgrMsg(plInputIfaceMgrMsg::kDisableAvatarClickable); + pMsg = new plInputIfaceMgrMsg(plInputIfaceMgrMsg::kDisableAvatarClickable); pMsg->SetAvKey(offeree); pMsg->SetBCastFlag(plMessage::kNetPropagate); pMsg->SetBCastFlag(plMessage::kNetForce); @@ -1115,7 +1112,7 @@ void plSceneInputInterface::ISendOfferNotification(plKey& offeree, int ID, hsBoo delete [] members; } - plNotifyMsg* pMsg = TRACKED_NEW plNotifyMsg; + plNotifyMsg* pMsg = new plNotifyMsg; pMsg->AddOfferBookEvent(plNetClientMgr::GetInstance()->GetLocalPlayerKey(), ID, offereeID); pMsg->AddReceiver(fBookKey); if (net) @@ -1138,9 +1135,9 @@ void plSceneInputInterface::ISendAvatarDisabledNotification(hsBool enabled) { plInputIfaceMgrMsg* pMsg = 0; if (enabled) - pMsg = TRACKED_NEW plInputIfaceMgrMsg(plInputIfaceMgrMsg::kEnableAvatarClickable); + pMsg = new plInputIfaceMgrMsg(plInputIfaceMgrMsg::kEnableAvatarClickable); else - pMsg = TRACKED_NEW plInputIfaceMgrMsg(plInputIfaceMgrMsg::kDisableAvatarClickable); + pMsg = new plInputIfaceMgrMsg(plInputIfaceMgrMsg::kDisableAvatarClickable); pMsg->SetAvKey(plNetClientMgr::GetInstance()->GetLocalPlayerKey()); pMsg->SetBCastFlag(plMessage::kNetPropagate); pMsg->SetBCastFlag(plMessage::kNetForce); @@ -1151,14 +1148,14 @@ void plSceneInputInterface::ISendAvatarDisabledNotification(hsBool enabled) //// IRequestLOSCheck //////////////////////////////////////////////////////// -void plSceneInputInterface::IRequestLOSCheck( hsScalar xPos, hsScalar yPos, int ID ) +void plSceneInputInterface::IRequestLOSCheck( float xPos, float yPos, int ID ) { if( fPipe == nil ) return; - Int32 x=(Int32) ( xPos * fPipe->Width() ); - Int32 y=(Int32) ( yPos * fPipe->Height() ); + int32_t x=(int32_t) ( xPos * fPipe->Width() ); + int32_t y=(int32_t) ( yPos * fPipe->Height() ); hsPoint3 endPos, startPos; @@ -1173,12 +1170,12 @@ void plSceneInputInterface::IRequestLOSCheck( hsScalar xPos, hsScalar yPos, i plLOSRequestMsg* pMsg; if(ID == ID_FIND_CLICKABLE) { - pMsg = TRACKED_NEW plLOSRequestMsg( fManager->GetKey(), startPos, endPos, plSimDefs::kLOSDBUIItems, plLOSRequestMsg::kTestClosest ); + pMsg = new plLOSRequestMsg( fManager->GetKey(), startPos, endPos, plSimDefs::kLOSDBUIItems, plLOSRequestMsg::kTestClosest ); pMsg->SetCullDB(plSimDefs::kLOSDBUIBlockers); } else if(ID == ID_FIND_WALKABLE_GROUND) { - pMsg = TRACKED_NEW plLOSRequestMsg( fManager->GetKey(), startPos, endPos, plSimDefs::kLOSDBAvatarWalkable, plLOSRequestMsg::kTestClosest); + pMsg = new plLOSRequestMsg( fManager->GetKey(), startPos, endPos, plSimDefs::kLOSDBAvatarWalkable, plLOSRequestMsg::kTestClosest); } else - pMsg = TRACKED_NEW plLOSRequestMsg( fManager->GetKey(), startPos, endPos, plSimDefs::kLOSDBLocalAvatar, plLOSRequestMsg::kTestClosest); + pMsg = new plLOSRequestMsg( fManager->GetKey(), startPos, endPos, plSimDefs::kLOSDBLocalAvatar, plLOSRequestMsg::kTestClosest); pMsg->SetReportType( plLOSRequestMsg::kReportHitOrMiss ); @@ -1197,8 +1194,8 @@ hsBool plSceneInputInterface::IWorldPosMovedSinceLastLOSCheck( void ) if( fPipe == nil ) return false; - Int32 x=(Int32) ( plMouseDevice::Instance()->GetCursorX() * fPipe->Width() ); - Int32 y=(Int32) ( plMouseDevice::Instance()->GetCursorY() * fPipe->Height() ); + int32_t x=(int32_t) ( plMouseDevice::Instance()->GetCursorX() * fPipe->Width() ); + int32_t y=(int32_t) ( plMouseDevice::Instance()->GetCursorY() * fPipe->Height() ); hsPoint3 endPos, startPos; @@ -1215,7 +1212,7 @@ hsBool plSceneInputInterface::IWorldPosMovedSinceLastLOSCheck( void ) //// GetCurrentCursorID /////////////////////////////////////////////////////// -UInt32 plSceneInputInterface::SetCurrentCursorID(UInt32 id) +uint32_t plSceneInputInterface::SetCurrentCursorID(uint32_t id) { if (fBookMode == kOfferBook || fBookMode == kBookOffered) { diff --git a/Sources/Plasma/PubUtilLib/plInputCore/plSceneInputInterface.h b/Sources/Plasma/PubUtilLib/plInputCore/plSceneInputInterface.h index e8952ef6..77ae0488 100644 --- a/Sources/Plasma/PubUtilLib/plInputCore/plSceneInputInterface.h +++ b/Sources/Plasma/PubUtilLib/plInputCore/plSceneInputInterface.h @@ -71,8 +71,8 @@ class plSceneInputInterface : public plInputInterface protected: static plSceneInputInterface *fInstance; - UInt32 fCurrentCursor; - UInt8 fButtonState; + uint32_t fCurrentCursor; + uint8_t fButtonState; hsBool fClickability; plKey fCurrentClickable, fLastClicked, fCurrentClickableLogicMod; hsPoint3 fCurrentClickPoint; @@ -82,7 +82,7 @@ class plSceneInputInterface : public plInputInterface int fBookMode; // are we in offer book mode? plKey fBookKey; // key for the python file modifier for the book we are offering plKey fOffereeKey; - UInt32 fOffereeID; // ID for the guy who's accepted our link offer + uint32_t fOffereeID; // ID for the guy who's accepted our link offer const char* fOfferedAgeFile; const char* fOfferedAgeInstance; const char* fSpawnPoint; @@ -106,10 +106,10 @@ class plSceneInputInterface : public plInputInterface hsPoint3 fLastStartPt, fLastEndPt; plPipeline *fPipe; - virtual hsBool IEval( double secs, hsScalar del, UInt32 dirty ); + virtual hsBool IEval( double secs, float del, uint32_t dirty ); - void IRequestLOSCheck( hsScalar xPos, hsScalar yPos, int ID ); + void IRequestLOSCheck( float xPos, float yPos, int ID ); void ISetLastClicked( plKey obj, hsPoint3 hitPoint ); void IHalfFadeAvatar(hsBool out); @@ -128,9 +128,9 @@ class plSceneInputInterface : public plInputInterface // Always return true, since the cursor should be representing how we control the avatar virtual hsBool HasInterestingCursorID( void ) const { return ( fCurrentCursor != kNullCursor ) ? true : false; } - virtual UInt32 GetPriorityLevel( void ) const { return kSceneInteractionPriority; } - virtual UInt32 GetCurrentCursorID( void ) const {return fCurrentCursor;} - UInt32 SetCurrentCursorID(UInt32 id); + virtual uint32_t GetPriorityLevel( void ) const { return kSceneInteractionPriority; } + virtual uint32_t GetCurrentCursorID( void ) const {return fCurrentCursor;} + uint32_t SetCurrentCursorID(uint32_t id); virtual hsBool InterpretInputEvent( plInputEventMsg *pMsg ); void RequestAvatarTurnToPointLOS(); diff --git a/Sources/Plasma/PubUtilLib/plInputCore/plTelescopeInputInterface.cpp b/Sources/Plasma/PubUtilLib/plInputCore/plTelescopeInputInterface.cpp index f8ec5bd0..ba5c0568 100644 --- a/Sources/Plasma/PubUtilLib/plInputCore/plTelescopeInputInterface.cpp +++ b/Sources/Plasma/PubUtilLib/plInputCore/plTelescopeInputInterface.cpp @@ -45,10 +45,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // // ////////////////////////////////////////////////////////////////////////////// -#include "hsConfig.h" -#include "hsWindows.h" - -#include "hsTypes.h" +#include "HeadSpin.h" #include "plTelescopeInputInterface.h" #include "plInputInterfaceMgr.h" @@ -100,7 +97,7 @@ void plTelescopeInputInterface::Init( plInputInterfaceMgr *manager ) //// IEval /////////////////////////////////////////////////////////////////// -hsBool plTelescopeInputInterface::IEval( double secs, hsScalar del, UInt32 dirty ) +hsBool plTelescopeInputInterface::IEval( double secs, float del, uint32_t dirty ) { return true; } diff --git a/Sources/Plasma/PubUtilLib/plInputCore/plTelescopeInputInterface.h b/Sources/Plasma/PubUtilLib/plInputCore/plTelescopeInputInterface.h index a33ad138..3bbed4ea 100644 --- a/Sources/Plasma/PubUtilLib/plInputCore/plTelescopeInputInterface.h +++ b/Sources/Plasma/PubUtilLib/plInputCore/plTelescopeInputInterface.h @@ -57,7 +57,7 @@ class plTelescopeInputInterface : public plInputInterface { protected: - virtual hsBool IEval( double secs, hsScalar del, UInt32 dirty ); + virtual hsBool IEval( double secs, float del, uint32_t dirty ); public: @@ -74,13 +74,13 @@ class plTelescopeInputInterface : public plInputInterface virtual void Shutdown( void ) {;} // Returns the priority of this interface layer, based on the Priorities enum - virtual UInt32 GetPriorityLevel( void ) const { return kTelescopeInputPriority; } + virtual uint32_t GetPriorityLevel( void ) const { return kTelescopeInputPriority; } // Returns the currently active mouse cursor for this layer, as defined in pnMessage/plCursorChangeMsg.h - virtual UInt32 GetCurrentCursorID( void ) const { return kCursorUp; } + virtual uint32_t GetCurrentCursorID( void ) const { return kCursorUp; } // Returns the current opacity that this layer wants the cursor to be, from 0 (xparent) to 1 (opaque) - virtual hsScalar GetCurrentCursorOpacity( void ) const { return 1.f; } + virtual float GetCurrentCursorOpacity( void ) const { return 1.f; } // Returns true if this layer is wanting to change the mouse, false if it isn't interested virtual hsBool HasInterestingCursorID( void ) const { return false; } diff --git a/Sources/Plasma/PubUtilLib/plInterp/hsInterp.cpp b/Sources/Plasma/PubUtilLib/plInterp/hsInterp.cpp index a004b48e..72dcc139 100644 --- a/Sources/Plasma/PubUtilLib/plInterp/hsInterp.cpp +++ b/Sources/Plasma/PubUtilLib/plInterp/hsInterp.cpp @@ -39,7 +39,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com Mead, WA 99021 *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "hsInterp.h" #include "plTransform/hsAffineParts.h" #include "hsColorRGBA.h" @@ -50,12 +50,12 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // linear interpolation /////////////////////////////////////////////////////// // -void hsInterp::LinInterp(hsScalar k1, hsScalar k2, hsScalar t, hsScalar* result) +void hsInterp::LinInterp(float k1, float k2, float t, float* result) { *result = k1 + t * (k2 - k1); } -void hsInterp::LinInterp(const hsScalarTriple* k1, const hsScalarTriple* k2, hsScalar t, +void hsInterp::LinInterp(const hsScalarTriple* k1, const hsScalarTriple* k2, float t, hsScalarTriple* result) { if (t==0.0) @@ -71,8 +71,8 @@ void hsInterp::LinInterp(const hsScalarTriple* k1, const hsScalarTriple* k2, hsS } } -void hsInterp::LinInterp(const hsColorRGBA* k1, const hsColorRGBA* k2, hsScalar t, - hsColorRGBA* result, UInt32 flags) +void hsInterp::LinInterp(const hsColorRGBA* k1, const hsColorRGBA* k2, float t, + hsColorRGBA* result, uint32_t flags) { if (t==0.0) { @@ -102,8 +102,8 @@ void hsInterp::LinInterp(const hsColorRGBA* k1, const hsColorRGBA* k2, hsScalar LinInterp(k1->a, k2->a, t, &result->a); } -void hsInterp::LinInterp(const hsMatrix33* k1, const hsMatrix33* k2, hsScalar t, - hsMatrix33* result, UInt32 flags) +void hsInterp::LinInterp(const hsMatrix33* k1, const hsMatrix33* k2, float t, + hsMatrix33* result, uint32_t flags) { if (t==0.0) { @@ -162,8 +162,8 @@ void hsInterp::LinInterp(const hsMatrix33* k1, const hsMatrix33* k2, hsScalar t, // // -void hsInterp::LinInterp(const hsMatrix44* mat1, const hsMatrix44* mat2, hsScalar t, - hsMatrix44* out, UInt32 flags) +void hsInterp::LinInterp(const hsMatrix44* mat1, const hsMatrix44* mat2, float t, + hsMatrix44* out, uint32_t flags) { if (flags == 0) { @@ -173,7 +173,7 @@ void hsInterp::LinInterp(const hsMatrix44* mat1, const hsMatrix44* mat2, hsScala return; } - if( hsScalar1 == t ) + if( 1.f == t ) { *out = *mat2; return; @@ -234,7 +234,7 @@ void hsInterp::LinInterp(const hsMatrix44* mat1, const hsMatrix44* mat2, hsScala } } -void hsInterp::LinInterp(const hsQuat* k1, const hsQuat* k2, hsScalar t, hsQuat* result) +void hsInterp::LinInterp(const hsQuat* k1, const hsQuat* k2, float t, hsQuat* result) { if (t==0.0) *result = *k1; @@ -247,15 +247,15 @@ void hsInterp::LinInterp(const hsQuat* k1, const hsQuat* k2, hsScalar t, hsQuat* } } -void hsInterp::LinInterp(const hsScaleValue* k1, const hsScaleValue* k2, hsScalar t, +void hsInterp::LinInterp(const hsScaleValue* k1, const hsScaleValue* k2, float t, hsScaleValue* result) { LinInterp(&k1->fS, &k2->fS, t, &result->fS); // Stretch rotation LinInterp(&k1->fQ, &k2->fQ, t, &result->fQ); // Stretch factor } -void hsInterp::LinInterp(const hsAffineParts* k1, const hsAffineParts* k2, hsScalar t, - hsAffineParts* result, UInt32 flags) +void hsInterp::LinInterp(const hsAffineParts* k1, const hsAffineParts* k2, float t, + hsAffineParts* result, uint32_t flags) { if (t==0.0) { @@ -329,28 +329,28 @@ void hsInterp::LinInterp(const hsAffineParts* k1, const hsAffineParts* k2, hsSca /////////////////////////////////////////////////////// // -void hsInterp::BezScalarEval(const hsScalar value1, const hsScalar outTan, - const hsScalar value2, const hsScalar inTan, - const hsScalar t, const hsScalar tanScale, hsScalar *result) +void hsInterp::BezScalarEval(const float value1, const float outTan, + const float value2, const float inTan, + const float t, const float tanScale, float *result) { #if 0 // If the tangents were what you'd expect them to be... Hermite splines, than this code // would make sense. But no, Max likes to store them in a scaled form based on the // time of each frame. If we ever optimize this further, we could do the scaling on export, // but I need this to work right now before all the artists hate me too much. - const hsScalar t2 = t * t; - const hsScalar t3 = t2 * t; + const float t2 = t * t; + const float t3 = t2 * t; - const hsScalar term1 = 2 * t3 - 3 * t2; + const float term1 = 2 * t3 - 3 * t2; *result = ((term1 + 1) * value1) + (-term1 * value2) + ((t3 - 2 * t2 + 1) * outTan) + ((t3 - t2) * inTan); #else - const hsScalar oneMinusT = (1.0f - t); - const hsScalar tSq = t * t; - const hsScalar oneMinusTSq = oneMinusT * oneMinusT; + const float oneMinusT = (1.0f - t); + const float tSq = t * t; + const float oneMinusTSq = oneMinusT * oneMinusT; *result = (oneMinusT * oneMinusTSq * value1) + (3.f * t * oneMinusTSq * (value1 + outTan * tanScale)) + @@ -359,23 +359,23 @@ void hsInterp::BezScalarEval(const hsScalar value1, const hsScalar outTan, #endif } -void hsInterp::BezInterp(const hsBezPoint3Key* k1, const hsBezPoint3Key* k2, const hsScalar t, hsScalarTriple* result) +void hsInterp::BezInterp(const hsBezPoint3Key* k1, const hsBezPoint3Key* k2, const float t, hsScalarTriple* result) { - hsScalar scale = (k2->fFrame - k1->fFrame) * MAX_TICKS_PER_FRAME / 3.f; + float scale = (k2->fFrame - k1->fFrame) * MAX_TICKS_PER_FRAME / 3.f; BezScalarEval(k1->fValue.fX, k1->fOutTan.fX, k2->fValue.fX, k2->fInTan.fX, t, scale, &result->fX); BezScalarEval(k1->fValue.fY, k1->fOutTan.fY, k2->fValue.fY, k2->fInTan.fY, t, scale, &result->fY); BezScalarEval(k1->fValue.fZ, k1->fOutTan.fZ, k2->fValue.fZ, k2->fInTan.fZ, t, scale, &result->fZ); } -void hsInterp::BezInterp(const hsBezScalarKey* k1, const hsBezScalarKey* k2, const hsScalar t, hsScalar* result) +void hsInterp::BezInterp(const hsBezScalarKey* k1, const hsBezScalarKey* k2, const float t, float* result) { - hsScalar scale = (k2->fFrame - k1->fFrame) * MAX_TICKS_PER_FRAME / 3.f; + float scale = (k2->fFrame - k1->fFrame) * MAX_TICKS_PER_FRAME / 3.f; BezScalarEval(k1->fValue, k1->fOutTan, k2->fValue, k2->fInTan, t, scale, result); } -void hsInterp::BezInterp(const hsBezScaleKey* k1, const hsBezScaleKey* k2, const hsScalar t, hsScaleValue* result) +void hsInterp::BezInterp(const hsBezScaleKey* k1, const hsBezScaleKey* k2, const float t, hsScaleValue* result) { - hsScalar scale = (k2->fFrame - k1->fFrame) * MAX_TICKS_PER_FRAME / 3.f; + float scale = (k2->fFrame - k1->fFrame) * MAX_TICKS_PER_FRAME / 3.f; BezScalarEval(k1->fValue.fS.fX, k1->fOutTan.fX, k2->fValue.fS.fX, k2->fInTan.fX, t, scale, &result->fS.fX); BezScalarEval(k1->fValue.fS.fY, k1->fOutTan.fY, k2->fValue.fS.fY, k2->fInTan.fY, t, scale, &result->fS.fY); BezScalarEval(k1->fValue.fS.fZ, k1->fOutTan.fZ, k2->fValue.fS.fZ, k2->fInTan.fZ, t, scale, &result->fS.fZ); @@ -387,7 +387,7 @@ void hsInterp::BezInterp(const hsBezScaleKey* k1, const hsBezScaleKey* k2, const // // Get an element from an array of unknown type // -static inline hsKeyFrame* GetKey(Int32 i, void *keys, Int32 size) +static inline hsKeyFrame* GetKey(int32_t i, void *keys, int32_t size) { return (hsKeyFrame*) ((char*)keys + size * i); } @@ -399,12 +399,12 @@ static inline hsKeyFrame* GetKey(Int32 i, void *keys, Int32 size) // Returns the index of the first key which can be passed in as a hint (lastKeyIdx) // for the next search. // -void hsInterp::GetBoundaryKeyFrames(hsScalar time, UInt32 numKeys, void *keys, UInt32 size, - hsKeyFrame **kF1, hsKeyFrame **kF2, UInt32 *lastKeyIdx, hsScalar *p, hsBool forwards) +void hsInterp::GetBoundaryKeyFrames(float time, uint32_t numKeys, void *keys, uint32_t size, + hsKeyFrame **kF1, hsKeyFrame **kF2, uint32_t *lastKeyIdx, float *p, hsBool forwards) { hsAssert(numKeys>1, "Must have more than 1 keyframe"); int k1, k2; - UInt16 frame = (UInt16)(time * MAX_FRAMES_PER_SEC); + uint16_t frame = (uint16_t)(time * MAX_FRAMES_PER_SEC); // boundary case, past end if (frame > GetKey(numKeys-1, keys, size)->fFrame) diff --git a/Sources/Plasma/PubUtilLib/plInterp/hsInterp.h b/Sources/Plasma/PubUtilLib/plInterp/hsInterp.h index 7523a07e..8d80fc0a 100644 --- a/Sources/Plasma/PubUtilLib/plInterp/hsInterp.h +++ b/Sources/Plasma/PubUtilLib/plInterp/hsInterp.h @@ -68,26 +68,26 @@ public: kPreservePartsScale = 0x40 // result gets the scale of key1 }; - static void BezScalarEval(const hsScalar value1, const hsScalar outTan, - const hsScalar value2, const hsScalar inTan, - const hsScalar t, const hsScalar scale, hsScalar *result); - static void BezInterp(const hsBezPoint3Key *k1, const hsBezPoint3Key *k2, const hsScalar t, hsScalarTriple *result); - static void BezInterp(const hsBezScalarKey *k1, const hsBezScalarKey *k2, const hsScalar t, hsScalar *result); - static void BezInterp(const hsBezScaleKey *k1, const hsBezScaleKey *k2, const hsScalar t, hsScaleValue *result); + static void BezScalarEval(const float value1, const float outTan, + const float value2, const float inTan, + const float t, const float scale, float *result); + static void BezInterp(const hsBezPoint3Key *k1, const hsBezPoint3Key *k2, const float t, hsScalarTriple *result); + static void BezInterp(const hsBezScalarKey *k1, const hsBezScalarKey *k2, const float t, float *result); + static void BezInterp(const hsBezScaleKey *k1, const hsBezScaleKey *k2, const float t, hsScaleValue *result); // simple linear interpolation - static void LinInterp(const hsScalar k1, const hsScalar k2, const hsScalar t, hsScalar *result); - static void LinInterp(const hsScalarTriple *k1, const hsScalarTriple *k2, const hsScalar t, hsScalarTriple *result); - static void LinInterp(const hsColorRGBA *k1, const hsColorRGBA *k2, const hsScalar t, hsColorRGBA *result, UInt32 ignoreFlags=0); - static void LinInterp(const hsMatrix33 *k1, const hsMatrix33 *k2, const hsScalar t, hsMatrix33 *result, UInt32 ignoreFlags=0); - static void LinInterp(const hsMatrix44 *mat1, const hsMatrix44 *mat2, const hsScalar t, hsMatrix44 *out, UInt32 ignoreFlags=0); - static void LinInterp(const hsQuat *k1, const hsQuat *k2, const hsScalar t, hsQuat *result); - static void LinInterp(const hsScaleValue *k1, const hsScaleValue *k2, const hsScalar t, hsScaleValue *result); - static void LinInterp(const hsAffineParts *k1, const hsAffineParts *k2, const hsScalar t, hsAffineParts *result, UInt32 ignoreFlags=0); + static void LinInterp(const float k1, const float k2, const float t, float *result); + static void LinInterp(const hsScalarTriple *k1, const hsScalarTriple *k2, const float t, hsScalarTriple *result); + static void LinInterp(const hsColorRGBA *k1, const hsColorRGBA *k2, const float t, hsColorRGBA *result, uint32_t ignoreFlags=0); + static void LinInterp(const hsMatrix33 *k1, const hsMatrix33 *k2, const float t, hsMatrix33 *result, uint32_t ignoreFlags=0); + static void LinInterp(const hsMatrix44 *mat1, const hsMatrix44 *mat2, const float t, hsMatrix44 *out, uint32_t ignoreFlags=0); + static void LinInterp(const hsQuat *k1, const hsQuat *k2, const float t, hsQuat *result); + static void LinInterp(const hsScaleValue *k1, const hsScaleValue *k2, const float t, hsScaleValue *result); + static void LinInterp(const hsAffineParts *k1, const hsAffineParts *k2, const float t, hsAffineParts *result, uint32_t ignoreFlags=0); // Given a time value, find the enclosing keyframes and normalize time (0-1) - static void GetBoundaryKeyFrames(hsScalar time, UInt32 numKeys, void *keys, - UInt32 keySize, hsKeyFrame **kF1, hsKeyFrame **kF2, UInt32 *lastKeyIdx, hsScalar *p, hsBool forwards); + static void GetBoundaryKeyFrames(float time, uint32_t numKeys, void *keys, + uint32_t keySize, hsKeyFrame **kF1, hsKeyFrame **kF2, uint32_t *lastKeyIdx, float *p, hsBool forwards); }; diff --git a/Sources/Plasma/PubUtilLib/plInterp/hsKeys.cpp b/Sources/Plasma/PubUtilLib/plInterp/hsKeys.cpp index bc8a9e19..6cd08a7c 100644 --- a/Sources/Plasma/PubUtilLib/plInterp/hsKeys.cpp +++ b/Sources/Plasma/PubUtilLib/plInterp/hsKeys.cpp @@ -41,6 +41,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ #include "hsKeys.h" #include "hsStream.h" +#include const int hsKeyFrame::kMaxFrameNumber = 65535; @@ -149,8 +150,8 @@ hsBool hsQuatKey::CompareValue(hsQuatKey *key) ////////////////////////////////////////////////////////////////////////////// -const hsScalar hsCompressedQuatKey32::kOneOverRootTwo = 0.70710678; -const hsScalar hsCompressedQuatKey32::k10BitScaleRange = 1023 / (2 * kOneOverRootTwo); +const float hsCompressedQuatKey32::kOneOverRootTwo = 0.70710678; +const float hsCompressedQuatKey32::k10BitScaleRange = 1023 / (2 * kOneOverRootTwo); void hsCompressedQuatKey32::Read(hsStream *stream) { @@ -177,8 +178,8 @@ hsBool hsCompressedQuatKey32::CompareValue(hsCompressedQuatKey32 *key) void hsCompressedQuatKey32::SetQuat(hsQuat &q) { q.Normalize(); - UInt32 maxElement = kCompQuatNukeX; - hsScalar maxVal = hsABS(q.fX); + uint32_t maxElement = kCompQuatNukeX; + float maxVal = hsABS(q.fX); if (hsABS(q.fY) > maxVal) { maxElement = kCompQuatNukeY; @@ -204,9 +205,9 @@ void hsCompressedQuatKey32::SetQuat(hsQuat &q) q = -q; fData = (maxElement << 30) | - (((UInt32)(k10BitScaleRange * (q.fY + kOneOverRootTwo))) << 20) | - (((UInt32)(k10BitScaleRange * (q.fZ + kOneOverRootTwo))) << 10) | - (((UInt32)(k10BitScaleRange * (q.fW + kOneOverRootTwo)))); + (((uint32_t)(k10BitScaleRange * (q.fY + kOneOverRootTwo))) << 20) | + (((uint32_t)(k10BitScaleRange * (q.fZ + kOneOverRootTwo))) << 10) | + (((uint32_t)(k10BitScaleRange * (q.fW + kOneOverRootTwo)))); break; } case kCompQuatNukeY: @@ -215,9 +216,9 @@ void hsCompressedQuatKey32::SetQuat(hsQuat &q) q = -q; fData = (maxElement << 30) | - (((UInt32)(k10BitScaleRange * (q.fX + kOneOverRootTwo))) << 20) | - (((UInt32)(k10BitScaleRange * (q.fZ + kOneOverRootTwo))) << 10) | - (((UInt32)(k10BitScaleRange * (q.fW + kOneOverRootTwo)))); + (((uint32_t)(k10BitScaleRange * (q.fX + kOneOverRootTwo))) << 20) | + (((uint32_t)(k10BitScaleRange * (q.fZ + kOneOverRootTwo))) << 10) | + (((uint32_t)(k10BitScaleRange * (q.fW + kOneOverRootTwo)))); break; } case kCompQuatNukeZ: @@ -226,9 +227,9 @@ void hsCompressedQuatKey32::SetQuat(hsQuat &q) q = -q; fData = (maxElement << 30) | - (((UInt32)(k10BitScaleRange * (q.fX + kOneOverRootTwo))) << 20) | - (((UInt32)(k10BitScaleRange * (q.fY + kOneOverRootTwo))) << 10) | - (((UInt32)(k10BitScaleRange * (q.fW + kOneOverRootTwo)))); + (((uint32_t)(k10BitScaleRange * (q.fX + kOneOverRootTwo))) << 20) | + (((uint32_t)(k10BitScaleRange * (q.fY + kOneOverRootTwo))) << 10) | + (((uint32_t)(k10BitScaleRange * (q.fW + kOneOverRootTwo)))); break; } case kCompQuatNukeW: @@ -238,9 +239,9 @@ void hsCompressedQuatKey32::SetQuat(hsQuat &q) q = -q; fData = (maxElement << 30) | - (((UInt32)(k10BitScaleRange * (q.fX + kOneOverRootTwo))) << 20) | - (((UInt32)(k10BitScaleRange * (q.fY + kOneOverRootTwo))) << 10) | - (((UInt32)(k10BitScaleRange * (q.fZ + kOneOverRootTwo)))); + (((uint32_t)(k10BitScaleRange * (q.fX + kOneOverRootTwo))) << 20) | + (((uint32_t)(k10BitScaleRange * (q.fY + kOneOverRootTwo))) << 10) | + (((uint32_t)(k10BitScaleRange * (q.fZ + kOneOverRootTwo)))); break; } } @@ -248,7 +249,7 @@ void hsCompressedQuatKey32::SetQuat(hsQuat &q) void hsCompressedQuatKey32::GetQuat(hsQuat &q) { - UInt32 maxElement = fData >> 30; + uint32_t maxElement = fData >> 30; switch (maxElement) { case kCompQuatNukeX: @@ -256,7 +257,7 @@ void hsCompressedQuatKey32::GetQuat(hsQuat &q) q.fY = (fData >> 20 & 0x000003ff) / k10BitScaleRange - kOneOverRootTwo; q.fZ = (fData >> 10 & 0x000003ff) / k10BitScaleRange - kOneOverRootTwo; q.fW = (fData & 0x000003ff) / k10BitScaleRange - kOneOverRootTwo; - q.fX = hsSquareRoot(1 - q.fY * q.fY - q.fZ * q.fZ - q.fW *q.fW); + q.fX = sqrt(1 - q.fY * q.fY - q.fZ * q.fZ - q.fW *q.fW); break; } case kCompQuatNukeY: @@ -264,7 +265,7 @@ void hsCompressedQuatKey32::GetQuat(hsQuat &q) q.fX = (fData >> 20 & 0x000003ff) / k10BitScaleRange - kOneOverRootTwo; q.fZ = (fData >> 10 & 0x000003ff) / k10BitScaleRange - kOneOverRootTwo; q.fW = (fData & 0x000003ff) / k10BitScaleRange - kOneOverRootTwo; - q.fY = hsSquareRoot(1 - q.fX * q.fX - q.fZ * q.fZ - q.fW *q.fW); + q.fY = sqrt(1 - q.fX * q.fX - q.fZ * q.fZ - q.fW *q.fW); break; } case kCompQuatNukeZ: @@ -272,7 +273,7 @@ void hsCompressedQuatKey32::GetQuat(hsQuat &q) q.fX = (fData >> 20 & 0x000003ff) / k10BitScaleRange - kOneOverRootTwo; q.fY = (fData >> 10 & 0x000003ff) / k10BitScaleRange - kOneOverRootTwo; q.fW = (fData & 0x000003ff) / k10BitScaleRange - kOneOverRootTwo; - q.fZ = hsSquareRoot(1 - q.fX * q.fX - q.fY * q.fY - q.fW *q.fW); + q.fZ = sqrt(1 - q.fX * q.fX - q.fY * q.fY - q.fW *q.fW); break; } case kCompQuatNukeW: @@ -281,7 +282,7 @@ void hsCompressedQuatKey32::GetQuat(hsQuat &q) q.fX = (fData >> 20 & 0x000003ff) / k10BitScaleRange - kOneOverRootTwo; q.fY = (fData >> 10 & 0x000003ff) / k10BitScaleRange - kOneOverRootTwo; q.fZ = (fData & 0x000003ff) / k10BitScaleRange - kOneOverRootTwo; - q.fW = hsSquareRoot(1 - q.fX * q.fX - q.fY * q.fY - q.fZ * q.fZ); + q.fW = sqrt(1 - q.fX * q.fX - q.fY * q.fY - q.fZ * q.fZ); break; } } @@ -289,9 +290,9 @@ void hsCompressedQuatKey32::GetQuat(hsQuat &q) ///////////////////////////////////////////////////////////////////////////// -const hsScalar hsCompressedQuatKey64::kOneOverRootTwo = 0.70710678; -const hsScalar hsCompressedQuatKey64::k20BitScaleRange = 1048575 / (2 * kOneOverRootTwo); -const hsScalar hsCompressedQuatKey64::k21BitScaleRange = 2097151 / (2 * kOneOverRootTwo); +const float hsCompressedQuatKey64::kOneOverRootTwo = 0.70710678; +const float hsCompressedQuatKey64::k20BitScaleRange = 1048575 / (2 * kOneOverRootTwo); +const float hsCompressedQuatKey64::k21BitScaleRange = 2097151 / (2 * kOneOverRootTwo); void hsCompressedQuatKey64::Read(hsStream *stream) { @@ -320,8 +321,8 @@ hsBool hsCompressedQuatKey64::CompareValue(hsCompressedQuatKey64 *key) void hsCompressedQuatKey64::SetQuat(hsQuat &q) { q.Normalize(); - UInt32 maxElement = kCompQuatNukeX; - hsScalar maxVal = hsABS(q.fX); + uint32_t maxElement = kCompQuatNukeX; + float maxVal = hsABS(q.fX); if (hsABS(q.fY) > maxVal) { maxElement = kCompQuatNukeY; @@ -347,11 +348,11 @@ void hsCompressedQuatKey64::SetQuat(hsQuat &q) q = -q; fData[0] = (maxElement << 30) | - (((UInt32)(k20BitScaleRange * (q.fY + kOneOverRootTwo))) << 10) | - (((UInt32)(k21BitScaleRange * (q.fZ + kOneOverRootTwo))) >> 11); + (((uint32_t)(k20BitScaleRange * (q.fY + kOneOverRootTwo))) << 10) | + (((uint32_t)(k21BitScaleRange * (q.fZ + kOneOverRootTwo))) >> 11); fData[1] = - (((UInt32)(k21BitScaleRange * (q.fZ + kOneOverRootTwo))) << 21) | - (((UInt32)(k21BitScaleRange * (q.fW + kOneOverRootTwo)))); + (((uint32_t)(k21BitScaleRange * (q.fZ + kOneOverRootTwo))) << 21) | + (((uint32_t)(k21BitScaleRange * (q.fW + kOneOverRootTwo)))); break; } case kCompQuatNukeY: @@ -360,11 +361,11 @@ void hsCompressedQuatKey64::SetQuat(hsQuat &q) q = -q; fData[0] = (maxElement << 30) | - (((UInt32)(k20BitScaleRange * (q.fX + kOneOverRootTwo))) << 10) | - (((UInt32)(k21BitScaleRange * (q.fZ + kOneOverRootTwo))) >> 11); + (((uint32_t)(k20BitScaleRange * (q.fX + kOneOverRootTwo))) << 10) | + (((uint32_t)(k21BitScaleRange * (q.fZ + kOneOverRootTwo))) >> 11); fData[1] = - (((UInt32)(k21BitScaleRange * (q.fZ + kOneOverRootTwo))) << 21) | - (((UInt32)(k21BitScaleRange * (q.fW + kOneOverRootTwo)))); + (((uint32_t)(k21BitScaleRange * (q.fZ + kOneOverRootTwo))) << 21) | + (((uint32_t)(k21BitScaleRange * (q.fW + kOneOverRootTwo)))); break; } case kCompQuatNukeZ: @@ -373,11 +374,11 @@ void hsCompressedQuatKey64::SetQuat(hsQuat &q) q = -q; fData[0] = (maxElement << 30) | - (((UInt32)(k20BitScaleRange * (q.fX + kOneOverRootTwo))) << 10) | - (((UInt32)(k21BitScaleRange * (q.fY + kOneOverRootTwo))) >> 11); + (((uint32_t)(k20BitScaleRange * (q.fX + kOneOverRootTwo))) << 10) | + (((uint32_t)(k21BitScaleRange * (q.fY + kOneOverRootTwo))) >> 11); fData[1] = - (((UInt32)(k21BitScaleRange * (q.fY + kOneOverRootTwo))) << 21) | - (((UInt32)(k21BitScaleRange * (q.fW + kOneOverRootTwo)))); + (((uint32_t)(k21BitScaleRange * (q.fY + kOneOverRootTwo))) << 21) | + (((uint32_t)(k21BitScaleRange * (q.fW + kOneOverRootTwo)))); break; } case kCompQuatNukeW: @@ -387,11 +388,11 @@ void hsCompressedQuatKey64::SetQuat(hsQuat &q) q = -q; fData[0] = (maxElement << 30) | - (((UInt32)(k20BitScaleRange * (q.fX + kOneOverRootTwo))) << 10) | - (((UInt32)(k21BitScaleRange * (q.fY + kOneOverRootTwo))) >> 11); + (((uint32_t)(k20BitScaleRange * (q.fX + kOneOverRootTwo))) << 10) | + (((uint32_t)(k21BitScaleRange * (q.fY + kOneOverRootTwo))) >> 11); fData[1] = - (((UInt32)(k21BitScaleRange * (q.fY + kOneOverRootTwo))) << 21) | - (((UInt32)(k21BitScaleRange * (q.fZ + kOneOverRootTwo)))); + (((uint32_t)(k21BitScaleRange * (q.fY + kOneOverRootTwo))) << 21) | + (((uint32_t)(k21BitScaleRange * (q.fZ + kOneOverRootTwo)))); break; } } @@ -399,7 +400,7 @@ void hsCompressedQuatKey64::SetQuat(hsQuat &q) void hsCompressedQuatKey64::GetQuat(hsQuat &q) { - UInt32 maxElement = fData[0] >> 30; + uint32_t maxElement = fData[0] >> 30; switch (maxElement) { case kCompQuatNukeX: @@ -407,7 +408,7 @@ void hsCompressedQuatKey64::GetQuat(hsQuat &q) q.fY = ((fData[0] >> 10) & 0x000fffff) / k20BitScaleRange - kOneOverRootTwo; q.fZ = (((fData[0] & 0x000003ff) << 11) | (fData[1] >> 21)) / k21BitScaleRange - kOneOverRootTwo; q.fW = (fData[1] & 0x001fffff) / k21BitScaleRange - kOneOverRootTwo; - q.fX = hsSquareRoot(1 - q.fY * q.fY - q.fZ * q.fZ - q.fW *q.fW); + q.fX = sqrt(1 - q.fY * q.fY - q.fZ * q.fZ - q.fW *q.fW); break; } case kCompQuatNukeY: @@ -415,7 +416,7 @@ void hsCompressedQuatKey64::GetQuat(hsQuat &q) q.fX = ((fData[0] >> 10) & 0x000fffff) / k20BitScaleRange - kOneOverRootTwo; q.fZ = (((fData[0] & 0x000003ff) << 11) | (fData[1] >> 21)) / k21BitScaleRange - kOneOverRootTwo; q.fW = (fData[1] & 0x001fffff) / k21BitScaleRange - kOneOverRootTwo; - q.fY = hsSquareRoot(1 - q.fX * q.fX - q.fZ * q.fZ - q.fW *q.fW); + q.fY = sqrt(1 - q.fX * q.fX - q.fZ * q.fZ - q.fW *q.fW); break; } case kCompQuatNukeZ: @@ -423,7 +424,7 @@ void hsCompressedQuatKey64::GetQuat(hsQuat &q) q.fX = ((fData[0] >> 10) & 0x000fffff) / k20BitScaleRange - kOneOverRootTwo; q.fY = (((fData[0] & 0x000003ff) << 11) | (fData[1] >> 21)) / k21BitScaleRange - kOneOverRootTwo; q.fW = (fData[1] & 0x001fffff) / k21BitScaleRange - kOneOverRootTwo; - q.fZ = hsSquareRoot(1 - q.fX * q.fX - q.fY * q.fY - q.fW *q.fW); + q.fZ = sqrt(1 - q.fX * q.fX - q.fY * q.fY - q.fW *q.fW); break; } case kCompQuatNukeW: @@ -432,7 +433,7 @@ void hsCompressedQuatKey64::GetQuat(hsQuat &q) q.fX = ((fData[0] >> 10) & 0x000fffff) / k20BitScaleRange - kOneOverRootTwo; q.fY = (((fData[0] & 0x000003ff) << 11) | (fData[1] >> 21)) / k21BitScaleRange - kOneOverRootTwo; q.fZ = (fData[1] & 0x001fffff) / k21BitScaleRange - kOneOverRootTwo; - q.fW = hsSquareRoot(1 - q.fX * q.fX - q.fY * q.fY - q.fZ * q.fZ); + q.fW = sqrt(1 - q.fX * q.fX - q.fY * q.fY - q.fZ * q.fZ); break; } } @@ -494,7 +495,7 @@ hsBool hsBezScaleKey::CompareValue(hsBezScaleKey *key) ////////////////////// -void hsG3DSMaxKeyFrame::Set(hsMatrix44 *mat, UInt16 frame) +void hsG3DSMaxKeyFrame::Set(hsMatrix44 *mat, uint16_t frame) { fFrame = frame; gemAffineParts parts; @@ -502,7 +503,7 @@ void hsG3DSMaxKeyFrame::Set(hsMatrix44 *mat, UInt16 frame) AP_SET(fParts, parts); } -void hsG3DSMaxKeyFrame::Set(const hsAffineParts &parts, UInt16 frame) +void hsG3DSMaxKeyFrame::Set(const hsAffineParts &parts, uint16_t frame) { fFrame = frame; fParts = parts; @@ -530,7 +531,7 @@ hsBool hsG3DSMaxKeyFrame::CompareValue(hsG3DSMaxKeyFrame *key) void hsMatrix33Key::Read(hsStream *stream) { fFrame = stream->ReadLE16(); - Int32 i,j; + int32_t i,j; for(i=0;i<3;i++) for(j=0;j<3;j++) fValue.fMap[j][i] = stream->ReadLEScalar(); @@ -539,7 +540,7 @@ void hsMatrix33Key::Read(hsStream *stream) void hsMatrix33Key::Write(hsStream *stream) { stream->WriteLE16(fFrame); - Int32 i,j; + int32_t i,j; for(i=0;i<3;i++) for(j=0;j<3;j++) stream->WriteLEScalar(fValue.fMap[j][i]); diff --git a/Sources/Plasma/PubUtilLib/plInterp/hsKeys.h b/Sources/Plasma/PubUtilLib/plInterp/hsKeys.h index 7fd3de52..e77c3d7a 100644 --- a/Sources/Plasma/PubUtilLib/plInterp/hsKeys.h +++ b/Sources/Plasma/PubUtilLib/plInterp/hsKeys.h @@ -70,7 +70,7 @@ struct hsKeyFrame kMatrix44KeyFrame, }; - UInt16 fFrame; + uint16_t fFrame; static const int kMaxFrameNumber; }; @@ -98,7 +98,7 @@ struct hsBezPoint3Key : public hsKeyFrame struct hsScalarKey : public hsKeyFrame { - hsScalar fValue; + float fValue; void Read(hsStream *stream); void Write(hsStream *stream); @@ -108,9 +108,9 @@ struct hsScalarKey : public hsKeyFrame struct hsBezScalarKey : public hsKeyFrame { - hsScalar fInTan; - hsScalar fOutTan; - hsScalar fValue; + float fInTan; + float fOutTan; + float fValue; void Read(hsStream *stream); void Write(hsStream *stream); @@ -138,8 +138,8 @@ struct hsCompressedQuatKey32 : public hsKeyFrame kCompQuatNukeW, }; - static const hsScalar kOneOverRootTwo; - static const hsScalar k10BitScaleRange; + static const float kOneOverRootTwo; + static const float k10BitScaleRange; void SetQuat(hsQuat &q); void GetQuat(hsQuat &q); @@ -150,7 +150,7 @@ struct hsCompressedQuatKey32 : public hsKeyFrame hsBool CompareValue(hsCompressedQuatKey32 *key); protected: - UInt32 fData; + uint32_t fData; }; struct hsCompressedQuatKey64 : public hsKeyFrame @@ -163,9 +163,9 @@ struct hsCompressedQuatKey64 : public hsKeyFrame kCompQuatNukeW, }; - static const hsScalar kOneOverRootTwo; - static const hsScalar k20BitScaleRange; - static const hsScalar k21BitScaleRange; + static const float kOneOverRootTwo; + static const float k20BitScaleRange; + static const float k21BitScaleRange; void SetQuat(hsQuat &q); void GetQuat(hsQuat &q); @@ -176,7 +176,7 @@ struct hsCompressedQuatKey64 : public hsKeyFrame hsBool CompareValue(hsCompressedQuatKey64 *key); protected: - UInt32 fData[2]; + uint32_t fData[2]; }; struct hsScaleValue : public hsKeyFrame @@ -221,8 +221,8 @@ struct hsG3DSMaxKeyFrame : public hsKeyFrame void Reset() { fParts.Reset(); } // Make parts identity - void Set(hsMatrix44 *mat, UInt16 frame); - void Set(const hsAffineParts &parts, UInt16 frame); + void Set(hsMatrix44 *mat, uint16_t frame); + void Set(const hsAffineParts &parts, uint16_t frame); hsMatrix44* GetMatrix44(hsMatrix44 *mat) { fParts.ComposeMatrix(mat); return mat; } diff --git a/Sources/Plasma/PubUtilLib/plInterp/hsTimedValue.h b/Sources/Plasma/PubUtilLib/plInterp/hsTimedValue.h index 60eff26b..53787750 100644 --- a/Sources/Plasma/PubUtilLib/plInterp/hsTimedValue.h +++ b/Sources/Plasma/PubUtilLib/plInterp/hsTimedValue.h @@ -53,9 +53,9 @@ public: kInstant = 0x2 }; protected: - UInt32 fFlags; - hsScalar fDuration; - hsScalar fStartTime; + uint32_t fFlags; + float fDuration; + float fStartTime; T fValue; T fGoal; @@ -65,10 +65,10 @@ public: hsTimedValue() : fFlags(kIdle|kInstant), fDuration(0) {} hsTimedValue(const T& v) : fFlags(kIdle|kInstant), fDuration(0) { SetValue(v); } - UInt32 GetFlags() { return fFlags; } + uint32_t GetFlags() { return fFlags; } - void SetDuration(hsScalar duration); - hsScalar GetDuration() const { return fDuration; } + void SetDuration(float duration); + float GetDuration() const { return fDuration; } hsBool32 operator==(const hsTimedValue& v); hsTimedValue& operator=(const T& v) { SetValue(v); return *this; } @@ -83,22 +83,22 @@ public: void Reset() { fFlags |= (kIdle | kInstant); } - void StartClock(hsScalar s); - hsScalar GetStartTime() const { return fStartTime; } + void StartClock(float s); + float GetStartTime() const { return fStartTime; } const T& GetFrom() const { return fFrom; } - void Update(hsScalar s); + void Update(float s); - void WriteScalar(hsStream* s, hsScalar currSecs); - void Write(hsStream* s, hsScalar currSecs); + void WriteScalar(hsStream* s, float currSecs); + void Write(hsStream* s, float currSecs); - void ReadScalar(hsStream* s, hsScalar currSecs); - void Read(hsStream* s, hsScalar currSecs); + void ReadScalar(hsStream* s, float currSecs); + void Read(hsStream* s, float currSecs); }; template -void hsTimedValue::WriteScalar(hsStream* s, hsScalar currSecs) +void hsTimedValue::WriteScalar(hsStream* s, float currSecs) { s->WriteLE32(fFlags); @@ -115,7 +115,7 @@ void hsTimedValue::WriteScalar(hsStream* s, hsScalar currSecs) } template -void hsTimedValue::Write(hsStream* s, hsScalar currSecs) +void hsTimedValue::Write(hsStream* s, float currSecs) { s->WriteLE32(fFlags); @@ -132,7 +132,7 @@ void hsTimedValue::Write(hsStream* s, hsScalar currSecs) } template -void hsTimedValue::ReadScalar(hsStream* s, hsScalar currSecs) +void hsTimedValue::ReadScalar(hsStream* s, float currSecs) { fFlags = s->ReadLE32(); @@ -149,7 +149,7 @@ void hsTimedValue::ReadScalar(hsStream* s, hsScalar currSecs) } template -void hsTimedValue::Read(hsStream* s, hsScalar currSecs) +void hsTimedValue::Read(hsStream* s, float currSecs) { fFlags = s->ReadLE32(); @@ -166,7 +166,7 @@ void hsTimedValue::Read(hsStream* s, hsScalar currSecs) } template -void hsTimedValue::SetDuration(hsScalar duration) +void hsTimedValue::SetDuration(float duration) { fDuration = duration; if( fDuration > 0 ) @@ -192,7 +192,7 @@ hsBool32 hsTimedValue::operator==(const hsTimedValue& v) } template -void hsTimedValue::StartClock(hsScalar s) +void hsTimedValue::StartClock(float s) { fStartTime = s; @@ -212,19 +212,19 @@ void hsTimedValue::StartClock(hsScalar s) } template -void hsTimedValue::Update(hsScalar s) +void hsTimedValue::Update(float s) { if( fFlags & kIdle ) return; hsAssert(fDuration > 0, "Instant should always be idle"); - hsScalar interp = (s - fStartTime) / fDuration; + float interp = (s - fStartTime) / fDuration; - if( interp >= hsScalar1 ) + if( interp >= 1.f ) { fValue = fGoal; - interp = hsScalar1; + interp = 1.f; fFlags |= kIdle; } else diff --git a/Sources/Plasma/PubUtilLib/plInterp/plATCEaseCurves.cpp b/Sources/Plasma/PubUtilLib/plInterp/plATCEaseCurves.cpp index 2242be86..b87b8e45 100644 --- a/Sources/Plasma/PubUtilLib/plInterp/plATCEaseCurves.cpp +++ b/Sources/Plasma/PubUtilLib/plInterp/plATCEaseCurves.cpp @@ -44,20 +44,20 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com /////////////////////////////////////////////////////////////////////////////////////////////// -plATCEaseCurve *plATCEaseCurve::CreateEaseCurve(UInt8 type, hsScalar minLength, hsScalar maxLength, hsScalar length, - hsScalar startSpeed, hsScalar goalSpeed) +plATCEaseCurve *plATCEaseCurve::CreateEaseCurve(uint8_t type, float minLength, float maxLength, float length, + float startSpeed, float goalSpeed) { if (type == plAnimEaseTypes::kConstAccel) - return TRACKED_NEW plConstAccelEaseCurve(minLength, maxLength, length, startSpeed, goalSpeed); + return new plConstAccelEaseCurve(minLength, maxLength, length, startSpeed, goalSpeed); if (type == plAnimEaseTypes::kSpline) - return TRACKED_NEW plSplineEaseCurve(minLength, maxLength, length, startSpeed, goalSpeed); + return new plSplineEaseCurve(minLength, maxLength, length, startSpeed, goalSpeed); return nil; } -void plATCEaseCurve::RecalcToSpeed(hsScalar startSpeed, hsScalar goalSpeed, hsBool preserveRate /* = false */) +void plATCEaseCurve::RecalcToSpeed(float startSpeed, float goalSpeed, hsBool preserveRate /* = false */) { - hsScalar rate = 1; + float rate = 1; if (fSpeed == goalSpeed && fStartSpeed == startSpeed) // already there, no need to do anything return; @@ -72,45 +72,45 @@ void plATCEaseCurve::RecalcToSpeed(hsScalar startSpeed, hsScalar goalSpeed, hsBo SetLengthOnRate(rate); } -void plATCEaseCurve::SetLengthOnRate(hsScalar rate) +void plATCEaseCurve::SetLengthOnRate(float rate) { fLength = (fSpeed - fStartSpeed) / rate; if (fLength < 0) fLength = -fLength; } -hsScalar plATCEaseCurve::GetMinDistance() +float plATCEaseCurve::GetMinDistance() { if (fMinLength == 0) return 0; - hsScalar oldLength = fLength; + float oldLength = fLength; fLength = fMinLength; - hsScalar result = PositionGivenTime(fMinLength); + float result = PositionGivenTime(fMinLength); fLength = oldLength; return result; } -hsScalar plATCEaseCurve::GetMaxDistance() +float plATCEaseCurve::GetMaxDistance() { if (fMaxLength == 0) return 0; - hsScalar oldLength = fLength; + float oldLength = fLength; fLength = fMaxLength; - hsScalar result = PositionGivenTime(fMaxLength); + float result = PositionGivenTime(fMaxLength); fLength = oldLength; return result; } -hsScalar plATCEaseCurve::GetNormDistance() +float plATCEaseCurve::GetNormDistance() { if (fNormLength == 0) return 0; - hsScalar oldLength = fLength; + float oldLength = fLength; fLength = fNormLength; - hsScalar result = PositionGivenTime(fNormLength); + float result = PositionGivenTime(fNormLength); fLength = oldLength; return result; } @@ -149,8 +149,8 @@ plConstAccelEaseCurve::plConstAccelEaseCurve() RecalcToSpeed(0, 1); } -plConstAccelEaseCurve::plConstAccelEaseCurve(hsScalar minLength, hsScalar maxLength, hsScalar length, - hsScalar startSpeed, hsScalar goalSpeed) +plConstAccelEaseCurve::plConstAccelEaseCurve(float minLength, float maxLength, float length, + float startSpeed, float goalSpeed) { fMinLength = minLength; fMaxLength = maxLength; @@ -162,7 +162,7 @@ plConstAccelEaseCurve::plConstAccelEaseCurve(hsScalar minLength, hsScalar maxLen plATCEaseCurve *plConstAccelEaseCurve::Clone() const { - plConstAccelEaseCurve *curve = TRACKED_NEW plConstAccelEaseCurve; + plConstAccelEaseCurve *curve = new plConstAccelEaseCurve; curve->fStartSpeed = fStartSpeed; curve->fMinLength = fMinLength; curve->fMaxLength = fMaxLength; @@ -174,22 +174,22 @@ plATCEaseCurve *plConstAccelEaseCurve::Clone() const return curve; } -void plConstAccelEaseCurve::SetLengthOnDistance(hsScalar dist) +void plConstAccelEaseCurve::SetLengthOnDistance(float dist) { fLength = 2 * dist / (fSpeed + fStartSpeed); } -hsScalar plConstAccelEaseCurve::PositionGivenTime(hsScalar time) const +float plConstAccelEaseCurve::PositionGivenTime(float time) const { - return (hsScalar)(fStartSpeed * time + (0.5 * (fSpeed - fStartSpeed) / fLength) * time * time); + return (float)(fStartSpeed * time + (0.5 * (fSpeed - fStartSpeed) / fLength) * time * time); } -hsScalar plConstAccelEaseCurve::VelocityGivenTime(hsScalar time) const +float plConstAccelEaseCurve::VelocityGivenTime(float time) const { return fStartSpeed + ((fSpeed - fStartSpeed) / fLength) * time; } -hsScalar plConstAccelEaseCurve::TimeGivenVelocity(hsScalar velocity) const +float plConstAccelEaseCurve::TimeGivenVelocity(float velocity) const { return (velocity - fStartSpeed) / ((fSpeed - fStartSpeed) / fLength); } @@ -204,8 +204,8 @@ plSplineEaseCurve::plSplineEaseCurve() RecalcToSpeed(0, 1); } -plSplineEaseCurve::plSplineEaseCurve(hsScalar minLength, hsScalar maxLength, hsScalar length, - hsScalar startSpeed, hsScalar goalSpeed) +plSplineEaseCurve::plSplineEaseCurve(float minLength, float maxLength, float length, + float startSpeed, float goalSpeed) { fMinLength = minLength; fMaxLength = maxLength; @@ -217,7 +217,7 @@ plSplineEaseCurve::plSplineEaseCurve(hsScalar minLength, hsScalar maxLength, hsS plATCEaseCurve *plSplineEaseCurve::Clone() const { - plSplineEaseCurve *curve = TRACKED_NEW plSplineEaseCurve; + plSplineEaseCurve *curve = new plSplineEaseCurve; curve->fStartSpeed = fStartSpeed; curve->fMinLength = fMinLength; curve->fMaxLength = fMaxLength; @@ -233,7 +233,7 @@ plATCEaseCurve *plSplineEaseCurve::Clone() const return curve; } -void plSplineEaseCurve::RecalcToSpeed(hsScalar startSpeed, hsScalar goalSpeed, hsBool preserveRate /* = false */) +void plSplineEaseCurve::RecalcToSpeed(float startSpeed, float goalSpeed, hsBool preserveRate /* = false */) { plATCEaseCurve::RecalcToSpeed(startSpeed, goalSpeed, preserveRate); @@ -241,7 +241,7 @@ void plSplineEaseCurve::RecalcToSpeed(hsScalar startSpeed, hsScalar goalSpeed, h // Note: "b" is always zero for the ease splines we're currently doing (and will remain that way // so long as the initial acceleration is zero. Can optimize a bit of the eval math to take // advantage of this. - hsScalar a, b, c, d; + float a, b, c, d; a = fStartSpeed; b = 0; @@ -254,16 +254,16 @@ void plSplineEaseCurve::RecalcToSpeed(hsScalar startSpeed, hsScalar goalSpeed, h fCoef[3] = d; } -void plSplineEaseCurve::SetLengthOnDistance(hsScalar dist) +void plSplineEaseCurve::SetLengthOnDistance(float dist) { - hsScalar curDist = PositionGivenTime(fLength); + float curDist = PositionGivenTime(fLength); fLength = fLength * dist / curDist; } -hsScalar plSplineEaseCurve::PositionGivenTime(hsScalar time) const +float plSplineEaseCurve::PositionGivenTime(float time) const { - hsScalar t1, t2, t3, t4; + float t1, t2, t3, t4; t1 = time / fLength; t2 = t1 * t1; t3 = t2 * t1; @@ -272,53 +272,53 @@ hsScalar plSplineEaseCurve::PositionGivenTime(hsScalar time) const return fLength * (fCoef[0] * t1 + fCoef[1] * t2 / 2 + fCoef[2] * t3 / 3 + fCoef[3] * t4 / 4); } -hsScalar plSplineEaseCurve::VelocityGivenTime(hsScalar time) const +float plSplineEaseCurve::VelocityGivenTime(float time) const { - hsScalar t1, t2, t3; + float t1, t2, t3; t1 = time / fLength; t2 = t1 * t1; t3 = t2 * t1; return fCoef[0] + fCoef[1] * t1 + fCoef[2] * t2 + fCoef[3] * t3; } -hsScalar plSplineEaseCurve::TimeGivenVelocity(hsScalar velocity) const +float plSplineEaseCurve::TimeGivenVelocity(float velocity) const { // Code based off of Graphics Gems V, pp 11-12 and // http://www.worldserver.com/turk/opensource/FindCubicRoots.c.txt // Solving the equation: fCoef[0] + fCoef[1] * t + fCoef[2] * t^2 + fCoef[3] * t^3 - velocity = 0 - hsScalar root; - hsScalar a = (fCoef[0] - velocity) / fCoef[3]; - hsScalar b = fCoef[1] / fCoef[3]; - hsScalar c = fCoef[2] / fCoef[3]; + float root; + float a = (fCoef[0] - velocity) / fCoef[3]; + float b = fCoef[1] / fCoef[3]; + float c = fCoef[2] / fCoef[3]; - hsScalar Q = (c * c - 3 * b) / 9; - hsScalar R = (2 * c * c * c - 9 * c * b + 27 * a) / 54; - hsScalar Q3 = Q * Q * Q; - hsScalar D = Q3 - R * R; + float Q = (c * c - 3 * b) / 9; + float R = (2 * c * c * c - 9 * c * b + 27 * a) / 54; + float Q3 = Q * Q * Q; + float D = Q3 - R * R; if (D >= 0) { // 3 roots, find the one in the range [0, 1] - const hsScalar pi = 3.14159; + const float pi = 3.14159; double theta = acos(R / sqrt(Q3)); double sqrtQ = sqrt(Q); - root = (hsScalar)(-2 * sqrtQ * cos((theta + 4 * pi) / 3) - c / 3); // Middle root, most likely to match + root = (float)(-2 * sqrtQ * cos((theta + 4 * pi) / 3) - c / 3); // Middle root, most likely to match if (root < 0.f || root > 1.f) { - root = (hsScalar)(-2 * sqrtQ * cos((theta + 2 * pi) / 3) - c / 3); // Lower root + root = (float)(-2 * sqrtQ * cos((theta + 2 * pi) / 3) - c / 3); // Lower root if (root < 0.f || root > 1.f) { - root = (hsScalar)(-2 * sqrtQ * cos(theta / 3) - c / 3); // Upper root + root = (float)(-2 * sqrtQ * cos(theta / 3) - c / 3); // Upper root } } } else // One root to the equation (I don't expect this to happen for ease splines, but JIC) { double E = sqrt(-D) + pow(fabs(R), 1.f / 3.f); - root = (hsScalar)((E + Q / E) - c / 3); + root = (float)((E + Q / E) - c / 3); if (R > 0) root = -root; } @@ -328,10 +328,10 @@ hsScalar plSplineEaseCurve::TimeGivenVelocity(hsScalar velocity) const hsAssert(false, "No valid root found while solving animation spline"); // Either a bug, or a rare case of floating-point inaccuracy. Either way, guess // the proper root as either the start or end of the curve based on the velocity. - hsScalar dStart = velocity - fStartSpeed; + float dStart = velocity - fStartSpeed; if (dStart < 0) dStart = -dStart; - hsScalar dEnd = velocity - fSpeed; + float dEnd = velocity - fSpeed; if (dEnd < 0) dEnd = -dEnd; diff --git a/Sources/Plasma/PubUtilLib/plInterp/plAnimPath.cpp b/Sources/Plasma/PubUtilLib/plInterp/plAnimPath.cpp index 291d6478..f9a69307 100644 --- a/Sources/Plasma/PubUtilLib/plInterp/plAnimPath.cpp +++ b/Sources/Plasma/PubUtilLib/plInterp/plAnimPath.cpp @@ -40,16 +40,17 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "plAnimPath.h" #include "plController.h" #include "hsFastMath.h" #include "hsResMgr.h" +#include -const hsScalar kSmallDelTime = 1.e-2f; -const hsScalar kInvSmallDelTime = 1.f / kSmallDelTime; -const hsScalar kTerminateDelTime = 1.e-3f; -const hsScalar kTerminateDelDistSq = .1f; +const float kSmallDelTime = 1.e-2f; +const float kInvSmallDelTime = 1.f / kSmallDelTime; +const float kTerminateDelTime = 1.e-3f; +const float kTerminateDelDistSq = .1f; plAnimPath::plAnimPath() : fController(nil), fLength(0), fMinDistSq(0), @@ -70,7 +71,7 @@ void plAnimPath::Reset() SetCurTime(0); } -void plAnimPath::SetCurTime(hsScalar t, UInt32 calcFlags) +void plAnimPath::SetCurTime(float t, uint32_t calcFlags) { fTime = t; if( !fController ) @@ -82,7 +83,7 @@ void plAnimPath::SetCurTime(hsScalar t, UInt32 calcFlags) return; } - hsScalar t0, t1, t2; + float t0, t1, t2; if( t < kSmallDelTime ) { @@ -144,7 +145,7 @@ void plAnimPath::ICalcBounds() int i; hsPoint3 pos; - hsTArray keyTimes; + hsTArray keyTimes; pc->GetKeyTimes(keyTimes); fCenter.Set(0,0,0); for( i = 0; i < keyTimes.GetCount() ; i++ ) @@ -152,19 +153,19 @@ void plAnimPath::ICalcBounds() pc->Interp(keyTimes[i], &pos); fCenter += pos; } - fCenter *= hsScalarInvert((hsScalar)keyTimes.GetCount()); + fCenter *= hsInvert((float)keyTimes.GetCount()); fRadius = 0; for( i = 0; i < keyTimes.GetCount(); i++ ) { pc->Interp(keyTimes[i], &pos); - hsScalar rad = (pos - fCenter).Magnitude(); + float rad = (pos - fCenter).Magnitude(); if( rad > fRadius ) fRadius = rad; } } -hsScalar plAnimPath::ICalcTotalLength() +float plAnimPath::ICalcTotalLength() { if( !(fController && fController->GetPosController()) ) return 0; @@ -183,6 +184,11 @@ void plAnimPath::SetController(plCompoundController* tmc) ICalcBounds(); } +float plAnimPath::GetMinDistance() const +{ + return sqrt(fMinDistSq); +} + void plAnimPath::SetTransform(const hsMatrix44& l2w, const hsMatrix44& w2l) { fLocalToWorld = l2w; @@ -224,15 +230,15 @@ void plAnimPath::Write(hsStream* stream, hsResMgr* mgr) stream->WriteLEScalar(fMinDistSq); } -hsBool plAnimPath::OutOfRange(hsPoint3 &worldPt, hsScalar range) const +hsBool plAnimPath::OutOfRange(hsPoint3 &worldPt, float range) const { hsPoint3 pt = fWorldToLocal * worldPt; - hsScalar radius = (pt - fCenter).Magnitude() - fRadius; + float radius = (pt - fCenter).Magnitude() - fRadius; return( radius > range ); } -hsScalar plAnimPath::GetExtremePoint(hsPoint3 &worldPt) const +float plAnimPath::GetExtremePoint(hsPoint3 &worldPt) const { if( !fController ) return 0; @@ -241,18 +247,18 @@ hsScalar plAnimPath::GetExtremePoint(hsPoint3 &worldPt) const plController *pc = fController->GetPosController(); - hsScalar minDistSq = 1.e33f; - hsScalar minTime = 0, delTime = 0; + float minDistSq = 1.e33f; + float minTime = 0, delTime = 0; // start search by using the time of the closest ctrl point int i; - hsTArray keyTimes; + hsTArray keyTimes; pc->GetKeyTimes(keyTimes); for( i = 0; i < keyTimes.GetCount(); i++ ) { - hsScalar t = keyTimes[i]; + float t = keyTimes[i]; hsPoint3 pos; pc->Interp(t, &pos); // handles easing - hsScalar distSq = (pt - pos).MagnitudeSquared(); + float distSq = (pt - pos).MagnitudeSquared(); if( distSq < minDistSq ) { minDistSq = distSq; @@ -263,8 +269,8 @@ hsScalar plAnimPath::GetExtremePoint(hsPoint3 &worldPt) const delTime = t - keyTimes[i - 1]; else { - hsScalar fore = keyTimes[i + 1] - t; - hsScalar back = t - keyTimes[i - 1]; + float fore = keyTimes[i + 1] - t; + float back = t - keyTimes[i - 1]; delTime = hsMaximum(fore, back); } } @@ -273,7 +279,7 @@ hsScalar plAnimPath::GetExtremePoint(hsPoint3 &worldPt) const return GetExtremePoint(minTime, delTime, worldPt); } -hsScalar plAnimPath::GetExtremePoint(hsScalar lastTime, hsScalar delTime, hsPoint3 &worldPt) const +float plAnimPath::GetExtremePoint(float lastTime, float delTime, hsPoint3 &worldPt) const { if( !fController ) return 0; @@ -284,7 +290,7 @@ hsScalar plAnimPath::GetExtremePoint(hsScalar lastTime, hsScalar delTime, hsPoin return ICheckInterval(pt); } -hsScalar plAnimPath::ICheckInterval(hsPoint3 &pt) const +float plAnimPath::ICheckInterval(hsPoint3 &pt) const { if( fDelTime <= kTerminateDelTime && hsVector3(&fCurPos, &fPrevPos).MagnitudeSquared() < kTerminateDelDistSq) @@ -331,7 +337,7 @@ hsScalar plAnimPath::ICheckInterval(hsPoint3 &pt) const return 0; } -void plAnimPath::IInitInterval(hsScalar time, hsScalar delTime, hsPoint3 &pt) const +void plAnimPath::IInitInterval(float time, float delTime, hsPoint3 &pt) const { plController* pc = fController->GetPosController(); @@ -395,7 +401,7 @@ void plAnimPath::IInitInterval(hsScalar time, hsScalar delTime, hsPoint3 &pt) co } } -hsScalar plAnimPath::ISubDivBack(hsPoint3 &pt) const +float plAnimPath::ISubDivBack(hsPoint3 &pt) const { fNextTime = fThisTime; fNextDistSq = fThisDistSq; @@ -419,7 +425,7 @@ hsScalar plAnimPath::ISubDivBack(hsPoint3 &pt) const return ICheckInterval(pt); } -hsScalar plAnimPath::ISubDivFore(hsPoint3 &pt) const +float plAnimPath::ISubDivFore(hsPoint3 &pt) const { fLastTime = fThisTime; fLastDistSq = fThisDistSq; @@ -443,7 +449,7 @@ hsScalar plAnimPath::ISubDivFore(hsPoint3 &pt) const return ICheckInterval(pt); } -hsScalar plAnimPath::IShiftBack(hsPoint3 &pt) const +float plAnimPath::IShiftBack(hsPoint3 &pt) const { if( !GetWrap() && (fLastTime <= 0) ) return ISubDivBack(pt); @@ -470,7 +476,7 @@ hsScalar plAnimPath::IShiftBack(hsPoint3 &pt) const return ICheckInterval(pt); } -hsScalar plAnimPath::IShiftFore(hsPoint3 &pt) const +float plAnimPath::IShiftFore(hsPoint3 &pt) const { if( !GetWrap() &&(fNextTime >= fLength) ) return ISubDivFore(pt); @@ -502,17 +508,17 @@ hsScalar plAnimPath::IShiftFore(hsPoint3 &pt) const // doesn't use any fancy subdivision or curvature measure when drawing. // Changes current time. // -void plAnimPath::IMakeSegment(hsTArray& idx, hsTArray& pos, +void plAnimPath::IMakeSegment(hsTArray& idx, hsTArray& pos, hsPoint3& p1, hsPoint3& p2) { hsVector3 del(&p2, &p1); hsVector3 up; up.Set(0,0,1.f); - const hsScalar kOutLength = 0.25f; + const float kOutLength = 0.25f; hsVector3 a = del % up; - hsScalar magSq = a.MagnitudeSquared(); + float magSq = a.MagnitudeSquared(); if( magSq < 1.e-3f ) { a.Set(kOutLength, 0, 0); @@ -576,7 +582,7 @@ void plAnimPath::IMakeSegment(hsTArray& idx, hsTArray& pos, } } -void plAnimPath::MakeDrawList(hsTArray& idx, hsTArray& pos) +void plAnimPath::MakeDrawList(hsTArray& idx, hsTArray& pos) { hsMatrix44 resetL2W = GetLocalToWorld(); hsMatrix44 resetW2L = GetWorldToLocal(); @@ -585,12 +591,12 @@ void plAnimPath::MakeDrawList(hsTArray& idx, hsTArray& pos) ident.Reset(); SetTransform(ident, ident); - hsScalar numSegs = fRadius; // crude estimate of arclength + float numSegs = fRadius; // crude estimate of arclength if (numSegs>100) numSegs=100; - hsScalar animLen = GetLength(); - hsScalar timeInc = animLen/numSegs; - hsScalar time=0; + float animLen = GetLength(); + float timeInc = animLen/numSegs; + float time=0; hsPoint3 p1, p2; SetCurTime(0, kCalcPosOnly); @@ -623,7 +629,7 @@ void plAnimPath::MakeDrawList(hsTArray& idx, hsTArray& pos) // Precompute array of arclen deltas for lookahead ability. // Changes current time! // -void plAnimPath::ComputeArcLenDeltas(Int32 numSamples) +void plAnimPath::ComputeArcLenDeltas(int32_t numSamples) { if (fArcLenDeltas.GetCount() >= numSamples) return; // already computed enough samples @@ -631,12 +637,12 @@ void plAnimPath::ComputeArcLenDeltas(Int32 numSamples) // compute arc len deltas fArcLenDeltas.Reset(); fArcLenDeltas.SetCount(numSamples); - hsScalar animLen = GetLength(); - hsScalar timeInc = animLen/(numSamples-1); // use num-1 since we'll create the zeroth entry by hand - hsScalar time=0; + float animLen = GetLength(); + float timeInc = animLen/(numSamples-1); // use num-1 since we'll create the zeroth entry by hand + float time=0; hsPoint3 p1, p2; - Int32 cnt=0; + int32_t cnt=0; // prime initial point SetCurTime(0, kCalcPosOnly); @@ -671,8 +677,8 @@ void plAnimPath::ComputeArcLenDeltas(Int32 numSamples) // Returns time of point (at least) arcLength units away from point at startTime. // Also sets strtSrchIdx for incremental searching. // -hsScalar plAnimPath::GetLookAheadTime(hsScalar startTime, hsScalar arcLengthIn, hsBool bwd, - Int32* startSrchIdx) +float plAnimPath::GetLookAheadTime(float startTime, float arcLengthIn, hsBool bwd, + int32_t* startSrchIdx) { if (arcLengthIn==0) return startTime; // default is no look ahead @@ -685,7 +691,7 @@ hsScalar plAnimPath::GetLookAheadTime(hsScalar startTime, hsScalar arcLengthIn, hsAssert(startSrchIdx, "nil var for startSrchIdx"); - hsScalar oldTime=fTime; + float oldTime=fTime; ComputeArcLenDeltas(); // precompute first time only @@ -695,7 +701,7 @@ hsScalar plAnimPath::GetLookAheadTime(hsScalar startTime, hsScalar arcLengthIn, // find nearest (forward) arcLen sample point, use starting srch index provided hsBool found=false; - Int32 i; + int32_t i; for(i=(*startSrchIdx); i=0 && percent<=1, "illegal percent value"); // 3. compute interpolated time value using percent diff --git a/Sources/Plasma/PubUtilLib/plInterp/plAnimPath.h b/Sources/Plasma/PubUtilLib/plInterp/plAnimPath.h index 1db15db9..df5b8034 100644 --- a/Sources/Plasma/PubUtilLib/plInterp/plAnimPath.h +++ b/Sources/Plasma/PubUtilLib/plInterp/plAnimPath.h @@ -70,12 +70,12 @@ protected: hsPoint3 fPos; hsVector3 fVel; hsVector3 fAccel; - hsScalar fTime; // presumably seconds + float fTime; // presumably seconds // The paramters (and options) for this curve. - UInt32 fAnimPathFlags; // currently set at runtime only - hsScalar fMinDistSq; - hsScalar fLength; // presumably seconds + uint32_t fAnimPathFlags; // currently set at runtime only + float fMinDistSq; + float fLength; // presumably seconds // Controller stuff only works in local space. hsMatrix44 fLocalToWorld; @@ -83,31 +83,31 @@ protected: // Bounding sphere available for ignoring out of range hsPoint3 fCenter; - hsScalar fRadius; + float fRadius; plCompoundController* fController; hsAffineParts fParts; // These are temps during a search. They're here to avoid recalc. - mutable hsScalar fLastTime; - mutable hsScalar fLastDistSq; - mutable hsScalar fThisTime; - mutable hsScalar fThisDistSq; - mutable hsScalar fNextTime; - mutable hsScalar fNextDistSq; - mutable hsScalar fDelTime; + mutable float fLastTime; + mutable float fLastDistSq; + mutable float fThisTime; + mutable float fThisDistSq; + mutable float fNextTime; + mutable float fNextDistSq; + mutable float fDelTime; mutable hsPoint3 fPrevPos, fCurPos; void ICalcBounds(); - hsScalar ICalcTotalLength(); - hsScalar IShiftFore(hsPoint3 &pt) const; - hsScalar IShiftBack(hsPoint3 &pt) const; - hsScalar ISubDivFore(hsPoint3 &pt) const; - hsScalar ISubDivBack(hsPoint3 &pt) const; - void IInitInterval(hsScalar time, hsScalar delTime, hsPoint3 &pt) const; - hsScalar ICheckInterval(hsPoint3 &pt) const; - hsScalar IBestTime() const { return fLastDistSq < fThisDistSq + float ICalcTotalLength(); + float IShiftFore(hsPoint3 &pt) const; + float IShiftBack(hsPoint3 &pt) const; + float ISubDivFore(hsPoint3 &pt) const; + float ISubDivBack(hsPoint3 &pt) const; + void IInitInterval(float time, float delTime, hsPoint3 &pt) const; + float ICheckInterval(hsPoint3 &pt) const; + float IBestTime() const { return fLastDistSq < fThisDistSq ? (fLastDistSq < fNextDistSq ? fLastTime : fNextTime) @@ -116,15 +116,15 @@ protected: : fNextTime); } // Visualization helper - void IMakeSegment(hsTArray& idx, hsTArray& pos, + void IMakeSegment(hsTArray& idx, hsTArray& pos, hsPoint3& p1, hsPoint3& p2); // For computing arclen struct ArcLenDeltaInfo { - hsScalar fT; - hsScalar fArcLenDelta; // arc len distance from prev sample point (array entry) - ArcLenDeltaInfo(hsScalar t, hsScalar del) : fT(t),fArcLenDelta(del) {} + float fT; + float fArcLenDelta; // arc len distance from prev sample point (array entry) + ArcLenDeltaInfo(float t, float del) : fT(t),fArcLenDelta(del) {} ArcLenDeltaInfo() : fT(0),fArcLenDelta(0) {} }; hsTArray fArcLenDeltas; @@ -142,10 +142,10 @@ public: const hsMatrix44& GetWorldToLocal() const { return fWorldToLocal; } // Visualization helper - void MakeDrawList(hsTArray& idx, hsTArray& pos); + void MakeDrawList(hsTArray& idx, hsTArray& pos); - void SetAnimPathFlags(UInt32 f) { fAnimPathFlags=f; } - UInt32 GetAnimPathFlags() const { return fAnimPathFlags; } + void SetAnimPathFlags(uint32_t f) { fAnimPathFlags=f; } + uint32_t GetAnimPathFlags() const { return fAnimPathFlags; } void SetWrap(hsBool on) { if(on)fAnimPathFlags |= kWrap; else fAnimPathFlags &= ~kWrap; } hsBool GetWrap() const { return 0 != (fAnimPathFlags & kWrap); } @@ -153,15 +153,15 @@ public: void SetFarthest(hsBool on) { if(on)fAnimPathFlags |= kFarthest; else fAnimPathFlags &= ~kFarthest; } hsBool GetFarthest() const { return 0 != (fAnimPathFlags & kFarthest); } - void SetCurTime(hsScalar t, UInt32 calcFlags=0); - hsScalar GetCurTime() const { return fTime; } + void SetCurTime(float t, uint32_t calcFlags=0); + float GetCurTime() const { return fTime; } void SetController(plCompoundController* tmc); plCompoundController* GetController() const { return fController; } - hsScalar GetLength() const { return fLength; } // seconds + float GetLength() const { return fLength; } // seconds - void SetMinDistance(hsScalar d) { fMinDistSq = d*d; } - hsScalar GetMinDistance() const { return hsSquareRoot(fMinDistSq); } + void SetMinDistance(float d) { fMinDistSq = d*d; } + float GetMinDistance() const; hsMatrix44* GetMatrix44(hsMatrix44* xOut) const { *xOut = fXform; return xOut; } hsPoint3* GetPosition(hsPoint3* pOut) const { *pOut = fPos; return pOut; } @@ -170,16 +170,16 @@ public: hsVector3* GetUp(hsVector3* uOut) const { uOut->Set(fXform.fMap[0][1], fXform.fMap[1][1], fXform.fMap[2][1]); return uOut; } hsVector3* GetAcceleration(hsVector3* aOut) const { *aOut = fAccel; return aOut; } - hsBool OutOfRange(hsPoint3 &pt, hsScalar range) const; + hsBool OutOfRange(hsPoint3 &pt, float range) const; const hsAffineParts* Parts() const { return &fParts; } void InitParts(const hsAffineParts& p) { fParts = p; } - hsScalar GetExtremePoint(hsPoint3 &worldPt) const; // Exhaustive search - hsScalar GetExtremePoint(hsScalar lastTime, hsScalar delTime, hsPoint3 &worldPt) const; // Incremental search + float GetExtremePoint(hsPoint3 &worldPt) const; // Exhaustive search + float GetExtremePoint(float lastTime, float delTime, hsPoint3 &worldPt) const; // Incremental search // for arclen usage - void ComputeArcLenDeltas(Int32 numSamples=256); - hsScalar GetLookAheadTime(hsScalar startTime, hsScalar arcLength, hsBool bwd, Int32* startSrchIdx); + void ComputeArcLenDeltas(int32_t numSamples=256); + float GetLookAheadTime(float startTime, float arcLength, hsBool bwd, int32_t* startSrchIdx); virtual void Read(hsStream* s, hsResMgr* mgr); virtual void Write(hsStream* s, hsResMgr* mgr); diff --git a/Sources/Plasma/PubUtilLib/plInterp/plAnimTimeConvert.cpp b/Sources/Plasma/PubUtilLib/plInterp/plAnimTimeConvert.cpp index 9c0281ee..ccf20b3b 100644 --- a/Sources/Plasma/PubUtilLib/plInterp/plAnimTimeConvert.cpp +++ b/Sources/Plasma/PubUtilLib/plInterp/plAnimTimeConvert.cpp @@ -39,7 +39,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com Mead, WA 99021 *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "plAnimEaseTypes.h" #include "plAnimTimeConvert.h" #include "plAvatar/plAGAnim.h" @@ -97,15 +97,15 @@ void plAnimTimeConvert::Init(plATCAnim *anim, plAGAnimInstance *instance, plAGMa { // Set up our eval callbacks plAGInstanceCallbackMsg *instMsg; - instMsg = TRACKED_NEW plAGInstanceCallbackMsg(master->GetKey(), kStart); + instMsg = new plAGInstanceCallbackMsg(master->GetKey(), kStart); instMsg->fInstance = instance; AddCallback(instMsg); hsRefCnt_SafeUnRef(instMsg); - instMsg = TRACKED_NEW plAGInstanceCallbackMsg(master->GetKey(), kStop); + instMsg = new plAGInstanceCallbackMsg(master->GetKey(), kStop); instMsg->fInstance = instance; AddCallback(instMsg); hsRefCnt_SafeUnRef(instMsg); - instMsg = TRACKED_NEW plAGInstanceCallbackMsg(master->GetKey(), kSingleFrameAdjust); + instMsg = new plAGInstanceCallbackMsg(master->GetKey(), kSingleFrameAdjust); instMsg->fInstance = instance; AddCallback(instMsg); hsRefCnt_SafeUnRef(instMsg); @@ -197,7 +197,7 @@ void plAnimTimeConvert::ResizeStates(int cnt) while (cnt>fStates.size()) { - fStates.push_back(TRACKED_NEW plATCState); + fStates.push_back(new plATCState); } hsAssert(fStates.size()==cnt, "state resize mismatch"); @@ -212,7 +212,7 @@ void plAnimTimeConvert::ResetWrap() fFlags &= (~kWrap & ~kNeedsReset); } -hsScalar plAnimTimeConvert::ICalcEaseTime(const plATCEaseCurve *curve, double start, double end) +float plAnimTimeConvert::ICalcEaseTime(const plATCEaseCurve *curve, double start, double end) { start -= curve->fBeginWorldTime; end -= curve->fBeginWorldTime; @@ -224,12 +224,12 @@ hsScalar plAnimTimeConvert::ICalcEaseTime(const plATCEaseCurve *curve, double st end = curve->fLength; - hsScalar delSecs = 0; + float delSecs = 0; if (start < curve->fLength) { // Redundant eval... but only when easing. - delSecs = curve->PositionGivenTime((hsScalar)end) - curve->PositionGivenTime((hsScalar)start); + delSecs = curve->PositionGivenTime((float)end) - curve->PositionGivenTime((float)start); } return delSecs; } @@ -244,7 +244,7 @@ void plAnimTimeConvert::IClearSpeedEase() fSpeedEaseCurve = nil; } -void plAnimTimeConvert::ICheckTimeCallbacks(hsScalar frameStart, hsScalar frameStop) +void plAnimTimeConvert::ICheckTimeCallbacks(float frameStart, float frameStop) { int i; for( i = fCallbackMsgs.GetCount()-1; i >= 0; --i ) @@ -262,7 +262,7 @@ void plAnimTimeConvert::ICheckTimeCallbacks(hsScalar frameStart, hsScalar frameS } } -hsBool plAnimTimeConvert::ITimeInFrame(hsScalar secs, hsScalar start, hsScalar stop) +hsBool plAnimTimeConvert::ITimeInFrame(float secs, float start, float stop) { if (secs == start && secs == stop) return true; @@ -328,7 +328,7 @@ void plAnimTimeConvert::ISendCallback(int i) } } -plAnimTimeConvert& plAnimTimeConvert::IStop(double time, hsScalar animTime) +plAnimTimeConvert& plAnimTimeConvert::IStop(double time, float animTime) { if( IsStopped() ) return *this; @@ -352,17 +352,17 @@ plAnimTimeConvert& plAnimTimeConvert::IStop(double time, hsScalar animTime) return *this; } -plAnimTimeConvert& plAnimTimeConvert::IProcessStateChange(double worldTime, hsScalar animTime /* = -1 */) +plAnimTimeConvert& plAnimTimeConvert::IProcessStateChange(double worldTime, float animTime /* = -1 */) { if (fStates.size() > 0 && worldTime < fStates.front()->fStartWorldTime) return *this; // Sorry... state saves only work in the forward direction fLastStateChange = worldTime; - plATCState *state = TRACKED_NEW plATCState; + plATCState *state = new plATCState; state->fStartWorldTime = fLastStateChange; state->fStartAnimTime = (animTime < 0 ? WorldToAnimTimeNoUpdate(fLastStateChange) : animTime); - state->fFlags = (UInt8)fFlags; + state->fFlags = (uint8_t)fFlags; state->fBegin = fBegin; state->fEnd = fEnd; state->fLoopBegin = fLoopBegin; @@ -395,7 +395,7 @@ void plAnimTimeConvert::IFlushOldStates() { plATCState *state; plATCStateList::const_iterator i = fStates.begin(); - UInt32 count = 0; + uint32_t count = 0; for (; i != fStates.end(); i++) { @@ -446,7 +446,7 @@ void plAnimTimeConvert::SetOwner(plSynchedObject* o) fOwner = o; } -hsBool plAnimTimeConvert::IIsStoppedAt(const double &wSecs, const UInt32 &flags, +hsBool plAnimTimeConvert::IIsStoppedAt(const double &wSecs, const uint32_t &flags, const plATCEaseCurve *curve) const { if (flags & kStopped) @@ -468,11 +468,11 @@ hsBool plAnimTimeConvert::IsStoppedAt(double wSecs) const return IIsStoppedAt(wSecs, state->fFlags, state->fEaseCurve); } -hsScalar plAnimTimeConvert::WorldToAnimTime(double wSecs) +float plAnimTimeConvert::WorldToAnimTime(double wSecs) { //hsAssert(wSecs >= fLastEvalWorldTime, "Tried to eval a time that's earlier than the last eval time."); double d = wSecs - fLastEvalWorldTime; - hsScalar f = fCurrentAnimTime; + float f = fCurrentAnimTime; if (wSecs < fLastStateChange) { @@ -505,8 +505,8 @@ hsScalar plAnimTimeConvert::WorldToAnimTime(double wSecs) return fCurrentAnimTime; } - hsScalar note = fCurrentAnimTime - f; - hsScalar secs = 0, delSecs = 0; + float note = fCurrentAnimTime - f; + float secs = 0, delSecs = 0; if (fCurrentEaseCurve != nil) { @@ -514,7 +514,7 @@ hsScalar plAnimTimeConvert::WorldToAnimTime(double wSecs) if (wSecs > fCurrentEaseCurve->GetEndWorldTime()) { if (fFlags & kEasingIn) - delSecs += hsScalar(wSecs - fCurrentEaseCurve->GetEndWorldTime()) * fSpeed; + delSecs += float(wSecs - fCurrentEaseCurve->GetEndWorldTime()) * fSpeed; IClearSpeedEase(); @@ -524,7 +524,7 @@ hsScalar plAnimTimeConvert::WorldToAnimTime(double wSecs) else { // The easy case... playing the animation at a constant speed. - delSecs = hsScalar(wSecs - fLastEvalWorldTime) * fSpeed; + delSecs = float(wSecs - fLastEvalWorldTime) * fSpeed; } if (fFlags & kBackwards) @@ -617,12 +617,12 @@ hsScalar plAnimTimeConvert::WorldToAnimTime(double wSecs) return fCurrentAnimTime = secs; } -hsScalar plAnimTimeConvert::WorldToAnimTimeNoUpdate(double wSecs) const +float plAnimTimeConvert::WorldToAnimTimeNoUpdate(double wSecs) const { return IWorldToAnimTimeNoUpdate(wSecs, IGetState(wSecs)); } -hsScalar plAnimTimeConvert::IWorldToAnimTimeNoUpdate(double wSecs, plATCState *state) +float plAnimTimeConvert::IWorldToAnimTimeNoUpdate(double wSecs, plATCState *state) { //hsAssert(wSecs >= fLastEvalWorldTime, "Tried to eval a time that's earlier than the last eval time."); if (state == nil) @@ -631,7 +631,7 @@ hsScalar plAnimTimeConvert::IWorldToAnimTimeNoUpdate(double wSecs, plATCState *s if (state->fFlags & kStopped) return state->fStartAnimTime; - hsScalar secs = 0, delSecs = 0; + float secs = 0, delSecs = 0; if (state->fEaseCurve != nil) { @@ -639,13 +639,13 @@ hsScalar plAnimTimeConvert::IWorldToAnimTimeNoUpdate(double wSecs, plATCState *s if (wSecs > state->fEaseCurve->GetEndWorldTime()) { if (state->fFlags & kEasingIn) - delSecs += hsScalar(wSecs - state->fEaseCurve->GetEndWorldTime()) * state->fSpeed; + delSecs += float(wSecs - state->fEaseCurve->GetEndWorldTime()) * state->fSpeed; } } else { // The easy case... playing the animation at a constant speed. - delSecs = hsScalar(wSecs - state->fStartWorldTime) * state->fSpeed; + delSecs = float(wSecs - state->fStartWorldTime) * state->fSpeed; } if (state->fFlags & kBackwards) @@ -720,12 +720,12 @@ hsScalar plAnimTimeConvert::IWorldToAnimTimeNoUpdate(double wSecs, plATCState *s return secs; } -hsScalar plAnimTimeConvert::IWorldToAnimTimeBeforeState(double wSecs) const +float plAnimTimeConvert::IWorldToAnimTimeBeforeState(double wSecs) const { return IWorldToAnimTimeNoUpdate(wSecs, IGetState(wSecs)); } -void plAnimTimeConvert::SetCurrentAnimTime(hsScalar s, hsBool jump /* = false */) +void plAnimTimeConvert::SetCurrentAnimTime(float s, hsBool jump /* = false */) { // We're setting the anim value for whenever we last evaluated. fFlags |= kForcedMove; @@ -743,7 +743,7 @@ void plAnimTimeConvert::SetCurrentAnimTime(hsScalar s, hsBool jump /* = false */ IProcessStateChange(hsTimer::GetSysSeconds(), fCurrentAnimTime); } -void plAnimTimeConvert::SetEase(hsBool easeIn, UInt8 type, hsScalar minLength, hsScalar maxLength, hsScalar normLength) +void plAnimTimeConvert::SetEase(hsBool easeIn, uint8_t type, float minLength, float maxLength, float normLength) { if (easeIn) { @@ -759,24 +759,24 @@ void plAnimTimeConvert::SetEase(hsBool easeIn, UInt8 type, hsScalar minLength, h -hsScalar plAnimTimeConvert::GetBestStopDist(hsScalar min, hsScalar max, hsScalar norm, hsScalar time) const +float plAnimTimeConvert::GetBestStopDist(float min, float max, float norm, float time) const { - hsScalar bestTime = -1; - hsScalar bestDist = -1; + float bestTime = -1; + float bestDist = -1; if (fStopPoints.GetCount() == 0) return norm; - hsScalar curTime; - hsScalar curDist; + float curTime; + float curDist; int i; for (i = 0; i < fStopPoints.GetCount(); i++) { - hsScalar stop = fStopPoints.Get(i); + float stop = fStopPoints.Get(i); if (IsLooped()) { - hsScalar loopDist; + float loopDist; if (IsBackwards()) { if ((time >= fLoopBegin && stop < fLoopBegin) || @@ -841,9 +841,9 @@ hsScalar plAnimTimeConvert::GetBestStopDist(hsScalar min, hsScalar max, hsScalar } // Passing in a rate of zero specifies an immediate change. -void plAnimTimeConvert::SetSpeed(hsScalar goal, hsScalar rate /* = 0 */) +void plAnimTimeConvert::SetSpeed(float goal, float rate /* = 0 */) { - hsScalar curSpeed = fSpeed; + float curSpeed = fSpeed; fSpeed = goal; @@ -860,7 +860,7 @@ void plAnimTimeConvert::SetSpeed(hsScalar goal, hsScalar rate /* = 0 */) if (fCurrentEaseCurve != nil) { double easeTime = curTime - fCurrentEaseCurve->fBeginWorldTime; - curSpeed = fCurrentEaseCurve->VelocityGivenTime((hsScalar)easeTime); + curSpeed = fCurrentEaseCurve->VelocityGivenTime((float)easeTime); } if (fSpeedEaseCurve != nil) { @@ -869,7 +869,7 @@ void plAnimTimeConvert::SetSpeed(hsScalar goal, hsScalar rate /* = 0 */) } else { - hsScalar length; + float length; length = (goal - curSpeed) / rate; if (length < 0) length = -length; @@ -889,7 +889,7 @@ void plAnimTimeConvert::Read(hsStream* s, hsResMgr* mgr) { plCreatable::Read(s, mgr); - fFlags = (UInt16)(s->ReadLE32()); + fFlags = (uint16_t)(s->ReadLE32()); fBegin = fInitialBegin = s->ReadLEScalar(); fEnd = fInitialEnd = s->ReadLEScalar(); @@ -975,7 +975,7 @@ plAnimTimeConvert& plAnimTimeConvert::Stop(double stopTime) if (stopTime < 0) stopTime = hsTimer::GetSysSeconds(); - hsScalar stopAnimTime = WorldToAnimTimeNoUpdate(stopTime); + float stopAnimTime = WorldToAnimTimeNoUpdate(stopTime); SetFlag(kEasingIn, false); @@ -984,11 +984,11 @@ plAnimTimeConvert& plAnimTimeConvert::Stop(double stopTime) return IStop(stopTime, fCurrentAnimTime); } - hsScalar currSpeed; + float currSpeed; if (fCurrentEaseCurve == nil || stopTime >= fCurrentEaseCurve->GetEndWorldTime()) currSpeed = fSpeed; else - currSpeed = fCurrentEaseCurve->VelocityGivenTime((hsScalar)(stopTime - fCurrentEaseCurve->fBeginWorldTime)); + currSpeed = fCurrentEaseCurve->VelocityGivenTime((float)(stopTime - fCurrentEaseCurve->fBeginWorldTime)); fEaseOutCurve->RecalcToSpeed(currSpeed > fSpeed ? currSpeed : fSpeed, 0); fEaseOutCurve->SetLengthOnDistance(GetBestStopDist(fEaseOutCurve->GetMinDistance(), fEaseOutCurve->GetMaxDistance(), @@ -1013,11 +1013,11 @@ plAnimTimeConvert& plAnimTimeConvert::Start(double startTime) if (fEaseInCurve != nil) { - hsScalar currSpeed; + float currSpeed; if (fCurrentEaseCurve == nil || startTime >= fCurrentEaseCurve->GetEndWorldTime()) currSpeed = 0; else - currSpeed = fCurrentEaseCurve->VelocityGivenTime((hsScalar)(startTime - fCurrentEaseCurve->fBeginWorldTime)); + currSpeed = fCurrentEaseCurve->VelocityGivenTime((float)(startTime - fCurrentEaseCurve->fBeginWorldTime)); if (currSpeed <= fSpeed) { @@ -1119,7 +1119,7 @@ plAnimTimeConvert& plAnimTimeConvert::Loop(hsBool on) return *this; } -plAnimTimeConvert& plAnimTimeConvert::PlayToTime(hsScalar time) +plAnimTimeConvert& plAnimTimeConvert::PlayToTime(float time) { fFlags |= kNeedsReset; if (fCurrentAnimTime > time) @@ -1144,7 +1144,7 @@ plAnimTimeConvert& plAnimTimeConvert::PlayToTime(hsScalar time) return *this; } -plAnimTimeConvert& plAnimTimeConvert::PlayToPercentage(hsScalar percent) +plAnimTimeConvert& plAnimTimeConvert::PlayToPercentage(float percent) { return PlayToTime(fBegin + (fEnd - fBegin) * percent); } @@ -1280,7 +1280,7 @@ hsBool plAnimTimeConvert::HandleCmd(plAnimCmdMsg* modMsg) if (fCurrentAnimTime == fEnd) return true; double currTime = hsTimer::GetSysSeconds(); - hsScalar newTime = fCurrentAnimTime + hsTimer::GetDelSysSeconds(); + float newTime = fCurrentAnimTime + hsTimer::GetDelSysSeconds(); if (newTime > fEnd) { newTime = fEnd; @@ -1293,7 +1293,7 @@ hsBool plAnimTimeConvert::HandleCmd(plAnimCmdMsg* modMsg) if (fCurrentAnimTime == fBegin) return true; double currTime = hsTimer::GetSysSeconds(); - hsScalar newTime = fCurrentAnimTime - hsTimer::GetDelSysSeconds(); + float newTime = fCurrentAnimTime - hsTimer::GetDelSysSeconds(); if (newTime < fBegin) { newTime = fBegin; @@ -1350,7 +1350,7 @@ void plATCState::Read(hsStream *s, hsResMgr *mgr) fStartWorldTime = s->ReadLEDouble(); fStartAnimTime = s->ReadLEScalar(); - fFlags = (UInt8)(s->ReadLE32()); + fFlags = (uint8_t)(s->ReadLE32()); fEnd = s->ReadLEScalar(); fLoopBegin = s->ReadLEScalar(); fLoopEnd = s->ReadLEScalar(); diff --git a/Sources/Plasma/PubUtilLib/plInterp/plAnimTimeConvert.h b/Sources/Plasma/PubUtilLib/plInterp/plAnimTimeConvert.h index 93775eab..739aa594 100644 --- a/Sources/Plasma/PubUtilLib/plInterp/plAnimTimeConvert.h +++ b/Sources/Plasma/PubUtilLib/plInterp/plAnimTimeConvert.h @@ -63,14 +63,14 @@ class plAnimTimeConvert : public plCreatable friend class plAGAnimInstance; protected: - UInt16 fFlags; - hsScalar fBegin; - hsScalar fEnd; - hsScalar fLoopEnd; - hsScalar fLoopBegin; - hsScalar fSpeed; - hsScalar fCurrentAnimTime; - hsScalar fWrapTime; + uint16_t fFlags; + float fBegin; + float fEnd; + float fLoopEnd; + float fLoopBegin; + float fSpeed; + float fCurrentAnimTime; + float fWrapTime; double fLastEvalWorldTime; // Do not change fLastEvalWorldTime anywhere except WorldToAnimTime() @@ -80,7 +80,7 @@ protected: typedef std::list plATCStateList; plATCStateList fStates; - hsTArray fStopPoints; + hsTArray fStopPoints; hsTArray fCallbackMsgs; ///////////////////////// @@ -94,25 +94,25 @@ protected: // ///////////////////////// - hsScalar fInitialBegin; - hsScalar fInitialEnd; + float fInitialBegin; + float fInitialEnd; - static hsScalar ICalcEaseTime(const plATCEaseCurve *curve, double start, double end); + static float ICalcEaseTime(const plATCEaseCurve *curve, double start, double end); void IClearSpeedEase(); - void ICheckTimeCallbacks(hsScalar frameStart, hsScalar frameStop); - hsBool ITimeInFrame(hsScalar secs, hsScalar start, hsScalar stop); + void ICheckTimeCallbacks(float frameStart, float frameStop); + hsBool ITimeInFrame(float secs, float start, float stop); void ISendCallback(int i); - plAnimTimeConvert& IStop(double time, hsScalar animTime); - hsBool IIsStoppedAt(const double &wSecs, const UInt32 &flags, const plATCEaseCurve *curve) const; - plAnimTimeConvert& IProcessStateChange(double worldTime, hsScalar animTime = -1); + plAnimTimeConvert& IStop(double time, float animTime); + hsBool IIsStoppedAt(const double &wSecs, const uint32_t &flags, const plATCEaseCurve *curve) const; + plAnimTimeConvert& IProcessStateChange(double worldTime, float animTime = -1); void IFlushOldStates(); void IClearAllStates(); plATCState *IGetState(double wSecs) const; plATCState *IGetLatestState() const; - plAnimTimeConvert& SetFlag(UInt8 f, hsBool on) { if(on)fFlags |= f; else fFlags &= ~f; return *this; } + plAnimTimeConvert& SetFlag(uint8_t f, hsBool on) { if(on)fFlags |= f; else fFlags &= ~f; return *this; } public: plAnimTimeConvert(); @@ -128,44 +128,44 @@ public: // ALL WorldToAnimTime functions are only valid if called with a time >= fLastEvalWorldTime. hsBool IsStoppedAt(double wSecs) const; - hsScalar WorldToAnimTime(double wSecs); - hsScalar WorldToAnimTimeNoUpdate(double wSecs) const; // convert time but don't fire triggers or set state + float WorldToAnimTime(double wSecs); + float WorldToAnimTimeNoUpdate(double wSecs) const; // convert time but don't fire triggers or set state protected: - static hsScalar IWorldToAnimTimeNoUpdate(double wSecs, plATCState *state); - hsScalar IWorldToAnimTimeBeforeState(double wSecs) const; + static float IWorldToAnimTimeNoUpdate(double wSecs, plATCState *state); + float IWorldToAnimTimeBeforeState(double wSecs) const; public: - void SetBegin(hsScalar s) { fBegin = s; } - void SetEnd(hsScalar s) { fEnd = s; } - void SetSpeed(hsScalar goal, hsScalar rate = 0); - void SetLoopPoints(hsScalar begin, hsScalar end) { SetLoopBegin(begin); SetLoopEnd(end); } - void SetLoopBegin(hsScalar s) { fLoopBegin = s; } - void SetLoopEnd(hsScalar s) { fLoopEnd = s; } - void SetEase(hsBool easeIn, UInt8 inType, hsScalar minLength, hsScalar maxLength, hsScalar inLength); + void SetBegin(float s) { fBegin = s; } + void SetEnd(float s) { fEnd = s; } + void SetSpeed(float goal, float rate = 0); + void SetLoopPoints(float begin, float end) { SetLoopBegin(begin); SetLoopEnd(end); } + void SetLoopBegin(float s) { fLoopBegin = s; } + void SetLoopEnd(float s) { fLoopEnd = s; } + void SetEase(hsBool easeIn, uint8_t inType, float minLength, float maxLength, float inLength); void SetCurrentEaseCurve(int x); // 0=nil, 1=easeIn, 2=easeOut, 3=speed - hsScalar GetBegin() const { return fBegin; } - hsScalar GetEnd() const { return fEnd; } - hsScalar GetLoopBegin() const { return fLoopBegin; } - hsScalar GetLoopEnd() const { return fLoopEnd; } - hsScalar GetSpeed() const { return fSpeed; } - hsTArray &GetStopPoints() { return fStopPoints; } - hsScalar GetBestStopDist(hsScalar min, hsScalar max, hsScalar norm, hsScalar time) const; + float GetBegin() const { return fBegin; } + float GetEnd() const { return fEnd; } + float GetLoopBegin() const { return fLoopBegin; } + float GetLoopEnd() const { return fLoopEnd; } + float GetSpeed() const { return fSpeed; } + hsTArray &GetStopPoints() { return fStopPoints; } + float GetBestStopDist(float min, float max, float norm, float time) const; int GetCurrentEaseCurve() const; // returns 0=nil, 1=easeIn, 2=easeOut, 3=speed void ResizeStates(int cnt); void ResetWrap(); plAnimTimeConvert& ClearFlags() { fFlags = kNone; return *this; } - hsBool GetFlag(UInt8 f) const { return (fFlags & f) ? true : false; } + hsBool GetFlag(uint8_t f) const { return (fFlags & f) ? true : false; } plAnimTimeConvert& InitStop(); // Called when initializing an anim that doesn't autostart plAnimTimeConvert& Stop(hsBool on); plAnimTimeConvert& Stop(double s = -1.0); plAnimTimeConvert& Start(double s = -1.0); - plAnimTimeConvert& PlayToTime(hsScalar time); - plAnimTimeConvert& PlayToPercentage(hsScalar percent); // zero to one. + plAnimTimeConvert& PlayToTime(float time); + plAnimTimeConvert& PlayToPercentage(float percent); // zero to one. plAnimTimeConvert& Loop(hsBool on); plAnimTimeConvert& Loop() { return Loop(true); } @@ -181,8 +181,8 @@ public: hsBool IsForewards() const { return !(fFlags & kBackwards); } double LastEvalWorldTime() const { return fLastEvalWorldTime; } - hsScalar CurrentAnimTime() const { return fCurrentAnimTime; } - void SetCurrentAnimTime(hsScalar s, hsBool jump = false); + float CurrentAnimTime() const { return fCurrentAnimTime; } + void SetCurrentAnimTime(float s, hsBool jump = false); virtual void Read(hsStream* s, hsResMgr* mgr); virtual void Write(hsStream* s, hsResMgr* mgr); @@ -224,21 +224,21 @@ public: class plATCEaseCurve : public plCreatable { protected: - hsScalar fStartSpeed; - hsScalar fMinLength; - hsScalar fMaxLength; - hsScalar fNormLength; + float fStartSpeed; + float fMinLength; + float fMaxLength; + float fNormLength; public: CLASSNAME_REGISTER( plATCEaseCurve ); GETINTERFACE_ANY( plATCEaseCurve, plCreatable ); double fBeginWorldTime; - hsScalar fLength; - hsScalar fSpeed; // The anim's target ("full") speed. + float fLength; + float fSpeed; // The anim's target ("full") speed. - static plATCEaseCurve *CreateEaseCurve(UInt8 type, hsScalar minLength, hsScalar maxLength, hsScalar normLength, - hsScalar startSpeed, hsScalar goalSpeed); + static plATCEaseCurve *CreateEaseCurve(uint8_t type, float minLength, float maxLength, float normLength, + float startSpeed, float goalSpeed); double GetEndWorldTime() const { return fBeginWorldTime + fLength; } @@ -246,40 +246,40 @@ public: virtual void Read(hsStream *s, hsResMgr *mgr); virtual void Write(hsStream *s, hsResMgr *mgr); - virtual void RecalcToSpeed(hsScalar startSpeed, hsScalar goalSpeed, hsBool preserveRate = false); - virtual void SetLengthOnRate(hsScalar rate); - virtual void SetLengthOnDistance(hsScalar dist) = 0; - virtual hsScalar PositionGivenTime(hsScalar time) const = 0; - virtual hsScalar VelocityGivenTime(hsScalar time) const = 0; - virtual hsScalar TimeGivenVelocity(hsScalar velocity) const = 0; - virtual hsScalar GetMinDistance(); - virtual hsScalar GetMaxDistance(); - virtual hsScalar GetNormDistance(); + virtual void RecalcToSpeed(float startSpeed, float goalSpeed, hsBool preserveRate = false); + virtual void SetLengthOnRate(float rate); + virtual void SetLengthOnDistance(float dist) = 0; + virtual float PositionGivenTime(float time) const = 0; + virtual float VelocityGivenTime(float time) const = 0; + virtual float TimeGivenVelocity(float velocity) const = 0; + virtual float GetMinDistance(); + virtual float GetMaxDistance(); + virtual float GetNormDistance(); }; class plConstAccelEaseCurve : public plATCEaseCurve { public: plConstAccelEaseCurve(); - plConstAccelEaseCurve(hsScalar minLength, hsScalar maxLength, hsScalar length, - hsScalar startSpeed, hsScalar goalSpeed); + plConstAccelEaseCurve(float minLength, float maxLength, float length, + float startSpeed, float goalSpeed); CLASSNAME_REGISTER( plConstAccelEaseCurve ); GETINTERFACE_ANY( plConstAccelEaseCurve, plATCEaseCurve ); virtual plATCEaseCurve *Clone() const; - virtual void SetLengthOnDistance(hsScalar dist); - virtual hsScalar PositionGivenTime(hsScalar time) const; - virtual hsScalar VelocityGivenTime(hsScalar time) const; - virtual hsScalar TimeGivenVelocity(hsScalar velocity) const; + virtual void SetLengthOnDistance(float dist); + virtual float PositionGivenTime(float time) const; + virtual float VelocityGivenTime(float time) const; + virtual float TimeGivenVelocity(float velocity) const; }; class plSplineEaseCurve : public plATCEaseCurve { public: plSplineEaseCurve(); - plSplineEaseCurve(hsScalar minLength, hsScalar maxLength, hsScalar length, - hsScalar startSpeed, hsScalar goalSpeed); + plSplineEaseCurve(float minLength, float maxLength, float length, + float startSpeed, float goalSpeed); CLASSNAME_REGISTER( plSplineEaseCurve ); GETINTERFACE_ANY( plSplineEaseCurve, plATCEaseCurve ); @@ -288,13 +288,13 @@ public: virtual void Write(hsStream *s, hsResMgr *mgr); virtual plATCEaseCurve *Clone() const; - virtual void RecalcToSpeed(hsScalar startSpeed, hsScalar goalSpeed, hsBool preserveRate = false); - virtual void SetLengthOnDistance(hsScalar dist); - virtual hsScalar PositionGivenTime(hsScalar time) const; - virtual hsScalar VelocityGivenTime(hsScalar time) const; - virtual hsScalar TimeGivenVelocity(hsScalar velocity) const; + virtual void RecalcToSpeed(float startSpeed, float goalSpeed, hsBool preserveRate = false); + virtual void SetLengthOnDistance(float dist); + virtual float PositionGivenTime(float time) const; + virtual float VelocityGivenTime(float time) const; + virtual float TimeGivenVelocity(float velocity) const; - hsScalar fCoef[4]; + float fCoef[4]; }; class plATCState @@ -307,15 +307,15 @@ public: void Write(hsStream *s, hsResMgr *mgr); double fStartWorldTime; - hsScalar fStartAnimTime; - - UInt8 fFlags; - hsScalar fBegin; - hsScalar fEnd; - hsScalar fLoopBegin; - hsScalar fLoopEnd; - hsScalar fSpeed; - hsScalar fWrapTime; + float fStartAnimTime; + + uint8_t fFlags; + float fBegin; + float fEnd; + float fLoopBegin; + float fLoopEnd; + float fSpeed; + float fWrapTime; plATCEaseCurve *fEaseCurve; }; diff --git a/Sources/Plasma/PubUtilLib/plInterp/plController.cpp b/Sources/Plasma/PubUtilLib/plInterp/plController.cpp index 2e9400cd..94aa1ca6 100644 --- a/Sources/Plasma/PubUtilLib/plInterp/plController.cpp +++ b/Sources/Plasma/PubUtilLib/plInterp/plController.cpp @@ -79,7 +79,7 @@ plLeafController::~plLeafController() delete[] fKeys; } -void plLeafController::Interp(hsScalar time, hsScalar* result, plControllerCacheInfo *cache) const +void plLeafController::Interp(float time, float* result, plControllerCacheInfo *cache) const { hsAssert(fType == hsKeyFrame::kScalarKeyFrame || fType == hsKeyFrame::kBezScalarKeyFrame, kInvalidInterpString); @@ -87,22 +87,22 @@ void plLeafController::Interp(hsScalar time, hsScalar* result, plControllerCache if (fType == hsKeyFrame::kScalarKeyFrame) { hsScalarKey *k1, *k2; - hsScalar t; - UInt32 *idxStore = (cache ? &cache->fKeyIndex : &fLastKeyIdx); + float t; + uint32_t *idxStore = (cache ? &cache->fKeyIndex : &fLastKeyIdx); hsInterp::GetBoundaryKeyFrames(time, fNumKeys, fKeys, sizeof(hsScalarKey), (hsKeyFrame**)&k1, (hsKeyFrame**)&k2, idxStore, &t, tryForward); hsInterp::LinInterp(k1->fValue, k2->fValue, t, result); } else { hsBezScalarKey *k1, *k2; - hsScalar t; - UInt32 *idxStore = (cache ? &cache->fKeyIndex : &fLastKeyIdx); + float t; + uint32_t *idxStore = (cache ? &cache->fKeyIndex : &fLastKeyIdx); hsInterp::GetBoundaryKeyFrames(time, fNumKeys, fKeys, sizeof(hsBezScalarKey), (hsKeyFrame**)&k1, (hsKeyFrame**)&k2, idxStore, &t, tryForward); hsInterp::BezInterp(k1, k2, t, result); } } -void plLeafController::Interp(hsScalar time, hsScalarTriple* result, plControllerCacheInfo *cache) const +void plLeafController::Interp(float time, hsScalarTriple* result, plControllerCacheInfo *cache) const { hsAssert(fType == hsKeyFrame::kPoint3KeyFrame || fType == hsKeyFrame::kBezPoint3KeyFrame, kInvalidInterpString); @@ -110,22 +110,22 @@ void plLeafController::Interp(hsScalar time, hsScalarTriple* result, plControlle if (fType == hsKeyFrame::kPoint3KeyFrame) { hsPoint3Key *k1, *k2; - hsScalar t; - UInt32 *idxStore = (cache ? &cache->fKeyIndex : &fLastKeyIdx); + float t; + uint32_t *idxStore = (cache ? &cache->fKeyIndex : &fLastKeyIdx); hsInterp::GetBoundaryKeyFrames(time, fNumKeys, fKeys, sizeof(hsPoint3Key), (hsKeyFrame**)&k1, (hsKeyFrame**)&k2, idxStore, &t, tryForward); hsInterp::LinInterp(&k1->fValue, &k2->fValue, t, result); } else { hsBezPoint3Key *k1, *k2; - hsScalar t; - UInt32 *idxStore = (cache ? &cache->fKeyIndex : &fLastKeyIdx); + float t; + uint32_t *idxStore = (cache ? &cache->fKeyIndex : &fLastKeyIdx); hsInterp::GetBoundaryKeyFrames(time, fNumKeys, fKeys, sizeof(hsBezPoint3Key), (hsKeyFrame**)&k1, (hsKeyFrame**)&k2, idxStore, &t, tryForward); hsInterp::BezInterp(k1, k2, t, result); } } -void plLeafController::Interp(hsScalar time, hsScaleValue* result, plControllerCacheInfo *cache) const +void plLeafController::Interp(float time, hsScaleValue* result, plControllerCacheInfo *cache) const { hsAssert(fType == hsKeyFrame::kScaleKeyFrame || fType == hsKeyFrame::kBezScaleKeyFrame, kInvalidInterpString); @@ -133,22 +133,22 @@ void plLeafController::Interp(hsScalar time, hsScaleValue* result, plControllerC if (fType == hsKeyFrame::kScaleKeyFrame) { hsScaleKey *k1, *k2; - hsScalar t; - UInt32 *idxStore = (cache ? &cache->fKeyIndex : &fLastKeyIdx); + float t; + uint32_t *idxStore = (cache ? &cache->fKeyIndex : &fLastKeyIdx); hsInterp::GetBoundaryKeyFrames(time, fNumKeys, fKeys, sizeof(hsScaleKey), (hsKeyFrame**)&k1, (hsKeyFrame**)&k2, idxStore, &t, tryForward); hsInterp::LinInterp(&k1->fValue, &k2->fValue, t, result); } else { hsBezScaleKey *k1, *k2; - hsScalar t; - UInt32 *idxStore = (cache ? &cache->fKeyIndex : &fLastKeyIdx); + float t; + uint32_t *idxStore = (cache ? &cache->fKeyIndex : &fLastKeyIdx); hsInterp::GetBoundaryKeyFrames(time, fNumKeys, fKeys, sizeof(hsBezScaleKey), (hsKeyFrame**)&k1, (hsKeyFrame**)&k2, idxStore, &t, tryForward); hsInterp::BezInterp(k1, k2, t, result); } } -void plLeafController::Interp(hsScalar time, hsQuat* result, plControllerCacheInfo *cache) const +void plLeafController::Interp(float time, hsQuat* result, plControllerCacheInfo *cache) const { hsAssert(fType == hsKeyFrame::kQuatKeyFrame || fType == hsKeyFrame::kCompressedQuatKeyFrame32 || @@ -158,16 +158,16 @@ void plLeafController::Interp(hsScalar time, hsQuat* result, plControllerCacheIn if (fType == hsKeyFrame::kQuatKeyFrame) { hsQuatKey *k1, *k2; - hsScalar t; - UInt32 *idxStore = (cache ? &cache->fKeyIndex : &fLastKeyIdx); + float t; + uint32_t *idxStore = (cache ? &cache->fKeyIndex : &fLastKeyIdx); hsInterp::GetBoundaryKeyFrames(time, fNumKeys, fKeys, sizeof(hsQuatKey), (hsKeyFrame**)&k1, (hsKeyFrame**)&k2, idxStore, &t, tryForward); hsInterp::LinInterp(&k1->fValue, &k2->fValue, t, result); } else if (fType == hsKeyFrame::kCompressedQuatKeyFrame32) { hsCompressedQuatKey32 *k1, *k2; - hsScalar t; - UInt32 *idxStore = (cache ? &cache->fKeyIndex : &fLastKeyIdx); + float t; + uint32_t *idxStore = (cache ? &cache->fKeyIndex : &fLastKeyIdx); hsInterp::GetBoundaryKeyFrames(time, fNumKeys, fKeys, sizeof(hsCompressedQuatKey32), (hsKeyFrame**)&k1, (hsKeyFrame**)&k2, idxStore, &t, tryForward); hsQuat q1, q2; @@ -178,8 +178,8 @@ void plLeafController::Interp(hsScalar time, hsQuat* result, plControllerCacheIn else // (fType == hsKeyFrame::kCompressedQuatKeyFrame64) { hsCompressedQuatKey64 *k1, *k2; - hsScalar t; - UInt32 *idxStore = (cache ? &cache->fKeyIndex : &fLastKeyIdx); + float t; + uint32_t *idxStore = (cache ? &cache->fKeyIndex : &fLastKeyIdx); hsInterp::GetBoundaryKeyFrames(time, fNumKeys, fKeys, sizeof(hsCompressedQuatKey64), (hsKeyFrame**)&k1, (hsKeyFrame**)&k2, idxStore, &t, tryForward); hsQuat q1, q2; @@ -189,31 +189,31 @@ void plLeafController::Interp(hsScalar time, hsQuat* result, plControllerCacheIn } } -void plLeafController::Interp(hsScalar time, hsMatrix33* result, plControllerCacheInfo *cache) const +void plLeafController::Interp(float time, hsMatrix33* result, plControllerCacheInfo *cache) const { hsAssert(fType == hsKeyFrame::kMatrix33KeyFrame, kInvalidInterpString); hsBool tryForward = (cache? cache->fAtc->IsForewards() : true); hsMatrix33Key *k1, *k2; - hsScalar t; - UInt32 *idxStore = (cache ? &cache->fKeyIndex : &fLastKeyIdx); + float t; + uint32_t *idxStore = (cache ? &cache->fKeyIndex : &fLastKeyIdx); hsInterp::GetBoundaryKeyFrames(time, fNumKeys, fKeys, sizeof(hsMatrix33Key), (hsKeyFrame**)&k1, (hsKeyFrame**)&k2, idxStore, &t, tryForward); hsInterp::LinInterp(&k1->fValue, &k2->fValue, t, result); } -void plLeafController::Interp(hsScalar time, hsMatrix44* result, plControllerCacheInfo *cache) const +void plLeafController::Interp(float time, hsMatrix44* result, plControllerCacheInfo *cache) const { hsAssert(fType == hsKeyFrame::kMatrix44KeyFrame, kInvalidInterpString); hsBool tryForward = (cache? cache->fAtc->IsForewards() : true); hsMatrix44Key *k1, *k2; - hsScalar t; - UInt32 *idxStore = (cache ? &cache->fKeyIndex : &fLastKeyIdx); + float t; + uint32_t *idxStore = (cache ? &cache->fKeyIndex : &fLastKeyIdx); hsInterp::GetBoundaryKeyFrames(time, fNumKeys, fKeys, sizeof(hsMatrix44Key), (hsKeyFrame**)&k1, (hsKeyFrame**)&k2, idxStore, &t, tryForward); hsInterp::LinInterp(&k1->fValue, &k2->fValue, t, result); } -void plLeafController::Interp(hsScalar time, hsColorRGBA* result, plControllerCacheInfo *cache) const +void plLeafController::Interp(float time, hsColorRGBA* result, plControllerCacheInfo *cache) const { hsPoint3 value; Interp(time, &value, cache); @@ -224,22 +224,22 @@ void plLeafController::Interp(hsScalar time, hsColorRGBA* result, plControllerCa plControllerCacheInfo *plLeafController::CreateCache() const { - plControllerCacheInfo *cache = TRACKED_NEW plControllerCacheInfo; + plControllerCacheInfo *cache = new plControllerCacheInfo; cache->fNumSubControllers = 0; return cache; } -hsScalar plLeafController::GetLength() const +float plLeafController::GetLength() const { - UInt32 stride = GetStride(); + uint32_t stride = GetStride(); if (stride == 0 || fNumKeys == 0) return 0; - UInt8 *ptr = (UInt8 *)fKeys; + uint8_t *ptr = (uint8_t *)fKeys; return ((hsKeyFrame *)(ptr + (fNumKeys - 1) * stride))->fFrame / MAX_FRAMES_PER_SEC; } -UInt32 plLeafController::GetStride() const +uint32_t plLeafController::GetStride() const { switch (fType) { @@ -273,112 +273,112 @@ UInt32 plLeafController::GetStride() const } } -hsPoint3Key *plLeafController::GetPoint3Key(UInt32 i) const +hsPoint3Key *plLeafController::GetPoint3Key(uint32_t i) const { if (fType != hsKeyFrame::kPoint3KeyFrame) return nil; - return (hsPoint3Key *)((UInt8 *)fKeys + i * sizeof(hsPoint3Key)); + return (hsPoint3Key *)((uint8_t *)fKeys + i * sizeof(hsPoint3Key)); } -hsBezPoint3Key *plLeafController::GetBezPoint3Key(UInt32 i) const +hsBezPoint3Key *plLeafController::GetBezPoint3Key(uint32_t i) const { if (fType != hsKeyFrame::kBezPoint3KeyFrame) return nil; - return (hsBezPoint3Key *)((UInt8 *)fKeys + i * sizeof(hsBezPoint3Key)); + return (hsBezPoint3Key *)((uint8_t *)fKeys + i * sizeof(hsBezPoint3Key)); } -hsScalarKey *plLeafController::GetScalarKey(UInt32 i) const +hsScalarKey *plLeafController::GetScalarKey(uint32_t i) const { if (fType != hsKeyFrame::kScalarKeyFrame) return nil; - return (hsScalarKey *)((UInt8 *)fKeys + i * sizeof(hsScalarKey)); + return (hsScalarKey *)((uint8_t *)fKeys + i * sizeof(hsScalarKey)); } -hsBezScalarKey *plLeafController::GetBezScalarKey(UInt32 i) const +hsBezScalarKey *plLeafController::GetBezScalarKey(uint32_t i) const { if (fType != hsKeyFrame::kBezScalarKeyFrame) return nil; - return (hsBezScalarKey *)((UInt8 *)fKeys + i * sizeof(hsBezScalarKey)); + return (hsBezScalarKey *)((uint8_t *)fKeys + i * sizeof(hsBezScalarKey)); } -hsScaleKey *plLeafController::GetScaleKey(UInt32 i) const +hsScaleKey *plLeafController::GetScaleKey(uint32_t i) const { if (fType != hsKeyFrame::kScaleKeyFrame) return nil; - return (hsScaleKey *)((UInt8 *)fKeys + i * sizeof(hsScaleKey)); + return (hsScaleKey *)((uint8_t *)fKeys + i * sizeof(hsScaleKey)); } -hsBezScaleKey *plLeafController::GetBezScaleKey(UInt32 i) const +hsBezScaleKey *plLeafController::GetBezScaleKey(uint32_t i) const { if (fType != hsKeyFrame::kBezScaleKeyFrame) return nil; - return (hsBezScaleKey *)((UInt8 *)fKeys + i * sizeof(hsBezScaleKey)); + return (hsBezScaleKey *)((uint8_t *)fKeys + i * sizeof(hsBezScaleKey)); } -hsQuatKey *plLeafController::GetQuatKey(UInt32 i) const +hsQuatKey *plLeafController::GetQuatKey(uint32_t i) const { if (fType != hsKeyFrame::kQuatKeyFrame) return nil; - return (hsQuatKey *)((UInt8 *)fKeys + i * sizeof(hsQuatKey)); + return (hsQuatKey *)((uint8_t *)fKeys + i * sizeof(hsQuatKey)); } -hsCompressedQuatKey32 *plLeafController::GetCompressedQuatKey32(UInt32 i) const +hsCompressedQuatKey32 *plLeafController::GetCompressedQuatKey32(uint32_t i) const { if (fType != hsKeyFrame::kCompressedQuatKeyFrame32) return nil; - return (hsCompressedQuatKey32 *)((UInt8 *)fKeys + i * sizeof(hsCompressedQuatKey32)); + return (hsCompressedQuatKey32 *)((uint8_t *)fKeys + i * sizeof(hsCompressedQuatKey32)); } -hsCompressedQuatKey64 *plLeafController::GetCompressedQuatKey64(UInt32 i) const +hsCompressedQuatKey64 *plLeafController::GetCompressedQuatKey64(uint32_t i) const { if (fType != hsKeyFrame::kCompressedQuatKeyFrame64) return nil; - return (hsCompressedQuatKey64 *)((UInt8 *)fKeys + i * sizeof(hsCompressedQuatKey64)); + return (hsCompressedQuatKey64 *)((uint8_t *)fKeys + i * sizeof(hsCompressedQuatKey64)); } -hsG3DSMaxKeyFrame *plLeafController::Get3DSMaxKey(UInt32 i) const +hsG3DSMaxKeyFrame *plLeafController::Get3DSMaxKey(uint32_t i) const { if (fType != hsKeyFrame::k3dsMaxKeyFrame) return nil; - return (hsG3DSMaxKeyFrame *)((UInt8 *)fKeys + i * sizeof(hsG3DSMaxKeyFrame)); + return (hsG3DSMaxKeyFrame *)((uint8_t *)fKeys + i * sizeof(hsG3DSMaxKeyFrame)); } -hsMatrix33Key *plLeafController::GetMatrix33Key(UInt32 i) const +hsMatrix33Key *plLeafController::GetMatrix33Key(uint32_t i) const { if (fType != hsKeyFrame::kMatrix33KeyFrame) return nil; - return (hsMatrix33Key *)((UInt8 *)fKeys + i * sizeof(hsMatrix33Key)); + return (hsMatrix33Key *)((uint8_t *)fKeys + i * sizeof(hsMatrix33Key)); } -hsMatrix44Key *plLeafController::GetMatrix44Key(UInt32 i) const +hsMatrix44Key *plLeafController::GetMatrix44Key(uint32_t i) const { if (fType != hsKeyFrame::kMatrix44KeyFrame) return nil; - return (hsMatrix44Key *)((UInt8 *)fKeys + i * sizeof(hsMatrix44Key)); + return (hsMatrix44Key *)((uint8_t *)fKeys + i * sizeof(hsMatrix44Key)); } -void plLeafController::GetKeyTimes(hsTArray &keyTimes) const +void plLeafController::GetKeyTimes(hsTArray &keyTimes) const { int cIdx; int kIdx; - UInt32 stride = GetStride(); - UInt8 *keyPtr = (UInt8 *)fKeys; + uint32_t stride = GetStride(); + uint8_t *keyPtr = (uint8_t *)fKeys; for (cIdx = 0, kIdx = 0; cIdx < fNumKeys, kIdx < keyTimes.GetCount();) { - hsScalar kTime = keyTimes[kIdx]; - hsScalar cTime = ((hsKeyFrame*)(keyPtr + cIdx * stride))->fFrame / MAX_FRAMES_PER_SEC; + float kTime = keyTimes[kIdx]; + float cTime = ((hsKeyFrame*)(keyPtr + cIdx * stride))->fFrame / MAX_FRAMES_PER_SEC; if (cTime < kTime) { keyTimes.InsertAtIndex(kIdx, cTime); @@ -399,12 +399,12 @@ void plLeafController::GetKeyTimes(hsTArray &keyTimes) const // All remaining times in the controller are later than the original keyTimes set for (; cIdx < fNumKeys; cIdx++) { - hsScalar cTime = ((hsKeyFrame*)(keyPtr + cIdx * stride))->fFrame / MAX_FRAMES_PER_SEC; + float cTime = ((hsKeyFrame*)(keyPtr + cIdx * stride))->fFrame / MAX_FRAMES_PER_SEC; keyTimes.Append(cTime); } } -void plLeafController::AllocKeys(UInt32 numKeys, UInt8 type) +void plLeafController::AllocKeys(uint32_t numKeys, uint8_t type) { delete fKeys; fNumKeys = numKeys; @@ -413,51 +413,51 @@ void plLeafController::AllocKeys(UInt32 numKeys, UInt8 type) switch (fType) { case hsKeyFrame::kPoint3KeyFrame: - fKeys = TRACKED_NEW hsPoint3Key[fNumKeys]; + fKeys = new hsPoint3Key[fNumKeys]; break; case hsKeyFrame::kBezPoint3KeyFrame: - fKeys = TRACKED_NEW hsBezPoint3Key[fNumKeys]; + fKeys = new hsBezPoint3Key[fNumKeys]; break; case hsKeyFrame::kScalarKeyFrame: - fKeys = TRACKED_NEW hsScalarKey[fNumKeys]; + fKeys = new hsScalarKey[fNumKeys]; break; case hsKeyFrame::kBezScalarKeyFrame: - fKeys = TRACKED_NEW hsBezScalarKey[fNumKeys]; + fKeys = new hsBezScalarKey[fNumKeys]; break; case hsKeyFrame::kScaleKeyFrame: - fKeys = TRACKED_NEW hsScaleKey[fNumKeys]; + fKeys = new hsScaleKey[fNumKeys]; break; case hsKeyFrame::kBezScaleKeyFrame: - fKeys = TRACKED_NEW hsBezScaleKey[fNumKeys]; + fKeys = new hsBezScaleKey[fNumKeys]; break; case hsKeyFrame::kQuatKeyFrame: - fKeys = TRACKED_NEW hsQuatKey[fNumKeys]; + fKeys = new hsQuatKey[fNumKeys]; break; case hsKeyFrame::kCompressedQuatKeyFrame32: - fKeys = TRACKED_NEW hsCompressedQuatKey32[fNumKeys]; + fKeys = new hsCompressedQuatKey32[fNumKeys]; break; case hsKeyFrame::kCompressedQuatKeyFrame64: - fKeys = TRACKED_NEW hsCompressedQuatKey64[fNumKeys]; + fKeys = new hsCompressedQuatKey64[fNumKeys]; break; case hsKeyFrame::k3dsMaxKeyFrame: - fKeys = TRACKED_NEW hsG3DSMaxKeyFrame[fNumKeys]; + fKeys = new hsG3DSMaxKeyFrame[fNumKeys]; break; case hsKeyFrame::kMatrix33KeyFrame: - fKeys = TRACKED_NEW hsMatrix33Key[fNumKeys]; + fKeys = new hsMatrix33Key[fNumKeys]; break; case hsKeyFrame::kMatrix44KeyFrame: - fKeys = TRACKED_NEW hsMatrix44Key[fNumKeys]; + fKeys = new hsMatrix44Key[fNumKeys]; break; case hsKeyFrame::kUnknownKeyFrame: @@ -467,15 +467,15 @@ void plLeafController::AllocKeys(UInt32 numKeys, UInt8 type) } } -void plLeafController::QuickScalarController(int numKeys, hsScalar* times, hsScalar* values, UInt32 valueStrides) +void plLeafController::QuickScalarController(int numKeys, float* times, float* values, uint32_t valueStrides) { AllocKeys(numKeys, hsKeyFrame::kScalarKeyFrame); int i; for( i = 0; i < numKeys; i++ ) { - ((hsScalarKey*)fKeys)[i].fFrame = (UInt16)(*times++ * MAX_FRAMES_PER_SEC); + ((hsScalarKey*)fKeys)[i].fFrame = (uint16_t)(*times++ * MAX_FRAMES_PER_SEC); ((hsScalarKey*)fKeys)[i].fValue = *values; - values = (hsScalar *)((UInt8 *)values + valueStrides); + values = (float *)((uint8_t *)values + valueStrides); } } @@ -604,8 +604,8 @@ hsBool plLeafController::PurgeRedundantSubcontrollers() void plLeafController::Read(hsStream* s, hsResMgr *mgr) { - UInt8 type = s->ReadByte(); - UInt32 numKeys = s->ReadLE32(); + uint8_t type = s->ReadByte(); + uint32_t numKeys = s->ReadLE32(); AllocKeys(numKeys, type); int i; @@ -764,7 +764,7 @@ plCompoundController::~plCompoundController() delete fZController; } -void plCompoundController::Interp(hsScalar time, hsScalarTriple* result, plControllerCacheInfo *cache) const +void plCompoundController::Interp(float time, hsScalarTriple* result, plControllerCacheInfo *cache) const { if (fXController) fXController->Interp(time, &result->fX, (cache ? cache->fSubControllers[0] : nil)); @@ -774,7 +774,7 @@ void plCompoundController::Interp(hsScalar time, hsScalarTriple* result, plContr fZController->Interp(time, &result->fZ, (cache ? cache->fSubControllers[2] : nil)); } -void plCompoundController::Interp(hsScalar time, hsQuat* result, plControllerCacheInfo *cache) const +void plCompoundController::Interp(float time, hsQuat* result, plControllerCacheInfo *cache) const { hsEuler eul(0,0,0,EulOrdXYZs); @@ -785,7 +785,7 @@ void plCompoundController::Interp(hsScalar time, hsQuat* result, plControllerCac eul.GetQuat(result); } -void plCompoundController::Interp(hsScalar time, hsAffineParts* parts, plControllerCacheInfo *cache) const +void plCompoundController::Interp(float time, hsAffineParts* parts, plControllerCacheInfo *cache) const { if (fXController) fXController->Interp(time, &parts->fT, (cache ? cache->fSubControllers[0] : nil)); @@ -802,16 +802,16 @@ void plCompoundController::Interp(hsScalar time, hsAffineParts* parts, plControl } } -void plCompoundController::Interp(hsScalar time, hsColorRGBA* result, plControllerCacheInfo *cache) const +void plCompoundController::Interp(float time, hsColorRGBA* result, plControllerCacheInfo *cache) const { fXController->Interp(time, &result->r, (cache ? cache->fSubControllers[0] : nil)); fYController->Interp(time, &result->g, (cache ? cache->fSubControllers[1] : nil)); fZController->Interp(time, &result->b, (cache ? cache->fSubControllers[2] : nil)); } -hsScalar plCompoundController::GetLength() const +float plCompoundController::GetLength() const { - hsScalar len=0; + float len=0; int i; for(i=0; i<3; i++) { @@ -821,7 +821,7 @@ hsScalar plCompoundController::GetLength() const return len; } -void plCompoundController::GetKeyTimes(hsTArray &keyTimes) const +void plCompoundController::GetKeyTimes(hsTArray &keyTimes) const { if (fXController) fXController->GetKeyTimes(keyTimes); @@ -879,9 +879,9 @@ hsBool plCompoundController::PurgeRedundantSubcontrollers() plControllerCacheInfo* plCompoundController::CreateCache() const { - plControllerCacheInfo* cache = TRACKED_NEW plControllerCacheInfo; + plControllerCacheInfo* cache = new plControllerCacheInfo; cache->fNumSubControllers = 3; - cache->fSubControllers = TRACKED_NEW plControllerCacheInfo*[cache->fNumSubControllers]; + cache->fSubControllers = new plControllerCacheInfo*[cache->fNumSubControllers]; int i; for (i = 0; i < cache->fNumSubControllers; i++) cache->fSubControllers[i] = (GetController(i) ? GetController(i)->CreateCache() : nil); @@ -889,12 +889,12 @@ plControllerCacheInfo* plCompoundController::CreateCache() const return cache; } -plController* plCompoundController::GetController(Int32 i) const +plController* plCompoundController::GetController(int32_t i) const { return (i==0 ? fXController : (i==1 ? fYController : fZController)); } -void plCompoundController::SetController(Int32 i, plController* c) +void plCompoundController::SetController(int32_t i, plController* c) { delete GetController(i); (i==0 ? fXController : (i==1 ? fYController : fZController)) = c; diff --git a/Sources/Plasma/PubUtilLib/plInterp/plController.h b/Sources/Plasma/PubUtilLib/plInterp/plController.h index 2c752ed2..c6aabace 100644 --- a/Sources/Plasma/PubUtilLib/plInterp/plController.h +++ b/Sources/Plasma/PubUtilLib/plInterp/plController.h @@ -76,10 +76,10 @@ class plCompoundController; class plControllerCacheInfo { public: - UInt8 fNumSubControllers; + uint8_t fNumSubControllers; plControllerCacheInfo **fSubControllers; - UInt32 fKeyIndex; + uint32_t fKeyIndex; plAnimTimeConvert *fAtc; plControllerCacheInfo(); @@ -98,18 +98,18 @@ public: CLASSNAME_REGISTER( plController ); GETINTERFACE_ANY( plController, plCreatable ); - virtual void Interp(hsScalar time, hsScalar* result, plControllerCacheInfo *cache = nil) const {} - virtual void Interp(hsScalar time, hsScalarTriple* result, plControllerCacheInfo *cache = nil) const {} - virtual void Interp(hsScalar time, hsScaleValue* result, plControllerCacheInfo *cache = nil) const {} - virtual void Interp(hsScalar time, hsQuat* result, plControllerCacheInfo *cache = nil) const {} - virtual void Interp(hsScalar time, hsMatrix33* result, plControllerCacheInfo *cache = nil) const {} - virtual void Interp(hsScalar time, hsMatrix44* result, plControllerCacheInfo *cache = nil) const {} - virtual void Interp(hsScalar time, hsColorRGBA* result, plControllerCacheInfo *cache = nil) const {} - virtual void Interp(hsScalar time, hsAffineParts* parts, plControllerCacheInfo *cache = nil) const {} + virtual void Interp(float time, float* result, plControllerCacheInfo *cache = nil) const {} + virtual void Interp(float time, hsScalarTriple* result, plControllerCacheInfo *cache = nil) const {} + virtual void Interp(float time, hsScaleValue* result, plControllerCacheInfo *cache = nil) const {} + virtual void Interp(float time, hsQuat* result, plControllerCacheInfo *cache = nil) const {} + virtual void Interp(float time, hsMatrix33* result, plControllerCacheInfo *cache = nil) const {} + virtual void Interp(float time, hsMatrix44* result, plControllerCacheInfo *cache = nil) const {} + virtual void Interp(float time, hsColorRGBA* result, plControllerCacheInfo *cache = nil) const {} + virtual void Interp(float time, hsAffineParts* parts, plControllerCacheInfo *cache = nil) const {} virtual plControllerCacheInfo* CreateCache() const { return nil; } // Caller must handle deleting the pointer. - virtual hsScalar GetLength() const = 0; - virtual void GetKeyTimes(hsTArray &keyTimes) const = 0; + virtual float GetLength() const = 0; + virtual void GetKeyTimes(hsTArray &keyTimes) const = 0; virtual hsBool AllKeysMatch() const = 0; // Checks each of our subcontrollers (if we have any) and deletes any that @@ -126,10 +126,10 @@ class plLeafController : public plController friend class plCompoundController; protected: - UInt8 fType; + uint8_t fType; void *fKeys; // Need to pay attend to fType to determine what these actually are - UInt32 fNumKeys; - mutable UInt32 fLastKeyIdx; + uint32_t fNumKeys; + mutable uint32_t fLastKeyIdx; public: plLeafController() : fType(hsKeyFrame::kUnknownKeyFrame), fKeys(nil), fNumKeys(0), fLastKeyIdx(0) {} @@ -138,37 +138,37 @@ public: CLASSNAME_REGISTER( plLeafController ); GETINTERFACE_ANY( plLeafController, plController ); - void Interp(hsScalar time, hsScalar* result, plControllerCacheInfo *cache = nil) const; - void Interp(hsScalar time, hsScalarTriple* result, plControllerCacheInfo *cache = nil) const; - void Interp(hsScalar time, hsScaleValue* result, plControllerCacheInfo *cache = nil) const; - void Interp(hsScalar time, hsQuat* result, plControllerCacheInfo *cache = nil) const; - void Interp(hsScalar time, hsMatrix33* result, plControllerCacheInfo *cache = nil) const; - void Interp(hsScalar time, hsMatrix44* result, plControllerCacheInfo *cache = nil) const; - void Interp(hsScalar time, hsColorRGBA* result, plControllerCacheInfo *cache = nil) const; + void Interp(float time, float* result, plControllerCacheInfo *cache = nil) const; + void Interp(float time, hsScalarTriple* result, plControllerCacheInfo *cache = nil) const; + void Interp(float time, hsScaleValue* result, plControllerCacheInfo *cache = nil) const; + void Interp(float time, hsQuat* result, plControllerCacheInfo *cache = nil) const; + void Interp(float time, hsMatrix33* result, plControllerCacheInfo *cache = nil) const; + void Interp(float time, hsMatrix44* result, plControllerCacheInfo *cache = nil) const; + void Interp(float time, hsColorRGBA* result, plControllerCacheInfo *cache = nil) const; virtual plControllerCacheInfo* CreateCache() const; - hsScalar GetLength() const; - UInt32 GetStride() const; - - hsPoint3Key *GetPoint3Key(UInt32 i) const; - hsBezPoint3Key *GetBezPoint3Key(UInt32 i) const; - hsScalarKey *GetScalarKey(UInt32 i) const; - hsBezScalarKey *GetBezScalarKey(UInt32 i) const; - hsScaleKey *GetScaleKey(UInt32 i) const; - hsBezScaleKey *GetBezScaleKey(UInt32 i) const; - hsQuatKey *GetQuatKey(UInt32 i) const; - hsCompressedQuatKey32 *GetCompressedQuatKey32(UInt32 i) const; - hsCompressedQuatKey64 *GetCompressedQuatKey64(UInt32 i) const; - hsG3DSMaxKeyFrame *Get3DSMaxKey(UInt32 i) const; - hsMatrix33Key *GetMatrix33Key(UInt32 i) const; - hsMatrix44Key *GetMatrix44Key(UInt32 i) const; - - UInt8 GetType() const { return fType; } - UInt32 GetNumKeys() const { return fNumKeys; } + float GetLength() const; + uint32_t GetStride() const; + + hsPoint3Key *GetPoint3Key(uint32_t i) const; + hsBezPoint3Key *GetBezPoint3Key(uint32_t i) const; + hsScalarKey *GetScalarKey(uint32_t i) const; + hsBezScalarKey *GetBezScalarKey(uint32_t i) const; + hsScaleKey *GetScaleKey(uint32_t i) const; + hsBezScaleKey *GetBezScaleKey(uint32_t i) const; + hsQuatKey *GetQuatKey(uint32_t i) const; + hsCompressedQuatKey32 *GetCompressedQuatKey32(uint32_t i) const; + hsCompressedQuatKey64 *GetCompressedQuatKey64(uint32_t i) const; + hsG3DSMaxKeyFrame *Get3DSMaxKey(uint32_t i) const; + hsMatrix33Key *GetMatrix33Key(uint32_t i) const; + hsMatrix44Key *GetMatrix44Key(uint32_t i) const; + + uint8_t GetType() const { return fType; } + uint32_t GetNumKeys() const { return fNumKeys; } void *GetKeyBuffer() const { return fKeys; } - void GetKeyTimes(hsTArray &keyTimes) const; - void AllocKeys(UInt32 n, UInt8 type); - void QuickScalarController(int numKeys, hsScalar* times, hsScalar* values, UInt32 valueStrides); + void GetKeyTimes(hsTArray &keyTimes) const; + void AllocKeys(uint32_t n, uint8_t type); + void QuickScalarController(int numKeys, float* times, float* values, uint32_t valueStrides); hsBool AllKeysMatch() const; hsBool PurgeRedundantSubcontrollers(); @@ -196,10 +196,10 @@ public: CLASSNAME_REGISTER( plCompoundController ); GETINTERFACE_ANY( plCompoundController, plController ); - void Interp(hsScalar time, hsQuat* result, plControllerCacheInfo *cache = nil) const; - void Interp(hsScalar time, hsScalarTriple* result, plControllerCacheInfo *cache = nil) const; - void Interp(hsScalar time, hsAffineParts* parts, plControllerCacheInfo *cache = nil) const; - void Interp(hsScalar time, hsColorRGBA* result, plControllerCacheInfo *cache = nil) const; + void Interp(float time, hsQuat* result, plControllerCacheInfo *cache = nil) const; + void Interp(float time, hsScalarTriple* result, plControllerCacheInfo *cache = nil) const; + void Interp(float time, hsAffineParts* parts, plControllerCacheInfo *cache = nil) const; + void Interp(float time, hsColorRGBA* result, plControllerCacheInfo *cache = nil) const; plControllerCacheInfo* CreateCache() const; plController *GetXController() const { return fXController; } @@ -208,9 +208,9 @@ public: plController *GetPosController() const { return fXController; } plController *GetRotController() const { return fYController; } plController *GetScaleController() const { return fZController; } - plController *GetController(Int32 i) const; - hsScalar GetLength() const; - void GetKeyTimes(hsTArray &keyTimes) const; + plController *GetController(int32_t i) const; + float GetLength() const; + void GetKeyTimes(hsTArray &keyTimes) const; hsBool AllKeysMatch() const; hsBool PurgeRedundantSubcontrollers(); @@ -220,7 +220,7 @@ public: void SetPosController(plController *c) { delete fXController; fXController = c; } void SetRotController(plController *c) { delete fYController; fYController = c; } void SetScaleController(plController *c) { delete fZController; fZController = c; } - void SetController(Int32 i, plController* c); + void SetController(int32_t i, plController* c); void Read(hsStream* s, hsResMgr* mgr); void Write(hsStream* s, hsResMgr* mgr); diff --git a/Sources/Plasma/PubUtilLib/plInterp/plModulator.cpp b/Sources/Plasma/PubUtilLib/plInterp/plModulator.cpp index 99963824..962c4e89 100644 --- a/Sources/Plasma/PubUtilLib/plInterp/plModulator.cpp +++ b/Sources/Plasma/PubUtilLib/plInterp/plModulator.cpp @@ -40,7 +40,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "plModulator.h" #include "hsResMgr.h" #include "hsStream.h" @@ -76,18 +76,18 @@ void plModulator::SetTransform(const hsMatrix44& l2w, const hsMatrix44& w2l) } // Volume - Want to base this on the closest point on the bounds, instead of just the center. -hsScalar plModulator::Modulation(const hsBounds3Ext& bnd) const +float plModulator::Modulation(const hsBounds3Ext& bnd) const { return Modulation(bnd.GetCenter()); } -hsScalar plModulator::Modulation(const hsPoint3& pos) const +float plModulator::Modulation(const hsPoint3& pos) const { hsAssert(fVolume, "Modulator with no Volume is pretty useless"); - hsScalar dist = fVolume->Test(pos); + float dist = fVolume->Test(pos); - hsScalar retVal; + float retVal; if( dist > 0 ) { if( dist < fSoftDist ) diff --git a/Sources/Plasma/PubUtilLib/plInterp/plModulator.h b/Sources/Plasma/PubUtilLib/plInterp/plModulator.h index 52c457d3..dbe8b43d 100644 --- a/Sources/Plasma/PubUtilLib/plInterp/plModulator.h +++ b/Sources/Plasma/PubUtilLib/plInterp/plModulator.h @@ -54,7 +54,7 @@ class plModulator : public plCreatable { protected: plVolumeIsect* fVolume; - hsScalar fSoftDist; + float fSoftDist; public: plModulator(); @@ -66,13 +66,13 @@ public: const plVolumeIsect* GetVolume() const { return fVolume; } void SetVolume(plVolumeIsect* vol); // Takes ownership, so don't delete after handing it in. - hsScalar Modulation(const hsPoint3& pos) const; - hsScalar Modulation(const hsBounds3Ext& bnd) const; + float Modulation(const hsPoint3& pos) const; + float Modulation(const hsBounds3Ext& bnd) const; void SetTransform(const hsMatrix44& l2w, const hsMatrix44& w2l); - hsScalar GetSoftDist() const { return fSoftDist; } - void SetSoftDist(hsScalar s) { fSoftDist = s; } + float GetSoftDist() const { return fSoftDist; } + void SetSoftDist(float s) { fSoftDist = s; } virtual void Read(hsStream* s, hsResMgr* mgr); virtual void Write(hsStream* s, hsResMgr* mgr); diff --git a/Sources/Plasma/PubUtilLib/plIntersect/plClosest.cpp b/Sources/Plasma/PubUtilLib/plIntersect/plClosest.cpp index 8271319a..f909dd01 100644 --- a/Sources/Plasma/PubUtilLib/plIntersect/plClosest.cpp +++ b/Sources/Plasma/PubUtilLib/plIntersect/plClosest.cpp @@ -40,28 +40,28 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "hsGeometry3.h" #include "plClosest.h" #include "hsFastMath.h" -static const hsScalar kRealSmall = 1.e-5f; +static const float kRealSmall = 1.e-5f; // Find the closest point on a line (or segment) to a point. -UInt32 plClosest::PointOnLine(const hsPoint3& p0, +uint32_t plClosest::PointOnLine(const hsPoint3& p0, const hsPoint3& p1, const hsVector3& v1, hsPoint3& cp, - UInt32 clamp) + uint32_t clamp) { - hsScalar invV1Sq = v1.MagnitudeSquared(); + float invV1Sq = v1.MagnitudeSquared(); // v1 is also zero length. The two input points are the only options for output. if( invV1Sq < kRealSmall ) { cp = p1; return kClamp; } - hsScalar t = v1.InnerProduct(p0 - p1) / invV1Sq; + float t = v1.InnerProduct(p0 - p1) / invV1Sq; cp = p1; // clamp to the ends of segment v1. if( (clamp & kClampLower1) && (t < 0) ) @@ -79,12 +79,12 @@ UInt32 plClosest::PointOnLine(const hsPoint3& p0, } // Find closest points to each other from two lines (or segments). -UInt32 plClosest::PointsOnLines(const hsPoint3& p0, const hsVector3& v0, +uint32_t plClosest::PointsOnLines(const hsPoint3& p0, const hsVector3& v0, const hsPoint3& p1, const hsVector3& v1, hsPoint3& cp0, hsPoint3& cp1, - UInt32 clamp) + uint32_t clamp) { - hsScalar invV0Sq = v0.MagnitudeSquared(); + float invV0Sq = v0.MagnitudeSquared(); // First handle degenerate cases. // v0 is zero length. Resolves to finding closest point on p1+v1 to p0 if( invV0Sq < kRealSmall ) @@ -139,7 +139,7 @@ UInt32 plClosest::PointsOnLines(const hsPoint3& p0, const hsVector3& v0, // Check for the vectors v0 and v1 being parallel, in which case // following the lines won't get us to any closer point. - hsScalar DV0dotDV0 = DV0.InnerProduct(DV0); + float DV0dotDV0 = DV0.InnerProduct(DV0); if( DV0dotDV0 < kRealSmall ) { // If neither is clamped, return any two corresponding points. @@ -147,14 +147,14 @@ UInt32 plClosest::PointsOnLines(const hsPoint3& p0, const hsVector3& v0, // If both are clamped, well, both are clamped. The distance between // points will no longer be the distance between lines. // In any case, the distance between the points should be correct. - UInt32 clamp1 = PointOnLine(p0, p1, v1, cp1, clamp); - UInt32 clamp0 = PointOnLine(cp1, p0, v0, cp0, clamp >> 1); + uint32_t clamp1 = PointOnLine(p0, p1, v1, cp1, clamp); + uint32_t clamp0 = PointOnLine(cp1, p0, v0, cp0, clamp >> 1); return clamp1 | (clamp0 << 1); } - UInt32 retVal = 0; + uint32_t retVal = 0; - hsScalar t1 = - (CV0.InnerProduct(DV0)) / DV0dotDV0; + float t1 = - (CV0.InnerProduct(DV0)) / DV0dotDV0; if( (clamp & kClampLower1) && (t1 <= 0) ) { t1 = 0; @@ -166,7 +166,7 @@ UInt32 plClosest::PointsOnLines(const hsPoint3& p0, const hsVector3& v0, retVal |= kClampUpper1; } - hsScalar t0 = v0.InnerProduct(p0subp1 - v1 * t1) * -invV0Sq; + float t0 = v0.InnerProduct(p0subp1 - v1 * t1) * -invV0Sq; cp0 = p0; if( (clamp & kClampUpper0) && (t0 >= 1.f) ) { @@ -207,11 +207,11 @@ UInt32 plClosest::PointsOnLines(const hsPoint3& p0, const hsVector3& v0, } hsBool plClosest::PointOnSphere(const hsPoint3& p0, - const hsPoint3& center, hsScalar rad, + const hsPoint3& center, float rad, hsPoint3& cp) { hsVector3 del(&p0, ¢er); - hsScalar dist = hsFastMath::InvSqrtAppr(del.MagnitudeSquared()); + float dist = hsFastMath::InvSqrtAppr(del.MagnitudeSquared()); dist *= rad; del *= dist; cp = center; @@ -226,7 +226,7 @@ hsBool plClosest::PointOnBox(const hsPoint3& p0, const hsVector3& axis2, hsPoint3& cp) { - UInt32 clamps = 0; + uint32_t clamps = 0; hsPoint3 currPt = corner; clamps |= PointOnLine(p0, currPt, axis0, cp, kClamp); currPt = cp; @@ -238,9 +238,9 @@ hsBool plClosest::PointOnBox(const hsPoint3& p0, } hsBool plClosest::PointOnSphere(const hsPoint3& p0, const hsVector3& v0, - const hsPoint3& center, hsScalar rad, + const hsPoint3& center, float rad, hsPoint3& cp, - UInt32 clamp) + uint32_t clamp) { // Does the line hit the sphere? If it does, we return the entry point in cp, // otherwise we find the closest point on the sphere to the line. @@ -261,22 +261,22 @@ hsBool plClosest::PointOnSphere(const hsPoint3& p0, const hsVector3& v0, to the center of the sphere, and return the intersection of the segment connecting that point and the center with the sphere. */ - hsScalar termA = v0.InnerProduct(v0); + float termA = v0.InnerProduct(v0); if( termA < kRealSmall ) { return PointOnSphere(p0, center, rad, cp); } hsVector3 p0Subc(&p0, ¢er); - hsScalar termB = v0.InnerProduct(p0Subc); - hsScalar termC = p0Subc.InnerProduct(p0Subc) - rad; - hsScalar disc = termB * termB - 4 * termA * termC; + float termB = v0.InnerProduct(p0Subc); + float termC = p0Subc.InnerProduct(p0Subc) - rad; + float disc = termB * termB - 4 * termA * termC; if( disc >= 0 ) { - disc = hsSquareRoot(disc); - hsScalar t = (-termB - disc) / (2.f * termA); + disc = sqrt(disc); + float t = (-termB - disc) / (2.f * termA); if( (t < 0) && (clamp & kClampLower0) ) { - hsScalar tOut = (-termB + disc) / (2.f * termA); + float tOut = (-termB + disc) / (2.f * termA); if( tOut < 0 ) { // Both isects are before beginning of clamped line. @@ -327,9 +327,9 @@ hsBool plClosest::PointOnBox(const hsPoint3& p0, const hsVector3& v0, const hsVector3& axis1, const hsVector3& axis2, hsPoint3& cp, - UInt32 clamp) + uint32_t clamp) { - UInt32 clampRes = 0; + uint32_t clampRes = 0; hsPoint3 cp0, cp1; hsPoint3 currPt = corner; @@ -354,9 +354,9 @@ hsBool plClosest::PointOnPlane(const hsPoint3& p0, p' = p - ((p-pPln)*n)/|n| * n/|n| p' = p + ((pPln-p)*n) * n / |n|^2 */ - hsScalar invNLen = hsFastMath::InvSqrt(n.MagnitudeSquared()); + float invNLen = hsFastMath::InvSqrt(n.MagnitudeSquared()); - hsScalar nDotp = n.InnerProduct(pPln - p0); + float nDotp = n.InnerProduct(pPln - p0); cp = p0 + n * (nDotp * invNLen); return nDotp >= 0; @@ -365,7 +365,7 @@ hsBool plClosest::PointOnPlane(const hsPoint3& p0, hsBool plClosest::PointOnPlane(const hsPoint3& p0, const hsVector3& v0, const hsPoint3& pPln, const hsVector3& n, hsPoint3& cp, - UInt32 clamp) + uint32_t clamp) { /* p0 + v0*t is on plane, i.e. @@ -378,11 +378,11 @@ hsBool plClosest::PointOnPlane(const hsPoint3& p0, const hsVector3& v0, Then clamp appropriately, garnish, and serve with wild rice. */ hsBool retVal = true; - hsScalar pDotn = n.InnerProduct(pPln - p0); - hsScalar v0Dotn = n.InnerProduct(v0); + float pDotn = n.InnerProduct(pPln - p0); + float v0Dotn = n.InnerProduct(v0); if( (v0Dotn < -kRealSmall) || (v0Dotn > kRealSmall) ) { - hsScalar t = pDotn / v0Dotn; + float t = pDotn / v0Dotn; if( (clamp & kClampLower) && (t < 0) ) { @@ -443,7 +443,7 @@ hsBool plClosest::PointBetweenBoxes(const hsPoint3& aCorner, hsPoint3 aBestPt; hsPoint3 bBestPt; - hsScalar minDistSq = 1.e33f; + float minDistSq = 1.e33f; for( j = 0; j < 3; j++ ) { hsPoint3 aNextPt, bNextPt; @@ -452,7 +452,7 @@ hsBool plClosest::PointBetweenBoxes(const hsPoint3& aCorner, aNextPt, bNextPt, plClosest::kClamp); - hsScalar distSq = hsVector3(&aNextPt, &bNextPt).MagnitudeSquared(); + float distSq = hsVector3(&aNextPt, &bNextPt).MagnitudeSquared(); if( distSq < minDistSq ) { aBestPt = aNextPt; @@ -501,7 +501,7 @@ hsBool plClosest::PointBetweenBoxes(const hsPoint3& aCorner, int bIdx2 = 2; hsPoint3 aBestPt, bBestPt; - hsScalar minDistSq = 1.e33f; + float minDistSq = 1.e33f; hsBool retVal = false; @@ -534,7 +534,7 @@ hsBool plClosest::PointBetweenBoxes(const hsPoint3& aCorner, plClosest::kClamp); - hsScalar distSq = hsVector3(&aNextPt, &bNextPt).MagnitudeSquared(); + float distSq = hsVector3(&aNextPt, &bNextPt).MagnitudeSquared(); if( distSq < minDistSq ) { aBestPt = aNextPt; @@ -647,7 +647,7 @@ hsBool plClosest::PointBetweenBoxes(const hsPoint3& aCorner, } hsPoint3 aBestPt, bBestPt; - hsScalar minDistSq = 1.e33f; + float minDistSq = 1.e33f; hsBool retVal = false; @@ -680,7 +680,7 @@ hsBool plClosest::PointBetweenBoxes(const hsPoint3& aCorner, plClosest::kClamp); - hsScalar distSq = hsVector3(&aNextPt, &bNextPt).MagnitudeSquared(); + float distSq = hsVector3(&aNextPt, &bNextPt).MagnitudeSquared(); if( distSq < minDistSq ) { aBestPt = aNextPt; diff --git a/Sources/Plasma/PubUtilLib/plIntersect/plClosest.h b/Sources/Plasma/PubUtilLib/plIntersect/plClosest.h index 4f20b3a8..66e29b8f 100644 --- a/Sources/Plasma/PubUtilLib/plIntersect/plClosest.h +++ b/Sources/Plasma/PubUtilLib/plIntersect/plClosest.h @@ -65,21 +65,21 @@ enum plClosestClampFlags // Return clamp flags for where clamped - static UInt32 PointOnLine(const hsPoint3& p0, // Point + static uint32_t PointOnLine(const hsPoint3& p0, // Point const hsPoint3& p1, const hsVector3& v1, // Line hsPoint3& cp, // Output closest point on line to p0 - UInt32 clamp); // Clamp on ends of segment (use Lower1/Upper1) + uint32_t clamp); // Clamp on ends of segment (use Lower1/Upper1) // Return clamp flags for where clamped - static UInt32 PointsOnLines(const hsPoint3& p0, const hsVector3& v0,// First line + static uint32_t PointsOnLines(const hsPoint3& p0, const hsVector3& v0,// First line const hsPoint3& p1, const hsVector3& v1, // Second line hsPoint3& cp0, // Output closest on line0 to line1 hsPoint3& cp1, // Output closest on line1 to line0 - UInt32 clamp); // Clamp on ends + uint32_t clamp); // Clamp on ends // Return true if p0 is inside or on sphere. static hsBool PointOnSphere(const hsPoint3& p0, // Point - const hsPoint3& center, hsScalar rad, // Sphere + const hsPoint3& center, float rad, // Sphere hsPoint3& cp); // Output closest on sphere to p0 // Return true if p0 is inside box. @@ -92,9 +92,9 @@ enum plClosestClampFlags // Return true if line intersects or is inside sphere. static hsBool PointOnSphere(const hsPoint3& p0, const hsVector3& v0, // Line - const hsPoint3& center, hsScalar rad, // Sphere + const hsPoint3& center, float rad, // Sphere hsPoint3& cp, // Output closest on sphere to p0, or entry point if line hits sphere - UInt32 clamp); + uint32_t clamp); // Return true if line intersects or is inside box. static hsBool PointOnBox(const hsPoint3& p0, const hsVector3& v0, // Line @@ -103,7 +103,7 @@ enum plClosestClampFlags const hsVector3& axis1, const hsVector3& axis2, hsPoint3& cp, - UInt32 clamp); + uint32_t clamp); // Return true if point inside (negative side) of plane static hsBool PointOnPlane(const hsPoint3& p0, @@ -114,7 +114,7 @@ enum plClosestClampFlags static hsBool PointOnPlane(const hsPoint3& p0, const hsVector3& v0, const hsPoint3& pPln, const hsVector3& n, hsPoint3& cp, - UInt32 clamp); + uint32_t clamp); // Two identical functions, just different wrapping. First version repacks // parameters and calls second. diff --git a/Sources/Plasma/PubUtilLib/plIntersect/plHardRegion.cpp b/Sources/Plasma/PubUtilLib/plIntersect/plHardRegion.cpp index 20d9b85a..55157284 100644 --- a/Sources/Plasma/PubUtilLib/plIntersect/plHardRegion.cpp +++ b/Sources/Plasma/PubUtilLib/plIntersect/plHardRegion.cpp @@ -40,7 +40,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "hsStream.h" #include "plHardRegion.h" diff --git a/Sources/Plasma/PubUtilLib/plIntersect/plHardRegion.h b/Sources/Plasma/PubUtilLib/plIntersect/plHardRegion.h index dfa7359e..db5d85fc 100644 --- a/Sources/Plasma/PubUtilLib/plIntersect/plHardRegion.h +++ b/Sources/Plasma/PubUtilLib/plIntersect/plHardRegion.h @@ -64,7 +64,7 @@ protected: kCamInside }; - mutable UInt32 fState; + mutable uint32_t fState; hsPoint3 fCamPos; virtual void SetKey(plKey k); @@ -81,7 +81,7 @@ public: virtual void SetTransform(const hsMatrix44& l2w, const hsMatrix44& w2l) = 0; - virtual Int32 GetNumProperties() const { return 1; } // This is stupid. + virtual int32_t GetNumProperties() const { return 1; } // This is stupid. virtual hsBool MsgReceive(plMessage* msg); diff --git a/Sources/Plasma/PubUtilLib/plIntersect/plHardRegionPlanes.cpp b/Sources/Plasma/PubUtilLib/plIntersect/plHardRegionPlanes.cpp index fb0f914e..c4845380 100644 --- a/Sources/Plasma/PubUtilLib/plIntersect/plHardRegionPlanes.cpp +++ b/Sources/Plasma/PubUtilLib/plIntersect/plHardRegionPlanes.cpp @@ -40,7 +40,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "plHardRegionPlanes.h" #include "hsStream.h" @@ -147,11 +147,11 @@ void plHardRegionPlanes::AddPlane(const hsVector3& n, const hsPoint3& p) int i; for( i = 0; i < fPlanes.GetCount(); i++ ) { - const hsScalar kCloseToOne = 1.f - 1.e-4f; + const float kCloseToOne = 1.f - 1.e-4f; if( fPlanes[i].fNorm.InnerProduct(nNorm) >= kCloseToOne ) { - hsScalar newDist = nNorm.InnerProduct(p); - hsScalar oldDist = fPlanes[i].fNorm.InnerProduct(fPlanes[i].fPos); + float newDist = nNorm.InnerProduct(p); + float oldDist = fPlanes[i].fNorm.InnerProduct(fPlanes[i].fPos); if( newDist > oldDist ) { fPlanes[i].fPos = p; diff --git a/Sources/Plasma/PubUtilLib/plIntersect/plHardRegionPlanes.h b/Sources/Plasma/PubUtilLib/plIntersect/plHardRegionPlanes.h index 9882ee5f..9450417d 100644 --- a/Sources/Plasma/PubUtilLib/plIntersect/plHardRegionPlanes.h +++ b/Sources/Plasma/PubUtilLib/plIntersect/plHardRegionPlanes.h @@ -56,7 +56,7 @@ protected: hsVector3 fWorldNorm; hsPoint3 fWorldPos; - hsScalar fWorldDist; + float fWorldDist; }; hsTArray fPlanes; @@ -75,7 +75,7 @@ public: // Now Planes specifics void AddPlane(const hsVector3& n, const hsPoint3& p); - UInt32 GetNumPlanes() const { return fPlanes.GetCount(); } + uint32_t GetNumPlanes() const { return fPlanes.GetCount(); } void GetPlane(int i, hsVector3& n, hsPoint3& p) const { n = fPlanes[i].fNorm; p = fPlanes[i].fPos; } void GetWorldPlane(int i, hsVector3& n, hsPoint3& p) const { n = fPlanes[i].fWorldNorm; p = fPlanes[i].fWorldPos; } diff --git a/Sources/Plasma/PubUtilLib/plIntersect/plHardRegionTypes.cpp b/Sources/Plasma/PubUtilLib/plIntersect/plHardRegionTypes.cpp index a74e7769..84fd9931 100644 --- a/Sources/Plasma/PubUtilLib/plIntersect/plHardRegionTypes.cpp +++ b/Sources/Plasma/PubUtilLib/plIntersect/plHardRegionTypes.cpp @@ -40,7 +40,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "plHardRegionTypes.h" #include "hsStream.h" @@ -65,7 +65,7 @@ void plHardRegionComplex::Read(hsStream* s, hsResMgr* mgr) int n = s->ReadLE32(); int i; for( i = 0; i < n; i++ ) - mgr->ReadKeyNotifyMe(s, TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnCreate, 0, kSubRegion), plRefFlags::kActiveRef); + mgr->ReadKeyNotifyMe(s, new plGenRefMsg(GetKey(), plRefMsg::kOnCreate, 0, kSubRegion), plRefFlags::kActiveRef); } void plHardRegionComplex::Write(hsStream* s, hsResMgr* mgr) @@ -102,7 +102,7 @@ hsBool plHardRegionComplex::MsgReceive(plMessage* msg) } //////////////////////////////////////////////////////////////////////////////////////// -// Booleans follow +// bools follow //////////////////////////////////////////////////////////////////////////////////////// // Union diff --git a/Sources/Plasma/PubUtilLib/plIntersect/plHardRegionTypes.h b/Sources/Plasma/PubUtilLib/plIntersect/plHardRegionTypes.h index 6e415649..117944ca 100644 --- a/Sources/Plasma/PubUtilLib/plIntersect/plHardRegionTypes.h +++ b/Sources/Plasma/PubUtilLib/plIntersect/plHardRegionTypes.h @@ -67,7 +67,7 @@ public: // Now Complex specifics virtual hsBool MsgReceive(plMessage* msg); - UInt16 GetNumSubs() const { return fSubRegions.GetCount(); } + uint16_t GetNumSubs() const { return fSubRegions.GetCount(); } const plHardRegion* GetSub(int i) const { return fSubRegions[i]; } }; diff --git a/Sources/Plasma/PubUtilLib/plIntersect/plSoftVolume.cpp b/Sources/Plasma/PubUtilLib/plIntersect/plSoftVolume.cpp index 4d3e9728..f4b88dac 100644 --- a/Sources/Plasma/PubUtilLib/plIntersect/plSoftVolume.cpp +++ b/Sources/Plasma/PubUtilLib/plIntersect/plSoftVolume.cpp @@ -40,7 +40,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "hsStream.h" #include "plSoftVolume.h" @@ -83,12 +83,12 @@ void plSoftVolume::Write(hsStream* s, hsResMgr* mgr) s->WriteLEScalar(fOutsideStrength); } -hsScalar plSoftVolume::GetStrength(const hsPoint3& pos) const +float plSoftVolume::GetStrength(const hsPoint3& pos) const { return IRemapStrength(IGetStrength(pos)); } -hsScalar plSoftVolume::GetListenerStrength() const +float plSoftVolume::GetListenerStrength() const { if( !(fListenState & kListenPosSet) ) { @@ -135,12 +135,12 @@ hsBool plSoftVolume::MsgReceive(plMessage* msg) return plRegionBase::MsgReceive(msg); } -hsScalar plSoftVolume::IUpdateListenerStrength() const +float plSoftVolume::IUpdateListenerStrength() const { return fListenStrength = GetStrength(fListenPos); } -void plSoftVolume::SetInsideStrength(hsScalar s) +void plSoftVolume::SetInsideStrength(float s) { if( s < 0 ) s = 0; @@ -149,7 +149,7 @@ void plSoftVolume::SetInsideStrength(hsScalar s) fInsideStrength = s; } -void plSoftVolume::SetOutsideStrength(hsScalar s) +void plSoftVolume::SetOutsideStrength(float s) { if( s < 0 ) s = 0; diff --git a/Sources/Plasma/PubUtilLib/plIntersect/plSoftVolume.h b/Sources/Plasma/PubUtilLib/plIntersect/plSoftVolume.h index 0b1f2bae..a4b1e1f5 100644 --- a/Sources/Plasma/PubUtilLib/plIntersect/plSoftVolume.h +++ b/Sources/Plasma/PubUtilLib/plIntersect/plSoftVolume.h @@ -67,19 +67,19 @@ protected: }; hsPoint3 fListenPos; - mutable hsScalar fListenStrength; - mutable UInt32 fListenState; + mutable float fListenStrength; + mutable uint32_t fListenState; - hsScalar fInsideStrength; - hsScalar fOutsideStrength; + float fInsideStrength; + float fOutsideStrength; - virtual hsScalar IUpdateListenerStrength() const; + virtual float IUpdateListenerStrength() const; - hsScalar IRemapStrength(hsScalar s) const { return fOutsideStrength + s * (fInsideStrength - fOutsideStrength); } + float IRemapStrength(float s) const { return fOutsideStrength + s * (fInsideStrength - fOutsideStrength); } private: // Don't call this, use public GetStrength(). - virtual hsScalar IGetStrength(const hsPoint3& pos) const = 0; + virtual float IGetStrength(const hsPoint3& pos) const = 0; public: plSoftVolume(); @@ -88,14 +88,14 @@ public: CLASSNAME_REGISTER( plSoftVolume ); GETINTERFACE_ANY( plSoftVolume, plRegionBase ); - virtual hsScalar GetStrength(const hsPoint3& pos) const; + virtual float GetStrength(const hsPoint3& pos) const; virtual hsBool IsInside(const hsPoint3& pos) const { return GetStrength(pos) >= 1.f; } virtual void SetTransform(const hsMatrix44& l2w, const hsMatrix44& w2l) = 0; - virtual Int32 GetNumProperties() const { return 1; } // This is stupid. + virtual int32_t GetNumProperties() const { return 1; } // This is stupid. - virtual hsScalar GetListenerStrength() const; + virtual float GetListenerStrength() const; virtual void UpdateListenerPosition(const hsPoint3& p); virtual void SetCheckListener(hsBool on=true); virtual hsBool GetCheckListener() const { return 0 != (fListenState & kListenCheck); } @@ -105,11 +105,11 @@ public: virtual void Read(hsStream* stream, hsResMgr* mgr); virtual void Write(hsStream* stream, hsResMgr* mgr); - void SetInsideStrength(hsScalar s); - void SetOutsideStrength(hsScalar s); + void SetInsideStrength(float s); + void SetOutsideStrength(float s); - hsScalar GetInsideStrength() const { return fInsideStrength; } - hsScalar GetOutsideStrength() const { return fOutsideStrength; } + float GetInsideStrength() const { return fInsideStrength; } + float GetOutsideStrength() const { return fOutsideStrength; } }; #endif // plSoftVolume_inc diff --git a/Sources/Plasma/PubUtilLib/plIntersect/plSoftVolumeTypes.cpp b/Sources/Plasma/PubUtilLib/plIntersect/plSoftVolumeTypes.cpp index 25d4a6b4..5734fdd4 100644 --- a/Sources/Plasma/PubUtilLib/plIntersect/plSoftVolumeTypes.cpp +++ b/Sources/Plasma/PubUtilLib/plIntersect/plSoftVolumeTypes.cpp @@ -40,7 +40,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "hsMatrix44.h" #include "hsGeometry3.h" #include "hsResMgr.h" @@ -63,12 +63,12 @@ plSoftVolumeSimple::~plSoftVolumeSimple() delete fVolume; } -hsScalar plSoftVolumeSimple::IGetStrength(const hsPoint3& pos) const +float plSoftVolumeSimple::IGetStrength(const hsPoint3& pos) const { if( !fVolume || GetProperty(kDisable) ) return 0; - hsScalar dist = fVolume->Test(pos); + float dist = fVolume->Test(pos); if( dist <= 0 ) return 1.f; @@ -129,7 +129,7 @@ void plSoftVolumeComplex::Read(hsStream* s, hsResMgr* mgr) int n = s->ReadLE32(); int i; for( i = 0; i < n; i++ ) - mgr->ReadKeyNotifyMe(s, TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnCreate, 0, kSubVolume), plRefFlags::kActiveRef); + mgr->ReadKeyNotifyMe(s, new plGenRefMsg(GetKey(), plRefMsg::kOnCreate, 0, kSubVolume), plRefFlags::kActiveRef); } void plSoftVolumeComplex::Write(hsStream* s, hsResMgr* mgr) @@ -184,13 +184,13 @@ plSoftVolumeUnion::~plSoftVolumeUnion() { } -hsScalar plSoftVolumeUnion::IGetStrength(const hsPoint3& pos) const +float plSoftVolumeUnion::IGetStrength(const hsPoint3& pos) const { - hsScalar retVal = 0; + float retVal = 0; int i; for( i = 0; i < fSubVolumes.GetCount(); i++ ) { - hsScalar subRet = fSubVolumes[i]->GetStrength(pos); + float subRet = fSubVolumes[i]->GetStrength(pos); if( subRet >= 1.f ) return 1.f; if( subRet > retVal ) @@ -199,13 +199,13 @@ hsScalar plSoftVolumeUnion::IGetStrength(const hsPoint3& pos) const return retVal; } -hsScalar plSoftVolumeUnion::IUpdateListenerStrength() const +float plSoftVolumeUnion::IUpdateListenerStrength() const { - hsScalar retVal = 0; + float retVal = 0; int i; for( i = 0; i < fSubVolumes.GetCount(); i++ ) { - hsScalar subRet = fSubVolumes[i]->GetListenerStrength(); + float subRet = fSubVolumes[i]->GetListenerStrength(); if( subRet >= 1.f ) { retVal = 1.f; @@ -228,13 +228,13 @@ plSoftVolumeIntersect::~plSoftVolumeIntersect() { } -hsScalar plSoftVolumeIntersect::IGetStrength(const hsPoint3& pos) const +float plSoftVolumeIntersect::IGetStrength(const hsPoint3& pos) const { - hsScalar retVal = 1.f; + float retVal = 1.f; int i; for( i = 0; i < fSubVolumes.GetCount(); i++ ) { - hsScalar subRet = fSubVolumes[i]->GetStrength(pos); + float subRet = fSubVolumes[i]->GetStrength(pos); if( subRet <= 0 ) return 0; if( subRet < retVal ) @@ -243,13 +243,13 @@ hsScalar plSoftVolumeIntersect::IGetStrength(const hsPoint3& pos) const return retVal; } -hsScalar plSoftVolumeIntersect::IUpdateListenerStrength() const +float plSoftVolumeIntersect::IUpdateListenerStrength() const { - hsScalar retVal = 1.f; + float retVal = 1.f; int i; for( i = 0; i < fSubVolumes.GetCount(); i++ ) { - hsScalar subRet = fSubVolumes[i]->GetListenerStrength(); + float subRet = fSubVolumes[i]->GetListenerStrength(); if( subRet <= 0 ) { retVal = 0.f; @@ -272,7 +272,7 @@ plSoftVolumeInvert::~plSoftVolumeInvert() { } -hsScalar plSoftVolumeInvert::IGetStrength(const hsPoint3& pos) const +float plSoftVolumeInvert::IGetStrength(const hsPoint3& pos) const { hsAssert(fSubVolumes.GetCount() <= 1, "Too many subvolumes on inverter"); if( fSubVolumes.GetCount() ) @@ -281,10 +281,10 @@ hsScalar plSoftVolumeInvert::IGetStrength(const hsPoint3& pos) const return 1.f; } -hsScalar plSoftVolumeInvert::IUpdateListenerStrength() const +float plSoftVolumeInvert::IUpdateListenerStrength() const { hsAssert(fSubVolumes.GetCount() <= 1, "Too many subvolumes on inverter"); - hsScalar retVal = 1.f; + float retVal = 1.f; if( fSubVolumes.GetCount() ) retVal = (1.f - fSubVolumes[0]->GetListenerStrength()); diff --git a/Sources/Plasma/PubUtilLib/plIntersect/plSoftVolumeTypes.h b/Sources/Plasma/PubUtilLib/plIntersect/plSoftVolumeTypes.h index 616458b4..c5dcd32a 100644 --- a/Sources/Plasma/PubUtilLib/plIntersect/plSoftVolumeTypes.h +++ b/Sources/Plasma/PubUtilLib/plIntersect/plSoftVolumeTypes.h @@ -52,10 +52,10 @@ class plSoftVolumeSimple : public plSoftVolume { protected: plVolumeIsect* fVolume; - hsScalar fSoftDist; + float fSoftDist; private: - virtual hsScalar IGetStrength(const hsPoint3& pos) const; + virtual float IGetStrength(const hsPoint3& pos) const; public: plSoftVolumeSimple(); @@ -73,8 +73,8 @@ public: plVolumeIsect* GetVolume() const { return fVolume; } void SetVolume(plVolumeIsect* v); // Takes ownership, don't delete after giving to SoftVolume - hsScalar GetDistance() const { return fSoftDist; } - void SetDistance(hsScalar d) { fSoftDist = d; } + float GetDistance() const { return fSoftDist; } + void SetDistance(float d) { fSoftDist = d; } }; @@ -101,17 +101,17 @@ public: // Now Complex specifics virtual hsBool MsgReceive(plMessage* msg); - UInt16 GetNumSubs() const { return fSubVolumes.GetCount(); } + uint16_t GetNumSubs() const { return fSubVolumes.GetCount(); } const plSoftVolume* GetSub(int i) const { return fSubVolumes[i]; } }; class plSoftVolumeUnion : public plSoftVolumeComplex { protected: - virtual hsScalar IUpdateListenerStrength() const; + virtual float IUpdateListenerStrength() const; private: - virtual hsScalar IGetStrength(const hsPoint3& pos) const; + virtual float IGetStrength(const hsPoint3& pos) const; public: plSoftVolumeUnion(); @@ -125,10 +125,10 @@ public: class plSoftVolumeIntersect : public plSoftVolumeComplex { protected: - virtual hsScalar IUpdateListenerStrength() const; + virtual float IUpdateListenerStrength() const; private: - virtual hsScalar IGetStrength(const hsPoint3& pos) const; + virtual float IGetStrength(const hsPoint3& pos) const; public: plSoftVolumeIntersect(); @@ -142,10 +142,10 @@ public: class plSoftVolumeInvert : public plSoftVolumeComplex { protected: - virtual hsScalar IUpdateListenerStrength() const; + virtual float IUpdateListenerStrength() const; private: - virtual hsScalar IGetStrength(const hsPoint3& pos) const; + virtual float IGetStrength(const hsPoint3& pos) const; public: plSoftVolumeInvert(); diff --git a/Sources/Plasma/PubUtilLib/plIntersect/plVolumeIsect.cpp b/Sources/Plasma/PubUtilLib/plIntersect/plVolumeIsect.cpp index 82c49967..41a63e05 100644 --- a/Sources/Plasma/PubUtilLib/plIntersect/plVolumeIsect.cpp +++ b/Sources/Plasma/PubUtilLib/plIntersect/plVolumeIsect.cpp @@ -40,7 +40,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "plVolumeIsect.h" #include "hsBounds.h" #include "hsFastMath.h" @@ -48,7 +48,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "hsResMgr.h" #include "plIntersect/plClosest.h" -static const hsScalar kDefLength = 5.f; +static const float kDefLength = 5.f; plSphereIsect::plSphereIsect() : fRadius(1.f) @@ -77,9 +77,9 @@ void plSphereIsect::SetCenter(const hsPoint3& c) } } -void plSphereIsect::SetRadius(hsScalar r) +void plSphereIsect::SetRadius(float r) { - hsScalar del = r - fRadius; + float del = r - fRadius; int i; for( i = 0; i < 3; i++ ) { @@ -140,12 +140,12 @@ plVolumeCullResult plSphereIsect::Test(const hsBounds3Ext& bnd) const return kVolumeClear; } -hsScalar plSphereIsect::Test(const hsPoint3& pos) const +float plSphereIsect::Test(const hsPoint3& pos) const { - hsScalar dist = (pos - fWorldCenter).MagnitudeSquared(); + float dist = (pos - fWorldCenter).MagnitudeSquared(); if( dist < fRadius*fRadius ) return 0; - dist = hsSquareRoot(dist); + dist = sqrt(dist); return dist - fRadius; } @@ -171,7 +171,7 @@ void plSphereIsect::Write(hsStream* s, hsResMgr* mgr) /////////////////////////////////////////////////////////////////////////// plConeIsect::plConeIsect() -: fLength(kDefLength), fRadAngle(hsScalarPI*0.25f), fCapped(false) +: fLength(kDefLength), fRadAngle(M_PI*0.25f), fCapped(false) { ISetup(); } @@ -180,7 +180,7 @@ plConeIsect::~plConeIsect() { } -void plConeIsect::SetAngle(hsScalar rads) +void plConeIsect::SetAngle(float rads) { fRadAngle = rads; ISetup(); @@ -188,17 +188,17 @@ void plConeIsect::SetAngle(hsScalar rads) void plConeIsect::ISetup() { - hsScalar sinAng, cosAng; + float sinAng, cosAng; hsFastMath::SinCosInRangeAppr(fRadAngle, sinAng, cosAng); - const hsScalar kHither = 0.1f; + const float kHither = 0.1f; fLightToNDC.Reset(); - fLightToNDC.fMap[0][0] = hsScalarDiv( cosAng, sinAng ); - fLightToNDC.fMap[1][1] = hsScalarDiv( cosAng, sinAng ); - fLightToNDC.fMap[2][2] = -hsScalarDiv( fLength, fLength - kHither ); - fLightToNDC.fMap[3][3] = hsIntToScalar( 0 ); - fLightToNDC.fMap[3][2] = hsIntToScalar( -1 ); - fLightToNDC.fMap[2][3] = -hsScalarMulDiv( fLength, kHither, fLength - kHither ); + fLightToNDC.fMap[0][0] = cosAng / sinAng; + fLightToNDC.fMap[1][1] = cosAng / sinAng; + fLightToNDC.fMap[2][2] = -(fLength / (fLength - kHither)); + fLightToNDC.fMap[3][3] = int32_t( 0 ); + fLightToNDC.fMap[3][2] = int32_t( -1 ); + fLightToNDC.fMap[2][3] = -(fLength * kHither / (fLength - kHither)); fLightToNDC.NotIdentity(); } @@ -229,7 +229,7 @@ plVolumeCullResult plConeIsect::Test(const hsBounds3Ext& bnd) const hsVector3 perp = axis % normDir; - hsScalar sinAng, cosAng; + float sinAng, cosAng; hsFastMath::SinCosInRangeAppr(fRadAngle, sinAng, cosAng); hsVector3 tangent = normDir + sinAng * perp + (1-cosAng) * (axis % perp); @@ -239,7 +239,7 @@ plVolumeCullResult plConeIsect::Test(const hsBounds3Ext& bnd) const hsVector3 normIn2 = perp + sinAng * (perp % axis) + (1-cosAng) * (axis % (axis % perp)); bnd.TestPlane(normIn, depth); - hsScalar normInDotTip = normIn.InnerProduct(fWorldTip); + float normInDotTip = normIn.InnerProduct(fWorldTip); if( depth.fY < normInDotTip ) return kVolumeCulled; } @@ -247,9 +247,9 @@ plVolumeCullResult plConeIsect::Test(const hsBounds3Ext& bnd) const return retVal; } -hsScalar plConeIsect::Test(const hsPoint3& pos) const +float plConeIsect::Test(const hsPoint3& pos) const { - UInt32 clampFlags = fCapped ? plClosest::kClamp : plClosest::kClampLower; + uint32_t clampFlags = fCapped ? plClosest::kClamp : plClosest::kClampLower; hsPoint3 cp; plClosest::PointOnLine(pos, @@ -257,17 +257,17 @@ hsScalar plConeIsect::Test(const hsPoint3& pos) const cp, clampFlags); - hsScalar radDist = (pos - cp).Magnitude(); - hsScalar axDist = fWorldNorm.InnerProduct(pos - fWorldTip) / fLength; + float radDist = (pos - cp).Magnitude(); + float axDist = fWorldNorm.InnerProduct(pos - fWorldTip) / fLength; if( axDist < 0 ) { return radDist; } - hsScalar sinAng, cosAng; + float sinAng, cosAng; hsFastMath::SinCosInRangeAppr(fRadAngle, sinAng, cosAng); - hsScalar radius = axDist * sinAng / cosAng; + float radius = axDist * sinAng / cosAng; radDist -= radius; axDist -= fLength; @@ -282,7 +282,7 @@ hsScalar plConeIsect::Test(const hsPoint3& pos) const //#define MF_DEBUG_NORM #ifdef MF_DEBUG_NORM -#define IDEBUG_NORMALIZE( a, b ) { hsScalar len = 1.f / a.Magnitude(); a *= len; b *= len; } +#define IDEBUG_NORMALIZE( a, b ) { float len = 1.f / a.Magnitude(); a *= len; b *= len; } #else // MF_DEBUG_NORM #define IDEBUG_NORMALIZE( a, b ) #endif // MF_DEBUG_NORM @@ -316,7 +316,7 @@ void plConeIsect::SetTransform(const hsMatrix44& l2w, const hsMatrix44& w2l) } } -void plConeIsect::SetLength(hsScalar d) +void plConeIsect::SetLength(float d) { if( d > 0 ) { @@ -386,7 +386,7 @@ plCylinderIsect::~plCylinderIsect() { } -void plCylinderIsect::ISetupCyl(const hsPoint3& wTop, const hsPoint3& wBot, hsScalar radius) +void plCylinderIsect::ISetupCyl(const hsPoint3& wTop, const hsPoint3& wBot, float radius) { fWorldNorm.Set(&wTop, &wBot); fLength = fWorldNorm.Magnitude(); @@ -394,14 +394,14 @@ void plCylinderIsect::ISetupCyl(const hsPoint3& wTop, const hsPoint3& wBot, hsSc fMax = fWorldNorm.InnerProduct(wTop); if( fMin > fMax ) { - hsScalar t = fMin; + float t = fMin; fMin = fMax; fMax = t; } fRadius = radius; } -void plCylinderIsect::SetCylinder(const hsPoint3& lTop, const hsPoint3& lBot, hsScalar radius) +void plCylinderIsect::SetCylinder(const hsPoint3& lTop, const hsPoint3& lBot, float radius) { fTop = lTop; fBot = lBot; @@ -410,7 +410,7 @@ void plCylinderIsect::SetCylinder(const hsPoint3& lTop, const hsPoint3& lBot, hs ISetupCyl(fTop, fBot, fRadius); } -void plCylinderIsect::SetCylinder(const hsPoint3& lBot, const hsVector3& axis, hsScalar radius) +void plCylinderIsect::SetCylinder(const hsPoint3& lBot, const hsVector3& axis, float radius) { fBot = lBot; fTop = fBot; @@ -457,12 +457,12 @@ plVolumeCullResult plCylinderIsect::Test(const hsBounds3Ext& bnd) const bnd.GetAxes(axes+0, axes+1, axes+2); hsPoint3 cp = corner; - hsScalar bndRadiusSq = bnd.GetRadius(); + float bndRadiusSq = bnd.GetRadius(); bndRadiusSq *= bndRadiusSq; - hsScalar radiusSq = fRadius*fRadius; + float radiusSq = fRadius*fRadius; - hsScalar maxClearDistSq = fRadius - bnd.GetRadius(); + float maxClearDistSq = fRadius - bnd.GetRadius(); maxClearDistSq *= maxClearDistSq; int i; @@ -474,7 +474,7 @@ plVolumeCullResult plCylinderIsect::Test(const hsBounds3Ext& bnd) const cp, axes[i], cp0, currPt, plClosest::kClamp); - hsScalar distSq = (cp0 - currPt).MagnitudeSquared(); + float distSq = (cp0 - currPt).MagnitudeSquared(); if( distSq < radiusSq ) { if( distSq < maxClearDistSq ) @@ -489,7 +489,7 @@ plVolumeCullResult plCylinderIsect::Test(const hsBounds3Ext& bnd) const return retVal; } -hsScalar plCylinderIsect::Test(const hsPoint3& pos) const +float plCylinderIsect::Test(const hsPoint3& pos) const { hsPoint3 cp; @@ -498,15 +498,15 @@ hsScalar plCylinderIsect::Test(const hsPoint3& pos) const cp, plClosest::kClamp); - hsScalar radDist = (pos - cp).Magnitude() - fRadius; - hsScalar axDist = fWorldNorm.InnerProduct(pos - fWorldBot) / fLength; + float radDist = (pos - cp).Magnitude() - fRadius; + float axDist = fWorldNorm.InnerProduct(pos - fWorldBot) / fLength; if( axDist < 0 ) axDist = -axDist; else axDist -= fLength; - hsScalar dist = axDist > radDist ? axDist : radDist; + float dist = axDist > radDist ? axDist : radDist; return dist > 0 ? dist : 0; } @@ -569,8 +569,8 @@ void plParallelIsect::SetTransform(const hsMatrix44& l2w, const hsMatrix44& w2l) hsVector3 norm; norm.Set(&wPosOne, &wPosTwo); fPlanes[i].fNorm = norm; - hsScalar t0 = norm.InnerProduct(wPosOne); - hsScalar t1 = norm.InnerProduct(wPosTwo); + float t0 = norm.InnerProduct(wPosOne); + float t1 = norm.InnerProduct(wPosTwo); if( t0 > t1 ) { @@ -605,13 +605,13 @@ plVolumeCullResult plParallelIsect::Test(const hsBounds3Ext& bnd) const return retVal; } -hsScalar plParallelIsect::Test(const hsPoint3& pos) const +float plParallelIsect::Test(const hsPoint3& pos) const { - hsScalar maxDist = 0; + float maxDist = 0; int i; for( i = 0; i < fPlanes.GetCount(); i++ ) { - hsScalar dist = fPlanes[i].fNorm.InnerProduct(pos); + float dist = fPlanes[i].fNorm.InnerProduct(pos); if( dist > fPlanes[i].fMax ) { @@ -676,7 +676,7 @@ plConvexIsect::~plConvexIsect() { } -void plConvexIsect::AddPlaneUnchecked(const hsVector3& n, hsScalar dist) +void plConvexIsect::AddPlaneUnchecked(const hsVector3& n, float dist) { SinglePlane plane; plane.fNorm = n; @@ -697,10 +697,10 @@ void plConvexIsect::AddPlane(const hsVector3& n, const hsPoint3& p) int i; for( i = 0; i < fPlanes.GetCount(); i++ ) { - const hsScalar kCloseToOne = 1.f - 1.e-4f; + const float kCloseToOne = 1.f - 1.e-4f; if( fPlanes[i].fNorm.InnerProduct(nNorm) >= kCloseToOne ) { - hsScalar dist = nNorm.InnerProduct(p); + float dist = nNorm.InnerProduct(p); if( dist > fPlanes[i].fDist ) { fPlanes[i].fDist = dist; @@ -761,13 +761,13 @@ plVolumeCullResult plConvexIsect::Test(const hsBounds3Ext& bnd) const return retVal; } -hsScalar plConvexIsect::Test(const hsPoint3& pos) const +float plConvexIsect::Test(const hsPoint3& pos) const { - hsScalar maxDist = 0; + float maxDist = 0; int i; for( i = 0; i < fPlanes.GetCount(); i++ ) { - hsScalar dist = fPlanes[i].fWorldNorm.InnerProduct(pos) - fPlanes[i].fWorldDist; + float dist = fPlanes[i].fWorldNorm.InnerProduct(pos) - fPlanes[i].fWorldDist; if( dist > maxDist ) maxDist = dist; @@ -777,7 +777,7 @@ hsScalar plConvexIsect::Test(const hsPoint3& pos) const void plConvexIsect::Read(hsStream* s, hsResMgr* mgr) { - Int16 n = s->ReadLE16(); + int16_t n = s->ReadLE16(); fPlanes.SetCount(n); int i; @@ -843,7 +843,7 @@ plVolumeCullResult plBoundsIsect::Test(const hsBounds3Ext& bnd) const return retVal < 0 ? kVolumeCulled : kVolumeSplit; } -hsScalar plBoundsIsect::Test(const hsPoint3& pos) const +float plBoundsIsect::Test(const hsPoint3& pos) const { hsAssert(false, "Unimplemented"); return 0.f; @@ -942,13 +942,13 @@ plVolumeCullResult plUnionIsect::Test(const hsBounds3Ext& bnd) const return retVal; } -hsScalar plUnionIsect::Test(const hsPoint3& pos) const +float plUnionIsect::Test(const hsPoint3& pos) const { - hsScalar retVal = 1.e33f; + float retVal = 1.e33f; int i; for( i = 0; i < fVolumes.GetCount(); i++ ) { - hsScalar ret = fVolumes[i]->Test(pos); + float ret = fVolumes[i]->Test(pos); if( ret <= 0 ) return 0; if( ret < retVal ) @@ -990,13 +990,13 @@ plVolumeCullResult plIntersectionIsect::Test(const hsBounds3Ext& bnd) const return retVal; } -hsScalar plIntersectionIsect::Test(const hsPoint3& pos) const +float plIntersectionIsect::Test(const hsPoint3& pos) const { - hsScalar retVal = -1.f; + float retVal = -1.f; int i; for( i = 0; i < fVolumes.GetCount(); i++ ) { - hsScalar ret = fVolumes[i]->Test(pos); + float ret = fVolumes[i]->Test(pos); if( ret > retVal ) retVal = ret; } diff --git a/Sources/Plasma/PubUtilLib/plIntersect/plVolumeIsect.h b/Sources/Plasma/PubUtilLib/plIntersect/plVolumeIsect.h index 7c878992..94364616 100644 --- a/Sources/Plasma/PubUtilLib/plIntersect/plVolumeIsect.h +++ b/Sources/Plasma/PubUtilLib/plIntersect/plVolumeIsect.h @@ -68,7 +68,7 @@ public: virtual void SetTransform(const hsMatrix44& l2w, const hsMatrix44& w2l) = 0; virtual plVolumeCullResult Test(const hsBounds3Ext& bnd) const = 0; - virtual hsScalar Test(const hsPoint3& pos) const = 0; + virtual float Test(const hsPoint3& pos) const = 0; virtual void Read(hsStream* s, hsResMgr* mgr) = 0; virtual void Write(hsStream* s, hsResMgr* mgr) = 0; @@ -79,7 +79,7 @@ class plSphereIsect : public plVolumeIsect protected: hsPoint3 fCenter; hsPoint3 fWorldCenter; - hsScalar fRadius; + float fRadius; hsPoint3 fMins; hsPoint3 fMaxs; public: @@ -90,14 +90,14 @@ public: GETINTERFACE_ANY( plSphereIsect, plVolumeIsect ); void SetCenter(const hsPoint3& c); - void SetRadius(hsScalar r); + void SetRadius(float r); - hsScalar GetRadius() const { return fRadius; } + float GetRadius() const { return fRadius; } virtual void SetTransform(const hsMatrix44& l2w, const hsMatrix44& w2l); virtual plVolumeCullResult Test(const hsBounds3Ext& bnd) const; - virtual hsScalar Test(const hsPoint3& pos) const; // return 0 if point inside, else "distance" from pos to volume + virtual float Test(const hsPoint3& pos) const; // return 0 if point inside, else "distance" from pos to volume virtual void Read(hsStream* s, hsResMgr* mgr); virtual void Write(hsStream* s, hsResMgr* mgr); @@ -108,8 +108,8 @@ class plConeIsect : public plVolumeIsect protected: hsBool fCapped; - hsScalar fRadAngle; - hsScalar fLength; + float fRadAngle; + float fLength; hsPoint3 fWorldTip; hsVector3 fWorldNorm; @@ -118,7 +118,7 @@ protected: hsMatrix44 fLightToNDC; hsVector3 fNorms[5]; - hsScalar fDists[5]; + float fDists[5]; void ISetup(); public: @@ -129,16 +129,16 @@ public: CLASSNAME_REGISTER( plConeIsect ); GETINTERFACE_ANY( plConeIsect, plVolumeIsect ); - void SetAngle(hsScalar rads); - void SetLength(hsScalar d); + void SetAngle(float rads); + void SetLength(float d); - hsScalar GetLength() const { return fCapped ? fLength : 0; } - hsScalar GetAngle() const { return fRadAngle; } + float GetLength() const { return fCapped ? fLength : 0; } + float GetAngle() const { return fRadAngle; } virtual void SetTransform(const hsMatrix44& l2w, const hsMatrix44& w2l); virtual plVolumeCullResult Test(const hsBounds3Ext& bnd) const; - virtual hsScalar Test(const hsPoint3& pos) const; + virtual float Test(const hsPoint3& pos) const; virtual void Read(hsStream* s, hsResMgr* mgr); virtual void Write(hsStream* s, hsResMgr* mgr); @@ -149,15 +149,15 @@ class plCylinderIsect : public plVolumeIsect protected: hsPoint3 fTop; hsPoint3 fBot; - hsScalar fRadius; + float fRadius; hsPoint3 fWorldBot; hsVector3 fWorldNorm; - hsScalar fLength; - hsScalar fMin; - hsScalar fMax; + float fLength; + float fMin; + float fMax; - void ISetupCyl(const hsPoint3& wTop, const hsPoint3& wBot, hsScalar radius); + void ISetupCyl(const hsPoint3& wTop, const hsPoint3& wBot, float radius); public: plCylinderIsect(); @@ -166,13 +166,13 @@ public: CLASSNAME_REGISTER( plCylinderIsect ); GETINTERFACE_ANY( plCylinderIsect, plVolumeIsect ); - void SetCylinder(const hsPoint3& lTop, const hsPoint3& lBot, hsScalar radius); - void SetCylinder(const hsPoint3& lBot, const hsVector3& axis, hsScalar radius); + void SetCylinder(const hsPoint3& lTop, const hsPoint3& lBot, float radius); + void SetCylinder(const hsPoint3& lBot, const hsVector3& axis, float radius); virtual void SetTransform(const hsMatrix44& l2w, const hsMatrix44& w2l); virtual plVolumeCullResult Test(const hsBounds3Ext& bnd) const; - virtual hsScalar Test(const hsPoint3& pos) const; + virtual float Test(const hsPoint3& pos) const; virtual void Read(hsStream* s, hsResMgr* mgr); virtual void Write(hsStream* s, hsResMgr* mgr); @@ -185,8 +185,8 @@ protected: { public: hsVector3 fNorm; - hsScalar fMin; - hsScalar fMax; + float fMin; + float fMax; hsPoint3 fPosOne; hsPoint3 fPosTwo; @@ -201,14 +201,14 @@ public: GETINTERFACE_ANY( plParallelIsect, plVolumeIsect ); void SetNumPlanes(int n); // each plane is really two parallel planes - UInt16 GetNumPlanes() const { return fPlanes.GetCount(); } + uint16_t GetNumPlanes() const { return fPlanes.GetCount(); } void SetPlane(int which, const hsPoint3& locPosOne, const hsPoint3& locPosTwo); virtual void SetTransform(const hsMatrix44& l2w, const hsMatrix44& w2l); virtual plVolumeCullResult Test(const hsBounds3Ext& bnd) const; - virtual hsScalar Test(const hsPoint3& pos) const; + virtual float Test(const hsPoint3& pos) const; virtual void Read(hsStream* s, hsResMgr* mgr); virtual void Write(hsStream* s, hsResMgr* mgr); @@ -221,11 +221,11 @@ protected: { public: hsVector3 fNorm; - hsScalar fDist; + float fDist; hsPoint3 fPos; hsVector3 fWorldNorm; - hsScalar fWorldDist; + float fWorldDist; }; hsTArray fPlanes; @@ -238,14 +238,14 @@ public: GETINTERFACE_ANY( plConvexIsect, plVolumeIsect ); void ClearPlanes() { fPlanes.SetCount(0); } - void AddPlaneUnchecked(const hsVector3& n, hsScalar dist); // no validation here + void AddPlaneUnchecked(const hsVector3& n, float dist); // no validation here void AddPlane(const hsVector3& n, const hsPoint3& p); - UInt16 GetNumPlanes() const { return fPlanes.GetCount(); } + uint16_t GetNumPlanes() const { return fPlanes.GetCount(); } virtual void SetTransform(const hsMatrix44& l2w, const hsMatrix44& w2l); virtual plVolumeCullResult Test(const hsBounds3Ext& bnd) const; - virtual hsScalar Test(const hsPoint3& pos) const; + virtual float Test(const hsPoint3& pos) const; virtual void Read(hsStream* s, hsResMgr* mgr); virtual void Write(hsStream* s, hsResMgr* mgr); @@ -268,7 +268,7 @@ public: virtual void SetTransform(const hsMatrix44& l2w, const hsMatrix44& w2l); virtual plVolumeCullResult Test(const hsBounds3Ext& bnd) const; - virtual hsScalar Test(const hsPoint3& pos) const; + virtual float Test(const hsPoint3& pos) const; virtual void Read(hsStream* s, hsResMgr* mgr); virtual void Write(hsStream* s, hsResMgr* mgr); @@ -287,7 +287,7 @@ public: GETINTERFACE_ANY( plComplexIsect, plVolumeIsect ); void AddVolume(plVolumeIsect* v); // Will capture pointer - UInt16 GetNumVolumes() const { return fVolumes.GetCount(); } + uint16_t GetNumVolumes() const { return fVolumes.GetCount(); } virtual void SetTransform(const hsMatrix44& l2w, const hsMatrix44& w2l); @@ -305,7 +305,7 @@ public: GETINTERFACE_ANY( plUnionIsect, plComplexIsect ); virtual plVolumeCullResult Test(const hsBounds3Ext& bnd) const; - virtual hsScalar Test(const hsPoint3& pos) const; + virtual float Test(const hsPoint3& pos) const; }; class plIntersectionIsect : public plComplexIsect @@ -318,7 +318,7 @@ public: GETINTERFACE_ANY( plIntersectionIsect, plComplexIsect ); virtual plVolumeCullResult Test(const hsBounds3Ext& bnd) const; - virtual hsScalar Test(const hsPoint3& pos) const; + virtual float Test(const hsPoint3& pos) const; }; #endif // plVolumeIsect_inc diff --git a/Sources/Plasma/PubUtilLib/plJPEG/plJPEG.cpp b/Sources/Plasma/PubUtilLib/plJPEG/plJPEG.cpp index 77c130b8..cceca6f7 100644 --- a/Sources/Plasma/PubUtilLib/plJPEG/plJPEG.cpp +++ b/Sources/Plasma/PubUtilLib/plJPEG/plJPEG.cpp @@ -50,11 +50,11 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // // /////////////////////////////////////////////////////////////////////////////// -#include "hsTypes.h" +#include "HeadSpin.h" #include "plJPEG.h" #include "hsStream.h" #include "hsExceptions.h" -#include "hsUtils.h" + #include "plGImage/plMipmap.h" #include @@ -115,11 +115,9 @@ const char *plJPEG::GetLastError( void ) plMipmap *plJPEG::IRead( hsStream *inStream ) { - MemPushDisableTracking(); - plMipmap *newMipmap = nil; - UInt8 *jpegSourceBuffer = nil; - UInt32 jpegSourceSize; + uint8_t *jpegSourceBuffer = nil; + uint32_t jpegSourceSize; struct jpeg_decompress_struct cinfo; struct jpeg_error_mgr jerr; @@ -143,7 +141,7 @@ plMipmap *plJPEG::IRead( hsStream *inStream ) /// JPEG stream into a separate buffer before we can decode it. Which means we ALSO /// have to write/read a length of said buffer. Such is life, I guess... jpegSourceSize = inStream->ReadLE32(); - jpegSourceBuffer = TRACKED_NEW UInt8[ jpegSourceSize ]; + jpegSourceBuffer = new uint8_t[ jpegSourceSize ]; if( jpegSourceBuffer == nil ) { // waah. @@ -183,7 +181,7 @@ plMipmap *plJPEG::IRead( hsStream *inStream ) (void) jpeg_start_decompress( &cinfo ); /// Construct a new mipmap to hold everything - newMipmap = TRACKED_NEW plMipmap( cinfo.output_width, cinfo.output_height, plMipmap::kRGB32Config, 1, plMipmap::kJPEGCompression ); + newMipmap = new plMipmap( cinfo.output_width, cinfo.output_height, plMipmap::kRGB32Config, 1, plMipmap::kJPEGCompression ); if( newMipmap == nil || newMipmap->GetImage() == nil ) { @@ -194,9 +192,9 @@ plMipmap *plJPEG::IRead( hsStream *inStream ) JSAMPROW jbuffer; int row_stride = cinfo.output_width * cinfo.output_components; int out_stride = cinfo.output_width * 4; // Decompress to RGBA - jbuffer = TRACKED_NEW JSAMPLE[row_stride]; + jbuffer = new JSAMPLE[row_stride]; - UInt8 *destp = (UInt8 *)newMipmap->GetImage(); + uint8_t *destp = (uint8_t *)newMipmap->GetImage(); while( cinfo.output_scanline < cinfo.output_height ) { (void) jpeg_read_scanlines( &cinfo, &jbuffer, 1 ); @@ -216,7 +214,7 @@ plMipmap *plJPEG::IRead( hsStream *inStream ) delete [] jbuffer; // Sometimes life just sucks - ISwapRGBAComponents( (UInt32 *)newMipmap->GetImage(), newMipmap->GetWidth() * newMipmap->GetHeight() ); + ISwapRGBAComponents( (uint32_t *)newMipmap->GetImage(), newMipmap->GetWidth() * newMipmap->GetHeight() ); } catch( ... ) { @@ -229,7 +227,6 @@ plMipmap *plJPEG::IRead( hsStream *inStream ) // Clean up the JPEG Library jpeg_destroy_decompress( &cinfo ); - MemPopDisableTracking(); // All done! return newMipmap; @@ -237,13 +234,13 @@ plMipmap *plJPEG::IRead( hsStream *inStream ) plMipmap* plJPEG::ReadFromFile( const char *fileName ) { - wchar* wFilename = hsStringToWString(fileName); + wchar_t* wFilename = hsStringToWString(fileName); plMipmap* retVal = ReadFromFile(wFilename); delete [] wFilename; return retVal; } -plMipmap* plJPEG::ReadFromFile( const wchar *fileName ) +plMipmap* plJPEG::ReadFromFile( const wchar_t *fileName ) { // we use a stream because the IJL can't handle unicode hsRAMStream tempstream; @@ -254,8 +251,8 @@ plMipmap* plJPEG::ReadFromFile( const wchar *fileName ) // The stream reader for JPEGs expects a 32-bit size at the start, // so insert that into the stream before passing it on in.FastFwd(); - UInt32 fsize = in.GetPosition(); - UInt8 *tempbuffer = TRACKED_NEW UInt8[fsize]; + uint32_t fsize = in.GetPosition(); + uint8_t *tempbuffer = new uint8_t[fsize]; in.Rewind(); in.Read(fsize, tempbuffer); tempstream.WriteLE32(fsize); @@ -274,8 +271,8 @@ plMipmap* plJPEG::ReadFromFile( const wchar *fileName ) hsBool plJPEG::IWrite( plMipmap *source, hsStream *outStream ) { hsBool result = true, swapped = false; - UInt8 *jpgBuffer = nil; - UInt32 jpgBufferSize = 0; + uint8_t *jpgBuffer = nil; + uint32_t jpgBufferSize = 0; struct jpeg_compress_struct cinfo; struct jpeg_error_mgr jerr; @@ -292,13 +289,13 @@ hsBool plJPEG::IWrite( plMipmap *source, hsStream *outStream ) // Create a buffer to hold the data jpgBufferSize = source->GetWidth() * source->GetHeight() * 3; - jpgBuffer = TRACKED_NEW UInt8[ jpgBufferSize ]; + jpgBuffer = new uint8_t[ jpgBufferSize ]; if( jpgBuffer == nil ) { ERREXIT1( &cinfo, JERR_OUT_OF_MEMORY, 0 ); } - UInt8 *bufferAddr = jpgBuffer; + uint8_t *bufferAddr = jpgBuffer; unsigned long bufferSize = jpgBufferSize; jpeg_mem_dest( &cinfo, &bufferAddr, &bufferSize ); @@ -318,16 +315,16 @@ hsBool plJPEG::IWrite( plMipmap *source, hsStream *outStream ) jpeg_start_compress( &cinfo, TRUE ); // Sometimes life just sucks - ISwapRGBAComponents( (UInt32 *)source->GetImage(), source->GetWidth() * source->GetHeight() ); + ISwapRGBAComponents( (uint32_t *)source->GetImage(), source->GetWidth() * source->GetHeight() ); swapped = true; // Write it! JSAMPROW jbuffer; int in_stride = cinfo.image_width * 4; // Input is always RGBA int row_stride = cinfo.image_width * cinfo.input_components; - jbuffer = TRACKED_NEW JSAMPLE[row_stride]; + jbuffer = new JSAMPLE[row_stride]; - UInt8 *srcp = (UInt8 *)source->GetImage(); + uint8_t *srcp = (uint8_t *)source->GetImage(); while( cinfo.next_scanline < cinfo.image_height ) { for( size_t pixel = 0; pixel < cinfo.image_width; ++pixel ) @@ -358,20 +355,20 @@ hsBool plJPEG::IWrite( plMipmap *source, hsStream *outStream ) jpeg_destroy_compress( &cinfo ); if( swapped ) - ISwapRGBAComponents( (UInt32 *)source->GetImage(), source->GetWidth() * source->GetHeight() ); + ISwapRGBAComponents( (uint32_t *)source->GetImage(), source->GetWidth() * source->GetHeight() ); return result; } hsBool plJPEG::WriteToFile( const char *fileName, plMipmap *sourceData ) { - wchar* wFilename = hsStringToWString(fileName); + wchar_t* wFilename = hsStringToWString(fileName); hsBool retVal = WriteToFile(wFilename, sourceData); delete [] wFilename; return retVal; } -hsBool plJPEG::WriteToFile( const wchar *fileName, plMipmap *sourceData ) +hsBool plJPEG::WriteToFile( const wchar_t *fileName, plMipmap *sourceData ) { // we use a stream because the IJL can't handle unicode hsRAMStream tempstream; @@ -384,8 +381,8 @@ hsBool plJPEG::WriteToFile( const wchar *fileName, plMipmap *sourceData ) // The stream writer for JPEGs prepends a 32-bit size, // so remove that from the stream before saving to a file tempstream.Rewind(); - UInt32 fsize = tempstream.ReadLE32(); - UInt8 *tempbuffer = TRACKED_NEW UInt8[fsize]; + uint32_t fsize = tempstream.ReadLE32(); + uint8_t *tempbuffer = new uint8_t[fsize]; tempstream.Read(fsize, tempbuffer); out.Write(fsize, tempbuffer); @@ -397,7 +394,7 @@ hsBool plJPEG::WriteToFile( const wchar *fileName, plMipmap *sourceData ) //// ISwapRGBAComponents ////////////////////////////////////////////////////// -void plJPEG::ISwapRGBAComponents( UInt32 *data, UInt32 count ) +void plJPEG::ISwapRGBAComponents( uint32_t *data, uint32_t count ) { while( count-- ) { diff --git a/Sources/Plasma/PubUtilLib/plJPEG/plJPEG.h b/Sources/Plasma/PubUtilLib/plJPEG/plJPEG.h index 9948c6c8..7aa4661e 100644 --- a/Sources/Plasma/PubUtilLib/plJPEG/plJPEG.h +++ b/Sources/Plasma/PubUtilLib/plJPEG/plJPEG.h @@ -63,26 +63,26 @@ class plJPEG { protected: - UInt8 fWriteQuality; + uint8_t fWriteQuality; // Pick one... plMipmap *IRead( hsStream *inStream ); hsBool IWrite( plMipmap *source, hsStream *outStream ); - void ISwapRGBAComponents( UInt32 *data, UInt32 count ); + void ISwapRGBAComponents( uint32_t *data, uint32_t count ); public: plMipmap *ReadFromStream( hsStream *inStream ) { return IRead( inStream ); } plMipmap *ReadFromFile( const char *fileName ); - plMipmap *ReadFromFile( const wchar *fileName ); + plMipmap *ReadFromFile( const wchar_t *fileName ); hsBool WriteToStream( hsStream *outStream, plMipmap *sourceData ) { return IWrite( sourceData, outStream ); } hsBool WriteToFile( const char *fileName, plMipmap *sourceData ); - hsBool WriteToFile( const wchar *fileName, plMipmap *sourceData ); + hsBool WriteToFile( const wchar_t *fileName, plMipmap *sourceData ); // Range is 0 (worst) to 100 (best) - void SetWriteQuality( UInt8 q ) { fWriteQuality = q; } + void SetWriteQuality( uint8_t q ) { fWriteQuality = q; } const char *GetLastError( void ); diff --git a/Sources/Plasma/PubUtilLib/plMath/hsNoiseFunc.cpp b/Sources/Plasma/PubUtilLib/plMath/hsNoiseFunc.cpp index 82434c48..7e3a43dc 100644 --- a/Sources/Plasma/PubUtilLib/plMath/hsNoiseFunc.cpp +++ b/Sources/Plasma/PubUtilLib/plMath/hsNoiseFunc.cpp @@ -40,8 +40,8 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ #include "hsNoiseFunc.h" -#include "hsTypes.h" -#include "hsScalar.h" +#include "HeadSpin.h" + #include "hsGeometry3.h" hsNoiseFunc::hsNoiseFunc() @@ -52,7 +52,7 @@ hsNoiseFunc::~hsNoiseFunc() { } -void hsNoiseFunc::Seed(UInt32 s) +void hsNoiseFunc::Seed(uint32_t s) { srand(s); } @@ -67,7 +67,7 @@ hsTableNoise::~hsTableNoise() delete [] fTable; } -void hsTableNoise::SetTable(int len, hsScalar* arr) +void hsTableNoise::SetTable(int len, float* arr) { fTableLen = len; @@ -78,7 +78,7 @@ void hsTableNoise::SetTable(int len, hsScalar* arr) return; } - fTable = TRACKED_NEW hsScalar[len+2]; + fTable = new float[len+2]; int i; for( i = 0; i < len; i++ ) @@ -88,67 +88,67 @@ void hsTableNoise::SetTable(int len, hsScalar* arr) } -hsScalar hsTableNoise::Noise(hsScalar lo, hsScalar hi, hsScalar t) +float hsTableNoise::Noise(float lo, float hi, float t) { hsAssert(fTableLen, "Badly initialized table noise function"); - hsScalar r = hsScalar(rand()) / hsScalar(RAND_MAX); + float r = float(rand()) / float(RAND_MAX); r = lo + (hi - lo) * r; if( t < 0 ) t = 0; - else if( t > hsScalar1 ) - t = hsScalar1; + else if( t > 1.f ) + t = 1.f; - hsScalar tIdx = t * fTableLen; - UInt32 idx = UInt32(tIdx); - hsScalar frac = tIdx - hsScalar(idx); + float tIdx = t * fTableLen; + uint32_t idx = uint32_t(tIdx); + float frac = tIdx - float(idx); hsAssert((idx >= 0)&&(idx <= fTableLen), "Noise parm t out of range [0..1]"); - hsScalar scale = fTable[idx] + (fTable[idx+1] - fTable[idx]) * frac; + float scale = fTable[idx] + (fTable[idx+1] - fTable[idx]) * frac; r *= scale; return r; } -hsScalar hsTableNoise::NoisePoint(const hsPoint3& p, hsScalar lo, hsScalar hi, hsScalar t) +float hsTableNoise::NoisePoint(const hsPoint3& p, float lo, float hi, float t) { hsAssert(fTableLen, "Badly initialized table noise function"); - UInt32 sX = *((UInt32*)&p.fX); - UInt32 sY = *((UInt32*)&p.fY); - UInt32 sZ = *((UInt32*)&p.fZ); + uint32_t sX = *((uint32_t*)&p.fX); + uint32_t sY = *((uint32_t*)&p.fY); + uint32_t sZ = *((uint32_t*)&p.fZ); - UInt32 sAll = ((((sX & 0x07800000) >> 16) | ((sX & 0x007fffff) >> 17)) << 20) + uint32_t sAll = ((((sX & 0x07800000) >> 16) | ((sX & 0x007fffff) >> 17)) << 20) | ((((sY & 0x07800000) >> 16) | ((sY & 0x007fffff) >> 17)) << 10) | ((((sZ & 0x07800000) >> 16) | ((sZ & 0x007fffff) >> 17)) ); - const UInt32 kExp = 0x3f800000; - const UInt32 kMsk = 0x007fffff; + const uint32_t kExp = 0x3f800000; + const uint32_t kMsk = 0x007fffff; - const UInt32 kA = 1665636L; - const UInt32 kC = 1013904223L; + const uint32_t kA = 1665636L; + const uint32_t kC = 1013904223L; - UInt32 iR = kA * sAll + kC; + uint32_t iR = kA * sAll + kC; iR &= kMsk; iR |= kExp; - hsScalar r = (*(float*)&iR) - 1.f; + float r = (*(float*)&iR) - 1.f; r = lo + (hi - lo) * r; if( t < 0 ) t = 0; - else if( t > hsScalar1 ) - t = hsScalar1; + else if( t > 1.f ) + t = 1.f; - hsScalar tIdx = t * fTableLen; - UInt32 idx = UInt32(tIdx); - hsScalar frac = tIdx - hsScalar(idx); + float tIdx = t * fTableLen; + uint32_t idx = uint32_t(tIdx); + float frac = tIdx - float(idx); hsAssert((idx >= 0)&&(idx <= fTableLen), "Noise parm t out of range [0..1]"); - hsScalar scale = fTable[idx] + (fTable[idx+1] - fTable[idx]) * frac; + float scale = fTable[idx] + (fTable[idx+1] - fTable[idx]) * frac; r *= scale; diff --git a/Sources/Plasma/PubUtilLib/plMath/hsNoiseFunc.h b/Sources/Plasma/PubUtilLib/plMath/hsNoiseFunc.h index b91133f5..69ff288b 100644 --- a/Sources/Plasma/PubUtilLib/plMath/hsNoiseFunc.h +++ b/Sources/Plasma/PubUtilLib/plMath/hsNoiseFunc.h @@ -43,8 +43,8 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #ifndef hsNoiseFunc_inc #define hsNoiseFunc_inc +#include "HeadSpin.h" #include "hsRefCnt.h" -#include "hsScalar.h" struct hsPoint3; @@ -54,29 +54,29 @@ public: hsNoiseFunc(); virtual ~hsNoiseFunc(); - virtual void Seed(UInt32 s); - virtual hsScalar Noise(hsScalar lo=0, hsScalar hi=hsScalar1, hsScalar t=0) = 0; // t = [0..1] - returns random num [lo..hi] scaled by fTable[t] + virtual void Seed(uint32_t s); + virtual float Noise(float lo=0, float hi=1.f, float t=0) = 0; // t = [0..1] - returns random num [lo..hi] scaled by fTable[t] - virtual hsScalar NoisePoint(const hsPoint3& p, hsScalar lo=0, hsScalar hi=hsScalar1, hsScalar t=0) = 0; // t = [0..1] - returns random num [lo..hi] scaled by fTable[t] + virtual float NoisePoint(const hsPoint3& p, float lo=0, float hi=1.f, float t=0) = 0; // t = [0..1] - returns random num [lo..hi] scaled by fTable[t] }; class hsTableNoise : public hsNoiseFunc // should inherit from keyed object { protected: - hsScalar* fTable; - UInt32 fTableLen; + float* fTable; + uint32_t fTableLen; public: hsTableNoise(); virtual ~hsTableNoise(); - void SetTable(int len, hsScalar* arr); // copies. arr should be hsScalars in range [0..1] - hsScalar* GetTable(int& len) { len = fTableLen; return fTable; } // should be debug only, access through noise func + void SetTable(int len, float* arr); // copies. arr should be hsScalars in range [0..1] + float* GetTable(int& len) { len = fTableLen; return fTable; } // should be debug only, access through noise func - virtual hsScalar Noise(hsScalar lo=0, hsScalar hi=hsScalar1, hsScalar t=0); // t = [0..1] - returns random num [lo..hi] scaled by fTable[t] + virtual float Noise(float lo=0, float hi=1.f, float t=0); // t = [0..1] - returns random num [lo..hi] scaled by fTable[t] - virtual hsScalar NoisePoint(const hsPoint3& p, hsScalar lo=0, hsScalar hi=hsScalar1, hsScalar t=0); // t = [0..1] - returns random num [lo..hi] scaled by fTable[t] + virtual float NoisePoint(const hsPoint3& p, float lo=0, float hi=1.f, float t=0); // t = [0..1] - returns random num [lo..hi] scaled by fTable[t] }; #endif // hsNoiseFunc_inc diff --git a/Sources/Plasma/PubUtilLib/plMath/hsRadixSort.cpp b/Sources/Plasma/PubUtilLib/plMath/hsRadixSort.cpp index ad088e54..70cbe7f5 100644 --- a/Sources/Plasma/PubUtilLib/plMath/hsRadixSort.cpp +++ b/Sources/Plasma/PubUtilLib/plMath/hsRadixSort.cpp @@ -40,7 +40,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "hsMemory.h" #include "hsRadixSort.h" @@ -135,7 +135,7 @@ void hsRadixSort::IReverse() } } -hsRadixSort::Elem* hsRadixSort::Sort(Elem* inList, UInt32 flags) +hsRadixSort::Elem* hsRadixSort::Sort(Elem* inList, uint32_t flags) { if( !(inList && inList->fNext) ) return inList; diff --git a/Sources/Plasma/PubUtilLib/plMath/hsRadixSort.h b/Sources/Plasma/PubUtilLib/plMath/hsRadixSort.h index f2b1bb74..7c35a1b2 100644 --- a/Sources/Plasma/PubUtilLib/plMath/hsRadixSort.h +++ b/Sources/Plasma/PubUtilLib/plMath/hsRadixSort.h @@ -84,7 +84,7 @@ public: hsRadixSort(); - Elem* Sort(Elem* inList, UInt32 flags = 0); + Elem* Sort(Elem* inList, uint32_t flags = 0); }; diff --git a/Sources/Plasma/PubUtilLib/plMath/hsSearchVersion.h b/Sources/Plasma/PubUtilLib/plMath/hsSearchVersion.h index feba4a08..b5e36315 100644 --- a/Sources/Plasma/PubUtilLib/plMath/hsSearchVersion.h +++ b/Sources/Plasma/PubUtilLib/plMath/hsSearchVersion.h @@ -43,7 +43,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #ifndef hsSearchVersion_inc #define hsSearchVersion_inc -#include "hsTypes.h" +#include "HeadSpin.h" /* do a template of lists to search for a matching entry. basic idea is that @@ -59,15 +59,15 @@ set from 0 to max forever index. template class hsVersionNode { protected: T fData; - Int32 fIndex; + int32_t fIndex; hsVersionNode* fNext; public: - hsVersionNode(const UInt32 idx, const T &data) : fIndex(idx), fNext(nil) { fData = data; } + hsVersionNode(const uint32_t idx, const T &data) : fIndex(idx), fNext(nil) { fData = data; } ~hsVersionNode() { delete fNext; } hsVersionNode* Next() const { return fNext; } - Int32 Index() const { return fIndex; } + int32_t Index() const { return fIndex; } inline void Append(hsVersionNode* next); inline int operator==(const T& o) const; @@ -92,40 +92,40 @@ template void hsVersionNode::Append(hsVersionNode* next) template class hsSearchVersion { protected: - UInt32 fLength; + uint32_t fLength; hsVersionNode** fArray; - UInt32 fNextIndex; - UInt32 fNumIndex; - UInt32 fIncIndex; + uint32_t fNextIndex; + uint32_t fNumIndex; + uint32_t fIncIndex; T** fBackArray; void ICheckBackArray(); public: - hsSearchVersion(UInt32 len, UInt32 inc = 0); + hsSearchVersion(uint32_t len, uint32_t inc = 0); ~hsSearchVersion(); - T& operator[]( Int32 index ); + T& operator[]( int32_t index ); - Int32 Find(int where, const T& what, hsBool forceUnique=false); + int32_t Find(int where, const T& what, hsBool forceUnique=false); - UInt32 GetCount() const { return fNextIndex; } + uint32_t GetCount() const { return fNextIndex; } }; -template T& hsSearchVersion::operator[]( Int32 index ) +template T& hsSearchVersion::operator[]( int32_t index ) { - hsDebugCode(hsThrowIfBadParam((UInt32)index >= (UInt32)fNextIndex);) + hsDebugCode(hsThrowIfBadParam((uint32_t)index >= (uint32_t)fNextIndex);) return *fBackArray[index]; } -template hsSearchVersion::hsSearchVersion(UInt32 len, UInt32 inc) +template hsSearchVersion::hsSearchVersion(uint32_t len, uint32_t inc) : fNextIndex(0) { fIncIndex = inc ? inc : len; fLength = len; - fArray = TRACKED_NEW hsVersionNode*[fLength]; + fArray = new hsVersionNode*[fLength]; HSMemory::Clear(fArray, fLength*sizeof(*fArray)); - fBackArray = TRACKED_NEW T*[fNumIndex = fLength]; + fBackArray = new T*[fNumIndex = fLength]; } template hsSearchVersion::~hsSearchVersion() @@ -141,7 +141,7 @@ template void hsSearchVersion::ICheckBackArray() { if( fNextIndex >= fNumIndex ) { - T** newBackArray = TRACKED_NEW T*[fNumIndex + fIncIndex]; + T** newBackArray = new T*[fNumIndex + fIncIndex]; HSMemory::BlockMove(fBackArray, newBackArray, fNextIndex*sizeof(T*)); delete [] fBackArray; fBackArray = newBackArray; @@ -149,7 +149,7 @@ template void hsSearchVersion::ICheckBackArray() } } -template Int32 hsSearchVersion::Find(int where, const T&what, hsBool forceUnique) +template int32_t hsSearchVersion::Find(int where, const T&what, hsBool forceUnique) { hsVersionNode* curr = fArray[where]; @@ -157,7 +157,7 @@ template Int32 hsSearchVersion::Find(int where, const T&what, hsBoo if( !curr ) { - hsVersionNode* next = TRACKED_NEW hsVersionNode(fNextIndex, what); + hsVersionNode* next = new hsVersionNode(fNextIndex, what); fArray[where] = next; fBackArray[fNextIndex] = &next->GetData(); return fNextIndex++; @@ -172,7 +172,7 @@ template Int32 hsSearchVersion::Find(int where, const T&what, hsBoo if( curr->Next() ) return curr->Next()->Index(); - hsVersionNode* next = TRACKED_NEW hsVersionNode(fNextIndex, what); + hsVersionNode* next = new hsVersionNode(fNextIndex, what); curr->Append(next); fBackArray[fNextIndex] = &next->GetData(); return fNextIndex++; diff --git a/Sources/Plasma/PubUtilLib/plMath/plAvg.cpp b/Sources/Plasma/PubUtilLib/plMath/plAvg.cpp index aff1b85b..f760f5db 100644 --- a/Sources/Plasma/PubUtilLib/plMath/plAvg.cpp +++ b/Sources/Plasma/PubUtilLib/plMath/plAvg.cpp @@ -40,7 +40,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "plAvg.h" #include diff --git a/Sources/Plasma/PubUtilLib/plMath/plAvg.h b/Sources/Plasma/PubUtilLib/plMath/plAvg.h index 57c7626a..69494c50 100644 --- a/Sources/Plasma/PubUtilLib/plMath/plAvg.h +++ b/Sources/Plasma/PubUtilLib/plMath/plAvg.h @@ -42,7 +42,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #ifndef PL_AVG_H #define PL_AVG_H -#include "hsConfig.h" +#include "HeadSpin.h" #include "hsThread.h" #include "hsStlUtils.h" diff --git a/Sources/Plasma/PubUtilLib/plMath/plRandom.h b/Sources/Plasma/PubUtilLib/plMath/plRandom.h index 49aab02a..5e51c839 100644 --- a/Sources/Plasma/PubUtilLib/plMath/plRandom.h +++ b/Sources/Plasma/PubUtilLib/plMath/plRandom.h @@ -56,7 +56,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com class plRandom { protected: - mutable UInt32 fSeed; + mutable uint32_t fSeed; public: inline float RandNorm() const; inline int Rand() const; @@ -65,7 +65,7 @@ public: inline float RandMinusOneToOne() const; inline float RandZeroToOne() const; - UInt32 GetSeed() const { return fSeed; } + uint32_t GetSeed() const { return fSeed; } void SetSeed(int seed) { fSeed = seed; } plRandom(int seed = 1) : fSeed(seed) {} @@ -92,18 +92,18 @@ inline int plRandom::Rand() const #endif // FAST_Q } -// RandZeroToOne - take our usual random UInt32. +// RandZeroToOne - take our usual random uint32_t. // We're going to mask in an exponent to make it // a float in range [1..2). Then subtract 1.f to -// make it [0..1). We shift our random UInt32 down +// make it [0..1). We shift our random uint32_t down // by 9 because the upper bits are the most random. inline float plRandom::RandZeroToOne() const { #ifndef FAST_Q return Rand() * RandNorm(); #else // FAST_Q - const UInt32 kOneExp = 0x3f800000; - register UInt32 temp = kOneExp | (UInt32(Rand()) >> 9); + const uint32_t kOneExp = 0x3f800000; + register uint32_t temp = kOneExp | (uint32_t(Rand()) >> 9); return (*(float*)&temp) - 1.f; #endif // FAST_Q } @@ -116,8 +116,8 @@ inline float plRandom::RandMinusOneToOne() const #ifndef FAST_Q return RandZeroToOne() * 2.f - 1.f; #else // FAST_Q - const UInt32 kTwoExp = 0x40000000; - register UInt32 temp = kTwoExp | (UInt32(Rand()) >> 9); + const uint32_t kTwoExp = 0x40000000; + register uint32_t temp = kTwoExp | (uint32_t(Rand()) >> 9); return (*(float*)&temp) - 3.f; #endif // FAST_Q } diff --git a/Sources/Plasma/PubUtilLib/plMath/plTriUtils.cpp b/Sources/Plasma/PubUtilLib/plMath/plTriUtils.cpp index a80c7d22..cf2e4913 100644 --- a/Sources/Plasma/PubUtilLib/plMath/plTriUtils.cpp +++ b/Sources/Plasma/PubUtilLib/plMath/plTriUtils.cpp @@ -40,15 +40,16 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "hsGeometry3.h" +#include #include "plTriUtils.h" -static const hsScalar kAlmostZero = 1.e-5f; -static const hsScalar kPastZero = -kAlmostZero; -static const hsScalar kPastOne = 1.f + kAlmostZero; -static const hsScalar kAlmostOne = 1.f - kAlmostZero; -static const hsScalar kAlmostZeroSquared = kAlmostZero*kAlmostZero; +static const float kAlmostZero = 1.e-5f; +static const float kPastZero = -kAlmostZero; +static const float kPastOne = 1.f + kAlmostZero; +static const float kAlmostOne = 1.f - kAlmostZero; +static const float kAlmostZeroSquared = kAlmostZero*kAlmostZero; static inline hsVector3 Cross(const hsScalarTriple& p0, const hsScalarTriple& p1) { @@ -71,7 +72,7 @@ plTriUtils::Bary plTriUtils::ComputeBarycentricProjection(const hsPoint3& p0, co hsVector3 v02(&p0, &p2); hsVector3 norm = Cross(v12, v02); - hsScalar invLenSq12 = norm.MagnitudeSquared(); + float invLenSq12 = norm.MagnitudeSquared(); if( invLenSq12 < kAlmostZero ) return kDegenerateTri; // degenerate triangle @@ -91,7 +92,7 @@ plTriUtils::Bary plTriUtils::ComputeBarycentric(const hsPoint3& p0, const hsPoin hsVector3 v12(&p1, &p2); hsVector3 v02(&p0, &p2); hsVector3 norm = Cross(v12, v02); - hsScalar invLenSq12 = norm.MagnitudeSquared(); + float invLenSq12 = norm.MagnitudeSquared(); if( invLenSq12 < kAlmostZero ) return kDegenerateTri; // degenerate triangle @@ -105,11 +106,11 @@ plTriUtils::Bary plTriUtils::ComputeBarycentric(const hsPoint3& p0, const hsPoin } -plTriUtils::Bary plTriUtils::IComputeBarycentric(const hsVector3& v12, hsScalar invLenSq12, const hsVector3& v0, const hsVector3& v1, hsPoint3& out) +plTriUtils::Bary plTriUtils::IComputeBarycentric(const hsVector3& v12, float invLenSq12, const hsVector3& v0, const hsVector3& v1, hsPoint3& out) { - UInt32 state = 0; + uint32_t state = 0; - hsScalar lenSq0 = v0.MagnitudeSquared(); + float lenSq0 = v0.MagnitudeSquared(); if( lenSq0 < kAlmostZeroSquared ) { // On edge p1-p2; @@ -119,7 +120,7 @@ plTriUtils::Bary plTriUtils::IComputeBarycentric(const hsVector3& v12, hsScalar else { out[0] = lenSq0 * invLenSq12; - out[0] = hsSquareRoot(out[0]); + out[0] = sqrt(out[0]); // if( v0.InnerProduct(v12) < 0 ) { @@ -132,7 +133,7 @@ plTriUtils::Bary plTriUtils::IComputeBarycentric(const hsVector3& v12, hsScalar state |= kOnVertex0; } - hsScalar lenSq1 = v1.MagnitudeSquared(); + float lenSq1 = v1.MagnitudeSquared(); if( lenSq1 < kAlmostZeroSquared ) { // On edge p0-p2 @@ -142,7 +143,7 @@ plTriUtils::Bary plTriUtils::IComputeBarycentric(const hsVector3& v12, hsScalar else { out[1] = lenSq1 * invLenSq12; - out[1] = hsSquareRoot(out[1]); + out[1] = sqrt(out[1]); if( v1.InnerProduct(v12) < 0 ) { @@ -194,7 +195,7 @@ plTriUtils::Bary plTriUtils::IComputeBarycentric(const hsVector3& v12, hsScalar int plTriUtils::ISelectAxis(const hsVector3& norm) { int retVal = -2; - hsScalar maxDim = 0; + float maxDim = 0; int i; for( i = 0; i < 3; i++ ) { @@ -223,16 +224,16 @@ hsBool plTriUtils::IFastBarycentric(int iAx, const hsPoint3& p0, const hsPoint3& hsVector3 v02(&p0, &p2); hsVector3 v12(&p1, &p2); - hsScalar totArea = v02[iAx] * v12[jAx] - v02[jAx] * v12[iAx]; + float totArea = v02[iAx] * v12[jAx] - v02[jAx] * v12[iAx]; hsAssert(totArea != 0, "Should have already filtered degerate tris and degenerate projection"); - hsScalar invTotArea = 1.f / totArea; + float invTotArea = 1.f / totArea; hsVector3 vp2(&p, &p2); - hsScalar aArea = vp2[iAx] * v12[jAx] - vp2[jAx] * v12[iAx]; + float aArea = vp2[iAx] * v12[jAx] - vp2[jAx] * v12[iAx]; - hsScalar bArea = v02[iAx] * vp2[jAx] - v02[jAx] * vp2[iAx]; + float bArea = v02[iAx] * vp2[jAx] - v02[jAx] * vp2[iAx]; out[0] = aArea * invTotArea; out[1] = bArea * invTotArea; @@ -247,14 +248,14 @@ hsBool plTriUtils::FastBarycentricProjection(const hsPoint3& p0, const hsPoint3& hsVector3 v12(&p1, &p2); hsVector3 norm = Cross(v12, v02); - hsScalar invLenSq12 = norm.MagnitudeSquared(); + float invLenSq12 = norm.MagnitudeSquared(); if( invLenSq12 < kAlmostZero ) return false; // degenerate triangle invLenSq12 = 1.f / invLenSq12; hsVector3 del(&p0, &p); - hsScalar delDotNormOverLenSq = del.InnerProduct(norm) * invLenSq12; + float delDotNormOverLenSq = del.InnerProduct(norm) * invLenSq12; p += norm * delDotNormOverLenSq; @@ -277,9 +278,9 @@ hsBool plTriUtils::FastBarycentric(const hsPoint3& p0, const hsPoint3& p1, const ////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////// -hsBool plTriUtils::ProjectOntoPlane(const hsVector3& norm, hsScalar dist, hsPoint3& p) +hsBool plTriUtils::ProjectOntoPlane(const hsVector3& norm, float dist, hsPoint3& p) { - hsScalar normMagSq = norm.MagnitudeSquared(); + float normMagSq = norm.MagnitudeSquared(); if( normMagSq > kAlmostZero ) { dist /= normMagSq; @@ -298,15 +299,15 @@ hsBool plTriUtils::ProjectOntoPlane(const hsPoint3& p0, const hsPoint3& p1, cons hsVector3 norm = v12 % v02; - hsScalar dist = norm.InnerProduct(p0 - p); + float dist = norm.InnerProduct(p0 - p); return ProjectOntoPlane(norm, dist, p); } -hsBool plTriUtils::ProjectOntoPlaneAlongVector(const hsVector3& norm, hsScalar dist, const hsVector3& vec, hsPoint3& p) +hsBool plTriUtils::ProjectOntoPlaneAlongVector(const hsVector3& norm, float dist, const hsVector3& vec, hsPoint3& p) { - hsScalar s = norm.InnerProduct(vec); - const hsScalar kAlmostZero = 1.e-5f; + float s = norm.InnerProduct(vec); + const float kAlmostZero = 1.e-5f; if( (s > kAlmostZero)||(s < kPastZero) ) { dist /= s; @@ -324,7 +325,7 @@ hsBool plTriUtils::ProjectOntoPlaneAlongVector(const hsPoint3& p0, const hsPoint hsVector3 v12(&p1, &p2); hsVector3 norm = v12 % v02; - hsScalar dist = norm.InnerProduct(p0 - p); + float dist = norm.InnerProduct(p0 - p); return ProjectOntoPlaneAlongVector(norm, dist, vec, p); } \ No newline at end of file diff --git a/Sources/Plasma/PubUtilLib/plMath/plTriUtils.h b/Sources/Plasma/PubUtilLib/plMath/plTriUtils.h index e1bf5715..704c2bc3 100644 --- a/Sources/Plasma/PubUtilLib/plMath/plTriUtils.h +++ b/Sources/Plasma/PubUtilLib/plMath/plTriUtils.h @@ -64,7 +64,7 @@ public: protected: - Bary IComputeBarycentric(const hsVector3& v12, hsScalar invLenSq12, const hsVector3& v0, const hsVector3& v1, hsPoint3& out); + Bary IComputeBarycentric(const hsVector3& v12, float invLenSq12, const hsVector3& v0, const hsVector3& v1, hsPoint3& out); int ISelectAxis(const hsVector3& norm); hsBool IFastBarycentric(int iAx, const hsPoint3& p0, const hsPoint3& p1, const hsPoint3& p2, const hsPoint3&p, hsPoint3& out); @@ -77,9 +77,9 @@ public: hsBool FastBarycentricProjection(const hsPoint3& p0, const hsPoint3& p1, const hsPoint3& p2, hsPoint3&p, hsPoint3& out); hsBool FastBarycentric(const hsPoint3& p0, const hsPoint3& p1, const hsPoint3& p2, const hsPoint3&p, hsPoint3& out); - hsBool ProjectOntoPlane(const hsVector3& norm, hsScalar dist, hsPoint3& p); + hsBool ProjectOntoPlane(const hsVector3& norm, float dist, hsPoint3& p); hsBool ProjectOntoPlane(const hsPoint3& p0, const hsPoint3& p1, const hsPoint3& p2, hsPoint3& p); - hsBool ProjectOntoPlaneAlongVector(const hsVector3& norm, hsScalar dist, const hsVector3& vec, hsPoint3& p); + hsBool ProjectOntoPlaneAlongVector(const hsVector3& norm, float dist, const hsVector3& vec, hsPoint3& p); hsBool ProjectOntoPlaneAlongVector(const hsPoint3& p0, const hsPoint3& p1, const hsPoint3& p2, const hsVector3& vec, hsPoint3& p); }; diff --git a/Sources/Plasma/PubUtilLib/plMessage/plActivatorMsg.h b/Sources/Plasma/PubUtilLib/plMessage/plActivatorMsg.h index 7150407c..5e07f84d 100644 --- a/Sources/Plasma/PubUtilLib/plMessage/plActivatorMsg.h +++ b/Sources/Plasma/PubUtilLib/plMessage/plActivatorMsg.h @@ -99,7 +99,7 @@ public: kExitUnTrigger, }; - UInt32 fTriggerType; + uint32_t fTriggerType; plKey fPickedObj; plKey fHiteeObj; plKey fHitterObj; diff --git a/Sources/Plasma/PubUtilLib/plMessage/plAnimCmdMsg.cpp b/Sources/Plasma/PubUtilLib/plMessage/plAnimCmdMsg.cpp index f2b9755d..6ee197c5 100644 --- a/Sources/Plasma/PubUtilLib/plMessage/plAnimCmdMsg.cpp +++ b/Sources/Plasma/PubUtilLib/plMessage/plAnimCmdMsg.cpp @@ -40,7 +40,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "plAnimCmdMsg.h" #include "hsStream.h" diff --git a/Sources/Plasma/PubUtilLib/plMessage/plAnimCmdMsg.h b/Sources/Plasma/PubUtilLib/plMessage/plAnimCmdMsg.h index de8d7c12..219da379 100644 --- a/Sources/Plasma/PubUtilLib/plMessage/plAnimCmdMsg.h +++ b/Sources/Plasma/PubUtilLib/plMessage/plAnimCmdMsg.h @@ -117,13 +117,13 @@ public: void SetLoopName(const char *name); const char *GetLoopName(); - hsScalar fBegin; - hsScalar fEnd; - hsScalar fLoopEnd; - hsScalar fLoopBegin; - hsScalar fSpeed; - hsScalar fSpeedChangeRate; - hsScalar fTime; + float fBegin; + float fEnd; + float fLoopEnd; + float fLoopBegin; + float fSpeed; + float fSpeedChangeRate; + float fTime; // IO void Read(hsStream* stream, hsResMgr* mgr); @@ -168,11 +168,11 @@ public: void SetAnimName(const char *name); const char *GetAnimName(); - hsScalar fBlend; - hsScalar fBlendRate; - hsScalar fAmp; - hsScalar fAmpRate; - hsScalar fAnimTime; + float fBlend; + float fBlendRate; + float fAmp; + float fAmpRate; + float fAnimTime; // IO void Read(hsStream* stream, hsResMgr* mgr); @@ -183,7 +183,7 @@ class plAGInstanceCallbackMsg : public plEventCallbackMsg { public: plAGInstanceCallbackMsg() : plEventCallbackMsg(), fInstance(nil) {} - plAGInstanceCallbackMsg(plKey receiver, CallbackEvent e, int idx=0, hsScalar t=0, Int16 repeats=-1, UInt16 user=0) : + plAGInstanceCallbackMsg(plKey receiver, CallbackEvent e, int idx=0, float t=0, int16_t repeats=-1, uint16_t user=0) : plEventCallbackMsg(receiver, e, idx, t, repeats, user), fInstance(nil) {} CLASSNAME_REGISTER( plAGInstanceCallbackMsg ); @@ -203,7 +203,7 @@ protected: public: plAGDetachCallbackMsg() : plEventCallbackMsg(), fAnimName(nil) {} - plAGDetachCallbackMsg(plKey receiver, CallbackEvent e, int idx=0, hsScalar t=0, Int16 repeats=-1, UInt16 user=0) : + plAGDetachCallbackMsg(plKey receiver, CallbackEvent e, int idx=0, float t=0, int16_t repeats=-1, uint16_t user=0) : plEventCallbackMsg(receiver, e, idx, t, repeats, user), fAnimName(nil) {} virtual ~plAGDetachCallbackMsg(); diff --git a/Sources/Plasma/PubUtilLib/plMessage/plAvCoopMsg.cpp b/Sources/Plasma/PubUtilLib/plMessage/plAvCoopMsg.cpp index a9847ec6..75e75ad4 100644 --- a/Sources/Plasma/PubUtilLib/plMessage/plAvCoopMsg.cpp +++ b/Sources/Plasma/PubUtilLib/plMessage/plAvCoopMsg.cpp @@ -72,7 +72,7 @@ plAvCoopMsg::~plAvCoopMsg() // plAvCoopMsg ----------------------------------- // ------------ -plAvCoopMsg::plAvCoopMsg(Command cmd, UInt32 id, UInt16 serial) +plAvCoopMsg::plAvCoopMsg(Command cmd, uint32_t id, uint16_t serial) : plMessage(nil, plAvatarMgr::GetInstance()->GetKey(), nil), fInitiatorID(id), fInitiatorSerial(serial), diff --git a/Sources/Plasma/PubUtilLib/plMessage/plAvCoopMsg.h b/Sources/Plasma/PubUtilLib/plMessage/plAvCoopMsg.h index bae44b03..9b0222a3 100644 --- a/Sources/Plasma/PubUtilLib/plMessage/plAvCoopMsg.h +++ b/Sources/Plasma/PubUtilLib/plMessage/plAvCoopMsg.h @@ -99,7 +99,7 @@ public: // constructors plAvCoopMsg(); - plAvCoopMsg(Command cmd, UInt32 id, UInt16 serial); + plAvCoopMsg(Command cmd, uint32_t id, uint16_t serial); plAvCoopMsg(plKey sender, plCoopCoordinator *coordinateur); ~plAvCoopMsg(); @@ -117,8 +117,8 @@ public: // ///////////////////////////////////////////////////////////////////////////////////// - UInt32 fInitiatorID; - UInt16 fInitiatorSerial; + uint32_t fInitiatorID; + uint16_t fInitiatorSerial; Command fCommand; diff --git a/Sources/Plasma/PubUtilLib/plMessage/plAvatarFootMsg.cpp b/Sources/Plasma/PubUtilLib/plMessage/plAvatarFootMsg.cpp index b6ee3881..8459649c 100644 --- a/Sources/Plasma/PubUtilLib/plMessage/plAvatarFootMsg.cpp +++ b/Sources/Plasma/PubUtilLib/plMessage/plAvatarFootMsg.cpp @@ -40,7 +40,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "plAvatarFootMsg.h" #include "hsStream.h" diff --git a/Sources/Plasma/PubUtilLib/plMessage/plAvatarMsg.cpp b/Sources/Plasma/PubUtilLib/plMessage/plAvatarMsg.cpp index 89f00a33..4b4f0c29 100644 --- a/Sources/Plasma/PubUtilLib/plMessage/plAvatarMsg.cpp +++ b/Sources/Plasma/PubUtilLib/plMessage/plAvatarMsg.cpp @@ -250,7 +250,7 @@ plAvSeekMsg::plAvSeekMsg() plAvSeekMsg::plAvSeekMsg(const plKey& sender, const plKey& receiver, const plKey &seekKey, float duration, hsBool smartSeek, plAvAlignment alignType, char *animName, hsBool noSeek, - UInt8 flags, plKey finishKey) + uint8_t flags, plKey finishKey) : plAvTaskMsg(sender, receiver), fSeekPoint(seekKey), fTargetPos(0, 0, 0), @@ -321,7 +321,7 @@ void plAvSeekMsg::Write(hsStream *stream, hsResMgr *mgr) stream->WriteLEScalar(fDuration); stream->WriteBool(fSmartSeek); stream->WriteSafeString(fAnimName); - stream->WriteLE16(static_cast(fAlignType)); + stream->WriteLE16(static_cast(fAlignType)); stream->WriteBool(fNoSeek); stream->WriteByte(fFlags); mgr->WriteKey(stream, fFinishKey); @@ -416,7 +416,7 @@ plAvBrainGenericMsg::plAvBrainGenericMsg() // canonical CTOR sender receiver type stage rewind transitionTime plAvBrainGenericMsg::plAvBrainGenericMsg(const plKey& sender, const plKey &receiver, - plAvBrainGenericMsg::Type type, int stage, hsBool rewind, hsScalar transitionTime) + plAvBrainGenericMsg::Type type, int stage, hsBool rewind, float transitionTime) : plAvatarMsg(sender, receiver), fType(type), fWhichStage(stage), @@ -430,8 +430,8 @@ plAvBrainGenericMsg::plAvBrainGenericMsg(const plKey& sender, const plKey &recei } plAvBrainGenericMsg::plAvBrainGenericMsg(const plKey& sender, const plKey &receiver, - Type type, int stage, hsBool setTime, hsScalar newTime, - hsBool setDirection, bool isForward, hsScalar transitiontime) + Type type, int stage, hsBool setTime, float newTime, + hsBool setDirection, bool isForward, float transitiontime) : plAvatarMsg(sender, receiver), fType(type), fWhichStage(stage), diff --git a/Sources/Plasma/PubUtilLib/plMessage/plAvatarMsg.h b/Sources/Plasma/PubUtilLib/plMessage/plAvatarMsg.h index 8c35d5d0..e4e6b451 100644 --- a/Sources/Plasma/PubUtilLib/plMessage/plAvatarMsg.h +++ b/Sources/Plasma/PubUtilLib/plMessage/plAvatarMsg.h @@ -190,7 +190,7 @@ public: plAvSeekMsg(); plAvSeekMsg(const plKey& sender, const plKey& receiver, const plKey &seekKey, float duration, hsBool smartSeek, plAvAlignment align = kAlignHandle, char *animName = nil, hsBool noSeek = false, - UInt8 flags = kSeekFlagForce3rdPersonOnStart, plKey finishKey = nil); + uint8_t flags = kSeekFlagForce3rdPersonOnStart, plKey finishKey = nil); // plasma protocol CLASSNAME_REGISTER( plAvSeekMsg ); @@ -214,7 +214,7 @@ public: hsBool fNoSeek; char *fAnimName; plAvAlignment fAlignType; - UInt8 fFlags; + uint8_t fFlags; plKey fFinishKey; }; @@ -282,9 +282,9 @@ public: } fType; int fWhichStage; // used only by goto stage - hsScalar fTransitionTime; // for crossfade between stages + float fTransitionTime; // for crossfade between stages hsBool fSetTime; - hsScalar fNewTime; + float fNewTime; hsBool fSetDirection; hsBool fNewDirection; int fNewLoopCount; @@ -293,7 +293,7 @@ public: //! Older constructor version, allowing simple rewinding only plAvBrainGenericMsg(const plKey& sender, const plKey &receiver, - Type type, int stage, hsBool rewind, hsScalar transitionTime); + Type type, int stage, hsBool rewind, float transitionTime); /** Canonical constructor, allowing full control over time and direction of new stage. \param sender Message sender @@ -301,14 +301,14 @@ public: \param type The "verb" for the command - next stage, previous stage, goto stage \param stage The stage we're going to, if this is a goto command \param setTime Do we want to manually set the time on the target stage? - \param newTime If setTime is true, this is the TRACKED_NEW (local) time used in the target stage + \param newTime If setTime is true, this is the new (local) time used in the target stage \param setDirection Do we want to set the overall brain direction? \param isForward If setDirection is true, then true = forward, false = backward \param transitionTime Time in seconds to transition between stages. */ plAvBrainGenericMsg(const plKey& sender, const plKey &receiver, - Type type, int stage, hsBool setTime, hsScalar newTime, - hsBool setDirection, bool isForward, hsScalar transitiontime); + Type type, int stage, hsBool setTime, float newTime, + hsBool setDirection, bool isForward, float transitiontime); /** Constructor for setting the loop count in a particular stage. \param sender The sender of this message. @@ -389,7 +389,7 @@ public: kStealthCloaked, kStealthCloakedButSeen, }; - UInt8 fMode; + uint8_t fMode; int fLevel; // you are invisible to other players/CCRs of lower level CLASSNAME_REGISTER(plAvatarStealthModeMsg); @@ -402,7 +402,7 @@ public: class plAvatarBehaviorNotifyMsg : public plMessage { public: - UInt32 fType; + uint32_t fType; hsBool state; plAvatarBehaviorNotifyMsg() : fType(0),state(false) {} @@ -419,7 +419,7 @@ class plAvatarOpacityCallbackMsg : public plEventCallbackMsg { public: plAvatarOpacityCallbackMsg() : plEventCallbackMsg() {} - plAvatarOpacityCallbackMsg(plKey receiver, CallbackEvent e, int idx=0, hsScalar t=0, Int16 repeats=-1, UInt16 user=0) : + plAvatarOpacityCallbackMsg(plKey receiver, CallbackEvent e, int idx=0, float t=0, int16_t repeats=-1, uint16_t user=0) : plEventCallbackMsg(receiver, e, idx, t, repeats, user) {} CLASSNAME_REGISTER( plAvatarOpacityCallbackMsg ); @@ -449,7 +449,7 @@ class plAvatarPhysicsEnableCallbackMsg : public plEventCallbackMsg { public: plAvatarPhysicsEnableCallbackMsg() : plEventCallbackMsg() {} - plAvatarPhysicsEnableCallbackMsg(plKey receiver, CallbackEvent e, int idx=0, hsScalar t=0, Int16 repeats=-1, UInt16 user=0) : + plAvatarPhysicsEnableCallbackMsg(plKey receiver, CallbackEvent e, int idx=0, float t=0, int16_t repeats=-1, uint16_t user=0) : plEventCallbackMsg(receiver, e, idx, t, repeats, user) {} CLASSNAME_REGISTER( plAvatarPhysicsEnableCallbackMsg ); diff --git a/Sources/Plasma/PubUtilLib/plMessage/plBulletMsg.cpp b/Sources/Plasma/PubUtilLib/plMessage/plBulletMsg.cpp index 86071b5d..0f5c5ae8 100644 --- a/Sources/Plasma/PubUtilLib/plMessage/plBulletMsg.cpp +++ b/Sources/Plasma/PubUtilLib/plMessage/plBulletMsg.cpp @@ -40,7 +40,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "hsStream.h" @@ -64,7 +64,7 @@ void plBulletMsg::Write(hsStream* stream, hsResMgr* mgr) { IMsgWrite(stream, mgr); - stream->WriteByte(UInt8(fCmd)); + stream->WriteByte(uint8_t(fCmd)); fFrom.Write(stream); fDir.Write(stream); @@ -73,7 +73,7 @@ void plBulletMsg::Write(hsStream* stream, hsResMgr* mgr) stream->WriteLEScalar(fPartyTime); } -void plBulletMsg::FireShot(const hsPoint3& from, const hsVector3& dir, hsScalar radius, hsScalar range, hsScalar psecs) +void plBulletMsg::FireShot(const hsPoint3& from, const hsVector3& dir, float radius, float range, float psecs) { fFrom = from; fDir = dir; @@ -84,13 +84,13 @@ void plBulletMsg::FireShot(const hsPoint3& from, const hsVector3& dir, hsScalar fCmd = kShot; } -void plBulletMsg::FireShot(const hsPoint3& from, const hsPoint3& at, hsScalar radius, hsScalar psecs) +void plBulletMsg::FireShot(const hsPoint3& from, const hsPoint3& at, float radius, float psecs) { hsVector3 dir(&at, &from); - hsScalar invLen = hsFastMath::InvSqrt(dir.MagnitudeSquared()); + float invLen = hsFastMath::InvSqrt(dir.MagnitudeSquared()); hsAssert(invLen > 0, "degenerate from and at to fire bullet"); dir *= invLen; - hsScalar range = 1.f / invLen; + float range = 1.f / invLen; FireShot(from, dir, radius, range, psecs); } diff --git a/Sources/Plasma/PubUtilLib/plMessage/plBulletMsg.h b/Sources/Plasma/PubUtilLib/plMessage/plBulletMsg.h index 09c148dc..ded09309 100644 --- a/Sources/Plasma/PubUtilLib/plMessage/plBulletMsg.h +++ b/Sources/Plasma/PubUtilLib/plMessage/plBulletMsg.h @@ -60,9 +60,9 @@ protected: hsPoint3 fFrom; hsVector3 fDir; - hsScalar fRange; - hsScalar fRadius; - hsScalar fPartyTime; + float fRange; + float fRadius; + float fPartyTime; public: plBulletMsg() { SetBCastFlag(kNetPropagate | kBCastByType, true); } plBulletMsg(const plKey &s, @@ -81,17 +81,17 @@ public: hsBool Spray() const { return fCmd == kSpray; } hsBool Stop() const { return fCmd == kStop; } - void FireShot(const hsPoint3& from, const hsVector3& dir, hsScalar radius, hsScalar range, hsScalar psecs=-1.f); - void FireShot(const hsPoint3& from, const hsPoint3& at, hsScalar radius, hsScalar psecs=-1.f); + void FireShot(const hsPoint3& from, const hsVector3& dir, float radius, float range, float psecs=-1.f); + void FireShot(const hsPoint3& from, const hsPoint3& at, float radius, float psecs=-1.f); Cmd GetCmd() const { return fCmd; } void SetCmd(Cmd c) { fCmd = c; } const hsPoint3& From() const { return fFrom; } const hsVector3& Dir() const { return fDir; } - hsScalar Range() const { return fRange; } - hsScalar Radius() const { return fRadius; } - hsScalar PartyTime() const { return fPartyTime; } + float Range() const { return fRange; } + float Radius() const { return fRadius; } + float PartyTime() const { return fPartyTime; } }; #endif // plBulletMsg_inc diff --git a/Sources/Plasma/PubUtilLib/plMessage/plCCRMsg.h b/Sources/Plasma/PubUtilLib/plMessage/plCCRMsg.h index 7a9bea0d..451c6e0d 100644 --- a/Sources/Plasma/PubUtilLib/plMessage/plCCRMsg.h +++ b/Sources/Plasma/PubUtilLib/plMessage/plCCRMsg.h @@ -63,7 +63,7 @@ public: class plCCRPetitionMsg : public plCCRMessage { private: - UInt8 fPetitionType; + uint8_t fPetitionType; std::string fNote; std::string fTitle; public: @@ -82,8 +82,8 @@ public: const char* GetTitle() const { return fTitle.c_str(); } // petition type - void SetType(const UInt8 t) { fPetitionType=t; } - UInt8 GetType() const { return fPetitionType; } + void SetType(const uint8_t t) { fPetitionType=t; } + uint8_t GetType() const { return fPetitionType; } virtual void Read(hsStream* stream, hsResMgr* mgr); virtual void Write(hsStream* stream, hsResMgr* mgr); @@ -96,7 +96,7 @@ class plCCRInvisibleMsg : public plCCRMessage { public: plKey fAvKey; - UInt8 fInvisLevel; // 0 means visible + uint8_t fInvisLevel; // 0 means visible plCCRInvisibleMsg(); ~plCCRInvisibleMsg() {} @@ -124,7 +124,7 @@ public: }; std::string fString; Type fType; - UInt32 fCCRPlayerID; + uint32_t fCCRPlayerID; plCCRCommunicationMsg(); ~plCCRCommunicationMsg() {} @@ -139,8 +139,8 @@ public: void SetType(Type t) { fType=t; } Type GetType() const { return fType; } - void SetCCRPlayerID(UInt32 t) { fCCRPlayerID=t; } - UInt32 GetCCRPlayerID() const { return fCCRPlayerID; } + void SetCCRPlayerID(uint32_t t) { fCCRPlayerID=t; } + uint32_t GetCCRPlayerID() const { return fCCRPlayerID; } virtual void Read(hsStream* stream, hsResMgr* mgr); virtual void Write(hsStream* stream, hsResMgr* mgr); diff --git a/Sources/Plasma/PubUtilLib/plMessage/plCaptureRenderMsg.cpp b/Sources/Plasma/PubUtilLib/plMessage/plCaptureRenderMsg.cpp index 28757340..8d33fcff 100644 --- a/Sources/Plasma/PubUtilLib/plMessage/plCaptureRenderMsg.cpp +++ b/Sources/Plasma/PubUtilLib/plMessage/plCaptureRenderMsg.cpp @@ -40,7 +40,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "plCaptureRenderMsg.h" #include "plGImage/plMipmap.h" diff --git a/Sources/Plasma/PubUtilLib/plMessage/plClimbMsg.cpp b/Sources/Plasma/PubUtilLib/plMessage/plClimbMsg.cpp index c3653511..9be33a2b 100644 --- a/Sources/Plasma/PubUtilLib/plMessage/plClimbMsg.cpp +++ b/Sources/Plasma/PubUtilLib/plMessage/plClimbMsg.cpp @@ -77,8 +77,8 @@ void plClimbMsg::Read(hsStream *stream, hsResMgr *mgr) void plClimbMsg::Write(hsStream *stream, hsResMgr *mgr) { plMessage::IMsgWrite(stream, mgr); - stream->WriteLE32(static_cast(fCommand)); - stream->WriteLE32(static_cast(fDirection)); + stream->WriteLE32(static_cast(fCommand)); + stream->WriteLE32(static_cast(fDirection)); stream->WriteBool(fStatus); mgr->WriteKey(stream, fTarget); } diff --git a/Sources/Plasma/PubUtilLib/plMessage/plCondRefMsg.h b/Sources/Plasma/PubUtilLib/plMessage/plCondRefMsg.h index 3854f2af..1a511d78 100644 --- a/Sources/Plasma/PubUtilLib/plMessage/plCondRefMsg.h +++ b/Sources/Plasma/PubUtilLib/plMessage/plCondRefMsg.h @@ -60,7 +60,7 @@ public: CLASSNAME_REGISTER( plCondRefMsg ); GETINTERFACE_ANY( plCondRefMsg, plRefMsg ); - Int8 fWhich; + int8_t fWhich; // IO - not really applicable to ref msgs, but anyway void Read(hsStream* stream, hsResMgr* mgr) diff --git a/Sources/Plasma/PubUtilLib/plMessage/plConsoleMsg.h b/Sources/Plasma/PubUtilLib/plMessage/plConsoleMsg.h index e868594a..d37cd606 100644 --- a/Sources/Plasma/PubUtilLib/plMessage/plConsoleMsg.h +++ b/Sources/Plasma/PubUtilLib/plMessage/plConsoleMsg.h @@ -53,7 +53,7 @@ class plConsoleMsg : public plMessage { protected: - UInt32 fCmd; + uint32_t fCmd; char *fString; public: @@ -66,20 +66,20 @@ public: }; plConsoleMsg() : plMessage(nil, nil, nil), fCmd( 0 ), fString( nil ) { SetBCastFlag(kBCastByExactType); } - plConsoleMsg( UInt32 cmd, const char *str ) : + plConsoleMsg( uint32_t cmd, const char *str ) : plMessage(nil, nil, nil), fCmd( cmd ), fString(hsStrcpy(str)) { SetBCastFlag( kBCastByExactType ); } - ~plConsoleMsg() { FREE(fString); } + ~plConsoleMsg() { free(fString); } CLASSNAME_REGISTER( plConsoleMsg ); GETINTERFACE_ANY( plConsoleMsg, plMessage ); - UInt32 GetCmd( void ) const { return fCmd; } + uint32_t GetCmd( void ) const { return fCmd; } const char *GetString( void ) const { return fString; }; - void SetCmd (UInt32 cmd) { fCmd = cmd; } - void SetString (const char str[]) { FREE(fString); fString = hsStrcpy(str); } + void SetCmd (uint32_t cmd) { fCmd = cmd; } + void SetString (const char str[]) { free(fString); fString = hsStrcpy(str); } virtual void Read(hsStream* s, hsResMgr* mgr) { diff --git a/Sources/Plasma/PubUtilLib/plMessage/plDynaDecalEnableMsg.cpp b/Sources/Plasma/PubUtilLib/plMessage/plDynaDecalEnableMsg.cpp index edda5a87..22e34df7 100644 --- a/Sources/Plasma/PubUtilLib/plMessage/plDynaDecalEnableMsg.cpp +++ b/Sources/Plasma/PubUtilLib/plMessage/plDynaDecalEnableMsg.cpp @@ -40,7 +40,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "plDynaDecalEnableMsg.h" #include "hsResMgr.h" @@ -51,11 +51,11 @@ plDynaDecalEnableMsg::plDynaDecalEnableMsg() fKey(nil), fFlags(0), fConTime(0), - fID(UInt32(-1)) + fID(uint32_t(-1)) { } -plDynaDecalEnableMsg::plDynaDecalEnableMsg(const plKey& r, const plKey& a, double t, hsScalar w, hsBool end, UInt32 id, hsBool isArm) +plDynaDecalEnableMsg::plDynaDecalEnableMsg(const plKey& r, const plKey& a, double t, float w, hsBool end, uint32_t id, hsBool isArm) : plMessage(nil, r, nil), fKey(a), fFlags(0), diff --git a/Sources/Plasma/PubUtilLib/plMessage/plDynaDecalEnableMsg.h b/Sources/Plasma/PubUtilLib/plMessage/plDynaDecalEnableMsg.h index f99e2c3a..5ca73168 100644 --- a/Sources/Plasma/PubUtilLib/plMessage/plDynaDecalEnableMsg.h +++ b/Sources/Plasma/PubUtilLib/plMessage/plDynaDecalEnableMsg.h @@ -58,12 +58,12 @@ protected: }; plKey fKey; double fConTime; - hsScalar fWetLength; - UInt32 fFlags; - UInt32 fID; + float fWetLength; + uint32_t fFlags; + uint32_t fID; public: plDynaDecalEnableMsg(); - plDynaDecalEnableMsg(const plKey& r, const plKey& armOrShapeKey, double conTime, hsScalar wetLength, hsBool end, UInt32 id=UInt32(-1), hsBool isArm=true); + plDynaDecalEnableMsg(const plKey& r, const plKey& armOrShapeKey, double conTime, float wetLength, hsBool end, uint32_t id=uint32_t(-1), hsBool isArm=true); ~plDynaDecalEnableMsg(); CLASSNAME_REGISTER( plDynaDecalEnableMsg ); @@ -85,14 +85,14 @@ public: double GetContactTime() const { return fConTime; } void SetContactTime(double t) { fConTime = t; } - hsScalar GetWetLength() const { return fWetLength; } - void SetWetLength(hsScalar w) { fWetLength = w; } + float GetWetLength() const { return fWetLength; } + void SetWetLength(float w) { fWetLength = w; } hsBool AtEnd() const { return 0 != (fFlags & kAtEnd); } void SetAtEnd(hsBool b) { if(b)fFlags |= kAtEnd; else fFlags &= ~kAtEnd; } - UInt32 GetID() const { return fID; } - void SetID(UInt32 n) { fID = n; } + uint32_t GetID() const { return fID; } + void SetID(uint32_t n) { fID = n; } }; #endif // plDynaDecalEnableMsg_inc diff --git a/Sources/Plasma/PubUtilLib/plMessage/plDynamicEnvMapMsg.h b/Sources/Plasma/PubUtilLib/plMessage/plDynamicEnvMapMsg.h index 7bc556da..5992ba75 100644 --- a/Sources/Plasma/PubUtilLib/plMessage/plDynamicEnvMapMsg.h +++ b/Sources/Plasma/PubUtilLib/plMessage/plDynamicEnvMapMsg.h @@ -64,14 +64,14 @@ public: kSetRefresh = 0x40 }; - UInt32 fCmd; + uint32_t fCmd; hsPoint3 fPos; - hsScalar fHither; - hsScalar fYon; - hsScalar fFogStart; + float fHither; + float fYon; + float fFogStart; hsColorRGBA fColor; - hsScalar fRefresh; + float fRefresh; public: plDynamicEnvMapMsg() : plMessage(nil, nil, nil), fCmd(0) {} diff --git a/Sources/Plasma/PubUtilLib/plMessage/plDynamicTextMsg.cpp b/Sources/Plasma/PubUtilLib/plMessage/plDynamicTextMsg.cpp index faf6cc80..a2112896 100644 --- a/Sources/Plasma/PubUtilLib/plMessage/plDynamicTextMsg.cpp +++ b/Sources/Plasma/PubUtilLib/plMessage/plDynamicTextMsg.cpp @@ -46,7 +46,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // // ////////////////////////////////////////////////////////////////////////////// -#include "hsTypes.h" +#include "HeadSpin.h" #include "plDynamicTextMsg.h" #include "hsResMgr.h" #include "hsBitVector.h" @@ -60,31 +60,31 @@ void plDynamicTextMsg::SetTextColor( hsColorRGBA &c, hsBool blockRGB ) fBlockRGB = blockRGB; } -void plDynamicTextMsg::SetFont( const char *face, Int16 size, hsBool isBold ) +void plDynamicTextMsg::SetFont( const char *face, int16_t size, hsBool isBold ) { hsAssert( ( fCmd & ( kPosCmds | kStringCmds | kFlagCmds ) ) == 0, "Attempting to issue conflicting drawText commands" ); fCmd &= ~( kPosCmds | kStringCmds | kFlagCmds ); fCmd |= kSetFont; fString = hsStringToWString( face ); fX = size; - fFlags = (UInt32)isBold; + fFlags = (uint32_t)isBold; } -void plDynamicTextMsg::SetLineSpacing( Int16 spacing ) +void plDynamicTextMsg::SetLineSpacing( int16_t spacing ) { fCmd |= kSetLineSpacing; fLineSpacing = spacing; } -void plDynamicTextMsg::SetJustify( UInt8 justifyFlags ) +void plDynamicTextMsg::SetJustify( uint8_t justifyFlags ) { hsAssert( ( fCmd & ( kFlagCmds ) ) == 0, "Attempting to issue conflicting drawText commands" ); fCmd &= ~( kFlagCmds ); fCmd |= kSetJustify; - fFlags = (UInt32)justifyFlags; + fFlags = (uint32_t)justifyFlags; } -void plDynamicTextMsg::FillRect( UInt16 left, UInt16 top, UInt16 right, UInt16 bottom, hsColorRGBA &c ) +void plDynamicTextMsg::FillRect( uint16_t left, uint16_t top, uint16_t right, uint16_t bottom, hsColorRGBA &c ) { hsAssert( ( fCmd & ( kRectCmds | kColorCmds ) ) == 0, "Attempting to issue conflicting drawText commands" ); fCmd &= ~( kRectCmds | kColorCmds ); @@ -97,7 +97,7 @@ void plDynamicTextMsg::FillRect( UInt16 left, UInt16 top, UInt16 right, UInt1 fColor = c; } -void plDynamicTextMsg::FrameRect( UInt16 left, UInt16 top, UInt16 right, UInt16 bottom, hsColorRGBA &c ) +void plDynamicTextMsg::FrameRect( uint16_t left, uint16_t top, uint16_t right, uint16_t bottom, hsColorRGBA &c ) { hsAssert( ( fCmd & ( kRectCmds | kColorCmds ) ) == 0, "Attempting to issue conflicting drawText commands" ); fCmd &= ~( kRectCmds | kColorCmds ); @@ -110,40 +110,40 @@ void plDynamicTextMsg::FrameRect( UInt16 left, UInt16 top, UInt16 right, UInt fColor = c; } -void plDynamicTextMsg::DrawString( Int16 x, Int16 y, const char *text ) +void plDynamicTextMsg::DrawString( int16_t x, int16_t y, const char *text ) { wchar_t *wString = hsStringToWString(text); DrawString(x,y,wString); delete [] wString; } -void plDynamicTextMsg::DrawString( Int16 x, Int16 y, const wchar_t *text ) +void plDynamicTextMsg::DrawString( int16_t x, int16_t y, const wchar_t *text ) { hsAssert( ( fCmd & ( kStringCmds | kPosCmds ) ) == 0, "Attempting to issue conflicting drawText commands" ); fCmd &= ~( kStringCmds | kPosCmds ); fCmd |= kDrawString; - fString = TRACKED_NEW wchar_t[wcslen(text)+1]; + fString = new wchar_t[wcslen(text)+1]; wcscpy( fString, text ); fString[wcslen(text)] = L'\0'; fX = x; fY = y; } -void plDynamicTextMsg::DrawClippedString( Int16 x, Int16 y, UInt16 clipLeft, UInt16 clipTop, UInt16 clipRight, UInt16 clipBottom, const char *text ) +void plDynamicTextMsg::DrawClippedString( int16_t x, int16_t y, uint16_t clipLeft, uint16_t clipTop, uint16_t clipRight, uint16_t clipBottom, const char *text ) { wchar_t *wString = hsStringToWString(text); DrawClippedString(x,y,clipLeft,clipTop,clipRight,clipBottom,wString); delete [] wString; } -void plDynamicTextMsg::DrawClippedString( Int16 x, Int16 y, UInt16 clipLeft, UInt16 clipTop, UInt16 clipRight, UInt16 clipBottom, const wchar_t *text ) +void plDynamicTextMsg::DrawClippedString( int16_t x, int16_t y, uint16_t clipLeft, uint16_t clipTop, uint16_t clipRight, uint16_t clipBottom, const wchar_t *text ) { hsAssert( ( fCmd & ( kStringCmds | kPosCmds | kRectCmds ) ) == 0, "Attempting to issue conflicting drawText commands" ); fCmd &= ~( kStringCmds | kPosCmds | kRectCmds ); fCmd |= kDrawClippedString; - fString = TRACKED_NEW wchar_t[wcslen(text)+1]; + fString = new wchar_t[wcslen(text)+1]; wcscpy( fString, text ); fString[wcslen(text)] = L'\0'; fX = x; @@ -155,20 +155,20 @@ void plDynamicTextMsg::DrawClippedString( Int16 x, Int16 y, UInt16 clipLeft, fBottom = clipBottom; } -void plDynamicTextMsg::DrawWrappedString( Int16 x, Int16 y, UInt16 wrapWidth, UInt16 wrapHeight, const char *text ) +void plDynamicTextMsg::DrawWrappedString( int16_t x, int16_t y, uint16_t wrapWidth, uint16_t wrapHeight, const char *text ) { wchar_t *wString = hsStringToWString(text); DrawWrappedString(x,y,wrapWidth,wrapHeight,wString); delete [] wString; } -void plDynamicTextMsg::DrawWrappedString( Int16 x, Int16 y, UInt16 wrapWidth, UInt16 wrapHeight, const wchar_t *text ) +void plDynamicTextMsg::DrawWrappedString( int16_t x, int16_t y, uint16_t wrapWidth, uint16_t wrapHeight, const wchar_t *text ) { hsAssert( ( fCmd & ( kStringCmds | kPosCmds | kRectCmds ) ) == 0, "Attempting to issue conflicting drawText commands" ); fCmd &= ~( kStringCmds | kPosCmds | kRectCmds ); fCmd |= kDrawWrappedString; - fString = TRACKED_NEW wchar_t[wcslen(text)+1]; + fString = new wchar_t[wcslen(text)+1]; wcscpy( fString, text ); fString[wcslen(text)] = L'\0'; fX = x; @@ -178,7 +178,7 @@ void plDynamicTextMsg::DrawWrappedString( Int16 x, Int16 y, UInt16 wrapWidth, fBottom = wrapHeight; } -void plDynamicTextMsg::DrawImage( Int16 x, Int16 y, plKey &image, hsBool respectAlpha ) +void plDynamicTextMsg::DrawImage( int16_t x, int16_t y, plKey &image, hsBool respectAlpha ) { hsAssert( ( fCmd & ( kPosCmds | kFlagCmds ) ) == 0, "Attempting to issue conflicting drawText commands" ); fCmd &= ~( kPosCmds | kFlagCmds ); @@ -187,10 +187,10 @@ void plDynamicTextMsg::DrawImage( Int16 x, Int16 y, plKey &image, hsBool resp fImageKey = image; fX = x; fY = y; - fFlags = (UInt32)respectAlpha; + fFlags = (uint32_t)respectAlpha; } -void plDynamicTextMsg::DrawClippedImage( Int16 x, Int16 y, plKey &image, UInt16 clipX, UInt16 clipY, UInt16 clipWidth, UInt16 clipHeight, hsBool respectAlpha ) +void plDynamicTextMsg::DrawClippedImage( int16_t x, int16_t y, plKey &image, uint16_t clipX, uint16_t clipY, uint16_t clipWidth, uint16_t clipHeight, hsBool respectAlpha ) { hsAssert( ( fCmd & ( kPosCmds | kFlagCmds | kRectCmds ) ) == 0, "Attempting to issue conflicting drawText commands" ); fCmd &= ~( kPosCmds | kFlagCmds | kRectCmds ); @@ -203,7 +203,7 @@ void plDynamicTextMsg::DrawClippedImage( Int16 x, Int16 y, plKey &image, UInt fTop = clipY; fRight = clipWidth; fBottom = clipHeight; - fFlags = (UInt32)respectAlpha; + fFlags = (uint32_t)respectAlpha; } void plDynamicTextMsg::Read( hsStream *s, hsResMgr *mgr ) diff --git a/Sources/Plasma/PubUtilLib/plMessage/plDynamicTextMsg.h b/Sources/Plasma/PubUtilLib/plMessage/plDynamicTextMsg.h index bc474d17..7b79dff6 100644 --- a/Sources/Plasma/PubUtilLib/plMessage/plDynamicTextMsg.h +++ b/Sources/Plasma/PubUtilLib/plMessage/plDynamicTextMsg.h @@ -59,13 +59,13 @@ class plDynamicTextMsg : public plMessage friend class plDynamicTextMap; protected: - UInt16 fCmd; + uint16_t fCmd; // Position (fX is also used for font size) - Int16 fX, fY; + int16_t fX, fY; // A rectangle - UInt16 fLeft, fTop, fRight, fBottom; + uint16_t fLeft, fTop, fRight, fBottom; // Colors hsColorRGBA fClearColor; @@ -78,10 +78,10 @@ protected: plKey fImageKey; // Misc flags field - UInt32 fFlags; + uint32_t fFlags; hsBool fBlockRGB; - Int16 fLineSpacing; + int16_t fLineSpacing; public: plDynamicTextMsg() : plMessage( nil, nil, nil ) { fCmd = 0; fString = nil; fImageKey = nil; fFlags = 0; fBlockRGB = false; } @@ -122,19 +122,19 @@ public: // The following are mutually exclusive commands 'cause they share some parameters void SetTextColor( hsColorRGBA &c, hsBool blockRGB = false ); - void SetFont( const char *face, Int16 size, hsBool isBold = false ); - void SetLineSpacing( Int16 spacing ); - void FillRect( UInt16 left, UInt16 top, UInt16 right, UInt16 bottom, hsColorRGBA &c ); - void FrameRect( UInt16 left, UInt16 top, UInt16 right, UInt16 bottom, hsColorRGBA &c ); - void DrawString( Int16 x, Int16 y, const char *text ); - void DrawString( Int16 x, Int16 y, const wchar_t *text ); - void DrawClippedString( Int16 x, Int16 y, UInt16 clipLeft, UInt16 clipTop, UInt16 clipRight, UInt16 clipBottom, const char *text ); - void DrawClippedString( Int16 x, Int16 y, UInt16 clipLeft, UInt16 clipTop, UInt16 clipRight, UInt16 clipBottom, const wchar_t *text ); - void DrawWrappedString( Int16 x, Int16 y, UInt16 wrapWidth, UInt16 wrapHeight, const char *text ); - void DrawWrappedString( Int16 x, Int16 y, UInt16 wrapWidth, UInt16 wrapHeight, const wchar_t *text ); - void DrawImage( Int16 x, Int16 y, plKey &image, hsBool respectAlpha = false ); - void DrawClippedImage( Int16 x, Int16 y, plKey &image, UInt16 clipX, UInt16 clipY, UInt16 clipWidth, UInt16 clipHeight, hsBool respectAlpha = false ); - void SetJustify( UInt8 justifyFlags ); + void SetFont( const char *face, int16_t size, hsBool isBold = false ); + void SetLineSpacing( int16_t spacing ); + void FillRect( uint16_t left, uint16_t top, uint16_t right, uint16_t bottom, hsColorRGBA &c ); + void FrameRect( uint16_t left, uint16_t top, uint16_t right, uint16_t bottom, hsColorRGBA &c ); + void DrawString( int16_t x, int16_t y, const char *text ); + void DrawString( int16_t x, int16_t y, const wchar_t *text ); + void DrawClippedString( int16_t x, int16_t y, uint16_t clipLeft, uint16_t clipTop, uint16_t clipRight, uint16_t clipBottom, const char *text ); + void DrawClippedString( int16_t x, int16_t y, uint16_t clipLeft, uint16_t clipTop, uint16_t clipRight, uint16_t clipBottom, const wchar_t *text ); + void DrawWrappedString( int16_t x, int16_t y, uint16_t wrapWidth, uint16_t wrapHeight, const char *text ); + void DrawWrappedString( int16_t x, int16_t y, uint16_t wrapWidth, uint16_t wrapHeight, const wchar_t *text ); + void DrawImage( int16_t x, int16_t y, plKey &image, hsBool respectAlpha = false ); + void DrawClippedImage( int16_t x, int16_t y, plKey &image, uint16_t clipX, uint16_t clipY, uint16_t clipWidth, uint16_t clipHeight, hsBool respectAlpha = false ); + void SetJustify( uint8_t justifyFlags ); // IO void Read(hsStream* stream, hsResMgr* mgr); void Write(hsStream* stream, hsResMgr* mgr); diff --git a/Sources/Plasma/PubUtilLib/plMessage/plEnvEffectMsg.h b/Sources/Plasma/PubUtilLib/plMessage/plEnvEffectMsg.h index 9bc6a844..f9d7f5de 100644 --- a/Sources/Plasma/PubUtilLib/plMessage/plEnvEffectMsg.h +++ b/Sources/Plasma/PubUtilLib/plMessage/plEnvEffectMsg.h @@ -85,7 +85,7 @@ public: class plEnvAudioEffectMsg : public plEnvEffectMsg { - UInt32 fPreset; + uint32_t fPreset; public: plEnvAudioEffectMsg(){SetBCastFlag(plMessage::kPropagateToModifiers);} @@ -98,8 +98,8 @@ public: CLASSNAME_REGISTER( plEnvAudioEffectMsg ); GETINTERFACE_ANY( plEnvAudioEffectMsg, plEnvEffectMsg ); - UInt32 GetEffect() { return fPreset; } - void SetEffect(UInt32 i) { fPreset = i; } + uint32_t GetEffect() { return fPreset; } + void SetEffect(uint32_t i) { fPreset = i; } // IO void Read(hsStream* stream, hsResMgr* mgr) diff --git a/Sources/Plasma/PubUtilLib/plMessage/plExcludeRegionMsg.h b/Sources/Plasma/PubUtilLib/plMessage/plExcludeRegionMsg.h index 93e7a51b..98bf4a6f 100644 --- a/Sources/Plasma/PubUtilLib/plMessage/plExcludeRegionMsg.h +++ b/Sources/Plasma/PubUtilLib/plMessage/plExcludeRegionMsg.h @@ -58,7 +58,7 @@ public: }; protected: - UInt8 fCmd; + uint8_t fCmd; public: plExcludeRegionMsg() : fCmd(kClear), fSynchFlags(0) {} @@ -69,9 +69,9 @@ public: GETINTERFACE_ANY(plExcludeRegionMsg, plMessage); void SetCmd(CmdType cmd) { fCmd = cmd; } - UInt8 GetCmd() { return fCmd; } + uint8_t GetCmd() { return fCmd; } - UInt32 fSynchFlags; + uint32_t fSynchFlags; // IO void Read(hsStream* stream, hsResMgr* mgr) { diff --git a/Sources/Plasma/PubUtilLib/plMessage/plInputEventMsg.cpp b/Sources/Plasma/PubUtilLib/plMessage/plInputEventMsg.cpp index 1b90626c..bfb11c75 100644 --- a/Sources/Plasma/PubUtilLib/plMessage/plInputEventMsg.cpp +++ b/Sources/Plasma/PubUtilLib/plMessage/plInputEventMsg.cpp @@ -40,7 +40,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "plInputEventMsg.h" #include "pnKeyedObject/plKey.h" #include "hsResMgr.h" @@ -134,7 +134,7 @@ plControlEventMsg::~plControlEventMsg() void plControlEventMsg::Read(hsStream* stream, hsResMgr* mgr) { plInputEventMsg::Read(stream, mgr); - stream->ReadLE((Int32*)&fControlCode); + stream->ReadLE((int32_t*)&fControlCode); stream->ReadLE(&fControlActivated); stream->ReadLE(&fControlPct); fTurnToPt.Read(stream); @@ -146,7 +146,7 @@ void plControlEventMsg::Read(hsStream* stream, hsResMgr* mgr) void plControlEventMsg::Write(hsStream* stream, hsResMgr* mgr) { plInputEventMsg::Write(stream, mgr); - stream->WriteLE((Int32)fControlCode); + stream->WriteLE((int32_t)fControlCode); stream->WriteLE(fControlActivated); stream->WriteLE(fControlPct); fTurnToPt.Write(stream); @@ -172,7 +172,7 @@ void plControlEventMsg::ReadVersion(hsStream* s, hsResMgr* mgr) contentFlags.Read(s); if (contentFlags.IsBitSet(kControlEventMsgCode)) - s->ReadLE((Int32*)&fControlCode); + s->ReadLE((int32_t*)&fControlCode); if (contentFlags.IsBitSet(kControlEventMsgActivated)) s->ReadLE(&fControlActivated); @@ -201,7 +201,7 @@ void plControlEventMsg::WriteVersion(hsStream* s, hsResMgr* mgr) contentFlags.Write(s); // kControlEventMsgCode, - s->WriteLE((Int32)fControlCode); + s->WriteLE((int32_t)fControlCode); // kControlEventMsgActivated, s->WriteLE(fControlActivated); @@ -278,7 +278,7 @@ const ControlEventCode plAvatarInputStateMsg::fCodeMap[] = B_CONTROL_MODIFIER_STRAFE, B_CONTROL_LADDER_INVERTED, }; -const UInt8 plAvatarInputStateMsg::fMapSize = 12; +const uint8_t plAvatarInputStateMsg::fMapSize = 12; void plAvatarInputStateMsg::Read(hsStream *s, hsResMgr *mgr) { diff --git a/Sources/Plasma/PubUtilLib/plMessage/plInputEventMsg.h b/Sources/Plasma/PubUtilLib/plMessage/plInputEventMsg.h index d9e36c39..b60daf04 100644 --- a/Sources/Plasma/PubUtilLib/plMessage/plInputEventMsg.h +++ b/Sources/Plasma/PubUtilLib/plMessage/plInputEventMsg.h @@ -47,7 +47,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "pnInputCore/plControlDefinition.h" #include "hsGeometry3.h" #include "hsStream.h" -#include "hsUtils.h" + class plKeyEventMsg; class plMouseEventMsg; @@ -89,7 +89,7 @@ protected: ControlEventCode fControlCode; hsBool fControlActivated; hsPoint3 fTurnToPt; - hsScalar fControlPct; + float fControlPct; public: plControlEventMsg(); @@ -105,12 +105,12 @@ public: void SetControlCode(ControlEventCode c) { fControlCode = c; } void SetControlActivated(hsBool b) { fControlActivated = b; } void SetTurnToPt(hsPoint3 pt) { fTurnToPt = pt; } - void SetControlPct(hsScalar p) { fControlPct = p; } + void SetControlPct(float p) { fControlPct = p; } ControlEventCode GetControlCode() const { return fControlCode; } hsBool ControlActivated() { return fControlActivated; } hsPoint3 GetTurnToPt() { return fTurnToPt; } - hsScalar GetPct() { return fControlPct; } + float GetPct() { return fControlPct; } char* GetCmdString() { return fCmd; } // IO @@ -165,7 +165,7 @@ public: void Read(hsStream* stream, hsResMgr* mgr) { plInputEventMsg::Read(stream, mgr); - stream->ReadLE((Int32*)&fKeyCode); + stream->ReadLE((int32_t*)&fKeyCode); stream->ReadLE(&fKeyDown); stream->ReadLE(&fCapsLockKeyDown); stream->ReadLE(&fShiftKeyDown); @@ -176,7 +176,7 @@ public: void Write(hsStream* stream, hsResMgr* mgr) { plInputEventMsg::Write(stream, mgr); - stream->WriteLE((Int32)fKeyCode); + stream->WriteLE((int32_t)fKeyCode); stream->WriteLE(fKeyDown); stream->WriteLE(fCapsLockKeyDown); stream->WriteLE(fShiftKeyDown); @@ -224,7 +224,7 @@ public: void Read(hsStream* stream, hsResMgr* mgr) { plInputEventMsg::Read(stream, mgr); - stream->ReadLE((Int32*)&fKeyCode); + stream->ReadLE((int32_t*)&fKeyCode); stream->ReadLE(&fKeyDown); stream->ReadLE(&fCapsLockKeyDown); stream->ReadLE(&fShiftKeyDown); @@ -234,7 +234,7 @@ public: void Write(hsStream* stream, hsResMgr* mgr) { plInputEventMsg::Write(stream, mgr); - stream->WriteLE((Int32)fKeyCode); + stream->WriteLE((int32_t)fKeyCode); stream->WriteLE(fKeyDown); stream->WriteLE(fCapsLockKeyDown); stream->WriteLE(fShiftKeyDown); @@ -402,7 +402,7 @@ public: class plAvatarInputStateMsg : public plMessage { public: - UInt16 fState; + uint16_t fState; plAvatarInputStateMsg() : plMessage(), fState(0) {} ~plAvatarInputStateMsg() {} @@ -418,7 +418,7 @@ public: // Mapping of bits to the control events we care about static const ControlEventCode fCodeMap[]; - static const UInt8 fMapSize; + static const uint8_t fMapSize; static hsBool IsCodeInMap(ControlEventCode code); }; diff --git a/Sources/Plasma/PubUtilLib/plMessage/plInputIfaceMgrMsg.cpp b/Sources/Plasma/PubUtilLib/plMessage/plInputIfaceMgrMsg.cpp index c1134b72..6f04c68a 100644 --- a/Sources/Plasma/PubUtilLib/plMessage/plInputIfaceMgrMsg.cpp +++ b/Sources/Plasma/PubUtilLib/plMessage/plInputIfaceMgrMsg.cpp @@ -46,7 +46,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // // ////////////////////////////////////////////////////////////////////////////// -#include "hsTypes.h" +#include "HeadSpin.h" #include "plInputIfaceMgrMsg.h" #include "plInputCore/plInputInterface.h" #include "hsResMgr.h" diff --git a/Sources/Plasma/PubUtilLib/plMessage/plInputIfaceMgrMsg.h b/Sources/Plasma/PubUtilLib/plMessage/plInputIfaceMgrMsg.h index 82136163..16a29ece 100644 --- a/Sources/Plasma/PubUtilLib/plMessage/plInputIfaceMgrMsg.h +++ b/Sources/Plasma/PubUtilLib/plMessage/plInputIfaceMgrMsg.h @@ -48,7 +48,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #ifndef _plInputIfaceMgrMsg_h #define _plInputIfaceMgrMsg_h -#include "hsTypes.h" +#include "HeadSpin.h" #include "hsStream.h" #include "hsResMgr.h" #include "pnMessage/plMessage.h" @@ -59,9 +59,9 @@ class plInputIfaceMgrMsg : public plMessage { protected: - UInt8 fCommand; + uint8_t fCommand; plInputInterface *fInterface; - UInt32 fPageID; + uint32_t fPageID; const char* ageName; const char* ageFileName; const char* spawnPoint; @@ -89,9 +89,9 @@ class plInputIfaceMgrMsg : public plMessage }; plInputIfaceMgrMsg() : plMessage( nil, nil, nil ) { SetBCastFlag( kBCastByExactType ); fInterface = nil; ageName = ageFileName = spawnPoint = 0; fAvKey = nil; } - plInputIfaceMgrMsg( plKey &receiver, UInt8 command ) : plMessage( nil, nil, nil ) { AddReceiver( receiver ); fCommand = command; fInterface = nil; fAvKey = nil; ageName = ageFileName = spawnPoint = 0;} - plInputIfaceMgrMsg( UInt8 command ) : plMessage( nil, nil, nil ) { SetBCastFlag( kBCastByExactType ); fCommand = command; fInterface = nil; fAvKey = nil; ageName = ageFileName = spawnPoint = 0;} - plInputIfaceMgrMsg( UInt8 command, UInt32 pageID ) : plMessage( nil, nil, nil ) { SetBCastFlag( kBCastByExactType ); fCommand = command; fPageID = pageID; fInterface = nil; fAvKey = nil; ageName = ageFileName = spawnPoint = 0;} + plInputIfaceMgrMsg( plKey &receiver, uint8_t command ) : plMessage( nil, nil, nil ) { AddReceiver( receiver ); fCommand = command; fInterface = nil; fAvKey = nil; ageName = ageFileName = spawnPoint = 0;} + plInputIfaceMgrMsg( uint8_t command ) : plMessage( nil, nil, nil ) { SetBCastFlag( kBCastByExactType ); fCommand = command; fInterface = nil; fAvKey = nil; ageName = ageFileName = spawnPoint = 0;} + plInputIfaceMgrMsg( uint8_t command, uint32_t pageID ) : plMessage( nil, nil, nil ) { SetBCastFlag( kBCastByExactType ); fCommand = command; fPageID = pageID; fInterface = nil; fAvKey = nil; ageName = ageFileName = spawnPoint = 0;} ~plInputIfaceMgrMsg(); CLASSNAME_REGISTER( plInputIfaceMgrMsg ); @@ -127,8 +127,8 @@ class plInputIfaceMgrMsg : public plMessage const char* GetSpawnPoint() { return spawnPoint; } void SetAgeInstanceGuid(const plUUID& guid) { ageInstanceGuid = guid; } const plUUID& GetAgeInstanceGuid() { return ageInstanceGuid; } - UInt8 GetCommand( void ) { return fCommand; } - UInt32 GetPageID( void ) { return fPageID; } + uint8_t GetCommand( void ) { return fCommand; } + uint32_t GetPageID( void ) { return fPageID; } void SetIFace( plInputInterface *iface ); plInputInterface *GetIFace( void ) const { return fInterface; } plKey& GetAvKey( void ) { return fAvKey; } diff --git a/Sources/Plasma/PubUtilLib/plMessage/plInterestingPing.h b/Sources/Plasma/PubUtilLib/plMessage/plInterestingPing.h index cb6dfff1..49b204a3 100644 --- a/Sources/Plasma/PubUtilLib/plMessage/plInterestingPing.h +++ b/Sources/Plasma/PubUtilLib/plMessage/plInterestingPing.h @@ -60,12 +60,12 @@ public: CLASSNAME_REGISTER( plInterestingModMsg ); GETINTERFACE_ANY( plInterestingModMsg, plMessage ); - hsScalar fWeight; - hsScalar fRadius; - hsScalar fSize; + float fWeight; + float fRadius; + float fSize; hsPoint3 fPos; plKey fObj; - UInt8 fType; + uint8_t fType; // IO void Read(hsStream* stream, hsResMgr* mgr) diff --git a/Sources/Plasma/PubUtilLib/plMessage/plLOSHitMsg.cpp b/Sources/Plasma/PubUtilLib/plMessage/plLOSHitMsg.cpp index 6d287af6..c277d098 100644 --- a/Sources/Plasma/PubUtilLib/plMessage/plLOSHitMsg.cpp +++ b/Sources/Plasma/PubUtilLib/plMessage/plLOSHitMsg.cpp @@ -40,7 +40,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "plLOSHitMsg.h" plLOSHitMsg::plLOSHitMsg() diff --git a/Sources/Plasma/PubUtilLib/plMessage/plLOSHitMsg.h b/Sources/Plasma/PubUtilLib/plMessage/plLOSHitMsg.h index c553bb78..4d64b25e 100644 --- a/Sources/Plasma/PubUtilLib/plMessage/plLOSHitMsg.h +++ b/Sources/Plasma/PubUtilLib/plMessage/plLOSHitMsg.h @@ -58,8 +58,8 @@ public: plKey fObj; hsPoint3 fHitPoint; hsBool fNoHit; - UInt32 fRequestID; - UInt32 fHitFlags; + uint32_t fRequestID; + uint32_t fHitFlags; hsVector3 fNormal; float fDistance; diff --git a/Sources/Plasma/PubUtilLib/plMessage/plLOSRequestMsg.h b/Sources/Plasma/PubUtilLib/plMessage/plLOSRequestMsg.h index f5377a17..ffaa4e2c 100644 --- a/Sources/Plasma/PubUtilLib/plMessage/plLOSRequestMsg.h +++ b/Sources/Plasma/PubUtilLib/plMessage/plLOSRequestMsg.h @@ -86,8 +86,8 @@ public: ReportType GetReportType() const { return fReportType; } /** An ID invented by the caller for their own bookkeeping. */ - void SetRequestID(UInt32 id) { fRequestID = id; } - UInt32 GetRequestID() { return fRequestID; } + void SetRequestID(uint32_t id) { fRequestID = id; } + uint32_t GetRequestID() { return fRequestID; } /** If we get a hit on the first pass, we'll then double-check the remaining segment (start->first hit) against the "cull db". If *any* hit is found, @@ -111,7 +111,7 @@ private: plSimDefs::plLOSDB fCullDB; // if we find a hit, see if anything in this DB blocks it. TestType fTestType; // testing closest hit or just any? ReportType fReportType; // reporting hits, misses, or both? - UInt32 fRequestID; + uint32_t fRequestID; }; #endif // plLOSRequestMsg_inc diff --git a/Sources/Plasma/PubUtilLib/plMessage/plLayRefMsg.cpp b/Sources/Plasma/PubUtilLib/plMessage/plLayRefMsg.cpp index 63c84a87..437f3611 100644 --- a/Sources/Plasma/PubUtilLib/plMessage/plLayRefMsg.cpp +++ b/Sources/Plasma/PubUtilLib/plMessage/plLayRefMsg.cpp @@ -40,7 +40,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "plLayRefMsg.h" #include "hsStream.h" diff --git a/Sources/Plasma/PubUtilLib/plMessage/plLayRefMsg.h b/Sources/Plasma/PubUtilLib/plMessage/plLayRefMsg.h index d50aaa7e..55ebde50 100644 --- a/Sources/Plasma/PubUtilLib/plMessage/plLayRefMsg.h +++ b/Sources/Plasma/PubUtilLib/plMessage/plLayRefMsg.h @@ -59,13 +59,13 @@ public: }; plLayRefMsg() : fType(-1), fWhich(-1) {} - plLayRefMsg(const plKey &r, UInt8 f, Int8 which, Int8 type) : plRefMsg(r, f), fWhich(which), fType(type) {} + plLayRefMsg(const plKey &r, uint8_t f, int8_t which, int8_t type) : plRefMsg(r, f), fWhich(which), fType(type) {} CLASSNAME_REGISTER( plLayRefMsg ); GETINTERFACE_ANY( plLayRefMsg, plRefMsg ); - Int8 fType; - Int8 fWhich; + int8_t fType; + int8_t fWhich; // IO - not really applicable to ref msgs, but anyway void Read(hsStream* stream, hsResMgr* mgr); diff --git a/Sources/Plasma/PubUtilLib/plMessage/plLightRefMsg.h b/Sources/Plasma/PubUtilLib/plMessage/plLightRefMsg.h index 1d1e9095..7f94c49d 100644 --- a/Sources/Plasma/PubUtilLib/plMessage/plLightRefMsg.h +++ b/Sources/Plasma/PubUtilLib/plMessage/plLightRefMsg.h @@ -51,7 +51,7 @@ class plLightRefMsg : public plRefMsg { public: plLightRefMsg() {} - plLightRefMsg(const plKey& s, const plKey &r, hsKeyedObject* l, UInt8 c) : plRefMsg(r, c) { SetRef(l); SetSender(s); } + plLightRefMsg(const plKey& s, const plKey &r, hsKeyedObject* l, uint8_t c) : plRefMsg(r, c) { SetRef(l); SetSender(s); } CLASSNAME_REGISTER( plLightRefMsg ); GETINTERFACE_ANY( plLightRefMsg, plRefMsg ); diff --git a/Sources/Plasma/PubUtilLib/plMessage/plLinkToAgeMsg.cpp b/Sources/Plasma/PubUtilLib/plMessage/plLinkToAgeMsg.cpp index a27d5a3c..a224e0f9 100644 --- a/Sources/Plasma/PubUtilLib/plMessage/plLinkToAgeMsg.cpp +++ b/Sources/Plasma/PubUtilLib/plMessage/plLinkToAgeMsg.cpp @@ -42,7 +42,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "hsStream.h" #include "plLinkToAgeMsg.h" #include "hsResMgr.h" -#include "hsUtils.h" + #include "plgDispatch.h" #include "plNetCommon/plNetServerSessionInfo.h" #include "plNetCommon/plNetCommon.h" @@ -68,11 +68,11 @@ plLinkToAgeMsg::~plLinkToAgeMsg() } // StreamVersion needed for back compatibility. -UInt8 plLinkToAgeInfo_StreamVersion = 0; +uint8_t plLinkToAgeInfo_StreamVersion = 0; void plLinkToAgeMsg::Read(hsStream* stream, hsResMgr* mgr) { plMessage::IMsgRead( stream, mgr ); - UInt8 ltaVer = stream->ReadByte(); + uint8_t ltaVer = stream->ReadByte(); fAgeLink.Read( stream, mgr ); fLinkInAnimName = stream->ReadSafeString(); } @@ -314,7 +314,7 @@ void plLinkEffectBCMsg::Write(hsStream* stream, hsResMgr* mgr) stream->WriteLE32(fLinkFlags); } -void plLinkEffectBCMsg::SetLinkFlag(UInt32 flag, hsBool on /* = true */) +void plLinkEffectBCMsg::SetLinkFlag(uint32_t flag, hsBool on /* = true */) { if (on) fLinkFlags |= flag; @@ -322,7 +322,7 @@ void plLinkEffectBCMsg::SetLinkFlag(UInt32 flag, hsBool on /* = true */) fLinkFlags &= ~flag; } -hsBool plLinkEffectBCMsg::HasLinkFlag(UInt32 flag) +hsBool plLinkEffectBCMsg::HasLinkFlag(uint32_t flag) { return fLinkFlags & flag; } diff --git a/Sources/Plasma/PubUtilLib/plMessage/plLinkToAgeMsg.h b/Sources/Plasma/PubUtilLib/plMessage/plLinkToAgeMsg.h index 929856eb..c286384d 100644 --- a/Sources/Plasma/PubUtilLib/plMessage/plLinkToAgeMsg.h +++ b/Sources/Plasma/PubUtilLib/plMessage/plLinkToAgeMsg.h @@ -46,7 +46,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "pnMessage/plEventCallbackMsg.h" #include "plNetCommon/plNetServerSessionInfo.h" #include "plNetCommon/plNetCommonHelpers.h" -#include "hsUtils.h" + //////////////////////////////////////////////////////////////////// // A msg which is sent to the networking system to cause the player to link @@ -90,7 +90,7 @@ public: class plLinkingMgrMsg : public plMessage { - UInt8 fLinkingMgrCmd; + uint8_t fLinkingMgrCmd; plCreatableListHelper fArgs; public: @@ -100,8 +100,8 @@ public: CLASSNAME_REGISTER( plLinkingMgrMsg ); GETINTERFACE_ANY( plLinkingMgrMsg, plMessage ); - UInt8 GetCmd() const { return fLinkingMgrCmd; } - void SetCmd( UInt8 v ) { fLinkingMgrCmd=v; } + uint8_t GetCmd() const { return fLinkingMgrCmd; } + void SetCmd( uint8_t v ) { fLinkingMgrCmd=v; } plCreatableListHelper * GetArgs() { return &fArgs; } void Read( hsStream* stream, hsResMgr* mgr ); @@ -146,7 +146,7 @@ public: void ReadVersion(hsStream* s, hsResMgr* mgr); void WriteVersion(hsStream* s, hsResMgr* mgr); - Int32 fEffects; + int32_t fEffects; }; //////////////////////////////////////////////////////////////////// @@ -180,7 +180,7 @@ public: class plLinkEffectBCMsg : public plMessage { protected: - UInt32 fLinkFlags; + uint32_t fLinkFlags; public: enum // link flags @@ -202,8 +202,8 @@ public: void Read(hsStream* stream, hsResMgr* mgr); void Write(hsStream* stream, hsResMgr* mgr); - void SetLinkFlag(UInt32 flag, hsBool on = true); - hsBool HasLinkFlag(UInt32 flag); + void SetLinkFlag(uint32_t flag, hsBool on = true); + hsBool HasLinkFlag(uint32_t flag); plKey fLinkKey; }; diff --git a/Sources/Plasma/PubUtilLib/plMessage/plListenerMsg.cpp b/Sources/Plasma/PubUtilLib/plMessage/plListenerMsg.cpp index 8aaae25b..eaee7c6f 100644 --- a/Sources/Plasma/PubUtilLib/plMessage/plListenerMsg.cpp +++ b/Sources/Plasma/PubUtilLib/plMessage/plListenerMsg.cpp @@ -40,7 +40,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "hsStream.h" #include "plListenerMsg.h" #include "hsResMgr.h" @@ -66,7 +66,7 @@ void plListenerMsg::Write(hsStream* s, hsResMgr* mgr) } -plSetListenerMsg::plSetListenerMsg( UInt8 type, const plKey &srcKey, hsBool binding ) : plMessage( nil, nil, nil ) +plSetListenerMsg::plSetListenerMsg( uint8_t type, const plKey &srcKey, hsBool binding ) : plMessage( nil, nil, nil ) { plUoid uoid( kListenerMod_KEY ); plKey pLKey = hsgResMgr::ResMgr()->FindKey( uoid ); @@ -94,10 +94,10 @@ void plSetListenerMsg::Write( hsStream *s, hsResMgr *mgr ) s->WriteBool( fBinding ); } -void plSetListenerMsg::Set( const plKey &key, UInt8 type, hsBool binding ) +void plSetListenerMsg::Set( const plKey &key, uint8_t type, hsBool binding ) { fSrcKey = key; - fType = (UInt8)type; + fType = (uint8_t)type; fBinding = binding; } diff --git a/Sources/Plasma/PubUtilLib/plMessage/plListenerMsg.h b/Sources/Plasma/PubUtilLib/plMessage/plListenerMsg.h index 4c38e1f9..ab1d8b36 100644 --- a/Sources/Plasma/PubUtilLib/plMessage/plListenerMsg.h +++ b/Sources/Plasma/PubUtilLib/plMessage/plListenerMsg.h @@ -86,7 +86,7 @@ class plSetListenerMsg : public plMessage { protected: - UInt8 fType; + uint8_t fType; plKey fSrcKey; hsBool fBinding; @@ -103,7 +103,7 @@ public: }; plSetListenerMsg() : plMessage( nil, nil, nil ) { fType = 0; fBinding = false; } - plSetListenerMsg( UInt8 type, const plKey &srcKey, hsBool binding ); + plSetListenerMsg( uint8_t type, const plKey &srcKey, hsBool binding ); ~plSetListenerMsg(); CLASSNAME_REGISTER( plSetListenerMsg ); @@ -112,10 +112,10 @@ public: virtual void Read(hsStream* s, hsResMgr* mgr); virtual void Write(hsStream* s, hsResMgr* mgr); - void Set( const plKey &key, UInt8 type, hsBool binding ); + void Set( const plKey &key, uint8_t type, hsBool binding ); plKey &GetSrcKey( void ) { return fSrcKey; } - UInt8 GetType( void ) const { return fType; } + uint8_t GetType( void ) const { return fType; } hsBool IsBinding( void ) const { return fBinding; } }; diff --git a/Sources/Plasma/PubUtilLib/plMessage/plLoadAgeMsg.cpp b/Sources/Plasma/PubUtilLib/plMessage/plLoadAgeMsg.cpp index f5bcbf08..3d51511b 100644 --- a/Sources/Plasma/PubUtilLib/plMessage/plLoadAgeMsg.cpp +++ b/Sources/Plasma/PubUtilLib/plMessage/plLoadAgeMsg.cpp @@ -42,7 +42,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "hsStream.h" #include "plLoadAgeMsg.h" #include "hsResMgr.h" -#include "hsUtils.h" + #include "hsBitVector.h" void plLoadAgeMsg::Read(hsStream* stream, hsResMgr* mgr) @@ -52,11 +52,11 @@ void plLoadAgeMsg::Read(hsStream* stream, hsResMgr* mgr) delete [] fAgeFilename; // read agename - UInt8 len; + uint8_t len; stream->ReadLE(&len); if (len) { - fAgeFilename=TRACKED_NEW char[len+1]; + fAgeFilename=new char[len+1]; stream->Read(len, fAgeFilename); fAgeFilename[len]=0; } @@ -70,7 +70,7 @@ void plLoadAgeMsg::Write(hsStream* stream, hsResMgr* mgr) plMessage::IMsgWrite(stream, mgr); // write agename - UInt8 len=fAgeFilename?hsStrlen(fAgeFilename):0; + uint8_t len=fAgeFilename?hsStrlen(fAgeFilename):0; stream->WriteLE(len); if (len) { diff --git a/Sources/Plasma/PubUtilLib/plMessage/plLoadAgeMsg.h b/Sources/Plasma/PubUtilLib/plMessage/plLoadAgeMsg.h index c33838f3..a21bf01b 100644 --- a/Sources/Plasma/PubUtilLib/plMessage/plLoadAgeMsg.h +++ b/Sources/Plasma/PubUtilLib/plMessage/plLoadAgeMsg.h @@ -44,7 +44,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "pnMessage/plMessage.h" #include "pnUUID/pnUUID.h" -#include "hsUtils.h" + // // A msg which is sent to the networking system to cause an age to be loaded or unloaded diff --git a/Sources/Plasma/PubUtilLib/plMessage/plLoadAvatarMsg.cpp b/Sources/Plasma/PubUtilLib/plMessage/plLoadAvatarMsg.cpp index 1eec2e40..30a1b5f5 100644 --- a/Sources/Plasma/PubUtilLib/plMessage/plLoadAvatarMsg.cpp +++ b/Sources/Plasma/PubUtilLib/plMessage/plLoadAvatarMsg.cpp @@ -65,7 +65,7 @@ plLoadAvatarMsg::plLoadAvatarMsg() } // CTOR uoidToClone, requestorKey, userData, isPlayer, spawnPOint, initialTask -plLoadAvatarMsg::plLoadAvatarMsg(const plUoid &uoidToClone, const plKey &requestorKey, UInt32 userData, +plLoadAvatarMsg::plLoadAvatarMsg(const plUoid &uoidToClone, const plKey &requestorKey, uint32_t userData, hsBool isPlayer, const plKey &spawnPoint, plAvTask *initialTask, const char* userStr /*= nil*/) : plLoadCloneMsg(uoidToClone, requestorKey, userData), fIsPlayer(isPlayer), @@ -76,7 +76,7 @@ plLoadAvatarMsg::plLoadAvatarMsg(const plUoid &uoidToClone, const plKey &request SetUserStr(userStr); } -plLoadAvatarMsg::plLoadAvatarMsg(const plKey &existing, const plKey &requestor, UInt32 userData, +plLoadAvatarMsg::plLoadAvatarMsg(const plKey &existing, const plKey &requestor, uint32_t userData, hsBool isPlayer, hsBool isLoading, const char* userStr /*= nil*/) : plLoadCloneMsg(existing, requestor, userData, isLoading), fIsPlayer(isPlayer), @@ -226,7 +226,7 @@ void plLoadAvatarMsg::SetUserStr(const char *userStr) return; } - fUserStr = TRACKED_NEW char[strlen(userStr) + 1]; + fUserStr = new char[strlen(userStr) + 1]; strcpy(fUserStr, userStr); fUserStr[strlen(userStr)] = '\0'; } diff --git a/Sources/Plasma/PubUtilLib/plMessage/plLoadAvatarMsg.h b/Sources/Plasma/PubUtilLib/plMessage/plLoadAvatarMsg.h index 6e4fecff..28fc7ecb 100644 --- a/Sources/Plasma/PubUtilLib/plMessage/plLoadAvatarMsg.h +++ b/Sources/Plasma/PubUtilLib/plMessage/plLoadAvatarMsg.h @@ -46,7 +46,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #define plLoadAvatarMsg_INC #include "plLoadCloneMsg.h" -#include "hsUtils.h" + #include "pnKeyedObject/plUoid.h" class plAvTask; @@ -82,7 +82,7 @@ public: \param initialTask - queue up this task after loading (and spawning) \param userStr - a string that the user can set */ - plLoadAvatarMsg(const plUoid &uoidToClone, const plKey &requestorKey, UInt32 userData, + plLoadAvatarMsg(const plUoid &uoidToClone, const plKey &requestorKey, uint32_t userData, hsBool isPlayer, const plKey &spawnPoint, plAvTask *initialTask, const char *userStr = nil); /** Use this form if you're sending a message about an existing clone -- either @@ -96,7 +96,7 @@ public: \param isLoading - Are we loading or unloading? \param userStr - a string that the user can set */ - plLoadAvatarMsg(const plKey &existing, const plKey &requestorKey, UInt32 userData, + plLoadAvatarMsg(const plKey &existing, const plKey &requestorKey, uint32_t userData, hsBool isPlayer, hsBool isLoading, const char *userStr = nil); virtual ~plLoadAvatarMsg(); diff --git a/Sources/Plasma/PubUtilLib/plMessage/plLoadCloneMsg.cpp b/Sources/Plasma/PubUtilLib/plMessage/plLoadCloneMsg.cpp index 796fdf94..09842c4e 100644 --- a/Sources/Plasma/PubUtilLib/plMessage/plLoadCloneMsg.cpp +++ b/Sources/Plasma/PubUtilLib/plMessage/plLoadCloneMsg.cpp @@ -50,7 +50,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // other #include "pnNetCommon/plNetApp.h" -#include "hsTypes.h" +#include "HeadSpin.h" @@ -65,7 +65,7 @@ plLoadCloneMsg::plLoadCloneMsg() // CTOR uoidToClone, requestorKey, userData, isLoading // this form is for creating new clones -plLoadCloneMsg::plLoadCloneMsg(const plUoid &uoidToClone, const plKey &requestorKey, UInt32 userData) +plLoadCloneMsg::plLoadCloneMsg(const plUoid &uoidToClone, const plKey &requestorKey, uint32_t userData) : fRequestorKey(requestorKey), fUserData(userData), fValidMsg(false), @@ -99,7 +99,7 @@ plLoadCloneMsg::plLoadCloneMsg(const plUoid &uoidToClone, const plKey &requestor // CTOR existing, requestor, userData, isLoading // this form is for unloading or other operations on existing clones -plLoadCloneMsg::plLoadCloneMsg(const plKey &existing, const plKey &requestor, UInt32 userData, hsBool isLoading) +plLoadCloneMsg::plLoadCloneMsg(const plKey &existing, const plKey &requestor, uint32_t userData, hsBool isLoading) : fCloneKey(existing), fRequestorKey(requestor), fUserData(userData), @@ -237,18 +237,18 @@ hsBool plLoadCloneMsg::IsValidMessage() } // GETUSERDATA -UInt32 plLoadCloneMsg::GetUserData() +uint32_t plLoadCloneMsg::GetUserData() { return fUserData; } // GETORIGINATINGPLAYERID -UInt32 plLoadCloneMsg::GetOriginatingPlayerID() +uint32_t plLoadCloneMsg::GetOriginatingPlayerID() { return fOriginatingPlayerID; } -void plLoadCloneMsg::SetOriginatingPlayerID(UInt32 playerId) +void plLoadCloneMsg::SetOriginatingPlayerID(uint32_t playerId) { fOriginatingPlayerID = playerId; } diff --git a/Sources/Plasma/PubUtilLib/plMessage/plLoadCloneMsg.h b/Sources/Plasma/PubUtilLib/plMessage/plLoadCloneMsg.h index 26f65c8b..7e35431d 100644 --- a/Sources/Plasma/PubUtilLib/plMessage/plLoadCloneMsg.h +++ b/Sources/Plasma/PubUtilLib/plMessage/plLoadCloneMsg.h @@ -47,7 +47,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "pnMessage/plMessage.h" -// #include "hsUtils.h" +// #include "pnKeyedObject/plUoid.h" /** \class plLoadCloneMsg @@ -80,7 +80,7 @@ public: \param userData - Whatever you want. Will be propagated to the requestor after cloning. */ - plLoadCloneMsg(const plUoid &uoidToClone, const plKey &requestorKey, UInt32 userData); + plLoadCloneMsg(const plUoid &uoidToClone, const plKey &requestorKey, uint32_t userData); /** This constructor form is for when you want to send a clone message based on an existing cloned object. The two primary uses of this are: @@ -92,7 +92,7 @@ public: \param userData - Whatever you want. Will be propagated to the requestor. \param isLoading - Are we loading or unloading? */ - plLoadCloneMsg(const plKey &existing, const plKey &requestor, UInt32 userData, hsBool isLoading); + plLoadCloneMsg(const plKey &existing, const plKey &requestor, uint32_t userData, hsBool isLoading); virtual ~plLoadCloneMsg(); @@ -109,9 +109,9 @@ public: plKey GetCloneKey(); plKey GetRequestorKey(); hsBool IsValidMessage(); - UInt32 GetUserData(); - UInt32 GetOriginatingPlayerID(); - void SetOriginatingPlayerID(UInt32 playerId); + uint32_t GetUserData(); + uint32_t GetOriginatingPlayerID(); + void SetOriginatingPlayerID(uint32_t playerId); hsBool GetIsLoading(); void SetTriggerMsg(plMessage *msg); plMessage *GetTriggerMsg(); @@ -121,8 +121,8 @@ protected: plKey fCloneKey; // the key that will be loaded plKey fRequestorKey; // forward the message to this guy after the clone is created hsBool fValidMsg; // only gets set if the message built successfully - UInt32 fUserData; // let requestors send some data to their remote versions - UInt32 fOriginatingPlayerID; // network / player id of the client initiating the request + uint32_t fUserData; // let requestors send some data to their remote versions + uint32_t fOriginatingPlayerID; // network / player id of the client initiating the request hsBool fIsLoading; // true if we're loading; false if we're unloading plMessage *fTriggerMsg; // Handy place to store a message that caused you to request a clone, // so you can see it and continue processing once your clone is loaded. diff --git a/Sources/Plasma/PubUtilLib/plMessage/plMatRefMsg.h b/Sources/Plasma/PubUtilLib/plMessage/plMatRefMsg.h index 201d6d21..e65eb67c 100644 --- a/Sources/Plasma/PubUtilLib/plMessage/plMatRefMsg.h +++ b/Sources/Plasma/PubUtilLib/plMessage/plMatRefMsg.h @@ -55,7 +55,7 @@ public: }; plMatRefMsg() {} - plMatRefMsg(const plKey &r, UInt8 flags, Int8 which, Int8 type) : plGenRefMsg(r, flags, which, type) {} + plMatRefMsg(const plKey &r, uint8_t flags, int8_t which, int8_t type) : plGenRefMsg(r, flags, which, type) {} CLASSNAME_REGISTER( plMatRefMsg ); GETINTERFACE_ANY( plMatRefMsg, plGenRefMsg ); diff --git a/Sources/Plasma/PubUtilLib/plMessage/plMatrixUpdateMsg.cpp b/Sources/Plasma/PubUtilLib/plMessage/plMatrixUpdateMsg.cpp index af2f2ac1..fa5ae34f 100644 --- a/Sources/Plasma/PubUtilLib/plMessage/plMatrixUpdateMsg.cpp +++ b/Sources/Plasma/PubUtilLib/plMessage/plMatrixUpdateMsg.cpp @@ -40,7 +40,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "plMatrixUpdateMsg.h" #include "hsResMgr.h" #include "hsStream.h" diff --git a/Sources/Plasma/PubUtilLib/plMessage/plMemberUpdateMsg.h b/Sources/Plasma/PubUtilLib/plMessage/plMemberUpdateMsg.h index 3a0fb5d5..2dde66cf 100644 --- a/Sources/Plasma/PubUtilLib/plMessage/plMemberUpdateMsg.h +++ b/Sources/Plasma/PubUtilLib/plMessage/plMemberUpdateMsg.h @@ -43,7 +43,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #define plMemberUpdateMsg_INC #include "pnMessage/plMessage.h" -#include "hsUtils.h" + // // A msg sent locally when remote players have joined or left the game diff --git a/Sources/Plasma/PubUtilLib/plMessage/plMeshRefMsg.h b/Sources/Plasma/PubUtilLib/plMessage/plMeshRefMsg.h index d6380114..deda95f2 100644 --- a/Sources/Plasma/PubUtilLib/plMessage/plMeshRefMsg.h +++ b/Sources/Plasma/PubUtilLib/plMessage/plMeshRefMsg.h @@ -62,8 +62,8 @@ public: CLASSNAME_REGISTER( plMeshRefMsg ); GETINTERFACE_ANY( plMeshRefMsg, plRefMsg ); - UInt8 fType; - UInt8 fWhich; + uint8_t fType; + uint8_t fWhich; // IO - not really applicable to ref msgs, but anyway virtual void Read(hsStream* stream, hsResMgr* mgr) diff --git a/Sources/Plasma/PubUtilLib/plMessage/plMovieMsg.h b/Sources/Plasma/PubUtilLib/plMessage/plMovieMsg.h index deb30d3e..2db1ed71 100644 --- a/Sources/Plasma/PubUtilLib/plMessage/plMovieMsg.h +++ b/Sources/Plasma/PubUtilLib/plMessage/plMovieMsg.h @@ -78,21 +78,21 @@ protected: hsColorRGBA fColor; hsColorRGBA fFadeInColor; - hsScalar fFadeInSecs; + float fFadeInSecs; hsColorRGBA fFadeOutColor; - hsScalar fFadeOutSecs; + float fFadeOutSecs; - hsScalar fVolume; + float fVolume; char* fFileName; - UInt16 fCmd; + uint16_t fCmd; hsTArray fCallbacks; public: - plMovieMsg(const char* n, UInt16 cmd) + plMovieMsg(const char* n, uint16_t cmd) : plMessage(nil, nil, nil) { fFileName = hsStrcpy(n); @@ -130,30 +130,30 @@ public: } // Make sure you set at least one command, and set appropriate params for the command - UInt16 GetCmd() const { return fCmd; } - plMovieMsg& SetCmd(UInt16 c) { fCmd = c; return *this; } + uint16_t GetCmd() const { return fCmd; } + plMovieMsg& SetCmd(uint16_t c) { fCmd = c; return *this; } // Center 0,0 is center of screen, 1,1 is Upper-Right, -1,-1 is Lower-Left, etc. const hsPoint2& GetCenter() const { return fCenter; } - hsScalar GetCenterX() const { return fCenter.fX; } - hsScalar GetCenterY() const { return fCenter.fY; } + float GetCenterX() const { return fCenter.fX; } + float GetCenterY() const { return fCenter.fY; } plMovieMsg& SetCenter(const hsPoint2& p) { fCenter = p; return *this; } - plMovieMsg& SetCenter(hsScalar x, hsScalar y) { fCenter.Set(x, y); return *this; } - plMovieMsg& SetCenterX(hsScalar x) { fCenter.fX = x; return *this; } - plMovieMsg& SetCenterY(hsScalar y) { fCenter.fY = y; return *this; } + plMovieMsg& SetCenter(float x, float y) { fCenter.Set(x, y); return *this; } + plMovieMsg& SetCenterX(float x) { fCenter.fX = x; return *this; } + plMovieMsg& SetCenterY(float y) { fCenter.fY = y; return *this; } // Scale of 1.0 matches movie pixel to screen pixel (whatever the resolution). // Scale of 2.0 doubles each movie pixel across 2 screen pixels. // Etc. const hsPoint2& GetScale() const { return fScale; } - hsScalar GetScaleX() const { return fScale.fX; } - hsScalar GetScaleY() const { return fScale.fY; } + float GetScaleX() const { return fScale.fX; } + float GetScaleY() const { return fScale.fY; } plMovieMsg& SetScale(const hsPoint2& p) { fScale = p; return *this; } - plMovieMsg& SetScale(hsScalar x, hsScalar y) { fScale.Set(x, y); return *this; } - plMovieMsg& SetScaleX(hsScalar x) { fScale.fX = x; return *this; } - plMovieMsg& SetScaleY(hsScalar y) { fScale.fY = y; return *this; } + plMovieMsg& SetScale(float x, float y) { fScale.Set(x, y); return *this; } + plMovieMsg& SetScaleX(float x) { fScale.fX = x; return *this; } + plMovieMsg& SetScaleY(float y) { fScale.fY = y; return *this; } // Include the movie folder, e.g. "avi/porno.bik" // String is copied, not pointer copy. @@ -163,30 +163,30 @@ public: // Color is mostly useful for alpha fade up and down. const hsColorRGBA& GetColor() const { return fColor; } plMovieMsg& SetColor(const hsColorRGBA& c) { fColor = c; return *this; } - plMovieMsg& SetColor(hsScalar r, hsScalar g, hsScalar b, hsScalar a) { fColor.Set(r,g,b,a); return *this; } - plMovieMsg& SetOpacity(hsScalar a) { return SetColor(1.f, 1.f, 1.f, a); } + plMovieMsg& SetColor(float r, float g, float b, float a) { fColor.Set(r,g,b,a); return *this; } + plMovieMsg& SetOpacity(float a) { return SetColor(1.f, 1.f, 1.f, a); } // Or the auto matic fades const hsColorRGBA& GetFadeInColor() const { return fFadeInColor; } plMovieMsg& SetFadeInColor(const hsColorRGBA& c) { fFadeInColor = c; return *this; } - plMovieMsg& SetFadeInColor(hsScalar r, hsScalar g, hsScalar b, hsScalar a) { fFadeInColor.Set(r,g,b,a); return *this; } + plMovieMsg& SetFadeInColor(float r, float g, float b, float a) { fFadeInColor.Set(r,g,b,a); return *this; } - hsScalar GetFadeInSecs() const { return fFadeInSecs; } - plMovieMsg& SetFadeInSecs(hsScalar s) { fFadeInSecs = s; return *this; } + float GetFadeInSecs() const { return fFadeInSecs; } + plMovieMsg& SetFadeInSecs(float s) { fFadeInSecs = s; return *this; } const hsColorRGBA& GetFadeOutColor() const { return fFadeOutColor; } plMovieMsg& SetFadeOutColor(const hsColorRGBA& c) { fFadeOutColor = c; return *this; } - plMovieMsg& SetFadeOutColor(hsScalar r, hsScalar g, hsScalar b, hsScalar a) { fFadeOutColor.Set(r,g,b,a); return *this; } + plMovieMsg& SetFadeOutColor(float r, float g, float b, float a) { fFadeOutColor.Set(r,g,b,a); return *this; } - hsScalar GetFadeOutSecs() const { return fFadeOutSecs; } - plMovieMsg& SetFadeOutSecs(hsScalar s) { fFadeOutSecs = s; return *this; } + float GetFadeOutSecs() const { return fFadeOutSecs; } + plMovieMsg& SetFadeOutSecs(float s) { fFadeOutSecs = s; return *this; } // Volume is on scale of 0=muted to 1=full - hsScalar GetVolume() const { return fVolume; } - plMovieMsg& SetVolume(hsScalar v) { fVolume = v; return *this; } + float GetVolume() const { return fVolume; } + plMovieMsg& SetVolume(float v) { fVolume = v; return *this; } plMovieMsg& AddCallback(plMessage* msg) { hsRefCnt_SafeRef(msg); fCallbacks.Append(msg); return *this; } - UInt32 GetNumCallbacks() const { return fCallbacks.GetCount(); } + uint32_t GetNumCallbacks() const { return fCallbacks.GetCount(); } plMessage* GetCallback(int i) const { return fCallbacks[i]; } virtual void Read(hsStream* s, hsResMgr* mgr) { hsAssert(false, "Not for I/O"); plMessage::IMsgRead(s, mgr); } diff --git a/Sources/Plasma/PubUtilLib/plMessage/plMultistageMsg.h b/Sources/Plasma/PubUtilLib/plMessage/plMultistageMsg.h index 09b8f299..97dea462 100644 --- a/Sources/Plasma/PubUtilLib/plMessage/plMultistageMsg.h +++ b/Sources/Plasma/PubUtilLib/plMessage/plMultistageMsg.h @@ -58,14 +58,14 @@ public: kSetLoopCount, }; - UInt8 fStageNum; - UInt8 fNumLoops; + uint8_t fStageNum; + uint8_t fNumLoops; plMultistageModMsg() : fStageNum(0), fNumLoops(1) {} plMultistageModMsg(const plKey &sender, const plKey &receiver) : plMessage(sender,receiver,nil),fStageNum(0),fNumLoops(1) {} - hsBool GetCommand(UInt8 cmd) { return fCmds.IsBitSet(cmd); } - void SetCommand(UInt8 cmd, hsBool val = true) { fCmds.SetBit(cmd, val); } + hsBool GetCommand(uint8_t cmd) { return fCmds.IsBitSet(cmd); } + void SetCommand(uint8_t cmd, hsBool val = true) { fCmds.SetBit(cmd, val); } // plasma protocol CLASSNAME_REGISTER( plMultistageModMsg ); diff --git a/Sources/Plasma/PubUtilLib/plMessage/plNetCommMsgs.h b/Sources/Plasma/PubUtilLib/plMessage/plNetCommMsgs.h index f82b29ea..996c32b8 100644 --- a/Sources/Plasma/PubUtilLib/plMessage/plNetCommMsgs.h +++ b/Sources/Plasma/PubUtilLib/plMessage/plNetCommMsgs.h @@ -100,7 +100,7 @@ public: class plNetCommFileDownloadMsg : public plNetCommReplyMsg { public: - wchar filename[MAX_PATH]; + wchar_t filename[MAX_PATH]; hsStream * writer; CLASSNAME_REGISTER(plNetCommFileDownloadMsg); diff --git a/Sources/Plasma/PubUtilLib/plMessage/plNetVoiceListMsg.cpp b/Sources/Plasma/PubUtilLib/plMessage/plNetVoiceListMsg.cpp index fdd540a9..0f48e6d5 100644 --- a/Sources/Plasma/PubUtilLib/plMessage/plNetVoiceListMsg.cpp +++ b/Sources/Plasma/PubUtilLib/plMessage/plNetVoiceListMsg.cpp @@ -40,7 +40,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "plNetVoiceListMsg.h" #include "hsStream.h" #include "hsResMgr.h" diff --git a/Sources/Plasma/PubUtilLib/plMessage/plNetVoiceListMsg.h b/Sources/Plasma/PubUtilLib/plMessage/plNetVoiceListMsg.h index 824ad0ab..e587e6bf 100644 --- a/Sources/Plasma/PubUtilLib/plMessage/plNetVoiceListMsg.h +++ b/Sources/Plasma/PubUtilLib/plMessage/plNetVoiceListMsg.h @@ -50,7 +50,7 @@ class plNetVoiceListMsg : public plMessage { protected: - hsTArray fClientIDs; + hsTArray fClientIDs; int fCmd; plKey fRemoved; @@ -63,7 +63,7 @@ public: }; plNetVoiceListMsg() : plMessage(nil, nil, nil), fCmd( 0 ) { SetBCastFlag(kBCastByExactType); } - plNetVoiceListMsg( UInt32 cmd ) : + plNetVoiceListMsg( uint32_t cmd ) : plMessage(nil, nil, nil), fCmd( cmd ) { SetBCastFlag( kBCastByExactType ); } @@ -72,8 +72,8 @@ public: CLASSNAME_REGISTER( plNetVoiceListMsg ); GETINTERFACE_ANY( plNetVoiceListMsg, plMessage ); - UInt32 GetCmd( void ) { return fCmd; } - hsTArray* GetClientList( void ) { return &fClientIDs; }; + uint32_t GetCmd( void ) { return fCmd; } + hsTArray* GetClientList( void ) { return &fClientIDs; }; plKey GetRemovedKey() { return fRemoved; } void SetRemovedKey(plKey& k) { fRemoved = k; } virtual void Read(hsStream* s, hsResMgr* mgr); diff --git a/Sources/Plasma/PubUtilLib/plMessage/plOneShotCallbacks.cpp b/Sources/Plasma/PubUtilLib/plMessage/plOneShotCallbacks.cpp index 3e5552d1..bbbe597e 100644 --- a/Sources/Plasma/PubUtilLib/plMessage/plOneShotCallbacks.cpp +++ b/Sources/Plasma/PubUtilLib/plMessage/plOneShotCallbacks.cpp @@ -41,7 +41,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ #include "plOneShotCallbacks.h" #include "hsStream.h" -#include "hsUtils.h" + #include "hsResMgr.h" plOneShotCallbacks::plOneShotCallbacks() @@ -56,7 +56,7 @@ plOneShotCallbacks::~plOneShotCallbacks() fCallbacks.clear(); } -void plOneShotCallbacks::AddCallback(const char *marker, plKey &receiver, Int16 user) +void plOneShotCallbacks::AddCallback(const char *marker, plKey &receiver, int16_t user) { fCallbacks.push_back(plOneShotCallback(hsStrcpy(marker), receiver, user)); } @@ -79,7 +79,7 @@ void plOneShotCallbacks::Read(hsStream* stream, hsResMgr* mgr) { char *marker = stream->ReadSafeString(); plKey receiver = mgr->ReadKey(stream); - Int16 user = stream->ReadLE16(); + int16_t user = stream->ReadLE16(); fCallbacks.push_back(plOneShotCallback(marker, receiver, user)); } diff --git a/Sources/Plasma/PubUtilLib/plMessage/plOneShotCallbacks.h b/Sources/Plasma/PubUtilLib/plMessage/plOneShotCallbacks.h index 528543c7..e419eefa 100644 --- a/Sources/Plasma/PubUtilLib/plMessage/plOneShotCallbacks.h +++ b/Sources/Plasma/PubUtilLib/plMessage/plOneShotCallbacks.h @@ -39,7 +39,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com Mead, WA 99021 *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "hsStlUtils.h" #include "hsRefCnt.h" @@ -59,12 +59,12 @@ public: class plOneShotCallback { public: - plOneShotCallback(char *marker, plKey &receiver, Int16 user) : + plOneShotCallback(char *marker, plKey &receiver, int16_t user) : fMarker(marker), fReceiver(receiver) , fUser(user) {} char *fMarker; plKey fReceiver; - Int16 fUser; + int16_t fUser; }; protected: @@ -74,7 +74,7 @@ public: plOneShotCallbacks(); ~plOneShotCallbacks(); - void AddCallback(const char *marker, plKey &receiver, Int16 user=0); + void AddCallback(const char *marker, plKey &receiver, int16_t user=0); int GetNumCallbacks(); plOneShotCallback& GetCallback(int i); diff --git a/Sources/Plasma/PubUtilLib/plMessage/plOneShotMsg.cpp b/Sources/Plasma/PubUtilLib/plMessage/plOneShotMsg.cpp index c839df16..240bfe1e 100644 --- a/Sources/Plasma/PubUtilLib/plMessage/plOneShotMsg.cpp +++ b/Sources/Plasma/PubUtilLib/plMessage/plOneShotMsg.cpp @@ -44,7 +44,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com plOneShotMsg::plOneShotMsg() { - fCallbacks = TRACKED_NEW plOneShotCallbacks; + fCallbacks = new plOneShotCallbacks; } plOneShotMsg::~plOneShotMsg() diff --git a/Sources/Plasma/PubUtilLib/plMessage/plParticleUpdateMsg.h b/Sources/Plasma/PubUtilLib/plMessage/plParticleUpdateMsg.h index d8f153b9..5a7eccdb 100644 --- a/Sources/Plasma/PubUtilLib/plMessage/plParticleUpdateMsg.h +++ b/Sources/Plasma/PubUtilLib/plMessage/plParticleUpdateMsg.h @@ -56,7 +56,7 @@ class plParticleUpdateMsg : public plMessage public: plParticleUpdateMsg() : plMessage(nil, nil, nil) {} - plParticleUpdateMsg(const plKey &s, const plKey &r, const double* t, UInt32 paramID, hsScalar paramValue ) + plParticleUpdateMsg(const plKey &s, const plKey &r, const double* t, uint32_t paramID, float paramValue ) : plMessage(s, r, t) { fParamID = paramID; fParamValue = paramValue; } virtual ~plParticleUpdateMsg() {} @@ -85,11 +85,11 @@ public: kParamEnabled, }; - UInt32 fParamID; - hsScalar fParamValue; + uint32_t fParamID; + float fParamValue; - UInt32 GetParamID() { return fParamID; } - hsScalar GetParamValue() { return fParamValue; } + uint32_t GetParamID() { return fParamID; } + float GetParamValue() { return fParamValue; } // IO virtual void Read(hsStream* stream, hsResMgr* mgr) @@ -118,10 +118,10 @@ class plParticleTransferMsg : public plMessage { public: plKey fSysSOKey; // sceneObject of the system we're snagging particles from - UInt16 fNumToTransfer; // number of particles to transfer + uint16_t fNumToTransfer; // number of particles to transfer plParticleTransferMsg() : plMessage(nil, nil, nil), fSysSOKey(nil), fNumToTransfer(0) {} - plParticleTransferMsg(const plKey &s, const plKey &r, const double* t, plKey sysSOKey, UInt16 numParticles ) + plParticleTransferMsg(const plKey &s, const plKey &r, const double* t, plKey sysSOKey, uint16_t numParticles ) : plMessage(s, r, t) { fSysSOKey = sysSOKey; fNumToTransfer = numParticles; } virtual ~plParticleTransferMsg() {} @@ -155,10 +155,10 @@ public: class plParticleKillMsg : public plMessage { public: - hsScalar fNumToKill; - hsScalar fTimeLeft; + float fNumToKill; + float fTimeLeft; - UInt8 fFlags; + uint8_t fFlags; enum { kParticleKillImmortalOnly = 0x1, // Only slap a death sentence on "immortal" particles (the others are already dying) @@ -166,7 +166,7 @@ public: }; plParticleKillMsg() : plMessage(nil, nil, nil), fNumToKill(0.f), fTimeLeft(0.f), fFlags(kParticleKillImmortalOnly) {} - plParticleKillMsg(const plKey &s, const plKey &r, const double* t, hsScalar numToKill, hsScalar timeLeft, UInt8 flags = kParticleKillImmortalOnly ) + plParticleKillMsg(const plKey &s, const plKey &r, const double* t, float numToKill, float timeLeft, uint8_t flags = kParticleKillImmortalOnly ) : plMessage(s, r, t) { fNumToKill = numToKill; fTimeLeft = timeLeft; fFlags = flags; } virtual ~plParticleKillMsg() {} @@ -196,8 +196,8 @@ public: class plParticleFlockMsg : public plMessage { public: - hsScalar fX, fY, fZ; - UInt8 fCmd; + float fX, fY, fZ; + uint8_t fCmd; enum { kFlockCmdSetOffset, @@ -205,7 +205,7 @@ public: }; plParticleFlockMsg() : plMessage(nil, nil, nil), fCmd(0), fX(0.f), fY(0.f), fZ(0.f) {} - plParticleFlockMsg(const plKey &s, const plKey &r, const double* t, UInt8 cmd, hsScalar x, hsScalar y, hsScalar z) + plParticleFlockMsg(const plKey &s, const plKey &r, const double* t, uint8_t cmd, float x, float y, float z) : plMessage(s, r, t), fCmd(cmd), fX(x), fY(y), fZ(z) {} virtual ~plParticleFlockMsg() {} diff --git a/Sources/Plasma/PubUtilLib/plMessage/plRenderRequestMsg.cpp b/Sources/Plasma/PubUtilLib/plMessage/plRenderRequestMsg.cpp index 75e9685e..6304aae2 100644 --- a/Sources/Plasma/PubUtilLib/plMessage/plRenderRequestMsg.cpp +++ b/Sources/Plasma/PubUtilLib/plMessage/plRenderRequestMsg.cpp @@ -40,7 +40,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "plRenderRequestMsg.h" #include "pnKeyedObject/plUoid.h" #include "pnKeyedObject/plFixedKey.h" @@ -88,7 +88,7 @@ plRenderRequestAck::plRenderRequestAck() hsAssert(false, "Improper usage, use argumented constructor"); } -plRenderRequestAck::plRenderRequestAck(plKey r, UInt32 userData) +plRenderRequestAck::plRenderRequestAck(plKey r, uint32_t userData) : plMessage(nil, r, nil), fUserData(userData) { diff --git a/Sources/Plasma/PubUtilLib/plMessage/plRenderRequestMsg.h b/Sources/Plasma/PubUtilLib/plMessage/plRenderRequestMsg.h index d7e02d07..eb78956e 100644 --- a/Sources/Plasma/PubUtilLib/plMessage/plRenderRequestMsg.h +++ b/Sources/Plasma/PubUtilLib/plMessage/plRenderRequestMsg.h @@ -92,19 +92,19 @@ public: class plRenderRequestAck: public plMessage { protected: - UInt32 fUserData; - UInt32 fNumDrawn; // number of objects drawn. + uint32_t fUserData; + uint32_t fNumDrawn; // number of objects drawn. public: // Argumentless constructor useless (except for compiling). plRenderRequestAck(); - plRenderRequestAck(plKey r, UInt32 userData=0); + plRenderRequestAck(plKey r, uint32_t userData=0); ~plRenderRequestAck() {} CLASSNAME_REGISTER( plRenderRequestAck ); GETINTERFACE_ANY( plRenderRequestAck, plMessage ); - void SetNumDrawn(UInt32 n) { fNumDrawn = n; } - UInt32 GetNumDrawn() const { return fNumDrawn; } + void SetNumDrawn(uint32_t n) { fNumDrawn = n; } + uint32_t GetNumDrawn() const { return fNumDrawn; } // These aren't really implemented. Read/Write/Transmission of // these messages doesn't currently make sense. diff --git a/Sources/Plasma/PubUtilLib/plMessage/plReplaceGeometryMsg.h b/Sources/Plasma/PubUtilLib/plMessage/plReplaceGeometryMsg.h index 16a73e87..1563d3d2 100644 --- a/Sources/Plasma/PubUtilLib/plMessage/plReplaceGeometryMsg.h +++ b/Sources/Plasma/PubUtilLib/plMessage/plReplaceGeometryMsg.h @@ -53,7 +53,7 @@ class plReplaceGeometryMsg : public plMessage public: plSharedMesh *fMesh; hsGMaterial *fMaterial; - UInt32 fFlags; + uint32_t fFlags; plReplaceGeometryMsg() : fMesh(nil), fMaterial(nil), fFlags(0) {} ~plReplaceGeometryMsg() {} @@ -80,7 +80,7 @@ public: plDrawableSpans *fSpans; plSwapSpansRefMsg() : plGenRefMsg(), fSpans(nil) {} - plSwapSpansRefMsg(const plKey &r, UInt8 c, int which, int type) : plGenRefMsg(r, c, which, type) {} + plSwapSpansRefMsg(const plKey &r, uint8_t c, int which, int type) : plGenRefMsg(r, c, which, type) {} ~plSwapSpansRefMsg() {} CLASSNAME_REGISTER( plSwapSpansRefMsg ); diff --git a/Sources/Plasma/PubUtilLib/plMessage/plResMgrHelperMsg.h b/Sources/Plasma/PubUtilLib/plMessage/plResMgrHelperMsg.h index ff958118..e0e5794c 100644 --- a/Sources/Plasma/PubUtilLib/plMessage/plResMgrHelperMsg.h +++ b/Sources/Plasma/PubUtilLib/plMessage/plResMgrHelperMsg.h @@ -43,7 +43,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #ifndef _plResMgrHelperMsg_h #define _plResMgrHelperMsg_h -#include "hsTypes.h" +#include "HeadSpin.h" #include "hsStream.h" #include "pnMessage/plMessage.h" #include "plResMgr/plResManagerHelper.h" @@ -57,7 +57,7 @@ protected: plResPageKeyRefList *fKeyList; - UInt8 fCommand; + uint8_t fCommand; public: @@ -69,7 +69,7 @@ public: kDisableDebugScreen }; - plResMgrHelperMsg( UInt8 command = 0 ) : plMessage(nil, nil, nil), fKeyList( nil ) { fCommand = command; } + plResMgrHelperMsg( uint8_t command = 0 ) : plMessage(nil, nil, nil), fKeyList( nil ) { fCommand = command; } ~plResMgrHelperMsg() { delete fKeyList; } CLASSNAME_REGISTER( plResMgrHelperMsg ); @@ -85,7 +85,7 @@ public: hsAssert( false, "This should never get written" ); } - UInt8 GetCommand( void ) const { return fCommand; } + uint8_t GetCommand( void ) const { return fCommand; } }; #endif // _plResMgrHelperMsg_h diff --git a/Sources/Plasma/PubUtilLib/plMessage/plRippleShapeMsg.cpp b/Sources/Plasma/PubUtilLib/plMessage/plRippleShapeMsg.cpp index 6f3caa9f..b6ed5e1e 100644 --- a/Sources/Plasma/PubUtilLib/plMessage/plRippleShapeMsg.cpp +++ b/Sources/Plasma/PubUtilLib/plMessage/plRippleShapeMsg.cpp @@ -40,7 +40,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "plRippleShapeMsg.h" #include "hsResMgr.h" diff --git a/Sources/Plasma/PubUtilLib/plMessage/plRoomLoadNotifyMsg.h b/Sources/Plasma/PubUtilLib/plMessage/plRoomLoadNotifyMsg.h index ebacba86..a86035bf 100644 --- a/Sources/Plasma/PubUtilLib/plMessage/plRoomLoadNotifyMsg.h +++ b/Sources/Plasma/PubUtilLib/plMessage/plRoomLoadNotifyMsg.h @@ -57,7 +57,7 @@ class plRoomLoadNotifyMsg : public plMessage { protected: plKey fRoomKey; - UInt8 fWhat; + uint8_t fWhat; private: void IInit() @@ -88,8 +88,8 @@ public: virtual void SetRoom(plKey &rkey) { fRoomKey = rkey; } virtual plKey GetRoom() { return fRoomKey; } - virtual void SetWhatHappen(UInt8 what) { fWhat = what; } - virtual UInt8 GetWhatHappen() { return fWhat; } + virtual void SetWhatHappen(uint8_t what) { fWhat = what; } + virtual uint8_t GetWhatHappen() { return fWhat; } // IO void Read(hsStream* stream, hsResMgr* mgr) diff --git a/Sources/Plasma/PubUtilLib/plMessage/plTimerCallbackMsg.h b/Sources/Plasma/PubUtilLib/plMessage/plTimerCallbackMsg.h index f835cffc..4b229f84 100644 --- a/Sources/Plasma/PubUtilLib/plMessage/plTimerCallbackMsg.h +++ b/Sources/Plasma/PubUtilLib/plMessage/plTimerCallbackMsg.h @@ -52,14 +52,14 @@ class plTimerCallbackMsg : public plMessage public: plTimerCallbackMsg(){;} plTimerCallbackMsg(const plKey &s, const plKey &r, const double* t){;} - plTimerCallbackMsg(const plKey &r, UInt32 id = 0) { AddReceiver(r); fID = id;} + plTimerCallbackMsg(const plKey &r, uint32_t id = 0) { AddReceiver(r); fID = id;} ~plTimerCallbackMsg(){;} CLASSNAME_REGISTER( plTimerCallbackMsg ); GETINTERFACE_ANY( plTimerCallbackMsg, plMessage ); - UInt32 fID; - hsScalar fTime; + uint32_t fID; + float fTime; virtual void Read(hsStream* stream, hsResMgr* mgr) { diff --git a/Sources/Plasma/PubUtilLib/plMessage/plTransitionMsg.h b/Sources/Plasma/PubUtilLib/plMessage/plTransitionMsg.h index 5c23dd3d..bf8edb19 100644 --- a/Sources/Plasma/PubUtilLib/plMessage/plTransitionMsg.h +++ b/Sources/Plasma/PubUtilLib/plMessage/plTransitionMsg.h @@ -43,7 +43,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #ifndef plTransitionMsg_inc #define plTransitionMsg_inc -#include "hsTypes.h" +#include "HeadSpin.h" #include "hsStream.h" #include "pnMessage/plMessageWithCallbacks.h" @@ -51,8 +51,8 @@ class plTransitionMsg : public plMessageWithCallbacks { protected: - UInt32 fEffect; - hsScalar fLengthInSecs; + uint32_t fEffect; + float fLengthInSecs; hsBool fHoldUntilNext; public: enum @@ -64,7 +64,7 @@ public: }; plTransitionMsg() : plMessageWithCallbacks(nil, nil, nil), fEffect( 0 ) { SetBCastFlag(kBCastByExactType); } - plTransitionMsg( UInt32 type, hsScalar lengthInSecs, hsBool holdUntilNext = false ) : + plTransitionMsg( uint32_t type, float lengthInSecs, hsBool holdUntilNext = false ) : plMessageWithCallbacks(nil, nil, nil), fEffect( type ), fLengthInSecs( lengthInSecs ), fHoldUntilNext( holdUntilNext ) { SetBCastFlag( kBCastByExactType ); } @@ -73,8 +73,8 @@ public: CLASSNAME_REGISTER( plTransitionMsg ); GETINTERFACE_ANY( plTransitionMsg, plMessageWithCallbacks ); - UInt32 GetEffect( void ) const { return fEffect; } - hsScalar GetLengthInSecs( void ) const { return fLengthInSecs; } + uint32_t GetEffect( void ) const { return fEffect; } + float GetLengthInSecs( void ) const { return fLengthInSecs; } hsBool GetHoldState( void ) const { return fHoldUntilNext; } virtual void Read(hsStream* s, hsResMgr* mgr) diff --git a/Sources/Plasma/PubUtilLib/plMessage/plVaultNotifyMsg.h b/Sources/Plasma/PubUtilLib/plMessage/plVaultNotifyMsg.h index b1905e1e..db3db9e5 100644 --- a/Sources/Plasma/PubUtilLib/plMessage/plVaultNotifyMsg.h +++ b/Sources/Plasma/PubUtilLib/plMessage/plVaultNotifyMsg.h @@ -48,9 +48,9 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com class plVaultNotifyMsg : public plMessage { - UInt16 fType; + uint16_t fType; plCreatableListHelper fArgs; - Int8 fResultCode; + int8_t fResultCode; public: enum VaultNotifyTypes @@ -72,11 +72,11 @@ public: CLASSNAME_REGISTER( plVaultNotifyMsg ); GETINTERFACE_ANY_AUX( plVaultNotifyMsg, plMessage, plCreatableListHelper, fArgs ); - UInt16 GetType() const { return fType; } - void SetType( UInt16 v ) { fType=v; } + uint16_t GetType() const { return fType; } + void SetType( uint16_t v ) { fType=v; } - Int8 GetResultCode() const { return fResultCode; } - void SetResultCode( Int8 v ) { fResultCode=v; } + int8_t GetResultCode() const { return fResultCode; } + void SetResultCode( int8_t v ) { fResultCode=v; } plCreatableListHelper * GetArgs() { return &fArgs; } const plCreatableListHelper * GetArgs() const { return &fArgs; } diff --git a/Sources/Plasma/PubUtilLib/plModifier/plAnimEventModifier.cpp b/Sources/Plasma/PubUtilLib/plModifier/plAnimEventModifier.cpp index 7b1cdc5e..41d7c554 100644 --- a/Sources/Plasma/PubUtilLib/plModifier/plAnimEventModifier.cpp +++ b/Sources/Plasma/PubUtilLib/plModifier/plAnimEventModifier.cpp @@ -77,7 +77,7 @@ void plAnimEventModifier::Read(hsStream* stream, hsResMgr* mgr) // plKey animKey = fCallback->GetReceiver(0); hsgResMgr::ResMgr()->AddViaNotify(animKey, - TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnCreate, 0, 0), + new plGenRefMsg(GetKey(), plRefMsg::kOnCreate, 0, 0), plRefFlags::kPassiveRef); } @@ -128,7 +128,7 @@ void plAnimEventModifier::ISendNotify(bool triggered) { if (fDisabled) return; - plNotifyMsg* notify = TRACKED_NEW plNotifyMsg; + plNotifyMsg* notify = new plNotifyMsg; // Setup the event data in case this is a OneShot responder that needs it plKey playerKey = plNetClientApp::GetInstance()->GetLocalPlayerKey(); diff --git a/Sources/Plasma/PubUtilLib/plModifier/plAnimEventModifier.h b/Sources/Plasma/PubUtilLib/plModifier/plAnimEventModifier.h index be750e10..068fa3e1 100644 --- a/Sources/Plasma/PubUtilLib/plModifier/plAnimEventModifier.h +++ b/Sources/Plasma/PubUtilLib/plModifier/plAnimEventModifier.h @@ -54,7 +54,7 @@ protected: hsTArray fReceivers;// Keys to notify when the anim event happens plMessage* fCallback; // The callback setup message we send when the anim loads - virtual hsBool IEval(double secs, hsScalar del, UInt32 dirty) { return false; } + virtual hsBool IEval(double secs, float del, uint32_t dirty) { return false; } void ISendNotify(bool triggered); hsBool fDisabled; diff --git a/Sources/Plasma/PubUtilLib/plModifier/plAnimTimeConvertSDLModifier.cpp b/Sources/Plasma/PubUtilLib/plModifier/plAnimTimeConvertSDLModifier.cpp index 8512ffd8..657b9ae1 100644 --- a/Sources/Plasma/PubUtilLib/plModifier/plAnimTimeConvertSDLModifier.cpp +++ b/Sources/Plasma/PubUtilLib/plModifier/plAnimTimeConvertSDLModifier.cpp @@ -88,7 +88,7 @@ void plAnimTimeConvertSDLModifier::ISetCurrentATC(const plStateDataRecord* atcSt plStateDataRecord::SimpleVarsList vars; int num=atcStateDataRec->GetUsedVars(&vars); int j; - hsScalar lastStateAnimTime = 0; + float lastStateAnimTime = 0; double lastStateChange = 0; for(j=0;jGetButton() == kLeftButtonUp ) { // Remove ourselves from the stack - plInputIfaceMgrMsg *msg = TRACKED_NEW plInputIfaceMgrMsg( plInputIfaceMgrMsg::kRemoveInterface ); + plInputIfaceMgrMsg *msg = new plInputIfaceMgrMsg( plInputIfaceMgrMsg::kRemoveInterface ); msg->SetIFace( this ); plgDispatch::MsgSend( msg ); return true; @@ -99,7 +99,7 @@ class plAxisInputInterface : public plInputInterface return false; } - virtual UInt32 GetCurrentCursorID( void ) const { return kCursorGrab; } + virtual uint32_t GetCurrentCursorID( void ) const { return kCursorGrab; } virtual hsBool HasInterestingCursorID( void ) const { return true; } }; @@ -112,8 +112,8 @@ fYPos(0.0f), fIface(0), fAllOrNothing(false) { - fNotify = TRACKED_NEW plNotifyMsg; - fInputIface = TRACKED_NEW plAxisInputInterface( this ); + fNotify = new plNotifyMsg; + fInputIface = new plAxisInputInterface( this ); } plAxisAnimModifier::~plAxisAnimModifier() { @@ -122,7 +122,7 @@ plAxisAnimModifier::~plAxisAnimModifier() } -hsBool plAxisAnimModifier::IEval(double secs, hsScalar del, UInt32 dirty) +hsBool plAxisAnimModifier::IEval(double secs, float del, uint32_t dirty) { if (!fActive) return true; @@ -144,7 +144,7 @@ hsBool plAxisAnimModifier::MsgReceive(plMessage* msg) if (pCall) { // Send our notification to whomever cares; - hsScalar time = 0.0f; + float time = 0.0f; if (pCall->fEvent == kEnd) time = 1.0f; fNotify->ClearEvents(); @@ -172,7 +172,7 @@ hsBool plAxisAnimModifier::MsgReceive(plMessage* msg) fYPos = plMouseDevice::Instance()->GetCursorY(); // Insert our input interface onto the input stack - plInputIfaceMgrMsg *msg = TRACKED_NEW plInputIfaceMgrMsg( plInputIfaceMgrMsg::kAddInterface ); + plInputIfaceMgrMsg *msg = new plInputIfaceMgrMsg( plInputIfaceMgrMsg::kAddInterface ); msg->SetIFace( fInputIface ); plgDispatch::MsgSend( msg ); } @@ -183,7 +183,7 @@ hsBool plAxisAnimModifier::MsgReceive(plMessage* msg) fActive = false; // Remove our input interface from the input stack - plInputIfaceMgrMsg *msg = TRACKED_NEW plInputIfaceMgrMsg( plInputIfaceMgrMsg::kRemoveInterface ); + plInputIfaceMgrMsg *msg = new plInputIfaceMgrMsg( plInputIfaceMgrMsg::kRemoveInterface ); msg->SetIFace( fInputIface ); plgDispatch::MsgSend( msg ); } @@ -201,7 +201,7 @@ hsBool plAxisAnimModifier::MsgReceive(plMessage* msg) { if (pMMsg->GetDX() > 0.05f) return true; - plAnimCmdMsg* pMsg = TRACKED_NEW plAnimCmdMsg; + plAnimCmdMsg* pMsg = new plAnimCmdMsg; pMsg->AddReceiver(fXAnim); pMsg->SetAnimName(fAnimLabel.c_str()); // pMsg->SetAnimName() @@ -221,7 +221,7 @@ hsBool plAxisAnimModifier::MsgReceive(plMessage* msg) if (pMMsg->GetDY() > 0.05f) return true; - plAnimCmdMsg* pMsg = TRACKED_NEW plAnimCmdMsg; + plAnimCmdMsg* pMsg = new plAnimCmdMsg; pMsg->AddReceiver(fYAnim); pMsg->SetAnimName(fAnimLabel.c_str()); if (fYPos > pMMsg->GetYPos()) @@ -233,7 +233,7 @@ hsBool plAxisAnimModifier::MsgReceive(plMessage* msg) fActive = false; // Remove our input interface from the input stack - plInputIfaceMgrMsg *msg = TRACKED_NEW plInputIfaceMgrMsg( plInputIfaceMgrMsg::kRemoveInterface ); + plInputIfaceMgrMsg *msg = new plInputIfaceMgrMsg( plInputIfaceMgrMsg::kRemoveInterface ); msg->SetIFace( fInputIface ); plgDispatch::MsgSend( msg ); plInputManager::SetRecenterMouse(false); @@ -252,7 +252,7 @@ hsBool plAxisAnimModifier::MsgReceive(plMessage* msg) fActive = false; // Remove our input interface from the input stack - plInputIfaceMgrMsg *msg = TRACKED_NEW plInputIfaceMgrMsg( plInputIfaceMgrMsg::kRemoveInterface ); + plInputIfaceMgrMsg *msg = new plInputIfaceMgrMsg( plInputIfaceMgrMsg::kRemoveInterface ); msg->SetIFace( fInputIface ); plgDispatch::MsgSend( msg ); @@ -287,17 +287,17 @@ hsBool plAxisAnimModifier::MsgReceive(plMessage* msg) fXAnim = pRefMsg->GetRef()->GetKey(); // add callbacks for beginning and end of animation - plEventCallbackMsg* pCall1 = TRACKED_NEW plEventCallbackMsg; + plEventCallbackMsg* pCall1 = new plEventCallbackMsg; pCall1->fEvent = kBegin; pCall1->fRepeats = -1; pCall1->AddReceiver(GetKey()); - plEventCallbackMsg* pCall2 = TRACKED_NEW plEventCallbackMsg; + plEventCallbackMsg* pCall2 = new plEventCallbackMsg; pCall2->fEvent = kEnd; pCall2->fRepeats = -1; pCall2->AddReceiver(GetKey()); - plAnimCmdMsg* pMsg = TRACKED_NEW plAnimCmdMsg; + plAnimCmdMsg* pMsg = new plAnimCmdMsg; pMsg->SetCmd(plAnimCmdMsg::kAddCallbacks); pMsg->AddCallback(pCall1); pMsg->AddCallback(pCall2); @@ -315,17 +315,17 @@ hsBool plAxisAnimModifier::MsgReceive(plMessage* msg) fYAnim = pRefMsg->GetRef()->GetKey(); // add callbacks for beginning and end of animation - plEventCallbackMsg* pCall1 = TRACKED_NEW plEventCallbackMsg; + plEventCallbackMsg* pCall1 = new plEventCallbackMsg; pCall1->fEvent = kBegin; pCall1->fRepeats = -1; pCall1->AddReceiver(GetKey()); - plEventCallbackMsg* pCall2 = TRACKED_NEW plEventCallbackMsg; + plEventCallbackMsg* pCall2 = new plEventCallbackMsg; pCall2->fEvent = kEnd; pCall2->fRepeats = -1; pCall2->AddReceiver(GetKey()); - plAnimCmdMsg* pMsg = TRACKED_NEW plAnimCmdMsg; + plAnimCmdMsg* pMsg = new plAnimCmdMsg; pMsg->SetCmd(plAnimCmdMsg::kAddCallbacks); pMsg->AddCallback(pCall1); pMsg->AddCallback(pCall2); @@ -365,9 +365,9 @@ void plAxisAnimModifier::Read(hsStream* s, hsResMgr* mgr) { plSingleModifier::Read(s, mgr); - mgr->ReadKeyNotifyMe( s, TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnCreate, 0, kTypeX), plRefFlags::kPassiveRef); - mgr->ReadKeyNotifyMe( s, TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnCreate, 0, kTypeY), plRefFlags::kPassiveRef); - mgr->ReadKeyNotifyMe( s, TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnCreate, 0, kTypeLogic), plRefFlags::kPassiveRef); + mgr->ReadKeyNotifyMe( s, new plGenRefMsg(GetKey(), plRefMsg::kOnCreate, 0, kTypeX), plRefFlags::kPassiveRef); + mgr->ReadKeyNotifyMe( s, new plGenRefMsg(GetKey(), plRefMsg::kOnCreate, 0, kTypeY), plRefFlags::kPassiveRef); + mgr->ReadKeyNotifyMe( s, new plGenRefMsg(GetKey(), plRefMsg::kOnCreate, 0, kTypeLogic), plRefFlags::kPassiveRef); fAllOrNothing = s->ReadBool(); plNotifyMsg* pMsg = plNotifyMsg::ConvertNoRef(mgr->ReadCreatable(s)); diff --git a/Sources/Plasma/PubUtilLib/plModifier/plAxisAnimModifier.h b/Sources/Plasma/PubUtilLib/plModifier/plAxisAnimModifier.h index e1fd7f7a..4bb981b8 100644 --- a/Sources/Plasma/PubUtilLib/plModifier/plAxisAnimModifier.h +++ b/Sources/Plasma/PubUtilLib/plModifier/plAxisAnimModifier.h @@ -66,8 +66,8 @@ protected: plKey fYAnim; plKey fNotificationKey; - hsScalar fXPos; - hsScalar fYPos; + float fXPos; + float fYPos; hsBool fActive; hsBool fAllOrNothing; @@ -78,7 +78,7 @@ protected: plAxisInputInterface *fInputIface; - virtual hsBool IEval(double secs, hsScalar del, UInt32 dirty); + virtual hsBool IEval(double secs, float del, uint32_t dirty); public: plAxisAnimModifier(); diff --git a/Sources/Plasma/PubUtilLib/plModifier/plCloneSpawnModifier.cpp b/Sources/Plasma/PubUtilLib/plModifier/plCloneSpawnModifier.cpp index 88e36511..072d254c 100644 --- a/Sources/Plasma/PubUtilLib/plModifier/plCloneSpawnModifier.cpp +++ b/Sources/Plasma/PubUtilLib/plModifier/plCloneSpawnModifier.cpp @@ -111,18 +111,18 @@ plKey plCloneSpawnModifier::SpawnClone(const char* cloneName, const char* cloneA if (key) { - plLoadCloneMsg* cloneMsg = TRACKED_NEW plLoadCloneMsg(objUoid, requestor, 0); + plLoadCloneMsg* cloneMsg = new plLoadCloneMsg(objUoid, requestor, 0); cloneMsg->SetBCastFlag(plMessage::kMsgWatch); plKey cloneKey = cloneMsg->GetCloneKey();//resMgr->CloneKey(key); cloneMsg->Send(); // Put the clone into the clone room, which also forces it to load. plKey cloneNodeKey = resMgr->FindKey(kNetClientCloneRoom_KEY); - plNodeRefMsg* nodeRefCloneMsg = TRACKED_NEW plNodeRefMsg(cloneNodeKey, plNodeRefMsg::kOnRequest, -1, plNodeRefMsg::kObject); + plNodeRefMsg* nodeRefCloneMsg = new plNodeRefMsg(cloneNodeKey, plNodeRefMsg::kOnRequest, -1, plNodeRefMsg::kObject); resMgr->AddViaNotify(cloneKey, nodeRefCloneMsg, plRefFlags::kActiveRef); // Warp it into position - plWarpMsg *warpMsg = TRACKED_NEW plWarpMsg; + plWarpMsg *warpMsg = new plWarpMsg; warpMsg->AddReceiver(cloneKey); warpMsg->SetTransform(pos); plgDispatch::MsgSend(warpMsg); diff --git a/Sources/Plasma/PubUtilLib/plModifier/plCloneSpawnModifier.h b/Sources/Plasma/PubUtilLib/plModifier/plCloneSpawnModifier.h index d001f66b..c768d38d 100644 --- a/Sources/Plasma/PubUtilLib/plModifier/plCloneSpawnModifier.h +++ b/Sources/Plasma/PubUtilLib/plModifier/plCloneSpawnModifier.h @@ -50,7 +50,7 @@ protected: char* fTemplateName; bool fExportTime; - virtual hsBool IEval(double secs, hsScalar del, UInt32 dirty) { return true; } + virtual hsBool IEval(double secs, float del, uint32_t dirty) { return true; } public: plCloneSpawnModifier(); diff --git a/Sources/Plasma/PubUtilLib/plModifier/plDecalEnableMod.cpp b/Sources/Plasma/PubUtilLib/plModifier/plDecalEnableMod.cpp index b3964e3d..9799fba4 100644 --- a/Sources/Plasma/PubUtilLib/plModifier/plDecalEnableMod.cpp +++ b/Sources/Plasma/PubUtilLib/plModifier/plDecalEnableMod.cpp @@ -41,7 +41,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "plDecalEnableMod.h" #include "plMessage/plDynaDecalEnableMsg.h" #include "plMessage/plCollideMsg.h" @@ -79,7 +79,7 @@ hsBool plDecalEnableMod::MsgReceive(plMessage* msg) int i; for( i = 0; i < fDecalMgrs.GetCount(); i++ ) { - plDynaDecalEnableMsg* ena = TRACKED_NEW plDynaDecalEnableMsg(fDecalMgrs[i], armKey, hsTimer::GetSysSeconds(), fWetLength, !coll->fEntering); + plDynaDecalEnableMsg* ena = new plDynaDecalEnableMsg(fDecalMgrs[i], armKey, hsTimer::GetSysSeconds(), fWetLength, !coll->fEntering); ena->Send(); } diff --git a/Sources/Plasma/PubUtilLib/plModifier/plDecalEnableMod.h b/Sources/Plasma/PubUtilLib/plModifier/plDecalEnableMod.h index 092502ee..8c1c6527 100644 --- a/Sources/Plasma/PubUtilLib/plModifier/plDecalEnableMod.h +++ b/Sources/Plasma/PubUtilLib/plModifier/plDecalEnableMod.h @@ -53,9 +53,9 @@ protected: hsTArray fDecalMgrs; - hsScalar fWetLength; + float fWetLength; - virtual hsBool IEval(double secs, hsScalar del, UInt32 dirty) { return false; } + virtual hsBool IEval(double secs, float del, uint32_t dirty) { return false; } public: plDecalEnableMod(); @@ -69,11 +69,11 @@ public: virtual void Read(hsStream* stream, hsResMgr* mgr); virtual void Write(hsStream* stream, hsResMgr* mgr); - void SetWetLength(hsScalar t) { fWetLength = t; } - hsScalar GetWetLength() const { return fWetLength; } + void SetWetLength(float t) { fWetLength = t; } + float GetWetLength() const { return fWetLength; } void AddDecalKey(const plKey& k) { fDecalMgrs.Append(k); } - UInt32 GetNumDecalKeys() const { return fDecalMgrs.GetCount(); } + uint32_t GetNumDecalKeys() const { return fDecalMgrs.GetCount(); } const plKey& GetDecalKey(int i) const { return fDecalMgrs[i]; } }; diff --git a/Sources/Plasma/PubUtilLib/plModifier/plExcludeRegionModifier.cpp b/Sources/Plasma/PubUtilLib/plModifier/plExcludeRegionModifier.cpp index 8f4cb483..37298b40 100644 --- a/Sources/Plasma/PubUtilLib/plModifier/plExcludeRegionModifier.cpp +++ b/Sources/Plasma/PubUtilLib/plModifier/plExcludeRegionModifier.cpp @@ -189,7 +189,7 @@ void plExcludeRegionModifier::AddTarget(plSceneObject* so) if (so) { delete fSDLModifier; - fSDLModifier = TRACKED_NEW plExcludeRegionSDLModifier(this); + fSDLModifier = new plExcludeRegionSDLModifier(this); so->AddModifier(fSDLModifier); } plSingleModifier::SetTarget(so); @@ -285,7 +285,7 @@ void plExcludeRegionModifier::IMoveAvatars() if (closestIdx != -1) { - plAvSeekMsg* msg = TRACKED_NEW plAvSeekMsg; + plAvSeekMsg* msg = new plAvSeekMsg; msg->SetBCastFlag(plMessage::kPropagateToModifiers); msg->AddReceiver(fContainedAvatars[i]); msg->fSmartSeek = fSeek; @@ -305,7 +305,7 @@ void plExcludeRegionModifier::IMoveAvatars() int numControllers = plPXPhysicalControllerCore::GetNumberOfControllersInThisSubWorld(phys->GetWorldKey()); if (numControllers > 0) { - plPXPhysicalControllerCore** controllers = TRACKED_NEW plPXPhysicalControllerCore*[numControllers]; + plPXPhysicalControllerCore** controllers = new plPXPhysicalControllerCore*[numControllers]; int actualCount = plPXPhysicalControllerCore::GetControllersInThisSubWorld(phys->GetWorldKey(), numControllers, controllers); @@ -323,7 +323,7 @@ void plExcludeRegionModifier::IMoveAvatars() // *** warning; if there's more than one generic brain active, this will only look at the first if (curGenBrain && curGenBrain->GetType() == plAvBrainGeneric::kLadder) { - plAvBrainGenericMsg* pMsg = TRACKED_NEW plAvBrainGenericMsg( + plAvBrainGenericMsg* pMsg = new plAvBrainGenericMsg( nil, constAvMod->GetKey(), plAvBrainGenericMsg::kGotoStage, @@ -341,7 +341,7 @@ void plExcludeRegionModifier::IMoveAvatars() int closestIdx = IFindClosestSafePoint(controllers[i]->GetOwner()); if (closestIdx != -1) { - plAvSeekMsg* msg = TRACKED_NEW plAvSeekMsg; + plAvSeekMsg* msg = new plAvSeekMsg; msg->SetBCastFlag(plMessage::kPropagateToModifiers); msg->AddReceiver(controllers[i]->GetOwner()); msg->fSmartSeek = fSeek; diff --git a/Sources/Plasma/PubUtilLib/plModifier/plExcludeRegionModifier.h b/Sources/Plasma/PubUtilLib/plModifier/plExcludeRegionModifier.h index ebc78856..15b70999 100644 --- a/Sources/Plasma/PubUtilLib/plModifier/plExcludeRegionModifier.h +++ b/Sources/Plasma/PubUtilLib/plModifier/plExcludeRegionModifier.h @@ -63,8 +63,8 @@ protected: hsTArray fContainedAvatars; // Avatars inside our volume plExcludeRegionSDLModifier *fSDLModifier; hsBool fSeek; // use smart seek or teleport? - hsScalar fSeekTime; // how long to seek for - virtual hsBool IEval(double secs, hsScalar del, UInt32 dirty) { return true; } + float fSeekTime; // how long to seek for + virtual hsBool IEval(double secs, float del, uint32_t dirty) { return true; } void ISetPhysicalState(bool cleared); @@ -91,7 +91,7 @@ public: void AddSafePoint(plKey& key); void UseSmartSeek() { fSeek = true; } - void SetSeekTime(hsScalar s) { fSeekTime = s; } + void SetSeekTime(float s) { fSeekTime = s; } void SetBlockCameras(bool block) { fFlags.SetBit(kBlockCameras, block); } }; diff --git a/Sources/Plasma/PubUtilLib/plModifier/plGameMarkerModifier.cpp b/Sources/Plasma/PubUtilLib/plModifier/plGameMarkerModifier.cpp index 247b612f..5b2c4c2e 100644 --- a/Sources/Plasma/PubUtilLib/plModifier/plGameMarkerModifier.cpp +++ b/Sources/Plasma/PubUtilLib/plModifier/plGameMarkerModifier.cpp @@ -52,7 +52,7 @@ hsBool plGameMarkerModifier::MsgReceive(plMessage* msg) { if (collideMsg->fEntering) { - plNotifyMsg* notify = TRACKED_NEW plNotifyMsg; + plNotifyMsg* notify = new plNotifyMsg; notify->AddCollisionEvent(true, collideMsg->fOtherKey, GetTarget()->GetKey()); notify->Send(hsgResMgr::ResMgr()->FindKey(kMarkerMgr_KEY)); } diff --git a/Sources/Plasma/PubUtilLib/plModifier/plGameMarkerModifier.h b/Sources/Plasma/PubUtilLib/plModifier/plGameMarkerModifier.h index 0b44dfcb..290e55bb 100644 --- a/Sources/Plasma/PubUtilLib/plModifier/plGameMarkerModifier.h +++ b/Sources/Plasma/PubUtilLib/plModifier/plGameMarkerModifier.h @@ -51,10 +51,10 @@ protected: plKey fRedAnimKey; plKey fOpenAnimKey; plKey fBounceAnimKey; - UInt16 fPlaceSndIdx; - UInt16 fHitSndIdx; + uint16_t fPlaceSndIdx; + uint16_t fHitSndIdx; - virtual hsBool IEval(double secs, hsScalar del, UInt32 dirty) { return true; } + virtual hsBool IEval(double secs, float del, uint32_t dirty) { return true; } plKey IFindCloneKey(plKey baseKey); @@ -68,7 +68,7 @@ public: GETINTERFACE_ANY(plGameMarkerModifier, plSingleModifier); void ExportInit(plKey greenKey, plKey redKey, plKey openKey, plKey bounceAnimKey, - UInt16 placeSndIdx, UInt16 hitSndIdx) + uint16_t placeSndIdx, uint16_t hitSndIdx) { fGreenAnimKey = greenKey; fRedAnimKey = redKey; diff --git a/Sources/Plasma/PubUtilLib/plModifier/plImageLibMod.cpp b/Sources/Plasma/PubUtilLib/plModifier/plImageLibMod.cpp index dfd87baf..03b1c72c 100644 --- a/Sources/Plasma/PubUtilLib/plModifier/plImageLibMod.cpp +++ b/Sources/Plasma/PubUtilLib/plModifier/plImageLibMod.cpp @@ -41,7 +41,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "plImageLibMod.h" #include "plGImage/plBitmap.h" @@ -85,10 +85,10 @@ void plImageLibMod::Read(hsStream* stream, hsResMgr* mgr) { plSingleModifier::Read(stream, mgr); - UInt32 i, count = stream->ReadLE32(); + uint32_t i, count = stream->ReadLE32(); fImages.SetCountAndZero( count ); for( i = 0; i < count; i++ ) - mgr->ReadKeyNotifyMe( stream, TRACKED_NEW plGenRefMsg( GetKey(), plRefMsg::kOnCreate, i, kRefImage ), plRefFlags::kActiveRef ); + mgr->ReadKeyNotifyMe( stream, new plGenRefMsg( GetKey(), plRefMsg::kOnCreate, i, kRefImage ), plRefFlags::kActiveRef ); } void plImageLibMod::Write(hsStream* stream, hsResMgr* mgr) @@ -96,7 +96,7 @@ void plImageLibMod::Write(hsStream* stream, hsResMgr* mgr) plSingleModifier::Write(stream, mgr); stream->WriteLE32( fImages.GetCount() ); - UInt32 i; + uint32_t i; for( i = 0; i < fImages.GetCount(); i++ ) mgr->WriteKey( stream, fImages[ i ]->GetKey() ); } diff --git a/Sources/Plasma/PubUtilLib/plModifier/plImageLibMod.h b/Sources/Plasma/PubUtilLib/plModifier/plImageLibMod.h index be02eec5..ded2f8fd 100644 --- a/Sources/Plasma/PubUtilLib/plModifier/plImageLibMod.h +++ b/Sources/Plasma/PubUtilLib/plModifier/plImageLibMod.h @@ -54,7 +54,7 @@ protected: hsTArray fImages; - virtual hsBool IEval(double secs, hsScalar del, UInt32 dirty) { return false; } + virtual hsBool IEval(double secs, float del, uint32_t dirty) { return false; } public: plImageLibMod(); @@ -73,7 +73,7 @@ public: kRefImage = 0 }; - UInt32 GetNumImages( void ) const { return fImages.GetCount(); } + uint32_t GetNumImages( void ) const { return fImages.GetCount(); } }; #endif // plImageLibMod_inc diff --git a/Sources/Plasma/PubUtilLib/plModifier/plInterfaceInfoModifier.cpp b/Sources/Plasma/PubUtilLib/plModifier/plInterfaceInfoModifier.cpp index ca6d71f4..bee75400 100644 --- a/Sources/Plasma/PubUtilLib/plModifier/plInterfaceInfoModifier.cpp +++ b/Sources/Plasma/PubUtilLib/plModifier/plInterfaceInfoModifier.cpp @@ -40,7 +40,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "plInterfaceInfoModifier.h" #include "hsResMgr.h" #include "pnKeyedObject/plKey.h" diff --git a/Sources/Plasma/PubUtilLib/plModifier/plInterfaceInfoModifier.h b/Sources/Plasma/PubUtilLib/plModifier/plInterfaceInfoModifier.h index ee595bd8..33fc6ea3 100644 --- a/Sources/Plasma/PubUtilLib/plModifier/plInterfaceInfoModifier.h +++ b/Sources/Plasma/PubUtilLib/plModifier/plInterfaceInfoModifier.h @@ -52,7 +52,7 @@ class plInterfaceInfoModifier : public plSingleModifier protected: hsTArray fKeyList; - virtual hsBool IEval(double secs, hsScalar del, UInt32 dirty){ return true; } + virtual hsBool IEval(double secs, float del, uint32_t dirty){ return true; } public: plInterfaceInfoModifier(); diff --git a/Sources/Plasma/PubUtilLib/plModifier/plLayerSDLModifier.cpp b/Sources/Plasma/PubUtilLib/plModifier/plLayerSDLModifier.cpp index a0c59d9f..6fdbb5fb 100644 --- a/Sources/Plasma/PubUtilLib/plModifier/plLayerSDLModifier.cpp +++ b/Sources/Plasma/PubUtilLib/plModifier/plLayerSDLModifier.cpp @@ -112,24 +112,24 @@ void plLayerSDLModifier::IPutCurrentStateIn(plStateDataRecord* dstState) int channelIdx = 0; if (layer->fPreshadeColor && (layer->fOwnedChannels & plLayerInterface::kPreshadeColor)) { - channelVar->Set((UInt8)(layer->fPreshadeColor->r * 255), channelIdx++); - channelVar->Set((UInt8)(layer->fPreshadeColor->g * 255), channelIdx++); - channelVar->Set((UInt8)(layer->fPreshadeColor->b * 255), channelIdx++); + channelVar->Set((uint8_t)(layer->fPreshadeColor->r * 255), channelIdx++); + channelVar->Set((uint8_t)(layer->fPreshadeColor->g * 255), channelIdx++); + channelVar->Set((uint8_t)(layer->fPreshadeColor->b * 255), channelIdx++); } if (layer->fRuntimeColor && (layer->fOwnedChannels & plLayerInterface::kRuntimeColor)) { - channelVar->Set((UInt8)(layer->fRuntimeColor->r * 255), channelIdx++); - channelVar->Set((UInt8)(layer->fRuntimeColor->g * 255), channelIdx++); - channelVar->Set((UInt8)(layer->fRuntimeColor->b * 255), channelIdx++); + channelVar->Set((uint8_t)(layer->fRuntimeColor->r * 255), channelIdx++); + channelVar->Set((uint8_t)(layer->fRuntimeColor->g * 255), channelIdx++); + channelVar->Set((uint8_t)(layer->fRuntimeColor->b * 255), channelIdx++); } if (layer->fAmbientColor && (layer->fOwnedChannels & plLayerInterface::kAmbientColor)) { - channelVar->Set((UInt8)(layer->fAmbientColor->r * 255), channelIdx++); - channelVar->Set((UInt8)(layer->fAmbientColor->g * 255), channelIdx++); - channelVar->Set((UInt8)(layer->fAmbientColor->b * 255), channelIdx++); + channelVar->Set((uint8_t)(layer->fAmbientColor->r * 255), channelIdx++); + channelVar->Set((uint8_t)(layer->fAmbientColor->g * 255), channelIdx++); + channelVar->Set((uint8_t)(layer->fAmbientColor->b * 255), channelIdx++); } if (layer->fOpacity && (layer->fOwnedChannels & plLayerInterface::kOpacity)) - channelVar->Set((UInt8)(*layer->fOpacity * 255), channelIdx++); + channelVar->Set((uint8_t)(*layer->fOpacity * 255), channelIdx++); } // @@ -166,7 +166,7 @@ void plLayerSDLModifier::ISetCurrentStateFrom(const plStateDataRecord* srcState) plSimpleStateVariable *channelVar = srcState->FindVar(kStrChannelData); int channelIdx = 0; - UInt8 val; + uint8_t val; if (layer->fPreshadeColor && (layer->fOwnedChannels & plLayerInterface::kPreshadeColor)) { channelVar->Get(&val, channelIdx++); diff --git a/Sources/Plasma/PubUtilLib/plModifier/plLogicModifier.cpp b/Sources/Plasma/PubUtilLib/plModifier/plLogicModifier.cpp index da7f2ce6..6c24e203 100644 --- a/Sources/Plasma/PubUtilLib/plModifier/plLogicModifier.cpp +++ b/Sources/Plasma/PubUtilLib/plModifier/plLogicModifier.cpp @@ -39,7 +39,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com Mead, WA 99021 *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "plLogicModifier.h" #include "plgDispatch.h" #include "pnTimer/plTimerCallbackManager.h" @@ -162,7 +162,7 @@ hsBool plLogicModifier::MsgReceive(plMessage* msg) { plCursorChangeMsg* pMsg = 0; if ((VerifyConditions(pFakeMsg) && fMyCursor) && !Disabled()) - pMsg = TRACKED_NEW plCursorChangeMsg(fMyCursor, 1); + pMsg = new plCursorChangeMsg(fMyCursor, 1); else { #ifndef PLASMA_EXTERNAL_RELEASE @@ -190,7 +190,7 @@ hsBool plLogicModifier::MsgReceive(plMessage* msg) } } #endif // PLASMA_EXTERNAL_RELEASE - pMsg = TRACKED_NEW plCursorChangeMsg(plCursorChangeMsg::kNullCursor, 1); + pMsg = new plCursorChangeMsg(plCursorChangeMsg::kNullCursor, 1); } pMsg->AddReceiver( pFakeMsg->GetSender() ); @@ -221,7 +221,7 @@ void plLogicModifier::PreTrigger(hsBool netRequest) if (fTimer) { - plgTimerCallbackMgr::NewTimer( fTimer, TRACKED_NEW plTimerCallbackMsg( GetKey() ) ); + plgTimerCallbackMgr::NewTimer( fTimer, new plTimerCallbackMsg( GetKey() ) ); return; } plLogicModBase::PreTrigger(netRequest); @@ -244,7 +244,7 @@ void plLogicModifier::Read(hsStream* stream, hsResMgr* mgr) int i; for(i = 0; i < n; i++ ) { - refMsg = TRACKED_NEW plCondRefMsg(GetKey(), i); + refMsg = new plCondRefMsg(GetKey(), i); mgr->ReadKeyNotifyMe(stream,refMsg, plRefFlags::kActiveRef); } fMyCursor = stream->ReadLE32(); @@ -261,7 +261,7 @@ void plLogicModifier::Write(hsStream* stream, hsResMgr* mgr) void plLogicModifier::AddCondition(plConditionalObject* c) { - plGenRefMsg *msg= TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnCreate, -1, -1); + plGenRefMsg *msg= new plGenRefMsg(GetKey(), plRefMsg::kOnCreate, -1, -1); hsgResMgr::ResMgr()->AddViaNotify(c->GetKey(), msg, plRefFlags::kActiveRef); fConditionList.Append(c); diff --git a/Sources/Plasma/PubUtilLib/plModifier/plMaintainersMarkerModifier.h b/Sources/Plasma/PubUtilLib/plModifier/plMaintainersMarkerModifier.h index d2707660..5bc700c6 100644 --- a/Sources/Plasma/PubUtilLib/plModifier/plMaintainersMarkerModifier.h +++ b/Sources/Plasma/PubUtilLib/plModifier/plMaintainersMarkerModifier.h @@ -57,7 +57,7 @@ public: kCalibrated, }; protected: - virtual hsBool IEval(double secs, hsScalar del, UInt32 dirty) {return true;} + virtual hsBool IEval(double secs, float del, uint32_t dirty) {return true;} int fCalibrated; public: diff --git a/Sources/Plasma/PubUtilLib/plModifier/plResponderModifier.cpp b/Sources/Plasma/PubUtilLib/plModifier/plResponderModifier.cpp index d0e62679..65d177ca 100644 --- a/Sources/Plasma/PubUtilLib/plModifier/plResponderModifier.cpp +++ b/Sources/Plasma/PubUtilLib/plModifier/plResponderModifier.cpp @@ -39,7 +39,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com Mead, WA 99021 *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "hsStlUtils.h" #include "hsTimer.h" #include "plResponderModifier.h" @@ -168,14 +168,14 @@ hsBool plResponderModifier::MsgReceive(plMessage* msg) plTimerCallbackMsg *timerMsg = plTimerCallbackMsg::ConvertNoRef(msg); if (pEventMsg || timerMsg) { - UInt32 waitID = pEventMsg ? pEventMsg->fUser : timerMsg->fID; + uint32_t waitID = pEventMsg ? pEventMsg->fUser : timerMsg->fID; if (waitID != -1) { // Flag that this callback completed and try sending in case any commands were waiting on this fCompletedEvents.SetBit(waitID); - ResponderLog(ILog(plStatusLog::kWhite, "Got callback from command %d(id:%d)", ICmdFromWait((Int8)waitID)+1, waitID)); + ResponderLog(ILog(plStatusLog::kWhite, "Got callback from command %d(id:%d)", ICmdFromWait((int8_t)waitID)+1, waitID)); IContinueSending(); DirtySynchState(kSDLResponder, 0); @@ -203,7 +203,7 @@ void plResponderModifier::AddCommand(plMessage* pMsg, int state) fStates[state].fCmds.Append(plResponderCmd(pMsg, -1)); } -void plResponderModifier::AddCallback(Int8 state, Int8 cmd, Int8 callback) +void plResponderModifier::AddCallback(int8_t state, int8_t cmd, int8_t callback) { fStates[state].fWaitToCmd[callback] = cmd; } @@ -227,7 +227,7 @@ bool plResponderModifier::IIsLocalOnlyCmd(plMessage* cmd) return false; } -void plResponderModifier::ISetResponderState(Int8 state) +void plResponderModifier::ISetResponderState(int8_t state) { // make sure that it is a valid state to switch to if (state >= 0 && state < fStates.Count()) @@ -245,7 +245,7 @@ void plResponderModifier::ISetResponderStateFromNotify(plNotifyMsg* msg) // set the state of the responder IF they want it to be proResponderStateEventData* event = (proResponderStateEventData*)msg->FindEventRecord(proEventData::kResponderState); if (event != nil) - ISetResponderState((Int8)(event->fState)); + ISetResponderState((int8_t)(event->fState)); } void plResponderModifier::Trigger(plNotifyMsg *msg) @@ -259,7 +259,7 @@ void plResponderModifier::Trigger(plNotifyMsg *msg) #endif // If we're not in the middle of sending, reset and start sending commands - if (fCurCommand == Int8(-1) && fEnabled) + if (fCurCommand == int8_t(-1) && fEnabled) { ResponderLog(ILog(plStatusLog::kGreen, "Trigger")); @@ -288,7 +288,7 @@ void plResponderModifier::Trigger(plNotifyMsg *msg) bool plResponderModifier::IContinueSending() { // If we haven't been started, exit - if (fCurCommand == Int8(-1)) + if (fCurCommand == int8_t(-1)) return false; plResponderState& state = fStates[fCurState]; @@ -299,17 +299,17 @@ bool plResponderModifier::IContinueSending() if (msg) { // If this command needs to wait, and it's condition hasn't been met yet, exit - Int8 wait = state.fCmds[fCurCommand].fWaitOn; + int8_t wait = state.fCmds[fCurCommand].fWaitOn; if (wait != -1 && !fCompletedEvents.IsBitSet(wait)) { - ResponderLog(ILog(plStatusLog::kWhite, "Command %d is waiting for command %d(id:%d)", Int8(fCurCommand)+1, ICmdFromWait(wait)+1, wait)); + ResponderLog(ILog(plStatusLog::kWhite, "Command %d is waiting for command %d(id:%d)", int8_t(fCurCommand)+1, ICmdFromWait(wait)+1, wait)); return false; } if (!(fNotifyMsgFlags & plMessage::kNetNonLocal)|| !IIsLocalOnlyCmd(msg)) { // make sure outgoing msgs inherit net flags as part of cascade - UInt32 msgFlags = msg->GetAllBCastFlags(); + uint32_t msgFlags = msg->GetAllBCastFlags(); plNetClientApp::InheritNetMsgFlags(fNotifyMsgFlags, &msgFlags, true); msg->SetAllBCastFlags(msgFlags); @@ -414,7 +414,7 @@ bool plResponderModifier::IContinueSending() return true; } -Int8 plResponderModifier::ICmdFromWait(Int8 waitIdx) +int8_t plResponderModifier::ICmdFromWait(int8_t waitIdx) { WaitToCmd& waitToCmd = fStates[fCurState].fWaitToCmd; if (waitToCmd.find(waitIdx) != waitToCmd.end()) @@ -457,14 +457,14 @@ void plResponderModifier::Restore() if (plAnimCmdMsg* animMsg = plAnimCmdMsg::ConvertNoRef(callbackMsg)) { - plAnimCmdMsg* newAnimMsg = TRACKED_NEW plAnimCmdMsg; + plAnimCmdMsg* newAnimMsg = new plAnimCmdMsg; newAnimMsg->SetCmd(plAnimCmdMsg::kAddCallbacks); newCallbackMsg = newAnimMsg; ResponderLog(ILog(plStatusLog::kGreen, "Restoring anim callback")); } else if (plSoundMsg* soundMsg = plSoundMsg::ConvertNoRef(callbackMsg)) { - plSoundMsg* newSoundMsg = TRACKED_NEW plSoundMsg; + plSoundMsg* newSoundMsg = new plSoundMsg; newSoundMsg->SetCmd(plSoundMsg::kAddCallbacks); newCallbackMsg = newSoundMsg; ResponderLog(ILog(plStatusLog::kGreen, "Restoring sound callback")); @@ -502,7 +502,7 @@ plMessage* plResponderModifier::IGetFastForwardMsg(plMessage* msg, bool python) if (animMsg->Cmd(plAnimCmdMsg::kContinue) || animMsg->Cmd(plAnimCmdMsg::kAddCallbacks)) { - plAnimCmdMsg* newAnimMsg = TRACKED_NEW plAnimCmdMsg; + plAnimCmdMsg* newAnimMsg = new plAnimCmdMsg; newAnimMsg->fCmd = animMsg->fCmd; newAnimMsg->fBegin = animMsg->fBegin; newAnimMsg->fEnd = animMsg->fEnd; @@ -544,7 +544,7 @@ plMessage* plResponderModifier::IGetFastForwardMsg(plMessage* msg, bool python) soundMsg->Cmd(plSoundMsg::kToggleState) || soundMsg->Cmd(plAnimCmdMsg::kAddCallbacks)) { - plSoundMsg *newSoundMsg = TRACKED_NEW plSoundMsg; + plSoundMsg *newSoundMsg = new plSoundMsg; newSoundMsg->fCmd = soundMsg->fCmd; newSoundMsg->fBegin = soundMsg->fBegin; newSoundMsg->fEnd = soundMsg->fEnd; @@ -640,17 +640,17 @@ void plResponderModifier::Read(hsStream* stream, hsResMgr* mgr) { plSingleModifier::Read(stream, mgr); - Int8 numStates = stream->ReadByte(); + int8_t numStates = stream->ReadByte(); fStates.SetCount(numStates); - for (Int8 i = 0; i < numStates; i++) + for (int8_t i = 0; i < numStates; i++) { plResponderState& state = fStates[i]; state.fNumCallbacks = stream->ReadByte(); state.fSwitchToState = stream->ReadByte(); - Int8 j; + int8_t j; - Int8 numCmds = stream->ReadByte(); + int8_t numCmds = stream->ReadByte(); state.fCmds.SetCount(numCmds); for (j = 0; j < numCmds; j++) { @@ -662,11 +662,11 @@ void plResponderModifier::Read(hsStream* stream, hsResMgr* mgr) } state.fWaitToCmd.clear(); - Int8 mapSize = stream->ReadByte(); + int8_t mapSize = stream->ReadByte(); for (j = 0; j < mapSize; j++) { - Int8 wait = stream->ReadByte(); - Int8 cmd = stream->ReadByte(); + int8_t wait = stream->ReadByte(); + int8_t cmd = stream->ReadByte(); state.fWaitToCmd[wait] = cmd; } } @@ -677,7 +677,7 @@ void plResponderModifier::Read(hsStream* stream, hsResMgr* mgr) // attach responderSDLMod delete fResponderSDLMod; - fResponderSDLMod = TRACKED_NEW plResponderSDLModifier; + fResponderSDLMod = new plResponderSDLModifier; fResponderSDLMod->SetResponder(this); } @@ -685,7 +685,7 @@ void plResponderModifier::Write(hsStream* stream, hsResMgr* mgr) { plSingleModifier::Write(stream, mgr); - Int8 numStates = fStates.GetCount(); + int8_t numStates = fStates.GetCount(); stream->WriteByte(numStates); for (int i = 0; i < numStates; i++) { @@ -693,7 +693,7 @@ void plResponderModifier::Write(hsStream* stream, hsResMgr* mgr) stream->WriteByte(state.fNumCallbacks); stream->WriteByte(state.fSwitchToState); - Int8 numCmds = state.fCmds.GetCount(); + int8_t numCmds = state.fCmds.GetCount(); stream->WriteByte(numCmds); for (int j = 0; j < numCmds; j++) { @@ -703,7 +703,7 @@ void plResponderModifier::Write(hsStream* stream, hsResMgr* mgr) stream->WriteByte(cmd.fWaitOn); } - Int8 mapSize = state.fWaitToCmd.size(); + int8_t mapSize = state.fWaitToCmd.size(); stream->WriteByte(mapSize); for (WaitToCmd::iterator it = state.fWaitToCmd.begin(); it != state.fWaitToCmd.end(); it++) { @@ -724,23 +724,23 @@ void plResponderModifier::IDebugAnimBox(bool start) { plDebugText &debugTxt = plDebugText::Instance(); - UInt32 scrnWidth, scrnHeight; + uint32_t scrnWidth, scrnHeight; debugTxt.GetScreenSize(&scrnWidth, &scrnHeight); // Box size is 1/8 screen size - UInt32 boxSize = scrnHeight / 8; + uint32_t boxSize = scrnHeight / 8; // Draw box in lower left corner if (start) - debugTxt.DrawRect(0, (UInt16)(scrnHeight-boxSize), (UInt16)boxSize, (UInt16)scrnHeight, 0, 255, 0); + debugTxt.DrawRect(0, (uint16_t)(scrnHeight-boxSize), (uint16_t)boxSize, (uint16_t)scrnHeight, 0, 255, 0); else - debugTxt.DrawRect((UInt16)boxSize, (UInt16)(scrnHeight-boxSize), (UInt16)(boxSize*2), (UInt16)scrnHeight, 255, 0, 0); + debugTxt.DrawRect((uint16_t)boxSize, (uint16_t)(scrnHeight-boxSize), (uint16_t)(boxSize*2), (uint16_t)scrnHeight, 255, 0, 0); } void plResponderModifier::IDebugPlayMsg(plAnimCmdMsg* msg) { // Create a stop callback so we can do a cue for that too - plEventCallbackMsg *eventMsg = TRACKED_NEW plEventCallbackMsg; + plEventCallbackMsg *eventMsg = new plEventCallbackMsg; eventMsg->AddReceiver(GetKey()); eventMsg->fRepeats = 0; eventMsg->fUser = -1; @@ -766,7 +766,7 @@ void plResponderModifier::NoLogString(const char* str) #endif // STATUS_LOG } -void plResponderModifier::ILog(UInt32 color, const char* format, ...) +void plResponderModifier::ILog(uint32_t color, const char* format, ...) { #ifdef STATUS_LOG if (!gLog) diff --git a/Sources/Plasma/PubUtilLib/plModifier/plResponderModifier.h b/Sources/Plasma/PubUtilLib/plModifier/plResponderModifier.h index 13386edc..5d0b57dd 100644 --- a/Sources/Plasma/PubUtilLib/plModifier/plResponderModifier.h +++ b/Sources/Plasma/PubUtilLib/plModifier/plResponderModifier.h @@ -54,30 +54,30 @@ class plResponderModifier : public plSingleModifier { friend class plResponderSDLModifier; protected: - typedef std::map WaitToCmd; + typedef std::map WaitToCmd; class plResponderCmd { public: plResponderCmd() : fMsg(nil), fWaitOn(-1) {} - plResponderCmd(plMessage *msg, Int8 waitOn) : fMsg(msg), fWaitOn(waitOn) {} + plResponderCmd(plMessage *msg, int8_t waitOn) : fMsg(msg), fWaitOn(waitOn) {} plMessage *fMsg; - Int8 fWaitOn; // Index into fCompletedEvents of who we're waiting on + int8_t fWaitOn; // Index into fCompletedEvents of who we're waiting on }; class plResponderState { public: hsTArray fCmds; - Int8 fNumCallbacks; // So we know how far to search into the bitvector to find out when we're done - Int8 fSwitchToState; // State to switch to when all commands complete + int8_t fNumCallbacks; // So we know how far to search into the bitvector to find out when we're done + int8_t fSwitchToState; // State to switch to when all commands complete WaitToCmd fWaitToCmd; }; hsTArray fStates; - Int8 fCurState; // The current state (first index for fCommandList) - Int8 fCurCommand; // The command we are currently waiting to send (or -1 if we're not sending) + int8_t fCurState; // The current state (first index for fCommandList) + int8_t fCurCommand; // The command we are currently waiting to send (or -1 if we're not sending) bool fNetRequest; // Was the last trigger a net request hsBitVector fCompletedEvents; // Which events that commands are waiting on have completed bool fEnabled; @@ -94,16 +94,16 @@ protected: kDetectUnTrigger = 0x2, kSkipFFSound = 0x4 }; - UInt8 fFlags; - UInt32 fNotifyMsgFlags; // store the msg flags of the notify which triggered us + uint8_t fFlags; + uint32_t fNotifyMsgFlags; // store the msg flags of the notify which triggered us void Trigger(plNotifyMsg *msg); bool IIsLocalOnlyCmd(plMessage* cmd); bool IContinueSending(); - Int8 ICmdFromWait(Int8 waitIdx); + int8_t ICmdFromWait(int8_t waitIdx); - virtual hsBool IEval(double secs, hsScalar del, UInt32 dirty) { return true; } + virtual hsBool IEval(double secs, float del, uint32_t dirty) { return true; } static bool fDebugAnimBox; // Draws a box on screen when an animation is started static void IDebugAnimBox(bool start); @@ -116,9 +116,9 @@ protected: plMessage* IGetFastForwardMsg(plMessage* msg, bool python); void ISetResponderStateFromNotify(plNotifyMsg* msg); - void ISetResponderState(Int8 state); + void ISetResponderState(int8_t state); - void ILog(UInt32 color, const char* format, ...); + void ILog(uint32_t color, const char* format, ...); friend class plResponderComponent; friend class plResponderWait; @@ -143,12 +143,12 @@ public: // Restore callback state after load void Restore(); - const Int8 GetState() const { return fCurState; } + const int8_t GetState() const { return fCurState; } // // Export time only // void AddCommand(plMessage* pMsg, int state=0); - void AddCallback(Int8 state, Int8 cmd, Int8 callback); + void AddCallback(int8_t state, int8_t cmd, int8_t callback); }; // Message for changing the enable state in a responder modifier diff --git a/Sources/Plasma/PubUtilLib/plModifier/plSDLModifier.cpp b/Sources/Plasma/PubUtilLib/plModifier/plSDLModifier.cpp index 2746ad7e..e1477e31 100644 --- a/Sources/Plasma/PubUtilLib/plModifier/plSDLModifier.cpp +++ b/Sources/Plasma/PubUtilLib/plModifier/plSDLModifier.cpp @@ -70,10 +70,10 @@ void plSDLModifier::AddTarget(plSceneObject* so) if (so) plSingleModifier::AddTarget(so); if (!fStateCache) - fStateCache = TRACKED_NEW plStateDataRecord(GetSDLName()); + fStateCache = new plStateDataRecord(GetSDLName()); } -UInt32 plSDLModifier::IApplyModFlags(UInt32 sendFlags) +uint32_t plSDLModifier::IApplyModFlags(uint32_t sendFlags) { return sendFlags; } @@ -81,7 +81,7 @@ UInt32 plSDLModifier::IApplyModFlags(UInt32 sendFlags) // // write to net msg and send to server // -void plSDLModifier::ISendNetMsg(plStateDataRecord*& state, plKey senderKey, UInt32 sendFlags) +void plSDLModifier::ISendNetMsg(plStateDataRecord*& state, plKey senderKey, uint32_t sendFlags) { hsAssert(senderKey, "nil senderKey?"); @@ -112,7 +112,7 @@ hsBool plSDLModifier::MsgReceive(plMessage* msg) plSDLModifierMsg* sdlMsg = plSDLModifierMsg::ConvertNoRef(msg); if (sdlMsg && !stricmp(sdlMsg->GetSDLName(),GetSDLName())) { - UInt32 sendFlags = IApplyModFlags(sdlMsg->GetFlags()); + uint32_t sendFlags = IApplyModFlags(sdlMsg->GetFlags()); if (!fSentOrRecvdState) sendFlags |= plSynchedObject::kNewState; @@ -150,7 +150,7 @@ hsBool plSDLModifier::MsgReceive(plMessage* msg) // send a state update // bool gMooseDump=false; -void plSDLModifier::SendState(UInt32 sendFlags) +void plSDLModifier::SendState(uint32_t sendFlags) { hsAssert(fStateCache, "nil stateCache"); @@ -161,7 +161,7 @@ void plSDLModifier::SendState(UInt32 sendFlags) bool broadcast = (sendFlags & plSynchedObject::kBCastToClients) != 0; // record current state - plStateDataRecord* curState = TRACKED_NEW plStateDataRecord(GetSDLName()); + plStateDataRecord* curState = new plStateDataRecord(GetSDLName()); IPutCurrentStateIn(curState); // return sdl record which reflects current state of sceneObj, dirties curState if (!force) { diff --git a/Sources/Plasma/PubUtilLib/plModifier/plSDLModifier.h b/Sources/Plasma/PubUtilLib/plModifier/plSDLModifier.h index a8e8b7a3..2de7dd61 100644 --- a/Sources/Plasma/PubUtilLib/plModifier/plSDLModifier.h +++ b/Sources/Plasma/PubUtilLib/plModifier/plSDLModifier.h @@ -56,13 +56,13 @@ protected: plStateDataRecord* fStateCache; bool fSentOrRecvdState; - void ISendNetMsg(plStateDataRecord*& state, plKey senderKey, UInt32 sendFlags); // transmit net msg + void ISendNetMsg(plStateDataRecord*& state, plKey senderKey, uint32_t sendFlags); // transmit net msg virtual void IPutCurrentStateIn(plStateDataRecord* dstState) = 0; virtual void ISetCurrentStateFrom(const plStateDataRecord* srcState) = 0; virtual void ISentState(const plStateDataRecord* sentState) {} - hsBool IEval(double secs, hsScalar del, UInt32 dirty) {return false;} + hsBool IEval(double secs, float del, uint32_t dirty) {return false;} - virtual UInt32 IApplyModFlags(UInt32 sendFlags); + virtual uint32_t IApplyModFlags(uint32_t sendFlags); public: CLASSNAME_REGISTER( plSDLModifier ); @@ -72,7 +72,7 @@ public: virtual ~plSDLModifier(); hsBool MsgReceive(plMessage* msg); - void SendState(UInt32 sendFlags); // send a state update + void SendState(uint32_t sendFlags); // send a state update void ReceiveState(const plStateDataRecord* srcState); // recv a state update virtual const char* GetSDLName() const = 0; // return the string name of the type of state descriptor you handle virtual plKey GetStateOwnerKey() const; diff --git a/Sources/Plasma/PubUtilLib/plModifier/plSimpleModifier.cpp b/Sources/Plasma/PubUtilLib/plModifier/plSimpleModifier.cpp index 910a47ac..9a3e5d45 100644 --- a/Sources/Plasma/PubUtilLib/plModifier/plSimpleModifier.cpp +++ b/Sources/Plasma/PubUtilLib/plModifier/plSimpleModifier.cpp @@ -40,7 +40,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "plSimpleModifier.h" #include "plgDispatch.h" @@ -114,7 +114,7 @@ void plSimpleModifier::IEnd() } } -hsBool plSimpleModifier::IEval(double secs, hsScalar del, UInt32 dirty) +hsBool plSimpleModifier::IEval(double secs, float del, uint32_t dirty) { return IHandleTime(secs, del); } @@ -180,13 +180,13 @@ hsBool plSimpleModifier::IHandleCmd(plAnimCmdMsg* modMsg) return true; } -hsBool plSimpleModifier::IHandleTime(double wSecs, hsScalar del) +hsBool plSimpleModifier::IHandleTime(double wSecs, float del) { if( !fTarget ) return true; - hsScalar secs = fTimeConvert.WorldToAnimTime(wSecs); + float secs = fTimeConvert.WorldToAnimTime(wSecs); if( secs != fCurrentTime ) { diff --git a/Sources/Plasma/PubUtilLib/plModifier/plSimpleModifier.h b/Sources/Plasma/PubUtilLib/plModifier/plSimpleModifier.h index 2f9e4688..73990dd1 100644 --- a/Sources/Plasma/PubUtilLib/plModifier/plSimpleModifier.h +++ b/Sources/Plasma/PubUtilLib/plModifier/plSimpleModifier.h @@ -71,9 +71,9 @@ protected: plAnimTimeConvert fTimeConvert; // The following are in animation time. - hsScalar fCurrentTime; + float fCurrentTime; - hsBool IHandleTime(double wSecs, hsScalar del); + hsBool IHandleTime(double wSecs, float del); hsBool IHandleRef(plRefMsg* refMsg); virtual hsBool IHandleCmd(plAnimCmdMsg* modMsg); @@ -83,7 +83,7 @@ protected: virtual void IBegin(); virtual void IEnd(); - virtual hsBool IEval(double secs, hsScalar del, UInt32 dirty); + virtual hsBool IEval(double secs, float del, uint32_t dirty); public: plSimpleModifier(); diff --git a/Sources/Plasma/PubUtilLib/plModifier/plSoundSDLModifier.cpp b/Sources/Plasma/PubUtilLib/plModifier/plSoundSDLModifier.cpp index e4f895a0..3639d809 100644 --- a/Sources/Plasma/PubUtilLib/plModifier/plSoundSDLModifier.cpp +++ b/Sources/Plasma/PubUtilLib/plModifier/plSoundSDLModifier.cpp @@ -116,7 +116,7 @@ void plSoundSDLModifier::ISetCurrentStateFrom(const plStateDataRecord* srcState) { //double timeStarted; /*if (soundState->FindVar(kStrTime)->Get(&timeStarted)) - sound->SynchedPlay((hsScalar)timeStarted); + sound->SynchedPlay((float)timeStarted); else { // Can't get the time we're supposed to start at, so we'll just try to play normally, diff --git a/Sources/Plasma/PubUtilLib/plModifier/plSpawnModifier.cpp b/Sources/Plasma/PubUtilLib/plModifier/plSpawnModifier.cpp index 0f00aebe..54e9e110 100644 --- a/Sources/Plasma/PubUtilLib/plModifier/plSpawnModifier.cpp +++ b/Sources/Plasma/PubUtilLib/plModifier/plSpawnModifier.cpp @@ -40,7 +40,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ -//#include "hsTypes.h" +//#include "HeadSpin.h" //#include "hsGeometry3.h" //#include "plgDispatch.h" //#include "pnSceneObject/plDrawInterface.h" @@ -63,7 +63,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // fTargets.GetCount(); // for (int i=0; i < GetNumTargets(); i++) // { -// plSpawnModMsg* pMsg = NEW(plSpawnModMsg); +// plSpawnModMsg* pMsg = new plSpawnModMsg; // pMsg->AddReceiver( pSpawnMsg->GetSender() ); // //pMsg->fPos= GetTarget(i)->GetDrawInterface()->GetWorldBounds().GetCenter(); // pMsg->fPos= GetTarget(i)->GetCoordinateInterface()->GetLocalToWorld().GetTranslate(); diff --git a/Sources/Plasma/PubUtilLib/plModifier/plSpawnModifier.h b/Sources/Plasma/PubUtilLib/plModifier/plSpawnModifier.h index b32770af..1ddb919f 100644 --- a/Sources/Plasma/PubUtilLib/plModifier/plSpawnModifier.h +++ b/Sources/Plasma/PubUtilLib/plModifier/plSpawnModifier.h @@ -49,7 +49,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com class plSpawnModifier : public plMultiModifier { protected: - virtual hsBool IEval(double secs, hsScalar del, UInt32 dirty) {return true;} + virtual hsBool IEval(double secs, float del, uint32_t dirty) {return true;} public: plSpawnModifier(){;} diff --git a/Sources/Plasma/PubUtilLib/plNetClient/plLinkEffectsMgr.cpp b/Sources/Plasma/PubUtilLib/plNetClient/plLinkEffectsMgr.cpp index ed5bee0a..843a1fe1 100644 --- a/Sources/Plasma/PubUtilLib/plNetClient/plLinkEffectsMgr.cpp +++ b/Sources/Plasma/PubUtilLib/plNetClient/plLinkEffectsMgr.cpp @@ -39,7 +39,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com Mead, WA 99021 *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "pnKeyedObject/plKey.h" #include "hsTemplates.h" #include "hsStream.h" @@ -203,7 +203,7 @@ void plLinkEffectsMgr::ISendAllReadyCallbacks() { if (fLinks[i]->GetLinkKey() == plNetClientApp::GetInstance()->GetLocalPlayerKey()) { - plLinkOutUnloadMsg* lam = TRACKED_NEW plLinkOutUnloadMsg; // derived from LoadAgeMsg + plLinkOutUnloadMsg* lam = new plLinkOutUnloadMsg; // derived from LoadAgeMsg lam->SetAgeFilename( NetCommGetAge()->ageDatasetName ); lam->AddReceiver(plNetClientMgr::GetInstance()->GetKey()); lam->SetPlayerID(plNetClientMgr::GetInstance()->GetPlayerID()); @@ -212,14 +212,14 @@ void plLinkEffectsMgr::ISendAllReadyCallbacks() } else { - plLinkInDoneMsg* lid = TRACKED_NEW plLinkInDoneMsg; + plLinkInDoneMsg* lid = new plLinkInDoneMsg; lid->AddReceiver(fLinks[i]->GetLinkKey()); lid->SetBCastFlag(plMessage::kPropagateToModifiers); lid->Send(); if (fLinks[i]->GetLinkKey() == plNetClientApp::GetInstance()->GetLocalPlayerKey()) { - plLinkInDoneMsg* lid = TRACKED_NEW plLinkInDoneMsg; + plLinkInDoneMsg* lid = new plLinkInDoneMsg; lid->AddReceiver(plNetClientMgr::GetInstance()->GetKey()); lid->Send(); } @@ -251,7 +251,7 @@ hsBool plLinkEffectsMgr::MsgReceive(plMessage *msg) if (!plNetClientMgr::GetInstance()->IsAPlayerKey(pSeudoMsg->fAvatarKey)) return true; // send the trigger message to the avatar... - plPseudoLinkAnimTriggerMsg* pMsg = TRACKED_NEW plPseudoLinkAnimTriggerMsg(true, pSeudoMsg->fAvatarKey); + plPseudoLinkAnimTriggerMsg* pMsg = new plPseudoLinkAnimTriggerMsg(true, pSeudoMsg->fAvatarKey); pMsg->SetSender(GetKey()); pMsg->Send(); IAddPsuedo(pSeudoMsg); @@ -269,7 +269,7 @@ hsBool plLinkEffectsMgr::MsgReceive(plMessage *msg) { hsMatrix44 mat = pObj->GetCoordinateInterface()->GetLocalToWorld(); // create message - plWarpMsg* pMsg = TRACKED_NEW plWarpMsg(mat); + plWarpMsg* pMsg = new plWarpMsg(mat); pMsg->SetWarpFlags(plWarpMsg::kFlushTransform); pMsg->AddReceiver(pSeudoCallback->fAvatarKey); plUoid U(kVirtualCamera1_KEY); @@ -280,7 +280,7 @@ hsBool plLinkEffectsMgr::MsgReceive(plMessage *msg) } plgDispatch::MsgSend( pMsg ); // whoosh... off it goes // now make him re-appear - plPseudoLinkAnimTriggerMsg* pTrigMsg = TRACKED_NEW plPseudoLinkAnimTriggerMsg(false, pSeudoCallback->fAvatarKey); + plPseudoLinkAnimTriggerMsg* pTrigMsg = new plPseudoLinkAnimTriggerMsg(false, pSeudoCallback->fAvatarKey); pTrigMsg->SetSender(GetKey()); pTrigMsg->Send(); IRemovePseudo(pSeudoCallback->fAvatarKey); @@ -293,7 +293,7 @@ hsBool plLinkEffectsMgr::MsgReceive(plMessage *msg) { plNetApp::GetInstance()->DebugMsg("Received LinkEffectsTriggerPREPMsg\n"); IAddWait(tpMsg->GetTrigger()); - plLinkEffectPrepBCMsg *bcpMsg = TRACKED_NEW plLinkEffectPrepBCMsg; + plLinkEffectPrepBCMsg *bcpMsg = new plLinkEffectPrepBCMsg; bcpMsg->fLeavingAge = tpMsg->fLeavingAge; bcpMsg->fLinkKey = tpMsg->fLinkKey; bcpMsg->Send(); @@ -361,7 +361,7 @@ hsBool plLinkEffectsMgr::MsgReceive(plMessage *msg) else hsStatusMessage("Starting LinkIn FX\n"); - plLinkEffectBCMsg *BCMsg = TRACKED_NEW plLinkEffectBCMsg(); + plLinkEffectBCMsg *BCMsg = new plLinkEffectBCMsg(); BCMsg->fLinkKey = linkKey; BCMsg->SetLinkFlag(plLinkEffectBCMsg::kLeavingAge, pTriggerMsg->IsLeavingAge()); BCMsg->SetLinkFlag(plLinkEffectBCMsg::kSendCallback, true); @@ -424,11 +424,11 @@ hsBool plLinkEffectsMgr::MsgReceive(plMessage *msg) if (avMod && linkInAnim) { - plAvOneShotTask *task = TRACKED_NEW plAvOneShotTask(linkInAnim->GetName(), false, false, nil); + plAvOneShotTask *task = new plAvOneShotTask(linkInAnim->GetName(), false, false, nil); task->fBackwards = true; task->fDisableLooping = true; task->fDisablePhysics = false; - (TRACKED_NEW plAvTaskMsg(GetKey(), avMod->GetKey(), task))->Send(); + (new plAvTaskMsg(GetKey(), avMod->GetKey(), task))->Send(); } } @@ -439,7 +439,7 @@ hsBool plLinkEffectsMgr::MsgReceive(plMessage *msg) // link, plus we know any effect broadcast messages will have processed before this (and therefore // have told us to wait for them.) pTriggerMsg->fEffects++; - plLinkCallbackMsg *dummyMsg = TRACKED_NEW plLinkCallbackMsg(); + plLinkCallbackMsg *dummyMsg = new plLinkCallbackMsg(); dummyMsg->AddReceiver(GetKey()); dummyMsg->fLinkKey = linkKey; plgDispatch::MsgSend(dummyMsg); @@ -498,19 +498,19 @@ hsBool plLinkEffectsMgr::MsgReceive(plMessage *msg) return true; } - const hsScalar kMaxTimeForLinkTrigger = 30.f; + const float kMaxTimeForLinkTrigger = 30.f; // If we're not loading state, we're in the age. So this avatar coming in must be linking in. // If the player is us, no prep is necessary. if (!plNetClientApp::GetInstance()->IsLoadingInitialAgeState() && (pageMsg->fPlayer != nc->GetLocalPlayerKey())) { - plLinkEffectsTriggerMsg *trigMsg = TRACKED_NEW plLinkEffectsTriggerMsg; + plLinkEffectsTriggerMsg *trigMsg = new plLinkEffectsTriggerMsg; trigMsg->SetLeavingAge(false); trigMsg->SetLinkKey(pageMsg->fPlayer); // Send off the prep message right away - plLinkEffectsTriggerPrepMsg *trigPrepMsg = TRACKED_NEW plLinkEffectsTriggerPrepMsg; + plLinkEffectsTriggerPrepMsg *trigPrepMsg = new plLinkEffectsTriggerPrepMsg; trigPrepMsg->fLinkKey = pageMsg->fPlayer; trigPrepMsg->SetTrigger(trigMsg); trigPrepMsg->Send(GetKey()); @@ -529,7 +529,7 @@ hsBool plLinkEffectsMgr::MsgReceive(plMessage *msg) return hsKeyedObject::MsgReceive(msg); } -void plLinkEffectsMgr::WaitForEffect(plKey linkKey, hsScalar time) +void plLinkEffectsMgr::WaitForEffect(plKey linkKey, float time) { plLinkEffectsTriggerMsg *msg = IFindLinkTriggerMsg(linkKey); if (msg == nil) @@ -539,7 +539,7 @@ void plLinkEffectsMgr::WaitForEffect(plKey linkKey, hsScalar time) } msg->fEffects++; - plLinkCallbackMsg *callback = TRACKED_NEW plLinkCallbackMsg(); + plLinkCallbackMsg *callback = new plLinkCallbackMsg(); callback->fEvent = kStop; callback->fRepeats = 0; callback->fLinkKey = linkKey; @@ -559,7 +559,7 @@ plMessage *plLinkEffectsMgr::WaitForEffect(plKey linkKey) msg->fEffects++; - plLinkCallbackMsg *callback = TRACKED_NEW plLinkCallbackMsg(); + plLinkCallbackMsg *callback = new plLinkCallbackMsg(); callback->fEvent = kStop; callback->fRepeats = 0; callback->fLinkKey = linkKey; @@ -567,7 +567,7 @@ plMessage *plLinkEffectsMgr::WaitForEffect(plKey linkKey) return callback; } -void plLinkEffectsMgr::WaitForPseudoEffect(plKey linkKey, hsScalar time) +void plLinkEffectsMgr::WaitForPseudoEffect(plKey linkKey, float time) { plPseudoLinkEffectMsg* msg = IFindPseudo(linkKey); if (msg == nil) @@ -576,7 +576,7 @@ void plLinkEffectsMgr::WaitForPseudoEffect(plKey linkKey, hsScalar time) return; } - plPseudoLinkAnimCallbackMsg* callback = TRACKED_NEW plPseudoLinkAnimCallbackMsg(); + plPseudoLinkAnimCallbackMsg* callback = new plPseudoLinkAnimCallbackMsg(); callback->fAvatarKey = linkKey; double timeToDeliver = hsTimer::GetSysSeconds() + time; callback->SetTimeStamp( timeToDeliver ); diff --git a/Sources/Plasma/PubUtilLib/plNetClient/plLinkEffectsMgr.h b/Sources/Plasma/PubUtilLib/plNetClient/plLinkEffectsMgr.h index cea212b7..e4cd3b45 100644 --- a/Sources/Plasma/PubUtilLib/plNetClient/plLinkEffectsMgr.h +++ b/Sources/Plasma/PubUtilLib/plNetClient/plLinkEffectsMgr.h @@ -86,8 +86,8 @@ public: CLASSNAME_REGISTER( plLinkEffectsMgr ); GETINTERFACE_ANY( plLinkEffectsMgr, hsKeyedObject ); - void WaitForEffect(plKey linkKey, hsScalar time); - void WaitForPseudoEffect(plKey linkKey, hsScalar time); + void WaitForEffect(plKey linkKey, float time); + void WaitForPseudoEffect(plKey linkKey, float time); plMessage *WaitForEffect(plKey linkKey); diff --git a/Sources/Plasma/PubUtilLib/plNetClient/plNetCliAgeJoiner.cpp b/Sources/Plasma/PubUtilLib/plNetClient/plNetCliAgeJoiner.cpp index 73941f36..60eeb30e 100644 --- a/Sources/Plasma/PubUtilLib/plNetClient/plNetCliAgeJoiner.cpp +++ b/Sources/Plasma/PubUtilLib/plNetClient/plNetCliAgeJoiner.cpp @@ -198,7 +198,7 @@ void plNCAgeJoiner::Complete (bool success, const char msg[]) { notify.msg = msg; callback(this, kAgeJoinerComplete, ¬ify, userState); - DEL(this); + delete this; } } @@ -340,7 +340,7 @@ void plNCAgeJoiner::ExecNextOp () { case kEnableClickables: { LogMsg(kLogPerf, L"AgeJoiner: Exec:kEnableClickables"); // Enable scene clickables - (void)(TRACKED_NEW plInputIfaceMgrMsg(plInputIfaceMgrMsg::kEnableClickables))->Send(); + (void)(new plInputIfaceMgrMsg(plInputIfaceMgrMsg::kEnableClickables))->Send(); LogMsg(kLogPerf, L"AgeJoiner: Next:kNotifyAgeLoaded"); nextOp = kNotifyAgeLoaded; diff --git a/Sources/Plasma/PubUtilLib/plNetClient/plNetCliAgeLeaver.cpp b/Sources/Plasma/PubUtilLib/plNetClient/plNetCliAgeLeaver.cpp index c52ce77a..46869a21 100644 --- a/Sources/Plasma/PubUtilLib/plNetClient/plNetCliAgeLeaver.cpp +++ b/Sources/Plasma/PubUtilLib/plNetClient/plNetCliAgeLeaver.cpp @@ -139,7 +139,7 @@ void plNCAgeLeaver::Complete (bool success, const char msg[]) { notify.msg = msg; callback(this, kAgeLeaveComplete, ¬ify, userState); - DEL(this); + delete this; } } @@ -193,7 +193,7 @@ void plNCAgeLeaver::ExecNextOp () { //==================================================================== case kDisableClickables: { - (TRACKED_NEW plInputIfaceMgrMsg(plInputIfaceMgrMsg::kDisableClickables))->Send(); + (new plInputIfaceMgrMsg(plInputIfaceMgrMsg::kDisableClickables))->Send(); nextOp = kLinkOutFX; } break; diff --git a/Sources/Plasma/PubUtilLib/plNetClient/plNetClientMgr.cpp b/Sources/Plasma/PubUtilLib/plNetClient/plNetClientMgr.cpp index 6c374809..1a0fb70a 100644 --- a/Sources/Plasma/PubUtilLib/plNetClient/plNetClientMgr.cpp +++ b/Sources/Plasma/PubUtilLib/plNetClient/plNetClientMgr.cpp @@ -223,10 +223,10 @@ void plNetClientMgr::IClearPendingLoads() // void plNetClientMgr::IAddCloneRoom() { - plSceneNode *cloneRoom = TRACKED_NEW plSceneNode(); + plSceneNode *cloneRoom = new plSceneNode(); cloneRoom->RegisterAs(kNetClientCloneRoom_KEY); plKey clientKey=hsgResMgr::ResMgr()->FindKey(kClient_KEY); - plClientRefMsg *pMsg1 = TRACKED_NEW plClientRefMsg(clientKey, plRefMsg::kOnCreate, -1, plClientRefMsg::kManualRoom); + plClientRefMsg *pMsg1 = new plClientRefMsg(clientKey, plRefMsg::kOnCreate, -1, plClientRefMsg::kManualRoom); hsgResMgr::ResMgr()->AddViaNotify(cloneRoom->GetKey(), pMsg1, plRefFlags::kPassiveRef); } @@ -439,7 +439,7 @@ void plNetClientMgr::StartLinkOutFX() { plNetLinkingMgr * lm = plNetLinkingMgr::GetInstance(); - plLinkEffectsTriggerMsg* lem = TRACKED_NEW plLinkEffectsTriggerMsg(); + plLinkEffectsTriggerMsg* lem = new plLinkEffectsTriggerMsg(); lem->SetLeavingAge(true); lem->SetLinkKey(fLocalPlayerKey); lem->SetBCastFlag(plMessage::kNetPropagate); @@ -458,7 +458,7 @@ void plNetClientMgr::StartLinkInFX() { const plArmatureMod *avMod = plAvatarMgr::GetInstance()->GetLocalAvatar(); - plLinkEffectsTriggerMsg* lem = TRACKED_NEW plLinkEffectsTriggerMsg(); + plLinkEffectsTriggerMsg* lem = new plLinkEffectsTriggerMsg(); lem->SetLeavingAge(false); // linking in lem->SetLinkKey(fLocalPlayerKey); lem->SetLinkInAnimKey(avMod->GetLinkInAnimKey()); @@ -634,7 +634,7 @@ void plNetClientMgr::ICheckPendingStateLoad(double secs) plSynchedObject*so = pl->fKey ? plSynchedObject::ConvertNoRef(pl->fKey->ObjectIsLoaded()) : nil; if (so && so->IsFinal()) { - plSDLModifierMsg* sdlMsg = TRACKED_NEW plSDLModifierMsg(pl->fSDRec->GetDescriptor()->GetName(), + plSDLModifierMsg* sdlMsg = new plSDLModifierMsg(pl->fSDRec->GetDescriptor()->GetName(), plSDLModifierMsg::kRecv); sdlMsg->SetState( pl->fSDRec, true/*delete pl->fSDRec for us*/ ); sdlMsg->SetPlayerID( pl->fPlayerID ); @@ -915,7 +915,7 @@ hsBool plNetClientMgr::MsgReceive( plMessage* msg ) if ( GetFlagsBit( kNeedToSendInitialAgeStateLoadedMsg ) ) { SetFlagsBit(kNeedToSendInitialAgeStateLoadedMsg, false); - plInitialAgeStateLoadedMsg* m = TRACKED_NEW plInitialAgeStateLoadedMsg; + plInitialAgeStateLoadedMsg* m = new plInitialAgeStateLoadedMsg; m->Send(); } @@ -1108,7 +1108,7 @@ void plNetClientMgr::IncNumInitialSDLStates() void plNetClientMgr::NotifyRcvdAllSDLStates() { DebugMsg( "Got all initial SDL states" ); - plNetClientMgrMsg * msg = TRACKED_NEW plNetClientMgrMsg(); + plNetClientMgrMsg * msg = new plNetClientMgrMsg(); msg->type = plNetClientMgrMsg::kNotifyRcvdAllSDLStates; msg->SetBCastFlag(plMessage::kBCastByType); msg->Send(); @@ -1178,7 +1178,7 @@ unsigned plNetClientMgr::GetPlayerIdByName (const plString & name) const { return 0; } -UInt32 plNetClientMgr::GetPlayerID() const +uint32_t plNetClientMgr::GetPlayerID() const { return NetCommGetPlayer()->playerInt; } @@ -1243,7 +1243,7 @@ void plNetClientMgr::MakeCCRInvisible(plKey avKey, int level) return; } - plAvatarStealthModeMsg *msg = TRACKED_NEW plAvatarStealthModeMsg(); + plAvatarStealthModeMsg *msg = new plAvatarStealthModeMsg(); msg->SetSender(avKey); msg->fLevel = level; @@ -1305,12 +1305,12 @@ void plNetClientMgr::IDisableNet () { char title[256]; StrPrintf(title, arrsize(title), "%S Error", ProductCoreName()); hsMessageBox(fDisableMsg->str, title, hsMessageBoxNormal, hsMessageBoxIconError ); - plClientMsg *quitMsg = NEW(plClientMsg)(plClientMsg::kQuit); + plClientMsg *quitMsg = new plClientMsg(plClientMsg::kQuit); quitMsg->Send(hsgResMgr::ResMgr()->FindKey(kClient_KEY)); } else { - pfKIMsg *msg = TRACKED_NEW pfKIMsg(pfKIMsg::kKIOKDialog); + pfKIMsg *msg = new pfKIMsg(pfKIMsg::kKIOKDialog); msg->SetString(fDisableMsg->str); msg->Send(); } @@ -1409,7 +1409,7 @@ bool plNetClientMgr::IHandlePlayerPageMsg(plPlayerPageMsg *playerMsg) } // for debugging purposes -bool plNetClientMgr::IFindModifier(plSynchedObject* obj, Int16 classIdx) +bool plNetClientMgr::IFindModifier(plSynchedObject* obj, int16_t classIdx) { plLayerAnimation* layer = plLayerAnimation::ConvertNoRef(obj); if (layer) diff --git a/Sources/Plasma/PubUtilLib/plNetClient/plNetClientMgr.h b/Sources/Plasma/PubUtilLib/plNetClient/plNetClientMgr.h index 64992cdf..ce33cab9 100644 --- a/Sources/Plasma/PubUtilLib/plNetClient/plNetClientMgr.h +++ b/Sources/Plasma/PubUtilLib/plNetClient/plNetClientMgr.h @@ -42,8 +42,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #ifndef PL_NET_CLIENT_inc #define PL_NET_CLIENT_inc -#include "hsConfig.h" -#include "hsUtils.h" +#include "HeadSpin.h" #include "hsStlUtils.h" #include "plNetClientGroup.h" @@ -126,7 +125,7 @@ public: // must be set by user plStateDataRecord* fSDRec; // the sdl data record plUoid fUoid; // the object it's meant for - UInt32 fPlayerID; // the player that originally sent the state + uint32_t fPlayerID; // the player that originally sent the state // set by NetClient plKey fKey; // the key of the object it's meant for @@ -163,15 +162,15 @@ private: std::string fIniAccountName; std::string fIniAccountPass; std::string fIniAuthServer; - UInt32 fIniPlayerID; // the player we want to load from vault. + uint32_t fIniPlayerID; // the player we want to load from vault. std::string fSPDesiredPlayerName; // SP: the player we want to load from vault. // server info double fServerTimeOffset; // diff between our unified time and server's unified time - UInt32 fTimeSamples; + uint32_t fTimeSamples; double fLastTimeUpdate; - UInt8 fJoinOrder; // returned by the server + uint8_t fJoinOrder; // returned by the server // voice lists int fListenListMode; // how we are generating our listen list @@ -186,9 +185,9 @@ private: std::vector fMsgPlayers; plKey fAgeSDLObjectKey; - UInt8 fExperimentalLevel; + uint8_t fExperimentalLevel; plNetClientStats fNetClientStats; - UInt8 fPingServerType; // non-zero if we're pinging someone + uint8_t fPingServerType; // non-zero if we're pinging someone float fOverrideAgeTimeOfDayPercent; // for console debugging int fNumInitialSDLStates; @@ -219,7 +218,7 @@ private: void IHandleNetVoiceListMsg(plNetVoiceListMsg* msg); hsBool IApplyNewListenList(std::vector& newListenList, hsBool forceSynch); int IPrepMsg(plNetMessage* msg); - void IPlayerChangeAge(hsBool exiting, Int32 spawnPt); + void IPlayerChangeAge(hsBool exiting, int32_t spawnPt); void IAddCloneRoom(); void IRemoveCloneRoom(); @@ -228,7 +227,7 @@ private: plKey ILoadClone(plLoadCloneMsg *cloneMsg); - bool IFindModifier(plSynchedObject* obj, Int16 classIdx); + bool IFindModifier(plSynchedObject* obj, int16_t classIdx); void IClearPendingLoads(); // recorder @@ -277,22 +276,22 @@ public: void SetIniAuthServer(const char * value) { fIniAuthServer=value;} void SetIniAccountName(const char * value) { fIniAccountName=value;} void SetIniAccountPass(const char * value) { fIniAccountPass=value;} - void SetIniPlayerID(UInt32 value) { fIniPlayerID=value;} + void SetIniPlayerID(uint32_t value) { fIniPlayerID=value;} void SetSPDesiredPlayerName( const char * value ) { fSPDesiredPlayerName=value;} const char * GetSPDesiredPlayerName() const { return fSPDesiredPlayerName.c_str(); } void SetLocalPlayerKey(plKey l, hsBool pageOut=false); void SetNullSend(hsBool on); // turn null send on/off - void SetPingServer(UInt8 serverType) { fPingServerType = serverType; } + void SetPingServer(uint8_t serverType) { fPingServerType = serverType; } // getters - UInt32 GetPlayerID( void ) const; + uint32_t GetPlayerID( void ) const; plString GetPlayerName( const plKey avKey=nil ) const; plString GetPlayerNameById (unsigned playerId) const; unsigned GetPlayerIdByName(const plString & name) const; - UInt8 GetJoinOrder() const { return fJoinOrder; } // only valid at join time + uint8_t GetJoinOrder() const { return fJoinOrder; } // only valid at join time plKey GetLocalPlayerKey() const { return fLocalPlayerKey; } plSynchedObject* GetLocalPlayer(hsBool forceLoad=false) const; @@ -311,7 +310,7 @@ public: void IncTaskProgress( const char *msg ); // avatar vault actions - int UploadPlayerVault(UInt32 vaultFlags); + int UploadPlayerVault(uint32_t vaultFlags); // remote players const std::vector& RemotePlayerKeys() const { return fRemotePlayerKeys; } @@ -354,7 +353,7 @@ public: void MakeCCRInvisible(plKey avKey, int level); bool CCRVaultConnected() const { return GetFlagsBit(kCCRVaultConnected); } - UInt8 GetExperimentalLevel() const { return fExperimentalLevel; } + uint8_t GetExperimentalLevel() const { return fExperimentalLevel; } void AddPendingLoad(PendingLoad *pl); const plKey& GetAgeSDLObjectKey() const { return fAgeSDLObjectKey; } @@ -381,7 +380,7 @@ public: bool IsObjectOwner(); void SetObjectOwner(bool own); - void StoreSDLState(const plStateDataRecord* sdRec, const plUoid& uoid, UInt32 sendFlags, UInt32 writeOptions); + void StoreSDLState(const plStateDataRecord* sdRec, const plUoid& uoid, uint32_t sendFlags, uint32_t writeOptions); void UpdateServerTimeOffset(plNetMessage* msg); void ResetServerTimeOffset(); @@ -392,8 +391,8 @@ private: int IInitNetClientComm(); int IDeInitNetClientComm(); - void INetClientCommOpStarted(UInt32 context); - void INetClientCommOpComplete(UInt32 context, int resultCode); + void INetClientCommOpStarted(uint32_t context); + void INetClientCommOpComplete(uint32_t context, int resultCode); friend struct plNCAgeJoiner; friend struct plNCAgeLeaver; diff --git a/Sources/Plasma/PubUtilLib/plNetClient/plNetClientMgrLoad.cpp b/Sources/Plasma/PubUtilLib/plNetClient/plNetClientMgrLoad.cpp index ac075455..a27fa4e6 100644 --- a/Sources/Plasma/PubUtilLib/plNetClient/plNetClientMgrLoad.cpp +++ b/Sources/Plasma/PubUtilLib/plNetClient/plNetClientMgrLoad.cpp @@ -125,7 +125,7 @@ plKey plNetClientMgr::ILoadClone(plLoadCloneMsg *pCloneMsg) plKey cloneNodeKey = hsgResMgr::ResMgr()->FindKey(kNetClientCloneRoom_KEY); // Put the clone into the room, which also forces it to load. - plNodeRefMsg* nodeRefCloneMsg = TRACKED_NEW plNodeRefMsg(cloneNodeKey, plNodeRefMsg::kOnRequest, -1, plNodeRefMsg::kObject); + plNodeRefMsg* nodeRefCloneMsg = new plNodeRefMsg(cloneNodeKey, plNodeRefMsg::kOnRequest, -1, plNodeRefMsg::kObject); hsgResMgr::ResMgr()->AddViaNotify(cloneKey, nodeRefCloneMsg, plRefFlags::kActiveRef); // Finally, pump the dispatch system so all the new refs get delivered. ? @@ -145,7 +145,7 @@ plKey plNetClientMgr::ILoadClone(plLoadCloneMsg *pCloneMsg) GetKey()->Release(cloneKey); // undo the active ref we took in ILoadClone // send message to scene object to remove him from the room - plNodeChangeMsg* nodeChange = TRACKED_NEW plNodeChangeMsg(GetKey(), cloneKey, nil); + plNodeChangeMsg* nodeChange = new plNodeChangeMsg(GetKey(), cloneKey, nil); plgDispatch::MsgSend(nodeChange); } @@ -166,7 +166,7 @@ plKey plNetClientMgr::ILoadClone(plLoadCloneMsg *pCloneMsg) // Cause a player to respawn. This is typically called on the local player when he links to a new age. // or for unspawn: // -void plNetClientMgr::IPlayerChangeAge(hsBool exitAge, Int32 spawnPt) +void plNetClientMgr::IPlayerChangeAge(hsBool exitAge, int32_t spawnPt) { plArmatureMod *avatar = plAvatarMgr::GetInstance()->GetLocalAvatar(); diff --git a/Sources/Plasma/PubUtilLib/plNetClient/plNetClientMgrRecord.cpp b/Sources/Plasma/PubUtilLib/plNetClient/plNetClientMgrRecord.cpp index 5415a149..66ef1477 100644 --- a/Sources/Plasma/PubUtilLib/plNetClient/plNetClientMgrRecord.cpp +++ b/Sources/Plasma/PubUtilLib/plNetClient/plNetClientMgrRecord.cpp @@ -55,15 +55,15 @@ bool plNetClientMgr::RecordMsgs(const char* recType, const char* recName) if (!fMsgRecorder) { if (stricmp(recType,"stream") == 0) - fMsgRecorder = TRACKED_NEW plNetClientStreamRecorder; + fMsgRecorder = new plNetClientStreamRecorder; if (stricmp(recType,"stressstream") == 0) - fMsgRecorder = TRACKED_NEW plNetClientStressStreamRecorder; + fMsgRecorder = new plNetClientStressStreamRecorder; if (stricmp(recType,"stats") == 0) - fMsgRecorder = TRACKED_NEW plNetClientStatsRecorder; + fMsgRecorder = new plNetClientStatsRecorder; if (stricmp(recType,"streamandstats") == 0) - fMsgRecorder = TRACKED_NEW plNetClientStreamAndStatsRecorder(TRACKED_NEW plNetClientStreamRecorder(), TRACKED_NEW plNetClientStatsRecorder()); + fMsgRecorder = new plNetClientStreamAndStatsRecorder(new plNetClientStreamRecorder(), new plNetClientStatsRecorder()); if (stricmp(recType,"stressstreamandstats") == 0) - fMsgRecorder = TRACKED_NEW plNetClientStreamAndStatsRecorder(TRACKED_NEW plNetClientStressStreamRecorder(), TRACKED_NEW plNetClientStatsRecorder()); + fMsgRecorder = new plNetClientStreamAndStatsRecorder(new plNetClientStressStreamRecorder(), new plNetClientStatsRecorder()); if (!fMsgRecorder || !fMsgRecorder->BeginRecording(recName)) { @@ -85,7 +85,7 @@ bool plNetClientMgr::PlaybackMsgs(const char* recName) { hsLogEntry(DebugMsg("DEMO: Beginning Playback")); - plNetClientRecorder* player = TRACKED_NEW plNetClientStreamRecorder; + plNetClientRecorder* player = new plNetClientStreamRecorder; if (player->BeginPlayback(recName)) { diff --git a/Sources/Plasma/PubUtilLib/plNetClient/plNetClientMgrSend.cpp b/Sources/Plasma/PubUtilLib/plNetClient/plNetClientMgrSend.cpp index 4ac812ff..b40734cc 100644 --- a/Sources/Plasma/PubUtilLib/plNetClient/plNetClientMgrSend.cpp +++ b/Sources/Plasma/PubUtilLib/plNetClient/plNetClientMgrSend.cpp @@ -98,14 +98,14 @@ int plNetClientMgr::ISendDirtyState(double secs) { std::vector carryOvers; - Int32 num=plSynchedObject::GetNumDirtyStates(); + int32_t num=plSynchedObject::GetNumDirtyStates(); #if 0 if (num) { DebugMsg("%d dirty sdl state msgs queued, t=%f", num, secs); } #endif - Int32 i; + int32_t i; for(i=0;iGetType(); + uint8_t type = petMsg->GetType(); const char* title = petMsg->GetTitle(); const char* note = petMsg->GetNote(); @@ -170,9 +170,9 @@ void plNetClientMgr::ISendCCRPetition(plCCRPetitionMsg* petMsg) buf.resize( size ); ram.CopyToMem( (void*)buf.data() ); - wchar * wStr = StrDupToUnicode(buf.c_str()); + wchar_t * wStr = StrDupToUnicode(buf.c_str()); NetCliAuthSendCCRPetition(wStr); - FREE(wStr); + free(wStr); } // @@ -180,7 +180,7 @@ void plNetClientMgr::ISendCCRPetition(plCCRPetitionMsg* petMsg) // void plNetClientMgr::ISendCameraReset(hsBool bEnteringAge) { - plCameraMsg* pCamMsg = TRACKED_NEW plCameraMsg; + plCameraMsg* pCamMsg = new plCameraMsg; if (bEnteringAge) pCamMsg->SetCmd(plCameraMsg::kResetOnEnter); else @@ -272,7 +272,7 @@ int plNetClientMgr::ISendGameMessage(plMessage* msg) { plLoadAvatarMsg* lam=plLoadAvatarMsg::ConvertNoRef(msg); - netMsgWrap = TRACKED_NEW plNetMsgLoadClone; + netMsgWrap = new plNetMsgLoadClone; plNetMsgLoadClone* netLoadClone=plNetMsgLoadClone::ConvertNoRef(netMsgWrap); netLoadClone->SetIsPlayer(lam && lam->GetIsPlayer()); @@ -282,11 +282,11 @@ int plNetClientMgr::ISendGameMessage(plMessage* msg) else if (dstIDs) { - netMsgWrap = TRACKED_NEW plNetMsgGameMessageDirected; + netMsgWrap = new plNetMsgGameMessageDirected; int i; for(i=0;isize();i++) { - UInt32 playerID = (*dstIDs)[i]; + uint32_t playerID = (*dstIDs)[i]; if (playerID == NetCommGetPlayer()->playerInt) continue; hsLogEntry( DebugMsg( "\tAdding receiver: %lu" , playerID ) ); @@ -294,7 +294,7 @@ int plNetClientMgr::ISendGameMessage(plMessage* msg) } } else - netMsgWrap = TRACKED_NEW plNetMsgGameMessage; + netMsgWrap = new plNetMsgGameMessage; // check delivery timestamp if (msg->GetTimeStamp()<=hsTimer::GetSysSeconds()) @@ -383,7 +383,7 @@ int plNetClientMgr::ISendGameMessage(plMessage* msg) netMsgWrap->SetBit(plNetMessage::kNeedsReliableSend, 0); // clear reliable net send bit #ifdef HS_DEBUGGING - Int16 type=*(Int16*)netMsgWrap->StreamInfo()->GetStreamBuf(); + int16_t type=*(int16_t*)netMsgWrap->StreamInfo()->GetStreamBuf(); hsAssert(type>=0 && typePrepNetMsg(0, writeOptions); @@ -470,5 +470,5 @@ void plNetClientMgr::StoreSDLState(const plStateDataRecord* sdRec, const plUoid& } SendMsg(msg); - DEL(msg); + delete msg; } diff --git a/Sources/Plasma/PubUtilLib/plNetClient/plNetClientMgrShow.cpp b/Sources/Plasma/PubUtilLib/plNetClient/plNetClientMgrShow.cpp index ad63ead4..fd3f4897 100644 --- a/Sources/Plasma/PubUtilLib/plNetClient/plNetClientMgrShow.cpp +++ b/Sources/Plasma/PubUtilLib/plNetClient/plNetClientMgrShow.cpp @@ -105,7 +105,7 @@ void plNetClientMgr::IShowLists() mbr->GetTransportFlags() & plNetTransportMember::kSendingActions ? "A" : " ", mbr->AsString().c_str(), mbr->IsPeerToPeer(), - mbr->GetDistSq() != hsScalarMax ? hsSquareRoot(mbr->GetDistSq()) :-1.f); + mbr->GetDistSq() != FLT_MAX ? sqrt(mbr->GetDistSq()) :-1.f); txt.DrawString(x,y,str); y+=yOff; mbr->SetTransportFlags(mbr->GetTransportFlags() & @@ -184,12 +184,12 @@ void plNetClientMgr::IShowRooms() } } -UInt32 IPrintRelRegion(const hsBitVector& region, int x, int y, const hsBitVector* cmpRegion) +uint32_t IPrintRelRegion(const hsBitVector& region, int x, int y, const hsBitVector* cmpRegion) { char buf[256]; int maxBits = 255; - UInt32 num = plRelevanceMgr::Instance()->GetNumRegions(); + uint32_t num = plRelevanceMgr::Instance()->GetNumRegions(); if (num > maxBits) num = maxBits; @@ -229,7 +229,7 @@ void plNetClientMgr::IShowRelevanceRegions() // // Print out the player names in the first column // - UInt32 maxPlayerName = 0; + uint32_t maxPlayerName = 0; txt.DrawString(x, y, _TEMP_CONVERT_TO_CONST_CHAR(GetPlayerName())); maxPlayerName = hsMaximum(maxPlayerName, txt.CalcStringWidth(_TEMP_CONVERT_TO_CONST_CHAR(GetPlayerName()))); @@ -265,7 +265,7 @@ void plNetClientMgr::IShowRelevanceRegions() if (avMod) { ourIn = &avMod->GetRelRegionImIn(); - UInt32 width = IPrintRelRegion(*ourIn, x, y, nil); + uint32_t width = IPrintRelRegion(*ourIn, x, y, nil); ourCare = &avMod->GetRelRegionCareAbout(); IPrintRelRegion(*ourCare, x + width + xOff, y, nil); @@ -287,7 +287,7 @@ void plNetClientMgr::IShowRelevanceRegions() if (avMod) { const hsBitVector& in = avMod->GetRelRegionImIn(); - UInt32 width = IPrintRelRegion(in, x, y, ourCare); + uint32_t width = IPrintRelRegion(in, x, y, ourCare); const hsBitVector& care = avMod->GetRelRegionCareAbout(); IPrintRelRegion(care, x + width + xOff, y, ourIn); diff --git a/Sources/Plasma/PubUtilLib/plNetClient/plNetClientMgrVoice.cpp b/Sources/Plasma/PubUtilLib/plNetClient/plNetClientMgrVoice.cpp index 32739663..c4f1fffc 100644 --- a/Sources/Plasma/PubUtilLib/plNetClient/plNetClientMgrVoice.cpp +++ b/Sources/Plasma/PubUtilLib/plNetClient/plNetClientMgrVoice.cpp @@ -245,7 +245,7 @@ hsBool plNetClientMgr::IUpdateListenList(double secs) int i; for(i=0;iSetDistSq(hsScalarMax); + fTransport.GetMember(i)->SetDistSq(FLT_MAX); if (fTransport.GetMember(i)->IsServer()) continue; @@ -337,7 +337,7 @@ hsBool plNetClientMgr::IUpdateListenList(double secs) SynchTalkList(); #endif // notify KI, member distances have been updated - plMemberUpdateMsg* mu = TRACKED_NEW plMemberUpdateMsg; + plMemberUpdateMsg* mu = new plMemberUpdateMsg; mu->Send(); } diff --git a/Sources/Plasma/PubUtilLib/plNetClient/plNetClientMsgHandler.cpp b/Sources/Plasma/PubUtilLib/plNetClient/plNetClientMsgHandler.cpp index 2c5b911b..15591b68 100644 --- a/Sources/Plasma/PubUtilLib/plNetClient/plNetClientMsgHandler.cpp +++ b/Sources/Plasma/PubUtilLib/plNetClient/plNetClientMsgHandler.cpp @@ -110,10 +110,10 @@ int plNetClientMsgHandler::PeekMsg(plNetMessage * netMsg) void plNetClientMsgHandler::IFillInTransportMember(const plNetMsgMemberInfoHelper* mbi, plNetTransportMember* mbr) { const plNetClientMgr* nc=IGetNetClientMgr(); - UInt16 port = mbi->GetClientGuid()->GetSrcPort(); - UInt32 addr = mbi->GetClientGuid()->GetSrcAddr(); - UInt32 flags = mbi->GetFlags(); - UInt32 plrID = mbi->GetClientGuid()->GetPlayerID(); + uint16_t port = mbi->GetClientGuid()->GetSrcPort(); + uint32_t addr = mbi->GetClientGuid()->GetSrcAddr(); + uint32_t flags = mbi->GetFlags(); + uint32_t plrID = mbi->GetClientGuid()->GetPlayerID(); plUoid avUoid = mbi->GetAvatarUoid(); plKey avKey=hsgResMgr::ResMgr()->FindKey(avUoid); @@ -176,7 +176,7 @@ MSG_HANDLER_DEFN(plNetClientMsgHandler,plNetMsgGroupOwner) */ /* - plNetOwnershipMsg* netOwnMsg = TRACKED_NEW plNetOwnershipMsg; + plNetOwnershipMsg* netOwnMsg = new plNetOwnershipMsg; int i; for(i=0;iGetNumGroups();i++) @@ -211,7 +211,7 @@ MSG_HANDLER_DEFN(plNetClientMsgHandler,plNetMsgSDLState) m->ClassName(), m->AsStdString().c_str(), m->GetNetCoreMsgLen()) ); */ - UInt32 rwFlags = 0; + uint32_t rwFlags = 0; if ( m->IsInitialState() ) { @@ -247,7 +247,7 @@ MSG_HANDLER_DEFN(plNetClientMsgHandler,plNetMsgSDLState) // // ERROR CHECK SDL FILE // - plStateDataRecord* sdRec = des ? TRACKED_NEW plStateDataRecord(des) : nil; + plStateDataRecord* sdRec = des ? new plStateDataRecord(des) : nil; if (!sdRec || sdRec->GetDescriptor()->GetVersion()!=ver) { std::string err; @@ -269,7 +269,7 @@ MSG_HANDLER_DEFN(plNetClientMsgHandler,plNetMsgSDLState) plStateDataRecord* stateRec = nil; if (m->IsInitialState()) { - stateRec = TRACKED_NEW plStateDataRecord(des); + stateRec = new plStateDataRecord(des); stateRec->SetFromDefaults(false); stateRec->UpdateFrom(*sdRec, rwFlags); @@ -278,7 +278,7 @@ MSG_HANDLER_DEFN(plNetClientMsgHandler,plNetMsgSDLState) else stateRec = sdRec; - plNetClientMgr::PendingLoad* pl = TRACKED_NEW plNetClientMgr::PendingLoad(); + plNetClientMgr::PendingLoad* pl = new plNetClientMgr::PendingLoad(); pl->fSDRec = stateRec; // will be deleted when PendingLoad is processed if (m->GetHasPlayerID()) pl->fPlayerID = m->GetPlayerID(); // copy originating playerID if we have it @@ -334,7 +334,7 @@ MSG_HANDLER_DEFN(plNetClientMsgHandler,plNetMsgGameMessage) plLoadAvatarMsg* unloadClone = plLoadAvatarMsg::ConvertNoRef(gameMsg); if (unloadClone) { - plLoadAvatarMsg* unloadMsg = TRACKED_NEW plLoadAvatarMsg(unloadClone->GetCloneKey(), unloadClone->GetRequestorKey(), unloadClone->GetUserData(), unloadClone->GetIsPlayer(), false); + plLoadAvatarMsg* unloadMsg = new plLoadAvatarMsg(unloadClone->GetCloneKey(), unloadClone->GetRequestorKey(), unloadClone->GetUserData(), unloadClone->GetIsPlayer(), false); unloadMsg->SetOriginatingPlayerID(unloadClone->GetOriginatingPlayerID()); gameMsg = unloadMsg; } @@ -485,7 +485,7 @@ MSG_HANDLER_DEFN(plNetClientMsgHandler,plNetMsgMembersList) // this app is not one of the members in the msg for( i=0 ;iMemberListInfo()->GetNumMembers() ;i++ ) { - plNetTransportMember* mbr = TRACKED_NEW plNetTransportMember(nc); + plNetTransportMember* mbr = new plNetTransportMember(nc); IFillInTransportMember(m->MemberListInfo()->GetMember(i), mbr); hsLogEntry(nc->DebugMsg("\tAdding transport member, name=%s, p2p=%d, plrID=%d\n", mbr->AsString().c_str(), mbr->IsPeerToPeer(), mbr->GetPlayerID())); int idx=nc->fTransport.AddMember(mbr); @@ -494,7 +494,7 @@ MSG_HANDLER_DEFN(plNetClientMsgHandler,plNetMsgMembersList) } // for // new player has been aded send local MembersUpdate msg - plMemberUpdateMsg* mu = TRACKED_NEW plMemberUpdateMsg; + plMemberUpdateMsg* mu = new plMemberUpdateMsg; mu->Send(); return hsOK; @@ -518,7 +518,7 @@ MSG_HANDLER_DEFN(plNetClientMsgHandler,plNetMsgMemberUpdate) if ( idx>=0 ) mbr = nc->fTransport.GetMember(idx); else - mbr = TRACKED_NEW plNetTransportMember(nc); + mbr = new plNetTransportMember(nc); hsAssert(mbr, "nil xport member"); IFillInTransportMember(m->MemberInfo(), mbr); @@ -542,7 +542,7 @@ MSG_HANDLER_DEFN(plNetClientMsgHandler,plNetMsgMemberUpdate) } // new player has been aded send local MembersUpdate msg - plMemberUpdateMsg* mu = TRACKED_NEW plMemberUpdateMsg; + plMemberUpdateMsg* mu = new plMemberUpdateMsg; mu->Send(); return hsOK; @@ -564,7 +564,7 @@ MSG_HANDLER_DEFN(plNetClientMsgHandler,plNetMsgListenListUpdate) if(!tm) { #if 0 - tm = TRACKED_NEW plNetTransportMember(nc); + tm = new plNetTransportMember(nc); tm->SetClientNum(m->GetSenderClientNum()); int idx=nc->fTransport.AddMember(tm); hsAssert(idx>=0, "Failed adding member?"); diff --git a/Sources/Plasma/PubUtilLib/plNetClient/plNetClientStats.cpp b/Sources/Plasma/PubUtilLib/plNetClient/plNetClientStats.cpp index 4513fcea..f848a1c4 100644 --- a/Sources/Plasma/PubUtilLib/plNetClient/plNetClientStats.cpp +++ b/Sources/Plasma/PubUtilLib/plNetClient/plNetClientStats.cpp @@ -67,7 +67,7 @@ float plNetClientStats::GetAgeStatsULBitsPerSec() const // // return the acks that were conpressed so far // -UInt32 plNetClientStats::GetRecvdMultipleAcks() const +uint32_t plNetClientStats::GetRecvdMultipleAcks() const { return fRecvdMultipleAcks; } diff --git a/Sources/Plasma/PubUtilLib/plNetClient/plNetClientStats.h b/Sources/Plasma/PubUtilLib/plNetClient/plNetClientStats.h index 24024bf5..fa010e72 100644 --- a/Sources/Plasma/PubUtilLib/plNetClient/plNetClientStats.h +++ b/Sources/Plasma/PubUtilLib/plNetClient/plNetClientStats.h @@ -42,7 +42,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #ifndef plNetClientStats_h #define plNetClientStats_h -#include "hsTypes.h" +#include "HeadSpin.h" // // Holds stats counters used by the Net Client @@ -58,16 +58,16 @@ public: // private: // Vault msg counters - UInt32 fNumVaultMsgsSent; - UInt32 fNumVaultMsgsRcvd; - UInt32 fVaultMsgSentBytes; - UInt32 fVaultMsgRcvdBytes; + uint32_t fNumVaultMsgsSent; + uint32_t fNumVaultMsgsRcvd; + uint32_t fVaultMsgSentBytes; + uint32_t fVaultMsgRcvdBytes; public: // msg counters - UInt32 GetNumVaultMsgsSent() const { return fNumVaultMsgsSent; } - UInt32 GetNumVaultMsgsRcvd() const { return fNumVaultMsgsRcvd; } - UInt32 GetVaultMsgSentBytes() const { return fVaultMsgSentBytes; } - UInt32 GetVaultMsgRcvdBytes() const { return fVaultMsgRcvdBytes; } + uint32_t GetNumVaultMsgsSent() const { return fNumVaultMsgsSent; } + uint32_t GetNumVaultMsgsRcvd() const { return fNumVaultMsgsRcvd; } + uint32_t GetVaultMsgSentBytes() const { return fVaultMsgSentBytes; } + uint32_t GetVaultMsgRcvdBytes() const { return fVaultMsgRcvdBytes; } void TallyVaultMsgSent( int size ) { fNumVaultMsgsSent++; fVaultMsgSentBytes+=size; } void TallyVaultMsgRcvd( int size ) { fNumVaultMsgsRcvd++; fVaultMsgRcvdBytes+=size; } void ResetVaultMsgCounters() { fNumVaultMsgsSent=fNumVaultMsgsRcvd=fVaultMsgSentBytes=fVaultMsgRcvdBytes=0; } @@ -77,7 +77,7 @@ public: // private: int fAgeStatsULBits, fAgeStatsDLBits; - UInt32 fRecvdMultipleAcks; + uint32_t fRecvdMultipleAcks; double fAgeStatsLinkInTime; public: @@ -85,7 +85,7 @@ public: void ResetAgeStats(); float GetAgeStatsULBitsPerSec() const; float GetAgeStatsDLBitsPerSec() const; - UInt32 GetRecvdMultipleAcks() const; + uint32_t GetRecvdMultipleAcks() const; }; #endif // plNetClientStats_h diff --git a/Sources/Plasma/PubUtilLib/plNetClient/plNetLinkingMgr.cpp b/Sources/Plasma/PubUtilLib/plNetClient/plNetLinkingMgr.cpp index dc4efb5f..cdcf7064 100644 --- a/Sources/Plasma/PubUtilLib/plNetClient/plNetLinkingMgr.cpp +++ b/Sources/Plasma/PubUtilLib/plNetClient/plNetLinkingMgr.cpp @@ -116,7 +116,7 @@ struct NlmLeaveAgeOp : NlmOp { struct NlmOpNode { LINK(NlmOpNode) link; NlmOp * op; - ~NlmOpNode () { DEL(op); } + ~NlmOpNode () { delete op; } }; @@ -173,7 +173,7 @@ void plNetLinkingMgr::NCAgeJoinerCallback ( // Pull our wait op off exec queue if (NlmOpWaitOp * waitOp = (NlmOpWaitOp *) userState) - DEL(waitOp->node); + delete waitOp->node; } break; @@ -195,7 +195,7 @@ void plNetLinkingMgr::NCAgeLeaverCallback ( // Pull our wait op off exec queue if (NlmOpWaitOp * waitOp = (NlmOpWaitOp *) userState) - DEL(waitOp->node); + delete waitOp->node; } break; @@ -260,7 +260,7 @@ void plNetLinkingMgr::ExecNextOp () { break; } - DEL(opNode); + delete opNode; } @@ -369,7 +369,7 @@ bool plNetLinkingMgr::IProcessLinkToAgeMsg( plLinkToAgeMsg * msg ) GetAgeLink()->CopyFrom( msg->GetAgeLink() ); // Actually do stuff... - UInt8 pre = IPreProcessLink(); + uint8_t pre = IPreProcessLink(); if (pre == kLinkImmediately) { msg->Ref(); @@ -443,7 +443,7 @@ bool plNetLinkingMgr::IProcessLinkingMgrMsg( plLinkingMgrMsg * msg ) case kLinkPlayerHere: { // player wants to link to our age - UInt32 playerID = msg->GetArgs()->GetInt( 0 ); + uint32_t playerID = msg->GetArgs()->GetInt( 0 ); hsLogEntry( nc->DebugMsg( "Linking player %lu to this age.", playerID ) ); LinkPlayerHere( playerID ); } @@ -461,7 +461,7 @@ bool plNetLinkingMgr::IProcessLinkingMgrMsg( plLinkingMgrMsg * msg ) case kOfferLinkToPlayer: { // // Notify the KI that we received an offer. -// plVaultNotifyMsg * notify = TRACKED_NEW plVaultNotifyMsg(); +// plVaultNotifyMsg * notify = new plVaultNotifyMsg(); // notify->SetType( plVaultNotifyMsg::kPlayerOfferedLink ); // notify->GetArgs()->AddItem( 0, msg->GetArgs()->GetItem( 0 ), true ); // add to notify and have notify take over memory management of the item. // msg->GetArgs()->RemoveItem( 0, true ); // msg to stop memory managing item, notify msg will delete it. @@ -529,7 +529,7 @@ bool plNetLinkingMgr::IProcessVaultNotifyMsg(plVaultNotifyMsg* msg) //////////////////////////////////////////////////////////////////// -bool plNetLinkingMgr::IDispatchMsg( plMessage * msg, UInt32 playerID ) +bool plNetLinkingMgr::IDispatchMsg( plMessage * msg, uint32_t playerID ) { plNetClientMgr * nc = plNetClientMgr::GetInstance(); @@ -550,12 +550,12 @@ bool plNetLinkingMgr::IDispatchMsg( plMessage * msg, UInt32 playerID ) //////////////////////////////////////////////////////////////////// -void plNetLinkingMgr::LinkToAge( plAgeLinkStruct * link, UInt32 playerID ) +void plNetLinkingMgr::LinkToAge( plAgeLinkStruct * link, uint32_t playerID ) { LinkToAge(link, nil, playerID); } -void plNetLinkingMgr::LinkToAge( plAgeLinkStruct * link, const char* linkAnim, UInt32 playerID ) +void plNetLinkingMgr::LinkToAge( plAgeLinkStruct * link, const char* linkAnim, uint32_t playerID ) { if ( !fLinkingEnabled ) { @@ -563,14 +563,14 @@ void plNetLinkingMgr::LinkToAge( plAgeLinkStruct * link, const char* linkAnim, U return; } - plLinkToAgeMsg* pMsg = TRACKED_NEW plLinkToAgeMsg( link ); + plLinkToAgeMsg* pMsg = new plLinkToAgeMsg( link ); if (linkAnim) pMsg->SetLinkInAnimName(linkAnim); IDispatchMsg( pMsg, playerID ); } // link myself back to my last age -void plNetLinkingMgr::LinkToPrevAge( UInt32 playerID ) +void plNetLinkingMgr::LinkToPrevAge( uint32_t playerID ) { if ( !fLinkingEnabled ) { @@ -580,7 +580,7 @@ void plNetLinkingMgr::LinkToPrevAge( UInt32 playerID ) if (GetPrevAgeLink()->GetAgeInfo()->HasAgeFilename()) { - plLinkToAgeMsg* pMsg = TRACKED_NEW plLinkToAgeMsg( GetPrevAgeLink() ); + plLinkToAgeMsg* pMsg = new plLinkToAgeMsg( GetPrevAgeLink() ); IDispatchMsg( pMsg, playerID ); } else @@ -589,7 +589,7 @@ void plNetLinkingMgr::LinkToPrevAge( UInt32 playerID ) } } -void plNetLinkingMgr::LinkToMyPersonalAge( UInt32 playerID ) +void plNetLinkingMgr::LinkToMyPersonalAge( uint32_t playerID ) { if ( !fLinkingEnabled ) { @@ -606,11 +606,11 @@ void plNetLinkingMgr::LinkToMyPersonalAge( UInt32 playerID ) hutSpawnPoint.SetName(kPersonalAgeLinkInPointCloset); link.SetSpawnPoint(hutSpawnPoint); - plLinkToAgeMsg* pMsg = TRACKED_NEW plLinkToAgeMsg( &link ); + plLinkToAgeMsg* pMsg = new plLinkToAgeMsg( &link ); IDispatchMsg( pMsg, playerID ); } -void plNetLinkingMgr::LinkToMyNeighborhoodAge( UInt32 playerID ) +void plNetLinkingMgr::LinkToMyNeighborhoodAge( uint32_t playerID ) { if ( !fLinkingEnabled ) { @@ -625,11 +625,11 @@ void plNetLinkingMgr::LinkToMyNeighborhoodAge( UInt32 playerID ) link.SetLinkingRules( plNetCommon::LinkingRules::kOwnedBook ); - plLinkToAgeMsg* pMsg = TRACKED_NEW plLinkToAgeMsg( &link ); + plLinkToAgeMsg* pMsg = new plLinkToAgeMsg( &link ); IDispatchMsg( pMsg, playerID ); } -void plNetLinkingMgr::LinkPlayerHere( UInt32 playerID ) +void plNetLinkingMgr::LinkPlayerHere( uint32_t playerID ) { if ( !fLinkingEnabled ) { @@ -644,7 +644,7 @@ void plNetLinkingMgr::LinkPlayerHere( UInt32 playerID ) LinkPlayerToAge( &link, playerID ); } -void plNetLinkingMgr::LinkPlayerToAge( plAgeLinkStruct * link, UInt32 playerID ) +void plNetLinkingMgr::LinkPlayerToAge( plAgeLinkStruct * link, uint32_t playerID ) { if ( !fLinkingEnabled ) { @@ -655,14 +655,14 @@ void plNetLinkingMgr::LinkPlayerToAge( plAgeLinkStruct * link, UInt32 playerID ) // send the player the age link so they can link there. link->SetLinkingRules( plNetCommon::LinkingRules::kBasicLink ); - plLinkToAgeMsg* pMsg = TRACKED_NEW plLinkToAgeMsg( link ); + plLinkToAgeMsg* pMsg = new plLinkToAgeMsg( link ); IDispatchMsg( pMsg, playerID ); } // // link the player back to his previous age // -void plNetLinkingMgr::LinkPlayerToPrevAge( UInt32 playerID ) +void plNetLinkingMgr::LinkPlayerToPrevAge( uint32_t playerID ) { if ( !fLinkingEnabled ) { @@ -673,12 +673,12 @@ void plNetLinkingMgr::LinkPlayerToPrevAge( UInt32 playerID ) // Send the player a msg telling them to link to their last age plNetClientMgr * nc = plNetClientMgr::GetInstance(); - plLinkingMgrMsg* pMsg = TRACKED_NEW plLinkingMgrMsg(); + plLinkingMgrMsg* pMsg = new plLinkingMgrMsg(); pMsg->SetCmd( kLinkPlayerToPrevAge); IDispatchMsg( pMsg, playerID ); } -void plNetLinkingMgr::LinkToPlayersAge( UInt32 playerID ) +void plNetLinkingMgr::LinkToPlayersAge( uint32_t playerID ) { if ( !fLinkingEnabled ) { @@ -688,7 +688,7 @@ void plNetLinkingMgr::LinkToPlayersAge( UInt32 playerID ) // Send the player a msg telling them to send us a msg to link to them. isn't that fun? :) plNetClientMgr * nc = plNetClientMgr::GetInstance(); - plLinkingMgrMsg* pMsg = TRACKED_NEW plLinkingMgrMsg(); + plLinkingMgrMsg* pMsg = new plLinkingMgrMsg(); pMsg->SetCmd( kLinkPlayerHere ); pMsg->GetArgs()->AddInt( 0, NetCommGetPlayer()->playerInt ); // send them our id. IDispatchMsg( pMsg, playerID ); @@ -697,11 +697,11 @@ void plNetLinkingMgr::LinkToPlayersAge( UInt32 playerID ) //////////////////////////////////////////////////////////////////// -void plNetLinkingMgr::OfferLinkToPlayer( const plAgeLinkStruct * inInfo, UInt32 playerID ) +void plNetLinkingMgr::OfferLinkToPlayer( const plAgeLinkStruct * inInfo, uint32_t playerID ) { plNetClientMgr *mgr = plNetClientMgr::GetInstance(); - plLinkToAgeMsg * linkM = TRACKED_NEW plLinkToAgeMsg(inInfo); + plLinkToAgeMsg * linkM = new plLinkToAgeMsg(inInfo); linkM->AddReceiver(mgr->GetKey()); plKey host = mgr->GetLocalPlayerKey(); @@ -716,11 +716,11 @@ void plNetLinkingMgr::OfferLinkToPlayer( const plAgeLinkStruct * inInfo, UInt32 } } // my special version - cjp -void plNetLinkingMgr::OfferLinkToPlayer( const plAgeLinkStruct * inInfo, UInt32 playerID, plKey replyKey ) +void plNetLinkingMgr::OfferLinkToPlayer( const plAgeLinkStruct * inInfo, uint32_t playerID, plKey replyKey ) { plNetClientMgr *mgr = plNetClientMgr::GetInstance(); - plLinkToAgeMsg * linkM = TRACKED_NEW plLinkToAgeMsg(inInfo); + plLinkToAgeMsg * linkM = new plLinkToAgeMsg(inInfo); linkM->AddReceiver(mgr->GetKey()); plKey host = mgr->GetLocalPlayerKey(); @@ -736,9 +736,9 @@ void plNetLinkingMgr::OfferLinkToPlayer( const plAgeLinkStruct * inInfo, UInt32 } // for backwards compatibility -void plNetLinkingMgr::OfferLinkToPlayer( const plAgeInfoStruct * inInfo, UInt32 playerID ) +void plNetLinkingMgr::OfferLinkToPlayer( const plAgeInfoStruct * inInfo, uint32_t playerID ) { - plAgeLinkStruct *ageLink = TRACKED_NEW plAgeLinkStruct; + plAgeLinkStruct *ageLink = new plAgeLinkStruct; ageLink->GetAgeInfo()->CopyFrom(inInfo); ageLink->SetLinkingRules(plNetCommon::LinkingRules::kBasicLink); @@ -760,7 +760,7 @@ void plNetLinkingMgr::IPostProcessLink( void ) // Update our online status if (RelVaultNode* rvnInfo = VaultGetPlayerInfoNodeIncRef()) { VaultPlayerInfoNode accInfo(rvnInfo); - wchar ageInstName[MAX_PATH]; + wchar_t ageInstName[MAX_PATH]; Uuid ageInstGuid = *info->GetAgeInstanceGuid(); StrToUnicode(ageInstName, info->GetAgeInstanceName(), arrsize(ageInstName)); accInfo.SetAgeInstName(ageInstName); @@ -836,7 +836,7 @@ void plNetLinkingMgr::IPostProcessLink( void ) //////////////////////////////////////////////////////////////////// -UInt8 plNetLinkingMgr::IPreProcessLink(void) +uint8_t plNetLinkingMgr::IPreProcessLink(void) { // Grab some stuff we're gonna use extensively plNetClientMgr* nc = plNetClientMgr::GetInstance(); @@ -864,7 +864,7 @@ UInt8 plNetLinkingMgr::IPreProcessLink(void) // Update our online status if (RelVaultNode * rvnInfo = VaultGetPlayerInfoNodeIncRef()) { VaultPlayerInfoNode accInfo(rvnInfo); - wchar ageInstName[MAX_PATH]; + wchar_t ageInstName[MAX_PATH]; Uuid ageInstGuid = *GetAgeLink()->GetAgeInfo()->GetAgeInstanceGuid(); StrToUnicode(ageInstName, info->GetAgeInstanceName(), arrsize(ageInstName)); accInfo.SetAgeInstName(ageInstName); @@ -1066,7 +1066,7 @@ UInt8 plNetLinkingMgr::IPreProcessLink(void) case plNetCommon::LinkingRules::kChildAgeBook: { plAgeLinkStruct childLink; - wchar parentAgeName[MAX_PATH]; + wchar_t parentAgeName[MAX_PATH]; if (link->HasParentAgeFilename()) StrToUnicode(parentAgeName, link->GetParentAgeFilename(), arrsize(parentAgeName)); diff --git a/Sources/Plasma/PubUtilLib/plNetClient/plNetLinkingMgr.h b/Sources/Plasma/PubUtilLib/plNetClient/plNetLinkingMgr.h index 0cca355d..e10380e4 100644 --- a/Sources/Plasma/PubUtilLib/plNetClient/plNetLinkingMgr.h +++ b/Sources/Plasma/PubUtilLib/plNetClient/plNetLinkingMgr.h @@ -42,7 +42,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #ifndef plNetLinkingMgr_h_inc #define plNetLinkingMgr_h_inc -#include "hsTypes.h" +#include "HeadSpin.h" #include "hsStlUtils.h" #include "hsBitVector.h" #include "plNetCommon/plNetServerSessionInfo.h" @@ -103,14 +103,14 @@ class plNetLinkingMgr kLinkDeferred, }; - UInt8 IPreProcessLink( void ); + uint8_t IPreProcessLink( void ); void IPostProcessLink( void ); bool IProcessLinkingMgrMsg( plLinkingMgrMsg * msg ); bool IProcessLinkToAgeMsg( plLinkToAgeMsg * msg ); void IDoLink(plLinkToAgeMsg* link); bool IProcessVaultNotifyMsg(plVaultNotifyMsg* msg); - bool IDispatchMsg( plMessage * msg, UInt32 playerID ); + bool IDispatchMsg( plMessage * msg, uint32_t playerID ); public: @@ -125,26 +125,26 @@ public: bool Linking () const { return !fLinkedIn && !fLinkingEnabled; } // Link to an age. - void LinkToAge( plAgeLinkStruct * link, UInt32 playerID=kInvalidPlayerID ); - void LinkToAge( plAgeLinkStruct * link, const char* linkAnim, UInt32 playerID=kInvalidPlayerID ); + void LinkToAge( plAgeLinkStruct * link, uint32_t playerID=kInvalidPlayerID ); + void LinkToAge( plAgeLinkStruct * link, const char* linkAnim, uint32_t playerID=kInvalidPlayerID ); // Link to my last age. - void LinkToPrevAge( UInt32 playerID=kInvalidPlayerID ); + void LinkToPrevAge( uint32_t playerID=kInvalidPlayerID ); // Link to my Personal Age - void LinkToMyPersonalAge( UInt32 playerID=kInvalidPlayerID ); + void LinkToMyPersonalAge( uint32_t playerID=kInvalidPlayerID ); // Link to my Neighborhood Age - void LinkToMyNeighborhoodAge( UInt32 playerID=kInvalidPlayerID ); + void LinkToMyNeighborhoodAge( uint32_t playerID=kInvalidPlayerID ); // Link a player here. - void LinkPlayerHere( UInt32 playerID ); + void LinkPlayerHere( uint32_t playerID ); // Link player to specified age - void LinkPlayerToAge( plAgeLinkStruct * link, UInt32 playerID ); + void LinkPlayerToAge( plAgeLinkStruct * link, uint32_t playerID ); // Link player back to his last age - void LinkPlayerToPrevAge( UInt32 playerID ); + void LinkPlayerToPrevAge( uint32_t playerID ); // Link us to a players age. - void LinkToPlayersAge( UInt32 playerID ); + void LinkToPlayersAge( uint32_t playerID ); // Offer a link to player. - void OfferLinkToPlayer( const plAgeLinkStruct * info, UInt32 playerID, plKey replyKey ); - void OfferLinkToPlayer( const plAgeInfoStruct * info, UInt32 playerID ); - void OfferLinkToPlayer( const plAgeLinkStruct * info, UInt32 playerID ); + void OfferLinkToPlayer( const plAgeLinkStruct * info, uint32_t playerID, plKey replyKey ); + void OfferLinkToPlayer( const plAgeInfoStruct * info, uint32_t playerID ); + void OfferLinkToPlayer( const plAgeLinkStruct * info, uint32_t playerID ); // Leave the current age void LeaveAge (bool quitting); diff --git a/Sources/Plasma/PubUtilLib/plNetClient/plNetObjectDebugger.cpp b/Sources/Plasma/PubUtilLib/plNetClient/plNetObjectDebugger.cpp index 2eb22fef..27561b63 100644 --- a/Sources/Plasma/PubUtilLib/plNetClient/plNetObjectDebugger.cpp +++ b/Sources/Plasma/PubUtilLib/plNetClient/plNetObjectDebugger.cpp @@ -51,7 +51,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "plNetClient/plNetClientMgr.h" #include "plAgeLoader/plAgeLoader.h" -plNetObjectDebugger::DebugObject::DebugObject(const char* objName, plLocation& loc, UInt32 flags) : +plNetObjectDebugger::DebugObject::DebugObject(const char* objName, plLocation& loc, uint32_t flags) : fLoc(loc), fFlags(flags) { @@ -187,7 +187,7 @@ bool plNetObjectDebugger::AddDebugObject(const char* objName, const char* pageNa // set string matching flags // int len = strlen(objName); - UInt32 flags=0; + uint32_t flags=0; if (objName[0]=='*') { if (objName[len-1]=='*') @@ -224,7 +224,7 @@ bool plNetObjectDebugger::AddDebugObject(const char* objName, const char* pageNa flags |= kPageMatch; } - fDebugObjects.push_back(TRACKED_NEW DebugObject(tmpObjName, loc, flags)); + fDebugObjects.push_back(new DebugObject(tmpObjName, loc, flags)); ICreateStatusLog(); diff --git a/Sources/Plasma/PubUtilLib/plNetClient/plNetObjectDebugger.h b/Sources/Plasma/PubUtilLib/plNetClient/plNetObjectDebugger.h index 43d08413..88b39bd9 100644 --- a/Sources/Plasma/PubUtilLib/plNetClient/plNetObjectDebugger.h +++ b/Sources/Plasma/PubUtilLib/plNetClient/plNetObjectDebugger.h @@ -42,7 +42,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #ifndef plNetObjectDebugger_inc #define plNetObjectDebugger_inc -#include "hsTypes.h" +#include "HeadSpin.h" #include "hsStlUtils.h" #include "pnKeyedObject/plUoid.h" #include "pnNetCommon/plNetApp.h" @@ -65,11 +65,11 @@ private: { std::string fObjName; plLocation fLoc; - UInt32 fFlags; + uint32_t fFlags; bool StringMatches(const char* str) const; // return true if string matches objName according to flags bool ObjectMatches(const hsKeyedObject* obj); bool ObjectMatches(const char* objName, const char* pageName); - DebugObject(const char* objName, plLocation& loc, UInt32 flags); + DebugObject(const char* objName, plLocation& loc, uint32_t flags); }; typedef std::vector DebugObjectList; DebugObjectList fDebugObjects; diff --git a/Sources/Plasma/PubUtilLib/plNetClient/plNetVoiceList.cpp b/Sources/Plasma/PubUtilLib/plNetClient/plNetVoiceList.cpp index edcc33af..4ba52669 100644 --- a/Sources/Plasma/PubUtilLib/plNetClient/plNetVoiceList.cpp +++ b/Sources/Plasma/PubUtilLib/plNetClient/plNetVoiceList.cpp @@ -128,13 +128,13 @@ void plNetListenList::AddMember(plNetTransportMember* e) #if 0 // call the new member's win audible and set talk icon parameters - plSoundMsg* pMsg = TRACKED_NEW plSoundMsg; + plSoundMsg* pMsg = new plSoundMsg; plArmatureMod* pMod = plArmatureMod::ConvertNoRef(e->GetAvatarKey()->GetObjectPtr()); if (pMod) pMsg->AddReceiver(pMod->GetTarget(0)->GetKey()); pMsg->SetCmd(plSoundMsg::kSetTalkIcon); pMsg->fIndex = GetNumMembers(); - pMsg->fNameStr = (UInt32)e->GetName(); + pMsg->fNameStr = (uint32_t)e->GetName(); plgDispatch::MsgSend(pMsg); #endif } @@ -150,7 +150,7 @@ void plNetListenList::RemoveMember(plNetTransportMember* e) #if 0 // call the new member's win audible and set talk icon parameters - plSoundMsg* pMsg = TRACKED_NEW plSoundMsg; + plSoundMsg* pMsg = new plSoundMsg; plArmatureMod* pMod = plArmatureMod::ConvertNoRef(e->GetAvatarKey()->GetObjectPtr()); if (pMod) pMsg->AddReceiver(pMod->GetTarget(0)->GetKey()); diff --git a/Sources/Plasma/PubUtilLib/plNetClient/plNetVoiceList.h b/Sources/Plasma/PubUtilLib/plNetClient/plNetVoiceList.h index a4e0f8e6..9ad4bacc 100644 --- a/Sources/Plasma/PubUtilLib/plNetClient/plNetVoiceList.h +++ b/Sources/Plasma/PubUtilLib/plNetClient/plNetVoiceList.h @@ -42,7 +42,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #ifndef plNetVoiceList_h #define plNetVoiceList_h -#include "hsTypes.h" +#include "HeadSpin.h" #include "hsStlUtils.h" // @@ -108,7 +108,7 @@ private: { kDirty = 0x1 }; - UInt32 fFlags; + uint32_t fFlags; public: plNetTalkList() : fFlags(0) {} ~plNetTalkList() {} diff --git a/Sources/Plasma/PubUtilLib/plNetClientComm/plNetClientComm.cpp b/Sources/Plasma/PubUtilLib/plNetClientComm/plNetClientComm.cpp index 25c922d8..8cc3e22a 100644 --- a/Sources/Plasma/PubUtilLib/plNetClientComm/plNetClientComm.cpp +++ b/Sources/Plasma/PubUtilLib/plNetClientComm/plNetClientComm.cpp @@ -110,19 +110,19 @@ static bool s_loginComplete = false; static bool s_hasAuthSrvIpAddress = false; static bool s_hasFileSrvIpAddress = false; static ENetError s_authResult = kNetErrAuthenticationFailed; -static wchar s_authSrvAddr[256]; -static wchar s_fileSrvAddr[256]; +static wchar_t s_authSrvAddr[256]; +static wchar_t s_fileSrvAddr[256]; -static wchar s_iniServerAddr[256]; -static wchar s_iniFileServerAddr[256]; -static wchar s_iniAccountUsername[kMaxAccountNameLength]; +static wchar_t s_iniServerAddr[256]; +static wchar_t s_iniFileServerAddr[256]; +static wchar_t s_iniAccountUsername[kMaxAccountNameLength]; static ShaDigest s_namePassHash; -static wchar s_iniAuthToken[kMaxPublisherAuthKeyLength]; -static wchar s_iniOS[kMaxGTOSIdLength]; +static wchar_t s_iniAuthToken[kMaxPublisherAuthKeyLength]; +static wchar_t s_iniOS[kMaxGTOSIdLength]; static bool s_iniReadAccountInfo = true; -static wchar s_iniStartupAgeName[kMaxAgeNameLength]; +static wchar_t s_iniStartupAgeName[kMaxAgeNameLength]; static Uuid s_iniStartupAgeInstId; -static wchar s_iniStartupPlayerName[kMaxPlayerNameLength]; +static wchar_t s_iniStartupPlayerName[kMaxPlayerNameLength]; static bool s_netError = false; @@ -154,7 +154,7 @@ static NetCommMsgHandler s_preHandler(0, nil, nil); //============================================================================ static void INetLogCallback ( ELogSeverity severity, - const wchar msg[] + const wchar_t msg[] ) { // Use the async log facility AsyncLogWriteMsg(ProductShortName(), severity, msg); @@ -216,7 +216,7 @@ static void IPreInitNetErrorCallback ( static void INetBufferCallback ( unsigned type, unsigned bytes, - const byte buffer[] + const uint8_t buffer[] ) { if (!plFactory::IsValidClassIndex(type)) { LogMsg(kLogError, "NetComm: received junk propagated buffer"); @@ -253,7 +253,7 @@ static void INotifyNewBuildCallback () { if (!NetCommGetAge()->ageInstId) return; - pfKIMsg * msg = NEW(pfKIMsg)(pfKIMsg::kHACKChatMsg); + pfKIMsg * msg = new pfKIMsg(pfKIMsg::kHACKChatMsg); msg->SetString("Uru has been updated. Please quit the game and log back in."); msg->SetUser("Updater Service", plNetClientApp::GetInstance()->GetPlayerID()); msg->SetFlags(pfKIMsg::kAdminMsg); @@ -293,12 +293,12 @@ static void PlayerInitCallback ( VaultProcessPlayerInbox(); } - plNetCommActivePlayerMsg * msg = NEW(plNetCommActivePlayerMsg); + plNetCommActivePlayerMsg * msg = new plNetCommActivePlayerMsg; msg->result = result; msg->param = param; msg->Send(); - plAccountUpdateMsg * updateMsg = TRACKED_NEW plAccountUpdateMsg(plAccountUpdateMsg::kActivePlayer); + plAccountUpdateMsg * updateMsg = new plAccountUpdateMsg(plAccountUpdateMsg::kActivePlayer); updateMsg->SetPlayerInt(NetCommGetPlayer()->playerInt); updateMsg->SetResult((unsigned)result); updateMsg->SetBCastFlag(plMessage::kBCastByExactType); @@ -342,19 +342,19 @@ static void LoginPlayerInitCallback ( VaultProcessPlayerInbox(); { - plNetCommAuthMsg * msg = NEW(plNetCommAuthMsg); + plNetCommAuthMsg * msg = new plNetCommAuthMsg; msg->result = result; msg->param = param; msg->Send(); } { - plNetCommActivePlayerMsg * msg = NEW(plNetCommActivePlayerMsg); + plNetCommActivePlayerMsg * msg = new plNetCommActivePlayerMsg; msg->result = result; msg->param = param; msg->Send(); } { - plAccountUpdateMsg * msg = TRACKED_NEW plAccountUpdateMsg(plAccountUpdateMsg::kActivePlayer); + plAccountUpdateMsg * msg = new plAccountUpdateMsg(plAccountUpdateMsg::kActivePlayer); msg->SetPlayerInt(NetCommGetPlayer()->playerInt); msg->SetResult((unsigned)result); msg->SetBCastFlag(plMessage::kBCastByExactType); @@ -370,7 +370,7 @@ static void INetCliAuthLoginSetPlayerRequestCallback ( if (IS_NET_ERROR(result) && (result != kNetErrVaultNodeNotFound)) { s_player = nil; - plNetCommAuthMsg * msg = NEW(plNetCommAuthMsg); + plNetCommAuthMsg * msg = new plNetCommAuthMsg; msg->result = result; msg->param = param; msg->Send(); @@ -473,7 +473,7 @@ static void INetCliAuthCreatePlayerRequestCallback ( }} } - plAccountUpdateMsg* updateMsg = TRACKED_NEW plAccountUpdateMsg(plAccountUpdateMsg::kCreatePlayer); + plAccountUpdateMsg* updateMsg = new plAccountUpdateMsg(plAccountUpdateMsg::kCreatePlayer); updateMsg->SetPlayerInt(playerInfo.playerInt); updateMsg->SetResult((unsigned)result); updateMsg->SetBCastFlag(plMessage::kBCastByExactType); @@ -510,7 +510,7 @@ static void INetCliAuthDeletePlayerCallback ( }} } - plAccountUpdateMsg* updateMsg = TRACKED_NEW plAccountUpdateMsg(plAccountUpdateMsg::kDeletePlayer); + plAccountUpdateMsg* updateMsg = new plAccountUpdateMsg(plAccountUpdateMsg::kDeletePlayer); updateMsg->SetPlayerInt(playerInt); updateMsg->SetResult((unsigned)result); updateMsg->SetBCastFlag(plMessage::kBCastByExactType); @@ -529,7 +529,7 @@ static void INetCliAuthChangePasswordCallback ( LogMsg(kLogDebug, L"Password changed!"); } - plAccountUpdateMsg* updateMsg = TRACKED_NEW plAccountUpdateMsg(plAccountUpdateMsg::kChangePassword); + plAccountUpdateMsg* updateMsg = new plAccountUpdateMsg(plAccountUpdateMsg::kChangePassword); updateMsg->SetPlayerInt(0); updateMsg->SetResult((unsigned)result); updateMsg->SetBCastFlag(plMessage::kBCastByExactType); @@ -551,7 +551,7 @@ static void INetCliAuthGetPublicAgeListCallback ( msg->ages.Set(ages.Ptr(), ages.Count()); msg->Send(); - DEL(cp); + delete cp; } //============================================================================ @@ -561,7 +561,7 @@ static void INetAuthFileListRequestCallback ( const NetCliAuthFileInfo infoArr[], unsigned infoCount ) { - plNetCommFileListMsg * msg = NEW(plNetCommFileListMsg); + plNetCommFileListMsg * msg = new plNetCommFileListMsg; msg->result = result; msg->param = param; msg->fileInfoArr.Set(infoArr, infoCount); @@ -572,10 +572,10 @@ static void INetAuthFileListRequestCallback ( static void INetCliAuthFileRequestCallback ( ENetError result, void * param, - const wchar filename[], + const wchar_t filename[], hsStream * writer ) { - plNetCommFileDownloadMsg * msg = NEW(plNetCommFileDownloadMsg); + plNetCommFileDownloadMsg * msg = new plNetCommFileDownloadMsg; msg->result = result; msg->writer = writer; StrCopy(msg->filename, filename, arrsize(filename)); @@ -587,7 +587,7 @@ static void INetCliGameJoinAgeRequestCallback ( ENetError result, void * param ) { - plNetCommLinkToAgeMsg * msg = NEW(plNetCommLinkToAgeMsg); + plNetCommLinkToAgeMsg * msg = new plNetCommLinkToAgeMsg; msg->result = result; msg->param = param; msg->Send(); @@ -606,8 +606,8 @@ static void INetCliAuthAgeRequestCallback ( s_age.ageInstId = ageInstId; s_age.ageVaultId = ageVaultId; - wchar gameAddrStr[64]; - wchar ageInstIdStr[64]; + wchar_t gameAddrStr[64]; + wchar_t ageInstIdStr[64]; NetAddressNodeToString(gameAddr, gameAddrStr, arrsize(gameAddrStr)); LogMsg( kLogPerf, @@ -654,7 +654,7 @@ static void INetCliAuthUpgradeVisitorRequestCallback ( }} } - plAccountUpdateMsg* updateMsg = TRACKED_NEW plAccountUpdateMsg(plAccountUpdateMsg::kUpgradePlayer); + plAccountUpdateMsg* updateMsg = new plAccountUpdateMsg(plAccountUpdateMsg::kUpgradePlayer); updateMsg->SetPlayerInt(playerInt); updateMsg->SetResult((unsigned)result); updateMsg->SetBCastFlag(plMessage::kBCastByExactType); @@ -666,24 +666,24 @@ static void INetCliAuthSendFriendInviteCallback ( ENetError result, void * param ) { - pfKIMsg* kiMsg = TRACKED_NEW pfKIMsg(pfKIMsg::kFriendInviteSent); - kiMsg->SetIntValue((Int32)result); + pfKIMsg* kiMsg = new pfKIMsg(pfKIMsg::kFriendInviteSent); + kiMsg->SetIntValue((int32_t)result); kiMsg->Send(); } //============================================================================ static void IReadNetIni() { - wchar filename[MAX_PATH]; + wchar_t filename[MAX_PATH]; StrPrintf(filename, arrsize(filename), L"%s.cfg", ProductCoreName()); - wchar pathAndName[MAX_PATH]; + wchar_t pathAndName[MAX_PATH]; PathGetInitDirectory(pathAndName, arrsize(pathAndName)); PathAddFilename(pathAndName, pathAndName, filename, arrsize(pathAndName)); #ifndef PLASMA_EXTERNAL_RELEASE // internal dev build will override user-based setting with local folder if it's there - wchar localPathAndName[MAX_PATH]; + wchar_t localPathAndName[MAX_PATH]; PathAddFilename(localPathAndName, L"init", filename, arrsize(localPathAndName)); if (PathDoesFileExist(localPathAndName)) StrCopy(pathAndName, localPathAndName, arrsize(pathAndName)); @@ -691,7 +691,7 @@ static void IReadNetIni() { Ini * ini = IniOpen(pathAndName); - wchar password[kMaxPasswordLength]; + wchar_t password[kMaxPasswordLength]; if (ini) { // Read [Net.Server] section @@ -786,8 +786,8 @@ static void IReadNetIni() { // @@@: Internal build only: Drop a default version of the file if not found if (!ini) { EFileError fileError; - qword fileSize; - qword lastWrite; + uint64_t fileSize; + uint64_t lastWrite; AsyncFile file = AsyncFileOpen( pathAndName, nil, @@ -834,7 +834,7 @@ static void IReadNetIni() { #endif // Set startup age info - ZERO(s_startupAge); + memset(&s_startupAge, 0, sizeof(s_startupAge)); if (StrLen(s_iniStartupAgeName) == 0) StrCopy(s_startupAge.ageDatasetName, "StartUp", arrsize(s_startupAge.ageDatasetName)); @@ -851,7 +851,7 @@ static void IReadNetIni() { static void AuthSrvIpAddressCallback ( ENetError result, void * param, - const wchar addr[] + const wchar_t addr[] ) { StrCopy(s_authSrvAddr, addr, arrsize(s_authSrvAddr)); s_hasAuthSrvIpAddress = true; @@ -861,7 +861,7 @@ static void AuthSrvIpAddressCallback ( static void FileSrvIpAddressCallback ( ENetError result, void * param, - const wchar addr[] + const wchar_t addr[] ) { StrCopy(s_fileSrvAddr, addr, arrsize(s_fileSrvAddr)); s_hasFileSrvIpAddress = true; @@ -922,7 +922,7 @@ void NetCommSetAvatarLoaded (bool loaded /* = true */) { //============================================================================ void NetCommChangeMyPassword ( - const wchar password[] + const wchar_t password[] ) { NetCliAuthAccountChangePasswordRequest(s_account.accountName, password, INetCliAuthChangePasswordCallback, nil); } @@ -934,7 +934,7 @@ void NetCommStartup () { LogRegisterHandler(INetLogCallback); AsyncCoreInitialize(); AsyncLogInitialize(L"Log", false); - wchar productString[256]; + wchar_t productString[256]; ProductString(productString, arrsize(productString)); LogMsg(kLogPerf, L"Client: %s", productString); @@ -1005,7 +1005,7 @@ void NetCommUpdate () { //============================================================================ void NetCommConnect () { - const wchar ** addrs; + const wchar_t ** addrs; unsigned count; hsBool connectedToKeeper = false; @@ -1028,7 +1028,7 @@ void NetCommConnect () { AsyncSleep(10); } - const wchar * authSrv[] = { + const wchar_t * authSrv[] = { s_authSrvAddr }; NetCliAuthStartConnect(authSrv, 1); @@ -1057,7 +1057,7 @@ void NetCommConnect () { AsyncSleep(10); } - const wchar * fileSrv[] = { + const wchar_t * fileSrv[] = { s_fileSrvAddr }; NetCliFileStartConnect(fileSrv, 1); @@ -1084,7 +1084,7 @@ void NetCommSendMsg ( msg->SetPlayerID(NetCommGetPlayer()->playerInt); unsigned msgSize = msg->GetPackSize(); - byte * buf = ALLOCA(byte, msgSize); + uint8_t * buf = (uint8_t *)malloc(msgSize); msg->PokeBuffer((char *)buf, msgSize); switch (msg->GetNetProtocol()) { @@ -1106,6 +1106,8 @@ void NetCommSendMsg ( DEFAULT_FATAL(msg->GetNetProtocol()); } + + free(buf); } //============================================================================ @@ -1155,7 +1157,7 @@ void NetCommAddMsgHandlerForExactType ( ASSERT(!state || (state && state != kNetCommAllUserStates)); NetCommRemoveMsgHandler(msgClassIdx, proc, state); - NetCommMsgHandler * handler = NEW(NetCommMsgHandler)(msgClassIdx, proc, state); + NetCommMsgHandler * handler = new NetCommMsgHandler(msgClassIdx, proc, state); s_handlers.Add(handler); } @@ -1180,7 +1182,7 @@ void NetCommRemoveMsgHandler ( continue; // We found a matching handler, delete it - DEL(handler); + delete handler; } } @@ -1204,7 +1206,7 @@ void NetCommSetMsgPreHandler ( //============================================================================ void NetCommSetAccountUsernamePassword ( - wchar username[], + wchar_t username[], const ShaDigest & namePassHash ) { StrCopy(s_iniAccountUsername, username, arrsize(s_iniAccountUsername)); @@ -1215,8 +1217,8 @@ void NetCommSetAccountUsernamePassword ( //============================================================================ void NetCommSetAuthTokenAndOS ( - wchar authToken[], - wchar os[] + wchar_t authToken[], + wchar_t os[] ) { if (authToken) StrCopy(s_iniAuthToken, authToken, arrsize(s_iniAuthToken)); @@ -1270,7 +1272,7 @@ void NetCommLinkToAge ( // --> plNetCommLinkToAgeMsg s_age = age; if (plNetClientMgr::GetInstance()->GetFlagsBit(plNetClientApp::kLinkingToOfflineAge)) { - plNetCommLinkToAgeMsg * msg = NEW(plNetCommLinkToAgeMsg); + plNetCommLinkToAgeMsg * msg = new plNetCommLinkToAgeMsg; msg->result = kNetSuccess; msg->param = nil; msg->Send(); @@ -1278,7 +1280,7 @@ void NetCommLinkToAge ( // --> plNetCommLinkToAgeMsg return; } - wchar wAgeName[kMaxAgeNameLength]; + wchar_t wAgeName[kMaxAgeNameLength]; StrToUnicode(wAgeName, s_age.ageDatasetName, arrsize(wAgeName)); NetCliAuthAgeRequest( @@ -1342,9 +1344,9 @@ void NetCommCreatePlayer ( // --> plNetCommCreatePlayerMsg unsigned createFlags, void * param ) { - wchar wplayerName[kMaxPlayerNameLength]; - wchar wavatarShape[MAX_PATH]; - wchar wfriendInvite[MAX_PATH]; + wchar_t wplayerName[kMaxPlayerNameLength]; + wchar_t wavatarShape[MAX_PATH]; + wchar_t wfriendInvite[MAX_PATH]; StrToUnicode(wplayerName, playerName, arrsize(wplayerName)); StrToUnicode(wavatarShape, avatarShape, arrsize(wavatarShape)); @@ -1361,9 +1363,9 @@ void NetCommCreatePlayer ( // --> plNetCommCreatePlayerMsg //============================================================================ void NetCommCreatePlayer ( // --> plNetCommCreatePlayerMsg - const wchar playerName[], - const wchar avatarShape[], - const wchar friendInvite[], + const wchar_t playerName[], + const wchar_t avatarShape[], + const wchar_t friendInvite[], unsigned createFlags, void * param ) { @@ -1397,11 +1399,11 @@ void NetCommGetPublicAgeList (//-> plNetCommPublicAgeListMsg void * param, plNetCommReplyMsg::EParamType ptype ) { - NetCommParam * cp = NEW(NetCommParam); + NetCommParam * cp = new NetCommParam; cp->param = param; cp->type = ptype; - wchar wStr[MAX_PATH]; + wchar_t wStr[MAX_PATH]; StrToUnicode(wStr, ageName, arrsize(wStr)); NetCliAuthGetPublicAgeList( wStr, @@ -1510,8 +1512,8 @@ void NetCommSetCCRLevel ( //============================================================================ void NetCommSendFriendInvite ( - const wchar emailAddress[], - const wchar toName[], + const wchar_t emailAddress[], + const wchar_t toName[], const Uuid& inviteUuid ) { NetCliAuthSendFriendInvite( @@ -1545,7 +1547,7 @@ plNetClientComm::~plNetClientComm() } // AddMsgHandlerForType ---------------------------------------------- -void plNetClientComm::AddMsgHandlerForType( UInt16 msgClassIdx, MsgHandler* handler ) +void plNetClientComm::AddMsgHandlerForType( uint16_t msgClassIdx, MsgHandler* handler ) { int i; for( i = 0; i < plFactory::GetNumClasses(); i++ ) @@ -1556,7 +1558,7 @@ void plNetClientComm::AddMsgHandlerForType( UInt16 msgClassIdx, MsgHandler* hand } // AddMsgHandlerForExactType ---------------------------------------------- -void plNetClientComm::AddMsgHandlerForExactType( UInt16 msgClassIdx, MsgHandler* handler ) +void plNetClientComm::AddMsgHandlerForExactType( uint16_t msgClassIdx, MsgHandler* handler ) { NetCommAddMsgHandlerForExactType(msgClassIdx, MsgHandler::StaticMsgHandler, handler); } diff --git a/Sources/Plasma/PubUtilLib/plNetClientComm/plNetClientComm.h b/Sources/Plasma/PubUtilLib/plNetClientComm/plNetClientComm.h index a418a790..0ffdf54f 100644 --- a/Sources/Plasma/PubUtilLib/plNetClientComm/plNetClientComm.h +++ b/Sources/Plasma/PubUtilLib/plNetClientComm/plNetClientComm.h @@ -44,7 +44,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com * $/Plasma20/Sources/Plasma/PubUtilLib/plNetClientComm/plNetClientComm.h * * This module is the translation layer between simple network types -* such as byte arrays, and higher-level Plasma-specific types such +* such as uint8_t arrays, and higher-level Plasma-specific types such * as the plFactory-managed types. * ***/ @@ -53,7 +53,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #define PLASMA20_SOURCES_PLASMA_PUBUTILLIB_PLNETCLIENTCOMM_PLNETCLIENTCOMM_H -#include "hsTypes.h" +#include "HeadSpin.h" #include "pnUtils/pnUtils.h" #include "pnNetBase/pnNetBase.h" #include "plNetCommon/plNetServerSessionInfo.h" @@ -72,7 +72,7 @@ class plNetMessage; struct NetCommPlayer { unsigned playerInt; - wchar playerName[kMaxPlayerNameLength]; + wchar_t playerName[kMaxPlayerNameLength]; char playerNameAnsi[kMaxPlayerNameLength]; char avatarDatasetName[64]; unsigned explorer; @@ -80,7 +80,7 @@ struct NetCommPlayer { struct NetCommAccount { Uuid accountUuid; - wchar accountName[kMaxAccountNameLength]; + wchar_t accountName[kMaxAccountNameLength]; ShaDigest accountNamePassHash; char accountNameAnsi[kMaxAccountNameLength]; unsigned accountFlags; @@ -102,13 +102,13 @@ const ARRAY(NetCommPlayer) & NetCommGetPlayerList (); unsigned NetCommGetPlayerCount (); bool NetCommIsLoginComplete (); void NetCommSetReadIniAccountInfo (bool readFromIni); -void NetCommSetAccountUsernamePassword (wchar username[], const ShaDigest & namePassHash); -void NetCommSetAuthTokenAndOS (wchar authToken[], wchar os[]); +void NetCommSetAccountUsernamePassword (wchar_t username[], const ShaDigest & namePassHash); +void NetCommSetAuthTokenAndOS (wchar_t authToken[], wchar_t os[]); ENetError NetCommGetAuthResult (); bool NetCommNeedToLoadAvatar (); void NetCommSetAvatarLoaded (bool loaded = true); -void NetCommChangeMyPassword (const wchar password[]); +void NetCommChangeMyPassword (const wchar_t password[]); void NetCommStartup (); void NetCommShutdown (); @@ -186,12 +186,12 @@ void NetCommAuthenticate ( // --> plNetCommAuthMsg void * param ); void NetCommGetFileList ( // --> plNetCommFileListMsg - const wchar dir[], - const wchar ext[], + const wchar_t dir[], + const wchar_t ext[], void * param ); void NetCommGetFile ( // --> plNetCommFileDownloadMsg - const wchar filename[], + const wchar_t filename[], hsStream * writer, void * param ); @@ -211,9 +211,9 @@ void NetCommCreatePlayer ( // --> plNetCommCreatePlayerMsg void * param ); void NetCommCreatePlayer ( // --> plNetCommCreatePlayerMsg - const wchar playerName[], - const wchar avatarShape[], - const wchar friendInvite[], + const wchar_t playerName[], + const wchar_t avatarShape[], + const wchar_t friendInvite[], unsigned createFlags, void * param ); @@ -278,8 +278,8 @@ void NetCommSetCCRLevel ( unsigned ccrLevel ); void NetCommSendFriendInvite ( - const wchar emailAddress[], - const wchar toName[], + const wchar_t emailAddress[], + const wchar_t toName[], const Uuid& inviteUuid ); @@ -349,14 +349,14 @@ public: plCreatableListHelper fCbArgs; //------------------------------- virtual ~Callback(){} - virtual void OperationStarted( UInt32 context ) = 0; - virtual void OperationComplete( UInt32 context, int resultCode ) = 0; + virtual void OperationStarted( uint32_t context ) = 0; + virtual void OperationComplete( uint32_t context, int resultCode ) = 0; }; class StubbedCallback : public Callback { public: - void OperationStarted( UInt32 context ) {} - void OperationComplete( UInt32 context, int resultCode ) {} + void OperationStarted( uint32_t context ) {} + void OperationComplete( uint32_t context, int resultCode ) {} }; // Message handler for unsolicited msgs or registered for specific msg types. @@ -375,10 +375,10 @@ public: //////////////////////////////////////////////////////////////// // Adds a msg handler for a msg that is convertable to specified type. - void AddMsgHandlerForType( UInt16 msgClassIdx, MsgHandler* handler ); + void AddMsgHandlerForType( uint16_t msgClassIdx, MsgHandler* handler ); // Adds a msg handler for a specific msg type. - void AddMsgHandlerForExactType( UInt16 msgClassIdx, MsgHandler* handler ); + void AddMsgHandlerForExactType( uint16_t msgClassIdx, MsgHandler* handler ); bool RemoveMsgHandler( MsgHandler* handler ); diff --git a/Sources/Plasma/PubUtilLib/plNetClientRecorder/plNetClientRecorder.cpp b/Sources/Plasma/PubUtilLib/plNetClientRecorder/plNetClientRecorder.cpp index bcd30b56..dc43052d 100644 --- a/Sources/Plasma/PubUtilLib/plNetClientRecorder/plNetClientRecorder.cpp +++ b/Sources/Plasma/PubUtilLib/plNetClientRecorder/plNetClientRecorder.cpp @@ -93,7 +93,7 @@ void plNetClientRecorder::IMakeFilename(const char* recName, char* path) bool plNetClientRecorder::IsRecordableMsg(plNetMessage* msg) const { - UInt16 idx = msg->ClassIndex(); + uint16_t idx = msg->ClassIndex(); return ( idx == CLASS_INDEX_SCOPED(plNetMsgLoadClone) || @@ -123,7 +123,7 @@ bool plNetClientLoggingRecorder::IProcessRecordMsg(plNetMessage* msg, double sec if (msg->ClassIndex() == CLASS_INDEX_SCOPED(plNetMsgGameMessage)) { plNetMsgGameMessage* gameMsg = plNetMsgGameMessage::ConvertNoRef(msg); - UInt16 gameMsgIdx = gameMsg->StreamInfo()->GetStreamType(); + uint16_t gameMsgIdx = gameMsg->StreamInfo()->GetStreamType(); if (gameMsgIdx == CLASS_INDEX_SCOPED(plServerReplyMsg)) return false; diff --git a/Sources/Plasma/PubUtilLib/plNetClientRecorder/plNetClientRecorder.h b/Sources/Plasma/PubUtilLib/plNetClientRecorder/plNetClientRecorder.h index 24d1123d..02a8dbb6 100644 --- a/Sources/Plasma/PubUtilLib/plNetClientRecorder/plNetClientRecorder.h +++ b/Sources/Plasma/PubUtilLib/plNetClientRecorder/plNetClientRecorder.h @@ -42,7 +42,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #ifndef plNetClientRecorder_h_inc #define plNetClientRecorder_h_inc -#include "hsTypes.h" +#include "HeadSpin.h" class hsStream; class plNetMessage; diff --git a/Sources/Plasma/PubUtilLib/plNetClientRecorder/plNetClientStreamRecorder.cpp b/Sources/Plasma/PubUtilLib/plNetClientRecorder/plNetClientStreamRecorder.cpp index deab3856..86a5c46f 100644 --- a/Sources/Plasma/PubUtilLib/plNetClientRecorder/plNetClientStreamRecorder.cpp +++ b/Sources/Plasma/PubUtilLib/plNetClientRecorder/plNetClientStreamRecorder.cpp @@ -98,7 +98,7 @@ bool plNetClientStreamRecorder::BeginRecording(const char* recName) { if (!fRecordStream) { - fRecordStream = TRACKED_NEW hsUNIXStream; + fRecordStream = new hsUNIXStream; char path[256]; IMakeFilename(recName, path); @@ -125,7 +125,7 @@ bool plNetClientStreamRecorder::BeginPlayback(const char* recName) { if (!fRecordStream) { - fRecordStream = TRACKED_NEW hsUNIXStream; + fRecordStream = new hsUNIXStream; char path[256]; IMakeFilename(recName, path); @@ -250,7 +250,7 @@ bool plNetClientStreamRecorder::IIsValidMsg(plNetMessage* msg) { if (plNetMsgGameMessage* gameMsg = plNetMsgGameMessage::ConvertNoRef(msg)) { - Int16 type = gameMsg->StreamInfo()->GetStreamType(); + int16_t type = gameMsg->StreamInfo()->GetStreamType(); // // These messages will be regenerated if they are for the local avatar, @@ -367,7 +367,7 @@ void plNetClientStreamRecorder::ILogMsg(plNetMessage* msg, const char* preText) bool plNetClientStressStreamRecorder::IsRecordableMsg(plNetMessage* msg) const { - UInt16 idx = msg->ClassIndex(); + uint16_t idx = msg->ClassIndex(); return ( plNetClientStreamRecorder::IsRecordableMsg(msg) diff --git a/Sources/Plasma/PubUtilLib/plNetCommon/plClientGuid.cpp b/Sources/Plasma/PubUtilLib/plNetCommon/plClientGuid.cpp index e5d86f59..dadb7a6f 100644 --- a/Sources/Plasma/PubUtilLib/plNetCommon/plClientGuid.cpp +++ b/Sources/Plasma/PubUtilLib/plNetCommon/plClientGuid.cpp @@ -72,13 +72,13 @@ void plClientGuid::SetAccountUUID(const plUUID & v ) SetAccountUUID( &v ); } -void plClientGuid::SetBuildType(UInt8 type) +void plClientGuid::SetBuildType(uint8_t type) { fBuildType=type; fFlags|=kBuildType; } -void plClientGuid::SetPlayerID(UInt32 id) +void plClientGuid::SetPlayerID(uint32_t id) { fPlayerID=id; if ( fPlayerID ) @@ -90,7 +90,7 @@ void plClientGuid::SetPlayerID(UInt32 id) fFlags&=~kPlayerID; } -void plClientGuid::SetTempPlayerID(UInt32 id) +void plClientGuid::SetTempPlayerID(uint32_t id) { fPlayerID=id; if ( fPlayerID ) @@ -113,7 +113,7 @@ void plClientGuid::SetPlayerName( const plString & v ) fFlags&=~kPlayerName; } -void plClientGuid::SetCCRLevel(UInt8 v) +void plClientGuid::SetCCRLevel(uint8_t v) { fCCRLevel=v; fFlags|=kCCRLevel; @@ -125,7 +125,7 @@ void plClientGuid::SetProtectedLogin(bool b) fFlags |= kProtectedLogin; } -void plClientGuid::SetSrcAddr( UInt32 v ) +void plClientGuid::SetSrcAddr( uint32_t v ) { fSrcAddr = v; if ( fSrcAddr ) @@ -139,7 +139,7 @@ void plClientGuid::SetSrcAddrFromStr( const char * s ) hsAssert(false, "eric, port me"); } -void plClientGuid::SetSrcPort( UInt16 v ) +void plClientGuid::SetSrcPort( uint16_t v ) { fSrcPort = v; if ( fSrcPort ) diff --git a/Sources/Plasma/PubUtilLib/plNetCommon/plClientGuid.h b/Sources/Plasma/PubUtilLib/plNetCommon/plClientGuid.h index b1a3e860..0583cda7 100644 --- a/Sources/Plasma/PubUtilLib/plNetCommon/plClientGuid.h +++ b/Sources/Plasma/PubUtilLib/plNetCommon/plClientGuid.h @@ -42,24 +42,24 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #ifndef plClientGuid_h_inc #define plClientGuid_h_inc -#include "hsConfig.h" +#include "HeadSpin.h" #include "hsStlUtils.h" #include "pnFactory/plCreatable.h" #include "pnUUID/pnUUID.h" class plClientGuid : public plCreatable { - UInt16 fFlags; - plUUID fAccountUUID; - UInt32 fPlayerID; - UInt8 fCCRLevel; - bool fProtectedLogin; - UInt8 fBuildType; // see plNetCommon.h - plString fPlayerName; - UInt32 fSrcAddr; - UInt16 fSrcPort; - bool fReserved; - plString fClientKey; + uint16_t fFlags; + plUUID fAccountUUID; + uint32_t fPlayerID; + uint8_t fCCRLevel; + bool fProtectedLogin; + uint8_t fBuildType; // see plNetCommon.h + plString fPlayerName; + uint32_t fSrcAddr; + uint16_t fSrcPort; + bool fReserved; + plString fClientKey; public: enum Flags // 16 bits. @@ -86,7 +86,7 @@ public: void CopyFrom(const plClientGuid * other); void UpdateFrom(const plClientGuid * other); bool IsEqualTo(const plClientGuid * other) const; - bool IsFlagSet( UInt16 flag ) const { return (fFlags&flag)!=0; } + bool IsFlagSet( uint16_t flag ) const { return (fFlags&flag)!=0; } bool IsFullyQualified() const { return HasAccountUUID()&&HasPlayerID();} void Read(hsStream * s, hsResMgr* =nil); @@ -104,35 +104,35 @@ public: bool HasClientKey() const { return (fFlags&kClientKey)!=0;} const plUUID * GetAccountUUID() const { return &fAccountUUID;} - UInt32 GetPlayerID() const { return fPlayerID;} + uint32_t GetPlayerID() const { return fPlayerID;} const plString & GetPlayerName() const { return fPlayerName; } - UInt8 GetCCRLevel() const { return fCCRLevel; } + uint8_t GetCCRLevel() const { return fCCRLevel; } bool GetProtectedLogin() const { return ( fProtectedLogin!=0 ); } - UInt8 GetFlags() const { return (UInt8)fFlags;} - UInt8 GetBuildType() const { return fBuildType;} - UInt32 GetSrcAddr() const { return fSrcAddr; } + uint8_t GetFlags() const { return (uint8_t)fFlags;} + uint8_t GetBuildType() const { return fBuildType;} + uint32_t GetSrcAddr() const { return fSrcAddr; } const char * GetSrcAddrStr() const; - UInt16 GetSrcPort() const { return fSrcPort; } + uint16_t GetSrcPort() const { return fSrcPort; } bool IsReserved() const { return fReserved!=0; } const plString& GetClientKey() const { return fClientKey; } void SetAccountUUID(const plUUID * v); void SetAccountUUID(const plUUID & v); - void SetPlayerID(UInt32 v); + void SetPlayerID(uint32_t v); void SetPlayerName( const plString & v ); - void SetCCRLevel(UInt8 v); + void SetCCRLevel(uint8_t v); void SetProtectedLogin(bool v); - void SetBuildType(UInt8 v); - void SetSrcAddr( UInt32 v ); + void SetBuildType(uint8_t v); + void SetSrcAddr( uint32_t v ); void SetSrcAddrFromStr( const char * s ); - void SetSrcPort( UInt16 v ); + void SetSrcPort( uint16_t v ); void SetReserved( bool v ); void SetClientKey( const plString& key ); // When a client hasn't selected a player yet, // we need to uniquely identify them in the lobby server. // We do this by stuffing a temp value into the fPlayerID // while keeping the kPlayerID flag cleared. - void SetTempPlayerID(UInt32 id); + void SetTempPlayerID(uint32_t id); friend bool operator==(const plClientGuid & X, const plClientGuid & Y); friend bool operator!=(const plClientGuid & X, const plClientGuid & Y); diff --git a/Sources/Plasma/PubUtilLib/plNetCommon/plNetCommonHelpers.cpp b/Sources/Plasma/PubUtilLib/plNetCommon/plNetCommonHelpers.cpp index e45cc166..27df21a1 100644 --- a/Sources/Plasma/PubUtilLib/plNetCommon/plNetCommonHelpers.cpp +++ b/Sources/Plasma/PubUtilLib/plNetCommon/plNetCommonHelpers.cpp @@ -40,7 +40,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "hsStream.h" #include "hsStlUtils.h" #include "plNetCommonHelpers.h" @@ -52,7 +52,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com //////////////////////////////////////////////////////////////////// #ifndef SERVER -const UInt8 plNetCoreStatsSummary::StreamVersion = 1; +const uint8_t plNetCoreStatsSummary::StreamVersion = 1; plNetCoreStatsSummary::plNetCoreStatsSummary() :fULBitsPS(0), @@ -67,7 +67,7 @@ fDLDroppedPackets(0) void plNetCoreStatsSummary::Read(hsStream* s, hsResMgr*) { - UInt8 streamVer; + uint8_t streamVer; s->ReadLE(&streamVer); hsAssert(streamVer==StreamVersion,"plNetCoreStatsSummary invalid stream version."); s->ReadLE(&fULBitsPS); @@ -122,7 +122,7 @@ void plCreatableListHelper::CopyFrom( const plCreatableListHelper * other, bool } -void plCreatableListHelper::AddItem( UInt16 id, plCreatable * item, bool manageItem ) +void plCreatableListHelper::AddItem( uint16_t id, plCreatable * item, bool manageItem ) { RemoveItem( id ); fItems[id] = item; @@ -130,12 +130,12 @@ void plCreatableListHelper::AddItem( UInt16 id, plCreatable * item, bool manageI fManagedItems.push_back( item ); } -void plCreatableListHelper::AddItem( UInt16 id, const plCreatable * item, bool manageItem ) +void plCreatableListHelper::AddItem( uint16_t id, const plCreatable * item, bool manageItem ) { AddItem( id, const_cast( item ), manageItem ); } -void plCreatableListHelper::RemoveItem( UInt16 id, bool unManageItem ) +void plCreatableListHelper::RemoveItem( uint16_t id, bool unManageItem ) { plCreatable * item = GetItem( id ); if ( !item ) @@ -150,9 +150,9 @@ void plCreatableListHelper::RemoveItem( UInt16 id, bool unManageItem ) fItems.erase( id ); } -plCreatable * plCreatableListHelper::GetItem( UInt16 id, bool unManageItem/*=false */) const +plCreatable * plCreatableListHelper::GetItem( uint16_t id, bool unManageItem/*=false */) const { - std::map::const_iterator it=fItems.find( id ); + std::map::const_iterator it=fItems.find( id ); if ( it!=fItems.end() ) { if ( unManageItem ) @@ -166,52 +166,52 @@ plCreatable * plCreatableListHelper::GetItem( UInt16 id, bool unManageItem/*=fal return nil; } -bool plCreatableListHelper::ItemExists( UInt16 id ) const +bool plCreatableListHelper::ItemExists( uint16_t id ) const { return ( fItems.find( id )!=fItems.end() ); } -void plCreatableListHelper::AddString(UInt16 id, const char * value) +void plCreatableListHelper::AddString(uint16_t id, const char * value) { - plCreatableGenericValue * V = TRACKED_NEW plCreatableGenericValue(); + plCreatableGenericValue * V = new plCreatableGenericValue(); V->Value().SetString( (char*)value ); AddItem( id, V, true ); } -void plCreatableListHelper::AddString( UInt16 id, std::string & value ) +void plCreatableListHelper::AddString( uint16_t id, std::string & value ) { AddString( id, value.c_str() ); } -void plCreatableListHelper::AddInt( UInt16 id, Int32 value ) +void plCreatableListHelper::AddInt( uint16_t id, int32_t value ) { - plCreatableGenericValue * V = TRACKED_NEW plCreatableGenericValue(); + plCreatableGenericValue * V = new plCreatableGenericValue(); V->Value().SetInt(value); AddItem( id, V, true ); } -void plCreatableListHelper::AddDouble( UInt16 id, double value ) +void plCreatableListHelper::AddDouble( uint16_t id, double value ) { - plCreatableGenericValue * V = TRACKED_NEW plCreatableGenericValue(); + plCreatableGenericValue * V = new plCreatableGenericValue(); V->Value().SetDouble(value); AddItem( id, V, true ); } -const char * plCreatableListHelper::GetString( UInt16 id ) +const char * plCreatableListHelper::GetString( uint16_t id ) { plCreatableGenericValue * V = plCreatableGenericValue::ConvertNoRef( GetItem( id ) ); if ( !V ) return nil; return (const char *)V->Value(); } -Int32 plCreatableListHelper::GetInt( UInt16 id ) +int32_t plCreatableListHelper::GetInt( uint16_t id ) { plCreatableGenericValue * V = plCreatableGenericValue::ConvertNoRef( GetItem( id ) ); if ( !V ) return 0; - return (Int32)V->Value(); + return (int32_t)V->Value(); } -double plCreatableListHelper::GetDouble( UInt16 id ) +double plCreatableListHelper::GetDouble( uint16_t id ) { plCreatableGenericValue * V = plCreatableGenericValue::ConvertNoRef( GetItem( id ) ); if ( !V ) return 0; @@ -228,22 +228,22 @@ void plCreatableListHelper::Read( hsStream* s, hsResMgr* mgr ) fFlags &= ~kWritten; - UInt32 bufSz; + uint32_t bufSz; s->LogReadLE( &bufSz, "BufSz" ); std::string buf; buf.resize( bufSz ); if ( fFlags&kCompressed ) { - UInt32 zBufSz; + uint32_t zBufSz; s->LogReadLE( &zBufSz, "Compressed BufSz" ); std::string zBuf; zBuf.resize( zBufSz ); s->LogSubStreamPushDesc("Compressed Data"); s->Read( zBufSz, (void*)zBuf.data() ); plZlibCompress compressor; - UInt32 tmp; - hsBool ans = compressor.Uncompress( (UInt8*)buf.data(), &tmp, (UInt8*)zBuf.data(), zBufSz ); + uint32_t tmp; + hsBool ans = compressor.Uncompress( (uint8_t*)buf.data(), &tmp, (uint8_t*)zBuf.data(), zBufSz ); hsAssert( ans!=0, "plCreatableListHelper: Failed to uncompress buffer." ); hsAssert( tmp==bufSz, "compression size mismatch" ); fFlags&=~kCompressed; @@ -257,12 +257,12 @@ void plCreatableListHelper::Read( hsStream* s, hsResMgr* mgr ) hsReadOnlyStream ram( bufSz, (void*)buf.data() ); - UInt16 nItems; + uint16_t nItems; ram.ReadLE( &nItems ); for ( int i=0; i::iterator ii=fItems.begin(); ii!=fItems.end(); ++ii ) + for ( std::map::iterator ii=fItems.begin(); ii!=fItems.end(); ++ii ) { - UInt16 id = ii->first; + uint16_t id = ii->first; plCreatable * item = ii->second; - UInt16 classIdx = item->ClassIndex(); + uint16_t classIdx = item->ClassIndex(); ram.WriteLE( id ); ram.WriteLE( classIdx ); item->Write( &ram, mgr ); } // read ram stream into a buffer - UInt32 bufSz = ram.GetPosition(); + uint32_t bufSz = ram.GetPosition(); ram.Rewind(); std::string buf; buf.resize( bufSz ); @@ -305,10 +305,10 @@ void plCreatableListHelper::Write( hsStream* s, hsResMgr* mgr ) if ( fFlags&kWantCompression && bufSz>fCompressionThreshold ) { plZlibCompress compressor; - UInt32 zBufSz; + uint32_t zBufSz; std::string zBuf; zBuf.resize( bufSz ); - hsBool ans = compressor.Compress( (UInt8*)zBuf.data(), &zBufSz, (const UInt8*)buf.data(), bufSz ); + hsBool ans = compressor.Compress( (uint8_t*)zBuf.data(), &zBufSz, (const uint8_t*)buf.data(), bufSz ); bool compressed = ( ans && zBufSz ); hsAssert( compressed, "plCreatableListHelper: Failed to compress buffer." ); if ( compressed ) @@ -327,12 +327,12 @@ void plCreatableListHelper::Write( hsStream* s, hsResMgr* mgr ) if ( fFlags&kCompressed ) { - UInt32 zBufSz = buf.size(); + uint32_t zBufSz = buf.size(); ram.WriteLE( zBufSz ); } ram.Write( buf.size(), buf.data() ); - UInt32 sz = ram.GetPosition(); + uint32_t sz = ram.GetPosition(); ram.Rewind(); fWritten.resize( sz ); @@ -346,15 +346,15 @@ void plCreatableListHelper::Write( hsStream* s, hsResMgr* mgr ) void plCreatableListHelper::GetItemsAsVec( std::vector& out ) { - for ( std::map::iterator ii=fItems.begin(); ii!=fItems.end(); ++ii ) + for ( std::map::iterator ii=fItems.begin(); ii!=fItems.end(); ++ii ) { out.push_back( ii->second ); } } -void plCreatableListHelper::GetItems( std::map& out ) +void plCreatableListHelper::GetItems( std::map& out ) { - for ( std::map::iterator ii=fItems.begin(); ii!=fItems.end(); ++ii ) + for ( std::map::iterator ii=fItems.begin(); ii!=fItems.end(); ++ii ) { out[ii->first] = ii->second; } diff --git a/Sources/Plasma/PubUtilLib/plNetCommon/plNetCommonHelpers.h b/Sources/Plasma/PubUtilLib/plNetCommon/plNetCommonHelpers.h index 0f9813bf..55d0f866 100644 --- a/Sources/Plasma/PubUtilLib/plNetCommon/plNetCommonHelpers.h +++ b/Sources/Plasma/PubUtilLib/plNetCommon/plNetCommonHelpers.h @@ -42,7 +42,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #ifndef plNetCommonHelpers_h_inc #define plNetCommonHelpers_h_inc -#include "hsTypes.h" +#include "HeadSpin.h" #include "hsStlUtils.h" #include "hsTimer.h" #include "pnNetCommon/pnNetCommon.h" @@ -54,14 +54,14 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #ifndef SERVER class plNetCoreStatsSummary : public plCreatable { - static const UInt8 StreamVersion; + static const uint8_t StreamVersion; float fULBitsPS; float fDLBitsPS; float fULPeakBitsPS; float fDLPeakBitsPS; float fULPeakPktsPS; float fDLPeakPktsPS; - UInt32 fDLDroppedPackets; + uint32_t fDLDroppedPackets; public: plNetCoreStatsSummary(); CLASSNAME_REGISTER( plNetCoreStatsSummary ); @@ -74,7 +74,7 @@ public: float GetDLPeakBitsPS() const { return fDLPeakBitsPS; } float GetULPeakPktsPS() const { return fULPeakPktsPS; } float GetDLPeakPktsPS() const { return fDLPeakPktsPS; } - UInt32 GetDLDroppedPackets() const { return fDLDroppedPackets; } + uint32_t GetDLDroppedPackets() const { return fDLDroppedPackets; } }; #endif // SERVER @@ -90,10 +90,10 @@ class plCreatableListHelper : public plCreatable kCompressed = 1<<1, kWritten = 1<<2, }; - UInt8 fFlags; - std::map fItems; + uint8_t fFlags; + std::map fItems; mutable std::vector fManagedItems; - UInt32 fCompressionThreshold; // NOT WRITTEN + uint32_t fCompressionThreshold; // NOT WRITTEN std::string fWritten; void IClearItems(); @@ -111,26 +111,26 @@ public: void SetWantCompression( bool v ) { if ( v ) fFlags|=kWantCompression; else fFlags&=~kWantCompression; } bool WantCompression() const { return ( fFlags&kWantCompression )!=0; } - UInt32 GetCompressionThreshold() const { return fCompressionThreshold; } - void SetCompressionThreshold( UInt32 v ) { fCompressionThreshold=v; } + uint32_t GetCompressionThreshold() const { return fCompressionThreshold; } + void SetCompressionThreshold( uint32_t v ) { fCompressionThreshold=v; } // support for generic arguments - void AddItem( UInt16 id, plCreatable * item, bool manageItem=false ); - void AddItem( UInt16 id, const plCreatable * item, bool manageItem=false ); - plCreatable* GetItem( UInt16 id, bool unManageItem=false ) const; - void RemoveItem( UInt16 id, bool unManageItem=false ); - bool ItemExists( UInt16 id ) const; + void AddItem( uint16_t id, plCreatable * item, bool manageItem=false ); + void AddItem( uint16_t id, const plCreatable * item, bool manageItem=false ); + plCreatable* GetItem( uint16_t id, bool unManageItem=false ) const; + void RemoveItem( uint16_t id, bool unManageItem=false ); + bool ItemExists( uint16_t id ) const; int GetNumItems() const { return fItems.size();} // helpers for typed arguments - void AddString( UInt16 id, const char * value ); - void AddString( UInt16 id, std::string & value ); - const char * GetString( UInt16 id ); - void AddInt( UInt16 id, Int32 value ); - Int32 GetInt( UInt16 id ); - void AddDouble( UInt16 id, double value ); - double GetDouble( UInt16 id ); + void AddString( uint16_t id, const char * value ); + void AddString( uint16_t id, std::string & value ); + const char * GetString( uint16_t id ); + void AddInt( uint16_t id, int32_t value ); + int32_t GetInt( uint16_t id ); + void AddDouble( uint16_t id, double value ); + double GetDouble( uint16_t id ); void GetItemsAsVec( std::vector& out ); - void GetItems( std::map& out ); + void GetItems( std::map& out ); }; ///////////////////////////////////////////////////////////////////// diff --git a/Sources/Plasma/PubUtilLib/plNetCommon/plNetMember.h b/Sources/Plasma/PubUtilLib/plNetCommon/plNetMember.h index 49e49dc2..6e0aafff 100644 --- a/Sources/Plasma/PubUtilLib/plNetCommon/plNetMember.h +++ b/Sources/Plasma/PubUtilLib/plNetCommon/plNetMember.h @@ -42,8 +42,8 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #ifndef PLNETMEMBER_inc #define PLNETMEMBER_inc -#include "hsConfig.h" -#include "hsUtils.h" +#include "HeadSpin.h" + #include "hsStlUtils.h" #include "pnFactory/plCreatable.h" @@ -72,8 +72,8 @@ protected: friend class plNetClientMsgHandler; friend class plNetClientGamePlayMsgHandler; - Int32 fPeerID; // low-level netPlayer object for msg send/recv - UInt32 fFlags; + int32_t fPeerID; // low-level netPlayer object for msg send/recv + uint32_t fFlags; plNetApp* fNetApp; // these calls should be made by the client/server app only, @@ -91,15 +91,15 @@ public: virtual bool IsEqualTo(const plNetMember * other) const = 0; // getters - Int32 GetPeerID() const { return fPeerID; } - UInt32 GetFlags() const { return fFlags; } + int32_t GetPeerID() const { return fPeerID; } + uint32_t GetFlags() const { return fFlags; } plNetApp* GetNetApp() { return fNetApp; } virtual plString AsString() const = 0; // setters - void SetFlags(UInt32 f) { fFlags=f; } + void SetFlags(uint32_t f) { fFlags=f; } void SetNetApp(plNetApp* n) { fNetApp=n; } - void SetPeerID(Int32 p) { fPeerID=p; } + void SetPeerID(int32_t p) { fPeerID=p; } }; #endif // PLNETMEMBER_inc diff --git a/Sources/Plasma/PubUtilLib/plNetCommon/plNetMsgHandler.h b/Sources/Plasma/PubUtilLib/plNetCommon/plNetMsgHandler.h index 6d2b4ef5..8e740da7 100644 --- a/Sources/Plasma/PubUtilLib/plNetCommon/plNetMsgHandler.h +++ b/Sources/Plasma/PubUtilLib/plNetCommon/plNetMsgHandler.h @@ -42,8 +42,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #ifndef plNetMsgHandler_inc #define plNetMsgHandler_inc -#include "hsConfig.h" -#include "hsTypes.h" // for nil +#include "HeadSpin.h" class plNetMessage; class plNetApp; diff --git a/Sources/Plasma/PubUtilLib/plNetCommon/plNetMsgScreener.cpp b/Sources/Plasma/PubUtilLib/plNetCommon/plNetMsgScreener.cpp index 6d2a6d51..ba49e33c 100644 --- a/Sources/Plasma/PubUtilLib/plNetCommon/plNetMsgScreener.cpp +++ b/Sources/Plasma/PubUtilLib/plNetCommon/plNetMsgScreener.cpp @@ -39,7 +39,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com Mead, WA 99021 *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "plNetMsgScreener.h" #include "plCreatableIndex.h" @@ -65,7 +65,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // // say why the msg got rejected // -void plNetMsgScreener::IRejectLogMsg(Int16 classIndex, const char* desc, const plNetGameMember* gm) const +void plNetMsgScreener::IRejectLogMsg(int16_t classIndex, const char* desc, const plNetGameMember* gm) const { DebugMsg("Message %s was rejected, reason:%s, age:%s, client:%s", plFactory::GetNameOfClass(classIndex), desc, IGetAgeName(), IGetSenderName(gm)); @@ -88,7 +88,7 @@ void plNetMsgScreener::IRejectLogMsg(const plMessage* msg, const char* desc, con // Try to accept/reject quickly // the netMsg arg has been peeked except for the stream // -plNetMsgScreener::Answer plNetMsgScreener::IAllowMessageType(Int16 classIndex, const plNetGameMember* gm) const +plNetMsgScreener::Answer plNetMsgScreener::IAllowMessageType(int16_t classIndex, const plNetGameMember* gm) const { // Check based on baseclass if (plFactory::DerivesFrom(plCCRMessage::Index(), classIndex)) diff --git a/Sources/Plasma/PubUtilLib/plNetCommon/plNetMsgScreener.h b/Sources/Plasma/PubUtilLib/plNetCommon/plNetMsgScreener.h index 8ec23f87..cee32efa 100644 --- a/Sources/Plasma/PubUtilLib/plNetCommon/plNetMsgScreener.h +++ b/Sources/Plasma/PubUtilLib/plNetCommon/plNetMsgScreener.h @@ -69,11 +69,11 @@ protected: virtual bool IIsLocalArmatureModKey(plKey key, const plNetGameMember* gm) const { return true; } virtual void ILogChatMessage(const plMessage* msg_, const plNetGameMember* gm) const {} - virtual void ILogCCRMessage(Int16 classIndex, const plNetGameMember* gm) const {} + virtual void ILogCCRMessage(int16_t classIndex, const plNetGameMember* gm) const {} - Answer IAllowMessageType(Int16 classIndex, const plNetGameMember* gm=nil) const; + Answer IAllowMessageType(int16_t classIndex, const plNetGameMember* gm=nil) const; bool IValidateMessage(const plMessage* msg, const plNetGameMember* gm=nil) const; - void IRejectLogMsg(Int16 classIndex, const char* desc, const plNetGameMember* gm) const; + void IRejectLogMsg(int16_t classIndex, const char* desc, const plNetGameMember* gm) const; void IRejectLogMsg(const plMessage* msg, const char* desc, const plNetGameMember* gm) const; virtual bool IAmClient() const = 0; }; diff --git a/Sources/Plasma/PubUtilLib/plNetCommon/plNetServerSessionInfo.cpp b/Sources/Plasma/PubUtilLib/plNetCommon/plNetServerSessionInfo.cpp index 01ced3e2..fedaa86d 100644 --- a/Sources/Plasma/PubUtilLib/plNetCommon/plNetServerSessionInfo.cpp +++ b/Sources/Plasma/PubUtilLib/plNetCommon/plNetServerSessionInfo.cpp @@ -39,7 +39,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com Mead, WA 99021 *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "hsStream.h" #include "pnMessage/plMessage.h" #include "plNetServerSessionInfo.h" @@ -291,7 +291,7 @@ void plAgeInfoStruct::SetAgeUserDefinedName( const char * v ) } } -void plAgeInfoStruct::SetAgeSequenceNumber( UInt32 v ) +void plAgeInfoStruct::SetAgeSequenceNumber( uint32_t v ) { if ( v ) { @@ -317,7 +317,7 @@ void plAgeInfoStruct::SetAgeDescription( const char * v ) } } -void plAgeInfoStruct::SetAgeLanguage( UInt32 v ) +void plAgeInfoStruct::SetAgeLanguage( uint32_t v ) { if ( v >= 0 ) { @@ -731,7 +731,7 @@ void plNetServerSessionInfo::SetServerName(const char * val) } } -void plNetServerSessionInfo::SetServerType(UInt8 val) +void plNetServerSessionInfo::SetServerType(uint8_t val) { if (val>0) { @@ -759,7 +759,7 @@ void plNetServerSessionInfo::SetServerAddr(const char * val) } } -void plNetServerSessionInfo::SetServerPort(UInt16 val) +void plNetServerSessionInfo::SetServerPort(uint16_t val) { if (val>0) { diff --git a/Sources/Plasma/PubUtilLib/plNetCommon/plNetServerSessionInfo.h b/Sources/Plasma/PubUtilLib/plNetCommon/plNetServerSessionInfo.h index e1708f42..08e0ce38 100644 --- a/Sources/Plasma/PubUtilLib/plNetCommon/plNetServerSessionInfo.h +++ b/Sources/Plasma/PubUtilLib/plNetCommon/plNetServerSessionInfo.h @@ -42,7 +42,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #ifndef plNetServerSessionInfo_h_inc #define plNetServerSessionInfo_h_inc -#include "hsTypes.h" +#include "HeadSpin.h" #include "hsStlUtils.h" #include "pnFactory/plCreatable.h" #include "pnNetCommon/plNetServers.h" @@ -60,7 +60,7 @@ class plVaultAgeLinkNode; class plAgeInfoStruct : public plCreatable { - mutable UInt8 fFlags; + mutable uint8_t fFlags; // Age dataset name "Neighborhood" std::string fAgeFilename; @@ -79,10 +79,10 @@ class plAgeInfoStruct : public plCreatable // A modifier to user-defined name to make it unique in gui lists. // Assigned by vault server. - Int32 fAgeSequenceNumber; + int32_t fAgeSequenceNumber; // The language of the client that created this age - Int32 fAgeLanguage; + int32_t fAgeLanguage; mutable std::string fDisplayName; @@ -97,9 +97,9 @@ class plAgeInfoStruct : public plCreatable kHasAgeLanguage = 1<<6, }; - void SetFlag( UInt8 bit, bool on=true ) const { (on)?fFlags|=bit:fFlags&=~bit;} - void ClearFlag( UInt8 bit ) { fFlags&=~bit;} - bool IsFlagSet( UInt8 bit ) const { return (fFlags&bit)!=0;} + void SetFlag( uint8_t bit, bool on=true ) const { (on)?fFlags|=bit:fFlags&=~bit;} + void ClearFlag( uint8_t bit ) { fFlags&=~bit;} + bool IsFlagSet( uint8_t bit ) const { return (fFlags&bit)!=0;} public: plAgeInfoStruct() @@ -123,16 +123,16 @@ public: const plUUID * GetAgeInstanceGuid() const { return &fAgeInstanceGuid; } const char * GetAgeUserDefinedName() const { return fAgeUserDefinedName.c_str(); } const char * GetAgeDescription() const { return fAgeDescription.c_str(); } - UInt32 GetAgeSequenceNumber() const { return fAgeSequenceNumber; } - UInt32 GetAgeLanguage() const { return fAgeLanguage; } + uint32_t GetAgeSequenceNumber() const { return fAgeSequenceNumber; } + uint32_t GetAgeLanguage() const { return fAgeLanguage; } void SetAgeFilename( const char * v ); void SetAgeInstanceName( const char * v ); void SetAgeInstanceGuid( const plUUID * v ); void SetAgeUserDefinedName( const char * v ); void SetAgeDescription( const char * v ); - void SetAgeSequenceNumber( UInt32 v ); - void SetAgeLanguage( UInt32 v ); + void SetAgeSequenceNumber( uint32_t v ); + void SetAgeLanguage( uint32_t v ); bool HasAgeFilename() const { return IsFlagSet( kHasAgeFilename ); } bool HasAgeInstanceName() const { return IsFlagSet( kHasAgeInstanceName ); } @@ -154,19 +154,19 @@ public: class plAgeLinkStruct : public plCreatable { - UInt16 fFlags; + uint16_t fFlags; // Where we want to link. plAgeInfoStruct fAgeInfo; // The linking rule to use. See plNetCommon::LinkingRules - Int8 fLinkingRules; + int8_t fLinkingRules; // Where to spawn avatar when we load the age specified in fAgeInfo plSpawnPointInfo fSpawnPoint; // Override PLS/MCP load balancing rules for CCRs. - UInt8 fAmCCR; + uint8_t fAmCCR; // If this is a child age link, who is the parent // ...Age dataset name like "Neighborhood" @@ -183,9 +183,9 @@ class plAgeLinkStruct : public plCreatable kHasParentAgeFilename = 1<<6, }; - void SetFlag( UInt16 bit, bool on=true ) { (on)?fFlags|=bit:fFlags&=~bit;} - void ClearFlag( UInt16 bit ) { fFlags&=~bit;} - bool IsFlagSet( UInt16 bit ) const { return (fFlags&bit)!=0;} + void SetFlag( uint16_t bit, bool on=true ) { (on)?fFlags|=bit:fFlags&=~bit;} + void ClearFlag( uint16_t bit ) { fFlags&=~bit;} + bool IsFlagSet( uint16_t bit ) const { return (fFlags&bit)!=0;} public: plAgeLinkStruct(); @@ -230,11 +230,11 @@ public: class plNetServerSessionInfo : public plCreatable { - UInt8 fFlags; + uint8_t fFlags; std::string fServerName; - UInt8 fServerType; + uint8_t fServerType; std::string fServerAddr; - UInt16 fServerPort; + uint16_t fServerPort; plUUID fServerGuid; enum @@ -246,9 +246,9 @@ class plNetServerSessionInfo : public plCreatable kHasServerGuid = 1<<4, }; - void SetFlag( UInt8 bit ) { fFlags|=bit;} - void ClearFlag( UInt8 bit ) { fFlags&=~bit;} - bool IsFlagSet( UInt8 bit ) const { return (fFlags&bit)!=0;} + void SetFlag( uint8_t bit ) { fFlags|=bit;} + void ClearFlag( uint8_t bit ) { fFlags&=~bit;} + bool IsFlagSet( uint8_t bit ) const { return (fFlags&bit)!=0;} public: plNetServerSessionInfo() @@ -260,16 +260,16 @@ public: GETINTERFACE_ANY( plNetServerSessionInfo, plCreatable ); void SetServerName(const char * val); - void SetServerType(UInt8 val); + void SetServerType(uint8_t val); void SetServerAddr(const char * val); - void SetServerPort(UInt16 val); + void SetServerPort(uint16_t val); void SetServerGuid(const plUUID * val); void CopyServerGuid(const plUUID & val); const char * GetServerName() const { return fServerName.c_str();} - UInt8 GetServerType() const { return fServerType;} + uint8_t GetServerType() const { return fServerType;} const char * GetServerAddr() const { return fServerAddr.c_str(); } - UInt16 GetServerPort() const { return fServerPort; } + uint16_t GetServerPort() const { return fServerPort; } const plUUID *GetServerGuid() const { return &fServerGuid; } plUUID * GetServerGuid() { return &fServerGuid; } @@ -309,7 +309,7 @@ public: //class plAgeLinkingInfo : public plCreatable //{ // int fLinkingRules; -// UInt32 fPlayerID; +// uint32_t fPlayerID; // hsBool8 fSuperUser; // mutable plAgeInfoStruct fAgeInfo; // mutable plNetServerSessionInfo fServerInfo; @@ -322,8 +322,8 @@ public: // // int GetLinkingRules( void ) const { return fLinkingRules;} // void SetLinkingRules( int v ) { fLinkingRules=v;} -// UInt32 GetPlayerID( void ) const { return fPlayerID;} -// void SetPlayerID( UInt32 v ) { fPlayerID=v;} +// uint32_t GetPlayerID( void ) const { return fPlayerID;} +// void SetPlayerID( uint32_t v ) { fPlayerID=v;} // void SetSuperUser(bool b) { fSuperUser=b; } // bool GetSuperUser() const { return fSuperUser ? true : false; } // diff --git a/Sources/Plasma/PubUtilLib/plNetCommon/plServerGuid.cpp b/Sources/Plasma/PubUtilLib/plNetCommon/plServerGuid.cpp index 1e9b9bac..74886122 100644 --- a/Sources/Plasma/PubUtilLib/plNetCommon/plServerGuid.cpp +++ b/Sources/Plasma/PubUtilLib/plNetCommon/plServerGuid.cpp @@ -57,19 +57,19 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // Taken from plUnifiedTime, in turn taken from python source. // TODO: Move this down to CoreLib someday (and rename it maybe). #define MAGICWINDOWSOFFSET ((__int64)11644473600) -static UInt32 SecsSinceUNIXEpoch() +static uint32_t SecsSinceUNIXEpoch() { FILETIME ft; GetSystemTimeAsFileTime(&ft); /* 100 ns blocks since 01-Jan-1641 */ __int64 ff,ffsecs; ff = *(__int64*)(&ft); ffsecs = ff/(__int64)10000000; - return (UInt32)(ffsecs-MAGICWINDOWSOFFSET); + return (uint32_t)(ffsecs-MAGICWINDOWSOFFSET); } #else -static UInt32 SecsSinceUNIXEpoch() +static uint32_t SecsSinceUNIXEpoch() { struct timeval tv; gettimeofday(&tv, nil); @@ -81,7 +81,7 @@ static UInt32 SecsSinceUNIXEpoch() //////////////////////////////////////////////////////////////////// -UInt32 plServerGuid::fGuidSeed = 0; +uint32_t plServerGuid::fGuidSeed = 0; plServerGuid::plServerGuid() { @@ -244,7 +244,7 @@ void plServerGuid::Clear() memset(N,0,kGuidBytes); } -void plServerGuid::SetGuidSeed(UInt32 seed) +void plServerGuid::SetGuidSeed(uint32_t seed) { fGuidSeed = seed; } @@ -261,7 +261,7 @@ plServerGuid plServerGuid::GenerateGuid() // Current Time: 24 bits (seconds. ~8.5 year cycle) // Counter: 16 bits (always increasing per process) - static UInt16 StaticCounter = 0; + static uint16_t StaticCounter = 0; if (!fGuidSeed) { hsStatusMessage( "fGuidSeed not set yet. Cannot generate a reliable guid! Setting fGuidSeed=getpid()." ); @@ -269,15 +269,15 @@ plServerGuid plServerGuid::GenerateGuid() fGuidSeed = getpid(); } - UInt32 currTime = SecsSinceUNIXEpoch(); + uint32_t currTime = SecsSinceUNIXEpoch(); plServerGuid guid; - guid.N[0] = (UInt8)((fGuidSeed & 0x00FF0000)>>16); - guid.N[1] = (UInt8)((fGuidSeed & 0x0000FF00)>> 8); - guid.N[2] = (UInt8)(fGuidSeed & 0x000000FF); - guid.N[3] = (UInt8)((currTime & 0x00FF0000)>>16); - guid.N[4] = (UInt8)((currTime & 0x0000FF00)>> 8); - guid.N[5] = (UInt8)(currTime & 0x000000FF); + guid.N[0] = (uint8_t)((fGuidSeed & 0x00FF0000)>>16); + guid.N[1] = (uint8_t)((fGuidSeed & 0x0000FF00)>> 8); + guid.N[2] = (uint8_t)(fGuidSeed & 0x000000FF); + guid.N[3] = (uint8_t)((currTime & 0x00FF0000)>>16); + guid.N[4] = (uint8_t)((currTime & 0x0000FF00)>> 8); + guid.N[5] = (uint8_t)(currTime & 0x000000FF); guid.N[6] = (StaticCounter & 0xFF00)>> 8; guid.N[7] = (StaticCounter & 0x00FF); diff --git a/Sources/Plasma/PubUtilLib/plNetCommon/plServerGuid.h b/Sources/Plasma/PubUtilLib/plNetCommon/plServerGuid.h index 1b1360ee..a191eb44 100644 --- a/Sources/Plasma/PubUtilLib/plNetCommon/plServerGuid.h +++ b/Sources/Plasma/PubUtilLib/plNetCommon/plServerGuid.h @@ -63,7 +63,7 @@ public: union { - UInt8 N[kGuidBytes]; + uint8_t N[kGuidBytes]; hsWide fWide; }; plServerGuid(); @@ -94,7 +94,7 @@ public: void CopyFrom( const plServerGuid * other ); void Clear(); - static void SetGuidSeed( UInt32 seed ); + static void SetGuidSeed( uint32_t seed ); static bool GuidSeedIsSet( void ) { return fGuidSeed!=0;} static plServerGuid GenerateGuid( void ); @@ -102,7 +102,7 @@ public: GETINTERFACE_ANY( plServerGuid, plCreatable ); private: - static UInt32 fGuidSeed; // only low 24 bits are used + static uint32_t fGuidSeed; // only low 24 bits are used }; diff --git a/Sources/Plasma/PubUtilLib/plNetCommon/plSpawnPointInfo.h b/Sources/Plasma/PubUtilLib/plNetCommon/plSpawnPointInfo.h index c2f7c6c5..e78223af 100644 --- a/Sources/Plasma/PubUtilLib/plNetCommon/plSpawnPointInfo.h +++ b/Sources/Plasma/PubUtilLib/plNetCommon/plSpawnPointInfo.h @@ -42,7 +42,6 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #ifndef plSpawnPointInfo_h_inc #define plSpawnPointInfo_h_inc -#include "hsConfig.h" #include "hsStlUtils.h" /////////////////////////////////////////////////////////////////// diff --git a/Sources/Plasma/PubUtilLib/plNetGameLib/Intern.h b/Sources/Plasma/PubUtilLib/plNetGameLib/Intern.h index 9a4c4602..e9eb0575 100644 --- a/Sources/Plasma/PubUtilLib/plNetGameLib/Intern.h +++ b/Sources/Plasma/PubUtilLib/plNetGameLib/Intern.h @@ -329,7 +329,7 @@ struct NetTrans : AtomicRef { virtual bool Send () = 0; virtual void Post () = 0; virtual bool Recv ( // return false to disconnect from server - const byte msg[], + const uint8_t msg[], unsigned bytes ) = 0; }; @@ -391,7 +391,7 @@ struct NetNotifyTrans : NetTrans { bool CanStart () const { return true; } bool Send () { m_state = kTransStateComplete; return true; } bool Recv ( - const byte [], + const uint8_t [], unsigned ) { return true; } }; @@ -402,7 +402,7 @@ void NetTransSetTimeoutMs (unsigned ms); unsigned NetTransGetTimeoutMs (); void NetTransSend (NetTrans * trans); -bool NetTransRecv (unsigned transId, const byte msg[], unsigned bytes); +bool NetTransRecv (unsigned transId, const uint8_t msg[], unsigned bytes); void NetTransCancel (unsigned transId, ENetError error); void NetTransCancelByProtocol (ENetProtocol protocol, ENetError error); void NetTransCancelByConnId (unsigned connId, ENetError error); diff --git a/Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglAuth.cpp b/Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglAuth.cpp index b7c7e74e..8008db80 100644 --- a/Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglAuth.cpp +++ b/Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglAuth.cpp @@ -82,13 +82,13 @@ struct CliAuConn : AtomicRef { void StopAutoPing (); void TimerPing (); - void Send (const unsigned_ptr fields[], unsigned count); + void Send (const uintptr_t fields[], unsigned count); CCritSect critsect; LINK(CliAuConn) link; AsyncSocket sock; NetCli * cli; - wchar name[MAX_PATH]; + wchar_t name[MAX_PATH]; NetAddress addr; Uuid token; unsigned seq; @@ -105,7 +105,7 @@ struct PingRequestTrans : NetAuthTrans { void * m_param; unsigned m_pingAtMs; unsigned m_replyAtMs; - ARRAY(byte) m_payload; + ARRAY(uint8_t) m_payload; PingRequestTrans ( FNetCliAuthPingRequestCallback callback, @@ -118,7 +118,7 @@ struct PingRequestTrans : NetAuthTrans { bool Send (); void Post (); bool Recv ( - const byte msg[], + const uint8_t msg[], unsigned bytes ); }; @@ -131,23 +131,23 @@ struct AccountExistsRequestTrans : NetAuthTrans { void * m_param; // send - wchar m_accountName[kMaxAccountNameLength]; + wchar_t m_accountName[kMaxAccountNameLength]; // recv - byte m_exists; + uint8_t m_exists; AccountExistsRequestTrans ( FNetCliAuthAccountExistsRequestCallback callback, void * param, - const wchar accountName[] + const wchar_t accountName[] ); bool Send (); void Post (); bool Recv ( - const byte msg[], + const uint8_t msg[], unsigned bytes ); }; @@ -172,15 +172,15 @@ struct LoginRequestTrans : NetAuthTrans { void AddPlayer ( unsigned playerInt, - const wchar playerName[], - const wchar avatarShape[], + const wchar_t playerName[], + const wchar_t avatarShape[], unsigned explorer ); bool Send (); void Post (); bool Recv ( - const byte msg[], + const uint8_t msg[], unsigned bytes ); }; @@ -191,14 +191,14 @@ struct LoginRequestTrans : NetAuthTrans { struct AgeRequestTrans : NetAuthTrans { FNetCliAuthAgeRequestCallback m_callback; void * m_param; - wchar m_ageName[kMaxAgeNameLength]; + wchar_t m_ageName[kMaxAgeNameLength]; unsigned m_ageMcpId; Uuid m_ageInstId; unsigned m_ageVaultId; NetAddressNode m_gameSrvNode; AgeRequestTrans ( - const wchar ageName[], + const wchar_t ageName[], const Uuid & ageInstId, FNetCliAuthAgeRequestCallback callback, void * param @@ -208,7 +208,7 @@ struct AgeRequestTrans : NetAuthTrans { bool Send (); void Post (); bool Recv ( - const byte msg[], + const uint8_t msg[], unsigned bytes ); }; @@ -221,7 +221,7 @@ struct AccountCreateRequestTrans : NetAuthTrans { void * m_param; // send - wchar m_accountName[kMaxAccountNameLength]; + wchar_t m_accountName[kMaxAccountNameLength]; ShaDigest m_namePassHash; unsigned m_accountFlags; unsigned m_billingType; @@ -230,8 +230,8 @@ struct AccountCreateRequestTrans : NetAuthTrans { Uuid m_accountId; AccountCreateRequestTrans ( - const wchar accountName[], - const wchar password[], + const wchar_t accountName[], + const wchar_t password[], unsigned accountFlags, unsigned billingType, FNetCliAuthAccountCreateRequestCallback callback, @@ -241,7 +241,7 @@ struct AccountCreateRequestTrans : NetAuthTrans { bool Send (); void Post (); bool Recv ( - const byte msg[], + const uint8_t msg[], unsigned bytes ); }; @@ -254,7 +254,7 @@ struct AccountCreateFromKeyRequestTrans : NetAuthTrans { void * m_param; // send - wchar m_accountName[kMaxAccountNameLength]; + wchar_t m_accountName[kMaxAccountNameLength]; ShaDigest m_namePassHash; Uuid m_key; unsigned m_billingType; @@ -264,8 +264,8 @@ struct AccountCreateFromKeyRequestTrans : NetAuthTrans { Uuid m_activationKey; AccountCreateFromKeyRequestTrans ( - const wchar accountName[], - const wchar password[], + const wchar_t accountName[], + const wchar_t password[], const Uuid & key, unsigned billingType, FNetCliAuthAccountCreateFromKeyRequestCallback callback, @@ -275,7 +275,7 @@ struct AccountCreateFromKeyRequestTrans : NetAuthTrans { bool Send (); void Post (); bool Recv ( - const byte msg[], + const uint8_t msg[], unsigned bytes ); }; @@ -288,18 +288,18 @@ struct PlayerCreateRequestTrans : NetAuthTrans { void * m_param; // send - wchar m_playerName[kMaxPlayerNameLength]; - wchar m_avatarShape[MAX_PATH]; - wchar m_friendInvite[MAX_PATH]; + wchar_t m_playerName[kMaxPlayerNameLength]; + wchar_t m_avatarShape[MAX_PATH]; + wchar_t m_friendInvite[MAX_PATH]; // recv NetCliAuthPlayerInfo m_playerInfo; PlayerCreateRequestTrans ( - const wchar playerName[], - const wchar avatarShape[], - const wchar friendInvite[], + const wchar_t playerName[], + const wchar_t avatarShape[], + const wchar_t friendInvite[], FNetCliAuthPlayerCreateRequestCallback callback, void * param ); @@ -307,7 +307,7 @@ struct PlayerCreateRequestTrans : NetAuthTrans { bool Send (); void Post (); bool Recv ( - const byte msg[], + const uint8_t msg[], unsigned bytes ); }; @@ -335,7 +335,7 @@ struct PlayerDeleteRequestTrans : NetAuthTrans { bool Send (); void Post (); bool Recv ( - const byte msg[], + const uint8_t msg[], unsigned bytes ); }; @@ -359,7 +359,7 @@ struct UpgradeVisitorRequestTrans : NetAuthTrans { bool Send (); void Post (); bool Recv ( - const byte msg[], + const uint8_t msg[], unsigned bytes ); }; @@ -385,7 +385,7 @@ struct SetPlayerRequestTrans : NetAuthTrans { bool Send (); void Post (); bool Recv ( - const byte msg[], + const uint8_t msg[], unsigned bytes ); }; @@ -398,12 +398,12 @@ struct AccountChangePasswordRequestTrans : NetAuthTrans { void * m_param; // send - wchar m_accountName[kMaxAccountNameLength]; + wchar_t m_accountName[kMaxAccountNameLength]; ShaDigest m_namePassHash; AccountChangePasswordRequestTrans ( - const wchar accountName[], - const wchar password[], + const wchar_t accountName[], + const wchar_t password[], FNetCliAuthAccountChangePasswordRequestCallback callback, void * param ); @@ -411,7 +411,7 @@ struct AccountChangePasswordRequestTrans : NetAuthTrans { bool Send (); void Post (); bool Recv ( - const byte msg[], + const uint8_t msg[], unsigned bytes ); }; @@ -424,13 +424,13 @@ struct GetPublicAgeListTrans : NetAuthTrans { void * m_param; // send - wchar m_ageName[MAX_PATH]; + wchar_t m_ageName[MAX_PATH]; // recv ARRAY(NetAgeInfo) m_ages; GetPublicAgeListTrans ( - const wchar ageName[], + const wchar_t ageName[], FNetCliAuthGetPublicAgeListCallback callback, void * param ); @@ -438,7 +438,7 @@ struct GetPublicAgeListTrans : NetAuthTrans { bool Send (); void Post (); bool Recv ( - const byte msg[], + const uint8_t msg[], unsigned bytes ); }; @@ -451,11 +451,11 @@ struct AccountSetRolesRequestTrans : NetAuthTrans { void * m_param; // send - wchar m_accountName[kMaxAccountNameLength]; + wchar_t m_accountName[kMaxAccountNameLength]; unsigned m_accountFlags; AccountSetRolesRequestTrans ( - const wchar accountName[], + const wchar_t accountName[], unsigned accountFlags, FNetCliAuthAccountSetRolesRequestCallback callback, void * param @@ -464,7 +464,7 @@ struct AccountSetRolesRequestTrans : NetAuthTrans { bool Send (); void Post (); bool Recv ( - const byte msg[], + const uint8_t msg[], unsigned bytes ); }; @@ -477,11 +477,11 @@ struct AccountSetBillingTypeRequestTrans : NetAuthTrans { void * m_param; // send - wchar m_accountName[kMaxAccountNameLength]; + wchar_t m_accountName[kMaxAccountNameLength]; unsigned m_billingType; AccountSetBillingTypeRequestTrans ( - const wchar accountName[], + const wchar_t accountName[], unsigned billingType, FNetCliAuthAccountSetBillingTypeRequestCallback callback, void * param @@ -490,7 +490,7 @@ struct AccountSetBillingTypeRequestTrans : NetAuthTrans { bool Send (); void Post (); bool Recv ( - const byte msg[], + const uint8_t msg[], unsigned bytes ); }; @@ -514,7 +514,7 @@ struct AccountActivateRequestTrans : NetAuthTrans { bool Send (); void Post (); bool Recv ( - const byte msg[], + const uint8_t msg[], unsigned bytes ); }; @@ -526,22 +526,22 @@ struct FileListRequestTrans : NetAuthTrans { FNetCliAuthFileListRequestCallback m_callback; void * m_param; - wchar m_directory[MAX_PATH]; - wchar m_ext[MAX_EXT]; + wchar_t m_directory[MAX_PATH]; + wchar_t m_ext[MAX_EXT]; ARRAY(NetCliAuthFileInfo) m_fileInfoArray; FileListRequestTrans ( FNetCliAuthFileListRequestCallback callback, void * param, - const wchar directory[], - const wchar ext[] + const wchar_t directory[], + const wchar_t ext[] ); bool Send (); void Post (); bool Recv ( - const byte msg[], + const uint8_t msg[], unsigned bytes ); }; @@ -553,20 +553,20 @@ struct FileDownloadRequestTrans : NetAuthTrans { FNetCliAuthFileRequestCallback m_callback; void * m_param; - wchar m_filename[MAX_PATH]; + wchar_t m_filename[MAX_PATH]; hsStream * m_writer; FileDownloadRequestTrans ( FNetCliAuthFileRequestCallback callback, void * param, - const wchar filename[], + const wchar_t filename[], hsStream * writer ); bool Send (); void Post (); bool Recv ( - const byte msg[], + const uint8_t msg[], unsigned bytes ); }; @@ -578,7 +578,7 @@ struct RcvdFileDownloadChunkTrans : NetNotifyTrans { unsigned bytes; unsigned offset; - byte * data; + uint8_t * data; hsStream * writer; RcvdFileDownloadChunkTrans () : NetNotifyTrans(kRcvdFileDownloadChunkTrans) {} @@ -594,7 +594,7 @@ struct RcvdPropagatedBufferTrans : NetNotifyTrans { unsigned bufferType; unsigned bufferBytes; - byte * bufferData; + uint8_t * bufferData; RcvdPropagatedBufferTrans () : NetNotifyTrans(kRcvdPropagatedBufferTrans) {} ~RcvdPropagatedBufferTrans (); @@ -669,7 +669,7 @@ struct VaultFetchNodeRefsTrans : NetAuthTrans { bool Send (); void Post (); bool Recv ( - const byte msg[], + const uint8_t msg[], unsigned bytes ); }; @@ -683,10 +683,10 @@ struct VaultInitAgeTrans : NetAuthTrans { Uuid m_ageInstId; Uuid m_parentAgeInstId; - wchar * m_ageFilename; - wchar * m_ageInstName; - wchar * m_ageUserName; - wchar * m_ageDesc; + wchar_t * m_ageFilename; + wchar_t * m_ageInstName; + wchar_t * m_ageUserName; + wchar_t * m_ageDesc; unsigned m_ageSequenceNumber; unsigned m_ageLanguage; @@ -698,10 +698,10 @@ struct VaultInitAgeTrans : NetAuthTrans { void * param, // optional const Uuid & ageInstId, // optional. is used in match const Uuid & parentAgeInstId, // optional. is used in match - const wchar ageFilename[], // optional. is used in match - const wchar ageInstName[], // optional. not used in match - const wchar ageUserName[], // optional. not used in match - const wchar ageDesc[], // optional. not used in match + const wchar_t ageFilename[], // optional. is used in match + const wchar_t ageInstName[], // optional. not used in match + const wchar_t ageUserName[], // optional. not used in match + const wchar_t ageDesc[], // optional. not used in match unsigned ageSequenceNumber, // optional. not used in match unsigned ageLanguage // optional. not used in match ); @@ -710,7 +710,7 @@ struct VaultInitAgeTrans : NetAuthTrans { bool Send (); void Post (); bool Recv ( - const byte msg[], + const uint8_t msg[], unsigned bytes ); }; @@ -735,7 +735,7 @@ struct VaultFetchNodeTrans : NetAuthTrans { bool Send (); void Post (); bool Recv ( - const byte msg[], + const uint8_t msg[], unsigned bytes ); }; @@ -762,7 +762,7 @@ struct VaultFindNodeTrans : NetAuthTrans { bool Send (); void Post (); bool Recv ( - const byte msg[], + const uint8_t msg[], unsigned bytes ); }; @@ -787,7 +787,7 @@ struct VaultCreateNodeTrans : NetAuthTrans { bool Send (); void Post (); bool Recv ( - const byte msg[], + const uint8_t msg[], unsigned bytes ); }; @@ -799,7 +799,7 @@ struct VaultSaveNodeTrans : NetAuthTrans { unsigned m_nodeId; Uuid m_revisionId; - ARRAY(byte) m_buffer; + ARRAY(uint8_t) m_buffer; FNetCliAuthVaultNodeSaveCallback m_callback; void * m_param; @@ -815,7 +815,7 @@ struct VaultSaveNodeTrans : NetAuthTrans { bool Send (); void Post (); bool Recv ( - const byte msg[], + const uint8_t msg[], unsigned bytes ); }; @@ -842,7 +842,7 @@ struct VaultAddNodeTrans : NetAuthTrans { bool Send (); void Post (); bool Recv ( - const byte msg[], + const uint8_t msg[], unsigned bytes ); }; @@ -867,7 +867,7 @@ struct VaultRemoveNodeTrans : NetAuthTrans { bool Send (); void Post (); bool Recv ( - const byte msg[], + const uint8_t msg[], unsigned bytes ); }; @@ -902,7 +902,7 @@ struct SetPlayerBanStatusRequestTrans : NetAuthTrans { bool Send (); void Post (); bool Recv ( - const byte msg[], + const uint8_t msg[], unsigned bytes ); }; @@ -916,11 +916,11 @@ struct ChangePlayerNameRequestTrans : NetAuthTrans { // send unsigned m_playerId; - wchar m_newName[kMaxPlayerNameLength]; + wchar_t m_newName[kMaxPlayerNameLength]; ChangePlayerNameRequestTrans ( unsigned playerId, - const wchar newName[], + const wchar_t newName[], FNetCliAuthChangePlayerNameRequestCallback callback, void * param ); @@ -928,7 +928,7 @@ struct ChangePlayerNameRequestTrans : NetAuthTrans { bool Send (); void Post (); bool Recv ( - const byte msg[], + const uint8_t msg[], unsigned bytes ); }; @@ -941,13 +941,13 @@ struct SendFriendInviteTrans : NetAuthTrans { void * m_param; // send - wchar m_emailAddress[kMaxEmailAddressLength]; - wchar m_toName[kMaxPlayerNameLength]; + wchar_t m_emailAddress[kMaxEmailAddressLength]; + wchar_t m_toName[kMaxPlayerNameLength]; Uuid m_inviteUuid; SendFriendInviteTrans ( - const wchar emailAddr[], - const wchar toName[], + const wchar_t emailAddr[], + const wchar_t toName[], const Uuid & inviteUuid, FNetCliAuthSendFriendInviteCallback callback, void * param @@ -956,7 +956,7 @@ struct SendFriendInviteTrans : NetAuthTrans { bool Send (); void Post (); bool Recv ( - const byte msg[], + const uint8_t msg[], unsigned bytes ); }; @@ -986,7 +986,7 @@ struct ScoreCreateTrans : NetAuthTrans { // recv unsigned m_scoreId; - UInt32 m_createdTime; + uint32_t m_createdTime; ScoreCreateTrans ( unsigned ownerId, @@ -1000,7 +1000,7 @@ struct ScoreCreateTrans : NetAuthTrans { bool Send (); void Post (); bool Recv ( - const byte msg[], + const uint8_t msg[], unsigned bytes ); }; @@ -1024,7 +1024,7 @@ struct ScoreDeleteTrans : NetAuthTrans { bool Send (); void Post (); bool Recv ( - const byte msg[], + const uint8_t msg[], unsigned bytes ); }; @@ -1054,7 +1054,7 @@ struct ScoreGetScoresTrans : NetAuthTrans { bool Send (); void Post (); bool Recv ( - const byte msg[], + const uint8_t msg[], unsigned bytes ); }; @@ -1080,7 +1080,7 @@ struct ScoreAddPointsTrans : NetAuthTrans { bool Send (); void Post (); bool Recv ( - const byte msg[], + const uint8_t msg[], unsigned bytes ); }; @@ -1108,7 +1108,7 @@ struct ScoreTransferPointsTrans : NetAuthTrans { bool Send (); void Post (); bool Recv ( - const byte msg[], + const uint8_t msg[], unsigned bytes ); }; @@ -1134,7 +1134,7 @@ struct ScoreSetPointsTrans : NetAuthTrans { bool Send (); void Post (); bool Recv ( - const byte msg[], + const uint8_t msg[], unsigned bytes ); }; @@ -1150,7 +1150,7 @@ struct ScoreGetRanksTrans : NetAuthTrans { unsigned m_ownerId; unsigned m_scoreGroup; unsigned m_parentFolderId; - wchar m_gameName[kMaxGameScoreNameLength]; + wchar_t m_gameName[kMaxGameScoreNameLength]; unsigned m_timePeriod; unsigned m_numResults; unsigned m_pageNumber; @@ -1176,7 +1176,7 @@ struct ScoreGetRanksTrans : NetAuthTrans { bool Send (); void Post (); bool Recv ( - const byte msg[], + const uint8_t msg[], unsigned bytes ); }; @@ -1199,14 +1199,14 @@ static bool s_running; static CCritSect s_critsect; static LISTDECL(CliAuConn, link) s_conns; static CliAuConn * s_active; -static wchar s_accountName[kMaxAccountNameLength]; +static wchar_t s_accountName[kMaxAccountNameLength]; static ShaDigest s_accountNamePassHash; -static wchar s_authToken[kMaxPublisherAuthKeyLength]; -static wchar s_os[kMaxGTOSIdLength]; +static wchar_t s_authToken[kMaxPublisherAuthKeyLength]; +static wchar_t s_os[kMaxGTOSIdLength]; static long s_perf[kNumPerf]; -static UInt32 s_encryptionKey[4]; +static uint32_t s_encryptionKey[4]; static FNetCliAuthRecvBufferHandler s_bufRcvdCb; static FNetCliAuthConnectCallback s_connectedCb; @@ -1232,14 +1232,14 @@ static inline bool ICharIsSpace (unsigned ch) { } //=========================================================================== -static ENetError FixupPlayerName (wchar * name) { +static ENetError FixupPlayerName (wchar_t * name) { ASSERT(name); // Trim leading and trailing whitespace and convert // multiple internal spaces into only one space unsigned nonSpaceChars = 0; - wchar *dst = name; - for (wchar *src = name; *src; ) { + wchar_t *dst = name; + for (wchar_t *src = name; *src; ) { // Skip whitespace while (*src && ICharIsSpace(*src)) src++; @@ -1314,7 +1314,7 @@ static void UnlinkAndAbandonConn_CS (CliAuConn * conn) { //============================================================================ static void SendClientRegisterRequest (CliAuConn * conn) { - const unsigned_ptr msg[] = { + const uintptr_t msg[] = { kCli2Auth_ClientRegisterRequest, BuildId(), }; @@ -1333,7 +1333,7 @@ static bool ConnEncrypt (ENetError error, void * param) { if (!s_perf[kPingDisabled]) conn->AutoPing(); - AuthConnectedNotifyTrans * trans = NEW(AuthConnectedNotifyTrans); + AuthConnectedNotifyTrans * trans = new AuthConnectedNotifyTrans; NetTransSend(trans); } @@ -1525,7 +1525,7 @@ static void Connect ( //============================================================================ static void Connect ( - const wchar name[], + const wchar_t name[], const NetAddress & addr ) { ASSERT(s_running); @@ -1543,7 +1543,7 @@ static void Connect ( //============================================================================ static void AsyncLookupCallback ( void * param, - const wchar name[], + const wchar_t name[], unsigned addrCount, const NetAddress addrs[] ) { @@ -1720,7 +1720,7 @@ void CliAuConn::TimerPing () { // Send a ping request pingSendTimeMs = GetNonZeroTimeMs(); - const unsigned_ptr msg[] = { + const uintptr_t msg[] = { kCli2Auth_PingRequest, pingSendTimeMs, 0, // not a transaction @@ -1733,7 +1733,7 @@ void CliAuConn::TimerPing () { } //============================================================================ -void CliAuConn::Send (const unsigned_ptr fields[], unsigned count) { +void CliAuConn::Send (const uintptr_t fields[], unsigned count) { critsect.Enter(); { NetCliSend(cli, fields, count); @@ -1751,7 +1751,7 @@ void CliAuConn::Send (const unsigned_ptr fields[], unsigned count) { //============================================================================ static bool Recv_PingReply ( - const byte msg[], + const uint8_t msg[], unsigned bytes, void * ) { @@ -1765,7 +1765,7 @@ static bool Recv_PingReply ( //============================================================================ static bool Recv_AccountExistsReply ( - const byte msg[], + const uint8_t msg[], unsigned bytes, void * ) { @@ -1780,7 +1780,7 @@ static bool Recv_AccountExistsReply ( //============================================================================ static bool Recv_ClientRegisterReply ( - const byte msg[], + const uint8_t msg[], unsigned , void * param ) { @@ -1801,7 +1801,7 @@ static bool Recv_ClientRegisterReply ( //============================================================================ static bool Recv_AcctPlayerInfo ( - const byte msg[], + const uint8_t msg[], unsigned bytes, void * ) { @@ -1814,7 +1814,7 @@ static bool Recv_AcctPlayerInfo ( //============================================================================ static bool Recv_AcctLoginReply ( - const byte msg[], + const uint8_t msg[], unsigned bytes, void * ) { @@ -1827,7 +1827,7 @@ static bool Recv_AcctLoginReply ( //============================================================================ static bool Recv_AcctCreateReply ( - const byte msg[], + const uint8_t msg[], unsigned bytes, void * ) { @@ -1840,7 +1840,7 @@ static bool Recv_AcctCreateReply ( //============================================================================ static bool Recv_AcctCreateFromKeyReply ( - const byte msg[], + const uint8_t msg[], unsigned bytes, void * ) { @@ -1853,7 +1853,7 @@ static bool Recv_AcctCreateFromKeyReply ( //============================================================================ static bool Recv_PlayerCreateReply ( - const byte msg[], + const uint8_t msg[], unsigned bytes, void * ) { @@ -1866,7 +1866,7 @@ static bool Recv_PlayerCreateReply ( //============================================================================ static bool Recv_PlayerDeleteReply ( - const byte msg[], + const uint8_t msg[], unsigned bytes, void * ) { @@ -1879,7 +1879,7 @@ static bool Recv_PlayerDeleteReply ( //============================================================================ static bool Recv_UpgradeVisitorReply ( - const byte msg[], + const uint8_t msg[], unsigned bytes, void * ) { @@ -1892,7 +1892,7 @@ static bool Recv_UpgradeVisitorReply ( //============================================================================ static bool Recv_AcctSetPlayerReply ( - const byte msg[], + const uint8_t msg[], unsigned bytes, void * ) { @@ -1905,7 +1905,7 @@ static bool Recv_AcctSetPlayerReply ( //============================================================================ static bool Recv_AcctChangePasswordReply ( - const byte msg[], + const uint8_t msg[], unsigned bytes, void * ) { @@ -1918,7 +1918,7 @@ static bool Recv_AcctChangePasswordReply ( //============================================================================ static bool Recv_AcctSetRolesReply ( - const byte msg[], + const uint8_t msg[], unsigned bytes, void * ) { @@ -1931,7 +1931,7 @@ static bool Recv_AcctSetRolesReply ( //============================================================================ static bool Recv_AcctSetBillingTypeReply ( - const byte msg[], + const uint8_t msg[], unsigned bytes, void * ) { @@ -1944,7 +1944,7 @@ static bool Recv_AcctSetBillingTypeReply ( //============================================================================ static bool Recv_AcctActivateReply ( - const byte msg[], + const uint8_t msg[], unsigned bytes, void * ) { @@ -1957,7 +1957,7 @@ static bool Recv_AcctActivateReply ( //============================================================================ static bool Recv_AgeReply ( - const byte msg[], + const uint8_t msg[], unsigned bytes, void * ) { @@ -1970,7 +1970,7 @@ static bool Recv_AgeReply ( //============================================================================ static bool Recv_FileListReply ( - const byte msg[], + const uint8_t msg[], unsigned bytes, void * ) { @@ -1983,7 +1983,7 @@ static bool Recv_FileListReply ( //============================================================================ static bool Recv_FileDownloadChunk ( - const byte msg[], + const uint8_t msg[], unsigned bytes, void * ) { @@ -1996,7 +1996,7 @@ static bool Recv_FileDownloadChunk ( //============================================================================ static bool Recv_KickedOff ( - const byte buffer[], + const uint8_t buffer[], unsigned bytes, void * param ) { @@ -2010,7 +2010,7 @@ static bool Recv_KickedOff ( //============================================================================ static bool Recv_VaultNodeRefsFetched ( - const byte msg[], + const uint8_t msg[], unsigned bytes, void * ) { @@ -2023,7 +2023,7 @@ static bool Recv_VaultNodeRefsFetched ( //============================================================================ static bool Recv_VaultNodeFetched ( - const byte msg[], + const uint8_t msg[], unsigned bytes, void * ) { @@ -2036,7 +2036,7 @@ static bool Recv_VaultNodeFetched ( //============================================================================ static bool Recv_VaultNodeCreated ( - const byte msg[], + const uint8_t msg[], unsigned bytes, void * ) { @@ -2049,13 +2049,13 @@ static bool Recv_VaultNodeCreated ( //============================================================================ static bool Recv_VaultNodeChanged ( - const byte msg[], + const uint8_t msg[], unsigned , void * ) { const Auth2Cli_VaultNodeChanged & notify = *(const Auth2Cli_VaultNodeChanged *)msg; - VaultNodeChangedTrans * trans = NEW(VaultNodeChangedTrans); + VaultNodeChangedTrans * trans = new VaultNodeChangedTrans; trans->m_nodeId = notify.nodeId; trans->m_revId = notify.revisionId; NetTransSend(trans); @@ -2065,13 +2065,13 @@ static bool Recv_VaultNodeChanged ( //============================================================================ static bool Recv_VaultNodeAdded ( - const byte msg[], + const uint8_t msg[], unsigned , void * ) { const Auth2Cli_VaultNodeAdded & notify = *(const Auth2Cli_VaultNodeAdded *)msg; - VaultNodeAddedTrans * trans = NEW(VaultNodeAddedTrans); + VaultNodeAddedTrans * trans = new VaultNodeAddedTrans; trans->m_parentId = notify.parentId; trans->m_childId = notify.childId; trans->m_ownerId = notify.ownerId; @@ -2082,13 +2082,13 @@ static bool Recv_VaultNodeAdded ( //============================================================================ static bool Recv_VaultNodeRemoved ( - const byte msg[], + const uint8_t msg[], unsigned , void * ) { const Auth2Cli_VaultNodeRemoved & notify = *(const Auth2Cli_VaultNodeRemoved *)msg; - VaultNodeRemovedTrans * trans = NEW(VaultNodeRemovedTrans); + VaultNodeRemovedTrans * trans = new VaultNodeRemovedTrans; trans->m_parentId = notify.parentId; trans->m_childId = notify.childId; NetTransSend(trans); @@ -2098,13 +2098,13 @@ static bool Recv_VaultNodeRemoved ( //============================================================================ static bool Recv_VaultNodeDeleted ( - const byte msg[], + const uint8_t msg[], unsigned , void * ) { const Auth2Cli_VaultNodeDeleted & notify = *(const Auth2Cli_VaultNodeDeleted *)msg; - VaultNodeDeletedTrans * trans = NEW(VaultNodeDeletedTrans); + VaultNodeDeletedTrans * trans = new VaultNodeDeletedTrans; trans->m_nodeId = notify.nodeId; NetTransSend(trans); @@ -2113,7 +2113,7 @@ static bool Recv_VaultNodeDeleted ( //============================================================================ static bool Recv_VaultSaveNodeReply ( - const byte msg[], + const uint8_t msg[], unsigned bytes, void * ) { @@ -2126,7 +2126,7 @@ static bool Recv_VaultSaveNodeReply ( //============================================================================ static bool Recv_VaultAddNodeReply ( - const byte msg[], + const uint8_t msg[], unsigned bytes, void * ) { @@ -2139,7 +2139,7 @@ static bool Recv_VaultAddNodeReply ( //============================================================================ static bool Recv_VaultRemoveNodeReply ( - const byte msg[], + const uint8_t msg[], unsigned bytes, void * ) { @@ -2152,7 +2152,7 @@ static bool Recv_VaultRemoveNodeReply ( //============================================================================ static bool Recv_VaultInitAgeReply ( - const byte msg[], + const uint8_t msg[], unsigned bytes, void * ) { @@ -2165,7 +2165,7 @@ static bool Recv_VaultInitAgeReply ( //============================================================================ static bool Recv_VaultNodeFindReply ( - const byte msg[], + const uint8_t msg[], unsigned bytes, void * ) { @@ -2178,7 +2178,7 @@ static bool Recv_VaultNodeFindReply ( //============================================================================ static bool Recv_PublicAgeList ( - const byte msg[], + const uint8_t msg[], unsigned bytes, void * ) { @@ -2191,7 +2191,7 @@ static bool Recv_PublicAgeList ( //============================================================================ static bool Recv_ServerAddr ( - const byte in[], + const uint8_t in[], unsigned , void * ) { @@ -2209,7 +2209,7 @@ static bool Recv_ServerAddr ( NetAddressGetPort(s_active->addr), &s_active->addr ); - wchar addrStr[64]; + wchar_t addrStr[64]; NetAddressNodeToString( msg.srvAddr, addrStr, @@ -2225,11 +2225,11 @@ static bool Recv_ServerAddr ( //============================================================================ static bool Recv_NotifyNewBuild ( - const byte[], + const uint8_t[], unsigned , void * ) { - NotifyNewBuildTrans * trans = NEW(NotifyNewBuildTrans); + NotifyNewBuildTrans * trans = new NotifyNewBuildTrans; NetTransSend(trans); return true; @@ -2237,7 +2237,7 @@ static bool Recv_NotifyNewBuild ( //============================================================================ static bool Recv_SetPlayerBanStatusReply ( - const byte msg[], + const uint8_t msg[], unsigned bytes, void * ) { @@ -2250,7 +2250,7 @@ static bool Recv_SetPlayerBanStatusReply ( //============================================================================ static bool Recv_ChangePlayerNameReply ( - const byte msg[], + const uint8_t msg[], unsigned bytes, void * ) { @@ -2263,7 +2263,7 @@ static bool Recv_ChangePlayerNameReply ( //============================================================================ static bool Recv_SendFriendInviteReply ( - const byte msg[], + const uint8_t msg[], unsigned bytes, void * ) { @@ -2276,7 +2276,7 @@ static bool Recv_SendFriendInviteReply ( //============================================================================ static bool Recv_ScoreCreateReply ( - const byte msg[], + const uint8_t msg[], unsigned bytes, void * ) { @@ -2289,7 +2289,7 @@ static bool Recv_ScoreCreateReply ( //============================================================================ static bool Recv_ScoreDeleteReply ( - const byte msg[], + const uint8_t msg[], unsigned bytes, void * ) { @@ -2302,7 +2302,7 @@ static bool Recv_ScoreDeleteReply ( //============================================================================ static bool Recv_ScoreGetScoresReply ( - const byte msg[], + const uint8_t msg[], unsigned bytes, void * ) { @@ -2315,7 +2315,7 @@ static bool Recv_ScoreGetScoresReply ( //============================================================================ static bool Recv_ScoreAddPointsReply ( - const byte msg[], + const uint8_t msg[], unsigned bytes, void * ) { @@ -2328,7 +2328,7 @@ static bool Recv_ScoreAddPointsReply ( //============================================================================ static bool Recv_ScoreTransferPointsReply ( - const byte msg[], + const uint8_t msg[], unsigned bytes, void * ) { @@ -2341,7 +2341,7 @@ static bool Recv_ScoreTransferPointsReply ( //============================================================================ static bool Recv_ScoreSetPointsReply ( - const byte msg[], + const uint8_t msg[], unsigned bytes, void * ) { @@ -2354,7 +2354,7 @@ static bool Recv_ScoreSetPointsReply ( //============================================================================ static bool Recv_ScoreGetRanksReply ( - const byte msg[], + const uint8_t msg[], unsigned bytes, void * ) { @@ -2490,7 +2490,7 @@ PingRequestTrans::PingRequestTrans ( , m_param(param) , m_pingAtMs(pingAtMs) { - m_payload.Set((const byte *)payload, payloadBytes); + m_payload.Set((const uint8_t *)payload, payloadBytes); } //============================================================================ @@ -2499,12 +2499,12 @@ bool PingRequestTrans::Send () { if (!AcquireConn()) return false; - const unsigned_ptr msg[] = { + const uintptr_t msg[] = { kCli2Auth_PingRequest, m_pingAtMs, m_transId, m_payload.Count(), - (unsigned_ptr) m_payload.Ptr(), + (uintptr_t) m_payload.Ptr(), }; m_conn->Send(msg, arrsize(msg)); @@ -2527,7 +2527,7 @@ void PingRequestTrans::Post () { //============================================================================ bool PingRequestTrans::Recv ( - const byte msg[], + const uint8_t msg[], unsigned bytes ) { const Auth2Cli_PingReply & reply = *(const Auth2Cli_PingReply *)msg; @@ -2551,7 +2551,7 @@ bool PingRequestTrans::Recv ( AccountExistsRequestTrans::AccountExistsRequestTrans ( FNetCliAuthAccountExistsRequestCallback callback, void * param, - const wchar accountName[] + const wchar_t accountName[] ) : NetAuthTrans(kPingRequestTrans) , m_callback(callback) , m_param(param) @@ -2565,10 +2565,10 @@ bool AccountExistsRequestTrans::Send () { if (!AcquireConn()) return false; - const unsigned_ptr msg[] = { + const uintptr_t msg[] = { kCli2Auth_AccountExistsRequest, m_transId, - (unsigned_ptr)m_accountName + (uintptr_t)m_accountName }; m_conn->Send(msg, arrsize(msg)); @@ -2588,7 +2588,7 @@ void AccountExistsRequestTrans::Post () { //============================================================================ bool AccountExistsRequestTrans::Recv ( - const byte msg[], + const uint8_t msg[], unsigned bytes ) { const Auth2Cli_AccountExistsReply & reply = *(const Auth2Cli_AccountExistsReply *)msg; @@ -2618,14 +2618,14 @@ LoginRequestTrans::LoginRequestTrans ( , m_accountFlags(0) , m_playerCount(0) { - ZERO(m_players); + memset(&m_players, 0, sizeof(m_players)); } //============================================================================ void LoginRequestTrans::AddPlayer ( unsigned playerInt, - const wchar playerName[], - const wchar avatarShape[], + const wchar_t playerName[], + const wchar_t avatarShape[], unsigned explorer ) { unsigned index = m_playerCount++; @@ -2643,9 +2643,9 @@ bool LoginRequestTrans::Send () { return false; ShaDigest challengeHash; - dword clientChallenge = 0; + uint32_t clientChallenge = 0; - wchar domain[15]; + wchar_t domain[15]; PathSplitEmail(s_accountName, nil, 0, domain, arrsize(domain), nil, 0, nil, 0, 0); if (StrLen(domain) == 0 || StrCmpI(domain, L"gametap") == 0) { @@ -2654,7 +2654,7 @@ bool LoginRequestTrans::Send () { else { CryptCreateRandomSeed( sizeof(clientChallenge), - (byte *) &clientChallenge + (uint8_t *) &clientChallenge ); CryptHashPasswordChallenge( @@ -2665,14 +2665,14 @@ bool LoginRequestTrans::Send () { ); } - const unsigned_ptr msg[] = { + const uintptr_t msg[] = { kCli2Auth_AcctLoginRequest, m_transId, clientChallenge, - (unsigned_ptr) s_accountName, - (unsigned_ptr) &challengeHash, - (unsigned_ptr) s_authToken, - (unsigned_ptr) s_os, + (uintptr_t) s_accountName, + (uintptr_t) &challengeHash, + (uintptr_t) s_authToken, + (uintptr_t) s_os, }; m_conn->Send(msg, arrsize(msg)); @@ -2695,10 +2695,10 @@ void LoginRequestTrans::Post () { //============================================================================ bool LoginRequestTrans::Recv ( - const byte msg[], + const uint8_t msg[], unsigned bytes ) { - dword msgId = (dword)*msg; + uint32_t msgId = (uint32_t)*msg; switch (msgId) { case kAuth2Cli_AcctPlayerInfo: { const Auth2Cli_AcctPlayerInfo & reply = *(const Auth2Cli_AcctPlayerInfo *) msg; @@ -2715,8 +2715,8 @@ bool LoginRequestTrans::Recv ( m_billingType = reply.billingType; unsigned memSize = min(arrsize(s_encryptionKey), arrsize(reply.encryptionKey)); - memSize *= sizeof(UInt32); - MemCopy(s_encryptionKey, reply.encryptionKey, memSize); + memSize *= sizeof(uint32_t); + memcpy(s_encryptionKey, reply.encryptionKey, memSize); } break; @@ -2735,7 +2735,7 @@ bool LoginRequestTrans::Recv ( //============================================================================ AgeRequestTrans::AgeRequestTrans ( - const wchar ageName[], + const wchar_t ageName[], const Uuid & ageInstId, FNetCliAuthAgeRequestCallback callback, void * param @@ -2756,11 +2756,11 @@ bool AgeRequestTrans::Send () { if (!AcquireConn()) return true; - const unsigned_ptr msg[] = { + const uintptr_t msg[] = { kCli2Auth_AgeRequest, m_transId, - (unsigned_ptr) m_ageName, - (unsigned_ptr) &m_ageInstId, + (uintptr_t) m_ageName, + (uintptr_t) &m_ageInstId, }; m_conn->Send(msg, arrsize(msg)); @@ -2782,7 +2782,7 @@ void AgeRequestTrans::Post () { //============================================================================ bool AgeRequestTrans::Recv ( - const byte msg[], + const uint8_t msg[], unsigned bytes ) { const Auth2Cli_AgeReply & reply = *(const Auth2Cli_AgeReply *) msg; @@ -2803,8 +2803,8 @@ bool AgeRequestTrans::Recv ( //============================================================================ AccountCreateRequestTrans::AccountCreateRequestTrans ( - const wchar accountName[], - const wchar password[], + const wchar_t accountName[], + const wchar_t password[], unsigned accountFlags, unsigned billingType, FNetCliAuthAccountCreateRequestCallback callback, @@ -2829,11 +2829,11 @@ bool AccountCreateRequestTrans::Send () { if (!AcquireConn()) return false; - const unsigned_ptr msg[] = { + const uintptr_t msg[] = { kCli2Auth_AcctCreateRequest, m_transId, - (unsigned_ptr) m_accountName, - (unsigned_ptr) &m_namePassHash, + (uintptr_t) m_accountName, + (uintptr_t) &m_namePassHash, m_accountFlags, m_billingType, }; @@ -2854,7 +2854,7 @@ void AccountCreateRequestTrans::Post () { //============================================================================ bool AccountCreateRequestTrans::Recv ( - const byte msg[], + const uint8_t msg[], unsigned bytes ) { const Auth2Cli_AcctCreateReply & reply = *(const Auth2Cli_AcctCreateReply *) msg; @@ -2873,8 +2873,8 @@ bool AccountCreateRequestTrans::Recv ( //============================================================================ AccountCreateFromKeyRequestTrans::AccountCreateFromKeyRequestTrans ( - const wchar accountName[], - const wchar password[], + const wchar_t accountName[], + const wchar_t password[], const Uuid & key, unsigned billingType, FNetCliAuthAccountCreateFromKeyRequestCallback callback, @@ -2899,12 +2899,12 @@ bool AccountCreateFromKeyRequestTrans::Send () { if (!AcquireConn()) return false; - const unsigned_ptr msg[] = { + const uintptr_t msg[] = { kCli2Auth_AcctCreateFromKeyRequest, m_transId, - (unsigned_ptr) m_accountName, - (unsigned_ptr) &m_namePassHash, - (unsigned_ptr) &m_key, + (uintptr_t) m_accountName, + (uintptr_t) &m_namePassHash, + (uintptr_t) &m_key, m_billingType, }; @@ -2925,7 +2925,7 @@ void AccountCreateFromKeyRequestTrans::Post () { //============================================================================ bool AccountCreateFromKeyRequestTrans::Recv ( - const byte msg[], + const uint8_t msg[], unsigned bytes ) { const Auth2Cli_AcctCreateFromKeyReply & reply = *(const Auth2Cli_AcctCreateFromKeyReply *) msg; @@ -2945,9 +2945,9 @@ bool AccountCreateFromKeyRequestTrans::Recv ( //============================================================================ PlayerCreateRequestTrans::PlayerCreateRequestTrans ( - const wchar playerName[], - const wchar avatarShape[], - const wchar friendInvite[], + const wchar_t playerName[], + const wchar_t avatarShape[], + const wchar_t friendInvite[], FNetCliAuthPlayerCreateRequestCallback callback, void * param ) : NetAuthTrans(kPlayerCreateRequestTrans) @@ -2960,7 +2960,7 @@ PlayerCreateRequestTrans::PlayerCreateRequestTrans ( StrCopy(m_friendInvite, friendInvite, arrsize(m_friendInvite)); else m_friendInvite[0] = 0; - ZERO(m_playerInfo); + memset(&m_playerInfo, 0, sizeof(m_playerInfo)); } //============================================================================ @@ -2968,12 +2968,12 @@ bool PlayerCreateRequestTrans::Send () { if (!AcquireConn()) return false; - const unsigned_ptr msg[] = { + const uintptr_t msg[] = { kCli2Auth_PlayerCreateRequest, m_transId, - (unsigned_ptr) m_playerName, - (unsigned_ptr) m_avatarShape, - (unsigned_ptr) m_friendInvite, + (uintptr_t) m_playerName, + (uintptr_t) m_avatarShape, + (uintptr_t) m_friendInvite, }; m_conn->Send(msg, arrsize(msg)); @@ -2992,7 +2992,7 @@ void PlayerCreateRequestTrans::Post () { //============================================================================ bool PlayerCreateRequestTrans::Recv ( - const byte msg[], + const uint8_t msg[], unsigned bytes ) { const Auth2Cli_PlayerCreateReply & reply = *(const Auth2Cli_PlayerCreateReply *) msg; @@ -3031,7 +3031,7 @@ bool PlayerDeleteRequestTrans::Send () { if (!AcquireConn()) return false; - const unsigned_ptr msg[] = { + const uintptr_t msg[] = { kCli2Auth_PlayerDeleteRequest, m_transId, m_playerId @@ -3052,7 +3052,7 @@ void PlayerDeleteRequestTrans::Post () { //============================================================================ bool PlayerDeleteRequestTrans::Recv ( - const byte msg[], + const uint8_t msg[], unsigned ) { const Auth2Cli_PlayerDeleteReply & reply = *(const Auth2Cli_PlayerDeleteReply *) msg; @@ -3085,7 +3085,7 @@ bool UpgradeVisitorRequestTrans::Send () { if (!AcquireConn()) return false; - const unsigned_ptr msg[] = { + const uintptr_t msg[] = { kCli2Auth_UpgradeVisitorRequest, m_transId, m_playerId @@ -3106,7 +3106,7 @@ void UpgradeVisitorRequestTrans::Post () { //============================================================================ bool UpgradeVisitorRequestTrans::Recv ( - const byte msg[], + const uint8_t msg[], unsigned ) { const Auth2Cli_UpgradeVisitorReply & reply = *(const Auth2Cli_UpgradeVisitorReply *) msg; @@ -3140,7 +3140,7 @@ bool SetPlayerRequestTrans::Send () { if (!AcquireConn()) return false; - const unsigned_ptr msg[] = { + const uintptr_t msg[] = { kCli2Auth_AcctSetPlayerRequest, m_transId, m_playerInt, @@ -3158,7 +3158,7 @@ void SetPlayerRequestTrans::Post () { //============================================================================ bool SetPlayerRequestTrans::Recv ( - const byte msg[], + const uint8_t msg[], unsigned bytes ) { const Auth2Cli_AcctSetPlayerReply & reply = *(const Auth2Cli_AcctSetPlayerReply *) msg; @@ -3175,8 +3175,8 @@ bool SetPlayerRequestTrans::Recv ( //============================================================================ AccountChangePasswordRequestTrans::AccountChangePasswordRequestTrans ( - const wchar accountName[], - const wchar password[], + const wchar_t accountName[], + const wchar_t password[], FNetCliAuthAccountChangePasswordRequestCallback callback, void * param ) : NetAuthTrans(kAccountChangePasswordRequestTrans) @@ -3197,11 +3197,11 @@ bool AccountChangePasswordRequestTrans::Send () { if (!AcquireConn()) return false; - const unsigned_ptr msg[] = { + const uintptr_t msg[] = { kCli2Auth_AcctChangePasswordRequest, m_transId, - (unsigned_ptr) m_accountName, - (unsigned_ptr) &m_namePassHash, + (uintptr_t) m_accountName, + (uintptr_t) &m_namePassHash, }; m_conn->Send(msg, arrsize(msg)); @@ -3219,7 +3219,7 @@ void AccountChangePasswordRequestTrans::Post () { //============================================================================ bool AccountChangePasswordRequestTrans::Recv ( - const byte msg[], + const uint8_t msg[], unsigned bytes ) { const Auth2Cli_AcctChangePasswordReply & reply = *(const Auth2Cli_AcctChangePasswordReply *) msg; @@ -3237,7 +3237,7 @@ bool AccountChangePasswordRequestTrans::Recv ( //============================================================================ GetPublicAgeListTrans::GetPublicAgeListTrans ( - const wchar ageName[], + const wchar_t ageName[], FNetCliAuthGetPublicAgeListCallback callback, void * param ) : NetAuthTrans(kGetPublicAgeListTrans) @@ -3252,10 +3252,10 @@ bool GetPublicAgeListTrans::Send () { if (!AcquireConn()) return false; - const unsigned_ptr msg[] = { + const uintptr_t msg[] = { kCli2Auth_GetPublicAgeList, m_transId, - (unsigned_ptr) &m_ageName, + (uintptr_t) &m_ageName, }; m_conn->Send(msg, arrsize(msg)); @@ -3274,7 +3274,7 @@ void GetPublicAgeListTrans::Post () { //============================================================================ bool GetPublicAgeListTrans::Recv ( - const byte msg[], + const uint8_t msg[], unsigned bytes ) { const Auth2Cli_PublicAgeList & reply = *(const Auth2Cli_PublicAgeList *) msg; @@ -3296,7 +3296,7 @@ bool GetPublicAgeListTrans::Recv ( //============================================================================ AccountSetRolesRequestTrans::AccountSetRolesRequestTrans ( - const wchar accountName[], + const wchar_t accountName[], unsigned accountFlags, FNetCliAuthAccountSetRolesRequestCallback callback, void * param @@ -3313,10 +3313,10 @@ bool AccountSetRolesRequestTrans::Send () { if (!AcquireConn()) return false; - const unsigned_ptr msg[] = { + const uintptr_t msg[] = { kCli2Auth_AcctSetRolesRequest, m_transId, - (unsigned_ptr) m_accountName, + (uintptr_t) m_accountName, m_accountFlags, }; @@ -3335,7 +3335,7 @@ void AccountSetRolesRequestTrans::Post () { //============================================================================ bool AccountSetRolesRequestTrans::Recv ( - const byte msg[], + const uint8_t msg[], unsigned bytes ) { const Auth2Cli_AcctSetRolesReply & reply = *(const Auth2Cli_AcctSetRolesReply *) msg; @@ -3353,7 +3353,7 @@ bool AccountSetRolesRequestTrans::Recv ( //============================================================================ AccountSetBillingTypeRequestTrans::AccountSetBillingTypeRequestTrans ( - const wchar accountName[], + const wchar_t accountName[], unsigned billingType, FNetCliAuthAccountSetBillingTypeRequestCallback callback, void * param @@ -3370,10 +3370,10 @@ bool AccountSetBillingTypeRequestTrans::Send () { if (!AcquireConn()) return false; - const unsigned_ptr msg[] = { + const uintptr_t msg[] = { kCli2Auth_AcctSetBillingTypeRequest, m_transId, - (unsigned_ptr) m_accountName, + (uintptr_t) m_accountName, m_billingType, }; @@ -3392,7 +3392,7 @@ void AccountSetBillingTypeRequestTrans::Post () { //============================================================================ bool AccountSetBillingTypeRequestTrans::Recv ( - const byte msg[], + const uint8_t msg[], unsigned bytes ) { const Auth2Cli_AcctSetBillingTypeReply & reply = *(const Auth2Cli_AcctSetBillingTypeReply *) msg; @@ -3425,10 +3425,10 @@ bool AccountActivateRequestTrans::Send () { if (!AcquireConn()) return false; - const unsigned_ptr msg[] = { + const uintptr_t msg[] = { kCli2Auth_AcctActivateRequest, m_transId, - (unsigned_ptr) &m_activationKey, + (uintptr_t) &m_activationKey, }; m_conn->Send(msg, arrsize(msg)); @@ -3446,7 +3446,7 @@ void AccountActivateRequestTrans::Post () { //============================================================================ bool AccountActivateRequestTrans::Recv ( - const byte msg[], + const uint8_t msg[], unsigned bytes ) { const Auth2Cli_AcctActivateReply & reply = *(const Auth2Cli_AcctActivateReply *) msg; @@ -3466,8 +3466,8 @@ bool AccountActivateRequestTrans::Recv ( FileListRequestTrans::FileListRequestTrans ( FNetCliAuthFileListRequestCallback callback, void * param, - const wchar directory[], - const wchar ext[] + const wchar_t directory[], + const wchar_t ext[] ) : NetAuthTrans(kFileListRequestTrans) , m_callback(callback) , m_param(param) @@ -3481,11 +3481,11 @@ bool FileListRequestTrans::Send () { if (!AcquireConn()) return false; - const unsigned_ptr msg[] = { + const uintptr_t msg[] = { kCli2Auth_FileListRequest, m_transId, - (unsigned_ptr) m_directory, - (unsigned_ptr) m_ext, + (uintptr_t) m_directory, + (uintptr_t) m_ext, }; m_conn->Send(msg, arrsize(msg)); @@ -3500,47 +3500,47 @@ void FileListRequestTrans::Post () { //============================================================================ bool FileListRequestTrans::Recv ( - const byte msg[], + const uint8_t msg[], unsigned bytes ) { const Auth2Cli_FileListReply & reply = *(const Auth2Cli_FileListReply *) msg; - dword wcharCount = reply.wcharCount; - const wchar* curChar = reply.fileData; - // if wcharCount is 2, the data only contains the terminator "\0\0" and we + uint32_t wchar_tCount = reply.wchar_tCount; + const wchar_t* curChar = reply.fileData; + // if wchar_tCount is 2, the data only contains the terminator "\0\0" and we // don't need to convert anything - if (wcharCount == 2) + if (wchar_tCount == 2) m_fileInfoArray.Clear(); else { // fileData format: "filename\0size\0filename\0size\0...\0\0" bool done = false; while (!done) { - if (wcharCount == 0) + if (wchar_tCount == 0) { done = true; break; } // read in the filename - wchar filename[MAX_PATH]; + wchar_t filename[MAX_PATH]; StrCopy(filename, curChar, arrsize(filename)); filename[arrsize(filename) - 1] = L'\0'; // make sure it's terminated unsigned filenameLen = StrLen(filename); curChar += filenameLen; // advance the pointer - wcharCount -= filenameLen; // keep track of the amount remaining - if ((*curChar != L'\0') || (wcharCount <= 0)) + wchar_tCount -= filenameLen; // keep track of the amount remaining + if ((*curChar != L'\0') || (wchar_tCount <= 0)) return false; // something is screwy, abort and disconnect curChar++; // point it at the first part of the size value (format: 0xHHHHLLLL) - wcharCount--; - if (wcharCount < 4) // we have to have 2 chars for the size, and 2 for terminator at least + wchar_tCount--; + if (wchar_tCount < 4) // we have to have 2 chars for the size, and 2 for terminator at least return false; // screwy data unsigned size = ((*curChar) << 16) + (*(curChar + 1)); curChar += 2; - wcharCount -= 2; - if ((*curChar != L'\0') || (wcharCount <= 0)) + wchar_tCount -= 2; + if ((*curChar != L'\0') || (wchar_tCount <= 0)) return false; // screwy data // save the data in our array @@ -3550,15 +3550,15 @@ bool FileListRequestTrans::Recv ( // point it at either the second part of the terminator, or the next filename curChar++; - wcharCount--; + wchar_tCount--; if (*curChar == L'\0') { // we hit the terminator - if (wcharCount != 1) + if (wchar_tCount != 1) return false; // invalid data, we shouldn't have any more done = true; // we're done } - else if (wcharCount < 6) // we must have at least a 1 char string, '\0', size, and "\0\0" terminator left + else if (wchar_tCount < 6) // we must have at least a 1 char string, '\0', size, and "\0\0" terminator left return false; // screwy data } } @@ -3579,7 +3579,7 @@ bool FileListRequestTrans::Recv ( FileDownloadRequestTrans::FileDownloadRequestTrans ( FNetCliAuthFileRequestCallback callback, void * param, - const wchar filename[], + const wchar_t filename[], hsStream * writer ) : NetAuthTrans(kFileDownloadRequestTrans) , m_callback(callback) @@ -3597,10 +3597,10 @@ bool FileDownloadRequestTrans::Send () { if (!AcquireConn()) return false; - const unsigned_ptr msg[] = { + const uintptr_t msg[] = { kCli2Auth_FileDownloadRequest, m_transId, - (unsigned_ptr) m_filename, + (uintptr_t) m_filename, }; m_conn->Send(msg, arrsize(msg)); @@ -3615,7 +3615,7 @@ void FileDownloadRequestTrans::Post () { //============================================================================ bool FileDownloadRequestTrans::Recv ( - const byte msg[], + const uint8_t msg[], unsigned bytes ) { const Auth2Cli_FileDownloadChunk & reply = *(const Auth2Cli_FileDownloadChunk *) msg; @@ -3630,12 +3630,12 @@ bool FileDownloadRequestTrans::Recv ( // we have data to write, so queue it for write in the main thread (we're // currently in a net recv thread) if (reply.chunkSize) { - RcvdFileDownloadChunkTrans * writeTrans = NEW(RcvdFileDownloadChunkTrans); + RcvdFileDownloadChunkTrans * writeTrans = new RcvdFileDownloadChunkTrans; writeTrans->writer = m_writer; writeTrans->bytes = reply.chunkSize; writeTrans->offset = reply.chunkOffset; - writeTrans->data = (byte *)ALLOC(reply.chunkSize); - MemCopy(writeTrans->data, reply.chunkData, reply.chunkSize); + writeTrans->data = (uint8_t *)malloc(reply.chunkSize); + memcpy(writeTrans->data, reply.chunkData, reply.chunkSize); NetTransSend(writeTrans); } @@ -3646,7 +3646,7 @@ bool FileDownloadRequestTrans::Recv ( } // Ack the data - const unsigned_ptr ack[] = { + const uintptr_t ack[] = { kCli2Auth_FileDownloadChunkAck, m_transId }; @@ -3664,7 +3664,7 @@ bool FileDownloadRequestTrans::Recv ( //============================================================================ RcvdFileDownloadChunkTrans::~RcvdFileDownloadChunkTrans () { - FREE(data); + free(data); } //============================================================================ @@ -3687,7 +3687,7 @@ void RcvdFileDownloadChunkTrans::Post () { //============================================================================ RcvdPropagatedBufferTrans::~RcvdPropagatedBufferTrans () { - FREE(bufferData); + free(bufferData); } //============================================================================ @@ -3772,7 +3772,7 @@ bool VaultFetchNodeRefsTrans::Send () { if (!AcquireConn()) return false; - const unsigned_ptr msg[] = { + const uintptr_t msg[] = { kCli2Auth_VaultFetchNodeRefs, m_transId, m_nodeId, @@ -3796,7 +3796,7 @@ void VaultFetchNodeRefsTrans::Post () { //============================================================================ bool VaultFetchNodeRefsTrans::Recv ( - const byte msg[], + const uint8_t msg[], unsigned ) { const Auth2Cli_VaultNodeRefsFetched & reply = *(const Auth2Cli_VaultNodeRefsFetched *) msg; @@ -3823,10 +3823,10 @@ VaultInitAgeTrans::VaultInitAgeTrans ( void * param, // optional const Uuid & ageInstId, // optional. is used in match const Uuid & parentAgeInstId, // optional. is used in match - const wchar ageFilename[], // optional. is used in match - const wchar ageInstName[], // optional. not used in match - const wchar ageUserName[], // optional. not used in match - const wchar ageDesc[], // optional. not used in match + const wchar_t ageFilename[], // optional. is used in match + const wchar_t ageInstName[], // optional. not used in match + const wchar_t ageUserName[], // optional. not used in match + const wchar_t ageDesc[], // optional. not used in match unsigned ageSequenceNumber, // optional. not used in match unsigned ageLanguage // optional. not used in match ) : NetAuthTrans(kVaultInitAgeTrans) @@ -3845,10 +3845,10 @@ VaultInitAgeTrans::VaultInitAgeTrans ( //============================================================================ VaultInitAgeTrans::~VaultInitAgeTrans () { - FREE(m_ageFilename); - FREE(m_ageInstName); - FREE(m_ageUserName); - FREE(m_ageDesc); + free(m_ageFilename); + free(m_ageInstName); + free(m_ageUserName); + free(m_ageDesc); } //============================================================================ @@ -3856,15 +3856,15 @@ bool VaultInitAgeTrans::Send () { if (!AcquireConn()) return false; - const unsigned_ptr msg[] = { + const uintptr_t msg[] = { kCli2Auth_VaultInitAgeRequest, m_transId, - (unsigned_ptr) &m_ageInstId, - (unsigned_ptr) &m_parentAgeInstId, - (unsigned_ptr) m_ageFilename, - (unsigned_ptr) m_ageInstName, - (unsigned_ptr) m_ageUserName, - (unsigned_ptr) m_ageDesc, + (uintptr_t) &m_ageInstId, + (uintptr_t) &m_parentAgeInstId, + (uintptr_t) m_ageFilename, + (uintptr_t) m_ageInstName, + (uintptr_t) m_ageUserName, + (uintptr_t) m_ageDesc, m_ageSequenceNumber, m_ageLanguage, }; @@ -3887,7 +3887,7 @@ void VaultInitAgeTrans::Post () { //============================================================================ bool VaultInitAgeTrans::Recv ( - const byte msg[], + const uint8_t msg[], unsigned ) { const Auth2Cli_VaultInitAgeReply & reply = *(const Auth2Cli_VaultInitAgeReply *) msg; @@ -3925,7 +3925,7 @@ bool VaultFetchNodeTrans::Send () { if (!AcquireConn()) return false; - const unsigned_ptr msg[] = { + const uintptr_t msg[] = { kCli2Auth_VaultNodeFetch, m_transId, m_nodeId, @@ -3949,7 +3949,7 @@ void VaultFetchNodeTrans::Post () { //============================================================================ bool VaultFetchNodeTrans::Recv ( - const byte msg[], + const uint8_t msg[], unsigned bytes ) { const Auth2Cli_VaultNodeFetched & reply = *(const Auth2Cli_VaultNodeFetched *) msg; @@ -3996,16 +3996,16 @@ bool VaultFindNodeTrans::Send () { if (!AcquireConn()) return false; - ARRAY(byte) buffer; + ARRAY(uint8_t) buffer; m_node->critsect.Enter(); m_node->Write_LCS(&buffer, 0); m_node->critsect.Leave(); - const unsigned_ptr msg[] = { + const uintptr_t msg[] = { kCli2Auth_VaultNodeFind, m_transId, buffer.Count(), - (unsigned_ptr) buffer.Ptr(), + (uintptr_t) buffer.Ptr(), }; m_conn->Send(msg, arrsize(msg)); @@ -4025,13 +4025,13 @@ void VaultFindNodeTrans::Post () { //============================================================================ bool VaultFindNodeTrans::Recv ( - const byte msg[], + const uint8_t msg[], unsigned bytes ) { const Auth2Cli_VaultNodeFindReply & reply = *(const Auth2Cli_VaultNodeFindReply *) msg; if (IS_NET_SUCCESS(reply.result)) { - COMPILER_ASSERT(sizeof(unsigned) == sizeof(dword)); + COMPILER_ASSERT(sizeof(unsigned) == sizeof(uint32_t)); m_nodeIds.Set((unsigned *)reply.nodeIds, reply.nodeIdCount); } @@ -4066,14 +4066,14 @@ bool VaultCreateNodeTrans::Send () { if (!AcquireConn()) return false; - ARRAY(byte) buffer; + ARRAY(uint8_t) buffer; m_templateNode->Write_LCS(&buffer, 0); - const unsigned_ptr msg[] = { + const uintptr_t msg[] = { kCli2Auth_VaultNodeCreate, m_transId, buffer.Count(), - (unsigned_ptr) buffer.Ptr() + (uintptr_t) buffer.Ptr() }; m_conn->Send(msg, arrsize(msg)); @@ -4093,7 +4093,7 @@ void VaultCreateNodeTrans::Post () { //============================================================================ bool VaultCreateNodeTrans::Recv ( - const byte msg[], + const uint8_t msg[], unsigned bytes ) { const Auth2Cli_VaultNodeCreated & reply = *(const Auth2Cli_VaultNodeCreated *) msg; @@ -4127,7 +4127,7 @@ VaultSaveNodeTrans::VaultSaveNodeTrans ( , m_callback(callback) , m_param(param) { - m_buffer.Set((const byte *)data, dataCount); + m_buffer.Set((const uint8_t *)data, dataCount); } //============================================================================ @@ -4135,13 +4135,13 @@ bool VaultSaveNodeTrans::Send () { if (!AcquireConn()) return false; - const unsigned_ptr msg[] = { + const uintptr_t msg[] = { kCli2Auth_VaultNodeSave, m_transId, m_nodeId, - (unsigned_ptr) &m_revisionId, + (uintptr_t) &m_revisionId, m_buffer.Count(), - (unsigned_ptr) m_buffer.Ptr(), + (uintptr_t) m_buffer.Ptr(), }; m_conn->Send(msg, arrsize(msg)); @@ -4161,7 +4161,7 @@ void VaultSaveNodeTrans::Post () { //============================================================================ bool VaultSaveNodeTrans::Recv ( - const byte msg[], + const uint8_t msg[], unsigned bytes ) { const Auth2Cli_VaultSaveNodeReply & reply = *(const Auth2Cli_VaultSaveNodeReply *) msg; @@ -4199,7 +4199,7 @@ bool VaultAddNodeTrans::Send () { if (!AcquireConn()) return false; - const unsigned_ptr msg[] = { + const uintptr_t msg[] = { kCli2Auth_VaultNodeAdd, m_transId, m_parentId, @@ -4224,7 +4224,7 @@ void VaultAddNodeTrans::Post () { //============================================================================ bool VaultAddNodeTrans::Recv ( - const byte msg[], + const uint8_t msg[], unsigned bytes ) { const Auth2Cli_VaultAddNodeReply & reply = *(const Auth2Cli_VaultAddNodeReply *) msg; @@ -4260,7 +4260,7 @@ bool VaultRemoveNodeTrans::Send () { if (!AcquireConn()) return false; - const unsigned_ptr msg[] = { + const uintptr_t msg[] = { kCli2Auth_VaultNodeRemove, m_transId, m_parentId, @@ -4284,7 +4284,7 @@ void VaultRemoveNodeTrans::Post () { //============================================================================ bool VaultRemoveNodeTrans::Recv ( - const byte msg[], + const uint8_t msg[], unsigned bytes ) { const Auth2Cli_VaultRemoveNodeReply & reply = *(const Auth2Cli_VaultRemoveNodeReply *) msg; @@ -4333,7 +4333,7 @@ bool SetPlayerBanStatusRequestTrans::Send () { if (!AcquireConn()) return false; - const unsigned_ptr msg[] = { + const uintptr_t msg[] = { kCli2Auth_SetPlayerBanStatusRequest, m_transId, m_playerId, @@ -4355,7 +4355,7 @@ void SetPlayerBanStatusRequestTrans::Post () { //============================================================================ bool SetPlayerBanStatusRequestTrans::Recv ( - const byte msg[], + const uint8_t msg[], unsigned bytes ) { const Auth2Cli_SetPlayerBanStatusReply & reply = *(const Auth2Cli_SetPlayerBanStatusReply *) msg; @@ -4374,7 +4374,7 @@ bool SetPlayerBanStatusRequestTrans::Recv ( //============================================================================ ChangePlayerNameRequestTrans::ChangePlayerNameRequestTrans ( unsigned playerId, - const wchar newName[], + const wchar_t newName[], FNetCliAuthChangePlayerNameRequestCallback callback, void * param ) : NetAuthTrans(kChangePlayerNameRequestTrans) @@ -4390,11 +4390,11 @@ bool ChangePlayerNameRequestTrans::Send () { if (!AcquireConn()) return false; - const unsigned_ptr msg[] = { + const uintptr_t msg[] = { kCli2Auth_ChangePlayerNameRequest, m_transId, m_playerId, - (unsigned_ptr) m_newName, + (uintptr_t) m_newName, }; m_conn->Send(msg, arrsize(msg)); @@ -4412,7 +4412,7 @@ void ChangePlayerNameRequestTrans::Post () { //============================================================================ bool ChangePlayerNameRequestTrans::Recv ( - const byte msg[], + const uint8_t msg[], unsigned bytes ) { const Auth2Cli_ChangePlayerNameReply & reply = *(const Auth2Cli_ChangePlayerNameReply *) msg; @@ -4431,8 +4431,8 @@ bool ChangePlayerNameRequestTrans::Recv ( //============================================================================ SendFriendInviteTrans::SendFriendInviteTrans ( - const wchar emailAddr[], - const wchar toName[], + const wchar_t emailAddr[], + const wchar_t toName[], const Uuid & inviteUuid, FNetCliAuthSendFriendInviteCallback callback, void * param @@ -4450,12 +4450,12 @@ bool SendFriendInviteTrans::Send () { if (!AcquireConn()) return false; - const unsigned_ptr msg[] = { + const uintptr_t msg[] = { kCli2Auth_SendFriendInviteRequest, m_transId, - (unsigned_ptr) &m_inviteUuid, - (unsigned_ptr) m_emailAddress, - (unsigned_ptr) m_toName, + (uintptr_t) &m_inviteUuid, + (uintptr_t) m_emailAddress, + (uintptr_t) m_toName, }; m_conn->Send(msg, arrsize(msg)); @@ -4473,7 +4473,7 @@ void SendFriendInviteTrans::Post () { //============================================================================ bool SendFriendInviteTrans::Recv ( - const byte msg[], + const uint8_t msg[], unsigned bytes ) { const Auth2Cli_SendFriendInviteReply & reply = *(const Auth2Cli_SendFriendInviteReply *) msg; @@ -4528,14 +4528,14 @@ bool ScoreCreateTrans::Send () { if (!AcquireConn()) return false; - wchar wgameName[kMaxGameScoreNameLength]; + wchar_t wgameName[kMaxGameScoreNameLength]; StrToUnicode(wgameName, m_gameName, arrsize(wgameName)); - const unsigned_ptr msg[] = { + const uintptr_t msg[] = { kCli2Auth_ScoreCreate, m_transId, m_ownerId, - (unsigned_ptr) wgameName, + (uintptr_t) wgameName, m_gameType, m_value }; @@ -4563,7 +4563,7 @@ void ScoreCreateTrans::Post () { //============================================================================ bool ScoreCreateTrans::Recv ( - const byte msg[], + const uint8_t msg[], unsigned bytes ) { const Auth2Cli_ScoreCreateReply & reply = *(const Auth2Cli_ScoreCreateReply *) msg; @@ -4599,7 +4599,7 @@ bool ScoreDeleteTrans::Send () { if (!AcquireConn()) return false; - const unsigned_ptr msg[] = { + const uintptr_t msg[] = { kCli2Auth_ScoreDelete, m_transId, m_scoreId, @@ -4622,7 +4622,7 @@ void ScoreDeleteTrans::Post () { //============================================================================ bool ScoreDeleteTrans::Recv ( - const byte msg[], + const uint8_t msg[], unsigned bytes ) { const Auth2Cli_ScoreDeleteReply & reply = *(const Auth2Cli_ScoreDeleteReply *) msg; @@ -4659,14 +4659,14 @@ bool ScoreGetScoresTrans::Send () { if (!AcquireConn()) return false; - wchar wgameName[kMaxGameScoreNameLength]; + wchar_t wgameName[kMaxGameScoreNameLength]; StrToUnicode(wgameName, m_gameName, arrsize(wgameName)); - const unsigned_ptr msg[] = { + const uintptr_t msg[] = { kCli2Auth_ScoreGetScores, m_transId, m_ownerId, - (unsigned_ptr) wgameName + (uintptr_t) wgameName }; m_conn->Send(msg, arrsize(msg)); @@ -4688,16 +4688,16 @@ void ScoreGetScoresTrans::Post () { //============================================================================ bool ScoreGetScoresTrans::Recv ( - const byte msg[], + const uint8_t msg[], unsigned bytes ) { const Auth2Cli_ScoreGetScoresReply & reply = *(const Auth2Cli_ScoreGetScoresReply *) msg; if (reply.scoreCount > 0) { m_scoreCount = reply.scoreCount; - m_scores = TRACKED_NEW NetGameScore[m_scoreCount]; + m_scores = new NetGameScore[m_scoreCount]; - byte* bufferPos = const_cast(reply.buffer); + uint8_t* bufferPos = const_cast(reply.buffer); unsigned bufferLength = reply.byteCount; for (unsigned i = 0; i < m_scoreCount; ++i) { @@ -4739,7 +4739,7 @@ bool ScoreAddPointsTrans::Send () { if (!AcquireConn()) return false; - const unsigned_ptr msg[] = { + const uintptr_t msg[] = { kCli2Auth_ScoreAddPoints, m_transId, m_scoreId, @@ -4763,7 +4763,7 @@ void ScoreAddPointsTrans::Post () { //============================================================================ bool ScoreAddPointsTrans::Recv ( - const byte msg[], + const uint8_t msg[], unsigned bytes ) { const Auth2Cli_ScoreAddPointsReply & reply = *(const Auth2Cli_ScoreAddPointsReply *) msg; @@ -4800,7 +4800,7 @@ bool ScoreTransferPointsTrans::Send () { if (!AcquireConn()) return false; - const unsigned_ptr msg[] = { + const uintptr_t msg[] = { kCli2Auth_ScoreTransferPoints, m_transId, m_srcScoreId, @@ -4825,7 +4825,7 @@ void ScoreTransferPointsTrans::Post () { //============================================================================ bool ScoreTransferPointsTrans::Recv ( - const byte msg[], + const uint8_t msg[], unsigned bytes ) { const Auth2Cli_ScoreTransferPointsReply & reply = *(const Auth2Cli_ScoreTransferPointsReply *) msg; @@ -4860,7 +4860,7 @@ bool ScoreSetPointsTrans::Send () { if (!AcquireConn()) return false; - const unsigned_ptr msg[] = { + const uintptr_t msg[] = { kCli2Auth_ScoreSetPoints, m_transId, m_scoreId, @@ -4884,7 +4884,7 @@ void ScoreSetPointsTrans::Post () { //============================================================================ bool ScoreSetPointsTrans::Recv ( - const byte msg[], + const uint8_t msg[], unsigned bytes ) { const Auth2Cli_ScoreSetPointsReply & reply = *(const Auth2Cli_ScoreSetPointsReply *) msg; @@ -4932,13 +4932,13 @@ bool ScoreGetRanksTrans::Send () { if (!AcquireConn()) return false; - const unsigned_ptr msg[] = { + const uintptr_t msg[] = { kCli2Auth_ScoreGetRanks, m_transId, m_ownerId, m_scoreGroup, m_parentFolderId, - (unsigned_ptr) m_gameName, + (uintptr_t) m_gameName, m_timePeriod, m_numResults, m_pageNumber, @@ -4964,16 +4964,16 @@ void ScoreGetRanksTrans::Post () { //============================================================================ bool ScoreGetRanksTrans::Recv ( - const byte msg[], + const uint8_t msg[], unsigned bytes ) { const Auth2Cli_ScoreGetRanksReply & reply = *(const Auth2Cli_ScoreGetRanksReply *) msg; if (reply.rankCount > 0) { m_rankCount = reply.rankCount; - m_ranks = TRACKED_NEW NetGameRank[m_rankCount]; + m_ranks = new NetGameRank[m_rankCount]; - byte* bufferPos = const_cast(reply.buffer); + uint8_t* bufferPos = const_cast(reply.buffer); unsigned bufferLength = reply.byteCount; for (unsigned i = 0; i < m_rankCount; ++i) { @@ -5135,7 +5135,7 @@ void AuthPingEnable (bool enable) { //============================================================================ void NetCliAuthStartConnect ( - const wchar * authAddrList[], + const wchar_t * authAddrList[], unsigned authAddrCount ) { // TEMP: Only connect to one auth server until we fill out this module @@ -5144,7 +5144,7 @@ void NetCliAuthStartConnect ( for (unsigned i = 0; i < authAddrCount; ++i) { // Do we need to lookup the address? - const wchar * name = authAddrList[i]; + const wchar_t * name = authAddrList[i]; while (unsigned ch = *name) { ++name; if (!(isdigit(ch) || ch == L'.' || ch == L':')) { @@ -5216,7 +5216,7 @@ void NetCliAuthPingRequest ( FNetCliAuthPingRequestCallback callback, void * param ) { - PingRequestTrans * trans = NEW(PingRequestTrans)( + PingRequestTrans * trans = new PingRequestTrans( callback, param, pingTimeMs, @@ -5228,11 +5228,11 @@ void NetCliAuthPingRequest ( //============================================================================ void NetCliAuthAccountExistsRequest ( - const wchar accountName[], + const wchar_t accountName[], FNetCliAuthAccountExistsRequestCallback callback, void * param ) { - AccountExistsRequestTrans * trans = NEW(AccountExistsRequestTrans)( + AccountExistsRequestTrans * trans = new AccountExistsRequestTrans( callback, param, accountName @@ -5242,10 +5242,10 @@ void NetCliAuthAccountExistsRequest ( //============================================================================ void NetCliAuthLoginRequest ( - const wchar accountName[], + const wchar_t accountName[], const ShaDigest * accountNamePassHash, - const wchar authToken[], - const wchar os[], + const wchar_t authToken[], + const wchar_t os[], FNetCliAuthLoginRequestCallback callback, void * param ) { @@ -5259,18 +5259,18 @@ void NetCliAuthLoginRequest ( if (os) StrCopy(s_os, os, arrsize(s_os)); - LoginRequestTrans * trans = NEW(LoginRequestTrans)(callback, param); + LoginRequestTrans * trans = new LoginRequestTrans(callback, param); NetTransSend(trans); } //============================================================================ void NetCliAuthAgeRequest ( - const wchar ageName[], + const wchar_t ageName[], const Uuid & ageInstId, FNetCliAuthAgeRequestCallback callback, void * param ) { - AgeRequestTrans * trans = NEW(AgeRequestTrans)( + AgeRequestTrans * trans = new AgeRequestTrans( ageName, ageInstId, callback, @@ -5281,24 +5281,24 @@ void NetCliAuthAgeRequest ( //============================================================================ void NetCliAuthGetEncryptionKey ( - UInt32 key[], + uint32_t key[], unsigned size ) { unsigned memSize = min(arrsize(s_encryptionKey), size); - memSize *= sizeof(UInt32); - MemCopy(key, s_encryptionKey, memSize); + memSize *= sizeof(uint32_t); + memcpy(key, s_encryptionKey, memSize); } //============================================================================ void NetCliAuthAccountCreateRequest ( - const wchar accountName[], - const wchar password[], + const wchar_t accountName[], + const wchar_t password[], unsigned accountFlags, unsigned billingType, FNetCliAuthAccountCreateRequestCallback callback, void * param ) { - AccountCreateRequestTrans * trans = NEW(AccountCreateRequestTrans)( + AccountCreateRequestTrans * trans = new AccountCreateRequestTrans( accountName, password, accountFlags, @@ -5311,14 +5311,14 @@ void NetCliAuthAccountCreateRequest ( //============================================================================ void NetCliAuthAccountCreateFromKeyRequest ( - const wchar accountName[], - const wchar password[], + const wchar_t accountName[], + const wchar_t password[], Uuid key, unsigned billingType, FNetCliAuthAccountCreateFromKeyRequestCallback callback, void * param ) { - AccountCreateFromKeyRequestTrans * trans = NEW(AccountCreateFromKeyRequestTrans)( + AccountCreateFromKeyRequestTrans * trans = new AccountCreateFromKeyRequestTrans( accountName, password, key, @@ -5331,13 +5331,13 @@ void NetCliAuthAccountCreateFromKeyRequest ( //============================================================================ void NetCliAuthPlayerCreateRequest ( - const wchar playerName[], - const wchar avatarShape[], - const wchar friendInvite[], + const wchar_t playerName[], + const wchar_t avatarShape[], + const wchar_t friendInvite[], FNetCliAuthPlayerCreateRequestCallback callback, void * param ) { - wchar name[kMaxPlayerNameLength]; + wchar_t name[kMaxPlayerNameLength]; StrCopy(name, playerName, arrsize(name)); ENetError error = FixupPlayerName(name); if (IS_NET_ERROR(error)) { @@ -5345,7 +5345,7 @@ void NetCliAuthPlayerCreateRequest ( callback(error, param, playerInfo); } else { - PlayerCreateRequestTrans * trans = NEW(PlayerCreateRequestTrans)( + PlayerCreateRequestTrans * trans = new PlayerCreateRequestTrans( name, avatarShape, friendInvite, @@ -5362,7 +5362,7 @@ void NetCliAuthPlayerDeleteRequest ( FNetCliAuthPlayerDeleteRequestCallback callback, void * param ) { - PlayerDeleteRequestTrans * trans = NEW(PlayerDeleteRequestTrans)( + PlayerDeleteRequestTrans * trans = new PlayerDeleteRequestTrans( playerId, callback, param @@ -5376,7 +5376,7 @@ void NetCliAuthUpgradeVisitorRequest ( FNetCliAuthUpgradeVisitorRequestCallback callback, void * param ) { - UpgradeVisitorRequestTrans * trans = NEW(UpgradeVisitorRequestTrans)( + UpgradeVisitorRequestTrans * trans = new UpgradeVisitorRequestTrans( playerId, callback, param @@ -5392,7 +5392,7 @@ void NetCliAuthSetCCRLevel ( if (!conn) return; - const unsigned_ptr msg[] = { + const uintptr_t msg[] = { kCli2Auth_ClientSetCCRLevel, ccrLevel, }; @@ -5407,7 +5407,7 @@ void NetCliAuthSetPlayerRequest ( FNetCliAuthSetPlayerRequestCallback callback, void * param ) { - SetPlayerRequestTrans * trans = NEW(SetPlayerRequestTrans)( + SetPlayerRequestTrans * trans = new SetPlayerRequestTrans( playerInt, callback, param @@ -5424,7 +5424,7 @@ void NetCliAuthSetAgePublic ( if (!conn) return; - const unsigned_ptr msg[] = { + const uintptr_t msg[] = { kCli2Auth_SetAgePublic, ageInfoId, publicOrNot, @@ -5437,11 +5437,11 @@ void NetCliAuthSetAgePublic ( //============================================================================ void NetCliAuthGetPublicAgeList ( - const wchar ageName[], + const wchar_t ageName[], FNetCliAuthGetPublicAgeListCallback callback, void * param ) { - GetPublicAgeListTrans * trans = NEW(GetPublicAgeListTrans)( + GetPublicAgeListTrans * trans = new GetPublicAgeListTrans( ageName, callback, param @@ -5451,12 +5451,12 @@ void NetCliAuthGetPublicAgeList ( //============================================================================ void NetCliAuthAccountChangePasswordRequest ( - const wchar accountName[], - const wchar password[], + const wchar_t accountName[], + const wchar_t password[], FNetCliAuthAccountChangePasswordRequestCallback callback, void * param ) { - AccountChangePasswordRequestTrans * trans = NEW(AccountChangePasswordRequestTrans)( + AccountChangePasswordRequestTrans * trans = new AccountChangePasswordRequestTrans( accountName, password, callback, @@ -5467,12 +5467,12 @@ void NetCliAuthAccountChangePasswordRequest ( //============================================================================ void NetCliAuthAccountSetRolesRequest ( - const wchar accountName[], + const wchar_t accountName[], unsigned accountFlags, FNetCliAuthAccountSetRolesRequestCallback callback, void * param ) { - AccountSetRolesRequestTrans * trans = NEW(AccountSetRolesRequestTrans)( + AccountSetRolesRequestTrans * trans = new AccountSetRolesRequestTrans( accountName, accountFlags, callback, @@ -5483,12 +5483,12 @@ void NetCliAuthAccountSetRolesRequest ( //============================================================================ void NetCliAuthAccountSetBillingTypeRequest ( - const wchar accountName[], + const wchar_t accountName[], unsigned billingType, FNetCliAuthAccountSetBillingTypeRequestCallback callback, void * param ) { - AccountSetBillingTypeRequestTrans * trans = NEW(AccountSetBillingTypeRequestTrans)( + AccountSetBillingTypeRequestTrans * trans = new AccountSetBillingTypeRequestTrans( accountName, billingType, callback, @@ -5503,7 +5503,7 @@ void NetCliAuthAccountActivateRequest ( FNetCliAuthAccountActivateRequestCallback callback, void * param ) { - AccountActivateRequestTrans * trans = NEW(AccountActivateRequestTrans)( + AccountActivateRequestTrans * trans = new AccountActivateRequestTrans( activationKey, callback, param @@ -5513,12 +5513,12 @@ void NetCliAuthAccountActivateRequest ( //============================================================================ void NetCliAuthFileListRequest ( - const wchar dir[], - const wchar ext[], + const wchar_t dir[], + const wchar_t ext[], FNetCliAuthFileListRequestCallback callback, void * param ) { - FileListRequestTrans * trans = NEW(FileListRequestTrans)( + FileListRequestTrans * trans = new FileListRequestTrans( callback, param, dir, @@ -5529,12 +5529,12 @@ void NetCliAuthFileListRequest ( //============================================================================ void NetCliAuthFileRequest ( - const wchar filename[], + const wchar_t filename[], hsStream * writer, FNetCliAuthFileRequestCallback callback, void * param ) { - FileDownloadRequestTrans * trans = NEW(FileDownloadRequestTrans)( + FileDownloadRequestTrans * trans = new FileDownloadRequestTrans( callback, param, filename, @@ -5643,7 +5643,7 @@ unsigned NetCliAuthVaultNodeSave ( // We're definitely saving this node, so assign a revisionId node->revisionId = GuidGenerate(); - ARRAY(byte) buffer; + ARRAY(uint8_t) buffer; unsigned bytes = node->Write_LCS(&buffer, NetVaultNode::kRwDirtyOnly | NetVaultNode::kRwUpdateDirty); VaultSaveNodeTrans * trans = NEWZERO(VaultSaveNodeTrans)( @@ -5723,7 +5723,7 @@ void NetCliAuthVaultSetSeen ( if (!conn) return; - const unsigned_ptr msg[] = { + const uintptr_t msg[] = { kCli2Auth_VaultSetSeen, parentId, childId, @@ -5744,7 +5744,7 @@ void NetCliAuthVaultSendNode ( if (!conn) return; - const unsigned_ptr msg[] = { + const uintptr_t msg[] = { kCli2Auth_VaultSendNode, srcNodeId, dstPlayerId, @@ -5759,10 +5759,10 @@ void NetCliAuthVaultSendNode ( void NetCliAuthVaultInitAge ( const Uuid & ageInstId, // optional. is used in match const Uuid & parentAgeInstId, // optional. is used in match - const wchar ageFilename[], // optional. is used in match - const wchar ageInstName[], // optional. not used in match - const wchar ageUserName[], // optional. not used in match - const wchar ageDesc[], // optional. not used in match + const wchar_t ageFilename[], // optional. is used in match + const wchar_t ageInstName[], // optional. not used in match + const wchar_t ageUserName[], // optional. not used in match + const wchar_t ageDesc[], // optional. not used in match unsigned ageSequenceNumber, // optional. not used in match unsigned ageLanguage, // optional. not used in match FNetCliAuthAgeInitCallback callback, // optional @@ -5792,7 +5792,7 @@ void NetCliAuthSetRecvBufferHandler ( //============================================================================ void NetCliAuthSendCCRPetition ( - const wchar * petitionText + const wchar_t * petitionText ) { hsAssert(false, "eric, implement me."); } @@ -5801,17 +5801,17 @@ void NetCliAuthSendCCRPetition ( void NetCliAuthPropagateBuffer ( unsigned type, unsigned bytes, - const byte buffer[] + const uint8_t buffer[] ) { CliAuConn * conn = GetConnIncRef("PropBuffer"); if (!conn) return; - const unsigned_ptr msg[] = { + const uintptr_t msg[] = { kCli2Auth_PropagateBuffer, type, bytes, - (unsigned_ptr) buffer, + (uintptr_t) buffer, }; conn->Send(msg, arrsize(msg)); @@ -5821,14 +5821,14 @@ void NetCliAuthPropagateBuffer ( } //============================================================================ -void NetCliAuthLogPythonTraceback (const wchar traceback[]) { +void NetCliAuthLogPythonTraceback (const wchar_t traceback[]) { CliAuConn * conn = GetConnIncRef("LogTraceback"); if (!conn) return; - const unsigned_ptr msg[] = { + const uintptr_t msg[] = { kCli2Auth_LogPythonTraceback, - (unsigned_ptr) traceback + (uintptr_t) traceback }; conn->Send(msg, arrsize(msg)); @@ -5838,14 +5838,14 @@ void NetCliAuthLogPythonTraceback (const wchar traceback[]) { //============================================================================ -void NetCliAuthLogStackDump (const wchar stackdump[]) { +void NetCliAuthLogStackDump (const wchar_t stackdump[]) { CliAuConn * conn = GetConnIncRef("LogStackDump"); if (!conn) return; - const unsigned_ptr msg[] = { + const uintptr_t msg[] = { kCli2Auth_LogStackDump, - (unsigned_ptr) stackdump + (uintptr_t) stackdump }; conn->Send(msg, arrsize(msg)); @@ -5861,7 +5861,7 @@ void NetCliAuthLogClientDebuggerConnect () { unsigned nothing = 0; - const unsigned_ptr msg[] = { + const uintptr_t msg[] = { kCli2Auth_LogClientDebuggerConnect, nothing }; @@ -5884,7 +5884,7 @@ void NetCliAuthSetPlayerBanStatusRequest ( FNetCliAuthSetPlayerBanStatusRequestCallback callback, void * param ) { - SetPlayerBanStatusRequestTrans * trans = NEW(SetPlayerBanStatusRequestTrans)( + SetPlayerBanStatusRequestTrans * trans = new SetPlayerBanStatusRequestTrans( playerId, banned, callback, @@ -5901,7 +5901,7 @@ void NetCliAuthKickPlayer ( if (!conn) return; - const unsigned_ptr msg[] = { + const uintptr_t msg[] = { kCli2Auth_KickPlayer, playerId }; @@ -5913,11 +5913,11 @@ void NetCliAuthKickPlayer ( //============================================================================ void NetCliAuthChangePlayerNameRequest ( unsigned playerId, - const wchar newName[], + const wchar_t newName[], FNetCliAuthChangePlayerNameRequestCallback callback, void * param ) { - ChangePlayerNameRequestTrans * trans = NEW(ChangePlayerNameRequestTrans)( + ChangePlayerNameRequestTrans * trans = new ChangePlayerNameRequestTrans( playerId, newName, callback, @@ -5928,13 +5928,13 @@ void NetCliAuthChangePlayerNameRequest ( //============================================================================ void NetCliAuthSendFriendInvite ( - const wchar emailAddress[], - const wchar toName[], + const wchar_t emailAddress[], + const wchar_t toName[], const Uuid& inviteUuid, FNetCliAuthSendFriendInviteCallback callback, void * param ) { - SendFriendInviteTrans * trans = NEW(SendFriendInviteTrans)( + SendFriendInviteTrans * trans = new SendFriendInviteTrans( emailAddress, toName, inviteUuid, @@ -5953,7 +5953,7 @@ void NetCliAuthScoreCreate ( FNetCliAuthCreateScoreCallback callback, void * param ) { - ScoreCreateTrans * trans = NEW(ScoreCreateTrans)( + ScoreCreateTrans * trans = new ScoreCreateTrans( ownerId, gameName, gameType, @@ -5970,7 +5970,7 @@ void NetCliAuthScoreDelete( FNetCliAuthScoreUpdateCallback callback, void * param ) { - ScoreDeleteTrans * trans = NEW(ScoreDeleteTrans)( + ScoreDeleteTrans * trans = new ScoreDeleteTrans( scoreId, callback, param @@ -5985,7 +5985,7 @@ void NetCliAuthScoreGetScores( FNetCliAuthGetScoresCallback callback, void * param ) { - ScoreGetScoresTrans * trans = NEW(ScoreGetScoresTrans)( + ScoreGetScoresTrans * trans = new ScoreGetScoresTrans( ownerId, gameName, callback, @@ -6001,7 +6001,7 @@ void NetCliAuthScoreAddPoints( FNetCliAuthScoreUpdateCallback callback, void * param ) { - ScoreAddPointsTrans * trans = NEW(ScoreAddPointsTrans)( + ScoreAddPointsTrans * trans = new ScoreAddPointsTrans( scoreId, numPoints, callback, @@ -6018,7 +6018,7 @@ void NetCliAuthScoreTransferPoints( FNetCliAuthScoreUpdateCallback callback, void * param ) { - ScoreTransferPointsTrans * trans = NEW(ScoreTransferPointsTrans)( + ScoreTransferPointsTrans * trans = new ScoreTransferPointsTrans( srcScoreId, destScoreId, numPoints, @@ -6035,7 +6035,7 @@ void NetCliAuthScoreSetPoints( FNetCliAuthScoreUpdateCallback callback, void * param ) { - ScoreSetPointsTrans * trans = NEW(ScoreSetPointsTrans)( + ScoreSetPointsTrans * trans = new ScoreSetPointsTrans( scoreId, numPoints, callback, @@ -6057,7 +6057,7 @@ void NetCliAuthScoreGetRankList( FNetCliAuthGetRanksCallback callback, void * param ) { - ScoreGetRanksTrans * trans = NEW(ScoreGetRanksTrans)( + ScoreGetRanksTrans * trans = new ScoreGetRanksTrans( ownerId, scoreGroup, parentFolderId, diff --git a/Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglAuth.h b/Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglAuth.h index 04883e95..6637909f 100644 --- a/Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglAuth.h +++ b/Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglAuth.h @@ -61,7 +61,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // Connect //============================================================================ void NetCliAuthStartConnect ( - const wchar * authAddrList[], + const wchar_t * authAddrList[], unsigned authAddrCount ); bool NetCliAuthQueryConnected (); @@ -88,8 +88,8 @@ typedef void (*FNetCliAuthPingRequestCallback)( void * param, unsigned pingAtMs, unsigned replyAtMs, - unsigned payloadbytes, - const byte payload[] + unsigned payloadBytes, + const uint8_t payload[] ); void NetCliAuthPingRequest ( unsigned pingTimeMs, @@ -108,7 +108,7 @@ typedef void (*FNetCliAuthAccountExistsRequestCallback)( bool accountExists ); void NetCliAuthAccountExistsRequest ( - const wchar accountName[], + const wchar_t accountName[], FNetCliAuthAccountExistsRequestCallback callback, void * param ); @@ -118,8 +118,8 @@ void NetCliAuthAccountExistsRequest ( //============================================================================ struct NetCliAuthPlayerInfo { unsigned playerInt; - wchar playerName[kMaxPlayerNameLength]; - wchar avatarShape[kMaxVaultNodeStringLength]; + wchar_t playerName[kMaxPlayerNameLength]; + wchar_t avatarShape[kMaxVaultNodeStringLength]; unsigned playerFlags; unsigned explorer; }; @@ -134,10 +134,10 @@ typedef void (*FNetCliAuthLoginRequestCallback)( unsigned playerCount ); void NetCliAuthLoginRequest ( - const wchar accountName[], // nil --> reuse previous acct name + const wchar_t accountName[], // nil --> reuse previous acct name const ShaDigest * accountNamePassHash, // nil --> reuse previous acct pass - const wchar authToken[], // nil --> reuse previous auth token - const wchar os[], // nil --> reuse previous os + const wchar_t authToken[], // nil --> reuse previous auth token + const wchar_t os[], // nil --> reuse previous os FNetCliAuthLoginRequestCallback callback, void * param ); @@ -164,8 +164,8 @@ typedef void (*FNetCliAuthAccountCreateRequestCallback)( const Uuid & accountId ); void NetCliAuthAccountCreateRequest ( - const wchar accountName[], - const wchar accountPass[], + const wchar_t accountName[], + const wchar_t accountPass[], unsigned accountFlags, unsigned billingType, FNetCliAuthAccountCreateRequestCallback callback, @@ -182,8 +182,8 @@ typedef void (*FNetCliAuthAccountCreateFromKeyRequestCallback)( const Uuid & activationKey ); void NetCliAuthAccountCreateFromKeyRequest ( - const wchar accountName[], - const wchar accountPass[], + const wchar_t accountName[], + const wchar_t accountPass[], Uuid key, unsigned billingType, FNetCliAuthAccountCreateFromKeyRequestCallback callback, @@ -199,9 +199,9 @@ typedef void (*FNetCliAuthPlayerCreateRequestCallback)( const NetCliAuthPlayerInfo & playerInfo ); void NetCliAuthPlayerCreateRequest ( - const wchar playerName[], - const wchar avatarShape[], - const wchar friendInvite[], + const wchar_t playerName[], + const wchar_t avatarShape[], + const wchar_t friendInvite[], FNetCliAuthPlayerCreateRequestCallback callback, void * param ); @@ -257,7 +257,7 @@ typedef void (*FNetCliAuthGetPublicAgeListCallback)( const ARRAY(NetAgeInfo) & ages ); void NetCliAuthGetPublicAgeList ( - const wchar ageName[], + const wchar_t ageName[], FNetCliAuthGetPublicAgeListCallback callback, void * param ); @@ -270,8 +270,8 @@ typedef void (*FNetCliAuthAccountChangePasswordRequestCallback)( void * param ); void NetCliAuthAccountChangePasswordRequest ( - const wchar accountName[], - const wchar accountPass[], + const wchar_t accountName[], + const wchar_t accountPass[], FNetCliAuthAccountChangePasswordRequestCallback callback, void * param ); @@ -284,7 +284,7 @@ typedef void (*FNetCliAuthAccountSetRolesRequestCallback)( void * param ); void NetCliAuthAccountSetRolesRequest ( - const wchar accountName[], + const wchar_t accountName[], unsigned accountFlags, FNetCliAuthAccountSetRolesRequestCallback callback, void * param @@ -298,7 +298,7 @@ typedef void (*FNetCliAuthAccountSetBillingTypeRequestCallback)( void * param ); void NetCliAuthAccountSetBillingTypeRequest ( - const wchar accountName[], + const wchar_t accountName[], unsigned billingType, FNetCliAuthAccountSetBillingTypeRequestCallback callback, void * param @@ -329,7 +329,7 @@ typedef void (*FNetCliAuthAgeRequestCallback)( NetAddressNode gameAddr ); void NetCliAuthAgeRequest ( - const wchar ageName[], // L"Teledahn" + const wchar_t ageName[], // L"Teledahn" const Uuid & ageInstId, FNetCliAuthAgeRequestCallback callback, void * param @@ -339,7 +339,7 @@ void NetCliAuthAgeRequest ( // Secure File Encryption Key //============================================================================ void NetCliAuthGetEncryptionKey ( - UInt32 key[], + uint32_t key[], unsigned size ); @@ -347,7 +347,7 @@ void NetCliAuthGetEncryptionKey ( // File List //============================================================================ struct NetCliAuthFileInfo { - wchar filename[MAX_PATH]; + wchar_t filename[MAX_PATH]; unsigned filesize; }; typedef void (*FNetCliAuthFileListRequestCallback)( @@ -357,8 +357,8 @@ typedef void (*FNetCliAuthFileListRequestCallback)( unsigned infoCount ); void NetCliAuthFileListRequest ( - const wchar dir[], - const wchar ext[], + const wchar_t dir[], + const wchar_t ext[], FNetCliAuthFileListRequestCallback callback, void * param ); @@ -369,11 +369,11 @@ void NetCliAuthFileListRequest ( typedef void (*FNetCliAuthFileRequestCallback)( ENetError result, void * param, - const wchar filename[], + const wchar_t filename[], hsStream * writer ); void NetCliAuthFileRequest ( - const wchar filename[], + const wchar_t filename[], hsStream * writer, FNetCliAuthFileRequestCallback callback, void * param @@ -520,19 +520,19 @@ typedef void (*FNetCliAuthAgeInitCallback) ( void NetCliAuthVaultInitAge ( const Uuid & ageInstId, // optional. is used in match const Uuid & parentAgeInstId, // optional. is used in match - const wchar ageFilename[], // optional. is used in match - const wchar ageInstName[], // optional. not used in match - const wchar ageUserName[], // optional. not used in match - const wchar ageDesc[], // optional. not used in match + const wchar_t ageFilename[], // optional. is used in match + const wchar_t ageInstName[], // optional. not used in match + const wchar_t ageUserName[], // optional. not used in match + const wchar_t ageDesc[], // optional. not used in match unsigned ageSequenceNumber, // optional. not used in match unsigned ageLanguage, // optional. not used in match FNetCliAuthAgeInitCallback callback, // optional void * param // optional ); -void NetCliAuthLogPythonTraceback (const wchar traceback[]); +void NetCliAuthLogPythonTraceback (const wchar_t traceback[]); -void NetCliAuthLogStackDump (const wchar stackdump[]); +void NetCliAuthLogStackDump (const wchar_t stackdump[]); void NetCliAuthLogClientDebuggerConnect (); //============================================================================ @@ -565,7 +565,7 @@ typedef void (*FNetCliAuthChangePlayerNameRequestCallback)( ); void NetCliAuthChangePlayerNameRequest ( unsigned playerId, - const wchar newName[], + const wchar_t newName[], FNetCliAuthChangePlayerNameRequestCallback callback, void * param ); @@ -574,7 +574,7 @@ void NetCliAuthChangePlayerNameRequest ( // CCRPetition //============================================================================ void NetCliAuthSendCCRPetition ( - const wchar * petitionText + const wchar_t * petitionText ); //============================================================================ @@ -586,8 +586,8 @@ typedef void (*FNetCliAuthSendFriendInviteCallback)( ); void NetCliAuthSendFriendInvite ( - const wchar emailAddress[], - const wchar toName[], + const wchar_t emailAddress[], + const wchar_t toName[], const Uuid& inviteUuid, FNetCliAuthSendFriendInviteCallback callback, void * param @@ -599,7 +599,7 @@ void NetCliAuthSendFriendInvite ( typedef void (*FNetCliAuthRecvBufferHandler)( unsigned type, unsigned bytes, - const byte buffer[] + const uint8_t buffer[] ); void NetCliAuthSetRecvBufferHandler ( FNetCliAuthRecvBufferHandler handler @@ -607,7 +607,7 @@ void NetCliAuthSetRecvBufferHandler ( void NetCliAuthPropagateBuffer ( unsigned type, unsigned bytes, - const byte buffer[] + const uint8_t buffer[] ); //============================================================================ @@ -631,7 +631,7 @@ typedef void (*FNetCliAuthCreateScoreCallback)( ENetError result, void * param, unsigned scoreId, - UInt32 createdTime, + uint32_t createdTime, unsigned ownerId, const char* gameName, unsigned gameType, diff --git a/Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglCore.cpp b/Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglCore.cpp index ac35cfba..0e294e77 100644 --- a/Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglCore.cpp +++ b/Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglCore.cpp @@ -127,7 +127,7 @@ void ReportNetErrorTrans::Post () { //============================================================================ void ReportNetError (ENetProtocol protocol, ENetError error) { - ReportNetErrorTrans * trans = NEW(ReportNetErrorTrans)(protocol, error); + ReportNetErrorTrans * trans = new ReportNetErrorTrans(protocol, error); NetTransSend(trans); } diff --git a/Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglCsr.cpp b/Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglCsr.cpp index 5d548225..cdd753f3 100644 --- a/Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglCsr.cpp +++ b/Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglCsr.cpp @@ -90,7 +90,7 @@ struct CliCsConn : AtomicRef { void StopAutoPing (); void TimerPing (); - void Send (const unsigned_ptr fields[], unsigned count); + void Send (const uintptr_t fields[], unsigned count); }; @@ -108,14 +108,14 @@ struct ConnectedNotifyTrans : NetNotifyTrans { , m_latestBuildId(lbi) { } ~ConnectedNotifyTrans () { - DEL(m_connectParam); + delete m_connectParam; } void Post (); }; struct LoginRequestTrans : NetCsrTrans { - wchar m_csrName[kMaxAccountNameLength]; + wchar_t m_csrName[kMaxAccountNameLength]; ShaDigest m_namePassHash; FNetCliCsrLoginCallback m_callback; void * m_param; @@ -124,7 +124,7 @@ struct LoginRequestTrans : NetCsrTrans { unsigned m_csrFlags; LoginRequestTrans ( - const wchar csrName[], + const wchar_t csrName[], const ShaDigest & namePassHash, FNetCliCsrLoginCallback callback, void * param @@ -133,7 +133,7 @@ struct LoginRequestTrans : NetCsrTrans { bool Send (); void Post (); bool Recv ( - const byte msg[], + const uint8_t msg[], unsigned bytes ); }; @@ -213,7 +213,7 @@ static void UnlinkAndAbandonConn_CS (CliCsConn * conn) { //============================================================================ static void SendRegisterRequest (CliCsConn * conn) { - const unsigned_ptr msg[] = { + const uintptr_t msg[] = { kCli2Csr_RegisterRequest, 0 }; @@ -411,7 +411,7 @@ static void Connect ( //============================================================================ static void AsyncLookupCallback ( void * param, - const wchar name[], + const wchar_t name[], unsigned addrCount, const NetAddress addrs[] ) { @@ -437,7 +437,7 @@ static void AsyncLookupCallback ( //============================================================================ static bool Recv_PingReply ( - const byte msg[], + const uint8_t msg[], unsigned bytes, void * ) { @@ -450,7 +450,7 @@ static bool Recv_PingReply ( //============================================================================ static bool Recv_RegisterReply ( - const byte msg[], + const uint8_t msg[], unsigned , void * param ) { @@ -461,7 +461,7 @@ static bool Recv_RegisterReply ( conn->serverChallenge = reply.serverChallenge; conn->latestBuildId = reply.csrBuildId; - ConnectedNotifyTrans * trans = NEW(ConnectedNotifyTrans)( + ConnectedNotifyTrans * trans = new ConnectedNotifyTrans( conn->connectParam, conn->latestBuildId ); @@ -474,7 +474,7 @@ static bool Recv_RegisterReply ( //============================================================================ static bool Recv_LoginReply ( - const byte msg[], + const uint8_t msg[], unsigned bytes, void * ) { @@ -543,7 +543,7 @@ CliCsConn::~CliCsConn () { if (cli) NetCliDelete(cli, true); - DEL(connectParam); + delete connectParam; AtomicAdd(&s_perf[kPerfConnCount], -1); } @@ -583,7 +583,7 @@ void CliCsConn::TimerPing () { // Send a ping request pingSendTimeMs = GetNonZeroTimeMs(); - const unsigned_ptr msg[] = { + const uintptr_t msg[] = { kCli2Auth_PingRequest, 0, // not a transaction pingSendTimeMs, @@ -595,7 +595,7 @@ void CliCsConn::TimerPing () { } //============================================================================ -void CliCsConn::Send (const unsigned_ptr fields[], unsigned count) { +void CliCsConn::Send (const uintptr_t fields[], unsigned count) { critsect.Enter(); { @@ -628,7 +628,7 @@ void ConnectedNotifyTrans::Post () { //============================================================================ LoginRequestTrans::LoginRequestTrans ( - const wchar csrName[], + const wchar_t csrName[], const ShaDigest & namePassHash, FNetCliCsrLoginCallback callback, void * param @@ -648,11 +648,11 @@ bool LoginRequestTrans::Send () { return false; ShaDigest challengeHash; - dword clientChallenge = 0; + uint32_t clientChallenge = 0; CryptCreateRandomSeed( sizeof(clientChallenge), - (byte *) &clientChallenge + (uint8_t *) &clientChallenge ); CryptHashPasswordChallenge( @@ -662,12 +662,12 @@ bool LoginRequestTrans::Send () { &challengeHash ); - const unsigned_ptr msg[] = { + const uintptr_t msg[] = { kCli2Csr_LoginRequest, m_transId, clientChallenge, - (unsigned_ptr) m_csrName, - (unsigned_ptr) &challengeHash + (uintptr_t) m_csrName, + (uintptr_t) &challengeHash }; m_conn->Send(msg, arrsize(msg)); @@ -687,7 +687,7 @@ void LoginRequestTrans::Post () { //============================================================================ bool LoginRequestTrans::Recv ( - const byte msg[], + const uint8_t msg[], unsigned bytes ) { const Csr2Cli_LoginReply & reply = *(const Csr2Cli_LoginReply *) msg; @@ -828,7 +828,7 @@ unsigned CsrGetConnId () { //============================================================================ void NetCliCsrStartConnect ( - const wchar * addrList[], + const wchar_t * addrList[], unsigned addrCount, FNetCliCsrConnectedCallback callback, void * param @@ -838,11 +838,11 @@ void NetCliCsrStartConnect ( for (unsigned i = 0; i < addrCount; ++i) { // Do we need to lookup the address? - const wchar * name = addrList[i]; + const wchar_t * name = addrList[i]; while (unsigned ch = *name) { ++name; if (!(isdigit(ch) || ch == L'.' || ch == L':')) { - ConnectParam * cp = NEW(ConnectParam); + ConnectParam * cp = new ConnectParam; cp->callback = callback; cp->param = param; @@ -861,7 +861,7 @@ void NetCliCsrStartConnect ( NetAddress addr; NetAddressFromString(&addr, addrList[i], kNetDefaultClientPort); - ConnectParam * cp = NEW(ConnectParam); + ConnectParam * cp = new ConnectParam; cp->callback = callback; cp->param = param; @@ -884,12 +884,12 @@ void NetCliCsrDisconnect () { //============================================================================ void NetCliCsrLoginRequest ( - const wchar csrName[], + const wchar_t csrName[], const ShaDigest & namePassHash, FNetCliCsrLoginCallback callback, void * param ) { - LoginRequestTrans * trans = NEW(LoginRequestTrans)( + LoginRequestTrans * trans = new LoginRequestTrans( csrName, namePassHash, callback, diff --git a/Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglCsr.h b/Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglCsr.h index 6b345383..1cee1e57 100644 --- a/Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglCsr.h +++ b/Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglCsr.h @@ -62,7 +62,7 @@ typedef void (*FNetCliCsrConnectedCallback) ( unsigned latestBuildId ); void NetCliCsrStartConnect ( - const wchar * addrList[], + const wchar_t * addrList[], unsigned addrCount, FNetCliCsrConnectedCallback callback = nil, void * param = nil @@ -76,7 +76,7 @@ typedef void (*FNetCliCsrLoginCallback)( unsigned csrFlags ); void NetCliCsrLoginRequest ( - const wchar csrName[], + const wchar_t csrName[], const ShaDigest & namePassHash, FNetCliCsrLoginCallback callback, void * param @@ -87,7 +87,7 @@ typedef void (*FNetCliCsrSetTicketFilterCallback)( void * param ); void NetCliCsrSetTicketFilter ( - const wchar filterSpec[], + const wchar_t filterSpec[], FNetCliCsrSetTicketFilterCallback callback, void * param ); diff --git a/Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglFile.cpp b/Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglFile.cpp index 35742330..d22bb5f0 100644 --- a/Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglFile.cpp +++ b/Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglFile.cpp @@ -64,10 +64,10 @@ struct CliFileConn : AtomicRef { LINK(CliFileConn) link; CLock sockLock; // to protect the socket pointer so we don't nuke it while using it AsyncSocket sock; - wchar name[MAX_PATH]; + wchar_t name[MAX_PATH]; NetAddress addr; unsigned seq; - ARRAY(byte) recvBuffer; + ARRAY(uint8_t) recvBuffer; AsyncCancelId cancelId; bool abandoned; unsigned buildId; @@ -134,7 +134,7 @@ struct BuildIdRequestTrans : NetFileTrans { bool Send (); void Post (); bool Recv ( - const byte msg[], + const uint8_t msg[], unsigned bytes ); }; @@ -145,7 +145,7 @@ struct BuildIdRequestTrans : NetFileTrans { struct ManifestRequestTrans : NetFileTrans { FNetCliFileManifestRequestCallback m_callback; void * m_param; - wchar m_group[MAX_PATH]; + wchar_t m_group[MAX_PATH]; unsigned m_buildId; ARRAY(NetCliFileManifestEntry) m_manifest; @@ -154,14 +154,14 @@ struct ManifestRequestTrans : NetFileTrans { ManifestRequestTrans ( FNetCliFileManifestRequestCallback callback, void * param, - const wchar group[], + const wchar_t group[], unsigned buildId ); bool Send (); void Post (); bool Recv ( - const byte msg[], + const uint8_t msg[], unsigned bytes ); }; @@ -173,7 +173,7 @@ struct DownloadRequestTrans : NetFileTrans { FNetCliFileDownloadRequestCallback m_callback; void * m_param; - wchar m_filename[MAX_PATH]; + wchar_t m_filename[MAX_PATH]; hsStream * m_writer; unsigned m_buildId; @@ -182,7 +182,7 @@ struct DownloadRequestTrans : NetFileTrans { DownloadRequestTrans ( FNetCliFileDownloadRequestCallback callback, void * param, - const wchar filename[], + const wchar_t filename[], hsStream * writer, unsigned buildId ); @@ -190,7 +190,7 @@ struct DownloadRequestTrans : NetFileTrans { bool Send (); void Post (); bool Recv ( - const byte msg[], + const uint8_t msg[], unsigned bytes ); }; @@ -201,7 +201,7 @@ struct DownloadRequestTrans : NetFileTrans { struct RcvdFileDownloadChunkTrans : NetNotifyTrans { unsigned bytes; - byte * data; + uint8_t * data; hsStream * writer; RcvdFileDownloadChunkTrans () : NetNotifyTrans (kFileRcvdFileDownloadChunkTrans) {} @@ -437,10 +437,10 @@ static bool NotifyConnSocketRead (CliFileConn * conn, AsyncNotifySocketRead * re read->bytesProcessed += read->bytes; for (;;) { - if (conn->recvBuffer.Count() < sizeof(dword)) + if (conn->recvBuffer.Count() < sizeof(uint32_t)) return true; - dword msgSize = *(dword *)conn->recvBuffer.Ptr(); + uint32_t msgSize = *(uint32_t *)conn->recvBuffer.Ptr(); if (conn->recvBuffer.Count() < msgSize) return true; @@ -539,7 +539,7 @@ static void Connect (CliFileConn * conn) { //============================================================================ static void Connect ( - const wchar name[], + const wchar_t name[], const NetAddress & addr ) { ASSERT(s_running); @@ -559,7 +559,7 @@ static void Connect ( //============================================================================ static void AsyncLookupCallback ( void * param, - const wchar name[], + const wchar_t name[], unsigned addrCount, const NetAddress addrs[] ) { @@ -798,7 +798,7 @@ bool CliFileConn::Recv_PingReply ( bool CliFileConn::Recv_BuildIdReply ( const File2Cli_BuildIdReply * msg ) { - NetTransRecv(msg->transId, (const byte *)msg, msg->messageBytes); + NetTransRecv(msg->transId, (const uint8_t *)msg, msg->messageBytes); return true; } @@ -816,7 +816,7 @@ bool CliFileConn::Recv_BuildIdUpdate ( bool CliFileConn::Recv_ManifestReply ( const File2Cli_ManifestReply * msg ) { - NetTransRecv(msg->transId, (const byte *)msg, msg->messageBytes); + NetTransRecv(msg->transId, (const uint8_t *)msg, msg->messageBytes); return true; } @@ -825,7 +825,7 @@ bool CliFileConn::Recv_ManifestReply ( bool CliFileConn::Recv_FileDownloadReply ( const File2Cli_FileDownloadReply * msg ) { - NetTransRecv(msg->transId, (const byte *)msg, msg->messageBytes); + NetTransRecv(msg->transId, (const uint8_t *)msg, msg->messageBytes); return true; } @@ -868,7 +868,7 @@ void BuildIdRequestTrans::Post () { //============================================================================ bool BuildIdRequestTrans::Recv ( - const byte msg[], + const uint8_t msg[], unsigned bytes ) { const File2Cli_BuildIdReply & reply = *(const File2Cli_BuildIdReply *) msg; @@ -900,7 +900,7 @@ bool BuildIdRequestTrans::Recv ( ManifestRequestTrans::ManifestRequestTrans ( FNetCliFileManifestRequestCallback callback, void * param, - const wchar group[], + const wchar_t group[], unsigned buildId ) : NetFileTrans(kManifestRequestTrans) , m_callback(callback) @@ -937,7 +937,7 @@ void ManifestRequestTrans::Post () { } //============================================================================ -void ReadStringFromMsg(const wchar* curMsgPtr, wchar str[], unsigned maxStrLen, unsigned* length) { +void ReadStringFromMsg(const wchar_t* curMsgPtr, wchar_t str[], unsigned maxStrLen, unsigned* length) { StrCopy(str, curMsgPtr, maxStrLen); str[maxStrLen - 1] = L'\0'; // make sure it's terminated @@ -945,22 +945,22 @@ void ReadStringFromMsg(const wchar* curMsgPtr, wchar str[], unsigned maxStrLen, } //============================================================================ -void ReadUnsignedFromMsg(const wchar* curMsgPtr, unsigned* val) { +void ReadUnsignedFromMsg(const wchar_t* curMsgPtr, unsigned* val) { (*val) = ((*curMsgPtr) << 16) + (*(curMsgPtr + 1)); } //============================================================================ bool ManifestRequestTrans::Recv ( - const byte msg[], + const uint8_t msg[], unsigned bytes ) { m_timeoutAtMs = TimeGetMs() + NetTransGetTimeoutMs(); // Reset the timeout counter const File2Cli_ManifestReply & reply = *(const File2Cli_ManifestReply *) msg; - dword numFiles = reply.numFiles; - dword wcharCount = reply.wcharCount; - const wchar* curChar = reply.manifestData; // the pointer is not yet dereferenced here! + uint32_t numFiles = reply.numFiles; + uint32_t wchar_tCount = reply.wchar_tCount; + const wchar_t* curChar = reply.manifestData; // the pointer is not yet dereferenced here! // tell the server we got the data Cli2File_ManifestEntryAck manifestAck; @@ -971,9 +971,9 @@ bool ManifestRequestTrans::Recv ( m_conn->Send(&manifestAck, manifestAck.messageBytes); - // if wcharCount is 2 or less, the data only contains the terminator "\0\0" and we + // if wchar_tCount is 2 or less, the data only contains the terminator "\0\0" and we // don't need to convert anything (and we are done) - if ((IS_NET_ERROR(reply.result)) || (wcharCount <= 2)) { + if ((IS_NET_ERROR(reply.result)) || (wchar_tCount <= 2)) { // we have a problem... or we have nothing to so, so we're done m_result = reply.result; m_state = kTransStateComplete; @@ -986,7 +986,7 @@ bool ManifestRequestTrans::Recv ( // manifestData format: "clientFile\0downloadFile\0md5\0filesize\0zipsize\0flags\0...\0\0" bool done = false; while (!done) { - if (wcharCount == 0) + if (wchar_tCount == 0) { done = true; break; @@ -1000,98 +1000,98 @@ bool ManifestRequestTrans::Recv ( unsigned filenameLen; ReadStringFromMsg(curChar, entry.clientName, arrsize(entry.clientName), &filenameLen); curChar += filenameLen; // advance the pointer - wcharCount -= filenameLen; // keep track of the amount remaining - if ((*curChar != L'\0') || (wcharCount <= 0)) + wchar_tCount -= filenameLen; // keep track of the amount remaining + if ((*curChar != L'\0') || (wchar_tCount <= 0)) return false; // something is screwy, abort and disconnect // point it at the downloadFile curChar++; - wcharCount--; + wchar_tCount--; // -------------------------------------------------------------------- // read in the downloadFilename ReadStringFromMsg(curChar, entry.downloadName, arrsize(entry.downloadName), &filenameLen); curChar += filenameLen; // advance the pointer - wcharCount -= filenameLen; // keep track of the amount remaining - if ((*curChar != L'\0') || (wcharCount <= 0)) + wchar_tCount -= filenameLen; // keep track of the amount remaining + if ((*curChar != L'\0') || (wchar_tCount <= 0)) return false; // something is screwy, abort and disconnect // point it at the md5 curChar++; - wcharCount--; + wchar_tCount--; // -------------------------------------------------------------------- // read in the md5 ReadStringFromMsg(curChar, entry.md5, arrsize(entry.md5), &filenameLen); curChar += filenameLen; // advance the pointer - wcharCount -= filenameLen; // keep track of the amount remaining - if ((*curChar != L'\0') || (wcharCount <= 0)) + wchar_tCount -= filenameLen; // keep track of the amount remaining + if ((*curChar != L'\0') || (wchar_tCount <= 0)) return false; // something is screwy, abort and disconnect // point it at the md5 for compressed files curChar++; - wcharCount--; + wchar_tCount--; // -------------------------------------------------------------------- // read in the md5 for compressed files ReadStringFromMsg(curChar, entry.md5compressed, arrsize(entry.md5compressed), &filenameLen); curChar += filenameLen; // advance the pointer - wcharCount -= filenameLen; // keep track of the amount remaining - if ((*curChar != L'\0') || (wcharCount <= 0)) + wchar_tCount -= filenameLen; // keep track of the amount remaining + if ((*curChar != L'\0') || (wchar_tCount <= 0)) return false; // something is screwy, abort and disconnect // point it at the first part of the filesize value (format: 0xHHHHLLLL) curChar++; - wcharCount--; + wchar_tCount--; // -------------------------------------------------------------------- - if (wcharCount < 2) // we have to have 2 chars for the size + if (wchar_tCount < 2) // we have to have 2 chars for the size return false; // screwy data ReadUnsignedFromMsg(curChar, &entry.fileSize); curChar += 2; - wcharCount -= 2; - if ((*curChar != L'\0') || (wcharCount <= 0)) + wchar_tCount -= 2; + if ((*curChar != L'\0') || (wchar_tCount <= 0)) return false; // screwy data // point it at the first part of the zipsize value (format: 0xHHHHLLLL) curChar++; - wcharCount--; + wchar_tCount--; // -------------------------------------------------------------------- - if (wcharCount < 2) // we have to have 2 chars for the size + if (wchar_tCount < 2) // we have to have 2 chars for the size return false; // screwy data ReadUnsignedFromMsg(curChar, &entry.zipSize); curChar += 2; - wcharCount -= 2; - if ((*curChar != L'\0') || (wcharCount <= 0)) + wchar_tCount -= 2; + if ((*curChar != L'\0') || (wchar_tCount <= 0)) return false; // screwy data // point it at the first part of the flags value (format: 0xHHHHLLLL) curChar++; - wcharCount--; + wchar_tCount--; // -------------------------------------------------------------------- - if (wcharCount < 2) // we have to have 2 chars for the size + if (wchar_tCount < 2) // we have to have 2 chars for the size return false; // screwy data ReadUnsignedFromMsg(curChar, &entry.flags); curChar += 2; - wcharCount -= 2; - if ((*curChar != L'\0') || (wcharCount <= 0)) + wchar_tCount -= 2; + if ((*curChar != L'\0') || (wchar_tCount <= 0)) return false; // screwy data // -------------------------------------------------------------------- // point it at either the second part of the terminator, or the next filename curChar++; - wcharCount--; + wchar_tCount--; // do sanity checking if (*curChar == L'\0') { // we hit the terminator - if (wcharCount != 1) + if (wchar_tCount != 1) return false; // invalid data, we shouldn't have any more done = true; // we're done } - else if (wcharCount < 14) + else if (wchar_tCount < 14) // we must have at least three 1-char strings, three nulls, three 32-bit ints, and 2-char terminator left (3+3+6+2) return false; // screwy data @@ -1123,7 +1123,7 @@ bool ManifestRequestTrans::Recv ( DownloadRequestTrans::DownloadRequestTrans ( FNetCliFileDownloadRequestCallback callback, void * param, - const wchar filename[], + const wchar_t filename[], hsStream * writer, unsigned buildId ) : NetFileTrans(kDownloadRequestTrans) @@ -1163,15 +1163,15 @@ void DownloadRequestTrans::Post () { //============================================================================ bool DownloadRequestTrans::Recv ( - const byte msg[], + const uint8_t msg[], unsigned bytes ) { m_timeoutAtMs = TimeGetMs() + NetTransGetTimeoutMs(); // Reset the timeout counter const File2Cli_FileDownloadReply & reply = *(const File2Cli_FileDownloadReply *) msg; - dword byteCount = reply.byteCount; - const byte* data = reply.fileData; + uint32_t byteCount = reply.byteCount; + const uint8_t* data = reply.fileData; // tell the server we got the data Cli2File_FileDownloadChunkAck fileAck; @@ -1192,11 +1192,11 @@ bool DownloadRequestTrans::Recv ( // we have data to write, so queue it for write in the main thread (we're // currently in a net recv thread) if (byteCount > 0) { - RcvdFileDownloadChunkTrans * writeTrans = NEW(RcvdFileDownloadChunkTrans); + RcvdFileDownloadChunkTrans * writeTrans = new RcvdFileDownloadChunkTrans; writeTrans->writer = m_writer; writeTrans->bytes = byteCount; - writeTrans->data = (byte *)ALLOC(byteCount); - MemCopy(writeTrans->data, data, byteCount); + writeTrans->data = (uint8_t *)malloc(byteCount); + memcpy(writeTrans->data, data, byteCount); NetTransSend(writeTrans); } m_totalBytesReceived += byteCount; @@ -1217,7 +1217,7 @@ bool DownloadRequestTrans::Recv ( //============================================================================ RcvdFileDownloadChunkTrans::~RcvdFileDownloadChunkTrans () { - FREE(data); + free(data); } //============================================================================ @@ -1334,7 +1334,7 @@ unsigned FileGetConnId () { //============================================================================ void NetCliFileStartConnect ( - const wchar * fileAddrList[], + const wchar_t * fileAddrList[], unsigned fileAddrCount, bool isPatcher /* = false */ ) { @@ -1346,7 +1346,7 @@ void NetCliFileStartConnect ( for (unsigned i = 0; i < fileAddrCount; ++i) { // Do we need to lookup the address? - const wchar * name = fileAddrList[i]; + const wchar_t * name = fileAddrList[i]; while (unsigned ch = *name) { ++name; if (!(isdigit(ch) || ch == L'.' || ch == L':')) { @@ -1371,7 +1371,7 @@ void NetCliFileStartConnect ( //============================================================================ void NetCliFileStartConnectAsServer ( - const wchar * fileAddrList[], + const wchar_t * fileAddrList[], unsigned fileAddrCount, unsigned serverType, unsigned serverBuildId @@ -1384,7 +1384,7 @@ void NetCliFileStartConnectAsServer ( for (unsigned i = 0; i < fileAddrCount; ++i) { // Do we need to lookup the address? - const wchar * name = fileAddrList[i]; + const wchar_t * name = fileAddrList[i]; while (unsigned ch = *name) { ++name; if (!(isdigit(ch) || ch == L'.' || ch == L':')) { @@ -1423,7 +1423,7 @@ void NetCliFileBuildIdRequest ( FNetCliFileBuildIdRequestCallback callback, void * param ) { - BuildIdRequestTrans * trans = NEW(BuildIdRequestTrans)( + BuildIdRequestTrans * trans = new BuildIdRequestTrans( callback, param ); @@ -1439,10 +1439,10 @@ void NetCliFileRegisterBuildIdUpdate (FNetCliFileBuildIdUpdateCallback callback) void NetCliFileManifestRequest ( FNetCliFileManifestRequestCallback callback, void * param, - const wchar group[], + const wchar_t group[], unsigned buildId /* = 0 */ ) { - ManifestRequestTrans * trans = NEW(ManifestRequestTrans)( + ManifestRequestTrans * trans = new ManifestRequestTrans( callback, param, group, @@ -1453,13 +1453,13 @@ void NetCliFileManifestRequest ( //============================================================================ void NetCliFileDownloadRequest ( - const wchar filename[], + const wchar_t filename[], hsStream * writer, FNetCliFileDownloadRequestCallback callback, void * param, unsigned buildId /* = 0 */ ) { - DownloadRequestTrans * trans = NEW(DownloadRequestTrans)( + DownloadRequestTrans * trans = new DownloadRequestTrans( callback, param, filename, diff --git a/Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglFile.h b/Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglFile.h index 7db5f812..23d82b64 100644 --- a/Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglFile.h +++ b/Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglFile.h @@ -62,12 +62,12 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // Connect //============================================================================ void NetCliFileStartConnect ( - const wchar * fileAddrList[], + const wchar_t * fileAddrList[], unsigned fileAddrCount, bool isPatcher = false ); void NetCliFileStartConnectAsServer ( - const wchar * fileAddrList[], + const wchar_t * fileAddrList[], unsigned fileAddrCount, unsigned serverType, unsigned serverBuildId @@ -97,10 +97,10 @@ void NetCliFileRegisterBuildIdUpdate (FNetCliFileBuildIdUpdateCallback callback) // Manifest //============================================================================ struct NetCliFileManifestEntry { - wchar clientName[MAX_PATH]; // path and file on client side (for comparison) - wchar downloadName[MAX_PATH]; // path and file on server side (for download) - wchar md5[MAX_PATH]; - wchar md5compressed[MAX_PATH]; // md5 for the compressed file + wchar_t clientName[MAX_PATH]; // path and file on client side (for comparison) + wchar_t downloadName[MAX_PATH]; // path and file on server side (for download) + wchar_t md5[MAX_PATH]; + wchar_t md5compressed[MAX_PATH]; // md5 for the compressed file unsigned fileSize; unsigned zipSize; unsigned flags; @@ -108,14 +108,14 @@ struct NetCliFileManifestEntry { typedef void (*FNetCliFileManifestRequestCallback)( ENetError result, void * param, - const wchar group[], + const wchar_t group[], const NetCliFileManifestEntry manifest[], unsigned entryCount ); void NetCliFileManifestRequest ( FNetCliFileManifestRequestCallback callback, void * param, - const wchar group[], // the group of files you want (empty or nil = all) + const wchar_t group[], // the group of files you want (empty or nil = all) unsigned buildId = 0 // 0 = get latest, other = get particular build (servers only) ); @@ -125,11 +125,11 @@ void NetCliFileManifestRequest ( typedef void (*FNetCliFileDownloadRequestCallback)( ENetError result, void * param, - const wchar filename[], + const wchar_t filename[], hsStream * writer ); void NetCliFileDownloadRequest ( - const wchar filename[], + const wchar_t filename[], hsStream * writer, FNetCliFileDownloadRequestCallback callback, void * param, diff --git a/Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglGame.cpp b/Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglGame.cpp index 4a11f2c8..1040c346 100644 --- a/Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglGame.cpp +++ b/Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglGame.cpp @@ -74,7 +74,7 @@ struct CliGmConn : AtomicRef { CliGmConn (); ~CliGmConn (); - void Send (const unsigned_ptr fields[], unsigned count); + void Send (const uintptr_t fields[], unsigned count); }; @@ -100,7 +100,7 @@ struct JoinAgeRequestTrans : NetGameTrans { bool Send (); void Post (); bool Recv ( - const byte msg[], + const uint8_t msg[], unsigned bytes ); }; @@ -112,7 +112,7 @@ struct RcvdPropagatedBufferTrans : NetNotifyTrans { unsigned bufferType; unsigned bufferBytes; - byte * bufferData; + uint8_t * bufferData; RcvdPropagatedBufferTrans () : NetNotifyTrans(kGmRcvdPropagatedBufferTrans) {} ~RcvdPropagatedBufferTrans (); @@ -125,7 +125,7 @@ struct RcvdPropagatedBufferTrans : NetNotifyTrans { struct RcvdGameMgrMsgTrans : NetNotifyTrans { unsigned bufferBytes; - byte * bufferData; + uint8_t * bufferData; RcvdGameMgrMsgTrans () : NetNotifyTrans(kGmRcvdGameMgrMsgTrans) {} ~RcvdGameMgrMsgTrans (); @@ -405,7 +405,7 @@ CliGmConn::~CliGmConn () { } //============================================================================ -void CliGmConn::Send (const unsigned_ptr fields[], unsigned count) { +void CliGmConn::Send (const uintptr_t fields[], unsigned count) { critsect.Enter(); { NetCliSend(cli, fields, count); @@ -423,7 +423,7 @@ void CliGmConn::Send (const unsigned_ptr fields[], unsigned count) { //============================================================================ static bool Recv_PingReply ( - const byte msg[], + const uint8_t msg[], unsigned bytes, void * param ) { @@ -432,7 +432,7 @@ static bool Recv_PingReply ( //============================================================================ static bool Recv_JoinAgeReply ( - const byte msg[], + const uint8_t msg[], unsigned bytes, void * param ) { @@ -447,17 +447,17 @@ static bool Recv_JoinAgeReply ( //============================================================================ static bool Recv_PropagateBuffer ( - const byte msg[], + const uint8_t msg[], unsigned bytes, void * param ) { const Game2Cli_PropagateBuffer & reply = *(const Game2Cli_PropagateBuffer *)msg; - RcvdPropagatedBufferTrans * trans = NEW(RcvdPropagatedBufferTrans); + RcvdPropagatedBufferTrans * trans = new RcvdPropagatedBufferTrans; trans->bufferType = reply.type; trans->bufferBytes = reply.bytes; - trans->bufferData = (byte *)ALLOC(reply.bytes); - MemCopy(trans->bufferData, reply.buffer, reply.bytes); + trans->bufferData = (uint8_t *)malloc(reply.bytes); + memcpy(trans->bufferData, reply.buffer, reply.bytes); NetTransSend(trans); return true; @@ -465,16 +465,16 @@ static bool Recv_PropagateBuffer ( //============================================================================ static bool Recv_GameMgrMsg ( - const byte msg[], + const uint8_t msg[], unsigned bytes, void * param ) { const Game2Cli_GameMgrMsg & reply = *(const Game2Cli_GameMgrMsg *)msg; - RcvdGameMgrMsgTrans * trans = NEW(RcvdGameMgrMsgTrans); + RcvdGameMgrMsgTrans * trans = new RcvdGameMgrMsgTrans; trans->bufferBytes = reply.bytes; - trans->bufferData = (byte *)ALLOC(reply.bytes); - MemCopy(trans->bufferData, reply.buffer, reply.bytes); + trans->bufferData = (uint8_t *)malloc(reply.bytes); + memcpy(trans->bufferData, reply.buffer, reply.bytes); NetTransSend(trans); return true; @@ -530,11 +530,11 @@ bool JoinAgeRequestTrans::Send () { if (!AcquireConn()) return false; - const unsigned_ptr msg[] = { + const uintptr_t msg[] = { kCli2Game_JoinAgeRequest, m_transId, m_ageMcpId, - (unsigned_ptr) &m_accountUuid, + (uintptr_t) &m_accountUuid, m_playerInt, }; @@ -553,7 +553,7 @@ void JoinAgeRequestTrans::Post () { //============================================================================ bool JoinAgeRequestTrans::Recv ( - const byte msg[], + const uint8_t msg[], unsigned bytes ) { const Game2Cli_JoinAgeReply & reply = *(const Game2Cli_JoinAgeReply *) msg; @@ -570,7 +570,7 @@ bool JoinAgeRequestTrans::Recv ( //============================================================================ RcvdPropagatedBufferTrans::~RcvdPropagatedBufferTrans () { - FREE(bufferData); + free(bufferData); } //============================================================================ @@ -587,7 +587,7 @@ void RcvdPropagatedBufferTrans::Post () { //============================================================================ RcvdGameMgrMsgTrans::~RcvdGameMgrMsgTrans () { - FREE(bufferData); + free(bufferData); } //============================================================================ @@ -771,17 +771,17 @@ void NetCliGameSetRecvBufferHandler ( void NetCliGamePropagateBuffer ( unsigned type, unsigned bytes, - const byte buffer[] + const uint8_t buffer[] ) { CliGmConn * conn = GetConnIncRef("PropBuffer"); if (!conn) return; - const unsigned_ptr msg[] = { + const uintptr_t msg[] = { kCli2Game_PropagateBuffer, type, bytes, - (unsigned_ptr) buffer, + (uintptr_t) buffer, }; conn->Send(msg, arrsize(msg)); @@ -800,10 +800,10 @@ void NetCliGameSendGameMgrMsg (GameMsgHeader * msgHdr) { if (!conn) return; - const unsigned_ptr msg[] = { + const uintptr_t msg[] = { kCli2Game_GameMgrMsg, msgHdr->messageBytes, - (unsigned_ptr) msgHdr, + (uintptr_t) msgHdr, }; conn->Send(msg, arrsize(msg)); diff --git a/Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglGame.h b/Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglGame.h index 62a663e0..c9642753 100644 --- a/Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglGame.h +++ b/Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglGame.h @@ -90,7 +90,7 @@ void NetCliGameJoinAgeRequest ( typedef void (*FNetCliGameRecvBufferHandler)( unsigned type, unsigned bytes, - const byte buffer[] + const uint8_t buffer[] ); void NetCliGameSetRecvBufferHandler ( FNetCliGameRecvBufferHandler handler @@ -98,7 +98,7 @@ void NetCliGameSetRecvBufferHandler ( void NetCliGamePropagateBuffer ( unsigned type, unsigned bytes, - const byte buffer[] + const uint8_t buffer[] ); //============================================================================ diff --git a/Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglGateKeeper.cpp b/Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglGateKeeper.cpp index db65144a..7334aa41 100644 --- a/Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglGateKeeper.cpp +++ b/Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglGateKeeper.cpp @@ -83,13 +83,13 @@ struct CliGkConn : AtomicRef { void StopAutoPing (); void TimerPing (); - void Send (const unsigned_ptr fields[], unsigned count); + void Send (const uintptr_t fields[], unsigned count); CCritSect critsect; LINK(CliGkConn) link; AsyncSocket sock; NetCli * cli; - wchar name[MAX_PATH]; + wchar_t name[MAX_PATH]; NetAddress addr; Uuid token; unsigned seq; @@ -107,7 +107,7 @@ struct PingRequestTrans : NetGateKeeperTrans { void * m_param; unsigned m_pingAtMs; unsigned m_replyAtMs; - ARRAY(byte) m_payload; + ARRAY(uint8_t) m_payload; PingRequestTrans ( FNetCliGateKeeperPingRequestCallback callback, @@ -120,7 +120,7 @@ struct PingRequestTrans : NetGateKeeperTrans { bool Send (); void Post (); bool Recv ( - const byte msg[], + const uint8_t msg[], unsigned bytes ); }; @@ -131,7 +131,7 @@ struct PingRequestTrans : NetGateKeeperTrans { struct FileSrvIpAddressRequestTrans : NetGateKeeperTrans { FNetCliGateKeeperFileSrvIpAddressRequestCallback m_callback; void * m_param; - wchar m_addr[64]; + wchar_t m_addr[64]; bool m_isPatcher; FileSrvIpAddressRequestTrans ( @@ -143,7 +143,7 @@ struct FileSrvIpAddressRequestTrans : NetGateKeeperTrans { bool Send (); void Post (); bool Recv ( - const byte msg[], + const uint8_t msg[], unsigned bytes ); }; @@ -154,7 +154,7 @@ struct FileSrvIpAddressRequestTrans : NetGateKeeperTrans { struct AuthSrvIpAddressRequestTrans : NetGateKeeperTrans { FNetCliGateKeeperAuthSrvIpAddressRequestCallback m_callback; void * m_param; - wchar m_addr[64]; + wchar_t m_addr[64]; AuthSrvIpAddressRequestTrans ( FNetCliGateKeeperAuthSrvIpAddressRequestCallback callback, @@ -164,7 +164,7 @@ struct AuthSrvIpAddressRequestTrans : NetGateKeeperTrans { bool Send (); void Post (); bool Recv ( - const byte msg[], + const uint8_t msg[], unsigned bytes ); }; @@ -246,7 +246,7 @@ static void UnlinkAndAbandonConn_CS (CliGkConn * conn) { //============================================================================ static void SendClientRegisterRequest (CliGkConn * conn) { -/* const unsigned_ptr msg[] = { +/* const uintptr_t msg[] = { kCli2GateKeeper_ClientRegisterRequest, BuildId(), }; @@ -271,7 +271,7 @@ static bool ConnEncrypt (ENetError error, void * param) { } s_critsect.Leave(); - // AuthConnectedNotifyTrans * trans = NEW(AuthConnectedNotifyTrans); + // AuthConnectedNotifyTrans * trans = new AuthConnectedNotifyTrans; // NetTransSend(trans); } @@ -463,7 +463,7 @@ static void Connect ( //============================================================================ static void Connect ( - const wchar name[], + const wchar_t name[], const NetAddress & addr ) { ASSERT(s_running); @@ -481,7 +481,7 @@ static void Connect ( //============================================================================ static void AsyncLookupCallback ( void * param, - const wchar name[], + const wchar_t name[], unsigned addrCount, const NetAddress addrs[] ) { @@ -660,7 +660,7 @@ void CliGkConn::TimerPing () { // Send a ping request pingSendTimeMs = GetNonZeroTimeMs(); - const unsigned_ptr msg[] = { + const uintptr_t msg[] = { kCli2GateKeeper_PingRequest, pingSendTimeMs, 0, // not a transaction @@ -673,7 +673,7 @@ void CliGkConn::TimerPing () { } //============================================================================ -void CliGkConn::Send (const unsigned_ptr fields[], unsigned count) { +void CliGkConn::Send (const uintptr_t fields[], unsigned count) { critsect.Enter(); { NetCliSend(cli, fields, count); @@ -691,7 +691,7 @@ void CliGkConn::Send (const unsigned_ptr fields[], unsigned count) { //============================================================================ static bool Recv_PingReply ( - const byte msg[], + const uint8_t msg[], unsigned bytes, void * ) { @@ -706,7 +706,7 @@ static bool Recv_PingReply ( //============================================================================ static bool Recv_FileSrvIpAddressReply ( - const byte msg[], + const uint8_t msg[], unsigned bytes, void * ) { @@ -720,7 +720,7 @@ static bool Recv_FileSrvIpAddressReply ( //============================================================================ static bool Recv_AuthSrvIpAddressReply ( - const byte msg[], + const uint8_t msg[], unsigned bytes, void * ) { @@ -774,7 +774,7 @@ PingRequestTrans::PingRequestTrans ( , m_param(param) , m_pingAtMs(pingAtMs) { - m_payload.Set((const byte *)payload, payloadBytes); + m_payload.Set((const uint8_t *)payload, payloadBytes); } //============================================================================ @@ -783,12 +783,12 @@ bool PingRequestTrans::Send () { if (!AcquireConn()) return false; - const unsigned_ptr msg[] = { + const uintptr_t msg[] = { kCli2GateKeeper_PingRequest, m_pingAtMs, m_transId, m_payload.Count(), - (unsigned_ptr) m_payload.Ptr(), + (uintptr_t) m_payload.Ptr(), }; m_conn->Send(msg, arrsize(msg)); @@ -811,7 +811,7 @@ void PingRequestTrans::Post () { //============================================================================ bool PingRequestTrans::Recv ( - const byte msg[], + const uint8_t msg[], unsigned bytes ) { const GateKeeper2Cli_PingReply & reply = *(const GateKeeper2Cli_PingReply *)msg; @@ -850,7 +850,7 @@ bool FileSrvIpAddressRequestTrans::Send () { return false; - const unsigned_ptr msg[] = { + const uintptr_t msg[] = { kCli2GateKeeper_FileSrvIpAddressRequest, m_transId, m_isPatcher == true ? 1 : 0 @@ -873,7 +873,7 @@ void FileSrvIpAddressRequestTrans::Post () { //============================================================================ bool FileSrvIpAddressRequestTrans::Recv ( - const byte msg[], + const uint8_t msg[], unsigned bytes ) { const GateKeeper2Cli_FileSrvIpAddressReply & reply = *(const GateKeeper2Cli_FileSrvIpAddressReply *)msg; @@ -909,7 +909,7 @@ bool AuthSrvIpAddressRequestTrans::Send () { if (!AcquireConn()) return false; - const unsigned_ptr msg[] = { + const uintptr_t msg[] = { kCli2GateKeeper_AuthSrvIpAddressRequest, m_transId, }; @@ -931,7 +931,7 @@ void AuthSrvIpAddressRequestTrans::Post () { //============================================================================ bool AuthSrvIpAddressRequestTrans::Recv ( - const byte msg[], + const uint8_t msg[], unsigned bytes ) { const GateKeeper2Cli_AuthSrvIpAddressReply & reply = *(const GateKeeper2Cli_AuthSrvIpAddressReply *)msg; @@ -1065,14 +1065,14 @@ unsigned GateKeeperGetConnId () { //============================================================================ void NetCliGateKeeperStartConnect ( - const wchar * gateKeeperAddrList[], + const wchar_t * gateKeeperAddrList[], unsigned gateKeeperAddrCount ) { gateKeeperAddrCount = min(gateKeeperAddrCount, 1); for (unsigned i = 0; i < gateKeeperAddrCount; ++i) { // Do we need to lookup the address? - const wchar * name = gateKeeperAddrList[i]; + const wchar_t * name = gateKeeperAddrList[i]; while (unsigned ch = *name) { ++name; if (!(isdigit(ch) || ch == L'.' || ch == L':')) { @@ -1114,7 +1114,7 @@ void NetCliGateKeeperPingRequest ( FNetCliGateKeeperPingRequestCallback callback, void * param ) { - PingRequestTrans * trans = NEW(PingRequestTrans)( + PingRequestTrans * trans = new PingRequestTrans( callback, param, pingTimeMs, @@ -1130,7 +1130,7 @@ void NetCliGateKeeperFileSrvIpAddressRequest ( void * param, bool isPatcher ) { - FileSrvIpAddressRequestTrans * trans = NEW(FileSrvIpAddressRequestTrans)(callback, param, isPatcher); + FileSrvIpAddressRequestTrans * trans = new FileSrvIpAddressRequestTrans(callback, param, isPatcher); NetTransSend(trans); } @@ -1139,6 +1139,6 @@ void NetCliGateKeeperAuthSrvIpAddressRequest ( FNetCliGateKeeperAuthSrvIpAddressRequestCallback callback, void * param ) { - AuthSrvIpAddressRequestTrans * trans = NEW(AuthSrvIpAddressRequestTrans)(callback, param); + AuthSrvIpAddressRequestTrans * trans = new AuthSrvIpAddressRequestTrans(callback, param); NetTransSend(trans); } diff --git a/Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglGateKeeper.h b/Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglGateKeeper.h index 7ba0da50..c7beb0c5 100644 --- a/Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglGateKeeper.h +++ b/Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglGateKeeper.h @@ -62,7 +62,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // Connect //============================================================================ void NetCliGateKeeperStartConnect ( - const wchar * gateKeeperAddrList[], + const wchar_t * gateKeeperAddrList[], unsigned gateKeeperAddrCount ); @@ -91,8 +91,8 @@ typedef void (*FNetCliGateKeeperPingRequestCallback)( void * param, unsigned pingAtMs, unsigned replyAtMs, - unsigned payloadbytes, - const byte payload[] + unsigned payloadBytes, + const uint8_t payload[] ); void NetCliGateKeeperPingRequest ( unsigned pingTimeMs, @@ -109,7 +109,7 @@ void NetCliGateKeeperPingRequest ( typedef void (*FNetCliGateKeeperFileSrvIpAddressRequestCallback)( ENetError result, void * param, - const wchar addr[] + const wchar_t addr[] ); void NetCliGateKeeperFileSrvIpAddressRequest ( @@ -125,7 +125,7 @@ void NetCliGateKeeperFileSrvIpAddressRequest ( typedef void (*FNetCliGateKeeperAuthSrvIpAddressRequestCallback)( ENetError result, void * param, - const wchar addr[] + const wchar_t addr[] ); void NetCliGateKeeperAuthSrvIpAddressRequest ( diff --git a/Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglTrans.cpp b/Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglTrans.cpp index d9d90cf5..eb3bfea1 100644 --- a/Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglTrans.cpp +++ b/Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglTrans.cpp @@ -211,7 +211,7 @@ void NetTransSend (NetTrans * trans) { } //============================================================================ -bool NetTransRecv (unsigned transId, const byte msg[], unsigned bytes) { +bool NetTransRecv (unsigned transId, const uint8_t msg[], unsigned bytes) { NetTrans * trans = FindTransIncRef(transId, "Recv"); if (!trans) diff --git a/Sources/Plasma/PubUtilLib/plNetMessage/plNetCommonMessage.h b/Sources/Plasma/PubUtilLib/plNetMessage/plNetCommonMessage.h index c7089c1e..5b2b7b71 100644 --- a/Sources/Plasma/PubUtilLib/plNetMessage/plNetCommonMessage.h +++ b/Sources/Plasma/PubUtilLib/plNetMessage/plNetCommonMessage.h @@ -42,7 +42,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #ifndef plNetCommonMessage_inc #define plNetCommonMessage_inc -#include "hsTypes.h" +#include "HeadSpin.h" #include "hsSafeRefCnt.h" // @@ -72,7 +72,7 @@ class plNetCommonMessage private: plNetCommonMessageData* fMsgData; protected: - UInt32 fLen; // sent + uint32_t fLen; // sent public: plNetCommonMessage() : fLen(0),fMsgData(nil) {} virtual ~plNetCommonMessage() { hsRefCnt_SafeUnRef(fMsgData); } @@ -80,7 +80,7 @@ public: // setters void SetData(char *d) { - plNetCommonMessageData* n = d ? TRACKED_NEW plNetCommonMessageData(d) : nil; + plNetCommonMessageData* n = d ? new plNetCommonMessageData(d) : nil; hsRefCnt_SafeAssign(fMsgData, n); hsRefCnt_SafeUnRef(n); } @@ -88,12 +88,12 @@ public: { hsRefCnt_SafeAssign(fMsgData, d); } - void SetLen(UInt32 l) { fLen=l; } + void SetLen(uint32_t l) { fLen=l; } // getters char* GetData() const { return fMsgData ? fMsgData->GetData() : nil; } - virtual UInt32 GetDataLen() { return fLen; } - UInt32 GetLen() const { return fLen; } + virtual uint32_t GetDataLen() { return fLen; } + uint32_t GetLen() const { return fLen; } plNetCommonMessageData* GetMsgData() const { return fMsgData; } }; #endif // plNetCommonMessage_inc diff --git a/Sources/Plasma/PubUtilLib/plNetMessage/plNetMessage.cpp b/Sources/Plasma/PubUtilLib/plNetMessage/plNetMessage.cpp index 49d7248d..2bb231b4 100644 --- a/Sources/Plasma/PubUtilLib/plNetMessage/plNetMessage.cpp +++ b/Sources/Plasma/PubUtilLib/plNetMessage/plNetMessage.cpp @@ -39,7 +39,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com Mead, WA 99021 *==LICENSE==*/ -#include "hsWindows.h" + #include "hsResMgr.h" #include "plNetMessage.h" #include "plNetCommonMessage.h" @@ -70,8 +70,8 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // static // // see plNetMsgVersion.h -const UInt8 plNetMessage::kVerMajor = PLASMA2_NETMSG_MAJOR_VERSION; -const UInt8 plNetMessage::kVerMinor = PLASMA2_NETMSG_MINOR_VERSION; +const uint8_t plNetMessage::kVerMajor = PLASMA2_NETMSG_MAJOR_VERSION; +const uint8_t plNetMessage::kVerMinor = PLASMA2_NETMSG_MINOR_VERSION; @@ -182,7 +182,7 @@ plNetMessage* plNetMessage::Create(const plNetCommonMessage* msg) return nil; } -int plNetMessage::PokeBuffer(char* bufIn, int bufLen, UInt32 peekOptions) +int plNetMessage::PokeBuffer(char* bufIn, int bufLen, uint32_t peekOptions) { fPeekStatus = 0; @@ -207,12 +207,12 @@ int plNetMessage::PokeBuffer(char* bufIn, int bufLen, UInt32 peekOptions) return ret; } -int plNetMessage::PeekBuffer(const char* bufIn, int bufLen, UInt32 peekOptions, bool forcePeek, plStreamLogger::EventList* el) +int plNetMessage::PeekBuffer(const char* bufIn, int bufLen, uint32_t peekOptions, bool forcePeek, plStreamLogger::EventList* el) { if(!bufLen || bufLen < 1) return 0; - UInt32 partialPeekOptions = (peekOptions & kPartialPeekMask); + uint32_t partialPeekOptions = (peekOptions & kPartialPeekMask); if (!forcePeek && (fPeekStatus & partialPeekOptions) ) return 0; // already peeked, fully or partially @@ -251,7 +251,7 @@ void plNetMessage::IWriteClassIndex(hsStream* stream) } // put in buffer -int plNetMessage::IPokeBuffer(hsStream* stream, UInt32 peekOptions) +int plNetMessage::IPokeBuffer(hsStream* stream, uint32_t peekOptions) { IWriteClassIndex(stream); @@ -284,7 +284,7 @@ void plNetMessage::IReadClassIndex(hsStream* stream) } // get out of buffer -int plNetMessage::IPeekBuffer(hsStream* stream, UInt32 peekOptions) +int plNetMessage::IPeekBuffer(hsStream* stream, uint32_t peekOptions) { IReadClassIndex(stream); @@ -405,7 +405,7 @@ int plNetMessage::GetPackSize() return IPokeBuffer(&nullStream); } -UInt32 plNetMessage::GetNetCoreMsgLen() const +uint32_t plNetMessage::GetNetCoreMsgLen() const { return fNetCoreMsg ? fNetCoreMsg->GetLen() : 0; } @@ -424,7 +424,7 @@ void plNetMessage::ValidatePoke() const //////////////////////////////////////////////////////// // plNetMsgStream //////////////////////////////////////////////////////// -int plNetMsgStream::IPokeBuffer(hsStream* stream, UInt32 peekOptions) +int plNetMsgStream::IPokeBuffer(hsStream* stream, uint32_t peekOptions) { int bytes=plNetMessage::IPokeBuffer(stream, peekOptions); if (bytes) @@ -436,7 +436,7 @@ int plNetMsgStream::IPokeBuffer(hsStream* stream, UInt32 peekOptions) return bytes; } -int plNetMsgStream::IPeekBuffer(hsStream* stream, UInt32 peekOptions) +int plNetMsgStream::IPeekBuffer(hsStream* stream, uint32_t peekOptions) { int bytes=plNetMessage::IPeekBuffer(stream, peekOptions); if (bytes) @@ -452,7 +452,7 @@ int plNetMsgStream::IPeekBuffer(hsStream* stream, UInt32 peekOptions) //////////////////////////////////////////////////////// // plNetMsgGameMessage //////////////////////////////////////////////////////// -int plNetMsgGameMessage::IPokeBuffer(hsStream* stream, UInt32 peekOptions) +int plNetMsgGameMessage::IPokeBuffer(hsStream* stream, uint32_t peekOptions) { int bytes=plNetMsgStream::IPokeBuffer(stream, peekOptions); if (bytes) @@ -471,7 +471,7 @@ int plNetMsgGameMessage::IPokeBuffer(hsStream* stream, UInt32 peekOptions) return bytes; } -int plNetMsgGameMessage::IPeekBuffer(hsStream* stream, UInt32 peekOptions) +int plNetMsgGameMessage::IPeekBuffer(hsStream* stream, uint32_t peekOptions) { int bytes=plNetMsgStream::IPeekBuffer(stream, peekOptions); if (bytes) @@ -550,7 +550,7 @@ void plNetMsgGameMessage::WriteVersion(hsStream* s, hsResMgr* mgr) //////////////////////////////////////////////////////// // plNetMsgGameMessageDirected //////////////////////////////////////////////////////// -int plNetMsgGameMessageDirected::IPokeBuffer(hsStream* stream, UInt32 peekOptions) +int plNetMsgGameMessageDirected::IPokeBuffer(hsStream* stream, uint32_t peekOptions) { int bytes=plNetMsgGameMessage::IPokeBuffer(stream, peekOptions); if (bytes) @@ -562,7 +562,7 @@ int plNetMsgGameMessageDirected::IPokeBuffer(hsStream* stream, UInt32 peekOption return bytes; } -int plNetMsgGameMessageDirected::IPeekBuffer(hsStream* stream, UInt32 peekOptions) +int plNetMsgGameMessageDirected::IPeekBuffer(hsStream* stream, uint32_t peekOptions) { int bytes=plNetMsgGameMessage::IPeekBuffer(stream, peekOptions); if (bytes) @@ -601,7 +601,7 @@ void plNetMsgGameMessageDirected::WriteVersion(hsStream* s, hsResMgr* mgr) //////////////////////////////////////////////////////// // plNetMsgObject //////////////////////////////////////////////////////// -int plNetMsgObject::IPokeBuffer(hsStream* stream, UInt32 peekOptions) +int plNetMsgObject::IPokeBuffer(hsStream* stream, uint32_t peekOptions) { int bytes=plNetMessage::IPokeBuffer(stream, peekOptions); if (bytes) @@ -612,7 +612,7 @@ int plNetMsgObject::IPokeBuffer(hsStream* stream, UInt32 peekOptions) return bytes; } -int plNetMsgObject::IPeekBuffer(hsStream* stream, UInt32 peekOptions) +int plNetMsgObject::IPeekBuffer(hsStream* stream, uint32_t peekOptions) { int bytes=plNetMessage::IPeekBuffer(stream, peekOptions); if (bytes) @@ -652,7 +652,7 @@ void plNetMsgObject::WriteVersion(hsStream* s, hsResMgr* mgr) // plNetMsgStreamedObject //////////////////////////////////////////////////////// -int plNetMsgStreamedObject::IPokeBuffer(hsStream* stream, UInt32 peekOptions) +int plNetMsgStreamedObject::IPokeBuffer(hsStream* stream, uint32_t peekOptions) { int bytes=plNetMsgObject::IPokeBuffer(stream, peekOptions); if (bytes) @@ -663,7 +663,7 @@ int plNetMsgStreamedObject::IPokeBuffer(hsStream* stream, UInt32 peekOptions) return bytes; } -int plNetMsgStreamedObject::IPeekBuffer(hsStream* stream, UInt32 peekOptions) +int plNetMsgStreamedObject::IPeekBuffer(hsStream* stream, uint32_t peekOptions) { int bytes=plNetMsgObject::IPeekBuffer(stream, peekOptions); if (bytes) @@ -727,7 +727,7 @@ void plNetMsgSDLState::ISetDescName() const } } -int plNetMsgSDLState::IPokeBuffer(hsStream* stream, UInt32 peekOptions) +int plNetMsgSDLState::IPokeBuffer(hsStream* stream, uint32_t peekOptions) { ISetDescName(); // stash away the descName before poke/compress plNetMsgStreamedObject::IPokeBuffer(stream, peekOptions); @@ -737,7 +737,7 @@ int plNetMsgSDLState::IPokeBuffer(hsStream* stream, UInt32 peekOptions) return stream->GetPosition(); } -int plNetMsgSDLState::IPeekBuffer(hsStream* stream, UInt32 peekOptions) +int plNetMsgSDLState::IPeekBuffer(hsStream* stream, uint32_t peekOptions) { plNetMsgStreamedObject::IPeekBuffer(stream, peekOptions); stream->LogReadLE( &fIsInitialState, "IsInitialAgeState" ); @@ -756,9 +756,9 @@ void plNetMsgSDLState::ReadVersion(hsStream* s, hsResMgr* mgr) if (contentFlags.IsBitSet(kSDLStateStream)) { - UInt32 len; + uint32_t len; s->LogReadLE(&len,"SDLState StreamLen"); - UInt8* buf = TRACKED_NEW UInt8[len]; + uint8_t* buf = new uint8_t[len]; s->LogRead(len, buf,"SDLState StreamData"); StreamInfo()->SetStreamLen(len); @@ -795,7 +795,7 @@ void plNetMsgSDLState::WriteVersion(hsStream* s, hsResMgr* mgr) // plNetMsgSDLStateBCast //////////////////////////////////////////////////////// -int plNetMsgSDLStateBCast::IPokeBuffer(hsStream* stream, UInt32 peekOptions) +int plNetMsgSDLStateBCast::IPokeBuffer(hsStream* stream, uint32_t peekOptions) { int bytes = plNetMsgSDLState::IPokeBuffer(stream, peekOptions); if (bytes) @@ -805,7 +805,7 @@ int plNetMsgSDLStateBCast::IPokeBuffer(hsStream* stream, UInt32 peekOptions) return bytes; } -int plNetMsgSDLStateBCast::IPeekBuffer(hsStream* stream, UInt32 peekOptions) +int plNetMsgSDLStateBCast::IPeekBuffer(hsStream* stream, uint32_t peekOptions) { int bytes=plNetMsgSDLState::IPeekBuffer(stream, peekOptions); if (bytes) @@ -828,7 +828,7 @@ void plNetMsgSDLStateBCast::WriteVersion(hsStream* s, hsResMgr* mgr) //////////////////////////////////////////////////////// // plNetMsgRoomsList //////////////////////////////////////////////////////// -int plNetMsgRoomsList::IPokeBuffer(hsStream* stream, UInt32 peekOptions) +int plNetMsgRoomsList::IPokeBuffer(hsStream* stream, uint32_t peekOptions) { int bytes=plNetMessage::IPokeBuffer(stream, peekOptions); if (bytes) @@ -848,7 +848,7 @@ int plNetMsgRoomsList::IPokeBuffer(hsStream* stream, UInt32 peekOptions) return bytes; } -int plNetMsgRoomsList::IPeekBuffer(hsStream* stream, UInt32 peekOptions) +int plNetMsgRoomsList::IPeekBuffer(hsStream* stream, uint32_t peekOptions) { int bytes=plNetMessage::IPeekBuffer(stream, peekOptions); if (bytes) @@ -894,7 +894,7 @@ int plNetMsgRoomsList::FindRoomLocation(plLocation loc) //////////////////////////////////////////////////////// // plNetMsgPagingRoom //////////////////////////////////////////////////////// -int plNetMsgPagingRoom::IPokeBuffer(hsStream* stream, UInt32 peekOptions) +int plNetMsgPagingRoom::IPokeBuffer(hsStream* stream, uint32_t peekOptions) { int bytes=plNetMsgRoomsList::IPokeBuffer(stream, peekOptions); if (bytes) @@ -905,7 +905,7 @@ int plNetMsgPagingRoom::IPokeBuffer(hsStream* stream, UInt32 peekOptions) return bytes; } -int plNetMsgPagingRoom::IPeekBuffer(hsStream* stream, UInt32 peekOptions) +int plNetMsgPagingRoom::IPeekBuffer(hsStream* stream, uint32_t peekOptions) { int bytes=plNetMsgRoomsList::IPeekBuffer(stream, peekOptions); if (bytes) @@ -919,7 +919,7 @@ int plNetMsgPagingRoom::IPeekBuffer(hsStream* stream, UInt32 peekOptions) //////////////////////////////////////////////////////// // plNetMsgGroupOwner //////////////////////////////////////////////////////// -int plNetMsgGroupOwner::IPokeBuffer(hsStream* stream, UInt32 peekOptions) +int plNetMsgGroupOwner::IPokeBuffer(hsStream* stream, uint32_t peekOptions) { int bytes=plNetMsgServerToClient::IPokeBuffer(stream, peekOptions); if (bytes) @@ -934,7 +934,7 @@ int plNetMsgGroupOwner::IPokeBuffer(hsStream* stream, UInt32 peekOptions) return bytes; } -int plNetMsgGroupOwner::IPeekBuffer(hsStream* stream, UInt32 peekOptions) +int plNetMsgGroupOwner::IPeekBuffer(hsStream* stream, uint32_t peekOptions) { int bytes=plNetMsgServerToClient::IPeekBuffer(stream, peekOptions); if (bytes) @@ -966,7 +966,7 @@ void plNetMsgSharedState::CopySharedState(plNetSharedState* ss) StreamInfo()->CopyStream(&stream); } -int plNetMsgSharedState::IPokeBuffer(hsStream* stream, UInt32 peekOptions) +int plNetMsgSharedState::IPokeBuffer(hsStream* stream, uint32_t peekOptions) { int bytes=plNetMsgStreamedObject::IPokeBuffer(stream, peekOptions); if (bytes) @@ -977,7 +977,7 @@ int plNetMsgSharedState::IPokeBuffer(hsStream* stream, UInt32 peekOptions) return bytes; } -int plNetMsgSharedState::IPeekBuffer(hsStream* stream, UInt32 peekOptions) +int plNetMsgSharedState::IPeekBuffer(hsStream* stream, uint32_t peekOptions) { int bytes=plNetMsgStreamedObject::IPeekBuffer(stream, peekOptions); if (bytes) @@ -1014,7 +1014,7 @@ void plNetMsgSharedState::WriteVersion(hsStream* s, hsResMgr* mgr) //////////////////////////////////////////////////////// // plNetMsgGetSharedState //////////////////////////////////////////////////////// -int plNetMsgGetSharedState::IPokeBuffer(hsStream* stream, UInt32 peekOptions) +int plNetMsgGetSharedState::IPokeBuffer(hsStream* stream, uint32_t peekOptions) { int bytes=plNetMsgObject::IPokeBuffer(stream, peekOptions); if (bytes) @@ -1025,7 +1025,7 @@ int plNetMsgGetSharedState::IPokeBuffer(hsStream* stream, UInt32 peekOptions) return bytes; } -int plNetMsgGetSharedState::IPeekBuffer(hsStream* stream, UInt32 peekOptions) +int plNetMsgGetSharedState::IPeekBuffer(hsStream* stream, uint32_t peekOptions) { int bytes=plNetMsgObject::IPeekBuffer(stream, peekOptions); if (bytes) @@ -1041,7 +1041,7 @@ int plNetMsgGetSharedState::IPeekBuffer(hsStream* stream, UInt32 peekOptions) //////////////////////////////////////////////////////// // plNetMsgObject //////////////////////////////////////////////////////// -int plNetMsgObjectUpdateFilter::IPokeBuffer(hsStream* stream, UInt32 peekOptions) +int plNetMsgObjectUpdateFilter::IPokeBuffer(hsStream* stream, uint32_t peekOptions) { int bytes=plNetMessage::IPokeBuffer(stream, peekOptions); if (bytes) @@ -1054,7 +1054,7 @@ int plNetMsgObjectUpdateFilter::IPokeBuffer(hsStream* stream, UInt32 peekOptions return bytes; } -int plNetMsgObjectUpdateFilter::IPeekBuffer(hsStream* stream, UInt32 peekOptions) +int plNetMsgObjectUpdateFilter::IPeekBuffer(hsStream* stream, uint32_t peekOptions) { int bytes=plNetMessage::IPeekBuffer(stream, peekOptions); if (bytes) @@ -1072,7 +1072,7 @@ int plNetMsgObjectUpdateFilter::IPeekBuffer(hsStream* stream, UInt32 peekOptions //////////////////////////////////////////////////////// // plNetMsgMembersList //////////////////////////////////////////////////////// -int plNetMsgMembersList::IPokeBuffer(hsStream* stream, UInt32 peekOptions) +int plNetMsgMembersList::IPokeBuffer(hsStream* stream, uint32_t peekOptions) { int bytes=plNetMsgServerToClient::IPokeBuffer(stream, peekOptions); if (bytes) @@ -1083,7 +1083,7 @@ int plNetMsgMembersList::IPokeBuffer(hsStream* stream, UInt32 peekOptions) return bytes; } -int plNetMsgMembersList::IPeekBuffer(hsStream* stream, UInt32 peekOptions) +int plNetMsgMembersList::IPeekBuffer(hsStream* stream, uint32_t peekOptions) { int bytes=plNetMsgServerToClient::IPeekBuffer(stream, peekOptions); if (bytes) @@ -1098,7 +1098,7 @@ int plNetMsgMembersList::IPeekBuffer(hsStream* stream, UInt32 peekOptions) //////////////////////////////////////////////////////// // plNetMsgMemberUpdate //////////////////////////////////////////////////////// -int plNetMsgMemberUpdate::IPokeBuffer(hsStream* stream, UInt32 peekOptions) +int plNetMsgMemberUpdate::IPokeBuffer(hsStream* stream, uint32_t peekOptions) { int bytes=plNetMsgServerToClient::IPokeBuffer(stream, peekOptions); if (bytes) @@ -1114,7 +1114,7 @@ int plNetMsgMemberUpdate::IPokeBuffer(hsStream* stream, UInt32 peekOptions) return bytes; } -int plNetMsgMemberUpdate::IPeekBuffer(hsStream* stream, UInt32 peekOptions) +int plNetMsgMemberUpdate::IPeekBuffer(hsStream* stream, uint32_t peekOptions) { int bytes=plNetMsgServerToClient::IPeekBuffer(stream, peekOptions); if (bytes) @@ -1131,7 +1131,7 @@ int plNetMsgMemberUpdate::IPeekBuffer(hsStream* stream, UInt32 peekOptions) //////////////////////////////////////////////////////// // plNetMsgVoice //////////////////////////////////////////////////////// -int plNetMsgVoice::IPokeBuffer(hsStream* stream, UInt32 peekOptions) +int plNetMsgVoice::IPokeBuffer(hsStream* stream, uint32_t peekOptions) { plNetMessage::IPokeBuffer(stream, peekOptions); stream->WriteLE(fFlags); @@ -1141,7 +1141,7 @@ int plNetMsgVoice::IPokeBuffer(hsStream* stream, UInt32 peekOptions) return stream->GetPosition(); } -int plNetMsgVoice::IPeekBuffer(hsStream* stream, UInt32 peekOptions) +int plNetMsgVoice::IPeekBuffer(hsStream* stream, uint32_t peekOptions) { int bytes=plNetMessage::IPeekBuffer(stream, peekOptions); if (bytes) @@ -1161,7 +1161,7 @@ void plNetMsgVoice::ReadVersion(hsStream* s, hsResMgr* mgr) { plNetMessage::ReadVersion(s,mgr); - UInt16 old = 0; + uint16_t old = 0; hsBitVector contentFlags; contentFlags.Read(s); @@ -1207,7 +1207,7 @@ const char *plNetMsgVoice::GetVoiceData() const //////////////////////////////////////////////////////// // plNetMsgListenListUpdate //////////////////////////////////////////////////////// -int plNetMsgListenListUpdate::IPokeBuffer(hsStream* stream, UInt32 peekOptions) +int plNetMsgListenListUpdate::IPokeBuffer(hsStream* stream, uint32_t peekOptions) { int bytes=plNetMessage::IPokeBuffer(stream, peekOptions); stream->WriteLE(fAdding); @@ -1215,7 +1215,7 @@ int plNetMsgListenListUpdate::IPokeBuffer(hsStream* stream, UInt32 peekOptions) return stream->GetPosition(); } -int plNetMsgListenListUpdate::IPeekBuffer(hsStream* stream, UInt32 peekOptions) +int plNetMsgListenListUpdate::IPeekBuffer(hsStream* stream, uint32_t peekOptions) { int bytes=plNetMessage::IPeekBuffer(stream, peekOptions); if (bytes) @@ -1232,7 +1232,7 @@ int plNetMsgListenListUpdate::IPeekBuffer(hsStream* stream, UInt32 peekOptions) // plNetMsgPlayerPage //////////////////////////////////////////////////////////////////// -int plNetMsgPlayerPage::IPokeBuffer( hsStream* stream, UInt32 peekOptions ) +int plNetMsgPlayerPage::IPokeBuffer( hsStream* stream, uint32_t peekOptions ) { plNetMessage::IPokeBuffer( stream, peekOptions ); stream->WriteLE( fUnload ); @@ -1241,7 +1241,7 @@ int plNetMsgPlayerPage::IPokeBuffer( hsStream* stream, UInt32 peekOptions ) return stream->GetPosition(); } -int plNetMsgPlayerPage::IPeekBuffer( hsStream* stream, UInt32 peekOptions ) +int plNetMsgPlayerPage::IPeekBuffer( hsStream* stream, uint32_t peekOptions ) { int bytes = plNetMessage::IPeekBuffer(stream, peekOptions ); if ( bytes ) @@ -1258,7 +1258,7 @@ int plNetMsgPlayerPage::IPeekBuffer( hsStream* stream, UInt32 peekOptions ) // plNetMsgLoadClone //////////////////////////////////////////////////////////////////// -int plNetMsgLoadClone::IPokeBuffer( hsStream* stream, UInt32 peekOptions ) +int plNetMsgLoadClone::IPokeBuffer( hsStream* stream, uint32_t peekOptions ) { int bytes = plNetMsgGameMessage::IPokeBuffer( stream, peekOptions ); if ( bytes ) @@ -1272,7 +1272,7 @@ int plNetMsgLoadClone::IPokeBuffer( hsStream* stream, UInt32 peekOptions ) return bytes; } -int plNetMsgLoadClone::IPeekBuffer( hsStream* stream, UInt32 peekOptions ) +int plNetMsgLoadClone::IPeekBuffer( hsStream* stream, uint32_t peekOptions ) { stream->LogSubStreamPushDesc("LoadClone"); int bytes = plNetMsgGameMessage::IPeekBuffer(stream, peekOptions ); @@ -1326,14 +1326,14 @@ void plNetMsgLoadClone::WriteVersion(hsStream* s, hsResMgr* mgr) //////////////////////////////////////////////////////////////////// -int plNetMsgInitialAgeStateSent::IPokeBuffer( hsStream* stream, UInt32 peekOptions ) +int plNetMsgInitialAgeStateSent::IPokeBuffer( hsStream* stream, uint32_t peekOptions ) { plNetMessage::IPokeBuffer( stream, peekOptions ); stream->WriteLE( fNumInitialSDLStates ); return stream->GetPosition(); } -int plNetMsgInitialAgeStateSent::IPeekBuffer( hsStream* stream, UInt32 peekOptions ) +int plNetMsgInitialAgeStateSent::IPeekBuffer( hsStream* stream, uint32_t peekOptions ) { stream->LogSubStreamPushDesc("InitialAgeStateSent"); int bytes=plNetMessage::IPeekBuffer(stream, peekOptions ); @@ -1350,7 +1350,7 @@ int plNetMsgInitialAgeStateSent::IPeekBuffer( hsStream* stream, UInt32 peekOptio // plNetMsgRelevanceRegions //////////////////////////////////////////////////////////////////// -int plNetMsgRelevanceRegions::IPokeBuffer( hsStream* stream, UInt32 peekOptions ) +int plNetMsgRelevanceRegions::IPokeBuffer( hsStream* stream, uint32_t peekOptions ) { plNetMessage::IPokeBuffer( stream, peekOptions ); fRegionsICareAbout.Write(stream); @@ -1359,7 +1359,7 @@ int plNetMsgRelevanceRegions::IPokeBuffer( hsStream* stream, UInt32 peekOptions return stream->GetPosition(); } -int plNetMsgRelevanceRegions::IPeekBuffer( hsStream* stream, UInt32 peekOptions ) +int plNetMsgRelevanceRegions::IPeekBuffer( hsStream* stream, uint32_t peekOptions ) { stream->LogSubStreamPushDesc("RelevanceRegions"); int bytes=plNetMessage::IPeekBuffer(stream, peekOptions ); diff --git a/Sources/Plasma/PubUtilLib/plNetMessage/plNetMessage.h b/Sources/Plasma/PubUtilLib/plNetMessage/plNetMessage.h index d815c2ba..4719ba89 100644 --- a/Sources/Plasma/PubUtilLib/plNetMessage/plNetMessage.h +++ b/Sources/Plasma/PubUtilLib/plNetMessage/plNetMessage.h @@ -42,8 +42,8 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #ifndef plNetMessage_h_inc #define plNetMessage_h_inc -#include "hsUtils.h" -#include "hsTypes.h" + +#include "HeadSpin.h" #include "hsStlUtils.h" #include "hsStream.h" #include "hsBitVector.h" @@ -82,18 +82,18 @@ class plNetMessage : public plCreatable { friend class plNetServerMsgPlsRoutableMsg; - UInt32 fFlags; // indicates what is present in the message, always transmitted + uint32_t fFlags; // indicates what is present in the message, always transmitted plUnifiedTime fTimeSent; // time msg was sent (in sender's unified timeSpace), always transmitted to and from the client double fTimeRecvd; // time msg was recvd (in rcvrs timeSpace), never transmitted - UInt32 fBytesRead; // amount of data we've already read, never transmitted - UInt32 fContext; // set by sender, included in reply. Only written if kHasContext flag set - UInt32 fTransactionID; // set by originator, included in reply. Only written if kHasTransactionID flag set - UInt32 fPlayerID; // set by originator. Only written if kHasPlayerID flag set + uint32_t fBytesRead; // amount of data we've already read, never transmitted + uint32_t fContext; // set by sender, included in reply. Only written if kHasContext flag set + uint32_t fTransactionID; // set by originator, included in reply. Only written if kHasTransactionID flag set + uint32_t fPlayerID; // set by originator. Only written if kHasPlayerID flag set plUUID fAcctUUID; // set by sender (app level). Only written if kHasAcctUUID flag set const plNetCommonMessage* fNetCoreMsg; // not sent, set by the receiver - UInt32 fPeekStatus; // not sent. set on PeekBuffer, cleared on PokeBuffer - UInt8 fProtocolVerMajor; // conditionally sent - UInt8 fProtocolVerMinor; // conditionally sent + uint32_t fPeekStatus; // not sent. set on PeekBuffer, cleared on PokeBuffer + uint8_t fProtocolVerMajor; // conditionally sent + uint8_t fProtocolVerMinor; // conditionally sent ENetProtocol fNetProtocol; // the server this msg should be sent to. this value is not sent over wire. enum ContentFlags @@ -107,20 +107,20 @@ class plNetMessage : public plCreatable }; protected: - virtual int IPokeBuffer(hsStream* stream, UInt32 peekOptions=0); - virtual int IPeekBuffer(hsStream* stream, UInt32 peekOptions=0); + virtual int IPokeBuffer(hsStream* stream, uint32_t peekOptions=0); + virtual int IPeekBuffer(hsStream* stream, uint32_t peekOptions=0); void IWriteClassIndex(hsStream* stream); void IReadClassIndex(hsStream* stream); bool IPeeked() const { return fPeekStatus==kFullyPeeked;} - void ISetPeekStatus(UInt32 s) { fPeekStatus=s; } + void ISetPeekStatus(uint32_t s) { fPeekStatus=s; } public: - typedef UInt16 plStrLen; - static const UInt8 kVerMajor, kVerMinor; // version of the networking code + typedef uint16_t plStrLen; + static const uint8_t kVerMajor, kVerMinor; // version of the networking code - typedef UInt16 ClassIndexType; // the type returned by plCreatable::ClassIndex() + typedef uint16_t ClassIndexType; // the type returned by plCreatable::ClassIndex() enum { kMaxNameLen=32 @@ -193,8 +193,8 @@ public: static plNetMessage* CreateAndRead(const plNetCommonMessage*, plStreamLogger::EventList* el = nil); static plNetMessage* Create(const plNetCommonMessage*); - int PokeBuffer(char* buf, int bufLen, UInt32 peekOptions=0); // put msg in buffer - int PeekBuffer(const char* buf, int bufLen, UInt32 peekOptions=0, bool forcePeek=false, plStreamLogger::EventList* el = nil); // get msg out of buffer + int PokeBuffer(char* buf, int bufLen, uint32_t peekOptions=0); // put msg in buffer + int PeekBuffer(const char* buf, int bufLen, uint32_t peekOptions=0, bool forcePeek=false, plStreamLogger::EventList* el = nil); // get msg out of buffer bool NeedsReliableSend() const { return IsBitSet(kNeedsReliableSend); } bool IsSystemMessage() const { return IsBitSet(kIsSystemMessage); } virtual void ValidatePoke() const; @@ -209,18 +209,18 @@ public: double GetTimeReceived() const { return fTimeRecvd; } bool IsBitSet(int b) const { return (fFlags & b) != 0; } const plNetCommonMessage* GetNetCoreMsg() const { return fNetCoreMsg; } - UInt32 GetNetCoreMsgLen() const; + uint32_t GetNetCoreMsgLen() const; bool GetHasContext() const { return IsBitSet(kHasContext);} - UInt32 GetContext() const { return fContext;} + uint32_t GetContext() const { return fContext;} bool GetHasTransactionID() const { return IsBitSet(kHasTransactionID);} - UInt32 GetTransactionID() const { return fTransactionID;} + uint32_t GetTransactionID() const { return fTransactionID;} bool GetHasPlayerID() const { return IsBitSet(kHasPlayerID);} - UInt32 GetPlayerID() const { hsAssert(GetHasPlayerID(), "uninit playerID"); return fPlayerID; } - UInt32 JustGetPlayerID() const { return fPlayerID; } + uint32_t GetPlayerID() const { hsAssert(GetHasPlayerID(), "uninit playerID"); return fPlayerID; } + uint32_t JustGetPlayerID() const { return fPlayerID; } bool GetHasAcctUUID() const { return IsBitSet(kHasAcctUUID); } const plUUID * GetAcctUUID() const { return &fAcctUUID; } - UInt8 GetVersionMajor() const { return fProtocolVerMajor; } - UInt8 GetVersionMinor() const { return fProtocolVerMinor; } + uint8_t GetVersionMajor() const { return fProtocolVerMajor; } + uint8_t GetVersionMinor() const { return fProtocolVerMinor; } ENetProtocol GetNetProtocol () const { return fNetProtocol; } // setters @@ -230,14 +230,14 @@ public: void SetBit(int b, bool on=true) { if (on) fFlags |= b; else fFlags &= ~b; } void SetNetCoreMsg(const plNetCommonMessage* ncmsg) { fNetCoreMsg=ncmsg; } void SetHasContext(bool value) { SetBit(kHasContext,value);} - void SetContext(UInt32 value) { fContext=value; SetHasContext(true);} + void SetContext(uint32_t value) { fContext=value; SetHasContext(true);} void SetHasTransactionID(bool value) { SetBit(kHasTransactionID,value);} - void SetTransactionID(UInt32 value) { fTransactionID=value; SetHasTransactionID(true);} + void SetTransactionID(uint32_t value) { fTransactionID=value; SetHasTransactionID(true);} void SetHasPlayerID(bool value) { SetBit(kHasPlayerID,value);} - void SetPlayerID(UInt32 value) { fPlayerID=value; SetHasPlayerID(true);} + void SetPlayerID(uint32_t value) { fPlayerID=value; SetHasPlayerID(true);} void SetHasAcctUUID( bool v ) { SetBit( kHasAcctUUID,v ); } void SetAcctUUID(const plUUID * v ) { fAcctUUID.CopyFrom(v); SetHasAcctUUID(true); } - void SetVersion(UInt8 maj=kVerMajor, UInt8 min=kVerMinor) { SetBit(kHasVersion); fProtocolVerMajor=maj; fProtocolVerMinor=min; } + void SetVersion(uint8_t maj=kVerMajor, uint8_t min=kVerMinor) { SetBit(kHasVersion); fProtocolVerMajor=maj; fProtocolVerMinor=min; } void SetNetProtocol (ENetProtocol v ) { fNetProtocol = v; } // init fContext, fTransactionID, etc. if needed. @@ -294,8 +294,8 @@ class plNetMsgStream : public plNetMessage protected: plNetMsgStreamHelper fStreamHelper; - int IPokeBuffer(hsStream* stream, UInt32 peekOptions=0); - int IPeekBuffer(hsStream* stream, UInt32 peekOptions=0); + int IPokeBuffer(hsStream* stream, uint32_t peekOptions=0); + int IPeekBuffer(hsStream* stream, uint32_t peekOptions=0); public: CLASSNAME_REGISTER( plNetMsgStream ); GETINTERFACE_ANY_AUX(plNetMsgStream,plNetMessage,plNetMsgStreamHelper,fStreamHelper) @@ -316,8 +316,8 @@ private: }; protected: plNetMsgObjectHelper fObjectHelper; - int IPokeBuffer(hsStream* stream, UInt32 peekOptions=0); - int IPeekBuffer(hsStream* stream, UInt32 peekOptions=0); + int IPokeBuffer(hsStream* stream, uint32_t peekOptions=0); + int IPeekBuffer(hsStream* stream, uint32_t peekOptions=0); public: CLASSNAME_REGISTER( plNetMsgObject ); GETINTERFACE_ANY_AUX(plNetMsgObject,plNetMessage,plNetMsgObjectHelper,fObjectHelper) @@ -349,8 +349,8 @@ private: protected: plNetMsgStreamHelper fStreamHelper; - int IPokeBuffer(hsStream* stream, UInt32 peekOptions=0); - int IPeekBuffer(hsStream* stream, UInt32 peekOptions=0); + int IPokeBuffer(hsStream* stream, uint32_t peekOptions=0); + int IPeekBuffer(hsStream* stream, uint32_t peekOptions=0); public: plNetMsgStreamedObject() {} ~plNetMsgStreamedObject() {} @@ -385,8 +385,8 @@ private: bool fIsInitialState; protected: - int IPokeBuffer(hsStream* stream, UInt32 peekOptions=0); - int IPeekBuffer(hsStream* stream, UInt32 peekOptions=0); + int IPokeBuffer(hsStream* stream, uint32_t peekOptions=0); + int IPeekBuffer(hsStream* stream, uint32_t peekOptions=0); bool fPersistOnServer; bool fIsAvatarState; @@ -418,8 +418,8 @@ public: class plNetMsgSDLStateBCast : public plNetMsgSDLState { protected: - int IPokeBuffer(hsStream* stream, UInt32 peekOptions=0); - int IPeekBuffer(hsStream* stream, UInt32 peekOptions=0); + int IPokeBuffer(hsStream* stream, uint32_t peekOptions=0); + int IPeekBuffer(hsStream* stream, uint32_t peekOptions=0); public: CLASSNAME_REGISTER( plNetMsgSDLStateBCast ); GETINTERFACE_ANY(plNetMsgSDLStateBCast, plNetMsgSDLState); @@ -453,8 +453,8 @@ protected: std::vector fRooms; std::vector fRoomNames; // for debug usage only - int IPokeBuffer(hsStream* stream, UInt32 peekOptions=0); - int IPeekBuffer(hsStream* stream, UInt32 peekOptions=0); + int IPokeBuffer(hsStream* stream, uint32_t peekOptions=0); + int IPeekBuffer(hsStream* stream, uint32_t peekOptions=0); public: plNetMsgRoomsList() {} ~plNetMsgRoomsList() {}; @@ -481,8 +481,8 @@ class plNetMsgGameMessage: public plNetMsgStream protected: plClientUnifiedTime fDeliveryTime; // for future timestamping - int IPokeBuffer(hsStream* stream, UInt32 peekOptions=0); - int IPeekBuffer(hsStream* stream, UInt32 peekOptions=0); + int IPokeBuffer(hsStream* stream, uint32_t peekOptions=0); + int IPeekBuffer(hsStream* stream, uint32_t peekOptions=0); public: plNetMsgGameMessage() { SetBit(kNeedsReliableSend); } @@ -530,8 +530,8 @@ protected: bool fIsInitialState; plNetMsgObjectHelper fObjectHelper; - int IPokeBuffer(hsStream* stream, UInt32 peekOptions=0); - int IPeekBuffer(hsStream* stream, UInt32 peekOptions=0); + int IPokeBuffer(hsStream* stream, uint32_t peekOptions=0); + int IPeekBuffer(hsStream* stream, uint32_t peekOptions=0); public: CLASSNAME_REGISTER( plNetMsgLoadClone ); @@ -568,8 +568,8 @@ public: class plNetMsgPlayerPage : public plNetMessage { protected: - int IPokeBuffer(hsStream* stream, UInt32 peekOptions=0); - int IPeekBuffer(hsStream* stream, UInt32 peekOptions=0); + int IPokeBuffer(hsStream* stream, uint32_t peekOptions=0); + int IPeekBuffer(hsStream* stream, uint32_t peekOptions=0); public: plUoid fUoid; bool fUnload; @@ -594,8 +594,8 @@ private: protected: plNetMsgReceiversListHelper fReceivers; - int IPokeBuffer(hsStream* stream, UInt32 peekOptions=0); - int IPeekBuffer(hsStream* stream, UInt32 peekOptions=0); + int IPokeBuffer(hsStream* stream, uint32_t peekOptions=0); + int IPeekBuffer(hsStream* stream, uint32_t peekOptions=0); public: CLASSNAME_REGISTER( plNetMsgGameMessageDirected ); GETINTERFACE_ANY_AUX(plNetMsgGameMessageDirected,plNetMsgGameMessage, @@ -622,10 +622,10 @@ public: kFinalRoomInAge=0x8 // done paging in the age }; protected: - UInt8 fPageFlags; + uint8_t fPageFlags; - int IPokeBuffer(hsStream* stream, UInt32 peekOptions=0); - int IPeekBuffer(hsStream* stream, UInt32 peekOptions=0); + int IPokeBuffer(hsStream* stream, uint32_t peekOptions=0); + int IPeekBuffer(hsStream* stream, uint32_t peekOptions=0); public: plNetMsgPagingRoom() : fPageFlags(0) { SetBit(kIsSystemMessage|kNeedsReliableSend); } ~plNetMsgPagingRoom() {} @@ -633,8 +633,8 @@ public: CLASSNAME_REGISTER( plNetMsgPagingRoom ); GETINTERFACE_ANY( plNetMsgPagingRoom, plNetMsgRoomsList ); - void SetPageFlags(UInt8 f) { fPageFlags=f; } - UInt8 GetPageFlags() const { return fPageFlags; } + void SetPageFlags(uint8_t f) { fPageFlags=f; } + uint8_t GetPageFlags() const { return fPageFlags; } void SetPagingOut(hsBool b) { if (b) fPageFlags |= kPagingOut; else fPageFlags&=~kPagingOut; } hsBool GetPagingOut() const { return (fPageFlags & kPagingOut) != 0; } @@ -690,8 +690,8 @@ public: protected: std::vector fGroups; - int IPokeBuffer(hsStream* stream, UInt32 peekOptions=0); - int IPeekBuffer(hsStream* stream, UInt32 peekOptions=0); + int IPokeBuffer(hsStream* stream, uint32_t peekOptions=0); + int IPeekBuffer(hsStream* stream, uint32_t peekOptions=0); public: CLASSNAME_REGISTER( plNetMsgGroupOwner ); GETINTERFACE_ANY( plNetMsgGroupOwner, plNetMsgServerToClient ); @@ -721,14 +721,14 @@ private: kVoiceData }; protected: - UInt8 fFlags; // voice flags - UInt8 fNumFrames; // number of frames encoded + uint8_t fFlags; // voice flags + uint8_t fNumFrames; // number of frames encoded std::string fVoiceData; plNetMsgReceiversListHelper fReceivers; - int IPokeBuffer(hsStream* stream, UInt32 peekOptions=0); - int IPeekBuffer(hsStream* stream, UInt32 peekOptions=0); + int IPokeBuffer(hsStream* stream, uint32_t peekOptions=0); + int IPeekBuffer(hsStream* stream, uint32_t peekOptions=0); public: plNetMsgVoice(): fFlags(0), fNumFrames(0) { } ~plNetMsgVoice() {} @@ -739,8 +739,8 @@ public: void SetFlag(int f) { fFlags |= f; } int GetFlags() { return fFlags; } - void SetNumFrames(UInt8 f) { fNumFrames = f; } - UInt8 GetNumFrames() const { return fNumFrames; } + void SetNumFrames(uint8_t f) { fNumFrames = f; } + uint8_t GetNumFrames() const { return fNumFrames; } void SetVoiceData(char *data, int len ); int GetVoiceDataLen() const { return fVoiceData.length(); } @@ -777,8 +777,8 @@ private: protected: bool fLockRequest; - int IPokeBuffer(hsStream* stream, UInt32 peekOptions=0); - int IPeekBuffer(hsStream* stream, UInt32 peekOptions=0); + int IPokeBuffer(hsStream* stream, uint32_t peekOptions=0); + int IPeekBuffer(hsStream* stream, uint32_t peekOptions=0); public: plNetMsgSharedState() : fLockRequest(false) {} ~plNetMsgSharedState() {} @@ -822,8 +822,8 @@ class plNetMsgGetSharedState : public plNetMsgObject protected: char fSharedStateName[kMaxNameLen]; - int IPokeBuffer(hsStream* stream, UInt32 peekOptions=0); - int IPeekBuffer(hsStream* stream, UInt32 peekOptions=0); + int IPokeBuffer(hsStream* stream, uint32_t peekOptions=0); + int IPeekBuffer(hsStream* stream, uint32_t peekOptions=0); public: plNetMsgGetSharedState() { *fSharedStateName=0; SetBit(kNeedsReliableSend); } ~plNetMsgGetSharedState() {} @@ -844,8 +844,8 @@ protected: plNetMsgObjectListHelper fObjectListHelper; float fMaxUpdateFreq; // in secs - int IPokeBuffer(hsStream* stream, UInt32 peekOptions=0); - int IPeekBuffer(hsStream* stream, UInt32 peekOptions=0); + int IPokeBuffer(hsStream* stream, uint32_t peekOptions=0); + int IPeekBuffer(hsStream* stream, uint32_t peekOptions=0); public: plNetMsgObjectUpdateFilter() : fMaxUpdateFreq(-1) {} ~plNetMsgObjectUpdateFilter() {} @@ -879,8 +879,8 @@ class plNetMsgMembersList : public plNetMsgServerToClient protected: plNetMsgMemberListHelper fMemberListHelper; protected: - int IPokeBuffer(hsStream* stream, UInt32 peekOptions=0); - int IPeekBuffer(hsStream* stream, UInt32 peekOptions=0); + int IPokeBuffer(hsStream* stream, uint32_t peekOptions=0); + int IPeekBuffer(hsStream* stream, uint32_t peekOptions=0); public: CLASSNAME_REGISTER( plNetMsgMembersList ); GETINTERFACE_ANY_AUX(plNetMsgMembersList,plNetMsgServerToClient,plNetMsgMemberListHelper,fMemberListHelper) @@ -897,8 +897,8 @@ protected: plNetMsgMemberInfoHelper fMemberInfo; bool fAddMember; // else remove member protected: - int IPokeBuffer(hsStream* stream, UInt32 peekOptions=0); - int IPeekBuffer(hsStream* stream, UInt32 peekOptions=0); + int IPokeBuffer(hsStream* stream, uint32_t peekOptions=0); + int IPeekBuffer(hsStream* stream, uint32_t peekOptions=0); public: CLASSNAME_REGISTER( plNetMsgMemberUpdate ); GETINTERFACE_ANY_AUX(plNetMsgMemberUpdate,plNetMsgServerToClient,plNetMsgMemberInfoHelper,fMemberInfo) @@ -922,8 +922,8 @@ private: plNetMsgReceiversListHelper fReceivers; // used by server, the players we're listening to bool fAdding; // else removing - int IPokeBuffer(hsStream* stream, UInt32 peekOptions=0); - int IPeekBuffer(hsStream* stream, UInt32 peekOptions=0); + int IPokeBuffer(hsStream* stream, uint32_t peekOptions=0); + int IPeekBuffer(hsStream* stream, uint32_t peekOptions=0); public: plNetMsgListenListUpdate() : fAdding(false) {} ~plNetMsgListenListUpdate() {} @@ -944,15 +944,15 @@ public: /////////////////////////////////////////////////////////////////// class plNetMsgInitialAgeStateSent : public plNetMsgServerToClient { - UInt32 fNumInitialSDLStates; - int IPokeBuffer(hsStream* stream, UInt32 peekOptions=0); - int IPeekBuffer(hsStream* stream, UInt32 peekOptions=0); + uint32_t fNumInitialSDLStates; + int IPokeBuffer(hsStream* stream, uint32_t peekOptions=0); + int IPeekBuffer(hsStream* stream, uint32_t peekOptions=0); public: plNetMsgInitialAgeStateSent():fNumInitialSDLStates(0){} CLASSNAME_REGISTER( plNetMsgInitialAgeStateSent ); GETINTERFACE_ANY( plNetMsgInitialAgeStateSent, plNetMsgServerToClient); - void SetNumInitialSDLStates( UInt32 n ) { fNumInitialSDLStates=n; } - UInt32 GetNumInitialSDLStates() const { return fNumInitialSDLStates; } + void SetNumInitialSDLStates( uint32_t n ) { fNumInitialSDLStates=n; } + uint32_t GetNumInitialSDLStates() const { return fNumInitialSDLStates; } }; // @@ -964,8 +964,8 @@ protected: hsBitVector fRegionsImIn; hsBitVector fRegionsICareAbout; - int IPokeBuffer(hsStream* stream, UInt32 peekOptions=0); - int IPeekBuffer(hsStream* stream, UInt32 peekOptions=0); + int IPokeBuffer(hsStream* stream, uint32_t peekOptions=0); + int IPeekBuffer(hsStream* stream, uint32_t peekOptions=0); public: plNetMsgRelevanceRegions() { SetBit(kNeedsReliableSend); } ~plNetMsgRelevanceRegions() {} diff --git a/Sources/Plasma/PubUtilLib/plNetMessage/plNetMsgHelpers.cpp b/Sources/Plasma/PubUtilLib/plNetMessage/plNetMsgHelpers.cpp index ca8b0b2b..1a683fa9 100644 --- a/Sources/Plasma/PubUtilLib/plNetMessage/plNetMsgHelpers.cpp +++ b/Sources/Plasma/PubUtilLib/plNetMessage/plNetMsgHelpers.cpp @@ -59,14 +59,14 @@ plNetMsgStreamableHelper & plNetMsgStreamableHelper::operator =(hsStreamable * v return *this; } -int plNetMsgStreamableHelper::Poke(hsStream* stream, UInt32 peekOptions) +int plNetMsgStreamableHelper::Poke(hsStream* stream, uint32_t peekOptions) { hsAssert(fObject, "plNetMsgStreamableHelper::Poke: fObject not set."); fObject->Write(stream); return stream->GetPosition(); } -int plNetMsgStreamableHelper::Peek(hsStream* stream, UInt32 peekOptions) +int plNetMsgStreamableHelper::Peek(hsStream* stream, uint32_t peekOptions) { hsAssert(fObject, "plNetMsgStreamableHelper::Peek: fObject not set."); fObject->Read(stream); @@ -117,18 +117,18 @@ plCreatable * plNetMsgCreatableHelper::GetObject() return fCreatable; } -int plNetMsgCreatableHelper::Poke(hsStream * s, UInt32 peekOptions) +int plNetMsgCreatableHelper::Poke(hsStream * s, uint32_t peekOptions) { hsAssert(fCreatable,"plNetMsgCreatableHelper::Poke: fCreatable not set"); - UInt16 classIndex = fCreatable->ClassIndex(); + uint16_t classIndex = fCreatable->ClassIndex(); s->WriteLE(classIndex); fCreatable->Write(s,nil); return s->GetPosition(); } -int plNetMsgCreatableHelper::Peek(hsStream * s, UInt32 peekOptions) +int plNetMsgCreatableHelper::Peek(hsStream * s, uint32_t peekOptions) { - UInt16 classIndex; + uint16_t classIndex; s->LogSubStreamStart("push me"); s->LogReadLE(&classIndex,"ClassIdx"); SetObject(plFactory::Create(classIndex)); @@ -160,7 +160,7 @@ void plNetMsgStreamHelper::Clear() fCompressionThreshold = kDefaultCompressionThreshold; } -int plNetMsgStreamHelper::Poke(hsStream* stream, UInt32 peekOptions) +int plNetMsgStreamHelper::Poke(hsStream* stream, uint32_t peekOptions) { if ( !(peekOptions & plNetMessage::kDontCompress) ) Compress(); @@ -171,7 +171,7 @@ int plNetMsgStreamHelper::Poke(hsStream* stream, UInt32 peekOptions) return stream->GetPosition(); } -int plNetMsgStreamHelper::Peek(hsStream* stream, const UInt32 peekOptions) +int plNetMsgStreamHelper::Peek(hsStream* stream, const uint32_t peekOptions) { stream->LogSubStreamStart("Stream Helper"); stream->LogReadLE(&fUncompressedSize,"UncompressedSize"); @@ -187,7 +187,7 @@ int plNetMsgStreamHelper::Peek(hsStream* stream, const UInt32 peekOptions) stream->LogRead(fStreamLen, fStreamBuf,"StreamData"); if ( !(peekOptions & plNetMessage::kDontCompress) ) Uncompress(); - fStreamType = *(Int16*)fStreamBuf; // grab from start fo stream + fStreamType = *(int16_t*)fStreamBuf; // grab from start fo stream } else { @@ -233,28 +233,28 @@ void plNetMsgStreamHelper::WriteVersion(hsStream* s, hsResMgr* mgr) s->Write(fStreamLen,fStreamBuf); } -void plNetMsgStreamHelper::IAllocStream(UInt32 len) +void plNetMsgStreamHelper::IAllocStream(uint32_t len) { delete [] fStreamBuf; fStreamBuf=nil; fStreamLen=len; if (len) - fStreamBuf = TRACKED_NEW UInt8[len]; + fStreamBuf = new uint8_t[len]; } void plNetMsgStreamHelper::CopyStream(hsStream* ssStream) { - UInt32 len=ssStream->GetEOF(); + uint32_t len=ssStream->GetEOF(); IAllocStream(len); ssStream->CopyToMem(fStreamBuf); - fStreamType = *(Int16*)fStreamBuf; + fStreamType = *(int16_t*)fStreamBuf; } -void plNetMsgStreamHelper::CopyStream(Int32 len, const void* buf) +void plNetMsgStreamHelper::CopyStream(int32_t len, const void* buf) { IAllocStream(len); memcpy(fStreamBuf, buf, len); - fStreamType = *(Int16*)fStreamBuf; + fStreamType = *(int16_t*)fStreamBuf; } void plNetMsgStreamHelper::CopyFrom(const plNetMsgStreamHelper* other) @@ -270,16 +270,16 @@ bool plNetMsgStreamHelper::Compress(int offset) return true; plZlibCompress compressor; - UInt8* buf = (UInt8*)GetStreamBuf(); // skip creatable index - UInt32 bufLen = GetStreamLen(); - UInt32 uncompressedSize = bufLen; + uint8_t* buf = (uint8_t*)GetStreamBuf(); // skip creatable index + uint32_t bufLen = GetStreamLen(); + uint32_t uncompressedSize = bufLen; SetUncompressedSize( uncompressedSize ); if ( compressor.Compress( &buf, &bufLen, offset) ) { SetCompressionType( plNetMessage::kCompressionZlib ); SetStreamLen(bufLen); SetStreamBuf(buf); - Int32 diff = uncompressedSize-bufLen; + int32_t diff = uncompressedSize-bufLen; #if 0 plNetApp::StaticDebugMsg( "\tCompressed stream: %lu->%lu bytes, (%s %d bytes, %.1f%%)", uncompressedSize, bufLen, (diff>=0)?"shrunk":"GREW?!?", diff, (diff/(float)uncompressedSize)*100 ); @@ -299,16 +299,16 @@ bool plNetMsgStreamHelper::Uncompress(int offset) if ( !IsCompressed() ) return true; - UInt32 origLen = GetStreamLen(); + uint32_t origLen = GetStreamLen(); plZlibCompress compressor; - UInt8* buf = (UInt8*)GetStreamBuf(); - UInt32 bufLen = origLen; + uint8_t* buf = (uint8_t*)GetStreamBuf(); + uint32_t bufLen = origLen; if ( compressor.Uncompress( &buf, &bufLen, GetUncompressedSize(), offset ) ) { SetCompressionType( plNetMessage::kCompressionNone ); SetStreamLen(bufLen); SetStreamBuf(buf); - Int32 diff = bufLen-origLen; + int32_t diff = bufLen-origLen; #if 0 plNetApp::StaticDebugMsg( "\tUncompressed stream: %lu->%lu bytes, (%s %d bytes, %.1f%%)", origLen, bufLen, (diff>=0)?"grew":"SHRUNK?!?", diff, (diff/(float)bufLen)*100 ); @@ -347,14 +347,14 @@ plNetMsgObjectHelper & plNetMsgObjectHelper::operator =(const plNetMsgObjectHelp return *this; } -int plNetMsgObjectHelper::Poke(hsStream* stream, UInt32 peekOptions) +int plNetMsgObjectHelper::Poke(hsStream* stream, uint32_t peekOptions) { fUoid.Write(stream); return stream->GetPosition(); } -int plNetMsgObjectHelper::Peek(hsStream* stream, const UInt32 peekOptions) +int plNetMsgObjectHelper::Peek(hsStream* stream, const uint32_t peekOptions) { stream->LogSubStreamStart("push me"); fUoid.Read(stream); @@ -411,9 +411,9 @@ void plNetMsgObjectListHelper::Reset() fObjects.clear(); } -int plNetMsgObjectListHelper::Poke(hsStream* stream, UInt32 peekOptions) +int plNetMsgObjectListHelper::Poke(hsStream* stream, uint32_t peekOptions) { - Int16 num = GetNumObjects(); + int16_t num = GetNumObjects(); stream->WriteLE(num); int i; for( i=0 ;iGetPosition(); } -int plNetMsgObjectListHelper::Peek(hsStream* stream, const UInt32 peekOptions) +int plNetMsgObjectListHelper::Peek(hsStream* stream, const uint32_t peekOptions) { Reset(); stream->LogSubStreamStart("push me"); - Int16 num; + int16_t num; stream->LogReadLE(&num,"ObjectListHelper Num"); int i; for( i=0 ;iPeek(stream, peekOptions); } // for stream->LogSubStreamEnd(); @@ -451,7 +451,7 @@ plNetMsgMemberInfoHelper::plNetMsgMemberInfoHelper() { } -int plNetMsgMemberInfoHelper::Peek(hsStream* s, const UInt32 peekOptions) +int plNetMsgMemberInfoHelper::Peek(hsStream* s, const uint32_t peekOptions) { s->LogSubStreamStart("push me"); s->LogReadLE(&fFlags,"MemberInfoHelper Flags"); @@ -461,7 +461,7 @@ int plNetMsgMemberInfoHelper::Peek(hsStream* s, const UInt32 peekOptions) return s->GetPosition(); } -int plNetMsgMemberInfoHelper::Poke(hsStream* s, const UInt32 peekOptions) +int plNetMsgMemberInfoHelper::Poke(hsStream* s, const uint32_t peekOptions) { s->WriteLE(fFlags); fClientGuid.Write( s, nil ); @@ -480,16 +480,16 @@ plNetMsgMemberListHelper::~plNetMsgMemberListHelper() delete fMembers[i]; } -int plNetMsgMemberListHelper::Peek(hsStream* stream, const UInt32 peekOptions) +int plNetMsgMemberListHelper::Peek(hsStream* stream, const uint32_t peekOptions) { - Int16 numMembers; + int16_t numMembers; stream->LogSubStreamStart("push me"); stream->LogReadLE(&numMembers,"MemberListHelper NumMembers"); fMembers.clear(); int i; for(i=0;iPeek(stream, peekOptions); AddMember(addr); } @@ -497,9 +497,9 @@ int plNetMsgMemberListHelper::Peek(hsStream* stream, const UInt32 peekOptions) return stream->GetPosition(); } -int plNetMsgMemberListHelper::Poke(hsStream* stream, const UInt32 peekOptions) +int plNetMsgMemberListHelper::Poke(hsStream* stream, const uint32_t peekOptions) { - Int16 numMembers = (Int16)GetNumMembers(); + int16_t numMembers = (int16_t)GetNumMembers(); stream->WriteLE(numMembers); int i; @@ -519,9 +519,9 @@ int plNetMsgMemberListHelper::Poke(hsStream* stream, const UInt32 peekOptions) // plNetMsgReceiversListHelper - HELPER class //////////////////////////////////////////////////////// -int plNetMsgReceiversListHelper::Peek(hsStream* stream, const UInt32 peekOptions) +int plNetMsgReceiversListHelper::Peek(hsStream* stream, const uint32_t peekOptions) { - UInt8 numIDs; + uint8_t numIDs; stream->LogSubStreamStart("push me"); stream->LogReadLE(&numIDs,"ReceiversListHelper NumIDs"); @@ -529,7 +529,7 @@ int plNetMsgReceiversListHelper::Peek(hsStream* stream, const UInt32 peekOptions int i; for(i=0;iLogReadLE(&ID,"ReceiversListHelper ID"); AddReceiverPlayerID(ID); } @@ -537,9 +537,9 @@ int plNetMsgReceiversListHelper::Peek(hsStream* stream, const UInt32 peekOptions return stream->GetPosition(); } -int plNetMsgReceiversListHelper::Poke(hsStream* stream, const UInt32 peekOptions) +int plNetMsgReceiversListHelper::Poke(hsStream* stream, const uint32_t peekOptions) { - UInt8 numIDs = (UInt8)GetNumReceivers(); + uint8_t numIDs = (uint8_t)GetNumReceivers(); stream->WriteLE(numIDs); int i; @@ -550,9 +550,9 @@ int plNetMsgReceiversListHelper::Poke(hsStream* stream, const UInt32 peekOptions } -bool plNetMsgReceiversListHelper::RemoveReceiverPlayerID(UInt32 n) +bool plNetMsgReceiversListHelper::RemoveReceiverPlayerID(uint32_t n) { - std::vector::iterator res = std::find(fPlayerIDList.begin(), fPlayerIDList.end(), n); + std::vector::iterator res = std::find(fPlayerIDList.begin(), fPlayerIDList.end(), n); if (res != fPlayerIDList.end()) { fPlayerIDList.erase(res); diff --git a/Sources/Plasma/PubUtilLib/plNetMessage/plNetMsgHelpers.h b/Sources/Plasma/PubUtilLib/plNetMessage/plNetMsgHelpers.h index 2d1aa53d..7d1df76b 100644 --- a/Sources/Plasma/PubUtilLib/plNetMessage/plNetMsgHelpers.h +++ b/Sources/Plasma/PubUtilLib/plNetMessage/plNetMsgHelpers.h @@ -47,8 +47,8 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // in to avoid multiple derivation by net messages. // -#include "hsTypes.h" -#include "hsUtils.h" +#include "HeadSpin.h" + #include "hsStream.h" #include "hsStlUtils.h" #include "pnNetCommon/pnNetCommon.h" @@ -80,8 +80,8 @@ public: GETINTERFACE_ANY(plNetMsgStreamableHelper, plCreatable); void SetObject(hsStreamable * object) { fObject=object;} hsStreamable * GetObject() const { return fObject;} - int Poke(hsStream* stream, UInt32 peekOptions=0); - int Peek(hsStream* stream, UInt32 peekOptions=0); + int Poke(hsStream* stream, uint32_t peekOptions=0); + int Peek(hsStream* stream, uint32_t peekOptions=0); }; //////////////////////////////////////////////////////////////////// @@ -106,8 +106,8 @@ public: GETINTERFACE_ANY(plNetMsgCreatableHelper, plCreatable); void SetObject(plCreatable * object); plCreatable * GetObject(); - int Poke(hsStream* stream, UInt32 peekOptions=0); - int Peek(hsStream* stream, UInt32 peekOptions=0); + int Poke(hsStream* stream, uint32_t peekOptions=0); + int Peek(hsStream* stream, uint32_t peekOptions=0); }; //////////////////////////////////////////////////////////////////// @@ -125,14 +125,14 @@ private: kCompressionType, }; protected: - UInt32 fUncompressedSize; - Int16 fStreamType; // set to creatable type, not read/written, gleaned from creatable stream - UInt8* fStreamBuf; - UInt32 fStreamLen; - UInt8 fCompressionType; // see plNetMessage::CompressionType - UInt32 fCompressionThreshold; // NOT WRITTEN + uint32_t fUncompressedSize; + int16_t fStreamType; // set to creatable type, not read/written, gleaned from creatable stream + uint8_t* fStreamBuf; + uint32_t fStreamLen; + uint8_t fCompressionType; // see plNetMessage::CompressionType + uint32_t fCompressionThreshold; // NOT WRITTEN - void IAllocStream(UInt32 len); + void IAllocStream(uint32_t len); public: enum { kDefaultCompressionThreshold = 255 }; // bytes @@ -143,8 +143,8 @@ public: CLASSNAME_REGISTER( plNetMsgStreamHelper ); GETINTERFACE_ANY(plNetMsgStreamHelper, plCreatable); - virtual int Poke(hsStream* stream, UInt32 peekOptions=0); - virtual int Peek(hsStream* stream, UInt32 peekOptions=0); + virtual int Poke(hsStream* stream, uint32_t peekOptions=0); + virtual int Peek(hsStream* stream, uint32_t peekOptions=0); // creatable ops virtual void Read(hsStream* s, hsResMgr* mgr) { Peek(s); } @@ -158,27 +158,27 @@ public: // copiers void CopyFrom(const plNetMsgStreamHelper* other); void CopyStream(hsStream* ssStream); // copies to fStream - void CopyStream(Int32 len, const void* buf); // copies to fStream + void CopyStream(int32_t len, const void* buf); // copies to fStream // setters - void SetCompressionType(UInt8 t) { fCompressionType=t; } - void SetStreamLen(UInt32 l) { fStreamLen=l; } - void SetStreamBuf(UInt8* b) { fStreamBuf=b; } - void SetUncompressedSize(UInt32 s) { fUncompressedSize=s; } + void SetCompressionType(uint8_t t) { fCompressionType=t; } + void SetStreamLen(uint32_t l) { fStreamLen=l; } + void SetStreamBuf(uint8_t* b) { fStreamBuf=b; } + void SetUncompressedSize(uint32_t s) { fUncompressedSize=s; } // Getters - UInt8 GetCompressionType() const { return fCompressionType; } - Int16 GetStreamType() const { return fStreamType; } - UInt32 GetStreamLen() const { return fStreamLen; } - UInt8* GetStreamBuf() const { return fStreamBuf; } - UInt32 GetUncompressedSize() const { return fUncompressedSize; } + uint8_t GetCompressionType() const { return fCompressionType; } + int16_t GetStreamType() const { return fStreamType; } + uint32_t GetStreamLen() const { return fStreamLen; } + uint8_t* GetStreamBuf() const { return fStreamBuf; } + uint32_t GetUncompressedSize() const { return fUncompressedSize; } bool Compress(int offset=2 /* skip 2 bytes as creatable index */ ); bool Uncompress(int offset=2 /* skip 2 bytes as creatable index */ ); bool IsCompressed() const; bool IsCompressable() const; - UInt32 GetCompressionThreshold() const { return fCompressionThreshold; } - void SetCompressionThreshold( UInt32 v ) { fCompressionThreshold=v; } + uint32_t GetCompressionThreshold() const { return fCompressionThreshold; } + void SetCompressionThreshold( uint32_t v ) { fCompressionThreshold=v; } }; // @@ -203,8 +203,8 @@ public: CLASSNAME_REGISTER( plNetMsgObjectHelper ); GETINTERFACE_ANY(plNetMsgObjectHelper, plCreatable); - virtual int Poke(hsStream* stream, UInt32 peekOptions=0); - virtual int Peek(hsStream* stream, UInt32 peekOptions=0); + virtual int Poke(hsStream* stream, uint32_t peekOptions=0); + virtual int Peek(hsStream* stream, uint32_t peekOptions=0); plNetMsgObjectHelper & operator =(const plNetMsgObjectHelper & other); @@ -214,7 +214,7 @@ public: // getters const plString& GetObjectName() const { return fUoid.GetObjectName(); } - UInt32 GetPageID() const { return fUoid.GetLocation().GetSequenceNumber(); } + uint32_t GetPageID() const { return fUoid.GetLocation().GetSequenceNumber(); } const plUoid& GetUoid() const { return fUoid; } void ReadVersion(hsStream* s, hsResMgr* mgr); @@ -235,13 +235,13 @@ public: CLASSNAME_REGISTER( plNetMsgObjectListHelper ); GETINTERFACE_ANY(plNetMsgObjectListHelper, plCreatable); - virtual int Poke(hsStream* stream, UInt32 peekOptions=0); - virtual int Peek(hsStream* stream, UInt32 peekOptions=0); + virtual int Poke(hsStream* stream, uint32_t peekOptions=0); + virtual int Peek(hsStream* stream, uint32_t peekOptions=0); void Reset(); int GetNumObjects() const { return fObjects.size(); } plNetMsgObjectHelper* GetObject(int i) { return fObjects[i]; } - void AddObject(plKey key) { fObjects.push_back(TRACKED_NEW plNetMsgObjectHelper(key)); } + void AddObject(plKey key) { fObjects.push_back(new plNetMsgObjectHelper(key)); } }; // @@ -250,7 +250,7 @@ public: class plNetMsgMemberInfoHelper : public plCreatable { protected: - UInt32 fFlags; + uint32_t fFlags; plUoid fAvatarUoid; plClientGuid fClientGuid; public: @@ -259,16 +259,16 @@ public: CLASSNAME_REGISTER( plNetMsgMemberInfoHelper ); GETINTERFACE_ANY( plNetMsgMemberInfoHelper, plCreatable); - virtual int Poke(hsStream* stream, UInt32 peekOptions=0); - virtual int Peek(hsStream* stream, UInt32 peekOptions=0); + virtual int Poke(hsStream* stream, uint32_t peekOptions=0); + virtual int Peek(hsStream* stream, uint32_t peekOptions=0); const plClientGuid * GetClientGuid() const { return &fClientGuid; } plClientGuid * GetClientGuid() { return &fClientGuid; } - UInt32 GetFlags() const { return fFlags; } + uint32_t GetFlags() const { return fFlags; } plUoid GetAvatarUoid() const { return fAvatarUoid; } - void SetFlags(UInt32 v) { fFlags=v; } + void SetFlags(uint32_t v) { fFlags=v; } void SetAvatarUoid(plUoid u) { fAvatarUoid=u; } }; @@ -282,8 +282,8 @@ public: typedef std::vector MemberInfoHelperVec; struct MatchesPlayerID { - UInt32 fID; - MatchesPlayerID( UInt32 id ): fID( id ){} + uint32_t fID; + MatchesPlayerID( uint32_t id ): fID( id ){} bool operator()( const plNetMsgMemberInfoHelper * mbr ) const { return ( mbr && mbr->GetClientGuid()->GetPlayerID()==fID ); @@ -300,8 +300,8 @@ public: CLASSNAME_REGISTER( plNetMsgMemberListHelper ); GETINTERFACE_ANY( plNetMsgMemberListHelper, plCreatable); - virtual int Poke(hsStream* stream, UInt32 peekOptions=0); - virtual int Peek(hsStream* stream, UInt32 peekOptions=0); + virtual int Poke(hsStream* stream, uint32_t peekOptions=0); + virtual int Peek(hsStream* stream, uint32_t peekOptions=0); int GetNumMembers() const { return fMembers.size(); } const plNetMsgMemberInfoHelper* GetMember(int i) const { return fMembers[i]; } @@ -320,7 +320,7 @@ public: class plNetMsgReceiversListHelper : public plCreatable { protected: - std::vector fPlayerIDList; + std::vector fPlayerIDList; public: plNetMsgReceiversListHelper() {} virtual ~plNetMsgReceiversListHelper() {} @@ -328,14 +328,14 @@ public: CLASSNAME_REGISTER( plNetMsgReceiversListHelper ); GETINTERFACE_ANY( plNetMsgReceiversListHelper, plCreatable); - virtual int Poke(hsStream* stream, UInt32 peekOptions=0); - virtual int Peek(hsStream* stream, UInt32 peekOptions=0); + virtual int Poke(hsStream* stream, uint32_t peekOptions=0); + virtual int Peek(hsStream* stream, uint32_t peekOptions=0); void Clear() { fPlayerIDList.clear(); } int GetNumReceivers() const { return fPlayerIDList.size(); } - UInt32 GetReceiverPlayerID(int i) const { return fPlayerIDList[i]; } - void AddReceiverPlayerID(UInt32 a) { fPlayerIDList.push_back(a); } - bool RemoveReceiverPlayerID(UInt32 n); // returns true if found and removed + uint32_t GetReceiverPlayerID(int i) const { return fPlayerIDList[i]; } + void AddReceiverPlayerID(uint32_t a) { fPlayerIDList.push_back(a); } + bool RemoveReceiverPlayerID(uint32_t n); // returns true if found and removed }; diff --git a/Sources/Plasma/PubUtilLib/plNetMessage/plNetMsgVersion.h b/Sources/Plasma/PubUtilLib/plNetMessage/plNetMsgVersion.h index 6e868a9c..4f5f1305 100644 --- a/Sources/Plasma/PubUtilLib/plNetMessage/plNetMsgVersion.h +++ b/Sources/Plasma/PubUtilLib/plNetMessage/plNetMsgVersion.h @@ -58,7 +58,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com 9 07/01/02 rje Changed Authentication Scheme 10 10/16/02 eap Removed low-level KI. Replaced with plVault. 11 07/03/03 MT Optimized plNetMessage headers for size - 12 09/17/03 eap Removed UInt32 acctID. Added Uuid acctUUID. Changed PlayerUpdate enum values. + 12 09/17/03 eap Removed uint32_t acctID. Added Uuid acctUUID. Changed PlayerUpdate enum values. */ @@ -100,7 +100,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com 1 10/15/02 thamer minor changes for CCR 2 11/04/02 eap Changed plNetMsgVault format. 3 12/04/02 eap Moved compression into plNetMsgStreamHelper. Changed plNetMsgVault format. - 4 12/04/02 eap Changed plNetMsgStreamHelper fUncompressedSize type to UInt32. + 4 12/04/02 eap Changed plNetMsgStreamHelper fUncompressedSize type to uint32_t. 5 12/05/02 eap Added PlayerName and AvatarShape to CreatePlayer msg. 6 12/11/02 thamer Moved PlayerID into the base class 7 12/18/02 thamer Changed SDL format @@ -111,7 +111,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com 12 02/05/03 thamer Added initial age state to joinAck 13 02/10/03 eap Changed format of vault FetchNodes msg to support bundling of multiple nodes into one msg. 14 02/12/03 eap Changed the way ages are (un)registered. client used to do it. now vault server does it. - 15 02/24/03 eap Added a byte to plNetMsgLeave to specify the reason for leaving. + 15 02/24/03 eap Added a uint8_t to plNetMsgLeave to specify the reason for leaving. 16 02/25/03 thamer Changed the auth response generation 17 02/26/03 thamer again 18 02/28/03 eap Support for multiple spawn points for vault age link nodes. diff --git a/Sources/Plasma/PubUtilLib/plNetTransport/plNetTransport.cpp b/Sources/Plasma/PubUtilLib/plNetTransport/plNetTransport.cpp index 17fbc48e..de8d512f 100644 --- a/Sources/Plasma/PubUtilLib/plNetTransport/plNetTransport.cpp +++ b/Sources/Plasma/PubUtilLib/plNetTransport/plNetTransport.cpp @@ -259,7 +259,7 @@ void plNetTransport::ClearMembers() // // return array index or -1 // -int plNetTransport::FindMember(UInt32 playerID) const +int plNetTransport::FindMember(uint32_t playerID) const { int i; for( i=0 ;iGetDistSq() : hsScalarMax; - float d2=m2 ? (*m2)->GetDistSq() : hsScalarMax; + float d1=m1 ? (*m1)->GetDistSq() : FLT_MAX; + float d2=m2 ? (*m2)->GetDistSq() : FLT_MAX; return (int)(d1-d2); } @@ -361,7 +361,7 @@ int compare( const void* arg1, const void *arg2 ) void plNetTransport::GetMemberListDistSorted(plNetTransportMember**& listIn) const { // copy members list - listIn = TRACKED_NEW plNetTransportMember* [fMembers.size()]; + listIn = new plNetTransportMember* [fMembers.size()]; int i; for (i=0; i fSubscriptions; // list of channelGrp subscriptions - UInt32 fTransportFlags; + uint32_t fTransportFlags; float fDistSq; // from local player, temp - UInt8 fCCRLevel; + uint8_t fCCRLevel; public: CLASSNAME_REGISTER( plNetTransportMember); GETINTERFACE_ANY( plNetTransportMember, plNetMember); @@ -91,8 +91,8 @@ public: } void SetPlayerName(const plString & value) { fPlayerName=value;} plString GetPlayerName() const { return fPlayerName;} - void SetPlayerID(UInt32 value) { fPlayerID=value;} - UInt32 GetPlayerID() const { return fPlayerID;} + void SetPlayerID(uint32_t value) { fPlayerID=value;} + uint32_t GetPlayerID() const { return fPlayerID;} void SetIsServer(bool value) { (value)?SetFlags(GetFlags()|kIsServer):SetFlags(GetFlags()&!kIsServer);} bool IsServer() const { return (GetFlags()&kIsServer)?true:false;} @@ -105,8 +105,8 @@ public: void CopySubscriptions(std::vector* channels) { *channels = fSubscriptions; } - void SetTransportFlags(UInt32 f) { fTransportFlags=f; } - UInt32 GetTransportFlags() const { return fTransportFlags; } + void SetTransportFlags(uint32_t f) { fTransportFlags=f; } + uint32_t GetTransportFlags() const { return fTransportFlags; } bool IsPeerToPeer() const { return hsCheckBits(fFlags, kRequestP2P); } plString AsString() const; @@ -118,8 +118,8 @@ public: } bool IsCCR() const { return (fCCRLevel>0); } - UInt8 GetCCRLevel() const { return fCCRLevel; } - void SetCCRLevel(UInt8 cl) { fCCRLevel=cl; } + uint8_t GetCCRLevel() const { return fCCRLevel; } + void SetCCRLevel(uint8_t cl) { fCCRLevel=cl; } }; #endif // plNetTransportMember_h diff --git a/Sources/Plasma/PubUtilLib/plParticleSystem/plBoundInterface.h b/Sources/Plasma/PubUtilLib/plParticleSystem/plBoundInterface.h index 888d8d9b..dca76c09 100644 --- a/Sources/Plasma/PubUtilLib/plParticleSystem/plBoundInterface.h +++ b/Sources/Plasma/PubUtilLib/plParticleSystem/plBoundInterface.h @@ -69,7 +69,7 @@ public: CLASSNAME_REGISTER( plBoundInterface ); GETINTERFACE_ANY( plBoundInterface, plObjInterface ); - virtual Int32 GetNumProperties() const { return kNumProps; } + virtual int32_t GetNumProperties() const { return kNumProps; } virtual void SetTransform(const hsMatrix44& l2w, const hsMatrix44& w2l); virtual void Read(hsStream* stream, hsResMgr* mgr); diff --git a/Sources/Plasma/PubUtilLib/plParticleSystem/plConvexVolume.cpp b/Sources/Plasma/PubUtilLib/plParticleSystem/plConvexVolume.cpp index 97529b7a..bb640bc1 100644 --- a/Sources/Plasma/PubUtilLib/plParticleSystem/plConvexVolume.cpp +++ b/Sources/Plasma/PubUtilLib/plParticleSystem/plConvexVolume.cpp @@ -39,7 +39,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com Mead, WA 99021 *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "hsGeometry3.h" #include "hsMatrix44.h" #include "plConvexVolume.h" @@ -79,9 +79,9 @@ hsBool plConvexVolume::AddPlane(const hsPlane3 &plane) } fNumPlanes++; //delete [] fFlags; - //fFlags = TRACKED_NEW UInt32[fNumPlanes]; + //fFlags = new uint32_t[fNumPlanes]; - hsPlane3 *tempPlanes = TRACKED_NEW hsPlane3[fNumPlanes]; + hsPlane3 *tempPlanes = new hsPlane3[fNumPlanes]; for (i = 0; i < fNumPlanes - 1; i++) { tempPlanes[i] = fLocalPlanes[i]; @@ -91,7 +91,7 @@ hsBool plConvexVolume::AddPlane(const hsPlane3 &plane) delete [] fLocalPlanes; fLocalPlanes = tempPlanes; delete [] fWorldPlanes; - fWorldPlanes = TRACKED_NEW hsPlane3[fNumPlanes]; + fWorldPlanes = new hsPlane3[fNumPlanes]; return true; } @@ -110,16 +110,16 @@ void plConvexVolume::Update(const hsMatrix44 &l2w) } } -void plConvexVolume::SetNumPlanesAndClear(const UInt32 num) +void plConvexVolume::SetNumPlanesAndClear(const uint32_t num) { IClear(); - //fFlags = TRACKED_NEW UInt32[num]; - fLocalPlanes = TRACKED_NEW hsPlane3[num]; - fWorldPlanes = TRACKED_NEW hsPlane3[num]; + //fFlags = new uint32_t[num]; + fLocalPlanes = new hsPlane3[num]; + fWorldPlanes = new hsPlane3[num]; fNumPlanes = num; } -void plConvexVolume::SetPlane(const hsPlane3 &plane, const UInt32 index) +void plConvexVolume::SetPlane(const hsPlane3 &plane, const uint32_t index) { fLocalPlanes[index] = plane; } @@ -138,10 +138,10 @@ hsBool plConvexVolume::IsInside(const hsPoint3 &pos) const hsBool plConvexVolume::ResolvePoint(hsPoint3 &pos) const { - hsScalar minDist = 1.e33f; - Int32 minIndex = -1; + float minDist = 1.e33f; + int32_t minIndex = -1; - hsScalar currDist; + float currDist; int i; for (i = 0; i < fNumPlanes; i++) { @@ -159,12 +159,12 @@ hsBool plConvexVolume::ResolvePoint(hsPoint3 &pos) const return true; } -hsBool plConvexVolume::BouncePoint(hsPoint3 &pos, hsVector3 &velocity, hsScalar bounce, hsScalar friction) const +hsBool plConvexVolume::BouncePoint(hsPoint3 &pos, hsVector3 &velocity, float bounce, float friction) const { - hsScalar minDist = 1.e33f; - Int32 minIndex = -1; + float minDist = 1.e33f; + int32_t minIndex = -1; - hsScalar currDist; + float currDist; int i; for (i = 0; i < fNumPlanes; i++) { diff --git a/Sources/Plasma/PubUtilLib/plParticleSystem/plConvexVolume.h b/Sources/Plasma/PubUtilLib/plParticleSystem/plConvexVolume.h index 116875f6..984ae8f3 100644 --- a/Sources/Plasma/PubUtilLib/plParticleSystem/plConvexVolume.h +++ b/Sources/Plasma/PubUtilLib/plParticleSystem/plConvexVolume.h @@ -64,8 +64,8 @@ public: void Update(const hsMatrix44 &l2w); hsBool AddPlane(const hsPlane3 &plane); - void SetNumPlanesAndClear(const UInt32 num); - void SetPlane(const hsPlane3 &plane, const UInt32 index); + void SetNumPlanesAndClear(const uint32_t num); + void SetPlane(const hsPlane3 &plane, const uint32_t index); // If you only care about the test, call this. Otherwise call ResolvePoint. hsBool IsInside(const hsPoint3 &pos) const; @@ -75,7 +75,7 @@ public: // returns true if the point was inside and pos and velocity updated to bounce off offending plane. // input bounce==1.f for perfect bounce, bounce==0 to slide. - hsBool BouncePoint(hsPoint3 &pos, hsVector3 &velocity, hsScalar bounce, hsScalar friction) const; + hsBool BouncePoint(hsPoint3 &pos, hsVector3 &velocity, float bounce, float friction) const; inline hsBool TestPlane(const hsPoint3 &pos, const hsPlane3 &plane) const; // Is the point inside the plane? virtual void Read(hsStream* s, hsResMgr *mgr); @@ -87,12 +87,12 @@ protected: hsPlane3 *fLocalPlanes; hsPlane3 *fWorldPlanes; - UInt32 fNumPlanes; + uint32_t fNumPlanes; }; inline hsBool plConvexVolume::TestPlane(const hsPoint3 &pos, const hsPlane3 &plane) const { - hsScalar dis = plane.fN.InnerProduct(pos); + float dis = plane.fN.InnerProduct(pos); dis += plane.fD; if( dis >= 0.f ) return false; diff --git a/Sources/Plasma/PubUtilLib/plParticleSystem/plEffectTargetInfo.h b/Sources/Plasma/PubUtilLib/plParticleSystem/plEffectTargetInfo.h index 8c1bffd0..1ded2261 100644 --- a/Sources/Plasma/PubUtilLib/plParticleSystem/plEffectTargetInfo.h +++ b/Sources/Plasma/PubUtilLib/plParticleSystem/plEffectTargetInfo.h @@ -42,7 +42,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #ifndef plEffectTargetInfo_inc #define plEffectTargetInfo_inc -#include "hsTypes.h" +#include "HeadSpin.h" struct hsPoint3; class plPipeline; @@ -58,7 +58,7 @@ public: plPipeline* fPipeline; plParticleSystem* fSystem; double fSecs; - hsScalar fDelSecs; + float fDelSecs; }; @@ -68,27 +68,27 @@ public: class plEffectTargetInfo { public: - // Byte arrays. Declared as type UInt8 so that adding the stride to the pointer is guaranteed to advance + // uint8_t arrays. Declared as type uint8_t so that adding the stride to the pointer is guaranteed to advance // the exact number of bytes. - UInt8 *fPos; - UInt8 *fVelocity; - UInt8 *fInvMass; - UInt8 *fAcceleration; - UInt8 *fColor; - UInt8 *fRadsPerSec; - UInt8 *fMiscFlags; + uint8_t *fPos; + uint8_t *fVelocity; + uint8_t *fInvMass; + uint8_t *fAcceleration; + uint8_t *fColor; + uint8_t *fRadsPerSec; + uint8_t *fMiscFlags; - UInt32 fPosStride; - UInt32 fVelocityStride; - UInt32 fInvMassStride; - UInt32 fAccelerationStride; - UInt32 fColorStride; - UInt32 fRadsPerSecStride; - UInt32 fMiscFlagsStride; + uint32_t fPosStride; + uint32_t fVelocityStride; + uint32_t fInvMassStride; + uint32_t fAccelerationStride; + uint32_t fColorStride; + uint32_t fRadsPerSecStride; + uint32_t fMiscFlagsStride; plParticleContext fContext; - UInt32 fNumValidParticles; - UInt32 fFirstNewParticle; + uint32_t fNumValidParticles; + uint32_t fFirstNewParticle; // We're going to need some sort of connectivity data for constraint satisfaction, but at least we have // a system that allows that to be added in smoothly when it's needed, so for now, let's get the main diff --git a/Sources/Plasma/PubUtilLib/plParticleSystem/plParticle.h b/Sources/Plasma/PubUtilLib/plParticleSystem/plParticle.h index 58ad2749..f037f6e3 100644 --- a/Sources/Plasma/PubUtilLib/plParticleSystem/plParticle.h +++ b/Sources/Plasma/PubUtilLib/plParticleSystem/plParticle.h @@ -82,10 +82,10 @@ class plParticleCore { public: hsPoint3 fPos; - UInt32 fColor; // Particle opacity goes into the color's alpha. + uint32_t fColor; // Particle opacity goes into the color's alpha. hsPoint3 fOrientation; // fMiscFlags determines how this should be used. hsVector3 fNormal; - hsScalar fHSize, fVSize; // distance from the heart of the particle to the borders of its poly. + float fHSize, fVSize; // distance from the heart of the particle to the borders of its poly. hsPoint3 fUVCoords[4]; }; @@ -94,20 +94,20 @@ class plParticleExt public: //hsPoint3 fOldPos; hsVector3 fVelocity; - hsScalar fInvMass; // The inverse (1 / mass) is what we actually need for calculations. Storing it this + float fInvMass; // The inverse (1 / mass) is what we actually need for calculations. Storing it this // way allows us to make an object immovable with an inverse mass of 0 (and save a divide). hsVector3 fAcceleration; // Accumulated from multiple forces. - hsScalar fLife; // how many seconds before we recycle this? (My particle has more of a life than I do...) - hsScalar fStartLife; - hsScalar fScale; - hsScalar fRadsPerSec; - //UInt32 fOrigColor; + float fLife; // how many seconds before we recycle this? (My particle has more of a life than I do...) + float fStartLife; + float fScale; + float fRadsPerSec; + //uint32_t fOrigColor; enum // Miscellaneous flags for particles { kImmortal = 0x00000001, }; - UInt32 fMiscFlags; // I know... 32 bits for a single flag... + uint32_t fMiscFlags; // I know... 32 bits for a single flag... // Feel free to change this if you've got something to pack it against. }; diff --git a/Sources/Plasma/PubUtilLib/plParticleSystem/plParticleApplicator.cpp b/Sources/Plasma/PubUtilLib/plParticleSystem/plParticleApplicator.cpp index 93477a40..86f807c3 100644 --- a/Sources/Plasma/PubUtilLib/plParticleSystem/plParticleApplicator.cpp +++ b/Sources/Plasma/PubUtilLib/plParticleSystem/plParticleApplicator.cpp @@ -51,7 +51,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com plParticleGenerator *plParticleApplicator::IGetParticleGen(plSceneObject *so) { - UInt32 numMods = so->GetNumModifiers(); + uint32_t numMods = so->GetNumModifiers(); int i; for (i = 0; i < numMods; i++) { @@ -88,7 +88,7 @@ void plParticleAngleApplicator::IApply(const plAGModifier *mod, double time) { plScalarChannel *chan = plScalarChannel::ConvertNoRef(fChannel); IGetParticleGen(mod->GetTarget(0))->UpdateParam(plParticleUpdateMsg::kParamInitPitchRange, - (hsScalar)(chan->Value(time) * PI / 180.f)); + (float)(chan->Value(time) * PI / 180.f)); } void plParticleVelMinApplicator::IApply(const plAGModifier *mod, double time) diff --git a/Sources/Plasma/PubUtilLib/plParticleSystem/plParticleEffect.cpp b/Sources/Plasma/PubUtilLib/plParticleSystem/plParticleEffect.cpp index b84c8df5..3997259c 100644 --- a/Sources/Plasma/PubUtilLib/plParticleSystem/plParticleEffect.cpp +++ b/Sources/Plasma/PubUtilLib/plParticleSystem/plParticleEffect.cpp @@ -39,7 +39,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com Mead, WA 99021 *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "hsGeometry3.h" #include "plParticle.h" #include "plParticleEffect.h" @@ -98,7 +98,7 @@ void plParticleCollisionEffect::Read(hsStream *s, hsResMgr *mgr) hsKeyedObject::Read(s, mgr); plGenRefMsg* msg; - msg = TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnCreate, 0, 0); // SceneObject + msg = new plGenRefMsg(GetKey(), plRefMsg::kOnCreate, 0, 0); // SceneObject mgr->ReadKeyNotifyMe(s, msg, plRefFlags::kActiveRef); fBounds = nil; } @@ -118,7 +118,7 @@ plParticleCollisionEffectBeat::plParticleCollisionEffectBeat() { } -hsBool plParticleCollisionEffectBeat::ApplyEffect(const plEffectTargetInfo &target, Int32 i) +hsBool plParticleCollisionEffectBeat::ApplyEffect(const plEffectTargetInfo &target, int32_t i) { hsAssert(i >= 0, "Use of default argument doesn't make sense for plParticleCollisionEffect"); @@ -137,7 +137,7 @@ plParticleCollisionEffectDie::plParticleCollisionEffectDie() { } -hsBool plParticleCollisionEffectDie::ApplyEffect(const plEffectTargetInfo &target, Int32 i) +hsBool plParticleCollisionEffectDie::ApplyEffect(const plEffectTargetInfo &target, int32_t i) { hsAssert(i >= 0, "Use of default argument doesn't make sense for plParticleCollisionEffect"); @@ -156,7 +156,7 @@ plParticleCollisionEffectBounce::plParticleCollisionEffectBounce() { } -hsBool plParticleCollisionEffectBounce::ApplyEffect(const plEffectTargetInfo &target, Int32 i) +hsBool plParticleCollisionEffectBounce::ApplyEffect(const plEffectTargetInfo &target, int32_t i) { hsAssert(i >= 0, "Use of default argument doesn't make sense for plParticleCollisionEffect"); @@ -234,9 +234,9 @@ plParticleFadeVolumeEffect::~plParticleFadeVolumeEffect() // The shorter the distance, the more noticable the fade out. // Note the wierdness between the fractions, because kFadeFrac is fraction // of fLength, but kFadeParm and kInvFadeFrac are fraction of 2.f*fLength. Sorry. -const hsScalar kFadeFrac = 0.5f; -const hsScalar kFadeParm = 1.f - kFadeFrac * 0.5f; -const hsScalar kInvFadeFrac = 1.f / (kFadeFrac * 0.5f); +const float kFadeFrac = 0.5f; +const float kFadeParm = 1.f - kFadeFrac * 0.5f; +const float kInvFadeFrac = 1.f / (kFadeFrac * 0.5f); void plParticleFadeVolumeEffect::PrepareEffect(const plEffectTargetInfo &target) { @@ -265,13 +265,13 @@ void plParticleFadeVolumeEffect::PrepareEffect(const plEffectTargetInfo &target) fNorm.fZ = 1.f / (fMax.fZ - fMin.fZ); } -hsBool plParticleFadeVolumeEffect::ApplyEffect(const plEffectTargetInfo& target, Int32 i) +hsBool plParticleFadeVolumeEffect::ApplyEffect(const plEffectTargetInfo& target, int32_t i) { hsPoint3 *currPos = (hsPoint3 *)(target.fPos + i * target.fPosStride); - hsScalar parm; + float parm; - hsScalar fade = 1.f; + float fade = 1.f; parm = (currPos->fX - fMin.fX) * fNorm.fX; if( parm < 0 ) @@ -338,8 +338,8 @@ hsBool plParticleFadeVolumeEffect::ApplyEffect(const plEffectTargetInfo& target, if( fade < 1.f ) { - UInt32 *color = (UInt32 *)(target.fColor + i * target.fColorStride); - UInt32 alpha = (UInt32)((*color >> 24) * fade); + uint32_t *color = (uint32_t *)(target.fColor + i * target.fColorStride); + uint32_t alpha = (uint32_t)((*color >> 24) * fade); *color = (*color & 0x00ffffff) | (alpha << 24); } @@ -409,7 +409,7 @@ void plParticleWindEffect::Write(hsStream *s, hsResMgr *mgr) void plParticleWindEffect::SetRefDirection(const hsVector3& v) { fRefDir = v; - hsScalar lenSq = fRefDir.MagnitudeSquared(); + float lenSq = fRefDir.MagnitudeSquared(); if( lenSq > 1.e-1f ) { fDir = fRefDir * hsFastMath::InvSqrtAppr(lenSq); @@ -484,12 +484,12 @@ void plParticleLocalWind::PrepareEffect(const plEffectTargetInfo& target) } -hsBool plParticleLocalWind::ApplyEffect(const plEffectTargetInfo& target, Int32 i) +hsBool plParticleLocalWind::ApplyEffect(const plEffectTargetInfo& target, int32_t i) { const hsPoint3& pos = *(hsPoint3 *)(target.fPos + i * target.fPosStride); hsVector3& vel = *(hsVector3*)(target.fVelocity + i * target.fVelocityStride); - const hsScalar kMinToBother = 0; + const float kMinToBother = 0; float strength = 1.f / ( (1.f + fConstancy) * (1.f + fConstancy) ); float s, c, t; @@ -516,7 +516,7 @@ hsBool plParticleLocalWind::ApplyEffect(const plEffectTargetInfo& target, Int32 strength *= c; #endif - const hsScalar& invMass = *(hsScalar*)(target.fInvMass + i * target.fInvMassStride); + const float& invMass = *(float*)(target.fInvMass + i * target.fInvMassStride); strength *= invMass; vel += fWindVec * strength; @@ -569,9 +569,9 @@ void plParticleUniformWind::Write(hsStream *s, hsResMgr *mgr) s->WriteLEScalar(fFreqRate); } -void plParticleUniformWind::SetFrequencyRange(hsScalar minSecsPerCycle, hsScalar maxSecsPerCycle) +void plParticleUniformWind::SetFrequencyRange(float minSecsPerCycle, float maxSecsPerCycle) { - const hsScalar kMinSecsPerCycle = 1.f; + const float kMinSecsPerCycle = 1.f; if( minSecsPerCycle < kMinSecsPerCycle ) minSecsPerCycle = kMinSecsPerCycle; if( minSecsPerCycle < kMinSecsPerCycle ) @@ -589,9 +589,9 @@ void plParticleUniformWind::SetFrequencyRange(hsScalar minSecsPerCycle, hsScalar } } -void plParticleUniformWind::SetFrequencyRate(hsScalar secsPerCycle) +void plParticleUniformWind::SetFrequencyRate(float secsPerCycle) { - const hsScalar kMinSecsPerCycle = 1.f; + const float kMinSecsPerCycle = 1.f; if( secsPerCycle < kMinSecsPerCycle ) secsPerCycle = kMinSecsPerCycle; fFreqRate = 1.f / secsPerCycle; @@ -606,9 +606,9 @@ void plParticleUniformWind::PrepareEffect(const plEffectTargetInfo& target) { static plRandom random; - const double kTwoPi = hsScalarPI * 2.0; + const double kTwoPi = M_PI * 2.0; double t0 = fFreqCurr * fLastFreqSecs + fCurrPhase; - hsScalar t1 = (hsScalar)fmod(t0, kTwoPi); + float t1 = (float)fmod(t0, kTwoPi); fCurrPhase -= t0 - t1; fFreqCurr += fFreqRate * target.fContext.fDelSecs * random.RandZeroToOne(); @@ -624,11 +624,11 @@ void plParticleUniformWind::PrepareEffect(const plEffectTargetInfo& target) fFreqRate = -fFreqRate; } - hsScalar phaseDel = (hsScalar)(t1 - (fFreqCurr * fLastFreqSecs + fCurrPhase)); + float phaseDel = (float)(t1 - (fFreqCurr * fLastFreqSecs + fCurrPhase)); fCurrPhase += phaseDel; - hsScalar t = hsScalar(fFreqCurr * target.fContext.fSecs + fCurrPhase); - hsScalar s; + float t = float(fFreqCurr * target.fContext.fSecs + fCurrPhase); + float s; hsFastMath::SinCosAppr(t, s, fCurrentStrength); fCurrentStrength += fConstancy; fCurrentStrength /= (1.f + fConstancy); @@ -641,11 +641,11 @@ void plParticleUniformWind::PrepareEffect(const plEffectTargetInfo& target) } -hsBool plParticleUniformWind::ApplyEffect(const plEffectTargetInfo& target, Int32 i) +hsBool plParticleUniformWind::ApplyEffect(const plEffectTargetInfo& target, int32_t i) { hsVector3& vel = *(hsVector3*)(target.fVelocity + i * target.fVelocityStride); - const hsScalar& invMass = *(hsScalar*)(target.fInvMass + i * target.fInvMassStride); + const float& invMass = *(float*)(target.fInvMass + i * target.fInvMassStride); vel += fWindVec * (invMass * fCurrentStrength); @@ -729,9 +729,9 @@ void plParticleFlockEffect::IUpdateInfluences(const plEffectTargetInfo &target) } if (numAvg > 0) - fInfluences[i].fAvgVel /= (hsScalar)numAvg; + fInfluences[i].fAvgVel /= (float)numAvg; if (numRep > 0) - fInfluences[i].fRepDir /= (hsScalar)numRep; + fInfluences[i].fRepDir /= (float)numRep; } } @@ -743,7 +743,7 @@ void plParticleFlockEffect::PrepareEffect(const plEffectTargetInfo& target) // Some of this is the same for every particle and should be cached in PrepareEffect(). // Holding off on that until I like the behavior. -hsBool plParticleFlockEffect::ApplyEffect(const plEffectTargetInfo& target, Int32 i) +hsBool plParticleFlockEffect::ApplyEffect(const plEffectTargetInfo& target, int32_t i) { if (i >= fMaxParticles) return false; // Don't have the memory to deal with you. Good luck kid... @@ -751,9 +751,9 @@ hsBool plParticleFlockEffect::ApplyEffect(const plEffectTargetInfo& target, Int3 const hsPoint3 &pos = *(hsPoint3*)(target.fPos + i * target.fPosStride); hsVector3 &vel = *(hsVector3*)(target.fVelocity + i * target.fVelocityStride); - hsScalar curSpeed = vel.Magnitude(); + float curSpeed = vel.Magnitude(); hsPoint3 goal; - if (*(UInt32*)(target.fMiscFlags + i * target.fMiscFlagsStride) & plParticleExt::kImmortal) + if (*(uint32_t*)(target.fMiscFlags + i * target.fMiscFlagsStride) & plParticleExt::kImmortal) goal = target.fContext.fSystem->GetTarget(0)->GetLocalToWorld().GetTranslate() + fTargetOffset; else goal = fDissenterTarget; @@ -761,13 +761,13 @@ hsBool plParticleFlockEffect::ApplyEffect(const plEffectTargetInfo& target, Int3 hsVector3 goalDir; hsPoint3 tmp = goal - pos; goalDir.Set(&tmp); - hsScalar distSq = goalDir.MagnitudeSquared(); + float distSq = goalDir.MagnitudeSquared(); goalDir.Normalize(); - hsScalar goalStr; - hsScalar maxSpeed; - hsScalar maxSpeedSq; + float goalStr; + float maxSpeed; + float maxSpeedSq; if (distSq <= fGoalDistSq) { goalStr = fGoalOrbitStr; @@ -785,7 +785,7 @@ hsBool plParticleFlockEffect::ApplyEffect(const plEffectTargetInfo& target, Int3 } else { - hsScalar pct = (distSq - fGoalDistSq) / (fFullChaseDistSq - fGoalDistSq); + float pct = (distSq - fGoalDistSq) / (fFullChaseDistSq - fGoalDistSq); goalStr = fGoalOrbitStr + (fGoalChaseStr - fGoalOrbitStr) * pct; maxSpeed = fMaxOrbitSpeed + (fMaxChaseSpeed - fMaxOrbitSpeed) * pct; } @@ -804,7 +804,7 @@ hsBool plParticleFlockEffect::ApplyEffect(const plEffectTargetInfo& target, Int3 return false; } -void plParticleFlockEffect::SetMaxParticles(const UInt16 num) +void plParticleFlockEffect::SetMaxParticles(const uint16_t num) { delete [] fDistSq; delete [] fInfluences; @@ -812,8 +812,8 @@ void plParticleFlockEffect::SetMaxParticles(const UInt16 num) if (num > 0) { - fDistSq = TRACKED_NEW hsScalar[num * num]; - fInfluences = TRACKED_NEW plParticleInfluenceInfo[num]; + fDistSq = new float[num * num]; + fInfluences = new plParticleInfluenceInfo[num]; } } @@ -833,7 +833,7 @@ void plParticleFlockEffect::Read(hsStream *s, hsResMgr *mgr) fGoalChaseStr = s->ReadLEScalar(); SetMaxOrbitSpeed(s->ReadLEScalar()); SetMaxChaseSpeed(s->ReadLEScalar()); - SetMaxParticles((UInt16)s->ReadLEScalar()); + SetMaxParticles((uint16_t)s->ReadLEScalar()); } void plParticleFlockEffect::Write(hsStream *s, hsResMgr *mgr) @@ -889,7 +889,7 @@ void plParticleFollowSystemEffect::PrepareEffect(const plEffectTargetInfo& targe fEvalThisFrame = (fOldW2L != target.fContext.fSystem->GetTarget(0)->GetWorldToLocal()); } -hsBool plParticleFollowSystemEffect::ApplyEffect(const plEffectTargetInfo& target, Int32 i) +hsBool plParticleFollowSystemEffect::ApplyEffect(const plEffectTargetInfo& target, int32_t i) { if (fEvalThisFrame) { diff --git a/Sources/Plasma/PubUtilLib/plParticleSystem/plParticleEffect.h b/Sources/Plasma/PubUtilLib/plParticleSystem/plParticleEffect.h index 2d0d6012..f74073c6 100644 --- a/Sources/Plasma/PubUtilLib/plParticleSystem/plParticleEffect.h +++ b/Sources/Plasma/PubUtilLib/plParticleSystem/plParticleEffect.h @@ -67,7 +67,7 @@ public: // context (invalidating anything cached). // Defaults for Prepare and End are no-ops. virtual void PrepareEffect(const plEffectTargetInfo& target) {} - virtual hsBool ApplyEffect(const plEffectTargetInfo& target, Int32 i) = 0; + virtual hsBool ApplyEffect(const plEffectTargetInfo& target, int32_t i) = 0; virtual void EndEffect(const plEffectTargetInfo& target) {} }; @@ -102,7 +102,7 @@ public: CLASSNAME_REGISTER( plParticleCollisionEffectBeat ); GETINTERFACE_ANY( plParticleCollisionEffectBeat, plParticleCollisionEffect ); - virtual hsBool ApplyEffect(const plEffectTargetInfo& target, Int32 i); + virtual hsBool ApplyEffect(const plEffectTargetInfo& target, int32_t i); }; // This particle blocker just kills any particles that hit it. @@ -114,30 +114,30 @@ public: CLASSNAME_REGISTER( plParticleCollisionEffectDie ); GETINTERFACE_ANY( plParticleCollisionEffectDie, plParticleCollisionEffect ); - virtual hsBool ApplyEffect(const plEffectTargetInfo& target, Int32 i); + virtual hsBool ApplyEffect(const plEffectTargetInfo& target, int32_t i); }; class plParticleCollisionEffectBounce : public plParticleCollisionEffect { protected: - hsScalar fBounce; - hsScalar fFriction; + float fBounce; + float fFriction; public: plParticleCollisionEffectBounce(); CLASSNAME_REGISTER( plParticleCollisionEffectBounce ); GETINTERFACE_ANY( plParticleCollisionEffectBounce, plParticleCollisionEffect ); - virtual hsBool ApplyEffect(const plEffectTargetInfo& target, Int32 i); + virtual hsBool ApplyEffect(const plEffectTargetInfo& target, int32_t i); virtual void Read(hsStream *s, hsResMgr *mgr); virtual void Write(hsStream *s, hsResMgr *mgr); - void SetBounce(hsScalar b) { fBounce = b; } - hsScalar GetBounce() const { return fBounce; } + void SetBounce(float b) { fBounce = b; } + float GetBounce() const { return fBounce; } - void SetFriction(hsScalar f) { fFriction = f; } - hsScalar GetFriction() const { return fFriction; } + void SetFriction(float f) { fFriction = f; } + float GetFriction() const { return fFriction; } }; class plParticleFadeVolumeEffect : public plParticleEffect @@ -157,13 +157,13 @@ public: GETINTERFACE_ANY( plParticleFadeVolumeEffect, plParticleEffect ); virtual void PrepareEffect(const plEffectTargetInfo& target); - virtual hsBool ApplyEffect(const plEffectTargetInfo& target, Int32 i); + virtual hsBool ApplyEffect(const plEffectTargetInfo& target, int32_t i); virtual void Read(hsStream *s, hsResMgr *mgr); virtual void Write(hsStream *s, hsResMgr *mgr); //virtual hsBool MsgReceive(plMessage *msg); - hsScalar fLength; + float fLength; hsBool fIgnoreZ; }; @@ -171,9 +171,9 @@ class plParticleWindEffect : public plParticleEffect { protected: // The properties that define the wind. These might/should be animatable. - hsScalar fStrength; - hsScalar fConstancy; - hsScalar fSwirl; + float fStrength; + float fConstancy; + float fSwirl; hsBool fHorizontal; hsVector3 fRefDir; @@ -193,19 +193,19 @@ public: GETINTERFACE_ANY( plParticleWindEffect, plParticleEffect ); virtual void PrepareEffect(const plEffectTargetInfo& target); - virtual hsBool ApplyEffect(const plEffectTargetInfo& target, Int32 i) = 0; + virtual hsBool ApplyEffect(const plEffectTargetInfo& target, int32_t i) = 0; virtual void Read(hsStream *s, hsResMgr *mgr); virtual void Write(hsStream *s, hsResMgr *mgr); - void SetStrength(hsScalar v) { fStrength = v; } - hsScalar GetStrength() const { return fStrength; } + void SetStrength(float v) { fStrength = v; } + float GetStrength() const { return fStrength; } - void SetConstancy(hsScalar c) { fConstancy = c; } - hsScalar GetConstancy() const { return fConstancy; } + void SetConstancy(float c) { fConstancy = c; } + float GetConstancy() const { return fConstancy; } - void SetSwirl(hsScalar s) { fSwirl = s; } - hsScalar GetSwirl() const { return fSwirl; } + void SetSwirl(float s) { fSwirl = s; } + float GetSwirl() const { return fSwirl; } void SetHorizontal(hsBool on) { fHorizontal = on; } hsBool GetHorizontal() const { return fHorizontal; } @@ -218,7 +218,7 @@ class plParticleLocalWind : public plParticleWindEffect { protected: hsVector3 fScale; - hsScalar fSpeed; + float fSpeed; hsVector3 fPhase; hsVector3 fInvScale; @@ -232,13 +232,13 @@ public: GETINTERFACE_ANY( plParticleLocalWind, plParticleWindEffect ); virtual void PrepareEffect(const plEffectTargetInfo& target); - virtual hsBool ApplyEffect(const plEffectTargetInfo& target, Int32 i); + virtual hsBool ApplyEffect(const plEffectTargetInfo& target, int32_t i); void SetScale(const hsVector3& v) { fScale = v; } const hsVector3& GetScale() const { return fScale; } - void SetSpeed(hsScalar v) { fSpeed = v; } - hsScalar GetSpeed() const { return fSpeed; } + void SetSpeed(float v) { fSpeed = v; } + float GetSpeed() const { return fSpeed; } virtual void Read(hsStream *s, hsResMgr *mgr); virtual void Write(hsStream *s, hsResMgr *mgr); @@ -249,15 +249,15 @@ class plParticleUniformWind : public plParticleWindEffect { protected: - hsScalar fFreqMin; - hsScalar fFreqMax; - hsScalar fFreqCurr; - hsScalar fFreqRate; + float fFreqMin; + float fFreqMax; + float fFreqCurr; + float fFreqRate; double fCurrPhase; double fLastFreqSecs; - hsScalar fCurrentStrength; + float fCurrentStrength; public: plParticleUniformWind(); ~plParticleUniformWind(); @@ -266,10 +266,10 @@ public: GETINTERFACE_ANY( plParticleUniformWind, plParticleWindEffect ); virtual void PrepareEffect(const plEffectTargetInfo& target); - virtual hsBool ApplyEffect(const plEffectTargetInfo& target, Int32 i); + virtual hsBool ApplyEffect(const plEffectTargetInfo& target, int32_t i); - void SetFrequencyRange(hsScalar minSecsPerCycle, hsScalar maxSecsPerCycle); - void SetFrequencyRate(hsScalar secsPerCycle); + void SetFrequencyRange(float minSecsPerCycle, float maxSecsPerCycle); + void SetFrequencyRate(float secsPerCycle); virtual void Read(hsStream *s, hsResMgr *mgr); virtual void Write(hsStream *s, hsResMgr *mgr); @@ -289,19 +289,19 @@ class plParticleFlockEffect : public plParticleEffect protected: hsPoint3 fTargetOffset; // Worldspace offset from our target to get the true goal hsPoint3 fDissenterTarget; // Where to particles go when they get scared and leave us? - hsScalar fInfAvgRadSq; // Square of the radius of influence for average velocity matching. - hsScalar fInfRepRadSq; // Same, for repelling from neighbors. - hsScalar fAvgVelStr; // How strongly are we influenced by average dir? - hsScalar fRepDirStr; // Same for repelling - hsScalar fGoalOrbitStr; // Same for the goal (when we're within the desired distance) - hsScalar fGoalChaseStr; // Same for the goal (when we're too far away, and chasing it) - hsScalar fGoalDistSq; - hsScalar fFullChaseDistSq; - hsScalar fMaxOrbitSpeed; - hsScalar fMaxChaseSpeed; - - UInt16 fMaxParticles; - hsScalar *fDistSq; // Table of distances from particle to particle + float fInfAvgRadSq; // Square of the radius of influence for average velocity matching. + float fInfRepRadSq; // Same, for repelling from neighbors. + float fAvgVelStr; // How strongly are we influenced by average dir? + float fRepDirStr; // Same for repelling + float fGoalOrbitStr; // Same for the goal (when we're within the desired distance) + float fGoalChaseStr; // Same for the goal (when we're too far away, and chasing it) + float fGoalDistSq; + float fFullChaseDistSq; + float fMaxOrbitSpeed; + float fMaxChaseSpeed; + + uint16_t fMaxParticles; + float *fDistSq; // Table of distances from particle to particle plParticleInfluenceInfo *fInfluences; void IUpdateDistances(const plEffectTargetInfo &target); @@ -315,21 +315,21 @@ public: GETINTERFACE_ANY( plParticleFlockEffect, plParticleEffect ); virtual void PrepareEffect(const plEffectTargetInfo& target); - virtual hsBool ApplyEffect(const plEffectTargetInfo& target, Int32 i); + virtual hsBool ApplyEffect(const plEffectTargetInfo& target, int32_t i); void SetTargetOffset(const hsPoint3 &offset) { fTargetOffset = offset; } void SetDissenterTarget(const hsPoint3 &target) { fDissenterTarget = target; } - void SetInfluenceAvgRadius(hsScalar val) { fInfAvgRadSq = val * val; } - void SetInfluenceRepelRadius(hsScalar val) { fInfRepRadSq = val * val; } - void SetGoalRadius(hsScalar val) { fGoalDistSq = val * val; } - void SetFullChaseRadius(hsScalar val) { fFullChaseDistSq = val * val; } - void SetConformStr(hsScalar val) { fAvgVelStr = val; } - void SetRepelStr(hsScalar val) { fRepDirStr = val; } - void SetGoalOrbitStr(hsScalar val) { fGoalOrbitStr = val; } - void SetGoalChaseStr(hsScalar val) { fGoalChaseStr = val; } - void SetMaxOrbitSpeed(hsScalar val) { fMaxOrbitSpeed = val; } - void SetMaxChaseSpeed(hsScalar val) { fMaxChaseSpeed = val; } - void SetMaxParticles(UInt16 num); + void SetInfluenceAvgRadius(float val) { fInfAvgRadSq = val * val; } + void SetInfluenceRepelRadius(float val) { fInfRepRadSq = val * val; } + void SetGoalRadius(float val) { fGoalDistSq = val * val; } + void SetFullChaseRadius(float val) { fFullChaseDistSq = val * val; } + void SetConformStr(float val) { fAvgVelStr = val; } + void SetRepelStr(float val) { fRepDirStr = val; } + void SetGoalOrbitStr(float val) { fGoalOrbitStr = val; } + void SetGoalChaseStr(float val) { fGoalChaseStr = val; } + void SetMaxOrbitSpeed(float val) { fMaxOrbitSpeed = val; } + void SetMaxChaseSpeed(float val) { fMaxChaseSpeed = val; } + void SetMaxParticles(uint16_t num); virtual void Read(hsStream *s, hsResMgr *mgr); virtual void Write(hsStream *s, hsResMgr *mgr); @@ -345,7 +345,7 @@ public: plParticleFollowSystemEffect(); virtual void PrepareEffect(const plEffectTargetInfo& target); - virtual hsBool ApplyEffect(const plEffectTargetInfo& target, Int32 i); + virtual hsBool ApplyEffect(const plEffectTargetInfo& target, int32_t i); virtual void EndEffect(const plEffectTargetInfo& target); protected: diff --git a/Sources/Plasma/PubUtilLib/plParticleSystem/plParticleEmitter.cpp b/Sources/Plasma/PubUtilLib/plParticleSystem/plParticleEmitter.cpp index ae200e97..832ed290 100644 --- a/Sources/Plasma/PubUtilLib/plParticleSystem/plParticleEmitter.cpp +++ b/Sources/Plasma/PubUtilLib/plParticleSystem/plParticleEmitter.cpp @@ -39,8 +39,8 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com Mead, WA 99021 *==LICENSE==*/ -#include "hsTypes.h" -#include "hsUtils.h" +#include "HeadSpin.h" + #include "hsResMgr.h" #include "pnMessage/plRefMsg.h" #include "plMessage/plParticleUpdateMsg.h" @@ -68,7 +68,7 @@ plParticleEmitter::plParticleEmitter() fTimeToLive = 0; } -void plParticleEmitter::Init(plParticleSystem *system, UInt32 maxParticles, UInt32 spanIndex, UInt32 miscFlags, +void plParticleEmitter::Init(plParticleSystem *system, uint32_t maxParticles, uint32_t spanIndex, uint32_t miscFlags, plParticleGenerator *gen /* = nil */) { IClear(); @@ -93,7 +93,7 @@ void plParticleEmitter::Init(plParticleSystem *system, UInt32 maxParticles, UInt ISetupParticleMem(); } -void plParticleEmitter::Clone(plParticleEmitter* src, UInt32 spanIndex) +void plParticleEmitter::Clone(plParticleEmitter* src, uint32_t spanIndex) { Init(src->fSystem, src->fMaxParticles, @@ -131,18 +131,18 @@ void plParticleEmitter::ISetupParticleMem() { fNumValidParticles = 0; - fParticleCores = TRACKED_NEW plParticleCore[fMaxParticles]; - fParticleExts = TRACKED_NEW plParticleExt[fMaxParticles]; + fParticleCores = new plParticleCore[fMaxParticles]; + fParticleExts = new plParticleExt[fMaxParticles]; - fTargetInfo.fPos = (UInt8 *)fParticleCores; - fTargetInfo.fColor = (UInt8 *)fParticleCores + sizeof(hsPoint3); + fTargetInfo.fPos = (uint8_t *)fParticleCores; + fTargetInfo.fColor = (uint8_t *)fParticleCores + sizeof(hsPoint3); fTargetInfo.fPosStride = fTargetInfo.fColorStride = sizeof(plParticleCore); - fTargetInfo.fVelocity = (UInt8 *)fParticleExts; + fTargetInfo.fVelocity = (uint8_t *)fParticleExts; fTargetInfo.fInvMass = fTargetInfo.fVelocity + sizeof(hsVector3); - fTargetInfo.fAcceleration = fTargetInfo.fInvMass + sizeof(hsScalar); - fTargetInfo.fMiscFlags = (UInt8 *)&(fParticleExts[0].fMiscFlags); - fTargetInfo.fRadsPerSec = (UInt8 *)&(fParticleExts[0].fRadsPerSec); + fTargetInfo.fAcceleration = fTargetInfo.fInvMass + sizeof(float); + fTargetInfo.fMiscFlags = (uint8_t *)&(fParticleExts[0].fMiscFlags); + fTargetInfo.fRadsPerSec = (uint8_t *)&(fParticleExts[0].fRadsPerSec); fTargetInfo.fVelocityStride = fTargetInfo.fInvMassStride = fTargetInfo.fAccelerationStride @@ -151,7 +151,7 @@ void plParticleEmitter::ISetupParticleMem() = sizeof(plParticleExt); } -UInt32 plParticleEmitter::GetNumTiles() const +uint32_t plParticleEmitter::GetNumTiles() const { return fSystem->GetNumTiles(); } @@ -161,13 +161,13 @@ const hsMatrix44 &plParticleEmitter::GetLocalToWorld() const return fMiscFlags & kOverrideLocalToWorld ? fLocalToWorld : fSystem->GetLocalToWorld(); } -void plParticleEmitter::AddParticle(hsPoint3 &pos, hsVector3 &velocity, UInt32 tileIndex, - hsScalar hSize, hsScalar vSize, hsScalar scale, hsScalar invMass, hsScalar life, - hsPoint3 &orientation, UInt32 miscFlags, hsScalar radsPerSec) +void plParticleEmitter::AddParticle(hsPoint3 &pos, hsVector3 &velocity, uint32_t tileIndex, + float hSize, float vSize, float scale, float invMass, float life, + hsPoint3 &orientation, uint32_t miscFlags, float radsPerSec) { plParticleCore *core; plParticleExt *ext; - UInt32 currParticle; + uint32_t currParticle; if (fNumValidParticles == fMaxParticles) return; // No more room... you lose! @@ -185,8 +185,8 @@ void plParticleEmitter::AddParticle(hsPoint3 &pos, hsVector3 &velocity, UInt32 t //if (core->fMiscFlags & kNormalUp != 0) core->fNormal.Set(0, 0, 1); - hsScalar xOff = (tileIndex % fSystem->fXTiles) / (float)fSystem->fXTiles; - hsScalar yOff = (tileIndex / fSystem->fXTiles) / (float)fSystem->fYTiles; + float xOff = (tileIndex % fSystem->fXTiles) / (float)fSystem->fXTiles; + float yOff = (tileIndex / fSystem->fXTiles) / (float)fSystem->fYTiles; core->fUVCoords[0].fX = xOff; core->fUVCoords[0].fY = yOff + 1.0f / fSystem->fYTiles; @@ -220,7 +220,7 @@ void plParticleEmitter::WipeExistingParticles() } // This method is called from a network received message. Don't trust the args without checking. -void plParticleEmitter::KillParticles(hsScalar num, hsScalar timeToDie, UInt8 flags) +void plParticleEmitter::KillParticles(float num, float timeToDie, uint8_t flags) { if (flags & plParticleKillMsg::kParticleKillPercentage) { @@ -252,16 +252,16 @@ void plParticleEmitter::KillParticles(hsScalar num, hsScalar timeToDie, UInt8 fl } } -void plParticleEmitter::UpdateGenerator(UInt32 paramID, hsScalar paramValue) +void plParticleEmitter::UpdateGenerator(uint32_t paramID, float paramValue) { if (fGenerator != nil) fGenerator->UpdateParam(paramID, paramValue); } -UInt16 plParticleEmitter::StealParticlesFrom(plParticleEmitter *victim, UInt16 num) +uint16_t plParticleEmitter::StealParticlesFrom(plParticleEmitter *victim, uint16_t num) { - UInt16 spaceAvail = (UInt16)(fMaxParticles - fNumValidParticles); - UInt16 numToCopy = (UInt16)(hsMinimum(num, (victim ? victim->fNumValidParticles : 0))); + uint16_t spaceAvail = (uint16_t)(fMaxParticles - fNumValidParticles); + uint16_t numToCopy = (uint16_t)(hsMinimum(num, (victim ? victim->fNumValidParticles : 0))); if (spaceAvail < numToCopy) numToCopy = spaceAvail; @@ -285,7 +285,7 @@ void plParticleEmitter::TranslateAllParticles(hsPoint3 &amount) fParticleCores[i].fPos += amount; } -hsBool plParticleEmitter::IUpdate(hsScalar delta) +hsBool plParticleEmitter::IUpdate(float delta) { if (fMiscFlags & kNeedsUpdate) { @@ -303,7 +303,7 @@ hsBool plParticleEmitter::IUpdate(hsScalar delta) return true; } -void plParticleEmitter::IUpdateParticles(hsScalar delta) +void plParticleEmitter::IUpdateParticles(float delta) { int i, j; @@ -343,7 +343,7 @@ void plParticleEmitter::IUpdateParticles(hsScalar delta) hsVector3 *currVelocity; hsVector3 *currAccel; hsPoint3 color(fColor.r, fColor.g, fColor.b); - hsScalar alpha = fColor.a; + float alpha = fColor.a; plController *colorCtl; // Allow effects a chance to cache any upfront calculations @@ -365,7 +365,7 @@ void plParticleEmitter::IUpdateParticles(hsScalar delta) { if (!( fParticleExts[i].fMiscFlags & plParticleExt::kImmortal )) { - hsScalar percent = (1.0f - fParticleExts[i].fLife / fParticleExts[i].fStartLife); + float percent = (1.0f - fParticleExts[i].fLife / fParticleExts[i].fStartLife); colorCtl = (fMiscFlags & kMatIsEmissive ? fSystem->fAmbientCtl : fSystem->fDiffuseCtl); if (colorCtl != nil) colorCtl->Interp(colorCtl->GetLength() * percent, &color); @@ -417,8 +417,8 @@ void plParticleEmitter::IUpdateParticles(hsScalar delta) } else if( fParticleExts[i].fRadsPerSec != 0 ) { - hsScalar sinX, cosX; - hsFastMath::SinCos(fParticleExts[i].fLife * fParticleExts[i].fRadsPerSec * 2.f * hsScalarPI, sinX, cosX); + float sinX, cosX; + hsFastMath::SinCos(fParticleExts[i].fLife * fParticleExts[i].fRadsPerSec * 2.f * M_PI, sinX, cosX); fParticleCores[i].fOrientation.Set(sinX, -cosX, 0); } @@ -431,7 +431,7 @@ void plParticleEmitter::IUpdateParticles(hsScalar delta) // V = V + -k*(V * delta) // V *= (1 + -k * delta) // Giving the change in velocity. - hsScalar drag = 1.f + fSystem->fDrag * delta; + float drag = 1.f + fSystem->fDrag * delta; // Clamp it at 0. Drag should never cause a reversal in velocity direction. if( drag < 0.f ) drag = 0.f; @@ -478,7 +478,7 @@ void plParticleEmitter::IUpdateParticles(hsScalar delta) plProfile_CreateTimer("Bound", "Particles", ParticleBound); plProfile_CreateTimer("Normal", "Particles", ParticleNormal); -void plParticleEmitter::IUpdateBoundsAndNormals(hsScalar delta) +void plParticleEmitter::IUpdateBoundsAndNormals(float delta) { plProfile_BeginTiming(ParticleBound); fBoundBox.MakeEmpty(); @@ -526,7 +526,7 @@ void plParticleEmitter::IUpdateBoundsAndNormals(hsScalar delta) plProfile_EndTiming(ParticleNormal); } -void plParticleEmitter::IRemoveParticle(UInt32 index) +void plParticleEmitter::IRemoveParticle(uint32_t index) { hsAssert(index < fNumValidParticles, "Trying to remove an invalid particle"); @@ -571,19 +571,19 @@ void plParticleEmitter::Write(hsStream *s, hsResMgr *mgr) fColor.Write(s); } -UInt32 plParticleEmitter::CreateHexColor(const hsColorRGBA &color) +uint32_t plParticleEmitter::CreateHexColor(const hsColorRGBA &color) { return CreateHexColor(color.r, color.g, color.b, color.a); } -UInt32 plParticleEmitter::CreateHexColor(const hsScalar r, const hsScalar g, const hsScalar b, const hsScalar a) +uint32_t plParticleEmitter::CreateHexColor(const float r, const float g, const float b, const float a) { - UInt32 ru, gu, bu, au; + uint32_t ru, gu, bu, au; - au = (UInt32)(a * 255.0f); - ru = (UInt32)(r * 255.0f); - gu = (UInt32)(g * 255.0f); - bu = (UInt32)(b * 255.0f); + au = (uint32_t)(a * 255.0f); + ru = (uint32_t)(r * 255.0f); + gu = (uint32_t)(g * 255.0f); + bu = (uint32_t)(b * 255.0f); return ( au << 24 ) | ( ru << 16 ) | ( gu << 8 ) | ( bu ); } diff --git a/Sources/Plasma/PubUtilLib/plParticleSystem/plParticleEmitter.h b/Sources/Plasma/PubUtilLib/plParticleSystem/plParticleEmitter.h index d4921b16..ebb61737 100644 --- a/Sources/Plasma/PubUtilLib/plParticleSystem/plParticleEmitter.h +++ b/Sources/Plasma/PubUtilLib/plParticleSystem/plParticleEmitter.h @@ -67,34 +67,34 @@ class plParticleEmitter : public plCreatable public: plParticleEmitter(); ~plParticleEmitter(); - void Init(plParticleSystem *system, UInt32 maxParticles, UInt32 spanIndex, UInt32 miscFlags, + void Init(plParticleSystem *system, uint32_t maxParticles, uint32_t spanIndex, uint32_t miscFlags, plParticleGenerator *gen = nil); - void Clone(plParticleEmitter* src, UInt32 spanIndex); + void Clone(plParticleEmitter* src, uint32_t spanIndex); plParticleCore *GetParticleArray() const { return fParticleCores; } - UInt32 GetParticleCount() const { return fNumValidParticles; } - UInt32 GetNumTiles() const; + uint32_t GetParticleCount() const { return fNumValidParticles; } + uint32_t GetNumTiles() const; const hsBounds3Ext &GetBoundingBox() const { return fBoundBox; } - UInt32 GetSpanIndex() const { return fSpanIndex; } + uint32_t GetSpanIndex() const { return fSpanIndex; } const hsMatrix44 &GetLocalToWorld() const; - void AddParticle(hsPoint3 &pos, hsVector3 &velocity, UInt32 tileIndex, - hsScalar hSize, hsScalar vSize, hsScalar scale, hsScalar invMass, hsScalar life, - hsPoint3 &orientation, UInt32 miscFlags, hsScalar radsPerSec=0); + void AddParticle(hsPoint3 &pos, hsVector3 &velocity, uint32_t tileIndex, + float hSize, float vSize, float scale, float invMass, float life, + hsPoint3 &orientation, uint32_t miscFlags, float radsPerSec=0); void WipeExistingParticles(); - void KillParticles(hsScalar num, hsScalar timeToDie, UInt8 flags); - UInt16 StealParticlesFrom(plParticleEmitter *victim, UInt16 num); // returns the number actually stolen + void KillParticles(float num, float timeToDie, uint8_t flags); + uint16_t StealParticlesFrom(plParticleEmitter *victim, uint16_t num); // returns the number actually stolen void TranslateAllParticles(hsPoint3 &amount); // Used to recenter the system when linking between ages. - void UpdateGenerator(UInt32 paramID, hsScalar paramValue); + void UpdateGenerator(uint32_t paramID, float paramValue); - static UInt32 CreateHexColor(const hsColorRGBA &color); - static UInt32 CreateHexColor(const hsScalar r, const hsScalar g, const hsScalar b, const hsScalar a); + static uint32_t CreateHexColor(const hsColorRGBA &color); + static uint32_t CreateHexColor(const float r, const float g, const float b, const float a); void OverrideLocalToWorld(const hsMatrix44& l2w); void UnOverrideLocalToWorld() { fMiscFlags &= ~kOverrideLocalToWorld; } hsBool LocalToWorldOverridden() const { return 0 != (fMiscFlags & kOverrideLocalToWorld); } - void SetTimeToLive(hsScalar dt) { fTimeToLive = dt; } - hsScalar GetTimeToLive() const { return fTimeToLive; } // 0 time to live is never turn off. + void SetTimeToLive(float dt) { fTimeToLive = dt; } + float GetTimeToLive() const { return fTimeToLive; } // 0 time to live is never turn off. CLASSNAME_REGISTER( plParticleEmitter ); GETINTERFACE_ANY( plParticleEmitter, plCreatable); @@ -127,7 +127,7 @@ public: kOrientationVelocityMask = kOrientationVelocityBased | kOrientationVelocityStretch | kOrientationVelocityFlow, // Velocity dependent kOrientationMask = kOrientationUp | kOrientationVelocityMask, }; - UInt32 fMiscFlags; + uint32_t fMiscFlags; protected: @@ -137,23 +137,23 @@ protected: // doesn't need. plParticleGenerator *fGenerator; // Optional auto generator (have this be nil if you don't want auto-generation) - UInt32 fSpanIndex; // Index of the span that this emitter uses. - UInt32 fNumValidParticles; - UInt32 fMaxParticles; + uint32_t fSpanIndex; // Index of the span that this emitter uses. + uint32_t fNumValidParticles; + uint32_t fMaxParticles; hsBounds3Ext fBoundBox; plEffectTargetInfo fTargetInfo; // A collection of pointers and strides that plParticleEffects will manipulate. hsColorRGBA fColor; hsMatrix44 fLocalToWorld; - hsScalar fTimeToLive; + float fTimeToLive; void IClear(); void ISetupParticleMem(); void ISetSystem(plParticleSystem *sys) { fSystem = sys; } - hsBool IUpdate(hsScalar delta); - void IUpdateParticles(hsScalar delta); - void IUpdateBoundsAndNormals(hsScalar delta); - void IRemoveParticle(UInt32 index); + hsBool IUpdate(float delta); + void IUpdateParticles(float delta); + void IUpdateBoundsAndNormals(float delta); + void IRemoveParticle(uint32_t index); }; #endif diff --git a/Sources/Plasma/PubUtilLib/plParticleSystem/plParticleGenerator.cpp b/Sources/Plasma/PubUtilLib/plParticleSystem/plParticleGenerator.cpp index c0e0b044..501d30a3 100644 --- a/Sources/Plasma/PubUtilLib/plParticleSystem/plParticleGenerator.cpp +++ b/Sources/Plasma/PubUtilLib/plParticleSystem/plParticleGenerator.cpp @@ -39,11 +39,11 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com Mead, WA 99021 *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "hsGeometry3.h" #include "hsStream.h" #include "hsFastMath.h" -#include "hsUtils.h" + #include "plParticle.h" #include "plParticleSystem.h" #include "plParticleEmitter.h" @@ -54,14 +54,14 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "hsResMgr.h" #include "plMath/plRandom.h" -static const hsScalar DEFAULT_INVERSE_MASS = 1.f; +static const float DEFAULT_INVERSE_MASS = 1.f; static plRandom sRandom; const void plParticleGenerator::ComputeDirection(float pitch, float yaw, hsVector3 &direction) { - hsScalar cosPitch, sinPitch; - hsScalar cosYaw, sinYaw; + float cosPitch, sinPitch; + float cosYaw, sinYaw; hsFastMath::SinCos(pitch, sinPitch, cosPitch); hsFastMath::SinCos(yaw, sinYaw, cosYaw); @@ -101,13 +101,13 @@ plSimpleParticleGenerator::~plSimpleParticleGenerator() delete [] fInitYaw; } -void plSimpleParticleGenerator::Init(hsScalar genLife, hsScalar partLifeMin, hsScalar partLifeMax, - hsScalar particlesPerSecond, UInt32 numSources, hsPoint3 *initPos, - hsScalar *initPitch, hsScalar *initYaw, hsScalar angleRange, - hsScalar initVelMin, hsScalar initVelMax, - hsScalar xSize, hsScalar ySize, - hsScalar scaleMin, hsScalar scaleMax, - hsScalar massRange, hsScalar radsPerSecRange) +void plSimpleParticleGenerator::Init(float genLife, float partLifeMin, float partLifeMax, + float particlesPerSecond, uint32_t numSources, hsPoint3 *initPos, + float *initPitch, float *initYaw, float angleRange, + float initVelMin, float initVelMax, + float xSize, float ySize, + float scaleMin, float scaleMax, + float massRange, float radsPerSecRange) { fGenLife = genLife; fPartLifeMin = partLifeMin; @@ -135,9 +135,9 @@ void plSimpleParticleGenerator::Init(hsScalar genLife, hsScalar partLifeMin, hsS if (fGenLife < 0) fMiscFlags |= kImmortal; } -hsBool plSimpleParticleGenerator::AddAutoParticles(plParticleEmitter *emitter, float dt, UInt32 numForced /* = 0 */) +hsBool plSimpleParticleGenerator::AddAutoParticles(plParticleEmitter *emitter, float dt, uint32_t numForced /* = 0 */) { - Int32 numNewParticles; + int32_t numNewParticles; if (numForced == 0) { @@ -146,7 +146,7 @@ hsBool plSimpleParticleGenerator::AddAutoParticles(plParticleEmitter *emitter, f return true; // Leave it around so that a message can bring it back to life. fParticleSum += fParticlesPerSecond * dt; - numNewParticles = (Int32)fParticleSum; + numNewParticles = (int32_t)fParticleSum; if (numNewParticles <= 0 || fParticlesPerSecond == 0) return true; @@ -156,27 +156,27 @@ hsBool plSimpleParticleGenerator::AddAutoParticles(plParticleEmitter *emitter, f numNewParticles = numForced; } - UInt32 miscFlags = 0; + uint32_t miscFlags = 0; hsPoint3 currStart; fParticleSum -= numNewParticles; hsPoint3 orientation; hsVector3 initDirection; - hsScalar vel = (fVelMax + fVelMin) * 0.5f; - hsScalar velRange = vel - fVelMin; - hsScalar initVelocity; - hsScalar initLife; - hsScalar life = (fPartLifeMax + fPartLifeMin) * 0.5f; - hsScalar lifeRange = life - fPartLifeMin; - hsScalar currSizeVar; - hsScalar scale = (fScaleMax + fScaleMin) * 0.5f; - hsScalar scaleRange = scale - fScaleMin; - hsScalar radsPerSec = 0; - UInt32 tile; - UInt32 sourceIndex; - - const hsScalar lifeDiff = dt / numNewParticles; - hsScalar lifeSoFar; + float vel = (fVelMax + fVelMin) * 0.5f; + float velRange = vel - fVelMin; + float initVelocity; + float initLife; + float life = (fPartLifeMax + fPartLifeMin) * 0.5f; + float lifeRange = life - fPartLifeMin; + float currSizeVar; + float scale = (fScaleMax + fScaleMin) * 0.5f; + float scaleRange = scale - fScaleMin; + float radsPerSec = 0; + uint32_t tile; + uint32_t sourceIndex; + + const float lifeDiff = dt / numNewParticles; + float lifeSoFar; int i; for (i = 0, lifeSoFar = 0; i < numNewParticles; i++, lifeSoFar += lifeDiff) { @@ -189,7 +189,7 @@ hsBool plSimpleParticleGenerator::AddAutoParticles(plParticleEmitter *emitter, f if (initLife <= 0 && initLife + lifeSoFar >= 0) continue; - sourceIndex = (UInt32)(sRandom.RandZeroToOne() * fNumSources); + sourceIndex = (uint32_t)(sRandom.RandZeroToOne() * fNumSources); ComputeDirection(fInitPitch[sourceIndex] + fAngleRange * sRandom.RandMinusOneToOne(), fInitYaw[sourceIndex] + fAngleRange * sRandom.RandMinusOneToOne(), initDirection); @@ -205,10 +205,10 @@ hsBool plSimpleParticleGenerator::AddAutoParticles(plParticleEmitter *emitter, f else orientation.Set(&initDirection); - tile = (UInt32)(sRandom.RandZeroToOne() * emitter->GetNumTiles()); + tile = (uint32_t)(sRandom.RandZeroToOne() * emitter->GetNumTiles()); currSizeVar = scale + scaleRange * sRandom.RandMinusOneToOne(); - hsScalar invMass = fPartInvMassMin; + float invMass = fPartInvMassMin; // Might be faster to just do the math instead of checking for zero... if( fPartInvMassRange > 0 ) invMass += fPartInvMassRange * sRandom.RandZeroToOne(); @@ -224,7 +224,7 @@ hsBool plSimpleParticleGenerator::AddAutoParticles(plParticleEmitter *emitter, f return true; } -void plSimpleParticleGenerator::UpdateParam(UInt32 paramID, hsScalar paramValue) +void plSimpleParticleGenerator::UpdateParam(uint32_t paramID, float paramValue) { switch (paramID) { @@ -296,14 +296,14 @@ void plSimpleParticleGenerator::UpdateParam(UInt32 paramID, hsScalar paramValue) void plSimpleParticleGenerator::Read(hsStream* s, hsResMgr *mgr) { - hsScalar genLife = s->ReadLEScalar(); - hsScalar partLifeMin = s->ReadLEScalar(); - hsScalar partLifeMax = s->ReadLEScalar(); - hsScalar pps = s->ReadLEScalar(); - UInt32 numSources = s->ReadLE32(); - hsPoint3 *pos = TRACKED_NEW hsPoint3[numSources]; - hsScalar *pitch = TRACKED_NEW hsScalar[numSources]; - hsScalar *yaw = TRACKED_NEW hsScalar[numSources]; + float genLife = s->ReadLEScalar(); + float partLifeMin = s->ReadLEScalar(); + float partLifeMax = s->ReadLEScalar(); + float pps = s->ReadLEScalar(); + uint32_t numSources = s->ReadLE32(); + hsPoint3 *pos = new hsPoint3[numSources]; + float *pitch = new float[numSources]; + float *yaw = new float[numSources]; int i; for (i = 0; i < numSources; i++) { @@ -311,15 +311,15 @@ void plSimpleParticleGenerator::Read(hsStream* s, hsResMgr *mgr) pitch[i] = s->ReadLEScalar(); yaw[i] = s->ReadLEScalar(); } - hsScalar angleRange = s->ReadLEScalar(); - hsScalar velMin = s->ReadLEScalar(); - hsScalar velMax = s->ReadLEScalar(); - hsScalar xSize = s->ReadLEScalar(); - hsScalar ySize = s->ReadLEScalar(); - hsScalar scaleMin = s->ReadLEScalar(); - hsScalar scaleMax = s->ReadLEScalar(); - hsScalar massRange = s->ReadLEScalar(); - hsScalar radsPerSec = s->ReadLEScalar(); + float angleRange = s->ReadLEScalar(); + float velMin = s->ReadLEScalar(); + float velMax = s->ReadLEScalar(); + float xSize = s->ReadLEScalar(); + float ySize = s->ReadLEScalar(); + float scaleMin = s->ReadLEScalar(); + float scaleMax = s->ReadLEScalar(); + float massRange = s->ReadLEScalar(); + float radsPerSec = s->ReadLEScalar(); Init(genLife, partLifeMin, partLifeMax, pps, numSources, pos, pitch, yaw, angleRange, velMin, velMax, xSize, ySize, scaleMin, scaleMax, massRange, radsPerSec); @@ -347,7 +347,7 @@ void plSimpleParticleGenerator::Write(hsStream* s, hsResMgr *mgr) s->WriteLEScalar(fScaleMin); s->WriteLEScalar(fScaleMax); - hsScalar massRange = 1.f / fPartInvMassMin - DEFAULT_INVERSE_MASS; + float massRange = 1.f / fPartInvMassMin - DEFAULT_INVERSE_MASS; s->WriteLEScalar(massRange); s->WriteLEScalar(fPartRadsPerSecRange); } @@ -364,8 +364,8 @@ plOneTimeParticleGenerator::~plOneTimeParticleGenerator() delete [] fDirection; } -void plOneTimeParticleGenerator::Init(hsScalar count, hsPoint3 *pointArray, hsVector3 *dirArray, - hsScalar xSize, hsScalar ySize, hsScalar scaleMin, hsScalar scaleMax, hsScalar radsPerSecRange) +void plOneTimeParticleGenerator::Init(float count, hsPoint3 *pointArray, hsVector3 *dirArray, + float xSize, float ySize, float scaleMin, float scaleMax, float radsPerSecRange) { fCount = count; fPosition = pointArray; @@ -378,18 +378,18 @@ void plOneTimeParticleGenerator::Init(hsScalar count, hsPoint3 *pointArray, hsVe } // The numForced param is required by the parent class, but ignored by this particular generator -hsBool plOneTimeParticleGenerator::AddAutoParticles(plParticleEmitter *emitter, float dt, UInt32 numForced /* = 0 */) +hsBool plOneTimeParticleGenerator::AddAutoParticles(plParticleEmitter *emitter, float dt, uint32_t numForced /* = 0 */) { - hsScalar currSizeVar; - hsScalar scale = (fScaleMax + fScaleMin) / 2; - hsScalar scaleRange = scale - fScaleMin; + float currSizeVar; + float scale = (fScaleMax + fScaleMin) / 2; + float scaleRange = scale - fScaleMin; - hsScalar tile; + float tile; hsPoint3 currStart; hsPoint3 orientation; hsVector3 initDirection; hsVector3 zeroVel(0.f, 0.f, 0.f); - hsScalar radsPerSec = 0; + float radsPerSec = 0; int i; for (i = 0; i < fCount; i++) @@ -402,13 +402,13 @@ hsBool plOneTimeParticleGenerator::AddAutoParticles(plParticleEmitter *emitter, else orientation.Set(&initDirection); - tile = (hsScalar)(sRandom.Rand() % emitter->GetNumTiles()); + tile = (float)(sRandom.Rand() % emitter->GetNumTiles()); currSizeVar = scale + scaleRange * sRandom.RandMinusOneToOne(); if( fPartRadsPerSecRange > 0 ) radsPerSec = fPartRadsPerSecRange * sRandom.RandMinusOneToOne(); - emitter->AddParticle(currStart, zeroVel, (UInt32)tile, fXSize, fYSize, currSizeVar, + emitter->AddParticle(currStart, zeroVel, (uint32_t)tile, fXSize, fYSize, currSizeVar, DEFAULT_INVERSE_MASS, -1, orientation, 0, radsPerSec); } emitter->fMiscFlags &= ~plParticleEmitter::kNeedsUpdate; @@ -417,15 +417,15 @@ hsBool plOneTimeParticleGenerator::AddAutoParticles(plParticleEmitter *emitter, void plOneTimeParticleGenerator::Read(hsStream* s, hsResMgr *mgr) { - UInt32 count = s->ReadLE32(); - hsScalar xSize = s->ReadLEScalar(); - hsScalar ySize = s->ReadLEScalar(); - hsScalar scaleMin = s->ReadLEScalar(); - hsScalar scaleMax = s->ReadLEScalar(); - hsScalar radsPerSecRange = s->ReadLEScalar(); + uint32_t count = s->ReadLE32(); + float xSize = s->ReadLEScalar(); + float ySize = s->ReadLEScalar(); + float scaleMin = s->ReadLEScalar(); + float scaleMax = s->ReadLEScalar(); + float radsPerSecRange = s->ReadLEScalar(); - hsPoint3 *pos = TRACKED_NEW hsPoint3[count]; - hsVector3 *dir = TRACKED_NEW hsVector3[count]; + hsPoint3 *pos = new hsPoint3[count]; + hsVector3 *dir = new hsVector3[count]; int i; for (i = 0; i < count; i++) @@ -434,12 +434,12 @@ void plOneTimeParticleGenerator::Read(hsStream* s, hsResMgr *mgr) dir[i].Read(s); } - Init((hsScalar)count, pos, dir, xSize, ySize, scaleMin, scaleMax, radsPerSecRange); + Init((float)count, pos, dir, xSize, ySize, scaleMin, scaleMax, radsPerSecRange); } void plOneTimeParticleGenerator::Write(hsStream* s, hsResMgr *mgr) { - s->WriteLE32((UInt32)fCount); + s->WriteLE32((uint32_t)fCount); s->WriteLEScalar(fXSize); s->WriteLEScalar(fYSize); s->WriteLEScalar(fScaleMin); diff --git a/Sources/Plasma/PubUtilLib/plParticleSystem/plParticleGenerator.h b/Sources/Plasma/PubUtilLib/plParticleSystem/plParticleGenerator.h index 8351249f..dd8109ee 100644 --- a/Sources/Plasma/PubUtilLib/plParticleSystem/plParticleGenerator.h +++ b/Sources/Plasma/PubUtilLib/plParticleSystem/plParticleGenerator.h @@ -56,9 +56,9 @@ class plParticleGenerator : public plCreatable public: // returns false if it's done generating particles and is safe to delete. - virtual hsBool AddAutoParticles(plParticleEmitter *emitter, float dt, UInt32 numForced = 0) = 0; + virtual hsBool AddAutoParticles(plParticleEmitter *emitter, float dt, uint32_t numForced = 0) = 0; - virtual void UpdateParam(UInt32 paramID, hsScalar paramValue) = 0; + virtual void UpdateParam(uint32_t paramID, float paramValue) = 0; CLASSNAME_REGISTER( plParticleGenerator ); GETINTERFACE_ANY( plParticleGenerator, plCreatable ); @@ -73,50 +73,50 @@ class plSimpleParticleGenerator : public plParticleGenerator public: plSimpleParticleGenerator(); ~plSimpleParticleGenerator(); - void Init(hsScalar genLife, hsScalar partLifeMin, hsScalar partLifeMax, hsScalar particlesPerSecond, - UInt32 numSources, hsPoint3 *pos, hsScalar *initPitch, hsScalar *initYaw, hsScalar angleRange, - hsScalar initVelMin, hsScalar initVelMax, hsScalar xSize, hsScalar ySize, - hsScalar scaleMin, hsScalar scaleMax, - hsScalar massRange, hsScalar radsPerSecRange); + void Init(float genLife, float partLifeMin, float partLifeMax, float particlesPerSecond, + uint32_t numSources, hsPoint3 *pos, float *initPitch, float *initYaw, float angleRange, + float initVelMin, float initVelMax, float xSize, float ySize, + float scaleMin, float scaleMax, + float massRange, float radsPerSecRange); CLASSNAME_REGISTER( plSimpleParticleGenerator ); GETINTERFACE_ANY( plSimpleParticleGenerator, plParticleGenerator); - virtual hsBool AddAutoParticles(plParticleEmitter *emitter, float dt, UInt32 numForced); - virtual void UpdateParam(UInt32 paramID, hsScalar paramValue); + virtual hsBool AddAutoParticles(plParticleEmitter *emitter, float dt, uint32_t numForced); + virtual void UpdateParam(uint32_t paramID, float paramValue); virtual void Read(hsStream* s, hsResMgr *mgr); virtual void Write(hsStream* s, hsResMgr *mgr); protected: - hsScalar fParticlesPerSecond; - UInt32 fNumSources; + float fParticlesPerSecond; + uint32_t fNumSources; hsPoint3 *fInitPos; - hsScalar *fInitPitch, *fInitYaw; - hsScalar fAngleRange; - hsScalar fVelMin, fVelMax; - hsScalar fXSize, fYSize, fScaleMin, fScaleMax; - hsScalar fGenLife; // How long shall we spit out particles from this location? When this time runs out, we stop + float *fInitPitch, *fInitYaw; + float fAngleRange; + float fVelMin, fVelMax; + float fXSize, fYSize, fScaleMin, fScaleMax; + float fGenLife; // How long shall we spit out particles from this location? When this time runs out, we stop // spitting particles, but we don't actually die until all of our particles die naturally. // (Even the ones that we feel are suffering needlessly.) - hsScalar fPartLifeMin; // lifespan for the particles we generate - hsScalar fPartLifeMax; + float fPartLifeMin; // lifespan for the particles we generate + float fPartLifeMax; - hsScalar fPartInvMassMin; // Doing a uniform variant over the inverse mass range (instead of over the mass range - hsScalar fPartInvMassRange; // and then inverting) will favor the low end of the mass range, but then again, + float fPartInvMassMin; // Doing a uniform variant over the inverse mass range (instead of over the mass range + float fPartInvMassRange; // and then inverting) will favor the low end of the mass range, but then again, // it's just a freaking game. Note though that fPartInvMassMin == 1.f / massMAX. - hsScalar fPartRadsPerSecRange; // Zero means no rot, otherwise uniform random between [-range..range] + float fPartRadsPerSecRange; // Zero means no rot, otherwise uniform random between [-range..range] - hsScalar fParticleSum; + float fParticleSum; enum { kImmortal = 0x1, kDisabled = 0x2, }; - UInt32 fMiscFlags; + uint32_t fMiscFlags; }; class plOneTimeParticleGenerator : public plParticleGenerator @@ -125,24 +125,24 @@ public: plOneTimeParticleGenerator(); ~plOneTimeParticleGenerator(); - void Init(hsScalar count, hsPoint3 *pointArray, hsVector3 *dirArray, - hsScalar xSize, hsScalar ySize, hsScalar scaleMin, hsScalar scaleMax, hsScalar radsPerSec); + void Init(float count, hsPoint3 *pointArray, hsVector3 *dirArray, + float xSize, float ySize, float scaleMin, float scaleMax, float radsPerSec); CLASSNAME_REGISTER( plOneTimeParticleGenerator ); GETINTERFACE_ANY( plOneTimeParticleGenerator, plParticleGenerator); - virtual hsBool AddAutoParticles(plParticleEmitter *emitter, float dt, UInt32 numForced = 0); - virtual void UpdateParam(UInt32 paramID, hsScalar paramValue) {} + virtual hsBool AddAutoParticles(plParticleEmitter *emitter, float dt, uint32_t numForced = 0); + virtual void UpdateParam(uint32_t paramID, float paramValue) {} virtual void Read(hsStream* s, hsResMgr *mgr); virtual void Write(hsStream* s, hsResMgr *mgr); protected: - hsScalar fCount; + float fCount; hsPoint3 *fPosition; hsVector3 *fDirection; - hsScalar fXSize, fYSize, fScaleMin, fScaleMax; - hsScalar fPartRadsPerSecRange; // Zero means no rot, otherwise uniform random between [-range..range] + float fXSize, fYSize, fScaleMin, fScaleMax; + float fPartRadsPerSecRange; // Zero means no rot, otherwise uniform random between [-range..range] }; #endif diff --git a/Sources/Plasma/PubUtilLib/plParticleSystem/plParticleSDLMod.cpp b/Sources/Plasma/PubUtilLib/plParticleSystem/plParticleSDLMod.cpp index d6f12460..7955961e 100644 --- a/Sources/Plasma/PubUtilLib/plParticleSystem/plParticleSDLMod.cpp +++ b/Sources/Plasma/PubUtilLib/plParticleSystem/plParticleSDLMod.cpp @@ -55,7 +55,7 @@ void plParticleSDLMod::IPutCurrentStateIn(plStateDataRecord* dstState) if (!sobj) return; - UInt32 flags = sobj->GetKey()->GetUoid().GetLocation().GetFlags(); + uint32_t flags = sobj->GetKey()->GetUoid().GetLocation().GetFlags(); const plParticleSystem *sys = plParticleSystem::ConvertNoRef(sobj->GetModifierByType(plParticleSystem::Index())); if (!sys) @@ -84,7 +84,7 @@ void plParticleSDLMod::ISetCurrentStateFrom(const plStateDataRecord* srcState) sys->GenerateParticles(num); } -UInt32 plParticleSDLMod::IApplyModFlags(UInt32 sendFlags) +uint32_t plParticleSDLMod::IApplyModFlags(uint32_t sendFlags) { if (fAttachedToAvatar) return (sendFlags | plSynchedObject::kDontPersistOnServer | plSynchedObject::kIsAvatarState); diff --git a/Sources/Plasma/PubUtilLib/plParticleSystem/plParticleSDLMod.h b/Sources/Plasma/PubUtilLib/plParticleSystem/plParticleSDLMod.h index 98e627f5..972896b9 100644 --- a/Sources/Plasma/PubUtilLib/plParticleSystem/plParticleSDLMod.h +++ b/Sources/Plasma/PubUtilLib/plParticleSystem/plParticleSDLMod.h @@ -57,7 +57,7 @@ private: protected: void IPutCurrentStateIn(plStateDataRecord* dstState); void ISetCurrentStateFrom(const plStateDataRecord* srcState); - UInt32 IApplyModFlags(UInt32 sendFlags); + uint32_t IApplyModFlags(uint32_t sendFlags); public: // var labels static char kStrNumParticles[]; diff --git a/Sources/Plasma/PubUtilLib/plParticleSystem/plParticleSystem.cpp b/Sources/Plasma/PubUtilLib/plParticleSystem/plParticleSystem.cpp index 96c88d73..c1c7c677 100644 --- a/Sources/Plasma/PubUtilLib/plParticleSystem/plParticleSystem.cpp +++ b/Sources/Plasma/PubUtilLib/plParticleSystem/plParticleSystem.cpp @@ -39,7 +39,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com Mead, WA 99021 *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "plParticleSystem.h" #include "plParticleEmitter.h" #include "plParticleGenerator.h" @@ -67,7 +67,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com plProfile_CreateCounter("Num Particles", "Particles", NumParticles); -const hsScalar plParticleSystem::GRAVITY_ACCEL_FEET_PER_SEC2 = 32.0f; +const float plParticleSystem::GRAVITY_ACCEL_FEET_PER_SEC2 = 32.0f; plParticleSystem::plParticleSystem() : fParticleSDLMod(nil), fAttachedToAvatar(false) { @@ -89,7 +89,7 @@ plParticleSystem::~plParticleSystem() delete fHeightCtl; } -void plParticleSystem::Init(UInt32 xTiles, UInt32 yTiles, UInt32 maxTotalParticles, UInt32 maxEmitters, +void plParticleSystem::Init(uint32_t xTiles, uint32_t yTiles, uint32_t maxTotalParticles, uint32_t maxEmitters, plController *ambientCtl, plController *diffuseCtl, plController *opacityCtl, plController *widthCtl, plController *heightCtl) { @@ -113,7 +113,7 @@ void plParticleSystem::Init(UInt32 xTiles, UInt32 yTiles, UInt32 maxTotalParticl fMaxTotalParticles = fMaxTotalParticlesLeft = maxTotalParticles; fMaxEmitters = maxEmitters; - fEmitters = TRACKED_NEW plParticleEmitter *[fMaxEmitters]; + fEmitters = new plParticleEmitter *[fMaxEmitters]; int i; for (i = 0; i < maxEmitters; i++) fEmitters[i] = nil; @@ -125,7 +125,7 @@ void plParticleSystem::Init(UInt32 xTiles, UInt32 yTiles, UInt32 maxTotalParticl fHeightCtl = heightCtl; } -void plParticleSystem::IAddEffect(plParticleEffect *effect, UInt32 type) +void plParticleSystem::IAddEffect(plParticleEffect *effect, uint32_t type) { switch(type) { @@ -147,7 +147,7 @@ plParticleEmitter* plParticleSystem::GetAvailEmitter() if( !fNumValidEmitters ) // got to start with at least one. return nil; - hsScalar minTTL = 1.e33; + float minTTL = 1.e33; int iMinTTL = -1; int i; for( i = 0; i < fNumValidEmitters; i++ ) @@ -164,7 +164,7 @@ plParticleEmitter* plParticleSystem::GetAvailEmitter() { minTTL = 0; iMinTTL = fNumValidEmitters++; - fEmitters[iMinTTL] = TRACKED_NEW plParticleEmitter(); + fEmitters[iMinTTL] = new plParticleEmitter(); fEmitters[iMinTTL]->Clone(fEmitters[0], iMinTTL); fMaxTotalParticlesLeft -= fEmitters[iMinTTL]->fMaxParticles; @@ -177,11 +177,11 @@ plParticleEmitter* plParticleSystem::GetAvailEmitter() return fEmitters[iMinTTL]; } -UInt32 plParticleSystem::AddEmitter(UInt32 maxParticles, plParticleGenerator *gen, UInt32 emitterFlags) +uint32_t plParticleSystem::AddEmitter(uint32_t maxParticles, plParticleGenerator *gen, uint32_t emitterFlags) { if (fMaxEmitters == 0) // silly rabbit, Trix are for kids! return 0; - UInt32 currEmitter; + uint32_t currEmitter; if (fNumValidEmitters == fMaxEmitters) // No more free spots, snag the next in line. { int i; @@ -207,7 +207,7 @@ UInt32 plParticleSystem::AddEmitter(UInt32 maxParticles, plParticleGenerator *ge if (maxParticles < 0) maxParticles = 0; - fEmitters[currEmitter] = TRACKED_NEW plParticleEmitter(); + fEmitters[currEmitter] = new plParticleEmitter(); fEmitters[currEmitter]->Init(this, maxParticles, fNextEmitterToGo, emitterFlags, gen); fMaxTotalParticlesLeft -= fEmitters[currEmitter]->fMaxParticles; @@ -216,9 +216,9 @@ UInt32 plParticleSystem::AddEmitter(UInt32 maxParticles, plParticleGenerator *ge return maxParticles; } -void plParticleSystem::AddParticle(hsPoint3 &pos, hsVector3 &velocity, UInt32 tileIndex, - hsScalar hSize, hsScalar vSize, hsScalar scale, hsScalar invMass, hsScalar life, - hsPoint3 &orientation, UInt32 miscFlags, hsScalar radsPerSec) +void plParticleSystem::AddParticle(hsPoint3 &pos, hsVector3 &velocity, uint32_t tileIndex, + float hSize, float vSize, float scale, float invMass, float life, + hsPoint3 &orientation, uint32_t miscFlags, float radsPerSec) { hsAssert(fNumValidEmitters > 0, "Trying to explicitly add particles to a system with no valid emitters."); if (fNumValidEmitters == 0) @@ -227,7 +227,7 @@ void plParticleSystem::AddParticle(hsPoint3 &pos, hsVector3 &velocity, UInt32 ti fEmitters[0]->AddParticle(pos, velocity, tileIndex, hSize, vSize, scale, invMass, life, orientation, miscFlags, radsPerSec); } -void plParticleSystem::GenerateParticles(UInt32 num, hsScalar dt /* = 0.f */) +void plParticleSystem::GenerateParticles(uint32_t num, float dt /* = 0.f */) { if (num <= 0) return; @@ -245,7 +245,7 @@ void plParticleSystem::WipeExistingParticles() fEmitters[i]->WipeExistingParticles(); } -void plParticleSystem::KillParticles(hsScalar num, hsScalar timeToDie, UInt8 flags) +void plParticleSystem::KillParticles(float num, float timeToDie, uint8_t flags) { if (fEmitters[0]) fEmitters[0]->KillParticles(num, timeToDie, flags); @@ -267,14 +267,14 @@ void plParticleSystem::DisableGenerators() fEmitters[i]->UpdateGenerator(plParticleUpdateMsg::kParamEnabled, 0.f); } -UInt16 plParticleSystem::StealParticlesFrom(plParticleSystem *victim, UInt16 num) +uint16_t plParticleSystem::StealParticlesFrom(plParticleSystem *victim, uint16_t num) { if (fNumValidEmitters <= 0) return 0; // you just lose if (victim) { - UInt16 numStolen = fEmitters[0]->StealParticlesFrom(victim->fNumValidEmitters > 0 ? victim->fEmitters[0] : nil, num); + uint16_t numStolen = fEmitters[0]->StealParticlesFrom(victim->fNumValidEmitters > 0 ? victim->fEmitters[0] : nil, num); GetTarget(0)->DirtySynchState(kSDLParticleSystem, 0); victim->GetTarget(0)->DirtySynchState(kSDLParticleSystem, 0); return numStolen; @@ -288,7 +288,7 @@ plParticleGenerator *plParticleSystem::GetExportedGenerator() const return (fNumValidEmitters > 0 ? fEmitters[0]->fGenerator : nil); } -plParticleEffect *plParticleSystem::GetEffect(UInt16 type) const +plParticleEffect *plParticleSystem::GetEffect(uint16_t type) const { int i; for (i = 0; i < fForces.GetCount(); i++) @@ -306,9 +306,9 @@ plParticleEffect *plParticleSystem::GetEffect(UInt16 type) const return nil; } -UInt32 plParticleSystem::GetNumValidParticles(hsBool immortalOnly /* = false */) const +uint32_t plParticleSystem::GetNumValidParticles(hsBool immortalOnly /* = false */) const { - UInt32 count = 0; + uint32_t count = 0; int i, j; for (i = 0; i < fNumValidEmitters; i++) { @@ -332,7 +332,7 @@ const hsMatrix44 &plParticleSystem::GetLocalToWorld() const return fTarget->GetCoordinateInterface()->GetLocalToWorld(); } -hsBool plParticleSystem::IEval(double secs, hsScalar del, UInt32 dirty) +hsBool plParticleSystem::IEval(double secs, float del, uint32_t dirty) { return false; } @@ -367,7 +367,7 @@ hsBool plParticleSystem::IShouldUpdate(plPipeline* pipe) const // Now, are we visible? hsBool isVisible = pipe->TestVisibleWorld(wBnd); - hsScalar delta = fLastTime > 0 ? hsScalar(fCurrTime - fLastTime) : hsTimer::GetDelSysSeconds(); + float delta = fLastTime > 0 ? float(fCurrTime - fLastTime) : hsTimer::GetDelSysSeconds(); if( isVisible ) { // If we know how fast the fastest particle is moving, then we can @@ -382,13 +382,13 @@ hsBool plParticleSystem::IShouldUpdate(plPipeline* pipe) const // We're in view, but how close are we to the camera? Look at closest point. hsPoint2 depth; wBnd.TestPlane(pipe->GetViewDirWorld(), depth); - hsScalar eyeDist = pipe->GetViewDirWorld().InnerProduct(pipe->GetViewPositionWorld()); - hsScalar dist = depth.fX - eyeDist; + float eyeDist = pipe->GetViewDirWorld().InnerProduct(pipe->GetViewPositionWorld()); + float dist = depth.fX - eyeDist; - static hsScalar kUpdateCutoffDist = 100.f; + static float kUpdateCutoffDist = 100.f; if( dist > kUpdateCutoffDist ) { - static hsScalar kDistantUpdateSecs = 0.1f; + static float kDistantUpdateSecs = 0.1f; return delta >= kDistantUpdateSecs; } #endif // ALWAYS_IF_VISIBLE @@ -397,7 +397,7 @@ hsBool plParticleSystem::IShouldUpdate(plPipeline* pipe) const } - static hsScalar kOffscreenUpdateSecs = 1.f; + static float kOffscreenUpdateSecs = 1.f; return delta >= kOffscreenUpdateSecs; } @@ -407,10 +407,10 @@ plDrawInterface* plParticleSystem::ICheckDrawInterface() if( !di ) return nil; - if( di->GetDrawableMeshIndex(0) == UInt32(-1) ) + if( di->GetDrawableMeshIndex(0) == uint32_t(-1) ) { di->SetUpForParticleSystem( fMaxEmitters + 1, fMaxTotalParticles, fTexture, fPermaLights ); - hsAssert(di->GetDrawableMeshIndex( 0 ) != (UInt32)-1, "SetUpForParticleSystem should never fail"); // still invalid, didn't fix it. + hsAssert(di->GetDrawableMeshIndex( 0 ) != (uint32_t)-1, "SetUpForParticleSystem should never fail"); // still invalid, didn't fix it. } return di; @@ -419,10 +419,10 @@ plDrawInterface* plParticleSystem::ICheckDrawInterface() void plParticleSystem::IHandleRenderMsg(plPipeline* pipe) { fCurrTime = hsTimer::GetSysSeconds(); - hsScalar delta = hsScalar(fCurrTime - fLastTime); + float delta = float(fCurrTime - fLastTime); if (delta == 0) return; - plConst(hsScalar) kMaxDelta(0.3f); + plConst(float) kMaxDelta(0.3f); if( delta > kMaxDelta ) delta = kMaxDelta; @@ -536,7 +536,7 @@ hsBool plParticleSystem::MsgReceive(plMessage* msg) return plModifier::MsgReceive(msg); } -void plParticleSystem::UpdateGenerator(UInt32 paramID, hsScalar value) +void plParticleSystem::UpdateGenerator(uint32_t paramID, float value) { int i; for (i = 0; i < fNumValidEmitters; i++) @@ -554,7 +554,7 @@ void plParticleSystem::AddTarget(plSceneObject *so) plgDispatch::Dispatch()->RegisterForExactType(plAgeLoadedMsg::Index(), GetKey()); delete fParticleSDLMod; - fParticleSDLMod = TRACKED_NEW plParticleSDLMod; + fParticleSDLMod = new plParticleSDLMod; fParticleSDLMod->SetAttachedToAvatar(fAttachedToAvatar); so->AddModifier(fParticleSDLMod); } @@ -585,7 +585,7 @@ void plParticleSystem::IPreSim() double secs = fPreSim; while (secs > 0) { - fEmitters[i]->IUpdateParticles((hsScalar)PRESIM_UPDATE_TICK); + fEmitters[i]->IUpdateParticles((float)PRESIM_UPDATE_TICK); secs -= PRESIM_UPDATE_TICK; } } @@ -593,15 +593,15 @@ void plParticleSystem::IPreSim() fPreSim = 0; } -void plParticleSystem::IReadEffectsArray(hsTArray &effects, UInt32 type, hsStream *s, hsResMgr *mgr) +void plParticleSystem::IReadEffectsArray(hsTArray &effects, uint32_t type, hsStream *s, hsResMgr *mgr) { plGenRefMsg *msg; effects.Reset(); - UInt32 count = s->ReadLE32(); + uint32_t count = s->ReadLE32(); int i; for (i = 0; i < count; i++) { - msg = TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnCreate, 0, (Int8)type); + msg = new plGenRefMsg(GetKey(), plRefMsg::kOnCreate, 0, (int8_t)type); mgr->ReadKeyNotifyMe(s, msg, plRefFlags::kActiveRef); } } @@ -611,7 +611,7 @@ void plParticleSystem::Read(hsStream *s, hsResMgr *mgr) plModifier::Read(s, mgr); plGenRefMsg* msg; - msg = TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnCreate, 0, 0); // Material + msg = new plGenRefMsg(GetKey(), plRefMsg::kOnCreate, 0, 0); // Material mgr->ReadKeyNotifyMe(s, msg, plRefFlags::kActiveRef); fAmbientCtl = plController::ConvertNoRef(mgr->ReadCreatable(s)); @@ -620,10 +620,10 @@ void plParticleSystem::Read(hsStream *s, hsResMgr *mgr) fWidthCtl = plController::ConvertNoRef(mgr->ReadCreatable(s)); fHeightCtl = plController::ConvertNoRef(mgr->ReadCreatable(s)); - UInt32 xTiles = s->ReadLE32(); - UInt32 yTiles = s->ReadLE32(); - UInt32 maxTotal = s->ReadLE32(); - UInt32 maxEmitters = s->ReadLE32(); + uint32_t xTiles = s->ReadLE32(); + uint32_t yTiles = s->ReadLE32(); + uint32_t maxTotal = s->ReadLE32(); + uint32_t maxEmitters = s->ReadLE32(); Init(xTiles, yTiles, maxTotal, maxEmitters, fAmbientCtl, fDiffuseCtl, fOpacityCtl, fWidthCtl, fHeightCtl); fPreSim = s->ReadLEScalar(); diff --git a/Sources/Plasma/PubUtilLib/plParticleSystem/plParticleSystem.h b/Sources/Plasma/PubUtilLib/plParticleSystem/plParticleSystem.h index 192225fd..1f8df20a 100644 --- a/Sources/Plasma/PubUtilLib/plParticleSystem/plParticleSystem.h +++ b/Sources/Plasma/PubUtilLib/plParticleSystem/plParticleSystem.h @@ -72,25 +72,25 @@ class plParticleSystem : public plModifier friend class plSimpleParticleGenerator; protected: - static const hsScalar GRAVITY_ACCEL_FEET_PER_SEC2; + static const float GRAVITY_ACCEL_FEET_PER_SEC2; plSceneObject *fTarget; hsGMaterial *fTexture; // One texture per system (Tiling is your friend!) - UInt32 fXTiles, fYTiles; // Width/height of the texture (in tiles) for determining a particle's UVs + uint32_t fXTiles, fYTiles; // Width/height of the texture (in tiles) for determining a particle's UVs double fCurrTime; double fLastTime; hsVector3 fAccel; - hsScalar fPreSim; - hsScalar fDrag; - hsScalar fWindMult; + float fPreSim; + float fDrag; + float fWindMult; bool fAttachedToAvatar; - UInt32 fMaxTotalParticles; - UInt32 fMaxTotalParticlesLeft; - UInt32 fNumValidEmitters; - UInt32 fMaxEmitters; - UInt32 fNextEmitterToGo; + uint32_t fMaxTotalParticles; + uint32_t fMaxTotalParticlesLeft; + uint32_t fNumValidEmitters; + uint32_t fMaxEmitters; + uint32_t fNextEmitterToGo; plParticleEmitter **fEmitters; // Various locations we're emitting particles from (the first one is // reserved for particles added explicitly (to keep all the bookkeeping @@ -113,17 +113,17 @@ protected: plParticleSDLMod *fParticleSDLMod; hsBool IShouldUpdate(plPipeline* pipe) const; - virtual hsBool IEval(double secs, hsScalar del, UInt32 dirty); // required by plModifier + virtual hsBool IEval(double secs, float del, uint32_t dirty); // required by plModifier void IHandleRenderMsg(plPipeline* pipe); plDrawInterface* ICheckDrawInterface(); - void IAddEffect(plParticleEffect *effect, UInt32 type); - void IReadEffectsArray(hsTArray &effects, UInt32 type, hsStream *s, hsResMgr *mgr); + void IAddEffect(plParticleEffect *effect, uint32_t type); + void IReadEffectsArray(hsTArray &effects, uint32_t type, hsStream *s, hsResMgr *mgr); void IPreSim(); public: plParticleSystem(); virtual ~plParticleSystem(); - void Init(UInt32 xTiles, UInt32 yTiles, UInt32 maxTotalParticles, UInt32 numEmitters, + void Init(uint32_t xTiles, uint32_t yTiles, uint32_t maxTotalParticles, uint32_t numEmitters, plController *ambientCtl, plController *diffuseCtl, plController *opacityCtl, plController *widthCtl, plController *heightCtl); @@ -138,11 +138,11 @@ public: { kParticleSystemAlwaysUpdate = 0x1 }; - UInt8 fMiscFlags; // Not read/written (could be, but it's not needed yet.) + uint8_t fMiscFlags; // Not read/written (could be, but it's not needed yet.) // There might not be enough particles available. this function returns the number of maxParticles that // the emitter actually received. - UInt32 AddEmitter(UInt32 maxParticles, plParticleGenerator *gen, UInt32 emitterFlags); + uint32_t AddEmitter(uint32_t maxParticles, plParticleGenerator *gen, uint32_t emitterFlags); plParticleEmitter* GetAvailEmitter(); @@ -151,34 +151,34 @@ public: // These are just public wrappers to the equivalent plParticleEmitter functions, provided for the purpose // of adding particles to a system explicitly. - void AddParticle(hsPoint3 &pos, hsVector3 &velocity, UInt32 tileIndex, - hsScalar hSize, hsScalar vSize, hsScalar scale, hsScalar invMass, hsScalar life, - hsPoint3 &orientation, UInt32 miscFlags, hsScalar radsPerSec=0.f); - void GenerateParticles(UInt32 num, hsScalar dt = 0.f); + void AddParticle(hsPoint3 &pos, hsVector3 &velocity, uint32_t tileIndex, + float hSize, float vSize, float scale, float invMass, float life, + hsPoint3 &orientation, uint32_t miscFlags, float radsPerSec=0.f); + void GenerateParticles(uint32_t num, float dt = 0.f); void WipeExistingParticles(); // Instant nuke - void KillParticles(hsScalar num, hsScalar timeToDie, UInt8 flags); // Sets a death timer. They'll get removed on the next update (if time has run out) - UInt16 StealParticlesFrom(plParticleSystem *victim, UInt16 num); // Returns the number of particles actually stolen + void KillParticles(float num, float timeToDie, uint8_t flags); // Sets a death timer. They'll get removed on the next update (if time has run out) + uint16_t StealParticlesFrom(plParticleSystem *victim, uint16_t num); // Returns the number of particles actually stolen void TranslateAllParticles(hsPoint3 &amount); // Used to recenter the system when linking between ages. void DisableGenerators(); - UInt32 GetNumTiles() const { return fXTiles * fYTiles; } - void SetTileIndex(plParticle &particle, UInt32 index); // Sets the UV coordinates appropriate for the current texture - UInt32 GetNumValidParticles(hsBool immortalOnly = false) const; // Takes a bit longer if we want a count of immortal particles... - UInt32 GetMaxTotalParticles() const { return fMaxTotalParticles; } + uint32_t GetNumTiles() const { return fXTiles * fYTiles; } + void SetTileIndex(plParticle &particle, uint32_t index); // Sets the UV coordinates appropriate for the current texture + uint32_t GetNumValidParticles(hsBool immortalOnly = false) const; // Takes a bit longer if we want a count of immortal particles... + uint32_t GetMaxTotalParticles() const { return fMaxTotalParticles; } const hsMatrix44 &GetLocalToWorld() const; void SetAccel(const hsVector3& a) { fAccel = GRAVITY_ACCEL_FEET_PER_SEC2 * a; } - void SetGravity(hsScalar pct) { fAccel.Set(0, 0, -GRAVITY_ACCEL_FEET_PER_SEC2 * pct); } - void SetDrag(hsScalar d) { fDrag = -d; } - void SetWindMult(hsScalar m) { fWindMult = m; } - void SetPreSim(hsScalar time) { fPreSim = time; } - void UpdateGenerator(UInt32 paramID, hsScalar value); + void SetGravity(float pct) { fAccel.Set(0, 0, -GRAVITY_ACCEL_FEET_PER_SEC2 * pct); } + void SetDrag(float d) { fDrag = -d; } + void SetWindMult(float m) { fWindMult = m; } + void SetPreSim(float time) { fPreSim = time; } + void UpdateGenerator(uint32_t paramID, float value); plParticleGenerator *GetExportedGenerator() const; const hsVector3& GetAccel() const { return fAccel; } - hsScalar GetDrag() const { return fDrag; } - hsScalar GetWindMult() const { return fWindMult; } - plParticleEffect *GetEffect(UInt16 type) const; + float GetDrag() const { return fDrag; } + float GetWindMult() const { return fWindMult; } + plParticleEffect *GetEffect(uint16_t type) const; plParticleSDLMod* GetSDLMod() {return fParticleSDLMod;} // Functions related to/required by plModifier diff --git a/Sources/Plasma/PubUtilLib/plPhysX/plLOSDispatch.cpp b/Sources/Plasma/PubUtilLib/plPhysX/plLOSDispatch.cpp index 18c922a4..44de0732 100644 --- a/Sources/Plasma/PubUtilLib/plPhysX/plLOSDispatch.cpp +++ b/Sources/Plasma/PubUtilLib/plPhysX/plLOSDispatch.cpp @@ -74,7 +74,7 @@ public: bool GotHit() { return fDist != FLT_MAX; } plKey GetObj() { return fHitObj; } - hsScalar GetDistance() { return fDist; } + float GetDistance() { return fDist; } const hsVector3& GetNormal() { return fNormal; } const hsPoint3& GetPoint() { return fPoint; } void ResetHitObj(){fHitObj=nil;} @@ -85,7 +85,7 @@ private: plPXPhysical* phys = (plPXPhysical*)hitActor.userData; plKey objKey = nil; - UInt16 objDB = plSimDefs::kLOSDBNone; + uint16_t objDB = plSimDefs::kLOSDBNone; if (phys) { @@ -153,7 +153,7 @@ private: plKey fHitObj; hsVector3 fNormal; hsPoint3 fPoint; - hsScalar fDist; + float fDist; } gMyReport; plLOSDispatch::plLOSDispatch() @@ -213,7 +213,7 @@ hsBool plLOSDispatch::MsgReceive(plMessage* msg) gMyReport.InitCast(requestMsg->GetRequestType(), requestMsg->GetTestType()); hsVector3 norm = hsVector3(at - from); - hsScalar dist = norm.Magnitude(); + float dist = norm.Magnitude(); norm.Normalize(); NxRay worldRay; @@ -238,7 +238,7 @@ hsBool plLOSDispatch::MsgReceive(plMessage* msg) // If we have a cull db, adjust the length of the raycast to be from the // original point to the object we hit. If we find anything from the cull // db in there, the cast fails. - hsScalar dist = gMyReport.GetDistance(); + float dist = gMyReport.GetDistance(); if(dist!=0.0) { gMyReport.InitCast(requestMsg->GetCullDB(), plLOSRequestMsg::kTestAny); @@ -290,7 +290,7 @@ plMessage* plLOSDispatch::ICreateHitMsg(plLOSRequestMsg* requestMsg, hsMatrix44& { plKey ourKey = GetKey(); plKey rcvKey = requestMsg->GetSender(); - plLOSHitMsg* hitMsg = TRACKED_NEW plLOSHitMsg(ourKey, rcvKey, nil); + plLOSHitMsg* hitMsg = new plLOSHitMsg(ourKey, rcvKey, nil); hitMsg->fNoHit = false; hitMsg->fObj = gMyReport.GetObj(); hitMsg->fDistance = gMyReport.GetDistance(); @@ -304,7 +304,7 @@ plMessage* plLOSDispatch::ICreateMissMsg(plLOSRequestMsg* requestMsg) { plKey ourKey = GetKey(); plKey rcvKey = requestMsg->GetSender(); - plLOSHitMsg* missMsg = TRACKED_NEW plLOSHitMsg(ourKey, rcvKey, nil); + plLOSHitMsg* missMsg = new plLOSHitMsg(ourKey, rcvKey, nil); missMsg->fNoHit = true; missMsg->fObj = nil; missMsg->fRequestID = requestMsg->GetRequestID(); diff --git a/Sources/Plasma/PubUtilLib/plPhysX/plPXPhysical.cpp b/Sources/Plasma/PubUtilLib/plPhysX/plPXPhysical.cpp index c46a8b05..2ca77b15 100644 --- a/Sources/Plasma/PubUtilLib/plPhysX/plPXPhysical.cpp +++ b/Sources/Plasma/PubUtilLib/plPhysX/plPXPhysical.cpp @@ -212,7 +212,7 @@ static void MakeBoxFromHull(NxConvexMesh* convexMesh, NxBoxShapeDesc& box) NxConvexMeshDesc desc; convexMesh->saveToDesc(desc); - hsScalar minX, minY, minZ, maxX, maxY, maxZ; + float minX, minY, minZ, maxX, maxY, maxZ; minX = minY = minZ = FLT_MAX; maxX = maxY = maxZ = -FLT_MAX; @@ -265,11 +265,11 @@ void plPXPhysical::IMakeHull(NxConvexMesh* convexMesh, hsMatrix44 l2w) delete [] fSaveTriangles; fHullNumberPlanes = desc.numTriangles; - fSaveTriangles = TRACKED_NEW hsPoint3[fHullNumberPlanes*3]; + fSaveTriangles = new hsPoint3[fHullNumberPlanes*3]; for (int i = 0; i < desc.numTriangles; i++) { - UInt32* triangle = (UInt32*)(((char*)desc.triangles) + desc.triangleStrideBytes*i); + uint32_t* triangle = (uint32_t*)(((char*)desc.triangles) + desc.triangleStrideBytes*i); float* vertex1 = (float*)(((char*)desc.points) + desc.pointStrideBytes*triangle[0]); float* vertex2 = (float*)(((char*)desc.points) + desc.pointStrideBytes*triangle[1]); float* vertex3 = (float*)(((char*)desc.points) + desc.pointStrideBytes*triangle[2]); @@ -288,7 +288,7 @@ void plPXPhysical::ISetHullToWorldWTriangles() // if we have a detector hull and the world hasn't been updated if (fWorldHull == nil) { - fWorldHull = TRACKED_NEW hsPlane3[fHullNumberPlanes]; + fWorldHull = new hsPlane3[fHullNumberPlanes]; // use the local2world from the physics engine so that it matches the transform of the positions from the triggerees hsMatrix44 l2w; plPXConvert::Matrix(fActor->getGlobalPose(), l2w); @@ -546,12 +546,12 @@ hsBool plPXPhysical::Init(PhysRecipe& recipe) if (GetProperty(plSimulationInterface::kSuppressed_DEAD)) IEnable(false); - plNodeRefMsg* refMsg = TRACKED_NEW plNodeRefMsg(fSceneNode, plRefMsg::kOnCreate, -1, plNodeRefMsg::kPhysical); + plNodeRefMsg* refMsg = new plNodeRefMsg(fSceneNode, plRefMsg::kOnCreate, -1, plNodeRefMsg::kPhysical); hsgResMgr::ResMgr()->AddViaNotify(GetKey(), refMsg, plRefFlags::kActiveRef); if (fWorldKey) { - plGenRefMsg* ref = TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnCreate, 0, kPhysRefWorld); + plGenRefMsg* ref = new plGenRefMsg(GetKey(), plRefMsg::kOnCreate, 0, kPhysRefWorld); hsgResMgr::ResMgr()->AddViaNotify(fWorldKey, ref, plRefFlags::kActiveRef); } @@ -563,7 +563,7 @@ hsBool plPXPhysical::Init(PhysRecipe& recipe) hsAssert(sceneObj, "nil sceneObject, failed to create and attach SDL modifier"); delete fSDLMod; - fSDLMod = TRACKED_NEW plPhysicalSDLModifier; + fSDLMod = new plPhysicalSDLModifier; sceneObj->AddModifier(fSDLMod); } @@ -612,7 +612,7 @@ hsBool plPXPhysical::MsgReceive( plMessage* msg ) // right now, we're only worrying about the subworlds hsBool plPXPhysical::HandleRefMsg(plGenRefMsg* refMsg) { - UInt8 refCtxt = refMsg->GetContext(); + uint8_t refCtxt = refMsg->GetContext(); plKey refKey = refMsg->GetRef()->GetKey(); plKey ourKey = GetKey(); PhysRefType refType = PhysRefType(refMsg->fType); @@ -804,7 +804,7 @@ void plPXPhysical::SendNewLocation(hsBool synchTransform, hsBool isSynchUpdate) hsMatrix44 w2l; fCachedLocal2World.GetInverse(&w2l); - plCorrectionMsg *pCorrMsg = TRACKED_NEW plCorrectionMsg(GetObjectKey(), fCachedLocal2World, w2l, synchTransform); + plCorrectionMsg *pCorrMsg = new plCorrectionMsg(GetObjectKey(), fCachedLocal2World, w2l, synchTransform); pCorrMsg->Send(); if (fProxyGen) fProxyGen->SetTransform(fCachedLocal2World, w2l); @@ -1035,7 +1035,7 @@ void plPXPhysical::Read(hsStream* stream, hsResMgr* mgr) recipe.sceneNode = mgr->ReadKey(stream); recipe.worldKey = mgr->ReadKey(stream); - mgr->ReadKeyNotifyMe(stream, TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnCreate, 0, kPhysRefSndGroup), plRefFlags::kActiveRef); + mgr->ReadKeyNotifyMe(stream, new plGenRefMsg(GetKey(), plRefMsg::kOnCreate, 0, kPhysRefSndGroup), plRefFlags::kActiveRef); hsPoint3 pos; hsQuat rot; @@ -1071,7 +1071,7 @@ void plPXPhysical::Read(hsStream* stream, hsResMgr* mgr) hsAssert(!fProxyGen, "Already have proxy gen, double read?"); hsColorRGBA physColor; - hsScalar opac = 1.0f; + float opac = 1.0f; if (fGroup == plSimDefs::kGroupAvatar) { @@ -1117,7 +1117,7 @@ void plPXPhysical::Read(hsStream* stream, hsResMgr* mgr) physColor.Set(0.6f,0.6f,0.6f,1.f); } - fProxyGen = TRACKED_NEW plPhysicalProxy(hsColorRGBA().Set(0,0,0,1.f), physColor, opac); + fProxyGen = new plPhysicalProxy(hsColorRGBA().Set(0,0,0,1.f), physColor, opac); fProxyGen->Init(this); } @@ -1190,7 +1190,7 @@ void plPXPhysical::Write(hsStream* stream, hsResMgr* mgr) // TESTING SDL // Send phys sendState msg to object's plPhysicalSDLModifier // -hsBool plPXPhysical::DirtySynchState(const char* SDLStateName, UInt32 synchFlags ) +hsBool plPXPhysical::DirtySynchState(const char* SDLStateName, uint32_t synchFlags ) { if (GetObjectKey()) { @@ -1272,21 +1272,21 @@ inline hsPoint3& GetTrimeshVert(NxTriangleMeshDesc& desc, int idx) return *((hsPoint3*)(((char*)desc.points)+desc.pointStrideBytes*idx)); } -void GetTrimeshTri(NxTriangleMeshDesc& desc, int idx, UInt16* out) +void GetTrimeshTri(NxTriangleMeshDesc& desc, int idx, uint16_t* out) { if (hsCheckBits(desc.flags, NX_MF_16_BIT_INDICES)) { - UInt16* descTris = ((UInt16*)(((char*)desc.triangles)+desc.pointStrideBytes*idx)); + uint16_t* descTris = ((uint16_t*)(((char*)desc.triangles)+desc.pointStrideBytes*idx)); out[0] = descTris[0]; out[1] = descTris[1]; out[2] = descTris[2]; } else { - UInt32* descTris = ((UInt32*)(((char*)desc.triangles)+desc.pointStrideBytes*idx)); - out[0] = (UInt16)descTris[0]; - out[1] = (UInt16)descTris[1]; - out[2] = (UInt16)descTris[2]; + uint32_t* descTris = ((uint32_t*)(((char*)desc.triangles)+desc.pointStrideBytes*idx)); + out[0] = (uint16_t)descTris[0]; + out[1] = (uint16_t)descTris[1]; + out[2] = (uint16_t)descTris[2]; } } @@ -1296,26 +1296,26 @@ inline hsPoint3& GetConvexVert(NxConvexMeshDesc& desc, int idx) return *((hsPoint3*)(((char*)desc.points)+desc.pointStrideBytes*idx)); } -void GetConvexTri(NxConvexMeshDesc& desc, int idx, UInt16* out) +void GetConvexTri(NxConvexMeshDesc& desc, int idx, uint16_t* out) { if (hsCheckBits(desc.flags, NX_MF_16_BIT_INDICES)) { - UInt16* descTris = ((UInt16*)(((char*)desc.triangles)+desc.pointStrideBytes*idx)); + uint16_t* descTris = ((uint16_t*)(((char*)desc.triangles)+desc.pointStrideBytes*idx)); out[0] = descTris[0]; out[1] = descTris[1]; out[2] = descTris[2]; } else { - UInt32* descTris = ((UInt32*)(((char*)desc.triangles)+desc.pointStrideBytes*idx)); - out[0] = (UInt16)descTris[0]; - out[1] = (UInt16)descTris[1]; - out[2] = (UInt16)descTris[2]; + uint32_t* descTris = ((uint32_t*)(((char*)desc.triangles)+desc.pointStrideBytes*idx)); + out[0] = (uint16_t)descTris[0]; + out[1] = (uint16_t)descTris[1]; + out[2] = (uint16_t)descTris[2]; } } // Make a visible object that can be viewed by users for debugging purposes. -plDrawableSpans* plPXPhysical::CreateProxy(hsGMaterial* mat, hsTArray& idx, plDrawableSpans* addTo) +plDrawableSpans* plPXPhysical::CreateProxy(hsGMaterial* mat, hsTArray& idx, plDrawableSpans* addTo) { plDrawableSpans* myDraw = addTo; hsMatrix44 l2w, unused; @@ -1332,7 +1332,7 @@ plDrawableSpans* plPXPhysical::CreateProxy(hsGMaterial* mat, hsTArray& i trimeshShape->getTriangleMesh().saveToDesc(desc); hsTArray pos; - hsTArray tris; + hsTArray tris; const int kMaxTris = 10000; const int kMaxVerts = 32000; @@ -1411,7 +1411,7 @@ plDrawableSpans* plPXPhysical::CreateProxy(hsGMaterial* mat, hsTArray& i convexShape->getConvexMesh().saveToDesc(desc); hsTArray pos; - hsTArray tris; + hsTArray tris; pos.SetCount(desc.numVertices); tris.SetCount(desc.numTriangles * 3); diff --git a/Sources/Plasma/PubUtilLib/plPhysX/plPXPhysical.h b/Sources/Plasma/PubUtilLib/plPhysX/plPXPhysical.h index b8cf424e..fbcd32e8 100644 --- a/Sources/Plasma/PubUtilLib/plPhysX/plPXPhysical.h +++ b/Sources/Plasma/PubUtilLib/plPhysX/plPXPhysical.h @@ -46,7 +46,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "hsMatrix44.h" #include "plPhysical/plSimDefs.h" #include "hsBitVector.h" -#include "hsUtils.h" + class NxActor; class NxConvexMesh; @@ -74,12 +74,12 @@ class PhysRecipe public: PhysRecipe(); - hsScalar mass; - hsScalar friction; - hsScalar restitution; + float mass; + float friction; + float restitution; plSimDefs::Bounds bounds; plSimDefs::Group group; - UInt32 reportsOn; + uint32_t reportsOn; plKey objectKey; plKey sceneNode; plKey worldKey; @@ -91,7 +91,7 @@ public: NxTriangleMesh* triMesh; // For spheres only - hsScalar radius; + float radius; hsPoint3 offset; // For Boxes @@ -151,10 +151,10 @@ public: virtual int GetGroup() const { return fGroup; } - virtual void AddLOSDB(UInt16 flag) { hsSetBits(fLOSDBs, flag); } - virtual void RemoveLOSDB(UInt16 flag) { hsClearBits(fLOSDBs, flag); } - virtual UInt16 GetAllLOSDBs() { return fLOSDBs; } - virtual hsBool IsInLOSDB(UInt16 flag) { return hsCheckBits(fLOSDBs, flag); } + virtual void AddLOSDB(uint16_t flag) { hsSetBits(fLOSDBs, flag); } + virtual void RemoveLOSDB(uint16_t flag) { hsClearBits(fLOSDBs, flag); } + virtual uint16_t GetAllLOSDBs() { return fLOSDBs; } + virtual hsBool IsInLOSDB(uint16_t flag) { return hsCheckBits(fLOSDBs, flag); } virtual hsBool DoDetectorHullWorkaround() { return fSaveTriangles ? true : false; } virtual hsBool Should_I_Trigger(hsBool enter, hsPoint3& pos); @@ -178,7 +178,7 @@ public: virtual void ExcludeRegionHack(hsBool cleared); - virtual plDrawableSpans* CreateProxy(hsGMaterial* mat, hsTArray& idx, plDrawableSpans* addTo); + virtual plDrawableSpans* CreateProxy(hsGMaterial* mat, hsTArray& idx, plDrawableSpans* addTo); hsBool DoReportOn(plSimDefs::Group group) const { return hsCheckBits(fReportsOn, 1<userData; if (physical) { - plCollideMsg* msg = TRACKED_NEW plCollideMsg; + plCollideMsg* msg = new plCollideMsg; msg->fOtherKey = fOwner; msg->fEntering = entering; @@ -321,7 +321,7 @@ public: obj->SetNetGroupConstant(plNetGroup::kNetGroupLocalPhysicals); // Tell all the other clients that we own this physical - plSetNetGroupIDMsg* setNetGroupID = TRACKED_NEW plSetNetGroupIDMsg; + plSetNetGroupIDMsg* setNetGroupID = new plSetNetGroupIDMsg; setNetGroupID->fId = plNetGroup::kNetGroupRemotePhysicals; setNetGroupID->SetBCastFlag(plMessage::kNetPropagate | plMessage::kNetForce); setNetGroupID->SetBCastFlag(plMessage::kLocalPropagate, false); @@ -705,11 +705,11 @@ void plPXPhysicalController::GetKinematicPosition(hsPoint3& pos) void plPXPhysicalController::IApply(hsScalar delSecs) { - /*static const UInt32 collideFlags = + /*static const uint32_t collideFlags = 1<fLocalToWorld = fLastGlobalLoc; corrMsg->fLocalToWorld.GetInverse(&corrMsg->fWorldToLocal); corrMsg->fDirtySynch = true; @@ -1197,7 +1197,7 @@ void plPXPhysicalController::ICreateController() opac = 0.8f; // the avatar proxy doesn't seem to work... not sure why? - fProxyGen = TRACKED_NEW plPhysicalProxy(hsColorRGBA().Set(0,0,0,1.f), physColor, opac); + fProxyGen = new plPhysicalProxy(hsColorRGBA().Set(0,0,0,1.f), physColor, opac); fProxyGen->Init(this); } @@ -1219,7 +1219,7 @@ void plPXPhysicalController::IDeleteController() } // Make a visible object that can be viewed by users for debugging purposes. -plDrawableSpans* plPXPhysicalController::CreateProxy(hsGMaterial* mat, hsTArray& idx, plDrawableSpans* addTo) +plDrawableSpans* plPXPhysicalController::CreateProxy(hsGMaterial* mat, hsTArray& idx, plDrawableSpans* addTo) { plDrawableSpans* myDraw = addTo; @@ -1250,7 +1250,7 @@ void plPXPhysicalController::IDrawDebugDisplay() plDebugText &debugTxt = plDebugText::Instance(); char strBuf[ 2048 ]; int lineHeight = debugTxt.GetFontSize() + 4; - UInt32 scrnWidth, scrnHeight; + uint32_t scrnWidth, scrnHeight; debugTxt.GetScreenSize( &scrnWidth, &scrnHeight ); int y = 10; diff --git a/Sources/Plasma/PubUtilLib/plPhysX/plPXPhysicalController.h b/Sources/Plasma/PubUtilLib/plPhysX/plPXPhysicalController.h index 64ab7ed3..75acced2 100644 --- a/Sources/Plasma/PubUtilLib/plPhysX/plPXPhysicalController.h +++ b/Sources/Plasma/PubUtilLib/plPhysX/plPXPhysicalController.h @@ -127,7 +127,7 @@ public: virtual bool IsKinematic(); virtual void GetKinematicPosition(hsPoint3& pos); - virtual plDrawableSpans* CreateProxy(hsGMaterial* mat, hsTArray& idx, plDrawableSpans* addTo); + virtual plDrawableSpans* CreateProxy(hsGMaterial* mat, hsTArray& idx, plDrawableSpans* addTo); virtual const hsMatrix44& GetPrevSubworldW2L() { return fPrevSubworldW2L; } diff --git a/Sources/Plasma/PubUtilLib/plPhysX/plPXPhysicalControllerCore.cpp b/Sources/Plasma/PubUtilLib/plPhysX/plPXPhysicalControllerCore.cpp index f4a79da7..233040eb 100644 --- a/Sources/Plasma/PubUtilLib/plPhysX/plPXPhysicalControllerCore.cpp +++ b/Sources/Plasma/PubUtilLib/plPhysX/plPXPhysicalControllerCore.cpp @@ -99,7 +99,7 @@ public: plPXPhysicalControllerCore* ac = plPXPhysicalControllerCore::FindController(hit.controller); NxActor& actor = hit.shape->getActor(); plPXPhysical* phys = (plPXPhysical*)actor.userData; - static hsScalar SlopeLimit = kSLOPELIMIT; + static float SlopeLimit = kSLOPELIMIT; hsVector3 normal = plPXConvert::Vector(hit.worldNormal); ac->fMovementInterface->IAddContactNormals(normal); #ifndef PLASMA_EXTERNAL_RELEASE @@ -127,9 +127,9 @@ public: // If the avatar hit a movable physical, apply some force to it. hsVector3 dir = plPXConvert::Vector(hit.dir); float dirdotup=dir.fZ; - hsPoint3 pos((hsScalar)hit.worldPos.x, (hsScalar)hit.worldPos.y, (hsScalar)hit.worldPos.z); + hsPoint3 pos((float)hit.worldPos.x, (float)hit.worldPos.y, (float)hit.worldPos.z); NxExtendedVec3 controllerPos=hit.controller->getPosition(); - hsVector3 bottomOfTheCapsule((hsScalar)controllerPos.x,(hsScalar)controllerPos.y,(hsScalar)controllerPos.z); + hsVector3 bottomOfTheCapsule((float)controllerPos.x,(float)controllerPos.y,(float)controllerPos.z); bottomOfTheCapsule.fZ=bottomOfTheCapsule.fZ-(ac->fHeight/2.0f + ac->fRadius); if (actor.isDynamic() ) { @@ -154,7 +154,7 @@ public: plSynchedObject* obj = plSynchedObject::ConvertNoRef(phys->GetObjectKey()->ObjectIsLoaded()); obj->SetNetGroupConstant(plNetGroup::kNetGroupLocalPhysicals); // Tell all the other clients that we own this physical - plSetNetGroupIDMsg* setNetGroupID = TRACKED_NEW plSetNetGroupIDMsg; + plSetNetGroupIDMsg* setNetGroupID = new plSetNetGroupIDMsg; setNetGroupID->fId = plNetGroup::kNetGroupRemotePhysicals; setNetGroupID->SetBCastFlag(plMessage::kNetPropagate | plMessage::kNetForce); setNetGroupID->SetBCastFlag(plMessage::kLocalPropagate, false); @@ -167,10 +167,10 @@ public: hsVector3 vel=ac->GetLinearVelocity()- plPXConvert::Vector( actor.getLinearVelocity()); if(dirdotup>=0)vel.fZ=0.001f; else vel.fZ=0.0f; - static hsScalar kAvieMass = 140.f/32.f; + static float kAvieMass = 140.f/32.f; if (!vel.IsEmpty()) { - static hsScalar kForceScale = 140.0f; + static float kForceScale = 140.0f; NxF32 coeff; NxExtendedVec3 norm2=hit.controller->getPosition(); norm2.x=hit.worldPos.x-bottomOfTheCapsule.fX; @@ -195,9 +195,9 @@ public: float proj=(float)(norm2.x*dir.fX+dir.fY*norm2.y+dir.fZ*norm2.z); coeff =abs(proj*kForceScale*vel.Magnitude()); - vel.fZ=(hsScalar)norm2.z; - vel.fY=(hsScalar)norm2.y; - vel.fX=(hsScalar)norm2.x; + vel.fZ=(float)norm2.z; + vel.fY=(float)norm2.y; + vel.fX=(float)norm2.x; phys->SetHitForce(vel*coeff, pos); } } @@ -223,14 +223,14 @@ public: } gMyReport; -plPhysicalControllerCore* plPhysicalControllerCore::Create(plKey ownerSO, hsScalar height, hsScalar width) +plPhysicalControllerCore* plPhysicalControllerCore::Create(plKey ownerSO, float height, float width) { // Test to see how many controller there already is if ( !plPXPhysicalControllerCore::fPXControllersMax || plPXPhysicalControllerCore::NumControllers() < plPXPhysicalControllerCore::fPXControllersMax ) { - hsScalar radius = width / 2.f; - hsScalar realHeight = height - width + kPhysicalHeightFudge; - return TRACKED_NEW plPXPhysicalControllerCore(ownerSO, realHeight,radius); + float radius = width / 2.f; + float realHeight = height - width + kPhysicalHeightFudge; + return new plPXPhysicalControllerCore(ownerSO, realHeight,radius); } return nil; } @@ -326,7 +326,7 @@ int plPXPhysicalControllerCore::GetNumberOfControllersInThisSubWorld(plKey world return i; } // -plPXPhysicalControllerCore::plPXPhysicalControllerCore(plKey ownerSO, hsScalar height, hsScalar radius) +plPXPhysicalControllerCore::plPXPhysicalControllerCore(plKey ownerSO, float height, float radius) : plPhysicalControllerCore(ownerSO,height,radius) , fController(nil) , fProxyGen(nil) @@ -499,12 +499,12 @@ void plPXPhysicalControllerCore::IGetPositionSim(hsPoint3& pos) const if(this->fBehavingLikeAnimatedPhys) { const NxExtendedVec3& nxPos = fController->getPosition(); - pos.Set(hsScalar(nxPos.x), hsScalar(nxPos.y), hsScalar(nxPos.z) - kPhysZOffset); + pos.Set(float(nxPos.x), float(nxPos.y), float(nxPos.z) - kPhysZOffset); } else { NxVec3 Pos = fKinematicActor->getGlobalPosition(); - pos.Set(hsScalar(Pos.x), hsScalar(Pos.y), hsScalar(Pos.z) - kPhysZOffset); + pos.Set(float(Pos.x), float(Pos.y), float(Pos.z) - kPhysZOffset); } } void plPXPhysicalControllerCore::ICreateController() @@ -568,7 +568,7 @@ NxScene* scene = plSimulationMgr::GetInstance()->GetScene(fWorldKey); //hsAssert(!fProxyGen, "Already have proxy gen, double read?"); hsColorRGBA physColor; - hsScalar opac = 1.0f; + float opac = 1.0f; // local avatar is light purple and transparent physColor.Set(.2f, .1f, .2f, 1.f); @@ -576,7 +576,7 @@ NxScene* scene = plSimulationMgr::GetInstance()->GetScene(fWorldKey); /* // the avatar proxy doesn't seem to work... not sure why? - fProxyGen = TRACKED_NEW plPhysicalProxy(hsColorRGBA().Set(0,0,0,1.f), physColor, opac); + fProxyGen = new plPhysicalProxy(hsColorRGBA().Set(0,0,0,1.f), physColor, opac); fProxyGen->Init(this); */ } @@ -638,7 +638,7 @@ void plPXPhysicalControllerCore::ICreateController(const hsPoint3& pos) //hsAssert(!fProxyGen, "Already have proxy gen, double read?"); hsColorRGBA physColor; - hsScalar opac = 1.0f; + float opac = 1.0f; // local avatar is light purple and transparent physColor.Set(.2f, .1f, .2f, 1.f); @@ -646,7 +646,7 @@ void plPXPhysicalControllerCore::ICreateController(const hsPoint3& pos) /* // the avatar proxy doesn't seem to work... not sure why? - fProxyGen = TRACKED_NEW plPhysicalProxy(hsColorRGBA().Set(0,0,0,1.f), physColor, opac); + fProxyGen = new plPhysicalProxy(hsColorRGBA().Set(0,0,0,1.f), physColor, opac); fProxyGen->Init(this); */ @@ -694,7 +694,7 @@ void plPXPhysicalControllerCore::IInformDetectors(bool entering,bool deferUntilN bool doReport = physical->DoReportOn(plSimDefs::kGroupAvatar); if(doReport) { - plCollideMsg* msg = TRACKED_NEW plCollideMsg; + plCollideMsg* msg = new plCollideMsg; msg->fOtherKey = fOwner; msg->fEntering = entering; msg->AddReceiver(physical->GetObjectKey()); @@ -809,7 +809,7 @@ void plPXPhysicalControllerCore::GetState(hsPoint3& pos, float& zRot) fLocalRotation.GetAngleAxis(&zRot, (hsVector3*)&pos); if (pos.fZ < 0) - zRot = (2 * hsScalarPI) - zRot; // axis is backwards, so reverse the angle too + zRot = (2 * M_PI) - zRot; // axis is backwards, so reverse the angle too pos = fLocalPosition; @@ -870,13 +870,13 @@ void plPXPhysicalControllerCore::GetKinematicPosition(hsPoint3& pos) if ( fKinematicActor ) { NxVec3 klPos = fKinematicActor->getGlobalPosition(); - pos.Set(hsScalar(klPos.x), hsScalar(klPos.y), hsScalar(klPos.z) - kPhysZOffset); + pos.Set(float(klPos.x), float(klPos.y), float(klPos.z) - kPhysZOffset); } } -void plPXPhysicalControllerCore::UpdatePoststep( hsScalar delSecs) +void plPXPhysicalControllerCore::UpdatePoststep( float delSecs) { // Apparently the user data field of the controllers is broken -// UInt32 count = gControllerMgr.getNbControllers(); +// uint32_t count = gControllerMgr.getNbControllers(); // NxController* controllers = (NxController*)gControllerMgr.getControllers(); // // for (int i = 0; i < count; i++) @@ -901,7 +901,7 @@ void plPXPhysicalControllerCore::UpdatePoststep( hsScalar delSecs) } } } -void plPXPhysicalControllerCore::UpdatePrestep(hsScalar delSecs) +void plPXPhysicalControllerCore::UpdatePrestep(float delSecs) { for (int i = 0; i < gControllers.size(); i++) { @@ -928,7 +928,7 @@ void plPXPhysicalControllerCore::UpdatePrestep(hsScalar delSecs) } gRebuildCache = false; } -void plPXPhysicalControllerCore::UpdatePostSimStep(hsScalar delSecs) +void plPXPhysicalControllerCore::UpdatePostSimStep(float delSecs) { for (int i = 0; i < gControllers.size(); i++) { @@ -981,7 +981,7 @@ void plPXPhysicalControllerCore::HandleKinematicEnableNextUpdate() void plPXPhysicalControllerCore::IHandleResize() { - UInt32 collideFlags = + uint32_t collideFlags = 1<GetScene(this->fWorldKey); -// NxShape** response=TRACKED_NEW NxShape*[2]; +// NxShape** response=new NxShape*[2]; NxVec3 center(fLocalPosition.fX,fLocalPosition.fY,fLocalPosition.fZ+fPreferedRadius); NxSegment Seg(center,center); @@ -1011,7 +1011,7 @@ void plPXPhysicalControllerCore::IHandleResize() // delete[] response; } -void plPXPhysicalControllerCore::SetControllerDimensions(hsScalar radius, hsScalar height) +void plPXPhysicalControllerCore::SetControllerDimensions(float radius, float height) { fNeedsResize=false; if(fRadius!=radius) @@ -1033,7 +1033,7 @@ void plPXPhysicalControllerCore::LeaveAge() this->fMovementInterface->LeaveAge(); } int plPXPhysicalControllerCore::SweepControllerPath(const hsPoint3& startPos, const hsPoint3& endPos, hsBool vsDynamics, hsBool vsStatics, - UInt32& vsSimGroups, std::multiset< plControllerSweepRecord >& WhatWasHitOut) + uint32_t& vsSimGroups, std::multiset< plControllerSweepRecord >& WhatWasHitOut) { NxCapsule tempCap; tempCap.p0 =plPXConvert::Point( startPos); @@ -1129,7 +1129,7 @@ void plPXPhysicalControllerCore::SetLinearVelocity(const hsVector3& linearVel) fKinematicActor->setLinearVelocity(vel); } } -void plPXPhysicalControllerCore::SetAngularVelocity(const hsScalar angvel) +void plPXPhysicalControllerCore::SetAngularVelocity(const float angvel) { plPhysicalControllerCore::SetAngularVelocity(angvel); if(fKinematicActor && !fBehavingLikeAnimatedPhys) @@ -1138,7 +1138,7 @@ void plPXPhysicalControllerCore::SetAngularVelocity(const hsScalar angvel) fKinematicActor->setAngularVelocity(vel); } } -void plPXPhysicalControllerCore::SetVelocities(const hsVector3& linearVel, hsScalar angVel) +void plPXPhysicalControllerCore::SetVelocities(const hsVector3& linearVel, float angVel) { SetLinearVelocity(linearVel); SetAngularVelocity(angVel); @@ -1165,7 +1165,7 @@ const hsVector3& plPXPhysicalControllerCore::GetLinearVelocity() } // Make a visible object that can be viewed by users for debugging purposes. -plDrawableSpans* plPXPhysicalControllerCore::CreateProxy(hsGMaterial* mat, hsTArray& idx, plDrawableSpans* addTo) +plDrawableSpans* plPXPhysicalControllerCore::CreateProxy(hsGMaterial* mat, hsTArray& idx, plDrawableSpans* addTo) { plDrawableSpans* myDraw = addTo; hsBool blended = ((mat->GetLayer(0)->GetBlendFlags() & hsGMatState::kBlendMask)); @@ -1194,7 +1194,7 @@ void plPXPhysicalControllerCore::IDrawDebugDisplay() plDebugText &debugTxt = plDebugText::Instance(); char strBuf[ 2048 ]; int lineHeight = debugTxt.GetFontSize() + 4; - UInt32 scrnWidth, scrnHeight; + uint32_t scrnWidth, scrnHeight; debugTxt.GetScreenSize( &scrnWidth, &scrnHeight ); int y = 10; @@ -1212,7 +1212,7 @@ void plPXPhysicalControllerCore::IDrawDebugDisplay() { hsVector3 normal = fDbgCollisionInfo[i].fNormal; char *overlapStr = fDbgCollisionInfo[i].fOverlap ? "yes" : "no"; - hsScalar angle = hsScalarRadToDeg(hsACosine(normal * hsVector3(0, 0, 1))); + float angle = hsRadiansToDegrees(acos(normal * hsVector3(0, 0, 1))); sprintf(strBuf, " Obj: %s, Normal: (%.2f, %.2f, %.2f), Angle(%.1f), Overlap(%3s)", fDbgCollisionInfo[i].fSO->GetKeyName(), normal.fX, normal.fY, normal.fZ, angle, overlapStr); diff --git a/Sources/Plasma/PubUtilLib/plPhysX/plPXPhysicalControllerCore.h b/Sources/Plasma/PubUtilLib/plPhysX/plPXPhysicalControllerCore.h index 8a99e59c..c4dcb935 100644 --- a/Sources/Plasma/PubUtilLib/plPhysX/plPXPhysicalControllerCore.h +++ b/Sources/Plasma/PubUtilLib/plPhysX/plPXPhysicalControllerCore.h @@ -68,7 +68,7 @@ class plPXPhysicalControllerCore: public plPhysicalControllerCore { friend class PXControllerHitReportWalk; public: - plPXPhysicalControllerCore(plKey ownerSO, hsScalar height, hsScalar radius); + plPXPhysicalControllerCore(plKey ownerSO, float height, float radius); ~plPXPhysicalControllerCore(); //should actually be a 3 vector but everywhere else it is assumed to be just around Z @@ -98,7 +98,7 @@ public: virtual void GetPositionSim(hsPoint3& pos){IGetPositionSim(pos);} virtual void MoveKinematicToController(hsPoint3& pos); virtual const hsPoint3& GetLocalPosition(){return fLocalPosition;} - virtual void SetControllerDimensions(hsScalar radius, hsScalar height); + virtual void SetControllerDimensions(float radius, float height); virtual void LeaveAge(); virtual void UpdateControllerAndPhysicalRep(); @@ -113,24 +113,24 @@ public: static int GetControllersInThisSubWorld(plKey world, int maxToReturn, plPXPhysicalControllerCore** bufferout); static int GetNumberOfControllersInThisSubWorld(plKey world); - static void UpdatePrestep(hsScalar delSecs); - static void UpdatePoststep(hsScalar delSecs); - static void UpdatePostSimStep(hsScalar delSecs); - virtual plDrawableSpans* CreateProxy(hsGMaterial* mat, hsTArray& idx, plDrawableSpans* addTo); + static void UpdatePrestep(float delSecs); + static void UpdatePoststep(float delSecs); + static void UpdatePostSimStep(float delSecs); + virtual plDrawableSpans* CreateProxy(hsGMaterial* mat, hsTArray& idx, plDrawableSpans* addTo); #ifndef PLASMA_EXTERNAL_RELEASE static hsBool fDebugDisplay; #endif // PLASMA_EXTERNAL_RELEASE static void SetMaxNumberOfControllers(int max) { fPXControllersMax = max; } static int fPXControllersMax; - virtual int SweepControllerPath(const hsPoint3& startPos, const hsPoint3& endPos, hsBool vsDynamics, hsBool vsStatics, UInt32& vsSimGroups, std::multiset< plControllerSweepRecord >& WhatWasHitOut); + virtual int SweepControllerPath(const hsPoint3& startPos, const hsPoint3& endPos, hsBool vsDynamics, hsBool vsStatics, uint32_t& vsSimGroups, std::multiset< plControllerSweepRecord >& WhatWasHitOut); virtual void BehaveLikeAnimatedPhysical(hsBool actLikeAnAnimatedPhys); virtual hsBool BehavingLikeAnAnimatedPhysical(); virtual const hsVector3& GetLinearVelocity(); virtual void SetLinearVelocity(const hsVector3& linearVel); //should actually be a 3 vector but everywhere else it is assumed to be just around Z - virtual void SetAngularVelocity(const hsScalar angvel); - virtual void SetVelocities(const hsVector3& linearVel, hsScalar angVel); + virtual void SetAngularVelocity(const float angvel); + virtual void SetVelocities(const hsVector3& linearVel, float angVel); protected: friend class PXControllerHitReport; @@ -151,8 +151,8 @@ protected: void IDrawDebugDisplay(); #endif void IHandleResize(); - hsScalar fPreferedRadius; - hsScalar fPreferedHeight; + float fPreferedRadius; + float fPreferedHeight; // The global position and rotation of the avatar last time we set it (so we // can detect if someone else moves him) plPhysicalProxy* fProxyGen; diff --git a/Sources/Plasma/PubUtilLib/plPhysX/plSimulationMgr.cpp b/Sources/Plasma/PubUtilLib/plPhysX/plSimulationMgr.cpp index df15e972..20f13ab8 100644 --- a/Sources/Plasma/PubUtilLib/plPhysX/plSimulationMgr.cpp +++ b/Sources/Plasma/PubUtilLib/plPhysX/plSimulationMgr.cpp @@ -209,7 +209,7 @@ class SensorReport : public NxUserTriggerReport { DetectorLogYellow("Collision: %s was triggered by %s. Sending an %s msg", receiver->GetName(), hitter ? hitter->GetName().c_str() : "(nil)" , entering ? "'enter'" : "'exit'"); - plCollideMsg* msg = TRACKED_NEW plCollideMsg; + plCollideMsg* msg = new plCollideMsg; msg->fOtherKey = hitter; msg->fEntering = entering; msg->AddReceiver(receiver); @@ -293,23 +293,6 @@ class ErrorStream : public NxUserOutputStream } } gErrorStream; -// This class allows PhysX to use our heap manager -static class HeapAllocator : public NxUserAllocator { -public: - void * malloc (NxU32 size) { - return ALLOC(size); - } - void * mallocDEBUG (NxU32 size, const char * fileName, int line) { - return MemAlloc(size, 0, fileName, line); - } - void * realloc (void * memory, NxU32 size) { - return REALLOC(memory, size); - } - void free (void * memory) { - FREE(memory); - } -} gHeapAllocator; - ///////////////////////////////////////////////////////////////// // @@ -370,7 +353,7 @@ bool plSimulationMgr::fDoClampingOnStep=true; void plSimulationMgr::Init() { hsAssert(!gTheInstance, "Initializing the sim when it's already been done"); - gTheInstance = TRACKED_NEW plSimulationMgr(); + gTheInstance = new plSimulationMgr(); if (gTheInstance->InitSimulation()) { gTheInstance->RegisterAs(kSimulationMgr_KEY); @@ -380,7 +363,7 @@ void plSimulationMgr::Init() { // There was an error when creating the PhysX simulation // ...then get rid of the simulation instance - DEL(gTheInstance); // clean up the memory we allocated + delete gTheInstance; // clean up the memory we allocated gTheInstance = nil; } } @@ -410,7 +393,7 @@ plSimulationMgr::plSimulationMgr() : fSuspended(true) , fMaxDelta(kDefaultMaxDelta) , fStepSize(kDefaultStepSize) - , fLOSDispatch(TRACKED_NEW plLOSDispatch()) + , fLOSDispatch(new plLOSDispatch()) , fSoundMgr(new plPhysicsSoundMgr) , fLog(nil) { @@ -419,7 +402,7 @@ plSimulationMgr::plSimulationMgr() bool plSimulationMgr::InitSimulation() { - fSDK = NxCreatePhysicsSDK(NX_PHYSICS_SDK_VERSION, &gHeapAllocator, &gErrorStream); + fSDK = NxCreatePhysicsSDK(NX_PHYSICS_SDK_VERSION, NULL, &gErrorStream); if (!fSDK) return false; // client will handle this and ask user to install @@ -468,7 +451,7 @@ NxScene* plSimulationMgr::GetScene(plKey world) if (!scene) { - UInt32 maxSteps = (UInt32)hsCeil(fMaxDelta / fStepSize); + uint32_t maxSteps = (uint32_t)ceil(fMaxDelta / fStepSize); NxSceneDesc sceneDesc; sceneDesc.gravity.set(0, 0, -32.174049f); @@ -539,7 +522,7 @@ void plSimulationMgr::ISendCollisionMsg(plKey receiver, plKey hitter, hsBool ent { DetectorLogYellow("Collision: %s is inside %s. Sending an %s msg", hitter ? hitter->GetName().c_str() : "(nil)", receiver->GetName().c_str(), entering ? "'enter'" : "'exit'"); - plCollideMsg* msg = TRACKED_NEW plCollideMsg; + plCollideMsg* msg = new plCollideMsg; msg->fOtherKey = hitter; msg->fEntering = entering; msg->AddReceiver(receiver); @@ -556,7 +539,7 @@ void plSimulationMgr::UpdateDetectorsInScene(plKey world, plKey avatar, hsPoint3 hsPoint3 soPos = ci->GetWorldPos(); if (scene) { - UInt32 numActors = scene->getNbActors(); + uint32_t numActors = scene->getNbActors(); NxActor** actors = scene->getActors(); for (int i = 0; i < numActors; i++) @@ -584,7 +567,7 @@ void plSimulationMgr::UpdateAvatarInDetector(plKey world, plPXPhysical* detector NxScene* scene = GetScene(world); if (scene) { - UInt32 numActors = scene->getNbActors(); + uint32_t numActors = scene->getNbActors(); NxActor** actors = scene->getActors(); for (int i = 0; i < numActors; i++) @@ -629,7 +612,7 @@ void plSimulationMgr::Advance(float delSecs) plProfile_IncCount(StepLen, (int)(delSecs*1000)); #ifndef PLASMA_EXTERNAL_RELASE - UInt32 stepTime = hsTimer::GetPrecTickCount(); + uint32_t stepTime = hsTimer::GetPrecTickCount(); #endif plProfile_BeginTiming(Step); plPXPhysicalControllerCore::UpdatePrestep(delSecs); @@ -719,7 +702,7 @@ void plSimulationMgr::ISendUpdates() for (; it != fScenes.end(); it++) { NxScene* scene = it->second; - UInt32 numActors = scene->getNbActors(); + uint32_t numActors = scene->getNbActors(); NxActor** actors = scene->getActors(); for (int i = 0; i < numActors; i++) @@ -802,7 +785,7 @@ int plSimulationMgr::GetStepsPerSecond() return (int)((1.0 / fStepSize) + 0.5f); // round to nearest int } -int plSimulationMgr::GetMaterialIdx(NxScene* scene, hsScalar friction, hsScalar restitution) +int plSimulationMgr::GetMaterialIdx(NxScene* scene, float friction, float restitution) { if (friction == 0.5f && restitution == 0.5f) return 0; @@ -984,7 +967,7 @@ void plSimulationMgr::IDrawActiveActorList() plDebugText &debugTxt = plDebugText::Instance(); char strBuf[ 2048 ]; int lineHeight = debugTxt.GetFontSize() + 4; - UInt32 scrnWidth, scrnHeight; + uint32_t scrnWidth, scrnHeight; debugTxt.GetScreenSize( &scrnWidth, &scrnHeight ); int y = 10; @@ -1000,9 +983,9 @@ void plSimulationMgr::IDrawActiveActorList() sprintf(strBuf, "Scene: %s",it->first->GetName()); debugTxt.DrawString(x, y, strBuf); y += lineHeight; - UInt32 numActors =it->second->getNbActors(); + uint32_t numActors =it->second->getNbActors(); NxActor** actors =it->second->getActors(); - for(UInt32 i=0;iisSleeping()) { diff --git a/Sources/Plasma/PubUtilLib/plPhysX/plSimulationMgr.h b/Sources/Plasma/PubUtilLib/plPhysX/plSimulationMgr.h index 18448172..d22fc286 100644 --- a/Sources/Plasma/PubUtilLib/plPhysX/plSimulationMgr.h +++ b/Sources/Plasma/PubUtilLib/plPhysX/plSimulationMgr.h @@ -97,7 +97,7 @@ public: // the scene void ReleaseScene(plKey world); - int GetMaterialIdx(NxScene* scene, hsScalar friction, hsScalar restitution); + int GetMaterialIdx(NxScene* scene, float friction, float restitution); // PHYSX FIXME - walk thru all the convex hull detector regions to see if we are in any... we're either coming or going void UpdateDetectorsInScene(plKey world, plKey avatar, hsPoint3& pos, bool entering); diff --git a/Sources/Plasma/PubUtilLib/plPhysical/plCollisionDetector.cpp b/Sources/Plasma/PubUtilLib/plPhysical/plCollisionDetector.cpp index 96e247d2..b0891d65 100644 --- a/Sources/Plasma/PubUtilLib/plPhysical/plCollisionDetector.cpp +++ b/Sources/Plasma/PubUtilLib/plPhysical/plCollisionDetector.cpp @@ -41,7 +41,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ #include "plAvatar/plAvCallbackAction.h" -#include "hsTypes.h" +#include "HeadSpin.h" #include "plCollisionDetector.h" #include "plMessage/plCollideMsg.h" #include "plgDispatch.h" @@ -114,7 +114,7 @@ hsBool plCollisionDetector::MsgReceive(plMessage* msg) { for (int i = 0; i < fReceivers.Count(); i++) { - plActivatorMsg* pMsg = TRACKED_NEW plActivatorMsg; + plActivatorMsg* pMsg = new plActivatorMsg; pMsg->AddReceiver( fReceivers[i] ); if (fProxyKey) @@ -141,7 +141,7 @@ hsBool plCollisionDetector::MsgReceive(plMessage* msg) for (int i = 0; i < fReceivers.Count(); i++) { - plActivatorMsg* pMsg = TRACKED_NEW plActivatorMsg; + plActivatorMsg* pMsg = new plActivatorMsg; pMsg->AddReceiver( fReceivers[i] ); if (fProxyKey) pMsg->fHiteeObj = fProxyKey; @@ -194,7 +194,7 @@ hsBool plCollisionDetector::MsgReceive(plMessage* msg) plgDispatch::Dispatch()->UnRegisterForExactType(plEvalMsg::Index(), GetKey()); for (int i = 0; i < fReceivers.Count(); i++) { - plActivatorMsg* pMsg = TRACKED_NEW plActivatorMsg; + plActivatorMsg* pMsg = new plActivatorMsg; pMsg->AddReceiver( fReceivers[i] ); if (fProxyKey) pMsg->fHiteeObj = fProxyKey; @@ -491,7 +491,7 @@ void plObjectInVolumeDetector::ITrigger(plKey hitter, bool entering, bool immedi else initialState =false; - plCollisionBookKeepingInfo* BookKeeper=TRACKED_NEW plCollisionBookKeepingInfo(hitter); + plCollisionBookKeepingInfo* BookKeeper=new plCollisionBookKeepingInfo(hitter); if(entering) { BookKeeper->enters++; @@ -509,7 +509,7 @@ void plObjectInVolumeDetector::ITrigger(plKey hitter, bool entering, bool immedi } else { - plActivatorMsg* ActivatorMsg = TRACKED_NEW plActivatorMsg; + plActivatorMsg* ActivatorMsg = new plActivatorMsg; ActivatorMsg->AddReceivers(fReceivers); if (fProxyKey) ActivatorMsg->fHiteeObj = fProxyKey; @@ -533,7 +533,7 @@ void plObjectInVolumeDetector::ITrigger(plKey hitter, bool entering, bool immedi } #endif // USE_PHYSX_COLLISION_FLUTTER_WORKAROUND -/* fSavedActivatorMsg = TRACKED_NEW plActivatorMsg; +/* fSavedActivatorMsg = new plActivatorMsg; fSavedActivatorMsg->AddReceivers(fReceivers); @@ -647,7 +647,7 @@ void plObjectInVolumeDetector::IHandleEval(plEvalMsg* pEval) HitIt = fCurrentResidents.find((*it)->hitter); if(HitIt != fCurrentResidents.end()) alreadyInside = true; else alreadyInside=false; - plActivatorMsg* actout=TRACKED_NEW plActivatorMsg; + plActivatorMsg* actout=new plActivatorMsg; actout->fHitterObj=((*it)->hitter); actout->SetSender(GetKey()); if (fProxyKey) @@ -743,7 +743,7 @@ plObjectInVolumeAndFacingDetector::~plObjectInVolumeAndFacingDetector() void plObjectInVolumeAndFacingDetector::SetFacingTolerance(int degrees) { - fFacingTolerance = hsCosine(hsScalarDegToRad(degrees)); + fFacingTolerance = cos(hsDegreesToRadians(degrees)); } void plObjectInVolumeAndFacingDetector::ICheckForTrigger() @@ -760,7 +760,7 @@ void plObjectInVolumeAndFacingDetector::ICheckForTrigger() playerView.Normalize(); objView.Normalize(); - hsScalar dot = playerView * objView; + float dot = playerView * objView; // hsStatusMessageF("Dot: %f Tolerance: %f", dot, fFacingTolerance); bool facing = dot >= fFacingTolerance; @@ -890,14 +890,14 @@ hsBool plSubworldRegionDetector::MsgReceive(plMessage* msg) DetectorLogSpecial("Switching to subworld %s", fSub->GetName()); plKey nilKey; - plSubWorldMsg* msg = TRACKED_NEW plSubWorldMsg(GetKey(), avMod->GetKey(), fSub); + plSubWorldMsg* msg = new plSubWorldMsg(GetKey(), avMod->GetKey(), fSub); msg->Send(); } } else { DetectorLogSpecial("Switching to main subworld"); - plSubWorldMsg* msg = TRACKED_NEW plSubWorldMsg(GetKey(), avMod->GetKey(), nil); + plSubWorldMsg* msg = new plSubWorldMsg(GetKey(), avMod->GetKey(), nil); msg->Send(); } } @@ -1075,7 +1075,7 @@ hsBool plSimpleRegionSensor::MsgReceive(plMessage *msg) } // IEVAL -hsBool plSimpleRegionSensor::IEval(double secs, hsScalar del, UInt32 dirty) +hsBool plSimpleRegionSensor::IEval(double secs, float del, uint32_t dirty) { return false; } diff --git a/Sources/Plasma/PubUtilLib/plPhysical/plCollisionDetector.h b/Sources/Plasma/PubUtilLib/plPhysical/plCollisionDetector.h index 8a832b5e..519215d3 100644 --- a/Sources/Plasma/PubUtilLib/plPhysical/plCollisionDetector.h +++ b/Sources/Plasma/PubUtilLib/plPhysical/plCollisionDetector.h @@ -56,7 +56,7 @@ class plEvalMsg; class plCollisionDetector : public plDetectorModifier { protected: - Int8 fType; + int8_t fType; hsBool fBumped, fTriggered; plArmatureMod* IGetAvatarModifier(plKey key); @@ -81,7 +81,7 @@ public: CLASSNAME_REGISTER( plCollisionDetector ); GETINTERFACE_ANY( plCollisionDetector, plDetectorModifier ); - virtual void SetType(Int8 i) { fType |= i; } + virtual void SetType(int8_t i) { fType |= i; } void Read(hsStream* stream, hsResMgr* mgr); void Write(hsStream* stream, hsResMgr* mgr); @@ -130,7 +130,7 @@ public: fWaitingForEval=false;fSavedActivatorMsg=nil; } - plObjectInVolumeDetector(Int8 i){fType = i;fWaitingForEval=false;fSavedActivatorMsg=nil;} + plObjectInVolumeDetector(int8_t i){fType = i;fWaitingForEval=false;fSavedActivatorMsg=nil;} virtual ~plObjectInVolumeDetector(){;} virtual hsBool MsgReceive(plMessage* msg); @@ -147,7 +147,7 @@ public: class plObjectInVolumeAndFacingDetector : public plObjectInVolumeDetector { protected: - hsScalar fFacingTolerance; + float fFacingTolerance; bool fNeedWalkingForward; bool fAvatarInVolume; @@ -271,7 +271,7 @@ public: virtual void Write(hsStream *stream, hsResMgr *mgr); virtual void Read(hsStream *stream, hsResMgr *mgr); - virtual hsBool IEval(double secs, hsScalar del, UInt32 dirty); + virtual hsBool IEval(double secs, float del, uint32_t dirty); protected: plMessage *fEnterMsg; plMessage *fExitMsg; diff --git a/Sources/Plasma/PubUtilLib/plPhysical/plDetectorModifier.h b/Sources/Plasma/PubUtilLib/plPhysical/plDetectorModifier.h index 3e6b2f16..d2cab1be 100644 --- a/Sources/Plasma/PubUtilLib/plPhysical/plDetectorModifier.h +++ b/Sources/Plasma/PubUtilLib/plPhysical/plDetectorModifier.h @@ -51,7 +51,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com class plDetectorModifier : public plSingleModifier { protected: - virtual hsBool IEval(double secs, hsScalar del, UInt32 dirty){ return true; } + virtual hsBool IEval(double secs, float del, uint32_t dirty){ return true; } hsTArray fReceivers; plModifier* fRemoteMod; @@ -68,7 +68,7 @@ public: void AddLogicObj(plKey pKey) { fReceivers.Append(pKey); } void SetRemote(plModifier* p) { fRemoteMod = p; } plModifier* RemoteMod() { return fRemoteMod; } - virtual void SetType(Int8 i) {;} + virtual void SetType(int8_t i) {;} int GetNumReceivers() const { return fReceivers.Count(); } plKey GetReceiver(int i) const { return fReceivers[i]; } void SetProxyKey(const plKey &k) { fProxyKey = k; } @@ -81,7 +81,7 @@ public: { fReceivers.Append(mgr->ReadKey(stream)); } - mgr->ReadKeyNotifyMe(stream, TRACKED_NEW plObjRefMsg(GetKey(), plRefMsg::kOnCreate, 0, plObjRefMsg::kModifier), plRefFlags::kActiveRef); + mgr->ReadKeyNotifyMe(stream, new plObjRefMsg(GetKey(), plRefMsg::kOnCreate, 0, plObjRefMsg::kModifier), plRefFlags::kActiveRef); fProxyKey = mgr->ReadKey(stream); } diff --git a/Sources/Plasma/PubUtilLib/plPhysical/plPhysicalProxy.cpp b/Sources/Plasma/PubUtilLib/plPhysical/plPhysicalProxy.cpp index b2b79426..a8cd5f5a 100644 --- a/Sources/Plasma/PubUtilLib/plPhysical/plPhysicalProxy.cpp +++ b/Sources/Plasma/PubUtilLib/plPhysical/plPhysicalProxy.cpp @@ -55,7 +55,7 @@ plPhysicalProxy::plPhysicalProxy() { } -plPhysicalProxy::plPhysicalProxy(const hsColorRGBA& amb, const hsColorRGBA& dif, hsScalar opac) +plPhysicalProxy::plPhysicalProxy(const hsColorRGBA& amb, const hsColorRGBA& dif, float opac) : plProxyGen(amb, dif, opac), fOwner(nil), fController(nil) @@ -97,7 +97,7 @@ plKey plPhysicalProxy::IGetNode() const return nil; } -plDrawableSpans* plPhysicalProxy::ICreateProxy(hsGMaterial* mat, hsTArray& idx, plDrawableSpans* addTo) +plDrawableSpans* plPhysicalProxy::ICreateProxy(hsGMaterial* mat, hsTArray& idx, plDrawableSpans* addTo) { if (fOwner) { diff --git a/Sources/Plasma/PubUtilLib/plPhysical/plPhysicalProxy.h b/Sources/Plasma/PubUtilLib/plPhysical/plPhysicalProxy.h index cd20a028..6804d7ad 100644 --- a/Sources/Plasma/PubUtilLib/plPhysical/plPhysicalProxy.h +++ b/Sources/Plasma/PubUtilLib/plPhysical/plPhysicalProxy.h @@ -53,7 +53,7 @@ class plPhysicalProxy : public plProxyGen { public: plPhysicalProxy(); - plPhysicalProxy(const hsColorRGBA& amb, const hsColorRGBA& dif, hsScalar opac); + plPhysicalProxy(const hsColorRGBA& amb, const hsColorRGBA& dif, float opac); virtual ~plPhysicalProxy(); bool Init(plPhysical* phys); @@ -63,7 +63,7 @@ protected: plPhysical* fOwner; plPXPhysicalControllerCore* fController; - virtual plDrawableSpans* ICreateProxy(hsGMaterial* mat, hsTArray& idx, plDrawableSpans* addTo=nil); + virtual plDrawableSpans* ICreateProxy(hsGMaterial* mat, hsTArray& idx, plDrawableSpans* addTo=nil); virtual plKey IGetNode() const; }; diff --git a/Sources/Plasma/PubUtilLib/plPhysical/plPhysicalSDLModifier.cpp b/Sources/Plasma/PubUtilLib/plPhysical/plPhysicalSDLModifier.cpp index 5ced3505..65988b56 100644 --- a/Sources/Plasma/PubUtilLib/plPhysical/plPhysicalSDLModifier.cpp +++ b/Sources/Plasma/PubUtilLib/plPhysical/plPhysicalSDLModifier.cpp @@ -194,7 +194,7 @@ static void IGetVars(plStateDataRecord::SimpleVarsList& vars, } } -void plPhysicalSDLModifier::ILogState(const plStateDataRecord* state, bool useDirty, const char* prefix, UInt32 color) +void plPhysicalSDLModifier::ILogState(const plStateDataRecord* state, bool useDirty, const char* prefix, uint32_t color) { hsPoint3 pos; bool isPosSet; diff --git a/Sources/Plasma/PubUtilLib/plPhysical/plPhysicalSDLModifier.h b/Sources/Plasma/PubUtilLib/plPhysical/plPhysicalSDLModifier.h index 360fb0f2..f9b8dde7 100644 --- a/Sources/Plasma/PubUtilLib/plPhysical/plPhysicalSDLModifier.h +++ b/Sources/Plasma/PubUtilLib/plPhysical/plPhysicalSDLModifier.h @@ -66,7 +66,7 @@ public: protected: static int fLogLevel; static plStatusLog* IGetLog(); - void ILogState(const plStateDataRecord* state, bool useDirty, const char* prefix, UInt32 color); + void ILogState(const plStateDataRecord* state, bool useDirty, const char* prefix, uint32_t color); plPhysical* IGetPhysical(); virtual void IPutCurrentStateIn(plStateDataRecord* dstState); diff --git a/Sources/Plasma/PubUtilLib/plPhysical/plPhysicalSndGroup.cpp b/Sources/Plasma/PubUtilLib/plPhysical/plPhysicalSndGroup.cpp index 012a08eb..6e115f89 100644 --- a/Sources/Plasma/PubUtilLib/plPhysical/plPhysicalSndGroup.cpp +++ b/Sources/Plasma/PubUtilLib/plPhysical/plPhysicalSndGroup.cpp @@ -61,7 +61,7 @@ plPhysicalSndGroup::plPhysicalSndGroup() : fPlayingSlideSound(false) fGroup = kNone; } -plPhysicalSndGroup::plPhysicalSndGroup( UInt32 grp ) : fPlayingSlideSound(false) +plPhysicalSndGroup::plPhysicalSndGroup( uint32_t grp ) : fPlayingSlideSound(false) { fGroup = grp; } @@ -70,12 +70,12 @@ plPhysicalSndGroup::~plPhysicalSndGroup() { } -bool plPhysicalSndGroup::HasSlideSound(UInt32 against) +bool plPhysicalSndGroup::HasSlideSound(uint32_t against) { return against < fSlideSounds.GetCount(); } -bool plPhysicalSndGroup::HasImpactSound(UInt32 against) +bool plPhysicalSndGroup::HasImpactSound(uint32_t against) { return against < fImpactSounds.GetCount(); } @@ -91,7 +91,7 @@ void plPhysicalSndGroup::Read( hsStream *s, hsResMgr *mgr ) s->ReadLE( &fGroup ); - UInt32 i, count = s->ReadLE32(); + uint32_t i, count = s->ReadLE32(); fImpactSounds.Reset(); for( i = 0; i < count; i++ ) @@ -110,7 +110,7 @@ void plPhysicalSndGroup::Write( hsStream *s, hsResMgr *mgr ) s->WriteLE( fGroup ); - UInt32 i; + uint32_t i; s->WriteLE32( fImpactSounds.GetCount() ); for( i = 0; i < fImpactSounds.GetCount(); i++ ) mgr->WriteKey( s, fImpactSounds[ i ] ); @@ -120,7 +120,7 @@ void plPhysicalSndGroup::Write( hsStream *s, hsResMgr *mgr ) mgr->WriteKey( s, fSlideSounds[ i ] ); } -void plPhysicalSndGroup::AddImpactSound( UInt32 against, plKey receiver ) +void plPhysicalSndGroup::AddImpactSound( uint32_t against, plKey receiver ) { if( fImpactSounds.GetCount() <= against ) { @@ -131,7 +131,7 @@ void plPhysicalSndGroup::AddImpactSound( UInt32 against, plKey receiver ) fImpactSounds[ against ] = receiver; } -void plPhysicalSndGroup::AddSlideSound( UInt32 against, plKey receiver ) +void plPhysicalSndGroup::AddSlideSound( uint32_t against, plKey receiver ) { if( fSlideSounds.GetCount() <= against ) { @@ -142,40 +142,40 @@ void plPhysicalSndGroup::AddSlideSound( UInt32 against, plKey receiver ) fSlideSounds[ against ] = receiver; } -void plPhysicalSndGroup::PlaySlideSound(UInt32 against) +void plPhysicalSndGroup::PlaySlideSound(uint32_t against) { if(against >= fSlideSounds.Count()) return; - plAnimCmdMsg* animMsg = TRACKED_NEW plAnimCmdMsg; + plAnimCmdMsg* animMsg = new plAnimCmdMsg; animMsg->SetCmd(plAnimCmdMsg::kContinue); animMsg->Send(fSlideSounds[against]); fPlayingSlideSound = true; } -void plPhysicalSndGroup::StopSlideSound(UInt32 against) +void plPhysicalSndGroup::StopSlideSound(uint32_t against) { if(against >= fSlideSounds.Count()) return; - plAnimCmdMsg *animMsg = TRACKED_NEW plAnimCmdMsg; + plAnimCmdMsg *animMsg = new plAnimCmdMsg; animMsg->SetCmd(plAnimCmdMsg::kStop); animMsg->Send(fSlideSounds[against]); fPlayingSlideSound = false; } -void plPhysicalSndGroup::PlayImpactSound(UInt32 against) +void plPhysicalSndGroup::PlayImpactSound(uint32_t against) { if(against >= fImpactSounds.Count()) return; - plAnimCmdMsg* animMsg = TRACKED_NEW plAnimCmdMsg; + plAnimCmdMsg* animMsg = new plAnimCmdMsg; animMsg->SetCmd(plAnimCmdMsg::kContinue); animMsg->Send(fImpactSounds[against]); } -void plPhysicalSndGroup::SetSlideSoundVolume(UInt32 against, hsScalar volume) +void plPhysicalSndGroup::SetSlideSoundVolume(uint32_t against, float volume) { if(against >= fSlideSounds.Count()) return; - plAnimCmdMsg* animMsg = TRACKED_NEW plAnimCmdMsg; + plAnimCmdMsg* animMsg = new plAnimCmdMsg; animMsg->SetCmd(plAnimCmdMsg::kSetSpeed); animMsg->fSpeed = volume; animMsg->Send(fSlideSounds[against]); diff --git a/Sources/Plasma/PubUtilLib/plPhysical/plPhysicalSndGroup.h b/Sources/Plasma/PubUtilLib/plPhysical/plPhysicalSndGroup.h index aa88357e..f22a67cd 100644 --- a/Sources/Plasma/PubUtilLib/plPhysical/plPhysicalSndGroup.h +++ b/Sources/Plasma/PubUtilLib/plPhysical/plPhysicalSndGroup.h @@ -52,7 +52,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // // ////////////////////////////////////////////////////////////////////////////// -#include "hsTypes.h" +#include "HeadSpin.h" #include "hsTemplates.h" #include "pnKeyedObject/hsKeyedObject.h" @@ -73,7 +73,7 @@ public: }; plPhysicalSndGroup(); - plPhysicalSndGroup( UInt32 grp ); + plPhysicalSndGroup( uint32_t grp ); virtual ~plPhysicalSndGroup(); CLASSNAME_REGISTER( plPhysicalSndGroup ); @@ -85,18 +85,18 @@ public: virtual void Read( hsStream *s, hsResMgr *mgr ); virtual void Write( hsStream *s, hsResMgr *mgr ); - void PlaySlideSound(UInt32 against); - void StopSlideSound(UInt32 against); - void PlayImpactSound(UInt32 against); - void SetSlideSoundVolume(UInt32 against, hsScalar volume); - bool HasSlideSound(UInt32 against); - bool HasImpactSound(UInt32 against); + void PlaySlideSound(uint32_t against); + void StopSlideSound(uint32_t against); + void PlayImpactSound(uint32_t against); + void SetSlideSoundVolume(uint32_t against, float volume); + bool HasSlideSound(uint32_t against); + bool HasImpactSound(uint32_t against); - UInt32 GetGroup( void ) const { return fGroup; } + uint32_t GetGroup( void ) const { return fGroup; } // Export only - void AddImpactSound( UInt32 against, plKey receiver ); - void AddSlideSound( UInt32 against, plKey receiver ); + void AddImpactSound( uint32_t against, plKey receiver ); + void AddSlideSound( uint32_t against, plKey receiver ); bool IsSliding() { return fPlayingSlideSound; } protected: @@ -107,7 +107,7 @@ protected: kRefSlideSound }; - UInt32 fGroup; + uint32_t fGroup; bool fPlayingSlideSound; // Sound key arrays for, well, our sounds! diff --git a/Sources/Plasma/PubUtilLib/plPhysical/plPhysicsSoundMgr.cpp b/Sources/Plasma/PubUtilLib/plPhysical/plPhysicsSoundMgr.cpp index d6a06732..0df567ce 100644 --- a/Sources/Plasma/PubUtilLib/plPhysical/plPhysicsSoundMgr.cpp +++ b/Sources/Plasma/PubUtilLib/plPhysical/plPhysicsSoundMgr.cpp @@ -88,7 +88,7 @@ void plPhysicsSoundMgr::Update() void plPhysicsSoundMgr::IStartCollision(const CollidePair& cp) { hsVector3 v1, v2; - const hsScalar strengthThreshold = 20.0f; + const float strengthThreshold = 20.0f; plPhysical* physicalA = cp.FirstPhysical(); plPhysical* physicalB = cp.SecondPhysical(); @@ -106,7 +106,7 @@ void plPhysicsSoundMgr::IStartCollision(const CollidePair& cp) physicalA->GetLinearVelocitySim(v1); physicalB->GetLinearVelocitySim(v2); hsVector3 vel = v1 - v2; - hsScalar strength = vel.MagnitudeSquared(); + float strength = vel.MagnitudeSquared(); if (strength >= strengthThreshold) { @@ -149,7 +149,7 @@ void plPhysicsSoundMgr::IStopCollision(const CollidePair& cp) void plPhysicsSoundMgr::IUpdateCollision(const CollidePair& cp) { - const hsScalar slideThreshhold = 0.f; + const float slideThreshhold = 0.f; hsVector3 v1, v2; plPhysical* physicalA = cp.FirstPhysical(); plPhysical* physicalB = cp.SecondPhysical(); @@ -162,7 +162,7 @@ void plPhysicsSoundMgr::IUpdateCollision(const CollidePair& cp) physicalA->GetLinearVelocitySim(v1); physicalB->GetLinearVelocitySim(v2); hsVector3 vel = v1 - v2; - hsScalar strength = vel.MagnitudeSquared(); + float strength = vel.MagnitudeSquared(); // scale strength to use as volume strength /= 16*8; @@ -175,7 +175,7 @@ void plPhysicsSoundMgr::IUpdateCollision(const CollidePair& cp) IProcessSlide(sndB, sndA, strength); } -void plPhysicsSoundMgr::IProcessSlide(plPhysicalSndGroup* sndA, plPhysicalSndGroup* sndB, hsScalar strength) +void plPhysicsSoundMgr::IProcessSlide(plPhysicalSndGroup* sndA, plPhysicalSndGroup* sndB, float strength) { sndA->SetSlideSoundVolume(sndB->GetGroup(), strength); diff --git a/Sources/Plasma/PubUtilLib/plPhysical/plPhysicsSoundMgr.h b/Sources/Plasma/PubUtilLib/plPhysical/plPhysicsSoundMgr.h index 6b86136b..7ee2c8b7 100644 --- a/Sources/Plasma/PubUtilLib/plPhysical/plPhysicsSoundMgr.h +++ b/Sources/Plasma/PubUtilLib/plPhysical/plPhysicsSoundMgr.h @@ -84,7 +84,7 @@ private: void IStartCollision(const CollidePair& cp); void IStopCollision(const CollidePair& cp); void IUpdateCollision(const CollidePair& cp); - void IProcessSlide(plPhysicalSndGroup* sndA, plPhysicalSndGroup* sndB, hsScalar strength); + void IProcessSlide(plPhysicalSndGroup* sndA, plPhysicalSndGroup* sndB, float strength); typedef std::set CollideSet; CollideSet fPrevCollisions; diff --git a/Sources/Plasma/PubUtilLib/plPhysical/plPickingDetector.cpp b/Sources/Plasma/PubUtilLib/plPhysical/plPickingDetector.cpp index 2aa00a75..471cbee0 100644 --- a/Sources/Plasma/PubUtilLib/plPhysical/plPickingDetector.cpp +++ b/Sources/Plasma/PubUtilLib/plPhysical/plPickingDetector.cpp @@ -39,7 +39,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com Mead, WA 99021 *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "plPickingDetector.h" #include "plMessage/plActivatorMsg.h" #include "plMessage/plPickedMsg.h" @@ -78,7 +78,7 @@ hsBool plPickingDetector::MsgReceive(plMessage* msg) { for (int i = 0; i < fReceivers.Count(); i++) { - plActivatorMsg* pMsg = TRACKED_NEW plActivatorMsg; + plActivatorMsg* pMsg = new plActivatorMsg; pMsg->AddReceiver( fReceivers[i] ); if (pPMsg->fPicked) pMsg->SetTriggerType( plActivatorMsg::kPickedTrigger ); diff --git a/Sources/Plasma/PubUtilLib/plPipeline/hsFogControl.h b/Sources/Plasma/PubUtilLib/plPipeline/hsFogControl.h index 597926d2..013b21f0 100644 --- a/Sources/Plasma/PubUtilLib/plPipeline/hsFogControl.h +++ b/Sources/Plasma/PubUtilLib/plPipeline/hsFogControl.h @@ -62,14 +62,14 @@ protected: hsDynamicArray fFogNodes; // hsGEnvironment::FogState fAvgFog; - virtual hsScalar IGetStrength(hsSceneNode* node) = 0; + virtual float IGetStrength(hsSceneNode* node) = 0; void IPopNodes(); void IPushNodes(); void IZeroAvgFog(); void IAverageNodes(); -// void IAccumFog(hsGEnvironment* env, hsScalar wgt); +// void IAccumFog(hsGEnvironment* env, float wgt); public: hsFogControl() {} @@ -78,7 +78,7 @@ public: CLASSNAME_REGISTER( hsFogControl ); GETINTERFACE_ANY( hsFogControl, plCreatable ); - virtual UInt32 GetType() = 0; + virtual uint32_t GetType() = 0; // virtual hsGEnvironment* GetHomeEnv() = 0; virtual void Init(hsSceneNode* node); @@ -120,21 +120,21 @@ protected: }; hsDynamicArray fPortals; - hsScalar fDefRadius; + float fDefRadius; - UInt32 fStatus; + uint32_t fStatus; void IFindFogNodes(); - virtual hsScalar IGetStrength(hsSceneNode* node); + virtual float IGetStrength(hsSceneNode* node); public: hsPortalFogControl(); - void SetDefaultRadius(hsScalar r) { fDefRadius = r; } - hsScalar GetDefaultRadius() { return fDefRadius; } + void SetDefaultRadius(float r) { fDefRadius = r; } + float GetDefaultRadius() { return fDefRadius; } hsPortal* GetPortal(int i); - virtual UInt32 GetType() { return kFogCtlPortal; } + virtual uint32_t GetType() { return kFogCtlPortal; } virtual void Init(hsSceneNode* node); virtual void Blend(); diff --git a/Sources/Plasma/PubUtilLib/plPipeline/hsG3DDeviceSelector.cpp b/Sources/Plasma/PubUtilLib/plPipeline/hsG3DDeviceSelector.cpp index 2b27b634..c053443d 100644 --- a/Sources/Plasma/PubUtilLib/plPipeline/hsG3DDeviceSelector.cpp +++ b/Sources/Plasma/PubUtilLib/plPipeline/hsG3DDeviceSelector.cpp @@ -42,15 +42,15 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com //#define DYNAHEADER_CREATE_STORAGE -#include "hsTypes.h" +#include "HeadSpin.h" #include -#include "hsWindows.h" + #include "hsG3DDeviceSelector.h" #include "hsStream.h" -#include "hsUtils.h" + #include "plPipeline.h" #ifdef HS_OPEN_GL @@ -113,7 +113,7 @@ void hsG3DDeviceMode::Read( hsStream* s ) fDepth = s->ReadLE32(); fZStencilDepths.Reset(); - UInt8 count= s->ReadByte(); + uint8_t count= s->ReadByte(); while( count-- ) fZStencilDepths.Append( s->ReadLE16() ); @@ -133,13 +133,13 @@ void hsG3DDeviceMode::Write( hsStream* s ) const s->WriteLE32(fHeight); s->WriteLE32(fDepth); - UInt8 i, count = (UInt8)fZStencilDepths.GetCount(); + uint8_t i, count = (uint8_t)fZStencilDepths.GetCount(); s->WriteByte( count ); for( i = 0; i < count; i++ ) s->WriteLE16( fZStencilDepths[ i ] ); /// Version 9 - count = (UInt8)fFSAATypes.GetCount(); + count = (uint8_t)fFSAATypes.GetCount(); s->WriteByte( count ); for( i = 0; i < count; i++ ) s->WriteByte( fFSAATypes[ i ] ); @@ -252,7 +252,7 @@ const char* hsG3DDeviceRecord::GetG3DDeviceTypeName() const "OpenGL" }; - UInt32 devType = GetG3DDeviceType(); + uint32_t devType = GetG3DDeviceType(); if( devType > hsG3DDeviceSelector::kNumDevTypes ) devType = hsG3DDeviceSelector::kDevTypeUnknown; @@ -351,22 +351,22 @@ void hsG3DDeviceRecord::Read(hsStream* s) int len; len = s->ReadLE32(); - fG3DDriverDesc = TRACKED_NEW char[len + 1]; + fG3DDriverDesc = new char[len + 1]; s->Read(len, fG3DDriverDesc); fG3DDriverDesc[len] = 0; len = s->ReadLE32(); - fG3DDriverName = TRACKED_NEW char[len + 1]; + fG3DDriverName = new char[len + 1]; s->Read(len, fG3DDriverName); fG3DDriverName[len] = 0; len = s->ReadLE32(); - fG3DDriverVersion = TRACKED_NEW char[len + 1]; + fG3DDriverVersion = new char[len + 1]; s->Read(len, fG3DDriverVersion); fG3DDriverVersion[len] = 0; len = s->ReadLE32(); - fG3DDeviceDesc = TRACKED_NEW char[len + 1]; + fG3DDeviceDesc = new char[len + 1]; s->Read(len, fG3DDeviceDesc); fG3DDeviceDesc[len] = 0; @@ -570,7 +570,7 @@ void hsG3DDeviceSelector::RemoveUnusableDevModes(hsBool bTough) else if( fRecords[i].GetG3DDeviceType() == hsG3DDeviceSelector::kDevTypeDirect3D || fRecords[i].GetG3DDeviceType() == hsG3DDeviceSelector::kDevTypeDirect3DTnL ) { - UInt32 totalMem; + uint32_t totalMem; char devDesc[ 256 ]; @@ -631,7 +631,7 @@ void hsG3DDeviceSelector::RemoveUnusableDevModes(hsBool bTough) // Microsoft, the best way to do this is to add in the memory necessary for // the entire desktop. Okay, whatever... -UInt32 hsG3DDeviceSelector::IAdjustDirectXMemory( UInt32 cardMem ) +uint32_t hsG3DDeviceSelector::IAdjustDirectXMemory( uint32_t cardMem ) { #if HS_BUILD_FOR_WIN32 HDC deskDC; @@ -677,7 +677,7 @@ void hsG3DDeviceSelector::Enumerate(hsWinRef winRef) tempClass.hInstance = GetModuleHandle( nil ); tempClass.hbrBackground = (HBRUSH)GetStockObject( BLACK_BRUSH ); tempClass.lpszClassName = fTempWinClass; - UInt16 ret = RegisterClass(&tempClass); + uint16_t ret = RegisterClass(&tempClass); hsAssert(ret, "Cannot create temporary window class to test for device modes" ); #endif @@ -698,7 +698,7 @@ void hsG3DDeviceSelector::Enumerate(hsWinRef winRef) hsBool hsG3DDeviceSelector::GetDefault (hsG3DDeviceModeRecord *dmr) { - Int32 iTnL, iD3D, iOpenGL, device, mode, i; + int32_t iTnL, iD3D, iOpenGL, device, mode, i; device = iTnL = iD3D = iOpenGL = mode = -1; if (device == -1) @@ -1117,7 +1117,7 @@ void hsG3DDeviceSelector::IGetExtOpenGLInfo( hsG3DDeviceRecord &devRec ) } while( c2 >= extString && ( isdigit( *c2 ) || isspace( *c2 ) ) ); c2++; - strncpy( str, c2, (UInt32)c - (UInt32)c2 ); + strncpy( str, c2, (uint32_t)c - (uint32_t)c2 ); j = atoi( str ); sprintf( str, "ITryOpenGL(): Device has %d MB texture memory\n", j ); hsStatusMessage( str ); @@ -1169,7 +1169,7 @@ void hsG3DDeviceSelector::IGetExtOpenGLInfo( hsG3DDeviceRecord &devRec ) #ifdef HS_OPEN_GL #if HS_BUILD_FOR_WIN32 -UInt32 hsG3DDeviceSelector::ICreateTempOpenGLContext( HDC hDC, hsBool32 makeItFull ) +uint32_t hsG3DDeviceSelector::ICreateTempOpenGLContext( HDC hDC, hsBool32 makeItFull ) { DEVMODE modeInfo; int pixFmt; @@ -1213,7 +1213,7 @@ UInt32 hsG3DDeviceSelector::ICreateTempOpenGLContext( HDC hDC, hsBool32 makeItF pixFmt = ChoosePixelFormat( hDC, &pfd ); if( pixFmt > 0 && SetPixelFormat( hDC, pixFmt, &pfd ) ) - return (UInt32)wglCreateContext( hDC ); + return (uint32_t)wglCreateContext( hDC ); return 0; } @@ -1230,7 +1230,7 @@ namespace /// The table consists of entries for each of our supported chipsets in the table, /// plus, flags to be forced set and flags to be forced cleared. Also included /// is a Z-buffer suckiness rating, which represents how badly we need to bias - /// the z and w values to avoid z-buffer artifacts, stored as an hsScalar (i.e + /// the z and w values to avoid z-buffer artifacts, stored as an float (i.e /// a float). A rating of 0 means very good/default (read: Nvidia), while, say, /// a 9.0 (i.e. shift the scale 9 times above normal) means s****y, like, say, /// a Savage4. Also also included is a forced value for max # of layers (0 means @@ -1281,13 +1281,13 @@ namespace typedef struct { - hsScalar fFogExpApproxStart; - hsScalar fFogExp2ApproxStart; - hsScalar fFogEndBias; - hsScalar fFogExpKnee; // Fog knees - hsScalar fFogExpKneeVal; - hsScalar fFogExp2Knee; - hsScalar fFogExp2KneeVal; + float fFogExpApproxStart; + float fFogExp2ApproxStart; + float fFogEndBias; + float fFogExpKnee; // Fog knees + float fFogExpKneeVal; + float fFogExp2Knee; + float fFogExp2KneeVal; } FogTweakTable; FogTweakTable dsDefaultFogVals = { 0, 0, 254.0 / 255.0, 0.5f, 0.15f, 0.5f, 0.15f }; @@ -1298,27 +1298,27 @@ namespace typedef struct { - UInt8 fType; // Our chipset ID - UInt32 *fFlagsToSet; - UInt32 *fFlagsToClear; - hsScalar fZSuckiness; // See above - UInt32 fForceMaxLayers; // The max # of layers we REALLY want (0 to not force) - hsScalar fLODRating; + uint8_t fType; // Our chipset ID + uint32_t *fFlagsToSet; + uint32_t *fFlagsToClear; + float fZSuckiness; // See above + uint32_t fForceMaxLayers; // The max # of layers we REALLY want (0 to not force) + float fLODRating; FogTweakTable *fFogTweaks; } CFTable; - UInt32 dsSavageCapsClr[] = { + uint32_t dsSavageCapsClr[] = { 4, // First integer is always the length hsG3DDeviceSelector::kCapsCompressTextures, hsG3DDeviceSelector::kCapsFogExp, hsG3DDeviceSelector::kCapsFogExp2, hsG3DDeviceSelector::kCapsDoesSmallTextures }; - UInt32 dsSavageCapsSet[] = { + uint32_t dsSavageCapsSet[] = { 1, // First integer is always the length hsG3DDeviceSelector::kCapsBadYonStuff }; - UInt32 dsSavage2kCapsClr[] = { + uint32_t dsSavage2kCapsClr[] = { 5, // First integer is always the length hsG3DDeviceSelector::kCapsCompressTextures, hsG3DDeviceSelector::kCapsPixelFog, @@ -1326,45 +1326,45 @@ namespace hsG3DDeviceSelector::kCapsFogExp2, hsG3DDeviceSelector::kCapsDoesSmallTextures }; - UInt32 dsS3GenerCapsClr[] = { + uint32_t dsS3GenerCapsClr[] = { 4, // First integer is always the length hsG3DDeviceSelector::kCapsCompressTextures, hsG3DDeviceSelector::kCapsFogExp, hsG3DDeviceSelector::kCapsFogExp2, hsG3DDeviceSelector::kCapsDoesSmallTextures }; - UInt32 dsATIFuryCapsClr[] = { + uint32_t dsATIFuryCapsClr[] = { 3, // First integer is always the length hsG3DDeviceSelector::kCapsFogExp, hsG3DDeviceSelector::kCapsFogExp2, hsG3DDeviceSelector::kCapsPixelFog }; - UInt32 dsATIRageCapsClr[] = { + uint32_t dsATIRageCapsClr[] = { 4, // First integer is always the length hsG3DDeviceSelector::kCapsFogExp, hsG3DDeviceSelector::kCapsFogExp2, hsG3DDeviceSelector::kCapsDoesSmallTextures, hsG3DDeviceSelector::kCapsPixelFog }; - UInt32 dsATIGenerCapsClr[] = { + uint32_t dsATIGenerCapsClr[] = { 4, // First integer is always the length hsG3DDeviceSelector::kCapsPixelFog, hsG3DDeviceSelector::kCapsFogExp, hsG3DDeviceSelector::kCapsFogExp2, hsG3DDeviceSelector::kCapsDoesSmallTextures }; - UInt32 dsATIRadeonCapsSet[] = { + uint32_t dsATIRadeonCapsSet[] = { 2, // First integer is always the length hsG3DDeviceSelector::kCapsBadManaged, hsG3DDeviceSelector::kCapsShareDepth }; - UInt32 dsATIRadeonCapsClr[] = { + uint32_t dsATIRadeonCapsClr[] = { 2, // First integer is always the length hsG3DDeviceSelector::kCapsWBuffer, hsG3DDeviceSelector::kCapsDoesSmallTextures }; - UInt32 dsATIR7X00CapsSet[] = { + uint32_t dsATIR7X00CapsSet[] = { 4, // First integer is always the length hsG3DDeviceSelector::kCapsCantShadow, hsG3DDeviceSelector::kCapsBadManaged, @@ -1372,7 +1372,7 @@ namespace hsG3DDeviceSelector::kCapsNoAniso }; - UInt32 dsATIR7500CapsSet[] = { + uint32_t dsATIR7500CapsSet[] = { 5, // First integer is always the length hsG3DDeviceSelector::kCapsMaxUVWSrc2, hsG3DDeviceSelector::kCapsCantShadow, @@ -1381,70 +1381,70 @@ namespace hsG3DDeviceSelector::kCapsNoAniso }; - UInt32 dsATIR7X00CapsClr[] = { + uint32_t dsATIR7X00CapsClr[] = { 2, // First integer is always the length hsG3DDeviceSelector::kCapsWBuffer, hsG3DDeviceSelector::kCapsDoesSmallTextures }; - UInt32 dsATIR8X00CapsSet[] = { + uint32_t dsATIR8X00CapsSet[] = { 2, // First integer is always the length hsG3DDeviceSelector::kCapsBadManaged, hsG3DDeviceSelector::kCapsShareDepth }; - UInt32 dsATIR8X00CapsClr[] = { + uint32_t dsATIR8X00CapsClr[] = { 2, // First integer is always the length hsG3DDeviceSelector::kCapsWBuffer, hsG3DDeviceSelector::kCapsDoesSmallTextures }; - UInt32 dsTNTCapsClr[] = { + uint32_t dsTNTCapsClr[] = { 1, // First integer is always the length hsG3DDeviceSelector::kCapsDoesSmallTextures }; - UInt32 dsDefaultCapsClr[] = { + uint32_t dsDefaultCapsClr[] = { 1, // First integer is always the length hsG3DDeviceSelector::kCapsDoesSmallTextures }; - UInt32 dsMG400CapsClr[] = { + uint32_t dsMG400CapsClr[] = { 1, // First integer is always the length hsG3DDeviceSelector::kCapsDoesSmallTextures }; - UInt32 dsKYROCapsClr[] = { + uint32_t dsKYROCapsClr[] = { 2, // First integer is always the length hsG3DDeviceSelector::kCapsDoesSmallTextures, hsG3DDeviceSelector::kCapsPixelFog }; - UInt32 dsKYROCapsSet[] = { + uint32_t dsKYROCapsSet[] = { 1, // First integer is always the length hsG3DDeviceSelector::kCapsNoKindaSmallTexs }; - UInt32 ds3dfxV5CapsClr[] = { + uint32_t ds3dfxV5CapsClr[] = { 2, // First integer is always the length hsG3DDeviceSelector::kCapsFogExp, hsG3DDeviceSelector::kCapsFogExp2 }; - UInt32 dsMatroxParheliaSet[] = { + uint32_t dsMatroxParheliaSet[] = { 1, hsG3DDeviceSelector::kCapsNoAA }; - UInt32 dsGeForceSet[] = { + uint32_t dsGeForceSet[] = { 2, hsG3DDeviceSelector::kCapsCantProj, hsG3DDeviceSelector::kCapsDoubleFlush }; - UInt32 dsGeForce2Set[] = { + uint32_t dsGeForce2Set[] = { 1, hsG3DDeviceSelector::kCapsDoubleFlush }; - UInt32 dsGeForce3Set[] = { + uint32_t dsGeForce3Set[] = { 1, hsG3DDeviceSelector::kCapsSingleFlush }; - UInt32 dsGeForce4MXSet[] = { + uint32_t dsGeForce4MXSet[] = { 1, hsG3DDeviceSelector::kCapsSingleFlush }; - UInt32 dsGeForce4Set[] = { + uint32_t dsGeForce4Set[] = { 1, hsG3DDeviceSelector::kCapsSingleFlush }; @@ -1802,7 +1802,7 @@ void hsG3DDeviceSelector::IFudgeDirectXDevice( hsG3DDeviceRecord &record, // Given a chipset ID, looks the values up in the CFT and sets the appropriate // values. -void hsG3DDeviceSelector::ISetFudgeFactors( UInt8 chipsetID, hsG3DDeviceRecord &record ) +void hsG3DDeviceSelector::ISetFudgeFactors( uint8_t chipsetID, hsG3DDeviceRecord &record ) { int i, maxIDs, j; @@ -1971,7 +1971,7 @@ void plDemoDebugFile::Write( char *string1, char *string2 ) #endif } -void plDemoDebugFile::Write( char *string1, Int32 value ) +void plDemoDebugFile::Write( char *string1, int32_t value ) { #if M3DDEMOINFO // Demo Debug Build if( !fIsOpen ) diff --git a/Sources/Plasma/PubUtilLib/plPipeline/hsG3DDeviceSelector.h b/Sources/Plasma/PubUtilLib/plPipeline/hsG3DDeviceSelector.h index b45e38b2..1eaf1e7e 100644 --- a/Sources/Plasma/PubUtilLib/plPipeline/hsG3DDeviceSelector.h +++ b/Sources/Plasma/PubUtilLib/plPipeline/hsG3DDeviceSelector.h @@ -86,15 +86,15 @@ class hsG3DDeviceMode kDiscarded = 0x1 }; protected: - UInt32 fFlags; + uint32_t fFlags; - UInt32 fWidth; - UInt32 fHeight; - UInt32 fDepth; + uint32_t fWidth; + uint32_t fHeight; + uint32_t fDepth; - hsTArray fZStencilDepths; // Array of supported depth/stencil buffer formats. + hsTArray fZStencilDepths; // Array of supported depth/stencil buffer formats. // Each entry is of the form: ( stencil bit count << 8 ) | ( depth bit count ) - hsTArray fFSAATypes; // Array of multisample types supported (each one 2-16) + hsTArray fFSAATypes; // Array of multisample types supported (each one 2-16) hsBool fCanRenderToCubics; @@ -107,24 +107,24 @@ public: void Clear(); hsBool GetDiscarded() const { return 0 != (fFlags & kDiscarded); } - UInt32 GetWidth() const { return fWidth; } - UInt32 GetHeight() const { return fHeight; } - UInt32 GetColorDepth() const { return fDepth; } - UInt8 GetNumZStencilDepths( void ) const { return fZStencilDepths.GetCount(); } - UInt16 GetZStencilDepth( UInt8 i ) const { return fZStencilDepths[ i ]; } - UInt8 GetNumFSAATypes( void ) const { return fFSAATypes.GetCount(); } - UInt8 GetFSAAType( UInt8 i ) const { return fFSAATypes[ i ]; } + uint32_t GetWidth() const { return fWidth; } + uint32_t GetHeight() const { return fHeight; } + uint32_t GetColorDepth() const { return fDepth; } + uint8_t GetNumZStencilDepths( void ) const { return fZStencilDepths.GetCount(); } + uint16_t GetZStencilDepth( uint8_t i ) const { return fZStencilDepths[ i ]; } + uint8_t GetNumFSAATypes( void ) const { return fFSAATypes.GetCount(); } + uint8_t GetFSAAType( uint8_t i ) const { return fFSAATypes[ i ]; } hsBool GetCanRenderToCubics( void ) const { return fCanRenderToCubics; } void SetDiscarded(hsBool on=true) { if(on) fFlags |= kDiscarded; else fFlags &= ~kDiscarded; } - void SetWidth(UInt32 w) { fWidth = w; } - void SetHeight(UInt32 h) { fHeight = h; } - void SetColorDepth(UInt32 d) { fDepth = d; } + void SetWidth(uint32_t w) { fWidth = w; } + void SetHeight(uint32_t h) { fHeight = h; } + void SetColorDepth(uint32_t d) { fDepth = d; } void ClearZStencilDepths( void ) { fZStencilDepths.Reset(); } - void AddZStencilDepth( UInt16 depth ) { fZStencilDepths.Append( depth ); } + void AddZStencilDepth( uint16_t depth ) { fZStencilDepths.Append( depth ); } void ClearFSAATypes( void ) { fFSAATypes.Reset(); } - void AddFSAAType( UInt8 type ) { fFSAATypes.Append( type ); } + void AddFSAAType( uint8_t type ) { fFSAATypes.Append( type ); } void SetCanRenderToCubics( hsBool can ) { fCanRenderToCubics = can; } @@ -149,7 +149,7 @@ public: protected: - UInt32 fRecordVersion; /// Version starts at 2 (see .cpp for explanation) + uint32_t fRecordVersion; /// Version starts at 2 (see .cpp for explanation) enum { kCurrRecordVersion = 0x0b /// Version history: @@ -167,10 +167,10 @@ protected: }; /// Version < 2 Data - UInt32 fFlags; + uint32_t fFlags; - UInt32 fG3DDeviceType; - UInt32 fG3DHALorHEL; + uint32_t fG3DDeviceType; + uint32_t fG3DHALorHEL; char* fG3DDriverDesc; @@ -179,8 +179,8 @@ protected: char* fG3DDeviceDesc; hsBitVector fCaps; - UInt32 fLayersAtOnce; - UInt32 fMemoryBytes; + uint32_t fLayersAtOnce; + uint32_t fMemoryBytes; hsTArray fModes; @@ -198,10 +198,10 @@ protected: float fFogKneeVals[ kNumFogTypes ]; /// Version 9 - The actual AA setting we use - UInt8 fAASetting; + uint8_t fAASetting; /// Version A - the anisotropic level we use - UInt8 fMaxAnisotropicSamples; // 1 to disable, up to max allowed in hardware + uint8_t fMaxAnisotropicSamples; // 1 to disable, up to max allowed in hardware int fPixelShaderMajorVer; int fPixelShaderMinorVer; @@ -212,28 +212,28 @@ public: hsG3DDeviceRecord(const hsG3DDeviceRecord& src); hsG3DDeviceRecord& operator=(const hsG3DDeviceRecord& src); - UInt32 GetG3DDeviceType() const { return fG3DDeviceType; } + uint32_t GetG3DDeviceType() const { return fG3DDeviceType; } const char* GetG3DDeviceTypeName() const; - UInt32 GetG3DHALorHEL() const { return fG3DHALorHEL; } + uint32_t GetG3DHALorHEL() const { return fG3DHALorHEL; } - UInt32 GetMemoryBytes() const { return fMemoryBytes; } + uint32_t GetMemoryBytes() const { return fMemoryBytes; } const char* GetDriverDesc() const { return fG3DDriverDesc; } const char* GetDriverName() const { return fG3DDriverName; } const char* GetDriverVersion() const { return fG3DDriverVersion; } const char* GetDeviceDesc() const { return fG3DDeviceDesc; } - void SetG3DDeviceType(UInt32 t) { fG3DDeviceType = t; } - void SetG3DHALorHEL(UInt32 h) { fG3DHALorHEL = h; } - void SetMemoryBytes(UInt32 b) { fMemoryBytes = b; } + void SetG3DDeviceType(uint32_t t) { fG3DDeviceType = t; } + void SetG3DHALorHEL(uint32_t h) { fG3DHALorHEL = h; } + void SetMemoryBytes(uint32_t b) { fMemoryBytes = b; } void SetDriverDesc(const char* s); void SetDriverName(const char* s); void SetDriverVersion(const char* s); void SetDeviceDesc(const char* s); - hsBool GetCap(UInt32 cap) const { return fCaps.IsBitSet(cap); } - void SetCap(UInt32 cap, hsBool on=true) { fCaps.SetBit(cap, on); } + hsBool GetCap(uint32_t cap) const { return fCaps.IsBitSet(cap); } + void SetCap(uint32_t cap, hsBool on=true) { fCaps.SetBit(cap, on); } float GetZBiasRating( void ) const { return fZBiasRating; } void SetZBiasRating( float rating ) { fZBiasRating = rating; } @@ -249,17 +249,17 @@ public: float GetFogEndBias( void ) const { return fFogEndBias; } void SetFogEndBias( float rating ) { fFogEndBias = rating; } - void GetFogKneeParams( UInt8 type, float &knee, float &kneeVal ) const { knee = fFogKnees[ type ]; kneeVal = fFogKneeVals[ type ]; } - void SetFogKneeParams( UInt8 type, float knee, float kneeVal ) { fFogKnees[ type ] = knee; fFogKneeVals[ type ] = kneeVal; } + void GetFogKneeParams( uint8_t type, float &knee, float &kneeVal ) const { knee = fFogKnees[ type ]; kneeVal = fFogKneeVals[ type ]; } + void SetFogKneeParams( uint8_t type, float knee, float kneeVal ) { fFogKnees[ type ] = knee; fFogKneeVals[ type ] = kneeVal; } - UInt32 GetLayersAtOnce() const { return fLayersAtOnce; } - void SetLayersAtOnce(UInt32 n) { fLayersAtOnce = n; } + uint32_t GetLayersAtOnce() const { return fLayersAtOnce; } + void SetLayersAtOnce(uint32_t n) { fLayersAtOnce = n; } - UInt8 GetAASetting() const { return fAASetting; } - void SetAASetting( UInt8 s ) { fAASetting = s; } + uint8_t GetAASetting() const { return fAASetting; } + void SetAASetting( uint8_t s ) { fAASetting = s; } - UInt8 GetMaxAnisotropicSamples( void ) const { return fMaxAnisotropicSamples; } - void SetMaxAnisotropicSamples( UInt8 num ) { fMaxAnisotropicSamples = num; } + uint8_t GetMaxAnisotropicSamples( void ) const { return fMaxAnisotropicSamples; } + void SetMaxAnisotropicSamples( uint8_t num ) { fMaxAnisotropicSamples = num; } void SetDiscarded(hsBool on=true) { if(on)fFlags |= kDiscarded; else fFlags &= ~kDiscarded; } hsBool GetDiscarded() const { return 0 != (fFlags & kDiscarded); } @@ -393,7 +393,7 @@ protected: #endif // HS_SELECT_DX7 void IFudgeDirectXDevice( hsG3DDeviceRecord &record, D3DEnum_DriverInfo *driverInfo, D3DEnum_DeviceInfo *deviceInfo ); - UInt32 IAdjustDirectXMemory( UInt32 cardMem ); + uint32_t IAdjustDirectXMemory( uint32_t cardMem ); hsBool IGetD3DCardInfo( hsG3DDeviceRecord &record, void *driverInfo, void *deviceInfo, DWORD *vendorID, DWORD *deviceID, char **driverString, char **descString ); @@ -409,11 +409,11 @@ protected: hsG3DDeviceRecord &devRec, char *driverName ); #ifdef HS_OPEN_GL #if HS_BUILD_FOR_WIN32 - UInt32 ICreateTempOpenGLContext( HDC hDC, hsBool makeItFull ); + uint32_t ICreateTempOpenGLContext( HDC hDC, hsBool makeItFull ); #endif #endif - void ISetFudgeFactors( UInt8 chipsetID, hsG3DDeviceRecord &record ); + void ISetFudgeFactors( uint8_t chipsetID, hsG3DDeviceRecord &record ); public: hsG3DDeviceSelector(); @@ -463,7 +463,7 @@ class plDemoDebugFile static void Write( char *string1, char *string2 ); // Static function to write a string and a signed integer value to the DDF - static void Write( char *string1, Int32 value ); + static void Write( char *string1, int32_t value ); // Enables or disables the DDF class static void Enable( hsBool yes ) { fEnabled = yes; } diff --git a/Sources/Plasma/PubUtilLib/plPipeline/hsGColorizer.cpp b/Sources/Plasma/PubUtilLib/plPipeline/hsGColorizer.cpp index e046d72e..00ddf882 100644 --- a/Sources/Plasma/PubUtilLib/plPipeline/hsGColorizer.cpp +++ b/Sources/Plasma/PubUtilLib/plPipeline/hsGColorizer.cpp @@ -40,7 +40,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "plPipeline.h" #include "hsGColorizer.h" diff --git a/Sources/Plasma/PubUtilLib/plPipeline/hsGColorizer.h b/Sources/Plasma/PubUtilLib/plPipeline/hsGColorizer.h index 0c654272..b2dcb1e4 100644 --- a/Sources/Plasma/PubUtilLib/plPipeline/hsGColorizer.h +++ b/Sources/Plasma/PubUtilLib/plPipeline/hsGColorizer.h @@ -43,7 +43,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #ifndef hsGColorizer_inc #define hsGColorizer_inc -#include "hsTypes.h" +#include "HeadSpin.h" #include "hsColorRGBA.h" class plPipeline; diff --git a/Sources/Plasma/PubUtilLib/plPipeline/hsGDDrawDllLoad.cpp b/Sources/Plasma/PubUtilLib/plPipeline/hsGDDrawDllLoad.cpp index ab902935..349980ff 100644 --- a/Sources/Plasma/PubUtilLib/plPipeline/hsGDDrawDllLoad.cpp +++ b/Sources/Plasma/PubUtilLib/plPipeline/hsGDDrawDllLoad.cpp @@ -39,7 +39,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com Mead, WA 99021 *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include diff --git a/Sources/Plasma/PubUtilLib/plPipeline/hsGDDrawDllLoad.h b/Sources/Plasma/PubUtilLib/plPipeline/hsGDDrawDllLoad.h index 27cba099..cc80bb20 100644 --- a/Sources/Plasma/PubUtilLib/plPipeline/hsGDDrawDllLoad.h +++ b/Sources/Plasma/PubUtilLib/plPipeline/hsGDDrawDllLoad.h @@ -43,7 +43,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #ifndef hsGDDrawDllLoad_inc #define hsGDDrawDllLoad_inc -#include "hsConfig.h" +#include "HeadSpin.h" #if HS_BUILD_FOR_WIN32 class hsGDDrawDllLoad diff --git a/Sources/Plasma/PubUtilLib/plPipeline/hsGDeviceRef.h b/Sources/Plasma/PubUtilLib/plPipeline/hsGDeviceRef.h index 3036c485..6f513acb 100644 --- a/Sources/Plasma/PubUtilLib/plPipeline/hsGDeviceRef.h +++ b/Sources/Plasma/PubUtilLib/plPipeline/hsGDeviceRef.h @@ -55,7 +55,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com class hsGDeviceRef : public hsRefCnt { protected: - UInt32 fFlags; + uint32_t fFlags; public: // Note, derived classes define more flags. Take care if adding flags here. @@ -65,7 +65,7 @@ public: kDirty = 0x1 }; - UInt32 fUseTime; // time stamp when last used - stat gather only + uint32_t fUseTime; // time stamp when last used - stat gather only hsBool IsDirty() const { return (fFlags & kDirty); } void SetDirty(hsBool on) { if(on)fFlags |= kDirty; else fFlags &= ~kDirty; } diff --git a/Sources/Plasma/PubUtilLib/plPipeline/hsWinRef.h b/Sources/Plasma/PubUtilLib/plPipeline/hsWinRef.h index 29cd6790..db465218 100644 --- a/Sources/Plasma/PubUtilLib/plPipeline/hsWinRef.h +++ b/Sources/Plasma/PubUtilLib/plPipeline/hsWinRef.h @@ -46,7 +46,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #ifdef HS_BUILD_FOR_WIN32 -#include "hsWindows.h" + typedef HWND hsWinRef; #else // Whatever diff --git a/Sources/Plasma/PubUtilLib/plPipeline/plCaptureRender.cpp b/Sources/Plasma/PubUtilLib/plPipeline/plCaptureRender.cpp index 5f5abe5a..bd51296d 100644 --- a/Sources/Plasma/PubUtilLib/plPipeline/plCaptureRender.cpp +++ b/Sources/Plasma/PubUtilLib/plPipeline/plCaptureRender.cpp @@ -40,7 +40,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "plCaptureRender.h" #ifndef MF_FRONTBUFF_CAPTURE @@ -128,14 +128,14 @@ void plCaptureRenderRequest::Render(plPipeline* pipe, plPageTreeMgr* pageMgr) hsTArray plCaptureRender::fProcessed; // plCaptureRender::Capture -hsBool plCaptureRender::Capture(const plKey& ack, UInt16 width, UInt16 height) +hsBool plCaptureRender::Capture(const plKey& ack, uint16_t width, uint16_t height) { // Create our render target - const UInt16 flags = plRenderTarget::kIsOffscreen; - const UInt8 bitDepth(32); - const UInt8 zDepth(-1); - const UInt8 stencilDepth(-1); - plRenderTarget* rt = TRACKED_NEW plRenderTarget(flags, width, height, bitDepth, zDepth, stencilDepth); + const uint16_t flags = plRenderTarget::kIsOffscreen; + const uint8_t bitDepth(32); + const uint8_t zDepth(-1); + const uint8_t stencilDepth(-1); + plRenderTarget* rt = new plRenderTarget(flags, width, height, bitDepth, zDepth, stencilDepth); static int idx=0; plString buff = plString::Format("tRT%d", idx++); @@ -143,14 +143,14 @@ hsBool plCaptureRender::Capture(const plKey& ack, UInt16 width, UInt16 height) // Create a render request and render request message - plCaptureRenderRequest* req = TRACKED_NEW plCaptureRenderRequest; + plCaptureRenderRequest* req = new plCaptureRenderRequest; - const hsScalar pri(-100.f); + const float pri(-100.f); req->SetPriority(pri); req->SetRenderTarget(rt); - const UInt32 renderState + const uint32_t renderState = plPipeline::kRenderNormal | plPipeline::kRenderClearColor | plPipeline::kRenderClearDepth; @@ -160,7 +160,7 @@ hsBool plCaptureRender::Capture(const plKey& ack, UInt16 width, UInt16 height) req->RequestAck(ack); // Submit - plRenderRequestMsg* msg = TRACKED_NEW plRenderRequestMsg(ack, req); + plRenderRequestMsg* msg = new plRenderRequestMsg(ack, req); hsRefCnt_SafeUnRef(req); msg->Send(); @@ -186,7 +186,7 @@ hsBool plCaptureRender::IProcess(plPipeline* pipe, const plKey& ack, plRenderTar mipMap->Ref(); // Stash it, and send it off during the update phase. - plCaptureRenderMsg* msg = TRACKED_NEW plCaptureRenderMsg(ack, mipMap); + plCaptureRenderMsg* msg = new plCaptureRenderMsg(ack, mipMap); fProcessed.Append(msg); return true; @@ -213,18 +213,18 @@ void plCaptureRender::Update(plPipeline* pipe) for( i = 0; i < fCapReqs.GetCount(); i++ ) { - plMipmap* mipmap = TRACKED_NEW plMipmap(fCapReqs[i].fWidth, fCapReqs[i].fHeight, plMipmap::kARGB32Config, 1); + plMipmap* mipmap = new plMipmap(fCapReqs[i].fWidth, fCapReqs[i].fHeight, plMipmap::kARGB32Config, 1); pipe->CaptureScreen(mipmap, false, fCapReqs[i].fWidth, fCapReqs[i].fHeight); - plCaptureRenderMsg* msg = TRACKED_NEW plCaptureRenderMsg(fCapReqs[i].fAck, mipmap); + plCaptureRenderMsg* msg = new plCaptureRenderMsg(fCapReqs[i].fAck, mipmap); msg->Send(); } fCapReqs.Reset(); } -hsBool plCaptureRender::Capture(const plKey& ack, UInt16 width, UInt16 height) +hsBool plCaptureRender::Capture(const plKey& ack, uint16_t width, uint16_t height) { CapInfo capInfo; capInfo.fAck = ack; diff --git a/Sources/Plasma/PubUtilLib/plPipeline/plCaptureRender.h b/Sources/Plasma/PubUtilLib/plPipeline/plCaptureRender.h index a1082e7f..0d25608a 100644 --- a/Sources/Plasma/PubUtilLib/plPipeline/plCaptureRender.h +++ b/Sources/Plasma/PubUtilLib/plPipeline/plCaptureRender.h @@ -71,7 +71,7 @@ protected: friend class plClient; public: - static hsBool Capture(const plKey& ack, UInt16 width=800, UInt16 height=600); + static hsBool Capture(const plKey& ack, uint16_t width=800, uint16_t height=600); }; @@ -89,8 +89,8 @@ protected: { public: plKey fAck; - UInt16 fWidth; - UInt16 fHeight; + uint16_t fWidth; + uint16_t fHeight; }; static hsTArray fCapReqs; @@ -100,7 +100,7 @@ protected: friend class plClient; public: - static hsBool Capture(const plKey& ack, UInt16 width=800, UInt16 height=600); + static hsBool Capture(const plKey& ack, uint16_t width=800, uint16_t height=600); }; diff --git a/Sources/Plasma/PubUtilLib/plPipeline/plCubicRenderTarget.h b/Sources/Plasma/PubUtilLib/plPipeline/plCubicRenderTarget.h index 731f37f9..168febbc 100644 --- a/Sources/Plasma/PubUtilLib/plPipeline/plCubicRenderTarget.h +++ b/Sources/Plasma/PubUtilLib/plPipeline/plCubicRenderTarget.h @@ -95,7 +95,7 @@ class plCubicRenderTarget : public plRenderTarget fFaces[0] = fFaces[1] = fFaces[2] = fFaces[3] = fFaces[4] = fFaces[5] = nil; } - plCubicRenderTarget( UInt16 flags, UInt16 width, UInt16 height, UInt8 bitDepth, UInt8 zDepth = -1, UInt8 sDepth = -1 ) + plCubicRenderTarget( uint16_t flags, uint16_t width, uint16_t height, uint8_t bitDepth, uint8_t zDepth = -1, uint8_t sDepth = -1 ) : plRenderTarget( flags, width, height, bitDepth, zDepth, sDepth ) { int i; @@ -103,7 +103,7 @@ class plCubicRenderTarget : public plRenderTarget for( i = 0; i < 6; i++ ) { - fFaces[i] = TRACKED_NEW plRenderTarget( flags, width, height, bitDepth, zDepth, sDepth ); + fFaces[i] = new plRenderTarget( flags, width, height, bitDepth, zDepth, sDepth ); fFaces[i]->fParent = this; fWorldToCameras[i].Reset(); fCameraToWorlds[i].Reset(); @@ -120,16 +120,16 @@ class plCubicRenderTarget : public plRenderTarget } // Get the total size in bytes - virtual UInt32 GetTotalSize( void ) const; + virtual uint32_t GetTotalSize( void ) const; virtual void SetCameraMatrix(const hsPoint3& pos); - virtual const hsMatrix44& GetWorldToCamera(UInt8 face) const { return fWorldToCameras[face]; } - virtual const hsMatrix44& GetCameraToWorld(UInt8 face) const { return fCameraToWorlds[face]; } + virtual const hsMatrix44& GetWorldToCamera(uint8_t face) const { return fWorldToCameras[face]; } + virtual const hsMatrix44& GetCameraToWorld(uint8_t face) const { return fCameraToWorlds[face]; } - plRenderTarget *GetFace(UInt8 face) const { return fFaces[face]; } + plRenderTarget *GetFace(uint8_t face) const { return fFaces[face]; } - virtual UInt32 Read(hsStream *s); - virtual UInt32 Write(hsStream *s); + virtual uint32_t Read(hsStream *s); + virtual uint32_t Write(hsStream *s); }; diff --git a/Sources/Plasma/PubUtilLib/plPipeline/plCubicRenderTargetModifier.cpp b/Sources/Plasma/PubUtilLib/plPipeline/plCubicRenderTargetModifier.cpp index ef2ee736..3e192a5d 100644 --- a/Sources/Plasma/PubUtilLib/plPipeline/plCubicRenderTargetModifier.cpp +++ b/Sources/Plasma/PubUtilLib/plPipeline/plCubicRenderTargetModifier.cpp @@ -50,7 +50,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // // /////////////////////////////////////////////////////////////////////////////// -#include "hsTypes.h" +#include "HeadSpin.h" #include "plCubicRenderTargetModifier.h" #include "plCubicRenderTarget.h" #include "plgDispatch.h" @@ -97,9 +97,9 @@ void plCubicRenderTargetModifier::ICreateRenderRequest( int face ) if( rr == nil ) - rr = fRequests[ face ] = TRACKED_NEW plRenderRequest; + rr = fRequests[ face ] = new plRenderRequest; - UInt32 renderState + uint32_t renderState = plPipeline::kRenderNormal | plPipeline::kRenderClearColor | plPipeline::kRenderClearDepth; @@ -124,7 +124,7 @@ void plCubicRenderTargetModifier::ICreateRenderRequest( int face ) //// IEval //////////////////////////////////////////////////////////////////// -hsBool plCubicRenderTargetModifier::IEval( double secs, hsScalar del, UInt32 dirty ) +hsBool plCubicRenderTargetModifier::IEval( double secs, float del, uint32_t dirty ) { hsPoint3 center; hsMatrix44 mtx, invMtx; @@ -156,7 +156,7 @@ hsBool plCubicRenderTargetModifier::IEval( double secs, hsScalar del, UInt32 di { fRequests[ i ]->SetCameraTransform(fCubic->GetWorldToCamera(i), fCubic->GetCameraToWorld(i)); - msg = TRACKED_NEW plRenderRequestMsg( nil, fRequests[ i ] ); + msg = new plRenderRequestMsg( nil, fRequests[ i ] ); plgDispatch::MsgSend( msg ); } } @@ -178,7 +178,7 @@ hsBool plCubicRenderTargetModifier::MsgReceive( plMessage* msg ) if( eval ) { const double secs = eval->DSeconds(); - const hsScalar del = eval->DelSeconds(); + const float del = eval->DelSeconds(); IEval( secs, del, 0 ); return true; } @@ -241,10 +241,10 @@ void plCubicRenderTargetModifier::Read( hsStream *s, hsResMgr *mgr ) hsKeyedObject::Read( s, mgr ); plGenRefMsg* msg; - msg = TRACKED_NEW plGenRefMsg( GetKey(), plRefMsg::kOnCreate, 0, 0 ); // SceneObject + msg = new plGenRefMsg( GetKey(), plRefMsg::kOnCreate, 0, 0 ); // SceneObject mgr->ReadKeyNotifyMe( s, msg, plRefFlags::kActiveRef ); - msg = TRACKED_NEW plGenRefMsg( GetKey(), plRefMsg::kOnCreate, 0, 0 ); // cubicRT + msg = new plGenRefMsg( GetKey(), plRefMsg::kOnCreate, 0, 0 ); // cubicRT mgr->ReadKeyNotifyMe( s, msg, plRefFlags::kActiveRef ); } diff --git a/Sources/Plasma/PubUtilLib/plPipeline/plCubicRenderTargetModifier.h b/Sources/Plasma/PubUtilLib/plPipeline/plCubicRenderTargetModifier.h index 733c6cba..0c0ee15f 100644 --- a/Sources/Plasma/PubUtilLib/plPipeline/plCubicRenderTargetModifier.h +++ b/Sources/Plasma/PubUtilLib/plPipeline/plCubicRenderTargetModifier.h @@ -93,7 +93,7 @@ protected: plRenderRequest *fRequests[ 6 ]; - virtual hsBool IEval( double secs, hsScalar del, UInt32 dirty ); // required by plModifier + virtual hsBool IEval( double secs, float del, uint32_t dirty ); // required by plModifier void ICreateRenderRequest( int face ); diff --git a/Sources/Plasma/PubUtilLib/plPipeline/plCullTree.cpp b/Sources/Plasma/PubUtilLib/plPipeline/plCullTree.cpp index 1ec48ea3..fab2cd13 100644 --- a/Sources/Plasma/PubUtilLib/plPipeline/plCullTree.cpp +++ b/Sources/Plasma/PubUtilLib/plPipeline/plCullTree.cpp @@ -40,7 +40,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "plCullTree.h" #include "plDrawable/plSpaceTree.h" #include "hsFastMath.h" @@ -52,7 +52,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #define MF_DEBUG_NORM #ifdef MF_DEBUG_NORM -#define IDEBUG_NORMALIZE( a, b ) { hsScalar len = hsFastMath::InvSqrtAppr((a).MagnitudeSquared()); a *= len; b *= len; } +#define IDEBUG_NORMALIZE( a, b ) { float len = hsFastMath::InvSqrtAppr((a).MagnitudeSquared()); a *= len; b *= len; } #else // MF_DEBUG_NORM #define IDEBUG_NORMALIZE( a, b ) @@ -60,10 +60,10 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com //#define CULL_SMALL_TOLERANCE #ifdef CULL_SMALL_TOLERANCE -//static const hsScalar kTolerance = 1.e-5f; -static const hsScalar kTolerance = 1.e-3f; +//static const float kTolerance = 1.e-5f; +static const float kTolerance = 1.e-3f; #else //CULL_SMALL_TOLERANCE -static const hsScalar kTolerance = 1.e-1f; +static const float kTolerance = 1.e-1f; #endif // CULL_SMALL_TOLERANCE plProfile_CreateCounter("Harvest Nodes", "Draw", HarvestNodes); @@ -128,8 +128,8 @@ plCullNode::plCullStatus plCullNode::TestBounds(const hsBounds3Ext& bnd) const // side timings to be sure. Still looking for some reasonably constructed real data sets. mf #define MF_TEST_SPHERE_FIRST #ifdef MF_TEST_SPHERE_FIRST - hsScalar dist = fNorm.InnerProduct(bnd.GetCenter()) + fDist; - hsScalar rad = bnd.GetRadius(); + float dist = fNorm.InnerProduct(bnd.GetCenter()) + fDist; + float rad = bnd.GetRadius(); if( dist < -rad ) return kCulled; if( dist > rad ) @@ -139,7 +139,7 @@ plCullNode::plCullStatus plCullNode::TestBounds(const hsBounds3Ext& bnd) const hsPoint2 depth; bnd.TestPlane(fNorm, depth); - const hsScalar kSafetyDist = -0.1f; + const float kSafetyDist = -0.1f; if( depth.fY + fDist < kSafetyDist ) return kCulled; @@ -149,7 +149,7 @@ plCullNode::plCullStatus plCullNode::TestBounds(const hsBounds3Ext& bnd) const return kSplit; } -plCullNode::plCullStatus plCullNode::ITestSphereRecur(const hsPoint3& center, hsScalar rad) const +plCullNode::plCullStatus plCullNode::ITestSphereRecur(const hsPoint3& center, float rad) const { plCullNode::plCullStatus retVal = TestSphere(center, rad); @@ -198,9 +198,9 @@ plCullNode::plCullStatus plCullNode::ITestSphereRecur(const hsPoint3& center, hs return kCulled; } -plCullNode::plCullStatus plCullNode::TestSphere(const hsPoint3& center, hsScalar rad) const +plCullNode::plCullStatus plCullNode::TestSphere(const hsPoint3& center, float rad) const { - hsScalar dist = fNorm.InnerProduct(center) + fDist; + float dist = fNorm.InnerProduct(center) + fDist; if( dist < -rad ) return kCulled; if( dist > rad ) @@ -210,7 +210,7 @@ plCullNode::plCullStatus plCullNode::TestSphere(const hsPoint3& center, hsScalar } // For this Cull Node, recur down the space hierarchy pruning out who to test for the next Cull Node. -plCullNode::plCullStatus plCullNode::ITestNode(const plSpaceTree* space, Int16 who, hsLargeArray& clear, hsLargeArray& split, hsLargeArray& culled) const +plCullNode::plCullStatus plCullNode::ITestNode(const plSpaceTree* space, int16_t who, hsLargeArray& clear, hsLargeArray& split, hsLargeArray& culled) const { if( space->IsDisabled(who) || (space->GetNode(who).fWorldBounds.GetType() != kBoundsNormal) ) { @@ -263,21 +263,21 @@ plCullNode::plCullStatus plCullNode::ITestNode(const plSpaceTree* space, Int16 w // We reclaim the scratch indices in clear and split when we're done (SetCount(0)), but we can't // reclaim the culled, because our caller may be looking at who all we culled. See below in split. // If a node is disabled, we can just ignore we ever got called. -void plCullNode::ITestNode(const plSpaceTree* space, Int16 who, hsBitVector& totList, hsBitVector& outList) const +void plCullNode::ITestNode(const plSpaceTree* space, int16_t who, hsBitVector& totList, hsBitVector& outList) const { if( space->IsDisabled(who) ) return; - UInt32 myClearStart = ScratchClear().GetCount(); - UInt32 mySplitStart = ScratchSplit().GetCount(); - UInt32 myCullStart = ScratchCulled().GetCount(); + uint32_t myClearStart = ScratchClear().GetCount(); + uint32_t mySplitStart = ScratchSplit().GetCount(); + uint32_t myCullStart = ScratchCulled().GetCount(); if( kPureSplit == ITestNode(space, who, ScratchClear(), ScratchSplit(), ScratchCulled()) ) ScratchSplit().Append(who); - UInt32 myClearEnd = ScratchClear().GetCount(); - UInt32 mySplitEnd = ScratchSplit().GetCount(); - UInt32 myCullEnd = ScratchCulled().GetCount(); + uint32_t myClearEnd = ScratchClear().GetCount(); + uint32_t mySplitEnd = ScratchSplit().GetCount(); + uint32_t myCullEnd = ScratchCulled().GetCount(); int i; // If there's no OuterChild, everything in clear and split is visible. Everything in culled @@ -368,7 +368,7 @@ void plCullNode::ITestNode(const plSpaceTree* space, Int16 who, hsBitVector& tot ScratchCulled().SetCount(myCullStart); } -void plCullNode::IHarvest(const plSpaceTree* space, hsTArray& outList) const +void plCullNode::IHarvest(const plSpaceTree* space, hsTArray& outList) const { ITestNode(space, space->GetRoot(), ScratchTotVec(), ScratchBitVec()); space->BitVectorToList(outList, ScratchBitVec()); @@ -384,7 +384,7 @@ void plCullNode::IHarvest(const plSpaceTree* space, hsTArray& outList) co // This section builds the tree from the input cullpoly's ////////////////////////////////////////////////////////////////////// -void plCullNode::IBreakPoly(const plCullPoly& poly, const hsTArray& depths, +void plCullNode::IBreakPoly(const plCullPoly& poly, const hsTArray& depths, hsBitVector& inVerts, hsBitVector& outVerts, hsBitVector& onVerts, @@ -415,7 +415,7 @@ void plCullNode::IBreakPoly(const plCullPoly& poly, const hsTArray& de if( outVerts.IsBitSet(outPoly.fVerts.GetCount()-1) ) { hsPoint3 interp; - hsScalar t = IInterpVert(poly.fVerts[i-1], poly.fVerts[i], interp); + float t = IInterpVert(poly.fVerts[i-1], poly.fVerts[i], interp); // add interp onVerts.SetBit(outPoly.fVerts.GetCount()); if( poly.fClipped.IsBitSet(i-1) ) @@ -429,7 +429,7 @@ void plCullNode::IBreakPoly(const plCullPoly& poly, const hsTArray& de if( inVerts.IsBitSet(outPoly.fVerts.GetCount()-1) ) { hsPoint3 interp; - hsScalar t = IInterpVert(poly.fVerts[i-1], poly.fVerts[i], interp); + float t = IInterpVert(poly.fVerts[i-1], poly.fVerts[i], interp); // add interp onVerts.SetBit(outPoly.fVerts.GetCount()); if( poly.fClipped.IsBitSet(i-1) ) @@ -451,7 +451,7 @@ void plCullNode::IBreakPoly(const plCullPoly& poly, const hsTArray& de ||(outVerts.IsBitSet(outPoly.fVerts.GetCount()-1) && inVerts.IsBitSet(0)) ) { hsPoint3 interp; - hsScalar t = IInterpVert(poly.fVerts[poly.fVerts.GetCount()-1], poly.fVerts[0], interp); + float t = IInterpVert(poly.fVerts[poly.fVerts.GetCount()-1], poly.fVerts[0], interp); onVerts.SetBit(outPoly.fVerts.GetCount()); if( poly.fClipped.IsBitSet(poly.fVerts.GetCount()-1) ) outPoly.fClipped.SetBit(outPoly.fVerts.GetCount()); @@ -477,7 +477,7 @@ void plCullNode::ITakeHalfPoly(const plCullPoly& srcPoly, if( onVerts.IsBitSet(vtxIdx[i]) && onVerts.IsBitSet(vtxIdx[last]) && onVerts.IsBitSet(vtxIdx[next]) ) { #if 0 // FISH - hsScalar dot = hsVector3(&srcPoly.fVerts[vtxIdx[last]], &srcPoly.fVerts[vtxIdx[i]]).InnerProduct(hsVector3(&srcPoly.fVerts[vtxIdx[next]], &srcPoly.fVerts[vtxIdx[i]])); + float dot = hsVector3(&srcPoly.fVerts[vtxIdx[last]], &srcPoly.fVerts[vtxIdx[i]]).InnerProduct(hsVector3(&srcPoly.fVerts[vtxIdx[next]], &srcPoly.fVerts[vtxIdx[i]])); if( dot <= 0 ) #endif // FISH continue; @@ -512,7 +512,7 @@ plCullNode::plCullStatus plCullNode::ISplitPoly(const plCullPoly& poly, plCullPoly*& innerPoly, plCullPoly*& outerPoly) const { - static hsTArray depths; + static hsTArray depths; depths.SetCount(poly.fVerts.GetCount()); static hsBitVector onVerts; @@ -597,12 +597,12 @@ plCullNode::plCullStatus plCullNode::ISplitPoly(const plCullPoly& poly, return kSplit; } -hsScalar plCullNode::IInterpVert(const hsPoint3& p0, const hsPoint3& p1, hsPoint3& out) const +float plCullNode::IInterpVert(const hsPoint3& p0, const hsPoint3& p1, hsPoint3& out) const { hsVector3 oneToOh; oneToOh.Set(&p0, &p1); - hsScalar t = -(fNorm.InnerProduct(p1) + fDist) / fNorm.InnerProduct(oneToOh); + float t = -(fNorm.InnerProduct(p1) + fDist) / fNorm.InnerProduct(oneToOh); if( t >= 1.f ) { out = p0; @@ -658,8 +658,8 @@ void plCullTree::AddPoly(const plCullPoly& poly) hsVector3 cenToEye(&fViewPos, &poly.fCenter); hsFastMath::NormalizeAppr(cenToEye); - hsScalar camDist = cenToEye.InnerProduct(poly.fNorm); - plConst(hsScalar) kTol(0.1f); + float camDist = cenToEye.InnerProduct(poly.fNorm); + plConst(float) kTol(0.1f); hsBool backFace = camDist < -kTol; if( !backFace && (camDist < kTol) ) return; @@ -709,7 +709,7 @@ void plCullTree::AddPoly(const plCullPoly& poly) #endif // DEBUG_POINTERS } -Int16 plCullTree::IAddPolyRecur(const plCullPoly& poly, Int16 iNode) +int16_t plCullTree::IAddPolyRecur(const plCullPoly& poly, int16_t iNode) { if( poly.fVerts.GetCount() < 3 ) return iNode; @@ -759,16 +759,16 @@ Int16 plCullTree::IAddPolyRecur(const plCullPoly& poly, Int16 iNode) return iNode; } -Int16 plCullTree::IMakePolyNode(const plCullPoly& poly, int i0, int i1) const +int16_t plCullTree::IMakePolyNode(const plCullPoly& poly, int i0, int i1) const { - Int16 retINode = fNodeList.GetCount(); + int16_t retINode = fNodeList.GetCount(); plCullNode* nextNode = fNodeList.Push(); hsVector3 a; hsVector3 b; a.Set(&poly.fVerts[i0], &fViewPos); b.Set(&poly.fVerts[i1], &fViewPos); hsVector3 n = a % b; - hsScalar d = -n.InnerProduct(fViewPos); + float d = -n.InnerProduct(fViewPos); IDEBUG_NORMALIZE(n, d); @@ -777,21 +777,21 @@ Int16 plCullTree::IMakePolyNode(const plCullPoly& poly, int i0, int i1) const return retINode; } -Int16 plCullTree::IMakeHoleSubTree(const plCullPoly& poly) const +int16_t plCullTree::IMakeHoleSubTree(const plCullPoly& poly) const { if( fCapturePolys ) IVisPoly(poly, true); int firstNode = fNodeList.GetCount(); - Int16 iNode = -1; + int16_t iNode = -1; int i; for( i = 0; i < poly.fVerts.GetCount()-1; i++ ) { if( !poly.fClipped.IsBitSet(i) ) { - Int16 child = IMakePolyNode(poly, i, i+1); + int16_t child = IMakePolyNode(poly, i, i+1); if( iNode >= 0 ) IGetNode(iNode)->fOuterChild = child; iNode = child; @@ -799,7 +799,7 @@ Int16 plCullTree::IMakeHoleSubTree(const plCullPoly& poly) const } if( !poly.fClipped.IsBitSet(i) ) { - Int16 child = IMakePolyNode(poly, i, 0); + int16_t child = IMakePolyNode(poly, i, 0); if( iNode >= 0 ) IGetNode(iNode)->fOuterChild = child; iNode = child; @@ -813,7 +813,7 @@ Int16 plCullTree::IMakeHoleSubTree(const plCullPoly& poly) const return firstNode; } -Int16 plCullTree::IMakePolySubTree(const plCullPoly& poly) const +int16_t plCullTree::IMakePolySubTree(const plCullPoly& poly) const { poly.Validate(); @@ -825,14 +825,14 @@ Int16 plCullTree::IMakePolySubTree(const plCullPoly& poly) const int firstNode = fNodeList.GetCount(); - Int16 iNode = -1; + int16_t iNode = -1; int i; for( i = 0; i < poly.fVerts.GetCount()-1; i++ ) { if( !poly.fClipped.IsBitSet(i) ) { - Int16 child = IMakePolyNode(poly, i, i+1); + int16_t child = IMakePolyNode(poly, i, i+1); if( iNode >= 0 ) IGetNode(iNode)->fInnerChild = child; iNode = child; @@ -840,7 +840,7 @@ Int16 plCullTree::IMakePolySubTree(const plCullPoly& poly) const } if( !poly.fClipped.IsBitSet(i) ) { - Int16 child = IMakePolyNode(poly, i, 0); + int16_t child = IMakePolyNode(poly, i, 0); if( iNode >= 0 ) IGetNode(iNode)->fInnerChild = child; iNode = child; @@ -971,7 +971,7 @@ void plCullTree::ReleaseCapture() const // End visualization section of the program /////////////////////////////////////////////////////////////////// -void plCullTree::ISetupScratch(UInt16 nNodes) +void plCullTree::ISetupScratch(uint16_t nNodes) { ScratchPolys().SetCount(nNodes << 1); ScratchPolys().SetCount(0); @@ -996,11 +996,11 @@ void plCullTree::InitFrustum(const hsMatrix44& world2NDC) fNodeList.SetCount(6); fNodeList.SetCount(0); - Int16 lastIdx = -1; + int16_t lastIdx = -1; plCullNode* node; hsVector3 norm; - hsScalar dist; + float dist; int i; for( i = 0; i < 2; i++ ) @@ -1067,7 +1067,7 @@ void plCullTree::SetViewPos(const hsPoint3& p) ////////////////////////////////////////////////////////////////////// // Use the tree ////////////////////////////////////////////////////////////////////// -void plCullTree::Harvest(const plSpaceTree* space, hsTArray& outList) const +void plCullTree::Harvest(const plSpaceTree* space, hsTArray& outList) const { outList.SetCount(0); if (!space->IsEmpty()) @@ -1080,7 +1080,7 @@ hsBool plCullTree::BoundsVisible(const hsBounds3Ext& bnd) const return plCullNode::kCulled != IGetRoot()->ITestBoundsRecur(bnd); } -hsBool plCullTree::SphereVisible(const hsPoint3& center, hsScalar rad) const +hsBool plCullTree::SphereVisible(const hsPoint3& center, float rad) const { return plCullNode::kCulled != IGetRoot()->ITestSphereRecur(center, rad); } diff --git a/Sources/Plasma/PubUtilLib/plPipeline/plCullTree.h b/Sources/Plasma/PubUtilLib/plPipeline/plCullTree.h index 82be591c..ad3fc42b 100644 --- a/Sources/Plasma/PubUtilLib/plPipeline/plCullTree.h +++ b/Sources/Plasma/PubUtilLib/plPipeline/plCullTree.h @@ -70,13 +70,13 @@ protected: mutable hsTArray fVisVerts; mutable hsTArray fVisNorms; mutable hsTArray fVisColors; - mutable hsTArray fVisTris; - mutable hsScalar fVisYon; + mutable hsTArray fVisTris; + mutable float fVisYon; mutable hsTArray fScratchPolys; - mutable hsLargeArray fScratchClear; - mutable hsLargeArray fScratchSplit; - mutable hsLargeArray fScratchCulled; + mutable hsLargeArray fScratchClear; + mutable hsLargeArray fScratchSplit; + mutable hsLargeArray fScratchCulled; mutable hsBitVector fScratchBitVec; mutable hsBitVector fScratchTotVec; @@ -87,28 +87,28 @@ protected: hsPoint3 fViewPos; - Int16 fRoot; + int16_t fRoot; mutable hsTArray fNodeList; // Scratch list we make the tree from. plCullNode* IGetRoot() const { return IGetNode(fRoot); } - plCullNode* IGetNode(Int16 i) const { return i >= 0 ? &fNodeList[i] : nil; } + plCullNode* IGetNode(int16_t i) const { return i >= 0 ? &fNodeList[i] : nil; } - void ITestNode(const plSpaceTree* space, Int16 who, hsTArray& outList) const; // Appends to outlist - void ITestList(const plSpaceTree* space, const hsTArray& inList, hsTArray& outList) const; + void ITestNode(const plSpaceTree* space, int16_t who, hsTArray& outList) const; // Appends to outlist + void ITestList(const plSpaceTree* space, const hsTArray& inList, hsTArray& outList) const; - Int16 IAddPolyRecur(const plCullPoly& poly, Int16 iNode); - Int16 IMakeHoleSubTree(const plCullPoly& poly) const; - Int16 IMakePolySubTree(const plCullPoly& poly) const; - Int16 IMakePolyNode(const plCullPoly& poly, int i0, int i1) const; + int16_t IAddPolyRecur(const plCullPoly& poly, int16_t iNode); + int16_t IMakeHoleSubTree(const plCullPoly& poly) const; + int16_t IMakePolySubTree(const plCullPoly& poly) const; + int16_t IMakePolyNode(const plCullPoly& poly, int i0, int i1) const; // Some scratch areas for the nodes use when building the tree etc. hsTArray& ScratchPolys() const { return fScratchPolys; } - hsLargeArray& ScratchClear() const { return fScratchClear; } - hsLargeArray& ScratchSplit() const { return fScratchSplit; } - hsLargeArray& ScratchCulled() const { return fScratchCulled; } + hsLargeArray& ScratchClear() const { return fScratchClear; } + hsLargeArray& ScratchSplit() const { return fScratchSplit; } + hsLargeArray& ScratchCulled() const { return fScratchCulled; } hsBitVector& ScratchBitVec() const { return fScratchBitVec; } hsBitVector& ScratchTotVec() const { return fScratchTotVec; } - void ISetupScratch(UInt16 nNodes); + void ISetupScratch(uint16_t nNodes); friend class plCullNode; @@ -121,20 +121,20 @@ public: void SetViewPos(const hsPoint3& pos); void AddPoly(const plCullPoly& poly); - UInt32 GetNumNodes() const { return fNodeList.GetCount(); } + uint32_t GetNumNodes() const { return fNodeList.GetCount(); } - virtual void Harvest(const plSpaceTree* space, hsTArray& outList) const; + virtual void Harvest(const plSpaceTree* space, hsTArray& outList) const; virtual hsBool BoundsVisible(const hsBounds3Ext& bnd) const; - virtual hsBool SphereVisible(const hsPoint3& center, hsScalar rad) const; + virtual hsBool SphereVisible(const hsPoint3& center, float rad) const; // Visualization stuff. Only to be called by the pipeline (or some other vis manager). - void SetVisualizationYon(hsScalar y) const { fVisYon = y; } + void SetVisualizationYon(float y) const { fVisYon = y; } void BeginCapturePolys() const { fCapturePolys = true; } void EndCapturePolys() const { fCapturePolys = false; } hsTArray& GetCaptureVerts() const { return fVisVerts; } hsTArray& GetCaptureNorms() const { return fVisNorms; } hsTArray& GetCaptureColors() const { return fVisColors; } - hsTArray& GetCaptureTris() const { return fVisTris; } + hsTArray& GetCaptureTris() const { return fVisTris; } void ReleaseCapture() const; }; @@ -150,16 +150,16 @@ enum plCullStatus }; protected: hsVector3 fNorm; - hsScalar fDist; + float fDist; hsBool fIsFace; - Int16 fInnerChild; - Int16 fOuterChild; + int16_t fInnerChild; + int16_t fOuterChild; const plCullTree* fTree; - plCullNode* IGetNode(Int16 i) const; + plCullNode* IGetNode(int16_t i) const; #ifdef DEBUG_POINTERS mutable plCullNode* fInnerPtr; @@ -172,50 +172,50 @@ protected: // Bounds only version plCullNode::plCullStatus ITestBoundsRecur(const hsBounds3Ext& bnd) const; - plCullNode::plCullStatus ITestSphereRecur(const hsPoint3& center, hsScalar rad) const; + plCullNode::plCullStatus ITestSphereRecur(const hsPoint3& center, float rad) const; // Using the nodes - plCullNode::plCullStatus ITestNode(const plSpaceTree* space, Int16 who, hsLargeArray& clear, hsLargeArray& split, hsLargeArray& culled) const; - void ITestNode(const plSpaceTree* space, Int16 who, hsBitVector& totList, hsBitVector& outList) const; - void IHarvest(const plSpaceTree* space, hsTArray& outList) const; + plCullNode::plCullStatus ITestNode(const plSpaceTree* space, int16_t who, hsLargeArray& clear, hsLargeArray& split, hsLargeArray& culled) const; + void ITestNode(const plSpaceTree* space, int16_t who, hsBitVector& totList, hsBitVector& outList) const; + void IHarvest(const plSpaceTree* space, hsTArray& outList) const; // Constructing the tree - hsScalar IInterpVert(const hsPoint3& p0, const hsPoint3& p1, hsPoint3& out) const; + float IInterpVert(const hsPoint3& p0, const hsPoint3& p1, hsPoint3& out) const; plCullNode::plCullStatus ISplitPoly(const plCullPoly& poly, plCullPoly*& innerPoly, plCullPoly*& outerPoly) const; void IMarkClipped(const plCullPoly& poly, const hsBitVector& onVerts) const; void ITakeHalfPoly(const plCullPoly& scrPoly, const hsTArray& vtxIdx, const hsBitVector& onVerts, plCullPoly& outPoly) const; - void IBreakPoly(const plCullPoly& poly, const hsTArray& depths, + void IBreakPoly(const plCullPoly& poly, const hsTArray& depths, hsBitVector& inVerts, hsBitVector& outVerts, hsBitVector& onVerts, plCullPoly& srcPoly) const; hsTArray& ScratchPolys() const { return fTree->ScratchPolys(); } - hsLargeArray& ScratchClear() const { return fTree->ScratchClear(); } - hsLargeArray& ScratchSplit() const { return fTree->ScratchSplit(); } - hsLargeArray& ScratchCulled() const { return fTree->ScratchCulled(); } + hsLargeArray& ScratchClear() const { return fTree->ScratchClear(); } + hsLargeArray& ScratchSplit() const { return fTree->ScratchSplit(); } + hsLargeArray& ScratchCulled() const { return fTree->ScratchCulled(); } hsBitVector& ScratchBitVec() const { return fTree->ScratchBitVec(); } hsBitVector& ScratchTotVec() const { return fTree->ScratchTotVec(); } friend class plCullTree; public: - void Init(const plCullTree* t, const hsVector3& n, hsScalar d) { fIsFace = false; fTree = t; fInnerChild = fOuterChild = -1; SetPlane(n, d); } + void Init(const plCullTree* t, const hsVector3& n, float d) { fIsFace = false; fTree = t; fInnerChild = fOuterChild = -1; SetPlane(n, d); } void Init(const plCullTree* t, const plCullPoly& poly) { Init(t, poly.fNorm, poly.fDist); } - void SetPlane(const hsVector3& n, hsScalar d) { fNorm = n; fDist = d; } + void SetPlane(const hsVector3& n, float d) { fNorm = n; fDist = d; } const hsVector3& GetNormal() const { return fNorm; } - const hsScalar GetDist() const { return fDist; } + const float GetDist() const { return fDist; } plCullStatus TestBounds(const hsBounds3Ext& bnd) const; - plCullStatus TestSphere(const hsPoint3& center, hsScalar rad) const; + plCullStatus TestSphere(const hsPoint3& center, float rad) const; }; -inline plCullNode* plCullNode::IGetNode(Int16 i) const +inline plCullNode* plCullNode::IGetNode(int16_t i) const { return fTree->IGetNode(i); } diff --git a/Sources/Plasma/PubUtilLib/plPipeline/plCuller.h b/Sources/Plasma/PubUtilLib/plPipeline/plCuller.h index 648524af..9c154d1e 100644 --- a/Sources/Plasma/PubUtilLib/plPipeline/plCuller.h +++ b/Sources/Plasma/PubUtilLib/plPipeline/plCuller.h @@ -54,7 +54,7 @@ public: plCuller() {} ~plCuller() {} - virtual void Harvest(const plSpaceTree* space, hsTArray& outList) const = 0; + virtual void Harvest(const plSpaceTree* space, hsTArray& outList) const = 0; }; #endif // plCuller_inc diff --git a/Sources/Plasma/PubUtilLib/plPipeline/plDTProgressMgr.cpp b/Sources/Plasma/PubUtilLib/plPipeline/plDTProgressMgr.cpp index 95d80310..373ad31d 100644 --- a/Sources/Plasma/PubUtilLib/plPipeline/plDTProgressMgr.cpp +++ b/Sources/Plasma/PubUtilLib/plPipeline/plDTProgressMgr.cpp @@ -50,7 +50,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com ////////////////////////////////////////////////////////////////////////////// #include -#include "hsTypes.h" +#include "HeadSpin.h" #include "plDTProgressMgr.h" #include "plPipeline.h" #include "plDebugText.h" @@ -124,7 +124,7 @@ void plDTProgressMgr::Deactivate() void plDTProgressMgr::Draw( plPipeline *p ) { - UInt16 scrnWidth, scrnHeight, width, height, x, y; + uint16_t scrnWidth, scrnHeight, width, height, x, y; plDebugText &text = plDebugText::Instance(); plOperationProgress *prog; @@ -133,8 +133,8 @@ void plDTProgressMgr::Draw( plPipeline *p ) if( fOperations == nil ) return; - scrnWidth = (UInt16)p->Width(); - scrnHeight = (UInt16)p->Height(); + scrnWidth = (uint16_t)p->Width(); + scrnHeight = (uint16_t)p->Height(); width = scrnWidth - 64; height = 16; @@ -177,12 +177,12 @@ void plDTProgressMgr::Draw( plPipeline *p ) //// IDrawTheStupidThing ///////////////////////////////////////////////////// void plDTProgressMgr::IDrawTheStupidThing( plPipeline *p, plOperationProgress *prog, - UInt16 x, UInt16 y, UInt16 width, UInt16 height ) + uint16_t x, uint16_t y, uint16_t width, uint16_t height ) { plDebugText &text = plDebugText::Instance(); // Lets just set the color to blue - UInt32 color = 0xff302b3a; + uint32_t color = 0xff302b3a; if( prog->GetMax() > 0.f ) { @@ -193,12 +193,12 @@ void plDTProgressMgr::IDrawTheStupidThing( plPipeline *p, plOperationProgress width -= 4; height -= 4; - UInt16 drawWidth = width; - Int16 drawX = x; - UInt16 rightX = drawX + drawWidth; + uint16_t drawWidth = width; + int16_t drawX = x; + uint16_t rightX = drawX + drawWidth; if (prog->GetProgress() <= prog->GetMax()) - drawWidth = (UInt16)( (hsScalar)width * prog->GetProgress() / prog->GetMax() ); + drawWidth = (uint16_t)( (float)width * prog->GetProgress() / prog->GetMax() ); rightX = drawX + drawWidth; @@ -223,7 +223,7 @@ void plDTProgressMgr::IDrawTheStupidThing( plPipeline *p, plOperationProgress const char* unitTerm = (timeRemain == 1) ? "SECOND" : "SECONDS"; sprintf(remainStr, "%s%d %s REMAINING", remainStr, timeRemain, unitTerm); - text.DrawString(x, y + height + 2, remainStr, (UInt32)0xff635e6d ); + text.DrawString(x, y + height + 2, remainStr, (uint32_t)0xff635e6d ); x -= 2; y -= 2; @@ -241,12 +241,12 @@ void plDTProgressMgr::IDrawTheStupidThing( plPipeline *p, plOperationProgress { if( prog->GetTitle()[ 0 ] != 0 ) { - text.DrawString( x, y, prog->GetTitle(), (UInt32)0xccb0b0b0 ); - x += (UInt16)text.CalcStringWidth( prog->GetTitle() ); + text.DrawString( x, y, prog->GetTitle(), (uint32_t)0xccb0b0b0 ); + x += (uint16_t)text.CalcStringWidth( prog->GetTitle() ); } if( prog->GetStatusText()[ 0 ] != 0 ) - text.DrawString( x, y, prog->GetStatusText(), (UInt32)0xccb0b0b0 ); + text.DrawString( x, y, prog->GetStatusText(), (uint32_t)0xccb0b0b0 ); } } diff --git a/Sources/Plasma/PubUtilLib/plPipeline/plDTProgressMgr.h b/Sources/Plasma/PubUtilLib/plPipeline/plDTProgressMgr.h index 94a8d56c..9c548380 100644 --- a/Sources/Plasma/PubUtilLib/plPipeline/plDTProgressMgr.h +++ b/Sources/Plasma/PubUtilLib/plPipeline/plDTProgressMgr.h @@ -61,7 +61,7 @@ class plPipeline; class plDTProgressMgr : public plProgressMgr { protected: - Int32 fCurrentImage; + int32_t fCurrentImage; float fLastDraw; plPlate* fActivePlate; plPlate* fStaticTextPlate; @@ -71,7 +71,7 @@ class plDTProgressMgr : public plProgressMgr void Deactivate(); void IDrawTheStupidThing( plPipeline *p, plOperationProgress *prog, - UInt16 x, UInt16 y, UInt16 width, UInt16 height ); + uint16_t x, uint16_t y, uint16_t width, uint16_t height ); public: diff --git a/Sources/Plasma/PubUtilLib/plPipeline/plDXBufferRefs.h b/Sources/Plasma/PubUtilLib/plPipeline/plDXBufferRefs.h index 8c347edc..290bc733 100644 --- a/Sources/Plasma/PubUtilLib/plPipeline/plDXBufferRefs.h +++ b/Sources/Plasma/PubUtilLib/plPipeline/plDXBufferRefs.h @@ -67,17 +67,17 @@ class plDXVertexBufferRef : public plDXDeviceRef { public: IDirect3DVertexBuffer9* fD3DBuffer; - UInt32 fCount; - UInt32 fIndex; - UInt32 fVertexSize; - Int32 fOffset; - UInt8 fFormat; + uint32_t fCount; + uint32_t fIndex; + uint32_t fVertexSize; + int32_t fOffset; + uint8_t fFormat; plGBufferGroup* fOwner; - UInt8* fData; + uint8_t* fData; IDirect3DDevice9* fDevice; // For releasing the VertexShader - UInt32 fRefTime; + uint32_t fRefTime; enum { kRebuiltSinceUsed = 0x10, // kDirty = 0x1 is in hsGDeviceRef @@ -85,8 +85,8 @@ class plDXVertexBufferRef : public plDXDeviceRef kSkinned = 0x40 }; - hsBool HasFlag(UInt32 f) const { return 0 != (fFlags & f); } - void SetFlag(UInt32 f, hsBool on) { if(on) fFlags |= f; else fFlags &= ~f; } + hsBool HasFlag(uint32_t f) const { return 0 != (fFlags & f); } + void SetFlag(uint32_t f, hsBool on) { if(on) fFlags |= f; else fFlags &= ~f; } hsBool RebuiltSinceUsed() const { return HasFlag(kRebuiltSinceUsed); } void SetRebuiltSinceUsed(hsBool b) { SetFlag(kRebuiltSinceUsed, b); } @@ -97,8 +97,8 @@ class plDXVertexBufferRef : public plDXDeviceRef hsBool Skinned() const { return HasFlag(kSkinned); } void SetSkinned(hsBool b) { SetFlag(kSkinned, b); } - hsBool Expired(UInt32 t) const { return Volatile() && (IsDirty() || (fRefTime != t)); } - void SetRefTime(UInt32 t) { fRefTime = t; } + hsBool Expired(uint32_t t) const { return Volatile() && (IsDirty() || (fRefTime != t)); } + void SetRefTime(uint32_t t) { fRefTime = t; } void Link( plDXVertexBufferRef **back ) { plDXDeviceRef::Link( (plDXDeviceRef **)back ); } plDXVertexBufferRef* GetNext() { return (plDXVertexBufferRef *)fNext; } @@ -125,11 +125,11 @@ class plDXIndexBufferRef : public plDXDeviceRef { public: IDirect3DIndexBuffer9* fD3DBuffer; - UInt32 fCount; - UInt32 fIndex; - Int32 fOffset; + uint32_t fCount; + uint32_t fIndex; + int32_t fOffset; plGBufferGroup* fOwner; - UInt32 fRefTime; + uint32_t fRefTime; D3DPOOL fPoolType; enum { @@ -137,8 +137,8 @@ class plDXIndexBufferRef : public plDXDeviceRef kVolatile = 0x20 }; - hsBool HasFlag(UInt32 f) const { return 0 != (fFlags & f); } - void SetFlag(UInt32 f, hsBool on) { if(on) fFlags |= f; else fFlags &= ~f; } + hsBool HasFlag(uint32_t f) const { return 0 != (fFlags & f); } + void SetFlag(uint32_t f, hsBool on) { if(on) fFlags |= f; else fFlags &= ~f; } hsBool RebuiltSinceUsed() const { return HasFlag(kRebuiltSinceUsed); } void SetRebuiltSinceUsed(hsBool b) { SetFlag(kRebuiltSinceUsed, b); } @@ -146,8 +146,8 @@ class plDXIndexBufferRef : public plDXDeviceRef hsBool Volatile() const { return HasFlag(kVolatile); } void SetVolatile(hsBool b) { SetFlag(kVolatile, b); } - hsBool Expired(UInt32 t) const { return Volatile() && (IsDirty() || (fRefTime != t)); } - void SetRefTime(UInt32 t) { fRefTime = t; } + hsBool Expired(uint32_t t) const { return Volatile() && (IsDirty() || (fRefTime != t)); } + void SetRefTime(uint32_t t) { fRefTime = t; } void Link( plDXIndexBufferRef **back ) { plDXDeviceRef::Link( (plDXDeviceRef **)back ); } plDXIndexBufferRef* GetNext() { return (plDXIndexBufferRef *)fNext; } diff --git a/Sources/Plasma/PubUtilLib/plPipeline/plDXDeviceRef.h b/Sources/Plasma/PubUtilLib/plPipeline/plDXDeviceRef.h index 96a364aa..983d1038 100644 --- a/Sources/Plasma/PubUtilLib/plPipeline/plDXDeviceRef.h +++ b/Sources/Plasma/PubUtilLib/plPipeline/plDXDeviceRef.h @@ -53,7 +53,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #ifndef _plDXDeviceRef_h #define _plDXDeviceRef_h -#include "hsTypes.h" +#include "HeadSpin.h" #include "hsGDeviceRef.h" diff --git a/Sources/Plasma/PubUtilLib/plPipeline/plDXDeviceRefs.cpp b/Sources/Plasma/PubUtilLib/plPipeline/plDXDeviceRefs.cpp index db79af42..705a3ccd 100644 --- a/Sources/Plasma/PubUtilLib/plPipeline/plDXDeviceRefs.cpp +++ b/Sources/Plasma/PubUtilLib/plPipeline/plDXDeviceRefs.cpp @@ -50,7 +50,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // // /////////////////////////////////////////////////////////////////////////////// -#include "hsTypes.h" +#include "HeadSpin.h" #include #include @@ -157,8 +157,8 @@ void plDXIndexBufferRef::Release( void ) { if( fD3DBuffer != nil ) { - plProfile_DelMem(MemIndex, fCount * sizeof(UInt16)); - PROFILE_POOL_MEM(fPoolType, fCount * sizeof(UInt16), false, "IndexBuff"); + plProfile_DelMem(MemIndex, fCount * sizeof(uint16_t)); + PROFILE_POOL_MEM(fPoolType, fCount * sizeof(uint16_t), false, "IndexBuff"); ReleaseObject( fD3DBuffer ); } @@ -171,8 +171,8 @@ void plDXIndexBufferRef::Release( void ) //// Set ////////////////////////////////////////////////////////////////////// -plDXTextureRef& plDXTextureRef::Set( D3DFORMAT ft, UInt32 ml, UInt32 mw, UInt32 mh, UInt32 np, - UInt32 sz, UInt32 manSize, UInt32* lSz, void* pd, hsBool ed, hsBool renderTarget ) +plDXTextureRef& plDXTextureRef::Set( D3DFORMAT ft, uint32_t ml, uint32_t mw, uint32_t mh, uint32_t np, + uint32_t sz, uint32_t manSize, uint32_t* lSz, void* pd, hsBool ed, hsBool renderTarget ) { if( fDataSize > 0 ) plProfile_DelMem(MemTexture, fDataSize + sizeof(plDXTextureRef)); @@ -194,7 +194,7 @@ plDXTextureRef& plDXTextureRef::Set( D3DFORMAT ft, UInt32 ml, UInt32 mw, UInt32 fLevelSizes = lSz; else { - fLevelSizes = TRACKED_NEW UInt32[1]; + fLevelSizes = new uint32_t[1]; fLevelSizes[0] = sz; } fData = pd; @@ -207,8 +207,8 @@ plDXTextureRef& plDXTextureRef::Set( D3DFORMAT ft, UInt32 ml, UInt32 mw, UInt32 //// Constructor & Destructor ///////////////////////////////////////////////// -plDXTextureRef::plDXTextureRef( D3DFORMAT ft, UInt32 ml, UInt32 mw, UInt32 mh, UInt32 np, - UInt32 sz, UInt32 manSize, UInt32* lSz, void* pd, hsBool ed, hsBool renderTarget ) +plDXTextureRef::plDXTextureRef( D3DFORMAT ft, uint32_t ml, uint32_t mw, uint32_t mh, uint32_t np, + uint32_t sz, uint32_t manSize, uint32_t* lSz, void* pd, hsBool ed, hsBool renderTarget ) { fLevelSizes = nil; fOwner = nil; @@ -303,7 +303,7 @@ void plDXLightRef::UpdateD3DInfo( IDirect3DDevice9 *dev, plDXLightSettings *s fD3DInfo.Falloff = spotOwner->GetFalloff(); fD3DInfo.Theta = spotOwner->GetSpotInner() * 2; -// fD3DInfo.Phi = spotOwner->GetProjection() ? hsScalarPI : spotOwner->GetSpotOuter() * 2; +// fD3DInfo.Phi = spotOwner->GetProjection() ? M_PI : spotOwner->GetSpotOuter() * 2; // D3D doesn't seem to like a Phi of PI, even though that's supposed to be the // largest legal value. Symptom is an erratic, intermitant, unpredictable failure // of the light to light, with bizarreness like lighting one object but not the object @@ -367,7 +367,7 @@ void plDXLightRef::Release( void ) //// Constructor ////////////////////////////////////////////////////////////// -plDXRenderTargetRef::plDXRenderTargetRef( D3DFORMAT tp, UInt32 ml, plRenderTarget *owner, hsBool releaseDepthOnDelete ) +plDXRenderTargetRef::plDXRenderTargetRef( D3DFORMAT tp, uint32_t ml, plRenderTarget *owner, hsBool releaseDepthOnDelete ) : plDXTextureRef( tp, ml, owner->GetWidth(), owner->GetHeight(), owner->GetWidth() * owner->GetHeight(), owner->GetWidth() * owner->GetHeight() * ( owner->GetPixelSize() >> 3 ), @@ -397,7 +397,7 @@ plDXRenderTargetRef::plDXRenderTargetRef( D3DFORMAT tp, UInt32 ml, plRenderTarge //// Set ////////////////////////////////////////////////////////////////////// -plDXRenderTargetRef& plDXRenderTargetRef::Set( D3DFORMAT tp, UInt32 ml, plRenderTarget *owner ) +plDXRenderTargetRef& plDXRenderTargetRef::Set( D3DFORMAT tp, uint32_t ml, plRenderTarget *owner ) { fOwner = owner; diff --git a/Sources/Plasma/PubUtilLib/plPipeline/plDXEnumerate.cpp b/Sources/Plasma/PubUtilLib/plPipeline/plDXEnumerate.cpp index 3774fe20..caf714a5 100644 --- a/Sources/Plasma/PubUtilLib/plPipeline/plDXEnumerate.cpp +++ b/Sources/Plasma/PubUtilLib/plPipeline/plDXEnumerate.cpp @@ -44,13 +44,13 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "hsGDDrawDllLoad.h" #include "hsG3DDeviceSelector.h" -#include "hsUtils.h" + //// Local Typedefs /////////////////////////////////////////////////////////// typedef LPDIRECT3D9 (WINAPI * Direct3DCreateProc)( UINT sdkVersion ); -const UInt8 hsGDirect3DTnLEnumerate::kNumDisplayFormats = 6; +const uint8_t hsGDirect3DTnLEnumerate::kNumDisplayFormats = 6; const D3DFORMAT hsGDirect3DTnLEnumerate::kDisplayFormats[] = { D3DFMT_A1R5G5B5, @@ -353,8 +353,8 @@ void hsGDirect3DTnLEnumerate::IEnumAdapterDevices( IDirect3D9 *pD3D, UINT iAd const TCHAR* strDeviceDescs[] = { "HAL", "REF" }; const D3DDEVTYPE deviceTypes[] = { D3DDEVTYPE_HAL, D3DDEVTYPE_REF }; - BOOL *formatWorks = TRACKED_NEW BOOL[kNumDisplayFormats + 1]; // One for each format - DWORD *behavior = TRACKED_NEW DWORD[kNumDisplayFormats + 1]; + BOOL *formatWorks = new BOOL[kNumDisplayFormats + 1]; // One for each format + DWORD *behavior = new DWORD[kNumDisplayFormats + 1]; UINT iDevice; for (iDevice = 0; iDevice < numDeviceTypes; iDevice++) { @@ -368,7 +368,7 @@ void hsGDirect3DTnLEnumerate::IEnumAdapterDevices( IDirect3D9 *pD3D, UINT iAd /// Loop through the formats, checking each against this device to see /// if it will work. If so, add all modes matching that format - UInt8 iFormat; + uint8_t iFormat; for (iFormat = 0; iFormat < kNumDisplayFormats + 1; iFormat++ ) { // the desktop format gets to be first, everything else is nudged over one. @@ -666,8 +666,8 @@ hsBool hsG3DDeviceSelector::IGetD3DCardInfo( hsG3DDeviceRecord &record, plDemoDebugFile::Write( "DeviceSelector detected DX Direct3D device. Info:" ); plDemoDebugFile::Write( " Driver Description", (char *)adapterInfo->Description ); plDemoDebugFile::Write( " Driver Name", (char *)adapterInfo->Driver ); - plDemoDebugFile::Write( " Vendor ID", (Int32)adapterInfo->VendorId ); - plDemoDebugFile::Write( " Device ID", (Int32)adapterInfo->DeviceId ); + plDemoDebugFile::Write( " Vendor ID", (int32_t)adapterInfo->VendorId ); + plDemoDebugFile::Write( " Device ID", (int32_t)adapterInfo->DeviceId ); plDemoDebugFile::Write( " Version", (char *)record.GetDriverVersion() ); plDemoDebugFile::Write( " Memory size (in MB)", record.GetMemoryBytes() / ( 1024 * 1024 ) ); plDemoDebugFile::Write( " Memory size (in bytes)", record.GetMemoryBytes() ); @@ -843,7 +843,7 @@ void hsG3DDeviceSelector::ITryDirect3DTnLDevice(D3DEnum_DeviceInfo* devInfo, hsG if( devInfo->fDDCaps.MaxAnisotropy <= 1 ) devRec.SetMaxAnisotropicSamples( 0 ); else - devRec.SetMaxAnisotropicSamples( (UInt8)devInfo->fDDCaps.MaxAnisotropy ); + devRec.SetMaxAnisotropicSamples( (uint8_t)devInfo->fDDCaps.MaxAnisotropy ); if (D3DSHADER_VERSION_MAJOR(devInfo->fDDCaps.PixelShaderVersion) > 0) devRec.SetCap(kCapsPixelShader); @@ -862,7 +862,7 @@ void hsG3DDeviceSelector::ITryDirect3DTnLDevice(D3DEnum_DeviceInfo* devInfo, hsG const struct { - D3DFORMAT fmt; UInt16 depth; + D3DFORMAT fmt; uint16_t depth; } depths[] = { { D3DFMT_D16, 0x0010 }, { D3DFMT_D24X8, 0x0018 }, { D3DFMT_D32, 0x0020 }, { D3DFMT_D15S1, 0x010f }, { D3DFMT_D24X4S4, 0x0418 }, { D3DFMT_D24S8, 0x0818 }, { D3DFMT_UNKNOWN, 0 } }; diff --git a/Sources/Plasma/PubUtilLib/plPipeline/plDXEnumerate.h b/Sources/Plasma/PubUtilLib/plPipeline/plDXEnumerate.h index 84125cfe..afa32eb8 100644 --- a/Sources/Plasma/PubUtilLib/plPipeline/plDXEnumerate.h +++ b/Sources/Plasma/PubUtilLib/plPipeline/plDXEnumerate.h @@ -41,7 +41,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ #ifndef hsGDirect3DTnLEnumerate_h #define hsGDirect3DTnLEnumerate_h -#include "hsConfig.h" +#include "HeadSpin.h" #include "hsTemplates.h" //#include "plMemTrackerOff.h" @@ -138,7 +138,7 @@ protected: hsBool ICheckCubicRenderTargets( IDirect3D9 *pD3D, UINT iAdapter, D3DDEVTYPE deviceType, D3DEnum_ModeInfo *modeInfo ); HRESULT IConfirmDevice( D3DCAPS9* pCaps, DWORD dwBehavior, D3DFORMAT format ); - static const UInt8 kNumDisplayFormats; + static const uint8_t kNumDisplayFormats; static const D3DFORMAT kDisplayFormats[]; public: @@ -153,7 +153,7 @@ public: HRESULT D3DEnum_SelectDefaultMode(int width, int height, int depth); HRESULT D3DEnum_SelectDefaultDriver( DWORD dwFlags ); - UInt32 GetNumDrivers() { return fDrivers.GetCount(); } + uint32_t GetNumDrivers() { return fDrivers.GetCount(); } D3DEnum_DriverInfo* GetDriver(int i) { return &fDrivers[i]; } D3DEnum_DriverInfo* GetCurrentDriver() { return fCurrentDriver; } diff --git a/Sources/Plasma/PubUtilLib/plPipeline/plDXLightRef.h b/Sources/Plasma/PubUtilLib/plPipeline/plDXLightRef.h index 2be5de49..2300646d 100644 --- a/Sources/Plasma/PubUtilLib/plPipeline/plDXLightRef.h +++ b/Sources/Plasma/PubUtilLib/plPipeline/plDXLightRef.h @@ -69,8 +69,8 @@ class plDXLightRef : public plDXDeviceRef plLightInfo *fOwner; D3DLIGHT9 fD3DInfo; - UInt32 fD3DIndex; - hsScalar fScale; + uint32_t fD3DIndex; + float fScale; plDXLightSettings *fParentSettings; IDirect3DDevice9 *fD3DDevice; diff --git a/Sources/Plasma/PubUtilLib/plPipeline/plDXPipeline.cpp b/Sources/Plasma/PubUtilLib/plPipeline/plDXPipeline.cpp index 7a8fb12c..763f82be 100644 --- a/Sources/Plasma/PubUtilLib/plPipeline/plDXPipeline.cpp +++ b/Sources/Plasma/PubUtilLib/plPipeline/plDXPipeline.cpp @@ -51,8 +51,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // // /////////////////////////////////////////////////////////////////////////////// -#include "hsConfig.h" -#include "hsWindows.h" +#include "HeadSpin.h" #include #include @@ -67,7 +66,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "hsWinRef.h" -#include "hsTypes.h" +#include "HeadSpin.h" #include "plDXPipeline.h" #include "plPipelineCreate.h" #include "plDebugText.h" @@ -168,10 +167,10 @@ PipelineParams plPipeline::fInitialPipeParams; #ifdef MF_ENABLE_HACKOFF //WHITE static hsTArray hackOffscreens; -UInt32 doHackPlate = UInt32(-1); +uint32_t doHackPlate = uint32_t(-1); #endif // MF_ENABLE_HACKOFF -UInt32 fDbgSetupInitFlags; // HACK temp only +uint32_t fDbgSetupInitFlags; // HACK temp only #ifdef HS_DEBUGGING void plReleaseObject(IUnknown* x) @@ -194,40 +193,40 @@ void plReleaseObject(IUnknown* x) //// Local Static Stuff /////////////////////////////////////////////////////// /// Macros for getting/setting data in a D3D vertex buffer -inline UInt8* inlStuffPoint( UInt8* ptr, const hsScalarTriple& point ) +inline uint8_t* inlStuffPoint( uint8_t* ptr, const hsScalarTriple& point ) { register float* dst = (float*)ptr; register const float* src = (float*)&point.fX; *dst++ = *src++; *dst++ = *src++; *dst++ = *src++; - return (UInt8*)dst; + return (uint8_t*)dst; } -inline UInt8* inlStuffUInt32( UInt8* ptr, const UInt32 uint ) +inline uint8_t* inlStuffUInt32( uint8_t* ptr, const uint32_t uint ) { - *(UInt32*)ptr = uint; + *(uint32_t*)ptr = uint; return ptr + sizeof(uint); } -inline UInt8* inlExtractPoint( const UInt8* ptr, const hsScalarTriple& pt ) +inline uint8_t* inlExtractPoint( const uint8_t* ptr, const hsScalarTriple& pt ) { register const float* src = (float*)ptr; register float* dst = (float*)&pt.fX; *dst++ = *src++; *dst++ = *src++; *dst++ = *src++; - return (UInt8*)src; + return (uint8_t*)src; } -inline UInt8* inlExtractFloat( const UInt8*& ptr, float& f ) +inline uint8_t* inlExtractFloat( const uint8_t*& ptr, float& f ) { register const float* src = (float*)ptr; f = *src++; - return (UInt8*)src; + return (uint8_t*)src; } -inline UInt8* inlExtractUInt32( const UInt8*& ptr, UInt32& uint ) +inline uint8_t* inlExtractUInt32( const uint8_t*& ptr, uint32_t& uint ) { - const UInt32* src = (UInt32*)ptr; + const uint32_t* src = (uint32_t*)ptr; uint = *src++; - return (UInt8*)src; + return (uint8_t*)src; } inline DWORD F2DW( FLOAT f ) @@ -260,7 +259,7 @@ static const enum _D3DTRANSFORMSTATETYPE sTextureStages[ 8 ] = static const float kPerspLayerScale = 0.00001f; static const float kPerspLayerScaleW = 0.001f; static const float kPerspLayerTrans = 0.00002f; -static const hsScalar kAvTexPoolShrinkThresh = 30.f; // seconds +static const float kAvTexPoolShrinkThresh = 30.f; // seconds // This caps the number of D3D lights we use. We'll use up to the max allowed // or this number, whichever is smaller. (This is to prevent us going haywire @@ -463,7 +462,7 @@ void D3DSURF_MEMDEL(IDirect3DCubeTexture9* cTex) {} #endif // PLASMA_EXTERNAL_RELEASE #ifndef PLASMA_EXTERNAL_RELEASE -void plDXPipeline::ProfilePoolMem(D3DPOOL poolType, UInt32 size, hsBool add, char *id) +void plDXPipeline::ProfilePoolMem(D3DPOOL poolType, uint32_t size, hsBool add, char *id) { switch( poolType ) { @@ -553,10 +552,10 @@ hsBool plRenderTriListFunc::RenderPrims() const //// Constructor & Destructor ///////////////////////////////////////////////// -UInt32 plDXPipeline::fTexUsed(0); -UInt32 plDXPipeline::fTexManaged(0); -UInt32 plDXPipeline::fVtxUsed(0); -UInt32 plDXPipeline::fVtxManaged(0); +uint32_t plDXPipeline::fTexUsed(0); +uint32_t plDXPipeline::fTexManaged(0); +uint32_t plDXPipeline::fVtxUsed(0); +uint32_t plDXPipeline::fVtxManaged(0); plDXPipeline::plDXPipeline( hsWinRef hWnd, const hsG3DDeviceModeRecord *devModeRec ) : fManagedAlloced(false), @@ -587,7 +586,7 @@ plDXPipeline::plDXPipeline( hsWinRef hWnd, const hsG3DDeviceModeRecord *devModeR fSettings.fOrigHeight = fInitialPipeParams.Height; fSettings.fOrigWidth = fInitialPipeParams.Width; } - IGetViewTransform().SetScreenSize((UInt16)(fSettings.fOrigWidth), (UInt16)(fSettings.fOrigHeight)); + IGetViewTransform().SetScreenSize((uint16_t)(fSettings.fOrigWidth), (uint16_t)(fSettings.fOrigHeight)); fSettings.fColorDepth = devMode->GetColorDepth(); fVSync = fInitialPipeParams.VSync; @@ -638,11 +637,11 @@ plDXPipeline::plDXPipeline( hsWinRef hWnd, const hsG3DDeviceModeRecord *devModeR fSettings.fMaxAnisotropicSamples = fInitialPipeParams.AnisotropicLevel; if(fSettings.fMaxAnisotropicSamples > fCurrentDevice->fDDCaps.MaxAnisotropy) - fSettings.fMaxAnisotropicSamples = (UInt8)fCurrentDevice->fDDCaps.MaxAnisotropy; + fSettings.fMaxAnisotropicSamples = (uint8_t)fCurrentDevice->fDDCaps.MaxAnisotropy; - plConst(UInt32) kDefaultDynVtxSize(32000 * 44); - plConst(UInt32) kDefaultDynIdxSize(0 * plGBufferGroup::kMaxNumIndicesPerBuffer * 2); + plConst(uint32_t) kDefaultDynVtxSize(32000 * 44); + plConst(uint32_t) kDefaultDynIdxSize(0 * plGBufferGroup::kMaxNumIndicesPerBuffer * 2); fDynVtxSize = kDefaultDynVtxSize; fVtxRefTime = 0; @@ -819,7 +818,7 @@ void plDXViewSettings::Reset() // Want to limit the number of nodes in the cull tree. After adding so many nodes, // the benefits (#objects culled) falls off, but the cost (evaluating objects against // node planes) keeps rising. - const UInt16 kCullMaxNodes = 250; + const uint16_t kCullMaxNodes = 250; fCullTree.Reset(); fCullTreeDirty = true; fCullMaxNodes = kCullMaxNodes; @@ -929,7 +928,7 @@ void plDXPipeline::IInitDeviceState() fD3DDevice->SetRenderState( D3DRS_NORMALIZENORMALS, TRUE ); fD3DDevice->SetRenderState( D3DRS_LOCALVIEWER, TRUE ); - UInt32 totalMem = fD3DDevice->GetAvailableTextureMem(); + uint32_t totalMem = fD3DDevice->GetAvailableTextureMem(); plProfile_Set(TotalTexSize, totalMem); // Initialization for all 8 stages (even though we only use a few of them). @@ -1072,7 +1071,7 @@ void plDXPipeline::ISetCaps() if (fSettings.fMaxLayersAtOnce < 4) SetDebugFlag(plPipeDbg::kFlagBumpUV, true); - fSettings.fMaxAnisotropicSamples = (UInt8)(fCurrentDevice->fDDCaps.MaxAnisotropy); + fSettings.fMaxAnisotropicSamples = (uint8_t)(fCurrentDevice->fDDCaps.MaxAnisotropy); fSettings.fNoGammaCorrect = !(fCurrentDevice->fDDCaps.Caps2 & D3DCAPS2_FULLSCREENGAMMA); @@ -1087,7 +1086,7 @@ void plDXPipeline::ISetCaps() // versions we can render. So if we can render it, we load it and skip its low quality substitute, // if we can't render it, we skip it and load its low quality substitute. // Naturally, this must happen before we do any loading. -void plDXPipeline::ISetGraphicsCapability(UInt32 v) +void plDXPipeline::ISetGraphicsCapability(uint32_t v) { int pixelMajor = D3DSHADER_VERSION_MAJOR(v); int pixelMinor = D3DSHADER_VERSION_MINOR(v); @@ -1180,7 +1179,7 @@ void plDXPipeline::IRestrictCaps( const hsG3DDeviceRecord& devRec ) devRec.GetFogKneeParams( hsG3DDeviceRecord::kFogExp2, fTweaks.fExp2FogKnee, fTweaks.fExp2FogKneeVal ); // Max # of layers - UInt32 max = devRec.GetLayersAtOnce(); + uint32_t max = devRec.GetLayersAtOnce(); if( max > 0 && max < fSettings.fMaxLayersAtOnce ) fSettings.fMaxLayersAtOnce = max; @@ -1255,12 +1254,12 @@ void plDXPipeline::IRestrictCaps( const hsG3DDeviceRecord& devRec ) //// Get/SetZBiasScale //////////////////////////////////////////////////////// // If the board really doesn't support Z-biasing, we adjust the perspective matrix in IGetCameraToNDC // The layer scale and translation are tailored to the current hardware. -hsScalar plDXPipeline::GetZBiasScale() const +float plDXPipeline::GetZBiasScale() const { return ( fTweaks.fPerspLayerScale / fTweaks.fDefaultPerspLayerScale ) - 1.0f; } -void plDXPipeline::SetZBiasScale( hsScalar scale ) +void plDXPipeline::SetZBiasScale( float scale ) { scale += 1.0f; fTweaks.fPerspLayerScale = fTweaks.fDefaultPerspLayerScale * scale; @@ -1279,7 +1278,7 @@ hsBool plDXPipeline::ICreateDynDeviceObjects() IMakeRenderTargetPools(); // Create device-specific stuff - fDebugTextMgr = TRACKED_NEW plDebugTextManager(); + fDebugTextMgr = new plDebugTextManager(); if( fDebugTextMgr == nil ) return true; @@ -1306,7 +1305,7 @@ hsBool plDXPipeline::ICreateDeviceObjects() // PlateMgr is largely for debugging and performance stats, // but also gets used for some things like the cursor and // linking fade to/from black. - fPlateMgr = TRACKED_NEW plDXPlateManager( this, fD3DDevice ); + fPlateMgr = new plDXPlateManager( this, fD3DDevice ); if( fPlateMgr == nil || !fPlateMgr->IsValid() ) return true; @@ -1327,15 +1326,15 @@ hsBool plDXPipeline::ICreateDeviceObjects() return true; /// Log renderer - fLogDrawer = TRACKED_NEW plStatusLogDrawer( this ); + fLogDrawer = new plStatusLogDrawer( this ); plStatusLogMgr::GetInstance().SetDrawer( fLogDrawer ); /// Ok, we're done now #if MCN_BOUNDS_SPANS - fBoundsSpans = TRACKED_NEW plDrawableSpans(); + fBoundsSpans = new plDrawableSpans(); hsgResMgr::ResMgr()->NewKey( _TEMP_CONVERT_FROM_LITERAL("BoundsSpans"), fBoundsSpans, plLocation::kGlobalFixedLoc ); fBoundsSpans->SetNativeProperty( plDrawable::kPropVolatile, true ); - fBoundsMat = TRACKED_NEW hsGMaterial(); + fBoundsMat = new hsGMaterial(); hsgResMgr::ResMgr()->NewKey( _TEMP_CONVERT_FROM_LITERAL("BoundsMaterial"), fBoundsMat, plLocation::kGlobalFixedLoc ); plLayer *lay = fBoundsMat->MakeBaseLayer(); lay->SetMiscFlags( hsGMatState::kMiscWireFrame | hsGMatState::kMiscTwoSided ); @@ -1358,7 +1357,7 @@ void plDXPipeline::ISetCurrentDriver( D3DEnum_DriverInfo *driv ) if( fCurrentDriver != nil ) delete fCurrentDriver; - fCurrentDriver = TRACKED_NEW D3DEnum_DriverInfo; + fCurrentDriver = new D3DEnum_DriverInfo; fCurrentDriver->fGuid = driv->fGuid; hsStrncpy( fCurrentDriver->fStrDesc, driv->fStrDesc, 40 ); @@ -1391,7 +1390,7 @@ void plDXPipeline::ISetCurrentDevice( D3DEnum_DeviceInfo *dev ) { if( fCurrentDevice != nil ) delete fCurrentDevice; - fCurrentDevice = TRACKED_NEW D3DEnum_DeviceInfo; + fCurrentDevice = new D3DEnum_DeviceInfo; hsStrncpy( fCurrentDevice->fStrName, dev->fStrName, 40 ); @@ -1430,7 +1429,7 @@ void plDXPipeline::ISetCurrentMode( D3DEnum_ModeInfo *mode ) { if( fCurrentMode != nil ) delete fCurrentMode; - fCurrentMode = TRACKED_NEW D3DEnum_ModeInfo; + fCurrentMode = new D3DEnum_ModeInfo; *fCurrentMode = *mode; } @@ -1503,7 +1502,7 @@ hsBool plDXPipeline::ITextureFormatAllowed( D3DFORMAT format ) // Debug flags should never be employed to do a game effect, although they can // be useful for developing effects. Mostly they help in diagnosing problems // in rendering or performance. -void plDXPipeline::SetDebugFlag( UInt32 flag, hsBool on ) +void plDXPipeline::SetDebugFlag( uint32_t flag, hsBool on ) { fDebugFlags.SetBit(flag, on); @@ -1529,7 +1528,7 @@ void plDXPipeline::SetDebugFlag( UInt32 flag, hsBool on ) } } -hsBool plDXPipeline::IsDebugFlagSet( UInt32 flag ) const +hsBool plDXPipeline::IsDebugFlagSet( uint32_t flag ) const { return fDebugFlags.IsBitSet(flag); } @@ -1707,11 +1706,11 @@ hsBool plDXPipeline::ICreateDevice(hsBool windowed) // This bit matches up with the fManagedCutoff workaround for a problem // with the NVidia drivers on win2k. Search for "GetVersionEx" in IRestrictCaps // for more info. - UInt32 mem = fD3DDevice->GetAvailableTextureMem(); + uint32_t mem = fD3DDevice->GetAvailableTextureMem(); plProfile_IncCount(TexTot, mem); - const UInt32 kSingleFlush(40000000); - const UInt32 kDoubleFlush(24000000); + const uint32_t kSingleFlush(40000000); + const uint32_t kDoubleFlush(24000000); if( fManagedCutoff ) { if( mem < 64000000 ) @@ -2083,7 +2082,7 @@ void plDXPipeline::IReleaseDynamicBuffers() { iRef->fD3DBuffer->Release(); iRef->fD3DBuffer = nil; - PROFILE_POOL_MEM(iRef->fPoolType, iRef->fCount * sizeof(UInt16), false, "IndexBuff"); + PROFILE_POOL_MEM(iRef->fPoolType, iRef->fCount * sizeof(uint16_t), false, "IndexBuff"); } iRef = iRef->GetNext(); } @@ -2220,7 +2219,7 @@ void plDXPipeline::IResetToDefaults(D3DPRESENT_PARAMETERS *params) // fire off a message to the client so we can write defaults to the ini file, and adjust the window size plKey clientKey = hsgResMgr::ResMgr()->FindKey( kClient_KEY ); - plClientMsg* clientMsg = TRACKED_NEW plClientMsg(plClientMsg::kSetGraphicsDefaults); + plClientMsg* clientMsg = new plClientMsg(plClientMsg::kSetGraphicsDefaults); clientMsg->Send(clientKey); } @@ -2285,7 +2284,7 @@ hsBool plDXPipeline::IResetDevice() /// Broadcast a message letting everyone know that we were recreated and that /// all device-specific stuff needs to be recreated - plDeviceRecreateMsg* clean = TRACKED_NEW plDeviceRecreateMsg(); + plDeviceRecreateMsg* clean = new plDeviceRecreateMsg(); plgDispatch::MsgSend(clean); SetCapture(fSettings.fHWnd); @@ -2481,7 +2480,7 @@ int plDXPipeline::GetMaxAnisotropicSamples() // This Resize function used to serve as both to Resize the primary buffers and // to restore after losing the device (alt-tab). It didn't actually do either // very well, so I'm not sure why I haven't deleted it. -void plDXPipeline::Resize( UInt32 width, UInt32 height ) +void plDXPipeline::Resize( uint32_t width, uint32_t height ) { hsMatrix44 w2c, c2w, proj; @@ -2529,8 +2528,8 @@ void plDXPipeline::Resize( UInt32 width, UInt32 height ) // Width and height of zero mean just recreate fSettings.fOrigWidth = width; fSettings.fOrigHeight = height; - IGetViewTransform().SetScreenSize((UInt16)(fSettings.fOrigWidth), (UInt16)(fSettings.fOrigHeight)); - resetTransform.SetScreenSize((UInt16)(fSettings.fOrigWidth), (UInt16)(fSettings.fOrigHeight)); + IGetViewTransform().SetScreenSize((uint16_t)(fSettings.fOrigWidth), (uint16_t)(fSettings.fOrigHeight)); + resetTransform.SetScreenSize((uint16_t)(fSettings.fOrigWidth), (uint16_t)(fSettings.fOrigHeight)); } else { @@ -2561,7 +2560,7 @@ void plDXPipeline::Resize( UInt32 width, UInt32 height ) /// Broadcast a message letting everyone know that we were recreated and that /// all device-specific stuff needs to be recreated - plDeviceRecreateMsg* clean = TRACKED_NEW plDeviceRecreateMsg(); + plDeviceRecreateMsg* clean = new plDeviceRecreateMsg(); plgDispatch::MsgSend(clean); } @@ -2572,12 +2571,12 @@ void plDXPipeline::Resize( UInt32 width, UInt32 height ) //// MakeTextFont ///////////////////////////////////////////////////////////// -plTextFont *plDXPipeline::MakeTextFont( char *face, UInt16 size ) +plTextFont *plDXPipeline::MakeTextFont( char *face, uint16_t size ) { plTextFont *font; - font = TRACKED_NEW plDXTextFont( this, fD3DDevice ); + font = new plDXTextFont( this, fD3DDevice ); if( font == nil ) return nil; font->Create( face, size ); @@ -2599,7 +2598,7 @@ plTextFont *plDXPipeline::MakeTextFont( char *face, UInt16 size ) // span indices within this drawable. // This is called once per render, and generally well before rendering begins (as part of the // cull phase). -hsBool plDXPipeline::PreRender( plDrawable* drawable, hsTArray& visList, plVisMgr* visMgr ) +hsBool plDXPipeline::PreRender( plDrawable* drawable, hsTArray& visList, plVisMgr* visMgr ) { plDrawableSpans *ds = plDrawableSpans::ConvertNoRef(drawable); if( !ds ) @@ -2638,7 +2637,7 @@ hsBool plDXPipeline::PreRender( plDrawable* drawable, hsTArray& visList, #if MF_BOUNDS_LEVEL_ICE if( (fSettings.fBoundsDrawLevel >= 0) && ( drawable != fBoundsSpans ) ) { - hsTArray bndList; + hsTArray bndList; drawable->GetSpaceTree()->HarvestLevel(fSettings.fBoundsDrawLevel, bndList); int i; for( i = 0; i < bndList.GetCount(); i++ ) @@ -2654,8 +2653,8 @@ hsBool plDXPipeline::PreRender( plDrawable* drawable, hsTArray& visList, struct plSortFace { - UInt16 fIdx[3]; - hsScalar fDist; + uint16_t fIdx[3]; + float fDist; }; struct plCompSortFace : public std::binary_function @@ -2680,7 +2679,7 @@ struct plCompSortFace : public std::binary_function& visList) +hsBool plDXPipeline::IAvatarSort(plDrawableSpans* d, const hsTArray& visList) { plProfile_BeginTiming(AvatarSort); int i; @@ -2700,8 +2699,8 @@ hsBool plDXPipeline::IAvatarSort(plDrawableSpans* d, const hsTArray& visL plDXVertexBufferRef* vRef = (plDXVertexBufferRef*)group->GetVertexBufferRef(span->fVBufferIdx); - const UInt8* vdata = vRef->fData; - const UInt32 stride = vRef->fVertexSize; + const uint8_t* vdata = vRef->fData; + const uint32_t stride = vRef->fVertexSize; const int numTris = span->fILength/3; @@ -2719,12 +2718,12 @@ hsBool plDXPipeline::IAvatarSort(plDrawableSpans* d, const hsTArray& visL // point on the triangle, or the farthest point on the triangle. // Having tried all three on the avatar (the only thing this sort is used on), // the best results surprisingly came from using the center of the triangle. - UInt16* indices = group->GetIndexBufferData(span->fIBufferIdx) + span->fIStartIdx; + uint16_t* indices = group->GetIndexBufferData(span->fIBufferIdx) + span->fIStartIdx; int j; for( j = 0; j < numTris; j++ ) { #if 1 // TRICENTER - UInt16 idx = *indices++; + uint16_t idx = *indices++; sortScratch[j].fIdx[0] = idx; hsPoint3 pos = *(hsPoint3*)(vdata + idx * stride); @@ -2740,11 +2739,11 @@ hsBool plDXPipeline::IAvatarSort(plDrawableSpans* d, const hsTArray& visL sortScratch[j].fDist = hsVector3(&pos, &viewPos).MagnitudeSquared(); #elif 0 // NEAREST - UInt16 idx = *indices++; + uint16_t idx = *indices++; sortScratch[j].fIdx[0] = idx; hsPoint3 pos = *(hsPoint3*)(vdata + idx * stride); - hsScalar dist = hsVector3(&pos, &viewPos).MagnitudeSquared(); - hsScalar minDist = dist; + float dist = hsVector3(&pos, &viewPos).MagnitudeSquared(); + float minDist = dist; idx = *indices++; sortScratch[j].fIdx[1] = idx; @@ -2762,11 +2761,11 @@ hsBool plDXPipeline::IAvatarSort(plDrawableSpans* d, const hsTArray& visL sortScratch[j].fDist = minDist; #elif 1 // FURTHEST - UInt16 idx = *indices++; + uint16_t idx = *indices++; sortScratch[j].fIdx[0] = idx; hsPoint3 pos = *(hsPoint3*)(vdata + idx * stride); - hsScalar dist = hsVector3(&pos, &viewPos).MagnitudeSquared(); - hsScalar maxDist = dist; + float dist = hsVector3(&pos, &viewPos).MagnitudeSquared(); + float maxDist = dist; idx = *indices++; sortScratch[j].fIdx[1] = idx; @@ -2816,7 +2815,7 @@ hsBool plDXPipeline::IAvatarSort(plDrawableSpans* d, const hsTArray& visL // This is called once per render, and before any rendering actually starts. See plPageTreeMgr.cpp. // So any preperation needs to last until rendering actually begins. So cached information, like // which lights a span will use, needs to be stored on the span. -hsBool plDXPipeline::PrepForRender(plDrawable* d, hsTArray& visList, plVisMgr* visMgr) +hsBool plDXPipeline::PrepForRender(plDrawable* d, hsTArray& visList, plVisMgr* visMgr) { plProfile_BeginTiming(PrepDrawable); @@ -2871,7 +2870,7 @@ void plDXPipeline::Draw( plDrawable *d ) if( ( ds->GetType() & fView.fDrawableTypeMask ) == 0 ) return; - static hsTArrayvisList; + static hsTArrayvisList; PreRender( ds, visList ); PrepForRender(ds, visList); @@ -2897,7 +2896,7 @@ void plDXPipeline::Draw( plDrawable *d ) // Render(B, BTotalVisList); // Render(A, ANearHalfVisList); // See plPageTreeMgr, which handles all this. -void plDXPipeline::Render( plDrawable *d, const hsTArray& visList ) +void plDXPipeline::Render( plDrawable *d, const hsTArray& visList ) { // Reset here, since we can push/pop renderTargets after BeginRender() but before // this function, which necessitates this being called @@ -3032,7 +3031,7 @@ void plDXPipeline::EndVisMgr(plVisMgr* visMgr) // A) moving objects, which can't be staticly lit, so are affected by all runtime lights. // B) moving lights, which can't staticly light, so affect all objects // C) specular objects + specular lights, since specular can't be precomputed. -void plDXPipeline::ICheckLighting(plDrawableSpans* drawable, hsTArray& visList, plVisMgr* visMgr) +void plDXPipeline::ICheckLighting(plDrawableSpans* drawable, hsTArray& visList, plVisMgr* visMgr) { if( fView.fRenderState & kRenderNoLights ) return; @@ -3089,9 +3088,9 @@ void plDXPipeline::ICheckLighting(plDrawableSpans* drawable, hsTArray& vi // A) moving - affected by all lights - moveList // B) specular - affected by specular lights - specList // C) visible - affected by moving lights - visList - static hsTArray tmpList; - static hsTArray moveList; - static hsTArray specList; + static hsTArray tmpList; + static hsTArray moveList; + static hsTArray specList; moveList.SetCount(0); specList.SetCount(0); @@ -3154,7 +3153,7 @@ void plDXPipeline::ICheckLighting(plDrawableSpans* drawable, hsTArray& vi { plProfile_BeginTiming(ApplyMoving); - const hsTArray& litList = light->GetAffected(drawable->GetSpaceTree(), + const hsTArray& litList = light->GetAffected(drawable->GetSpaceTree(), visList, tmpList, drawable->GetNativeProperty(plDrawable::kPropCharacter) ); @@ -3178,7 +3177,7 @@ void plDXPipeline::ICheckLighting(plDrawableSpans* drawable, hsTArray& vi if( !(currProj && (span->fProps & plSpan::kPropSkipProjection)) ) { plDXLightRef *ref = (plDXLightRef *)light->GetDeviceRef(); - hsScalar strength, scale; + float strength, scale; light->GetStrengthAndScale(span->fWorldBounds, strength, scale); @@ -3202,7 +3201,7 @@ void plDXPipeline::ICheckLighting(plDrawableSpans* drawable, hsTArray& vi plProfile_BeginTiming(ApplyToSpec); - const hsTArray& litList = light->GetAffected(drawable->GetSpaceTree(), + const hsTArray& litList = light->GetAffected(drawable->GetSpaceTree(), specList, tmpList, drawable->GetNativeProperty(plDrawable::kPropCharacter) ); @@ -3226,7 +3225,7 @@ void plDXPipeline::ICheckLighting(plDrawableSpans* drawable, hsTArray& vi if( !(currProj && (span->fProps & plSpan::kPropSkipProjection)) ) { plDXLightRef *ref = (plDXLightRef *)light->GetDeviceRef(); - hsScalar strength, scale; + float strength, scale; light->GetStrengthAndScale(span->fWorldBounds, strength, scale); @@ -3249,7 +3248,7 @@ void plDXPipeline::ICheckLighting(plDrawableSpans* drawable, hsTArray& vi plProfile_BeginTiming(ApplyToMoving); - const hsTArray& litList = light->GetAffected(drawable->GetSpaceTree(), + const hsTArray& litList = light->GetAffected(drawable->GetSpaceTree(), moveList, tmpList, drawable->GetNativeProperty(plDrawable::kPropCharacter) ); @@ -3273,7 +3272,7 @@ void plDXPipeline::ICheckLighting(plDrawableSpans* drawable, hsTArray& vi if( !(currProj && (span->fProps & plSpan::kPropSkipProjection)) ) { plDXLightRef *ref = (plDXLightRef *)light->GetDeviceRef(); - hsScalar strength, scale; + float strength, scale; light->GetStrengthAndScale(span->fWorldBounds, strength, scale); @@ -3307,7 +3306,7 @@ void plDXPipeline::ICheckLighting(plDrawableSpans* drawable, hsTArray& vi // to bother with, which drawables within the SceneNode). For finer objects, like the spans // themselves, the culling is done via IGetVisibleSpans, which also takes the plVisMgr into // account. -hsBool plDXPipeline::HarvestVisible(plSpaceTree* space, hsTArray& visList) +hsBool plDXPipeline::HarvestVisible(plSpaceTree* space, hsTArray& visList) { if( !space ) return false; @@ -3330,9 +3329,9 @@ hsBool plDXPipeline::HarvestVisible(plSpaceTree* space, hsTArray& visList // Given a drawable, returns a list of visible span indices. Disabled spans will not // show up in the list, behaving as if they were culled. // See plCullTree (in plPipeline) and plSpaceTree (in plDrawable) and plVisMgr (in plScene). -void plDXPipeline::IGetVisibleSpans( plDrawableSpans* drawable, hsTArray& visList, plVisMgr* visMgr ) +void plDXPipeline::IGetVisibleSpans( plDrawableSpans* drawable, hsTArray& visList, plVisMgr* visMgr ) { - static hsTArray tmpVis; + static hsTArray tmpVis; tmpVis.SetCount(0); visList.SetCount(0); @@ -3343,7 +3342,7 @@ void plDXPipeline::IGetVisibleSpans( plDrawableSpans* drawable, hsTArray& if( fView.fCullTreeDirty ) IRefreshCullTree(); - const hsScalar viewDist = GetViewDirWorld().InnerProduct(GetViewPositionWorld()); + const float viewDist = GetViewDirWorld().InnerProduct(GetViewPositionWorld()); const hsTArray &spans = drawable->GetSpanArray(); @@ -3389,7 +3388,7 @@ void plDXPipeline::IGetVisibleSpans( plDrawableSpans* drawable, hsTArray& // We'll check here for spans we can discard because they've completely distance faded out. // Note this is based on view direction distance (because the fade is), rather than the // preferrable distance to camera we sort by. - hsScalar minDist, maxDist; + float minDist, maxDist; if( drawable->GetSubVisDists(tmpVis[i], minDist, maxDist) ) { const hsBounds3Ext& bnd = drawable->GetSpaceTree()->GetNode(tmpVis[i]).fWorldBounds; @@ -3465,7 +3464,7 @@ hsBool plDXPipeline::IRefreshDynVertices(plGBufferGroup* group, plDXVertexBuffer // First, pad out our next slot to be on a vertex boundary (for this vertex size). fNextDynVtx = ((fNextDynVtx + vRef->fVertexSize-1) / vRef->fVertexSize) * vRef->fVertexSize; - Int32 size = (group->GetVertBufferEnd(vRef->fIndex) - group->GetVertBufferStart(vRef->fIndex)) * vRef->fVertexSize; + int32_t size = (group->GetVertBufferEnd(vRef->fIndex) - group->GetVertBufferStart(vRef->fIndex)) * vRef->fVertexSize; if( !size ) return false; // No error, just nothing to do. @@ -3484,14 +3483,14 @@ hsBool plDXPipeline::IRefreshDynVertices(plGBufferGroup* group, plDXVertexBuffer } // Point our ref at the next available spot - Int32 newStart = fNextDynVtx / vRef->fVertexSize; + int32_t newStart = fNextDynVtx / vRef->fVertexSize; vRef->fOffset = newStart - group->GetVertBufferStart(vRef->fIndex); // Lock the buffer // If index is zero, lock with discard, else with overwrite. DWORD lockFlag = fNextDynVtx ? D3DLOCK_NOOVERWRITE : D3DLOCK_DISCARD; - UInt8* destPtr = nil; + uint8_t* destPtr = nil; if( FAILED( fDynVtxBuff->Lock( fNextDynVtx, size, (void **)&destPtr, @@ -3501,7 +3500,7 @@ hsBool plDXPipeline::IRefreshDynVertices(plGBufferGroup* group, plDXVertexBuffer return true; } - UInt8* vData; + uint8_t* vData; if( vRef->fData ) { vData = vRef->fData; @@ -3614,12 +3613,12 @@ hsBool plDXPipeline::ICheckDynBuffers(plDrawableSpans* drawable, plGBufferGroup* // Renders an array of spans obtained from a plDrawableSpans object // The incoming visList gives the indices of the spans which are visible and should // be drawn now, and gives them in sorted order. -void plDXPipeline::IRenderSpans( plDrawableSpans *drawable, const hsTArray& visList ) +void plDXPipeline::IRenderSpans( plDrawableSpans *drawable, const hsTArray& visList ) { plProfile_BeginTiming(RenderSpan); hsMatrix44 lastL2W; - UInt32 i, j; + uint32_t i, j; bool drewPatch = false; hsGMaterial *material; @@ -3706,7 +3705,7 @@ void plDXPipeline::IRenderSpans( plDrawableSpans *drawable, const hsTArray spanArray; @@ -3721,7 +3720,7 @@ void plDXPipeline::IAddBoundsSpan( plDrawableSpans *ice, const hsBounds3Ext * if( spanArray.GetCount() == 0 ) { spanArray.Reset(); - spanArray.Append( TRACKED_NEW plGeometrySpan() ); + spanArray.Append( new plGeometrySpan() ); identMatrix.Reset(); // Make normals @@ -3733,7 +3732,7 @@ void plDXPipeline::IAddBoundsSpan( plDrawableSpans *ice, const hsBounds3Ext * } } else - spanArray[ 0 ] = TRACKED_NEW plGeometrySpan(); + spanArray[ 0 ] = new plGeometrySpan(); newSpan = spanArray[ 0 ]; @@ -3782,14 +3781,14 @@ void plDXPipeline::IAddBoundsSpan( plDrawableSpans *ice, const hsBounds3Ext * // world bounds. // Debugging only. -void plDXPipeline::IAddNormalsSpan( plDrawableSpans *ice, plIcicle *span, plDXVertexBufferRef *vRef, UInt32 bndColor ) +void plDXPipeline::IAddNormalsSpan( plDrawableSpans *ice, plIcicle *span, plDXVertexBufferRef *vRef, uint32_t bndColor ) { #if MCN_BOUNDS_SPANS static hsTArray spanArray; static hsMatrix44 identMatrix; static hsPoint3 point, off, blank; hsVector3 b2; - UInt16 v1, v2, v3; + uint16_t v1, v2, v3; int i; plGeometrySpan *newSpan; @@ -3797,11 +3796,11 @@ void plDXPipeline::IAddNormalsSpan( plDrawableSpans *ice, plIcicle *span, plD if( spanArray.GetCount() == 0 ) { spanArray.Reset(); - spanArray.Append( TRACKED_NEW plGeometrySpan() ); + spanArray.Append( new plGeometrySpan() ); identMatrix.Reset(); } else - spanArray[ 0 ] = TRACKED_NEW plGeometrySpan(); + spanArray[ 0 ] = new plGeometrySpan(); newSpan = spanArray[ 0 ]; @@ -3838,12 +3837,12 @@ hsBool plDXPipeline::BeginRender() if( IResetDevice() ) return true; - // We were lost, but now we're found! Spread the good word brother! + // We were lost, but now we're found! Spread the good uint16_t brother! if( fDevWasLost ) { /// Broadcast a message letting everyone know that we were recreated and that /// all device-specific stuff needs to be recreated -// plDeviceRecreateMsg* clean = TRACKED_NEW plDeviceRecreateMsg(); +// plDeviceRecreateMsg* clean = new plDeviceRecreateMsg(); // plgDispatch::MsgSend(clean); fDevWasLost = false; @@ -3869,7 +3868,7 @@ hsBool plDXPipeline::BeginRender() plProfile_Set(ManSeen, fManagedSeen); if( fManagedCutoff ) { - plConst(UInt32) kMinEvictTime(1800); // ~2 minutes @ 15FPS + plConst(uint32_t) kMinEvictTime(1800); // ~2 minutes @ 15FPS if( (fManagedSeen > fManagedCutoff) && (fTexUsed + fVtxUsed < fManagedCutoff) && (fTextUseTime - fEvictTime > kMinEvictTime) ) { fD3DDevice->EvictManagedResources(); @@ -4066,7 +4065,7 @@ hsBool plDXPipeline::EndRender() // SetGamma //////////////////////////////////////////////////////////// // Create and set a gamma table based on the input exponent values for // R, G, and B. Can also set explicit table using the other SetGamma(). -hsBool plDXPipeline::SetGamma(hsScalar eR, hsScalar eG, hsScalar eB) +hsBool plDXPipeline::SetGamma(float eR, float eG, float eB) { if( fSettings.fNoGammaCorrect ) return false; @@ -4075,7 +4074,7 @@ hsBool plDXPipeline::SetGamma(hsScalar eR, hsScalar eG, hsScalar eB) ramp.red[0] = ramp.green[0] = ramp.blue[0] = 0L; - plConst(hsScalar) kMinE(0.1f); + plConst(float) kMinE(0.1f); if( eR > kMinE ) eR = 1.f / eR; else @@ -4092,20 +4091,20 @@ hsBool plDXPipeline::SetGamma(hsScalar eR, hsScalar eG, hsScalar eB) int i; for( i = 1; i < 256; i++ ) { - hsScalar orig = hsScalar(i) / 255.f; + float orig = float(i) / 255.f; - hsScalar gamm; + float gamm; gamm = pow(orig, eR); - gamm *= hsScalar(UInt16(-1)); - ramp.red[i] = UInt16(gamm); + gamm *= float(uint16_t(-1)); + ramp.red[i] = uint16_t(gamm); gamm = pow(orig, eG); - gamm *= hsScalar(UInt16(-1)); - ramp.green[i] = UInt16(gamm); + gamm *= float(uint16_t(-1)); + ramp.green[i] = uint16_t(gamm); gamm = pow(orig, eB); - gamm *= hsScalar(UInt16(-1)); - ramp.blue[i] = UInt16(gamm); + gamm *= float(uint16_t(-1)); + ramp.blue[i] = uint16_t(gamm); } fD3DDevice->SetGammaRamp(0, D3DSGR_NO_CALIBRATION, &ramp); @@ -4115,7 +4114,7 @@ hsBool plDXPipeline::SetGamma(hsScalar eR, hsScalar eG, hsScalar eB) // SetGamma // Copy the input gamma tables and pass them to the hardware. -hsBool plDXPipeline::SetGamma(const UInt16* const tabR, const UInt16* const tabG, const UInt16* const tabB) +hsBool plDXPipeline::SetGamma(const uint16_t* const tabR, const uint16_t* const tabG, const uint16_t* const tabB) { if( fSettings.fNoGammaCorrect ) return false; @@ -4183,17 +4182,17 @@ plMipmap* plDXPipeline::ExtractMipMap(plRenderTarget* targ) const int width = targ->GetWidth(); const int height = targ->GetHeight(); - plMipmap* mipMap = TRACKED_NEW plMipmap(width, height, plMipmap::kARGB32Config, 1); + plMipmap* mipMap = new plMipmap(width, height, plMipmap::kARGB32Config, 1); - UInt8* ptr = (UInt8*)(rect.pBits); + uint8_t* ptr = (uint8_t*)(rect.pBits); const int pitch = rect.Pitch; - const UInt32 blackOpaque = 0xff000000; + const uint32_t blackOpaque = 0xff000000; int y; for( y = 0; y < height; y++ ) { - UInt32* destPtr = mipMap->GetAddr32(0, y); - UInt32* srcPtr = (UInt32*)ptr; + uint32_t* destPtr = mipMap->GetAddr32(0, y); + uint32_t* srcPtr = (uint32_t*)ptr; int x; for( x = 0; x < width; x++ ) { @@ -4217,9 +4216,9 @@ plMipmap* plDXPipeline::ExtractMipMap(plRenderTarget* targ) // all pixels in dest get written to, even though the client window may be partially // offscreen. If the client window is partially offscreen, there will be no values // for the "offscreen pixels" to copy to dest, so opaque black is used. -hsBool plDXPipeline::CaptureScreen( plMipmap *dest, bool flipVertical, UInt16 desiredWidth, UInt16 desiredHeight ) +hsBool plDXPipeline::CaptureScreen( plMipmap *dest, bool flipVertical, uint16_t desiredWidth, uint16_t desiredHeight ) { - UInt32 y, *destPtr, *srcPtr, width, height, bigWidth, bigHeight; + uint32_t y, *destPtr, *srcPtr, width, height, bigWidth, bigHeight; IDirect3DSurface9 *surface; D3DLOCKED_RECT rect; RECT rToLock; @@ -4296,7 +4295,7 @@ hsBool plDXPipeline::CaptureScreen( plMipmap *dest, bool flipVertical, UInt16 d dest->Create( width, height, plMipmap::kARGB32Config, 1 ); } - const UInt32 blackOpaque = 0xff000000; + const uint32_t blackOpaque = 0xff000000; /// Copy over for( y = 0; y < top; y++ ) { @@ -4313,7 +4312,7 @@ hsBool plDXPipeline::CaptureScreen( plMipmap *dest, bool flipVertical, UInt16 d } for( y = top; y < bottom; y++ ) { - srcPtr = (UInt32 *)( (UInt8 *)rect.pBits + rect.Pitch * y ); + srcPtr = (uint32_t *)( (uint8_t *)rect.pBits + rect.Pitch * y ); if (flipVertical) destPtr = dest->GetAddr32( 0, height - 1 - y ); else @@ -4323,7 +4322,7 @@ hsBool plDXPipeline::CaptureScreen( plMipmap *dest, bool flipVertical, UInt16 d for( x = 0; x < left; x++ ) *destPtr++ = blackOpaque; - memcpy( destPtr, srcPtr, (right - left) * sizeof( UInt32 ) ); + memcpy( destPtr, srcPtr, (right - left) * sizeof( uint32_t ) ); destPtr += (right - left); for( x = right; x < width; x++ ) @@ -4374,7 +4373,7 @@ hsGDeviceRef *plDXPipeline::MakeRenderTargetRef( plRenderTarget *owner ) D3DRESOURCETYPE resType; int i; plCubicRenderTarget *cubicRT; - UInt16 width, height; + uint16_t width, height; hsAssert(!fManagedAlloced, "Allocating non-managed resource with managed resources alloc'd"); @@ -4455,7 +4454,7 @@ hsGDeviceRef *plDXPipeline::MakeRenderTargetRef( plRenderTarget *owner ) if( ref != nil ) ref->Set( surfFormat, 0, owner ); else - ref = TRACKED_NEW plDXRenderTargetRef( surfFormat, 0, owner ); + ref = new plDXRenderTargetRef( surfFormat, 0, owner ); if( !FAILED( fD3DDevice->CreateCubeTexture( owner->GetWidth(), 1, D3DUSAGE_RENDERTARGET, surfFormat, D3DPOOL_DEFAULT, (IDirect3DCubeTexture9 **)&cTexture, NULL ) ) ) @@ -4475,7 +4474,7 @@ hsGDeviceRef *plDXPipeline::MakeRenderTargetRef( plRenderTarget *owner ) } else { - face->SetDeviceRef( TRACKED_NEW plDXRenderTargetRef( surfFormat, 0, face, false ) ); + face->SetDeviceRef( new plDXRenderTargetRef( surfFormat, 0, face, false ) ); ( (plDXRenderTargetRef *)face->GetDeviceRef())->Link( &fRenderTargetRefList ); // Unref now, since for now ONLY the RT owns the ref, not us (not until we use it, at least) hsRefCnt_SafeUnRef( face->GetDeviceRef() ); @@ -4501,7 +4500,7 @@ hsGDeviceRef *plDXPipeline::MakeRenderTargetRef( plRenderTarget *owner ) if( ref != nil ) ref->Set( surfFormat, 0, owner ); else - ref = TRACKED_NEW plDXRenderTargetRef( surfFormat, 0, owner ); + ref = new plDXRenderTargetRef( surfFormat, 0, owner ); if( !FAILED( fD3DDevice->CreateTexture( owner->GetWidth(), owner->GetHeight(), 1, D3DUSAGE_RENDERTARGET, surfFormat, D3DPOOL_DEFAULT, (IDirect3DTexture9 **)&texture, NULL ) ) ) @@ -4531,7 +4530,7 @@ hsGDeviceRef *plDXPipeline::MakeRenderTargetRef( plRenderTarget *owner ) if( ref != nil ) ref->Set( surfFormat, 0, owner ); else - ref = TRACKED_NEW plDXRenderTargetRef( surfFormat, 0, owner ); + ref = new plDXRenderTargetRef( surfFormat, 0, owner ); width = owner->GetWidth(); height = owner->GetHeight(); @@ -4599,7 +4598,7 @@ hsGDeviceRef* plDXPipeline::SharedRenderTargetRef(plRenderTarget* share, plRende D3DRESOURCETYPE resType; int i; plCubicRenderTarget* cubicRT; - UInt16 width, height; + uint16_t width, height; // If we don't already have one to share from, start from scratch. if( !share ) @@ -4653,7 +4652,7 @@ hsGDeviceRef* plDXPipeline::SharedRenderTargetRef(plRenderTarget* share, plRende if( ref != nil ) ref->Set( surfFormat, 0, owner ); else - ref = TRACKED_NEW plDXRenderTargetRef( surfFormat, 0, owner ); + ref = new plDXRenderTargetRef( surfFormat, 0, owner ); hsAssert(!fManagedAlloced, "Alloc default with managed alloc'd"); if( !FAILED( fD3DDevice->CreateCubeTexture( owner->GetWidth(), 1, D3DUSAGE_RENDERTARGET, surfFormat, @@ -4675,7 +4674,7 @@ hsGDeviceRef* plDXPipeline::SharedRenderTargetRef(plRenderTarget* share, plRende } else { - face->SetDeviceRef( TRACKED_NEW plDXRenderTargetRef( surfFormat, 0, face, false ) ); + face->SetDeviceRef( new plDXRenderTargetRef( surfFormat, 0, face, false ) ); ( (plDXRenderTargetRef *)face->GetDeviceRef())->Link( &fRenderTargetRefList ); // Unref now, since for now ONLY the RT owns the ref, not us (not until we use it, at least) hsRefCnt_SafeUnRef( face->GetDeviceRef() ); @@ -4700,7 +4699,7 @@ hsGDeviceRef* plDXPipeline::SharedRenderTargetRef(plRenderTarget* share, plRende if( ref != nil ) ref->Set( surfFormat, 0, owner ); else - ref = TRACKED_NEW plDXRenderTargetRef( surfFormat, 0, owner ); + ref = new plDXRenderTargetRef( surfFormat, 0, owner ); hsAssert(!fManagedAlloced, "Alloc default with managed alloc'd"); if( !FAILED( fD3DDevice->CreateTexture( owner->GetWidth(), owner->GetHeight(), 1, D3DUSAGE_RENDERTARGET, surfFormat, @@ -4724,7 +4723,7 @@ hsGDeviceRef* plDXPipeline::SharedRenderTargetRef(plRenderTarget* share, plRende if( ref != nil ) ref->Set( surfFormat, 0, owner ); else - ref = TRACKED_NEW plDXRenderTargetRef( surfFormat, 0, owner ); + ref = new plDXRenderTargetRef( surfFormat, 0, owner ); width = owner->GetWidth(); height = owner->GetHeight(); @@ -4775,8 +4774,8 @@ hsBool plDXPipeline::IPrepRenderTargetInfo( plRenderTarget *owner, D3DFORMAT &s D3DFORMAT &depthFormat, D3DRESOURCETYPE &resType ) { int i, j; - UInt16 flags, width, height; - Int8 bitDepth, zDepth, stencilDepth, stencilIndex; + uint16_t flags, width, height; + int8_t bitDepth, zDepth, stencilDepth, stencilIndex; D3DFORMAT depthFormats[] = { D3DFMT_D24X8, D3DFMT_D24X4S4, D3DFMT_D24S8 }; @@ -4898,8 +4897,8 @@ hsBool plDXPipeline::IPrepRenderTargetInfo( plRenderTarget *owner, D3DFORMAT &s // that's going to share a depth buffer that's already been created. hsBool plDXPipeline::IFindRenderTargetInfo( plRenderTarget *owner, D3DFORMAT &surfFormat, D3DRESOURCETYPE &resType ) { - UInt16 flags, width, height; - Int8 bitDepth; + uint16_t flags, width, height; + int8_t bitDepth; flags = owner->GetFlags(); @@ -5166,7 +5165,7 @@ void plDXPipeline::ISetRenderTarget( plRenderTarget *target ) // SetClear ///////////////////////////////////////////////////////////////////// // Set the color and depth clear values. -void plDXPipeline::SetClear(const hsColorRGBA* col, const hsScalar* depth) +void plDXPipeline::SetClear(const hsColorRGBA* col, const float* depth) { if( col ) fView.fClearColor = inlGetD3DColor(*col); @@ -5183,7 +5182,7 @@ hsColorRGBA plDXPipeline::GetClearColor() const // GetClearDepth //////////////////////////////////////////////////////////////// // Return the current clear depth. -hsScalar plDXPipeline::GetClearDepth() const +float plDXPipeline::GetClearDepth() const { return fView.fClearDepth; } @@ -5220,12 +5219,12 @@ void plDXPipeline::ClearRenderTarget( plDrawable* d ) } } - UInt32 s = fView.fRenderState; - UInt32 dtm = fView.fDrawableTypeMask; - UInt32 sdtm = fView.fSubDrawableTypeMask; + uint32_t s = fView.fRenderState; + uint32_t dtm = fView.fDrawableTypeMask; + uint32_t sdtm = fView.fSubDrawableTypeMask; fView.fDrawableTypeMask = plDrawable::kNormal; - fView.fSubDrawableTypeMask = UInt32(-1); + fView.fSubDrawableTypeMask = uint32_t(-1); BeginDrawable(d); Draw(d); @@ -5263,12 +5262,12 @@ hsBool plDXPipeline::IGetClearViewPort(D3DRECT& r) // ClearRenderTarget ////////////////////////////////////////////////////////////////////////////// // Flat fill the current render target with the specified color and depth values. -void plDXPipeline::ClearRenderTarget( const hsColorRGBA *col, const hsScalar* depth ) +void plDXPipeline::ClearRenderTarget( const hsColorRGBA *col, const float* depth ) { if( fView.fRenderState & (kRenderClearColor | kRenderClearDepth) ) { DWORD clearColor = inlGetD3DColor(col ? *col : GetClearColor()); - hsScalar clearDepth = depth ? *depth : fView.fClearDepth; + float clearDepth = depth ? *depth : fView.fClearDepth; DWORD dwFlags = 0;//fStencil.fDepth > 0 ? D3DCLEAR_STENCIL : 0; if( fView.fRenderState & kRenderClearColor ) @@ -5309,8 +5308,8 @@ void plDXPipeline::IGetVSFogSet(float* const set) const if( fCurrFog.fEnvPtr ) { hsColorRGBA colorTrash; - hsScalar start; - hsScalar end; + float start; + float end; fCurrFog.fEnvPtr->GetPipelineParams(&start, &end, &colorTrash); if( end > start ) { @@ -5352,8 +5351,8 @@ void plDXPipeline::ISetFogParameters(const plSpan* span, const plLayerInterface* plFogEnvironment* fog = (span ? (span->fFogEnvironment ? span->fFogEnvironment : &fView.fDefaultFog) : nil); - UInt8 isVertex = 0; - UInt8 isShader = false; + uint8_t isVertex = 0; + uint8_t isShader = false; if (baseLay) { if ((baseLay->GetShadeFlags() & hsGMatState::kShadeReallyNoFog) && !(fMatOverOff.fShadeFlags & hsGMatState::kShadeReallyNoFog)) @@ -5377,7 +5376,7 @@ void plDXPipeline::ISetFogParameters(const plSpan* span, const plLayerInterface* if ((fCurrFog.fEnvPtr == fog) && (fCurrFog.fIsVertex == isVertex) && (fCurrFog.fIsShader == isShader)) return; - UInt8 type = ( fog == nil ) ? plFogEnvironment::kNoFog : fog->GetType(); + uint8_t type = ( fog == nil ) ? plFogEnvironment::kNoFog : fog->GetType(); if (type == plFogEnvironment::kNoFog) { @@ -5405,7 +5404,7 @@ void plDXPipeline::ISetFogParameters(const plSpan* span, const plLayerInterface* fCurrFog.fIsShader = isShader; fCurrFog.fIsVertex = isVertex; - hsScalar startOrDensity, end; + float startOrDensity, end; hsColorRGBA color; /// Get params @@ -5524,7 +5523,7 @@ hsBool plDXPipeline::StencilEnable( hsBool enable ) //// StencilSetCompareFunc //////////////////////////////////////////////////// -void plDXPipeline::StencilSetCompareFunc( UInt8 func, UInt32 refValue ) +void plDXPipeline::StencilSetCompareFunc( uint8_t func, uint32_t refValue ) { D3DCMPFUNC newFunc; @@ -5557,7 +5556,7 @@ void plDXPipeline::StencilSetCompareFunc( UInt8 func, UInt32 refValue ) //// StencilSetMask /////////////////////////////////////////////////////////// -void plDXPipeline::StencilSetMask( UInt32 mask, UInt32 writeMask ) +void plDXPipeline::StencilSetMask( uint32_t mask, uint32_t writeMask ) { if( fStencil.fMask != mask ) { @@ -5574,7 +5573,7 @@ void plDXPipeline::StencilSetMask( UInt32 mask, UInt32 writeMask ) //// StencilSetOps //////////////////////////////////////////////////////////// -void plDXPipeline::StencilSetOps( UInt8 passOp, UInt8 failOp, UInt8 passButZFailOp ) +void plDXPipeline::StencilSetOps( uint8_t passOp, uint8_t failOp, uint8_t passButZFailOp ) { D3DSTENCILOP op; @@ -5702,7 +5701,7 @@ hsBool plDXPipeline::StencilGetCaps( plStencilCaps *caps ) // as well as attached to the light. hsGDeviceRef *plDXPipeline::IMakeLightRef( plLightInfo *owner ) { - plDXLightRef *lRef = TRACKED_NEW plDXLightRef(); + plDXLightRef *lRef = new plDXLightRef(); /// Assign stuff and update @@ -5922,7 +5921,7 @@ void plDXPipeline::IRestoreSpanLights() //// IScaleD3DLight /////////////////////////////////////////////////////////// // Scale the D3D light by the given scale factor, used for fading lights // in and out by importance. -void plDXPipeline::IScaleD3DLight( plDXLightRef *ref, hsScalar scale ) +void plDXPipeline::IScaleD3DLight( plDXLightRef *ref, float scale ) { scale = int(scale * 1.e1f) * 1.e-1f; if( ref->fScale != scale ) @@ -6011,9 +6010,9 @@ static inline D3DCOLORVALUE ColorMul(const D3DCOLORVALUE& c0, const hsColorRGBA& void plDXPipeline::ICalcLighting( const plLayerInterface *currLayer, const plSpan *currSpan ) { D3DMATERIAL9 mat; - static hsScalar diffScale = 1.f; - static hsScalar ambScale = 1.f; - UInt32 props; + static float diffScale = 1.f; + static float ambScale = 1.f; + uint32_t props; plProfile_Inc(MatLightState); @@ -6275,9 +6274,9 @@ void plDXLightSettings::Release() //// ReserveD3DIndex ////////////////////////////////////////////////////////// // Reserve a D3D light index. -UInt32 plDXLightSettings::ReserveD3DIndex() +uint32_t plDXLightSettings::ReserveD3DIndex() { - for( ; fNextIndex < (UInt32)-1; fNextIndex++ ) + for( ; fNextIndex < (uint32_t)-1; fNextIndex++ ) { if( !fUsedFlags.IsBitSet( fNextIndex ) ) break; @@ -6295,7 +6294,7 @@ UInt32 plDXLightSettings::ReserveD3DIndex() //// ReleaseD3DIndex ////////////////////////////////////////////////////////// // Release a reserved D3D light index to be reused. -void plDXLightSettings::ReleaseD3DIndex( UInt32 idx ) +void plDXLightSettings::ReleaseD3DIndex( uint32_t idx ) { fUsedFlags.SetBit( idx, false ); if( fNextIndex > idx ) @@ -6317,7 +6316,7 @@ void plDXLightSettings::ReleaseD3DIndex( UInt32 idx ) //// ISetLayer //////////////////////////////////////////////////////////////// // Sets whether we're rendering a base layer or upper layer. Upper layer has // a Z bias to avoid Z fighting. -void plDXPipeline::ISetLayer( UInt32 lay ) +void plDXPipeline::ISetLayer( uint32_t lay ) { if( lay ) { @@ -6522,7 +6521,7 @@ void plDXPipeline::IPopPiggyBacks() // index not yet used. (I.e. if we ate layers 0 and 1, it'll return 2). // A return value of -1 means don't bother rendering. -Int32 plDXPipeline::IHandleMaterial( hsGMaterial *newMat, UInt32 layer, const plSpan *currSpan ) +int32_t plDXPipeline::IHandleMaterial( hsGMaterial *newMat, uint32_t layer, const plSpan *currSpan ) { // No material means no draw. if( !newMat && newMat->GetLayer(layer) ) @@ -6554,7 +6553,7 @@ Int32 plDXPipeline::IHandleMaterial( hsGMaterial *newMat, UInt32 layer, const if( !fForceMatHandle && (newMat == fCurrMaterial && layer == fCurrLayerIdx) ) { // Before returning, check if we have to redo our lighting - UInt32 lightType = ( currSpan != nil ) ? ( currSpan->fProps & plSpan::kLiteMask ) : plSpan::kLiteMaterial; + uint32_t lightType = ( currSpan != nil ) ? ( currSpan->fProps & plSpan::kLiteMask ) : plSpan::kLiteMaterial; if( lightType != fCurrLightingMethod ) ICalcLighting( fCurrLay, currSpan ); @@ -6651,7 +6650,7 @@ Int32 plDXPipeline::IHandleMaterial( hsGMaterial *newMat, UInt32 layer, const // way to handle this would be to have a different handler based on whether we are 2 TMU limited // or not, but whatever. if( fLayerState[1].fBlendFlags & (hsGMatState::kBlendNoTexAlpha | hsGMatState::kBlendNoTexColor) ) - fLayerState[1].fBlendFlags = UInt32(-1); + fLayerState[1].fBlendFlags = uint32_t(-1); } // Placed here, since it's material-dependent (or more accurately, current-layer-dependent) @@ -6785,7 +6784,7 @@ const hsGMatState& plDXPipeline::ICompositeLayerState(int which, plLayerInterfac { fOldLayerState[which] = fLayerState[which]; fLayerState[which].Composite(layer->GetState(), fMatOverOn, fMatOverOff); - if( fOldLayerState[which].fBlendFlags == UInt32(-1) ) + if( fOldLayerState[which].fBlendFlags == uint32_t(-1) ) fOldLayerState[which].fBlendFlags = ~fLayerState[which].fBlendFlags; return fLayerState[which]; @@ -6871,7 +6870,7 @@ void plDXPipeline::IHandleMiscMode() //// IHandleTextureStage ////////////////////////////////////////////////////// // Issue D3D calls to enable rendering the given layer at the given texture stage. -void plDXPipeline::IHandleTextureStage( UInt32 stage, plLayerInterface *layer ) +void plDXPipeline::IHandleTextureStage( uint32_t stage, plLayerInterface *layer ) { hsGDeviceRef *ref = nil; plBitmap *texture; @@ -6950,10 +6949,10 @@ void plDXPipeline::CheckTextureRef(plLayerInterface* layer) // This has never been used in production assets, because I never got // a good effect out of it, and BUMPENVMAPLUMINANCE isn't universally // supported in hardware. -void plDXPipeline::IHandleBumpEnv(int stage, UInt32 blendFlags) +void plDXPipeline::IHandleBumpEnv(int stage, uint32_t blendFlags) { DWORD current = stage ? D3DTA_CURRENT : D3DTA_DIFFUSE; - UInt32 colorSrc = blendFlags & hsGMatState::kBlendInvertColor ? D3DTA_TEXTURE | D3DTA_COMPLEMENT : D3DTA_TEXTURE; + uint32_t colorSrc = blendFlags & hsGMatState::kBlendInvertColor ? D3DTA_TEXTURE | D3DTA_COMPLEMENT : D3DTA_TEXTURE; fD3DDevice->SetTextureStageState(stage, D3DTSS_COLOROP, D3DTOP_BUMPENVMAPLUMINANCE); fD3DDevice->SetTextureStageState(stage, D3DTSS_COLORARG1, colorSrc); @@ -6976,7 +6975,7 @@ void plDXPipeline::IHandleBumpEnv(int stage, UInt32 blendFlags) // Translate current blend state for this stage into D3D settings. void plDXPipeline::IHandleStageBlend(int stage) { - const UInt32 blendFlags = fLayerState[stage].fBlendFlags; + const uint32_t blendFlags = fLayerState[stage].fBlendFlags; // If it's the base layer, handle that differently, because it's not really // texture stage settings, but frame buffer blend settings. if( stage == 0 ) @@ -6985,7 +6984,7 @@ void plDXPipeline::IHandleStageBlend(int stage) return; } - UInt32 colorSrc = D3DTA_TEXTURE; + uint32_t colorSrc = D3DTA_TEXTURE; if( blendFlags & hsGMatState::kBlendInvertColor ) colorSrc |= D3DTA_COMPLEMENT ; // kBlendEnvBumpNext not really used. @@ -7332,7 +7331,7 @@ void plDXPipeline::IHandleFirstStageBlend() // become apparent. if( fLayerState[0].Differs( fLayerState[0].fBlendFlags, fOldLayerState[0].fBlendFlags, hsGMatState::kBlendAlphaTestHigh) ) { - plConst(UInt32) kHighAlphaTest(0x40); + plConst(uint32_t) kHighAlphaTest(0x40); if( fLayerState[0].fBlendFlags & hsGMatState::kBlendAlphaTestHigh ) fD3DDevice->SetRenderState(D3DRS_ALPHAREF, kHighAlphaTest); else @@ -7414,7 +7413,7 @@ void plDXPipeline::IHandleTextureMode(plLayerInterface* layer) // If our NoTexColor setting has changed, for a refresh of blend state on the next stage // since it's affected by our NoTexColor state. if( fLayerState[0].Differs( fLayerState[0].fBlendFlags, fOldLayerState[0].fBlendFlags, hsGMatState::kBlendNoTexColor) ) - fLayerState[1].fBlendFlags = UInt32(-1); + fLayerState[1].fBlendFlags = uint32_t(-1); } // Alpha Arg1 is texture alpha (possibly complemented), and Arg2 is diffuse (possibly complemented). @@ -7450,7 +7449,7 @@ void plDXPipeline::IHandleTextureMode(plLayerInterface* layer) fD3DDevice->SetTextureStageState(0, D3DTSS_COLORARG1, D3DTA_DIFFUSE); fD3DDevice->SetTextureStageState(0, D3DTSS_ALPHAARG1, D3DTA_DIFFUSE); if( fLayerState[0].Differs( fLayerState[0].fBlendFlags, fOldLayerState[0].fBlendFlags, (hsGMatState::kBlendNoTexColor|hsGMatState::kBlendNoTexAlpha)) ) - fLayerState[1].fBlendFlags = UInt32(-1); + fLayerState[1].fBlendFlags = uint32_t(-1); fTexturing = false; } // Finally, a color only (non-textured) pass. Just select diffuse. @@ -7475,7 +7474,7 @@ void plDXPipeline::IHandleTextureMode(plLayerInterface* layer) // Translate our current wrap/clamp mode to D3D calls. void plDXPipeline::IHandleStageClamp(int stage) { - const UInt32 flags = fLayerState[stage].fClampFlags; + const uint32_t flags = fLayerState[stage].fClampFlags; switch( flags ) { case 0: @@ -7630,15 +7629,15 @@ void plDXPipeline::ISetBumpMatrices(const plLayerInterface* layer, const plSpan* hsVector3 liDir(0,0,0); int i; const hsTArray& spanLights = span->GetLightList(false); - hsScalar maxStrength = 0; + float maxStrength = 0; for( i = 0; i < spanLights.GetCount(); i++ ) { - hsScalar liWgt = span->GetLightStrength(i, false); + float liWgt = span->GetLightStrength(i, false); // A light strength of 2.f means it's from a light group, and we haven't actually calculated // the strength. So calculate it now. if( liWgt == 2.f ) { - hsScalar scale; + float scale; spanLights[i]->GetStrengthAndScale(span->fWorldBounds, liWgt, scale); } if( liWgt > maxStrength ) @@ -7647,16 +7646,16 @@ void plDXPipeline::ISetBumpMatrices(const plLayerInterface* layer, const plSpan* } hsFastMath::NormalizeAppr(liDir); - static hsScalar kUVWScale = 1.f; - hsScalar uvwScale = kUVWScale; + static float kUVWScale = 1.f; + float uvwScale = kUVWScale; if( fLayerState[0].fBlendFlags & hsGMatState::kBlendAdd ) { hsVector3 cam2span(&GetViewPositionWorld(), &spanPos); hsFastMath::NormalizeAppr(cam2span); liDir += cam2span; hsFastMath::NormalizeAppr(liDir); - static hsScalar kSpecularMax = 0.1f; - static hsScalar kSpecularMaxUV = 0.5f; + static float kSpecularMax = 0.1f; + static float kSpecularMaxUV = 0.5f; if (IsDebugFlagSet(plPipeDbg::kFlagBumpUV)) uvwScale *= kSpecularMaxUV; else @@ -7680,11 +7679,11 @@ void plDXPipeline::ISetBumpMatrices(const plLayerInterface* layer, const plSpan* maxStrength = 1.f; liDir *= uvwScale * maxStrength; - const hsScalar kUVWOffset = 0.5f; + const float kUVWOffset = 0.5f; - hsScalar kOffsetToRed; - hsScalar kOffsetToGreen; - hsScalar kOffsetToBlue; + float kOffsetToRed; + float kOffsetToGreen; + float kOffsetToBlue; if (IsDebugFlagSet(plPipeDbg::kFlagBumpUV) || IsDebugFlagSet(plPipeDbg::kFlagBumpW)) { @@ -7741,7 +7740,7 @@ void plDXPipeline::ISetBumpMatrices(const plLayerInterface* layer, const plSpan* // IGetBumpMatrix /////////////////////////////////////////////////////// // Return the correct uvw transform for the bump map channel implied // in the miscFlags. The matrices have been previously set in ISetBumpMatrices. -const hsMatrix44& plDXPipeline::IGetBumpMatrix(UInt32 miscFlags) const +const hsMatrix44& plDXPipeline::IGetBumpMatrix(uint32_t miscFlags) const { switch( miscFlags & hsGMatState::kMiscBumpChans ) { @@ -7761,7 +7760,7 @@ const hsMatrix44& plDXPipeline::IGetBumpMatrix(UInt32 miscFlags) const // If skipping, we advance past the bump layers. // If there are no more layers after that, we return true (to abort further rendering of currSpan), // else false to continue rendering. -hsBool plDXPipeline::ISkipBumpMap(hsGMaterial* newMat, UInt32& layer, const plSpan* currSpan) const +hsBool plDXPipeline::ISkipBumpMap(hsGMaterial* newMat, uint32_t& layer, const plSpan* currSpan) const { if( newMat && currSpan ) { @@ -7807,7 +7806,7 @@ void plDXPipeline::IHandleStageTransform( int stage, plLayerInterface *layer // This is just a rotation about X of Pi/2 (y = z, z = -y), // followed by flipping Z to reflect back towards us (z = -z). - hsScalar t = c2env.fMap[1][0]; + float t = c2env.fMap[1][0]; c2env.fMap[1][0] = c2env.fMap[2][0]; c2env.fMap[2][0] = t; @@ -7831,7 +7830,7 @@ void plDXPipeline::IHandleStageTransform( int stage, plLayerInterface *layer // This is just a rotation about X of Pi/2 (y = z, z = -y), // followed by NOT flipping Z to reflect back towards us (z = -z). // In other words, same as reflection, but then c2env = c2env * scaleMatNegateZ. - hsScalar t = c2env.fMap[1][0]; + float t = c2env.fMap[1][0]; c2env.fMap[1][0] = c2env.fMap[2][0]; c2env.fMap[2][0] = t; @@ -7848,7 +7847,7 @@ void plDXPipeline::IHandleStageTransform( int stage, plLayerInterface *layer c2env.fMap[2][2] = -c2env.fMap[2][2]; #if 0 - const hsScalar kFishEyeScale = 0.5f; + const float kFishEyeScale = 0.5f; // You can adjust the fish-eye-ness of this by scaling // X and Y as well. Eventually, you wind up with the same // as c2env * scaleMatXYAndNegateZ, but this is shorter. @@ -7883,7 +7882,7 @@ void plDXPipeline::IHandleStageTransform( int stage, plLayerInterface *layer // The scale and trans move us from NDC to Screen space. We need to swap // the Z and W coordinates so that the texture projection will divide by W // and give us projected 2D coordinates. - hsScalar temp = p2s.fMap[2][2]; + float temp = p2s.fMap[2][2]; p2s.fMap[2][2] = p2s.fMap[3][2]; p2s.fMap[3][2] = temp; @@ -7949,9 +7948,9 @@ void plDXPipeline::IHandleStageTransform( int stage, plLayerInterface *layer void plDXPipeline::IUseTextureRef( int stage, hsGDeviceRef *dRef, plLayerInterface* layer ) { plDXTextureRef *ref = (plDXTextureRef *)dRef; - UInt32 xformFlags; + uint32_t xformFlags; - UInt32 uvwSrc = layer->GetUVWSrc(); + uint32_t uvwSrc = layer->GetUVWSrc(); // Keep track of how much managed memory has been "seen" since the last // evict, for that NVidia bug. Look for OSVERSIONINFO for more notes. @@ -8032,7 +8031,7 @@ void plDXPipeline::IUseTextureRef( int stage, hsGDeviceRef *dRef, plLayerInte // c) we have 3 or more stages active. Append a modulation by diffuse // Note that this only applies to color, because diffuse alpha is always modulated // in from the start. -void plDXPipeline::IStageStop( UInt32 stage ) +void plDXPipeline::IStageStop( uint32_t stage ) { int disableStage = stage; @@ -8042,7 +8041,7 @@ void plDXPipeline::IStageStop( UInt32 stage ) { fD3DDevice->SetTextureStageState(stage, D3DTSS_COLOROP, D3DTOP_DISABLE); fD3DDevice->SetTextureStageState(stage, D3DTSS_ALPHAOP, D3DTOP_DISABLE); - fLayerState[ stage ].fBlendFlags = UInt32(-1); + fLayerState[ stage ].fBlendFlags = uint32_t(-1); disableStage = stage; } else if( stage == 2 ) @@ -8068,8 +8067,8 @@ void plDXPipeline::IStageStop( UInt32 stage ) fD3DDevice->SetTextureStageState(2, D3DTSS_ALPHAOP, D3DTOP_DISABLE); - fLayerState[2].fBlendFlags = UInt32(-1); - fLayerState[3].fBlendFlags = UInt32(-1); + fLayerState[2].fBlendFlags = uint32_t(-1); + fLayerState[3].fBlendFlags = uint32_t(-1); } else { @@ -8087,10 +8086,10 @@ void plDXPipeline::IStageStop( UInt32 stage ) fD3DDevice->SetTextureStageState(stage, D3DTSS_COLORARG2, D3DTA_CURRENT); fD3DDevice->SetTextureStageState(stage, D3DTSS_ALPHAOP, D3DTOP_DISABLE); - fLayerState[stage].fBlendFlags = UInt32(-1); + fLayerState[stage].fBlendFlags = uint32_t(-1); fD3DDevice->SetTextureStageState(stage+1, D3DTSS_COLOROP, D3DTOP_DISABLE); - fLayerState[stage+1].fBlendFlags = UInt32(-1); + fLayerState[stage+1].fBlendFlags = uint32_t(-1); disableStage = stage+1; } @@ -8173,7 +8172,7 @@ void plDXPipeline::IInvalidateState() //// ILayersAtOnce //////////////////////////////////////////////////////////// // Compute how many of the upcoming layers we can render in a single pass on the // current hardware. -UInt32 plDXPipeline::ILayersAtOnce( hsGMaterial *mat, UInt32 which ) +uint32_t plDXPipeline::ILayersAtOnce( hsGMaterial *mat, uint32_t which ) { fCurrNumLayers = 1; @@ -8251,7 +8250,7 @@ hsBool plDXPipeline::ICanEatLayer( plLayerInterface* lay ) return false; if( (lay->GetBlendFlags() & hsGMatState::kBlendAlpha ) - &&(lay->GetAmbientColor().a < hsScalar1) ) + &&(lay->GetAmbientColor().a < 1.f) ) return false; if( !(lay->GetZFlags() & hsGMatState::kZNoZWrite) ) @@ -8320,7 +8319,7 @@ IDirect3DTexture9 *plDXPipeline::IMakeD3DTexture( plDXTextureRef *ref, D3DFORM void plDXPipeline::IFillD3DTexture( plDXTextureRef *ref ) { int i; - UInt8 *pTexDat = (UInt8 *)ref->fData; + uint8_t *pTexDat = (uint8_t *)ref->fData; if( pTexDat == nil ) @@ -8380,7 +8379,7 @@ void plDXPipeline::IFillD3DCubeTexture( plDXCubeTextureRef *ref ) for( f = 0; f < 6; f++ ) { - UInt8 *pTexDat = ( f == 0 ) ? (UInt8 *)ref->fData : (UInt8 *)ref->fFaceData[ f - 1 ]; + uint8_t *pTexDat = ( f == 0 ) ? (uint8_t *)ref->fData : (uint8_t *)ref->fFaceData[ f - 1 ]; IDirect3DCubeTexture9 *lpDst = (IDirect3DCubeTexture9 *)ref->fD3DTexture; for( i = 0; i < ref->fMMLvs; i++ ) @@ -8421,13 +8420,13 @@ hsGDeviceRef *plDXPipeline::MakeTextureRef( plLayerInterface* layer, plMipmap b = hsCodecManager::Instance().CreateUncompressedMipmap( b, hsCodecManager::k16BitDepth ); /// Set up some stuff - UInt32 mmlvs = 1; + uint32_t mmlvs = 1; D3DFORMAT formatType = D3DFMT_UNKNOWN; // D3D Format - UInt32 formatSize = 0; - UInt32 totalSize = 0; - UInt32* levelSizes = nil; - UInt32 numPix = 0; - UInt32 externData = false; + uint32_t formatSize = 0; + uint32_t totalSize = 0; + uint32_t* levelSizes = nil; + uint32_t numPix = 0; + uint32_t externData = false; void *tData; hsBool noMip = !(fSettings.fD3DCaps & kCapsMipmap); @@ -8446,7 +8445,7 @@ hsGDeviceRef *plDXPipeline::MakeTextureRef( plLayerInterface* layer, plMipmap plDXTextureRef *ref = (plDXTextureRef *)b->GetDeviceRef(); if( !ref ) { - ref = TRACKED_NEW plDXTextureRef( formatType, + ref = new plDXTextureRef( formatType, mmlvs, b->GetWidth(), b->GetHeight(), numPix, totalSize, totalSize, levelSizes, tData, externData ); @@ -8511,12 +8510,12 @@ hsGDeviceRef *plDXPipeline::IMakeCubicTextureRef( plLayerInterface* layer, pl plMipmap *faces[ 6 ]; int i; D3DFORMAT formatType = D3DFMT_UNKNOWN; - UInt32 formatSize = 0; - UInt32 numLevels = 1; - UInt32 totalSize = 0; - UInt32 *levelSizes = nil; - UInt32 numPixels = 0; - UInt32 externData; + uint32_t formatSize = 0; + uint32_t numLevels = 1; + uint32_t totalSize = 0; + uint32_t *levelSizes = nil; + uint32_t numPixels = 0; + uint32_t externData; void *textureData[ 6 ]; if( cubic == nil || !( fSettings.fD3DCaps & kCapsCubicTextures ) ) @@ -8565,7 +8564,7 @@ hsGDeviceRef *plDXPipeline::IMakeCubicTextureRef( plLayerInterface* layer, pl ref = (plDXCubeTextureRef *)cubic->GetDeviceRef(); if( !ref ) { - ref = TRACKED_NEW plDXCubeTextureRef( formatType, + ref = new plDXCubeTextureRef( formatType, numLevels, faces[ 0 ]->GetWidth(), faces[ 0 ]->GetHeight(), numPixels, totalSize, totalSize * 6, levelSizes, textureData[ 0 ], externData ); @@ -8621,13 +8620,13 @@ hsGDeviceRef *plDXPipeline::IMakeCubicTextureRef( plLayerInterface* layer, pl // Compute proper values for the arguments passed in. // Return true if the data returned points directly into the mipmap data, // return false if textureData is a reformatted copy of the mipmap's data. -hsBool plDXPipeline::IProcessMipmapLevels( plMipmap *mipmap, UInt32 &numLevels, - UInt32 *&levelSizes, UInt32 &totalSize, - UInt32 &numPixels, void *&textureData, hsBool noMip ) +hsBool plDXPipeline::IProcessMipmapLevels( plMipmap *mipmap, uint32_t &numLevels, + uint32_t *&levelSizes, uint32_t &totalSize, + uint32_t &numPixels, void *&textureData, hsBool noMip ) { hsBool externData = false; D3DFORMAT formatType = D3DFMT_UNKNOWN; // D3D Format - UInt32 formatSize; + uint32_t formatSize; IGetD3DTextureFormat( mipmap, formatType, formatSize ); @@ -8644,7 +8643,7 @@ hsBool plDXPipeline::IProcessMipmapLevels( plMipmap *mipmap, UInt32 &numLevels, } else { - UInt32 sizeMask = 0x03; + uint32_t sizeMask = 0x03; /// 10.31.2000 - If we have this flag set, we really have to cut out /// sizes under 8x8. So far only true on the KYRO... @@ -8669,7 +8668,7 @@ hsBool plDXPipeline::IProcessMipmapLevels( plMipmap *mipmap, UInt32 &numLevels, mipmap->SetCurrLevel( 0 ); totalSize = 0; numLevels = maxLevel + 1; - levelSizes = TRACKED_NEW UInt32[ numLevels ]; + levelSizes = new uint32_t[ numLevels ]; int i; for( i = 0; i < numLevels; i++ ) { @@ -8693,10 +8692,10 @@ hsBool plDXPipeline::IProcessMipmapLevels( plMipmap *mipmap, UInt32 &numLevels, numPixels = mipmap->GetTotalSize() * 8 / mipmap->GetPixelSize(); numLevels = mipmap->GetNumLevels(); - levelSizes = TRACKED_NEW UInt32[ numLevels ]; + levelSizes = new uint32_t[ numLevels ]; int i; - UInt32 w, h; + uint32_t w, h; for( i = 0; i < numLevels; i++ ) { mipmap->GetLevelPtr( i, &w, &h ); @@ -8724,10 +8723,10 @@ hsBool plDXPipeline::IProcessMipmapLevels( plMipmap *mipmap, UInt32 &numLevels, //// IGetPixelScratch ///////////////////////////////////////////////////////// // Return scratch space at least of at least size bytes, to reformat a mipmap into. -void *plDXPipeline::IGetPixelScratch( UInt32 size ) +void *plDXPipeline::IGetPixelScratch( uint32_t size ) { static char *sPtr = nil; - static UInt32 sSize = 0; + static uint32_t sSize = 0; if( size > sSize ) { @@ -8735,7 +8734,7 @@ void *plDXPipeline::IGetPixelScratch( UInt32 size ) delete [] sPtr; if( size > 0 ) - sPtr = TRACKED_NEW char[ sSize = size ]; + sPtr = new char[ sSize = size ]; else sPtr = nil; } @@ -8754,7 +8753,7 @@ void *plDXPipeline::IGetPixelScratch( UInt32 size ) //// IGetD3DTextureFormat ///////////////////////////////////////////////////// // Given a bitmap, finds the matching D3D format. -void plDXPipeline::IGetD3DTextureFormat( plBitmap *b, D3DFORMAT &formatType, UInt32& texSize ) +void plDXPipeline::IGetD3DTextureFormat( plBitmap *b, D3DFORMAT &formatType, uint32_t& texSize ) { hsAssert( b, "Nil input to GetTextureFormat()" ); @@ -8905,13 +8904,13 @@ void plDXPipeline::IGetD3DTextureFormat( plBitmap *b, D3DFORMAT &formatType, //// IFormatTextureData /////////////////////////////////////////////////////// // Convert the input 32 bit uncompressed RGBA data into the requested format. -void plDXPipeline::IFormatTextureData( UInt32 formatType, UInt32 numPix, hsRGBAColor32* const src, void *dst ) +void plDXPipeline::IFormatTextureData( uint32_t formatType, uint32_t numPix, hsRGBAColor32* const src, void *dst ) { switch( formatType ) { case D3DFMT_L6V5U5: { - UInt16 *pixels = (UInt16 *)dst; + uint16_t *pixels = (uint16_t *)dst; hsRGBAColor32* p = src; hsRGBAColor32* end = src + numPix; @@ -8937,7 +8936,7 @@ void plDXPipeline::IFormatTextureData( UInt32 formatType, UInt32 numPix, hsRG case D3DFMT_V8U8: { - UInt16 *pixels = (UInt16 *)dst; + uint16_t *pixels = (uint16_t *)dst; hsRGBAColor32* p = src; hsRGBAColor32* end = src + numPix; @@ -8953,7 +8952,7 @@ void plDXPipeline::IFormatTextureData( UInt32 formatType, UInt32 numPix, hsRG case D3DFMT_A8L8: { - UInt16 *pixels = (UInt16 *)dst; + uint16_t *pixels = (uint16_t *)dst; int i; hsRGBAColor32* const p = src; @@ -8964,7 +8963,7 @@ void plDXPipeline::IFormatTextureData( UInt32 formatType, UInt32 numPix, hsRG case D3DFMT_A4R4G4B4: { - UInt16 *pixels = (UInt16 *)dst; + uint16_t *pixels = (uint16_t *)dst; int i; hsRGBAColor32* const p = src; @@ -8980,7 +8979,7 @@ void plDXPipeline::IFormatTextureData( UInt32 formatType, UInt32 numPix, hsRG case D3DFMT_A1R5G5B5: { - UInt16 *pixels = (UInt16 *)dst; + uint16_t *pixels = (uint16_t *)dst; int i; hsRGBAColor32* const p = src; @@ -8995,7 +8994,7 @@ void plDXPipeline::IFormatTextureData( UInt32 formatType, UInt32 numPix, hsRG case D3DFMT_L8: { - UInt8 *pixels = (UInt8 *)dst; + uint8_t *pixels = (uint8_t *)dst; int i; hsRGBAColor32* const p = src; @@ -9006,7 +9005,7 @@ void plDXPipeline::IFormatTextureData( UInt32 formatType, UInt32 numPix, hsRG case D3DFMT_A8R8G8B8: { - UInt32 *pixels = (UInt32 *)dst; + uint32_t *pixels = (uint32_t *)dst; int i; hsRGBAColor32* const p = src; @@ -9091,7 +9090,7 @@ void plDXPipeline::GetViewAxesWorld(hsVector3 axes[3] /* ac,up,at */ ) const //// GetFOV /////////////////////////////////////////////////////////////////// // Get the current FOV in degrees. -void plDXPipeline::GetFOV(hsScalar& fovX, hsScalar& fovY) const +void plDXPipeline::GetFOV(float& fovX, float& fovY) const { fovX = GetViewTransform().GetFovXDeg(); fovY = GetViewTransform().GetFovYDeg(); @@ -9099,14 +9098,14 @@ void plDXPipeline::GetFOV(hsScalar& fovX, hsScalar& fovY) const //// SetFOV /////////////////////////////////////////////////////////////////// // Set the current FOV in degrees. Forces perspective rendering to be true. -void plDXPipeline::SetFOV( hsScalar fovX, hsScalar fovY ) +void plDXPipeline::SetFOV( float fovX, float fovY ) { IGetViewTransform().SetFovDeg(fovX, fovY); IGetViewTransform().SetPerspective(true); } // Get the orthogonal projection view size in world units (e.g. feet). -void plDXPipeline::GetSize( hsScalar& width, hsScalar& height ) const +void plDXPipeline::GetSize( float& width, float& height ) const { width = GetViewTransform().GetScreenWidth(); height = GetViewTransform().GetScreenHeight(); @@ -9114,7 +9113,7 @@ void plDXPipeline::GetSize( hsScalar& width, hsScalar& height ) const // Set the orthogonal projection view size in world units (e.g. feet). // Forces projection to orthogonal if it wasn't. -void plDXPipeline::SetSize( hsScalar width, hsScalar height ) +void plDXPipeline::SetSize( float width, float height ) { IGetViewTransform().SetWidth(width); IGetViewTransform().SetHeight(height); @@ -9123,14 +9122,14 @@ void plDXPipeline::SetSize( hsScalar width, hsScalar height ) //// GetDepth ///////////////////////////////////////////////////////////////// // Get the current hither and yon. -void plDXPipeline::GetDepth(hsScalar& hither, hsScalar& yon) const +void plDXPipeline::GetDepth(float& hither, float& yon) const { GetViewTransform().GetDepth(hither, yon); } //// SetDepth ///////////////////////////////////////////////////////////////// // Set the current hither and yon. -void plDXPipeline::SetDepth(hsScalar hither, hsScalar yon) +void plDXPipeline::SetDepth(float hither, float yon) { IGetViewTransform().SetDepth(hither, yon); } @@ -9141,7 +9140,7 @@ void plDXPipeline::SetDepth(hsScalar hither, hsScalar yon) // Obsolete since we don't support the Savage4 chipset any more. void plDXPipeline::ISavageYonHack() { - hsScalar yon = GetViewTransform().GetYon(); + float yon = GetViewTransform().GetYon(); if( ( yon > 128.f - 5.0f ) && ( yon < 128.f + 1.01f ) ) @@ -9212,7 +9211,7 @@ void plDXPipeline::SetViewTransform(const plViewTransform& v) if( !v.GetScreenWidth() || !v.GetScreenHeight() ) { - fView.fTransform.SetScreenSize((UInt16)(fSettings.fOrigWidth), (UInt16)(fSettings.fOrigHeight)); + fView.fTransform.SetScreenSize((uint16_t)(fSettings.fOrigWidth), (uint16_t)(fSettings.fOrigHeight)); } IUpdateViewFlags(); @@ -9284,7 +9283,7 @@ hsBool plDXPipeline::IIsViewLeftHanded() // Given a screen space pixel position, and a world space distance from the camera, return a // full world space position. I.e. cast a ray through a screen pixel dist feet, and where // is it. -void plDXPipeline::ScreenToWorldPoint( int n, UInt32 stride, Int32 *scrX, Int32 *scrY, hsScalar dist, UInt32 strideOut, hsPoint3 *worldOut ) +void plDXPipeline::ScreenToWorldPoint( int n, uint32_t stride, int32_t *scrX, int32_t *scrY, float dist, uint32_t strideOut, hsPoint3 *worldOut ) { while( n-- ) { @@ -9359,14 +9358,14 @@ void plDXPipeline::IMakeOcclusionSnap() hsTArray& pos = fView.fCullTree.GetCaptureVerts(); hsTArray& norm = fView.fCullTree.GetCaptureNorms(); hsTArray& color = fView.fCullTree.GetCaptureColors(); - hsTArray& tris = fView.fCullTree.GetCaptureTris(); + hsTArray& tris = fView.fCullTree.GetCaptureTris(); if( tris.GetCount() ) { hsMatrix44 ident; ident.Reset(); - hsGMaterial* mat = TRACKED_NEW hsGMaterial; + hsGMaterial* mat = new hsGMaterial; hsgResMgr::ResMgr()->NewKey( _TEMP_CONVERT_FROM_LITERAL("OcclusionSnapMat"), mat, plLocation::kGlobalFixedLoc ); plLayer *lay = mat->MakeBaseLayer(); lay->SetZFlags(hsGMatState::kZNoZWrite); @@ -9484,14 +9483,14 @@ hsGMaterial *plDXPipeline::GetOverrideMaterial() const //// GetMaterialOverrideOn //////////////////////////////////////////////////// // Return the current bits set to be always on for the given category (e.g. ZFlags). -UInt32 plDXPipeline::GetMaterialOverrideOn( hsGMatState::StateIdx category ) const +uint32_t plDXPipeline::GetMaterialOverrideOn( hsGMatState::StateIdx category ) const { return fMatOverOn.Value(category); } //// GetMaterialOverrideOff /////////////////////////////////////////////////// // Return the current bits set to be always off for the given category (e.g. ZFlags). -UInt32 plDXPipeline::GetMaterialOverrideOff( hsGMatState::StateIdx category ) const +uint32_t plDXPipeline::GetMaterialOverrideOff( hsGMatState::StateIdx category ) const { return fMatOverOff.Value(category); } @@ -9520,7 +9519,7 @@ hsGMatState plDXPipeline::PushMaterialOverride( const hsGMatState& state, hsBool // Force material state bits on or off. If you use this, save the return value // as input to PopMaterialOverride, to restore previous values. // This version just sets for one category (e.g. Z flags). -hsGMatState plDXPipeline::PushMaterialOverride(hsGMatState::StateIdx cat, UInt32 which, hsBool on) +hsGMatState plDXPipeline::PushMaterialOverride(hsGMatState::StateIdx cat, uint32_t which, hsBool on) { hsGMatState ret = GetMaterialOverride( on ); if( on ) @@ -9754,12 +9753,12 @@ void plDXPipeline::ITransformsToD3D() // ISetupVertexBufferRef ///////////////////////////////////////////////////////// // Initialize input vertex buffer ref according to source. -void plDXPipeline::ISetupVertexBufferRef(plGBufferGroup* owner, UInt32 idx, plDXVertexBufferRef* vRef) +void plDXPipeline::ISetupVertexBufferRef(plGBufferGroup* owner, uint32_t idx, plDXVertexBufferRef* vRef) { // Initialize to nil, in case something goes wrong. vRef->fD3DBuffer = nil; - UInt8 format = owner->GetVertexFormat(); + uint8_t format = owner->GetVertexFormat(); // All indexed skinning is currently done on CPU, so the source data // will have indices, but we strip them out for the D3D buffer. @@ -9771,8 +9770,8 @@ void plDXPipeline::ISetupVertexBufferRef(plGBufferGroup* owner, UInt32 idx, plDX vRef->SetVolatile(true); } - UInt32 vertSize = IGetBufferFormatSize(format); // vertex stride - UInt32 numVerts = owner->GetVertBufferCount(idx); + uint32_t vertSize = IGetBufferFormatSize(format); // vertex stride + uint32_t numVerts = owner->GetVertBufferCount(idx); vRef->fDevice = fD3DDevice; @@ -9797,7 +9796,7 @@ void plDXPipeline::ISetupVertexBufferRef(plGBufferGroup* owner, UInt32 idx, plDX // ICheckStaticVertexBuffer /////////////////////////////////////////////////////////////////////// // Ensure a static vertex buffer has any D3D resources necessary for rendering created and filled // with proper vertex data. -void plDXPipeline::ICheckStaticVertexBuffer(plDXVertexBufferRef* vRef, plGBufferGroup* owner, UInt32 idx) +void plDXPipeline::ICheckStaticVertexBuffer(plDXVertexBufferRef* vRef, plGBufferGroup* owner, uint32_t idx) { hsAssert(!vRef->Volatile(), "Creating a managed vertex buffer for a volatile buffer ref"); @@ -9843,7 +9842,7 @@ void plDXPipeline::ICheckStaticVertexBuffer(plDXVertexBufferRef* vRef, plGBuffer // BufferRef is set up, just copy the data in. // This is uglied up hugely by the insane non-interleaved data case with cells // and whatever else. -void plDXPipeline::IFillStaticVertexBufferRef(plDXVertexBufferRef *ref, plGBufferGroup *group, UInt32 idx) +void plDXPipeline::IFillStaticVertexBufferRef(plDXVertexBufferRef *ref, plGBufferGroup *group, uint32_t idx) { IDirect3DVertexBuffer9* vertexBuff = ref->fD3DBuffer; @@ -9853,14 +9852,14 @@ void plDXPipeline::IFillStaticVertexBufferRef(plDXVertexBufferRef *ref, plGBuffe return; } - const UInt32 vertSize = ref->fVertexSize; - const UInt32 vertStart = group->GetVertBufferStart(idx) * vertSize; - const UInt32 size = group->GetVertBufferEnd(idx) * vertSize - vertStart; + const uint32_t vertSize = ref->fVertexSize; + const uint32_t vertStart = group->GetVertBufferStart(idx) * vertSize; + const uint32_t size = group->GetVertBufferEnd(idx) * vertSize - vertStart; if( !size ) return; /// Lock the buffer - UInt8* ptr; + uint8_t* ptr; if( FAILED( vertexBuff->Lock( vertStart, size, (void **)&ptr, group->AreVertsVolatile() ? D3DLOCK_DISCARD : 0 ) ) ) { hsAssert( false, "Failed to lock vertex buffer for writing" ); @@ -9875,8 +9874,8 @@ void plDXPipeline::IFillStaticVertexBufferRef(plDXVertexBufferRef *ref, plGBuffe hsAssert(0 == vertStart, "Offsets on non-interleaved data not supported"); hsAssert(group->GetVertBufferCount(idx) * vertSize == size, "Trailing dead space on non-interleaved data not supported"); - const UInt32 vertSmallSize = group->GetVertexLiteStride() - sizeof( hsPoint3 ) * 2; - UInt8* srcVPtr = group->GetVertBufferData(idx); + const uint32_t vertSmallSize = group->GetVertexLiteStride() - sizeof( hsPoint3 ) * 2; + uint8_t* srcVPtr = group->GetVertBufferData(idx); plGBufferColor* const srcCPtr = group->GetColorBufferData( idx ); const int numCells = group->GetNumCells(idx); @@ -9885,7 +9884,7 @@ void plDXPipeline::IFillStaticVertexBufferRef(plDXVertexBufferRef *ref, plGBuffe { plGBufferCell *cell = group->GetCell( idx, i ); - if( cell->fColorStart == (UInt32)-1 ) + if( cell->fColorStart == (uint32_t)-1 ) { /// Interleaved, do straight copy memcpy( ptr, srcVPtr + cell->fVtxStart, cell->fLength * vertSize ); @@ -9894,7 +9893,7 @@ void plDXPipeline::IFillStaticVertexBufferRef(plDXVertexBufferRef *ref, plGBuffe else { /// Separated, gotta interleave - UInt8* tempVPtr = srcVPtr + cell->fVtxStart; + uint8_t* tempVPtr = srcVPtr + cell->fVtxStart; plGBufferColor* tempCPtr = srcCPtr + cell->fColorStart; int j; for( j = 0; j < cell->fLength; j++ ) @@ -9903,10 +9902,10 @@ void plDXPipeline::IFillStaticVertexBufferRef(plDXVertexBufferRef *ref, plGBuffe ptr += sizeof( hsPoint3 ) * 2; tempVPtr += sizeof( hsPoint3 ) * 2; - memcpy( ptr, &tempCPtr->fDiffuse, sizeof( UInt32 ) ); - ptr += sizeof( UInt32 ); - memcpy( ptr, &tempCPtr->fSpecular, sizeof( UInt32 ) ); - ptr += sizeof( UInt32 ); + memcpy( ptr, &tempCPtr->fDiffuse, sizeof( uint32_t ) ); + ptr += sizeof( uint32_t ); + memcpy( ptr, &tempCPtr->fSpecular, sizeof( uint32_t ) ); + ptr += sizeof( uint32_t ); memcpy( ptr, tempVPtr, vertSmallSize ); ptr += vertSmallSize; @@ -9944,9 +9943,9 @@ hsBool plDXPipeline::OpenAccess(plAccessSpan& dst, plDrawableSpans* drawable, co return false; } - const UInt32 stride = vRef->fVertexSize; - const UInt32 vertStart = span->fVStartIdx * stride; - const UInt32 size = span->fVLength * stride; + const uint32_t stride = vRef->fVertexSize; + const uint32_t vertStart = span->fVStartIdx * stride; + const uint32_t size = span->fVLength * stride; if( !size ) { @@ -9956,7 +9955,7 @@ hsBool plDXPipeline::OpenAccess(plAccessSpan& dst, plDrawableSpans* drawable, co DWORD lockFlags = readOnly ? D3DLOCK_READONLY : 0; - UInt8* ptr; + uint8_t* ptr; if( FAILED( vertexBuff->Lock(vertStart, size, (void **)&ptr, lockFlags) ) ) { hsAssert( false, "Failed to lock vertex buffer for writing" ); @@ -9966,23 +9965,23 @@ hsBool plDXPipeline::OpenAccess(plAccessSpan& dst, plDrawableSpans* drawable, co plAccessVtxSpan& acc = dst.AccessVtx(); - acc.SetVertCount((UInt16)(span->fVLength)); + acc.SetVertCount((uint16_t)(span->fVLength)); - Int32 offset = (-(Int32)(span->fVStartIdx)) * ((Int32)stride); + int32_t offset = (-(int32_t)(span->fVStartIdx)) * ((int32_t)stride); - acc.PositionStream(ptr, (UInt16)stride, offset); + acc.PositionStream(ptr, (uint16_t)stride, offset); ptr += sizeof(hsPoint3); int numWgts = grp->GetNumWeights(); if( numWgts ) { acc.SetNumWeights(numWgts); - acc.WeightStream(ptr, (UInt16)stride, offset); - ptr += numWgts * sizeof(hsScalar); + acc.WeightStream(ptr, (uint16_t)stride, offset); + ptr += numWgts * sizeof(float); if( grp->GetVertexFormat() & plGBufferGroup::kSkinIndices ) { - acc.WgtIndexStream(ptr, (UInt16)stride, offset); - ptr += sizeof(UInt32); + acc.WgtIndexStream(ptr, (uint16_t)stride, offset); + ptr += sizeof(uint32_t); } else { @@ -9994,16 +9993,16 @@ hsBool plDXPipeline::OpenAccess(plAccessSpan& dst, plDrawableSpans* drawable, co acc.SetNumWeights(0); } - acc.NormalStream(ptr, (UInt16)stride, offset); + acc.NormalStream(ptr, (uint16_t)stride, offset); ptr += sizeof(hsVector3); - acc.DiffuseStream(ptr, (UInt16)stride, offset); - ptr += sizeof(UInt32); + acc.DiffuseStream(ptr, (uint16_t)stride, offset); + ptr += sizeof(uint32_t); - acc.SpecularStream(ptr, (UInt16)stride, offset); - ptr += sizeof(UInt32); + acc.SpecularStream(ptr, (uint16_t)stride, offset); + ptr += sizeof(uint32_t); - acc.UVWStream(ptr, (UInt16)stride, offset); + acc.UVWStream(ptr, (uint16_t)stride, offset); acc.SetNumUVWs(grp->GetNumUVs()); @@ -10036,7 +10035,7 @@ hsBool plDXPipeline::CloseAccess(plAccessSpan& dst) // CheckVertexBufferRef ///////////////////////////////////////////////////// // Make sure the buffer group has a valid buffer ref and that it is up to date. -void plDXPipeline::CheckVertexBufferRef(plGBufferGroup* owner, UInt32 idx) +void plDXPipeline::CheckVertexBufferRef(plGBufferGroup* owner, uint32_t idx) { // First, do we have a device ref at this index? plDXVertexBufferRef* vRef = (plDXVertexBufferRef*)owner->GetVertexBufferRef(idx); @@ -10044,7 +10043,7 @@ void plDXPipeline::CheckVertexBufferRef(plGBufferGroup* owner, UInt32 idx) if( !vRef ) { // Make the blank ref - vRef = TRACKED_NEW plDXVertexBufferRef; + vRef = new plDXVertexBufferRef; ISetupVertexBufferRef(owner, idx, vRef); @@ -10076,21 +10075,21 @@ void plDXPipeline::CheckVertexBufferRef(plGBufferGroup* owner, UInt32 idx) if( !vRef->fData && (vRef->fFormat != owner->GetVertexFormat()) ) { - vRef->fData = TRACKED_NEW UInt8[vRef->fCount * vRef->fVertexSize]; + vRef->fData = new uint8_t[vRef->fCount * vRef->fVertexSize]; } } } // CheckIndexBufferRef ///////////////////////////////////////////////////// // Make sure the buffer group has an index buffer ref and that its data is current. -void plDXPipeline::CheckIndexBufferRef(plGBufferGroup* owner, UInt32 idx) +void plDXPipeline::CheckIndexBufferRef(plGBufferGroup* owner, uint32_t idx) { plDXIndexBufferRef* iRef = (plDXIndexBufferRef*)owner->GetIndexBufferRef(idx); if( !iRef ) { // Create one from scratch. - iRef = TRACKED_NEW plDXIndexBufferRef; + iRef = new plDXIndexBufferRef; ISetupIndexBufferRef(owner, idx, iRef); @@ -10108,16 +10107,16 @@ void plDXPipeline::CheckIndexBufferRef(plGBufferGroup* owner, UInt32 idx) // IFillIndexBufferRef //////////////////////////////////////////////////////////// // Refresh the D3D index buffer from the plasma index buffer. -void plDXPipeline::IFillIndexBufferRef(plDXIndexBufferRef* iRef, plGBufferGroup* owner, UInt32 idx) +void plDXPipeline::IFillIndexBufferRef(plDXIndexBufferRef* iRef, plGBufferGroup* owner, uint32_t idx) { - UInt32 startIdx = owner->GetIndexBufferStart(idx); - UInt32 size = (owner->GetIndexBufferEnd(idx) - startIdx) * sizeof(UInt16); + uint32_t startIdx = owner->GetIndexBufferStart(idx); + uint32_t size = (owner->GetIndexBufferEnd(idx) - startIdx) * sizeof(uint16_t); if( !size ) return; DWORD lockFlags = iRef->Volatile() ? D3DLOCK_DISCARD : 0; - UInt16* destPtr = nil; - if( FAILED( iRef->fD3DBuffer->Lock(startIdx * sizeof(UInt16), size, (void **)&destPtr, lockFlags) ) ) + uint16_t* destPtr = nil; + if( FAILED( iRef->fD3DBuffer->Lock(startIdx * sizeof(uint16_t), size, (void **)&destPtr, lockFlags) ) ) { hsAssert( false, "Cannot lock index buffer for writing" ); return; @@ -10140,7 +10139,7 @@ void plDXPipeline::ICheckIndexBuffer(plDXIndexBufferRef* iRef) D3DPOOL poolType = fAllocUnManaged ? D3DPOOL_DEFAULT : D3DPOOL_MANAGED; DWORD usage = D3DUSAGE_WRITEONLY; iRef->SetVolatile(false); - if( FAILED( fD3DDevice->CreateIndexBuffer( sizeof( UInt16 ) * iRef->fCount, + if( FAILED( fD3DDevice->CreateIndexBuffer( sizeof( uint16_t ) * iRef->fCount, usage, D3DFMT_INDEX16, poolType, @@ -10150,7 +10149,7 @@ void plDXPipeline::ICheckIndexBuffer(plDXIndexBufferRef* iRef) iRef->fD3DBuffer = nil; return; } - PROFILE_POOL_MEM(poolType, sizeof(UInt16) * iRef->fCount, true, "IndexBuff"); + PROFILE_POOL_MEM(poolType, sizeof(uint16_t) * iRef->fCount, true, "IndexBuff"); iRef->fPoolType = poolType; iRef->SetDirty(true); @@ -10160,9 +10159,9 @@ void plDXPipeline::ICheckIndexBuffer(plDXIndexBufferRef* iRef) // ISetupIndexBufferRef //////////////////////////////////////////////////////////////// // Initialize the index buffer ref, but don't create anything for it. -void plDXPipeline::ISetupIndexBufferRef(plGBufferGroup* owner, UInt32 idx, plDXIndexBufferRef* iRef) +void plDXPipeline::ISetupIndexBufferRef(plGBufferGroup* owner, uint32_t idx, plDXIndexBufferRef* iRef) { - UInt32 numIndices = owner->GetIndexBufferCount(idx); + uint32_t numIndices = owner->GetIndexBufferCount(idx); iRef->fCount = numIndices; iRef->fOwner = owner; iRef->fIndex = idx; @@ -10184,7 +10183,7 @@ void plDXPipeline::ISetupIndexBufferRef(plGBufferGroup* owner, UInt32 idx, plDXI // In hardware, we want the opposite, to break it into managable chunks, manageable meaning // few enough matrices to fit into hardware registers. So for hardware version, we set up // our palette, draw a span or few, setup our matrix palette with new matrices, draw, repeat. -hsBool plDXPipeline::ISoftwareVertexBlend( plDrawableSpans* drawable, const hsTArray& visList ) +hsBool plDXPipeline::ISoftwareVertexBlend( plDrawableSpans* drawable, const hsTArray& visList ) { if (IsDebugFlagSet(plPipeDbg::kFlagNoSkinning)) return true; @@ -10243,7 +10242,7 @@ hsBool plDXPipeline::ISoftwareVertexBlend( plDrawableSpans* drawable, const hsAssert(vRef->fData, "Going into skinning with no place to put results!"); - UInt8* destPtr = vRef->fData; + uint8_t* destPtr = vRef->fData; int k; for( k = 0; k < visList.GetCount(); k++ ) @@ -10256,7 +10255,7 @@ hsBool plDXPipeline::ISoftwareVertexBlend( plDrawableSpans* drawable, const hsMatrix44* matrixPalette = drawable->GetMatrixPalette(span.fBaseMatrix); matrixPalette[0] = span.fLocalToWorld; - UInt8* ptr = vRef->fOwner->GetVertBufferData(vRef->fIndex); + uint8_t* ptr = vRef->fOwner->GetVertBufferData(vRef->fIndex); ptr += span.fVStartIdx * vRef->fOwner->GetVertexSize(); IBlendVertsIntoBuffer( (plSpan*)&span, matrixPalette, span.fNumMatrices, @@ -10323,15 +10322,15 @@ void plDXPipeline::ICheckTextureUsage() plProfile_IncCount(fTexUsed, fTexUsed); plProfile_IncCount(fTexManaged, fTexManaged); - plConst(UInt32) kMinTexManaged(5000000); + plConst(uint32_t) kMinTexManaged(5000000); if( fTexManaged < kMinTexManaged ) return; - plConst(UInt32) kScale(2); + plConst(uint32_t) kScale(2); if( fTexUsed * kScale < fTexManaged ) { // Find the stalest - UInt32 stalest = fTextUseTime; + uint32_t stalest = fTextUseTime; plDXTextureRef* ref = fTextureRefList; while( ref ) { @@ -10343,7 +10342,7 @@ void plDXPipeline::ICheckTextureUsage() stalest = fTextUseTime - stalest; // If the stalest is fresh, live with thrashing - plConst(UInt32) kMinAge(60); + plConst(uint32_t) kMinAge(60); if( stalest < kMinAge ) return; @@ -10382,15 +10381,15 @@ void plDXPipeline::ICheckVtxUsage() plProfile_IncCount(fVtxUsed, fVtxUsed); plProfile_IncCount(fVtxManaged, fVtxManaged); - plConst(UInt32) kMinVtxManaged(5000000); + plConst(uint32_t) kMinVtxManaged(5000000); if( fVtxManaged < kMinVtxManaged ) return; - plConst(UInt32) kScale(2); + plConst(uint32_t) kScale(2); if( fVtxUsed * kScale < fVtxManaged ) { // Find the stalest - UInt32 stalest = fTextUseTime; + uint32_t stalest = fTextUseTime; plDXVertexBufferRef* ref = fVtxBuffRefList; while( ref ) { @@ -10401,7 +10400,7 @@ void plDXPipeline::ICheckVtxUsage() stalest = fTextUseTime - stalest; // If the stalest is fresh, live with thrashing - plConst(UInt32) kMinAge(60); + plConst(uint32_t) kMinAge(60); if( stalest < kMinAge ) return; @@ -10469,7 +10468,7 @@ void plDXPipeline::LoadResources() IReleaseAvRTPool(); // Create all RenderTargets - plPipeRTMakeMsg* rtMake = TRACKED_NEW plPipeRTMakeMsg(this); + plPipeRTMakeMsg* rtMake = new plPipeRTMakeMsg(this); rtMake->Send(); // Create all our shadow render targets and pipeline specific POOL_DEFAULT vertex buffers. @@ -10478,7 +10477,7 @@ void plDXPipeline::LoadResources() ICreateDynamicBuffers(); // Create all POOL_DEFAULT (sorted) index buffers in the scene. - plPipeGeoMakeMsg* defMake = TRACKED_NEW plPipeGeoMakeMsg(this, true); + plPipeGeoMakeMsg* defMake = new plPipeGeoMakeMsg(this, true); defMake->Send(); // This can be a bit of a mem hog and will use more mem if available, so keep it last in the @@ -10491,7 +10490,7 @@ void plDXPipeline::LoadResources() // Force a create of all our static D3D vertex buffers. #define MF_PRELOAD_MANAGEDBUFFERS #ifdef MF_PRELOAD_MANAGEDBUFFERS - plPipeGeoMakeMsg* manMake = TRACKED_NEW plPipeGeoMakeMsg(this, false); + plPipeGeoMakeMsg* manMake = new plPipeGeoMakeMsg(this, false); manMake->Send(); #endif // MF_PRELOAD_MANAGEDBUFFERS @@ -10502,7 +10501,7 @@ void plDXPipeline::LoadResources() #define MF_PRELOAD_TEXTURES #endif // MF_TOSSER #ifdef MF_PRELOAD_TEXTURES - plPipeTexMakeMsg* texMake = TRACKED_NEW plPipeTexMakeMsg(this); + plPipeTexMakeMsg* texMake = new plPipeTexMakeMsg(this); texMake->Send(); #endif // MF_PRELOAD_TEXTURES @@ -10556,8 +10555,8 @@ void plDXPipeline::LoadResources() // inlTESTPOINT ///////////////////////////////////////// // Update mins and maxs if destP is outside. inline void inlTESTPOINT(const hsPoint3& destP, - hsScalar& minX, hsScalar& minY, hsScalar& minZ, - hsScalar& maxX, hsScalar& maxY, hsScalar& maxZ) + float& minX, float& minY, float& minZ, + float& maxX, float& maxY, float& maxZ) { if( destP.fX < minX ) minX = destP.fX; @@ -10582,12 +10581,12 @@ inline void inlTESTPOINT(const hsPoint3& destP, void plDXPipeline::IBlendVertsIntoBuffer( plSpan* span, hsMatrix44* matrixPalette, int numMatrices, - const UInt8 *src, UInt8 format, UInt32 srcStride, - UInt8 *dest, UInt32 destStride, UInt32 count, - UInt16 localUVWChans ) + const uint8_t *src, uint8_t format, uint32_t srcStride, + uint8_t *dest, uint32_t destStride, uint32_t count, + uint16_t localUVWChans ) { - UInt8 numUVs, numWeights; - UInt32 i, j, indices, color, specColor, uvChanSize; + uint8_t numUVs, numWeights; + uint32_t i, j, indices, color, specColor, uvChanSize; float weights[ 4 ], weightSum; hsPoint3 pt, tempPt, destPt; hsVector3 vec, tempNorm, destNorm; @@ -10607,13 +10606,13 @@ void plDXPipeline::IBlendVertsIntoBuffer( plSpan* span, //#define MF_RECALC_BOUNDS #ifdef MF_RECALC_BOUNDS - hsScalar minX = 1.e33f; - hsScalar minY = 1.e33f; - hsScalar minZ = 1.e33f; + float minX = 1.e33f; + float minY = 1.e33f; + float minZ = 1.e33f; - hsScalar maxX = -1.e33f; - hsScalar maxY = -1.e33f; - hsScalar maxZ = -1.e33f; + float maxX = -1.e33f; + float maxY = -1.e33f; + float maxZ = -1.e33f; #endif // MF_RECALC_BOUNDS // localUVWChans is bump mapping tangent space vectors, which need to @@ -10682,8 +10681,8 @@ void plDXPipeline::IBlendVertsIntoBuffer( plSpan* span, } else { - UInt8 hiChan = localUVWChans >> 8; - UInt8 loChan = localUVWChans & 0xff; + uint8_t hiChan = localUVWChans >> 8; + uint8_t loChan = localUVWChans & 0xff; /// Copy whilst blending for( i = 0; i < count; i++ ) { @@ -10712,7 +10711,7 @@ void plDXPipeline::IBlendVertsIntoBuffer( plSpan* span, src = inlExtractUInt32( src, color ); src = inlExtractUInt32( src, specColor ); - UInt8 k; + uint8_t k; for( k = 0; k < numUVs; k++ ) { src = inlExtractPoint( src, srcUVWs[k] ); @@ -11001,7 +11000,7 @@ HRESULT plDXPipeline::ISetShaders(plShader* vShader, plShader* pShader) plDXVertexShader* vRef = (plDXVertexShader*)vShader->GetDeviceRef(); if( !vRef ) { - vRef = TRACKED_NEW plDXVertexShader(vShader); + vRef = new plDXVertexShader(vShader); hsRefCnt_SafeUnRef(vRef); } if( !vRef->IsLinked() ) @@ -11029,7 +11028,7 @@ HRESULT plDXPipeline::ISetShaders(plShader* vShader, plShader* pShader) plDXPixelShader* pRef = (plDXPixelShader*)pShader->GetDeviceRef(); if( !pRef ) { - pRef = TRACKED_NEW plDXPixelShader(pShader); + pRef = new plDXPixelShader(pShader); hsRefCnt_SafeUnRef(pRef); } if( !pRef->IsLinked() ) @@ -11190,8 +11189,8 @@ inline void plDXPipeline::ICheckVBUsage(plDXVertexBufferRef* vRef) // renders it in as many passes as it takes in ILoopOverLayers. void plDXPipeline::IRenderBufferSpan( const plIcicle& span, hsGDeviceRef *vb, hsGDeviceRef *ib, - hsGMaterial *material, UInt32 vStart, UInt32 vLength, - UInt32 iStart, UInt32 iLength ) + hsGMaterial *material, uint32_t vStart, uint32_t vLength, + uint32_t iStart, uint32_t iLength ) { plProfile_BeginTiming(RenderBuff); @@ -11353,7 +11352,7 @@ hsBool plDXPipeline::ILoopOverLayers(const plRenderPrimFunc& inRender, hsGMateri // Debug only, renders wireframe on top of normal render. void plDXPipeline::IRenderOverWire(const plRenderPrimFunc& render, hsGMaterial* material, const plSpan& span) { - UInt32 state = fView.fRenderState; + uint32_t state = fView.fRenderState; fView.fRenderState |= plPipeline::kRenderBaseLayerOnly; static plLayerDepth depth; depth.SetMiscFlags(depth.GetMiscFlags() | hsGMatState::kMiscWireFrame | hsGMatState::kMiscTwoSided); @@ -11489,7 +11488,7 @@ void plDXPipeline::IRenderProjection(const plRenderPrimFunc& render, plLightInfo fLastEndingStage = 1; fD3DDevice->SetTextureStageState(1, D3DTSS_COLOROP, D3DTOP_DISABLE); fD3DDevice->SetTextureStageState(1, D3DTSS_ALPHAOP, D3DTOP_DISABLE); - fLayerState[1].fBlendFlags = UInt32(-1); + fLayerState[1].fBlendFlags = uint32_t(-1); #ifdef HS_DEBUGGING DWORD nPass; @@ -11509,7 +11508,7 @@ void plDXPipeline::IRenderProjection(const plRenderPrimFunc& render, plLightInfo // Convert the dumbest vertex format on the planet (ours) into an FVF code. // Note the assumption of position, normal, diffuse, and specular. // We no longer use FVF codes, just shader handles. -long plDXPipeline::IGetBufferD3DFormat( UInt8 format ) const +long plDXPipeline::IGetBufferD3DFormat( uint8_t format ) const { long fmt, i; @@ -11558,9 +11557,9 @@ long plDXPipeline::IGetBufferD3DFormat( UInt8 format ) const //// IGetBufferFormatSize ///////////////////////////////////////////////////// // Calculate the vertex stride from the given format. -UInt32 plDXPipeline::IGetBufferFormatSize( UInt8 format ) const +uint32_t plDXPipeline::IGetBufferFormatSize( uint8_t format ) const { - UInt32 size = sizeof( float ) * 6 + sizeof( UInt32 ) * 2; // Position and normal, and two packed colors + uint32_t size = sizeof( float ) * 6 + sizeof( uint32_t ) * 2; // Position and normal, and two packed colors switch( format & plGBufferGroup::kSkinWeightMask ) @@ -11595,7 +11594,7 @@ UInt32 plDXPipeline::IGetBufferFormatSize( UInt8 format ) const // Make a quad suitable for rendering as a tristrip. void plDXPlateManager::ICreateGeometry(plDXPipeline* pipe) { - UInt32 fvfFormat = PLD3D_PLATEFVF; + uint32_t fvfFormat = PLD3D_PLATEFVF; D3DPOOL poolType = D3DPOOL_DEFAULT; hsAssert(!pipe->ManagedAlloced(), "Alloc default with managed alloc'd"); if( FAILED( fD3DDevice->CreateVertexBuffer( 4 * sizeof( plPlateVertex ), @@ -11673,8 +11672,8 @@ void plDXPlateManager::IDrawToDevice( plPipeline *pipe ) { plDXPipeline *dxPipe = (plDXPipeline *)pipe; plPlate *plate; - UInt32 scrnWidthDiv2 = fOwner->Width() >> 1; - UInt32 scrnHeightDiv2 = fOwner->Height() >> 1; + uint32_t scrnWidthDiv2 = fOwner->Width() >> 1; + uint32_t scrnHeightDiv2 = fOwner->Height() >> 1; D3DXMATRIX mat; D3DCULL oldCullMode; @@ -11709,7 +11708,7 @@ void plDXPlateManager::IDrawToDevice( plPipeline *pipe ) pt.fX = pt.fX * scrnWidthDiv2 + scrnWidthDiv2; pt.fY = pt.fY * scrnHeightDiv2 + scrnHeightDiv2; pt.fX -= plDebugText::Instance().CalcStringWidth( title ) >> 1; - plDebugText::Instance().DrawString( (UInt16)pt.fX, (UInt16)pt.fY + 1, title, 255, 255, 255, 255, plDebugText::kStyleBold ); + plDebugText::Instance().DrawString( (uint16_t)pt.fX, (uint16_t)pt.fY + 1, title, 255, 255, 255, 255, plDebugText::kStyleBold ); } if( plate->GetFlags() & plPlate::kFlagIsAGraph ) @@ -11729,7 +11728,7 @@ void plDXPlateManager::IDrawToDevice( plPipeline *pipe ) pt.fY = pt.fY * scrnHeightDiv2 + scrnHeightDiv2; pt.fY += plDebugText::Instance().GetFontHeight(); - UInt32 numLabels = graph->GetNumLabels(); + uint32_t numLabels = graph->GetNumLabels(); if (numLabels > graph->GetNumColors()) numLabels = graph->GetNumColors(); @@ -11741,7 +11740,7 @@ void plDXPlateManager::IDrawToDevice( plPipeline *pipe ) pt2 = pt; pt2.fX -= plDebugText::Instance().CalcStringWidth( str ); - plDebugText::Instance().DrawString( (UInt16)pt2.fX, (UInt16)pt2.fY, str, + plDebugText::Instance().DrawString( (uint16_t)pt2.fX, (uint16_t)pt2.fY, str, graph->GetDataColor( i ), plDebugText::kStyleBold ); pt.fY += plDebugText::Instance().GetFontHeight(); } @@ -12112,7 +12111,7 @@ plLayerInterface* plDXPipeline::RemoveLayerInterface(plLayerInterface* li, hsBoo // IAttachShadowsToReceivers /////////////////////////////////////////////////////////// // For each active shadow map (in fShadows), attach it to all of the visible spans in drawable // that it affects. Shadows explicitly attached via light groups are handled separately in ISetShadowFromGroup. -void plDXPipeline::IAttachShadowsToReceivers(plDrawableSpans* drawable, const hsTArray& visList) +void plDXPipeline::IAttachShadowsToReceivers(plDrawableSpans* drawable, const hsTArray& visList) { int i; for( i = 0; i < fShadows.GetCount(); i++ ) @@ -12122,7 +12121,7 @@ void plDXPipeline::IAttachShadowsToReceivers(plDrawableSpans* drawable, const hs // IAttachSlaveToReceivers ///////////////////////////////////////////////////// // Find all the visible spans in this drawable affected by this shadow map, // and attach it to them. -void plDXPipeline::IAttachSlaveToReceivers(int which, plDrawableSpans* drawable, const hsTArray& visList) +void plDXPipeline::IAttachSlaveToReceivers(int which, plDrawableSpans* drawable, const hsTArray& visList) { plShadowSlave* slave = fShadows[which]; @@ -12143,7 +12142,7 @@ void plDXPipeline::IAttachSlaveToReceivers(int which, plDrawableSpans* drawable, cache.Clear(); space->EnableLeaves(visList, cache); - static hsTArray hitList; + static hsTArray hitList; hitList.SetCount(0); space->HarvestEnabledLeaves(slave->fIsect, cache, hitList); @@ -12240,7 +12239,7 @@ void plDXPipeline::SubmitShadowSlave(plShadowSlave* slave) fShadows.Insert(i, slave); } -hsScalar blurScale = -1.f; +float blurScale = -1.f; static const int kL2NumSamples = 3; // Log2(4) // IBlurShadowMap ////////////////////////////////////////////////////////////////// @@ -12275,7 +12274,7 @@ static const int kL2NumSamples = 3; // Log2(4) void plDXPipeline::IBlurShadowMap(plShadowSlave* slave) { plRenderTarget* smap = (plRenderTarget*)slave->fPipeData; - hsScalar scale = slave->fBlurScale; + float scale = slave->fBlurScale; // Find a scratch rendertarget which matches the input. int which = IGetScratchRenderTarget(smap); @@ -12348,8 +12347,8 @@ int plDXPipeline::IGetScratchRenderTarget(plRenderTarget* smap) // later, and we won't know to look in the bigger slot for it, so we could wind // up using say two 128x128's (one in the 256 slot, one in the 128 slot). // This intermediate is one power of 2 smaller than the source. - UInt32 width = smap->GetWidth(); - UInt32 height = smap->GetHeight(); + uint32_t width = smap->GetWidth(); + uint32_t height = smap->GetHeight(); if( width > 32 ) { width >>= 1; @@ -12360,8 +12359,8 @@ int plDXPipeline::IGetScratchRenderTarget(plRenderTarget* smap) if( !fBlurDestRTs[which] ) { // Destination is same size as source. - UInt32 width = smap->GetWidth(); - UInt32 height = smap->GetHeight(); + uint32_t width = smap->GetWidth(); + uint32_t height = smap->GetHeight(); fBlurDestRTs[which] = IFindRenderTarget(width, height, smap->GetFlags() & plRenderTarget::kIsOrtho); } #ifdef MF_ENABLE_HACKOFF @@ -12406,7 +12405,7 @@ void plDXPipeline::IBlurSetRenderTarget(plRenderTarget* rt) // Render a shadow map into a scratch render target multiple times offset slightly to create a blur // in the color, preserving alpha exactly. It's just rendering a single quad with slight offsets // in the UVW transform. -void plDXPipeline::IRenderBlurFromShadowMap(plRenderTarget* scratchRT, plRenderTarget* smap, hsScalar scale) +void plDXPipeline::IRenderBlurFromShadowMap(plRenderTarget* scratchRT, plRenderTarget* smap, float scale) { // Quad is set up in camera space. fD3DDevice->SetTransform(D3DTS_VIEW, &d3dIdentityMatrix); @@ -12416,7 +12415,7 @@ void plDXPipeline::IRenderBlurFromShadowMap(plRenderTarget* scratchRT, plRenderT // Figure out how many passes we'll need. // const int kNumSamples = 1 << kL2NumSamples; // HACKSAMPLE const int kNumSamples = mfCurrentTest > 101 ? 8 : 4; - int nPasses = (int)hsCeil(float(kNumSamples) / fSettings.fMaxLayersAtOnce); + int nPasses = (int)ceil(float(kNumSamples) / fSettings.fMaxLayersAtOnce); int nSamplesPerPass = kNumSamples / nPasses; // Attenuate by number of passes, to average as we sum. @@ -12494,7 +12493,7 @@ void plDXPipeline::IRenderBlurFromShadowMap(plRenderTarget* scratchRT, plRenderT fD3DDevice->SetTextureStageState(0, D3DTSS_ALPHAARG1, D3DTA_TFACTOR); fD3DDevice->SetTextureStageState(0, D3DTSS_ALPHAOP, D3DTOP_SELECTARG1); - fLayerState[0].fBlendFlags = UInt32(-1); + fLayerState[0].fBlendFlags = uint32_t(-1); hsRefCnt_SafeAssign( fLayerRef[0], ref ); fD3DDevice->SetTexture( 0, ref->fD3DTexture ); @@ -12521,7 +12520,7 @@ void plDXPipeline::IRenderBlurFromShadowMap(plRenderTarget* scratchRT, plRenderT fD3DDevice->SetTextureStageState(i, D3DTSS_ALPHAARG1, D3DTA_TEXTURE); fD3DDevice->SetTextureStageState(i, D3DTSS_ALPHAARG2, D3DTA_CURRENT); fD3DDevice->SetTextureStageState(i, D3DTSS_ALPHAOP, D3DTOP_SELECTARG2); - fLayerState[i].fBlendFlags = UInt32(-1); + fLayerState[i].fBlendFlags = uint32_t(-1); hsRefCnt_SafeAssign( fLayerRef[i], ref ); fD3DDevice->SetTexture( i, ref->fD3DTexture ); @@ -12659,7 +12658,7 @@ void plDXPipeline::IRenderBlurBackToShadowMap(plRenderTarget* smap, plRenderTarg fD3DDevice->SetTextureStageState(0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE); fD3DDevice->SetTextureStageState(0, D3DTSS_ALPHAOP, D3DTOP_SELECTARG1); - fLayerState[0].fBlendFlags = UInt32(-1); + fLayerState[0].fBlendFlags = uint32_t(-1); fD3DDevice->SetTextureStageState(1, D3DTSS_COLORARG2, D3DTA_CURRENT); fD3DDevice->SetTextureStageState(1, D3DTSS_COLOROP, D3DTOP_SELECTARG2); @@ -12667,7 +12666,7 @@ void plDXPipeline::IRenderBlurBackToShadowMap(plRenderTarget* smap, plRenderTarg fD3DDevice->SetTextureStageState(1, D3DTSS_ALPHAARG1, D3DTA_TEXTURE); fD3DDevice->SetTextureStageState(1, D3DTSS_ALPHAOP, D3DTOP_SELECTARG1); - fLayerState[1].fBlendFlags = UInt32(-1); + fLayerState[1].fBlendFlags = uint32_t(-1); fD3DDevice->SetTextureStageState(2, D3DTSS_COLOROP, D3DTOP_DISABLE); fD3DDevice->SetTextureStageState(2, D3DTSS_ALPHAOP, D3DTOP_DISABLE); @@ -12692,7 +12691,7 @@ struct plShadowVertStruct // Free up our blur quad vertex buffers. Note these are in POOL_DEFAULT void plDXPipeline::IReleaseBlurVBuffers() { - const UInt32 kVSize = sizeof(plShadowVertStruct); + const uint32_t kVSize = sizeof(plShadowVertStruct); int i; for( i = 0; i < kMaxRenderTargetNext; i++ ) { @@ -12711,8 +12710,8 @@ void plDXPipeline::IReleaseBlurVBuffers() hsBool plDXPipeline::ICreateBlurVBuffers() { // vertex size is 4 verts, with 4 floats each for position, and 2 floats each for uv. - const UInt32 kVSize = sizeof(plShadowVertStruct); - const UInt32 kVFormat = D3DFVF_XYZ | D3DFVF_TEX1 | D3DFVF_TEXCOORDSIZE2(0) ; + const uint32_t kVSize = sizeof(plShadowVertStruct); + const uint32_t kVFormat = D3DFVF_XYZ | D3DFVF_TEX1 | D3DFVF_TEXCOORDSIZE2(0) ; int i; for( i = 0; i < kMaxRenderTargetNext; i++ ) @@ -12762,7 +12761,7 @@ hsBool plDXPipeline::ICreateBlurVBuffers() // Create the buffer. IDirect3DVertexBuffer9* vBuffer = nil; - UInt32 fvfFormat = kVFormat; + uint32_t fvfFormat = kVFormat; hsAssert(!ManagedAlloced(), "Alloc default with managed alloc'd"); if( FAILED( fD3DDevice->CreateVertexBuffer( 4 * kVSize, D3DUSAGE_WRITEONLY, @@ -12823,8 +12822,8 @@ hsBool plDXPipeline::ICreateBlurVBuffers() // Select the appropriate blur quad (based on size of shadow map) and set it up to render. hsBool plDXPipeline::ISetBlurQuadToRender(plRenderTarget* smap) { - const UInt32 kVSize = sizeof(plShadowVertStruct); - const UInt32 kVFormat = D3DFVF_XYZ | D3DFVF_TEX1 | D3DFVF_TEXCOORDSIZE2(0) ; + const uint32_t kVSize = sizeof(plShadowVertStruct); + const uint32_t kVFormat = D3DFVF_XYZ | D3DFVF_TEX1 | D3DFVF_TEXCOORDSIZE2(0) ; // Each vb will be rendertarget size specific, so select one based on input rendertarget int which = -1; @@ -12934,10 +12933,10 @@ void plDXPipeline::IRenderShadowCasterSpan(plShadowSlave* slave, plDrawableSpans iRef->SetRebuiltSinceUsed(false); } - UInt32 vStart = span.fVStartIdx; - UInt32 vLength = span.fVLength; - UInt32 iStart = span.fIPackedIdx; - UInt32 iLength= span.fILength; + uint32_t vStart = span.fVStartIdx; + uint32_t vLength = span.fVLength; + uint32_t iStart = span.fIPackedIdx; + uint32_t iLength= span.fILength; plRenderTriListFunc render(fD3DDevice, iRef->fOffset, vStart, vLength, iStart, iLength/3); @@ -12962,9 +12961,9 @@ plDXTextureRef* plDXPipeline::IGetULutTextureRef() const int height = 1; if( !fULutTextureRef ) { - UInt32* tData = TRACKED_NEW UInt32[width * height]; + uint32_t* tData = new uint32_t[width * height]; - UInt32* pData = tData; + uint32_t* pData = tData; int j; for( j = 0; j < height; j++ ) { @@ -12979,12 +12978,12 @@ plDXTextureRef* plDXPipeline::IGetULutTextureRef() } } - plDXTextureRef* ref = TRACKED_NEW plDXTextureRef( D3DFMT_A8R8G8B8, + plDXTextureRef* ref = new plDXTextureRef( D3DFMT_A8R8G8B8, 1, // Num mip levels width, height, // width by height width * height, // numpix - width*height*sizeof(UInt32), // totalsize - width*height*sizeof(UInt32), + width*height*sizeof(uint32_t), // totalsize + width*height*sizeof(uint32_t), nil, // levels data tData, false // externData @@ -13001,10 +13000,10 @@ plDXTextureRef* plDXPipeline::IGetULutTextureRef() // will look for a smaller size if there isn't one available. // Param ortho indicates whether it will be used for orthogonal projection as opposed // to perspective (directional light vs. point light), but is no longer used. -plRenderTarget* plDXPipeline::IFindRenderTarget(UInt32& width, UInt32& height, hsBool ortho) +plRenderTarget* plDXPipeline::IFindRenderTarget(uint32_t& width, uint32_t& height, hsBool ortho) { hsTArray* pool = nil; - UInt32* iNext = nil; + uint32_t* iNext = nil; // NOT CURRENTLY SUPPORTING NON-SQUARE SHADOWS. IF WE DO, CHANGE THIS. switch(height) { @@ -13086,7 +13085,7 @@ hsBool plDXPipeline::IPushShadowCastState(plShadowSlave* slave) fD3DDevice->SetTextureStageState(0, D3DTSS_TEXCOORDINDEX, D3DTSS_TCI_CAMERASPACEPOSITION); fLayerUVWSrcs[0] = D3DTSS_TCI_CAMERASPACEPOSITION; } - UInt32 xformFlags = D3DTTFF_COUNT3; + uint32_t xformFlags = D3DTTFF_COUNT3; if( xformFlags != fLayerXformFlags[0] ) { @@ -13121,7 +13120,7 @@ hsBool plDXPipeline::IPushShadowCastState(plShadowSlave* slave) if( slave->fBlurScale > 0 ) { const int kNumSamples = mfCurrentTest > 101 ? 8 : 4; - int nPasses = (int)hsCeil(float(kNumSamples) / fSettings.fMaxLayersAtOnce); + int nPasses = (int)ceil(float(kNumSamples) / fSettings.fMaxLayersAtOnce); int nSamplesPerPass = kNumSamples / nPasses; DWORD k = int(128.f / float(nSamplesPerPass)); intens = (0xff << 24) @@ -13150,13 +13149,13 @@ hsBool plDXPipeline::IPushShadowCastState(plShadowSlave* slave) fD3DDevice->SetTextureStageState(0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE); fD3DDevice->SetTextureStageState(0, D3DTSS_ALPHAOP, D3DTOP_SELECTARG1); - fLayerState[0].fBlendFlags = UInt32(-1); + fLayerState[0].fBlendFlags = uint32_t(-1); // For stage 1 - disable fLastEndingStage = 1; fD3DDevice->SetTextureStageState(1, D3DTSS_COLOROP, D3DTOP_DISABLE); fD3DDevice->SetTextureStageState(1, D3DTSS_ALPHAOP, D3DTOP_DISABLE); - fLayerState[1].fBlendFlags = UInt32(-1); + fLayerState[1].fBlendFlags = uint32_t(-1); // Set texture to U_LUT plDXTextureRef* ref = IGetULutTextureRef(); @@ -13272,7 +13271,7 @@ plDXLightRef* plDXPipeline::INextShadowLight(plShadowSlave* slave) if( !fLights.fShadowLights[fLights.fNextShadowLight] ) { - plDXLightRef *lRef = TRACKED_NEW plDXLightRef(); + plDXLightRef *lRef = new plDXLightRef(); /// Assign stuff and update lRef->fD3DIndex = fLights.ReserveD3DIndex(); @@ -13324,7 +13323,7 @@ void plDXPipeline::IMakeRenderTargetPools() // These numbers were set with multi-player in mind, so should be reconsidered. // But do keep in mind that there are many things in production assets that cast // shadows besides the avatar. - plConst(hsScalar) kCount[kMaxRenderTargetNext] = { + plConst(float) kCount[kMaxRenderTargetNext] = { 0, // 1x1 0, // 2x2 0, // 4x4 @@ -13374,16 +13373,16 @@ void plDXPipeline::IMakeRenderTargetPools() int j; for( j = 0; j < kCount[i]; j++ ) { - UInt16 flags = plRenderTarget::kIsTexture | plRenderTarget::kIsProjected; - UInt8 bitDepth = 32; - UInt8 zDepth = 24; - UInt8 stencilDepth = 0; + uint16_t flags = plRenderTarget::kIsTexture | plRenderTarget::kIsProjected; + uint8_t bitDepth = 32; + uint8_t zDepth = 24; + uint8_t stencilDepth = 0; // If we ever allow non-square shadows, change this. int width = 1 << i; int height = width; - plRenderTarget* rt = TRACKED_NEW plRenderTarget(flags, width, height, bitDepth, zDepth, stencilDepth); + plRenderTarget* rt = new plRenderTarget(flags, width, height, bitDepth, zDepth, stencilDepth); // If we've failed to create our render target ref, we're probably out of // video memory. We'll return nil, and this guy just doesn't get a shadow @@ -13447,9 +13446,9 @@ hsBool plDXPipeline::IPrepShadowCaster(const plShadowCaster* caster) plDrawableSpans* drawable = castSpans[i].fDraw; // Start a visList with this index. - static hsTArray visList; + static hsTArray visList; visList.SetCount(0); - visList.Append((Int16)(castSpans[i].fIndex)); + visList.Append((int16_t)(castSpans[i].fIndex)); // We're about to have done this castSpan. done.SetBit(i); @@ -13463,7 +13462,7 @@ hsBool plDXPipeline::IPrepShadowCaster(const plShadowCaster* caster) if( !done.IsBitSet(j) && (castSpans[j].fDraw == drawable) ) { // Add to list - visList.Append((Int16)(castSpans[j].fIndex)); + visList.Append((int16_t)(castSpans[j].fIndex)); // We're about to have done this castSpan. done.SetBit(j); @@ -13501,7 +13500,7 @@ hsBool plDXPipeline::IRenderShadowCaster(plShadowSlave* slave) { plDrawableSpans* dr = caster->Spans()[iSpan].fDraw; const plSpan* sp = caster->Spans()[iSpan].fSpan; - UInt32 spIdx = caster->Spans()[iSpan].fIndex; + uint32_t spIdx = caster->Spans()[iSpan].fIndex; hsAssert(sp->fTypeMask & plSpan::kIcicleSpan, "Shadow casting from non-trimeshes not currently supported"); @@ -13645,8 +13644,8 @@ void plDXPipeline::IRenderShadowsOntoSpan(const plRenderPrimFunc& render, const // the surface casting the shadow (because they are the same object). if( selfShadowNow ) { - plConst(hsScalar) kMaxSelfPower = 0.3f; - hsScalar power = fShadows[i]->fPower > kMaxSelfPower ? kMaxSelfPower : fShadows[i]->fPower; + plConst(float) kMaxSelfPower = 0.3f; + float power = fShadows[i]->fPower > kMaxSelfPower ? kMaxSelfPower : fShadows[i]->fPower; lRef->fD3DInfo.Diffuse.r = lRef->fD3DInfo.Diffuse.g = lRef->fD3DInfo.Diffuse.b @@ -13782,7 +13781,7 @@ void plDXPipeline::ISetupShadowRcvTextureStages(hsGMaterial* mat) fD3DDevice->SetTextureStageState(1, D3DTSS_ALPHAARG1, D3DTA_TEXTURE); fD3DDevice->SetTextureStageState(1, D3DTSS_ALPHAARG2, D3DTA_CURRENT); fD3DDevice->SetTextureStageState(1, D3DTSS_ALPHAOP, D3DTOP_SUBTRACT); - fLayerState[1].fBlendFlags = UInt32(-1); + fLayerState[1].fBlendFlags = uint32_t(-1); if( fLayerUVWSrcs[1] != D3DTSS_TCI_CAMERASPACEPOSITION ) { @@ -13829,7 +13828,7 @@ void plDXPipeline::ISetupShadowRcvTextureStages(hsGMaterial* mat) fD3DDevice->SetTextureStageState(iNextStage, D3DTSS_ALPHAOP, D3DTOP_SELECTARG2); // Blend flags to layer blend (alpha +- complement) - fLayerState[iNextStage].fBlendFlags = UInt32(-1); + fLayerState[iNextStage].fBlendFlags = uint32_t(-1); // Clamp to whatever the texture wants. if( fLayerState[iNextStage].fClampFlags ^ layer->GetClampFlags() ) @@ -13851,7 +13850,7 @@ void plDXPipeline::ISetupShadowRcvTextureStages(hsGMaterial* mat) IHandleStageTransform(iNextStage, layer); // Normal UVW source. - UInt32 uvwSrc = layer->GetUVWSrc(); + uint32_t uvwSrc = layer->GetUVWSrc(); if( fLayerUVWSrcs[ iNextStage ] != uvwSrc ) { @@ -13859,7 +13858,7 @@ void plDXPipeline::ISetupShadowRcvTextureStages(hsGMaterial* mat) fLayerUVWSrcs[ iNextStage ] = uvwSrc; } - UInt32 xformFlags; + uint32_t xformFlags; if( layer->GetMiscFlags() & hsGMatState::kMiscPerspProjection ) xformFlags = D3DTTFF_COUNT3 | D3DTTFF_PROJECTED; else if( uvwSrc & (plLayerInterface::kUVWNormal | plLayerInterface::kUVWPosition | plLayerInterface::kUVWReflect) ) @@ -13887,17 +13886,17 @@ void plDXPipeline::ISetupShadowRcvTextureStages(hsGMaterial* mat) fD3DDevice->SetTextureStageState(iNextStage, D3DTSS_ALPHAOP, D3DTOP_DISABLE); - fLayerState[iNextStage].fBlendFlags = UInt32(-1); + fLayerState[iNextStage].fBlendFlags = uint32_t(-1); iNextStage++; } - fLayerState[iNextStage].fBlendFlags = UInt32(-1); + fLayerState[iNextStage].fBlendFlags = uint32_t(-1); // And seal it up fD3DDevice->SetTextureStageState(iNextStage, D3DTSS_COLOROP, D3DTOP_DISABLE); fD3DDevice->SetTextureStageState(iNextStage, D3DTSS_ALPHAOP, D3DTOP_DISABLE); - fLayerState[iNextStage].fBlendFlags = UInt32(-1); + fLayerState[iNextStage].fBlendFlags = uint32_t(-1); fLastEndingStage = 0; @@ -13910,7 +13909,7 @@ void plDXPipeline::ISetupShadowRcvTextureStages(hsGMaterial* mat) fD3DDevice->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_ZERO); fD3DDevice->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCCOLOR); - fLayerState[0].fBlendFlags = UInt32(-1); + fLayerState[0].fBlendFlags = uint32_t(-1); // Turn on alpha test. Alpha of zero means the shadow map depth // is greater or equal to the surface depth, i.e. the surface @@ -13966,7 +13965,7 @@ void plDXPipeline::ISetupShadowSlaveTextures(plShadowSlave* slave) fLayerTransform[0] = true; // Directional lights (ortho projection) just use COUNT2, point lights use COUNT3|PROJECTED. - UInt32 xformFlags = slave->fView.GetOrthogonal() ? D3DTTFF_COUNT2 : D3DTTFF_COUNT3 | D3DTTFF_PROJECTED; + uint32_t xformFlags = slave->fView.GetOrthogonal() ? D3DTTFF_COUNT2 : D3DTTFF_COUNT3 | D3DTTFF_PROJECTED; if( xformFlags != fLayerXformFlags[0] ) { @@ -14122,17 +14121,17 @@ void plDXPipeline::IFillAvRTPool() } } -hsBool plDXPipeline::IFillAvRTPool(UInt16 numRTs, UInt16 width) +hsBool plDXPipeline::IFillAvRTPool(uint16_t numRTs, uint16_t width) { fAvRTPool.SetCount(numRTs); int i; for (i = 0; i < numRTs; i++) { - UInt16 flags = plRenderTarget::kIsTexture | plRenderTarget::kIsProjected; - UInt8 bitDepth = 32; - UInt8 zDepth = 0; - UInt8 stencilDepth = 0; - fAvRTPool[i] = TRACKED_NEW plRenderTarget(flags, width, width, bitDepth, zDepth, stencilDepth); + uint16_t flags = plRenderTarget::kIsTexture | plRenderTarget::kIsProjected; + uint8_t bitDepth = 32; + uint8_t zDepth = 0; + uint8_t stencilDepth = 0; + fAvRTPool[i] = new plRenderTarget(flags, width, width, bitDepth, zDepth, stencilDepth); // If anyone fails, release everyone we've created. if (!MakeRenderTargetRef(fAvRTPool[i])) @@ -14173,7 +14172,7 @@ plRenderTarget *plDXPipeline::IGetNextAvRT() void plDXPipeline::IFreeAvRT(plRenderTarget* tex) { - UInt32 index = fAvRTPool.Find(tex); + uint32_t index = fAvRTPool.Find(tex); if (index != fAvRTPool.kMissingIndex) { hsAssert(index < fAvNextFreeRT, "Freeing an avatar RT that's already free?"); @@ -14194,11 +14193,11 @@ void plDXPipeline::IPreprocessAvatarTextures() plProfile_Set(AvRTPoolUsed, fClothingOutfits.GetCount()); plProfile_Set(AvRTPoolCount, fAvRTPool.GetCount()); plProfile_Set(AvRTPoolRes, fAvRTWidth); - plProfile_Set(AvRTShrinkTime, UInt32(hsTimer::GetSysSeconds() - fAvRTShrinkValidSince)); + plProfile_Set(AvRTShrinkTime, uint32_t(hsTimer::GetSysSeconds() - fAvRTShrinkValidSince)); IClearClothingOutfits(&fPrevClothingOutfits); // Frees anyone used last frame that we don't need this frame - const UInt32 kVFormat = D3DFVF_XYZ | D3DFVF_TEX1 | D3DFVF_TEXCOORDSIZE2(0); + const uint32_t kVFormat = D3DFVF_XYZ | D3DFVF_TEX1 | D3DFVF_TEXCOORDSIZE2(0); if (fClothingOutfits.GetCount() == 0) return; @@ -14248,10 +14247,10 @@ void plDXPipeline::IPreprocessAvatarTextures() fD3DDevice->SetTextureStageState(0, D3DTSS_ALPHAARG1, D3DTA_TFACTOR); fD3DDevice->SetTextureStageState(0, D3DTSS_ALPHAARG2, D3DTA_TEXTURE); fD3DDevice->SetRenderState(D3DRS_ALPHAFUNC, D3DCMP_ALWAYS); - fLayerState[0].fBlendFlags = UInt32(-1); + fLayerState[0].fBlendFlags = uint32_t(-1); fD3DDevice->SetTextureStageState(1, D3DTSS_COLOROP, D3DTOP_DISABLE); fD3DDevice->SetTextureStageState(1, D3DTSS_ALPHAOP, D3DTOP_DISABLE); - fLayerState[1].fBlendFlags = UInt32(-1); + fLayerState[1].fBlendFlags = uint32_t(-1); inlEnsureLightingOff(); int oIdx; @@ -14278,14 +14277,14 @@ void plDXPipeline::IPreprocessAvatarTextures() D3DVIEWPORT9 vp = {0, 0, rt->GetWidth(), rt->GetHeight(), 0.f, 1.f}; WEAK_ERROR_CHECK(fD3DDevice->SetViewport(&vp)); - hsScalar uOff = 0.5f / rt->GetWidth(); - hsScalar vOff = 0.5f / rt->GetHeight(); + float uOff = 0.5f / rt->GetWidth(); + float vOff = 0.5f / rt->GetHeight(); // Copy over the base fD3DDevice->SetRenderState(D3DRS_ALPHABLENDENABLE, FALSE); fD3DDevice->SetRenderState(D3DRS_COLORWRITEENABLE, D3DCOLORWRITEENABLE_RED | D3DCOLORWRITEENABLE_GREEN | D3DCOLORWRITEENABLE_BLUE | D3DCOLORWRITEENABLE_ALPHA); fD3DDevice->SetRenderState(D3DRS_TEXTUREFACTOR, 0xffffffff); - fLayerState[0].fBlendFlags = UInt32(-1); + fLayerState[0].fBlendFlags = uint32_t(-1); IDrawClothingQuad(-1.f, -1.f, 2.f, 2.f, uOff, vOff, co->fBase->fBaseTexture); plClothingLayout *layout = plClothingMgr::GetClothingMgr()->GetLayout(co->fBase->fLayoutName); @@ -14321,11 +14320,11 @@ void plDXPipeline::IPreprocessAvatarTextures() fD3DDevice->SetRenderState(D3DRS_COLORWRITEENABLE, D3DCOLORWRITEENABLE_RED | D3DCOLORWRITEENABLE_GREEN | D3DCOLORWRITEENABLE_BLUE); } fD3DDevice->SetRenderState(D3DRS_TEXTUREFACTOR, tint.ToARGB32()); - fLayerState[0].fBlendFlags = UInt32(-1); - hsScalar screenW = (hsScalar)item->fElements[j]->fWidth / layout->fOrigWidth * 2.f; - hsScalar screenH = (hsScalar)item->fElements[j]->fHeight / layout->fOrigWidth * 2.f; - hsScalar screenX = (hsScalar)item->fElements[j]->fXPos / layout->fOrigWidth * 2.f - 1.f; - hsScalar screenY = (1.f - (hsScalar)item->fElements[j]->fYPos / layout->fOrigWidth) * 2.f - 1.f - screenH; + fLayerState[0].fBlendFlags = uint32_t(-1); + float screenW = (float)item->fElements[j]->fWidth / layout->fOrigWidth * 2.f; + float screenH = (float)item->fElements[j]->fHeight / layout->fOrigWidth * 2.f; + float screenX = (float)item->fElements[j]->fXPos / layout->fOrigWidth * 2.f - 1.f; + float screenY = (1.f - (float)item->fElements[j]->fYPos / layout->fOrigWidth) * 2.f - 1.f - screenH; IDrawClothingQuad(screenX, screenY, screenW, screenH, uOff, vOff, itemBufferTex); } } @@ -14340,10 +14339,10 @@ void plDXPipeline::IPreprocessAvatarTextures() fClothingOutfits.Swap(fPrevClothingOutfits); } -void plDXPipeline::IDrawClothingQuad(hsScalar x, hsScalar y, hsScalar w, hsScalar h, - hsScalar uOff, hsScalar vOff, plMipmap *tex) +void plDXPipeline::IDrawClothingQuad(float x, float y, float w, float h, + float uOff, float vOff, plMipmap *tex) { - const UInt32 kVSize = sizeof(plAVTexVert); + const uint32_t kVSize = sizeof(plAVTexVert); plDXTextureRef* ref = (plDXTextureRef*)tex->GetDeviceRef(); if (!ref || ref->IsDirty()) { @@ -14410,7 +14409,7 @@ void plDXPipeline::IDrawClothingQuad(hsScalar x, hsScalar y, hsScalar w, hsScala plPipeline *plPipelineCreate::ICreateDXPipeline( hsWinRef hWnd, const hsG3DDeviceModeRecord *devMode ) { - plDXPipeline *pipe = TRACKED_NEW plDXPipeline( hWnd, devMode ); + plDXPipeline *pipe = new plDXPipeline( hWnd, devMode ); // Taken out 8.1.2001 mcn - If we have an error, still return so the client can grab the string // if( pipe->GetErrorString() != nil ) diff --git a/Sources/Plasma/PubUtilLib/plPipeline/plDXPipeline.h b/Sources/Plasma/PubUtilLib/plPipeline/plDXPipeline.h index ff21bbad..cdc4e2e4 100644 --- a/Sources/Plasma/PubUtilLib/plPipeline/plDXPipeline.h +++ b/Sources/Plasma/PubUtilLib/plPipeline/plDXPipeline.h @@ -140,7 +140,7 @@ class plDXPlateManager : public plPlateManager struct plPlateVertex { hsPoint3 fPoint; - UInt32 fColor; + uint32_t fColor; hsPoint3 fUV; }; @@ -221,9 +221,9 @@ protected: D3DFORMAT fSharedDepthFormat[2]; // Dynamic buffers - UInt32 fVtxRefTime; - UInt32 fNextDynVtx; - UInt32 fDynVtxSize; + uint32_t fVtxRefTime; + uint32_t fNextDynVtx; + uint32_t fDynVtxSize; IDirect3DVertexBuffer9* fDynVtxBuff; hsBool fManagedAlloced; hsBool fAllocUnManaged; @@ -250,8 +250,8 @@ protected: hsGMaterial* fCurrMaterial; plLayerInterface* fCurrLay; - UInt32 fCurrLayerIdx, fCurrNumLayers, fCurrRenderLayer; - UInt32 fCurrLightingMethod; // Based on plSpan flags + uint32_t fCurrLayerIdx, fCurrNumLayers, fCurrRenderLayer; + uint32_t fCurrLightingMethod; // Based on plSpan flags D3DCULL fCurrCullMode; hsGMatState fMatOverOn; @@ -268,8 +268,8 @@ protected: plLayerInterface* fOverBaseLayer; plLayerInterface* fOverAllLayer; hsTArray fPiggyBackStack; - Int32 fMatPiggyBacks; - Int32 fActivePiggyBacks; + int32_t fMatPiggyBacks; + int32_t fActivePiggyBacks; UINT fCurrentAdapter; D3DEnum_DriverInfo* fCurrentDriver; @@ -281,31 +281,31 @@ protected: hsGMatState fOldLayerState[ 8 ]; hsBool fLayerTransform[ 8 ]; float fLayerLODBias[ 8 ]; - UInt32 fLayerUVWSrcs[ 8 ]; - UInt32 fLayerXformFlags[ 8 ]; - UInt32 fLastEndingStage; + uint32_t fLayerUVWSrcs[ 8 ]; + uint32_t fLayerXformFlags[ 8 ]; + uint32_t fLastEndingStage; hsBool fTexturing; hsBool fForceMatHandle; - UInt32 fInSceneDepth; - UInt32 fTextUseTime; // inc'd every frame - stat gather only - static UInt32 fTexManaged; - static UInt32 fTexUsed; - static UInt32 fVtxManaged; - static UInt32 fVtxUsed; - UInt32 fEvictTime; - UInt32 fManagedSeen; - UInt32 fManagedCutoff; + uint32_t fInSceneDepth; + uint32_t fTextUseTime; // inc'd every frame - stat gather only + static uint32_t fTexManaged; + static uint32_t fTexUsed; + static uint32_t fVtxManaged; + static uint32_t fVtxUsed; + uint32_t fEvictTime; + uint32_t fManagedSeen; + uint32_t fManagedCutoff; double fTime; // World time. - UInt32 fFrame; // inc'd every time the camera moves. - UInt32 fRenderCnt; // inc'd every begin scene. + uint32_t fFrame; // inc'd every time the camera moves. + uint32_t fRenderCnt; // inc'd every begin scene. // View stuff plDXViewSettings fView; hsBitVector fDebugFlags; - UInt32 fDebugSpanGraphY; + uint32_t fDebugSpanGraphY; // Fog plDXFogSettings fCurrFog; @@ -321,12 +321,12 @@ protected: hsTArray fRenderTargetPool64; hsTArray fRenderTargetPool32; enum { kMaxRenderTargetNext = 10 }; - UInt32 fRenderTargetNext[kMaxRenderTargetNext]; + uint32_t fRenderTargetNext[kMaxRenderTargetNext]; plDXTextureRef* fULutTextureRef; plRenderTarget* fBlurScratchRTs[kMaxRenderTargetNext]; plRenderTarget* fBlurDestRTs[kMaxRenderTargetNext]; IDirect3DVertexBuffer9* fBlurVBuffers[kMaxRenderTargetNext]; - UInt32 fBlurVSHandle; + uint32_t fBlurVSHandle; hsTArray fClothingOutfits; hsTArray fPrevClothingOutfits; @@ -334,7 +334,7 @@ protected: // Debug stuff plDrawableSpans *fBoundsSpans; hsGMaterial *fBoundsMat; - hsTArray fBSpansToDelete; + hsTArray fBSpansToDelete; plStatusLogDrawer *fLogDrawer; @@ -350,29 +350,29 @@ protected: hsBool IRefreshDynVertices(plGBufferGroup* group, plDXVertexBufferRef* vRef); hsBool ICheckAuxBuffers(const plAuxSpan* span); hsBool ICheckDynBuffers(plDrawableSpans* drawable, plGBufferGroup* group, const plSpan* span); - void ICheckStaticVertexBuffer(plDXVertexBufferRef* vRef, plGBufferGroup* owner, UInt32 idx); + void ICheckStaticVertexBuffer(plDXVertexBufferRef* vRef, plGBufferGroup* owner, uint32_t idx); void ICheckIndexBuffer(plDXIndexBufferRef* iRef); - void IFillStaticVertexBufferRef(plDXVertexBufferRef *ref, plGBufferGroup *group, UInt32 idx); - void IFillIndexBufferRef(plDXIndexBufferRef* iRef, plGBufferGroup* owner, UInt32 idx); - void ISetupVertexBufferRef(plGBufferGroup* owner, UInt32 idx, plDXVertexBufferRef* vRef); - void ISetupIndexBufferRef(plGBufferGroup* owner, UInt32 idx, plDXIndexBufferRef* iRef); + void IFillStaticVertexBufferRef(plDXVertexBufferRef *ref, plGBufferGroup *group, uint32_t idx); + void IFillIndexBufferRef(plDXIndexBufferRef* iRef, plGBufferGroup* owner, uint32_t idx); + void ISetupVertexBufferRef(plGBufferGroup* owner, uint32_t idx, plDXVertexBufferRef* vRef); + void ISetupIndexBufferRef(plGBufferGroup* owner, uint32_t idx, plDXIndexBufferRef* iRef); void ICreateDynamicBuffers(); void IReleaseDynamicBuffers(); - void IAddBoundsSpan( plDrawableSpans *ice, const hsBounds3Ext *bounds, UInt32 bndColor = 0xffff0000 ); - void IAddNormalsSpan( plDrawableSpans *ice, plIcicle *span, plDXVertexBufferRef *vRef, UInt32 bndColor ); + void IAddBoundsSpan( plDrawableSpans *ice, const hsBounds3Ext *bounds, uint32_t bndColor = 0xffff0000 ); + void IAddNormalsSpan( plDrawableSpans *ice, plIcicle *span, plDXVertexBufferRef *vRef, uint32_t bndColor ); // Rendering hsBool IFlipSurface(); - long IGetBufferD3DFormat(UInt8 format) const; - UInt32 IGetBufferFormatSize(UInt8 format) const; - void IGetVisibleSpans( plDrawableSpans* drawable, hsTArray& visList, plVisMgr* visMgr ); - void IRenderSpans( plDrawableSpans *ice, const hsTArray& visList ); + long IGetBufferD3DFormat(uint8_t format) const; + uint32_t IGetBufferFormatSize(uint8_t format) const; + void IGetVisibleSpans( plDrawableSpans* drawable, hsTArray& visList, plVisMgr* visMgr ); + void IRenderSpans( plDrawableSpans *ice, const hsTArray& visList ); hsBool ILoopOverLayers(const plRenderPrimFunc& render, hsGMaterial* material, const plSpan& span); void IRenderBufferSpan( const plIcicle& span, hsGDeviceRef *vb, hsGDeviceRef *ib, hsGMaterial *material, - UInt32 vStart, UInt32 vLength, UInt32 iStart, UInt32 iLength ); + uint32_t vStart, uint32_t vLength, uint32_t iStart, uint32_t iLength ); void IRenderAuxSpan(const plSpan& span, const plAuxSpan* aux); void IRenderAuxSpans(const plSpan& span); @@ -382,14 +382,14 @@ protected: // Lighting hsGDeviceRef *IMakeLightRef( plLightInfo *owner ); - void IScaleD3DLight( plDXLightRef *ref, hsScalar scale); + void IScaleD3DLight( plDXLightRef *ref, float scale); void ICalcLighting( const plLayerInterface *currLayer, const plSpan *currSpan ); void IDisableSpanLights(); void IRestoreSpanLights(); void ISelectLights( plSpan *span, int numLights, hsBool proj ); void IEnableLights( plSpan *span ); void IMakeLightLists(plVisMgr* visMgr); - void ICheckLighting(plDrawableSpans* drawable, hsTArray& visList, plVisMgr* visMgr); + void ICheckLighting(plDrawableSpans* drawable, hsTArray& visList, plVisMgr* visMgr); inline void inlEnsureLightingOff(); inline void inlEnsureLightingOn(); void IRenderProjection(const plRenderPrimFunc& render, plLightInfo* li); @@ -397,29 +397,29 @@ protected: void IRenderProjectionEach(const plRenderPrimFunc& render, hsGMaterial* material, int iPass, const plSpan& span); void IRenderOverWire(const plRenderPrimFunc& render, hsGMaterial* material, const plSpan& span); - hsBool ISkipBumpMap(hsGMaterial* newMat, UInt32& layer, const plSpan* currSpan) const; + hsBool ISkipBumpMap(hsGMaterial* newMat, uint32_t& layer, const plSpan* currSpan) const; void ISetBumpMatrices(const plLayerInterface* layer, const plSpan* span); - const hsMatrix44& IGetBumpMatrix(UInt32 miscFlags) const; + const hsMatrix44& IGetBumpMatrix(uint32_t miscFlags) const; // Materials const hsGMatState& ICompositeLayerState(int which, plLayerInterface* layer); - Int32 IHandleMaterial(hsGMaterial* newMat, UInt32 which, const plSpan* currSpan); + int32_t IHandleMaterial(hsGMaterial* newMat, uint32_t which, const plSpan* currSpan); void IHandleFirstTextureStage( plLayerInterface* layer ); void IHandleShadeMode(); void IHandleZMode(); void IHandleMiscMode(); - void IHandleTextureStage(UInt32 stage, plLayerInterface* layer); + void IHandleTextureStage(uint32_t stage, plLayerInterface* layer); void IHandleFirstStageBlend(); - void IHandleBumpEnv(int stage, UInt32 blendFlags); + void IHandleBumpEnv(int stage, uint32_t blendFlags); void IHandleStageBlend(int stage); void IHandleStageClamp(int stage); void IHandleStageTransform(int stage, plLayerInterface* layer); void IHandleTextureMode(plLayerInterface* layer); void IUseTextureRef(int stage, hsGDeviceRef* dRef, plLayerInterface* layer); - void IStageStop(UInt32 stage); - UInt32 ILayersAtOnce(hsGMaterial* mat, UInt32 which); + void IStageStop(uint32_t stage); + uint32_t ILayersAtOnce(hsGMaterial* mat, uint32_t which); hsBool ICanEatLayer(plLayerInterface* lay); - void ISetLayer(UInt32 lay); + void ISetLayer(uint32_t lay); void IBottomLayer(); // Push special effects @@ -439,34 +439,34 @@ protected: // Stenciling virtual hsBool StencilEnable( hsBool enable ); - virtual void StencilSetCompareFunc( UInt8 func, UInt32 refValue ); - virtual void StencilSetMask( UInt32 mask, UInt32 writeMask ); - virtual void StencilSetOps( UInt8 passOp, UInt8 failOp, UInt8 passButZFailOp ); + virtual void StencilSetCompareFunc( uint8_t func, uint32_t refValue ); + virtual void StencilSetMask( uint32_t mask, uint32_t writeMask ); + virtual void StencilSetOps( uint8_t passOp, uint8_t failOp, uint8_t passButZFailOp ); virtual hsBool StencilGetCaps( plStencilCaps *caps ); hsGDeviceRef *MakeTextureRef( plLayerInterface* layer, plMipmap *b ); void IReloadTexture( plDXTextureRef *ref ); void IFillD3DTexture( plDXTextureRef *ref ); void IFillD3DCubeTexture( plDXCubeTextureRef *ref ); - void IGetD3DTextureFormat( plBitmap *b, D3DFORMAT &formatType, UInt32& texSize ); - void IFormatTextureData( UInt32 formatType, UInt32 numPix, hsRGBAColor32* const src, void *dst ); - void *IGetPixelScratch( UInt32 size ); + void IGetD3DTextureFormat( plBitmap *b, D3DFORMAT &formatType, uint32_t& texSize ); + void IFormatTextureData( uint32_t formatType, uint32_t numPix, hsRGBAColor32* const src, void *dst ); + void *IGetPixelScratch( uint32_t size ); hsGDeviceRef *IMakeCubicTextureRef( plLayerInterface* layer, plCubicEnvironmap *cubic ); - hsBool IProcessMipmapLevels( plMipmap *mipmap, UInt32 &numLevels, - UInt32 *&levelSizes, UInt32 &totalSize, - UInt32 &numPixels, void *&textureData, hsBool noMip ); + hsBool IProcessMipmapLevels( plMipmap *mipmap, uint32_t &numLevels, + uint32_t *&levelSizes, uint32_t &totalSize, + uint32_t &numPixels, void *&textureData, hsBool noMip ); IDirect3DTexture9 *IMakeD3DTexture( plDXTextureRef *ref, D3DFORMAT formatType ); IDirect3DCubeTexture9 *IMakeD3DCubeTexture( plDXTextureRef *ref, D3DFORMAT formatType ); // Visualization of active occluders void IMakeOcclusionSnap(); - hsBool IAvatarSort(plDrawableSpans* d, const hsTArray& visList); + hsBool IAvatarSort(plDrawableSpans* d, const hsTArray& visList); void IBlendVertsIntoBuffer( plSpan* span, hsMatrix44* matrixPalette, int numMatrices, - const UInt8 *src, UInt8 format, UInt32 srcStride, - UInt8 *dest, UInt32 destStride, UInt32 count, UInt16 localUVWChans ); - hsBool ISoftwareVertexBlend( plDrawableSpans* drawable, const hsTArray& visList ); + const uint8_t *src, uint8_t format, uint32_t srcStride, + uint8_t *dest, uint32_t destStride, uint32_t count, uint16_t localUVWChans ); + hsBool ISoftwareVertexBlend( plDrawableSpans* drawable, const hsTArray& visList ); void ILinkDevRef( plDXDeviceRef *ref, plDXDeviceRef **refList ); @@ -492,7 +492,7 @@ protected: void IClearMembers(); void ISetCaps(); void IRestrictCaps( const hsG3DDeviceRecord& devRec ); - void ISetGraphicsCapability(UInt32 v); + void ISetGraphicsCapability(uint32_t v); hsBool IFindDepthFormat(D3DPRESENT_PARAMETERS& params); hsBool IFindCompressedFormats(); @@ -572,12 +572,12 @@ protected: void IReleaseBlurVBuffers(); void IMakeRenderTargetPools(); void IResetRenderTargetPools(); - plRenderTarget* IFindRenderTarget(UInt32& w, UInt32& h, hsBool ortho); + plRenderTarget* IFindRenderTarget(uint32_t& w, uint32_t& h, hsBool ortho); void IReleaseRenderTargetPools(); // Selection - void IAttachSlaveToReceivers(int iSlave, plDrawableSpans* drawable, const hsTArray& visList); - void IAttachShadowsToReceivers(plDrawableSpans* drawable, const hsTArray& visList); + void IAttachSlaveToReceivers(int iSlave, plDrawableSpans* drawable, const hsTArray& visList); + void IAttachShadowsToReceivers(plDrawableSpans* drawable, const hsTArray& visList); hsBool IAcceptsShadow(const plSpan* span, plShadowSlave* slave); hsBool IReceivesShadows(const plSpan* span, hsGMaterial* mat); void ISetShadowFromGroup(plDrawableSpans* drawable, const plSpan* span, plLightInfo* liInfo); @@ -593,7 +593,7 @@ protected: // Postprocess (blurring) hsBool ISetBlurQuadToRender(plRenderTarget* smap); void IRenderBlurBackToShadowMap(plRenderTarget* smap, plRenderTarget* scratch, plRenderTarget* dst); - void IRenderBlurFromShadowMap(plRenderTarget* scratchRT, plRenderTarget* smap, hsScalar scale); + void IRenderBlurFromShadowMap(plRenderTarget* scratchRT, plRenderTarget* smap, float scale); void IBlurSetRenderTarget(plRenderTarget* rt); int IGetScratchRenderTarget(plRenderTarget* smap); void IBlurShadowMap(plShadowSlave* slave); @@ -601,15 +601,15 @@ protected: // Avatar Texture Rendering double fAvRTShrinkValidSince; hsTArray fAvRTPool; - UInt16 fAvRTWidth; - UInt32 fAvNextFreeRT; + uint16_t fAvRTWidth; + uint32_t fAvNextFreeRT; void IFillAvRTPool(); - hsBool IFillAvRTPool(UInt16 numRTs, UInt16 width); // Returns true if we successfully filled the pool. Otherwise cleans up. + hsBool IFillAvRTPool(uint16_t numRTs, uint16_t width); // Returns true if we successfully filled the pool. Otherwise cleans up. void IReleaseAvRTPool(); plRenderTarget* IGetNextAvRT(); void IFreeAvRT(plRenderTarget* tex); void IPreprocessAvatarTextures(); - void IDrawClothingQuad(hsScalar x, hsScalar y, hsScalar w, hsScalar h, hsScalar uOff, hsScalar vOff, plMipmap *tex); + void IDrawClothingQuad(float x, float y, float w, float h, float uOff, float vOff, plMipmap *tex); void IClearClothingOutfits(hsTArray* outfits); void IPrintDeviceInitError(); @@ -626,9 +626,9 @@ public: virtual IDirect3DDevice9* GetD3DDevice() const { return fD3DDevice; } // Typical 3D device - virtual hsBool PreRender(plDrawable* drawable, hsTArray& visList, plVisMgr* visMgr=nil); - virtual hsBool PrepForRender(plDrawable* drawable, hsTArray& visList, plVisMgr* visMgr=nil); - virtual void Render(plDrawable* d, const hsTArray& visList); + virtual hsBool PreRender(plDrawable* drawable, hsTArray& visList, plVisMgr* visMgr=nil); + virtual hsBool PrepForRender(plDrawable* drawable, hsTArray& visList, plVisMgr* visMgr=nil); + virtual void Render(plDrawable* d, const hsTArray& visList); virtual void Draw(plDrawable* d); virtual void PushRenderRequest(plRenderRequest* req); @@ -637,10 +637,10 @@ public: void ResetDisplayDevice(int Width, int Height, int ColorDepth, hsBool Windowed, int NumAASamples, int MaxAnisotropicSamples, hsBool VSync = false ); virtual void ClearRenderTarget( plDrawable* d ); - virtual void ClearRenderTarget( const hsColorRGBA* col = nil, const hsScalar* depth = nil ); - virtual void SetClear(const hsColorRGBA* col=nil, const hsScalar* depth=nil); + virtual void ClearRenderTarget( const hsColorRGBA* col = nil, const float* depth = nil ); + virtual void SetClear(const hsColorRGBA* col=nil, const float* depth=nil); virtual hsColorRGBA GetClearColor() const; - virtual hsScalar GetClearDepth() const; + virtual float GetClearDepth() const; virtual hsGDeviceRef* MakeRenderTargetRef( plRenderTarget *owner ); virtual hsGDeviceRef* SharedRenderTargetRef(plRenderTarget* sharer, plRenderTarget *owner); virtual void PushRenderTarget( plRenderTarget *target ); @@ -657,58 +657,58 @@ public: virtual void EndVisMgr(plVisMgr* visMgr); virtual hsBool IsFullScreen() const { return fSettings.fFullscreen; } - virtual UInt32 Width() const { return fView.fTransform.GetViewPortWidth(); } - virtual UInt32 Height() const { return fView.fTransform.GetViewPortHeight(); } - virtual UInt32 ColorDepth() const { return fSettings.fColorDepth; } - virtual void Resize( UInt32 width, UInt32 height ); + virtual uint32_t Width() const { return fView.fTransform.GetViewPortWidth(); } + virtual uint32_t Height() const { return fView.fTransform.GetViewPortHeight(); } + virtual uint32_t ColorDepth() const { return fSettings.fColorDepth; } + virtual void Resize( uint32_t width, uint32_t height ); // Culling. Might be used in Update before bothering to do any serious computation. virtual hsBool TestVisibleWorld(const hsBounds3Ext& wBnd); virtual hsBool TestVisibleWorld(const plSceneObject* sObj); - virtual hsBool HarvestVisible(plSpaceTree* space, hsTArray& visList); + virtual hsBool HarvestVisible(plSpaceTree* space, hsTArray& visList); virtual hsBool SubmitOccluders(const hsTArray& polyList); // Debug flags - virtual void SetDebugFlag( UInt32 flag, hsBool on ); - virtual hsBool IsDebugFlagSet( UInt32 flag ) const; + virtual void SetDebugFlag( uint32_t flag, hsBool on ); + virtual hsBool IsDebugFlagSet( uint32_t flag ) const; // These are also only for debugging. - virtual void SetMaxCullNodes(UInt16 n) { fView.fCullMaxNodes = n; } - virtual UInt16 GetMaxCullNodes() const { return fView.fCullMaxNodes; } + virtual void SetMaxCullNodes(uint16_t n) { fView.fCullMaxNodes = n; } + virtual uint16_t GetMaxCullNodes() const { return fView.fCullMaxNodes; } virtual hsBool CheckResources(); virtual void LoadResources(); // Tells us where it's a good time to load in unmanaged resources. // Properties - virtual void SetProperty( UInt32 prop, hsBool on ) { on ? fSettings.fProperties |= prop : fSettings.fProperties &= ~prop; } - virtual hsBool GetProperty( UInt32 prop ) const { return ( fSettings.fProperties & prop ) ? true : false; } + virtual void SetProperty( uint32_t prop, hsBool on ) { on ? fSettings.fProperties |= prop : fSettings.fProperties &= ~prop; } + virtual hsBool GetProperty( uint32_t prop ) const { return ( fSettings.fProperties & prop ) ? true : false; } - virtual UInt32 GetMaxLayersAtOnce() const { return fSettings.fMaxLayersAtOnce; } + virtual uint32_t GetMaxLayersAtOnce() const { return fSettings.fMaxLayersAtOnce; } // Drawable type mask - virtual void SetDrawableTypeMask( UInt32 mask ) { fView.fDrawableTypeMask = mask; } - virtual UInt32 GetDrawableTypeMask() const { return fView.fDrawableTypeMask; } - virtual void SetSubDrawableTypeMask( UInt32 mask ) { fView.fSubDrawableTypeMask = mask; } - virtual UInt32 GetSubDrawableTypeMask() const { return fView.fSubDrawableTypeMask; } + virtual void SetDrawableTypeMask( uint32_t mask ) { fView.fDrawableTypeMask = mask; } + virtual uint32_t GetDrawableTypeMask() const { return fView.fDrawableTypeMask; } + virtual void SetSubDrawableTypeMask( uint32_t mask ) { fView.fSubDrawableTypeMask = mask; } + virtual uint32_t GetSubDrawableTypeMask() const { return fView.fSubDrawableTypeMask; } // Create a debug text font object - virtual plTextFont *MakeTextFont( char *face, UInt16 size ); + virtual plTextFont *MakeTextFont( char *face, uint16_t size ); // Create and/or Refresh geometry buffers - virtual void CheckVertexBufferRef(plGBufferGroup* owner, UInt32 idx); - virtual void CheckIndexBufferRef(plGBufferGroup* owner, UInt32 idx); + virtual void CheckVertexBufferRef(plGBufferGroup* owner, uint32_t idx); + virtual void CheckIndexBufferRef(plGBufferGroup* owner, uint32_t idx); virtual hsBool OpenAccess(plAccessSpan& dst, plDrawableSpans* d, const plVertexSpan* span, hsBool readOnly); virtual hsBool CloseAccess(plAccessSpan& acc); virtual void CheckTextureRef(plLayerInterface* lay); - static void FreeManagedTexture(UInt32 sz) { hsAssert(fTexManaged >= sz, "Freeing mem we don't have"); fTexManaged -= sz; } - static void AllocManagedTexture(UInt32 sz) { fTexManaged += sz; } - static void FreeManagedVertex(UInt32 sz) { hsAssert(fVtxManaged >= sz, "Freeing mem we don't have"); fVtxManaged -= sz; } - static void AllocManagedVertex(UInt32 sz) { fVtxManaged += sz; } + static void FreeManagedTexture(uint32_t sz) { hsAssert(fTexManaged >= sz, "Freeing mem we don't have"); fTexManaged -= sz; } + static void AllocManagedTexture(uint32_t sz) { fTexManaged += sz; } + static void FreeManagedVertex(uint32_t sz) { hsAssert(fVtxManaged >= sz, "Freeing mem we don't have"); fVtxManaged -= sz; } + static void AllocManagedVertex(uint32_t sz) { fVtxManaged += sz; } #ifndef PLASMA_EXTERNAL_RELEASE - static void ProfilePoolMem(D3DPOOL poolType, UInt32 size, hsBool add, char *id); + static void ProfilePoolMem(D3DPOOL poolType, uint32_t size, hsBool add, char *id); #endif // PLASMA_EXTERNAL_RELEASE // From a D3DFORMAT enumeration, return the bit depth associated with it. @@ -725,17 +725,17 @@ public: virtual hsVector3 GetViewDirWorld() const { return GetViewTransform().GetDirection(); } virtual void GetViewAxesWorld(hsVector3 axes[3] /* ac,up,at */ ) const; - virtual void GetFOV(hsScalar& fovX, hsScalar& fovY) const; - virtual void SetFOV(hsScalar fovX, hsScalar fovY); + virtual void GetFOV(float& fovX, float& fovY) const; + virtual void SetFOV(float fovX, float fovY); - virtual void GetSize(hsScalar& width, hsScalar& height) const; - virtual void SetSize(hsScalar width, hsScalar height); + virtual void GetSize(float& width, float& height) const; + virtual void SetSize(float width, float height); - virtual void GetDepth(hsScalar& hither, hsScalar& yon) const; - virtual void SetDepth(hsScalar hither, hsScalar yon); + virtual void GetDepth(float& hither, float& yon) const; + virtual void SetDepth(float hither, float yon); - virtual hsScalar GetZBiasScale() const; - virtual void SetZBiasScale(hsScalar scale); + virtual float GetZBiasScale() const; + virtual void SetZBiasScale(float scale); virtual const hsMatrix44& GetWorldToCamera() const; virtual const hsMatrix44& GetCameraToWorld() const; @@ -747,8 +747,8 @@ public: virtual const hsMatrix44& GetWorldToLocal() const; virtual const hsMatrix44& GetLocalToWorld() const; - virtual void ScreenToWorldPoint( int n, UInt32 stride, Int32 *scrX, Int32 *scrY, - hsScalar dist, UInt32 strideOut, hsPoint3 *worldOut ); + virtual void ScreenToWorldPoint( int n, uint32_t stride, int32_t *scrX, int32_t *scrY, + float dist, uint32_t strideOut, hsPoint3 *worldOut ); virtual void RefreshMatrices(); virtual void RefreshScreenMatrices(); @@ -767,11 +767,11 @@ public: virtual plLayerInterface* PushPiggyBackLayer(plLayerInterface* li); virtual plLayerInterface* PopPiggyBackLayer(plLayerInterface* li); - virtual UInt32 GetMaterialOverrideOn(hsGMatState::StateIdx category) const; - virtual UInt32 GetMaterialOverrideOff(hsGMatState::StateIdx category) const; + virtual uint32_t GetMaterialOverrideOn(hsGMatState::StateIdx category) const; + virtual uint32_t GetMaterialOverrideOff(hsGMatState::StateIdx category) const; virtual hsGMatState PushMaterialOverride(const hsGMatState& state, hsBool on); - virtual hsGMatState PushMaterialOverride(hsGMatState::StateIdx cat, UInt32 which, hsBool on); + virtual hsGMatState PushMaterialOverride(hsGMatState::StateIdx cat, uint32_t which, hsBool on); virtual void PopMaterialOverride(const hsGMatState& restore, hsBool on); virtual const hsGMatState& GetMaterialOverride(hsBool on) const; @@ -782,10 +782,10 @@ public: virtual void SubmitShadowSlave(plShadowSlave* slave); virtual void SubmitClothingOutfit(plClothingOutfit* co); - virtual hsBool SetGamma(hsScalar eR, hsScalar eG, hsScalar eB); - virtual hsBool SetGamma(const UInt16* const tabR, const UInt16* const tabG, const UInt16* const tabB); + virtual hsBool SetGamma(float eR, float eG, float eB); + virtual hsBool SetGamma(const uint16_t* const tabR, const uint16_t* const tabG, const uint16_t* const tabB); - virtual hsBool CaptureScreen( plMipmap *dest, bool flipVertical = false, UInt16 desiredWidth = 0, UInt16 desiredHeight = 0 ); + virtual hsBool CaptureScreen( plMipmap *dest, bool flipVertical = false, uint16_t desiredWidth = 0, uint16_t desiredHeight = 0 ); virtual plMipmap* ExtractMipMap(plRenderTarget* targ); /// Error handling diff --git a/Sources/Plasma/PubUtilLib/plPipeline/plDXPixelShader.cpp b/Sources/Plasma/PubUtilLib/plPipeline/plDXPixelShader.cpp index 3b917433..930314a1 100644 --- a/Sources/Plasma/PubUtilLib/plPipeline/plDXPixelShader.cpp +++ b/Sources/Plasma/PubUtilLib/plPipeline/plDXPixelShader.cpp @@ -39,14 +39,11 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com Mead, WA 99021 *==LICENSE==*/ -#include "hsConfig.h" -#include "hsWindows.h" +#include "HeadSpin.h" #include #include -#include "hsTypes.h" - #include "plDXPixelShader.h" #include "plSurface/plShader.h" @@ -73,7 +70,7 @@ void plDXPixelShader::Release() ISetError(nil); } -hsBool plDXPixelShader::VerifyFormat(UInt8 format) const +hsBool plDXPixelShader::VerifyFormat(uint8_t format) const { return (fOwner->GetInputFormat() & format) == fOwner->GetInputFormat(); } diff --git a/Sources/Plasma/PubUtilLib/plPipeline/plDXPixelShader.h b/Sources/Plasma/PubUtilLib/plPipeline/plDXPixelShader.h index dc34c8b6..1c0545a3 100644 --- a/Sources/Plasma/PubUtilLib/plPipeline/plDXPixelShader.h +++ b/Sources/Plasma/PubUtilLib/plPipeline/plDXPixelShader.h @@ -64,7 +64,7 @@ public: void Release(); void Link(plDXPixelShader** back) { plDXDeviceRef::Link((plDXDeviceRef**)back); } - hsBool VerifyFormat(UInt8 format) const; + hsBool VerifyFormat(uint8_t format) const; IDirect3DPixelShader9 *GetShader(plDXPipeline* pipe); }; diff --git a/Sources/Plasma/PubUtilLib/plPipeline/plDXRenderTargetRef.h b/Sources/Plasma/PubUtilLib/plPipeline/plDXRenderTargetRef.h index c537275e..e1bbf033 100644 --- a/Sources/Plasma/PubUtilLib/plPipeline/plDXRenderTargetRef.h +++ b/Sources/Plasma/PubUtilLib/plPipeline/plDXRenderTargetRef.h @@ -74,8 +74,8 @@ class plDXRenderTargetRef: public plDXTextureRef plDXRenderTargetRef *GetNext( void ) { return (plDXRenderTargetRef *)fNext; } - plDXRenderTargetRef( D3DFORMAT tp, UInt32 ml, plRenderTarget *owner, hsBool releaseDepthOnDelete = true ); - plDXRenderTargetRef& Set( D3DFORMAT tp, UInt32 ml, plRenderTarget *owner ); + plDXRenderTargetRef( D3DFORMAT tp, uint32_t ml, plRenderTarget *owner, hsBool releaseDepthOnDelete = true ); + plDXRenderTargetRef& Set( D3DFORMAT tp, uint32_t ml, plRenderTarget *owner ); virtual void SetOwner( plRenderTarget *targ ) { fOwner = (plBitmap *)targ; } diff --git a/Sources/Plasma/PubUtilLib/plPipeline/plDXSettings.h b/Sources/Plasma/PubUtilLib/plPipeline/plDXSettings.h index 9bdcbea4..26249e9d 100644 --- a/Sources/Plasma/PubUtilLib/plPipeline/plDXSettings.h +++ b/Sources/Plasma/PubUtilLib/plPipeline/plDXSettings.h @@ -77,12 +77,12 @@ class plDXIndexBufferRef; class plDXViewSettings { public: - UInt32 fRenderState; + uint32_t fRenderState; plRenderRequest* fRenderRequest; - UInt32 fDrawableTypeMask; - UInt32 fSubDrawableTypeMask; + uint32_t fDrawableTypeMask; + uint32_t fSubDrawableTypeMask; DWORD fClearColor; float fClearDepth; @@ -91,7 +91,7 @@ public: plCullTree fCullTree; hsBool fCullTreeDirty; - UInt16 fCullMaxNodes; + uint16_t fCullMaxNodes; enum XformResets { @@ -102,7 +102,7 @@ public: kResetAll = 0x07 }; - UInt8 fXformResetFlags; + uint8_t fXformResetFlags; hsBool fLocalToWorldLeftHanded; hsBool fWorldToCamLeftHanded; @@ -134,17 +134,17 @@ class plDXGeneralSettings hsBool fFullscreen; hsWinRef fHWnd; - UInt32 fColorDepth; - UInt8 fNumAASamples; - UInt32 fD3DCaps, fBoardKluge, fStageEnd; - UInt32 fMaxNumLights; - UInt32 fMaxNumProjectors; - UInt32 fMaxLayersAtOnce; - UInt32 fMaxPiggyBacks; - Int32 fBoundsDrawLevel; - UInt32 fProperties; + uint32_t fColorDepth; + uint8_t fNumAASamples; + uint32_t fD3DCaps, fBoardKluge, fStageEnd; + uint32_t fMaxNumLights; + uint32_t fMaxNumProjectors; + uint32_t fMaxLayersAtOnce; + uint32_t fMaxPiggyBacks; + int32_t fBoundsDrawLevel; + uint32_t fProperties; DWORD fClearColor; - UInt8 fMaxAnisotropicSamples; + uint8_t fMaxAnisotropicSamples; D3DPRESENT_PARAMETERS fPresentParams; hsBool fVeryAnnoyingTextureInvalidFlag; hsBool fNoGammaCorrect; @@ -166,7 +166,7 @@ class plDXGeneralSettings plDXDeviceRef *fCurrRenderTargetRef; plDXVertexBufferRef *fCurrVertexBuffRef; plDXIndexBufferRef *fCurrIndexBuffRef; - UInt32 fOrigWidth, fOrigHeight; + uint32_t fOrigWidth, fOrigHeight; IDirect3DVertexShader9 *fCurrVertexShader; IDirect3DPixelShader9 *fCurrPixelShader; @@ -218,9 +218,9 @@ class plDXFogSettings public: plFogEnvironment* fEnvPtr; // nil means no fog D3DFOGMODE fMode; - UInt8 fIsVertex; - UInt8 fIsShader; - UInt32 fHexColor; + uint8_t fIsVertex; + uint8_t fIsShader; + uint32_t fHexColor; float fStart; float fEnd; float fDensity; @@ -248,8 +248,8 @@ class plDXLightSettings hsBitVector fUsedFlags; hsBitVector fEnabledFlags; hsBitVector fHoldFlags; - UInt32 fNextIndex, fLastIndex; - UInt16 fTime; + uint32_t fNextIndex, fLastIndex; + uint16_t fTime; plLightInfo* fActiveList; plDXLightRef* fRefList; plDXPipeline* fPipeline; @@ -259,7 +259,7 @@ class plDXLightSettings hsTArray fCharLights; hsTArray fVisLights; - UInt32 fNextShadowLight; + uint32_t fNextShadowLight; hsTArray fShadowLights; plDXLightSettings(); @@ -269,9 +269,9 @@ class plDXLightSettings // Releases/deletes anything associated with these settings void Release( void ); // Reserve a D3D light index - UInt32 ReserveD3DIndex( void ); + uint32_t ReserveD3DIndex( void ); // Release a reserved D3D light index - void ReleaseD3DIndex( UInt32 idx ); + void ReleaseD3DIndex( uint32_t idx ); }; //// Stencil Settings ///////////////////////////////////////////////////////// @@ -279,13 +279,13 @@ class plDXLightSettings class plDXStencilSettings { public: - UInt8 fDepth; + uint8_t fDepth; hsBool fEnabled; - UInt8 fCmpFunc; - UInt8 fFailOp, fPassOp, fPassButZFailOp; - UInt32 fRefValue; - UInt32 fMask; - UInt32 fWriteMask; + uint8_t fCmpFunc; + uint8_t fFailOp, fPassOp, fPassButZFailOp; + uint32_t fRefValue; + uint32_t fMask; + uint32_t fWriteMask; void Reset( void ) { diff --git a/Sources/Plasma/PubUtilLib/plPipeline/plDXShader.cpp b/Sources/Plasma/PubUtilLib/plPipeline/plDXShader.cpp index 3b6bafc2..5cf6e6ec 100644 --- a/Sources/Plasma/PubUtilLib/plPipeline/plDXShader.cpp +++ b/Sources/Plasma/PubUtilLib/plPipeline/plDXShader.cpp @@ -39,13 +39,12 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com Mead, WA 99021 *==LICENSE==*/ -#include "hsConfig.h" -#include "hsWindows.h" +#include "HeadSpin.h" #include #include -#include "hsTypes.h" +#include "HeadSpin.h" #include "plDXShader.h" diff --git a/Sources/Plasma/PubUtilLib/plPipeline/plDXTextFont.cpp b/Sources/Plasma/PubUtilLib/plPipeline/plDXTextFont.cpp index 8376940f..19be9731 100644 --- a/Sources/Plasma/PubUtilLib/plPipeline/plDXTextFont.cpp +++ b/Sources/Plasma/PubUtilLib/plPipeline/plDXTextFont.cpp @@ -50,15 +50,14 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // // /////////////////////////////////////////////////////////////////////////////// -#include "hsConfig.h" -#include "hsWindows.h" +#include "HeadSpin.h" #include #include #include #include "hsWinRef.h" -#include "hsTypes.h" +#include "HeadSpin.h" #include "plDXTextFont.h" #include "plDXPipeline.h" @@ -77,14 +76,14 @@ static D3DXMATRIX d3dIdentityMatrix( 1.0f, 0.0f, 0.0f, 0.0f, // * 4 primitives per char max (for bold text) // * 3 verts per primitive -//const UInt32 kNumVertsInBuffer(32768); -const UInt32 kNumVertsInBuffer(4608); +//const uint32_t kNumVertsInBuffer(32768); +const uint32_t kNumVertsInBuffer(4608); // See the declaration for plFontVertex in plTextFont.h for info const DWORD plDXTextFont::kFVF = D3DFVF_XYZ | D3DFVF_DIFFUSE | D3DFVF_TEX1 | D3DFVF_TEXCOORDSIZE3(0); IDirect3DVertexBuffer9* plDXTextFont::fBuffer = nil; -UInt32 plDXTextFont::fBufferCursor = 0; +uint32_t plDXTextFont::fBufferCursor = 0; //// Constructor & Destructor ///////////////////////////////////////////////// @@ -103,7 +102,7 @@ plDXTextFont::~plDXTextFont() //// ICreateTexture /////////////////////////////////////////////////////////// -void plDXTextFont::ICreateTexture( UInt16 *data ) +void plDXTextFont::ICreateTexture( uint16_t *data ) { HRESULT hr; D3DLOCKED_RECT lockInfo; @@ -120,7 +119,7 @@ void plDXTextFont::ICreateTexture( UInt16 *data ) // Lock the texture and write our values out fD3DTexture->LockRect( 0, &lockInfo, 0, 0 ); - memcpy( lockInfo.pBits, data, fTextureWidth * fTextureHeight * sizeof( UInt16 ) ); + memcpy( lockInfo.pBits, data, fTextureWidth * fTextureHeight * sizeof( uint16_t ) ); fD3DTexture->UnlockRect( nil ); } @@ -203,7 +202,7 @@ void plDXTextFont::DestroyObjects() //// IDrawPrimitive /////////////////////////////////////////////////////////// -void plDXTextFont::IDrawPrimitive( UInt32 count, plFontVertex *array ) +void plDXTextFont::IDrawPrimitive( uint32_t count, plFontVertex *array ) { plFontVertex *v; @@ -248,7 +247,7 @@ void plDXTextFont::IDrawPrimitive( UInt32 count, plFontVertex *array ) //// IDrawLines /////////////////////////////////////////////////////////////// -void plDXTextFont::IDrawLines( UInt32 count, plFontVertex *array ) +void plDXTextFont::IDrawLines( uint32_t count, plFontVertex *array ) { if( !fBuffer ) return; diff --git a/Sources/Plasma/PubUtilLib/plPipeline/plDXTextFont.h b/Sources/Plasma/PubUtilLib/plPipeline/plDXTextFont.h index a73a7de4..c16b5cb3 100644 --- a/Sources/Plasma/PubUtilLib/plPipeline/plDXTextFont.h +++ b/Sources/Plasma/PubUtilLib/plPipeline/plDXTextFont.h @@ -60,15 +60,15 @@ protected: IDirect3DDevice9 *fDevice; static IDirect3DVertexBuffer9 *fBuffer; - static UInt32 fBufferCursor; + static uint32_t fBufferCursor; IDirect3DStateBlock9 *fOldStateBlock; IDirect3DStateBlock9 *fTextStateBlock; - virtual void ICreateTexture( UInt16 *data ); + virtual void ICreateTexture( uint16_t *data ); virtual void IInitStateBlocks( void ); - virtual void IDrawPrimitive( UInt32 count, plFontVertex *array ); - virtual void IDrawLines( UInt32 count, plFontVertex *array ); + virtual void IDrawPrimitive( uint32_t count, plFontVertex *array ); + virtual void IDrawLines( uint32_t count, plFontVertex *array ); public: plDXTextFont( plPipeline *pipe, IDirect3DDevice9 *device ); diff --git a/Sources/Plasma/PubUtilLib/plPipeline/plDXTextureRef.h b/Sources/Plasma/PubUtilLib/plPipeline/plDXTextureRef.h index 767127bd..97827e87 100644 --- a/Sources/Plasma/PubUtilLib/plPipeline/plDXTextureRef.h +++ b/Sources/Plasma/PubUtilLib/plPipeline/plDXTextureRef.h @@ -82,24 +82,24 @@ class plDXTextureRef : public plDXDeviceRef IDirect3DBaseTexture9 *fD3DTexture; D3DFORMAT fFormatType; // Format of the D3D texture object - UInt32 fMMLvs; // Number of mipmap levels - UInt32 fMaxWidth; // Width of the highest mipmap level - UInt32 fMaxHeight; // Height of the highest mipmap level (no pun intended) - UInt32 fNumPix; // total num texels in all mip levels - UInt32 fDataSize; // size of fData[0..n] in bytes - UInt32* fLevelSizes; // fLevelSize[i] == size in bytes of level i - //UInt32 fCurrLOD; // Current LOD setting for this texture + uint32_t fMMLvs; // Number of mipmap levels + uint32_t fMaxWidth; // Width of the highest mipmap level + uint32_t fMaxHeight; // Height of the highest mipmap level (no pun intended) + uint32_t fNumPix; // total num texels in all mip levels + uint32_t fDataSize; // size of fData[0..n] in bytes + uint32_t* fLevelSizes; // fLevelSize[i] == size in bytes of level i + //uint32_t fCurrLOD; // Current LOD setting for this texture plBitmap *fOwner; void* fData; // for reloading - UInt32 GetFlags( void ) { return fFlags; } - void SetFlags( UInt32 flag ) { fFlags = flag; } + uint32_t GetFlags( void ) { return fFlags; } + void SetFlags( uint32_t flag ) { fFlags = flag; } - plDXTextureRef& Set( D3DFORMAT tp, UInt32 ml, UInt32 mw, UInt32 mh, UInt32 np, UInt32 sz, UInt32 manSize, UInt32* lSz, void* pd, hsBool ed=false, hsBool renderTarget = false ); + plDXTextureRef& Set( D3DFORMAT tp, uint32_t ml, uint32_t mw, uint32_t mh, uint32_t np, uint32_t sz, uint32_t manSize, uint32_t* lSz, void* pd, hsBool ed=false, hsBool renderTarget = false ); - plDXTextureRef( D3DFORMAT tp, UInt32 ml, UInt32 mw, UInt32 mh, UInt32 np, UInt32 sz, UInt32 manSize, UInt32* lSz, void* pd, hsBool ed=false, hsBool renderTarget = false ); + plDXTextureRef( D3DFORMAT tp, uint32_t ml, uint32_t mw, uint32_t mh, uint32_t np, uint32_t sz, uint32_t manSize, uint32_t* lSz, void* pd, hsBool ed=false, hsBool renderTarget = false ); virtual ~plDXTextureRef(); void Link( plDXTextureRef **back ) { plDXDeviceRef::Link( (plDXDeviceRef **)back ); } @@ -113,7 +113,7 @@ class plDXCubeTextureRef : public plDXTextureRef public: void *fFaceData[ 5 ]; // First face is in the inherited fData - plDXCubeTextureRef( D3DFORMAT tp, UInt32 ml, UInt32 mw, UInt32 mh, UInt32 np, UInt32 sz, UInt32 manSize, UInt32* lSz, void* pd, hsBool ed=false, hsBool renderTarget = false ) : + plDXCubeTextureRef( D3DFORMAT tp, uint32_t ml, uint32_t mw, uint32_t mh, uint32_t np, uint32_t sz, uint32_t manSize, uint32_t* lSz, void* pd, hsBool ed=false, hsBool renderTarget = false ) : plDXTextureRef( tp, ml, mw, mh, np, sz, manSize, lSz, pd, ed, renderTarget ) { diff --git a/Sources/Plasma/PubUtilLib/plPipeline/plDXVertexShader.cpp b/Sources/Plasma/PubUtilLib/plPipeline/plDXVertexShader.cpp index e017cbf3..3215159f 100644 --- a/Sources/Plasma/PubUtilLib/plPipeline/plDXVertexShader.cpp +++ b/Sources/Plasma/PubUtilLib/plPipeline/plDXVertexShader.cpp @@ -39,13 +39,12 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com Mead, WA 99021 *==LICENSE==*/ -#include "hsConfig.h" -#include "hsWindows.h" +#include "HeadSpin.h" #include #include -#include "hsTypes.h" +#include "HeadSpin.h" #include "plDXVertexShader.h" @@ -73,7 +72,7 @@ void plDXVertexShader::Release() ISetError(nil); } -hsBool plDXVertexShader::VerifyFormat(UInt8 format) const +hsBool plDXVertexShader::VerifyFormat(uint8_t format) const { return (fOwner->GetInputFormat() & format) == fOwner->GetInputFormat(); } diff --git a/Sources/Plasma/PubUtilLib/plPipeline/plDXVertexShader.h b/Sources/Plasma/PubUtilLib/plPipeline/plDXVertexShader.h index c40ff83e..27f3fb55 100644 --- a/Sources/Plasma/PubUtilLib/plPipeline/plDXVertexShader.h +++ b/Sources/Plasma/PubUtilLib/plPipeline/plDXVertexShader.h @@ -66,7 +66,7 @@ public: virtual void Release(); void Link(plDXVertexShader** back) { plDXDeviceRef::Link((plDXDeviceRef**)back); } - hsBool VerifyFormat(UInt8 format) const; + hsBool VerifyFormat(uint8_t format) const; IDirect3DVertexShader9* GetShader(plDXPipeline* pipe); }; diff --git a/Sources/Plasma/PubUtilLib/plPipeline/plDebugText.cpp b/Sources/Plasma/PubUtilLib/plPipeline/plDebugText.cpp index c850e201..9d310b5e 100644 --- a/Sources/Plasma/PubUtilLib/plPipeline/plDebugText.cpp +++ b/Sources/Plasma/PubUtilLib/plPipeline/plDebugText.cpp @@ -57,7 +57,7 @@ plDebugText plDebugText::fInstance; //// DrawString ////////////////////////////////////////////////////////////// -void plDebugText::DrawString( UInt16 x, UInt16 y, const char *string, UInt32 hexColor, UInt8 style ) +void plDebugText::DrawString( uint16_t x, uint16_t y, const char *string, uint32_t hexColor, uint8_t style ) { if( IsEnabled() && fManager && string != nil && string[ 0 ] != 0 ) fManager->AddString( x, y, string, hexColor, style, fDrawOnTopMode ); @@ -65,7 +65,7 @@ void plDebugText::DrawString( UInt16 x, UInt16 y, const char *string, UInt32 //// CalcStringWidth ///////////////////////////////////////////////////////// -UInt32 plDebugText::CalcStringWidth( const char *string ) +uint32_t plDebugText::CalcStringWidth( const char *string ) { if( IsEnabled() && fManager && string ) return fManager->CalcStringWidth( string ); @@ -78,7 +78,7 @@ UInt32 plDebugText::CalcStringWidth( const char *string ) // to create a background for our console; will be obliterated once we figure // a better way to do so. -void plDebugText::DrawRect( UInt16 left, UInt16 top, UInt16 right, UInt16 bottom, UInt32 hexColor ) +void plDebugText::DrawRect( uint16_t left, uint16_t top, uint16_t right, uint16_t bottom, uint32_t hexColor ) { if( IsEnabled() && fManager ) fManager->DrawRect( left, top, right, bottom, hexColor, fDrawOnTopMode ); @@ -86,7 +86,7 @@ void plDebugText::DrawRect( UInt16 left, UInt16 top, UInt16 right, UInt16 bot //// Draw3DBorder //////////////////////////////////////////////////////////// -void plDebugText::Draw3DBorder( UInt16 left, UInt16 top, UInt16 right, UInt16 bottom, UInt32 hexColor1, UInt32 hexColor2 ) +void plDebugText::Draw3DBorder( uint16_t left, uint16_t top, uint16_t right, uint16_t bottom, uint32_t hexColor1, uint32_t hexColor2 ) { if( IsEnabled() && fManager ) fManager->Draw3DBorder( left, top, right, bottom, hexColor1, hexColor2, fDrawOnTopMode ); @@ -94,13 +94,13 @@ void plDebugText::Draw3DBorder( UInt16 left, UInt16 top, UInt16 right, UInt16 //// GetScreenSize /////////////////////////////////////////////////////////// -void plDebugText::GetScreenSize( UInt32 *width, UInt32 *height ) +void plDebugText::GetScreenSize( uint32_t *width, uint32_t *height ) { if( fManager ) fManager->GetScreenSize( width, height ); } -UInt16 plDebugText::GetFontHeight() +uint16_t plDebugText::GetFontHeight() { if (fManager) return fManager->GetFontHeight(); @@ -113,7 +113,7 @@ UInt16 plDebugText::GetFontHeight() //// plDebugTextNode Constructor ///////////////////////////////////////////// -plDebugTextManager::plDebugTextNode::plDebugTextNode( const char *s, UInt32 c, UInt16 x, UInt16 y, UInt8 style ) +plDebugTextManager::plDebugTextNode::plDebugTextNode( const char *s, uint32_t c, uint16_t x, uint16_t y, uint8_t style ) { HSMemory::Clear( fText, sizeof( fText ) ); strncpy( fText, s, sizeof( fText ) - 1 ); @@ -123,7 +123,7 @@ plDebugTextManager::plDebugTextNode::plDebugTextNode( const char *s, UInt32 c, U fStyle = style; } -plDebugTextManager::plDebugTextNode::plDebugTextNode( UInt16 left, UInt16 top, UInt16 right, UInt16 bottom, UInt32 c ) +plDebugTextManager::plDebugTextNode::plDebugTextNode( uint16_t left, uint16_t top, uint16_t right, uint16_t bottom, uint32_t c ) { memset( fText, 0, sizeof( fText ) ); fColor = c; @@ -134,7 +134,7 @@ plDebugTextManager::plDebugTextNode::plDebugTextNode( UInt16 left, UInt16 top, U fStyle = 0xff; } -plDebugTextManager::plDebugTextNode::plDebugTextNode( UInt16 left, UInt16 top, UInt16 right, UInt16 bottom, UInt32 c1, UInt32 c2 ) +plDebugTextManager::plDebugTextNode::plDebugTextNode( uint16_t left, uint16_t top, uint16_t right, uint16_t bottom, uint32_t c1, uint32_t c2 ) { memset( fText, 0, sizeof( fText ) ); fColor = c1; @@ -156,7 +156,7 @@ plDebugTextManager::~plDebugTextManager() //// AddString /////////////////////////////////////////////////////////////// -void plDebugTextManager::AddString( UInt16 x, UInt16 y, const char *s, UInt32 hexColor, UInt8 style, hsBool drawOnTop ) +void plDebugTextManager::AddString( uint16_t x, uint16_t y, const char *s, uint32_t hexColor, uint8_t style, hsBool drawOnTop ) { if( drawOnTop ) fDrawOnTopList.Append( plDebugTextNode( s, hexColor, x, y, style ) ); @@ -169,7 +169,7 @@ void plDebugTextManager::AddString( UInt16 x, UInt16 y, const char *s, UInt32 // to create a background for our console; will be obliterated once we figure // a better way to do so. -void plDebugTextManager::DrawRect( UInt16 left, UInt16 top, UInt16 right, UInt16 bottom, UInt32 hexColor, hsBool drawOnTop ) +void plDebugTextManager::DrawRect( uint16_t left, uint16_t top, uint16_t right, uint16_t bottom, uint32_t hexColor, hsBool drawOnTop ) { if( drawOnTop ) fDrawOnTopList.Append( plDebugTextNode( left, top, right, bottom, hexColor ) ); @@ -179,7 +179,7 @@ void plDebugTextManager::DrawRect( UInt16 left, UInt16 top, UInt16 right, UIn //// Draw3DBorder //////////////////////////////////////////////////////////// -void plDebugTextManager::Draw3DBorder( UInt16 left, UInt16 top, UInt16 right, UInt16 bottom, UInt32 hexColor1, UInt32 hexColor2, hsBool drawOnTop ) +void plDebugTextManager::Draw3DBorder( uint16_t left, uint16_t top, uint16_t right, uint16_t bottom, uint32_t hexColor1, uint32_t hexColor2, hsBool drawOnTop ) { if( drawOnTop ) fDrawOnTopList.Append( plDebugTextNode( left, top, right, bottom, hexColor1, hexColor2 ) ); @@ -275,7 +275,7 @@ void plDebugTextManager::DrawToDevice( plPipeline *pipe ) //// CalcStringWidth ///////////////////////////////////////////////////////// -UInt32 plDebugTextManager::CalcStringWidth( const char *string ) +uint32_t plDebugTextManager::CalcStringWidth( const char *string ) { if( !plDebugText::Instance().IsEnabled() || fFont == nil ) return 0; @@ -285,7 +285,7 @@ UInt32 plDebugTextManager::CalcStringWidth( const char *string ) //// GetScreenSize /////////////////////////////////////////////////////////// -void plDebugTextManager::GetScreenSize( UInt32 *width, UInt32 *height ) +void plDebugTextManager::GetScreenSize( uint32_t *width, uint32_t *height ) { if( width != nil ) *width = fSWidth; @@ -293,7 +293,7 @@ void plDebugTextManager::GetScreenSize( UInt32 *width, UInt32 *height ) *height = fSHeight; } -UInt16 plDebugTextManager::GetFontHeight() +uint16_t plDebugTextManager::GetFontHeight() { if (fFont) return fFont->GetFontHeight(); diff --git a/Sources/Plasma/PubUtilLib/plPipeline/plDebugText.h b/Sources/Plasma/PubUtilLib/plPipeline/plDebugText.h index 16cc5298..282496d0 100644 --- a/Sources/Plasma/PubUtilLib/plPipeline/plDebugText.h +++ b/Sources/Plasma/PubUtilLib/plPipeline/plDebugText.h @@ -48,10 +48,10 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #ifndef _plDebugText_h #define _plDebugText_h -#include "hsTypes.h" +#include "HeadSpin.h" #include "hsColorRGBA.h" #include "hsTemplates.h" -#include "hsUtils.h" + //// plDebugText Class Definition //////////////////////////////////////////// @@ -82,7 +82,7 @@ class plDebugText plDebugTextManager *fManager; char fFontFace[ 128 ]; - UInt16 fFontSize; + uint16_t fFontSize; hsBool fEnabled, fLockEnable, fDrawOnTopMode; public: @@ -97,56 +97,56 @@ class plDebugText static plDebugText &Instance( void ) { return fInstance; } - UInt32 CalcStringWidth( const char *string ); + uint32_t CalcStringWidth( const char *string ); - void DrawString( UInt16 x, UInt16 y, const char *string, UInt32 hexColor, UInt8 style = 0 ); + void DrawString( uint16_t x, uint16_t y, const char *string, uint32_t hexColor, uint8_t style = 0 ); - void DrawString( UInt16 x, UInt16 y, const char *string, hsColorRGBA &color, UInt8 style = 0 ) + void DrawString( uint16_t x, uint16_t y, const char *string, hsColorRGBA &color, uint8_t style = 0 ) { - UInt32 hex; - UInt8 r, g, b, a; + uint32_t hex; + uint8_t r, g, b, a; - r = (UInt8)( color.r * 255.0 ); - g = (UInt8)( color.g * 255.0 ); - b = (UInt8)( color.b * 255.0 ); - a = (UInt8)( color.a * 255.0 ); + r = (uint8_t)( color.r * 255.0 ); + g = (uint8_t)( color.g * 255.0 ); + b = (uint8_t)( color.b * 255.0 ); + a = (uint8_t)( color.a * 255.0 ); hex = ( a << 24 ) | ( r << 16 ) | ( g << 8 ) | ( b ); DrawString( x, y, string, hex, style ); } - void DrawString( UInt16 x, UInt16 y, const char *string, UInt8 r = 255, UInt8 g = 255, UInt8 b = 255, UInt8 a = 255, UInt8 style = 0 ) + void DrawString( uint16_t x, uint16_t y, const char *string, uint8_t r = 255, uint8_t g = 255, uint8_t b = 255, uint8_t a = 255, uint8_t style = 0 ) { - DrawString( x, y, string, (UInt32)( ( a << 24 ) | ( r << 16 ) | ( g << 8 ) | ( b ) ), style ); + DrawString( x, y, string, (uint32_t)( ( a << 24 ) | ( r << 16 ) | ( g << 8 ) | ( b ) ), style ); } void SetDrawOnTopMode( hsBool enable ) { fDrawOnTopMode = enable; } /// TEMPORARY FUNCTION (until we can find a better way to do this, one way or the other) - void DrawRect( UInt16 left, UInt16 top, UInt16 right, UInt16 bottom, UInt32 hexColor ); + void DrawRect( uint16_t left, uint16_t top, uint16_t right, uint16_t bottom, uint32_t hexColor ); /// TEMPORARY FUNCTION (until we can find a better way to do this, one way or the other) - void DrawRect( UInt16 left, UInt16 top, UInt16 right, UInt16 bottom, UInt8 r, UInt8 g, UInt8 b, UInt8 a = 255 ) + void DrawRect( uint16_t left, uint16_t top, uint16_t right, uint16_t bottom, uint8_t r, uint8_t g, uint8_t b, uint8_t a = 255 ) { - DrawRect( left, top, right, bottom, (UInt32)( ( a << 24 ) | ( r << 16 ) | ( g << 8 ) | ( b ) ) ); + DrawRect( left, top, right, bottom, (uint32_t)( ( a << 24 ) | ( r << 16 ) | ( g << 8 ) | ( b ) ) ); } /// EVEN MORE TEMPORARY FUNCTION (until we can find a better way to do this, one way or the other) - void Draw3DBorder( UInt16 left, UInt16 top, UInt16 right, UInt16 bottom, UInt32 hexColor1, UInt32 hexColor2 ); + void Draw3DBorder( uint16_t left, uint16_t top, uint16_t right, uint16_t bottom, uint32_t hexColor1, uint32_t hexColor2 ); void SetManager( plDebugTextManager *m ) { fManager = m; } - void SetFont(const char *face, UInt16 size ) { hsStrncpy( fFontFace, face, sizeof( fFontFace ) ); fFontSize = size; } + void SetFont(const char *face, uint16_t size ) { hsStrncpy( fFontFace, face, sizeof( fFontFace ) ); fFontSize = size; } const char *GetFontFace( void ) { return fFontFace; } - const UInt16 GetFontSize( void ) { return fFontSize; } - UInt16 GetFontHeight(); + const uint16_t GetFontSize( void ) { return fFontSize; } + uint16_t GetFontHeight(); void SetEnable( hsBool on ) { fEnabled = on; } void DisablePermanently( void ) { fEnabled = false; fLockEnable = true; } const hsBool IsEnabled( void ) { return fEnabled; } - void GetScreenSize( UInt32 *width, UInt32 *height ); + void GetScreenSize( uint32_t *width, uint32_t *height ); }; //// plDebugTextManager Class Definition ///////////////////////////////////// @@ -160,14 +160,14 @@ class plDebugTextManager struct plDebugTextNode { char fText[ 256 ]; - UInt32 fColor, fDarkColor; - UInt16 fX, fY, fRight, fBottom; // Last 2 are for rects only - UInt8 fStyle; // 0xff means rectangle, 0xfe means 3d border + uint32_t fColor, fDarkColor; + uint16_t fX, fY, fRight, fBottom; // Last 2 are for rects only + uint8_t fStyle; // 0xff means rectangle, 0xfe means 3d border plDebugTextNode() { fText[ 0 ] = 0; fColor = 0; fX = fY = 0; fStyle = 0; } - plDebugTextNode( const char *s, UInt32 c, UInt16 x, UInt16 y, UInt8 style ); - plDebugTextNode( UInt16 left, UInt16 top, UInt16 right, UInt16 bottom, UInt32 c ); - plDebugTextNode( UInt16 left, UInt16 top, UInt16 right, UInt16 bottom, UInt32 c1, UInt32 c2 ); + plDebugTextNode( const char *s, uint32_t c, uint16_t x, uint16_t y, uint8_t style ); + plDebugTextNode( uint16_t left, uint16_t top, uint16_t right, uint16_t bottom, uint32_t c ); + plDebugTextNode( uint16_t left, uint16_t top, uint16_t right, uint16_t bottom, uint32_t c1, uint32_t c2 ); ~plDebugTextNode() {;} }; @@ -175,27 +175,27 @@ class plDebugTextManager hsTArray fDrawOnTopList; plTextFont *fFont; - UInt32 fSWidth, fSHeight; + uint32_t fSWidth, fSHeight; public: plDebugTextManager() { plDebugText::Instance().SetManager( this ); fFont = nil; } ~plDebugTextManager(); - void AddString( UInt16 x, UInt16 y, const char *s, UInt32 hexColor, UInt8 style, hsBool drawOnTop = false ); - UInt32 CalcStringWidth( const char *string ); + void AddString( uint16_t x, uint16_t y, const char *s, uint32_t hexColor, uint8_t style, hsBool drawOnTop = false ); + uint32_t CalcStringWidth( const char *string ); /// TEMPORARY FUNCTION (until we can find a better way to do this, one way or the other) - void DrawRect( UInt16 left, UInt16 top, UInt16 right, UInt16 bottom, UInt32 hexColor, hsBool drawOnTop = false ); + void DrawRect( uint16_t left, uint16_t top, uint16_t right, uint16_t bottom, uint32_t hexColor, hsBool drawOnTop = false ); /// EVEN MORE TEMPORARY FUNCTION (until we can find a better way to do this, one way or the other) - void Draw3DBorder( UInt16 left, UInt16 top, UInt16 right, UInt16 bottom, UInt32 hexColor1, UInt32 hexColor2, hsBool drawOnTop = false ); + void Draw3DBorder( uint16_t left, uint16_t top, uint16_t right, uint16_t bottom, uint32_t hexColor1, uint32_t hexColor2, hsBool drawOnTop = false ); void DrawToDevice( plPipeline *pipe ); - void GetScreenSize( UInt32 *width, UInt32 *height ); + void GetScreenSize( uint32_t *width, uint32_t *height ); - UInt16 GetFontHeight(); + uint16_t GetFontHeight(); }; diff --git a/Sources/Plasma/PubUtilLib/plPipeline/plDrawPrim.h b/Sources/Plasma/PubUtilLib/plPipeline/plDrawPrim.h index 7e3b6963..347dc252 100644 --- a/Sources/Plasma/PubUtilLib/plPipeline/plDrawPrim.h +++ b/Sources/Plasma/PubUtilLib/plPipeline/plDrawPrim.h @@ -60,9 +60,9 @@ public: kTypeSplatList = 0x2 }; protected: - UInt32 fPrimType; + uint32_t fPrimType; - UInt32 fDrawProps; + uint32_t fDrawProps; hsGMaterial* fMaterial; @@ -73,8 +73,8 @@ public: virtual const hsBounds3Ext& GetLocalBounds() const = 0; hsGMaterial* GetMaterial() { return fMaterial; } - UInt32 GetPrimType() { return fPrimType; } - UInt32 GetDrawProps() { return fDrawProps; } + uint32_t GetPrimType() { return fPrimType; } + uint32_t GetDrawProps() { return fDrawProps; } }; class plTriListPrim : public plDrawPrim diff --git a/Sources/Plasma/PubUtilLib/plPipeline/plDynamicEnvMap.cpp b/Sources/Plasma/PubUtilLib/plPipeline/plDynamicEnvMap.cpp index 4982d066..09e5d710 100644 --- a/Sources/Plasma/PubUtilLib/plPipeline/plDynamicEnvMap.cpp +++ b/Sources/Plasma/PubUtilLib/plPipeline/plDynamicEnvMap.cpp @@ -40,7 +40,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "plDynamicEnvMap.h" #include "plPipeline.h" @@ -82,12 +82,12 @@ plDynamicEnvMap::plDynamicEnvMap() fColor.Set(0,0,0,1.f); int i; for( i = 0; i < 6; i++ ) - fReqMsgs[i] = TRACKED_NEW plRenderRequestMsg(nil, &fReqs[i]);; + fReqMsgs[i] = new plRenderRequestMsg(nil, &fReqs[i]);; SetPosition(fPos); } -plDynamicEnvMap::plDynamicEnvMap(UInt16 width, UInt16 height, UInt8 bitDepth, UInt8 zDepth, UInt8 sDepth) +plDynamicEnvMap::plDynamicEnvMap(uint16_t width, uint16_t height, uint8_t bitDepth, uint8_t zDepth, uint8_t sDepth) : fPos(0,0,0), fHither(0.3f), fYon(0.f), // yon < hither means ignore and use current settings @@ -103,7 +103,7 @@ plDynamicEnvMap::plDynamicEnvMap(UInt16 width, UInt16 height, UInt8 bitDepth, UI fColor.Set(0,0,0,1.f); int i; for( i = 0; i < 6; i++ ) - fReqMsgs[i] = TRACKED_NEW plRenderRequestMsg(nil, &fReqs[i]);; + fReqMsgs[i] = new plRenderRequestMsg(nil, &fReqs[i]);; SetPosition(fPos); } @@ -155,17 +155,17 @@ void plDynamicEnvMap::IUpdatePosition() SetCameraMatrix(fPos); } -void plDynamicEnvMap::SetHither(hsScalar f) +void plDynamicEnvMap::SetHither(float f) { fHither = f; } -void plDynamicEnvMap::SetYon(hsScalar f) +void plDynamicEnvMap::SetYon(float f) { fYon = f; } -void plDynamicEnvMap::SetFogStart(hsScalar f) +void plDynamicEnvMap::SetFogStart(float f) { fFogStart = f; } @@ -175,7 +175,7 @@ void plDynamicEnvMap::SetColor(const hsColorRGBA& col) fColor = col; } -void plDynamicEnvMap::SetRefreshRate(hsScalar secs) +void plDynamicEnvMap::SetRefreshRate(float secs) { fRefreshRate = secs / 6.f; plgDispatch::Dispatch()->RegisterForExactType(plRenderMsg::Index(), GetKey()); @@ -183,7 +183,7 @@ void plDynamicEnvMap::SetRefreshRate(hsScalar secs) void plDynamicEnvMap::ISetupRenderRequests() { - UInt32 renderState + uint32_t renderState = plPipeline::kRenderNormal | plPipeline::kRenderClearColor | plPipeline::kRenderClearDepth; @@ -408,14 +408,14 @@ void plDynamicEnvMap::SetIncludeCharacters(hsBool b) void plDynamicEnvMap::AddVisRegion(plVisRegion* reg) { - plGenRefMsg* msg = TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnRequest, 0, kRefVisSet); + plGenRefMsg* msg = new plGenRefMsg(GetKey(), plRefMsg::kOnRequest, 0, kRefVisSet); hsgResMgr::ResMgr()->AddViaNotify(reg->GetKey(), msg, plRefFlags::kActiveRef); } void plDynamicEnvMap::Read(hsStream* s, hsResMgr* mgr) { hsKeyedObject::Read(s, mgr); - UInt32 sz = plCubicRenderTarget::Read(s); + uint32_t sz = plCubicRenderTarget::Read(s); fPos.Read(s); fHither = s->ReadLEScalar(); @@ -434,17 +434,17 @@ void plDynamicEnvMap::Read(hsStream* s, hsResMgr* mgr) int nVis = s->ReadLE32(); int i; for( i = 0; i < nVis; i++ ) - mgr->ReadKeyNotifyMe(s, TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnCreate, -1, kRefVisSet), plRefFlags::kActiveRef); + mgr->ReadKeyNotifyMe(s, new plGenRefMsg(GetKey(), plRefMsg::kOnCreate, -1, kRefVisSet), plRefFlags::kActiveRef); nVis = s->ReadLE32(); for( i = 0; i < nVis; i++) { plKey key = plKeyFinder::Instance().StupidSearch(nil, nil, plVisRegion::Index(), s->ReadSafeString_TEMP()); if (key) - hsgResMgr::ResMgr()->AddViaNotify(key, TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnCreate, -1, kRefVisSet), plRefFlags::kActiveRef); + hsgResMgr::ResMgr()->AddViaNotify(key, new plGenRefMsg(GetKey(), plRefMsg::kOnCreate, -1, kRefVisSet), plRefFlags::kActiveRef); } - mgr->ReadKeyNotifyMe(s, TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnCreate, -1, kRefRootNode), plRefFlags::kActiveRef); + mgr->ReadKeyNotifyMe(s, new plGenRefMsg(GetKey(), plRefMsg::kOnCreate, -1, kRefRootNode), plRefFlags::kActiveRef); Init(); } @@ -453,7 +453,7 @@ void plDynamicEnvMap::Write(hsStream* s, hsResMgr* mgr) { hsKeyedObject::Write(s, mgr); - UInt32 sz = plCubicRenderTarget::Write(s); + uint32_t sz = plCubicRenderTarget::Write(s); fPos.Write(s); s->WriteLEScalar(fHither); @@ -482,7 +482,7 @@ void plDynamicEnvMap::Write(hsStream* s, hsResMgr* mgr) ////////////////////////////////////////////////////////////////////////////////////////////////////// -UInt8 plDynamicCamMap::fFlags = kReflectionEnabled | kReflectionCapable; +uint8_t plDynamicCamMap::fFlags = kReflectionEnabled | kReflectionCapable; plDynamicCamMap::plDynamicCamMap() : fHither(0.3f), @@ -497,10 +497,10 @@ fIncCharacters(false), fDisableTexture(nil) { fColor.Set(0,0,0,1.f); - fReqMsg = TRACKED_NEW plRenderRequestMsg(nil, &fReq); + fReqMsg = new plRenderRequestMsg(nil, &fReq); } -plDynamicCamMap::plDynamicCamMap(UInt16 width, UInt16 height, UInt8 bitDepth, UInt8 zDepth, UInt8 sDepth) : +plDynamicCamMap::plDynamicCamMap(uint16_t width, uint16_t height, uint8_t bitDepth, uint8_t zDepth, uint8_t sDepth) : fHither(0.3f), fYon(-1.f), fFogStart(-1.f), @@ -514,7 +514,7 @@ fDisableTexture(nil), plRenderTarget(plRenderTarget::kIsTexture, width, height, bitDepth, zDepth, sDepth) { fColor.Set(0,0,0,1.f); - fReqMsg = TRACKED_NEW plRenderRequestMsg(nil, &fReq); + fReqMsg = new plRenderRequestMsg(nil, &fReq); } plDynamicCamMap::~plDynamicCamMap() @@ -537,7 +537,7 @@ void plDynamicCamMap::Init() plgDispatch::Dispatch()->RegisterForExactType(plRenderMsg::Index(), GetKey()); } -void plDynamicCamMap::SetRefreshRate(hsScalar secs) +void plDynamicCamMap::SetRefreshRate(float secs) { fRefreshRate = secs; plgDispatch::Dispatch()->RegisterForExactType(plRenderMsg::Index(), GetKey()); @@ -733,13 +733,13 @@ void plDynamicCamMap::IPrepTextureLayers() { fMatLayers[i]->SetUVWSrc(plLayerInterface::kUVWPosition); fMatLayers[i]->SetMiscFlags(hsGMatState::kMiscCam2Screen | hsGMatState::kMiscPerspProjection); - hsgResMgr::ResMgr()->SendRef(GetKey(), TRACKED_NEW plGenRefMsg(fMatLayers[i]->GetKey(), plRefMsg::kOnRequest, 0, plLayRefMsg::kTexture), plRefFlags::kActiveRef); + hsgResMgr::ResMgr()->SendRef(GetKey(), new plGenRefMsg(fMatLayers[i]->GetKey(), plRefMsg::kOnRequest, 0, plLayRefMsg::kTexture), plRefFlags::kActiveRef); } else { fMatLayers[i]->SetUVWSrc(0); fMatLayers[i]->SetMiscFlags(0); - hsgResMgr::ResMgr()->SendRef(fDisableTexture->GetKey(), TRACKED_NEW plGenRefMsg(fMatLayers[i]->GetKey(), plRefMsg::kOnRequest, 0, plLayRefMsg::kTexture), plRefFlags::kActiveRef); + hsgResMgr::ResMgr()->SendRef(fDisableTexture->GetKey(), new plGenRefMsg(fMatLayers[i]->GetKey(), plRefMsg::kOnRequest, 0, plLayRefMsg::kTexture), plRefFlags::kActiveRef); } } } @@ -861,7 +861,7 @@ void plDynamicCamMap::SetIncludeCharacters(hsBool b) void plDynamicCamMap::AddVisRegion(plVisRegion* reg) { - hsgResMgr::ResMgr()->AddViaNotify( reg->GetKey(), TRACKED_NEW plGenRefMsg( GetKey(), plGenRefMsg::kOnReplace, -1, kRefVisSet ), plRefFlags::kActiveRef ); + hsgResMgr::ResMgr()->AddViaNotify( reg->GetKey(), new plGenRefMsg( GetKey(), plGenRefMsg::kOnReplace, -1, kRefVisSet ), plRefFlags::kActiveRef ); } void plDynamicCamMap::SetEnabled(hsBool enable) @@ -893,32 +893,32 @@ void plDynamicCamMap::Read(hsStream* s, hsResMgr* mgr) fRefreshRate = s->ReadLEScalar(); fIncCharacters = s->ReadBool(); SetIncludeCharacters(fIncCharacters); - mgr->ReadKeyNotifyMe(s, TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnCreate, 0, kRefCamera), plRefFlags::kPassiveRef); - mgr->ReadKeyNotifyMe(s, TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnCreate, 0, kRefRootNode), plRefFlags::kActiveRef); + mgr->ReadKeyNotifyMe(s, new plGenRefMsg(GetKey(), plRefMsg::kOnCreate, 0, kRefCamera), plRefFlags::kPassiveRef); + mgr->ReadKeyNotifyMe(s, new plGenRefMsg(GetKey(), plRefMsg::kOnCreate, 0, kRefRootNode), plRefFlags::kActiveRef); int numTargs = s->ReadByte(); int i; for (i = 0; i < numTargs; i++) - mgr->ReadKeyNotifyMe(s, TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnCreate, i, kRefTargetNode), plRefFlags::kPassiveRef); + mgr->ReadKeyNotifyMe(s, new plGenRefMsg(GetKey(), plRefMsg::kOnCreate, i, kRefTargetNode), plRefFlags::kPassiveRef); int nVis = s->ReadLE32(); for( i = 0; i < nVis; i++ ) - mgr->ReadKeyNotifyMe(s, TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnCreate, 0, kRefVisSet), plRefFlags::kActiveRef); + mgr->ReadKeyNotifyMe(s, new plGenRefMsg(GetKey(), plRefMsg::kOnCreate, 0, kRefVisSet), plRefFlags::kActiveRef); nVis = s->ReadLE32(); for( i = 0; i < nVis; i++) { plKey key = plKeyFinder::Instance().StupidSearch(nil, nil, plVisRegion::Index(), s->ReadSafeString_TEMP()); if (key) - hsgResMgr::ResMgr()->AddViaNotify(key, TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnCreate, -1, kRefVisSet), plRefFlags::kActiveRef); + hsgResMgr::ResMgr()->AddViaNotify(key, new plGenRefMsg(GetKey(), plRefMsg::kOnCreate, -1, kRefVisSet), plRefFlags::kActiveRef); } - mgr->ReadKeyNotifyMe(s, TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnCreate, 0, kRefDisableTexture), plRefFlags::kActiveRef); + mgr->ReadKeyNotifyMe(s, new plGenRefMsg(GetKey(), plRefMsg::kOnCreate, 0, kRefDisableTexture), plRefFlags::kActiveRef); - UInt8 numLayers = s->ReadByte(); + uint8_t numLayers = s->ReadByte(); for (i = 0; i < numLayers; i++) { - mgr->ReadKeyNotifyMe(s, TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnCreate, 0, kRefMatLayer), plRefFlags::kPassiveRef); + mgr->ReadKeyNotifyMe(s, new plGenRefMsg(GetKey(), plRefMsg::kOnCreate, 0, kRefMatLayer), plRefFlags::kPassiveRef); } Init(); diff --git a/Sources/Plasma/PubUtilLib/plPipeline/plDynamicEnvMap.h b/Sources/Plasma/PubUtilLib/plPipeline/plDynamicEnvMap.h index 7480f087..63926d48 100644 --- a/Sources/Plasma/PubUtilLib/plPipeline/plDynamicEnvMap.h +++ b/Sources/Plasma/PubUtilLib/plPipeline/plDynamicEnvMap.h @@ -72,12 +72,12 @@ protected: plSceneObject* fRootNode; hsPoint3 fPos; - hsScalar fHither; - hsScalar fYon; - hsScalar fFogStart; + float fHither; + float fYon; + float fFogStart; hsColorRGBA fColor; - hsScalar fRefreshRate; + float fRefreshRate; double fLastRefresh; int fLastRender; int fOutStanding; @@ -99,7 +99,7 @@ protected: public: plDynamicEnvMap(); - plDynamicEnvMap(UInt16 width, UInt16 height, UInt8 bitDepth, UInt8 zDepth = -1, UInt8 sDepth = -1); + plDynamicEnvMap(uint16_t width, uint16_t height, uint8_t bitDepth, uint8_t zDepth = -1, uint8_t sDepth = -1); virtual ~plDynamicEnvMap(); @@ -116,18 +116,18 @@ public: void Init(); void SetPosition(const hsPoint3& pos); - void SetHither(hsScalar f); - void SetYon(hsScalar f); - void SetFogStart(hsScalar f); + void SetHither(float f); + void SetYon(float f); + void SetFogStart(float f); void SetColor(const hsColorRGBA& col); - void SetRefreshRate(hsScalar secs); + void SetRefreshRate(float secs); hsPoint3 GetPosition() const; - hsScalar GetHither() const { return fHither; } - hsScalar GetYon() const { return fYon; } - hsScalar GetFogStart() const { return fFogStart; } + float GetHither() const { return fHither; } + float GetYon() const { return fYon; } + float GetFogStart() const { return fFogStart; } hsColorRGBA GetColor() const { return fColor; } - hsScalar GetRefreshRate() const { return 6.f * fRefreshRate; } + float GetRefreshRate() const { return 6.f * fRefreshRate; } void AddVisRegion(plVisRegion* reg); // Will just send a ref @@ -153,16 +153,16 @@ public: kRefMatLayer, }; - hsScalar fHither; - hsScalar fYon; - hsScalar fFogStart; + float fHither; + float fYon; + float fFogStart; hsColorRGBA fColor; protected: plRenderRequest fReq; plRenderRequestMsg* fReqMsg; - hsScalar fRefreshRate; + float fRefreshRate; double fLastRefresh; int fOutStanding; @@ -177,7 +177,7 @@ protected: // Extra info for swapping around textures when reflections are disabled. plBitmap* fDisableTexture; hsTArray fMatLayers; - static UInt8 fFlags; + static uint8_t fFlags; enum { kReflectionCapable = 0x01, @@ -196,7 +196,7 @@ protected: public: plDynamicCamMap(); - plDynamicCamMap(UInt16 width, UInt16 height, UInt8 bitDepth, UInt8 zDepth = -1, UInt8 sDepth = -1); + plDynamicCamMap(uint16_t width, uint16_t height, uint8_t bitDepth, uint8_t zDepth = -1, uint8_t sDepth = -1); virtual ~plDynamicCamMap(); @@ -212,7 +212,7 @@ public: void Init(); void SetIncludeCharacters(hsBool b); - void SetRefreshRate(hsScalar secs); + void SetRefreshRate(float secs); void AddVisRegion(plVisRegion* reg); void SetVisRegionName(char *name){ fVisRegionNames.Push(name); } diff --git a/Sources/Plasma/PubUtilLib/plPipeline/plFogEnvironment.cpp b/Sources/Plasma/PubUtilLib/plPipeline/plFogEnvironment.cpp index f074136b..381349ea 100644 --- a/Sources/Plasma/PubUtilLib/plPipeline/plFogEnvironment.cpp +++ b/Sources/Plasma/PubUtilLib/plPipeline/plFogEnvironment.cpp @@ -47,6 +47,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "plFogEnvironment.h" +#include #include "plTweak.h" //// Constructors & Destructor /////////////////////////////////////////////// @@ -56,12 +57,12 @@ plFogEnvironment::plFogEnvironment() fType = kNoFog; } -plFogEnvironment::plFogEnvironment( hsScalar start, hsScalar end, hsScalar density, hsColorRGBA &color ) +plFogEnvironment::plFogEnvironment( float start, float end, float density, hsColorRGBA &color ) { Set( start, end, density, &color ); } -plFogEnvironment::plFogEnvironment( FogType type, hsScalar end, hsScalar density, hsColorRGBA &color ) +plFogEnvironment::plFogEnvironment( FogType type, float end, float density, hsColorRGBA &color ) { SetExp( type, end, density, &color ); } @@ -72,7 +73,7 @@ plFogEnvironment::~plFogEnvironment() //// Set ///////////////////////////////////////////////////////////////////// -void plFogEnvironment::Set( hsScalar start, hsScalar end, hsScalar density, const hsColorRGBA *color ) +void plFogEnvironment::Set( float start, float end, float density, const hsColorRGBA *color ) { if( density <= 0.f ) { @@ -92,7 +93,7 @@ void plFogEnvironment::Set( hsScalar start, hsScalar end, hsScalar density, c fColor = *color; } -void plFogEnvironment::SetExp( FogType type, hsScalar end, hsScalar density, const hsColorRGBA *color ) +void plFogEnvironment::SetExp( FogType type, float end, float density, const hsColorRGBA *color ) { hsAssert( type == kExpFog || type == kExp2Fog, "Invalid fog type passed to plFogEnvironment" ); if( density <= 0.f ) @@ -117,7 +118,7 @@ void plFogEnvironment::SetExp( FogType type, hsScalar end, hsScalar density, // Gets the parameters. Sets start to 0 if the type is not linear (can be // nil). -void plFogEnvironment::GetParameters( hsScalar *start, hsScalar *end, hsScalar *density, hsColorRGBA *color ) +void plFogEnvironment::GetParameters( float *start, float *end, float *density, hsColorRGBA *color ) { hsAssert( fType != kLinearFog || start != nil, "Trying to get non-linear paramters on linear fog!" ); hsAssert( end != nil && density != nil && color != nil, "Bad pointer to plFogEnvironment::GetParameters()" ); @@ -138,7 +139,7 @@ void plFogEnvironment::GetParameters( hsScalar *start, hsScalar *end, hsScala // scale our end value out by the density. The whole formula is: // pipelineEnd = ( end - start ) / density + start -void plFogEnvironment::GetPipelineParams( hsScalar *start, hsScalar *end, hsColorRGBA *color ) +void plFogEnvironment::GetPipelineParams( float *start, float *end, hsColorRGBA *color ) { // hsAssert( fType == kLinearFog, "Getting linear pipeline params on non-linear fog!" ); @@ -173,7 +174,7 @@ void plFogEnvironment::GetPipelineParams( hsScalar *start, hsScalar *end, hsC // to modulate the density by the end value so that it actually ends at the // right spot. -void plFogEnvironment::GetPipelineParams( hsScalar *density, hsColorRGBA *color ) +void plFogEnvironment::GetPipelineParams( float *density, hsColorRGBA *color ) { const float ln256 = logf( 256.f ); const float sqrtLn256 = sqrtf( ln256 ); diff --git a/Sources/Plasma/PubUtilLib/plPipeline/plFogEnvironment.h b/Sources/Plasma/PubUtilLib/plPipeline/plFogEnvironment.h index e97ab038..11c5429f 100644 --- a/Sources/Plasma/PubUtilLib/plPipeline/plFogEnvironment.h +++ b/Sources/Plasma/PubUtilLib/plPipeline/plFogEnvironment.h @@ -49,10 +49,10 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #define _plFogEnvironment_h #include "pnKeyedObject/hsKeyedObject.h" -#include "hsTypes.h" +#include "HeadSpin.h" #include "hsColorRGBA.h" #include "hsTemplates.h" -#include "hsUtils.h" + //// plFogEnvironment Class Definition //////////////////////////////////////////// @@ -62,9 +62,9 @@ class plFogEnvironment : public hsKeyedObject { protected: - UInt8 fType; - hsScalar fStart; // Used for linear fog only - hsScalar fEnd, fDensity; // Always used! + uint8_t fType; + float fStart; // Used for linear fog only + float fEnd, fDensity; // Always used! hsColorRGBA fColor; public: @@ -81,15 +81,15 @@ class plFogEnvironment : public hsKeyedObject }; plFogEnvironment(); - plFogEnvironment( hsScalar start, hsScalar end, hsScalar density, hsColorRGBA &color ); - plFogEnvironment( FogType type, hsScalar end, hsScalar density, hsColorRGBA &color ); + plFogEnvironment( float start, float end, float density, hsColorRGBA &color ); + plFogEnvironment( FogType type, float end, float density, hsColorRGBA &color ); ~plFogEnvironment(); // Sets the parameters for linear fog - void Set( hsScalar start, hsScalar end, hsScalar density, const hsColorRGBA *color = nil ); + void Set( float start, float end, float density, const hsColorRGBA *color = nil ); // Sets the parameters for exp or exp^2 fog - void SetExp( FogType type, hsScalar end, hsScalar density, const hsColorRGBA *color = nil ); + void SetExp( FogType type, float end, float density, const hsColorRGBA *color = nil ); // Sets the color void SetColor( hsColorRGBA &color ) { fColor = color; } @@ -98,19 +98,19 @@ class plFogEnvironment : public hsKeyedObject void Clear( void ) { fType = kNoFog; } // Gets the type - UInt8 GetType( void ) { return fType; } + uint8_t GetType( void ) { return fType; } // Gets the color hsColorRGBA &GetColor( void ) { return fColor; } // Gets the parameters. Sets start to 0 if the type is not linear (can be nil) - void GetParameters( hsScalar *start, hsScalar *end, hsScalar *density, hsColorRGBA *color ); + void GetParameters( float *start, float *end, float *density, hsColorRGBA *color ); // Gets linear pipeline (DX) specific parameters. - void GetPipelineParams( hsScalar *start, hsScalar *end, hsColorRGBA *color ); + void GetPipelineParams( float *start, float *end, hsColorRGBA *color ); // Gets exp or exp^2 pipeline (DX) specific parameters. - void GetPipelineParams( hsScalar *density, hsColorRGBA *color ); + void GetPipelineParams( float *density, hsColorRGBA *color ); virtual void Read(hsStream *s, hsResMgr *mgr); virtual void Write(hsStream *s, hsResMgr *mgr); diff --git a/Sources/Plasma/PubUtilLib/plPipeline/plGBufferGroup.cpp b/Sources/Plasma/PubUtilLib/plPipeline/plGBufferGroup.cpp index 93a15e44..a3461832 100644 --- a/Sources/Plasma/PubUtilLib/plPipeline/plGBufferGroup.cpp +++ b/Sources/Plasma/PubUtilLib/plPipeline/plGBufferGroup.cpp @@ -50,7 +50,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // // /////////////////////////////////////////////////////////////////////////////// -#include "hsWindows.h" + #include "HeadSpin.h" #include "plGBufferGroup.h" #include "hsStream.h" @@ -68,8 +68,8 @@ plProfile_CreateMemCounter("Buf Group Indices", "Memory", MemBufGrpIndex); plProfile_CreateTimer("Refill Vertex", "Draw", DrawRefillVertex); plProfile_CreateTimer("Refill Index", "Draw", DrawRefillIndex); -const UInt32 plGBufferGroup::kMaxNumVertsPerBuffer = 32000; -const UInt32 plGBufferGroup::kMaxNumIndicesPerBuffer = 32000; +const uint32_t plGBufferGroup::kMaxNumVertsPerBuffer = 32000; +const uint32_t plGBufferGroup::kMaxNumIndicesPerBuffer = 32000; //// plGBufferTriangle Read and Write ///////////////////////////////////////// @@ -110,7 +110,7 @@ void plGBufferCell::Write( hsStream *s ) //// Constructor ////////////////////////////////////////////////////////////// -plGBufferGroup::plGBufferGroup( UInt8 format, hsBool vertsVolatile, hsBool idxVolatile, int LOD ) +plGBufferGroup::plGBufferGroup( uint8_t format, hsBool vertsVolatile, hsBool idxVolatile, int LOD ) { fVertBuffStorage.Reset(); fIdxBuffStorage.Reset(); @@ -131,7 +131,7 @@ plGBufferGroup::plGBufferGroup( UInt8 format, hsBool vertsVolatile, hsBool idxVo plGBufferGroup::~plGBufferGroup() { - UInt32 i; + uint32_t i; CleanUp(); @@ -168,7 +168,7 @@ void plGBufferGroup::TidyUp( void ) */ } -void plGBufferGroup::PurgeVertBuffer(UInt32 idx) +void plGBufferGroup::PurgeVertBuffer(uint32_t idx) { if( AreVertsVolatile() ) return; @@ -190,7 +190,7 @@ void plGBufferGroup::PurgeVertBuffer(UInt32 idx) return; } -void plGBufferGroup::PurgeIndexBuffer(UInt32 idx) +void plGBufferGroup::PurgeIndexBuffer(uint32_t idx) { if( AreIdxVolatile() ) return; @@ -213,7 +213,7 @@ void plGBufferGroup::CleanUp( void ) } for( i = 0; i < fIdxBuffStorage.GetCount(); i++ ) { - plProfile_DelMem(MemBufGrpIndex, fIdxBuffCounts[i] * sizeof(UInt16)); + plProfile_DelMem(MemBufGrpIndex, fIdxBuffCounts[i] * sizeof(uint16_t)); delete [] fIdxBuffStorage[ i ]; } for( i = 0; i < fColorBuffStorage.GetCount(); i++ ) @@ -241,7 +241,7 @@ void plGBufferGroup::CleanUp( void ) //// SetVertexBufferRef /////////////////////////////////////////////////////// -void plGBufferGroup::SetVertexBufferRef( UInt32 index, hsGDeviceRef *vb ) +void plGBufferGroup::SetVertexBufferRef( uint32_t index, hsGDeviceRef *vb ) { hsAssert( index < fVertexBufferRefs.GetCount() + 1, "Vertex buffers must be assigned linearly!" ); @@ -259,7 +259,7 @@ void plGBufferGroup::SetVertexBufferRef( UInt32 index, hsGDeviceRef *vb ) //// SetIndexBufferRef //////////////////////////////////////////////////////// -void plGBufferGroup::SetIndexBufferRef( UInt32 index, hsGDeviceRef *ib ) +void plGBufferGroup::SetIndexBufferRef( uint32_t index, hsGDeviceRef *ib ) { hsAssert( index < fIndexBufferRefs.GetCount() + 1, "Index buffers must be assigned linearly!" ); @@ -286,7 +286,7 @@ void plGBufferGroup::PrepForRendering( plPipeline *pipe, hsBool adjustForNvid } -hsGDeviceRef* plGBufferGroup::GetVertexBufferRef(UInt32 i) +hsGDeviceRef* plGBufferGroup::GetVertexBufferRef(uint32_t i) { if( i >= fVertexBufferRefs.GetCount() ) fVertexBufferRefs.ExpandAndZero(i+1); @@ -294,7 +294,7 @@ hsGDeviceRef* plGBufferGroup::GetVertexBufferRef(UInt32 i) return fVertexBufferRefs[i]; } -hsGDeviceRef* plGBufferGroup::GetIndexBufferRef(UInt32 i) +hsGDeviceRef* plGBufferGroup::GetIndexBufferRef(uint32_t i) { if( i >= fIndexBufferRefs.GetCount() ) fIndexBufferRefs.ExpandAndZero(i+1); @@ -329,9 +329,9 @@ void plGBufferGroup::ISendStorageToBuffers( plPipeline *pipe, hsBool adjustFo //// ICalcVertexSize ////////////////////////////////////////////////////////// -UInt8 plGBufferGroup::ICalcVertexSize( UInt8 &liteStride ) +uint8_t plGBufferGroup::ICalcVertexSize( uint8_t &liteStride ) { - UInt8 size; + uint8_t size; size = sizeof( float ) * ( 3 + 3 ); // pos + normal @@ -349,7 +349,7 @@ UInt8 plGBufferGroup::ICalcVertexSize( UInt8 &liteStride ) { size += sizeof( float ) * fNumSkinWeights; if( fFormat & kSkinIndices ) - size += sizeof( UInt32 ); + size += sizeof( uint32_t ); } liteStride = size; @@ -361,9 +361,9 @@ UInt8 plGBufferGroup::ICalcVertexSize( UInt8 &liteStride ) void plGBufferGroup::Read( hsStream *s ) { - UInt32 totalDynSize, i, count, temp = 0, j; - UInt8 *vData; - UInt16 *iData; + uint32_t totalDynSize, i, count, temp = 0, j; + uint8_t *vData; + uint16_t *iData; plGBufferColor *cData; @@ -388,14 +388,14 @@ void plGBufferGroup::Read( hsStream *s ) { if( fFormat & kEncoded ) { - const UInt16 numVerts = s->ReadLE16(); - const UInt32 size = numVerts * fStride; + const uint16_t numVerts = s->ReadLE16(); + const uint32_t size = numVerts * fStride; fVertBuffSizes.Append(size); fVertBuffStarts.Append(0); fVertBuffEnds.Append(-1); - vData = TRACKED_NEW UInt8[size]; + vData = new uint8_t[size]; fVertBuffStorage.Append( vData ); plProfile_NewMem(MemBufGrpVertex, temp); @@ -413,7 +413,7 @@ void plGBufferGroup::Read( hsStream *s ) fVertBuffStarts.Append(0); fVertBuffEnds.Append(-1); - vData = TRACKED_NEW UInt8[ temp ]; + vData = new uint8_t[ temp ]; hsAssert( vData != nil, "Not enough memory to read in vertices" ); s->Read( temp, (void *)vData ); fVertBuffStorage.Append( vData ); @@ -424,7 +424,7 @@ void plGBufferGroup::Read( hsStream *s ) if( temp > 0 ) { - cData = TRACKED_NEW plGBufferColor[ temp ]; + cData = new plGBufferColor[ temp ]; s->Read( temp * sizeof( plGBufferColor ), (void *)cData ); plProfile_NewMem(MemBufGrpVertex, temp * sizeof(plGBufferColor)); } @@ -443,11 +443,11 @@ void plGBufferGroup::Read( hsStream *s ) fIdxBuffStarts.Append(0); fIdxBuffEnds.Append(-1); - iData = TRACKED_NEW UInt16[ temp ]; + iData = new uint16_t[ temp ]; hsAssert( iData != nil, "Not enough memory to read in indices" ); - s->ReadLE16( temp, (UInt16 *)iData ); + s->ReadLE16( temp, (uint16_t *)iData ); fIdxBuffStorage.Append( iData ); - plProfile_NewMem(MemBufGrpIndex, temp * sizeof(UInt16)); + plProfile_NewMem(MemBufGrpIndex, temp * sizeof(uint16_t)); } /// Read in cell arrays, one per vBuffer @@ -455,7 +455,7 @@ void plGBufferGroup::Read( hsStream *s ) { temp = s->ReadLE32(); - fCells.Append( TRACKED_NEW hsTArray ); + fCells.Append( new hsTArray ); fCells[ i ]->SetCount( temp ); for( j = 0; j < temp; j++ ) @@ -468,7 +468,7 @@ void plGBufferGroup::Read( hsStream *s ) void plGBufferGroup::Write( hsStream *s ) { - UInt32 totalDynSize, i, j; + uint32_t totalDynSize, i, j; #define MF_VERTCODE_ENABLED #ifdef MF_VERTCODE_ENABLED @@ -485,7 +485,7 @@ void plGBufferGroup::Write( hsStream *s ) for( i = 0; i < fVertBuffSizes.GetCount(); i++ ) totalDynSize += fVertBuffSizes[ i ]; for( i = 0; i < fIdxBuffCounts.GetCount(); i++ ) - totalDynSize += sizeof( UInt16 ) * fIdxBuffCounts[ i ]; + totalDynSize += sizeof( uint16_t ) * fIdxBuffCounts[ i ]; s->WriteLE( fFormat ); s->WriteLE32( totalDynSize ); @@ -493,15 +493,15 @@ void plGBufferGroup::Write( hsStream *s ) plVertCoder coder; /// Write out dyanmic data - s->WriteLE32( (UInt32)fVertBuffStorage.GetCount() ); + s->WriteLE32( (uint32_t)fVertBuffStorage.GetCount() ); for( i = 0; i < fVertBuffStorage.GetCount(); i++ ) { #ifdef MF_VERTCODE_ENABLED hsAssert(fCells[i]->GetCount() == 1, "Data must be interleaved for compression"); - UInt32 numVerts = fVertBuffSizes[i] / fStride; - s->WriteLE16((UInt16)numVerts); - coder.Write(s, fVertBuffStorage[i], fFormat, fStride, (UInt16)numVerts); + uint32_t numVerts = fVertBuffSizes[i] / fStride; + s->WriteLE16((uint16_t)numVerts); + coder.Write(s, fVertBuffStorage[i], fFormat, fStride, (uint16_t)numVerts); #ifdef VERT_LOG char buf[256]; @@ -528,7 +528,7 @@ void plGBufferGroup::Write( hsStream *s ) #endif // MF_VERTCODE_ENABLED } - s->WriteLE32( (UInt32)fIdxBuffCounts.GetCount() ); + s->WriteLE32( (uint32_t)fIdxBuffCounts.GetCount() ); for( i = 0; i < fIdxBuffStorage.GetCount(); i++ ) { s->WriteLE32( fIdxBuffCounts[ i ] ); @@ -561,10 +561,10 @@ void plGBufferGroup::Write( hsStream *s ) // Note 2: for simplicity sake, we only do this for groups with ONE interleaved // cell. Doing this for multiple separated cells would be, literally, hell. -void plGBufferGroup::DeleteVertsFromStorage( UInt32 which, UInt32 start, UInt32 length ) +void plGBufferGroup::DeleteVertsFromStorage( uint32_t which, uint32_t start, uint32_t length ) { - UInt8 *dstPtr, *srcPtr; - UInt32 amount; + uint8_t *dstPtr, *srcPtr; + uint32_t amount; hsAssert( fCells[ which ]->GetCount() == 1, "Cannot delete verts on a mixed buffer group" ); @@ -600,7 +600,7 @@ void plGBufferGroup::DeleteVertsFromStorage( UInt32 which, UInt32 start, UInt // Adjusts indices >= a given threshold by a given delta. Use it to adjust // indices after vertex deletion. Affects only the given buffer. -void plGBufferGroup::AdjustIndicesInStorage( UInt32 which, UInt16 threshhold, Int16 delta ) +void plGBufferGroup::AdjustIndicesInStorage( uint32_t which, uint16_t threshhold, int16_t delta ) { int i; @@ -620,10 +620,10 @@ void plGBufferGroup::AdjustIndicesInStorage( UInt32 which, UInt16 threshhold, // Deletes a span of indices from the index storage. Remember to Prep this // group after doing this! -void plGBufferGroup::DeleteIndicesFromStorage( UInt32 which, UInt32 start, UInt32 length ) +void plGBufferGroup::DeleteIndicesFromStorage( uint32_t which, uint32_t start, uint32_t length ) { - UInt16 *dstPtr, *srcPtr; - UInt32 amount; + uint16_t *dstPtr, *srcPtr; + uint32_t amount; hsAssert( start + length <= fIdxBuffCounts[ which ], "Illegal range to DeleteIndicesFromStorage()" ); @@ -635,11 +635,11 @@ void plGBufferGroup::DeleteIndicesFromStorage( UInt32 which, UInt32 start, UI amount = fIdxBuffCounts[ which ] - ( start + length ); - memmove( dstPtr, srcPtr, amount * sizeof( UInt16 ) ); + memmove( dstPtr, srcPtr, amount * sizeof( uint16_t ) ); } fIdxBuffCounts[ which ] -= length; - plProfile_DelMem(MemBufGrpIndex, length * sizeof(UInt16)); + plProfile_DelMem(MemBufGrpIndex, length * sizeof(uint16_t)); if( fIndexBufferRefs.GetCount() > which && fIndexBufferRefs[ which ] != nil ) { @@ -652,7 +652,7 @@ void plGBufferGroup::DeleteIndicesFromStorage( UInt32 which, UInt32 start, UI //// GetNumPrimaryVertsLeft /////////////////////////////////////////////////// // Base on the cells, so we can take instanced cells into account -UInt32 plGBufferGroup::GetNumPrimaryVertsLeft( void ) const +uint32_t plGBufferGroup::GetNumPrimaryVertsLeft( void ) const { return GetNumVertsLeft( 0 ); } @@ -660,12 +660,12 @@ UInt32 plGBufferGroup::GetNumPrimaryVertsLeft( void ) const //// GetNumVertsLeft ////////////////////////////////////////////////////////// // Base on the cells, so we can take instanced cells into account -UInt32 plGBufferGroup::GetNumVertsLeft( UInt32 idx ) const +uint32_t plGBufferGroup::GetNumVertsLeft( uint32_t idx ) const { if( idx >= fCells.GetCount() ) return kMaxNumVertsPerBuffer; - UInt32 i, total = kMaxNumVertsPerBuffer; + uint32_t i, total = kMaxNumVertsPerBuffer; for( i = 0; i < fCells[ idx ]->GetCount(); i++ ) @@ -677,7 +677,7 @@ UInt32 plGBufferGroup::GetNumVertsLeft( UInt32 idx ) const //// IMakeCell //////////////////////////////////////////////////////////////// // Get a cell from the given cell array. -UInt32 plGBufferGroup::IMakeCell( UInt32 vbIndex, UInt8 flags, UInt32 vStart, UInt32 cStart, UInt32 len, UInt32 *offset ) +uint32_t plGBufferGroup::IMakeCell( uint32_t vbIndex, uint8_t flags, uint32_t vStart, uint32_t cStart, uint32_t len, uint32_t *offset ) { hsTArray *cells = fCells[ vbIndex ]; @@ -692,20 +692,20 @@ UInt32 plGBufferGroup::IMakeCell( UInt32 vbIndex, UInt8 flags, UInt32 vStart, U if( flags & kReserveSeparated ) cells->Append( plGBufferCell( vStart, cStart, len ) ); else - cells->Append( plGBufferCell( (UInt32)-1, cStart, len ) ); + cells->Append( plGBufferCell( (uint32_t)-1, cStart, len ) ); *offset = 0; } else { /// Merge if the last cell was an interleaved cell - if( cells->GetCount() > 0 && (*cells)[ cells->GetCount() - 1 ].fColorStart == (UInt32)-1 ) + if( cells->GetCount() > 0 && (*cells)[ cells->GetCount() - 1 ].fColorStart == (uint32_t)-1 ) { *offset = (*cells)[ cells->GetCount() - 1 ].fLength; (*cells)[ cells->GetCount() - 1 ].fLength += len; } else { - cells->Append( plGBufferCell( vStart, (UInt32)-1, len ) ); + cells->Append( plGBufferCell( vStart, (uint32_t)-1, len ) ); *offset = 0; } } @@ -718,10 +718,10 @@ UInt32 plGBufferGroup::IMakeCell( UInt32 vbIndex, UInt8 flags, UInt32 vStart, U // and starting position. Basically does what AppendToVertStorage() used to // do except it doesn't actually copy any data into the space reserved. -hsBool plGBufferGroup::ReserveVertStorage( UInt32 numVerts, UInt32 *vbIndex, UInt32 *cell, UInt32 *offset, UInt8 flags ) +hsBool plGBufferGroup::ReserveVertStorage( uint32_t numVerts, uint32_t *vbIndex, uint32_t *cell, uint32_t *offset, uint8_t flags ) { - UInt8 *storagePtr = nil; - UInt32 cStartIdx = 0, vStartIdx = 0; + uint8_t *storagePtr = nil; + uint32_t cStartIdx = 0, vStartIdx = 0; plGBufferColor *cStoragePtr = nil; int i; @@ -758,7 +758,7 @@ hsBool plGBufferGroup::ReserveVertStorage( UInt32 numVerts, UInt32 *vbIndex, UI fColorBuffStorage.Append( nil ); fColorBuffCounts.Append( 0 ); - fCells.Append( TRACKED_NEW hsTArray ); + fCells.Append( new hsTArray ); } *vbIndex = i; @@ -770,7 +770,7 @@ hsBool plGBufferGroup::ReserveVertStorage( UInt32 numVerts, UInt32 *vbIndex, UI { /// Increase the storage size vStartIdx = fVertBuffSizes[ i ]; - storagePtr = TRACKED_NEW UInt8[ fVertBuffSizes[ i ] + numVerts * fLiteStride ]; + storagePtr = new uint8_t[ fVertBuffSizes[ i ] + numVerts * fLiteStride ]; if( fVertBuffSizes[ i ] > 0 ) memcpy( storagePtr, fVertBuffStorage[ i ], fVertBuffSizes[ i ] ); fVertBuffSizes[ i ] += numVerts * fLiteStride; @@ -779,7 +779,7 @@ hsBool plGBufferGroup::ReserveVertStorage( UInt32 numVerts, UInt32 *vbIndex, UI /// Color too cStartIdx = fColorBuffCounts[ i ]; - cStoragePtr = TRACKED_NEW plGBufferColor[ fColorBuffCounts[ i ] + numVerts ]; + cStoragePtr = new plGBufferColor[ fColorBuffCounts[ i ] + numVerts ]; if( fColorBuffCounts[ i ] > 0 ) memcpy( cStoragePtr, fColorBuffStorage[ i ], fColorBuffCounts[ i ] * sizeof( plGBufferColor ) ); } @@ -789,7 +789,7 @@ hsBool plGBufferGroup::ReserveVertStorage( UInt32 numVerts, UInt32 *vbIndex, UI /// Increase the storage size vStartIdx = fVertBuffSizes[ i ]; - storagePtr = TRACKED_NEW UInt8[ fVertBuffSizes[ i ] + numVerts * fStride ]; + storagePtr = new uint8_t[ fVertBuffSizes[ i ] + numVerts * fStride ]; if( fVertBuffSizes[ i ] > 0 ) memcpy( storagePtr, fVertBuffStorage[ i ], fVertBuffSizes[ i ] ); fVertBuffSizes[ i ] += numVerts * fStride; @@ -836,7 +836,7 @@ hsBool plGBufferGroup::ReserveVertStorage( UInt32 numVerts, UInt32 *vbIndex, UI // same format. // Updated 6.15.2001 mcn to use ReserveVertStorage(). -void plGBufferGroup::AppendToVertStorage( plGeometrySpan *srcSpan, UInt32 *vbIndex, UInt32 *cell, UInt32 *offset ) +void plGBufferGroup::AppendToVertStorage( plGeometrySpan *srcSpan, uint32_t *vbIndex, uint32_t *cell, uint32_t *offset ) { if( !ReserveVertStorage( srcSpan->fNumVerts, vbIndex, cell, offset, kReserveInterleaved ) ) return; @@ -848,7 +848,7 @@ void plGBufferGroup::AppendToVertStorage( plGeometrySpan *srcSpan, UInt32 *vb // Same as AppendToVertStorage(), but writes only the verts to the vertex // storage and the colors to the separate color storage. -void plGBufferGroup::AppendToVertAndColorStorage( plGeometrySpan *srcSpan, UInt32 *vbIndex, UInt32 *cell, UInt32 *offset ) +void plGBufferGroup::AppendToVertAndColorStorage( plGeometrySpan *srcSpan, uint32_t *vbIndex, uint32_t *cell, uint32_t *offset ) { if( !ReserveVertStorage( srcSpan->fNumVerts, vbIndex, cell, offset, kReserveSeparated ) ) return; @@ -859,7 +859,7 @@ void plGBufferGroup::AppendToVertAndColorStorage( plGeometrySpan *srcSpan, UI //// AppendToColorStorage ///////////////////////////////////////////////////// // Same as AppendToVertStorage(), but writes JUST to color storage. -void plGBufferGroup::AppendToColorStorage( plGeometrySpan *srcSpan, UInt32 *vbIndex, UInt32 *cell, UInt32 *offset, UInt32 origCell ) +void plGBufferGroup::AppendToColorStorage( plGeometrySpan *srcSpan, uint32_t *vbIndex, uint32_t *cell, uint32_t *offset, uint32_t origCell ) { if( !ReserveVertStorage( srcSpan->fNumVerts, vbIndex, cell, offset, kReserveColors ) ) return; @@ -872,7 +872,7 @@ void plGBufferGroup::AppendToColorStorage( plGeometrySpan *srcSpan, UInt32 *v //// IGetStartVtxPointer ////////////////////////////////////////////////////// // Get the start vertex and color buffer pointers for a given cell and offset -void plGBufferGroup::IGetStartVtxPointer( UInt32 vbIndex, UInt32 cell, UInt32 offset, UInt8 *&tempPtr, plGBufferColor *&cPtr ) +void plGBufferGroup::IGetStartVtxPointer( uint32_t vbIndex, uint32_t cell, uint32_t offset, uint8_t *&tempPtr, plGBufferColor *&cPtr ) { hsAssert( vbIndex < fVertBuffStorage.GetCount(), "Invalid vbIndex in StuffToVertStorage()" ); hsAssert( cell < fCells[ vbIndex ]->GetCount(), "Invalid cell in StuffToVertStorage()" ); @@ -885,23 +885,23 @@ void plGBufferGroup::IGetStartVtxPointer( UInt32 vbIndex, UInt32 cell, UInt32 if( offset > 0 ) { - tempPtr += offset * ( ( (*fCells[ vbIndex ])[ cell ].fColorStart == (UInt32)-1 ) ? fStride : fLiteStride ); + tempPtr += offset * ( ( (*fCells[ vbIndex ])[ cell ].fColorStart == (uint32_t)-1 ) ? fStride : fLiteStride ); cPtr += offset; } } //// GetVertBufferCount /////////////////////////////////////////////////////// -UInt32 plGBufferGroup::GetVertBufferCount( UInt32 idx ) const +uint32_t plGBufferGroup::GetVertBufferCount( uint32_t idx ) const { return GetVertStartFromCell( idx, fCells[ idx ]->GetCount(), 0 ); } //// GetVertStartFromCell ///////////////////////////////////////////////////// -UInt32 plGBufferGroup::GetVertStartFromCell( UInt32 vbIndex, UInt32 cell, UInt32 offset ) const +uint32_t plGBufferGroup::GetVertStartFromCell( uint32_t vbIndex, uint32_t cell, uint32_t offset ) const { - UInt32 i, numVerts; + uint32_t i, numVerts; hsAssert( vbIndex < fVertBuffStorage.GetCount(), "Invalid vbIndex in StuffToVertStorage()" ); @@ -920,9 +920,9 @@ UInt32 plGBufferGroup::GetVertStartFromCell( UInt32 vbIndex, UInt32 cell, UInt3 // Stuffs data from a plGeometrySpan into the specified location in the // specified vertex buffer. -void plGBufferGroup::StuffToVertStorage( plGeometrySpan *srcSpan, UInt32 vbIndex, UInt32 cell, UInt32 offset, UInt8 flags ) +void plGBufferGroup::StuffToVertStorage( plGeometrySpan *srcSpan, uint32_t vbIndex, uint32_t cell, uint32_t offset, uint8_t flags ) { - UInt8 *tempPtr, stride; + uint8_t *tempPtr, stride; plGBufferColor *cPtr; int i, j, numVerts; plGBufferCell *cellPtr; @@ -933,7 +933,7 @@ void plGBufferGroup::StuffToVertStorage( plGeometrySpan *srcSpan, UInt32 vbIn IGetStartVtxPointer( vbIndex, cell, offset, tempPtr, cPtr ); cellPtr = &(*fCells[ vbIndex ])[ cell ]; - stride = ( cellPtr->fColorStart != (UInt32)-1 ) ? fLiteStride : fStride; + stride = ( cellPtr->fColorStart != (uint32_t)-1 ) ? fLiteStride : fStride; numVerts = srcSpan->fNumVerts; @@ -942,12 +942,12 @@ void plGBufferGroup::StuffToVertStorage( plGeometrySpan *srcSpan, UInt32 vbIn { hsPoint3 pos; float weights[ 3 ]; - UInt32 weightIndices; + uint32_t weightIndices; hsVector3 norm; - UInt32 color, specColor; + uint32_t color, specColor; hsPoint3 uvs[ plGeometrySpan::kMaxNumUVChannels ]; float *fPtr; - UInt32 *dPtr; + uint32_t *dPtr; // Gotta swap the data around, since plGeometrySpans store the data slightly differently @@ -985,7 +985,7 @@ void plGBufferGroup::StuffToVertStorage( plGeometrySpan *srcSpan, UInt32 vbIn if( fNumSkinWeights > 1 ) { - dPtr = (UInt32 *)fPtr; + dPtr = (uint32_t *)fPtr; *dPtr = weightIndices; dPtr++; @@ -1000,7 +1000,7 @@ void plGBufferGroup::StuffToVertStorage( plGeometrySpan *srcSpan, UInt32 vbIn if( flags & kReserveInterleaved ) { - dPtr = (UInt32 *)fPtr; + dPtr = (uint32_t *)fPtr; dPtr[ 0 ] = color; dPtr[ 1 ] = specColor; dPtr += 2; @@ -1033,9 +1033,9 @@ void plGBufferGroup::StuffToVertStorage( plGeometrySpan *srcSpan, UInt32 vbIn //// ReserveIndexStorage ////////////////////////////////////////////////////// // Same as ReserveVertStorage(), only for indices :) -hsBool plGBufferGroup::ReserveIndexStorage( UInt32 numIndices, UInt32 *ibIndex, UInt32 *ibStart, UInt16 **dataPtr ) +hsBool plGBufferGroup::ReserveIndexStorage( uint32_t numIndices, uint32_t *ibIndex, uint32_t *ibStart, uint16_t **dataPtr ) { - UInt16 *storagePtr; + uint16_t *storagePtr; int i; @@ -1065,9 +1065,9 @@ hsBool plGBufferGroup::ReserveIndexStorage( UInt32 numIndices, UInt32 *ibIndex, *ibStart = fIdxBuffCounts[ i ]; /// Increase the storage size - storagePtr = TRACKED_NEW UInt16[ fIdxBuffCounts[ i ] + numIndices ]; + storagePtr = new uint16_t[ fIdxBuffCounts[ i ] + numIndices ]; if( fIdxBuffCounts[ i ] > 0 ) - memcpy( storagePtr, fIdxBuffStorage[ i ], fIdxBuffCounts[ i ] * sizeof( UInt16 ) ); + memcpy( storagePtr, fIdxBuffStorage[ i ], fIdxBuffCounts[ i ] * sizeof( uint16_t ) ); if( dataPtr != nil ) *dataPtr = storagePtr + fIdxBuffCounts[ i ]; @@ -1078,7 +1078,7 @@ hsBool plGBufferGroup::ReserveIndexStorage( UInt32 numIndices, UInt32 *ibIndex, delete [] fIdxBuffStorage[ i ]; fIdxBuffStorage[ i ] = storagePtr; fIdxBuffCounts[ i ] += numIndices; - plProfile_NewMem(MemBufGrpIndex, numIndices * sizeof(UInt16)); + plProfile_NewMem(MemBufGrpIndex, numIndices * sizeof(uint16_t)); /// All done! if( fIndexBufferRefs.GetCount() > i && fIndexBufferRefs[ i ] != nil ) @@ -1093,10 +1093,10 @@ hsBool plGBufferGroup::ReserveIndexStorage( UInt32 numIndices, UInt32 *ibIndex, //// AppendToIndexStorage ///////////////////////////////////////////////////// // Same as AppendToVertStorage, only for the index buffers and indices. Duh :) -void plGBufferGroup::AppendToIndexStorage( UInt32 numIndices, UInt16 *data, UInt32 addToAll, - UInt32 *ibIndex, UInt32 *ibStart ) +void plGBufferGroup::AppendToIndexStorage( uint32_t numIndices, uint16_t *data, uint32_t addToAll, + uint32_t *ibIndex, uint32_t *ibStart ) { - UInt16 *tempPtr; + uint16_t *tempPtr; int i; @@ -1105,7 +1105,7 @@ void plGBufferGroup::AppendToIndexStorage( UInt32 numIndices, UInt16 *data, U /// Copy new indices over, offsetting them as we were told to for( i = 0; i < numIndices; i++ ) - tempPtr[ i ] = data[ i ] + (UInt16)addToAll; + tempPtr[ i ] = data[ i ] + (uint16_t)addToAll; /// All done! } @@ -1114,15 +1114,15 @@ void plGBufferGroup::AppendToIndexStorage( UInt32 numIndices, UInt16 *data, U // Returns an array of plGBufferTriangles representing the span of indices // specified. -plGBufferTriangle *plGBufferGroup::ConvertToTriList( Int16 spanIndex, UInt32 whichIdx, UInt32 whichVtx, UInt32 whichCell, UInt32 start, UInt32 numTriangles ) +plGBufferTriangle *plGBufferGroup::ConvertToTriList( int16_t spanIndex, uint32_t whichIdx, uint32_t whichVtx, uint32_t whichCell, uint32_t start, uint32_t numTriangles ) { plGBufferTriangle *array; - UInt16 *storagePtr; - UInt8 *vertStgPtr, stride; + uint16_t *storagePtr; + uint8_t *vertStgPtr, stride; float *vertPtr; int i, j; hsPoint3 center; - UInt32 offsetBy; + uint32_t offsetBy; plGBufferColor *wastePtr; @@ -1134,13 +1134,13 @@ plGBufferTriangle *plGBufferGroup::ConvertToTriList( Int16 spanIndex, UInt32 w hsAssert( whichCell < fCells[ whichVtx ]->GetCount(), "Invalid cell to ConvertToTriList()" ); /// Create the array and fill it - array = TRACKED_NEW plGBufferTriangle[ numTriangles ]; + array = new plGBufferTriangle[ numTriangles ]; hsAssert( array != nil, "Not enough memory to create triangle data in ConvertToTriList()" ); storagePtr = fIdxBuffStorage[ whichIdx ]; IGetStartVtxPointer( whichVtx, whichCell, 0, vertStgPtr, wastePtr ); offsetBy = GetVertStartFromCell( whichVtx, whichCell, 0 ); - stride = ( (*fCells[ whichVtx ])[ whichCell ].fColorStart == (UInt32)-1 ) ? fStride : fLiteStride; + stride = ( (*fCells[ whichVtx ])[ whichCell ].fColorStart == (uint32_t)-1 ) ? fStride : fLiteStride; for( i = 0, j = 0; i < numTriangles; i++, j += 3 ) { @@ -1183,9 +1183,9 @@ plGBufferTriangle *plGBufferGroup::ConvertToTriList( Int16 spanIndex, UInt32 w // Stuffs the indices from an array of plGBufferTriangles into the index // storage. -void plGBufferGroup::StuffFromTriList( UInt32 which, UInt32 start, UInt32 numTriangles, UInt16 *data ) +void plGBufferGroup::StuffFromTriList( uint32_t which, uint32_t start, uint32_t numTriangles, uint16_t *data ) { - UInt16 *storagePtr; + uint16_t *storagePtr; /// Sanity checks @@ -1217,7 +1217,7 @@ void plGBufferGroup::StuffFromTriList( UInt32 which, UInt32 start, UInt32 num //// StuffTri ///////////////////////////////////////////////////////////////// -void plGBufferGroup::StuffTri( UInt32 iBuff, UInt32 iTri, UInt16 idx0, UInt16 idx1, UInt16 idx2 ) +void plGBufferGroup::StuffTri( uint32_t iBuff, uint32_t iTri, uint16_t idx0, uint16_t idx1, uint16_t idx2 ) { /// Sanity checks hsAssert( iBuff < fIdxBuffStorage.GetCount(), "Invalid index buffer ID to StuffFromTriList()" ); @@ -1231,9 +1231,9 @@ void plGBufferGroup::StuffTri( UInt32 iBuff, UInt32 iTri, UInt16 idx0, UInt16 //// Accessor Functions /////////////////////////////////////////////////////// -hsPoint3 &plGBufferGroup::Position( int iBuff, UInt32 cell, int iVtx ) +hsPoint3 &plGBufferGroup::Position( int iBuff, uint32_t cell, int iVtx ) { - UInt8 *vertStgPtr; + uint8_t *vertStgPtr; plGBufferColor *cPtr; IGetStartVtxPointer( iBuff, cell, iVtx, vertStgPtr, cPtr ); @@ -1241,9 +1241,9 @@ hsPoint3 &plGBufferGroup::Position( int iBuff, UInt32 cell, int iVtx ) return *(hsPoint3 *)( vertStgPtr + 0 ); } -hsVector3 &plGBufferGroup::Normal( int iBuff, UInt32 cell, int iVtx ) +hsVector3 &plGBufferGroup::Normal( int iBuff, uint32_t cell, int iVtx ) { - UInt8 *vertStgPtr; + uint8_t *vertStgPtr; plGBufferColor *cPtr; IGetStartVtxPointer( iBuff, cell, iVtx, vertStgPtr, cPtr ); @@ -1251,43 +1251,43 @@ hsVector3 &plGBufferGroup::Normal( int iBuff, UInt32 cell, int iVtx ) return *(hsVector3 *)( vertStgPtr + sizeof( hsPoint3 ) ); } -UInt32 &plGBufferGroup::Color( int iBuff, UInt32 cell, int iVtx ) +uint32_t &plGBufferGroup::Color( int iBuff, uint32_t cell, int iVtx ) { - UInt8 *vertStgPtr; + uint8_t *vertStgPtr; plGBufferColor *cPtr; IGetStartVtxPointer( iBuff, cell, iVtx, vertStgPtr, cPtr ); - if( (*fCells[ iBuff ])[ cell ].fColorStart != (UInt32)-1 ) - return *(UInt32 *)( &cPtr->fDiffuse ); + if( (*fCells[ iBuff ])[ cell ].fColorStart != (uint32_t)-1 ) + return *(uint32_t *)( &cPtr->fDiffuse ); else - return *(UInt32 *)( vertStgPtr + 2 * sizeof( hsPoint3 ) ); + return *(uint32_t *)( vertStgPtr + 2 * sizeof( hsPoint3 ) ); } -UInt32 &plGBufferGroup::Specular( int iBuff, UInt32 cell, int iVtx ) +uint32_t &plGBufferGroup::Specular( int iBuff, uint32_t cell, int iVtx ) { - UInt8 *vertStgPtr; + uint8_t *vertStgPtr; plGBufferColor *cPtr; IGetStartVtxPointer( iBuff, cell, iVtx, vertStgPtr, cPtr ); - if( (*fCells[ iBuff ])[ cell ].fColorStart != (UInt32)-1 ) - return *(UInt32 *)( &cPtr->fSpecular ); + if( (*fCells[ iBuff ])[ cell ].fColorStart != (uint32_t)-1 ) + return *(uint32_t *)( &cPtr->fSpecular ); else - return *(UInt32 *)( vertStgPtr + 2 * sizeof( hsPoint3 ) ); + return *(uint32_t *)( vertStgPtr + 2 * sizeof( hsPoint3 ) ); } -hsPoint3 &plGBufferGroup::UV( int iBuff, UInt32 cell, int iVtx, int channel ) +hsPoint3 &plGBufferGroup::UV( int iBuff, uint32_t cell, int iVtx, int channel ) { - UInt8 *vertStgPtr; + uint8_t *vertStgPtr; plGBufferColor *cPtr; IGetStartVtxPointer( iBuff, cell, iVtx, vertStgPtr, cPtr ); vertStgPtr += 2 * sizeof( hsPoint3 ) + channel * sizeof( hsPoint3 ); - if( (*fCells[ iBuff ])[ cell ].fColorStart != (UInt32)-1 ) + if( (*fCells[ iBuff ])[ cell ].fColorStart != (uint32_t)-1 ) return *(hsPoint3 *)( vertStgPtr ); else - return *(hsPoint3 *)( vertStgPtr + 2 * sizeof( UInt32 ) ); + return *(hsPoint3 *)( vertStgPtr + 2 * sizeof( uint32_t ) ); } diff --git a/Sources/Plasma/PubUtilLib/plPipeline/plGBufferGroup.h b/Sources/Plasma/PubUtilLib/plPipeline/plGBufferGroup.h index 75a164f0..b8c55f5a 100644 --- a/Sources/Plasma/PubUtilLib/plPipeline/plGBufferGroup.h +++ b/Sources/Plasma/PubUtilLib/plPipeline/plGBufferGroup.h @@ -66,7 +66,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com class plGBufferTriangle { public: - UInt16 fIndex1, fIndex2, fIndex3, fSpanIndex; + uint16_t fIndex1, fIndex2, fIndex3, fSpanIndex; hsPoint3 fCenter; void Read( hsStream *s ); @@ -78,11 +78,11 @@ class plGBufferTriangle class plGBufferCell { public: - UInt32 fVtxStart; // In bytes - UInt32 fColorStart; // In bytes - UInt32 fLength; + uint32_t fVtxStart; // In bytes + uint32_t fColorStart; // In bytes + uint32_t fLength; - plGBufferCell( UInt32 vStart, UInt32 cStart, UInt32 len ) + plGBufferCell( uint32_t vStart, uint32_t cStart, uint32_t len ) { fVtxStart = vStart; fColorStart = cStart; fLength = len; } @@ -96,7 +96,7 @@ class plGBufferCell class plGBufferColor { public: - UInt32 fDiffuse, fSpecular; + uint32_t fDiffuse, fSpecular; }; //// plGBufferGroup Class Definition ////////////////////////////////////////// @@ -112,12 +112,12 @@ class plGeometrySpan; class plGBufferGroup { protected: - UInt8 fFormat; - UInt8 fStride; - UInt8 fLiteStride; - UInt8 fNumSkinWeights; - UInt32 fNumVerts; - UInt32 fNumIndices; + uint8_t fFormat; + uint8_t fStride; + uint8_t fLiteStride; + uint8_t fNumSkinWeights; + uint32_t fNumVerts; + uint32_t fNumIndices; hsBool fVertsVolatile; hsBool fIdxVolatile; int fLOD; @@ -125,16 +125,16 @@ class plGBufferGroup hsTArray fVertexBufferRefs; hsTArray fIndexBufferRefs; - hsTArray fVertBuffSizes; - hsTArray fIdxBuffCounts; - hsTArray fColorBuffCounts; - hsTArray fVertBuffStorage; - hsTArray fIdxBuffStorage; + hsTArray fVertBuffSizes; + hsTArray fIdxBuffCounts; + hsTArray fColorBuffCounts; + hsTArray fVertBuffStorage; + hsTArray fIdxBuffStorage; - hsTArray fVertBuffStarts; - hsTArray fVertBuffEnds; - hsTArray fIdxBuffStarts; - hsTArray fIdxBuffEnds; + hsTArray fVertBuffStarts; + hsTArray fVertBuffEnds; + hsTArray fIdxBuffStarts; + hsTArray fIdxBuffEnds; hsTArray fColorBuffStorage; @@ -142,17 +142,17 @@ class plGBufferGroup virtual void ISendStorageToBuffers( plPipeline *pipe, hsBool adjustForNvidiaLighting ); - UInt8 ICalcVertexSize( UInt8 &liteStride ); + uint8_t ICalcVertexSize( uint8_t &liteStride ); - UInt8* IVertBuffStorage(int iBuff, int iVtx) const { return fVertBuffStorage[iBuff] + iVtx*fStride; } + uint8_t* IVertBuffStorage(int iBuff, int iVtx) const { return fVertBuffStorage[iBuff] + iVtx*fStride; } - UInt32 IMakeCell( UInt32 vbIndex, UInt8 flags, UInt32 vStart, UInt32 cStart, UInt32 len, UInt32 *offset ); - void IGetStartVtxPointer( UInt32 vbIndex, UInt32 cell, UInt32 offset, UInt8 *&tempPtr, plGBufferColor *&cPtr ); + uint32_t IMakeCell( uint32_t vbIndex, uint8_t flags, uint32_t vStart, uint32_t cStart, uint32_t len, uint32_t *offset ); + void IGetStartVtxPointer( uint32_t vbIndex, uint32_t cell, uint32_t offset, uint8_t *&tempPtr, plGBufferColor *&cPtr ); public: - static const UInt32 kMaxNumVertsPerBuffer; - static const UInt32 kMaxNumIndicesPerBuffer; + static const uint32_t kMaxNumVertsPerBuffer; + static const uint32_t kMaxNumIndicesPerBuffer; enum Formats { @@ -179,37 +179,37 @@ class plGBufferGroup kReserveIsolate = 0x10 }; - plGBufferGroup(UInt8 format, hsBool vertsVolatile, hsBool idxVolatile, int LOD = 0); + plGBufferGroup(uint8_t format, hsBool vertsVolatile, hsBool idxVolatile, int LOD = 0); ~plGBufferGroup(); - UInt8 GetNumUVs( void ) const { return ( fFormat & kUVCountMask ); } - UInt8 GetNumWeights() const { return (fFormat & kSkinWeightMask) >> 4; } + uint8_t GetNumUVs( void ) const { return ( fFormat & kUVCountMask ); } + uint8_t GetNumWeights() const { return (fFormat & kSkinWeightMask) >> 4; } - static UInt8 CalcNumUVs( UInt8 format ) { return ( format & kUVCountMask ); } - static UInt8 UVCountToFormat( UInt8 numUVs ) { return numUVs & kUVCountMask; } + static uint8_t CalcNumUVs( uint8_t format ) { return ( format & kUVCountMask ); } + static uint8_t UVCountToFormat( uint8_t numUVs ) { return numUVs & kUVCountMask; } void DirtyVertexBuffer(int i); void DirtyIndexBuffer(int i); hsBool VertexReady(int i) const { return (i < fVertexBufferRefs.GetCount()) && fVertexBufferRefs[i]; } hsBool IndexReady(int i) const { return (i < fIndexBufferRefs.GetCount()) && fIndexBufferRefs[i]; } - UInt8 GetVertexSize( void ) const { return fStride; } - UInt8 GetVertexLiteStride( void ) const { return fLiteStride; } - UInt8 GetVertexFormat( void ) const { return fFormat; } - UInt32 GetMemUsage( void ) const { return ( fNumVerts * GetVertexSize() ) + ( fNumIndices * sizeof( UInt16 ) ); } - UInt32 GetNumVerts( void ) const { return fNumVerts; } - UInt32 GetNumIndices( void ) const { return fNumIndices; } - UInt32 GetNumPrimaryVertsLeft( void ) const; - UInt32 GetNumVertsLeft( UInt32 idx ) const; - - UInt32 GetVertBufferSize(UInt32 idx) const { return fVertBuffSizes[idx]; } - UInt32 GetVertBufferCount(UInt32 idx) const; - UInt32 GetIndexBufferCount(UInt32 idx) const { return fIdxBuffCounts[idx]; } - UInt32 GetVertStartFromCell(UInt32 idx, UInt32 cell, UInt32 offset) const; + uint8_t GetVertexSize( void ) const { return fStride; } + uint8_t GetVertexLiteStride( void ) const { return fLiteStride; } + uint8_t GetVertexFormat( void ) const { return fFormat; } + uint32_t GetMemUsage( void ) const { return ( fNumVerts * GetVertexSize() ) + ( fNumIndices * sizeof( uint16_t ) ); } + uint32_t GetNumVerts( void ) const { return fNumVerts; } + uint32_t GetNumIndices( void ) const { return fNumIndices; } + uint32_t GetNumPrimaryVertsLeft( void ) const; + uint32_t GetNumVertsLeft( uint32_t idx ) const; + + uint32_t GetVertBufferSize(uint32_t idx) const { return fVertBuffSizes[idx]; } + uint32_t GetVertBufferCount(uint32_t idx) const; + uint32_t GetIndexBufferCount(uint32_t idx) const { return fIdxBuffCounts[idx]; } + uint32_t GetVertStartFromCell(uint32_t idx, uint32_t cell, uint32_t offset) const; // These should only be called by the pipeline, because only it knows when it's safe. // If the data is volatile, these are no-ops - void PurgeVertBuffer(UInt32 idx); - void PurgeIndexBuffer(UInt32 idx); + void PurgeVertBuffer(uint32_t idx); + void PurgeIndexBuffer(uint32_t idx); /////////////////////////////////////////////////////////////////////////////// // The following group of functions is an advanced optimization, and a pretty @@ -220,43 +220,43 @@ class plGBufferGroup // things may work faster. If you set them incorrectly, be sure to save // all files before running. // All of these are indices, not bytes. from the beginning of the buffer. - UInt32 GetVertBufferStart(UInt32 idx) const { return fVertBuffStarts[idx]; } - UInt32 GetVertBufferEnd(UInt32 idx) const { return fVertBuffEnds[idx] >= 0 ? UInt32(fVertBuffEnds[idx]) : GetVertBufferCount(idx); } - UInt32 GetIndexBufferStart(UInt32 idx) const { return fIdxBuffStarts[idx]; } - UInt32 GetIndexBufferEnd(UInt32 idx) const { return fIdxBuffEnds[idx] >= 0 ? UInt32(fIdxBuffEnds[idx]) : GetIndexBufferCount(idx); } - - void SetVertBufferStart(UInt32 idx, UInt32 s) { fVertBuffStarts[idx] = s; } - void SetVertBufferEnd(UInt32 idx, UInt32 e) { fVertBuffEnds[idx] = e; } - void SetIndexBufferStart(UInt32 idx, UInt32 s) { fIdxBuffStarts[idx] = s; } - void SetIndexBufferEnd(UInt32 idx, UInt32 e) { fIdxBuffEnds[idx] = e; } + uint32_t GetVertBufferStart(uint32_t idx) const { return fVertBuffStarts[idx]; } + uint32_t GetVertBufferEnd(uint32_t idx) const { return fVertBuffEnds[idx] >= 0 ? uint32_t(fVertBuffEnds[idx]) : GetVertBufferCount(idx); } + uint32_t GetIndexBufferStart(uint32_t idx) const { return fIdxBuffStarts[idx]; } + uint32_t GetIndexBufferEnd(uint32_t idx) const { return fIdxBuffEnds[idx] >= 0 ? uint32_t(fIdxBuffEnds[idx]) : GetIndexBufferCount(idx); } + + void SetVertBufferStart(uint32_t idx, uint32_t s) { fVertBuffStarts[idx] = s; } + void SetVertBufferEnd(uint32_t idx, uint32_t e) { fVertBuffEnds[idx] = e; } + void SetIndexBufferStart(uint32_t idx, uint32_t s) { fIdxBuffStarts[idx] = s; } + void SetIndexBufferEnd(uint32_t idx, uint32_t e) { fIdxBuffEnds[idx] = e; } /////////////////////////////////////////////////////////////////////////////// - UInt32 GetNumVertexBuffers( void ) const { return fVertBuffStorage.GetCount(); } - UInt32 GetNumIndexBuffers( void ) const { return fIdxBuffStorage.GetCount(); } + uint32_t GetNumVertexBuffers( void ) const { return fVertBuffStorage.GetCount(); } + uint32_t GetNumIndexBuffers( void ) const { return fIdxBuffStorage.GetCount(); } - UInt8 *GetVertBufferData( UInt32 idx ) { return fVertBuffStorage[ idx ]; } - UInt16 *GetIndexBufferData( UInt32 idx ) { return fIdxBuffStorage[ idx ]; } - plGBufferColor *GetColorBufferData( UInt32 idx ) { return fColorBuffStorage[ idx ]; } + uint8_t *GetVertBufferData( uint32_t idx ) { return fVertBuffStorage[ idx ]; } + uint16_t *GetIndexBufferData( uint32_t idx ) { return fIdxBuffStorage[ idx ]; } + plGBufferColor *GetColorBufferData( uint32_t idx ) { return fColorBuffStorage[ idx ]; } - hsGDeviceRef *GetVertexBufferRef( UInt32 i ); - hsGDeviceRef *GetIndexBufferRef( UInt32 i ); + hsGDeviceRef *GetVertexBufferRef( uint32_t i ); + hsGDeviceRef *GetIndexBufferRef( uint32_t i ); - UInt32 GetNumCells( UInt32 idx ) const { return fCells[ idx ]->GetCount(); } - plGBufferCell *GetCell( UInt32 idx, UInt32 cell ) { return &( (*fCells[ idx ])[ cell ] ); } + uint32_t GetNumCells( uint32_t idx ) const { return fCells[ idx ]->GetCount(); } + plGBufferCell *GetCell( uint32_t idx, uint32_t cell ) { return &( (*fCells[ idx ])[ cell ] ); } - void SetVertexBufferRef( UInt32 index, hsGDeviceRef *vb ); - void SetIndexBufferRef( UInt32 index, hsGDeviceRef *ib ); + void SetVertexBufferRef( uint32_t index, hsGDeviceRef *vb ); + void SetIndexBufferRef( uint32_t index, hsGDeviceRef *ib ); virtual void Read( hsStream* s ); virtual void Write( hsStream* s ); // Accessor functions - hsPoint3 &Position( int iBuff, UInt32 cell, int iVtx ); - hsVector3 &Normal( int iBuff, UInt32 cell, int iVtx ); - UInt32 &Color( int iBuff, UInt32 cell, int iVtx ); - UInt32 &Specular( int iBuff, UInt32 cell, int iVtx ); - hsPoint3 &UV( int iBuff, UInt32 cell, int iVtx, int channel ); - UInt32 Format() const { return fFormat; } + hsPoint3 &Position( int iBuff, uint32_t cell, int iVtx ); + hsVector3 &Normal( int iBuff, uint32_t cell, int iVtx ); + uint32_t &Color( int iBuff, uint32_t cell, int iVtx ); + uint32_t &Specular( int iBuff, uint32_t cell, int iVtx ); + hsPoint3 &UV( int iBuff, uint32_t cell, int iVtx, int channel ); + uint32_t Format() const { return fFormat; } // Take temp accumulators and actually build buffer data from them void TidyUp( void ); @@ -268,34 +268,34 @@ class plGBufferGroup void PrepForRendering( plPipeline *pipe, hsBool adjustForNvidiaLighting ); // Reserves space in a vertex buffer - hsBool ReserveVertStorage( UInt32 numVerts, UInt32 *vbIndex, UInt32 *cell, UInt32 *offset, UInt8 flags ); + hsBool ReserveVertStorage( uint32_t numVerts, uint32_t *vbIndex, uint32_t *cell, uint32_t *offset, uint8_t flags ); // Append vertex data to the first available storage buffer - void AppendToVertStorage( plGeometrySpan *srcSpan, UInt32 *vbIndex, UInt32 *cell, UInt32 *offset ); - void AppendToVertAndColorStorage( plGeometrySpan *srcSpan, UInt32 *vbIndex, UInt32 *cell, UInt32 *offset ); - void AppendToColorStorage( plGeometrySpan *srcSpan, UInt32 *vbIndex, UInt32 *cell, UInt32 *offset, UInt32 origCell ); + void AppendToVertStorage( plGeometrySpan *srcSpan, uint32_t *vbIndex, uint32_t *cell, uint32_t *offset ); + void AppendToVertAndColorStorage( plGeometrySpan *srcSpan, uint32_t *vbIndex, uint32_t *cell, uint32_t *offset ); + void AppendToColorStorage( plGeometrySpan *srcSpan, uint32_t *vbIndex, uint32_t *cell, uint32_t *offset, uint32_t origCell ); // Reserves space in an index buffer - hsBool ReserveIndexStorage( UInt32 numIndices, UInt32 *ibIndex, UInt32 *ibStart, UInt16 **dataPtr = nil ); + hsBool ReserveIndexStorage( uint32_t numIndices, uint32_t *ibIndex, uint32_t *ibStart, uint16_t **dataPtr = nil ); // Append index data to the first available storage buffer - void AppendToIndexStorage( UInt32 numIndices, UInt16 *data, UInt32 addToAll, UInt32 *ibIndex, UInt32 *ibStart ); + void AppendToIndexStorage( uint32_t numIndices, uint16_t *data, uint32_t addToAll, uint32_t *ibIndex, uint32_t *ibStart ); /// Dynamic functions (addition/deletion of raw data) - void DeleteVertsFromStorage( UInt32 which, UInt32 start, UInt32 length ); - void AdjustIndicesInStorage( UInt32 which, UInt16 threshhold, Int16 delta ); - void DeleteIndicesFromStorage( UInt32 which, UInt32 start, UInt32 length ); + void DeleteVertsFromStorage( uint32_t which, uint32_t start, uint32_t length ); + void AdjustIndicesInStorage( uint32_t which, uint16_t threshhold, int16_t delta ); + void DeleteIndicesFromStorage( uint32_t which, uint32_t start, uint32_t length ); // Returns an array of plGBufferTriangles representing the span of indices specified - plGBufferTriangle *ConvertToTriList( Int16 spanIndex, UInt32 whichIdx, UInt32 whichVtx, UInt32 whichCell, UInt32 start, UInt32 numTriangles ); + plGBufferTriangle *ConvertToTriList( int16_t spanIndex, uint32_t whichIdx, uint32_t whichVtx, uint32_t whichCell, uint32_t start, uint32_t numTriangles ); // Stuffs the indices from an array of plGBufferTriangles into the index storage - void StuffFromTriList( UInt32 which, UInt32 start, UInt32 numTriangles, UInt16 *data ); - void StuffTri( UInt32 iBuff, UInt32 iTri, UInt16 idx0, UInt16 idx1, UInt16 idx2 ); + void StuffFromTriList( uint32_t which, uint32_t start, uint32_t numTriangles, uint16_t *data ); + void StuffTri( uint32_t iBuff, uint32_t iTri, uint16_t idx0, uint16_t idx1, uint16_t idx2 ); // Stuff the data from a geometry span into vertex storage - void StuffToVertStorage( plGeometrySpan *srcSpan, UInt32 vbIndex, UInt32 cell, UInt32 offset, UInt8 flags ); + void StuffToVertStorage( plGeometrySpan *srcSpan, uint32_t vbIndex, uint32_t cell, uint32_t offset, uint8_t flags ); // Are our verts volatile? hsBool AreVertsVolatile() const { return fVertsVolatile; } diff --git a/Sources/Plasma/PubUtilLib/plPipeline/plPlates.cpp b/Sources/Plasma/PubUtilLib/plPipeline/plPlates.cpp index 46e30bcf..5292efcf 100644 --- a/Sources/Plasma/PubUtilLib/plPipeline/plPlates.cpp +++ b/Sources/Plasma/PubUtilLib/plPipeline/plPlates.cpp @@ -45,8 +45,8 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // // ////////////////////////////////////////////////////////////////////////////// -#include "hsWindows.h" -#include "hsTypes.h" + +#include "HeadSpin.h" #include "plPipeline.h" #include "plPlates.h" @@ -75,7 +75,7 @@ void SetHInstance(void *instance) //// plPlate Functions /////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////// -UInt32 plPlate::fMagicUniqueKeyInt = 0; +uint32_t plPlate::fMagicUniqueKeyInt = 0; plPlate::plPlate( plPlate **owningHandle ) { @@ -107,7 +107,7 @@ plPlate::~plPlate() //// SetPosition ///////////////////////////////////////////////////////////// -void plPlate::SetPosition( hsScalar x, hsScalar y, hsScalar z ) +void plPlate::SetPosition( float x, float y, float z ) { hsVector3 triple; @@ -130,14 +130,14 @@ void plPlate::SetPosition( hsScalar x, hsScalar y, hsScalar z ) //// SetSize ///////////////////////////////////////////////////////////////// -void plPlate::SetSize( hsScalar width, hsScalar height, bool adjustByAspectRation ) +void plPlate::SetSize( float width, float height, bool adjustByAspectRation ) { hsVector3 size; width *= fDepth / 1.0f; height *= fDepth / 1.0f; - size.fX = adjustByAspectRation ? (width * ((hsScalar)plPlateManager::Instance().GetPipeHeight() / (hsScalar)plPlateManager::Instance().GetPipeWidth())) : width; + size.fX = adjustByAspectRation ? (width * ((float)plPlateManager::Instance().GetPipeHeight() / (float)plPlateManager::Instance().GetPipeWidth())) : width; size.fY = height; size.fZ = 1.0f; @@ -166,7 +166,7 @@ void plPlate::SetTexture(plBitmap *texture) hsGMaterial *material; plString keyName; - material = TRACKED_NEW hsGMaterial(); + material = new hsGMaterial(); keyName = plString::Format( "PlateBlank#%d", fMagicUniqueKeyInt++ ); hsgResMgr::ResMgr()->NewKey( keyName, material, plLocation::kGlobalFixedLoc ); layer = material->MakeBaseLayer(); @@ -176,14 +176,14 @@ void plPlate::SetTexture(plBitmap *texture) layer->SetOpacity( fOpacity ); layer->SetUVWSrc(plLayerInterface::kUVWPassThru); - hsgResMgr::ResMgr()->AddViaNotify(texture->GetKey(), TRACKED_NEW plGenRefMsg(layer->GetKey(), plRefMsg::kOnCreate, -1, plLayRefMsg::kTexture), plRefFlags::kActiveRef); + hsgResMgr::ResMgr()->AddViaNotify(texture->GetKey(), new plGenRefMsg(layer->GetKey(), plRefMsg::kOnCreate, -1, plLayRefMsg::kTexture), plRefFlags::kActiveRef); SetMaterial(material); } //// SetOpacity ////////////////////////////////////////////////////////////// -void plPlate::SetOpacity( hsScalar opacity ) +void plPlate::SetOpacity( float opacity ) { if( fMaterial != nil && fMaterial->GetLayer( 0 ) != nil ) { @@ -198,7 +198,7 @@ void plPlate::SetOpacity( hsScalar opacity ) // Creates a new material for this plate with either a specified texture // or an empty, white-filled bitmap. -plMipmap *plPlate::CreateMaterial( UInt32 width, UInt32 height, hsBool withAlpha, plMipmap* texture ) +plMipmap *plPlate::CreateMaterial( uint32_t width, uint32_t height, hsBool withAlpha, plMipmap* texture ) { plLayer *layer; hsGMaterial *material; @@ -212,7 +212,7 @@ plMipmap *plPlate::CreateMaterial( UInt32 width, UInt32 height, hsBool withAl else { /// Create a new bitmap - fMipmap = TRACKED_NEW plMipmap( width, height, withAlpha ? plMipmap::kARGB32Config : plMipmap::kRGB32Config, 1 ); + fMipmap = new plMipmap( width, height, withAlpha ? plMipmap::kARGB32Config : plMipmap::kRGB32Config, 1 ); memset( fMipmap->GetImage(), 0xff, height * fMipmap->GetRowBytes() ); keyName = plString::Format( "PlateBitmap#%d", fMagicUniqueKeyInt++ ); hsgResMgr::ResMgr()->NewKey( keyName, fMipmap, plLocation::kGlobalFixedLoc ); @@ -220,7 +220,7 @@ plMipmap *plPlate::CreateMaterial( UInt32 width, UInt32 height, hsBool withAl } /// NOW create a layer wrapper and a material for that layer - material = TRACKED_NEW hsGMaterial(); + material = new hsGMaterial(); keyName = plString::Format( "PlateBlank#%d", fMagicUniqueKeyInt++ ); hsgResMgr::ResMgr()->NewKey( keyName, material, plLocation::kGlobalFixedLoc ); layer = material->MakeBaseLayer(); @@ -229,7 +229,7 @@ plMipmap *plPlate::CreateMaterial( UInt32 width, UInt32 height, hsBool withAl layer->SetBlendFlags( layer->GetBlendFlags() | hsGMatState::kBlendAlpha ); layer->SetOpacity( fOpacity ); - hsgResMgr::ResMgr()->AddViaNotify( fMipmap->GetKey(), TRACKED_NEW plLayRefMsg( layer->GetKey(), plRefMsg::kOnCreate, 0, plLayRefMsg::kTexture ), plRefFlags::kActiveRef ); + hsgResMgr::ResMgr()->AddViaNotify( fMipmap->GetKey(), new plLayRefMsg( layer->GetKey(), plRefMsg::kOnCreate, 0, plLayRefMsg::kTexture ), plRefFlags::kActiveRef ); // Set up a ref to these. Since we don't have a key, we use the // generic RefObject() (and matching UnRefObject() when we're done). @@ -249,7 +249,7 @@ void plPlate::CreateFromResource(const char *resName) { if (resName) { - plMipmap* resTexture = TRACKED_NEW plMipmap; + plMipmap* resTexture = new plMipmap; resTexture->CopyFrom(plClientResMgr::Instance().getResource(resName)); plString keyName = plString::Format( "PlateResource#%d", fMagicUniqueKeyInt++ ); @@ -325,7 +325,7 @@ plGraphPlate::~plGraphPlate() //// IMakePow2 /////////////////////////////////////////////////////////////// -UInt32 plGraphPlate::IMakePow2( UInt32 value ) +uint32_t plGraphPlate::IMakePow2( uint32_t value ) { int i; @@ -336,9 +336,9 @@ UInt32 plGraphPlate::IMakePow2( UInt32 value ) //// SetDataRange //////////////////////////////////////////////////////////// -void plGraphPlate::SetDataRange( UInt32 min, UInt32 max, UInt32 width ) +void plGraphPlate::SetDataRange( uint32_t min, uint32_t max, uint32_t width ) { - UInt32 height; + uint32_t height; width = IMakePow2( width + 4 ); @@ -356,7 +356,7 @@ void plGraphPlate::SetDataRange( UInt32 min, UInt32 max, UInt32 width ) //// SetDataLabels /////////////////////////////////////////////////////////// -void plGraphPlate::SetDataLabels( UInt32 min, UInt32 max ) +void plGraphPlate::SetDataLabels( uint32_t min, uint32_t max ) { fLabelMin = min; fLabelMax = max; @@ -366,7 +366,7 @@ void plGraphPlate::SetDataLabels( UInt32 min, UInt32 max ) void plGraphPlate::ClearData( void ) { - UInt32 *bits = (UInt32 *)fMipmap->GetImage(), *ptr; + uint32_t *bits = (uint32_t *)fMipmap->GetImage(), *ptr; int i; @@ -394,9 +394,9 @@ void plGraphPlate::ClearData( void ) //// AddData ///////////////////////////////////////////////////////////////// // Scroll graph data left by one, then add the new value -void plGraphPlate::AddData( Int32 value, Int32 value2, Int32 value3, Int32 value4 ) +void plGraphPlate::AddData( int32_t value, int32_t value2, int32_t value3, int32_t value4 ) { - std::vector values; + std::vector values; if (value != -1) values.push_back(value); if (value2 != -1) @@ -408,15 +408,15 @@ void plGraphPlate::AddData( Int32 value, Int32 value2, Int32 value3, Int32 va AddData(values); } -void plGraphPlate::AddData( std::vector values ) +void plGraphPlate::AddData( std::vector values ) { hsAssert( fMipmap != nil, "Trying to add data to an uninitialized plGraphPlate" ); fMipmap->SetCurrLevel( 0 ); - UInt32 *bits = (UInt32 *)fMipmap->GetImage(), *ptr; - UInt32 *minDPos = fMipmap->GetAddr32( 3, fMipmap->GetHeight() - 3 - 10 ); - UInt32 *maxDPos = fMipmap->GetAddr32( 3, 2 ); + uint32_t *bits = (uint32_t *)fMipmap->GetImage(), *ptr; + uint32_t *minDPos = fMipmap->GetAddr32( 3, fMipmap->GetHeight() - 3 - 10 ); + uint32_t *maxDPos = fMipmap->GetAddr32( 3, 2 ); int i, j; std::vector lows, his; float lineCtr, lineInc; @@ -446,7 +446,7 @@ void plGraphPlate::AddData( std::vector values ) values[ i ] = fLabelMax; else if( values[ i ] < fLabelMin ) values[ i ] = fLabelMin; - values[ i ] = (UInt32)( (float)values[ i ] * ( fMipmap->GetHeight() - 4 ) / ( fLabelMax - fLabelMin + 1 ) ); + values[ i ] = (uint32_t)( (float)values[ i ] * ( fMipmap->GetHeight() - 4 ) / ( fLabelMax - fLabelMin + 1 ) ); if( values[ i ] < fLastValues[ i ] ) { @@ -472,7 +472,7 @@ void plGraphPlate::AddData( std::vector values ) if( lineInt != lastLineInt ) bumpCtr = 2; - memmove( ptr, ptr + 1, ( fMipmap->GetWidth() - 5 ) * sizeof( UInt32 ) ); + memmove( ptr, ptr + 1, ( fMipmap->GetWidth() - 5 ) * sizeof( uint32_t ) ); int dataIndex; bool dataPlotted = false; for (dataIndex = 0; dataIndex < values.size(); dataIndex++) @@ -519,7 +519,7 @@ void plGraphPlate::AddData( std::vector values ) //// SetColors /////////////////////////////////////////////////////////////// -void plGraphPlate::SetColors( UInt32 bgHexColor, UInt32 axesHexColor, UInt32 dataHexColor, UInt32 graphHexColor ) +void plGraphPlate::SetColors( uint32_t bgHexColor, uint32_t axesHexColor, uint32_t dataHexColor, uint32_t graphHexColor ) { fBGHexColor = bgHexColor; fAxesHexColor = axesHexColor; @@ -534,9 +534,9 @@ void plGraphPlate::SetColors( UInt32 bgHexColor, UInt32 axesHexColor, UInt32 //// SetDataColors /////////////////////////////////////////////////////////// -void plGraphPlate::SetDataColors( UInt32 hexColor1, UInt32 hexColor2, UInt32 hexColor3, UInt32 hexColor4 ) +void plGraphPlate::SetDataColors( uint32_t hexColor1, uint32_t hexColor2, uint32_t hexColor3, uint32_t hexColor4 ) { - std::vector colors; + std::vector colors; colors.push_back(hexColor1); colors.push_back(hexColor2); colors.push_back(hexColor3); @@ -544,7 +544,7 @@ void plGraphPlate::SetDataColors( UInt32 hexColor1, UInt32 hexColor2, UInt32 SetDataColors(colors); } -void plGraphPlate::SetDataColors( const std::vector & hexColors ) +void plGraphPlate::SetDataColors( const std::vector & hexColors ) { fDataHexColors = hexColors; } @@ -583,7 +583,7 @@ void plGraphPlate::SetLabelText( const std::vector & text ) //// IDrawNumber ///////////////////////////////////////////////////////////// -void plGraphPlate::IDrawNumber( UInt32 number, UInt32 *dataPtr, UInt32 stride, UInt32 color ) +void plGraphPlate::IDrawNumber( uint32_t number, uint32_t *dataPtr, uint32_t stride, uint32_t color ) { char str[ 16 ]; int i; @@ -599,7 +599,7 @@ void plGraphPlate::IDrawNumber( UInt32 number, UInt32 *dataPtr, UInt32 stride //// IDrawDigit ////////////////////////////////////////////////////////////// -void plGraphPlate::IDrawDigit( char digit, UInt32 *dataPtr, UInt32 stride, UInt32 color ) +void plGraphPlate::IDrawDigit( char digit, uint32_t *dataPtr, uint32_t stride, uint32_t color ) { /// Yes, I know this is ugly. Move it into another file if you like. char digits[ 10 ][ 5 * 3 ] = @@ -698,20 +698,20 @@ plPlateManager::~plPlateManager() void plPlateManager::CreatePlate( plPlate **handle ) { - plPlate *plate = TRACKED_NEW plPlate( handle ); + plPlate *plate = new plPlate( handle ); plate->ILink( &fPlates ); *handle = plate; } -void plPlateManager::CreatePlate( plPlate **handle, hsScalar width, hsScalar height ) +void plPlateManager::CreatePlate( plPlate **handle, float width, float height ) { CreatePlate( handle ); (*handle)->SetSize( width, height ); } -void plPlateManager::CreatePlate( plPlate **handle, hsScalar x, hsScalar y, hsScalar width, hsScalar height ) +void plPlateManager::CreatePlate( plPlate **handle, float x, float y, float width, float height ) { CreatePlate( handle ); (*handle)->SetPosition( x, y ); @@ -720,7 +720,7 @@ void plPlateManager::CreatePlate( plPlate **handle, hsScalar x, hsScalar y, h void plPlateManager::CreateGraphPlate( plGraphPlate **handle ) { - plGraphPlate *plate = TRACKED_NEW plGraphPlate( (plPlate **)handle ); + plGraphPlate *plate = new plGraphPlate( (plPlate **)handle ); plate->ILink( &fPlates ); @@ -740,12 +740,12 @@ void plPlateManager::DestroyPlate( plPlate *plate ) //// GetPipeWidth/Height ///////////////////////////////////////////////////// -UInt32 plPlateManager::GetPipeWidth( void ) +uint32_t plPlateManager::GetPipeWidth( void ) { return fOwner->Width(); } -UInt32 plPlateManager::GetPipeHeight( void ) +uint32_t plPlateManager::GetPipeHeight( void ) { return fOwner->Height(); } @@ -774,7 +774,7 @@ void plPlateManager::IResortPlate( plPlate *plate, bool fromCurrent ) //// SetPlateScreenPos /////////////////////////////////////////////////////// -void plPlateManager::SetPlateScreenPos( plPlate *plate, UInt32 x, UInt32 y ) +void plPlateManager::SetPlateScreenPos( plPlate *plate, uint32_t x, uint32_t y ) { float cX = ( (float)x / fOwner->Width() ) * 2.0f - 1.0f; float cY = ( (float)y / fOwner->Height() ) * 2.0f - 1.0f; @@ -782,7 +782,7 @@ void plPlateManager::SetPlateScreenPos( plPlate *plate, UInt32 x, UInt32 y ) plate->SetPosition( cX, cY ); } -void plPlateManager::SetPlatePixelSize( plPlate *plate, UInt32 pWidth, UInt32 pHeight ) +void plPlateManager::SetPlatePixelSize( plPlate *plate, uint32_t pWidth, uint32_t pHeight ) { float width = (float)pWidth / fOwner->Width() * 2.0f; float height = (float)pHeight / fOwner->Height() * 2.0f; diff --git a/Sources/Plasma/PubUtilLib/plPipeline/plPlates.h b/Sources/Plasma/PubUtilLib/plPipeline/plPlates.h index 3ecb14c4..ad3780b5 100644 --- a/Sources/Plasma/PubUtilLib/plPipeline/plPlates.h +++ b/Sources/Plasma/PubUtilLib/plPipeline/plPlates.h @@ -48,11 +48,11 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #ifndef _plPlates_h #define _plPlates_h -#include "hsTypes.h" +#include "HeadSpin.h" #include "hsStlUtils.h" #include "hsColorRGBA.h" #include "hsTemplates.h" -#include "hsUtils.h" + #include "hsMatrix44.h" @@ -77,8 +77,8 @@ class plPlate hsMatrix44 fXformMatrix; hsGMaterial *fMaterial; plMipmap *fMipmap; - hsScalar fDepth, fOpacity; - UInt32 fFlags; + float fDepth, fOpacity; + uint32_t fFlags; char fTitle[ 64 ]; plPlate *fNext; @@ -86,7 +86,7 @@ class plPlate plPlate **fOwningHandle; - static UInt32 fMagicUniqueKeyInt; + static uint32_t fMagicUniqueKeyInt; plPlate( plPlate** owningHandle ); virtual ~plPlate(); @@ -104,7 +104,7 @@ class plPlate fPrevPtr = nil; } - void ISetResourceAlphas(UInt32 colorKey); + void ISetResourceAlphas(uint32_t colorKey); public: @@ -125,24 +125,24 @@ class plPlate hsGMaterial *GetMaterial( void ) { return fMaterial; } hsMatrix44 &GetTransform( void ) { return fXformMatrix; } const char *GetTitle( void ) { return fTitle; } - UInt32 GetFlags( void ) { return fFlags; } + uint32_t GetFlags( void ) { return fFlags; } const plMipmap *GetMipmap( void ) { return fMipmap; } void SetVisible( hsBool vis ) { if( vis ) fFlags |= kFlagVisible; else fFlags &= ~kFlagVisible; } hsBool IsVisible( void ); - void SetOpacity( hsScalar opacity = 1.f ); + void SetOpacity( float opacity = 1.f ); plPlate *GetNext( void ) { return fNext; } /// Helper functions - void SetDepth( hsScalar depth) { fDepth = depth; } - void SetPosition( hsScalar x, hsScalar y, hsScalar z = -1.0f ); - void SetSize( hsScalar width, hsScalar height, bool adjustByAspectRatio = false ); + void SetDepth( float depth) { fDepth = depth; } + void SetPosition( float x, float y, float z = -1.0f ); + void SetSize( float width, float height, bool adjustByAspectRatio = false ); - plMipmap *CreateMaterial( UInt32 width, UInt32 height, hsBool withAlpha, plMipmap* texture = NULL ); + plMipmap *CreateMaterial( uint32_t width, uint32_t height, hsBool withAlpha, plMipmap* texture = NULL ); void CreateFromResource( const char *resName ); void ReloadFromResource( const char *resName ); }; @@ -154,37 +154,37 @@ class plPlate class plGraphPlate : public plPlate { protected: - UInt32 fBGHexColor, fAxesHexColor, fGraphHexColor; - std::vector fDataHexColors; - UInt32 fMin, fMax, fLabelMin, fLabelMax; - std::vector fLastValues; + uint32_t fBGHexColor, fAxesHexColor, fGraphHexColor; + std::vector fDataHexColors; + uint32_t fMin, fMax, fLabelMin, fLabelMax; + std::vector fLastValues; std::vector fLabelText; - UInt32 IMakePow2( UInt32 value ); - void IDrawNumber( UInt32 number, UInt32 *dataPtr, UInt32 stride, UInt32 color ); - void IDrawDigit( char digit, UInt32 *dataPtr, UInt32 stride, UInt32 color ); + uint32_t IMakePow2( uint32_t value ); + void IDrawNumber( uint32_t number, uint32_t *dataPtr, uint32_t stride, uint32_t color ); + void IDrawDigit( char digit, uint32_t *dataPtr, uint32_t stride, uint32_t color ); public: plGraphPlate( plPlate **owningHandle ); virtual ~plGraphPlate(); - void SetDataRange( UInt32 min, UInt32 max, UInt32 width ); - void SetDataLabels( UInt32 min, UInt32 max ); + void SetDataRange( uint32_t min, uint32_t max, uint32_t width ); + void SetDataLabels( uint32_t min, uint32_t max ); void SetLabelText( char *text1, char *text2 = nil, char *text3 = nil, char *text4 = nil ); void SetLabelText( const std::vector & text ); void ClearData( void ); - void AddData( Int32 value, Int32 value2 = -1, Int32 value3 = -1, Int32 value4 = -1 ); - void AddData( std::vector values ); + void AddData( int32_t value, int32_t value2 = -1, int32_t value3 = -1, int32_t value4 = -1 ); + void AddData( std::vector values ); - void SetColors( UInt32 bgHexColor = 0x80000000, UInt32 axesHexColor = 0xffffffff, UInt32 dataHexColor = 0xff00ff00, UInt32 graphHexColor = 0x80ff0000 ); - void SetDataColors( UInt32 hexColor1 = 0xff00ff00, UInt32 hexColor2 = 0xff0000ff, UInt32 hexColor3 = 0xffffff00, UInt32 hexColor4 = 0xffff00ff ); - void SetDataColors( const std::vector & hexColors ); + void SetColors( uint32_t bgHexColor = 0x80000000, uint32_t axesHexColor = 0xffffffff, uint32_t dataHexColor = 0xff00ff00, uint32_t graphHexColor = 0x80ff0000 ); + void SetDataColors( uint32_t hexColor1 = 0xff00ff00, uint32_t hexColor2 = 0xff0000ff, uint32_t hexColor3 = 0xffffff00, uint32_t hexColor4 = 0xffff00ff ); + void SetDataColors( const std::vector & hexColors ); const char *GetLabelText( int i ) { return fLabelText[ i ].c_str(); } - const UInt32 GetDataColor( int i ) { return fDataHexColors[ i ]; } - const UInt32 GetNumLabels() { return fLabelText.size(); } - const UInt32 GetNumColors() { return fDataHexColors.size(); } + const uint32_t GetDataColor( int i ) { return fDataHexColors[ i ]; } + const uint32_t GetNumLabels() { return fLabelText.size(); } + const uint32_t GetNumColors() { return fDataHexColors.size(); } }; //// plPlateManager Class Definition ///////////////////////////////////////// @@ -227,18 +227,18 @@ class plPlateManager static bool InstanceValid( void ) { return fInstance != nil; } void CreatePlate( plPlate **handle ); - void CreatePlate( plPlate **handle, hsScalar width, hsScalar height ); - void CreatePlate( plPlate **handle, hsScalar x, hsScalar y, hsScalar width, hsScalar height ); + void CreatePlate( plPlate **handle, float width, float height ); + void CreatePlate( plPlate **handle, float x, float y, float width, float height ); void CreateGraphPlate( plGraphPlate **handle ); void DestroyPlate( plPlate *plate ); - void SetPlateScreenPos( plPlate *plate, UInt32 x, UInt32 y ); - void SetPlatePixelSize( plPlate *plate, UInt32 pWidth, UInt32 pHeight ); + void SetPlateScreenPos( plPlate *plate, uint32_t x, uint32_t y ); + void SetPlatePixelSize( plPlate *plate, uint32_t pWidth, uint32_t pHeight ); - UInt32 GetPipeWidth( void ); - UInt32 GetPipeHeight( void ); + uint32_t GetPipeWidth( void ); + uint32_t GetPipeHeight( void ); void DrawToDevice( plPipeline *pipe ); hsBool IsValid( void ) { return fCreatedSucessfully; } diff --git a/Sources/Plasma/PubUtilLib/plPipeline/plRenderTarget.cpp b/Sources/Plasma/PubUtilLib/plPipeline/plRenderTarget.cpp index 2b5fa7f7..313c9728 100644 --- a/Sources/Plasma/PubUtilLib/plPipeline/plRenderTarget.cpp +++ b/Sources/Plasma/PubUtilLib/plPipeline/plRenderTarget.cpp @@ -50,7 +50,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // // /////////////////////////////////////////////////////////////////////////////// -#include "hsTypes.h" +#include "HeadSpin.h" #include "plRenderTarget.h" #include "plCubicRenderTarget.h" #include "hsStream.h" @@ -90,9 +90,9 @@ hsBool plRenderTarget::MsgReceive(plMessage* msg) return plBitmap::MsgReceive(msg); } -UInt32 plRenderTarget::Read( hsStream *s ) +uint32_t plRenderTarget::Read( hsStream *s ) { - UInt32 total = plBitmap::Read( s ); + uint32_t total = plBitmap::Read( s ); fWidth = s->ReadLE16(); fHeight = s->ReadLE16(); @@ -116,12 +116,12 @@ UInt32 plRenderTarget::Read( hsStream *s ) fZDepth = s->ReadByte(); fStencilDepth = s->ReadByte(); - return total + 2 * 2 + 2 + 4 * ( fProportionalViewport ? sizeof( hsScalar ) : sizeof( UInt16 ) ) + sizeof( hsBool ); + return total + 2 * 2 + 2 + 4 * ( fProportionalViewport ? sizeof( float ) : sizeof( uint16_t ) ) + sizeof( hsBool ); } -UInt32 plRenderTarget::Write( hsStream *s ) +uint32_t plRenderTarget::Write( hsStream *s ) { - UInt32 total = plBitmap::Write( s ); + uint32_t total = plBitmap::Write( s ); s->WriteLE16( fWidth ); s->WriteLE16( fHeight ); @@ -145,23 +145,23 @@ UInt32 plRenderTarget::Write( hsStream *s ) s->WriteByte( fZDepth ); s->WriteByte( fStencilDepth ); - return total + 2 * 2 + 2 + 4 * ( fProportionalViewport ? sizeof( hsScalar ) : sizeof( UInt16 ) ) + sizeof( hsBool ); + return total + 2 * 2 + 2 + 4 * ( fProportionalViewport ? sizeof( float ) : sizeof( uint16_t ) ) + sizeof( hsBool ); } /////////////////////////////////////////////////////////////////////////////// //// plCubicRenderTarget Functions //////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////// -UInt32 plCubicRenderTarget::Read( hsStream *s ) +uint32_t plCubicRenderTarget::Read( hsStream *s ) { int i; - UInt32 total = plRenderTarget::Read( s ); + uint32_t total = plRenderTarget::Read( s ); for( i = 0; i < 6; i++ ) { if( fFaces[ i ] == nil ) - fFaces[ i ] = TRACKED_NEW plRenderTarget(); + fFaces[ i ] = new plRenderTarget(); fFaces[ i ]->fParent = this; total += fFaces[ i ]->Read( s ); @@ -170,10 +170,10 @@ UInt32 plCubicRenderTarget::Read( hsStream *s ) return total; } -UInt32 plCubicRenderTarget::Write( hsStream *s ) +uint32_t plCubicRenderTarget::Write( hsStream *s ) { int i; - UInt32 total = plRenderTarget::Write( s ); + uint32_t total = plRenderTarget::Write( s ); for( i = 0; i < 6; i++ ) @@ -184,9 +184,9 @@ UInt32 plCubicRenderTarget::Write( hsStream *s ) return total; } -UInt32 plCubicRenderTarget::GetTotalSize( void ) const +uint32_t plCubicRenderTarget::GetTotalSize( void ) const { - UInt32 size = 0, i; + uint32_t size = 0, i; for( i = 0; i < 6; i++ ) { diff --git a/Sources/Plasma/PubUtilLib/plPipeline/plRenderTarget.h b/Sources/Plasma/PubUtilLib/plPipeline/plRenderTarget.h index 80b79034..32189a4d 100644 --- a/Sources/Plasma/PubUtilLib/plPipeline/plRenderTarget.h +++ b/Sources/Plasma/PubUtilLib/plPipeline/plRenderTarget.h @@ -71,30 +71,30 @@ class plRenderTarget : public plBitmap protected: - UInt16 fWidth, fHeight; + uint16_t fWidth, fHeight; union { struct { - UInt16 fLeft, fTop, fRight, fBottom; + uint16_t fLeft, fTop, fRight, fBottom; } fAbsolute; struct { - hsScalar fLeft, fTop, fRight, fBottom; + float fLeft, fTop, fRight, fBottom; } fProportional; } fViewport; hsBool fApplyTexQuality; hsBool fProportionalViewport; - UInt8 fZDepth, fStencilDepth; + uint8_t fZDepth, fStencilDepth; plCubicRenderTarget *fParent; virtual void SetKey(plKey k); - virtual UInt32 Read( hsStream *s ); - virtual UInt32 Write( hsStream *s ); + virtual uint32_t Read( hsStream *s ); + virtual uint32_t Write( hsStream *s ); public: CLASSNAME_REGISTER( plRenderTarget ); @@ -116,7 +116,7 @@ class plRenderTarget : public plBitmap plPipeResReq::Request(); } - plRenderTarget( UInt16 flags, UInt16 width, UInt16 height, UInt8 bitDepth, UInt8 zDepth = 0xff, UInt8 stencilDepth = 0xff ) + plRenderTarget( uint16_t flags, uint16_t width, uint16_t height, uint8_t bitDepth, uint8_t zDepth = 0xff, uint8_t stencilDepth = 0xff ) { fWidth = width; fHeight = height; @@ -136,7 +136,7 @@ class plRenderTarget : public plBitmap } // Render-to-Screen constructor - plRenderTarget( UInt16 flags, hsScalar left, hsScalar top, hsScalar right, hsScalar bottom, UInt8 bitDepth, UInt8 zDepth = 0xff, UInt8 stencilDepth = 0xff ) + plRenderTarget( uint16_t flags, float left, float top, float right, float bottom, uint8_t bitDepth, uint8_t zDepth = 0xff, uint8_t stencilDepth = 0xff ) { fWidth = 0; // Can't really set these, at least not yet fHeight = 0; @@ -157,7 +157,7 @@ class plRenderTarget : public plBitmap virtual ~plRenderTarget() {} - virtual void SetViewport( UInt16 left, UInt16 top, UInt16 right, UInt16 bottom ) + virtual void SetViewport( uint16_t left, uint16_t top, uint16_t right, uint16_t bottom ) { ASSERT_ABSOLUTE; fViewport.fAbsolute.fLeft = left; @@ -166,7 +166,7 @@ class plRenderTarget : public plBitmap fViewport.fAbsolute.fBottom = bottom; } - virtual void SetViewport( hsScalar left, hsScalar top, hsScalar right, hsScalar bottom ) + virtual void SetViewport( float left, float top, float right, float bottom ) { ASSERT_PROPORTIONAL; fViewport.fProportional.fLeft = left; @@ -175,26 +175,26 @@ class plRenderTarget : public plBitmap fViewport.fProportional.fBottom = bottom; } - UInt16 GetWidth( void ) { return fWidth; } - UInt16 GetHeight( void ) { return fHeight; } - UInt8 GetZDepth( void ) { return fZDepth; } - UInt8 GetStencilDepth( void ) { return fStencilDepth; } + uint16_t GetWidth( void ) { return fWidth; } + uint16_t GetHeight( void ) { return fHeight; } + uint8_t GetZDepth( void ) { return fZDepth; } + uint8_t GetStencilDepth( void ) { return fStencilDepth; } - UInt16 GetVPLeft( void ) { ASSERT_ABSOLUTE; return fViewport.fAbsolute.fLeft; } - UInt16 GetVPTop( void ) { ASSERT_ABSOLUTE; return fViewport.fAbsolute.fTop; } - UInt16 GetVPRight( void ) { ASSERT_ABSOLUTE; return fViewport.fAbsolute.fRight; } - UInt16 GetVPBottom( void ) { ASSERT_ABSOLUTE; return fViewport.fAbsolute.fBottom; } + uint16_t GetVPLeft( void ) { ASSERT_ABSOLUTE; return fViewport.fAbsolute.fLeft; } + uint16_t GetVPTop( void ) { ASSERT_ABSOLUTE; return fViewport.fAbsolute.fTop; } + uint16_t GetVPRight( void ) { ASSERT_ABSOLUTE; return fViewport.fAbsolute.fRight; } + uint16_t GetVPBottom( void ) { ASSERT_ABSOLUTE; return fViewport.fAbsolute.fBottom; } - hsScalar GetVPLeftProp( void ) { ASSERT_PROPORTIONAL; return fViewport.fProportional.fLeft; } - hsScalar GetVPTopProp( void ) { ASSERT_PROPORTIONAL; return fViewport.fProportional.fTop; } - hsScalar GetVPRightProp( void ) { ASSERT_PROPORTIONAL; return fViewport.fProportional.fRight; } - hsScalar GetVPBottomProp( void ) { ASSERT_PROPORTIONAL; return fViewport.fProportional.fBottom; } + float GetVPLeftProp( void ) { ASSERT_PROPORTIONAL; return fViewport.fProportional.fLeft; } + float GetVPTopProp( void ) { ASSERT_PROPORTIONAL; return fViewport.fProportional.fTop; } + float GetVPRightProp( void ) { ASSERT_PROPORTIONAL; return fViewport.fProportional.fRight; } + float GetVPBottomProp( void ) { ASSERT_PROPORTIONAL; return fViewport.fProportional.fBottom; } hsBool ViewIsProportional( void ) const { return fProportionalViewport; } plCubicRenderTarget *GetParent( void ) const { return fParent; } - virtual UInt32 GetTotalSize( void ) const { return fWidth * fHeight * ( fPixelSize >> 3 ); } + virtual uint32_t GetTotalSize( void ) const { return fWidth * fHeight * ( fPixelSize >> 3 ); } virtual hsBool MsgReceive(plMessage* msg); diff --git a/Sources/Plasma/PubUtilLib/plPipeline/plStatusLogDrawer.cpp b/Sources/Plasma/PubUtilLib/plPipeline/plStatusLogDrawer.cpp index 2b53b2d1..593a75ee 100644 --- a/Sources/Plasma/PubUtilLib/plPipeline/plStatusLogDrawer.cpp +++ b/Sources/Plasma/PubUtilLib/plPipeline/plStatusLogDrawer.cpp @@ -45,7 +45,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // // ////////////////////////////////////////////////////////////////////////////// -#include "hsTypes.h" +#include "HeadSpin.h" #include "plStatusLogDrawer.h" #include "plPipeline.h" #include "plDebugText.h" @@ -57,7 +57,7 @@ void plStatusLogDrawer::IDrawLogNames(plStatusLog* curLog, plStatusLog* firstLog { plDebugText& drawText = plDebugText::Instance(); - UInt32 width = 0, numLogs = 0; + uint32_t width = 0, numLogs = 0; plStatusLog* iLog = firstLog; while (iLog) @@ -67,17 +67,17 @@ void plStatusLogDrawer::IDrawLogNames(plStatusLog* curLog, plStatusLog* firstLog numLogs++; } - UInt32 height = drawText.GetFontHeight() + 2; - drawText.DrawRect(0, 0, (UInt16)width, (UInt16)(height*numLogs), 0, 0, 0); + uint32_t height = drawText.GetFontHeight() + 2; + drawText.DrawRect(0, 0, (uint16_t)width, (uint16_t)(height*numLogs), 0, 0, 0); - UInt32 yPos = 0; + uint32_t yPos = 0; iLog = firstLog; while (iLog) { if (iLog == curLog) - drawText.DrawString(2, (UInt16)yPos, iLog->GetFileName(), 0, 255, 0); + drawText.DrawString(2, (uint16_t)yPos, iLog->GetFileName(), 0, 255, 0); else - drawText.DrawString(2, (UInt16)yPos, iLog->GetFileName()); + drawText.DrawString(2, (uint16_t)yPos, iLog->GetFileName()); iLog = iLog->fNext; yPos += height; diff --git a/Sources/Plasma/PubUtilLib/plPipeline/plStencil.h b/Sources/Plasma/PubUtilLib/plPipeline/plStencil.h index 2b831424..9388553b 100644 --- a/Sources/Plasma/PubUtilLib/plPipeline/plStencil.h +++ b/Sources/Plasma/PubUtilLib/plPipeline/plStencil.h @@ -53,7 +53,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #ifndef _plStencil_h #define _plStencil_h -#include "hsTypes.h" +#include "HeadSpin.h" //// Stencil Caps ///////////////////////////////////////////////////////////// @@ -96,8 +96,8 @@ class plStencilCaps }; hsBool fIsSupported; - UInt8 fSupportedDepths; - UInt8 fSupportedOps; + uint8_t fSupportedDepths; + uint8_t fSupportedOps; }; #endif // _plStencil_h diff --git a/Sources/Plasma/PubUtilLib/plPipeline/plTextFont.cpp b/Sources/Plasma/PubUtilLib/plPipeline/plTextFont.cpp index 517a6736..7f1dea0d 100644 --- a/Sources/Plasma/PubUtilLib/plPipeline/plTextFont.cpp +++ b/Sources/Plasma/PubUtilLib/plPipeline/plTextFont.cpp @@ -50,7 +50,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // // /////////////////////////////////////////////////////////////////////////////// -#include "hsWindows.h" + #include "HeadSpin.h" #include "plTextFont.h" #include "plDebugText.h" @@ -73,11 +73,11 @@ plTextFont::~plTextFont() //// IInitFontTexture ///////////////////////////////////////////////////////// -UInt16 *plTextFont::IInitFontTexture( void ) +uint16_t *plTextFont::IInitFontTexture( void ) { int nHeight, x, y, c; char myChar[ 2 ] = "x"; - UInt16 *tBits; + uint16_t *tBits; DWORD *bitmapBits; BITMAPINFO bmi; @@ -138,7 +138,7 @@ UInt16 *plTextFont::IInitFontTexture( void ) myChar[ 0 ] = c; GetTextExtentPoint32( hDC, myChar, 1, &size ); - if( (UInt32)( x + size.cx + 1 ) > fTextureWidth ) + if( (uint32_t)( x + size.cx + 1 ) > fTextureWidth ) { x = 0; y += size.cy + 1; @@ -146,8 +146,8 @@ UInt16 *plTextFont::IInitFontTexture( void ) ExtTextOut( hDC, x, y, ETO_OPAQUE, nil, myChar, 1, nil ); - fCharInfo[ c ].fW = (UInt16)size.cx; - fCharInfo[ c ].fH = (UInt16)size.cy; + fCharInfo[ c ].fW = (uint16_t)size.cx; + fCharInfo[ c ].fH = (uint16_t)size.cy; fCharInfo[ c ].fUVs[ 0 ].fX = (float)x / (float)fTextureWidth; fCharInfo[ c ].fUVs[ 0 ].fY = (float)y / (float)fTextureHeight; fCharInfo[ c ].fUVs[ 1 ].fX = (float)( x + size.cx ) / (float)fTextureWidth; @@ -166,7 +166,7 @@ UInt16 *plTextFont::IInitFontTexture( void ) fCharInfo[ '\t' ].fH = fCharInfo[ 32 ].fH; /// Now create the data block - UInt16 *data = TRACKED_NEW UInt16[ fTextureWidth * fTextureHeight ]; + uint16_t *data = new uint16_t[ fTextureWidth * fTextureHeight ]; tBits = data; for( y = 0; y < fTextureHeight; y++ ) { @@ -193,7 +193,7 @@ UInt16 *plTextFont::IInitFontTexture( void ) //// Create /////////////////////////////////////////////////////////////////// -void plTextFont::Create( char *face, UInt16 size ) +void plTextFont::Create( char *face, uint16_t size ) { // Init normal stuff strncpy( fFace, face, sizeof( fFace ) ); @@ -204,7 +204,7 @@ void plTextFont::Create( char *face, UInt16 size ) void plTextFont::IInitObjects( void ) { - UInt16 *data; + uint16_t *data; // Create texture @@ -222,8 +222,8 @@ void plTextFont::IInitObjects( void ) //// DrawString /////////////////////////////////////////////////////////////// -void plTextFont::DrawString( const char *string, int sX, int sY, UInt32 hexColor, - UInt8 style, UInt32 rightEdge ) +void plTextFont::DrawString( const char *string, int sX, int sY, uint32_t hexColor, + uint8_t style, uint32_t rightEdge ) { static hsTArray verts; @@ -355,7 +355,7 @@ void plTextFont::DrawString( const char *string, int sX, int sY, UInt32 hexCo //// CalcStringWidth ////////////////////////////////////////////////////////// -UInt32 plTextFont::CalcStringWidth( const char *string ) +uint32_t plTextFont::CalcStringWidth( const char *string ) { int i, width = 0; @@ -378,7 +378,7 @@ UInt32 plTextFont::CalcStringWidth( const char *string ) // to create a background for our console; will be obliterated once we figure // a better way to do so. -void plTextFont::DrawRect( int left, int top, int right, int bottom, UInt32 hexColor ) +void plTextFont::DrawRect( int left, int top, int right, int bottom, uint32_t hexColor ) { static hsTArray verts; int i; @@ -412,7 +412,7 @@ void plTextFont::DrawRect( int left, int top, int right, int bottom, UInt32 h // second. I just LOOOOVE temporary functions :) // Note: this way sucks. Live with it. -void plTextFont::Draw3DBorder( int left, int top, int right, int bottom, UInt32 hexColor1, UInt32 hexColor2 ) +void plTextFont::Draw3DBorder( int left, int top, int right, int bottom, uint32_t hexColor1, uint32_t hexColor2 ) { static hsTArray verts; int i; diff --git a/Sources/Plasma/PubUtilLib/plPipeline/plTextFont.h b/Sources/Plasma/PubUtilLib/plPipeline/plTextFont.h index ce2add2f..c5219e5a 100644 --- a/Sources/Plasma/PubUtilLib/plPipeline/plTextFont.h +++ b/Sources/Plasma/PubUtilLib/plPipeline/plTextFont.h @@ -67,14 +67,14 @@ class plTextFont struct plDXCharInfo { - UInt16 fW, fH; + uint16_t fW, fH; hsPoint3 fUVs[ 2 ]; }; struct plFontVertex { hsPoint3 fPoint; - UInt32 fColor; + uint32_t fColor; hsPoint3 fUV; plFontVertex& operator=(const int zero) @@ -87,13 +87,13 @@ class plTextFont } }; - UInt32 fMaxNumIndices; - UInt32 fTextureWidth, fTextureHeight; + uint32_t fMaxNumIndices; + uint32_t fTextureWidth, fTextureHeight; char fFace[ 128 ]; - UInt16 fSize; + uint16_t fSize; hsBool fInitialized; - UInt16 fFontHeight; + uint16_t fFontHeight; plPipeline *fPipe; @@ -104,12 +104,12 @@ class plTextFont virtual void IInitObjects( void ); - virtual void ICreateTexture( UInt16 *data ) = 0; + virtual void ICreateTexture( uint16_t *data ) = 0; virtual void IInitStateBlocks( void ) = 0; - virtual void IDrawPrimitive( UInt32 count, plFontVertex *array ) = 0; - virtual void IDrawLines( UInt32 count, plFontVertex *array ) = 0; + virtual void IDrawPrimitive( uint32_t count, plFontVertex *array ) = 0; + virtual void IDrawLines( uint32_t count, plFontVertex *array ) = 0; - UInt16 *IInitFontTexture( void ); + uint16_t *IInitFontTexture( void ); void IUnlink( void ) { @@ -127,14 +127,14 @@ class plTextFont plTextFont( plPipeline *pipe ); virtual ~plTextFont(); - void Create( char *face, UInt16 size ); - void DrawString( const char *string, int x, int y, UInt32 hexColor, UInt8 style, UInt32 rightEdge = 0 ); - void DrawRect( int left, int top, int right, int bottom, UInt32 hexColor ); - void Draw3DBorder( int left, int top, int right, int bottom, UInt32 hexColor1, UInt32 hexColor2 ); - UInt32 CalcStringWidth( const char *string ); - UInt32 GetFontSize( void ) { return fSize; } + void Create( char *face, uint16_t size ); + void DrawString( const char *string, int x, int y, uint32_t hexColor, uint8_t style, uint32_t rightEdge = 0 ); + void DrawRect( int left, int top, int right, int bottom, uint32_t hexColor ); + void Draw3DBorder( int left, int top, int right, int bottom, uint32_t hexColor1, uint32_t hexColor2 ); + uint32_t CalcStringWidth( const char *string ); + uint32_t GetFontSize( void ) { return fSize; } - UInt16 GetFontHeight() { return fFontHeight; } + uint16_t GetFontHeight() { return fFontHeight; } virtual void DestroyObjects( void ) = 0; virtual void SaveStates( void ) = 0; diff --git a/Sources/Plasma/PubUtilLib/plPipeline/plTextGenerator.cpp b/Sources/Plasma/PubUtilLib/plPipeline/plTextGenerator.cpp index 03afcc8c..430d644a 100644 --- a/Sources/Plasma/PubUtilLib/plPipeline/plTextGenerator.cpp +++ b/Sources/Plasma/PubUtilLib/plPipeline/plTextGenerator.cpp @@ -50,8 +50,8 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // // /////////////////////////////////////////////////////////////////////////////// -#include "hsWindows.h" -#include "hsTypes.h" + +#include "HeadSpin.h" #include "hsMatrix44.h" #include "pnKeyedObject/hsKeyedObject.h" #include "plTextGenerator.h" @@ -77,7 +77,7 @@ plTextGenerator::plTextGenerator() fHost = nil; } -plTextGenerator::plTextGenerator( plMipmap *host, UInt16 width, UInt16 height ) +plTextGenerator::plTextGenerator( plMipmap *host, uint16_t width, uint16_t height ) { fHost = nil; Attach( host, width, height ); @@ -96,9 +96,9 @@ plTextGenerator::~plTextGenerator() // Grab onto a plMipmap, suck the texture out of it and replace it with our // own. -void plTextGenerator::Attach( plMipmap *host, UInt16 width, UInt16 height ) +void plTextGenerator::Attach( plMipmap *host, uint16_t width, uint16_t height ) { - UInt16 textWidth, textHeight; + uint16_t textWidth, textHeight; hsAssert( fHost == nil, "Attempting to attach an already attached plTextGenerator" ); @@ -151,7 +151,7 @@ void plTextGenerator::Attach( plMipmap *host, UInt16 width, UInt16 height ) } /// Send ourselves a passive ref of the mipmap, so we get notified if and when it goes away - hsgResMgr::ResMgr()->AddViaNotify( fHost->GetKey(), TRACKED_NEW plGenRefMsg( GetKey(), plRefMsg::kOnCreate, 0, 0 ), plRefFlags::kActiveRef ); + hsgResMgr::ResMgr()->AddViaNotify( fHost->GetKey(), new plGenRefMsg( GetKey(), plRefMsg::kOnCreate, 0, 0 ), plRefFlags::kActiveRef ); #endif /// All done! } @@ -160,7 +160,7 @@ void plTextGenerator::Attach( plMipmap *host, UInt16 width, UInt16 height ) // OS-specific. Allocates a rectangular bitmap of the given dimensions that // the OS can draw text into. Returns a pointer to the pixels. -UInt32 *plTextGenerator::IAllocateOSSurface( UInt16 width, UInt16 height ) +uint32_t *plTextGenerator::IAllocateOSSurface( uint16_t width, uint16_t height ) { #if HS_BUILD_FOR_WIN32 @@ -201,7 +201,7 @@ UInt32 *plTextGenerator::IAllocateOSSurface( UInt16 width, UInt16 height ) SelectObject( fWinAlphaDC, fWinAlphaBitmap ); - return (UInt32 *)fWinRGBBits; + return (uint32_t *)fWinRGBBits; #endif } @@ -257,8 +257,8 @@ void plTextGenerator::IDestroyOSSurface( void ) void plTextGenerator::ClearToColor( hsColorRGBA &color ) { int i; - UInt32 *data = (UInt32 *)fHost->fImage; - UInt32 hexColor = color.ToARGB32(); + uint32_t *data = (uint32_t *)fHost->fImage; + uint32_t hexColor = color.ToARGB32(); #if HS_BUILD_FOR_WIN32 GdiFlush(); @@ -269,14 +269,14 @@ void plTextGenerator::ClearToColor( hsColorRGBA &color ) // Fill our alpha bitmap as well, since we use that too #if HS_BUILD_FOR_WIN32 - memset( fWinAlphaBits, (UInt8)( color.a * 255.f ), fHost->fWidth * fHost->fHeight ); + memset( fWinAlphaBits, (uint8_t)( color.a * 255.f ), fHost->fWidth * fHost->fHeight ); #endif } //// SetFont ////////////////////////////////////////////////////////////////// // OS-specific. Load the given font for drawing the text with. -void plTextGenerator::SetFont( const char *face, UInt16 size, hsBool antiAliasRGB ) +void plTextGenerator::SetFont( const char *face, uint16_t size, hsBool antiAliasRGB ) { #if HS_BUILD_FOR_WIN32 if( fWinFont != nil ) @@ -338,14 +338,14 @@ void plTextGenerator::SetTextColor( hsColorRGBA &color, hsBool blockRGB ) //// DrawString /////////////////////////////////////////////////////////////// -void plTextGenerator::DrawString( UInt16 x, UInt16 y, const char *text ) +void plTextGenerator::DrawString( uint16_t x, uint16_t y, const char *text ) { wchar_t *wText = hsStringToWString(text); DrawString(x,y,wText); delete [] wText; } -void plTextGenerator::DrawString( UInt16 x, UInt16 y, const wchar_t *text ) +void plTextGenerator::DrawString( uint16_t x, uint16_t y, const wchar_t *text ) { #if HS_BUILD_FOR_WIN32 @@ -357,14 +357,14 @@ void plTextGenerator::DrawString( UInt16 x, UInt16 y, const wchar_t *text ) //// DrawClippedString //////////////////////////////////////////////////////// -void plTextGenerator::DrawClippedString( Int16 x, Int16 y, const char *text, UInt16 width, UInt16 height ) +void plTextGenerator::DrawClippedString( int16_t x, int16_t y, const char *text, uint16_t width, uint16_t height ) { wchar_t *wText = hsStringToWString(text); DrawClippedString(x,y,wText,width,height); delete [] wText; } -void plTextGenerator::DrawClippedString( Int16 x, Int16 y, const wchar_t *text, UInt16 width, UInt16 height ) +void plTextGenerator::DrawClippedString( int16_t x, int16_t y, const wchar_t *text, uint16_t width, uint16_t height ) { #if HS_BUILD_FOR_WIN32 @@ -379,14 +379,14 @@ void plTextGenerator::DrawClippedString( Int16 x, Int16 y, const wchar_t *tex //// DrawClippedString //////////////////////////////////////////////////////// -void plTextGenerator::DrawClippedString( Int16 x, Int16 y, const char *text, UInt16 clipX, UInt16 clipY, UInt16 width, UInt16 height ) +void plTextGenerator::DrawClippedString( int16_t x, int16_t y, const char *text, uint16_t clipX, uint16_t clipY, uint16_t width, uint16_t height ) { wchar_t *wText = hsStringToWString(text); DrawClippedString(x,y,wText,clipX,clipY,width,height); delete [] wText; } -void plTextGenerator::DrawClippedString( Int16 x, Int16 y, const wchar_t *text, UInt16 clipX, UInt16 clipY, UInt16 width, UInt16 height ) +void plTextGenerator::DrawClippedString( int16_t x, int16_t y, const wchar_t *text, uint16_t clipX, uint16_t clipY, uint16_t width, uint16_t height ) { #if HS_BUILD_FOR_WIN32 @@ -401,14 +401,14 @@ void plTextGenerator::DrawClippedString( Int16 x, Int16 y, const wchar_t *tex //// DrawWrappedString //////////////////////////////////////////////////////// -void plTextGenerator::DrawWrappedString( UInt16 x, UInt16 y, const char *text, UInt16 width, UInt16 height ) +void plTextGenerator::DrawWrappedString( uint16_t x, uint16_t y, const char *text, uint16_t width, uint16_t height ) { wchar_t *wText = hsStringToWString(text); DrawWrappedString(x,y,wText,width,height); delete [] wText; } -void plTextGenerator::DrawWrappedString( UInt16 x, UInt16 y, const wchar_t *text, UInt16 width, UInt16 height ) +void plTextGenerator::DrawWrappedString( uint16_t x, uint16_t y, const wchar_t *text, uint16_t width, uint16_t height ) { #if HS_BUILD_FOR_WIN32 @@ -428,15 +428,15 @@ void plTextGenerator::DrawWrappedString( UInt16 x, UInt16 y, const wchar_t *t //// CalcStringWidth ////////////////////////////////////////////////////////// -UInt16 plTextGenerator::CalcStringWidth( const char *text, UInt16 *height ) +uint16_t plTextGenerator::CalcStringWidth( const char *text, uint16_t *height ) { wchar_t *wText = hsStringToWString(text); - UInt16 retVal = CalcStringWidth(wText,height); + uint16_t retVal = CalcStringWidth(wText,height); delete [] wText; return retVal; } -UInt16 plTextGenerator::CalcStringWidth( const wchar_t *text, UInt16 *height ) +uint16_t plTextGenerator::CalcStringWidth( const wchar_t *text, uint16_t *height ) { #if HS_BUILD_FOR_WIN32 @@ -444,22 +444,22 @@ UInt16 plTextGenerator::CalcStringWidth( const wchar_t *text, UInt16 *heigh ::GetTextExtentPoint32W( fWinRGBDC, text, wcslen( text ), &size ); if( height != nil ) - *height = (UInt16)size.cy; + *height = (uint16_t)size.cy; - return (UInt16)size.cx; + return (uint16_t)size.cx; #endif } //// CalcWrappedStringSize //////////////////////////////////////////////////// -void plTextGenerator::CalcWrappedStringSize( const char *text, UInt16 *width, UInt16 *height ) +void plTextGenerator::CalcWrappedStringSize( const char *text, uint16_t *width, uint16_t *height ) { wchar_t *wText = hsStringToWString(text); CalcWrappedStringSize(wText,width,height); delete [] wText; } -void plTextGenerator::CalcWrappedStringSize( const wchar_t *text, UInt16 *width, UInt16 *height ) +void plTextGenerator::CalcWrappedStringSize( const wchar_t *text, uint16_t *width, uint16_t *height ) { #if HS_BUILD_FOR_WIN32 @@ -468,15 +468,15 @@ void plTextGenerator::CalcWrappedStringSize( const wchar_t *text, UInt16 *wid ::DrawTextW( fWinRGBDC, text, wcslen( text ), &r, DT_TOP | DT_LEFT | DT_NOPREFIX | DT_WORDBREAK | DT_CALCRECT ); - *width = (UInt16)(r.right); + *width = (uint16_t)(r.right); if( height != nil ) - *height = (UInt16)r.bottom; + *height = (uint16_t)r.bottom; #endif } //// FillRect ///////////////////////////////////////////////////////////////// -void plTextGenerator::FillRect( UInt16 x, UInt16 y, UInt16 width, UInt16 height, hsColorRGBA &color ) +void plTextGenerator::FillRect( uint16_t x, uint16_t y, uint16_t width, uint16_t height, hsColorRGBA &color ) { #if HS_BUILD_FOR_WIN32 @@ -500,7 +500,7 @@ void plTextGenerator::FillRect( UInt16 x, UInt16 y, UInt16 width, UInt16 heig //// FrameRect //////////////////////////////////////////////////////////////// -void plTextGenerator::FrameRect( UInt16 x, UInt16 y, UInt16 width, UInt16 height, hsColorRGBA &color ) +void plTextGenerator::FrameRect( uint16_t x, uint16_t y, uint16_t width, uint16_t height, hsColorRGBA &color ) { #if HS_BUILD_FOR_WIN32 @@ -531,9 +531,9 @@ void plTextGenerator::FlushToHost( void ) GdiFlush(); // Now copy our alpha channel over. I hate the GDI - UInt32 i = fHost->fWidth * fHost->fHeight; - UInt32 *dest = fWinRGBBits; - UInt8 *src = fWinAlphaBits; + uint32_t i = fHost->fWidth * fHost->fHeight; + uint32_t *dest = fWinRGBBits; + uint8_t *src = fWinAlphaBits; /* while( i-- ) { @@ -559,14 +559,14 @@ void plTextGenerator::FlushToHost( void ) //// GetTextWidth/Height ////////////////////////////////////////////////////// -UInt16 plTextGenerator::GetTextWidth( void ) +uint16_t plTextGenerator::GetTextWidth( void ) { - return ( fHost != nil ) ? (UInt16)(fHost->fWidth) : 0; + return ( fHost != nil ) ? (uint16_t)(fHost->fWidth) : 0; } -UInt16 plTextGenerator::GetTextHeight( void ) +uint16_t plTextGenerator::GetTextHeight( void ) { - return ( fHost != nil ) ? (UInt16)(fHost->fHeight) : 0; + return ( fHost != nil ) ? (uint16_t)(fHost->fHeight) : 0; } //// GetLayerTransform //////////////////////////////////////////////////////// diff --git a/Sources/Plasma/PubUtilLib/plPipeline/plTextGenerator.h b/Sources/Plasma/PubUtilLib/plPipeline/plTextGenerator.h index c3b6f516..75921508 100644 --- a/Sources/Plasma/PubUtilLib/plPipeline/plTextGenerator.h +++ b/Sources/Plasma/PubUtilLib/plPipeline/plTextGenerator.h @@ -69,61 +69,61 @@ class plTextGenerator : public hsKeyedObject protected: plMipmap *fHost; - UInt16 fWidth, fHeight; + uint16_t fWidth, fHeight; #if HS_BUILD_FOR_WIN32 HDC fWinRGBDC; HBITMAP fWinRGBBitmap; HFONT fWinFont; - UInt32 *fWinRGBBits; + uint32_t *fWinRGBBits; HFONT fWinAlphaFont; HDC fWinAlphaDC; HBITMAP fWinAlphaBitmap; - UInt8 *fWinAlphaBits; + uint8_t *fWinAlphaBits; #endif - UInt32 *IAllocateOSSurface( UInt16 width, UInt16 height ); + uint32_t *IAllocateOSSurface( uint16_t width, uint16_t height ); void IDestroyOSSurface( void ); public: plTextGenerator(); - plTextGenerator( plMipmap *host, UInt16 width, UInt16 height ); + plTextGenerator( plMipmap *host, uint16_t width, uint16_t height ); virtual ~plTextGenerator(); - void Attach( plMipmap *host, UInt16 width, UInt16 height ); + void Attach( plMipmap *host, uint16_t width, uint16_t height ); void Detach( void ); /// Operations to perform on the text block void ClearToColor( hsColorRGBA &color ); - void SetFont( const char *face, UInt16 size, hsBool antiAliasRGB = true ); + void SetFont( const char *face, uint16_t size, hsBool antiAliasRGB = true ); void SetTextColor( hsColorRGBA &color, hsBool blockRGB = false ); - void DrawString( UInt16 x, UInt16 y, const char *text ); - void DrawString( UInt16 x, UInt16 y, const wchar_t *text ); - void DrawClippedString( Int16 x, Int16 y, const char *text, UInt16 width, UInt16 height ); - void DrawClippedString( Int16 x, Int16 y, const wchar_t *text, UInt16 width, UInt16 height ); - void DrawClippedString( Int16 x, Int16 y, const char *text, UInt16 clipX, UInt16 clipY, UInt16 width, UInt16 height ); - void DrawClippedString( Int16 x, Int16 y, const wchar_t *text, UInt16 clipX, UInt16 clipY, UInt16 width, UInt16 height ); - void DrawWrappedString( UInt16 x, UInt16 y, const char *text, UInt16 width, UInt16 height ); - void DrawWrappedString( UInt16 x, UInt16 y, const wchar_t *text, UInt16 width, UInt16 height ); - UInt16 CalcStringWidth( const char *text, UInt16 *height = nil ); - UInt16 CalcStringWidth( const wchar_t *text, UInt16 *height = nil ); - void CalcWrappedStringSize( const char *text, UInt16 *width, UInt16 *height ); - void CalcWrappedStringSize( const wchar_t *text, UInt16 *width, UInt16 *height ); - void FillRect( UInt16 x, UInt16 y, UInt16 width, UInt16 height, hsColorRGBA &color ); - void FrameRect( UInt16 x, UInt16 y, UInt16 width, UInt16 height, hsColorRGBA &color ); + void DrawString( uint16_t x, uint16_t y, const char *text ); + void DrawString( uint16_t x, uint16_t y, const wchar_t *text ); + void DrawClippedString( int16_t x, int16_t y, const char *text, uint16_t width, uint16_t height ); + void DrawClippedString( int16_t x, int16_t y, const wchar_t *text, uint16_t width, uint16_t height ); + void DrawClippedString( int16_t x, int16_t y, const char *text, uint16_t clipX, uint16_t clipY, uint16_t width, uint16_t height ); + void DrawClippedString( int16_t x, int16_t y, const wchar_t *text, uint16_t clipX, uint16_t clipY, uint16_t width, uint16_t height ); + void DrawWrappedString( uint16_t x, uint16_t y, const char *text, uint16_t width, uint16_t height ); + void DrawWrappedString( uint16_t x, uint16_t y, const wchar_t *text, uint16_t width, uint16_t height ); + uint16_t CalcStringWidth( const char *text, uint16_t *height = nil ); + uint16_t CalcStringWidth( const wchar_t *text, uint16_t *height = nil ); + void CalcWrappedStringSize( const char *text, uint16_t *width, uint16_t *height ); + void CalcWrappedStringSize( const wchar_t *text, uint16_t *width, uint16_t *height ); + void FillRect( uint16_t x, uint16_t y, uint16_t width, uint16_t height, hsColorRGBA &color ); + void FrameRect( uint16_t x, uint16_t y, uint16_t width, uint16_t height, hsColorRGBA &color ); void FlushToHost( void ); - UInt16 GetTextWidth( void ); - UInt16 GetTextHeight( void ); + uint16_t GetTextWidth( void ); + uint16_t GetTextHeight( void ); - UInt16 GetWidth( void ) { return fWidth; } - UInt16 GetHeight( void ) { return fHeight; } + uint16_t GetWidth( void ) { return fWidth; } + uint16_t GetHeight( void ) { return fHeight; } // Since the textGen can actually create a texture bigger than you were expecting, // you want to be able to apply a layer texture transform that will compensate. This diff --git a/Sources/Plasma/PubUtilLib/plPipeline/plTransitionMgr.cpp b/Sources/Plasma/PubUtilLib/plPipeline/plTransitionMgr.cpp index e8610efb..266b218a 100644 --- a/Sources/Plasma/PubUtilLib/plPipeline/plTransitionMgr.cpp +++ b/Sources/Plasma/PubUtilLib/plPipeline/plTransitionMgr.cpp @@ -52,8 +52,8 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // // ////////////////////////////////////////////////////////////////////////////// -#include "hsWindows.h" -#include "hsTypes.h" + +#include "HeadSpin.h" #include "plTransitionMgr.h" #include "plPlates.h" @@ -129,7 +129,7 @@ void plTransitionMgr::ICreatePlate( void ) plMipmap *ourMip = fEffectPlate->CreateMaterial( 16, 16, true ); for( y = 0; y < ourMip->GetHeight(); y++ ) { - UInt32 *pixels = ourMip->GetAddr32( 0, y ); + uint32_t *pixels = ourMip->GetAddr32( 0, y ); for( x = 0; x < ourMip->GetWidth(); x++ ) pixels[ x ] = 0xff000000; } @@ -139,7 +139,7 @@ void plTransitionMgr::ICreatePlate( void ) //// IStartFadeOut /////////////////////////////////////////////////////////// -void plTransitionMgr::IStartFadeOut( hsScalar lengthInSecs, UInt8 effect ) +void plTransitionMgr::IStartFadeOut( float lengthInSecs, uint8_t effect ) { fCurrentEffect = effect; // default - kFadeOut; fEffectLength = lengthInSecs; @@ -177,7 +177,7 @@ void plTransitionMgr::IStartFadeOut( hsScalar lengthInSecs, UInt8 effect ) //// IStartFadeIn //////////////////////////////////////////////////////////// -void plTransitionMgr::IStartFadeIn( hsScalar lengthInSecs, UInt8 effect ) +void plTransitionMgr::IStartFadeIn( float lengthInSecs, uint8_t effect ) { fCurrentEffect = effect; // default - kFadeIn; fEffectLength = lengthInSecs; @@ -265,17 +265,17 @@ hsBool plTransitionMgr::MsgReceive( plMessage* msg ) // So instead we don't start the clock until we get our first plTimeMsg. - fLastTime = (hsScalar)(time->DSeconds()); + fLastTime = (float)(time->DSeconds()); return false; } - fEffectLength -= (hsScalar)( time->DSeconds() - fLastTime );//*/time->DelSeconds(); + fEffectLength -= (float)( time->DSeconds() - fLastTime );//*/time->DelSeconds(); if( fEffectLength < 0 ) IStop(); else { // Grab the layer so we can set the opacity - fCurrOpacity += (hsScalar)(fOpacDelta * ( time->DSeconds() - fLastTime ));//*/time->DelSeconds(); + fCurrOpacity += (float)(fOpacDelta * ( time->DSeconds() - fLastTime ));//*/time->DelSeconds(); if( fEffectPlate == nil ) ICreatePlate(); @@ -290,7 +290,7 @@ hsBool plTransitionMgr::MsgReceive( plMessage* msg ) plgAudioSys::SetGlobalFadeVolume( 1.f - fCurrOpacity ); - fLastTime = (hsScalar)(time->DSeconds()); + fLastTime = (float)(time->DSeconds()); } return false; diff --git a/Sources/Plasma/PubUtilLib/plPipeline/plTransitionMgr.h b/Sources/Plasma/PubUtilLib/plPipeline/plTransitionMgr.h index f56f67f7..d6725d38 100644 --- a/Sources/Plasma/PubUtilLib/plPipeline/plTransitionMgr.h +++ b/Sources/Plasma/PubUtilLib/plPipeline/plTransitionMgr.h @@ -48,10 +48,10 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #ifndef _plTransitionMgr_h #define _plTransitionMgr_h -#include "hsTypes.h" +#include "HeadSpin.h" #include "hsTemplates.h" #include "pnKeyedObject/hsKeyedObject.h" -#include "hsUtils.h" + //// Class Definition //////////////////////////////////////////////////////// @@ -74,13 +74,13 @@ class plTransitionMgr : public hsKeyedObject kTransitionFadeOut }; - UInt8 fCurrentEffect; + uint8_t fCurrentEffect; hsBool fRegisteredForTime, fHoldAtEnd, fPlaying, fNoSoundFade; - hsScalar fEffectLength, fCurrOpacity, fOpacDelta; - hsScalar fLastTime; + float fEffectLength, fCurrOpacity, fOpacDelta; + float fLastTime; - void IStartFadeIn( hsScalar lengthInSecs, UInt8 effect = kFadeIn ); - void IStartFadeOut( hsScalar lengthInSecs, UInt8 effect = kFadeOut ); + void IStartFadeIn( float lengthInSecs, uint8_t effect = kFadeIn ); + void IStartFadeOut( float lengthInSecs, uint8_t effect = kFadeOut ); void ICreatePlate( void ); diff --git a/Sources/Plasma/PubUtilLib/plPipeline/plVertCoder.cpp b/Sources/Plasma/PubUtilLib/plPipeline/plVertCoder.cpp index 43e3485c..0a81b485 100644 --- a/Sources/Plasma/PubUtilLib/plPipeline/plVertCoder.cpp +++ b/Sources/Plasma/PubUtilLib/plPipeline/plVertCoder.cpp @@ -40,23 +40,23 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "plVertCoder.h" #include "hsStream.h" - +#include #include "plGBufferGroup.h" -const hsScalar kPosQuantum = 1.f / hsScalar(1 << 10); -const hsScalar kWeightQuantum = 1.f / hsScalar(1 << 15); -const hsScalar kUVWQuantum = 1.f / hsScalar(1 << 16); +const float kPosQuantum = 1.f / float(1 << 10); +const float kWeightQuantum = 1.f / float(1 << 15); +const float kUVWQuantum = 1.f / float(1 << 16); -UInt32 plVertCoder::fCodedVerts = 0; -UInt32 plVertCoder::fCodedBytes = 0; -UInt32 plVertCoder::fRawBytes = 0; -UInt32 plVertCoder::fSkippedBytes = 0; +uint32_t plVertCoder::fCodedVerts = 0; +uint32_t plVertCoder::fCodedBytes = 0; +uint32_t plVertCoder::fRawBytes = 0; +uint32_t plVertCoder::fSkippedBytes = 0; -static const hsScalar kQuanta[plVertCoder::kNumFloatFields] = +static const float kQuanta[plVertCoder::kNumFloatFields] = { kPosQuantum, kWeightQuantum, @@ -73,24 +73,24 @@ static const hsScalar kQuanta[plVertCoder::kNumFloatFields] = }; -inline void plVertCoder::ICountFloats(const UInt8* src, UInt16 maxCnt, const hsScalar quant, const UInt32 stride, - hsScalar& lo, hsBool &allSame, UInt16& count) +inline void plVertCoder::ICountFloats(const uint8_t* src, uint16_t maxCnt, const float quant, const uint32_t stride, + float& lo, hsBool &allSame, uint16_t& count) { - lo = *(hsScalar*)src; + lo = *(float*)src; lo = floor(lo / quant + 0.5f) * quant; allSame = false; - hsScalar hi = lo; + float hi = lo; count = 1; - const hsScalar maxRange = hsScalar(UInt16(0xffff)) * quant; + const float maxRange = float(uint16_t(0xffff)) * quant; src += stride; maxCnt--; while( maxCnt-- ) { - hsScalar val = *(hsScalar*)src; + float val = *(float*)src; val = floor(val / quant + 0.5f) * quant; if( val < lo ) { @@ -110,36 +110,36 @@ inline void plVertCoder::ICountFloats(const UInt8* src, UInt16 maxCnt, const hsS allSame = (lo == hi); } -static inline void IWriteFloat(hsStream* s, const UInt8*& src, const hsScalar offset, const hsScalar quantum) +static inline void IWriteFloat(hsStream* s, const uint8_t*& src, const float offset, const float quantum) { float fval = *(float*)src; fval -= offset; fval /= quantum; -// hsAssert(fval < hsScalar(UInt16(0xffff)), "Bad offset?"); +// hsAssert(fval < float(uint16_t(0xffff)), "Bad offset?"); - const UInt16 ival = UInt16(floor(fval + 0.5f)); + const uint16_t ival = uint16_t(floor(fval + 0.5f)); s->WriteLE16(ival); src += 4; } -static inline void IReadFloat(hsStream* s, UInt8*& dst, const hsScalar offset, const hsScalar quantum) +static inline void IReadFloat(hsStream* s, uint8_t*& dst, const float offset, const float quantum) { - const UInt16 ival = s->ReadLE16(); + const uint16_t ival = s->ReadLE16(); float fval = float(ival) * quantum; fval += offset; - hsScalar* val = (hsScalar*)dst; + float* val = (float*)dst; *val = fval; dst += 4; } -inline void plVertCoder::IEncodeFloat(hsStream* s, const UInt32 vertsLeft, const int field, const int chan, const UInt8*& src, const UInt32 stride) +inline void plVertCoder::IEncodeFloat(hsStream* s, const uint32_t vertsLeft, const int field, const int chan, const uint8_t*& src, const uint32_t stride) { if( !fFloats[field][chan].fCount ) { - ICountFloats(src, (UInt16)vertsLeft, kQuanta[field], stride, fFloats[field][chan].fOffset, fFloats[field][chan].fAllSame, fFloats[field][chan].fCount); + ICountFloats(src, (uint16_t)vertsLeft, kQuanta[field], stride, fFloats[field][chan].fOffset, fFloats[field][chan].fAllSame, fFloats[field][chan].fCount); s->WriteLEScalar(fFloats[field][chan].fOffset); s->WriteBool(fFloats[field][chan].fAllSame); @@ -154,7 +154,7 @@ inline void plVertCoder::IEncodeFloat(hsStream* s, const UInt32 vertsLeft, const fFloats[field][chan].fCount--; } -inline void plVertCoder::IDecodeFloat(hsStream* s, const int field, const int chan, UInt8*& dst, const UInt32 stride) +inline void plVertCoder::IDecodeFloat(hsStream* s, const int field, const int chan, uint8_t*& dst, const uint32_t stride) { if( !fFloats[field][chan].fCount ) { @@ -167,57 +167,57 @@ inline void plVertCoder::IDecodeFloat(hsStream* s, const int field, const int ch IReadFloat(s, dst, fFloats[field][chan].fOffset, kQuanta[field]); else { - *((hsScalar*)dst) = fFloats[field][chan].fOffset; + *((float*)dst) = fFloats[field][chan].fOffset; dst += 4; } fFloats[field][chan].fCount--; } -static inline int INumWeights(const UInt8 format) +static inline int INumWeights(const uint8_t format) { return (format & plGBufferGroup::kSkinWeightMask) >> 4; } -static const hsScalar kNormalScale(Int16(0x7fff)); -static const hsScalar kInvNormalScale(1.f / kNormalScale); +static const float kNormalScale(int16_t(0x7fff)); +static const float kInvNormalScale(1.f / kNormalScale); -inline void plVertCoder::IEncodeNormal(hsStream* s, const UInt8*& src, const UInt32 stride) +inline void plVertCoder::IEncodeNormal(hsStream* s, const uint8_t*& src, const uint32_t stride) { - hsScalar x = *(hsScalar*)src; - s->WriteByte((UInt8)((x / 2.f + .5f) * 255.9f)); + float x = *(float*)src; + s->WriteByte((uint8_t)((x / 2.f + .5f) * 255.9f)); src += 4; - x = *(hsScalar*)src; - s->WriteByte((UInt8)((x / 2.f + .5f) * 255.9f)); + x = *(float*)src; + s->WriteByte((uint8_t)((x / 2.f + .5f) * 255.9f)); src += 4; - x = *(hsScalar*)src; - s->WriteByte((UInt8)((x / 2.f + .5f) * 255.9f)); + x = *(float*)src; + s->WriteByte((uint8_t)((x / 2.f + .5f) * 255.9f)); src += 4; } -inline void plVertCoder::IDecodeNormal(hsStream* s, UInt8*& dst, const UInt32 stride) +inline void plVertCoder::IDecodeNormal(hsStream* s, uint8_t*& dst, const uint32_t stride) { - UInt8 ix = s->ReadByte(); - hsScalar* x = (hsScalar*)dst; + uint8_t ix = s->ReadByte(); + float* x = (float*)dst; *x = (ix / 255.9f - .5f) * 2.f; dst += 4; ix = s->ReadByte(); - x = (hsScalar*)dst; + x = (float*)dst; *x = (ix / 255.9f - .5f) * 2.f; dst += 4; ix = s->ReadByte(); - x = (hsScalar*)dst; + x = (float*)dst; *x = (ix / 255.9f - .5f) * 2.f; dst += 4; } -inline void plVertCoder::ICountBytes(const UInt32 vertsLeft, const UInt8* src, const UInt32 stride, UInt16& len, UInt8& same) +inline void plVertCoder::ICountBytes(const uint32_t vertsLeft, const uint8_t* src, const uint32_t stride, uint16_t& len, uint8_t& same) { // We want to run length encode this. So we're looking here for either // the number of consecutive bytes of the same value, @@ -228,7 +228,7 @@ inline void plVertCoder::ICountBytes(const UInt32 vertsLeft, const UInt8* src, c if( vertsLeft < 4 ) { - len = (UInt16)vertsLeft; + len = (uint16_t)vertsLeft; same = false; return; @@ -268,19 +268,19 @@ inline void plVertCoder::ICountBytes(const UInt32 vertsLeft, const UInt8* src, c return; } - len = (UInt16)vertsLeft; + len = (uint16_t)vertsLeft; return; } -static const UInt16 kSameMask(0x8000); +static const uint16_t kSameMask(0x8000); -inline void plVertCoder::IEncodeByte(hsStream* s, const int chan, const UInt32 vertsLeft, const UInt8*& src, const UInt32 stride) +inline void plVertCoder::IEncodeByte(hsStream* s, const int chan, const uint32_t vertsLeft, const uint8_t*& src, const uint32_t stride) { if( !fColors[chan].fCount ) { ICountBytes(vertsLeft, src, stride, fColors[chan].fCount, fColors[chan].fSame); - UInt16 cnt = fColors[chan].fCount; + uint16_t cnt = fColors[chan].fCount; if( fColors[chan].fSame ) cnt |= kSameMask; s->WriteLE16(cnt); @@ -296,11 +296,11 @@ inline void plVertCoder::IEncodeByte(hsStream* s, const int chan, const UInt32 v fColors[chan].fCount--; } -inline void plVertCoder::IDecodeByte(hsStream* s, const int chan, UInt8*& dst, const UInt32 stride) +inline void plVertCoder::IDecodeByte(hsStream* s, const int chan, uint8_t*& dst, const uint32_t stride) { if( !fColors[chan].fCount ) { - UInt16 cnt = s->ReadLE16(); + uint16_t cnt = s->ReadLE16(); if( cnt & kSameMask ) { fColors[chan].fSame = true; @@ -323,7 +323,7 @@ inline void plVertCoder::IDecodeByte(hsStream* s, const int chan, UInt8*& dst, c fColors[chan].fCount--; } -inline void plVertCoder::IEncodeColor(hsStream* s, const UInt32 vertsLeft, const UInt8*& src, const UInt32 stride) +inline void plVertCoder::IEncodeColor(hsStream* s, const uint32_t vertsLeft, const uint8_t*& src, const uint32_t stride) { IEncodeByte(s, 0, vertsLeft, src, stride); IEncodeByte(s, 1, vertsLeft, src, stride); @@ -331,7 +331,7 @@ inline void plVertCoder::IEncodeColor(hsStream* s, const UInt32 vertsLeft, const IEncodeByte(s, 3, vertsLeft, src, stride); } -inline void plVertCoder::IDecodeColor(hsStream* s, UInt8*& dst, const UInt32 stride) +inline void plVertCoder::IDecodeColor(hsStream* s, uint8_t*& dst, const uint32_t stride) { IDecodeByte(s, 0, dst, stride); IDecodeByte(s, 1, dst, stride); @@ -339,7 +339,7 @@ inline void plVertCoder::IDecodeColor(hsStream* s, UInt8*& dst, const UInt32 str IDecodeByte(s, 3, dst, stride); } -inline void plVertCoder::IEncode(hsStream* s, const UInt32 vertsLeft, const UInt8*& src, const UInt32 stride, const UInt8 format) +inline void plVertCoder::IEncode(hsStream* s, const uint32_t vertsLeft, const uint8_t*& src, const uint32_t stride, const uint8_t format) { IEncodeFloat(s, vertsLeft, kPosition, 0, src, stride); IEncodeFloat(s, vertsLeft, kPosition, 1, src, stride); @@ -355,7 +355,7 @@ inline void plVertCoder::IEncode(hsStream* s, const UInt32 vertsLeft, const UInt if( format & plGBufferGroup::kSkinIndices ) { - const UInt32 idx = *(UInt32*)src; + const uint32_t idx = *(uint32_t*)src; s->WriteLE32(idx); src += 4; } @@ -378,7 +378,7 @@ inline void plVertCoder::IEncode(hsStream* s, const UInt32 vertsLeft, const UInt } } -inline void plVertCoder::IDecode(hsStream* s, UInt8*& dst, const UInt32 stride, const UInt8 format) +inline void plVertCoder::IDecode(hsStream* s, uint8_t*& dst, const uint32_t stride, const uint8_t format) { IDecodeFloat(s, kPosition, 0, dst, stride); IDecodeFloat(s, kPosition, 1, dst, stride); @@ -394,7 +394,7 @@ inline void plVertCoder::IDecode(hsStream* s, UInt8*& dst, const UInt32 stride, if( format & plGBufferGroup::kSkinIndices ) { - UInt32* idx = (UInt32*)dst; + uint32_t* idx = (uint32_t*)dst; *idx = s->ReadLE32(); dst += 4; } @@ -405,7 +405,7 @@ inline void plVertCoder::IDecode(hsStream* s, UInt8*& dst, const UInt32 stride, IDecodeColor(s, dst, stride); // COLOR2 - UInt32* trash = (UInt32*)dst; + uint32_t* trash = (uint32_t*)dst; *trash = 0; dst += 4; @@ -419,7 +419,7 @@ inline void plVertCoder::IDecode(hsStream* s, UInt8*& dst, const UInt32 stride, } } -void plVertCoder::Read(hsStream* s, UInt8* dst, const UInt8 format, const UInt32 stride, const UInt16 numVerts) +void plVertCoder::Read(hsStream* s, uint8_t* dst, const uint8_t format, const uint32_t stride, const uint16_t numVerts) { Clear(); @@ -429,11 +429,11 @@ void plVertCoder::Read(hsStream* s, UInt8* dst, const UInt8 format, const UInt32 } -void plVertCoder::Write(hsStream* s, const UInt8* src, const UInt8 format, const UInt32 stride, const UInt16 numVerts) +void plVertCoder::Write(hsStream* s, const uint8_t* src, const uint8_t format, const uint32_t stride, const uint16_t numVerts) { Clear(); - UInt32 streamStart = s->GetPosition(); + uint32_t streamStart = s->GetPosition(); int numLeft = numVerts; while( numLeft ) diff --git a/Sources/Plasma/PubUtilLib/plPipeline/plVertCoder.h b/Sources/Plasma/PubUtilLib/plPipeline/plVertCoder.h index 5206155c..b6b91d17 100644 --- a/Sources/Plasma/PubUtilLib/plPipeline/plVertCoder.h +++ b/Sources/Plasma/PubUtilLib/plPipeline/plVertCoder.h @@ -60,43 +60,43 @@ protected: class FloatCode { public: - hsScalar fOffset; + float fOffset; hsBool fAllSame; - UInt16 fCount; + uint16_t fCount; }; FloatCode fFloats[kNumFloatFields][3]; - class ByteCode + class byteCode { public: - UInt16 fCount; - UInt8 fVal; - UInt8 fSame; + uint16_t fCount; + uint8_t fVal; + uint8_t fSame; }; - ByteCode fColors[4]; + byteCode fColors[4]; - static UInt32 fCodedVerts; - static UInt32 fCodedBytes; - static UInt32 fRawBytes; - static UInt32 fSkippedBytes; + static uint32_t fCodedVerts; + static uint32_t fCodedBytes; + static uint32_t fRawBytes; + static uint32_t fSkippedBytes; - inline void ICountFloats(const UInt8* src, UInt16 maxCnt, const hsScalar quant, const UInt32 stride, hsScalar& lo, hsBool& allSame, UInt16& count); - inline void IEncodeFloat(hsStream* s, const UInt32 vertsLeft, const int field, const int chan, const UInt8*& src, const UInt32 stride); - inline void IDecodeFloat(hsStream* s, const int field, const int chan, UInt8*& dst, const UInt32 stride); + inline void ICountFloats(const uint8_t* src, uint16_t maxCnt, const float quant, const uint32_t stride, float& lo, hsBool& allSame, uint16_t& count); + inline void IEncodeFloat(hsStream* s, const uint32_t vertsLeft, const int field, const int chan, const uint8_t*& src, const uint32_t stride); + inline void IDecodeFloat(hsStream* s, const int field, const int chan, uint8_t*& dst, const uint32_t stride); - inline void IEncodeNormal(hsStream* s, const UInt8*& src, const UInt32 stride); - inline void IDecodeNormal(hsStream* s, UInt8*& dst, const UInt32 stride); + inline void IEncodeNormal(hsStream* s, const uint8_t*& src, const uint32_t stride); + inline void IDecodeNormal(hsStream* s, uint8_t*& dst, const uint32_t stride); - inline void ICountBytes(const UInt32 vertsLeft, const UInt8* src, const UInt32 stride, UInt16& len, UInt8& same); - inline void IEncodeByte(hsStream* s, const int chan, const UInt32 vertsLeft, const UInt8*& src, const UInt32 stride); - inline void IDecodeByte(hsStream* s, const int chan, UInt8*& dst, const UInt32 stride); - inline void IEncodeColor(hsStream* s, const UInt32 vertsLeft, const UInt8*& src, const UInt32 stride); - inline void IDecodeColor(hsStream* s, UInt8*& dst, const UInt32 stride); + inline void ICountBytes(const uint32_t vertsLeft, const uint8_t* src, const uint32_t stride, uint16_t& len, uint8_t& same); + inline void IEncodeByte(hsStream* s, const int chan, const uint32_t vertsLeft, const uint8_t*& src, const uint32_t stride); + inline void IDecodeByte(hsStream* s, const int chan, uint8_t*& dst, const uint32_t stride); + inline void IEncodeColor(hsStream* s, const uint32_t vertsLeft, const uint8_t*& src, const uint32_t stride); + inline void IDecodeColor(hsStream* s, uint8_t*& dst, const uint32_t stride); - inline void IEncode(hsStream* s, const UInt32 vertsLeft, const UInt8*& src, const UInt32 stride, const UInt8 format); - inline void IDecode(hsStream* s, UInt8*& dst, const UInt32 stride, const UInt8 format); + inline void IEncode(hsStream* s, const uint32_t vertsLeft, const uint8_t*& src, const uint32_t stride, const uint8_t format); + inline void IDecode(hsStream* s, uint8_t*& dst, const uint32_t stride, const uint8_t format); public: plVertCoder(); @@ -104,19 +104,19 @@ public: void Clear(); - void Read(hsStream* s, UInt8* dst, const UInt8 format, const UInt32 stride, const UInt16 numVerts); - void Write(hsStream* s, const UInt8* src, const UInt8 format, const UInt32 stride, const UInt16 numVerts); + void Read(hsStream* s, uint8_t* dst, const uint8_t format, const uint32_t stride, const uint16_t numVerts); + void Write(hsStream* s, const uint8_t* src, const uint8_t format, const uint32_t stride, const uint16_t numVerts); static void ClearAverage() { fCodedVerts = 0; fCodedBytes = 0; fRawBytes = 0; fSkippedBytes = 0; } - static UInt32 CodedBytes() { return fCodedBytes; } - static UInt32 RawBytes() { return fRawBytes; } - static UInt32 CodedVerts() { return fCodedVerts; } + static uint32_t CodedBytes() { return fCodedBytes; } + static uint32_t RawBytes() { return fRawBytes; } + static uint32_t CodedVerts() { return fCodedVerts; } static float AverageCodedVertSize() { return fCodedVerts ? float(fCodedBytes) / float(fCodedVerts) : 0; } static float AverageRawVertSize() { return fCodedVerts ? float(fRawBytes) / float(fCodedVerts) : 0; } - static UInt32 SkippedBytes() { return fSkippedBytes; } - static void AddSkippedBytes(UInt32 f) { fSkippedBytes += f; } + static uint32_t SkippedBytes() { return fSkippedBytes; } + static void AddSkippedBytes(uint32_t f) { fSkippedBytes += f; } }; #endif // plVertCoder_inc diff --git a/Sources/Plasma/PubUtilLib/plProgressMgr/plProgressMgr.cpp b/Sources/Plasma/PubUtilLib/plProgressMgr/plProgressMgr.cpp index 2871d17d..d874a55c 100644 --- a/Sources/Plasma/PubUtilLib/plProgressMgr/plProgressMgr.cpp +++ b/Sources/Plasma/PubUtilLib/plProgressMgr/plProgressMgr.cpp @@ -50,7 +50,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com ////////////////////////////////////////////////////////////////////////////// #include -#include "hsTypes.h" +#include "HeadSpin.h" #include "plProgressMgr.h" #include "hsTimer.h" @@ -87,7 +87,7 @@ plProgressMgr::plProgressMgr() // Fill array with pre-computed loading frame IDs for (int i=0; i < LOADING_RES_COUNT; i++) { - char* frameID = TRACKED_NEW char[128]; + char* frameID = new char[128]; sprintf(frameID, LOADING_RES, i); fImageRotation[i] = frameID; } @@ -107,17 +107,17 @@ plProgressMgr::~plProgressMgr() //// RegisterOperation /////////////////////////////////////////////////////// -plOperationProgress* plProgressMgr::RegisterOperation(hsScalar length, const char *title, StaticText staticTextType, bool isRetry, bool alwaysDrawText) +plOperationProgress* plProgressMgr::RegisterOperation(float length, const char *title, StaticText staticTextType, bool isRetry, bool alwaysDrawText) { return IRegisterOperation(length, title, staticTextType, isRetry, false, alwaysDrawText); } -plOperationProgress* plProgressMgr::RegisterOverallOperation(hsScalar length, const char *title, StaticText staticTextType, bool alwaysDrawText) +plOperationProgress* plProgressMgr::RegisterOverallOperation(float length, const char *title, StaticText staticTextType, bool alwaysDrawText) { return IRegisterOperation(length, title, staticTextType, false, true, alwaysDrawText); } -plOperationProgress* plProgressMgr::IRegisterOperation(hsScalar length, const char *title, StaticText staticTextType, bool isRetry, bool isOverall, bool alwaysDrawText) +plOperationProgress* plProgressMgr::IRegisterOperation(float length, const char *title, StaticText staticTextType, bool isRetry, bool isOverall, bool alwaysDrawText) { if (fOperations == nil) { @@ -125,7 +125,7 @@ plOperationProgress* plProgressMgr::IRegisterOperation(hsScalar length, const ch Activate(); } - plOperationProgress *op = TRACKED_NEW plOperationProgress( length ); + plOperationProgress *op = new plOperationProgress( length ); op->SetTitle( title ); @@ -259,7 +259,7 @@ const char* plProgressMgr::GetStaticTextID(StaticText staticTextType) //// plOperationProgress //////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////// -plOperationProgress::plOperationProgress( hsScalar length ) : +plOperationProgress::plOperationProgress( float length ) : fMax(length), fValue(0), fNext(nil), @@ -292,15 +292,15 @@ void plOperationProgress::IUpdateStats() else elapsed = fStartTime - curTime; - hsScalar progress = GetProgress(); + float progress = GetProgress(); if (elapsed > 0) - fAmtPerSec = progress / hsScalar(elapsed); + fAmtPerSec = progress / float(elapsed); else fAmtPerSec = 0; - fElapsedSecs = (UInt32)elapsed; + fElapsedSecs = (uint32_t)elapsed; if (progress < fMax) - fRemainingSecs = (UInt32)((fMax - progress) / fAmtPerSec); + fRemainingSecs = (uint32_t)((fMax - progress) / fAmtPerSec); else fRemainingSecs = 0; } @@ -328,7 +328,7 @@ void plOperationProgress::IChildUpdateEnd(plOperationProgress* child) //// Increment /////////////////////////////////////////////////////////////// -void plOperationProgress::Increment( hsScalar byHowMuch ) +void plOperationProgress::Increment( float byHowMuch ) { fValue += byHowMuch; if( fValue > fMax ) @@ -340,7 +340,7 @@ void plOperationProgress::Increment( hsScalar byHowMuch ) //// SetHowMuch ////////////////////////////////////////////////////////////// -void plOperationProgress::SetHowMuch( hsScalar howMuch ) +void plOperationProgress::SetHowMuch( float howMuch ) { fValue = howMuch; if( fValue > fMax ) @@ -374,7 +374,7 @@ void plOperationProgress::SetTitle( const char *text ) //// SetLength /////////////////////////////////////////////////////////////// -void plOperationProgress::SetLength( hsScalar length ) +void plOperationProgress::SetLength( float length ) { fMax = length; if( fValue > fMax ) diff --git a/Sources/Plasma/PubUtilLib/plProgressMgr/plProgressMgr.h b/Sources/Plasma/PubUtilLib/plProgressMgr/plProgressMgr.h index 5b156aeb..061d4a77 100644 --- a/Sources/Plasma/PubUtilLib/plProgressMgr/plProgressMgr.h +++ b/Sources/Plasma/PubUtilLib/plProgressMgr/plProgressMgr.h @@ -55,8 +55,8 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #ifndef _plProgressMgr_h #define _plProgressMgr_h -#include "hsTypes.h" -#include "hsUtils.h" +#include "HeadSpin.h" + class plPipeline; class plPlate; @@ -73,14 +73,14 @@ class plOperationProgress protected: - hsScalar fValue, fMax; + float fValue, fMax; char fStatusText[ 256 ]; char fTitle[ 256 ]; - UInt32 fContext; + uint32_t fContext; double fStartTime; - UInt32 fElapsedSecs, fRemainingSecs; - hsScalar fAmtPerSec; + uint32_t fElapsedSecs, fRemainingSecs; + float fAmtPerSec; enum Flags { @@ -93,7 +93,7 @@ class plOperationProgress kOverall = 0x40, kAlwaysDrawText = 0x80, }; - UInt8 fFlags; + uint8_t fFlags; plOperationProgress *fNext, *fBack; @@ -103,29 +103,29 @@ class plOperationProgress void IChildUpdateBegin(plOperationProgress* child); void IChildUpdateEnd(plOperationProgress* child); - plOperationProgress( hsScalar length ); + plOperationProgress( float length ); public: ~plOperationProgress(); - hsScalar GetMax( void ) const { return fMax; } - hsScalar GetProgress( void ) const { return fValue; } + float GetMax( void ) const { return fMax; } + float GetProgress( void ) const { return fValue; } const char * GetTitle( void ) const { return fTitle; } const char * GetStatusText( void ) const { return fStatusText; } - UInt32 GetContext( void ) const { return fContext; } - UInt32 GetElapsedSecs() { return fElapsedSecs; } - UInt32 GetRemainingSecs() { return fRemainingSecs; } - hsScalar GetAmtPerSec() { return fAmtPerSec; } + uint32_t GetContext( void ) const { return fContext; } + uint32_t GetElapsedSecs() { return fElapsedSecs; } + uint32_t GetRemainingSecs() { return fRemainingSecs; } + float GetAmtPerSec() { return fAmtPerSec; } // Adds on to current value - void Increment( hsScalar byHowMuch ); + void Increment( float byHowMuch ); // Sets current value - void SetHowMuch( hsScalar byHowMuch ); + void SetHowMuch( float byHowMuch ); // Set the length - void SetLength( hsScalar length ); + void SetLength( float length ); // Sets the display text above the bar (nil for nothing) void SetStatusText( const char *text ); @@ -134,7 +134,7 @@ class plOperationProgress void SetTitle( const char *title ); // Application data - void SetContext( UInt32 context ) { fContext = context;} + void SetContext( uint32_t context ) { fContext = context;} hsBool IsDone( void ) { return ( fValue < fMax ) ? false : true; } @@ -215,7 +215,7 @@ class plProgressMgr void IUpdateFlags(plOperationProgress* progress); - plOperationProgress* IRegisterOperation(hsScalar length, const char *title, StaticText staticTextType, bool isRetry, bool isOverall, bool alwaysDrawText); + plOperationProgress* IRegisterOperation(float length, const char *title, StaticText staticTextType, bool isRetry, bool isOverall, bool alwaysDrawText); // Called by the operation void IUnregisterOperation(plOperationProgress* op); @@ -234,8 +234,8 @@ class plProgressMgr virtual void Draw( plPipeline *p ) { } - plOperationProgress* RegisterOperation(hsScalar length, const char *title = nil, StaticText staticTextType = kNone, bool isRetry = false, bool alwaysDrawText = false); - plOperationProgress* RegisterOverallOperation(hsScalar length, const char *title = nil, StaticText staticTextType = kNone, bool alwaysDrawText = false); + plOperationProgress* RegisterOperation(float length, const char *title = nil, StaticText staticTextType = kNone, bool isRetry = false, bool alwaysDrawText = false); + plOperationProgress* RegisterOverallOperation(float length, const char *title = nil, StaticText staticTextType = kNone, bool alwaysDrawText = false); plProgressMgrCallbackProc SetCallbackProc( plProgressMgrCallbackProc proc ); diff --git a/Sources/Plasma/PubUtilLib/plResMgr/plBSDiffBuffer.cpp b/Sources/Plasma/PubUtilLib/plResMgr/plBSDiffBuffer.cpp index a3c89553..c006c56c 100644 --- a/Sources/Plasma/PubUtilLib/plResMgr/plBSDiffBuffer.cpp +++ b/Sources/Plasma/PubUtilLib/plResMgr/plBSDiffBuffer.cpp @@ -51,9 +51,9 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // ////////////////////////////////////////////////////////////////////////////// -#include "hsTypes.h" +#include "HeadSpin.h" #include "plBSDiffBuffer.h" -#include "hsUtils.h" + #include "hsStream.h" #define plBSDiffBuffer_MIN(x,y) (((x)<(y)) ? (x) : (y)) @@ -68,7 +68,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // buffer, but if you do, it'll help this class do some internal space // optimization. -plBSDiffBuffer::plBSDiffBuffer( UInt32 newLength, UInt32 oldLength ) +plBSDiffBuffer::plBSDiffBuffer( uint32_t newLength, uint32_t oldLength ) : fNewLength( newLength ) , fPatchLength( 0 ) { @@ -82,7 +82,7 @@ plBSDiffBuffer::plBSDiffBuffer( UInt32 newLength, UInt32 oldLength ) // will be copied, so you don't need to keep it around after you construct // this object. -plBSDiffBuffer::plBSDiffBuffer( void *buffer, UInt32 length ) +plBSDiffBuffer::plBSDiffBuffer( void *buffer, uint32_t length ) : fNewLength( 0 ) , fPatchLength( 0 ) , fPatchBuffer( nil ) @@ -91,7 +91,7 @@ plBSDiffBuffer::plBSDiffBuffer( void *buffer, UInt32 length ) if (!buffer || length < 32) hsAssert(false, "Corrupt Patch Buffer!"); - if((fPatchBuffer=TRACKED_NEW unsigned char[length+1])!=nil) + if((fPatchBuffer=new unsigned char[length+1])!=nil) { fPatchLength = length; memcpy(fPatchBuffer, buffer, fPatchLength); @@ -111,21 +111,21 @@ plBSDiffBuffer::~plBSDiffBuffer() //// Diff ///////////////////////////////////////////////////////////////////// // Diff() creates the diff buffer from the new and old. -UInt32 plBSDiffBuffer::Diff( UInt32 oldLength, void *oldBuffer, UInt32 newLength, void *newBuffer ) +uint32_t plBSDiffBuffer::Diff( uint32_t oldLength, void *oldBuffer, uint32_t newLength, void *newBuffer ) { hsAssert( fWriting, "Trying to Add() to a difference buffer that's reading" ); - Int32 *I,*V; + int32_t *I,*V; - Int32 scan,pos,len; - Int32 lastscan,lastpos,lastoffset; - Int32 oldscore,scsc; + int32_t scan,pos,len; + int32_t lastscan,lastpos,lastoffset; + int32_t oldscore,scsc; - Int32 s,Sf,lenf,Sb,lenb; - Int32 overlap,Ss,lens; - Int32 i; + int32_t s,Sf,lenf,Sb,lenb; + int32_t overlap,Ss,lens; + int32_t i; - UInt32 cblen,dblen,eblen; + uint32_t cblen,dblen,eblen; unsigned char *oldbuf, *newbuf; unsigned char *cb,*db,*eb; @@ -142,8 +142,8 @@ UInt32 plBSDiffBuffer::Diff( UInt32 oldLength, void *oldBuffer, UInt32 newLength oldbuf = (unsigned char *)oldBuffer; newbuf = (unsigned char *)newBuffer; - if(((I=TRACKED_NEW Int32[oldLength+1])==nil) || - ((V=TRACKED_NEW Int32[oldLength+1])==nil)) + if(((I=new int32_t[oldLength+1])==nil) || + ((V=new int32_t[oldLength+1])==nil)) { delete[] I; delete[] V; @@ -157,9 +157,9 @@ UInt32 plBSDiffBuffer::Diff( UInt32 oldLength, void *oldBuffer, UInt32 newLength /* * These could probably be smaller, especially cb. */ - if(((cb=TRACKED_NEW unsigned char[newLength+1])==nil) || - ((db=TRACKED_NEW unsigned char[newLength+1])==nil) || - ((eb=TRACKED_NEW unsigned char[newLength+1])==nil)) + if(((cb=new unsigned char[newLength+1])==nil) || + ((db=new unsigned char[newLength+1])==nil) || + ((eb=new unsigned char[newLength+1])==nil)) { delete[] I; delete[] cb; @@ -246,9 +246,9 @@ UInt32 plBSDiffBuffer::Diff( UInt32 oldLength, void *oldBuffer, UInt32 newLength dblen+=lenf; eblen+=(scan-lenb)-(lastscan+lenf); - IWriteUnsignedInt8(lenf,cb+cblen); - IWriteUnsignedInt8((scan-lenb)-(lastscan+lenf),cb+cblen+8); - IWriteUnsignedInt8((pos-lenb)-(lastpos+lenf),cb+cblen+16); + IWriteUnsignedint8_t(lenf,cb+cblen); + IWriteUnsignedint8_t((scan-lenb)-(lastscan+lenf),cb+cblen+8); + IWriteUnsignedint8_t((pos-lenb)-(lastpos+lenf),cb+cblen+16); cblen+=24; lastscan=scan-lenb; @@ -257,13 +257,13 @@ UInt32 plBSDiffBuffer::Diff( UInt32 oldLength, void *oldBuffer, UInt32 newLength }; }; - IWriteUnsignedInt8(cblen,header+8); - IWriteUnsignedInt8(dblen,header+16); - IWriteUnsignedInt8(newLength,header+24); + IWriteUnsignedint8_t(cblen,header+8); + IWriteUnsignedint8_t(dblen,header+16); + IWriteUnsignedint8_t(newLength,header+24); fPatchLength = 32 + cblen + dblen + eblen; fPatchBuffer = nil; - if((fPatchBuffer=TRACKED_NEW unsigned char[fPatchLength])!=nil) + if((fPatchBuffer=new unsigned char[fPatchLength])!=nil) { memcpy(fPatchBuffer,header,32); memcpy(fPatchBuffer+32,cb,cblen); @@ -290,7 +290,7 @@ UInt32 plBSDiffBuffer::Diff( UInt32 oldLength, void *oldBuffer, UInt32 newLength // function will rewind the diff stream, so once you call it, you can't do // anything else on the object. -void plBSDiffBuffer::GetBuffer( UInt32 &length, void *&bufferPtr ) +void plBSDiffBuffer::GetBuffer( uint32_t &length, void *&bufferPtr ) { hsAssert( fWriting, "Trying to GetBuffer() on a difference buffer that's reading" ); @@ -315,20 +315,20 @@ void plBSDiffBuffer::GetBuffer( UInt32 &length, void *&bufferPtr ) // Patch() will take this diff buffer and apply it to the given old buffer, // allocating and producing a new buffer. You are responsible for freeing the new buffer. -UInt32 plBSDiffBuffer::Patch( UInt32 oldLength, void *oldBuffer, UInt32 &newLength, void *&newBuffer ) +uint32_t plBSDiffBuffer::Patch( uint32_t oldLength, void *oldBuffer, uint32_t &newLength, void *&newBuffer ) { hsAssert( !fWriting, "Trying to Patch() a difference buffer that's writing" ); unsigned char *ctrlpipe, *ctrlend; unsigned char *diffpipe, *diffend; unsigned char *extrapipe; - UInt32 ctrllen,datalen; + uint32_t ctrllen,datalen; int version=0; unsigned char *newpos, *newend; unsigned char *oldpos, *oldend; unsigned char *patchend; - UInt32 ctrl[3]; - UInt32 i; + uint32_t ctrl[3]; + uint32_t i; if (oldBuffer == nil || oldLength < 0 || @@ -375,9 +375,9 @@ UInt32 plBSDiffBuffer::Patch( UInt32 oldLength, void *oldBuffer, UInt32 &newLeng if(!version) return (-1); - ctrllen=IReadUnsignedInt8(fPatchBuffer+8); - datalen=IReadUnsignedInt8(fPatchBuffer+16); - newLength=IReadUnsignedInt8(fPatchBuffer+24); + ctrllen=IReadUnsignedint8_t(fPatchBuffer+8); + datalen=IReadUnsignedint8_t(fPatchBuffer+16); + newLength=IReadUnsignedint8_t(fPatchBuffer+24); if((ctrllen<0) || (datalen<0) || (newLength<0) || ((version==1) && (32+ctrllen+datalen!=fPatchLength))) return (-1); @@ -390,7 +390,7 @@ UInt32 plBSDiffBuffer::Patch( UInt32 oldLength, void *oldBuffer, UInt32 &newLeng extrapipe=diffpipe+datalen; }; - if((newBuffer=(void *)TRACKED_NEW unsigned char[newLength+1])==nil) return(-1); + if((newBuffer=(void *)new unsigned char[newLength+1])==nil) return(-1); newpos = (unsigned char *)newBuffer; newend = (unsigned char *)newBuffer + newLength; oldpos = (unsigned char *)oldBuffer; @@ -398,7 +398,7 @@ UInt32 plBSDiffBuffer::Patch( UInt32 oldLength, void *oldBuffer, UInt32 &newLeng while(newposkk) ISplit(I,V,kk,start+len-kk,h); } -void plBSDiffBuffer::IQSuffixSort(Int32 *I,Int32 *V,unsigned char *old,UInt32 oldsize) +void plBSDiffBuffer::IQSuffixSort(int32_t *I,int32_t *V,unsigned char *old,uint32_t oldsize) { - UInt32 buckets[256]; - UInt32 i,h,len; + uint32_t buckets[256]; + uint32_t i,h,len; for(i=0;i<256;i++) buckets[i]=0; for(i=0;iWriteLE32( fNewLength ); fStream->WriteBool( f16BitMode ); fWriting = true; @@ -98,7 +98,7 @@ plDiffBuffer::plDiffBuffer( UInt32 newLength, UInt32 oldLength ) // will be copied, so you don't need to keep it around after you construct // this object. -plDiffBuffer::plDiffBuffer( void *buffer, UInt32 length ) +plDiffBuffer::plDiffBuffer( void *buffer, uint32_t length ) : fBSDiffBuffer( nil ) , fStream( nil ) , fIsBSDiff( false ) @@ -109,12 +109,12 @@ plDiffBuffer::plDiffBuffer( void *buffer, UInt32 length ) memcmp(buffer,"BSDIFF40",8)==0 ) { // This is a bsdiff buffer. Use plBSDiffBuffer to handle it. - fBSDiffBuffer = TRACKED_NEW plBSDiffBuffer(buffer, length); + fBSDiffBuffer = new plBSDiffBuffer(buffer, length); fIsBSDiff = true; } else { - fStream = TRACKED_NEW hsRAMStream(); + fStream = new hsRAMStream(); fStream->Write( length, buffer ); fStream->Rewind(); @@ -141,14 +141,14 @@ plDiffBuffer::~plDiffBuffer() // supplied will be copied internally, so you can discard it after you call // this function. -void plDiffBuffer::Add( Int32 length, void *newData ) +void plDiffBuffer::Add( int32_t length, void *newData ) { hsAssert( fWriting, "Trying to Add() to a difference buffer that's reading" ); // We flag our two different op types by the sign of the length. Negative // lengths are an add operation, positive ones are copy ops. if( f16BitMode ) - fStream->WriteLE16( -( (Int16)length ) ); + fStream->WriteLE16( -( (int16_t)length ) ); else fStream->WriteLE32( -length ); fStream->Write( length, newData ); @@ -157,7 +157,7 @@ void plDiffBuffer::Add( Int32 length, void *newData ) //// Copy //////////////////////////////////////////////////////////////////// // Copy() appends a Copy-Data-From-Old operation to the diff buffer. -void plDiffBuffer::Copy( Int32 length, UInt32 oldOffset ) +void plDiffBuffer::Copy( int32_t length, uint32_t oldOffset ) { hsAssert( fWriting, "Trying to Copy() to a difference buffer that's reading" ); @@ -165,8 +165,8 @@ void plDiffBuffer::Copy( Int32 length, UInt32 oldOffset ) // lengths are an add operation, positive ones are copy ops. if( f16BitMode ) { - fStream->WriteLE16( (Int16)length ); - fStream->WriteLE16( (UInt16)oldOffset ); + fStream->WriteLE16( (int16_t)length ); + fStream->WriteLE16( (uint16_t)oldOffset ); } else { @@ -182,12 +182,12 @@ void plDiffBuffer::Copy( Int32 length, UInt32 oldOffset ) // function will rewind the diff stream, so once you call it, you can't do // anything else on the object. -void plDiffBuffer::GetBuffer( UInt32 &length, void *&bufferPtr ) +void plDiffBuffer::GetBuffer( uint32_t &length, void *&bufferPtr ) { hsAssert( fWriting, "Trying to GetBuffer() on a difference buffer that's reading" ); length = fStream->GetPosition(); - bufferPtr = (void *)TRACKED_NEW UInt8[ length ]; + bufferPtr = (void *)new uint8_t[ length ]; fStream->Rewind(); fStream->Read( length, bufferPtr ); @@ -205,7 +205,7 @@ void plDiffBuffer::GetBuffer( UInt32 &length, void *&bufferPtr ) #define hsAssertAndBreak( cond, msg ) { if( cond ) { hsAssert( false, msg ); break; } } -void plDiffBuffer::Apply( UInt32 oldLength, void *oldBuffer, UInt32 &newLength, void *&newBuffer ) +void plDiffBuffer::Apply( uint32_t oldLength, void *oldBuffer, uint32_t &newLength, void *&newBuffer ) { hsAssert( !fWriting, "Trying to Apply() a difference buffer that's writing" ); @@ -218,24 +218,24 @@ void plDiffBuffer::Apply( UInt32 oldLength, void *oldBuffer, UInt32 &newLengt /// Step 1: Allocate the new buffer newLength = fNewLength; - UInt8 *new8Buffer = TRACKED_NEW UInt8[ newLength ]; - UInt8 *old8Buffer = (UInt8 *)oldBuffer; + uint8_t *new8Buffer = new uint8_t[ newLength ]; + uint8_t *old8Buffer = (uint8_t *)oldBuffer; newBuffer = (void *)new8Buffer; /// Step 2: Loop through the difference stream - Int32 opLength; - UInt32 newBufferPos = 0; + int32_t opLength; + uint32_t newBufferPos = 0; while( newBufferPos < newLength ) { // Read in the op length if( f16BitMode ) { - Int16 opLen16 = fStream->ReadLE16(); + int16_t opLen16 = fStream->ReadLE16(); if( opLen16 < 0 ) - opLength = -( (Int32)( -opLen16 ) ); + opLength = -( (int32_t)( -opLen16 ) ); else - opLength = (UInt32)opLen16; + opLength = (uint32_t)opLen16; } else opLength = fStream->ReadLE32(); @@ -252,7 +252,7 @@ void plDiffBuffer::Apply( UInt32 oldLength, void *oldBuffer, UInt32 &newLengt else { // Copy op, so get the old offset and copy from there - UInt32 oldOffset = f16BitMode ? fStream->ReadLE16() : fStream->ReadLE32(); + uint32_t oldOffset = f16BitMode ? fStream->ReadLE16() : fStream->ReadLE32(); hsAssertAndBreak( newBufferPos + opLength > newLength, "Destination buffer offset in plDiffBuffer() is out of range!" ); hsAssertAndBreak( oldOffset + opLength > oldLength, "Difference buffer offset in plDiffBuffer() is out of range of the old buffer!" ); diff --git a/Sources/Plasma/PubUtilLib/plResMgr/plDiffBuffer.h b/Sources/Plasma/PubUtilLib/plResMgr/plDiffBuffer.h index 6fdf3ef0..8b4b2220 100644 --- a/Sources/Plasma/PubUtilLib/plResMgr/plDiffBuffer.h +++ b/Sources/Plasma/PubUtilLib/plResMgr/plDiffBuffer.h @@ -70,7 +70,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #ifndef _plDiffBuffer_h #define _plDiffBuffer_h -#include "hsTypes.h" +#include "HeadSpin.h" #include "hsStream.h" //// Class Definition //////////////////////////////////////////////////////// @@ -82,7 +82,7 @@ class plDiffBuffer protected: hsBool fWriting, f16BitMode; - UInt32 fNewLength; + uint32_t fNewLength; hsRAMStream *fStream; // Support for BSDiff patch buffers (Patching only) @@ -91,8 +91,8 @@ class plDiffBuffer public: - plDiffBuffer( UInt32 newLength, UInt32 oldLength = 0 ); // Constructor for writing new buffers. oldLength isn't required but helpful for optimizations - plDiffBuffer( void *buffer, UInt32 length ); // Constructor for applying a given diff set + plDiffBuffer( uint32_t newLength, uint32_t oldLength = 0 ); // Constructor for writing new buffers. oldLength isn't required but helpful for optimizations + plDiffBuffer( void *buffer, uint32_t length ); // Constructor for applying a given diff set // to an old buffer virtual ~plDiffBuffer(); @@ -100,19 +100,19 @@ class plDiffBuffer /// Creation/write functions // Add() appends an Add-New-Data operation to the diff buffer. The data supplied will be copied internally. - void Add( Int32 length, void *newData ); + void Add( int32_t length, void *newData ); // Copy() appends a Copy-Data-From-Old operation to the diff buffer - void Copy( Int32 length, UInt32 oldOffset ); + void Copy( int32_t length, uint32_t oldOffset ); // GetBuffer() will copy the diff stream into a new buffer and return it. You are responsible for freeing the buffer. - void GetBuffer( UInt32 &length, void *&bufferPtr ); + void GetBuffer( uint32_t &length, void *&bufferPtr ); /// Apply functions // Apply() will take this diff buffer and apply it to the given old buffer, allocating and producing a new buffer. You are responsible for freeing the new buffer. - void Apply( UInt32 oldLength, void *oldBuffer, UInt32 &newLength, void *&newBuffer ); + void Apply( uint32_t oldLength, void *oldBuffer, uint32_t &newLength, void *&newBuffer ); }; diff --git a/Sources/Plasma/PubUtilLib/plResMgr/plKeyFinder.cpp b/Sources/Plasma/PubUtilLib/plResMgr/plKeyFinder.cpp index 6d559308..dc7b4682 100644 --- a/Sources/Plasma/PubUtilLib/plResMgr/plKeyFinder.cpp +++ b/Sources/Plasma/PubUtilLib/plResMgr/plKeyFinder.cpp @@ -52,7 +52,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "plRegistryKeyList.h" #include "plPageInfo.h" #include "pnFactory/plFactory.h" -#include "hsUtils.h" + #include "plCreatableIndex.h" plResManager* IGetResMgr() { return (plResManager*)hsgResMgr::ResMgr(); } @@ -119,14 +119,14 @@ hsBool NameMatches(const char* obName, const char* pKName, hsBool subString) plKey plKeyFinder::StupidSearch(const char * age, const char * rm, const char *className, const plString &obName, hsBool subString) { - UInt16 ty = plFactory::FindClassIndex(className); + uint16_t ty = plFactory::FindClassIndex(className); return StupidSearch(age, rm, ty, obName, subString); } class plKeyFinderIter : public plRegistryKeyIterator, public plRegistryPageIterator { protected: - UInt16 fClassType; + uint16_t fClassType; plString fObjName; hsBool fSubstr; plKey fFoundKey; @@ -135,10 +135,10 @@ protected: public: plKey GetFoundKey( void ) const { return fFoundKey; } - plKeyFinderIter( UInt16 classType, const plString &obName, hsBool substr ) + plKeyFinderIter( uint16_t classType, const plString &obName, hsBool substr ) : fFoundKey( nil ), fClassType( classType ), fObjName( obName ), fSubstr( substr ) { } - plKeyFinderIter( UInt16 classType, const plString &obName, hsBool substr, const char *ageName ) + plKeyFinderIter( uint16_t classType, const plString &obName, hsBool substr, const char *ageName ) : fFoundKey( nil ), fClassType( classType ), fObjName( obName ), fSubstr( substr ), fAgeName( ageName ) {} @@ -182,7 +182,7 @@ public: }; plKey plKeyFinder::StupidSearch(const char * age, const char * rm, - UInt16 classType, const plString &obName, hsBool subString) + uint16_t classType, const plString &obName, hsBool subString) { if (obName.IsNull()) return nil; @@ -191,9 +191,9 @@ plKey plKeyFinder::StupidSearch(const char * age, const char * rm, fLastError = kOk; - UInt16 maxClasses = plFactory::GetNumClasses(); + uint16_t maxClasses = plFactory::GetNumClasses(); - UInt16 ty = classType; + uint16_t ty = classType; if (ty == maxClasses) // error { fLastError = kInvalidClass; return nil; @@ -276,14 +276,14 @@ class plKeyFinderIterator : public plRegistryKeyIterator, public plRegistryPageI { protected: - UInt16 fClassType; + uint16_t fClassType; plString fObjName; std::vector &fFoundKeys; public: - plKeyFinderIterator( UInt16 classType, const plString &obName, std::vector& foundKeys ) + plKeyFinderIterator( uint16_t classType, const plString &obName, std::vector& foundKeys ) : fClassType( classType ), fObjName( obName ), fFoundKeys( foundKeys ) { } virtual hsBool EatKey( const plKey& key ) @@ -304,7 +304,7 @@ class plKeyFinderIterator : public plRegistryKeyIterator, public plRegistryPageI } }; -void plKeyFinder::ReallyStupidSubstringSearch(const plString &name, UInt16 objType, std::vector& foundKeys, const plLocation &hintLocation ) +void plKeyFinder::ReallyStupidSubstringSearch(const plString &name, uint16_t objType, std::vector& foundKeys, const plLocation &hintLocation ) { if (name.IsNull()) return; diff --git a/Sources/Plasma/PubUtilLib/plResMgr/plKeyFinder.h b/Sources/Plasma/PubUtilLib/plResMgr/plKeyFinder.h index b11048e0..4d4a2b77 100644 --- a/Sources/Plasma/PubUtilLib/plResMgr/plKeyFinder.h +++ b/Sources/Plasma/PubUtilLib/plResMgr/plKeyFinder.h @@ -63,7 +63,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // //---------------------------- -#include "hsTypes.h" +#include "HeadSpin.h" #include "pnKeyedObject/plKey.h" #include "pnKeyedObject/plUoid.h" #include "hsStlUtils.h" @@ -90,7 +90,7 @@ public: // These are Stupid search because they just do string searchs on the objects. plKey StupidSearch(const char * age, const char * rm, const char *className, const plString &obName, hsBool subString=false); - plKey StupidSearch(const char * age, const char * rm, UInt16 objType, const plString &obName, hsBool subString=false); + plKey StupidSearch(const char * age, const char * rm, uint16_t objType, const plString &obName, hsBool subString=false); eErrCodes GetLastErrorCode() { return fLastError; } const char* GetLastErrorString(); // For Console display @@ -98,7 +98,7 @@ public: void ReallyStupidResponderSearch(const plString& name, std::vector& foundKeys, const plLocation& hintLocation = plLocation::kInvalidLoc); void ReallyStupidActivatorSearch(const plString& name, std::vector& foundKeys, const plLocation& hintLocation = plLocation::kInvalidLoc); - void ReallyStupidSubstringSearch(const plString& name, UInt16 objType, std::vector& foundKeys, const plLocation& hintLocation = plLocation::kInvalidLoc); + void ReallyStupidSubstringSearch(const plString& name, uint16_t objType, std::vector& foundKeys, const plLocation& hintLocation = plLocation::kInvalidLoc); void GetActivatorNames(std::vector& names); void GetResponderNames(std::vector& names); diff --git a/Sources/Plasma/PubUtilLib/plResMgr/plLoc.h b/Sources/Plasma/PubUtilLib/plResMgr/plLoc.h index dd8619af..72bafb5c 100644 --- a/Sources/Plasma/PubUtilLib/plResMgr/plLoc.h +++ b/Sources/Plasma/PubUtilLib/plResMgr/plLoc.h @@ -43,7 +43,6 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #define PLLOC_H #include "HeadSpin.h" -#include "hsUtils.h" // Values for UOID, such as AGE, District Room @@ -65,7 +64,7 @@ class plLocFileParser public: plLocFileParser(); ~plLocFileParser() { if (fpFile) fclose(fpFile); fpFile = 0; } - void ThrowBack(char *p,UInt8 lev) { fThrowBack = p; fThrowBackLevel = lev; } + void ThrowBack(char *p,uint8_t lev) { fThrowBack = p; fThrowBackLevel = lev; } void ClearThrowBack() { fThrowBack = NULL; fThrowBackLevel = 0; } bool ThrowBackAvailable() { return (fThrowBack == NULL) ? false: true; } int NextLine(char **pP); // returns an Allocated string in pP of next valid line, and Level #, or LOC_EOF diff --git a/Sources/Plasma/PubUtilLib/plResMgr/plLocalization.cpp b/Sources/Plasma/PubUtilLib/plResMgr/plLocalization.cpp index d34e9287..773e4bbd 100644 --- a/Sources/Plasma/PubUtilLib/plResMgr/plLocalization.cpp +++ b/Sources/Plasma/PubUtilLib/plResMgr/plLocalization.cpp @@ -39,10 +39,10 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com Mead, WA 99021 *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "plLocalization.h" #include "plFile/plFileUtils.h" -#include "hsUtils.h" + plLocalization::Language plLocalization::fLanguage = plLocalization::kEnglish; diff --git a/Sources/Plasma/PubUtilLib/plResMgr/plPageInfo.cpp b/Sources/Plasma/PubUtilLib/plResMgr/plPageInfo.cpp index f01176c8..44da5ac1 100644 --- a/Sources/Plasma/PubUtilLib/plResMgr/plPageInfo.cpp +++ b/Sources/Plasma/PubUtilLib/plResMgr/plPageInfo.cpp @@ -40,12 +40,12 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ #include "plPageInfo.h" -#include "hsUtils.h" + #include "hsStream.h" #include "pnKeyedObject/plUoid.h" #include "plVersion.h" -static UInt32 sCurrPageInfoVersion = 6; +static uint32_t sCurrPageInfoVersion = 6; //// Constructor/Destructor ////////////////////////////////////////////////// plPageInfo::plPageInfo() @@ -112,7 +112,7 @@ void plPageInfo::SetLocation( const plLocation &loc ) fLocation = loc; } -void plPageInfo::AddClassVersion(UInt16 classIdx, UInt16 version) +void plPageInfo::AddClassVersion(uint16_t classIdx, uint16_t version) { ClassVersion cv; cv.Class = classIdx; @@ -135,7 +135,7 @@ void plPageInfo::Read( hsStream *s ) // 5 is the earliest version since we began working again on the P20 codebase in Sep 2005, // after Uru's online component was cancelled in Feb 2004, so I've removed support for // anything prior to that to clean things up a bit. - UInt32 version = s->ReadLE32(); + uint32_t version = s->ReadLE32(); if (version > sCurrPageInfoVersion || version < 5) { hsAssert( false, "Invalid header version in plPageInfo::Read()" ); @@ -153,11 +153,11 @@ void plPageInfo::Read( hsStream *s ) if (version < 6) { - UInt16 unusedMinorVersion; + uint16_t unusedMinorVersion; s->ReadLE(&unusedMinorVersion); - Int32 unusedReleaseVersion; + int32_t unusedReleaseVersion; s->ReadLE(&unusedReleaseVersion); // This was always zero... yanked. - UInt32 unusedFlags; + uint32_t unusedFlags; s->ReadLE(&unusedFlags); } @@ -168,9 +168,9 @@ void plPageInfo::Read( hsStream *s ) if (version >= 6) { - UInt16 numClassVersions = s->ReadLE16(); + uint16_t numClassVersions = s->ReadLE16(); fClassVersions.reserve(numClassVersions); - for (UInt16 i = 0; i < numClassVersions; i++) + for (uint16_t i = 0; i < numClassVersions; i++) { ClassVersion cv; cv.Class = s->ReadLE16(); @@ -190,9 +190,9 @@ void plPageInfo::Write( hsStream *s ) s->WriteLE( fChecksum ); s->WriteLE( fDataStart ); s->WriteLE( fIndexStart ); - UInt16 numClassVersions = UInt16(fClassVersions.size()); + uint16_t numClassVersions = uint16_t(fClassVersions.size()); s->WriteLE16(numClassVersions); - for (UInt16 i = 0; i < numClassVersions; i++) + for (uint16_t i = 0; i < numClassVersions; i++) { ClassVersion& cv = fClassVersions[i]; s->WriteLE16(cv.Class); diff --git a/Sources/Plasma/PubUtilLib/plResMgr/plPageInfo.h b/Sources/Plasma/PubUtilLib/plResMgr/plPageInfo.h index 4f869957..c3cce2e4 100644 --- a/Sources/Plasma/PubUtilLib/plResMgr/plPageInfo.h +++ b/Sources/Plasma/PubUtilLib/plResMgr/plPageInfo.h @@ -47,7 +47,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #ifndef _plPageInfo_h #define _plPageInfo_h -#include "hsTypes.h" +#include "HeadSpin.h" #include "pnKeyedObject/plUoid.h" #include @@ -56,17 +56,17 @@ class plLocation; class plPageInfo { public: - struct ClassVersion { UInt16 Class; UInt16 Version; }; + struct ClassVersion { uint16_t Class; uint16_t Version; }; typedef std::vector ClassVerVec; protected: plLocation fLocation; char* fAge; char* fPage; - UInt16 fMajorVersion; + uint16_t fMajorVersion; ClassVerVec fClassVersions; - UInt32 fChecksum; - UInt32 fDataStart, fIndexStart; + uint32_t fChecksum; + uint32_t fDataStart, fIndexStart; void IInit( void ); void ISetFrom( const plPageInfo &src ); @@ -84,7 +84,7 @@ public: plPageInfo &operator=( const plPageInfo &src ); void ClearClassVersions() { fClassVersions.clear(); } - void AddClassVersion(UInt16 classIdx, UInt16 version); + void AddClassVersion(uint16_t classIdx, uint16_t version); const ClassVerVec& GetClassVersions() const { return fClassVersions; } void SetStrings( const char *age, const char *page ); @@ -92,21 +92,21 @@ public: void SetLocation(const plLocation& loc); const plLocation& GetLocation() const; - UInt16 GetMajorVersion() const { return fMajorVersion; } - void SetMajorVersion(UInt16 major) { fMajorVersion = major; } + uint16_t GetMajorVersion() const { return fMajorVersion; } + void SetMajorVersion(uint16_t major) { fMajorVersion = major; } - void SetChecksum( UInt32 c ) { fChecksum = c; } - UInt32 GetChecksum( void ) const { return fChecksum; } + void SetChecksum( uint32_t c ) { fChecksum = c; } + uint32_t GetChecksum( void ) const { return fChecksum; } void Read( hsStream *s ); void Write( hsStream *s ); hsBool IsValid( void ) const; - UInt32 GetDataStart( void ) const { return fDataStart; } - void SetDataStart( UInt32 s ) { fDataStart = s; } + uint32_t GetDataStart( void ) const { return fDataStart; } + void SetDataStart( uint32_t s ) { fDataStart = s; } - UInt32 GetIndexStart( void ) const { return fIndexStart; } - void SetIndexStart( UInt32 s ) { fIndexStart = s; } + uint32_t GetIndexStart( void ) const { return fIndexStart; } + void SetIndexStart( uint32_t s ) { fIndexStart = s; } }; #endif // _plPageInfo_h diff --git a/Sources/Plasma/PubUtilLib/plResMgr/plRegistryHelpers.h b/Sources/Plasma/PubUtilLib/plResMgr/plRegistryHelpers.h index 88cb8ee1..349fa79e 100644 --- a/Sources/Plasma/PubUtilLib/plResMgr/plRegistryHelpers.h +++ b/Sources/Plasma/PubUtilLib/plResMgr/plRegistryHelpers.h @@ -52,7 +52,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #ifndef _plRegistryHelpers_h #define _plRegistryHelpers_h -#include "hsTypes.h" +#include "HeadSpin.h" #include "hsTemplates.h" #include "pnKeyedObject/plKey.h" diff --git a/Sources/Plasma/PubUtilLib/plResMgr/plRegistryKeyList.cpp b/Sources/Plasma/PubUtilLib/plResMgr/plRegistryKeyList.cpp index 88cd3a70..d665b7fb 100644 --- a/Sources/Plasma/PubUtilLib/plResMgr/plRegistryKeyList.cpp +++ b/Sources/Plasma/PubUtilLib/plResMgr/plRegistryKeyList.cpp @@ -44,7 +44,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "hsStream.h" #include -plRegistryKeyList::plRegistryKeyList(UInt16 classType) +plRegistryKeyList::plRegistryKeyList(uint16_t classType) { fClassType = classType; fReffedStaticKeys = 0; @@ -108,7 +108,7 @@ plKeyImp* plRegistryKeyList::FindKey(const plString& keyName) plKeyImp* plRegistryKeyList::FindKey(const plUoid& uoid) { - UInt32 objectID = uoid.GetObjectID(); + uint32_t objectID = uoid.GetObjectID(); // Key is dynamic or doesn't know it's index. Do a find by name. if (objectID == 0) @@ -202,7 +202,7 @@ void plRegistryKeyList::AddKey(plKeyImp* key, LoadStatus& loadStatusChange) void plRegistryKeyList::SetKeyUsed(plKeyImp* key) { // If this is a static key, mark that we used it. Otherwise, just ignore it. - UInt32 id = key->GetUoid().GetObjectID(); + uint32_t id = key->GetUoid().GetObjectID(); if (id > 0) fReffedStaticKeys++; } @@ -220,7 +220,7 @@ bool plRegistryKeyList::SetKeyUnused(plKeyImp* key, LoadStatus& loadStatusChange } // Check if it's a static key - UInt32 id = key->GetUoid().GetObjectID(); + uint32_t id = key->GetUoid().GetObjectID(); hsAssert(id <= fStaticKeys.size(), "Bad static key id"); if (id != 0 && id <= fStaticKeys.size()) { @@ -293,7 +293,7 @@ void plRegistryKeyList::PrepForWrite() } // Start our new object id's after any already created ones - UInt32 objectID = fStaticKeys.size()+1; + uint32_t objectID = fStaticKeys.size()+1; // Make room for our new keys fStaticKeys.resize(fStaticKeys.size()+numDynKeys); @@ -318,7 +318,7 @@ void plRegistryKeyList::PrepForWrite() void plRegistryKeyList::Read(hsStream* s) { - UInt32 keyListLen = s->ReadLE32(); + uint32_t keyListLen = s->ReadLE32(); if (!fStaticKeys.empty()) { s->Skip(keyListLen); @@ -327,12 +327,12 @@ void plRegistryKeyList::Read(hsStream* s) fFlags = s->ReadByte(); - UInt32 numKeys = s->ReadLE32(); + uint32_t numKeys = s->ReadLE32(); fStaticKeys.resize(numKeys); for (int i = 0; i < numKeys; i++) { - plKeyImp* newKey = TRACKED_NEW plKeyImp; + plKeyImp* newKey = new plKeyImp; newKey->Read(s); fStaticKeys[i] = newKey; } @@ -341,7 +341,7 @@ void plRegistryKeyList::Read(hsStream* s) void plRegistryKeyList::Write(hsStream* s) { // Save space for the length of our data - UInt32 beginPos = s->GetPosition(); + uint32_t beginPos = s->GetPosition(); s->WriteLE32(0); s->WriteByte(fFlags); @@ -356,8 +356,8 @@ void plRegistryKeyList::Write(hsStream* s) } // Go back to the start and write the length of our data - UInt32 endPos = s->GetPosition(); + uint32_t endPos = s->GetPosition(); s->SetPosition(beginPos); - s->WriteLE32(endPos-beginPos-sizeof(UInt32)); + s->WriteLE32(endPos-beginPos-sizeof(uint32_t)); s->SetPosition(endPos); } diff --git a/Sources/Plasma/PubUtilLib/plResMgr/plRegistryKeyList.h b/Sources/Plasma/PubUtilLib/plResMgr/plRegistryKeyList.h index bdad2d71..016baa4f 100644 --- a/Sources/Plasma/PubUtilLib/plResMgr/plRegistryKeyList.h +++ b/Sources/Plasma/PubUtilLib/plResMgr/plRegistryKeyList.h @@ -42,7 +42,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #ifndef plRegistryKeyList_h_inc #define plRegistryKeyList_h_inc -#include "hsTypes.h" +#include "HeadSpin.h" #include "pnKeyedObject/plKeyImp.h" #include #include @@ -67,19 +67,19 @@ class plRegistryKeyList protected: friend class plKeyFinder; - UInt16 fClassType; + uint16_t fClassType; // Lock counter for iterating. If this is >0, don't do any ops that // can change key positions in the array (instead, just leave holes) - UInt16 fLocked; + uint16_t fLocked; enum Flags { kStaticUnsorted = 0x1 }; - UInt8 fFlags; + uint8_t fFlags; // Static keys are one's we read off disk. These don't change and are // assumed to be already sorted when they're read in. typedef std::vector StaticVec; StaticVec fStaticKeys; - UInt32 fReffedStaticKeys; // Number of static keys that are loaded + uint32_t fReffedStaticKeys; // Number of static keys that are loaded // Dynamic keys are anything created at runtime. They are put in the // correct sorted position when they are added @@ -94,10 +94,10 @@ protected: void IRepack(); public: - plRegistryKeyList(UInt16 classType); + plRegistryKeyList(uint16_t classType); ~plRegistryKeyList(); - UInt16 GetClassType() const { return fClassType; } + uint16_t GetClassType() const { return fClassType; } // Find a key by name (case-insensitive) plKeyImp* FindKey(const plString& keyName); diff --git a/Sources/Plasma/PubUtilLib/plResMgr/plRegistryNode.cpp b/Sources/Plasma/PubUtilLib/plResMgr/plRegistryNode.cpp index 08b1b0d4..684cfe28 100644 --- a/Sources/Plasma/PubUtilLib/plResMgr/plRegistryNode.cpp +++ b/Sources/Plasma/PubUtilLib/plResMgr/plRegistryNode.cpp @@ -106,7 +106,7 @@ plRegistryPageNode::~plRegistryPageNode() PageCond plRegistryPageNode::IVerify() { // Check the checksum values first, to make sure the files aren't corrupt - UInt32 ourChecksum = 0; + uint32_t ourChecksum = 0; hsStream* stream = OpenStream(); if (stream) { @@ -127,7 +127,7 @@ PageCond plRegistryPageNode::IVerify() for (int i = 0; i < classVersions.size(); i++) { const plPageInfo::ClassVersion& cv = classVersions[i]; - UInt16 curVersion = plVersion::GetCreatableVersion(cv.Class); + uint16_t curVersion = plVersion::GetCreatableVersion(cv.Class); if (curVersion > cv.Version) return kPageOutOfDate; @@ -175,18 +175,18 @@ void plRegistryPageNode::LoadKeys() // If we're loading keys in the middle of a read because FindKey() failed, we'd better // make note of our stream position and restore it when we're done. - UInt32 oldPos = stream->GetPosition(); + uint32_t oldPos = stream->GetPosition(); stream->SetPosition(GetPageInfo().GetIndexStart()); // Read in the number of key types - UInt32 numTypes = stream->ReadLE32(); - for (UInt32 i = 0; i < numTypes; i++) + uint32_t numTypes = stream->ReadLE32(); + for (uint32_t i = 0; i < numTypes; i++) { - UInt16 classType = stream->ReadLE16(); + uint16_t classType = stream->ReadLE16(); plRegistryKeyList* keyList = IGetKeyList(classType); if (!keyList) { - keyList = TRACKED_NEW plRegistryKeyList(classType); + keyList = new plRegistryKeyList(classType); fKeyLists[classType] = keyList; } keyList->Read(stream); @@ -300,7 +300,7 @@ hsBool plRegistryPageNode::IterateKeys(plRegistryKeyIterator* iterator) const // Restricted version that only iterates through the keys of a given class // type. -hsBool plRegistryPageNode::IterateKeys(plRegistryKeyIterator* iterator, UInt16 classToRestrictTo) const +hsBool plRegistryPageNode::IterateKeys(plRegistryKeyIterator* iterator, uint16_t classToRestrictTo) const { plRegistryKeyList* keyList = IGetKeyList(classToRestrictTo); if (keyList != nil) @@ -309,7 +309,7 @@ hsBool plRegistryPageNode::IterateKeys(plRegistryKeyIterator* iterator, UInt16 c return true; } -plKeyImp* plRegistryPageNode::FindKey(UInt16 classType, const plString& name) const +plKeyImp* plRegistryPageNode::FindKey(uint16_t classType, const plString& name) const { plRegistryKeyList* keys = IGetKeyList(classType); if (keys == nil) @@ -329,11 +329,11 @@ plKeyImp* plRegistryPageNode::FindKey(const plUoid& uoid) const void plRegistryPageNode::AddKey(plKeyImp* key) { - UInt16 classType = key->GetUoid().GetClassType(); + uint16_t classType = key->GetUoid().GetClassType(); plRegistryKeyList* keys = fKeyLists[classType]; if (keys == nil) { - keys = TRACKED_NEW plRegistryKeyList(classType); + keys = new plRegistryKeyList(classType); fKeyLists[classType] = keys; } @@ -401,7 +401,7 @@ hsBool plRegistryPageNode::SetKeyUnused(plKeyImp* key) return removed; } -plRegistryKeyList* plRegistryPageNode::IGetKeyList(UInt16 classType) const +plRegistryKeyList* plRegistryPageNode::IGetKeyList(uint16_t classType) const { KeyMap::const_iterator it = fKeyLists.find(classType); if (it != fKeyLists.end()) diff --git a/Sources/Plasma/PubUtilLib/plResMgr/plRegistryNode.h b/Sources/Plasma/PubUtilLib/plResMgr/plRegistryNode.h index e053ef51..a9cdd665 100644 --- a/Sources/Plasma/PubUtilLib/plResMgr/plRegistryNode.h +++ b/Sources/Plasma/PubUtilLib/plResMgr/plRegistryNode.h @@ -42,7 +42,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #ifndef plRegistryNode_h_inc #define plRegistryNode_h_inc -#include "hsTypes.h" +#include "HeadSpin.h" #include "hsStream.h" #include "plPageInfo.h" @@ -71,7 +71,7 @@ protected: friend class plKeyFinder; // Map from class type to a list of keys of that type - typedef std::map KeyMap; + typedef std::map KeyMap; KeyMap fKeyLists; int fDynLoadedTypes; // The number of key types that have dynamic keys loaded int fStaticLoadedTypes; // The number of key types that have all their keys loaded @@ -81,13 +81,13 @@ protected: plPageInfo fPageInfo; // Info about this page hsBufferedStream fStream; // Stream for reading/writing our page - UInt8 fOpenRequests; // How many handles there are to fStream (or + uint8_t fOpenRequests; // How many handles there are to fStream (or // zero if it's closed) hsBool fIsNewPage; // True if this page is new (not read off disk) plRegistryPageNode() {} - plRegistryKeyList* IGetKeyList(UInt16 classType) const; + plRegistryKeyList* IGetKeyList(uint16_t classType) const; PageCond IVerify(); public: @@ -118,7 +118,7 @@ public: void UnloadKeys(); // Frees all our keys // Find a key by type and name - plKeyImp* FindKey(UInt16 classType, const plString& name) const; + plKeyImp* FindKey(uint16_t classType, const plString& name) const; // Find a key by direct uoid lookup (or fallback to name lookup if that doesn't work) plKeyImp* FindKey(const plUoid& uoid) const; @@ -131,7 +131,7 @@ public: hsBool SetKeyUnused(plKeyImp* key); hsBool IterateKeys(plRegistryKeyIterator* iterator) const; - hsBool IterateKeys(plRegistryKeyIterator* iterator, UInt16 classToRestrictTo) const; + hsBool IterateKeys(plRegistryKeyIterator* iterator, uint16_t classToRestrictTo) const; // Call this to get a read stream for the page. If a valid pointer is // returned, make sure to call CloseStream when you're done using it. diff --git a/Sources/Plasma/PubUtilLib/plResMgr/plResManager.cpp b/Sources/Plasma/PubUtilLib/plResMgr/plResManager.cpp index e30c2c30..b522ee12 100644 --- a/Sources/Plasma/PubUtilLib/plResMgr/plResManager.cpp +++ b/Sources/Plasma/PubUtilLib/plResMgr/plResManager.cpp @@ -71,7 +71,7 @@ hsBool gDataServerLocal = false; /// Logging #define for easier use #define kResMgrLog(level, log) if (plResMgrSettings::Get().GetLoggingLevel() >= level) log -static void ILog(UInt8 level, const char* format, ...) +static void ILog(uint8_t level, const char* format, ...) { static plStatusLog* log = plStatusLogMgr::GetInstance().CreateStatusLog ( @@ -83,7 +83,7 @@ static void ILog(UInt8 level, const char* format, ...) va_list arguments; va_start(arguments, format); - UInt32 color = 0; + uint32_t color = 0; switch (level) { case 1: color = 0xffffffff; break; @@ -139,7 +139,7 @@ hsBool plResManager::IInit() char fileName[kFolderIterator_MaxPath]; pathIterator.GetPathAndName(fileName); - plRegistryPageNode* node = TRACKED_NEW plRegistryPageNode(fileName); + plRegistryPageNode* node = new plRegistryPageNode(fileName); fAllPages.insert(node); } } @@ -148,12 +148,12 @@ hsBool plResManager::IInit() CreatePage(plLocation::kGlobalFixedLoc, "Global", "FixedKeys"); hsAssert(!fDispatch, "Dispatch already set"); - fDispatch = TRACKED_NEW plDispatch; + fDispatch = new plDispatch; plgTimerCallbackMgr::Init(); // Init our helper - fMyHelper = TRACKED_NEW plResManagerHelper(this); + fMyHelper = new plResManagerHelper(this); fMyHelper->Init(); hsAssert(fMyHelper->GetKey() != nil, "ResManager helper didn't init properly!" ); @@ -234,7 +234,7 @@ void plResManager::IShutdown() void plResManager::AddSinglePage(const char* pagePath) { - plRegistryPageNode* node = TRACKED_NEW plRegistryPageNode(pagePath); + plRegistryPageNode* node = new plRegistryPageNode(pagePath); AddPage(node); } @@ -280,8 +280,8 @@ hsKeyedObject* plResManager::IGetSharedObject(plKeyImp* pKey) plKeyImp* origKey = (plKeyImp*)pKey->GetCloneOwner(); // Find the first non-nil key and ask it to clone itself - UInt32 count = origKey->GetNumClones(); - for (UInt32 i = 0; i < count; i++) + uint32_t count = origKey->GetNumClones(); + for (uint32_t i = 0; i < count; i++) { plKey cloneKey = origKey->GetCloneByIdx(i); if (cloneKey) @@ -351,10 +351,10 @@ hsBool plResManager::ReadObject(plKeyImp* key) hsBool plResManager::IReadObject(plKeyImp* pKey, hsStream *stream) { - static UInt64 totalTime = 0; + static uint64_t totalTime = 0; - UInt64 startTotalTime = totalTime; - UInt64 startTime = 0; + uint64_t startTotalTime = totalTime; + uint64_t startTime = 0; if (fLogReadTimes) startTime = hsTimer::GetFullTickCount(); @@ -364,10 +364,10 @@ hsBool plResManager::IReadObject(plKeyImp* pKey, hsStream *stream) if (pKey->GetUoid().GetLoadMask().DontLoad()) return nil; - hsAssert(pKey->GetStartPos() != UInt32(-1), "Missing StartPos"); - hsAssert(pKey->GetDataLen() != UInt32(-1), "Missing Data Length"); + hsAssert(pKey->GetStartPos() != uint32_t(-1), "Missing StartPos"); + hsAssert(pKey->GetDataLen() != uint32_t(-1), "Missing Data Length"); - if (pKey->GetStartPos() == UInt32(-1) || pKey->GetDataLen() == UInt32(-1)) + if (pKey->GetStartPos() == uint32_t(-1) || pKey->GetDataLen() == uint32_t(-1)) return false; // Try to recover from this by just not reading an object kResMgrLog(3, ILog(3, " Reading object %s::%s", plFactory::GetNameOfClass(pKey->GetUoid().GetClassType()), pKey->GetUoid().GetObjectName())); @@ -444,8 +444,8 @@ hsBool plResManager::IReadObject(plKeyImp* pKey, hsStream *stream) if (fLogReadTimes) { - UInt64 ourTime = hsTimer::GetFullTickCount() - startTime; - UInt64 childTime = totalTime - startTotalTime; + uint64_t ourTime = hsTimer::GetFullTickCount() - startTime; + uint64_t childTime = totalTime - startTotalTime; ourTime -= childTime; plStatusLog::AddLineS("readtimings.log", plStatusLog::kWhite, "%s, %s, %u, %.1f", @@ -466,10 +466,10 @@ class plPageOutIterator : public plRegistryPageIterator { protected: plResManager* fResMgr; - UInt16 fHint; + uint16_t fHint; public: - plPageOutIterator(plResManager* resMgr, UInt16 hint) : fResMgr(resMgr), fHint(hint) + plPageOutIterator(plResManager* resMgr, uint16_t hint) : fResMgr(resMgr), fHint(hint) { fResMgr->IterateAllPages(this); } @@ -511,7 +511,7 @@ void plResManager::IPageOutSceneNodes(hsBool forceAll) if (forceAll) { hsStatusMessage( "--- plResManager Object Leak Report (BEGIN) ---" ); - plPageOutIterator iter(this, UInt16(-1)); + plPageOutIterator iter(this, uint16_t(-1)); hsStatusMessage( "--- plResManager Object Leak Report (END) ---" ); } else @@ -572,7 +572,7 @@ plKey plResManager::FindOriginalKey(const plUoid& uoid) // Note: startPos of -1 means we didn't read it from disk, but 0 length // is our special key that we're a passively created key - foundKey = TRACKED_NEW plKeyImp(uoid, UInt32(-1), UInt32(0)); + foundKey = new plKeyImp(uoid, uint32_t(-1), uint32_t(0)); key = plKey::Make(foundKey); } @@ -754,7 +754,7 @@ plKey plResManager::NewKey(plUoid& newUoid, hsKeyedObject* object) { hsAssert(fInited, "Attempting to create a new key before we're inited!"); - plKeyImp* newKey = TRACKED_NEW plKeyImp; + plKeyImp* newKey = new plKeyImp; newKey->SetUoid(newUoid); AddKey(newKey); @@ -815,7 +815,7 @@ plKey plResManager::ReRegister(const plString& nm, const plUoid& oid) } } - plKeyImp* pKey = TRACKED_NEW plKeyImp; + plKeyImp* pKey = new plKeyImp; if (canClone && pOrigKey) { pKey->CopyForClone((plKeyImp*)pOrigKey, fCurClonePlayerID, fCurCloneID); @@ -913,7 +913,7 @@ plKey plResManager::CloneKey(const plKey& objKey) return ICloneKey(objKey->GetUoid(), plNetClientApp::GetInstance()->GetPlayerID(), fCloningCounter); } -plKey plResManager::ICloneKey(const plUoid& objUoid, UInt32 playerID, UInt32 cloneID) +plKey plResManager::ICloneKey(const plUoid& objUoid, uint32_t playerID, uint32_t cloneID) { hsAssert(fCurCloneID == 0, "Recursive clone"); fCurCloneID = cloneID; @@ -925,7 +925,7 @@ plKey plResManager::ICloneKey(const plUoid& objUoid, UInt32 playerID, UInt32 clo fCurCloneID = 0; // Then notify NetClientMgr when object loads - plObjRefMsg* refMsg = TRACKED_NEW plObjRefMsg(plNetClientApp::GetInstance()->GetKey(), plRefMsg::kOnCreate, 0, 0); + plObjRefMsg* refMsg = new plObjRefMsg(plNetClientApp::GetInstance()->GetKey(), plRefMsg::kOnCreate, 0, 0); AddViaNotify(cloneKey, refMsg, plRefFlags::kPassiveRef); return cloneKey; @@ -950,7 +950,7 @@ hsBool plResManager::Unload(const plKey& objKey) plCreatable* plResManager::IReadCreatable(hsStream* s) const { - UInt16 hClass = s->ReadLE16(); + uint16_t hClass = s->ReadLE16(); plCreatable* pCre = plFactory::Create(hClass); if (!pCre) hsAssert( hClass == 0x8000, "Invalid creatable index" ); @@ -976,7 +976,7 @@ plCreatable* plResManager::ReadCreatableVersion(hsStream* s) inline void IWriteCreatable(hsStream* s, plCreatable* pCre) { - Int16 hClass = pCre ? pCre->ClassIndex() : 0x8000; + int16_t hClass = pCre ? pCre->ClassIndex() : 0x8000; hsAssert(pCre == nil || plFactory::IsValidClassIndex(hClass), "Invalid class index on write"); s->WriteLE16(hClass); } @@ -1063,7 +1063,7 @@ void plResManager::LoadAgeKeys(const char* age) kResMgrLog(1, ILog(1, "Loading age keys for age %s", age)); hsStatusMessageF("*** Loading age keys for age %s ***\n", age); - plResAgeHolder* holder = TRACKED_NEW plResAgeHolder(age); + plResAgeHolder* holder = new plResAgeHolder(age); fHeldAgeKeys[age] = holder; // Go find pages that match this age, load the keys, and ref them all plResHolderIterator iter(age, holder->fKeys, this); @@ -1127,12 +1127,12 @@ void plResManager::IDropAllAgeKeys() class plOurRefferAndFinder : public plRegistryKeyIterator { hsTArray &fRefArray; - UInt16 fClassToFind; + uint16_t fClassToFind; plKey &fFoundKey; public: - plOurRefferAndFinder( hsTArray &refArray, UInt16 classToFind, plKey &foundKey ) + plOurRefferAndFinder( hsTArray &refArray, uint16_t classToFind, plKey &foundKey ) : fRefArray( refArray ), fClassToFind( classToFind ), fFoundKey( foundKey ) { } virtual hsBool EatKey( const plKey& key ) @@ -1150,9 +1150,9 @@ class plOurRefferAndFinder : public plRegistryKeyIterator } }; -void plResManager::PageInRoom(const plLocation& page, UInt16 objClassToRef, plRefMsg* refMsg) +void plResManager::PageInRoom(const plLocation& page, uint16_t objClassToRef, plRefMsg* refMsg) { - UInt64 readRoomTime = 0; + uint64_t readRoomTime = 0; if (fLogReadTimes) readRoomTime = hsTimer::GetFullTickCount(); @@ -1259,7 +1259,7 @@ public: plPageInAgeIter(plKey destKey, const char *ageName) : fDestKey(destKey), fAgeName(ageName) {} ~plPageInAgeIter() { - plClientMsg* pMsg1 = TRACKED_NEW plClientMsg(plClientMsg::kLoadRoomHold); + plClientMsg* pMsg1 = new plClientMsg(plClientMsg::kLoadRoomHold); for (int i = 0; i < fLocations.size(); i++) { pMsg1->AddRoomLoc(fLocations[i]); @@ -1286,7 +1286,7 @@ void plResManager::PageInAge(const char *age) plKey clientKey = hsgResMgr::ResMgr()->FindKey(lu); // Tell the client to load all the keys for this age, to make the loading process work better - plClientMsg *loadAgeKeysMsg = TRACKED_NEW plClientMsg(plClientMsg::kLoadAgeKeys); + plClientMsg *loadAgeKeysMsg = new plClientMsg(plClientMsg::kLoadAgeKeys); loadAgeKeysMsg->SetAgeName(age); loadAgeKeysMsg->Send(clientKey); @@ -1510,7 +1510,7 @@ void plResManager::DumpUnusedKeys(plRegistryPageNode* page) const plRegistryPageNode* plResManager::CreatePage(const plLocation& location, const char* age, const char* page) { - plRegistryPageNode* pageNode = TRACKED_NEW plRegistryPageNode(location, age, page, fDataPath.c_str()); + plRegistryPageNode* pageNode = new plRegistryPageNode(location, age, page, fDataPath.c_str()); fAllPages.insert(pageNode); return pageNode; @@ -1549,7 +1549,7 @@ static void sIReportLeak(plKeyImp* key, plRegistryPageNode* page) class plKeyImpRef : public plKeyImp { public: - UInt16 GetRefCnt() const { return fRefCount; } + uint16_t GetRefCnt() const { return fRefCount; } }; static bool alreadyDone = false; @@ -1594,7 +1594,7 @@ static void sIReportLeak(plKeyImp* key, plRegistryPageNode* page) // Update 5.20: since there are so many problems with doing this, don't // delete the objects, just print out a memleak report. -mcn -void plResManager::UnloadPageObjects(plRegistryPageNode* pageNode, UInt16 classIndexHint) +void plResManager::UnloadPageObjects(plRegistryPageNode* pageNode, uint16_t classIndexHint) { if (!pageNode->IsLoaded()) return; @@ -1613,7 +1613,7 @@ void plResManager::UnloadPageObjects(plRegistryPageNode* pageNode, UInt16 classI plUnloadObjectsIterator iterator; - if (classIndexHint != UInt16(-1)) + if (classIndexHint != uint16_t(-1)) pageNode->IterateKeys(&iterator, classIndexHint); else pageNode->IterateKeys(&iterator); diff --git a/Sources/Plasma/PubUtilLib/plResMgr/plResManager.h b/Sources/Plasma/PubUtilLib/plResMgr/plResManager.h index c632235a..bb0d17ad 100644 --- a/Sources/Plasma/PubUtilLib/plResMgr/plResManager.h +++ b/Sources/Plasma/PubUtilLib/plResMgr/plResManager.h @@ -135,7 +135,7 @@ public: //--------------------------- void LoadAgeKeys(const char* age); void DropAgeKeys(const char* age); - void PageInRoom(const plLocation& page, UInt16 objClassToRef, plRefMsg* refMsg); + void PageInRoom(const plLocation& page, uint16_t objClassToRef, plRefMsg* refMsg); void PageInAge(const char* age); // Usually, a page file is kept open during load because the first keyed object @@ -161,7 +161,7 @@ public: // Helpers for key iterators void LoadPageKeys(plRegistryPageNode* pageNode); - void UnloadPageObjects(plRegistryPageNode* pageNode, UInt16 classIndexHint); + void UnloadPageObjects(plRegistryPageNode* pageNode, uint16_t classIndexHint); void DumpUnusedKeys(plRegistryPageNode* page) const; plRegistryPageNode* FindPage(const plLocation& location) const; plRegistryPageNode* FindPage(const char* age, const char* page) const; @@ -179,7 +179,7 @@ protected: virtual hsBool IReadObject(plKeyImp* pKey, hsStream *stream); plCreatable* IReadCreatable(hsStream* s) const; - plKey ICloneKey(const plUoid& objUoid, UInt32 playerID, UInt32 cloneID); + plKey ICloneKey(const plUoid& objUoid, uint32_t playerID, uint32_t cloneID); virtual void IKeyReffed(plKeyImp* key); virtual void IKeyUnreffed(plKeyImp* key); @@ -209,7 +209,7 @@ protected: plRegistryPageNode* CreatePage(const plLocation& location, const char* age, const char* page); hsBool fInited; - UInt16 fPageOutHint; + uint16_t fPageOutHint; // True if we're reading in an object. We only read one object at a time hsBool fReadingObject; @@ -219,9 +219,9 @@ protected: plDispatch* fDispatch; - UInt32 fCurCloneID; // Current clone ID. If it isn't zero, we're cloning - UInt32 fCurClonePlayerID; - UInt32 fCloningCounter; // Next clone ID to use. + uint32_t fCurCloneID; // Current clone ID. If it isn't zero, we're cloning + uint32_t fCurClonePlayerID; + uint32_t fCloningCounter; // Next clone ID to use. typedef std::map HeldAgeKeyMap; HeldAgeKeyMap fHeldAgeKeys; @@ -231,7 +231,7 @@ protected: hsBool fLogReadTimes; - UInt8 fPageListLock; // Number of locks on the page lists. If it's greater than zero, they can't be modified + uint8_t fPageListLock; // Number of locks on the page lists. If it's greater than zero, they can't be modified hsBool fPagesNeedCleanup; // True if something modified the page lists while they were locked. typedef std::set PageSet; diff --git a/Sources/Plasma/PubUtilLib/plResMgr/plResManagerHelper.cpp b/Sources/Plasma/PubUtilLib/plResMgr/plResManagerHelper.cpp index 934dffc2..eb21d56f 100644 --- a/Sources/Plasma/PubUtilLib/plResMgr/plResManagerHelper.cpp +++ b/Sources/Plasma/PubUtilLib/plResMgr/plResManagerHelper.cpp @@ -50,7 +50,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // ////////////////////////////////////////////////////////////////////////////// -#include "hsTypes.h" +#include "HeadSpin.h" #include "plResManagerHelper.h" #include "plResManager.h" #include "plRegistryNode.h" @@ -174,8 +174,8 @@ void plResManagerHelper::LoadAndHoldPageKeys( plRegistryPageNode *page ) hsAssert( GetKey() != nil, "Can't load and hold keys when we don't have a key for the helper" ); // Create our msg - plResMgrHelperMsg *refferMsg = TRACKED_NEW plResMgrHelperMsg( plResMgrHelperMsg::kKeyRefList ); - refferMsg->fKeyList = TRACKED_NEW plResPageKeyRefList; + plResMgrHelperMsg *refferMsg = new plResMgrHelperMsg( plResMgrHelperMsg::kKeyRefList ); + refferMsg->fKeyList = new plResPageKeyRefList; fResManager->LoadPageKeys(page); page->IterateKeys( refferMsg->fKeyList ); @@ -214,7 +214,7 @@ class plResMgrDebugInterface : public plInputInterface plResMgrDebugInterface( plResManagerHelper * const mgr ) : fParent( mgr ) { SetEnabled( true ); } - virtual UInt32 GetPriorityLevel( void ) const { return kGUISystemPriority + 10; } + virtual uint32_t GetPriorityLevel( void ) const { return kGUISystemPriority + 10; } virtual hsBool InterpretInputEvent( plInputEventMsg *pMsg ) { plKeyEventMsg *pKeyMsg = plKeyEventMsg::ConvertNoRef( pMsg ); @@ -240,7 +240,7 @@ class plResMgrDebugInterface : public plInputInterface } else if( pKeyMsg->GetKeyCode() == KEY_ESCAPE ) { - plResMgrHelperMsg *msg = TRACKED_NEW plResMgrHelperMsg( plResMgrHelperMsg::kDisableDebugScreen ); + plResMgrHelperMsg *msg = new plResMgrHelperMsg( plResMgrHelperMsg::kDisableDebugScreen ); msg->Send( fParent->GetKey() ); return true; } @@ -268,7 +268,7 @@ class plResMgrDebugInterface : public plInputInterface return false; } - virtual UInt32 GetCurrentCursorID( void ) const { return 0; } + virtual uint32_t GetCurrentCursorID( void ) const { return 0; } virtual hsBool HasInterestingCursorID( void ) const { return false; } }; @@ -286,12 +286,12 @@ void plResManagerHelper::EnableDebugScreen( hsBool enable ) fDebugScreen = plStatusLogMgr::GetInstance().CreateStatusLog( kLogSize, "ResManager Status", plStatusLog::kFilledBackground | plStatusLog::kDontWriteFile ); fRefreshing = true; - plResMgrHelperMsg *msg = TRACKED_NEW plResMgrHelperMsg( plResMgrHelperMsg::kUpdateDebugScreen ); + plResMgrHelperMsg *msg = new plResMgrHelperMsg( plResMgrHelperMsg::kUpdateDebugScreen ); // msg->SetTimeStamp( hsTimer::GetSysSeconds() + kUpdateDelay ); msg->Send( GetKey() ); - fDebugInput = TRACKED_NEW plResMgrDebugInterface( this ); - plInputIfaceMgrMsg *imsg = TRACKED_NEW plInputIfaceMgrMsg( plInputIfaceMgrMsg::kAddInterface ); + fDebugInput = new plResMgrDebugInterface( this ); + plInputIfaceMgrMsg *imsg = new plInputIfaceMgrMsg( plInputIfaceMgrMsg::kAddInterface ); imsg->SetIFace( fDebugInput ); imsg->Send(); } @@ -304,7 +304,7 @@ void plResManagerHelper::EnableDebugScreen( hsBool enable ) delete fDebugScreen; fDebugScreen = nil; - plInputIfaceMgrMsg *imsg = TRACKED_NEW plInputIfaceMgrMsg( plInputIfaceMgrMsg::kRemoveInterface ); + plInputIfaceMgrMsg *imsg = new plInputIfaceMgrMsg( plInputIfaceMgrMsg::kRemoveInterface ); imsg->SetIFace( fDebugInput ); imsg->Send(); @@ -322,14 +322,14 @@ class plDebugPrintIterator : public plRegistryPageIterator, plRegistryKeyIterato { public: plStatusLog *fLog; - UInt8 fStep, fLines; - UInt32 &fLoadedCount, &fHoldingCount, fPageCount, fAgeIndex; + uint8_t fStep, fLines; + uint32_t &fLoadedCount, &fHoldingCount, fPageCount, fAgeIndex; char fCurrAge[ 128 ]; - UInt32 fLoadedKeys, fTotalKeys, fTotalSize, fLoadedSize; + uint32_t fLoadedKeys, fTotalKeys, fTotalSize, fLoadedSize; plResManagerHelper *fParent; - plDebugPrintIterator( plResManagerHelper *parent, plStatusLog *log, UInt32 &loadedCount, UInt32 &holdingCount ) + plDebugPrintIterator( plResManagerHelper *parent, plStatusLog *log, uint32_t &loadedCount, uint32_t &holdingCount ) : fParent( parent ), fLog( log ), fStep( 0 ), fLines( 0 ), fLoadedCount( loadedCount ), fHoldingCount( holdingCount ) { fLoadedCount = fHoldingCount = 0; @@ -368,7 +368,7 @@ class plDebugPrintIterator : public plRegistryPageIterator, plRegistryKeyIterato { if( fLines < kLogSize - 4 ) { - UInt32 color = plStatusLog::kWhite; + uint32_t color = plStatusLog::kWhite; if( fParent->fCurrAge == fAgeIndex ) color = plStatusLog::kYellow; @@ -491,7 +491,7 @@ void plResManagerHelper::IUpdateDebugScreen( hsBool force ) return; plRegistry *reg = fResManager->IGetRegistry(); - UInt32 loadedCnt, holdingCnt; + uint32_t loadedCnt, holdingCnt; fDebugScreen->Clear(); @@ -507,7 +507,7 @@ void plResManagerHelper::IUpdateDebugScreen( hsBool force ) // Repump our update if( !force ) { - plResMgrHelperMsg *msg = TRACKED_NEW plResMgrHelperMsg( plResMgrHelperMsg::kUpdateDebugScreen ); + plResMgrHelperMsg *msg = new plResMgrHelperMsg( plResMgrHelperMsg::kUpdateDebugScreen ); msg->SetTimeStamp( hsTimer::GetSysSeconds() + kUpdateDelay ); msg->Send( GetKey() ); } diff --git a/Sources/Plasma/PubUtilLib/plResMgr/plResManagerHelper.h b/Sources/Plasma/PubUtilLib/plResMgr/plResManagerHelper.h index 18ec8bba..5b956ac2 100644 --- a/Sources/Plasma/PubUtilLib/plResMgr/plResManagerHelper.h +++ b/Sources/Plasma/PubUtilLib/plResMgr/plResManagerHelper.h @@ -53,7 +53,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #ifndef _plResManagerHelper_h #define _plResManagerHelper_h -#include "hsTypes.h" +#include "HeadSpin.h" #include "hsTemplates.h" #include "plRegistryHelpers.h" #include "pnKeyedObject/hsKeyedObject.h" diff --git a/Sources/Plasma/PubUtilLib/plResMgr/plResMgrSettings.h b/Sources/Plasma/PubUtilLib/plResMgr/plResMgrSettings.h index c4ea9eb9..d10e82c8 100644 --- a/Sources/Plasma/PubUtilLib/plResMgr/plResMgrSettings.h +++ b/Sources/Plasma/PubUtilLib/plResMgr/plResMgrSettings.h @@ -53,7 +53,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #ifndef _plResMgrSettings_h #define _plResMgrSettings_h -#include "hsTypes.h" +#include "HeadSpin.h" class plResMgrSettings { @@ -63,7 +63,7 @@ protected: bool fFilterOlderPageVersions; bool fFilterNewerPageVersions; - UInt8 fLoggingLevel; + uint8_t fLoggingLevel; bool fPassiveKeyRead; bool fLoadPagesOnInit; @@ -93,8 +93,8 @@ public: bool GetFilterNewerPageVersions() const { return fFilterNewerPageVersions; } void SetFilterNewerPageVersions(bool f) { fFilterNewerPageVersions = f; } - UInt8 GetLoggingLevel() const { return fLoggingLevel; } - void SetLoggingLevel(UInt8 level) { fLoggingLevel = level; } + uint8_t GetLoggingLevel() const { return fLoggingLevel; } + void SetLoggingLevel(uint8_t level) { fLoggingLevel = level; } bool GetPassiveKeyRead() const { return fPassiveKeyRead; } void SetPassiveKeyRead(bool p) { fPassiveKeyRead = p; } diff --git a/Sources/Plasma/PubUtilLib/plResMgr/plVersion.cpp b/Sources/Plasma/PubUtilLib/plResMgr/plVersion.cpp index c50f4980..7d01a186 100644 --- a/Sources/Plasma/PubUtilLib/plResMgr/plVersion.cpp +++ b/Sources/Plasma/PubUtilLib/plResMgr/plVersion.cpp @@ -52,7 +52,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // creatable that was changed. Every time the minor version is reset (for a // major version change), delete all the entries. // -static void GetChangedCreatables(int minorVersion, std::vector& creatables) +static void GetChangedCreatables(int minorVersion, std::vector& creatables) { ChangedCreatable(1, plLoadAvatarMsg); ChangedCreatable(1, plArmatureMod); @@ -72,18 +72,18 @@ static void CalcCreatableVersions() for (int minorVer = 1; minorVer <= PLASMA2_MINOR_VERSION; minorVer++) { - std::vector changedTypes; + std::vector changedTypes; changedTypes.reserve(10); GetChangedCreatables(minorVer, changedTypes); for (int i = 0; i < changedTypes.size(); i++) { - UInt16 changedType = changedTypes[i]; + uint16_t changedType = changedTypes[i]; CreatableVersions[changedType] = minorVer; // Bump any classes that derive from this one - for (UInt16 toCheck = 0; toCheck < plFactory::GetNumClasses(); toCheck++) + for (uint16_t toCheck = 0; toCheck < plFactory::GetNumClasses(); toCheck++) { if (plFactory::DerivesFrom(changedType, toCheck)) CreatableVersions[toCheck] = minorVer; @@ -92,10 +92,10 @@ static void CalcCreatableVersions() } } -UInt16 plVersion::GetMajorVersion() { return PLASMA2_MAJOR_VERSION; } -UInt16 plVersion::GetMinorVersion() { return PLASMA2_MINOR_VERSION; } +uint16_t plVersion::GetMajorVersion() { return PLASMA2_MAJOR_VERSION; } +uint16_t plVersion::GetMinorVersion() { return PLASMA2_MINOR_VERSION; } -int plVersion::GetCreatableVersion(UInt16 creatableIndex) +int plVersion::GetCreatableVersion(uint16_t creatableIndex) { static bool calced = false; if (!calced) diff --git a/Sources/Plasma/PubUtilLib/plResMgr/plVersion.h b/Sources/Plasma/PubUtilLib/plResMgr/plVersion.h index 0d0a0c12..c915aae2 100644 --- a/Sources/Plasma/PubUtilLib/plResMgr/plVersion.h +++ b/Sources/Plasma/PubUtilLib/plResMgr/plVersion.h @@ -42,7 +42,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #ifndef plVersion_h_inc #define plVersion_h_inc -#include "hsTypes.h" +#include "HeadSpin.h" // RULES: // Log your change @@ -59,14 +59,14 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com class plVersion { public: - static UInt16 GetMajorVersion(); - static UInt16 GetMinorVersion(); + static uint16_t GetMajorVersion(); + static uint16_t GetMinorVersion(); // Pass in a creatable index to get its current version. Zero means it // hasn't changed since the last major version change, anything else is the // last minor version it changed at. This takes into account the version of // parent classes. - static int GetCreatableVersion(UInt16 creatableIndex); + static int GetCreatableVersion(uint16_t creatableIndex); }; /* Major Log ---Death to those who do not log changes--- @@ -138,7 +138,7 @@ public: 64 10/28/05 jeff changed plLocation to handle more pages and plUoid for optimization reasons 65 2/22/06 bob animation key rewrite to save space 66 2/27/06 bob 64-bit quaternion anim keys - 67 2/28/06 bob Anims store UInt16 frame numbers, not 32-bit float times. + 67 2/28/06 bob Anims store uint16_t frame numbers, not 32-bit float times. 68 3/03/06 bob constant anim channels (plMatrixConstant, plScalarConstant had no R/W methods) 69 5/08/06 bob changed plVertCoder and hsMatrix44::Read/Write 70 2/12/07 bob Merged in several registry/resMangaer fixes diff --git a/Sources/Plasma/PubUtilLib/plSDL/plSDL.h b/Sources/Plasma/PubUtilLib/plSDL/plSDL.h index 3e469a46..192efa2a 100644 --- a/Sources/Plasma/PubUtilLib/plSDL/plSDL.h +++ b/Sources/Plasma/PubUtilLib/plSDL/plSDL.h @@ -47,7 +47,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // #include "plSDLDescriptor.h" -#include "hsUtils.h" + #include "hsStlUtils.h" #include "pnFactory/plCreatable.h" @@ -112,8 +112,8 @@ public: void SetHintString(const char* c) { fHintString=c; } const char* GetHintString() const { return fHintString.c_str(); } - void Read(hsStream* s, UInt32 readOptions); - void Write(hsStream* s, UInt32 writeOptions) const; + void Read(hsStream* s, uint32_t readOptions); + void Write(hsStream* s, uint32_t writeOptions) const; }; // @@ -131,7 +131,7 @@ public: kUsed = 0x2 // true when it contains some value (either by Set(...) or Read() ) }; protected: - UInt32 fFlags; + uint32_t fFlags; plStateVarNotificationInfo fNotificationInfo; public: plStateVariable() : fFlags(0) {} @@ -164,8 +164,8 @@ public: virtual void DumpToStream(hsStream* stream, bool dirtyOnly, int level) const {} // IO - virtual bool ReadData(hsStream* s, float timeConvert, UInt32 readOptions); - virtual bool WriteData(hsStream* s, float timeConvert, UInt32 writeOptions) const; + virtual bool ReadData(hsStream* s, float timeConvert, uint32_t readOptions); + virtual bool WriteData(hsStream* s, float timeConvert, uint32_t writeOptions) const; }; // @@ -180,7 +180,7 @@ private: float fDelta; typedef std::vector KeyList; KeyList fKeys; // the objects to notify on change>delta - static UInt32 fCurrentPlayerID; + static uint32_t fCurrentPlayerID; void IAddKey(plKey k); int IRemoveKey(plKey k); @@ -198,8 +198,8 @@ public: bool GetValue(float* i) const; bool SetValue(float i); - static UInt32 GetCurrentPlayerID() { return fCurrentPlayerID; } - static void SetCurrentPlayerID(UInt32 p) { fCurrentPlayerID=p; } + static uint32_t GetCurrentPlayerID() { return fCurrentPlayerID; } + static void SetCurrentPlayerID(uint32_t p) { fCurrentPlayerID=p; } bool operator==(const plStateChangeNotifier &) const; }; @@ -210,7 +210,6 @@ public: class plUoid; class plKey; class plClientUnifiedTime; -typedef unsigned char byte; class plSimpleStateVariable : public plStateVariable { protected: @@ -218,7 +217,7 @@ protected: { int* fI; // array of int short* fS; // array of short - byte* fBy; // array of byte + uint8_t* fBy; // array of byte float* fF; // array of float double* fD; // array of double bool* fB; // array of bool @@ -250,8 +249,8 @@ protected: bool IConvertFromRGB8(plVarDescriptor::Type newType); bool IConvertFromRGBA8(plVarDescriptor::Type newType); - bool IReadData(hsStream* s, float timeConvert, int idx, UInt32 readOptions); - bool IWriteData(hsStream* s, float timeConvert, int idx, UInt32 writeOptions) const; + bool IReadData(hsStream* s, float timeConvert, int idx, uint32_t readOptions); + bool IWriteData(hsStream* s, float timeConvert, int idx, uint32_t writeOptions) const; public: @@ -266,7 +265,7 @@ public: void TimeStamp( const plUnifiedTime & ut=plUnifiedTime::GetCurrentTime() ); void CopyFrom(plVarDescriptor* v); - void CopyData(const plSimpleStateVariable* other, UInt32 writeOptions=0); + void CopyData(const plSimpleStateVariable* other, uint32_t writeOptions=0); bool SetFromString(const char* value, int idx, bool timeStampNow); // set value from string, type. return false on err char* GetAsString(int idx) const; bool ConvertTo(plSimpleVarDescriptor* toVar, bool force=false); // return false on err @@ -280,8 +279,8 @@ public: bool Set(double* v, int idx=0); // doubleVector bool Set(int v, int idx=0); bool Set(int* v, int idx=0) { return Set(*v, idx); } // helper since there is no int vec type - bool Set(byte v, int idx=0); - bool Set(byte* v, int idx=0); // byteVector + bool Set(uint8_t v, int idx=0); + bool Set(uint8_t* v, int idx=0); // uint8_tVector bool Set(short v, int idx=0); bool Set(short* v, int idx=0) { return Set(*v, idx); } // helper since there is no short vec type bool Set(bool v, int idx=0); @@ -294,7 +293,7 @@ public: // getters bool Get(int* value, int idx=0) const; bool Get(short* value, int idx=0) const; - bool Get(byte* value, int idx=0) const; // returns byte or byteVector + bool Get(uint8_t* value, int idx=0) const; // returns uint8_t or uint8_tVector bool Get(float* value, int idx=0) const; // returns float or floatVector bool Get(double* value, int idx=0) const; // returns double or doubleVector bool Get(bool* value, int idx=0) const; @@ -322,8 +321,8 @@ public: void DumpToStream(hsStream* stream, bool dirtyOnly, int level) const; // IO - bool ReadData(hsStream* s, float timeConvert, UInt32 readOptions); - bool WriteData(hsStream* s, float timeConvert, UInt32 writeOptions) const; + bool ReadData(hsStream* s, float timeConvert, uint32_t readOptions); + bool WriteData(hsStream* s, float timeConvert, uint32_t writeOptions) const; }; // @@ -351,8 +350,8 @@ public: bool operator==(const plSDStateVariable &other) const; // assumes matching var descriptors void ConvertTo(plSDStateVariable* otherSDVar, bool force=false); - void CopyFrom(plSDStateVariable* other, UInt32 writeOptions=0); - void UpdateFrom(plSDStateVariable* other, UInt32 writeOptions=0); + void CopyFrom(plSDStateVariable* other, uint32_t writeOptions=0); + void UpdateFrom(plSDStateVariable* other, uint32_t writeOptions=0); void AddStateDataRecord(plStateDataRecord *sdr) { fDataRecList.push_back(sdr); SetDirty(true); SetUsed(true); } void InsertStateDataRecord(plStateDataRecord *sdr, int i) { fDataRecList[i] = sdr; SetDirty(true); SetUsed(true);} void SetFromDefaults(bool timeStampNow); @@ -384,8 +383,8 @@ public: void DumpToStream(hsStream* stream, bool dirtyOnly, int level) const; // IO - bool ReadData(hsStream* s, float timeConvert, UInt32 readOptions); - bool WriteData(hsStream* s, float timeConvert, UInt32 writeOptions) const; + bool ReadData(hsStream* s, float timeConvert, uint32_t readOptions); + bool WriteData(hsStream* s, float timeConvert, uint32_t writeOptions) const; }; // @@ -408,8 +407,8 @@ protected: plUoid fAssocObject; // optional VarsList fVarsList; // list of variables VarsList fSDVarsList; // list of nested data records - UInt32 fFlags; - static const UInt8 kIOVersion; // I/O Version + uint32_t fFlags; + static const uint8_t kIOVersion; // I/O Version void IDeleteVarsList(VarsList& vars); void IInitDescriptor(const char* name, int version); // or plSDL::kLatestVersion @@ -433,22 +432,22 @@ public: plStateDataRecord(const char* sdName, int version=plSDL::kLatestVersion); plStateDataRecord(plStateDescriptor* sd); - plStateDataRecord(const plStateDataRecord &other, UInt32 writeOptions=0 ):fFlags(0) { CopyFrom(other, writeOptions); } + plStateDataRecord(const plStateDataRecord &other, uint32_t writeOptions=0 ):fFlags(0) { CopyFrom(other, writeOptions); } plStateDataRecord():fFlags(0) {} ~plStateDataRecord(); bool ConvertTo(plStateDescriptor* other, bool force=false ); bool operator==(const plStateDataRecord &other) const; // assumes matching state descriptors - UInt32 GetFlags() const { return fFlags; } - void SetFlags(UInt32 f) { fFlags =f; } + uint32_t GetFlags() const { return fFlags; } + void SetFlags(uint32_t f) { fFlags =f; } plSimpleStateVariable* FindVar(const char* name) const { return (plSimpleStateVariable*)IFindVar(fVarsList, name); } plSDStateVariable* FindSDVar(const char* name) const { return (plSDStateVariable*)IFindVar(fSDVarsList, name); } plStateDataRecord& operator=(const plStateDataRecord& other) { CopyFrom(other); return *this; } - void CopyFrom(const plStateDataRecord& other, UInt32 writeOptions=0); - void UpdateFrom(const plStateDataRecord& other, UInt32 writeOptions=0); + void CopyFrom(const plStateDataRecord& other, uint32_t writeOptions=0); + void UpdateFrom(const plStateDataRecord& other, uint32_t writeOptions=0); void SetFromDefaults(bool timeStampNow); void TimeStampDirtyVars(); @@ -482,7 +481,7 @@ public: const plStateDescriptor* GetDescriptor() const { return fDescriptor; } void SetDescriptor(const char* sdName, int version); - plNetMsgSDLState* PrepNetMsg(float timeConvert, UInt32 writeOptions) const; // create/prep a net msg with this data + plNetMsgSDLState* PrepNetMsg(float timeConvert, uint32_t writeOptions) const; // create/prep a net msg with this data void SetAssocObject(const plUoid& u) { fAssocObject=u; } // optional plUoid* GetAssocObject() { return &fAssocObject; } // optional @@ -496,8 +495,8 @@ public: void DumpToStream(hsStream* stream, const char* msg, bool dirtyOnly=false, int level=0) const; // IO - bool Read(hsStream* s, float timeConvert, UInt32 readOptions=0); - void Write(hsStream* s, float timeConvert, UInt32 writeOptions=0) const; + bool Read(hsStream* s, float timeConvert, uint32_t readOptions=0); + void Write(hsStream* s, float timeConvert, uint32_t writeOptions=0) const; static bool ReadStreamHeader(hsStream* s, char** name, int* version, plUoid* objUoid=nil); void WriteStreamHeader(hsStream* s, plUoid* objUoid=nil) const; @@ -536,7 +535,7 @@ private: std::string fSDLDir; plSDL::DescriptorList fDescriptors; plNetApp* fNetApp; - UInt32 fBehaviorFlags; + uint32_t fBehaviorFlags; void IDeleteDescriptors(plSDL::DescriptorList* dl); public: @@ -554,10 +553,10 @@ public: void SetNetApp(plNetApp* a) { fNetApp=a; } plNetApp* GetNetApp() const { return fNetApp; } - bool Init( UInt32 behaviorFlags=0 ); // parse sdl folder + bool Init( uint32_t behaviorFlags=0 ); // parse sdl folder void DeInit(); - UInt32 GetBehaviorFlags() const { return fBehaviorFlags; } - void SetBehaviorFlags(UInt32 v) { fBehaviorFlags=v; } + uint32_t GetBehaviorFlags() const { return fBehaviorFlags; } + void SetBehaviorFlags(uint32_t v) { fBehaviorFlags=v; } bool AllowTimeStamping() const { return ! ( fBehaviorFlags&plSDL::kDisallowTimeStamping ); } // I/O - return # of bytes read/written diff --git a/Sources/Plasma/PubUtilLib/plSDL/plSDLDescriptor.h b/Sources/Plasma/PubUtilLib/plSDL/plSDLDescriptor.h index 47eb2f8a..ad9a93c6 100644 --- a/Sources/Plasma/PubUtilLib/plSDL/plSDLDescriptor.h +++ b/Sources/Plasma/PubUtilLib/plSDL/plSDLDescriptor.h @@ -47,8 +47,8 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // These define a schema representing an object's saveState buffer. // -#include "hsTypes.h" -#include "hsUtils.h" +#include "HeadSpin.h" + #include "hsStlUtils.h" // @@ -98,13 +98,13 @@ public: kVariableLength = 0x4 // Var is defined as int foo[], so it's length is variable, starting at 0 }; protected: - static const UInt8 kVersion; // for Read/Write format + static const uint8_t kVersion; // for Read/Write format char* fDefault; // set by .sdl char* fName; // set by .sdl int fCount; // set by .sdl Type fType; // set by .sdl char* fTypeString; // string version of fType - UInt32 fFlags; + uint32_t fFlags; std::string fDisplayOptions; // set by .sdl public: plVarDescriptor(); @@ -221,7 +221,7 @@ class plKey; class plStateDescriptor { private: - static const UInt8 kVersion; // for Read/Write format + static const uint8_t kVersion; // for Read/Write format typedef std::vector VarsList; VarsList fVarsList; int fVersion; diff --git a/Sources/Plasma/PubUtilLib/plSDL/plSDLMgr.cpp b/Sources/Plasma/PubUtilLib/plSDL/plSDLMgr.cpp index 7584f876..a95f30b9 100644 --- a/Sources/Plasma/PubUtilLib/plSDL/plSDLMgr.cpp +++ b/Sources/Plasma/PubUtilLib/plSDL/plSDLMgr.cpp @@ -66,7 +66,7 @@ plSDLMgr::~plSDLMgr() DeInit(); } -bool plSDLMgr::Init( UInt32 behaviorFlags ) +bool plSDLMgr::Init( uint32_t behaviorFlags ) { fBehaviorFlags = behaviorFlags; plSDLParser parser; @@ -145,7 +145,7 @@ int plSDLMgr::Write(hsStream* s, const plSDL::DescriptorList* dl) if (dl==nil) dl=&fDescriptors; - UInt16 num=dl->size(); + uint16_t num=dl->size(); s->WriteLE(num); plSDL::DescriptorList::const_iterator it; @@ -174,7 +174,7 @@ int plSDLMgr::Read(hsStream* s, plSDL::DescriptorList* dl) // clear dl IDeleteDescriptors(dl); - UInt16 num; + uint16_t num; try { // read dtor list @@ -183,7 +183,7 @@ int plSDLMgr::Read(hsStream* s, plSDL::DescriptorList* dl) int i; for(i=0;iRead(s)) dl->push_back(sd); } diff --git a/Sources/Plasma/PubUtilLib/plSDL/plSDLParser.cpp b/Sources/Plasma/PubUtilLib/plSDL/plSDLParser.cpp index 41ff6361..ca30812c 100644 --- a/Sources/Plasma/PubUtilLib/plSDL/plSDLParser.cpp +++ b/Sources/Plasma/PubUtilLib/plSDL/plSDLParser.cpp @@ -39,7 +39,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com Mead, WA 99021 *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "hsStlUtils.h" #include "plSDL.h" #include "plFile/hsFiles.h" @@ -90,7 +90,7 @@ bool plSDLParser::IParseStateDesc(const char* fileName, hsStream* stream, char t // curDesc=plSDLMgr::GetInstance()->FindDescriptor(token, plSDL::kLatestVersion); // if (!curDesc) { - curDesc = TRACKED_NEW plStateDescriptor; + curDesc = new plStateDescriptor; curDesc->SetName(token); DebugMsg("SDL: DESC name=%s", token); @@ -182,10 +182,10 @@ bool plSDLParser::IParseVarDesc(const char* fileName, hsStream* stream, char tok plStateDescriptor* stateDesc = plSDLMgr::GetInstance()->FindDescriptor(sdlName, plSDL::kLatestVersion); hsAssert(stateDesc, xtl::format("can't find nested state desc reference %s, fileName=%s", sdlName, fileName).c_str()); - curVar = TRACKED_NEW plSDVarDescriptor(stateDesc); + curVar = new plSDVarDescriptor(stateDesc); } else - curVar = TRACKED_NEW plSimpleVarDescriptor; + curVar = new plSimpleVarDescriptor; curDesc->AddVar(curVar); bool ok=curVar->SetType(token); diff --git a/Sources/Plasma/PubUtilLib/plSDL/plStateChangeNotifier.cpp b/Sources/Plasma/PubUtilLib/plSDL/plStateChangeNotifier.cpp index b6519bd8..fdbf6e39 100644 --- a/Sources/Plasma/PubUtilLib/plSDL/plStateChangeNotifier.cpp +++ b/Sources/Plasma/PubUtilLib/plSDL/plStateChangeNotifier.cpp @@ -44,7 +44,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include // static -UInt32 plStateChangeNotifier::fCurrentPlayerID = 0; +uint32_t plStateChangeNotifier::fCurrentPlayerID = 0; plStateChangeNotifier::plStateChangeNotifier() : fDelta(0) @@ -123,7 +123,7 @@ bool plStateChangeNotifier::operator==(const plStateChangeNotifier &other) const void plStateChangeNotifier::SendNotificationMsg(const plSimpleStateVariable* srcVar, const plSimpleStateVariable* dstVar, const char* sdlName) { - plSDLNotificationMsg* m = TRACKED_NEW plSDLNotificationMsg; + plSDLNotificationMsg* m = new plSDLNotificationMsg; // add receivers KeyList::iterator kit=fKeys.begin(); diff --git a/Sources/Plasma/PubUtilLib/plSDL/plStateDataRecord.cpp b/Sources/Plasma/PubUtilLib/plSDL/plStateDataRecord.cpp index c8777ba2..2da31107 100644 --- a/Sources/Plasma/PubUtilLib/plSDL/plStateDataRecord.cpp +++ b/Sources/Plasma/PubUtilLib/plSDL/plStateDataRecord.cpp @@ -52,7 +52,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com const plString plSDL::kAgeSDLObjectName = _TEMP_CONVERT_FROM_LITERAL("AgeSDLHook"); // static -const UInt8 plStateDataRecord::kIOVersion=6; +const uint8_t plStateDataRecord::kIOVersion=6; // // helper @@ -155,12 +155,12 @@ void plStateDataRecord::IInitDescriptor(const plStateDescriptor* sd) { if (vd->GetAsSDVarDescriptor()) { // it's a var which references another state descriptor. - fSDVarsList.push_back(TRACKED_NEW plSDStateVariable(vd->GetAsSDVarDescriptor())); + fSDVarsList.push_back(new plSDStateVariable(vd->GetAsSDVarDescriptor())); } else { hsAssert(vd->GetAsSimpleVarDescriptor(), "var class problem"); - fVarsList.push_back(TRACKED_NEW plSimpleStateVariable(vd->GetAsSimpleVarDescriptor())); + fVarsList.push_back(new plSimpleStateVariable(vd->GetAsSimpleVarDescriptor())); } } } @@ -234,10 +234,10 @@ bool plStateDataRecord::IHasUsedVars(const VarsList& vars) const // // read state vars and indices, return true on success // -bool plStateDataRecord::Read(hsStream* s, float timeConvert, UInt32 readOptions) +bool plStateDataRecord::Read(hsStream* s, float timeConvert, uint32_t readOptions) { fFlags = s->ReadLE16(); - UInt8 ioVersion = s->ReadByte(); + uint8_t ioVersion = s->ReadByte(); if (ioVersion != kIOVersion) return false; @@ -333,7 +333,7 @@ bool plStateDataRecord::Read(hsStream* s, float timeConvert, UInt32 readOptions) // // write out the state vars, along with their index // -void plStateDataRecord::Write(hsStream* s, float timeConvert, UInt32 writeOptions) const +void plStateDataRecord::Write(hsStream* s, float timeConvert, uint32_t writeOptions) const { #ifdef HS_DEBUGGING if ( !plSDLMgr::GetInstance()->AllowTimeStamping() && (writeOptions & plSDL::kWriteTimeStamps) ) @@ -343,7 +343,7 @@ void plStateDataRecord::Write(hsStream* s, float timeConvert, UInt32 writeOption } #endif - s->WriteLE16((UInt16)fFlags); + s->WriteLE16((uint16_t)fFlags); s->WriteByte(kIOVersion); // @@ -394,7 +394,7 @@ void plStateDataRecord::Write(hsStream* s, float timeConvert, UInt32 writeOption // bool plStateDataRecord::ReadStreamHeader(hsStream* s, char** name, int* version, plUoid* objUoid) { - UInt16 savFlags; + uint16_t savFlags; s->ReadLE(&savFlags); if (!(savFlags & plSDL::kAddedVarLengthIO)) // using to establish a new version in the header, can delete in 8/03 { @@ -429,13 +429,13 @@ bool plStateDataRecord::ReadStreamHeader(hsStream* s, char** name, int* version, // void plStateDataRecord::WriteStreamHeader(hsStream* s, plUoid* objUoid) const { - UInt16 savFlags=plSDL::kAddedVarLengthIO; // using to establish a new version in the header, can delete in 8/03 + uint16_t savFlags=plSDL::kAddedVarLengthIO; // using to establish a new version in the header, can delete in 8/03 if (objUoid) savFlags |= plSDL::kHasUoid; s->WriteLE(savFlags); s->WriteSafeString(GetDescriptor()->GetName()); - s->WriteLE16((Int16)GetDescriptor()->GetVersion()); + s->WriteLE16((int16_t)GetDescriptor()->GetVersion()); if (objUoid) objUoid->Write(s); } @@ -443,7 +443,7 @@ void plStateDataRecord::WriteStreamHeader(hsStream* s, plUoid* objUoid) const // // create and prepare a net msg with this data // -plNetMsgSDLState* plStateDataRecord::PrepNetMsg(float timeConvert, UInt32 writeOptions) const +plNetMsgSDLState* plStateDataRecord::PrepNetMsg(float timeConvert, uint32_t writeOptions) const { // save to stream hsRAMStream stream; @@ -453,9 +453,9 @@ plNetMsgSDLState* plStateDataRecord::PrepNetMsg(float timeConvert, UInt32 writeO // fill in net msg plNetMsgSDLState* msg; if (writeOptions & plSDL::kBroadcast) - msg = TRACKED_NEW plNetMsgSDLStateBCast; + msg = new plNetMsgSDLStateBCast; else - msg = TRACKED_NEW plNetMsgSDLState; + msg = new plNetMsgSDLState; msg->StreamInfo()->CopyStream(&stream); return msg; @@ -464,7 +464,7 @@ plNetMsgSDLState* plStateDataRecord::PrepNetMsg(float timeConvert, UInt32 writeO // // Destroys 'this' and makes a total copy of other // -void plStateDataRecord::CopyFrom(const plStateDataRecord& other, UInt32 writeOptions/*=0*/) +void plStateDataRecord::CopyFrom(const plStateDataRecord& other, uint32_t writeOptions/*=0*/) { fFlags = other.GetFlags(); IInitDescriptor(other.GetDescriptor()); @@ -487,7 +487,7 @@ void plStateDataRecord::CopyFrom(const plStateDataRecord& other, UInt32 writeOpt // copy them to my corresponding item. // Requires that records have the same descriptor. // -void plStateDataRecord::UpdateFrom(const plStateDataRecord& other, UInt32 writeOptions/*=0*/) +void plStateDataRecord::UpdateFrom(const plStateDataRecord& other, uint32_t writeOptions/*=0*/) { if ( GetDescriptor()->GetVersion()!=other.GetDescriptor()->GetVersion() ) { diff --git a/Sources/Plasma/PubUtilLib/plSDL/plStateDescriptor.cpp b/Sources/Plasma/PubUtilLib/plSDL/plStateDescriptor.cpp index 0e4d69c5..f2d74fe8 100644 --- a/Sources/Plasma/PubUtilLib/plSDL/plStateDescriptor.cpp +++ b/Sources/Plasma/PubUtilLib/plSDL/plStateDescriptor.cpp @@ -43,7 +43,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "plSDL.h" #include "pnNetCommon/plNetApp.h" -const UInt8 plStateDescriptor::kVersion=1; // for Read/Write format +const uint8_t plStateDescriptor::kVersion=1; // for Read/Write format ///////////////////////////////////////////////////////////////////////////////// // STATE DESC @@ -85,7 +85,7 @@ plVarDescriptor* plStateDescriptor::FindVar(const char* name, int* idx) const // bool plStateDescriptor::Read(hsStream* s) { - UInt8 rwVersion; + uint8_t rwVersion; s->ReadLE(&rwVersion); if (rwVersion != kVersion) { @@ -98,21 +98,21 @@ bool plStateDescriptor::Read(hsStream* s) delete [] fName; fName = s->ReadSafeString(); - UInt16 version=s->ReadLE16(); + uint16_t version=s->ReadLE16(); fVersion=version; - UInt16 numVars=s->ReadLE16(); + uint16_t numVars=s->ReadLE16(); fVarsList.reserve(numVars); int i; for(i=0;iReadByte(); + uint8_t SDVar=s->ReadByte(); plVarDescriptor* var = nil; if (SDVar) - var = TRACKED_NEW plSDVarDescriptor; + var = new plSDVarDescriptor; else - var = TRACKED_NEW plSimpleVarDescriptor; + var = new plSimpleVarDescriptor; if (var->Read(s)) fVarsList.push_back(var); else @@ -130,16 +130,16 @@ void plStateDescriptor::Write(hsStream* s) const s->WriteSafeString(fName); - UInt16 version=fVersion; + uint16_t version=fVersion; s->WriteLE(version); - UInt16 numVars=fVarsList.size(); + uint16_t numVars=fVarsList.size(); s->WriteLE(numVars); VarsList::const_iterator it; for(it=fVarsList.begin(); it!=fVarsList.end(); it++) { - UInt8 SDVar = ((*it)->GetAsSDVarDescriptor() != nil); + uint8_t SDVar = ((*it)->GetAsSDVarDescriptor() != nil); s->WriteByte(SDVar); (*it)->Write(s); } diff --git a/Sources/Plasma/PubUtilLib/plSDL/plStateVariable.cpp b/Sources/Plasma/PubUtilLib/plSDL/plStateVariable.cpp index 63469006..4b08f612 100644 --- a/Sources/Plasma/PubUtilLib/plSDL/plStateVariable.cpp +++ b/Sources/Plasma/PubUtilLib/plSDL/plStateVariable.cpp @@ -86,16 +86,16 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com class plSDLCreatableStub : public plCreatable { private: - UInt16 fClassIndex; + uint16_t fClassIndex; public: void* fData; int fDataLen; - plSDLCreatableStub(UInt16 classIndex, int len) : fClassIndex(classIndex),fData(nil),fDataLen(len) {} + plSDLCreatableStub(uint16_t classIndex, int len) : fClassIndex(classIndex),fData(nil),fDataLen(len) {} ~plSDLCreatableStub() { delete[] (char*)fData; } const char* ClassName() const { return "SDLCreatable"; } - UInt16 ClassIndex() const { return fClassIndex; } + uint16_t ClassIndex() const { return fClassIndex; } void Read(hsStream* s, hsResMgr* mgr) { delete[] (char*)fData; fData = new char[fDataLen]; s->Read(fDataLen, fData); } void Write(hsStream* s, hsResMgr* mgr) { s->Write(fDataLen, fData); } @@ -105,9 +105,9 @@ public: // plStateVarNotificationInfo ///////////////////////////////////////////////////// -void plStateVarNotificationInfo::Read(hsStream* s, UInt32 readOptions) +void plStateVarNotificationInfo::Read(hsStream* s, uint32_t readOptions) { - UInt8 saveFlags=s->ReadByte(); // unused + uint8_t saveFlags=s->ReadByte(); // unused char* hint=s->ReadSafeString(); if (hint && !(readOptions & plSDL::kSkipNotificationInfo)) fHintString = (const char*)hint; @@ -115,9 +115,9 @@ void plStateVarNotificationInfo::Read(hsStream* s, UInt32 readOptions) delete[] hint; } -void plStateVarNotificationInfo::Write(hsStream* s, UInt32 writeOptions) const +void plStateVarNotificationInfo::Write(hsStream* s, uint32_t writeOptions) const { - UInt8 saveFlags=0; // unused + uint8_t saveFlags=0; // unused s->WriteLE(saveFlags); s->WriteSafeString(fHintString.c_str()); } @@ -125,9 +125,9 @@ void plStateVarNotificationInfo::Write(hsStream* s, UInt32 writeOptions) const ///////////////////////////////////////////////////// // plStateVariable ///////////////////////////////////////////////////// -bool plStateVariable::ReadData(hsStream* s, float timeConvert, UInt32 readOptions) +bool plStateVariable::ReadData(hsStream* s, float timeConvert, uint32_t readOptions) { - UInt8 saveFlags; + uint8_t saveFlags; s->ReadLE(&saveFlags); if (saveFlags & plSDL::kHasNotificationInfo) { @@ -136,11 +136,11 @@ bool plStateVariable::ReadData(hsStream* s, float timeConvert, UInt32 readOption return true; } -bool plStateVariable::WriteData(hsStream* s, float timeConvert, UInt32 writeOptions) const +bool plStateVariable::WriteData(hsStream* s, float timeConvert, uint32_t writeOptions) const { bool writeNotificationInfo = ((writeOptions & plSDL::kSkipNotificationInfo)==0); - UInt8 saveFlags=0; + uint8_t saveFlags=0; if (writeNotificationInfo) saveFlags |= plSDL::kHasNotificationInfo; @@ -225,7 +225,7 @@ void plSimpleStateVariable::IDeAlloc() #define SDLALLOC(typeName, type, var) \ case typeName: \ - var = TRACKED_NEW type[cnt]; \ + var = new type[cnt]; \ break; void plSimpleStateVariable::Alloc(int listSize) @@ -244,20 +244,20 @@ void plSimpleStateVariable::Alloc(int listSize) { SDLALLOC(plVarDescriptor::kInt, int, fI) SDLALLOC(plVarDescriptor::kAgeTimeOfDay, float, fF) - SDLALLOC(plVarDescriptor::kByte, byte, fBy) + SDLALLOC(plVarDescriptor::kByte, uint8_t, fBy) SDLALLOC(plVarDescriptor::kShort, short, fS) SDLALLOC(plVarDescriptor::kFloat, float, fF) SDLALLOC(plVarDescriptor::kDouble, double, fD) SDLALLOC(plVarDescriptor::kBool, bool, fB) SDLALLOC(plVarDescriptor::kCreatable, plCreatable*, fC) case plVarDescriptor::kTime: - fT = TRACKED_NEW plClientUnifiedTime[cnt]; + fT = new plClientUnifiedTime[cnt]; break; case plVarDescriptor::kKey: - fU = TRACKED_NEW plUoid[cnt]; + fU = new plUoid[cnt]; break; case plVarDescriptor::kString32: - fS32 = TRACKED_NEW plVarDescriptor::String32[cnt]; + fS32 = new plVarDescriptor::String32[cnt]; break; default: hsAssert(false, "undefined atomic type"); @@ -282,7 +282,7 @@ void plSimpleStateVariable::Reset() { RESET(plVarDescriptor::kInt, int, fI) RESET(plVarDescriptor::kAgeTimeOfDay, float, fF) - RESET(plVarDescriptor::kByte, byte, fBy) + RESET(plVarDescriptor::kByte, uint8_t, fBy) RESET(plVarDescriptor::kShort, short, fS) RESET(plVarDescriptor::kFloat, float, fF) RESET(plVarDescriptor::kDouble, double, fD) @@ -356,7 +356,7 @@ bool plSimpleStateVariable::SetFromString(const char* valueConst, int idx, bool else if (type==plVarDescriptor::kShort && fS) fS[i++] = (short)atoi(ptr); else if (type==plVarDescriptor::kByte && fBy) - fBy[i++] = (byte)atoi(ptr); + fBy[i++] = (uint8_t)atoi(ptr); else if ( (type==plVarDescriptor::kFloat || type==plVarDescriptor::kAgeTimeOfDay) && fF) fF[i++] = (float)atof(ptr); else if ( (type==plVarDescriptor::kDouble || type==plVarDescriptor::kTime) && fD) @@ -538,7 +538,7 @@ bool plSimpleStateVariable::IConvertFromRGB(plVarDescriptor::Type newType) { // rgb to rgba int i,j; - float* newF = TRACKED_NEW float[fVar.GetCount()*4]; // make more space + float* newF = new float[fVar.GetCount()*4]; // make more space for(j=0;j=0, "negative unified time"); fT[j+i].SetSecsDouble(newUt); } @@ -1941,10 +1937,10 @@ bool plSimpleStateVariable::IReadData(hsStream* s, float timeConvert, int idx, U case plVarDescriptor::kCreatable: { hsAssert(fVar.GetAtomicCount()==1, "invalid atomic count"); - UInt16 hClass = s->ReadLE16(); // class index + uint16_t hClass = s->ReadLE16(); // class index if (hClass != 0x8000) { - UInt32 len = s->ReadLE32(); // length + uint32_t len = s->ReadLE32(); // length if (plFactory::CanCreate(hClass)) { delete fC[j]; @@ -1952,7 +1948,7 @@ bool plSimpleStateVariable::IReadData(hsStream* s, float timeConvert, int idx, U } else { - plSDLCreatableStub* stub = TRACKED_NEW plSDLCreatableStub(hClass, len); + plSDLCreatableStub* stub = new plSDLCreatableStub(hClass, len); fC[j] = stub; } fC[j]->Read(s, hsgResMgr::ResMgr()); // data @@ -1968,7 +1964,7 @@ bool plSimpleStateVariable::IReadData(hsStream* s, float timeConvert, int idx, U } #pragma optimize( "", on ) // restore optimizations to their defaults -bool plSimpleStateVariable::WriteData(hsStream* s, float timeConvert, UInt32 writeOptions) const +bool plSimpleStateVariable::WriteData(hsStream* s, float timeConvert, uint32_t writeOptions) const { #ifdef HS_DEBUGGING if (!IsUsed()) @@ -2001,7 +1997,7 @@ bool plSimpleStateVariable::WriteData(hsStream* s, float timeConvert, UInt32 wri forceDirtyFlags = forceDirtyFlags || (!sameAsDefaults && (writeOptions & plSDL::kDirtyNonDefaults)!=0); // write save flags - UInt8 saveFlags = 0; + uint8_t saveFlags = 0; saveFlags |= writeTimeStamps ? plSDL::kHasTimeStamp : 0; saveFlags |= forceDirtyFlags || (writeDirtyFlags && IsDirty()) ? plSDL::kHasDirtyFlag : 0; saveFlags |= wantTimeStamp ? plSDL::kWantTimeStamp : 0; @@ -2039,7 +2035,7 @@ bool plSimpleStateVariable::WriteData(hsStream* s, float timeConvert, UInt32 wri } // assumes var is created from the right type of descriptor (count, type, etc.) -bool plSimpleStateVariable::ReadData(hsStream* s, float timeConvert, UInt32 readOptions) +bool plSimpleStateVariable::ReadData(hsStream* s, float timeConvert, uint32_t readOptions) { // read base class data plStateVariable::ReadData(s, timeConvert, readOptions); @@ -2047,7 +2043,7 @@ bool plSimpleStateVariable::ReadData(hsStream* s, float timeConvert, UInt32 read plUnifiedTime ut; ut.ToEpoch(); - UInt8 saveFlags; + uint8_t saveFlags; s->ReadLE(&saveFlags); bool isDirty = ( saveFlags & plSDL::kHasDirtyFlag )!=0; @@ -2069,7 +2065,7 @@ bool plSimpleStateVariable::ReadData(hsStream* s, float timeConvert, UInt32 read // read list size if (GetVarDescriptor()->IsVariableLength()) { - UInt32 cnt; + uint32_t cnt; s->ReadLE(&cnt); // have to read as long since we don't know how big the list is if (cnt>=0 && cntGetStateDescriptor()); + fDataRecList[i] = new plStateDataRecord(fVarDescriptor->GetStateDescriptor()); } SetDirty(true); @@ -2449,7 +2445,7 @@ void plSDStateVariable::Alloc(plSDVarDescriptor* sdvd, int listSize) { if (fVarDescriptor==nil) { - fVarDescriptor = TRACKED_NEW plSDVarDescriptor; + fVarDescriptor = new plSDVarDescriptor; fVarDescriptor->CopyFrom(sdvd); } @@ -2457,7 +2453,7 @@ void plSDStateVariable::Alloc(plSDVarDescriptor* sdvd, int listSize) fDataRecList.resize(cnt); int j; for (j=0;jGetStateDescriptor()), j); + InsertStateDataRecord(new plStateDataRecord(sdvd->GetStateDescriptor()), j); } } @@ -2485,7 +2481,7 @@ void plSDStateVariable::IDeInit() // // Make 'this' into a copy of 'other'. // -void plSDStateVariable::CopyFrom(plSDStateVariable* other, UInt32 writeOptions/*=0*/) +void plSDStateVariable::CopyFrom(plSDStateVariable* other, uint32_t writeOptions/*=0*/) { // IDeInit(); Alloc(other->GetSDVarDescriptor(), other->GetCount()); @@ -2499,7 +2495,7 @@ void plSDStateVariable::CopyFrom(plSDStateVariable* other, UInt32 writeOptions/* // copy them to my corresponding item. // Requires that records have the same descriptor. // -void plSDStateVariable::UpdateFrom(plSDStateVariable* other, UInt32 writeOptions/*=0*/) +void plSDStateVariable::UpdateFrom(plSDStateVariable* other, uint32_t writeOptions/*=0*/) { hsAssert(!stricmp(other->GetSDVarDescriptor()->GetName(), fVarDescriptor->GetName()), xtl::format("var descriptor mismatch in UpdateFrom, name %s,%s ver %d,%d", @@ -2600,17 +2596,17 @@ void plSDStateVariable::GetDirtyDataRecords(ConstDataRecList* recList) const // // read all SDVars // -bool plSDStateVariable::ReadData(hsStream* s, float timeConvert, UInt32 readOptions) +bool plSDStateVariable::ReadData(hsStream* s, float timeConvert, uint32_t readOptions) { plStateVariable::ReadData(s, timeConvert, readOptions); - UInt8 saveFlags; + uint8_t saveFlags; s->ReadLE(&saveFlags); // unused // read total list size if (GetVarDescriptor()->IsVariableLength()) { - UInt32 total; + uint32_t total; s->ReadLE(&total); Resize(total); } @@ -2645,15 +2641,15 @@ bool plSDStateVariable::ReadData(hsStream* s, float timeConvert, UInt32 readOpti // // write all SDVars // -bool plSDStateVariable::WriteData(hsStream* s, float timeConvert, UInt32 writeOptions) const +bool plSDStateVariable::WriteData(hsStream* s, float timeConvert, uint32_t writeOptions) const { plStateVariable::WriteData(s, timeConvert, writeOptions); - UInt8 saveFlags=0; // unused + uint8_t saveFlags=0; // unused s->WriteLE(saveFlags); // write total list size - UInt32 total=GetCount(); + uint32_t total=GetCount(); if (GetVarDescriptor()->IsVariableLength()) s->WriteLE(total); diff --git a/Sources/Plasma/PubUtilLib/plSDL/plVarDescriptor.cpp b/Sources/Plasma/PubUtilLib/plSDL/plVarDescriptor.cpp index e76b36ed..2a45fd98 100644 --- a/Sources/Plasma/PubUtilLib/plSDL/plVarDescriptor.cpp +++ b/Sources/Plasma/PubUtilLib/plSDL/plVarDescriptor.cpp @@ -49,7 +49,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "plUnifiedTime/plUnifiedTime.h" -const UInt8 plVarDescriptor::kVersion=3; // for Read/Write format +const uint8_t plVarDescriptor::kVersion=3; // for Read/Write format ///////////////////////////////////////////////////////////////////////////////// // State Var @@ -168,7 +168,7 @@ void plVarDescriptor::CopyFrom(const plVarDescriptor* other) // bool plVarDescriptor::Read(hsStream* s) { - UInt8 version; + uint8_t version; s->ReadLE(&version); if (version != kVersion) { @@ -203,7 +203,7 @@ void plVarDescriptor::Write(hsStream* s) const s->WriteSafeString(fName); plMsgStdStringHelper::Poke(fDisplayOptions, s); s->WriteLE32(fCount); - s->WriteByte((UInt8)fType); + s->WriteByte((uint8_t)fType); s->WriteSafeString(fDefault); s->WriteLE32(fFlags); } @@ -227,7 +227,7 @@ int plSimpleVarDescriptor::GetAtomicSize() const case kInt: return sizeof(int)*GetAtomicCount(); case kByte: - return sizeof(byte)*GetAtomicCount(); + return sizeof(uint8_t)*GetAtomicCount(); case kShort: return sizeof(short)*GetAtomicCount(); case kAgeTimeOfDay: @@ -375,8 +375,8 @@ void plSimpleVarDescriptor::Write(hsStream* s) const { plVarDescriptor::Write(s); - s->WriteLE16((Int16)fAtomicCount); - s->WriteByte((UInt8)fAtomicType); + s->WriteLE16((int16_t)fAtomicCount); + s->WriteByte((uint8_t)fAtomicType); } ///////////////////////////////////////////////////////////////////////////////// @@ -399,7 +399,7 @@ bool plSDVarDescriptor::Read(hsStream* s) return false; char* sdName=s->ReadSafeString(); - UInt16 version = s->ReadLE16(); + uint16_t version = s->ReadLE16(); plStateDescriptor* sd=plSDLMgr::GetInstance()->FindDescriptor(sdName, version); hsAssert( sd, xtl::format("Failed to find sdl descriptor: %s,%d. Missing legacy descriptor?", sdName, version ).c_str() ); SetStateDesc(sd); @@ -415,6 +415,6 @@ void plSDVarDescriptor::Write(hsStream* s) const plVarDescriptor::Write(s); s->WriteSafeString(GetStateDescriptor()->GetName()); - UInt16 version=GetStateDescriptor()->GetVersion(); + uint16_t version=GetStateDescriptor()->GetVersion(); s->WriteLE(version); } diff --git a/Sources/Plasma/PubUtilLib/plScene/plCullPoly.cpp b/Sources/Plasma/PubUtilLib/plScene/plCullPoly.cpp index 82f95558..fd3cd799 100644 --- a/Sources/Plasma/PubUtilLib/plScene/plCullPoly.cpp +++ b/Sources/Plasma/PubUtilLib/plScene/plCullPoly.cpp @@ -40,13 +40,13 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "plCullPoly.h" #include "hsMatrix44.h" #include "hsStream.h" #include "hsFastMath.h" -plCullPoly& plCullPoly::InitFromVerts(UInt32 f) +plCullPoly& plCullPoly::InitFromVerts(uint32_t f) { fFlags = f; @@ -66,20 +66,20 @@ plCullPoly& plCullPoly::InitFromVerts(UInt32 f) { fCenter += fVerts[i]; } - fCenter *= 1.f / hsScalar(fVerts.GetCount()); + fCenter *= 1.f / float(fVerts.GetCount()); fRadius = ICalcRadius(); return *this; } -hsScalar plCullPoly::ICalcRadius() const +float plCullPoly::ICalcRadius() const { - hsScalar radSq = 0; + float radSq = 0; int i; for( i = 0; i < fVerts.GetCount(); i++ ) { - hsScalar tmpSq = hsVector3(&fVerts[i], &fCenter).MagnitudeSquared(); + float tmpSq = hsVector3(&fVerts[i], &fCenter).MagnitudeSquared(); if( tmpSq > radSq ) radSq = tmpSq; } @@ -169,8 +169,8 @@ void plCullPoly::Write(hsStream* s, hsResMgr* mgr) #ifdef MF_VALIDATE_POLYS hsBool plCullPoly::Validate() const { - const hsScalar kMinMag = 1.e-8f; - hsScalar magSq = fNorm.MagnitudeSquared(); + const float kMinMag = 1.e-8f; + float magSq = fNorm.MagnitudeSquared(); if( magSq < kMinMag ) return false; if( fVerts.GetCount() < 3 ) diff --git a/Sources/Plasma/PubUtilLib/plScene/plCullPoly.h b/Sources/Plasma/PubUtilLib/plScene/plCullPoly.h index b9b14504..7af6ec62 100644 --- a/Sources/Plasma/PubUtilLib/plScene/plCullPoly.h +++ b/Sources/Plasma/PubUtilLib/plScene/plCullPoly.h @@ -51,7 +51,7 @@ class hsStream; class hsResMgr; struct hsMatrix44; -const hsScalar kCullPolyDegen = 1.e-4f; +const float kCullPolyDegen = 1.e-4f; class plCullPoly { @@ -62,17 +62,17 @@ public: kTwoSided = 0x2 }; - UInt32 fFlags; + uint32_t fFlags; mutable hsBitVector fClipped; // fClipped[i] => edge(fVerts[i], fVerts[(i+1)%n]) hsTArray fVerts; hsVector3 fNorm; - hsScalar fDist; + float fDist; hsPoint3 fCenter; - hsScalar fRadius; + float fRadius; const hsPoint3& GetCenter() const { return fCenter; } - hsScalar GetRadius() const { return fRadius; } + float GetRadius() const { return fRadius; } void SetHole(hsBool on) { if( on )fFlags |= kHole; else fFlags &= ~kHole; } void SetTwoSided(hsBool on) { if( on )fFlags |= kTwoSided; else fFlags &= ~kTwoSided; } @@ -82,8 +82,8 @@ public: plCullPoly& Init(const plCullPoly& p) { fClipped.Clear(); fVerts.SetCount(0); fFlags = p.fFlags; fNorm = p.fNorm; fDist = p.fDist; fCenter = p.fCenter; return *this; } plCullPoly& Flip(const plCullPoly& p); - plCullPoly& InitFromVerts(UInt32 f=kNone); - hsScalar ICalcRadius() const; + plCullPoly& InitFromVerts(uint32_t f=kNone); + float ICalcRadius() const; plCullPoly& Transform(const hsMatrix44& l2w, const hsMatrix44& w2l, plCullPoly& dst) const; diff --git a/Sources/Plasma/PubUtilLib/plScene/plOccTree.cpp b/Sources/Plasma/PubUtilLib/plScene/plOccTree.cpp index 7a101f53..c499aa73 100644 --- a/Sources/Plasma/PubUtilLib/plScene/plOccTree.cpp +++ b/Sources/Plasma/PubUtilLib/plScene/plOccTree.cpp @@ -175,7 +175,7 @@ plOccNode* plOccTree::IAddPolyRecur(plOccNode* node, plOccPoly* poly) plOccPoly* outPoly = nil; - UInt32 test = ITestPoly(node->fPlane, poly, inPoly, outPoly); + uint32_t test = ITestPoly(node->fPlane, poly, inPoly, outPoly); switch( test ) { diff --git a/Sources/Plasma/PubUtilLib/plScene/plOccTree.h b/Sources/Plasma/PubUtilLib/plScene/plOccTree.h index b5d96a0a..e3b70a01 100644 --- a/Sources/Plasma/PubUtilLib/plScene/plOccTree.h +++ b/Sources/Plasma/PubUtilLib/plScene/plOccTree.h @@ -66,7 +66,7 @@ public: plOccPlane fPlane; hsTArray fVerts; - hsTArray fEdgeFlags; // flag[i] => edge(fVerts[i], fVerts[(i+1)%n]) + hsTArray fEdgeFlags; // flag[i] => edge(fVerts[i], fVerts[(i+1)%n]) }; class plOccNode @@ -82,7 +82,7 @@ protected: kSplit = 0x2 }; - UInt32 fFlags; + uint32_t fFlags; plOccPlane fPolyPlane; // Plane of the poly we came from plOccPlane fViewPlane; // Plane perp to view dir. @@ -106,7 +106,7 @@ protected: kNeedsBuild = 0x1 }; - UInt8 fFlags; + uint8_t fFlags; // Temp pools for building our trees each frame. hsTArray fPolyPool; diff --git a/Sources/Plasma/PubUtilLib/plScene/plOccluder.cpp b/Sources/Plasma/PubUtilLib/plScene/plOccluder.cpp index f9493bc6..669e1362 100644 --- a/Sources/Plasma/PubUtilLib/plScene/plOccluder.cpp +++ b/Sources/Plasma/PubUtilLib/plScene/plOccluder.cpp @@ -40,7 +40,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "plOccluder.h" #include "hsStream.h" #include "plOccluderProxy.h" @@ -58,7 +58,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com plOccluder::plOccluder() : fSceneNode(nil) { - fProxyGen = TRACKED_NEW plOccluderProxy; + fProxyGen = new plOccluderProxy; fProxyGen->Init(this); fVisSet.SetBit(0); @@ -130,12 +130,12 @@ void plOccluder::IRemoveVisRegion(plVisRegion* reg) } } -plDrawableSpans* plOccluder::CreateProxy(hsGMaterial* mat, hsTArray& idx, plDrawableSpans* addTo) +plDrawableSpans* plOccluder::CreateProxy(hsGMaterial* mat, hsTArray& idx, plDrawableSpans* addTo) { hsTArray pos; hsTArray norm; hsTArray color; - hsTArray tris; + hsTArray tris; plLayer* lay = plLayer::ConvertNoRef(mat->GetLayer(0)->BottomOfStack()); if( lay ) @@ -238,9 +238,9 @@ void plOccluder::IComputeBounds() } } -hsScalar plOccluder::IComputeSurfaceArea() +float plOccluder::IComputeSurfaceArea() { - hsScalar area = 0; + float area = 0; const hsTArray& polys = GetLocalPolyList(); int i; for( i =0 ; i < polys.GetCount(); i++ ) @@ -258,7 +258,7 @@ hsScalar plOccluder::IComputeSurfaceArea() void plOccluder::SetPolyList(const hsTArray& list) { - UInt16 n = list.GetCount(); + uint16_t n = list.GetCount(); fPolys.SetCount(n); int i; for( i = 0; i < n; i++ ) @@ -271,7 +271,7 @@ void plOccluder::ISetSceneNode(plKey node) { if( node ) { - plNodeRefMsg* refMsg = TRACKED_NEW plNodeRefMsg(node, plRefMsg::kOnCreate, -1, plNodeRefMsg::kOccluder); + plNodeRefMsg* refMsg = new plNodeRefMsg(node, plRefMsg::kOnCreate, -1, plNodeRefMsg::kOccluder); hsgResMgr::ResMgr()->AddViaNotify(GetKey(), refMsg, plRefFlags::kPassiveRef); } if( fSceneNode ) @@ -290,7 +290,7 @@ void plOccluder::Read(hsStream* s, hsResMgr* mgr) fPriority = s->ReadLEScalar(); hsTArray& localPolys = IGetLocalPolyList(); - UInt16 n = s->ReadLE16(); + uint16_t n = s->ReadLE16(); localPolys.SetCount(n); int i; for( i = 0; i < n; i++ ) @@ -302,7 +302,7 @@ void plOccluder::Read(hsStream* s, hsResMgr* mgr) n = s->ReadLE16(); fVisRegions.SetCountAndZero(n); for( i = 0; i < n; i++ ) - mgr->ReadKeyNotifyMe(s, TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnCreate, 0, kRefVisRegion), plRefFlags::kActiveRef); + mgr->ReadKeyNotifyMe(s, new plGenRefMsg(GetKey(), plRefMsg::kOnCreate, 0, kRefVisRegion), plRefFlags::kActiveRef); } void plOccluder::Write(hsStream* s, hsResMgr* mgr) @@ -360,7 +360,7 @@ void plMobileOccluder::SetTransform(const hsMatrix44& l2w, const hsMatrix44& w2l void plMobileOccluder::SetPolyList(const hsTArray& list) { - UInt16 n = list.GetCount(); + uint16_t n = list.GetCount(); fOrigPolys.SetCount(n); fPolys.SetCount(n); diff --git a/Sources/Plasma/PubUtilLib/plScene/plOccluder.h b/Sources/Plasma/PubUtilLib/plScene/plOccluder.h index 2acdf706..dc4e0efb 100644 --- a/Sources/Plasma/PubUtilLib/plScene/plOccluder.h +++ b/Sources/Plasma/PubUtilLib/plScene/plOccluder.h @@ -75,12 +75,12 @@ protected: hsTArray fVisRegions; hsBitVector fVisNot; - hsScalar fPriority; + float fPriority; hsBounds3Ext fWorldBounds; plKey fSceneNode; - virtual hsScalar IComputeSurfaceArea(); + virtual float IComputeSurfaceArea(); virtual void IComputeBounds(); virtual hsTArray& IGetLocalPolyList() { return fPolys; } @@ -99,7 +99,7 @@ public: virtual hsBool MsgReceive(plMessage* msg); - virtual hsScalar GetPriority() const { return fPriority; } + virtual float GetPriority() const { return fPriority; } hsBool InVisSet(const hsBitVector& visSet) const { return fVisSet.Overlap(visSet); } hsBool InVisNot(const hsBitVector& visNot) const { return fVisNot.Overlap(visNot); } @@ -114,13 +114,13 @@ public: virtual const hsTArray& GetWorldPolyList() const { return fPolys; } virtual const hsTArray& GetLocalPolyList() const { return fPolys; } - virtual Int32 GetNumProperties() const { return kNumProps; } + virtual int32_t GetNumProperties() const { return kNumProps; } virtual void Read(hsStream* s, hsResMgr* mgr); virtual void Write(hsStream* s, hsResMgr* mgr); // Visualization - virtual plDrawableSpans* CreateProxy(hsGMaterial* mat, hsTArray& idx, plDrawableSpans* addTo); + virtual plDrawableSpans* CreateProxy(hsGMaterial* mat, hsTArray& idx, plDrawableSpans* addTo); // Export only function to initialize. virtual void ComputeFromPolys(); diff --git a/Sources/Plasma/PubUtilLib/plScene/plOccluderProxy.cpp b/Sources/Plasma/PubUtilLib/plScene/plOccluderProxy.cpp index f004f523..2b5332ba 100644 --- a/Sources/Plasma/PubUtilLib/plScene/plOccluderProxy.cpp +++ b/Sources/Plasma/PubUtilLib/plScene/plOccluderProxy.cpp @@ -40,7 +40,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "plOccluderProxy.h" #include "plOccluder.h" #include "plDrawable/plDrawableSpans.h" @@ -72,7 +72,7 @@ plKey plOccluderProxy::IGetNode() const return fOwner ? fOwner->GetSceneNode() : nil; } -plDrawableSpans* plOccluderProxy::ICreateProxy(hsGMaterial* mat, hsTArray& idx, plDrawableSpans* addTo) +plDrawableSpans* plOccluderProxy::ICreateProxy(hsGMaterial* mat, hsTArray& idx, plDrawableSpans* addTo) { if( fOwner ) { diff --git a/Sources/Plasma/PubUtilLib/plScene/plOccluderProxy.h b/Sources/Plasma/PubUtilLib/plScene/plOccluderProxy.h index ee975c43..bf026ee8 100644 --- a/Sources/Plasma/PubUtilLib/plScene/plOccluderProxy.h +++ b/Sources/Plasma/PubUtilLib/plScene/plOccluderProxy.h @@ -55,7 +55,7 @@ protected: plOccluder* fOwner; - virtual plDrawableSpans* ICreateProxy(hsGMaterial* mat, hsTArray& idx, plDrawableSpans* addTo=nil); + virtual plDrawableSpans* ICreateProxy(hsGMaterial* mat, hsTArray& idx, plDrawableSpans* addTo=nil); virtual plKey IGetNode() const; public: plOccluderProxy(); diff --git a/Sources/Plasma/PubUtilLib/plScene/plPageTreeMgr.cpp b/Sources/Plasma/PubUtilLib/plScene/plPageTreeMgr.cpp index bc46e908..737499c0 100644 --- a/Sources/Plasma/PubUtilLib/plScene/plPageTreeMgr.cpp +++ b/Sources/Plasma/PubUtilLib/plScene/plPageTreeMgr.cpp @@ -40,7 +40,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "plPageTreeMgr.h" #include "plDrawable/plSpaceTreeMaker.h" #include "plDrawable/plSpaceTree.h" @@ -116,7 +116,7 @@ hsBool plPageTreeMgr::Harvest(plVolumeIsect* isect, hsTArray& lev if( !(GetSpaceTree() || IBuildSpaceTree()) ) return false; - static hsTArray list; + static hsTArray list; GetSpaceTree()->HarvestLeaves(isect, list); @@ -139,7 +139,7 @@ int plPageTreeMgr::Render(plPipeline* pipe) if( !(GetSpaceTree() || IBuildSpaceTree()) ) return 0; - static hsTArray list; + static hsTArray list; list.SetCount(0); plProfile_BeginTiming(RenderScene); @@ -276,7 +276,7 @@ hsBool plPageTreeMgr::ISortByLevel(plPipeline* pipe, hsTArray& dr // Returns the index of the last one drawn. int plPageTreeMgr::IPrepForRenderSortingSpans(plPipeline* pipe, hsTArray& drawVis, int& iDrawStart) { - UInt32 renderLevel = drawVis[iDrawStart].fDrawable->GetRenderLevel().Level(); + uint32_t renderLevel = drawVis[iDrawStart].fDrawable->GetRenderLevel().Level(); int i; @@ -308,7 +308,7 @@ int plPageTreeMgr::IPrepForRenderSortingSpans(plPipeline* pipe, hsTArray& visList = drawVis[iDraw].fVisList; + hsTArray& visList = drawVis[iDraw].fVisList; for( i = 0; i < visList.GetCount(); i++ ) { plDrawSpanPair* pair = pairs.Push(); @@ -354,14 +354,14 @@ hsBool plPageTreeMgr::IRenderSortingSpans(plPipeline* pipe, hsTArrayfDrawable; listTrav = &scratchList[iSort++]; - listTrav->fBody = (void*)*(UInt32*)&pairs[i]; + listTrav->fBody = (void*)*(uint32_t*)&pairs[i]; listTrav->fNext = listTrav + 1; if( drawable->GetNativeProperty(plDrawable::kPropSortAsOne) ) { const hsBounds3Ext& bnd = drawable->GetSpaceTree()->GetNode(drawable->GetSpaceTree()->GetRoot()).fWorldBounds; - plConst(hsScalar) kDistFudge(1.e-1f); - listTrav->fKey.fFloat = -(bnd.GetCenter() - viewPos).MagnitudeSquared() + hsScalar(pairs[i].fSpan) * kDistFudge; + plConst(float) kDistFudge(1.e-1f); + listTrav->fKey.fFloat = -(bnd.GetCenter() - viewPos).MagnitudeSquared() + float(pairs[i].fSpan) * kDistFudge; } else { @@ -381,7 +381,7 @@ hsBool plPageTreeMgr::IRenderSortingSpans(plPipeline* pipe, hsTArray visList; + static hsTArray visList; visList.SetCount(0); plVisMgr* visMgr = fDisableVisMgr ? nil : fVisMgr; @@ -449,7 +449,7 @@ hsBool plPageTreeMgr::IRenderSortingSpans(plPipeline* pipe, hsTArrayfNext; - static hsTArray numDrawn; + static hsTArray numDrawn; numDrawn.SetCountAndZero(drawList.GetCount()); visList.Append(drawList[curDraw]->fVisList[numDrawn[curDraw]++]); @@ -632,7 +632,7 @@ hsBool plPageTreeMgr::IGetCullPolys(plPipeline* pipe) { if( pipe->TestVisibleWorld(fOccluders[i]->GetWorldBounds()) ) { - hsScalar invDist = -hsFastMath::InvSqrtAppr((viewPos - fOccluders[i]->GetWorldBounds().GetCenter()).MagnitudeSquared()); + float invDist = -hsFastMath::InvSqrtAppr((viewPos - fOccluders[i]->GetWorldBounds().GetCenter()).MagnitudeSquared()); listTrav = &scratchList[numSubmit++]; listTrav->fBody = (void*)fOccluders[i]; listTrav->fNext = listTrav+1; @@ -653,7 +653,7 @@ hsBool plPageTreeMgr::IGetCullPolys(plPipeline* pipe) hsRadixSort::Elem* sortedList = rad.Sort(scratchList.AcquireArray(), 0); listTrav = sortedList; - const UInt32 kMaxOccluders = 1000; + const uint32_t kMaxOccluders = 1000; if( numSubmit > kMaxOccluders ) numSubmit = kMaxOccluders; @@ -673,7 +673,7 @@ hsBool plPageTreeMgr::IGetCullPolys(plPipeline* pipe) return fCullPolys.GetCount() > 0; } -hsBool plPageTreeMgr::IGetOcclusion(plPipeline* pipe, hsTArray& list) +hsBool plPageTreeMgr::IGetOcclusion(plPipeline* pipe, hsTArray& list) { plProfile_BeginTiming(DrawOccBuild); diff --git a/Sources/Plasma/PubUtilLib/plScene/plPageTreeMgr.h b/Sources/Plasma/PubUtilLib/plScene/plPageTreeMgr.h index a0adec02..a49f06ab 100644 --- a/Sources/Plasma/PubUtilLib/plScene/plPageTreeMgr.h +++ b/Sources/Plasma/PubUtilLib/plScene/plPageTreeMgr.h @@ -59,9 +59,9 @@ class plDrawSpanPair { public: plDrawSpanPair() {} - plDrawSpanPair(UInt16 d, UInt16 s) : fDrawable(d), fSpan(s) {} - UInt16 fDrawable; - UInt16 fSpan; + plDrawSpanPair(uint16_t d, uint16_t s) : fDrawable(d), fSpan(s) {} + uint16_t fDrawable; + uint16_t fSpan; }; class plDrawVisList @@ -71,7 +71,7 @@ public: virtual ~plDrawVisList() {} plDrawable* fDrawable; - hsTArray fVisList; + hsTArray fVisList; plDrawVisList& operator=(const plDrawVisList& v) { fDrawable = v.fDrawable; fVisList = v.fVisList; return *this; } }; @@ -94,7 +94,7 @@ protected: hsBool IBuildSpaceTree(); hsBool IRefreshTree(plPipeline* pipe); void ISortCullPolys(plPipeline* pipe); - hsBool IGetOcclusion(plPipeline* pipe, hsTArray& list); + hsBool IGetOcclusion(plPipeline* pipe, hsTArray& list); hsBool IGetCullPolys(plPipeline* pipe); void IResetOcclusion(plPipeline* pipe); void IAddCullPolyList(const hsTArray& polyList); diff --git a/Sources/Plasma/PubUtilLib/plScene/plPostEffectMod.cpp b/Sources/Plasma/PubUtilLib/plScene/plPostEffectMod.cpp index b9e4b911..46ba42f1 100644 --- a/Sources/Plasma/PubUtilLib/plScene/plPostEffectMod.cpp +++ b/Sources/Plasma/PubUtilLib/plScene/plPostEffectMod.cpp @@ -40,7 +40,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "plPostEffectMod.h" #include "plPageTreeMgr.h" #include "plSceneNode.h" @@ -64,8 +64,8 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com plPostEffectMod::plPostEffectMod() : fHither(1.f), fYon(100.f), - fFovX(hsScalarPI * 0.25f), - fFovY(hsScalarPI * 0.25f * 0.75f), + fFovX(M_PI * 0.25f), + fFovY(M_PI * 0.25f * 0.75f), fPageMgr(nil), fRenderTarget(nil), fRenderRequest(nil) @@ -83,18 +83,18 @@ plPostEffectMod::~plPostEffectMod() void plPostEffectMod::ISetupRenderRequest() { - UInt32 rtFlags = 0; + uint32_t rtFlags = 0; // If we go to rendering to sub-window, we'll want to explicitly set width and height - UInt32 width = 0; - UInt32 height = 0; + uint32_t width = 0; + uint32_t height = 0; - UInt32 colorDepth = 0; - UInt32 zDepth = 0; - UInt32 stencilDepth = 0; + uint32_t colorDepth = 0; + uint32_t zDepth = 0; + uint32_t stencilDepth = 0; - fRenderRequest = TRACKED_NEW plRenderRequest; - UInt32 renderState = plPipeline::kRenderNormal + fRenderRequest = new plRenderRequest; + uint32_t renderState = plPipeline::kRenderNormal | plPipeline::kRenderNoProjection | plPipeline::kRenderNoLights | plPipeline::kRenderClearDepth; @@ -107,7 +107,7 @@ void plPostEffectMod::ISetupRenderRequest() fRenderRequest->SetRenderTarget(fRenderTarget); - fPageMgr = TRACKED_NEW plPageTreeMgr; + fPageMgr = new plPageTreeMgr; fRenderRequest->SetPageTreeMgr(fPageMgr); @@ -157,7 +157,7 @@ hsBool plPostEffectMod::IIsEnabled() const return /*GetTarget() &&*/ !fPageMgr->Empty() && fState.IsBitSet(kEnabled); } -hsBool plPostEffectMod::IEval(double secs, hsScalar del, UInt32 dirty) +hsBool plPostEffectMod::IEval(double secs, float del, uint32_t dirty) { return false; } @@ -223,7 +223,7 @@ void plPostEffectMod::ISubmitRequest() IUpdateRenderRequest(); - plRenderRequestMsg* req = TRACKED_NEW plRenderRequestMsg(GetKey(), fRenderRequest); + plRenderRequestMsg* req = new plRenderRequestMsg(GetKey(), fRenderRequest); plgDispatch::MsgSend(req); } @@ -305,7 +305,7 @@ void plPostEffectMod::Read(hsStream* s, hsResMgr* mgr) fFovX = s->ReadLEScalar(); fFovY = s->ReadLEScalar(); - fNodeKey = mgr->ReadKeyNotifyMe(s, TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnCreate, -1, kNodeRef), plRefFlags::kPassiveRef); + fNodeKey = mgr->ReadKeyNotifyMe(s, new plGenRefMsg(GetKey(), plRefMsg::kOnCreate, -1, kNodeRef), plRefFlags::kPassiveRef); fDefaultW2C.Read( s ); fDefaultC2W.Read( s ); @@ -334,4 +334,4 @@ const plViewTransform& plPostEffectMod::GetViewTransform() { IUpdateRenderRequest(); return fRenderRequest->GetViewTransform(); -} \ No newline at end of file +} diff --git a/Sources/Plasma/PubUtilLib/plScene/plPostEffectMod.h b/Sources/Plasma/PubUtilLib/plScene/plPostEffectMod.h index 533dc48b..fb3f315e 100644 --- a/Sources/Plasma/PubUtilLib/plScene/plPostEffectMod.h +++ b/Sources/Plasma/PubUtilLib/plScene/plPostEffectMod.h @@ -69,11 +69,11 @@ protected: hsBitVector fState; - hsScalar fHither; - hsScalar fYon; + float fHither; + float fYon; - hsScalar fFovX; - hsScalar fFovY; + float fFovX; + float fFovY; plKey fNodeKey; plPageTreeMgr* fPageMgr; @@ -84,7 +84,7 @@ protected: hsMatrix44 fDefaultW2C, fDefaultC2W; - virtual hsBool IEval(double secs, hsScalar del, UInt32 dirty); // called only by owner object's Eval() + virtual hsBool IEval(double secs, float del, uint32_t dirty); // called only by owner object's Eval() void ISetupRenderRequest(); void IDestroyRenderRequest(); @@ -118,15 +118,15 @@ public: void SetNodeKey(plKey key) { fNodeKey = key; } plKey GetNodeKey() const { return fNodeKey; } - void SetHither(hsScalar h) { fHither = h; } - void SetYon(hsScalar y) { fYon = y; } - void SetFovX(hsScalar f) { fFovX = f; } - void SetFovY(hsScalar f) { fFovY = f; } + void SetHither(float h) { fHither = h; } + void SetYon(float y) { fYon = y; } + void SetFovX(float f) { fFovX = f; } + void SetFovY(float f) { fFovY = f; } - hsScalar GetHither() const { return fHither; } - hsScalar GetYon() const { return fYon; } - hsScalar GetFovX() const { return fFovX; } - hsScalar GetFovY() const { return fFovY; } + float GetHither() const { return fHither; } + float GetYon() const { return fYon; } + float GetFovX() const { return fFovX; } + float GetFovY() const { return fFovY; } plPageTreeMgr* GetPageMgr() const { return fPageMgr; } diff --git a/Sources/Plasma/PubUtilLib/plScene/plRelevanceMgr.cpp b/Sources/Plasma/PubUtilLib/plScene/plRelevanceMgr.cpp index 50e6946f..44f785e2 100644 --- a/Sources/Plasma/PubUtilLib/plScene/plRelevanceMgr.cpp +++ b/Sources/Plasma/PubUtilLib/plScene/plRelevanceMgr.cpp @@ -53,7 +53,7 @@ plRelevanceMgr::plRelevanceMgr() : fEnabled(true) void plRelevanceMgr::Init() { - fInstance = TRACKED_NEW plRelevanceMgr; + fInstance = new plRelevanceMgr; fInstance->RegisterAs(kRelevanceMgr_KEY); } @@ -119,7 +119,7 @@ void plRelevanceMgr::SetRegionVectors(const hsPoint3 &pos, hsBitVector ®ionsI } } -UInt32 plRelevanceMgr::GetNumRegions() const +uint32_t plRelevanceMgr::GetNumRegions() const { int i; @@ -149,7 +149,7 @@ hsBool plRelevanceMgr::MsgReceive(plMessage* msg) return hsKeyedObject::MsgReceive(msg); } -UInt32 plRelevanceMgr::GetIndex(const plString ®ionName) +uint32_t plRelevanceMgr::GetIndex(const plString ®ionName) { int i; for (i = 0; i < fRegions.GetCount(); i++) @@ -161,9 +161,9 @@ UInt32 plRelevanceMgr::GetIndex(const plString ®ionName) return -1; } -void plRelevanceMgr::MarkRegion(UInt32 localIdx, UInt32 remoteIdx, hsBool doICare) +void plRelevanceMgr::MarkRegion(uint32_t localIdx, uint32_t remoteIdx, hsBool doICare) { - if (localIdx == (UInt32)-1 || remoteIdx == (UInt32)-1) + if (localIdx == (uint32_t)-1 || remoteIdx == (uint32_t)-1) return; if (localIdx - 1 >= fRegions.GetCount() || remoteIdx - 1 >= fRegions.GetCount() || fRegions[localIdx - 1] == nil) @@ -219,7 +219,7 @@ void plRelevanceMgr::ParseCsvInput(hsStream *s) if (strcmp(buff, "") == 0) continue; // ignore the initial blank one - plRegionInfo *info = TRACKED_NEW plRegionInfo; + plRegionInfo *info = new plRegionInfo; regions.Append(info); info->fName = hsStrcpy(buff); info->fIndex = GetIndex(_TEMP_CONVERT_FROM_LITERAL(buff)); diff --git a/Sources/Plasma/PubUtilLib/plScene/plRelevanceMgr.h b/Sources/Plasma/PubUtilLib/plScene/plRelevanceMgr.h index c11b2ce2..25566b05 100644 --- a/Sources/Plasma/PubUtilLib/plScene/plRelevanceMgr.h +++ b/Sources/Plasma/PubUtilLib/plScene/plRelevanceMgr.h @@ -80,10 +80,10 @@ public: hsBool GetEnabled() { return fEnabled; } void SetEnabled(hsBool val) { fEnabled = val; } - UInt32 GetIndex(const plString ®ionName); - void MarkRegion(UInt32 localIdx, UInt32 remoteIdx, hsBool doICare); + uint32_t GetIndex(const plString ®ionName); + void MarkRegion(uint32_t localIdx, uint32_t remoteIdx, hsBool doICare); void SetRegionVectors(const hsPoint3 &pos, hsBitVector ®ionsImIn, hsBitVector ®ionsICareAbout); - UInt32 GetNumRegions() const; // includes the secret 0 region in its count + uint32_t GetNumRegions() const; // includes the secret 0 region in its count void ParseCsvInput(hsStream *s); plString GetRegionNames(hsBitVector regions); diff --git a/Sources/Plasma/PubUtilLib/plScene/plRelevanceRegion.cpp b/Sources/Plasma/PubUtilLib/plScene/plRelevanceRegion.cpp index d1749b55..72401654 100644 --- a/Sources/Plasma/PubUtilLib/plScene/plRelevanceRegion.cpp +++ b/Sources/Plasma/PubUtilLib/plScene/plRelevanceRegion.cpp @@ -48,13 +48,13 @@ void plRelevanceRegion::Read(hsStream* s, hsResMgr* mgr) { plObjInterface::Read(s, mgr); - mgr->ReadKeyNotifyMe(s, TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnCreate, 0, 0), plRefFlags::kActiveRef); + mgr->ReadKeyNotifyMe(s, new plGenRefMsg(GetKey(), plRefMsg::kOnCreate, 0, 0), plRefFlags::kActiveRef); // Added to the manager when read in. // Removed when paged out, due to passive ref. if (plRelevanceMgr::Instance()) { - plGenRefMsg *msg = TRACKED_NEW plGenRefMsg(plRelevanceMgr::Instance()->GetKey(), plRefMsg::kOnCreate, -1, -1); + plGenRefMsg *msg = new plGenRefMsg(plRelevanceMgr::Instance()->GetKey(), plRefMsg::kOnCreate, -1, -1); hsgResMgr::ResMgr()->AddViaNotify(GetKey(), msg, plRefFlags::kPassiveRef); } } @@ -87,9 +87,9 @@ hsBool plRelevanceRegion::MsgReceive(plMessage* msg) } -void plRelevanceRegion::SetMgrIndex(UInt32 index) +void plRelevanceRegion::SetMgrIndex(uint32_t index) { - if (fMgrIdx != (UInt32)-1) + if (fMgrIdx != (uint32_t)-1) fRegionsICareAbout.SetBit(fMgrIdx, false); fMgrIdx = index; diff --git a/Sources/Plasma/PubUtilLib/plScene/plRelevanceRegion.h b/Sources/Plasma/PubUtilLib/plScene/plRelevanceRegion.h index 9e7d0ed6..adbb1849 100644 --- a/Sources/Plasma/PubUtilLib/plScene/plRelevanceRegion.h +++ b/Sources/Plasma/PubUtilLib/plScene/plRelevanceRegion.h @@ -54,10 +54,10 @@ class plRelevanceRegion : public plObjInterface protected: plRegionBase *fRegion; hsBitVector fRegionsICareAbout; - UInt32 fMgrIdx; + uint32_t fMgrIdx; public: - plRelevanceRegion() : fRegion(nil), fMgrIdx((UInt32)-1) {} + plRelevanceRegion() : fRegion(nil), fMgrIdx((uint32_t)-1) {} virtual ~plRelevanceRegion() {} CLASSNAME_REGISTER( plRelevanceRegion ); @@ -66,12 +66,12 @@ public: virtual hsBool MsgReceive(plMessage* msg); virtual void SetTransform(const hsMatrix44& l2w, const hsMatrix44& w2l) {} - virtual Int32 GetNumProperties() const { return 1; } + virtual int32_t GetNumProperties() const { return 1; } virtual void Read(hsStream* stream, hsResMgr* mgr); virtual void Write(hsStream* stream, hsResMgr* mgr); - void SetMgrIndex(UInt32 idx); + void SetMgrIndex(uint32_t idx); }; #endif // plRelevanceRegion_inc diff --git a/Sources/Plasma/PubUtilLib/plScene/plRenderRequest.cpp b/Sources/Plasma/PubUtilLib/plScene/plRenderRequest.cpp index 34fa3b6c..f99d5d53 100644 --- a/Sources/Plasma/PubUtilLib/plScene/plRenderRequest.cpp +++ b/Sources/Plasma/PubUtilLib/plScene/plRenderRequest.cpp @@ -40,7 +40,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "plRenderRequest.h" #include "plPageTreeMgr.h" #include "plPipeline/plRenderTarget.h" @@ -57,8 +57,8 @@ plRenderRequest::plRenderRequest() fAck(nil), fOverrideMat(nil), fEraseMat(nil), - fDrawableMask(UInt32(-1)), - fSubDrawableMask(UInt32(-1)), + fDrawableMask(uint32_t(-1)), + fSubDrawableMask(uint32_t(-1)), fRenderState(0), fClearDepth(1.f), fFogStart(-1.f), @@ -136,7 +136,7 @@ void plRenderRequest::Render(plPipeline* pipe, plPageTreeMgr* pageMgr) if( GetAck() ) { - plRenderRequestAck* ack = TRACKED_NEW plRenderRequestAck( GetAck(), GetUserData() ); + plRenderRequestAck* ack = new plRenderRequestAck( GetAck(), GetUserData() ); ack->SetNumDrawn(numDrawn); plgDispatch::MsgSend( ack ); } diff --git a/Sources/Plasma/PubUtilLib/plScene/plRenderRequest.h b/Sources/Plasma/PubUtilLib/plScene/plRenderRequest.h index 52a3a0a0..4d3c8724 100644 --- a/Sources/Plasma/PubUtilLib/plScene/plRenderRequest.h +++ b/Sources/Plasma/PubUtilLib/plScene/plRenderRequest.h @@ -64,7 +64,7 @@ class plRenderRequest : public plRenderRequestBase { public: protected: - UInt32 fRenderState; // Or'ed from plPipeline::RenderStateSettings::kRender* + uint32_t fRenderState; // Or'ed from plPipeline::RenderStateSettings::kRender* plDrawable* fClearDrawable; plRenderTarget* fRenderTarget; @@ -75,15 +75,15 @@ protected: plKey fAck; - hsScalar fPriority; + float fPriority; - UInt32 fDrawableMask; - UInt32 fSubDrawableMask; + uint32_t fDrawableMask; + uint32_t fSubDrawableMask; hsColorRGBA fClearColor; - hsScalar fClearDepth; + float fClearDepth; - hsScalar fFogStart; + float fFogStart; hsMatrix44 fLocalToWorld; hsMatrix44 fWorldToLocal; @@ -92,7 +92,7 @@ protected: hsBitVector fVisForce; - UInt32 fUserData; + uint32_t fUserData; hsBool fIgnoreOccluders; public: @@ -102,14 +102,14 @@ public: hsBool GetRenderSelect() const { return !fVisForce.Empty(); } hsBool GetRenderCharacters() const; - void SetRenderState(UInt32 st) { fRenderState = st; } - UInt32 GetRenderState() const { return fRenderState; } + void SetRenderState(uint32_t st) { fRenderState = st; } + uint32_t GetRenderState() const { return fRenderState; } - void SetDrawableMask(UInt32 m) { fDrawableMask = m; } - UInt32 GetDrawableMask() const { return fDrawableMask; } + void SetDrawableMask(uint32_t m) { fDrawableMask = m; } + uint32_t GetDrawableMask() const { return fDrawableMask; } - void SetSubDrawableMask(UInt32 m) { fSubDrawableMask = m; } - UInt32 GetSubDrawableMask() const { return fSubDrawableMask; } + void SetSubDrawableMask(uint32_t m) { fSubDrawableMask = m; } + uint32_t GetSubDrawableMask() const { return fSubDrawableMask; } void RequestAck(plKey key) { fAck = key; } plKey GetAck() const { return fAck; } @@ -139,28 +139,28 @@ public: const plViewTransform& GetViewTransform() const { return fViewTransform; } - hsScalar GetHither() const { return fViewTransform.GetHither(); } - hsScalar GetYon() const { return fViewTransform.GetYon(); } + float GetHither() const { return fViewTransform.GetHither(); } + float GetYon() const { return fViewTransform.GetYon(); } - hsScalar GetFovX() const { return fViewTransform.GetFovXDeg(); } - hsScalar GetFovY() const { return fViewTransform.GetFovYDeg(); } + float GetFovX() const { return fViewTransform.GetFovXDeg(); } + float GetFovY() const { return fViewTransform.GetFovYDeg(); } - hsScalar GetSizeX() const { return fViewTransform.GetOrthoWidth(); } - hsScalar GetSizeY() const { return fViewTransform.GetOrthoHeight(); } + float GetSizeX() const { return fViewTransform.GetOrthoWidth(); } + float GetSizeY() const { return fViewTransform.GetOrthoHeight(); } - UInt16 GetScreenWidth() const { return fViewTransform.GetScreenWidth(); } - UInt16 GetScreenHeight() const { return fViewTransform.GetScreenHeight(); } + uint16_t GetScreenWidth() const { return fViewTransform.GetScreenWidth(); } + uint16_t GetScreenHeight() const { return fViewTransform.GetScreenHeight(); } const hsColorRGBA& GetClearColor() const { return fClearColor; } - hsScalar GetClearDepth() const { return fClearDepth; } + float GetClearDepth() const { return fClearDepth; } // FogStart // negative => use current settings (default) // 0 => no fog == fog starts at yon // 1 => fog starts at camera. // Fog start greater than 1 is legal. Fog always linear. - hsScalar GetFogStart() const { return fFogStart; } + float GetFogStart() const { return fFogStart; } - hsScalar GetPriority() const { return fPriority; } + float GetPriority() const { return fPriority; } void SetLocalTransform(const hsMatrix44& l2w, const hsMatrix44& w2l); @@ -171,31 +171,31 @@ public: void SetPerspective(hsBool on=true) { fViewTransform.SetPerspective(on); } void SetOrthogonal(hsBool on=true) { fViewTransform.SetOrthogonal(on); } - void SetHither(hsScalar f) { fViewTransform.SetHither(f); } - void SetYon(hsScalar f) { fViewTransform.SetYon(f); } + void SetHither(float f) { fViewTransform.SetHither(f); } + void SetYon(float f) { fViewTransform.SetYon(f); } - void SetFovX(hsScalar f) { fViewTransform.SetFovXDeg(f); } - void SetFovY(hsScalar f) { fViewTransform.SetFovYDeg(f); } + void SetFovX(float f) { fViewTransform.SetFovXDeg(f); } + void SetFovY(float f) { fViewTransform.SetFovYDeg(f); } - void SetSizeX(hsScalar f) { fViewTransform.SetWidth(f); } - void SetSizeY(hsScalar f) { fViewTransform.SetHeight(f); } + void SetSizeX(float f) { fViewTransform.SetWidth(f); } + void SetSizeY(float f) { fViewTransform.SetHeight(f); } void SetClearColor(const hsColorRGBA& c) { fClearColor = c; } - void SetClearDepth(hsScalar d) { fClearDepth = d; } + void SetClearDepth(float d) { fClearDepth = d; } // FogStart // negative => use current settings (default) // 0 => no fog == fog starts at yon // 1 => fog starts at camera. // Fog start greater than 1 is legal. Fog always linear. - void SetFogStart(hsScalar d) { fFogStart = d; } + void SetFogStart(float d) { fFogStart = d; } - void SetPriority(hsScalar p) { fPriority = p; } + void SetPriority(float p) { fPriority = p; } virtual void Read(hsStream* s, hsResMgr* mgr); virtual void Write(hsStream* s, hsResMgr* mgr); - void SetUserData(UInt32 n) { fUserData = n; } - UInt32 GetUserData() const { return fUserData; } + void SetUserData(uint32_t n) { fUserData = n; } + uint32_t GetUserData() const { return fUserData; } void SetIgnoreOccluders(hsBool b) { fIgnoreOccluders = b; } hsBool GetIgnoreOccluders() { return fIgnoreOccluders; } diff --git a/Sources/Plasma/PubUtilLib/plScene/plSceneNode.cpp b/Sources/Plasma/PubUtilLib/plScene/plSceneNode.cpp index dbe17388..56d10d7a 100644 --- a/Sources/Plasma/PubUtilLib/plScene/plSceneNode.cpp +++ b/Sources/Plasma/PubUtilLib/plScene/plSceneNode.cpp @@ -41,7 +41,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "plSceneNode.h" #include "pnDispatch/plDispatch.h" #include "plMessage/plNodeCleanupMsg.h" @@ -96,14 +96,14 @@ void plSceneNode::Read(hsStream* s, hsResMgr* mgr) { hsKeyedObject::Read(s, mgr); - UInt32 n; + uint32_t n; int i; n = s->ReadLE32(); fSceneObjects.Reset(); for( i = 0; i < n; i++ ) { - plNodeRefMsg* refMsg = TRACKED_NEW plNodeRefMsg(GetKey(), plRefMsg::kOnCreate, i, plNodeRefMsg::kObject); + plNodeRefMsg* refMsg = new plNodeRefMsg(GetKey(), plRefMsg::kOnCreate, i, plNodeRefMsg::kObject); plKey key = mgr->ReadKeyNotifyMe(s, refMsg, plRefFlags::kActiveRef); } @@ -111,7 +111,7 @@ void plSceneNode::Read(hsStream* s, hsResMgr* mgr) fGenericPool.Reset(); for( i = 0; i < n; i++ ) { - plNodeRefMsg* refMsg = TRACKED_NEW plNodeRefMsg(GetKey(), plRefMsg::kOnCreate, -1, plNodeRefMsg::kGeneric); + plNodeRefMsg* refMsg = new plNodeRefMsg(GetKey(), plRefMsg::kOnCreate, -1, plNodeRefMsg::kGeneric); mgr->ReadKeyNotifyMe(s, refMsg, plRefFlags::kActiveRef); } } @@ -133,10 +133,10 @@ void plSceneNode::Write(hsStream* s, hsResMgr* mgr) void plSceneNode::Harvest(plVolumeIsect* isect, hsTArray& levList) { - static hsTArray visList; + static hsTArray visList; visList.SetCount(0); GetSpaceTree()->HarvestLeaves(isect, visList); - static hsTArray visSpans; + static hsTArray visSpans; visSpans.SetCount(0); int i; @@ -155,10 +155,10 @@ void plSceneNode::Harvest(plVolumeIsect* isect, hsTArray& levList void plSceneNode::CollectForRender(plPipeline* pipe, hsTArray& levList, plVisMgr* visMgr) { - static hsTArray visList; + static hsTArray visList; visList.SetCount(0); pipe->HarvestVisible(GetSpaceTree(), visList); - static hsTArray visSpans; + static hsTArray visSpans; visSpans.SetCount(0); int i; diff --git a/Sources/Plasma/PubUtilLib/plScene/plSceneNode.h b/Sources/Plasma/PubUtilLib/plScene/plSceneNode.h index 99a4fa06..c694c0de 100644 --- a/Sources/Plasma/PubUtilLib/plScene/plSceneNode.h +++ b/Sources/Plasma/PubUtilLib/plScene/plSceneNode.h @@ -74,7 +74,7 @@ public: protected: hsBool fFilterGenerics; // Export only - Int16 fDepth; + int16_t fDepth; hsTArray fSceneObjects; @@ -133,9 +133,9 @@ public: virtual hsBool MsgReceive(plMessage* msg); - Int16 GetDepth() { return fDepth; } - Int16 IncDepth() { return ++fDepth; } - Int16 DecDepth() { return --fDepth; } + int16_t GetDepth() { return fDepth; } + int16_t IncDepth() { return ++fDepth; } + int16_t DecDepth() { return --fDepth; } void Init( void ); diff --git a/Sources/Plasma/PubUtilLib/plScene/plVisMgr.cpp b/Sources/Plasma/PubUtilLib/plScene/plVisMgr.cpp index d2e443af..d9bb3e01 100644 --- a/Sources/Plasma/PubUtilLib/plScene/plVisMgr.cpp +++ b/Sources/Plasma/PubUtilLib/plScene/plVisMgr.cpp @@ -40,7 +40,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "plVisMgr.h" #include "plVisRegion.h" @@ -209,7 +209,7 @@ plVisMgr* plGlobalVisMgr::fInstance = nil; void plGlobalVisMgr::Init() { - fInstance = TRACKED_NEW plVisMgr; + fInstance = new plVisMgr; fInstance->RegisterAs(kGlobalVisMgr_KEY); } diff --git a/Sources/Plasma/PubUtilLib/plScene/plVisRegion.cpp b/Sources/Plasma/PubUtilLib/plScene/plVisRegion.cpp index 966a15ea..9384db6f 100644 --- a/Sources/Plasma/PubUtilLib/plScene/plVisRegion.cpp +++ b/Sources/Plasma/PubUtilLib/plScene/plVisRegion.cpp @@ -40,7 +40,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "plVisRegion.h" #include "hsStream.h" @@ -127,8 +127,8 @@ void plVisRegion::Read(hsStream* s, hsResMgr* mgr) { plObjInterface::Read(s, mgr); - mgr->ReadKeyNotifyMe(s, TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnCreate, 0, kRefRegion), plRefFlags::kActiveRef); - mgr->ReadKeyNotifyMe(s, TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnCreate, 0, kRefVisMgr), plRefFlags::kActiveRef); + mgr->ReadKeyNotifyMe(s, new plGenRefMsg(GetKey(), plRefMsg::kOnCreate, 0, kRefRegion), plRefFlags::kActiveRef); + mgr->ReadKeyNotifyMe(s, new plGenRefMsg(GetKey(), plRefMsg::kOnCreate, 0, kRefVisMgr), plRefFlags::kActiveRef); if( fMgr ) fMgr->Register(this, GetProperty(kIsNot)); diff --git a/Sources/Plasma/PubUtilLib/plScene/plVisRegion.h b/Sources/Plasma/PubUtilLib/plScene/plVisRegion.h index f11b392b..43e5a78a 100644 --- a/Sources/Plasma/PubUtilLib/plScene/plVisRegion.h +++ b/Sources/Plasma/PubUtilLib/plScene/plVisRegion.h @@ -72,9 +72,9 @@ protected: plVisMgr* fMgr; - Int32 fIndex; + int32_t fIndex; - void SetIndex(Int32 i) { fIndex = i; } + void SetIndex(int32_t i) { fIndex = i; } friend class plVisMgr; public: @@ -84,7 +84,7 @@ public: CLASSNAME_REGISTER( plVisRegion ); GETINTERFACE_ANY( plVisRegion, plObjInterface ); - virtual Int32 GetNumProperties() const { return 3; } // This is stupid. + virtual int32_t GetNumProperties() const { return 3; } // This is stupid. virtual hsBool MsgReceive(plMessage* msg); @@ -97,7 +97,7 @@ public: hsBool Eval(const hsPoint3& pos) const; - Int32 GetIndex() const { return fIndex; } + int32_t GetIndex() const { return fIndex; } hsBool Registered() const { return GetIndex() > 0; } diff --git a/Sources/Plasma/PubUtilLib/plSockets/plMemBuffer.cpp b/Sources/Plasma/PubUtilLib/plSockets/plMemBuffer.cpp index 9477b117..6d27eea4 100644 --- a/Sources/Plasma/PubUtilLib/plSockets/plMemBuffer.cpp +++ b/Sources/Plasma/PubUtilLib/plSockets/plMemBuffer.cpp @@ -39,8 +39,9 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com Mead, WA 99021 *==LICENSE==*/ -#include "hsUtils.h" + #include "plMemBuffer.h" +#include "HeadSpin.h" ///////////////////////////////////////////////// @@ -83,7 +84,7 @@ void plMemBuffer::SetBuffer(char * data, int len) void plMemBuffer::CopyBuffer(char * data, int len) { - char * tmp = TRACKED_NEW char[len]; + char * tmp = new char[len]; memcpy(tmp,data,len); ClearBuffer(); AllocBuffer(len); @@ -100,7 +101,7 @@ void plMemBuffer::GrowBuffer(int newLen) int len = newLen + kThrashSize; len = len+len; - char * tmp = TRACKED_NEW char[len]; + char * tmp = new char[len]; if(fBuffer != nil) memcpy(tmp,fBuffer,fBufferLen); @@ -143,7 +144,7 @@ void plMemBuffer::ClearBuffer() void plMemBuffer::AllocBuffer(int len) { - fBuffer = TRACKED_NEW char[len]; + fBuffer = new char[len]; fBufferLocal = true; fBufferLen = len; } diff --git a/Sources/Plasma/PubUtilLib/plSockets/plNet.h b/Sources/Plasma/PubUtilLib/plSockets/plNet.h index 889cecbc..d4459dff 100644 --- a/Sources/Plasma/PubUtilLib/plSockets/plNet.h +++ b/Sources/Plasma/PubUtilLib/plSockets/plNet.h @@ -43,15 +43,13 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #define plNet_h_inc -#include "hsTypes.h" // for hsAssert +#include "HeadSpin.h" //////////////////////////////////////////////////// // Windows net types #if HS_BUILD_FOR_WIN32 -#include - const int kBlockingError = WSAEWOULDBLOCK; const int kTimeoutError = WSAETIMEDOUT; const SOCKET kBadSocket = 0xffffffff; diff --git a/Sources/Plasma/PubUtilLib/plSockets/plRingBuffer.cpp b/Sources/Plasma/PubUtilLib/plSockets/plRingBuffer.cpp index 9ef344ec..b5cb25bd 100644 --- a/Sources/Plasma/PubUtilLib/plSockets/plRingBuffer.cpp +++ b/Sources/Plasma/PubUtilLib/plSockets/plRingBuffer.cpp @@ -39,8 +39,9 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com Mead, WA 99021 *==LICENSE==*/ -#include "hsUtils.h" + #include "plRingBuffer.h" +#include "HeadSpin.h" plRingBuffer::plRingBuffer(int size) : plMemBuffer(size) diff --git a/Sources/Plasma/PubUtilLib/plStatGather/plAutoProfile.cpp b/Sources/Plasma/PubUtilLib/plStatGather/plAutoProfile.cpp index dbe53715..aef15e17 100644 --- a/Sources/Plasma/PubUtilLib/plStatGather/plAutoProfile.cpp +++ b/Sources/Plasma/PubUtilLib/plStatGather/plAutoProfile.cpp @@ -87,7 +87,7 @@ protected: bool fLinkedToSingleAge; bool fJustLinkToAges; - UInt64 fLinkTime; + uint64_t fLinkTime; plString fStatusMessage; @@ -162,12 +162,12 @@ void plAutoProfileImp::IInit() plgDispatch::Dispatch()->RegisterForExactType(plInitialAgeStateLoadedMsg::Index(), GetKey()); plgDispatch::Dispatch()->RegisterForExactType(plEvalMsg::Index(), GetKey()); - plConsoleMsg* consoleMsg = TRACKED_NEW plConsoleMsg(plConsoleMsg::kExecuteLine, "Camera.AlwaysCut true"); + plConsoleMsg* consoleMsg = new plConsoleMsg(plConsoleMsg::kExecuteLine, "Camera.AlwaysCut true"); consoleMsg->Send(); } #ifdef HS_BUILD_FOR_WIN32 -#include "hsWindows.h" + #include #endif @@ -176,8 +176,8 @@ void plAutoProfileImp::IShutdown() // KLUDGE - Copy the load timing log, in case we used it #define kTimingLog L"readtimings.0.log" #define kAgeTimingLog L"agetimings.0.log" - wchar destPath[MAX_PATH]; - wchar sourcePath[MAX_PATH]; + wchar_t destPath[MAX_PATH]; + wchar_t sourcePath[MAX_PATH]; PathAddFilename(destPath, plProfileManagerFull::Instance().GetProfilePath(), kTimingLog, arrsize(destPath)); PathGetLogDirectory(sourcePath, arrsize(sourcePath)); @@ -201,7 +201,7 @@ void plAutoProfileImp::IShutdown() // Pump the queue so we get fully unregistered plgDispatch::Dispatch()->MsgQueueProcess(); - plClientMsg* clientMsg = TRACKED_NEW plClientMsg(plClientMsg::kQuit); + plClientMsg* clientMsg = new plClientMsg(plClientMsg::kQuit); clientMsg->Send(hsgResMgr::ResMgr()->FindKey(kClient_KEY)); } @@ -326,7 +326,7 @@ bool plAutoProfileImp::INextSpawnPoint() fNextSpawnPoint++; - plTimerCallbackMsg* timerMsg = TRACKED_NEW plTimerCallbackMsg(GetKey()); + plTimerCallbackMsg* timerMsg = new plTimerCallbackMsg(GetKey()); plgTimerCallbackMgr::NewTimer(30, timerMsg); return true; @@ -372,7 +372,7 @@ hsBool plAutoProfileImp::MsgReceive(plMessage* msg) fStatusMessage = _TEMP_CONVERT_FROM_LITERAL("Age loaded. Preparing to profile."); // Age is loaded, start profiling in 5 seconds (to make sure the avatar is linked in all the way) - plTimerCallbackMsg* timerMsg = TRACKED_NEW plTimerCallbackMsg(GetKey()); + plTimerCallbackMsg* timerMsg = new plTimerCallbackMsg(GetKey()); plgTimerCallbackMgr::NewTimer(5, timerMsg); return true; } diff --git a/Sources/Plasma/PubUtilLib/plStatGather/plCalculatedProfiles.cpp b/Sources/Plasma/PubUtilLib/plStatGather/plCalculatedProfiles.cpp index df639323..af6586bc 100644 --- a/Sources/Plasma/PubUtilLib/plStatGather/plCalculatedProfiles.cpp +++ b/Sources/Plasma/PubUtilLib/plStatGather/plCalculatedProfiles.cpp @@ -87,8 +87,8 @@ plProfile_CreateCounter("Polys Per Material", "General", PolysPerMat); void CalculateProfiles() { // KLUDGE - do timing that overlaps the beginframe / endframe (where timing is normally reset) - static UInt32 lastTicks = plProfileManager::GetTime(); - UInt32 curTicks = plProfileManager::GetTime(); + static uint32_t lastTicks = plProfileManager::GetTime(); + uint32_t curTicks = plProfileManager::GetTime(); gVarRFPS.Set(curTicks - lastTicks); lastTicks = curTicks; @@ -111,18 +111,18 @@ void CalculateProfiles() hsAssert(nc->GetNetCore(), "nil net core in stats?"); plNetCoreStats* ns = nc->GetNetCore()->GetStats(); - plProfile_Set(UploadAgeBitsPerSec, (UInt32)nc->GetNetClientStats().GetAgeStatsULBitsPerSec()); + plProfile_Set(UploadAgeBitsPerSec, (uint32_t)nc->GetNetClientStats().GetAgeStatsULBitsPerSec()); plProfile_Set(UploadBW, ns->GetULBits()/8); plProfile_Set(UploadPPS, ns->GetULPackets()); - plProfile_Set(UploadAPS, (UInt32)ns->GetULAvgPacketBytes()); - plProfile_Set(UploadPQ, (UInt32)ns->GetULAvgNumPacketsQueued()); + plProfile_Set(UploadAPS, (uint32_t)ns->GetULAvgPacketBytes()); + plProfile_Set(UploadPQ, (uint32_t)ns->GetULAvgNumPacketsQueued()); plProfile_Set(RMultAcksPQ, nc->GetNetClientStats().GetRecvdMultipleAcks()); - plProfile_Set(DownloadAgeBitsPerSec, (UInt32)nc->GetNetClientStats().GetAgeStatsDLBitsPerSec()); + plProfile_Set(DownloadAgeBitsPerSec, (uint32_t)nc->GetNetClientStats().GetAgeStatsDLBitsPerSec()); plProfile_Set(DownloadBW, ns->GetDLBits()/8); plProfile_Set(DownloadPPS, ns->GetDLPackets()); - plProfile_Set(DownloadAPS, (UInt32)ns->GetDLAvgPacketBytes()); - plProfile_Set(DownloadPQ, (UInt32)ns->GetDLAvgNumPacketsQueued()); + plProfile_Set(DownloadAPS, (uint32_t)ns->GetDLAvgPacketBytes()); + plProfile_Set(DownloadPQ, (uint32_t)ns->GetDLAvgNumPacketsQueued()); plProfile_Set(DownloadDP, ns->GetDLDroppedPackets()); plProfile_Set(RemotePlayers, nc->RemotePlayerKeys().size()); @@ -269,8 +269,8 @@ void UpdateStandardGraphs(float xPos, float yPos) if (fNetBWPlate) { fNetBWPlate->AddData( - (UInt32)(ns->GetULBits()/8.f), - (UInt32)(ns->GetDLBits()/8.f)); + (uint32_t)(ns->GetULBits()/8.f), + (uint32_t)(ns->GetDLBits()/8.f)); PositionPlate(fNetBWPlate); } @@ -294,24 +294,24 @@ void UpdateStandardGraphs(float xPos, float yPos) if (fNetAvgBWPlate) { fNetAvgBWPlate->AddData( - (UInt32)(ns->GetULBitsPS()/8.f), - (UInt32)(ns->GetDLBitsPS()/8.f)); + (uint32_t)(ns->GetULBitsPS()/8.f), + (uint32_t)(ns->GetDLBitsPS()/8.f)); PositionPlate(fNetAvgBWPlate); } if (fNetAvgPPSPlate) { fNetAvgPPSPlate->AddData( - (Int32)ns->GetULNumPacketsPS(), - (Int32)ns->GetDLNumPacketsPS()); + (int32_t)ns->GetULNumPacketsPS(), + (int32_t)ns->GetDLNumPacketsPS()); PositionPlate(fNetAvgPPSPlate); } if (fNetAvgQueuesPlate) { fNetAvgQueuesPlate->AddData( - (Int32)ns->GetULAvgNumPacketsQueued(), - (Int32)ns->GetDLAvgNumPacketsQueued()); + (int32_t)ns->GetULAvgNumPacketsQueued(), + (int32_t)ns->GetDLAvgNumPacketsQueued()); PositionPlate(fNetAvgQueuesPlate); } #endif diff --git a/Sources/Plasma/PubUtilLib/plStatGather/plProfileManagerFull.cpp b/Sources/Plasma/PubUtilLib/plStatGather/plProfileManagerFull.cpp index 8474af74..69491d4a 100644 --- a/Sources/Plasma/PubUtilLib/plStatGather/plProfileManagerFull.cpp +++ b/Sources/Plasma/PubUtilLib/plStatGather/plProfileManagerFull.cpp @@ -194,7 +194,7 @@ static void PrintColumn(ProfileGroup& group, const char* groupName, int column, txt.DrawString(x, y+height, groupName, 255, 255, 255, 255, plDebugText::kStyleBold); height += yInc; - UInt32 samplesWidth = txt.CalcStringWidth("[000]"); + uint32_t samplesWidth = txt.CalcStringWidth("[000]"); for (int i = 0; i < group.size(); i++) { @@ -376,13 +376,13 @@ void plProfileManagerFull::Update() double value; double scale; int i; - std::vector values; + std::vector values; for (i=0; iGetValue(); scale = 100.0/((double)(fDetailVars[i].max-fDetailVars[i].min)); value = scale*value-fDetailVars[i].min; - values.push_back((Int32)value); + values.push_back((int32_t)value); } fDetailGraph->AddData(values); fDetailGraph->SetVisible(true); @@ -421,15 +421,15 @@ void plProfileManagerFull::IPrintGroup(hsStream* s, const char* groupName, bool void plProfileManagerFull::LogStats(const char* ageName, const char* spawnName) { fLogStats = true; - wchar* temp = hsStringToWString(ageName); + wchar_t* temp = hsStringToWString(ageName); fLogAgeName = temp; delete [] temp; fLogSpawnName = spawnName; } -const wchar* plProfileManagerFull::GetProfilePath() +const wchar_t* plProfileManagerFull::GetProfilePath() { - static wchar profilePath[MAX_PATH]; + static wchar_t profilePath[MAX_PATH]; static bool initialized = false; if (!initialized) @@ -442,7 +442,7 @@ const wchar* plProfileManagerFull::GetProfilePath() PathAddFilename(profilePath, profilePath, L"Profile", arrsize(profilePath)); plFileUtils::CreateDir(profilePath); - wchar buff[256]; + wchar_t buff[256]; swprintf(buff, 256, L"%02d-%02d-%04d_%02d-%02d//", curTime.GetMonth(), curTime.GetDay(), @@ -459,7 +459,7 @@ const wchar* plProfileManagerFull::GetProfilePath() void plProfileManagerFull::ILogStats() { - wchar statFilename[256]; + wchar_t statFilename[256]; swprintf(statFilename, 256, L"%s%s.csv", GetProfilePath(), fLogAgeName.c_str()); bool exists = plFileUtils::FileExists(statFilename); @@ -543,7 +543,7 @@ void plProfileManagerFull::ShowLaps(const char* groupName, const char* varName) fShowLaps->SetLapsActive(true); } -void plProfileManagerFull::CreateGraph(const char* varName, UInt32 min, UInt32 max) +void plProfileManagerFull::CreateGraph(const char* varName, uint32_t min, uint32_t max) { // If the graph is already created, destroy it for (int i = 0; i < fGraphs.size(); i++) @@ -609,7 +609,7 @@ void plProfileManagerFull::HideDetailGraph() } } -void plProfileManagerFull::AddDetailVar(const char* varName, UInt32 min, UInt32 max) +void plProfileManagerFull::AddDetailVar(const char* varName, uint32_t min, uint32_t max) { int i=0; for (i=0; iSetLabelText(labels); // update the colors as well, just in case - std::vector colors; + std::vector colors; colors.push_back(0xff00ff00); // green colors.push_back(0xff0000ff); // blue colors.push_back(0xffffff00); // yellow diff --git a/Sources/Plasma/PubUtilLib/plStatGather/plProfileManagerFull.h b/Sources/Plasma/PubUtilLib/plStatGather/plProfileManagerFull.h index 53643153..fa10c997 100644 --- a/Sources/Plasma/PubUtilLib/plStatGather/plProfileManagerFull.h +++ b/Sources/Plasma/PubUtilLib/plStatGather/plProfileManagerFull.h @@ -72,15 +72,15 @@ protected: struct detailVar { plProfileVar* var; - Int32 min; - Int32 max; + int32_t min; + int32_t max; }; std::vector fDetailVars; // the vars we want to show on the detail graph GroupSet fShowGroups; plProfileVar* fShowLaps; - UInt32 fMinLap; // For Display + uint32_t fMinLap; // For Display void IPrintGroup(hsStream* s, const char* groupName, bool printTitle=false); void ILogStats(); @@ -109,19 +109,19 @@ public: void PageDownLaps() { fMinLap += 40; } void PageUpLaps() { fMinLap = (fMinLap < 40) ? 0 : fMinLap - 40;} - void CreateGraph(const char* varName, UInt32 min, UInt32 max); + void CreateGraph(const char* varName, uint32_t min, uint32_t max); void ResetDefaultDetailVars(); void ShowDetailGraph(); void HideDetailGraph(); - void AddDetailVar(const char* varName, UInt32 min, UInt32 max); + void AddDetailVar(const char* varName, uint32_t min, uint32_t max); void RemoveDetailVar(const char* varName); void UpdateDetailLabels(); void ResetMax(); void LogStats(const char* ageName, const char* spawnName); - const wchar* GetProfilePath(); + const wchar_t* GetProfilePath(); // If you're going to call LogStats, make sure to call this first so all stats will be evaluated before logging void ActivateAllStats(); diff --git a/Sources/Plasma/PubUtilLib/plStatusLog/plEncryptLogLine.cpp b/Sources/Plasma/PubUtilLib/plStatusLog/plEncryptLogLine.cpp index 5c0ff316..feeddc20 100644 --- a/Sources/Plasma/PubUtilLib/plStatusLog/plEncryptLogLine.cpp +++ b/Sources/Plasma/PubUtilLib/plStatusLog/plEncryptLogLine.cpp @@ -53,12 +53,12 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include -void plStatusEncrypt::Encrypt( UInt8 *line, UInt8 hint ) +void plStatusEncrypt::Encrypt( uint8_t *line, uint8_t hint ) { // Current encryption scheme: rotate all characters right by 2 bits, // then rotate the whole damn line by 3 bits to the right - UInt32 i, len = strlen( (char *)line ); - UInt8 newHi, hiBits = ( ( line[ len - 1 ] ) << ( 5 - 2 ) ) & 0xe0; + uint32_t i, len = strlen( (char *)line ); + uint8_t newHi, hiBits = ( ( line[ len - 1 ] ) << ( 5 - 2 ) ) & 0xe0; for( i = 0; i < len; i++ ) { @@ -76,11 +76,11 @@ void plStatusEncrypt::Encrypt( UInt8 *line, UInt8 hint ) } } -void plStatusEncrypt::Decrypt( UInt8 *line, Int32 len, UInt8 hint ) +void plStatusEncrypt::Decrypt( uint8_t *line, int32_t len, uint8_t hint ) { // Da reverse, of course! - Int32 i; - UInt8 lastChar = 0, newLo, loBits = ( line[ 0 ] ^ hint ) >> 5; + int32_t i; + uint8_t lastChar = 0, newLo, loBits = ( line[ 0 ] ^ hint ) >> 5; for( i = len - 1; i >= 0; i-- ) { diff --git a/Sources/Plasma/PubUtilLib/plStatusLog/plEncryptLogLine.h b/Sources/Plasma/PubUtilLib/plStatusLog/plEncryptLogLine.h index d3f2df2c..7a0e268d 100644 --- a/Sources/Plasma/PubUtilLib/plStatusLog/plEncryptLogLine.h +++ b/Sources/Plasma/PubUtilLib/plStatusLog/plEncryptLogLine.h @@ -52,12 +52,12 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #ifndef _plEncryptLogLine_h #define _plEncryptLogLine_h -#include "hsTypes.h" +#include "HeadSpin.h" namespace plStatusEncrypt { - void Encrypt( UInt8 *line, UInt8 hint ); - void Decrypt( UInt8 *line, Int32 length, UInt8 hint ); + void Encrypt( uint8_t *line, uint8_t hint ); + void Decrypt( uint8_t *line, int32_t length, uint8_t hint ); }; #endif //_plEncryptLogLine_h diff --git a/Sources/Plasma/PubUtilLib/plStatusLog/plLoggable.h b/Sources/Plasma/PubUtilLib/plStatusLog/plLoggable.h index eaf00841..25e86efc 100644 --- a/Sources/Plasma/PubUtilLib/plStatusLog/plLoggable.h +++ b/Sources/Plasma/PubUtilLib/plStatusLog/plLoggable.h @@ -43,7 +43,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #define plLoggable_inc #include -#include "hsTypes.h" +#include "HeadSpin.h" // // An abstract base class which contains a status log and simple functions diff --git a/Sources/Plasma/PubUtilLib/plStatusLog/plStatusLog.cpp b/Sources/Plasma/PubUtilLib/plStatusLog/plStatusLog.cpp index 147777d1..b7626041 100644 --- a/Sources/Plasma/PubUtilLib/plStatusLog/plStatusLog.cpp +++ b/Sources/Plasma/PubUtilLib/plStatusLog/plStatusLog.cpp @@ -81,7 +81,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com //// plStatusLogMgr Stuff //////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////// -wchar plStatusLogMgr::fBasePath[ MAX_PATH ] = L""; +wchar_t plStatusLogMgr::fBasePath[ MAX_PATH ] = L""; //// Constructor & Destructor //////////////////////////////////////////////// @@ -99,7 +99,7 @@ plStatusLogMgr::plStatusLogMgr() #else const char* home = getenv("HOME"); if (!home) home = ""; - wchar* temp = hsStringToWString(home); + wchar_t* temp = hsStringToWString(home); swprintf(fBasePath, MAX_PATH, L"%S/.cache", temp); delete[] temp; #endif @@ -119,7 +119,7 @@ plStatusLogMgr::~plStatusLogMgr() fDisplays->IUnlink(); if( log->fFlags & plStatusLog::kDeleteForMe ) - DEL(log); + delete log; } } @@ -131,7 +131,7 @@ plStatusLogMgr &plStatusLogMgr::GetInstance( void ) //// IEnsurePathExists /////////////////////////////////////////////////////// -void plStatusLogMgr::IEnsurePathExists( const wchar *dirName ) +void plStatusLogMgr::IEnsurePathExists( const wchar_t *dirName ) { // Note: this creates the directory if it doesn't exist, or if it does, // returns false @@ -140,7 +140,7 @@ void plStatusLogMgr::IEnsurePathExists( const wchar *dirName ) //// IPathAppend ///////////////////////////////////////////////////////////// -void plStatusLogMgr::IPathAppend( wchar *base, const wchar *extra, unsigned maxLen ) +void plStatusLogMgr::IPathAppend( wchar_t *base, const wchar_t *extra, unsigned maxLen ) { if (!base || !extra) return; @@ -192,18 +192,18 @@ void plStatusLogMgr::Draw( void ) //// CreateStatusLog ///////////////////////////////////////////////////////// -plStatusLog *plStatusLogMgr::CreateStatusLog( UInt8 numDisplayLines, const char *filename, UInt32 flags ) +plStatusLog *plStatusLogMgr::CreateStatusLog( uint8_t numDisplayLines, const char *filename, uint32_t flags ) { - wchar* wFilename = hsStringToWString(filename); + wchar_t* wFilename = hsStringToWString(filename); plStatusLog* ret = CreateStatusLog(numDisplayLines, wFilename, flags); delete [] wFilename; return ret; } -plStatusLog *plStatusLogMgr::CreateStatusLog( UInt8 numDisplayLines, const wchar *filename, UInt32 flags ) +plStatusLog *plStatusLogMgr::CreateStatusLog( uint8_t numDisplayLines, const wchar_t *filename, uint32_t flags ) { IEnsurePathExists( fBasePath ); - plStatusLog *log = NEW(plStatusLog)( numDisplayLines, filename, flags ); + plStatusLog *log = new plStatusLog( numDisplayLines, filename, flags ); // Put the new log in its alphabetical position plStatusLog** nextLog = &fDisplays; @@ -236,12 +236,12 @@ void plStatusLogMgr::ToggleStatusLog( plStatusLog *logToDisplay ) void plStatusLogMgr::SetCurrStatusLog(const char* logName) { - wchar* wLogName = hsStringToWString(logName); + wchar_t* wLogName = hsStringToWString(logName); SetCurrStatusLog(wLogName); delete [] wLogName; } -void plStatusLogMgr::SetCurrStatusLog(const wchar* logName) +void plStatusLogMgr::SetCurrStatusLog(const wchar_t* logName) { plStatusLog* log = FindLog(logName, false); if (log != nil) @@ -284,13 +284,13 @@ void plStatusLogMgr::PrevStatusLog( void ) plStatusLog *plStatusLogMgr::FindLog( const char *filename, hsBool createIfNotFound ) { - wchar* wFilename = hsStringToWString(filename); + wchar_t* wFilename = hsStringToWString(filename); plStatusLog* ret = FindLog(wFilename, createIfNotFound); delete [] wFilename; return ret; } -plStatusLog *plStatusLogMgr::FindLog( const wchar *filename, hsBool createIfNotFound ) +plStatusLog *plStatusLogMgr::FindLog( const wchar_t *filename, hsBool createIfNotFound ) { plStatusLog *log = fDisplays; @@ -316,12 +316,12 @@ plStatusLog *plStatusLogMgr::FindLog( const wchar *filename, hsBool createIfNotF void plStatusLogMgr::SetBasePath( const char * path ) { - wchar* wPath = hsStringToWString(path); + wchar_t* wPath = hsStringToWString(path); SetBasePath(wPath); delete [] wPath; } -void plStatusLogMgr::SetBasePath( const wchar * path ) +void plStatusLogMgr::SetBasePath( const wchar_t * path ) { wcscpy( fBasePath, path ); } @@ -345,17 +345,17 @@ void plStatusLogMgr::BounceLogs() bool plStatusLogMgr::DumpLogs( const char *newFolderName ) { - wchar* wFolderName = hsStringToWString(newFolderName); + wchar_t* wFolderName = hsStringToWString(newFolderName); bool ret = DumpLogs(wFolderName); delete [] wFolderName; return ret; } -bool plStatusLogMgr::DumpLogs( const wchar *newFolderName ) +bool plStatusLogMgr::DumpLogs( const wchar_t *newFolderName ) { bool retVal = true; // assume success // create root path and make sure it exists - wchar temp[MAX_PATH]; + wchar_t temp[MAX_PATH]; std::wstring newPath = L""; if (fBasePath) { @@ -406,9 +406,9 @@ bool plStatusLogMgr::DumpLogs( const wchar *newFolderName ) //// plStatusLog //////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////// -UInt32 plStatusLog::fLoggingOff = false; +uint32_t plStatusLog::fLoggingOff = false; -plStatusLog::plStatusLog( UInt8 numDisplayLines, const wchar *filename, UInt32 flags ) +plStatusLog::plStatusLog( uint8_t numDisplayLines, const wchar_t *filename, uint32_t flags ) { fFileHandle = nil; fSize = 0; @@ -445,8 +445,8 @@ void plStatusLog::IInit() fFlags = fOrigFlags; - fLines = TRACKED_NEW char *[ fMaxNumLines ]; - fColors = TRACKED_NEW UInt32[ fMaxNumLines ]; + fLines = new char *[ fMaxNumLines ]; + fColors = new uint32_t[ fMaxNumLines ]; for( i = 0; i < fMaxNumLines; i++ ) { fLines[ i ] = nil; @@ -469,9 +469,9 @@ bool plStatusLog::IReOpen( void ) // Open the file, clearing it, if necessary if(!(fFlags & kDontWriteFile)) { - wchar file[ MAX_PATH ]; - wchar fileNoExt[MAX_PATH]; - wchar* ext=nil; + wchar_t file[ MAX_PATH ]; + wchar_t fileNoExt[MAX_PATH]; + wchar_t* ext=nil; IParseFileName(file, MAX_PATH, fileNoExt, &ext); fEncryptMe = false; #ifdef PLASMA_EXTERNAL_RELEASE @@ -479,11 +479,11 @@ bool plStatusLog::IReOpen( void ) if( fEncryptMe ) ext = L".elf"; #endif - wchar fileToOpen[MAX_PATH]; + wchar_t fileToOpen[MAX_PATH]; swprintf(fileToOpen, MAX_PATH, L"%s.0%s", fileNoExt, ext); if (!(fFlags & kDontRotateLogs)) { - wchar work[MAX_PATH], work2[MAX_PATH]; + wchar_t work[MAX_PATH], work2[MAX_PATH]; swprintf(work, MAX_PATH, L"%s.3%s",fileNoExt,ext); plFileUtils::RemoveFile(work); swprintf(work2, MAX_PATH, L"%s.2%s",fileNoExt,ext); @@ -537,9 +537,9 @@ void plStatusLog::IFini( void ) } -void plStatusLog::IParseFileName(wchar* file, size_t fnsize, wchar* fileNoExt, wchar** ext) const +void plStatusLog::IParseFileName(wchar_t* file, size_t fnsize, wchar_t* fileNoExt, wchar_t** ext) const { - const wchar *base = plStatusLogMgr::IGetBasePath(); + const wchar_t *base = plStatusLogMgr::IGetBasePath(); if( wcslen( base ) != nil ) swprintf( file, fnsize, L"%s%s%s", base, WPATH_SEPARATOR_STR, fFilename.c_str() ); else @@ -593,7 +593,7 @@ void plStatusLog::ILink( plStatusLog **back ) //// IAddLine //////////////////////////////////////////////////////////////// // Actually add a stinking line. -bool plStatusLog::IAddLine( const char *line, Int32 count, UInt32 color ) +bool plStatusLog::IAddLine( const char *line, int32_t count, uint32_t color ) { int i; @@ -632,7 +632,7 @@ bool plStatusLog::IAddLine( const char *line, Int32 count, UInt32 color ) if (fMaxNumLines > 0) { - fLines[ i ] = TRACKED_NEW char[ count + 1 ]; + fLines[ i ] = new char[ count + 1 ]; hsStrncpy( fLines[ i ], line, count + 1 ); fLines[ i ][ count ] = 0; @@ -654,7 +654,7 @@ bool plStatusLog::IAddLine( const char *line, Int32 count, UInt32 color ) //// AddLine ///////////////////////////////////////////////////////////////// -bool plStatusLog::AddLine( const char *line, UInt32 color ) +bool plStatusLog::AddLine( const char *line, uint32_t color ) { char *c, *str; if(fLoggingOff && !fForceLog) @@ -666,7 +666,7 @@ bool plStatusLog::AddLine( const char *line, UInt32 color ) for( str = (char *)line; ( c = strchr( str, '\n' ) ) != nil; str = c + 1 ) { // So if we got here, c points to a carriage return... - ret = IAddLine( str, (unsigned_ptr)c - (unsigned_ptr)str, color ); + ret = IAddLine( str, (uintptr_t)c - (uintptr_t)str, color ); } /// We might have some left over @@ -687,7 +687,7 @@ bool plStatusLog::AddLineV( const char *format, va_list arguments ) return AddLineV( kWhite, format, arguments ); } -bool plStatusLog::AddLineV( UInt32 color, const char *format, va_list arguments ) +bool plStatusLog::AddLineV( uint32_t color, const char *format, va_list arguments ) { if(fLoggingOff && !fForceLog) return true; @@ -706,7 +706,7 @@ bool plStatusLog::AddLineF( const char *format, ... ) return AddLineV( kWhite, format, arguments ); } -bool plStatusLog::AddLineF( UInt32 color, const char *format, ... ) +bool plStatusLog::AddLineF( uint32_t color, const char *format, ... ) { if(fLoggingOff && !fForceLog) return true; @@ -731,7 +731,7 @@ bool plStatusLog::AddLineS( const char *filename, const char *format, ... ) return log->AddLineV( format, arguments ); } -bool plStatusLog::AddLineS( const char *filename, UInt32 color, const char *format, ... ) +bool plStatusLog::AddLineS( const char *filename, uint32_t color, const char *format, ... ) { plStatusLog *log = plStatusLogMgr::GetInstance().FindLog( filename ); @@ -761,7 +761,7 @@ void plStatusLog::Clear( void ) //// Bounce ////////////////////////////////////////////////////////////////// -void plStatusLog::Bounce( UInt32 flags) +void plStatusLog::Bounce( uint32_t flags) { if (flags) fOrigFlags=flags; @@ -776,16 +776,16 @@ void plStatusLog::Bounce( UInt32 flags) //// IPrintLineToFile //////////////////////////////////////////////////////// -bool plStatusLog::IPrintLineToFile( const char *line, UInt32 count ) +bool plStatusLog::IPrintLineToFile( const char *line, uint32_t count ) { if( fFlags & kDontWriteFile ) return true; #ifdef PLASMA_EXTERNAL_RELEASE - UInt8 hint = 0; + uint8_t hint = 0; if( fFlags & kAppendToLast ) { - hint = (UInt8)fSize; + hint = (uint8_t)fSize; } #endif @@ -856,10 +856,10 @@ bool plStatusLog::IPrintLineToFile( const char *line, UInt32 count ) if( fEncryptMe ) { // Encrypt! - plStatusEncrypt::Encrypt( (UInt8 *)buf, hint ); + plStatusEncrypt::Encrypt( (uint8_t *)buf, hint ); // xor the line length, then write it out, then the line, no terminating character - UInt16 encrySize = length ^ ((UInt16)fSize); + uint16_t encrySize = length ^ ((uint16_t)fSize); // try the first write, if it fails reopen and try again int err; diff --git a/Sources/Plasma/PubUtilLib/plStatusLog/plStatusLog.h b/Sources/Plasma/PubUtilLib/plStatusLog/plStatusLog.h index c5e483a4..965fc74b 100644 --- a/Sources/Plasma/PubUtilLib/plStatusLog/plStatusLog.h +++ b/Sources/Plasma/PubUtilLib/plStatusLog/plStatusLog.h @@ -56,7 +56,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #ifndef _plStatusLog_h #define _plStatusLog_h -#include "hsTypes.h" +#include "HeadSpin.h" #include "hsThread.h" #include @@ -79,17 +79,17 @@ class plStatusLog protected: - mutable UInt32 fFlags; // Mutable so we can change it in IPrintLineToFile() internally - UInt32 fOrigFlags; + mutable uint32_t fFlags; // Mutable so we can change it in IPrintLineToFile() internally + uint32_t fOrigFlags; - UInt32 fMaxNumLines; + uint32_t fMaxNumLines; std::string fCFilename; // used ONLY by GetFileName() std::wstring fFilename; char **fLines; - UInt32 *fColors; + uint32_t *fColors; hsMutex fMutex; // To make multithreaded-safe FILE* fFileHandle; - UInt32 fSize; + uint32_t fSize; bool fEncryptMe; bool fForceLog; @@ -100,19 +100,19 @@ class plStatusLog void IUnlink( void ); void ILink( plStatusLog **back ); - bool IAddLine( const char *line, Int32 count, UInt32 color ); - bool IPrintLineToFile( const char *line, UInt32 count ); - void IParseFileName(wchar* file, size_t fnsize, wchar* fileNoExt, wchar** ext) const; + bool IAddLine( const char *line, int32_t count, uint32_t color ); + bool IPrintLineToFile( const char *line, uint32_t count ); + void IParseFileName(wchar_t* file, size_t fnsize, wchar_t* fileNoExt, wchar_t** ext) const; void IInit( void ); void IFini( void ); bool IReOpen( void ); - plStatusLog( UInt8 numDisplayLines, const wchar *filename, UInt32 flags ); + plStatusLog( uint8_t numDisplayLines, const wchar_t *filename, uint32_t flags ); public: - static UInt32 fLoggingOff; + static uint32_t fLoggingOff; enum StatusFlagType { kFilledBackground = 0x00000001, @@ -159,28 +159,28 @@ class plStatusLog ~plStatusLog(); - bool AddLine( const char *line, UInt32 color = kWhite ); + bool AddLine( const char *line, uint32_t color = kWhite ); /// printf-like functions bool AddLineF( const char *format, ... ); - bool AddLineF( UInt32 color, const char *format, ... ); + bool AddLineF( uint32_t color, const char *format, ... ); bool AddLineV( const char *format, va_list arguments ); - bool AddLineV( UInt32 color, const char *format, va_list arguments ); + bool AddLineV( uint32_t color, const char *format, va_list arguments ); /// Static functions that you give a filename to and it searches for a log based on that /// (or creates one if it isn't available) static bool AddLineS( const char *filename, const char *format, ... ); - static bool AddLineS( const char *filename, UInt32 color, const char *format, ... ); + static bool AddLineS( const char *filename, uint32_t color, const char *format, ... ); void Clear( void ); // Clear and open a new file. - void Bounce( UInt32 flags=0 ); + void Bounce( uint32_t flags=0 ); const char* GetFileName() const {return fCFilename.c_str();} - const wchar* GetFileNameW() const {return fFilename.c_str();} + const wchar_t* GetFileNameW() const {return fFilename.c_str();} void SetForceLog(bool force) { fForceLog = force; } }; @@ -206,12 +206,12 @@ class plStatusLogMgr double fLastLogChangeTime; - static wchar fBasePath[]; + static wchar_t fBasePath[]; - static const wchar *IGetBasePath( void ) { return fBasePath; } + static const wchar_t *IGetBasePath( void ) { return fBasePath; } - void IEnsurePathExists( const wchar *dirName ); - void IPathAppend( wchar *base, const wchar *extra, unsigned maxLen ); + void IEnsurePathExists( const wchar_t *dirName ); + void IPathAppend( wchar_t *base, const wchar_t *extra, unsigned maxLen ); hsMutex fMutex; // To make multithreaded-safe @@ -228,25 +228,25 @@ class plStatusLogMgr void Draw( void ); - plStatusLog *CreateStatusLog( UInt8 numDisplayLines, const char *filename, UInt32 flags = plStatusLog::kFilledBackground ); - plStatusLog *CreateStatusLog( UInt8 numDisplayLines, const wchar *filename, UInt32 flags = plStatusLog::kFilledBackground ); + plStatusLog *CreateStatusLog( uint8_t numDisplayLines, const char *filename, uint32_t flags = plStatusLog::kFilledBackground ); + plStatusLog *CreateStatusLog( uint8_t numDisplayLines, const wchar_t *filename, uint32_t flags = plStatusLog::kFilledBackground ); void ToggleStatusLog( plStatusLog *logToDisplay ); void NextStatusLog( void ); void PrevStatusLog( void ); void SetCurrStatusLog( const char *logName ); - void SetCurrStatusLog( const wchar *logName ); + void SetCurrStatusLog( const wchar_t *logName ); plStatusLog *FindLog( const char *filename, hsBool createIfNotFound = true ); - plStatusLog *FindLog( const wchar *filename, hsBool createIfNotFound = true ); + plStatusLog *FindLog( const wchar_t *filename, hsBool createIfNotFound = true ); void SetDrawer( plStatusLogDrawerStub *drawer ) { fDrawer = drawer; } void SetBasePath( const char * path ); - void SetBasePath( const wchar * path ); + void SetBasePath( const wchar_t * path ); void BounceLogs(); // Create a new folder and copy all log files into it (returns false on failure) bool DumpLogs( const char *newFolderName ); - bool DumpLogs( const wchar *newFolderName ); + bool DumpLogs( const wchar_t *newFolderName ); }; //// plStatusLogDrawerStub Class //////////////////////////////////////////// @@ -260,12 +260,12 @@ class plStatusLogDrawerStub { protected: - UInt32 IGetMaxNumLines( plStatusLog *log ) const { return log->fMaxNumLines; } + uint32_t IGetMaxNumLines( plStatusLog *log ) const { return log->fMaxNumLines; } char **IGetLines( plStatusLog *log ) const { return log->fLines; } const char *IGetFilename( plStatusLog *log ) const { return log->GetFileName(); } - const wchar *IGetFilenameW( plStatusLog *log ) const { return log->GetFileNameW(); } - UInt32 *IGetColors( plStatusLog *log ) const { return log->fColors; } - UInt32 IGetFlags( plStatusLog *log ) const { return log->fFlags; } + const wchar_t *IGetFilenameW( plStatusLog *log ) const { return log->GetFileNameW(); } + uint32_t *IGetColors( plStatusLog *log ) const { return log->fColors; } + uint32_t IGetFlags( plStatusLog *log ) const { return log->fFlags; } public: virtual ~plStatusLogDrawerStub() {} diff --git a/Sources/Plasma/PubUtilLib/plStreamLogger/plStreamLogger.cpp b/Sources/Plasma/PubUtilLib/plStreamLogger/plStreamLogger.cpp index 77712839..dd012bc4 100644 --- a/Sources/Plasma/PubUtilLib/plStreamLogger/plStreamLogger.cpp +++ b/Sources/Plasma/PubUtilLib/plStreamLogger/plStreamLogger.cpp @@ -125,12 +125,12 @@ void hsReadOnlyLoggingStream::FastFwd() hsThrow( "can't fast forward a logging stream"); } -void hsReadOnlyLoggingStream::SetPosition(UInt32 position) +void hsReadOnlyLoggingStream::SetPosition(uint32_t position) { hsThrow( "can't set position on a logging stream"); } -void hsReadOnlyLoggingStream::Skip(UInt32 deltaByteCount) +void hsReadOnlyLoggingStream::Skip(uint32_t deltaByteCount) { hsReadOnlyStream::Skip(deltaByteCount); if (deltaByteCount > 0 && !IsLogEntryWaiting()) @@ -139,9 +139,9 @@ void hsReadOnlyLoggingStream::Skip(UInt32 deltaByteCount) } } -UInt32 hsReadOnlyLoggingStream::Read(UInt32 byteCount, void * buffer) +uint32_t hsReadOnlyLoggingStream::Read(uint32_t byteCount, void * buffer) { - UInt32 ret = hsReadOnlyStream::Read(byteCount,buffer); + uint32_t ret = hsReadOnlyStream::Read(byteCount,buffer); if (ret > 0 && !IsLogEntryWaiting()) { LogEntry(plGenericType::kNone,byteCount,nil,"Unknown Read"); @@ -151,7 +151,7 @@ UInt32 hsReadOnlyLoggingStream::Read(UInt32 byteCount, void * buffer) } -void hsReadOnlyLoggingStream::LogSkip(UInt32 deltaByteCount, const char* desc) +void hsReadOnlyLoggingStream::LogSkip(uint32_t deltaByteCount, const char* desc) { ILogEntryWaiting(); Skip(deltaByteCount); @@ -161,10 +161,10 @@ void hsReadOnlyLoggingStream::LogSkip(UInt32 deltaByteCount, const char* desc) } } -UInt32 hsReadOnlyLoggingStream::LogRead(UInt32 byteCount, void * buffer, const char* desc) +uint32_t hsReadOnlyLoggingStream::LogRead(uint32_t byteCount, void * buffer, const char* desc) { ILogEntryWaiting(); - UInt32 ret = Read(byteCount,buffer); + uint32_t ret = Read(byteCount,buffer); if (ret > 0) { LogEntry(plGenericType::kNone,byteCount,nil,desc); @@ -175,15 +175,15 @@ UInt32 hsReadOnlyLoggingStream::LogRead(UInt32 byteCount, void * buffer, const c char *hsReadOnlyLoggingStream::LogReadSafeString() { LogSubStreamStart("push me"); - UInt16 numChars; + uint16_t numChars; LogReadLE(&numChars,"NumChars"); numChars &= ~0xf000; // XXX: remove when hsStream no longer does this. if (numChars > 0) { - char *name = TRACKED_NEW char[numChars+1]; + char *name = new char[numChars+1]; ILogEntryWaiting(); - UInt32 ret = Read(numChars, name); + uint32_t ret = Read(numChars, name); name[numChars] = '\0'; if (ret > 0) { @@ -199,13 +199,13 @@ char *hsReadOnlyLoggingStream::LogReadSafeString() char *hsReadOnlyLoggingStream::LogReadSafeStringLong() { LogSubStreamStart("push me"); - UInt32 numChars; + uint32_t numChars; LogReadLE(&numChars,"NumChars"); if (numChars > 0) { - char *name = TRACKED_NEW char[numChars+1]; + char *name = new char[numChars+1]; ILogEntryWaiting(); - UInt32 ret = Read(numChars, name); + uint32_t ret = Read(numChars, name); name[numChars] = '\0'; if (ret > 0) { diff --git a/Sources/Plasma/PubUtilLib/plStreamLogger/plStreamLogger.h b/Sources/Plasma/PubUtilLib/plStreamLogger/plStreamLogger.h index 6e33f57c..73d9746e 100644 --- a/Sources/Plasma/PubUtilLib/plStreamLogger/plStreamLogger.h +++ b/Sources/Plasma/PubUtilLib/plStreamLogger/plStreamLogger.h @@ -113,37 +113,37 @@ private: public: void Rewind(); void FastFwd(); - void SetPosition(UInt32 position); + void SetPosition(uint32_t position); - UInt32 Read(UInt32 byteCount, void * buffer); - void Skip(UInt32 deltaByteCount); + uint32_t Read(uint32_t byteCount, void * buffer); + void Skip(uint32_t deltaByteCount); - UInt32 LogRead(UInt32 byteCount, void * buffer, const char* desc); + uint32_t LogRead(uint32_t byteCount, void * buffer, const char* desc); char* LogReadSafeString(); char* LogReadSafeStringLong(); - void LogSkip(UInt32 deltaByteCount, const char* desc); + void LogSkip(uint32_t deltaByteCount, const char* desc); void LogStringString(const char* s); void LogSubStreamStart(const char* desc); void LogSubStreamEnd(); void LogSubStreamPushDesc(const char* desc); LOG_READ_LE(bool, kBool) - LOG_READ_LE(UInt8, kUInt) - LOG_READ_LE(UInt16, kUInt) - LOG_READ_LE(UInt32, kUInt) - LOG_READ_LE_ARRAY(UInt8, kUInt) - LOG_READ_LE_ARRAY(UInt16, kUInt) - LOG_READ_LE_ARRAY(UInt32, kUInt) - - LOG_READ_LE(Int8, kInt) + LOG_READ_LE(uint8_t, kUInt) + LOG_READ_LE(uint16_t, kUInt) + LOG_READ_LE(uint32_t, kUInt) + LOG_READ_LE_ARRAY(uint8_t, kUInt) + LOG_READ_LE_ARRAY(uint16_t, kUInt) + LOG_READ_LE_ARRAY(uint32_t, kUInt) + + LOG_READ_LE(int8_t, kInt) LOG_READ_LE(char, kChar) - LOG_READ_LE(Int16, kInt) - LOG_READ_LE(Int32, kInt) + LOG_READ_LE(int16_t, kInt) + LOG_READ_LE(int32_t, kInt) LOG_READ_LE(int, kInt) - LOG_READ_LE_ARRAY(Int8, kInt) + LOG_READ_LE_ARRAY(int8_t, kInt) LOG_READ_LE_ARRAY(char, kChar) - LOG_READ_LE_ARRAY(Int16, kInt) - LOG_READ_LE_ARRAY(Int32, kInt) + LOG_READ_LE_ARRAY(int16_t, kInt) + LOG_READ_LE_ARRAY(int32_t, kInt) LOG_READ_LE_ARRAY(int, kInt) LOG_READ_LE(float, kFloat) diff --git a/Sources/Plasma/PubUtilLib/plSurface/hsGMaterial.cpp b/Sources/Plasma/PubUtilLib/plSurface/hsGMaterial.cpp index ff9b8f45..f258df5b 100644 --- a/Sources/Plasma/PubUtilLib/plSurface/hsGMaterial.cpp +++ b/Sources/Plasma/PubUtilLib/plSurface/hsGMaterial.cpp @@ -43,7 +43,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "hsGMaterial.h" #include -#include "hsTypes.h" +#include "HeadSpin.h" #include "hsMemory.h" #include "hsResMgr.h" #include "plLayerInterface.h" @@ -72,17 +72,17 @@ hsGMaterial::~hsGMaterial() IClearLayers(); } -plLayerInterface* hsGMaterial::GetPiggyBack(UInt32 which) +plLayerInterface* hsGMaterial::GetPiggyBack(uint32_t which) { return fPiggyBacks[which]; } -plLayerInterface* hsGMaterial::GetLayer(UInt32 which) +plLayerInterface* hsGMaterial::GetLayer(uint32_t which) { return fLayers[which]; } -UInt32 hsGMaterial::IMakeExtraLayer() +uint32_t hsGMaterial::IMakeExtraLayer() { fLayers.ExpandAndZero(GetNumLayers()+1); return fLayers.GetCount(); @@ -116,7 +116,7 @@ hsGMaterial* hsGMaterial::Clone() hsGMaterial* hsGMaterial::CloneNoLayers() { - hsGMaterial* clo = TRACKED_NEW hsGMaterial; + hsGMaterial* clo = new hsGMaterial; clo->fCompFlags = fCompFlags; clo->fLoadFlags = fLoadFlags; @@ -126,7 +126,7 @@ hsGMaterial* hsGMaterial::CloneNoLayers() plLayer* hsGMaterial::MakeBaseLayer() { - plLayer* newLay = TRACKED_NEW plLayer; + plLayer* newLay = new plLayer; newLay->InitToDefault(); IClearLayers(); @@ -145,12 +145,12 @@ plLayer* hsGMaterial::MakeBaseLayer() return newLay; } -UInt32 hsGMaterial::AddLayerViaNotify(plLayerInterface* layer) +uint32_t hsGMaterial::AddLayerViaNotify(plLayerInterface* layer) { int idx = GetNumLayers(); // Add via notify so we'll dispose of it properly later. - plMatRefMsg* msg = TRACKED_NEW plMatRefMsg(GetKey(), plRefMsg::kOnRequest, idx, plMatRefMsg::kLayer); + plMatRefMsg* msg = new plMatRefMsg(GetKey(), plRefMsg::kOnRequest, idx, plMatRefMsg::kLayer); hsgResMgr::ResMgr()->SendRef(layer->GetKey(), msg, plRefFlags::kActiveRef); fLayers.SetCount(idx+1); @@ -190,14 +190,14 @@ void hsGMaterial::RemoveLayer(plLayerInterface* lay, hsBool piggyBack) layers.Remove(i); } -void hsGMaterial::InsertLayer(plLayerInterface* layer, Int32 which, hsBool piggyBack) +void hsGMaterial::InsertLayer(plLayerInterface* layer, int32_t which, hsBool piggyBack) { hsTArray& layers = piggyBack ? fPiggyBacks : fLayers; hsAssert(which <= layers.GetCount(), "Material layers Exceeding test depth"); layers.InsertAtIndex(which, layer); } -void hsGMaterial::SetLayer(plLayerInterface* layer, Int32 which, hsBool insert, hsBool piggyBack) +void hsGMaterial::SetLayer(plLayerInterface* layer, int32_t which, hsBool insert, hsBool piggyBack) { if( insert ) { @@ -266,17 +266,17 @@ void hsGMaterial::Read(hsStream *stream, hsResMgr *group) // Assign texture(s) for (iLay = 0; iLay < GetNumLayers(); iLay++) { - plMatRefMsg* msg = TRACKED_NEW plMatRefMsg(GetKey(), plRefMsg::kOnCreate, iLay, plMatRefMsg::kLayer); + plMatRefMsg* msg = new plMatRefMsg(GetKey(), plRefMsg::kOnCreate, iLay, plMatRefMsg::kLayer); plKey key = group->ReadKeyNotifyMe(stream, msg, plRefFlags::kActiveRef); } for (iLay = 0; iLay < GetNumPiggyBacks(); iLay++) { - plMatRefMsg* msg = TRACKED_NEW plMatRefMsg(GetKey(), plRefMsg::kOnCreate, iLay, plMatRefMsg::kPiggyBack); + plMatRefMsg* msg = new plMatRefMsg(GetKey(), plRefMsg::kOnCreate, iLay, plMatRefMsg::kPiggyBack); plKey key = group->ReadKeyNotifyMe(stream, msg, plRefFlags::kActiveRef); } } -void hsGMaterial::Eval(double secs, UInt32 frame) +void hsGMaterial::Eval(double secs, uint32_t frame) { plProfile_BeginLap(MaterialAnims, GetKeyName().c_str()); diff --git a/Sources/Plasma/PubUtilLib/plSurface/hsGMaterial.h b/Sources/Plasma/PubUtilLib/plSurface/hsGMaterial.h index 3a06952d..0fc5b72f 100644 --- a/Sources/Plasma/PubUtilLib/plSurface/hsGMaterial.h +++ b/Sources/Plasma/PubUtilLib/plSurface/hsGMaterial.h @@ -81,20 +81,20 @@ public: }; protected: - UInt32 fLOD; + uint32_t fLOD; hsTArray fLayers; hsTArray fPiggyBacks; - UInt32 fCompFlags; - UInt32 fLoadFlags; + uint32_t fCompFlags; + uint32_t fLoadFlags; - hsScalar fLastUpdateTime; + float fLastUpdateTime; void IClearLayers(); - UInt32 IMakeExtraLayer(); + uint32_t IMakeExtraLayer(); - void InsertLayer(plLayerInterface* lay, Int32 which = 0, hsBool piggyBack = false); - void SetLayer(plLayerInterface* lay, Int32 which = 0, hsBool insert=false, hsBool piggyBack=false); + void InsertLayer(plLayerInterface* lay, int32_t which = 0, hsBool piggyBack = false); + void SetLayer(plLayerInterface* lay, int32_t which = 0, hsBool insert=false, hsBool piggyBack=false); void ReplaceLayer(plLayerInterface* oldLay, plLayerInterface* newLay, hsBool piggyBack = false); void RemoveLayer(plLayerInterface* oldLay, hsBool piggyBack = false); public: @@ -105,24 +105,24 @@ public: virtual hsGMaterial* CloneNoLayers(); // For things like blending copies, that manipulate layers directly. // copies no keyed objects. plLayer* MakeBaseLayer(); - plLayerInterface* GetLayer(UInt32 which); - plLayerInterface* GetPiggyBack(UInt32 which); - UInt32 AddLayerViaNotify(plLayerInterface* lay); - UInt32 GetNumLayers() const { return fLayers.GetCount(); } + plLayerInterface* GetLayer(uint32_t which); + plLayerInterface* GetPiggyBack(uint32_t which); + uint32_t AddLayerViaNotify(plLayerInterface* lay); + uint32_t GetNumLayers() const { return fLayers.GetCount(); } void SetNumLayers(int cnt); - UInt32 GetNumPiggyBacks() const { return fPiggyBacks.GetCount(); } + uint32_t GetNumPiggyBacks() const { return fPiggyBacks.GetCount(); } void SetNumPiggyBacks(); - void SetLOD(UInt32 l) { fLOD = l; } - UInt32 GetLOD() const { return fLOD; } + void SetLOD(uint32_t l) { fLOD = l; } + uint32_t GetLOD() const { return fLOD; } - void SetCompositeFlags(UInt32 f) { fCompFlags = f; } // normally composite flags are calculated internally, not set. - UInt32 GetCompositeFlags() const { return fCompFlags; } - UInt32 GetLoadFlags() const { return fLoadFlags; } + void SetCompositeFlags(uint32_t f) { fCompFlags = f; } // normally composite flags are calculated internally, not set. + uint32_t GetCompositeFlags() const { return fCompFlags; } + uint32_t GetLoadFlags() const { return fLoadFlags; } - hsScalar GetLastUpdateTime() const { return fLastUpdateTime; } - void SetLastUpdateTime(hsScalar f) { fLastUpdateTime = f; } - hsBool IShouldUpdate(hsScalar secs, UInt32 flags) { return GetLastUpdateTime() != secs || (flags & kUpdateAgain); } + float GetLastUpdateTime() const { return fLastUpdateTime; } + void SetLastUpdateTime(float f) { fLastUpdateTime = f; } + hsBool IShouldUpdate(float secs, uint32_t flags) { return GetLastUpdateTime() != secs || (flags & kUpdateAgain); } hsBool IsDynamic() const { return (fCompFlags & kCompDynamic); } hsBool IsDecal() const { return (fCompFlags & kCompDecal); } @@ -133,7 +133,7 @@ public: virtual void Read(hsStream* s, hsResMgr *group); virtual void Write(hsStream* s, hsResMgr *group); - virtual void Eval(double secs, UInt32 frame); + virtual void Eval(double secs, uint32_t frame); virtual void Reset(); virtual void Init(); diff --git a/Sources/Plasma/PubUtilLib/plSurface/plGrassShaderMod.cpp b/Sources/Plasma/PubUtilLib/plSurface/plGrassShaderMod.cpp index 01ec71e9..a87fb1c6 100644 --- a/Sources/Plasma/PubUtilLib/plSurface/plGrassShaderMod.cpp +++ b/Sources/Plasma/PubUtilLib/plSurface/plGrassShaderMod.cpp @@ -200,7 +200,7 @@ void plGrassShaderMod::Read(hsStream *stream, hsResMgr *mgr) { plModifier::Read(stream, mgr); - mgr->ReadKeyNotifyMe(stream, TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnRequest, 0, kRefMaterial), plRefFlags::kActiveRef); + mgr->ReadKeyNotifyMe(stream, new plGenRefMsg(GetKey(), plRefMsg::kOnRequest, 0, kRefMaterial), plRefFlags::kActiveRef); int i; for (i = 0; i < kNumWaves; i++) @@ -211,7 +211,7 @@ void plGrassShaderMod::Read(hsStream *stream, hsResMgr *mgr) plgDispatch::Dispatch()->RegisterForExactType(plAgeLoadedMsg::Index(), GetKey()); } -hsBool plGrassShaderMod::IEval(double secs, hsScalar del, UInt32 dirty) +hsBool plGrassShaderMod::IEval(double secs, float del, uint32_t dirty) { if (fVShader) { @@ -225,7 +225,7 @@ void plGrassShaderMod::ISetupShaders() { if (!fVShader) { - plShader* vShader = TRACKED_NEW plShader; + plShader* vShader = new plShader; plString buff = plString::Format("%s_GrassVS", GetKey()->GetName().c_str()); hsgResMgr::ResMgr()->NewKey(buff, vShader, GetKey()->GetUoid().GetLocation()); vShader->SetIsPixelShader(false); @@ -234,7 +234,7 @@ void plGrassShaderMod::ISetupShaders() vShader->SetNumConsts(plGrassVS::kNumConsts); vShader->SetVector(plGrassVS::kNumericConsts, 0.f, 0.5f, 1.f, 2.f); - vShader->SetVector(plGrassVS::kPiConsts, 1.f / (8.f*hsScalarPI*4.f*4.f), hsScalarPI/2.f, hsScalarPI, hsScalarPI*2.f); + vShader->SetVector(plGrassVS::kPiConsts, 1.f / (8.f*M_PI*4.f*4.f), M_PI/2.f, M_PI, M_PI*2.f); vShader->SetVector(plGrassVS::kSinConsts, -1.f/6.f, 1.f/120.f, -1.f/5040.f, 1.f/362880.f); IRefreshWaves(vShader); @@ -243,12 +243,12 @@ void plGrassShaderMod::ISetupShaders() vShader->SetPipeConst(0, plPipeConst::kLocalToNDC, plGrassVS::kLocalToNDC); vShader->SetDecl(plShaderTable::Decl(plShaderID::vs_GrassShader)); - hsgResMgr::ResMgr()->SendRef(vShader->GetKey(), TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnRequest, 0, kRefGrassVS), plRefFlags::kActiveRef); + hsgResMgr::ResMgr()->SendRef(vShader->GetKey(), new plGenRefMsg(GetKey(), plRefMsg::kOnRequest, 0, kRefGrassVS), plRefFlags::kActiveRef); } if (!fPShader) { - plShader* pShader = TRACKED_NEW plShader; + plShader* pShader = new plShader; plString buff = plString::Format("%s_GrassPS", GetKey()->GetName().c_str()); hsgResMgr::ResMgr()->NewKey(buff, pShader, GetKey()->GetUoid().GetLocation()); pShader->SetIsPixelShader(true); @@ -256,18 +256,18 @@ void plGrassShaderMod::ISetupShaders() pShader->SetInputFormat(0); pShader->SetOutputFormat(0); pShader->SetDecl(plShaderTable::Decl(plShaderID::ps_GrassShader)); - hsgResMgr::ResMgr()->SendRef(pShader->GetKey(), TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnRequest, 0, kRefGrassPS), plRefFlags::kActiveRef); + hsgResMgr::ResMgr()->SendRef(pShader->GetKey(), new plGenRefMsg(GetKey(), plRefMsg::kOnRequest, 0, kRefGrassPS), plRefFlags::kActiveRef); } plLayer* layer = plLayer::ConvertNoRef(fMaterial->GetLayer(0)->BottomOfStack()); if (layer && (layer->GetVertexShader() != fVShader)) { - plLayRefMsg* refMsg = TRACKED_NEW plLayRefMsg(layer->GetKey(), plRefMsg::kOnCreate, 0, plLayRefMsg::kVertexShader); + plLayRefMsg* refMsg = new plLayRefMsg(layer->GetKey(), plRefMsg::kOnCreate, 0, plLayRefMsg::kVertexShader); hsgResMgr::ResMgr()->SendRef(fVShader->GetKey(), refMsg, plRefFlags::kActiveRef); } if (layer && (layer->GetPixelShader() != fPShader)) { - plLayRefMsg* refMsg = TRACKED_NEW plLayRefMsg(layer->GetKey(), plRefMsg::kOnCreate, 0, plLayRefMsg::kPixelShader); + plLayRefMsg* refMsg = new plLayRefMsg(layer->GetKey(), plRefMsg::kOnCreate, 0, plLayRefMsg::kPixelShader); hsgResMgr::ResMgr()->SendRef(fPShader->GetKey(), refMsg, plRefFlags::kActiveRef); } } diff --git a/Sources/Plasma/PubUtilLib/plSurface/plGrassShaderMod.h b/Sources/Plasma/PubUtilLib/plSurface/plGrassShaderMod.h index 259bd868..fda56818 100644 --- a/Sources/Plasma/PubUtilLib/plSurface/plGrassShaderMod.h +++ b/Sources/Plasma/PubUtilLib/plSurface/plGrassShaderMod.h @@ -53,12 +53,12 @@ class plGrassWave public: plGrassWave() : fDistX(0.F), fDistY(0.F), fDistZ(0.F), fDirX(0.F), fDirY(0.F), fSpeed(0.F) {} - hsScalar fDistX; - hsScalar fDistY; - hsScalar fDistZ; - hsScalar fDirX; - hsScalar fDirY; - hsScalar fSpeed; + float fDistX; + float fDistY; + float fDistZ; + float fDirX; + float fDirY; + float fSpeed; void Write(hsStream *s); void Read(hsStream *s); @@ -99,7 +99,7 @@ public: plGrassWave fWaves[kNumWaves]; protected: - virtual hsBool IEval(double secs, hsScalar del, UInt32 dirty); + virtual hsBool IEval(double secs, float del, uint32_t dirty); virtual void IApplyDynamic() {}; // dummy function required by base class void ISetupShaders(); void IRefreshWaves(plShader *vShader); diff --git a/Sources/Plasma/PubUtilLib/plSurface/plLayer.cpp b/Sources/Plasma/PubUtilLib/plSurface/plLayer.cpp index 2d38d408..7e4e7d3e 100644 --- a/Sources/Plasma/PubUtilLib/plSurface/plLayer.cpp +++ b/Sources/Plasma/PubUtilLib/plSurface/plLayer.cpp @@ -40,7 +40,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "plLayer.h" #include "plMessage/plAnimCmdMsg.h" #include "hsStream.h" @@ -73,32 +73,32 @@ plLayer::plLayer() | kPixelShader | kBumpEnvXfm; - fTransform = TRACKED_NEW hsMatrix44; + fTransform = new hsMatrix44; fTransform->Reset(); - fPreshadeColor = TRACKED_NEW hsColorRGBA; - fRuntimeColor = TRACKED_NEW hsColorRGBA; - fAmbientColor = TRACKED_NEW hsColorRGBA; - fSpecularColor = TRACKED_NEW hsColorRGBA; - fOpacity = TRACKED_NEW hsScalar; + fPreshadeColor = new hsColorRGBA; + fRuntimeColor = new hsColorRGBA; + fAmbientColor = new hsColorRGBA; + fSpecularColor = new hsColorRGBA; + fOpacity = new float; - fState = TRACKED_NEW hsGMatState; + fState = new hsGMatState; fState->Reset(); - fUVWSrc = TRACKED_NEW UInt32; - fLODBias = TRACKED_NEW hsScalar; - fSpecularPower = TRACKED_NEW hsScalar; + fUVWSrc = new uint32_t; + fLODBias = new float; + fSpecularPower = new float; - fTexture = TRACKED_NEW plBitmap*; + fTexture = new plBitmap*; *fTexture = nil; - fVertexShader = TRACKED_NEW plShader*; + fVertexShader = new plShader*; *fVertexShader = nil; - fPixelShader = TRACKED_NEW plShader*; + fPixelShader = new plShader*; *fPixelShader = nil; - fBumpEnvXfm = TRACKED_NEW hsMatrix44; + fBumpEnvXfm = new hsMatrix44; fBumpEnvXfm->Reset(); } @@ -106,9 +106,9 @@ plLayer::~plLayer() { } -UInt32 plLayer::Eval(double secs, UInt32 frame, UInt32 ignore) +uint32_t plLayer::Eval(double secs, uint32_t frame, uint32_t ignore) { - return UInt32(0); + return uint32_t(0); } void plLayer::Read(hsStream* s, hsResMgr* mgr) @@ -128,14 +128,14 @@ void plLayer::Read(hsStream* s, hsResMgr* mgr) *fLODBias = s->ReadLEScalar(); *fSpecularPower = s->ReadLEScalar(); - plLayRefMsg* refMsg = TRACKED_NEW plLayRefMsg(GetKey(), plRefMsg::kOnCreate, 0, plLayRefMsg::kTexture); + plLayRefMsg* refMsg = new plLayRefMsg(GetKey(), plRefMsg::kOnCreate, 0, plLayRefMsg::kTexture); mgr->ReadKeyNotifyMe(s,refMsg, plRefFlags::kActiveRef); #if 1 // For read/write shaders - refMsg = TRACKED_NEW plLayRefMsg(GetKey(), plRefMsg::kOnCreate, 0, plLayRefMsg::kVertexShader); + refMsg = new plLayRefMsg(GetKey(), plRefMsg::kOnCreate, 0, plLayRefMsg::kVertexShader); mgr->ReadKeyNotifyMe(s,refMsg, plRefFlags::kActiveRef); - refMsg = TRACKED_NEW plLayRefMsg(GetKey(), plRefMsg::kOnCreate, 0, plLayRefMsg::kPixelShader); + refMsg = new plLayRefMsg(GetKey(), plRefMsg::kOnCreate, 0, plLayRefMsg::kPixelShader); mgr->ReadKeyNotifyMe(s,refMsg, plRefFlags::kActiveRef); fBumpEnvXfm->Read(s); diff --git a/Sources/Plasma/PubUtilLib/plSurface/plLayer.h b/Sources/Plasma/PubUtilLib/plSurface/plLayer.h index 23d0a307..924c51ba 100644 --- a/Sources/Plasma/PubUtilLib/plSurface/plLayer.h +++ b/Sources/Plasma/PubUtilLib/plSurface/plLayer.h @@ -56,7 +56,7 @@ public: CLASSNAME_REGISTER( plLayer ); GETINTERFACE_ANY( plLayer, plLayerInterface ); - virtual UInt32 Eval(double secs, UInt32 frame, UInt32 ignore); + virtual uint32_t Eval(double secs, uint32_t frame, uint32_t ignore); virtual void Read(hsStream* s, hsResMgr* mgr); virtual void Write(hsStream* s, hsResMgr* mgr); @@ -66,11 +66,11 @@ public: // Flat layer specifics plLayer& InitToDefault(); - void SetBlendFlags(UInt32 f) { fState->fBlendFlags = f; } - void SetClampFlags(UInt32 f) { fState->fClampFlags = f; } - void SetShadeFlags(UInt32 f) { fState->fShadeFlags = f; } - void SetZFlags(UInt32 f) { fState->fZFlags = f; } - void SetMiscFlags(UInt32 f) { fState->fMiscFlags = f; } + void SetBlendFlags(uint32_t f) { fState->fBlendFlags = f; } + void SetClampFlags(uint32_t f) { fState->fClampFlags = f; } + void SetShadeFlags(uint32_t f) { fState->fShadeFlags = f; } + void SetZFlags(uint32_t f) { fState->fZFlags = f; } + void SetMiscFlags(uint32_t f) { fState->fMiscFlags = f; } void SetState(const hsGMatState& state); void SetTexture(plBitmap* t) { *fTexture = t; } @@ -79,11 +79,11 @@ public: void SetRuntimeColor( const hsColorRGBA& col ) { *fRuntimeColor = col; } void SetAmbientColor(const hsColorRGBA& col) { *fAmbientColor = col; } void SetSpecularColor(const hsColorRGBA& col) { *fSpecularColor = col; } - void SetOpacity(hsScalar a) { *fOpacity = a; } + void SetOpacity(float a) { *fOpacity = a; } void SetTransform(const hsMatrix44& xfm); - void SetUVWSrc(UInt32 chan) { *fUVWSrc = chan; } - void SetLODBias(hsScalar f) { *fLODBias = f; } - void SetSpecularPower(hsScalar f) { *fSpecularPower = f; } + void SetUVWSrc(uint32_t chan) { *fUVWSrc = chan; } + void SetLODBias(float f) { *fLODBias = f; } + void SetSpecularPower(float f) { *fSpecularPower = f; } void SetVertexShader(plShader* shader) { *fVertexShader = shader; } void SetPixelShader(plShader* shader) { *fPixelShader = shader; } diff --git a/Sources/Plasma/PubUtilLib/plSurface/plLayerAnimation.cpp b/Sources/Plasma/PubUtilLib/plSurface/plLayerAnimation.cpp index 6882e336..4e84ff9a 100644 --- a/Sources/Plasma/PubUtilLib/plSurface/plLayerAnimation.cpp +++ b/Sources/Plasma/PubUtilLib/plSurface/plLayerAnimation.cpp @@ -40,7 +40,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "hsTimer.h" #include "plLayerAnimation.h" #include "pnKeyedObject/plKey.h" @@ -98,32 +98,32 @@ void plLayerAnimationBase::Read(hsStream* s, hsResMgr* mgr) if( fOpacityCtl ) { fOwnedChannels |= kOpacity; - fOpacity = TRACKED_NEW hsScalar; + fOpacity = new float; } if( fPreshadeColorCtl ) { fOwnedChannels |= kPreshadeColor; - fPreshadeColor = TRACKED_NEW hsColorRGBA; + fPreshadeColor = new hsColorRGBA; } if( fRuntimeColorCtl ) { fOwnedChannels |= kRuntimeColor; - fRuntimeColor = TRACKED_NEW hsColorRGBA; + fRuntimeColor = new hsColorRGBA; } if( fAmbientColorCtl ) { fOwnedChannels |= kAmbientColor; - fAmbientColor = TRACKED_NEW hsColorRGBA; + fAmbientColor = new hsColorRGBA; } if( fSpecularColorCtl ) { fOwnedChannels |= kSpecularColor; - fSpecularColor = TRACKED_NEW hsColorRGBA; + fSpecularColor = new hsColorRGBA; } if( fTransformCtl ) { fOwnedChannels |= kTransform; - fTransform = TRACKED_NEW hsMatrix44; + fTransform = new hsMatrix44; } fLength = IMakeUniformLength(); } @@ -145,7 +145,7 @@ plLayerInterface* plLayerAnimationBase::Attach(plLayerInterface* prev) return plLayerInterface::Attach(prev); } -void plLayerAnimationBase::IEvalConvertedTime(hsScalar secs, UInt32 passChans, UInt32 evalChans, UInt32 &dirty) +void plLayerAnimationBase::IEvalConvertedTime(float secs, uint32_t passChans, uint32_t evalChans, uint32_t &dirty) { if( evalChans & kPreshadeColor ) { @@ -220,7 +220,7 @@ void plLayerAnimationBase::SetPreshadeColorCtl(plController* colCtl) if( fPreshadeColorCtl ) delete fPreshadeColorCtl; else - fPreshadeColor = TRACKED_NEW hsColorRGBA; + fPreshadeColor = new hsColorRGBA; fOwnedChannels |= kPreshadeColor; fPreshadeColorCtl = colCtl; @@ -231,7 +231,7 @@ void plLayerAnimationBase::SetRuntimeColorCtl(plController* colCtl) if( fRuntimeColorCtl ) delete fRuntimeColorCtl; else - fRuntimeColor = TRACKED_NEW hsColorRGBA; + fRuntimeColor = new hsColorRGBA; fOwnedChannels |= kRuntimeColor; fRuntimeColorCtl = colCtl; @@ -242,7 +242,7 @@ void plLayerAnimationBase::SetAmbientColorCtl(plController* ambCtl) if( fAmbientColorCtl ) delete fAmbientColorCtl; else - fAmbientColor = TRACKED_NEW hsColorRGBA; + fAmbientColor = new hsColorRGBA; fOwnedChannels |= kAmbientColor; fAmbientColorCtl = ambCtl; @@ -253,7 +253,7 @@ void plLayerAnimationBase::SetSpecularColorCtl(plController* ambCtl) if( fSpecularColorCtl ) delete fSpecularColorCtl; else - fSpecularColor = TRACKED_NEW hsColorRGBA; + fSpecularColor = new hsColorRGBA; fOwnedChannels |= kSpecularColor; fSpecularColorCtl = ambCtl; @@ -264,7 +264,7 @@ void plLayerAnimationBase::SetOpacityCtl(plController* opaCtl) if( fOpacityCtl ) delete fOpacityCtl; else - fOpacity = TRACKED_NEW hsScalar; + fOpacity = new float; fOwnedChannels |= kOpacity; fOpacityCtl = opaCtl; @@ -275,13 +275,13 @@ void plLayerAnimationBase::SetTransformCtl(plController* xfmCtl) if( fTransformCtl ) delete fTransformCtl; else - fTransform = TRACKED_NEW hsMatrix44; + fTransform = new hsMatrix44; fOwnedChannels |= kTransform; fTransformCtl = xfmCtl; } -hsScalar plLayerAnimationBase::IMakeUniformLength() +float plLayerAnimationBase::IMakeUniformLength() { fLength = 0; if( fPreshadeColorCtl && (fPreshadeColorCtl->GetLength() > fLength) ) @@ -330,7 +330,7 @@ void plLayerAnimation::Read(hsStream* s, hsResMgr* mgr) // add sdl modifier delete fLayerSDLMod; - fLayerSDLMod = TRACKED_NEW plLayerSDLModifier; + fLayerSDLMod = new plLayerSDLModifier; fLayerSDLMod->SetLayerAnimation(this); } @@ -349,14 +349,14 @@ plLayerInterface* plLayerAnimation::Attach(plLayerInterface* prev) return plLayerAnimationBase::Attach(prev); } -UInt32 plLayerAnimation::Eval(double wSecs, UInt32 frame, UInt32 ignore) +uint32_t plLayerAnimation::Eval(double wSecs, uint32_t frame, uint32_t ignore) { - UInt32 dirty = plLayerInterface::Eval(wSecs, frame, ignore); + uint32_t dirty = plLayerInterface::Eval(wSecs, frame, ignore); if( wSecs != fEvalTime ) { - UInt32 evalChans = 0; - UInt32 passChans = dirty | fPassThruChannels; - hsScalar secs = fTimeConvert.WorldToAnimTime(wSecs); + uint32_t evalChans = 0; + uint32_t passChans = dirty | fPassThruChannels; + float secs = fTimeConvert.WorldToAnimTime(wSecs); if( secs != fCurrentTime ) { evalChans = fOwnedChannels & ~ignore & ~fPassThruChannels; @@ -427,7 +427,7 @@ plLayerLinkAnimation::plLayerLinkAnimation() : fLastFadeFlag(0), fFadeFlagsDirty(false) { - fIFaceCallback = TRACKED_NEW plEventCallbackMsg(); + fIFaceCallback = new plEventCallbackMsg(); fIFaceCallback->fEvent = kTime; fIFaceCallback->fRepeats = 0; } @@ -463,26 +463,26 @@ void plLayerLinkAnimation::Write(hsStream* s, hsResMgr* mgr) s->WriteBool(fLeavingAge); } -UInt32 plLayerLinkAnimation::Eval(double wSecs, UInt32 frame, UInt32 ignore) +uint32_t plLayerLinkAnimation::Eval(double wSecs, uint32_t frame, uint32_t ignore) { - UInt32 dirty = plLayerInterface::Eval(wSecs, frame, ignore); + uint32_t dirty = plLayerInterface::Eval(wSecs, frame, ignore); if (wSecs != fEvalTime) { - UInt32 evalChans = 0; - UInt32 passChans = dirty | fPassThruChannels; - hsScalar oldAnimTime = fTimeConvert.CurrentAnimTime(); - hsScalar secs = oldAnimTime; + uint32_t evalChans = 0; + uint32_t passChans = dirty | fPassThruChannels; + float oldAnimTime = fTimeConvert.CurrentAnimTime(); + float secs = oldAnimTime; if (fFadeFlagsDirty) { - hsScalar goal = 0.f; + float goal = 0.f; if (fFadeFlags & kFadeLinkPrep) secs = goal = fLength; else { - hsScalar rate = 0.f; - hsScalar delta = (hsScalar)(wSecs - fEvalTime); + float rate = 0.f; + float delta = (float)(wSecs - fEvalTime); if (fFadeFlags & kFadeLinking) { @@ -527,7 +527,7 @@ UInt32 plLayerLinkAnimation::Eval(double wSecs, UInt32 frame, UInt32 ignore) { // Either we're going opaque, or we were opaque and now we're fading. // Tell the armature to re-eval its opacity settings. - plAvatarOpacityCallbackMsg *opacityMsg = TRACKED_NEW plAvatarOpacityCallbackMsg(fLinkKey, kStop); + plAvatarOpacityCallbackMsg *opacityMsg = new plAvatarOpacityCallbackMsg(fLinkKey, kStop); opacityMsg->SetBCastFlag(plMessage::kPropagateToModifiers); opacityMsg->Send(); } @@ -540,7 +540,7 @@ UInt32 plLayerLinkAnimation::Eval(double wSecs, UInt32 frame, UInt32 ignore) return dirty; } -void plLayerLinkAnimation::SetFadeFlag(UInt8 flag, hsBool val) +void plLayerLinkAnimation::SetFadeFlag(uint8_t flag, hsBool val) { if (val) fFadeFlags |= flag; @@ -681,13 +681,13 @@ plLayerSDLAnimation::~plLayerSDLAnimation() delete [] fVarName; } -UInt32 plLayerSDLAnimation::Eval(double wSecs, UInt32 frame, UInt32 ignore) +uint32_t plLayerSDLAnimation::Eval(double wSecs, uint32_t frame, uint32_t ignore) { - UInt32 dirty = plLayerInterface::Eval(wSecs, frame, ignore); + uint32_t dirty = plLayerInterface::Eval(wSecs, frame, ignore); if( wSecs != fEvalTime ) { - UInt32 evalChans = 0; - UInt32 passChans = dirty | fPassThruChannels; + uint32_t evalChans = 0; + uint32_t passChans = dirty | fPassThruChannels; if (fEvalTime < 0) { @@ -703,7 +703,7 @@ UInt32 plLayerSDLAnimation::Eval(double wSecs, UInt32 frame, UInt32 ignore) } } } - hsScalar secs; + float secs; if (fVar) fVar->Get(&secs); else diff --git a/Sources/Plasma/PubUtilLib/plSurface/plLayerAnimation.h b/Sources/Plasma/PubUtilLib/plSurface/plLayerAnimation.h index bdaa68a5..6e30079b 100644 --- a/Sources/Plasma/PubUtilLib/plSurface/plLayerAnimation.h +++ b/Sources/Plasma/PubUtilLib/plSurface/plLayerAnimation.h @@ -62,8 +62,8 @@ class plLayerAnimationBase : public plLayerInterface protected: char* fSegmentID; double fEvalTime; - hsScalar fCurrentTime; - hsScalar fLength; + float fCurrentTime; + float fLength; plController* fPreshadeColorCtl; plController* fRuntimeColorCtl; @@ -72,8 +72,8 @@ protected: plController* fOpacityCtl; plController* fTransformCtl; - hsScalar IMakeUniformLength(); - void IEvalConvertedTime(hsScalar secs, UInt32 passChans, UInt32 evalChans, UInt32 &dirty); + float IMakeUniformLength(); + void IEvalConvertedTime(float secs, uint32_t passChans, uint32_t evalChans, uint32_t &dirty); public: plLayerAnimationBase(); @@ -83,7 +83,7 @@ public: GETINTERFACE_ANY( plLayerAnimationBase, plLayerInterface ); virtual plLayerInterface* Attach(plLayerInterface* prev); - //virtual UInt32 Eval(double secs, UInt32 frame, UInt32 ignore) = 0; + //virtual uint32_t Eval(double secs, uint32_t frame, uint32_t ignore) = 0; virtual hsBool MsgReceive(plMessage* msg); @@ -91,7 +91,7 @@ public: virtual void Write(hsStream* s, hsResMgr* mgr); // Specialized - hsScalar GetLength() const { return fLength; } + float GetLength() const { return fLength; } char *GetSegmentID() const { return fSegmentID; } void SetSegmentID(char *ID) { delete fSegmentID; fSegmentID = hsStrcpy(ID); } @@ -127,7 +127,7 @@ public: GETINTERFACE_ANY( plLayerAnimation, plLayerAnimationBase ); virtual plLayerInterface* Attach(plLayerInterface* prev); - virtual UInt32 Eval(double wSecs, UInt32 frame, UInt32 ignore); + virtual uint32_t Eval(double wSecs, uint32_t frame, uint32_t ignore); virtual hsBool MsgReceive(plMessage* msg); @@ -155,8 +155,8 @@ protected: kFadeIFace = 0x08, kFadeCCR = 0x10, }; - UInt8 fFadeFlags; - UInt8 fLastFadeFlag; + uint8_t fFadeFlags; + uint8_t fLastFadeFlag; hsBool fFadeFlagsDirty; public: @@ -173,14 +173,14 @@ public: // NEVER! // If you think it should... talk to Bob. He will explain why it can't be, and beat you up. // If he can't remember, beat him up until he does (or ask Moose). - virtual hsBool DirtySynchState(const char* sdlName, UInt32 sendFlags) { return false; } // don't send link state + virtual hsBool DirtySynchState(const char* sdlName, uint32_t sendFlags) { return false; } // don't send link state virtual void Read(hsStream* s, hsResMgr* mgr); virtual void Write(hsStream* s, hsResMgr* mgr); - virtual UInt32 Eval(double wSecs, UInt32 frame, UInt32 ignore); + virtual uint32_t Eval(double wSecs, uint32_t frame, uint32_t ignore); virtual hsBool MsgReceive(plMessage* pMsg); void Enable(hsBool b) { fEnabled = b; } - void SetFadeFlag(UInt8 flag, hsBool val); + void SetFadeFlag(uint8_t flag, hsBool val); hsBool fLeavingAge; }; @@ -198,7 +198,7 @@ public: CLASSNAME_REGISTER( plLayerSDLAnimation ); GETINTERFACE_ANY( plLayerSDLAnimation, plLayerAnimationBase ); - virtual UInt32 Eval(double wSecs, UInt32 frame, UInt32 ignore); + virtual uint32_t Eval(double wSecs, uint32_t frame, uint32_t ignore); virtual hsBool MsgReceive(plMessage* msg); diff --git a/Sources/Plasma/PubUtilLib/plSurface/plLayerDepth.cpp b/Sources/Plasma/PubUtilLib/plSurface/plLayerDepth.cpp index 070c765d..a6bf6251 100644 --- a/Sources/Plasma/PubUtilLib/plSurface/plLayerDepth.cpp +++ b/Sources/Plasma/PubUtilLib/plSurface/plLayerDepth.cpp @@ -40,7 +40,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "plLayerDepth.h" plLayerDepth::plLayerDepth() diff --git a/Sources/Plasma/PubUtilLib/plSurface/plLayerInterface.cpp b/Sources/Plasma/PubUtilLib/plSurface/plLayerInterface.cpp index 2ac4d490..3cc3f5e0 100644 --- a/Sources/Plasma/PubUtilLib/plSurface/plLayerInterface.cpp +++ b/Sources/Plasma/PubUtilLib/plSurface/plLayerInterface.cpp @@ -40,7 +40,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "plLayerInterface.h" #include "plMessage/plLayRefMsg.h" #include "plLayer.h" @@ -97,7 +97,7 @@ plLayerInterface::~plLayerInterface() delete fBumpEnvXfm; } -void plLayerInterface::ISetPassThru(UInt32 chans) +void plLayerInterface::ISetPassThru(uint32_t chans) { fPassThruChannels |= chans; if( fOverLay ) @@ -129,7 +129,7 @@ void plLayerInterface::ISetPassThru(UInt32 chans) // Note that a layer may claim ownership of its channels but then lose // ownership (because another layer went active) before ever having // been Eval'd. -void plLayerInterface::ClaimChannels(UInt32 chans) +void plLayerInterface::ClaimChannels(uint32_t chans) { if( fOverLay ) fOverLay->ISetPassThru(chans); @@ -137,18 +137,18 @@ void plLayerInterface::ClaimChannels(UInt32 chans) DirtySynchState(kSDLLayer, 0); } -UInt32 plLayerInterface::Eval(double secs, UInt32 frame, UInt32 ignore) +uint32_t plLayerInterface::Eval(double secs, uint32_t frame, uint32_t ignore) { if( fUnderLay ) return fUnderLay->Eval(secs, frame, ignore); - return UInt32(0); + return uint32_t(0); } // Export Only void plLayerInterface::AttachViaNotify(plLayerInterface *prev) { - plLayRefMsg* refMsg = TRACKED_NEW plLayRefMsg(GetKey(), plRefMsg::kOnCreate, 0, plLayRefMsg::kUnderLay); + plLayRefMsg* refMsg = new plLayRefMsg(GetKey(), plRefMsg::kOnCreate, 0, plLayRefMsg::kUnderLay); hsgResMgr::ResMgr()->AddViaNotify(prev->GetKey(), refMsg, plRefFlags::kActiveRef); } @@ -330,7 +330,7 @@ void plLayerInterface::Read(hsStream* s, hsResMgr* mgr) { plSynchedObject::Read(s, mgr); - plLayRefMsg* refMsg = TRACKED_NEW plLayRefMsg(GetKey(), plRefMsg::kOnCreate, 0, plLayRefMsg::kUnderLay); + plLayRefMsg* refMsg = new plLayRefMsg(GetKey(), plRefMsg::kOnCreate, 0, plLayRefMsg::kUnderLay); plKey key = mgr->ReadKeyNotifyMe(s,refMsg, plRefFlags::kActiveRef); if( key && !fUnderLay ) Attach(plLayer::DefaultLayer()); diff --git a/Sources/Plasma/PubUtilLib/plSurface/plLayerInterface.h b/Sources/Plasma/PubUtilLib/plSurface/plLayerInterface.h index b4f4ac49..e82c634c 100644 --- a/Sources/Plasma/PubUtilLib/plSurface/plLayerInterface.h +++ b/Sources/Plasma/PubUtilLib/plSurface/plLayerInterface.h @@ -101,20 +101,20 @@ protected: // from dirty bits), or when you want to (you'll know from secs/frame). // fOwnedChannels specifies which channels you have allocated and own (and will delete) - UInt32 fOwnedChannels; + uint32_t fOwnedChannels; // fPassThruChannels are channels which we need to pass through our underlay's values, // even if we have a differing opinion on what the value should be. This let's us arbitrate // between different layers that control the same channels. A layer can claim control of // a channel by telling all other layers to pass through that channel via the - // ClaimChannels(UInt32 chans) member function. See .cpp for arbitration rules. - UInt32 fPassThruChannels; + // ClaimChannels(uint32_t chans) member function. See .cpp for arbitration rules. + uint32_t fPassThruChannels; hsMatrix44* fTransform; hsColorRGBA* fPreshadeColor; hsColorRGBA* fRuntimeColor; // Diffuse color to be used with runtime lights vs. static preshading hsColorRGBA* fAmbientColor; hsColorRGBA* fSpecularColor; - hsScalar* fOpacity; + float* fOpacity; // Would like to abstract out the mipmap, but we'll bring it // along for now. @@ -122,9 +122,9 @@ protected: // (Currently) unanimatables. hsGMatState* fState; - UInt32* fUVWSrc; - hsScalar* fLODBias; - hsScalar* fSpecularPower; + uint32_t* fUVWSrc; + float* fLODBias; + float* fSpecularPower; plShader** fVertexShader; plShader** fPixelShader; @@ -132,7 +132,7 @@ protected: hsMatrix44* fBumpEnvXfm; void IUnthread(); - void ISetPassThru(UInt32 chans); + void ISetPassThru(uint32_t chans); public: plLayerInterface(); @@ -153,21 +153,21 @@ public: const hsColorRGBA& GetRuntimeColor() const { return *fRuntimeColor; } const hsColorRGBA& GetAmbientColor() const { return *fAmbientColor; } const hsColorRGBA& GetSpecularColor() const { return *fSpecularColor; } - hsScalar GetOpacity() const { return *fOpacity; } + float GetOpacity() const { return *fOpacity; } plBitmap* GetTexture() const { return *fTexture; } // (Currently) unanimatables - UInt32 GetUVWSrc() const { return *fUVWSrc; } - hsScalar GetLODBias() const { return *fLODBias; } - hsScalar GetSpecularPower() const { return *fSpecularPower; } + uint32_t GetUVWSrc() const { return *fUVWSrc; } + float GetLODBias() const { return *fLODBias; } + float GetSpecularPower() const { return *fSpecularPower; } const hsGMatState& GetState() const { return *fState; } - UInt32 GetBlendFlags() const { return fState->fBlendFlags; } - UInt32 GetClampFlags() const { return fState->fClampFlags; } - UInt32 GetShadeFlags() const { return fState->fShadeFlags; } - UInt32 GetZFlags() const { return fState->fZFlags; } - UInt32 GetMiscFlags() const { return fState->fMiscFlags; } + uint32_t GetBlendFlags() const { return fState->fBlendFlags; } + uint32_t GetClampFlags() const { return fState->fClampFlags; } + uint32_t GetShadeFlags() const { return fState->fShadeFlags; } + uint32_t GetZFlags() const { return fState->fZFlags; } + uint32_t GetMiscFlags() const { return fState->fMiscFlags; } plShader* GetVertexShader() const { return *fVertexShader; } plShader* GetPixelShader() const { return *fPixelShader; } @@ -176,7 +176,7 @@ public: // ClaimChannels will tell every other layer on this stack (besides this) to // pass through the value, giving this layer the final say on it's value - void ClaimChannels(UInt32 chans); + void ClaimChannels(uint32_t chans); // Eval may be called multiple times per frame, or even multiple times per render (for multiple // renders per frame). The burden of deciding whether any update is necessary falls to the @@ -187,7 +187,7 @@ public: // return value of fUnderLay->Eval() - bits are true for fields that an interface earlier in the chain dirtied. A field // flagged dirty that you modify (as opposed to overwrite) should be updated regardless of secs and frame. // - virtual UInt32 Eval(double secs, UInt32 frame, UInt32 ignore); + virtual uint32_t Eval(double secs, uint32_t frame, uint32_t ignore); // Attach gives you a chance to decide whether you want to pass through fields from prev (by copying // the pointers which you then sooner put long pins through your own eyes than modify). Alloc @@ -208,7 +208,7 @@ public: plLayerInterface* GetAttached(); void AttachViaNotify(plLayerInterface *prev); // Export only - hsBool OwnChannel(UInt32 which) const { return 0 != (fOwnedChannels & which); } + hsBool OwnChannel(uint32_t which) const { return 0 != (fOwnedChannels & which); } virtual void Read(hsStream* s, hsResMgr* mgr); virtual void Write(hsStream* s, hsResMgr* mgr); diff --git a/Sources/Plasma/PubUtilLib/plSurface/plLayerMultiply.cpp b/Sources/Plasma/PubUtilLib/plSurface/plLayerMultiply.cpp index 7f39a6c5..e621a2f7 100644 --- a/Sources/Plasma/PubUtilLib/plSurface/plLayerMultiply.cpp +++ b/Sources/Plasma/PubUtilLib/plSurface/plLayerMultiply.cpp @@ -60,14 +60,14 @@ void plLayerMultiply::Read(hsStream* s, hsResMgr* mgr) fOwnedChannels = s->ReadLE32(); if (fOwnedChannels & kOpacity) { - fOpacity = TRACKED_NEW hsScalar; + fOpacity = new float; *fOpacity = fSrcOpacity = s->ReadLEScalar(); fDirtyChannels |= kOpacity; } if (fOwnedChannels & kPreshadeColor) { - fPreshadeColor = TRACKED_NEW hsColorRGBA; + fPreshadeColor = new hsColorRGBA; fSrcPreshadeColor.Read(s); *fPreshadeColor = fSrcPreshadeColor; fDirtyChannels |= kPreshadeColor; @@ -75,7 +75,7 @@ void plLayerMultiply::Read(hsStream* s, hsResMgr* mgr) if (fOwnedChannels & kRuntimeColor) { - fRuntimeColor = TRACKED_NEW hsColorRGBA; + fRuntimeColor = new hsColorRGBA; fSrcRuntimeColor.Read(s); *fRuntimeColor = fSrcRuntimeColor; fDirtyChannels |= kRuntimeColor; @@ -83,7 +83,7 @@ void plLayerMultiply::Read(hsStream* s, hsResMgr* mgr) if (fOwnedChannels & kAmbientColor) { - fAmbientColor = TRACKED_NEW hsColorRGBA; + fAmbientColor = new hsColorRGBA; fSrcAmbientColor.Read(s); *fAmbientColor = fSrcAmbientColor; fDirtyChannels |= kAmbientColor; @@ -91,7 +91,7 @@ void plLayerMultiply::Read(hsStream* s, hsResMgr* mgr) if (fOwnedChannels & kTransform) { - fTransform = TRACKED_NEW hsMatrix44; + fTransform = new hsMatrix44; fSrcTransform.Read(s); *fTransform = fSrcTransform; fDirtyChannels |= kTransform; @@ -124,10 +124,10 @@ plLayerInterface* plLayerMultiply::Attach(plLayerInterface* prev) return plLayerInterface::Attach(prev); } -UInt32 plLayerMultiply::Eval(double wSecs, UInt32 frame, UInt32 ignore) +uint32_t plLayerMultiply::Eval(double wSecs, uint32_t frame, uint32_t ignore) { - UInt32 dirtyChannels = fDirtyChannels | plLayerInterface::Eval(wSecs, frame, ignore); - UInt32 evalChannels = dirtyChannels & fOwnedChannels; + uint32_t dirtyChannels = fDirtyChannels | plLayerInterface::Eval(wSecs, frame, ignore); + uint32_t evalChannels = dirtyChannels & fOwnedChannels; if (evalChannels & kPreshadeColor) *fPreshadeColor = fSrcPreshadeColor * fUnderLay->GetPreshadeColor(); @@ -171,7 +171,7 @@ void plLayerMultiply::SetAmbientColor(const hsColorRGBA& col) fDirtyChannels |= kAmbientColor; } -void plLayerMultiply::SetOpacity(hsScalar a) +void plLayerMultiply::SetOpacity(float a) { fSrcOpacity = a; fDirtyChannels |= kOpacity; @@ -181,4 +181,4 @@ void plLayerMultiply::SetTransform(const hsMatrix44& xfm) { fSrcTransform = xfm; fDirtyChannels |= kTransform; -} \ No newline at end of file +} diff --git a/Sources/Plasma/PubUtilLib/plSurface/plLayerMultiply.h b/Sources/Plasma/PubUtilLib/plSurface/plLayerMultiply.h index 2896149a..924b34bc 100644 --- a/Sources/Plasma/PubUtilLib/plSurface/plLayerMultiply.h +++ b/Sources/Plasma/PubUtilLib/plSurface/plLayerMultiply.h @@ -57,7 +57,7 @@ public: GETINTERFACE_ANY( plLayerMultiply, plLayerInterface ); virtual plLayerInterface* Attach(plLayerInterface* prev); - virtual UInt32 Eval(double secs, UInt32 frame, UInt32 ignore); + virtual uint32_t Eval(double secs, uint32_t frame, uint32_t ignore); virtual hsBool MsgReceive(plMessage* msg); virtual void Read(hsStream* s, hsResMgr* mgr); virtual void Write(hsStream* s, hsResMgr* mgr); @@ -65,15 +65,15 @@ public: void SetPreshadeColor(const hsColorRGBA& col); void SetRuntimeColor(const hsColorRGBA& col); void SetAmbientColor(const hsColorRGBA& col); - void SetOpacity(hsScalar a); + void SetOpacity(float a); void SetTransform(const hsMatrix44& xfm); protected: - UInt32 fDirtyChannels; + uint32_t fDirtyChannels; hsColorRGBA fSrcPreshadeColor; hsColorRGBA fSrcRuntimeColor; hsColorRGBA fSrcAmbientColor; - hsScalar fSrcOpacity; + float fSrcOpacity; hsMatrix44 fSrcTransform; }; diff --git a/Sources/Plasma/PubUtilLib/plSurface/plLayerOr.cpp b/Sources/Plasma/PubUtilLib/plSurface/plLayerOr.cpp index 667bdb85..113670ed 100644 --- a/Sources/Plasma/PubUtilLib/plSurface/plLayerOr.cpp +++ b/Sources/Plasma/PubUtilLib/plSurface/plLayerOr.cpp @@ -40,12 +40,12 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "plLayerOr.h" plLayerOr::plLayerOr() { - fState = TRACKED_NEW hsGMatState; + fState = new hsGMatState; fState->Reset(); fOwnedChannels = kState; @@ -71,9 +71,9 @@ plLayerInterface *plLayerOr::Attach( plLayerInterface* prev ) return plLayerInterface::Attach( prev ); } -UInt32 plLayerOr::Eval(double secs, UInt32 frame, UInt32 ignore) +uint32_t plLayerOr::Eval(double secs, uint32_t frame, uint32_t ignore) { - UInt32 ret = plLayerInterface::Eval(secs, frame, ignore); + uint32_t ret = plLayerInterface::Eval(secs, frame, ignore); if( fUnderLay ) { if( fDirty || (ret & kState) ) diff --git a/Sources/Plasma/PubUtilLib/plSurface/plLayerOr.h b/Sources/Plasma/PubUtilLib/plSurface/plLayerOr.h index c6c38246..9fa59b70 100644 --- a/Sources/Plasma/PubUtilLib/plSurface/plLayerOr.h +++ b/Sources/Plasma/PubUtilLib/plSurface/plLayerOr.h @@ -59,16 +59,16 @@ class plLayerOr : public plLayerInterface CLASSNAME_REGISTER( plLayerOr ); GETINTERFACE_ANY( plLayerOr, plLayerInterface ); - void SetBlendFlags( UInt32 f ) { fOringState.fBlendFlags = f; } - void SetClampFlags( UInt32 f ) { fOringState.fClampFlags = f; } - void SetShadeFlags( UInt32 f ) { fOringState.fShadeFlags = f; } - void SetZFlags( UInt32 f ) { fOringState.fZFlags = f; } - void SetMiscFlags( UInt32 f ) { fOringState.fMiscFlags = f; } + void SetBlendFlags( uint32_t f ) { fOringState.fBlendFlags = f; } + void SetClampFlags( uint32_t f ) { fOringState.fClampFlags = f; } + void SetShadeFlags( uint32_t f ) { fOringState.fShadeFlags = f; } + void SetZFlags( uint32_t f ) { fOringState.fZFlags = f; } + void SetMiscFlags( uint32_t f ) { fOringState.fMiscFlags = f; } void SetState( const hsGMatState& state ); virtual plLayerInterface* Attach(plLayerInterface* prev); - virtual UInt32 Eval(double secs, UInt32 frame, UInt32 ignore); + virtual uint32_t Eval(double secs, uint32_t frame, uint32_t ignore); }; #endif //_plLayerOr_h diff --git a/Sources/Plasma/PubUtilLib/plSurface/plLayerShadowBase.cpp b/Sources/Plasma/PubUtilLib/plSurface/plLayerShadowBase.cpp index fa049319..562d5974 100644 --- a/Sources/Plasma/PubUtilLib/plSurface/plLayerShadowBase.cpp +++ b/Sources/Plasma/PubUtilLib/plSurface/plLayerShadowBase.cpp @@ -40,7 +40,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "plLayerShadowBase.h" /////////////////////////////////////////////////////////////////////////// @@ -51,13 +51,13 @@ plLayerLightBase::plLayerLightBase() | kAmbientColor | kPreshadeColor; - fState = TRACKED_NEW hsGMatState; + fState = new hsGMatState; fState->Reset(); - fAmbientColor = TRACKED_NEW hsColorRGBA; + fAmbientColor = new hsColorRGBA; fAmbientColor->Set(0,0,0,1.f); - fPreshadeColor = TRACKED_NEW hsColorRGBA; + fPreshadeColor = new hsColorRGBA; fPreshadeColor->Set(0,0,0,1.f); } @@ -71,16 +71,16 @@ plLayerInterface* plLayerLightBase::Attach(plLayerInterface* prev) return plLayerInterface::Attach(prev); } -UInt32 plLayerLightBase::Eval(double secs, UInt32 frame, UInt32 ignore) +uint32_t plLayerLightBase::Eval(double secs, uint32_t frame, uint32_t ignore) { - UInt32 ret = plLayerInterface::Eval(secs, frame, ignore); + uint32_t ret = plLayerInterface::Eval(secs, frame, ignore); if( fUnderLay ) { if( fDirty || (ret & kState) ) { *fState = fUnderLay->GetState(); - UInt32 blend = fState->fBlendFlags; + uint32_t blend = fState->fBlendFlags; fState->fBlendFlags &= ~hsGMatState::kBlendMask; @@ -114,13 +114,13 @@ plLayerShadowBase::plLayerShadowBase() | kAmbientColor | kPreshadeColor; - fState = TRACKED_NEW hsGMatState; + fState = new hsGMatState; fState->Reset(); - fAmbientColor = TRACKED_NEW hsColorRGBA; + fAmbientColor = new hsColorRGBA; fAmbientColor->Set(0,0,0,1.f); - fPreshadeColor = TRACKED_NEW hsColorRGBA; + fPreshadeColor = new hsColorRGBA; fPreshadeColor->Set(0,0,0,1.f); } @@ -134,9 +134,9 @@ plLayerInterface* plLayerShadowBase::Attach(plLayerInterface* prev) return plLayerInterface::Attach(prev); } -UInt32 plLayerShadowBase::Eval(double secs, UInt32 frame, UInt32 ignore) +uint32_t plLayerShadowBase::Eval(double secs, uint32_t frame, uint32_t ignore) { - UInt32 ret = plLayerInterface::Eval(secs, frame, ignore); + uint32_t ret = plLayerInterface::Eval(secs, frame, ignore); if( fUnderLay ) { if( fDirty || (ret & kState) ) diff --git a/Sources/Plasma/PubUtilLib/plSurface/plLayerShadowBase.h b/Sources/Plasma/PubUtilLib/plSurface/plLayerShadowBase.h index f4365a9a..3cd5dc2d 100644 --- a/Sources/Plasma/PubUtilLib/plSurface/plLayerShadowBase.h +++ b/Sources/Plasma/PubUtilLib/plSurface/plLayerShadowBase.h @@ -61,7 +61,7 @@ public: virtual plLayerInterface* Attach(plLayerInterface* prev); - virtual UInt32 Eval(double secs, UInt32 frame, UInt32 ignore); + virtual uint32_t Eval(double secs, uint32_t frame, uint32_t ignore); }; @@ -81,7 +81,7 @@ public: virtual plLayerInterface* Attach(plLayerInterface* prev); - virtual UInt32 Eval(double secs, UInt32 frame, UInt32 ignore); + virtual uint32_t Eval(double secs, uint32_t frame, uint32_t ignore); }; diff --git a/Sources/Plasma/PubUtilLib/plSurface/plLayerWrapper.cpp b/Sources/Plasma/PubUtilLib/plSurface/plLayerWrapper.cpp index c087cf32..f13889ef 100644 --- a/Sources/Plasma/PubUtilLib/plSurface/plLayerWrapper.cpp +++ b/Sources/Plasma/PubUtilLib/plSurface/plLayerWrapper.cpp @@ -40,7 +40,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "plLayerWrapper.h" plLayerWrapper::plLayerWrapper() diff --git a/Sources/Plasma/PubUtilLib/plSurface/plLayerWrapper.h b/Sources/Plasma/PubUtilLib/plSurface/plLayerWrapper.h index a7c28b01..33f620a8 100644 --- a/Sources/Plasma/PubUtilLib/plSurface/plLayerWrapper.h +++ b/Sources/Plasma/PubUtilLib/plSurface/plLayerWrapper.h @@ -60,7 +60,7 @@ public: virtual void Init(const plLayerInterface* prev) {} // Init(layer) currently handles all this void Init(hsGLayer* lay); - virtual UInt32 Eval(double secs, UInt32 frame, UInt32 dirty, plLayerInterface* prev) + virtual uint32_t Eval(double secs, uint32_t frame, uint32_t dirty, plLayerInterface* prev) { return dirty; } diff --git a/Sources/Plasma/PubUtilLib/plSurface/plShader.cpp b/Sources/Plasma/PubUtilLib/plSurface/plShader.cpp index 312bcc75..a7793425 100644 --- a/Sources/Plasma/PubUtilLib/plSurface/plShader.cpp +++ b/Sources/Plasma/PubUtilLib/plSurface/plShader.cpp @@ -41,7 +41,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "plShader.h" #include "plShaderTable.h" @@ -147,7 +147,7 @@ void plShader::SetVector(int i, const hsScalarTriple& vec) fConsts[i].fZ = vec.fZ; } -void plShader::SetVector(int i, hsScalar x, hsScalar y, hsScalar z, hsScalar w) +void plShader::SetVector(int i, float x, float y, float z, float w) { fConsts[i].x = x; fConsts[i].y = y; @@ -263,7 +263,7 @@ hsVector3 plShader::GetVector(int i) const return hsVector3(fConsts[i].fX, fConsts[i].fY, fConsts[i].fZ); } -void plShader::GetVector(int i, hsScalar& x, hsScalar& y, hsScalar& z, hsScalar& w) const +void plShader::GetVector(int i, float& x, float& y, float& z, float& w) const { x = fConsts[i].x; y = fConsts[i].y; @@ -271,7 +271,7 @@ void plShader::GetVector(int i, hsScalar& x, hsScalar& y, hsScalar& z, hsScalar& w = fConsts[i].w; } -hsScalar plShader::GetFloat(int i, int chan) const +float plShader::GetFloat(int i, int chan) const { return fConsts[i].fArray[chan]; } @@ -287,7 +287,7 @@ void plShader::Read(hsStream* s, hsResMgr* mgr) hsKeyedObject::Read(s, mgr); - UInt32 n = s->ReadLE32(); + uint32_t n = s->ReadLE32(); fConsts.SetCount(n); int i; for( i = 0; i < n; i++ ) diff --git a/Sources/Plasma/PubUtilLib/plSurface/plShader.h b/Sources/Plasma/PubUtilLib/plSurface/plShader.h index 63b3c16f..9aa68578 100644 --- a/Sources/Plasma/PubUtilLib/plSurface/plShader.h +++ b/Sources/Plasma/PubUtilLib/plSurface/plShader.h @@ -167,10 +167,10 @@ public: public: plPipeConst() {} - plPipeConst(Type t, UInt16 r) : fType(t), fReg(r) {} + plPipeConst(Type t, uint16_t r) : fType(t), fReg(r) {} Type fType; - UInt16 fReg; + uint16_t fReg; }; typedef plPipeConst::Type plPipeConstType; @@ -187,7 +187,7 @@ public: kShaderUnsupported = 0x20 }; protected: - mutable UInt32 fFlags; + mutable uint32_t fFlags; hsTArray fConsts; @@ -195,8 +195,8 @@ protected: const plShaderDecl* fDecl; - UInt8 fInput; - UInt8 fOutput; + uint8_t fInput; + uint8_t fOutput; hsTArray fPipeConsts; @@ -212,7 +212,7 @@ public: virtual void Write(hsStream* s, hsResMgr* mgr); void SetNumConsts(int cnt) { fConsts.SetCount(cnt); } - UInt32 GetNumConsts() const { return fConsts.GetCount(); } + uint32_t GetNumConsts() const { return fConsts.GetCount(); } plShaderConst& GetConst(int i) { return fConsts[i]; } const plShaderConst& GetConst(int i) const { return fConsts[i]; } void SetConst(int i, const plShaderConst& c) { fConsts[i] = c; } @@ -225,8 +225,8 @@ public: hsColorRGBA GetColor(int i) const; hsPoint3 GetPosition(int i) const; hsVector3 GetVector(int i) const; - void GetVector(int i, hsScalar& x, hsScalar& y, hsScalar& z, hsScalar& w) const; - hsScalar GetFloat(int i, int chan) const; + void GetVector(int i, float& x, float& y, float& z, float& w) const; + float GetFloat(int i, int chan) const; const float* const GetFloat4(int i) const; void SetMatrix(int i, const plFloat44& xfm); // Will transpose @@ -236,8 +236,8 @@ public: void SetMatrix24(int i, const hsMatrix44& xfm); void SetColor(int i, const hsColorRGBA& col); void SetVector(int i, const hsScalarTriple& vec); /* Doesn't touch .fW */ - void SetVectorW(int i, const hsScalarTriple& vec, hsScalar w=1.f) { SetVector(i, vec.fX, vec.fY, vec.fZ, w); } - void SetVector(int i, hsScalar x, hsScalar y, hsScalar z, hsScalar w); + void SetVectorW(int i, const hsScalarTriple& vec, float w=1.f) { SetVector(i, vec.fX, vec.fY, vec.fZ, w); } + void SetVector(int i, float x, float y, float z, float w); void SetFloat(int i, int chan, float v); void SetFloat4(int i, const float* const f); @@ -261,22 +261,22 @@ public: void CopyConsts(const plShader* src) { fConsts = src->fConsts; } - void SetInputFormat(UInt8 format) { fInput = format; } - void SetOutputFormat(UInt8 format) { fOutput = format; } + void SetInputFormat(uint8_t format) { fInput = format; } + void SetOutputFormat(uint8_t format) { fOutput = format; } - UInt8 GetInputFormat() const { return fInput; } - UInt8 GetOutputFormat() const { return fOutput; } + uint8_t GetInputFormat() const { return fInput; } + uint8_t GetOutputFormat() const { return fOutput; } - UInt32 GetNumPipeConsts() const { return fPipeConsts.GetCount(); } + uint32_t GetNumPipeConsts() const { return fPipeConsts.GetCount(); } const plPipeConst& GetPipeConst(int i) const { return fPipeConsts[i]; } plPipeConst::Type GetPipeConstType(int i) const { return fPipeConsts[i].fType; } - UInt16 GetPipeConstReg(int i) const { return fPipeConsts[i].fReg; } + uint16_t GetPipeConstReg(int i) const { return fPipeConsts[i].fReg; } void SetNumPipeConsts(int n); void SetPipeConst(int i, const plPipeConst& c) { fPipeConsts[i] = c; } - void SetPipeConst(int i, plPipeConstType t, UInt16 r) { fPipeConsts[i].fType = t; fPipeConsts[i].fReg = r; } + void SetPipeConst(int i, plPipeConstType t, uint16_t r) { fPipeConsts[i].fType = t; fPipeConsts[i].fReg = r; } void SetPipeConstType(int i, plPipeConstType t) { fPipeConsts[i].fType = t; } - void SetPipeConstReg(int i, UInt16 r) { fPipeConsts[i].fReg = r; } + void SetPipeConstReg(int i, uint16_t r) { fPipeConsts[i].fReg = r; } }; #endif // plShader_inc diff --git a/Sources/Plasma/PubUtilLib/plSurface/plShaderTable.cpp b/Sources/Plasma/PubUtilLib/plSurface/plShaderTable.cpp index e67165af..5f919cb9 100644 --- a/Sources/Plasma/PubUtilLib/plSurface/plShaderTable.cpp +++ b/Sources/Plasma/PubUtilLib/plSurface/plShaderTable.cpp @@ -40,7 +40,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "plShaderTable.h" #include "plShader.h" diff --git a/Sources/Plasma/PubUtilLib/plSurface/plShaderTable.h b/Sources/Plasma/PubUtilLib/plSurface/plShaderTable.h index 4d4b1c4e..9d611758 100644 --- a/Sources/Plasma/PubUtilLib/plSurface/plShaderTable.h +++ b/Sources/Plasma/PubUtilLib/plSurface/plShaderTable.h @@ -102,17 +102,17 @@ class plShaderDecl { protected: const plShaderID::ID fID; - const UInt32 fByteLen; - const UInt8* const fCodes; + const uint32_t fbyteLen; + const uint8_t* const fCodes; const char* const fFileName; public: - plShaderDecl(const char* const fname, plShaderID::ID id = plShaderID::Unregistered, UInt32 byteLen = 0, const UInt8* const codes = 0L) : fID(id), fByteLen(byteLen), fCodes(codes), fFileName(fname) {} + plShaderDecl(const char* const fname, plShaderID::ID id = plShaderID::Unregistered, uint32_t byteLen = 0, const uint8_t* const codes = 0L) : fID(id), fbyteLen(byteLen), fCodes(codes), fFileName(fname) {} // Data (fCodes) is never deleted, It points to memory compiled in. plShaderID::ID GetID() const { return fID; } - UInt32 GetByteLen() const { return fByteLen; } - const UInt8* GetCodes() const { return fCodes; } + uint32_t GetByteLen() const { return fbyteLen; } + const uint8_t* GetCodes() const { return fCodes; } const char* const GetFileName() const { return fFileName; } }; @@ -124,7 +124,7 @@ protected: kLoadFromFile = 0x1 }; - UInt32 fFlags; + uint32_t fFlags; const plShaderDecl* fTable[plShaderID::kNumShaders]; diff --git a/Sources/Plasma/PubUtilLib/plSurface/ps_BiasNormals.h b/Sources/Plasma/PubUtilLib/plSurface/ps_BiasNormals.h index 18ea02e0..5ac6a4c3 100644 --- a/Sources/Plasma/PubUtilLib/plSurface/ps_BiasNormals.h +++ b/Sources/Plasma/PubUtilLib/plSurface/ps_BiasNormals.h @@ -41,9 +41,9 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ -static const UInt32 ps_BiasNormalsByteLen = 76; +static const uint32_t ps_BiasNormalsbyteLen = 76; -static const UInt8 ps_BiasNormalsCodes[] = { +static const uint8_t ps_BiasNormalsCodes[] = { 0x1, 0x1, 0xff, 0xff, 0x42, 0x0, 0x0, 0x0, 0x0, 0x0, 0xf, 0xb0, @@ -65,7 +65,7 @@ static const UInt8 ps_BiasNormalsCodes[] = { 0xff, 0xff, 0x0, 0x0 }; -static const plShaderDecl ps_BiasNormalsDecl("sha/ps_BiasNormals.inl", ps_BiasNormals, ps_BiasNormalsByteLen, ps_BiasNormalsCodes); +static const plShaderDecl ps_BiasNormalsDecl("sha/ps_BiasNormals.inl", ps_BiasNormals, ps_BiasNormalsbyteLen, ps_BiasNormalsCodes); static const plShaderRegister ps_BiasNormalsRegister(&ps_BiasNormalsDecl); diff --git a/Sources/Plasma/PubUtilLib/plSurface/ps_CaddAAdd.h b/Sources/Plasma/PubUtilLib/plSurface/ps_CaddAAdd.h index e436a0c0..210c3304 100644 --- a/Sources/Plasma/PubUtilLib/plSurface/ps_CaddAAdd.h +++ b/Sources/Plasma/PubUtilLib/plSurface/ps_CaddAAdd.h @@ -41,9 +41,9 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ -static const UInt32 ps_CaddAAddByteLen = 72; +static const uint32_t ps_CaddAAddbyteLen = 72; -static const UInt8 ps_CaddAAddCodes[] = { +static const uint8_t ps_CaddAAddCodes[] = { 0x1, 0x1, 0xff, 0xff, 0x42, 0x0, 0x0, 0x0, 0x0, 0x0, 0xf, 0xb0, @@ -64,7 +64,7 @@ static const UInt8 ps_CaddAAddCodes[] = { 0xff, 0xff, 0x0, 0x0 }; -static const plShaderDecl ps_CaddAAddDecl("sha/ps_CaddAAdd.inl", ps_CaddAAdd, ps_CaddAAddByteLen, ps_CaddAAddCodes); +static const plShaderDecl ps_CaddAAddDecl("sha/ps_CaddAAdd.inl", ps_CaddAAdd, ps_CaddAAddbyteLen, ps_CaddAAddCodes); static const plShaderRegister ps_CaddAAddRegister(&ps_CaddAAddDecl); diff --git a/Sources/Plasma/PubUtilLib/plSurface/ps_CaddAMult.h b/Sources/Plasma/PubUtilLib/plSurface/ps_CaddAMult.h index 48f5856d..1c76510d 100644 --- a/Sources/Plasma/PubUtilLib/plSurface/ps_CaddAMult.h +++ b/Sources/Plasma/PubUtilLib/plSurface/ps_CaddAMult.h @@ -41,9 +41,9 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ -static const UInt32 ps_CaddAMultByteLen = 72; +static const uint32_t ps_CaddAMultbyteLen = 72; -static const UInt8 ps_CaddAMultCodes[] = { +static const uint8_t ps_CaddAMultCodes[] = { 0x1, 0x1, 0xff, 0xff, 0x42, 0x0, 0x0, 0x0, 0x0, 0x0, 0xf, 0xb0, @@ -64,7 +64,7 @@ static const UInt8 ps_CaddAMultCodes[] = { 0xff, 0xff, 0x0, 0x0 }; -static const plShaderDecl ps_CaddAMultDecl("sha/ps_CaddAMult.inl", ps_CaddAMult, ps_CaddAMultByteLen, ps_CaddAMultCodes); +static const plShaderDecl ps_CaddAMultDecl("sha/ps_CaddAMult.inl", ps_CaddAMult, ps_CaddAMultbyteLen, ps_CaddAMultCodes); static const plShaderRegister ps_CaddAMultRegister(&ps_CaddAMultDecl); diff --git a/Sources/Plasma/PubUtilLib/plSurface/ps_CaddAbase.h b/Sources/Plasma/PubUtilLib/plSurface/ps_CaddAbase.h index 5f6ae05f..abcb50db 100644 --- a/Sources/Plasma/PubUtilLib/plSurface/ps_CaddAbase.h +++ b/Sources/Plasma/PubUtilLib/plSurface/ps_CaddAbase.h @@ -41,9 +41,9 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ -static const UInt32 ps_CaddAbaseByteLen = 68; +static const uint32_t ps_CaddAbasebyteLen = 68; -static const UInt8 ps_CaddAbaseCodes[] = { +static const uint8_t ps_CaddAbaseCodes[] = { 0x1, 0x1, 0xff, 0xff, 0x42, 0x0, 0x0, 0x0, 0x0, 0x0, 0xf, 0xb0, @@ -63,7 +63,7 @@ static const UInt8 ps_CaddAbaseCodes[] = { 0xff, 0xff, 0x0, 0x0 }; -static const plShaderDecl ps_CaddAbaseDecl("sha/ps_CaddAbase.inl", ps_CaddAbase, ps_CaddAbaseByteLen, ps_CaddAbaseCodes); +static const plShaderDecl ps_CaddAbaseDecl("sha/ps_CaddAbase.inl", ps_CaddAbase, ps_CaddAbasebyteLen, ps_CaddAbaseCodes); static const plShaderRegister ps_CaddAbaseRegister(&ps_CaddAbaseDecl); diff --git a/Sources/Plasma/PubUtilLib/plSurface/ps_CalphaAMult.h b/Sources/Plasma/PubUtilLib/plSurface/ps_CalphaAMult.h index 20029260..0bee101f 100644 --- a/Sources/Plasma/PubUtilLib/plSurface/ps_CalphaAMult.h +++ b/Sources/Plasma/PubUtilLib/plSurface/ps_CalphaAMult.h @@ -41,9 +41,9 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ -static const UInt32 ps_CalphaAMultByteLen = 76; +static const uint32_t ps_CalphaAMultbyteLen = 76; -static const UInt8 ps_CalphaAMultCodes[] = { +static const uint8_t ps_CalphaAMultCodes[] = { 0x1, 0x1, 0xff, 0xff, 0x42, 0x0, 0x0, 0x0, 0x0, 0x0, 0xf, 0xb0, @@ -65,7 +65,7 @@ static const UInt8 ps_CalphaAMultCodes[] = { 0xff, 0xff, 0x0, 0x0 }; -static const plShaderDecl ps_CalphaAMultDecl("sha/ps_CalphaAMult.inl", ps_CalphaAMult, ps_CalphaAMultByteLen, ps_CalphaAMultCodes); +static const plShaderDecl ps_CalphaAMultDecl("sha/ps_CalphaAMult.inl", ps_CalphaAMult, ps_CalphaAMultbyteLen, ps_CalphaAMultCodes); static const plShaderRegister ps_CalphaAMultRegister(&ps_CalphaAMultDecl); diff --git a/Sources/Plasma/PubUtilLib/plSurface/ps_CalphaAadd.h b/Sources/Plasma/PubUtilLib/plSurface/ps_CalphaAadd.h index 53da9416..c43ee059 100644 --- a/Sources/Plasma/PubUtilLib/plSurface/ps_CalphaAadd.h +++ b/Sources/Plasma/PubUtilLib/plSurface/ps_CalphaAadd.h @@ -41,9 +41,9 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ -static const UInt32 ps_CalphaAaddByteLen = 76; +static const uint32_t ps_CalphaAaddbyteLen = 76; -static const UInt8 ps_CalphaAaddCodes[] = { +static const uint8_t ps_CalphaAaddCodes[] = { 0x1, 0x1, 0xff, 0xff, 0x42, 0x0, 0x0, 0x0, 0x0, 0x0, 0xf, 0xb0, @@ -65,7 +65,7 @@ static const UInt8 ps_CalphaAaddCodes[] = { 0xff, 0xff, 0x0, 0x0 }; -static const plShaderDecl ps_CalphaAaddDecl("sha/ps_CalphaAadd.inl", ps_CalphaAadd, ps_CalphaAaddByteLen, ps_CalphaAaddCodes); +static const plShaderDecl ps_CalphaAaddDecl("sha/ps_CalphaAadd.inl", ps_CalphaAadd, ps_CalphaAaddbyteLen, ps_CalphaAaddCodes); static const plShaderRegister ps_CalphaAaddRegister(&ps_CalphaAaddDecl); diff --git a/Sources/Plasma/PubUtilLib/plSurface/ps_CalphaAbase.h b/Sources/Plasma/PubUtilLib/plSurface/ps_CalphaAbase.h index e9104261..bdc56541 100644 --- a/Sources/Plasma/PubUtilLib/plSurface/ps_CalphaAbase.h +++ b/Sources/Plasma/PubUtilLib/plSurface/ps_CalphaAbase.h @@ -41,9 +41,9 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ -static const UInt32 ps_CalphaAbaseByteLen = 72; +static const uint32_t ps_CalphaAbasebyteLen = 72; -static const UInt8 ps_CalphaAbaseCodes[] = { +static const uint8_t ps_CalphaAbaseCodes[] = { 0x1, 0x1, 0xff, 0xff, 0x42, 0x0, 0x0, 0x0, 0x0, 0x0, 0xf, 0xb0, @@ -64,7 +64,7 @@ static const UInt8 ps_CalphaAbaseCodes[] = { 0xff, 0xff, 0x0, 0x0 }; -static const plShaderDecl ps_CalphaAbaseDecl("sha/ps_CalphaAbase.inl", ps_CalphaAbase, ps_CalphaAbaseByteLen, ps_CalphaAbaseCodes); +static const plShaderDecl ps_CalphaAbaseDecl("sha/ps_CalphaAbase.inl", ps_CalphaAbase, ps_CalphaAbasebyteLen, ps_CalphaAbaseCodes); static const plShaderRegister ps_CalphaAbaseRegister(&ps_CalphaAbaseDecl); diff --git a/Sources/Plasma/PubUtilLib/plSurface/ps_CbaseAbase.h b/Sources/Plasma/PubUtilLib/plSurface/ps_CbaseAbase.h index 00ab7e6c..4799269a 100644 --- a/Sources/Plasma/PubUtilLib/plSurface/ps_CbaseAbase.h +++ b/Sources/Plasma/PubUtilLib/plSurface/ps_CbaseAbase.h @@ -41,9 +41,9 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ -static const UInt32 ps_CbaseAbaseByteLen = 32; +static const uint32_t ps_CbaseAbasebyteLen = 32; -static const UInt8 ps_CbaseAbaseCodes[] = { +static const uint8_t ps_CbaseAbaseCodes[] = { 0x1, 0x1, 0xff, 0xff, 0x42, 0x0, 0x0, 0x0, 0x0, 0x0, 0xf, 0xb0, @@ -54,7 +54,7 @@ static const UInt8 ps_CbaseAbaseCodes[] = { 0xff, 0xff, 0x0, 0x0 }; -static const plShaderDecl ps_CbaseAbaseDecl("sha/ps_CbaseAbase.inl", ps_CbaseAbase, ps_CbaseAbaseByteLen, ps_CbaseAbaseCodes); +static const plShaderDecl ps_CbaseAbaseDecl("sha/ps_CbaseAbase.inl", ps_CbaseAbase, ps_CbaseAbasebyteLen, ps_CbaseAbaseCodes); static const plShaderRegister ps_CbaseAbaseRegister(&ps_CbaseAbaseDecl); diff --git a/Sources/Plasma/PubUtilLib/plSurface/ps_CmultAAdd.h b/Sources/Plasma/PubUtilLib/plSurface/ps_CmultAAdd.h index ac3a04b4..0cb37438 100644 --- a/Sources/Plasma/PubUtilLib/plSurface/ps_CmultAAdd.h +++ b/Sources/Plasma/PubUtilLib/plSurface/ps_CmultAAdd.h @@ -41,9 +41,9 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ -static const UInt32 ps_CmultAAddByteLen = 72; +static const uint32_t ps_CmultAAddbyteLen = 72; -static const UInt8 ps_CmultAAddCodes[] = { +static const uint8_t ps_CmultAAddCodes[] = { 0x1, 0x1, 0xff, 0xff, 0x42, 0x0, 0x0, 0x0, 0x0, 0x0, 0xf, 0xb0, @@ -64,7 +64,7 @@ static const UInt8 ps_CmultAAddCodes[] = { 0xff, 0xff, 0x0, 0x0 }; -static const plShaderDecl ps_CmultAAddDecl("sha/ps_CmultAAdd.inl", ps_CmultAAdd, ps_CmultAAddByteLen, ps_CmultAAddCodes); +static const plShaderDecl ps_CmultAAddDecl("sha/ps_CmultAAdd.inl", ps_CmultAAdd, ps_CmultAAddbyteLen, ps_CmultAAddCodes); static const plShaderRegister ps_CmultAAddRegister(&ps_CmultAAddDecl); diff --git a/Sources/Plasma/PubUtilLib/plSurface/ps_CmultAMult.h b/Sources/Plasma/PubUtilLib/plSurface/ps_CmultAMult.h index e60e5d87..9911ce4a 100644 --- a/Sources/Plasma/PubUtilLib/plSurface/ps_CmultAMult.h +++ b/Sources/Plasma/PubUtilLib/plSurface/ps_CmultAMult.h @@ -41,9 +41,9 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ -static const UInt32 ps_CmultAMultByteLen = 72; +static const uint32_t ps_CmultAMultbyteLen = 72; -static const UInt8 ps_CmultAMultCodes[] = { +static const uint8_t ps_CmultAMultCodes[] = { 0x1, 0x1, 0xff, 0xff, 0x42, 0x0, 0x0, 0x0, 0x0, 0x0, 0xf, 0xb0, @@ -64,7 +64,7 @@ static const UInt8 ps_CmultAMultCodes[] = { 0xff, 0xff, 0x0, 0x0 }; -static const plShaderDecl ps_CmultAMultDecl("sha/ps_CmultAMult.inl", ps_CmultAMult, ps_CmultAMultByteLen, ps_CmultAMultCodes); +static const plShaderDecl ps_CmultAMultDecl("sha/ps_CmultAMult.inl", ps_CmultAMult, ps_CmultAMultbyteLen, ps_CmultAMultCodes); static const plShaderRegister ps_CmultAMultRegister(&ps_CmultAMultDecl); diff --git a/Sources/Plasma/PubUtilLib/plSurface/ps_CmultAbase.h b/Sources/Plasma/PubUtilLib/plSurface/ps_CmultAbase.h index 8b341337..10e54f4c 100644 --- a/Sources/Plasma/PubUtilLib/plSurface/ps_CmultAbase.h +++ b/Sources/Plasma/PubUtilLib/plSurface/ps_CmultAbase.h @@ -41,9 +41,9 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ -static const UInt32 ps_CmultAbaseByteLen = 68; +static const uint32_t ps_CmultAbasebyteLen = 68; -static const UInt8 ps_CmultAbaseCodes[] = { +static const uint8_t ps_CmultAbaseCodes[] = { 0x1, 0x1, 0xff, 0xff, 0x42, 0x0, 0x0, 0x0, 0x0, 0x0, 0xf, 0xb0, @@ -63,7 +63,7 @@ static const UInt8 ps_CmultAbaseCodes[] = { 0xff, 0xff, 0x0, 0x0 }; -static const plShaderDecl ps_CmultAbaseDecl("sha/ps_CmultAbase.inl", ps_CmultAbase, ps_CmultAbaseByteLen, ps_CmultAbaseCodes); +static const plShaderDecl ps_CmultAbaseDecl("sha/ps_CmultAbase.inl", ps_CmultAbase, ps_CmultAbasebyteLen, ps_CmultAbaseCodes); static const plShaderRegister ps_CmultAbaseRegister(&ps_CmultAbaseDecl); diff --git a/Sources/Plasma/PubUtilLib/plSurface/ps_CompCosines.h b/Sources/Plasma/PubUtilLib/plSurface/ps_CompCosines.h index ec447725..3f03a5be 100644 --- a/Sources/Plasma/PubUtilLib/plSurface/ps_CompCosines.h +++ b/Sources/Plasma/PubUtilLib/plSurface/ps_CompCosines.h @@ -41,9 +41,9 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ -static const UInt32 ps_CompCosinesByteLen = 148; +static const uint32_t ps_CompCosinesbyteLen = 148; -static const UInt8 ps_CompCosinesCodes[] = { +static const uint8_t ps_CompCosinesCodes[] = { 0x1, 0x1, 0xff, 0xff, 0x42, 0x0, 0x0, 0x0, 0x0, 0x0, 0xf, 0xb0, @@ -83,7 +83,7 @@ static const UInt8 ps_CompCosinesCodes[] = { 0xff, 0xff, 0x0, 0x0 }; -static const plShaderDecl ps_CompCosinesDecl("sha/ps_CompCosines.inl", ps_CompCosines, ps_CompCosinesByteLen, ps_CompCosinesCodes); +static const plShaderDecl ps_CompCosinesDecl("sha/ps_CompCosines.inl", ps_CompCosines, ps_CompCosinesbyteLen, ps_CompCosinesCodes); static const plShaderRegister ps_CompCosinesRegister(&ps_CompCosinesDecl); diff --git a/Sources/Plasma/PubUtilLib/plSurface/ps_GrassShader.h b/Sources/Plasma/PubUtilLib/plSurface/ps_GrassShader.h index 356c0ea1..b9cd6829 100644 --- a/Sources/Plasma/PubUtilLib/plSurface/ps_GrassShader.h +++ b/Sources/Plasma/PubUtilLib/plSurface/ps_GrassShader.h @@ -41,9 +41,9 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ -static const UInt32 ps_GrassShaderByteLen = 32; +static const uint32_t ps_GrassShaderbyteLen = 32; -static const UInt8 ps_GrassShaderCodes[] = { +static const uint8_t ps_GrassShaderCodes[] = { 0x1, 0x1, 0xff, 0xff, 0x42, 0x0, 0x0, 0x0, 0x0, 0x0, 0xf, 0xb0, @@ -54,7 +54,7 @@ static const UInt8 ps_GrassShaderCodes[] = { 0xff, 0xff, 0x0, 0x0 }; -static const plShaderDecl ps_GrassShaderDecl("sha/ps_GrassShader.inl", ps_GrassShader, ps_GrassShaderByteLen, ps_GrassShaderCodes); +static const plShaderDecl ps_GrassShaderDecl("sha/ps_GrassShader.inl", ps_GrassShader, ps_GrassShaderbyteLen, ps_GrassShaderCodes); static const plShaderRegister ps_GrassShaderRegister(&ps_GrassShaderDecl); diff --git a/Sources/Plasma/PubUtilLib/plSurface/ps_MoreCosines.h b/Sources/Plasma/PubUtilLib/plSurface/ps_MoreCosines.h index a07e5288..68a3b706 100644 --- a/Sources/Plasma/PubUtilLib/plSurface/ps_MoreCosines.h +++ b/Sources/Plasma/PubUtilLib/plSurface/ps_MoreCosines.h @@ -41,9 +41,9 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ -static const UInt32 ps_MoreCosinesByteLen = 160; +static const uint32_t ps_MoreCosinesbyteLen = 160; -static const UInt8 ps_MoreCosinesCodes[] = { +static const uint8_t ps_MoreCosinesCodes[] = { 0x1, 0x1, 0xff, 0xff, 0x42, 0x0, 0x0, 0x0, 0x0, 0x0, 0xf, 0xb0, @@ -86,7 +86,7 @@ static const UInt8 ps_MoreCosinesCodes[] = { 0xff, 0xff, 0x0, 0x0 }; -static const plShaderDecl ps_MoreCosinesDecl("sha/ps_MoreCosines.inl", ps_MoreCosines, ps_MoreCosinesByteLen, ps_MoreCosinesCodes); +static const plShaderDecl ps_MoreCosinesDecl("sha/ps_MoreCosines.inl", ps_MoreCosines, ps_MoreCosinesbyteLen, ps_MoreCosinesCodes); static const plShaderRegister ps_MoreCosinesRegister(&ps_MoreCosinesDecl); diff --git a/Sources/Plasma/PubUtilLib/plSurface/ps_ShoreLeave6.h b/Sources/Plasma/PubUtilLib/plSurface/ps_ShoreLeave6.h index a7e7622d..0f15bcd8 100644 --- a/Sources/Plasma/PubUtilLib/plSurface/ps_ShoreLeave6.h +++ b/Sources/Plasma/PubUtilLib/plSurface/ps_ShoreLeave6.h @@ -41,9 +41,9 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ -static const UInt32 ps_ShoreLeave6ByteLen = 172; +static const uint32_t ps_ShoreLeave6byteLen = 172; -static const UInt8 ps_ShoreLeave6Codes[] = { +static const uint8_t ps_ShoreLeave6Codes[] = { 0x1, 0x1, 0xff, 0xff, 0x51, 0x0, 0x0, 0x0, 0x0, 0x0, 0xf, 0xa0, @@ -89,7 +89,7 @@ static const UInt8 ps_ShoreLeave6Codes[] = { 0xff, 0xff, 0x0, 0x0 }; -static const plShaderDecl ps_ShoreLeave6Decl("sha/ps_ShoreLeave6.inl", ps_ShoreLeave6, ps_ShoreLeave6ByteLen, ps_ShoreLeave6Codes); +static const plShaderDecl ps_ShoreLeave6Decl("sha/ps_ShoreLeave6.inl", ps_ShoreLeave6, ps_ShoreLeave6byteLen, ps_ShoreLeave6Codes); static const plShaderRegister ps_ShoreLeave6Register(&ps_ShoreLeave6Decl); diff --git a/Sources/Plasma/PubUtilLib/plSurface/ps_WaveDecEnv.h b/Sources/Plasma/PubUtilLib/plSurface/ps_WaveDecEnv.h index af57ab4a..5e78da0b 100644 --- a/Sources/Plasma/PubUtilLib/plSurface/ps_WaveDecEnv.h +++ b/Sources/Plasma/PubUtilLib/plSurface/ps_WaveDecEnv.h @@ -41,9 +41,9 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ -static const UInt32 ps_WaveDecEnvByteLen = 84; +static const uint32_t ps_WaveDecEnvbyteLen = 84; -static const UInt8 ps_WaveDecEnvCodes[] = { +static const uint8_t ps_WaveDecEnvCodes[] = { 0x1, 0x1, 0xff, 0xff, 0x42, 0x0, 0x0, 0x0, 0x0, 0x0, 0xf, 0xb0, @@ -67,7 +67,7 @@ static const UInt8 ps_WaveDecEnvCodes[] = { 0xff, 0xff, 0x0, 0x0 }; -static const plShaderDecl ps_WaveDecEnvDecl("sha/ps_WaveDecEnv.inl", ps_WaveDecEnv, ps_WaveDecEnvByteLen, ps_WaveDecEnvCodes); +static const plShaderDecl ps_WaveDecEnvDecl("sha/ps_WaveDecEnv.inl", ps_WaveDecEnv, ps_WaveDecEnvbyteLen, ps_WaveDecEnvCodes); static const plShaderRegister ps_WaveDecEnvRegister(&ps_WaveDecEnvDecl); diff --git a/Sources/Plasma/PubUtilLib/plSurface/ps_WaveFixed.h b/Sources/Plasma/PubUtilLib/plSurface/ps_WaveFixed.h index d73b890f..b277528b 100644 --- a/Sources/Plasma/PubUtilLib/plSurface/ps_WaveFixed.h +++ b/Sources/Plasma/PubUtilLib/plSurface/ps_WaveFixed.h @@ -41,9 +41,9 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ -static const UInt32 ps_WaveFixedByteLen = 108; +static const uint32_t ps_WaveFixedbyteLen = 108; -static const UInt8 ps_WaveFixedCodes[] = { +static const uint8_t ps_WaveFixedCodes[] = { 0x1, 0x1, 0xff, 0xff, 0x51, 0x0, 0x0, 0x0, 0x0, 0x0, 0xf, 0xa0, @@ -73,7 +73,7 @@ static const UInt8 ps_WaveFixedCodes[] = { 0xff, 0xff, 0x0, 0x0 }; -static const plShaderDecl ps_WaveFixedDecl("sha/ps_WaveFixed.inl", ps_WaveFixed, ps_WaveFixedByteLen, ps_WaveFixedCodes); +static const plShaderDecl ps_WaveFixedDecl("sha/ps_WaveFixed.inl", ps_WaveFixed, ps_WaveFixedbyteLen, ps_WaveFixedCodes); static const plShaderRegister ps_WaveFixedRegister(&ps_WaveFixedDecl); diff --git a/Sources/Plasma/PubUtilLib/plSurface/ps_WaveGraph.h b/Sources/Plasma/PubUtilLib/plSurface/ps_WaveGraph.h index 824ade18..501c65de 100644 --- a/Sources/Plasma/PubUtilLib/plSurface/ps_WaveGraph.h +++ b/Sources/Plasma/PubUtilLib/plSurface/ps_WaveGraph.h @@ -41,9 +41,9 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ -static const UInt32 ps_WaveGraphByteLen = 80; +static const uint32_t ps_WaveGraphbyteLen = 80; -static const UInt8 ps_WaveGraphCodes[] = { +static const uint8_t ps_WaveGraphCodes[] = { 0x1, 0x1, 0xff, 0xff, 0x42, 0x0, 0x0, 0x0, 0x0, 0x0, 0xf, 0xb0, @@ -66,7 +66,7 @@ static const UInt8 ps_WaveGraphCodes[] = { 0xff, 0xff, 0x0, 0x0 }; -static const plShaderDecl ps_WaveGraphDecl("sha/ps_WaveGraph.inl", ps_WaveGraph, ps_WaveGraphByteLen, ps_WaveGraphCodes); +static const plShaderDecl ps_WaveGraphDecl("sha/ps_WaveGraph.inl", ps_WaveGraph, ps_WaveGraphbyteLen, ps_WaveGraphCodes); static const plShaderRegister ps_WaveGraphRegister(&ps_WaveGraphDecl); diff --git a/Sources/Plasma/PubUtilLib/plSurface/ps_WaveGrid.h b/Sources/Plasma/PubUtilLib/plSurface/ps_WaveGrid.h index f506e903..87d38e72 100644 --- a/Sources/Plasma/PubUtilLib/plSurface/ps_WaveGrid.h +++ b/Sources/Plasma/PubUtilLib/plSurface/ps_WaveGrid.h @@ -41,9 +41,9 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ -static const UInt32 ps_WaveGridByteLen = 84; +static const uint32_t ps_WaveGridbyteLen = 84; -static const UInt8 ps_WaveGridCodes[] = { +static const uint8_t ps_WaveGridCodes[] = { 0x1, 0x1, 0xff, 0xff, 0x42, 0x0, 0x0, 0x0, 0x0, 0x0, 0xf, 0xb0, @@ -67,7 +67,7 @@ static const UInt8 ps_WaveGridCodes[] = { 0xff, 0xff, 0x0, 0x0 }; -static const plShaderDecl ps_WaveGridDecl("sha/ps_WaveGrid.inl", ps_WaveGrid, ps_WaveGridByteLen, ps_WaveGridCodes); +static const plShaderDecl ps_WaveGridDecl("sha/ps_WaveGrid.inl", ps_WaveGrid, ps_WaveGridbyteLen, ps_WaveGridCodes); static const plShaderRegister ps_WaveGridRegister(&ps_WaveGridDecl); diff --git a/Sources/Plasma/PubUtilLib/plSurface/ps_WaveRip.h b/Sources/Plasma/PubUtilLib/plSurface/ps_WaveRip.h index 98a315f3..7bf5770e 100644 --- a/Sources/Plasma/PubUtilLib/plSurface/ps_WaveRip.h +++ b/Sources/Plasma/PubUtilLib/plSurface/ps_WaveRip.h @@ -41,9 +41,9 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ -static const UInt32 ps_WaveRipByteLen = 32; +static const uint32_t ps_WaveRipbyteLen = 32; -static const UInt8 ps_WaveRipCodes[] = { +static const uint8_t ps_WaveRipCodes[] = { 0x1, 0x1, 0xff, 0xff, 0x42, 0x0, 0x0, 0x0, 0x0, 0x0, 0xf, 0xb0, @@ -54,7 +54,7 @@ static const UInt8 ps_WaveRipCodes[] = { 0xff, 0xff, 0x0, 0x0 }; -static const plShaderDecl ps_WaveRipDecl("sha/ps_WaveRip.inl", ps_WaveRip, ps_WaveRipByteLen, ps_WaveRipCodes); +static const plShaderDecl ps_WaveRipDecl("sha/ps_WaveRip.inl", ps_WaveRip, ps_WaveRipbyteLen, ps_WaveRipCodes); static const plShaderRegister ps_WaveRipRegister(&ps_WaveRipDecl); diff --git a/Sources/Plasma/PubUtilLib/plSurface/vs_BiasNormals.h b/Sources/Plasma/PubUtilLib/plSurface/vs_BiasNormals.h index b701063e..c933ab66 100644 --- a/Sources/Plasma/PubUtilLib/plSurface/vs_BiasNormals.h +++ b/Sources/Plasma/PubUtilLib/plSurface/vs_BiasNormals.h @@ -41,9 +41,9 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ -static const UInt32 vs_BiasNormalsByteLen = 168; +static const uint32_t vs_BiasNormalsbyteLen = 168; -static const UInt8 vs_BiasNormalsCodes[] = { +static const uint8_t vs_BiasNormalsCodes[] = { 0x1, 0x1, 0xfe, 0xff, 0x1f, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x80, @@ -88,7 +88,7 @@ static const UInt8 vs_BiasNormalsCodes[] = { 0xff, 0xff, 0x0, 0x0 }; -static const plShaderDecl vs_BiasNormalsDecl("sha/vs_BiasNormals.inl", vs_BiasNormals, vs_BiasNormalsByteLen, vs_BiasNormalsCodes); +static const plShaderDecl vs_BiasNormalsDecl("sha/vs_BiasNormals.inl", vs_BiasNormals, vs_BiasNormalsbyteLen, vs_BiasNormalsCodes); static const plShaderRegister vs_BiasNormalsRegister(&vs_BiasNormalsDecl); diff --git a/Sources/Plasma/PubUtilLib/plSurface/vs_CompCosines.h b/Sources/Plasma/PubUtilLib/plSurface/vs_CompCosines.h index 6c094b78..48983062 100644 --- a/Sources/Plasma/PubUtilLib/plSurface/vs_CompCosines.h +++ b/Sources/Plasma/PubUtilLib/plSurface/vs_CompCosines.h @@ -41,9 +41,9 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ -static const UInt32 vs_CompCosinesByteLen = 168; +static const uint32_t vs_CompCosinesbyteLen = 168; -static const UInt8 vs_CompCosinesCodes[] = { +static const uint8_t vs_CompCosinesCodes[] = { 0x1, 0x1, 0xfe, 0xff, 0x1f, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x80, @@ -88,7 +88,7 @@ static const UInt8 vs_CompCosinesCodes[] = { 0xff, 0xff, 0x0, 0x0 }; -static const plShaderDecl vs_CompCosinesDecl("sha/vs_CompCosines.inl", vs_CompCosines, vs_CompCosinesByteLen, vs_CompCosinesCodes); +static const plShaderDecl vs_CompCosinesDecl("sha/vs_CompCosines.inl", vs_CompCosines, vs_CompCosinesbyteLen, vs_CompCosinesCodes); static const plShaderRegister vs_CompCosinesRegister(&vs_CompCosinesDecl); diff --git a/Sources/Plasma/PubUtilLib/plSurface/vs_GrassShader.h b/Sources/Plasma/PubUtilLib/plSurface/vs_GrassShader.h index a181a2ea..a77f16e8 100644 --- a/Sources/Plasma/PubUtilLib/plSurface/vs_GrassShader.h +++ b/Sources/Plasma/PubUtilLib/plSurface/vs_GrassShader.h @@ -41,9 +41,9 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ -static const UInt32 vs_GrassShaderByteLen = 500; +static const uint32_t vs_GrassShaderbyteLen = 500; -static const UInt8 vs_GrassShaderCodes[] = { +static const uint8_t vs_GrassShaderCodes[] = { 0x1, 0x1, 0xfe, 0xff, 0x1f, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x80, @@ -171,7 +171,7 @@ static const UInt8 vs_GrassShaderCodes[] = { 0xff, 0xff, 0x0, 0x0 }; -static const plShaderDecl vs_GrassShaderDecl("sha/vs_GrassShader.inl", vs_GrassShader, vs_GrassShaderByteLen, vs_GrassShaderCodes); +static const plShaderDecl vs_GrassShaderDecl("sha/vs_GrassShader.inl", vs_GrassShader, vs_GrassShaderbyteLen, vs_GrassShaderCodes); static const plShaderRegister vs_GrassShaderRegister(&vs_GrassShaderDecl); diff --git a/Sources/Plasma/PubUtilLib/plSurface/vs_ShoreLeave6.h b/Sources/Plasma/PubUtilLib/plSurface/vs_ShoreLeave6.h index 433600f5..05aa35e2 100644 --- a/Sources/Plasma/PubUtilLib/plSurface/vs_ShoreLeave6.h +++ b/Sources/Plasma/PubUtilLib/plSurface/vs_ShoreLeave6.h @@ -41,9 +41,9 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ -static const UInt32 vs_ShoreLeave6ByteLen = 1220; +static const uint32_t vs_ShoreLeave6byteLen = 1220; -static const UInt8 vs_ShoreLeave6Codes[] = { +static const uint8_t vs_ShoreLeave6Codes[] = { 0x1, 0x1, 0xfe, 0xff, 0x1f, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x80, @@ -351,7 +351,7 @@ static const UInt8 vs_ShoreLeave6Codes[] = { 0xff, 0xff, 0x0, 0x0 }; -static const plShaderDecl vs_ShoreLeave6Decl("sha/vs_ShoreLeave6.inl", vs_ShoreLeave6, vs_ShoreLeave6ByteLen, vs_ShoreLeave6Codes); +static const plShaderDecl vs_ShoreLeave6Decl("sha/vs_ShoreLeave6.inl", vs_ShoreLeave6, vs_ShoreLeave6byteLen, vs_ShoreLeave6Codes); static const plShaderRegister vs_ShoreLeave6Register(&vs_ShoreLeave6Decl); diff --git a/Sources/Plasma/PubUtilLib/plSurface/vs_ShoreLeave7.h b/Sources/Plasma/PubUtilLib/plSurface/vs_ShoreLeave7.h index 5a17e2a6..36622820 100644 --- a/Sources/Plasma/PubUtilLib/plSurface/vs_ShoreLeave7.h +++ b/Sources/Plasma/PubUtilLib/plSurface/vs_ShoreLeave7.h @@ -41,9 +41,9 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ -static const UInt32 vs_ShoreLeave7ByteLen = 972; +static const uint32_t vs_ShoreLeave7byteLen = 972; -static const UInt8 vs_ShoreLeave7Codes[] = { +static const uint8_t vs_ShoreLeave7Codes[] = { 0x1, 0x1, 0xfe, 0xff, 0x1f, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x80, @@ -289,7 +289,7 @@ static const UInt8 vs_ShoreLeave7Codes[] = { 0xff, 0xff, 0x0, 0x0 }; -static const plShaderDecl vs_ShoreLeave7Decl("sha/vs_ShoreLeave7.inl", vs_ShoreLeave7, vs_ShoreLeave7ByteLen, vs_ShoreLeave7Codes); +static const plShaderDecl vs_ShoreLeave7Decl("sha/vs_ShoreLeave7.inl", vs_ShoreLeave7, vs_ShoreLeave7byteLen, vs_ShoreLeave7Codes); static const plShaderRegister vs_ShoreLeave7Register(&vs_ShoreLeave7Decl); diff --git a/Sources/Plasma/PubUtilLib/plSurface/vs_WaveDec1Lay.h b/Sources/Plasma/PubUtilLib/plSurface/vs_WaveDec1Lay.h index 04267f14..9feefa82 100644 --- a/Sources/Plasma/PubUtilLib/plSurface/vs_WaveDec1Lay.h +++ b/Sources/Plasma/PubUtilLib/plSurface/vs_WaveDec1Lay.h @@ -41,9 +41,9 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ -static const UInt32 vs_WaveDec1LayByteLen = 1100; +static const uint32_t vs_WaveDec1LaybyteLen = 1100; -static const UInt8 vs_WaveDec1LayCodes[] = { +static const uint8_t vs_WaveDec1LayCodes[] = { 0x1, 0x1, 0xfe, 0xff, 0x1f, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x80, @@ -321,7 +321,7 @@ static const UInt8 vs_WaveDec1LayCodes[] = { 0xff, 0xff, 0x0, 0x0 }; -static const plShaderDecl vs_WaveDec1LayDecl("sha/vs_WaveDec1Lay.inl", vs_WaveDec1Lay, vs_WaveDec1LayByteLen, vs_WaveDec1LayCodes); +static const plShaderDecl vs_WaveDec1LayDecl("sha/vs_WaveDec1Lay.inl", vs_WaveDec1Lay, vs_WaveDec1LaybyteLen, vs_WaveDec1LayCodes); static const plShaderRegister vs_WaveDec1LayRegister(&vs_WaveDec1LayDecl); diff --git a/Sources/Plasma/PubUtilLib/plSurface/vs_WaveDec1Lay_7.h b/Sources/Plasma/PubUtilLib/plSurface/vs_WaveDec1Lay_7.h index 2eebe372..e08c56f5 100644 --- a/Sources/Plasma/PubUtilLib/plSurface/vs_WaveDec1Lay_7.h +++ b/Sources/Plasma/PubUtilLib/plSurface/vs_WaveDec1Lay_7.h @@ -41,9 +41,9 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ -static const UInt32 vs_WaveDec1Lay_7ByteLen = 964; +static const uint32_t vs_WaveDec1Lay_7byteLen = 964; -static const UInt8 vs_WaveDec1Lay_7Codes[] = { +static const uint8_t vs_WaveDec1Lay_7Codes[] = { 0x1, 0x1, 0xfe, 0xff, 0x1f, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x80, @@ -287,7 +287,7 @@ static const UInt8 vs_WaveDec1Lay_7Codes[] = { 0xff, 0xff, 0x0, 0x0 }; -static const plShaderDecl vs_WaveDec1Lay_7Decl("sha/vs_WaveDec1Lay_7.inl", vs_WaveDec1Lay_7, vs_WaveDec1Lay_7ByteLen, vs_WaveDec1Lay_7Codes); +static const plShaderDecl vs_WaveDec1Lay_7Decl("sha/vs_WaveDec1Lay_7.inl", vs_WaveDec1Lay_7, vs_WaveDec1Lay_7byteLen, vs_WaveDec1Lay_7Codes); static const plShaderRegister vs_WaveDec1Lay_7Register(&vs_WaveDec1Lay_7Decl); diff --git a/Sources/Plasma/PubUtilLib/plSurface/vs_WaveDec2Lay11.h b/Sources/Plasma/PubUtilLib/plSurface/vs_WaveDec2Lay11.h index 47284012..078e3e87 100644 --- a/Sources/Plasma/PubUtilLib/plSurface/vs_WaveDec2Lay11.h +++ b/Sources/Plasma/PubUtilLib/plSurface/vs_WaveDec2Lay11.h @@ -41,9 +41,9 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ -static const UInt32 vs_WaveDec2Lay11ByteLen = 1144; +static const uint32_t vs_WaveDec2Lay11byteLen = 1144; -static const UInt8 vs_WaveDec2Lay11Codes[] = { +static const uint8_t vs_WaveDec2Lay11Codes[] = { 0x1, 0x1, 0xfe, 0xff, 0x1f, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x80, @@ -332,7 +332,7 @@ static const UInt8 vs_WaveDec2Lay11Codes[] = { 0xff, 0xff, 0x0, 0x0 }; -static const plShaderDecl vs_WaveDec2Lay11Decl("sha/vs_WaveDec2Lay11.inl", vs_WaveDec2Lay11, vs_WaveDec2Lay11ByteLen, vs_WaveDec2Lay11Codes); +static const plShaderDecl vs_WaveDec2Lay11Decl("sha/vs_WaveDec2Lay11.inl", vs_WaveDec2Lay11, vs_WaveDec2Lay11byteLen, vs_WaveDec2Lay11Codes); static const plShaderRegister vs_WaveDec2Lay11Register(&vs_WaveDec2Lay11Decl); diff --git a/Sources/Plasma/PubUtilLib/plSurface/vs_WaveDec2Lay11_7.h b/Sources/Plasma/PubUtilLib/plSurface/vs_WaveDec2Lay11_7.h index 6550c745..561fc6b3 100644 --- a/Sources/Plasma/PubUtilLib/plSurface/vs_WaveDec2Lay11_7.h +++ b/Sources/Plasma/PubUtilLib/plSurface/vs_WaveDec2Lay11_7.h @@ -41,9 +41,9 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ -static const UInt32 vs_WaveDec2Lay11_7ByteLen = 1008; +static const uint32_t vs_WaveDec2Lay11_7byteLen = 1008; -static const UInt8 vs_WaveDec2Lay11_7Codes[] = { +static const uint8_t vs_WaveDec2Lay11_7Codes[] = { 0x1, 0x1, 0xfe, 0xff, 0x1f, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x80, @@ -298,7 +298,7 @@ static const UInt8 vs_WaveDec2Lay11_7Codes[] = { 0xff, 0xff, 0x0, 0x0 }; -static const plShaderDecl vs_WaveDec2Lay11_7Decl("sha/vs_WaveDec2Lay11_7.inl", vs_WaveDec2Lay11_7, vs_WaveDec2Lay11_7ByteLen, vs_WaveDec2Lay11_7Codes); +static const plShaderDecl vs_WaveDec2Lay11_7Decl("sha/vs_WaveDec2Lay11_7.inl", vs_WaveDec2Lay11_7, vs_WaveDec2Lay11_7byteLen, vs_WaveDec2Lay11_7Codes); static const plShaderRegister vs_WaveDec2Lay11_7Register(&vs_WaveDec2Lay11_7Decl); diff --git a/Sources/Plasma/PubUtilLib/plSurface/vs_WaveDec2Lay12.h b/Sources/Plasma/PubUtilLib/plSurface/vs_WaveDec2Lay12.h index 8668c2ef..62a7c3c2 100644 --- a/Sources/Plasma/PubUtilLib/plSurface/vs_WaveDec2Lay12.h +++ b/Sources/Plasma/PubUtilLib/plSurface/vs_WaveDec2Lay12.h @@ -41,9 +41,9 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ -static const UInt32 vs_WaveDec2Lay12ByteLen = 1156; +static const uint32_t vs_WaveDec2Lay12byteLen = 1156; -static const UInt8 vs_WaveDec2Lay12Codes[] = { +static const uint8_t vs_WaveDec2Lay12Codes[] = { 0x1, 0x1, 0xfe, 0xff, 0x1f, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x80, @@ -335,7 +335,7 @@ static const UInt8 vs_WaveDec2Lay12Codes[] = { 0xff, 0xff, 0x0, 0x0 }; -static const plShaderDecl vs_WaveDec2Lay12Decl("sha/vs_WaveDec2Lay12.inl", vs_WaveDec2Lay12, vs_WaveDec2Lay12ByteLen, vs_WaveDec2Lay12Codes); +static const plShaderDecl vs_WaveDec2Lay12Decl("sha/vs_WaveDec2Lay12.inl", vs_WaveDec2Lay12, vs_WaveDec2Lay12byteLen, vs_WaveDec2Lay12Codes); static const plShaderRegister vs_WaveDec2Lay12Register(&vs_WaveDec2Lay12Decl); diff --git a/Sources/Plasma/PubUtilLib/plSurface/vs_WaveDec2Lay12_7.h b/Sources/Plasma/PubUtilLib/plSurface/vs_WaveDec2Lay12_7.h index f82db431..62bbfd1d 100644 --- a/Sources/Plasma/PubUtilLib/plSurface/vs_WaveDec2Lay12_7.h +++ b/Sources/Plasma/PubUtilLib/plSurface/vs_WaveDec2Lay12_7.h @@ -41,9 +41,9 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ -static const UInt32 vs_WaveDec2Lay12_7ByteLen = 1020; +static const uint32_t vs_WaveDec2Lay12_7byteLen = 1020; -static const UInt8 vs_WaveDec2Lay12_7Codes[] = { +static const uint8_t vs_WaveDec2Lay12_7Codes[] = { 0x1, 0x1, 0xfe, 0xff, 0x1f, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x80, @@ -301,7 +301,7 @@ static const UInt8 vs_WaveDec2Lay12_7Codes[] = { 0xff, 0xff, 0x0, 0x0 }; -static const plShaderDecl vs_WaveDec2Lay12_7Decl("sha/vs_WaveDec2Lay12_7.inl", vs_WaveDec2Lay12_7, vs_WaveDec2Lay12_7ByteLen, vs_WaveDec2Lay12_7Codes); +static const plShaderDecl vs_WaveDec2Lay12_7Decl("sha/vs_WaveDec2Lay12_7.inl", vs_WaveDec2Lay12_7, vs_WaveDec2Lay12_7byteLen, vs_WaveDec2Lay12_7Codes); static const plShaderRegister vs_WaveDec2Lay12_7Register(&vs_WaveDec2Lay12_7Decl); diff --git a/Sources/Plasma/PubUtilLib/plSurface/vs_WaveDecEnv.h b/Sources/Plasma/PubUtilLib/plSurface/vs_WaveDecEnv.h index 3e9176e6..f72b2f2a 100644 --- a/Sources/Plasma/PubUtilLib/plSurface/vs_WaveDecEnv.h +++ b/Sources/Plasma/PubUtilLib/plSurface/vs_WaveDecEnv.h @@ -41,9 +41,9 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ -static const UInt32 vs_WaveDecEnvByteLen = 1616; +static const uint32_t vs_WaveDecEnvbyteLen = 1616; -static const UInt8 vs_WaveDecEnvCodes[] = { +static const uint8_t vs_WaveDecEnvCodes[] = { 0x1, 0x1, 0xfe, 0xff, 0x1f, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x80, @@ -450,7 +450,7 @@ static const UInt8 vs_WaveDecEnvCodes[] = { 0xff, 0xff, 0x0, 0x0 }; -static const plShaderDecl vs_WaveDecEnvDecl("sha/vs_WaveDecEnv.inl", vs_WaveDecEnv, vs_WaveDecEnvByteLen, vs_WaveDecEnvCodes); +static const plShaderDecl vs_WaveDecEnvDecl("sha/vs_WaveDecEnv.inl", vs_WaveDecEnv, vs_WaveDecEnvbyteLen, vs_WaveDecEnvCodes); static const plShaderRegister vs_WaveDecEnvRegister(&vs_WaveDecEnvDecl); diff --git a/Sources/Plasma/PubUtilLib/plSurface/vs_WaveDecEnv_7.h b/Sources/Plasma/PubUtilLib/plSurface/vs_WaveDecEnv_7.h index 8006ba2a..2fa44ae3 100644 --- a/Sources/Plasma/PubUtilLib/plSurface/vs_WaveDecEnv_7.h +++ b/Sources/Plasma/PubUtilLib/plSurface/vs_WaveDecEnv_7.h @@ -41,9 +41,9 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ -static const UInt32 vs_WaveDecEnv_7ByteLen = 1752; +static const uint32_t vs_WaveDecEnv_7byteLen = 1752; -static const UInt8 vs_WaveDecEnv_7Codes[] = { +static const uint8_t vs_WaveDecEnv_7Codes[] = { 0x1, 0x1, 0xfe, 0xff, 0x1f, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x80, @@ -484,7 +484,7 @@ static const UInt8 vs_WaveDecEnv_7Codes[] = { 0xff, 0xff, 0x0, 0x0 }; -static const plShaderDecl vs_WaveDecEnv_7Decl("sha/vs_WaveDecEnv_7.inl", vs_WaveDecEnv_7, vs_WaveDecEnv_7ByteLen, vs_WaveDecEnv_7Codes); +static const plShaderDecl vs_WaveDecEnv_7Decl("sha/vs_WaveDecEnv_7.inl", vs_WaveDecEnv_7, vs_WaveDecEnv_7byteLen, vs_WaveDecEnv_7Codes); static const plShaderRegister vs_WaveDecEnv_7Register(&vs_WaveDecEnv_7Decl); diff --git a/Sources/Plasma/PubUtilLib/plSurface/vs_WaveFixedFin6.h b/Sources/Plasma/PubUtilLib/plSurface/vs_WaveFixedFin6.h index a5a310d9..0a168633 100644 --- a/Sources/Plasma/PubUtilLib/plSurface/vs_WaveFixedFin6.h +++ b/Sources/Plasma/PubUtilLib/plSurface/vs_WaveFixedFin6.h @@ -41,9 +41,9 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ -static const UInt32 vs_WaveFixedFin6ByteLen = 1928; +static const uint32_t vs_WaveFixedFin6byteLen = 1928; -static const UInt8 vs_WaveFixedFin6Codes[] = { +static const uint8_t vs_WaveFixedFin6Codes[] = { 0x1, 0x1, 0xfe, 0xff, 0x1f, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x80, @@ -528,7 +528,7 @@ static const UInt8 vs_WaveFixedFin6Codes[] = { 0xff, 0xff, 0x0, 0x0 }; -static const plShaderDecl vs_WaveFixedFin6Decl("sha/vs_WaveFixedFin6.inl", vs_WaveFixedFin6, vs_WaveFixedFin6ByteLen, vs_WaveFixedFin6Codes); +static const plShaderDecl vs_WaveFixedFin6Decl("sha/vs_WaveFixedFin6.inl", vs_WaveFixedFin6, vs_WaveFixedFin6byteLen, vs_WaveFixedFin6Codes); static const plShaderRegister vs_WaveFixedFin6Register(&vs_WaveFixedFin6Decl); diff --git a/Sources/Plasma/PubUtilLib/plSurface/vs_WaveFixedFin7.h b/Sources/Plasma/PubUtilLib/plSurface/vs_WaveFixedFin7.h index c791fce3..fc158b6c 100644 --- a/Sources/Plasma/PubUtilLib/plSurface/vs_WaveFixedFin7.h +++ b/Sources/Plasma/PubUtilLib/plSurface/vs_WaveFixedFin7.h @@ -41,9 +41,9 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ -static const UInt32 vs_WaveFixedFin7ByteLen = 1876; +static const uint32_t vs_WaveFixedFin7byteLen = 1876; -static const UInt8 vs_WaveFixedFin7Codes[] = { +static const uint8_t vs_WaveFixedFin7Codes[] = { 0x1, 0x1, 0xfe, 0xff, 0x1f, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x80, @@ -515,7 +515,7 @@ static const UInt8 vs_WaveFixedFin7Codes[] = { 0xff, 0xff, 0x0, 0x0 }; -static const plShaderDecl vs_WaveFixedFin7Decl("sha/vs_WaveFixedFin7.inl", vs_WaveFixedFin7, vs_WaveFixedFin7ByteLen, vs_WaveFixedFin7Codes); +static const plShaderDecl vs_WaveFixedFin7Decl("sha/vs_WaveFixedFin7.inl", vs_WaveFixedFin7, vs_WaveFixedFin7byteLen, vs_WaveFixedFin7Codes); static const plShaderRegister vs_WaveFixedFin7Register(&vs_WaveFixedFin7Decl); diff --git a/Sources/Plasma/PubUtilLib/plSurface/vs_WaveGraph2.h b/Sources/Plasma/PubUtilLib/plSurface/vs_WaveGraph2.h index 20cda81c..066329b0 100644 --- a/Sources/Plasma/PubUtilLib/plSurface/vs_WaveGraph2.h +++ b/Sources/Plasma/PubUtilLib/plSurface/vs_WaveGraph2.h @@ -41,9 +41,9 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ -static const UInt32 vs_WaveGraph2ByteLen = 608; +static const uint32_t vs_WaveGraph2byteLen = 608; -static const UInt8 vs_WaveGraph2Codes[] = { +static const uint8_t vs_WaveGraph2Codes[] = { 0x1, 0x1, 0xfe, 0xff, 0x1f, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x80, @@ -198,7 +198,7 @@ static const UInt8 vs_WaveGraph2Codes[] = { 0xff, 0xff, 0x0, 0x0 }; -static const plShaderDecl vs_WaveGraph2Decl("sha/vs_WaveGraph2.inl", vs_WaveGraph2, vs_WaveGraph2ByteLen, vs_WaveGraph2Codes); +static const plShaderDecl vs_WaveGraph2Decl("sha/vs_WaveGraph2.inl", vs_WaveGraph2, vs_WaveGraph2byteLen, vs_WaveGraph2Codes); static const plShaderRegister vs_WaveGraph2Register(&vs_WaveGraph2Decl); diff --git a/Sources/Plasma/PubUtilLib/plSurface/vs_WaveGridFin.h b/Sources/Plasma/PubUtilLib/plSurface/vs_WaveGridFin.h index 8557b654..5621988a 100644 --- a/Sources/Plasma/PubUtilLib/plSurface/vs_WaveGridFin.h +++ b/Sources/Plasma/PubUtilLib/plSurface/vs_WaveGridFin.h @@ -41,9 +41,9 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ -static const UInt32 vs_WaveGridFinByteLen = 1728; +static const uint32_t vs_WaveGridFinbyteLen = 1728; -static const UInt8 vs_WaveGridFinCodes[] = { +static const uint8_t vs_WaveGridFinCodes[] = { 0x1, 0x1, 0xfe, 0xff, 0x1f, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x80, @@ -478,7 +478,7 @@ static const UInt8 vs_WaveGridFinCodes[] = { 0xff, 0xff, 0x0, 0x0 }; -static const plShaderDecl vs_WaveGridFinDecl("sha/vs_WaveGridFin.inl", vs_WaveGridFin, vs_WaveGridFinByteLen, vs_WaveGridFinCodes); +static const plShaderDecl vs_WaveGridFinDecl("sha/vs_WaveGridFin.inl", vs_WaveGridFin, vs_WaveGridFinbyteLen, vs_WaveGridFinCodes); static const plShaderRegister vs_WaveGridFinRegister(&vs_WaveGridFinDecl); diff --git a/Sources/Plasma/PubUtilLib/plSurface/vs_WaveRip.h b/Sources/Plasma/PubUtilLib/plSurface/vs_WaveRip.h index 143a63eb..df5f534f 100644 --- a/Sources/Plasma/PubUtilLib/plSurface/vs_WaveRip.h +++ b/Sources/Plasma/PubUtilLib/plSurface/vs_WaveRip.h @@ -41,9 +41,9 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ -static const UInt32 vs_WaveRipByteLen = 1344; +static const uint32_t vs_WaveRipbyteLen = 1344; -static const UInt8 vs_WaveRipCodes[] = { +static const uint8_t vs_WaveRipCodes[] = { 0x1, 0x1, 0xfe, 0xff, 0x1f, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x80, @@ -382,7 +382,7 @@ static const UInt8 vs_WaveRipCodes[] = { 0xff, 0xff, 0x0, 0x0 }; -static const plShaderDecl vs_WaveRipDecl("sha/vs_WaveRip.inl", vs_WaveRip, vs_WaveRipByteLen, vs_WaveRipCodes); +static const plShaderDecl vs_WaveRipDecl("sha/vs_WaveRip.inl", vs_WaveRip, vs_WaveRipbyteLen, vs_WaveRipCodes); static const plShaderRegister vs_WaveRipRegister(&vs_WaveRipDecl); diff --git a/Sources/Plasma/PubUtilLib/plSurface/vs_WaveRip7.h b/Sources/Plasma/PubUtilLib/plSurface/vs_WaveRip7.h index f9b23221..9e987a68 100644 --- a/Sources/Plasma/PubUtilLib/plSurface/vs_WaveRip7.h +++ b/Sources/Plasma/PubUtilLib/plSurface/vs_WaveRip7.h @@ -41,9 +41,9 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ -static const UInt32 vs_WaveRip7ByteLen = 1208; +static const uint32_t vs_WaveRip7byteLen = 1208; -static const UInt8 vs_WaveRip7Codes[] = { +static const uint8_t vs_WaveRip7Codes[] = { 0x1, 0x1, 0xfe, 0xff, 0x1f, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x80, @@ -348,7 +348,7 @@ static const UInt8 vs_WaveRip7Codes[] = { 0xff, 0xff, 0x0, 0x0 }; -static const plShaderDecl vs_WaveRip7Decl("sha/vs_WaveRip7.inl", vs_WaveRip7, vs_WaveRip7ByteLen, vs_WaveRip7Codes); +static const plShaderDecl vs_WaveRip7Decl("sha/vs_WaveRip7.inl", vs_WaveRip7, vs_WaveRip7byteLen, vs_WaveRip7Codes); static const plShaderRegister vs_WaveRip7Register(&vs_WaveRip7Decl); diff --git a/Sources/Plasma/PubUtilLib/plTransform/hsAffineParts.cpp b/Sources/Plasma/PubUtilLib/plTransform/hsAffineParts.cpp index 9ee5c99e..1895b291 100644 --- a/Sources/Plasma/PubUtilLib/plTransform/hsAffineParts.cpp +++ b/Sources/Plasma/PubUtilLib/plTransform/hsAffineParts.cpp @@ -244,7 +244,7 @@ void hsAffineParts::ComposeMatrix(hsMatrix44 *out) const hsVector3 R[3]; QuatTo3Vectors(fQ, R); - hsScalar f = fF < 0 ? -1.f : 1.f; + float f = fF < 0 ? -1.f : 1.f; for( i = 0; i < 3; i++ ) { for( j = 0; j < 3; j++ ) @@ -274,7 +274,7 @@ void hsAffineParts::ComposeInverseMatrix(hsMatrix44 *out) const // Build scale factor matrix hsMatrix44 K; hsVector3 invK; - invK.Set(hsScalarInvert(fK.fX),hsScalarInvert(fK.fY),hsScalarInvert(fK.fZ)); + invK.Set(hsInvert(fK.fX),hsInvert(fK.fY),hsInvert(fK.fZ)); K.MakeScaleMat(&invK); // Build Utranspose matrix @@ -357,7 +357,7 @@ void hsAffineParts::ComposeInverseMatrix(hsMatrix44 *out) const int i, j; hsVector3 invK; - invK.Set(hsScalarInvert(fK.fX),hsScalarInvert(fK.fY),hsScalarInvert(fK.fZ)); + invK.Set(hsInvert(fK.fX),hsInvert(fK.fY),hsInvert(fK.fZ)); hsVector3 UK[3]; for( i = 0; i < 3; i++ ) { @@ -378,7 +378,7 @@ void hsAffineParts::ComposeInverseMatrix(hsMatrix44 *out) const hsVector3 Rt[3]; QuatTo3VectorsTranspose(fQ.Conjugate(), Rt); - hsScalar f = fF < 0 ? -1.f : 1.f; + float f = fF < 0 ? -1.f : 1.f; for( i = 0; i < 3; i++ ) { for( j = 0; j < 3; j++ ) diff --git a/Sources/Plasma/PubUtilLib/plTransform/hsEuler.cpp b/Sources/Plasma/PubUtilLib/plTransform/hsEuler.cpp index 054654ad..5ec7471d 100644 --- a/Sources/Plasma/PubUtilLib/plTransform/hsEuler.cpp +++ b/Sources/Plasma/PubUtilLib/plTransform/hsEuler.cpp @@ -46,6 +46,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com ////////////////////////////////////////////////////////////////////////// // #include // for FLT_EPSILON +#include #include "hsEuler.h" #include "hsQuat.h" #include "hsMatrix44.h" @@ -67,7 +68,7 @@ void hsEuler::GetQuat(hsQuat* qu) EulGetOrd(ea.fOrder,i,j,k,h,n,s,f); if (f==EulFrmR) { - hsScalar t = ea.fX; ea.fX = ea.fZ; ea.fZ = t; + float t = ea.fX; ea.fX = ea.fZ; ea.fZ = t; } if (n==EulParOdd) ea.fY = -ea.fY; @@ -108,7 +109,7 @@ void hsEuler::GetMatrix44(hsMatrix44* mat) EulGetOrd(ea.fOrder,i,j,k,h,n,s,f); if (f==EulFrmR) { - hsScalar t = ea.fX; ea.fX = ea.fZ; ea.fZ = t; + float t = ea.fX; ea.fX = ea.fZ; ea.fZ = t; } if (n==EulParOdd) { @@ -153,7 +154,7 @@ void hsEuler::GetMatrix44(hsMatrix44* mat) // // Convert matrix to Euler angles (in radians) // -void hsEuler::SetFromMatrix44(const hsMatrix44* mat, UInt32 order) +void hsEuler::SetFromMatrix44(const hsMatrix44* mat, uint32_t order) { int i,j,k,h,n,s,f; @@ -195,7 +196,7 @@ void hsEuler::SetFromMatrix44(const hsMatrix44* mat, UInt32 order) } if (f==EulFrmR) { - hsScalar t = fX; fX = fZ; fZ = t; + float t = fX; fX = fZ; fZ = t; } fOrder = order; } @@ -203,7 +204,7 @@ void hsEuler::SetFromMatrix44(const hsMatrix44* mat, UInt32 order) // // Convert quaternion to Euler angles (in radians) // -void hsEuler::SetFromQuat(const hsQuat* q, UInt32 order) +void hsEuler::SetFromQuat(const hsQuat* q, uint32_t order) { hsMatrix44 mat; double Nq = q->fX*q->fX+q->fY*q->fY+q->fZ*q->fZ+q->fW*q->fW; diff --git a/Sources/Plasma/PubUtilLib/plTransform/hsEuler.h b/Sources/Plasma/PubUtilLib/plTransform/hsEuler.h index cafa2ec4..64f34c5c 100644 --- a/Sources/Plasma/PubUtilLib/plTransform/hsEuler.h +++ b/Sources/Plasma/PubUtilLib/plTransform/hsEuler.h @@ -115,18 +115,18 @@ class hsQuat; class hsEuler { public: - hsScalar fX,fY,fZ; - UInt32 fOrder; + float fX,fY,fZ; + uint32_t fOrder; - hsEuler(hsScalar ai, hsScalar aj, hsScalar ah, UInt32 order) : fX(ai),fY(aj),fZ(ah),fOrder(order) {} + hsEuler(float ai, float aj, float ah, uint32_t order) : fX(ai),fY(aj),fZ(ah),fOrder(order) {} // getters, converters void GetQuat(hsQuat* res ); void GetMatrix44(hsMatrix44* M); // setters, converters - void SetFromMatrix44(const hsMatrix44* M, UInt32 order); - void SetFromQuat(const hsQuat* q, UInt32 order); + void SetFromMatrix44(const hsMatrix44* M, uint32_t order); + void SetFromQuat(const hsQuat* q, uint32_t order); }; #endif // HS_EULER_inc diff --git a/Sources/Plasma/PubUtilLib/plUnifiedTime/plClientUnifiedTime.cpp b/Sources/Plasma/PubUtilLib/plUnifiedTime/plClientUnifiedTime.cpp index 9610e861..1c1a90f0 100644 --- a/Sources/Plasma/PubUtilLib/plUnifiedTime/plClientUnifiedTime.cpp +++ b/Sources/Plasma/PubUtilLib/plUnifiedTime/plClientUnifiedTime.cpp @@ -70,11 +70,9 @@ void plClientUnifiedTime::SetSysTime() #pragma optimize( "g", off ) // disable global optimizations void plClientUnifiedTime::SetFromGameTime(double gameTime, double curGameSecs) { - hsDoublePrecBegin; //double gameTimeOff = curGameSecs-gameTime; // when did this happen relative to our currrent sysTime //*this = GetFrameStartTime() - plUnifiedTime(gameTimeOff); SetSecsDouble(gameTime - fSysTimeOffset); - hsDoublePrecEnd; #if 0 extern bool gMooseDump; @@ -96,11 +94,9 @@ void plClientUnifiedTime::SetFromGameTime(double gameTime, double curGameSecs) // void plClientUnifiedTime::ConvertToGameTime(double* gameTimeOut, double curGameSecs) { - hsDoublePrecBegin; //plUnifiedTime utOff = GetFrameStartTime() - GetAsUnifiedTime(); // compute offset relative to current startFrame time //*gameTimeOut = curGameSecs - utOff.GetSecsDouble(); *gameTimeOut = GetSecsDouble() + fSysTimeOffset; - hsDoublePrecEnd; #if 0 extern bool gMooseDump; diff --git a/Sources/Plasma/PubUtilLib/plUnifiedTime/plUnifiedTime.cpp b/Sources/Plasma/PubUtilLib/plUnifiedTime/plUnifiedTime.cpp index e1302d01..67074d12 100644 --- a/Sources/Plasma/PubUtilLib/plUnifiedTime/plUnifiedTime.cpp +++ b/Sources/Plasma/PubUtilLib/plUnifiedTime/plUnifiedTime.cpp @@ -42,7 +42,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include #include "plUnifiedTime.h" #include "hsStlUtils.h" -#include "hsWindows.h" + #if HS_BUILD_FOR_UNIX #include @@ -53,7 +53,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include // for timeb #endif -#include "hsUtils.h" + #include #include "hsStream.h" @@ -76,7 +76,7 @@ hsBool plUnifiedTime::SetFromWinFileTime(const FILETIME ft) if (ffsecs >= MAGICWINDOWSOFFSET) // make sure we won't end up negatice { fSecs = (time_t)(ffsecs-MAGICWINDOWSOFFSET); - fMicros = (UInt32)(ff % 10000000)/10; + fMicros = (uint32_t)(ff % 10000000)/10; return true; } else @@ -248,7 +248,7 @@ void plUnifiedTime::SetSecsDouble(double secs) double x,y; x = modf(secs,&y); fSecs = (time_t)y; - fMicros = (UInt32)(x*1000000); + fMicros = (uint32_t)(x*1000000); } @@ -370,9 +370,7 @@ int plUnifiedTime::GetMillis() const #pragma optimize( "g", off ) // disable global optimizations double plUnifiedTime::GetSecsDouble() const { - hsDoublePrecBegin double ret = GetSecs() + GetMicros() / 1000000.0; - hsDoublePrecEnd return ret; } #pragma optimize( "", on ) // restore optimizations to their defaults @@ -380,7 +378,7 @@ double plUnifiedTime::GetSecsDouble() const void plUnifiedTime::Read(hsStream* s) { s->LogSubStreamStart("UnifiedTime"); - UInt32 secs; + uint32_t secs; s->LogReadLE(&secs,"Seconds"); fSecs = (time_t)secs; s->LogReadLE(&fMicros,"MicroSeconds"); @@ -390,7 +388,7 @@ void plUnifiedTime::Read(hsStream* s) void plUnifiedTime::Write(hsStream* s) const { - s->WriteLE((UInt32)fSecs); + s->WriteLE((uint32_t)fSecs); s->WriteLE(fMicros); // preserve fMode } @@ -1004,9 +1002,9 @@ bool plUnifiedTime::FromString(const char * buf, const char * fmt) /// Local time zone offset stuff -Int32 plUnifiedTime::fLocalTimeZoneOffset = -1; +int32_t plUnifiedTime::fLocalTimeZoneOffset = -1; -Int32 plUnifiedTime::IGetLocalTimeZoneOffset( void ) +int32_t plUnifiedTime::IGetLocalTimeZoneOffset( void ) { static bool inited = false; @@ -1026,7 +1024,7 @@ Int32 plUnifiedTime::IGetLocalTimeZoneOffset( void ) double diffInSecs = difftime( utc, currLocalTime ); - fLocalTimeZoneOffset = (Int32)diffInSecs; + fLocalTimeZoneOffset = (int32_t)diffInSecs; } return fLocalTimeZoneOffset; diff --git a/Sources/Plasma/PubUtilLib/plUnifiedTime/plUnifiedTime.h b/Sources/Plasma/PubUtilLib/plUnifiedTime/plUnifiedTime.h index 47921406..6a8e25db 100644 --- a/Sources/Plasma/PubUtilLib/plUnifiedTime/plUnifiedTime.h +++ b/Sources/Plasma/PubUtilLib/plUnifiedTime/plUnifiedTime.h @@ -42,11 +42,11 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #ifndef _PL_UNIFIEDTIME_INC_ #define _PL_UNIFIEDTIME_INC_ -#include "hsTypes.h" +#include "HeadSpin.h" #include "hsStlUtils.h" #if HS_BUILD_FOR_WIN32 -#include "hsWindows.h" + #endif // @@ -76,14 +76,14 @@ public: protected: time_t fSecs; - UInt32 fMicros; + uint32_t fMicros; Mode fMode; - static Int32 fLocalTimeZoneOffset; + static int32_t fLocalTimeZoneOffset; struct tm * IGetTime(const time_t * timer) const; - static Int32 IGetLocalTimeZoneOffset( void ); + static int32_t IGetLocalTimeZoneOffset( void ); public: plUnifiedTime() : fSecs(0),fMicros(0), fMode(kGmt) { } // set ToEpoch() at start @@ -109,7 +109,7 @@ public: // getters time_t GetSecs() const { return fSecs; } - UInt32 GetMicros() const { return fMicros; } + uint32_t GetMicros() const { return fMicros; } double GetSecsDouble() const; // get the secs and micros as a double floating point value hsBool GetTime(short &year, short &month, short &day, short &hour, short &minute, short &second) const; struct tm * GetTm(struct tm * ptm=nil) const; @@ -126,7 +126,7 @@ public: // setters void SetSecs(const time_t secs) { fSecs = secs; } void SetSecsDouble(double secs); - void SetMicros(const UInt32 micros) { fMicros = micros; } + void SetMicros(const uint32_t micros) { fMicros = micros; } hsBool SetTime(short year, short month, short day, short hour, short minute, short second, unsigned long usec=0, int dst=-1); hsBool SetGMTime(short year, short month, short day, short hour, short minute, short second, unsigned long usec=0, int dst=-1); hsBool SetToUTC(); diff --git a/Sources/Plasma/PubUtilLib/plVault/plDniCoordinateInfo.cpp b/Sources/Plasma/PubUtilLib/plVault/plDniCoordinateInfo.cpp index 93628d3d..9ef49da2 100644 --- a/Sources/Plasma/PubUtilLib/plVault/plDniCoordinateInfo.cpp +++ b/Sources/Plasma/PubUtilLib/plVault/plDniCoordinateInfo.cpp @@ -52,7 +52,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #ifdef CLIENT /////////////////////////////////////////////////////////////////// -const UInt8 plDniCoordinateInfo::StreamVersion = 1; +const uint8_t plDniCoordinateInfo::StreamVersion = 1; plDniCoordinateInfo::plDniCoordinateInfo() @@ -73,7 +73,7 @@ void plDniCoordinateInfo::CopyFrom( const plDniCoordinateInfo * other ) void plDniCoordinateInfo::Read( hsStream* s, hsResMgr* mgr ) { - UInt8 streamVer; + uint8_t streamVer; s->ReadLE( &streamVer ); if ( streamVer==StreamVersion ) { diff --git a/Sources/Plasma/PubUtilLib/plVault/plDniCoordinateInfo.h b/Sources/Plasma/PubUtilLib/plVault/plDniCoordinateInfo.h index f67c1add..d67f7e32 100644 --- a/Sources/Plasma/PubUtilLib/plVault/plDniCoordinateInfo.h +++ b/Sources/Plasma/PubUtilLib/plVault/plDniCoordinateInfo.h @@ -42,7 +42,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #ifndef plDniCoordinateInfo_h_inc #define plDniCoordinateInfo_h_inc -#include "hsConfig.h" +#include "HeadSpin.h" #include "hsStlUtils.h" #include "pnFactory/plCreatable.h" @@ -54,7 +54,7 @@ class hsResMgr; class plDniCoordinateInfo : public plCreatable { - static const UInt8 StreamVersion; + static const uint8_t StreamVersion; protected: // spherical coords (rho,theta,phi) diff --git a/Sources/Plasma/PubUtilLib/plVault/plVaultClientApi.cpp b/Sources/Plasma/PubUtilLib/plVault/plVaultClientApi.cpp index a72647d1..9dcf9133 100644 --- a/Sources/Plasma/PubUtilLib/plVault/plVaultClientApi.cpp +++ b/Sources/Plasma/PubUtilLib/plVault/plVaultClientApi.cpp @@ -76,9 +76,9 @@ struct INotifyAfterDownload : THashKeyVal { struct DeviceInbox : CHashKeyStr { HASHLINK(DeviceInbox) link; - wchar inboxName[kMaxVaultNodeStringLength]; + wchar_t inboxName[kMaxVaultNodeStringLength]; - DeviceInbox (const wchar device[], const wchar inbox[]) + DeviceInbox (const wchar_t device[], const wchar_t inbox[]) : CHashKeyStr(device) { StrCopy(inboxName, inbox, arrsize(inboxName)); @@ -175,7 +175,7 @@ struct VaultDownloadTrans { FVaultProgressCallback progressCallback; void * cbProgressParam; - wchar tag[MAX_PATH]; + wchar_t tag[MAX_PATH]; unsigned nodeCount; unsigned nodesLeft; unsigned vaultId; @@ -308,14 +308,14 @@ static void VaultNodeAddedDownloadCallback(ENetError result, void * param) { } } - DEL(notify); + delete notify; } } //============================================================================ static void __cdecl LogDumpProc ( void * , - const wchar fmt[], + const wchar_t fmt[], ... ) { va_list args; @@ -796,7 +796,7 @@ void VaultCreateNodeTrans::Complete (ENetError result) { node ); - DEL(this); + delete this; } @@ -821,7 +821,7 @@ void VaultFindNodeTrans::VaultNodeFound ( nodeIdCount, nodeIds ); - DEL(trans); + delete trans; } @@ -870,7 +870,7 @@ void VaultDownloadTrans::VaultNodeFetched ( trans->cbParam ); - DEL(trans); + delete trans; } } @@ -921,7 +921,7 @@ void VaultDownloadTrans::VaultNodeRefsFetched ( trans->cbParam ); - DEL(trans); + delete trans; } } @@ -950,7 +950,7 @@ void VaultAgeInitTrans::AgeInitCallback ( ageInfoVaultId ); - DEL(trans); + delete trans; } @@ -992,7 +992,7 @@ void AddChildNodeFetchTrans::VaultNodeRefsFetched ( trans->result, trans->cbParam ); - DEL(trans); + delete trans; } } @@ -1016,7 +1016,7 @@ void AddChildNodeFetchTrans::VaultNodeFetched ( trans->result, trans->cbParam ); - DEL(trans); + delete trans; } } @@ -1072,14 +1072,14 @@ void IRelVaultNode::Unlink (RelVaultNode * other) { link->link.Unlink(); // remove us from other's tables. link->node->state->Unlink(node); - DEL(link); + delete link; } if (nil != (link = children.Find(other->nodeId))) { // make them non-findable in our children table link->link.Unlink(); // remove us from other's tables. link->node->state->Unlink(node); - DEL(link); + delete link; } } @@ -1096,7 +1096,7 @@ RelVaultNode::RelVaultNode () { //============================================================================ RelVaultNode::~RelVaultNode () { - DEL(state); + delete state; } //============================================================================ @@ -1393,8 +1393,8 @@ void RelVaultNode::SetSeen (unsigned parentId, bool seen) { } //============================================================================ -void RelVaultNode::Print (const wchar tag[], FStateDump dumpProc, unsigned level) { - wchar str[1024]; +void RelVaultNode::Print (const wchar_t tag[], FStateDump dumpProc, unsigned level) { + wchar_t str[1024]; StrPrintf( str, arrsize(str), @@ -1409,7 +1409,7 @@ void RelVaultNode::Print (const wchar tag[], FStateDump dumpProc, unsigned level ); NetVaultNodeFieldArray fields(this); - for (qword bit = 1; bit; bit <<= 1) { + for (uint64_t bit = 1; bit; bit <<= 1) { if (!(fieldFlags & bit)) continue; if (bit > fieldFlags) @@ -1465,7 +1465,7 @@ RelVaultNode * RelVaultNode::GetParentAgeLinkIncRef () { //============================================================================ void VaultRegisterCallback (VaultCallback * cb) { - IVaultCallback * internal = NEW(IVaultCallback); + IVaultCallback * internal = new IVaultCallback; internal->cb = cb; cb->internal = internal; s_callbacks.Link(internal); @@ -1474,7 +1474,7 @@ void VaultRegisterCallback (VaultCallback * cb) { //============================================================================ void VaultUnregisterCallback (VaultCallback * cb) { ASSERT(cb->internal); - DEL(cb->internal); + delete cb->internal; cb->internal = nil; } @@ -1510,7 +1510,7 @@ void VaultDestroy () { for (; link; link = next) { next = s_nodes.Next(link); link->node->state->UnlinkFromRelatives(); - DEL(link); + delete link; } } @@ -1733,7 +1733,7 @@ void VaultAddChildNodeAndWait ( using namespace _VaultAddChildNodeAndWait; _AddChildNodeParam param; - ZERO(param); + memset(¶m, 0, sizeof(param)); VaultAddChildNode( parentId, @@ -1809,7 +1809,7 @@ void VaultDeleteNode ( //============================================================================ void VaultPublishNode ( unsigned nodeId, - const wchar deviceName[] + const wchar_t deviceName[] ) { RelVaultNode * rvn; @@ -1916,7 +1916,7 @@ RelVaultNode * VaultCreateNodeAndWaitIncRef ( using namespace _VaultCreateNodeAndWaitIncRef; _CreateNodeParam param; - ZERO(param); + memset(¶m, 0, sizeof(param)); VaultCreateNode( templateNode, @@ -1977,7 +1977,7 @@ void VaultForceSaveNodeAndWait ( using namespace _VaultForceSaveNodeAndWait; _SaveNodeParam param; - ZERO(param); + memset(¶m, 0, sizeof(param)); NetCliAuthVaultNodeSave( node, @@ -2037,7 +2037,7 @@ void VaultFindNodesAndWait ( using namespace _VaultFindNodesAndWait; _FindNodeParam param; - ZERO(param); + memset(¶m, 0, sizeof(param)); NetCliAuthVaultNodeFind( templateNode, @@ -2125,10 +2125,10 @@ void VaultInitAge ( trans->cbState = state; trans->cbParam = param; - wchar ageFilename[MAX_PATH]; - wchar ageInstName[MAX_PATH]; - wchar ageUserName[MAX_PATH]; - wchar ageDesc[1024]; + wchar_t ageFilename[MAX_PATH]; + wchar_t ageInstName[MAX_PATH]; + wchar_t ageUserName[MAX_PATH]; + wchar_t ageDesc[1024]; StrToUnicode(ageFilename, info->GetAgeFilename(), arrsize(ageFilename)); StrToUnicode(ageInstName, info->GetAgeInstanceName(), arrsize(ageInstName)); @@ -2259,7 +2259,7 @@ bool VaultGetLinkToMyNeighborhood (plAgeLinkStruct * link) { templateNode->SetNodeType(plVault::kNodeType_AgeInfo); VaultAgeInfoNode ageInfo(templateNode); - wchar str[MAX_PATH]; + wchar_t str[MAX_PATH]; StrToUnicode(str, kNeighborhoodAgeFilename, arrsize(str)); ageInfo.SetAgeFilename(str); @@ -2286,7 +2286,7 @@ bool VaultGetLinkToMyPersonalAge (plAgeLinkStruct * link) { templateNode->SetNodeType(plVault::kNodeType_AgeInfo); VaultAgeInfoNode ageInfo(templateNode); - wchar str[MAX_PATH]; + wchar_t str[MAX_PATH]; StrToUnicode(str, kPersonalAgeFilename, arrsize(str)); ageInfo.SetAgeFilename(str); @@ -2313,7 +2313,7 @@ bool VaultGetLinkToCity (plAgeLinkStruct * link) { templateNode->SetNodeType(plVault::kNodeType_AgeInfo); VaultAgeInfoNode ageInfo(templateNode); - wchar str[MAX_PATH]; + wchar_t str[MAX_PATH]; StrToUnicode(str, kCityAgeFilename, arrsize(str)); ageInfo.SetAgeFilename(str); @@ -2342,7 +2342,7 @@ RelVaultNode * VaultGetOwnedAgeLinkIncRef (const plAgeInfoStruct * info) { VaultAgeInfoNode ageInfo(templateNode); if (info->HasAgeFilename()) { - wchar str[MAX_PATH]; + wchar_t str[MAX_PATH]; StrToUnicode(str, info->GetAgeFilename(), arrsize(str)); ageInfo.SetAgeFilename(str); } @@ -2377,7 +2377,7 @@ RelVaultNode * VaultGetOwnedAgeInfoIncRef (const plAgeInfoStruct * info) { VaultAgeInfoNode ageInfo(templateNode); if (info->HasAgeFilename()) { - wchar str[MAX_PATH]; + wchar_t str[MAX_PATH]; StrToUnicode(str, info->GetAgeFilename(), arrsize(str)); ageInfo.SetAgeFilename(str); } @@ -2412,7 +2412,7 @@ bool VaultGetOwnedAgeLink (const plAgeInfoStruct * info, plAgeLinkStruct * link) } //============================================================================ -bool VaultFindOrCreateChildAgeLinkAndWait (const wchar ownedAgeName[], const plAgeInfoStruct * info, plAgeLinkStruct * link) { +bool VaultFindOrCreateChildAgeLinkAndWait (const wchar_t ownedAgeName[], const plAgeInfoStruct * info, plAgeLinkStruct * link) { hsAssert(false, "eric, implement me"); return false; } @@ -2510,7 +2510,7 @@ RelVaultNode * VaultGetVisitAgeLinkIncRef (const plAgeInfoStruct * info) { VaultAgeInfoNode ageInfo(templateNode); if (info->HasAgeFilename()) { - wchar str[MAX_PATH]; + wchar_t str[MAX_PATH]; StrToUnicode(str, info->GetAgeFilename(), arrsize(str)); ageInfo.SetAgeFilename(str); } @@ -2638,7 +2638,7 @@ bool VaultRegisterOwnedAgeAndWait (const plAgeLinkStruct * link) { { // Init age vault _InitAgeParam param; - ZERO(param); + memset(¶m, 0, sizeof(param)); VaultInitAge( link->GetAgeInfo(), @@ -2664,7 +2664,7 @@ bool VaultRegisterOwnedAgeAndWait (const plAgeLinkStruct * link) { { // Create age link _CreateNodeParam param; - ZERO(param); + memset(¶m, 0, sizeof(param)); VaultCreateNode( plVault::kNodeType_AgeLink, @@ -2689,7 +2689,7 @@ bool VaultRegisterOwnedAgeAndWait (const plAgeLinkStruct * link) { { // Fetch age info node tree _FetchVaultParam param; - ZERO(param); + memset(¶m, 0, sizeof(param)); VaultDownload( L"RegisterOwnedAge", @@ -2719,9 +2719,9 @@ bool VaultRegisterOwnedAgeAndWait (const plAgeLinkStruct * link) { _AddChildNodeParam param1; _AddChildNodeParam param2; _AddChildNodeParam param3; - ZERO(param1); - ZERO(param2); - ZERO(param3); + memset(¶m1, 0, sizeof(param1)); + memset(¶m2, 0, sizeof(param2)); + memset(¶m3, 0, sizeof(param3)); unsigned ageOwnersId = 0; if (RelVaultNode * rvnAgeInfo = VaultGetNodeIncRef(ageInfoId)) { @@ -2809,7 +2809,7 @@ namespace _VaultRegisterOwnedAge { void* fAgeInfoId; ~_Params() { - DEL(fSpawn); + delete fSpawn; } }; @@ -2831,7 +2831,7 @@ namespace _VaultRegisterOwnedAge { void _CreateAgeLinkNode(ENetError result, void* state, void* param, RelVaultNode* node) { if (IS_NET_ERROR(result)) { LogMsg(kLogError, "VaultRegisterOwnedAge: Failed to create AgeLink (async)"); - DEL(param); + delete param; return; } @@ -2846,10 +2846,10 @@ namespace _VaultRegisterOwnedAge { RelVaultNode* agesIOwn = VaultGetAgesIOwnFolderIncRef(); RelVaultNode* plyrInfo = VaultGetPlayerInfoNodeIncRef(); VaultAddChildNode(agesIOwn->nodeId, node->nodeId, 0, (FVaultAddChildNodeCallback)_AddAgeLinkNode, nil); - VaultAddChildNode(node->nodeId, (UInt32)p->fAgeInfoId, 0, (FVaultAddChildNodeCallback)_AddAgeInfoNode, nil); + VaultAddChildNode(node->nodeId, (uint32_t)p->fAgeInfoId, 0, (FVaultAddChildNodeCallback)_AddAgeInfoNode, nil); // Add our PlayerInfo to important places - if (RelVaultNode* rvnAgeInfo = VaultGetNodeIncRef((UInt32)p->fAgeInfoId)) { + if (RelVaultNode* rvnAgeInfo = VaultGetNodeIncRef((uint32_t)p->fAgeInfoId)) { if (RelVaultNode* rvnAgeOwners = rvnAgeInfo->GetChildPlayerInfoListNodeIncRef(plVault::kAgeOwnersFolder, 1)) { VaultAddChildNode(rvnAgeOwners->nodeId, plyrInfo->nodeId, 0, (FVaultAddChildNodeCallback)_AddPlayerInfoNode, nil); rvnAgeOwners->DecRef(); @@ -2868,20 +2868,20 @@ namespace _VaultRegisterOwnedAge { // Don't leak memory agesIOwn->DecRef(); plyrInfo->DecRef(); - DEL(p); + delete p; } void _DownloadCallback(ENetError result, void* param) { if (IS_NET_ERROR(result)) { LogMsg(kLogError, "VaultRegisterOwnedAge: Failed to download age vault (async)"); - DEL(param); + delete param; } else VaultCreateNode(plVault::kNodeType_AgeLink, (FVaultCreateNodeCallback)_CreateAgeLinkNode, nil, param); } - void _InitAgeCallback(ENetError result, void* state, void* param, UInt32 ageVaultId, UInt32 ageInfoVaultId) { + void _InitAgeCallback(ENetError result, void* state, void* param, uint32_t ageVaultId, uint32_t ageInfoVaultId) { if (IS_NET_SUCCESS(result)) { - _Params* p = TRACKED_NEW _Params(); + _Params* p = new _Params(); p->fAgeInfoId = (void*)ageInfoVaultId; p->fSpawn = (plSpawnPointInfo*)param; @@ -2916,7 +2916,7 @@ void VaultRegisterOwnedAge(const plAgeLinkStruct* link) { kNilGuid, (FVaultInitAgeCallback)_InitAgeCallback, nil, - TRACKED_NEW plSpawnPointInfo(link->SpawnPoint())); + new plSpawnPointInfo(link->SpawnPoint())); } //============================================================================ @@ -3012,7 +3012,7 @@ bool VaultRegisterVisitAgeAndWait (const plAgeLinkStruct * link) { { // Init age vault _InitAgeParam param; - ZERO(param); + memset(¶m, 0, sizeof(param)); VaultInitAge( link->GetAgeInfo(), @@ -3038,7 +3038,7 @@ bool VaultRegisterVisitAgeAndWait (const plAgeLinkStruct * link) { { // Create age link _CreateNodeParam param; - ZERO(param); + memset(¶m, 0, sizeof(param)); VaultCreateNode( plVault::kNodeType_AgeLink, @@ -3063,7 +3063,7 @@ bool VaultRegisterVisitAgeAndWait (const plAgeLinkStruct * link) { { // Fetch age info node tree _FetchVaultParam param; - ZERO(param); + memset(¶m, 0, sizeof(param)); VaultDownload( L"RegisterVisitAge", @@ -3092,9 +3092,9 @@ bool VaultRegisterVisitAgeAndWait (const plAgeLinkStruct * link) { _AddChildNodeParam param1; _AddChildNodeParam param2; _AddChildNodeParam param3; - ZERO(param1); - ZERO(param2); - ZERO(param3); + memset(¶m1, 0, sizeof(param1)); + memset(¶m2, 0, sizeof(param2)); + memset(¶m3, 0, sizeof(param3)); unsigned ageVisitorsId = 0; if (RelVaultNode * rvnAgeInfo = VaultGetNodeIncRef(ageInfoId)) { @@ -3183,19 +3183,19 @@ namespace _VaultRegisterVisitAge { void* fAgeInfoId; ~_Params() { - DEL(fSpawn); + delete fSpawn; } }; void _CreateAgeLinkNode(ENetError result, void* state, void* param, RelVaultNode* node) { if (IS_NET_ERROR(result)) { LogMsg(kLogError, "RegisterVisitAge: Failed to create AgeLink (async)"); - DEL(param); + delete param; return; } _Params* p = (_Params*)param; - RelVaultNode* ageInfo = VaultGetNodeIncRef((UInt32)p->fAgeInfoId); + RelVaultNode* ageInfo = VaultGetNodeIncRef((uint32_t)p->fAgeInfoId); // Add ourselves to the Can Visit folder of the age if (RelVaultNode * playerInfo = VaultGetPlayerInfoNodeIncRef()) { @@ -3225,13 +3225,13 @@ namespace _VaultRegisterVisitAge { msg->Send(); //Don't leak memory - DEL(param); + delete param; } void _DownloadCallback(ENetError result, void* param) { if (IS_NET_ERROR(result)) { LogMsg(kLogError, "RegisterVisitAge: Failed to download age vault (async)"); - DEL(param); + delete param; return; } @@ -3239,10 +3239,10 @@ namespace _VaultRegisterVisitAge { VaultCreateNode(plVault::kNodeType_AgeLink, (FVaultCreateNodeCallback)_CreateAgeLinkNode, nil, param); } - void _InitAgeCallback(ENetError result, void* state, void* param, UInt32 ageVaultId, UInt32 ageInfoId) { + void _InitAgeCallback(ENetError result, void* state, void* param, uint32_t ageVaultId, uint32_t ageInfoId) { if (IS_NET_ERROR(result)) { LogMsg(kLogError, "RegisterVisitAge: Failed to init age vault (async)"); - DEL(param); + delete param; return; } @@ -3269,8 +3269,8 @@ void VaultRegisterVisitAge(const plAgeLinkStruct* link) { return; // Still here? We need to actually do some work, then. - _Params* p = TRACKED_NEW _Params; - p->fSpawn = TRACKED_NEW plSpawnPointInfo(link->SpawnPoint()); + _Params* p = new _Params; + p->fSpawn = new plSpawnPointInfo(link->SpawnPoint()); // This doesn't actually *create* a new age but rather fetches the // already existing age vault. Weird? Yes... @@ -3411,7 +3411,7 @@ bool VaultUnregisterVisitAgeAndWait (const plAgeInfoStruct * info) { } //============================================================================ -RelVaultNode * VaultFindChronicleEntryIncRef (const wchar entryName[], int entryType) { +RelVaultNode * VaultFindChronicleEntryIncRef (const wchar_t entryName[], int entryType) { RelVaultNode * result = nil; if (RelVaultNode * rvnFldr = GetChildFolderNode(GetPlayerNode(), plVault::kChronicleFolder, 1)) { @@ -3430,7 +3430,7 @@ RelVaultNode * VaultFindChronicleEntryIncRef (const wchar entryName[], int entry } //============================================================================ -bool VaultHasChronicleEntry (const wchar entryName[], int entryType) { +bool VaultHasChronicleEntry (const wchar_t entryName[], int entryType) { if (RelVaultNode * rvn = VaultFindChronicleEntryIncRef(entryName, entryType)) { rvn->DecRef(); return true; @@ -3440,9 +3440,9 @@ bool VaultHasChronicleEntry (const wchar entryName[], int entryType) { //============================================================================ void VaultAddChronicleEntryAndWait ( - const wchar entryName[], + const wchar_t entryName[], int entryType, - const wchar entryValue[] + const wchar_t entryValue[] ) { if (RelVaultNode * rvnChrn = VaultFindChronicleEntryIncRef(entryName, entryType)) { VaultChronicleNode chrnNode(rvnChrn); @@ -3523,7 +3523,7 @@ bool VaultSetCCRStatus (bool online) { } //============================================================================ -void VaultDump (const wchar tag[], unsigned vaultId, FStateDump dumpProc) { +void VaultDump (const wchar_t tag[], unsigned vaultId, FStateDump dumpProc) { LogMsg(kLogDebug, L"<---- ID:%u, Begin Vault%*s%s ---->", vaultId, tag ? 1 : 0, L" ", tag); if (RelVaultNode * rvn = GetNode(vaultId)) @@ -3533,7 +3533,7 @@ void VaultDump (const wchar tag[], unsigned vaultId, FStateDump dumpProc) { } //============================================================================ -void VaultDump (const wchar tag[], unsigned vaultId) { +void VaultDump (const wchar_t tag[], unsigned vaultId) { VaultDump (tag, vaultId, LogDumpProc); } @@ -3607,7 +3607,7 @@ bool VaultAmOwnerOfCurrentAge () { plAgeInfoStruct info; info.SetAgeFilename(ageFilename); - FREE(ageFilename); + free(ageFilename); if (RelVaultNode * rvnLink = VaultGetOwnedAgeLinkIncRef(&info)) { @@ -3649,8 +3649,8 @@ bool VaultAmCzarOfAge (const Uuid & ageInstId) { //============================================================================ bool VaultRegisterMTStationAndWait ( - const wchar stationName[], - const wchar linkBackSpawnPtObjName[] + const wchar_t stationName[], + const wchar_t linkBackSpawnPtObjName[] ) { plAgeInfoStruct info; info.SetAgeFilename(kCityAgeFilename); @@ -3901,7 +3901,7 @@ RelVaultNode * VaultFindAgeSubAgeLinkIncRef (const plAgeInfoStruct * info) { templateNode->SetNodeType(plVault::kNodeType_AgeInfo); VaultAgeInfoNode ageInfo(templateNode); - wchar str[MAX_PATH]; + wchar_t str[MAX_PATH]; StrToUnicode(str, info->GetAgeFilename(), arrsize(str)); ageInfo.SetAgeFilename(str); @@ -3920,22 +3920,22 @@ RelVaultNode * VaultFindAgeSubAgeLinkIncRef (const plAgeInfoStruct * info) { } //============================================================================ -RelVaultNode * VaultFindAgeChronicleEntryIncRef (const wchar entryName[], int entryType) { +RelVaultNode * VaultFindAgeChronicleEntryIncRef (const wchar_t entryName[], int entryType) { hsAssert(false, "eric, implement me"); return nil; } //============================================================================ void VaultAddAgeChronicleEntry ( - const wchar entryName[], + const wchar_t entryName[], int entryType, - const wchar entryValue[] + const wchar_t entryValue[] ) { hsAssert(false, "eric, implement me"); } //============================================================================ -RelVaultNode * VaultAgeAddDeviceAndWaitIncRef (const wchar deviceName[]) { +RelVaultNode * VaultAgeAddDeviceAndWaitIncRef (const wchar_t deviceName[]) { if (RelVaultNode * existing = VaultAgeGetDeviceIncRef(deviceName)) return existing; @@ -3967,7 +3967,7 @@ RelVaultNode * VaultAgeAddDeviceAndWaitIncRef (const wchar deviceName[]) { } //============================================================================ -void VaultAgeRemoveDevice (const wchar deviceName[]) { +void VaultAgeRemoveDevice (const wchar_t deviceName[]) { if (RelVaultNode * folder = VaultGetAgeDevicesFolderIncRef()) { NetVaultNode * templateNode = NEWZERO(NetVaultNode); templateNode->IncRef(); @@ -3979,7 +3979,7 @@ void VaultAgeRemoveDevice (const wchar deviceName[]) { device->DecRef(); if (DeviceInbox * deviceInbox = s_ageDeviceInboxes.Find(CHashKeyStr(deviceName))) - DEL(device); + delete device; } templateNode->DecRef(); folder->DecRef(); @@ -3987,7 +3987,7 @@ void VaultAgeRemoveDevice (const wchar deviceName[]) { } //============================================================================ -bool VaultAgeHasDevice (const wchar deviceName[]) { +bool VaultAgeHasDevice (const wchar_t deviceName[]) { bool found = false; if (RelVaultNode * folder = VaultGetAgeDevicesFolderIncRef()) { NetVaultNode * templateNode = NEWZERO(NetVaultNode); @@ -4006,7 +4006,7 @@ bool VaultAgeHasDevice (const wchar deviceName[]) { } //============================================================================ -RelVaultNode * VaultAgeGetDeviceIncRef (const wchar deviceName[]) { +RelVaultNode * VaultAgeGetDeviceIncRef (const wchar_t deviceName[]) { RelVaultNode * result = nil; if (RelVaultNode * folder = VaultGetAgeDevicesFolderIncRef()) { NetVaultNode * templateNode = NEWZERO(NetVaultNode); @@ -4023,7 +4023,7 @@ RelVaultNode * VaultAgeGetDeviceIncRef (const wchar deviceName[]) { } //============================================================================ -RelVaultNode * VaultAgeSetDeviceInboxAndWaitIncRef (const wchar deviceName[], const wchar inboxName[]) { +RelVaultNode * VaultAgeSetDeviceInboxAndWaitIncRef (const wchar_t deviceName[], const wchar_t inboxName[]) { DeviceInbox * devInbox = s_ageDeviceInboxes.Find(CHashKeyStr(deviceName)); if (devInbox) { StrCopy(devInbox->inboxName, inboxName, arrsize(devInbox->inboxName)); @@ -4064,14 +4064,14 @@ RelVaultNode * VaultAgeSetDeviceInboxAndWaitIncRef (const wchar deviceName[], co } //============================================================================ -RelVaultNode * VaultAgeGetDeviceInboxIncRef (const wchar deviceName[]) { +RelVaultNode * VaultAgeGetDeviceInboxIncRef (const wchar_t deviceName[]) { RelVaultNode * result = nil; DeviceInbox * devInbox = s_ageDeviceInboxes.Find(CHashKeyStr(deviceName)); if (devInbox) { RelVaultNode * parentNode = nil; - const wchar * inboxName = nil; + const wchar_t * inboxName = nil; if (StrCmp(devInbox->inboxName, DEFAULT_DEVICE_INBOX) == 0) { parentNode = VaultAgeGetDeviceIncRef(deviceName); @@ -4098,7 +4098,7 @@ RelVaultNode * VaultAgeGetDeviceInboxIncRef (const wchar deviceName[]) { //============================================================================ void VaultClearDeviceInboxMap () { while (DeviceInbox * inbox = s_ageDeviceInboxes.Head()) { - DEL(inbox); + delete inbox; } } @@ -4150,7 +4150,7 @@ RelVaultNode * VaultGetSubAgeLinkIncRef (const plAgeInfoStruct * info) { templateNode->SetNodeType(plVault::kNodeType_AgeInfo); VaultAgeInfoNode ageInfo(templateNode); - wchar str[MAX_PATH]; + wchar_t str[MAX_PATH]; StrToUnicode(str, info->GetAgeFilename(), arrsize(str)); ageInfo.SetAgeFilename(str); @@ -4284,7 +4284,7 @@ bool VaultAgeFindOrCreateSubAgeLinkAndWait ( { // Init age vault _InitAgeParam param; - ZERO(param); + memset(¶m, 0, sizeof(param)); VaultInitAge( info, @@ -4310,7 +4310,7 @@ bool VaultAgeFindOrCreateSubAgeLinkAndWait ( { // Create age link _CreateNodeParam param; - ZERO(param); + memset(¶m, 0, sizeof(param)); VaultCreateNode( plVault::kNodeType_AgeLink, @@ -4335,7 +4335,7 @@ bool VaultAgeFindOrCreateSubAgeLinkAndWait ( { // Fetch age info node tree _FetchVaultParam param; - ZERO(param); + memset(¶m, 0, sizeof(param)); VaultDownload( L"CreateSubAge", @@ -4363,8 +4363,8 @@ bool VaultAgeFindOrCreateSubAgeLinkAndWait ( // ageInfo to ageLink _AddChildNodeParam param1; _AddChildNodeParam param2; - ZERO(param1); - ZERO(param2); + memset(¶m1, 0, sizeof(param1)); + memset(¶m2, 0, sizeof(param2)); VaultAddChildNode( subAgesId, @@ -4422,7 +4422,7 @@ namespace _VaultCreateSubAge { } // Add the children to the right places - VaultAddChildNode(node->nodeId, (UInt32)param, 0, nil, nil); + VaultAddChildNode(node->nodeId, (uint32_t)param, 0, nil, nil); if (RelVaultNode* saFldr = VaultGetAgeSubAgesFolderIncRef()) { VaultAddChildNode(saFldr->nodeId, node->nodeId, 0, nil, nil); saFldr->DecRef(); @@ -4451,7 +4451,7 @@ namespace _VaultCreateSubAge { ); } - void _InitAgeCallback(ENetError result, void* state, void* param, UInt32 ageVaultId, UInt32 ageInfoId) { + void _InitAgeCallback(ENetError result, void* state, void* param, uint32_t ageVaultId, uint32_t ageInfoId) { if (IS_NET_ERROR(result)) { LogMsg(kLogError, "CreateSubAge: Failed to init age (async)"); return; @@ -4562,7 +4562,7 @@ static void _AddChildNodeCallback ( //============================================================================ bool VaultAgeFindOrCreateChildAgeLinkAndWait ( - const wchar parentAgeName[], + const wchar_t parentAgeName[], const plAgeInfoStruct * info, plAgeLinkStruct * link ) { @@ -4611,7 +4611,7 @@ bool VaultAgeFindOrCreateChildAgeLinkAndWait ( templateNode->SetNodeType(plVault::kNodeType_AgeInfo); VaultAgeInfoNode ageInfo(templateNode); - wchar str[MAX_PATH]; + wchar_t str[MAX_PATH]; StrToUnicode(str, info->GetAgeFilename(), arrsize(str)); ageInfo.SetAgeFilename(str); @@ -4635,10 +4635,10 @@ bool VaultAgeFindOrCreateChildAgeLinkAndWait ( { // Init age vault _InitAgeParam param; - ZERO(param); + memset(¶m, 0, sizeof(param)); Uuid parentAgeInstId; - ZERO(parentAgeInstId); + memset(&parentAgeInstId, 0, sizeof(parentAgeInstId)); if (RelVaultNode * rvnAge = VaultGetAgeNodeIncRef()) { VaultAgeNode access(rvnAge); parentAgeInstId = access.ageInstUuid; @@ -4669,7 +4669,7 @@ bool VaultAgeFindOrCreateChildAgeLinkAndWait ( { // Create age link _CreateNodeParam param; - ZERO(param); + memset(¶m, 0, sizeof(param)); VaultCreateNode( plVault::kNodeType_AgeLink, @@ -4694,7 +4694,7 @@ bool VaultAgeFindOrCreateChildAgeLinkAndWait ( { // Fetch age info node tree _FetchVaultParam param; - ZERO(param); + memset(¶m, 0, sizeof(param)); VaultDownload( L"CreateChildAge", @@ -4722,8 +4722,8 @@ bool VaultAgeFindOrCreateChildAgeLinkAndWait ( // ageInfo to ageLink _AddChildNodeParam param1; _AddChildNodeParam param2; - ZERO(param1); - ZERO(param2); + memset(¶m1, 0, sizeof(param1)); + memset(¶m2, 0, sizeof(param2)); VaultAddChildNode( childAgesId, @@ -4782,15 +4782,15 @@ namespace _VaultCreateChildAge { void _CreateNodeCallback(ENetError result, void* state, void* param, RelVaultNode* node) { if (IS_NET_ERROR(result)) { LogMsg(kLogError, "CreateChildAge: Failed to create AgeLink (async)"); - DEL(param); + delete param; return; } _Params* p = (_Params*)param; // Add the children to the right places - VaultAddChildNode(node->nodeId, (UInt32)p->fAgeInfoId, 0, nil, nil); - VaultAddChildNode((UInt32)p->fChildAgesFldr, node->nodeId, 0, nil, nil); + VaultAddChildNode(node->nodeId, (uint32_t)p->fAgeInfoId, 0, nil, nil); + VaultAddChildNode((uint32_t)p->fChildAgesFldr, node->nodeId, 0, nil, nil); // Send the VaultNotify that the plNetLinkingMgr wants... plVaultNotifyMsg * msg = NEWZERO(plVaultNotifyMsg); @@ -4799,13 +4799,13 @@ namespace _VaultCreateChildAge { msg->GetArgs()->AddInt(plNetCommon::VaultTaskArgs::kAgeLinkNode, node->nodeId); msg->Send(); - DEL(param); + delete param; } void _DownloadCallback(ENetError result, void* param) { if (IS_NET_ERROR(result)) { LogMsg(kLogError, "CreateChildAge: Failed to download age vault (async)"); - DEL(param); + delete param; return; } @@ -4817,10 +4817,10 @@ namespace _VaultCreateChildAge { ); } - void _InitAgeCallback(ENetError result, void* state, void* param, UInt32 ageVaultId, UInt32 ageInfoId) { + void _InitAgeCallback(ENetError result, void* state, void* param, uint32_t ageVaultId, uint32_t ageInfoId) { if (IS_NET_ERROR(result)) { LogMsg(kLogError, "CreateChildAge: Failed to init age (async)"); - DEL(param); + delete param; return; } @@ -4838,8 +4838,8 @@ namespace _VaultCreateChildAge { } }; // namespace _VaultCreateAge -UInt8 VaultAgeFindOrCreateChildAgeLink( - const wchar parentAgeName[], +uint8_t VaultAgeFindOrCreateChildAgeLink( + const wchar_t parentAgeName[], const plAgeInfoStruct* info, plAgeLinkStruct* link) { @@ -4865,10 +4865,10 @@ UInt8 VaultAgeFindOrCreateChildAgeLink( } // Still here? Try to find the Child Ages folder - UInt8 retval = hsFail; + uint8_t retval = hsFail; if (RelVaultNode* rvnChildAges = rvnParentInfo->GetChildAgeInfoListNodeIncRef(plVault::kChildAgesFolder, 1)) { const char* ageName = info->GetAgeFilename(); - wchar hack[MAX_PATH]; + wchar_t hack[MAX_PATH]; StrToUnicode(hack, ageName, arrsize(hack)); // Search for our age @@ -4890,7 +4890,7 @@ UInt8 VaultAgeFindOrCreateChildAgeLink( retval = TRUE; } else { - _Params* p = TRACKED_NEW _Params; + _Params* p = new _Params; p->fChildAgesFldr = (void*)rvnChildAges->nodeId; VaultAgeInfoNode accParentInfo(rvnParentInfo); @@ -4932,7 +4932,7 @@ void VaultCCRDumpPlayers() { //============================================================================ void VaultDownload ( - const wchar tag[], + const wchar_t tag[], unsigned vaultId, FVaultDownloadCallback callback, void * cbParam, @@ -4969,13 +4969,13 @@ static void _DownloadVaultCallback ( } void VaultDownloadAndWait ( - const wchar tag[], + const wchar_t tag[], unsigned vaultId, FVaultProgressCallback progressCallback, void * cbProgressParam ) { _DownloadVaultParam param; - ZERO(param); + memset(¶m, 0, sizeof(param)); VaultDownload( tag, @@ -4999,7 +4999,7 @@ void VaultCull (unsigned vaultId) { if (RelVaultNodeLink * link = s_nodes.Find(vaultId)) { LogMsg(kLogDebug, L"Vault: Culling node %u", link->node->nodeId); link->node->state->UnlinkFromRelatives(); - DEL(link); + delete link; } // Remove all orphaned nodes from the global table @@ -5022,7 +5022,7 @@ void VaultCull (unsigned vaultId) { if (!foundRoot) { LogMsg(kLogDebug, L"Vault: Culling node %u", link->node->nodeId); link->node->state->UnlinkFromRelatives(); - DEL(link); + delete link; } } } diff --git a/Sources/Plasma/PubUtilLib/plVault/plVaultClientApi.h b/Sources/Plasma/PubUtilLib/plVault/plVaultClientApi.h index 21ee40c0..13e0df9e 100644 --- a/Sources/Plasma/PubUtilLib/plVault/plVaultClientApi.h +++ b/Sources/Plasma/PubUtilLib/plVault/plVaultClientApi.h @@ -178,7 +178,7 @@ struct RelVaultNode : NetVaultNode { void SetSeen (unsigned parentId, bool seen); // logging - void Print (const wchar tag[], FStateDump dumpProc, unsigned level); + void Print (const wchar_t tag[], FStateDump dumpProc, unsigned level); void PrintTree (FStateDump dumpProc, unsigned level); // AgeInfoNode-specific (and it checks!) @@ -246,7 +246,7 @@ void VaultDeleteNode ( ); void VaultPublishNode ( unsigned nodeId, - const wchar deviceName[] + const wchar_t deviceName[] ); void VaultSendNode ( RelVaultNode* srcNode, @@ -353,20 +353,20 @@ bool VaultRegisterVisitAgeAndWait (const plAgeLinkStruct * link); void VaultRegisterVisitAge (const plAgeLinkStruct* link); bool VaultUnregisterOwnedAgeAndWait (const plAgeInfoStruct * info); bool VaultUnregisterVisitAgeAndWait (const plAgeInfoStruct * info); -RelVaultNode * VaultFindChronicleEntryIncRef (const wchar entryName[], int entryType = -1); -bool VaultHasChronicleEntry (const wchar entryName[], int entryType = -1); +RelVaultNode * VaultFindChronicleEntryIncRef (const wchar_t entryName[], int entryType = -1); +bool VaultHasChronicleEntry (const wchar_t entryName[], int entryType = -1); // if entry of same name and type already exists, value is updated void VaultAddChronicleEntryAndWait ( - const wchar entryName[], + const wchar_t entryName[], int entryType, - const wchar entryValue[] + const wchar_t entryValue[] ); bool VaultAmIgnoringPlayer (unsigned playerId); unsigned VaultGetKILevel (); bool VaultGetCCRStatus (); // true=online, false=away bool VaultSetCCRStatus (bool online); // true=online, false=away -void VaultDump (const wchar tag[], unsigned vaultId, FStateDump dumpProc); -void VaultDump (const wchar tag[], unsigned vaultId); +void VaultDump (const wchar_t tag[], unsigned vaultId, FStateDump dumpProc); +void VaultDump (const wchar_t tag[], unsigned vaultId); bool VaultAmInMyPersonalAge (); bool VaultAmInMyNeighborhoodAge (); @@ -375,8 +375,8 @@ bool VaultAmCzarOfCurrentAge (); bool VaultAmOwnerOfAge (const Uuid & ageInstId); bool VaultAmCzarOfAge (const Uuid & ageInstId); bool VaultRegisterMTStationAndWait ( - const wchar stationName[], - const wchar linkBackSpawnPtObjName[] + const wchar_t stationName[], + const wchar_t linkBackSpawnPtObjName[] ); void VaultProcessPlayerInbox (); @@ -402,19 +402,19 @@ RelVaultNode * VaultGetAgePublicAgesFolderIncRef (); RelVaultNode * VaultAgeGetBookshelfFolderIncRef (); RelVaultNode * VaultFindAgeSubAgeLinkIncRef (const plAgeInfoStruct * info); RelVaultNode * VaultFindAgeChildAgeLinkIncRef (const plAgeInfoStruct * info); -RelVaultNode * VaultFindAgeChronicleEntryIncRef (const wchar entryName[], int entryType = -1); +RelVaultNode * VaultFindAgeChronicleEntryIncRef (const wchar_t entryName[], int entryType = -1); // if entry of same name and type already exists, value is updated void VaultAddAgeChronicleEntry ( - const wchar entryName[], + const wchar_t entryName[], int entryType, - const wchar entryValue[] -); -RelVaultNode * VaultAgeAddDeviceAndWaitIncRef (const wchar deviceName[]); // blocks until completion -void VaultAgeRemoveDevice (const wchar deviceName[]); -bool VaultAgeHasDevice (const wchar deviceName[]); -RelVaultNode * VaultAgeGetDeviceIncRef (const wchar deviceName[]); -RelVaultNode * VaultAgeSetDeviceInboxAndWaitIncRef (const wchar deviceName[], const wchar inboxName[]); // blocks until completion -RelVaultNode * VaultAgeGetDeviceInboxIncRef (const wchar deviceName[]); + const wchar_t entryValue[] +); +RelVaultNode * VaultAgeAddDeviceAndWaitIncRef (const wchar_t deviceName[]); // blocks until completion +void VaultAgeRemoveDevice (const wchar_t deviceName[]); +bool VaultAgeHasDevice (const wchar_t deviceName[]); +RelVaultNode * VaultAgeGetDeviceIncRef (const wchar_t deviceName[]); +RelVaultNode * VaultAgeSetDeviceInboxAndWaitIncRef (const wchar_t deviceName[], const wchar_t inboxName[]); // blocks until completion +RelVaultNode * VaultAgeGetDeviceInboxIncRef (const wchar_t deviceName[]); void VaultClearDeviceInboxMap (); bool VaultAgeGetAgeSDL (class plStateDataRecord * out); @@ -434,11 +434,11 @@ bool VaultAgeFindOrCreateSubAgeLinkAndWait ( ); bool VaultAgeFindOrCreateSubAgeLink(const plAgeInfoStruct* info, plAgeLinkStruct* link, const Uuid& parentUuid); bool VaultAgeFindOrCreateChildAgeLinkAndWait ( - const wchar parentAgeName[], // nil --> current age, non-nil --> owned age by given name + const wchar_t parentAgeName[], // nil --> current age, non-nil --> owned age by given name const plAgeInfoStruct * info, plAgeLinkStruct * link ); -UInt8 VaultAgeFindOrCreateChildAgeLink(const wchar parentAgeName[], const plAgeInfoStruct* info, plAgeLinkStruct* link); +uint8_t VaultAgeFindOrCreateChildAgeLink(const wchar_t parentAgeName[], const plAgeInfoStruct* info, plAgeLinkStruct* link); @@ -469,7 +469,7 @@ typedef void (*FVaultProgressCallback)( ); void VaultDownload ( - const wchar tag[], + const wchar_t tag[], unsigned vaultId, FVaultDownloadCallback callback, void * cbParam, @@ -477,7 +477,7 @@ void VaultDownload ( void * cbProgressParam ); void VaultDownloadAndWait ( - const wchar tag[], + const wchar_t tag[], unsigned vaultId, FVaultProgressCallback progressCallback, void * cbProgressParam diff --git a/Sources/Plasma/PubUtilLib/plVault/plVaultNodeAccess.cpp b/Sources/Plasma/PubUtilLib/plVault/plVaultNodeAccess.cpp index 458b6a74..2c31fd31 100644 --- a/Sources/Plasma/PubUtilLib/plVault/plVaultNodeAccess.cpp +++ b/Sources/Plasma/PubUtilLib/plVault/plVaultNodeAccess.cpp @@ -53,7 +53,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com //============================================================================ struct NodeTypeToVolatileField { unsigned nodeType; - qword volatileFields; + uint64_t volatileFields; }; NodeTypeToVolatileField volatileFieldList[] = { @@ -62,8 +62,8 @@ NodeTypeToVolatileField volatileFieldList[] = { }; //============================================================================ -qword GetNodeVolatileFields(NetVaultNode* node) { - qword volatileFields = 0; +uint64_t GetNodeVolatileFields(NetVaultNode* node) { + uint64_t volatileFields = 0; unsigned index = 0; while (volatileFieldList[index].nodeType != 0) { @@ -112,12 +112,12 @@ VaultPlayerNode::VaultPlayerNode (NetVaultNode * node) } //============================================================================ -void VaultPlayerNode::SetPlayerName (const wchar v[]) { +void VaultPlayerNode::SetPlayerName (const wchar_t v[]) { IVaultNodeSetString(kPlayerName, base, &playerName, v, kMaxVaultNodeStringLength); } //============================================================================ -void VaultPlayerNode::SetAvatarShapeName (const wchar v[]) { +void VaultPlayerNode::SetAvatarShapeName (const wchar_t v[]) { IVaultNodeSetString(kAvatarShapeName, base, &avatarShapeName, v, kMaxVaultNodeStringLength); } @@ -171,12 +171,12 @@ void VaultPlayerInfoNode::SetPlayerId (unsigned v) { } //============================================================================ -void VaultPlayerInfoNode::SetPlayerName (const wchar v[]) { +void VaultPlayerInfoNode::SetPlayerName (const wchar_t v[]) { IVaultNodeSetString(kPlayerName, base, &playerName, v, kMaxVaultNodeStringLength); } //============================================================================ -void VaultPlayerInfoNode::SetAgeInstName (const wchar v[]) { +void VaultPlayerInfoNode::SetAgeInstName (const wchar_t v[]) { IVaultNodeSetString(kAgeInstName, base, &ageInstName, v, kMaxVaultNodeStringLength); } @@ -210,7 +210,7 @@ VaultFolderNode::VaultFolderNode (NetVaultNode * node) } //============================================================================ -void VaultFolderNode::SetFolderName (const wchar v[]) { +void VaultFolderNode::SetFolderName (const wchar_t v[]) { IVaultNodeSetString(kFolderName, base, &folderName, v, kMaxVaultNodeStringLength); } @@ -267,12 +267,12 @@ void VaultChronicleNode::SetEntryType (int v) { } //============================================================================ -void VaultChronicleNode::SetEntryName (const wchar v[]) { +void VaultChronicleNode::SetEntryName (const wchar_t v[]) { IVaultNodeSetString(kEntryName, base, &entryName, v, kMaxVaultNodeStringLength); } //============================================================================ -void VaultChronicleNode::SetEntryValue (const wchar v[]) { +void VaultChronicleNode::SetEntryValue (const wchar_t v[]) { IVaultNodeSetString(kEntryValue, base, &entryValue, v, (unsigned)-1); } @@ -304,12 +304,12 @@ void VaultTextNoteNode::SetNoteSubType (int v) { } //============================================================================ -void VaultTextNoteNode::SetNoteTitle (const wchar v[]) { +void VaultTextNoteNode::SetNoteTitle (const wchar_t v[]) { IVaultNodeSetString(kNoteTitle, base, ¬eTitle, v, kMaxVaultNodeStringLength); } //============================================================================ -void VaultTextNoteNode::SetNoteText (const wchar v[]) { +void VaultTextNoteNode::SetNoteText (const wchar_t v[]) { IVaultNodeSetString(kNoteText, base, ¬eText, v, (unsigned)-1); } @@ -328,82 +328,82 @@ enum EAgeInfoFields { #ifdef CLIENT void VaultTextNoteNode::SetVisitInfo (const plAgeInfoStruct & info) { - ARRAY(wchar) buf; + ARRAY(wchar_t) buf; for (unsigned i = 0; i < kNumAgeInfoFields; ++i) { switch (i) { case kAgeFilename: { - wchar src[128]; + wchar_t src[128]; StrToUnicode(src, info.GetAgeFilename(), arrsize(src)); unsigned len = StrLen(src); - wchar * dst = buf.New(len); - MemCopy(dst, src, len * sizeof(src[0])); + wchar_t * dst = buf.New(len); + memcpy(dst, src, len * sizeof(src[0])); } break; case kAgeInstName: { - wchar src[128]; + wchar_t src[128]; StrToUnicode(src, info.GetAgeInstanceName(), arrsize(src)); unsigned len = StrLen(src); - wchar * dst = buf.New(len); - MemCopy(dst, src, len * sizeof(src[0])); + wchar_t * dst = buf.New(len); + memcpy(dst, src, len * sizeof(src[0])); } break; case kAgeUserName: { - wchar src[128]; + wchar_t src[128]; StrToUnicode(src, info.GetAgeUserDefinedName(), arrsize(src)); unsigned len = StrLen(src); - wchar * dst = buf.New(len); - MemCopy(dst, src, len * sizeof(src[0])); + wchar_t * dst = buf.New(len); + memcpy(dst, src, len * sizeof(src[0])); } break; case kAgeDesc: { - wchar src[128]; + wchar_t src[128]; StrToUnicode(src, info.GetAgeDescription(), arrsize(src)); unsigned len = StrLen(src); - wchar * dst = buf.New(len); - MemCopy(dst, src, len * sizeof(src[0])); + wchar_t * dst = buf.New(len); + memcpy(dst, src, len * sizeof(src[0])); } break; case kAgeInstGuid: { Uuid guid = (Uuid)*info.GetAgeInstanceGuid(); - wchar src[64]; + wchar_t src[64]; GuidToString(guid, src, arrsize(src)); unsigned len = StrLen(src); - wchar * dst = buf.New(len); - MemCopy(dst, src, len * sizeof(src[0])); + wchar_t * dst = buf.New(len); + memcpy(dst, src, len * sizeof(src[0])); } break; case kAgeLanguage: { - wchar src[32]; + wchar_t src[32]; StrPrintf(src, arrsize(src), L"%u", info.GetAgeLanguage()); unsigned len = StrLen(src); - wchar * dst = buf.New(len); - MemCopy(dst, src, len * sizeof(src[0])); + wchar_t * dst = buf.New(len); + memcpy(dst, src, len * sizeof(src[0])); } break; case kAgeSequence: { - wchar src[32]; + wchar_t src[32]; StrPrintf(src, arrsize(src), L"%u", info.GetAgeSequenceNumber()); unsigned len = StrLen(src); - wchar * dst = buf.New(len); - MemCopy(dst, src, len * sizeof(src[0])); + wchar_t * dst = buf.New(len); + memcpy(dst, src, len * sizeof(src[0])); } break; DEFAULT_FATAL(i); } - wchar * sep = buf.New(1); + wchar_t * sep = buf.New(1); *sep = L'|'; } - wchar * term = buf.New(1); + wchar_t * term = buf.New(1); *term = 0; SetNoteText(buf.Ptr()); @@ -414,12 +414,12 @@ void VaultTextNoteNode::SetVisitInfo (const plAgeInfoStruct & info) { #ifdef CLIENT bool VaultTextNoteNode::GetVisitInfo (plAgeInfoStruct * info) { - wchar * mem; - const wchar * str = mem = StrDup(noteText); + wchar_t * mem; + const wchar_t * str = mem = StrDup(noteText); for (unsigned i = 0; i < kNumAgeInfoFields; ++i) { - wchar token[1024]; + wchar_t token[1024]; switch (i) { case kAgeFilename: { StrTokenize(&str, token, arrsize(token), L"|", 1); @@ -491,7 +491,7 @@ bool VaultTextNoteNode::GetVisitInfo (plAgeInfoStruct * info) { } } - FREE(mem); + free(mem); return true; } #endif @@ -519,7 +519,7 @@ void VaultSDLNode::SetSdlIdent (int v) { } //============================================================================ -void VaultSDLNode::SetSdlName (const wchar v[]) { +void VaultSDLNode::SetSdlName (const wchar_t v[]) { IVaultNodeSetString(kSDLName, base, &sdlName, v, kMaxVaultNodeStringLength); } @@ -539,7 +539,7 @@ bool VaultSDLNode::GetStateDataRecord (plStateDataRecord * rec, unsigned readOpt return false; rec->SetDescriptor(sdlRecName, sdlRecVersion); - FREE(sdlRecName); + free(sdlRecName); // Note: Setting from default here results in a bug causing age SDL to // be incorrectly shown when immediately linking back to an age you linked @@ -566,27 +566,24 @@ void VaultSDLNode::SetStateDataRecord (const plStateDataRecord * rec, unsigned w ram.Rewind(); unsigned bytes = ram.GetEOF(); - byte * buf, * heap = nil; - if (bytes <= 2048) - buf = ALLOCA(byte, bytes); - else - buf = (byte *)ALLOC(bytes); + uint8_t * buf = nil; + buf = (uint8_t *)malloc(bytes); ram.CopyToMem(buf); IVaultNodeSetBlob(kSDLData, base, &sdlData, &sdlDataLen, buf, bytes); - FREE(heap); + free(buf); } #endif // def CLIENT //============================================================================ #ifdef CLIENT -void VaultSDLNode::InitStateDataRecord (const wchar sdlRecName[], unsigned writeOptions) { +void VaultSDLNode::InitStateDataRecord (const wchar_t sdlRecName[], unsigned writeOptions) { { plStateDataRecord * rec = NEWZERO(plStateDataRecord); bool exists = GetStateDataRecord(rec, 0); - DEL(rec); + delete rec; if (exists) return; } @@ -619,7 +616,7 @@ VaultImageNode::VaultImageNode (NetVaultNode * node) } //============================================================================ -void VaultImageNode::SetImageTitle (const wchar v[]) { +void VaultImageNode::SetImageTitle (const wchar_t v[]) { IVaultNodeSetString(kImageTitle, base, &title, v, kMaxVaultNodeStringLength); } @@ -629,7 +626,7 @@ void VaultImageNode::SetImageType (int v) { } //============================================================================ -void VaultImageNode::SetImageData (const byte buffer[], unsigned bytes) { +void VaultImageNode::SetImageData (const uint8_t buffer[], unsigned bytes) { IVaultNodeSetBlob(kImageData, base, &imgData, &imgDataLen, buffer, bytes); } @@ -640,11 +637,11 @@ void VaultImageNode::StuffImage (plMipmap * src) { plJPEG::Instance().SetWriteQuality(30/*percent*/); if (plJPEG::Instance().WriteToStream(&ramStream, src)) { unsigned bytes = ramStream.GetEOF(); - byte * buffer = (byte *)ALLOC(bytes); + uint8_t * buffer = (uint8_t *)malloc(bytes); ramStream.CopyToMem(buffer); IVaultNodeSetBlob(kImageData, base, &imgData, &imgDataLen, buffer, bytes); SetImageType(kJPEG); - FREE(buffer); + free(buffer); } else { IVaultNodeSetBlob(kImageData, base, &imgData, &imgDataLen, nil, 0); @@ -792,8 +789,8 @@ bool VaultAgeLinkNode::HasSpawnPoint (const plSpawnPointInfo & point) const { void VaultAgeLinkNode::GetSpawnPoints (plSpawnPointVec * out) const { char str[2048]; - ZERO(str); - MemCopy(str, spawnPoints, min(spawnPointsLen, arrsize(str) - 1)); + memset(&str, 0, sizeof(str)); + memcpy(str, spawnPoints, min(spawnPointsLen, arrsize(str) - 1)); char token1[ 1024 ]; hsStringTokenizer izer1( str, ";" ); @@ -830,7 +827,7 @@ void VaultAgeLinkNode::SetSpawnPoints (const plSpawnPointVec & in) { base, &spawnPoints, &spawnPointsLen, - (const byte *)ss.str().c_str(), + (const uint8_t *)ss.str().c_str(), ss.str().size() ); } @@ -862,7 +859,7 @@ void VaultAgeNode::SetParentAgeInstGuid (const Uuid & v) { } //============================================================================ -void VaultAgeNode::SetAgeName (const wchar v[]) { +void VaultAgeNode::SetAgeName (const wchar_t v[]) { IVaultNodeSetString(kAgeName, base, &ageName, v, kMaxVaultNodeStringLength); } @@ -892,17 +889,17 @@ VaultAgeInfoNode::VaultAgeInfoNode (NetVaultNode * node) } //============================================================================ -void VaultAgeInfoNode::SetAgeFilename (const wchar v[]) { +void VaultAgeInfoNode::SetAgeFilename (const wchar_t v[]) { IVaultNodeSetString(kAgeFilename, base, &ageFilename, v, kMaxVaultNodeStringLength); } //============================================================================ -void VaultAgeInfoNode::SetAgeInstName (const wchar v[]) { +void VaultAgeInfoNode::SetAgeInstName (const wchar_t v[]) { IVaultNodeSetString(kAgeInstanceName, base, &ageInstName, v, kMaxVaultNodeStringLength); } //============================================================================ -void VaultAgeInfoNode::SetAgeUserDefinedName (const wchar v[]) { +void VaultAgeInfoNode::SetAgeUserDefinedName (const wchar_t v[]) { IVaultNodeSetString(kAgeUserDefinedName, base, &ageUserDefinedName, v, kMaxVaultNodeStringLength); } @@ -947,7 +944,7 @@ void VaultAgeInfoNode::SetAgeInfoFlags (unsigned v) { } //============================================================================ -void VaultAgeInfoNode::SetAgeDescription (const wchar v[]) { +void VaultAgeInfoNode::SetAgeDescription (const wchar_t v[]) { IVaultNodeSetString(kAgeDescription, base, &ageDescription, v, (unsigned)-1); } @@ -962,7 +959,7 @@ const class plUnifiedTime * VaultAgeInfoNode::GetAgeTime () const { //============================================================================ #ifdef CLIENT void VaultAgeInfoNode::CopyFrom (const plAgeInfoStruct * info) { - wchar str[MAX_PATH]; + wchar_t str[MAX_PATH]; // age filename if (info->HasAgeFilename()) { @@ -1079,7 +1076,7 @@ VaultMarkerGameNode::VaultMarkerGameNode (NetVaultNode * node) } //============================================================================ -void VaultMarkerGameNode::SetGameName (const wchar v[]) { +void VaultMarkerGameNode::SetGameName (const wchar_t v[]) { IVaultNodeSetString(kGameName, base, &gameName, v, (unsigned)-1); } diff --git a/Sources/Plasma/PubUtilLib/plVault/plVaultNodeAccess.h b/Sources/Plasma/PubUtilLib/plVault/plVaultNodeAccess.h index e3648009..83acd6c3 100644 --- a/Sources/Plasma/PubUtilLib/plVault/plVaultNodeAccess.h +++ b/Sources/Plasma/PubUtilLib/plVault/plVaultNodeAccess.h @@ -73,15 +73,15 @@ typedef std::vector plSpawnPointVec; //============================================================================ // Volatile Vault Node Fields //============================================================================ -qword GetNodeVolatileFields(NetVaultNode* node); +uint64_t GetNodeVolatileFields(NetVaultNode* node); //============================================================================ // NetVaultNodeAccess //============================================================================ struct NetVaultNodeAccess { NetVaultNode * base; - qword & fieldFlags; - qword & dirtyFlags; + uint64_t & fieldFlags; + uint64_t & dirtyFlags; NetVaultNodeAccess (NetVaultNode * node); NetVaultNodeAccess (const NetVaultNodeAccess &); // not implemented @@ -93,18 +93,18 @@ struct NetVaultNodeAccess { // VaultPlayerNode //============================================================================ struct VaultPlayerNode : NetVaultNodeAccess { - static const qword kPlayerName = NetVaultNode::kIString64_1; - static const qword kAvatarShapeName = NetVaultNode::kString64_1; - static const qword kDisabled = NetVaultNode::kInt32_1; - static const qword kExplorer = NetVaultNode::kInt32_2; // explorer = 1, visitor = 0 - static const qword kOnlineTime = NetVaultNode::kUInt32_1; - static const qword kAccountUuid = NetVaultNode::kUuid_1; - static const qword kInviteUuid = NetVaultNode::kUuid_2; + static const uint64_t kPlayerName = NetVaultNode::kIString64_1; + static const uint64_t kAvatarShapeName = NetVaultNode::kString64_1; + static const uint64_t kDisabled = NetVaultNode::kInt32_1; + static const uint64_t kExplorer = NetVaultNode::kInt32_2; // explorer = 1, visitor = 0 + static const uint64_t kOnlineTime = NetVaultNode::kUInt32_1; + static const uint64_t kAccountUuid = NetVaultNode::kUuid_1; + static const uint64_t kInviteUuid = NetVaultNode::kUuid_2; // Treat these as read-only or node flag fields will become invalid // Threaded apps: Must be accessed with node->critsect locked - wchar *& playerName; - wchar *& avatarShapeName; + wchar_t *& playerName; + wchar_t *& avatarShapeName; int & disabled; unsigned & onlineTime; Uuid & accountUuid; @@ -116,8 +116,8 @@ struct VaultPlayerNode : NetVaultNodeAccess { const VaultPlayerNode & operator= (const VaultPlayerNode &); // not implemented // Threaded apps: Must be called with node->critsect locked - void SetPlayerName (const wchar v[]); - void SetAvatarShapeName (const wchar v[]); + void SetPlayerName (const wchar_t v[]); + void SetAvatarShapeName (const wchar_t v[]); void SetDisabled (int v); void SetOnlineTime (unsigned v); void SetAccountUuid (const Uuid & v); @@ -130,18 +130,18 @@ struct VaultPlayerNode : NetVaultNodeAccess { // VaultPlayerInfoNode //============================================================================ struct VaultPlayerInfoNode : NetVaultNodeAccess { - static const qword kPlayerId = NetVaultNode::kUInt32_1; - static const qword kPlayerName = NetVaultNode::kIString64_1; - static const qword kAgeInstName = NetVaultNode::kString64_1; // name of age player is currently in - static const qword kAgeInstUuid = NetVaultNode::kUuid_1; // guid of age player is currently in - static const qword kOnline = NetVaultNode::kInt32_1; // whether or not player is online - static const qword kCCRLevel = NetVaultNode::kInt32_2; + static const uint64_t kPlayerId = NetVaultNode::kUInt32_1; + static const uint64_t kPlayerName = NetVaultNode::kIString64_1; + static const uint64_t kAgeInstName = NetVaultNode::kString64_1; // name of age player is currently in + static const uint64_t kAgeInstUuid = NetVaultNode::kUuid_1; // guid of age player is currently in + static const uint64_t kOnline = NetVaultNode::kInt32_1; // whether or not player is online + static const uint64_t kCCRLevel = NetVaultNode::kInt32_2; // Treat these as read-only or node flag fields will become invalid // Threaded apps: Must be accessed with node->critsect locked unsigned & playerId; - wchar *& playerName; - wchar *& ageInstName; + wchar_t *& playerName; + wchar_t *& ageInstName; Uuid & ageInstUuid; int & online; int & ccrLevel; @@ -152,8 +152,8 @@ struct VaultPlayerInfoNode : NetVaultNodeAccess { // Threaded apps: Must be called with node->critsect locked void SetPlayerId (unsigned v); - void SetPlayerName (const wchar v[]); - void SetAgeInstName (const wchar v[]); + void SetPlayerName (const wchar_t v[]); + void SetAgeInstName (const wchar_t v[]); void SetAgeInstUuid (const Uuid & v); void SetOnline (int v); void SetCCRLevel (int v); @@ -164,20 +164,20 @@ struct VaultPlayerInfoNode : NetVaultNodeAccess { // VaultFolderNode //============================================================================ struct VaultFolderNode : NetVaultNodeAccess { - static const qword kFolderType = NetVaultNode::kInt32_1; - static const qword kFolderName = NetVaultNode::kString64_1; + static const uint64_t kFolderType = NetVaultNode::kInt32_1; + static const uint64_t kFolderName = NetVaultNode::kString64_1; // Treat these as read-only or node flag fields will become invalid // Threaded apps: Must be accessed with node->critsect locked int & folderType; - wchar *& folderName; + wchar_t *& folderName; VaultFolderNode (NetVaultNode * node); VaultFolderNode (const VaultFolderNode &); // not implemented const VaultFolderNode & operator= (const VaultFolderNode &); // not implemented // Threaded apps: Must be called with node->critsect locked - void SetFolderName (const wchar v[]); + void SetFolderName (const wchar_t v[]); void SetFolderType (int v); }; @@ -206,15 +206,15 @@ struct VaultAgeInfoListNode : VaultFolderNode { // VaultChronicleNode //============================================================================ struct VaultChronicleNode : NetVaultNodeAccess { - static const qword kEntryType = NetVaultNode::kInt32_1; - static const qword kEntryName = NetVaultNode::kString64_1; - static const qword kEntryValue = NetVaultNode::kText_1; + static const uint64_t kEntryType = NetVaultNode::kInt32_1; + static const uint64_t kEntryName = NetVaultNode::kString64_1; + static const uint64_t kEntryValue = NetVaultNode::kText_1; // Treat these as read-only or node flag fields will become invalid // Threaded apps: Must be accessed with node->critsect locked int & entryType; - wchar *& entryName; - wchar *& entryValue; + wchar_t *& entryName; + wchar_t *& entryValue; VaultChronicleNode (NetVaultNode * node); VaultChronicleNode (const VaultChronicleNode &); // not implemented @@ -222,8 +222,8 @@ struct VaultChronicleNode : NetVaultNodeAccess { // Threaded apps: Must be called with node->critsect locked void SetEntryType (int v); - void SetEntryName (const wchar v[]); - void SetEntryValue (const wchar v[]); + void SetEntryName (const wchar_t v[]); + void SetEntryValue (const wchar_t v[]); }; @@ -231,13 +231,13 @@ struct VaultChronicleNode : NetVaultNodeAccess { // VaultSDLNode //============================================================================ struct VaultSDLNode : NetVaultNodeAccess { - static const qword kSDLName = NetVaultNode::kString64_1; - static const qword kSDLIdent = NetVaultNode::kInt32_1; - static const qword kSDLData = NetVaultNode::kBlob_1; + static const uint64_t kSDLName = NetVaultNode::kString64_1; + static const uint64_t kSDLIdent = NetVaultNode::kInt32_1; + static const uint64_t kSDLData = NetVaultNode::kBlob_1; int & sdlIdent; - wchar *& sdlName; - byte *& sdlData; + wchar_t *& sdlName; + uint8_t *& sdlData; unsigned & sdlDataLen; VaultSDLNode (NetVaultNode * node); @@ -245,12 +245,12 @@ struct VaultSDLNode : NetVaultNodeAccess { const VaultSDLNode & operator= (const VaultSDLNode &); // not implemented void SetSdlIdent (int v); - void SetSdlName (const wchar v[]); + void SetSdlName (const wchar_t v[]); #ifdef CLIENT bool GetStateDataRecord (class plStateDataRecord * out, unsigned readOptions = 0); void SetStateDataRecord (const class plStateDataRecord * rec, unsigned writeOptions = 0); - void InitStateDataRecord (const wchar sdlRecName[], unsigned writeOptions = 0); + void InitStateDataRecord (const wchar_t sdlRecName[], unsigned writeOptions = 0); #endif // def CLIENT }; @@ -258,13 +258,13 @@ struct VaultSDLNode : NetVaultNodeAccess { // VaultAgeLinkNode //============================================================================ struct VaultAgeLinkNode : NetVaultNodeAccess { - static const qword kUnlocked = NetVaultNode::kInt32_1; - static const qword kVolatile = NetVaultNode::kInt32_2; - static const qword kSpawnPoints = NetVaultNode::kBlob_1; + static const uint64_t kUnlocked = NetVaultNode::kInt32_1; + static const uint64_t kVolatile = NetVaultNode::kInt32_2; + static const uint64_t kSpawnPoints = NetVaultNode::kBlob_1; int & unlocked; int & volat; - byte *& spawnPoints; + uint8_t *& spawnPoints; unsigned & spawnPointsLen; VaultAgeLinkNode (NetVaultNode * node); @@ -292,22 +292,22 @@ struct VaultImageNode : NetVaultNodeAccess { enum ImageTypes { kNone=0, kJPEG=1 }; - static const qword kImageType = NetVaultNode::kInt32_1; - static const qword kImageTitle = NetVaultNode::kString64_1; - static const qword kImageData = NetVaultNode::kBlob_1; + static const uint64_t kImageType = NetVaultNode::kInt32_1; + static const uint64_t kImageTitle = NetVaultNode::kString64_1; + static const uint64_t kImageData = NetVaultNode::kBlob_1; - wchar *& title; + wchar_t *& title; int & imgType; - byte *& imgData; + uint8_t *& imgData; unsigned & imgDataLen; VaultImageNode (NetVaultNode * node); VaultImageNode (const VaultImageNode &); // not implemented const VaultImageNode & operator= (const VaultImageNode &); // not implemented - void SetImageTitle (const wchar v[]); + void SetImageTitle (const wchar_t v[]); void SetImageType (int v); - void SetImageData (const byte buffer[], unsigned bytes); + void SetImageData (const uint8_t buffer[], unsigned bytes); #ifdef CLIENT void StuffImage (class plMipmap * src); @@ -333,15 +333,15 @@ struct VaultCliImageNode : VaultImageNode { //============================================================================ struct VaultTextNoteNode : NetVaultNodeAccess { - static const qword kNoteType = NetVaultNode::kInt32_1; - static const qword kNoteSubType = NetVaultNode::kInt32_2; - static const qword kNoteTitle = NetVaultNode::kString64_1; - static const qword kNoteText = NetVaultNode::kText_1; + static const uint64_t kNoteType = NetVaultNode::kInt32_1; + static const uint64_t kNoteSubType = NetVaultNode::kInt32_2; + static const uint64_t kNoteTitle = NetVaultNode::kString64_1; + static const uint64_t kNoteText = NetVaultNode::kText_1; int & noteType; int & noteSubType; - wchar *& noteTitle; - wchar *& noteText; + wchar_t *& noteTitle; + wchar_t *& noteText; VaultTextNoteNode (NetVaultNode * node); VaultTextNoteNode (const VaultTextNoteNode &); // not implemented @@ -349,8 +349,8 @@ struct VaultTextNoteNode : NetVaultNodeAccess { void SetNoteType (int v); void SetNoteSubType (int v); - void SetNoteTitle (const wchar v[]); - void SetNoteText (const wchar v[]); + void SetNoteTitle (const wchar_t v[]); + void SetNoteText (const wchar_t v[]); #ifdef CLIENT // for kNoteType_Visit/UnVisit @@ -364,13 +364,13 @@ struct VaultTextNoteNode : NetVaultNodeAccess { //============================================================================ struct VaultAgeNode : NetVaultNodeAccess { - static const qword kAgeInstanceGuid = NetVaultNode::kUuid_1; - static const qword kParentAgeInstanceGuid = NetVaultNode::kUuid_2; - static const qword kAgeName = NetVaultNode::kString64_1; + static const uint64_t kAgeInstanceGuid = NetVaultNode::kUuid_1; + static const uint64_t kParentAgeInstanceGuid = NetVaultNode::kUuid_2; + static const uint64_t kAgeName = NetVaultNode::kString64_1; Uuid & ageInstUuid; Uuid & parentAgeInstUuid; - wchar *& ageName; + wchar_t *& ageName; VaultAgeNode (NetVaultNode * node); VaultAgeNode (const VaultAgeNode &); // not implemented @@ -378,7 +378,7 @@ struct VaultAgeNode : NetVaultNodeAccess { void SetAgeInstGuid (const Uuid & v); void SetParentAgeInstGuid (const Uuid & v); - void SetAgeName (const wchar v[]); + void SetAgeName (const wchar_t v[]); }; //============================================================================ @@ -386,22 +386,22 @@ struct VaultAgeNode : NetVaultNodeAccess { //============================================================================ struct VaultAgeInfoNode : NetVaultNodeAccess { - static const qword kAgeFilename = NetVaultNode::kString64_2; // "Garden" - static const qword kAgeInstanceName = NetVaultNode::kString64_3; // "Eder Kemo" - static const qword kAgeUserDefinedName = NetVaultNode::kString64_4; // "Joe's" - static const qword kAgeInstanceGuid = NetVaultNode::kUuid_1; // 6278b081-342a-4229-ac1b-a0b8a2658390 - static const qword kParentAgeInstanceGuid = NetVaultNode::kUuid_2; // 9192be7f-89ef-41bc-83db-79afe451e399 - static const qword kAgeDescription = NetVaultNode::kText_1; // "Stay out!" - static const qword kAgeSequenceNumber = NetVaultNode::kInt32_1; - static const qword kIsPublic = NetVaultNode::kInt32_2; - static const qword kAgeLanguage = NetVaultNode::kInt32_3; // The language of the client that made this age - static const qword kAgeId = NetVaultNode::kUInt32_1; - static const qword kAgeCzarId = NetVaultNode::kUInt32_2; - static const qword kAgeInfoFlags = NetVaultNode::kUInt32_3; + static const uint64_t kAgeFilename = NetVaultNode::kString64_2; // "Garden" + static const uint64_t kAgeInstanceName = NetVaultNode::kString64_3; // "Eder Kemo" + static const uint64_t kAgeUserDefinedName = NetVaultNode::kString64_4; // "Joe's" + static const uint64_t kAgeInstanceGuid = NetVaultNode::kUuid_1; // 6278b081-342a-4229-ac1b-a0b8a2658390 + static const uint64_t kParentAgeInstanceGuid = NetVaultNode::kUuid_2; // 9192be7f-89ef-41bc-83db-79afe451e399 + static const uint64_t kAgeDescription = NetVaultNode::kText_1; // "Stay out!" + static const uint64_t kAgeSequenceNumber = NetVaultNode::kInt32_1; + static const uint64_t kIsPublic = NetVaultNode::kInt32_2; + static const uint64_t kAgeLanguage = NetVaultNode::kInt32_3; // The language of the client that made this age + static const uint64_t kAgeId = NetVaultNode::kUInt32_1; + static const uint64_t kAgeCzarId = NetVaultNode::kUInt32_2; + static const uint64_t kAgeInfoFlags = NetVaultNode::kUInt32_3; - wchar *& ageFilename; - wchar *& ageInstName; - wchar *& ageUserDefinedName; + wchar_t *& ageFilename; + wchar_t *& ageInstName; + wchar_t *& ageUserDefinedName; Uuid & ageInstUuid; Uuid & parentAgeInstUuid; int & ageSequenceNumber; @@ -410,15 +410,15 @@ struct VaultAgeInfoNode : NetVaultNodeAccess { unsigned & ageId; unsigned & ageCzarId; unsigned & ageInfoFlags; - wchar *& ageDescription; + wchar_t *& ageDescription; VaultAgeInfoNode (NetVaultNode * node); VaultAgeInfoNode (const VaultAgeInfoNode &); // not implemented const VaultAgeInfoNode & operator= (const VaultAgeInfoNode &); // not implemented - void SetAgeFilename (const wchar v[]); - void SetAgeInstName (const wchar v[]); - void SetAgeUserDefinedName (const wchar v[]); + void SetAgeFilename (const wchar_t v[]); + void SetAgeInstName (const wchar_t v[]); + void SetAgeUserDefinedName (const wchar_t v[]); void SetAgeInstGuid (const Uuid & v); void SetParentAgeInstGuid (const Uuid & v); void SetAgeSequenceNumber (int v); @@ -427,7 +427,7 @@ struct VaultAgeInfoNode : NetVaultNodeAccess { void SetAgeId (unsigned v); void SetAgeCzarId (unsigned v); void SetAgeInfoFlags (unsigned v); - void SetAgeDescription (const wchar v[]); + void SetAgeDescription (const wchar_t v[]); #ifdef CLIENT const class plUnifiedTime * GetAgeTime () const; @@ -441,7 +441,7 @@ struct VaultAgeInfoNode : NetVaultNodeAccess { //============================================================================ struct VaultSystemNode : NetVaultNodeAccess { - static const qword kCCRStatus = NetVaultNode::kInt32_1; + static const uint64_t kCCRStatus = NetVaultNode::kInt32_1; int & ccrStatus; @@ -458,16 +458,16 @@ struct VaultSystemNode : NetVaultNodeAccess { //============================================================================ struct VaultMarkerGameNode : NetVaultNodeAccess { - static const qword kGameName = NetVaultNode::kText_1; - static const qword kGameGuid = NetVaultNode::kUuid_1; + static const uint64_t kGameName = NetVaultNode::kText_1; + static const uint64_t kGameGuid = NetVaultNode::kUuid_1; - wchar *& gameName; - Uuid & gameGuid; + wchar_t *& gameName; + Uuid & gameGuid; VaultMarkerGameNode (NetVaultNode * node); VaultMarkerGameNode (const VaultMarkerGameNode &); // not implemented const VaultMarkerGameNode & operator= (const VaultMarkerGameNode &); // not implemented - void SetGameName (const wchar v[]); + void SetGameName (const wchar_t v[]); void SetGameGuid (const Uuid & v); }; diff --git a/Sources/Plasma/PythonLib/pyNetClientComm/pyNetClientComm.cpp b/Sources/Plasma/PythonLib/pyNetClientComm/pyNetClientComm.cpp index 7eb31278..92b6970d 100644 --- a/Sources/Plasma/PythonLib/pyNetClientComm/pyNetClientComm.cpp +++ b/Sources/Plasma/PythonLib/pyNetClientComm/pyNetClientComm.cpp @@ -65,7 +65,7 @@ public: { Py_XDECREF( fPyObject ); } - void OperationStarted( UInt32 context ) + void OperationStarted( uint32_t context ) { if ( fPyObject ) { @@ -81,7 +81,7 @@ public: } } } - void OperationComplete( UInt32 context, int resultCode ) + void OperationComplete( uint32_t context, int resultCode ) { if ( fPyObject ) { @@ -90,11 +90,11 @@ public: if ( pyArgs ) { PyObject* pyDict = PyDict_New(); - std::map args; + std::map args; fCbArgs.GetItems( args ); - for ( std::map::iterator ii=args.begin(); ii!=args.end(); ++ii ) + for ( std::map::iterator ii=args.begin(); ii!=args.end(); ++ii ) { - UInt16 key = ii->first; + uint16_t key = ii->first; PyObject* keyObj = PyInt_FromLong(key); char* strTemp = NULL; plCreatable* arg = ii->second; @@ -106,12 +106,12 @@ public: switch ( value.GetType() ) { case plGenericType::kInt: - valueObj = PyLong_FromLong((Int32)value); + valueObj = PyLong_FromLong((int32_t)value); PyDict_SetItem(pyDict, keyObj, valueObj); Py_DECREF(valueObj); break; case plGenericType::kUInt: - valueObj = PyLong_FromUnsignedLong((UInt32)value); + valueObj = PyLong_FromUnsignedLong((uint32_t)value); PyDict_SetItem(pyDict, keyObj, valueObj); Py_DECREF(valueObj); break; @@ -209,55 +209,55 @@ pyNetClientComm::~pyNetClientComm() } // NetAuthenticate ---------------------------------------------- -int pyNetClientComm::NetAuthenticate( double maxAuthSecs, PyObject* cbClass/*=nil*/, UInt32 cbContext/*=0 */) +int pyNetClientComm::NetAuthenticate( double maxAuthSecs, PyObject* cbClass/*=nil*/, uint32_t cbContext/*=0 */) { return fNetClient.NetAuthenticate( maxAuthSecs, new pyNetClientCommCallback( cbClass ), cbContext ); } // NetLeave ---------------------------------------------- -int pyNetClientComm::NetLeave( UInt8 reason, PyObject* cbClass/*=nil*/, UInt32 cbContext/*=0 */) +int pyNetClientComm::NetLeave( uint8_t reason, PyObject* cbClass/*=nil*/, uint32_t cbContext/*=0 */) { return fNetClient.NetLeave( reason, new pyNetClientCommCallback( cbClass ), cbContext ); } // NetPing ---------------------------------------------- -int pyNetClientComm::NetPing( int serverType, int timeoutSecs/*=0*/, PyObject* cbClass/*=nil*/, UInt32 cbContext/*=0 */) +int pyNetClientComm::NetPing( int serverType, int timeoutSecs/*=0*/, PyObject* cbClass/*=nil*/, uint32_t cbContext/*=0 */) { return fNetClient.NetPing( serverType, timeoutSecs, new pyNetClientCommCallback( cbClass ), cbContext ); } // NetFindAge ---------------------------------------------- -int pyNetClientComm::NetFindAge( const pyAgeLinkStruct* linkInfo, PyObject* cbClass/*=nil*/, UInt32 cbContext/*=0 */) +int pyNetClientComm::NetFindAge( const pyAgeLinkStruct* linkInfo, PyObject* cbClass/*=nil*/, uint32_t cbContext/*=0 */) { return fNetClient.NetFindAge( linkInfo->GetAgeLink(), new pyNetClientCommCallback( cbClass ), cbContext ); } // NetGetPlayerList ---------------------------------------------- -int pyNetClientComm::NetGetPlayerList( PyObject* cbClass/*=nil*/, UInt32 cbContext/*=0 */) +int pyNetClientComm::NetGetPlayerList( PyObject* cbClass/*=nil*/, uint32_t cbContext/*=0 */) { return fNetClient.NetGetPlayerList( new pyNetClientCommCallback( cbClass ), cbContext ); } // NetSetActivePlayer ---------------------------------------------- -int pyNetClientComm::NetSetActivePlayer( UInt32 playerID, const char* playerName, PyObject* cbClass/*=nil*/, UInt32 cbContext/*=0 */) +int pyNetClientComm::NetSetActivePlayer( uint32_t playerID, const char* playerName, PyObject* cbClass/*=nil*/, uint32_t cbContext/*=0 */) { return fNetClient.NetSetActivePlayer( playerID, playerName, 0 /*ccrLevel*/, new pyNetClientCommCallback( cbClass ), cbContext ); } // NetCreatePlayer ---------------------------------------------- -int pyNetClientComm::NetCreatePlayer( const char* playerName, const char* avatarShape, UInt32 createFlags, PyObject* cbClass/*=nil*/, UInt32 cbContext/*=0 */) +int pyNetClientComm::NetCreatePlayer( const char* playerName, const char* avatarShape, uint32_t createFlags, PyObject* cbClass/*=nil*/, uint32_t cbContext/*=0 */) { return fNetClient.NetCreatePlayer( playerName, avatarShape, createFlags, nil, nil, nil, new pyNetClientCommCallback( cbClass ), cbContext ); } // NetJoinAge ---------------------------------------------- -int pyNetClientComm::NetJoinAge( PyObject* cbClass/*=nil*/, UInt32 cbContext/*=0 */) +int pyNetClientComm::NetJoinAge( PyObject* cbClass/*=nil*/, uint32_t cbContext/*=0 */) { return fNetClient.NetJoinAge( true /*tryP2P*/, true /*allowTimeout*/, new pyNetClientCommCallback( cbClass ), cbContext ); } // NetSetTimeout ---------------------------------------------- -int pyNetClientComm::NetSetTimeout( float timeoutSecs, PyObject* cbClass/*=nil*/, UInt32 cbContext/*=0 */) +int pyNetClientComm::NetSetTimeout( float timeoutSecs, PyObject* cbClass/*=nil*/, uint32_t cbContext/*=0 */) { return fNetClient.NetSetTimeout( timeoutSecs, new pyNetClientCommCallback( cbClass ), cbContext ); } @@ -309,7 +309,7 @@ int pyNetClientComm::SetAuthInfo( const char* acctName, const char* password ) } // SetLogByName ---------------------------------------------- -void pyNetClientComm::SetLogByName( const char * name, UInt32 flags ) +void pyNetClientComm::SetLogByName( const char * name, uint32_t flags ) { plStatusLog * log = plStatusLogMgr::GetInstance().CreateStatusLog( 80, name, flags | plStatusLog::kTimestamp | plStatusLog::kDeleteForMe ); diff --git a/Sources/Plasma/PythonLib/pyNetClientComm/pyNetClientComm.h b/Sources/Plasma/PythonLib/pyNetClientComm/pyNetClientComm.h index 1dbc069b..945d5659 100644 --- a/Sources/Plasma/PythonLib/pyNetClientComm/pyNetClientComm.h +++ b/Sources/Plasma/PythonLib/pyNetClientComm/pyNetClientComm.h @@ -111,23 +111,23 @@ public: // Auth with active server using auth info set earlier. // Will timeout after maxAuthSecs elapsed. - int NetAuthenticate( double maxAuthSecs, PyObject* cbClass=nil, UInt32 cbContext=0 ); + int NetAuthenticate( double maxAuthSecs, PyObject* cbClass=nil, uint32_t cbContext=0 ); // Leave the active server. - int NetLeave( UInt8 reason, PyObject* cbClass=nil, UInt32 cbContext=0 ); + int NetLeave( uint8_t reason, PyObject* cbClass=nil, uint32_t cbContext=0 ); // Ping the specified server. - int NetPing( int serverType, int timeoutSecs=0, PyObject* cbClass=nil, UInt32 cbContext=0 ); + int NetPing( int serverType, int timeoutSecs=0, PyObject* cbClass=nil, uint32_t cbContext=0 ); // Spawn a game for us. - int NetFindAge( const pyAgeLinkStruct* linkInfo, PyObject* cbClass=nil, UInt32 cbContext=0 ); + int NetFindAge( const pyAgeLinkStruct* linkInfo, PyObject* cbClass=nil, uint32_t cbContext=0 ); // Get player list. - int NetGetPlayerList( PyObject* cbClass=nil, UInt32 cbContext=0 ); + int NetGetPlayerList( PyObject* cbClass=nil, uint32_t cbContext=0 ); // Set the active player. - int NetSetActivePlayer( UInt32 playerID, const char* playerName, PyObject* cbClass=nil, UInt32 cbContext=0 ); + int NetSetActivePlayer( uint32_t playerID, const char* playerName, PyObject* cbClass=nil, uint32_t cbContext=0 ); // Create a player - int NetCreatePlayer( const char* playerName, const char* avatarShape, UInt32 createFlags, PyObject* cbClass=nil, UInt32 cbContext=0 ); + int NetCreatePlayer( const char* playerName, const char* avatarShape, uint32_t createFlags, PyObject* cbClass=nil, uint32_t cbContext=0 ); // Join age - int NetJoinAge( PyObject* cbClass=nil, UInt32 cbContext=0 ); + int NetJoinAge( PyObject* cbClass=nil, uint32_t cbContext=0 ); // Set server-side timeout - int NetSetTimeout( float timeoutSecs, PyObject* cbClass=nil, UInt32 cbContext=0 ); + int NetSetTimeout( float timeoutSecs, PyObject* cbClass=nil, uint32_t cbContext=0 ); //////////////////////////////////////////////////////////////// @@ -139,7 +139,7 @@ public: // Get/Set Log object void SetLog( pyStatusLog* log ); - void SetLogByName( const char * name, UInt32 flags=0 ); + void SetLogByName( const char * name, uint32_t flags=0 ); PyObject* GetLog() const; // return pyStatusLog // NetCore log level @@ -168,13 +168,13 @@ public: const pyNetServerSessionInfo* GetActiveServer() const; // Sets/clears receipt tracking for given message class. - void SetReceiptTrackingForType( UInt16 msgClassIdx, bool on ); + void SetReceiptTrackingForType( uint16_t msgClassIdx, bool on ); // Adds a msg handler for a msg that is convertable to specified type. - void AddMsgHandlerForType( UInt16 msgClassIdx, pyNetClientCommMsgHandler* handler ); + void AddMsgHandlerForType( uint16_t msgClassIdx, pyNetClientCommMsgHandler* handler ); // Adds a msg handler for a specific msg type. - void AddMsgHandlerForExactType( UInt16 msgClassIdx, pyNetClientCommMsgHandler* handler ); + void AddMsgHandlerForExactType( uint16_t msgClassIdx, pyNetClientCommMsgHandler* handler ); void RemoveMsgHandler( pyNetClientCommMsgHandler* handler ); @@ -187,9 +187,9 @@ public: void SetMsgReceiptHandler( pyNetClientCommRcptHandler* rcptHandler ); // Send a message to the server. - int SendMsg( plNetMessage* msg, UInt32 sendFlags=0 ); + int SendMsg( plNetMessage* msg, uint32_t sendFlags=0 ); // Send a message to specified peer - int SendMsg( plNetMessage* msg, plNetCore::PeerID peerID, UInt32 sendFlags=0 ); + int SendMsg( plNetMessage* msg, plNetCore::PeerID peerID, uint32_t sendFlags=0 ); // Set the alive message send frequency. 0 means don't send periodic alive msgs. void SetAliveFreq( float secs ); diff --git a/Sources/Plasma/PythonLib/pyVault/pyVNodeMgr.cpp b/Sources/Plasma/PythonLib/pyVault/pyVNodeMgr.cpp index c12c5e89..fd70c132 100644 --- a/Sources/Plasma/PythonLib/pyVault/pyVNodeMgr.cpp +++ b/Sources/Plasma/PythonLib/pyVault/pyVNodeMgr.cpp @@ -63,7 +63,7 @@ public: { Py_XDECREF( fPyObject ); } - void VaultOperationStarted( UInt32 context ) + void VaultOperationStarted( uint32_t context ) { if ( fPyObject ) { @@ -79,7 +79,7 @@ public: } } } - void VaultOperationComplete( UInt32 context, int resultCode ) + void VaultOperationComplete( uint32_t context, int resultCode ) { if ( fPyObject ) { @@ -88,11 +88,11 @@ public: // if ( pyArgs ) // { // dict pyDict = dict(); -// std::map args; +// std::map args; // fCbArgs.GetItems( args ); -// for ( std::map::iterator ii=args.begin(); ii!=args.end(); ++ii ) +// for ( std::map::iterator ii=args.begin(); ii!=args.end(); ++ii ) // { -// UInt16 key = ii->first; +// uint16_t key = ii->first; // plCreatable* arg = ii->second; // plCreatableGenericValue * genValue = plCreatableGenericValue::ConvertNoRef( arg ); // if ( genValue ) @@ -244,13 +244,13 @@ bool pyVNodeMgr::IIsThisMe( plVaultPlayerNode * node ) const } // ISendNetMsg ---------------------------------------------- -int pyVNodeMgr::ISendNetMsg( plNetMsgVault* msg, UInt32 sendFlags/*=0 */) +int pyVNodeMgr::ISendNetMsg( plNetMsgVault* msg, uint32_t sendFlags/*=0 */) { return fMyComm->GetNetClientComm()->SendMsg( msg, sendFlags ); } // IGetPlayerID ---------------------------------------------- -UInt32 pyVNodeMgr::IGetPlayerID() const +uint32_t pyVNodeMgr::IGetPlayerID() const { return fMyComm->GetNetClientComm()->GetPlayerID(); } @@ -281,7 +281,7 @@ bool pyVNodeMgr::IsConnected() } // Disconnect ---------------------------------------------- -void pyVNodeMgr::Disconnect( PyObject* cb/*=nil*/, UInt32 cbContext/*=0 */) +void pyVNodeMgr::Disconnect( PyObject* cb/*=nil*/, uint32_t cbContext/*=0 */) { // disconnect from allplayers and globalsdl folders plVaultNodeRef * out; @@ -301,16 +301,16 @@ void pyVNodeMgr::Disconnect( PyObject* cb/*=nil*/, UInt32 cbContext/*=0 */) } // Connect ---------------------------------------------- -void pyVNodeMgr::Connect( int childFetchLevel/*=plVault::kFetchAllChildren*/, PyObject* cb/*=nil*/, UInt32 cbContext/*=0 */) +void pyVNodeMgr::Connect( int childFetchLevel/*=plVault::kFetchAllChildren*/, PyObject* cb/*=nil*/, uint32_t cbContext/*=0 */) { plVNodeMgr::Connect( childFetchLevel, new pyVaultOperationCallback( cb ), cbContext ); } // FetchNode ---------------------------------------------- -bool pyVNodeMgr::FetchNode( UInt32 nodeID, +bool pyVNodeMgr::FetchNode( uint32_t nodeID, int childFetchLevel/*=plVault::kFetchAllChildren*/, PyObject* cb/*=nil*/, - UInt32 cbContext/*=0 */) + uint32_t cbContext/*=0 */) { return plVNodeMgr::FetchNode( nodeID, childFetchLevel, new pyVaultOperationCallback( cb ), cbContext ); } @@ -322,13 +322,13 @@ PyObject* pyVNodeMgr::GetRootNode() const } // GetClientID ---------------------------------------------- -UInt32 pyVNodeMgr::GetClientID() const +uint32_t pyVNodeMgr::GetClientID() const { return plVNodeMgr::GetClientID(); } // GetNode ---------------------------------------------- -PyObject* pyVNodeMgr::GetNode( UInt32 id ) const +PyObject* pyVNodeMgr::GetNode( uint32_t id ) const { plVaultNode * tmp; if ( plVNodeMgr::GetNode( id, tmp ) ) diff --git a/Sources/Plasma/PythonLib/pyVault/pyVNodeMgr.h b/Sources/Plasma/PythonLib/pyVault/pyVNodeMgr.h index 07742eb7..0cbefa13 100644 --- a/Sources/Plasma/PythonLib/pyVault/pyVNodeMgr.h +++ b/Sources/Plasma/PythonLib/pyVault/pyVNodeMgr.h @@ -86,8 +86,8 @@ protected: bool IAmOnline() const; bool IIsThisMe( plVaultPlayerInfoNode* node ) const; bool IIsThisMe( plVaultPlayerNode * node ) const; - int ISendNetMsg( plNetMsgVault* msg, UInt32 sendFlags=0 ); - UInt32 IGetPlayerID() const; + int ISendNetMsg( plNetMsgVault* msg, uint32_t sendFlags=0 ); + uint32_t IGetPlayerID() const; pyVNodeMgr(): fMyComm(nil) {fMsgHandler.setMgr(this);} // for python glue only, do NOT call pyVNodeMgr( PyObject* thaComm ); @@ -120,11 +120,11 @@ public: bool IsConnected(); void Disconnect( PyObject* cb=nil, - UInt32 cbContext=0 ); + uint32_t cbContext=0 ); void Connect( int childFetchLevel=plVault::kFetchAllChildren, PyObject* cb=nil, - UInt32 cbContext=0 ); + uint32_t cbContext=0 ); // TODO: Glue this. // Fetch matching node from server and hold onto it. // Note: You won't receive notifications about the fetched node or @@ -135,19 +135,19 @@ public: // int childFetchLevel=plVault::kFetchAllChildren, // bool allowCreate = false, // PyObject* cb=nil, -// UInt32 cbContext=0 ); - bool FetchNode( UInt32 nodeID, +// uint32_t cbContext=0 ); + bool FetchNode( uint32_t nodeID, int childFetchLevel=plVault::kFetchAllChildren, PyObject* cb=nil, - UInt32 cbContext=0 ); + uint32_t cbContext=0 ); // get our root node PyObject* GetRootNode() const; // returns pyVaultNode // get the client node ID returned to us by the server ( if we didn't // fetch when we connected then we have to use this to identify ourselves ). - UInt32 GetClientID() const; + uint32_t GetClientID() const; // search all nodes in client locally - PyObject* GetNode( UInt32 id ) const; // returns pyVaultNode + PyObject* GetNode( uint32_t id ) const; // returns pyVaultNode // TODO: Glue these. PyObject* FindNode( pyVaultNode* templateNode ) const; // returns pyVaultNode // bool FindNodes( const pyVaultNode* templateNode, PyObject * out ) const; diff --git a/Sources/Tools/MaxComponent/pfGUISkinComp.cpp b/Sources/Tools/MaxComponent/pfGUISkinComp.cpp index fda33ed6..d9126f1e 100644 --- a/Sources/Tools/MaxComponent/pfGUISkinComp.cpp +++ b/Sources/Tools/MaxComponent/pfGUISkinComp.cpp @@ -199,7 +199,7 @@ void pfGUISkinEditProc::IRefreshImageBuffer( void ) { SetDIBitsToDevice( fImageDC, 0, 0, fDblWidth, fDblHeight, 0, 0, 0, fDblHeight, - ( (UInt8 *)bitInfo ) + bitInfo->bmiHeader.biSize, + ( (uint8_t *)bitInfo ) + bitInfo->bmiHeader.biSize, bitInfo, DIB_RGB_COLORS ); } @@ -348,7 +348,7 @@ bool pfGUISkinEditProc::IPointWithinHorzRange( int x, int y, int ptX1, int pt return false; } -UInt8 pfGUISkinEditProc::IGetDragTypeFlags( int x, int y ) +uint8_t pfGUISkinEditProc::IGetDragTypeFlags( int x, int y ) { // Corners if( IPointWithinRange( x, y, fCurrElemRect.left, fCurrElemRect.top ) ) @@ -719,7 +719,7 @@ INT_PTR CALLBACK pfGUISkinEditProc::DialogProc( HWND hDlg, UINT msg, WPARAM w } else { - UInt8 dragType = IGetDragTypeFlags( x, y ); + uint8_t dragType = IGetDragTypeFlags( x, y ); HCURSOR cursor; switch( dragType ) { diff --git a/Sources/Tools/MaxComponent/pfGUISkinComp.h b/Sources/Tools/MaxComponent/pfGUISkinComp.h index 488a9653..69b22e5c 100644 --- a/Sources/Tools/MaxComponent/pfGUISkinComp.h +++ b/Sources/Tools/MaxComponent/pfGUISkinComp.h @@ -65,8 +65,8 @@ public: plLayerTex *GetSkinBitmap( void ); - virtual UInt32 GetNumMtls( void ) const; - virtual Texmap *GetMtl( UInt32 idx ); + virtual uint32_t GetNumMtls( void ) const; + virtual Texmap *GetMtl( uint32_t idx ); enum { @@ -119,7 +119,7 @@ class pfGUISkinEditProc HPEN fDefPen, fOtherPen; bool fDragging; - UInt8 fDragType; + uint8_t fDragType; int fDragTimer; int fDragOffsetX, fDragOffsetY; HCURSOR fOrigCursor; @@ -152,7 +152,7 @@ class pfGUISkinEditProc kDragAll = kLeft | kTop | kRight | kBottom }; - UInt8 IGetDragTypeFlags( int x, int y ); + uint8_t IGetDragTypeFlags( int x, int y ); void IJustDrawOneRect( int whichElement, IParamBlock2 *pb, HDC hDC, HPEN whichPen, int refToIgnore ); diff --git a/Sources/Tools/MaxComponent/plAGComponents.cpp b/Sources/Tools/MaxComponent/plAGComponents.cpp index 204fa5c4..a58b9052 100644 --- a/Sources/Tools/MaxComponent/plAGComponents.cpp +++ b/Sources/Tools/MaxComponent/plAGComponents.cpp @@ -229,8 +229,8 @@ hsBool plAnimAvatarComponent::ConvertNode(plMaxNode *node, plErrorMsg *pErrMsg) if (loopName) { anim->SetLoop(true); - hsScalar loopStart = info.GetLoopStart(loopName); - hsScalar loopEnd = info.GetLoopEnd(loopName); + float loopStart = info.GetLoopStart(loopName); + float loopEnd = info.GetLoopEnd(loopName); anim->SetLoopStart(loopStart == -1 ? anim->GetStart() : loopStart); anim->SetLoopEnd(loopEnd == -1 ? anim->GetEnd() : loopEnd); } @@ -254,7 +254,7 @@ hsBool plAnimAvatarComponent::ConvertNode(plMaxNode *node, plErrorMsg *pErrMsg) // ------------- plATCAnim * plAnimAvatarComponent::NewAnimation(const char *name, double begin, double end) { - return TRACKED_NEW plATCAnim(name, begin, end); + return new plATCAnim(name, begin, end); } @@ -288,15 +288,15 @@ hsBool plAnimAvatarComponent::ConvertNodeSegmentBranch(plMaxNode *node, plAGAnim // around. Just nuke it and replace it with a constant channel. if (tmc->PurgeRedundantSubcontrollers()) { - channel = TRACKED_NEW plMatrixConstant(constSetting); + channel = new plMatrixConstant(constSetting); delete tmc; tmc = nil; } else { - channel = TRACKED_NEW plMatrixControllerChannel(tmc, &parts); + channel = new plMatrixControllerChannel(tmc, &parts); } - plMatrixChannelApplicator *app = TRACKED_NEW plMatrixChannelApplicator(); + plMatrixChannelApplicator *app = new plMatrixChannelApplicator(); app->SetChannelName(node->GetKey()->GetName()); app->SetChannel(channel); mod->AddApplicator(app); @@ -345,7 +345,7 @@ hsBool plAnimAvatarComponent::MakePersistent(plMaxNode *node, plAGAnim *anim, co { plKey animKey = hsgResMgr::ResMgr()->NewKey(animName, anim, nodeLoc); - plNodeRefMsg* refMsg = TRACKED_NEW plNodeRefMsg(sceneNodeKey, plNodeRefMsg::kOnRequest, -1, plNodeRefMsg::kGeneric); + plNodeRefMsg* refMsg = new plNodeRefMsg(sceneNodeKey, plNodeRefMsg::kOnRequest, -1, plNodeRefMsg::kGeneric); hsgResMgr::ResMgr()->AddViaNotify(animKey, refMsg, plRefFlags::kActiveRef); } @@ -457,5 +457,5 @@ hsBool plEmoteComponent::Convert(plMaxNode *node, plErrorMsg *pErrMsg) // ------------- plATCAnim * plEmoteComponent::NewAnimation(const char *name, double begin, double end) { - return TRACKED_NEW plEmoteAnim(name, begin, end, fFadeIn, fFadeOut, fBodyUsage); + return new plEmoteAnim(name, begin, end, fFadeIn, fFadeOut, fBodyUsage); } diff --git a/Sources/Tools/MaxComponent/plActivatorBaseComponent.cpp b/Sources/Tools/MaxComponent/plActivatorBaseComponent.cpp index 335006d1..6ab16de4 100644 --- a/Sources/Tools/MaxComponent/plActivatorBaseComponent.cpp +++ b/Sources/Tools/MaxComponent/plActivatorBaseComponent.cpp @@ -96,9 +96,9 @@ hsBool plActivatorBaseComponent::PreConvert(plMaxNode *node, plErrorMsg *pErrMsg plSceneObject *obj = node->GetSceneObject(); // Create and register the VolumeGadget's logic component - plLogicModifier *logic = TRACKED_NEW plLogicModifier; + plLogicModifier *logic = new plLogicModifier; plKey logicKey = hsgResMgr::ResMgr()->NewKey(IGetUniqueName(node), logic, node->GetLocation()); - hsgResMgr::ResMgr()->AddViaNotify(logicKey, TRACKED_NEW plObjRefMsg(obj->GetKey(), plRefMsg::kOnCreate, -1, plObjRefMsg::kModifier), plRefFlags::kActiveRef); + hsgResMgr::ResMgr()->AddViaNotify(logicKey, new plObjRefMsg(obj->GetKey(), plRefMsg::kOnCreate, -1, plObjRefMsg::kModifier), plRefFlags::kActiveRef); fLogicModKeys[node] = logicKey; diff --git a/Sources/Tools/MaxComponent/plAnimComponent.cpp b/Sources/Tools/MaxComponent/plAnimComponent.cpp index 62ca77ec..cf5b0c31 100644 --- a/Sources/Tools/MaxComponent/plAnimComponent.cpp +++ b/Sources/Tools/MaxComponent/plAnimComponent.cpp @@ -42,7 +42,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "HeadSpin.h" #include "resource.h" -#include "hsUtils.h" + #include "plAnimComponent.h" #include "plComponentProcBase.h" #include "plPhysicalComponents.h" @@ -580,10 +580,10 @@ hsBool plAnimGroupedComponent::PreConvert(plMaxNode *node, plErrorMsg *pErrMsg) bool needSetMaster = fNeedReset; if (fNeedReset) { - fForward = TRACKED_NEW plMsgForwarder; + fForward = new plMsgForwarder; plKey forwardKey = hsgResMgr::ResMgr()->NewKey(IGetUniqueName(node), fForward, node->GetLocation()); - plNodeRefMsg *refMsg = TRACKED_NEW plNodeRefMsg(node->GetRoomKey(), plRefMsg::kOnCreate, -1, plNodeRefMsg::kGeneric); + plNodeRefMsg *refMsg = new plNodeRefMsg(node->GetRoomKey(), plRefMsg::kOnCreate, -1, plNodeRefMsg::kGeneric); hsgResMgr::ResMgr()->AddViaNotify(forwardKey, refMsg, plRefFlags::kActiveRef); } @@ -617,7 +617,7 @@ const char *plAnimComponentBase::GetAnimName() bool IsSubworld(plMaxNode* node) { - UInt32 numComps = node->NumAttachedComponents(); + uint32_t numComps = node->NumAttachedComponents(); for (int i = 0; i < numComps; i++) { plComponentBase* comp = node->GetAttachedComponent(i); @@ -699,7 +699,7 @@ hsBool plAnimComponentBase::PreConvert(plMaxNode *node, plErrorMsg *pErrMsg) { node->AddModifier(new plAGModifier(node->GetName()), IGetUniqueName(node)); } - mod = TRACKED_NEW plAGMasterMod(); + mod = new plAGMasterMod(); plKey modKey = node->AddModifier(mod, IGetUniqueName(node)); } @@ -723,21 +723,21 @@ hsBool plAnimComponentBase::PreConvert(plMaxNode *node, plErrorMsg *pErrMsg) if (fCompPB->GetInt(ParamID(kAnimUseGlobal))) { - plAgeGlobalAnim *ageAnim = TRACKED_NEW plAgeGlobalAnim(animName, 0, 0); + plAgeGlobalAnim *ageAnim = new plAgeGlobalAnim(animName, 0, 0); ageAnim->SetGlobalVarName((char*)fCompPB->GetStr(ParamID(kAnimGlobalName))); fAnims[node] = ageAnim; } else { - plATCAnim *ATCAnim = TRACKED_NEW plATCAnim(animName, 0, 0); + plATCAnim *ATCAnim = new plATCAnim(animName, 0, 0); plNotetrackAnim noteAnim(node, pErrMsg); plAnimInfo info = noteAnim.GetAnimInfo(animName); ATCAnim->SetAutoStart(fCompPB->GetInt(kAnimAutoStart)); - hsScalar start = info.GetAnimStart(); - hsScalar end = info.GetAnimEnd(); - hsScalar initial = info.GetAnimInitial(); + float start = info.GetAnimStart(); + float end = info.GetAnimEnd(); + float initial = info.GetAnimInitial(); if (start != -1) ATCAnim->SetStart(start); if (end != -1) @@ -749,8 +749,8 @@ hsBool plAnimComponentBase::PreConvert(plMaxNode *node, plErrorMsg *pErrMsg) { ATCAnim->SetLoop(true); const char *loopName = fCompPB->GetStr(kAnimLoopName); - hsScalar loopStart = info.GetLoopStart(loopName); - hsScalar loopEnd = info.GetLoopEnd(loopName); + float loopStart = info.GetLoopStart(loopName); + float loopEnd = info.GetLoopEnd(loopName); ATCAnim->SetLoopStart(loopStart == -1 ? ATCAnim->GetStart() : loopStart); ATCAnim->SetLoopEnd(loopEnd == -1 ? ATCAnim->GetEnd() : loopEnd); @@ -787,7 +787,7 @@ hsBool plAnimComponentBase::IAddTMToAnim(plMaxNode *node, plAGAnim *anim, plErro // Get the affine parts and the TM Controller plSceneObject *obj = node->GetSceneObject(); - hsAffineParts * parts = TRACKED_NEW hsAffineParts; + hsAffineParts * parts = new hsAffineParts; plController* tmc; if (!strcmp(anim->GetName(), ENTIRE_ANIMATION_NAME)) @@ -797,9 +797,9 @@ hsBool plAnimComponentBase::IAddTMToAnim(plMaxNode *node, plAGAnim *anim, plErro if (tmc) { - plMatrixChannelApplicator *app = TRACKED_NEW plMatrixChannelApplicator(); + plMatrixChannelApplicator *app = new plMatrixChannelApplicator(); app->SetChannelName(node->GetName()); - plMatrixControllerChannel *channel = TRACKED_NEW plMatrixControllerChannel(tmc, parts); + plMatrixControllerChannel *channel = new plMatrixControllerChannel(tmc, parts); app->SetChannel(channel); anim->AddApplicator(app); if (!strcmp(anim->GetName(), ENTIRE_ANIMATION_NAME)) @@ -888,7 +888,7 @@ hsBool plAnimComponentBase::IMakePersistent(plMaxNode *node, plAGAnim *anim, plE plLocation nodeLoc = node->GetLocation(); plKey animKey = hsgResMgr::ResMgr()->NewKey(buffer, anim, nodeLoc); - plGenRefMsg* refMsg = TRACKED_NEW plGenRefMsg(mod->GetKey(), plRefMsg::kOnCreate, 0, 0); + plGenRefMsg* refMsg = new plGenRefMsg(mod->GetKey(), plRefMsg::kOnCreate, 0, 0); hsgResMgr::ResMgr()->AddViaNotify(animKey, refMsg, plRefFlags::kActiveRef); return true; @@ -932,7 +932,7 @@ hsBool plAnimComponentBase::DeInit(plMaxNode *node, plErrorMsg *pErrMsg) void plAnimComponentBase::SetupCtl( plAGAnim *anim, plController *ctl, plAGApplicator *app, plMaxNode *node ) { - plScalarControllerChannel *channel = TRACKED_NEW plScalarControllerChannel(ctl); + plScalarControllerChannel *channel = new plScalarControllerChannel(ctl); app->SetChannel(channel); anim->AddApplicator(app); if (!strcmp(anim->GetName(), ENTIRE_ANIMATION_NAME)) diff --git a/Sources/Tools/MaxComponent/plAnimEventComponent.cpp b/Sources/Tools/MaxComponent/plAnimEventComponent.cpp index a214835f..dff4715c 100644 --- a/Sources/Tools/MaxComponent/plAnimEventComponent.cpp +++ b/Sources/Tools/MaxComponent/plAnimEventComponent.cpp @@ -147,7 +147,7 @@ hsBool plAnimEventComponent::PreConvert(plMaxNode* node, plErrorMsg* pErrMsg) if (!fCanExport) return false; - plAnimEventModifier* mod = TRACKED_NEW plAnimEventModifier; + plAnimEventModifier* mod = new plAnimEventModifier; plKey modKey = node->AddModifier(mod, IGetUniqueName(node)); fLogicModKeys[node] = modKey; @@ -157,7 +157,7 @@ hsBool plAnimEventComponent::PreConvert(plMaxNode* node, plErrorMsg* pErrMsg) plEventCallbackMsg* CreateCallbackMsg(plAnimCmdMsg* animMsg, plKey modKey) { - plEventCallbackMsg *eventMsg = TRACKED_NEW plEventCallbackMsg; + plEventCallbackMsg *eventMsg = new plEventCallbackMsg; eventMsg->AddReceiver(modKey); eventMsg->fRepeats = -1; @@ -185,7 +185,7 @@ hsBool plAnimEventComponent::Convert(plMaxNode *node, plErrorMsg *pErrMsg) plKey animKey = animComp->GetModKey(animNode); const char* animName = animComp->GetAnimName(); - plAnimCmdMsg *animMsg = TRACKED_NEW plAnimCmdMsg; + plAnimCmdMsg *animMsg = new plAnimCmdMsg; animMsg->SetCmd(plAnimCmdMsg::kAddCallbacks); animMsg->SetSender(modKey); animMsg->SetAnimName(animName); @@ -459,7 +459,7 @@ hsBool plMtlEventComponent::PreConvert(plMaxNode* node, plErrorMsg* pErrMsg) if (!fCanExport) return false; - plAnimEventModifier* mod = TRACKED_NEW plAnimEventModifier; + plAnimEventModifier* mod = new plAnimEventModifier; plKey modKey = node->AddModifier(mod, IGetUniqueName(node)); fLogicModKeys[node] = modKey; @@ -488,7 +488,7 @@ hsBool plMtlEventComponent::Convert(plMaxNode *node, plErrorMsg *pErrMsg) hsTArray animKeys; GetMatAnimModKey(mtl, mtlNode, mtlAnim, animKeys); - plAnimCmdMsg *animMsg = TRACKED_NEW plAnimCmdMsg; + plAnimCmdMsg *animMsg = new plAnimCmdMsg; animMsg->SetCmd(plAnimCmdMsg::kAddCallbacks); animMsg->SetSender(modKey); animMsg->SetAnimName(mtlAnim); diff --git a/Sources/Tools/MaxComponent/plAudioComponents.cpp b/Sources/Tools/MaxComponent/plAudioComponents.cpp index 9959738d..4cc106c7 100644 --- a/Sources/Tools/MaxComponent/plAudioComponents.cpp +++ b/Sources/Tools/MaxComponent/plAudioComponents.cpp @@ -229,10 +229,10 @@ enum kSndFadeTypeExponential }; -UInt32 plBaseSoundEmitterComponent::fWarningFlags = 0; +uint32_t plBaseSoundEmitterComponent::fWarningFlags = 0; //bool plBaseSoundEmitterComponent::fAllowUnhide = false; -void plBaseSoundEmitterComponent::IShowError( UInt32 type, const char *errMsg, const char *nodeName, plErrorMsg *pErrMsg ) +void plBaseSoundEmitterComponent::IShowError( uint32_t type, const char *errMsg, const char *nodeName, plErrorMsg *pErrMsg ) { if( !( fWarningFlags & (1 << type) ) ) { @@ -310,7 +310,7 @@ IOResult plBaseSoundEmitterComponent::Save(ISave *isave) isave->BeginChunk(MAX_ASS_CHUNK); ULONG nwrite; - UInt64 id = fSoundAssetId; + uint64_t id = fSoundAssetId; res = isave->Write(&id, sizeof(id), &nwrite); if (res != IO_OK) return res; @@ -346,7 +346,7 @@ IOResult plBaseSoundEmitterComponent::Load(ILoad *iload) else if (iload->CurChunkID() == MAX_ASS_CHUNK) { ULONG nread; - UInt64 id; + uint64_t id; res = iload->Read(&id, sizeof(id), &nread); fSoundAssetId = id; res = iload->Read(&id, sizeof(id), &nread); @@ -480,17 +480,17 @@ hsBool plBaseSoundEmitterComponent::PreConvert( plMaxNode *node, plErrorMsg *pEr const plAudioInterface *ai = node->GetSceneObject()->GetAudioInterface(); if (!ai) { - ai = TRACKED_NEW plAudioInterface; + ai = new plAudioInterface; plKey pAiKey = hsgResMgr::ResMgr()->NewKey(IGetUniqueName(node), (hsKeyedObject*)ai,node->GetKey()->GetUoid().GetLocation(), node->GetLoadMask()); - hsgResMgr::ResMgr()->AddViaNotify(pAiKey, TRACKED_NEW plObjRefMsg(node->GetKey(), plRefMsg::kOnCreate, 0, plObjRefMsg::kInterface), plRefFlags::kActiveRef); + hsgResMgr::ResMgr()->AddViaNotify(pAiKey, new plObjRefMsg(node->GetKey(), plRefMsg::kOnCreate, 0, plObjRefMsg::kInterface), plRefFlags::kActiveRef); } if (!ai->GetAudible()) { - plAudible *pAudible = TRACKED_NEW plWinAudible; + plAudible *pAudible = new plWinAudible; // Add a key for it plKey key = hsgResMgr::ResMgr()->NewKey(IGetUniqueName(node), pAudible, node->GetKey()->GetUoid().GetLocation(), node->GetLoadMask()); - plIntRefMsg* pMsg = TRACKED_NEW plIntRefMsg(node->GetKey(), plRefMsg::kOnCreate, 0, plIntRefMsg::kAudible); + plIntRefMsg* pMsg = new plIntRefMsg(node->GetKey(), plRefMsg::kOnCreate, 0, plIntRefMsg::kAudible); hsgResMgr::ResMgr()->AddViaNotify(pAudible->GetKey(), pMsg, plRefFlags::kActiveRef ); pAudible->SetSceneNode(node->GetRoomKey()); @@ -509,7 +509,7 @@ void plBaseSoundEmitterComponent::IGrabFadeValues( plSound *sound ) // Fade in is enabled; set the params plSound::plFadeParams::Type type; - hsScalar len = (hsScalar)fCompPB->GetFloat( (ParamID)kSndFadeInLength, 0 ); + float len = (float)fCompPB->GetFloat( (ParamID)kSndFadeInLength, 0 ); switch( fCompPB->GetInt( (ParamID)kSndFadeInType, 0 ) ) { @@ -526,7 +526,7 @@ void plBaseSoundEmitterComponent::IGrabFadeValues( plSound *sound ) // Fade out is enabled; set the params plSound::plFadeParams::Type type; - hsScalar len = (hsScalar)fCompPB->GetFloat( (ParamID)kSndFadeOutLength, 0 ); + float len = (float)fCompPB->GetFloat( (ParamID)kSndFadeOutLength, 0 ); switch( fCompPB->GetInt( (ParamID)kSndFadeOutType, 0 ) ) { @@ -538,7 +538,7 @@ void plBaseSoundEmitterComponent::IGrabFadeValues( plSound *sound ) sound->SetFadeOutEffect( type, len ); } -// sound->SetFadedVolume( (hsScalar)fCompPB->GetFloat( kSndFadedVolume, 0 ) ); +// sound->SetFadedVolume( (float)fCompPB->GetFloat( kSndFadedVolume, 0 ) ); } void plBaseSoundEmitterComponent::IGrabSoftRegion( plSound *sound, plErrorMsg *pErrMsg ) @@ -557,7 +557,7 @@ void plBaseSoundEmitterComponent::IGrabSoftRegion( plSound *sound, plErrorMsg if( vol != nil ) { vol->SetCheckListener(); - hsgResMgr::ResMgr()->AddViaNotify( softKey, TRACKED_NEW plGenRefMsg( sound->GetKey(), plRefMsg::kOnCreate, 0, plSound::kSoftRegion ), plRefFlags::kActiveRef ); + hsgResMgr::ResMgr()->AddViaNotify( softKey, new plGenRefMsg( sound->GetKey(), plRefMsg::kOnCreate, 0, plSound::kSoftRegion ), plRefFlags::kActiveRef ); } } } @@ -569,9 +569,9 @@ void plBaseSoundEmitterComponent::IGrabSoftRegion( plSound *sound, plErrorMsg } } -UInt32 plBaseSoundEmitterComponent::ICalcSourceBufferFlags( void ) const +uint32_t plBaseSoundEmitterComponent::ICalcSourceBufferFlags( void ) const { - UInt32 bufferFlags = 0; + uint32_t bufferFlags = 0; if( IHasWaveformProps() ) { @@ -587,7 +587,7 @@ UInt32 plBaseSoundEmitterComponent::ICalcSourceBufferFlags( void ) const return bufferFlags; } -plSoundBuffer *plBaseSoundEmitterComponent::GetSourceBuffer( const char *fileName, plMaxNode *srcNode, UInt32 srcBufferFlags ) +plSoundBuffer *plBaseSoundEmitterComponent::GetSourceBuffer( const char *fileName, plMaxNode *srcNode, uint32_t srcBufferFlags ) { plSoundBuffer* sb = IGetSourceBuffer(fileName, srcNode, srcBufferFlags); @@ -611,7 +611,7 @@ plSoundBuffer *plBaseSoundEmitterComponent::GetSourceBuffer( const char *fileN return sb; } -plSoundBuffer *plBaseSoundEmitterComponent::IGetSourceBuffer( const char *fileName, plMaxNode *srcNode, UInt32 srcBufferFlags ) +plSoundBuffer *plBaseSoundEmitterComponent::IGetSourceBuffer( const char *fileName, plMaxNode *srcNode, uint32_t srcBufferFlags ) { plKey key; char keyName[ MAX_PATH ]; @@ -673,7 +673,7 @@ plSoundBuffer *plBaseSoundEmitterComponent::IGetSourceBuffer( const char *file return plSoundBuffer::ConvertNoRef( key->GetObjectPtr() ); // Not yet created, so make a new one - plSoundBuffer *buffer = TRACKED_NEW plSoundBuffer( fileName, srcBufferFlags ); + plSoundBuffer *buffer = new plSoundBuffer( fileName, srcBufferFlags ); if( !buffer->IsValid() ) { // Invalid, so delete and return nil @@ -767,7 +767,7 @@ void plBaseSoundEmitterComponent::UpdateSoundFileSelection( void ) } else { - baseBuffer = TRACKED_NEW plSoundBuffer( GetSoundFileName( kBaseSound ) ); + baseBuffer = new plSoundBuffer( GetSoundFileName( kBaseSound ) ); if( baseBuffer != nil && baseBuffer->IsValid() ) { // Update our stereo channel selection if necessary @@ -790,7 +790,7 @@ void plBaseSoundEmitterComponent::UpdateSoundFileSelection( void ) delete baseBuffer; } -hsScalar plBaseSoundEmitterComponent::GetSoundVolume( void ) const +float plBaseSoundEmitterComponent::GetSoundVolume( void ) const { return IGetDigitalVolume(); } @@ -914,7 +914,7 @@ hsBool plBaseSoundEmitterComponent::AddToAnim( plAGAnim *anim, plMaxNode *node plController *ctl; hsControlConverter& cc = hsControlConverter::Instance(); - hsScalar start, end; + float start, end; if (!strcmp(anim->GetName(), ENTIRE_ANIMATION_NAME)) { start = end = -1; @@ -936,7 +936,7 @@ hsBool plBaseSoundEmitterComponent::AddToAnim( plAGAnim *anim, plMaxNode *node } std::map::iterator i = fIndices.begin(); - plSoundVolumeApplicator *app = TRACKED_NEW plSoundVolumeApplicator( (*i).second ); + plSoundVolumeApplicator *app = new plSoundVolumeApplicator( (*i).second ); app->SetChannelName(node->GetName()); plAnimComponentBase::SetupCtl( anim, ctl, app, node ); result = true; @@ -1391,7 +1391,7 @@ class plEAXPropsDlgProc : public plSingleCompSelProc { public: char *fName; - Int16 fOcc; + int16_t fOcc; float fLFRatio; float fRoomRatio; }; @@ -1426,13 +1426,13 @@ public: // Annoyingly, the EAX headers don't have a convenient array, just some #defines static char occNames[][ 64 ] = { "Single window", "Double window", "Thin door", "Thick door", "Wood wall", "Brick wall", "Stone wall", "Curtain" }; - Int16 occValues[] = { EAX_MATERIAL_SINGLEWINDOW, EAX_MATERIAL_DOUBLEWINDOW, EAX_MATERIAL_THINDOOR, + int16_t occValues[] = { EAX_MATERIAL_SINGLEWINDOW, EAX_MATERIAL_DOUBLEWINDOW, EAX_MATERIAL_THINDOOR, EAX_MATERIAL_THICKDOOR, EAX_MATERIAL_WOODWALL, EAX_MATERIAL_BRICKWALL, EAX_MATERIAL_STONEWALL, EAX_MATERIAL_CURTAIN }; float occLFValues[] = { EAX_MATERIAL_SINGLEWINDOWLF, EAX_MATERIAL_DOUBLEWINDOWLF, EAX_MATERIAL_THINDOORLF, EAX_MATERIAL_THICKDOORLF, EAX_MATERIAL_WOODWALLLF, EAX_MATERIAL_BRICKWALLLF, EAX_MATERIAL_STONEWALLLF, EAX_MATERIAL_CURTAINLF }; - Int16 occRoomValues[] = { EAX_MATERIAL_SINGLEWINDOWROOMRATIO, EAX_MATERIAL_DOUBLEWINDOWROOMRATIO, EAX_MATERIAL_THINDOORROOMRATIO, + int16_t occRoomValues[] = { EAX_MATERIAL_SINGLEWINDOWROOMRATIO, EAX_MATERIAL_DOUBLEWINDOWROOMRATIO, EAX_MATERIAL_THINDOORROOMRATIO, EAX_MATERIAL_THICKDOORROOMRATIO, EAX_MATERIAL_WOODWALLROOMRATIO, EAX_MATERIAL_BRICKWALLROOMRATIO, EAX_MATERIAL_STONEWALLROOMRATIO, EAX_MATERIAL_CURTAINROOMRATIO }; @@ -1699,7 +1699,7 @@ void plBaseSoundEmitterComponent::IGrabEAXParams( plSound *sound, plErrorMsg if( vol != nil ) { vol->SetCheckListener(); - hsgResMgr::ResMgr()->AddViaNotify( softKey, TRACKED_NEW plGenRefMsg( sound->GetKey(), plRefMsg::kOnCreate, 0, plSound::kRefSoftOcclusionRegion ), plRefFlags::kActiveRef ); + hsgResMgr::ResMgr()->AddViaNotify( softKey, new plGenRefMsg( sound->GetKey(), plRefMsg::kOnCreate, 0, plSound::kRefSoftOcclusionRegion ), plRefFlags::kActiveRef ); } } } @@ -2191,22 +2191,22 @@ hsBool plSound3DEmitterComponent::Convert(plMaxNode *node, plErrorMsg *pErrMsg) plWin32Sound *sound = nil; if (!strcmp(node->GetName(), "LinkSoundSource")) - sound = TRACKED_NEW plWin32LinkSound; + sound = new plWin32LinkSound; else { #if 0 - sound = TRACKED_NEW plWin32StaticSound; + sound = new plWin32StaticSound; #else /// New method, still in testing: any sounds over 4 seconds get made into streaming sounds if( srcBuffer->GetDataLengthInSecs() > 4.f ) - sound = TRACKED_NEW plWin32StreamingSound; + sound = new plWin32StreamingSound; else - sound = TRACKED_NEW plWin32StaticSound; + sound = new plWin32StaticSound; } #endif hsgResMgr::ResMgr()->NewKey(keyName, sound, node->GetLocation(), node->GetLoadMask()); - hsgResMgr::ResMgr()->AddViaNotify( srcBuffer->GetKey(), TRACKED_NEW plGenRefMsg( sound->GetKey(), plRefMsg::kOnCreate, -1, plSound::kRefDataBuffer ), plRefFlags::kActiveRef ); + hsgResMgr::ResMgr()->AddViaNotify( srcBuffer->GetKey(), new plGenRefMsg( sound->GetKey(), plRefMsg::kOnCreate, -1, plSound::kRefDataBuffer ), plRefFlags::kActiveRef ); if( pAudible->AddSound( sound, fIndex, true ) ) { @@ -2232,9 +2232,9 @@ hsBool plSound3DEmitterComponent::ConvertGrouped( plMaxNode *baseNode, hsTArray // allocate it here). // Also also also build up a volume array parallel to startPoses that represents the individual volume // setting for each sound in the group - hsTArray startPoses; - hsTArray volumes; - hsLargeArray mergedData; + hsTArray startPoses; + hsTArray volumes; + hsLargeArray mergedData; int i; plWAVHeader mergedHeader; @@ -2257,7 +2257,7 @@ hsBool plSound3DEmitterComponent::ConvertGrouped( plMaxNode *baseNode, hsTArray // Grab the buffer for this sound directly from the original source const char *fileName = groupArray[ i ]->GetSoundFileName( kBaseSound ); - plSoundBuffer *buffer = TRACKED_NEW plSoundBuffer( fileName ); + plSoundBuffer *buffer = new plSoundBuffer( fileName ); if( !buffer->IsValid() || !buffer->EnsureInternal() ) { // OK, because some *cough* machines are completely stupid and don't load AssetMan scenes with @@ -2281,7 +2281,7 @@ hsBool plSound3DEmitterComponent::ConvertGrouped( plMaxNode *baseNode, hsTArray // Got a path to try, so try it! delete buffer; - buffer = TRACKED_NEW plSoundBuffer( newPath ); + buffer = new plSoundBuffer( newPath ); if( buffer->IsValid() && buffer->EnsureInternal() ) worked = true; } @@ -2323,7 +2323,7 @@ hsBool plSound3DEmitterComponent::ConvertGrouped( plMaxNode *baseNode, hsTArray // Grab the data from this buffer and merge it // HACK: SetCount() won't copy the old data over, Expand() won't up the use count, so do // an expand-and-setCount combo. - UInt32 pos = mergedData.GetCount(); + uint32_t pos = mergedData.GetCount(); startPoses.Append( pos ); mergedData.Expand( pos + buffer->GetDataLength() ); mergedData.SetCount( pos + buffer->GetDataLength() ); @@ -2347,7 +2347,7 @@ hsBool plSound3DEmitterComponent::ConvertGrouped( plMaxNode *baseNode, hsTArray plPluginResManager::ResMgr()->NukeKeyAndObject( buffKey ); // Create a new one... - plSoundBuffer *mergedBuffer = TRACKED_NEW plSoundBuffer(); + plSoundBuffer *mergedBuffer = new plSoundBuffer(); mergedBuffer->SetInternalData( mergedHeader, mergedData.GetCount(), mergedData.AcquireArray() ); mergedData.Reset(); // The buffer may be shared across multiple sources. We could or together the LoadMasks of all @@ -2362,12 +2362,12 @@ hsBool plSound3DEmitterComponent::ConvertGrouped( plMaxNode *baseNode, hsTArray plWinAudible* pAudible = (plWinAudible*)ai->GetAudible(); sprintf( keyName, "%s", GetINode()->GetName()); - plWin32GroupedSound *sound = TRACKED_NEW plWin32GroupedSound; + plWin32GroupedSound *sound = new plWin32GroupedSound; sound->SetPositionArray( startPoses.GetCount(), startPoses.AcquireArray(), volumes.AcquireArray() ); sound->SetProperty( plSound::kPropLoadOnlyOnCall, true ); hsgResMgr::ResMgr()->NewKey( keyName, sound, baseNode->GetLocation(), baseNode->GetLoadMask() ); - hsgResMgr::ResMgr()->AddViaNotify( mergedBuffer->GetKey(), TRACKED_NEW plGenRefMsg( sound->GetKey(), plRefMsg::kOnCreate, -1, plSound::kRefDataBuffer ), plRefFlags::kActiveRef ); + hsgResMgr::ResMgr()->AddViaNotify( mergedBuffer->GetKey(), new plGenRefMsg( sound->GetKey(), plRefMsg::kOnCreate, -1, plSound::kRefDataBuffer ), plRefFlags::kActiveRef ); if( pAudible->AddSound( sound, index, true ) ) { @@ -2402,7 +2402,7 @@ public: virtual hsBool IsLocalOnly( void ) const { if( fCompPB->GetInt( (ParamID)kSndIsLocalOnly ) ) return true; else return false; } protected: - virtual UInt32 ICalcSourceBufferFlags() const; + virtual uint32_t ICalcSourceBufferFlags() const; bool IValidate(plMaxNode *node, plErrorMsg *pErrMsg); virtual hsBool IGetCategoryList( char **&catList, int *&catKonstantList ); @@ -2471,9 +2471,9 @@ hsBool plBackgroundMusicComponent::SetupProperties(plMaxNode *pNode, plErrorMsg return plBaseSoundEmitterComponent::SetupProperties( pNode, pErrMsg ); } -UInt32 plBackgroundMusicComponent::ICalcSourceBufferFlags() const +uint32_t plBackgroundMusicComponent::ICalcSourceBufferFlags() const { - UInt32 ourFlags = 0; + uint32_t ourFlags = 0; if (fCompPB->GetInt(kSndStreamCompressed)) ourFlags |= plSoundBuffer::kStreamCompressed; @@ -2513,14 +2513,14 @@ hsBool plBackgroundMusicComponent::Convert(plMaxNode *node, plErrorMsg *pErrMsg) plWin32Sound *sound = nil; if( srcBuffer->GetDataLengthInSecs() > 4.f ) - sound = TRACKED_NEW plWin32StreamingSound; + sound = new plWin32StreamingSound; else - sound = TRACKED_NEW plWin32StaticSound; + sound = new plWin32StaticSound; hsgResMgr::ResMgr()->NewKey(keyName, sound, node->GetLocation(), node->GetLoadMask()); srcBuffer->SetFlag( plSoundBuffer::kAlwaysExternal ); - hsgResMgr::ResMgr()->AddViaNotify( srcBuffer->GetKey(), TRACKED_NEW plGenRefMsg( sound->GetKey(), plRefMsg::kOnCreate, -1, plSound::kRefDataBuffer ), plRefFlags::kActiveRef ); + hsgResMgr::ResMgr()->AddViaNotify( srcBuffer->GetKey(), new plGenRefMsg( sound->GetKey(), plRefMsg::kOnCreate, -1, plSound::kRefDataBuffer ), plRefFlags::kActiveRef ); if (pAudible->AddSound( sound, fIndex, false)) { @@ -2670,10 +2670,10 @@ hsBool plGUISoundComponent::Convert(plMaxNode *node, plErrorMsg *pErrMsg) char keyName[ 256 ]; sprintf( keyName, "%s_Win32GUISound", GetINode()->GetName() ); - plWin32StaticSound *sound = TRACKED_NEW plWin32StaticSound; + plWin32StaticSound *sound = new plWin32StaticSound; hsgResMgr::ResMgr()->NewKey(keyName, sound, node->GetLocation(), node->GetLoadMask()); - hsgResMgr::ResMgr()->AddViaNotify( srcBuffer->GetKey(), TRACKED_NEW plGenRefMsg( sound->GetKey(), plRefMsg::kOnCreate, -1, plSound::kRefDataBuffer ), plRefFlags::kActiveRef ); + hsgResMgr::ResMgr()->AddViaNotify( srcBuffer->GetKey(), new plGenRefMsg( sound->GetKey(), plRefMsg::kOnCreate, -1, plSound::kRefDataBuffer ), plRefFlags::kActiveRef ); if (pAudible->AddSound( sound, fIndex, false)) { @@ -2959,11 +2959,11 @@ hsBool plEAXListenerComponent::Convert(plMaxNode *node, plErrorMsg *errMsg) return true; // Create a listener mod to handle these things - plEAXListenerMod *listener = TRACKED_NEW plEAXListenerMod(); + plEAXListenerMod *listener = new plEAXListenerMod(); node->AddModifier( listener, IGetUniqueName(node) ); // Add the soft region - hsgResMgr::ResMgr()->AddViaNotify( softKey, TRACKED_NEW plGenRefMsg( listener->GetKey(), plRefMsg::kOnCreate, 0, plEAXListenerMod::kRefSoftRegion ), plRefFlags::kActiveRef ); + hsgResMgr::ResMgr()->AddViaNotify( softKey, new plGenRefMsg( listener->GetKey(), plRefMsg::kOnCreate, 0, plEAXListenerMod::kRefSoftRegion ), plRefFlags::kActiveRef ); #ifdef EAX_SDK_AVAILABLE // Set up the parameters of the listener mod @@ -3035,7 +3035,7 @@ void plEAXListenerComponent::SetCustFile( const char *path ) { char *fKeyword; ParamID fParamID; - UInt8 fType; // 0 is int, 1 is float for now + uint8_t fType; // 0 is int, 1 is float for now } myMap[] = { { "flEnvironmentSize", kRefEnvironmentSize, 1 }, { "flEnvironmentDiffusion", kRefEnvironmentDiffusion, 1 }, @@ -3379,7 +3379,7 @@ hsBool plRandomSoundComponent::ICheckForSounds(plMaxNode* node) return false; int nSounds = 0; - UInt32 numComp = node->NumAttachedComponents(false); + uint32_t numComp = node->NumAttachedComponents(false); for(int i = 0; i < numComp; i++) { plComponentBase* comp = node->GetAttachedComponent(i); @@ -3409,7 +3409,7 @@ hsBool plRandomSoundComponent::Convert(plMaxNode *node, plErrorMsg *pErrMsg) else mod->SetState(plRandomSoundMod::kStopped); - UInt8 mode = plRandomSoundMod::kNormal; + uint8_t mode = plRandomSoundMod::kNormal; switch( fCompPB->GetInt((ParamID)kSelectMode) ) { // random, repeats okay, play until stopped - Normal @@ -3468,7 +3468,7 @@ hsBool plRandomSoundComponent::Convert(plMaxNode *node, plErrorMsg *pErrMsg) pAudible = (plWinAudible*)ai->GetAudible(); hsTArray comps; - plRandomSoundModGroup *groups = TRACKED_NEW plRandomSoundModGroup[kMaxGroups]; + plRandomSoundModGroup *groups = new plRandomSoundModGroup[kMaxGroups]; int i; int numSoFar = 0; for (i = 0; i < kMaxGroups; i++) @@ -3482,9 +3482,9 @@ hsBool plRandomSoundComponent::Convert(plMaxNode *node, plErrorMsg *pErrMsg) continue; } - groups[i].fIndices = TRACKED_NEW UInt16[numSounds]; + groups[i].fIndices = new uint16_t[numSounds]; - hsTArray indices; + hsTArray indices; int j; if( !fCompPB->GetInt( (ParamID)kCombineSounds ) ) @@ -3584,7 +3584,7 @@ hsBool plRandomSoundComponent::PreConvert(plMaxNode *pNode, plErrorMsg *pErrMsg { if (ICheckForSounds(pNode)) { - plRandomSoundMod* mod = TRACKED_NEW plRandomSoundMod; + plRandomSoundMod* mod = new plRandomSoundMod; hsgResMgr::ResMgr()->NewKey(IGetUniqueName(pNode), mod, pNode->GetLocation()); fSoundMods[pNode] = mod; } @@ -3942,7 +3942,7 @@ hsBool plPhysicsSndGroupComp::Convert( plMaxNode *node, plErrorMsg *pErrMsg ) if (si) { // Create a new sound group - plPhysicalSndGroup *grp = TRACKED_NEW plPhysicalSndGroup( fCompPB->GetInt( (ParamID)kRefGroup ) ); + plPhysicalSndGroup *grp = new plPhysicalSndGroup( fCompPB->GetInt( (ParamID)kRefGroup ) ); hsgResMgr::ResMgr()->NewKey( IGetUniqueName( node ), grp, node->GetLocation(), node->GetLoadMask() ); // Convert each sound into a plWin32StaticSound and store onto the sound group @@ -4006,7 +4006,7 @@ hsBool plPhysicsSndGroupComp::Convert( plMaxNode *node, plErrorMsg *pErrMsg ) } // Attach the sound group to the physical - hsgResMgr::ResMgr()->AddViaNotify( grp->GetKey(), TRACKED_NEW plGenRefMsg( si->GetPhysical()->GetKey(), plRefMsg::kOnCreate, 0, plPXPhysical::kPhysRefSndGroup ), plRefFlags::kActiveRef ); + hsgResMgr::ResMgr()->AddViaNotify( grp->GetKey(), new plGenRefMsg( si->GetPhysical()->GetKey(), plRefMsg::kOnCreate, 0, plPXPhysical::kPhysRefSndGroup ), plRefFlags::kActiveRef ); } } diff --git a/Sources/Tools/MaxComponent/plAudioComponents.h b/Sources/Tools/MaxComponent/plAudioComponents.h index f5c5eebf..beee84c4 100644 --- a/Sources/Tools/MaxComponent/plAudioComponents.h +++ b/Sources/Tools/MaxComponent/plAudioComponents.h @@ -109,7 +109,7 @@ class plBaseSoundEmitterComponent : public plComponent return -1; } - static plSoundBuffer *GetSourceBuffer( const char *fileName, plMaxNode *node, UInt32 srcBufferFlags ); + static plSoundBuffer *GetSourceBuffer( const char *fileName, plMaxNode *node, uint32_t srcBufferFlags ); static hsBool LookupLatestAsset( const char *waveName, char *retPath, plErrorMsg *errMsg ); virtual void UpdateSoundFileSelection( void ); @@ -128,7 +128,7 @@ class plBaseSoundEmitterComponent : public plComponent void SetCreateGrouped( plMaxNode *baseNode, int commonSoundIdx ); // Grabs the current sound volume - virtual hsScalar GetSoundVolume( void ) const; + virtual float GetSoundVolume( void ) const; protected: #ifdef MAXASS_AVAILABLE @@ -139,7 +139,7 @@ class plBaseSoundEmitterComponent : public plComponent friend class plAudioBaseComponentProc; - static UInt32 fWarningFlags; + static uint32_t fWarningFlags; bool fAllowUnhide; hsBool fCreateGrouped; @@ -154,7 +154,7 @@ class plBaseSoundEmitterComponent : public plComponent void IUpdateAssets( void ); - static void IShowError( UInt32 type, const char *errMsg, const char *nodeName, plErrorMsg *pErrMsg ); + static void IShowError( uint32_t type, const char *errMsg, const char *nodeName, plErrorMsg *pErrMsg ); std::map fIndices; std::map fValidNodes; @@ -167,9 +167,9 @@ class plBaseSoundEmitterComponent : public plComponent void IGrabSoftRegion( plSound *sound, plErrorMsg *pErrMsg ); void IGrabEAXParams( plSound *sound, plErrorMsg *pErrMsg ); - virtual UInt32 ICalcSourceBufferFlags() const; + virtual uint32_t ICalcSourceBufferFlags() const; - static plSoundBuffer *IGetSourceBuffer( const char *fileName, plMaxNode *srcNode, UInt32 srcBufferFlags ); + static plSoundBuffer *IGetSourceBuffer( const char *fileName, plMaxNode *srcNode, uint32_t srcBufferFlags ); plSoundBuffer *IProcessSourceBuffer( plMaxNode *maxNode, plErrorMsg *errMsg ); diff --git a/Sources/Tools/MaxComponent/plAutoComponent.cpp b/Sources/Tools/MaxComponent/plAutoComponent.cpp index 30198459..1768d139 100644 --- a/Sources/Tools/MaxComponent/plAutoComponent.cpp +++ b/Sources/Tools/MaxComponent/plAutoComponent.cpp @@ -66,7 +66,7 @@ plAutoUIComp *gAutoUI; void DummyCode() { - gAutoUI = TRACKED_NEW plAutoUIComp(&gAutoDesc); + gAutoUI = new plAutoUIComp(&gAutoDesc); gAutoUI->AddCheckBox(0, "test", "Test", true); gAutoUI->AddFloatSpinner(1, "t2", "T2", 0.5, 0.f, 100.f); diff --git a/Sources/Tools/MaxComponent/plAutoUIBase.cpp b/Sources/Tools/MaxComponent/plAutoUIBase.cpp index 4cb2f2c7..56f707db 100644 --- a/Sources/Tools/MaxComponent/plAutoUIBase.cpp +++ b/Sources/Tools/MaxComponent/plAutoUIBase.cpp @@ -46,7 +46,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "iparamb2.h" #include "plAutoUIParams.h" -#include "hsUtils.h" + #include "resource.h" #include "plGUICompClassIDs.h" @@ -62,8 +62,8 @@ plAutoUIBase::~plAutoUIBase() { // The internal names are just pointers Max keeps to OUR copy of the string. // We'll free them here to prevent leaks - UInt16 count = fDesc->Count(); - for (UInt16 i = 0; i < count; i++) + uint16_t count = fDesc->Count(); + for (uint16_t i = 0; i < count; i++) { ParamID id = fDesc->IndextoID(i); ParamDef& def = fDesc->GetParamDef(id); @@ -84,8 +84,8 @@ plAutoUIBase::~plAutoUIBase() fDesc = nil; } - UInt32 count = fParams.size(); - for (UInt32 i = 0; i < count; i++) + uint32_t count = fParams.size(); + for (uint32_t i = 0; i < count; i++) delete fParams[i]; fParams.clear(); @@ -125,19 +125,19 @@ char *plAutoUIBase::IMakeScriptName(const char *fullName) // Setup control // -void plAutoUIBase::AddCheckBox(Int16 id, const char *scriptName, const char *name, int vid, std::vector* vstates, hsBool def) +void plAutoUIBase::AddCheckBox(int16_t id, const char *scriptName, const char *name, int vid, std::vector* vstates, hsBool def) { char *scriptNameNew = scriptName ? hsStrcpy(scriptName) : IMakeScriptName(name); fDesc->AddParam(id, scriptNameNew, TYPE_BOOL, 0, 0, p_default, def, end, end); - plAutoUIParam* param = TRACKED_NEW plCheckBoxParam(id, name); + plAutoUIParam* param = new plCheckBoxParam(id, name); param->SetVisInfo(vid, vstates); fParams.push_back(param); } -void plAutoUIBase::AddFloatSpinner(Int16 id, const char *scriptName, const char *name, int vid, std::vector* vstates, hsScalar def, hsScalar min, hsScalar max) +void plAutoUIBase::AddFloatSpinner(int16_t id, const char *scriptName, const char *name, int vid, std::vector* vstates, float def, float min, float max) { char *scriptNameNew = scriptName ? hsStrcpy(scriptName) : IMakeScriptName(name); @@ -146,12 +146,12 @@ void plAutoUIBase::AddFloatSpinner(Int16 id, const char *scriptName, const char p_range, min, max, end, end); - plAutoUIParam* param = TRACKED_NEW plSpinnerParam(id, name, true); + plAutoUIParam* param = new plSpinnerParam(id, name, true); param->SetVisInfo(vid, vstates); fParams.push_back(param); } -void plAutoUIBase::AddIntSpinner(Int16 id, const char *scriptName, const char *name, int vid, std::vector* vstates, int def, int min, int max) +void plAutoUIBase::AddIntSpinner(int16_t id, const char *scriptName, const char *name, int vid, std::vector* vstates, int def, int min, int max) { char *scriptNameNew = scriptName ? hsStrcpy(scriptName) : IMakeScriptName(name); @@ -160,259 +160,259 @@ void plAutoUIBase::AddIntSpinner(Int16 id, const char *scriptName, const char *n p_range, min, max, end, end); - plAutoUIParam* param = TRACKED_NEW plSpinnerParam(id, name, false); + plAutoUIParam* param = new plSpinnerParam(id, name, false); param->SetVisInfo(vid, vstates); fParams.push_back(param); } -void plAutoUIBase::AddEditBox(Int16 id, const char *scriptName, const char *name, int vid, std::vector* vstates, const char *def, int lines) +void plAutoUIBase::AddEditBox(int16_t id, const char *scriptName, const char *name, int vid, std::vector* vstates, const char *def, int lines) { char *scriptNameNew = scriptName ? hsStrcpy(scriptName) : IMakeScriptName(name); fDesc->AddParam(id, scriptNameNew, TYPE_STRING, 0, 0, p_default, def ? hsStrcpy(def) : nil, end, end); - plAutoUIParam* param = TRACKED_NEW plEditParam(id, name, lines); + plAutoUIParam* param = new plEditParam(id, name, lines); param->SetVisInfo(vid, vstates); fParams.push_back(param); } -void plAutoUIBase::AddPickNodeList(Int16 id, const char *scriptName, const char *name, int vid, std::vector* vstates, std::vector* filter) +void plAutoUIBase::AddPickNodeList(int16_t id, const char *scriptName, const char *name, int vid, std::vector* vstates, std::vector* filter) { char *scriptNameNew = scriptName ? hsStrcpy(scriptName) : IMakeScriptName(name); fDesc->AddParam(id, scriptNameNew, TYPE_INODE_TAB, 0, 0, 0, end, end); - plAutoUIParam* param = TRACKED_NEW plPickListParam(id, name, filter); + plAutoUIParam* param = new plPickListParam(id, name, filter); param->SetVisInfo(vid, vstates); fParams.push_back(param); } -void plAutoUIBase::AddPickNodeButton(Int16 id, const char *scriptName, const char *name, int vid, std::vector* vstates, std::vector* filter, bool canConvertToType) +void plAutoUIBase::AddPickNodeButton(int16_t id, const char *scriptName, const char *name, int vid, std::vector* vstates, std::vector* filter, bool canConvertToType) { char *scriptNameNew = scriptName ? hsStrcpy(scriptName) : IMakeScriptName(name); fDesc->AddParam(id, scriptNameNew, TYPE_INODE, 0, 0, end, end); - plAutoUIParam* param = TRACKED_NEW plPickButtonParam(id, name, filter, canConvertToType); + plAutoUIParam* param = new plPickButtonParam(id, name, filter, canConvertToType); param->SetVisInfo(vid, vstates); fParams.push_back(param); } -void plAutoUIBase::AddPickComponentButton(Int16 id, const char *scriptName, const char *name, int vid, std::vector* vstates, std::vector* filter, bool canConvertToType) +void plAutoUIBase::AddPickComponentButton(int16_t id, const char *scriptName, const char *name, int vid, std::vector* vstates, std::vector* filter, bool canConvertToType) { char *scriptNameNew = scriptName ? hsStrcpy(scriptName) : IMakeScriptName(name); fDesc->AddParam(id, scriptNameNew, TYPE_INODE, 0, 0, end, end); - plAutoUIParam* param = TRACKED_NEW plPickComponentButtonParam(id, name, filter, canConvertToType); + plAutoUIParam* param = new plPickComponentButtonParam(id, name, filter, canConvertToType); param->SetVisInfo(vid, vstates); fParams.push_back(param); } -void plAutoUIBase::AddPickComponentList(Int16 id, const char *scriptName, const char *name, int vid, std::vector* vstates, std::vector* filter) +void plAutoUIBase::AddPickComponentList(int16_t id, const char *scriptName, const char *name, int vid, std::vector* vstates, std::vector* filter) { char *scriptNameNew = scriptName ? hsStrcpy(scriptName) : IMakeScriptName(name); fDesc->AddParam(id, scriptNameNew, TYPE_INODE_TAB, 0, 0, 0, end, end); - plAutoUIParam* param = TRACKED_NEW plPickComponentListParam(id, name, filter); + plAutoUIParam* param = new plPickComponentListParam(id, name, filter); param->SetVisInfo(vid, vstates); fParams.push_back(param); } -void plAutoUIBase::AddPickActivatorButton(Int16 id, const char *scriptName, const char *name, int vid, std::vector* vstates) +void plAutoUIBase::AddPickActivatorButton(int16_t id, const char *scriptName, const char *name, int vid, std::vector* vstates) { char *scriptNameNew = scriptName ? hsStrcpy(scriptName) : IMakeScriptName(name); fDesc->AddParam(id, scriptNameNew, TYPE_INODE, 0, 0, end, end); - plAutoUIParam* param = TRACKED_NEW plPickActivatorButtonParam(id, name); + plAutoUIParam* param = new plPickActivatorButtonParam(id, name); param->SetVisInfo(vid, vstates); fParams.push_back(param); } -void plAutoUIBase::AddPickActivatorList(Int16 id, const char *scriptName, const char *name, int vid, std::vector* vstates) +void plAutoUIBase::AddPickActivatorList(int16_t id, const char *scriptName, const char *name, int vid, std::vector* vstates) { char *scriptNameNew = scriptName ? hsStrcpy(scriptName) : IMakeScriptName(name); fDesc->AddParam(id, scriptNameNew, TYPE_INODE_TAB, 0, 0, 0, end, end); - plAutoUIParam* param = TRACKED_NEW plPickActivatorListParam(id, name); + plAutoUIParam* param = new plPickActivatorListParam(id, name); param->SetVisInfo(vid, vstates); fParams.push_back(param); } -void plAutoUIBase::AddPickDynamicTextButton(Int16 id, const char *scriptName, const char *name, int vid, std::vector* vstates) +void plAutoUIBase::AddPickDynamicTextButton(int16_t id, const char *scriptName, const char *name, int vid, std::vector* vstates) { char *scriptNameNew = scriptName ? hsStrcpy(scriptName) : IMakeScriptName(name); fDesc->AddParam(id, scriptNameNew, TYPE_REFTARG, 0, 0, end, end); - plAutoUIParam* param = TRACKED_NEW plPickDynamicTextButtonParam(id, name); + plAutoUIParam* param = new plPickDynamicTextButtonParam(id, name); param->SetVisInfo(vid, vstates); fParams.push_back(param); } -void plAutoUIBase::AddPickGUIDialogButton(Int16 id, const char *scriptName, const char *name, int vid, std::vector* vstates) +void plAutoUIBase::AddPickGUIDialogButton(int16_t id, const char *scriptName, const char *name, int vid, std::vector* vstates) { char *scriptNameNew = scriptName ? hsStrcpy(scriptName) : IMakeScriptName(name); fDesc->AddParam(id, scriptNameNew, TYPE_INODE, 0, 0, end, end); - plAutoUIParam* param = TRACKED_NEW plPickSingleComponentButtonParam(id, name,plAutoUIParam::kTypeGUIDialog,GUI_DIALOG_COMP_CLASS_ID); + plAutoUIParam* param = new plPickSingleComponentButtonParam(id, name,plAutoUIParam::kTypeGUIDialog,GUI_DIALOG_COMP_CLASS_ID); param->SetVisInfo(vid, vstates); fParams.push_back(param); } -void plAutoUIBase::AddPickExcludeRegionButton(Int16 id, const char *scriptName, const char *name, int vid, std::vector* vstates) +void plAutoUIBase::AddPickExcludeRegionButton(int16_t id, const char *scriptName, const char *name, int vid, std::vector* vstates) { char *scriptNameNew = scriptName ? hsStrcpy(scriptName) : IMakeScriptName(name); fDesc->AddParam(id, scriptNameNew, TYPE_INODE, 0, 0, end, end); - plAutoUIParam* param = TRACKED_NEW plPickExcludeRegionButtonParam(id, name); + plAutoUIParam* param = new plPickExcludeRegionButtonParam(id, name); param->SetVisInfo(vid, vstates); fParams.push_back(param); } -void plAutoUIBase::AddPickWaterComponentButton(Int16 id, const char *scriptName, const char *name, int vid, std::vector* vstates) +void plAutoUIBase::AddPickWaterComponentButton(int16_t id, const char *scriptName, const char *name, int vid, std::vector* vstates) { char *scriptNameNew = scriptName ? hsStrcpy(scriptName) : IMakeScriptName(name); fDesc->AddParam(id, scriptNameNew, TYPE_INODE, 0, 0, end, end); - plAutoUIParam* param = TRACKED_NEW plPickWaterComponentButtonParam(id, name); + plAutoUIParam* param = new plPickWaterComponentButtonParam(id, name); param->SetVisInfo(vid, vstates); fParams.push_back(param); } -void plAutoUIBase::AddPickSwimCurrentInterfaceButton(Int16 id, const char *scriptName, const char *name, int vid, std::vector* vstates) +void plAutoUIBase::AddPickSwimCurrentInterfaceButton(int16_t id, const char *scriptName, const char *name, int vid, std::vector* vstates) { char *scriptNameNew = scriptName ? hsStrcpy(scriptName) : IMakeScriptName(name); fDesc->AddParam(id, scriptNameNew, TYPE_INODE, 0, 0, end, end); - plAutoUIParam* param = TRACKED_NEW plPickSwimCurrentInterfaceButtonParam(id, name); + plAutoUIParam* param = new plPickSwimCurrentInterfaceButtonParam(id, name); param->SetVisInfo(vid, vstates); fParams.push_back(param); } -void plAutoUIBase::AddPickClusterComponentButton(Int16 id, const char *scriptName, const char *name, int vid, std::vector* vstates) +void plAutoUIBase::AddPickClusterComponentButton(int16_t id, const char *scriptName, const char *name, int vid, std::vector* vstates) { char *scriptNameNew = scriptName ? hsStrcpy(scriptName) : IMakeScriptName(name); fDesc->AddParam(id, scriptNameNew, TYPE_INODE, 0, 0, end, end); - plAutoUIParam* param = TRACKED_NEW plPickClusterComponentButtonParam(id, name); + plAutoUIParam* param = new plPickClusterComponentButtonParam(id, name); param->SetVisInfo(vid, vstates); fParams.push_back(param); } -void plAutoUIBase::AddPickAnimationButton(Int16 id, const char *scriptName, const char *name, int vid, std::vector* vstates) +void plAutoUIBase::AddPickAnimationButton(int16_t id, const char *scriptName, const char *name, int vid, std::vector* vstates) { char *scriptNameNew = scriptName ? hsStrcpy(scriptName) : IMakeScriptName(name); fDesc->AddParam(id, scriptNameNew, TYPE_INODE, 0, 0, end, end); - plAutoUIParam* param = TRACKED_NEW plPickAnimationButtonParam(id, name); + plAutoUIParam* param = new plPickAnimationButtonParam(id, name); param->SetVisInfo(vid, vstates); fParams.push_back(param); } -void plAutoUIBase::AddPickBehaviorButton(Int16 id, const char *scriptName, const char *name, int vid, std::vector* vstates) +void plAutoUIBase::AddPickBehaviorButton(int16_t id, const char *scriptName, const char *name, int vid, std::vector* vstates) { char *scriptNameNew = scriptName ? hsStrcpy(scriptName) : IMakeScriptName(name); fDesc->AddParam(id, scriptNameNew, TYPE_INODE, 0, 0, end, end); - plAutoUIParam* param = TRACKED_NEW plPickBehaviorButtonParam(id, name); + plAutoUIParam* param = new plPickBehaviorButtonParam(id, name); param->SetVisInfo(vid, vstates); fParams.push_back(param); } -void plAutoUIBase::AddPickMaterialButton(Int16 id, const char *scriptName, const char *name, int vid, std::vector* vstates) +void plAutoUIBase::AddPickMaterialButton(int16_t id, const char *scriptName, const char *name, int vid, std::vector* vstates) { char *scriptNameNew = scriptName ? hsStrcpy(scriptName) : IMakeScriptName(name); fDesc->AddParam(id, scriptNameNew, TYPE_REFTARG, 0, 0, end, end); - plAutoUIParam* param = TRACKED_NEW plPickMaterialButtonParam(id, name); + plAutoUIParam* param = new plPickMaterialButtonParam(id, name); param->SetVisInfo(vid, vstates); fParams.push_back(param); } -void plAutoUIBase::AddPickMaterialAnimationButton(Int16 id, const char *scriptName, const char *name, int vid, std::vector* vstates) +void plAutoUIBase::AddPickMaterialAnimationButton(int16_t id, const char *scriptName, const char *name, int vid, std::vector* vstates) { char *scriptNameNew = scriptName ? hsStrcpy(scriptName) : IMakeScriptName(name); fDesc->AddParam(id, scriptNameNew, TYPE_REFTARG, 0, 0, end, end); - plAutoUIParam* param = TRACKED_NEW plPickMaterialAnimationButtonParam(id, name); + plAutoUIParam* param = new plPickMaterialAnimationButtonParam(id, name); param->SetVisInfo(vid, vstates); fParams.push_back(param); } -void plAutoUIBase::AddPickGUIPopUpMenuButton(Int16 id, const char *scriptName, const char *name, int vid, std::vector* vstates) +void plAutoUIBase::AddPickGUIPopUpMenuButton(int16_t id, const char *scriptName, const char *name, int vid, std::vector* vstates) { char *scriptNameNew = scriptName ? hsStrcpy(scriptName) : IMakeScriptName(name); fDesc->AddParam(id, scriptNameNew, TYPE_INODE, 0, 0, end, end); - plAutoUIParam* param = TRACKED_NEW plPickSingleComponentButtonParam(id, name,plAutoUIParam::kTypeGUIPopUpMenu,GUI_MENUANCHOR_CLASSID); + plAutoUIParam* param = new plPickSingleComponentButtonParam(id, name,plAutoUIParam::kTypeGUIPopUpMenu,GUI_MENUANCHOR_CLASSID); param->SetVisInfo(vid, vstates); fParams.push_back(param); } -void plAutoUIBase::AddPickGUISkinButton(Int16 id, const char *scriptName, const char *name, int vid, std::vector* vstates) +void plAutoUIBase::AddPickGUISkinButton(int16_t id, const char *scriptName, const char *name, int vid, std::vector* vstates) { char *scriptNameNew = scriptName ? hsStrcpy(scriptName) : IMakeScriptName(name); fDesc->AddParam(id, scriptNameNew, TYPE_INODE, 0, 0, end, end); - plAutoUIParam* param = TRACKED_NEW plPickSingleComponentButtonParam(id, name,plAutoUIParam::kTypeGUISkin,GUI_SKIN_CLASSID); + plAutoUIParam* param = new plPickSingleComponentButtonParam(id, name,plAutoUIParam::kTypeGUISkin,GUI_SKIN_CLASSID); param->SetVisInfo(vid, vstates); fParams.push_back(param); } -void plAutoUIBase::AddDropDownList(Int16 id, const char *scriptName, const char *name, int vid, std::vector* vstates, std::vector* options) +void plAutoUIBase::AddDropDownList(int16_t id, const char *scriptName, const char *name, int vid, std::vector* vstates, std::vector* options) { char *scriptNameNew = scriptName ? hsStrcpy(scriptName) : IMakeScriptName(name); fDesc->AddParam(id, scriptNameNew, TYPE_STRING, 0, 0, p_default, nil, end, end); - plAutoUIParam* param = TRACKED_NEW plDropDownListParam(id, name, options); + plAutoUIParam* param = new plDropDownListParam(id, name, options); param->SetVisInfo(vid, vstates); fParams.push_back(param); } -void plAutoUIBase::AddPickGrassComponentButton(Int16 id, const char *scriptName, const char *name, int vid, std::vector* vstates) +void plAutoUIBase::AddPickGrassComponentButton(int16_t id, const char *scriptName, const char *name, int vid, std::vector* vstates) { char *scriptNameNew = scriptName ? hsStrcpy(scriptName) : IMakeScriptName(name); fDesc->AddParam(id, scriptNameNew, TYPE_INODE, 0, 0, end, end); - plAutoUIParam* param = TRACKED_NEW plPickGrassComponentButtonParam(id, name); + plAutoUIParam* param = new plPickGrassComponentButtonParam(id, name); param->SetVisInfo(vid, vstates); fParams.push_back(param); } @@ -443,8 +443,8 @@ BOOL plAutoUIBase::DlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam) PostMessage(fhDlg, WM_SIZE_PANEL, 0, 0); } - UInt32 count = fParams.size(); - for (UInt32 i = 0; i < count; i++) + uint32_t count = fParams.size(); + for (uint32_t i = 0; i < count; i++) { if (fParams[i]->IsMyMessage(msg, wParam, lParam, fPBlock)) { @@ -457,7 +457,7 @@ BOOL plAutoUIBase::DlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam) // We now have the id and current state of the drop-down list that changed // so now we need to update the visible state of the controls - for (UInt32 idx = 0; idx < fParams.size(); idx++) + for (uint32_t idx = 0; idx < fParams.size(); idx++) { plAutoUIParam* par = fParams[idx]; @@ -490,7 +490,7 @@ BOOL plAutoUIBase::DlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam) // Ok, this sucks but I don't know of a better way at this point // We need to intialize the visible state of the controls, and the only way to do this // is by looping through and finding all of the drop-down lists - for (UInt32 i = 0; i < fParams.size(); i++) + for (uint32_t i = 0; i < fParams.size(); i++) { if (fParams[i]->GetParamType() == plAutoUIParam::kTypeDropDownList) { @@ -505,7 +505,7 @@ BOOL plAutoUIBase::DlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam) // We now have the id and current state of the drop-down list that changed // so now we need to update the visible state of the controls - for (UInt32 idx = 0; idx < fParams.size(); idx++) + for (uint32_t idx = 0; idx < fParams.size(); idx++) { if (fParams[idx]->CheckVisibility(id, str)) { @@ -538,8 +538,8 @@ void plAutoUIBase::ICreateControls() { int yOffset = 10; - UInt32 count = fParams.size(); - for (UInt32 i = 0; i < count; i++) + uint32_t count = fParams.size(); + for (uint32_t i = 0; i < count; i++) yOffset = fParams[i]->Create(fhDlg, fPBlock, yOffset)+5; //yOffset = fParams[i]->CreateControls(fhDlg, fPBlock, yOffset)+5; diff --git a/Sources/Tools/MaxComponent/plAutoUIBase.h b/Sources/Tools/MaxComponent/plAutoUIBase.h index 35acda25..0d9e6d4c 100644 --- a/Sources/Tools/MaxComponent/plAutoUIBase.h +++ b/Sources/Tools/MaxComponent/plAutoUIBase.h @@ -46,8 +46,8 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com //#include "plComponentBase.h" //#include "plComponentReg.h" -#include "hsTypes.h" -#include "hsWindows.h" +#include "HeadSpin.h" + #include class ParamBlockDesc2; @@ -81,47 +81,47 @@ public: // // 'scriptName' is a MaxScript visible name. Here's what the help file says: // "They should begin with an alpha character, have only alphanumerics, and have no - // spaces, punctuations, etc. The convention for multi-word names is to use + // spaces, punctuations, etc. The convention for multi-uint16_t names is to use // studly-caps, eg, paintRadius." // (Note: if this is nil, one will be generated from 'name'.) // // 'name' is the name that will show up in the user interface (a copy is made, so you // can free the pointer after this function returns if it was allocated) // - void AddCheckBox (Int16 id, const char *scriptName, const char *name, int vid, std::vector* vstates, + void AddCheckBox (int16_t id, const char *scriptName, const char *name, int vid, std::vector* vstates, hsBool def=false); - void AddFloatSpinner(Int16 id, const char *scriptName, const char *name, int vid, std::vector* vstates, - hsScalar def=0.f, hsScalar min=0.f, hsScalar max=1.f); - void AddIntSpinner (Int16 id, const char *scriptName, const char *name, int vid, std::vector* vstates, + void AddFloatSpinner(int16_t id, const char *scriptName, const char *name, int vid, std::vector* vstates, + float def=0.f, float min=0.f, float max=1.f); + void AddIntSpinner (int16_t id, const char *scriptName, const char *name, int vid, std::vector* vstates, int def=1, int min=0, int max=1); - void AddEditBox (Int16 id, const char *scriptName, const char *name, int vid, std::vector* vstates, + void AddEditBox (int16_t id, const char *scriptName, const char *name, int vid, std::vector* vstates, const char *def=nil, int lines=1); - void AddPickNodeList(Int16 id, const char *scriptName, const char *name, int vid, std::vector* vstates, + void AddPickNodeList(int16_t id, const char *scriptName, const char *name, int vid, std::vector* vstates, std::vector* filter=nil); - void AddPickNodeButton(Int16 id, const char *scriptName, const char *name, int vid, std::vector* vstates, + void AddPickNodeButton(int16_t id, const char *scriptName, const char *name, int vid, std::vector* vstates, std::vector* filter=nil, bool canConvertToType=false); - void AddPickComponentButton(Int16 id, const char *scriptName, const char *name, int vid, std::vector* vstates, + void AddPickComponentButton(int16_t id, const char *scriptName, const char *name, int vid, std::vector* vstates, std::vector* filter=nil, bool canConvertToType=false); - void AddPickComponentList(Int16 id, const char *scriptName, const char *name, int vid, std::vector* vstates, + void AddPickComponentList(int16_t id, const char *scriptName, const char *name, int vid, std::vector* vstates, std::vector* filter=nil); - void AddPickActivatorList(Int16 id, const char *scriptName, const char *name, int vid, std::vector* vstates); - void AddPickActivatorButton(Int16 id, const char *scriptName, const char *name, int vid, std::vector* vstates); - void AddPickDynamicTextButton(Int16 id, const char *scriptName, const char *name, int vid, std::vector* vstates); - void AddPickGUIDialogButton(Int16 id, const char *scriptName, const char *name, int vid, std::vector* vstates); - void AddPickExcludeRegionButton(Int16 id, const char *scriptName, const char *name, int vid, std::vector* vstates); - void AddPickAnimationButton(Int16 id, const char *scriptName, const char *name, int vid, std::vector* vstates); - void AddPickBehaviorButton(Int16 id, const char *scriptName, const char *name, int vid, std::vector* vstates); - void AddPickMaterialButton(Int16 id, const char *scriptName, const char *name, int vid, std::vector* vstates); - void AddPickMaterialAnimationButton(Int16 id, const char *scriptName, const char *name, int vid, std::vector* vstates); - void AddPickWaterComponentButton(Int16 id, const char *scriptName, const char *name, int vid, std::vector* vstates); - void AddPickSwimCurrentInterfaceButton(Int16 id, const char *scriptName, const char *name, int vid, std::vector* vstates); - void AddPickClusterComponentButton(Int16 id, const char *scriptName, const char *name, int vid, std::vector* vstates); - - void AddPickGUIPopUpMenuButton(Int16 id, const char *scriptName, const char *name, int vid, std::vector* vstates); - void AddPickGUISkinButton(Int16 id, const char *scriptName, const char *name, int vid, std::vector* vstates); + void AddPickActivatorList(int16_t id, const char *scriptName, const char *name, int vid, std::vector* vstates); + void AddPickActivatorButton(int16_t id, const char *scriptName, const char *name, int vid, std::vector* vstates); + void AddPickDynamicTextButton(int16_t id, const char *scriptName, const char *name, int vid, std::vector* vstates); + void AddPickGUIDialogButton(int16_t id, const char *scriptName, const char *name, int vid, std::vector* vstates); + void AddPickExcludeRegionButton(int16_t id, const char *scriptName, const char *name, int vid, std::vector* vstates); + void AddPickAnimationButton(int16_t id, const char *scriptName, const char *name, int vid, std::vector* vstates); + void AddPickBehaviorButton(int16_t id, const char *scriptName, const char *name, int vid, std::vector* vstates); + void AddPickMaterialButton(int16_t id, const char *scriptName, const char *name, int vid, std::vector* vstates); + void AddPickMaterialAnimationButton(int16_t id, const char *scriptName, const char *name, int vid, std::vector* vstates); + void AddPickWaterComponentButton(int16_t id, const char *scriptName, const char *name, int vid, std::vector* vstates); + void AddPickSwimCurrentInterfaceButton(int16_t id, const char *scriptName, const char *name, int vid, std::vector* vstates); + void AddPickClusterComponentButton(int16_t id, const char *scriptName, const char *name, int vid, std::vector* vstates); + + void AddPickGUIPopUpMenuButton(int16_t id, const char *scriptName, const char *name, int vid, std::vector* vstates); + void AddPickGUISkinButton(int16_t id, const char *scriptName, const char *name, int vid, std::vector* vstates); - void AddDropDownList(Int16 id, const char *scriptName, const char *name, int vid, std::vector* vstates, std::vector* options = nil); - void AddPickGrassComponentButton(Int16 id, const char *scriptName, const char *name, int vid, std::vector* vstates); + void AddDropDownList(int16_t id, const char *scriptName, const char *name, int vid, std::vector* vstates, std::vector* options = nil); + void AddPickGrassComponentButton(int16_t id, const char *scriptName, const char *name, int vid, std::vector* vstates); void CreateAutoRollup(IParamBlock2 *pb); void DestroyAutoRollup(); diff --git a/Sources/Tools/MaxComponent/plAutoUIBlock.cpp b/Sources/Tools/MaxComponent/plAutoUIBlock.cpp index 6b4ef318..767704ab 100644 --- a/Sources/Tools/MaxComponent/plAutoUIBlock.cpp +++ b/Sources/Tools/MaxComponent/plAutoUIBlock.cpp @@ -46,14 +46,14 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "iparamb2.h" #include "plComponentReg.h" -#include "hsUtils.h" + #include "resource.h" plAutoUIBlock::plAutoUIBlock(plComponentClassDesc *cd, int blockID, const char *name, int version) { fName = hsStrcpy(name); fVersion = version; - fDesc = TRACKED_NEW ParamBlockDesc2(blockID, "Auto", IDS_COMP_AUTO, cd, 0, end); + fDesc = new ParamBlockDesc2(blockID, "Auto", IDS_COMP_AUTO, cd, 0, end); fIsMultiModifier = false; } diff --git a/Sources/Tools/MaxComponent/plAutoUIComp.cpp b/Sources/Tools/MaxComponent/plAutoUIComp.cpp index 8d8c6a6e..e61415f9 100644 --- a/Sources/Tools/MaxComponent/plAutoUIComp.cpp +++ b/Sources/Tools/MaxComponent/plAutoUIComp.cpp @@ -52,7 +52,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com plAutoUIComp::plAutoUIComp(plAutoUIClassDesc *cd) { - fDesc = TRACKED_NEW ParamBlockDesc2(plComponentBase::kBlkComp, "Auto", IDS_COMP_AUTO, cd, P_AUTO_CONSTRUCT, plComponentBase::kRefComp, end); + fDesc = new ParamBlockDesc2(plComponentBase::kBlkComp, "Auto", IDS_COMP_AUTO, cd, P_AUTO_CONSTRUCT, plComponentBase::kRefComp, end); cd->autoComp = this; } @@ -60,37 +60,37 @@ plAutoUIComp::plAutoUIComp(plAutoUIClassDesc *cd) // Get value from control // -hsBool plAutoUIComp::GetCheckBox(Int16 id, plComponentBase *comp) +hsBool plAutoUIComp::GetCheckBox(int16_t id, plComponentBase *comp) { IParamBlock2 *pblock = comp->GetParamBlockByID(plComponentBase::kBlkComp); return pblock->GetInt(id); } -hsScalar plAutoUIComp::GetFloatSpinner(Int16 id, plComponentBase *comp) +float plAutoUIComp::GetFloatSpinner(int16_t id, plComponentBase *comp) { IParamBlock2 *pblock = comp->GetParamBlockByID(plComponentBase::kBlkComp); return pblock->GetFloat(id); } -int plAutoUIComp::GetIntSpinner(Int16 id, plComponentBase *comp) +int plAutoUIComp::GetIntSpinner(int16_t id, plComponentBase *comp) { IParamBlock2 *pblock = comp->GetParamBlockByID(plComponentBase::kBlkComp); return pblock->GetInt(id); } -TSTR plAutoUIComp::GetEditBox(Int16 id, plComponentBase *comp) +TSTR plAutoUIComp::GetEditBox(int16_t id, plComponentBase *comp) { IParamBlock2 *pblock = comp->GetParamBlockByID(plComponentBase::kBlkComp); return pblock->GetStr(id); } -INode *plAutoUIComp::GetPickNode(Int16 id, plComponentBase *comp, int idx) +INode *plAutoUIComp::GetPickNode(int16_t id, plComponentBase *comp, int idx) { IParamBlock2 *pblock = comp->GetParamBlockByID(plComponentBase::kBlkComp); return pblock->GetINode(id, 0, idx); } -int plAutoUIComp::Count(Int16 id, plComponentBase *comp) +int plAutoUIComp::Count(int16_t id, plComponentBase *comp) { IParamBlock2 *pblock = comp->GetParamBlockByID(plComponentBase::kBlkComp); return pblock->Count(id); diff --git a/Sources/Tools/MaxComponent/plAutoUIComp.h b/Sources/Tools/MaxComponent/plAutoUIComp.h index 55d78a55..6672f330 100644 --- a/Sources/Tools/MaxComponent/plAutoUIComp.h +++ b/Sources/Tools/MaxComponent/plAutoUIComp.h @@ -53,14 +53,14 @@ public: ///////////////////////////////////////////////////////////////////////////////////// // Get the value of a control. Pass in the id and your 'this' pointer. // - hsBool GetCheckBox(Int16 id, plComponentBase *comp); - hsScalar GetFloatSpinner(Int16 id, plComponentBase *comp); - int GetIntSpinner(Int16 id, plComponentBase *comp); - TSTR GetEditBox(Int16 id, plComponentBase *comp); - INode* GetPickNode(Int16 id, plComponentBase *comp, int idx); + hsBool GetCheckBox(int16_t id, plComponentBase *comp); + float GetFloatSpinner(int16_t id, plComponentBase *comp); + int GetIntSpinner(int16_t id, plComponentBase *comp); + TSTR GetEditBox(int16_t id, plComponentBase *comp); + INode* GetPickNode(int16_t id, plComponentBase *comp, int idx); // Get the count for a parameter that takes an index - int Count(Int16 id, plComponentBase *comp); + int Count(int16_t id, plComponentBase *comp); ///////////////////////////////////////////////////////////////////////////////////// // Max/internal functions diff --git a/Sources/Tools/MaxComponent/plAutoUIParams.cpp b/Sources/Tools/MaxComponent/plAutoUIParams.cpp index 16fcc34d..d586b7f5 100644 --- a/Sources/Tools/MaxComponent/plAutoUIParams.cpp +++ b/Sources/Tools/MaxComponent/plAutoUIParams.cpp @@ -43,7 +43,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "plAutoUIParams.h" #include "MaxMain/plMaxAccelerators.h" -#include "hsUtils.h" + #include #include "MaxMain/plMaxNode.h" #include "plComponentBase.h" @@ -417,7 +417,7 @@ bool plEditParam::IsMyMessage(UINT msg, WPARAM wParam, LPARAM lParam, IParamBloc int len = GetWindowTextLength(fhEdit)+1; if (len > 1) { - char *buf = TRACKED_NEW char[len]; + char *buf = new char[len]; GetWindowText(fhEdit, buf, len); pb->SetValue(fID, 0, buf); delete [] buf; @@ -1724,7 +1724,7 @@ bool plDropDownListParam::IsMyMessage(UINT msg, WPARAM wParam, LPARAM lParam, IP if (idx >=0 && idx < fOptions.size()) { - char* buf = TRACKED_NEW char[fOptions[idx].size() + 1]; + char* buf = new char[fOptions[idx].size() + 1]; strcpy(buf, fOptions[idx].c_str()); pb->SetValue(fID, 0, buf); delete [] buf; diff --git a/Sources/Tools/MaxComponent/plAutoUIParams.h b/Sources/Tools/MaxComponent/plAutoUIParams.h index 1ad5bc21..8b0c3731 100644 --- a/Sources/Tools/MaxComponent/plAutoUIParams.h +++ b/Sources/Tools/MaxComponent/plAutoUIParams.h @@ -41,7 +41,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ #include "max.h" #include "iparamb2.h" -#include "hsTypes.h" +#include "HeadSpin.h" #include "hsTemplates.h" #include diff --git a/Sources/Tools/MaxComponent/plAvatarComponent.cpp b/Sources/Tools/MaxComponent/plAvatarComponent.cpp index 1752188f..09883a82 100644 --- a/Sources/Tools/MaxComponent/plAvatarComponent.cpp +++ b/Sources/Tools/MaxComponent/plAvatarComponent.cpp @@ -124,7 +124,7 @@ class plCritterCommands; plArmatureMod* plArmatureComponent::IGenerateMyArmMod(plHKPhysical* myHKPhys, plMaxNode* node) { - plArmatureMod *avMod = TRACKED_NEW plArmatureMod(); + plArmatureMod *avMod = new plArmatureMod(); avMod->SetRootName(node->GetKey()->GetName()); return avMod; } @@ -216,17 +216,17 @@ void plArmatureComponent::ISetArmatureSORecurse(plMaxNode *node, plSceneObject * hsBool plArmatureComponent::PreConvert(plMaxNode* node, plErrorMsg* pErrMsg) { // add audio interface and record/playback component - pl2WayWinAudible* pAudible = TRACKED_NEW pl2WayWinAudible; + pl2WayWinAudible* pAudible = new pl2WayWinAudible; // Add a key for it plKey key = hsgResMgr::ResMgr()->NewKey(IGetUniqueName(node), pAudible, node->GetLocation() ); - plAudioInterface* ai = TRACKED_NEW plAudioInterface; + plAudioInterface* ai = new plAudioInterface; plKey pAiKey = hsgResMgr::ResMgr()->NewKey(IGetUniqueName(node), (hsKeyedObject*)ai,node->GetLocation()); - hsgResMgr::ResMgr()->AddViaNotify(pAiKey, TRACKED_NEW plObjRefMsg(node->GetKey(), plRefMsg::kOnCreate, 0, plObjRefMsg::kInterface), plRefFlags::kActiveRef); + hsgResMgr::ResMgr()->AddViaNotify(pAiKey, new plObjRefMsg(node->GetKey(), plRefMsg::kOnCreate, 0, plObjRefMsg::kInterface), plRefFlags::kActiveRef); - plIntRefMsg* pMsg = TRACKED_NEW plIntRefMsg(node->GetKey(), plRefMsg::kOnCreate, 0, plIntRefMsg::kAudible); + plIntRefMsg* pMsg = new plIntRefMsg(node->GetKey(), plRefMsg::kOnCreate, 0, plIntRefMsg::kAudible); hsgResMgr::ResMgr()->AddViaNotify(pAudible->GetKey(), pMsg, plRefFlags::kActiveRef ); ISetArmatureSORecurse(node, node->GetSceneObject()); @@ -248,9 +248,9 @@ hsBool plArmatureComponent::Convert(plMaxNode* node, plErrorMsg *pErrMsg) ISetupClothes(node, fArmMod, pErrMsg); // ArmatureEffects - plArmatureEffectsMgr *effects = TRACKED_NEW plArmatureEffectsMgr(); + plArmatureEffectsMgr *effects = new plArmatureEffectsMgr(); hsgResMgr::ResMgr()->NewKey(IGetUniqueName(node), effects, node->GetLocation()); - plGenRefMsg *msg = TRACKED_NEW plGenRefMsg(fArmMod->GetKey(), plRefMsg::kOnCreate, -1, -1); + plGenRefMsg *msg = new plGenRefMsg(fArmMod->GetKey(), plRefMsg::kOnCreate, -1, -1); hsgResMgr::ResMgr()->AddViaNotify(effects->GetKey(), msg, plRefFlags::kActiveRef); // Attach effects plSceneObject *obj = node->GetSceneObject(); @@ -264,7 +264,7 @@ hsBool plArmatureComponent::Convert(plMaxNode* node, plErrorMsg *pErrMsg) { // MakeCharacterHierarchy will attach agmodifiers to all the bones in the hierarchy; // have to manually add any for non-bone objects... - agMod = TRACKED_NEW plAGModifier("Handle"); // the player root is known as the handle + agMod = new plAGModifier("Handle"); // the player root is known as the handle node->AddModifier(agMod, IGetUniqueName(node)); } @@ -462,7 +462,7 @@ void plAvatarComponent::IAttachModifiers(plMaxNode *node, plErrorMsg *pErrMsg) plSceneObject * bodySO = node->GetSceneObject(); - plArmatureMod* avMod = TRACKED_NEW plArmatureMod(); + plArmatureMod* avMod = new plArmatureMod(); avMod->SetRootName(name); avMod->AppendMeshKey(meshKey); int skeletonType = fCompPB->GetInt(ParamID(kSkeleton)); @@ -470,9 +470,9 @@ void plAvatarComponent::IAttachModifiers(plMaxNode *node, plErrorMsg *pErrMsg) // only make a human brain if we're a human if (skeletonType == plArmatureMod::kBoneBaseCritter) - avMod->PushBrain(TRACKED_NEW plAvBrainCritter()); + avMod->PushBrain(new plAvBrainCritter()); else - avMod->PushBrain(TRACKED_NEW plAvBrainHuman(skeletonType == plArmatureMod::kBoneBaseActor)); + avMod->PushBrain(new plAvBrainHuman(skeletonType == plArmatureMod::kBoneBaseActor)); avMod->SetBodyAgeName(node->GetAgeName()); avMod->SetBodyFootstepSoundPage(fCompPB->GetStr(ParamID(kBodyFootstepSoundPage))); @@ -481,7 +481,7 @@ void plAvatarComponent::IAttachModifiers(plMaxNode *node, plErrorMsg *pErrMsg) //AddLinkSound(node, node->GetSceneObject()->GetKey(), pErrMsg ); plKey avKey = hsgResMgr::ResMgr()->NewKey(IGetUniqueName(node), avMod, node->GetLocation()); - plObjRefMsg *objRefMsg = TRACKED_NEW plObjRefMsg(bodySO->GetKey(), plRefMsg::kOnCreate,-1, plObjRefMsg::kModifier); + plObjRefMsg *objRefMsg = new plObjRefMsg(bodySO->GetKey(), plRefMsg::kOnCreate,-1, plObjRefMsg::kModifier); hsgResMgr::ResMgr()->AddViaNotify(avKey, objRefMsg, plRefFlags::kActiveRef); fArmMod = avMod; @@ -501,7 +501,7 @@ void AddClothingToMod(plMaxNode *node, plArmatureMod *mod, int group, hsGMateria return; } - plClothingBase *base = TRACKED_NEW plClothingBase(); + plClothingBase *base = new plClothingBase(); if (node->GetUserPropString("layout", sdata)) { toker.Reset(sdata, hsConverterUtils::fTagSeps); @@ -511,14 +511,14 @@ void AddClothingToMod(plMaxNode *node, plArmatureMod *mod, int group, hsGMateria base->SetLayoutName("BasicHuman"); sprintf(keyName, "%s_ClothingBase", node->GetName()); hsgResMgr::ResMgr()->NewKey(keyName, base, node->GetLocation()); - plClothingOutfit *outfit = TRACKED_NEW plClothingOutfit(); + plClothingOutfit *outfit = new plClothingOutfit(); outfit->fGroup = group; sprintf(keyName, "%s_outfit", mod->GetKey()->GetName()); hsgResMgr::ResMgr()->NewKey(keyName, outfit, node->GetLocation()); - msg = TRACKED_NEW plGenRefMsg(outfit->GetKey(), plRefMsg::kOnCreate, -1, -1); + msg = new plGenRefMsg(outfit->GetKey(), plRefMsg::kOnCreate, -1, -1); hsgResMgr::ResMgr()->AddViaNotify(base->GetKey(), msg, plRefFlags::kActiveRef); // Add clothing base to outfit - msg = TRACKED_NEW plGenRefMsg(mod->GetKey(), plRefMsg::kOnCreate, -1, -1); + msg = new plGenRefMsg(mod->GetKey(), plRefMsg::kOnCreate, -1, -1); hsgResMgr::ResMgr()->AddViaNotify(outfit->GetKey(), msg, plRefFlags::kActiveRef); // Attach outfit @@ -542,14 +542,14 @@ void AddClothingToMod(plMaxNode *node, plArmatureMod *mod, int group, hsGMateria // The tex is what the outfit and the material hold onto. It's what // gets rendered. The base will hang onto the original baseTex. - msg = TRACKED_NEW plGenRefMsg(base->GetKey(), plRefMsg::kOnCreate, -1, -1); + msg = new plGenRefMsg(base->GetKey(), plRefMsg::kOnCreate, -1, -1); hsgResMgr::ResMgr()->SendRef(baseTex->GetKey(), msg, plRefFlags::kActiveRef); // Set base texture of avatar - plLayRefMsg* layRef = TRACKED_NEW plLayRefMsg(li->GetKey(), plRefMsg::kOnRemove, 0, plLayRefMsg::kTexture); + plLayRefMsg* layRef = new plLayRefMsg(li->GetKey(), plRefMsg::kOnRemove, 0, plLayRefMsg::kTexture); hsgResMgr::ResMgr()->SendRef(baseTex->GetKey(), layRef, plRefFlags::kActiveRef); // Remove it from the material - msg = TRACKED_NEW plGenRefMsg(outfit->GetKey(), plRefMsg::kOnCreate, -1, -1); + msg = new plGenRefMsg(outfit->GetKey(), plRefMsg::kOnCreate, -1, -1); hsgResMgr::ResMgr()->AddViaNotify(li->GetKey(), msg, plRefFlags::kActiveRef); // Set outfit's target layer interface - msg = TRACKED_NEW plGenRefMsg(outfit->GetKey(), plRefMsg::kOnCreate, -1, -1); + msg = new plGenRefMsg(outfit->GetKey(), plRefMsg::kOnCreate, -1, -1); hsgResMgr::ResMgr()->AddViaNotify(mat->GetKey(), msg, plRefFlags::kActiveRef); // Outfit needs the material } else @@ -689,7 +689,7 @@ hsBool plCompoundCtrlComponent::Convert(plMaxNode* node, plErrorMsg *pErrMsg) // create and register the player modifier - plAGMasterMod *agMaster = TRACKED_NEW plAGMasterMod(); + plAGMasterMod *agMaster = new plAGMasterMod(); node->AddModifier(agMaster, IGetUniqueName(node)); return true; @@ -1055,14 +1055,14 @@ void plLODAvatarComponent::IAttachModifiers( plMaxNode *node, plErrorMsg *pEr const char *avatarName = node->GetKey()->GetName(); plMaxNode *animRoot = (plMaxNode *)fCompPB->GetINode(plLODAvatarComponent::kRootNodeAddBtn); plKey animRootKey = animRoot->GetSceneObject()->GetKey(); - plArmatureLODMod* avMod = TRACKED_NEW plArmatureLODMod(avatarName); + plArmatureLODMod* avMod = new plArmatureLODMod(avatarName); int skeletonType = fCompPB->GetInt(ParamID(kSkeleton)); avMod->SetBodyType( skeletonType ); if (skeletonType == plArmatureLODMod::kBoneBaseCritter) - avMod->PushBrain(TRACKED_NEW plAvBrainCritter()); + avMod->PushBrain(new plAvBrainCritter()); else - avMod->PushBrain(TRACKED_NEW plAvBrainHuman(skeletonType == plArmatureMod::kBoneBaseActor)); + avMod->PushBrain(new plAvBrainHuman(skeletonType == plArmatureMod::kBoneBaseActor)); avMod->SetBodyAgeName(node->GetAgeName()); avMod->SetBodyFootstepSoundPage(fCompPB->GetStr(ParamID(kBodyFootstepSoundPage))); @@ -1136,7 +1136,7 @@ hsBool plLODAvatarComponent::Convert(plMaxNode* node, plErrorMsg* pErrMsg) for (i = 0; i < kMaxNumLODLevels; i++) { int numBones = fCompPB->GetInt(ParamID(kGroupTotals), 0, i); - plKeyVector *keyVec = TRACKED_NEW plKeyVector; + plKeyVector *keyVec = new plKeyVector; int j; for (j = 0; j < numBones; j++) @@ -1176,7 +1176,7 @@ void plLODAvatarComponent::IAttachShadowCastModifiersRecur(plMaxNode* node, plSh void plLODAvatarComponent::IAttachShadowCastToLODs(plMaxNode* rootNode) { - plShadowCaster* caster = TRACKED_NEW plShadowCaster; + plShadowCaster* caster = new plShadowCaster; hsgResMgr::ResMgr()->NewKey(IGetUniqueName(rootNode), caster, rootNode->GetLocation()); caster->SetSelfShadow(true); diff --git a/Sources/Tools/MaxComponent/plBehavioralComponents.cpp b/Sources/Tools/MaxComponent/plBehavioralComponents.cpp index 67a3b5d2..5c174b21 100644 --- a/Sources/Tools/MaxComponent/plBehavioralComponents.cpp +++ b/Sources/Tools/MaxComponent/plBehavioralComponents.cpp @@ -155,7 +155,7 @@ hsBool plAvBehaviorSittingComponent::PreConvert(plMaxNode* node, plErrorMsg* pEr bool hasRightApproach = fCompPB->GetInt(ParamID(kApproachRight)) ? true : false; // Create our key here and give it to the detector so it will notify us - plSittingModifier *sitMod = TRACKED_NEW plSittingModifier(hasFrontApproach, hasLeftApproach, hasRightApproach); + plSittingModifier *sitMod = new plSittingModifier(hasFrontApproach, hasLeftApproach, hasRightApproach); if (fCompPB->GetInt(ParamID(kDisableForward))) sitMod->fMiscFlags |= plSittingModifier::kDisableForward; diff --git a/Sources/Tools/MaxComponent/plBipedKiller.cpp b/Sources/Tools/MaxComponent/plBipedKiller.cpp index f0bf739d..375603a3 100644 --- a/Sources/Tools/MaxComponent/plBipedKiller.cpp +++ b/Sources/Tools/MaxComponent/plBipedKiller.cpp @@ -104,11 +104,11 @@ void ProcessBipedNodeRecurse(INode *bipNode, INode *newParent, Interface *theInt void ProcessNonBipedNodeRecurse(INode *node, INode *parent, Interface *theInterface); int LimitTransform(INode* node, Matrix3* nodeTM); -void GetParts(Int32 i, std::vector& mat3Array, hsAffineParts* parts); +void GetParts(int32_t i, std::vector& mat3Array, hsAffineParts* parts); -Quat GetRotKey(Int32 i, std::vector& mat3Array, hsAffineParts* parts); -Point3 GetPosKey(Int32 i, std::vector& mat3Array, hsAffineParts* parts); -ScaleValue GetScaleKey(Int32 i, std::vector& mat3Array, hsAffineParts* parts); +Quat GetRotKey(int32_t i, std::vector& mat3Array, hsAffineParts* parts); +Point3 GetPosKey(int32_t i, std::vector& mat3Array, hsAffineParts* parts); +ScaleValue GetScaleKey(int32_t i, std::vector& mat3Array, hsAffineParts* parts); Quat MakeRotKey(INode *node, INode *parent, TimeValue t); Point3 MakePosKey(INode *node, INode *parent, TimeValue t); @@ -118,7 +118,7 @@ AffineParts GetLocalNodeParts(INode *node, INode *parent, TimeValue t); bool ExportableAnimationController(INode* node); bool HasBipController(INode* node); -Quat GetRotKey(Int32 i, std::vector& mat3Array); +Quat GetRotKey(int32_t i, std::vector& mat3Array); plSampleVec * SampleNodeMotion(INode* node, INode* parent, int sampleRate, Interface *theInterface); @@ -448,7 +448,7 @@ plSampleVec * SampleNodeMotion(INode* node, INode* parent, int sampleRate, Inter // intended for use in the context of a full tree traversal plSampleVec * SampleNodeMotion(INode * node, INode* parent, int sampleRate, TimeValue start, TimeValue end) { - plSampleVec *result = TRACKED_NEW plSampleVec; + plSampleVec *result = new plSampleVec; bool done = false; @@ -462,7 +462,7 @@ plSampleVec * SampleNodeMotion(INode * node, INode* parent, int sampleRate, Time int frameNum= keyTime / GetTicksPerFrame(); // get localTM - nodeTMInfo * nti = TRACKED_NEW nodeTMInfo; + nodeTMInfo * nti = new nodeTMInfo; nti->fTime = keyTime; Matrix3 localTM = node->GetNodeTM(keyTime); @@ -564,7 +564,7 @@ plSampleVecMap *SampleTreeMotion(INode* node, INode* parent, int sampleRate, Int Interval interval = theInterface->GetAnimRange(); TimeValue start = interval.Start(); // in ticks TimeValue end = interval.End(); - plSampleVecMap *ourMap = TRACKED_NEW plSampleVecMap(); + plSampleVecMap *ourMap = new plSampleVecMap(); sampleRate *= GetTicksPerFrame(); // convert sample rate to ticks @@ -581,7 +581,7 @@ void SampleTreeMotionRecurse(INode * node, INode* parent, int sampleRate, if(!HasBipController(node)) { char *nodeName = node->GetName(); - char *nameCopy = TRACKED_NEW char[strlen(nodeName) + 1]; + char *nameCopy = new char[strlen(nodeName) + 1]; strcpy(nameCopy, nodeName); plSampleVec *branch = SampleNodeMotion(node, parent, sampleRate, start, end); @@ -597,7 +597,7 @@ void SampleTreeMotionRecurse(INode * node, INode* parent, int sampleRate, } // GETPARTS -void GetParts(Int32 i, std::vector& mat3Array, hsAffineParts* parts) +void GetParts(int32_t i, std::vector& mat3Array, hsAffineParts* parts) { hsAssert(parts, "nil parts"); @@ -627,7 +627,7 @@ Quat MakeRotKey(INode *node, INode *parent, TimeValue t) return q; } -Quat GetRotKey(Int32 i, std::vector& mat3Array) +Quat GetRotKey(int32_t i, std::vector& mat3Array) { Matrix3 m = mat3Array[i]->fMat3; AffineParts parts; @@ -641,7 +641,7 @@ Quat GetRotKey(Int32 i, std::vector& mat3Array) // GETROTKEY -Quat GetRotKey(Int32 i, std::vector& mat3Array, hsAffineParts* parts) +Quat GetRotKey(int32_t i, std::vector& mat3Array, hsAffineParts* parts) { hsAffineParts myParts; if (!parts) @@ -660,7 +660,7 @@ Quat GetRotKey(Int32 i, std::vector& mat3Array, hsAffineParts* par Point3 ax; float ang; AngAxisFromQ(q, &ang, ax); - //ang -= hsScalarPI; + //ang -= M_PI; ax = -ax; q = QFromAngAxis(ang, ax); } @@ -684,7 +684,7 @@ Point3 MakePosKey(INode *node, INode *parent, TimeValue t) // GETPOSKEY -Point3 GetPosKey(Int32 i, std::vector& mat3Array, hsAffineParts* parts) +Point3 GetPosKey(int32_t i, std::vector& mat3Array, hsAffineParts* parts) { hsAffineParts myParts; if (!parts) @@ -729,7 +729,7 @@ ScaleValue MakeScaleKey(INode *node, INode *parent, TimeValue t) } // GETSCALEKEY -ScaleValue GetScaleKey(Int32 i, std::vector& mat3Array, hsAffineParts* parts) +ScaleValue GetScaleKey(int32_t i, std::vector& mat3Array, hsAffineParts* parts) { hsAffineParts myParts; if (!parts) diff --git a/Sources/Tools/MaxComponent/plBlowComponent.cpp b/Sources/Tools/MaxComponent/plBlowComponent.cpp index 1f86679e..fe5c7b86 100644 --- a/Sources/Tools/MaxComponent/plBlowComponent.cpp +++ b/Sources/Tools/MaxComponent/plBlowComponent.cpp @@ -51,7 +51,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "MaxMain/plMaxNode.h" -#include "hsTypes.h" +#include "HeadSpin.h" #include "plBlowComponent.h" @@ -128,7 +128,7 @@ hsBool plBlowComponent::PreConvert(plMaxNode *node, plErrorMsg *pErrMsg) hsBool plBlowComponent::Convert(plMaxNode *node, plErrorMsg *pErrMsg) { - plBlower* pMod = TRACKED_NEW plBlower; + plBlower* pMod = new plBlower; float strength = fCompPB->GetFloat(kStrength) * 0.01f; float speed = fCompPB->GetFloat(kSpeed) * 0.01f; diff --git a/Sources/Tools/MaxComponent/plCameraComponents.cpp b/Sources/Tools/MaxComponent/plCameraComponents.cpp index 8c3f36f9..3cfe1ff1 100644 --- a/Sources/Tools/MaxComponent/plCameraComponents.cpp +++ b/Sources/Tools/MaxComponent/plCameraComponents.cpp @@ -125,12 +125,12 @@ struct PreTrans hsBool fCutPos; hsBool fCutPOA; hsBool fIgnore; - hsScalar fAccel; - hsScalar fDecel; - hsScalar fVelocity; - hsScalar fPOAAccel; - hsScalar fPOADecel; - hsScalar fPOAVelocity; + float fAccel; + float fDecel; + float fVelocity; + float fPOAAccel; + float fPOADecel; + float fPOAVelocity; }; @@ -440,9 +440,9 @@ hsBool plTransOverrideComponent::PreConvert(plMaxNode *pNode, plErrorMsg *pErrMs PreTrans* pTrans = nil; if (pCamNode) - pTrans = TRACKED_NEW PreTrans(((plMaxNode*)pCamNode)->GetSceneObject()); + pTrans = new PreTrans(((plMaxNode*)pCamNode)->GetSceneObject()); else - pTrans = TRACKED_NEW PreTrans(nil); + pTrans = new PreTrans(nil); if (fCompPB->GetInt(kIgnoreTrans)) { @@ -767,7 +767,7 @@ hsBool plCameraBaseComponent::Convert(plMaxNode *node, plErrorMsg *pErrMsg) { // check for overriden transitions and special animation commands int count = node->NumAttachedComponents(); - for (UInt32 x = 0; x < count; x++) + for (uint32_t x = 0; x < count; x++) { plComponentBase *comp = node->GetAttachedComponent(x); if (comp->ClassID() == TRANSCAM_CID) @@ -794,9 +794,9 @@ hsBool plCameraBaseComponent::Convert(plMaxNode *node, plErrorMsg *pErrMsg) } CamTrans* camTrans = nil; if (!pCamMod) - camTrans = TRACKED_NEW CamTrans(nil); + camTrans = new CamTrans(nil); else - camTrans = TRACKED_NEW CamTrans(pCamMod->GetKey()); + camTrans = new CamTrans(pCamMod->GetKey()); camTrans->fAccel = trans->fAccel; camTrans->fDecel = trans->fDecel; @@ -837,10 +837,10 @@ plCameraModifier1* plCameraBaseComponent::ICreateCameraModifier(plMaxNode* pNode // create run-time objects - plCameraModifier1* pMod = TRACKED_NEW plCameraModifier1; + plCameraModifier1* pMod = new plCameraModifier1; plKey modifierKey = hsgResMgr::ResMgr()->NewKey(IGetUniqueName(pNode), pMod, pNode->GetLocation()); - hsgResMgr::ResMgr()->AddViaNotify(modifierKey, TRACKED_NEW plObjRefMsg(pNode->GetSceneObject()->GetKey(), plRefMsg::kOnCreate, -1, plObjRefMsg::kModifier), plRefFlags::kActiveRef); + hsgResMgr::ResMgr()->AddViaNotify(modifierKey, new plObjRefMsg(pNode->GetSceneObject()->GetKey(), plRefMsg::kOnCreate, -1, plObjRefMsg::kModifier), plRefFlags::kActiveRef); obj = pNode->EvalWorldState(hsConverterUtils::Instance().GetTime(pNode->GetInterface())).obj; @@ -853,7 +853,7 @@ plCameraModifier1* plCameraBaseComponent::ICreateCameraModifier(plMaxNode* pNode // convert FOVvalue = FOVvalue*(180/3.141592); int FOVType = theCam->GetFOVType(); - hsScalar wDeg, hDeg; + float wDeg, hDeg; switch(FOVType) { case 0: // FOV_W @@ -881,7 +881,7 @@ void plCameraBaseComponent::ISetLimitPan(plMaxNode* pNode, plCameraBrain1* pBrai { plComponentBase* LimitPanComp = 0; - for (UInt32 x = 0; x < pNode->NumAttachedComponents(); x++) + for (uint32_t x = 0; x < pNode->NumAttachedComponents(); x++) { plComponentBase *comp = pNode->GetAttachedComponent(x); if (comp->ClassID() == LIMITPAN_CID) @@ -893,14 +893,14 @@ void plCameraBaseComponent::ISetLimitPan(plMaxNode* pNode, plCameraBrain1* pBrai IParamBlock2* pBlk = LimitPanComp->GetParamBlock(plComponentBase::kRefComp); if ( pBlk && pBlk->GetInt(kLimitPanX) ) { - hsScalar deg = pBlk->GetFloat(kPanZDeg); - hsScalar rad = hsScalarDegToRad(deg); + float deg = pBlk->GetFloat(kPanZDeg); + float rad = hsDegreesToRadians(deg); pBrain->SetXPanLimit( rad * 0.5f ); } if ( pBlk && pBlk->GetInt(kLimitPanZ) ) { - hsScalar deg = pBlk->GetFloat(kPanXDeg); - hsScalar rad = hsScalarDegToRad(deg); + float deg = pBlk->GetFloat(kPanXDeg); + float rad = hsDegreesToRadians(deg); pBrain->SetZPanLimit( rad * 0.5f ); } } @@ -910,7 +910,7 @@ void plCameraBaseComponent::ISetLimitZoom(plMaxNode* pNode, plCameraBrain1* pBra { plComponentBase* LimitZoomComp = 0; - for (UInt32 x = 0; x < pNode->NumAttachedComponents(); x++) + for (uint32_t x = 0; x < pNode->NumAttachedComponents(); x++) { plComponentBase *comp = pNode->GetAttachedComponent(x); if (comp->ClassID() == CAMERAZOOM_CID) @@ -920,9 +920,9 @@ void plCameraBaseComponent::ISetLimitZoom(plMaxNode* pNode, plCameraBrain1* pBra { // set this camera to limit panning x degrees IParamBlock2* pBlk = LimitZoomComp->GetParamBlock(plComponentBase::kRefComp); - hsScalar max = pBlk->GetFloat(kZoomMaxDeg); - hsScalar min = pBlk->GetFloat(kZoomMinDeg); - hsScalar rate = pBlk->GetFloat(kZoomRate); + float max = pBlk->GetFloat(kZoomMaxDeg); + float min = pBlk->GetFloat(kZoomMinDeg); + float rate = pBlk->GetFloat(kZoomRate); pBrain->SetZoomParams(max / 1.33333333, min / 1.33333333, rate); } } @@ -931,7 +931,7 @@ void plCameraBaseComponent::ISetIgnoreSubworld(plMaxNode* pNode, plCameraBrain1* { plComponentBase* subComp = 0; - for (UInt32 x = 0; x < pNode->NumAttachedComponents(); x++) + for (uint32_t x = 0; x < pNode->NumAttachedComponents(); x++) { plComponentBase *comp = pNode->GetAttachedComponent(x); if (comp->ClassID() == CAM_IGNORE_SUB_CID) @@ -950,17 +950,17 @@ plCameraModifier1* plCameraBaseComponent::ICreateFocalPointObject(plMaxNode* pNo { plMaxNode* node = ((plMaxNode*)pNode->GetTarget()); - plCameraModifier1* pPOAMod = TRACKED_NEW plCameraModifier1; + plCameraModifier1* pPOAMod = new plCameraModifier1; plKey poaModifierKey = hsgResMgr::ResMgr()->NewKey(IGetUniqueName(pNode), pPOAMod, node->GetLocation()); - hsgResMgr::ResMgr()->AddViaNotify(poaModifierKey, TRACKED_NEW plObjRefMsg(node->GetKey(), plRefMsg::kOnCreate, -1, plObjRefMsg::kModifier), plRefFlags::kActiveRef); + hsgResMgr::ResMgr()->AddViaNotify(poaModifierKey, new plObjRefMsg(node->GetKey(), plRefMsg::kOnCreate, -1, plObjRefMsg::kModifier), plRefFlags::kActiveRef); - plCameraBrain1* pPOABrain = TRACKED_NEW plCameraBrain1(pPOAMod); + plCameraBrain1* pPOABrain = new plCameraBrain1(pPOAMod); // Give the brain a key hsgResMgr::ResMgr()->NewKey(IGetUniqueName(pNode), pPOABrain, pNode->GetLocation()); - plGenRefMsg* pGRMsg = TRACKED_NEW plGenRefMsg(pPOAMod->GetKey(), plRefMsg::kOnCreate, -1, 0); + plGenRefMsg* pGRMsg = new plGenRefMsg(pPOAMod->GetKey(), plRefMsg::kOnCreate, -1, 0); pGRMsg->SetRef( (hsKeyedObject*)pPOABrain ); plConvert::Instance().AddMessageToQueue(pGRMsg); @@ -977,7 +977,7 @@ hsBool plCameraBaseComponent::ISetPOA(plMaxNode* pNode, plCameraBrain1* pBrain, hsBool bPOAObject = false; plComponentBase* objPOAComp = 0; - for (UInt32 x = 0; x < pNode->NumAttachedComponents(); x++) + for (uint32_t x = 0; x < pNode->NumAttachedComponents(); x++) { plComponentBase *comp = pNode->GetAttachedComponent(x); if (comp->ClassID() == OBJECT_POA_CID) @@ -1104,11 +1104,11 @@ hsBool plCamera1Component::PreConvert(plMaxNode *pNode, plErrorMsg *pErrMsg) return false; //this is a fixed camera using the built-in target - plCameraBrain1_Fixed* pBrain = TRACKED_NEW plCameraBrain1_Fixed(pMod); + plCameraBrain1_Fixed* pBrain = new plCameraBrain1_Fixed(pMod); // Give the brain a key hsgResMgr::ResMgr()->NewKey(IGetUniqueName(pNode), pBrain, pNode->GetLocation()); - plGenRefMsg* pMsg = TRACKED_NEW plGenRefMsg(pMod->GetKey(), plRefMsg::kOnCreate, -1, 0); + plGenRefMsg* pMsg = new plGenRefMsg(pMod->GetKey(), plRefMsg::kOnCreate, -1, 0); pMsg->SetRef( (hsKeyedObject*)pBrain ); plConvert::Instance().AddMessageToQueue(pMsg); @@ -1347,11 +1347,11 @@ hsBool plAutoCamComponent::PreConvert(plMaxNode *pNode, plErrorMsg *pErrMsg) if (!pMod) return false; - plCameraBrain1_Avatar* pBrain = TRACKED_NEW plCameraBrain1_Avatar(pMod); + plCameraBrain1_Avatar* pBrain = new plCameraBrain1_Avatar(pMod); // Give the brain a key hsgResMgr::ResMgr()->NewKey(IGetUniqueName(pNode), pBrain, pNode->GetLocation()); - plGenRefMsg* pMsg = TRACKED_NEW plGenRefMsg(pMod->GetKey(), plRefMsg::kOnCreate, -1, 0); + plGenRefMsg* pMsg = new plGenRefMsg(pMod->GetKey(), plRefMsg::kOnCreate, -1, 0); pMsg->SetRef( (hsKeyedObject*)pBrain ); plConvert::Instance().AddMessageToQueue(pMsg); hsVector3 pt; @@ -1509,11 +1509,11 @@ hsBool plFPCamComponent::PreConvert(plMaxNode *pNode, plErrorMsg *pErrMsg) if (!pMod) return false; - plCameraBrain1_FirstPerson* pBrain = TRACKED_NEW plCameraBrain1_FirstPerson(pMod); + plCameraBrain1_FirstPerson* pBrain = new plCameraBrain1_FirstPerson(pMod); // Give the brain a key hsgResMgr::ResMgr()->NewKey(IGetUniqueName(pNode), pBrain, pNode->GetLocation()); - plGenRefMsg* pMsg2 = TRACKED_NEW plGenRefMsg(pMod->GetKey(), plRefMsg::kOnCreate, -1, 0); + plGenRefMsg* pMsg2 = new plGenRefMsg(pMod->GetKey(), plRefMsg::kOnCreate, -1, 0); pMsg2->SetRef( (hsKeyedObject*)pBrain ); plConvert::Instance().AddMessageToQueue(pMsg2); @@ -1648,7 +1648,7 @@ plRailCameraComponent::plRailCameraComponent() hsBool plRailCameraComponent::IMakeLineMod(plMaxNode* pNode, plErrorMsg* pErrMsg) { - plRailCameraMod* lineMod = TRACKED_NEW plRailCameraMod; + plRailCameraMod* lineMod = new plRailCameraMod; hsgResMgr::ResMgr()->NewKey(IGetUniqueName(pNode), lineMod, pNode->GetLocation()); lineMod->SetFollowMode(plLineFollowMod::kFollowLocalAvatar); @@ -1686,7 +1686,7 @@ hsBool plRailCameraComponent::IMakeLineMod(plMaxNode* pNode, plErrorMsg* pErrMsg hsAffineParts initParts; AP_SET(initParts, ap); - plAnimPath* animPath = TRACKED_NEW plAnimPath; + plAnimPath* animPath = new plAnimPath; animPath->SetController(tmc); animPath->InitParts(initParts); animPath->SetFarthest(fCompPB->GetInt(kRailFarthest)); @@ -1699,7 +1699,7 @@ hsBool plRailCameraComponent::IMakeLineMod(plMaxNode* pNode, plErrorMsg* pErrMsg plSceneObject* parObj = parNode->GetSceneObject(); if( parObj ) { - plGenRefMsg* refMsg = TRACKED_NEW plGenRefMsg(lineMod->GetKey(), plRefMsg::kOnCreate, 0, plLineFollowMod::kRefParent); + plGenRefMsg* refMsg = new plGenRefMsg(lineMod->GetKey(), plRefMsg::kOnCreate, 0, plLineFollowMod::kRefParent); hsgResMgr::ResMgr()->AddViaNotify(parObj->GetKey(), refMsg, plRefFlags::kPassiveRef); } } @@ -1756,7 +1756,7 @@ hsBool plRailCameraComponent::PreConvert(plMaxNode* pNode, plErrorMsg* pErrMsg) return false; //this is a fixed camera using the built-in target - plCameraBrain1_Fixed* pBrain = TRACKED_NEW plCameraBrain1_Fixed(pMod); + plCameraBrain1_Fixed* pBrain = new plCameraBrain1_Fixed(pMod); // Give the brain a key hsgResMgr::ResMgr()->NewKey(IGetUniqueName(pNode), pBrain, pNode->GetLocation()); @@ -1764,7 +1764,7 @@ hsBool plRailCameraComponent::PreConvert(plMaxNode* pNode, plErrorMsg* pErrMsg) pBrain->SetAccel(5.0f); pBrain->SetDecel(5.0f); - plGenRefMsg* pMsg = TRACKED_NEW plGenRefMsg(pMod->GetKey(), plRefMsg::kOnCreate, -1, 0); + plGenRefMsg* pMsg = new plGenRefMsg(pMod->GetKey(), plRefMsg::kOnCreate, -1, 0); pMsg->SetRef( (hsKeyedObject*)pBrain ); plConvert::Instance().AddMessageToQueue(pMsg); @@ -1910,7 +1910,7 @@ hsBool plCircleCameraComponent::PreConvert(plMaxNode* pNode, plErrorMsg* pErrMsg return false; //this is a circle camera using the built-in target - plCameraBrain1_Circle* pBrain = TRACKED_NEW plCameraBrain1_Circle(pMod); + plCameraBrain1_Circle* pBrain = new plCameraBrain1_Circle(pMod); // Give the brain a key hsgResMgr::ResMgr()->NewKey(IGetUniqueName(pNode), pBrain, pNode->GetLocation()); @@ -1924,7 +1924,7 @@ hsBool plCircleCameraComponent::PreConvert(plMaxNode* pNode, plErrorMsg* pErrMsg if (fCompPB->GetInt(kCircleFarthest)) pBrain->SetFarCircleCam(true); - plGenRefMsg* pMsg = TRACKED_NEW plGenRefMsg(pMod->GetKey(), plRefMsg::kOnCreate, -1, 0); + plGenRefMsg* pMsg = new plGenRefMsg(pMod->GetKey(), plRefMsg::kOnCreate, -1, 0); pMsg->SetRef( (hsKeyedObject*)pBrain ); plConvert::Instance().AddMessageToQueue(pMsg); @@ -2077,14 +2077,14 @@ hsBool plCameraDetectorComponent::Convert(plMaxNode *node, plErrorMsg *pErrMsg) plSceneObject *obj = node->GetSceneObject(); plLocation loc = node->GetLocation(); - plCameraRegionDetector *detector = TRACKED_NEW plCameraRegionDetector; + plCameraRegionDetector *detector = new plCameraRegionDetector; // Register the detector plKey detectorKey = hsgResMgr::ResMgr()->NewKey(IGetUniqueName(node), detector, loc); - hsgResMgr::ResMgr()->AddViaNotify(detectorKey, TRACKED_NEW plObjRefMsg(obj->GetKey(), plRefMsg::kOnCreate, -1, plObjRefMsg::kModifier), plRefFlags::kActiveRef); + hsgResMgr::ResMgr()->AddViaNotify(detectorKey, new plObjRefMsg(obj->GetKey(), plRefMsg::kOnCreate, -1, plObjRefMsg::kModifier), plRefFlags::kActiveRef); - plCameraMsg* pMsg = TRACKED_NEW plCameraMsg; + plCameraMsg* pMsg = new plCameraMsg; pMsg->SetBCastFlag(plMessage::kBCastByType); // need to get the key for the camera here... @@ -2097,7 +2097,7 @@ hsBool plCameraDetectorComponent::Convert(plMaxNode *node, plErrorMsg *pErrMsg) pMsg->SetNewCam(((plMaxNode*)pCamNode)->GetSceneObject()->GetKey()); int count = ((plMaxNode*)pCamNode)->NumAttachedComponents(); - for (UInt32 x = 0; x < count; x++) + for (uint32_t x = 0; x < count; x++) { plComponentBase *comp = ((plMaxNode*)pCamNode)->GetAttachedComponent(x); if (comp->ClassID() == DEFAULTCAM_CID) @@ -2301,11 +2301,11 @@ hsBool plFollowCamComponent::PreConvert(plMaxNode *pNode, plErrorMsg *pErrMsg) if (!pMod) return false; - plCameraBrain1_Avatar* pBrain = TRACKED_NEW plCameraBrain1_Avatar(pMod); + plCameraBrain1_Avatar* pBrain = new plCameraBrain1_Avatar(pMod); // Give the brain a key hsgResMgr::ResMgr()->NewKey(IGetUniqueName(pNode), pBrain, pNode->GetLocation()); - plGenRefMsg* pMsg = TRACKED_NEW plGenRefMsg(pMod->GetKey(), plRefMsg::kOnCreate, -1, 0); + plGenRefMsg* pMsg = new plGenRefMsg(pMod->GetKey(), plRefMsg::kOnCreate, -1, 0); pMsg->SetRef( (hsKeyedObject*)pBrain ); plConvert::Instance().AddMessageToQueue(pMsg); hsVector3 pt; diff --git a/Sources/Tools/MaxComponent/plClickDragComponent.cpp b/Sources/Tools/MaxComponent/plClickDragComponent.cpp index c0e2fd78..50fa6f32 100644 --- a/Sources/Tools/MaxComponent/plClickDragComponent.cpp +++ b/Sources/Tools/MaxComponent/plClickDragComponent.cpp @@ -363,9 +363,9 @@ hsBool plClickDragComponent::PreConvert(plMaxNode *node, plErrorMsg *pErrMsg) plSceneObject *obj = node->GetSceneObject(); // do the same thing for axis animation controllers. - plAxisAnimModifier* pAxis = TRACKED_NEW plAxisAnimModifier; + plAxisAnimModifier* pAxis = new plAxisAnimModifier; plKey axisKey = hsgResMgr::ResMgr()->NewKey(IGetUniqueName(node), pAxis, loc); - hsgResMgr::ResMgr()->AddViaNotify(axisKey, TRACKED_NEW plObjRefMsg(obj->GetKey(), plRefMsg::kOnCreate, -1, plObjRefMsg::kModifier), plRefFlags::kActiveRef); + hsgResMgr::ResMgr()->AddViaNotify(axisKey, new plObjRefMsg(obj->GetKey(), plRefMsg::kOnCreate, -1, plObjRefMsg::kModifier), plRefFlags::kActiveRef); logic->AddNotifyReceiver(axisKey); fAxisKeys[node] = axisKey; @@ -384,11 +384,11 @@ hsBool plClickDragComponent::Convert(plMaxNode *node, plErrorMsg *pErrMsg) // Create the detector plDetectorModifier *detector = nil; - detector = TRACKED_NEW plPickingDetector; + detector = new plPickingDetector; // Register the detector plKey detectorKey = hsgResMgr::ResMgr()->NewKey(IGetUniqueName(node), detector, loc); - hsgResMgr::ResMgr()->AddViaNotify(detectorKey, TRACKED_NEW plObjRefMsg(obj->GetKey(), plRefMsg::kOnCreate, -1, plObjRefMsg::kModifier), plRefFlags::kActiveRef); + hsgResMgr::ResMgr()->AddViaNotify(detectorKey, new plObjRefMsg(obj->GetKey(), plRefMsg::kOnCreate, -1, plObjRefMsg::kModifier), plRefFlags::kActiveRef); // set up the axis anim controller @@ -405,7 +405,7 @@ hsBool plClickDragComponent::Convert(plMaxNode *node, plErrorMsg *pErrMsg) pAxis->GetNotify()->AddReceiver(receivers[i]); pAxis->SetNotificationKey(logicKey); - UInt32 count = node->NumAttachedComponents(); + uint32_t count = node->NumAttachedComponents(); hsBool bHasAnim = false; plAnimComponentBase* pAnim = nil; @@ -437,17 +437,17 @@ hsBool plClickDragComponent::Convert(plMaxNode *node, plErrorMsg *pErrMsg) pAxis->SetAllOrNothing(fCompPB->GetInt(kClickDragAllOrNothing)); // add callbacks for beginning and end of animation - plEventCallbackMsg* pCall1 = TRACKED_NEW plEventCallbackMsg; + plEventCallbackMsg* pCall1 = new plEventCallbackMsg; pCall1->fEvent = kBegin; pCall1->fRepeats = -1; pCall1->AddReceiver(axisKey); - plEventCallbackMsg* pCall2 = TRACKED_NEW plEventCallbackMsg; + plEventCallbackMsg* pCall2 = new plEventCallbackMsg; pCall2->fEvent = kEnd; pCall2->fRepeats = -1; pCall2->AddReceiver(axisKey); - plAnimCmdMsg* pMsg = TRACKED_NEW plAnimCmdMsg; + plAnimCmdMsg* pMsg = new plAnimCmdMsg; const char *tempAnimName = pAnim->GetAnimName(); if (tempAnimName == nil) { @@ -484,9 +484,9 @@ hsBool plClickDragComponent::Convert(plMaxNode *node, plErrorMsg *pErrMsg) { // verify that there is a physical proxy attached to this scene object: - UInt32 count = ((plMaxNodeBase*)pProxyNode)->NumAttachedComponents(); + uint32_t count = ((plMaxNodeBase*)pProxyNode)->NumAttachedComponents(); hsBool bHasPhys = false; -// for (UInt32 i = 0; i < count; i++) +// for (uint32_t i = 0; i < count; i++) // { // plComponentBase *comp = ((plMaxNodeBase*)pProxyNode)->GetAttachedComponent(i); // if (comp->ClassID() == Class_ID(0x11e81ee4, 0x36b81450)) @@ -504,11 +504,11 @@ hsBool plClickDragComponent::Convert(plMaxNode *node, plErrorMsg *pErrMsg) if(pProxyNode->CanConvert()) { - det2 = TRACKED_NEW plPickingDetector; + det2 = new plPickingDetector; // Register the detector det2Key = hsgResMgr::ResMgr()->NewKey(IGetUniqueName(node), det2, loc); - hsgResMgr::ResMgr()->AddViaNotify(det2Key, TRACKED_NEW plObjRefMsg(((plMaxNode*)pProxyNode)->GetSceneObject()->GetKey(), plRefMsg::kOnCreate, -1, plObjRefMsg::kModifier), plRefFlags::kActiveRef); - hsgResMgr::ResMgr()->AddViaNotify(logicKey, TRACKED_NEW plObjRefMsg( det2Key, plRefMsg::kOnCreate, -1, plObjRefMsg::kModifier), plRefFlags::kActiveRef); + hsgResMgr::ResMgr()->AddViaNotify(det2Key, new plObjRefMsg(((plMaxNode*)pProxyNode)->GetSceneObject()->GetKey(), plRefMsg::kOnCreate, -1, plObjRefMsg::kModifier), plRefFlags::kActiveRef); + hsgResMgr::ResMgr()->AddViaNotify(logicKey, new plObjRefMsg( det2Key, plRefMsg::kOnCreate, -1, plObjRefMsg::kModifier), plRefFlags::kActiveRef); det2->SetProxyKey(node->GetSceneObject()->GetKey()); } else @@ -523,7 +523,7 @@ hsBool plClickDragComponent::Convert(plMaxNode *node, plErrorMsg *pErrMsg) // create and register the CONDITIONS for the DETECTOR's Logic Modifier - plActivatorConditionalObject* activatorCond = TRACKED_NEW plActivatorConditionalObject; + plActivatorConditionalObject* activatorCond = new plActivatorConditionalObject; plKey activatorKey = hsgResMgr::ResMgr()->NewKey(IGetUniqueName(node), activatorCond, loc); // do we have a required region? @@ -531,9 +531,9 @@ hsBool plClickDragComponent::Convert(plMaxNode *node, plErrorMsg *pErrMsg) if (pProxyRegNode) { // verify that there is a physical detector attached to this scene object: - UInt32 count = ((plMaxNodeBase*)pProxyRegNode)->NumAttachedComponents(); + uint32_t count = ((plMaxNodeBase*)pProxyRegNode)->NumAttachedComponents(); hsBool bHasPhys = false; -// for (UInt32 i = 0; i < count; i++) +// for (uint32_t i = 0; i < count; i++) // { // plComponentBase *comp = ((plMaxNodeBase*)pProxyRegNode)->GetAttachedComponent(i); // if (comp->ClassID() == Class_ID(0x33b60376, 0x7e5163e0)) @@ -553,12 +553,12 @@ hsBool plClickDragComponent::Convert(plMaxNode *node, plErrorMsg *pErrMsg) { // need a player in box condition here... // first a detector-any for the box - plObjectInVolumeDetector* pCDet = TRACKED_NEW plObjectInVolumeDetector(plCollisionDetector::kTypeAny); + plObjectInVolumeDetector* pCDet = new plObjectInVolumeDetector(plCollisionDetector::kTypeAny); plKey cDetKey = hsgResMgr::ResMgr()->NewKey(IGetUniqueName(node), pCDet, loc); - hsgResMgr::ResMgr()->AddViaNotify(cDetKey, TRACKED_NEW plObjRefMsg(((plMaxNode*)pProxyRegNode)->GetSceneObject()->GetKey(), plRefMsg::kOnCreate, -1, plObjRefMsg::kModifier), plRefFlags::kActiveRef); + hsgResMgr::ResMgr()->AddViaNotify(cDetKey, new plObjRefMsg(((plMaxNode*)pProxyRegNode)->GetSceneObject()->GetKey(), plRefMsg::kOnCreate, -1, plObjRefMsg::kModifier), plRefFlags::kActiveRef); pCDet->AddLogicObj(logicKey); // then an object-in-box condition for the logic mod - plObjectInBoxConditionalObject* boxCond = TRACKED_NEW plObjectInBoxConditionalObject; + plObjectInBoxConditionalObject* boxCond = new plObjectInBoxConditionalObject; plKey boxCondKey = hsgResMgr::ResMgr()->NewKey(IGetUniqueName(node), boxCond, loc); logic->AddCondition(boxCond); } @@ -578,13 +578,13 @@ hsBool plClickDragComponent::Convert(plMaxNode *node, plErrorMsg *pErrMsg) // How do we feel about player facing - plFacingConditionalObject* facingCond = TRACKED_NEW plFacingConditionalObject; + plFacingConditionalObject* facingCond = new plFacingConditionalObject; facingCond->SetDirectional(fCompPB->GetInt(kClickDragDirectional)); int deg = fCompPB->GetInt(kClickDragDegrees); if (deg > 180) deg = 180; - hsScalar rad = hsScalarDegToRad(deg); - facingCond->SetTolerance(hsCosine(rad)); + float rad = hsDegreesToRadians(deg); + facingCond->SetTolerance(cos(rad)); plKey facingKey = hsgResMgr::ResMgr()->NewKey(IGetUniqueName(node), facingCond, loc); diff --git a/Sources/Tools/MaxComponent/plClickableComponent.cpp b/Sources/Tools/MaxComponent/plClickableComponent.cpp index e290dcdc..fe56a953 100644 --- a/Sources/Tools/MaxComponent/plClickableComponent.cpp +++ b/Sources/Tools/MaxComponent/plClickableComponent.cpp @@ -264,9 +264,9 @@ hsBool plClickableComponent::PreConvert(plMaxNode *node, plErrorMsg *pErrMsg) plSceneObject *obj = clickNode->GetSceneObject(); // Create and register the VolumeGadget's logic component - plLogicModifier *logic = TRACKED_NEW plLogicModifier; + plLogicModifier *logic = new plLogicModifier; plKey logicKey = hsgResMgr::ResMgr()->NewKey(IGetUniqueName(node), logic, clickNode->GetLocation()); - hsgResMgr::ResMgr()->AddViaNotify(logicKey, TRACKED_NEW plObjRefMsg(obj->GetKey(), plRefMsg::kOnCreate, -1, plObjRefMsg::kModifier), plRefFlags::kActiveRef); + hsgResMgr::ResMgr()->AddViaNotify(logicKey, new plObjRefMsg(obj->GetKey(), plRefMsg::kOnCreate, -1, plObjRefMsg::kModifier), plRefFlags::kActiveRef); fLogicModKeys[clickNode] = logicKey; @@ -328,14 +328,14 @@ hsBool plClickableComponent::Convert(plMaxNode *node, plErrorMsg *pErrMsg) // Create the detector plDetectorModifier *detector = nil; - detector = TRACKED_NEW plPickingDetector; + detector = new plPickingDetector; // Register the detector plKey detectorKey = hsgResMgr::ResMgr()->NewKey(IGetUniqueName(node), detector, loc); - hsgResMgr::ResMgr()->AddViaNotify(detectorKey, TRACKED_NEW plObjRefMsg(obj->GetKey(), plRefMsg::kOnCreate, -1, plObjRefMsg::kModifier), plRefFlags::kActiveRef); + hsgResMgr::ResMgr()->AddViaNotify(detectorKey, new plObjRefMsg(obj->GetKey(), plRefMsg::kOnCreate, -1, plObjRefMsg::kModifier), plRefFlags::kActiveRef); // create and register the CONDITIONS for the DETECTOR's Logic Modifier - plActivatorConditionalObject* activatorCond = TRACKED_NEW plActivatorConditionalObject; + plActivatorConditionalObject* activatorCond = new plActivatorConditionalObject; plKey activatorKey = hsgResMgr::ResMgr()->NewKey(IGetUniqueName(node), activatorCond, loc); // @@ -345,14 +345,14 @@ hsBool plClickableComponent::Convert(plMaxNode *node, plErrorMsg *pErrMsg) // first a detector-any for the box if (!ignoreProxyRegion) { - plObjectInVolumeDetector* pCDet = TRACKED_NEW plObjectInVolumeDetector(plCollisionDetector::kTypeAny); + plObjectInVolumeDetector* pCDet = new plObjectInVolumeDetector(plCollisionDetector::kTypeAny); plKey pCDetKey = hsgResMgr::ResMgr()->NewKey(IGetUniqueName(node), pCDet, loc); - hsgResMgr::ResMgr()->AddViaNotify(pCDetKey, TRACKED_NEW plObjRefMsg(detectNode->GetSceneObject()->GetKey(), plRefMsg::kOnCreate, -1, plObjRefMsg::kModifier), plRefFlags::kActiveRef); + hsgResMgr::ResMgr()->AddViaNotify(pCDetKey, new plObjRefMsg(detectNode->GetSceneObject()->GetKey(), plRefMsg::kOnCreate, -1, plObjRefMsg::kModifier), plRefFlags::kActiveRef); pCDet->AddLogicObj(logicKey); // then an object-in-box condition for the logic mod - plObjectInBoxConditionalObject* boxCond = TRACKED_NEW plObjectInBoxConditionalObject; + plObjectInBoxConditionalObject* boxCond = new plObjectInBoxConditionalObject; plKey boxCondKey = hsgResMgr::ResMgr()->NewKey(IGetUniqueName(node), boxCond, loc); logic->AddCondition(boxCond); } @@ -360,13 +360,13 @@ hsBool plClickableComponent::Convert(plMaxNode *node, plErrorMsg *pErrMsg) // // How do we feel about player facing // - plFacingConditionalObject* facingCond = TRACKED_NEW plFacingConditionalObject; + plFacingConditionalObject* facingCond = new plFacingConditionalObject; facingCond->SetDirectional(fCompPB->GetInt(kClickableDirectional)); int deg = fCompPB->GetInt(kClickableDegrees); if (deg > 180) deg = 180; - hsScalar rad = hsScalarDegToRad(deg); - facingCond->SetTolerance(hsCosine(rad)); + float rad = hsDegreesToRadians(deg); + facingCond->SetTolerance(cos(rad)); plKey facingKey = hsgResMgr::ResMgr()->NewKey(IGetUniqueName(node), facingCond, loc); detector->AddLogicObj(logicKey); // send messages to this logic component diff --git a/Sources/Tools/MaxComponent/plClimbComponent.cpp b/Sources/Tools/MaxComponent/plClimbComponent.cpp index 246831a9..d3c63a68 100644 --- a/Sources/Tools/MaxComponent/plClimbComponent.cpp +++ b/Sources/Tools/MaxComponent/plClimbComponent.cpp @@ -239,7 +239,7 @@ hsBool plClimbTriggerComponent::Convert(plMaxNode *node, plErrorMsg *pErrMsg) plClimbMsg *enterMsg = nil; if(enterCommand != plClimbMsg::kNoCommand) { - enterMsg = TRACKED_NEW plClimbMsg(nilKey, nilKey, enterCommand, direction, enterStatus, target); + enterMsg = new plClimbMsg(nilKey, nilKey, enterCommand, direction, enterStatus, target); enterMsg->SetBCastFlag(plMessage::kPropagateToModifiers); enterMsg->SetBCastFlag(plMessage::kNetPropagate); enterMsg->SetBCastFlag(plMessage::kNetForce); @@ -248,13 +248,13 @@ hsBool plClimbTriggerComponent::Convert(plMaxNode *node, plErrorMsg *pErrMsg) plClimbMsg *exitMsg = nil; if(exitCommand != nil) { - exitMsg = TRACKED_NEW plClimbMsg(nilKey, nilKey, exitCommand, direction, exitStatus, target); + exitMsg = new plClimbMsg(nilKey, nilKey, exitCommand, direction, exitStatus, target); exitMsg->SetBCastFlag(plMessage::kPropagateToModifiers); exitMsg->SetBCastFlag(plMessage::kNetPropagate); exitMsg->SetBCastFlag(plMessage::kNetForce); } - plSimpleRegionSensor *sensMod = TRACKED_NEW plSimpleRegionSensor(enterMsg, exitMsg); + plSimpleRegionSensor *sensMod = new plSimpleRegionSensor(enterMsg, exitMsg); node->AddModifier(sensMod, IGetUniqueName(node)); return true; diff --git a/Sources/Tools/MaxComponent/plClothingComponent.cpp b/Sources/Tools/MaxComponent/plClothingComponent.cpp index 722b4c94..0abb2053 100644 --- a/Sources/Tools/MaxComponent/plClothingComponent.cpp +++ b/Sources/Tools/MaxComponent/plClothingComponent.cpp @@ -42,7 +42,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "HeadSpin.h" #include "max.h" #include "resource.h" -//#include "hsUtils.h" +// #include "hsTemplates.h" #include "plResMgr/plKeyFinder.h" #include "plResMgr/plPageInfo.h" @@ -168,7 +168,7 @@ hsBool plClothingComponent::SetupProperties(plMaxNode* node, plErrorMsg* pErrMsg if (!LODNode->GetSwappableGeom()) LODNode->SetSwappableGeom(new plSharedMesh); - //UInt32 targetID = fCompPB->GetInt(kType); + //uint32_t targetID = fCompPB->GetInt(kType); //((plMaxNode *)LODNode->GetParentNode())->SetSwappableGeomTarget(targetID); } } @@ -198,7 +198,7 @@ hsBool plClothingComponent::Convert(plMaxNode *node, plErrorMsg *pErrMsg) for (i = 0; i < fCompPB->Count(kMeshNodeTab); i++) { spanArray.Reset(); - //plSharedMesh *mesh = TRACKED_NEW plSharedMesh; + //plSharedMesh *mesh = new plSharedMesh; LODNode = (plMaxNode *)fCompPB->GetINode(kMeshNodeTab, 0, i); if (LODNode != nil) { @@ -240,7 +240,7 @@ hsBool plClothingComponent::Convert(plMaxNode *node, plErrorMsg *pErrMsg) { if (keys[j] != nil) { - refMsg = TRACKED_NEW plGenRefMsg(cloth->GetKey(), plRefMsg::kOnCreate, j, -1); + refMsg = new plGenRefMsg(cloth->GetKey(), plRefMsg::kOnCreate, j, -1); hsgResMgr::ResMgr()->AddViaNotify(keys[j], refMsg, plRefFlags::kActiveRef); } } diff --git a/Sources/Tools/MaxComponent/plClusterComponent.cpp b/Sources/Tools/MaxComponent/plClusterComponent.cpp index b329fca9..24326bce 100644 --- a/Sources/Tools/MaxComponent/plClusterComponent.cpp +++ b/Sources/Tools/MaxComponent/plClusterComponent.cpp @@ -53,7 +53,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "MaxExport/plExportProgressBar.h" #include "MaxMain/plMaxNode.h" -#include "hsTypes.h" +#include "HeadSpin.h" #include "hsBitVector.h" #include "plMath/hsRadixSort.h" @@ -447,7 +447,7 @@ void plClusterComponent::IBuildDistribTab() plMaxNodeBase* targ = GetTarget(i); if( targ ) { - UInt32 count = targ->NumAttachedComponents(); + uint32_t count = targ->NumAttachedComponents(); int j; for( j = 0; j < count; j++ ) // For each DistribComponent @@ -967,7 +967,7 @@ void plClusterComponent::IClusterBins(plDistribInstTab& nodes, Box3& box) } int totSize = IGetBinCount(); - fClusterBins = TRACKED_NEW plDistribInstTab*[totSize]; + fClusterBins = new plDistribInstTab*[totSize]; memset(fClusterBins, 0, sizeof(*fClusterBins) * totSize); @@ -1010,7 +1010,7 @@ plDistribInstTab* plClusterComponent::IGetClusterBin(const Box3& box, const Poin } int idx = coord[0] * fSizes[1] * fSizes[2] + coord[1] * fSizes[2] + coord[2]; if( !fClusterBins[idx] ) - fClusterBins[idx] = TRACKED_NEW plDistribInstTab; + fClusterBins[idx] = new plDistribInstTab; return fClusterBins[idx]; } @@ -1150,7 +1150,7 @@ BOOL plClusterComponent::IGetLocation() plMaxNodeBase* targ = GetTarget(i); if( targ ) { - UInt32 numComp = targ->NumAttachedComponents(false); + uint32_t numComp = targ->NumAttachedComponents(false); int j; for( j = 0; j < numComp; j++ ) { diff --git a/Sources/Tools/MaxComponent/plComponent.h b/Sources/Tools/MaxComponent/plComponent.h index 9d2f4e20..f3fc02cd 100644 --- a/Sources/Tools/MaxComponent/plComponent.h +++ b/Sources/Tools/MaxComponent/plComponent.h @@ -133,7 +133,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com ** BlockParameter 2: ** The internal name string. This name is not localized. Internal names are meant ** to be parsable as identifiers. As such they should begin with an alpha character, have only -** alphanumerics, and have no spaces, punctuations, etc. The convention for multi-word names +** alphanumerics, and have no spaces, punctuations, etc. The convention for multi-uint16_t names ** is to use studly-caps, eg, paintRadius. THIS IS A REQUIRED FIELD. ** ** BlockParameter 3: @@ -158,7 +158,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com ** Indicates the parameter block2 will be constructed and referenced automatically ** to its owner in the call to ClassDesc2::MakeAutoParamBlocks(). If this flag is ** set, the parameter block's reference number in the owning object should be given -** immediately following the flag word in the descriptor constructor. See +** immediately following the flag uint16_t in the descriptor constructor. See ** . ** ** P_AUTO_UI diff --git a/Sources/Tools/MaxComponent/plComponentBase.cpp b/Sources/Tools/MaxComponent/plComponentBase.cpp index 2de9ab03..f71e8c56 100644 --- a/Sources/Tools/MaxComponent/plComponentBase.cpp +++ b/Sources/Tools/MaxComponent/plComponentBase.cpp @@ -203,7 +203,7 @@ void plComponentBase::AddTargetsToList(INodeTab& list) } } -UInt32 plComponentBase::NumTargets() +uint32_t plComponentBase::NumTargets() { if (fTargsPB) return fTargsPB->Count(kTargs); @@ -211,7 +211,7 @@ UInt32 plComponentBase::NumTargets() return 0; } -plMaxNodeBase *plComponentBase::GetTarget(UInt32 i) +plMaxNodeBase *plComponentBase::GetTarget(uint32_t i) { if (fTargsPB && i < NumTargets()) return (plMaxNodeBase*)fTargsPB->GetINode(kTargs, 0, i); @@ -225,8 +225,8 @@ void plComponentBase::AddTarget(plMaxNodeBase *target) return; // Make sure we don't already ref this - UInt32 count = fTargsPB->Count(kTargs); - for (UInt32 i = 0; i < count; i++) + uint32_t count = fTargsPB->Count(kTargs); + for (uint32_t i = 0; i < count; i++) { if (fTargsPB->GetINode(kTargs, 0, i) == target) return; @@ -243,8 +243,8 @@ void plComponentBase::DeleteTarget(plMaxNodeBase *target) if (!target) return; - UInt32 count = fTargsPB->Count(kTargs); - for (UInt32 i = 0; i < count; i++) + uint32_t count = fTargsPB->Count(kTargs); + for (uint32_t i = 0; i < count; i++) { if (fTargsPB->GetINode(kTargs, 0, i) == target) { @@ -535,8 +535,8 @@ void plComponentBase::DestroyRollups() static bool INodeHasComponent(plMaxNodeBase *node, plMaxNodeBase *compNode) { - UInt32 count = node->NumAttachedComponents(); - for (UInt32 i = 0; i < count; i++) + uint32_t count = node->NumAttachedComponents(); + for (uint32_t i = 0; i < count; i++) { if (node->GetAttachedComponent(i)->GetINode() == compNode) return true; @@ -568,7 +568,7 @@ int plSharedComponents(INodeTab& nodes, INodeTab& components) for (i = 1; i < nodes.Count(); i++) { plMaxNodeBase *node = (plMaxNodeBase*)nodes[i]; - UInt32 count = node->NumAttachedComponents(); + uint32_t count = node->NumAttachedComponents(); for (int j = components.Count()-1; j >= 0; j--) { @@ -630,7 +630,7 @@ static void FindObsoleteComponents(plMaxNodeBase *node, std::vector -#include "hsUtils.h" + static void ComponentNotify(void *param, NotifyInfo *info) { diff --git a/Sources/Tools/MaxComponent/plComponentBase.h b/Sources/Tools/MaxComponent/plComponentBase.h index 51a43e7a..274aa485 100644 --- a/Sources/Tools/MaxComponent/plComponentBase.h +++ b/Sources/Tools/MaxComponent/plComponentBase.h @@ -46,7 +46,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "iparamb2.h" #include "iparamm2.h" -#include "hsTypes.h" +#include "HeadSpin.h" #include "pnKeyedObject/plKey.h" extern TCHAR *GetString(int id); @@ -90,8 +90,8 @@ public: virtual ~plComponentBase(); void DeleteThis() { delete this; } - UInt32 NumTargets(); - plMaxNodeBase *GetTarget(UInt32 i); + uint32_t NumTargets(); + plMaxNodeBase *GetTarget(uint32_t i); virtual void AddTarget(plMaxNodeBase *target); virtual void DeleteTarget(plMaxNodeBase *target); virtual void DeleteAllTargets(); @@ -298,7 +298,7 @@ public: ** BlockParameter 2: ** The internal name string. This name is not localized. Internal names are meant ** to be parsable as identifiers. As such they should begin with an alpha character, have only -** alphanumerics, and have no spaces, punctuations, etc. The convention for multi-word names +** alphanumerics, and have no spaces, punctuations, etc. The convention for multi-uint16_t names ** is to use studly-caps, eg, paintRadius. THIS IS A REQUIRED FIELD. ** ** BlockParameter 3: @@ -323,7 +323,7 @@ public: ** Indicates the parameter block2 will be constructed and referenced automatically ** to its owner in the call to ClassDesc2::MakeAutoParamBlocks(). If this flag is ** set, the parameter block's reference number in the owning object should be given -** immediately following the flag word in the descriptor constructor. See +** immediately following the flag uint16_t in the descriptor constructor. See ** . ** ** P_AUTO_UI @@ -343,7 +343,7 @@ public: ** (This is used by ClassDesc2::BeginEditParams() and ClassDesc2::EndEditParams() ** to determine whether the ParamMap2 shold be created/deleted on this call. ** All the bits in the supplied mask must be on in the Begin/EndEditParams -** flag longword for the action to take place. For this example we have 0.) +** flag longuint16_t for the action to take place. For this example we have 0.) ** int rollup_flags ** (This flag is used to control rollup creation. You may pass ** APPENDROLL_CLOSED to have the rollup added in the closed (rolled up) state. diff --git a/Sources/Tools/MaxComponent/plComponentMgr.cpp b/Sources/Tools/MaxComponent/plComponentMgr.cpp index b0e39f31..f337aad0 100644 --- a/Sources/Tools/MaxComponent/plComponentMgr.cpp +++ b/Sources/Tools/MaxComponent/plComponentMgr.cpp @@ -72,12 +72,12 @@ plComponentMgr &plComponentMgr::Inst() return theInstance; } -UInt32 plComponentMgr::Count() +uint32_t plComponentMgr::Count() { return fDescs.size(); } -ClassDesc *plComponentMgr::Get(UInt32 i) +ClassDesc *plComponentMgr::Get(uint32_t i) { if (i < fDescs.size()) return fDescs[i]; @@ -88,7 +88,7 @@ ClassDesc *plComponentMgr::Get(UInt32 i) } } -UInt32 plComponentMgr::FindClassID(Class_ID id) +uint32_t plComponentMgr::FindClassID(Class_ID id) { for (unsigned int i = 0; i < fDescs.size(); i++) { diff --git a/Sources/Tools/MaxComponent/plComponentMgr.h b/Sources/Tools/MaxComponent/plComponentMgr.h index b61f7478..69dcccdf 100644 --- a/Sources/Tools/MaxComponent/plComponentMgr.h +++ b/Sources/Tools/MaxComponent/plComponentMgr.h @@ -42,7 +42,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #ifndef PL_COMPONENTMGR_H #define PL_COMPONENTMGR_H -#include "hsTypes.h" +#include "HeadSpin.h" #include "max.h" #include "utilapi.h" @@ -82,10 +82,10 @@ public: virtual void SelectionSetChanged(Interface *ip,IUtil *iu) {} virtual void DeleteThis() {} - virtual UInt32 Count(); - virtual ClassDesc *Get(UInt32 i); + virtual uint32_t Count(); + virtual ClassDesc *Get(uint32_t i); - virtual UInt32 FindClassID(Class_ID id); + virtual uint32_t FindClassID(Class_ID id); // Registers a component. Only used by the classdesc macro. virtual void Register(ClassDesc *desc); diff --git a/Sources/Tools/MaxComponent/plComponentTools.h b/Sources/Tools/MaxComponent/plComponentTools.h index 442c7848..600afe84 100644 --- a/Sources/Tools/MaxComponent/plComponentTools.h +++ b/Sources/Tools/MaxComponent/plComponentTools.h @@ -42,7 +42,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #ifndef PL_COMPONENT_TOOLS_H #define PL_COMPONENT_TOOLS_H -#include "hsTypes.h" +#include "HeadSpin.h" #include "hsTemplates.h" #include "pnKeyedObject/plKey.h" diff --git a/Sources/Tools/MaxComponent/plDistribComponent.cpp b/Sources/Tools/MaxComponent/plDistribComponent.cpp index 1659816b..28ad2bec 100644 --- a/Sources/Tools/MaxComponent/plDistribComponent.cpp +++ b/Sources/Tools/MaxComponent/plDistribComponent.cpp @@ -41,7 +41,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ #include "HeadSpin.h" -#include "hsWindows.h" + #include #include "max.h" @@ -59,7 +59,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "MaxPlasmaMtls/Layers/plLayerTex.h" -#include "hsTypes.h" +#include "HeadSpin.h" #include "MaxConvert/plDistributor.h" #include "MaxConvert/plDistTree.h" diff --git a/Sources/Tools/MaxComponent/plDistribComponent_old.cpp b/Sources/Tools/MaxComponent/plDistribComponent_old.cpp index 5af6d160..d109a66e 100644 --- a/Sources/Tools/MaxComponent/plDistribComponent_old.cpp +++ b/Sources/Tools/MaxComponent/plDistribComponent_old.cpp @@ -41,7 +41,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ #include "HeadSpin.h" -#include "hsWindows.h" + #include #include "max.h" @@ -58,7 +58,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "MaxPlasmaMtls/Layers/plLayerTex.h" -#include "hsTypes.h" +#include "HeadSpin.h" #include "MaxConvert/plDistributor.h" #include "MaxConvert/plDistTree.h" // FISH HACK - just testing diff --git a/Sources/Tools/MaxComponent/plExcludeRegionComponent.cpp b/Sources/Tools/MaxComponent/plExcludeRegionComponent.cpp index 67d1d5e1..982207f1 100644 --- a/Sources/Tools/MaxComponent/plExcludeRegionComponent.cpp +++ b/Sources/Tools/MaxComponent/plExcludeRegionComponent.cpp @@ -177,7 +177,7 @@ hsBool plExcludeRegionComponent::PreConvert(plMaxNode *node, plErrorMsg *pErrMsg return false; } - plExcludeRegionModifier *mod = TRACKED_NEW plExcludeRegionModifier; + plExcludeRegionModifier *mod = new plExcludeRegionModifier; plKey key = node->AddModifier(mod, IGetUniqueName(node)); fXRegionKeys[node] = key; diff --git a/Sources/Tools/MaxComponent/plFootPrintComponent.cpp b/Sources/Tools/MaxComponent/plFootPrintComponent.cpp index 9ef92d31..faefe544 100644 --- a/Sources/Tools/MaxComponent/plFootPrintComponent.cpp +++ b/Sources/Tools/MaxComponent/plFootPrintComponent.cpp @@ -53,7 +53,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "MaxExport/plExportProgressBar.h" #include "MaxConvert/hsMaterialConverter.h" -#include "hsTypes.h" +#include "HeadSpin.h" #include "plTweak.h" #include "hsResMgr.h" @@ -318,7 +318,7 @@ hsBool plFootPrintComponent::PreConvert(plMaxNode* node, plErrorMsg* pErrMsg) // If we haven't already, create our DynaDecalMgr and stash it away. if( !fDecalMgr ) { - ISetupDecalMgr(node, pErrMsg, TRACKED_NEW plDynaFootMgr); + ISetupDecalMgr(node, pErrMsg, new plDynaFootMgr); } return true; @@ -333,7 +333,7 @@ hsBool plFootPrintComponent::Convert(plMaxNode* node, plErrorMsg* pErrMsg) ISetupNotifies(node, pErrMsg); // Add this node's object to our DynaDecalMgr. - hsgResMgr::ResMgr()->AddViaNotify(node->GetKey(), TRACKED_NEW plGenRefMsg(fDecalMgr->GetKey(), plRefMsg::kOnCreate, 0, plDynaDecalMgr::kRefTarget), plRefFlags::kActiveRef); + hsgResMgr::ResMgr()->AddViaNotify(node->GetKey(), new plGenRefMsg(fDecalMgr->GetKey(), plRefMsg::kOnCreate, 0, plDynaDecalMgr::kRefTarget), plRefFlags::kActiveRef); return true; } @@ -377,7 +377,7 @@ hsBool plFootPrintComponent::ISetupDecalMgr(plMaxNode* node, plErrorMsg* pErrMsg float intensity = fCompPB->GetFloat(kIntensity) * 1.e-2f; float partyTime = fCompPB->GetFloat(kPartyTime); - const hsScalar kHeightHack = 1.f; + const float kHeightHack = 1.f; fDecalMgr->SetScale(hsVector3(width, length, kHeightHack)); const float kMinFadeOut = 1.e-2f; @@ -400,7 +400,7 @@ hsBool plFootPrintComponent::ISetupDecalMgr(plMaxNode* node, plErrorMsg* pErrMsg return fValid = false; } - hsgResMgr::ResMgr()->AddViaNotify(mgrKey, TRACKED_NEW plNodeRefMsg(node->GetRoomKey(), plRefMsg::kOnCreate, -1, plNodeRefMsg::kGeneric), plRefFlags::kActiveRef); + hsgResMgr::ResMgr()->AddViaNotify(mgrKey, new plNodeRefMsg(node->GetRoomKey(), plRefMsg::kOnCreate, -1, plNodeRefMsg::kGeneric), plRefFlags::kActiveRef); ISetupParticles(node, pErrMsg); @@ -473,18 +473,18 @@ hsBool plFootPrintComponent::ICreateDecalMaterials(plMaxNode* node, plErrorMsg* if( !matRTShade ) return fValid = false; - hsgResMgr::ResMgr()->AddViaNotify(matRTShade->GetKey(), TRACKED_NEW plGenRefMsg(fDecalMgr->GetKey(), plRefMsg::kOnCreate, 0, plDynaDecalMgr::kRefMatRTShade), plRefFlags::kActiveRef); + hsgResMgr::ResMgr()->AddViaNotify(matRTShade->GetKey(), new plGenRefMsg(fDecalMgr->GetKey(), plRefMsg::kOnCreate, 0, plDynaDecalMgr::kRefMatRTShade), plRefFlags::kActiveRef); hsGMaterial* matPreShade = hsMaterialConverter::Instance().AlphaHackPrint(node, fCompPB->GetTexmap(kLayer), hsGMatState::kBlendAlpha); - hsgResMgr::ResMgr()->AddViaNotify(matPreShade->GetKey(), TRACKED_NEW plGenRefMsg(fDecalMgr->GetKey(), plRefMsg::kOnCreate, 0, plDynaDecalMgr::kRefMatPreShade), plRefFlags::kActiveRef); + hsgResMgr::ResMgr()->AddViaNotify(matPreShade->GetKey(), new plGenRefMsg(fDecalMgr->GetKey(), plRefMsg::kOnCreate, 0, plDynaDecalMgr::kRefMatPreShade), plRefFlags::kActiveRef); return true; } hsBool plFootPrintComponent::ISetupColorDecalMaterials(plMaxNode* node, plErrorMsg* pErrMsg) { - UInt32 blendFlags = 0; + uint32_t blendFlags = 0; switch( fCompPB->GetInt(kBlend) ) { case kMADD: @@ -512,7 +512,7 @@ hsBool plFootPrintComponent::ISetupColorDecalMaterials(plMaxNode* node, plErrorM layer->SetBlendFlags(layer->GetBlendFlags() | hsGMatState::kBlendInvertFinalColor); } - hsgResMgr::ResMgr()->AddViaNotify(matRTShade->GetKey(), TRACKED_NEW plGenRefMsg(fDecalMgr->GetKey(), plRefMsg::kOnCreate, 0, plDynaDecalMgr::kRefMatRTShade), plRefFlags::kActiveRef); + hsgResMgr::ResMgr()->AddViaNotify(matRTShade->GetKey(), new plGenRefMsg(fDecalMgr->GetKey(), plRefMsg::kOnCreate, 0, plDynaDecalMgr::kRefMatRTShade), plRefFlags::kActiveRef); return true; } @@ -691,11 +691,11 @@ hsBool plRippleComponent::PreConvert(plMaxNode* node, plErrorMsg* pErrMsg) plDynaRippleMgr* ripple = nil; if( node->GetVS() || node->UserPropExists("XXXWaterColor") ) { - ripple = TRACKED_NEW plDynaRippleVSMgr; + ripple = new plDynaRippleVSMgr; } else { - ripple = TRACKED_NEW plDynaRippleMgr; + ripple = new plDynaRippleMgr; } ISetupDecalMgr(node, pErrMsg, ripple); if( fValid ) @@ -717,7 +717,7 @@ hsBool plRippleComponent::Convert(plMaxNode* node, plErrorMsg* pErrMsg) plWaveSetBase* waveSet = plWaterComponent::GetWaveSetFromNode(node); if( waveSet ) { - plGenRefMsg* refMsg = TRACKED_NEW plGenRefMsg(fDecalMgr->GetKey(), plRefMsg::kOnCreate, 0, plDynaRippleVSMgr::kRefWaveSetBase); + plGenRefMsg* refMsg = new plGenRefMsg(fDecalMgr->GetKey(), plRefMsg::kOnCreate, 0, plDynaRippleVSMgr::kRefWaveSetBase); hsgResMgr::ResMgr()->AddViaNotify(waveSet->GetKey(), refMsg, plRefFlags::kPassiveRef); } @@ -725,7 +725,7 @@ hsBool plRippleComponent::Convert(plMaxNode* node, plErrorMsg* pErrMsg) } // Add this node's object to our DynaDecalMgr. - hsgResMgr::ResMgr()->AddViaNotify(node->GetKey(), TRACKED_NEW plGenRefMsg(fDecalMgr->GetKey(), plRefMsg::kOnCreate, 0, plDynaDecalMgr::kRefTarget), plRefFlags::kActiveRef); + hsgResMgr::ResMgr()->AddViaNotify(node->GetKey(), new plGenRefMsg(fDecalMgr->GetKey(), plRefMsg::kOnCreate, 0, plDynaDecalMgr::kRefTarget), plRefFlags::kActiveRef); return true; } @@ -863,7 +863,7 @@ hsBool plPuddleComponent::PreConvert(plMaxNode* node, plErrorMsg* pErrMsg) // If we haven't already, create our DynaDecalMgr and stash it away. if( !fDecalMgr ) { - plDynaRippleMgr* puddle = TRACKED_NEW plDynaPuddleMgr; + plDynaRippleMgr* puddle = new plDynaPuddleMgr; ISetupDecalMgr(node, pErrMsg, puddle); if( fValid ) @@ -883,7 +883,7 @@ hsBool plPuddleComponent::Convert(plMaxNode* node, plErrorMsg* pErrMsg) ISetupNotifies(node, pErrMsg); // Add this node's object to our DynaDecalMgr. - hsgResMgr::ResMgr()->AddViaNotify(node->GetKey(), TRACKED_NEW plGenRefMsg(fDecalMgr->GetKey(), plRefMsg::kOnCreate, 0, plDynaDecalMgr::kRefTarget), plRefFlags::kActiveRef); + hsgResMgr::ResMgr()->AddViaNotify(node->GetKey(), new plGenRefMsg(fDecalMgr->GetKey(), plRefMsg::kOnCreate, 0, plDynaDecalMgr::kRefTarget), plRefFlags::kActiveRef); return true; } @@ -1028,7 +1028,7 @@ hsBool plBulletComponent::PreConvert(plMaxNode* node, plErrorMsg* pErrMsg) // If we haven't already, create our DynaDecalMgr and stash it away. if( !fDecalMgr ) { - plDynaBulletMgr* bullet = TRACKED_NEW plDynaBulletMgr; + plDynaBulletMgr* bullet = new plDynaBulletMgr; ISetupDecalMgr(node, pErrMsg, bullet); } @@ -1044,7 +1044,7 @@ hsBool plBulletComponent::Convert(plMaxNode* node, plErrorMsg* pErrMsg) ISetupNotifies(node, pErrMsg); // Add this node's object to our DynaDecalMgr. - hsgResMgr::ResMgr()->AddViaNotify(node->GetKey(), TRACKED_NEW plGenRefMsg(fDecalMgr->GetKey(), plRefMsg::kOnCreate, 0, plDynaDecalMgr::kRefTarget), plRefFlags::kActiveRef); + hsgResMgr::ResMgr()->AddViaNotify(node->GetKey(), new plGenRefMsg(fDecalMgr->GetKey(), plRefMsg::kOnCreate, 0, plDynaDecalMgr::kRefTarget), plRefFlags::kActiveRef); return true; } @@ -1193,9 +1193,9 @@ hsBool plTorpedoComponent::PreConvert(plMaxNode* node, plErrorMsg* pErrMsg) { plDynaRippleMgr* torpedo; if( node->GetVS() ) - torpedo = TRACKED_NEW plDynaTorpedoVSMgr; + torpedo = new plDynaTorpedoVSMgr; else - torpedo = TRACKED_NEW plDynaTorpedoMgr; + torpedo = new plDynaTorpedoMgr; ISetupDecalMgr(node, pErrMsg, torpedo); if( fValid ) @@ -1351,7 +1351,7 @@ hsBool plWakeComponent::PreConvert(plMaxNode* node, plErrorMsg* pErrMsg) // If we haven't already, create our DynaDecalMgr and stash it away. if( !fDecalMgr ) { - plDynaWakeMgr* wake = TRACKED_NEW plDynaWakeMgr; + plDynaWakeMgr* wake = new plDynaWakeMgr; ISetupDecalMgr(node, pErrMsg, wake); if( fValid ) { @@ -1371,7 +1371,7 @@ hsBool plWakeComponent::Convert(plMaxNode* node, plErrorMsg* pErrMsg) ISetupNotifies(node, pErrMsg); // Add this node's object to our DynaDecalMgr. - hsgResMgr::ResMgr()->AddViaNotify(node->GetKey(), TRACKED_NEW plGenRefMsg(fDecalMgr->GetKey(), plRefMsg::kOnCreate, 0, plDynaDecalMgr::kRefTarget), plRefFlags::kActiveRef); + hsgResMgr::ResMgr()->AddViaNotify(node->GetKey(), new plGenRefMsg(fDecalMgr->GetKey(), plRefMsg::kOnCreate, 0, plDynaDecalMgr::kRefTarget), plRefFlags::kActiveRef); return true; } @@ -1498,7 +1498,7 @@ hsBool plDirtyComponent::Convert(plMaxNode* node, plErrorMsg* pErrMsg) } - plDecalEnableMod* enable = TRACKED_NEW plDecalEnableMod; + plDecalEnableMod* enable = new plDecalEnableMod; plKey modKey = hsgResMgr::ResMgr()->NewKey(IGetUniqueName(node), enable, node->GetLocation()); int numDecals = fCompPB->Count(kDecals); @@ -1516,7 +1516,7 @@ hsBool plDirtyComponent::Convert(plMaxNode* node, plErrorMsg* pErrMsg) } } enable->SetWetLength(fCompPB->GetFloat(kDirtyTime)); - hsgResMgr::ResMgr()->AddViaNotify(modKey, TRACKED_NEW plObjRefMsg(node->GetKey(), plRefMsg::kOnCreate, -1, plObjRefMsg::kModifier), plRefFlags::kActiveRef); + hsgResMgr::ResMgr()->AddViaNotify(modKey, new plObjRefMsg(node->GetKey(), plRefMsg::kOnCreate, -1, plObjRefMsg::kModifier), plRefFlags::kActiveRef); return true; } @@ -1620,14 +1620,14 @@ hsBool plPrintShapeComponent::Convert(plMaxNode* node, plErrorMsg* pErrMsg) if( !obj ) return true; - plPrintShape* shape = TRACKED_NEW plPrintShape(); + plPrintShape* shape = new plPrintShape(); plKey shapeKey = hsgResMgr::ResMgr()->NewKey(IGetUniqueName(node), shape, node->GetLocation()); shape->SetWidth(fCompPB->GetFloat(kWidth)); shape->SetLength(fCompPB->GetFloat(kLength)); shape->SetHeight(fCompPB->GetFloat(kHeight)); - hsgResMgr::ResMgr()->AddViaNotify(shapeKey, TRACKED_NEW plObjRefMsg(obj->GetKey(), plRefMsg::kOnCreate, 0, plObjRefMsg::kInterface), plRefFlags::kActiveRef); + hsgResMgr::ResMgr()->AddViaNotify(shapeKey, new plObjRefMsg(obj->GetKey(), plRefMsg::kOnCreate, 0, plObjRefMsg::kInterface), plRefFlags::kActiveRef); return true; } @@ -1770,7 +1770,7 @@ hsBool plActivePrintShapeComponent::Convert(plMaxNode* node, plErrorMsg* pErrMsg if( !obj ) return true; - plActivePrintShape* shape = TRACKED_NEW plActivePrintShape(); + plActivePrintShape* shape = new plActivePrintShape(); plKey shapeKey = hsgResMgr::ResMgr()->NewKey(IGetUniqueName(node), shape, node->GetLocation()); shape->SetWidth(fCompPB->GetFloat(kWidth)); @@ -1789,7 +1789,7 @@ hsBool plActivePrintShapeComponent::Convert(plMaxNode* node, plErrorMsg* pErrMsg } - hsgResMgr::ResMgr()->AddViaNotify(shapeKey, TRACKED_NEW plObjRefMsg(obj->GetKey(), plRefMsg::kOnCreate, 0, plObjRefMsg::kInterface), plRefFlags::kActiveRef); + hsgResMgr::ResMgr()->AddViaNotify(shapeKey, new plObjRefMsg(obj->GetKey(), plRefMsg::kOnCreate, 0, plObjRefMsg::kInterface), plRefFlags::kActiveRef); return true; } diff --git a/Sources/Tools/MaxComponent/plFootstepComponent.cpp b/Sources/Tools/MaxComponent/plFootstepComponent.cpp index d9c13da2..4c8131b8 100644 --- a/Sources/Tools/MaxComponent/plFootstepComponent.cpp +++ b/Sources/Tools/MaxComponent/plFootstepComponent.cpp @@ -42,7 +42,6 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "HeadSpin.h" #include "max.h" #include "resource.h" -#include "hsConfig.h" #include #include "hsResMgr.h" #include "MaxMain/plPlasmaRefMsgs.h" @@ -113,7 +112,7 @@ extern const plArmatureMod * FindArmatureMod(const plSceneObject *obj); hsBool plFootstepSoundComponent::Convert(plMaxNode *node, plErrorMsg *pErrMsg) { plGenRefMsg *msg; - plArmatureEffectFootSound *effect = TRACKED_NEW plArmatureEffectFootSound(); + plArmatureEffectFootSound *effect = new plArmatureEffectFootSound(); // Note: MUST be a hard-coded keyname, since we search for same name in plArmatureMod.cpp hsgResMgr::ResMgr()->NewKey( "FootstepSounds", effect, node->GetLocation()); @@ -130,7 +129,7 @@ hsBool plFootstepSoundComponent::Convert(plMaxNode *node, plErrorMsg *pErrMsg) plRandomSoundMod *mod = rsComp->fSoundMods[node]; if (mod != nil) { - msg = TRACKED_NEW plGenRefMsg(effect->GetKey(), plRefMsg::kOnCreate, i, -1); + msg = new plGenRefMsg(effect->GetKey(), plRefMsg::kOnCreate, i, -1); hsgResMgr::ResMgr()->AddViaNotify(mod->GetKey(), msg, plRefFlags::kActiveRef); } } @@ -138,7 +137,7 @@ hsBool plFootstepSoundComponent::Convert(plMaxNode *node, plErrorMsg *pErrMsg) } // Add it to the scene node's generic list, so that all avatars can access it. - plNodeRefMsg* nodeRefMsg = TRACKED_NEW plNodeRefMsg(node->GetRoomKey(), plNodeRefMsg::kOnRequest, -1, plNodeRefMsg::kGeneric); + plNodeRefMsg* nodeRefMsg = new plNodeRefMsg(node->GetRoomKey(), plNodeRefMsg::kOnRequest, -1, plNodeRefMsg::kGeneric); hsgResMgr::ResMgr()->AddViaNotify(effect->GetKey(), nodeRefMsg, plRefFlags::kActiveRef); return true; diff --git a/Sources/Tools/MaxComponent/plGUIComponents.cpp b/Sources/Tools/MaxComponent/plGUIComponents.cpp index 345a7692..10038a33 100644 --- a/Sources/Tools/MaxComponent/plGUIComponents.cpp +++ b/Sources/Tools/MaxComponent/plGUIComponents.cpp @@ -406,7 +406,7 @@ public: kRefCurrIDSel = 64 // So we can share it among other components }; - static UInt32 GetTagIDOnNode( plMaxNode *node ); + static uint32_t GetTagIDOnNode( plMaxNode *node ); }; //Max desc stuff necessary below. @@ -435,7 +435,7 @@ void plGUITagProc::ILoadTags( HWND hWnd, IParamBlock2 *pb ) idx2 = idx = SendMessage( hWnd, CB_ADDSTRING, 0, (LPARAM)str ); SendMessage( hWnd, CB_SETITEMDATA, (WPARAM)idx, (LPARAM)0 ); - for( UInt32 i = 0; i < pfGameGUIMgr::GetNumTags(); i++ ) + for( uint32_t i = 0; i < pfGameGUIMgr::GetNumTags(); i++ ) { pfGUITag *tag = pfGameGUIMgr::GetTag( i ); idx = SendMessage( hWnd, CB_ADDSTRING, 0, (LPARAM)tag->fName ); @@ -612,9 +612,9 @@ hsBool plGUITagComponent::Convert(plMaxNode *node, plErrorMsg *pErrMsg) return true; } -UInt32 plGUITagComponent::GetTagIDOnNode( plMaxNode *node ) +uint32_t plGUITagComponent::GetTagIDOnNode( plMaxNode *node ) { - UInt32 i; + uint32_t i; for( i = 0; i < node->NumAttachedComponents( false ); i++ ) @@ -986,7 +986,7 @@ hsBool plGUIColorSchemeComp::Convert(plMaxNode *node, plErrorMsg *pErrMsg) pfGUIControlMod *ctrl = plGUIControlBase::GrabControlFromObject( node ); if( ctrl != nil ) { - pfGUIColorScheme *cs = TRACKED_NEW pfGUIColorScheme; + pfGUIColorScheme *cs = new pfGUIColorScheme; ConvertScheme( fCompPB, cs, pErrMsg ); ctrl->SetColorScheme( cs ); } @@ -1178,7 +1178,7 @@ plGUIDialogComponent::plGUIDialogComponent( hsBool dontInit ) pfGUIDialogMod *plGUIDialogComponent::IMakeDialog( void ) { - return TRACKED_NEW pfGUIDialogMod(); + return new pfGUIDialogMod(); } // SetupProperties - Internal setup and write-only set properties on the MaxNode. No reading @@ -1213,14 +1213,14 @@ hsBool plGUIDialogComponent::SetupProperties(plMaxNode *node, plErrorMsg *pErrM } const char *ageName = fCompPB->GetStr(kRefAgeName); - Int32 seqNum = plPageInfoUtils::GetSeqNumFromAgeDesc( ageName, dialogName ); - Int32 newNum = plPluginResManager::ResMgr()->VerifySeqNumber( seqNum, ageName, dialogName ); + int32_t seqNum = plPageInfoUtils::GetSeqNumFromAgeDesc( ageName, dialogName ); + int32_t newNum = plPluginResManager::ResMgr()->VerifySeqNumber( seqNum, ageName, dialogName ); if( newNum != seqNum ) { if( !fSeqNumValidated ) { plLocation pageLoc = plPluginResManager::ResMgr()->FindLocation( ageName, dialogName ); - Int32 pageSeqNum = pageLoc.GetSequenceNumber(); + int32_t pageSeqNum = pageLoc.GetSequenceNumber(); char errMsg[ 512 ]; sprintf( errMsg, "The sequence number stored by the resource manager (0x%X) for page %s, District, %s does not match\n" "the sequence number stored in the .age file (0x%X). Forcing it to use the one in the .age file", @@ -1268,7 +1268,7 @@ hsBool plGUIDialogComponent::Convert(plMaxNode *node, plErrorMsg *pErrMsg) return true; } - plPostEffectMod* mod = TRACKED_NEW plPostEffectMod; + plPostEffectMod* mod = new plPostEffectMod; float hither = cam->GetEnvRange(timeVal, ENV_NEAR_RANGE); if( hither < 0.5f ) @@ -1281,7 +1281,7 @@ hsBool plGUIDialogComponent::Convert(plMaxNode *node, plErrorMsg *pErrMsg) float fov = cam->GetFOV(timeVal); // convert int FOVType = cam->GetFOVType(); - hsScalar fovX, fovY; + float fovX, fovY; switch(FOVType) { case 0: // FOV_W @@ -1297,15 +1297,15 @@ hsBool plGUIDialogComponent::Convert(plMaxNode *node, plErrorMsg *pErrMsg) } break; } - fovX *= 180.f / hsScalarPI; - fovY *= 180.f / hsScalarPI; + fovX *= 180.f / M_PI; + fovY *= 180.f / M_PI; mod->SetFovX(fovX); mod->SetFovY(fovY); // Should already be created from SetupProperties... // Note: can't just grab the node's room key, 'cause we might not be on the right node! plKey sceneNodeKey = plPluginResManager::ResMgr()->NameToLoc( fCompPB->GetStr( kRefAgeName ), - fCompPB->GetStr( kRefDialogName ), (UInt32)-1 ); + fCompPB->GetStr( kRefDialogName ), (uint32_t)-1 ); mod->SetNodeKey( sceneNodeKey ); // node->AddModifier(mod); @@ -1320,10 +1320,10 @@ hsBool plGUIDialogComponent::Convert(plMaxNode *node, plErrorMsg *pErrMsg) plLocation nodeLoc = sceneNodeKey->GetUoid().GetLocation(); plKey modKey = hsgResMgr::ResMgr()->NewKey( fCompPB->GetStr( kRefDialogName ), mod, nodeLoc ); - hsgResMgr::ResMgr()->AddViaNotify( modKey, TRACKED_NEW plNodeRefMsg( sceneNodeKey, plRefMsg::kOnCreate, -1, plNodeRefMsg::kGeneric ), plRefFlags::kActiveRef ); + hsgResMgr::ResMgr()->AddViaNotify( modKey, new plNodeRefMsg( sceneNodeKey, plRefMsg::kOnCreate, -1, plNodeRefMsg::kGeneric ), plRefFlags::kActiveRef ); // Also add our dialog mod to the scene node in the same way - hsgResMgr::ResMgr()->AddViaNotify( fDialogMod->GetKey(), TRACKED_NEW plNodeRefMsg( sceneNodeKey, plRefMsg::kOnCreate, -1, plNodeRefMsg::kGeneric ), plRefFlags::kActiveRef ); + hsgResMgr::ResMgr()->AddViaNotify( fDialogMod->GetKey(), new plNodeRefMsg( sceneNodeKey, plRefMsg::kOnCreate, -1, plNodeRefMsg::kGeneric ), plRefFlags::kActiveRef ); /// Already created our mod, just gotta fill it out fDialogMod->SetRenderMod( mod ); @@ -1357,7 +1357,7 @@ hsBool plGUIDialogComponent::PreConvert(plMaxNode *node, plErrorMsg *pErrMsg) // Note: can't just grab the node's room key, 'cause we might not be on the right node! plKey sceneNodeKey = plPluginResManager::ResMgr()->NameToLoc( fCompPB->GetStr( kRefAgeName ), - fCompPB->GetStr( kRefDialogName ), (UInt32)-1 ); + fCompPB->GetStr( kRefDialogName ), (uint32_t)-1 ); plLocation nodeLoc = sceneNodeKey->GetUoid().GetLocation(); plKey dlgKey = hsgResMgr::ResMgr()->NewKey( fCompPB->GetStr( kRefDialogName ), fDialogMod, nodeLoc ); @@ -1365,7 +1365,7 @@ hsBool plGUIDialogComponent::PreConvert(plMaxNode *node, plErrorMsg *pErrMsg) fDialogMod->SetSceneNodeKey( sceneNodeKey ); // See if there's a tag to be had - UInt32 id = fCompPB->GetInt( plGUITagComponent::kRefCurrIDSel ); + uint32_t id = fCompPB->GetInt( plGUITagComponent::kRefCurrIDSel ); if( id > 0 ) fDialogMod->SetTagID( id ); @@ -1422,7 +1422,7 @@ bool plGUIDialogComponent::SetNotifyReceiver( plKey key ) pfGUIDialogMod *plGUIDialogComponent::GetNodeDialog( plMaxNode *childNode ) { - UInt32 i, numComp = childNode->NumAttachedComponents( false ); + uint32_t i, numComp = childNode->NumAttachedComponents( false ); for( i = 0; i < numComp; i++ ) { plComponentBase *comp = childNode->GetAttachedComponent( i ); @@ -1544,7 +1544,7 @@ void plGUIControlBase::CollectNonDrawables( INodeTab &nonDrawables ) pfGUIDialogMod *plGUIControlBase::IGetDialogMod( plMaxNode *node ) { - UInt32 i; + uint32_t i; for( i = 0; i < node->NumAttachedComponents( false ); i++ ) @@ -1582,12 +1582,12 @@ hsBool plGUIControlBase::PreConvert(plMaxNode *node, plErrorMsg *pErrMsg) node->AddModifier( fControl, IGetUniqueName(node) ); // Look for any tag IDs - UInt32 id = plGUITagComponent::GetTagIDOnNode( node ); + uint32_t id = plGUITagComponent::GetTagIDOnNode( node ); if( id > 0 ) fControl->SetTagID( id ); // Now add it to our list of converted nodes - UInt32 i = fTargetNodes.Find( node ); + uint32_t i = fTargetNodes.Find( node ); if( i == fTargetNodes.kMissingIndex ) { fTargetNodes.Append( node ); @@ -1626,7 +1626,7 @@ hsBool plGUIControlBase::Convert(plMaxNode *node, plErrorMsg *pErrMsg) // Grab fControl from the modifier list on the node, since fControl isn't valid // between PreConvert() and Convert() (it might get called multiple times, once per node applied) - UInt32 i = fTargetNodes.Find( node ); + uint32_t i = fTargetNodes.Find( node ); if( i == fTargetNodes.kMissingIndex ) { pErrMsg->Set( true, "GUI Control Component Error", "The object %s somehow skipped the GUI control Pre-convert stage. Inform a programmer immediately and seek shelter.", node->GetName() ).Show(); @@ -1645,7 +1645,7 @@ hsBool plGUIControlBase::Convert(plMaxNode *node, plErrorMsg *pErrMsg) { case 0: // Console command - fControl->SetHandler( TRACKED_NEW pfGUIConsoleCmdProc( fCompPB->GetStr( kRefConsoleCmd ) ) ); + fControl->SetHandler( new pfGUIConsoleCmdProc( fCompPB->GetStr( kRefConsoleCmd ) ) ); break; case 1: @@ -1656,7 +1656,7 @@ hsBool plGUIControlBase::Convert(plMaxNode *node, plErrorMsg *pErrMsg) break; case 2: - fControl->SetHandler( TRACKED_NEW pfGUICloseDlgProc() ); + fControl->SetHandler( new pfGUICloseDlgProc() ); break; case 3: @@ -1674,7 +1674,7 @@ hsBool plGUIControlBase::Convert(plMaxNode *node, plErrorMsg *pErrMsg) Mtl *maxMaterial = hsMaterialConverter::Instance().GetBaseMtl( node ); hsTArray *mtlArray = hsMaterialConverter::Instance().CreateMaterialArray( maxMaterial, node, 0 ); - UInt32 i, j; + uint32_t i, j; plDynamicTextMap *dynText = nil; plLayerInterface *layerIFace = nil; @@ -1715,7 +1715,7 @@ hsBool plGUIControlBase::Convert(plMaxNode *node, plErrorMsg *pErrMsg) pfGUIControlMod *plGUIControlBase::GrabControlFromObject( INode *node ) { - UInt32 i; + uint32_t i; plMaxNodeBase *maxNode = (plMaxNodeBase *)node; @@ -1788,7 +1788,7 @@ pfGUIControlMod *plGUIControlBase::ConvertCompToControl( plComponentBase *comp, } else { - UInt32 i = base->fTargetNodes.Find( (plMaxNode *)sceneObjectNode ); + uint32_t i = base->fTargetNodes.Find( (plMaxNode *)sceneObjectNode ); if( i == base->fTargetNodes.kMissingIndex ) return nil; @@ -1799,7 +1799,7 @@ pfGUIControlMod *plGUIControlBase::ConvertCompToControl( plComponentBase *comp, return nil; } -const char *plGUIControlBase::ISetSoundIndex( ParamID checkBoxID, ParamID sndCompID, UInt8 guiCtrlEvent, plMaxNode *maxNode ) +const char *plGUIControlBase::ISetSoundIndex( ParamID checkBoxID, ParamID sndCompID, uint8_t guiCtrlEvent, plMaxNode *maxNode ) { if( fCompPB->GetInt( checkBoxID ) ) { @@ -1878,7 +1878,7 @@ class plGUIButtonComponent : public plGUIControlBase { protected: - virtual pfGUIControlMod *IGetNewControl( void ) { return TRACKED_NEW pfGUIButtonMod; } + virtual pfGUIControlMod *IGetNewControl( void ) { return new pfGUIButtonMod; } virtual bool ICanHaveProxy( void ) { return true; } public: @@ -2220,7 +2220,7 @@ class plGUICheckBoxComponent : public plGUIControlBase { protected: - virtual pfGUIControlMod *IGetNewControl( void ) { return TRACKED_NEW pfGUICheckBoxCtrl; } + virtual pfGUIControlMod *IGetNewControl( void ) { return new pfGUICheckBoxCtrl; } virtual bool ICanHaveProxy( void ) { return true; } public: @@ -2420,7 +2420,7 @@ class plGUIDraggableComponent : public plGUIControlBase { protected: - virtual pfGUIControlMod *IGetNewControl( void ) { return TRACKED_NEW pfGUIDraggableMod; } + virtual pfGUIControlMod *IGetNewControl( void ) { return new pfGUIDraggableMod; } virtual bool ICanHaveProxy( void ) { return true; } public: @@ -2529,7 +2529,7 @@ class plGUIKnobCtrlComponent : public plGUIControlBase { protected: - virtual pfGUIControlMod *IGetNewControl( void ) { return TRACKED_NEW pfGUIKnobCtrl; } + virtual pfGUIControlMod *IGetNewControl( void ) { return new pfGUIKnobCtrl; } virtual bool ICanHaveProxy( void ) { return true; } hsBool IGrabAnimationRange( plMaxNode *node, plErrorMsg *pErrMsg, hsMatrix44 &startL2W, hsMatrix44 &endL2W ); @@ -2644,14 +2644,14 @@ hsBool plGUIKnobCtrlComponent::IGrabAnimationRange( plMaxNode *node, plErrorMsg // Get the affine parts and the TM Controller plSceneObject *obj = node->GetSceneObject(); - hsAffineParts * parts = TRACKED_NEW hsAffineParts; + hsAffineParts * parts = new hsAffineParts; plController* tmc = hsControlConverter::Instance().ConvertTMAnim(obj, node, parts); if (tmc) { - plMatrixControllerChannel *channel = TRACKED_NEW plMatrixControllerChannel(tmc, parts); + plMatrixControllerChannel *channel = new plMatrixControllerChannel(tmc, parts); - hsScalar length = tmc->GetLength(); + float length = tmc->GetLength(); startL2W = channel->Value( 0.f ); endL2W = channel->Value( length ); @@ -2778,7 +2778,7 @@ class plGUIListBoxComponent : public plGUIControlBase { protected: - virtual pfGUIControlMod *IGetNewControl( void ) { return TRACKED_NEW pfGUIListBoxMod; } + virtual pfGUIControlMod *IGetNewControl( void ) { return new pfGUIListBoxMod; } virtual bool INeedsDynamicText( void ) { return true; } public: @@ -2948,7 +2948,7 @@ hsBool plGUIListBoxComponent::Convert(plMaxNode *node, plErrorMsg *pErrMsg) pfGUIValueCtrl *scroll = pfGUIValueCtrl::ConvertNoRef( GrabControlMod( fCompPB->GetINode( kRefScrollCtrl ) ) ); if( scroll != nil ) { - hsgResMgr::ResMgr()->AddViaNotify( scroll->GetKey(), TRACKED_NEW plGenRefMsg( ctrl->GetKey(), + hsgResMgr::ResMgr()->AddViaNotify( scroll->GetKey(), new plGenRefMsg( ctrl->GetKey(), plRefMsg::kOnCreate, -1, pfGUIListBoxMod::kRefScrollCtrl ), plRefFlags::kActiveRef ); } } @@ -2993,7 +2993,7 @@ hsBool plGUIListBoxComponent::Convert(plMaxNode *node, plErrorMsg *pErrMsg) hsAssert( nodeID == GUI_SKIN_CLASSID, "Bad node param in GUIMenu::Convert()" ); plGUISkinComp *skin = (plGUISkinComp *)comp; - hsgResMgr::ResMgr()->AddViaNotify( skin->GetConvertedSkin()->GetKey(), TRACKED_NEW plGenRefMsg( ctrl->GetKey(), plRefMsg::kOnCreate, -1, pfGUIControlMod::kRefSkin ), plRefFlags::kActiveRef ); + hsgResMgr::ResMgr()->AddViaNotify( skin->GetConvertedSkin()->GetKey(), new plGenRefMsg( ctrl->GetKey(), plRefMsg::kOnCreate, -1, pfGUIControlMod::kRefSkin ), plRefFlags::kActiveRef ); } } @@ -3013,7 +3013,7 @@ class plGUITextBoxComponent : public plGUIControlBase { protected: - virtual pfGUIControlMod *IGetNewControl( void ) { return TRACKED_NEW pfGUITextBoxMod; } + virtual pfGUIControlMod *IGetNewControl( void ) { return new pfGUITextBoxMod; } virtual bool INeedsDynamicText( void ) { return true; } public: @@ -3110,14 +3110,14 @@ public: int strLen = SendDlgItemMessage( hWnd, IDC_GUI_INITTEXT, WM_GETTEXTLENGTH, 0, 0 ); if( strLen > 0 ) { - char *str = TRACKED_NEW char[ strLen + 1 ]; + char *str = new char[ strLen + 1 ]; GetDlgItemText( hWnd, IDC_GUI_INITTEXT, str, strLen + 1 ); str[ strLen ] = 0; ISetTranslation(fCurLanguage,str); delete [] str; std::string translation = plLocalization::LocalToString(fTranslations); - str = TRACKED_NEW char[ translation.length() + 1 ]; + str = new char[ translation.length() + 1 ]; strcpy(str,translation.c_str()); str[translation.length()] = 0; @@ -3141,7 +3141,7 @@ public: int strLen = SendDlgItemMessage( hWnd, IDC_GUI_LOCALIZATION_PATH, WM_GETTEXTLENGTH, 0, 0 ); if( strLen > 0 ) { - char *str = TRACKED_NEW char[ strLen + 1 ]; + char *str = new char[ strLen + 1 ]; GetDlgItemText( hWnd, IDC_GUI_LOCALIZATION_PATH, str, strLen + 1 ); str[ strLen ] = 0; pmap->GetParamBlock()->SetValue( plGUITextBoxComponent::kRefLocalizationPath, 0, str ); @@ -3310,7 +3310,7 @@ class plGUIEditBoxComponent : public plGUIControlBase { protected: - virtual pfGUIControlMod *IGetNewControl( void ) { return TRACKED_NEW pfGUIEditBoxMod; } + virtual pfGUIControlMod *IGetNewControl( void ) { return new pfGUIEditBoxMod; } virtual bool INeedsDynamicText( void ) { return true; } public: @@ -3405,7 +3405,7 @@ class plGUIUpDownPairComponent : public plGUIControlBase { protected: - virtual pfGUIControlMod *IGetNewControl( void ) { return TRACKED_NEW pfGUIUpDownPairMod; } + virtual pfGUIControlMod *IGetNewControl( void ) { return new pfGUIUpDownPairMod; } public: plGUIUpDownPairComponent(); @@ -3617,7 +3617,7 @@ class plGUIDragBarComponent : public plGUIControlBase { protected: - virtual pfGUIControlMod *IGetNewControl( void ) { return TRACKED_NEW pfGUIDragBarCtrl; } + virtual pfGUIControlMod *IGetNewControl( void ) { return new pfGUIDragBarCtrl; } virtual bool ICanHaveProxy( void ) { return true; } public: @@ -3703,7 +3703,7 @@ class plGUIRadioGroupComponent : public plGUIControlBase protected: - virtual pfGUIControlMod *IGetNewControl( void ) { return TRACKED_NEW pfGUIRadioGroupCtrl; } + virtual pfGUIControlMod *IGetNewControl( void ) { return new pfGUIRadioGroupCtrl; } public: plGUIRadioGroupComponent(); @@ -3916,7 +3916,7 @@ class plGUIDynDisplayComponent : public plGUIControlBase { protected: - virtual pfGUIControlMod *IGetNewControl( void ) { return TRACKED_NEW pfGUIDynDisplayCtrl; } + virtual pfGUIControlMod *IGetNewControl( void ) { return new pfGUIDynDisplayCtrl; } virtual bool IHasProcRollout( void ) { return false; } public: @@ -4045,7 +4045,7 @@ hsBool plGUIDynDisplayComponent::Convert(plMaxNode *node, plErrorMsg *pErrMsg) const hsTArray &materials = hsMaterialConverter::Instance().DoneMaterials(); - UInt32 i,count = pLayer->GetNumConversionTargets(); + uint32_t i,count = pLayer->GetNumConversionTargets(); for( i = 0; i < count; i++ ) { plLayerInterface *layIface = pLayer->GetConversionTarget( i ); @@ -4056,12 +4056,12 @@ hsBool plGUIDynDisplayComponent::Convert(plMaxNode *node, plErrorMsg *pErrMsg) if( map != nil ) ctrl->AddMap( map ); - UInt32 mat; + uint32_t mat; bool found = false; for (mat=0; matGetNumLayers(); lay++) { if (layIface->BottomOfStack() == curMaterial->GetLayer(lay)) @@ -4092,7 +4092,7 @@ class plGUIMultiLineEditComp : public plGUIControlBase { protected: - virtual pfGUIControlMod *IGetNewControl( void ) { return TRACKED_NEW pfGUIMultiLineEditCtrl; } + virtual pfGUIControlMod *IGetNewControl( void ) { return new pfGUIMultiLineEditCtrl; } virtual bool INeedsDynamicText( void ) { return true; } public: @@ -4192,7 +4192,7 @@ hsBool plGUIMultiLineEditComp::Convert(plMaxNode *node, plErrorMsg *pErrMsg) pfGUIValueCtrl *scroll = pfGUIValueCtrl::ConvertNoRef( GrabControlMod( fCompPB->GetINode( kRefScrollCtrl ) ) ); if( scroll != nil ) { - hsgResMgr::ResMgr()->AddViaNotify( scroll->GetKey(), TRACKED_NEW plGenRefMsg( ctrl->GetKey(), + hsgResMgr::ResMgr()->AddViaNotify( scroll->GetKey(), new plGenRefMsg( ctrl->GetKey(), plRefMsg::kOnCreate, -1, pfGUIMultiLineEditCtrl::kRefScrollCtrl ), plRefFlags::kActiveRef ); } } @@ -4214,7 +4214,7 @@ class plGUIProgressCtrlComponent : public plGUIControlBase { protected: - virtual pfGUIControlMod *IGetNewControl( void ) { return TRACKED_NEW pfGUIProgressCtrl; } + virtual pfGUIControlMod *IGetNewControl( void ) { return new pfGUIProgressCtrl; } virtual bool ICanHaveProxy( void ) { return false; } public: @@ -4476,7 +4476,7 @@ class plGUIClickMapComponent : public plGUIControlBase { protected: - virtual pfGUIControlMod *IGetNewControl( void ) { return TRACKED_NEW pfGUIClickMapCtrl; } + virtual pfGUIControlMod *IGetNewControl( void ) { return new pfGUIClickMapCtrl; } virtual bool ICanHaveProxy( void ) { return false; } public: @@ -4695,12 +4695,12 @@ plKey plGUISkinComp::GetConvertedSkinKey( void ) const return nil; } -UInt32 plGUISkinComp::GetNumMtls( void ) const +uint32_t plGUISkinComp::GetNumMtls( void ) const { return 1; } -Texmap *plGUISkinComp::GetMtl( UInt32 idx ) +Texmap *plGUISkinComp::GetMtl( uint32_t idx ) { return (Texmap *)GetSkinBitmap(); } @@ -4713,7 +4713,7 @@ plLayerTex *plGUISkinComp::GetSkinBitmap( void ) plLayerTex *layer = (plLayerTex *)fCompPB->GetTexmap( kRefBitmap, 0 ); if( layer == nil || layer->ClassID() != LAYER_TEX_CLASS_ID ) { - layer = TRACKED_NEW plLayerTex; + layer = new plLayerTex; fCompPB->SetValue( kRefBitmap, 0, (Texmap *)layer ); } @@ -4758,7 +4758,7 @@ hsBool plGUISkinComp::PreConvert(plMaxNode *node, plErrorMsg *pErrMsg) return true; } - fConvertedSkin = TRACKED_NEW pfGUISkin(); + fConvertedSkin = new pfGUISkin(); hsgResMgr::ResMgr()->NewKey( IGetUniqueName(node), fConvertedSkin, node->GetLocation() ); return true; @@ -4773,7 +4773,7 @@ hsBool plGUISkinComp::Convert(plMaxNode *node, plErrorMsg *pErrMsg) fConvertedSkin->SetMargins( fCompPB->GetInt( kRefItemMargin ), fCompPB->GetInt( kRefBorderMargin ) ); - UInt32 i; + uint32_t i; for( i = 0; i < pfGUISkin::kNumElements; i++ ) { ParamID id = ( i * 4 ) + kRefUpLeftCorner; @@ -4791,7 +4791,7 @@ hsBool plGUISkinComp::Convert(plMaxNode *node, plErrorMsg *pErrMsg) plBitmap *bMap = plLayerConverter::Instance().CreateSimpleTexture( texture->bi.Name(), fConvertedSkin->GetKey()->GetUoid().GetLocation(), 0, plMipmap::kForceNonCompressed | plMipmap::kAlphaChannelFlag | plMipmap::kNoMaxSize ); if( bMap != nil && plMipmap::ConvertNoRef( bMap ) != nil ) { - hsgResMgr::ResMgr()->AddViaNotify( bMap->GetKey(), TRACKED_NEW plGenRefMsg( fConvertedSkin->GetKey(), + hsgResMgr::ResMgr()->AddViaNotify( bMap->GetKey(), new plGenRefMsg( fConvertedSkin->GetKey(), plRefMsg::kOnCreate, -1, pfGUISkin::kRefMipmap ), plRefFlags::kActiveRef ); } } @@ -4903,7 +4903,7 @@ plGUIMenuComponent::plGUIMenuComponent() : plGUIDialogComponent( true ) pfGUIDialogMod *plGUIMenuComponent::IMakeDialog( void ) { - return TRACKED_NEW pfGUIPopUpMenu(); + return new pfGUIPopUpMenu(); } plKey plGUIMenuComponent::GetConvertedMenuKey( void ) const @@ -4975,7 +4975,7 @@ hsBool plGUIMenuComponent::Convert(plMaxNode *node, plErrorMsg *pErrMsg) const plLocation &loc = menu->GetKey()->GetUoid().GetLocation(); // Create the rendermod - plPostEffectMod *renderMod = TRACKED_NEW plPostEffectMod; + plPostEffectMod *renderMod = new plPostEffectMod; hsgResMgr::ResMgr()->NewKey( IGetUniqueName(node), renderMod, loc ); renderMod->SetHither( 0.5f ); @@ -4988,29 +4988,29 @@ hsBool plGUIMenuComponent::Convert(plMaxNode *node, plErrorMsg *pErrMsg) float fovX = atan( scrnWidth / ( 2.f * 100.f ) ) * 2.f; float fovY = fovX;// * 3.f / 4.f; - renderMod->SetFovX( fovX * 180.f / hsScalarPI ); - renderMod->SetFovY( fovY * 180.f / hsScalarPI ); + renderMod->SetFovX( fovX * 180.f / M_PI ); + renderMod->SetFovY( fovY * 180.f / M_PI ); - hsgResMgr::ResMgr()->AddViaNotify( renderMod->GetKey(), TRACKED_NEW plNodeRefMsg( fConvertedNode, plRefMsg::kOnCreate, -1, plNodeRefMsg::kGeneric ), plRefFlags::kActiveRef ); - hsgResMgr::ResMgr()->AddViaNotify( fConvertedNode, TRACKED_NEW plGenRefMsg( renderMod->GetKey(), plRefMsg::kOnCreate, 0, plPostEffectMod::kNodeRef ), plRefFlags::kPassiveRef ); + hsgResMgr::ResMgr()->AddViaNotify( renderMod->GetKey(), new plNodeRefMsg( fConvertedNode, plRefMsg::kOnCreate, -1, plNodeRefMsg::kGeneric ), plRefFlags::kActiveRef ); + hsgResMgr::ResMgr()->AddViaNotify( fConvertedNode, new plGenRefMsg( renderMod->GetKey(), plRefMsg::kOnCreate, 0, plPostEffectMod::kNodeRef ), plRefFlags::kPassiveRef ); menu->SetRenderMod( renderMod ); menu->SetName( fCompPB->GetStr( kRefDialogName ) ); // Create the dummy scene object to hold the menu - plSceneObject *newObj = TRACKED_NEW plSceneObject; + plSceneObject *newObj = new plSceneObject; hsgResMgr::ResMgr()->NewKey( IGetUniqueName(node), newObj, loc ); // *#&$(*@&#$ need a coordIface... - plCoordinateInterface *newCI = TRACKED_NEW plCoordinateInterface; + plCoordinateInterface *newCI = new plCoordinateInterface; hsgResMgr::ResMgr()->NewKey( IGetUniqueName(node), newCI, loc ); - hsgResMgr::ResMgr()->AddViaNotify( menu->GetKey(), TRACKED_NEW plObjRefMsg( newObj->GetKey(), plRefMsg::kOnCreate, -1, plObjRefMsg::kModifier ), plRefFlags::kActiveRef ); + hsgResMgr::ResMgr()->AddViaNotify( menu->GetKey(), new plObjRefMsg( newObj->GetKey(), plRefMsg::kOnCreate, -1, plObjRefMsg::kModifier ), plRefFlags::kActiveRef ); - hsgResMgr::ResMgr()->AddViaNotify( newCI->GetKey(), TRACKED_NEW plObjRefMsg( newObj->GetKey(), plRefMsg::kOnCreate, -1, plObjRefMsg::kInterface ), plRefFlags::kActiveRef ); - hsgResMgr::ResMgr()->AddViaNotify( renderMod->GetKey(), TRACKED_NEW plObjRefMsg( newObj->GetKey(), plRefMsg::kOnCreate, -1, plObjRefMsg::kModifier ), plRefFlags::kActiveRef ); + hsgResMgr::ResMgr()->AddViaNotify( newCI->GetKey(), new plObjRefMsg( newObj->GetKey(), plRefMsg::kOnCreate, -1, plObjRefMsg::kInterface ), plRefFlags::kActiveRef ); + hsgResMgr::ResMgr()->AddViaNotify( renderMod->GetKey(), new plObjRefMsg( newObj->GetKey(), plRefMsg::kOnCreate, -1, plObjRefMsg::kModifier ), plRefFlags::kActiveRef ); newObj->SetSceneNode( fConvertedNode ); menu->SetSceneNodeKey( fConvertedNode ); @@ -5033,8 +5033,8 @@ hsBool plGUIMenuComponent::PreConvert(plMaxNode *node, plErrorMsg *pErrMsg) return true; // Only convert once, since we don't care what node we're on /// Create an entirely new sceneNode for us - Int32 seqNum = plPageInfoUtils::GetSeqNumFromAgeDesc( fCompPB->GetStr( kRefAgeName ), fCompPB->GetStr( kRefDialogName ) ); - Int32 newNum = plPluginResManager::ResMgr()->VerifySeqNumber( seqNum, fCompPB->GetStr( kRefAgeName ), fCompPB->GetStr( kRefDialogName ) ); + int32_t seqNum = plPageInfoUtils::GetSeqNumFromAgeDesc( fCompPB->GetStr( kRefAgeName ), fCompPB->GetStr( kRefDialogName ) ); + int32_t newNum = plPluginResManager::ResMgr()->VerifySeqNumber( seqNum, fCompPB->GetStr( kRefAgeName ), fCompPB->GetStr( kRefDialogName ) ); if( newNum != seqNum ) { if( !fSeqNumValidated ) @@ -5056,7 +5056,7 @@ hsBool plGUIMenuComponent::PreConvert(plMaxNode *node, plErrorMsg *pErrMsg) return false; } - fConvertedMenu = TRACKED_NEW pfGUIPopUpMenu(); + fConvertedMenu = new pfGUIPopUpMenu(); hsgResMgr::ResMgr()->NewKey( IGetUniqueName(node), fConvertedMenu, fConvertedNode->GetUoid().GetLocation() ); return true; diff --git a/Sources/Tools/MaxComponent/plGUIComponents.h b/Sources/Tools/MaxComponent/plGUIComponents.h index 21794c62..f30bcc0a 100644 --- a/Sources/Tools/MaxComponent/plGUIComponents.h +++ b/Sources/Tools/MaxComponent/plGUIComponents.h @@ -77,7 +77,7 @@ class plGUIDialogComponent : public plComponent virtual pfGUIDialogMod *IMakeDialog( void ); public: - // I believe booleans should always default to false, hence why this is dontInit instead of init. Byte me. + // I believe booleans should always default to false, hence why this is dontInit instead of init. uint8_t me. plGUIDialogComponent( hsBool dontInit = false ); void DeleteThis() { delete this; } @@ -133,7 +133,7 @@ class plGUIControlBase : public plComponent virtual bool INeedsDynamicText( void ) { return false; } virtual bool ICanHaveProxy( void ) { return false; } - const char *ISetSoundIndex( ParamID checkBoxID, ParamID sndCompID, UInt8 guiCtrlEvent, plMaxNode *node ); + const char *ISetSoundIndex( ParamID checkBoxID, ParamID sndCompID, uint8_t guiCtrlEvent, plMaxNode *node ); // When converting, since we get a new instance per component but not per node, @@ -153,8 +153,8 @@ class plGUIControlBase : public plComponent virtual void CollectNonDrawables( INodeTab &nonDrawables ); - virtual UInt32 GetNumMtls( void ) const { return 0; } - virtual Texmap *GetMtl( UInt32 idx ) { return nil; } + virtual uint32_t GetNumMtls( void ) const { return 0; } + virtual Texmap *GetMtl( uint32_t idx ) { return nil; } // Given a maxNode that is really a component, will return a pointer to the GUI control modifier // created for it at export time. Only valid after PreConvert. If you think the control component diff --git a/Sources/Tools/MaxComponent/plGrassComponent.cpp b/Sources/Tools/MaxComponent/plGrassComponent.cpp index 8572341e..bf398df3 100644 --- a/Sources/Tools/MaxComponent/plGrassComponent.cpp +++ b/Sources/Tools/MaxComponent/plGrassComponent.cpp @@ -236,7 +236,7 @@ plGrassComponent::plGrassComponent() : fShader(nil) hsBool plGrassComponent::PreConvert(plMaxNode *node, plErrorMsg *pErrMsg) { - fShader = TRACKED_NEW plGrassShaderMod(); + fShader = new plGrassShaderMod(); plLoadMask loadMask; int qual = 1; @@ -263,12 +263,12 @@ hsBool plGrassComponent::PreConvert(plMaxNode *node, plErrorMsg *pErrMsg) hsBool plGrassComponent::Convert(plMaxNode *node, plErrorMsg *pErrMsg) { - plObjRefMsg* refMsg = TRACKED_NEW plObjRefMsg(node->GetKey(), plRefMsg::kOnRequest, -1, plObjRefMsg::kModifier); + plObjRefMsg* refMsg = new plObjRefMsg(node->GetKey(), plRefMsg::kOnRequest, -1, plObjRefMsg::kModifier); hsgResMgr::ResMgr()->AddViaNotify(fShader->GetKey(), refMsg, plRefFlags::kActiveRef); hsTArray mats; hsMaterialConverter::Instance().CollectConvertedMaterials(hsMaterialConverter::Instance().GetBaseMtl(node), mats); - hsgResMgr::ResMgr()->SendRef(mats[0]->GetKey(), TRACKED_NEW plGenRefMsg(fShader->GetKey(), plRefMsg::kOnRequest, 0, plGrassShaderMod::kRefMaterial), plRefFlags::kActiveRef); + hsgResMgr::ResMgr()->SendRef(mats[0]->GetKey(), new plGenRefMsg(fShader->GetKey(), plRefMsg::kOnRequest, 0, plGrassShaderMod::kRefMaterial), plRefFlags::kActiveRef); return TRUE; } diff --git a/Sources/Tools/MaxComponent/plIgnoreComponent.cpp b/Sources/Tools/MaxComponent/plIgnoreComponent.cpp index ae51ae6e..c5a539e4 100644 --- a/Sources/Tools/MaxComponent/plIgnoreComponent.cpp +++ b/Sources/Tools/MaxComponent/plIgnoreComponent.cpp @@ -403,14 +403,14 @@ hsBool plNoShowComponent::Convert(plMaxNode *node, plErrorMsg *pErrMsg) { if( fCompPB->GetInt(kAffectDraw) ) { - plEnableMsg* eMsg = TRACKED_NEW plEnableMsg(nil, plEnableMsg::kDisable, plEnableMsg::kDrawable); + plEnableMsg* eMsg = new plEnableMsg(nil, plEnableMsg::kDisable, plEnableMsg::kDrawable); eMsg->AddReceiver(obj->GetKey()); eMsg->Send(); } if( fCompPB->GetInt(kAffectPhys) ) { hsAssert(0, "Who uses this?"); -// plEventGroupEnableMsg* pMsg = TRACKED_NEW plEventGroupEnableMsg; +// plEventGroupEnableMsg* pMsg = new plEventGroupEnableMsg; // pMsg->SetFlags(plEventGroupEnableMsg::kCollideOff | plEventGroupEnableMsg::kReportOff); // pMsg->AddReceiver(obj->GetKey()); // pMsg->Send(); diff --git a/Sources/Tools/MaxComponent/plImpactGadgetComponent.cpp b/Sources/Tools/MaxComponent/plImpactGadgetComponent.cpp index 9d13d0e0..e3f8d1d5 100644 --- a/Sources/Tools/MaxComponent/plImpactGadgetComponent.cpp +++ b/Sources/Tools/MaxComponent/plImpactGadgetComponent.cpp @@ -169,15 +169,15 @@ OBSOLETE_CLASS(plImpactGadget, gImpactGadgetDesc, "Collision Sensor", "Collisio // physNode = node; // // // Create remote detector -// plCollisionDetector* det = TRACKED_NEW plCollisionDetector; +// plCollisionDetector* det = new plCollisionDetector; // det->SetType(plCollisionDetector::kTypeBump); // // // Register the detector // plKey detKey = hsgResMgr::ResMgr()->NewKey(IGetUniqueName(node), det, loc); -// hsgResMgr::ResMgr()->AddViaNotify(detKey, TRACKED_NEW plObjRefMsg(physNode->GetSceneObject()->GetKey(), plRefMsg::kOnCreate, -1, plObjRefMsg::kModifier), plRefFlags::kActiveRef); +// hsgResMgr::ResMgr()->AddViaNotify(detKey, new plObjRefMsg(physNode->GetSceneObject()->GetKey(), plRefMsg::kOnCreate, -1, plObjRefMsg::kModifier), plRefFlags::kActiveRef); // // // create and register the CONDITIONS for the DETECTOR's Logic Modifier -// plActivatorConditionalObject* activatorCond = TRACKED_NEW plActivatorConditionalObject; +// plActivatorConditionalObject* activatorCond = new plActivatorConditionalObject; // plKey activatorKey = hsgResMgr::ResMgr()->NewKey(IGetUniqueName(node), activatorCond, loc); // // // link everything up: diff --git a/Sources/Tools/MaxComponent/plInventoryObjComponent.cpp b/Sources/Tools/MaxComponent/plInventoryObjComponent.cpp index 8eb8ab63..13b03360 100644 --- a/Sources/Tools/MaxComponent/plInventoryObjComponent.cpp +++ b/Sources/Tools/MaxComponent/plInventoryObjComponent.cpp @@ -186,11 +186,11 @@ hsBool plInventoryObjComponent::PreConvert(plMaxNode *node, plErrorMsg *pErrMsg) plSceneObject *obj = node->GetSceneObject(); // Create and register the ClickDrag's logic component - plLogicModifier *logic = TRACKED_NEW plLogicModifier; + plLogicModifier *logic = new plLogicModifier; char tmpName[256]; sprintf(tmpName, "%s_%s_LogicModifier", obj->GetKeyName(), GetINode()->GetName()); plKey logicKey = hsgResMgr::ResMgr()->NewKey(tmpName, logic, node->GetLocation()); - hsgResMgr::ResMgr()->AddViaNotify(logicKey, TRACKED_NEW plObjRefMsg(obj->GetKey(), plRefMsg::kOnCreate, -1, plObjRefMsg::kModifier), plRefFlags::kActiveRef); + hsgResMgr::ResMgr()->AddViaNotify(logicKey, new plObjRefMsg(obj->GetKey(), plRefMsg::kOnCreate, -1, plObjRefMsg::kModifier), plRefFlags::kActiveRef); fLogicModKeys[node] = logicKey; diff --git a/Sources/Tools/MaxComponent/plLODFadeComponent.cpp b/Sources/Tools/MaxComponent/plLODFadeComponent.cpp index c07f4519..9a4c01d0 100644 --- a/Sources/Tools/MaxComponent/plLODFadeComponent.cpp +++ b/Sources/Tools/MaxComponent/plLODFadeComponent.cpp @@ -50,7 +50,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "MaxMain/plMaxNode.h" #include "MaxExport/plExportProgressBar.h" -#include "hsTypes.h" +#include "HeadSpin.h" #include "plLODFadeComponent.h" @@ -630,7 +630,7 @@ hsBool plLOSFadeComponent::PreConvert(plMaxNode* node, plErrorMsg* pErrMsg) hsBool plLOSFadeComponent::Convert(plMaxNode* node, plErrorMsg* pErrMsg) { - plFadeOpacityMod* fade = TRACKED_NEW plFadeOpacityMod; + plFadeOpacityMod* fade = new plFadeOpacityMod; if( fCompPB->GetInt(kBoundsCenter) ) fade->SetFlag(plFadeOpacityMod::kBoundsCenter); @@ -724,7 +724,7 @@ hsBool plGZFadeComponent::PreConvert(plMaxNode* node, plErrorMsg* pErrMsg) hsBool plGZFadeComponent::Convert(plMaxNode* node, plErrorMsg* pErrMsg) { - plDistOpacityMod* fade = TRACKED_NEW plDistOpacityMod; + plDistOpacityMod* fade = new plDistOpacityMod; float opaq = fCompPB->GetFloat(kOpaque); float transp = fCompPB->GetFloat(kTransp); diff --git a/Sources/Tools/MaxComponent/plLightGrpComponent.cpp b/Sources/Tools/MaxComponent/plLightGrpComponent.cpp index f5649440..35fff7da 100644 --- a/Sources/Tools/MaxComponent/plLightGrpComponent.cpp +++ b/Sources/Tools/MaxComponent/plLightGrpComponent.cpp @@ -152,7 +152,7 @@ hsBool plLightGrpComponent::IAddLightsToSpans(plMaxNode* pNode, plErrorMsg* pErr plDrawableSpans* drawable = plDrawableSpans::ConvertNoRef(di->GetDrawable(iDraw)); if( drawable ) { - UInt32 diIndex = di->GetDrawableMeshIndex(iDraw); + uint32_t diIndex = di->GetDrawableMeshIndex(iDraw); ISendItOff(fLightInfos[i], drawable, diIndex); } @@ -161,7 +161,7 @@ hsBool plLightGrpComponent::IAddLightsToSpans(plMaxNode* pNode, plErrorMsg* pErr return true; } -hsBool plLightGrpComponent::ISendItOff(plLightInfo* liInfo, plDrawableSpans* drawable, UInt32 diIndex) +hsBool plLightGrpComponent::ISendItOff(plLightInfo* liInfo, plDrawableSpans* drawable, uint32_t diIndex) { plDISpanIndex spans = drawable->GetDISpans(diIndex); @@ -170,8 +170,8 @@ hsBool plLightGrpComponent::ISendItOff(plLightInfo* liInfo, plDrawableSpans* dra if( !fCompPB->GetInt(kTest) ) { - UInt8 liMsgType = liInfo->GetProjection() ? plDrawable::kMsgPermaProjDI : plDrawable::kMsgPermaLightDI; - plGenRefMsg* refMsg = TRACKED_NEW plGenRefMsg(drawable->GetKey(), plRefMsg::kOnCreate, diIndex, liMsgType); + uint8_t liMsgType = liInfo->GetProjection() ? plDrawable::kMsgPermaProjDI : plDrawable::kMsgPermaLightDI; + plGenRefMsg* refMsg = new plGenRefMsg(drawable->GetKey(), plRefMsg::kOnCreate, diIndex, liMsgType); hsgResMgr::ResMgr()->AddViaNotify(liInfo->GetKey(), refMsg, plRefFlags::kPassiveRef); } else @@ -180,13 +180,13 @@ hsBool plLightGrpComponent::ISendItOff(plLightInfo* liInfo, plDrawableSpans* dra hsBitVector litSpans; liInfo->GetAffectedForced(drawable->GetSpaceTree(), litSpans, false); - UInt8 liMsgType = liInfo->GetProjection() ? plDrawable::kMsgPermaProj : plDrawable::kMsgPermaLight; + uint8_t liMsgType = liInfo->GetProjection() ? plDrawable::kMsgPermaProj : plDrawable::kMsgPermaLight; int i; for( i = 0; i < spans.GetCount(); i++ ) { if( litSpans.IsBitSet(spans[i]) ) { - plGenRefMsg* refMsg = TRACKED_NEW plGenRefMsg(drawable->GetKey(), plRefMsg::kOnCreate, spans[i], liMsgType); + plGenRefMsg* refMsg = new plGenRefMsg(drawable->GetKey(), plRefMsg::kOnCreate, spans[i], liMsgType); hsgResMgr::ResMgr()->AddViaNotify(liInfo->GetKey(), refMsg, plRefFlags::kPassiveRef); } } diff --git a/Sources/Tools/MaxComponent/plLightGrpComponent.h b/Sources/Tools/MaxComponent/plLightGrpComponent.h index 5e8c66b7..598eb619 100644 --- a/Sources/Tools/MaxComponent/plLightGrpComponent.h +++ b/Sources/Tools/MaxComponent/plLightGrpComponent.h @@ -60,7 +60,7 @@ private: hsTArray fLightInfos; hsBool IAddLightsToSpans(plMaxNode* pNode, plErrorMsg* pErrMsg); - hsBool ISendItOff(plLightInfo* liInfo, plDrawableSpans* drawable, UInt32 diIndex); + hsBool ISendItOff(plLightInfo* liInfo, plDrawableSpans* drawable, uint32_t diIndex); hsBool IGetLightInfos(); public: diff --git a/Sources/Tools/MaxComponent/plLightMapComponent.cpp b/Sources/Tools/MaxComponent/plLightMapComponent.cpp index 1b710ed0..d1afa230 100644 --- a/Sources/Tools/MaxComponent/plLightMapComponent.cpp +++ b/Sources/Tools/MaxComponent/plLightMapComponent.cpp @@ -181,7 +181,7 @@ float plLightMapComponent::GetScale() const return res; } -UInt32 plLightMapComponent::GetUVWSrc() const +uint32_t plLightMapComponent::GetUVWSrc() const { return fCompPB->GetInt(kMapChannel)-1; } diff --git a/Sources/Tools/MaxComponent/plLightMapComponent.h b/Sources/Tools/MaxComponent/plLightMapComponent.h index 1cf59542..c54f580c 100644 --- a/Sources/Tools/MaxComponent/plLightMapComponent.h +++ b/Sources/Tools/MaxComponent/plLightMapComponent.h @@ -67,7 +67,7 @@ public: plKey GetLightMapKey() const { return fLightMapKey; } float GetScale() const; - UInt32 GetUVWSrc() const; + uint32_t GetUVWSrc() const; hsBool GetCompress() const; hsBool GetShared() const; diff --git a/Sources/Tools/MaxComponent/plLineFollowComp.cpp b/Sources/Tools/MaxComponent/plLineFollowComp.cpp index 2ee206ce..59ec3a56 100644 --- a/Sources/Tools/MaxComponent/plLineFollowComp.cpp +++ b/Sources/Tools/MaxComponent/plLineFollowComp.cpp @@ -276,7 +276,7 @@ hsBool plLineFollowComponent::IMakeLineMod(plMaxNode* pNode, plErrorMsg* pErrMsg { plLineFollowMod::FollowMode mode = plLineFollowMod::FollowMode(fCompPB->GetInt(kFollowModeRadio)); - plLineFollowMod* lineMod = TRACKED_NEW plLineFollowMod; + plLineFollowMod* lineMod = new plLineFollowMod; hsgResMgr::ResMgr()->NewKey(IGetUniqueName(pNode), lineMod, pNode->GetLocation()); if( plLineFollowMod::kFollowObject == mode ) @@ -292,7 +292,7 @@ hsBool plLineFollowComponent::IMakeLineMod(plMaxNode* pNode, plErrorMsg* pErrMsg plSceneObject* targObj = targNode->GetSceneObject(); if( targObj ) { - plGenRefMsg* refMsg = TRACKED_NEW plGenRefMsg(lineMod->GetKey(), plRefMsg::kOnCreate, 0, plLineFollowMod::kRefObject); + plGenRefMsg* refMsg = new plGenRefMsg(lineMod->GetKey(), plRefMsg::kOnCreate, 0, plLineFollowMod::kRefObject); hsgResMgr::ResMgr()->AddViaNotify(targObj->GetKey(), refMsg, plRefFlags::kPassiveRef); lineMod->SetFollowMode(plLineFollowMod::kFollowObject); @@ -328,7 +328,7 @@ hsBool plLineFollowComponent::IMakeLineMod(plMaxNode* pNode, plErrorMsg* pErrMsg hsAffineParts initParts; AP_SET(initParts, ap); - plAnimPath* animPath = TRACKED_NEW plAnimPath; + plAnimPath* animPath = new plAnimPath; animPath->SetController(tmc); animPath->InitParts(initParts); @@ -340,7 +340,7 @@ hsBool plLineFollowComponent::IMakeLineMod(plMaxNode* pNode, plErrorMsg* pErrMsg plSceneObject* parObj = parNode->GetSceneObject(); if( parObj ) { - plGenRefMsg* refMsg = TRACKED_NEW plGenRefMsg(lineMod->GetKey(), plRefMsg::kOnCreate, 0, plLineFollowMod::kRefParent); + plGenRefMsg* refMsg = new plGenRefMsg(lineMod->GetKey(), plRefMsg::kOnCreate, 0, plLineFollowMod::kRefParent); hsgResMgr::ResMgr()->AddViaNotify(parObj->GetKey(), refMsg, plRefFlags::kPassiveRef); } } @@ -583,15 +583,15 @@ hsBool plStereizeComp::Bail(plMaxNode* node, const char* msg, plErrorMsg* pErrMs hsBool plStereizeComp::Convert(plMaxNode* node, plErrorMsg* pErrMsg) { - plStereizer* stereo = TRACKED_NEW plStereizer; + plStereizer* stereo = new plStereizer; stereo->SetAmbientDist(fCompPB->GetFloat(kAmbientDist)); stereo->SetTransition(fCompPB->GetFloat(kTransition)); - hsScalar ang = fCompPB->GetFloat(kSepAngle); + float ang = fCompPB->GetFloat(kSepAngle); if( ang > 80.f ) ang = 80.f; - stereo->SetSepAngle(hsScalarDegToRad(ang)); + stereo->SetSepAngle(hsDegreesToRadians(ang)); stereo->SetMaxSepDist(fCompPB->GetFloat(kMaxDist)); stereo->SetMinSepDist(fCompPB->GetFloat(kMinDist)); @@ -805,7 +805,7 @@ hsBool plSwivelComp::Bail(plMaxNode* node, const char* msg, plErrorMsg* pErrMsg) hsBool plSwivelComp::Convert(plMaxNode* node, plErrorMsg* pErrMsg) { - plViewFaceModifier* pMod = TRACKED_NEW plViewFaceModifier; + plViewFaceModifier* pMod = new plViewFaceModifier; pMod->SetOrigTransform(node->GetLocalToParent44(), node->GetParentToLocal44()); node->AddModifier(pMod, IGetUniqueName(node)); diff --git a/Sources/Tools/MaxComponent/plMaxAnimUtils.cpp b/Sources/Tools/MaxComponent/plMaxAnimUtils.cpp index 4127dccd..e9157a3f 100644 --- a/Sources/Tools/MaxComponent/plMaxAnimUtils.cpp +++ b/Sources/Tools/MaxComponent/plMaxAnimUtils.cpp @@ -43,7 +43,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "Max.h" #include "notetrck.h" -#include "hsTypes.h" +#include "HeadSpin.h" #include "hsTemplates.h" #include "plMaxAnimUtils.h" @@ -304,33 +304,33 @@ void GetSegment(const char *note, float time, SegmentMap *segMap, plErrorMsg *pE } else { - char *nameCopy = TRACKED_NEW char[strlen(segName)+1]; + char *nameCopy = new char[strlen(segName)+1]; strcpy(nameCopy, segName); switch (type) { case kNoteStartAnim: - (*segMap)[nameCopy] = TRACKED_NEW SegmentSpec(time, -1, nameCopy, SegmentSpec::kAnim); + (*segMap)[nameCopy] = new SegmentSpec(time, -1, nameCopy, SegmentSpec::kAnim); break; case kNoteStartLoop: - (*segMap)[nameCopy] = TRACKED_NEW SegmentSpec(time, -1, nameCopy, SegmentSpec::kLoop); + (*segMap)[nameCopy] = new SegmentSpec(time, -1, nameCopy, SegmentSpec::kLoop); break; case kNoteEndLoop: - (*segMap)[nameCopy] = TRACKED_NEW SegmentSpec(-1, time, nameCopy, SegmentSpec::kLoop); + (*segMap)[nameCopy] = new SegmentSpec(-1, time, nameCopy, SegmentSpec::kLoop); break; case kNoteMarker: - (*segMap)[nameCopy] = TRACKED_NEW SegmentSpec(time, -1, nameCopy, SegmentSpec::kMarker); + (*segMap)[nameCopy] = new SegmentSpec(time, -1, nameCopy, SegmentSpec::kMarker); break; case kNoteStopPoint: - (*segMap)[nameCopy] = TRACKED_NEW SegmentSpec(time, -1, nameCopy, SegmentSpec::kStopPoint); + (*segMap)[nameCopy] = new SegmentSpec(time, -1, nameCopy, SegmentSpec::kStopPoint); break; case kNoteSuppress: - (*segMap)[nameCopy] = TRACKED_NEW SegmentSpec(-1, -1, nameCopy, SegmentSpec::kSuppress); + (*segMap)[nameCopy] = new SegmentSpec(-1, -1, nameCopy, SegmentSpec::kSuppress); break; default: @@ -351,7 +351,7 @@ SegmentMap * GetAnimSegmentMap(Animatable *anim, plErrorMsg *pErrMsg) if (!anim->HasNoteTracks()) return nil; - SegmentMap *segMap = TRACKED_NEW SegmentMap(); + SegmentMap *segMap = new SegmentMap(); int numTracks = anim->NumNoteTracks(); diff --git a/Sources/Tools/MaxComponent/plMaxAnimUtils.h b/Sources/Tools/MaxComponent/plMaxAnimUtils.h index db025ffc..2af1541a 100644 --- a/Sources/Tools/MaxComponent/plMaxAnimUtils.h +++ b/Sources/Tools/MaxComponent/plMaxAnimUtils.h @@ -42,7 +42,6 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #ifndef PLMAXANIMUTILS_H #define PLMAXANIMUTILS_H -#include "hsConfig.h" #include #include #include "hsStlSortUtils.h" diff --git a/Sources/Tools/MaxComponent/plMaxWaveUtils.cpp b/Sources/Tools/MaxComponent/plMaxWaveUtils.cpp index e9b88091..c72cff0d 100644 --- a/Sources/Tools/MaxComponent/plMaxWaveUtils.cpp +++ b/Sources/Tools/MaxComponent/plMaxWaveUtils.cpp @@ -42,7 +42,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "HeadSpin.h" #include "plMaxWaveUtils.h" #include "plAudioCore/plWavFile.h" -#include "hsTypes.h" +#include "HeadSpin.h" SegmentMap *GetWaveSegmentMap(const char *file, plErrorMsg *pErrMsg) { @@ -52,7 +52,7 @@ SegmentMap *GetWaveSegmentMap(const char *file, plErrorMsg *pErrMsg) if (numMarkers == 0) return nil; - SegmentMap *segMap = TRACKED_NEW SegmentMap(); + SegmentMap *segMap = new SegmentMap(); for (int i = 0; i < waveFile.GetNumMarkers(); i++) { diff --git a/Sources/Tools/MaxComponent/plMiscComponents.cpp b/Sources/Tools/MaxComponent/plMiscComponents.cpp index 1694a7fd..47adb01f 100644 --- a/Sources/Tools/MaxComponent/plMiscComponents.cpp +++ b/Sources/Tools/MaxComponent/plMiscComponents.cpp @@ -174,9 +174,9 @@ plInterestingComponent::plInterestingComponent() hsBool plInterestingComponent::Convert(plMaxNode *node, plErrorMsg *pErrMsg) { - plInterestingModifier* pMod = TRACKED_NEW plInterestingModifier; + plInterestingModifier* pMod = new plInterestingModifier; - hsScalar loader = fCompPB->GetFloat(kCamInterestRadius); + float loader = fCompPB->GetFloat(kCamInterestRadius); pMod->SetInterestRadius(loader); loader = fCompPB->GetFloat(kCamInterestWeight); pMod->SetInterestWeight(loader); @@ -440,7 +440,7 @@ hsBool plPageInfoComponent::SetupProperties(plMaxNode *pNode, plErrorMsg *pErrMs fItinerant = fCompPB->GetInt(kItinerant); // Build our sequence number - Int32 newNum, seqNum; + int32_t newNum, seqNum; seqNum = plPageInfoUtils::CombineSeqNum( fCompPB->GetInt( kInfoSeqPrefix ), fCompPB->GetInt( kInfoSeqSuffix ) ); newNum = plPluginResManager::ResMgr()->VerifySeqNumber( seqNum, age, room ); if( newNum != seqNum ) @@ -734,7 +734,7 @@ const char *plPageInfoUtils::GetAgeFolder() return nil; } -Int32 plPageInfoUtils::CombineSeqNum( int prefix, int suffix ) +int32_t plPageInfoUtils::CombineSeqNum( int prefix, int suffix ) { hsAssert(abs(prefix) < 0xFF, "Sequence prefix must be less then the max 8-bit number"); hsAssert(suffix <= 0xFFFF, "Sequence suffix must be less then the max 16-bit number"); @@ -745,7 +745,7 @@ Int32 plPageInfoUtils::CombineSeqNum( int prefix, int suffix ) return ( prefix << 16 ) + suffix; } -Int32 plPageInfoUtils::GetCommonSeqNumFromNormal( Int32 normalSeqNumber, int whichCommonPage ) +int32_t plPageInfoUtils::GetCommonSeqNumFromNormal( int32_t normalSeqNumber, int whichCommonPage ) { int prefix; const int kFirstCommonSeqSuffix = 0xffff; @@ -762,7 +762,7 @@ Int32 plPageInfoUtils::GetCommonSeqNumFromNormal( Int32 normalSeqNumber, int w return CombineSeqNum( prefix, kFirstCommonSeqSuffix - whichCommonPage ); } -Int32 plPageInfoUtils::GetSeqNumFromAgeDesc( const char *ageName, const char *pageName ) +int32_t plPageInfoUtils::GetSeqNumFromAgeDesc( const char *ageName, const char *pageName ) { int seqPrefix, seqSuffix = 0; plAgeDescription *aged = GetAgeDesc( ageName ); @@ -806,7 +806,7 @@ plAgeDescription *plPageInfoUtils::GetAgeDesc( const char *ageName ) return nil; // Create and read the age desc - plAgeDescription *aged = TRACKED_NEW plAgeDescription; + plAgeDescription *aged = new plAgeDescription; aged->Read( &s ); s.Close(); @@ -1109,7 +1109,7 @@ static hsBool FindMaxBounds(plMaxNode* node, hsBounds3Ext& bnd) hsBool plViewFacingComponent::Convert(plMaxNode *node, plErrorMsg *pErrMsg) { - plViewFaceModifier* pMod = TRACKED_NEW plViewFaceModifier; + plViewFaceModifier* pMod = new plViewFaceModifier; hsBounds3Ext maxBnd; if( FindMaxBounds(node, maxBnd) ) @@ -1201,7 +1201,7 @@ plSpriteComponent::plSpriteComponent() hsBool plSpriteComponent::Convert(plMaxNode *node, plErrorMsg *pErrMsg) { - plViewFaceModifier* pMod = TRACKED_NEW plViewFaceModifier; + plViewFaceModifier* pMod = new plViewFaceModifier; hsBounds3Ext maxBnd; if( FindMaxBounds(node, maxBnd) ) @@ -1385,7 +1385,7 @@ hsBool plCamViewComponent::Convert(plMaxNode *node, plErrorMsg *pErrMsg) return false; } - plPostEffectMod* mod = TRACKED_NEW plPostEffectMod; + plPostEffectMod* mod = new plPostEffectMod; float hither = cam->GetEnvRange(timeVal, ENV_NEAR_RANGE); if( hither < 0.5f ) @@ -1398,7 +1398,7 @@ hsBool plCamViewComponent::Convert(plMaxNode *node, plErrorMsg *pErrMsg) float fov = cam->GetFOV(timeVal); // convert int FOVType = cam->GetFOVType(); - hsScalar fovX, fovY; + float fovX, fovY; switch(FOVType) { case 0: // FOV_W @@ -1414,8 +1414,8 @@ hsBool plCamViewComponent::Convert(plMaxNode *node, plErrorMsg *pErrMsg) } break; } - fovX *= 180.f / hsScalarPI; - fovY *= 180.f / hsScalarPI; + fovX *= 180.f / M_PI; + fovY *= 180.f / M_PI; mod->SetFovX(fovX); mod->SetFovY(fovY); @@ -1527,7 +1527,7 @@ public: { IParamBlock2 *pb = map->GetParamBlock(); map->SetTooltip(kLeaderObjectSel, TRUE, "Press the button, & select the object to follow in one of the Viewports" ); - if( pb->GetInt(kLeaderTypeRadio) == Int32(plFollowMod::kObject) ) + if( pb->GetInt(kLeaderTypeRadio) == int32_t(plFollowMod::kObject) ) map->Enable(kLeaderObjectSel, TRUE); else map->Enable(kLeaderObjectSel, FALSE); @@ -1543,7 +1543,7 @@ public: || (LOWORD(wParam) == IDC_F_RADIO_OBJECT) ) { IParamBlock2 *pb = map->GetParamBlock(); - if( pb->GetInt(kLeaderTypeRadio) == Int32(plFollowMod::kObject) ) + if( pb->GetInt(kLeaderTypeRadio) == int32_t(plFollowMod::kObject) ) map->Enable(kLeaderObjectSel, TRUE); else map->Enable(kLeaderObjectSel, FALSE); @@ -1635,7 +1635,7 @@ plFollowMod* plFollowComponent::IMakeFollowMod(plMaxNode* pNode, plErrorMsg* pEr { plFollowMod::FollowLeaderType lType = plFollowMod::FollowLeaderType(fCompPB->GetInt(kLeaderTypeRadio)); - plFollowMod* follow = TRACKED_NEW plFollowMod; + plFollowMod* follow = new plFollowMod; hsgResMgr::ResMgr()->NewKey(IGetUniqueName(pNode), follow, pNode->GetLocation()); @@ -1650,7 +1650,7 @@ plFollowMod* plFollowComponent::IMakeFollowMod(plMaxNode* pNode, plErrorMsg* pEr plSceneObject* targObj = targNode->GetSceneObject(); if( targObj ) { - plGenRefMsg* refMsg = TRACKED_NEW plGenRefMsg(follow->GetKey(), plRefMsg::kOnCreate, 0, plFollowMod::kRefLeader); + plGenRefMsg* refMsg = new plGenRefMsg(follow->GetKey(), plRefMsg::kOnCreate, 0, plFollowMod::kRefLeader); hsgResMgr::ResMgr()->AddViaNotify(targObj->GetKey(), refMsg, plRefFlags::kPassiveRef); follow->SetType(plFollowMod::kObject); @@ -1663,7 +1663,7 @@ plFollowMod* plFollowComponent::IMakeFollowMod(plMaxNode* pNode, plErrorMsg* pEr follow->SetType(lType); } - UInt32 mode = 0; + uint32_t mode = 0; if( fCompPB->GetInt(kAffectX) ) mode |= plFollowMod::kPositionX; if( fCompPB->GetInt(kAffectY) ) @@ -2398,7 +2398,7 @@ public: case WM_COMMAND: if( LOWORD( wParam ) == IDC_IMAGE_ADD ) { - plLayerTex *newLayer = TRACKED_NEW plLayerTex; + plLayerTex *newLayer = new plLayerTex; if( newLayer->HandleBitmapSelection() ) { @@ -2497,7 +2497,7 @@ plLayerTex *pfImageLibComponent::GetBitmap( int idx ) plLayerTex *layer = (plLayerTex *)fCompPB->GetTexmap( (ParamID)kRefImageList, 0, idx ); if( layer == nil || layer->ClassID() != LAYER_TEX_CLASS_ID ) { - layer = TRACKED_NEW plLayerTex; + layer = new plLayerTex; fCompPB->SetValue( (ParamID)kRefImageList, 0, (Texmap *)layer, idx ); } @@ -2539,7 +2539,7 @@ hsBool pfImageLibComponent::SetupProperties(plMaxNode *pNode, plErrorMsg *pErrM hsBool pfImageLibComponent::Convert(plMaxNode *node, plErrorMsg *pErrMsg) { - plImageLibMod *lib = TRACKED_NEW plImageLibMod; + plImageLibMod *lib = new plImageLibMod; node->AddModifier( lib, IGetUniqueName(node) ); int i; @@ -2551,7 +2551,7 @@ hsBool pfImageLibComponent::Convert(plMaxNode *node, plErrorMsg *pErrMsg) PBBitmap *texture = layer->GetPBBitmap(); if( texture != nil ) { - UInt32 flags = plBitmap::kAlphaChannelFlag; + uint32_t flags = plBitmap::kAlphaChannelFlag; plBitmap *bMap; if (fCompPB->GetInt(kCompressImage, 0, i) == 0) @@ -2563,7 +2563,7 @@ hsBool pfImageLibComponent::Convert(plMaxNode *node, plErrorMsg *pErrMsg) bMap = plLayerConverter::Instance().CreateSimpleTexture( texture->bi.Name(), lib->GetKey()->GetUoid().GetLocation(), 0, flags, true ); if( bMap != nil ) { - hsgResMgr::ResMgr()->AddViaNotify( bMap->GetKey(), TRACKED_NEW plGenRefMsg( lib->GetKey(), + hsgResMgr::ResMgr()->AddViaNotify( bMap->GetKey(), new plGenRefMsg( lib->GetKey(), plRefMsg::kOnCreate, lib->GetNumImages(), plImageLibMod::kRefImage ), plRefFlags::kActiveRef ); } } diff --git a/Sources/Tools/MaxComponent/plMiscComponents.h b/Sources/Tools/MaxComponent/plMiscComponents.h index 812292b4..d7d7ce97 100644 --- a/Sources/Tools/MaxComponent/plMiscComponents.h +++ b/Sources/Tools/MaxComponent/plMiscComponents.h @@ -61,9 +61,9 @@ const char* LocCompGetPage(plComponentBase* comp); namespace plPageInfoUtils { const char *GetAgeFolder(); - Int32 GetSeqNumFromAgeDesc( const char *ageName, const char *pageName ); - Int32 CombineSeqNum( int prefix, int suffix ); - Int32 GetCommonSeqNumFromNormal( Int32 normalSeqNumber, int whichCommonPage ); + int32_t GetSeqNumFromAgeDesc( const char *ageName, const char *pageName ); + int32_t CombineSeqNum( int prefix, int suffix ); + int32_t GetCommonSeqNumFromNormal( int32_t normalSeqNumber, int whichCommonPage ); plAgeDescription *GetAgeDesc( const char *ageName ); }; diff --git a/Sources/Tools/MaxComponent/plMorphSeqComp.cpp b/Sources/Tools/MaxComponent/plMorphSeqComp.cpp index c0465931..db817441 100644 --- a/Sources/Tools/MaxComponent/plMorphSeqComp.cpp +++ b/Sources/Tools/MaxComponent/plMorphSeqComp.cpp @@ -51,7 +51,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "MaxMain/plMaxNode.h" #include "MaxExport/plExportProgressBar.h" -#include "hsTypes.h" +#include "HeadSpin.h" #include "hsResMgr.h" #include "pnSceneObject/plSceneObject.h" @@ -304,7 +304,7 @@ hsBool plMorphSeqComp::Convert(plMaxNode* node, plErrorMsg* pErrMsg) plMorphSequence* morphSeq = const_cast(plMorphSequence::ConvertNoRef(node->GetSceneObject()->GetModifierByType(plMorphSequence::Index()))); if (!morphSeq) { - morphSeq = TRACKED_NEW plMorphSequence; + morphSeq = new plMorphSequence; node->AddModifier(morphSeq, IGetUniqueName(node)); } @@ -316,9 +316,9 @@ hsBool plMorphSeqComp::Convert(plMaxNode* node, plErrorMsg* pErrMsg) // Error check we have some base geometry. - plMorphDataSet *set = TRACKED_NEW plMorphDataSet; + plMorphDataSet *set = new plMorphDataSet; hsgResMgr::ResMgr()->NewKey(IGetUniqueName(node), set, node->GetLocation()); - hsgResMgr::ResMgr()->AddViaNotify(set->GetKey(), TRACKED_NEW plGenRefMsg(mesh->GetKey(), plRefMsg::kOnCreate, -1, -1), plRefFlags::kActiveRef); + hsgResMgr::ResMgr()->AddViaNotify(set->GetKey(), new plGenRefMsg(mesh->GetKey(), plRefMsg::kOnCreate, -1, -1), plRefFlags::kActiveRef); const int num = fCompPB->Count(kLayers); int i; diff --git a/Sources/Tools/MaxComponent/plMultistageBehComponent.cpp b/Sources/Tools/MaxComponent/plMultistageBehComponent.cpp index 016992ea..21f6761a 100644 --- a/Sources/Tools/MaxComponent/plMultistageBehComponent.cpp +++ b/Sources/Tools/MaxComponent/plMultistageBehComponent.cpp @@ -189,7 +189,7 @@ void plMultistageBehComponent::IGetReceivers(plMaxNode* node, std::vector hsBool plMultistageBehComponent::PreConvert(plMaxNode *node, plErrorMsg *pErrMsg) { //create the modifier here so that other components can find it - plMultistageBehMod *mod = TRACKED_NEW plMultistageBehMod; + plMultistageBehMod *mod = new plMultistageBehMod; hsgResMgr::ResMgr()->NewKey(IGetUniqueName(node), mod, node->GetLocation()); fMods[node] = mod; @@ -199,7 +199,7 @@ hsBool plMultistageBehComponent::PreConvert(plMaxNode *node, plErrorMsg *pErrMsg hsBool plMultistageBehComponent::Convert(plMaxNode *node, plErrorMsg *pErrMsg) { // Create the stage vector - plAnimStageVec* animStages = TRACKED_NEW plAnimStageVec; + plAnimStageVec* animStages = new plAnimStageVec; int numStages = fStages.size(); animStages->reserve(numStages); @@ -349,7 +349,7 @@ BOOL plMultistageBehComponent::IDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPAR if (LOWORD(wParam) == IDC_ADD) { // Create the new stage and give it a default name. - plBaseStage* stage = TRACKED_NEW plStandardStage; + plBaseStage* stage = new plStandardStage; int count = fStages.size(); fStages.push_back(stage); char buf[64]; @@ -487,14 +487,14 @@ public: // Don't support any of this virtual hsBool Open(const char *, const char * = "rb") { hsAssert(0, "Not supported"); return false; } - virtual hsBool Open(const wchar *, const wchar * = L"rb") { hsAssert(0, "Not supported"); return false; } + virtual hsBool Open(const wchar_t *, const wchar_t * = L"rb") { hsAssert(0, "Not supported"); return false; } virtual hsBool Close() { hsAssert(0, "Not supported"); return false; } - virtual void Skip(UInt32 deltaByteCount) { hsAssert(0, "Not supported"); } + virtual void Skip(uint32_t deltaByteCount) { hsAssert(0, "Not supported"); } virtual void Rewind() { hsAssert(0, "Not supported"); } - virtual UInt32 GetEOF() { return (UInt32)fLoad->CurChunkLength(); } + virtual uint32_t GetEOF() { return (uint32_t)fLoad->CurChunkLength(); } - virtual UInt32 Read(UInt32 byteCount, void * buffer) + virtual uint32_t Read(uint32_t byteCount, void * buffer) { ULONG numRead = 0; hsAssert(fLoad, "No Max ILoad!"); @@ -503,7 +503,7 @@ public: fPosition += numRead; return numRead; } - virtual UInt32 Write(UInt32 byteCount, const void* buffer) + virtual uint32_t Write(uint32_t byteCount, const void* buffer) { ULONG numWritten; hsAssert(fSave, "No Max ISave!"); @@ -571,7 +571,7 @@ IOResult plMultistageBehComponent::Load(ILoad* iload) break; case kStandard: - stage = TRACKED_NEW plStandardStage; + stage = new plStandardStage; break; } diff --git a/Sources/Tools/MaxComponent/plMultistageStage.cpp b/Sources/Tools/MaxComponent/plMultistageStage.cpp index 262a069a..d8cabea1 100644 --- a/Sources/Tools/MaxComponent/plMultistageStage.cpp +++ b/Sources/Tools/MaxComponent/plMultistageStage.cpp @@ -44,7 +44,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "max.h" #include "hsStream.h" #include "resource.h" -#include "hsUtils.h" + #include "plAvatar/plAnimStage.h" @@ -54,7 +54,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com char* MyReadSafeString(hsStream* s) { char *name = nil; - UInt16 numChars = s->ReadLE16(); + uint16_t numChars = s->ReadLE16(); bool oldFormat = !(numChars & 0xf000); if (oldFormat) @@ -64,7 +64,7 @@ char* MyReadSafeString(hsStream* s) hsAssert(numChars <= s->GetSizeLeft(), "Bad string"); if (numChars > 0) { - name = TRACKED_NEW char[numChars+1]; + name = new char[numChars+1]; s->Read(numChars, name); name[numChars] = '\0'; } @@ -186,7 +186,7 @@ void plStandardStage::Read(hsStream *stream) { plBaseStage::Read(stream); - UInt16 version = stream->ReadLE16(); + uint16_t version = stream->ReadLE16(); delete [] fAnimName; fAnimName = MyReadSafeString(stream); @@ -456,7 +456,7 @@ void plStandardStage::IInitDlg() plAnimStage* plStandardStage::CreateStage() { int loopCount = fLoopForever ? -1 : fNumLoops; - plAnimStage* stage = TRACKED_NEW plAnimStage(fAnimName, + plAnimStage* stage = new plAnimStage(fAnimName, fNotify, (plAnimStage::ForwardType)fForward, (plAnimStage::BackType)fBackward, @@ -473,7 +473,7 @@ plAnimStage* plStandardStage::CreateStage() plBaseStage* plStandardStage::Clone() { - plStandardStage* clone = TRACKED_NEW plStandardStage; + plStandardStage* clone = new plStandardStage; clone->fAnimName = hsStrcpy(fAnimName); clone->fNumLoops = fNumLoops; clone->fLoopForever = fLoopForever; diff --git a/Sources/Tools/MaxComponent/plMultistageStage.h b/Sources/Tools/MaxComponent/plMultistageStage.h index c099d6e2..8ab5a0d4 100644 --- a/Sources/Tools/MaxComponent/plMultistageStage.h +++ b/Sources/Tools/MaxComponent/plMultistageStage.h @@ -39,8 +39,8 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com Mead, WA 99021 *==LICENSE==*/ -#include "hsTypes.h" -#include "hsWindows.h" +#include "HeadSpin.h" + class hsStream; class plAnimStage; @@ -95,18 +95,18 @@ protected: static HWND fDlg; char *fAnimName; - UInt32 fNumLoops; + uint32_t fNumLoops; bool fLoopForever; - UInt8 fForward; - UInt8 fBackward; - UInt8 fStageAdvance; - UInt8 fStageRegress; - UInt8 fNotify; + uint8_t fForward; + uint8_t fBackward; + uint8_t fStageAdvance; + uint8_t fStageRegress; + uint8_t fNotify; bool fUseGlobalCoord; bool fDoAdvanceTo; - UInt32 fAdvanceTo; + uint32_t fAdvanceTo; bool fDoRegressTo; - UInt32 fRegressTo; + uint32_t fRegressTo; BOOL IDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam); void IInitDlg(); diff --git a/Sources/Tools/MaxComponent/plNPCSpawnComp.cpp b/Sources/Tools/MaxComponent/plNPCSpawnComp.cpp index 1d7090a2..abfc2986 100644 --- a/Sources/Tools/MaxComponent/plNPCSpawnComp.cpp +++ b/Sources/Tools/MaxComponent/plNPCSpawnComp.cpp @@ -186,7 +186,7 @@ hsBool plNPCSpawnComp::PreConvert(plMaxNode *node, plErrorMsg *pErrMsg) const char *accountName = fCompPB->GetStr(kAccountName); bool autoSpawn = fCompPB->GetInt(kAutoSpawn) ? true : false; - plNPCSpawnMod *mod = TRACKED_NEW plNPCSpawnMod(modelName, accountName, autoSpawn); + plNPCSpawnMod *mod = new plNPCSpawnMod(modelName, accountName, autoSpawn); fMods[node] = mod; // this is used by the python file modifier to figure out which component we're coming from @@ -210,7 +210,7 @@ hsBool plNPCSpawnComp::Convert(plMaxNode* node, plErrorMsg *pErrMsg) // let's make a notification message that we'll use to notify interested parties // when we actually do our spawn. - plNotifyMsg *notify = TRACKED_NEW plNotifyMsg(); + plNotifyMsg *notify = new plNotifyMsg(); hsTArray receivers; IGetReceivers(node, receivers); notify->SetSender(mod->GetKey()); diff --git a/Sources/Tools/MaxComponent/plNavigableComponents.cpp b/Sources/Tools/MaxComponent/plNavigableComponents.cpp index 518654c9..fbd57050 100644 --- a/Sources/Tools/MaxComponent/plNavigableComponents.cpp +++ b/Sources/Tools/MaxComponent/plNavigableComponents.cpp @@ -272,7 +272,7 @@ hsBool plAvLadderComponent::PreConvert(plMaxNode *node, plErrorMsg *pErrMsg) int ladderType = fCompPB->GetInt(kTypeCombo); bool enabled = (fCompPB->GetInt(kEnabled) != 0); - plAvLadderMod* ladMod = TRACKED_NEW plAvLadderMod(goingUp, ladderType, loops, enabled, ladderView); + plAvLadderMod* ladMod = new plAvLadderMod(goingUp, ladderType, loops, enabled, ladderView); plKey modKey = node->AddModifier(ladMod, IGetUniqueName(node)); fKeys.Append(modKey); diff --git a/Sources/Tools/MaxComponent/plNotetrackDlg.h b/Sources/Tools/MaxComponent/plNotetrackDlg.h index 975938c5..0f1c60b8 100644 --- a/Sources/Tools/MaxComponent/plNotetrackDlg.h +++ b/Sources/Tools/MaxComponent/plNotetrackDlg.h @@ -42,8 +42,8 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #ifndef PLNOTETRACKDLG_INC #define PLNOTETRACKDLG_INC -#include "hsTypes.h" -#include "hsWindows.h" // For HWND +#include "HeadSpin.h" + // For HWND #include "plMaxAnimUtils.h" class IParamBlock2; diff --git a/Sources/Tools/MaxComponent/plObjectFlockerComponent.cpp b/Sources/Tools/MaxComponent/plObjectFlockerComponent.cpp index 5b7faa69..e69917bc 100644 --- a/Sources/Tools/MaxComponent/plObjectFlockerComponent.cpp +++ b/Sources/Tools/MaxComponent/plObjectFlockerComponent.cpp @@ -229,7 +229,7 @@ hsBool plObjectFlockerComponent::PreConvert(plMaxNode *node, plErrorMsg *pErrMsg if (fFlocker) delete fFlocker; - fFlocker = TRACKED_NEW pfObjectFlocker; + fFlocker = new pfObjectFlocker; hsgResMgr::ResMgr()->NewKey( IGetUniqueName(node), fFlocker, node->GetLocation(), node->GetLoadMask()); fFlocker->SetGoalWeight(fCompPB->GetFloat(ParamID(kGoalStrength))); diff --git a/Sources/Tools/MaxComponent/plOneShotComponent.cpp b/Sources/Tools/MaxComponent/plOneShotComponent.cpp index 7d5a2118..b6b5d842 100644 --- a/Sources/Tools/MaxComponent/plOneShotComponent.cpp +++ b/Sources/Tools/MaxComponent/plOneShotComponent.cpp @@ -240,7 +240,7 @@ hsBool plOneShotComponent::PreConvert(plMaxNode *node, plErrorMsg *pErrMsg) { if (IsValid()) { - plOneShotMod *mod = TRACKED_NEW plOneShotMod; + plOneShotMod *mod = new plOneShotMod; hsgResMgr::ResMgr()->NewKey(IGetUniqueName(node), mod, node->GetLocation()); fMods[node] = mod; } diff --git a/Sources/Tools/MaxComponent/plParticleComponents.cpp b/Sources/Tools/MaxComponent/plParticleComponents.cpp index d1e8332f..fe19769c 100644 --- a/Sources/Tools/MaxComponent/plParticleComponents.cpp +++ b/Sources/Tools/MaxComponent/plParticleComponents.cpp @@ -152,9 +152,9 @@ hsBool plParticleCoreComponent::PreConvert(plMaxNode *pNode, plErrorMsg *pErrMsg // Moving this from Convert so the DrawInterface will appear sooner. Other components expect // the interfaces to be fully set up by the Convert pass. plSceneNode *sNode = plSceneNode::ConvertNoRef( pNode->GetRoomKey()->GetObjectPtr() ); - plDrawInterface *di = TRACKED_NEW plDrawInterface; + plDrawInterface *di = new plDrawInterface; hsgResMgr::ResMgr()->NewKey(IGetUniqueName(pNode), di, pNode->GetLocation(), pNode->GetLoadMask()); - hsgResMgr::ResMgr()->AddViaNotify( di->GetKey(), TRACKED_NEW plObjRefMsg(pNode->GetSceneObject()->GetKey(), plRefMsg::kOnCreate, 0, plObjRefMsg::kInterface ), plRefFlags::kActiveRef ); + hsgResMgr::ResMgr()->AddViaNotify( di->GetKey(), new plObjRefMsg(pNode->GetSceneObject()->GetKey(), plRefMsg::kOnCreate, 0, plObjRefMsg::kInterface ), plRefFlags::kActiveRef ); pNode->SetDISceneNodeSpans(di, true); return true; @@ -162,13 +162,13 @@ hsBool plParticleCoreComponent::PreConvert(plMaxNode *pNode, plErrorMsg *pErrMsg hsBool plParticleCoreComponent::Convert(plMaxNode *node, plErrorMsg *pErrMsg) { - Int32 i, j, k; + int32_t i, j, k; plLocation nodeLoc = node->GetKey()->GetUoid().GetLocation(); const char *objName = node->GetKey()->GetName(); plSceneObject *sObj = node->GetSceneObject(); - plParticleSystem *sys = TRACKED_NEW plParticleSystem(); + plParticleSystem *sys = new plParticleSystem(); hsgResMgr::ResMgr()->NewKey(IGetUniqueName(node), sys, nodeLoc, node->GetLoadMask()); @@ -196,29 +196,29 @@ hsBool plParticleCoreComponent::Convert(plMaxNode *node, plErrorMsg *pErrMsg) heightCtl = cc.MakeScalarController(particleMtl->GetHeightController(), node); } - hsScalar genLife = -1; - hsScalar partLifeMin, partLifeMax; - hsScalar pps = fUserInput.fPPS; + float genLife = -1; + float partLifeMin, partLifeMax; + float pps = fUserInput.fPPS; hsPoint3 pos(0, 0, 0); - hsScalar pitch = PI; - hsScalar yaw = 0; - hsScalar angleRange = fUserInput.fConeAngle * PI / 180.f; - hsScalar velMin = fUserInput.fVelocityMin; - hsScalar velMax = fUserInput.fVelocityMax; - hsScalar xSize = fUserInput.fHSize; - hsScalar ySize = fUserInput.fVSize; - hsScalar scaleMin = fUserInput.fScaleMin / 100.0f; - hsScalar scaleMax = fUserInput.fScaleMax / 100.0f; - hsScalar gravity = fUserInput.fGravity / 100.0f; - hsScalar drag = fUserInput.fDrag / 100.f; - hsScalar windMult = fUserInput.fWindMult / 100.f; - hsScalar massRange = fUserInput.fMassRange; - hsScalar rotRange = fUserInput.fRotRange * PI / 180.f; - - UInt32 xTiles = fUserInput.fXTiles; - UInt32 yTiles = fUserInput.fYTiles; - UInt32 maxEmitters = 1 + GetEmitterReserve(); - UInt32 maxTotalParticles = 0; + float pitch = PI; + float yaw = 0; + float angleRange = fUserInput.fConeAngle * PI / 180.f; + float velMin = fUserInput.fVelocityMin; + float velMax = fUserInput.fVelocityMax; + float xSize = fUserInput.fHSize; + float ySize = fUserInput.fVSize; + float scaleMin = fUserInput.fScaleMin / 100.0f; + float scaleMax = fUserInput.fScaleMax / 100.0f; + float gravity = fUserInput.fGravity / 100.0f; + float drag = fUserInput.fDrag / 100.f; + float windMult = fUserInput.fWindMult / 100.f; + float massRange = fUserInput.fMassRange; + float rotRange = fUserInput.fRotRange * PI / 180.f; + + uint32_t xTiles = fUserInput.fXTiles; + uint32_t yTiles = fUserInput.fYTiles; + uint32_t maxEmitters = 1 + GetEmitterReserve(); + uint32_t maxTotalParticles = 0; // Need to do this even when immortal, so that maxTotalParticles is computed correctly. partLifeMin = fUserInput.fLifeMin; @@ -227,11 +227,11 @@ hsBool plParticleCoreComponent::Convert(plMaxNode *node, plErrorMsg *pErrMsg) if (ppsCtl != nil && ppsCtl->GetLength() > 0) { // Simulate just the birth across the curve and record the max - hsScalar frameDelta = (1.f / MAX_FRAMES_PER_SEC); - hsScalar avgLife = (partLifeMax + partLifeMin) / 2; - UInt32 count = node->NumAttachedComponents(); - UInt32 lifeTicks = avgLife / frameDelta; - hsScalar *birth = TRACKED_NEW hsScalar[lifeTicks]; + float frameDelta = (1.f / MAX_FRAMES_PER_SEC); + float avgLife = (partLifeMax + partLifeMin) / 2; + uint32_t count = node->NumAttachedComponents(); + uint32_t lifeTicks = avgLife / frameDelta; + float *birth = new float[lifeTicks]; // Find any anim components attached to the same node. for (i = 0; i < count; i++) @@ -239,7 +239,7 @@ hsBool plParticleCoreComponent::Convert(plMaxNode *node, plErrorMsg *pErrMsg) if (!plAnimComponentBase::IsAnimComponent(node->GetAttachedComponent(i))) continue; - hsScalar maxAnimParticles = 0; + float maxAnimParticles = 0; plAnimComponentBase *comp = (plAnimComponentBase *)node->GetAttachedComponent(i); plATCAnim *anim = plATCAnim::ConvertNoRef(comp->fAnims[node]); @@ -247,11 +247,11 @@ hsBool plParticleCoreComponent::Convert(plMaxNode *node, plErrorMsg *pErrMsg) // If it's an ATC anim, we can be aggressive in determining the max if (anim) { - hsScalar curAnimParticles = 0; + float curAnimParticles = 0; - hsScalar loopStart, loopEnd; + float loopStart, loopEnd; - for (j = -1; j < (Int32)anim->GetNumLoops(); j++) + for (j = -1; j < (int32_t)anim->GetNumLoops(); j++) { // Initialize our birth counters for (k = 0; k < lifeTicks; k++) @@ -265,20 +265,20 @@ hsBool plParticleCoreComponent::Convert(plMaxNode *node, plErrorMsg *pErrMsg) else anim->GetLoop(j, loopStart, loopEnd); - hsScalar loopLength = loopEnd - loopStart; + float loopLength = loopEnd - loopStart; if (loopLength == 0) // It's the default "(Entire Animation)" loopLength = ppsCtl->GetLength(); - UInt32 loopTicks = loopLength * MAX_FRAMES_PER_SEC; + uint32_t loopTicks = loopLength * MAX_FRAMES_PER_SEC; - UInt32 startTick = loopStart * MAX_FRAMES_PER_SEC; - UInt32 tick; + uint32_t startTick = loopStart * MAX_FRAMES_PER_SEC; + uint32_t tick; for (tick = 0; tick < loopTicks + lifeTicks; tick++) { curAnimParticles -= birth[tick % lifeTicks] * frameDelta; - hsScalar birthStart = 0.f; - hsScalar birthEnd = 0.f; + float birthStart = 0.f; + float birthEnd = 0.f; ppsCtl->Interp(((tick % loopTicks) + startTick) * frameDelta, &birthStart); ppsCtl->Interp(((tick % loopTicks) + startTick + 1) * frameDelta, &birthEnd); birth[tick % lifeTicks] = (birthStart + birthEnd) / 2; @@ -290,11 +290,11 @@ hsBool plParticleCoreComponent::Convert(plMaxNode *node, plErrorMsg *pErrMsg) } else // No info on the animation. Assume the worst. { - hsScalar maxPps = 0; + float maxPps = 0; int i; for (i = 1; i < ppsCtl->GetNumKeys(); i++) { - hsScalar curVal = 0; + float curVal = 0; hsScalarKey *key = ppsCtl->GetScalarKey(i); if (key) curVal = key->fValue; @@ -310,7 +310,7 @@ hsBool plParticleCoreComponent::Convert(plMaxNode *node, plErrorMsg *pErrMsg) } if (maxTotalParticles < maxAnimParticles) - maxTotalParticles = (UInt32)maxAnimParticles; + maxTotalParticles = (uint32_t)maxAnimParticles; } delete [] birth; } @@ -323,7 +323,7 @@ hsBool plParticleCoreComponent::Convert(plMaxNode *node, plErrorMsg *pErrMsg) delete ppsCtl; ppsCtl = nil; - UInt32 maxAllowedParticles = plGBufferGroup::kMaxNumIndicesPerBuffer / 6; + uint32_t maxAllowedParticles = plGBufferGroup::kMaxNumIndicesPerBuffer / 6; if (maxTotalParticles > maxAllowedParticles) { char text[512]; @@ -350,21 +350,21 @@ hsBool plParticleCoreComponent::Convert(plMaxNode *node, plErrorMsg *pErrMsg) // Figure out the appropriate generator to add plParticleGenerator *generator = nil; - UInt32 sources; - hsScalar *pitchArray; - hsScalar *yawArray; + uint32_t sources; + float *pitchArray; + float *yawArray; hsPoint3 *pointArray; hsVector3 *dirArray; if (fUserInput.fGenType == kGenPoint) { sources = 1; - pitchArray = TRACKED_NEW hsScalar[sources]; - yawArray = TRACKED_NEW hsScalar[sources]; - pointArray = TRACKED_NEW hsPoint3[sources]; + pitchArray = new float[sources]; + yawArray = new float[sources]; + pointArray = new hsPoint3[sources]; pitchArray[0] = pitch; yawArray[0] = yaw; pointArray[0].Set(0, 0, 0); - plSimpleParticleGenerator *gen = TRACKED_NEW plSimpleParticleGenerator(); + plSimpleParticleGenerator *gen = new plSimpleParticleGenerator(); gen->Init(genLife, partLifeMin, partLifeMax, pps, sources, pointArray, pitchArray, yawArray, angleRange, velMin, velMax, xSize, ySize, scaleMin, scaleMax, massRange, rotRange); generator = gen; @@ -375,16 +375,16 @@ hsBool plParticleCoreComponent::Convert(plMaxNode *node, plErrorMsg *pErrMsg) hsTArray pos; plMeshConverter::Instance().StuffPositionsAndNormals(node, &pos, &normals); sources = normals.GetCount(); - pitchArray = TRACKED_NEW hsScalar[sources]; - yawArray = TRACKED_NEW hsScalar[sources]; - pointArray = TRACKED_NEW hsPoint3[sources]; + pitchArray = new float[sources]; + yawArray = new float[sources]; + pointArray = new hsPoint3[sources]; int i; for (i = 0; i < sources; i++) { plParticleGenerator::ComputePitchYaw(pitchArray[i], yawArray[i], normals.Get(i)); pointArray[i] = pos.Get(i); } - plSimpleParticleGenerator *gen = TRACKED_NEW plSimpleParticleGenerator(); + plSimpleParticleGenerator *gen = new plSimpleParticleGenerator(); gen->Init(genLife, partLifeMin, partLifeMax, pps, sources, pointArray, pitchArray, yawArray, angleRange, velMin, velMax, xSize, ySize, scaleMin, scaleMax, massRange, rotRange); generator = gen; @@ -396,8 +396,8 @@ hsBool plParticleCoreComponent::Convert(plMaxNode *node, plErrorMsg *pErrMsg) plMeshConverter::Instance().StuffPositionsAndNormals(node, &pos, &normals); sources = normals.GetCount(); - pointArray = TRACKED_NEW hsPoint3[sources]; - dirArray = TRACKED_NEW hsVector3[sources]; + pointArray = new hsPoint3[sources]; + dirArray = new hsVector3[sources]; int i; for (i = 0; i < sources; i++) { @@ -405,7 +405,7 @@ hsBool plParticleCoreComponent::Convert(plMaxNode *node, plErrorMsg *pErrMsg) pointArray[i] = pos.Get(i); } - plOneTimeParticleGenerator *gen = TRACKED_NEW plOneTimeParticleGenerator(); + plOneTimeParticleGenerator *gen = new plOneTimeParticleGenerator(); gen->Init(sources, pointArray, dirArray, xSize, ySize, scaleMin, scaleMax, rotRange); generator = gen; maxTotalParticles = sources; @@ -415,11 +415,11 @@ hsBool plParticleCoreComponent::Convert(plMaxNode *node, plErrorMsg *pErrMsg) // Init and attach to the scene object sys->Init(xTiles, yTiles, maxTotalParticles, maxEmitters, ambientCtl, diffuseCtl, opacityCtl, widthCtl, heightCtl); - hsgResMgr::ResMgr()->AddViaNotify( particleMat->GetKey(), TRACKED_NEW plGenRefMsg( sys->GetKey(), plRefMsg::kOnCreate, 0, 0 ), plRefFlags::kActiveRef ); - hsgResMgr::ResMgr()->AddViaNotify( sys->GetKey(), TRACKED_NEW plObjRefMsg( sObj->GetKey(), plRefMsg::kOnCreate, -1, plObjRefMsg::kModifier ), plRefFlags::kActiveRef ); + hsgResMgr::ResMgr()->AddViaNotify( particleMat->GetKey(), new plGenRefMsg( sys->GetKey(), plRefMsg::kOnCreate, 0, 0 ), plRefFlags::kActiveRef ); + hsgResMgr::ResMgr()->AddViaNotify( sys->GetKey(), new plObjRefMsg( sObj->GetKey(), plRefMsg::kOnCreate, -1, plObjRefMsg::kModifier ), plRefFlags::kActiveRef ); // Set up normals and orientation - UInt32 miscFlags = 0; + uint32_t miscFlags = 0; switch(fUserInput.fNormal) { case plParticleMtl::kNormalViewFacing: @@ -493,9 +493,9 @@ hsBool plParticleCoreComponent::Convert(plMaxNode *node, plErrorMsg *pErrMsg) if (fCompPB->GetInt(ParamID(kFollowSystem))) { - plParticleFollowSystemEffect *effect = TRACKED_NEW plParticleFollowSystemEffect; + plParticleFollowSystemEffect *effect = new plParticleFollowSystemEffect; hsgResMgr::ResMgr()->NewKey(IGetUniqueName(node), effect, node->GetLocation(), node->GetLoadMask()); - hsgResMgr::ResMgr()->AddViaNotify( effect->GetKey(), TRACKED_NEW plGenRefMsg( sys->GetKey(), plRefMsg::kOnCreate, 0, plParticleSystem::kEffectMisc ), plRefFlags::kActiveRef ); + hsgResMgr::ResMgr()->AddViaNotify( effect->GetKey(), new plGenRefMsg( sys->GetKey(), plRefMsg::kOnCreate, 0, plParticleSystem::kEffectMisc ), plRefFlags::kActiveRef ); } return true; @@ -517,7 +517,7 @@ hsBool plParticleCoreComponent::AddToAnim(plAGAnim *anim, plMaxNode *node) plController *ctl; hsControlConverter& cc = hsControlConverter::Instance(); - hsScalar start, end; + float start, end; if (!strcmp(anim->GetName(), ENTIRE_ANIMATION_NAME)) { start = end = -1; @@ -533,7 +533,7 @@ hsBool plParticleCoreComponent::AddToAnim(plAGAnim *anim, plMaxNode *node) ctl = cc.MakeScalarController(GetParamBlock2Controller(fCompPB, ParamID(kLifeMin)), node, start, end); if (ctl != nil) { - plParticleLifeMinApplicator *app = TRACKED_NEW plParticleLifeMinApplicator(); + plParticleLifeMinApplicator *app = new plParticleLifeMinApplicator(); app->SetChannelName(node->GetName()); plAnimComponentBase::SetupCtl(anim, ctl, app, node); result = true; @@ -542,7 +542,7 @@ hsBool plParticleCoreComponent::AddToAnim(plAGAnim *anim, plMaxNode *node) ctl = cc.MakeScalarController(GetParamBlock2Controller(fCompPB, ParamID(kLifeMax)), node, start, end); if (ctl != nil) { - plParticleLifeMaxApplicator *app = TRACKED_NEW plParticleLifeMaxApplicator(); + plParticleLifeMaxApplicator *app = new plParticleLifeMaxApplicator(); app->SetChannelName(node->GetName()); plAnimComponentBase::SetupCtl(anim, ctl, app, node); result = true; @@ -551,7 +551,7 @@ hsBool plParticleCoreComponent::AddToAnim(plAGAnim *anim, plMaxNode *node) ctl = cc.MakeScalarController(GetParamBlock2Controller(fCompPB, ParamID(kPPS)), node, start, end); if (ctl != nil) { - plParticlePPSApplicator *app = TRACKED_NEW plParticlePPSApplicator(); + plParticlePPSApplicator *app = new plParticlePPSApplicator(); app->SetChannelName(node->GetName()); plAnimComponentBase::SetupCtl(anim, ctl, app, node); result = true; @@ -560,7 +560,7 @@ hsBool plParticleCoreComponent::AddToAnim(plAGAnim *anim, plMaxNode *node) ctl = cc.MakeScalarController(GetParamBlock2Controller(fCompPB, ParamID(kConeAngle)), node, start, end); if (ctl != nil) { - plParticleAngleApplicator *app = TRACKED_NEW plParticleAngleApplicator(); + plParticleAngleApplicator *app = new plParticleAngleApplicator(); app->SetChannelName(node->GetName()); plAnimComponentBase::SetupCtl(anim, ctl, app, node); result = true; @@ -569,7 +569,7 @@ hsBool plParticleCoreComponent::AddToAnim(plAGAnim *anim, plMaxNode *node) ctl = cc.MakeScalarController(GetParamBlock2Controller(fCompPB, ParamID(kVelocityMin)), node, start, end); if (ctl != nil) { - plParticleVelMinApplicator *app = TRACKED_NEW plParticleVelMinApplicator(); + plParticleVelMinApplicator *app = new plParticleVelMinApplicator(); app->SetChannelName(node->GetName()); plAnimComponentBase::SetupCtl(anim, ctl, app, node); result = true; @@ -578,7 +578,7 @@ hsBool plParticleCoreComponent::AddToAnim(plAGAnim *anim, plMaxNode *node) ctl = cc.MakeScalarController(GetParamBlock2Controller(fCompPB, ParamID(kVelocityMax)), node, start, end); if (ctl != nil) { - plParticleVelMaxApplicator *app = TRACKED_NEW plParticleVelMaxApplicator(); + plParticleVelMaxApplicator *app = new plParticleVelMaxApplicator(); app->SetChannelName(node->GetName()); plAnimComponentBase::SetupCtl(anim, ctl, app, node); result = true; @@ -588,7 +588,7 @@ hsBool plParticleCoreComponent::AddToAnim(plAGAnim *anim, plMaxNode *node) ctl = cc.MakeScalarController(GetParamBlock2Controller(fCompPB, ParamID(kGravity)), node, start, end); if (ctl != nil) { - plParticleGravityApplicator *app = TRACKED_NEW plParticleGravityApplicator(); + plParticleGravityApplicator *app = new plParticleGravityApplicator(); plAnimComponentBase::SetupCtl(anim, ctl, app, node); result = true; } @@ -596,7 +596,7 @@ hsBool plParticleCoreComponent::AddToAnim(plAGAnim *anim, plMaxNode *node) ctl = cc.MakeScalarController(GetParamBlock2Controller(fCompPB, ParamID(kDrag)), node, start, end); if (ctl != nil) { - plParticleDragApplicator *app = TRACKED_NEW plParticleDragApplicator(); + plParticleDragApplicator *app = new plParticleDragApplicator(); plAnimComponentBase::SetupCtl(anim, ctl, app, node); result = true; } @@ -606,7 +606,7 @@ hsBool plParticleCoreComponent::AddToAnim(plAGAnim *anim, plMaxNode *node) ctl = cc.MakeScalarController(GetParamBlock2Controller(fCompPB, ParamID(kScaleMin)), node, start, end); if (ctl != nil) { - plParticleScaleMinApplicator *app = TRACKED_NEW plParticleScaleMinApplicator(); + plParticleScaleMinApplicator *app = new plParticleScaleMinApplicator(); app->SetChannelName(node->GetName()); plAnimComponentBase::SetupCtl(anim, ctl, app, node); result = true; @@ -615,7 +615,7 @@ hsBool plParticleCoreComponent::AddToAnim(plAGAnim *anim, plMaxNode *node) ctl = cc.MakeScalarController(GetParamBlock2Controller(fCompPB, ParamID(kScaleMax)), node, start, end); if (ctl != nil) { - plParticleScaleMaxApplicator *app = TRACKED_NEW plParticleScaleMaxApplicator(); + plParticleScaleMaxApplicator *app = new plParticleScaleMaxApplicator(); app->SetChannelName(node->GetName()); plAnimComponentBase::SetupCtl(anim, ctl, app, node); result = true; @@ -656,9 +656,9 @@ public: ParticleCompDlgProc() {} ~ParticleCompDlgProc() {} - void IValidateSpinners(TimeValue t, IParamBlock2 *pb, IParamMap2 *map, UInt32 id) + void IValidateSpinners(TimeValue t, IParamBlock2 *pb, IParamMap2 *map, uint32_t id) { - UInt32 minIndex, maxIndex; + uint32_t minIndex, maxIndex; hsBool adjustMin; switch(id) { @@ -964,7 +964,7 @@ void plParticleFadeComponent::AddToParticleSystem(plParticleSystem *sys, plMaxNo plParticleFadeVolumeEffect *effect = nil; if( !fEffect ) { - effect = TRACKED_NEW plParticleFadeVolumeEffect(); + effect = new plParticleFadeVolumeEffect(); hsgResMgr::ResMgr()->NewKey(IGetUniqueName(node), effect, node->GetLocation(), node->GetLoadMask()); effect->fLength = (float)fCompPB->GetInt(kFadeDistance); if (fCompPB->GetInt(kFadeZ)) @@ -977,7 +977,7 @@ void plParticleFadeComponent::AddToParticleSystem(plParticleSystem *sys, plMaxNo effect = plParticleFadeVolumeEffect::ConvertNoRef(fEffect); } hsAssert(effect, "Our effect pointer was wrong type?"); - hsgResMgr::ResMgr()->AddViaNotify( effect->GetKey(), TRACKED_NEW plGenRefMsg( sys->GetKey(), plRefMsg::kOnCreate, 0, plParticleSystem::kEffectMisc ), plRefFlags::kActiveRef ); + hsgResMgr::ResMgr()->AddViaNotify( effect->GetKey(), new plGenRefMsg( sys->GetKey(), plRefMsg::kOnCreate, 0, plParticleSystem::kEffectMisc ), plRefFlags::kActiveRef ); } CLASS_DESC(plParticleFadeComponent, gParticleFadeDesc, "Fade Volume Effect", "Fade Volume Effect", COMP_TYPE_PARTICLE, PARTICLE_FADE_COMPONENT_CLASS_ID) @@ -1050,10 +1050,10 @@ void plParticleVolumeComponent::BuildVolume(plMaxNode *node) if (fBound != nil) return; // already converted it - fBound = TRACKED_NEW plBoundInterface; + fBound = new plBoundInterface; hsgResMgr::ResMgr()->NewKey(node->GetName(), fBound, node->GetLocation(), node->GetLoadMask()); fBound->Init(plMeshConverter::Instance().CreateConvexVolume(node)); - hsgResMgr::ResMgr()->AddViaNotify(fBound->GetKey(), TRACKED_NEW plObjRefMsg(node->GetKey(), plRefMsg::kOnCreate, -1, plObjRefMsg::kInterface), plRefFlags::kActiveRef); + hsgResMgr::ResMgr()->AddViaNotify(fBound->GetKey(), new plObjRefMsg(node->GetKey(), plRefMsg::kOnCreate, -1, plObjRefMsg::kInterface), plRefFlags::kActiveRef); } @@ -1072,14 +1072,14 @@ void plParticleVolumeComponent::AddToParticleSystem(plParticleSystem *sys, plMax { default: case kImpDefault: - effect = TRACKED_NEW plParticleCollisionEffectBeat(); + effect = new plParticleCollisionEffectBeat(); break; case kImpDie: - effect = TRACKED_NEW plParticleCollisionEffectDie(); + effect = new plParticleCollisionEffectDie(); break; case kImpBounce: { - plParticleCollisionEffectBounce* bnc = TRACKED_NEW plParticleCollisionEffectBounce(); + plParticleCollisionEffectBounce* bnc = new plParticleCollisionEffectBounce(); bnc->SetBounce(fCompPB->GetFloat(kBounceAmt) * 1.e-2f); bnc->SetFriction(fCompPB->GetFloat(kFrictionAmt) * 1.e-2f); effect = bnc; @@ -1089,7 +1089,7 @@ void plParticleVolumeComponent::AddToParticleSystem(plParticleSystem *sys, plMax hsgResMgr::ResMgr()->NewKey(IGetUniqueName(node), effect, node->GetLocation(), node->GetLoadMask()); plSceneObject *sObj = source->GetSceneObject(); - hsgResMgr::ResMgr()->AddViaNotify( sObj->GetKey(), TRACKED_NEW plGenRefMsg( effect->GetKey(), plRefMsg::kOnCreate, 0, 0 ), plRefFlags::kPassiveRef ); + hsgResMgr::ResMgr()->AddViaNotify( sObj->GetKey(), new plGenRefMsg( effect->GetKey(), plRefMsg::kOnCreate, 0, 0 ), plRefFlags::kPassiveRef ); fEffect = effect; } @@ -1098,7 +1098,7 @@ void plParticleVolumeComponent::AddToParticleSystem(plParticleSystem *sys, plMax effect = plParticleCollisionEffect::ConvertNoRef(fEffect); } hsAssert(effect, "Our effect pointer was wrong type?"); - hsgResMgr::ResMgr()->AddViaNotify( effect->GetKey(), TRACKED_NEW plGenRefMsg( sys->GetKey(), plRefMsg::kOnCreate, 0, plParticleSystem::kEffectConstraint ), plRefFlags::kActiveRef ); + hsgResMgr::ResMgr()->AddViaNotify( effect->GetKey(), new plGenRefMsg( sys->GetKey(), plRefMsg::kOnCreate, 0, plParticleSystem::kEffectConstraint ), plRefFlags::kActiveRef ); } CLASS_DESC(plParticleVolumeComponent, gParticleVolumeDesc, "Collision Volume Effect", "Collision Volume Effect", COMP_TYPE_PARTICLE, PARTICLE_VOLUME_COMPONENT_CLASS_ID) @@ -1156,7 +1156,7 @@ static hsVector3 IGetRefDir(plMaxNode* node, INode* refNode, float clampAngDeg) float vecLen = 100.f; if( clampAngDeg > 1.f ) { - float rads = hsScalarDegToRad(clampAngDeg); + float rads = hsDegreesToRadians(clampAngDeg); float sinAng = sinf(rads); hsAssert(sinAng > 0.01, "Trig confusion?"); @@ -1190,7 +1190,7 @@ void plParticleWindComponent::AddToParticleSystem(plParticleSystem *sys, plMaxNo plParticleLocalWind* effect = nil; if( !fEffect ) { - effect = TRACKED_NEW plParticleLocalWind(); + effect = new plParticleLocalWind(); effect->SetScale(hsVector3(fCompPB->GetFloat(kScaleX), fCompPB->GetFloat(kScaleY), fCompPB->GetFloat(kScaleZ))); effect->SetSpeed(fCompPB->GetFloat(kSpeed)); @@ -1210,7 +1210,7 @@ void plParticleWindComponent::AddToParticleSystem(plParticleSystem *sys, plMaxNo effect = plParticleLocalWind::ConvertNoRef(fEffect); } hsAssert(effect, "Our effect pointer was wrong type?"); - hsgResMgr::ResMgr()->AddViaNotify( effect->GetKey(), TRACKED_NEW plGenRefMsg( sys->GetKey(), plRefMsg::kOnCreate, 0, plParticleSystem::kEffectForce ), plRefFlags::kActiveRef ); + hsgResMgr::ResMgr()->AddViaNotify( effect->GetKey(), new plGenRefMsg( sys->GetKey(), plRefMsg::kOnCreate, 0, plParticleSystem::kEffectForce ), plRefFlags::kActiveRef ); } CLASS_DESC(plParticleWindComponent, gParticleWindDesc, "Wind Effect", "WindEffect", COMP_TYPE_PARTICLE, PARTICLE_WIND_COMPONENT_CLASS_ID) @@ -1311,7 +1311,7 @@ void plParticleUniWindComponent::AddToParticleSystem(plParticleSystem *sys, plMa plParticleUniformWind* effect = nil; if( !fEffect ) { - effect = TRACKED_NEW plParticleUniformWind(); + effect = new plParticleUniformWind(); hsgResMgr::ResMgr()->NewKey(IGetUniqueName(node), effect, node->GetLocation(), node->GetLoadMask()); effect->SetStrength(fCompPB->GetFloat(kStrength)); @@ -1331,7 +1331,7 @@ void plParticleUniWindComponent::AddToParticleSystem(plParticleSystem *sys, plMa effect = plParticleUniformWind::ConvertNoRef(fEffect); } hsAssert(effect, "Our effect pointer was wrong type?"); - hsgResMgr::ResMgr()->AddViaNotify( effect->GetKey(), TRACKED_NEW plGenRefMsg( sys->GetKey(), plRefMsg::kOnCreate, 0, plParticleSystem::kEffectForce ), plRefFlags::kActiveRef ); + hsgResMgr::ResMgr()->AddViaNotify( effect->GetKey(), new plGenRefMsg( sys->GetKey(), plRefMsg::kOnCreate, 0, plParticleSystem::kEffectForce ), plRefFlags::kActiveRef ); } CLASS_DESC(plParticleUniWindComponent, gParticleUniWindDesc, "Uniform Wind", "UniWind", COMP_TYPE_PARTICLE, PARTICLE_UNIWIND_COMPONENT_CLASS_ID) @@ -1422,9 +1422,9 @@ public: ParticleFlockEffectDlgProc() {} ~ParticleFlockEffectDlgProc() {} - void IValidateSpinners(TimeValue t, IParamBlock2 *pb, IParamMap2 *map, UInt32 id) + void IValidateSpinners(TimeValue t, IParamBlock2 *pb, IParamMap2 *map, uint32_t id) { - UInt32 minIndex, maxIndex; + uint32_t minIndex, maxIndex; hsBool adjustMin; switch(id) { @@ -1482,7 +1482,7 @@ void plParticleFlockComponent::AddToParticleSystem(plParticleSystem *sys, plMaxN plParticleFlockEffect* effect = nil; if( !fEffect ) { - effect = TRACKED_NEW plParticleFlockEffect(); + effect = new plParticleFlockEffect(); hsgResMgr::ResMgr()->NewKey(IGetUniqueName(node), effect, node->GetLocation(), node->GetLoadMask()); hsPoint3 offset(fCompPB->GetFloat(ParamID(kOffsetX)), @@ -1492,8 +1492,8 @@ void plParticleFlockComponent::AddToParticleSystem(plParticleSystem *sys, plMaxN effect->SetInfluenceAvgRadius(fCompPB->GetFloat(ParamID(kInfAvgDist))); effect->SetInfluenceRepelRadius(fCompPB->GetFloat(ParamID(kInfRepDist))); - hsScalar goalDist = fCompPB->GetFloat(ParamID(kGoalDist)); - hsScalar fcDist = fCompPB->GetFloat(ParamID(kFullChaseDist)); + float goalDist = fCompPB->GetFloat(ParamID(kGoalDist)); + float fcDist = fCompPB->GetFloat(ParamID(kFullChaseDist)); effect->SetGoalRadius(goalDist); effect->SetFullChaseRadius(goalDist > fcDist ? goalDist : fcDist); // Fix old data @@ -1512,7 +1512,7 @@ void plParticleFlockComponent::AddToParticleSystem(plParticleSystem *sys, plMaxN effect = plParticleFlockEffect::ConvertNoRef(fEffect); } hsAssert(effect, "Our effect pointer was wrong type?"); - hsgResMgr::ResMgr()->AddViaNotify( effect->GetKey(), TRACKED_NEW plGenRefMsg( sys->GetKey(), plRefMsg::kOnCreate, 0, plParticleSystem::kEffectForce ), plRefFlags::kActiveRef ); + hsgResMgr::ResMgr()->AddViaNotify( effect->GetKey(), new plGenRefMsg( sys->GetKey(), plRefMsg::kOnCreate, 0, plParticleSystem::kEffectForce ), plRefFlags::kActiveRef ); } CLASS_DESC(plParticleFlockComponent, gParticleFlockDesc, "Particle Flock", "Flock", COMP_TYPE_PARTICLE, PARTICLE_FLOCK_COMPONENT_CLASS_ID) diff --git a/Sources/Tools/MaxComponent/plParticleComponents.h b/Sources/Tools/MaxComponent/plParticleComponents.h index 195675fe..8757b8fb 100644 --- a/Sources/Tools/MaxComponent/plParticleComponents.h +++ b/Sources/Tools/MaxComponent/plParticleComponents.h @@ -58,27 +58,27 @@ class ParticleStats { public: - hsScalar fConeAngle; - hsScalar fVelocityMin; - hsScalar fVelocityMax; - hsScalar fLifeMin; - hsScalar fLifeMax; - hsScalar fPPS; - hsScalar fScaleMin; - hsScalar fScaleMax; - hsScalar fGravity; - hsScalar fDrag; - hsScalar fWindMult; - hsScalar fMassRange; - hsScalar fRotRange; - hsScalar fPreSim; - hsScalar fHSize; - hsScalar fVSize; - UInt32 fGenType; - UInt32 fXTiles; - UInt32 fYTiles; - UInt32 fNormal; - UInt32 fOrientation; + float fConeAngle; + float fVelocityMin; + float fVelocityMax; + float fLifeMin; + float fLifeMax; + float fPPS; + float fScaleMin; + float fScaleMax; + float fGravity; + float fDrag; + float fWindMult; + float fMassRange; + float fRotRange; + float fPreSim; + float fHSize; + float fVSize; + uint32_t fGenType; + uint32_t fXTiles; + uint32_t fYTiles; + uint32_t fNormal; + uint32_t fOrientation; hsBool fImmortal; ParticleStats() : fConeAngle(0.5), fVelocityMin(30.0), fVelocityMax(50.0), fLifeMin(5.0), fLifeMax(10.0), fPPS(20.0), diff --git a/Sources/Tools/MaxComponent/plPhysConstraintComponents.cpp b/Sources/Tools/MaxComponent/plPhysConstraintComponents.cpp index 1f52f049..09ef493c 100644 --- a/Sources/Tools/MaxComponent/plPhysConstraintComponents.cpp +++ b/Sources/Tools/MaxComponent/plPhysConstraintComponents.cpp @@ -405,7 +405,7 @@ extern PlasmaToHavokQuat(Havok::Quaternion &a, hsQuat &b); hsBool plPhysHingeConstraintComponent::Convert(plMaxNode *node, plErrorMsg *pErrMsg) { - plHingeConstraintMod* HMod = TRACKED_NEW plHingeConstraintMod; + plHingeConstraintMod* HMod = new plHingeConstraintMod; plMaxNode* ParentNode = (plMaxNode*)fCompPB->GetINode(kParent); @@ -493,8 +493,8 @@ hsBool plPhysHingeConstraintComponent::Convert(plMaxNode *node, plErrorMsg *pErr node->AddModifier(HMod, IGetUniqueName(node)); if(ParentKey) - hsgResMgr::ResMgr()->AddViaNotify( ParentKey, TRACKED_NEW plGenRefMsg( HMod->GetKey(), plRefMsg::kOnCreate, plHavokConstraintsMod::kParentIdx, 0 ), plRefFlags::kPassiveRef ); - hsgResMgr::ResMgr()->AddViaNotify( node->GetKey(), TRACKED_NEW plGenRefMsg( HMod->GetKey(), plRefMsg::kOnCreate, plHavokConstraintsMod::kChildIdx, 0 ), plRefFlags::kPassiveRef ); + hsgResMgr::ResMgr()->AddViaNotify( ParentKey, new plGenRefMsg( HMod->GetKey(), plRefMsg::kOnCreate, plHavokConstraintsMod::kParentIdx, 0 ), plRefFlags::kPassiveRef ); + hsgResMgr::ResMgr()->AddViaNotify( node->GetKey(), new plGenRefMsg( HMod->GetKey(), plRefMsg::kOnCreate, plHavokConstraintsMod::kChildIdx, 0 ), plRefFlags::kPassiveRef ); @@ -696,7 +696,7 @@ hsBool plPhysBridgeComponent::Convert(plMaxNode* node, plErrorMsg* errMsg) if (!parent) return false; - plHingeConstraintMod* mod = TRACKED_NEW plHingeConstraintMod; + plHingeConstraintMod* mod = new plHingeConstraintMod; // mod->SetHCFriction(0, 1.f); mod->SetRR(fCompPB->GetFloat(kStrength));//1.f / sqrt(float(count))); @@ -724,8 +724,8 @@ hsBool plPhysBridgeComponent::Convert(plMaxNode* node, plErrorMsg* errMsg) mod->SetRotationAxis(-1*hingeVector); node->AddModifier(mod, IGetUniqueName(node)); - hsgResMgr::ResMgr()->AddViaNotify(parent->GetKey(), TRACKED_NEW plGenRefMsg(mod->GetKey(), plRefMsg::kOnCreate, plHavokConstraintsMod::kParentIdx, 0), plRefFlags::kPassiveRef); - hsgResMgr::ResMgr()->AddViaNotify(node->GetKey(), TRACKED_NEW plGenRefMsg(mod->GetKey(), plRefMsg::kOnCreate, plHavokConstraintsMod::kChildIdx, 0), plRefFlags::kPassiveRef); + hsgResMgr::ResMgr()->AddViaNotify(parent->GetKey(), new plGenRefMsg(mod->GetKey(), plRefMsg::kOnCreate, plHavokConstraintsMod::kParentIdx, 0), plRefFlags::kPassiveRef); + hsgResMgr::ResMgr()->AddViaNotify(node->GetKey(), new plGenRefMsg(mod->GetKey(), plRefMsg::kOnCreate, plHavokConstraintsMod::kChildIdx, 0), plRefFlags::kPassiveRef); return true; } @@ -1042,7 +1042,7 @@ hsBool plStrongSpringConstraintComponent::SetupProperties(plMaxNode *pNode, plEr hsBool plStrongSpringConstraintComponent::Convert(plMaxNode *node, plErrorMsg *pErrMsg) { - plStrongSpringConstraintMod* HMod = TRACKED_NEW plStrongSpringConstraintMod; + plStrongSpringConstraintMod* HMod = new plStrongSpringConstraintMod; HMod->SetDamp(fCompPB->GetFloat(kStrength)); HMod->SetRR(fCompPB->GetFloat(kRebound)); @@ -1081,8 +1081,8 @@ hsBool plStrongSpringConstraintComponent::Convert(plMaxNode *node, plErrorMsg *p node->AddModifier(HMod, IGetUniqueName(node)); - hsgResMgr::ResMgr()->AddViaNotify( ParentKey, TRACKED_NEW plGenRefMsg( HMod->GetKey(), plRefMsg::kOnCreate, plHavokConstraintsMod::kParentIdx, 0 ), plRefFlags::kPassiveRef ); - hsgResMgr::ResMgr()->AddViaNotify( node->GetKey(), TRACKED_NEW plGenRefMsg( HMod->GetKey(), plRefMsg::kOnCreate, plHavokConstraintsMod::kChildIdx, 0 ), plRefFlags::kPassiveRef ); + hsgResMgr::ResMgr()->AddViaNotify( ParentKey, new plGenRefMsg( HMod->GetKey(), plRefMsg::kOnCreate, plHavokConstraintsMod::kParentIdx, 0 ), plRefFlags::kPassiveRef ); + hsgResMgr::ResMgr()->AddViaNotify( node->GetKey(), new plGenRefMsg( HMod->GetKey(), plRefMsg::kOnCreate, plHavokConstraintsMod::kChildIdx, 0 ), plRefFlags::kPassiveRef ); diff --git a/Sources/Tools/MaxComponent/plPhysicalComponents.cpp b/Sources/Tools/MaxComponent/plPhysicalComponents.cpp index fed365b3..7dc18d04 100644 --- a/Sources/Tools/MaxComponent/plPhysicalComponents.cpp +++ b/Sources/Tools/MaxComponent/plPhysicalComponents.cpp @@ -426,11 +426,11 @@ void plPhysTerrainComponent::CollectNonDrawables(INodeTab& nonDrawables) void ValidateGroups(IParamBlock2* pb, int memberID, int bounceID, plComponent* comp, plErrorMsg* pErrMsg) { - UInt32 defMember = pb->GetParamDef(memberID).def.i; - UInt32 member = pb->GetInt(memberID); + uint32_t defMember = pb->GetParamDef(memberID).def.i; + uint32_t member = pb->GetInt(memberID); - UInt32 defCollide = pb->GetParamDef(bounceID).def.i; - UInt32 collide = pb->GetInt(bounceID); + uint32_t defCollide = pb->GetParamDef(bounceID).def.i; + uint32_t collide = pb->GetInt(bounceID); if (defMember != member || defCollide != collide) { @@ -1075,9 +1075,9 @@ public: Swim2DDlgProc() {} ~Swim2DDlgProc() {} - void IValidateSpinners(TimeValue t, IParamBlock2 *pb, IParamMap2 *map, UInt32 id) + void IValidateSpinners(TimeValue t, IParamBlock2 *pb, IParamMap2 *map, uint32_t id) { - UInt32 minIndex, maxIndex; + uint32_t minIndex, maxIndex; hsBool adjustMin; switch(id) { @@ -1324,19 +1324,19 @@ hsBool plSwim2DComponent::PreConvert(plMaxNode *node, plErrorMsg *pErrMsg) { case kCurrentSpiral: { - fSwimRegions[node] = TRACKED_NEW plSwimCircularCurrentRegion(); + fSwimRegions[node] = new plSwimCircularCurrentRegion(); hsgResMgr::ResMgr()->NewKey(node->GetName(), fSwimRegions[node], node->GetLocation(), node->GetLoadMask()); break; } case kCurrentStraight: { - fSwimRegions[node] = TRACKED_NEW plSwimStraightCurrentRegion(); + fSwimRegions[node] = new plSwimStraightCurrentRegion(); hsgResMgr::ResMgr()->NewKey(node->GetName(), fSwimRegions[node], node->GetLocation(), node->GetLoadMask()); break; } default: { - fSwimRegions[node] = TRACKED_NEW plSwimRegionInterface(); + fSwimRegions[node] = new plSwimRegionInterface(); hsgResMgr::ResMgr()->NewKey(node->GetName(), fSwimRegions[node], node->GetLocation(), node->GetLoadMask()); break; } @@ -1354,11 +1354,11 @@ hsBool plSwim2DComponent::Convert(plMaxNode *node, plErrorMsg *pErrMsg) if (!detectorNode->GetSceneObject()->GetModifierByType(plSwimDetector::Index())) { plKey nilKey; - plSwimMsg *enterMsg = TRACKED_NEW plSwimMsg(detectorNode->GetKey(), nilKey, true, nil); - plSwimMsg *exitMsg = TRACKED_NEW plSwimMsg(detectorNode->GetKey(), nilKey, false, nil); + plSwimMsg *enterMsg = new plSwimMsg(detectorNode->GetKey(), nilKey, true, nil); + plSwimMsg *exitMsg = new plSwimMsg(detectorNode->GetKey(), nilKey, false, nil); enterMsg->SetBCastFlag(plMessage::kPropagateToModifiers); exitMsg->SetBCastFlag(plMessage::kPropagateToModifiers); - plSwimDetector *swimMod = TRACKED_NEW plSwimDetector(enterMsg, exitMsg); + plSwimDetector *swimMod = new plSwimDetector(enterMsg, exitMsg); detectorNode->AddModifier(swimMod, IGetUniqueName(node)); // the mod doesn't have a valid key until AddModifier is called, so this comes last. @@ -1384,7 +1384,7 @@ hsBool plSwim2DComponent::Convert(plMaxNode *node, plErrorMsg *pErrMsg) plMaxNode *currentNode = (plMaxNode *)fCompPB->GetINode(ParamID(kSwimCurrentNode)); if (currentNode) { - plGenRefMsg *msg= TRACKED_NEW plGenRefMsg(circInt->GetKey(), plRefMsg::kOnCreate, -1, -1); + plGenRefMsg *msg= new plGenRefMsg(circInt->GetKey(), plRefMsg::kOnCreate, -1, -1); hsgResMgr::ResMgr()->AddViaNotify(currentNode->GetSceneObject()->GetKey(), msg, plRefFlags::kActiveRef); } break; @@ -1400,7 +1400,7 @@ hsBool plSwim2DComponent::Convert(plMaxNode *node, plErrorMsg *pErrMsg) plMaxNode *currentNode = (plMaxNode *)fCompPB->GetINode(ParamID(kSwimCurrentNode)); if (currentNode) { - plGenRefMsg *msg= TRACKED_NEW plGenRefMsg(strInt->GetKey(), plRefMsg::kOnCreate, -1, -1); + plGenRefMsg *msg= new plGenRefMsg(strInt->GetKey(), plRefMsg::kOnCreate, -1, -1); hsgResMgr::ResMgr()->AddViaNotify(currentNode->GetSceneObject()->GetKey(), msg, plRefFlags::kActiveRef); } break; @@ -1416,7 +1416,7 @@ hsBool plSwim2DComponent::Convert(plMaxNode *node, plErrorMsg *pErrMsg) fSwimRegions[node]->fUpBuoyancy = fCompPB->GetFloat(ParamID(kSwimBuoyancyUp)) + 1; fSwimRegions[node]->fMaxUpwardVel = fCompPB->GetFloat(ParamID(kSwimMaxUpVel)); - hsgResMgr::ResMgr()->AddViaNotify(fSwimRegions[node]->GetKey(), TRACKED_NEW plObjRefMsg(node->GetKey(), plRefMsg::kOnCreate, -1, plObjRefMsg::kInterface), plRefFlags::kActiveRef); + hsgResMgr::ResMgr()->AddViaNotify(fSwimRegions[node]->GetKey(), new plObjRefMsg(node->GetKey(), plRefMsg::kOnCreate, -1, plObjRefMsg::kInterface), plRefFlags::kActiveRef); return true; } @@ -1633,7 +1633,7 @@ void plPhysSubWorldComponent::IAddChildren(plMaxNode* node, plMaxNode* subworld) bool hasSubworld = false; - UInt32 numComps = child->NumAttachedComponents(); + uint32_t numComps = child->NumAttachedComponents(); for (int j = 0; j < numComps; j++) { plComponentBase* comp = child->GetAttachedComponent(j); @@ -1765,11 +1765,11 @@ hsBool plSubworldDetectorComponent::Convert(plMaxNode *node, plErrorMsg *pErrMsg plSceneObject *obj = node->GetSceneObject(); plLocation loc = node->GetLocation(); - plSubworldRegionDetector *detector = TRACKED_NEW plSubworldRegionDetector; + plSubworldRegionDetector *detector = new plSubworldRegionDetector; // Register the detector plKey detectorKey = hsgResMgr::ResMgr()->NewKey(IGetUniqueName(node), detector, loc); - hsgResMgr::ResMgr()->AddViaNotify(detectorKey, TRACKED_NEW plObjRefMsg(obj->GetKey(), plRefMsg::kOnCreate, -1, plObjRefMsg::kModifier), plRefFlags::kActiveRef); + hsgResMgr::ResMgr()->AddViaNotify(detectorKey, new plObjRefMsg(obj->GetKey(), plRefMsg::kOnCreate, -1, plObjRefMsg::kModifier), plRefFlags::kActiveRef); // need to get the key for the camera here... plMaxNode* pSubNode = (plMaxNode*)fCompPB->GetINode(kSubworldTarget); @@ -1881,12 +1881,12 @@ hsBool plPanicLinkDetectorComponent::Convert(plMaxNode *node, plErrorMsg *pErrMs plSceneObject *obj = node->GetSceneObject(); plLocation loc = node->GetLocation(); - plPanicLinkRegion *detector = TRACKED_NEW plPanicLinkRegion; + plPanicLinkRegion *detector = new plPanicLinkRegion; detector->fPlayLinkOutAnim = fCompPB->GetInt(ParamID(kPlayAnim)); // Register the detector plKey detectorKey = hsgResMgr::ResMgr()->NewKey(IGetUniqueName(node), detector, loc); - hsgResMgr::ResMgr()->AddViaNotify(detectorKey, TRACKED_NEW plObjRefMsg(obj->GetKey(), plRefMsg::kOnCreate, -1, plObjRefMsg::kModifier), plRefFlags::kActiveRef); + hsgResMgr::ResMgr()->AddViaNotify(detectorKey, new plObjRefMsg(obj->GetKey(), plRefMsg::kOnCreate, -1, plObjRefMsg::kModifier), plRefFlags::kActiveRef); return true; } @@ -2002,14 +2002,14 @@ hsBool plRideAnimatedPhysicalComponent::Convert(plMaxNode *node, plErrorMsg *pEr { plSceneObject *obj = node->GetSceneObject(); plLocation loc = node->GetLocation(); - plRideAnimatedPhysMsg* enter = TRACKED_NEW plRideAnimatedPhysMsg(obj->GetKey(), nil, true, nil); + plRideAnimatedPhysMsg* enter = new plRideAnimatedPhysMsg(obj->GetKey(), nil, true, nil); enter->SetBCastFlag(plMessage::kPropagateToModifiers); - plRideAnimatedPhysMsg* exit = TRACKED_NEW plRideAnimatedPhysMsg(obj->GetKey(), nil, false, nil); + plRideAnimatedPhysMsg* exit = new plRideAnimatedPhysMsg(obj->GetKey(), nil, false, nil); exit->SetBCastFlag(plMessage::kPropagateToModifiers); - plRidingAnimatedPhysicalDetector *detector = TRACKED_NEW plRidingAnimatedPhysicalDetector(enter, exit); + plRidingAnimatedPhysicalDetector *detector = new plRidingAnimatedPhysicalDetector(enter, exit); // Register the detector //node->AddModifier(detector, IGetUniqueName(node)); plKey detectorKey = hsgResMgr::ResMgr()->NewKey(IGetUniqueName(node), detector, loc); - hsgResMgr::ResMgr()->AddViaNotify(detectorKey, TRACKED_NEW plObjRefMsg(obj->GetKey(), plRefMsg::kOnCreate, -1, plObjRefMsg::kModifier), plRefFlags::kActiveRef); + hsgResMgr::ResMgr()->AddViaNotify(detectorKey, new plObjRefMsg(obj->GetKey(), plRefMsg::kOnCreate, -1, plObjRefMsg::kModifier), plRefFlags::kActiveRef); return true; } diff --git a/Sources/Tools/MaxComponent/plPhysicalComponents.h b/Sources/Tools/MaxComponent/plPhysicalComponents.h index 3567868c..e3f8ded8 100644 --- a/Sources/Tools/MaxComponent/plPhysicalComponents.h +++ b/Sources/Tools/MaxComponent/plPhysicalComponents.h @@ -173,7 +173,7 @@ protected: void IFixBounds(); hsBool IGetProxy(plMaxNode *node, plErrorMsg *pErrMsg); - UInt32 IGetEventGroup(ParamID paramID); + uint32_t IGetEventGroup(ParamID paramID); }; class plSwim2DComponent : public plPhysicCoreComponent diff --git a/Sources/Tools/MaxComponent/plPickLocalizationDlg.cpp b/Sources/Tools/MaxComponent/plPickLocalizationDlg.cpp index 509d1ce5..feb739f3 100644 --- a/Sources/Tools/MaxComponent/plPickLocalizationDlg.cpp +++ b/Sources/Tools/MaxComponent/plPickLocalizationDlg.cpp @@ -45,7 +45,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "MaxMain/plMaxCFGFile.h" #include "MaxMain/plMaxAccelerators.h" -#include "hsUtils.h" + #include "hsStringTokenizer.h" #include "resource.h" diff --git a/Sources/Tools/MaxComponent/plPickLocalizationDlg.h b/Sources/Tools/MaxComponent/plPickLocalizationDlg.h index 5293fff1..e20cfb34 100644 --- a/Sources/Tools/MaxComponent/plPickLocalizationDlg.h +++ b/Sources/Tools/MaxComponent/plPickLocalizationDlg.h @@ -42,7 +42,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #ifndef plPickLocalizationDlg_h #define plPickLocalizationDlg_h -#include "hsTypes.h" +#include "HeadSpin.h" #include "max.h" #include diff --git a/Sources/Tools/MaxComponent/plPickNode.h b/Sources/Tools/MaxComponent/plPickNode.h index 49372a77..870934ae 100644 --- a/Sources/Tools/MaxComponent/plPickNode.h +++ b/Sources/Tools/MaxComponent/plPickNode.h @@ -42,7 +42,6 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #ifndef plPickNode_h_inc #define plPickNode_h_inc -#include "hsConfig.h" #include "max.h" #include diff --git a/Sources/Tools/MaxComponent/plPickNodeBase.cpp b/Sources/Tools/MaxComponent/plPickNodeBase.cpp index 4183faef..181f7c04 100644 --- a/Sources/Tools/MaxComponent/plPickNodeBase.cpp +++ b/Sources/Tools/MaxComponent/plPickNodeBase.cpp @@ -179,7 +179,7 @@ void plPickNodeBase::IGetSelNode(HWND hList) else { int len = ListBox_GetTextLen(hList, sel); - char* buf = TRACKED_NEW char[len+1]; + char* buf = new char[len+1]; ListBox_GetText(hList, sel, buf); /* if (!strcmp(buf, kUserTypeNone)) diff --git a/Sources/Tools/MaxComponent/plPythonFileComponent.cpp b/Sources/Tools/MaxComponent/plPythonFileComponent.cpp index d4f5db6f..ad04ea10 100644 --- a/Sources/Tools/MaxComponent/plPythonFileComponent.cpp +++ b/Sources/Tools/MaxComponent/plPythonFileComponent.cpp @@ -46,7 +46,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "plComponent.h" #include "plComponentReg.h" #include "MaxMain/plMaxNode.h" -#include "hsUtils.h" + #include "plAutoUIBlock.h" #include "plAutoUIParams.h" #include "pnSceneObject/plSceneObject.h" @@ -265,7 +265,7 @@ hsBool plPythonFileComponent::PreConvert(plMaxNode *node, plErrorMsg *pErrMsg) // if this is a multi-modifier python file component then is this the main (or first) maxnode bool mainMultiModierNode = false; - plPythonFileMod *mod = TRACKED_NEW plPythonFileMod; + plPythonFileMod *mod = new plPythonFileMod; // create the modifier key ourselves so that we can get the name of the modifier in the name plSceneObject *obj = node->GetSceneObject(); @@ -316,7 +316,7 @@ hsBool plPythonFileComponent::PreConvert(plMaxNode *node, plErrorMsg *pErrMsg) } // Create us a new sceneObject to attach to - obj = TRACKED_NEW plSceneObject; + obj = new plSceneObject; const plLocation &globalLoc = plPluginResManager::ResMgr()->GetCommonPage( node->GetLocation(), plAgeDescription::kGlobal ); hsAssert( globalLoc.IsValid(), "Invalid common page location!!!" ); @@ -355,7 +355,7 @@ hsBool plPythonFileComponent::PreConvert(plMaxNode *node, plErrorMsg *pErrMsg) modKey = hsgResMgr::ResMgr()->NewKey(IGetUniqueName(node), mod, node->GetLocation()); } } - hsgResMgr::ResMgr()->AddViaNotify(modKey, TRACKED_NEW plObjRefMsg(obj->GetKey(), plRefMsg::kOnCreate, -1, plObjRefMsg::kModifier), plRefFlags::kActiveRef); + hsgResMgr::ResMgr()->AddViaNotify(modKey, new plObjRefMsg(obj->GetKey(), plRefMsg::kOnCreate, -1, plObjRefMsg::kModifier), plRefFlags::kActiveRef); fModKeys[node] = modKey; // only let non-multimodifier or multimodifier then only the main node register for notifies @@ -442,7 +442,7 @@ hsBool plPythonFileComponent::Convert(plMaxNode *node, plErrorMsg *pErrMsg) switch (param->GetParamType()) { case plAutoUIParam::kTypeBool: - pyParam.SetToBoolean(param->GetBool(pb)); + pyParam.SetTobool(param->GetBool(pb)); mod->AddParameter(pyParam); break; diff --git a/Sources/Tools/MaxComponent/plRepComponent.cpp b/Sources/Tools/MaxComponent/plRepComponent.cpp index ea4401a3..255bbe9a 100644 --- a/Sources/Tools/MaxComponent/plRepComponent.cpp +++ b/Sources/Tools/MaxComponent/plRepComponent.cpp @@ -439,7 +439,7 @@ hsBool plRepGroupComp::DeInit(plMaxNode* node, plErrorMsg* pErrMsg) hsBool plRepGroupComp::ComputeAndValidate(plErrorMsg* pErrMsg, int quals[], int caps[], plLoadMask masks[]) { const int numReps = fCompPB->Count(kReps); - UInt32 preVal = plLoadMask::ValidateReps(numReps, quals, caps); + uint32_t preVal = plLoadMask::ValidateReps(numReps, quals, caps); if( preVal ) { @@ -459,7 +459,7 @@ hsBool plRepGroupComp::ComputeAndValidate(plErrorMsg* pErrMsg, int quals[], int hsBool val = plLoadMask::ComputeRepMasks(numReps, quals, caps, masks); - UInt32 postVal = plLoadMask::ValidateMasks(numReps, masks); + uint32_t postVal = plLoadMask::ValidateMasks(numReps, masks); if( postVal ) { diff --git a/Sources/Tools/MaxComponent/plResponderAnim.cpp b/Sources/Tools/MaxComponent/plResponderAnim.cpp index 517b1b54..74305162 100644 --- a/Sources/Tools/MaxComponent/plResponderAnim.cpp +++ b/Sources/Tools/MaxComponent/plResponderAnim.cpp @@ -330,7 +330,7 @@ plMessage *plResponderCmdAnim::ICreateAnimMsg(plMaxNode* node, plErrorMsg *pErrM if (!animKey) throw "Animation component didn't convert"; - plAnimCmdMsg *msg = TRACKED_NEW plAnimCmdMsg; + plAnimCmdMsg *msg = new plAnimCmdMsg; msg->AddReceiver(animKey); const char *tempAnimName = comp->GetAnimName(); @@ -409,7 +409,7 @@ plMessage* plResponderCmdAnim::ICreateSndMsg(plMaxNode* node, plErrorMsg *pErrMs const plAudioInterface *ai = targNode->GetSceneObject()->GetAudioInterface(); plKey key = ai->GetKey(); - plSoundMsg* msg = TRACKED_NEW plSoundMsg; + plSoundMsg* msg = new plSoundMsg; msg->AddReceiver(key); msg->fIndex = soundIdx; @@ -440,7 +440,7 @@ plMessage* plResponderCmdAnim::ICreateSndMsg(plMaxNode* node, plErrorMsg *pErrMs plKey key = plAudioComp::GetRandomSoundKey(comp, targNode); if (key) { - plAnimCmdMsg *msg = TRACKED_NEW plAnimCmdMsg; + plAnimCmdMsg *msg = new plAnimCmdMsg; msg->AddReceiver(key); if (type == kRespondPlayRndSound) @@ -502,7 +502,7 @@ void plResponderCmdAnim::CreateWait(plMaxNode* node, plErrorMsg* pErrMsg, IParam if (soundMsg) soundMsg->SetCmd(plSoundMsg::kAddCallbacks); - plEventCallbackMsg *eventMsg = TRACKED_NEW plEventCallbackMsg; + plEventCallbackMsg *eventMsg = new plEventCallbackMsg; eventMsg->AddReceiver(waitInfo.receiver); eventMsg->fRepeats = 0; eventMsg->fUser = waitInfo.callbackUser; diff --git a/Sources/Tools/MaxComponent/plResponderCmd.h b/Sources/Tools/MaxComponent/plResponderCmd.h index d5140c2e..0a4c8706 100644 --- a/Sources/Tools/MaxComponent/plResponderCmd.h +++ b/Sources/Tools/MaxComponent/plResponderCmd.h @@ -42,7 +42,6 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #ifndef plResponderCmd_h_inc #define plResponderCmd_h_inc -#include "hsConfig.h" #include #include #include "pnKeyedObject/plKey.h" diff --git a/Sources/Tools/MaxComponent/plResponderComponent.cpp b/Sources/Tools/MaxComponent/plResponderComponent.cpp index a7d938f2..8f6fcf18 100644 --- a/Sources/Tools/MaxComponent/plResponderComponent.cpp +++ b/Sources/Tools/MaxComponent/plResponderComponent.cpp @@ -338,9 +338,9 @@ hsBool plResponderComponent::PreConvert(plMaxNode *node,plErrorMsg *pErrMsg) plLocation loc = node->GetLocation(); // Create and register the RESPONDER's logic component - plResponderModifier *responder = TRACKED_NEW plResponderModifier; + plResponderModifier *responder = new plResponderModifier; plKey responderKey = hsgResMgr::ResMgr()->NewKey(IGetUniqueName(node), responder, loc); - hsgResMgr::ResMgr()->AddViaNotify(responderKey, TRACKED_NEW plObjRefMsg(rObj->GetKey(), plRefMsg::kOnCreate, -1, plObjRefMsg::kModifier), plRefFlags::kActiveRef); + hsgResMgr::ResMgr()->AddViaNotify(responderKey, new plObjRefMsg(rObj->GetKey(), plRefMsg::kOnCreate, -1, plObjRefMsg::kModifier), plRefFlags::kActiveRef); // Tell all the activators to notify us for (int i = 0; i < fCompPB->Count(kResponderActivators); i++) diff --git a/Sources/Tools/MaxComponent/plResponderGetComp.h b/Sources/Tools/MaxComponent/plResponderGetComp.h index 81be327f..665c5ec9 100644 --- a/Sources/Tools/MaxComponent/plResponderGetComp.h +++ b/Sources/Tools/MaxComponent/plResponderGetComp.h @@ -39,7 +39,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com Mead, WA 99021 *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "max.h" #include diff --git a/Sources/Tools/MaxComponent/plResponderLink.cpp b/Sources/Tools/MaxComponent/plResponderLink.cpp index 7a9951c7..6b0ea760 100644 --- a/Sources/Tools/MaxComponent/plResponderLink.cpp +++ b/Sources/Tools/MaxComponent/plResponderLink.cpp @@ -249,7 +249,7 @@ plMessage *plResponderCmdLink::CreateMsg(plMaxNode* node, plErrorMsg *pErrMsg, I if ( !ageLinkInAnimName ) ageLinkInAnimName = kDefaultLinkInAnimName; - plLinkToAgeMsg *msg = TRACKED_NEW plLinkToAgeMsg; + plLinkToAgeMsg *msg = new plLinkToAgeMsg; msg->GetAgeLink()->SetLinkingRules( linkingRule ); msg->GetAgeLink()->SetSpawnPoint( plSpawnPointInfo( ageSpawnPtTitle, ageSpawnPtName ) ); msg->GetAgeLink()->GetAgeInfo()->SetAgeFilename( ageFilename ); @@ -490,7 +490,7 @@ plMessage *plResponderCmdEnable::CreateMsg(plMaxNode* node, plErrorMsg *pErrMsg, BOOL enable = pb->GetInt(kEnable); - plResponderEnableMsg *msg = TRACKED_NEW plResponderEnableMsg; + plResponderEnableMsg *msg = new plResponderEnableMsg; msg->fEnable = (enable != false); plMaxNodeBase *respondNode = (plMaxNodeBase*)pb->GetReferenceTarget(kEnableNode); @@ -559,7 +559,7 @@ plMessage *plResponderCmdPhysEnable::CreateMsg(plMaxNode* node, plErrorMsg *pErr BOOL enable = pb->GetInt(kEnable); - plEnableMsg* enableMsg = TRACKED_NEW plEnableMsg; + plEnableMsg* enableMsg = new plEnableMsg; enableMsg->SetCmd(plEnableMsg::kPhysical); enableMsg->SetCmd(enable ? plEnableMsg::kEnable : plEnableMsg::kDisable); enableMsg->AddReceiver(physNode->GetKey()); @@ -672,7 +672,7 @@ plMessage *plResponderCmdOneShot::CreateMsg(plMaxNode* node, plErrorMsg *pErrMsg if (!oneShotKey) throw "One-shot component didn't convert"; - plOneShotMsg *msg = TRACKED_NEW plOneShotMsg; + plOneShotMsg *msg = new plOneShotMsg; msg->AddReceiver(oneShotKey); return msg; } @@ -715,7 +715,7 @@ ParamBlockDesc2 *plResponderCmdNotify::GetDesc() plMessage *plResponderCmdNotify::CreateMsg(plMaxNode* node, plErrorMsg *pErrMsg, IParamBlock2 *pb) { - plNotifyMsg *msg = TRACKED_NEW plNotifyMsg; + plNotifyMsg *msg = new plNotifyMsg; msg->SetBCastFlag(plMessage::kNetPropagate, 0); msg->SetState(1.0); // set to positive state msg->AddCallbackEvent(1); // create an event record with callback @@ -825,7 +825,7 @@ plMessage *plResponderCmdDetectorEnable::CreateMsg(plMaxNode* node, plErrorMsg * // Just stuffing this in here because I'm lazy if (comp->ClassID() == CAM_REGION_CID) { - plEnableMsg* enableMsg = TRACKED_NEW plEnableMsg; + plEnableMsg* enableMsg = new plEnableMsg; enableMsg->SetCmd(plEnableMsg::kPhysical); enableMsg->SetCmd(enable ? plEnableMsg::kEnable : plEnableMsg::kDisable); @@ -835,7 +835,7 @@ plMessage *plResponderCmdDetectorEnable::CreateMsg(plMaxNode* node, plErrorMsg * return enableMsg; } - plEnableMsg *msg = TRACKED_NEW plEnableMsg; + plEnableMsg *msg = new plEnableMsg; msg->SetCmd(enable ? plEnableMsg::kEnable : plEnableMsg::kDisable); hsTArray keys; @@ -1018,7 +1018,7 @@ plMessage *plResponderCmdXRegion::CreateMsg(plMaxNode* node, plErrorMsg *pErrMsg { plExcludeRegionComponent *xComp = (plExcludeRegionComponent*)comp; - plExcludeRegionMsg *msg = TRACKED_NEW plExcludeRegionMsg; + plExcludeRegionMsg *msg = new plExcludeRegionMsg; int type = pb->GetInt(kXRegionType); switch (type) @@ -1098,7 +1098,7 @@ plMessage *plResponderCmdCamTransition::CreateMsg(plMaxNode* node, plErrorMsg *p throw "No Camera Specified"; hsBool fail = true; int count = pCamNode->NumAttachedComponents(); - for (UInt32 x = 0; x < count; x++) + for (uint32_t x = 0; x < count; x++) { plComponentBase *comp = ((plMaxNode*)pCamNode)->GetAttachedComponent(x); if (comp->ClassID() == AUTOCAM_CID || @@ -1115,7 +1115,7 @@ plMessage *plResponderCmdCamTransition::CreateMsg(plMaxNode* node, plErrorMsg *p if (fail) throw "Invalid Camera Specified"; - plCameraMsg* pMsg = TRACKED_NEW plCameraMsg; + plCameraMsg* pMsg = new plCameraMsg; pMsg->SetBCastFlag(plMessage::kBCastByType); if(pCamNode->CanConvert()) @@ -1127,7 +1127,7 @@ plMessage *plResponderCmdCamTransition::CreateMsg(plMaxNode* node, plErrorMsg *p pMsg->SetNewCam(((plMaxNode*)pCamNode)->GetSceneObject()->GetKey()); int count = ((plMaxNode*)pCamNode)->NumAttachedComponents(); - for (UInt32 x = 0; x < count; x++) + for (uint32_t x = 0; x < count; x++) { plComponentBase *comp = ((plMaxNode*)pCamNode)->GetAttachedComponent(x); if (comp->ClassID() == DEFAULTCAM_CID) @@ -1185,7 +1185,7 @@ const char *plResponderCmdCamForce::GetInstanceName(IParamBlock2 *pb) plMessage *plResponderCmdCamForce::CreateMsg(plMaxNode* node, plErrorMsg *pErrMsg, IParamBlock2 *pb) { - plCameraMsg* msg = TRACKED_NEW plCameraMsg; + plCameraMsg* msg = new plCameraMsg; msg->SetBCastFlag(plMessage::kBCastByType); msg->SetBCastFlag(plMessage::kNetPropagate, false); @@ -1241,9 +1241,9 @@ plMessage *plResponderCmdDelay::CreateMsg(plMaxNode* node, plErrorMsg *pErrMsg, { float time = pb->GetFloat(kDelayTime); - plTimerCallbackMsg *msg = TRACKED_NEW plTimerCallbackMsg; + plTimerCallbackMsg *msg = new plTimerCallbackMsg; msg->fTime = time; - msg->fID = UInt32(-1); + msg->fID = uint32_t(-1); return msg; } @@ -1253,7 +1253,7 @@ void plResponderCmdDelay::CreateWait(plMaxNode* node, plErrorMsg* pErrMsg, IPara plTimerCallbackMsg *timerMsg = plTimerCallbackMsg::ConvertNoRef(waitInfo.msg); hsAssert(timerMsg, "Somebody is crazy"); - if (timerMsg->fID != UInt32(-1)) + if (timerMsg->fID != uint32_t(-1)) { pErrMsg->Set(true, "Responder Delay", @@ -1380,7 +1380,7 @@ plMessage *plResponderCmdVisibility::CreateMsg(plMaxNode* node, plErrorMsg *pErr plMaxNode* visNode = (plMaxNode*)pb->GetINode(kVisibilityNode); if (visNode) { - plEnableMsg* msg = TRACKED_NEW plEnableMsg; + plEnableMsg* msg = new plEnableMsg; msg->SetCmd(plEnableMsg::kDrawable); int type = pb->GetInt(kVisibilityType); @@ -1551,7 +1551,7 @@ plMessage *plResponderCmdSubWorld::CreateMsg(plMaxNode* node, plErrorMsg *pErrMs break; } - plSubWorldMsg * swMsg = TRACKED_NEW plSubWorldMsg(nilKey, nilKey2, worldKey); + plSubWorldMsg * swMsg = new plSubWorldMsg(nilKey, nilKey2, worldKey); return swMsg; } @@ -1629,7 +1629,7 @@ const char *plResponderCmdFootSurface::GetInstanceName(IParamBlock2 *pb) plMessage *plResponderCmdFootSurface::CreateMsg(plMaxNode* node, plErrorMsg *pErrMsg, IParamBlock2 *pb) { - plArmatureEffectStateMsg* msg = TRACKED_NEW plArmatureEffectStateMsg; + plArmatureEffectStateMsg* msg = new plArmatureEffectStateMsg; msg->SetBCastFlag(plMessage::kPropagateToModifiers); msg->SetBCastFlag(plMessage::kNetPropagate); msg->fSurface = pb->GetInt(kSurface); @@ -1729,7 +1729,7 @@ plMessage *plResponderCmdMultistage::CreateMsg(plMaxNode* node, plErrorMsg *pErr plMaxNodeBase *targNode; if (compNode.GetCompAndNode(comp, targNode)) { - plNotifyMsg* msg = TRACKED_NEW plNotifyMsg; + plNotifyMsg* msg = new plNotifyMsg; msg->SetState(1.f); // Will actually be set to the player key at runtime diff --git a/Sources/Tools/MaxComponent/plResponderLink.h b/Sources/Tools/MaxComponent/plResponderLink.h index 39dd76d4..3402809f 100644 --- a/Sources/Tools/MaxComponent/plResponderLink.h +++ b/Sources/Tools/MaxComponent/plResponderLink.h @@ -39,7 +39,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com Mead, WA 99021 *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "plResponderCmd.h" #include "pnKeyedObject/plKey.h" diff --git a/Sources/Tools/MaxComponent/plResponderMtl.cpp b/Sources/Tools/MaxComponent/plResponderMtl.cpp index 6cc168f9..4feff3a5 100644 --- a/Sources/Tools/MaxComponent/plResponderMtl.cpp +++ b/Sources/Tools/MaxComponent/plResponderMtl.cpp @@ -337,8 +337,8 @@ plMessage *plResponderCmdMtl::CreateMsg(plMaxNode* node, plErrorMsg *pErrMsg, IP throw "No material specified"; const char *animName = pb->GetStr(kMtlAnim); - hsScalar begin=-1.f; - hsScalar end = -1.f; + float begin=-1.f; + float end = -1.f; SegmentMap *segMap = GetAnimSegmentMap(maxMtl, pErrMsg); @@ -374,7 +374,7 @@ plMessage *plResponderCmdMtl::CreateMsg(plMaxNode* node, plErrorMsg *pErrMsg, IP throw "Material animation key(s) not found"; } - plAnimCmdMsg *msg = TRACKED_NEW plAnimCmdMsg; + plAnimCmdMsg *msg = new plAnimCmdMsg; msg->AddReceivers(keys); switch (pb->GetInt(kMtlType)) @@ -462,7 +462,7 @@ void plResponderCmdMtl::CreateWait(plMaxNode* node, plErrorMsg* pErrMsg, IParamB if (animMsg) animMsg->SetCmd(plAnimCmdMsg::kAddCallbacks); - plEventCallbackMsg *eventMsg = TRACKED_NEW plEventCallbackMsg; + plEventCallbackMsg *eventMsg = new plEventCallbackMsg; eventMsg->AddReceiver(waitInfo.receiver); eventMsg->fRepeats = 0; eventMsg->fEvent = kStop; diff --git a/Sources/Tools/MaxComponent/plResponderWait.h b/Sources/Tools/MaxComponent/plResponderWait.h index ce6f6d53..28bf797f 100644 --- a/Sources/Tools/MaxComponent/plResponderWait.h +++ b/Sources/Tools/MaxComponent/plResponderWait.h @@ -39,7 +39,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com Mead, WA 99021 *==LICENSE==*/ -#include "hsWindows.h" // Damn, had to pass in a HWND + // Damn, had to pass in a HWND #include class ClassDesc2; class IParamBlock2; diff --git a/Sources/Tools/MaxComponent/plSeekPoint.cpp b/Sources/Tools/MaxComponent/plSeekPoint.cpp index d05a396a..47194a31 100644 --- a/Sources/Tools/MaxComponent/plSeekPoint.cpp +++ b/Sources/Tools/MaxComponent/plSeekPoint.cpp @@ -106,11 +106,11 @@ plSeekPointComponent::plSeekPointComponent() hsBool plSeekPointComponent::Convert(plMaxNode *node, plErrorMsg *pErrMsg) { const char *objName = node->GetName(); - char *name = TRACKED_NEW char[strlen(objName) + 1]; + char *name = new char[strlen(objName) + 1]; strcpy(name, objName); - plSeekPointMod* pointMod = TRACKED_NEW plSeekPointMod(name); + plSeekPointMod* pointMod = new plSeekPointMod(name); node->AddModifier(pointMod, IGetUniqueName(node)); return true; } diff --git a/Sources/Tools/MaxComponent/plShadowComponents.cpp b/Sources/Tools/MaxComponent/plShadowComponents.cpp index 3f8f0de5..4f41600f 100644 --- a/Sources/Tools/MaxComponent/plShadowComponents.cpp +++ b/Sources/Tools/MaxComponent/plShadowComponents.cpp @@ -49,7 +49,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "MaxMain/plMaxNode.h" #include "MaxExport/plExportProgressBar.h" -#include "hsTypes.h" +#include "HeadSpin.h" #include "plShadowComponents.h" @@ -67,7 +67,7 @@ void DummyCodeIncludeFuncShadow() { } -static UInt16 QualityBitToMask(int q) { return ~((1 << q) - 1); } +static uint16_t QualityBitToMask(int q) { return ~((1 << q) - 1); } #define WM_ROLLOUT_OPEN WM_USER+1 static const int kNumQualities = 4; @@ -207,7 +207,7 @@ hsBool plShadowCastComponent::Convert(plMaxNode *node, plErrorMsg *pErrMsg) const float kBoostPercentToAbs = 1.e-2f; if( !fCaster ) { - fCaster = TRACKED_NEW plShadowCaster; + fCaster = new plShadowCaster; plLoadMask lm(QualityBitToMask(fCompPB->GetInt(kQuality)), QualityBitToMask(0)); hsgResMgr::ResMgr()->NewKey(IGetUniqueName(node), fCaster, node->GetLocation(), lm); fCaster->SetSelfShadow(fCompPB->GetInt(kSelfShadow)); @@ -260,7 +260,7 @@ hsBool plShadowCastComponent::AddShadowCastModifier(plSceneObject* so, plShadowC } // Okay, we're clear, just add via notify. - hsgResMgr::ResMgr()->AddViaNotify(caster->GetKey(), TRACKED_NEW plObjRefMsg(so->GetKey(), plRefMsg::kOnCreate, -1, plObjRefMsg::kModifier), plRefFlags::kActiveRef); + hsgResMgr::ResMgr()->AddViaNotify(caster->GetKey(), new plObjRefMsg(so->GetKey(), plRefMsg::kOnCreate, -1, plObjRefMsg::kModifier), plRefFlags::kActiveRef); return true; } @@ -415,7 +415,7 @@ hsBool plShadowLightComponent::Convert(plMaxNode *node, plErrorMsg *pErrMsg) hsBool plShadowLightComponent::IAddDirectMaster(plMaxNode* node, plSceneObject* so) { - plDirectShadowMaster* directMaster = TRACKED_NEW plDirectShadowMaster; + plDirectShadowMaster* directMaster = new plDirectShadowMaster; plLoadMask lm(QualityBitToMask(fCompPB->GetInt(kQuality)), QualityBitToMask(0)); hsgResMgr::ResMgr()->NewKey(IGetUniqueName(node), directMaster, node->GetLocation(), lm); @@ -428,13 +428,13 @@ hsBool plShadowLightComponent::IAddDirectMaster(plMaxNode* node, plSceneObject* directMaster->SetProperty(plShadowMaster::kSelfShadow, fCompPB->GetInt(kSelfShadow)); - hsgResMgr::ResMgr()->AddViaNotify(directMaster->GetKey(), TRACKED_NEW plObjRefMsg(so->GetKey(), plRefMsg::kOnCreate, -1, plObjRefMsg::kInterface), plRefFlags::kActiveRef); + hsgResMgr::ResMgr()->AddViaNotify(directMaster->GetKey(), new plObjRefMsg(so->GetKey(), plRefMsg::kOnCreate, -1, plObjRefMsg::kInterface), plRefFlags::kActiveRef); return true; } hsBool plShadowLightComponent::IAddPointMaster(plMaxNode* node, plSceneObject* so) { - plPointShadowMaster* pointMaster = TRACKED_NEW plPointShadowMaster; + plPointShadowMaster* pointMaster = new plPointShadowMaster; plLoadMask lm(QualityBitToMask(fCompPB->GetInt(kQuality)), QualityBitToMask(0)); hsgResMgr::ResMgr()->NewKey(IGetUniqueName(node), pointMaster, node->GetLocation(), lm); @@ -447,7 +447,7 @@ hsBool plShadowLightComponent::IAddPointMaster(plMaxNode* node, plSceneObject* s pointMaster->SetProperty(plShadowMaster::kSelfShadow, fCompPB->GetInt(kSelfShadow)); - hsgResMgr::ResMgr()->AddViaNotify(pointMaster->GetKey(), TRACKED_NEW plObjRefMsg(so->GetKey(), plRefMsg::kOnCreate, -1, plObjRefMsg::kInterface), plRefFlags::kActiveRef); + hsgResMgr::ResMgr()->AddViaNotify(pointMaster->GetKey(), new plObjRefMsg(so->GetKey(), plRefMsg::kOnCreate, -1, plObjRefMsg::kInterface), plRefFlags::kActiveRef); return true; } diff --git a/Sources/Tools/MaxComponent/plSmoothComponent.cpp b/Sources/Tools/MaxComponent/plSmoothComponent.cpp index 83878357..88840ce7 100644 --- a/Sources/Tools/MaxComponent/plSmoothComponent.cpp +++ b/Sources/Tools/MaxComponent/plSmoothComponent.cpp @@ -48,7 +48,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "MaxMain/plMaxNode.h" -#include "hsTypes.h" +#include "HeadSpin.h" #include "plDrawable/plDrawableSpans.h" @@ -166,8 +166,8 @@ hsBool plSmoothComponent::IGetSpans(plErrorMsg* pErrMsg, hsTArrayGetNumDrawables(); iDraw++ ) { plDrawableSpans* dr = plDrawableSpans::ConvertNoRef(di->GetDrawable(iDraw)); @@ -221,8 +221,8 @@ hsBool plSmoothComponent::IDoSmooth(plErrorMsg* pErrMsg, hsTArray& plSmoothBaseComponent::GetSpans(plErrorMsg* p { if( !fSpans.GetCount() ) { - UInt32 count = NumTargets(); - UInt32 i; + uint32_t count = NumTargets(); + uint32_t i; hsTArray spans; for( i = 0; i < count; i++ ) @@ -720,8 +720,8 @@ hsBool plSmoothSnapComponent::IGetDstSpans(plErrorMsg* pErrMsg, hsTArray geoSpans; spans.SetCount(0); - UInt32 count = NumTargets(); - UInt32 i; + uint32_t count = NumTargets(); + uint32_t i; for( i = 0; i < count; i++ ) { plMaxNode *node = (plMaxNode*)GetTarget(i); @@ -792,8 +792,8 @@ hsBool plSmoothSnapComponent::IDoSmooth(plErrorMsg* pErrMsg, hsTArrayAddViaNotify(subKey, TRACKED_NEW plGenRefMsg(masterKey, plRefMsg::kOnCreate, 0, plSoftVolume::kSubVolume), plRefFlags::kActiveRef); + hsgResMgr::ResMgr()->AddViaNotify(subKey, new plGenRefMsg(masterKey, plRefMsg::kOnCreate, 0, plSoftVolume::kSubVolume), plRefFlags::kActiveRef); } plKey plSoftVolBaseComponent::ISetVolumeKey(plSoftVolume* vol) @@ -265,7 +265,7 @@ plKey plSoftVolBaseComponent::IInvertVolume(plKey subKey) if( !subKey ) return nil; - plSoftVolumeInvert* invert = TRACKED_NEW plSoftVolumeInvert; + plSoftVolumeInvert* invert = new plSoftVolumeInvert; plKey invertKey = ISetVolumeKey(invert); IAddSubVolume(invertKey, subKey); @@ -454,7 +454,7 @@ plKey plSoftVolComponent::ICreateSoftVolume() return fSoftKey = ICreateFromNode(GetTarget(0)); } - plSoftVolumeUnion* compound = TRACKED_NEW plSoftVolumeUnion; + plSoftVolumeUnion* compound = new plSoftVolumeUnion; fSoftKey = ISetVolumeKey(compound); int i; @@ -507,7 +507,7 @@ plKey plSoftVolComponent::ICreateFromDummyObject(plMaxNodeBase* pNode, Object* o DummyObject* dummy = (DummyObject*)obj; Box3 bnd = dummy->GetBox(); - plParallelIsect* isect = TRACKED_NEW plParallelIsect; + plParallelIsect* isect = new plParallelIsect; isect->SetNumPlanes(3); hsMatrix44 v2l = pNode->GetVertToLocal44(); @@ -539,7 +539,7 @@ plKey plSoftVolComponent::ICreateFromTriObject(plMaxNodeBase* pNode, Object* obj hsMatrix44 v2l = pNode->GetVertToLocal44(); hsMatrix44 l2v = pNode->GetLocalToVert44(); - plConvexIsect* isect = TRACKED_NEW plConvexIsect; + plConvexIsect* isect = new plConvexIsect; int i; for( i = 0; i < mesh->getNumFaces(); i++ ) { @@ -574,7 +574,7 @@ plKey plSoftVolComponent::ISetFromIsect(plMaxNodeBase* pNode, plVolumeIsect* ise { isect->SetTransform(pNode->GetLocalToWorld44(), pNode->GetWorldToLocal44()); - plSoftVolumeSimple* simple = TRACKED_NEW plSoftVolumeSimple; + plSoftVolumeSimple* simple = new plSoftVolumeSimple; simple->SetVolume(isect); simple->SetDistance(fCompPB->GetFloat(kSoftDistance)); @@ -588,7 +588,7 @@ plKey plSoftVolComponent::ISetFromIsect(plMaxNodeBase* pNode, plVolumeIsect* ise plKey retVal = ISetVolumeKey(simple); - hsgResMgr::ResMgr()->AddViaNotify(simple->GetKey(), TRACKED_NEW plObjRefMsg(sceneObj->GetKey(), plRefMsg::kOnCreate, -1, plObjRefMsg::kInterface), plRefFlags::kActiveRef); + hsgResMgr::ResMgr()->AddViaNotify(simple->GetKey(), new plObjRefMsg(sceneObj->GetKey(), plRefMsg::kOnCreate, -1, plObjRefMsg::kInterface), plRefFlags::kActiveRef); return retVal; } @@ -732,7 +732,7 @@ plKey plSoftVolUnionComponent::ICreateSoftVolume() if( numSubs < 2 ) return fSoftKey = plSoftVolBaseComponent::GetSoftComponent(fCompPB->GetINode(kSubVolumes, 0, 0))->GetSoftVolume(); - plSoftVolumeUnion* compound = TRACKED_NEW plSoftVolumeUnion; + plSoftVolumeUnion* compound = new plSoftVolumeUnion; fSoftKey = ISetVolumeKey(compound); int i; @@ -893,7 +893,7 @@ plKey plSoftVolIsectComponent::ICreateSoftVolume() if( numSubs < 2 ) return fSoftKey = plSoftVolBaseComponent::GetSoftComponent(fCompPB->GetINode(kSubVolumes, 0, 0))->GetSoftVolume(); - plSoftVolumeIntersect* compound = TRACKED_NEW plSoftVolumeIntersect; + plSoftVolumeIntersect* compound = new plSoftVolumeIntersect; fSoftKey = ISetVolumeKey(compound); int i; @@ -1129,7 +1129,7 @@ hsBool plLightRegionComponent::Convert(plMaxNode *node, plErrorMsg *errMsg) if( !softKey ) return true; - hsgResMgr::ResMgr()->AddViaNotify(softKey, TRACKED_NEW plGenRefMsg(li->GetKey(), plRefMsg::kOnCreate, 0, plLightInfo::kSoftVolume), plRefFlags::kActiveRef); + hsgResMgr::ResMgr()->AddViaNotify(softKey, new plGenRefMsg(li->GetKey(), plRefMsg::kOnCreate, 0, plLightInfo::kSoftVolume), plRefFlags::kActiveRef); return true; } @@ -1298,7 +1298,7 @@ void plVisRegionComponent::ICheckVisRegion(const plLocation& loc) if( !softKey ) return; - fVisReg = TRACKED_NEW plVisRegion; + fVisReg = new plVisRegion; plKey key = hsgResMgr::ResMgr()->NewKey(GetINode()->GetName(), fVisReg, loc); @@ -1309,7 +1309,7 @@ void plVisRegionComponent::ICheckVisRegion(const plLocation& loc) fVisReg->SetProperty(plVisRegion::kReplaceNormal, true); fVisReg->SetProperty(plVisRegion::kDisableNormal, disableNormal); - plGenRefMsg* refMsg = TRACKED_NEW plGenRefMsg(fVisReg->GetKey(), plRefMsg::kOnCreate, 0, plVisRegion::kRefRegion); + plGenRefMsg* refMsg = new plGenRefMsg(fVisReg->GetKey(), plRefMsg::kOnCreate, 0, plVisRegion::kRefRegion); hsgResMgr::ResMgr()->SendRef(softKey, refMsg, plRefFlags::kActiveRef); } } @@ -1338,21 +1338,21 @@ hsBool plVisRegionComponent::Convert(plMaxNode *node, plErrorMsg *errMsg) return true; if( di ) - hsgResMgr::ResMgr()->AddViaNotify(fVisReg->GetKey(), TRACKED_NEW plGenRefMsg(di->GetKey(), plRefMsg::kOnCreate, 0, plDrawInterface::kRefVisRegion), plRefFlags::kActiveRef); + hsgResMgr::ResMgr()->AddViaNotify(fVisReg->GetKey(), new plGenRefMsg(di->GetKey(), plRefMsg::kOnCreate, 0, plDrawInterface::kRefVisRegion), plRefFlags::kActiveRef); if( occ ) { - hsgResMgr::ResMgr()->AddViaNotify(fVisReg->GetKey(), TRACKED_NEW plGenRefMsg(occ->GetKey(), plRefMsg::kOnCreate, 0, plOccluder::kRefVisRegion), plRefFlags::kActiveRef); + hsgResMgr::ResMgr()->AddViaNotify(fVisReg->GetKey(), new plGenRefMsg(occ->GetKey(), plRefMsg::kOnCreate, 0, plOccluder::kRefVisRegion), plRefFlags::kActiveRef); } if( li ) { - hsgResMgr::ResMgr()->AddViaNotify(fVisReg->GetKey(), TRACKED_NEW plGenRefMsg(li->GetKey(), plRefMsg::kOnCreate, 0, plLightInfo::kVisRegion), plRefFlags::kActiveRef); + hsgResMgr::ResMgr()->AddViaNotify(fVisReg->GetKey(), new plGenRefMsg(li->GetKey(), plRefMsg::kOnCreate, 0, plLightInfo::kVisRegion), plRefFlags::kActiveRef); } if( !(di || occ || li) ) { - hsgResMgr::ResMgr()->AddViaNotify(fVisReg->GetKey(), TRACKED_NEW plObjRefMsg(obj->GetKey(), plRefMsg::kOnCreate, -1, plObjRefMsg::kInterface), plRefFlags::kActiveRef); + hsgResMgr::ResMgr()->AddViaNotify(fVisReg->GetKey(), new plObjRefMsg(obj->GetKey(), plRefMsg::kOnCreate, -1, plObjRefMsg::kInterface), plRefFlags::kActiveRef); } return true; @@ -1464,14 +1464,14 @@ hsBool plRelevanceRegionComponent::Convert(plMaxNode *node, plErrorMsg *errMsg) if( !softKey ) return true; - fRegion = TRACKED_NEW plRelevanceRegion; + fRegion = new plRelevanceRegion; plKey key = hsgResMgr::ResMgr()->NewKey(GetINode()->GetName(), fRegion, node->GetLocation()); - plGenRefMsg* refMsg = TRACKED_NEW plGenRefMsg(fRegion->GetKey(), plRefMsg::kOnCreate, 0, 0); + plGenRefMsg* refMsg = new plGenRefMsg(fRegion->GetKey(), plRefMsg::kOnCreate, 0, 0); hsgResMgr::ResMgr()->SendRef(softKey, refMsg, plRefFlags::kActiveRef); } - hsgResMgr::ResMgr()->AddViaNotify(fRegion->GetKey(), TRACKED_NEW plObjRefMsg(obj->GetKey(), plRefMsg::kOnCreate, 0, plObjRefMsg::kInterface), plRefFlags::kActiveRef); + hsgResMgr::ResMgr()->AddViaNotify(fRegion->GetKey(), new plObjRefMsg(obj->GetKey(), plRefMsg::kOnCreate, 0, plObjRefMsg::kInterface), plRefFlags::kActiveRef); return true; } @@ -1532,16 +1532,16 @@ hsBool plEffVisSetComponent::Convert(plMaxNode *node, plErrorMsg *errMsg) return false; if( di ) - hsgResMgr::ResMgr()->AddViaNotify(fVisReg->GetKey(), TRACKED_NEW plGenRefMsg(di->GetKey(), plRefMsg::kOnCreate, 0, plDrawInterface::kRefVisRegion), plRefFlags::kActiveRef); + hsgResMgr::ResMgr()->AddViaNotify(fVisReg->GetKey(), new plGenRefMsg(di->GetKey(), plRefMsg::kOnCreate, 0, plDrawInterface::kRefVisRegion), plRefFlags::kActiveRef); if( occ ) { - hsgResMgr::ResMgr()->AddViaNotify(fVisReg->GetKey(), TRACKED_NEW plGenRefMsg(occ->GetKey(), plRefMsg::kOnCreate, 0, plOccluder::kRefVisRegion), plRefFlags::kActiveRef); + hsgResMgr::ResMgr()->AddViaNotify(fVisReg->GetKey(), new plGenRefMsg(occ->GetKey(), plRefMsg::kOnCreate, 0, plOccluder::kRefVisRegion), plRefFlags::kActiveRef); } if( li ) { - hsgResMgr::ResMgr()->AddViaNotify(fVisReg->GetKey(), TRACKED_NEW plGenRefMsg(li->GetKey(), plRefMsg::kOnCreate, 0, plLightInfo::kVisRegion), plRefFlags::kActiveRef); + hsgResMgr::ResMgr()->AddViaNotify(fVisReg->GetKey(), new plGenRefMsg(li->GetKey(), plRefMsg::kOnCreate, 0, plLightInfo::kVisRegion), plRefFlags::kActiveRef); } return true; @@ -1560,7 +1560,7 @@ plVisRegion* plEffVisSetComponent::GetVisRegion(plMaxNode* node) { if( !fVisReg ) { - fVisReg = TRACKED_NEW plVisRegion; + fVisReg = new plVisRegion; plKey key = hsgResMgr::ResMgr()->NewKey(GetINode()->GetName(), fVisReg, node->GetLocation()); fVisReg->SetProperty(plVisRegion::kIsNot, false); diff --git a/Sources/Tools/MaxComponent/plTemplateComponent.cpp b/Sources/Tools/MaxComponent/plTemplateComponent.cpp index dd32d3de..396d1fba 100644 --- a/Sources/Tools/MaxComponent/plTemplateComponent.cpp +++ b/Sources/Tools/MaxComponent/plTemplateComponent.cpp @@ -102,8 +102,8 @@ plTemplateComponent::plTemplateComponent() const char* plTemplateComponent::IGetAgeName(plMaxNode *node) { - UInt32 numComps = node->NumAttachedComponents(); - for (UInt32 i = 0; i < numComps; i++) + uint32_t numComps = node->NumAttachedComponents(); + for (uint32_t i = 0; i < numComps; i++) { plComponentBase* comp = node->GetAttachedComponent(i); if (comp->ClassID() == PAGEINFO_CID) @@ -128,7 +128,7 @@ hsBool plTemplateComponent::SetupProperties(plMaxNode *node, plErrorMsg *pErrMsg #if 0 const char *templateName = node->GetName(); - plKey roomKey = plPluginResManager::ResMgr()->NameToLoc(ageName, "District", "BuiltIn", (UInt32)-1); + plKey roomKey = plPluginResManager::ResMgr()->NameToLoc(ageName, "District", "BuiltIn", (uint32_t)-1); // Set this object and all its children to be in the special template age node->SetRoomKey(roomKey); @@ -224,7 +224,7 @@ hsBool plSpawnComponent::Convert(plMaxNode *node, plErrorMsg *pErrMsg) if (!templateName) return false; - plCloneSpawnModifier* mod = TRACKED_NEW plCloneSpawnModifier; + plCloneSpawnModifier* mod = new plCloneSpawnModifier; mod->SetExportTime(); mod->SetTemplateName(templateName); node->AddModifier(mod, IGetUniqueName(node)); diff --git a/Sources/Tools/MaxComponent/plTypesComponents.cpp b/Sources/Tools/MaxComponent/plTypesComponents.cpp index 5ca707ed..4d986e23 100644 --- a/Sources/Tools/MaxComponent/plTypesComponents.cpp +++ b/Sources/Tools/MaxComponent/plTypesComponents.cpp @@ -113,7 +113,7 @@ hsBool plStartingPointComponent::SetupProperties(plMaxNode* node, plErrorMsg* pE } hsBool plStartingPointComponent::Convert(plMaxNode *node, plErrorMsg *pErrMsg) { - plSpawnModifier* pSpawn = TRACKED_NEW plSpawnModifier; + plSpawnModifier* pSpawn = new plSpawnModifier; node->AddModifier(pSpawn, IGetUniqueName(node)); return true; } @@ -332,7 +332,7 @@ hsBool plVehicleComponent::PreConvert(plMaxNode *pNode, plErrorMsg *pErrMsg) if (!IIsValid()) return false; - fMod = TRACKED_NEW plVehicleModifier; + fMod = new plVehicleModifier; plKey modKey = pNode->AddModifier(fMod, IGetUniqueName(pNode)); plMaxNode* detectorNode = (plMaxNode*)fCompPB->GetINode(kVehicleDriveDet); @@ -459,7 +459,7 @@ hsBool plMaintainersMarkerComponent::SetupProperties(plMaxNode* node, plErrorMsg } hsBool plMaintainersMarkerComponent::Convert(plMaxNode *node, plErrorMsg *pErrMsg) { - plMaintainersMarkerModifier* pSpawn = TRACKED_NEW plMaintainersMarkerModifier; + plMaintainersMarkerModifier* pSpawn = new plMaintainersMarkerModifier; pSpawn->SetCalibrated(fCompPB->GetInt(kCalibrated)); node->AddModifier(pSpawn, IGetUniqueName(node)); return true; @@ -735,7 +735,7 @@ plKey plGameMarkerComponent::IGetAnimKey(int nodeID, int compID) hsBool plGameMarkerComponent::Convert(plMaxNode *node, plErrorMsg *pErrMsg) { - plGameMarkerModifier* markerMod = TRACKED_NEW plGameMarkerModifier; + plGameMarkerModifier* markerMod = new plGameMarkerModifier; plKey greenKey = IGetMtlAnimKey(kMarkerGreenAnim, node); plKey redKey = IGetMtlAnimKey(kMarkerRedAnim, node); diff --git a/Sources/Tools/MaxComponent/plVolumeGadgetComponent.cpp b/Sources/Tools/MaxComponent/plVolumeGadgetComponent.cpp index 838ffad6..5f0d0a34 100644 --- a/Sources/Tools/MaxComponent/plVolumeGadgetComponent.cpp +++ b/Sources/Tools/MaxComponent/plVolumeGadgetComponent.cpp @@ -314,7 +314,7 @@ hsBool plVolumeGadgetComponent::SetupProperties(plMaxNode *node, plErrorMsg *pEr // physProps->SetAllowLOS(true, node, pErrMsg); physProps->SetGroup(plSimDefs::kGroupDetector, node, pErrMsg); - UInt32 reportOn = fCompPB->GetInt(kVolumeReportOn); + uint32_t reportOn = fCompPB->GetInt(kVolumeReportOn); physProps->SetReportGroup(reportOn, node, pErrMsg); return true; @@ -329,11 +329,11 @@ hsBool plVolumeGadgetComponent::PreConvert(plMaxNode *node, plErrorMsg *pErrMsg) // Create and register the VolumeGadget's logic component if(fCompPB->GetInt(kVolumeGadgetEnter) || fCompPB->GetInt(kVolumeTriggerOnFacing)) { - plLogicModifier *logic = TRACKED_NEW plLogicModifier; + plLogicModifier *logic = new plLogicModifier; char tmpName[256]; sprintf(tmpName, "%s_Enter", IGetUniqueName(node)); plKey logicKey = hsgResMgr::ResMgr()->NewKey(tmpName, logic, node->GetLocation()); - hsgResMgr::ResMgr()->AddViaNotify(logicKey, TRACKED_NEW plObjRefMsg(obj->GetKey(), plRefMsg::kOnCreate, -1, plObjRefMsg::kModifier), plRefFlags::kActiveRef); + hsgResMgr::ResMgr()->AddViaNotify(logicKey, new plObjRefMsg(obj->GetKey(), plRefMsg::kOnCreate, -1, plObjRefMsg::kModifier), plRefFlags::kActiveRef); fLogicModKeys[node] = logicKey; if (fCompPB->GetInt(kVolumeOneShot)) @@ -344,11 +344,11 @@ hsBool plVolumeGadgetComponent::PreConvert(plMaxNode *node, plErrorMsg *pErrMsg) if(fCompPB->GetInt(kVolumeGadgetExit)) { - plLogicModifier *logic = TRACKED_NEW plLogicModifier; + plLogicModifier *logic = new plLogicModifier; char tmpName[256]; sprintf(tmpName, "%s_Exit", IGetUniqueName(node)); plKey logicKey = hsgResMgr::ResMgr()->NewKey(tmpName, logic, node->GetLocation()); - hsgResMgr::ResMgr()->AddViaNotify(logicKey, TRACKED_NEW plObjRefMsg(obj->GetKey(), plRefMsg::kOnCreate, -1, plObjRefMsg::kModifier), plRefFlags::kActiveRef); + hsgResMgr::ResMgr()->AddViaNotify(logicKey, new plObjRefMsg(obj->GetKey(), plRefMsg::kOnCreate, -1, plObjRefMsg::kModifier), plRefFlags::kActiveRef); fLogicModOutKeys[node] = logicKey; if (fCompPB->GetInt(kVolumeOneShot)) @@ -385,7 +385,7 @@ void plVolumeGadgetComponent::ICreateConditions(plMaxNode* node, plErrorMsg* err plDetectorModifier* detector = nil; if (enter && fCompPB->GetInt(kVolumeTriggerOnFacing)) { - plObjectInVolumeAndFacingDetector* newDetector = TRACKED_NEW plObjectInVolumeAndFacingDetector; + plObjectInVolumeAndFacingDetector* newDetector = new plObjectInVolumeAndFacingDetector; int deg = fCompPB->GetInt(kVolumeDegrees); if (deg > 180) @@ -398,7 +398,7 @@ void plVolumeGadgetComponent::ICreateConditions(plMaxNode* node, plErrorMsg* err detector = newDetector; } else - detector = TRACKED_NEW plObjectInVolumeDetector; + detector = new plObjectInVolumeDetector; const char* prefix = "Exit"; if (enter) @@ -407,15 +407,15 @@ void plVolumeGadgetComponent::ICreateConditions(plMaxNode* node, plErrorMsg* err // Register the detector sprintf(tmpName, "%s_%s", IGetUniqueName(node), prefix); plKey detectorKey = hsgResMgr::ResMgr()->NewKey(tmpName, detector, loc); - hsgResMgr::ResMgr()->AddViaNotify(detectorKey, TRACKED_NEW plObjRefMsg(obj->GetKey(), plRefMsg::kOnCreate, -1, plObjRefMsg::kModifier), plRefFlags::kActiveRef); + hsgResMgr::ResMgr()->AddViaNotify(detectorKey, new plObjRefMsg(obj->GetKey(), plRefMsg::kOnCreate, -1, plObjRefMsg::kModifier), plRefFlags::kActiveRef); plVolumeSensorConditionalObject* boxCond=nil; if((fCompPB->GetInt(kSkipServerArbitration)==0)) {//we want server arbitration - boxCond = TRACKED_NEW plVolumeSensorConditionalObject; + boxCond = new plVolumeSensorConditionalObject; } else { - boxCond = TRACKED_NEW plVolumeSensorConditionalObjectNoArbitration; + boxCond = new plVolumeSensorConditionalObjectNoArbitration; } sprintf(tmpName, "%s_%s", IGetUniqueName(node), prefix); plKey boxKey = hsgResMgr::ResMgr()->NewKey(tmpName, boxCond, loc); diff --git a/Sources/Tools/MaxComponent/plWaterComponent.cpp b/Sources/Tools/MaxComponent/plWaterComponent.cpp index c547f745..a8138602 100644 --- a/Sources/Tools/MaxComponent/plWaterComponent.cpp +++ b/Sources/Tools/MaxComponent/plWaterComponent.cpp @@ -54,7 +54,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "plWaterComponent.h" #include "plSoftVolumeComponent.h" -#include "hsTypes.h" +#include "HeadSpin.h" #include "plTweak.h" #include "plDrawable/plWaveSetBase.h" @@ -71,7 +71,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "plScene/plVisRegion.h" static const float kPercentToFrac(1.e-2f); -static const float kDegreeToRad(hsScalarPI/180.f); +static const float kDegreeToRad(M_PI/180.f); // Preliminary setup bookkeeping @@ -411,17 +411,17 @@ void plWaterComponent::CheckForObsoleteParams() // SpecEnd = kEnvRadius * 2.f // Okay, here we go. - hsScalar dispersion = fCompPB->GetFloat(kDispersion) / 100.f; - plConst(hsScalar) kMinAng(5.f); - plConst(hsScalar) kMaxAng(180.f); + float dispersion = fCompPB->GetFloat(kDispersion) / 100.f; + plConst(float) kMinAng(5.f); + plConst(float) kMaxAng(180.f); - hsScalar angleDev = kMinAng + dispersion * (kMaxAng - kMinAng); + float angleDev = kMinAng + dispersion * (kMaxAng - kMinAng); fCompPB->SetValue(kGeoAngleDev, TimeValue(0), angleDev); fCompPB->SetValue(kTexAngleDev, TimeValue(0), angleDev); - hsScalar windSpeed = fCompPB->GetFloat(kWindSpeed); - const hsScalar kGravConst(32.f); // ft/s^2 - hsScalar waveLen = windSpeed * windSpeed / kGravConst; + float windSpeed = fCompPB->GetFloat(kWindSpeed); + const float kGravConst(32.f); // ft/s^2 + float waveLen = windSpeed * windSpeed / kGravConst; waveLen /= 2.f; if( waveLen < 1.f ) waveLen = 1.f; @@ -429,14 +429,14 @@ void plWaterComponent::CheckForObsoleteParams() fCompPB->SetValue(kGeoMaxLen, TimeValue(0), waveLen*2.f); fCompPB->SetValue(kGeoAmpOverLen, TimeValue(0), 10.f); - hsScalar rippleScale = fCompPB->GetFloat(kRippleScale); + float rippleScale = fCompPB->GetFloat(kRippleScale); fCompPB->SetValue(kTexMinLen, TimeValue(0), 4.f / 256.f * rippleScale); fCompPB->SetValue(kTexMaxLen, TimeValue(0), 32.f / 256.f * rippleScale); - hsScalar amp = 0.01f; - hsScalar specMute = 0.5f; + float amp = 0.01f; + float specMute = 0.5f; if( windSpeed < 15.f ) { - hsScalar p = windSpeed / 15.f; + float p = windSpeed / 15.f; amp += p * (0.1f - 0.01f); specMute += (1-p)* 0.5f; @@ -446,9 +446,9 @@ void plWaterComponent::CheckForObsoleteParams() fCompPB->SetValue(kNoise, TimeValue(0), 50.f); - hsScalar envRad = fCompPB->GetFloat(kEnvRadius); - hsScalar specStart = envRad / 2.f; - hsScalar specEnd = envRad * 2.f; + float envRad = fCompPB->GetFloat(kEnvRadius); + float specStart = envRad / 2.f; + float specEnd = envRad * 2.f; fCompPB->SetValue(kSpecStart, TimeValue(0), specStart); fCompPB->SetValue(kSpecEnd, TimeValue(0), specEnd); @@ -512,7 +512,7 @@ hsBool plWaterComponent::Convert(plMaxNode* node, plErrorMsg* pErrMsg) if( !fWaveSet ) return true; - plObjRefMsg* refMsg = TRACKED_NEW plObjRefMsg(node->GetKey(), plRefMsg::kOnRequest, -1, plObjRefMsg::kModifier); + plObjRefMsg* refMsg = new plObjRefMsg(node->GetKey(), plRefMsg::kOnRequest, -1, plObjRefMsg::kModifier); hsgResMgr::ResMgr()->AddViaNotify(fWaveSet->GetKey(), refMsg, plRefFlags::kActiveRef); return true; @@ -558,16 +558,16 @@ hsBool plWaterComponent::IReadEnvObject(plMaxNode* node, plErrorMsg* pErrMsg, pl plDynamicEnvMap* env = plEnvMapComponent::GetEnvMap((plMaxNode*)ref); if( !env ) { - UInt32 size = fCompPB->GetInt(kEnvSize); - UInt32 i; + uint32_t size = fCompPB->GetInt(kEnvSize); + uint32_t i; for( i = 9; i > 5; i-- ) { if( (1UL << i) <= size ) break; } - size = UInt32(1 << i); + size = uint32_t(1 << i); - env = TRACKED_NEW plDynamicEnvMap(size, size, 32); + env = new plDynamicEnvMap(size, size, 32); hsgResMgr::ResMgr()->NewKey(ref->GetName(), env, node->GetLocation(), node->GetLoadMask()); Point3 pos = ref->GetNodeTM(TimeValue(0)).GetTrans(); @@ -584,7 +584,7 @@ hsBool plWaterComponent::IReadEnvObject(plMaxNode* node, plErrorMsg* pErrMsg, pl fWaveSet->SetEnvSize(env->GetWidth()); - plGenRefMsg* refMsg = TRACKED_NEW plGenRefMsg(fWaveSet->GetKey(), plRefMsg::kOnCreate, -1, plWaveSet7::kRefEnvMap); + plGenRefMsg* refMsg = new plGenRefMsg(fWaveSet->GetKey(), plRefMsg::kOnCreate, -1, plWaveSet7::kRefEnvMap); hsgResMgr::ResMgr()->SendRef(env->GetKey(), refMsg, plRefFlags::kActiveRef); ws.fEnvRadius = fCompPB->GetFloat(kEnvRadius); @@ -614,7 +614,7 @@ hsBool plWaterComponent::IMakeWaveSet(plMaxNode* node, plErrorMsg* pErrMsg) { // Go ahead and create the WaveSet modifier. There will be just // one created by this component, everyone has to share. - fWaveSet = TRACKED_NEW plWaveSet7; + fWaveSet = new plWaveSet7; hsgResMgr::ResMgr()->NewKey( IGetUniqueName(node), fWaveSet, node->GetLocation(), node->GetLoadMask()); // Set up the parameters @@ -685,7 +685,7 @@ hsBool plWaterComponent::IMakeWaveSet(plMaxNode* node, plErrorMsg* pErrMsg) return true; } -hsScalar plWaterComponent::IGetWaterHeight() +float plWaterComponent::IGetWaterHeight() { plMaxNodeBase* node = nil; @@ -703,7 +703,7 @@ hsScalar plWaterComponent::IGetWaterHeight() return ws.fWaterHeight; } -hsScalar plWaterComponent::GetWaterHeight(INode* node) +float plWaterComponent::GetWaterHeight(INode* node) { if( !node ) return 0.f; @@ -1273,21 +1273,21 @@ plRenderTarget* plEnvMapComponent::IGetMap() if( !fMap ) { - UInt32 size = fCompPB->GetInt(kEnvSize); + uint32_t size = fCompPB->GetInt(kEnvSize); for( i = 9; i > 5; i-- ) { - if( (1UL << UInt32(i)) <= size ) + if( (1UL << uint32_t(i)) <= size ) break; } - size = 1 << UInt32(i); + size = 1 << uint32_t(i); plDynamicEnvMap* env = nil; plDynamicCamMap* cam = nil; fMap = nil; if (fCompPB->GetInt((ParamID(kMapType))) == kMapCubic) - fMap = env = TRACKED_NEW plDynamicEnvMap(size, size, 32); + fMap = env = new plDynamicEnvMap(size, size, 32); else if (fCompPB->GetInt((ParamID(kMapType))) == kMapSingle) - fMap = cam = TRACKED_NEW plDynamicCamMap(size, size, 32); + fMap = cam = new plDynamicCamMap(size, size, 32); // Need to assign the key before we call all the setup functions. hsgResMgr::ResMgr()->NewKey(GetINode()->GetName(), fMap, firstTarg->GetLocation(), firstTarg->GetLoadMask()); @@ -1326,7 +1326,7 @@ plRenderTarget* plEnvMapComponent::IGetMap() plVisRegion* effReg = effComp->GetVisRegion(firstTarg); if( effReg ) { - plGenRefMsg* refMsg = TRACKED_NEW plGenRefMsg(fMap->GetKey(), plRefMsg::kOnCreate, -1, plDynamicEnvMap::kRefVisSet); + plGenRefMsg* refMsg = new plGenRefMsg(fMap->GetKey(), plRefMsg::kOnCreate, -1, plDynamicEnvMap::kRefVisSet); hsgResMgr::ResMgr()->SendRef(effReg->GetKey(), refMsg, plRefFlags::kPassiveRef); visGot++; @@ -1352,8 +1352,8 @@ plRenderTarget* plEnvMapComponent::IGetMap() // Right now, the envMap doesn't use this, but I plan to make it do so, so I'm // going ahead and adding the ref regardless of which type of map we made. - UInt8 refType = cam ? plDynamicCamMap::kRefRootNode : plDynamicEnvMap::kRefRootNode; - hsgResMgr::ResMgr()->AddViaNotify(firstTarg->GetSceneObject()->GetKey(), TRACKED_NEW plGenRefMsg(fMap->GetKey(), plRefMsg::kOnCreate, -1, refType), plRefFlags::kPassiveRef); + uint8_t refType = cam ? plDynamicCamMap::kRefRootNode : plDynamicEnvMap::kRefRootNode; + hsgResMgr::ResMgr()->AddViaNotify(firstTarg->GetSceneObject()->GetKey(), new plGenRefMsg(fMap->GetKey(), plRefMsg::kOnCreate, -1, refType), plRefFlags::kPassiveRef); } return fMap; } diff --git a/Sources/Tools/MaxComponent/plWaterComponent.h b/Sources/Tools/MaxComponent/plWaterComponent.h index 723f976d..85b0a244 100644 --- a/Sources/Tools/MaxComponent/plWaterComponent.h +++ b/Sources/Tools/MaxComponent/plWaterComponent.h @@ -141,7 +141,7 @@ protected: plWaveSetBase* IGetWaveSet() const { return (plWaveSetBase*)fWaveSet; } // fWaveSet set in SetupProperties pass. - hsScalar IGetWaterHeight(); + float IGetWaterHeight(); public: plWaterComponent(); @@ -157,7 +157,7 @@ public: virtual int GetMinCap() { return plQuality::kPS_1_1; } // This works anytime. - static hsScalar GetWaterHeight(INode* node); // node is component node. + static float GetWaterHeight(INode* node); // node is component node. // These only work after PreConvert pass static plWaveSetBase* GetWaveSet(INode* node); // Node is the component node diff --git a/Sources/Tools/MaxComponent/plXImposter.cpp b/Sources/Tools/MaxComponent/plXImposter.cpp index ddcfb06c..7975cf18 100644 --- a/Sources/Tools/MaxComponent/plXImposter.cpp +++ b/Sources/Tools/MaxComponent/plXImposter.cpp @@ -329,7 +329,7 @@ hsBool plFilterInheritComp::Convert(plMaxNode* node, plErrorMsg* pErrMsg) phys->SetProperty(plSimulationInterface::kPassive, true); } - UInt32 mask = plFilterCoordInterface::kNoRotation; + uint32_t mask = plFilterCoordInterface::kNoRotation; if( fCompPB->GetInt(kNoX) ) mask |= plFilterCoordInterface::kNoTransX; if( fCompPB->GetInt(kNoY) ) diff --git a/Sources/Tools/MaxConvert/StringTokenizer.cpp b/Sources/Tools/MaxConvert/StringTokenizer.cpp index 9c159970..8f1bf977 100644 --- a/Sources/Tools/MaxConvert/StringTokenizer.cpp +++ b/Sources/Tools/MaxConvert/StringTokenizer.cpp @@ -53,10 +53,10 @@ StringTokenizer::StringTokenizer() { StringTokenizer::StringTokenizer(const char *string, const char *seps) { qAsTok = true; inQuote = false; - this->string = TRACKED_NEW char[strlen(string)+1]; + this->string = new char[strlen(string)+1]; strcpy(this->string,string); numSeps = strlen(seps); - this->seps = TRACKED_NEW char[numSeps+1]; + this->seps = new char[numSeps+1]; strcpy(this->seps,seps); this->tok = this->string; if (isSep(*tok)) next(); @@ -81,7 +81,7 @@ char *StringTokenizer::next() { }; hsBool StringTokenizer::isSep(char c) { if (!qAsTok || !inQuote) { - for (Int32 i=0; istring) delete this->string; - this->string = TRACKED_NEW char[strlen(string)+1]; + this->string = new char[strlen(string)+1]; strcpy(this->string,string); if (this->seps) delete this->seps; numSeps = strlen(seps); - this->seps = TRACKED_NEW char[numSeps+1]; + this->seps = new char[numSeps+1]; strcpy(this->seps,seps); this->tok = this->string; if (isSep(*tok)) next(); diff --git a/Sources/Tools/MaxConvert/StringTokenizer.h b/Sources/Tools/MaxConvert/StringTokenizer.h index eba55fc9..c1bbfd64 100644 --- a/Sources/Tools/MaxConvert/StringTokenizer.h +++ b/Sources/Tools/MaxConvert/StringTokenizer.h @@ -50,7 +50,7 @@ private: char *seps; char *tok; hsBool isSep(char c); - Int32 numSeps; + int32_t numSeps; hsBool qAsTok; hsBool inQuote; public: diff --git a/Sources/Tools/MaxConvert/UserPropMgr.cpp b/Sources/Tools/MaxConvert/UserPropMgr.cpp index a8e71c4c..12229a13 100644 --- a/Sources/Tools/MaxConvert/UserPropMgr.cpp +++ b/Sources/Tools/MaxConvert/UserPropMgr.cpp @@ -41,15 +41,15 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ // UserPropMgr.cpp -#include "hsTypes.h" +#include "HeadSpin.h" #include "UserPropMgr.h" #include "hsStringTokenizer.h" -#include "hsUtils.h" + #include "hsHashTable.h" #define REFMSG_USERPROP (REFMSG_USER + 1) -const UInt32 UserPropMgr::kQuickSize = 150001;//199999; +const uint32_t UserPropMgr::kQuickSize = 150001;//199999; UserPropMgr gUserPropMgr(GetCOREInterface()); @@ -69,13 +69,13 @@ UserPropMgr::~UserPropMgr() CloseQuickTable(); } -void UserPropMgr::SetUserPropFlag(INode *node, const char *name, const BOOL setFlag, const Int32 hFlag) +void UserPropMgr::SetUserPropFlag(INode *node, const char *name, const BOOL setFlag, const int32_t hFlag) { if (setFlag) SetUserProp(node,name,NULL,hFlag); else ClearUserProp(node,name,hFlag); } -void UserPropMgr::ClearUserPropALL(const char *name, const Int32 hFlag) +void UserPropMgr::ClearUserPropALL(const char *name, const int32_t hFlag) { for (int i=0; i(kQuickSize); + fQuickTable = new hsHashTable(kQuickSize); } fQuickNode = nil; } @@ -854,7 +854,7 @@ void UserPropMgr::QuickPair::SetBuffer(char* buf) fBuffer = buf; } -UInt32 UserPropMgr::QuickPair::GetHash() const +uint32_t UserPropMgr::QuickPair::GetHash() const { const char * k = fKey; int len = k ? strlen(k) : 0; diff --git a/Sources/Tools/MaxConvert/UserPropMgr.h b/Sources/Tools/MaxConvert/UserPropMgr.h index 8819c4f7..d2dd9ee6 100644 --- a/Sources/Tools/MaxConvert/UserPropMgr.h +++ b/Sources/Tools/MaxConvert/UserPropMgr.h @@ -45,7 +45,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #define _USERPROPMGR_H_ #include "Max.h" -#include "hsTypes.h" +#include "HeadSpin.h" template class hsHashTable; @@ -64,30 +64,30 @@ public: NameMaker *nm; - void SetUserPropFlag(INode *node, const char *name, const BOOL setFlag, const Int32 hFlag=kMe); + void SetUserPropFlag(INode *node, const char *name, const BOOL setFlag, const int32_t hFlag=kMe); void SelectUserPropFlagALL(INode *node, const char *name, const BOOL flag); - void ClearUserProp(INode *node, const char *name, const Int32 hFlag=kMe); - void ClearUserPropALL(const char *name, const Int32 hFlag=kMe); - void SetUserPropFlagALL(const char *name, const BOOL setFlag, const Int32 hFlag=kMe); - BOOL GetUserPropFlagALL(const char *name, BOOL &isSet, const Int32 hFlag=kMe); - - BOOL GetUserProp(INode *node, const char *name, TSTR &value, const Int32 hFlag=kMe); - void SetUserProp(INode *node, const char *name, const char *value, const Int32 hFlag=kMe); - BOOL UserPropExists(INode *node, const char *name, const Int32 hFlag=kMe); - - BOOL GetUserPropString(INode *node, const char *name, TSTR &value, const Int32 hFlag=kMe); - void SetUserPropString(INode *node, const char *name, const char *value, const Int32 hFlag=kMe); - BOOL GetUserPropFloat(INode *node, const char *name, float &value, const Int32 hFlag=kMe); - void SetUserPropFloat(INode *node, const char *name, const float value, const Int32 hFlag=kMe); - BOOL GetUserPropInt(INode *node, const char *name, int &value, const Int32 hFlag=kMe); - void SetUserPropInt(INode *node, const char *name, const int value, const Int32 hFlag=kMe); + void ClearUserProp(INode *node, const char *name, const int32_t hFlag=kMe); + void ClearUserPropALL(const char *name, const int32_t hFlag=kMe); + void SetUserPropFlagALL(const char *name, const BOOL setFlag, const int32_t hFlag=kMe); + BOOL GetUserPropFlagALL(const char *name, BOOL &isSet, const int32_t hFlag=kMe); + + BOOL GetUserProp(INode *node, const char *name, TSTR &value, const int32_t hFlag=kMe); + void SetUserProp(INode *node, const char *name, const char *value, const int32_t hFlag=kMe); + BOOL UserPropExists(INode *node, const char *name, const int32_t hFlag=kMe); + + BOOL GetUserPropString(INode *node, const char *name, TSTR &value, const int32_t hFlag=kMe); + void SetUserPropString(INode *node, const char *name, const char *value, const int32_t hFlag=kMe); + BOOL GetUserPropFloat(INode *node, const char *name, float &value, const int32_t hFlag=kMe); + void SetUserPropFloat(INode *node, const char *name, const float value, const int32_t hFlag=kMe); + BOOL GetUserPropInt(INode *node, const char *name, int &value, const int32_t hFlag=kMe); + void SetUserPropInt(INode *node, const char *name, const int value, const int32_t hFlag=kMe); BOOL GetUserPropStringList(INode *node, const char *name, int &num, TSTR list[]); BOOL GetUserPropIntList(INode *node, const char *name, int &num, int list[]); BOOL GetUserPropFloatList(INode *node, const char *name, int &num, float list[]); - BOOL GetUserPropStringALL(const char *name, TSTR &value, const Int32 hFlag=kMe); - void SetUserPropStringALL(const char *name, const char *value, const Int32 hFlag=kMe); + BOOL GetUserPropStringALL(const char *name, TSTR &value, const int32_t hFlag=kMe); + void SetUserPropStringALL(const char *name, const char *value, const int32_t hFlag=kMe); BOOL GetUserPropStringListALL(const char *name, int &num, TSTR list[]); BOOL GetUserPropIntListALL(const char *name, int &num, int *list); BOOL GetUserPropFloatListALL(const char *name, int &num, float *list); @@ -116,7 +116,7 @@ public: void CloseQuickTable(); private: - INode* GetAncestorIfNeeded(INode* node, const Int32 hFlag); + INode* GetAncestorIfNeeded(INode* node, const int32_t hFlag); void DeSelectWithOut(const char *name, const char *value); void RecursiveSelectAll(INode *node = NULL); int RecursiveCountAlike(INode *node = NULL, BOOL MatchAll=true); @@ -140,14 +140,14 @@ private: void SetKey(const char* k) { fKey = k; } void SetVal(const char* v) { fVal = v; } - UInt32 GetHash() const; + uint32_t GetHash() const; hsBool GetVal(TSTR& value); bool operator==(const QuickPair& other) const; }; hsHashTable* fQuickTable; - static const UInt32 kQuickSize; + static const uint32_t kQuickSize; INode* fQuickNode; void IBuildQuickTable(INode* node); BOOL ICheckQuickEntry(const char *key, TSTR &value); diff --git a/Sources/Tools/MaxConvert/hsControlConverter.cpp b/Sources/Tools/MaxConvert/hsControlConverter.cpp index 96732ab1..d9043c28 100644 --- a/Sources/Tools/MaxConvert/hsControlConverter.cpp +++ b/Sources/Tools/MaxConvert/hsControlConverter.cpp @@ -39,7 +39,8 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com Mead, WA 99021 *==LICENSE==*/ -#include "hsWindows.h" + +#include "HeadSpin.h" #include #include @@ -53,8 +54,6 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "modstack.h" #include "keyreduc.h" -#include "HeadSpin.h" - #include "hsMaxLayerBase.h" #include "plInterp/plController.h" #include "plInterp/hsInterp.h" @@ -121,7 +120,7 @@ class KRStatus : public KeyReduceStatus int Progress(int p) { return KEYREDUCE_CONTINUE; } }; -void hsControlConverter::ReduceKeys(Control *control, hsScalar threshold) +void hsControlConverter::ReduceKeys(Control *control, float threshold) { if (control == nil || threshold <= 0) return; @@ -134,8 +133,8 @@ void hsControlConverter::ReduceKeys(Control *control, hsScalar threshold) IKeyControl *keyCont = GetKeyControlInterface(control); if (keyCont->GetNumKeys() > 2) { - IKey *key1 = (IKey*)TRACKED_NEW UInt8[keyCont->GetKeySize()]; - IKey *key2 = (IKey*)TRACKED_NEW UInt8[keyCont->GetKeySize()]; + IKey *key1 = (IKey*)new uint8_t[keyCont->GetKeySize()]; + IKey *key2 = (IKey*)new uint8_t[keyCont->GetKeySize()]; keyCont->GetKey(0, key1); keyCont->GetKey(keyCont->GetNumKeys() - 1, key2); @@ -158,8 +157,8 @@ void hsControlConverter::ReduceKeys(Control *control, hsScalar threshold) Interval interval(start, end); ApplyKeyReduction(control, interval, threshold, GetTicksPerFrame(), &status); } - delete [] (UInt8*)key1; - delete [] (UInt8*)key2; + delete [] (uint8_t*)key1; + delete [] (uint8_t*)key2; } } } @@ -172,7 +171,7 @@ void hsControlConverter::ReduceKeys(Control *control, hsScalar threshold) } plController *hsControlConverter::ConvertTMAnim(plSceneObject *obj, plMaxNode *node, hsAffineParts *parts, - hsScalar start /* = -1 */, hsScalar end /* = -1 */) + float start /* = -1 */, float end /* = -1 */) { Control* maxTm = node->GetTMController(); plController *tmc = hsControlConverter::Instance().MakeTransformController(maxTm, node, start, end); @@ -249,7 +248,7 @@ plLeafController* hsControlConverter::MakeMatrix44Controller(StdUVGen* uvGen, co CompositeKeyTimes(vAngCtl, kTimes); CompositeKeyTimes(wAngCtl, kTimes); - const float kMaxRads = 30.f * hsScalarPI / 180.f; + const float kMaxRads = 30.f * M_PI / 180.f; MaxSampleAngles(nodeName, uAngCtl, kTimes, kMaxRads); MaxSampleAngles(nodeName, vAngCtl, kTimes, kMaxRads); MaxSampleAngles(nodeName, wAngCtl, kTimes, kMaxRads); @@ -259,7 +258,7 @@ plLeafController* hsControlConverter::MakeMatrix44Controller(StdUVGen* uvGen, co return nil; } - plLeafController* ctrl = TRACKED_NEW plLeafController; + plLeafController* ctrl = new plLeafController; ctrl->AllocKeys(kTimes.Count(), hsKeyFrame::kMatrix44KeyFrame); TimeValue resetTime = fConverterUtils.GetTime(fInterface); for( i=0; i < kTimes.Count(); i++) @@ -310,7 +309,7 @@ plLeafController* hsControlConverter::MakeMatrix44Controller(Control* prsControl return nil; } - plLeafController* ctrl = TRACKED_NEW plLeafController; + plLeafController* ctrl = new plLeafController; ctrl->AllocKeys(kTimes.Count(), hsKeyFrame::kMatrix44KeyFrame); TimeValue resetTime = fConverterUtils.GetTime(fInterface);; for( i=0; i < kTimes.Count(); i++) @@ -339,7 +338,7 @@ plLeafController* hsControlConverter::MakeMatrix44Controller(Control* prsControl // Create a plScalarController and store the nodes parm behavior in it. // plLeafController* hsControlConverter::MakeScalarController(Control* control, plMaxNode* node, - hsScalar start /* = -1 */, hsScalar end /* = -1 */) + float start /* = -1 */, float end /* = -1 */) { hsGuardBegin("hsControlConverter::MakeScalarController"); @@ -354,7 +353,7 @@ plLeafController* hsControlConverter::MakeScalarController(Control* control, plM } plController* hsControlConverter::MakeColorController(Control* control, plMaxNode* node, - hsScalar start /* = -1 */, hsScalar end /* = -1 */) + float start /* = -1 */, float end /* = -1 */) { return MakePosController(control, node, start, end); } @@ -362,7 +361,7 @@ plController* hsControlConverter::MakeColorController(Control* control, plMaxNod // Create a plPosController and store the nodes parm behavior in it. // plController* hsControlConverter::MakePosController(Control* control, plMaxNode* node, - hsScalar start /* = -1 */, hsScalar end /* = -1 */) + float start /* = -1 */, float end /* = -1 */) { hsGuardBegin("hsControlConverter::MakePosController"); @@ -379,7 +378,7 @@ plController* hsControlConverter::MakePosController(Control* control, plMaxNode* } else { - hsCont = TRACKED_NEW plCompoundController; + hsCont = new plCompoundController; fErrorMsg->Set(control->NumSubs()!=3, node->GetName(), "compound should have 3 subs").Check(); if (control->ClassID() == Class_ID(POSITIONNOISE_CONTROL_CLASS_ID,0) ) @@ -412,7 +411,7 @@ plController* hsControlConverter::MakePosController(Control* control, plMaxNode* } plController *hsControlConverter::MakeScaleController(Control *control, plMaxNode* node, - hsScalar start /* = -1 */, hsScalar end /* = -1 */) + float start /* = -1 */, float end /* = -1 */) { ISetSegRange(start, end); @@ -435,7 +434,7 @@ plController *hsControlConverter::MakeScaleController(Control *control, plMaxNod } plController *hsControlConverter::MakeRotController(Control *control, plMaxNode *node, hsBool camRot /* = false */, - hsScalar start /* = -1 */, hsScalar end /* = -1 */) + float start /* = -1 */, float end /* = -1 */) { ISetSegRange(start, end); @@ -463,7 +462,7 @@ plController *hsControlConverter::MakeRotController(Control *control, plMaxNode if (fErrorMsg->Set(control->NumSubs() != 3, node->GetName(), "Rot compound controller should have 3 subcontrollers").CheckAndAsk()) return nil; - plCompoundController* rc = TRACKED_NEW plCompoundController; + plCompoundController* rc = new plCompoundController; int i; for (i=0; i<3; i++) { @@ -532,7 +531,7 @@ plController *hsControlConverter::MakeRotController(Control *control, plMaxNode return NULL; } -void hsControlConverter::ScalePositionController(plController* ctl, hsScalar scale) +void hsControlConverter::ScalePositionController(plController* ctl, float scale) { plLeafController* simp = plLeafController::ConvertNoRef(ctl); plCompoundController* comp; @@ -565,7 +564,7 @@ void hsControlConverter::ScalePositionController(plController* ctl, hsScalar sca } } -void hsControlConverter::MaxSampleAngles(const char* nodeName, Control* ctl, Tab& kTimes, hsScalar maxRads) +void hsControlConverter::MaxSampleAngles(const char* nodeName, Control* ctl, Tab& kTimes, float maxRads) { hsGuardBegin("hsControlConverter::MaxSampleAngles"); @@ -596,7 +595,7 @@ void hsControlConverter::MaxSampleAngles(const char* nodeName, Control* ctl, Tab } plCompoundController *hsControlConverter::MakeTransformController(Control *control, plMaxNode *node, - hsScalar start /* = -1 */, hsScalar end /* = -1 */) + float start /* = -1 */, float end /* = -1 */) { hsGuardBegin("hsControlConverter::MakeTransformController"); @@ -617,7 +616,7 @@ plCompoundController *hsControlConverter::MakeTransformController(Control *contr return NULL; } - plCompoundController *tmc = TRACKED_NEW plCompoundController; + plCompoundController *tmc = new plCompoundController; for (int i=0; iSubAnim(i); @@ -658,7 +657,7 @@ plCompoundController *hsControlConverter::MakeTransformController(Control *contr hsGuardEnd; } -void hsControlConverter::ISetSegRange(hsScalar start, hsScalar end) +void hsControlConverter::ISetSegRange(float start, float end) { fSegStart = (start >= 0 ? fTicksPerSec * start : fInterface->GetAnimRange().Start()); fSegEnd = (end >= 0 ? fTicksPerSec * end : fInterface->GetAnimRange().End()); @@ -666,7 +665,7 @@ void hsControlConverter::ISetSegRange(hsScalar start, hsScalar end) void hsControlConverter::IConvertSubTransform(Control *control, char *ctlName, plMaxNode *node, plCompoundController *tmc, - hsScalar start, hsScalar end) + float start, float end) { if (control) { @@ -748,7 +747,7 @@ plLeafController* hsControlConverter::ICreateQuatController(plMaxNode* node, Con { hsGuardBegin("hsControlConverter::ICreateQuatController"); - Int32 startIdx, endIdx; + int32_t startIdx, endIdx; IKeyControl* ikeys = GetKeyControlInterface(control); if ( ikeys && IGetRangeCoverKeyIndices(node ? node->GetName() : nil, control, startIdx, endIdx)>1 ) { @@ -759,11 +758,11 @@ plLeafController* hsControlConverter::ICreateQuatController(plMaxNode* node, Con return NULL; } - IKey* key=(IKey*)(new byte[ikeys->GetKeySize()]); - plLeafController* pc = TRACKED_NEW plLeafController; + IKey* key=(IKey*)(new uint8_t[ikeys->GetKeySize()]); + plLeafController* pc = new plLeafController; - UInt8 compressLevel = node->GetAnimCompress(); - UInt8 keyType; + uint8_t compressLevel = node->GetAnimCompress(); + uint8_t keyType; if (compressLevel == plAnimCompressComp::kCompressionHigh) keyType = hsKeyFrame::kCompressedQuatKeyFrame32; else if (compressLevel == plAnimCompressComp::kCompressionLow) @@ -776,7 +775,7 @@ plLeafController* hsControlConverter::ICreateQuatController(plMaxNode* node, Con { // Get key ikeys->GetKey(i, key); - const float kMaxRads = hsScalarPI* 0.5f; + const float kMaxRads = M_PI* 0.5f; Tab kTimes; kTimes.ZeroCount(); if( rotation ) @@ -828,7 +827,7 @@ plLeafController* hsControlConverter::ICreateScaleValueController(plMaxNode* nod hsGuardBegin("hsControlConverter::ICreateScaleValueController"); //plMaxNode* xformParent = GetXformParent(node); - Int32 startIdx, endIdx; + int32_t startIdx, endIdx; IKeyControl* ikeys = GetKeyControlInterface(control); if ( ikeys && IGetRangeCoverKeyIndices(node ? node->GetName() : nil, control, startIdx, endIdx)>1 ) { @@ -839,8 +838,8 @@ plLeafController* hsControlConverter::ICreateScaleValueController(plMaxNode* nod return NULL; } - IKey* key=(IKey*)(new byte [ikeys->GetKeySize()]); - plLeafController* pc = TRACKED_NEW plLeafController; + IKey* key=(IKey*)(new uint8_t [ikeys->GetKeySize()]); + plLeafController* pc = new plLeafController; pc->AllocKeys(endIdx - startIdx + 1, GetKeyType(control)); for(int i = startIdx; i <= endIdx; i++) { @@ -869,7 +868,7 @@ plLeafController* hsControlConverter::ICreateScalarController(plMaxNode* node, C { hsGuardBegin("hsControlConverter::ICreateScalarController"); - Int32 startIdx, endIdx; + int32_t startIdx, endIdx; IKeyControl* ikeys = GetKeyControlInterface(control); if ( ikeys && IGetRangeCoverKeyIndices(node ? node->GetName() : nil, control, startIdx, endIdx)>1 ) { @@ -880,8 +879,8 @@ plLeafController* hsControlConverter::ICreateScalarController(plMaxNode* node, C return NULL; } - IKey* key=(IKey*)(new byte [ikeys->GetKeySize()]); - plLeafController* pc = TRACKED_NEW plLeafController; + IKey* key=(IKey*)(new uint8_t [ikeys->GetKeySize()]); + plLeafController* pc = new plLeafController; pc->AllocKeys(endIdx - startIdx + 1, GetKeyType(control)); for(int i = startIdx; i <= endIdx; i++) { @@ -912,7 +911,7 @@ plLeafController* hsControlConverter::ICreateSimplePosController(plMaxNode* node hsGuardBegin("hsControlConverter::ICreateSimplePosController"); IKeyControl* ikeys = GetKeyControlInterface(control); - Int32 startIdx, endIdx; + int32_t startIdx, endIdx; if ( ikeys && IGetRangeCoverKeyIndices(node ? node->GetName() : nil, control, startIdx, endIdx)>1 ) { if(!(control->IsKeyable())) @@ -922,8 +921,8 @@ plLeafController* hsControlConverter::ICreateSimplePosController(plMaxNode* node return NULL; } - IKey* key=(IKey*)(new byte [ikeys->GetKeySize()]); - plLeafController* pc = TRACKED_NEW plLeafController; + IKey* key=(IKey*)(new uint8_t [ikeys->GetKeySize()]); + plLeafController* pc = new plLeafController; pc->AllocKeys(endIdx - startIdx + 1, GetKeyType(control)); for(int i = startIdx; i <= endIdx; i++) { @@ -955,7 +954,7 @@ int hsControlConverter::IAddPartsKeys(Control* control, { hsGuardBegin("hsControlConverter::IAddPartsKeys"); - Int32 startIdx, endIdx; + int32_t startIdx, endIdx; if (control->IsLeaf()) { IKeyControl* ikeys = GetKeyControlInterface(control); @@ -978,14 +977,14 @@ int hsControlConverter::IAddPartsKeys(Control* control, // // Traverse all keys of controller // - IKey* key=(IKey*)(new byte [ikeys->GetKeySize()]); + IKey* key=(IKey*)(new uint8_t [ikeys->GetKeySize()]); hsBool mb=false; plMaxNode* xformParent = GetXformParent(node); for(i = startIdx; i <= endIdx; i++) { // Get key ikeys->GetKey(i, key); - hsScalar frameTime = key->time / GetTicksPerSec(); + float frameTime = key->time / GetTicksPerSec(); int frameNum = key->time / GetTicksPerFrame(); hsAssert(frameNum <= hsKeyFrame::kMaxFrameNumber, "Anim is too long."); @@ -1067,7 +1066,7 @@ bool hsControlConverter::StdUVGenToHsMatrix44(hsMatrix44* hsMat, StdUVGen* uvGen for( i = 0; i < 2; i++ ) { if( fabsf(hsMat->fMap[i][3]) > 1.f ) - hsMat->fMap[i][3] -= hsScalar(int(hsMat->fMap[i][3])); + hsMat->fMap[i][3] -= float(int(hsMat->fMap[i][3])); } } @@ -1098,8 +1097,8 @@ void hsControlConverter::IGetControlSampleTimes(Control* control, int iLo, int i IKeyControl* ikeys = GetKeyControlInterface(control); - IKey* key=(IKey*)(new byte [ikeys->GetKeySize()]); - IKey* lastKey=(IKey*)(new byte [ikeys->GetKeySize()]); + IKey* key=(IKey*)(new uint8_t [ikeys->GetKeySize()]); + IKey* lastKey=(IKey*)(new uint8_t [ikeys->GetKeySize()]); int i; for( i = iLo; i < iHi; i++ ) @@ -1244,7 +1243,7 @@ void hsControlConverter::IGetControlSampleTimes(Control* control, int iLo, int i // // Create an hsKeyFrame from a 3DSMax key // -Int32 hsControlConverter::ICreateHSInterpKey(Control* control, IKey* mKey, TimeValue keyTime, hsKeyFrame* baseKey, plMaxNode* node, hsBool rotQuat) +int32_t hsControlConverter::ICreateHSInterpKey(Control* control, IKey* mKey, TimeValue keyTime, hsKeyFrame* baseKey, plMaxNode* node, hsBool rotQuat) { hsGuardBegin("hsControlConverter::ICreateHSInterpKey"); @@ -1371,7 +1370,7 @@ Int32 hsControlConverter::ICreateHSInterpKey(Control* control, IKey* mKey, TimeV hsGuardEnd; } -UInt8 hsControlConverter::GetKeyType(Control* control, hsBool rotQuat) +uint8_t hsControlConverter::GetKeyType(Control* control, hsBool rotQuat) { Class_ID cID = control->ClassID(); SClass_ID sID = control->SuperClassID(); @@ -1428,7 +1427,7 @@ UInt8 hsControlConverter::GetKeyType(Control* control, hsBool rotQuat) // // // -Int32 hsControlConverter::IGetRangeCoverKeyIndices(char* nodeName, Control* cont, Int32 &start, Int32 &end) +int32_t hsControlConverter::IGetRangeCoverKeyIndices(char* nodeName, Control* cont, int32_t &start, int32_t &end) { hsGuardBegin("hsControlConverter::IGetRangeCoverKeyIndices"); @@ -1442,7 +1441,7 @@ Int32 hsControlConverter::IGetRangeCoverKeyIndices(char* nodeName, Control* cont if (numKeys == 0) return 0; - IKey* key=(IKey*)(new byte [keys->GetKeySize()]); + IKey* key=(IKey*)(new uint8_t [keys->GetKeySize()]); start = numKeys; for (int i=0; iSetCmd(plCameraMsg::kSetAnimated); pCamMsg->AddReceiver(pCamMod->GetKey()); plConvert::Instance().AddMessageToQueue(pCamMsg); Object* obj = node->EvalWorldState(hsConverterUtils::Instance().GetTime(node->GetInterface())).obj; GenCamera* theCam; - hsTArray fovW; - hsTArray fovH; + hsTArray fovW; + hsTArray fovH; for (i=0; i < kfArray->Count(); i++) { TimeValue t = TimeValue(GetTicksPerFrame() * (kfArray[0][i].fFrame)); @@ -2107,7 +2106,7 @@ void hsControlConverter::IExportAnimatedCameraFOV(plMaxNode* node, hsTArray GetFOVType(); - hsScalar wDeg, hDeg; + float wDeg, hDeg; switch(FOVType) { case 0: // FOV_W @@ -2130,7 +2129,7 @@ void hsControlConverter::IExportAnimatedCameraFOV(plMaxNode* node, hsTArray Count(); i++) { - plCameraMsg* pFOVMsg = TRACKED_NEW plCameraMsg; + plCameraMsg* pFOVMsg = new plCameraMsg; plCameraConfig* pCfg = pFOVMsg->GetConfig(); if (i == kfArray->Count() - 1) @@ -2150,12 +2149,12 @@ void hsControlConverter::IExportAnimatedCameraFOV(plMaxNode* node, hsTArray SetCmd(plCameraMsg::kAddFOVKeyframe); pFOVMsg->AddReceiver(pCamMod->GetKey()); - plEventCallbackMsg* pCall = TRACKED_NEW plEventCallbackMsg; + plEventCallbackMsg* pCall = new plEventCallbackMsg; pCall->fEvent = kTime; pCall->fEventTime = kfArray[0][i].fFrame / MAX_FRAMES_PER_SEC; pCall->fIndex = i; pCall->AddReceiver(pCamMod->GetKey()); - plAnimCmdMsg* pMsg = TRACKED_NEW plAnimCmdMsg; + plAnimCmdMsg* pMsg = new plAnimCmdMsg; pMsg->AddReceiver(pCamMod->GetKey()); pMsg->SetSender(pAnim->GetModKey(node)); pMsg->SetCmd(plAnimCmdMsg::kAddCallbacks); @@ -2166,4 +2165,4 @@ void hsControlConverter::IExportAnimatedCameraFOV(plMaxNode* node, hsTArray & kTimes, hsScalar maxRads); - void ScalePositionController(plController* ctl, hsScalar scale); + void MaxSampleAngles(const char* nodeName, Control* ctl, Tab& kTimes, float maxRads); + void ScalePositionController(plController* ctl, float scale); - void ReduceKeys(Control *control, hsScalar threshold); + void ReduceKeys(Control *control, float threshold); hsBool HasKeyTimes(Control* ctl); - UInt8 GetKeyType(Control* ctl, hsBool rotQuat = false); + uint8_t GetKeyType(Control* ctl, hsBool rotQuat = false); plMaxNode* GetXformParent(plMaxNode* node); hsBool ForceWorldSpace(plMaxNode* node); @@ -150,8 +150,8 @@ public: float GetAnimLength() { return fAnimLength; } private: - void ISetSegRange(hsScalar start, hsScalar end); - void IConvertSubTransform(Control *control, char *ctlName, plMaxNode *node, plCompoundController *tmc, hsScalar start, hsScalar end); + void ISetSegRange(float start, float end); + void IConvertSubTransform(Control *control, char *ctlName, plMaxNode *node, plCompoundController *tmc, float start, float end); plLeafController* ICreateSimpleRotController(plMaxNode* node, Control* control, hsBool camRot = false); plLeafController* ICreateSimpleScaleController(plMaxNode* node, Control* control); @@ -163,8 +163,8 @@ private: void IEnableEaseCurves(Animatable* control, bool enable); void IGetControlSampleTimes(Control* control, int iLo, int iHi, Tab& kTimes, float maxRads); int IAddPartsKeys(Control* control, hsTArray * kfArray, plMaxNode* node); - Int32 ICreateHSInterpKey(Control* control, IKey* mKey, TimeValue keyTime, hsKeyFrame* baseKey, plMaxNode* node=nil, hsBool rotQuat = false); - Int32 IGetRangeCoverKeyIndices(char* nodeName, Control* cont, Int32 &start, Int32 &end); + int32_t ICreateHSInterpKey(Control* control, IKey* mKey, TimeValue keyTime, hsKeyFrame* baseKey, plMaxNode* node=nil, hsBool rotQuat = false); + int32_t IGetRangeCoverKeyIndices(char* nodeName, Control* cont, int32_t &start, int32_t &end); ControllerType IGetControlType(TSTR ctrlName); bool IIsKeyTimeInRange(TimeValue time); bool IIsKeyInRange(IKey* key); @@ -183,13 +183,13 @@ private: hsConverterUtils& fConverterUtils; plErrorMsg * fErrorMsg; - Int32 fTicksPerFrame; - Int32 fFrameRate; - Int32 fTicksPerSec; - Int32 fStartFrame; - Int32 fEndFrame; - Int32 fNumFrames; - hsScalar fAnimLength; + int32_t fTicksPerFrame; + int32_t fFrameRate; + int32_t fTicksPerSec; + int32_t fStartFrame; + int32_t fEndFrame; + int32_t fNumFrames; + float fAnimLength; hsBool fWarned; hsBool fForceLocal; diff --git a/Sources/Tools/MaxConvert/hsConverterUtils.cpp b/Sources/Tools/MaxConvert/hsConverterUtils.cpp index 1c03866a..54249978 100644 --- a/Sources/Tools/MaxConvert/hsConverterUtils.cpp +++ b/Sources/Tools/MaxConvert/hsConverterUtils.cpp @@ -40,7 +40,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "hsConverterUtils.h" #include "hsResMgr.h" #include "MaxMain/MaxCompat.h" @@ -93,10 +93,10 @@ namespace { hsGuardEnd; } - Int32 GetInstanceCount() { return fInstanceCount; } + int32_t GetInstanceCount() { return fInstanceCount; } private: - Int32 fInstanceCount; + int32_t fInstanceCount; }; } @@ -418,19 +418,19 @@ char* hsConverterUtils::StripMangledReference(char* dest, const char* name) hsGuardEnd; } -Int32 hsConverterUtils::FindNamedSelSetFromName(const char *name) +int32_t hsConverterUtils::FindNamedSelSetFromName(const char *name) { hsGuardBegin("hsConverterUtils::FindNamedSelSetFromName"); #if MAX_VERSION_MAJOR <= 12 - for (Int32 i=0; iGetNumNamedSelSets(); i++) + for (int32_t i=0; iGetNumNamedSelSets(); i++) { if (!_stricmp(name, fInterface->GetNamedSelSetName(i))) return (i); } #else INamedSelectionSetManager* selSetMgr = INamedSelectionSetManager::GetInstance(); - for (Int32 i=0; iGetNumNamedSelSets(); i++) + for (int32_t i=0; iGetNumNamedSelSets(); i++) { if (!_stricmp(name, selSetMgr->GetNamedSelSetName(i))) return (i); @@ -525,7 +525,7 @@ void hsConverterUtils::CreateNodeSearchCache() { if (!fNodeSearchCache) { - fNodeSearchCache = TRACKED_NEW hsHashTable(); + fNodeSearchCache = new hsHashTable(); } fNodeSearchCache->clear(); @@ -555,7 +555,7 @@ void hsConverterUtils::IBuildNodeSearchCacheRecur(INode* node) } } -UInt32 hsConverterUtils::CacheNode::GetHash() const +uint32_t hsConverterUtils::CacheNode::GetHash() const { const char* k = GetName(); int len = k ? strlen(k) : 0; diff --git a/Sources/Tools/MaxConvert/hsConverterUtils.h b/Sources/Tools/MaxConvert/hsConverterUtils.h index e94dce20..a0110b6f 100644 --- a/Sources/Tools/MaxConvert/hsConverterUtils.h +++ b/Sources/Tools/MaxConvert/hsConverterUtils.h @@ -95,7 +95,7 @@ public: char* MangleRefWithRoom(char *mangName, const char *nodeName, const char* roomName); char* UnMangleReference(char *dest, const char *name); hsBool IsMangled(const char *name); - Int32 FindNamedSelSetFromName(const char *name); + int32_t FindNamedSelSetFromName(const char *name); char* StripMangledReference(char* dest, const char* name); hsBool IsInstanced(Object* maxObject); @@ -120,7 +120,7 @@ private: plErrorMsg *fErrorMsg; hsBool fSuppressMangling; - UInt32 fWarned; + uint32_t fWarned; hsBool fSave; struct CacheNode @@ -140,7 +140,7 @@ private: void SetCaseSensitive(hsBool b) { fCaseSensitive = b; } hsBool GetCaseSensitive() { return fCaseSensitive; } - UInt32 GetHash() const; + uint32_t GetHash() const; bool operator==(const CacheNode& other) const; }; hsHashTable* fNodeSearchCache; diff --git a/Sources/Tools/MaxConvert/hsMaterialConverter.cpp b/Sources/Tools/MaxConvert/hsMaterialConverter.cpp index 40ffaf0f..efa3f132 100644 --- a/Sources/Tools/MaxConvert/hsMaterialConverter.cpp +++ b/Sources/Tools/MaxConvert/hsMaterialConverter.cpp @@ -39,7 +39,8 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com Mead, WA 99021 *==LICENSE==*/ -#include "hsWindows.h" + +#include "hsMaterialConverter.h" #include #include #include @@ -50,13 +51,12 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "istdplug.h" #include "texutil.h" -#include "hsMaterialConverter.h" #include "plLayerConverter.h" #include "MaxComponent/plMaxAnimUtils.h" #include "plResMgr/plKeyFinder.h" #include "hsResMgr.h" #include "pnKeyedObject/plUoid.h" -#include "hsUtils.h" + #include "hsMaxLayerBase.h" #include "MaxExport/plErrorMsg.h" #include "plSurface/hsGMaterial.h" @@ -126,7 +126,7 @@ namespace { void CopyMaterialLODToTextures(hsGMaterial* mat) { - Int32 i; + int32_t i; for (i = 0; i < mat->GetNumLayers(); ++i) { plLayerInterface* layer = mat->GetLayer(i); @@ -149,12 +149,12 @@ namespace { "This is not supported in the engine, so the upper layer will be disabled."; } -static UInt32 MakeUInt32Color(float r, float g, float b, float a) +static uint32_t MakeUInt32Color(float r, float g, float b, float a) { - return (UInt32(a * 255.9f) << 24) - |(UInt32(r * 255.9f) << 16) - |(UInt32(g * 255.9f) << 8) - |(UInt32(b * 255.9f) << 0); + return (uint32_t(a * 255.9f) << 24) + |(uint32_t(r * 255.9f) << 16) + |(uint32_t(g * 255.9f) << 8) + |(uint32_t(b * 255.9f) << 0); } static bool failedRT = false; @@ -287,8 +287,8 @@ hsBool hsMaterialConverter::PreserveUVOffset(Mtl* mtl) void AttachLinkMtlAnims(plMaxNode *node, hsGMaterial *mat) { const int numKeys = 2; - hsScalar times[] = {0.f, 1.5f}; - hsScalar values[numKeys] = {100.f, 0.f}; + float times[] = {0.f, 1.5f}; + float values[numKeys] = {100.f, 0.f}; hsBool leaving[] = {true, false}; char *animName = "_link_anim"; @@ -303,9 +303,9 @@ void AttachLinkMtlAnims(plMaxNode *node, hsGMaterial *mat) char suff[10]; sprintf(suff, "%d", k); - opaCtl = TRACKED_NEW plLeafController; - opaCtl->QuickScalarController(numKeys, times, values, sizeof(hsScalar)); - animLayer = TRACKED_NEW plLayerLinkAnimation; + opaCtl = new plLeafController; + opaCtl->QuickScalarController(numKeys, times, values, sizeof(float)); + animLayer = new plLayerLinkAnimation; animLayer->SetLinkKey(node->GetAvatarSO()->GetKey()); //animLayer->fLeavingAge = leaving[x]; TSTR fullAnimName = TSTR(oldLayer->GetKeyName()) + TSTR("_") + TSTR(animName) + TSTR("_") + TSTR(suff); @@ -317,16 +317,16 @@ void AttachLinkMtlAnims(plMaxNode *node, hsGMaterial *mat) animLayer->AttachViaNotify(currLayer); currLayer = animLayer; - plMatRefMsg* msg = TRACKED_NEW plMatRefMsg(mat->GetKey(), plRefMsg::kOnReplace, k, plMatRefMsg::kLayer); + plMatRefMsg* msg = new plMatRefMsg(mat->GetKey(), plRefMsg::kOnReplace, k, plMatRefMsg::kLayer); msg->SetOldRef(oldLayer); msg->SetRef(currLayer); hsgResMgr::ResMgr()->AddViaNotify(msg, plRefFlags::kActiveRef); } } -UInt32 hsMaterialConverter::ColorChannelsUseMask(plMaxNode* node, int iSubMtl) +uint32_t hsMaterialConverter::ColorChannelsUseMask(plMaxNode* node, int iSubMtl) { - UInt32 usedChan = 0; + uint32_t usedChan = 0; hsBool deleteIt = false; TriObject* triObj = node->GetTriObject(deleteIt); @@ -412,9 +412,9 @@ UInt32 hsMaterialConverter::ColorChannelsUseMask(plMaxNode* node, int iSubMtl) return usedChan; } -UInt32 hsMaterialConverter::ICheckPoints(const Point3& p0, const Point3& p1, const Point3& p2, +uint32_t hsMaterialConverter::ICheckPoints(const Point3& p0, const Point3& p1, const Point3& p2, int chan, - UInt32 mBlack, UInt32 mGrey, UInt32 mWhite) + uint32_t mBlack, uint32_t mGrey, uint32_t mWhite) { const float kSmall = 1.e-3f; if( (p0[chan] < kSmall) && (p1[chan] < kSmall) && (p2[chan] < kSmall) ) @@ -426,9 +426,9 @@ UInt32 hsMaterialConverter::ICheckPoints(const Point3& p0, const Point3& p1, con return mGrey; } -UInt32 hsMaterialConverter::ICheckPoints(const Point3& p0, const Point3& p1, const Point3& p2, const Point3& p3, +uint32_t hsMaterialConverter::ICheckPoints(const Point3& p0, const Point3& p1, const Point3& p2, const Point3& p3, int chan, - UInt32 mBlack, UInt32 mGrey, UInt32 mWhite) + uint32_t mBlack, uint32_t mGrey, uint32_t mWhite) { const float kSmall = 1.e-3f; if( (p0[chan] < kSmall) && (p1[chan] < kSmall) && (p2[chan] < kSmall) && (p3[chan] < kSmall) ) @@ -443,7 +443,7 @@ UInt32 hsMaterialConverter::ICheckPoints(const Point3& p0, const Point3& p1, con int hsMaterialConverter::NumVertexOpacityChannelsRequired(plMaxNode* node, int iSubMtl) { - UInt32 vtxChanMask = VertexChannelsRequiredMask(node, iSubMtl); + uint32_t vtxChanMask = VertexChannelsRequiredMask(node, iSubMtl); // Now count the bits. int numChan; @@ -454,7 +454,7 @@ int hsMaterialConverter::NumVertexOpacityChannelsRequired(plMaxNode* node, int i return numChan; } -UInt32 hsMaterialConverter::VertexChannelsRequiredMask(plMaxNode* node, int iSubMtl) +uint32_t hsMaterialConverter::VertexChannelsRequiredMask(plMaxNode* node, int iSubMtl) { Mtl* mtl = node->GetMtl(); if( !mtl ) @@ -480,7 +480,7 @@ UInt32 hsMaterialConverter::VertexChannelsRequiredMask(plMaxNode* node, int iSub // Get the channels our materials will look at. These should all // be of the grey variety, since a solid opaque can be drawn as is, // and a solid transparent can be pitched. - UInt32 vtxChanReq = VertexChannelsRequestMask(node, iSubMtl, mtl); + uint32_t vtxChanReq = VertexChannelsRequestMask(node, iSubMtl, mtl); // Or in vtx alpha. If it's been set, we need to respect it, if it hasn't, // it'll and out to zero anyway when we & with the vtxChanUsed. @@ -488,19 +488,19 @@ UInt32 hsMaterialConverter::VertexChannelsRequiredMask(plMaxNode* node, int iSub // Now figure out what's in all the channels, which are solid black, which // actually have interesting values etc. - UInt32 vtxChanUsed = ColorChannelsUseMask(node, iSubMtl); + uint32_t vtxChanUsed = ColorChannelsUseMask(node, iSubMtl); - UInt32 vtxChanMask = vtxChanReq & vtxChanUsed; + uint32_t vtxChanMask = vtxChanReq & vtxChanUsed; return vtxChanMask; } -UInt32 hsMaterialConverter::VertexChannelsRequestMask(plMaxNode* node, int iSubMtl, Mtl* mtl) +uint32_t hsMaterialConverter::VertexChannelsRequestMask(plMaxNode* node, int iSubMtl, Mtl* mtl) { if( !mtl ) return 0; - UInt32 vtxChanMask = 0; + uint32_t vtxChanMask = 0; if( IsMultiMat(mtl) && (iSubMtl >= 0) ) { @@ -747,9 +747,9 @@ void hsMaterialConverter::GetNodesByMaterial(Mtl *mtl, hsTArray &out // wants to generate several materials from it (like composites). hsTArray * -hsMaterialConverter::CreateMaterialArray(Mtl *maxMaterial, plMaxNode *node, UInt32 multiIndex) +hsMaterialConverter::CreateMaterialArray(Mtl *maxMaterial, plMaxNode *node, uint32_t multiIndex) { - hsTArray *ourMaterials = TRACKED_NEW hsTArray; + hsTArray *ourMaterials = new hsTArray; const char* dbgNodeName = node->GetName(); @@ -899,7 +899,7 @@ int hsMaterialConverter::MaxUsedUVWSrc(plMaxNode* node, Mtl* mtl) return 0; } -hsGMaterial* hsMaterialConverter::NonAlphaHackPrint(plMaxNode* node, Texmap* baseTex, UInt32 blendFlags) +hsGMaterial* hsMaterialConverter::NonAlphaHackPrint(plMaxNode* node, Texmap* baseTex, uint32_t blendFlags) { // Bogus input, I hope they choke on the nil pointer I'm returning. if( !(baseTex && node) ) @@ -910,7 +910,7 @@ hsGMaterial* hsMaterialConverter::NonAlphaHackPrint(plMaxNode* node, Texmap* bas // Search done materials for it - hsGMaterial* mat = TRACKED_NEW hsGMaterial; + hsGMaterial* mat = new hsGMaterial; hsgResMgr::ResMgr()->NewKey(name, mat, node->GetLocation()); // If plasmaLayer is nil, the artist has some other wierd (unsupported) layer type in the slot. @@ -942,7 +942,7 @@ hsGMaterial* hsMaterialConverter::NonAlphaHackPrint(plMaxNode* node, Texmap* bas return mat; } -hsGMaterial* hsMaterialConverter::AlphaHackPrint(plMaxNode* node, Texmap* baseTex, UInt32 blendFlags) +hsGMaterial* hsMaterialConverter::AlphaHackPrint(plMaxNode* node, Texmap* baseTex, uint32_t blendFlags) { // Bogus input, I hope they choke on the nil pointer I'm returning. if( !(baseTex && node) ) @@ -953,7 +953,7 @@ hsGMaterial* hsMaterialConverter::AlphaHackPrint(plMaxNode* node, Texmap* baseTe // Search done materials for it - hsGMaterial* mat = TRACKED_NEW hsGMaterial; + hsGMaterial* mat = new hsGMaterial; hsgResMgr::ResMgr()->NewKey(name, mat, node->GetLocation()); // If plasmaLayer is nil, the artist has some other wierd (unsupported) layer type in the slot. @@ -1062,8 +1062,8 @@ hsGMaterial *hsMaterialConverter::ICreateMaterial(Mtl *mtl, plMaxNode *node, con return mat; } - Int32 i; - Int32 index(-1); + int32_t i; + int32_t index(-1); for (i = 0; i < fDoneMaterials.Count(); i++) { if (IsMatchingDoneMaterial(&fDoneMaterials[i], mtl, isMultiMat, subIndex, forceCopy, runtimeLit, @@ -1153,7 +1153,7 @@ hsGMaterial *hsMaterialConverter::IProcessMaterial(Mtl *mtl, plMaxNode *node, co } else if (IsHsMaxMat(mtl) || IsDecalMat(mtl) || IsBumpMtl( mtl ) ) { - hMat = TRACKED_NEW hsGMaterial; + hMat = new hsGMaterial; hsgResMgr::ResMgr()->NewKey(name, hMat,nodeLoc); IProcessPlasmaMaterial(mtl, node, hMat, hMat->GetKey()->GetName()); } @@ -1185,7 +1185,7 @@ hsGMaterial *hsMaterialConverter::IProcessMaterial(Mtl *mtl, plMaxNode *node, co if (fErrorMsg->Set((fWarned & kWarnedNoLayers) == 0, node->GetName(), "Material has no layers. (%s)", mtl->GetName()).CheckAndAsk()) fWarned |= kWarnedNoLayers; - plLayer* hLay = TRACKED_NEW plLayer; + plLayer* hLay = new plLayer; hLay->InitToDefault(); hsgResMgr::ResMgr()->NewKey(TSTR(name) + TSTR("_DefLay"), hLay, nodeLoc); IAddLayerToMaterial(hMat, hLay); @@ -1210,7 +1210,7 @@ hsGMaterial *hsMaterialConverter::IProcessMaterial(Mtl *mtl, plMaxNode *node, co } hsBool hsMaterialConverter::IsMatchingDoneMaterial(DoneMaterialData *dmd, - Mtl *mtl, hsBool isMultiMat, UInt32 subMtlFlags, hsBool forceCopy, hsBool runtimeLit, + Mtl *mtl, hsBool isMultiMat, uint32_t subMtlFlags, hsBool forceCopy, hsBool runtimeLit, plMaxNode *node, int numUVChannels, hsBool makeAlphaLayer) { if (!((dmd->fMaxMaterial == mtl) && @@ -1281,7 +1281,7 @@ hsBool hsMaterialConverter::IsMatchingDoneMaterial(DoneMaterialData *dmd, hsGMaterial* hsMaterialConverter::IInsertDoneMaterial(Mtl *mtl, hsGMaterial *hMat, plMaxNode *node, hsBool isMultiMat, - hsBool forceCopy, hsBool runtimeLit, UInt32 subMtlFlags, int numUVChannels, + hsBool forceCopy, hsBool runtimeLit, uint32_t subMtlFlags, int numUVChannels, hsBool makeAlphaLayer) { if( failedRT ) @@ -1336,17 +1336,17 @@ hsGMaterial *hsMaterialConverter::IAddDefaultMaterial(plMaxNode *node) plLocation loc = node->GetLocation(); - hsGMaterial *hMat = TRACKED_NEW hsGMaterial; + hsGMaterial *hMat = new hsGMaterial; hsgResMgr::ResMgr()->NewKey(TSTR(node->GetName()) + TSTR("_DefMat"), hMat, loc); - plLayer *layer = TRACKED_NEW plLayer; + plLayer *layer = new plLayer; layer->InitToDefault(); hsgResMgr::ResMgr()->NewKey(TSTR(hMat->GetKeyName()) + TSTR("_DefLay"), layer, loc); DWORD color = node->GetWireColor(); - hsScalar r = hsScalar(GetRValue(color)) / 255.f; - hsScalar g = hsScalar(GetGValue(color)) / 255.f; - hsScalar b = hsScalar(GetBValue(color)) / 255.f; + float r = float(GetRValue(color)) / 255.f; + float g = float(GetGValue(color)) / 255.f; + float b = float(GetBValue(color)) / 255.f; layer->SetRuntimeColor(hsColorRGBA().Set(r, g, b, 1.f)); layer->SetPreshadeColor(hsColorRGBA().Set(r, g, b, 1.f)); layer->SetOpacity(1.f); @@ -1369,7 +1369,7 @@ plMipmap *hsMaterialConverter::IGetUVTransTexture(plMaxNode *node, hsBool useU / plMipmap *texture = plBitmapCreator::Instance().CreateBlankMipmap( w, h, plMipmap::kARGB32Config, 1, texName, node->GetLocation() ); // set the color data - UInt32* pix = (UInt32*)texture->GetImage(); + uint32_t* pix = (uint32_t*)texture->GetImage(); int x, y; for (y = 0; y < h; y++) { @@ -1413,23 +1413,23 @@ void hsMaterialConverter::IInsertSingleBlendLayer(plMipmap *texture, hsGMaterial mat->SetCompositeFlags(mat->GetCompositeFlags() | hsGMaterial::kCompNeedsBlendChannel); - plLayer* layer = TRACKED_NEW plLayer; + plLayer* layer = new plLayer; layer->InitToDefault(); hsgResMgr::ResMgr()->NewKey(TSTR(underLay->GetKeyName()) + TSTR("_AlphaBlend"), layer, node->GetLocation()); - hsgResMgr::ResMgr()->AddViaNotify(texture->GetKey(), TRACKED_NEW plLayRefMsg(layer->GetKey(), plRefMsg::kOnCreate, 0, plLayRefMsg::kTexture), plRefFlags::kActiveRef); + hsgResMgr::ResMgr()->AddViaNotify(texture->GetKey(), new plLayRefMsg(layer->GetKey(), plRefMsg::kOnCreate, 0, plLayRefMsg::kTexture), plRefFlags::kActiveRef); layer->SetAmbientColor(hsColorRGBA().Set(1.f, 1.f, 1.f, 1.f)); // layer->SetZFlags(hsGMatState::kZNoZWrite | hsGMatState::kZIncLayer); // The inclayer prop probably wouldn't hurt here, because this layer should only get drawn as // an upper layer, but I'm nuking it out for consistency. mf layer->SetZFlags(hsGMatState::kZNoZWrite); - UInt32 blendFlags = hsGMatState::kBlendNoTexColor | hsGMatState::kBlendAlphaMult | hsGMatState::kBlendAlpha; + uint32_t blendFlags = hsGMatState::kBlendNoTexColor | hsGMatState::kBlendAlphaMult | hsGMatState::kBlendAlpha; layer->SetBlendFlags(blendFlags); layer->SetClampFlags(hsGMatState::kClampTexture); layer->SetUVWSrc(UVChan); layer->SetMiscFlags(0); // Insert it in the right spot. - hsgResMgr::ResMgr()->AddViaNotify(layer->GetKey(), TRACKED_NEW plMatRefMsg(mat->GetKey(), plRefMsg::kOnCreate, + hsgResMgr::ResMgr()->AddViaNotify(layer->GetKey(), new plMatRefMsg(mat->GetKey(), plRefMsg::kOnCreate, layerIdx, plMatRefMsg::kLayer | plMatRefMsg::kInsert), plRefFlags::kActiveRef); } @@ -1574,11 +1574,11 @@ hsGMaterial *hsMaterialConverter::IProcessCompositeMtl(Mtl *mtl, plMaxNode *node { if (!mtl || mtl->ClassID() != COMP_MTL_CLASS_ID) return nil; - UInt32 *layerCounts = TRACKED_NEW UInt32[mtl->NumSubMtls()]; + uint32_t *layerCounts = new uint32_t[mtl->NumSubMtls()]; IParamBlock2 *pb = mtl->GetParamBlockByID(plCompositeMtl::kBlkPasses); char suff[10]; sprintf(suff, "_%d", subMtlFlags); - hsGMaterial *mat = TRACKED_NEW hsGMaterial; + hsGMaterial *mat = new hsGMaterial; hsgResMgr::ResMgr()->NewKey(TSTR(name) + TSTR(suff), mat, node->GetLocation()); int multiIndex = IFindSubIndex(node, mtl); @@ -1610,7 +1610,7 @@ hsGMaterial *hsMaterialConverter::IProcessCompositeMtl(Mtl *mtl, plMaxNode *node { for (j = mat->GetNumLayers() - 1; j >= (int)layerCounts[i - 1]; j--) { - UInt32 blendFlags = mat->GetLayer(j)->GetBlendFlags(); + uint32_t blendFlags = mat->GetLayer(j)->GetBlendFlags(); if ((blendFlags & hsGMatState::kBlendMask) != hsGMatState::kBlendAlpha) { hsBool ignore = fErrorMsg->Set(!(fWarned & kWarnedCompMtlBadBlend), node->GetName(), @@ -1678,8 +1678,8 @@ hsGMaterial *hsMaterialConverter::IProcessMultipassMtl(Mtl *mtl, plMaxNode *node if (!mtl || mtl->ClassID() != MULTIMTL_CLASS_ID) return nil; - hsGMaterial *mat = TRACKED_NEW hsGMaterial; - UInt32 *layerCounts = TRACKED_NEW UInt32[mtl->NumSubMtls()]; + hsGMaterial *mat = new hsGMaterial; + uint32_t *layerCounts = new uint32_t[mtl->NumSubMtls()]; hsgResMgr::ResMgr()->NewKey(name, mat, node->GetLocation()); IParamBlock2 *pb = mtl->GetParamBlockByID(plMultipassMtl::kBlkPasses); @@ -1712,7 +1712,7 @@ hsGMaterial *hsMaterialConverter::IProcessParticleMtl(Mtl *mtl, plMaxNode *node, plLocation nodeLoc = node->GetLocation(); char* dbgNodeName = node->GetName(); - hsGMaterial *mat = TRACKED_NEW hsGMaterial; + hsGMaterial *mat = new hsGMaterial; hsgResMgr::ResMgr()->NewKey(name, mat,nodeLoc); @@ -1742,12 +1742,12 @@ hsGMaterial *hsMaterialConverter::IProcessParticleMtl(Mtl *mtl, plMaxNode *node, // // Blend flags // - UInt32 blendFlags = 0; + uint32_t blendFlags = 0; // // Shade flags // - UInt32 shadeFlags = 0; + uint32_t shadeFlags = 0; if (basicPB->GetInt(plParticleMtl::kNormal) == plParticleMtl::kEmissive) shadeFlags |= hsGMatState::kShadeEmissive; @@ -1761,12 +1761,12 @@ hsGMaterial *hsMaterialConverter::IProcessParticleMtl(Mtl *mtl, plMaxNode *node, // // Misc flags... // - UInt32 miscFlags = 0; + uint32_t miscFlags = 0; // // Z flags // - UInt32 zFlags = 0; + uint32_t zFlags = 0; zFlags |= hsGMatState::kZNoZWrite; hsBool preserveUVOffset = false;//PreserveUVOffset(mtl); @@ -1793,12 +1793,12 @@ hsGMaterial *hsMaterialConverter::IProcessParticleMtl(Mtl *mtl, plMaxNode *node, baseLay->SetSpecularColor( hsColorRGBA().Set(0,0,0,1.f) ); baseLay->SetSpecularPower( 0 ); - baseLay->SetAmbientColor(hsColorRGBA().Set(amb.r, amb.g, amb.b, hsScalar1)); - baseLay->SetRuntimeColor(hsColorRGBA().Set(col.r, col.g, col.b, hsScalar1)); + baseLay->SetAmbientColor(hsColorRGBA().Set(amb.r, amb.g, amb.b, 1.f)); + baseLay->SetRuntimeColor(hsColorRGBA().Set(col.r, col.g, col.b, 1.f)); baseLay->SetPreshadeColor(hsColorRGBA().Set(0.f,0.f,0.f,1.f)); baseLay->SetOpacity( opac ); // Don't scale the material color by this if we're add blending; do that later - UInt32 blendType = 0; + uint32_t blendType = 0; switch (basicPB->GetInt(plParticleMtl::kBlend)) { case plParticleMtl::kBlendAlpha: blendType |= hsGMatState::kBlendAlpha; break; @@ -1826,7 +1826,7 @@ plLayerAnimation *IConvertNoteTrackAnims(plLayerAnimation *animLayer, SegmentMap SegmentSpec *spec = it->second; if (spec->fType == SegmentSpec::kAnim) { - plLayerAnimation *noteAnim = TRACKED_NEW plLayerAnimation; + plLayerAnimation *noteAnim = new plLayerAnimation; TSTR animName = TSTR(name) + TSTR("_anim_") + TSTR(spec->fName); hsgResMgr::ResMgr()->NewKey(animName, noteAnim, node->GetLocation()); @@ -1870,8 +1870,8 @@ void ISetDefaultAnim(plPassMtlBase* mtl, plAnimTimeConvert& tc, SegmentMap* segM if (mtl->GetLoop()) { // Default to the entire anim - hsScalar loopStart = tc.GetBegin(); - hsScalar loopEnd = tc.GetEnd(); + float loopStart = tc.GetBegin(); + float loopEnd = tc.GetEnd(); // If there's a loop, use it const char *loopName = mtl->GetAnimLoopName(); @@ -1885,7 +1885,7 @@ void ISetDefaultAnim(plPassMtlBase* mtl, plAnimTimeConvert& tc, SegmentMap* segM tc.Loop(false); } -void StuffStopPoints(SegmentMap *segMap, hsTArray &out) +void StuffStopPoints(SegmentMap *segMap, hsTArray &out) { if (segMap == nil) return; @@ -2002,12 +2002,12 @@ static plLayerInterface* IProcessLayerMovie(plPassMtlBase* mtl, plLayerTex* layT if (isBink) { - movieLayer = TRACKED_NEW plLayerBink; + movieLayer = new plLayerBink; moviePostfix = "_bink"; } else if (isAvi) { - movieLayer = TRACKED_NEW plLayerAVI; + movieLayer = new plLayerAVI; moviePostfix = "_avi"; } @@ -2054,7 +2054,7 @@ plLayerInterface* IProcessLayerAnimation(plPassMtlBase* mtl, plLayerTex* layTex, if( mtl->GetUseGlobal() ) { - plLayerSDLAnimation *SDLLayer = TRACKED_NEW plLayerSDLAnimation; + plLayerSDLAnimation *SDLLayer = new plLayerSDLAnimation; TSTR animName = TSTR(name) + TSTR("_anim_") + TSTR(mtl->GetGlobalVarName()); hsgResMgr::ResMgr()->NewKey(animName, SDLLayer, node->GetLocation()); @@ -2075,7 +2075,7 @@ plLayerInterface* IProcessLayerAnimation(plPassMtlBase* mtl, plLayerTex* layTex, { plAnimStealthNode *stealth = mtl->GetStealth( i ); - plLayerAnimation *noteAnim = TRACKED_NEW plLayerAnimation; + plLayerAnimation *noteAnim = new plLayerAnimation; node->CheckSynchOptions(noteAnim); const char *segName = stealth->GetSegmentName(); @@ -2111,7 +2111,7 @@ plLayerInterface* IProcessAnimation(plPassMtlBase *mtl, plMaxNode *node, const c { hsControlConverter& cc = hsControlConverter::Instance(); - hsScalar maxLength = 0; + float maxLength = 0; // // Look for animations. These will get tacked onto the base pass layer Control *maxColCtl = mtl->GetPreshadeColorController(); @@ -2154,7 +2154,7 @@ plLayerInterface* IProcessAnimation(plPassMtlBase *mtl, plMaxNode *node, const c //if (!hsMaterialConverter::Instance().CheckValidityOfSDLVarAnim(mtl, mtl->GetGlobalVarName(), node)) // return layerIFace; - plLayerSDLAnimation *SDLLayer = TRACKED_NEW plLayerSDLAnimation; + plLayerSDLAnimation *SDLLayer = new plLayerSDLAnimation; TSTR animName = TSTR(name) + TSTR("_anim_") + TSTR(mtl->GetGlobalVarName()); hsgResMgr::ResMgr()->NewKey(animName, SDLLayer, node->GetLocation()); @@ -2190,7 +2190,7 @@ plLayerInterface* IProcessAnimation(plPassMtlBase *mtl, plMaxNode *node, const c { plAnimStealthNode *stealth = mtl->GetStealth( i ); - plLayerAnimation *noteAnim = TRACKED_NEW plLayerAnimation; + plLayerAnimation *noteAnim = new plLayerAnimation; node->CheckSynchOptions(noteAnim); const char *segName = stealth->GetSegmentName(); @@ -2329,7 +2329,7 @@ hsBool hsMaterialConverter::IProcessPlasmaMaterial(Mtl *mtl, plMaxNode *node, hs // // Blend flags // - UInt32 blendFlags = 0; + uint32_t blendFlags = 0; if( node->GetAlphaTestHigh() || passBase->GetAlphaTestHigh() ) blendFlags |= hsGMatState::kBlendAlphaTestHigh; @@ -2340,7 +2340,7 @@ hsBool hsMaterialConverter::IProcessPlasmaMaterial(Mtl *mtl, plMaxNode *node, hs // // Shade flags // - UInt32 shadeFlags = 0; + uint32_t shadeFlags = 0; if (passBase->GetSoftShadow()) shadeFlags |= hsGMatState::kShadeSoftShadow; if (passBase->GetNoProj()) @@ -2380,7 +2380,7 @@ hsBool hsMaterialConverter::IProcessPlasmaMaterial(Mtl *mtl, plMaxNode *node, hs // // Misc flags... // - UInt32 miscFlags = 0; + uint32_t miscFlags = 0; if (passBase->GetBasicWire()) miscFlags |= hsGMatState::kMiscWireFrame; if (passBase->GetMeshOutlines()) @@ -2391,7 +2391,7 @@ hsBool hsMaterialConverter::IProcessPlasmaMaterial(Mtl *mtl, plMaxNode *node, hs // // Z flags // - UInt32 zFlags = 0; + uint32_t zFlags = 0; if (passBase->GetZClear()) zFlags |= hsGMatState::kZClearZ; if (passBase->GetZNoRead()) @@ -2438,7 +2438,7 @@ hsBool hsMaterialConverter::IProcessPlasmaMaterial(Mtl *mtl, plMaxNode *node, hs // we have to set kMiscRestartPassHere on this layer if( mat->GetNumLayers() > 0 ) { - UInt32 lastShades = mat->GetLayer( mat->GetNumLayers() - 1 )->GetShadeFlags(); + uint32_t lastShades = mat->GetLayer( mat->GetNumLayers() - 1 )->GetShadeFlags(); if( ( lastShades ^ shadeFlags ) & hsGMatState::kShadeEmissive ) baseLay->SetMiscFlags( baseLay->GetMiscFlags() | hsGMatState::kMiscRestartPassHere ); @@ -2451,16 +2451,16 @@ hsBool hsMaterialConverter::IProcessPlasmaMaterial(Mtl *mtl, plMaxNode *node, hs if (baseLay->GetShadeFlags() & hsGMatState::kShadeSpecular) { - baseLay->SetSpecularColor( hsColorRGBA().Set( specColor.r, specColor.g, specColor.b, hsScalar1 ) ); + baseLay->SetSpecularColor( hsColorRGBA().Set( specColor.r, specColor.g, specColor.b, 1.f ) ); baseLay->SetSpecularPower(shine); } - baseLay->SetAmbientColor(hsColorRGBA().Set(amb.r, amb.g, amb.b, hsScalar1)); - baseLay->SetPreshadeColor(hsColorRGBA().Set(col.r, col.g, col.b, hsScalar1)); - baseLay->SetRuntimeColor(hsColorRGBA().Set(runDif.r, runDif.g, runDif.b, hsScalar1)); + baseLay->SetAmbientColor(hsColorRGBA().Set(amb.r, amb.g, amb.b, 1.f)); + baseLay->SetPreshadeColor(hsColorRGBA().Set(col.r, col.g, col.b, 1.f)); + baseLay->SetRuntimeColor(hsColorRGBA().Set(runDif.r, runDif.g, runDif.b, 1.f)); baseLay->SetOpacity( opac ); // Don't scale the material color by this if we're add blending; do that later - UInt32 blendType = 0; + uint32_t blendType = 0; switch (passBase->GetOutputBlend()) { case plPassMtlBase::kBlendAlpha: blendType |= hsGMatState::kBlendAlpha; break; @@ -2499,7 +2499,7 @@ hsBool hsMaterialConverter::IProcessPlasmaMaterial(Mtl *mtl, plMaxNode *node, hs if (texMap && ( plasmaTopLayer = plPlasmaMAXLayer::GetPlasmaMAXLayer( baseTex ) ) != nil ) { // Blend flags (do this first so we can pass it to IProcessPlasmaLayer()) - UInt32 blendIndex = passBase->GetLayerBlend(); + uint32_t blendIndex = passBase->GetLayerBlend(); if( needAlphaHack &&(passBase->GetOutputBlend() == plPassMtlBase::kBlendAlpha) &&(blendIndex == plPassMtlBase::kBlendAdd || blendIndex == plPassMtlBase::kBlendMult) ) @@ -2513,7 +2513,7 @@ hsBool hsMaterialConverter::IProcessPlasmaMaterial(Mtl *mtl, plMaxNode *node, hs fWarned |= kWarnedAlphaAddCombo; } - UInt32 blendType = 0; + uint32_t blendType = 0; switch (blendIndex) { case plPassMtlBase::kBlendAlpha: @@ -2550,13 +2550,13 @@ hsBool hsMaterialConverter::IProcessPlasmaMaterial(Mtl *mtl, plMaxNode *node, hs if (hLay->GetShadeFlags() & hsGMatState::kShadeSpecular) { - hLay->SetSpecularColor( hsColorRGBA().Set( specColor.r, specColor.g, specColor.b, hsScalar1 ) ); + hLay->SetSpecularColor( hsColorRGBA().Set( specColor.r, specColor.g, specColor.b, 1.f ) ); hLay->SetSpecularPower(shine); } - hLay->SetAmbientColor(hsColorRGBA().Set(amb.r, amb.g, amb.b, hsScalar1)); - hLay->SetPreshadeColor(hsColorRGBA().Set(col.r, col.g, col.b, hsScalar1)); - hLay->SetRuntimeColor(hsColorRGBA().Set(runDif.r, runDif.g, runDif.b, hsScalar1)); + hLay->SetAmbientColor(hsColorRGBA().Set(amb.r, amb.g, amb.b, 1.f)); + hLay->SetPreshadeColor(hsColorRGBA().Set(col.r, col.g, col.b, 1.f)); + hLay->SetRuntimeColor(hsColorRGBA().Set(runDif.r, runDif.g, runDif.b, 1.f)); hLay->SetOpacity( opac ); if( IsBumpLayer(texMap) || IsBumpMtl( mtl ) ) @@ -2627,7 +2627,7 @@ hsBool hsMaterialConverter::IProcessPlasmaMaterial(Mtl *mtl, plMaxNode *node, hs void hsMaterialConverter::IAddLayerToMaterial(hsGMaterial *mat, plLayerInterface *layer) { - plMatRefMsg* msg = TRACKED_NEW plMatRefMsg(mat->GetKey(), plRefMsg::kOnCreate, -1, plMatRefMsg::kLayer); + plMatRefMsg* msg = new plMatRefMsg(mat->GetKey(), plRefMsg::kOnCreate, -1, plMatRefMsg::kLayer); hsgResMgr::ResMgr()->AddViaNotify(layer->GetKey(), msg, plRefFlags::kActiveRef); } @@ -2713,7 +2713,7 @@ hsBool hsMaterialConverter::IUVGenHasDynamicScale(plMaxNode* node, StdUVGen *uvG hsGuardEnd; } -void hsMaterialConverter::IScaleLayerOpacity(plLayer* hLay, hsScalar scale) +void hsMaterialConverter::IScaleLayerOpacity(plLayer* hLay, float scale) { hsGuardBegin("hsMaterialConverter::IScaleLayerOpacity"); @@ -2724,7 +2724,7 @@ void hsMaterialConverter::IScaleLayerOpacity(plLayer* hLay, hsScalar scale) hLay->SetBlendFlags(hLay->GetBlendFlags() | hsGMatState::kBlendAlpha); } - hsScalar opac = hLay->GetOpacity(); + float opac = hLay->GetOpacity(); opac *= scale; hLay->SetOpacity(scale); } @@ -2792,9 +2792,9 @@ hsGMaterial *hsMaterialConverter::IWrapTextureInMaterial(Texmap *texMap, plMaxNo return hMat; } - hMat = TRACKED_NEW hsGMaterial; + hMat = new hsGMaterial; - plLayer* hLay = TRACKED_NEW plLayer; + plLayer* hLay = new plLayer; hLay->InitToDefault(); hsgResMgr::ResMgr()->NewKey(txtFileName, hLay,nodeLoc); @@ -2823,7 +2823,7 @@ hsGMaterial *hsMaterialConverter::IWrapTextureInMaterial(Texmap *texMap, plMaxNo hLay->SetPreshadeColor(hsColorRGBA().Set(1.f, 1.f, 1.f, 1.f)); hLay->SetOpacity(1.f); - UInt32 autoStart = 0; + uint32_t autoStart = 0; char *nodeName = node->GetName(); char *texName = bitmapTex->GetName(); // BEGIN OVERRIDE @@ -2894,7 +2894,7 @@ static float IClampToRange(float v, float lo, float hi) return v; } -UInt32 hsMaterialConverter::IGetOpacityRanges(plMaxNode* node, Texmap* texMap, hsScalar& tr0, hsScalar& op0, hsScalar& op1, hsScalar& tr1) +uint32_t hsMaterialConverter::IGetOpacityRanges(plMaxNode* node, Texmap* texMap, float& tr0, float& op0, float& op1, float& tr1) { if( node->HasFade() ) { @@ -2904,7 +2904,7 @@ UInt32 hsMaterialConverter::IGetOpacityRanges(plMaxNode* node, Texmap* texMap, h op1 = fade.Max()[1]; tr1 = fade.Max()[0]; - UInt32 funkyType = kFunkyDistance; + uint32_t funkyType = kFunkyDistance; if( (tr0 == op0) && (op1 == tr1) ) { @@ -2959,7 +2959,7 @@ UInt32 hsMaterialConverter::IGetOpacityRanges(plMaxNode* node, Texmap* texMap, h return kFunkyNone; } - UInt32 funkyType = IGetFunkyType(texMap); + uint32_t funkyType = IGetFunkyType(texMap); switch( funkyType & kFunkyMask ) { case kFunkyDistance: @@ -2984,7 +2984,7 @@ UInt32 hsMaterialConverter::IGetOpacityRanges(plMaxNode* node, Texmap* texMap, h } if( tr0 > tr1 ) { - hsScalar t; + float t; t = tr0; tr0 = tr1; tr1 = t; @@ -3010,22 +3010,22 @@ UInt32 hsMaterialConverter::IGetOpacityRanges(plMaxNode* node, Texmap* texMap, h break; case kFunkyNormal: case kFunkyUp: - tr0 = hsCosine(hsScalarDegToRad(tr0)); - op0 = hsCosine(hsScalarDegToRad(op0)); - op1 = hsCosine(hsScalarDegToRad(op1)); - tr1 = hsCosine(hsScalarDegToRad(tr1)); + tr0 = cos(hsDegreesToRadians(tr0)); + op0 = cos(hsDegreesToRadians(op0)); + op1 = cos(hsDegreesToRadians(op1)); + tr1 = cos(hsDegreesToRadians(tr1)); break; case kFunkyReflect: - tr0 = hsCosine(hsScalarDegToRad(tr0)); - op0 = hsCosine(hsScalarDegToRad(op0)); - op1 = hsCosine(hsScalarDegToRad(op1)); - tr1 = hsCosine(hsScalarDegToRad(tr1)); + tr0 = cos(hsDegreesToRadians(tr0)); + op0 = cos(hsDegreesToRadians(op0)); + op1 = cos(hsDegreesToRadians(op1)); + tr1 = cos(hsDegreesToRadians(tr1)); break; } return funkyType; } -UInt32 hsMaterialConverter::IGetFunkyType(Texmap* texMap) +uint32_t hsMaterialConverter::IGetFunkyType(Texmap* texMap) { if( texMap && texMap->GetName() && *texMap->GetName() ) { @@ -3058,7 +3058,7 @@ void hsMaterialConverter::IAppendFunkyLayer(plMaxNode* node, Texmap* texMap, hsG prevLay->SetMiscFlags(prevLay->GetMiscFlags() | hsGMatState::kMiscBindNext); float tr0, op0, op1, tr1; - UInt32 funkyType = IGetOpacityRanges(node, texMap, tr0, op0, op1, tr1); + uint32_t funkyType = IGetOpacityRanges(node, texMap, tr0, op0, op1, tr1); if( funkyType == kFunkyNone ) return; @@ -3093,17 +3093,17 @@ void hsMaterialConverter::IAppendFunkyLayer(plMaxNode* node, Texmap* texMap, hsG char name[512]; sprintf(name, "%s_funkRamp", prevLay->GetKey()->GetName()); - plLayer* layer = TRACKED_NEW plLayer; + plLayer* layer = new plLayer; layer->InitToDefault(); hsgResMgr::ResMgr()->NewKey(name, layer, node->GetLocation()); - hsgResMgr::ResMgr()->AddViaNotify(funkRamp->GetKey(), TRACKED_NEW plLayRefMsg(layer->GetKey(), plRefMsg::kOnCreate, 0, plLayRefMsg::kTexture), plRefFlags::kActiveRef); + hsgResMgr::ResMgr()->AddViaNotify(funkRamp->GetKey(), new plLayRefMsg(layer->GetKey(), plRefMsg::kOnCreate, 0, plLayRefMsg::kTexture), plRefFlags::kActiveRef); layer->SetAmbientColor(hsColorRGBA().Set(1.f, 1.f, 1.f, 1.f)); layer->SetPreshadeColor(hsColorRGBA().Set(0, 0, 0, 1.f)); layer->SetRuntimeColor(hsColorRGBA().Set(0, 0, 0, 1.f)); layer->SetZFlags(hsGMatState::kZNoZWrite); - UInt32 blendFlags = hsGMatState::kBlendAlpha | hsGMatState::kBlendNoTexColor | hsGMatState::kBlendAlphaMult; + uint32_t blendFlags = hsGMatState::kBlendAlpha | hsGMatState::kBlendNoTexColor | hsGMatState::kBlendAlphaMult; layer->SetBlendFlags(blendFlags); layer->SetClampFlags(hsGMatState::kClampTexture); @@ -3127,12 +3127,12 @@ void hsMaterialConverter::IAppendFunkyLayer(plMaxNode* node, Texmap* texMap, hsG break; } - hsgResMgr::ResMgr()->AddViaNotify(layer->GetKey(), TRACKED_NEW plMatRefMsg(mat->GetKey(), plRefMsg::kOnCreate, + hsgResMgr::ResMgr()->AddViaNotify(layer->GetKey(), new plMatRefMsg(mat->GetKey(), plRefMsg::kOnCreate, -1, plMatRefMsg::kLayer), plRefFlags::kActiveRef); } -plBitmap* hsMaterialConverter::IGetFunkyRamp(plMaxNode* node, UInt32 funkyType) +plBitmap* hsMaterialConverter::IGetFunkyRamp(plMaxNode* node, uint32_t funkyType) { const char* funkName = funkyType & kFunkyAdd ? "FunkyRampAdd" : "FunkyRampMult"; @@ -3145,7 +3145,7 @@ plBitmap* hsMaterialConverter::IGetFunkyRamp(plMaxNode* node, UInt32 funkyType) // necessary. -mcn plMipmap *texture = plBitmapCreator::Instance().CreateBlankMipmap( kLUTWidth, kLUTHeight, plMipmap::kARGB32Config, 1, funkName, node->GetLocation() ); - UInt32* pix = (UInt32*)texture->GetImage(); + uint32_t* pix = (uint32_t*)texture->GetImage(); if( funkyType & kFunkyAdd ) { @@ -3239,13 +3239,13 @@ void hsMaterialConverter::IAppendWetLayer(plMaxNode* node, hsGMaterial* mat) layer = plLayer::ConvertNoRef(key->GetObjectPtr()); if( !layer ) { - layer = TRACKED_NEW plLayer; + layer = new plLayer; layer->InitToDefault(); hsgResMgr::ResMgr()->NewKey(name, layer, node->GetLocation()); plBitmap* funkRamp = IGetFunkyRamp(node, kFunkyUp); - hsgResMgr::ResMgr()->AddViaNotify(funkRamp->GetKey(), TRACKED_NEW plLayRefMsg(layer->GetKey(), plRefMsg::kOnCreate, 0, plLayRefMsg::kTexture), plRefFlags::kActiveRef); + hsgResMgr::ResMgr()->AddViaNotify(funkRamp->GetKey(), new plLayRefMsg(layer->GetKey(), plRefMsg::kOnCreate, 0, plLayRefMsg::kTexture), plRefFlags::kActiveRef); } layer->SetAmbientColor(hsColorRGBA().Set(1.f, 1.f, 1.f, 1.f)); @@ -3253,7 +3253,7 @@ void hsMaterialConverter::IAppendWetLayer(plMaxNode* node, hsGMaterial* mat) layer->SetRuntimeColor(hsColorRGBA().Set(0, 0, 0, 1.f)); layer->SetZFlags(hsGMatState::kZNoZWrite); - UInt32 blendFlags = hsGMatState::kBlendAlpha | hsGMatState::kBlendNoTexColor | hsGMatState::kBlendAlphaMult; + uint32_t blendFlags = hsGMatState::kBlendAlpha | hsGMatState::kBlendNoTexColor | hsGMatState::kBlendAlphaMult; layer->SetBlendFlags(blendFlags); layer->SetClampFlags(hsGMatState::kClampTexture); @@ -3262,19 +3262,19 @@ void hsMaterialConverter::IAppendWetLayer(plMaxNode* node, hsGMaterial* mat) layer->SetUVWSrc(plLayerInterface::kUVWNormal); layer->SetMiscFlags(layer->GetMiscFlags() | hsGMatState::kMiscOrthoProjection); - hsgResMgr::ResMgr()->AddViaNotify(layer->GetKey(), TRACKED_NEW plMatRefMsg(mat->GetKey(), plRefMsg::kOnCreate, + hsgResMgr::ResMgr()->AddViaNotify(layer->GetKey(), new plMatRefMsg(mat->GetKey(), plRefMsg::kOnCreate, -1, plMatRefMsg::kLayer), plRefFlags::kActiveRef); } -hsBool hsMaterialConverter::HasVisDists(plMaxNode* node, int iSubMtl, hsScalar& minDist, hsScalar& maxDist) +hsBool hsMaterialConverter::HasVisDists(plMaxNode* node, int iSubMtl, float& minDist, float& maxDist) { const char* dbgNodeName = node->GetName(); const char* dbgMatName = node->GetMtl() ? node->GetMtl()->GetName() : "Dunno"; if( node->HasFade() ) { - const hsScalar kMaxMaxDist = 1.e10f; + const float kMaxMaxDist = 1.e10f; Box3 fade = node->GetFade(); minDist = maxDist = 0; if( fade.Min()[2] < 0 ) @@ -3300,7 +3300,7 @@ hsBool hsMaterialConverter::HasVisDists(plMaxNode* node, int iSubMtl, hsScalar& return HasVisDists(node, mtl, minDist, maxDist); } -hsBool hsMaterialConverter::HasVisDists(plMaxNode* node, Mtl* mtl, hsScalar& minDist, hsScalar& maxDist) +hsBool hsMaterialConverter::HasVisDists(plMaxNode* node, Mtl* mtl, float& minDist, float& maxDist) { const char* dbgNodeName = node->GetName(); const char* dbgMatName = node->GetMtl() ? node->GetMtl()->GetName() : "Dunno"; @@ -3328,8 +3328,8 @@ hsBool hsMaterialConverter::HasVisDists(plMaxNode* node, Mtl* mtl, hsScalar& min hsBool baseFunky = false; hsBool topFunky = true; plPassMtl* passMtl = (plPassMtl*)mtl; - hsScalar tr0, op0, op1, tr1; - UInt32 funkyType = IGetOpacityRanges(node, mtl->GetSubTexmap(0), tr0, op0, op1, tr1); + float tr0, op0, op1, tr1; + uint32_t funkyType = IGetOpacityRanges(node, mtl->GetSubTexmap(0), tr0, op0, op1, tr1); if( kFunkyDistance == (funkyType & kFunkyMask) ) { @@ -3375,7 +3375,7 @@ hsBool hsMaterialConverter::HasVisDists(plMaxNode* node, Mtl* mtl, hsScalar& min int i; for( i = 0; i < mtl->NumSubMtls(); i++ ) { - hsScalar minD, maxD; + float minD, maxD; if( !HasVisDists(node, mtl->GetSubMtl(i), minD, maxD) ) return false; @@ -3536,7 +3536,7 @@ plMipmap *hsMaterialConverter::IGetBumpLutTexture(plMaxNode *node) int doneH = 0; // set the color data - UInt32* pix = (UInt32*)texture->GetImage(); + uint32_t* pix = (uint32_t*)texture->GetImage(); int i; // Red ramps, one with G,B = 0,0, one with G,B = 127,127 @@ -3619,7 +3619,7 @@ plMipmap *hsMaterialConverter::IGetBumpLutTexture(plMaxNode *node) int doneH = 0; // set the color data - UInt32* pix = (UInt32*)texture->GetImage(); + uint32_t* pix = (uint32_t*)texture->GetImage(); int i; const float kWScale = 1.f; @@ -3697,7 +3697,7 @@ plMipmap *hsMaterialConverter::IGetBumpLutTexture(plMaxNode *node) return texture; } -plLayer* hsMaterialConverter::IMakeBumpLayer(plMaxNode* node, const char* nameBase, hsGMaterial* mat, UInt32 miscFlag) +plLayer* hsMaterialConverter::IMakeBumpLayer(plMaxNode* node, const char* nameBase, hsGMaterial* mat, uint32_t miscFlag) { char name[256]; switch( miscFlag & hsGMatState::kMiscBumpChans ) @@ -3718,17 +3718,17 @@ plLayer* hsMaterialConverter::IMakeBumpLayer(plMaxNode* node, const char* nameBa plMipmap* bumpLutTexture = IGetBumpLutTexture(node); - plLayer* layer = TRACKED_NEW plLayer; + plLayer* layer = new plLayer; layer->InitToDefault(); hsgResMgr::ResMgr()->NewKey(name, layer, node->GetLocation()); - hsgResMgr::ResMgr()->AddViaNotify(bumpLutTexture->GetKey(), TRACKED_NEW plLayRefMsg(layer->GetKey(), plRefMsg::kOnCreate, 0, plLayRefMsg::kTexture), plRefFlags::kActiveRef); + hsgResMgr::ResMgr()->AddViaNotify(bumpLutTexture->GetKey(), new plLayRefMsg(layer->GetKey(), plRefMsg::kOnCreate, 0, plLayRefMsg::kTexture), plRefFlags::kActiveRef); layer->SetAmbientColor(hsColorRGBA().Set(1.f, 1.f, 1.f, 1.f)); layer->SetPreshadeColor(hsColorRGBA().Set(0, 0, 0, 1.f)); layer->SetRuntimeColor(hsColorRGBA().Set(0, 0, 0, 1.f)); layer->SetZFlags(hsGMatState::kZNoZWrite); - UInt32 blendFlags = miscFlag & hsGMatState::kMiscBumpDu ? hsGMatState::kBlendMADD : hsGMatState::kBlendAdd; + uint32_t blendFlags = miscFlag & hsGMatState::kMiscBumpDu ? hsGMatState::kBlendMADD : hsGMatState::kBlendAdd; layer->SetBlendFlags(blendFlags); layer->SetClampFlags(hsGMatState::kClampTexture); layer->SetMiscFlags(miscFlag); @@ -3797,11 +3797,11 @@ void hsMaterialConverter::IInsertBumpLayers(plMaxNode* node, hsGMaterial* mat, i layerDu->SetBlendFlags((layerDu->GetBlendFlags() & ~hsGMatState::kBlendMask) | hsGMatState::kBlendAdd); // Insert it in the right spot. - hsgResMgr::ResMgr()->AddViaNotify(layerDv->GetKey(), TRACKED_NEW plMatRefMsg(mat->GetKey(), plRefMsg::kOnCreate, + hsgResMgr::ResMgr()->AddViaNotify(layerDv->GetKey(), new plMatRefMsg(mat->GetKey(), plRefMsg::kOnCreate, bumpLayerIdx, plMatRefMsg::kLayer | plMatRefMsg::kInsert), plRefFlags::kActiveRef); - hsgResMgr::ResMgr()->AddViaNotify(layerDw->GetKey(), TRACKED_NEW plMatRefMsg(mat->GetKey(), plRefMsg::kOnCreate, + hsgResMgr::ResMgr()->AddViaNotify(layerDw->GetKey(), new plMatRefMsg(mat->GetKey(), plRefMsg::kOnCreate, bumpLayerIdx, plMatRefMsg::kLayer | plMatRefMsg::kInsert), plRefFlags::kActiveRef); - hsgResMgr::ResMgr()->AddViaNotify(layerDu->GetKey(), TRACKED_NEW plMatRefMsg(mat->GetKey(), plRefMsg::kOnCreate, + hsgResMgr::ResMgr()->AddViaNotify(layerDu->GetKey(), new plMatRefMsg(mat->GetKey(), plRefMsg::kOnCreate, bumpLayerIdx, plMatRefMsg::kLayer | plMatRefMsg::kInsert), plRefFlags::kActiveRef); } @@ -3896,7 +3896,7 @@ hsBool hsMaterialConverter::ClearDoneMaterials(plMaxNode* node) if (isMultiMat) { hsBool retVal = false; - Int32 i; + int32_t i; for (i = 0; i < mtl->NumSubMtls(); i++) { retVal = retVal || IClearDoneMaterial(mtl->GetSubMtl(i), node); @@ -3926,7 +3926,7 @@ hsBool hsMaterialConverter::IClearDoneMaterial(Mtl* mtl, plMaxNode* node) fLastMaterial.fOwnedCopy = false; } - Int32 i; + int32_t i; for (i = fDoneMaterials.Count() - 1; i >= 0; --i) { if (fDoneMaterials[i].fMaxMaterial == mtl) @@ -3995,22 +3995,22 @@ BMM_Color_64 hsMaterialConverter::ICubeSample(Bitmap *bitmap[6], double phi, dou } else { - if( (theta <= (hsScalarPI / 2.0 - hsScalarPI/4.0)) - ||(theta >= (hsScalarPI * 2.0 - hsScalarPI/4.0)) ) + if( (theta <= (M_PI / 2.0 - M_PI/4.0)) + ||(theta >= (M_PI * 2.0 - M_PI/4.0)) ) { map = bitmap[VIEW_FR]; xMap = x / y; yMap = -z / y; } else - if( theta <= (hsScalarPI - hsScalarPI/4.0) ) + if( theta <= (M_PI - M_PI/4.0) ) { map = bitmap[VIEW_LF]; xMap = -y / x; yMap = -z / x; } else - if( theta <= (hsScalarPI * 3.0/2.0 - hsScalarPI/4.0) ) + if( theta <= (M_PI * 3.0/2.0 - M_PI/4.0) ) { map = bitmap[VIEW_BK]; xMap = x / y; @@ -4464,7 +4464,7 @@ Mtl* hsMaterialConverter::FindSceneMtlByName(TSTR& name) hsGuardEnd; } -int hsMaterialConverter::GetMaterialArray(Mtl *mtl, plMaxNode* node, hsTArray& out, UInt32 multiIndex /* = 0 */) +int hsMaterialConverter::GetMaterialArray(Mtl *mtl, plMaxNode* node, hsTArray& out, uint32_t multiIndex /* = 0 */) { hsTArray* arGh = CreateMaterialArray(mtl, node, multiIndex); int i; @@ -4498,7 +4498,7 @@ static void GetMtlNodes(Mtl *mtl, INodeTab& nodes) rm = di.Next(); } -int hsMaterialConverter::GetMaterialArray(Mtl *mtl, hsTArray& out, UInt32 multiIndex /* = 0 */) +int hsMaterialConverter::GetMaterialArray(Mtl *mtl, hsTArray& out, uint32_t multiIndex /* = 0 */) { INodeTab nodes; GetMtlNodes(mtl, nodes); @@ -4533,7 +4533,7 @@ void hsMaterialConverter::CollectConvertedMaterials(Mtl *mtl, hsTArraySetName(mtl->GetName()); cloth->fSortOrder = (mtl->GetDefault() ? 0 : 1); @@ -4553,7 +4553,7 @@ plClothingItem *hsMaterialConverter::GenerateClothingItem(plClothingMtl *mtl, co sprintf(clothKeyName, "CItm_%s", cloth->fName); hsgResMgr::ResMgr()->NewKey(clothKeyName, cloth, loc); - plNodeRefMsg* nodeRefMsg = TRACKED_NEW plNodeRefMsg(plKeyFinder::Instance().FindSceneNodeKey(loc), + plNodeRefMsg* nodeRefMsg = new plNodeRefMsg(plKeyFinder::Instance().FindSceneNodeKey(loc), plNodeRefMsg::kOnRequest, -1, plNodeRefMsg::kGeneric); hsgResMgr::ResMgr()->AddViaNotify(cloth->GetKey(), nodeRefMsg, plRefFlags::kActiveRef); @@ -4565,8 +4565,8 @@ plClothingItem *hsMaterialConverter::GenerateClothingItem(plClothingMtl *mtl, co { for (j = 0; j < plClothingElement::kLayerMax; j++) { - UInt32 clipLevels; - UInt32 startWidth; + uint32_t clipLevels; + uint32_t startWidth; char *elementName = tileset->fElements.Get(i)->fName; plPlasmaMAXLayer *layer = (plPlasmaMAXLayer *)mtl->GetTexmap(i, j); if (layer == nil || layer->GetPBBitmap() == nil) @@ -4589,7 +4589,7 @@ plClothingItem *hsMaterialConverter::GenerateClothingItem(plClothingMtl *mtl, co } continue; } - plElementRefMsg *eMsg = TRACKED_NEW plElementRefMsg(cloth->GetKey(), plRefMsg::kOnCreate, i, -1, elementName, j); + plElementRefMsg *eMsg = new plElementRefMsg(cloth->GetKey(), plRefMsg::kOnCreate, i, -1, elementName, j); hsgResMgr::ResMgr()->AddViaNotify(tex->GetKey(), eMsg, plRefFlags::kActiveRef); } } @@ -4606,7 +4606,7 @@ plClothingItem *hsMaterialConverter::GenerateClothingItem(plClothingMtl *mtl, co } if (thumbnail != nil) { - plGenRefMsg *msg= TRACKED_NEW plGenRefMsg(cloth->GetKey(), plRefMsg::kOnCreate, -1, -1); + plGenRefMsg *msg= new plGenRefMsg(cloth->GetKey(), plRefMsg::kOnCreate, -1, -1); hsgResMgr::ResMgr()->AddViaNotify(thumbnail->GetKey(), msg, plRefFlags::kActiveRef); } cloth->fDescription = hsStrcpy(mtl->GetDescription()); @@ -4693,31 +4693,31 @@ static int ICompareDoneLayers(const plLayerInterface* one, const plLayerInterfac return 1; } - retVal = Int32(one->GetBlendFlags()) - Int32(two->GetBlendFlags()); + retVal = int32_t(one->GetBlendFlags()) - int32_t(two->GetBlendFlags()); if( retVal < 0 ) return -1; else if( retVal > 0 ) return 1; - retVal = Int32(one->GetZFlags()) - Int32(two->GetZFlags()); + retVal = int32_t(one->GetZFlags()) - int32_t(two->GetZFlags()); if( retVal < 0 ) return -1; else if( retVal > 0 ) return 1; - retVal = Int32(one->GetClampFlags()) - Int32(two->GetClampFlags()); + retVal = int32_t(one->GetClampFlags()) - int32_t(two->GetClampFlags()); if( retVal < 0 ) return -1; else if( retVal > 0 ) return 1; - retVal = Int32(one->GetMiscFlags()) - Int32(two->GetMiscFlags()); + retVal = int32_t(one->GetMiscFlags()) - int32_t(two->GetMiscFlags()); if( retVal < 0 ) return -1; else if( retVal > 0 ) return 1; - retVal = Int32(one->GetShadeFlags()) - Int32(two->GetShadeFlags()); + retVal = int32_t(one->GetShadeFlags()) - int32_t(two->GetShadeFlags()); if( retVal < 0 ) return -1; else if( retVal > 0 ) @@ -5140,7 +5140,7 @@ hsMaterialConverter::DoneMaterialData* hsMaterialConverter::IFindDoneMaterial(Do plMipmap *hsMaterialConverter::GetStaticColorTexture(Color c, plLocation &loc) { char texName[256]; - UInt32 colorHex = MakeUInt32Color(c.r, c.g, c.b, 1.f); + uint32_t colorHex = MakeUInt32Color(c.r, c.g, c.b, 1.f); sprintf(texName, "StaticColorTex_4x4_%X", colorHex); int w = 4; @@ -5149,7 +5149,7 @@ plMipmap *hsMaterialConverter::GetStaticColorTexture(Color c, plLocation &loc) plMipmap *texture = plBitmapCreator::Instance().CreateBlankMipmap(w, h, plMipmap::kARGB32Config, 1, texName, loc ); // set the color data - UInt32* pix = (UInt32*)texture->GetImage(); + uint32_t* pix = (uint32_t*)texture->GetImage(); int x, y; for (y = 0; y < h; y++) diff --git a/Sources/Tools/MaxConvert/hsMaterialConverter.h b/Sources/Tools/MaxConvert/hsMaterialConverter.h index a1c55d84..492d3ff5 100644 --- a/Sources/Tools/MaxConvert/hsMaterialConverter.h +++ b/Sources/Tools/MaxConvert/hsMaterialConverter.h @@ -90,7 +90,7 @@ class hsBitVector; class plExportMaterialData { public: - UInt32 fNumBlendChannels; + uint32_t fNumBlendChannels; hsGMaterial *fMaterial; }; @@ -138,10 +138,10 @@ public: static int GetCoordMapping(StdUVGen *uvgen); static void GetNodesByMaterial(Mtl *mtl, hsTArray &out); - static UInt32 VertexChannelsRequestMask(plMaxNode* node, int iSubMtl, Mtl* mtl); - static UInt32 VertexChannelsRequiredMask(plMaxNode* node, int iSubMtl); + static uint32_t VertexChannelsRequestMask(plMaxNode* node, int iSubMtl, Mtl* mtl); + static uint32_t VertexChannelsRequiredMask(plMaxNode* node, int iSubMtl); static int NumVertexOpacityChannelsRequired(plMaxNode* node, int iSubMtl); - static UInt32 ColorChannelsUseMask(plMaxNode* node, int iSubMtl); + static uint32_t ColorChannelsUseMask(plMaxNode* node, int iSubMtl); static int MaxUsedUVWSrc(plMaxNode* node, Mtl* mtl); @@ -150,8 +150,8 @@ public: static hsBool HasBumpLayer(plMaxNode* node, Mtl* mtl); static BitmapTex* GetBumpLayer(plMaxNode* node, Mtl* mtl); - static hsBool HasVisDists(plMaxNode* node, Mtl* subMtl, hsScalar& minDist, hsScalar& maxDist); - static hsBool HasVisDists(plMaxNode* node, int iSubMtl, hsScalar& minDist, hsScalar& maxDist); + static hsBool HasVisDists(plMaxNode* node, Mtl* subMtl, float& minDist, float& maxDist); + static hsBool HasVisDists(plMaxNode* node, int iSubMtl, float& minDist, float& maxDist); static hsBool IMustBeUniqueMaterial( Mtl *mtl ); static hsBool IMustBeUniqueLayer( Texmap *layer ); @@ -159,7 +159,7 @@ public: static Mtl* FindSubMtlByName(TSTR& name, Animatable* anim); Mtl* FindSceneMtlByName(TSTR& name); - hsTArray *CreateMaterialArray(Mtl *maxMaterial, plMaxNode *node, UInt32 multiIndex); + hsTArray *CreateMaterialArray(Mtl *maxMaterial, plMaxNode *node, uint32_t multiIndex); // true if last material creation changed MAX time, invalidating current mesh hsBool ChangedTimes() { return fChangedTimes; } @@ -168,15 +168,15 @@ public: hsBool ClearDoneMaterials(plMaxNode* node); - int GetMaterialArray(Mtl *mtl, plMaxNode* node, hsTArray& out, UInt32 multiIndex = 0 ); - int GetMaterialArray(Mtl *mtl, hsTArray& out, UInt32 multiIndex = 0); + int GetMaterialArray(Mtl *mtl, plMaxNode* node, hsTArray& out, uint32_t multiIndex = 0 ); + int GetMaterialArray(Mtl *mtl, hsTArray& out, uint32_t multiIndex = 0); void CollectConvertedMaterials(Mtl *mtl, hsTArray &out); plClothingItem *GenerateClothingItem(plClothingMtl *mtl, const plLocation &loc); hsGMaterial* AlphaHackVersion(plMaxNode* node, Mtl* mtl, int subIndex); // used by DynamicDecals hsGMaterial* NonAlphaHackVersion(plMaxNode* node, Mtl* mtl, int subIndex); - hsGMaterial* AlphaHackPrint(plMaxNode* node, Texmap* baseTex, UInt32 blendFlags); - hsGMaterial* NonAlphaHackPrint(plMaxNode* node, Texmap* baseTex, UInt32 blendFlags); + hsGMaterial* AlphaHackPrint(plMaxNode* node, Texmap* baseTex, uint32_t blendFlags); + hsGMaterial* NonAlphaHackPrint(plMaxNode* node, Texmap* baseTex, uint32_t blendFlags); plMipmap* GetStaticColorTexture(Color c, plLocation &loc); // Creates a 4x4 texture of the specified solid color; @@ -235,7 +235,7 @@ enum { hsBool fSubMultiMat; hsBool fOwnedCopy; hsBool fRuntimeLit; - UInt32 fSubMtlFlags; + uint32_t fSubMtlFlags; int fNumUVChannels; hsBool fMakeAlphaLayer; }; @@ -275,11 +275,11 @@ private: hsBool IProcessPlasmaMaterial(Mtl *mtl, plMaxNode *node, hsGMaterial *mat, const char* namePrefix); hsGMaterial* IInsertDoneMaterial(Mtl *mtl, hsGMaterial *hMat, plMaxNode *node, hsBool isMultiMat, - hsBool forceCopy, hsBool runtimeLit, UInt32 subMtlFlags, int numUVChannels, hsBool makeAlphaLayer); + hsBool forceCopy, hsBool runtimeLit, uint32_t subMtlFlags, int numUVChannels, hsBool makeAlphaLayer); void IInsertBumpLayers(plMaxNode* node, hsGMaterial* mat, int bumpLayerIdx); void IInsertBumpLayers(plMaxNode* node, hsGMaterial* mat); - plLayer* IMakeBumpLayer(plMaxNode* node, const char* nameBase, hsGMaterial* mat, UInt32 miscFlag); + plLayer* IMakeBumpLayer(plMaxNode* node, const char* nameBase, hsGMaterial* mat, uint32_t miscFlag); plMipmap* IGetBumpLutTexture(plMaxNode* node); hsBool IHasSubMtl(Mtl* base, Mtl* sub); @@ -303,7 +303,7 @@ private: #endif // ... and so forth hsBool IUVGenHasDynamicScale(plMaxNode* node, StdUVGen *uvGen); - void IScaleLayerOpacity(plLayer* hLay, hsScalar scale); + void IScaleLayerOpacity(plLayer* hLay, float scale); hsGMaterial *ICheckForProjectedTexture(plMaxNode *node); hsGMaterial *IWrapTextureInMaterial(Texmap *texMap, plMaxNode *node); @@ -311,43 +311,43 @@ private: BMM_Color_64 ICubeSample(Bitmap *bitmap[6], double phi, double theta); void IBuildSphereMap(Bitmap *bitmap[6], Bitmap *bm); #if 0 // DEFER_ANIM_MAT - void IProcessAnimMaterial(BitmapTex *bitmapTex, hsGAnimLayer* at, UInt32 texFlags, UInt32 procFlags); + void IProcessAnimMaterial(BitmapTex *bitmapTex, hsGAnimLayer* at, uint32_t texFlags, uint32_t procFlags); #endif // DEFER_ANIM_MAT static hsBool ITextureTransformIsAnimated(Texmap *texmap); static hsBool IHasAnimatedControllers(Animatable* anim); static hsBool IIsAnimatedTexmap(Texmap* texmap); - static UInt32 ICheckPoints(const Point3& p0, const Point3& p1, const Point3& p2, const Point3& p3, + static uint32_t ICheckPoints(const Point3& p0, const Point3& p1, const Point3& p2, const Point3& p3, int chan, - UInt32 mBlack, UInt32 mGrey, UInt32 mWhite); - static UInt32 ICheckPoints(const Point3& p0, const Point3& p1, const Point3& p2, + uint32_t mBlack, uint32_t mGrey, uint32_t mWhite); + static uint32_t ICheckPoints(const Point3& p0, const Point3& p1, const Point3& p2, int chan, - UInt32 mBlack, UInt32 mGrey, UInt32 mWhite); + uint32_t mBlack, uint32_t mGrey, uint32_t mWhite); void IAppendWetLayer(plMaxNode* node, hsGMaterial* mat); - static plBitmap* IGetFunkyRamp(plMaxNode* node, UInt32 funkyType); + static plBitmap* IGetFunkyRamp(plMaxNode* node, uint32_t funkyType); static void IAppendFunkyLayer(plMaxNode* node, Texmap* texMap, hsGMaterial* mat); static hsBool IHasFunkyOpacity(plMaxNode* node, Texmap* texMap); - static UInt32 IGetFunkyType(Texmap* texMap); - static UInt32 IGetOpacityRanges(plMaxNode* node, Texmap* texMap, hsScalar& tr0, hsScalar& op0, hsScalar& op1, hsScalar& tr1); + static uint32_t IGetFunkyType(Texmap* texMap); + static uint32_t IGetOpacityRanges(plMaxNode* node, Texmap* texMap, float& tr0, float& op0, float& op1, float& tr1); Interface *fInterface; hsConverterUtils& fConverterUtils; hsBool fSave; plErrorMsg *fErrorMsg; - Int32 fSubIndex; + int32_t fSubIndex; hsBool fChangedTimes; char *fNodeName; - UInt32 fWarned; + uint32_t fWarned; DoneMaterialData fLastMaterial; hsTArray fDoneMaterials; hsBool IsMatchingDoneMaterial(DoneMaterialData *dmd, - Mtl *mtl, hsBool isMultiMat, UInt32 subMtlFlags, hsBool forceCopy, hsBool runtimeLit, + Mtl *mtl, hsBool isMultiMat, uint32_t subMtlFlags, hsBool forceCopy, hsBool runtimeLit, plMaxNode *node, int numUVChannels, hsBool makeAlphaLayer); void ISortDoneMaterials(hsTArray& doneMats); diff --git a/Sources/Tools/MaxConvert/hsVertexShader.cpp b/Sources/Tools/MaxConvert/hsVertexShader.cpp index 7916aa90..df3dc9a7 100644 --- a/Sources/Tools/MaxConvert/hsVertexShader.cpp +++ b/Sources/Tools/MaxConvert/hsVertexShader.cpp @@ -184,8 +184,8 @@ void hsVertexShader::IShadeSpan( plGeometrySpan *span, INode* node ) if( span->fNumVerts == 0 ) return; - fShadeColorTable = TRACKED_NEW hsColorRGBA[ span->fNumVerts ]; - fIllumColorTable = TRACKED_NEW hsColorRGBA[ span->fNumVerts ]; + fShadeColorTable = new hsColorRGBA[ span->fNumVerts ]; + fIllumColorTable = new hsColorRGBA[ span->fNumVerts ]; translucent = IsTranslucent( span->fMaterial ); @@ -372,7 +372,7 @@ void hsVertexShader::IShadeVertices( plGeometrySpan *span, hsBitVector *dirtyVec /// Allocate temp vertex array - vertices = TRACKED_NEW plTmpVertex3[ span->fNumVerts ]; + vertices = new plTmpVertex3[ span->fNumVerts ]; for( index = 0; index < span->fNumVerts; index++ ) { span->ExtractVertex( index, &position, &normal, &color, &illum ); diff --git a/Sources/Tools/MaxConvert/plBitmapCreator.cpp b/Sources/Tools/MaxConvert/plBitmapCreator.cpp index 03284018..4d3afa16 100644 --- a/Sources/Tools/MaxConvert/plBitmapCreator.cpp +++ b/Sources/Tools/MaxConvert/plBitmapCreator.cpp @@ -39,7 +39,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com Mead, WA 99021 *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "max.h" #include #include "bmmlib.h" @@ -168,7 +168,7 @@ plMipmap *plBitmapCreator::ICreateBitmap(plBitmapData *bd) // // Create a plMipmap // - plMipmap *hBitmap = TRACKED_NEW plMipmap; + plMipmap *hBitmap = new plMipmap; if( (bm->Width() ^ (bm->Width() & -bm->Width())) ||(bm->Height() ^ (bm->Height() & -bm->Height())) ) { @@ -191,12 +191,12 @@ plMipmap *plBitmapCreator::ICreateBitmap(plBitmapData *bd) plMipmap *hMipmap = nil; if (sigma > 0.f) { - hMipmap = TRACKED_NEW plMipmap(hBitmap, sigma, bd->createFlags, bd->detailDropoffStart, + hMipmap = new plMipmap(hBitmap, sigma, bd->createFlags, bd->detailDropoffStart, bd->detailDropoffStop, bd->detailMax, bd->detailMin); } else { - hMipmap = TRACKED_NEW plMipmap(hBitmap, -1.f, bd->createFlags, bd->detailDropoffStart, + hMipmap = new plMipmap(hBitmap, -1.f, bd->createFlags, bd->detailDropoffStart, bd->detailDropoffStop, bd->detailMax, bd->detailMin); } delete hBitmap; @@ -220,7 +220,7 @@ plMipmap *plBitmapCreator::ICreateBitmap(plBitmapData *bd) hBitmap = hMipmap; - UInt32 flagsToSet = 0; + uint32_t flagsToSet = 0; if( bd->texFlags & plMipmap::kNoMaxSize ) flagsToSet |= plMipmap::kNoMaxSize; @@ -587,7 +587,7 @@ plBitmap *plBitmapCreator::ICreateTexture( plBitmapData *bd, const plLocation &l // If it hasn't been used before, make a new texture if( bd->isStaticCubicEnvMap ) { - plCubicEnvironmap *cubic = TRACKED_NEW plCubicEnvironmap; + plCubicEnvironmap *cubic = new plCubicEnvironmap; plMipmap *face; @@ -671,7 +671,7 @@ void plBitmapCreator::IAddBitmap( plBitmap *bitmap, hsBool dontRef ) // Simple mipmap creator, but importantly, it also adds the mipmap to the list // of "converted" maps to clean up at the end of export. -plMipmap *plBitmapCreator::CreateBlankMipmap( UInt32 width, UInt32 height, unsigned config, UInt8 numLevels, +plMipmap *plBitmapCreator::CreateBlankMipmap( uint32_t width, uint32_t height, unsigned config, uint8_t numLevels, const char *keyName, const plLocation &keyLocation ) { hsGuardBegin( "plBitmapCreator::CreateBlankMipmap" ); @@ -685,7 +685,7 @@ plMipmap *plBitmapCreator::CreateBlankMipmap( UInt32 width, UInt32 height, un return plMipmap::ConvertNoRef( key->GetObjectPtr() ); // Create - plMipmap *mip = TRACKED_NEW plMipmap( width, height, config, numLevels ); + plMipmap *mip = new plMipmap( width, height, config, numLevels ); // Assign key hsgResMgr::ResMgr()->NewKey( keyName, mip, textureLoc ); diff --git a/Sources/Tools/MaxConvert/plBitmapCreator.h b/Sources/Tools/MaxConvert/plBitmapCreator.h index 8d40e577..5942c3b6 100644 --- a/Sources/Tools/MaxConvert/plBitmapCreator.h +++ b/Sources/Tools/MaxConvert/plBitmapCreator.h @@ -39,7 +39,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com Mead, WA 99021 *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "pnKeyedObject/plKey.h" class BitmapInfo; @@ -61,18 +61,18 @@ public: }; const char *fileName; - UInt32 texFlags; - UInt32 createFlags; - hsScalar detailDropoffStart; - hsScalar detailDropoffStop; - hsScalar detailMax; - hsScalar detailMin; + uint32_t texFlags; + uint32_t createFlags; + float detailDropoffStart; + float detailDropoffStop; + float detailMax; + float detailMin; float sig; hsBool isStaticCubicEnvMap; hsBool invertAlpha; const char *faceNames[ 6 ]; - UInt32 maxDimension; - UInt8 clampFlags; + uint32_t maxDimension; + uint8_t clampFlags; bool useJPEG; plBitmapData() @@ -100,7 +100,7 @@ class plBitmapCreator static plBitmapCreator &Instance(); plBitmap *CreateTexture( plBitmapData *bd, const plLocation &loc, int clipID = -1 ); - plMipmap *CreateBlankMipmap( UInt32 width, UInt32 height, unsigned config, UInt8 numLevels, const char *keyName, const plLocation &keyLocation ); + plMipmap *CreateBlankMipmap( uint32_t width, uint32_t height, unsigned config, uint8_t numLevels, const char *keyName, const plLocation &keyLocation ); void Init( hsBool save, plErrorMsg *msg ); void DeInit( void ); diff --git a/Sources/Tools/MaxConvert/plClusterUtil.cpp b/Sources/Tools/MaxConvert/plClusterUtil.cpp index cd872ca5..79fdd347 100644 --- a/Sources/Tools/MaxConvert/plClusterUtil.cpp +++ b/Sources/Tools/MaxConvert/plClusterUtil.cpp @@ -40,7 +40,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ -#include "hsWindows.h" +#include "HeadSpin.h" #include #include "Max.h" @@ -49,7 +49,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "iparamb2.h" #include "meshdlib.h" -#include "hsTypes.h" +#include "HeadSpin.h" #include #include @@ -85,7 +85,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com plConst(int) kDefMinFaces(200); plConst(int) kDefMaxFaces(1000); -plConst(hsScalar) kDefMinSize(50.f); +plConst(float) kDefMinSize(50.f); plClusterUtil::plClusterUtil() : fGroup(nil), @@ -104,7 +104,7 @@ plClusterUtil::~plClusterUtil() plClusterGroup* plClusterUtil::CreateGroup(plMaxNode* templNode, const char* name) { - plClusterGroup* retVal = TRACKED_NEW plClusterGroup; + plClusterGroup* retVal = new plClusterGroup; char buff[256]; sprintf(buff, "%s_%s_%d", name, templNode->GetName(), fIdx++); @@ -113,7 +113,7 @@ plClusterGroup* plClusterUtil::CreateGroup(plMaxNode* templNode, const char* nam plKey sceneNode = templNode->GetRoomKey(); retVal->SetSceneNode(sceneNode); - plNodeRefMsg* refMsg = TRACKED_NEW plNodeRefMsg(sceneNode, plRefMsg::kOnCreate, -1, plNodeRefMsg::kGeneric); + plNodeRefMsg* refMsg = new plNodeRefMsg(sceneNode, plRefMsg::kOnCreate, -1, plNodeRefMsg::kGeneric); hsgResMgr::ResMgr()->AddViaNotify(retVal->GetKey(), refMsg, plRefFlags::kActiveRef); return retVal; @@ -159,11 +159,11 @@ void plClusterUtil::ISetupGroupFromTemplate(plMaxNode* templ) } if( templ->HasFade() ) { - hsScalar maxDist = 0; - hsScalar minDist = 0; + float maxDist = 0; + float minDist = 0; Box3 fade = templ->GetFade(); - const hsScalar kMaxMaxDist = 1.e10f; + const float kMaxMaxDist = 1.e10f; if( fade.Min()[2] < 0 ) { minDist = fade.Min()[0]; @@ -194,13 +194,13 @@ void plClusterUtil::ISetupGroupFromTemplate(plMaxNode* templ) class sortData { public: - UInt16 fIdx0; - UInt16 fIdx1; - UInt16 fIdx2; - hsScalar fDist; + uint16_t fIdx0; + uint16_t fIdx1; + uint16_t fIdx2; + float fDist; sortData() {} - sortData(UInt16 idx0, UInt16 idx1, UInt16 idx2, hsScalar dist) + sortData(uint16_t idx0, uint16_t idx1, uint16_t idx2, float dist) : fIdx0(idx0), fIdx1(idx1), fIdx2(idx2), fDist(dist) { } @@ -213,7 +213,7 @@ public: void plClusterUtil::ISortTemplate(plSpanTemplateB* templ) const { - UInt16* indexData = templ->fIndices; + uint16_t* indexData = templ->fIndices; const int numTris = templ->NumTris(); typedef std::vector sortVec; sortVec vec; @@ -258,7 +258,7 @@ void plClusterUtil::ISortTemplate(plSpanTemplateB* templ) const void plClusterUtil::ITemplateFromGeo(plSpanTemplateB* templ, plGeometrySpan* geo) { - UInt16 format = plSpanTemplate::MakeFormat( + uint16_t format = plSpanTemplate::MakeFormat( true, // hasColor geo->GetNumUVs(), // UVW count geo->fFormat & plGeometrySpan::kSkinIndices, // hasWgtIdx @@ -268,20 +268,20 @@ void plClusterUtil::ITemplateFromGeo(plSpanTemplateB* templ, plGeometrySpan* geo ); - UInt32 numVerts = geo->fNumVerts; - UInt32 numTris = geo->fNumIndices / 3; + uint32_t numVerts = geo->fNumVerts; + uint32_t numTris = geo->fNumIndices / 3; // Alloc it. templ->Alloc(format, numVerts, numTris); templ->AllocColors(); - UInt32 numPos = templ->NumPos(); - UInt32 numNorm = templ->NumNorm(); - UInt32 numUVWs = templ->NumUVWs(); - UInt32 numWeights = templ->NumWeights(); - UInt32 numColor = templ->NumColor(); - UInt32 numColor2 = templ->NumColor2(); - UInt32 numWgtIdx = templ->NumWgtIdx(); + uint32_t numPos = templ->NumPos(); + uint32_t numNorm = templ->NumNorm(); + uint32_t numUVWs = templ->NumUVWs(); + uint32_t numWeights = templ->NumWeights(); + uint32_t numColor = templ->NumColor(); + uint32_t numColor2 = templ->NumColor2(); + uint32_t numWgtIdx = templ->NumWgtIdx(); // Fill in the data. memcpy(templ->fIndices, geo->fIndexData, templ->IndexSize()); @@ -290,7 +290,7 @@ void plClusterUtil::ITemplateFromGeo(plSpanTemplateB* templ, plGeometrySpan* geo for( i = 0; i < templ->NumVerts(); i++ ) { float wgt[4]; - UInt32 wgtIdx; + uint32_t wgtIdx; geo->ExtractInitColor(i, templ->MultColor(i), templ->AddColor(i)); @@ -331,7 +331,7 @@ plSpanTemplateB* plClusterUtil::IAddTemplate(plMaxNode* templNode, plGeometrySpa // STUB // Create our blank template - plSpanTemplateB* templ = TRACKED_NEW plSpanTemplateB(templNode); + plSpanTemplateB* templ = new plSpanTemplateB(templNode); templ->fRenderLevel = templNode->GetRenderLevel(!templNode->GetNoDeferDraw()); @@ -508,7 +508,7 @@ void plClusterUtil::IFindClustersRecur(plSpanTemplateB* templ, plL2WTab& src, pl } else { - plL2WTab* tab = TRACKED_NEW plL2WTab(src); + plL2WTab* tab = new plL2WTab(src); dst.Append(1, &tab); } } @@ -520,19 +520,19 @@ void plClusterUtil::IFreeClustersRecur(plL2WTabTab& dst) const delete dst[i]; } -inline hsScalar inlGetAlpha(UInt32* color) +inline float inlGetAlpha(uint32_t* color) { - return hsScalar(*color >> 24) / 255.99f; + return float(*color >> 24) / 255.99f; } plSpanEncoding plClusterUtil::ISelectEncoding(plPoint3TabTab& delPosTab, plColorTabTab& colorsTab) { hsBool hasColor = false; hsBool hasAlpha = false; - hsScalar maxLenSq = 0; - hsScalar maxX = 0; - hsScalar maxY = 0; - hsScalar maxZ = 0; + float maxLenSq = 0; + float maxX = 0; + float maxY = 0; + float maxZ = 0; int i; for( i = 0; i < delPosTab.Count(); i++ ) { @@ -542,10 +542,10 @@ plSpanEncoding plClusterUtil::ISelectEncoding(plPoint3TabTab& delPosTab, plColor plPoint3Tab& delPos = *delPosTab[i]; for( j = 0; j < delPos.Count(); j++ ) { - hsScalar lenSq = delPos[j].MagnitudeSquared(); + float lenSq = delPos[j].MagnitudeSquared(); if( lenSq > maxLenSq ) maxLenSq = lenSq; - hsScalar d = fabs(delPos[j].fX); + float d = fabs(delPos[j].fX); if( d > maxX ) maxX = d; d = fabs(delPos[j].fY); @@ -563,7 +563,7 @@ plSpanEncoding plClusterUtil::ISelectEncoding(plPoint3TabTab& delPosTab, plColor plColorTab& color = *colorsTab[i]; for( j = 0; j < color.Count(); j++ ) { - UInt32 col = color[j]; + uint32_t col = color[j]; if( (col & 0x00ffffff) != 0x00ffffff ) hasColor = true; if( (col & 0xff000000) != 0xff000000 ) @@ -572,8 +572,8 @@ plSpanEncoding plClusterUtil::ISelectEncoding(plPoint3TabTab& delPosTab, plColor } } - UInt32 code = 0; - hsScalar posScale = 1.f; + uint32_t code = 0; + float posScale = 1.f; if( hasColor && hasAlpha ) code |= plSpanEncoding::kColAI88; @@ -582,8 +582,8 @@ plSpanEncoding plClusterUtil::ISelectEncoding(plPoint3TabTab& delPosTab, plColor else if( hasAlpha ) code |= plSpanEncoding::kColA8; - plConst(hsScalar) kPosQuantum(0.5 / 12.f); // 1/2 inch. - hsScalar maxLen = hsSquareRoot(maxLenSq); + plConst(float) kPosQuantum(0.5 / 12.f); // 1/2 inch. + float maxLen = sqrt(maxLenSq); if( maxLen > kPosQuantum ) { if( (maxX < kPosQuantum) && (maxY < kPosQuantum) ) @@ -596,15 +596,15 @@ plSpanEncoding plClusterUtil::ISelectEncoding(plPoint3TabTab& delPosTab, plColor code |= plSpanEncoding::kPos888; posScale = maxLen / 255.9f; } - else if( (maxLen / hsScalar(1 << 10)) < kPosQuantum ) + else if( (maxLen / float(1 << 10)) < kPosQuantum ) { code |= plSpanEncoding::kPos101010; - posScale = maxLen / hsScalar(1 << 10); + posScale = maxLen / float(1 << 10); } else { code |= plSpanEncoding::kPos161616; - posScale = maxLen / hsScalar(1 << 16); + posScale = maxLen / float(1 << 16); } } return plSpanEncoding(code, posScale); @@ -615,8 +615,8 @@ static int CompTemplates(const void *elem1, const void *elem2) plSpanTemplateB* templA = *((plSpanTemplateB**)elem1); plSpanTemplateB* templB = *((plSpanTemplateB**)elem2); - hsScalar hA = templA->GetLocalBounds().GetMaxs().fZ; - hsScalar hB = templB->GetLocalBounds().GetMaxs().fZ; + float hA = templA->GetLocalBounds().GetMaxs().fZ; + float hB = templB->GetLocalBounds().GetMaxs().fZ; if( hA < hB ) return -1; @@ -692,7 +692,7 @@ void plClusterUtil::IAddInstsToCluster(plCluster* cluster, plSpanTemplateB* temp int i; for( i = 0; i < insts.Count(); i++ ) { - plSpanInstance* span = TRACKED_NEW plSpanInstance; + plSpanInstance* span = new plSpanInstance; span->Alloc(cluster->GetEncoding(), templ->NumVerts()); span->SetLocalToWorld(plMaxNodeBase::Matrix3ToMatrix44(insts[i])); @@ -754,7 +754,7 @@ void plClusterUtil::IDelPosAndColor(plSpanTemplateB* templ, { def->Begin(templ->GetSrcNode(), wBnd); - delPos[i] = TRACKED_NEW plPoint3Tab; + delPos[i] = new plPoint3Tab; delPos[i]->SetCount(templ->NumVerts()); int j; for( j = 0; j < templ->NumVerts(); j++ ) @@ -770,13 +770,13 @@ void plClusterUtil::IDelPosAndColor(plSpanTemplateB* templ, - // Make the stored colors the actual output UInt32. + // Make the stored colors the actual output uint32_t. // templ has the mult and add colors, apply them here. if( doCol ) { shade->Begin(templ->GetSrcNode(), wBnd); - colors[i] = TRACKED_NEW plColorTab; + colors[i] = new plColorTab; colors[i]->SetCount(templ->NumVerts()); int j; for( j = 0; j < templ->NumVerts(); j++ ) diff --git a/Sources/Tools/MaxConvert/plClusterUtil.h b/Sources/Tools/MaxConvert/plClusterUtil.h index 13bc435e..ef86ff12 100644 --- a/Sources/Tools/MaxConvert/plClusterUtil.h +++ b/Sources/Tools/MaxConvert/plClusterUtil.h @@ -84,7 +84,7 @@ class plL2WTabTab : public Tab {}; class plPoint3Tab : public Tab {}; class plPoint3TabTab : public Tab {}; -class plColorTab : public Tab {}; +class plColorTab : public Tab {}; class plColorTabTab : public Tab {}; class plSpanTemplTab : public Tab {}; @@ -92,14 +92,14 @@ class plSpanTemplTab : public Tab {}; class plClusterUtil { protected: - UInt32 fIdx; + uint32_t fIdx; plClusterGroup* fGroup; plMaxNode* fTemplNode; plSpanTemplateB* fTemplate; int fMinFaces; int fMaxFaces; - hsScalar fMinSize; + float fMinSize; int fMinInsts; int fMaxInsts; diff --git a/Sources/Tools/MaxConvert/plConvert.cpp b/Sources/Tools/MaxConvert/plConvert.cpp index d394e138..8a41bf9e 100644 --- a/Sources/Tools/MaxConvert/plConvert.cpp +++ b/Sources/Tools/MaxConvert/plConvert.cpp @@ -43,7 +43,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // // 3DSMax HeadSpin exporter // -#include "hsTypes.h" +#include "HeadSpin.h" #include "Max.h" #include "istdplug.h" #include "Notify.h" @@ -78,7 +78,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "plPhysX/plSimulationMgr.h" #include "MaxMain/plPhysXCooking.h" #include "MaxExport/plExportProgressBar.h" -#include "hsUtils.h" + #include "MaxMain/plGetLocationDlg.h" @@ -395,7 +395,7 @@ void plConvert::DeInit() // to work without loading in the entire age worth of reffing objects. - 5.30.2002 mcn // plBitmapCreator::Instance().DeInit(); - plNodeCleanupMsg *clean = TRACKED_NEW plNodeCleanupMsg(); + plNodeCleanupMsg *clean = new plNodeCleanupMsg(); plgDispatch::MsgSend( clean ); } diff --git a/Sources/Tools/MaxConvert/plConvert.h b/Sources/Tools/MaxConvert/plConvert.h index 2ebeb7ca..c0d04a11 100644 --- a/Sources/Tools/MaxConvert/plConvert.h +++ b/Sources/Tools/MaxConvert/plConvert.h @@ -43,7 +43,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #ifndef plConvert_inc #define plConvert_inc -#include "hsTypes.h" +#include "HeadSpin.h" #include "hsTemplates.h" #include "pnKeyedObject/plKey.h" @@ -88,7 +88,7 @@ protected: public: static plConvert& Instance(); - UInt32 fWarned; + uint32_t fWarned; enum { kWarnedDecalOnBlendObj = 0x1, kWarnedBadMaterialOnParticle = 0x2, diff --git a/Sources/Tools/MaxConvert/plDistTree.cpp b/Sources/Tools/MaxConvert/plDistTree.cpp index f9059c60..b052bb9a 100644 --- a/Sources/Tools/MaxConvert/plDistTree.cpp +++ b/Sources/Tools/MaxConvert/plDistTree.cpp @@ -40,7 +40,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "Max.h" @@ -61,7 +61,7 @@ void plDistTree::Reset() fNodes.Reset(); } -void plDistTree::AddBoxIData(const Box3& box, const Box3& fade, UInt32 iData) +void plDistTree::AddBoxIData(const Box3& box, const Box3& fade, uint32_t iData) { fRoot = IAddNodeRecur(fRoot, box, fade, iData); } @@ -139,7 +139,7 @@ BOOL plDistTree::IBoxesClear(const Box3& box0, const Box3& box1) const ||(box0.Max()[2] < box1.Min()[2]); } -BOOL plDistTree::IBoxClearRecur(Int32 iNode, const Box3& box, const Box3& fade) const +BOOL plDistTree::IBoxClearRecur(int32_t iNode, const Box3& box, const Box3& fade) const { if( iNode < 0 ) return true; @@ -162,7 +162,7 @@ BOOL plDistTree::IBoxClearRecur(Int32 iNode, const Box3& box, const Box3& fade) return true; } -BOOL plDistTree::IPointClearRecur(Int32 iNode, const Point3& pt, const Box3& fade) const +BOOL plDistTree::IPointClearRecur(int32_t iNode, const Point3& pt, const Box3& fade) const { if( iNode < 0 ) return true; @@ -186,7 +186,7 @@ BOOL plDistTree::IPointClearRecur(Int32 iNode, const Point3& pt, const Box3& fad } -Int32 plDistTree::IAddNodeRecur(Int32 iNode, const Box3& box, const Box3& fade, UInt32 iData) +int32_t plDistTree::IAddNodeRecur(int32_t iNode, const Box3& box, const Box3& fade, uint32_t iData) { // if iNode < 0, make a node for box and return that. if( iNode < 0 ) @@ -218,9 +218,9 @@ Int32 plDistTree::IAddNodeRecur(Int32 iNode, const Box3& box, const Box3& fade, { #endif { - Int32 iChild = IGetChild(fNodes[iNode].fBox, box); + int32_t iChild = IGetChild(fNodes[iNode].fBox, box); - Int32 iChildNode = IAddNodeRecur(fNodes[iNode].fChildren[iChild], box, fade, iData); + int32_t iChildNode = IAddNodeRecur(fNodes[iNode].fChildren[iChild], box, fade, iData); fNodes[iNode].fChildren[iChild] = iChildNode; fNodes[iNode].fBox += fNodes[fNodes[iNode].fChildren[iChild]].fBox; @@ -233,15 +233,15 @@ Int32 plDistTree::IAddNodeRecur(Int32 iNode, const Box3& box, const Box3& fade, } } -Int32 plDistTree::IMergeNodes(Int32 iNode, const Box3& box, const Box3& fade, UInt32 iData) +int32_t plDistTree::IMergeNodes(int32_t iNode, const Box3& box, const Box3& fade, uint32_t iData) { Box3 parBox = box; parBox += fNodes[iNode].fBox; - Int32 pNode = INextNode(parBox, NonFade(), UInt32(-1)); - Int32 iChild = IGetChild(parBox, box); + int32_t pNode = INextNode(parBox, NonFade(), uint32_t(-1)); + int32_t iChild = IGetChild(parBox, box); - Int32 cNode = INextNode(box, fade, iData); + int32_t cNode = INextNode(box, fade, iData); fNodes[pNode].fChildren[iChild] = cNode; @@ -258,20 +258,20 @@ Int32 plDistTree::IMergeNodes(Int32 iNode, const Box3& box, const Box3& fade, UI return pNode; } -Int32 plDistTree::IGetChild(const Box3& parent, const Box3& child) const +int32_t plDistTree::IGetChild(const Box3& parent, const Box3& child) const { Point3 parCenter = parent.Center(); Point3 chiCenter = child.Center(); - Int32 idx = ((parCenter[0] < chiCenter[0]) << 0) + int32_t idx = ((parCenter[0] < chiCenter[0]) << 0) | ((parCenter[1] < chiCenter[1]) << 1) | ((parCenter[2] < chiCenter[2]) << 2); return idx; } -Int32 plDistTree::INextNode(const Box3& box, const Box3& fade, UInt32 iData) +int32_t plDistTree::INextNode(const Box3& box, const Box3& fade, uint32_t iData) { - Int32 iNode = fNodes.GetCount(); + int32_t iNode = fNodes.GetCount(); fNodes.Push(); @@ -291,12 +291,12 @@ Int32 plDistTree::INextNode(const Box3& box, const Box3& fade, UInt32 iData) return iNode; } -void plDistTree::HarvestBox(const Box3& box, Tab& out) const +void plDistTree::HarvestBox(const Box3& box, Tab& out) const { IHarvestBoxRecur(fRoot, box, out); } -void plDistTree::IHarvestBoxRecur(Int32 iNode, const Box3& box, Tab& out) const +void plDistTree::IHarvestBoxRecur(int32_t iNode, const Box3& box, Tab& out) const { if( iNode < 0 ) return; diff --git a/Sources/Tools/MaxConvert/plDistTree.h b/Sources/Tools/MaxConvert/plDistTree.h index 1251dba4..0eb48f93 100644 --- a/Sources/Tools/MaxConvert/plDistTree.h +++ b/Sources/Tools/MaxConvert/plDistTree.h @@ -51,16 +51,16 @@ public: enum { kIsLeaf = 0x1 }; - UInt32 fFlags; + uint32_t fFlags; - Int32 fChildren[8]; + int32_t fChildren[8]; Box3 fBox; Box3 fFade; union { void* fPData; - UInt32 fIData; + uint32_t fIData; }; const Box3& GetBox() const { return fBox; } @@ -73,26 +73,26 @@ class plDistTree { protected: - Int32 fRoot; + int32_t fRoot; hsLargeArray fNodes; - Int32 IAddNodeRecur(Int32 iNode, const Box3& box, const Box3& fade, UInt32 iData); + int32_t IAddNodeRecur(int32_t iNode, const Box3& box, const Box3& fade, uint32_t iData); - Int32 IMergeNodes(Int32 iNode, const Box3& box, const Box3& fade, UInt32 iData); - Int32 INextNode(const Box3& box, const Box3& fade, UInt32 iData); + int32_t IMergeNodes(int32_t iNode, const Box3& box, const Box3& fade, uint32_t iData); + int32_t INextNode(const Box3& box, const Box3& fade, uint32_t iData); - Int32 IGetChild(const Box3& parent, const Box3& child) const; + int32_t IGetChild(const Box3& parent, const Box3& child) const; inline BOOL IBoxesClear(const Box3& box0, const Box3& box1) const; inline BOOL IFadesClear(const Box3& fade0, const Box3& fade1) const; BOOL IBox0ContainsBox1(const Box3& box0, const Box3& box1, const Box3& fade0, const Box3& fade1) const; - BOOL IBoxClearRecur(Int32 iNode, const Box3& box, const Box3& fade) const; - BOOL IPointClearRecur(Int32 iNode, const Point3& pt, const Box3& fade) const; + BOOL IBoxClearRecur(int32_t iNode, const Box3& box, const Box3& fade) const; + BOOL IPointClearRecur(int32_t iNode, const Point3& pt, const Box3& fade) const; - void IHarvestBoxRecur(Int32 iNode, const Box3& box, Tab& out) const; + void IHarvestBoxRecur(int32_t iNode, const Box3& box, Tab& out) const; public: plDistTree(); @@ -100,8 +100,8 @@ public: void Reset(); - void AddBoxPData(const Box3& box, const Box3& fade, void* pData=nil) { AddBoxIData(box, fade, UInt32(pData)); } - void AddBoxIData(const Box3& box, const Box3& fade, UInt32 iData=0); + void AddBoxPData(const Box3& box, const Box3& fade, void* pData=nil) { AddBoxIData(box, fade, uint32_t(pData)); } + void AddBoxIData(const Box3& box, const Box3& fade, uint32_t iData=0); void AddBox(const Box3& box, const Box3& fade=NonFade()) { AddBoxIData(box, fade, 0); } BOOL BoxClear(const Box3& box, const Box3& fade) const; @@ -111,9 +111,9 @@ public: static Box3 NonFade() { return Box3(Point3(0,0,0), Point3(0,0,0)); } - void HarvestBox(const Box3& box, Tab& out) const; + void HarvestBox(const Box3& box, Tab& out) const; - const plDistNode& GetBox(Int32 i) const { return fNodes[i]; } + const plDistNode& GetBox(int32_t i) const { return fNodes[i]; } }; #endif // plDistTree_inc diff --git a/Sources/Tools/MaxConvert/plDistributor.cpp b/Sources/Tools/MaxConvert/plDistributor.cpp index 451bb5bf..47e17aff 100644 --- a/Sources/Tools/MaxConvert/plDistributor.cpp +++ b/Sources/Tools/MaxConvert/plDistributor.cpp @@ -40,7 +40,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ -#include "hsWindows.h" +#include "HeadSpin.h" #include #include "Max.h" @@ -55,9 +55,9 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "hsMaterialConverter.h" -#include "hsTypes.h" +#include "HeadSpin.h" #include "hsGeometry3.h" -#include "hsUtils.h" + #include "plMath/plTriUtils.h" #include "plDistributor.h" @@ -92,7 +92,7 @@ static inline Matrix3 Transpose(const Matrix3& m) plDistributor::plDistributor() { IClear(); - fRand.SetSeed(UInt32(this)); + fRand.SetSeed(uint32_t(this)); } plDistributor::~plDistributor() @@ -140,7 +140,7 @@ void plDistributor::IClear() fPolarRange = 0; fTanPolarRange = 0; - fAzimuthRange = hsScalarPI; + fAzimuthRange = M_PI; fOverallProb = 1.f; @@ -219,26 +219,26 @@ void plDistributor::ISetAngProbCosines() const float maxAng, minAng; if( fAngProbHi > fAngProbLo ) { - maxAng = hsScalarDegToRad(fAngProbHi); - minAng = hsScalarDegToRad(fAngProbLo); + maxAng = hsDegreesToRadians(fAngProbHi); + minAng = hsDegreesToRadians(fAngProbLo); } else { - maxAng = hsScalarDegToRad(fAngProbLo); - minAng = hsScalarDegToRad(fAngProbHi); + maxAng = hsDegreesToRadians(fAngProbLo); + minAng = hsDegreesToRadians(fAngProbHi); } - float transAng = hsScalarDegToRad(fAngProbTrans); + float transAng = hsDegreesToRadians(fAngProbTrans); if( transAng > (maxAng - minAng) * 0.5f ) transAng = (maxAng - minAng) * 0.5f; - float transAngMax = maxAng < hsScalarPI ? transAng : 0; + float transAngMax = maxAng < M_PI ? transAng : 0; float transAngMin = minAng > 0 ? transAng : 0; - fCosAngProbHi = hsCosine(minAng); - fCosAngProbLo = hsCosine(maxAng); - fCosAngProbHiTrans = hsCosine(minAng + transAngMin); - fCosAngProbLoTrans = hsCosine(maxAng - transAngMax); + fCosAngProbHi = cos(minAng); + fCosAngProbLo = cos(maxAng); + fCosAngProbHiTrans = cos(minAng + transAngMin); + fCosAngProbLoTrans = cos(maxAng - transAngMax); } BOOL plDistributor::ISetSurfaceNode(INode* surfNode) const @@ -303,14 +303,14 @@ void plDistributor::IMakeMeshTree() const } } -void plDistributor::IFindFaceSet(const Box3& box, Tab& faces) const +void plDistributor::IFindFaceSet(const Box3& box, Tab& faces) const { - Tab distNodes; + Tab distNodes; fMeshTree.HarvestBox(box, distNodes); int i; for( i = 0; i < distNodes.Count(); i++ ) { - Int32 iFace = Int32(fMeshTree.GetBox(distNodes[i]).fIData); + int32_t iFace = int32_t(fMeshTree.GetBox(distNodes[i]).fIData); faces.Append(1, &iFace); } } @@ -375,15 +375,15 @@ Box3 plDistributor::ISetupGrid(const Point3& p0, const Point3& p1, const Point3& int i; for( i = 0; i < 3; i++ ) { - hsScalar t = box.Min()[i]; + float t = box.Min()[i]; t /= fSpacing; - t = hsFloor(t); + t = floor(t); t *= fSpacing; mins[i] = t; t = box.Max()[i]; t /= fSpacing; - t = hsCeil(t); + t = ceil(t); t *= fSpacing; maxs[i] = t + fSpacing*0.5f; } @@ -643,7 +643,7 @@ hsBool plDistributor::IProbablyDoIt(int iFace, Point3& del, const Point3& bary) Point3 plDistributor::IPerpAxis(const Point3& p) const { - const hsScalar kMinLengthSquared = 1.e-1f; + const float kMinLengthSquared = 1.e-1f; int minAx = p.MinComponent(); Point3 ax(0,0,0); @@ -721,7 +721,7 @@ Matrix3 plDistributor::IGenerateTransform(int iRepNode, int iFace, const Point3& Point3 rndDir = IPerpAxis(norm); Point3 rndOut = rndDir ^ norm; rndDir *= fRand.RandMinusOneToOne(); - float len = hsSquareRoot(1.f - rndDir.LengthSquared()); + float len = sqrt(1.f - rndDir.LengthSquared()); rndOut *= len; if( fRand.RandMinusOneToOne() < 0 ) rndOut *= -1.f; @@ -742,7 +742,7 @@ Matrix3 plDistributor::IGenerateTransform(int iRepNode, int iFace, const Point3& Point3 out = dir ^ norm; if( out.LengthSquared() < kMinVecLengthSq ) { - if( fAzimuthRange < hsScalarPI * 0.5f ) + if( fAzimuthRange < M_PI * 0.5f ) { l2w.IdentityMatrix(); return l2w; @@ -969,7 +969,7 @@ BOOL plDistributor::IReadyRepNodes(plMeshCacheTab& cache) const int iCache = cache.Count(); cache.SetCount(iCache + 1); - cache[iCache].fMesh = TRACKED_NEW Mesh(*mesh); + cache[iCache].fMesh = new Mesh(*mesh); cache[iCache].fFlex = repNode->GetFlexibility(); if( obj ) @@ -1001,7 +1001,7 @@ void plDistributor::AddReplicateNode(INode* node) fRepNodes.Append(1, &node); } -BOOL plDistributor::IProjectVertex(const Point3& pt, const Point3& dir, float maxDist, Tab&faces, Point3& projPt) const +BOOL plDistributor::IProjectVertex(const Point3& pt, const Point3& dir, float maxDist, Tab&faces, Point3& projPt) const { BOOL retVal = false; plTriUtils triUtil; @@ -1050,7 +1050,7 @@ BOOL plDistributor::IConformCheck(Matrix3& l2w, int iRepNode, plMeshCacheTab& ca Box3 bnd = mesh->getBoundingBox() * OTM; bnd = Box3(Point3(bnd.Min().x, bnd.Min().y, -bnd.Max().z), bnd.Max()); bnd = bnd * l2w; - Tab faces; + Tab faces; IFindFaceSet(bnd, faces); int i; @@ -1084,14 +1084,14 @@ BOOL plDistributor::IConformAll(Matrix3& l2w, int iRepNode, plMeshCacheTab& cach Box3 bnd = mesh->getBoundingBox() * OTM; bnd = Box3(Point3(bnd.Min().x, bnd.Min().y, -bnd.Max().z), bnd.Max()); bnd = bnd * l2w; - Tab faces; + Tab faces; IFindFaceSet(bnd, faces); // l2w, iRepNode, cache, &iCache, maxScaledDist, dir iCache = cache.Count(); cache.SetCount(iCache + 1); cache[iCache] = cache[iRepNode]; - cache[iCache].fMesh = TRACKED_NEW Mesh(*mesh); + cache[iCache].fMesh = new Mesh(*mesh); mesh = cache[iCache].fMesh; @@ -1143,14 +1143,14 @@ BOOL plDistributor::IConformHeight(Matrix3& l2w, int iRepNode, plMeshCacheTab& c Box3 bnd = mesh->getBoundingBox() * OTM; bnd = Box3(Point3(bnd.Min().x, bnd.Min().y, -bnd.Max().z), bnd.Max()); bnd = bnd * l2w; - Tab faces; + Tab faces; IFindFaceSet(bnd, faces); // l2w, iRepNode, cache, &iCache, maxScaledDist, dir iCache = cache.Count(); cache.SetCount(iCache + 1); cache[iCache] = cache[iRepNode]; - cache[iCache].fMesh = TRACKED_NEW Mesh(*mesh); + cache[iCache].fMesh = new Mesh(*mesh); mesh = cache[iCache].fMesh; @@ -1212,14 +1212,14 @@ BOOL plDistributor::IConformBase(Matrix3& l2w, int iRepNode, plMeshCacheTab& cac Box3 bnd = mesh->getBoundingBox() * OTM; bnd = Box3(Point3(bnd.Min().x, bnd.Min().y, -bnd.Max().z), bnd.Max()); bnd = bnd * l2w; - Tab faces; + Tab faces; IFindFaceSet(bnd, faces); // l2w, iRepNode, cache, &iCache, maxScaledDist, dir iCache = cache.Count(); cache.SetCount(iCache + 1); cache[iCache] = cache[iRepNode]; - cache[iCache].fMesh = TRACKED_NEW Mesh(*mesh); + cache[iCache].fMesh = new Mesh(*mesh); mesh = cache[iCache].fMesh; @@ -1311,9 +1311,9 @@ void plDistributor::IDistributeOverFace(int iFace, plDistribInstTab& reps, plMes Box3 grid = ISetupGrid(p0, p1, p2); - hsScalar delta = fSpacing; + float delta = fSpacing; - hsScalar x, y, z; + float x, y, z; for( x = grid.Min().x; x < grid.Max().x; x += delta ) { for( y = grid.Min().y; y < grid.Max().y; y += delta ) @@ -1452,7 +1452,7 @@ void plDistributor::IReserveSpace(const Box3& clearBox) const fDistTree->AddBox(clearBox, fFade); } -UInt32 plDistributor::GetRandSeed() const +uint32_t plDistributor::GetRandSeed() const { return fRand.GetSeed(); } @@ -1464,7 +1464,7 @@ void plDistributor::SetRandSeed(int seed) void plDistributor::SetPolarRange(float deg) { - fPolarRange = hsScalarDegToRad(deg); + fPolarRange = hsDegreesToRadians(deg); fTanPolarRange = tan(fPolarRange); } diff --git a/Sources/Tools/MaxConvert/plDistributor.h b/Sources/Tools/MaxConvert/plDistributor.h index e6564b88..23143474 100644 --- a/Sources/Tools/MaxConvert/plDistributor.h +++ b/Sources/Tools/MaxConvert/plDistributor.h @@ -255,8 +255,8 @@ protected: BOOL INeedMeshTree() const; void IMakeMeshTree() const; - void IFindFaceSet(const Box3& box, Tab& faces) const; - BOOL IProjectVertex(const Point3& pt, const Point3& dir, float maxDist, Tab&faces, Point3& projPt) const; + void IFindFaceSet(const Box3& box, Tab& faces) const; + BOOL IProjectVertex(const Point3& pt, const Point3& dir, float maxDist, Tab&faces, Point3& projPt) const; BOOL IConform(Matrix3& l2w, int iRepNode, plMeshCacheTab& cache, int& iCache) const; BOOL IConformHeight(Matrix3& l2w, int iRepNode, plMeshCacheTab& cache, int& iCache) const; BOOL IConformAll(Matrix3& l2w, int iRepNode, plMeshCacheTab& cache, int& iCache) const; @@ -302,7 +302,7 @@ public: BOOL Distribute(INode* surfNode, plDistribInstTab& replicants, plMeshCacheTab& cache, plExportProgressBar& bar) const; void Reset(); - UInt32 GetRandSeed() const; + uint32_t GetRandSeed() const; void SetRandSeed(int seed); void ClearReplicateNodes(); @@ -325,10 +325,10 @@ public: float GetAlignmentWeight() const { return fAlignWgt * 100.f; } void SetPolarRange(float deg); - float GetPolarRange() const { return hsScalarRadToDeg(fPolarRange); } + float GetPolarRange() const { return hsRadiansToDegrees(fPolarRange); } - void SetAzimuthRange(float deg) { fAzimuthRange = hsScalarDegToRad(deg); } - float GetAzimuthRange() const { return hsScalarRadToDeg(fAzimuthRange); } + void SetAzimuthRange(float deg) { fAzimuthRange = hsDegreesToRadians(deg); } + float GetAzimuthRange() const { return hsRadiansToDegrees(fAzimuthRange); } void SetOverallProb(float percent) { fOverallProb = percent/100.f; } float GetOverallProb() const { return fOverallProb * 100.f; } diff --git a/Sources/Tools/MaxConvert/plLayerConverter.cpp b/Sources/Tools/MaxConvert/plLayerConverter.cpp index a2142dbc..90dffb79 100644 --- a/Sources/Tools/MaxConvert/plLayerConverter.cpp +++ b/Sources/Tools/MaxConvert/plLayerConverter.cpp @@ -58,14 +58,14 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // // /////////////////////////////////////////////////////////////////////////////// -#include "hsWindows.h" + #include "Max.h" #include "stdmat.h" #include "istdplug.h" #include "iparamb2.h" #include "iparamm2.h" -#include "hsUtils.h" + #include "hsExceptionStack.h" #include "plLayerConverter.h" @@ -198,7 +198,7 @@ void plLayerConverter::UnmuteWarnings( void ) plLayerInterface *plLayerConverter::ConvertTexmap( Texmap *texmap, plMaxNode *maxNode, - UInt32 blendFlags, hsBool preserveUVOffset, + uint32_t blendFlags, hsBool preserveUVOffset, hsBool upperLayer ) { hsGuardBegin( "plLayerConverter::ConvertTexmap" ); @@ -275,7 +275,7 @@ void plLayerConverter::IRegisterConversion( plPlasmaMAXLayer *origLayer, plLa //// IConvertLayerTex ///////////////////////////////////////////////////////// plLayerInterface *plLayerConverter::IConvertLayerTex( plPlasmaMAXLayer *layer, - plMaxNode *maxNode, UInt32 blendFlags, + plMaxNode *maxNode, uint32_t blendFlags, hsBool preserveUVOffset, hsBool upperLayer ) { hsGuardBegin( "plLayerConverter::IConvertLayerTex" ); @@ -332,7 +332,7 @@ plLayerInterface *plLayerConverter::IConvertLayerTex( plPlasmaMAXLayer *layer bd.fileName = bi->Name(); // Create texture and add it to list if unique - Int32 texFlags = 0;//hsGTexture::kMipMap; + int32_t texFlags = 0;//hsGTexture::kMipMap; // Texture Alpha/Color if( bitmapPB->GetInt( kBmpInvertColor ) ) @@ -411,7 +411,7 @@ plLayerInterface *plLayerConverter::IConvertLayerTex( plPlasmaMAXLayer *layer //// IConvertStaticEnvLayer /////////////////////////////////////////////////// plLayerInterface *plLayerConverter::IConvertStaticEnvLayer( plPlasmaMAXLayer *layer, - plMaxNode *maxNode, UInt32 blendFlags, + plMaxNode *maxNode, uint32_t blendFlags, hsBool preserveUVOffset, hsBool upperLayer ) { hsGuardBegin( "plLayerConverter::IConvertStaticEnvLayer" ); @@ -451,7 +451,7 @@ plLayerInterface *plLayerConverter::IConvertStaticEnvLayer( plPlasmaMAXLayer bd.fileName = bi->Name(); // Create texture and add it to list if unique - Int32 texFlags = 0; + int32_t texFlags = 0; // Texture Alpha/Color if( bitmapPB->GetInt( plStaticEnvLayer::kBmpInvertColor ) ) @@ -521,7 +521,7 @@ plLayerInterface *plLayerConverter::IConvertStaticEnvLayer( plPlasmaMAXLayer //// IConvertDynamicEnvLayer ////////////////////////////////////////////////// plLayerInterface *plLayerConverter::IConvertDynamicEnvLayer( plPlasmaMAXLayer *layer, - plMaxNode *maxNode, UInt32 blendFlags, + plMaxNode *maxNode, uint32_t blendFlags, hsBool preserveUVOffset, hsBool upperLayer ) { hsGuardBegin( "plLayerConverter::IConvertDynamicEnvLayer" ); @@ -556,7 +556,7 @@ plLayerInterface *plLayerConverter::IConvertDynamicEnvLayer( plPlasmaMAXLayer } // Create texture and add it to list if unique - Int32 texFlags = 0; + int32_t texFlags = 0; /// Since we're a cubic environMap, we don't care about the UV transform nor the uvwSrc plasmaLayer->SetUVWSrc( 0 ); @@ -574,7 +574,7 @@ plLayerInterface *plLayerConverter::IConvertDynamicEnvLayer( plPlasmaMAXLayer plBitmap *texture = (plBitmap *)IMakeCubicRenderTarget( texName, maxNode, anchor ); if( texture ) - hsgResMgr::ResMgr()->AddViaNotify( texture->GetKey(), TRACKED_NEW plLayRefMsg( plasmaLayer->GetKey(), plRefMsg::kOnCreate, 0, plLayRefMsg::kTexture ), plRefFlags::kActiveRef ); + hsgResMgr::ResMgr()->AddViaNotify( texture->GetKey(), new plLayRefMsg( plasmaLayer->GetKey(), plRefMsg::kOnCreate, 0, plLayRefMsg::kTexture ), plRefFlags::kActiveRef ); // Tag this layer as reflective cubic environmentmapping if( bitmapPB->GetInt(plDynamicEnvLayer::kBmpRefract) ) @@ -588,7 +588,7 @@ plLayerInterface *plLayerConverter::IConvertDynamicEnvLayer( plPlasmaMAXLayer } plLayerInterface *plLayerConverter::IConvertCameraLayer(plPlasmaMAXLayer *layer, - plMaxNode *maxNode, UInt32 blendFlags, + plMaxNode *maxNode, uint32_t blendFlags, hsBool preserveUVOffset, hsBool upperLayer) { hsGuardBegin( "plLayerConverter::IConvertCameraLayer" ); @@ -612,17 +612,17 @@ plLayerInterface *plLayerConverter::IConvertCameraLayer(plPlasmaMAXLayer *lay plDynamicCamMap *map = plEnvMapComponent::GetCamMap(rootNode ? rootNode : maxNode); if (map) { - Int32 texFlags = 0; + int32_t texFlags = 0; if (!pb->GetInt(ParamID(plMAXCameraLayer::kExplicitCam))) { plasmaLayer->SetUVWSrc(plLayerInterface::kUVWPosition); plasmaLayer->SetMiscFlags(hsGMatState::kMiscCam2Screen | hsGMatState::kMiscPerspProjection); - hsgResMgr::ResMgr()->AddViaNotify(rootNode->GetSceneObject()->GetKey(), TRACKED_NEW plGenRefMsg(map->GetKey(), plRefMsg::kOnCreate, -1, plDynamicCamMap::kRefRootNode), plRefFlags::kActiveRef); - hsgResMgr::ResMgr()->AddViaNotify(plasmaLayer->GetKey(), TRACKED_NEW plGenRefMsg(map->GetKey(), plRefMsg::kOnCreate, -1, plDynamicCamMap::kRefMatLayer), plRefFlags::kActiveRef); + hsgResMgr::ResMgr()->AddViaNotify(rootNode->GetSceneObject()->GetKey(), new plGenRefMsg(map->GetKey(), plRefMsg::kOnCreate, -1, plDynamicCamMap::kRefRootNode), plRefFlags::kActiveRef); + hsgResMgr::ResMgr()->AddViaNotify(plasmaLayer->GetKey(), new plGenRefMsg(map->GetKey(), plRefMsg::kOnCreate, -1, plDynamicCamMap::kRefMatLayer), plRefFlags::kActiveRef); if (!pb->GetInt(ParamID(plMAXCameraLayer::kForce))) { plBitmap *disableTexture = hsMaterialConverter::Instance().GetStaticColorTexture(pb->GetColor(ParamID(plMAXCameraLayer::kDisableColor)), loc); - hsgResMgr::ResMgr()->AddViaNotify(disableTexture->GetKey(), TRACKED_NEW plGenRefMsg(map->GetKey(), plRefMsg::kOnCreate, -1, plDynamicCamMap::kRefDisableTexture), plRefFlags::kActiveRef); + hsgResMgr::ResMgr()->AddViaNotify(disableTexture->GetKey(), new plGenRefMsg(map->GetKey(), plRefMsg::kOnCreate, -1, plDynamicCamMap::kRefDisableTexture), plRefFlags::kActiveRef); } } else @@ -632,7 +632,7 @@ plLayerInterface *plLayerConverter::IConvertCameraLayer(plPlasmaMAXLayer *lay { const plCameraModifier1 *mod = plCameraModifier1::ConvertNoRef(camNode->GetSceneObject()->GetModifierByType(plCameraModifier1::Index())); if (mod) - hsgResMgr::ResMgr()->AddViaNotify(mod->GetKey(), TRACKED_NEW plGenRefMsg(map->GetKey(), plRefMsg::kOnCreate, -1, plDynamicCamMap::kRefCamera), plRefFlags::kActiveRef); + hsgResMgr::ResMgr()->AddViaNotify(mod->GetKey(), new plGenRefMsg(map->GetKey(), plRefMsg::kOnCreate, -1, plDynamicCamMap::kRefCamera), plRefFlags::kActiveRef); } plasmaLayer->SetUVWSrc(pb->GetInt(ParamID(plMAXCameraLayer::kUVSource))); @@ -643,9 +643,9 @@ plLayerInterface *plLayerConverter::IConvertCameraLayer(plPlasmaMAXLayer *lay int i; for (i = 0; i < nodeList.GetCount(); i++) { - hsgResMgr::ResMgr()->AddViaNotify(nodeList[i]->GetSceneObject()->GetKey(), TRACKED_NEW plGenRefMsg(map->GetKey(), plRefMsg::kOnCreate, -1, plDynamicCamMap::kRefTargetNode), plRefFlags::kActiveRef); + hsgResMgr::ResMgr()->AddViaNotify(nodeList[i]->GetSceneObject()->GetKey(), new plGenRefMsg(map->GetKey(), plRefMsg::kOnCreate, -1, plDynamicCamMap::kRefTargetNode), plRefFlags::kActiveRef); } - hsgResMgr::ResMgr()->AddViaNotify(map->GetKey(), TRACKED_NEW plLayRefMsg(plasmaLayer->GetKey(), plRefMsg::kOnCreate, -1, plLayRefMsg::kTexture), plRefFlags::kActiveRef); + hsgResMgr::ResMgr()->AddViaNotify(map->GetKey(), new plLayRefMsg(plasmaLayer->GetKey(), plRefMsg::kOnCreate, -1, plLayRefMsg::kTexture), plRefFlags::kActiveRef); } @@ -657,7 +657,7 @@ plLayerInterface *plLayerConverter::IConvertCameraLayer(plPlasmaMAXLayer *lay //// IConvertDynamicTextLayer ///////////////////////////////////////////////// plLayerInterface *plLayerConverter::IConvertDynamicTextLayer( plPlasmaMAXLayer *layer, - plMaxNode *maxNode, UInt32 blendFlags, + plMaxNode *maxNode, uint32_t blendFlags, hsBool preserveUVOffset, hsBool upperLayer ) { hsGuardBegin( "plLayerConverter::IConvertDynamicTextLayer" ); @@ -692,7 +692,7 @@ plLayerInterface *plLayerConverter::IConvertDynamicTextLayer( plPlasmaMAXLaye maxNode ); // Set the initial bitmap if necessary - UInt32 *initBuffer = IGetInitBitmapBuffer( maxLayer ); + uint32_t *initBuffer = IGetInitBitmapBuffer( maxLayer ); if( initBuffer != nil ) { texture->SetInitBuffer( initBuffer ); @@ -700,7 +700,7 @@ plLayerInterface *plLayerConverter::IConvertDynamicTextLayer( plPlasmaMAXLaye } // Add the texture in - hsgResMgr::ResMgr()->AddViaNotify( texture->GetKey(), TRACKED_NEW plLayRefMsg( plasmaLayer->GetKey(), plRefMsg::kOnCreate, 0, plLayRefMsg::kTexture ), plRefFlags::kActiveRef ); + hsgResMgr::ResMgr()->AddViaNotify( texture->GetKey(), new plLayRefMsg( plasmaLayer->GetKey(), plRefMsg::kOnCreate, 0, plLayRefMsg::kTexture ), plRefFlags::kActiveRef ); // All done! return (plLayerInterface *)plasmaLayer; @@ -712,11 +712,11 @@ plLayerInterface *plLayerConverter::IConvertDynamicTextLayer( plPlasmaMAXLaye // Called to get a 32-bit uncompressed ARGB version of the init bitmap of // a dynamic text layer -UInt32 *plLayerConverter::IGetInitBitmapBuffer( plDynamicTextLayer *layer ) const +uint32_t *plLayerConverter::IGetInitBitmapBuffer( plDynamicTextLayer *layer ) const { - UInt32 *buffer; + uint32_t *buffer; hsRGBAColor32 *buffPtr; - UInt16 width, height; + uint16_t width, height; IParamBlock2 *bitmapPB = layer->GetParamBlockByID( plDynamicTextLayer::kBlkBitmap ); @@ -728,7 +728,7 @@ UInt32 *plLayerConverter::IGetInitBitmapBuffer( plDynamicTextLayer *layer ) con width = bitmapPB->GetInt( (ParamID)plDynamicTextLayer::kBmpExportWidth ); height = bitmapPB->GetInt( (ParamID)plDynamicTextLayer::kBmpExportHeight ); - buffer = TRACKED_NEW UInt32[ width * height ]; + buffer = new uint32_t[ width * height ]; if( buffer == nil ) return nil; @@ -762,12 +762,12 @@ UInt32 *plLayerConverter::IGetInitBitmapBuffer( plDynamicTextLayer *layer ) con return buffer; } -static UInt32 MakeUInt32Color(float r, float g, float b, float a) +static uint32_t MakeUInt32Color(float r, float g, float b, float a) { - return (UInt32(a * 255.9f) << 24) - |(UInt32(r * 255.9f) << 16) - |(UInt32(g * 255.9f) << 8) - |(UInt32(b * 255.9f) << 0); + return (uint32_t(a * 255.9f) << 24) + |(uint32_t(r * 255.9f) << 16) + |(uint32_t(g * 255.9f) << 8) + |(uint32_t(b * 255.9f) << 0); } plBitmap* plLayerConverter::IGetAttenRamp(plMaxNode *node, BOOL isAdd, int loClamp, int hiClamp) @@ -789,7 +789,7 @@ plBitmap* plLayerConverter::IGetAttenRamp(plMaxNode *node, BOOL isAdd, int loCla // necessary. -mcn plMipmap *texture = plBitmapCreator::Instance().CreateBlankMipmap( kLUTWidth, kLUTHeight, plMipmap::kARGB32Config, 1, funkName, node->GetLocation() ); - UInt32* pix = (UInt32*)texture->GetImage(); + uint32_t* pix = (uint32_t*)texture->GetImage(); if( isAdd ) { @@ -873,17 +873,17 @@ plLayer* plLayerConverter::ICreateAttenuationLayer(const char* name, plMaxNode * } plBitmap* funkRamp = IGetAttenRamp(node, chanAdd, loClamp, hiClamp); - plLayer* layer = TRACKED_NEW plLayer; + plLayer* layer = new plLayer; layer->InitToDefault(); hsgResMgr::ResMgr()->NewKey(name, layer, node->GetLocation()); - hsgResMgr::ResMgr()->AddViaNotify(funkRamp->GetKey(), TRACKED_NEW plLayRefMsg(layer->GetKey(), plRefMsg::kOnCreate, 0, plLayRefMsg::kTexture), plRefFlags::kActiveRef); + hsgResMgr::ResMgr()->AddViaNotify(funkRamp->GetKey(), new plLayRefMsg(layer->GetKey(), plRefMsg::kOnCreate, 0, plLayRefMsg::kTexture), plRefFlags::kActiveRef); layer->SetAmbientColor(hsColorRGBA().Set(1.f, 1.f, 1.f, 1.f)); layer->SetPreshadeColor(hsColorRGBA().Set(0, 0, 0, 1.f)); layer->SetRuntimeColor(hsColorRGBA().Set(0, 0, 0, 1.f)); layer->SetZFlags(hsGMatState::kZNoZWrite); - UInt32 blendFlags = hsGMatState::kBlendAlpha | hsGMatState::kBlendNoTexColor | hsGMatState::kBlendAlphaMult; + uint32_t blendFlags = hsGMatState::kBlendAlpha | hsGMatState::kBlendNoTexColor | hsGMatState::kBlendAlphaMult; layer->SetBlendFlags(blendFlags); layer->SetClampFlags(hsGMatState::kClampTexture); @@ -895,7 +895,7 @@ plLayer* plLayerConverter::ICreateAttenuationLayer(const char* name, plMaxNode * } plLayerInterface* plLayerConverter::IConvertAngleAttenLayer(plPlasmaMAXLayer *layer, - plMaxNode *maxNode, UInt32 blendFlags, + plMaxNode *maxNode, uint32_t blendFlags, hsBool preserveUVOffset, hsBool upperLayer) { hsGuardBegin( "plPlasmaMAXLayer::IConvertAngleAttenLayer" ); @@ -929,7 +929,7 @@ plLayer *plLayerConverter::ICreateLayer( const char *name, hsBool upperLayer { hsGuardBegin( "plPlasmaMAXLayer::ICreateLayer" ); - plLayer *layer = TRACKED_NEW plLayer; + plLayer *layer = new plLayer; layer->InitToDefault(); hsgResMgr::ResMgr()->NewKey( name, layer, loc ); @@ -967,7 +967,7 @@ void plLayerConverter::IProcessUVGen( plPlasmaMAXLayer *srcLayer, plLayer *de } // UVW Src - Int32 uvwSrc = srcLayer->GetMapChannel() - 1; + int32_t uvwSrc = srcLayer->GetMapChannel() - 1; if( fErrorMsg->Set( !( fWarned & kWarnedTooManyUVs ) && ( ( uvwSrc < 0 ) || ( uvwSrc >= plGeometrySpan::kMaxNumUVChannels ) ), @@ -989,7 +989,7 @@ void plLayerConverter::IProcessUVGen( plPlasmaMAXLayer *srcLayer, plLayer *de //// ICreateDynTextMap //////////////////////////////////////////////////////// -plDynamicTextMap *plLayerConverter::ICreateDynTextMap( const char *layerName, UInt32 width, UInt32 height, +plDynamicTextMap *plLayerConverter::ICreateDynTextMap( const char *layerName, uint32_t width, uint32_t height, hsBool includeAlphaChannel, plMaxNode *node ) { hsGuardBegin( "plPlasmaMAXLayer::ICreateDynTextMap" ); @@ -1013,7 +1013,7 @@ plDynamicTextMap *plLayerConverter::ICreateDynTextMap( const char *layerName, } // Create - map = TRACKED_NEW plDynamicTextMap(); + map = new plDynamicTextMap(); map->SetNoCreate( width, height, includeAlphaChannel ); /// Add a key for it @@ -1030,7 +1030,7 @@ plDynamicTextMap *plLayerConverter::ICreateDynTextMap( const char *layerName, /////////////////////////////////////////////////////////////////////////////// plBitmap *plLayerConverter::CreateSimpleTexture(const char *fileName, const plLocation &loc, - UInt32 clipID /* = 0 */, UInt32 texFlags /* = 0 */, bool useJPEG /* = false */) + uint32_t clipID /* = 0 */, uint32_t texFlags /* = 0 */, bool useJPEG /* = false */) { plBitmapData bd; bd.fileName = fileName; @@ -1077,7 +1077,7 @@ plLayer *plLayerConverter::IAssignTexture( plBitmapData *bd, plMaxNode *maxNode, } } else - hsgResMgr::ResMgr()->AddViaNotify( texture->GetKey(), TRACKED_NEW plLayRefMsg( destLayer->GetKey(), plRefMsg::kOnCreate, 0, plLayRefMsg::kTexture ), plRefFlags::kActiveRef ); + hsgResMgr::ResMgr()->AddViaNotify( texture->GetKey(), new plLayRefMsg( destLayer->GetKey(), plRefMsg::kOnCreate, 0, plLayRefMsg::kTexture ), plRefFlags::kActiveRef ); return destLayer; } @@ -1115,19 +1115,19 @@ plCubicRenderTarget *plLayerConverter::IMakeCubicRenderTarget( const char *name, return nil; /// Create - cubic = TRACKED_NEW plCubicRenderTarget( plRenderTarget::kIsTexture, 256, 256, 32 ); + cubic = new plCubicRenderTarget( plRenderTarget::kIsTexture, 256, 256, 32 ); hsAssert( cubic != nil, "Cannot create cubic render target!" ); /// Add a key key = hsgResMgr::ResMgr()->NewKey( name, cubic, node->GetLocation() ); /// Now make a modifier - plCubicRenderTargetModifier *mod = TRACKED_NEW plCubicRenderTargetModifier(); + plCubicRenderTargetModifier *mod = new plCubicRenderTargetModifier(); sprintf( modName, "%s_mod", name ); hsgResMgr::ResMgr()->NewKey( modName, mod, node->GetLocation() ); - hsgResMgr::ResMgr()->AddViaNotify( cubic->GetKey(), TRACKED_NEW plGenRefMsg( mod->GetKey(), plRefMsg::kOnCreate, 0, 0 ), plRefFlags::kPassiveRef ); - hsgResMgr::ResMgr()->AddViaNotify( mod->GetKey(), TRACKED_NEW plObjRefMsg( sObjKey, plRefMsg::kOnCreate, 0, plObjRefMsg::kModifier ), plRefFlags::kActiveRef ); + hsgResMgr::ResMgr()->AddViaNotify( cubic->GetKey(), new plGenRefMsg( mod->GetKey(), plRefMsg::kOnCreate, 0, 0 ), plRefFlags::kPassiveRef ); + hsgResMgr::ResMgr()->AddViaNotify( mod->GetKey(), new plObjRefMsg( sObjKey, plRefMsg::kOnCreate, 0, plObjRefMsg::kModifier ), plRefFlags::kActiveRef ); return cubic; } diff --git a/Sources/Tools/MaxConvert/plLayerConverter.h b/Sources/Tools/MaxConvert/plLayerConverter.h index 74f72b91..7c8fbe03 100644 --- a/Sources/Tools/MaxConvert/plLayerConverter.h +++ b/Sources/Tools/MaxConvert/plLayerConverter.h @@ -53,7 +53,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #ifndef _plLayerConverter_h #define _plLayerConverter_h -#include "hsTypes.h" +#include "HeadSpin.h" #include "hsTemplates.h" #include "Max.h" @@ -92,8 +92,8 @@ class plLayerConverter void DeInit( void ); plLayerInterface *ConvertTexmap( Texmap *texmap, plMaxNode *maxNode, - UInt32 blendFlags, hsBool preserveUVOffset, hsBool upperLayer ); - plBitmap *CreateSimpleTexture(const char *fileName, const plLocation &loc, UInt32 clipID = 0, UInt32 texFlags = 0, bool useJPEG = false); + uint32_t blendFlags, hsBool preserveUVOffset, hsBool upperLayer ); + plBitmap *CreateSimpleTexture(const char *fileName, const plLocation &loc, uint32_t clipID = 0, uint32_t texFlags = 0, bool useJPEG = false); void MuteWarnings( void ); void UnmuteWarnings( void ); @@ -101,7 +101,7 @@ class plLayerConverter protected: plErrorMsg *fErrorMsg; - UInt32 fWarned, fSavedWarned; + uint32_t fWarned, fSavedWarned; hsBool fSaving; Interface *fInterface; @@ -114,25 +114,25 @@ class plLayerConverter plLayer *ICreateLayer( const char *name, hsBool upperLayer, plLocation &loc ); void IProcessUVGen( plPlasmaMAXLayer *srcLayer, plLayer *destLayer, plBitmapData *bitmapData, hsBool preserveUVOffset ); - plDynamicTextMap *ICreateDynTextMap( const char *layerName, UInt32 width, UInt32 height, hsBool includeAlpha, plMaxNode *node ); + plDynamicTextMap *ICreateDynTextMap( const char *layerName, uint32_t width, uint32_t height, hsBool includeAlpha, plMaxNode *node ); plLayer *IAssignTexture( plBitmapData *bd, plMaxNode *maxNode, plLayer *destLayer, hsBool upperLayer, int clipID = -1 ); plCubicRenderTarget *IMakeCubicRenderTarget( const char *name, plMaxNode *maxNode, plMaxNode *anchor ); // Add your function to process your layer type here - plLayerInterface *IConvertLayerTex( plPlasmaMAXLayer *layer, plMaxNode *maxNode, UInt32 blendFlags, hsBool preserveUVOffset, hsBool upperLayer ); - plLayerInterface *IConvertStaticEnvLayer( plPlasmaMAXLayer *layer, plMaxNode *maxNode, UInt32 blendFlags, hsBool preserveUVOffset, hsBool upperLayer ); - plLayerInterface *IConvertDynamicEnvLayer( plPlasmaMAXLayer *layer, plMaxNode *maxNode, UInt32 blendFlags, hsBool preserveUVOffset, hsBool upperLayer ); - plLayerInterface *IConvertCameraLayer( plPlasmaMAXLayer *layer, plMaxNode *maxNode, UInt32 blendFlags, hsBool preserveUVOffset, hsBool upperLayer ); - plLayerInterface *IConvertDynamicTextLayer( plPlasmaMAXLayer *layer, plMaxNode *maxNode, UInt32 blendFlags, hsBool preserveUVOffset, hsBool upperLayer ); + plLayerInterface *IConvertLayerTex( plPlasmaMAXLayer *layer, plMaxNode *maxNode, uint32_t blendFlags, hsBool preserveUVOffset, hsBool upperLayer ); + plLayerInterface *IConvertStaticEnvLayer( plPlasmaMAXLayer *layer, plMaxNode *maxNode, uint32_t blendFlags, hsBool preserveUVOffset, hsBool upperLayer ); + plLayerInterface *IConvertDynamicEnvLayer( plPlasmaMAXLayer *layer, plMaxNode *maxNode, uint32_t blendFlags, hsBool preserveUVOffset, hsBool upperLayer ); + plLayerInterface *IConvertCameraLayer( plPlasmaMAXLayer *layer, plMaxNode *maxNode, uint32_t blendFlags, hsBool preserveUVOffset, hsBool upperLayer ); + plLayerInterface *IConvertDynamicTextLayer( plPlasmaMAXLayer *layer, plMaxNode *maxNode, uint32_t blendFlags, hsBool preserveUVOffset, hsBool upperLayer ); plBitmap* IGetAttenRamp( plMaxNode *maxNode, BOOL isAdd, int loClamp, int hiClamp); plLayer* ICreateAttenuationLayer(const char* name, plMaxNode *maxNode, int uvwSrc, float tr0, float op0, float tr1, float op1, int loClamp, int hiClamp); - plLayerInterface* IConvertAngleAttenLayer(plPlasmaMAXLayer *layer, plMaxNode *maxNode, UInt32 blendFlags, hsBool preserveUVOffset, hsBool upperLayer); + plLayerInterface* IConvertAngleAttenLayer(plPlasmaMAXLayer *layer, plMaxNode *maxNode, uint32_t blendFlags, hsBool preserveUVOffset, hsBool upperLayer); void IRegisterConversion( plPlasmaMAXLayer *origLayer, plLayerInterface *convertedLayer ); - UInt32 *IGetInitBitmapBuffer( plDynamicTextLayer *layer ) const; + uint32_t *IGetInitBitmapBuffer( plDynamicTextLayer *layer ) const; }; diff --git a/Sources/Tools/MaxConvert/plLightMapGen.cpp b/Sources/Tools/MaxConvert/plLightMapGen.cpp index 73eb6afc..1760a9db 100644 --- a/Sources/Tools/MaxConvert/plLightMapGen.cpp +++ b/Sources/Tools/MaxConvert/plLightMapGen.cpp @@ -42,7 +42,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com //#define MF_NEW_RGC -#include "hsTypes.h" +#include "HeadSpin.h" #include "Max.h" #include "dummy.h" #include "notify.h" @@ -101,7 +101,7 @@ void getRGC(void* param, NotifyInfo* info) class LMGScanPoint { public: - hsScalar fU; + float fU; hsPoint3 fBary; }; @@ -117,12 +117,12 @@ public: static int kDefaultSize = 64; -static UInt32 MakeUInt32Color(float r, float g, float b, float a) +static uint32_t MakeUInt32Color(float r, float g, float b, float a) { - return (UInt32(a * 255.9f) << 24) - |(UInt32(r * 255.9f) << 16) - |(UInt32(g * 255.9f) << 8) - |(UInt32(b * 255.9f) << 0); + return (uint32_t(a * 255.9f) << 24) + |(uint32_t(r * 255.9f) << 16) + |(uint32_t(g * 255.9f) << 8) + |(uint32_t(b * 255.9f) << 0); } plLightMapGen& plLightMapGen::Instance() @@ -171,7 +171,7 @@ hsBool plLightMapGen::Open(Interface* ip, TimeValue t, bool forceRegen) fInterface = ip; fTime = t; - fRP = TRACKED_NEW RendParams; + fRP = new RendParams; fRP->SetRenderElementMgr(fInterface->GetRenderElementMgr(RS_Production)); #ifdef MF_NEW_RGC @@ -191,7 +191,7 @@ hsBool plLightMapGen::Open(Interface* ip, TimeValue t, bool forceRegen) vp.yon = 30.f; vp.distance = 1.f; vp.zoom = 1.f; - vp.fov = hsScalarPI / 4.f; + vp.fov = M_PI / 4.f; vp.nearRange = 1.f; vp.farRange = 30.f; @@ -239,7 +239,7 @@ hsBool plLightMapGen::Open(Interface* ip, TimeValue t, bool forceRegen) #else MF_NEW_RGC - fRGC = TRACKED_NEW plRenderGlobalContext(fInterface, fTime); + fRGC = new plRenderGlobalContext(fInterface, fTime); fRGC->MakeRenderInstances((plMaxNode*)fInterface->GetRootNode(), fTime); #endif // MF_NEW_RGC @@ -308,8 +308,8 @@ void DumpMipmap(plMipmap* mipmap, const char* prefix) { mipmap->SetCurrLevel(i); - UInt32 width = mipmap->GetCurrWidth(); - UInt32 height = mipmap->GetCurrHeight(); + uint32_t width = mipmap->GetCurrWidth(); + uint32_t height = mipmap->GetCurrHeight(); sprintf(buf, "----- Level %d (%dx%d) -----\n", i, width, height); dump.WriteString(buf); @@ -318,11 +318,11 @@ void DumpMipmap(plMipmap* mipmap, const char* prefix) { for (int x = 0; x < width; x++) { - UInt32 color = *(mipmap->GetAddr32(x, y)); - UInt8 r = ((UInt8)((color)>>16)); - UInt8 g = ((UInt8)((color)>>8)); - UInt8 b = ((UInt8)((color)>>0)); - UInt8 a = ((UInt8)((color)>>24)); + uint32_t color = *(mipmap->GetAddr32(x, y)); + uint8_t r = ((uint8_t)((color)>>16)); + uint8_t g = ((uint8_t)((color)>>8)); + uint8_t b = ((uint8_t)((color)>>0)); + uint8_t a = ((uint8_t)((color)>>24)); sprintf(buf, "[%3d,%3d,%3d,%3d]", r, g, b, a); dump.WriteString(buf); } @@ -344,7 +344,7 @@ hsBool plLightMapGen::ICompressLightMaps() if( orig ) { - const hsScalar kFilterSigma = 1.0f; + const float kFilterSigma = 1.0f; if( IsFresh(orig) ) { @@ -380,7 +380,7 @@ hsBool plLightMapGen::ICompressLightMaps() if( orig == fCreatedLayers[j]->GetTexture() ) { fCreatedLayers[j]->GetKey()->Release(orig->GetKey()); - hsgResMgr::ResMgr()->AddViaNotify(compressed->GetKey(), TRACKED_NEW plLayRefMsg(fCreatedLayers[j]->GetKey(), plRefMsg::kOnReplace, 0, plLayRefMsg::kTexture), plRefFlags::kActiveRef); + hsgResMgr::ResMgr()->AddViaNotify(compressed->GetKey(), new plLayRefMsg(fCreatedLayers[j]->GetKey(), plRefMsg::kOnReplace, 0, plLayRefMsg::kTexture), plRefFlags::kActiveRef); } } @@ -478,7 +478,7 @@ hsBool plLightMapGen::IShadeSpan(plMaxNode* node, const hsMatrix44& l2w, const h if( !(span.fProps & plGeometrySpan::kDiffuseFoldedIn) ) { hsBool foldin = 0 != (span.fProps & plGeometrySpan::kLiteVtxNonPreshaded); - hsScalar opacity = 1.f; + float opacity = 1.f; hsColorRGBA dif = hsColorRGBA().Set(1.f, 1.f, 1.f, 1.f); if( foldin ) { @@ -569,7 +569,7 @@ plMipmap* plLightMapGen::IMakeAccumBitmap(plLayerInterface* lay) const int height = dst->GetHeight(); // Temporary mipmap here, so we don't have to worry about using plBitmapCreator - plMipmap* bitmap = TRACKED_NEW plMipmap( width, height, plMipmap::kRGB32Config, 1 ); + plMipmap* bitmap = new plMipmap( width, height, plMipmap::kRGB32Config, 1 ); HSMemory::Clear(bitmap->GetImage(), bitmap->GetHeight() * bitmap->GetRowBytes() ); return bitmap; @@ -584,7 +584,7 @@ hsBool plLightMapGen::IAddToLightMap(plLayerInterface* lay, plMipmap* src) const dst->SetCurrLevel( 0 ); // BLURLATER -// static hsScalar kFilterSigma = 0.5f; +// static float kFilterSigma = 0.5f; // src->Filter(kFilterSigma); // What we really want to do here is antialias our rasterization, so we can @@ -596,24 +596,24 @@ hsBool plLightMapGen::IAddToLightMap(plLayerInterface* lay, plMipmap* src) const { for( i = 0; i < dst->GetWidth(); i++ ) { - UInt32 srcRed = (*src->GetAddr32(i, j) >> 16) & 0xff; - UInt32 dstRed = (*dst->GetAddr32(i, j) >> 16) & 0xff; + uint32_t srcRed = (*src->GetAddr32(i, j) >> 16) & 0xff; + uint32_t dstRed = (*dst->GetAddr32(i, j) >> 16) & 0xff; // dstRed += srcRed; if( dstRed < srcRed ) dstRed = srcRed; if( dstRed > 0xff ) dstRed = 0xff; - UInt32 srcGreen = (*src->GetAddr32(i, j) >> 8) & 0xff; - UInt32 dstGreen = (*dst->GetAddr32(i, j) >> 8) & 0xff; + uint32_t srcGreen = (*src->GetAddr32(i, j) >> 8) & 0xff; + uint32_t dstGreen = (*dst->GetAddr32(i, j) >> 8) & 0xff; // dstGreen += srcGreen; if( dstGreen < srcGreen ) dstGreen = srcGreen; if( dstGreen > 0xff ) dstGreen = 0xff; - UInt32 srcBlue = (*src->GetAddr32(i, j) >> 0) & 0xff; - UInt32 dstBlue = (*dst->GetAddr32(i, j) >> 0) & 0xff; + uint32_t srcBlue = (*src->GetAddr32(i, j) >> 0) & 0xff; + uint32_t dstBlue = (*dst->GetAddr32(i, j) >> 0) & 0xff; // dstBlue += srcBlue; if( dstBlue < srcBlue ) dstBlue = srcBlue; @@ -711,8 +711,8 @@ hsBool plLightMapGen::IShadeVerts(plMaxLightContext& ctx, const Color& amb, cons i1 = i0 == 2 ? 0 : i0+1; i2 = i1 == 2 ? 0 : i1+1; - hsScalar v0 = uv[i0].fY; - hsScalar v1 = uv[i1].fY; + float v0 = uv[i0].fY; + float v1 = uv[i1].fY; int vStart = int(v0); int vEnd = int(v1); @@ -731,7 +731,7 @@ hsBool plLightMapGen::IShadeVerts(plMaxLightContext& ctx, const Color& amb, cons bary[i0] = (v1 - float(vMid)) / (v1 - v0); bary[i1] = 1.f - bary[i0]; bary[i2] = 0; - hsScalar u = uv[i0].fX * bary[i0] + float u = uv[i0].fX * bary[i0] + uv[i1].fX * bary[i1]; if( scanline[vMid].fEmpty ) { @@ -776,7 +776,7 @@ hsBool plLightMapGen::IShadeVerts(plMaxLightContext& ctx, const Color& amb, cons int uMid; for( uMid = uStart; uMid <= uEnd; uMid++ ) { - hsScalar t = (scanline[i].fFar.fU - float(uMid)) / (scanline[i].fFar.fU - scanline[i].fNear.fU); + float t = (scanline[i].fFar.fU - float(uMid)) / (scanline[i].fFar.fU - scanline[i].fNear.fU); hsPoint3 bary = scanline[i].fNear.fBary * t; bary += scanline[i].fFar.fBary * (1.f - t); @@ -785,7 +785,7 @@ hsBool plLightMapGen::IShadeVerts(plMaxLightContext& ctx, const Color& amb, cons hsFastMath::NormalizeAppr(n); - UInt32 color = IShadePoint(ctx, amb, p, n); + uint32_t color = IShadePoint(ctx, amb, p, n); *bitmap->GetAddr32(uMid, i) = color; } @@ -931,8 +931,8 @@ hsBool plLightMapGen::IDirAffectsNode(plLightMapInfo* liInfo, LightObject* liObj LightState ls; liObj->EvalLightState(TimeValue(0), FOREVER, &ls); - hsScalar radX = ls.fallsize; - hsScalar radY = radX; + float radX = ls.fallsize; + float radY = radX; if( ls.shape == RECT_LIGHT ) radY /= ls.aspect; @@ -968,8 +968,8 @@ hsBool plLightMapGen::ISpotAffectsNode(plLightMapInfo* liInfo, LightObject* liOb LightState ls; liObj->EvalLightState(TimeValue(0), FOREVER, &ls); - hsScalar coneRad[2]; - coneRad[0] = ls.fallsize * hsScalarPI / 180.f; + float coneRad[2]; + coneRad[0] = ls.fallsize * M_PI / 180.f; coneRad[1] = coneRad[0]; if( ls.shape == RECT_LIGHT ) coneRad[1] /= ls.aspect; @@ -981,13 +981,13 @@ hsBool plLightMapGen::ISpotAffectsNode(plLightMapInfo* liInfo, LightObject* liOb int j; for( j = 0; j < 8; j++ ) { - hsScalar rad; - rad = hsScalar(atan2(corners[j].fX, -corners[j].fZ)); + float rad; + rad = float(atan2(corners[j].fX, -corners[j].fZ)); if( rad > coneRad[0] ) numPos[0]++; if( rad < -coneRad[0] ) numPos[2]++; - rad = hsScalar(atan2(corners[j].fY, -corners[j].fZ)); + rad = float(atan2(corners[j].fY, -corners[j].fZ)); if( rad > coneRad[1] ) numPos[1]++; if( rad < -coneRad[1] ) @@ -1021,7 +1021,7 @@ hsBool plLightMapGen::IOmniAffectsNode(plLightMapInfo* liInfo, LightObject* liOb if( bnd.GetType() != kBoundsNormal ) return false; - hsScalar radius = ls.attenEnd; + float radius = ls.attenEnd; int i; for( i = 0; i < 3; i++ ) @@ -1208,9 +1208,9 @@ hsBool plLightMapGen::IValidateUVWSrc(hsTArray& spans) const void plLightMapGen::IInitBitmapColor(plMipmap* bitmap, const hsColorRGBA& col) const { - UInt32 initColor = MakeUInt32Color(col.r, col.g, col.b, col.a); - UInt32* pix = (UInt32*)bitmap->GetImage(); - UInt32* pixEnd = ((UInt32*)bitmap->GetImage()) + bitmap->GetWidth() * bitmap->GetHeight(); + uint32_t initColor = MakeUInt32Color(col.r, col.g, col.b, col.a); + uint32_t* pix = (uint32_t*)bitmap->GetImage(); + uint32_t* pixEnd = ((uint32_t*)bitmap->GetImage()) + bitmap->GetWidth() * bitmap->GetHeight(); while( pix < pixEnd ) *pix++ = initColor; } @@ -1279,11 +1279,11 @@ plLayerInterface* plLightMapGen::IMakeLightMapLayer(plMaxNode* node, plGeometryS } else { - objMat = TRACKED_NEW hsGMaterial; + objMat = new hsGMaterial; hsgResMgr::ResMgr()->NewKey(newMatName, objMat, nodeLoc); for( i = 0; i < mat->GetNumLayers(); i++ ) - hsgResMgr::ResMgr()->AddViaNotify(mat->GetLayer(i)->GetKey(), TRACKED_NEW plMatRefMsg(objMat->GetKey(), plRefMsg::kOnCreate, -1, plMatRefMsg::kLayer), plRefFlags::kActiveRef); + hsgResMgr::ResMgr()->AddViaNotify(mat->GetLayer(i)->GetKey(), new plMatRefMsg(objMat->GetKey(), plRefMsg::kOnCreate, -1, plMatRefMsg::kLayer), plRefFlags::kActiveRef); } objMat->SetCompositeFlags(objMat->GetCompositeFlags() | hsGMaterial::kCompIsLightMapped); @@ -1365,10 +1365,10 @@ plLayerInterface* plLightMapGen::IMakeLightMapLayer(plMaxNode* node, plGeometryS } } - plLayer* layer = TRACKED_NEW plLayer; + plLayer* layer = new plLayer; layer->InitToDefault(); layKey = hsgResMgr::ResMgr()->NewKey(layName, layer, nodeLoc); - hsgResMgr::ResMgr()->AddViaNotify(mipKey, TRACKED_NEW plLayRefMsg(layer->GetKey(), plRefMsg::kOnCreate, 0, plLayRefMsg::kTexture), plRefFlags::kActiveRef); + hsgResMgr::ResMgr()->AddViaNotify(mipKey, new plLayRefMsg(layer->GetKey(), plRefMsg::kOnCreate, 0, plLayRefMsg::kTexture), plRefFlags::kActiveRef); layer->SetAmbientColor(hsColorRGBA().Set(1.f, 1.f, 1.f, 1.f)); layer->SetZFlags(hsGMatState::kZNoZWrite); layer->SetBlendFlags(hsGMatState::kBlendMult); @@ -1377,7 +1377,7 @@ plLayerInterface* plLightMapGen::IMakeLightMapLayer(plMaxNode* node, plGeometryS layer->SetMiscFlags(hsGMatState::kMiscLightMap); } - hsgResMgr::ResMgr()->AddViaNotify(layKey, TRACKED_NEW plMatRefMsg(objMat->GetKey(), plRefMsg::kOnCreate, -1, plMatRefMsg::kPiggyBack), plRefFlags::kActiveRef); + hsgResMgr::ResMgr()->AddViaNotify(layKey, new plMatRefMsg(objMat->GetKey(), plRefMsg::kOnCreate, -1, plMatRefMsg::kPiggyBack), plRefFlags::kActiveRef); span.fMaterial = objMat; @@ -1450,7 +1450,7 @@ Color plLightMapGen::ShadePoint(plMaxLightContext& ctx, const hsPoint3& p, const } -UInt32 plLightMapGen::IShadePoint(plMaxLightContext& ctx, const Color& amb, const hsPoint3& p, const hsVector3& n) +uint32_t plLightMapGen::IShadePoint(plMaxLightContext& ctx, const Color& amb, const hsPoint3& p, const hsVector3& n) { ctx.globContext = fRGC; ctx.SetPoint(p, n); @@ -1459,7 +1459,7 @@ UInt32 plLightMapGen::IShadePoint(plMaxLightContext& ctx, const Color& amb, cons accum += amb; accum.ClampMinMax(); - UInt32 retVal; + uint32_t retVal; retVal = MakeUInt32Color(accum.r, accum.g, accum.b, 1.f); diff --git a/Sources/Tools/MaxConvert/plLightMapGen.h b/Sources/Tools/MaxConvert/plLightMapGen.h index 356d2aa4..4d30b8c8 100644 --- a/Sources/Tools/MaxConvert/plLightMapGen.h +++ b/Sources/Tools/MaxConvert/plLightMapGen.h @@ -135,7 +135,7 @@ protected: plLayerInterface* IMakeLightMapLayer(plMaxNode* node, plGeometrySpan& span); int IGetUVWSrc() const { return fUVWSrc; } - UInt32 IShadePoint(plMaxLightContext& ctx, const Color& amb, const hsPoint3& p, const hsVector3& n); + uint32_t IShadePoint(plMaxLightContext& ctx, const Color& amb, const hsPoint3& p, const hsVector3& n); hsBool IShadeVerts(plMaxLightContext& ctx, const Color& amb, const hsPoint3 pt[3], const hsVector3 norm[3], const hsPoint3 uv[3], plMipmap* bitmap); hsBool IShadeFace(plMaxNode* node, const hsMatrix44& l2w, const hsMatrix44& w2l, plGeometrySpan& span, int iFace, plMipmap* bitmap); hsBool IShadeSpan(plMaxNode* node, const hsMatrix44& l2w, const hsMatrix44& w2l, plGeometrySpan& spans); diff --git a/Sources/Tools/MaxConvert/plMeshConverter.cpp b/Sources/Tools/MaxConvert/plMeshConverter.cpp index 9d829f14..730db4a8 100644 --- a/Sources/Tools/MaxConvert/plMeshConverter.cpp +++ b/Sources/Tools/MaxConvert/plMeshConverter.cpp @@ -49,7 +49,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // // ////////////////////////////////////////////////////////////////////////////// -#include "hsTypes.h" +#include "HeadSpin.h" #include "Max.h" #include "iparamb2.h" #include "modstack.h" @@ -115,7 +115,7 @@ class TempWeightInfo { public: float fWeights[ 4 ]; - UInt32 fIndices; + uint32_t fIndices; }; @@ -125,13 +125,13 @@ class plMAXVertexAccNode hsPoint3 fPoint; // Inefficient space-wise, I know, but it makes this a lot simpler... hsVector3 fNormal; hsColorRGBA fColor, fIllum; - UInt32 fIndex; + uint32_t fIndex; hsPoint3 fUVs[ plGeometrySpan::kMaxNumUVChannels ]; - UInt32 fNumChannels; + uint32_t fNumChannels; plMAXVertexAccNode *fNext; - plMAXVertexAccNode( const hsPoint3 *point, const hsVector3 *normal, const hsColorRGBA& color, const hsColorRGBA& illum, int numChannels, const hsPoint3 *uvs, UInt32 index ); + plMAXVertexAccNode( const hsPoint3 *point, const hsVector3 *normal, const hsColorRGBA& color, const hsColorRGBA& illum, int numChannels, const hsPoint3 *uvs, uint32_t index ); hsBool IsEqual( const hsVector3 *normal, const hsColorRGBA& color, const hsColorRGBA& illum, const hsPoint3 *uvs ); }; @@ -145,11 +145,11 @@ class plMAXVertexAccumulator int fNumPoints, fNumChannels, fNumVertices; plMAXVertexAccNode **fPointList; - hsTArray fIndices; - hsTArray fInverseVertTable; + hsTArray fIndices; + hsTArray fInverseVertTable; - void IFindSkinWeights( ISkinContextData *skinData, int vertex, float *weights, UInt32 *indices ); - void IFindUserSkinWeights( plMaxNode* node, Mesh* mesh, int vertex, float *weights, UInt32 *indices ); + void IFindSkinWeights( ISkinContextData *skinData, int vertex, float *weights, uint32_t *indices ); + void IFindUserSkinWeights( plMaxNode* node, Mesh* mesh, int vertex, float *weights, uint32_t *indices ); void IFindAllUserSkinWeights( plMaxNode* node, Mesh* mesh, TempWeightInfo weights[]); public: @@ -161,7 +161,7 @@ class plMAXVertexAccumulator void StuffMyData( plMaxNode* node, plGeometrySpan *span, Mesh* mesh, ISkinContextData* skinData ); int GetVertexCount(); - UInt32 GetIndexCount( void ) { return fIndices.GetCount(); } + uint32_t GetIndexCount( void ) { return fIndices.GetCount(); } }; class plMAXVertNormal @@ -188,7 +188,7 @@ class plMAXVertNormal if( fNext ) fNext->AddNormal( n, s ); else - fNext = TRACKED_NEW plMAXVertNormal( ::Normalize(n), s ); + fNext = new plMAXVertNormal( ::Normalize(n), s ); } else { @@ -299,7 +299,7 @@ void plMeshConverter::StuffPositionsAndNormals(plMaxNode *node, hsTArrayGetName(); Mesh *mesh; - Int32 numVerts; + int32_t numVerts; hsMatrix44 l2wMatrix, vert2LMatrix, vertInvTransMatrix, tempMatrix; /// Get da mesh @@ -346,7 +346,7 @@ plConvexVolume *plMeshConverter::CreateConvexVolume(plMaxNode *node) const char* dbgNodeName = node->GetName(); Mesh *mesh; - Int32 numFaces, i, j, numVerts; + int32_t numFaces, i, j, numVerts; hsMatrix44 l2wMatrix, vert2LMatrix, vertInvTransMatrix, tempMatrix; hsBool flipOrder, checkForOverflow = false; @@ -358,7 +358,7 @@ plConvexVolume *plMeshConverter::CreateConvexVolume(plMaxNode *node) numFaces = mesh->getNumFaces(); numVerts = mesh->getNumVerts(); - plConvexVolume *bounds = TRACKED_NEW plConvexVolume(); + plConvexVolume *bounds = new plConvexVolume(); /// Get transforms l2wMatrix = node->GetLocalToWorld44(); @@ -379,7 +379,7 @@ plConvexVolume *plMeshConverter::CreateConvexVolume(plMaxNode *node) hsPoint3 pos[ 3 ]; hsPoint3 testPt1, testPt2, testPt3; hsVector3 normal; - UInt32 vertIdx[ 3 ]; + uint32_t vertIdx[ 3 ]; /// Add the 3 vertices to the correct vertex accumulator object @@ -458,7 +458,7 @@ bool plMeshConverter::IValidateUVs(plMaxNode* node) // Cache the original UV verts int numVerts = mesh->getNumMapVerts(1); int vertBufSize = sizeof(UVVert)*numVerts; - UVVert* origVerts = TRACKED_NEW UVVert[vertBufSize]; + UVVert* origVerts = new UVVert[vertBufSize]; memcpy(origVerts, mesh->mapVerts(1), vertBufSize); IDeleteTempGeometry(); @@ -520,15 +520,15 @@ hsBool plMeshConverter::CreateSpans( plMaxNode *node, hsTArrayGetName(); Mesh *mesh; - Int32 numFaces, i, j, k, numVerts, maxNumBones, maxUVWSrc; - Int32 numMaterials = 1, numSubMaterials = 1; + int32_t numFaces, i, j, k, numVerts, maxNumBones, maxUVWSrc; + int32_t numMaterials = 1, numSubMaterials = 1; hsMatrix44 l2wMatrix, vert2LMatrix, vertInvTransMatrix, tempMatrix; Mtl *maxMaterial = nil; hsBool isComposite, isMultiMat, flipOrder, checkForOverflow = false, includesComp; - UInt8 ourFormat, numChannels, maxBlendChannels; + uint8_t ourFormat, numChannels, maxBlendChannels; hsColorRGBA *colorArray = nil; hsColorRGBA *illumArray = nil; - UInt32 sharedSpanProps = 0; + uint32_t sharedSpanProps = 0; hsBitVector usedSubMtls; hsBool makeAlphaLayer = node->VtxAlphaNotAvailable(); @@ -621,7 +621,7 @@ hsBool plMeshConverter::CreateSpans( plMaxNode *node, hsTArrayGetHasWaterHeight() ) { sharedSpanProps |= plGeometrySpan::kWaterHeight; @@ -646,7 +646,7 @@ hsBool plMeshConverter::CreateSpans( plMaxNode *node, hsTArrayvertCol != nil) { - colorArray = TRACKED_NEW hsColorRGBA[ mesh->numCVerts ]; + colorArray = new hsColorRGBA[ mesh->numCVerts ]; for( i = 0; i < mesh->numCVerts; i++ ) { colorArray[i].Set(mesh->vertCol[ i ].x, mesh->vertCol[ i ].y, mesh->vertCol[ i ].z, 1.f); @@ -666,7 +666,7 @@ hsBool plMeshConverter::CreateSpans( plMaxNode *node, hsTArray *currAccum = TRACKED_NEW hsTArray; + hsTArray *currAccum = new hsTArray; int currNumSubMtls = ourMaterials[i]->GetCount(); currAccum->Reset(); ourAccumulators[i] = currAccum; @@ -860,7 +860,7 @@ hsBool plMeshConverter::CreateSpans( plMaxNode *node, hsTArrayfaces[ i ]; Point3 v0, v1, v2, norm; - UInt32 smGroup = smoothAll ? 1 : maxFace->getSmGroup(); + uint32_t smGroup = smoothAll ? 1 : maxFace->getSmGroup(); v0 = mesh->verts[ maxFace->v[ 0 ] ]; v1 = mesh->verts[ maxFace->v[ 1 ] ]; @@ -873,13 +873,13 @@ hsBool plMeshConverter::CreateSpans( plMaxNode *node, hsTArray[numMaterials]; - vertDPosDvCache = TRACKED_NEW hsTArray[numMaterials]; + vertDPosDuCache = new hsTArray[numMaterials]; + vertDPosDvCache = new hsTArray[numMaterials]; - hsTArray bumpLayIdx; - hsTArray bumpLayChan; - hsTArray bumpDuChan; - hsTArray bumpDvChan; + hsTArray bumpLayIdx; + hsTArray bumpLayChan; + hsTArray bumpDuChan; + hsTArray bumpDvChan; ISetBumpUvSrcs(ourMaterials, bumpLayIdx, bumpLayChan, bumpDuChan, bumpDvChan); if( node->GetWaterDecEnv() ) ISetWaterDecEnvUvSrcs(ourMaterials, bumpLayIdx, bumpLayChan, bumpDuChan, bumpDvChan); @@ -901,7 +901,7 @@ hsBool plMeshConverter::CreateSpans( plMaxNode *node, hsTArrayGetVertexCount() == 0) continue; - plGeometrySpan *span = TRACKED_NEW plGeometrySpan; + plGeometrySpan *span = new plGeometrySpan; span->BeginCreate( subMats->Get(j).fMaterial, l2wMatrix, ourFormat ); span->fLocalToOBB = node->GetLocalToOBB44(); @@ -1214,7 +1214,7 @@ hsBool plMeshConverter::CreateSpans( plMaxNode *node, hsTArrayEndCreate(); - hsScalar minDist, maxDist; + float minDist, maxDist; if( hsMaterialConverter::HasVisDists(node, i, minDist, maxDist) ) { span->fMinDist = (minDist); @@ -1345,9 +1345,9 @@ hsBool plMeshConverter::CreateSpans( plMaxNode *node, hsTArrayGetMtl(); @@ -1624,10 +1624,10 @@ int plMeshConverter::IGenerateUVs( plMaxNode *node, Mtl *maxMtl, Mesh *mesh, } void plMeshConverter::ISetWaterDecEnvUvSrcs(hsTArray *>& ourMaterials, - hsTArray& bumpLayIdx, - hsTArray& bumpLayChan, - hsTArray& bumpDuChan, - hsTArray& bumpDvChan) + hsTArray& bumpLayIdx, + hsTArray& bumpLayChan, + hsTArray& bumpDuChan, + hsTArray& bumpDvChan) { bumpLayIdx.SetCount(ourMaterials.GetCount()); bumpLayChan.SetCount(ourMaterials.GetCount()); @@ -1645,10 +1645,10 @@ void plMeshConverter::ISetWaterDecEnvUvSrcs(hsTArray *>& ourMaterials, - hsTArray& bumpLayIdx, - hsTArray& bumpLayChan, - hsTArray& bumpDuChan, - hsTArray& bumpDvChan) + hsTArray& bumpLayIdx, + hsTArray& bumpLayChan, + hsTArray& bumpDuChan, + hsTArray& bumpDvChan) { bumpLayIdx.SetCount(ourMaterials.GetCount()); bumpLayChan.SetCount(ourMaterials.GetCount()); @@ -1690,7 +1690,7 @@ void plMeshConverter::ISetBumpUvSrcs(hsTArray *>& } } -void plMeshConverter::ISetBumpUvs(Int16 uvChan, hsTArray& vertDPosDuvCache, TVFace* tvFace, UInt32 smGroup, +void plMeshConverter::ISetBumpUvs(int16_t uvChan, hsTArray& vertDPosDuvCache, TVFace* tvFace, uint32_t smGroup, hsPoint3* uvs1, hsPoint3* uvs2, hsPoint3* uvs3) { if( uvChan < 0 ) @@ -1708,7 +1708,7 @@ void plMeshConverter::ISetBumpUvs(Int16 uvChan, hsTArray& vertD // If we decided we needed them, they are in the output arrays, otherwise the output arrays are made empty. void plMeshConverter::ISmoothUVGradients(plMaxNode* node, Mesh* mesh, hsTArray *>& ourMaterials, - hsTArray& bumpLayIdx, hsTArray& bumpLayChan, + hsTArray& bumpLayIdx, hsTArray& bumpLayChan, hsTArray* vertDPosDuCache, hsTArray* vertDPosDvCache) { const char* dbgNodeName = node->GetName(); @@ -1724,7 +1724,7 @@ void plMeshConverter::ISmoothUVGradients(plMaxNode* node, Mesh* mesh, { if( bumpLayIdx[matIdx] >= 0 ) { - UInt32 uvwSrc = bumpLayChan[matIdx]; + uint32_t uvwSrc = bumpLayChan[matIdx]; if( mesh->getNumMapVerts(uvwSrc+1) && mesh->mapVerts(uvwSrc+1) ) { vertDPosDuCache[matIdx].SetCount(mesh->getNumMapVerts(uvwSrc+1)); @@ -1823,7 +1823,7 @@ void plMeshConverter::ISmoothUVGradients(plMaxNode* node, Mesh* mesh, // Get dPos/du into uvws[0], and dPos/dv into uvws[1]. dPos should be in the object's local space. Point3 plMeshConverter::IGetUvGradient(plMaxNode* node, - const hsMatrix44& uvXform44, Int16 bmpUvwSrc, // Transform and uvwSrc of layer to gradient + const hsMatrix44& uvXform44, int16_t bmpUvwSrc, // Transform and uvwSrc of layer to gradient Mesh *mesh, int faceIdx, int iUV) // 0 = uvw.x, 1 = uv2.y { @@ -1988,7 +1988,7 @@ void plMeshConverter::IGetUVTransform( plMaxNode *node, Mtl *mtl, Matrix3 *uv //// plMAXVertexAccNode Constructor ////////////////////////////////////////// -plMAXVertexAccNode::plMAXVertexAccNode( const hsPoint3 *point, const hsVector3 *normal, const hsColorRGBA& color, const hsColorRGBA& illum, int numChannels, const hsPoint3 *uvs, UInt32 index ) +plMAXVertexAccNode::plMAXVertexAccNode( const hsPoint3 *point, const hsVector3 *normal, const hsColorRGBA& color, const hsColorRGBA& illum, int numChannels, const hsPoint3 *uvs, uint32_t index ) { int i; @@ -2032,7 +2032,7 @@ plMAXVertexAccumulator::plMAXVertexAccumulator( int numOrigPoints, int numChanne fNumPoints = numOrigPoints; fNumChannels = numChannels; - fPointList = TRACKED_NEW plMAXVertexAccNodePtr[ fNumPoints ]; + fPointList = new plMAXVertexAccNodePtr[ fNumPoints ]; memset( fPointList, 0, sizeof( plMAXVertexAccNode * ) * fNumPoints ); fIndices.Reset(); @@ -2084,7 +2084,7 @@ void plMAXVertexAccumulator::AddVertex( int index, hsPoint3 *point, hsVector3 /// Adding new - node = TRACKED_NEW plMAXVertexAccNode( point, normal, color, illum, fNumChannels, uvs, fNumVertices ); + node = new plMAXVertexAccNode( point, normal, color, illum, fNumChannels, uvs, fNumVertices ); fInverseVertTable.Append( index ); fIndices.Append( fNumVertices++ ); @@ -2106,7 +2106,7 @@ void plMAXVertexAccumulator::StuffMyData( plMaxNode* maxNode, plGeometrySpan TempWeightInfo *weights = nil; /// Precalculate the weights if necessary - weights = TRACKED_NEW TempWeightInfo[ fNumPoints ]; + weights = new TempWeightInfo[ fNumPoints ]; if( skinData != nil ) { for( i = 0; i < fNumPoints; i++ ) @@ -2152,7 +2152,7 @@ void plMAXVertexAccumulator::StuffMyData( plMaxNode* maxNode, plGeometrySpan { for (i = 0; i < fNumPoints; i++) { - UInt8 indices[4]; + uint8_t indices[4]; indices[0] = (weights[i].fIndices) & 0xff; indices[1] = (weights[i].fIndices >> 8) & 0xff; indices[2] = (weights[i].fIndices >> 16) & 0xff; @@ -2177,10 +2177,10 @@ void plMAXVertexAccumulator::StuffMyData( plMaxNode* maxNode, plGeometrySpan } } - hsScalar maxWgt = 0; - hsScalar penWgt = 0; - Int16 maxIdx = -1; - Int16 penIdx = -1; + float maxWgt = 0; + float penWgt = 0; + int16_t maxIdx = -1; + int16_t penIdx = -1; // Find the highest two weighted bones. We'll use just these two to calculate our bounds. for( i = 0; i < fNumPoints; i++ ) { @@ -2310,14 +2310,14 @@ void plMAXVertexAccumulator::IFindAllUserSkinWeights( plMaxNode* node, Mesh* mes //// IFindSkinWeights //////////////////////////////////////////////////////// // Finds the biggest weights (up to 4) for the given vertex index and returns -// them, along with a dword specifying the indices for each. +// them, along with a uint32_t specifying the indices for each. void plMAXVertexAccumulator::IFindSkinWeights( ISkinContextData *skinData, int vertex, - float *weights, UInt32 *indices ) + float *weights, uint32_t *indices ) { float tempWs[ 4 ], tempW, t; - UInt32 idxs[ 4 ], tempIdx, tI; + uint32_t idxs[ 4 ], tempIdx, tI; int i, j; tempWs[ 0 ] = tempWs[ 1 ] = tempWs[ 2 ] = tempWs[ 3 ] = 0; @@ -2327,7 +2327,7 @@ void plMAXVertexAccumulator::IFindSkinWeights( ISkinContextData *skinData, if( boneCount ) { - hsScalar defWgt = 1.f; + float defWgt = 1.f; for( i = 0; i < boneCount; i++ ) { /// Grab the weight and index for this bone @@ -2444,12 +2444,12 @@ void SetWaterColor(plGeometrySpan* span) const int nVerts = tri.VertCount(); // Now, set up our accumulators - hsTArray lens; + hsTArray lens; lens.SetCount(nVerts); - memset(lens.AcquireArray(), 0, nVerts * sizeof(hsScalar)); - hsTArray wgts; + memset(lens.AcquireArray(), 0, nVerts * sizeof(float)); + hsTArray wgts; wgts.SetCount(nVerts); - memset(wgts.AcquireArray(), 0, nVerts * sizeof(hsScalar)); + memset(wgts.AcquireArray(), 0, nVerts * sizeof(float)); // For each triangle for( triIter.Begin(); triIter.More(); triIter.Advance() ) @@ -2461,15 +2461,15 @@ void SetWaterColor(plGeometrySpan* span) // Actually, I just realized that the area way kind of sucks, because, // as a parallelogram gets less and less rectangular, the area goes down // even as the longest edge (the diagonal) gets longer. - hsScalar lenSq20 = hsVector3(&triIter.Position(2), &triIter.Position(0)).MagnitudeSquared(); - hsScalar lenSq10 = hsVector3(&triIter.Position(1), &triIter.Position(0)).MagnitudeSquared(); - hsScalar lenSq21 = hsVector3(&triIter.Position(2), &triIter.Position(1)).MagnitudeSquared(); - hsScalar len = lenSq20; + float lenSq20 = hsVector3(&triIter.Position(2), &triIter.Position(0)).MagnitudeSquared(); + float lenSq10 = hsVector3(&triIter.Position(1), &triIter.Position(0)).MagnitudeSquared(); + float lenSq21 = hsVector3(&triIter.Position(2), &triIter.Position(1)).MagnitudeSquared(); + float len = lenSq20; if( len < lenSq10 ) len = lenSq10; if( len < lenSq21 ) len = lenSq21; - len = hsSquareRoot(len); + len = sqrt(len); lens[triIter.RawIndex(0)] += len; wgts[triIter.RawIndex(0)] += 1.f; @@ -2492,9 +2492,9 @@ void SetWaterColor(plGeometrySpan* span) } // Now we might want to smooth this out some // This can be repeated for any degree of smoothing - hsTArray smLens; + hsTArray smLens; smLens.SetCount(nVerts); - memset(smLens.AcquireArray(), 0, nVerts * sizeof(hsScalar)); + memset(smLens.AcquireArray(), 0, nVerts * sizeof(float)); // For each triangle for( triIter.Begin(); triIter.More(); triIter.Advance() ) { @@ -2508,7 +2508,7 @@ void SetWaterColor(plGeometrySpan* span) smLens[iVert] += lens[iVert]; wgts[iVert] += 1.f; - const hsScalar kSmooth(8.f); + const float kSmooth(8.f); smLens[iVertNext] += lens[iVert] * kSmooth; wgts[iVertNext] += kSmooth; @@ -2526,7 +2526,7 @@ void SetWaterColor(plGeometrySpan* span) wgts[iVert] = 0.f; // We'll use them again on smoothing. } - plConst(hsScalar) kNumLens(4.f); + plConst(float) kNumLens(4.f); // Okay, we have smoothed lengths. We just need to // iterate over the vertices and stuff 1/len into the alpha channel // For each vert diff --git a/Sources/Tools/MaxConvert/plMeshConverter.h b/Sources/Tools/MaxConvert/plMeshConverter.h index e66e7bf7..7403ac1b 100644 --- a/Sources/Tools/MaxConvert/plMeshConverter.h +++ b/Sources/Tools/MaxConvert/plMeshConverter.h @@ -106,17 +106,17 @@ public: private: bool IValidateUVs(plMaxNode* node); - void ISetBumpUvs(Int16 uvChan, hsTArray& vertDPosDuvCache, TVFace* tvFace, UInt32 smGroup, + void ISetBumpUvs(int16_t uvChan, hsTArray& vertDPosDuvCache, TVFace* tvFace, uint32_t smGroup, hsPoint3* uvs1, hsPoint3* uvs2, hsPoint3* uvs3); void ISetBumpUvSrcs(hsTArray *>& ourMaterials, - hsTArray& bumpLayIdx, hsTArray& bumpLayChan, hsTArray& bumpDuChan, hsTArray& bumpDvChan); + hsTArray& bumpLayIdx, hsTArray& bumpLayChan, hsTArray& bumpDuChan, hsTArray& bumpDvChan); void ISetWaterDecEnvUvSrcs(hsTArray *>& ourMaterials, - hsTArray& bumpLayIdx, hsTArray& bumpLayChan, hsTArray& bumpDuChan, hsTArray& bumpDvChan); + hsTArray& bumpLayIdx, hsTArray& bumpLayChan, hsTArray& bumpDuChan, hsTArray& bumpDvChan); void ISmoothUVGradients(plMaxNode* node, Mesh* mesh, hsTArray *>& ourMaterials, - hsTArray& bumpLayIdx, hsTArray& bumpLayChan, + hsTArray& bumpLayIdx, hsTArray& bumpLayChan, hsTArray* vertDPosDuCache, hsTArray* vertDPosDvCache); - Point3 IGetUvGradient(plMaxNode* node, const hsMatrix44& uvXform44, Int16 bmpUvwSrc, + Point3 IGetUvGradient(plMaxNode* node, const hsMatrix44& uvXform44, int16_t bmpUvwSrc, Mesh *mesh, int faceIdx, int iUV); @@ -124,8 +124,8 @@ private: hsPoint3 *uvs1, hsPoint3 *uvs2, hsPoint3 *uvs3 ); void IGetUVTransform( plMaxNode *node, Mtl *mtl, Matrix3 *uvTransform, int which ); - UInt32 ICreateHexColor( float r, float g, float b ); - UInt32 ISetHexAlpha( UInt32 color, float alpha ); + uint32_t ICreateHexColor( float r, float g, float b ); + uint32_t ISetHexAlpha( uint32_t color, float alpha ); Mesh* IGetNodeMesh(plMaxNode *node); void IDeleteTempGeometry(); diff --git a/Sources/Tools/MaxConvert/plRenderInstance.cpp b/Sources/Tools/MaxConvert/plRenderInstance.cpp index e13484b1..82ec1b69 100644 --- a/Sources/Tools/MaxConvert/plRenderInstance.cpp +++ b/Sources/Tools/MaxConvert/plRenderInstance.cpp @@ -40,7 +40,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "Max.h" #include "plRenderInstance.h" @@ -55,7 +55,7 @@ public: plNilView() { projType = 1; - fov = hsScalarPI * 0.25f; + fov = M_PI * 0.25f; pixelSize = 1.f; affineTM.IdentityMatrix(); worldToView.IdentityMatrix(); diff --git a/Sources/Tools/MaxExport/SimpleExport.h b/Sources/Tools/MaxExport/SimpleExport.h index 3fa244f8..71681bcb 100644 --- a/Sources/Tools/MaxExport/SimpleExport.h +++ b/Sources/Tools/MaxExport/SimpleExport.h @@ -42,7 +42,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #ifndef __SIMPLEEXPORT_H #define __SIMPLEEXPORT_H -#include "hsWindows.h" + #include "MaxMain/resource.h" #include "Max.h" #include "HeadSpin.h" @@ -79,7 +79,7 @@ public: const char* GetName() { return fName; } private: - static hsBool IProgressCallback(hsScalar percent); + static hsBool IProgressCallback(float percent); static DWORD WINAPI IProgressDummyFunc(LPVOID arg); char fName[128]; @@ -91,7 +91,7 @@ class HSClassDesc2 : public ClassDesc { public: int IsPublic() { return 1; } - void * Create(BOOL loading = FALSE) { return TRACKED_NEW HSExport2; } + void * Create(BOOL loading = FALSE) { return new HSExport2; } const TCHAR * ClassName() { return "Plasma 2.0 Scene Exporter"; } SClass_ID SuperClassID() { return SCENE_EXPORT_CLASS_ID; } #ifdef HS_DEBUGGING diff --git a/Sources/Tools/MaxExport/plErrorMsg.cpp b/Sources/Tools/MaxExport/plErrorMsg.cpp index 522e645c..c4e1fc55 100644 --- a/Sources/Tools/MaxExport/plErrorMsg.cpp +++ b/Sources/Tools/MaxExport/plErrorMsg.cpp @@ -41,9 +41,9 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ #include "HeadSpin.h" #include "plErrorMsg.h" -#include "hsTypes.h" +#include "HeadSpin.h" #include "hsExceptions.h" -#include "hsUtils.h" + #include "plErrorMsg.h" diff --git a/Sources/Tools/MaxExport/plErrorMsg.h b/Sources/Tools/MaxExport/plErrorMsg.h index dfc2b981..943f4b9c 100644 --- a/Sources/Tools/MaxExport/plErrorMsg.h +++ b/Sources/Tools/MaxExport/plErrorMsg.h @@ -42,7 +42,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #ifndef __plErrorMsg_h #define __plErrorMsg_h -#include "hsTypes.h" +#include "HeadSpin.h" #define PL_ERR_MSG_MAX_MSG 2048 diff --git a/Sources/Tools/MaxExport/plExportDlg.cpp b/Sources/Tools/MaxExport/plExportDlg.cpp index 43bee384..2bfe7811 100644 --- a/Sources/Tools/MaxExport/plExportDlg.cpp +++ b/Sources/Tools/MaxExport/plExportDlg.cpp @@ -40,7 +40,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ #include "HeadSpin.h" -#include "hsTypes.h" +#include "HeadSpin.h" #include "plExportDlg.h" #include "MaxMain/resource.h" #include "max.h" diff --git a/Sources/Tools/MaxExport/plExportErrorMsg.cpp b/Sources/Tools/MaxExport/plExportErrorMsg.cpp index e1e1d96a..0c6ac71a 100644 --- a/Sources/Tools/MaxExport/plExportErrorMsg.cpp +++ b/Sources/Tools/MaxExport/plExportErrorMsg.cpp @@ -40,11 +40,11 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ #include "HeadSpin.h" -#include "hsWindows.h" -#include "hsTypes.h" + +#include "HeadSpin.h" #include "plExportErrorMsg.h" #include "hsExceptions.h" -#include "hsUtils.h" + diff --git a/Sources/Tools/MaxExport/plExportLogErrorMsg.cpp b/Sources/Tools/MaxExport/plExportLogErrorMsg.cpp index 5f08dbed..76b8275c 100644 --- a/Sources/Tools/MaxExport/plExportLogErrorMsg.cpp +++ b/Sources/Tools/MaxExport/plExportLogErrorMsg.cpp @@ -44,11 +44,11 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include #include #include -#include "hsWindows.h" -#include "hsTypes.h" + +#include "HeadSpin.h" #include "plExportLogErrorMsg.h" #include "hsExceptions.h" -#include "hsUtils.h" + // // On our way out, be sure to close the error file diff --git a/Sources/Tools/MaxExport/plExportLogErrorMsg.h b/Sources/Tools/MaxExport/plExportLogErrorMsg.h index 0a7684d3..f65c9224 100644 --- a/Sources/Tools/MaxExport/plExportLogErrorMsg.h +++ b/Sources/Tools/MaxExport/plExportLogErrorMsg.h @@ -97,7 +97,7 @@ protected: private: FILE *fErrfile; // the error file to write the nasties char fErrfile_name[ERROR_LOGFILE_NAME_LEN]; // the name of the error file - Int32 fNumberErrors; + int32_t fNumberErrors; private: void IDebugThrow(); diff --git a/Sources/Tools/MaxExport/plExportProgressBar.cpp b/Sources/Tools/MaxExport/plExportProgressBar.cpp index 94451c98..81f459f8 100644 --- a/Sources/Tools/MaxExport/plExportProgressBar.cpp +++ b/Sources/Tools/MaxExport/plExportProgressBar.cpp @@ -65,7 +65,7 @@ plExportProgressBar::~plExportProgressBar() fInterface->ProgressEnd(); } -void plExportProgressBar::Start(char *name, UInt32 steps) +void plExportProgressBar::Start(char *name, uint32_t steps) { fTotalSteps = steps; fCurStep = 0; @@ -81,7 +81,7 @@ void plExportProgressBar::Start(char *name, UInt32 steps) } } -bool plExportProgressBar::Update(char *name, UInt32 inc) +bool plExportProgressBar::Update(char *name, uint32_t inc) { fCurStep += inc; @@ -119,14 +119,14 @@ bool plExportProgressBar::Update(char *name, UInt32 inc) return false; } -UInt32 plExportProgressBar::CountNodes() +uint32_t plExportProgressBar::CountNodes() { return INodeCount(GetCOREInterface()->GetRootNode()); } -UInt32 plExportProgressBar::INodeCount(INode *node) +uint32_t plExportProgressBar::INodeCount(INode *node) { - UInt32 count = 1; + uint32_t count = 1; for (int i = 0; i < node->NumberOfChildren(); i++) { diff --git a/Sources/Tools/MaxExport/plExportProgressBar.h b/Sources/Tools/MaxExport/plExportProgressBar.h index 29d9d184..2d8df767 100644 --- a/Sources/Tools/MaxExport/plExportProgressBar.h +++ b/Sources/Tools/MaxExport/plExportProgressBar.h @@ -42,7 +42,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #ifndef plExportProgressBar_inc #define plExportProgressBar_inc -#include "hsTypes.h" +#include "HeadSpin.h" class INode; @@ -52,18 +52,18 @@ public: plExportProgressBar(); ~plExportProgressBar(); - void Start(char *name, UInt32 steps=CountNodes()); - bool Update(char *name=nil, UInt32 inc=1); + void Start(char *name, uint32_t steps=CountNodes()); + bool Update(char *name=nil, uint32_t inc=1); - static UInt32 CountNodes(); + static uint32_t CountNodes(); private: - static UInt32 INodeCount(INode *node); + static uint32_t INodeCount(INode *node); Interface* fInterface; - UInt32 fTotalSteps; - UInt32 fCurStep; + uint32_t fTotalSteps; + uint32_t fCurStep; }; #endif // plExportProgressBar_inc \ No newline at end of file diff --git a/Sources/Tools/MaxExport/plProgressBar.h b/Sources/Tools/MaxExport/plProgressBar.h index 18c133ef..4af5f047 100644 --- a/Sources/Tools/MaxExport/plProgressBar.h +++ b/Sources/Tools/MaxExport/plProgressBar.h @@ -43,8 +43,8 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #ifndef plProgressBar_inc #define plProgressBar_inc -#include "hsTypes.h" -#include "hsScalar.h" +#include "HeadSpin.h" + // The progress bar displays an amount that's *fraction* of the distance between min and max. // i.e., if min is 0.2 and max is 0.7, the bar will run the gamut from min to max; at fraction @@ -54,7 +54,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com class plProgressBar { public: - plProgressBar(hsScalar min, hsScalar max) : fMin(min), fMax(max) + plProgressBar(float min, float max) : fMin(min), fMax(max) { hsAssert(min >= 0, "Min too small."); hsAssert(min <= 1, "Min too big."); @@ -63,13 +63,13 @@ public: hsAssert(min <= max, "Min and max out of order."); } - virtual hsBool32 Update(hsScalar fraction) = 0; + virtual hsBool32 Update(float fraction) = 0; - hsScalar GetTotalFraction(hsScalar f) const { return fMin + f * (fMax - fMin); } + float GetTotalFraction(float f) const { return fMin + f * (fMax - fMin); } private: - hsScalar fMin; - hsScalar fMax; + float fMin; + float fMax; }; #endif // plProgressBar_inc \ No newline at end of file diff --git a/Sources/Tools/MaxMain/CMakeLists.txt b/Sources/Tools/MaxMain/CMakeLists.txt index 64ae1bbf..034ac889 100644 --- a/Sources/Tools/MaxMain/CMakeLists.txt +++ b/Sources/Tools/MaxMain/CMakeLists.txt @@ -110,7 +110,6 @@ target_link_libraries(MaxMain ${Vorbis_LIBRARIES}) # Carbon copy from plClient # TODO: Maybe see if some of these can be removed? target_link_libraries(MaxMain CoreLib) -target_link_libraries(MaxMain CoreLibExe) target_link_libraries(MaxMain pfAnimation) target_link_libraries(MaxMain pfAudio) target_link_libraries(MaxMain pfCamera) diff --git a/Sources/Tools/MaxMain/GlobalUtility.cpp b/Sources/Tools/MaxMain/GlobalUtility.cpp index 47922759..d6ab8045 100644 --- a/Sources/Tools/MaxMain/GlobalUtility.cpp +++ b/Sources/Tools/MaxMain/GlobalUtility.cpp @@ -247,7 +247,7 @@ void PlasmaMax::Stop() #include "../../AssetMan/PublicInterface/AssManBaseTypes.h" #endif -void TextureSet(Texmap* texmap, int iBmp, UInt64 assetId) +void TextureSet(Texmap* texmap, int iBmp, uint64_t assetId) { plPlasmaMAXLayer* layer = plPlasmaMAXLayer::GetPlasmaMAXLayer(texmap); if (layer) @@ -301,7 +301,7 @@ DWORD PlasmaMax::Control(DWORD parameter) } #ifdef MAXASS_AVAILABLE - jvArray* textures = TRACKED_NEW jvArray(texInfo.size()); + jvArray* textures = new jvArray(texInfo.size()); for (int i = 0; i < texInfo.size(); i++) (*textures)[i] = texInfo[i]; return DWORD(textures); diff --git a/Sources/Tools/MaxMain/GlobalUtility.h b/Sources/Tools/MaxMain/GlobalUtility.h index 1ce30596..87f17a95 100644 --- a/Sources/Tools/MaxMain/GlobalUtility.h +++ b/Sources/Tools/MaxMain/GlobalUtility.h @@ -47,14 +47,14 @@ class Texmap; #include "max.h" #include "guplib.h" -#include "hsTypes.h" +#include "HeadSpin.h" #include #define PLASMA_MAX_CLASSID Class_ID(0x3d494269, 0x103c5c5f) extern ClassDesc* GetGUPDesc(); -typedef void (*TextureSetFunc)(Texmap* texmap, int iBmp, UInt64 assetId); +typedef void (*TextureSetFunc)(Texmap* texmap, int iBmp, uint64_t assetId); struct TexInfo { diff --git a/Sources/Tools/MaxMain/main.cpp b/Sources/Tools/MaxMain/main.cpp index 45afc05b..06a79654 100644 --- a/Sources/Tools/MaxMain/main.cpp +++ b/Sources/Tools/MaxMain/main.cpp @@ -45,8 +45,6 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "istdplug.h" #include "custcont.h" -#include "HeadSpin.h" - #include "MaxExport/SimpleExport.h" #include "MaxMain/MaxCompat.h" @@ -172,7 +170,7 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL,ULONG fdwReason,LPVOID lpvReserved) } // Initialize the ResManager - plResManager* pRmgr = TRACKED_NEW plPluginResManager; + plResManager* pRmgr = new plPluginResManager; hsgResMgr::Init(pRmgr); } @@ -240,7 +238,7 @@ class plGeneralAttribClassDesc : public ClassDesc2 { public: int IsPublic() { return 1; } - void* Create(BOOL loading) { return TRACKED_NEW plGeneralAttrib; } + void* Create(BOOL loading) { return new plGeneralAttrib; } const TCHAR* ClassName() { return _T("Plasma Attrib"); } SClass_ID SuperClassID() { return CUST_ATTRIB_CLASS_ID; } Class_ID ClassID() { return PL_GEN_ATTRIB_CLASS_ID; } diff --git a/Sources/Tools/MaxMain/plActionTableMgr.h b/Sources/Tools/MaxMain/plActionTableMgr.h index ad2c4f41..fc024073 100644 --- a/Sources/Tools/MaxMain/plActionTableMgr.h +++ b/Sources/Tools/MaxMain/plActionTableMgr.h @@ -48,10 +48,10 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #ifndef __PLACTIONTABLEMGR_H #define __PLACTIONTABLEMGR_H +#include "HeadSpin.h" #include "Max.h" #include "notify.h" #include -#include "hsTypes.h" typedef bool(*ActionCallbackFunc)(int); diff --git a/Sources/Tools/MaxMain/plAgeDescInterface.cpp b/Sources/Tools/MaxMain/plAgeDescInterface.cpp index 95d710b2..df59b1f0 100644 --- a/Sources/Tools/MaxMain/plAgeDescInterface.cpp +++ b/Sources/Tools/MaxMain/plAgeDescInterface.cpp @@ -47,7 +47,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "plAgeDescription/plAgeDescription.h" #include "plMaxCFGFile.h" #include "hsStream.h" -#include "hsUtils.h" + #ifdef MAXASS_AVAILABLE #include "../../AssetMan/PublicInterface/MaxAssInterface.h" #endif @@ -187,7 +187,7 @@ BOOL plAgeDescInterface::DlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lPar #ifdef MAXASS_AVAILABLE if( fAssetManIface == nil ) - fAssetManIface = TRACKED_NEW MaxAssBranchAccess(); + fAssetManIface = new MaxAssBranchAccess(); #endif // Make our bold font by getting the normal font and bolding @@ -333,7 +333,7 @@ BOOL plAgeDescInterface::DlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lPar { if( MessageBox( hDlg, "Are you sure you wish to reassign the sequence prefix for this age?", "WARNING", MB_YESNO | MB_ICONEXCLAMATION ) == IDYES ) { - Int32 prefix = (Int32)IGetNextFreeSequencePrefix( IsDlgButtonChecked( hDlg, IDC_RSVDCHECK ) ); + int32_t prefix = (int32_t)IGetNextFreeSequencePrefix( IsDlgButtonChecked( hDlg, IDC_RSVDCHECK ) ); fSeqPrefixSpin->SetValue( ( prefix >= 0 ) ? prefix : -prefix, false ); fDirty = true; } @@ -853,7 +853,7 @@ void plAgeDescInterface::IGetAgeFiles(vector& ageFiles) { ageFolder.GetPathAndName(agePath); - plAgeFile* age = TRACKED_NEW plAgeFile(plAgeFile::kLocalFile, agePath); + plAgeFile* age = new plAgeFile(plAgeFile::kLocalFile, agePath); ageFiles.push_back(age); } } @@ -873,7 +873,7 @@ void plAgeDescInterface::IGetAgeFiles(vector& ageFiles) { if (assetMan->GetLatestVersionFile((*assets)[i], agePath, sizeof(agePath))) { - plAgeFile* age = TRACKED_NEW plAgeFile(plAgeFile::kAssetFile, agePath, (*assets)[i]); + plAgeFile* age = new plAgeFile(plAgeFile::kAssetFile, agePath, (*assets)[i]); int existing = IFindAge(age->fAgeName.c_str(), ageFiles); // Remove it from our "local" list if there, since it's a duplicate @@ -1092,16 +1092,16 @@ void plAgeDescInterface::INewPage() int idx = ListBox_AddString(hPages, name); // Choose a new sequence suffix for it - plAgePage *newPage = TRACKED_NEW plAgePage( name, IGetFreePageSeqSuffix( hPages ), 0 ); + plAgePage *newPage = new plAgePage( name, IGetFreePageSeqSuffix( hPages ), 0 ); ListBox_SetItemData( hPages, idx, (LPARAM)newPage ); fDirty = true; } -UInt32 plAgeDescInterface::IGetFreePageSeqSuffix( HWND pageCombo ) +uint32_t plAgeDescInterface::IGetFreePageSeqSuffix( HWND pageCombo ) { int i, count = ListBox_GetCount( pageCombo ); - UInt32 searchSeq = 1; + uint32_t searchSeq = 1; do { @@ -1253,7 +1253,7 @@ void plAgeDescInterface::ILoadAge( const char *path, hsBool checkSeqNum ) } fCapSpin->SetValue(maxCap, FALSE); - Int32 seqPrefix = aged.GetSequencePrefix(); + int32_t seqPrefix = aged.GetSequencePrefix(); if( seqPrefix < 0 ) { // Reserved prefix @@ -1282,9 +1282,9 @@ void plAgeDescInterface::ILoadAge( const char *path, hsBool checkSeqNum ) } } -UInt32 plAgeDescInterface::IGetNextFreeSequencePrefix( hsBool getReservedPrefix ) +uint32_t plAgeDescInterface::IGetNextFreeSequencePrefix( hsBool getReservedPrefix ) { - Int32 searchSeq = getReservedPrefix ? -1 : 1; + int32_t searchSeq = getReservedPrefix ? -1 : 1; hsTArray ageList; int i; diff --git a/Sources/Tools/MaxMain/plAgeDescInterface.h b/Sources/Tools/MaxMain/plAgeDescInterface.h index 1fa6e04e..a7507a4e 100644 --- a/Sources/Tools/MaxMain/plAgeDescInterface.h +++ b/Sources/Tools/MaxMain/plAgeDescInterface.h @@ -39,8 +39,8 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com Mead, WA 99021 *==LICENSE==*/ -#include "hsWindows.h" -#include "hsTypes.h" + +#include "HeadSpin.h" #include "hsTemplates.h" #include #include @@ -122,8 +122,8 @@ protected: void INewPage(); - UInt32 IGetNextFreeSequencePrefix( hsBool getReservedPrefix ); - UInt32 IGetFreePageSeqSuffix( HWND pageCombo ); + uint32_t IGetNextFreeSequencePrefix( hsBool getReservedPrefix ); + uint32_t IGetFreePageSeqSuffix( HWND pageCombo ); void ICheckOutCurrentAge( void ); void ICheckInCurrentAge( void ); diff --git a/Sources/Tools/MaxMain/plCommonObjLib.cpp b/Sources/Tools/MaxMain/plCommonObjLib.cpp index c286df42..dd6d0875 100644 --- a/Sources/Tools/MaxMain/plCommonObjLib.cpp +++ b/Sources/Tools/MaxMain/plCommonObjLib.cpp @@ -48,7 +48,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com ////////////////////////////////////////////////////////////////////////////// #include "HeadSpin.h" -#include "hsTypes.h" +#include "HeadSpin.h" #include "plCommonObjLib.h" #include "pnKeyedObject/hsKeyedObject.h" #include "pnKeyedObject/plUoid.h" @@ -64,7 +64,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com class plCommonObjLibList { public: - UInt32 fRefCount; + uint32_t fRefCount; hsTArray fLibs; plCommonObjLibList() { fRefCount = 0; } @@ -92,12 +92,12 @@ class plCommonObjLibList plCommonObjLibList *plCommonObjLib::fLibList = nil; -UInt32 plCommonObjLib::GetNumLibs( void ) +uint32_t plCommonObjLib::GetNumLibs( void ) { return ( fLibList != nil ) ? fLibList->fLibs.GetCount() : 0; } -plCommonObjLib *plCommonObjLib::GetLib( UInt32 idx ) +plCommonObjLib *plCommonObjLib::GetLib( uint32_t idx ) { if( fLibList == nil ) return nil; @@ -117,7 +117,7 @@ plCommonObjLib::plCommonObjLib() { // Make sure we have a list to add ourselves to if( fLibList == nil ) - fLibList = TRACKED_NEW plCommonObjLibList(); + fLibList = new plCommonObjLibList(); // Add ourselves to the list of libs fLibList->Add( this ); @@ -219,7 +219,7 @@ hsBool plCommonObjLib::RemoveObjectAndKey( plKey &key ) // our lib. Returns nil if not found. Use to find out if you already have a // object of a given name that was previously exported. -hsKeyedObject *plCommonObjLib::FindObject( const char *name, UInt16 classType /* = -1 */ ) +hsKeyedObject *plCommonObjLib::FindObject( const char *name, uint16_t classType /* = -1 */ ) { int i; @@ -230,7 +230,7 @@ hsKeyedObject *plCommonObjLib::FindObject( const char *name, UInt16 classType if( stricmp( uoid.GetObjectName(), name ) == 0 && - ( classType == (UInt16)-1 || classType == uoid.GetClassType() ) ) + ( classType == (uint16_t)-1 || classType == uoid.GetClassType() ) ) { return fObjects[ i ]; } diff --git a/Sources/Tools/MaxMain/plCommonObjLib.h b/Sources/Tools/MaxMain/plCommonObjLib.h index a6c11f3e..a1dfcdac 100644 --- a/Sources/Tools/MaxMain/plCommonObjLib.h +++ b/Sources/Tools/MaxMain/plCommonObjLib.h @@ -88,7 +88,7 @@ class plCommonObjLib void AddObject( hsKeyedObject *object ); hsBool RemoveObjectAndKey( plKey &key ); - hsKeyedObject *FindObject( const char *name, UInt16 classType = (UInt16)-1 ); + hsKeyedObject *FindObject( const char *name, uint16_t classType = (uint16_t)-1 ); void ClearObjectList( void ); /// THIS IS YOUR VIRTUAL HERE. Override this to define which objects you collect @@ -96,8 +96,8 @@ class plCommonObjLib /// Static functions for use only by the export resManager - static UInt32 GetNumLibs( void ); - static plCommonObjLib *GetLib( UInt32 idx ); + static uint32_t GetNumLibs( void ); + static plCommonObjLib *GetLib( uint32_t idx ); private: diff --git a/Sources/Tools/MaxMain/plComponentDlg.cpp b/Sources/Tools/MaxMain/plComponentDlg.cpp index 6057e307..adc229d1 100644 --- a/Sources/Tools/MaxMain/plComponentDlg.cpp +++ b/Sources/Tools/MaxMain/plComponentDlg.cpp @@ -205,7 +205,7 @@ void plComponentDlg::IGetComment() int len = GetWindowTextLength(GetDlgItem(fhDlg, IDC_COMMENTS))+1; if (len != 0) { - char *buf = TRACKED_NEW char[len]; + char *buf = new char[len]; GetDlgItemText(fhDlg, IDC_COMMENTS, buf, len); fCommentNode->SetUserPropBuffer(buf); delete [] buf; @@ -492,8 +492,8 @@ void plComponentDlg::ICreateMenu() const char *lastCat = nil; HMENU hCurType = nil; - UInt32 count = plComponentMgr::Inst().Count(); - for (UInt32 i = 0; i < count; i++) + uint32_t count = plComponentMgr::Inst().Count(); + for (uint32_t i = 0; i < count; i++) { plComponentClassDesc *desc = (plComponentClassDesc*)plComponentMgr::Inst().Get(i); @@ -960,7 +960,7 @@ bool plComponentDlg::IIsHidden(Class_ID& cid) //////////////////////////////////////////////////////////////////////////////// -#include "hsUtils.h" + class plCopyCompCallback : public HitByNameDlgCallback { diff --git a/Sources/Tools/MaxMain/plComponentPanel.cpp b/Sources/Tools/MaxMain/plComponentPanel.cpp index f3ec1c9f..3dc346cd 100644 --- a/Sources/Tools/MaxMain/plComponentPanel.cpp +++ b/Sources/Tools/MaxMain/plComponentPanel.cpp @@ -336,11 +336,11 @@ void plComponentUtil::IAddRollups(plComponentBase* comp) // // Update the targets dialog // - UInt32 numTargs = 0; + uint32_t numTargs = 0; if (fCurComponent) { // Only count non-nil targets - for (UInt32 i = 0; i < fCurComponent->NumTargets(); i++) + for (uint32_t i = 0; i < fCurComponent->NumTargets(); i++) if (fCurComponent->GetTarget(i)) numTargs++; } @@ -376,14 +376,14 @@ void plComponentUtil::INextTarget(bool forward) // Loop through the selected component's targets until we find the currently selected node. // This gives us a starting point to find the next or previous target in this component's list. plMaxNode *curNode = (plMaxNode*)GetCOREInterface()->GetSelNode(0); - UInt32 count = fCurComponent->NumTargets(); - for (UInt32 i = 0; i < count; i++) + uint32_t count = fCurComponent->NumTargets(); + for (uint32_t i = 0; i < count; i++) { if (fCurComponent->GetTarget(i) == curNode) { // Got to loop until the target is non-nil here, so we skip over // any deleted nodes. - UInt32 targIdx = i; + uint32_t targIdx = i; do { // Figure out which target to change to diff --git a/Sources/Tools/MaxMain/plGetLocationDlg.cpp b/Sources/Tools/MaxMain/plGetLocationDlg.cpp index c7cc88ac..69ae90d6 100644 --- a/Sources/Tools/MaxMain/plGetLocationDlg.cpp +++ b/Sources/Tools/MaxMain/plGetLocationDlg.cpp @@ -46,7 +46,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "resource.h" #include "MaxExport/plErrorMsg.h" #include "MaxComponent/plComponent.h" -#include "hsUtils.h" + plGetLocationDlg::plGetLocationDlg() : fNode(nil), fErrMsg(nil), fDefaultLocation(nil) { diff --git a/Sources/Tools/MaxMain/plGetLocationDlg.h b/Sources/Tools/MaxMain/plGetLocationDlg.h index be6f3d26..e26c0958 100644 --- a/Sources/Tools/MaxMain/plGetLocationDlg.h +++ b/Sources/Tools/MaxMain/plGetLocationDlg.h @@ -39,7 +39,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com Mead, WA 99021 *==LICENSE==*/ -#include "hsWindows.h" + class plErrorMsg; class plMaxNode; diff --git a/Sources/Tools/MaxMain/plMaxCFGFile.cpp b/Sources/Tools/MaxMain/plMaxCFGFile.cpp index 028d3042..ab2c734c 100644 --- a/Sources/Tools/MaxMain/plMaxCFGFile.cpp +++ b/Sources/Tools/MaxMain/plMaxCFGFile.cpp @@ -42,7 +42,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "HeadSpin.h" #include "plMaxCFGFile.h" #include "max.h" -#include "hsTypes.h" +#include "HeadSpin.h" #include "plFile/plBrowseFolder.h" const char *plMaxConfig::GetPluginIni() @@ -64,7 +64,7 @@ const char *plMaxConfig::GetClientPath(bool getNew, bool quiet) const char *plugDir = GetPluginIni(); // Get the saved path - UInt32 len = GetPrivateProfileString("SceneViewer", "Directory", "", plasmaPath, MAX_PATH, plugDir); + uint32_t len = GetPrivateProfileString("SceneViewer", "Directory", "", plasmaPath, MAX_PATH, plugDir); // If we didn't find a path, or we want a new one, ask the user for one if ((len == 0 || getNew) && !quiet) @@ -105,7 +105,7 @@ bool plMaxConfig::AssetManInterfaceDisabled() configstr[0] = '\0'; const char *plugDir = GetPluginIni(); - UInt32 len = GetPrivateProfileString("AssetMan", "Disable", "", configstr, MAX_PATH, plugDir); + uint32_t len = GetPrivateProfileString("AssetMan", "Disable", "", configstr, MAX_PATH, plugDir); if (strcmp(configstr, "1") == 0 || stricmp(configstr, "true") == 0) disabled = true; diff --git a/Sources/Tools/MaxMain/plMaxMeshExtractor.cpp b/Sources/Tools/MaxMain/plMaxMeshExtractor.cpp index e92f8c31..7e5d3442 100644 --- a/Sources/Tools/MaxMain/plMaxMeshExtractor.cpp +++ b/Sources/Tools/MaxMain/plMaxMeshExtractor.cpp @@ -97,7 +97,7 @@ static bool MakeNormalMesh(plMaxNode *node, plMaxMeshExtractor::NeutralMesh& mes int parity = fullTM.Parity(); mesh.fNumVerts = pMesh->numVerts; - mesh.fVerts = TRACKED_NEW hsPoint3[mesh.fNumVerts]; + mesh.fVerts = new hsPoint3[mesh.fNumVerts]; for (int i = 0; i < mesh.fNumVerts; i++) { @@ -111,11 +111,11 @@ static bool MakeNormalMesh(plMaxNode *node, plMaxMeshExtractor::NeutralMesh& mes } mesh.fNumFaces = pMesh->numFaces; - mesh.fFaces = TRACKED_NEW UInt16[mesh.fNumFaces*3]; + mesh.fFaces = new uint16_t[mesh.fNumFaces*3]; for (int i = 0; i < mesh.fNumFaces; i++) { Face* pFace = &pMesh->faces[i]; - UInt16* pNFace = &mesh.fFaces[i * 3]; + uint16_t* pNFace = &mesh.fFaces[i * 3]; pNFace[0] = pFace->v[ parity ? 2 : 0 ]; // reverse winding if parity backwards pNFace[1] = pFace->v[1]; @@ -135,8 +135,8 @@ static bool MakeNormalMesh(plMaxNode *node, plMaxMeshExtractor::NeutralMesh& mes // MODIFIES *all* the input parameters. static void MakeBoxMesh(plMaxNode* node, plMaxMeshExtractor::NeutralMesh& mesh, hsPoint3& minV, hsPoint3& maxV) { - hsPoint3* newVerts = TRACKED_NEW hsPoint3[8]; - UInt16* newFaces = TRACKED_NEW UInt16[12 * 3]; + hsPoint3* newVerts = new hsPoint3[8]; + uint16_t* newFaces = new uint16_t[12 * 3]; newVerts[0].Set(minV.fX, minV.fY, minV.fZ); newVerts[1].Set(maxV.fX, minV.fY, minV.fZ); @@ -147,7 +147,7 @@ static void MakeBoxMesh(plMaxNode* node, plMaxMeshExtractor::NeutralMesh& mesh, newVerts[6].Set(minV.fX, maxV.fY, maxV.fZ); newVerts[7].Set(maxV.fX, maxV.fY, maxV.fZ); - UInt16 standardFaces[] = { 0, 2, 1, + uint16_t standardFaces[] = { 0, 2, 1, 1, 2, 3, 0, 1, 4, 1, 5, 4, diff --git a/Sources/Tools/MaxMain/plMaxMeshExtractor.h b/Sources/Tools/MaxMain/plMaxMeshExtractor.h index 2829b55f..c005d3e5 100644 --- a/Sources/Tools/MaxMain/plMaxMeshExtractor.h +++ b/Sources/Tools/MaxMain/plMaxMeshExtractor.h @@ -42,7 +42,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #ifndef plMaxMeshExtractor_h_inc #define plMaxMeshExtractor_h_inc -#include "hsTypes.h" +#include "HeadSpin.h" #include "hsMatrix44.h" class plMaxNode; @@ -55,7 +55,7 @@ public: int fNumVerts; hsPoint3* fVerts; int fNumFaces; - UInt16* fFaces; + uint16_t* fFaces; hsMatrix44 fL2W; }; diff --git a/Sources/Tools/MaxMain/plMaxNode.cpp b/Sources/Tools/MaxMain/plMaxNode.cpp index e51b6426..16e22a1c 100644 --- a/Sources/Tools/MaxMain/plMaxNode.cpp +++ b/Sources/Tools/MaxMain/plMaxNode.cpp @@ -53,7 +53,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "plgDispatch.h" #include "plPluginResManager.h" #include "plMaxNodeData.h" -#include "hsUtils.h" + #include "MaxConvert/plConvert.h" #include "hsTemplates.h" @@ -204,21 +204,21 @@ void plMaxBoneMap::FillBoneArray(plMaxNodeBase **boneArray) boneArray[(*boneIt).second] = (*boneIt).first; } -UInt8 plMaxBoneMap::GetIndex(plMaxNodeBase *bone) +uint8_t plMaxBoneMap::GetIndex(plMaxNodeBase *bone) { hsAssert(fBones.find(bone) != fBones.end(), "Bone missing in remap!"); return fBones[bone]; } -UInt32 plMaxBoneMap::GetBaseMatrixIndex(plDrawable *draw) +uint32_t plMaxBoneMap::GetBaseMatrixIndex(plDrawable *draw) { if (fBaseMatrices.find(draw) == fBaseMatrices.end()) - return (UInt32)-1; + return (uint32_t)-1; return fBaseMatrices[draw]; } -void plMaxBoneMap::SetBaseMatrixIndex(plDrawable *draw, UInt32 idx) +void plMaxBoneMap::SetBaseMatrixIndex(plDrawable *draw, uint32_t idx) { fBaseMatrices[draw] = idx; } @@ -227,7 +227,7 @@ void plMaxBoneMap::SetBaseMatrixIndex(plDrawable *draw, UInt32 idx) // you'll be hosed (duh). void plMaxBoneMap::SortBones() { - plMaxNodeBase **tempBones = TRACKED_NEW plMaxNodeBase*[fNumBones]; + plMaxNodeBase **tempBones = new plMaxNodeBase*[fNumBones]; FillBoneArray(tempBones); // Look ma! An n^2 bubble sort! @@ -263,7 +263,7 @@ plKey plMaxNode::AddModifier(plModifier *pMod, const char* name) plKey modKey = pMod->GetKey(); if (!modKey) modKey = hsgResMgr::ResMgr()->NewKey(name, pMod, GetLocation()); - hsgResMgr::ResMgr()->AddViaNotify(modKey, TRACKED_NEW plObjRefMsg(GetKey(), plRefMsg::kOnCreate, -1, plObjRefMsg::kModifier), plRefFlags::kActiveRef); + hsgResMgr::ResMgr()->AddViaNotify(modKey, new plObjRefMsg(GetKey(), plRefMsg::kOnCreate, -1, plObjRefMsg::kModifier), plRefFlags::kActiveRef); return modKey; } @@ -385,7 +385,7 @@ hsBool plMaxNode::ConvertValidate(plErrorMsg *pErrMsg, plConvertSettings *settin if( CanMakeMesh( obj, pErrMsg, settings ) ) { hsTArray nodes; - UInt32 numInstances = IBuildInstanceList( GetObjectRef(), t, nodes ); + uint32_t numInstances = IBuildInstanceList( GetObjectRef(), t, nodes ); if( numInstances > 1 ) { /// INSTANCED. Make sure to force local on us @@ -486,7 +486,7 @@ void plMaxNode::CheckSynchOptions(plSynchedObject* so) bool isDynSim = GetPhysicalProps()->GetGroup() == plSimDefs::kGroupDynamic; bool hasPFC = false; int count = NumAttachedComponents(); - for (UInt32 x = 0; x < count; x++) + for (uint32_t x = 0; x < count; x++) { plComponentBase *comp = GetAttachedComponent(x); if (comp->ClassID() == Class_ID(0x670d3629, 0x559e4f11)) @@ -538,7 +538,7 @@ hsBool plMaxNode::MakeSceneObject(plErrorMsg *pErrMsg, plConvertSettings *settin plKey objKey; // Handle this as a SceneObject - pso = TRACKED_NEW plSceneObject; + pso = new plSceneObject; objKey = hsgResMgr::ResMgr()->NewKey(GetName(), pso, nodeLoc, GetLoadMask()); // Remember info in MaxNodeData block for later @@ -824,7 +824,7 @@ hsBool plMaxNode::MakePhysical(plErrorMsg *pErrMsg, plConvertSettings *settings) // // Create the physical // - plPXPhysical* physical = TRACKED_NEW plPXPhysical; + plPXPhysical* physical = new plPXPhysical; // add the object to the resource manager, keyed to the new name plLocation nodeLoc = GetKey()->GetUoid().GetLocation(); @@ -860,14 +860,14 @@ hsBool plMaxNode::MakePhysical(plErrorMsg *pErrMsg, plConvertSettings *settings) if(physProps->GetLOSSwimRegion()) physical->AddLOSDB(plSimDefs::kLOSDBSwimRegion); - plSimulationInterface* si = TRACKED_NEW plSimulationInterface; + plSimulationInterface* si = new plSimulationInterface; plKey pSiKey = hsgResMgr::ResMgr()->NewKey(objName, si, nodeLoc, GetLoadMask()); // link the simulation interface to the scene object - hsgResMgr::ResMgr()->AddViaNotify(pSiKey, TRACKED_NEW plObjRefMsg(GetKey(), plRefMsg::kOnCreate, 0, plObjRefMsg::kInterface), plRefFlags::kActiveRef); + hsgResMgr::ResMgr()->AddViaNotify(pSiKey, new plObjRefMsg(GetKey(), plRefMsg::kOnCreate, 0, plObjRefMsg::kInterface), plRefFlags::kActiveRef); // add the physical to the simulation interface - hsgResMgr::ResMgr()->AddViaNotify(physKey , TRACKED_NEW plIntRefMsg(pSiKey, plRefMsg::kOnCreate, 0, plIntRefMsg::kPhysical), plRefFlags::kActiveRef); + hsgResMgr::ResMgr()->AddViaNotify(physKey , new plIntRefMsg(pSiKey, plRefMsg::kOnCreate, 0, plIntRefMsg::kPhysical), plRefFlags::kActiveRef); return true; } @@ -909,9 +909,9 @@ hsBool plMaxNode::MakeCoordinateInterface(plErrorMsg *pErrMsg, plConvertSettings hsMatrix44 loc2Par = GetLocalToParent44(); hsMatrix44 par2Loc = GetParentToLocal44(); if( GetFilterInherit() ) - ci = TRACKED_NEW plFilterCoordInterface; + ci = new plFilterCoordInterface; else - ci = TRACKED_NEW plCoordinateInterface; + ci = new plCoordinateInterface; //------------------------- // Get data from Node, then its key, then its name //------------------------- @@ -927,7 +927,7 @@ hsBool plMaxNode::MakeCoordinateInterface(plErrorMsg *pErrMsg, plConvertSettings ci->SetProperty(plCoordinateInterface::kCanEverDelayTransform, !usesPhysics); ci->SetProperty(plCoordinateInterface::kDelayedTransformEval, !usesPhysics); - hsgResMgr::ResMgr()->AddViaNotify(pCiKey, TRACKED_NEW plObjRefMsg(pNodeKey, plRefMsg::kOnCreate, 0, plObjRefMsg::kInterface), plRefFlags::kActiveRef); + hsgResMgr::ResMgr()->AddViaNotify(pCiKey, new plObjRefMsg(pNodeKey, plRefMsg::kOnCreate, 0, plObjRefMsg::kInterface), plRefFlags::kActiveRef); } return true; } @@ -950,7 +950,7 @@ hsBool plMaxNode::MakeModifiers(plErrorMsg *pErrMsg, plConvertSettings *settings // mf horse hack testing ViewFace which is already obsolete if ( UserPropExists("ViewFacing") ) { - plViewFaceModifier* pMod = TRACKED_NEW plViewFaceModifier; + plViewFaceModifier* pMod = new plViewFaceModifier; if( UserPropExists("VFPivotFavorY") ) pMod->SetFlag(plViewFaceModifier::kPivotFavorY); else if( UserPropExists("VFPivotY") ) @@ -975,15 +975,15 @@ hsBool plMaxNode::MakeModifiers(plErrorMsg *pErrMsg, plConvertSettings *settings switch( nGot ) { case 0: - scale.fZ = hsScalar(atof(token)); + scale.fZ = float(atof(token)); break; case 1: scale.fX = scale.fZ; - scale.fY = hsScalar(atof(token)); + scale.fY = float(atof(token)); scale.fZ = 1.f; break; case 2: - scale.fZ = hsScalar(atof(token)); + scale.fZ = float(atof(token)); break; } nGot++; @@ -1011,12 +1011,12 @@ hsBool plMaxNode::MakeParentOrRoomConnection(plErrorMsg *pErrMsg, plConvertSetti hsAssert(ci,"Missing CI"); - plIntRefMsg* msg = TRACKED_NEW plIntRefMsg(parKey, plRefMsg::kOnCreate, -1, plIntRefMsg::kChildObject); + plIntRefMsg* msg = new plIntRefMsg(parKey, plRefMsg::kOnCreate, -1, plIntRefMsg::kChildObject); msg->SetRef(pso); hsgResMgr::ResMgr()->AddViaNotify(msg, plRefFlags::kPassiveRef); } - hsgResMgr::ResMgr()->AddViaNotify(pso->GetKey(), TRACKED_NEW plNodeRefMsg(GetRoomKey(), plRefMsg::kOnCreate, -1, plNodeRefMsg::kObject), plRefFlags::kActiveRef); + hsgResMgr::ResMgr()->AddViaNotify(pso->GetKey(), new plNodeRefMsg(GetRoomKey(), plRefMsg::kOnCreate, -1, plNodeRefMsg::kObject), plRefFlags::kActiveRef); return true; } @@ -1089,12 +1089,12 @@ int IsGeoSpanConvexExhaust(const plGeometrySpan* span) { // Brute force, check every point against every face - UInt16* idx = span->fIndexData; + uint16_t* idx = span->fIndexData; int numFaces = span->fNumIndices / 3; - UInt32 stride = span->GetVertexSize(span->fFormat); + uint32_t stride = span->GetVertexSize(span->fFormat); - UInt8* vertData = span->fVertexData; + uint8_t* vertData = span->fVertexData; int numVerts = span->fNumVerts; hsBool someIn = false; @@ -1114,7 +1114,7 @@ int IsGeoSpanConvexExhaust(const plGeometrySpan* span) hsVector3 faceNorm = edge01 % edge02; hsFastMath::NormalizeAppr(faceNorm); - hsScalar faceDist = faceNorm.InnerProduct(pos[0]); + float faceDist = faceNorm.InnerProduct(pos[0]); int j; for( j = 0; j < numVerts; j++ ) @@ -1122,9 +1122,9 @@ int IsGeoSpanConvexExhaust(const plGeometrySpan* span) hsPoint3* p = (hsPoint3*)(vertData + idx[0] * stride); - hsScalar dist = p->InnerProduct(faceNorm) - faceDist; + float dist = p->InnerProduct(faceNorm) - faceDist; - const hsScalar kSmall = 1.e-3f; + const float kSmall = 1.e-3f; if( dist < -kSmall ) someIn = true; else if( dist > kSmall ) @@ -1168,16 +1168,16 @@ int IsGeoSpanConvex(plMaxNode* node, const plGeometrySpan* span) if( numFaces <= kSmallNumFaces ) return IsGeoSpanConvexExhaust(span); - hsTArray* vertList = TRACKED_NEW hsTArray [numVerts]; + hsTArray* vertList = new hsTArray [numVerts]; - hsTArray* normList = TRACKED_NEW hsTArray [numVerts]; - hsTArray* distList = TRACKED_NEW hsTArray [numVerts]; + hsTArray* normList = new hsTArray [numVerts]; + hsTArray* distList = new hsTArray [numVerts]; - UInt16* idx = span->fIndexData; + uint16_t* idx = span->fIndexData; - UInt32 stride = span->GetVertexSize(span->fFormat); + uint32_t stride = span->GetVertexSize(span->fFormat); - UInt8* vertData = span->fVertexData; + uint8_t* vertData = span->fVertexData; // For each face int iFace; @@ -1194,7 +1194,7 @@ int IsGeoSpanConvex(plMaxNode* node, const plGeometrySpan* span) hsVector3 faceNorm = edge01 % edge02; hsFastMath::NormalizeAppr(faceNorm); - hsScalar faceDist = faceNorm.InnerProduct(pos[0]); + float faceDist = faceNorm.InnerProduct(pos[0]); // For each vert @@ -1230,9 +1230,9 @@ int IsGeoSpanConvex(plMaxNode* node, const plGeometrySpan* span) for( j = 0; j < vertList[i].GetCount(); j++ ) { hsPoint3* pos = (hsPoint3*)(vertData + vertList[i][j] * stride); - hsScalar dist = pos->InnerProduct(normList[i][k]) - distList[i][k]; + float dist = pos->InnerProduct(normList[i][k]) - distList[i][k]; - const hsScalar kSmall = 1.e-3f; + const float kSmall = 1.e-3f; if( dist < -kSmall ) someIn = true; else if( dist > kSmall ) @@ -1278,7 +1278,7 @@ hsBool plMaxNode::MakeMesh(plErrorMsg *pErrMsg, plConvertSettings *settings) hsBool gotMade = false; hsBool haveAddedToSceneNode = false; hsGMesh *myMesh = nil; - UInt32 i, triMeshIndex = (UInt32)-1; + uint32_t i, triMeshIndex = (uint32_t)-1; const char *dbgNodeName = GetName(); TSTR sdata; hsStringTokenizer toker; @@ -1296,17 +1296,17 @@ hsBool plMaxNode::MakeMesh(plErrorMsg *pErrMsg, plConvertSettings *settings) } } - if( GetSwappableGeomTarget() != (UInt32)-1) + if( GetSwappableGeomTarget() != (uint32_t)-1) { // This node has no geometry on export, but will have some added at runtime, // so it needs a special drawInterface - plInstanceDrawInterface *newDI = TRACKED_NEW plInstanceDrawInterface; + plInstanceDrawInterface *newDI = new plInstanceDrawInterface; newDI->fTargetID = GetSwappableGeomTarget(); plKey pDiKey = hsgResMgr::ResMgr()->NewKey( GetKey()->GetName(), newDI, nodeLoc, GetLoadMask() ); - hsgResMgr::ResMgr()->AddViaNotify(pDiKey, TRACKED_NEW plObjRefMsg(GetKey(), plRefMsg::kOnCreate, 0, plObjRefMsg::kInterface), plRefFlags::kActiveRef); + hsgResMgr::ResMgr()->AddViaNotify(pDiKey, new plObjRefMsg(GetKey(), plRefMsg::kOnCreate, 0, plObjRefMsg::kInterface), plRefFlags::kActiveRef); - plSwapSpansRefMsg *sMsg = TRACKED_NEW plSwapSpansRefMsg(pDiKey, plRefMsg::kOnCreate, -1, -1); + plSwapSpansRefMsg *sMsg = new plSwapSpansRefMsg(pDiKey, plRefMsg::kOnCreate, -1, -1); plDrawableSpans *drawable = IGetSceneNodeSpans(IGetDrawableSceneNode(pErrMsg), true, true); hsgResMgr::ResMgr()->AddViaNotify(drawable->GetKey(), sMsg, plRefFlags::kActiveRef); @@ -1317,7 +1317,7 @@ hsBool plMaxNode::MakeMesh(plErrorMsg *pErrMsg, plConvertSettings *settings) { hsTArray nodes; TimeValue t = hsConverterUtils::Instance().GetTime(GetInterface()); - UInt32 numInstances = IBuildInstanceList( GetObjectRef(), t, nodes, true ); + uint32_t numInstances = IBuildInstanceList( GetObjectRef(), t, nodes, true ); /// Instanced, find an iNode in the list that's been converted already for( i = 0; i < numInstances; i++ ) @@ -1353,7 +1353,7 @@ hsBool plMaxNode::MakeMesh(plErrorMsg *pErrMsg, plConvertSettings *settings) for( i = 0; i < spanArray.GetCount(); i++ ) spanArray[i]->fMaxOwner = GetKey()->GetName(); - UInt32 shadeFlags = 0; + uint32_t shadeFlags = 0; if( GetNoPreShade() ) shadeFlags |= plGeometrySpan::kPropNoPreShade; if( GetRunTimeLight() ) @@ -1416,7 +1416,7 @@ hsBool plMaxNode::MakeMesh(plErrorMsg *pErrMsg, plConvertSettings *settings) color.Set( 0.5, 0.5, 1, 1 ); // Exp fog - myFog = TRACKED_NEW plFogEnvironment( plFogEnvironment::kExpFog, 700.f, 1.f, color ); + myFog = new plFogEnvironment( plFogEnvironment::kExpFog, 700.f, 1.f, color ); myFogKey = hsgResMgr::ResMgr()->NewKey( "HACK_FOG", myFog, nodeLoc ); hsgResMgr::ResMgr()->AddExportAlias( "HACK_FOG", plFogEnvironment::Index(), myFogKey ); } @@ -1468,9 +1468,9 @@ hsBool plMaxNode::MakeMesh(plErrorMsg *pErrMsg, plConvertSettings *settings) { /// Make a new drawInterface (will assign stuff to it later) - newDI = TRACKED_NEW plDrawInterface; + newDI = new plDrawInterface; plKey pDiKey = hsgResMgr::ResMgr()->NewKey( GetKey()->GetName(), newDI, nodeLoc, GetLoadMask() ); - hsgResMgr::ResMgr()->AddViaNotify(pDiKey, TRACKED_NEW plObjRefMsg(GetKey(), plRefMsg::kOnCreate, 0, plObjRefMsg::kInterface), plRefFlags::kActiveRef); + hsgResMgr::ResMgr()->AddViaNotify(pDiKey, new plObjRefMsg(GetKey(), plRefMsg::kOnCreate, 0, plObjRefMsg::kInterface), plRefFlags::kActiveRef); /// Attach the processed spans to the DI (through drawables) IAssignSpansToDrawables( spanArray, newDI, pErrMsg, settings ); @@ -1504,7 +1504,7 @@ void plMaxNode::IAssignSpansToDrawables( hsTArray &spanArra plSceneNode *tmpNode = nil; hsMatrix44 l2w = GetLocalToWorld44(); hsMatrix44 w2l = GetWorldToLocal44(); - UInt32 oIndex = (UInt32)-1, bIndex = (UInt32)-1, sIndex = UInt32(-1); + uint32_t oIndex = (uint32_t)-1, bIndex = (uint32_t)-1, sIndex = uint32_t(-1); tmpNode = IGetDrawableSceneNode(pErrMsg); /* @@ -1588,21 +1588,21 @@ void plMaxNode::IAssignSpansToDrawables( hsTArray &spanArra /// Now assign to the interface if( oSpans ) { - UInt8 iDraw = di->GetNumDrawables(); + uint8_t iDraw = di->GetNumDrawables(); di->SetDrawable( iDraw, oSpans ); di->SetDrawableMeshIndex( iDraw, oIndex ); } if( bSpans ) { - UInt8 iDraw = di->GetNumDrawables(); + uint8_t iDraw = di->GetNumDrawables(); di->SetDrawable( iDraw, bSpans ); di->SetDrawableMeshIndex( iDraw, bIndex ); } if( sSpans ) { - UInt8 iDraw = di->GetNumDrawables(); + uint8_t iDraw = di->GetNumDrawables(); di->SetDrawable( iDraw, sSpans ); di->SetDrawableMeshIndex( iDraw, sIndex ); } @@ -1613,7 +1613,7 @@ void plMaxNode::IAssignSpansToDrawables( hsTArray &spanArra // Small utility function for IAssignSpansToDrawables, just does some of // the low-down work that's identical for each drawable/spans/etc. -void plMaxNode::IAssignSpan( plDrawableSpans *drawable, hsTArray &spanArray, UInt32 &index, +void plMaxNode::IAssignSpan( plDrawableSpans *drawable, hsTArray &spanArray, uint32_t &index, hsMatrix44 &l2w, hsMatrix44 &w2l, plErrorMsg *pErrMsg, plConvertSettings *settings ) { @@ -1635,7 +1635,7 @@ void plMaxNode::IAssignSpan( plDrawableSpans *drawable, hsTArray &spanArray, UInt32 baseMatrix, UInt32 numMatrices) +void SetSpansBoneInfo(hsTArray &spanArray, uint32_t baseMatrix, uint32_t numMatrices) { int i; for( i = 0; i < spanArray.GetCount(); i++ ) @@ -1658,7 +1658,7 @@ void plMaxNode::ISetupBones(plDrawableSpans *drawable, hsTArrayGetBaseMatrixIndex(drawable) != (UInt32)-1) + if (boneMap && boneMap->GetBaseMatrixIndex(drawable) != (uint32_t)-1) { SetSpansBoneInfo(spanArray, boneMap->GetBaseMatrixIndex(drawable), boneMap->fNumBones); return; @@ -1666,8 +1666,8 @@ void plMaxNode::ISetupBones(plDrawableSpans *drawable, hsTArrayfNumBones : NumBones()) + 1; - plMaxNodeBase **boneArray = TRACKED_NEW plMaxNodeBase*[numBones]; + uint8_t numBones = (boneMap ? boneMap->fNumBones : NumBones()) + 1; + plMaxNodeBase **boneArray = new plMaxNodeBase*[numBones]; if (boneMap) boneMap->FillBoneArray(boneArray); @@ -1729,7 +1729,7 @@ void plMaxNode::ISetupBones(plDrawableSpans *drawable, hsTArrayFindBoneBaseMatrix(initialL2B, GetSwappableGeom() != nil); - if( baseMatrix != UInt32(-1) ) + if( baseMatrix != uint32_t(-1) ) { SetSpansBoneInfo(spanArray, baseMatrix, numBones); delete [] boneArray; @@ -1748,7 +1748,7 @@ void plMaxNode::ISetupBones(plDrawableSpans *drawable, hsTArrayGetName(); // Pick which drawable to point the DI to - UInt8 iDraw = 0; + uint8_t iDraw = 0; /// Now create the actual bone DI, or grab it if it's already created plDrawInterface *di = obj->GetVolatileDrawInterface(); @@ -1763,14 +1763,14 @@ void plMaxNode::ISetupBones(plDrawableSpans *drawable, hsTArrayGetLocation(); - di = TRACKED_NEW plDrawInterface; + di = new plDrawInterface; plKey diKey = hsgResMgr::ResMgr()->NewKey(GetKey()->GetName(), di, nodeLoc, GetLoadMask()); - hsgResMgr::ResMgr()->AddViaNotify(diKey, TRACKED_NEW plObjRefMsg(obj->GetKey(), plRefMsg::kOnCreate, 0, plObjRefMsg::kInterface), plRefFlags::kActiveRef); + hsgResMgr::ResMgr()->AddViaNotify(diKey, new plObjRefMsg(obj->GetKey(), plRefMsg::kOnCreate, 0, plObjRefMsg::kInterface), plRefFlags::kActiveRef); } if( di->GetNumDrawables() <= iDraw ) { - UInt32 diIndex = drawable->NewDIMatrixIndex(); + uint32_t diIndex = drawable->NewDIMatrixIndex(); di->SetDrawableMeshIndex(iDraw, diIndex); di->SetDrawable(iDraw, drawable); @@ -1793,7 +1793,7 @@ void plMaxNode::ISetupBones(plDrawableSpans *drawable, hsTArray &spanArray, plErrorMsg *pErrMsg, plConvertSettings *settings ) { - UInt8 iDraw; + uint8_t iDraw; int index, i; @@ -1806,7 +1806,7 @@ hsBool plMaxNode::IMakeInstanceSpans( plMaxNode *node, hsTArrayGetDrawable(iDraw)); if( !dr ) continue; - if( di->GetDrawableMeshIndex(iDraw) == (UInt32)-1 ) + if( di->GetDrawableMeshIndex(iDraw) == (uint32_t)-1 ) continue; plDISpanIndex disi = dr->GetDISpans(di->GetDrawableMeshIndex(iDraw)); @@ -1827,7 +1827,7 @@ hsBool plMaxNode::IMakeInstanceSpans( plMaxNode *node, hsTArrayMakeInstanceOf( dr->GetGeometrySpan( disi.fIndices[ i ] ) ); if( setVisDists ) @@ -1903,7 +1903,7 @@ hsBool plMaxNode::IMakeInstanceSpans( plMaxNode *node, hsTArray &nodes, hsBool beMoreAccurate ) +uint32_t plMaxNode::IBuildInstanceList( Object *obj, TimeValue t, hsTArray &nodes, hsBool beMoreAccurate ) { Object *thisObj = EvalWorldState( t ).obj; DependentIterator di( obj ); @@ -2004,13 +2004,13 @@ hsBool plMaxNode::ShadeMesh(plErrorMsg *pErrMsg, plConvertSettings *settings) if( !di ) return true; - UInt8 iDraw; + uint8_t iDraw; for( iDraw = 0; iDraw < di->GetNumDrawables(); iDraw++ ) { plDrawableSpans* dr = plDrawableSpans::ConvertNoRef(di->GetDrawable(iDraw)); if( !dr ) continue; - if( di->GetDrawableMeshIndex(iDraw) == (UInt32)-1 ) + if( di->GetDrawableMeshIndex(iDraw) == (uint32_t)-1 ) continue; plDISpanIndex disi = dr->GetDISpans(di->GetDrawableMeshIndex(iDraw)); @@ -2097,7 +2097,7 @@ hsBool plMaxNode::ConvertToOccluder(plErrorMsg* pErrMsg, hsBool twoSided, hsBool hsTArray polys; - UInt32 polyInitFlags = plCullPoly::kNone; + uint32_t polyInitFlags = plCullPoly::kNone; if( isHole ) polyInitFlags |= plCullPoly::kHole; else @@ -2113,8 +2113,8 @@ hsBool plMaxNode::ConvertToOccluder(plErrorMsg* pErrMsg, hsBool twoSided, hsBool Mesh mesh(meshObj->mesh); - const float kNormThresh = hsScalarPI / 20.f; - const float kEdgeThresh = hsScalarPI / 20.f; + const float kNormThresh = M_PI / 20.f; + const float kEdgeThresh = M_PI / 20.f; const float kBias = 0.1f; const float kMaxEdge = -1.f; const DWORD kOptFlags = OPTIMIZE_SAVESMOOTHBOUNDRIES; @@ -2137,7 +2137,7 @@ hsBool plMaxNode::ConvertToOccluder(plErrorMsg* pErrMsg, hsBool twoSided, hsBool // mnMesh.MakeConvexPolyMesh(); mnMesh.MakePolyMesh(); mnMesh.MakeConvex(); -// mnMesh.MakePlanar(1.f * hsScalarPI / 180.f); // Completely ineffective. Winding up with majorly non-planar polys. +// mnMesh.MakePlanar(1.f * M_PI / 180.f); // Completely ineffective. Winding up with majorly non-planar polys. mnMesh.Transform(maxV2L); @@ -2204,13 +2204,13 @@ hsBool plMaxNode::ConvertToOccluder(plErrorMsg* pErrMsg, hsBool twoSided, hsBool hsFastMath::Normalize(bXc); - hsScalar dotSq = aXb.InnerProduct(bXc); + float dotSq = aXb.InnerProduct(bXc); dotSq *= dotSq; - const hsScalar kMinLenSq = 1.e-8f; - const hsScalar kMinDotFracSq = 0.998f * 0.998f; + const float kMinLenSq = 1.e-8f; + const float kMinDotFracSq = 0.998f * 0.998f; - hsScalar lenSq = aXb.MagnitudeSquared() * bXc.MagnitudeSquared(); + float lenSq = aXb.MagnitudeSquared() * bXc.MagnitudeSquared(); if( lenSq < kMinLenSq ) continue; @@ -2243,12 +2243,12 @@ hsBool plMaxNode::ConvertToOccluder(plErrorMsg* pErrMsg, hsBool twoSided, hsBool plMobileOccluder* mob = nil; if( moving ) { - mob = TRACKED_NEW plMobileOccluder; + mob = new plMobileOccluder; occ = mob; } else { - occ = TRACKED_NEW plOccluder; + occ = new plOccluder; } occ->SetPolyList(polys); @@ -2267,7 +2267,7 @@ hsBool plMaxNode::ConvertToOccluder(plErrorMsg* pErrMsg, hsBool twoSided, hsBool } plKey key = hsgResMgr::ResMgr()->NewKey( tmpName, occ, nodeLoc, GetLoadMask() ); - hsgResMgr::ResMgr()->AddViaNotify(occ->GetKey(), TRACKED_NEW plObjRefMsg(GetKey(), plRefMsg::kOnCreate, -1, plObjRefMsg::kInterface), plRefFlags::kActiveRef); + hsgResMgr::ResMgr()->AddViaNotify(occ->GetKey(), new plObjRefMsg(GetKey(), plRefMsg::kOnCreate, -1, plObjRefMsg::kInterface), plRefFlags::kActiveRef); } return true; @@ -2310,7 +2310,7 @@ hsBool plMaxNode::MakeLight(plErrorMsg *pErrMsg, plConvertSettings *settings) plKey key = hsgResMgr::ResMgr()->NewKey( GetKey()->GetName(), liInfo, nodeLoc, GetLoadMask() ); - hsgResMgr::ResMgr()->AddViaNotify(liInfo->GetKey(), TRACKED_NEW plObjRefMsg(GetKey(), plRefMsg::kOnCreate, -1, plObjRefMsg::kInterface), plRefFlags::kActiveRef); + hsgResMgr::ResMgr()->AddViaNotify(liInfo->GetKey(), new plObjRefMsg(GetKey(), plRefMsg::kOnCreate, -1, plObjRefMsg::kInterface), plRefFlags::kActiveRef); // Only support projection for spots and dir lights for now. @@ -2358,7 +2358,7 @@ void plMaxNode::IGetLightAttenuation(plOmniLightInfo* liInfo, LightObject* light { TimeValue timeVal = hsConverterUtils::Instance().GetTime(GetInterface()); - hsScalar attenConst, attenLinear, attenQuadratic; + float attenConst, attenLinear, attenQuadratic; float intens = ls.intens >= 0 ? ls.intens : -ls.intens; float attenEnd = ls.attenEnd; @@ -2399,7 +2399,7 @@ void plMaxNode::IGetLightAttenuation(plOmniLightInfo* liInfo, LightObject* light } -hsBool plMaxNode::IGetRTLightAttenValues(IParamBlock2* ProperPB, hsScalar& attenConst, hsScalar& attenLinear, hsScalar& attenQuadratic, hsScalar &attenCutoff ) +hsBool plMaxNode::IGetRTLightAttenValues(IParamBlock2* ProperPB, float& attenConst, float& attenLinear, float& attenQuadratic, float &attenCutoff ) { TimeValue timeVal = hsConverterUtils::Instance().GetTime(GetInterface()); @@ -2455,7 +2455,7 @@ hsBool plMaxNode::IGetRTLightAttenValues(IParamBlock2* ProperPB, hsScalar& atten void plMaxNode::IGetRTLightAttenuation(plOmniLightInfo* liInfo, IParamBlock2* ProperPB) { - hsScalar attenConst, attenLinear, attenQuadratic, attenCutoff; + float attenConst, attenLinear, attenQuadratic, attenCutoff; if( IGetRTLightAttenValues(ProperPB, attenConst, attenLinear, attenQuadratic, attenCutoff) ) { @@ -2513,8 +2513,8 @@ void plMaxNode::IGetRTLightColors(plLightInfo* liInfo, IParamBlock2* ProperPB) void plMaxNode::IGetCone(plSpotLightInfo* liInfo, LightObject* light, LightState& ls) { - hsScalar inner = hsScalarDegToRad(ls.hotsize); - hsScalar outer = hsScalarDegToRad(ls.fallsize); + float inner = hsDegreesToRadians(ls.hotsize); + float outer = hsDegreesToRadians(ls.fallsize); /// 4.26.2001 mcn - MAX gives us full angles, but we want to store half angles liInfo->SetSpotInner( inner / 2.0f ); @@ -2527,10 +2527,10 @@ void plMaxNode::IGetRTCone(plSpotLightInfo* liInfo, IParamBlock2* ProperPB) //TimeValue timeVal = hsConverterUtils::Instance().GetTime(GetInterface()); TimeValue timeVal = hsConverterUtils::Instance().GetTime(GetInterface()); - hsScalar inner, outer; + float inner, outer; - inner = hsScalarDegToRad(ProperPB->GetFloat(plRTLightBase::kHotSpot, timeVal)); //ls.hotsize); - outer = hsScalarDegToRad(ProperPB->GetFloat(plRTLightBase::kFallOff, timeVal)); //ls.fallsize); + inner = hsDegreesToRadians(ProperPB->GetFloat(plRTLightBase::kHotSpot, timeVal)); //ls.hotsize); + outer = hsDegreesToRadians(ProperPB->GetFloat(plRTLightBase::kFallOff, timeVal)); //ls.fallsize); /// 4.26.2001 mcn - MAX gives us full angles, but we want to store half angles liInfo->SetSpotInner( inner / 2.0f ); @@ -2554,7 +2554,7 @@ plLightInfo* plMaxNode::IMakeSpot(plErrorMsg* pErrMsg, plConvertSettings* settin return nil; } - plSpotLightInfo* spot = TRACKED_NEW plSpotLightInfo; + plSpotLightInfo* spot = new plSpotLightInfo; IGetLightColors(spot, light, ls); @@ -2583,7 +2583,7 @@ plLightInfo* plMaxNode::IMakeOmni(plErrorMsg* pErrMsg, plConvertSettings* settin return nil; } - plOmniLightInfo* omni = TRACKED_NEW plOmniLightInfo; + plOmniLightInfo* omni = new plOmniLightInfo; IGetLightAttenuation(omni, light, ls); @@ -2614,7 +2614,7 @@ plLightInfo* plMaxNode::IMakeDirectional(plErrorMsg* pErrMsg, plConvertSettings* plLightInfo* plasLight = nil; if( light->GetProjMap() ) { - plLimitedDirLightInfo* ldl = TRACKED_NEW plLimitedDirLightInfo; + plLimitedDirLightInfo* ldl = new plLimitedDirLightInfo; float sz = light->GetFallsize(timeVal, FOREVER); float depth = 1000.f; @@ -2627,7 +2627,7 @@ plLightInfo* plMaxNode::IMakeDirectional(plErrorMsg* pErrMsg, plConvertSettings* else { - plDirectionalLightInfo* direct = TRACKED_NEW plDirectionalLightInfo; + plDirectionalLightInfo* direct = new plDirectionalLightInfo; plasLight = direct; } @@ -2654,7 +2654,7 @@ plLightInfo* plMaxNode::IMakeRTSpot(plErrorMsg* pErrMsg, plConvertSettings* sett } - plSpotLightInfo* spot = TRACKED_NEW plSpotLightInfo; + plSpotLightInfo* spot = new plSpotLightInfo; if(!ThisObjPB->GetInt(plRTLightBase::kLightOn)) spot->SetProperty(plLightInfo::kDisable, true); @@ -2665,7 +2665,7 @@ plLightInfo* plMaxNode::IMakeRTSpot(plErrorMsg* pErrMsg, plConvertSettings* sett IGetRTCone(spot, ThisObjPB); - //plSpotModifier* liMod = TRACKED_NEW plSpotModifier; + //plSpotModifier* liMod = new plSpotModifier; //GetRTLightColAnim(ThisObjPB, liMod); //GetRTLightAttenAnim(ThisObjPB, liMod); @@ -2689,7 +2689,7 @@ plLightInfo* plMaxNode::IMakeRTOmni(plErrorMsg* pErrMsg, plConvertSettings* sett Object *ThisObj = ((INode*)this)->GetObjectRef(); IParamBlock2* ThisObjPB = ThisObj->GetParamBlockByID(plRTLightBase::kBlkOmniLight); - plOmniLightInfo* omni = TRACKED_NEW plOmniLightInfo; + plOmniLightInfo* omni = new plOmniLightInfo; if(!ThisObjPB->GetInt(plRTLightBase::kLightOn)) omni->SetProperty(plLightInfo::kDisable, true); @@ -2698,7 +2698,7 @@ plLightInfo* plMaxNode::IMakeRTOmni(plErrorMsg* pErrMsg, plConvertSettings* sett IGetRTLightColors(omni, ThisObjPB); - //plOmniModifier* liMod = TRACKED_NEW plOmniModifier; + //plOmniModifier* liMod = new plOmniModifier; //GetRTLightColAnim(ThisObjPB, liMod); //GetRTLightAttenAnim(ThisObjPB, liMod); @@ -2722,14 +2722,14 @@ plLightInfo* plMaxNode::IMakeRTDirectional(plErrorMsg* pErrMsg, plConvertSetting IParamBlock2* ThisObjPB = ThisObj->GetParamBlockByID(plRTLightBase::kBlkTSpotLight); - plDirectionalLightInfo* direct = TRACKED_NEW plDirectionalLightInfo; + plDirectionalLightInfo* direct = new plDirectionalLightInfo; if(!ThisObjPB->GetInt(plRTLightBase::kLightOn)) direct->SetProperty(plLightInfo::kDisable, true); IGetRTLightColors(direct, ThisObjPB); - //plLightModifier* liMod = TRACKED_NEW plLightModifier; + //plLightModifier* liMod = new plLightModifier; //GetRTLightColAnim(ThisObjPB, liMod); @@ -2755,7 +2755,7 @@ plLightInfo *plMaxNode::IMakeRTProjDirectional( plErrorMsg *pErrMsg, plConvertSe IParamBlock2 *mainPB = ThisObj->GetParamBlockByID( plRTLightBase::kBlkMain ); IParamBlock2 *projPB = ThisObj->GetParamBlockByID( plRTProjDirLight::kBlkProj ); - plLimitedDirLightInfo *light = TRACKED_NEW plLimitedDirLightInfo; + plLimitedDirLightInfo *light = new plLimitedDirLightInfo; light->SetWidth( projPB->GetFloat( plRTProjDirLight::kWidth ) ); light->SetHeight( projPB->GetFloat( plRTProjDirLight::kHeight ) ); @@ -2766,7 +2766,7 @@ plLightInfo *plMaxNode::IMakeRTProjDirectional( plErrorMsg *pErrMsg, plConvertSe IGetRTLightColors( light, mainPB ); - //plLightModifier *liMod = TRACKED_NEW plLightModifier; + //plLightModifier *liMod = new plLightModifier; //GetRTLightColAnim( mainPB, liMod ); @@ -2860,7 +2860,7 @@ hsBool plMaxNode::IGetProjection(plLightInfo* li, plErrorMsg* pErrMsg) break; } - hsgResMgr::ResMgr()->AddViaNotify(proj->GetKey(), TRACKED_NEW plGenRefMsg(li->GetKey(), plRefMsg::kOnCreate, 0, 0), plRefFlags::kActiveRef); + hsgResMgr::ResMgr()->AddViaNotify(proj->GetKey(), new plGenRefMsg(li->GetKey(), plRefMsg::kOnCreate, 0, 0), plRefFlags::kActiveRef); li->SetShadowCaster(false); @@ -2997,9 +2997,9 @@ void plMaxNode::GetRTLightAttenAnim(IParamBlock2* ProperPB, plAGAnim *anim) if( ProperPB->GetInt(plRTLightBase::kAttenTypeRadio, TimeValue(0)) == 2 ) { // Animation of a cutoff attenuation, which only needs a scalar channel - plOmniCutoffApplicator *app = TRACKED_NEW plOmniCutoffApplicator(); + plOmniCutoffApplicator *app = new plOmniCutoffApplicator(); app->SetChannelName(GetName()); - plScalarControllerChannel *chan = TRACKED_NEW plScalarControllerChannel(subCtl); + plScalarControllerChannel *chan = new plScalarControllerChannel(subCtl); app->SetChannel(chan); anim->AddApplicator(app); if (!strcmp(anim->GetName(), ENTIRE_ANIMATION_NAME)) @@ -3015,10 +3015,10 @@ void plMaxNode::GetRTLightAttenAnim(IParamBlock2* ProperPB, plAGAnim *anim) hsScalarKey *key = subCtl->GetScalarKey(i); if (key) { - hsScalar attenEnd = key->fValue; + float attenEnd = key->fValue; TimeValue tv = key->fFrame * MAX_TICKS_PER_FRAME; - hsScalar intens = ProperPB->GetFloat(plRTLightBase::kIntensity, tv); - hsScalar newVal = (intens * plSillyLightKonstants::GetFarPowerKonst() - 1.f) / attenEnd; + float intens = ProperPB->GetFloat(plRTLightBase::kIntensity, tv); + float newVal = (intens * plSillyLightKonstants::GetFarPowerKonst() - 1.f) / attenEnd; if( distSq ) newVal /= attenEnd; @@ -3027,10 +3027,10 @@ void plMaxNode::GetRTLightAttenAnim(IParamBlock2* ProperPB, plAGAnim *anim) hsBezScalarKey *bezKey = subCtl->GetBezScalarKey(i); if (bezKey) { - hsScalar attenEnd = bezKey->fValue; + float attenEnd = bezKey->fValue; TimeValue tv = bezKey->fFrame * MAX_TICKS_PER_FRAME; - hsScalar intens = ProperPB->GetFloat(plRTLightBase::kIntensity, tv); - hsScalar newVal = (intens * plSillyLightKonstants::GetFarPowerKonst() - 1.f) / attenEnd; + float intens = ProperPB->GetFloat(plRTLightBase::kIntensity, tv); + float newVal = (intens * plSillyLightKonstants::GetFarPowerKonst() - 1.f) / attenEnd; if( distSq ) newVal /= attenEnd; @@ -3048,18 +3048,18 @@ void plMaxNode::GetRTLightAttenAnim(IParamBlock2* ProperPB, plAGAnim *anim) } plAGApplicator *app; if (distSq) - app = TRACKED_NEW plOmniSqApplicator; + app = new plOmniSqApplicator; else - app = TRACKED_NEW plOmniApplicator; + app = new plOmniApplicator; app->SetChannelName(GetName()); - plScalarControllerChannel *chan = TRACKED_NEW plScalarControllerChannel(subCtl); + plScalarControllerChannel *chan = new plScalarControllerChannel(subCtl); app->SetChannel(chan); anim->AddApplicator(app); if (!strcmp(anim->GetName(), ENTIRE_ANIMATION_NAME)) anim->ExtendToLength(subCtl->GetLength()); - hsScalar attenConst, attenLinear, attenQuadratic, attenCutoff; + float attenConst, attenLinear, attenQuadratic, attenCutoff; IGetRTLightAttenValues(ProperPB, attenConst, attenLinear, attenQuadratic, attenCutoff); plOmniLightInfo *info = plOmniLightInfo::ConvertNoRef(GetSceneObject()->GetGenericInterface(plOmniLightInfo::Index())); @@ -3091,14 +3091,14 @@ void plMaxNode::IAdjustRTColorByIntensity(plController* ctl, IParamBlock2* Prope if (key) { TimeValue tv = key->fFrame * MAX_TICKS_PER_FRAME; - hsScalar intens = ProperPB->GetFloat(plRTLightBase::kIntensity, tv); + float intens = ProperPB->GetFloat(plRTLightBase::kIntensity, tv); key->fValue *= intens; } hsBezPoint3Key* bezKey = simp->GetBezPoint3Key(i); if (bezKey) { TimeValue tv = bezKey->fFrame * MAX_TICKS_PER_FRAME; - hsScalar intens = ProperPB->GetFloat(plRTLightBase::kIntensity, tv); + float intens = ProperPB->GetFloat(plRTLightBase::kIntensity, tv); bezKey->fInTan *= intens; bezKey->fOutTan *= intens; bezKey->fValue *= intens; @@ -3132,9 +3132,9 @@ void plMaxNode::GetRTLightColAnim(IParamBlock2* ProperPB, plAGAnim *anim) if( ctl ) { - plLightAmbientApplicator *app = TRACKED_NEW plLightAmbientApplicator(); + plLightAmbientApplicator *app = new plLightAmbientApplicator(); app->SetChannelName(GetName()); - chan = TRACKED_NEW plPointControllerChannel(ctl); + chan = new plPointControllerChannel(ctl); app->SetChannel(chan); anim->AddApplicator(app); if (!strcmp(anim->GetName(), ENTIRE_ANIMATION_NAME)) @@ -3152,9 +3152,9 @@ void plMaxNode::GetRTLightColAnim(IParamBlock2* ProperPB, plAGAnim *anim) if( ctl ) { IAdjustRTColorByIntensity(ctl, ProperPB); - plLightDiffuseApplicator *app = TRACKED_NEW plLightDiffuseApplicator(); + plLightDiffuseApplicator *app = new plLightDiffuseApplicator(); app->SetChannelName(GetName()); - chan = TRACKED_NEW plPointControllerChannel(ctl); + chan = new plPointControllerChannel(ctl); app->SetChannel(chan); anim->AddApplicator(app); if (!strcmp(anim->GetName(), ENTIRE_ANIMATION_NAME)) @@ -3171,9 +3171,9 @@ void plMaxNode::GetRTLightColAnim(IParamBlock2* ProperPB, plAGAnim *anim) if( ctl ) { - plLightSpecularApplicator *app = TRACKED_NEW plLightSpecularApplicator(); + plLightSpecularApplicator *app = new plLightSpecularApplicator(); app->SetChannelName(GetName()); - chan = TRACKED_NEW plPointControllerChannel(ctl); + chan = new plPointControllerChannel(ctl); app->SetChannel(chan); anim->AddApplicator(app); if (!strcmp(anim->GetName(), ENTIRE_ANIMATION_NAME)) @@ -3198,9 +3198,9 @@ void plMaxNode::GetRTConeAnim(IParamBlock2* ProperPB, plAGAnim *anim) if( ctl ) { - plSpotInnerApplicator *app = TRACKED_NEW plSpotInnerApplicator(); + plSpotInnerApplicator *app = new plSpotInnerApplicator(); app->SetChannelName(GetName()); - chan = TRACKED_NEW plScalarControllerChannel(ctl); + chan = new plScalarControllerChannel(ctl); app->SetChannel(chan); anim->AddApplicator(app); if (!strcmp(anim->GetName(), ENTIRE_ANIMATION_NAME)) @@ -3217,9 +3217,9 @@ void plMaxNode::GetRTConeAnim(IParamBlock2* ProperPB, plAGAnim *anim) if( ctl ) { - plSpotOuterApplicator *app = TRACKED_NEW plSpotOuterApplicator(); + plSpotOuterApplicator *app = new plSpotOuterApplicator(); app->SetChannelName(GetName()); - chan = TRACKED_NEW plScalarControllerChannel(ctl); + chan = new plScalarControllerChannel(ctl); app->SetChannel(chan); anim->AddApplicator(app); if (!strcmp(anim->GetName(), ENTIRE_ANIMATION_NAME)) @@ -3247,10 +3247,10 @@ plXImposterComp* plMaxNode::GetXImposterComp() Point3 plMaxNode::GetFlexibility() { - UInt32 count = NumAttachedComponents(); + uint32_t count = NumAttachedComponents(); // Go through all the components attached to this node - for (UInt32 i = 0; i < count; i++) + for (uint32_t i = 0; i < count; i++) { // See if any are a flexibility component. plComponentBase *comp = GetAttachedComponent(i); @@ -3265,10 +3265,10 @@ Point3 plMaxNode::GetFlexibility() plLightMapComponent* plMaxNode::GetLightMapComponent() { - UInt32 count = NumAttachedComponents(); + uint32_t count = NumAttachedComponents(); // Go through all the components attached to this node - for (UInt32 i = 0; i < count; i++) + for (uint32_t i = 0; i < count; i++) { // See if any are a flexibility component. plComponentBase *comp = GetAttachedComponent(i); @@ -3288,7 +3288,7 @@ plDrawableCriteria plMaxNode::GetDrawableCriteria(hsBool needBlending, hsBool ne if( GetSortAsOpaque() ) level.Set(plRenderLevel::kOpaqueMajorLevel, level.Minor()); - UInt32 crit = 0; + uint32_t crit = 0; if( needBlending ) { if( needSorting && !GetNoFaceSort() ) @@ -3339,7 +3339,7 @@ plDrawableSpans *plMaxNode::IGetSceneNodeSpans( plSceneNode *node, hsBool needBl /// Couldn't find--create and return it - spans = TRACKED_NEW plDrawableSpans; + spans = new plDrawableSpans; if( needBlending ) { /// Blending (deferred) spans @@ -3353,7 +3353,7 @@ plDrawableSpans *plMaxNode::IGetSceneNodeSpans( plSceneNode *node, hsBool needBl sprintf( tmpName, "%s_%8.8x_%xSpans", node->GetKeyName(), crit.fLevel.fLevel, crit.fCriteria); } - if (GetSwappableGeomTarget() != (UInt32)-1 || GetSwappableGeom()) // We intend to swap geometry with this node... flag the drawable as volatile + if (GetSwappableGeomTarget() != (uint32_t)-1 || GetSwappableGeom()) // We intend to swap geometry with this node... flag the drawable as volatile { if( GetItinerant() ) spans->SetNativeProperty(plDrawable::kPropCharacter, true); @@ -3382,10 +3382,10 @@ hsBool plMaxNode::SetupPropertiesPass(plErrorMsg *pErrMsg, plConvertSettings *se hsBool ret = true; - UInt32 count = NumAttachedComponents(); + uint32_t count = NumAttachedComponents(); // Go through all the components attached to this node - for (UInt32 i = 0; i < count; i++) + for (uint32_t i = 0; i < count; i++) { // For each one, call the requested function. If any of the attached components // return false this function will return false. @@ -3459,10 +3459,10 @@ hsBool plMaxNode::FirstComponentPass(plErrorMsg *pErrMsg, plConvertSettings *set if (!CanConvert()) return ret; - UInt32 count = NumAttachedComponents(); + uint32_t count = NumAttachedComponents(); // Go through all the components attached to this node - for (UInt32 i = 0; i < count; i++) + for (uint32_t i = 0; i < count; i++) { // For each one, call the requested function. If any of the attached components // return false this function will return false. @@ -3496,10 +3496,10 @@ hsBool plMaxNode::ConvertComponents(plErrorMsg *pErrMsg, plConvertSettings *sett if (!CanConvert()) return ret; - UInt32 count = NumAttachedComponents(); + uint32_t count = NumAttachedComponents(); // Go through all the components attached to this node - for (UInt32 i = 0; i < count; i++) + for (uint32_t i = 0; i < count; i++) { // For each one, call the requested function. If any of the attached components // return false this function will return false. @@ -3533,10 +3533,10 @@ hsBool plMaxNode::DeInitComponents(plErrorMsg *pErrMsg, plConvertSettings *setti if (!CanConvert()) return ret; - UInt32 count = NumAttachedComponents(); + uint32_t count = NumAttachedComponents(); // Go through all the components attached to this node - for (UInt32 i = 0; i < count; i++) + for (uint32_t i = 0; i < count; i++) { // For each one, call the requested function. If any of the attached components // return false this function will return false. @@ -3690,12 +3690,12 @@ void plMaxNode::SetupBonesAliasesRecur(const char *rootName) plUoid* uoid = hsgResMgr::ResMgr()->FindAlias(aliasName, plSceneObject::Index()); if( !uoid ) { - plAliasModifier* pAlMod = TRACKED_NEW plAliasModifier; + plAliasModifier* pAlMod = new plAliasModifier; pAlMod->SetAlias(aliasName); AddModifier(pAlMod); } */ - plAGModifier *mod = TRACKED_NEW plAGModifier(nameToUse); + plAGModifier *mod = new plAGModifier(nameToUse); AddModifier(mod, GetName()); } } @@ -3798,7 +3798,7 @@ void plMaxNode::SetupBoneHierarchyPalette(plMaxBoneMap *bones /* = nil */) if (bones == nil) { - bones = TRACKED_NEW plMaxBoneMap(); + bones = new plMaxBoneMap(); bones->fOwner = this; } @@ -3924,7 +3924,7 @@ void plMaxNode::ISetCachedAlphaHackValue( int iSubMtl, int value ) hsTArray *cache = pDat->GetAlphaHackLayersCache(); if( cache == nil ) { - cache = TRACKED_NEW hsTArray; + cache = new hsTArray; pDat->SetAlphaHackLayersCache( cache ); } @@ -4016,9 +4016,9 @@ TriObject* plMaxNode::GetTriObject(hsBool& deleteIt) // Starting at 0, returns an incrementing index for each maxNode. Useful for // assigning indices to sound objects attached to the node. -UInt32 plMaxNode::GetNextSoundIdx( void ) +uint32_t plMaxNode::GetNextSoundIdx( void ) { - UInt32 idx = GetSoundIdxCounter(); + uint32_t idx = GetSoundIdxCounter(); SetSoundIdxCounter( idx + 1 ); return idx; } @@ -4049,7 +4049,7 @@ plPhysicalProps *plMaxNode::GetPhysicalProps() //// FindPageKey ///////////////////////////////////////////////////////////// // Little helper function. Calls FindKey() in the resManager using the location (page) of this node -plKey plMaxNode::FindPageKey( UInt16 classIdx, const char *name ) +plKey plMaxNode::FindPageKey( uint16_t classIdx, const char *name ) { return hsgResMgr::ResMgr()->FindKey( plUoid( GetLocation(), classIdx, name ) ); } @@ -4081,11 +4081,11 @@ hsBool plMaxNode::MakeIfaceReferences(plErrorMsg *pErrMsg, plConvertSettings *se if (!CanConvert()) return ret; - UInt32 count = GetSceneObject()->GetNumModifiers(); + uint32_t count = GetSceneObject()->GetNumModifiers(); hsTArray keys; // Go through all the modifiers attached to this node's scene object // and grab keys for objects who we would need to send interface messages to - for (UInt32 i = 0; i < count; i++) + for (uint32_t i = 0; i < count; i++) { const plModifier* pMod = GetSceneObject()->GetModifier(i); // right now all we care about are these, but I guarentee you we will @@ -4107,10 +4107,10 @@ hsBool plMaxNode::MakeIfaceReferences(plErrorMsg *pErrMsg, plConvertSettings *se // the list in a handy form if (keys.Count()) { - plInterfaceInfoModifier* pMod = TRACKED_NEW plInterfaceInfoModifier; + plInterfaceInfoModifier* pMod = new plInterfaceInfoModifier; plKey modifierKey = hsgResMgr::ResMgr()->NewKey(GetName(), pMod, GetLocation(), GetLoadMask()); - hsgResMgr::ResMgr()->AddViaNotify(modifierKey, TRACKED_NEW plObjRefMsg(GetSceneObject()->GetKey(), plRefMsg::kOnCreate, -1, plObjRefMsg::kModifier), plRefFlags::kActiveRef); + hsgResMgr::ResMgr()->AddViaNotify(modifierKey, new plObjRefMsg(GetSceneObject()->GetKey(), plRefMsg::kOnCreate, -1, plObjRefMsg::kModifier), plRefFlags::kActiveRef); for(int i = 0; i < keys.Count(); i++) pMod->AddRefdKey(keys[i]); diff --git a/Sources/Tools/MaxMain/plMaxNode.h b/Sources/Tools/MaxMain/plMaxNode.h index 20d10f14..34cfb5e5 100644 --- a/Sources/Tools/MaxMain/plMaxNode.h +++ b/Sources/Tools/MaxMain/plMaxNode.h @@ -168,7 +168,7 @@ public: plLightMapComponent* GetLightMapComponent(); // Starting at 0, returns an incrementing index for each maxNode. Useful for assigning // indices to sound objects attached to the node - UInt32 GetNextSoundIdx( void ); + uint32_t GetNextSoundIdx( void ); hsBool IsPhysical( void ); @@ -179,7 +179,7 @@ public: plPhysicalProps *GetPhysicalProps(); // Little helper function. Calls FindKey() in the resManager using the location (page) of this node - plKey FindPageKey( UInt16 classIdx, const char *name ); + plKey FindPageKey( uint16_t classIdx, const char *name ); const char *GetAgeName(); void CheckSynchOptions(plSynchedObject* so); @@ -206,7 +206,7 @@ protected: void IGetRTLightColors(plLightInfo* liInfo, IParamBlock2* ProperPB); void IGetRTLightAttenuation(plOmniLightInfo* liInfo, IParamBlock2* ProperPB); // RunTime Light animation builders - hsBool IGetRTLightAttenValues(IParamBlock2* ProperPB, hsScalar& attenConst, hsScalar& attenLinear, hsScalar& attenQuadratic,hsScalar &attenCutoff); + hsBool IGetRTLightAttenValues(IParamBlock2* ProperPB, float& attenConst, float& attenLinear, float& attenQuadratic,float &attenCutoff); void IAdjustRTColorByIntensity(plController* ctl, IParamBlock2* ProperPB); hsBool IAttachRTLightModifier(plLightModifier* liMod); @@ -215,7 +215,7 @@ protected: plSceneNode* IGetDrawableSceneNode(plErrorMsg *pErrMsg); void IAssignSpansToDrawables( hsTArray &spanArray, plDrawInterface *di, plErrorMsg *pErrMsg, plConvertSettings *settings ); - void IAssignSpan( plDrawableSpans *drawable, hsTArray &spanArray, UInt32 &index, + void IAssignSpan( plDrawableSpans *drawable, hsTArray &spanArray, uint32_t &index, hsMatrix44 &l2w, hsMatrix44 &w2l, plErrorMsg *pErrMsg, plConvertSettings *settings ); void ISetupBones( plDrawableSpans *drawable, hsTArray &spanArray, @@ -225,7 +225,7 @@ protected: void IWipeBranchDrawable(hsBool b); - UInt32 IBuildInstanceList( Object *obj, TimeValue t, hsTArray &nodes, hsBool beMoreAccurate = false ); + uint32_t IBuildInstanceList( Object *obj, TimeValue t, hsTArray &nodes, hsBool beMoreAccurate = false ); hsBool IMakeInstanceSpans( plMaxNode *node, hsTArray &spanArray, plErrorMsg *pErrMsg, plConvertSettings *settings ); hsBool IMaterialsMatch( plMaxNode *otherNode, hsBool beMoreAccurate ); @@ -239,22 +239,22 @@ friend class plLocationDlg; class plMaxBoneMap { protected: - typedef std::map BoneMap; + typedef std::map BoneMap; BoneMap fBones; - typedef std::map DrawableMap; + typedef std::map DrawableMap; DrawableMap fBaseMatrices; public: - UInt8 fNumBones; + uint8_t fNumBones; plMaxNodeBase *fOwner; // Make note of which node created us, so they can delete us. plMaxBoneMap() : fNumBones(0), fOwner(nil) {} void AddBone(plMaxNodeBase *bone); - UInt8 GetIndex(plMaxNodeBase *bone); + uint8_t GetIndex(plMaxNodeBase *bone); void FillBoneArray(plMaxNodeBase **boneArray); - UInt32 GetBaseMatrixIndex(plDrawable *draw); - void SetBaseMatrixIndex(plDrawable *draw, UInt32 idx); + uint32_t GetBaseMatrixIndex(plDrawable *draw); + void SetBaseMatrixIndex(plDrawable *draw, uint32_t idx); void SortBones(); }; diff --git a/Sources/Tools/MaxMain/plMaxNodeBase.cpp b/Sources/Tools/MaxMain/plMaxNodeBase.cpp index 9e55b0ce..ac8e7bc9 100644 --- a/Sources/Tools/MaxMain/plMaxNodeBase.cpp +++ b/Sources/Tools/MaxMain/plMaxNodeBase.cpp @@ -130,7 +130,7 @@ hsBool plMaxNodeBase::GetReverseSort() { GetMD; return (pMD) ? hsBool plMaxNodeBase::GetSortAsOpaque() { GetMD; return (pMD) ? pMD->GetSortAsOpaque() : nil;} hsBool plMaxNodeBase::GetVS() { GetMD; return (pMD) ? pMD->GetVS() : nil;} hsBool plMaxNodeBase::GetHasWaterHeight() { GetMD; return (pMD) ? pMD->GetHasWaterHeight() : nil; } -hsScalar plMaxNodeBase::GetWaterHeight() { GetMD; return (pMD) ? pMD->GetWaterHeight() : nil; } +float plMaxNodeBase::GetWaterHeight() { GetMD; return (pMD) ? pMD->GetWaterHeight() : nil; } hsBool plMaxNodeBase::GetSmoothAll() { GetMD; return (pMD) ? pMD->GetSmoothAll() : nil;} hsBool plMaxNodeBase::GetForceSortable() { GetMD; return (pMD) ? pMD->GetForceSortable() : nil;} hsBool plMaxNodeBase::GetConcave() { GetMD; return (pMD) ? pMD->GetConcave() : nil;} @@ -149,7 +149,7 @@ hsBool plMaxNodeBase::GetPhysical() { GetMD; return (pMD) ? hsBool plMaxNodeBase::GetItinerant() { GetMD; return (pMD) ? pMD->GetItinerant() : nil; } hsBool plMaxNodeBase::GetUnBounded() { GetMD; return (pMD) ? pMD->GetUnBounded() : nil; } hsBool plMaxNodeBase::GetDisableNormal() { GetMD; return (pMD) ? pMD->GetDisableNormal() : nil; } -UInt32 plMaxNodeBase::GetDecalLevel() { GetMD; return (pMD) ? pMD->GetDecalLevel() : nil; } +uint32_t plMaxNodeBase::GetDecalLevel() { GetMD; return (pMD) ? pMD->GetDecalLevel() : nil; } hsBool plMaxNodeBase::GetMovable() { GetMD; return (pMD) ? pMD->GetMovable() : nil; } hsBool plMaxNodeBase::GetIsBarney() { GetMD; return (pMD) ? pMD->GetIsBarney() : nil; } hsBool plMaxNodeBase::GetForceShadow() { GetMD; return (pMD) ? pMD->GetForceShadow() : nil; } @@ -164,7 +164,7 @@ hsBool plMaxNodeBase::GetBlendToFB() { GetMD; return (pMD) ? pMD- hsBool plMaxNodeBase::GetForceMaterialCopy() { GetMD; return (pMD) ? pMD->GetForceMaterialCopy() : nil; } hsBool plMaxNodeBase::GetInstanced() { GetMD; return (pMD) ? pMD->GetInstanced() : nil; } hsBool plMaxNodeBase::GetParticleRelated() { GetMD; return (pMD) ? pMD->GetParticleRelated() : nil; } -UInt32 plMaxNodeBase::GetSoundIdxCounter() { GetMD; return (pMD) ? pMD->GetSoundIdxCounter() : 0; } +uint32_t plMaxNodeBase::GetSoundIdxCounter() { GetMD; return (pMD) ? pMD->GetSoundIdxCounter() : 0; } plSceneObject* plMaxNodeBase::GetAvatarSO() { GetMD; return (pMD) ? pMD->GetAvatarSO() : nil; } BOOL plMaxNodeBase::HasFade() { GetMD; return (pMD) ? pMD->HasFade() : false; } Box3 plMaxNodeBase::GetFade() { GetMD; return (pMD) ? pMD->GetFade() : Box3(Point3(0,0,0), Point3(0,0,0)); } @@ -174,11 +174,11 @@ BOOL plMaxNodeBase::HasNormalChan() { GetMD; return (pMD) ? int plMaxNodeBase::GetNormalChan() { GetMD; return (pMD) ? pMD->GetNormalChan() : 0; } hsBool plMaxNodeBase::GetIsGUI() { GetMD; return (pMD) ? pMD->GetIsGUI() : false; } plSharedMesh* plMaxNodeBase::GetSwappableGeom() { GetMD; return (pMD) ? pMD->GetSwappableGeom() : nil; } -UInt32 plMaxNodeBase::GetSwappableGeomTarget() { GetMD; return (pMD) ? pMD->GetSwappableGeomTarget() : -1; } +uint32_t plMaxNodeBase::GetSwappableGeomTarget() { GetMD; return (pMD) ? pMD->GetSwappableGeomTarget() : -1; } plMaxBoneMap* plMaxNodeBase::GetBoneMap() { GetMD; return (pMD) ? pMD->GetBoneMap() : nil; } hsBool plMaxNodeBase::GetOverrideHighLevelSDL() { GetMD; return (pMD) ? pMD->GetOverrideHighLevelSDL() : false; } -UInt8 plMaxNodeBase::GetAnimCompress() { GetMD; return (pMD) ? pMD->GetAnimCompress() : false; } -hsScalar plMaxNodeBase::GetKeyReduceThreshold() { GetMD; return (pMD) ? pMD->GetKeyReduceThreshold() : 0; } +uint8_t plMaxNodeBase::GetAnimCompress() { GetMD; return (pMD) ? pMD->GetAnimCompress() : false; } +float plMaxNodeBase::GetKeyReduceThreshold() { GetMD; return (pMD) ? pMD->GetKeyReduceThreshold() : 0; } int plMaxNodeBase::NumRenderDependencies() { GetMD; return (pMD) ? pMD->NumRenderDependencies() : 0; } plMaxNodeBase* plMaxNodeBase::GetRenderDependency(int i) { GetMD; return (pMD) ? pMD->GetRenderDependency(i) : nil; } @@ -197,13 +197,13 @@ void plMaxNodeBase::SetPhysical(hsBool b) { GetMD; pMD //void plMaxNodeBase::SetItinerant(hsBool b); void plMaxNodeBase::SetUnBounded(hsBool b) { GetMD; pMD->SetUnBounded(b); } void plMaxNodeBase::SetDisableNormal(hsBool b) { GetMD; pMD->SetDisableNormal(b); } -void plMaxNodeBase::SetDecalLevel(UInt32 i) { GetMD; pMD->SetDecalLevel(i); } +void plMaxNodeBase::SetDecalLevel(uint32_t i) { GetMD; pMD->SetDecalLevel(i); } void plMaxNodeBase::SetMovable(hsBool b) { GetMD; pMD->SetMovable(b); pMD->SetRunTimeLight(b); pMD->SetNoPreShade(b); } void plMaxNodeBase::SetReverseSort(hsBool b) { GetMD; pMD->SetReverseSort(b); } void plMaxNodeBase::SetSortAsOpaque(hsBool b) { GetMD; pMD->SetSortAsOpaque(b); } void plMaxNodeBase::SetVS(hsBool b) { GetMD; pMD->SetVS(b); } void plMaxNodeBase::SetHasWaterHeight(hsBool b) { GetMD; pMD->SetHasWaterHeight(b); } -void plMaxNodeBase::SetWaterHeight(hsScalar h) { GetMD; pMD->SetWaterHeight(h); } +void plMaxNodeBase::SetWaterHeight(float h) { GetMD; pMD->SetWaterHeight(h); } void plMaxNodeBase::SetSmoothAll(hsBool b) { GetMD; pMD->SetSmoothAll(b); } void plMaxNodeBase::SetForceSortable(hsBool b) { GetMD; pMD->SetForceSortable(b); } void plMaxNodeBase::SetConcave(hsBool b) { GetMD; pMD->SetConcave(b); } @@ -230,7 +230,7 @@ void plMaxNodeBase::SetBlendToFB(hsBool b) { GetMD; pMD void plMaxNodeBase::SetForceMaterialCopy(hsBool b) { GetMD; pMD->SetForceMaterialCopy(b); } void plMaxNodeBase::SetInstanced(hsBool b) { GetMD; pMD->SetInstanced(b); } void plMaxNodeBase::SetParticleRelated(hsBool b) { GetMD; pMD->SetParticleRelated(b); } -void plMaxNodeBase::SetSoundIdxCounter(UInt32 ctr) { GetMD; pMD->SetSoundIdxCounter(ctr); } +void plMaxNodeBase::SetSoundIdxCounter(uint32_t ctr) { GetMD; pMD->SetSoundIdxCounter(ctr); } void plMaxNodeBase::SetAvatarSO(plSceneObject *so) { GetMD; pMD->SetAvatarSO(so); } void plMaxNodeBase::SetFade(const Box3& b) { GetMD; pMD->SetFade(b); } void plMaxNodeBase::SetDup2Sided(hsBool b) { GetMD; pMD->SetDup2Sided(b); } @@ -238,11 +238,11 @@ void plMaxNodeBase::SetRadiateNorms(hsBool b) { GetMD; pMD void plMaxNodeBase::SetNormalChan(int n) { GetMD; pMD->SetNormalChan(n); } void plMaxNodeBase::SetIsGUI(hsBool b) { GetMD; pMD->SetIsGUI(b); } void plMaxNodeBase::SetSwappableGeom(plSharedMesh *sm) { GetMD; pMD->SetSwappableGeom(sm); } -void plMaxNodeBase::SetSwappableGeomTarget(UInt32 id) { GetMD; pMD->SetSwappableGeomTarget(id); } +void plMaxNodeBase::SetSwappableGeomTarget(uint32_t id) { GetMD; pMD->SetSwappableGeomTarget(id); } void plMaxNodeBase::SetBoneMap(plMaxBoneMap *bones) { GetMD; pMD->SetBoneMap(bones); } void plMaxNodeBase::SetOverrideHighLevelSDL(hsBool b) { GetMD; pMD->SetOverrideHighLevelSDL(b); } -void plMaxNodeBase::SetAnimCompress(UInt8 v) { GetMD; pMD->SetAnimCompress(v); } -void plMaxNodeBase::SetKeyReduceThreshold(hsScalar v) { GetMD; pMD->SetKeyReduceThreshold(v); } +void plMaxNodeBase::SetAnimCompress(uint8_t v) { GetMD; pMD->SetAnimCompress(v); } +void plMaxNodeBase::SetKeyReduceThreshold(float v) { GetMD; pMD->SetKeyReduceThreshold(v); } void plMaxNodeBase::ClearRenderDependencies() { GetMD; pMD->ClearRenderDependencies(); } void plMaxNodeBase::AddBone(plMaxNodeBase* m) { GetMD; if(pMD) pMD->AddBone(m); } @@ -258,15 +258,15 @@ plLocation plMaxNodeBase::GetLocation() return loc; } -hsBool plMaxNodeBase::GetDirty(UInt8 i) +hsBool plMaxNodeBase::GetDirty(uint8_t i) { - UInt8 *dirty = IGetSceneViewerChunk(); + uint8_t *dirty = IGetSceneViewerChunk(); return *dirty & i; } -void plMaxNodeBase::SetDirty(UInt8 i, hsBool b) +void plMaxNodeBase::SetDirty(uint8_t i, hsBool b) { - UInt8 *dirty = IGetSceneViewerChunk(); + uint8_t *dirty = IGetSceneViewerChunk(); if (b) *dirty |= i; @@ -315,17 +315,17 @@ hsBool plMaxNodeBase::AddRenderDependency(plMaxNodeBase* m) return true; } -UInt8 *plMaxNodeBase::IGetSceneViewerChunk() +uint8_t *plMaxNodeBase::IGetSceneViewerChunk() { - UInt8 *SVChunk = nil; + uint8_t *SVChunk = nil; AppDataChunk *adc = GetAppDataChunk(PLASMA_MAX_CLASSID, GUP_CLASS_ID, kPlasmaSceneViewerChunk); if (adc) - SVChunk = (UInt8*)adc->data; + SVChunk = (uint8_t*)adc->data; else { // Does not exist, create a new one... - SVChunk = (UInt8*)MAX_new(1); + SVChunk = (uint8_t*)MAX_new(1); *SVChunk = 0; AddAppDataChunk(PLASMA_MAX_CLASSID, GUP_CLASS_ID, kPlasmaSceneViewerChunk, 1, SVChunk); } @@ -533,9 +533,9 @@ plComponentBase *plMaxNodeBase::ConvertToComponent() // list of the components found so far and ensure there aren't any duplicates. Maybe it // would be easier to just go through every component in the scene and check their target // lists... -Colin -UInt32 plMaxNodeBase::NumAttachedComponents(bool all) +uint32_t plMaxNodeBase::NumAttachedComponents(bool all) { - UInt32 numComponents = 0; + uint32_t numComponents = 0; std::vector comps; // Go through this item's reflist, looking for components @@ -556,9 +556,9 @@ UInt32 plMaxNodeBase::NumAttachedComponents(bool all) return numComponents; } -plComponentBase *plMaxNodeBase::GetAttachedComponent(UInt32 i, bool all) +plComponentBase *plMaxNodeBase::GetAttachedComponent(uint32_t i, bool all) { - UInt32 numComponents = 0; + uint32_t numComponents = 0; std::vector comps; // Go through this item's reflist, looking for components @@ -608,7 +608,7 @@ plComponentBase *plMaxNodeBase::IRefMakerToComponent(ReferenceMaker *maker, bool // Does this component actually ref us? (A component can have other // refs to a node, like a proxy object, so we want to make sure this // node is actually in the target list.) - for (UInt32 i = 0; i < comp->NumTargets(); i++) + for (uint32_t i = 0; i < comp->NumTargets(); i++) { if (comp->GetTarget(i) == this) return comp; @@ -654,7 +654,7 @@ const plRenderLevel& plMaxNodeBase::IGetRenderLevel(hsBool forBlend) return forBlend ? md->GetBlendLevel() : md->GetOpaqueLevel(); } -UInt32 plMaxNodeBase::IGetMajorRenderLevel(hsBool forBlend) +uint32_t plMaxNodeBase::IGetMajorRenderLevel(hsBool forBlend) { if( GetBlendToFB() ) return plRenderLevel::kFBMajorLevel; @@ -685,7 +685,7 @@ UInt32 plMaxNodeBase::IGetMajorRenderLevel(hsBool forBlend) return iMaxDep; } -UInt32 plMaxNodeBase::IGetMinorRenderLevel(hsBool forBlend) +uint32_t plMaxNodeBase::IGetMinorRenderLevel(hsBool forBlend) { if( GetAvatarSO() ) return plRenderLevel::kAvatarRendMinorLevel; @@ -765,8 +765,8 @@ const plRenderLevel& plMaxNodeBase::GetRenderLevel(hsBool forBlend) { #if 0 - UInt32 major = IGetMajorRenderLevel(forBlend); - UInt32 minor = IGetMinorRenderLevel(forBlend); + uint32_t major = IGetMajorRenderLevel(forBlend); + uint32_t minor = IGetMinorRenderLevel(forBlend); ISetRenderLevel(plRenderLevel(major, minor), forBlend); #else @@ -877,7 +877,7 @@ hsBool plMaxNodeBase::Contains(const Box3& bnd, const Matrix3& l2w) return true; } -hsScalar plMaxNodeBase::BoxVolume(const Box3& bnd, const Matrix3& l2w) +float plMaxNodeBase::BoxVolume(const Box3& bnd, const Matrix3& l2w) { Point3 corner = l2w * bnd[0]; // min, min, min float len[3]; @@ -889,7 +889,7 @@ hsScalar plMaxNodeBase::BoxVolume(const Box3& bnd, const Matrix3& l2w) return len[0] * len[1] * len[2]; } -hsScalar plMaxNodeBase::RegionPriority() +float plMaxNodeBase::RegionPriority() { TimeValue currTime = 0;//hsConverterUtils::Instance().GetTime(GetInterface()); Object *obj = EvalWorldState(currTime).obj; diff --git a/Sources/Tools/MaxMain/plMaxNodeBase.h b/Sources/Tools/MaxMain/plMaxNodeBase.h index 6bae6dd0..277b0546 100644 --- a/Sources/Tools/MaxMain/plMaxNodeBase.h +++ b/Sources/Tools/MaxMain/plMaxNodeBase.h @@ -42,7 +42,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #ifndef plMaxNodeBase_inc #define plMaxNodeBase_inc -#include "hsTypes.h" +#include "HeadSpin.h" #include "hsTemplates.h" #include "max.h" #include "hsMatrix44.h" @@ -101,7 +101,7 @@ public: hsBool GetWaterDecEnv(); hsBool GetVS(); hsBool GetHasWaterHeight(); - hsScalar GetWaterHeight(); + float GetWaterHeight(); hsBool GetSmoothAll(); hsBool GetForceSortable(); hsBool GetConcave(); @@ -114,7 +114,7 @@ public: hsBool GetItinerant(); hsBool GetUnBounded(); hsBool GetDisableNormal(); - UInt32 GetDecalLevel(); + uint32_t GetDecalLevel(); hsBool GetMovable(); hsBool GetNoShadow(); hsBool GetForceShadow(); @@ -129,7 +129,7 @@ public: hsBool GetForceMaterialCopy(); hsBool GetInstanced(); hsBool GetParticleRelated(); - UInt32 GetSoundIdxCounter(); + uint32_t GetSoundIdxCounter(); plSceneObject* GetAvatarSO(); BOOL HasFade(); Box3 GetFade(); @@ -140,11 +140,11 @@ public: BOOL GetGeoDice(int& maxFaces, float& maxSize, int& minFaces); hsBool GetIsGUI(); plSharedMesh* GetSwappableGeom(); - UInt32 GetSwappableGeomTarget(); + uint32_t GetSwappableGeomTarget(); plMaxBoneMap* GetBoneMap(); hsBool GetOverrideHighLevelSDL(); - UInt8 GetAnimCompress(); - hsScalar GetKeyReduceThreshold(); + uint8_t GetAnimCompress(); + float GetKeyReduceThreshold(); int NumRenderDependencies(); plMaxNodeBase* GetRenderDependency(int i); @@ -162,7 +162,7 @@ public: void SetItinerant(hsBool b); void SetUnBounded(hsBool b); void SetDisableNormal(hsBool b); - void SetDecalLevel(UInt32 i); + void SetDecalLevel(uint32_t i); void SetMovable(hsBool b); void SetNoPreShade(hsBool b); void SetForcePreShade(hsBool b); @@ -170,7 +170,7 @@ public: void SetSortAsOpaque(hsBool b); void SetVS(hsBool b); void SetHasWaterHeight(hsBool b); - void SetWaterHeight(hsScalar h); + void SetWaterHeight(float h); void SetSmoothAll(hsBool b); void SetForceSortable(hsBool b); void SetConcave(hsBool b); @@ -195,7 +195,7 @@ public: void SetForceMaterialCopy(hsBool b); void SetInstanced(hsBool b); void SetParticleRelated(hsBool b); - void SetSoundIdxCounter(UInt32 ctr); + void SetSoundIdxCounter(uint32_t ctr); void SetAvatarSO(plSceneObject *so); void SetFade(const Box3& b); void SetDup2Sided(hsBool b); @@ -204,11 +204,11 @@ public: void SetGeoDice(BOOL on, int maxFaces, float maxSize, int minFaces); void SetIsGUI(hsBool b); void SetSwappableGeom(plSharedMesh *sm); - void SetSwappableGeomTarget(UInt32 id); + void SetSwappableGeomTarget(uint32_t id); void SetBoneMap(plMaxBoneMap *bones); void SetOverrideHighLevelSDL(hsBool b); - void SetAnimCompress(UInt8 v); - void SetKeyReduceThreshold(hsScalar v); + void SetAnimCompress(uint8_t v); + void SetKeyReduceThreshold(float v); hsBool AddRenderDependency(plMaxNodeBase* m); hsBool RenderDependsOn(plMaxNodeBase* m); void ClearRenderDependencies(); @@ -218,8 +218,8 @@ public: // Dirty flags for SceneWatcher use enum { kGeomDirty = 0x1, kMatDirty = 0x2, kAllDirty = 0xFF }; - hsBool GetDirty(UInt8 i); - void SetDirty(UInt8 i, hsBool b); + hsBool GetDirty(uint8_t i); + void SetDirty(uint8_t i, hsBool b); plKey GetParentKey() { plMaxNodeBase *pPar = (plMaxNodeBase*)GetParentNode(); hsAssert(pPar, "No Parent"); return pPar->GetKey(); } @@ -248,13 +248,13 @@ public: // component will want to know what other components are attached to it. In // that case, set all to true, so that the attached components won't be // verified to be in your target list. - UInt32 NumAttachedComponents(bool all=false); - plComponentBase *GetAttachedComponent(UInt32 i, bool all=false); + uint32_t NumAttachedComponents(bool all=false); + plComponentBase *GetAttachedComponent(uint32_t i, bool all=false); hsBool Contains(const Point3& worldPt); // is the world space point inside my (CONVEX) geometry or dummy box? hsBool Contains(const Box3& bnd, const Matrix3& l2w); // is the box contained entirely inside my (CONVEX) geometry or dummy box? - hsScalar BoxVolume(const Box3& bnd, const Matrix3& l2w); - hsScalar RegionPriority(); // returns a dominance factor. If a point is in more than one environmental + float BoxVolume(const Box3& bnd, const Matrix3& l2w); + float RegionPriority(); // returns a dominance factor. If a point is in more than one environmental // region, the region with highest priority wins. Interface *GetInterface() { return ::GetCOREInterface(); } @@ -299,12 +299,12 @@ protected: kPlasmaLightChunk, // No longer in use, but cleared from old files }; - UInt8 *IGetSceneViewerChunk(); + uint8_t *IGetSceneViewerChunk(); // Attempts to convert a RefMaker pointer to a component. Returns nil if it is not a component. plComponentBase *IRefMakerToComponent(ReferenceMaker *maker, bool all); - UInt32 IGetMajorRenderLevel(hsBool forBlend); - UInt32 IGetMinorRenderLevel(hsBool forBlend); + uint32_t IGetMajorRenderLevel(hsBool forBlend); + uint32_t IGetMinorRenderLevel(hsBool forBlend); hsBool IRenderLevelSet(hsBool forBlend); void ISetRenderLevel(const plRenderLevel& l, hsBool forBlend); diff --git a/Sources/Tools/MaxMain/plMaxNodeData.h b/Sources/Tools/MaxMain/plMaxNodeData.h index 94947b49..8bef51d8 100644 --- a/Sources/Tools/MaxMain/plMaxNodeData.h +++ b/Sources/Tools/MaxMain/plMaxNodeData.h @@ -43,7 +43,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #ifndef plMaxNodeData_inc #define plMaxNodeData_inc -#include "hsTypes.h" +#include "HeadSpin.h" #include "hsTemplates.h" #include "hsColorRGBA.h" #include "plRenderLevel.h" @@ -129,7 +129,7 @@ public: DataBF() { - fBitVector = TRACKED_NEW hsBitVector; + fBitVector = new hsBitVector; fBitVector->SetBit(kDrawable); fBitVector->SetBit(kPhysical); } @@ -142,13 +142,13 @@ public: } DataBF(const DataBF& ot) { - fBitVector = TRACKED_NEW hsBitVector; + fBitVector = new hsBitVector; *fBitVector = *ot.fBitVector; } void Init() { - fBitVector = TRACKED_NEW hsBitVector; + fBitVector = new hsBitVector; fBitVector->SetBit(kDrawable); fBitVector->SetBit(kPhysical); } @@ -175,7 +175,7 @@ public: fWaterHeight(0), fGDMaxFaces(0), fGDMaxSize(0), fGDMinFaces(0), fSwapMesh(nil), - fSwapTargetID((UInt32)-1), + fSwapTargetID((uint32_t)-1), fCachedAlphaHackLayerCounts(nil), fBoneMap(nil), fAnimCompression(1), // Should be plAnimCompressComp::kCompressionLow, @@ -305,8 +305,8 @@ public: hsBool GetHasWaterHeight() { return MaxDatBF.CanBF(MaxDatBF.kWaterHeight); } void SetHasWaterHeight(hsBool b) { MaxDatBF.SetBF(b, MaxDatBF.kWaterHeight); } - hsScalar GetWaterHeight() { return fWaterHeight; } - void SetWaterHeight(hsScalar f) { SetHasWaterHeight(true); fWaterHeight = f; } + float GetWaterHeight() { return fWaterHeight; } + void SetWaterHeight(float f) { SetHasWaterHeight(true); fWaterHeight = f; } hsBool GetSmoothAll() {return MaxDatBF.CanBF(MaxDatBF.kSmoothAll); } void SetSmoothAll(hsBool b) { MaxDatBF.SetBF(b, MaxDatBF.kSmoothAll); } @@ -350,8 +350,8 @@ public: plSharedMesh* GetSwappableGeom() { return fSwapMesh;} void SetSwappableGeom(plSharedMesh *sm) { fSwapMesh = sm; } - UInt32 GetSwappableGeomTarget() { return fSwapTargetID;} - void SetSwappableGeomTarget(UInt32 id) { fSwapTargetID = id;} + uint32_t GetSwappableGeomTarget() { return fSwapTargetID;} + void SetSwappableGeomTarget(uint32_t id) { fSwapTargetID = id;} plMaxBoneMap* GetBoneMap() { return fBoneMap;} void SetBoneMap(plMaxBoneMap *bones) { fBoneMap = bones;} @@ -368,11 +368,11 @@ public: plKey GetRoomKey() { return fpRoomKey; } void SetRoomKey(plKey p) { fpRoomKey = p; } - UInt32 GetDecalLevel() { return fDecalLevel; } - void SetDecalLevel(UInt32 i) { fDecalLevel = i; } + uint32_t GetDecalLevel() { return fDecalLevel; } + void SetDecalLevel(uint32_t i) { fDecalLevel = i; } - UInt32 GetSoundIdxCounter() { return fSoundIdxCounter; } - void SetSoundIdxCounter( UInt32 i ) { fSoundIdxCounter = i; } + uint32_t GetSoundIdxCounter() { return fSoundIdxCounter; } + void SetSoundIdxCounter( uint32_t i ) { fSoundIdxCounter = i; } plSceneObject * GetAvatarSO() { return fAvatarSO; } void SetAvatarSO(plSceneObject *so) { fAvatarSO = so; } @@ -412,10 +412,10 @@ public: void SetAlphaHackLayersCache( hsTArray *cache ) { fCachedAlphaHackLayerCounts = cache; } hsBool GetOverrideHighLevelSDL() { return MaxDatBF.CanBF(MaxDatBF.kOverrideHighLevelSDL); } void SetOverrideHighLevelSDL(hsBool b) { MaxDatBF.SetBF(b, MaxDatBF.kOverrideHighLevelSDL); } - UInt8 GetAnimCompress() { return fAnimCompression; } - void SetAnimCompress(UInt8 v) { fAnimCompression = v; } - hsScalar GetKeyReduceThreshold() { return fKeyReduceThreshold; } - void SetKeyReduceThreshold(hsScalar v) { fKeyReduceThreshold = v; } + uint8_t GetAnimCompress() { return fAnimCompression; } + void SetAnimCompress(uint8_t v) { fAnimCompression = v; } + float GetKeyReduceThreshold() { return fKeyReduceThreshold; } + void SetKeyReduceThreshold(float v) { fKeyReduceThreshold = v; } protected: plKey fpKey; @@ -423,9 +423,9 @@ protected: // hacking this in here temporarily because everything's about to change in the mesh world... hsGMesh* fpMesh; plKey fpRoomKey; - UInt32 fDecalLevel; - Int32 fNormalChan; - UInt32 fSoundIdxCounter; + uint32_t fDecalLevel; + int32_t fNormalChan; + uint32_t fSoundIdxCounter; plSceneObject * fAvatarSO; plMaxNodeBaseTab fRenderDependencies; plMaxNodeBaseTab fBones; @@ -436,14 +436,14 @@ protected: plRenderLevel fBlendLevel; plRenderLevel fOpaqueLevel; plPhysicalProps fPhysicalProps; - UInt32 fSwapTargetID; + uint32_t fSwapTargetID; hsTArray *fCachedAlphaHackLayerCounts; plSharedMesh *fSwapMesh; plMaxBoneMap *fBoneMap; plLoadMask fLoadMask; - hsScalar fWaterHeight; - UInt8 fAnimCompression; - hsScalar fKeyReduceThreshold; + float fWaterHeight; + uint8_t fAnimCompression; + float fKeyReduceThreshold; DataBF MaxDatBF; }; diff --git a/Sources/Tools/MaxMain/plMtlCollector.cpp b/Sources/Tools/MaxMain/plMtlCollector.cpp index c087ca9f..aa82303b 100644 --- a/Sources/Tools/MaxMain/plMtlCollector.cpp +++ b/Sources/Tools/MaxMain/plMtlCollector.cpp @@ -69,7 +69,7 @@ static bool IsPlasmaMtl(Mtl *mtl) return false; } -static bool IsTexmapOK(Texmap *tex, UInt8 flags) +static bool IsTexmapOK(Texmap *tex, uint8_t flags) { if (flags & plMtlCollector::kPlasmaOnly && !plPlasmaMAXLayer::GetPlasmaMAXLayer(tex)) return false; @@ -77,7 +77,7 @@ static bool IsTexmapOK(Texmap *tex, UInt8 flags) return true; } -static bool IsMtlOK(Mtl *mtl, UInt8 flags) +static bool IsMtlOK(Mtl *mtl, uint8_t flags) { if (flags & plMtlCollector::kPlasmaOnly && !IsPlasmaMtl(mtl)) return false; @@ -91,7 +91,7 @@ static bool IsMtlOK(Mtl *mtl, UInt8 flags) return true; } -void GetMtlsRecur(MtlBase *mtlBase, MtlSet* mtls, TexSet* texmaps, UInt32 flags) +void GetMtlsRecur(MtlBase *mtlBase, MtlSet* mtls, TexSet* texmaps, uint32_t flags) { if (!mtlBase) return; @@ -177,7 +177,7 @@ static void GetTexmapPBs(Texmap* tex, PBSet& pbs) #include "MaxPlasmaLights/plRealTimeLightBase.h" -static void GetNodeMtlsRecur(INode *node, MtlSet* mtls, TexSet* texmaps, UInt32 flags) +static void GetNodeMtlsRecur(INode *node, MtlSet* mtls, TexSet* texmaps, uint32_t flags) { Mtl *mtl = node->GetMtl(); GetMtlsRecur(mtl, mtls, texmaps, flags); @@ -192,7 +192,7 @@ static void GetNodeMtlsRecur(INode *node, MtlSet* mtls, TexSet* texmaps, UInt32 plGUIControlBase *gui = plGUIControlBase::GetGUIComp( node ); if( gui != nil ) { - UInt32 i; + uint32_t i; for( i = 0; i < gui->GetNumMtls(); i++ ) GetMtlsRecur( gui->GetMtl( i ), mtls, texmaps, flags ); } @@ -202,7 +202,7 @@ static void GetNodeMtlsRecur(INode *node, MtlSet* mtls, TexSet* texmaps, UInt32 plGUISkinComp *guiSkin = plGUISkinComp::GetGUIComp( node ); if( guiSkin != nil ) { - UInt32 i; + uint32_t i; for( i = 0; i < guiSkin->GetNumMtls(); i++ ) GetMtlsRecur( guiSkin->GetMtl( i ), mtls, texmaps, flags ); } @@ -215,7 +215,7 @@ static void GetNodeMtlsRecur(INode *node, MtlSet* mtls, TexSet* texmaps, UInt32 if( base->ClassID() == IMAGE_LIB_CID ) { pfImageLibComponent *iLib = (pfImageLibComponent *)base; - UInt32 i; + uint32_t i; for( i = 0; i < iLib->GetNumBitmaps(); i++ ) GetMtlsRecur( iLib->GetBitmap( i ), mtls, texmaps, flags ); } @@ -227,7 +227,7 @@ static void GetNodeMtlsRecur(INode *node, MtlSet* mtls, TexSet* texmaps, UInt32 GetNodeMtlsRecur(node->GetChildNode(i), mtls, texmaps, flags); } -static void GetEditorMtls(MtlSet* mtls, TexSet* texmaps, UInt32 flags) +static void GetEditorMtls(MtlSet* mtls, TexSet* texmaps, uint32_t flags) { static const int kNumEditorSlots = 24; @@ -239,7 +239,7 @@ static void GetEditorMtls(MtlSet* mtls, TexSet* texmaps, UInt32 flags) } } -void plMtlCollector::GetMtls(MtlSet* mtls, TexSet* texmaps, UInt32 flags) +void plMtlCollector::GetMtls(MtlSet* mtls, TexSet* texmaps, uint32_t flags) { Interface *ip = GetCOREInterface(); diff --git a/Sources/Tools/MaxMain/plMtlCollector.h b/Sources/Tools/MaxMain/plMtlCollector.h index 19185a5e..6da10b89 100644 --- a/Sources/Tools/MaxMain/plMtlCollector.h +++ b/Sources/Tools/MaxMain/plMtlCollector.h @@ -42,7 +42,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #ifndef plMtlCollector_h_inc #define plMtlCollector_h_inc -#include "hsTypes.h" +#include "HeadSpin.h" #include #include "hsSTLSortUtils.h" @@ -69,7 +69,7 @@ public: kNoSubMtls = 0x10, }; - static void GetMtls(MtlSet* mtls, TexSet* texmaps, UInt32 flags=0); + static void GetMtls(MtlSet* mtls, TexSet* texmaps, uint32_t flags=0); static void GetMtlLayers(Mtl *mtl, LayerSet& layers); diff --git a/Sources/Tools/MaxMain/plPhysXCooking.cpp b/Sources/Tools/MaxMain/plPhysXCooking.cpp index 3f2cd134..4796d09e 100644 --- a/Sources/Tools/MaxMain/plPhysXCooking.cpp +++ b/Sources/Tools/MaxMain/plPhysXCooking.cpp @@ -64,11 +64,11 @@ hsBool ThreePlaneIntersect(const NxVec3& norm0, const NxVec3& point0, //need to make sure these planes aren't parallel hsBool suc=0; NxVec3 cross=norm1.cross( norm2); - hsScalar denom=norm0.dot(cross); + float denom=norm0.dot(cross); if(abs(denom)<0.0001) return 0;//basically paralell // if we are here there must be a point in 3 space try{ - hsScalar d1,d2,d3; + float d1,d2,d3; d1=norm0.dot(point0); d2=norm1.dot(point1); d3=norm2.dot(point2); @@ -108,18 +108,18 @@ void plPhysXCooking::Shutdown() fSkipErrors = false; } -hsVectorStream* plPhysXCooking::CookTrimesh(int nVerts, hsPoint3* verts, int nFaces, UInt16* faces) +hsVectorStream* plPhysXCooking::CookTrimesh(int nVerts, hsPoint3* verts, int nFaces, uint16_t* faces) { NxTriangleMeshDesc triDesc; triDesc.numVertices = nVerts; triDesc.pointStrideBytes = sizeof(hsPoint3); triDesc.points = verts; triDesc.numTriangles = nFaces; - triDesc.triangleStrideBytes = sizeof(UInt16) * 3; + triDesc.triangleStrideBytes = sizeof(uint16_t) * 3; triDesc.triangles = faces; triDesc.flags = NX_MF_16_BIT_INDICES; - hsVectorStream* ram = TRACKED_NEW hsVectorStream; + hsVectorStream* ram = new hsVectorStream; plPXStream buf(ram); bool status = NxCookTriangleMesh(triDesc, buf); hsAssert(status, "Trimesh failed to cook"); @@ -158,12 +158,12 @@ bool plPhysXCooking::TestIfConvex(NxConvexMesh* convexMesh, int nVerts, hsPoint3 NxConvexMeshDesc desc; convexMesh->saveToDesc(desc); - hsPlane3* planes = TRACKED_NEW hsPlane3[desc.numTriangles]; + hsPlane3* planes = new hsPlane3[desc.numTriangles]; int i; for ( i = 0; i < desc.numTriangles; i++) { - UInt32* triangle = (UInt32*)(((char*)desc.triangles) + desc.triangleStrideBytes*i); + uint32_t* triangle = (uint32_t*)(((char*)desc.triangles) + desc.triangleStrideBytes*i); float* vertex1 = (float*)(((char*)desc.points) + desc.pointStrideBytes*triangle[0]); float* vertex2 = (float*)(((char*)desc.points) + desc.pointStrideBytes*triangle[1]); float* vertex3 = (float*)(((char*)desc.points) + desc.pointStrideBytes*triangle[2]); @@ -199,7 +199,7 @@ hsVectorStream* plPhysXCooking::CookHull(int nVerts, hsPoint3* verts, bool infla convexDesc.flags|= NX_CF_INFLATE_CONVEX ; } - hsVectorStream* ram = TRACKED_NEW hsVectorStream; + hsVectorStream* ram = new hsVectorStream; plPXStream buf(ram); bool status = NxCookConvexMesh(convexDesc, buf); hsAssert(status, "Convex mesh failed to cook"); @@ -219,11 +219,11 @@ hsVectorStream* plPhysXCooking::CookHull(int nVerts, hsPoint3* verts, bool infla NxTriangleMesh* ReadExplicit(hsStream* stream) { const int nVertices = stream->ReadLE32(); - hsPoint3* pVertices = TRACKED_NEW hsPoint3[nVertices]; + hsPoint3* pVertices = new hsPoint3[nVertices]; stream->ReadLEScalar(nVertices*3, (float*)pVertices); const int nFaces = stream->ReadLE32(); - unsigned short* pTriangles = TRACKED_NEW unsigned short[nFaces * 3]; + unsigned short* pTriangles = new unsigned short[nFaces * 3]; stream->ReadLE16(nFaces * 3, pTriangles); NxTriangleMeshDesc triDesc; @@ -231,7 +231,7 @@ NxTriangleMesh* ReadExplicit(hsStream* stream) triDesc.pointStrideBytes = sizeof(hsPoint3); triDesc.points = pVertices; triDesc.numTriangles = nFaces; - triDesc.triangleStrideBytes = sizeof(UInt16) * 3; + triDesc.triangleStrideBytes = sizeof(uint16_t) * 3; triDesc.triangles = pTriangles; triDesc.flags = NX_MF_16_BIT_INDICES;// | NX_MF_FLIPNORMALS; @@ -257,7 +257,7 @@ NxTriangleMesh* ReadExplicit(hsStream* stream) NxConvexMesh* ReadConvexHull(hsStream* stream) { const int nVertices = stream->ReadLE32(); - hsPoint3* pVertices = TRACKED_NEW hsPoint3[nVertices]; + hsPoint3* pVertices = new hsPoint3[nVertices]; stream->ReadLEScalar(nVertices*3, (float*)pVertices); NxConvexMeshDesc convexDesc; @@ -287,10 +287,10 @@ NxConvexMesh* ReadConvexHull(hsStream* stream) void ReadBoxFromHull(hsStream* stream, NxBoxShapeDesc& box) { const int nVertices = stream->ReadLE32(); - hsPoint3* pVertices = TRACKED_NEW hsPoint3[nVertices]; + hsPoint3* pVertices = new hsPoint3[nVertices]; stream->ReadLEScalar(nVertices*3, (float*)pVertices); - hsScalar minX, minY, minZ, maxX, maxY, maxZ; + float minX, minY, minZ, maxX, maxY, maxZ; minX = minY = minZ = FLT_MAX; maxX = maxY = maxZ = -FLT_MAX; for (int i = 0; i < nVertices; i++) @@ -320,7 +320,7 @@ void ReadBoxFromHull(hsStream* stream, NxBoxShapeDesc& box) // box.localPose.setRowMajor44(&mat.fMap[0][0]); } */ -hsBool ProjectPointOnToPlane(const hsVector3& planeNormal,hsScalar& d0, +hsBool ProjectPointOnToPlane(const hsVector3& planeNormal,float& d0, const hsVector3 pointToProject, hsPoint3& res) { @@ -337,21 +337,21 @@ hsBool ProjectPointOnToPlane(const hsVector3& planeNormal,hsScalar& d0, void plPhysXCooking::PCA(const NxVec3* points,int numPoints, NxMat33& out) { NxVec3 mean(0.f,0.f,0.f); - hsScalar Cov[3][3]; - memset(Cov,0,9* sizeof hsScalar); + float Cov[3][3]; + memset(Cov,0,9* sizeof(float)); for(int i=0; i 0.f ) return false; diff --git a/Sources/Tools/MaxMain/plPhysicalProps.cpp b/Sources/Tools/MaxMain/plPhysicalProps.cpp index 7d564492..7c9147e0 100644 --- a/Sources/Tools/MaxMain/plPhysicalProps.cpp +++ b/Sources/Tools/MaxMain/plPhysicalProps.cpp @@ -113,12 +113,12 @@ plPhysicalProps::plPhysicalProps() : { } -bool plPhysicalProps::SetGroup(UInt32 group, plMaxNode *node, plErrorMsg *errMsg, bool canIgnore) +bool plPhysicalProps::SetGroup(uint32_t group, plMaxNode *node, plErrorMsg *errMsg, bool canIgnore) { return ISetParam(fGroup, group, kMemberGroup, canIgnore, node, errMsg); } -bool plPhysicalProps::SetReportGroup(UInt32 notifyGroup, plMaxNode *node, plErrorMsg *errMsg, bool canIgnore) +bool plPhysicalProps::SetReportGroup(uint32_t notifyGroup, plMaxNode *node, plErrorMsg *errMsg, bool canIgnore) { return ISetParam(fReportGroup, notifyGroup, kReportGroup, canIgnore, node, errMsg); } @@ -300,7 +300,7 @@ bool plPhysicalProps::GetPhysAnim() return IGetFlagParam(kFlagPhysAnim); } -void plPhysicalProps::SetCanIgnore(UInt32 type, bool canIgnore) +void plPhysicalProps::SetCanIgnore(uint32_t type, bool canIgnore) { if (canIgnore) fCanIgnore |= type; @@ -308,7 +308,7 @@ void plPhysicalProps::SetCanIgnore(UInt32 type, bool canIgnore) fCanIgnore &= ~type; } -bool plPhysicalProps::CanIgnore(UInt32 type) +bool plPhysicalProps::CanIgnore(uint32_t type) { return ((fCanIgnore & type) != 0); } diff --git a/Sources/Tools/MaxMain/plPhysicalProps.h b/Sources/Tools/MaxMain/plPhysicalProps.h index da604dfc..7d70b149 100644 --- a/Sources/Tools/MaxMain/plPhysicalProps.h +++ b/Sources/Tools/MaxMain/plPhysicalProps.h @@ -42,7 +42,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #ifndef plPhysicalProps_h_inc #define plPhysicalProps_h_inc -#include "hsTypes.h" +#include "HeadSpin.h" #include "..\..\NucleusLib\pnKeyedObject\plKey.h" class plMaxNode; @@ -55,8 +55,8 @@ public: // Set canIgnore to true if it is OK for someone else's setting to override yours // If any of the Set functions return false, there was a conflict and the export will be aborted. // - bool SetGroup(UInt32 group, plMaxNode *node, plErrorMsg *errMsg, bool canIgnore=false); - bool SetReportGroup(UInt32 notifyGroup, plMaxNode *node, plErrorMsg *errMsg, bool canIgnore=false); + bool SetGroup(uint32_t group, plMaxNode *node, plErrorMsg *errMsg, bool canIgnore=false); + bool SetReportGroup(uint32_t notifyGroup, plMaxNode *node, plErrorMsg *errMsg, bool canIgnore=false); bool SetMass(float mass, plMaxNode *node, plErrorMsg *errMsg, bool canIgnore=false); bool SetFriction(float friction, plMaxNode *node, plErrorMsg *errMsg, bool canIgnore=false); bool SetRestitution(float restitution, plMaxNode *node, plErrorMsg *errMsg, bool canIgnore=false); @@ -95,8 +95,8 @@ public: bool IsUsed() { return fUsed; } - UInt32 GetGroup() { return fGroup; } - UInt32 GetReportGroup() { return fReportGroup; } + uint32_t GetGroup() { return fGroup; } + uint32_t GetReportGroup() { return fReportGroup; } float GetMass() { return fMass; } float GetFriction() { return fFriction; } float GetRestitution() { return fRestitution; } @@ -124,16 +124,16 @@ public: protected: bool fUsed; - UInt32 fCanIgnore; + uint32_t fCanIgnore; - UInt32 fGroup; - UInt32 fReportGroup; + uint32_t fGroup; + uint32_t fReportGroup; float fMass; float fFriction; float fRestitution; int fBoundsType; plMaxNode *fProxyNode; - UInt32 fFlags; + uint32_t fFlags; plMaxNode* fSubworld; int fStartInactive; int fNoSynchronize; @@ -166,8 +166,8 @@ protected: return true; } - void SetCanIgnore(UInt32 type, bool canIgnore); - bool CanIgnore(UInt32 type); + void SetCanIgnore(uint32_t type, bool canIgnore); + bool CanIgnore(uint32_t type); void IDisplayErrorMsg(plMaxNode *node, plErrorMsg *errMsg); diff --git a/Sources/Tools/MaxMain/plPluginResManager.cpp b/Sources/Tools/MaxMain/plPluginResManager.cpp index de653271..4fb69433 100644 --- a/Sources/Tools/MaxMain/plPluginResManager.cpp +++ b/Sources/Tools/MaxMain/plPluginResManager.cpp @@ -41,7 +41,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ #include "HeadSpin.h" #include "plPluginResManager.h" -#include "hsTypes.h" +#include "HeadSpin.h" #include "hsTemplates.h" #include "plResMgr/plRegistryNode.h" #include "plResMgr/plRegistryHelpers.h" @@ -57,7 +57,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "plCommonObjLib.h" #include "MaxComponent/plMiscComponents.h" -plKey plPluginResManager::NameToLoc(const char* age, const char* page, Int32 sequenceNumber, hsBool itinerant) +plKey plPluginResManager::NameToLoc(const char* age, const char* page, int32_t sequenceNumber, hsBool itinerant) { // Hack for now--always prefer paging out sceneNodes first fPageOutHint = plSceneNode::Index(); @@ -76,7 +76,7 @@ plKey plPluginResManager::NameToLoc(const char* age, const char* page, Int32 seq if (snKey == nil) { // Not found, create a new one - plSceneNode *newSceneNode = TRACKED_NEW plSceneNode; + plSceneNode *newSceneNode = new plSceneNode; snKey = NewKey(keyName, newSceneNode, pageNode->GetPageInfo().GetLocation()); // Call init after it gets a key @@ -110,14 +110,14 @@ plKey plPluginResManager::NameToLoc(const char* age, const char* page, Int32 seq // seqNumber, returns the page for that combo (either by preloading it or // by creating it). -plRegistryPageNode* plPluginResManager::INameToPage(const char* age, const char* page, Int32 sequenceNumber, hsBool itinerant) +plRegistryPageNode* plPluginResManager::INameToPage(const char* age, const char* page, int32_t sequenceNumber, hsBool itinerant) { // Find the location first, to see if it already exists plRegistryPageNode* pageNode = FindPage(age, page); if (pageNode == nil) { // This page does not yet exist, so create a new page - if (sequenceNumber != UInt32(-1)) + if (sequenceNumber != uint32_t(-1)) { const plLocation& newLoc = ICreateLocation(age, page, sequenceNumber, itinerant); pageNode = CreatePage(newLoc, age, page); @@ -157,9 +157,9 @@ public: virtual hsBool EatKey(const plKey& key) { - UInt32 count = plCommonObjLib::GetNumLibs(); + uint32_t count = plCommonObjLib::GetNumLibs(); - for (UInt32 i = 0; i < count; i++) + for (uint32_t i = 0; i < count; i++) { plCommonObjLib* lib = plCommonObjLib::GetLib(i); if (lib->IsInteresting(key)) @@ -188,7 +188,7 @@ public: // Note: Broken out in a separate function 5.31.2002 mcn to facilitate // pre-loading textures exported to our special textures page. -void plPluginResManager::IPreLoadTextures(plRegistryPageNode* pageNode, Int32 origSeqNumber) +void plPluginResManager::IPreLoadTextures(plRegistryPageNode* pageNode, int32_t origSeqNumber) { // For common pages, we want to kinda-maybe-load all the objects so they don't get wiped when we // re-export them. However, we don't have a good way of telling whether a page is a common page, @@ -233,7 +233,7 @@ void plPluginResManager::IPreLoadTextures(plRegistryPageNode* pageNode, Int32 or // Make sure it's not a global page we're handling either if (!pageNode->GetPageInfo().GetLocation().IsReserved()) { - Int32 texSeqNum = -1; + int32_t texSeqNum = -1; if (origSeqNumber != -1) texSeqNum = plPageInfoUtils::GetCommonSeqNumFromNormal(origSeqNumber, plAgeDescription::kTextures); @@ -243,7 +243,7 @@ void plPluginResManager::IPreLoadTextures(plRegistryPageNode* pageNode, Int32 or hsAssert(texturePage != nil, "Unable to get or create the shared textures page? Shouldn't be possible."); // Do the other one - Int32 commonSeqNum = -1; + int32_t commonSeqNum = -1; if (origSeqNumber != -1) commonSeqNum = plPageInfoUtils::GetCommonSeqNumFromNormal(origSeqNumber, plAgeDescription::kGlobal); @@ -294,7 +294,7 @@ void plPluginResManager::IShutdown() // Loop through all the commonObjLibs and clear their object lists, just // as a safety measure (the creators of the various libs should really // be doing it) - for (UInt32 i = 0; i < plCommonObjLib::GetNumLibs(); i++) + for (uint32_t i = 0; i < plCommonObjLib::GetNumLibs(); i++) plCommonObjLib::GetLib(i)->ClearObjectList(); plResManager::IShutdown(); @@ -304,11 +304,11 @@ void plPluginResManager::IShutdown() class plSeqNumberFinder : public plRegistryPageIterator { protected: - Int32& fSeqNum; + int32_t& fSeqNum; hsBool fWillBeReserved; public: - plSeqNumberFinder(Int32& seqNum, hsBool willBeReserved) : fSeqNum(seqNum), fWillBeReserved(willBeReserved) {} + plSeqNumberFinder(int32_t& seqNum, hsBool willBeReserved) : fSeqNum(seqNum), fWillBeReserved(willBeReserved) {} virtual hsBool EatPage(plRegistryPageNode* page) { @@ -322,15 +322,15 @@ public: plLocation plPluginResManager::ICreateLocation(const char* age, const char* page, hsBool itinerant) { - Int32 seqNum = VerifySeqNumber(0, age, page); + int32_t seqNum = VerifySeqNumber(0, age, page); return ICreateLocation(age, page, seqNum, itinerant); } -plLocation plPluginResManager::ICreateLocation(const char* age, const char* page, Int32 seqNum, hsBool itinerant) +plLocation plPluginResManager::ICreateLocation(const char* age, const char* page, int32_t seqNum, hsBool itinerant) { hsBool willBeReserved = hsStrCaseEQ(age, "global"); - Int32 oldNum = seqNum; + int32_t oldNum = seqNum; seqNum = VerifySeqNumber(seqNum, age, page); if (seqNum != oldNum) { @@ -427,7 +427,7 @@ void plPluginResManager::AddLooseEnd(plKey key) } } // Verifies that the given sequence number belongs to the given string combo and ONLY that combo. Returns a new, unique sequenceNumber if not -Int32 plPluginResManager::VerifySeqNumber(Int32 sequenceNumber, const char* age, const char* page) +int32_t plPluginResManager::VerifySeqNumber(int32_t sequenceNumber, const char* age, const char* page) { hsBool negated = false, willBeReserved = hsStrCaseEQ(age, "global"); if (sequenceNumber < 0) @@ -479,7 +479,7 @@ Int32 plPluginResManager::VerifySeqNumber(Int32 sequenceNumber, const char* age, const int kTemporarySequenceStartPrefix = 100; // can't be larger then 0xFE, so well start out at 100 for kicks sequenceNumber = plPageInfoUtils::CombineSeqNum(kTemporarySequenceStartPrefix, 0); - Int32 upperLimit = 0xFEFFFF; // largest legal sequence number is a prefix of FE and a suffix of FFFF + int32_t upperLimit = 0xFEFFFF; // largest legal sequence number is a prefix of FE and a suffix of FFFF for(; sequenceNumber < upperLimit; sequenceNumber++) { if (willBeReserved) @@ -508,7 +508,7 @@ bool plPluginResManager::NukeKeyAndObject(plKey& objectKey) class plPublicRefKey : public plKeyImp { public: - UInt16 GetRefCount() const { return fRefCount; } + uint16_t GetRefCount() const { return fRefCount; } }; plKeyImp* keyData = (plKeyImp*)objectKey; diff --git a/Sources/Tools/MaxMain/plPluginResManager.h b/Sources/Tools/MaxMain/plPluginResManager.h index 5d4d9c1d..45733ea6 100644 --- a/Sources/Tools/MaxMain/plPluginResManager.h +++ b/Sources/Tools/MaxMain/plPluginResManager.h @@ -60,10 +60,10 @@ public: //------------------------ // Given a page string combo, returns the key of the sceneNode for that page. If the page does not exist, it creates one. - plKey NameToLoc(const char* age, const char* page, Int32 sequenceNumber, hsBool itinerant = false); + plKey NameToLoc(const char* age, const char* page, int32_t sequenceNumber, hsBool itinerant = false); // Verifies that the given sequence number belongs to the given string combo and ONLY that combo. Returns a new, unique sequenceNumber if not - Int32 VerifySeqNumber(Int32 sequenceNumber, const char* age, const char* page); + int32_t VerifySeqNumber(int32_t sequenceNumber, const char* age, const char* page); enum VerifyErrors { @@ -97,11 +97,11 @@ public: protected: plLocation ICreateLocation(const char* age, const char* page, hsBool itinerant); - plLocation ICreateLocation(const char* age, const char* page, Int32 seqNum, hsBool itinerant); + plLocation ICreateLocation(const char* age, const char* page, int32_t seqNum, hsBool itinerant); - plRegistryPageNode* INameToPage(const char* age, const char* page, Int32 sequenceNumber, hsBool itinerant = false); + plRegistryPageNode* INameToPage(const char* age, const char* page, int32_t sequenceNumber, hsBool itinerant = false); - void IPreLoadTextures(plRegistryPageNode* pageNode, Int32 origSeqNumber); + void IPreLoadTextures(plRegistryPageNode* pageNode, int32_t origSeqNumber); void IShutdown(); diff --git a/Sources/Tools/MaxMain/plPythonMgr.cpp b/Sources/Tools/MaxMain/plPythonMgr.cpp index cc80cff3..73fbd78f 100644 --- a/Sources/Tools/MaxMain/plPythonMgr.cpp +++ b/Sources/Tools/MaxMain/plPythonMgr.cpp @@ -49,7 +49,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "plgDispatch.h" #include "pfPython/cyPythonInterface.h" -#include "hsUtils.h" + plPythonMgr::plPythonMgr() { @@ -129,7 +129,7 @@ bool ICallStrFunc(PyObject *dict, char *funcName, char*& val) #include "MaxComponent/plPythonFileComponent.h" -#include "hsUtils.h" + enum ParamTypes { @@ -288,7 +288,7 @@ bool plPythonMgr::IQueryPythonFile(char *fileName) if (PyCallable_Check(getParamFunc)) { - plAutoUIBlock *autoUI = TRACKED_NEW plAutoUIBlock(PythonFile::GetClassDesc(), blockID, className, version); + plAutoUIBlock *autoUI = new plAutoUIBlock(PythonFile::GetClassDesc(), blockID, className, version); // test to see if it is a multi-modifier type class if (isMulti) autoUI->SetMultiModifierFlag(true); diff --git a/Sources/Tools/MaxMain/plSaveSelected.cpp b/Sources/Tools/MaxMain/plSaveSelected.cpp index c54eaeef..3dcfe93c 100644 --- a/Sources/Tools/MaxMain/plSaveSelected.cpp +++ b/Sources/Tools/MaxMain/plSaveSelected.cpp @@ -99,7 +99,7 @@ void plSaveSelected() { plMaxNode *node = (plMaxNode*)ip->GetSelNode(i); - UInt32 compCount = node->NumAttachedComponents(); + uint32_t compCount = node->NumAttachedComponents(); for (int j = 0; j < compCount; j++) { INode *compNode = node->GetAttachedComponent(j)->GetINode();//Node(j); @@ -128,8 +128,8 @@ void plSaveSelected() if (!IIsNodeInTab(selected, node)) { - UInt32 idx = -1; - for (UInt32 k = 0; k < out.size(); k++) + uint32_t idx = -1; + for (uint32_t k = 0; k < out.size(); k++) { if (out[k].comp == comp) idx = k; @@ -312,12 +312,12 @@ void plMerge() // Actually calculate the size of all the merged component names, because // a static buffer could be too small in large merges - UInt32 size = 0; + uint32_t size = 0; for (i = 0; i < nodeNames.Count(); i++) size += strlen(nodeNames[i]) + 1; // Put all the component names in a list and show it to the user - char *buf = TRACKED_NEW char[size+25]; + char *buf = new char[size+25]; strcpy(buf, "Components Merged:\n\n"); for (i = 0; i < nodeNames.Count(); i++) diff --git a/Sources/Tools/MaxMain/plTextureExportLog.cpp b/Sources/Tools/MaxMain/plTextureExportLog.cpp index 084c06aa..ba143b61 100644 --- a/Sources/Tools/MaxMain/plTextureExportLog.cpp +++ b/Sources/Tools/MaxMain/plTextureExportLog.cpp @@ -49,8 +49,8 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com ////////////////////////////////////////////////////////////////////////////// #include "HeadSpin.h" -#include "hsTypes.h" -#include "hsWindows.h" +#include "HeadSpin.h" + #include "plTextureExportLog.h" #include "plGImage/plCubicEnvironmap.h" #include "plGImage/plMipmap.h" @@ -58,7 +58,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "plPipeline/plRenderTarget.h" #include "plPipeline/plCubicRenderTarget.h" #include "pnKeyedObject/plKey.h" -#include "hsUtils.h" + #include "hsStream.h" @@ -91,9 +91,9 @@ plTextureExportLog::~plTextureExportLog() //// Other Ones ////////////////////////////////////////////////////////////// -void plTextureExportLog::IAddBMapNode( UInt32 rank, plBitmap *bMap ) +void plTextureExportLog::IAddBMapNode( uint32_t rank, plBitmap *bMap ) { - plBMapNode *node = TRACKED_NEW plBMapNode, **nodeHdl; + plBMapNode *node = new plBMapNode, **nodeHdl; node->fBitmap = bMap; @@ -121,9 +121,9 @@ void plTextureExportLog::AddTexture( plBitmap *texture ) void plTextureExportLog::Write( void ) { plBMapNode *node; - hsUNIXStream *stream = TRACKED_NEW hsUNIXStream; + hsUNIXStream *stream = new hsUNIXStream; char str[ 128 ]; - UInt32 size; + uint32_t size; stream->Open( fFileName, "wt" ); @@ -250,7 +250,7 @@ void plTextureExportLog::Write( void ) fFileName = nil; } -void plTextureExportLog::IWriteTabbedString( hsStream *stream, const char *string, Int8 numTabs ) +void plTextureExportLog::IWriteTabbedString( hsStream *stream, const char *string, int8_t numTabs ) { static char tabs[ 64 ]; int i; diff --git a/Sources/Tools/MaxMain/plTextureExportLog.h b/Sources/Tools/MaxMain/plTextureExportLog.h index 9f5e8c2d..796c5ea0 100644 --- a/Sources/Tools/MaxMain/plTextureExportLog.h +++ b/Sources/Tools/MaxMain/plTextureExportLog.h @@ -67,7 +67,7 @@ class plTextureExportLog class plBMapNode { public: - UInt32 fRank; // Sort with biggest first + uint32_t fRank; // Sort with biggest first plBitmap *fBitmap; plBMapNode *fNextNode; }; @@ -75,8 +75,8 @@ class plTextureExportLog plBMapNode *fNodeList; - void IAddBMapNode( UInt32 rank, plBitmap *bMap ); - void IWriteTabbedString( hsStream *stream, const char *string, Int8 numTabs ); + void IAddBMapNode( uint32_t rank, plBitmap *bMap ); + void IWriteTabbedString( hsStream *stream, const char *string, int8_t numTabs ); public: diff --git a/Sources/Tools/MaxMain/plTextureSearch.cpp b/Sources/Tools/MaxMain/plTextureSearch.cpp index 2e1a11fd..ee8d4424 100644 --- a/Sources/Tools/MaxMain/plTextureSearch.cpp +++ b/Sources/Tools/MaxMain/plTextureSearch.cpp @@ -42,7 +42,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "HeadSpin.h" #include "plTextureSearch.h" #include "resource.h" -#include "hsUtils.h" + #define PB2Export __declspec( dllexport ) // Because I don't feel like including all the paramblock crap #include "pbbitmap.h" @@ -239,7 +239,7 @@ void plTextureSearch::IUpdateTextures(plTextureSearch::Update update) if (update == kUpdateSetSize) { int sel = ComboBox_GetCurSel(hCombo); - UInt32 data = ComboBox_GetItemData(hCombo, sel); + uint32_t data = ComboBox_GetItemData(hCombo, sel); sizeX = LOWORD(data); sizeY = HIWORD(data); } diff --git a/Sources/Tools/MaxPlasmaLights/CMakeLists.txt b/Sources/Tools/MaxPlasmaLights/CMakeLists.txt index e2f10feb..62519b06 100644 --- a/Sources/Tools/MaxPlasmaLights/CMakeLists.txt +++ b/Sources/Tools/MaxPlasmaLights/CMakeLists.txt @@ -46,7 +46,6 @@ target_link_libraries(MaxPlasmaLights ${3dsm_LIBRARIES}) # Carbon copy from plClient # TODO: Maybe see if some of these can be removed? target_link_libraries(MaxPlasmaLights CoreLib) -target_link_libraries(MaxPlasmaLights CoreLibExe) target_link_libraries(MaxPlasmaLights pfAnimation) target_link_libraries(MaxPlasmaLights pfAudio) target_link_libraries(MaxPlasmaLights pfCamera) diff --git a/Sources/Tools/MaxPlasmaLights/plRTProjDirLight.cpp b/Sources/Tools/MaxPlasmaLights/plRTProjDirLight.cpp index e23aeb88..0b73c90b 100644 --- a/Sources/Tools/MaxPlasmaLights/plRTProjDirLight.cpp +++ b/Sources/Tools/MaxPlasmaLights/plRTProjDirLight.cpp @@ -178,12 +178,12 @@ plRTProjDirLight::plRTProjDirLight() ObjLightDesc *plRTProjDirLight::CreateLightDesc( INode *n, BOOL forceShadowBuf ) { - return TRACKED_NEW DirLight( n, forceShadowBuf ); + return new DirLight( n, forceShadowBuf ); } RefTargetHandle plRTProjDirLight::Clone( RemapDir &remap ) { - plRTProjDirLight *obj = TRACKED_NEW plRTProjDirLight; + plRTProjDirLight *obj = new plRTProjDirLight; obj->ReplaceReference( kRefDirLight, fLightPB->Clone( remap ) ); BaseClone( this, obj, remap ); @@ -287,7 +287,7 @@ Texmap *plRTProjDirLight::GetProjMap() plLayerTex *layer = (plLayerTex *)fProjPB->GetTexmap( kTexmap, 0 ); if( layer == nil || layer->ClassID() != LAYER_TEX_CLASS_ID ) { - layer = TRACKED_NEW plLayerTex; + layer = new plLayerTex; fProjPB->SetValue( kTexmap, 0, (Texmap *)layer ); IParamBlock2 *bitmapPB = layer->GetParamBlockByID( plLayerTex::kBlkBitmap ); diff --git a/Sources/Tools/MaxPlasmaLights/plRTProjDirLight.h b/Sources/Tools/MaxPlasmaLights/plRTProjDirLight.h index 01d7c7da..52cbd8f3 100644 --- a/Sources/Tools/MaxPlasmaLights/plRTProjDirLight.h +++ b/Sources/Tools/MaxPlasmaLights/plRTProjDirLight.h @@ -122,7 +122,7 @@ class plRTProjDirLight : public plRTLightBase SClass_ID SuperClassID( void ) { return LIGHT_CLASS_ID; } ObjLightDesc *CreateLightDesc( INode *n, BOOL forceShadowBuf = FALSE ); - GenLight *NewLight( int type ) { return TRACKED_NEW plRTProjDirLight(); } + GenLight *NewLight( int type ) { return new plRTProjDirLight(); } RefTargetHandle Clone( RemapDir &remap ); int CanConvertToType( Class_ID obtype ) { return ( obtype == RTPDIR_LIGHT_CLASSID ) ? 1 : 0; } diff --git a/Sources/Tools/MaxPlasmaLights/plRTProjDirLightClassDesc.h b/Sources/Tools/MaxPlasmaLights/plRTProjDirLightClassDesc.h index 2537cece..1aea4a15 100644 --- a/Sources/Tools/MaxPlasmaLights/plRTProjDirLightClassDesc.h +++ b/Sources/Tools/MaxPlasmaLights/plRTProjDirLightClassDesc.h @@ -62,7 +62,7 @@ class plRTProjDirLightDesc : public ClassDesc2 { public: int IsPublic() { return TRUE; } - void* Create(BOOL loading) { return TRACKED_NEW plRTProjDirLight; } + void* Create(BOOL loading) { return new plRTProjDirLight; } const TCHAR* ClassName() { return GetString(IDS_DB_PROJDIR); } SClass_ID SuperClassID() { return LIGHT_CLASS_ID; } Class_ID ClassID() { return RTPDIR_LIGHT_CLASSID; } diff --git a/Sources/Tools/MaxPlasmaLights/plRealTimeLightBase.cpp b/Sources/Tools/MaxPlasmaLights/plRealTimeLightBase.cpp index 1979651c..95fac93f 100644 --- a/Sources/Tools/MaxPlasmaLights/plRealTimeLightBase.cpp +++ b/Sources/Tools/MaxPlasmaLights/plRealTimeLightBase.cpp @@ -447,7 +447,7 @@ TSTR plRTLightBase::SubAnimName(int i) #if 0 RefTargetHandle plRTSpotLight::Clone(RemapDir &remap) { - plRTLightBase *obj = TRACKED_NEW plRTSpotLight; + plRTLightBase *obj = new plRTSpotLight; obj->GetParamBlock2->SetValue(kLightOn, t, fLightPB->GetInt(kLightOn, t)); // obj->fLightPB->SetValue(kLightType, t, fLightPB->GetInt(kLightType, t)); @@ -475,7 +475,7 @@ RefTargetHandle plRTSpotLight::Clone(RemapDir &remap) } obj->ReplaceReference(kRefSpotLight,fLightPB->Clone(remap)); /* - GeneralLight* newob = TRACKED_NEW GeneralLight(type); + GeneralLight* newob = new GeneralLight(type); newob->enable = enable; newob->coneDisplay = coneDisplay; newob->useLight = useLight; @@ -841,7 +841,7 @@ void plRTLightBase::GetLocalBoundBox(TimeValue t, INode *node, ViewExp *vpt, Box RefTargetHandle Clone(RemapDir &remap = NoRemap()) { - plRTLightBase* newOb = TRACKED_NEW plRTLightBase; + plRTLightBase* newOb = new plRTLightBase; newOb->fLightPB->SetValue(kLightOn, 0, this->fLightPB->GetInt(kLightOn, 0)); newOb->fLightPB->SetValue(kLightColor, 0, this->fLightPB->GetValue(kLightColor, 0)); newOb->fLightPB->SetValue(kLightExclude, 0, this->fLightPB->GetValue(kLightExclude, 0)); @@ -927,7 +927,7 @@ RefTargetHandle Clone(RemapDir &remap = NoRemap()) kUseProjectorBool, //Inserted in v1 kProjMapTexButton2, //Inserted in v1 kTargetDist //Inserted in v1 - GeneralLight* newob = TRACKED_NEW GeneralLight(type); + GeneralLight* newob = new GeneralLight(type); newob->enable = enable; newob->coneDisplay = coneDisplay; newob->useLight = useLight; @@ -1673,9 +1673,9 @@ BOOL plRTLightBase::GetConeDisplay(void) void plRTLightBase::SetProjMap(BitmapInfo* pmap) { - //plLayerTex* MyMap = TRACKED_NEW plLayerTex; + //plLayerTex* MyMap = new plLayerTex; if(!fTex) - fTex = TRACKED_NEW plLayerTex; + fTex = new plLayerTex; fTex->SetBitmap(pmap); ReplaceReference(kRefProjMap,fTex); @@ -1979,7 +1979,7 @@ int TSpotCreationManager::proc( createInterface->SelectNode( lgtNode ); // Create target object and node - targObject = TRACKED_NEW TargetObject; + targObject = new TargetObject; assert(targObject); targNode = createInterface->CreateObjectNode( targObject); assert(targNode); diff --git a/Sources/Tools/MaxPlasmaLights/plRealTimeLightBase.h b/Sources/Tools/MaxPlasmaLights/plRealTimeLightBase.h index a1aa749a..d7161242 100644 --- a/Sources/Tools/MaxPlasmaLights/plRealTimeLightBase.h +++ b/Sources/Tools/MaxPlasmaLights/plRealTimeLightBase.h @@ -48,7 +48,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "iparamm2.h" // Our generic headers -#include "hsTypes.h" +#include "HeadSpin.h" #include "MaxPlasmaMtls/Layers/plLayerTex.h" #include "MaxMain/MaxCompat.h" @@ -345,7 +345,7 @@ public: // plug-in mouse creation callback CreateMouseCallBack* GetCreateMouseCallBack(); - RefTargetHandle Clone(RemapDir &remap = DEFAULTREMAP){ plRTLightBase* thisObj = TRACKED_NEW plRTLightBase(); BaseClone(this, thisObj, remap); return thisObj;} + RefTargetHandle Clone(RemapDir &remap = DEFAULTREMAP){ plRTLightBase* thisObj = new plRTLightBase(); BaseClone(this, thisObj, remap); return thisObj;} virtual void BeginEditParams(IObjParam *ip, ULONG flags, Animatable *prev); virtual void EndEditParams(IObjParam *ip, ULONG flags, Animatable *next); diff --git a/Sources/Tools/MaxPlasmaLights/plRealTimeLights.cpp b/Sources/Tools/MaxPlasmaLights/plRealTimeLights.cpp index d2002a30..28552297 100644 --- a/Sources/Tools/MaxPlasmaLights/plRealTimeLights.cpp +++ b/Sources/Tools/MaxPlasmaLights/plRealTimeLights.cpp @@ -433,14 +433,14 @@ plRTOmniLight::plRTOmniLight() ObjLightDesc *plRTOmniLight::CreateLightDesc(INode *n, BOOL forceShadowBuf) { - return TRACKED_NEW OmniLight( n, forceShadowBuf ); + return new OmniLight( n, forceShadowBuf ); } RefTargetHandle plRTOmniLight::Clone(RemapDir &remap) { - plRTOmniLight *obj = TRACKED_NEW plRTOmniLight;//(plRTLightBase*) fClassDesc->Create(false); + plRTOmniLight *obj = new plRTOmniLight;//(plRTLightBase*) fClassDesc->Create(false); obj->ReplaceReference(kRefSpotLight, fLightPB->Clone(remap)); BaseClone(this, obj, remap); @@ -607,14 +607,14 @@ plRTSpotLight::plRTSpotLight() ObjLightDesc *plRTSpotLight::CreateLightDesc(INode *n, BOOL forceShadowBuf) { - return TRACKED_NEW SpotLight( n, forceShadowBuf ); + return new SpotLight( n, forceShadowBuf ); } RefTargetHandle plRTSpotLight::Clone(RemapDir &remap) { - plRTSpotLight *obj = TRACKED_NEW plRTSpotLight;//(plRTLightBase*) fClassDesc->Create(false); + plRTSpotLight *obj = new plRTSpotLight;//(plRTLightBase*) fClassDesc->Create(false); obj->ReplaceReference(kRefSpotLight, fLightPB->Clone(remap)); BaseClone(this, obj, remap); return obj; @@ -813,14 +813,14 @@ plRTDirLight::plRTDirLight() ObjLightDesc *plRTDirLight::CreateLightDesc(INode *n, BOOL forceShadowBuf) { - return TRACKED_NEW DirLight( n, forceShadowBuf ); + return new DirLight( n, forceShadowBuf ); } RefTargetHandle plRTDirLight::Clone(RemapDir &remap) { - plRTDirLight *obj = TRACKED_NEW plRTDirLight;//(plRTLightBase*) fClassDesc->Create(false); + plRTDirLight *obj = new plRTDirLight;//(plRTLightBase*) fClassDesc->Create(false); obj->ReplaceReference(kRefDirLight, fLightPB->Clone(remap)); BaseClone(this, obj, remap); return obj; diff --git a/Sources/Tools/MaxPlasmaLights/plRealTimeLights.h b/Sources/Tools/MaxPlasmaLights/plRealTimeLights.h index 40ad916a..ad56eb24 100644 --- a/Sources/Tools/MaxPlasmaLights/plRealTimeLights.h +++ b/Sources/Tools/MaxPlasmaLights/plRealTimeLights.h @@ -76,7 +76,7 @@ class plRTOmniLight : public plRTLightBase plRTOmniLight(); ObjLightDesc *CreateLightDesc(INode *n, BOOL forceShadowBuf= FALSE); - GenLight* NewLight(int type) {return TRACKED_NEW plRTOmniLight();} + GenLight* NewLight(int type) {return new plRTOmniLight();} RefTargetHandle Clone(RemapDir &remap); virtual void InitNodeName( TSTR &s ) { s = _T( "RTOmniLight" ); } @@ -95,7 +95,7 @@ class plRTOmniLightDesc : public ClassDesc2 { public: int IsPublic() { return TRUE; } - void* Create(BOOL loading) { return TRACKED_NEW plRTOmniLight; } + void* Create(BOOL loading) { return new plRTOmniLight; } const TCHAR* ClassName() { return GetString(IDS_DB_OMNI); } SClass_ID SuperClassID() { return LIGHT_CLASS_ID; } Class_ID ClassID() { return RTOMNI_LIGHT_CLASSID; } @@ -127,7 +127,7 @@ class plRTSpotLight : public plRTLightBase int CanConvertToType(Class_ID obtype) { return (obtype == RTSPOT_LIGHT_CLASSID ) ? 1 : 0; } ObjLightDesc *CreateLightDesc(INode *n, BOOL forceShadowBuf= FALSE); - GenLight* NewLight(int type) {return TRACKED_NEW plRTSpotLight();} + GenLight* NewLight(int type) {return new plRTSpotLight();} RefTargetHandle Clone(RemapDir &remap); virtual Texmap *GetProjMap(); @@ -150,7 +150,7 @@ class plRTSpotLightDesc : public ClassDesc2 { public: int IsPublic() { return TRUE; } - void* Create(BOOL loading = FALSE) { return TRACKED_NEW plRTSpotLight; } + void* Create(BOOL loading = FALSE) { return new plRTSpotLight; } const TCHAR* ClassName() { return GetString(IDS_DB_FREE_SPOT); } SClass_ID SuperClassID() { return LIGHT_CLASS_ID; } Class_ID ClassID() { return RTSPOT_LIGHT_CLASSID; } @@ -179,7 +179,7 @@ class plRTDirLight : public plRTLightBase SClass_ID SuperClassID() { return LIGHT_CLASS_ID; } ObjLightDesc *CreateLightDesc(INode *n, BOOL forceShadowBuf= FALSE); - GenLight* NewLight(int type) {return TRACKED_NEW plRTDirLight();} + GenLight* NewLight(int type) {return new plRTDirLight();} RefTargetHandle Clone(RemapDir &remap); int CanConvertToType(Class_ID obtype) { return (obtype == RTDIR_LIGHT_CLASSID ) ? 1 : 0; } @@ -201,7 +201,7 @@ class plRTDirLightDesc : public ClassDesc2 { public: int IsPublic() { return TRUE; } - void* Create(BOOL loading) { return TRACKED_NEW plRTDirLight; } + void* Create(BOOL loading) { return new plRTDirLight; } const TCHAR* ClassName() { return GetString(IDS_DB_DIRECTIONAL); } SClass_ID SuperClassID() { return LIGHT_CLASS_ID; } Class_ID ClassID() { return RTDIR_LIGHT_CLASSID; } diff --git a/Sources/Tools/MaxPlasmaMtls/Layers/plAngleAttenLayer.cpp b/Sources/Tools/MaxPlasmaMtls/Layers/plAngleAttenLayer.cpp index b8945a85..45d1b29b 100644 --- a/Sources/Tools/MaxPlasmaMtls/Layers/plAngleAttenLayer.cpp +++ b/Sources/Tools/MaxPlasmaMtls/Layers/plAngleAttenLayer.cpp @@ -39,7 +39,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com Mead, WA 99021 *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "plAngleAttenLayer.h" #include "iparamb2.h" @@ -53,7 +53,7 @@ class plAngleAttenLayerClassDesc : public ClassDesc2 { public: int IsPublic() { return TRUE; } - void* Create(BOOL loading = FALSE) { return TRACKED_NEW plAngleAttenLayer(); } + void* Create(BOOL loading = FALSE) { return new plAngleAttenLayer(); } const TCHAR* ClassName() { return GetString(IDS_ANGLE_ATTEN_LAYER); } SClass_ID SuperClassID() { return TEXMAP_CLASS_ID; } Class_ID ClassID() { return ANGLE_ATTEN_LAYER_CLASS_ID; } @@ -239,7 +239,7 @@ IParamBlock2* plAngleAttenLayer::GetParamBlockByID(BlockID id) //From ReferenceTarget RefTargetHandle plAngleAttenLayer::Clone(RemapDir &remap) { - plAngleAttenLayer *mnew = TRACKED_NEW plAngleAttenLayer(); + plAngleAttenLayer *mnew = new plAngleAttenLayer(); *((MtlBase*)mnew) = *((MtlBase*)this); // copy superclass stuff mnew->ReplaceReference(kRefAngles, remap.CloneRef(fParmsPB)); BaseClone(this, mnew, remap); diff --git a/Sources/Tools/MaxPlasmaMtls/Layers/plDynamicEnvLayer.cpp b/Sources/Tools/MaxPlasmaMtls/Layers/plDynamicEnvLayer.cpp index 823153e0..11527815 100644 --- a/Sources/Tools/MaxPlasmaMtls/Layers/plDynamicEnvLayer.cpp +++ b/Sources/Tools/MaxPlasmaMtls/Layers/plDynamicEnvLayer.cpp @@ -50,7 +50,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // // /////////////////////////////////////////////////////////////////////////////// -#include "hsTypes.h" +#include "HeadSpin.h" #include "plDynamicEnvLayer.h" #include "iparamb2.h" @@ -72,7 +72,7 @@ class plDynamicEnvLayerClassDesc : public ClassDesc2 { public: int IsPublic() { return TRUE; } - void* Create(BOOL loading = FALSE) { return TRACKED_NEW plDynamicEnvLayer(); } + void* Create(BOOL loading = FALSE) { return new plDynamicEnvLayer(); } const TCHAR* ClassName() { return GetString(IDS_DYNAMIC_ENVMAP_LAYER); } SClass_ID SuperClassID() { return TEXMAP_CLASS_ID; } Class_ID ClassID() { return DYNAMIC_ENV_LAYER_CLASS_ID; } @@ -226,7 +226,7 @@ IParamBlock2 *plDynamicEnvLayer::GetParamBlockByID( BlockID id ) RefTargetHandle plDynamicEnvLayer::Clone( RemapDir &remap ) { - plDynamicEnvLayer *mnew = TRACKED_NEW plDynamicEnvLayer(); + plDynamicEnvLayer *mnew = new plDynamicEnvLayer(); *((MtlBase*)mnew) = *((MtlBase*)this); // copy superclass stuff mnew->ReplaceReference(kRefBitmap, remap.CloneRef(fBitmapPB)); mnew->ReplaceReference(kRefUVGen, remap.CloneRef(fUVGen)); diff --git a/Sources/Tools/MaxPlasmaMtls/Layers/plDynamicTextLayer.cpp b/Sources/Tools/MaxPlasmaMtls/Layers/plDynamicTextLayer.cpp index f3716ba6..6202c42b 100644 --- a/Sources/Tools/MaxPlasmaMtls/Layers/plDynamicTextLayer.cpp +++ b/Sources/Tools/MaxPlasmaMtls/Layers/plDynamicTextLayer.cpp @@ -39,7 +39,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com Mead, WA 99021 *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "plDynamicTextLayer.h" #include "iparamb2.h" @@ -53,7 +53,7 @@ class plDynamicTextLayerClassDesc : public ClassDesc2 { public: int IsPublic() { return TRUE; } - void* Create(BOOL loading = FALSE) { return TRACKED_NEW plDynamicTextLayer(); } + void* Create(BOOL loading = FALSE) { return new plDynamicTextLayer(); } const TCHAR* ClassName() { return GetString(IDS_DYN_TEXT_LAYER); } SClass_ID SuperClassID() { return TEXMAP_CLASS_ID; } Class_ID ClassID() { return DYN_TEXT_LAYER_CLASS_ID; } @@ -216,7 +216,7 @@ IParamBlock2* plDynamicTextLayer::GetParamBlockByID(BlockID id) //From ReferenceTarget RefTargetHandle plDynamicTextLayer::Clone(RemapDir &remap) { - plDynamicTextLayer *mnew = TRACKED_NEW plDynamicTextLayer(); + plDynamicTextLayer *mnew = new plDynamicTextLayer(); *((MtlBase*)mnew) = *((MtlBase*)this); // copy superclass stuff mnew->ReplaceReference(kRefBitmap, remap.CloneRef(fBitmapPB)); mnew->ReplaceReference(kRefUVGen, remap.CloneRef(fUVGen)); diff --git a/Sources/Tools/MaxPlasmaMtls/Layers/plDynamicTextLayerBitmapPB.cpp b/Sources/Tools/MaxPlasmaMtls/Layers/plDynamicTextLayerBitmapPB.cpp index bd35256a..65d7e5a4 100644 --- a/Sources/Tools/MaxPlasmaMtls/Layers/plDynamicTextLayerBitmapPB.cpp +++ b/Sources/Tools/MaxPlasmaMtls/Layers/plDynamicTextLayerBitmapPB.cpp @@ -39,7 +39,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com Mead, WA 99021 *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "plDynamicTextLayer.h" #include "iparamb2.h" diff --git a/Sources/Tools/MaxPlasmaMtls/Layers/plLayerTex.cpp b/Sources/Tools/MaxPlasmaMtls/Layers/plLayerTex.cpp index cd8ea48b..0bfb47b5 100644 --- a/Sources/Tools/MaxPlasmaMtls/Layers/plLayerTex.cpp +++ b/Sources/Tools/MaxPlasmaMtls/Layers/plLayerTex.cpp @@ -39,7 +39,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com Mead, WA 99021 *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "plLayerTex.h" #include "iparamb2.h" @@ -55,7 +55,7 @@ class plLayerTexClassDesc : public ClassDesc2 { public: int IsPublic() { return TRUE; } - void* Create(BOOL loading = FALSE) { return TRACKED_NEW plLayerTex(); } + void* Create(BOOL loading = FALSE) { return new plLayerTex(); } const TCHAR* ClassName() { return GetString(IDS_LAYER); } SClass_ID SuperClassID() { return TEXMAP_CLASS_ID; } Class_ID ClassID() { return LAYER_TEX_CLASS_ID; } @@ -244,7 +244,7 @@ IParamBlock2* plLayerTex::GetParamBlockByID(BlockID id) //From ReferenceTarget RefTargetHandle plLayerTex::Clone(RemapDir &remap) { - plLayerTex *mnew = TRACKED_NEW plLayerTex(); + plLayerTex *mnew = new plLayerTex(); *((MtlBase*)mnew) = *((MtlBase*)this); // copy superclass stuff mnew->ReplaceReference(kRefBitmap, remap.CloneRef(fBitmapPB)); mnew->ReplaceReference(kRefUVGen, remap.CloneRef(fUVGen)); diff --git a/Sources/Tools/MaxPlasmaMtls/Layers/plLayerTexBitmapPB.cpp b/Sources/Tools/MaxPlasmaMtls/Layers/plLayerTexBitmapPB.cpp index 6c0ea041..3209f0e7 100644 --- a/Sources/Tools/MaxPlasmaMtls/Layers/plLayerTexBitmapPB.cpp +++ b/Sources/Tools/MaxPlasmaMtls/Layers/plLayerTexBitmapPB.cpp @@ -39,7 +39,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com Mead, WA 99021 *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "plLayerTex.h" #include "plLayerTexBitmapPB.h" #include "../plDetailCurveCtrl.h" @@ -135,7 +135,7 @@ public: GetClientRect( basis, &r ); MapWindowPoints( basis, dlg, (POINT *)&r, 2 ); - ctrl = TRACKED_NEW plDetailCurveCtrl( dlg, IDC_DETAIL_CURVE_CTRL, &r ); + ctrl = new plDetailCurveCtrl( dlg, IDC_DETAIL_CURVE_CTRL, &r ); } EnableWindow( GetDlgItem( dlg, IDC_DETAIL_CURVE_CTRL ), (BOOL)pblock->GetInt( kBmpUseDetail, t ) ); @@ -217,7 +217,7 @@ public: if (!pbbm->bm) pbbm->bm = TheManager->Load(&pbbm->bi); - BMCropper *cropper = TRACKED_NEW BMCropper(pblock); + BMCropper *cropper = new BMCropper(pblock); pbbm->bm->Display("Specify Cropping/Placement", BMM_CN, FALSE, TRUE, cropper); } diff --git a/Sources/Tools/MaxPlasmaMtls/Layers/plMAXCameraLayer.cpp b/Sources/Tools/MaxPlasmaMtls/Layers/plMAXCameraLayer.cpp index e985a697..4ce8390d 100644 --- a/Sources/Tools/MaxPlasmaMtls/Layers/plMAXCameraLayer.cpp +++ b/Sources/Tools/MaxPlasmaMtls/Layers/plMAXCameraLayer.cpp @@ -54,7 +54,7 @@ class plMAXCameraLayerClassDesc : public ClassDesc2 { public: int IsPublic() { return TRUE; } - void* Create(BOOL loading = FALSE) { return TRACKED_NEW plMAXCameraLayer(); } + void* Create(BOOL loading = FALSE) { return new plMAXCameraLayer(); } const TCHAR* ClassName() { return GetString(IDS_MAX_CAMERA_LAYER); } SClass_ID SuperClassID() { return TEXMAP_CLASS_ID; } Class_ID ClassID() { return MAX_CAMERA_LAYER_CLASS_ID; } @@ -170,7 +170,7 @@ static ParamBlockDesc2 gMAXCameraLayerParamBlk ///////////////////////////////////////////////////////////////////////////// const char *plMAXCameraLayer::kUVStrings[] = { "1", "2", "3", "4", "5", "6", "7", "8" }; -const UInt8 plMAXCameraLayer::kMaxUVSrc = 8; +const uint8_t plMAXCameraLayer::kMaxUVSrc = 8; plMAXCameraLayer::plMAXCameraLayer() : fParmsPB(NULL), @@ -272,7 +272,7 @@ IParamBlock2* plMAXCameraLayer::GetParamBlockByID(BlockID id) //From ReferenceTarget RefTargetHandle plMAXCameraLayer::Clone(RemapDir &remap) { - plMAXCameraLayer *mnew = TRACKED_NEW plMAXCameraLayer(); + plMAXCameraLayer *mnew = new plMAXCameraLayer(); *((MtlBase*)mnew) = *((MtlBase*)this); // copy superclass stuff mnew->ReplaceReference(kRefMain, remap.CloneRef(fParmsPB)); BaseClone(this, mnew, remap); diff --git a/Sources/Tools/MaxPlasmaMtls/Layers/plMAXCameraLayer.h b/Sources/Tools/MaxPlasmaMtls/Layers/plMAXCameraLayer.h index 0e4e40aa..710d2dae 100644 --- a/Sources/Tools/MaxPlasmaMtls/Layers/plMAXCameraLayer.h +++ b/Sources/Tools/MaxPlasmaMtls/Layers/plMAXCameraLayer.h @@ -146,7 +146,7 @@ public: }; static const char *kUVStrings[]; - static const UInt8 kMaxUVSrc; + static const uint8_t kMaxUVSrc; // Pure virtual accessors for the various bitmap related elements virtual Bitmap *GetMaxBitmap(int index = 0) { hsAssert(false, "Function call not valid on this type of layer."); return nil; } diff --git a/Sources/Tools/MaxPlasmaMtls/Layers/plPlasmaMAXLayer.cpp b/Sources/Tools/MaxPlasmaMtls/Layers/plPlasmaMAXLayer.cpp index f287f825..a60b771c 100644 --- a/Sources/Tools/MaxPlasmaMtls/Layers/plPlasmaMAXLayer.cpp +++ b/Sources/Tools/MaxPlasmaMtls/Layers/plPlasmaMAXLayer.cpp @@ -53,7 +53,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // // /////////////////////////////////////////////////////////////////////////////// -#include "hsTypes.h" +#include "HeadSpin.h" #include "plPlasmaMAXLayer.h" #include "stdmat.h" @@ -65,7 +65,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "../../AssetMan/PublicInterface/MaxAssInterface.h" #endif -#include "hsUtils.h" + #include "pnKeyedObject/hsKeyedObject.h" #include "pnMessage/plRefMsg.h" #include "plSurface/plLayerInterface.h" @@ -133,7 +133,7 @@ plPlasmaMAXLayer *plPlasmaMAXLayer::GetPlasmaMAXLayer( Texmap *map ) class plLayerTargetContainer : public hsKeyedObject { - static UInt32 fKeyCount; + static uint32_t fKeyCount; public: hsTArray fLayers; @@ -162,7 +162,7 @@ class plLayerTargetContainer : public hsKeyedObject } }; -UInt32 plLayerTargetContainer::fKeyCount = 0; +uint32_t plLayerTargetContainer::fKeyCount = 0; void plPlasmaMAXLayer::IAddConversionTarget( plLayerInterface *target ) @@ -170,7 +170,7 @@ void plPlasmaMAXLayer::IAddConversionTarget( plLayerInterface *target ) if( fConversionTargets == nil ) { // Create us a new container - fConversionTargets = TRACKED_NEW plLayerTargetContainer; + fConversionTargets = new plLayerTargetContainer; fConversionTargets->GetKey()->RefObject(); } diff --git a/Sources/Tools/MaxPlasmaMtls/Layers/plPlasmaMAXLayer.h b/Sources/Tools/MaxPlasmaMtls/Layers/plPlasmaMAXLayer.h index e97d3863..f2f354ad 100644 --- a/Sources/Tools/MaxPlasmaMtls/Layers/plPlasmaMAXLayer.h +++ b/Sources/Tools/MaxPlasmaMtls/Layers/plPlasmaMAXLayer.h @@ -64,7 +64,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "Max.h" #include "iparamm2.h" -#include "hsTypes.h" +#include "HeadSpin.h" //// Derived Type Class IDs /////////////////////////////////////////////////// // If you create a new Plasma layer type, add a define for the class ID here diff --git a/Sources/Tools/MaxPlasmaMtls/Layers/plStaticEnvLayer.cpp b/Sources/Tools/MaxPlasmaMtls/Layers/plStaticEnvLayer.cpp index 23189a06..b61ec6a5 100644 --- a/Sources/Tools/MaxPlasmaMtls/Layers/plStaticEnvLayer.cpp +++ b/Sources/Tools/MaxPlasmaMtls/Layers/plStaticEnvLayer.cpp @@ -39,7 +39,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com Mead, WA 99021 *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "plStaticEnvLayer.h" #include "iparamb2.h" @@ -53,7 +53,7 @@ class plStaticEnvLayerClassDesc : public ClassDesc2 { public: int IsPublic() { return TRUE; } - void* Create(BOOL loading = FALSE) { return TRACKED_NEW plStaticEnvLayer(); } + void* Create(BOOL loading = FALSE) { return new plStaticEnvLayer(); } const TCHAR* ClassName() { return GetString(IDS_STATIC_ENVMAP_LAYER); } SClass_ID SuperClassID() { return TEXMAP_CLASS_ID; } Class_ID ClassID() { return STATIC_ENV_LAYER_CLASS_ID; } @@ -223,7 +223,7 @@ IParamBlock2* plStaticEnvLayer::GetParamBlockByID(BlockID id) //From ReferenceTarget RefTargetHandle plStaticEnvLayer::Clone(RemapDir &remap) { - plStaticEnvLayer *mnew = TRACKED_NEW plStaticEnvLayer(); + plStaticEnvLayer *mnew = new plStaticEnvLayer(); *((MtlBase*)mnew) = *((MtlBase*)this); // copy superclass stuff mnew->ReplaceReference(kRefBitmap, remap.CloneRef(fBitmapPB)); mnew->ReplaceReference(kRefUVGen, remap.CloneRef(fUVGen)); diff --git a/Sources/Tools/MaxPlasmaMtls/Layers/plStaticEnvLayerBitmapPB.cpp b/Sources/Tools/MaxPlasmaMtls/Layers/plStaticEnvLayerBitmapPB.cpp index 276a012c..1ad8056e 100644 --- a/Sources/Tools/MaxPlasmaMtls/Layers/plStaticEnvLayerBitmapPB.cpp +++ b/Sources/Tools/MaxPlasmaMtls/Layers/plStaticEnvLayerBitmapPB.cpp @@ -39,7 +39,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com Mead, WA 99021 *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "plStaticEnvLayer.h" diff --git a/Sources/Tools/MaxPlasmaMtls/Materials/plAnimStealthConvert.cpp b/Sources/Tools/MaxPlasmaMtls/Materials/plAnimStealthConvert.cpp index f58d0292..417284a9 100644 --- a/Sources/Tools/MaxPlasmaMtls/Materials/plAnimStealthConvert.cpp +++ b/Sources/Tools/MaxPlasmaMtls/Materials/plAnimStealthConvert.cpp @@ -45,7 +45,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // // ////////////////////////////////////////////////////////////////////////////// -#include "hsTypes.h" +#include "HeadSpin.h" #include "plAnimStealthNode.h" #include "plPassMtlBase.h" #include "../resource.h" @@ -144,7 +144,7 @@ SegmentSpec *plAnimStealthNode::IGetSegmentSpec( void ) const } -hsScalar plAnimStealthNode::GetSegStart( void ) const +float plAnimStealthNode::GetSegStart( void ) const { SegmentSpec *spec = IGetSegmentSpec(); if( spec != nil ) @@ -153,7 +153,7 @@ hsScalar plAnimStealthNode::GetSegStart( void ) const return 0.f; } -hsScalar plAnimStealthNode::GetSegEnd( void ) const +float plAnimStealthNode::GetSegEnd( void ) const { SegmentSpec *spec = IGetSegmentSpec(); if( spec != nil ) @@ -162,7 +162,7 @@ hsScalar plAnimStealthNode::GetSegEnd( void ) const return 0.f; } -void plAnimStealthNode::GetLoopPoints( hsScalar &start, hsScalar &end ) const +void plAnimStealthNode::GetLoopPoints( float &start, float &end ) const { start = GetSegStart(); end = GetSegEnd(); @@ -172,7 +172,7 @@ void plAnimStealthNode::GetLoopPoints( hsScalar &start, hsScalar &end ) const GetSegMapAnimTime( loopName, fCachedSegMap, SegmentSpec::kLoop, start, end ); } -void plAnimStealthNode::GetAllStopPoints( hsTArray &out ) +void plAnimStealthNode::GetAllStopPoints( hsTArray &out ) { if( fCachedSegMap == nil ) return; @@ -191,7 +191,7 @@ void plAnimStealthNode::GetAllStopPoints( hsTArray &out ) // Handles converting all the settings we have that are applicable for an // animTimeConvert and stuffing it into said ATC. -void plAnimStealthNode::StuffToTimeConvert( plAnimTimeConvert &convert, hsScalar maxLength ) +void plAnimStealthNode::StuffToTimeConvert( plAnimTimeConvert &convert, float maxLength ) { const char *segName = GetSegmentName(); bool isEntire = ( segName == nil || strcmp( segName, ENTIRE_ANIMATION_NAME ) == 0 ) ? true : false; @@ -214,7 +214,7 @@ void plAnimStealthNode::StuffToTimeConvert( plAnimTimeConvert &convert, hsSca convert.SetLoopPoints( 0, maxLength ); else { - hsScalar loopStart, loopEnd; + float loopStart, loopEnd; GetLoopPoints( loopStart, loopEnd ); convert.SetLoopPoints( loopStart, loopEnd ); } diff --git a/Sources/Tools/MaxPlasmaMtls/Materials/plAnimStealthNode.cpp b/Sources/Tools/MaxPlasmaMtls/Materials/plAnimStealthNode.cpp index d7399bb3..db647932 100644 --- a/Sources/Tools/MaxPlasmaMtls/Materials/plAnimStealthNode.cpp +++ b/Sources/Tools/MaxPlasmaMtls/Materials/plAnimStealthNode.cpp @@ -48,7 +48,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // // ////////////////////////////////////////////////////////////////////////////// -#include "hsTypes.h" +#include "HeadSpin.h" #include "plAnimStealthNode.h" #include "plPassMtlBase.h" #include "../resource.h" @@ -69,7 +69,7 @@ class plStealthClassDesc : public ClassDesc2 { public: int IsPublic() { return FALSE; } - void* Create(BOOL loading) { return TRACKED_NEW plAnimStealthNode(loading); } + void* Create(BOOL loading) { return new plAnimStealthNode(loading); } const TCHAR* ClassName() { return GetString( IDS_STEALTH_NAME ); } SClass_ID SuperClassID() { return HELPER_CLASS_ID; } Class_ID ClassID() { return ANIMSTEALTH_CLASSID; } @@ -903,11 +903,11 @@ void plAnimStealthNode::SetLoop( bool b, const char *name ) fParamBlock->SetValue( (ParamID)kPBLoopName, 0, (char *)name ); } -UInt8 plAnimStealthNode::GetEaseInType( void ) const { return (UInt8)fParamBlock->GetInt( (ParamID)kPBEaseInType ); } -hsScalar plAnimStealthNode::GetEaseInLength( void ) const { return (hsScalar)fParamBlock->GetFloat( (ParamID)kPBEaseInLength ); } -hsScalar plAnimStealthNode::GetEaseInMin( void ) const { return (hsScalar)fParamBlock->GetFloat( (ParamID)kPBEaseInMin ); } -hsScalar plAnimStealthNode::GetEaseInMax( void ) const { return (hsScalar)fParamBlock->GetFloat( (ParamID)kPBEaseInMax ); } -void plAnimStealthNode::SetEaseIn( UInt8 type, hsScalar length, hsScalar min, hsScalar max ) +uint8_t plAnimStealthNode::GetEaseInType( void ) const { return (uint8_t)fParamBlock->GetInt( (ParamID)kPBEaseInType ); } +float plAnimStealthNode::GetEaseInLength( void ) const { return (float)fParamBlock->GetFloat( (ParamID)kPBEaseInLength ); } +float plAnimStealthNode::GetEaseInMin( void ) const { return (float)fParamBlock->GetFloat( (ParamID)kPBEaseInMin ); } +float plAnimStealthNode::GetEaseInMax( void ) const { return (float)fParamBlock->GetFloat( (ParamID)kPBEaseInMax ); } +void plAnimStealthNode::SetEaseIn( uint8_t type, float length, float min, float max ) { fParamBlock->SetValue( (ParamID)kPBEaseInType, 0, (int)type ); fParamBlock->SetValue( (ParamID)kPBEaseInLength, 0, (float)length ); @@ -915,11 +915,11 @@ void plAnimStealthNode::SetEaseIn( UInt8 type, hsScalar length, hsScalar fParamBlock->SetValue( (ParamID)kPBEaseInMax, 0, (float)max ); } -UInt8 plAnimStealthNode::GetEaseOutType( void ) const { return (UInt8)fParamBlock->GetInt( (ParamID)kPBEaseOutType ); } -hsScalar plAnimStealthNode::GetEaseOutLength( void ) const { return (hsScalar)fParamBlock->GetFloat( (ParamID)kPBEaseOutLength ); } -hsScalar plAnimStealthNode::GetEaseOutMin( void ) const { return (hsScalar)fParamBlock->GetFloat( (ParamID)kPBEaseOutMin ); } -hsScalar plAnimStealthNode::GetEaseOutMax( void ) const { return (hsScalar)fParamBlock->GetFloat( (ParamID)kPBEaseOutMax ); } -void plAnimStealthNode::SetEaseOut( UInt8 type, hsScalar length, hsScalar min, hsScalar max ) +uint8_t plAnimStealthNode::GetEaseOutType( void ) const { return (uint8_t)fParamBlock->GetInt( (ParamID)kPBEaseOutType ); } +float plAnimStealthNode::GetEaseOutLength( void ) const { return (float)fParamBlock->GetFloat( (ParamID)kPBEaseOutLength ); } +float plAnimStealthNode::GetEaseOutMin( void ) const { return (float)fParamBlock->GetFloat( (ParamID)kPBEaseOutMin ); } +float plAnimStealthNode::GetEaseOutMax( void ) const { return (float)fParamBlock->GetFloat( (ParamID)kPBEaseOutMax ); } +void plAnimStealthNode::SetEaseOut( uint8_t type, float length, float min, float max ) { fParamBlock->SetValue( (ParamID)kPBEaseOutType, 0, (int)type ); fParamBlock->SetValue( (ParamID)kPBEaseOutLength, 0, (float)length ); diff --git a/Sources/Tools/MaxPlasmaMtls/Materials/plAnimStealthNode.h b/Sources/Tools/MaxPlasmaMtls/Materials/plAnimStealthNode.h index d34820ca..f6356746 100644 --- a/Sources/Tools/MaxPlasmaMtls/Materials/plAnimStealthNode.h +++ b/Sources/Tools/MaxPlasmaMtls/Materials/plAnimStealthNode.h @@ -55,7 +55,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "iparamb2.h" #include "iparamm2.h" -#include "hsTypes.h" +#include "HeadSpin.h" #include "pnKeyedObject/plKey.h" #include "MaxComponent/plAnimObjInterface.h" #include "MaxComponent/plMaxAnimUtils.h" @@ -206,24 +206,24 @@ public: const char *GetLoopName( void ) const; void SetLoop( bool b, const char *name ); - UInt8 GetEaseInType( void ) const; - hsScalar GetEaseInLength( void ) const; - hsScalar GetEaseInMin( void ) const; - hsScalar GetEaseInMax( void ) const; - void SetEaseIn( UInt8 type, hsScalar length, hsScalar min, hsScalar max ); + uint8_t GetEaseInType( void ) const; + float GetEaseInLength( void ) const; + float GetEaseInMin( void ) const; + float GetEaseInMax( void ) const; + void SetEaseIn( uint8_t type, float length, float min, float max ); - UInt8 GetEaseOutType( void ) const; - hsScalar GetEaseOutLength( void ) const; - hsScalar GetEaseOutMin( void ) const; - hsScalar GetEaseOutMax( void ) const; - void SetEaseOut( UInt8 type, hsScalar length, hsScalar min, hsScalar max ); + uint8_t GetEaseOutType( void ) const; + float GetEaseOutLength( void ) const; + float GetEaseOutMin( void ) const; + float GetEaseOutMax( void ) const; + void SetEaseOut( uint8_t type, float length, float min, float max ); // Conversion stuff - void GetAllStopPoints( hsTArray &out ); - hsScalar GetSegStart( void ) const; - hsScalar GetSegEnd( void ) const; - void GetLoopPoints( hsScalar &start, hsScalar &end ) const; - void StuffToTimeConvert( plAnimTimeConvert &convert, hsScalar maxLength ); + void GetAllStopPoints( hsTArray &out ); + float GetSegStart( void ) const; + float GetSegEnd( void ) const; + void GetLoopPoints( float &start, float &end ) const; + void StuffToTimeConvert( plAnimTimeConvert &convert, float maxLength ); // plAnimObjInterface functions virtual void PickTargetNode( IParamBlock2 *destPB, ParamID destParamID, ParamID typeID ); diff --git a/Sources/Tools/MaxPlasmaMtls/Materials/plBumpMtl.cpp b/Sources/Tools/MaxPlasmaMtls/Materials/plBumpMtl.cpp index 2d9415a9..3b2b7ebb 100644 --- a/Sources/Tools/MaxPlasmaMtls/Materials/plBumpMtl.cpp +++ b/Sources/Tools/MaxPlasmaMtls/Materials/plBumpMtl.cpp @@ -39,7 +39,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com Mead, WA 99021 *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "plBumpMtl.h" #include "../resource.h" //extern ClassDesc2* GetMaxLayerDesc(); @@ -60,7 +60,7 @@ class plBumpMtlClassDesc : public ClassDesc2 { public: int IsPublic() { return TRUE; } - void* Create(BOOL loading) { return TRACKED_NEW plBumpMtl(loading); } + void* Create(BOOL loading) { return new plBumpMtl(loading); } const TCHAR* ClassName() { return GetString(IDS_BUMP_MTL); } SClass_ID SuperClassID() { return MATERIAL_CLASS_ID; } Class_ID ClassID() { return BUMP_MTL_CLASS_ID; } @@ -81,7 +81,7 @@ ParamBlockDesc2 *GetBumpLayersPB(); plBumpMtl::plBumpMtl(BOOL loading) : plPassMtlBase( loading ) { plBumpMtlDesc.MakeAutoParamBlocks( this ); - fBasicPB->SetValue( kBumpBasLayer, 0, TRACKED_NEW plLayerTex ); + fBasicPB->SetValue( kBumpBasLayer, 0, new plLayerTex ); // If we do this later (like, when the dialog loads) something blows up, // somewhere in Max. It didn't in 4, it does in 7. This seems to fix it. @@ -260,7 +260,7 @@ TSTR plBumpMtl::GetSubTexmapTVName(int i) RefTargetHandle plBumpMtl::Clone(RemapDir &remap) { - plBumpMtl *mnew = TRACKED_NEW plBumpMtl(FALSE); + plBumpMtl *mnew = new plBumpMtl(FALSE); plPassMtlBase::ICloneBase( mnew, remap ); return (RefTargetHandle)mnew; } diff --git a/Sources/Tools/MaxPlasmaMtls/Materials/plClothingMtl.cpp b/Sources/Tools/MaxPlasmaMtls/Materials/plClothingMtl.cpp index 3f54816f..74e98f87 100644 --- a/Sources/Tools/MaxPlasmaMtls/Materials/plClothingMtl.cpp +++ b/Sources/Tools/MaxPlasmaMtls/Materials/plClothingMtl.cpp @@ -39,7 +39,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com Mead, WA 99021 *==LICENSE==*/ -#include "hsUtils.h" + #include "plClothingMtl.h" #include "../resource.h" #include "../Shaders.h" @@ -59,7 +59,7 @@ class plClothingMtlClassDesc : public ClassDesc2 { public: int IsPublic() { return TRUE; } - void* Create(BOOL loading) { return TRACKED_NEW plClothingMtl(loading); } + void* Create(BOOL loading) { return new plClothingMtl(loading); } const TCHAR* ClassName() { return GetString(IDS_CLOTHING_MTL); } SClass_ID SuperClassID() { return MATERIAL_CLASS_ID; } Class_ID ClassID() { return CLOTHING_MTL_CLASS_ID; } @@ -108,7 +108,7 @@ const char *plClothingMtl::LayerStrings[] = "Tint 2" }; -const UInt8 plClothingMtl::LayerToPBIdx[] = +const uint8_t plClothingMtl::LayerToPBIdx[] = { kTexmapBase, kTexmapSkin, @@ -130,10 +130,10 @@ plClothingMtl::plClothingMtl(BOOL loading) : fBasicPB(NULL) int i; for (i = 0; i < plClothingMtl::kMaxTiles; i++) { - plLayerTex *tex = TRACKED_NEW plLayerTex; + plLayerTex *tex = new plLayerTex; fBasicPB->SetValue(ParamID(kTexmap), 0, tex, i); } - fBasicPB->SetValue(ParamID(kThumbnail), 0, TRACKED_NEW plLayerTex); + fBasicPB->SetValue(ParamID(kThumbnail), 0, new plLayerTex); } void plClothingMtl::Reset() @@ -352,7 +352,7 @@ IOResult plClothingMtl::Load(ILoad *iload) RefTargetHandle plClothingMtl::Clone(RemapDir &remap) { - plClothingMtl *mnew = TRACKED_NEW plClothingMtl(FALSE); + plClothingMtl *mnew = new plClothingMtl(FALSE); *((MtlBase*)mnew) = *((MtlBase*)this); mnew->ReplaceReference(kRefBasic, remap.CloneRef(fBasicPB)); @@ -573,68 +573,68 @@ void plClothingMtl::InitTilesets() plClothingElement::GetElements(fElements); /* - plClothingTileset *tileset = TRACKED_NEW plClothingTileset(); + plClothingTileset *tileset = new plClothingTileset(); tileset->SetName("shirt"); tileset->AddElement(FindElementByName("shirt-chest")); tileset->AddElement(FindElementByName("shirt-sleeve")); fTilesets[plClothingLayout::kSetShirt] = tileset; - tileset = TRACKED_NEW plClothingTileset(); + tileset = new plClothingTileset(); tileset->SetName("face"); tileset->AddElement(FindElementByName("face")); fTilesets[plClothingLayout::kSetFace] = tileset; - tileset = TRACKED_NEW plClothingTileset(); + tileset = new plClothingTileset(); tileset->SetName("eye"); tileset->AddElement(FindElementByName("eyeball")); fTilesets[plClothingLayout::kSetEye] = tileset; - tileset = TRACKED_NEW plClothingTileset(); + tileset = new plClothingTileset(); tileset->SetName("shoe"); tileset->AddElement(FindElementByName("shoe-top")); tileset->AddElement(FindElementByName("shoe-bottom")); fTilesets[plClothingLayout::kSetShoe] = tileset; - tileset = TRACKED_NEW plClothingTileset(); + tileset = new plClothingTileset(); tileset->SetName("pants"); tileset->AddElement(FindElementByName("pants")); fTilesets[plClothingLayout::kSetPants] = tileset; - tileset = TRACKED_NEW plClothingTileset(); + tileset = new plClothingTileset(); tileset->SetName("hand"); tileset->AddElement(FindElementByName("hand-LOD")); tileset->AddElement(FindElementByName("hand-square")); tileset->AddElement(FindElementByName("hand-wide")); fTilesets[plClothingLayout::kSetHand] = tileset; - tileset = TRACKED_NEW plClothingTileset(); + tileset = new plClothingTileset(); tileset->SetName("playerbook"); tileset->AddElement(FindElementByName("playerbook")); fTilesets[plClothingLayout::kSetPlayerBook] = tileset; - tileset = TRACKED_NEW plClothingTileset(); + tileset = new plClothingTileset(); tileset->SetName("backpack"); tileset->AddElement(FindElementByName("backpack")); fTilesets[plClothingLayout::kSetBackpack] = tileset; - tileset = TRACKED_NEW plClothingTileset(); + tileset = new plClothingTileset(); tileset->SetName("glasses"); tileset->AddElement(FindElementByName("glasses-front")); tileset->AddElement(FindElementByName("glasses-side")); fTilesets[plClothingLayout::kSetGlasses] = tileset; - tileset = TRACKED_NEW plClothingTileset(); + tileset = new plClothingTileset(); tileset->SetName("KI"); tileset->AddElement(FindElementByName("KI")); fTilesets[plClothingLayout::kSetKI] = tileset; */ - plClothingTileset *tileset = TRACKED_NEW plClothingTileset(); + plClothingTileset *tileset = new plClothingTileset(); tileset->SetName("Torso"); tileset->AddElement(FindElementByName("Chest")); tileset->AddElement(FindElementByName("Arm")); fTilesets[plClothingLayout::kSetShirt] = tileset; - tileset = TRACKED_NEW plClothingTileset(); + tileset = new plClothingTileset(); tileset->SetName("Head"); tileset->AddElement(FindElementByName("Eye")); tileset->AddElement(FindElementByName("Extra Hair")); @@ -642,43 +642,43 @@ void plClothingMtl::InitTilesets() tileset->AddElement(FindElementByName("Hat")); fTilesets[plClothingLayout::kSetFace] = tileset; - tileset = TRACKED_NEW plClothingTileset(); + tileset = new plClothingTileset(); tileset->SetName("Foot"); tileset->AddElement(FindElementByName("Foot")); fTilesets[plClothingLayout::kSetShoe] = tileset; - tileset = TRACKED_NEW plClothingTileset(); + tileset = new plClothingTileset(); tileset->SetName("Legs"); tileset->AddElement(FindElementByName("Legs")); fTilesets[plClothingLayout::kSetPants] = tileset; - tileset = TRACKED_NEW plClothingTileset(); + tileset = new plClothingTileset(); tileset->SetName("Hand"); tileset->AddElement(FindElementByName("Finger")); tileset->AddElement(FindElementByName("LOD")); tileset->AddElement(FindElementByName("Palm")); fTilesets[plClothingLayout::kSetHand] = tileset; - tileset = TRACKED_NEW plClothingTileset(); + tileset = new plClothingTileset(); tileset->SetName("Player Book"); tileset->AddElement(FindElementByName("Player Book")); fTilesets[plClothingLayout::kSetPlayerBook] = tileset; - tileset = TRACKED_NEW plClothingTileset(); + tileset = new plClothingTileset(); tileset->SetName("Glasses"); tileset->AddElement(FindElementByName("Glasses")); fTilesets[plClothingLayout::kSetGlasses] = tileset; - tileset = TRACKED_NEW plClothingTileset(); + tileset = new plClothingTileset(); tileset->SetName("KI"); tileset->AddElement(FindElementByName("KI")); fTilesets[plClothingLayout::kSetKI] = tileset; - tileset = TRACKED_NEW plClothingTileset(); + tileset = new plClothingTileset(); tileset->SetName("(unused)"); fTilesets[plClothingLayout::kSetEye] = tileset; - tileset = TRACKED_NEW plClothingTileset(); + tileset = new plClothingTileset(); tileset->SetName("(unused)"); fTilesets[plClothingLayout::kSetBackpack] = tileset; } diff --git a/Sources/Tools/MaxPlasmaMtls/Materials/plClothingMtl.h b/Sources/Tools/MaxPlasmaMtls/Materials/plClothingMtl.h index 15a5abfb..3c8e77b3 100644 --- a/Sources/Tools/MaxPlasmaMtls/Materials/plClothingMtl.h +++ b/Sources/Tools/MaxPlasmaMtls/Materials/plClothingMtl.h @@ -79,7 +79,7 @@ public: IMtlParams *fIMtlParams; static const char *LayerStrings[]; - static const UInt8 LayerToPBIdx[]; + static const uint8_t LayerToPBIdx[]; enum { diff --git a/Sources/Tools/MaxPlasmaMtls/Materials/plClothingMtlPBDec.h b/Sources/Tools/MaxPlasmaMtls/Materials/plClothingMtlPBDec.h index bb412a60..404fbe7a 100644 --- a/Sources/Tools/MaxPlasmaMtls/Materials/plClothingMtlPBDec.h +++ b/Sources/Tools/MaxPlasmaMtls/Materials/plClothingMtlPBDec.h @@ -64,7 +64,7 @@ protected: int len = GetWindowTextLength(hCtrl)+1; if (len > 1) { - char *buf = TRACKED_NEW char[len]; + char *buf = new char[len]; GetWindowText(hCtrl, buf, len); // If the old value is different from the current one, update @@ -176,7 +176,7 @@ public: layer = (plPlasmaMAXLayer *)pb->GetTexmap(ParamID(plClothingMtl::kThumbnail)); if (layer == nil) { - layer = TRACKED_NEW plLayerTex; + layer = new plLayerTex; pb->SetValue(ParamID(plClothingMtl::kThumbnail), 0, layer); } pbbm = layer->GetPBBitmap(); @@ -298,7 +298,7 @@ public: layer = (plPlasmaMAXLayer *)pb->GetTexmap(ParamID(layerIdx), 0, buttonIdx); if (layer == nil) { // First time we've set a layer on this spot - layer = TRACKED_NEW plLayerTex; + layer = new plLayerTex; pb->SetValue(ParamID(layerIdx), 0, layer, buttonIdx); } diff --git a/Sources/Tools/MaxPlasmaMtls/Materials/plCompositeMtl.cpp b/Sources/Tools/MaxPlasmaMtls/Materials/plCompositeMtl.cpp index ac0eeb9d..ec4c2532 100644 --- a/Sources/Tools/MaxPlasmaMtls/Materials/plCompositeMtl.cpp +++ b/Sources/Tools/MaxPlasmaMtls/Materials/plCompositeMtl.cpp @@ -39,7 +39,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com Mead, WA 99021 *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "plCompositeMtl.h" #include "plPassMtl.h" //#include "plCompositeMtlPB.h" @@ -49,7 +49,7 @@ class plCompositeClassDesc : public ClassDesc2 { public: int IsPublic() { return TRUE; } - void* Create(BOOL loading) { return TRACKED_NEW plCompositeMtl(loading); } + void* Create(BOOL loading) { return new plCompositeMtl(loading); } const TCHAR* ClassName() { return GetString(IDS_COMP_MTL); } SClass_ID SuperClassID() { return MATERIAL_CLASS_ID; } Class_ID ClassID() { return COMP_MTL_CLASS_ID; } @@ -84,7 +84,7 @@ plCompositeMtl::plCompositeMtl(BOOL loading) : fPassesPB(NULL) int i; for (i = 0; i < NSUBMTLS; i++) { - plPassMtl *newMtl = TRACKED_NEW plPassMtl(false); + plPassMtl *newMtl = new plPassMtl(false); fPassesPB->SetValue(kCompPasses, 0, newMtl, i); GetCOREInterface()->AssignNewName(fPassesPB->GetMtl(kCompPasses, 0, i)); } @@ -97,7 +97,7 @@ void plCompositeMtl::Reset() ParamDlg* plCompositeMtl::CreateParamDlg(HWND hwMtlEdit, IMtlParams *imp) { - fMtlDlg = TRACKED_NEW plCompositeMtlDlg(hwMtlEdit, imp, this); + fMtlDlg = new plCompositeMtlDlg(hwMtlEdit, imp, this); return fMtlDlg; } @@ -360,7 +360,7 @@ IOResult plCompositeMtl::Load(ILoad *iload) RefTargetHandle plCompositeMtl::Clone(RemapDir &remap) { - plCompositeMtl *mnew = TRACKED_NEW plCompositeMtl(FALSE); + plCompositeMtl *mnew = new plCompositeMtl(FALSE); *((MtlBase*)mnew) = *((MtlBase*)this); mnew->ReplaceReference(kRefPasses, remap.CloneRef(fPassesPB)); @@ -504,7 +504,7 @@ void plCompositeMtl::SetNumSubMtls(int num) for (int i = curNum; i < num; i++) { - plPassMtl *newMtl = TRACKED_NEW plPassMtl(false); + plPassMtl *newMtl = new plPassMtl(false); fPassesPB->SetValue(kMultPasses, t, newMtl, i); fPassesPB->SetValue(kMultOn, t, TRUE, i); GetCOREInterface()->AssignNewName(fPassesPB->GetMtl(kMultPasses, t, i)); diff --git a/Sources/Tools/MaxPlasmaMtls/Materials/plCompositeMtlDlg.cpp b/Sources/Tools/MaxPlasmaMtls/Materials/plCompositeMtlDlg.cpp index 0cae9cfb..78984289 100644 --- a/Sources/Tools/MaxPlasmaMtls/Materials/plCompositeMtlDlg.cpp +++ b/Sources/Tools/MaxPlasmaMtls/Materials/plCompositeMtlDlg.cpp @@ -39,7 +39,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com Mead, WA 99021 *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "max.h" #include "MaxIcon.h" diff --git a/Sources/Tools/MaxPlasmaMtls/Materials/plDecalMtl.cpp b/Sources/Tools/MaxPlasmaMtls/Materials/plDecalMtl.cpp index f0040c5f..49488fa7 100644 --- a/Sources/Tools/MaxPlasmaMtls/Materials/plDecalMtl.cpp +++ b/Sources/Tools/MaxPlasmaMtls/Materials/plDecalMtl.cpp @@ -39,7 +39,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com Mead, WA 99021 *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "plDecalMtl.h" #include "../resource.h" //extern ClassDesc2* GetMaxLayerDesc(); @@ -63,7 +63,7 @@ class plDecalMtlClassDesc : public ClassDesc2 { public: int IsPublic() { return TRUE; } - void* Create(BOOL loading) { return TRACKED_NEW plDecalMtl(loading); } + void* Create(BOOL loading) { return new plDecalMtl(loading); } const TCHAR* ClassName() { return GetString(IDS_DECAL_MTL); } SClass_ID SuperClassID() { return MATERIAL_CLASS_ID; } Class_ID ClassID() { return DECAL_MTL_CLASS_ID; } @@ -87,8 +87,8 @@ ParamBlockDesc2 *GetDecalLayersPB(); plDecalMtl::plDecalMtl(BOOL loading) : plPassMtlBase( loading ) { plDecalMtlDesc.MakeAutoParamBlocks( this ); - fLayersPB->SetValue( kDecalLayBase, 0, TRACKED_NEW plLayerTex ); - fLayersPB->SetValue( kDecalLayTop, 0, TRACKED_NEW plLayerTex ); + fLayersPB->SetValue( kDecalLayBase, 0, new plLayerTex ); + fLayersPB->SetValue( kDecalLayTop, 0, new plLayerTex ); // If we do this later (like, when the dialog loads) something blows up, // somewhere in Max. It didn't in 4, it does in 7. This seems to fix it. @@ -306,7 +306,7 @@ int plDecalMtl::SubTexmapOn(int i) RefTargetHandle plDecalMtl::Clone(RemapDir &remap) { - plDecalMtl *mnew = TRACKED_NEW plDecalMtl(FALSE); + plDecalMtl *mnew = new plDecalMtl(FALSE); plPassMtlBase::ICloneBase( mnew, remap ); return (RefTargetHandle)mnew; } diff --git a/Sources/Tools/MaxPlasmaMtls/Materials/plMultipassMtl.cpp b/Sources/Tools/MaxPlasmaMtls/Materials/plMultipassMtl.cpp index 14a60ea6..3739c6ca 100644 --- a/Sources/Tools/MaxPlasmaMtls/Materials/plMultipassMtl.cpp +++ b/Sources/Tools/MaxPlasmaMtls/Materials/plMultipassMtl.cpp @@ -39,7 +39,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com Mead, WA 99021 *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "plMultipassMtl.h" #include "plPassMtl.h" #include "plMultipassMtlPB.h" @@ -49,7 +49,7 @@ class plMultipassClassDesc : public ClassDesc2 { public: int IsPublic() { return TRUE; } - void* Create(BOOL loading) { return TRACKED_NEW plMultipassMtl(loading); } + void* Create(BOOL loading) { return new plMultipassMtl(loading); } const TCHAR* ClassName() { return GetString(IDS_MULTI_MTL); } SClass_ID SuperClassID() { return MATERIAL_CLASS_ID; } Class_ID ClassID() { return MULTIMTL_CLASS_ID; } @@ -79,7 +79,7 @@ void plMultipassMtl::Reset() ParamDlg* plMultipassMtl::CreateParamDlg(HWND hwMtlEdit, IMtlParams *imp) { - fMtlDlg = TRACKED_NEW plMultipassMtlDlg(hwMtlEdit, imp, this); + fMtlDlg = new plMultipassMtlDlg(hwMtlEdit, imp, this); return fMtlDlg; } @@ -271,7 +271,7 @@ IOResult plMultipassMtl::Load(ILoad *iload) RefTargetHandle plMultipassMtl::Clone(RemapDir &remap) { - plMultipassMtl *mnew = TRACKED_NEW plMultipassMtl(FALSE); + plMultipassMtl *mnew = new plMultipassMtl(FALSE); *((MtlBase*)mnew) = *((MtlBase*)this); mnew->ReplaceReference(kRefPasses, remap.CloneRef(fPassesPB)); @@ -378,7 +378,7 @@ void plMultipassMtl::SetNumSubMtls(int num) for (int i = curNum; i < num; i++) { - plPassMtl *newMtl = TRACKED_NEW plPassMtl(false); + plPassMtl *newMtl = new plPassMtl(false); fPassesPB->SetValue(kMultPasses, t, newMtl, i); fPassesPB->SetValue(kMultOn, t, TRUE, i); GetCOREInterface()->AssignNewName(fPassesPB->GetMtl(kMultPasses, t, i)); diff --git a/Sources/Tools/MaxPlasmaMtls/Materials/plMultipassMtlDlg.cpp b/Sources/Tools/MaxPlasmaMtls/Materials/plMultipassMtlDlg.cpp index 3b0cd400..facc3966 100644 --- a/Sources/Tools/MaxPlasmaMtls/Materials/plMultipassMtlDlg.cpp +++ b/Sources/Tools/MaxPlasmaMtls/Materials/plMultipassMtlDlg.cpp @@ -39,7 +39,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com Mead, WA 99021 *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "max.h" #include "MaxIcon.h" diff --git a/Sources/Tools/MaxPlasmaMtls/Materials/plMultipassMtlPB.cpp b/Sources/Tools/MaxPlasmaMtls/Materials/plMultipassMtlPB.cpp index 0e513ea3..326da7b1 100644 --- a/Sources/Tools/MaxPlasmaMtls/Materials/plMultipassMtlPB.cpp +++ b/Sources/Tools/MaxPlasmaMtls/Materials/plMultipassMtlPB.cpp @@ -39,7 +39,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com Mead, WA 99021 *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "plMultipassMtl.h" #include "plMultipassMtlPB.h" diff --git a/Sources/Tools/MaxPlasmaMtls/Materials/plNoteTrackWatcher.cpp b/Sources/Tools/MaxPlasmaMtls/Materials/plNoteTrackWatcher.cpp index ee6e040b..fdd2c142 100644 --- a/Sources/Tools/MaxPlasmaMtls/Materials/plNoteTrackWatcher.cpp +++ b/Sources/Tools/MaxPlasmaMtls/Materials/plNoteTrackWatcher.cpp @@ -50,7 +50,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // // ////////////////////////////////////////////////////////////////////////////// -#include "hsTypes.h" +#include "HeadSpin.h" #include "plNoteTrackWatcher.h" #include "plPassMtlBase.h" diff --git a/Sources/Tools/MaxPlasmaMtls/Materials/plNoteTrackWatcher.h b/Sources/Tools/MaxPlasmaMtls/Materials/plNoteTrackWatcher.h index 7312c85b..1aec216b 100644 --- a/Sources/Tools/MaxPlasmaMtls/Materials/plNoteTrackWatcher.h +++ b/Sources/Tools/MaxPlasmaMtls/Materials/plNoteTrackWatcher.h @@ -57,7 +57,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "iparamb2.h" #include "iparamm2.h" -#include "hsTypes.h" +#include "HeadSpin.h" extern TCHAR *GetString(int id); extern HINSTANCE hInstance; diff --git a/Sources/Tools/MaxPlasmaMtls/Materials/plParticleMtl.cpp b/Sources/Tools/MaxPlasmaMtls/Materials/plParticleMtl.cpp index fe0f8e2e..0cbe27b9 100644 --- a/Sources/Tools/MaxPlasmaMtls/Materials/plParticleMtl.cpp +++ b/Sources/Tools/MaxPlasmaMtls/Materials/plParticleMtl.cpp @@ -39,7 +39,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com Mead, WA 99021 *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "plParticleMtl.h" #include "../resource.h" //extern ClassDesc2* GetMaxLayerDesc(); @@ -60,7 +60,7 @@ class plParticleMtlClassDesc : public ClassDesc2 { public: int IsPublic() { return TRUE; } - void* Create(BOOL loading) { return TRACKED_NEW plParticleMtl(loading); } + void* Create(BOOL loading) { return new plParticleMtl(loading); } const TCHAR* ClassName() { return GetString(IDS_PARTICLE_MTL); } SClass_ID SuperClassID() { return MATERIAL_CLASS_ID; } Class_ID ClassID() { return PARTICLE_MTL_CLASS_ID; } @@ -102,7 +102,7 @@ plParticleMtl::plParticleMtl(BOOL loading) : fBasicPB(NULL)//, fBM(NULL), fUVGen // if (!loading) { Reset(); - plLayerTex *tex = TRACKED_NEW plLayerTex; + plLayerTex *tex = new plLayerTex; //tex->GetParamBlockByID(kBlkBasic)->SetValue(kBmpUseBitmap, 0, 1); fBasicPB->SetValue(kTexmap, 0, tex); @@ -330,7 +330,7 @@ IOResult plParticleMtl::Load(ILoad *iload) RefTargetHandle plParticleMtl::Clone(RemapDir &remap) { - plParticleMtl *mnew = TRACKED_NEW plParticleMtl(FALSE); + plParticleMtl *mnew = new plParticleMtl(FALSE); *((MtlBase*)mnew) = *((MtlBase*)this); mnew->ReplaceReference(kRefBasic, remap.CloneRef(fBasicPB)); diff --git a/Sources/Tools/MaxPlasmaMtls/Materials/plPassAnimDlgProc.cpp b/Sources/Tools/MaxPlasmaMtls/Materials/plPassAnimDlgProc.cpp index 5dcf620d..7c15998d 100644 --- a/Sources/Tools/MaxPlasmaMtls/Materials/plPassAnimDlgProc.cpp +++ b/Sources/Tools/MaxPlasmaMtls/Materials/plPassAnimDlgProc.cpp @@ -45,7 +45,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // // ////////////////////////////////////////////////////////////////////////////// -#include "hsTypes.h" +#include "HeadSpin.h" #include "plPassAnimDlgProc.h" #include "plPassBaseParamIDs.h" diff --git a/Sources/Tools/MaxPlasmaMtls/Materials/plPassMtl.cpp b/Sources/Tools/MaxPlasmaMtls/Materials/plPassMtl.cpp index 9bdad591..306b5eb6 100644 --- a/Sources/Tools/MaxPlasmaMtls/Materials/plPassMtl.cpp +++ b/Sources/Tools/MaxPlasmaMtls/Materials/plPassMtl.cpp @@ -39,7 +39,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com Mead, WA 99021 *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "plPassMtl.h" #include "../resource.h" //extern ClassDesc2* GetMaxLayerDesc(); @@ -64,7 +64,7 @@ class plPassMtlClassDesc : public ClassDesc2 { public: int IsPublic() { return TRUE; } - void* Create(BOOL loading) { return TRACKED_NEW plPassMtl(loading); } + void* Create(BOOL loading) { return new plPassMtl(loading); } const TCHAR* ClassName() { return GetString(IDS_PASS_MTL); } SClass_ID SuperClassID() { return MATERIAL_CLASS_ID; } Class_ID ClassID() { return PASS_MTL_CLASS_ID; } @@ -90,8 +90,8 @@ ParamBlockDesc2 *GetPassLayersPB(); plPassMtl::plPassMtl(BOOL loading) : plPassMtlBase( loading ) { plPassMtlDesc.MakeAutoParamBlocks( this ); - fLayersPB->SetValue( kPassLayBase, 0, TRACKED_NEW plLayerTex ); - fLayersPB->SetValue( kPassLayTop, 0, TRACKED_NEW plLayerTex ); + fLayersPB->SetValue( kPassLayBase, 0, new plLayerTex ); + fLayersPB->SetValue( kPassLayTop, 0, new plLayerTex ); // If we do this later (like, when the dialog loads) something blows up, // somewhere in Max. It didn't in 4, it does in 7. This seems to fix it. @@ -312,7 +312,7 @@ int plPassMtl::SubTexmapOn(int i) RefTargetHandle plPassMtl::Clone(RemapDir &remap) { - plPassMtl *mnew = TRACKED_NEW plPassMtl(FALSE); + plPassMtl *mnew = new plPassMtl(FALSE); plPassMtlBase::ICloneBase( mnew, remap ); return (RefTargetHandle)mnew; } diff --git a/Sources/Tools/MaxPlasmaMtls/Materials/plPassMtlBase.cpp b/Sources/Tools/MaxPlasmaMtls/Materials/plPassMtlBase.cpp index 2dbcffd7..146181d3 100644 --- a/Sources/Tools/MaxPlasmaMtls/Materials/plPassMtlBase.cpp +++ b/Sources/Tools/MaxPlasmaMtls/Materials/plPassMtlBase.cpp @@ -45,7 +45,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // // ////////////////////////////////////////////////////////////////////////////// -#include "hsTypes.h" +#include "HeadSpin.h" #include "hsBitVector.h" #include "Max.h" @@ -126,7 +126,7 @@ bool plPostLoadHandler::fLoading = false; plPassMtlBase::plPassMtlBase( BOOL loading ) : fNTWatcher( nil ), fBasicPB(NULL), fAdvPB(NULL), fLayersPB(NULL), fAnimPB(NULL), fLoading( loading ) { - fNTWatcher = TRACKED_NEW plNoteTrackWatcher( this ); + fNTWatcher = new plNoteTrackWatcher( this ); Reset(); } @@ -536,14 +536,14 @@ void plPassMtlBase::PostLoadAnimPBFixup( void ) myNew->SetAutoStart( (bool)fAnimPB->GetInt( (ParamID)kPBAnimAutoStart ) ); myNew->SetLoop( (bool)fAnimPB->GetInt( (ParamID)kPBAnimLoop ), (char *)fAnimPB->GetStr( (ParamID)kPBAnimLoopName ) ); - myNew->SetEaseIn( (UInt8)fAnimPB->GetInt( (ParamID)kPBAnimEaseInType ), - (hsScalar)fAnimPB->GetFloat( (ParamID)kPBAnimEaseInLength ), - (hsScalar)fAnimPB->GetFloat( (ParamID)kPBAnimEaseInMin ), - (hsScalar)fAnimPB->GetFloat( (ParamID)kPBAnimEaseInMax ) ); - myNew->SetEaseOut( (UInt8)fAnimPB->GetInt( (ParamID)kPBAnimEaseOutType ), - (hsScalar)fAnimPB->GetFloat( (ParamID)kPBAnimEaseOutLength ), - (hsScalar)fAnimPB->GetFloat( (ParamID)kPBAnimEaseOutMin ), - (hsScalar)fAnimPB->GetFloat( (ParamID)kPBAnimEaseOutMax ) ); + myNew->SetEaseIn( (uint8_t)fAnimPB->GetInt( (ParamID)kPBAnimEaseInType ), + (float)fAnimPB->GetFloat( (ParamID)kPBAnimEaseInLength ), + (float)fAnimPB->GetFloat( (ParamID)kPBAnimEaseInMin ), + (float)fAnimPB->GetFloat( (ParamID)kPBAnimEaseInMax ) ); + myNew->SetEaseOut( (uint8_t)fAnimPB->GetInt( (ParamID)kPBAnimEaseOutType ), + (float)fAnimPB->GetFloat( (ParamID)kPBAnimEaseOutLength ), + (float)fAnimPB->GetFloat( (ParamID)kPBAnimEaseOutMin ), + (float)fAnimPB->GetFloat( (ParamID)kPBAnimEaseOutMax ) ); #pragma warning( pop ) } } diff --git a/Sources/Tools/MaxPlasmaMtls/Shaders.cpp b/Sources/Tools/MaxPlasmaMtls/Shaders.cpp index e24f4644..8f376a6d 100644 --- a/Sources/Tools/MaxPlasmaMtls/Shaders.cpp +++ b/Sources/Tools/MaxPlasmaMtls/Shaders.cpp @@ -39,7 +39,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com Mead, WA 99021 *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "max.h" //#include "mtlhdr.h" #include "Shaders.h" diff --git a/Sources/Tools/MaxPlasmaMtls/plBMSampler.cpp b/Sources/Tools/MaxPlasmaMtls/plBMSampler.cpp index b9b1a295..849c5923 100644 --- a/Sources/Tools/MaxPlasmaMtls/plBMSampler.cpp +++ b/Sources/Tools/MaxPlasmaMtls/plBMSampler.cpp @@ -39,7 +39,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com Mead, WA 99021 *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "max.h" #include "texutil.h" #include "iparamb2.h" diff --git a/Sources/Tools/MaxPlasmaMtls/plDetailCurveCtrl.cpp b/Sources/Tools/MaxPlasmaMtls/plDetailCurveCtrl.cpp index 815238d7..159b8975 100644 --- a/Sources/Tools/MaxPlasmaMtls/plDetailCurveCtrl.cpp +++ b/Sources/Tools/MaxPlasmaMtls/plDetailCurveCtrl.cpp @@ -58,7 +58,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // // /////////////////////////////////////////////////////////////////////////////// -#include "hsTypes.h" +#include "HeadSpin.h" #include "plDetailCurveCtrl.h" #include "resource.h" diff --git a/Sources/Tools/MaxSceneViewer/SceneSync.cpp b/Sources/Tools/MaxSceneViewer/SceneSync.cpp index a7a2e4d7..a6894ac6 100644 --- a/Sources/Tools/MaxSceneViewer/SceneSync.cpp +++ b/Sources/Tools/MaxSceneViewer/SceneSync.cpp @@ -39,7 +39,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com Mead, WA 99021 *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "SceneSync.h" #include "SceneWatcher.h" @@ -233,7 +233,7 @@ bool SceneSync::BeginClientSync(const char *semaphoreName, const char *pipeName) // Update(); - fUpdateSignal = TRACKED_NEW hsSemaphore(0, semaphoreName); + fUpdateSignal = new hsSemaphore(0, semaphoreName); fPipeName = pipeName; @@ -353,7 +353,7 @@ bool SceneSync::IStartWatching(bool forceWatch) // b) there is previously saved data for this scene (we need to keep up to date) if (forceWatch || CanLoadOldResMgr()) { - fSceneWatcher = TRACKED_NEW SceneWatcher; + fSceneWatcher = new SceneWatcher; } return true; diff --git a/Sources/Tools/MaxSceneViewer/SceneViewer.cpp b/Sources/Tools/MaxSceneViewer/SceneViewer.cpp index 8e9351ce..ab655feb 100644 --- a/Sources/Tools/MaxSceneViewer/SceneViewer.cpp +++ b/Sources/Tools/MaxSceneViewer/SceneViewer.cpp @@ -39,7 +39,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com Mead, WA 99021 *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "SceneViewer.h" #include "SceneSync.h" @@ -131,7 +131,7 @@ bool SceneViewer::ISetRunning(bool running) strcat(path, "dat\\"); // Start the client - char *options = TRACKED_NEW char[strlen(path)+2+strlen(kSemaphoreName)+strlen(kPipeName)+6]; + char *options = new char[strlen(path)+2+strlen(kSemaphoreName)+strlen(kPipeName)+6]; sprintf(options, "-s %s %s \"%s\"", kSemaphoreName, kPipeName, path); int ret = (int)ShellExecute(NULL, diff --git a/Sources/Tools/MaxSceneViewer/SceneViewer.h b/Sources/Tools/MaxSceneViewer/SceneViewer.h index 9a00db60..3e7f5a8b 100644 --- a/Sources/Tools/MaxSceneViewer/SceneViewer.h +++ b/Sources/Tools/MaxSceneViewer/SceneViewer.h @@ -42,7 +42,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #ifndef SceneViewer_h_inc #define SceneViewer_h_inc -#include "hsWindows.h" +#include "HeadSpin.h" // The dialog for setting up and starting the SceneViewer. Controls starting the client // and SceneSync; SceneSync controls the updates though. diff --git a/Sources/Tools/MaxSceneViewer/SceneWatcher.cpp b/Sources/Tools/MaxSceneViewer/SceneWatcher.cpp index 02ef737e..ad39fddf 100644 --- a/Sources/Tools/MaxSceneViewer/SceneWatcher.cpp +++ b/Sources/Tools/MaxSceneViewer/SceneWatcher.cpp @@ -39,7 +39,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com Mead, WA 99021 *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "SceneWatcher.h" @@ -123,7 +123,7 @@ RefResult SceneWatcher::NotifyRefChanged(Interval changeInt, RefTargetHandle hTa if (node->IsComponent()) { plComponentBase *comp = node->ConvertToComponent(); - for (UInt32 i = 0; i < comp->NumTargets(); i++) + for (uint32_t i = 0; i < comp->NumTargets(); i++) { if (comp->GetTarget(i)) comp->GetTarget(i)->SetDirty(plMaxNode::kGeomDirty, true); diff --git a/Sources/Tools/MaxSceneViewer/plKeyRefSort.h b/Sources/Tools/MaxSceneViewer/plKeyRefSort.h index 5109e9b2..a5a068bb 100644 --- a/Sources/Tools/MaxSceneViewer/plKeyRefSort.h +++ b/Sources/Tools/MaxSceneViewer/plKeyRefSort.h @@ -39,7 +39,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com Mead, WA 99021 *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include #include "pnKeyedObject/plKey.h" diff --git a/Sources/Tools/MaxSceneViewer/plMaxFileData.cpp b/Sources/Tools/MaxSceneViewer/plMaxFileData.cpp index 454ef218..32d7dbda 100644 --- a/Sources/Tools/MaxSceneViewer/plMaxFileData.cpp +++ b/Sources/Tools/MaxSceneViewer/plMaxFileData.cpp @@ -39,7 +39,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com Mead, WA 99021 *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "plMaxFileData.h" #include "hsUtils.h" @@ -81,7 +81,7 @@ public: void GetClassName(TSTR& s) {s = "blah";} // Control methods - RefTargetHandle Clone(RemapDir& remap) { return TRACKED_NEW plMaxFileDataControl(); } + RefTargetHandle Clone(RemapDir& remap) { return new plMaxFileDataControl(); } void Copy(Control *from) {} virtual BOOL IsReplaceable() { return FALSE; } @@ -100,7 +100,7 @@ public: }; #define MAXFILE_DATA_CHUNK 1001 -static const UInt8 kVersion = 1; +static const uint8_t kVersion = 1; IOResult plMaxFileDataControl::Load(ILoad *iload) { @@ -110,8 +110,8 @@ IOResult plMaxFileDataControl::Load(ILoad *iload) { if (iload->CurChunkID() == MAXFILE_DATA_CHUNK) { - UInt8 version = 0; - res = iload->Read(&version, sizeof(UInt8), &nb); + uint8_t version = 0; + res = iload->Read(&version, sizeof(uint8_t), &nb); res = iload->Read(&fCodeBuildTime, sizeof(SYSTEMTIME), &nb); int branchLen = 0; @@ -147,7 +147,7 @@ class MaxFileDataClassDesc : public ClassDesc { public: int IsPublic() { return FALSE; } - void* Create(BOOL loading) { return TRACKED_NEW plMaxFileDataControl; } + void* Create(BOOL loading) { return new plMaxFileDataControl; } const TCHAR* ClassName() { return _T("MaxFileData"); } SClass_ID SuperClassID() { return CTRL_FLOAT_CLASS_ID; } Class_ID ClassID() { return PLASMA_FILE_DATA_CID; } diff --git a/Sources/Tools/MaxSceneViewer/plPluginClient.cpp b/Sources/Tools/MaxSceneViewer/plPluginClient.cpp index 5387dd54..bb948cb7 100644 --- a/Sources/Tools/MaxSceneViewer/plPluginClient.cpp +++ b/Sources/Tools/MaxSceneViewer/plPluginClient.cpp @@ -88,7 +88,7 @@ plUpdatableClient::~plUpdatableClient() void plUpdatableClient::InitUpdate(const char *semaphoreName, const char *pipeName, const char *dir) { - fUpdateSignal = TRACKED_NEW hsSemaphore(0, semaphoreName); + fUpdateSignal = new hsSemaphore(0, semaphoreName); fPipeName = pipeName; fDataPath = dir; } @@ -123,7 +123,7 @@ void plUpdatableClient::IGetUpdate() fLog->AddLineF(plStatusLog::kBlue, "SceneViewer Update #%d", numUpdates); #endif // LOG_SCENEVIWER - UInt8 type = s.ReadByte(); + uint8_t type = s.ReadByte(); if (type == ClientUpdate::kShutdown) { @@ -270,29 +270,29 @@ void plUpdatableClient::IEnableProxies(bool enable) // switch back on any drawable proxies if (fPipeline->GetDrawableTypeMask() & plDrawableSpans::kAudibleProxy) { - plProxyDrawMsg* msg = TRACKED_NEW plProxyDrawMsg(plProxyDrawMsg::kAudible | plProxyDrawMsg::kCreate); + plProxyDrawMsg* msg = new plProxyDrawMsg(plProxyDrawMsg::kAudible | plProxyDrawMsg::kCreate); plgDispatch::MsgSend(msg); } if (fPipeline->GetDrawableTypeMask() & plDrawableSpans::kOccluderProxy) { - plProxyDrawMsg* msg = TRACKED_NEW plProxyDrawMsg(plProxyDrawMsg::kOccluder | plProxyDrawMsg::kCreate); + plProxyDrawMsg* msg = new plProxyDrawMsg(plProxyDrawMsg::kOccluder | plProxyDrawMsg::kCreate); plgDispatch::MsgSend(msg); } if (fPipeline->GetDrawableTypeMask() & plDrawableSpans::kPhysicalProxy) { - plProxyDrawMsg* msg = TRACKED_NEW plProxyDrawMsg(plProxyDrawMsg::kPhysical | plProxyDrawMsg::kCreate); + plProxyDrawMsg* msg = new plProxyDrawMsg(plProxyDrawMsg::kPhysical | plProxyDrawMsg::kCreate); plgDispatch::MsgSend(msg); } if (fPipeline->GetDrawableTypeMask() & plDrawableSpans::kLightProxy) { - plProxyDrawMsg* msg = TRACKED_NEW plProxyDrawMsg(plProxyDrawMsg::kLight | plProxyDrawMsg::kCreate); + plProxyDrawMsg* msg = new plProxyDrawMsg(plProxyDrawMsg::kLight | plProxyDrawMsg::kCreate); plgDispatch::MsgSend(msg); } } else { // notify any and all drawable proxies to stop drawing... - plProxyDrawMsg* nuke = TRACKED_NEW plProxyDrawMsg(plProxyDrawMsg::kAudible + plProxyDrawMsg* nuke = new plProxyDrawMsg(plProxyDrawMsg::kAudible | plProxyDrawMsg::kOccluder | plProxyDrawMsg::kPhysical | plProxyDrawMsg::kLight diff --git a/Sources/Tools/MaxSceneViewer/plPluginClient.h b/Sources/Tools/MaxSceneViewer/plPluginClient.h index efe2150f..e2897783 100644 --- a/Sources/Tools/MaxSceneViewer/plPluginClient.h +++ b/Sources/Tools/MaxSceneViewer/plPluginClient.h @@ -42,7 +42,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #ifndef plUpdatableClient_h_inc #define plUpdatableClient_h_inc -#include "hsTypes.h" +#include "HeadSpin.h" #include "plClient/plClient.h" class hsSemaphore; diff --git a/Sources/Tools/plDatMerger/plDatMerger.cpp b/Sources/Tools/plDatMerger/plDatMerger.cpp index cbc11592..c18bfba4 100644 --- a/Sources/Tools/plDatMerger/plDatMerger.cpp +++ b/Sources/Tools/plDatMerger/plDatMerger.cpp @@ -169,7 +169,7 @@ class plStrFilter static hsBool Passes( const char *string, hsTArray &filters ) { - UInt32 i; + uint32_t i; for( i = 0; i < filters.GetCount(); i++ ) @@ -183,7 +183,7 @@ class plStrFilter static hsBool Passes( const plPageInfo &page, hsTArray &filters ) { - UInt32 i; + uint32_t i; for( i = 0; i < filters.GetCount(); i++ ) @@ -322,7 +322,7 @@ class plPageStuffer : public plRegistryPageIterator void IShutdown( int retCode ) { - UInt32 i; + uint32_t i; for( i = 0; i < fPageFilters.GetCount(); i++ ) delete fPageFilters[ i ]; @@ -383,10 +383,10 @@ int main( int argc, char *argv[] ) // Open the dest merged streams and write out our initial, incorrect, entry table so we can get positions right hsStream *destIdxStream = gDestMergeData->WriteEntries( true ); - hsStream *destDatStream = gDestMergeData->OpenData( (UInt32)-1, "wb" ); + hsStream *destDatStream = gDestMergeData->OpenData( (uint32_t)-1, "wb" ); - UInt32 i, bytesRead; - static UInt8 scratchBuffer[ 1024 * 64 ]; // 32k in size + uint32_t i, bytesRead; + static uint8_t scratchBuffer[ 1024 * 64 ]; // 32k in size for( i = 0; i < fSourcePages.GetCount(); i++ ) { printf( " Merging %s>%s...\n", fSourcePages[ i ]->GetPageInfo().GetAge(), fSourcePages[ i ]->GetPageInfo().GetPage() ); @@ -403,7 +403,7 @@ int main( int argc, char *argv[] ) // Idx first hsStream *srcStream = srcSource->OpenIndexStream( fSourcePages[ i ] ); - UInt32 size = srcStream->GetEOF(); + uint32_t size = srcStream->GetEOF(); do { bytesRead = srcStream->Read( size > sizeof( scratchBuffer ) ? sizeof( scratchBuffer ) : size, scratchBuffer ); diff --git a/Sources/Tools/plDatMerger/plRawKeyedObject.cpp b/Sources/Tools/plDatMerger/plRawKeyedObject.cpp index 2a026a1f..1a09a299 100644 --- a/Sources/Tools/plDatMerger/plRawKeyedObject.cpp +++ b/Sources/Tools/plDatMerger/plRawKeyedObject.cpp @@ -80,8 +80,8 @@ class plPublicKeyImp : public plKeyImp void SetAsEmpty( void ) { - fStartPos = (UInt32)-1; - fDataLen = (UInt32)-1; + fStartPos = (uint32_t)-1; + fDataLen = (uint32_t)-1; } void SetStartPosFromStream( hsStream *stream ) @@ -104,7 +104,7 @@ plRawKeyedObject::plRawKeyedObject() fBufferSize = 0; } -plRawKeyedObject::plRawKeyedObject( const plKey &key, UInt32 size, UInt8 *data ) +plRawKeyedObject::plRawKeyedObject( const plKey &key, uint32_t size, uint8_t *data ) { fSrcKey = key; ( (plPublicKeyImp *)(plKeyImp *)key )->SetObjectPtrDirect( this ); @@ -126,7 +126,7 @@ plRawKeyedObject::~plRawKeyedObject() delete [] fBuffer; } -void plRawKeyedObject::SetBuffer( UInt32 size, UInt8 *data ) +void plRawKeyedObject::SetBuffer( uint32_t size, uint8_t *data ) { delete [] fBuffer; @@ -138,7 +138,7 @@ void plRawKeyedObject::SetBuffer( UInt32 size, UInt8 *data ) } fBufferSize = size; - fBuffer = new UInt8[ size ]; + fBuffer = new uint8_t[ size ]; memcpy( fBuffer, data, size ); } @@ -173,9 +173,9 @@ void plRawKeyedObject::Write( hsStream *stream ) hsWriteOnlyStream replaceStream( fBufferSize, fBuffer ); // Here's the part that REALLY sucks, 'cause it assumes our written format will never change!!!! - // It ALSO assumes, VERY dangerously, that ReadSwap16() will ALWAYS read a size UInt16 + // It ALSO assumes, VERY dangerously, that ReadSwap16() will ALWAYS read a size uint16_t - replaceStream.SetPosition( sizeof( UInt16 ) ); // Get past creatable class that resManager writes out + replaceStream.SetPosition( sizeof( uint16_t ) ); // Get past creatable class that resManager writes out hsgResMgr::ResMgr()->WriteKey( &replaceStream, fSrcKey, hsResMgr::kWriteNoCheck ); } diff --git a/Sources/Tools/plDatMerger/plRawKeyedObject.h b/Sources/Tools/plDatMerger/plRawKeyedObject.h index ad7ce32e..bd166fa8 100644 --- a/Sources/Tools/plDatMerger/plRawKeyedObject.h +++ b/Sources/Tools/plDatMerger/plRawKeyedObject.h @@ -61,18 +61,18 @@ class plRawKeyedObject : public hsKeyedObject protected: plKey fSrcKey; - UInt32 fBufferSize; - UInt8 *fBuffer; + uint32_t fBufferSize; + uint8_t *fBuffer; public: plRawKeyedObject(); - plRawKeyedObject( const plKey &key, UInt32 size, UInt8 *buffer ); + plRawKeyedObject( const plKey &key, uint32_t size, uint8_t *buffer ); virtual ~plRawKeyedObject(); - void SetBuffer( UInt32 size, UInt8 *data ); - UInt32 GetBufferSize( void ) const { return fBufferSize; } - UInt8 *GetBuffer( void ) const { return fBuffer; } + void SetBuffer( uint32_t size, uint8_t *data ); + uint32_t GetBufferSize( void ) const { return fBufferSize; } + uint8_t *GetBuffer( void ) const { return fBuffer; } void SetKey( plKey k ); void Write( hsStream *stream ); diff --git a/Sources/Tools/plDatMerger/plRawPageAccessor.cpp b/Sources/Tools/plDatMerger/plRawPageAccessor.cpp index 6495b0c3..722f7f1d 100644 --- a/Sources/Tools/plDatMerger/plRawPageAccessor.cpp +++ b/Sources/Tools/plDatMerger/plRawPageAccessor.cpp @@ -99,9 +99,9 @@ class plRawReaderIter : public plRegistryKeyIterator { plRawResManager *mgr = (plRawResManager *)hsgResMgr::ResMgr(); - UInt32 len; + uint32_t len; plKeyImp *imp = (plKeyImp *)key; - UInt8 *buffer = mgr->ReadObjectBuffer( imp, len ); + uint8_t *buffer = mgr->ReadObjectBuffer( imp, len ); // This will also set the object ptr in the key plRawKeyedObject *obj = new plRawKeyedObject( key, len, buffer ); diff --git a/Sources/Tools/plDatMerger/plRawResManager.cpp b/Sources/Tools/plDatMerger/plRawResManager.cpp index eeaa9081..b0aabbd6 100644 --- a/Sources/Tools/plDatMerger/plRawResManager.cpp +++ b/Sources/Tools/plDatMerger/plRawResManager.cpp @@ -76,16 +76,16 @@ plRegistryPageNode *plRawResManager::CreatePage( const plPageInfo &info ) return page; } -UInt8 *plRawResManager::ReadObjectBuffer( plKeyImp *pKey, UInt32 &retBuffLength ) +uint8_t *plRawResManager::ReadObjectBuffer( plKeyImp *pKey, uint32_t &retBuffLength ) { - UInt8 *buffer = nil; + uint8_t *buffer = nil; hsAssert( pKey, "Null Key" ); - hsAssert( pKey->GetStartPos() != (UInt32)-1, "Missing StartPos" ); - hsAssert( pKey->GetDataLen() != (UInt32)-1, "Missing Data Length" ); + hsAssert( pKey->GetStartPos() != (uint32_t)-1, "Missing StartPos" ); + hsAssert( pKey->GetDataLen() != (uint32_t)-1, "Missing Data Length" ); - if( pKey->GetStartPos() == (UInt32)-1 || pKey->GetDataLen() == (UInt32)-1 ) + if( pKey->GetStartPos() == (uint32_t)-1 || pKey->GetDataLen() == (uint32_t)-1 ) { // Try to recover from this by just not reading an object retBuffLength = 0; @@ -98,14 +98,14 @@ UInt8 *plRawResManager::ReadObjectBuffer( plKeyImp *pKey, UInt32 &retBuffLengt { hsStream *stream = dataStream->GetStream(); - UInt32 oldPos = stream->GetPosition(); + uint32_t oldPos = stream->GetPosition(); stream->SetPosition( pKey->GetStartPos() ); - buffer = new UInt8[ pKey->GetDataLen() ]; + buffer = new uint8_t[ pKey->GetDataLen() ]; if( buffer != nil ) { - *( (UInt32 *)buffer ) = pKey->GetDataLen(); - stream->Read( pKey->GetDataLen(), (UInt8 *)buffer ); + *( (uint32_t *)buffer ) = pKey->GetDataLen(); + stream->Read( pKey->GetDataLen(), (uint8_t *)buffer ); retBuffLength = pKey->GetDataLen(); } else diff --git a/Sources/Tools/plDatMerger/plRawResManager.h b/Sources/Tools/plDatMerger/plRawResManager.h index 2bec6fd2..69083e00 100644 --- a/Sources/Tools/plDatMerger/plRawResManager.h +++ b/Sources/Tools/plDatMerger/plRawResManager.h @@ -63,7 +63,7 @@ class plRawResManager : public plResManager plRegistryPageNode *FindPage( const char *age, const char *chapter, const char *page ); plRegistryPageNode *CreatePage( const plPageInfo &info ); - UInt8 *ReadObjectBuffer( plKeyImp *key, UInt32 &retLength ); + uint8_t *ReadObjectBuffer( plKeyImp *key, uint32_t &retLength ); plKey NewBlankKey( const plUoid &newUoid ); }; diff --git a/Sources/Tools/plFontConverter/CMakeLists.txt b/Sources/Tools/plFontConverter/CMakeLists.txt index 093ec6f8..5878f81b 100644 --- a/Sources/Tools/plFontConverter/CMakeLists.txt +++ b/Sources/Tools/plFontConverter/CMakeLists.txt @@ -23,7 +23,6 @@ set(plFontConverter_RESOURCES add_executable(plFontConverter WIN32 ${plFontConverter_SOURCES} ${plFontConverter_HEADERS} ${plFontConverter_RESOURCES}) target_link_libraries(plFontConverter CoreLib) -target_link_libraries(plFontConverter CoreLibExe) target_link_libraries(plFontConverter pnKeyedObject) target_link_libraries(plFontConverter pnSceneObject) target_link_libraries(plFontConverter pnProduct) diff --git a/Sources/Tools/plFontConverter/hsCodecManagerStub.cpp b/Sources/Tools/plFontConverter/hsCodecManagerStub.cpp index 0765433a..e515eec9 100644 --- a/Sources/Tools/plFontConverter/hsCodecManagerStub.cpp +++ b/Sources/Tools/plFontConverter/hsCodecManagerStub.cpp @@ -60,23 +60,23 @@ hsCodecManager::hsCodecManager() { } -plMipmap *hsCodecManager::CreateCompressedMipmap(UInt32 compressionFormat, plMipmap *uncompressed) +plMipmap *hsCodecManager::CreateCompressedMipmap(uint32_t compressionFormat, plMipmap *uncompressed) { return nil; } -plMipmap *hsCodecManager::CreateUncompressedMipmap(plMipmap *compressed, UInt8 bitDepth) +plMipmap *hsCodecManager::CreateUncompressedMipmap(plMipmap *compressed, uint8_t bitDepth) { return nil; } -hsBool hsCodecManager::ColorizeCompMipmap( plMipmap *bMap, const UInt8 *colorMask ) +hsBool hsCodecManager::ColorizeCompMipmap( plMipmap *bMap, const uint8_t *colorMask ) { return false; } -hsBool hsCodecManager::Register(hsCodec *codec, UInt32 compressionFormat, hsScalar priority) +hsBool hsCodecManager::Register(hsCodec *codec, uint32_t compressionFormat, hsScalar priority) { return true; } diff --git a/Sources/Tools/plFontConverter/plFontConverter.cpp b/Sources/Tools/plFontConverter/plFontConverter.cpp index b63b6385..f884e8ff 100644 --- a/Sources/Tools/plFontConverter/plFontConverter.cpp +++ b/Sources/Tools/plFontConverter/plFontConverter.cpp @@ -43,8 +43,6 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #define WINDOWNAME "plFontConverter" #include "HeadSpin.h" -#include "hsTypes.h" -#include #include "res/resource.h" #include "pnAllCreatables.h" diff --git a/Sources/Tools/plFontConverter/plFontConverterProc.cpp b/Sources/Tools/plFontConverter/plFontConverterProc.cpp index 8f48a5ef..7aa8ebf6 100644 --- a/Sources/Tools/plFontConverter/plFontConverterProc.cpp +++ b/Sources/Tools/plFontConverter/plFontConverterProc.cpp @@ -40,8 +40,6 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ #include "HeadSpin.h" -#include "hsTypes.h" -#include #include "res/resource.h" #include #include @@ -179,9 +177,9 @@ void IUpdateInfo( HWND hDlg ) gFont->SetRenderColor( 0xff000000 ); gFont->SetRenderFlag( plFont::kRenderClip, true ); - gFont->SetRenderClipRect( 0, 0, (Int16)(r.right - r.left), (Int16)(r.bottom - r.top) ); - UInt16 w, h, a, lastX, lastY; - UInt32 firstCC; + gFont->SetRenderClipRect( 0, 0, (int16_t)(r.right - r.left), (int16_t)(r.bottom - r.top) ); + uint16_t w, h, a, lastX, lastY; + uint32_t firstCC; gFont->CalcStringExtents( testString, w, h, a, firstCC, lastX, lastY ); int cY = ( ( ( r.bottom - r.top ) - h ) >> 1 ) + a; @@ -200,7 +198,7 @@ void IUpdateInfo( HWND hDlg ) { for( x = 0; x < r.right - r.left; x++ ) { - UInt32 color = *mip->GetAddr32( x, y ); + uint32_t color = *mip->GetAddr32( x, y ); hsColorRGBA rgba; rgba.FromARGB32( color ); @@ -229,7 +227,7 @@ class plMyBDFCallback : public plBDFConvertCallback protected: HWND fDlg; clock_t fLastTime; - UInt16 fPoint; + uint16_t fPoint; void IPumpMessageQueue( void ) { @@ -244,7 +242,7 @@ class plMyBDFCallback : public plBDFConvertCallback public: plMyBDFCallback( HWND dlg ) : fDlg( dlg ) {} - virtual void NumChars( UInt16 chars ) + virtual void NumChars( uint16_t chars ) { ::SendDlgItemMessage( fDlg, IDC_PROGRESS, PBM_SETRANGE, 0, MAKELPARAM( 0, chars ) ); IPumpMessageQueue(); @@ -332,7 +330,7 @@ BOOL CALLBACK ResListWndProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM lPa { SendDlgItemMessage( hWnd, IDC_RESLIST, LB_RESETCONTENT, 0, 0 ); hsTArray *array = (hsTArray *)lParam; - for( UInt32 i = 0; i < array->GetCount(); i++ ) + for( uint32_t i = 0; i < array->GetCount(); i++ ) { ResRecord *rec = array->Get( i ); int idx = SendDlgItemMessage( hWnd, IDC_RESLIST, LB_ADDSTRING, 0, (LPARAM)rec->fName ); @@ -418,7 +416,7 @@ void IImportFON( HWND hWnd, const char *path ) MessageBox( hWnd, msg2, "Error", MB_OK | MB_ICONEXCLAMATION ); } - UInt32 i; + uint32_t i; for( i = 0; i < resList.GetCount(); i++ ) delete resList[ i ]; resList.Reset(); @@ -493,8 +491,8 @@ void IImportFreeType( HWND hWnd, const char *path ) IUpdateInfo( hWnd ); } -static UInt8 sNumSizes = 0; -static UInt8 sSizeArray[ 256 ]; +static uint8_t sNumSizes = 0; +static uint8_t sSizeArray[ 256 ]; static char sFontName[ 256 ]; // desired font name for FreeType conversions BOOL CALLBACK FreeTypeBatchDlgProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam ) @@ -582,7 +580,7 @@ void IBatchFreeType( HWND hWnd, const char *path ) plMyBDFCallback callback( dialog ); callback.NumChars( sNumSizes ); - UInt8 i; + uint8_t i; for( i = 0; i < sNumSizes; i++ ) { IMakeNewFont(); diff --git a/Sources/Tools/plFontConverter/plFontFreeType.cpp b/Sources/Tools/plFontConverter/plFontFreeType.cpp index 88c22bc7..c6f7cb40 100644 --- a/Sources/Tools/plFontConverter/plFontFreeType.cpp +++ b/Sources/Tools/plFontConverter/plFontFreeType.cpp @@ -100,9 +100,9 @@ hsBool plFontFreeType::ImportFreeType( const char *fontPath, Options *options, FT_GlyphSlot ftSlot = ftFace->glyph; FT_ULong ftChar; FT_UInt ftIndex; - UInt32 numGlyphs = 0, totalHeight = 0, maxChar = 0, i; + uint32_t numGlyphs = 0, totalHeight = 0, maxChar = 0, i; FT_Glyph ftGlyphs[ kMaxGlyphs ]; - UInt16 glyphChars[ kMaxGlyphs ]; + uint16_t glyphChars[ kMaxGlyphs ]; FT_Vector ftAdvances[ kMaxGlyphs ]; FT_BBox ftGlyphBox, ftFontBox; FT_UInt previous = 0; @@ -153,7 +153,7 @@ hsBool plFontFreeType::ImportFreeType( const char *fontPath, Options *options, if( maxChar < ftChar ) maxChar = ftChar; - glyphChars[ numGlyphs ] = (UInt16)ftChar; + glyphChars[ numGlyphs ] = (uint16_t)ftChar; numGlyphs++; } @@ -167,7 +167,7 @@ hsBool plFontFreeType::ImportFreeType( const char *fontPath, Options *options, if( fBPP == 1 ) fWidth = ( ( fWidth + 7 ) >> 3 ) << 3; fHeight = totalHeight; - fBMapData = new UInt8[ ( fWidth * fHeight * fBPP ) >> 3 ]; + fBMapData = new uint8_t[ ( fWidth * fHeight * fBPP ) >> 3 ]; memset( fBMapData, 0, ( fWidth * fHeight * fBPP ) >> 3 ); // Set the name and size of our font @@ -186,13 +186,13 @@ hsBool plFontFreeType::ImportFreeType( const char *fontPath, Options *options, SetFace( str ); // # of bytes per row - UInt32 stride = ( fBPP == 1 ) ? ( fWidth >> 3 ) : fWidth; + uint32_t stride = ( fBPP == 1 ) ? ( fWidth >> 3 ) : fWidth; // Pre-expand our char list fCharacters.ExpandAndZero( maxChar + 1 ); fCharacters.SetCount( 0 ); if( callback != nil ) - callback->NumChars( (UInt16)(maxChar + 1) ); + callback->NumChars( (uint16_t)(maxChar + 1) ); // Now re-run through our stored list of glyphs, converting them to bitmaps for( i = 0; i < numGlyphs; i++ ) @@ -214,7 +214,7 @@ hsBool plFontFreeType::ImportFreeType( const char *fontPath, Options *options, FT_BitmapGlyph ftBitmap = (FT_BitmapGlyph)ftGlyphs[ i ]; plCharacter *ch = &fCharacters[ glyphChars[ i ] ]; - UInt8 *ourBitmap = IGetFreeCharData( ch->fBitmapOff ); + uint8_t *ourBitmap = IGetFreeCharData( ch->fBitmapOff ); if( ourBitmap == nil ) throw false; @@ -225,16 +225,16 @@ hsBool plFontFreeType::ImportFreeType( const char *fontPath, Options *options, } // Set these now, since setting them before would've changed the IGetFreeCharData results - ch->fLeftKern = (hsScalar)ftBitmap->left; - ch->fRightKern = (hsScalar)ftAdvances[ i ].x / 64.f - (hsScalar)fWidth - ch->fLeftKern;//ftBitmap->bitmap.width; + ch->fLeftKern = (float)ftBitmap->left; + ch->fRightKern = (float)ftAdvances[ i ].x / 64.f - (float)fWidth - ch->fLeftKern;//ftBitmap->bitmap.width; ch->fBaseline = ftBitmap->top; ch->fHeight = ftBitmap->bitmap.rows; // Copy data straight through to our bitmap int y; - UInt8 *srcData = (UInt8 *)ftBitmap->bitmap.buffer; + uint8_t *srcData = (uint8_t *)ftBitmap->bitmap.buffer; - UInt32 bytesWide = ( fBPP == 1 ) ? ( ( ftBitmap->bitmap.width + 7 ) >> 3 ) : ftBitmap->bitmap.width; + uint32_t bytesWide = ( fBPP == 1 ) ? ( ( ftBitmap->bitmap.width + 7 ) >> 3 ) : ftBitmap->bitmap.width; for( y = 0; y < ch->fHeight; y++ ) { diff --git a/Sources/Tools/plFontConverter/plFontFreeType.h b/Sources/Tools/plFontConverter/plFontFreeType.h index b98e8527..1ca5af25 100644 --- a/Sources/Tools/plFontConverter/plFontFreeType.h +++ b/Sources/Tools/plFontConverter/plFontFreeType.h @@ -55,11 +55,11 @@ class plFontFreeType : public plFont struct Options { - UInt8 fSize; + uint8_t fSize; hsBool fUseKerning; - UInt8 fBitDepth; - UInt32 fScreenRes; - UInt32 fMaxCharLimit; + uint8_t fBitDepth; + uint32_t fScreenRes; + uint32_t fMaxCharLimit; Options() { fSize = 12; fUseKerning = false; fBitDepth = 1; fScreenRes = 96; fMaxCharLimit = 255; } }; diff --git a/Sources/Tools/plLocalizationEditor/CMakeLists.txt b/Sources/Tools/plLocalizationEditor/CMakeLists.txt index bf8432cf..88428c37 100644 --- a/Sources/Tools/plLocalizationEditor/CMakeLists.txt +++ b/Sources/Tools/plLocalizationEditor/CMakeLists.txt @@ -28,7 +28,6 @@ set(plLocalizationEditor_RESOURCES add_executable(plLocalizationEditor WIN32 ${plLocalizationEditor_HEADERS} ${plLocalizationEditor_SOURCES} ${plLocalizationEditor_RESOURCES}) target_link_libraries(plLocalizationEditor CoreLib) -target_link_libraries(plLocalizationEditor CoreLibExe) target_link_libraries(plLocalizationEditor pnProduct) target_link_libraries(plLocalizationEditor pnSceneObject) target_link_libraries(plLocalizationEditor plResMgr) diff --git a/Sources/Tools/plLocalizationEditor/plAddDlgs.cpp b/Sources/Tools/plLocalizationEditor/plAddDlgs.cpp index e4f92450..4e142c83 100644 --- a/Sources/Tools/plLocalizationEditor/plAddDlgs.cpp +++ b/Sources/Tools/plLocalizationEditor/plAddDlgs.cpp @@ -45,7 +45,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "plAddDlgs.h" #include "plEditDlg.h" -#include "hsUtils.h" + #include "plResMgr/plLocalization.h" #include "pfLocalizationMgr/pfLocalizationDataMgr.h" diff --git a/Sources/Tools/plLocalizationEditor/plAddDlgs.h b/Sources/Tools/plLocalizationEditor/plAddDlgs.h index b8c63053..af9832cc 100644 --- a/Sources/Tools/plLocalizationEditor/plAddDlgs.h +++ b/Sources/Tools/plLocalizationEditor/plAddDlgs.h @@ -43,10 +43,8 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #ifndef __plAddDlgs_h__ #define __plAddDlgs_h__ +#include "HeadSpin.h" #include -#define WIN32_LEAN_AND_MEAN -#include -#include class plAddElementDlg { diff --git a/Sources/Tools/plLocalizationEditor/plEditDlg.cpp b/Sources/Tools/plLocalizationEditor/plEditDlg.cpp index d770c9b8..61b08e5d 100644 --- a/Sources/Tools/plLocalizationEditor/plEditDlg.cpp +++ b/Sources/Tools/plLocalizationEditor/plEditDlg.cpp @@ -45,7 +45,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "plLocTreeView.h" #include "plAddDlgs.h" -#include "hsUtils.h" + #include "pfLocalizationMgr/pfLocalizationDataMgr.h" #include @@ -103,7 +103,7 @@ void SaveLocalizationText() if (gCurrentPath == L"") return; // no path to save - UInt32 textLen = (UInt32)SendMessage(GetDlgItem(gEditDlg, IDC_LOCALIZATIONTEXT), WM_GETTEXTLENGTH, (WPARAM)0, (LPARAM)0); + uint32_t textLen = (uint32_t)SendMessage(GetDlgItem(gEditDlg, IDC_LOCALIZATIONTEXT), WM_GETTEXTLENGTH, (WPARAM)0, (LPARAM)0); wchar_t *buffer = new wchar_t[textLen + 2]; GetDlgItemTextW(gEditDlg, IDC_LOCALIZATIONTEXT, buffer, textLen + 1); buffer[textLen + 1] = 0; diff --git a/Sources/Tools/plLocalizationEditor/plEditDlg.h b/Sources/Tools/plLocalizationEditor/plEditDlg.h index 31a20bd6..b11bc468 100644 --- a/Sources/Tools/plLocalizationEditor/plEditDlg.h +++ b/Sources/Tools/plLocalizationEditor/plEditDlg.h @@ -43,9 +43,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #ifndef _pfEditDlg_h #define _pfEditDlg_h -#define WIN32_LEAN_AND_MEAN -#include -#include +#include "HeadSpin.h" #include // Little trick to show a wait cursor while something is working diff --git a/Sources/Tools/plLocalizationEditor/plLocTreeView.cpp b/Sources/Tools/plLocalizationEditor/plLocTreeView.cpp index 7f68a83d..0bb55e71 100644 --- a/Sources/Tools/plLocalizationEditor/plLocTreeView.cpp +++ b/Sources/Tools/plLocalizationEditor/plLocTreeView.cpp @@ -42,9 +42,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "plLocTreeView.h" #include "plEditDlg.h" -#define WIN32_LEAN_AND_MEAN -#include -#include +#include "HeadSpin.h" #include #include #include "res\resource.h" @@ -52,7 +50,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include #include -#include "hsUtils.h" + #include "pfLocalizationMgr/pfLocalizationDataMgr.h" extern HINSTANCE gInstance; diff --git a/Sources/Tools/plLocalizationEditor/plLocTreeView.h b/Sources/Tools/plLocalizationEditor/plLocTreeView.h index bf8317d8..7836f79a 100644 --- a/Sources/Tools/plLocalizationEditor/plLocTreeView.h +++ b/Sources/Tools/plLocalizationEditor/plLocTreeView.h @@ -42,9 +42,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #ifndef _plLocTreeView_h #define _plLocTreeView_h -#define WIN32_LEAN_AND_MEAN -#include -#include +#include "HeadSpin.h" #include class plLocTreeView diff --git a/Sources/Tools/plLocalizationEditor/plLocalizationEditor.cpp b/Sources/Tools/plLocalizationEditor/plLocalizationEditor.cpp index b15a0ea4..699f0287 100644 --- a/Sources/Tools/plLocalizationEditor/plLocalizationEditor.cpp +++ b/Sources/Tools/plLocalizationEditor/plLocalizationEditor.cpp @@ -64,9 +64,7 @@ REGISTER_CREATABLE(plInitialAgeStateLoadedMsg); #include "plLocTreeView.h" #include "plEditDlg.h" -#define WIN32_LEAN_AND_MEAN -#include -#include +#include "HeadSpin.h" #include #include #include diff --git a/Sources/Tools/plResBrowser/CMakeLists.txt b/Sources/Tools/plResBrowser/CMakeLists.txt index ae38f5b8..7291b2d0 100644 --- a/Sources/Tools/plResBrowser/CMakeLists.txt +++ b/Sources/Tools/plResBrowser/CMakeLists.txt @@ -34,7 +34,6 @@ set(plResBrowser_RESOURCES add_executable(plResBrowser WIN32 ${plResBrowser_SOURCES} ${plResBrowser_HEADERS} ${plResBrowser_RESOURCES}) target_link_libraries(plResBrowser CoreLib) -target_link_libraries(plResBrowser CoreLibExe) target_link_libraries(plResBrowser plFile) target_link_libraries(plResBrowser plMessage) target_link_libraries(plResBrowser plResMgr) diff --git a/Sources/Tools/plResBrowser/plResBrowser.cpp b/Sources/Tools/plResBrowser/plResBrowser.cpp index 79ee980d..dc45bf70 100644 --- a/Sources/Tools/plResBrowser/plResBrowser.cpp +++ b/Sources/Tools/plResBrowser/plResBrowser.cpp @@ -43,8 +43,6 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #define WINDOWNAME "plResBrowser" #include "HeadSpin.h" -#include "hsTypes.h" -#include #include "res/resource.h" #include "pnAllCreatables.h" @@ -73,7 +71,7 @@ int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLin plResMgrSettings::Get().SetFilterOlderPageVersions( false ); gCommandLine = (char *)lpCmdLine; - plResManager *rMgr = TRACKED_NEW plResManager; + plResManager *rMgr = new plResManager; hsgResMgr::Init( rMgr ); if( !WinInit( hInstance, nCmdShow ) ) diff --git a/Sources/Tools/plResBrowser/plResBrowserWndProc.cpp b/Sources/Tools/plResBrowser/plResBrowserWndProc.cpp index 88f6a08f..b0e698f7 100644 --- a/Sources/Tools/plResBrowser/plResBrowserWndProc.cpp +++ b/Sources/Tools/plResBrowser/plResBrowserWndProc.cpp @@ -39,9 +39,8 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com Mead, WA 99021 *==LICENSE==*/ -#include "hsTypes.h" +#include "HeadSpin.h" #include "hsTemplates.h" -#include #include "afxres.h" #include "res/resource.h" #include diff --git a/Sources/Tools/plResBrowser/plResTreeView.cpp b/Sources/Tools/plResBrowser/plResTreeView.cpp index c0900700..31b6ca92 100644 --- a/Sources/Tools/plResBrowser/plResTreeView.cpp +++ b/Sources/Tools/plResBrowser/plResTreeView.cpp @@ -39,8 +39,8 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com Mead, WA 99021 *==LICENSE==*/ -#include "hsTypes.h" -#include "hsWindows.h" +#include "HeadSpin.h" + #include "plResTreeView.h" #include "plResMgr/plResManager.h" @@ -52,7 +52,6 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "pnKeyedObject/plKeyImp.h" #include "pnFactory/plFactory.h" -#include #include #include #include "res\resource.h" @@ -107,7 +106,7 @@ class plResDlgLoader : public plRegistryPageIterator, public plRegistryKeyIterat HWND fTree; HTREEITEM fCurrItem, fCurrTypeItem; - UInt16 fCurrType; + uint16_t fCurrType; bool fFilter; plRegistryPageNode *fCurrPage; @@ -148,7 +147,7 @@ class plResDlgLoader : public plRegistryPageIterator, public plRegistryKeyIterat sprintf( str, "%s->%s", info.GetAge(), info.GetPage() ); fCurrItem = AddLeaf( fTree, NULL, str, new plKeyInfo( nil, fCurrPage ) ); - fCurrType = (UInt16)-1; + fCurrType = (uint16_t)-1; page->LoadKeys(); page->IterateKeys( this ); return true; @@ -499,7 +498,7 @@ void plResTreeView::SaveSelectedObject(HWND treeCtrl) return; hsStream *dataStream = stream->GetStream(); - UInt8 *buffer = TRACKED_NEW UInt8[ keyImp->GetDataLen() ]; + uint8_t *buffer = new uint8_t[ keyImp->GetDataLen() ]; if( buffer != nil ) { dataStream->SetPosition( keyImp->GetStartPos() ); diff --git a/Sources/Tools/plResBrowser/plWinRegistryTools.cpp b/Sources/Tools/plResBrowser/plWinRegistryTools.cpp index 20f41920..2b2ad5b4 100644 --- a/Sources/Tools/plResBrowser/plWinRegistryTools.cpp +++ b/Sources/Tools/plResBrowser/plWinRegistryTools.cpp @@ -48,9 +48,9 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // ////////////////////////////////////////////////////////////////////////////// -#include "hsTypes.h" +#include "HeadSpin.h" #include "plWinRegistryTools.h" -#include "hsWindows.h" + //////////////////////////////////////////////////////////////////////////////