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>
941 lines
30 KiB
C++
941 lines
30 KiB
C++
// HouseObjectContainer.cpp: implementation of the CHouseObjectContainer class.
|
||
//
|
||
//////////////////////////////////////////////////////////////////////
|
||
|
||
#include "HouseObjectContainer.h"
|
||
#include "SceneManager.h"
|
||
#include "RenderOption.h"
|
||
|
||
//////////////////////////////////////////////////////////////////////
|
||
// Construction/Destruction
|
||
//////////////////////////////////////////////////////////////////////
|
||
//List<CHouseObjectContainer::HouseObjectNode*> CHouseObjectContainer::m_HouseContainer;
|
||
|
||
char* strfind(char *str,char *p,long size)
|
||
{
|
||
int len=strlen(str);
|
||
int i,j;
|
||
bool isSame;
|
||
for(i=0;i<len-(size-1);i++)
|
||
{
|
||
isSame=true;
|
||
for(j=0;j<size-1;j++)
|
||
{
|
||
if(str[i+j]!=p[j])
|
||
{
|
||
isSame=false;
|
||
break;
|
||
}
|
||
}
|
||
if(isSame)
|
||
return &str[i];
|
||
}
|
||
return NULL;
|
||
}
|
||
|
||
CHouseObjectContainer::HouseObjectNode::HouseObjectNode(CHouseObject *pHouseObject,char *strHouseName,char *strIn,char *strMed,char *strOut,char *strBsp)
|
||
{
|
||
strcpy(m_strHouseName,strHouseName);
|
||
strcpy(m_strMedName,strMed);
|
||
strcpy(m_strInName,strIn);
|
||
strcpy(m_strBspName,strBsp);
|
||
strcpy(m_strOutName,strOut);
|
||
|
||
m_pHouseObject=pHouseObject;
|
||
m_nUsed=1;
|
||
m_nOutHouseUsed=0;
|
||
m_nMedHouseUsed=0;
|
||
m_nInHouseUsed=0;
|
||
};
|
||
CHouseObjectContainer::HouseObjectNode::~HouseObjectNode()
|
||
{
|
||
if(m_pHouseObject)
|
||
delete m_pHouseObject;
|
||
};
|
||
|
||
|
||
CHouseObjectContainer::CHouseObjectContainer()
|
||
{
|
||
|
||
}
|
||
|
||
CHouseObjectContainer::~CHouseObjectContainer()
|
||
{
|
||
DeleteAllObject();
|
||
}
|
||
|
||
void CHouseObjectContainer::Load(char *strOut, char *strMed, char *strIn,char *strBsp,CMapStorage *pMapStorage)
|
||
{
|
||
char strOutName[MAX_NAMEBUFFER],strMedName[MAX_NAMEBUFFER],strInName[MAX_NAMEBUFFER],strBspName[MAX_NAMEBUFFER];
|
||
char *strExtract;
|
||
strcpy(strOutName,strOut);
|
||
strcpy(strMedName,strMed);
|
||
strcpy(strInName,strIn);
|
||
strcpy(strBspName,strBsp);
|
||
CHouseObject *pHouseObject=new CHouseObject();
|
||
CSceneManager::m_MeshObjectContainer.SetPath(HOUSEOBJECTPATH);
|
||
|
||
if(strcmp(strOut,"")!=0)
|
||
{
|
||
char strPathLodHouse[MAX_NAMEBUFFER];
|
||
char strLodHouse[MAX_NAMEBUFFER];
|
||
sprintf(strLodHouse,"%s",strOutName);
|
||
|
||
strExtract=strfind(strLodHouse,"_other",sizeof("_other"));
|
||
if(strExtract)
|
||
{
|
||
strExtract[0]='_';
|
||
strExtract[1]='L';
|
||
strExtract[2]='O';
|
||
strExtract[3]='D';
|
||
strExtract[4]='.';
|
||
strExtract[5]='R';
|
||
strExtract[6]='3';
|
||
strExtract[7]='S';
|
||
strExtract[8]=0;
|
||
}
|
||
else
|
||
{
|
||
int lens=strlen(strLodHouse);
|
||
strLodHouse[lens+4]='\0';
|
||
strLodHouse[lens+3]='S';
|
||
strLodHouse[lens+2]='3';
|
||
strLodHouse[lens+1]='R';
|
||
strLodHouse[lens-0]='.';
|
||
strLodHouse[lens-1]='D';
|
||
strLodHouse[lens-2]='O';
|
||
strLodHouse[lens-3]='L';
|
||
strLodHouse[lens-4]='_';
|
||
}
|
||
|
||
CSceneManager::m_MeshObjectContainer.SetPath(HOUSEOBJECTPATH);
|
||
sprintf(strPathLodHouse,"%s\\%s",HOUSEOBJECTPATH,strLodHouse);
|
||
FILE *fp=fopen(strPathLodHouse,"rb");
|
||
if(fp)
|
||
{
|
||
fclose(fp);
|
||
pHouseObject->m_pLodHouseObject=CSceneManager::m_MeshObjectContainer.GetMeshObject(strLodHouse);
|
||
pHouseObject->m_pLodHouseObject->ConvertNormal();
|
||
}
|
||
else
|
||
{
|
||
|
||
pHouseObject->m_pOutHouseObject=CSceneManager::m_MeshObjectContainer.GetMeshObject(strOut);
|
||
if(GF3OPTION)
|
||
{
|
||
//pHouseObject->m_pOutHouseObject->ConvertDetail();
|
||
}
|
||
}
|
||
|
||
char strLightmap[MAX_NAMEBUFFER];
|
||
sprintf(strLightmap,"%s\\%s",LIGHTMAPTEXTUREPATH,strInName);
|
||
strLightmap[strlen(strLightmap)-1]='S';
|
||
strLightmap[strlen(strLightmap)-2]='D';
|
||
strLightmap[strlen(strLightmap)-3]='D';
|
||
fp=fopen(strLightmap,"rb");
|
||
if(fp && CRenderOption::m_BuildingLightmap)
|
||
{
|
||
fclose(fp);
|
||
fp=NULL;
|
||
pHouseObject->m_isHaveInLightmap=true;
|
||
sprintf(strLightmap,"%s",strIn);
|
||
strLightmap[strlen(strLightmap)-1]='S';
|
||
strLightmap[strlen(strLightmap)-2]='D';
|
||
strLightmap[strlen(strLightmap)-3]='D';
|
||
strcpy(pHouseObject->m_InLightmap.m_strName,strLightmap);
|
||
if(pHouseObject->m_pLodHouseObject==NULL)
|
||
{
|
||
CTexture::SetPath(LIGHTMAPTEXTUREPATH);
|
||
pHouseObject->m_InLightmap.Load(pHouseObject->m_InLightmap.m_strName);
|
||
}
|
||
}
|
||
else
|
||
{
|
||
pHouseObject->m_isHaveInLightmap=false;
|
||
}
|
||
if(1)
|
||
{
|
||
char strLightmap[MAX_NAMEBUFFER];
|
||
sprintf(strLightmap,"%s\\%s",LIGHTMAPTEXTUREPATH,strOutName);
|
||
strLightmap[strlen(strLightmap)-1]='S';
|
||
strLightmap[strlen(strLightmap)-2]='D';
|
||
strLightmap[strlen(strLightmap)-3]='D';
|
||
fp=fopen(strLightmap,"rb");
|
||
if(fp && CRenderOption::m_BuildingLightmap)
|
||
{
|
||
fclose(fp);
|
||
fp=NULL;
|
||
pHouseObject->m_isHaveLightmap=true;
|
||
sprintf(strLightmap,"%s",strOut);
|
||
strLightmap[strlen(strLightmap)-1]='S';
|
||
strLightmap[strlen(strLightmap)-2]='D';
|
||
strLightmap[strlen(strLightmap)-3]='D';
|
||
strcpy(pHouseObject->m_Lightmap.m_strName,strLightmap);
|
||
if(pHouseObject->m_pLodHouseObject==NULL)
|
||
{
|
||
CTexture::SetPath(LIGHTMAPTEXTUREPATH);
|
||
pHouseObject->m_Lightmap.Load(pHouseObject->m_Lightmap.m_strName);
|
||
}
|
||
//pHouseObject->m_Lightmap.Load(strLightmap);
|
||
//////////////
|
||
// <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>Ʈ <20><> <20>ε<EFBFBD>
|
||
char strNightLightMap[256] = {0};
|
||
sprintf(strNightLightMap,"%s\\",LIGHTMAPTEXTUREPATH);
|
||
strcat(strNightLightMap,pHouseObject->m_Lightmap.m_strName);
|
||
char *pChr = strrchr(strNightLightMap,'.');
|
||
*(pChr++) = '_';
|
||
*(pChr++) = 'N';
|
||
*(pChr++) = '.';
|
||
*(pChr++) = 'D';
|
||
*(pChr++) = 'D';
|
||
*(pChr++) = 'S';
|
||
|
||
fp = fopen(strNightLightMap,"rb");
|
||
if(fp != NULL)
|
||
{
|
||
fclose(fp);
|
||
pChr = strrchr(strNightLightMap,'\\');
|
||
CTexture::SetPath(LIGHTMAPTEXTUREPATH);
|
||
pHouseObject->m_BackupLightmap.Load(pChr);
|
||
pHouseObject->m_bNightMap = true;
|
||
|
||
|
||
}
|
||
else
|
||
{
|
||
pHouseObject->m_bNightMap = false;
|
||
}
|
||
// <20><><EFBFBD><EFBFBD> uv load
|
||
|
||
pChr = strrchr(strNightLightMap,'\\');
|
||
char *pChr2 = strrchr(pChr,'_');
|
||
*(pChr2++) = '.';
|
||
*(pChr2++) = 'u';
|
||
*(pChr2++) = 'v';
|
||
*(pChr2++) = '\0';
|
||
|
||
sprintf(strNightLightMap,"%s%s",HOUSEOBJECTPATH,pChr);
|
||
if(pHouseObject->m_pOutHouseObject != NULL) {
|
||
|
||
fp = fopen(strNightLightMap,"rb");
|
||
if(fp != NULL)
|
||
{
|
||
|
||
pHouseObject->m_bNightUv = true;
|
||
|
||
pHouseObject->m_pOutHouseObject->AllLockBuffer();
|
||
|
||
if(pHouseObject->m_pBackupVertex.num <=0 )
|
||
{
|
||
int iBufferNum = 0;
|
||
fread((int *)&iBufferNum,sizeof(int),1,fp);
|
||
|
||
for(int i=0;i<iBufferNum;i++)
|
||
{
|
||
int iVertsNum = 0;
|
||
|
||
fread((int *)&iVertsNum,sizeof(int),1,fp);
|
||
|
||
MultiVertex *pVertexNode = new MultiVertex[iVertsNum];
|
||
MultiVertex *pVertexNode2 = new MultiVertex[iVertsNum];
|
||
|
||
fread((pVertexNode),sizeof(MultiVertex)*(iVertsNum),1,fp);
|
||
pHouseObject->m_pBackupVertex.Add(pVertexNode);
|
||
pHouseObject->m_pBackupTmp.Add(pVertexNode2);
|
||
|
||
}
|
||
}
|
||
pHouseObject->m_pOutHouseObject->AllUnlockBuffer();
|
||
|
||
fclose(fp);
|
||
|
||
}
|
||
else
|
||
{
|
||
pHouseObject->m_bNightUv = false;
|
||
|
||
}
|
||
|
||
}
|
||
else
|
||
{
|
||
pHouseObject->m_bNightUv = false;
|
||
}
|
||
//////////////
|
||
}
|
||
else
|
||
{
|
||
if(pHouseObject->m_pOutHouseObject)
|
||
{
|
||
pHouseObject->m_pOutHouseObject->ConvertNormal();
|
||
sprintf(strLightmap,"%s\\Detail_%s",OBJECTTEXTUREPATH,strOutName);
|
||
strLightmap[strlen(strLightmap)-1]='S';
|
||
strLightmap[strlen(strLightmap)-2]='D';
|
||
strLightmap[strlen(strLightmap)-3]='D';
|
||
fp=fopen(strLightmap,"rb");
|
||
if(fp)
|
||
{
|
||
fclose(fp);
|
||
sprintf(strLightmap,"Detail_%s",strOutName);
|
||
strLightmap[strlen(strLightmap)-1]='S';
|
||
strLightmap[strlen(strLightmap)-2]='D';
|
||
strLightmap[strlen(strLightmap)-3]='D';
|
||
strcpy(pHouseObject->m_Detailmap.m_strName,strLightmap);
|
||
pHouseObject->m_Detailmap.Load(pHouseObject->m_Detailmap.m_strName);
|
||
//pHouseObject->m_pOutHouseObject->ConvertDetail();
|
||
}
|
||
//////////////
|
||
// <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>Ʈ <20><> <20>ε<EFBFBD>
|
||
/* char strNightLightMap[256] = {0};
|
||
sprintf(strNightLightMap,"%s\\",LIGHTMAPTEXTUREPATH);
|
||
strcat(strNightLightMap,pHouseObject->m_Lightmap.m_strName);
|
||
char *pChr = strrchr(strNightLightMap,'.');
|
||
*(pChr++) = '_';
|
||
*(pChr++) = 'N';
|
||
*(pChr++) = '.';
|
||
*(pChr++) = 'D';
|
||
*(pChr++) = 'D';
|
||
*(pChr++) = 'S';
|
||
|
||
fp = fopen(strNightLightMap,"rb");
|
||
if(fp != NULL)
|
||
{
|
||
fclose(fp);
|
||
pHouseObject->m_BackupLightmap.Load(strNightLightMap);
|
||
pHouseObject->m_bNightData = true;
|
||
|
||
|
||
}
|
||
else
|
||
{
|
||
pHouseObject->m_bNightData = false;
|
||
}
|
||
// <20><><EFBFBD><EFBFBD> uv load
|
||
pChr = strrchr(strNightLightMap,'_');
|
||
*(pChr++) = 'u';
|
||
*(pChr++) = 'v';
|
||
|
||
fp = fopen(strNightLightMap,"rb");
|
||
if(fp != NULL)
|
||
{
|
||
pHouseObject->m_bNightData = true;
|
||
|
||
pHouseObject->m_pOutHouseObject->AllLockBuffer();
|
||
|
||
|
||
for(int i=0;i<pHouseObject->m_pOutHouseObject->m_pVertexBuffer.num;i++)
|
||
{
|
||
MultiVertex *pVertexNode = new MultiVertex[pHouseObject->m_pOutHouseObject->m_nVertex[i]];
|
||
MultiVertex *pVertexNode2 = new MultiVertex[pHouseObject->m_pOutHouseObject->m_nVertex[i]];
|
||
|
||
fread((pVertexNode),sizeof(MultiVertex)*(pHouseObject->m_pOutHouseObject->m_nVertex[i]),1,fp);
|
||
pHouseObject->m_pBackupVertex.Add(pVertexNode);
|
||
pHouseObject->m_pBackupTmp.Add(pVertexNode2);
|
||
|
||
}
|
||
pHouseObject->m_pOutHouseObject->AllUnlockBuffer();
|
||
|
||
fclose(fp);
|
||
|
||
}
|
||
else
|
||
{
|
||
pHouseObject->m_bNightData = false;
|
||
|
||
}
|
||
|
||
|
||
//////////////*/
|
||
}
|
||
}
|
||
}
|
||
char strOctree[MAX_NAMEBUFFER];
|
||
sprintf(strOctree,"%s",strOutName);
|
||
strOctree[strlen(strOctree)-1]='T';
|
||
strOctree[strlen(strOctree)-2]='C';
|
||
strOctree[strlen(strOctree)-3]='O';
|
||
pHouseObject->m_pOctree=CSceneManager::m_OctreeContainer.GetOctree(strOctree);
|
||
}
|
||
//pHouseObject->m_pOctree=NULL;//CSceneManager::m_OctreeContainer.GetOctree(strOctree);
|
||
|
||
strOut=strlwr(strOut);
|
||
strMed=strlwr(strMed);
|
||
strIn=strlwr(strIn);
|
||
strBsp=strlwr(strBsp);
|
||
HouseObjectNode *AddNode=new HouseObjectNode(pHouseObject,"<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>",strIn,strMed,strOut,strBsp);
|
||
pHouseObject->m_pInHouseMap=NULL;
|
||
if(strcmp(strBsp,"")==0)
|
||
{
|
||
strExtract=strfind(strOutName,"_other",sizeof("_other"));
|
||
if(strExtract)
|
||
{
|
||
strExtract[0]='.';
|
||
strExtract[1]='r';
|
||
strExtract[2]='3';
|
||
strExtract[3]='s';
|
||
strExtract[4]=0;
|
||
if(strcmp(strMedName,"")!=0)
|
||
{
|
||
strExtract=strfind(strMedName,"_other",sizeof("_other"));
|
||
if(strExtract==NULL)
|
||
{
|
||
|
||
}
|
||
strExtract[0]='.';
|
||
strExtract[1]='r';
|
||
strExtract[2]='3';
|
||
strExtract[3]='s';
|
||
strExtract[4]=0;
|
||
}
|
||
if(strcmp(strInName,"")!=0)
|
||
{
|
||
strExtract=strfind(strInName,"_other",sizeof("_other"));
|
||
if(strExtract==NULL)
|
||
{
|
||
|
||
}
|
||
strExtract[0]='.';
|
||
strExtract[1]='r';
|
||
strExtract[2]='3';
|
||
strExtract[3]='s';
|
||
strExtract[4]=0;
|
||
}
|
||
}
|
||
pHouseObject->m_pInHouseMap=pMapStorage->FindInHouseMap(strOutName,strMedName,strInName,strBsp);
|
||
}
|
||
pHouseObject->m_pBspObject=NULL;
|
||
if(strcmp(strBsp,"")!=0)
|
||
{
|
||
pHouseObject->m_pBspObject=new CBspScene();
|
||
char strBspName[256];
|
||
sprintf(strBspName,"%s%s","c:\\",strBsp);
|
||
pHouseObject->m_pBspObject->Load(strBspName);
|
||
pHouseObject->m_pInHouseMap=pMapStorage->FindInHouseMap(strOutName,strMedName,strInName,strBsp);
|
||
}
|
||
//pHouseObject->m_pInHouseMap=NULL;
|
||
m_HouseContainer.Add(AddNode);
|
||
}
|
||
|
||
CHouseObject *CHouseObjectContainer::GetHouseObject(char *strOut, char *strMed, char *strIn,char *strBsp,bool &isAlready,CMapStorage *pMapStorage)
|
||
{
|
||
strOut=strlwr(strOut);
|
||
strMed=strlwr(strMed);
|
||
strIn=strlwr(strIn);
|
||
for(int i=0;i<m_HouseContainer.num;i++)
|
||
{
|
||
if( strcmp(m_HouseContainer[i]->m_strInName,strIn)==0 &&
|
||
strcmp(m_HouseContainer[i]->m_strMedName,strMed)==0 &&
|
||
strcmp(m_HouseContainer[i]->m_strOutName,strOut)==0)
|
||
{
|
||
m_HouseContainer[i]->m_nUsed++;
|
||
isAlready=true;
|
||
return m_HouseContainer[i]->m_pHouseObject;
|
||
}
|
||
}
|
||
isAlready=false;
|
||
Load(strOut,strMed,strIn,strBsp,pMapStorage);
|
||
return m_HouseContainer[i]->m_pHouseObject;
|
||
}
|
||
|
||
void CHouseObjectContainer::DeleteHouseObject(char *strOut, char *strMed, char *strIn,char *strBsp)
|
||
{
|
||
strOut=strlwr(strOut);
|
||
strMed=strlwr(strMed);
|
||
strIn=strlwr(strIn);
|
||
for(int i=0;i<m_HouseContainer.num;i++)
|
||
{
|
||
if( strcmp(m_HouseContainer[i]->m_strInName,strIn)==0 &&
|
||
strcmp(m_HouseContainer[i]->m_strMedName,strMed)==0 &&
|
||
strcmp(m_HouseContainer[i]->m_strOutName,strOut)==0 &&
|
||
strcmp(m_HouseContainer[i]->m_strBspName,strBsp)==0 )
|
||
{
|
||
if(--m_HouseContainer[i]->m_nUsed==0)
|
||
{
|
||
HouseObjectNode *delNode=m_HouseContainer[i];
|
||
CSceneManager::m_MeshObjectContainer.DeleteMeshObject(delNode->m_strOutName);
|
||
CSceneManager::m_MeshObjectContainer.DeleteMeshObject(delNode->m_strMedName);
|
||
CSceneManager::m_MeshObjectContainer.DeleteMeshObject(delNode->m_strInName);
|
||
for(int cLight=0;cLight<m_HouseContainer[i]->m_pHouseObject->m_LightList.num;cLight++)
|
||
{
|
||
/*
|
||
CSceneManager::m_LightObjectContainer.DeleteLightObject(m_HouseContainer[i]->m_pHouseObject->m_LightList[cLight]->m_pLightObject->m_strLightObjectName,
|
||
m_HouseContainer[i]->m_pHouseObject->m_LightList[cLight]->m_pLightObject->m_fLightRange,
|
||
m_HouseContainer[i]->m_pHouseObject->m_LightList[cLight]->m_pLightObject->m_LightColor);
|
||
*/
|
||
delete m_HouseContainer[i]->m_pHouseObject->m_LightList[cLight];
|
||
}
|
||
m_HouseContainer[i]->m_pHouseObject->m_LightList.num=0;
|
||
|
||
for(int cObject=0;cObject<m_HouseContainer[i]->m_pHouseObject->m_ObjectList.num;cObject++)
|
||
{
|
||
/*
|
||
CSceneManager::m_ObjectContainer.DeleteObject(m_HouseContainer[i]->m_pHouseObject->m_ObjectList[cObject]->m_strObjectName,
|
||
m_HouseContainer[i]->m_pHouseObject->m_ObjectList[cObject]->m_isAlpha,
|
||
m_HouseContainer[i]->m_pHouseObject->m_ObjectList[cObject]->m_isLight);
|
||
*/
|
||
|
||
delete m_HouseContainer[i]->m_pHouseObject->m_ObjectList[cObject];
|
||
}
|
||
m_HouseContainer[i]->m_pHouseObject->m_ObjectList.num=0;
|
||
|
||
char strOctree[MAX_NAMEBUFFER];
|
||
strcpy(strOctree,m_HouseContainer[i]->m_strOutName);
|
||
strOctree[strlen(strOctree)-1]='T';
|
||
strOctree[strlen(strOctree)-2]='C';
|
||
strOctree[strlen(strOctree)-3]='O';
|
||
|
||
CSceneManager::m_OctreeContainer.DeleteOctree(strOctree);
|
||
if(m_HouseContainer[i]->m_pHouseObject->m_pBspObject)
|
||
{
|
||
delete m_HouseContainer[i]->m_pHouseObject->m_pBspObject;
|
||
m_HouseContainer[i]->m_pHouseObject->m_pBspObject=NULL;
|
||
}
|
||
delete delNode;
|
||
m_HouseContainer.DelIndex(i);
|
||
}
|
||
return;
|
||
}
|
||
}
|
||
}
|
||
|
||
void CHouseObjectContainer::DeleteAllObject()
|
||
{
|
||
for(int i=0;i<m_HouseContainer.num;i++)
|
||
{
|
||
HouseObjectNode *delNode=m_HouseContainer[i];
|
||
|
||
for(int cLight=0;cLight<m_HouseContainer[i]->m_pHouseObject->m_LightList.num;cLight++)
|
||
{
|
||
CSceneManager::m_LightObjectContainer.DeleteLightObject(m_HouseContainer[i]->m_pHouseObject->m_LightList[cLight]->m_pLightObject->m_strLightObjectName,
|
||
m_HouseContainer[i]->m_pHouseObject->m_LightList[cLight]->m_pLightObject->m_fLightRange,
|
||
m_HouseContainer[i]->m_pHouseObject->m_LightList[cLight]->m_pLightObject->m_LightColor);
|
||
delete m_HouseContainer[i]->m_pHouseObject->m_LightList[cLight];
|
||
}
|
||
m_HouseContainer[i]->m_pHouseObject->m_LightList.num=0;
|
||
|
||
for(int cObject=0;cObject<m_HouseContainer[i]->m_pHouseObject->m_ObjectList.num;cObject++)
|
||
{
|
||
CSceneManager::m_ObjectContainer.DeleteObject(m_HouseContainer[i]->m_pHouseObject->m_ObjectList[cObject]->m_strObjectName,
|
||
m_HouseContainer[i]->m_pHouseObject->m_ObjectList[cObject]->m_isAlpha,
|
||
m_HouseContainer[i]->m_pHouseObject->m_ObjectList[cObject]->m_isLight);
|
||
|
||
delete m_HouseContainer[i]->m_pHouseObject->m_ObjectList[cObject];
|
||
}
|
||
//if(!m_HouseContainer[i]->m_pHouseObject->m_pBspObject)
|
||
if(strcmp(m_HouseContainer[i]->m_strOutName,"")!=0)
|
||
{
|
||
char strOctree[MAX_NAMEBUFFER];
|
||
strcpy(strOctree,m_HouseContainer[i]->m_strOutName);
|
||
strOctree[strlen(strOctree)-1]='T';
|
||
strOctree[strlen(strOctree)-2]='C';
|
||
strOctree[strlen(strOctree)-3]='O';
|
||
CSceneManager::m_OctreeContainer.DeleteOctree(strOctree);
|
||
}
|
||
if(m_HouseContainer[i]->m_pHouseObject->m_pBspObject)
|
||
{
|
||
delete m_HouseContainer[i]->m_pHouseObject->m_pBspObject;
|
||
m_HouseContainer[i]->m_pHouseObject->m_pBspObject=NULL;
|
||
}
|
||
delete m_HouseContainer[i]->m_pHouseObject;
|
||
m_HouseContainer[i]->m_pHouseObject=NULL;
|
||
delete delNode;
|
||
}
|
||
m_HouseContainer.num=0;
|
||
}
|
||
|
||
void CHouseObjectContainer::LoadOut(char *strOut, char *strMed, char *strIn)
|
||
{
|
||
strOut=strlwr(strOut);
|
||
strMed=strlwr(strMed);
|
||
strIn=strlwr(strIn);
|
||
for(int i=0;i<m_HouseContainer.num;i++)
|
||
{
|
||
if( strcmp(m_HouseContainer[i]->m_strInName,strIn)==0 &&
|
||
strcmp(m_HouseContainer[i]->m_strMedName,strMed)==0 &&
|
||
strcmp(m_HouseContainer[i]->m_strOutName,strOut)==0)
|
||
{
|
||
if(m_HouseContainer[i]->m_pHouseObject->m_pOutHouseObject==NULL)
|
||
{
|
||
CSceneManager::m_MeshObjectContainer.SetPath(HOUSEOBJECTPATH);
|
||
|
||
m_HouseContainer[i]->m_pHouseObject->m_pOutHouseObject=
|
||
CSceneManager::m_MeshObjectContainer.GetMeshObject(strOut);
|
||
m_HouseContainer[i]->m_nOutHouseUsed++;
|
||
|
||
|
||
if(!m_HouseContainer[i]->m_pHouseObject->m_isHaveLightmap)
|
||
{
|
||
m_HouseContainer[i]->m_pHouseObject->m_pOutHouseObject->ConvertNormal();
|
||
}
|
||
else
|
||
{
|
||
CTexture::SetPath(LIGHTMAPTEXTUREPATH);
|
||
m_HouseContainer[i]->m_pHouseObject->m_Lightmap.Load(
|
||
m_HouseContainer[i]->m_pHouseObject->m_Lightmap.m_strName);
|
||
|
||
|
||
if(GF3OPTION)
|
||
{
|
||
//m_HouseContainer[i]->m_pHouseObject->m_pOutHouseObject->ConvertDetail();
|
||
}
|
||
}
|
||
|
||
|
||
|
||
|
||
break;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
void CHouseObjectContainer::LoadMed(char *strOut, char *strMed, char *strIn)
|
||
{
|
||
strOut=strlwr(strOut);
|
||
strMed=strlwr(strMed);
|
||
strIn=strlwr(strIn);
|
||
for(int i=0;i<m_HouseContainer.num;i++)
|
||
{
|
||
if( strcmp(m_HouseContainer[i]->m_strInName,strIn)==0 &&
|
||
strcmp(m_HouseContainer[i]->m_strMedName,strMed)==0 &&
|
||
strcmp(m_HouseContainer[i]->m_strOutName,strOut)==0)
|
||
{
|
||
if(m_HouseContainer[i]->m_pHouseObject->m_pMedHouseObject==NULL)
|
||
{
|
||
if(strcmp(m_HouseContainer[i]->m_strMedName,"")==0)
|
||
return;
|
||
CSceneManager::m_MeshObjectContainer.SetPath(HOUSEOBJECTPATH);
|
||
m_HouseContainer[i]->m_pHouseObject->m_pMedHouseObject
|
||
=CSceneManager::m_MeshObjectContainer.GetMeshObject(strMed);
|
||
m_HouseContainer[i]->m_nMedHouseUsed++;
|
||
if(!m_HouseContainer[i]->m_pHouseObject->m_isHaveLightmap)
|
||
m_HouseContainer[i]->m_pHouseObject->m_pMedHouseObject->ConvertNormal();
|
||
break;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
void CHouseObjectContainer::LoadIn(char *strOut, char *strMed, char *strIn)
|
||
{
|
||
strOut=strlwr(strOut);
|
||
strMed=strlwr(strMed);
|
||
strIn=strlwr(strIn);
|
||
for(int i=0;i<m_HouseContainer.num;i++)
|
||
{
|
||
if( strcmp(m_HouseContainer[i]->m_strInName,strIn)==0 &&
|
||
strcmp(m_HouseContainer[i]->m_strMedName,strMed)==0 &&
|
||
strcmp(m_HouseContainer[i]->m_strOutName,strOut)==0)
|
||
{
|
||
if(m_HouseContainer[i]->m_pHouseObject->m_pInHouseObject==NULL)
|
||
{
|
||
if(strcmp(m_HouseContainer[i]->m_strInName,"")==0)
|
||
return;
|
||
CSceneManager::m_MeshObjectContainer.SetPath(HOUSEOBJECTPATH);
|
||
m_HouseContainer[i]->m_pHouseObject->m_pInHouseObject=
|
||
CSceneManager::m_MeshObjectContainer.GetMeshObject(strIn);
|
||
m_HouseContainer[i]->m_nInHouseUsed++;
|
||
if(!m_HouseContainer[i]->m_pHouseObject->m_isHaveLightmap)
|
||
m_HouseContainer[i]->m_pHouseObject->m_pInHouseObject->ConvertNormal();
|
||
/*
|
||
char strOctree[MAX_NAMEBUFFER];
|
||
sprintf(strOctree,"%s",strOut);
|
||
strOctree[strlen(strOctree)-1]='T';
|
||
strOctree[strlen(strOctree)-2]='C';
|
||
strOctree[strlen(strOctree)-3]='O';
|
||
m_HouseContainer[i]->m_pHouseObject->m_pOctree=CSceneManager::m_OctreeContainer.GetOctree(strOctree);
|
||
*/
|
||
|
||
|
||
//CInHouseObjectMap *pInHouseMap=CMapStorage::FindInHouseMap(strOut,strMed,strIn);
|
||
|
||
/*
|
||
|
||
if(pInHouseMap)
|
||
{
|
||
for(int cLight=0;cLight<pInHouseMap->m_matLightList.num;cLight++)
|
||
{
|
||
CLightObjectScene *AddLightScene=new CLightObjectScene();
|
||
AddLightScene->m_TM=pInHouseMap->m_matLightList[cLight];
|
||
AddLightScene->m_AccumulateTM=pInHouseMap->m_matLightList[cLight];
|
||
AddLightScene->m_pLightObject=CSceneManager::m_LightObjectContainer.GetLightObject(pInHouseMap->m_strLightNameList[cLight],
|
||
pInHouseMap->m_fLightRange[cLight],
|
||
pInHouseMap->m_LightColor[cLight]);
|
||
AddLightScene->m_vecMaxBox=AddLightScene->m_pLightObject->m_pLightObject->m_MaxBox;
|
||
AddLightScene->m_vecMinBox=AddLightScene->m_pLightObject->m_pLightObject->m_MinBox;
|
||
AddLightScene->Init();
|
||
AddLightScene->m_LightID=pInHouseMap->m_LightID[cLight];
|
||
|
||
m_HouseContainer[i]->m_pHouseObject->m_LightList.Add(AddLightScene);
|
||
}
|
||
for(int cObject=0;cObject<pInHouseMap->m_matObjectList.num;cObject++)
|
||
{
|
||
CObjectScene *AddObjectScene=new CObjectScene();
|
||
AddObjectScene->m_TM=pInHouseMap->m_matObjectList[cObject];
|
||
AddObjectScene->m_AccumulateTM=pInHouseMap->m_matObjectList[cObject];
|
||
AddObjectScene->m_pObject=CSceneManager::m_ObjectContainer.GetObject(pInHouseMap->m_strObjectNameList[cObject],
|
||
pInHouseMap->m_isAlpha[cObject],
|
||
pInHouseMap->m_isLight[cObject]);
|
||
AddObjectScene->m_vecMaxBox=AddObjectScene->m_pObject->m_MaxBox;
|
||
AddObjectScene->m_vecMinBox=AddObjectScene->m_pObject->m_MinBox;
|
||
AddObjectScene->Init();
|
||
AddObjectScene->m_isAlpha=pInHouseMap->m_isAlpha[cObject];
|
||
AddObjectScene->m_isLight=pInHouseMap->m_isLight[cObject];
|
||
AddObjectScene->m_ObjectID=pInHouseMap->m_ObjectID[cObject];
|
||
m_HouseContainer[i]->m_pHouseObject->m_ObjectList.Add(AddObjectScene);
|
||
}
|
||
}
|
||
*/
|
||
break;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
void CHouseObjectContainer::LoadInObject(char *strOut, char *strMed, char *strIn)
|
||
{
|
||
strOut=strlwr(strOut);
|
||
strMed=strlwr(strMed);
|
||
strIn=strlwr(strIn);
|
||
for(int i=0;i<m_HouseContainer.num;i++)
|
||
{
|
||
if( strcmp(m_HouseContainer[i]->m_strInName,strIn)==0 &&
|
||
strcmp(m_HouseContainer[i]->m_strMedName,strMed)==0 &&
|
||
strcmp(m_HouseContainer[i]->m_strOutName,strOut)==0)
|
||
{
|
||
CInHouseObjectMap *pInHouseMap=m_HouseContainer[i]->m_pHouseObject->m_pInHouseMap;//=CMapStorage::FindInHouseMap(strOut,strMed,strIn);
|
||
if(pInHouseMap)
|
||
{
|
||
for(int cLight=0;cLight<pInHouseMap->m_matLightList.num;cLight++)
|
||
{
|
||
CLightObjectScene *AddLightScene=new CLightObjectScene();
|
||
AddLightScene->m_TM=pInHouseMap->m_matLightList[cLight];
|
||
AddLightScene->m_AccumulateTM=pInHouseMap->m_matLightList[cLight];
|
||
AddLightScene->m_pLightObject=CSceneManager::m_LightObjectContainer.GetLightObject(pInHouseMap->m_strLightNameList[cLight],
|
||
pInHouseMap->m_fLightRange[cLight],
|
||
pInHouseMap->m_LightColor[cLight]);
|
||
AddLightScene->m_vecMaxBox=AddLightScene->m_pLightObject->m_pLightObject->m_MaxBox;
|
||
AddLightScene->m_vecMinBox=AddLightScene->m_pLightObject->m_pLightObject->m_MinBox;
|
||
AddLightScene->Init();
|
||
AddLightScene->m_LightID=pInHouseMap->m_LightID[cLight];
|
||
|
||
m_HouseContainer[i]->m_pHouseObject->m_LightList.Add(AddLightScene);
|
||
}
|
||
for(int cObject=0;cObject<pInHouseMap->m_matObjectList.num;cObject++)
|
||
{
|
||
CObjectScene *AddObjectScene=new CObjectScene();
|
||
AddObjectScene->m_TM=pInHouseMap->m_matObjectList[cObject];
|
||
AddObjectScene->m_AccumulateTM=pInHouseMap->m_matObjectList[cObject];
|
||
|
||
|
||
AddObjectScene->m_pObject=CSceneManager::m_ObjectContainer.GetObject(pInHouseMap->m_strObjectNameList[cObject],
|
||
pInHouseMap->m_isAlpha[cObject],
|
||
pInHouseMap->m_isLight[cObject]);
|
||
|
||
strcpy(AddObjectScene->m_strObjectName,pInHouseMap->m_strObjectNameList[cObject]);
|
||
AddObjectScene->m_vecMaxBox=AddObjectScene->m_pObject->m_MaxBox;
|
||
AddObjectScene->m_vecMinBox=AddObjectScene->m_pObject->m_MinBox;
|
||
AddObjectScene->Init();
|
||
AddObjectScene->m_isAlpha=pInHouseMap->m_isAlpha[cObject];
|
||
AddObjectScene->m_isLight=pInHouseMap->m_isLight[cObject];
|
||
AddObjectScene->m_ObjectID=pInHouseMap->m_ObjectID[cObject];
|
||
m_HouseContainer[i]->m_pHouseObject->m_ObjectList.Add(AddObjectScene);
|
||
}
|
||
}
|
||
break;
|
||
}
|
||
}
|
||
}
|
||
|
||
void CHouseObjectContainer::DeleteOut(char *strOut, char *strMed, char *strIn)
|
||
{
|
||
strOut=strlwr(strOut);
|
||
strMed=strlwr(strMed);
|
||
strIn=strlwr(strIn);
|
||
for(int i=0;i<m_HouseContainer.num;i++)
|
||
{
|
||
if( strcmp(m_HouseContainer[i]->m_strInName,strIn)==0 &&
|
||
strcmp(m_HouseContainer[i]->m_strMedName,strMed)==0 &&
|
||
strcmp(m_HouseContainer[i]->m_strOutName,strOut)==0)
|
||
{
|
||
if(m_HouseContainer[i]->m_pHouseObject->m_pLodHouseObject)
|
||
{
|
||
if(--m_HouseContainer[i]->m_nOutHouseUsed==0)
|
||
{
|
||
/*
|
||
if(strcmp(m_HouseContainer[i]->m_strOutName,"hstone05.R3S")==0)
|
||
{
|
||
char debug[256];
|
||
sprintf(debug,"File=%s,Line=%s",__FILE__,__LINE__);
|
||
MessageBox(NULL,debug,0,0);
|
||
}
|
||
*/
|
||
|
||
// lod <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>;<EFBFBD> <20>Ѵ<EFBFBD> <20><EFBFBD><D7B7>Ƿ<EFBFBD> <20><><EFBFBD><EFBFBD> uv <20><>ü <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> ü<><C3BC><EFBFBD><EFBFBD> <20>ʿ<EFBFBD>
|
||
if((m_HouseContainer[i]->m_pHouseObject->m_bConvertNight == true) &&
|
||
(m_HouseContainer[i]->m_pHouseObject->m_bNightUv == true))
|
||
{
|
||
m_HouseContainer[i]->m_pHouseObject->m_bNightUv = false;
|
||
m_HouseContainer[i]->m_pHouseObject->m_bConvertNight = false;
|
||
|
||
}
|
||
|
||
CSceneManager::m_MeshObjectContainer.DeleteMeshObject(m_HouseContainer[i]->m_strOutName);
|
||
m_HouseContainer[i]->m_pHouseObject->m_pOutHouseObject=NULL;
|
||
|
||
if(m_HouseContainer[i]->m_pHouseObject->m_isHaveLightmap)
|
||
{
|
||
m_HouseContainer[i]->m_pHouseObject->m_Lightmap.Unload();
|
||
}
|
||
}
|
||
return;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
void CHouseObjectContainer::DeleteMed(char *strOut, char *strMed, char *strIn)
|
||
{
|
||
strOut=strlwr(strOut);
|
||
strMed=strlwr(strMed);
|
||
strIn=strlwr(strIn);
|
||
for(int i=0;i<m_HouseContainer.num;i++)
|
||
{
|
||
if( strcmp(m_HouseContainer[i]->m_strInName,strIn)==0 &&
|
||
strcmp(m_HouseContainer[i]->m_strMedName,strMed)==0 &&
|
||
strcmp(m_HouseContainer[i]->m_strOutName,strOut)==0)
|
||
{
|
||
if(--m_HouseContainer[i]->m_nMedHouseUsed==0)
|
||
{
|
||
/*
|
||
if(strcmp(m_HouseContainer[i]->m_strMedName,"hstone05.R3S")==0)
|
||
{
|
||
char debug[256];
|
||
sprintf(debug,"File=%s,Line=%s",__FILE__,__LINE__);
|
||
MessageBox(NULL,debug,0,0);
|
||
}
|
||
*/
|
||
CSceneManager::m_MeshObjectContainer.DeleteMeshObject(m_HouseContainer[i]->m_strMedName);
|
||
m_HouseContainer[i]->m_pHouseObject->m_pMedHouseObject=NULL;
|
||
}
|
||
return;
|
||
}
|
||
}
|
||
}
|
||
|
||
void CHouseObjectContainer::DeleteIn(char *strOut, char *strMed, char *strIn)
|
||
{
|
||
strOut=strlwr(strOut);
|
||
strMed=strlwr(strMed);
|
||
strIn=strlwr(strIn);
|
||
for(int i=0;i<m_HouseContainer.num;i++)
|
||
{
|
||
if( strcmp(m_HouseContainer[i]->m_strInName,strIn)==0 &&
|
||
strcmp(m_HouseContainer[i]->m_strMedName,strMed)==0 &&
|
||
strcmp(m_HouseContainer[i]->m_strOutName,strOut)==0)
|
||
{
|
||
if(--m_HouseContainer[i]->m_nInHouseUsed==0)
|
||
{
|
||
/*
|
||
if(strcmp(m_HouseContainer[i]->m_strInName,"hstone05.R3S")==0)
|
||
{
|
||
char debug[256];
|
||
sprintf(debug,"File=%s,Line=%s",__FILE__,__LINE__);
|
||
MessageBox(NULL,debug,0,0);
|
||
}
|
||
*/
|
||
CSceneManager::m_MeshObjectContainer.DeleteMeshObject(m_HouseContainer[i]->m_strInName);
|
||
/*
|
||
char strOctree[MAX_NAMEBUFFER];
|
||
sprintf(strOctree,"%s",strOut);
|
||
strOctree[strlen(strOctree)-1]='T';
|
||
strOctree[strlen(strOctree)-2]='C';
|
||
strOctree[strlen(strOctree)-3]='O';
|
||
CSceneManager::m_OctreeContainer.DeleteOctree(strOctree);
|
||
m_HouseContainer[i]->m_pHouseObject->m_pOctree=NULL;
|
||
*/
|
||
//pHouseObject->m_pOctree=CSceneManager::m_OctreeContainer.GetOctree(strOctree);
|
||
/*
|
||
for(int cLight=0;cLight<m_HouseContainer[i]->m_pHouseObject->m_LightList.num;cLight++)
|
||
{
|
||
CSceneManager::m_LightObjectContainer.DeleteLightObject(m_HouseContainer[i]->m_pHouseObject->m_LightList[cLight]->m_pLightObject->m_strLightObjectName,
|
||
m_HouseContainer[i]->m_pHouseObject->m_LightList[cLight]->m_pLightObject->m_fLightRange,
|
||
m_HouseContainer[i]->m_pHouseObject->m_LightList[cLight]->m_pLightObject->m_LightColor);
|
||
delete m_HouseContainer[i]->m_pHouseObject->m_LightList[cLight];
|
||
}
|
||
m_HouseContainer[i]->m_pHouseObject->m_LightList.num=0;
|
||
|
||
for(int cObject=0;cObject<m_HouseContainer[i]->m_pHouseObject->m_ObjectList.num;cObject++)
|
||
{
|
||
CSceneManager::m_ObjectContainer.DeleteObject(m_HouseContainer[i]->m_pHouseObject->m_ObjectList[cObject]->m_strObjectName,
|
||
m_HouseContainer[i]->m_pHouseObject->m_ObjectList[cObject]->m_isAlpha,
|
||
m_HouseContainer[i]->m_pHouseObject->m_ObjectList[cObject]->m_isLight);
|
||
|
||
delete m_HouseContainer[i]->m_pHouseObject->m_ObjectList[cObject];
|
||
}
|
||
m_HouseContainer[i]->m_pHouseObject->m_ObjectList.num=0;
|
||
*/
|
||
|
||
}
|
||
return;
|
||
}
|
||
}
|
||
}
|
||
|
||
int CHouseObjectContainer::GetCount(char *strOut, char *strMed, char *strIn)
|
||
{
|
||
for(int i=0;i<m_HouseContainer.num;i++)
|
||
{
|
||
if( strcmp(m_HouseContainer[i]->m_strInName,strIn)==0 &&
|
||
strcmp(m_HouseContainer[i]->m_strMedName,strMed)==0 &&
|
||
strcmp(m_HouseContainer[i]->m_strOutName,strOut)==0)
|
||
{
|
||
return m_HouseContainer[i]->m_nUsed;
|
||
}
|
||
}
|
||
return 0;
|
||
}
|
||
|
||
|
||
|
||
void CHouseObjectContainer::DeleteInObject(char *strOut, char *strMed, char *strIn)
|
||
{
|
||
strOut=strlwr(strOut);
|
||
strMed=strlwr(strMed);
|
||
strIn=strlwr(strIn);
|
||
for(int i=0;i<m_HouseContainer.num;i++)
|
||
{
|
||
if( strcmp(m_HouseContainer[i]->m_strInName,strIn)==0 &&
|
||
strcmp(m_HouseContainer[i]->m_strMedName,strMed)==0 &&
|
||
strcmp(m_HouseContainer[i]->m_strOutName,strOut)==0)
|
||
{
|
||
for(int cLight=0;cLight<m_HouseContainer[i]->m_pHouseObject->m_LightList.num;cLight++)
|
||
{
|
||
CSceneManager::m_LightObjectContainer.DeleteLightObject(m_HouseContainer[i]->m_pHouseObject->m_LightList[cLight]->m_pLightObject->m_strLightObjectName,
|
||
m_HouseContainer[i]->m_pHouseObject->m_LightList[cLight]->m_pLightObject->m_fLightRange,
|
||
m_HouseContainer[i]->m_pHouseObject->m_LightList[cLight]->m_pLightObject->m_LightColor);
|
||
delete m_HouseContainer[i]->m_pHouseObject->m_LightList[cLight];
|
||
}
|
||
m_HouseContainer[i]->m_pHouseObject->m_LightList.num=0;
|
||
|
||
for(int cObject=0;cObject<m_HouseContainer[i]->m_pHouseObject->m_ObjectList.num;cObject++)
|
||
{
|
||
/*
|
||
if(strcmp(m_HouseContainer[i]->m_pHouseObject->m_ObjectList[cObject]->m_strObjectName,"shield_002.R3S")==0)
|
||
{
|
||
int a=0;
|
||
}
|
||
*/
|
||
/*
|
||
CSceneManager::m_ObjectContainer.DeleteObject(m_HouseContainer[i]->m_pHouseObject->m_ObjectList[cObject]->m_strObjectName,
|
||
m_HouseContainer[i]->m_pHouseObject->m_ObjectList[cObject]->m_isAlpha,
|
||
m_HouseContainer[i]->m_pHouseObject->m_ObjectList[cObject]->m_isLight);
|
||
*/
|
||
|
||
delete m_HouseContainer[i]->m_pHouseObject->m_ObjectList[cObject];
|
||
}
|
||
m_HouseContainer[i]->m_pHouseObject->m_ObjectList.num=0;
|
||
return;
|
||
}
|
||
}
|
||
}
|