mirror of
https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git
synced 2025-07-18 19:29:09 +00:00
Merge pull request #87 from dpogue/linux
Make plPythonPack work on Linux --HG-- rename : Sources/Plasma/PubUtilLib/plUUID/plUUID.h => Sources/Plasma/NucleusLib/pnUUID/pnUUID.h rename : Sources/Plasma/PubUtilLib/plUUID/plUUID_Unix.cpp => Sources/Plasma/NucleusLib/pnUUID/pnUUID_Unix.cpp rename : Sources/Plasma/PubUtilLib/plUUID/plUUID_Win32.cpp => Sources/Plasma/NucleusLib/pnUUID/pnUUID_Win32.cpp
This commit is contained in:
@ -48,5 +48,4 @@ add_subdirectory(plStreamLogger)
|
||||
add_subdirectory(plSurface)
|
||||
add_subdirectory(plTransform)
|
||||
add_subdirectory(plUnifiedTime)
|
||||
add_subdirectory(plUUID)
|
||||
add_subdirectory(plVault)
|
||||
|
@ -46,7 +46,11 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
//#include "hsTimer.h"
|
||||
#include "plResPatcher.h"
|
||||
#include "plBackgroundDownloader.h"
|
||||
#include "process.h" // for getpid()
|
||||
#if HS_BUILD_FOR_WIN32
|
||||
# include "process.h" // for getpid()
|
||||
#else
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
|
||||
#include "pnProduct/pnProduct.h"
|
||||
|
||||
|
@ -52,7 +52,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
|
||||
#include "plAgeDescription/plAgeDescription.h"
|
||||
|
||||
#include "plUUID/plUUID.h"
|
||||
#include "pnUUID/pnUUID.h"
|
||||
|
||||
//
|
||||
// A singleton class which manages loading and unloading ages and operations associated with that
|
||||
|
@ -3,7 +3,9 @@ include_directories("../../NucleusLib/inc")
|
||||
include_directories("../../NucleusLib")
|
||||
include_directories("../../PubUtilLib")
|
||||
|
||||
include_directories(${DirectX_INCLUDE_DIR})
|
||||
if(WIN32)
|
||||
include_directories(${DirectX_INCLUDE_DIR})
|
||||
endif(WIN32)
|
||||
include_directories(${OPENAL_INCLUDE_DIR})
|
||||
include_directories(${Speex_INCLUDE_DIR})
|
||||
|
||||
|
@ -3,9 +3,13 @@ include_directories("../../NucleusLib/inc")
|
||||
include_directories("../../NucleusLib")
|
||||
include_directories("../../PubUtilLib")
|
||||
|
||||
include_directories(${DirectX_INCLUDE_DIR})
|
||||
include_directories(${Ogg_INCLUDE_DIR})
|
||||
include_directories(${Vorbis_INCLUDE_DIR})
|
||||
# We only need DirectX if we're building the Max plugin
|
||||
# TODO: Check if we actually need this at all
|
||||
if(3dsm_BUILD_PLUGIN)
|
||||
include_directories(${DirectX_INCLUDE_DIR})
|
||||
endif(3dsm_BUILD_PLUGIN)
|
||||
|
||||
set(plAudioCore_SOURCES
|
||||
plAudioFileReader.cpp
|
||||
@ -32,6 +36,8 @@ set(plAudioCore_HEADERS
|
||||
)
|
||||
|
||||
add_library(plAudioCore STATIC ${plAudioCore_SOURCES} ${plAudioCore_HEADERS})
|
||||
target_link_libraries(plAudioCore ${Ogg_LIBRARIES})
|
||||
target_link_libraries(plAudioCore ${Vorbis_LIBRARIES})
|
||||
|
||||
source_group("Source Files" FILES ${plAudioCore_SOURCES})
|
||||
source_group("Header Files" FILES ${plAudioCore_HEADERS})
|
||||
|
@ -458,9 +458,9 @@ hsScalar plAGAnimInstance::ICalcFade(hsBool &fade, hsScalar curVal, hsScalar goa
|
||||
hsScalar newVal;
|
||||
hsScalar curStep = rate * elapsed;
|
||||
if(rate > 0) {
|
||||
newVal = __min(goal, curVal + curStep);
|
||||
newVal = std::min(goal, curVal + curStep);
|
||||
} else {
|
||||
newVal = __max(goal, curVal + curStep);
|
||||
newVal = std::max(goal, curVal + curStep);
|
||||
}
|
||||
|
||||
if(newVal == goal)
|
||||
@ -593,7 +593,7 @@ void DumpAGAllocs()
|
||||
agAlloc * al = (*i).second;
|
||||
delete al;
|
||||
|
||||
i = gAGAllocs.erase(i);
|
||||
gAGAllocs.erase(i++);
|
||||
}
|
||||
hsStatusMessage("FINISHED DUMPING AG ALLOCATIONS *********************************************");
|
||||
}
|
||||
|
@ -51,7 +51,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
#include "plAGAnimInstance.h"
|
||||
#include "plMatrixChannel.h"
|
||||
#include "plAvBrainGeneric.h"
|
||||
#include "plMultiStageBehMod.h"
|
||||
#include "plMultistageBehMod.h"
|
||||
|
||||
// global
|
||||
#include "hsUtils.h"
|
||||
|
@ -797,7 +797,8 @@ bool plIniSectionConfigSource::ReadSubSource( const char * name )
|
||||
std::vector<std::string> sections;
|
||||
for ( int i=0; i<fSections.size(); i++ )
|
||||
sections.push_back( fSections[i].c_str() );
|
||||
return fConfigInfo->ReadFrom(&plIniSectionConfigSource( name, sections ));
|
||||
plIniSectionConfigSource src(name, sections);
|
||||
return fConfigInfo->ReadFrom(&src);
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////
|
||||
|
@ -205,8 +205,10 @@ void plCluster::UnPack(UInt8* vDst, UInt16* iDst, int idxOffset, hsBounds3Ext& w
|
||||
}
|
||||
}
|
||||
}
|
||||
wBnd.Reset(&hsPoint3(minX, minY, minZ));
|
||||
wBnd.Union(&hsPoint3(maxX, maxY, maxZ));
|
||||
hsPoint3 min(minX, minY, minZ);
|
||||
wBnd.Reset(&min);
|
||||
hsPoint3 max(maxX, maxY, maxZ);
|
||||
wBnd.Union(&max);
|
||||
}
|
||||
|
||||
|
||||
|
@ -547,7 +547,8 @@ plDrawableSpans *plDrawableGenerator::GenerateConicalDrawable( hsScalar radi
|
||||
|
||||
direction.Set( 0, 0, height );
|
||||
|
||||
return GenerateConicalDrawable( hsPoint3( 0, 0, 0 ), direction, radius, material, localToWorld, blended,
|
||||
hsPoint3 zero(0, 0, 0);
|
||||
return GenerateConicalDrawable(zero, direction, radius, material, localToWorld, blended,
|
||||
multColor, retIndex, toAddTo );
|
||||
}
|
||||
|
||||
|
@ -3549,8 +3549,9 @@ plParticleSpan *plDrawableSpans::ICreateParticleIcicle( hsGMaterial *material,
|
||||
icicle->fLocalBounds.MakeEmpty();
|
||||
icicle->fWorldBounds.MakeEmpty();
|
||||
|
||||
icicle->fLocalBounds.Union( &hsPoint3(0,0,0) );
|
||||
icicle->fWorldBounds.Union( &hsPoint3(0,0,0) );
|
||||
hsPoint3 zero(0, 0, 0);
|
||||
icicle->fLocalBounds.Union( &zero );
|
||||
icicle->fWorldBounds.Union( &zero );
|
||||
|
||||
icicle->fGroupIdx = set->fGroupIdx;
|
||||
icicle->fVBufferIdx = set->fVBufferIdx;
|
||||
|
@ -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(UInt32(this), GetKey());
|
||||
plDynaDecalInfo& info = IGetDecalInfo(unsigned_ptr(this), GetKey());
|
||||
|
||||
if( bull->PartyTime() > 0 )
|
||||
fPartyTime = bull->PartyTime();
|
||||
|
@ -348,7 +348,7 @@ hsBool plDynaDecalMgr::IWetParts(const plDynaDecalEnableMsg* enaMsg)
|
||||
const plPrintShape* shape = IGetPrintShape(enaMsg->GetShapeKey());
|
||||
if( shape )
|
||||
{
|
||||
plDynaDecalInfo& info = IGetDecalInfo(UInt32(shape), shape->GetKey());
|
||||
plDynaDecalInfo& info = IGetDecalInfo(unsigned_ptr(shape), shape->GetKey());
|
||||
IWetInfo(info, enaMsg);
|
||||
}
|
||||
}
|
||||
@ -362,7 +362,7 @@ hsBool plDynaDecalMgr::IWetParts(const plDynaDecalEnableMsg* enaMsg)
|
||||
const plPrintShape* shape = IGetPrintShape(avMod, fPartIDs[i]);
|
||||
if( shape )
|
||||
{
|
||||
plDynaDecalInfo& info = IGetDecalInfo(UInt32(shape), shape->GetKey());
|
||||
plDynaDecalInfo& info = IGetDecalInfo(unsigned_ptr(shape), shape->GetKey());
|
||||
IWetInfo(info, enaMsg);
|
||||
}
|
||||
}
|
||||
@ -381,7 +381,7 @@ hsBool plDynaDecalMgr::IWetPart(UInt32 id, const plDynaDecalEnableMsg* enaMsg)
|
||||
const plPrintShape* shape = IGetPrintShape(avMod, id);
|
||||
if( shape )
|
||||
{
|
||||
plDynaDecalInfo& info = IGetDecalInfo(UInt32(shape), shape->GetKey());
|
||||
plDynaDecalInfo& info = IGetDecalInfo(unsigned_ptr(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(UInt32(refMsg->GetRef()));
|
||||
IRemoveDecalInfo(unsigned_ptr(refMsg->GetRef()));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -537,7 +537,7 @@ plDynaDecalInfo& plDynaDecalInfo::Init(const plKey& key)
|
||||
return *this;
|
||||
}
|
||||
|
||||
plDynaDecalInfo& plDynaDecalMgr::IGetDecalInfo(UInt32 id, const plKey& key)
|
||||
plDynaDecalInfo& plDynaDecalMgr::IGetDecalInfo(unsigned_ptr id, const plKey& key)
|
||||
{
|
||||
plDynaDecalMap::iterator iter = fDecalMap.find(id);
|
||||
if( iter == fDecalMap.end() )
|
||||
|
@ -104,7 +104,7 @@ public:
|
||||
plDynaDecalInfo& Init(const plKey& key);
|
||||
};
|
||||
|
||||
typedef std::map< UInt32, plDynaDecalInfo, std::less<UInt32> > plDynaDecalMap;
|
||||
typedef std::map< unsigned_ptr, plDynaDecalInfo, std::less<unsigned_ptr> > plDynaDecalMap;
|
||||
|
||||
// plDynaDecalMgr
|
||||
// Primary responsibilities:
|
||||
@ -189,7 +189,7 @@ protected:
|
||||
hsBool IWetPart(UInt32 id, const plDynaDecalEnableMsg* enaMsg);
|
||||
void IWetInfo(plDynaDecalInfo& info, const plDynaDecalEnableMsg* enaMsg) const;
|
||||
hsScalar IHowWet(plDynaDecalInfo& info, double t) const;
|
||||
plDynaDecalInfo& IGetDecalInfo(UInt32 id, const plKey& key);
|
||||
plDynaDecalInfo& IGetDecalInfo(unsigned_ptr id, const plKey& key);
|
||||
void IRemoveDecalInfo(UInt32 id);
|
||||
void IRemoveDecalInfos(const plKey& key);
|
||||
|
||||
|
@ -115,7 +115,7 @@ hsBool plDynaFootMgr::MsgReceive(plMessage* msg)
|
||||
const plPrintShape* shape = IGetPrintShape(armMod, id);
|
||||
if( shape )
|
||||
{
|
||||
plDynaDecalInfo& info = IGetDecalInfo(UInt32(shape), shape->GetKey());
|
||||
plDynaDecalInfo& info = IGetDecalInfo(unsigned_ptr(shape), shape->GetKey());
|
||||
if( IPrintFromShape(shape, footMsg->IsLeft()) )
|
||||
{
|
||||
INotifyActive(info, armMod->GetKey(), id);
|
||||
@ -138,7 +138,7 @@ hsBool plDynaFootMgr::IPrintFromShape(const plPrintShape* shape, hsBool flip)
|
||||
|
||||
if( shape )
|
||||
{
|
||||
plDynaDecalInfo& info = IGetDecalInfo(UInt32(shape), shape->GetKey());
|
||||
plDynaDecalInfo& info = IGetDecalInfo(unsigned_ptr(shape), shape->GetKey());
|
||||
|
||||
double secs = hsTimer::GetSysSeconds();
|
||||
hsScalar wetness = IHowWet(info, secs);
|
||||
|
@ -94,7 +94,7 @@ hsBool plDynaPuddleMgr::MsgReceive(plMessage* msg)
|
||||
const plPrintShape* shape = IGetPrintShape(armMod, fPartIDs[i]);
|
||||
if( shape )
|
||||
{
|
||||
plDynaDecalInfo& info = IGetDecalInfo(UInt32(shape), shape->GetKey());
|
||||
plDynaDecalInfo& info = IGetDecalInfo(unsigned_ptr(shape), shape->GetKey());
|
||||
if( IRippleFromShape(shape, true) )
|
||||
{
|
||||
INotifyActive(info, armMod->GetKey(), fPartIDs[i]);
|
||||
|
@ -146,7 +146,7 @@ hsBool plDynaRippleMgr::MsgReceive(plMessage* msg)
|
||||
const plPrintShape* shape = IGetPrintShape(armMsg->fArmature, fPartIDs[i]);
|
||||
if( shape )
|
||||
{
|
||||
plDynaDecalInfo& info = IGetDecalInfo(UInt32(shape), shape->GetKey());
|
||||
plDynaDecalInfo& info = IGetDecalInfo(unsigned_ptr(shape), shape->GetKey());
|
||||
if( IRippleFromShape(shape, false) )
|
||||
{
|
||||
INotifyActive(info, armMsg->fArmature->GetKey(), fPartIDs[i]);
|
||||
@ -182,7 +182,7 @@ hsBool plDynaRippleMgr::IRippleFromShape(const plPrintShape* shape, hsBool force
|
||||
|
||||
hsBool retVal = false;
|
||||
|
||||
plDynaDecalInfo& info = IGetDecalInfo(UInt32(shape), shape->GetKey());
|
||||
plDynaDecalInfo& info = IGetDecalInfo(unsigned_ptr(shape), shape->GetKey());
|
||||
|
||||
const hsMatrix44& shapeL2W = shape->GetOwner()->GetLocalToWorld();
|
||||
|
||||
@ -191,7 +191,8 @@ hsBool plDynaRippleMgr::IRippleFromShape(const plPrintShape* shape, hsBool force
|
||||
double t = hsTimer::GetSysSeconds();
|
||||
hsScalar dt = hsScalar(t - info.fLastTime) * sRand.RandZeroToOne();
|
||||
hsBool longEnough = (dt >= kMinTime);
|
||||
hsBool farEnough = (hsVector3(&info.fLastPos, &shapeL2W.GetTranslate()).Magnitude() > kMinDist);
|
||||
hsPoint3 xlate = shapeL2W.GetTranslate();
|
||||
hsBool farEnough = (hsVector3(&info.fLastPos, &xlate).Magnitude() > kMinDist);
|
||||
if( force || longEnough || farEnough )
|
||||
{
|
||||
hsPoint3 pos = shapeL2W.GetTranslate();
|
||||
|
@ -172,7 +172,7 @@ hsBool plDynaRippleVSMgr::IRippleFromShape(const plPrintShape* shape, hsBool for
|
||||
|
||||
hsBool retVal = false;
|
||||
|
||||
plDynaDecalInfo& info = IGetDecalInfo(UInt32(shape), shape->GetKey());
|
||||
plDynaDecalInfo& info = IGetDecalInfo(unsigned_ptr(shape), shape->GetKey());
|
||||
|
||||
const hsMatrix44& shapeL2W = shape->GetOwner()->GetLocalToWorld();
|
||||
|
||||
@ -181,7 +181,8 @@ hsBool plDynaRippleVSMgr::IRippleFromShape(const plPrintShape* shape, hsBool for
|
||||
double t = hsTimer::GetSysSeconds();
|
||||
hsScalar dt = hsScalar(t - info.fLastTime) * sRand.RandZeroToOne();
|
||||
hsBool longEnough = (dt >= kMinTime);
|
||||
hsBool farEnough = (hsVector3(&info.fLastPos, &shapeL2W.GetTranslate()).Magnitude() > kMinDist);
|
||||
hsPoint3 xlate = shapeL2W.GetTranslate();
|
||||
hsBool farEnough = (hsVector3(&info.fLastPos, &xlate).Magnitude() > kMinDist);
|
||||
if( force || longEnough || farEnough )
|
||||
{
|
||||
hsPoint3 pos = shapeL2W.GetTranslate();
|
||||
|
@ -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(UInt32(this), GetKey());
|
||||
plDynaDecalInfo& info = IGetDecalInfo(unsigned_ptr(this), GetKey());
|
||||
|
||||
if( bull->PartyTime() > 0 )
|
||||
fPartyTime = bull->PartyTime();
|
||||
|
@ -173,7 +173,7 @@ hsBool plDynaWakeMgr::IRippleFromShape(const plPrintShape* shape, hsBool force)
|
||||
|
||||
hsBool retVal = false;
|
||||
|
||||
plDynaDecalInfo& info = IGetDecalInfo(UInt32(shape), shape->GetKey());
|
||||
plDynaDecalInfo& info = IGetDecalInfo(unsigned_ptr(shape), shape->GetKey());
|
||||
|
||||
const hsMatrix44& shapeL2W = shape->GetOwner()->GetLocalToWorld();
|
||||
|
||||
@ -182,7 +182,8 @@ hsBool plDynaWakeMgr::IRippleFromShape(const plPrintShape* shape, hsBool force)
|
||||
double t = hsTimer::GetSysSeconds();
|
||||
hsScalar dt = hsScalar(t - info.fLastTime) * sRand.RandZeroToOne();
|
||||
hsBool longEnough = (dt >= kMinTime);
|
||||
hsBool farEnough = (hsVector3(&info.fLastPos, &shapeL2W.GetTranslate()).Magnitude() > kMinDist);
|
||||
hsPoint3 xlate = shapeL2W.GetTranslate();
|
||||
hsBool farEnough = (hsVector3(&info.fLastPos, &xlate).Magnitude() > kMinDist);
|
||||
if( force || longEnough || farEnough )
|
||||
{
|
||||
hsPoint3 pos = shapeL2W.GetTranslate();
|
||||
@ -225,4 +226,4 @@ hsBool plDynaWakeMgr::IRippleFromShape(const plPrintShape* shape, hsBool force)
|
||||
retVal = true;
|
||||
}
|
||||
return retVal;
|
||||
}
|
||||
}
|
||||
|
@ -104,7 +104,8 @@ void inline IInlSetParticlePathFollow( const plParticleCore &particle, const hsM
|
||||
|
||||
/// Follow path specified by interpreting orientation as a velocity vector.
|
||||
|
||||
hsVector3 viewDir(&particle.fPos, &viewToWorld.GetTranslate());
|
||||
hsPoint3 xlate = viewToWorld.GetTranslate();
|
||||
hsVector3 viewDir(&particle.fPos, &xlate);
|
||||
hsFastMath::NormalizeAppr(viewDir);
|
||||
|
||||
zVec = viewDir;
|
||||
@ -152,7 +153,8 @@ void inline IInlSetParticlePathStretch( const plParticleCore &particle, const hs
|
||||
// Note that we could probably slim away a normalize or two, but the actual number
|
||||
// of normalizes we're doing hasn't gone up, I've just moved them up from IInlSetParticlePoints().
|
||||
|
||||
hsVector3 viewDir(&particle.fPos, &viewToWorld.GetTranslate());
|
||||
hsPoint3 xlate = viewToWorld.GetTranslate();
|
||||
hsVector3 viewDir(&particle.fPos, &xlate);
|
||||
hsScalar invD = hsFastMath::InvSqrtAppr(viewDir.MagnitudeSquared());
|
||||
viewDir *= invD;
|
||||
|
||||
@ -191,7 +193,8 @@ void inline IInlSetParticlePathFlow( const plParticleCore &particle, const hsMat
|
||||
// difference is that we're going to keep the area of the particle constant,
|
||||
// so the longer it stretches, the narrower it gets orthogonal to the velocity.
|
||||
|
||||
hsVector3 viewDir(&particle.fPos, &viewToWorld.GetTranslate());
|
||||
hsPoint3 xlate = viewToWorld.GetTranslate();
|
||||
hsVector3 viewDir(&particle.fPos, &xlate);
|
||||
hsScalar invD = hsFastMath::InvSqrtAppr(viewDir.MagnitudeSquared());
|
||||
viewDir *= invD;
|
||||
|
||||
@ -242,10 +245,12 @@ void inline IInlSetParticleExplicit( const hsMatrix44 &viewToWorld, const plPart
|
||||
// to calculate the vector from camera to particle and normalize it than
|
||||
// to transform the vector (0,0,-1) (though not as fast as pulling the
|
||||
// camera direction directly from the viewToWorld).
|
||||
hsVector3 del(&particle.fPos, &viewToWorld.GetTranslate());
|
||||
hsPoint3 xlate = viewToWorld.GetTranslate();
|
||||
hsVector3 del(&particle.fPos, &xlate);
|
||||
hsFastMath::NormalizeAppr(del);
|
||||
zVec = del;
|
||||
yVec.Set(&(viewToWorld * orientation));
|
||||
hsVector3 tmp = viewToWorld * orientation;
|
||||
yVec.Set(&tmp);
|
||||
xVec = yVec % zVec;
|
||||
#endif // See notes below - mf
|
||||
|
||||
@ -320,7 +325,8 @@ void inline IInlSetNormalStrongestLight( hsVector3 &partNorm, const plParticleCo
|
||||
{
|
||||
if( omniLight != nil )
|
||||
{
|
||||
partNorm.Set( &particle.fPos, &omniLight->GetWorldPosition() );
|
||||
hsPoint3 pos = omniLight->GetWorldPosition();
|
||||
partNorm.Set( &particle.fPos, &pos );
|
||||
partNorm = -partNorm;
|
||||
}
|
||||
else if( directionLight != nil )
|
||||
|
@ -551,7 +551,8 @@ plSpaceTree* plSpaceTreeMaker::IMakeEmptyTree()
|
||||
plSpaceTree* tree = TRACKED_NEW plSpaceTree;
|
||||
|
||||
tree->fTree.SetCount(1);
|
||||
tree->fTree[0].fWorldBounds.Reset(&hsPoint3(0,0,0));
|
||||
hsPoint3 zero(0, 0, 0);
|
||||
tree->fTree[0].fWorldBounds.Reset(&zero);
|
||||
tree->fTree[0].fFlags = plSpaceTreeNode::kEmpty;
|
||||
tree->fRoot = 0;
|
||||
tree->fNumLeaves = 0;
|
||||
@ -734,4 +735,4 @@ void plSpaceTreeMaker::IMakeSpaceTreeRecur(plSpacePrepNode* sub, plSpaceTree* tr
|
||||
IMakeSpaceTreeRecur(sub->fChildren[1], tree, targetLevel, currLevel+1);
|
||||
}
|
||||
|
||||
#endif // Leaves first
|
||||
#endif // Leaves first
|
||||
|
@ -31,7 +31,7 @@ set(plFile_HEADERS
|
||||
)
|
||||
|
||||
add_library(plFile STATIC ${plFile_SOURCES} ${plFile_HEADERS})
|
||||
target_link_libraries(plFile ${ZLIB_LIBRARIES})
|
||||
target_link_libraries(plFile CoreLib plUnifiedTime ${ZLIB_LIBRARIES})
|
||||
|
||||
source_group("Source Files" FILES ${plFile_SOURCES})
|
||||
source_group("Header Files" FILES ${plFile_HEADERS})
|
||||
|
@ -48,7 +48,6 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
#if HS_BUILD_FOR_UNIX
|
||||
#include <limits.h>
|
||||
#define kFolderIterator_MaxPath PATH_MAX
|
||||
#include <unistd.h>
|
||||
#define SetCurrentDirectory chdir
|
||||
#else
|
||||
#define kFolderIterator_MaxPath _MAX_PATH
|
||||
|
@ -103,7 +103,9 @@ hsBool plFileUtils::CreateDir( const wchar *path )
|
||||
#if HS_BUILD_FOR_WIN32
|
||||
return ( _wmkdir( path ) == 0 ) ? true : ( errno==EEXIST );
|
||||
#elif HS_BUILD_FOR_UNIX
|
||||
return ( mkdir( path, 0777 ) == 0 ) ? true : ( errno==EEXIST );
|
||||
const char* cpath = hsWStringToString(path);
|
||||
CreateDir(cpath);
|
||||
delete[] cpath; /* Free the string */
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -148,9 +150,15 @@ bool plFileUtils::RemoveFile(const char* filename, bool delReadOnly)
|
||||
|
||||
bool plFileUtils::RemoveFile(const wchar* filename, bool delReadOnly)
|
||||
{
|
||||
#ifdef HS_BUILD_FOR_WIN32
|
||||
if (delReadOnly)
|
||||
_wchmod(filename, S_IWRITE);
|
||||
return (_wunlink(filename) == 0);
|
||||
#elif HS_BUILD_FOR_UNIX
|
||||
const char* cfilename = hsWStringToString(filename);
|
||||
RemoveFile(cfilename, delReadOnly);
|
||||
delete[] cfilename; /* Free the string */
|
||||
#endif
|
||||
}
|
||||
|
||||
bool plFileUtils::FileCopy(const char* existingFile, const char* newFile)
|
||||
@ -169,8 +177,12 @@ bool plFileUtils::FileCopy(const wchar* existingFile, const wchar* newFile)
|
||||
return (::CopyFileW(existingFile, newFile, FALSE) != 0);
|
||||
#elif HS_BUILD_FOR_UNIX
|
||||
char data[1500];
|
||||
FILE* fp = fopen(existingFile, "rb");
|
||||
FILE* fw = fopen(newFile, "w");
|
||||
const char* cexisting = hsWStringToString(existingFile);
|
||||
const char* cnew = hsWStringToString(newFile);
|
||||
FILE* fp = fopen(cexisting, "rb");
|
||||
FILE* fw = fopen(cnew, "w");
|
||||
delete[] cexisting;
|
||||
delete[] cnew;
|
||||
int num = 0;
|
||||
bool retVal = true;
|
||||
if (fp && fw){
|
||||
@ -427,7 +439,22 @@ void plFileUtils::AddSlash(char* path)
|
||||
{
|
||||
char lastChar = path[strlen(path)-1];
|
||||
if (lastChar != '\\' && lastChar != '/')
|
||||
#if HS_BUILD_FOR_WIN32
|
||||
strcat(path, "\\");
|
||||
#else
|
||||
strcat(path, "/");
|
||||
#endif
|
||||
}
|
||||
|
||||
void plFileUtils::AddSlash(wchar* path)
|
||||
{
|
||||
wchar lastChar = path[wcslen(path)-1];
|
||||
if (lastChar != L'\\' && lastChar != L'/')
|
||||
#if HS_BUILD_FOR_WIN32
|
||||
wcscat(path, L"\\");
|
||||
#else
|
||||
wcscat(path, L"/");
|
||||
#endif
|
||||
}
|
||||
|
||||
void plFileUtils::ConcatFileName(char* path, const char* fileName)
|
||||
@ -436,6 +463,12 @@ void plFileUtils::ConcatFileName(char* path, const char* fileName)
|
||||
strcat(path, fileName);
|
||||
}
|
||||
|
||||
void plFileUtils::ConcatFileName(wchar* path, const wchar* fileName)
|
||||
{
|
||||
AddSlash(path);
|
||||
wcscat(path, fileName);
|
||||
}
|
||||
|
||||
//// GetFileSize /////////////////////////////////////////////////////////////
|
||||
|
||||
UInt32 plFileUtils::GetFileSize( const char *path )
|
||||
|
@ -107,9 +107,11 @@ namespace plFileUtils
|
||||
|
||||
// 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);
|
||||
|
||||
// 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);
|
||||
|
||||
// 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
|
||||
|
@ -46,6 +46,10 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
|
||||
#include <time.h>
|
||||
|
||||
#if !HS_BUILD_FOR_WIN32
|
||||
#define INVALID_HANDLE_VALUE 0
|
||||
#endif
|
||||
|
||||
// our default encryption key
|
||||
const UInt32 plSecureStream::kDefaultKey[4] = { 0x6c0a5452, 0x3827d0f, 0x3a170b92, 0x16db7fc2 };
|
||||
|
||||
@ -143,6 +147,7 @@ hsBool plSecureStream::Open(const wchar* name, const wchar* mode)
|
||||
{
|
||||
if (wcscmp(mode, L"rb") == 0)
|
||||
{
|
||||
#if HS_BUILD_FOR_WIN32
|
||||
if (fDeleteOnExit)
|
||||
{
|
||||
fRef = CreateFileW(name,
|
||||
@ -179,6 +184,23 @@ hsBool plSecureStream::Open(const wchar* name, const wchar* mode)
|
||||
|
||||
DWORD numBytesRead;
|
||||
ReadFile(fRef, &fActualFileSize, sizeof(UInt32), &numBytesRead, NULL);
|
||||
#elif HS_BUILD_FOR_UNIX
|
||||
const char* cname = hsWStringToString(name);
|
||||
fRef = fopen(cname, "rb");
|
||||
delete[] cname;
|
||||
|
||||
fPosition = 0;
|
||||
|
||||
if (fRef == INVALID_HANDLE_VALUE)
|
||||
return false;
|
||||
|
||||
if (!ICheckMagicString(fRef))
|
||||
{
|
||||
fclose(fRef);
|
||||
fRef = INVALID_HANDLE_VALUE;
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
// 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
|
||||
@ -221,7 +243,11 @@ hsBool plSecureStream::Close()
|
||||
}
|
||||
if (fRef != INVALID_HANDLE_VALUE)
|
||||
{
|
||||
#if HS_BUILD_FOR_WIN32
|
||||
rtn = CloseHandle(fRef);
|
||||
#elif HS_BUILD_FOR_UNIX
|
||||
rtn = fclose(fRef);
|
||||
#endif
|
||||
fRef = INVALID_HANDLE_VALUE;
|
||||
}
|
||||
|
||||
@ -248,8 +274,13 @@ UInt32 plSecureStream::IRead(UInt32 bytes, void* buffer)
|
||||
{
|
||||
if (fRef == INVALID_HANDLE_VALUE)
|
||||
return 0;
|
||||
DWORD numItems;
|
||||
bool success = (ReadFile(fRef, buffer, bytes, &numItems, NULL) != 0);
|
||||
UInt32 numItems;
|
||||
#if HS_BUILD_FOR_WIN32
|
||||
bool success = (ReadFile(fRef, buffer, bytes, (LPDWORD)&numItems, NULL) != 0);
|
||||
#elif HS_BUILD_FOR_UNIX
|
||||
numItems = fread(buffer, bytes, 1, fRef);
|
||||
bool success = numItems != 0;
|
||||
#endif
|
||||
fBytesRead += numItems;
|
||||
fPosition += numItems;
|
||||
if ((unsigned)numItems < bytes)
|
||||
@ -281,7 +312,11 @@ void plSecureStream::IBufferFile()
|
||||
fRAMStream->Rewind();
|
||||
|
||||
fBufferedStream = true;
|
||||
#if HS_BUILD_FOR_WIN32
|
||||
CloseHandle(fRef);
|
||||
#elif HS_BUILD_FOR_UNIX
|
||||
fclose(fRef);
|
||||
#endif
|
||||
fRef = INVALID_HANDLE_VALUE;
|
||||
fPosition = 0;
|
||||
}
|
||||
@ -305,7 +340,11 @@ void plSecureStream::Skip(UInt32 delta)
|
||||
{
|
||||
fBytesRead += delta;
|
||||
fPosition += delta;
|
||||
#if HS_BUILD_FOR_WIN32
|
||||
SetFilePointer(fRef, delta, 0, FILE_CURRENT);
|
||||
#elif HS_BUILD_FOR_UNIX
|
||||
fseek(fRef, delta, SEEK_CUR);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@ -320,7 +359,11 @@ void plSecureStream::Rewind()
|
||||
{
|
||||
fBytesRead = 0;
|
||||
fPosition = 0;
|
||||
#if HS_BUILD_FOR_WIN32
|
||||
SetFilePointer(fRef, kFileStartOffset, 0, FILE_BEGIN);
|
||||
#elif HS_BUILD_FOR_UNIX
|
||||
fseek(fRef, kFileStartOffset, SEEK_SET);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@ -333,7 +376,11 @@ void plSecureStream::FastFwd()
|
||||
}
|
||||
else if (fRef != INVALID_HANDLE_VALUE)
|
||||
{
|
||||
#if HS_BUILD_FOR_WIN32
|
||||
fBytesRead = fPosition = SetFilePointer(fRef, kFileStartOffset + fActualFileSize, 0, FILE_BEGIN);
|
||||
#elif HS_BUILD_FOR_UNIX
|
||||
fBytesRead = fPosition = fseek(fRef, 0, SEEK_END);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@ -551,11 +598,15 @@ bool plSecureStream::FileDecrypt(const wchar* fileName, UInt32* key /* = nil */)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool plSecureStream::ICheckMagicString(HANDLE fp)
|
||||
bool plSecureStream::ICheckMagicString(hsFD fp)
|
||||
{
|
||||
char magicString[kMagicStringLen+1];
|
||||
DWORD numBytesRead;
|
||||
ReadFile(fp, &magicString, kMagicStringLen, &numBytesRead, NULL);
|
||||
#ifdef HS_BUILD_FOR_WIN32
|
||||
DWORD numread;
|
||||
ReadFile(fp, &magicString, kMagicStringLen, &numread, NULL);
|
||||
#elif HS_BUILD_FOR_UNIX
|
||||
fread(&magicString, kMagicStringLen, 1, fp);
|
||||
#endif
|
||||
magicString[kMagicStringLen] = '\0';
|
||||
return (hsStrEQ(magicString, kMagicString) != 0);
|
||||
}
|
||||
@ -570,7 +621,9 @@ bool plSecureStream::IsSecureFile(const char* fileName)
|
||||
|
||||
bool plSecureStream::IsSecureFile(const wchar* fileName)
|
||||
{
|
||||
HANDLE fp = INVALID_HANDLE_VALUE;
|
||||
hsFD fp = INVALID_HANDLE_VALUE;
|
||||
|
||||
#if HS_BUILD_FOR_WIN32
|
||||
fp = CreateFileW(fileName,
|
||||
GENERIC_READ, // open for reading
|
||||
0, // no one can open the file until we're done
|
||||
@ -578,13 +631,22 @@ bool plSecureStream::IsSecureFile(const wchar* fileName)
|
||||
OPEN_EXISTING, // only open existing files (no creation)
|
||||
FILE_ATTRIBUTE_NORMAL, // normal file attributes
|
||||
NULL); // no template
|
||||
#elif HS_BUILD_FOR_UNIX
|
||||
const char* cfile = hsWStringToString(fileName);
|
||||
fp = fopen(cfile, "rb");
|
||||
delete[] cfile;
|
||||
#endif
|
||||
|
||||
if (fp == INVALID_HANDLE_VALUE)
|
||||
return false;
|
||||
|
||||
bool isEncrypted = ICheckMagicString(fp);
|
||||
|
||||
#if HS_BUILD_FOR_WIN32
|
||||
CloseHandle(fp);
|
||||
#elif HS_BUILD_FOR_UNIX
|
||||
fclose(fp);
|
||||
#endif
|
||||
|
||||
return isEncrypted;
|
||||
}
|
||||
@ -637,4 +699,4 @@ hsStream* plSecureStream::OpenSecureFileWrite(const wchar* fileName, UInt32* key
|
||||
|
||||
s->Open(fileName, L"wb");
|
||||
return s;
|
||||
}
|
||||
}
|
||||
|
@ -43,7 +43,13 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
#define plSecureStream_h_inc
|
||||
|
||||
#include "hsStream.h"
|
||||
#include <windows.h>
|
||||
|
||||
#if HS_BUILD_FOR_WIN32
|
||||
# include <windows.h>
|
||||
# define hsFD HANDLE
|
||||
#else
|
||||
# define hsFD FILE*
|
||||
#endif
|
||||
|
||||
// A slightly more secure stream then plEncryptedStream in that it uses windows file functions
|
||||
// to prevent other processes from accessing the file it is working with. It also can be set
|
||||
@ -53,7 +59,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
class plSecureStream: public hsStream
|
||||
{
|
||||
protected:
|
||||
HANDLE fRef;
|
||||
hsFD fRef;
|
||||
UInt32 fKey[4];
|
||||
|
||||
UInt32 fActualFileSize;
|
||||
@ -78,7 +84,7 @@ protected:
|
||||
|
||||
bool IWriteEncrypted(hsStream* sourceStream, const wchar* outputFile);
|
||||
|
||||
static bool ICheckMagicString(HANDLE fp);
|
||||
static bool ICheckMagicString(hsFD fp);
|
||||
|
||||
public:
|
||||
plSecureStream(hsBool deleteOnExit = false, UInt32* key = nil); // uses default key if you don't pass one in
|
||||
|
@ -46,6 +46,10 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
#include "plEncryptedStream.h"
|
||||
#include "plFileUtils.h"
|
||||
|
||||
#if HS_BUILD_FOR_UNIX
|
||||
# include <wctype.h>
|
||||
#endif
|
||||
|
||||
void ToLower(std::wstring& str)
|
||||
{
|
||||
for (unsigned i = 0; i < str.length(); i++)
|
||||
@ -209,4 +213,4 @@ plStreamSource* plStreamSource::GetInstance()
|
||||
{
|
||||
static plStreamSource source;
|
||||
return &source;
|
||||
}
|
||||
}
|
||||
|
@ -3,7 +3,9 @@ include_directories("../../NucleusLib/inc")
|
||||
include_directories("../../NucleusLib")
|
||||
include_directories("../../PubUtilLib")
|
||||
|
||||
include_directories(${DirectX_INCLUDE_DIR})
|
||||
if(WIN32)
|
||||
include_directories(${DirectX_INCLUDE_DIR})
|
||||
endif(WIN32)
|
||||
include_directories(${OPENAL_INCLUDE_DIR})
|
||||
|
||||
set(plInputCore_SOURCES
|
||||
|
@ -44,7 +44,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
#ifndef PL_INPUT_MANAGER_H
|
||||
#define PL_INPUT_MANAGER_H
|
||||
|
||||
#include <windows.h>
|
||||
#include "hsWindows.h"
|
||||
#include "hsTypes.h"
|
||||
#include "hsTemplates.h"
|
||||
#include "pnKeyedObject/hsKeyedObject.h"
|
||||
|
@ -120,7 +120,10 @@ void plAnimPath::SetCurTime(hsScalar t, UInt32 calcFlags)
|
||||
fVel.Set(pos+1, pos+0);
|
||||
fVel *= kInvSmallDelTime;
|
||||
fVel = fLocalToWorld * fVel;
|
||||
fAccel.Set(&(pos[2] - pos[1]), &(pos[1] - pos[0]));
|
||||
|
||||
hsPoint3 first = pos[2] - pos[1];
|
||||
hsPoint3 second = pos[1] - pos[0];
|
||||
fAccel.Set(&first, &second);
|
||||
fAccel *= kInvSmallDelTime * kInvSmallDelTime;
|
||||
fAccel = fLocalToWorld * fAccel;
|
||||
}
|
||||
|
@ -42,7 +42,6 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
#ifndef plAgeLoadedMsg_INC
|
||||
#define plAgeLoadedMsg_INC
|
||||
|
||||
#include "pnUtils/pnUtils.h"
|
||||
#include "pnMessage/plMessage.h"
|
||||
|
||||
//
|
||||
|
@ -52,7 +52,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
#include "hsStream.h"
|
||||
#include "hsResMgr.h"
|
||||
#include "pnMessage/plMessage.h"
|
||||
#include "pnUtils/pnUtils.h"
|
||||
#include "pnUUID/pnUUID.h"
|
||||
|
||||
class plInputInterface;
|
||||
class plInputIfaceMgrMsg : public plMessage
|
||||
@ -65,7 +65,7 @@ class plInputIfaceMgrMsg : public plMessage
|
||||
const char* ageName;
|
||||
const char* ageFileName;
|
||||
const char* spawnPoint;
|
||||
Uuid ageInstanceGuid;
|
||||
plUUID ageInstanceGuid;
|
||||
plKey fAvKey;
|
||||
public:
|
||||
|
||||
@ -125,8 +125,8 @@ class plInputIfaceMgrMsg : public plMessage
|
||||
const char* GetAgeFileName() { return ageFileName; }
|
||||
void SetSpawnPoint(const char* s) { spawnPoint = s; }
|
||||
const char* GetSpawnPoint() { return spawnPoint; }
|
||||
void SetAgeInstanceGuid(const Uuid& guid) { ageInstanceGuid = guid; }
|
||||
const Uuid& GetAgeInstanceGuid() { return ageInstanceGuid; }
|
||||
void SetAgeInstanceGuid(const plUUID& guid) { ageInstanceGuid = guid; }
|
||||
const plUUID& GetAgeInstanceGuid() { return ageInstanceGuid; }
|
||||
UInt8 GetCommand( void ) { return fCommand; }
|
||||
UInt32 GetPageID( void ) { return fPageID; }
|
||||
void SetIFace( plInputInterface *iface );
|
||||
|
@ -43,7 +43,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
#define plLoadAgeMsg_INC
|
||||
|
||||
#include "pnMessage/plMessage.h"
|
||||
#include "plUUID/plUUID.h"
|
||||
#include "pnUUID/pnUUID.h"
|
||||
#include "hsUtils.h"
|
||||
|
||||
//
|
||||
|
@ -45,7 +45,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
#include "hsConfig.h"
|
||||
#include "hsStlUtils.h"
|
||||
#include "pnFactory/plCreatable.h"
|
||||
#include "plUUID/plUUID.h"
|
||||
#include "pnUUID/pnUUID.h"
|
||||
|
||||
class plClientGuid : public plCreatable
|
||||
{
|
||||
|
@ -41,7 +41,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
*==LICENSE==*/
|
||||
#include "plNetCommon.h"
|
||||
#include "hsStlUtils.h"
|
||||
#include "plUUID/plUUID.h"
|
||||
#include "pnUUID/pnUUID.h"
|
||||
#include <algorithm>
|
||||
|
||||
namespace plNetCommon
|
||||
|
@ -55,10 +55,6 @@ REGISTER_CREATABLE( plNetCoreStatsSummary );
|
||||
#endif // SERVER
|
||||
REGISTER_CREATABLE( plCreatableListHelper );
|
||||
|
||||
// HACK: plUUID should have it's own creatable include
|
||||
#include "../plUUID/plUUID.h"
|
||||
REGISTER_CREATABLE( plCreatableUuid );
|
||||
|
||||
#include "plClientGuid.h"
|
||||
REGISTER_CREATABLE( plClientGuid );
|
||||
#include "plNetServerSessionInfo.h"
|
||||
|
@ -47,7 +47,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
#include "pnFactory/plCreatable.h"
|
||||
#include "pnNetCommon/plNetServers.h"
|
||||
#include "plNetCommon/plSpawnPointInfo.h"
|
||||
#include "plUUID/plUUID.h"
|
||||
#include "pnUUID/pnUUID.h"
|
||||
|
||||
|
||||
class hsStream;
|
||||
|
@ -104,7 +104,8 @@ void plConvexVolume::Update(const hsMatrix44 &l2w)
|
||||
{
|
||||
// Since fN is an hsVector3, it will only apply the rotational aspect of the transform...
|
||||
fWorldPlanes[i].fN = l2w * fLocalPlanes[i].fN;
|
||||
planePt.Set(&(fLocalPlanes[i].fN * fLocalPlanes[i].fD));
|
||||
hsVector3 tmp = fLocalPlanes[i].fN * fLocalPlanes[i].fD;
|
||||
planePt.Set(&tmp);
|
||||
fWorldPlanes[i].fD = -(l2w * planePt).InnerProduct(fWorldPlanes[i].fN);
|
||||
}
|
||||
}
|
||||
|
@ -759,7 +759,8 @@ hsBool plParticleFlockEffect::ApplyEffect(const plEffectTargetInfo& target, Int3
|
||||
goal = fDissenterTarget;
|
||||
|
||||
hsVector3 goalDir;
|
||||
goalDir.Set(&(goal - pos));
|
||||
hsPoint3 tmp = goal - pos;
|
||||
goalDir.Set(&tmp);
|
||||
hsScalar distSq = goalDir.MagnitudeSquared();
|
||||
|
||||
goalDir.Normalize();
|
||||
|
@ -410,7 +410,11 @@ void plParticleEmitter::IUpdateParticles(hsScalar delta)
|
||||
|
||||
// This is the only orientation option (so far) that requires an update here
|
||||
if (fMiscFlags & (kOrientationVelocityBased | kOrientationVelocityStretch | kOrientationVelocityFlow))
|
||||
fParticleCores[i].fOrientation.Set(&(*currVelocity * delta)); // mf - want the orientation to be a delposition
|
||||
{
|
||||
// mf - want the orientation to be a delposition
|
||||
hsVector3 tmp = *currVelocity * delta;
|
||||
fParticleCores[i].fOrientation.Set(&tmp);
|
||||
}
|
||||
else if( fParticleExts[i].fRadsPerSec != 0 )
|
||||
{
|
||||
hsScalar sinX, cosX;
|
||||
|
@ -216,7 +216,8 @@ hsBool plSimpleParticleGenerator::AddAutoParticles(plParticleEmitter *emitter, f
|
||||
if( fPartRadsPerSecRange > 0 )
|
||||
radsPerSec = fPartRadsPerSecRange * sRandom.RandMinusOneToOne();
|
||||
|
||||
emitter->AddParticle(currStart, initDirection * initVelocity, tile, fXSize, fYSize, currSizeVar,
|
||||
hsVector3 tmp = initDirection * initVelocity;
|
||||
emitter->AddParticle(currStart, tmp, tile, fXSize, fYSize, currSizeVar,
|
||||
invMass, initLife, orientation, miscFlags, radsPerSec);
|
||||
}
|
||||
|
||||
@ -451,4 +452,4 @@ void plOneTimeParticleGenerator::Write(hsStream* s, hsResMgr *mgr)
|
||||
fPosition[i].Write(s);
|
||||
fDirection[i].Write(s);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -93,7 +93,7 @@ class plObjectInVolumeDetector : public plCollisionDetector
|
||||
public:
|
||||
class plCollisionBookKeepingInfo
|
||||
{
|
||||
friend plObjectInVolumeDetector;
|
||||
friend class plObjectInVolumeDetector;
|
||||
public:
|
||||
plCollisionBookKeepingInfo(plKey& hit)
|
||||
{
|
||||
|
@ -7,7 +7,9 @@ include_directories("../../PubUtilLib")
|
||||
if(Bink_SDK_AVAILABLE)
|
||||
include_directories(${Bink_INCLUDE_DIR})
|
||||
endif()
|
||||
include_directories(${DirectX_INCLUDE_DIR})
|
||||
if(WIN32)
|
||||
include_directories(${DirectX_INCLUDE_DIR})
|
||||
endif(WIN32)
|
||||
|
||||
set(plPipeline_SOURCES
|
||||
hsG3DDeviceSelector.cpp
|
||||
@ -89,4 +91,4 @@ add_library(plPipeline STATIC ${plPipeline_SOURCES} ${plPipeline_HEADERS} ${plPi
|
||||
|
||||
source_group("Source Files" FILES ${plPipeline_SOURCES})
|
||||
source_group("Header Files" FILES ${plPipeline_HEADERS})
|
||||
source_group("DeviceRefs" FILES ${plPipeline_DEVICEREFS})
|
||||
source_group("DeviceRefs" FILES ${plPipeline_DEVICEREFS})
|
||||
|
@ -448,7 +448,7 @@ public:
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <stdio.h>
|
||||
#include "headspin.h"
|
||||
#include "HeadSpin.h"
|
||||
|
||||
class plDemoDebugFile
|
||||
{
|
||||
|
@ -70,7 +70,7 @@ plProgressMgr *plProgressMgr::fManager = nil;
|
||||
|
||||
char* plProgressMgr::fImageRotation[LOADING_RES_COUNT];
|
||||
|
||||
char* plProgressMgr::fStaticTextIDs[] = {
|
||||
const char* plProgressMgr::fStaticTextIDs[] = {
|
||||
"xLoading_Linking_Text.png",
|
||||
"xLoading_Updating_Text.png"
|
||||
};
|
||||
@ -249,7 +249,7 @@ char* plProgressMgr::GetLoadingFrameID(int index)
|
||||
return fImageRotation[0];
|
||||
}
|
||||
|
||||
char* plProgressMgr::GetStaticTextID(StaticText staticTextType)
|
||||
const char* plProgressMgr::GetStaticTextID(StaticText staticTextType)
|
||||
{
|
||||
return fStaticTextIDs[staticTextType];
|
||||
}
|
||||
|
@ -197,7 +197,7 @@ class plProgressMgr
|
||||
|
||||
static plProgressMgr *fManager;
|
||||
static char* fImageRotation[];
|
||||
static char* fStaticTextIDs[];
|
||||
static const char* fStaticTextIDs[];
|
||||
|
||||
protected:
|
||||
|
||||
@ -230,7 +230,7 @@ class plProgressMgr
|
||||
|
||||
static plProgressMgr* GetInstance() { return fManager; }
|
||||
static char* GetLoadingFrameID(int index);
|
||||
static char* GetStaticTextID(StaticText staticTextType);
|
||||
static const char* GetStaticTextID(StaticText staticTextType);
|
||||
|
||||
virtual void Draw( plPipeline *p ) { }
|
||||
|
||||
|
@ -34,6 +34,7 @@ set(plResMgr_HEADERS
|
||||
)
|
||||
|
||||
add_library(plResMgr STATIC ${plResMgr_SOURCES} ${plResMgr_HEADERS})
|
||||
target_link_libraries(plResMgr CoreLib pnDispatch pnFactory pnKeyedObject pnMessage pnTimer plFile plStatusLog)
|
||||
|
||||
source_group("Source Files" FILES ${plResMgr_SOURCES})
|
||||
source_group("Header Files" FILES ${plResMgr_HEADERS})
|
||||
|
@ -516,8 +516,8 @@ private:
|
||||
plVarDescriptor*& curVar) const;
|
||||
bool IParseStateDesc(const char* fileName, hsStream* stream, char token[], plStateDescriptor*& curDesc) const;
|
||||
|
||||
void DebugMsg(char* fmt, ...) const;
|
||||
void DebugMsgV(char* fmt, va_list args) const;
|
||||
void DebugMsg(const char* fmt, ...) const;
|
||||
void DebugMsgV(const char* fmt, va_list args) const;
|
||||
|
||||
public:
|
||||
|
||||
|
@ -49,7 +49,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
|
||||
static const int kTokenLen=256;
|
||||
|
||||
void plSDLParser::DebugMsg(char* fmt, ...) const
|
||||
void plSDLParser::DebugMsg(const char* fmt, ...) const
|
||||
{
|
||||
return;
|
||||
plNetApp* netApp = plSDLMgr::GetInstance()->GetNetApp();
|
||||
@ -66,7 +66,7 @@ void plSDLParser::DebugMsg(char* fmt, ...) const
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
void plSDLParser::DebugMsgV(char* fmt, va_list args) const
|
||||
void plSDLParser::DebugMsgV(const char* fmt, va_list args) const
|
||||
{
|
||||
if (strlen(fmt)==nil)
|
||||
return;
|
||||
|
@ -185,7 +185,8 @@ plSpaceTree* plSceneNode::IBuildSpaceTree()
|
||||
maker.Reset();
|
||||
|
||||
hsBounds3Ext bnd;
|
||||
bnd.Reset(&hsPoint3(0,0,0));
|
||||
hsPoint3 zero(0, 0, 0);
|
||||
bnd.Reset(&zero);
|
||||
|
||||
int i;
|
||||
for( i = 0; i < fDrawPool.GetCount(); i++ )
|
||||
|
@ -16,6 +16,7 @@ set(plStatusLog_HEADERS
|
||||
)
|
||||
|
||||
add_library(plStatusLog STATIC ${plStatusLog_SOURCES} ${plStatusLog_HEADERS})
|
||||
target_link_libraries(plStatusLog CoreLib plFile plUnifiedTime)
|
||||
|
||||
source_group("Source Files" FILES ${plStatusLog_SOURCES})
|
||||
source_group("Header Files" FILES ${plStatusLog_HEADERS})
|
||||
|
@ -66,7 +66,6 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
#include "hsStlUtils.h"
|
||||
#include "plFile/hsFiles.h"
|
||||
#include "plUnifiedTime/plUnifiedTime.h"
|
||||
#include "pnUtils/pnUtils.h"
|
||||
#include "pnProduct/pnProduct.h"
|
||||
|
||||
#include "plEncryptLogLine.h"
|
||||
@ -91,7 +90,8 @@ plStatusLogMgr::plStatusLogMgr()
|
||||
fDrawer = nil;
|
||||
fLastLogChangeTime = 0;
|
||||
|
||||
PathGetLogDirectory(fBasePath, arrsize(fBasePath));
|
||||
plFileUtils::ConcatFileName(fBasePath, L"log");
|
||||
plFileUtils::EnsureFilePathExists(fBasePath);
|
||||
}
|
||||
|
||||
plStatusLogMgr::~plStatusLogMgr()
|
||||
@ -352,6 +352,7 @@ bool plStatusLogMgr::DumpLogs( const wchar *newFolderName )
|
||||
newPath = newFolderName;
|
||||
IEnsurePathExists(newPath.c_str());
|
||||
|
||||
#if HS_BUILD_FOR_WIN32
|
||||
hsWFolderIterator folderIterator;
|
||||
if (fBasePath)
|
||||
folderIterator.SetPath(fBasePath);
|
||||
@ -382,6 +383,7 @@ bool plStatusLogMgr::DumpLogs( const wchar *newFolderName )
|
||||
bool succeeded = (CopyFileW(source.c_str(), destination.c_str(), FALSE) != 0);
|
||||
retVal = retVal && succeeded;
|
||||
}
|
||||
#endif
|
||||
return retVal;
|
||||
}
|
||||
|
||||
@ -468,21 +470,21 @@ bool plStatusLog::IReOpen( void )
|
||||
{
|
||||
wchar work[MAX_PATH], work2[MAX_PATH];
|
||||
swprintf(work, MAX_PATH, L"%s.3%s",fileNoExt,ext);
|
||||
_wremove(work);
|
||||
plFileUtils::RemoveFile(work);
|
||||
swprintf(work2, MAX_PATH, L"%s.2%s",fileNoExt,ext);
|
||||
_wrename(work2, work);
|
||||
plFileUtils::FileMove(work2, work);
|
||||
swprintf(work, MAX_PATH, L"%s.1%s",fileNoExt,ext);
|
||||
_wrename(work, work2);
|
||||
_wrename(fileToOpen, work);
|
||||
plFileUtils::FileMove(work, work2);
|
||||
plFileUtils::FileMove(fileToOpen, work);
|
||||
}
|
||||
|
||||
if (fFlags & kAppendToLast)
|
||||
{
|
||||
fFileHandle = _wfopen( fileToOpen, fEncryptMe ? L"ab" : L"at" );
|
||||
fFileHandle = hsWFopen( fileToOpen, fEncryptMe ? L"ab" : L"at" );
|
||||
}
|
||||
else
|
||||
{
|
||||
fFileHandle = _wfopen( fileToOpen, fEncryptMe ? L"wb" : L"wt" );
|
||||
fFileHandle = hsWFopen( fileToOpen, fEncryptMe ? L"wb" : L"wt" );
|
||||
// if we need to reopen lets just append
|
||||
fFlags |= kAppendToLast;
|
||||
}
|
||||
@ -542,7 +544,7 @@ void plStatusLog::IParseFileName(wchar* file, size_t fnsize, wchar* fileNoExt, w
|
||||
else
|
||||
{
|
||||
wcscpy(fileNoExt, file);
|
||||
*ext = L"";
|
||||
*ext = L'\0';
|
||||
}
|
||||
|
||||
}
|
||||
@ -649,7 +651,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, (UInt32)c - (UInt32)str, color );
|
||||
ret = IAddLine( str, (unsigned_ptr)c - (unsigned_ptr)str, color );
|
||||
}
|
||||
|
||||
/// We might have some left over
|
||||
@ -789,49 +791,44 @@ bool plStatusLog::IPrintLineToFile( const char *line, UInt32 count )
|
||||
{
|
||||
if ( fFlags & kTimestamp )
|
||||
{
|
||||
StrPrintf(work, arrsize(work), "(%s) ", plUnifiedTime(kNow).Format("%m/%d %H:%M:%S").c_str());
|
||||
StrPack(buf, work, arrsize(buf));
|
||||
snprintf(work, arrsize(work), "(%s) ", plUnifiedTime(kNow).Format("%m/%d %H:%M:%S").c_str());
|
||||
strncat(buf, work, arrsize(work));
|
||||
}
|
||||
if ( fFlags & kTimestampGMT )
|
||||
{
|
||||
StrPrintf(work, arrsize(work), "(%s) ", plUnifiedTime::GetCurrentTime().Format("%m/%d %H:%M:%S UTC").c_str());
|
||||
StrPack(buf, work, arrsize(buf));
|
||||
snprintf(work, arrsize(work), "(%s) ", plUnifiedTime::GetCurrentTime().Format("%m/%d %H:%M:%S UTC").c_str());
|
||||
strncat(buf, work, arrsize(work));
|
||||
}
|
||||
if ( fFlags & kTimeInSeconds )
|
||||
{
|
||||
StrPrintf(work, arrsize(work), "(%lu) ", (unsigned long)plUnifiedTime(kNow).GetSecs());
|
||||
StrPack(buf, work, arrsize(buf));
|
||||
snprintf(work, arrsize(work), "(%lu) ", (unsigned long)plUnifiedTime(kNow).GetSecs());
|
||||
strncat(buf, work, arrsize(work));
|
||||
}
|
||||
if ( fFlags & kTimeAsDouble )
|
||||
{
|
||||
StrPrintf(work, arrsize(work), "(%f) ", plUnifiedTime(kNow).GetSecsDouble());
|
||||
StrPack(buf, work, arrsize(buf));
|
||||
snprintf(work, arrsize(work), "(%f) ", plUnifiedTime(kNow).GetSecsDouble());
|
||||
strncat(buf, work, arrsize(work));
|
||||
}
|
||||
if (fFlags & kRawTimeStamp)
|
||||
{
|
||||
StrPrintf(work, arrsize(work), "[t=%10u] ", hsTimer::GetSeconds());
|
||||
StrPack(buf, work, arrsize(buf));
|
||||
snprintf(work, arrsize(work), "[t=%10u] ", hsTimer::GetSeconds());
|
||||
strncat(buf, work, arrsize(work));
|
||||
}
|
||||
if (fFlags & kThreadID)
|
||||
{
|
||||
StrPrintf(work, arrsize(work), "[t=%u] ", hsThread::GetMyThreadId());
|
||||
StrPack(buf, work, arrsize(buf));
|
||||
snprintf(work, arrsize(work), "[t=%u] ", hsThread::GetMyThreadId());
|
||||
strncat(buf, work, arrsize(work));
|
||||
}
|
||||
|
||||
// find the size of the buf plus the size of the line and only pack that much
|
||||
unsigned BufAndLine = StrLen(buf)+count+1;
|
||||
if ( BufAndLine > arrsize(buf) )
|
||||
BufAndLine = arrsize(buf);
|
||||
|
||||
StrPack(buf, line, BufAndLine );
|
||||
strncat(buf, line, arrsize(line));
|
||||
|
||||
if(!fEncryptMe )
|
||||
{
|
||||
StrPack(buf, "\n", arrsize(buf));
|
||||
strncat(buf, "\n", 1);
|
||||
}
|
||||
}
|
||||
|
||||
unsigned length = StrLen(buf);
|
||||
unsigned length = strlen(buf);
|
||||
|
||||
#ifdef PLASMA_EXTERNAL_RELEASE
|
||||
// Print to a separate line, since we have to encrypt it
|
||||
|
@ -218,7 +218,7 @@ hsBool plGrassShaderMod::IEval(double secs, hsScalar del, UInt32 dirty)
|
||||
fVShader->SetVector(plGrassVS::kAppConsts, float(hsTimer::GetSysSeconds()), 0.f, 0.f, 0.f);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
void plGrassShaderMod::ISetupShaders()
|
||||
@ -272,4 +272,4 @@ void plGrassShaderMod::ISetupShaders()
|
||||
plLayRefMsg* refMsg = TRACKED_NEW plLayRefMsg(layer->GetKey(), plRefMsg::kOnCreate, 0, plLayRefMsg::kPixelShader);
|
||||
hsgResMgr::ResMgr()->SendRef(fPShader->GetKey(), refMsg, plRefFlags::kActiveRef);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,22 +0,0 @@
|
||||
include_directories("../../CoreLib")
|
||||
include_directories("../../NucleusLib")
|
||||
include_directories("../../PubUtilLib")
|
||||
|
||||
set(plUUID_SOURCES
|
||||
plUUID.cpp
|
||||
)
|
||||
|
||||
if(WIN32)
|
||||
set(plUUID_SOURCES ${plUUID_SOURCES} plUUID_Win32.cpp)
|
||||
else(WIN32)
|
||||
set(plUUID_SOURCES ${plUUID_SOURCES} plUUID_Unix.cpp)
|
||||
endif(WIN32)
|
||||
|
||||
set(plUUID_HEADERS
|
||||
plUUID.h
|
||||
)
|
||||
|
||||
add_library(plUUID STATIC ${plUUID_SOURCES} ${plUUID_HEADERS})
|
||||
|
||||
source_group("Source Files" FILES ${plUUID_SOURCES})
|
||||
source_group("Header Files" FILES ${plUUID_HEADERS})
|
@ -1,121 +0,0 @@
|
||||
/*==LICENSE==*
|
||||
|
||||
CyanWorlds.com Engine - MMOG client, server and tools
|
||||
Copyright (C) 2011 Cyan Worlds, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Additional permissions under GNU GPL version 3 section 7
|
||||
|
||||
If you modify this Program, or any covered work, by linking or
|
||||
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
|
||||
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
|
||||
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
|
||||
(or a modified version of those libraries),
|
||||
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
|
||||
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
|
||||
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
|
||||
licensors of this Program grant you additional
|
||||
permission to convey the resulting work. Corresponding Source for a
|
||||
non-source form of such a combination shall include the source code for
|
||||
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
|
||||
work.
|
||||
|
||||
You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
or by snail mail at:
|
||||
Cyan Worlds, Inc.
|
||||
14617 N Newport Hwy
|
||||
Mead, WA 99021
|
||||
|
||||
*==LICENSE==*/
|
||||
#include "plUUID.h"
|
||||
#include "hsStream.h"
|
||||
|
||||
COMPILER_ASSERT(msizeof(Uuid, data) == msizeof(plUUID, fData));
|
||||
|
||||
plUUID::plUUID()
|
||||
{
|
||||
Clear();
|
||||
}
|
||||
|
||||
plUUID::plUUID( const char * s )
|
||||
{
|
||||
FromString( s );
|
||||
}
|
||||
|
||||
plUUID::plUUID( const plUUID & other )
|
||||
{
|
||||
CopyFrom( &other );
|
||||
}
|
||||
|
||||
plUUID::plUUID( const Uuid & uuid )
|
||||
{
|
||||
MemCopy(fData, uuid.data, sizeof(fData));
|
||||
}
|
||||
|
||||
void plUUID::Read( hsStream * s)
|
||||
{
|
||||
s->LogSubStreamPushDesc("plUUID");
|
||||
s->Read( sizeof( fData ), (void*)fData );
|
||||
}
|
||||
|
||||
void plUUID::Write( hsStream * s)
|
||||
{
|
||||
s->Write( sizeof( fData ), (const void*)fData );
|
||||
}
|
||||
|
||||
plUUID::operator Uuid () const {
|
||||
Uuid uuid;
|
||||
MemCopy(uuid.data, fData, sizeof(uuid.data));
|
||||
return uuid;
|
||||
}
|
||||
|
||||
const char * plUUID::AsString() const {
|
||||
static std::string str;
|
||||
ToStdString(str);
|
||||
return str.c_str();
|
||||
}
|
||||
|
||||
void plUUID::CopyFrom( const plUUID * v ) {
|
||||
if (!v)
|
||||
Clear();
|
||||
else
|
||||
CopyFrom(*v);
|
||||
}
|
||||
|
||||
void plUUID::CopyFrom( const plUUID & v ) {
|
||||
MemCopy(fData, v.fData, sizeof(fData));
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
*
|
||||
* plCreatableUuid
|
||||
*
|
||||
***/
|
||||
|
||||
//============================================================================
|
||||
plCreatableUuid::plCreatableUuid () {
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
plCreatableUuid::plCreatableUuid (const plCreatableUuid & other)
|
||||
: plUUID(other)
|
||||
{
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
plCreatableUuid::plCreatableUuid (const plUUID & other)
|
||||
: plUUID(other)
|
||||
{
|
||||
}
|
@ -1,104 +0,0 @@
|
||||
/*==LICENSE==*
|
||||
|
||||
CyanWorlds.com Engine - MMOG client, server and tools
|
||||
Copyright (C) 2011 Cyan Worlds, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Additional permissions under GNU GPL version 3 section 7
|
||||
|
||||
If you modify this Program, or any covered work, by linking or
|
||||
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
|
||||
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
|
||||
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
|
||||
(or a modified version of those libraries),
|
||||
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
|
||||
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
|
||||
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
|
||||
licensors of this Program grant you additional
|
||||
permission to convey the resulting work. Corresponding Source for a
|
||||
non-source form of such a combination shall include the source code for
|
||||
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
|
||||
work.
|
||||
|
||||
You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
or by snail mail at:
|
||||
Cyan Worlds, Inc.
|
||||
14617 N Newport Hwy
|
||||
Mead, WA 99021
|
||||
|
||||
*==LICENSE==*/
|
||||
#ifndef plUUID_h_inc
|
||||
#define plUUID_h_inc
|
||||
|
||||
#include "hsTypes.h"
|
||||
#include "hsStlUtils.h"
|
||||
#include "pnUtils/pnUtils.h"
|
||||
#include "pnFactory/plCreatable.h"
|
||||
|
||||
class hsStream;
|
||||
|
||||
class plUUID
|
||||
{
|
||||
// must be first field in class
|
||||
public:
|
||||
UInt8 fData[16];
|
||||
struct Match
|
||||
{
|
||||
const plUUID * fGuid;
|
||||
Match( const plUUID * guid ):fGuid( guid ){}
|
||||
bool operator()( const plUUID * guid ) const { return guid->IsEqualTo( fGuid );}
|
||||
};
|
||||
|
||||
plUUID();
|
||||
plUUID( const char * s );
|
||||
plUUID( const plUUID & other );
|
||||
plUUID( const Uuid & uuid );
|
||||
void Clear();
|
||||
bool IsNull() const;
|
||||
bool IsSet() const { return !IsNull(); }
|
||||
void CopyFrom( const plUUID * v );
|
||||
void CopyFrom( const plUUID & v );
|
||||
int CompareTo( const plUUID * v ) const;
|
||||
bool IsEqualTo( const plUUID * v ) const;
|
||||
bool FromString( const char * str );
|
||||
bool ToStdString( std::string & out ) const;
|
||||
inline std::string AsStdString() const { return AsString(); }
|
||||
const char * AsString() const; // returns static buffer
|
||||
void Read( hsStream * s );
|
||||
void Write( hsStream * s );
|
||||
operator std::string ( void ) const { return AsStdString();}
|
||||
bool operator==( const plUUID & other ) const { return IsEqualTo( &other ); }
|
||||
bool operator!=( const plUUID & other ) const { return !IsEqualTo( &other ); }
|
||||
int operator <( const plUUID & other ) const { return CompareTo( &other ); }
|
||||
operator Uuid () const;
|
||||
|
||||
static plUUID Generate();
|
||||
};
|
||||
|
||||
class plCreatableUuid : public plUUID, public plCreatable {
|
||||
public:
|
||||
CLASSNAME_REGISTER( plCreatableUuid );
|
||||
GETINTERFACE_ANY( plCreatableUuid, plCreatable );
|
||||
|
||||
plCreatableUuid ();
|
||||
plCreatableUuid (const plCreatableUuid & other);
|
||||
plCreatableUuid (const plUUID & other);
|
||||
|
||||
void Read( hsStream * s, hsResMgr* ) { plUUID::Read(s); }
|
||||
void Write( hsStream * s, hsResMgr* ) { plUUID::Write(s); }
|
||||
};
|
||||
|
||||
|
||||
#endif // plUUID_h_inc
|
@ -1,137 +0,0 @@
|
||||
/*==LICENSE==*
|
||||
|
||||
CyanWorlds.com Engine - MMOG client, server and tools
|
||||
Copyright (C) 2011 Cyan Worlds, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Additional permissions under GNU GPL version 3 section 7
|
||||
|
||||
If you modify this Program, or any covered work, by linking or
|
||||
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
|
||||
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
|
||||
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
|
||||
(or a modified version of those libraries),
|
||||
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
|
||||
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
|
||||
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
|
||||
licensors of this Program grant you additional
|
||||
permission to convey the resulting work. Corresponding Source for a
|
||||
non-source form of such a combination shall include the source code for
|
||||
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
|
||||
work.
|
||||
|
||||
You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
or by snail mail at:
|
||||
Cyan Worlds, Inc.
|
||||
14617 N Newport Hwy
|
||||
Mead, WA 99021
|
||||
|
||||
*==LICENSE==*/
|
||||
#include "plUUID.h"
|
||||
|
||||
#ifdef HS_BUILD_FOR_UNIX
|
||||
|
||||
#include <uuid/uuid.h>
|
||||
|
||||
struct plUUIDHelper
|
||||
{
|
||||
static inline void CopyToPlasma( plUUID * dst, const uuid_t & src )
|
||||
{
|
||||
hsAssert( sizeof(uuid_t)==sizeof(dst->fData), "sizeof(uuid_t)!=sizeof(plUUID)" );
|
||||
memcpy( (void*)dst->fData, (const void *)src, sizeof( plUUID ) );
|
||||
}
|
||||
|
||||
static inline void CopyToNative( uuid_t & dst, const plUUID * src )
|
||||
{
|
||||
hsAssert( sizeof(uuid_t)==sizeof(src->fData), "sizeof(uuid_t)!=sizeof(plUUID)" );
|
||||
memcpy( (void*)dst, (const void *)src->fData, sizeof( plUUID ) );
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
void plUUID::Clear()
|
||||
{
|
||||
uuid_t g;
|
||||
plUUIDHelper::CopyToNative( g, this );
|
||||
uuid_clear( g );
|
||||
plUUIDHelper::CopyToPlasma( this, g );
|
||||
}
|
||||
|
||||
bool plUUID::IsNull() const
|
||||
{
|
||||
uuid_t g;
|
||||
plUUIDHelper::CopyToNative( g, this );
|
||||
return ( uuid_is_null( g )!=0 );
|
||||
}
|
||||
|
||||
void plUUID::CopyFrom( const plUUID * v )
|
||||
{
|
||||
memcpy( (void*)fData, (const void*)v->fData, sizeof(fData) );
|
||||
}
|
||||
|
||||
int plUUID::CompareTo( const plUUID * v ) const
|
||||
{
|
||||
uuid_t ga, gb;
|
||||
plUUIDHelper::CopyToNative( ga, this );
|
||||
plUUIDHelper::CopyToNative( gb, v );
|
||||
int ans = uuid_compare( ga, gb );
|
||||
return ans;
|
||||
}
|
||||
|
||||
bool plUUID::IsEqualTo( const plUUID * v ) const
|
||||
{
|
||||
return ( CompareTo( v )==0 );
|
||||
}
|
||||
|
||||
bool plUUID::FromString( const char * str )
|
||||
{
|
||||
Clear();
|
||||
if ( !str )
|
||||
return false;
|
||||
uuid_t g;
|
||||
uuid_parse( str, g );
|
||||
plUUIDHelper::CopyToPlasma( this, g );
|
||||
return true;
|
||||
}
|
||||
|
||||
bool plUUID::ToStdString( std::string & out ) const
|
||||
{
|
||||
uuid_t g;
|
||||
plUUIDHelper::CopyToNative( g, this );
|
||||
char buf[40];
|
||||
uuid_unparse( g, buf );
|
||||
out = buf;
|
||||
return true;
|
||||
}
|
||||
|
||||
// static
|
||||
plUUID plUUID::Generate()
|
||||
{
|
||||
uuid_t g;
|
||||
uuid_generate( g );
|
||||
plUUID result;
|
||||
plUUIDHelper::CopyToPlasma( &result, g );
|
||||
return result;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
// dummy function to prevent a linker warning complaining about no public symbols if the
|
||||
// contents of the file get compiled out via pre-processor
|
||||
void _preventLNK4221WarningStub()
|
||||
{
|
||||
}
|
||||
|
||||
#endif
|
@ -1,102 +0,0 @@
|
||||
/*==LICENSE==*
|
||||
|
||||
CyanWorlds.com Engine - MMOG client, server and tools
|
||||
Copyright (C) 2011 Cyan Worlds, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Additional permissions under GNU GPL version 3 section 7
|
||||
|
||||
If you modify this Program, or any covered work, by linking or
|
||||
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
|
||||
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
|
||||
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
|
||||
(or a modified version of those libraries),
|
||||
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
|
||||
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
|
||||
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
|
||||
licensors of this Program grant you additional
|
||||
permission to convey the resulting work. Corresponding Source for a
|
||||
non-source form of such a combination shall include the source code for
|
||||
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
|
||||
work.
|
||||
|
||||
You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
or by snail mail at:
|
||||
Cyan Worlds, Inc.
|
||||
14617 N Newport Hwy
|
||||
Mead, WA 99021
|
||||
|
||||
*==LICENSE==*/
|
||||
#include "plUUID.h"
|
||||
|
||||
#ifdef HS_BUILD_FOR_WIN32
|
||||
|
||||
#include "hsUtils.h"
|
||||
#include "hsWindows.h"
|
||||
#include <rpc.h>
|
||||
|
||||
void plUUID::Clear()
|
||||
{
|
||||
UuidCreateNil( (GUID *)this );
|
||||
}
|
||||
|
||||
int plUUID::CompareTo( const plUUID * v ) const
|
||||
{
|
||||
RPC_STATUS s;
|
||||
return UuidCompare( (GUID *)this, (GUID *)v, &s );
|
||||
}
|
||||
|
||||
bool plUUID::IsEqualTo( const plUUID * v ) const
|
||||
{
|
||||
return ( CompareTo( v )==0 );
|
||||
}
|
||||
|
||||
bool plUUID::IsNull() const
|
||||
{
|
||||
RPC_STATUS s;
|
||||
return 1 == UuidIsNil( (GUID *)this, &s );
|
||||
}
|
||||
|
||||
bool plUUID::FromString( const char * str )
|
||||
{
|
||||
Clear();
|
||||
if ( !str )
|
||||
return false;
|
||||
return RPC_S_OK == UuidFromString( (unsigned char *)str, (GUID *)this );
|
||||
}
|
||||
|
||||
bool plUUID::ToStdString( std::string & out ) const
|
||||
{
|
||||
out = "";
|
||||
unsigned char * ubuf;
|
||||
RPC_STATUS s;
|
||||
s = UuidToString( (GUID *) this, &ubuf );
|
||||
bool success = ( s==RPC_S_OK );
|
||||
if ( success )
|
||||
out = (char*)ubuf;
|
||||
RpcStringFree( &ubuf );
|
||||
return success;
|
||||
}
|
||||
|
||||
// static
|
||||
plUUID plUUID::Generate()
|
||||
{
|
||||
hsAssert(sizeof(plUUID) >= sizeof(GUID), "plUUID size");
|
||||
plUUID result;
|
||||
UuidCreate( (GUID *)&result );
|
||||
return result;
|
||||
}
|
||||
|
||||
#endif
|
Reference in New Issue
Block a user