mirror of
https://github.com/openmoh/openmohaa.git
synced 2025-05-09 20:18:17 +03:00
Added timescript in ScriptMaster::ExecuteRunning()
This commit is contained in:
parent
481cd760a9
commit
24297bf396
1 changed files with 43 additions and 20 deletions
|
@ -82,7 +82,8 @@ CLASS_DECLARATION(Class, ScriptEvent, NULL) {
|
||||||
//
|
//
|
||||||
// world stuff
|
// world stuff
|
||||||
//
|
//
|
||||||
Event EV_SetTiki(
|
Event EV_SetTiki
|
||||||
|
(
|
||||||
"settiki",
|
"settiki",
|
||||||
EV_DEFAULT,
|
EV_DEFAULT,
|
||||||
NULL,
|
NULL,
|
||||||
|
@ -698,32 +699,54 @@ void ScriptMaster::ExecuteRunning(void)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
int startTime;
|
int startTime;
|
||||||
|
int startMs;
|
||||||
|
str fileName;
|
||||||
|
str sourcePosString;
|
||||||
|
|
||||||
if (stackCount) {
|
if (stackCount) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (timerList.IsDirty()) {
|
if (!timerList.IsDirty()) {
|
||||||
cmdTime = 0;
|
return;
|
||||||
cmdCount = 0;
|
|
||||||
startTime = level.svsTime;
|
|
||||||
|
|
||||||
try {
|
|
||||||
while ((m_CurrentThread = (ScriptThread *)timerList.GetNextElement(i))) {
|
|
||||||
level.setTime(level.svsStartTime + i);
|
|
||||||
|
|
||||||
m_CurrentThread->m_ScriptVM->m_ThreadState = THREAD_RUNNING;
|
|
||||||
m_CurrentThread->m_ScriptVM->Execute();
|
|
||||||
}
|
|
||||||
} catch (const ScriptException& e) {
|
|
||||||
gi.Error(ERR_DROP, "%s", e.string.c_str());
|
|
||||||
}
|
|
||||||
|
|
||||||
level.setTime(startTime);
|
|
||||||
level.m_LoopProtection = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
startTime = gi.Milliseconds();
|
cmdTime = 0;
|
||||||
|
cmdCount = 0;
|
||||||
|
startTime = level.svsTime;
|
||||||
|
|
||||||
|
try {
|
||||||
|
while ((m_CurrentThread = (ScriptThread *)timerList.GetNextElement(i))) {
|
||||||
|
if (g_timescripts->integer) {
|
||||||
|
fileName = m_CurrentThread->FileName();
|
||||||
|
sourcePosString = m_CurrentThread->m_ScriptVM->GetSourcePos();
|
||||||
|
startMs = gi.Milliseconds();
|
||||||
|
}
|
||||||
|
|
||||||
|
level.setTime(level.svsStartTime + i);
|
||||||
|
|
||||||
|
m_CurrentThread->m_ScriptVM->m_ThreadState = THREAD_RUNNING;
|
||||||
|
m_CurrentThread->m_ScriptVM->Execute();
|
||||||
|
|
||||||
|
if (g_timescripts->integer) {
|
||||||
|
str string;
|
||||||
|
|
||||||
|
string = "Execute Running: ";
|
||||||
|
string += str(gi.Milliseconds() - startMs / 1000.f);
|
||||||
|
string += " file: ";
|
||||||
|
string += fileName;
|
||||||
|
string += " codepos: ";
|
||||||
|
string += sourcePosString;
|
||||||
|
|
||||||
|
gi.DebugPrintf("%s\n", string.c_str());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (const ScriptException& e) {
|
||||||
|
gi.Error(ERR_DROP, "%s", e.string.c_str());
|
||||||
|
}
|
||||||
|
|
||||||
|
level.setTime(startTime);
|
||||||
|
level.m_LoopProtection = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScriptMaster::SetTime(int time)
|
void ScriptMaster::SetTime(int time)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue