Skip to content

Commit 4303137

Browse files
BoondorlRicardoLuis0
authored andcommitted
Added missing return values in VM calls
These are not supported by the JIT and must always be passed.
1 parent 02b5f9a commit 4303137

File tree

8 files changed

+22
-11
lines changed

8 files changed

+22
-11
lines changed

src/common/cutscenes/screenjob.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,8 +270,10 @@ void ScreenJobDraw()
270270
ScaleOverrider ovr(twod);
271271
IFVIRTUALPTRNAME(cutscene.runner, NAME_ScreenJobRunner, RunFrame)
272272
{
273+
int ret = 0;
273274
VMValue parm[] = { cutscene.runner, smoothratio };
274-
VMCall(func, parm, 2, nullptr, 0);
275+
VMReturn rets[] = { &ret };
276+
VMCall(func, parm, 2, rets, 1);
275277
}
276278
}
277279
}

src/g_statusbar/sbarinfo_commands.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1441,10 +1441,10 @@ class CommandDrawNumber : public CommandDrawString
14411441
static VMFunction *func = nullptr;
14421442
if (func == nullptr) PClass::FindFunction(&func, NAME_PlayerPawn, "GetEffectTicsForItem");
14431443
VMValue params[] = { statusBar->CPlayer->mo, inventoryItem };
1444-
int retv;
1445-
VMReturn ret(&retv);
1446-
VMCall(func, params, 2, &ret, 1);
1447-
num = retv < 0? 0 : retv / TICRATE + 1;
1444+
int ret1 = 0, ret2 = 0;
1445+
VMReturn rets[] = { &ret1, &ret2 };
1446+
VMCall(func, params, 2, rets, 2);
1447+
num = ret1 < 0? 0 : ret1 / TICRATE + 1;
14481448
break;
14491449
}
14501450
case INVENTORY:

src/intermission/intermission.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -325,8 +325,10 @@ void DIntermissionScreenCutscene::Drawer ()
325325
ScaleOverrider ovr(twod);
326326
IFVIRTUALPTRNAME(mScreenJobRunner, NAME_ScreenJobRunner, RunFrame)
327327
{
328+
int res = 0;
328329
VMValue parm[] = { mScreenJobRunner, I_GetTimeFrac() };
329-
VMCall(func, parm, 2, nullptr, 0);
330+
VMReturn ret[] = { &res };
331+
VMCall(func, parm, 2, ret, 1);
330332
}
331333
}
332334

src/p_conversation.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,8 +218,10 @@ static void TakeStrifeItem (player_t *player, PClassActor *itemtype, int amount)
218218

219219
IFVM(Actor, TakeInventory)
220220
{
221+
int taken = false;
221222
VMValue params[] = { player->mo, itemtype, amount, false, false };
222-
VMCall(func, params, 5, nullptr, 0);
223+
VMReturn rets[] = { &taken };
224+
VMCall(func, params, 5, rets, 1);
223225
}
224226
}
225227

src/playsim/fragglescript/t_func.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2532,8 +2532,10 @@ void FParser::SF_PlayerWeapon()
25322532

25332533
IFVM(PlayerPawn, PickNewWeapon)
25342534
{
2535+
AActor* weap = nullptr;
25352536
VMValue param[] = { Level->Players[playernum]->mo, (void*)nullptr };
2536-
VMCall(func, param, 2, nullptr, 0);
2537+
VMReturn rets[] = { (void**)&weap };
2538+
VMCall(func, param, 2, rets, 1);
25372539
}
25382540
}
25392541
}

src/playsim/p_interaction.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,10 @@ void AActor::Die (AActor *source, AActor *inflictor, int dmgflags, FName MeansOf
345345
}
346346
}
347347

348-
VMCall(func, params, 1, nullptr, 0);
348+
AActor* unused = nullptr;
349+
int unused2 = 0, unused3 = 0;
350+
VMReturn ret[] = { (void**)&unused, &unused2, &unused3 };
351+
VMCall(func, params, 1, ret, 3);
349352

350353
// Kill the dummy Actor if it didn't unmorph, otherwise checking the morph flags. Player pawns need
351354
// to stay, otherwise they won't respawn correctly.

src/playsim/p_map.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ bool P_CanCrossLine(AActor *mo, line_t *line, DVector3 next)
215215
assert(VIndex != ~0u);
216216
}
217217

218-
VMValue params[] = { mo, line, next.X, next.Y, next.Z, false };
218+
VMValue params[] = { mo, line, next.X, next.Y, next.Z };
219219
VMReturn ret;
220220
int retval;
221221
ret.IntAt(&retval);

src/playsim/p_teleport.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ bool P_Teleport (AActor *thing, DVector3 pos, DAngle angle, int flags)
249249
IFVIRTUALPTR(thing, AActor, PostTeleport)
250250
{
251251
VMValue params[] = { thing, pos.X, pos.Y, pos.Z, angle.Degrees(), flags };
252-
VMCall(func, params, countof(params), nullptr, 1);
252+
VMCall(func, params, countof(params), nullptr, 0);
253253
}
254254
}
255255
return true;

0 commit comments

Comments
 (0)