Files
Client/GameTools/Effect/EffectCasher.cpp
LGram16 dd97ddec92 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>
2025-11-29 20:17:20 +09:00

144 lines
2.8 KiB
C++

// 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가 실패 했습니다.","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 안에 똑같은 Hash Index 를 가지는 요소 존재
((*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( 문자열 )
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;
}