From 9178abc53db553736283ded9c72146d5f3b13e7e Mon Sep 17 00:00:00 2001 From: Alexander Batalov Date: Sat, 2 Sep 2023 19:47:15 +0300 Subject: [PATCH] Add toolbar_proto --- src/mapper/map_func.cc | 12 ++++++++++++ src/mapper/map_func.h | 1 + src/proto.cc | 3 +-- src/proto.h | 1 + 4 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/mapper/map_func.cc b/src/mapper/map_func.cc index def62b9..b9f853b 100644 --- a/src/mapper/map_func.cc +++ b/src/mapper/map_func.cc @@ -1,5 +1,7 @@ #include "mapper/map_func.h" +#include "proto.h" + namespace fallout { // 0x5595CC @@ -17,6 +19,16 @@ void copy_proto_lists() // TODO: Incomplete. } +// 0x484400 +int toolbar_proto(int type, int id) +{ + if (id < proto_max_id(type)) { + return (type << 24) | id; + } else { + return -1; + } +} + // 0x485D44 bool map_toggle_block_obj_viewing_on() { diff --git a/src/mapper/map_func.h b/src/mapper/map_func.h index 44d3166..e779f28 100644 --- a/src/mapper/map_func.h +++ b/src/mapper/map_func.h @@ -5,6 +5,7 @@ namespace fallout { void setup_map_dirs(); void copy_proto_lists(); +int toolbar_proto(int type, int id); bool map_toggle_block_obj_viewing_on(); } // namespace fallout diff --git a/src/proto.cc b/src/proto.cc index 001217f..f266498 100644 --- a/src/proto.cc +++ b/src/proto.cc @@ -39,7 +39,6 @@ static int _proto_find_free_subnode(int type, Proto** out_ptr); static void _proto_remove_some_list(int type); static void _proto_remove_list(int type); static int _proto_new_id(int type); -static int _proto_max_id(int type); // 0x50CF3C static char _aProto_0[] = "proto\\"; @@ -2170,7 +2169,7 @@ static int _proto_new_id(int type) } // 0x4A2214 -static int _proto_max_id(int type) +int proto_max_id(int type) { return _protoLists[type].max_entries_num; } diff --git a/src/proto.h b/src/proto.h index f00eef9..f49d1a6 100644 --- a/src/proto.h +++ b/src/proto.h @@ -137,6 +137,7 @@ int proto_new(int* pid, int type); void _proto_remove_all(); int protoGetProto(int pid, Proto** protoPtr); int _ResetPlayer(); +int proto_max_id(int type); static bool isExitGridPid(int pid) {