------------------------------------------------- DNGx: ------------------------------------------------- These 8 files contain maps, scripts and messages for the dungeons the party will venture in. They all have the same size of 6140 bytes and are loaded at address 0x802/2050. All the dungeons are 33x38 cells (1254 bytes) all tiles use hard-coded values: 0x00/0 Wall 0x01/1 Secret wall (just appear like a wall on screen) [0x02/2..0x06/6] Trap 0x07/7 Apparently not used [0x08/8..0x11/17] Possible random encounter selected like this; Monster = TileValue - 8 + int(rnd(1) * 3) + 12 * DungeonLvl That DungeonLvl value is located at offset 1255 [0x12/18..0x7F/127] Display special message [0x80/128..0x89/137] Random encounter selected like this: Monster = peek(2050 + 1128 + TileValue) Which is basically nothing but filling the variable with garbage data (and should be modified) 0x8A/138 Apparently not used [0x8B/139..0xB8/184] Nothing special 0xB9/185 Horizontal Door (opened) [0xBA/186..0xC5/197] Horizontal door (closed) + random encounter A test against characters listen skills is performed and a warning message is issued in case of success otherwise a random encounter occurs, monsters are calculated like this: Monsters = 12 * DungeonLvl + DoorValue - 2 (DoorValue - 2 = [0..11]) Monsters are always in a surprise state but party one is calculated like this: State = 1 - (rnd(1) > .5) * (SkillPass > -1) SkillPass is the result of the test performed before (test failure was = -1) 0xC6/198 Horizontal door (locked) A test against picklock skill is performed. Notice that the door will become unlockable in case of test failure (which i think was a design error in the game) 0xC7/199 Horizontal door (unlockable) 0xC8/200 Vertical door (opened) [0xC9/201..0xD4/212] Vertical door (closed) + random encounter 0xD5/213 Horizontal door (locked) 0xD6/214 Vertical door (unlockable) [0xD7/215..0xD9/217] Stairs (exit) >= 0xDA/218 Stairs from level (number - 0xD9) to level (number - 0xD8) >= 0xDD/221 Run special script Exits: At offsets 1266, 1269 & 1272 are located the data for the 3 possible exits from a dungeon, each of them contain 3 bytes: 0 1.b: Index of the OUTT file to load 1 1.b: X coordinates (local to the map) 2 1.b: Y coordinates (local to the map) Special messages: Messages table is located at offset 1740 each message can be 40 bytes. The message index is calculated like this: Idx = 2050 + 1700 + 40 * (TileValue - 17) So 1st message is located at offset 1740. Message #105 is a special one triggered by the DIVINE I spell. Scripts: Special tiles trigger scripts which infos are located inside the dungeon files, script location is calculated like this (starting at index 1): Location = 2050 + 1270 + 5 * (TileValue - 220) They consist of 5 bytes data: (i'm not sure yet but at least it's multiple of 5) 1st byte: If 255 then the script is empty If bit 7 = 1 then this is a one-shot script (won't be triggered anymore if dungeon is saved) All other bits contain the index for a message (calculated like special messages) 2nd byte: If >= 2 then the message above was asking the player to make a choice (byte = number of possible choices) remaining bytes (from 3 to X): A value is set depending on the choice made by the player. The choice number value is used as an index in the commands table: Commands table: The table is located at offset 1450 + (choice number * 2) 1st byte: if bit 7 = 0 then this is the last command in the chain if bit 6 = 1 then this is a one-shot command all other bits are used as command value for a jump table (the 3 other bytes are stored into Data1/Data2/Data3) There's room for 63 commands but it looks like only 23 are used: Damages to each character is calculated like this: damage amount = rnd(1) * Data1 * 10 / character's luck 1: print "SMOKE FILLS THE AIR" & do some damage to party 2: do some damage to party 3: print "A SPELL IS CAST" & do some damage to party 4: do some damage to party 5: trigger a selected encounter (Data1) 6: find a selected item (Data1) (handling works the same way as in wilderness) 7: print "THE PARTY GETS SOME GOLD" & add some gold (Data1) 8: add some gold silently (Data1) 9: "SOME OF YOUR GOLD IS TAKEN" 10: remove some gold silently (Data1) 11: display a given message (Data1) 12: print "THE PARTY IS MOVED" and teleport to Data1/Data2 13: teleport to Data1/Data2 14: print "YOU HEAR A NOISE IN THE DISTANCE" and modify the dungeon at Data1/Data2 with Data3 15: modify the dungeon at Data1/Data2 with Data3 16: trigger an hidden trap (can't be disarmed) 17: print "MONSTERS APPEAR" and trigger a surprise attack from given monsters (Data1) 18: change any data from any living character in the party (Data1 = data index, Data2 = new value) 19: goto to a given entry (Data3) of the commands table and return to the previous position if the characters attribute (Data1) is lower than Data2 (basically it's used to check if any of the character is skilled enough in a characteristic to reach that tile or to be repelled). 20: go to a given entry (Data1) of the commands table 21: go to a given entry (Data2) of the commands table if a random percentage is lower than Data1 (that is if Data1 = 20 then there's 20% percent chance to trigger the command) 22: change the script associated with the tile (Calculation is: Data1 + 220 so base is 1) 23: print "PRESS RETURN" and continue script sequence