What's going on with these cryptic arrays?
Pajamaman opened this issue · comments
What are these arrays found in ovr018.cs used for?
static byte[] /* seg600:081A */ unk_16B2A = { 1, 1, 1, 1, 2, 1, 1, 2 };
static byte[] /* seg600:0822 */ unk_16B32 = { 8, 8, 0xA, 0xA, 8, 4, 6, 4 };
static byte[] /* seg600:3EAA unk_1A1BA */ classMasks = { 2, 2, 8, 0x10, 0x20, 1, 4, 4 };
My guess is that the values in classMasks
are for cleric, druid, fighter, paladin, ranger, magic-user, thief and monk respectively. Is that right?
I am also wondering about this line in Gbl.cs:
public readonly static byte[] max_class_hit_dice = { 10, 15, 10, 10, 11, 12, 11, 13 }; // byte_1A1CB seg600:3EBB
Are these values in the same order as classMasks
above?
Finally, do you have any idea why these might differ from those found in OSRIC? I assume the developers took some liberties with the rules, but you might not know just from looking at the code :)
Aha, I think I figured the answer to the first part of my question. unk_16B2A
is probably the number of initial hit die for each class, since the ranger gets 2. The last one must be for the monk, which is the only other class I'm aware of that gets 2.
unk_16B32
is probably hit die type. It's odd that the monk would be assigned a d4, but since it never made it into the final game maybe it's not so odd.
I'm still totally confused what classMasks
is for!
it's used for bit stuffing, each item is a single bit, thus showing it in hex. Yes monk was the last class type, but it's not allowed in game.
They where pretty much 100% compliant with the AD&D v1 rules.
If something is left with it's original memory location as it's name it means:
A) I didn't know what it was for, and by know I mean 99% sure.
B) I did know, but didn't care once I'd worked it out.
if you load the code in VS you can do a Find References and see all the places it's used, makes these things make easier to workout... Then you can F2 rename, for the win.
Fair enough!
Regarding the discrepancies with OSRIC, I just realized the code that calculates hit points (sub_509E0
function in ovr018.cs) checks that the current class level is below the value in max_class_hit_dice
, so it makes perfect sense that each is off by 1 :)