diafero
13 years ago
42 changed files with 87 additions and 6503 deletions
@ -1,103 +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/>.
|
|
||||||
|
|
||||||
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 "plTagModifier.h" |
|
||||||
|
|
||||||
#include "hsResMgr.h" |
|
||||||
#include "../pnMessage/plRemoteAvatarInfoMsg.h" |
|
||||||
#include "../plMessage/plAvatarMsg.h" |
|
||||||
//#include "../pfMessage/plClothingMsg.h"
|
|
||||||
#include "../plMessage/plCollideMsg.h" |
|
||||||
#include "../plMessage/plSimInfluenceMsg.h" |
|
||||||
|
|
||||||
#include "../plStatusLog/plStatusLog.h" |
|
||||||
|
|
||||||
static plStatusLog* gLog = nil; |
|
||||||
|
|
||||||
plTagModifier::plTagModifier() |
|
||||||
{ |
|
||||||
if (!gLog) |
|
||||||
gLog = plStatusLogMgr::GetInstance().CreateStatusLog(15, "Tag", plStatusLog::kFilledBackground | plStatusLog::kDeleteForMe | plStatusLog::kDontWriteFile | plStatusLog::kAlignToTop); |
|
||||||
} |
|
||||||
|
|
||||||
plTagModifier::~plTagModifier() |
|
||||||
{ |
|
||||||
} |
|
||||||
|
|
||||||
hsBool plTagModifier::MsgReceive(plMessage* msg) |
|
||||||
{ |
|
||||||
plCollideMsg* collideMsg = plCollideMsg::ConvertNoRef(msg); |
|
||||||
if (collideMsg) |
|
||||||
{ |
|
||||||
gLog->AddLineF("Kicked by %s", collideMsg->fOtherKey->GetName()); |
|
||||||
return true; |
|
||||||
} |
|
||||||
|
|
||||||
plRemoteAvatarInfoMsg* avInfoMsg = plRemoteAvatarInfoMsg::ConvertNoRef(msg); |
|
||||||
if (avInfoMsg) |
|
||||||
{ |
|
||||||
// TODO
|
|
||||||
// Check if the local av is frozen
|
|
||||||
// plKey localAvKey = plNetClientMgr::GetInstance()->GetLocalPlayerKey();
|
|
||||||
|
|
||||||
// Freeze clicked av
|
|
||||||
plKey clickedAvKey = avInfoMsg->GetAvatarKey(); |
|
||||||
if (clickedAvKey) |
|
||||||
{ |
|
||||||
static hsBool tempHack = true; |
|
||||||
tempHack = !tempHack; |
|
||||||
|
|
||||||
plAvEnableMsg* avEnableMsg = new plAvEnableMsg(GetKey(), clickedAvKey, tempHack); |
|
||||||
avEnableMsg->SetBCastFlag(plMessage::kNetPropagate | plMessage::kPropagateToModifiers); |
|
||||||
avEnableMsg->Send(); |
|
||||||
|
|
||||||
gLog->AddLineF("Tagged %s", clickedAvKey->GetName()); |
|
||||||
} |
|
||||||
|
|
||||||
return true; |
|
||||||
} |
|
||||||
|
|
||||||
return plSingleModifier::MsgReceive(msg); |
|
||||||
} |
|
||||||
|
|
||||||
void plTagModifier::Read(hsStream* stream, hsResMgr* mgr) |
|
||||||
{ |
|
||||||
plSingleModifier::Read(stream, mgr); |
|
||||||
} |
|
||||||
|
|
||||||
void plTagModifier::Write(hsStream* stream, hsResMgr* mgr) |
|
||||||
{ |
|
||||||
plSingleModifier::Write(stream, mgr); |
|
||||||
} |
|
||||||
|
|
||||||
#include "plgDispatch.h" |
|
||||||
|
|
||||||
void plTagModifier::SetTarget(plSceneObject* so) |
|
||||||
{ |
|
||||||
if (so) |
|
||||||
plgDispatch::Dispatch()->RegisterForExactType(plRemoteAvatarInfoMsg::Index(), GetKey()); |
|
||||||
else |
|
||||||
plgDispatch::Dispatch()->UnRegisterForExactType(plRemoteAvatarInfoMsg::Index(), GetKey()); |
|
||||||
} |
|
@ -1,51 +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/>.
|
|
||||||
|
|
||||||
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 plTagModifier_inc |
|
||||||
#define plTagModifier_inc |
|
||||||
|
|
||||||
#include "../pnModifier/plSingleModifier.h" |
|
||||||
|
|
||||||
class plTagModifier : public plSingleModifier |
|
||||||
{ |
|
||||||
protected: |
|
||||||
virtual hsBool IEval(double secs, hsScalar del, UInt32 dirty) { return true; } |
|
||||||
|
|
||||||
public: |
|
||||||
plTagModifier(); |
|
||||||
virtual ~plTagModifier(); |
|
||||||
|
|
||||||
CLASSNAME_REGISTER(plTagModifier); |
|
||||||
GETINTERFACE_ANY(plTagModifier, plSingleModifier); |
|
||||||
|
|
||||||
virtual hsBool MsgReceive(plMessage* msg); |
|
||||||
|
|
||||||
virtual void Read(hsStream* stream, hsResMgr* mgr); |
|
||||||
virtual void Write(hsStream* stream, hsResMgr* mgr); |
|
||||||
|
|
||||||
virtual void SetTarget(plSceneObject* so); |
|
||||||
}; |
|
||||||
|
|
||||||
#endif // plTagModifier_inc
|
|
@ -1,164 +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/>.
|
|
||||||
|
|
||||||
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 "plNetClientMgr.h" |
|
||||||
#include "plNetClientVNodeMgr.h" |
|
||||||
#include "../plNetMessage/plNetMessage.h" |
|
||||||
#include "../plGImage/plMipmap.h" |
|
||||||
#include "../plJPEG/plJPEG.h" |
|
||||||
#include "../plVault/plVault.h" |
|
||||||
#include "hsResMgr.h" |
|
||||||
#include "../pnMessage/plRefMsg.h" |
|
||||||
#include "../plVault/plDniCoordinateInfo.h" |
|
||||||
#include "../plVault/plAgeInfoSource.h" |
|
||||||
#include "plNetLinkingMgr.h" |
|
||||||
#include "../plStatusLog/plStatusLog.h" |
|
||||||
#include "../plClientState/plClientStateMgr.h" |
|
||||||
#include "../plSDL/plSDL.h" |
|
||||||
#include "../plAgeLoader/plAgeLoader.h" |
|
||||||
|
|
||||||
#include "../../FeatureLib/pfMessage/pfKIMsg.h" |
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
class plNetClientAgeInfoSource : public plAgeInfoSource |
|
||||||
{ |
|
||||||
plDniCoordinateInfo fNilCoords; // TEMPORARY
|
|
||||||
public: |
|
||||||
const plDniCoordinateInfo * GetAgeCoords( void ) const |
|
||||||
{ |
|
||||||
return &fNilCoords; // tmp
|
|
||||||
} |
|
||||||
const plUnifiedTime * GetAgeTime( void ) const |
|
||||||
{ |
|
||||||
static plUnifiedTime ut; |
|
||||||
ut.SetSecsDouble(plNetClientMgr::GetInstance()->GetCurrentAgeElapsedSeconds()); |
|
||||||
return &ut; |
|
||||||
} |
|
||||||
const char * GetAgeName( void ) const |
|
||||||
{ |
|
||||||
return plNetLinkingMgr::GetInstance()->GetAgeLink()->GetAgeInfo()->GetAgeInstanceName(); |
|
||||||
} |
|
||||||
const plUUID * GetAgeGuid( void ) const |
|
||||||
{ |
|
||||||
return plNetLinkingMgr::GetInstance()->GetAgeLink()->GetAgeInfo()->GetAgeInstanceGuid(); |
|
||||||
} |
|
||||||
static plNetClientAgeInfoSource * GetInstance( void ) |
|
||||||
{ |
|
||||||
static plNetClientAgeInfoSource Me; |
|
||||||
return &Me; |
|
||||||
} |
|
||||||
}; |
|
||||||
|
|
||||||
|
|
||||||
//// Image/Mipmap Conversion //////////////////////////////////////////////////
|
|
||||||
|
|
||||||
hsBool StuffImageIntoNode( plMipmap * src, RelVaultNode * dst ) |
|
||||||
{ |
|
||||||
VaultImageNode image(dst); |
|
||||||
hsRAMStream ramStream; |
|
||||||
|
|
||||||
// Create our JPEG stream
|
|
||||||
plJPEG::Instance().SetWriteQuality( 30 ); // In percent quality
|
|
||||||
|
|
||||||
if( !plJPEG::Instance().WriteToStream( &ramStream, src ) ) |
|
||||||
return false; |
|
||||||
|
|
||||||
unsigned bytes = ramStream.GetEOF();
|
|
||||||
byte * buffer = (byte *)ALLOC(bytes); |
|
||||||
ramStream.CopyToMem(buffer); |
|
||||||
|
|
||||||
image.SetImageData(buffer, bytes); |
|
||||||
|
|
||||||
image.SetImageType( VaultImageNode::kJPEG ); |
|
||||||
|
|
||||||
// possibly make a plKey for the mipmap.
|
|
||||||
return ExtractImageFromNode( dst ); |
|
||||||
} |
|
||||||
|
|
||||||
hsBool ExtractImageFromNode( RelVaultNode * src) |
|
||||||
{ |
|
||||||
// no id? exit now. we will be called again when element is given an id.
|
|
||||||
if ( src->nodeId == 0 ) |
|
||||||
return false; |
|
||||||
|
|
||||||
VaultCliImageNode image(src); |
|
||||||
|
|
||||||
// already have a mipmap and it has a key? release it
|
|
||||||
if ( image.fMipmap && image.fMipmap->GetKey()!=nil ) |
|
||||||
{ |
|
||||||
plNetClientMgr::GetInstance()->GetKey()->Release( image.fMipmap->GetKey() ); |
|
||||||
image.fMipmap = nil; |
|
||||||
} |
|
||||||
|
|
||||||
// convert image data to a plMipmap
|
|
||||||
switch( image.imgType ) |
|
||||||
{ |
|
||||||
case VaultImageNode::kJPEG: |
|
||||||
{ |
|
||||||
// Copy to a RAM stream so the JPEG class is happy
|
|
||||||
hsRAMStream ramStream; |
|
||||||
ramStream.Write( image.imgDataLen, image.imgData ); |
|
||||||
ramStream.Rewind(); |
|
||||||
// create mipmap from image data
|
|
||||||
image.fMipmap = plJPEG::Instance().ReadFromStream( &ramStream ); |
|
||||||
} |
|
||||||
break; |
|
||||||
|
|
||||||
default: |
|
||||||
{ |
|
||||||
hsAssert( false, "ExtractImageFromNode: Invalid image type" ); |
|
||||||
return false; // Invalid image type
|
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
if ( !image.fMipmap ) |
|
||||||
{ |
|
||||||
hsAssert( false, "ExtractImageFromNode failed" ); |
|
||||||
return false; |
|
||||||
} |
|
||||||
|
|
||||||
// we now have a mipmap, but it doesn't have a key. make a key for it
|
|
||||||
static int UniqueIdentifier = 0; |
|
||||||
|
|
||||||
char keyName[512]; |
|
||||||
sprintf( keyName, "VaultImage_%lu_%d", src->nodeId, UniqueIdentifier++ ); |
|
||||||
|
|
||||||
// create a key for the mipmap
|
|
||||||
plKey imageKey = hsgResMgr::ResMgr()->NewKey( keyName, image.fMipmap, plLocation::kGlobalFixedLoc ); |
|
||||||
|
|
||||||
// ref the image key
|
|
||||||
hsgResMgr::ResMgr()->AddViaNotify( imageKey, TRACKED_NEW plGenRefMsg( |
|
||||||
plNetClientMgr::GetInstance()->GetKey(), plRefMsg::kOnCreate, 0, plNetClientMgr::kVaultImage ), |
|
||||||
plRefFlags::kActiveRef );
|
|
||||||
|
|
||||||
return ( image.fMipmap->GetKey()!=nil ); |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
|
||||||
// End.
|
|
||||||
|
|
@ -1,234 +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/>.
|
|
||||||
|
|
||||||
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 "plNetClientMgr.h" |
|
||||||
#include "plNetClientVault.h" |
|
||||||
#include "../pnNetCommon/plNetMsg.h" |
|
||||||
#include "../plGImage/plMipmap.h" |
|
||||||
#include "../plJPEG/plJPEG.h" |
|
||||||
#include "../plVault/plVaultTasks.h" |
|
||||||
#include "hsResMgr.h" |
|
||||||
#include "../pnMessage/plRefMsg.h" |
|
||||||
#include "../plVault/plDniCoordinateInfo.h" |
|
||||||
#include "../plVault/plAgeInfoSource.h" |
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
class plNetClientAgeInfoSource : public plAgeInfoSource |
|
||||||
{ |
|
||||||
plDniCoordinateInfo fNilCoords; // TEMPORARY
|
|
||||||
public: |
|
||||||
const plDniCoordinateInfo * GetAgeCoords( void ) const |
|
||||||
{ |
|
||||||
return &fNilCoords; // tmp
|
|
||||||
} |
|
||||||
const plUnifiedTime * GetAgeTime( void ) const |
|
||||||
{ |
|
||||||
static plUnifiedTime ut; |
|
||||||
ut.SetSecsDouble(plNetClientMgr::GetInstance()->GetCurrentAgeElapsedSeconds()); |
|
||||||
return &ut; |
|
||||||
} |
|
||||||
const char * GetAgeName( void ) const |
|
||||||
{ |
|
||||||
return plNetClientMgr::GetInstance()->GetAgeName(); |
|
||||||
} |
|
||||||
const plServerGuid * GetAgeGuid( void ) const |
|
||||||
{ |
|
||||||
return plNetClientMgr::GetInstance()->GetCurrSessionInfo()->GetServerGuid(); |
|
||||||
} |
|
||||||
static plNetClientAgeInfoSource * GetInstance( void ) |
|
||||||
{ |
|
||||||
static plNetClientAgeInfoSource Me; |
|
||||||
return &Me; |
|
||||||
} |
|
||||||
}; |
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
plNetClientVault::plNetClientVault() |
|
||||||
{ |
|
||||||
} |
|
||||||
|
|
||||||
plNetApp * plNetClientVault::GetNetApp( void ) const |
|
||||||
{ |
|
||||||
return plNetClientMgr::GetInstance(); |
|
||||||
} |
|
||||||
|
|
||||||
plAgeInfoSource * plNetClientVault::GetAgeInfo( void ) const |
|
||||||
{ |
|
||||||
return plNetClientAgeInfoSource::GetInstance(); |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
void plNetClientVault::IInitNode( plVaultNode * node ) |
|
||||||
{ |
|
||||||
plVaultImageNode * IMG = plVaultImageNode::ConvertNoRef( node ); |
|
||||||
if ( IMG ) |
|
||||||
{ |
|
||||||
plNetClientVault::ExtractImageFromNode( IMG ); |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
void plNetClientVault::IFiniNode( plVaultNode * node ) |
|
||||||
{ |
|
||||||
plVaultImageNode * IMG = plVaultImageNode::ConvertNoRef( node ); |
|
||||||
if ( IMG && IMG->GetMipmap() ) |
|
||||||
{ |
|
||||||
plNetClientMgr::GetInstance()->GetKey()->Release( IMG->GetMipmap()->GetKey() ); |
|
||||||
IMG->ISetMipmap( nil ); |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
int plNetClientVault::ISendNetMsg( plNetMsgVault * msg, UInt32 sendFlags ) |
|
||||||
{ |
|
||||||
return plNetClientMgr::GetInstance()->SendMsg( msg, sendFlags ); |
|
||||||
} |
|
||||||
|
|
||||||
void plNetClientVault::IOnTaskTimedOut( plVaultTask * task ) |
|
||||||
{ |
|
||||||
std::string msg; |
|
||||||
xtl::format( msg, "KI task timed out: %s", task->ClassName() ); |
|
||||||
plNetClientMgr::GetInstance()->OnNetFailure( msg.c_str(), true ); |
|
||||||
} |
|
||||||
|
|
||||||
bool plNetClientVault::IAmOnline( void ) const |
|
||||||
{ |
|
||||||
return plNetClientMgr::GetInstance()->IsEnabled()!=0; |
|
||||||
} |
|
||||||
|
|
||||||
//// Image/Mipmap Conversion //////////////////////////////////////////////////
|
|
||||||
|
|
||||||
hsBool plNetClientVault::StuffImageIntoNode( plMipmap * src, plVaultImageNode * dst ) |
|
||||||
{ |
|
||||||
hsRAMStream ramStream; |
|
||||||
|
|
||||||
// Create our JPEG stream
|
|
||||||
plJPEG::Instance().SetWriteQuality( 50 ); // In percent quality
|
|
||||||
|
|
||||||
if( !plJPEG::Instance().WriteToStream( &ramStream, src ) ) |
|
||||||
return false; |
|
||||||
|
|
||||||
// Copy the stream to the image element now
|
|
||||||
void * buffer = dst->AllocBuffer( ramStream.GetEOF() ); |
|
||||||
if( buffer == nil ) |
|
||||||
return false; |
|
||||||
ramStream.CopyToMem( buffer ); |
|
||||||
dst->SetImageType( plVaultImageNode::kJPEG ); |
|
||||||
|
|
||||||
// possibly make a plKey for the mipmap.
|
|
||||||
return plNetClientVault::ExtractImageFromNode( dst ); |
|
||||||
} |
|
||||||
|
|
||||||
hsBool plNetClientVault::ExtractImageFromNode( plVaultImageNode * src) |
|
||||||
{ |
|
||||||
// no id? exit now. we will be called again when element is given an id.
|
|
||||||
if ( src->GetID()==0 ) |
|
||||||
return false; |
|
||||||
|
|
||||||
// already have a mipmap and it has a key? release it
|
|
||||||
if ( src->GetMipmap() && src->GetMipmap()->GetKey()!=nil ) |
|
||||||
{ |
|
||||||
plNetClientMgr::GetInstance()->GetKey()->Release( src->GetMipmap()->GetKey() ); |
|
||||||
src->ISetMipmap( nil ); |
|
||||||
} |
|
||||||
|
|
||||||
// convert image data to a plMipmap
|
|
||||||
switch( src->GetImageType() ) |
|
||||||
{ |
|
||||||
case plVaultImageNode::kJPEG: |
|
||||||
{ |
|
||||||
// Copy to a RAM stream so the JPEG class is happy
|
|
||||||
hsRAMStream ramStream; |
|
||||||
ramStream.Write( src->GetBufSize(), src->GetBuffer() ); |
|
||||||
ramStream.Rewind(); |
|
||||||
// create mipmap from image data
|
|
||||||
src->ISetMipmap( plJPEG::Instance().ReadFromStream( &ramStream ) ); |
|
||||||
} |
|
||||||
break; |
|
||||||
|
|
||||||
default: |
|
||||||
{ |
|
||||||
hsAssert( false, "ExtractImageFromNode: Invalid image type" ); |
|
||||||
return false; // Invalid image type
|
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
if ( !src->GetMipmap() ) |
|
||||||
{ |
|
||||||
hsAssert( false, "ExtractImageFromNode failed" ); |
|
||||||
return false; |
|
||||||
} |
|
||||||
|
|
||||||
// we now have a mipmap, but it doesn't have a key. make a key for it
|
|
||||||
static int UniqueIdentifier = 0; |
|
||||||
|
|
||||||
char keyName[512]; |
|
||||||
sprintf( keyName, "VaultImage_%lu_%d", src->GetID(), UniqueIdentifier++ ); |
|
||||||
|
|
||||||
// create a key for the mipmap
|
|
||||||
plKey imageKey = hsgResMgr::ResMgr()->NewKey( keyName, src->IGetMipmap(), |
|
||||||
plLocation::kGlobalFixedLoc ); |
|
||||||
|
|
||||||
// ref the image key
|
|
||||||
hsgResMgr::ResMgr()->AddViaNotify( imageKey, new plGenRefMsg( |
|
||||||
plNetClientMgr::GetInstance()->GetKey(), plRefMsg::kOnCreate, 0, 0 ), |
|
||||||
plRefFlags::kActiveRef );
|
|
||||||
|
|
||||||
return ( src->GetMipmap()->GetKey()!=nil ); |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
plNetPlayerVault::plNetPlayerVault() |
|
||||||
{ |
|
||||||
} |
|
||||||
|
|
||||||
bool plNetPlayerVault::IIsThisMe( plVaultPlayerInfoNode * node ) const |
|
||||||
{ |
|
||||||
return GetPlayer()->GetPlayerInfo()->GetID()==node->GetID(); |
|
||||||
} |
|
||||||
|
|
||||||
plVaultPlayerNode * plNetPlayerVault::GetPlayer( void ) const |
|
||||||
{ |
|
||||||
return plVaultPlayerNode::ConvertNoRef( GetRootNode() ); |
|
||||||
} |
|
||||||
|
|
||||||
void plNetPlayerVault::IFillOutConnectFields( plNetMsgVault * msg ) const |
|
||||||
{ |
|
||||||
msg->AddInt( plVault::kArg_VaultClientType, plVault::kNodeType_VaultPlayer ); |
|
||||||
msg->AddInt( plVault::kArg_VaultClientID, plNetClientMgr::GetInstance()->GetDesiredPlayerID() ); |
|
||||||
} |
|
||||||
|
|
||||||
bool plNetPlayerVault::IIsThisMsgMine( plNetMsgVault * msg ) const |
|
||||||
{ |
|
||||||
if ( plVaultClient::IIsThisMsgMine( msg ) ) |
|
||||||
return true; |
|
||||||
return ( msg->GetInt( plVault::kArg_VaultClientID )==plNetClientMgr::GetInstance()->GetDesiredPlayerID() ); |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
|
||||||
// End.
|
|
@ -1,71 +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/>.
|
|
||||||
|
|
||||||
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 plNetClientVault_h_inc |
|
||||||
#define plNetClientVault_h_inc |
|
||||||
|
|
||||||
#include "../plVault/plVaultClient.h" |
|
||||||
|
|
||||||
class plMipmap; |
|
||||||
class plVaultImageNode; |
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
class plNetClientVault : public plVaultClient |
|
||||||
{ |
|
||||||
protected: |
|
||||||
void IInitNode( plVaultNode * node ); |
|
||||||
void IFiniNode( plVaultNode * node ); |
|
||||||
int ISendNetMsg( plNetMsgVault * msg, UInt32 sendFlags=0 ); |
|
||||||
void IOnTaskTimedOut( plVaultTask * task ); |
|
||||||
bool IAmOnline( void ) const; |
|
||||||
|
|
||||||
public: |
|
||||||
plNetClientVault(); |
|
||||||
|
|
||||||
plNetApp * GetNetApp( void ) const; |
|
||||||
plAgeInfoSource * GetAgeInfo( void ) const; |
|
||||||
|
|
||||||
// static helpers to convert between plMipmap and plVaultImageNode
|
|
||||||
static hsBool StuffImageIntoNode( plMipmap * src, plVaultImageNode * dst ); |
|
||||||
static hsBool ExtractImageFromNode( plVaultImageNode * src ); |
|
||||||
}; |
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
class plNetPlayerVault : public plNetClientVault |
|
||||||
{ |
|
||||||
protected: |
|
||||||
bool IIsThisMe( plVaultPlayerInfoNode * node ) const; |
|
||||||
void IFillOutConnectFields( plNetMsgVault * msg ) const; |
|
||||||
bool IIsThisMsgMine( plNetMsgVault * msg ) const; |
|
||||||
|
|
||||||
public: |
|
||||||
plNetPlayerVault(); |
|
||||||
plVaultPlayerNode * GetPlayer( void ) const; |
|
||||||
}; |
|
||||||
|
|
||||||
#endif // plNetClientVault_h_inc
|
|
@ -1,76 +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/>.
|
|
||||||
|
|
||||||
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 "hsTypes.h" |
|
||||||
#include "plEnvEffectDetector.h" |
|
||||||
#include "../plMessage/plCollideMsg.h" |
|
||||||
#include "plgDispatch.h" |
|
||||||
#include "../pnMessage/plEnvEffectMsg.h" |
|
||||||
|
|
||||||
/*
|
|
||||||
hsBool plEnvEffectDetector::MsgReceive(plMessage* msg) |
|
||||||
{ |
|
||||||
plCollideMsg* pCollMsg = plCollideMsg::ConvertNoRef(msg); |
|
||||||
|
|
||||||
if (pCollMsg) |
|
||||||
{ |
|
||||||
for (int i = 0; i < fEffectMsg.Count(); i++) |
|
||||||
{ |
|
||||||
fEffectMsg[i]->ClearReceivers(); |
|
||||||
if(pCollMsg->fEntering) |
|
||||||
{ |
|
||||||
fEffectMsg[i]->Enable( true ); |
|
||||||
} else { |
|
||||||
fEffectMsg[i]->Enable( false ); |
|
||||||
} |
|
||||||
fEffectMsg[i]->AddReceiver( pCollMsg->fOtherKey ); |
|
||||||
hsRefCnt_SafeRef(fEffectMsg[i]); |
|
||||||
plgDispatch::MsgSend( fEffectMsg[i] ); |
|
||||||
} |
|
||||||
} |
|
||||||
return plDetectorModifier::MsgReceive(msg); |
|
||||||
} |
|
||||||
|
|
||||||
void plEnvEffectDetector::Read(hsStream* stream, hsResMgr* mgr) |
|
||||||
{ |
|
||||||
plDetectorModifier::Read(stream, mgr); |
|
||||||
int n = stream->ReadSwap32(); |
|
||||||
fEffectMsg.SetCountAndZero(n); |
|
||||||
for(int i = 0; i < n; i++ ) |
|
||||||
{
|
|
||||||
plEnvEffectMsg* pMsg = plEnvEffectMsg::ConvertNoRef(mgr->ReadCreatable(stream)); |
|
||||||
fEffectMsg[i] = pMsg; |
|
||||||
}
|
|
||||||
} |
|
||||||
|
|
||||||
void plEnvEffectDetector::Write(hsStream* stream, hsResMgr* mgr) |
|
||||||
{ |
|
||||||
plDetectorModifier::Write(stream, mgr); |
|
||||||
stream->WriteSwap32(fEffectMsg.GetCount()); |
|
||||||
for(int i = 0; i < fEffectMsg.GetCount(); i++ ) |
|
||||||
mgr->WriteCreatable( stream, fEffectMsg[i] ); |
|
||||||
|
|
||||||
} |
|
||||||
*/ |
|
@ -1,57 +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/>.
|
|
||||||
|
|
||||||
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 plEnvEffectDetector_inc |
|
||||||
#define plEnvEffectDetector_inc |
|
||||||
|
|
||||||
#include "plDetectorModifier.h" |
|
||||||
|
|
||||||
class plEnvEffectMsg; |
|
||||||
class plMessage; |
|
||||||
class hsStream; |
|
||||||
class hsResMgr; |
|
||||||
|
|
||||||
class plEnvEffectDetector : public plDetectorModifier |
|
||||||
{ |
|
||||||
protected: |
|
||||||
|
|
||||||
public: |
|
||||||
plEnvEffectDetector(){;} |
|
||||||
virtual ~plEnvEffectDetector(){;} |
|
||||||
|
|
||||||
virtual hsBool MsgReceive(plMessage* msg); |
|
||||||
|
|
||||||
CLASSNAME_REGISTER( plEnvEffectDetector ); |
|
||||||
GETINTERFACE_ANY( plEnvEffectDetector, plDetectorModifier ); |
|
||||||
|
|
||||||
hsTArray<plEnvEffectMsg*> fEffectMsg; |
|
||||||
|
|
||||||
void Read(hsStream* stream, hsResMgr* mgr); |
|
||||||
void Write(hsStream* stream, hsResMgr* mgr); |
|
||||||
|
|
||||||
}; |
|
||||||
|
|
||||||
#endif plEnvEffectDetector_inc |
|
File diff suppressed because it is too large
Load Diff
@ -1,273 +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/>.
|
|
||||||
|
|
||||||
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 hsGEnviron_inc |
|
||||||
#define hsGEnviron_inc |
|
||||||
|
|
||||||
#include "hsGeometry3.h" // hsPoint3 |
|
||||||
#include "../plInterp/hsTimedValue.h" |
|
||||||
#include "../plResMgr/hsKeyedObject.h" |
|
||||||
#include "hsColorRGBA.h" |
|
||||||
#include "hsTemplates.h" |
|
||||||
|
|
||||||
//
|
|
||||||
//-----------------------------------
|
|
||||||
// Environment
|
|
||||||
//-----------------------------------
|
|
||||||
//
|
|
||||||
|
|
||||||
class hsGMaterial; |
|
||||||
class hsGDevEnvCache; |
|
||||||
class hsFogControl; |
|
||||||
class hsSceneNode; |
|
||||||
class hsScene; |
|
||||||
class hsGRenderProcs; |
|
||||||
class hsG3DDevice; |
|
||||||
class plKey; |
|
||||||
class hsResMgr; |
|
||||||
|
|
||||||
class hsGEnvironment : public hsKeyedObject { |
|
||||||
private: |
|
||||||
static const UInt16 kSaveMagicNumber; |
|
||||||
static const UInt16 kSaveVersion; |
|
||||||
|
|
||||||
public: |
|
||||||
struct FogState { |
|
||||||
private: |
|
||||||
static const UInt16 kSaveMagicNumber; |
|
||||||
static const UInt16 kSaveVersion; |
|
||||||
|
|
||||||
public: |
|
||||||
FogState() : fFlags(0) {}; |
|
||||||
enum { |
|
||||||
kColorSet = 0x1, |
|
||||||
kDistanceSet = 0x2, |
|
||||||
kDepthSet = 0x4, |
|
||||||
kDensitySet = 0x8, |
|
||||||
kYonSet = 0x10, |
|
||||||
kClearSet = 0x20, |
|
||||||
|
|
||||||
kLinear = 0x10000000, |
|
||||||
kExp = 0x20000000, |
|
||||||
kExp2 = 0x40000000, |
|
||||||
kTypeMask = kLinear | kExp | kExp2 |
|
||||||
}; |
|
||||||
UInt32 fFlags; |
|
||||||
hsTimedValue<hsColorRGBA> fColor; |
|
||||||
hsTimedValue<hsColorRGBA> fClear; |
|
||||||
hsTimedValue<hsScalar> fDistance; |
|
||||||
hsTimedValue<hsScalar> fDensity; |
|
||||||
hsTimedValue<hsScalar> fDepth; |
|
||||||
hsTimedValue<hsScalar> fYon; |
|
||||||
|
|
||||||
void ValidateEnv(class hsGEnvironment* env); |
|
||||||
void SetFromEnv(class hsGEnvironment* env); |
|
||||||
void SetToEnv(class hsGEnvironment* env); |
|
||||||
void Save(hsStream *stream, hsResMgr* mgr); |
|
||||||
void Load(hsStream *stream, hsResMgr* mgr); |
|
||||||
}; |
|
||||||
|
|
||||||
enum { |
|
||||||
kMapSet = 0x1, |
|
||||||
kCenterSet = 0x2, |
|
||||||
kRadiusSet = 0x4, |
|
||||||
kEnvironMapSet = kMapSet | kCenterSet | kRadiusSet, |
|
||||||
kFogDepthSet = 0x8, |
|
||||||
kFogColorSet = 0x10, |
|
||||||
kFogDensitySet = 0x20, |
|
||||||
kYonSet = 0x40, |
|
||||||
kOverride = 0x80, |
|
||||||
kFarOut = 0x100, |
|
||||||
kFogDistanceSet = 0x200, |
|
||||||
kCacheInvalid = 0x400, |
|
||||||
kClearColorSet = 0x800, |
|
||||||
kCurrentDepthSet = 0x1000, |
|
||||||
kFogControl = 0x2000, |
|
||||||
kSortObjects = 0x4000, |
|
||||||
kHasRenderProcs = 0x8000, |
|
||||||
kFogLinear = 0x10000, |
|
||||||
kFogExp = 0x20000, |
|
||||||
kFogExp2 = 0x40000, |
|
||||||
kFogTypeMask = kFogLinear | kFogExp | kFogExp2, |
|
||||||
kClearColorAmbient = 0x80000, |
|
||||||
kFogColorAmbient = 0x100000, |
|
||||||
kFogColorDiffuse = 0x200000 |
|
||||||
}; |
|
||||||
protected: |
|
||||||
static hsScalar fYonScale; |
|
||||||
|
|
||||||
UInt32 fFlags; |
|
||||||
hsGMaterial* fMap; |
|
||||||
char fMapName[256]; |
|
||||||
hsPoint3 fPos; |
|
||||||
hsScalar fRadius; |
|
||||||
hsScalar fValidScale; |
|
||||||
hsTArray<FogState*> fFogStateStack; |
|
||||||
hsTimedValue<hsScalar> fFogDistance; |
|
||||||
hsTimedValue<hsScalar> fFogDepth; // value 0..1, as fraction of yon, 0 is no fog
|
|
||||||
hsTimedValue<hsScalar> fFogDensity; |
|
||||||
hsTimedValue<hsColorRGBA> fFogColor; |
|
||||||
hsTimedValue<hsColorRGBA> fClearColor; |
|
||||||
hsTimedValue<hsScalar> fYon; |
|
||||||
hsScalar fCurrentDepth; // function of Depth and Distance
|
|
||||||
|
|
||||||
FogState fResetState; |
|
||||||
hsGDevEnvCache* fDevCache; |
|
||||||
|
|
||||||
hsDynamicArray<hsGRenderProcs*> fRenderProcs; |
|
||||||
hsTArray<plKey*> fNodeKeys; |
|
||||||
|
|
||||||
hsFogControl* fFogControl; |
|
||||||
|
|
||||||
void IReadFogControl(hsStream* s, hsResMgr* mgr); |
|
||||||
void IWriteFogControl(hsStream* s, hsResMgr* mgr); |
|
||||||
|
|
||||||
public: |
|
||||||
hsGEnvironment(); |
|
||||||
virtual ~hsGEnvironment(); |
|
||||||
|
|
||||||
hsBool32 AddNode(hsSceneNode *node); |
|
||||||
hsBool32 AddNodeKey(plKey *key); |
|
||||||
Int32 GetNumNodes() { return fNodeKeys.GetCount(); } |
|
||||||
hsSceneNode* GetNode(Int32 i); |
|
||||||
plKey* GetNodeKey(Int32 i) { return fNodeKeys[i]; } |
|
||||||
|
|
||||||
char* GetMapName() { return fMapName; } |
|
||||||
hsGMaterial* GetMap() const { return fMap; } |
|
||||||
hsPoint3 GetCenter() const { return fPos; } |
|
||||||
hsScalar GetRadius() const { return fRadius; } |
|
||||||
hsScalar GetFogDistance() const { return fFogDistance.GetValue(); } |
|
||||||
hsScalar GetFogDepth() const { return fFogDepth.GetValue(); } |
|
||||||
hsScalar GetCurrentDepth() const { return fCurrentDepth; } |
|
||||||
hsScalar GetFogDensity() const { return fFogDensity.GetValue(); } |
|
||||||
hsColorRGBA GetFogColor() const { return fFogColor.GetValue(); } |
|
||||||
hsColorRGBA GetClearColor() const { return fClearColor.GetValue(); } |
|
||||||
hsScalar GetYon() const { return fYonScale * fYon.GetValue(); } |
|
||||||
hsScalar GetUnscaledYon() const { return fYon.GetValue(); } |
|
||||||
hsBool32 GetOverride() const { return 0 != (fFlags & kOverride); } |
|
||||||
UInt32 GetFlags() const { return fFlags; } |
|
||||||
|
|
||||||
hsScalar GoalFogDistance() const { return fFogDistance.GetGoal(); } |
|
||||||
hsScalar GoalFogDepth() const { return fFogDepth.GetGoal(); } |
|
||||||
hsScalar GoalFogDensity() const { return fFogDensity.GetGoal(); } |
|
||||||
hsColorRGBA GoalFogColor() const { return fFogColor.GetGoal(); } |
|
||||||
hsColorRGBA GoalClearColor() const { return fClearColor.GetGoal(); } |
|
||||||
hsScalar GoalYon() const { return fYon.GetGoal(); } |
|
||||||
|
|
||||||
const hsTimedValue<hsScalar>& FogDistanceState() const { return fFogDistance; } |
|
||||||
const hsTimedValue<hsScalar>& FogDepthState() const { return fFogDepth; } |
|
||||||
const hsTimedValue<hsScalar>& FogDensityState() const { return fFogDensity; } |
|
||||||
const hsTimedValue<hsColorRGBA>& FogColorState() const { return fFogColor; } |
|
||||||
const hsTimedValue<hsColorRGBA>& ClearColorState() const { return fClearColor; } |
|
||||||
const hsTimedValue<hsScalar>& YonState() const { return fYon; } |
|
||||||
|
|
||||||
void SetFogDistance(const hsTimedValue<hsScalar>& v); |
|
||||||
void SetFogDepth(const hsTimedValue<hsScalar>& v); |
|
||||||
void SetFogDensity(const hsTimedValue<hsScalar>& v); |
|
||||||
void SetFogColor(const hsTimedValue<hsColorRGBA>& v); |
|
||||||
void SetClearColor(const hsTimedValue<hsColorRGBA>& v); |
|
||||||
void SetYon(const hsTimedValue<hsScalar>& v); |
|
||||||
|
|
||||||
void SetMapName(const char *name); |
|
||||||
void SetMap(hsGMaterial *m); // refs
|
|
||||||
void SetCenter(const hsPoint3 &p); |
|
||||||
void SetRadius(hsScalar r); |
|
||||||
void SetFogDistance(hsScalar d); |
|
||||||
void SetFogDepth(hsScalar f); |
|
||||||
void SetCurrentDepth(hsScalar f); |
|
||||||
void SetFogDensity(hsScalar f); |
|
||||||
void SetFogColor(const hsColorRGBA &c); |
|
||||||
void SetClearColor(const hsColorRGBA &c); |
|
||||||
void SetYon(hsScalar f); |
|
||||||
void SetOverride(hsBool32 on); |
|
||||||
void SetIsFar(hsBool32 on=true); |
|
||||||
void SetHasFogControl(hsBool32 on=true); |
|
||||||
void SetSortObjects(hsBool32 on=true); |
|
||||||
void SetFogType(UInt32 t); |
|
||||||
void SetFogColorAmbient(hsBool32 on=true); |
|
||||||
void SetFogColorDiffuse(hsBool32 on=true); |
|
||||||
void SetClearColorAmbient(hsBool32 on=true); |
|
||||||
|
|
||||||
void SetTimedFogDistance(const hsScalar g, const hsScalar s); |
|
||||||
void SetTimedFogDepth(const hsScalar g, const hsScalar s); |
|
||||||
void SetTimedFogDensity(const hsScalar g, const hsScalar s); |
|
||||||
void SetTimedFogColor(const hsColorRGBA& g, const hsScalar s); |
|
||||||
void SetTimedClearColor(const hsColorRGBA& g, const hsScalar s); |
|
||||||
void SetTimedYon(const hsScalar g, const hsScalar s); |
|
||||||
|
|
||||||
void UnSetMapName() { *fMapName = 0; } |
|
||||||
void UnSetEnvironMap() { fFlags &= ~kEnvironMapSet; } |
|
||||||
void UnSetFogDistance() { fFlags &= ~kFogDistanceSet; } |
|
||||||
void UnSetFogDepth() { fFlags &= ~kFogDepthSet; } |
|
||||||
void UnSetFogDensity() { fFlags &= ~kFogDensitySet; } |
|
||||||
void UnSetFogColor() { fFlags &= ~kFogColorSet; } |
|
||||||
void UnSetClearColor() { fFlags &= ~kClearColorSet; } |
|
||||||
void UnSetYon() { fFlags &= ~kYonSet; } |
|
||||||
|
|
||||||
hsGEnvironment* Copy(hsGEnvironment* env); // returns this
|
|
||||||
|
|
||||||
void MixEnvirons(hsGEnvironment* env, hsGEnvironment* def); |
|
||||||
|
|
||||||
void Push(hsG3DDevice* d); |
|
||||||
void Pop(hsG3DDevice* d); |
|
||||||
|
|
||||||
void Blend(); |
|
||||||
void Restore(); |
|
||||||
void Init(hsSceneNode* node); |
|
||||||
|
|
||||||
void SetDeviceCache(hsGDevEnvCache* p); |
|
||||||
hsGDevEnvCache* GetDeviceCache(){ return fDevCache; } |
|
||||||
|
|
||||||
void SetFogControl(hsFogControl* fc); |
|
||||||
hsFogControl* GetFogControl() { return fFogControl; } |
|
||||||
|
|
||||||
void SaveFogState(); // push
|
|
||||||
hsGEnvironment::FogState* PopFogState() { return fFogStateStack.GetCount() ? fFogStateStack.Pop() : nil; } // doesn't restore
|
|
||||||
void RestoreFogState(); // pop and restore
|
|
||||||
|
|
||||||
void AddRenderProc(hsGRenderProcs* rp); // refs
|
|
||||||
hsGRenderProcs* GetRenderProc(int i); // no ref
|
|
||||||
UInt32 GetNumRenderProcs(); |
|
||||||
|
|
||||||
virtual void SetResetState(); |
|
||||||
virtual void Reset(); |
|
||||||
virtual void ValidateInResetState(); |
|
||||||
virtual void Save(hsStream *stream, hsResMgr* mgr); |
|
||||||
virtual void Load(hsStream *stream, hsResMgr* mgr); |
|
||||||
virtual void Update(hsScalar secs, const hsPoint3& vPos); |
|
||||||
|
|
||||||
virtual void Read(hsStream* s); |
|
||||||
virtual void Write(hsStream* s); |
|
||||||
|
|
||||||
virtual void Write(hsStream *stream, hsResMgr *group); |
|
||||||
virtual void Read(hsStream *stream, hsResMgr *group); |
|
||||||
|
|
||||||
static hsScalar GetYonScale() { return fYonScale; } |
|
||||||
static hsScalar SetYonScale(hsScalar s); |
|
||||||
|
|
||||||
virtual hsBool MsgReceive(plMessage* msg); |
|
||||||
}; |
|
||||||
|
|
||||||
#endif // hsGEnviron_inc
|
|
@ -1,195 +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/>.
|
|
||||||
|
|
||||||
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==*/ |
|
||||||
#define plIndexFile_cpp // for version numbers in plVersion.h
|
|
||||||
|
|
||||||
#include "plIndexFile.h" |
|
||||||
#include "hsStream.h" |
|
||||||
#include "plVersion.h" |
|
||||||
|
|
||||||
//--------------------
|
|
||||||
// plIndexFileHeader
|
|
||||||
//--------------------
|
|
||||||
|
|
||||||
plIndexFileHeader::plIndexFileHeader() |
|
||||||
{ |
|
||||||
fTimeStamp[ 0 ] = fTimeStamp[ 1 ] = 0; |
|
||||||
fStrTblStartPos = 0; |
|
||||||
fStrTblKnt = 0; |
|
||||||
fMajorVersion = plVersion::GetMajorVersion(); |
|
||||||
fMinorVersion = plVersion::GetMinorVersion(); |
|
||||||
fExportLocal = 0; |
|
||||||
} |
|
||||||
|
|
||||||
void plIndexFileHeader::Write(hsStream *s)
|
|
||||||
{
|
|
||||||
s->WriteSwap32(2,fTimeStamp); |
|
||||||
s->WriteSwap32(fStrTblStartPos);
|
|
||||||
s->WriteSwap16(fStrTblKnt); |
|
||||||
s->WriteSwap16(fMajorVersion); |
|
||||||
s->WriteSwap16(fMinorVersion); |
|
||||||
s->WriteSwap16(fExportLocal); |
|
||||||
}
|
|
||||||
void plIndexFileHeader::Read(hsStream *s)
|
|
||||||
{
|
|
||||||
s->ReadSwap32(2,fTimeStamp); |
|
||||||
fStrTblStartPos = s->ReadSwap32();
|
|
||||||
fStrTblKnt = s->ReadSwap16(); |
|
||||||
fMajorVersion = s->ReadSwap16(); |
|
||||||
fMinorVersion = s->ReadSwap16(); |
|
||||||
fExportLocal = s->ReadSwap16(); |
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------
|
|
||||||
// plIndexFileRoom
|
|
||||||
//--------------------
|
|
||||||
|
|
||||||
void plIndexFileRoom::Write(hsStream *s)
|
|
||||||
{
|
|
||||||
fRmUoid.Write(s); |
|
||||||
s->WriteSwap32(fTypesInRoom);
|
|
||||||
s->WriteSwap16(fFiller1_16); |
|
||||||
s->WriteSwap32(fFiller2_32); |
|
||||||
s->WriteSwap32(fFiller3_32); |
|
||||||
}
|
|
||||||
void plIndexFileRoom::Read(hsStream *s)
|
|
||||||
{
|
|
||||||
fRmUoid.Read(s); |
|
||||||
fTypesInRoom = s->ReadSwap32();
|
|
||||||
s->ReadSwap16(); |
|
||||||
s->ReadSwap32(); |
|
||||||
s->ReadSwap32(); |
|
||||||
}
|
|
||||||
//--------------------
|
|
||||||
// plIndexFileType
|
|
||||||
//--------------------
|
|
||||||
|
|
||||||
|
|
||||||
void plIndexFileType::Write(hsStream *s) |
|
||||||
{
|
|
||||||
fTypeUoid.Write(s); |
|
||||||
s->WriteSwap32(fNumKeys);
|
|
||||||
s->WriteSwap32(fFiller1_32); |
|
||||||
s->WriteSwap32(fFiller2_32); |
|
||||||
} |
|
||||||
|
|
||||||
void plIndexFileType::Read(hsStream *s)
|
|
||||||
{
|
|
||||||
fTypeUoid.Read(s); |
|
||||||
fNumKeys = s->ReadSwap32();
|
|
||||||
s->ReadSwap32(); |
|
||||||
s->ReadSwap32(); |
|
||||||
}
|
|
||||||
//--------------------
|
|
||||||
// plIndexFileKey
|
|
||||||
//--------------------
|
|
||||||
|
|
||||||
|
|
||||||
void plIndexFileKey::Write(hsStream *s)
|
|
||||||
{
|
|
||||||
fKeyUoid.Write(s); |
|
||||||
s->WriteSwap32(fStartPos);
|
|
||||||
s->WriteSwap32(fDataLen); |
|
||||||
s->WriteSwap16(fNameIx); |
|
||||||
s->WriteSwap16(fFiller1_16); |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
void plIndexFileKey::Read(hsStream *s) |
|
||||||
{
|
|
||||||
fKeyUoid.Read(s); |
|
||||||
fStartPos = s->ReadSwap32();
|
|
||||||
fDataLen = s->ReadSwap32();
|
|
||||||
fNameIx = s->ReadSwap16(); |
|
||||||
s->ReadSwap16(); |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//--------------------
|
|
||||||
// plIxStrTbl
|
|
||||||
//--------------------
|
|
||||||
|
|
||||||
plIxStrTbl::~plIxStrTbl()
|
|
||||||
{
|
|
||||||
if (fpStrings) delete []fpStrings; // if strings came from elsewhere, not our responsibility
|
|
||||||
}
|
|
||||||
|
|
||||||
UInt16 plIxStrTbl::AddString(const char *p) |
|
||||||
{ Int16 ix = FindString(p);
|
|
||||||
if (ix != -1)
|
|
||||||
return ix; // duplicate
|
|
||||||
fStringTbl.push_back(p); return fStringTbl.size() - 1;
|
|
||||||
} |
|
||||||
|
|
||||||
Int16 plIxStrTbl::FindString(const char *p) |
|
||||||
{ |
|
||||||
for (int i=0; i < fStringTbl.size(); i++) |
|
||||||
{
|
|
||||||
if (!_stricmp(p,fStringTbl[i])) |
|
||||||
return i; |
|
||||||
} |
|
||||||
return -1; |
|
||||||
} |
|
||||||
|
|
||||||
void plIxStrTbl::Write(hsStream *s)
|
|
||||||
{
|
|
||||||
for (int i=0; i < fStringTbl.size(); i++) |
|
||||||
{ Int32 len= fStringTbl[i] ? strlen(fStringTbl[i]) : 0; |
|
||||||
hsAssert(len < 256,"Name string too long"); |
|
||||||
UInt8 l = (UInt8) len; |
|
||||||
s->WriteByte(l); // FUTURE, don't really need length!
|
|
||||||
if (len) |
|
||||||
{ |
|
||||||
s->Write(len, fStringTbl[i]); |
|
||||||
} |
|
||||||
s->WriteByte(0); // Null terminate
|
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
void plIxStrTbl::Read(hsStream *s) |
|
||||||
{ UInt32 pos = s->GetPosition(); |
|
||||||
s->FastFwd(); |
|
||||||
fTabSize = s->GetPosition() - pos; // Get size of table
|
|
||||||
s->SetPosition(pos); |
|
||||||
fpStrings = new char[fTabSize]; |
|
||||||
hsAssert(fpStrings,"new failed"); |
|
||||||
s->Read(fTabSize,fpStrings); // Read all the string in
|
|
||||||
|
|
||||||
char *p = fpStrings; |
|
||||||
while (p < fpStrings + fTabSize) |
|
||||||
{ |
|
||||||
UInt8 len = *p; |
|
||||||
p++; |
|
||||||
hsAssert(p < fpStrings + fTabSize,"String Index error"); |
|
||||||
fStringTbl.push_back(p); |
|
||||||
p += len + 1; // past len and NULL
|
|
||||||
}; |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,152 +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/>.
|
|
||||||
|
|
||||||
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 PLINDEXFILE_H |
|
||||||
#define PLINDEXFILE_H |
|
||||||
|
|
||||||
#include "../pnKeyedObject/plUoid.h" |
|
||||||
#include <vector> |
|
||||||
//---------------------------------------------------------------
|
|
||||||
// These Classes are used to Read and Write the Index file for the Database
|
|
||||||
// Records are kept the same size Currently 20 Bytes
|
|
||||||
// At the End of the file, the Strings are stored
|
|
||||||
// plIxStrTbl is used to Read and Write the String section of the Index
|
|
||||||
//---------------------------------------------------------------
|
|
||||||
|
|
||||||
//---------------------------------------------------------------
|
|
||||||
// Main header Entry, One per Index file
|
|
||||||
//---------------------------------------------------------------
|
|
||||||
class plIndexFileHeader |
|
||||||
{ |
|
||||||
public: |
|
||||||
plIndexFileHeader(); // I buried Paul
|
|
||||||
~plIndexFileHeader(){} |
|
||||||
|
|
||||||
UInt32 fTimeStamp[2]; |
|
||||||
UInt32 fStrTblStartPos; // where the String table starts in the Index file
|
|
||||||
UInt16 fStrTblKnt; // how many strings in the string table
|
|
||||||
UInt16 fMajorVersion; |
|
||||||
UInt16 fMinorVersion; |
|
||||||
UInt16 fExportLocal; // was this file exported locally or downloaded from server?
|
|
||||||
|
|
||||||
void Write(hsStream *s); |
|
||||||
void Read(hsStream *s); |
|
||||||
}; |
|
||||||
|
|
||||||
//---------------------------------------------------------------
|
|
||||||
// Room Entry One Entry per Room
|
|
||||||
//---------------------------------------------------------------
|
|
||||||
class plIndexFileRoom |
|
||||||
{ |
|
||||||
public: |
|
||||||
plIndexFileRoom() { memset(this,1,sizeof(this)); } // no virtuals...relax
|
|
||||||
~plIndexFileRoom(){} |
|
||||||
|
|
||||||
plUoid fRmUoid; |
|
||||||
UInt16 fTypesInRoom; |
|
||||||
UInt16 fFiller1_16; |
|
||||||
UInt32 fFiller2_32; |
|
||||||
UInt32 fFiller3_32; |
|
||||||
|
|
||||||
void Write(hsStream *s);
|
|
||||||
void Read(hsStream *s);
|
|
||||||
}; |
|
||||||
|
|
||||||
//---------------------------------------------------------------
|
|
||||||
// Type Entry One Entry per Type in each Room
|
|
||||||
//---------------------------------------------------------------
|
|
||||||
|
|
||||||
class plIndexFileType |
|
||||||
{ |
|
||||||
public: |
|
||||||
plIndexFileType() { memset(this,1,sizeof(this)); } // no virtuals...relax
|
|
||||||
~plIndexFileType(){} |
|
||||||
|
|
||||||
plUoid fTypeUoid; |
|
||||||
UInt16 fNumKeys; |
|
||||||
UInt32 fFiller1_32; |
|
||||||
UInt32 fFiller2_32; |
|
||||||
|
|
||||||
void Write(hsStream *s);
|
|
||||||
void Read(hsStream *s);
|
|
||||||
}; |
|
||||||
|
|
||||||
//---------------------------------------------------------------
|
|
||||||
// Key Entry One Entry per Type in each Room
|
|
||||||
//---------------------------------------------------------------
|
|
||||||
|
|
||||||
class plIndexFileKey |
|
||||||
{ |
|
||||||
public: |
|
||||||
plIndexFileKey() { memset(this,1,sizeof(this)); } // no virtuals...relax
|
|
||||||
~plIndexFileKey(){} |
|
||||||
|
|
||||||
|
|
||||||
plUoid fKeyUoid; |
|
||||||
UInt32 fStartPos; |
|
||||||
UInt32 fDataLen; |
|
||||||
UInt16 fNameIx; // Index into string table of name
|
|
||||||
UInt16 fFiller1_16; |
|
||||||
|
|
||||||
void Write(hsStream *s) ;
|
|
||||||
void Read(hsStream *s);
|
|
||||||
}; |
|
||||||
|
|
||||||
//---------------------------------------------------------------
|
|
||||||
// String Table, Lives at the end of the Index File
|
|
||||||
//---------------------------------------------------------------
|
|
||||||
class plIxStrTbl |
|
||||||
{ |
|
||||||
std::vector<const char *>fStringTbl; |
|
||||||
char *fpStrings; |
|
||||||
UInt32 fTabSize; // buffer size for strings
|
|
||||||
|
|
||||||
public: |
|
||||||
|
|
||||||
plIxStrTbl() :fpStrings(nil), fTabSize(0){} |
|
||||||
~plIxStrTbl(); |
|
||||||
|
|
||||||
Int16 FindString(const char *p); // returns -1 if not found, otherwise the index from zero
|
|
||||||
UInt16 AddString(const char *p); |
|
||||||
UInt16 NumStrings() { return fStringTbl.size(); } |
|
||||||
const char * GetString(UInt16 x) { return fStringTbl[x]; } |
|
||||||
|
|
||||||
void Write(hsStream *s); |
|
||||||
void Read(hsStream *s);
|
|
||||||
}; |
|
||||||
|
|
||||||
class plLinkRecord |
|
||||||
{ |
|
||||||
public: |
|
||||||
plLinkRecord(UInt16 a, UInt16 d, UInt16 r) : fAgeIx(a), fDistIx(d), fRoomIx(r){} |
|
||||||
~plLinkRecord(){} |
|
||||||
|
|
||||||
UInt16 fAgeIx; // Index into string table
|
|
||||||
UInt16 fDistIx; |
|
||||||
UInt16 fRoomIx; |
|
||||||
UInt32 fTimeStamp[2]; |
|
||||||
}; |
|
||||||
|
|
||||||
#endif |
|
@ -1,36 +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/>.
|
|
||||||
|
|
||||||
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 plUnifiedTimeCreatable_inc |
|
||||||
#define plUnifiedTimeCreatable_inc |
|
||||||
|
|
||||||
#if 0 |
|
||||||
#include "../pnFactory/plCreator.h" |
|
||||||
|
|
||||||
#include "plUnifiedTime.h" |
|
||||||
REGISTER_CREATABLE( plUnifiedTime ); |
|
||||||
#endif |
|
||||||
|
|
||||||
#endif // plUnifiedTimeCreatable_inc
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Loading…
Reference in new issue