-
Notifications
You must be signed in to change notification settings - Fork 552
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WorldThingGoalReached Virtual #2823
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -51,6 +51,7 @@ | |
#include "actorinlines.h" | ||
#include "a_ceiling.h" | ||
#include "shadowinlines.h" | ||
#include "events.h" | ||
|
||
#include "gi.h" | ||
|
||
|
@@ -2370,6 +2371,20 @@ DEFINE_ACTION_FUNCTION(AActor, A_Look2) | |
return 0; | ||
} | ||
|
||
void GoalReached(AActor* self, AActor* oldgoal) | ||
{ | ||
if (self && self->Level) | ||
self->Level->localEventManager->WorldThingGoalReached(self, oldgoal); | ||
} | ||
|
||
DEFINE_ACTION_FUNCTION(AActor, GoalReached) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should be native |
||
{ | ||
PARAM_SELF_PROLOGUE(AActor); | ||
PARAM_OBJECT(oldgoal, AActor); | ||
GoalReached(self, oldgoal); | ||
return 0; | ||
} | ||
|
||
//============================================================================= | ||
// | ||
// A_Chase | ||
|
@@ -2549,7 +2564,8 @@ void A_DoChase (AActor *actor, bool fastchase, FState *meleestate, FState *missi | |
// [RH] Don't attack if just moving toward goal | ||
if (actor->target == actor->goal || (actor->flags5&MF5_CHASEGOAL && actor->goal != NULL)) | ||
{ | ||
AActor * savedtarget = actor->target; | ||
AActor *savedtarget = actor->target; | ||
AActor *savedgoal = actor->goal; | ||
actor->target = actor->goal; | ||
bool result = P_CheckMeleeRange(actor); | ||
actor->target = savedtarget; | ||
|
@@ -2572,7 +2588,7 @@ void A_DoChase (AActor *actor, bool fastchase, FState *meleestate, FState *missi | |
DAngle lastgoalang = actor->goal->Angles.Yaw; | ||
int delay; | ||
AActor * newgoal = iterator.Next (); | ||
if (newgoal != NULL && actor->goal == actor->target) | ||
if (newgoal != nullptr && actor->goal == actor->target) | ||
{ | ||
delay = newgoal->args[1]; | ||
actor->reactiontime = delay * TICRATE + actor->Level->maptime; | ||
|
@@ -2592,6 +2608,7 @@ void A_DoChase (AActor *actor, bool fastchase, FState *meleestate, FState *missi | |
} | ||
actor->flags7 &= ~MF7_INCHASE; | ||
actor->goal = newgoal; | ||
GoalReached(actor, savedgoal); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Missing destruction check before calling this since a goal special could delete it. |
||
return; | ||
} | ||
if (actor->goal == actor->target) goto nomissile; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
self
doesn't need to be nulled checked since the VM ensures that this won't happen