From abb728db7c78d0502db5227717c993f1e474473b Mon Sep 17 00:00:00 2001 From: Dethrace Labs <78985374+dethrace-labs@users.noreply.github.com> Date: Fri, 3 Oct 2025 14:55:00 +1300 Subject: [PATCH] GetOpponentsSectionFinishNode matching --- src/DETHRACE/common/opponent.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/DETHRACE/common/opponent.c b/src/DETHRACE/common/opponent.c index baf3139b..0acd3df8 100644 --- a/src/DETHRACE/common/opponent.c +++ b/src/DETHRACE/common/opponent.c @@ -2941,11 +2941,7 @@ tS16 GetOpponentsSectionStartNode(tOpponent_spec* pOpponent_spec, tS16 pSection) if (pSection >= 20000 && pSection - 20000 < pOpponent_spec->nnext_sections) { section_no = pOpponent_spec->next_sections[pSection - 20000].section_no; node_index_index = pOpponent_spec->next_sections[pSection - 20000].direction == 0; - // if (pSection - 20000 <= pOpponent_spec->nnext_sections) { - // return gProgram_state.AI_vehicles.path_sections[section_no].node_indices[node_index_index]; - // } return pOpponent_spec->nnext_sections >= pSection - 20000 ? gProgram_state.AI_vehicles.path_sections[section_no].node_indices[node_index_index] : -1; - // return -1; } dr_dprintf("BIG ERROR - GetOpponentsSectionStartNode() - section not found in next_section array for opponent %s", pOpponent_spec->car_spec->driver_name); PDEnterDebugger("BIG ERROR - GetOpponentsSectionStartNode()"); @@ -2959,12 +2955,13 @@ tS16 GetOpponentsSectionFinishNode(tOpponent_spec* pOpponent_spec, tS16 pSection int node_index_index; if (pSection >= 20000 && pSection - 20000 < pOpponent_spec->nnext_sections) { - return gProgram_state.AI_vehicles.path_sections[pOpponent_spec->next_sections[pSection - 20000].section_no].node_indices[pOpponent_spec->next_sections[pSection - 20000].direction]; + section_no = pOpponent_spec->next_sections[pSection - 20000].section_no; + node_index_index = pOpponent_spec->next_sections[pSection - 20000].direction; + return gProgram_state.AI_vehicles.path_sections[section_no].node_indices[node_index_index]; } - dr_dprintf("BIG ERROR - GetOpponentsSectionFinishNode() - section not found in next_section array for opponent %s", - pOpponent_spec->car_spec->driver_name); + dr_dprintf("BIG ERROR - GetOpponentsSectionFinishNode() - section not found in next_section array for opponent %s", pOpponent_spec->car_spec->driver_name); PDEnterDebugger("BIG ERROR - GetOpponentsSectionFinishNode()"); - return 0; + return -1; } // IDA: br_vector3* __usercall GetOpponentsSectionStartNodePoint@(tOpponent_spec *pOpponent_spec@, tS16 pSection@)