mirror of
https://github.com/dashr9230/SA-MP.git
synced 2024-12-22 14:37:29 +08:00
[server] Implement CGameMode::Frame(...)
* Update `CNetGame::Process()`
This commit is contained in:
parent
52ee926fdd
commit
2df59766ac
@ -133,6 +133,35 @@ void CGameMode::Unload()
|
||||
|
||||
//----------------------------------------------------------------------------------
|
||||
|
||||
void CGameMode::Frame(float fElapsedTime)
|
||||
{
|
||||
if (!m_bInitialised)
|
||||
return;
|
||||
|
||||
if (!m_bSleeping)
|
||||
return;
|
||||
|
||||
if (m_fSleepTime > 0.0f)
|
||||
{
|
||||
m_fSleepTime -= fElapsedTime;
|
||||
}
|
||||
else
|
||||
{
|
||||
cell ret;
|
||||
int err = amx_Exec(&m_amx, &ret, AMX_EXEC_CONT);
|
||||
if (err == AMX_ERR_SLEEP)
|
||||
{
|
||||
m_bSleeping = true;
|
||||
m_fSleepTime = ((float)ret / 1000.0f);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_bSleeping = false;
|
||||
AMXPrintError(this, &m_amx, err);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------
|
||||
|
||||
int CGameMode::CallPublic(char* szFuncName)
|
||||
|
@ -22,6 +22,7 @@ public:
|
||||
|
||||
bool Load(char* pFileName);
|
||||
void Unload();
|
||||
void Frame(float fElapsedTime);
|
||||
|
||||
int CallPublic(char* szFuncName);
|
||||
|
||||
|
@ -592,11 +592,18 @@ void CNetGame::Process()
|
||||
{
|
||||
float fElapsedTime = GetElapsedTime();
|
||||
|
||||
if(m_iGameState == GAMESTATE_RUNNING)
|
||||
{
|
||||
if(m_pGameMode) m_pGameMode->Frame(fElapsedTime);
|
||||
}
|
||||
else if(m_iGameState == GAMESTATE_RESTARTING)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// TODO: CNetGame::Process W: 00491240 L: 080AEEE0
|
||||
|
||||
/*
|
||||
v4 = sub_80AA3D0();
|
||||
sub_80ABF00(this);
|
||||
sub_80AECE0((int)this);
|
||||
v1 = this->field_5E;
|
||||
|
Loading…
Reference in New Issue
Block a user