MCPcopy Create free account
hub / github.com/dhewm/dhewm3 / Execute

Method Execute

neo/game/script/Script_Interpreter.cpp:992–1902  ·  view source on GitHub ↗

==================== idInterpreter::Execute ==================== */

Source from the content-addressed store, hash-verified

990====================
991*/
992bool idInterpreter::Execute( void ) {
993 varEval_t var_a;
994 varEval_t var_b;
995 varEval_t var_c;
996 varEval_t var;
997 statement_t *st;
998 int runaway;
999 idThread *newThread;
1000 float floatVal;
1001 idScriptObject *obj;
1002 const function_t *func;
1003
1004 if ( threadDying || !currentFunction ) {
1005 return true;
1006 }
1007
1008 if ( multiFrameEvent ) {
1009 // move to previous instruction and call it again
1010 instructionPointer--;
1011 }
1012
1013 runaway = 5000000;
1014
1015 doneProcessing = false;
1016 while( !doneProcessing && !threadDying ) {
1017 instructionPointer++;
1018
1019 if ( !--runaway ) {
1020 Error( "runaway loop error" );
1021 }
1022
1023 // next statement
1024 st = &gameLocal.program.GetStatement( instructionPointer );
1025
1026 if ( !updateGameDebugger( this, &gameLocal.program, instructionPointer )
1027 && g_debugScript.GetBool( ) )
1028 {
1029 static int lastLineNumber = -1;
1030 if ( lastLineNumber != gameLocal.program.GetStatement ( instructionPointer ).linenumber ) {
1031 gameLocal.Printf ( "%s (%d)\n",
1032 gameLocal.program.GetFilename ( gameLocal.program.GetStatement ( instructionPointer ).file ),
1033 gameLocal.program.GetStatement ( instructionPointer ).linenumber
1034 );
1035 lastLineNumber = gameLocal.program.GetStatement ( instructionPointer ).linenumber;
1036 }
1037 }
1038
1039 switch( st->op ) {
1040 case OP_RETURN:
1041 LeaveFunction( st->a );
1042 break;
1043
1044 case OP_THREAD:
1045 newThread = new idThread( this, st->a->value.functionPtr, st->b->value.argSize );
1046 newThread->Start();
1047
1048 // return the thread number to the script
1049 gameLocal.program.ReturnFloat( newThread->GetThreadNum() );

Callers

nothing calls this directly

Calls 15

GetStringFunction · 0.85
WarningFunction · 0.85
ErrorFunction · 0.50
updateGameDebuggerFunction · 0.50
GetBoolMethod · 0.45
PrintfMethod · 0.45
GetFilenameMethod · 0.45
StartMethod · 0.45
ReturnFloatMethod · 0.45
GetThreadNumMethod · 0.45
GetFunctionMethod · 0.45
GetTypeDefMethod · 0.45

Tested by

no test coverage detected