From 64d012b0731626d704a148a40c6d40b189f7b1ec Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Wed, 24 May 2023 19:48:21 +0200 Subject: [PATCH] - implement the VM call's return value --- source/games/sw/src/actor.cpp | 6 ++++-- source/games/sw/src/game.h | 3 +-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/source/games/sw/src/actor.cpp b/source/games/sw/src/actor.cpp index 4c36dd38c..4917cd0cc 100644 --- a/source/games/sw/src/actor.cpp +++ b/source/games/sw/src/actor.cpp @@ -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 diff --git a/source/games/sw/src/game.h b/source/games/sw/src/game.h index 89eab0cd5..e458549b6 100644 --- a/source/games/sw/src/game.h +++ b/source/games/sw/src/game.h @@ -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