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>
84 lines
1.7 KiB
C++
84 lines
1.7 KiB
C++
// TextureContainer.cpp: implementation of the CTextureContainer class.
|
|
//
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
#include "TextureContainer.h"
|
|
#include "GMMemory.h"
|
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
// Construction/Destruction
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
CTextureContainer::CTextureContainer()
|
|
{
|
|
|
|
}
|
|
|
|
CTextureContainer::~CTextureContainer()
|
|
{
|
|
DeleteAllTexture();
|
|
}
|
|
|
|
void CTextureContainer::AddTexture(const char *strTextName, const LPDIRECT3DBASETEXTURE8 pddTexture)
|
|
{
|
|
TextureNode* pAdd = new TextureNode(strTextName,pddTexture);
|
|
|
|
m_TextureList.push_back(pAdd);
|
|
}
|
|
|
|
int CTextureContainer::FindTexture(char *strTextName)
|
|
{
|
|
for(int i=0;i<(int)m_TextureList.size();i++)
|
|
{
|
|
if(strcmp(m_TextureList[i]->m_strTextureName,strTextName)==0)
|
|
return i;
|
|
}
|
|
return -1;
|
|
}
|
|
|
|
LPDIRECT3DBASETEXTURE8 CTextureContainer::AddUsedTexture(int nUsed)
|
|
{
|
|
m_TextureList[nUsed]->m_nUsed++;
|
|
return m_TextureList[nUsed]->m_pddsTexture;
|
|
}
|
|
|
|
void CTextureContainer::DeleteTexture(char *strTextName)
|
|
{
|
|
std::vector<TextureNode*>::iterator obj = m_TextureList.begin();
|
|
|
|
for(int i=0;i<(int)m_TextureList.size();i++,obj++)
|
|
{
|
|
if(strcmp(m_TextureList[i]->m_strTextureName,strTextName)==0)
|
|
{
|
|
if(--m_TextureList[i]->m_nUsed==0)
|
|
{
|
|
TextureNode *temp=m_TextureList[i];
|
|
|
|
if(temp != NULL)
|
|
{
|
|
delete temp;
|
|
temp = NULL;
|
|
}
|
|
|
|
m_TextureList.erase(obj);
|
|
|
|
return;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
void CTextureContainer::DeleteAllTexture()
|
|
{
|
|
for(int i=0;i<(int)m_TextureList.size();i++)
|
|
{
|
|
if(m_TextureList[i] != NULL)
|
|
{
|
|
delete m_TextureList[i];
|
|
m_TextureList[i] = NULL;
|
|
}
|
|
}
|
|
|
|
m_TextureList.clear();
|
|
}
|