Up to this time the GetMemorizableSpellsCount()
function in Actor.cpp wasn't working properly.
As I understand it, the function loads the
clskills.2DA file into a two-dimentional array. Then
it reads the needed rows from the array based on the
Class IDs (Mage is 1, Fighter is 2, Cleric is 3, etc).
The function fails due to two factors:
1. The clskills.2DA file in the override folder is not
ordered according to class IDs. That means that the
Mage line, which supposed to go to the first line
(Since its ID is 1) in the array, goes to the 6th line
because its 6th in the file. The Priest screen worked,
because it looked up the line for the Paladin. The
patch rearanges Planescape's clskills.2DA file in
order to overcome this.
2. The function loads the file into an array which
begin counting from 0, while the class IDs, which it
uses as index for the array, begins from 1. Because of
this, every time it would want to lookup the data for
a Mage (ID 1, therefore recorded in the row 0 of the
array) it would get information on a Figher (ID 2,
therefore recorded in the row 1 of the array). Same
situation happens when it uses the character level to
look in the array containing the table for the maximum
free slot numbers (MXSPLWIZ for a mage). The patch
fixes this, by decrementing the ActorLevel and Class
variables by one.
WARNING: Although these changes work flawlessly for
Planescape Torment, I can't test this for any other
game. For that reason, I did not touch the
GetMemorizableSpellsCountIWD2() function, nor did I
change the clskills.2DA for any other game. If the
Class IDs are different for other games, then this
decrementation in the Actor.cpp would break them. If
it does break the other games, a possible workaround
is to just change the Planescape's clskills file to
have "UNUSED" row as a first line and revert to the
old Actor.cpp file.