* Load a script in an engine without removing the previously loaded script. * * @param script The script engine to run. * @param typeID The typeID for which we want to load a script. */
| 571 | * @param typeID The typeID for which we want to load a script. |
| 572 | */ |
| 573 | void Script_LoadAsSubroutine(ScriptEngine *script, uint8 typeID) |
| 574 | { |
| 575 | ScriptInfo *scriptInfo; |
| 576 | |
| 577 | if (!Script_IsLoaded(script)) return; |
| 578 | if (script->isSubroutine != 0) return; |
| 579 | |
| 580 | scriptInfo = script->scriptInfo; |
| 581 | script->isSubroutine = 1; |
| 582 | |
| 583 | STACK_PUSH((uint16)(script->script - scriptInfo->start)); |
| 584 | STACK_PUSH(script->returnValue); |
| 585 | |
| 586 | script->script = scriptInfo->start + scriptInfo->offsets[typeID]; |
| 587 | } |
| 588 | |
| 589 | /** |
| 590 | * Clears the given scriptInfo. |
no test coverage detected