From 0ab031f8a6f4cf587010e059baf71128177d966d Mon Sep 17 00:00:00 2001 From: Dethrace Labs <78985374+dethrace-labs@users.noreply.github.com> Date: Fri, 3 Oct 2025 14:16:05 +1300 Subject: [PATCH] GetOpponentsNextSection matching --- src/DETHRACE/common/opponent.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/src/DETHRACE/common/opponent.c b/src/DETHRACE/common/opponent.c index fcce54a1..d4a7786d 100644 --- a/src/DETHRACE/common/opponent.c +++ b/src/DETHRACE/common/opponent.c @@ -2920,18 +2920,15 @@ int GetOpponentsFirstSection(tOpponent_spec* pOpponent_spec) { // IDA: int __usercall GetOpponentsNextSection@(tOpponent_spec *pOpponent_spec@, tS16 pCurrent_section@) // FUNCTION: CARM95 0x0040b86e int GetOpponentsNextSection(tOpponent_spec* pOpponent_spec, tS16 pCurrent_section) { - - if (pCurrent_section < 20000) { - if (pCurrent_section < 15000) { - return -1; - } else { - return CalcNextTrailSection(pOpponent_spec, pCurrent_section); + if (pCurrent_section >= 20000) { + if (pCurrent_section - 19999 < pOpponent_spec->nnext_sections && (pOpponent_spec->cheating || gProgram_state.AI_vehicles.path_sections[pCurrent_section - 19999].type != ePST_cheat_only)) { + return pCurrent_section + 1; } - } else if (pCurrent_section - 19999 >= pOpponent_spec->nnext_sections || (!pOpponent_spec->cheating && gProgram_state.AI_vehicles.path_sections[pCurrent_section - 19999].type == ePST_cheat_only)) { return -1; - } else { - return pCurrent_section + 1; + } else if (pCurrent_section >= 15000) { + return CalcNextTrailSection(pOpponent_spec, pCurrent_section); } + return -1; } // IDA: tS16 __usercall GetOpponentsSectionStartNode@(tOpponent_spec *pOpponent_spec@, tS16 pSection@)