- Added support for Eternity Engine's function pointer ACS instructions. (Note that an alternative ACS compiler is necessary to use these instructions properly.)

SVN r3731 (trunk)
This commit is contained in:
Braden Obrzut 2012-07-03 01:24:52 +00:00
parent e800522e26
commit 439b60ae68
2 changed files with 25 additions and 3 deletions

View File

@ -4243,17 +4243,37 @@ int DLevelScript::RunScript ()
} }
break; break;
case PCD_PUSHFUNCTION:
{
int funcnum = NEXTBYTE;
PushToStack(funcnum | activeBehavior->GetLibraryID());
break;
}
case PCD_CALL: case PCD_CALL:
case PCD_CALLDISCARD: case PCD_CALLDISCARD:
case PCD_CALLSTACK:
{ {
int funcnum; int funcnum;
int i; int i;
ScriptFunction *func; ScriptFunction *func;
FBehavior *module = activeBehavior; FBehavior *module;
SDWORD *mylocals; SDWORD *mylocals;
funcnum = NEXTBYTE; if(pcd == PCD_CALLSTACK)
{
funcnum = STACK(1);
module = FBehavior::StaticGetModule(funcnum>>16);
--sp;
funcnum &= 0xFFFF; // Clear out tag
}
else
{
module = activeBehavior;
funcnum = NEXTBYTE;
}
func = activeBehavior->GetFunction (funcnum, module); func = activeBehavior->GetFunction (funcnum, module);
if (func == NULL) if (func == NULL)
{ {
Printf ("Function %d in %s out of range\n", funcnum, ScriptPresentation(script).GetChars()); Printf ("Function %d in %s out of range\n", funcnum, ScriptPresentation(script).GetChars());

View File

@ -598,8 +598,10 @@ public:
PCD_STRCPYTOMAPCHRANGE, // [FDARI] input range (copy string to all/part of array) PCD_STRCPYTOMAPCHRANGE, // [FDARI] input range (copy string to all/part of array)
PCD_STRCPYTOWORLDCHRANGE, PCD_STRCPYTOWORLDCHRANGE,
PCD_STRCPYTOGLOBALCHRANGE, PCD_STRCPYTOGLOBALCHRANGE,
PCD_PUSHFUNCTION,
/*360*/ PCD_CALLSTACK,
/*359*/ PCODE_COMMAND_COUNT /*361*/ PCODE_COMMAND_COUNT
}; };
// Some constants used by ACS scripts // Some constants used by ACS scripts