Restructure repository to include all source folders
Move git root from Client/ to src/ to track all source code: - Client: Game client source (moved to Client/Client/) - Server: Game server source - GameTools: Development tools - CryptoSource: Encryption utilities - database: Database scripts - Script: Game scripts - rylCoder_16.02.2008_src: Legacy coder tools - GMFont, Game: Additional resources 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
143
GameTools/Effect/EffectCasher.cpp
Normal file
143
GameTools/Effect/EffectCasher.cpp
Normal file
@@ -0,0 +1,143 @@
|
||||
// EffectCasher.cpp: implementation of the CEffectCasher class.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "EffectCasher.h"
|
||||
#include "SceneManager.h"
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// Construction/Destruction
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
CEffectCashObj::CEffectCashObj()
|
||||
{
|
||||
m_pData = NULL;
|
||||
}
|
||||
CEffectCashObj::CEffectCashObj(const char *strName)
|
||||
{
|
||||
EffectLoad(strName);
|
||||
}
|
||||
bool CEffectCashObj::EffectLoad(const char *strName) {
|
||||
|
||||
m_pData = new CEffScript;
|
||||
m_pData->GetScriptBinData((char *)strName);
|
||||
m_pData->SetDevice(CSceneManager::GetDevice());
|
||||
/* m_pData->SetStartPos(0.0f,0.0f,0.0f);
|
||||
m_pData->SetEndPos(0.0f,0.0f,0.0f);
|
||||
|
||||
|
||||
m_pData->ProcessEffect();
|
||||
*/
|
||||
return true;
|
||||
|
||||
}
|
||||
CEffectCashObj::~CEffectCashObj()
|
||||
{
|
||||
if(m_pData != NULL)
|
||||
{
|
||||
delete m_pData;
|
||||
m_pData = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
CEffectCasher::CEffectCasher()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
CEffectCasher::~CEffectCasher()
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
bool CEffectCasher::LoadCashData(const char *strPath)
|
||||
{
|
||||
return true;
|
||||
|
||||
}
|
||||
bool CEffectCasher::BuildHashTable(const char *strPath)
|
||||
{
|
||||
char strFilePath[256] = {0,};
|
||||
|
||||
|
||||
strcpy(strFilePath,strPath);
|
||||
strcat(strFilePath,"/*.esf");
|
||||
WIN32_FIND_DATA FindFileData;
|
||||
HANDLE hFind;
|
||||
hFind = FindFirstFile(strFilePath, &FindFileData);
|
||||
|
||||
if (hFind == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
MessageBox(NULL,"Effect Loader<65><72> <20><><EFBFBD><EFBFBD> <20>߽<EFBFBD><DFBD>ϴ<EFBFBD>.","ERROR",MB_OK);
|
||||
return false;
|
||||
}
|
||||
|
||||
m_iCashNum = 0;
|
||||
|
||||
while(1)
|
||||
{
|
||||
unsigned long ulTmp;
|
||||
CEffectCashObj *pNode = new CEffectCashObj(FindFileData.cFileName);
|
||||
|
||||
ulTmp = CheckHashIndex(FindFileData.cFileName);
|
||||
|
||||
ISDATAITER itr = m_HashTable.find(ulTmp);
|
||||
|
||||
if(itr == m_HashTable.end())
|
||||
{
|
||||
|
||||
m_HashTable.insert(DATACASHOBJ(ulTmp,pNode));
|
||||
m_iCashNum++;
|
||||
}
|
||||
else
|
||||
{// map <20>ȿ<EFBFBD> <20>Ȱ<EFBFBD><C8B0><EFBFBD> Hash Index <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
||||
((*itr).second)->m_pNext.push_back(pNode);
|
||||
((*itr).second)->m_iNext++;
|
||||
}
|
||||
if(!FindNextFile(hFind,&FindFileData))
|
||||
break;
|
||||
}
|
||||
FindClose(hFind);
|
||||
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
void *CEffectCasher::GetCashData(const char *strName)
|
||||
{
|
||||
unsigned long ulTmp = CheckHashIndex(strName);
|
||||
ISDATAITER itr = m_HashTable.find(ulTmp);
|
||||
|
||||
if(itr == m_HashTable.end())
|
||||
return NULL;
|
||||
|
||||
if((*itr).second != NULL) {
|
||||
if(!strcmp(((CEffectCashObj *)((*itr).second))->m_pData->m_FileName,strName))
|
||||
return ((CEffectCashObj *)((*itr).second))->m_pData;
|
||||
else {
|
||||
for(int i=0;i < ((*itr).second)->m_iNext; i++) {
|
||||
if(!strcmp(((CEffectCashObj *)(((*itr).second)->m_pNext[i]))->m_pData->m_FileName,strName))
|
||||
return ((CEffectCashObj *)(((*itr).second)->m_pNext[i]))->m_pData;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
|
||||
}
|
||||
// Hash Index Check( <20><><EFBFBD>ڿ<EFBFBD> )
|
||||
unsigned long CEffectCasher::CheckHashIndex(const char *strFileName)
|
||||
{
|
||||
unsigned long ulHashId = 0;
|
||||
|
||||
int iLength = strlen(strFileName);
|
||||
|
||||
for(int i=0;i < iLength; i++) {
|
||||
ulHashId += (( i + 1) * strFileName[i]);
|
||||
}
|
||||
return ulHashId;
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user