Initial commit: ROW Client source code
Game client codebase including: - CharacterActionControl: Character and creature management - GlobalScript: Network, items, skills, quests, utilities - RYLClient: Main client application with GUI and event handlers - Engine: 3D rendering engine (RYLGL) - MemoryManager: Custom memory allocation - Library: Third-party dependencies (DirectX, boost, etc.) - Tools: Development utilities 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
136
Engine/Zalla3D Base Class/Resource.cpp
Normal file
136
Engine/Zalla3D Base Class/Resource.cpp
Normal file
@@ -0,0 +1,136 @@
|
||||
#include ".\resource.h"
|
||||
#include "./ResourceMgr.h"
|
||||
#include "./NTexture.h"
|
||||
#include "../zalla3d scene class/NMesh.h"
|
||||
#include "../zalla3d scene class/OctreeScene.h"
|
||||
#include "GMMemory.h"
|
||||
|
||||
namespace CROSSM {
|
||||
CResource::CResource(void)
|
||||
{
|
||||
}
|
||||
|
||||
CResource::~CResource(void)
|
||||
{
|
||||
for(RESOURCETABLEITER itr = m_ResourceMgrMap.begin(); itr != m_ResourceMgrMap.end();)
|
||||
{
|
||||
if(itr->second != NULL)
|
||||
{
|
||||
SafeDelete(itr->second);
|
||||
}
|
||||
itr++;
|
||||
}
|
||||
m_ResourceMgrMap.clear();
|
||||
|
||||
}
|
||||
void CResource::Init()
|
||||
{
|
||||
m_ResourceMgrMap.clear();
|
||||
AddResourceMgr(RESOURCE_TEXTURE,new CResourceMgr<CNTexture>);
|
||||
AddResourceMgr(RESOURCE_MESH,new CResourceMgr<CNMesh>);
|
||||
AddResourceMgr(RESOURCE_OCTREESCENE,new CResourceMgr<COctreeScene>);
|
||||
}
|
||||
|
||||
void CResource::Update()
|
||||
{
|
||||
RESOURCETABLEITER itr = m_ResourceMgrMap.find(RESOURCE_TEXTURE);
|
||||
if(itr != m_ResourceMgrMap.end())
|
||||
{
|
||||
itr->second->Update();
|
||||
}
|
||||
|
||||
itr = m_ResourceMgrMap.find(RESOURCE_MESH);
|
||||
if(itr != m_ResourceMgrMap.end())
|
||||
{
|
||||
itr->second->Update();
|
||||
}
|
||||
|
||||
itr = m_ResourceMgrMap.find(RESOURCE_OCTREESCENE);
|
||||
if(itr != m_ResourceMgrMap.end())
|
||||
{
|
||||
itr->second->Update();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void CResource::AddResourceMgr(int iType,IResourceMgr *pMgr)
|
||||
{
|
||||
RESOURCETABLEITER itr = m_ResourceMgrMap.find(iType);
|
||||
if(itr == m_ResourceMgrMap.end())
|
||||
{
|
||||
|
||||
if(pMgr)
|
||||
{
|
||||
pMgr->SetType(iType); // Resource Type Setting.
|
||||
m_ResourceMgrMap.insert(RESOURCETABLEOBJ(iType,pMgr));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// CLogMgr::_LogError(" CResource::AddResourceMgr(), <20>̹<EFBFBD> <20><><EFBFBD><EFBFBD> <20≯<EFBFBD> <20><><EFBFBD><EFBFBD> resourcemgr<67><72> <20><><EFBFBD>ϵǾ<CFB5> <20>ֽ<EFBFBD><D6BD>ϴ<EFBFBD>");
|
||||
|
||||
}
|
||||
}
|
||||
void CResource::Release()
|
||||
{
|
||||
for(RESOURCETABLEITER itr = m_ResourceMgrMap.begin(); itr != m_ResourceMgrMap.end();)
|
||||
{
|
||||
if(itr->second != NULL)
|
||||
{
|
||||
SafeDelete(itr->second);
|
||||
}
|
||||
itr++;
|
||||
}
|
||||
m_ResourceMgrMap.clear();
|
||||
|
||||
}
|
||||
void CResource::ReleaseAllData()
|
||||
{
|
||||
for(RESOURCETABLEITER itr = m_ResourceMgrMap.begin(); itr != m_ResourceMgrMap.end();)
|
||||
{
|
||||
if(itr->second != NULL)
|
||||
{
|
||||
itr->second->ReleaseAllData();
|
||||
}
|
||||
itr++;
|
||||
}
|
||||
}
|
||||
void *CResource::GetData(int iType,const char *strName)
|
||||
{
|
||||
RESOURCETABLEITER itr = m_ResourceMgrMap.find(iType);
|
||||
if(itr != m_ResourceMgrMap.end())
|
||||
{
|
||||
return itr->second->GetData(strName);
|
||||
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
void CResource::ReleaseObj(int iType,char *strName)
|
||||
{
|
||||
|
||||
RESOURCETABLEITER itr = m_ResourceMgrMap.find(iType);
|
||||
if(itr != m_ResourceMgrMap.end())
|
||||
{
|
||||
itr->second->ReleaseData(strName);
|
||||
}
|
||||
}
|
||||
|
||||
// 2005.01.10 yundi ImmediateLoad <20><><EFBFBD><EFBFBD> <20>߰<EFBFBD>
|
||||
void CResource::LockImmediateLoad(int iType)
|
||||
{
|
||||
RESOURCETABLEITER itr = m_ResourceMgrMap.find(iType);
|
||||
if(itr != m_ResourceMgrMap.end())
|
||||
{
|
||||
itr->second->LockImmediateLoad();
|
||||
}
|
||||
}
|
||||
void CResource::UnlockImmediateLoad(int iType)
|
||||
{
|
||||
RESOURCETABLEITER itr = m_ResourceMgrMap.find(iType);
|
||||
if(itr != m_ResourceMgrMap.end())
|
||||
{
|
||||
itr->second->UnlockImmediateLoad();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user