diff --git a/artifacts/ddraw.ini b/artifacts/ddraw.ini index 45ca8ca0..f19aaad8 100644 --- a/artifacts/ddraw.ini +++ b/artifacts/ddraw.ini @@ -353,8 +353,8 @@ PlayIdleAnimOnReload=0 CorpseLineOfFireFix=0 ;Changes the timer (in days) for deleting corpses on a map after you leave (valid range: 0..13) -;Default is 6. Set to 0 for a 12-hour timer ;The corpses of critters with 'Ages' flag or on maps with 'dead_bodies_age=No' set in maps.txt will not disappear +;Default is 6. Set to 0 for a 12-hour timer CorpseDeleteTime=6 ;Set a number of milliseconds to idle each input loop diff --git a/artifacts/mods/gl_npcarmor.int b/artifacts/mods/gl_npcarmor.int index bc267a74..54d07d49 100644 Binary files a/artifacts/mods/gl_npcarmor.int and b/artifacts/mods/gl_npcarmor.int differ diff --git a/artifacts/mods/gl_npcarmor.ssl b/artifacts/mods/gl_npcarmor.ssl index d16ede07..d0a48cbb 100644 --- a/artifacts/mods/gl_npcarmor.ssl +++ b/artifacts/mods/gl_npcarmor.ssl @@ -96,7 +96,11 @@ procedure invenwield_handler begin if (critter and item and slot == INVEN_TYPE_WORN) then begin fid := check_armor_change(critter, item, isWorn); if (fid != -1) then begin - art_change_fid_num(critter, fid); + if art_exists(fid) then begin + art_change_fid_num(critter, fid); + end else begin + debug_msg("Error: NPC Armor mod: missing FID."); + end end return; end @@ -119,7 +123,12 @@ procedure adjustfid_handler begin fid := check_armor_change(dude_obj, armor, armor != 0); if (fid != -1) then begin variable weapAnim := get_sfall_arg bwand 0xF000; - set_sfall_return(fid bwand 0xFFFF0FFF bwor weapAnim); + variable newFid := fid bwand 0xFFFF0FFF bwor weapAnim; + if art_exists(newFid) then begin + set_sfall_return(newFid); + end else begin + debug_msg("Error: NPC Armor mod: missing FID."); + end end end end diff --git a/artifacts/scripting/sfall function notes.txt b/artifacts/scripting/sfall function notes.txt index d1707be9..ec3a7387 100644 --- a/artifacts/scripting/sfall function notes.txt +++ b/artifacts/scripting/sfall function notes.txt @@ -44,7 +44,7 @@ The get/set_sfall_global functions require an 8 characters long case sensitive s set_pickpocket_max and set_hit_chance_max effect all critters rather than just the player. set_skill_max can't be used to increase the skill cap above 300. set_perk_level_mod sets a modifier between +25 and -25 that is added/subtracted from the players level for the purposes of deciding which perks can be chosen. -set_fake_trait and set_fake_perk can be used to add additional traits and perks to the character screen. They will be saved correctly when the player saves and reloads games, but by themselves they will have no further effect on the character. For perks, the allowed range for levels is between 0 and 100; setting the level to 0 removes that perk. For traits, the level must be 0 or 1. The image is a numeric id that corresponds to an entry in skilldex.lst. The name is limited to 64 characters and the description to 1024 characters by sfall, but internal Fallout limits may be lower. +set_fake_trait and set_fake_perk can be used to add additional traits and perks to the character screen. They will be saved correctly when the player saves and reloads games, but by themselves they will have no further effect on the character. For perks, the allowed range for levels is between 0 and 100; setting the level to 0 removes that perk. For traits, the level must be 0 or 1. The image is a numeric id that corresponds to an entry in skilldex.lst. The name is limited to 63 characters and the description to 255 characters by sfall, but internal Fallout limits may be lower. has_fake_trait and has_fake_perk return the number of levels the player has of the perks/traits with the given name or ID of extra perk. diff --git a/sfall/Modules/Objects.cpp b/sfall/Modules/Objects.cpp index e8a566e2..83fb1f39 100644 --- a/sfall/Modules/Objects.cpp +++ b/sfall/Modules/Objects.cpp @@ -32,8 +32,10 @@ long Objects::uniqueID = UniqueID::Start; // saving to sfallgv.sav // Assigns a new unique identifier to an object if it has not been previously assigned // the identifier is saved with the object in the saved game and this can used in various script +// player ID = 18000, all party members have ID = 18000 + its pid (file number of prototype) long Objects::SetObjectUniqueID(fo::GameObject* obj) { - if (obj->id > UniqueID::Start || obj == fo::var::obj_dude) return obj->id; // dude id = 18000 + long id = obj->id; + if (id > UniqueID::Start || obj == fo::var::obj_dude || (id >= 18000 && id < 83536)) return id; // 65535 maximum possible number of prototypes if ((DWORD)uniqueID >= UniqueID::End) uniqueID = UniqueID::Start; obj->id = ++uniqueID; diff --git a/sfall/Modules/Perks.cpp b/sfall/Modules/Perks.cpp index f55ac363..ab479dd1 100644 --- a/sfall/Modules/Perks.cpp +++ b/sfall/Modules/Perks.cpp @@ -71,7 +71,7 @@ struct PerkInfoExt { static std::vector extPerks; struct FakePerk { - int Level; // current level (max 99) + int Level; // current level (max 100) int Image; char Name[maxNameLen]; char Desc[maxDescLen]; diff --git a/sfall/Modules/Scripting/Handlers/Utils.cpp b/sfall/Modules/Scripting/Handlers/Utils.cpp index 416897b2..7dd9c063 100644 --- a/sfall/Modules/Scripting/Handlers/Utils.cpp +++ b/sfall/Modules/Scripting/Handlers/Utils.cpp @@ -92,29 +92,31 @@ void sf_typeof(OpcodeContext& ctx) { static int _stdcall StringSplit(const char* str, const char* split) { int id; - if (strlen(split) == 0) { - id = TempArray(strlen(str), 4); - for (DWORD i = 0; i < strlen(str); i++) { + size_t count, splitLen = strlen(split); + if (!splitLen) { + count = strlen(str); + id = TempArray(count, 0); + for (DWORD i = 0; i < count; i++) { arrays[id].val[i].set(&str[i], 1); } } else { - int count = 1; + count = 1; const char *ptr = str, *newptr; while (true) { newptr = strstr(ptr, split); if (!newptr) break; count++; - ptr = newptr + strlen(split); + ptr = newptr + splitLen; } id = TempArray(count, 0); ptr = str; count = 0; while (true) { newptr = strstr(ptr, split); - int len = newptr ? newptr - ptr : strlen(ptr); + int len = (newptr) ? newptr - ptr : strlen(ptr); arrays[id].val[count++].set(ptr, len); if (!newptr) break; - ptr = newptr + strlen(split); + ptr = newptr + splitLen; } } return id;