home *** CD-ROM | disk | FTP | other *** search
/ RISC DISC 2 / RISC_DISC_2.iso / pd_share / games / aswap / WolfyMaps
Encoding:
Text File  |  1995-07-05  |  8.5 KB  |  271 lines

  1. Wolfenstein 3D Map Formats
  2. --------------------------
  3.  
  4. This document contains the formats of the MAPHEAD and GAMEMAPS file, which
  5. together define the maps for Wolfenstein 3D.  The file format is valid for
  6. versions of PC Wolfenstein 3D greater than V1.4 and for V1.0 of the RISC OS
  7. version.
  8.  
  9. MAPHEAD:
  10.  
  11. +0 - &CD
  12. +1 - &AB
  13. +2 - file pointer (in GAMEMAPS) of map descriptor for level 1
  14. +6 - file pointer of map descriptor for level 2
  15. +2 + 4*(n-1) - file pointer of map descriptor for level 3
  16.  
  17. So you extract the word from 2 + 4n where n is from 0 to 59 and that is an
  18. offset into the GAMEMAPS file from which you must load 18 bytes.  (Note that
  19. if the value is 0 this means that the level is not available.)  These 18
  20. bytes (the map descriptor) are:
  21.  
  22. +0 - File pointer to map plane 1 (in GAMEMAPS)
  23. +4 - File pointer to map plane 2
  24. +8 - File pointer to map plane 3
  25. +12 - Length of map plane 1 data
  26. +14 - Length of map plane 2 data
  27. +16 - Length of map plane 3 data
  28.  
  29. This requires a little explanation - each map plane contains 64x64 cells (the
  30. size of the map).  Map plane 1 contains the walls, floors and doors.  Map
  31. plane 2 contains the objects, actors, and various markers.  Map plane 3 is
  32. always filled with 0s.  Each cell is two bytes, so each map plane is 8K long
  33. when uncompressed.  Sadly, they are compressed, so you'll need to decompress
  34. them.  In Appendix I is an assembler-language code fragment to decompress a
  35. lump.      
  36.                                       
  37. Now you have 3 decompressed lumps you can look at and edit them.  As mentioned
  38. earlier, the first plane contains the walls, doors and floors.  Each value is
  39. two bytes, but for walls these are limited to:
  40.  
  41. 0 = nothingness - should never occur
  42. 1 to 49 = wall type n
  43. &5A/&5B = vertical/horizontal door
  44. &5C/&5D = vertical/horizontal door needing yellow key
  45. &5E/&5F = vertical/horizontal door needing blue key
  46. &64/&65 = elevator door
  47. &6A     = floor type 0
  48. &6B onwards = floor type n - &6A
  49.  
  50. Wall types each have 2 bitmaps in the ASWAP file.  The first two graphics in
  51. the ASWAP file are for wall #1.  The first frame is brighter than the second
  52. frame; this is used to express a little subtle lighting by plotting one frame
  53. on N/S wall faces and the other one on E/W faces.
  54.  
  55. Floor types go from 1 to 40 for normal floors and 0 for a 'silent' floor.  If
  56. a soldier starts on a 'silent' floor tile then he will not hear anything, and
  57. will only 'wake up' when he actually sees the player.  Experiment!
  58.  
  59. The object types use 9 bits of the value.  The other 7 bits must be 0.  (While
  60. I'm on, the top 8 bits of each wall value must be 0).
  61.  
  62. The mapping goes as follows: 
  63.  
  64. &00 : no object
  65. &01 - &12 : undefined, DO NOT USE
  66. &13 : player start, facing N
  67. &14 : player start, facing E
  68. &15 : player start, facing S
  69. &16 : player start, facing W
  70. &17 : Object #2
  71. &18 : Object #3
  72. &19 - &46 : Object #(n-&15)
  73. &47 - &59 : undefined, DO NOT USE
  74. &5A - &61 : Turn tiles 0 to 7
  75. &62 : Secret Door
  76. &63 : End of game
  77. &64 - &6B : undefined, DO NOT USE
  78.  
  79. &6C onwards are actors, which I will explain in a minute.  Firstly, though,
  80. objects #2 to #49 are the static objects.  Some you can walk through and some
  81. you can't.  The graphics are in the ASWAP file.  Object #0 is actually the
  82. "DEMO" sign and object #1 is the "DEATHCAM" sign - these are not true objects.
  83. The first object which can appear on a map is Object #2 - the pool of water.
  84.  
  85. The turn tiles affect actors when they are in wander mode.  Each tile forces
  86. a turn in one of the eight directions.  Again, experiment to find out which!
  87. The secret door tile is placed on the map plane in the same position as the
  88. wall in the wall plane, and makes that door secret.  The computer
  89. automagically
  90. works out in which direction the wall can be pushed.
  91. The end of game tile is only used at the end of levels 9 and 49.  These are
  92. the
  93. levels where the camera follows BJ's running jump instead of getting a
  94. DeathCam
  95. when you win.  Once the player hits the tile, he runs NORTH.  Look at levels 9
  96. and 49 to get the idea.
  97.  
  98. Actor concepts:
  99.  
  100. Actors begin either standing or walking (some are always walking).  An actor
  101. will detect your presence if you shoot when he is in earshot or if he sees
  102. you.
  103. Once he detects you it's you or him.  The standing actors just stand there,
  104. and
  105. if they are standing on a 'silent' tile then they won't hear your gun.  The
  106. walking actors walk forwards until they hit a wall or a turn tile.  Look at
  107. the
  108. maps to see how this allows you to plan complex patrols for the guards to
  109. follow.  Walking or chasing actors will open doors (including locked doors)
  110. whenever they need to.
  111.  
  112. Each actor has an initial direction (N,S,E or W) which he is facing and (if
  113. appropriate) walking.  They also have a difficulty level of 1,3 or 4.  1 means
  114. the actor appears at all difficulty levels.  3 means only on level 3 or
  115. higher,
  116. and 4 means only on 'I am death incarnate'.  The actor values on the map are
  117. grouped in 4s.  If the list below has a * to the left of the value, then
  118.  
  119. value + 0 is the item facing North
  120. value + 1 is the item facing East
  121. value + 2 is the item facing South
  122. value + 3 is the item facing West
  123.  
  124. * &6C - soldier, standing, level 1
  125. * &70 - soldier, walking, level 1
  126. * &74 - 'spion', standing, level 1
  127. * &78 - 'spion', walking, level 1
  128. * &7E - SS, standing, level 1
  129. * &82 - SS, walking, level 1
  130. * &86 - dog, standing, level 1 (this shouldn't be used)
  131. * &8A - dog, walking, level 1
  132.  
  133. Add &24 for the level 3 actors and &48 for the level 4 actors.
  134.  
  135. * &D8 - zombie, standing, level 1
  136. * &DC - zombie, walking, level 1
  137.  
  138. Add &12 for the level 3 actors and &24 for the level 4 actors.
  139.  
  140. The rest are bosses and special monsters, like the Pac-men.  These don't
  141. 'face'
  142. any direction.
  143.  
  144. &7C - the dead guard at the start of level 1
  145. &A0 - Ghost Hitler (episode 3)
  146. &B2 - Mecha-Hitler (episode 3)
  147. &B3 - Fat bastard at the end of episode 4
  148. &C4 - Dr Schabbs (the guy with the needles in episode 2)
  149. &C5 - Gretel Giftmacher, the blonde non-temptress in episode 5
  150. &D6 - Mr "Guten Tag" himself, official name Hans (episode 1)
  151. &D7 - Giftmacher, the ultimate challenge (episode 6)
  152. &E0,&E1,&E2,&E3 - Inky, Blinky, Pinky and Clyde
  153.  
  154. I've been pretty vague in some places.  I want to encourage you to experiment,
  155. all the nitty gritty is here and you need broad outlines.  The Wolfenstein 3D
  156. FAQ should help - it has tons and tons of stuff about screen designing in it.
  157.  
  158. Appendix I
  159. ----------
  160.  
  161. The following code is pretty raw, and is actually pulled straight from Arc
  162. Wolfenstein.  Exciting, huh?  The three words at the top of the program should
  163. be set up before the routine is called.  I'm afraid that recompression is left
  164. as an exercise to the reader.
  165.  
  166. .source
  167. EQUD 0                         ; This is the address of the compressed data
  168. .buffer
  169. EQUD 0                         ; This must point to a 8K buffer
  170. .target
  171. EQUD 0                         ; And this must point to the 8K output buffer
  172.    
  173. .decompress_lump
  174. STMFD R13!,{PC}
  175. LDR R0,source                  ; set the source address
  176. LDR R1,buffer                  ; set the address of an 8K buffer
  177. BL a7a8                        ; uncompress - first stage
  178. LDR R0,buffer                  ; source = first-stage uncompressed data
  179. LDR R1,target                  ; target address
  180. BL mexpand                     ; uncompress - second stage
  181. LDMFD R13!,{PC}                ; done !
  182. .a7a8
  183. MOV R2,R1               ; dest start
  184. LDRB R8,[R0],#1
  185. LDRB R9,[R0],#1
  186. ORR R8,R8,R9,ASL #8     ; target data length (first half-word)
  187. ADD R8,R8,R2            ; end of destination buffer
  188.  
  189. .looprep1
  190. LDRB R4,[R0],#1           ; lo
  191. LDRB R5,[R0],#1           ; hi
  192. CMP R5,#&A7              
  193. BNE nota7               
  194. MOVS R4,R4,ASL #1         ; length of run
  195. BEQ special             
  196. LDRB R6,[R0],#1           ; goback1
  197. MOV R6,R6,ASL #1
  198. .loopa7
  199. LDRB R7,[R1,-R6]
  200. STRB R7,[R1],#1
  201. SUBS R4,R4,#1
  202. BNE loopa7
  203. B endif
  204. .nota7
  205. CMP R5,#&A8
  206. BNE nota8
  207. MOVS R4,R4,ASL #1         ; length of run
  208. BEQ special
  209. LDRB R6,[R0],#1
  210. LDRB R7,[R0],#1
  211. ORR R6,R6,R7,ASL #8     ; goback2
  212. ADD R6,R2,R6,ASL #1
  213. .loopa8
  214. LDRB R7,[R6],#1
  215. STRB R7,[R1],#1
  216. SUBS R4,R4,#1
  217. BNE loopa8
  218. B endif
  219. .nota8
  220. STRB R4,[R1],#1
  221. STRB R5,[R1],#1
  222. .endif
  223. CMP R1,R8
  224. BLO looprep1
  225. MOV PC,R14
  226. .special
  227. STRB R5,[R1],#1
  228. LDRB R4,[R0],#1
  229. STRB R4,[R1],#1
  230. B endif
  231.  
  232. .specialword EQUD &ABCD
  233. .mexpand
  234. LDRB R10,specialword
  235. LDRB R11,specialword+1
  236.  
  237. LDRB R4,[R0],#1
  238. LDRB R5,[R0],#1
  239. ORR R4,R4,R5,ASL #8
  240. ADD R8,R4,R1             ; end of data target
  241.  
  242. .loopexp
  243.  
  244. LDRB R4,[R0],#1
  245. LDRB R5,[R0],#1
  246. CMP R5,R11:CMPEQ R4,R10:BNE notabcd
  247. LDRB R6,[R0],#1
  248. LDRB R7,[R0],#1
  249. ORR R6,R6,R7,ASL #8        ; count
  250. LDRB R4,[R0],#1
  251. LDRB R5,[R0],#1
  252. .loopabcd
  253. STRB R4,[R1],#1
  254. STRB R5,[R1],#1
  255. SUBS R6,R6,#1
  256. BNE loopabcd
  257. B endifexp
  258. .notabcd
  259. STRB R4,[R1],#1
  260. STRB R5,[R1],#1
  261. .endifexp
  262. CMP R1,R8
  263. BLO loopexp
  264. MOV PC,R14
  265.  
  266.  
  267.  
  268.  
  269.  
  270.  
  271.