- implement the VM call's return value

This commit is contained in:
Christoph Oelckers 2023-05-24 19:48:21 +02:00
parent fb79228600
commit 64d012b073
2 changed files with 5 additions and 4 deletions

View file

@ -1106,12 +1106,14 @@ void DSWActor::callStateAction()
int DSWActor::callFunction(VMFunction* func)
{
int ret = 0;
if (func)
{
VMValue param[] = { this };
VMCall(func, param, 1, nullptr, 0);
VMReturn r(&ret);
VMCall(func, param, 1, &r, 1);
}
return 0;
return ret;
}
END_SW_NS

View file

@ -350,8 +350,7 @@ typedef void (*soANIMATORp) (SECTOR_OBJECT*);
DEFINE_ACTION_FUNCTION_NATIVE(DSWActor, func, func) \
{ \
auto self = (DSWActor *)(param[0].a); \
func(self); \
return 0; \
ACTION_RETURN_INT(func(self)); \
}
#define AF(func) &DSWActor_##func##_VMPtr