Add update_toolname

This commit is contained in:
Alexander Batalov 2023-09-03 20:48:23 +03:00
parent 0d83cff24e
commit ee19238667
3 changed files with 82 additions and 1 deletions

View File

@ -46,6 +46,7 @@ static void edit_mapper();
static void mapper_load_toolbar(int a1, int a2);
static void redraw_toolname();
static void clear_toolname();
static void update_toolname(int* pid, int type, int id);
static void update_high_obj_name(Object* obj);
static int mapper_mark_exit_grid();
static void mapper_mark_all_exit_grids();
@ -1408,6 +1409,85 @@ void clear_toolname()
redraw_toolname();
}
// 0x48B328
void update_toolname(int* pid, int type, int id)
{
Proto* proto;
*pid = toolbar_proto(type, id);
if (protoGetProto(*pid, &proto) == -1) {
return;
}
windowDrawText(tool_win,
protoGetName(proto->pid),
120,
_scr_size.right - _scr_size.left - 149,
60,
260);
switch (PID_TYPE(proto->pid)) {
case OBJ_TYPE_ITEM:
windowDrawText(tool_win,
gItemTypeNames[proto->item.type],
120,
_scr_size.right - _scr_size.left - 149,
70,
260);
break;
case OBJ_TYPE_CRITTER:
windowDrawText(tool_win,
"",
120,
_scr_size.right - _scr_size.left - 149,
70,
260);
break;
case OBJ_TYPE_WALL:
windowDrawText(tool_win,
proto_wall_light_str(proto->wall.flags),
120,
_scr_size.right - _scr_size.left - 149,
70,
260);
break;
case OBJ_TYPE_TILE:
windowDrawText(tool_win,
"",
120,
_scr_size.right - _scr_size.left - 149,
70,
260);
break;
case OBJ_TYPE_MISC:
windowDrawText(tool_win,
"",
120,
_scr_size.right - _scr_size.left - 149,
70,
260);
break;
default:
windowDrawText(tool_win,
"",
120,
_scr_size.right - _scr_size.left - 149,
70,
260);
break;
}
windowDrawText(tool_win,
"",
120,
_scr_size.right - _scr_size.left - 149,
80,
260);
redraw_toolname();
}
// 0x48B5BC
void update_high_obj_name(Object* obj)
{

View File

@ -167,7 +167,7 @@ char* _proto_none_str;
static char* gBodyTypeNames[BODY_TYPE_COUNT];
// 0x664834
static char* gItemTypeNames[ITEM_TYPE_COUNT];
char* gItemTypeNames[ITEM_TYPE_COUNT];
// 0x66484C
static char* gDamageTypeNames[DAMAGE_TYPE_COUNT];

View File

@ -101,6 +101,7 @@ extern char _cd_path_base[COMPAT_MAX_PATH];
extern MessageList gProtoMessageList;
extern char* _proto_none_str;
extern char* gItemTypeNames[ITEM_TYPE_COUNT];
void proto_make_path(char* path, int pid);
int _proto_list_str(int pid, char* proto_path);