Routines |
Prev: 30170 | Up: Map | Next: 30439 |
30222 | CALL 38075 | Play upward scale sound | ||
30225 | CALL 37654 | Display / update command summary window at bottom of screen | ||
30228 | LD DE,45305 | Point DE at "PICK UP" text... | ||
30231 | CALL 38693 | ...and print in command summary window at bottom of screen | ||
30234 | LD IX,25464 | Point IX at objects' current positions table | ||
30238 | LD BC,3200 | Load B with 12 and C with 128 (bug) | ||
30241 | LD A,(65529) | Load A with Magic Knight's current room | ||
30244 | CP (IX+0) | If current object's room is not the same as Magic Knight's then... | ||
30247 | JR NZ,30250 | ...skip ahead to 30250 | ||
30249 | INC C | Increase C (count of objects in Magic Knight's current room) | ||
30250 | INC IX | Advance IX to next object's position... | ||
30252 | INC IX | ... | ||
30254 | INC IX | ... | ||
30256 | DJNZ 30241 | Decrease B and loop back for next object | ||
30258 | LD A,C | Copy total number of objects into A... | ||
30259 | OR A | ...and if this value is zero... [can't actually happen because of bug at 30238] | ||
30260 | JP Z,34436 | ...display "THERE IS NOTHING IN THIS ROOM" message and return to game | ||
30263 | LD IX,25464 | Point IX at objects' current positions table | ||
30267 | LD A,(65529) | Load A with Magic Knight's current room... | ||
30270 | LD C,A | ...and copy into C | ||
30271 | CALL 34385 | Load Magic Knight's coordinates (in characters) into DE | ||
30274 | XOR A | Set A to zero | ||
30275 | EX AF,AF' | Switch A register | ||
30276 | LD B,50 | Load B with 50 (as there are 50 objects) | ||
30278 | LD A,C | Load Magic Knight's current room into A | ||
30279 | CP (IX+0) | If room of current object is not the same as Magic Knight's current room then... | ||
30282 | JR NZ,30327 | ...skip ahead to 30327 (advance to next object) | ||
30284 | LD A,D | Copy Magic Knight's y-coordinate into A | ||
30285 | CP (IX+2) | If y-coordinate of object is not the same as Magic Knight's y-coordinate then... | ||
30288 | JR NZ,30327 | ...skip ahead to 30327 (advance to next object) | ||
30290 | LD A,E | Load Magic Knight's x-coordinate into A | ||
30291 | DEC A | Decrease x-coordinate by two... | ||
30292 | DEC A | ... | ||
30293 | CP (IX+1) | If x-coordinate of object is the same as Magic Knight's x-coordinate minus two... | ||
30296 | JP Z,30341 | ...skip ahead to 30341 | ||
30299 | INC A | Increase x-coordinate by one | ||
30300 | CP (IX+1) | If x-coordinate of object is the same as Magic Knight's x-coordinate minus one then... | ||
30303 | JP Z,30341 | ...skip ahead to 30341 | ||
30306 | INC A | Increase x-coordinate by one | ||
30307 | CP (IX+1) | If x-coordinate of object is the same as Magic Knight's x-coordinate then... | ||
30310 | JP Z,30341 | ...skip ahead to 30341 | ||
30313 | INC A | Increase x-coordinate by one | ||
30314 | CP (IX+1) | If x-coordinate of object is the same as Magic Knight's x-coordinate plus one then... | ||
30317 | JP Z,30341 | ...skip ahead to 30341 | ||
30320 | INC A | Increase x-coordinate by one | ||
30321 | CP (IX+1) | If x-coordinate of object is the same as Magic Knight's x-coordinate plus two then... | ||
30324 | JP Z,30341 | ...skip ahead to 30341 | ||
30327 | INC IX | Advance IX by three bytes to move to next object... | ||
30329 | INC IX | ... | ||
30331 | INC IX | ... | ||
30333 | EX AF,AF' | Switch A register back (so now contains the index of the object to test next) | ||
30334 | INC A | Increase A (index of current object to test) | ||
30335 | EX AF,AF' | Switch A register | ||
30336 | DJNZ 30278 | Loop back to 30278 for next object | ||
30338 | JP 34430 | Display "THERE IS NOTHING NEAR ENOUGH" message and return to game | ||
An object has been found within Magic Knight's reach so make this the Current Object
|
||||
30341 | EX AF,AF' | Switch A register (so now contains index of first object that is within Magic Knight's reach) | ||
30342 | LD (30467),A | Load index of this object into instruction at 30466 (i.e. set as Current Object) | ||
30345 | LD HL,41236 | Point HL at table of object names | ||
30348 | LD B,A | Load B with index of object that is within Magic Knight's reach | ||
30349 | CALL 34842 | Advance HL to B-th entry in object names table | ||
30352 | EX DE,HL | Swap DE and HL (so DE now contains pointer to name of Current Object) | ||
30353 | CALL 38693 | ...and print in command summary window at bottom of screen | ||
30356 | CALL 38725 | Display execute / reject command window and return if execute chosen, else exit | ||
30359 | LD A,(30467) | Load A with index of Current Object... | ||
30362 | CP 34 | ...and if it is not object 34 (Strange Liquid) then... | ||
30364 | JR NZ,30369 | ...jump to 30369 | ||
30366 | JP 34592 | Display "THE LIQUID IS STUCK TO THE FLOOR (IT'S A VERY THICK LIQUID)" window and exit | ||
30369 | LD HL,25399 | Load A with object at Magic Knight's fifth inventory slot... | ||
30372 | LD A,(HL) | ... | ||
30373 | OR A | If this is not zero (i.e. Magic Knight's hands are full)... | ||
30374 | JP NZ,34418 | ...then display "YOUR HANDS ARE FULL" window and return to game | ||
30377 | CALL 34202 | Check whether object has a weight greater than Magic Knight's surplus strength... | ||
30380 | JP P,34424 | ...and if it does, display "THAT OBJECT IS TOO HEAVY" message and return to game | ||
30383 | LD A,(30467) | Load A with index of Current Object... | ||
30386 | LD C,A | ...and into C | ||
30387 | LD B,5 | Load B with 5 (as 5 inventory slots) | ||
30389 | LD HL,25395 | Point HL at start of Magic Knight's inventory | ||
30392 | CALL 34151 | Load object in C into Magic Knight's first empty inventory slot | ||
30395 | LD A,(30467) | Load A with index of Current Object... | ||
30398 | LD C,A | ...and into C | ||
30399 | ADD A,A | Multiply index by three in A... | ||
30400 | ADD A,C | ... | ||
30401 | LD B,0 | Load B with zero | ||
30403 | LD C,A | Load three times object index into C (as position data is three bytes wide) | ||
30404 | LD HL,25464 | Point HL at objects' current positions table | ||
30407 | ADD HL,BC | Add BC as offset to point HL at position data for Current Object | ||
30408 | LD (HL),99 | Set object's room to 99 | ||
30410 | LD IX,25395 | Point IX at Magic Knight's current inventory | ||
30414 | LD B,5 | Load B with 5 (as five inventory slots) | ||
30416 | LD HL,45285 | Point HL at "YOU ARE NOW CARRYING" text | ||
30419 | CALL 34907 | Display "Magic Knight's current inventory" window as an information window | ||
30422 | CALL 38749 | Display "PRESS SPACE OR FIRE TO CONTINUE" window and wait for space / fire | ||
30425 | CALL 35495 | Set Magic Knight's available action flags | ||
30428 | LD A,(23377) | Reset Gimbal-white-out-safe flag... | ||
30431 | AND 254 | ... | ||
30433 | LD (23377),A | ... | ||
30436 | JP 27168 | Redraw current room and return to game |
Prev: 30170 | Up: Map | Next: 30439 |