Skip to content

Commit 765eac2

Browse files
Hexen: fix wyvern + porkalator bug (#701)
* Hexen: check for P_FindMobjFromTID() returning a NULL mobj in DragonSeek() Co-authored-by: Julia Nechaevskaya <[email protected]> Co-authored-by: Fabian Greffrath <[email protected]>
1 parent 19b0cf8 commit 765eac2

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

prboom2/src/p_enemy.c

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6492,14 +6492,27 @@ static void DragonSeek(mobj_t * actor, angle_t thresh, angle_t turnMax)
64926492
actor->target->y);
64936493
for (i = 0; i < 5; i++)
64946494
{
6495+
int mo_x, mo_y;
64956496
if (!target->special_args[i])
64966497
{
64976498
continue;
64986499
}
64996500
search = -1;
65006501
mo = P_FindMobjFromTID(target->special_args[i], &search);
6502+
// [crispy] fix wyvern + porkalator bug
6503+
if (mo == NULL)
6504+
{
6505+
lprintf(LO_WARN, "DragonSeek: P_FindMobjFromTID() returned NULL mobj!\n");
6506+
mo_x = 0;
6507+
mo_y = 0;
6508+
}
6509+
else
6510+
{
6511+
mo_x = mo->x;
6512+
mo_y = mo->y;
6513+
}
65016514
angleToSpot = R_PointToAngle2(actor->x, actor->y,
6502-
mo->x, mo->y);
6515+
mo_x, mo_y);
65036516
if (abs((int) angleToSpot - (int) angleToTarget) < bestAngle)
65046517
{
65056518
bestAngle = abs((int) angleToSpot - (int) angleToTarget);

0 commit comments

Comments
 (0)