Hi all,
As you probably know, there is a bug in the original game where, for a relatively small percentage of pit stops, the car doesn't stay in the pits anywhere near as long as it should, given how much fuel is added. This is most evident on 1-stop strategies where most cars will take 12-15 seconds to refuel but sometimes a car will be out in less than 7 with the full fuel amount. I wasn't able to find any fix for this online, so once it annoyed me enough, I decided to try to figure out a way to fix it myself (even though I pretty much had to learn assembly programming from scratch). After around 5 weeks of messing with it, I finally got it figured out and want to share it with everyone.
FixFixing this bug requires a change to gp4.exe. Open the decrypted (v1.02) gp4.exe with your favorite hex editor (back it up first of course), and make the following change starting at offset 0x0E681D:
Original file:
8B C6 8B 51 44 C1 E0 04 03 C6 83 7C C2 24 05 0F 84 8C 00 00 00 8B 85 BC 5D A9 00 85 C0 0F 8F 92 00 00 00
Replace with:
8B 85 BC 5D A9 00 85 C0 0F 8F A7 00 00 00 8B C6 8B 51 44 C1 E0 04 03 C6 83 7C C2 24 05 0F 84 7E 00 00 00
(Note: there are smaller changes that would surely fix the bug as well; the above change, though, preserves all of the original game's code, just rearranges it)
This fix
should be compatible with any tools that modify gp4.exe (not aware of any tool the modifies this part of the code), though I haven't tested it all that extensively. If anyone finds issues using this, please let me know. I'll also be running some more test races to ensure that nothing else is broken with this.
I might make a patch program at some later point to make it simpler, although I think it would be better to get this incorporated into one of the other tools if possible.
Explanation and Known IssueThe bug stems from a poorly-implemented feature. The idea appears to have been that for a small percentage of pit stops, the mechanic would have trouble detaching the fuel nozzle from the car at the end of the stop, leading to a
longer stop. However, the way the code handles this particular type of pit stops is that once a car arrives for a stop and is jacked up, the code starts checking (I believe) whether the 2 pit crew members responsible for refueling have finished their animations, and if they have, it considers the refueling part of the stop to be done. But the only animation being played at this point in the stop is the one for inserting the fuel nozzle... so as soon as it's inserted, the refueling part of the stop is over, and the nozzle is taken right back out. All this, even with the "problem" version of the detaching animation, takes less time than the tyre changes, so the end result is that for these stops, the refueling is basically instant, and the tyre change time is the only thing that determines the overall pit stop time.
The fix switches around 2 of the conditions used when checking whether refueling should be completed, so that now the "problem"-specific checks will only be done after the normal refueling is completed. This ensures that refueling will take the normal amount of time for every kind of stop.
The fix does not, however, implement the "refueling problem" feature itself, because there are other problems with the code as well (namely, that the code never checks whether the nozzle detaching animation is complete, neither for normal nor "problem" versions of the animation, when determining whether the pit stop as a whole is over). As a result, this fix introduces a small animation glitch for these "problem" pit stops, where the car drives away while the pit crew is still trying to detach the nozzle. This has no impact on the game beyond the animation looking weird - for all intents and purposes, the "problem" stops with the fix behave just like a normal stop would. This glitch itself can be fixed pretty easily if needed - for example, by changing the race normalchange.ssc file inside anim.wad (change the "fuel_problem" scenescript to match the "normal_change" one aside from the name).
Can the "Refueling Problem" Feature Be Enabled?I won't say that for sure it can't - after all, all the needed pieces are there in the game already - but I played around with a few relatively simple test fixes and wasn't able to get this feature working without also adversely impacting normal stops. So most likely a fix to properly enable this feature would be quite complex.
(EDIT: Added clarification on which gp4.exe version to use and an explanation of what the fix actually does).
Edited 1 time(s). Last edit at 09/28/2017 12:35AM by MikhailM.