Fixed range for object ID.

Added checks for FID in NPC armor appearance mod.
Minor edits to documents.
This commit is contained in:
NovaRain
2019-03-16 08:47:37 +08:00
parent 1fd93ba13f
commit aa91e9fad4
7 changed files with 26 additions and 13 deletions
+1 -1
View File
@@ -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
Binary file not shown.
+11 -2
View File
@@ -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
+1 -1
View File
@@ -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.
+3 -1
View File
@@ -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;
+1 -1
View File
@@ -71,7 +71,7 @@ struct PerkInfoExt {
static std::vector<PerkInfoExt> extPerks;
struct FakePerk {
int Level; // current level (max 99)
int Level; // current level (max 100)
int Image;
char Name[maxNameLen];
char Desc[maxDescLen];
+9 -7
View File
@@ -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;