dethrace-labs / dethrace

Reverse engineering the 1997 game "Carmageddon"
https://twitter.com/dethrace_labs
GNU General Public License v3.0
875 stars 46 forks source link

Wasted COP keeps knackeredness_detected == 1 and does not chase in any future race. #401

Closed b-kurczynski closed 4 months ago

b-kurczynski commented 4 months ago

After cop car is wasted its knackeredness_detected is not reset to 0 before next race thus a cop car occupying the same slot is not active in any future race (the same map or any other), although, it can be wasted again.

I believe, somewhere here: https://github.com/dethrace-labs/dethrace/blob/main/src/DETHRACE/common/opponent.c#L2534

the following line is missing:

+   gProgram_state.AI_vehicles.cops[i].knackeredness_detected = 0;

As the function is quite long, it could be this line got lost during reverse engineering. I do not know where precisely it should be placed.

madebr commented 4 months ago

You're 100% correct! finished_for_this_race was reset twice, instead of knackeredness_detected. I checked the other bitflags, and found out has_moved_at_some_point was not reset either.

Thanks for the find, and also pointing us to the correct location!

https://github.com/dethrace-labs/dethrace/pull/402 will fix this