Prev: 52309 Up: Map Next: 52371
52315: Swap Drutt's current depth level if possible
Used by the routine at 52309.
Input
IX Address of complex state data (current level) for Drutt
52315 LD A,(IX+1) If Drutt's depth is not 1...
52318 CP 1 ...
52320 JR NZ,52351 ...then skip ahead to 52351
Drutt's depth is 1
52322 LD A,(34230) If Drutt's current depth is the same as number of available depth levels in current room...
52325 CP (IX+1) ...i.e. room has depth of 1...
52328 RET Z ...then return (as there is no other depth level for Drutt to move to)
The following collision check is usually only satisfied by Berk. This prevents Drutt from jumping back a depth level while in front of (at same depth level as) Berk.
52329 CALL 54878 Check Drutt for collision with another entity (only those defined before, and in reverse order) at same depth level whose interaction-(11,7) flag is set and if a collision occurred, then return
52332 RET NC
The following collision check prevents Drutt from jumping back when there is an obstruction (e.g. the brick columns in the pit room, level 1) behind him.
52333 CALL 54890 Check Drutt for collision with another entity (in reverse order) at next depth level into screen whose interaction-(11,7) flag is set and if no collision occurred, then skip ahead to 52341
52336 JR C,52341
52338 CP 22 If collision was with an entity of class of 22 or greater (can't be picked up)...
52340 RET NC ...then return
52341 INC (IX+1) Increase Drutt's depth (i.e. move backward away from screen)
52344 DEC (IX+4) Decrease Drutt's top and bottom y-coordinates...
52347 DEC (IX+6) ...
52350 RET Return
Drutt's depth is not 1
52351 LD A,(IX+1) If Drutt's current depth is 1... (see trivia)
52354 CP 1 ...
52356 RET Z ...then return
The following collision check prevents Drutt from jumping forward a depth level while in behind an obstruction (e.g. Berk).
52357 CALL 54764 Check Drutt for collision with another entity at next depth level out of screen whose interaction-(11,6) flag is set...
52360 RET NC ...and if a collision occurred, then return
52361 DEC (IX+1) Decrease Drutt's depth (i.e. move forward towards screen)
52364 INC (IX+4) Increase Drutt's top and bottom y-coordinates...
52367 INC (IX+6) ...
52370 RET Return
Prev: 52309 Up: Map Next: 52371