Prev: 34122 Up: Map Next: 34484
34265: Set Magic Knight's available action flags and validate I.D. card if appropriate
Used by the routines at 26997, 28101, 29330 and 30001.
Input
IY 23610
34265 LD HL,1 Reset all available in-game menu command flags except command-a-character-enabled which is always set...
34268 LD (23698),HL ...
34271 LD A,(25024) If Magic Knight's magic level is zero...
34274 OR A ...
34275 JR Z,34281 ...then skip ahead to 34281
34277 SET 5,(IY+88) Set cast-a-spell-enabled menu command flag
34281 LD A,(23701) If Magic Knight's current room is not 1 (The Bridge, USS Pisces 1)...
34284 CP 1 ...
34286 JR NZ,34320 ...then skip ahead to 34320
34288 LD A,1 If Magic Knight is wearing the Cloak of Invisibility (01)...
34290 CALL 33640 ...
34293 JR Z,34320 ...then skip ahead to 34320
34295 LD A,3 If Magic Knight is not wearing the Valid I.D. Card (03)...
34297 CALL 33640 ...
34300 JR NZ,34320 ...then skip ahead to 34320
34302 SET 2,(IY+89) Set communicate-enabled menu command flag
34306 LD HL,25174 If Gordon is not carrying the Star Map...
34309 LD A,6 ...
34311 CALL 33648 ...
34314 JR NZ,34320 ...then skip ahead to 34320
34316 SET 0,(IY+89) Set move-starship-enabled menu command flag
34320 LD A,(23701) Load E with Magic Knight's current room...
34323 LD E,A ...
34324 LD BC,4 Load BC with 4 (as each transporter pad location entry is composed of 4 bytes)
34327 LD HL,32577 Point HL at table of transporter pad locations (32577)
34330 ADD HL,BC Advance HL by four bytes to next entry
34331 LD A,(HL) If first byte (room number) is 255 (end marker)...
34332 CP 255 ...
34334 JR Z,34363 ...then skip ahead to 34363 (end of data reached)
34336 CP E If current transporter pad's room is not in the same room as Magic Knight...
34337 JR NZ,34330 ...then loop back to 34330 for next transporter pad
34339 INC HL Advance HL to pad's left x-coordinate
34340 LD A,(25156) If Magic Knight's current x-coordinate (pixels) is less than this...
34343 CP (HL) ...
34344 JP C,34363 ...then skip ahead to 34363 (Magic Knight not on a transporter pad)
34347 INC HL Advance HL to pad's right x-coordinate
34348 CP (HL) If Magic Knight's current x-coordinate (pixels) is not less than this...
34349 JP NC,34363 ...then skip ahead to 34363 (Magic Knight not on a transporter pad)
34352 INC HL Advance HL to pad's y-coordinate
34353 LD A,(25157) If Magic Knight's current y-coordinate (pixels) is not the same as this...
34356 CP (HL) ...
34357 JR NZ,34363 ...then skip ahead to 34363 (Magic Knight not on a transporter pad)
34359 SET 1,(IY+89) Set use-transporter-enabled menu command flag
34363 XOR A Load C with weights / flags of all Magic Knight's carried objects, OR-ed together...
34364 CALL 34484 ...
34367 BIT 5,C ...and if can-be-read flag is not set for any of the objects...
34369 JR Z,34375 ...then skip ahead to 34375
34371 SET 3,(IY+88) Set read-something-enabled menu command flag
34375 LD A,1 Load C with flags (2) of all Magic Knight's carried objects, OR-ed together...
34377 CALL 34484 ...
34380 BIT 3,C ...and if can-be-worn flag is set for at least one of the objects...
34382 JR NZ,34390 ...then skip ahead to 34390
34384 LD A,(25169) If Magic Knight's first inventory slot (wearing) is empty...
34387 OR A ...
34388 JR Z,34394 ...then skip ahead to 34394
34390 SET 7,(IY+88) Set wear/unwear-object-enabled menu command flag
34394 LD A,2 If Magic Knight is not carrying the Blank I.D. Card (02)...
34396 CALL 33645 ...
34399 JR NZ,34473 ...then skip ahead to 34473
34401 LD A,10 If Magic Knight is not carrying the Pot of Glue (10)...
34403 CALL 33645 ...
34406 JR NZ,34473 ...then skip ahead to 34473
34408 LD A,5 If Magic Knight is not carrying the Photograph (of Magic Knight) (05)...
34410 CALL 33645 ...
34413 JR NZ,34473 ...then skip ahead to 34473
34415 LD C,5 Remove Photograph (of Magic Knight) from Magic Knight's current inventory (carrying)...
34417 LD B,5 ...
34419 LD HL,25164 ...
34422 PUSH HL ...storing HL (pointer to start of Magic Knight's current inventory)...
34423 CALL 36254 ...
34426 POP HL ...and restoring HL (pointer to start of Magic Knight's current inventory)
34427 PUSH HL Store HL (pointer to start of Magic Knight's current inventory)
34428 LD C,2 Remove Blank I.D. Card from Magic Knight's current inventory...
34430 LD B,5 ...
34432 CALL 36254 ...
34435 POP HL Restore HL (pointer to start of Magic Knight's current inventory)
34436 LD C,3 Load Valid I.D. Card into the first empty inventory slot of Magic Knight...
34438 LD B,5 ...
34440 CALL 33516 ...
34443 LD A,(23451) Set I.D.-card-validated flag...
34446 OR 16 ...
34448 LD (23451),A ...
34451 LD HL,45771 Point HL at "YOU HAVE HAD AN ACCIDENT WITH THE GLUE..." text
34454 LD DE,37227 Adjust height of window 17 to accommodate text...
34457 CALL 33774 ...
34460 PUSH HL Store HL (pointer to start of text)
34461 LD A,17 Draw window 17...
34463 CALL 34982 ...as a menu window (bug)
34466 POP HL Restore HL (pointer to start of text)
34467 CALL 34762 Print text to screen
34470 CALL 55138 Display "PRESS FIRE TO CONTINUE" window and wait for fire to be pressed
34473 LD A,(23701) If Magic Knight's current room is not 24 (The Control Column, USS Pisces, 6A)...
34476 CP 24 ...
34478 RET NZ ...then return
34479 SET 1,(IY+88) Set launch-tyme-machine-enabled menu command flag
34483 RET Return
Prev: 34122 Up: Map Next: 34484