From 9723f01906a9c5e29876ba01e915377ea24bd683 Mon Sep 17 00:00:00 2001 From: Nelsonh <81228864+OH296@users.noreply.github.com> Date: Mon, 16 Dec 2024 21:10:50 +0000 Subject: [PATCH] fix: obj_ini.icon string failsafe (#212) fixes: https://discord.com/channels/714022226810372107/1318249302799421450 --- objects/obj_controller/Draw_64.gml | 35 +++++++++++++++--------------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/objects/obj_controller/Draw_64.gml b/objects/obj_controller/Draw_64.gml index 926224cf4..e46f42052 100644 --- a/objects/obj_controller/Draw_64.gml +++ b/objects/obj_controller/Draw_64.gml @@ -43,28 +43,29 @@ if (!zoomed && !zui){ if (y_slide>0) then draw_set_alpha((100-(y_slide*2))/100); - + draw_set_alpha(1); draw_sprite(spr_new_banner,0,1439+new_banner_x,62); draw_sprite(spr_new_ui_cover,0,0,(900-17)); // Handles custom chapters - if (string_count("custom",obj_ini.icon_name)>0){ - var cusl=string_replace(obj_ini.icon_name,"custom",""); - cusl=real(cusl); - if (obj_cuicons.spr_custom[cusl]>0) and (obj_cuicons.spr_custom_icon[cusl]!=-1){ - draw_sprite_stretched(obj_cuicons.spr_custom_icon[cusl],0,1451+new_banner_x,73,141,141); - } - } - // Handles icon for normal chapters - if (string_count("custom",obj_ini.icon_name)==0){ - var icon_sprite=spr_icon,icc=obj_ini.icon; - if (icc<=20) then scr_image("creation",icc,1451+new_banner_x,73,141,141); - if (icc>20){ - icon_sprite=spr_icon_chapters; - icc-=19; - draw_sprite(icon_sprite,icc,1451+new_banner_x,73); - } + if (is_string(obj_ini.icon_name)){ + if (string_count("custom",obj_ini.icon_name)>0){ + var cusl=string_replace(obj_ini.icon_name,"custom",""); + cusl=real(cusl); + if (obj_cuicons.spr_custom[cusl]>0) and (obj_cuicons.spr_custom_icon[cusl]!=-1){ + draw_sprite_stretched(obj_cuicons.spr_custom_icon[cusl],0,1451+new_banner_x,73,141,141); + } + }else { + var icon_sprite=spr_icon,icc=obj_ini.icon; + if (icc<=20) then scr_image("creation",icc,1451+new_banner_x,73,141,141); + if (icc>20){ + icon_sprite=spr_icon_chapters; + icc-=19; + draw_sprite(icon_sprite,icc,1451+new_banner_x,73); + } + } } + draw_set_color(38144); draw_set_font(fnt_menu);