; ; BNF-like description of Doom RPG .bsp files ; ; By Simon Howard ; Verbatim copying is permitted provided this notice is kept attached. ; ; All integer values are little endian unless otherwise specified. ; This is what a Doom RPG 1.0.20 .bsp file looks like: :=
; This is what a Doom RPG 1.0.92 .bsp file looks like (string table is in ; a separate file) : :=
; Level name := * 16 ; level name, nul terminated ascii ; File header, everything currently unknown
:= ; ; ; ; ; ; ; This is the bsp tree. x1, y1-x2,y2 are the bounding boxes of each node ; nodetype is one of the following: ; ; 0 - leaf node ; 1 - split with horizontal line ; 2 - split with vertical line ; ; The other values then depend on this type: ; ; * If nodetype is 0, splitpos is also 0 (ignored?). ; arg1 is the number of lines inside this node. ; arg2 is the index of the first linedef in the lines for this range. ; * If nodetype is 1, the node divides into two subnodes. ; splitpos is the y value of the line to divide the node. ; arg1 and arg2 are the indexes of the subnodes. ; * If nodetype is 2, the node divides into two subnodes. ; splitpos is the x value of the line to divide the node. ; arg1 and arg2 are the indexes of the subnodes. := ; [numnodes] := ; ; ; ; ; ; ; ; ; Linedefs are walls, doors, etc. ; ; Lines run from (startx, starty)-(endx, endy) ; ; The "shift" flags are used to offset some walls slightly, ; eg to inset doors into the wall and give hints to the ; locations of secret doors ; ; Flags: ; Bit 3 - Shift East/South (depending on bit 8/9) ; Bit 4 - Shift West/North (depending on bit 8/9) ; Bit 5 - Secret (not displayed on map) ; Bit 8 - Apply vertical shift ; Bit 9 - Apply horizontal shift ; Bit 10 - Computer controlled doors? ; Bit 11 - Applied to south-facing walls ; Bit 12 - Applied to north-facing walls ; Bit 13 - Applied to west-facing walls ; Bit 14 - Applied to east-facing walls ; Bit 15 - Set sometimes, but purpose unknown ; ; Bits 0-2 seem to be line type: ; 0 - Normal wall ; 5 - Door := ; [numlinedefs] := ; ; ; ; ; ; ; Things are objects in the world: monsters, powerups, etc. := ; [numthings] := ; ; ; ; Section 4 - list of interaction areas ; ; This is related to interactions with things - doors, computer ; consoles, characters, etc. Adding one of these places a ; location on the map that the player can interact with. ; ; Low bits define the location of the square where interaction ; takes place. ; ; Bits 0-4: X position of square ; Bits 5-9: Y position of square ; Bits 10-18: Start index into section 5 ; Bits 19-24: Number of section 5 fields to use ; Bits 25-28: Unknown 1 ; Bits 29-31: Unknown 2 ; := ; [numinteractions] := ; Interaction script commands ; ; This is indexed by the interactions section. Each interaction has ; one or more commands that it executes as a script. ; ; There are different commands: ; ; 1 ; 2 ; 3 ; 4 ; 5 - "Pain!" ; 6,15,16,17 ; 7 ; 8,26 - Display message? arg1=string index in string table ; 9 ; 10 ; 11, 19, 20 - Somehow changes the interaction table (Unknown 1) ; 12 ; 13 ; 14 ; 18 ; 21 ; 22 ; 23 ; 24 ; 25 ; 26 ; 27 ; 28 ; 29 ; 30 ; 31 ; 32 ; 33 ; 34 ; 35 ; 36 ; 37 ; 38 ; 39 ; 40 ; 41 - Related to keyed doors: Arg1 specifies door: ; 0 = Green ; 1 = Yellow ; 2 = Blue ; 3 = Red := ; [numcommands] := ; ; ; ; Table of strings used for interaction with people/computers/etc := ; [numstrings] := ; [stringlength] ; ascii data ; The blockmap is an array of 1024 2-bit values, packed together into ; a 256 byte array. Each bit corresponds to a square in the 32x32 ; game world. Values: ; ; 0 = free space ; 1 = wall ; 2 = ? ; 3 = secret := [256] := ; bitshift up by 3 to get the ; in-game value