diff --git a/docs/rh-log.txt b/docs/rh-log.txt index 30094179a..e2456dc82 100644 --- a/docs/rh-log.txt +++ b/docs/rh-log.txt @@ -1,4 +1,10 @@ August 7, 2009 +- If SetActivatorToTarget is used for a player-run script, and the player is + alive, it now sets the activator to the actor the player is aiming at. I + also noticed that this looked like it was a quick copy'n'paste job from + SetActivator. It returns false if the activator at the end of the function + was the world, but it never sets the activator to the world. I'm not sure + that's the best use of the return value. - Added support for per-SpawnShot spawn lists. (Also fixed a potential infinite loop, though I'm not sure the parser allowed this condition to happen.) diff --git a/src/p_acs.cpp b/src/p_acs.cpp index b60db3152..507aa9f45 100644 --- a/src/p_acs.cpp +++ b/src/p_acs.cpp @@ -2935,9 +2935,23 @@ int DLevelScript::CallFunction(int argCount, int funcIndex, SDWORD *args) return activator != NULL; case ACSF_SetActivatorToTarget: - actor = SingleActorFromTID(args[0], NULL); - if (actor != NULL) actor = actor->target; - if (actor != NULL) activator = actor; + // [KS] I revised this a little bit + actor = SingleActorFromTID(args[0], activator); + if (actor != NULL) + { + if (actor->player != NULL && actor->player->playerstate == PST_LIVE) + { + P_BulletSlope(actor, &actor); + } + else + { + actor = actor->target; + } + } + if (actor != NULL) + { + activator = actor; + } return activator != NULL; case ACSF_GetActorViewHeight: