From 43031375f4b7b8a383547f85aaa9456bf15d6f2e Mon Sep 17 00:00:00 2001 From: Boondorl Date: Wed, 19 Mar 2025 13:57:26 -0400 Subject: [PATCH] Added missing return values in VM calls These are not supported by the JIT and must always be passed. --- src/common/cutscenes/screenjob.cpp | 4 +++- src/g_statusbar/sbarinfo_commands.cpp | 8 ++++---- src/intermission/intermission.cpp | 4 +++- src/p_conversation.cpp | 4 +++- src/playsim/fragglescript/t_func.cpp | 4 +++- src/playsim/p_interaction.cpp | 5 ++++- src/playsim/p_map.cpp | 2 +- src/playsim/p_teleport.cpp | 2 +- 8 files changed, 22 insertions(+), 11 deletions(-) diff --git a/src/common/cutscenes/screenjob.cpp b/src/common/cutscenes/screenjob.cpp index fa3752ba70..6220291ea5 100644 --- a/src/common/cutscenes/screenjob.cpp +++ b/src/common/cutscenes/screenjob.cpp @@ -270,8 +270,10 @@ void ScreenJobDraw() ScaleOverrider ovr(twod); IFVIRTUALPTRNAME(cutscene.runner, NAME_ScreenJobRunner, RunFrame) { + int ret = 0; VMValue parm[] = { cutscene.runner, smoothratio }; - VMCall(func, parm, 2, nullptr, 0); + VMReturn rets[] = { &ret }; + VMCall(func, parm, 2, rets, 1); } } } diff --git a/src/g_statusbar/sbarinfo_commands.cpp b/src/g_statusbar/sbarinfo_commands.cpp index a28d43e191..e927b1616f 100644 --- a/src/g_statusbar/sbarinfo_commands.cpp +++ b/src/g_statusbar/sbarinfo_commands.cpp @@ -1441,10 +1441,10 @@ class CommandDrawNumber : public CommandDrawString static VMFunction *func = nullptr; if (func == nullptr) PClass::FindFunction(&func, NAME_PlayerPawn, "GetEffectTicsForItem"); VMValue params[] = { statusBar->CPlayer->mo, inventoryItem }; - int retv; - VMReturn ret(&retv); - VMCall(func, params, 2, &ret, 1); - num = retv < 0? 0 : retv / TICRATE + 1; + int ret1 = 0, ret2 = 0; + VMReturn rets[] = { &ret1, &ret2 }; + VMCall(func, params, 2, rets, 2); + num = ret1 < 0? 0 : ret1 / TICRATE + 1; break; } case INVENTORY: diff --git a/src/intermission/intermission.cpp b/src/intermission/intermission.cpp index 24915f9f7a..0ae8e41da6 100644 --- a/src/intermission/intermission.cpp +++ b/src/intermission/intermission.cpp @@ -325,8 +325,10 @@ void DIntermissionScreenCutscene::Drawer () ScaleOverrider ovr(twod); IFVIRTUALPTRNAME(mScreenJobRunner, NAME_ScreenJobRunner, RunFrame) { + int res = 0; VMValue parm[] = { mScreenJobRunner, I_GetTimeFrac() }; - VMCall(func, parm, 2, nullptr, 0); + VMReturn ret[] = { &res }; + VMCall(func, parm, 2, ret, 1); } } diff --git a/src/p_conversation.cpp b/src/p_conversation.cpp index f51d498f2f..417b0e49f8 100644 --- a/src/p_conversation.cpp +++ b/src/p_conversation.cpp @@ -218,8 +218,10 @@ static void TakeStrifeItem (player_t *player, PClassActor *itemtype, int amount) IFVM(Actor, TakeInventory) { + int taken = false; VMValue params[] = { player->mo, itemtype, amount, false, false }; - VMCall(func, params, 5, nullptr, 0); + VMReturn rets[] = { &taken }; + VMCall(func, params, 5, rets, 1); } } diff --git a/src/playsim/fragglescript/t_func.cpp b/src/playsim/fragglescript/t_func.cpp index f9fff1b9ef..fe7699c35d 100644 --- a/src/playsim/fragglescript/t_func.cpp +++ b/src/playsim/fragglescript/t_func.cpp @@ -2532,8 +2532,10 @@ void FParser::SF_PlayerWeapon() IFVM(PlayerPawn, PickNewWeapon) { + AActor* weap = nullptr; VMValue param[] = { Level->Players[playernum]->mo, (void*)nullptr }; - VMCall(func, param, 2, nullptr, 0); + VMReturn rets[] = { (void**)&weap }; + VMCall(func, param, 2, rets, 1); } } } diff --git a/src/playsim/p_interaction.cpp b/src/playsim/p_interaction.cpp index 8d3e5022b2..5202041f3c 100644 --- a/src/playsim/p_interaction.cpp +++ b/src/playsim/p_interaction.cpp @@ -345,7 +345,10 @@ void AActor::Die (AActor *source, AActor *inflictor, int dmgflags, FName MeansOf } } - VMCall(func, params, 1, nullptr, 0); + AActor* unused = nullptr; + int unused2 = 0, unused3 = 0; + VMReturn ret[] = { (void**)&unused, &unused2, &unused3 }; + VMCall(func, params, 1, ret, 3); // Kill the dummy Actor if it didn't unmorph, otherwise checking the morph flags. Player pawns need // to stay, otherwise they won't respawn correctly. diff --git a/src/playsim/p_map.cpp b/src/playsim/p_map.cpp index 949514f2a7..5b427e0f7e 100644 --- a/src/playsim/p_map.cpp +++ b/src/playsim/p_map.cpp @@ -215,7 +215,7 @@ bool P_CanCrossLine(AActor *mo, line_t *line, DVector3 next) assert(VIndex != ~0u); } - VMValue params[] = { mo, line, next.X, next.Y, next.Z, false }; + VMValue params[] = { mo, line, next.X, next.Y, next.Z }; VMReturn ret; int retval; ret.IntAt(&retval); diff --git a/src/playsim/p_teleport.cpp b/src/playsim/p_teleport.cpp index a198f2b272..f26bb6fcbd 100644 --- a/src/playsim/p_teleport.cpp +++ b/src/playsim/p_teleport.cpp @@ -249,7 +249,7 @@ bool P_Teleport (AActor *thing, DVector3 pos, DAngle angle, int flags) IFVIRTUALPTR(thing, AActor, PostTeleport) { VMValue params[] = { thing, pos.X, pos.Y, pos.Z, angle.Degrees(), flags }; - VMCall(func, params, countof(params), nullptr, 1); + VMCall(func, params, countof(params), nullptr, 0); } } return true;