From 6cdcad425a50dbf789287154b5bd83e9d92be8ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ricardo=20Lu=C3=ADs=20Vaz=20Silva?= Date: Tue, 1 Apr 2025 17:10:18 -0300 Subject: [PATCH] convert g_game.cpp VMCalls to use VMCallSingle/VMCallVoid (as an example) --- src/g_game.cpp | 29 ++++++++--------------------- 1 file changed, 8 insertions(+), 21 deletions(-) diff --git a/src/g_game.cpp b/src/g_game.cpp index 30274dd930..6206b4c3d8 100644 --- a/src/g_game.cpp +++ b/src/g_game.cpp @@ -317,9 +317,7 @@ CCMD (slot) // Needs to be redone IFVIRTUALPTRNAME(mo, NAME_PlayerPawn, PickWeapon) { - VMValue param[] = { mo, slot, !(dmflags2 & DF2_DONTCHECKAMMO) }; - VMReturn ret((void**)&SendItemUse); - VMCall(func, param, 3, &ret, 1); + SendItemUse = VMCallSingle(func, mo, slot, (int)!(dmflags2 & DF2_DONTCHECKAMMO)); } } @@ -375,9 +373,7 @@ CCMD (weapnext) // Needs to be redone IFVIRTUALPTRNAME(mo, NAME_PlayerPawn, PickNextWeapon) { - VMValue param[] = { mo }; - VMReturn ret((void**)&SendItemUse); - VMCall(func, param, 1, &ret, 1); + SendItemUse = VMCallSingle(func, mo); } } @@ -402,9 +398,7 @@ CCMD (weapprev) // Needs to be redone IFVIRTUALPTRNAME(mo, NAME_PlayerPawn, PickPrevWeapon) { - VMValue param[] = { mo }; - VMReturn ret((void**)&SendItemUse); - VMCall(func, param, 1, &ret, 1); + SendItemUse = VMCallSingle(func, mo); } } @@ -443,8 +437,7 @@ CCMD (invnext) { IFVM(PlayerPawn, InvNext) { - VMValue param = players[consoleplayer].mo; - VMCall(func, ¶m, 1, nullptr, 0); + VMCallVoid(func, players[consoleplayer].mo); } } } @@ -455,8 +448,7 @@ CCMD(invprev) { IFVM(PlayerPawn, InvPrev) { - VMValue param = players[consoleplayer].mo; - VMCall(func, ¶m, 1, nullptr, 0); + VMCallVoid(func, players[consoleplayer].mo); } } } @@ -531,10 +523,7 @@ CCMD (useflechette) if (players[consoleplayer].mo == nullptr) return; IFVIRTUALPTRNAME(players[consoleplayer].mo, NAME_PlayerPawn, GetFlechetteItem) { - VMValue params[] = { players[consoleplayer].mo }; - AActor *cls; - VMReturn ret((void**)&cls); - VMCall(func, params, 1, &ret, 1); + AActor * cls = VMCallSingle(func, players[consoleplayer].mo); if (cls != nullptr) SendItemUse = cls; } @@ -1300,8 +1289,7 @@ void G_PlayerFinishLevel (int player, EFinishLevelType mode, int flags) { IFVM(PlayerPawn, PlayerFinishLevel) { - VMValue params[] = { players[player].mo, mode, flags }; - VMCall(func, params, 3, nullptr, 0); + VMCallVoid(func, players[player].mo, (int)mode, flags); } } @@ -1374,8 +1362,7 @@ void FLevelLocals::PlayerReborn (int player) IFVIRTUALPTRNAME(actor, NAME_PlayerPawn, GiveDefaultInventory) { - VMValue params[1] = { actor }; - VMCall(func, params, 1, nullptr, 0); + VMCallVoid(func, actor); } p->ReadyWeapon = p->PendingWeapon; }