📄 gameresourcemanager.cpp
字号:
{
if(idx >= m_MaxNpcChxList) break;
m_NpcChxList[idx].FileName = file.GetString();
++idx;
}
file.Release();
return TRUE;
}
char* CGameResourceManager::GetNpcChxName(DWORD index)
{
ASSERT(index > 0 && index < m_MaxNpcChxList);
return m_NpcChxList[index].FileName;
}
BOOL CGameResourceManager::LoadGameDesc()
{
char filename[64];
char value[64] = {0,};
CMHFile file;
#ifdef _FILE_BIN_
sprintf(filename,"INI/GameDesc.bin");
if(!file.Init(filename, "rb"))
return FALSE;
#else
sprintf(filename,"INI/GameDesc.ini");
if(!file.Init(filename, "rt"))
return FALSE;
#endif
while(1)
{
if(file.IsEOF())
break;
strcpy(value,strupr(file.GetString()));
if(strcmp(value,"*DISPWIDTH") == 0)
{
m_GameDesc.dispInfo.dwWidth = file.GetDword();
}
else if(strcmp(value,"*DISPHEIGHT") == 0)
{
m_GameDesc.dispInfo.dwHeight = file.GetDword();
}
else if(strcmp(value,"*BPS") == 0)
{
m_GameDesc.dispInfo.dwBPS = file.GetDword();
}
else if(strcmp(value,"*WINDOWMODE") == 0)
{
if( file.GetBool() )
m_GameDesc.dispInfo.dispType = WINDOW_WITH_BLT;
else
m_GameDesc.dispInfo.dispType = /*FULLSCREEN_WITH_FLIP;//*/FULLSCREEN_WITH_BLT; //FLIP篮 Alt_Tab捞 救等促.
// m_GameDesc.dispInfo.bWindowed = file.GetBool();
}
else if(strcmp(value,"*SHADOW") == 0)
{
m_GameDesc.bShadow = file.GetByte();
}
else if(strcmp(value,"*MAXSHADOWLIGHT") == 0)
{
m_GameDesc.MaxShadowNum = file.GetDword();
}
else if(strcmp(value,"*SHADOWDETAIL") == 0)
{
m_GameDesc.MaxShadowTexDetail = file.GetDword();
}
else if(strcmp(value,"*DISTRIBUTESERVERIP") == 0)
{
file.GetString(m_GameDesc.DistributeServerIP);
}
else if(strcmp(value,"*DISTRIBUTESERVERPORT") == 0)
{
m_GameDesc.DistributeServerPort = file.GetWord();
}
else if(strcmp(value,"*AGENTSERVERPORT") == 0)
{
m_GameDesc.AgentServerPort = file.GetWord();
}
else if(strcmp(value,"*MOVEPOINT") == 0)
{
file.GetString(m_GameDesc.MovePoint);
}
else if(strcmp(value,"*FPS") == 0)
{
m_GameDesc.FramePerSec = file.GetDword();
m_GameDesc.TickPerFrame = 1000/(float)m_GameDesc.FramePerSec;
}
else if(strcmp(value,"*CAMERAANGLEX") == 0)
{
m_GameDesc.CameraMinAngleX = file.GetFloat();
m_GameDesc.CameraMaxAngleX = file.GetFloat();
}
else if(strcmp(value,"*CAMERADISTANCE") == 0)
{
m_GameDesc.CameraMinDistance = file.GetFloat();
m_GameDesc.CameraMaxDistance = file.GetFloat();
}
else if(strcmp(value,"*GRAVITY") == 0)
{
gAntiGravity = 1/file.GetFloat();
}
// Volume
else if(strcmp(value,"*MASTERVOLUME") == 0)
{
m_GameDesc.MasterVolume = file.GetFloat();
}
else if(strcmp(value,"*SOUNDVOLUME") == 0)
{
m_GameDesc.SoundVolume = file.GetFloat();
}
else if(strcmp(value,"*BGMVOLUME") == 0)
{
m_GameDesc.BGMVolume = file.GetFloat();
}
//limit
else if(strcmp(value,"*LIMITDAY") == 0)
{
m_GameDesc.LimitDay = file.GetDword();
}
else if(strcmp(value,"*LIMITID") == 0)
{
file.GetString(m_GameDesc.LimitID);
}
else if(strcmp(value,"*LIMITPWD") == 0)
{
file.GetString(m_GameDesc.LimitPWD);
}
}
file.Release();
gTickPerFrame = m_GameDesc.TickPerFrame;
AUDIOMGR->SetMasterVolume(m_GameDesc.MasterVolume);
AUDIOMGR->SetSoundVolume(m_GameDesc.SoundVolume);
AUDIOMGR->SetBGMVolume(m_GameDesc.BGMVolume);
return TRUE;
}
BOOL CGameResourceManager::LoadServerList()
{
m_nMaxServerList = 0;
char filename[64];
char value[64] = {0,};
int index = 0;
CMHFile file;
#ifdef _FILE_BIN_
sprintf( filename, "INI/ServerList.bin" );
if( !file.Init( filename, "rb" ) )
return FALSE;
#else
sprintf( filename, "INI/ServerList.ini" );
if( !file.Init( filename, "rt" ) )
return FALSE;
#endif
while( 1 )
{
if( file.IsEOF() )
break;
strcpy( value, strupr(file.GetString()) );
if( strcmp( value,"*USERSERVER" ) == 0 )
{
++index;
if( index > 0 )
{
file.GetString( m_ServerList[index-1].DistributeIP );
m_ServerList[index-1].DistributePort = file.GetWord();
file.GetStringInQuotation( m_ServerList[index-1].ServerName );
m_ServerList[index-1].ServerNo = file.GetWord();
++m_nMaxServerList;
}
}
else if( strcmp( value,"*TESTSERVER" ) == 0 && g_bTESTSERVER)
{
++index;
if( index > 0 )
{
file.GetString( m_ServerList[index-1].DistributeIP );
m_ServerList[index-1].DistributePort = file.GetWord();
file.GetStringInQuotation( m_ServerList[index-1].ServerName );
m_ServerList[index-1].ServerNo = file.GetWord();
++m_nMaxServerList;
}
}
}
file.Release();
return TRUE;
}
#include "ItemManager.h" // for LoadPreDataTable()
void CGameResourceManager::LoadPreDataTable()
{
CMHFile file;
#ifdef _FILE_BIN_
if(!file.Init("./Resource/PreLoadData.bin", "rb"))
return;
#else
if(!file.Init("./Resource/PreLoadData.txt", "rt"))
return;
#endif
char Token[64];
while( !file.IsEOF() )
{
file.GetString(Token);
if(strcmp(Token, "#EFFECT") == 0)
{
PRELOADEFF* pEff = NULL;
pEff = new PRELOADEFF;
char buf[128];
file.GetString(buf);
pEff->FileName = buf;
m_PreLoadEfflist.AddTail(pEff);
}
else if(strcmp(Token, "#MAPNUM") == 0)
{
sPRELOAD_INFO* pPreLoadInfo = new sPRELOAD_INFO;
pPreLoadInfo->MapNum = file.GetInt();
// 秦寸甘狼 阁胶磐 沥焊 肺爹
LoadPreMonsterData(pPreLoadInfo, pPreLoadInfo->MapNum);
int Count = file.GetInt();
int* Level = NULL;
ITEM_INFO* pItemInfo = NULL;
/*
for(int i=0; i<Count; i++)
{
Level = file.GetInt();
// 秦寸 饭骇 酒捞袍 肺爹
ITEMMGR->SetPreItemData(pPreLoadInfo, Level);
}
*/
// Item辆幅啊 况倡 腹酒辑.. 瞒扼府 捞霸 炒瘤..
Level = new int[Count];
for(int i=0; i<Count; i++)
Level[i] = file.GetInt();
ITEMMGR->SetPreItemData(pPreLoadInfo, Level, Count);
delete Level;
m_PreLoadDataTable.Add(pPreLoadInfo, pPreLoadInfo->MapNum);
}
}
}
void CGameResourceManager::LoadPreMonsterData(sPRELOAD_INFO* pPreLoadInfo, MAPTYPE MapNum)
{
CMHFile file;
char filename[256];
#ifdef _FILE_BIN_
sprintf(filename,"Resource/Monster_%02d.bin",MapNum);
if(!file.Init(filename,"rb"))
return ;
#else
sprintf(filename,"Resource/Monster_%02d.txt",MapNum);
if(!file.Init(filename,"rt"))
return ;
#endif
char buff[256];
while(1)
{
if(file.IsEOF())
{
break;
}
file.GetString(buff);
strcpy(buff, _strupr(buff));
CMD_ST(buff)
CMD_CS("#ADD")
file.GetByte();
file.GetDword();
int kind = file.GetDword();
if(kind)
{
// 鞍篮霸 乐绰瘤 茫绊
for(int i=0; i<pPreLoadInfo->Count[ePreLoad_Monster]; i++)
if(kind == pPreLoadInfo->Kind[ePreLoad_Monster][i]) break;
// 绝栏搁 货肺款 阁胶磐 眠啊
if(i == pPreLoadInfo->Count[ePreLoad_Monster])
{
pPreLoadInfo->Kind[ePreLoad_Monster][i] = kind;
++pPreLoadInfo->Count[ePreLoad_Monster];
//
if(pPreLoadInfo->Count[ePreLoad_Monster] >= MAX_KIND_PERMAP)
break;
}
}
CMD_EN
}
}
#ifdef _TESTCLIENT_
BOOL CGameResourceManager::LoadTestClientInfo()
{
char filename[64];
char value[64] = {0,};
sprintf(filename,"../DeveloperWorking/TestClient.ini");
CMHFile file;
if(!file.Init(filename, "rt"))
return FALSE;
while(1)
{
if(file.IsEOF())
break;
strcpy(value,strupr(file.GetString()));
if(strcmp(value,"*STARTPOSITION") == 0)
{
m_TestClientInfo.x = file.GetFloat();
m_TestClientInfo.z = file.GetFloat();
}
if(strcmp(value,"*BOSSMONSTERKIND") == 0)
{
m_TestClientInfo.BossMonsterKind = file.GetWord();
}
if(strcmp(value,"*BOSSMONSTERNUM") == 0)
{
m_TestClientInfo.BossMonsterNum = file.GetWord();
}
else if(strcmp(value,"*EFFECT") == 0)
{
m_TestClientInfo.Effect = FindEffectNum(file.GetString());
}
else if(strcmp(value,"*MUGONG") == 0)
{
m_TestClientInfo.MugongIdx = file.GetWord();
}
else if(strcmp(value,"*WEAPON") == 0)
{
m_TestClientInfo.WeaponIdx = file.GetWord();
}
else if(strcmp(value,"*SHOES") == 0)
{
m_TestClientInfo.ShoesIdx = file.GetWord();
}
else if(strcmp(value,"*HAT") == 0)
{
m_TestClientInfo.HatIdx = file.GetWord();
}
else if(strcmp(value,"*DRESS") == 0)
{
m_TestClientInfo.DressIdx = file.GetWord();
}
else if(strcmp(value,"*GENDER") == 0)
{
m_TestClientInfo.Gender = file.GetByte();
}
else if(strcmp(value,"*MONSTERNUM") == 0)
{
m_TestClientInfo.MonsterNum = file.GetWord();
}
else if(strcmp(value,"*MONSTEREFFECT") == 0)
{
m_TestClientInfo.MonsterEffect = FindEffectNum(file.GetString());
}
else if(strcmp(value,"*MONSTERKIND") == 0)
{
m_TestClientInfo.MonsterKind = file.GetWord();
}
else if(strcmp(value,"*MAP") == 0)
{
m_TestClientInfo.Map = file.GetByte();
}
else if(strcmp(value,"*CHARACTERNUM") == 0)
{
m_TestClientInfo.CharacterNum = file.GetWord();
}
else if(strcmp(value,"*HAIR") == 0)
{
m_TestClientInfo.HairType = file.GetByte();
}
else if(strcmp(value,"*FACE") == 0)
{
m_TestClientInfo.FaceType = file.GetByte();
}
else if(strcmp(value,"*LIGHTEFFECT") == 0)
{
m_TestClientInfo.LightEffect = file.GetBool();
}
}
file.Release();
return TRUE;
}
#endif
//-----------------------------------------------------------------------------------------------------------//
#endif //_CLIENT_RESOURCE_FIELD_
//-----------------------------------------------------------------------------------------------------------//
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -