Rewrote the code in Animations.cpp

Fixed gl_auto_closebox not closing containers in some cases.
This commit is contained in:
NovaRain
2021-05-11 10:43:21 +08:00
parent 2cb2ebc9c9
commit 3a45d016af
6 changed files with 104 additions and 135 deletions
@@ -13,8 +13,10 @@ Requires sfall 4.2.2/3.8.29 or higher
#include "..\headers\sfall\define_extra.h"
procedure start;
procedure close;
variable lootObject;
variable closeObject;
procedure start begin
if (game_loaded) then begin
@@ -26,8 +28,13 @@ procedure start begin
lootObject := loot_obj;
if (obj_type(lootObject) != OBJ_TYPE_ITEM) then lootObject = 0;
end else if (lootObject andAlso get_sfall_arg_at(1) == INTFACELOOT) then begin
if (get_object_data(lootObject, OBJ_DATA_CUR_FRM) > 1) then obj_close(lootObject);
if (get_object_data(lootObject, OBJ_DATA_CUR_FRM) > 1) then call close in 1;
closeObject = lootObject;
lootObject = 0;
end
end
end
procedure close begin
obj_close(closeObject);
end
@@ -25,7 +25,7 @@ end
// Gets the string value from the specified ini
procedure GetIniConfigStr(variable section, variable key, variable def, variable inifile) begin
variable val := get_ini_string(inifile + "|" + section + "|" + key);
if val == -1 or val == "" then val := def;
if val == -1 orElse val == "" then val := def;
return val;
end
@@ -39,14 +39,14 @@ end
// Gets the string value from sfall-mods.ini
procedure GetConfigStr(variable section, variable key, variable def) begin
variable val := get_ini_string(ini + "|" + section + "|" + key);
if val == -1 or val == "" then val := def;
if val == -1 orElse val == "" then val := def;
return val;
end
// Gets the value from sfall-mods.ini as a temp array of strings
procedure GetConfigList(variable section, variable key) begin
variable val := get_ini_string(ini + "|" + section + "|" + key);
if val == -1 or val == "" then return [];
if val == -1 orElse val == "" then return [];
return string_split(val, ",");
end
@@ -65,7 +65,7 @@ end
// Translates given string using Translations.ini
procedure Translate(variable id, variable def) begin
variable str := get_ini_string(translationIni + "|Sfall|" + id);
if not str or (strlen(str) == 0) then begin
if (str == 0 orElse (strlen(str) == 0)) then begin
str := def;
end
return str;