some characters have no default attributes

https://attnam.com/topics/some-characters-has-no-default-attributes

The Cathedral of Attnam > Trouble Shooting and Bugs

#1 Mar 1, 11:37 am Hide

vasiliy

some characters have undefined attributes. it is mostly harmless, but causes the game to access uninitialised memory.

imp has no:
DefaultArmStrength
DefaultLegStrength
DefaultDexterity
DefaultAgility
DefaultEndurance
i don't know what to put there. i mean, by which other creature imp was modelled? and i'm not sure that this is harmless.

petruss wives has no fighting skills, and they need them just in case they will get some weapons. also, petruss wife #2 "wields" a child, so she needs weapon skills from the start. i propose something like
// taken from the housewife
KnownCWeaponSkills = { 3, UNARMED, UNCATEGORIZED, BLUNT_WEAPONS; }
CWeaponSkillHits = { 2, 50, 50, 50; }
BaseUnarmedStrength = 200;
in the main definition. "blunt" added for frying pans and rolling pins.

firstborn item is missing some definitions, so danger caluclation for petruss wife #2 is UB.
Category = MISC;
FormModifier = 30; //k8: i don't know
IsTwoHanded = true; //k8: why not?

don't ask me how i found that. you don't want to know.
SPOILER ALERT. Click here to see text.
a lot of debug printing and a lot of valgrind sessions with k8IVAN. then quickly checked if vanilla is missing those too.


there seem to be a problem with mushrooms too, but i don't know yet what causes it, and if it is present in vanilla too. it is something with graphics data and animation (and i rewrote graphics subsystem, so it's hard to compare things there).
#2 Mar 1, 2:23 pm Hide

vasiliy

mushroom needs `TorsoSpecialColor` and `BeltColor` set. the values can be arbitrary, the properties simply need to be defined. this is prolly wrong (the actual bug is somewhere else), but at least it makes valgrind happy.
#3 Mar 1, 4:02 pm Hide

red_kangaroo

I think this all just draws values from the default "character" here: https://github.com/Attnam/ivan/blob/master/Script/char.dat#L...

Doesn't it?
#4 Mar 1, 4:07 pm Hide

vasiliy

valgrind says that they are uninitialised. `character` doesn't have those default strenghtes set, there is even the comment about that. and colors are set only for humanoids. so those end up as undefined. fighting skills don't have default values too.

actually, the game itself should check for this, but sadly, it can't.

that is, valgrind is always right, because it actually executes the machine code, and checks if the memory initialised on each read. it's not some static analysis tool. it is freakin' slow, of course, because it is a fully-featured CPU emulator. so running the game with valgrind is PITA, and i cannot check more than that (it literally takes minutes to heal several HP). sigh.
#5 Mar 2, 11:49 am Hide

red_kangaroo

Ah, thanks. Tracked here: https://github.com/Attnam/ivan/issues/670