![]() |
Routines |
| Prev: 55219 | Up: Map | Next: 55349 |
|
Used by the routine at 54996.
|
||||||||
| 55233 | BIT 2,(IY+65) | If characters-can't-move flag is set... | ||||||
| 55237 | RET NZ | ...then return without moving characters | ||||||
| 55238 | LD A,(55218) | Load "character to move" index into A | ||||||
| 55241 | INC A | Increase by one, but cap at 31 and reset to zero if now above this... | ||||||
| 55242 | AND 31 | ... | ||||||
| 55244 | LD (55218),A | ... | ||||||
| 55247 | AND 24 | Return if value is over 7... | ||||||
| 55249 | RET NZ | ... | ||||||
| 55250 | LD A,(55218) | Load "character to move" index into A | ||||||
| 55253 | OR A | If value is not zero... | ||||||
| 55254 | JR NZ,55264 | ...then skip ahead to 55264 | ||||||
| 55256 | LD A,(23468) | If Gimbal is not free... | ||||||
| 55259 | AND 1 | ... | ||||||
| 55261 | RET Z | ...then return | ||||||
| 55262 | JR 55274 | Skip ahead to 55274 | ||||||
| 55264 | CP 7 | If value is not 7... | ||||||
| 55266 | JR NZ,55274 | ...then skip ahead to 55274 | ||||||
| 55268 | LD A,(23467) | If Banshee not released... | ||||||
| 55271 | AND 1 | ... | ||||||
| 55273 | RET Z | ...then return | ||||||
| 55274 | LD A,(55218) | Load A with "character to move" index | ||||||
| 55277 | LD E,6 | Point HL at character's asleep flag... | ||||||
| 55279 | CALL 34174 | ... | ||||||
| 55282 | BIT 7,(HL) | ...and if character is asleep... | ||||||
| 55284 | RET NZ | ...then return | ||||||
| 55285 | LD A,(55218) | Load "character to move" index into A | ||||||
| 55288 | LD C,A | Multiply by three (as data entries are three bytes wide)... | ||||||
| 55289 | ADD A,A | ... | ||||||
| 55290 | ADD A,C | ... | ||||||
| 55291 | LD C,A | Load into BC... | ||||||
| 55292 | LD B,0 | ... | ||||||
| 55294 | LD HL,25440 | Point HL at start of current character positions table | ||||||
| 55297 | ADD HL,BC | Add BC as offset | ||||||
| 55298 | LD A,(65529) | Load Magic Knight's current room into A | ||||||
| 55301 | CP (HL) | If Magic Knight and the character are both in the same room... | ||||||
| 55302 | RET Z | ...then return | ||||||
| 55303 | LD B,A | Copy Magic Knight's current room into B | ||||||
| 55304 | LD A,(HL) | If character's current room is not 99... | ||||||
| 55305 | CP 99 | ... | ||||||
| 55307 | JR NZ,55319 | ...then jump to 55319 | ||||||
| 55309 | CP 100 | If character's current room is 100 (i.e. character has been sent home) then return bug | ||||||
| 55311 | RET Z | |||||||
| 55312 | LD A,(55218) | Current room is 99 (character has been commanded to go away), so calculate the index of that character's "go away base room"... | ||||||
| 55315 | ADD A,A | ...((4 × character index) + 5)... | ||||||
| 55316 | ADD A,A | ... | ||||||
| 55317 | ADD A,5 | ... | ||||||
| 55319 | CALL 55404 | Load A with new room index for character to move into based upon current room | ||||||
| 55322 | CP 255 | If new room index is 255... | ||||||
| 55324 | RET Z | ...then return | ||||||
| 55325 | CP B | If new room index is same as Magic Knight's current room... | ||||||
| 55326 | RET Z | ...then return | ||||||
| 55327 | PUSH AF | Store AF (A = new room index) | ||||||
| 55328 | LD C,A | Load new room index into C | ||||||
| 55329 | LD A,(55218) | Load "character to move" index into B... | ||||||
| 55332 | LD B,A | ... | ||||||
| 55333 | PUSH HL | Store HL (pointer to character's current room) | ||||||
| 55334 | CALL 36327 | Assign a slot in room C to character B and get x- and y-coordinates in BC | ||||||
| 55337 | POP HL | Restore HL (pointer to character's current room) | ||||||
| 55338 | POP DE | Restore DE (was AF, now D = new room index) | ||||||
| 55339 | CP 4 | If new room is full... | ||||||
| 55341 | RET Z | ...then return | ||||||
| 55342 | LD A,D | Copy new room index into A | ||||||
| 55343 | LD (HL),A | Set character to be at coordinates (C, B) in room A... | ||||||
| 55344 | INC HL | ... | ||||||
| 55345 | LD (HL),C | ... | ||||||
| 55346 | INC HL | ... | ||||||
| 55347 | LD (HL),B | ... | ||||||
| 55348 | RET | Return | ||||||
| Prev: 55219 | Up: Map | Next: 55349 |