Hacking : Map-Location Data - (1) Stone WallsStone Walls are identified within the map data, in the second byte within the location's map data word (AB CD), whereby the final digit (D) is equal to '1'.
To best understand the definition of each wall, it is best to translate the two bytes (AB) and (CD) to binary, and consider which binary bits (right to left) contain defining information.
The Type of WallBit 7 of the (CD) byte is used to determine that the wall is not 'plain' - i.e. contains a Shelf / Sign / Switch or Gem Hole, and is switched 'on' or 'off' for this purpose.
Bits 0-1 of the (AB) byte are used to allocate the wall a number from 0-3.
This number will define the type of wall in occurrence. A plain wall will use a zero here.
0 = Shelf
1 = Sign
2 = Switch
3 = Socket (Crystal/Gem Hole)
The Direction of the WallAny wall which is not plain, i.e. with Bit 7 of (CD) set, can face in one direction only, N/E/S/W.
Bits 4-5 of the (CD) byte,stores a 0-3 value number, which translates to the direction; N/E/S/W.
ShelvesWhere a wall has been designated a shelf, there is only one parameter available.
Bit 3 of the (CD) byte, if set, will designated the shelf as "Concealed", as in how it is becomes after the use of the Conceal spell. No shelves in the original games begin in this state.
All other values are redundant.
SignsFor all wall signs, including wall Scrolls, additional information which will define the appearance of the scroll is contained with Bits 2-7 of (AB). These bits can be converted to a number, from 0-63, which will act as a reference.
Where a sign has a '0' reference value, a seeded colour sign, determined by the game itself, will be placed.
Where a sign has a reference value greater than or equal to 5, the sign will be of the 'wall text' type, and will directly link to a numbered scroll from the scroll data block. Note that the 'starting reference' (i.e. wall scroll number 1) will refer to a different section of text within the Wall Scroll Data, depending on the Tower.
The text which is linked to this particular reference number, including it's layout, is defined in a separate data-block. For information on this see:
Wall Scrolls The value defined by bits 2-7 of (AB) therefore, produces the following signs;
0 = 'generated colour'
1 = Serpent Sign
2 = Dragon Sign
3 = Moon Sign
4 = Chaos Sign
5-63 = Wall Scroll Sign, with reference number (value minus 5)
SwitchesWhere wall data is defined as a 'switch', used to trigger some other in-game event, such as the removal of another wall, there are two parameters available.
Bit 2 of the (AB) byte will determine if the switch is 'lit' or 'dim' - the 'on' value determines the switch as being dim (assume used)
Bits 3-7 of (AB) assigns the switch to a pre-defined function These bits can be converted to a number, from 0-31, which will act as a reference to the action performed by the switch.
The action performed by the Switch / Trigger;The action performed by this reference number is defined in a separate data-block. For information on this see:
Wall SwitchSockets (Gem / Crystal Holes)
Where wall data is defined as a 'socket', for teleportation gems, or crystals, there are two parameters available.
Bit 2 of the (AB) byte will determine if the socket is 'full' or 'empty' - the 'on' value determines the socket as being empty.
Bits 3-5 of (AB) assigns the socket to a particular type / colour. These bits can be converted to a number, from 0-7, which will determine this as follows;
0 = Serpent Crystal
1 = Chaos Crystal
2 = Dragon Crystal
3 = Moon Crystal
4 = Grey *
5 = Bluish
6 = Brown *
7 = Tan
It should be noted that the Grey and Brown gems do not appear in the game, and do not appear to operate.
The Bluish and Tan gems act as teleports, and for each tower use two location references (x/y coordinates) between which to jump. There is no 'floor' coordinate specified, and as such teleports will operate across the same floor only.
The locations specified for each pair of teleportation gems in each tower is defined in a separate data-block. For information on this see:
Teleportation Gems