From 572e6652ccc8a8bfbbef7a1d07200c77b09cdb53 Mon Sep 17 00:00:00 2001 From: smallmodel <15067410+smallmodel@users.noreply.github.com> Date: Sat, 27 Jul 2024 19:05:05 +0200 Subject: [PATCH] Fix `followpath` not working under special circumstances This fixes an issue where some planes (like the final bomber plane in t3l2) would not fly and look stuck --- code/fgame/scriptslave.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/code/fgame/scriptslave.cpp b/code/fgame/scriptslave.cpp index 50f1297e..847017e8 100644 --- a/code/fgame/scriptslave.cpp +++ b/code/fgame/scriptslave.cpp @@ -463,7 +463,7 @@ Event EV_ScriptSlave_FollowPath "eSSSSSS", "path arg1 arg2 arg3 arg4 arg5 arg6", "Makes the script slave follow the specified path. The allowable arguments are ignoreangles,\n" - "normalangles, loop, and a number specifying the start time.", + "ignorevelocity, normalangles, loop, and a number specifying the start time.", EV_NORMAL ); Event EV_ScriptSlave_FollowPath_RelativeYaw @@ -1407,6 +1407,17 @@ void ScriptSlave::FollowPath(Event *ev) clamp = false; } else if (IsNumeric(token)) { starttime = atof(token); + // Fixed in OPM + // HACKHACK + // + // There is a bug in mohaa where the token's raw pointer is directly used + // but then the token can be freed before comparison, which cause + // starttime to be always 0. + // OPM is correct here but for compatibility purpose the bug have to be reproduced. + // Otherwise, for example the final bomber plane in t3l2 will not fly. + if (!ev->IsStringAt(i)) { + starttime = 0; + } } else { ScriptError("Unknown followpath command %s.", token.c_str()); }