Prev: 32194 Up: Map Next: 32390
32258: Process and execute command to read an object
Used by the routines at 27176 and 31153.
32258 LD A,(65532) If read-enabled flag is not set...
32261 BIT 3,A ...
32263 JP Z,27189 ...then jump into main game loop (process keyboard input and move Magic Knight, enter menus or execute other command)
32266 CALL 38075 Play upward scale sound
32269 LD IX,25395 Point IX at start of Magic Knight's inventory
32273 LD B,5 Load B with 5 (as there are five inventory slots)
32275 LD HL,47288 Point HL at "READ WHICH OBJECT?" text
32278 LD DE,47295 Point DE at "READ" text
32281 CALL 34914 Show list of objects (window or menu) and handle selection if a menu
32284 LD HL,25395 Point HL at Magic Knight's inventory
32287 CALL 34864 Point DE at name of a selected object in object names table and print in command summary window
32290 CALL 38725 Display execute / reject command window and return if execute chosen, else exit
32293 LD A,(30467) Load A with index of Current Object
32296 CP 41 If Current Object is 41 (Instruction Book)...
32298 JP Z,32384 ...then display instructions
32301 CP 1 If Current Object is not 1 (Ancient Scroll)...
32303 JR NZ,32326 ...then skip ahead to 32326
32305 LD A,(23467) If the Engraved Candle is not lit...
32308 BIT 1,A ...
32310 JP Z,32361 ...then skip ahead to 32361 (display normal read-text)
32313 LD A,33 Load A with index of object 33 (Engraved Candle)
32315 CALL 34256 Check whether Magic Knight is carrying the Engraved Candle...
32318 JP NZ,32361 ...and if not, skip to 32361 (display normal read-text)
32321 LD B,8 Set text index to 8 (full Ancient Scroll text)
32323 JP 32378 Point HL at this text, then return
32326 CP 33 If Current Object is not 33 (Engraved Candle)...
32328 JP NZ,32344 ...then skip ahead to 32344
32331 LD A,14 Load A with index of object 14 (Broken Glass)
32333 CALL 34256 Check whether Magic Knight is carrying the Broken Glass...
32336 JP NZ,32361 ...and if not, skip to 32361
32339 LD B,9 Set text index to 9 (Engraved Candle text)
32341 JP 32378 Point HL at this text, then return
32344 CP 13 If Current Object is not 13 (Runestone)...
32346 JR NZ,32361 ...then skip ahead to 32361
32348 LD A,15 Load A with index of object 15 (Book of Runes)
32350 CALL 34256 Check whether Magic Knight is carrying the Book of Runes...
32353 JP NZ,32361 ...and if not, skip to 32361
32356 LD B,10 Set text index to 10 (full Runestone text)
32358 JP 32378 Point HL at this text, then return
32361 LD A,(30467) Load A with index of Current Object
32364 LD E,2 Load E with 2 (read text)
32366 CALL 34160 Point HL to read text property of object A
32369 BIT 7,(HL) If bit 7 is reset (i.e. value at HL is less than 128 so the object can't be read)...
32371 JP Z,34576 ...then jump to 34576 (display "THERE IS NO WRITING FOR ME TO READ" window and return to game)
32374 LD A,(HL) Load value into B...
32375 AND 127 ...resetting bit 7 to leave index of text required...
32377 LD B,A ...
32378 CALL 34854 Advance HL to B-th entry in list of readable objects' texts at 47322 then return
32381 JP 34799 Display window showing read-text window
32384 CALL 26788 Display instructions
32387 JP 30428 Reset Gimbal-white-out-safe flag, redraw current room and return to main game loop
Prev: 32194 Up: Map Next: 32390