convert g_game.cpp VMCalls to use VMCallSingle/VMCallVoid (as an example)

This commit is contained in:
Ricardo Luís Vaz Silva 2025-04-01 17:10:18 -03:00
parent d8651420cc
commit 6cdcad425a

View file

@ -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<AActor *>(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<AActor *>(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<AActor *>(func, mo);
}
}
@ -443,8 +437,7 @@ CCMD (invnext)
{
IFVM(PlayerPawn, InvNext)
{
VMValue param = players[consoleplayer].mo;
VMCall(func, &param, 1, nullptr, 0);
VMCallVoid<AActor *>(func, players[consoleplayer].mo);
}
}
}
@ -455,8 +448,7 @@ CCMD(invprev)
{
IFVM(PlayerPawn, InvPrev)
{
VMValue param = players[consoleplayer].mo;
VMCall(func, &param, 1, nullptr, 0);
VMCallVoid<AActor *>(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<AActor *>(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;
}