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
|
||||
//
|
||||
Event EV_SetTiki(
|
||||
Event EV_SetTiki
|
||||
(
|
||||
"settiki",
|
||||
EV_DEFAULT,
|
||||
NULL,
|
||||
|
@ -698,22 +699,47 @@ void ScriptMaster::ExecuteRunning(void)
|
|||
{
|
||||
int i;
|
||||
int startTime;
|
||||
int startMs;
|
||||
str fileName;
|
||||
str sourcePosString;
|
||||
|
||||
if (stackCount) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (timerList.IsDirty()) {
|
||||
if (!timerList.IsDirty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
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());
|
||||
|
@ -721,9 +747,6 @@ void ScriptMaster::ExecuteRunning(void)
|
|||
|
||||
level.setTime(startTime);
|
||||
level.m_LoopProtection = true;
|
||||
}
|
||||
|
||||
startTime = gi.Milliseconds();
|
||||
}
|
||||
|
||||
void ScriptMaster::SetTime(int time)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue