From 49804a52e6d821f0e354e3b527720878b5e240e5 Mon Sep 17 00:00:00 2001 From: Alexander Batalov Date: Mon, 24 Jul 2023 08:29:19 +0300 Subject: [PATCH] Add combat_ai_name --- src/combat_ai.cc | 18 ++++++++++++++++++ src/combat_ai.h | 1 + 2 files changed, 19 insertions(+) diff --git a/src/combat_ai.cc b/src/combat_ai.cc index 2cf475e..2110b9d 100644 --- a/src/combat_ai.cc +++ b/src/combat_ai.cc @@ -707,6 +707,24 @@ int combat_ai_num() return gAiPacketsLength; } +// 0x428060 +char* combat_ai_name(int packet_num) +{ + int index; + + if (packet_num < 0 || packet_num >= gAiPacketsLength) { + return NULL; + } + + for (index = 0; index < gAiPacketsLength; index++) { + if (gAiPackets[index].packet_num == packet_num) { + return gAiPackets[index].name; + } + } + + return NULL; +} + // Get ai from object // // 0x4280B4 diff --git a/src/combat_ai.h b/src/combat_ai.h index e182a2c..1e11dfb 100644 --- a/src/combat_ai.h +++ b/src/combat_ai.h @@ -31,6 +31,7 @@ int aiExit(); int aiLoad(File* stream); int aiSave(File* stream); int combat_ai_num(); +char* combat_ai_name(int packet_num); int aiGetAreaAttackMode(Object* obj); int aiGetRunAwayMode(Object* obj); int aiGetBestWeapon(Object* obj);