|  | Routines | 
| Prev: 55187 | Up: Map | Next: 55421 | 
| 
This routine handles the vertical component of Berk's or Drutt's jumping, checking for collisions (e.g. Berk or Drutt hitting an obstruction above, or Drutt knocking down an entity such as a key). The routine also checks the cached control input value at 55022 to determine the outcome of the next "bounce" if the jumper is on the floor (for example, start a leftward jump if left was pressed).
 
Used by the routine at 55041.
 
 
 | ||||||||||||
| 55196 | LD A,(IX+12) | Load A with current velocity of jumper's jump... | ||||||||||
| 55199 | AND 15 | ... | ||||||||||
| 55201 | BIT 6,(IX+12) | If downward-jump-phase flag is set... | ||||||||||
| 55205 | JR NZ,55281 | ...then skip ahead to 55281 | ||||||||||
| 
Downward jump phase flag is reset, i.e. in upward phase of jump
 | ||||||||||||
| 55207 | OR A | If current velocity of jumper's jump is at least one... | ||||||||||
| 55208 | JR NZ,55234 | ...then skip ahead to 55234 | ||||||||||
| 
Current velocity of jumper's jump is zero
 | ||||||||||||
| 55210 | LD A,(55022) | Load A with cached control input... | ||||||||||
| 55213 | BIT 3,A | ...and if back bit is reset... | ||||||||||
| 55215 | JR Z,55223 | ...then skip ahead to 55223 | ||||||||||
| 55217 | DEC (IX+4) | Move jumper up one character... | ||||||||||
| 55220 | DEC (IX+6) | ... | ||||||||||
| 55223 | SET 6,(IX+12) | Set downward-jump-phase flag | ||||||||||
| 55227 | CALL 55421 | Increase current velocity of jumper's jump if less than 7 | ||||||||||
| 55230 | LD A,1 | Prepare to set velocity of jumper's jump to one, downwards | ||||||||||
| 55232 | JR 55284 | Skip ahead to 55284 (handle downward phase of jump) | ||||||||||
| 
Current velocity of jumper's jump is at least 1
 | ||||||||||||
| 55234 | LD B,A | Load B with current velocity of jumper's jump | ||||||||||
| 55235 | DEC (IX+4) | Move jumper up one character... | ||||||||||
| 55238 | DEC (IX+6) | ... | ||||||||||
| 55241 | CALL 54768 | Check entity at IX for collision with another entity at same depth whose interaction-(11,6) flag is set... | ||||||||||
| 55244 | JR C,55258 | ...and if no collision occurred, then skip ahead to 55258 | ||||||||||
| 55246 | CP 130 | If collision was not with entity of class 130 (causes Berk and Drutt to bounce off or bang head)... | ||||||||||
| 55248 | JR NZ,55258 | ...then skip ahead to 55258 | ||||||||||
| 
Jumper has banged his head
 | ||||||||||||
| 55250 | LD A,6 | Set pending sound index to 6 (banging head) if it is currently zero, or lower priority... | ||||||||||
| 55252 | CALL 59613 | ... | ||||||||||
| 55255 | LD E,6 | Load E with 6 (jumper has banged his head on something above him) | ||||||||||
| 55257 | RET | Return | ||||||||||
| 
No collision, or collision with entity other than that of class 130
 | ||||||||||||
| 55258 | CP 22 | If collision was with an entity of class of 22 or greater (can't be picked up, or 255 for no collision)... | ||||||||||
| 55260 | JR NC,55270 | ...then skip ahead to 55270 | ||||||||||
| 
Drutt has knocked down an entity, e.g. red sweet on level 1
 | ||||||||||||
| 55262 | LD (IY+12),2 | Set initial velocity factor of entity jumper collided with to 2... | ||||||||||
| 55266 | SET 6,(IY+10) | ...and set its can-fall flag | ||||||||||
| 55270 | CALL 55433 | Change jumper's room up one if appropriate | ||||||||||
| 55273 | DJNZ 55235 | Decrease B (remaining number of characters to move up) and loop back to 55235 if not zero | ||||||||||
| 55275 | DEC (IX+12) | Decrease current velocity of jumper's jump, slowing ascent | ||||||||||
| 55278 | LD E,0 | Load E with zero (jumper jumping upwards, no collision) | ||||||||||
| 55280 | RET | Return | ||||||||||
| 
Downward jump phase flag is set, i.e. in downward phase of jump
 | ||||||||||||
| 55281 | CALL 55421 | Increase current velocity of jumper's jump if less than 7, speeding descent, and load into A | ||||||||||
| 55284 | LD B,A | Load B with velocity of jumper's jump | ||||||||||
| 55285 | INC (IX+4) | Move jumper down one character... | ||||||||||
| 55288 | INC (IX+6) | ... | ||||||||||
| 55291 | CALL 54768 | Check jumper for collision with another entity at same depth whose interaction-(11,6) flag is set... | ||||||||||
| 55294 | JR C,55300 | ...and if no collision occurred, then skip ahead to 55300 | ||||||||||
| 55296 | CP 35 | If collision was with an entity of class 35 (platform, level 1 or level 3)... | ||||||||||
| 55298 | JR Z,55363 | ...then skip ahead to 55363 | ||||||||||
| 
No collision, or collision with entity other than that of class 35
 | ||||||||||||
| 55300 | LD A,(IX+6) | Load A with y-coordinate of jumper's bottom edge... | ||||||||||
| 55303 | ADD A,(IX+1) | ...and add jumper's depth | ||||||||||
| 55306 | CP 122 | If A is 122 (i.e. jumper is at bottom of screen)... | ||||||||||
| 55308 | JR Z,55320 | ...then skip ahead to 55320 | ||||||||||
| 55310 | DJNZ 55285 | Decrease B (remaining number of characters to move down) and loop back to 55285 if not zero | ||||||||||
| 55312 | PUSH HL | Store HL | ||||||||||
| 55313 | CALL 55616 | Change jumper's room down one if appropriate | ||||||||||
| 55316 | POP HL | Restore HL | ||||||||||
| 55317 | LD E,0 | Load E with zero (jumper jumping downwards, no collision) | ||||||||||
| 55319 | RET | Return | ||||||||||
| 
Jumper is at the bottom of the screen
 | ||||||||||||
| 55320 | CALL 54768 | Check jumper for collision with another entity at same depth whose interaction-(11,6) flag is set... | ||||||||||
| 55323 | JR C,55363 | ...and if no collision occurred, then skip ahead to 55363 | ||||||||||
| 55325 | CP 129 | If collision was with entity of class 129 (causes other entities to start falling)... | ||||||||||
| 55327 | JR Z,55334 | ...then skip ahead to 55334 | ||||||||||
| 
Collision was not with entity of class 129, so need to resume collision check from current position in entities list, i.e. entity that jumper did collide with
 | ||||||||||||
| 55329 | CALL 54871 | Resume checking jumper for collision with another entity at same depth whose interaction-(11,6) flag is set | ||||||||||
| 55332 | JR 55323 | ...and jump back to 55323 | ||||||||||
| 
Collision with entity of class 129
 | ||||||||||||
| 55334 | LD A,(IX+8) | If jumper is not Berk... | ||||||||||
| 55337 | CP 31 | ...(class = 31)..... | ||||||||||
| 55339 | JR NZ,55285 | ...then jump back to 55285 (continue moving downwards) | ||||||||||
| 55341 | LD A,(IX+5) | If Berk's left edge... | ||||||||||
| 55344 | CP (IY+5) | ...is at or to the right of the colliding entity's left edge... | ||||||||||
| 55347 | JR NC,55352 | ...then skip ahead to 55352 | ||||||||||
| 
Berk's left edge is to the left of colliding entity's left edge
 | ||||||||||||
| 55349 | LD E,7 | Load E with 7 (jumper is Berk, his left edge is to the left of colliding, class=129, entity's left edge) | ||||||||||
| 55351 | RET | Return | ||||||||||
| 
Berk's left edge is at, or to the right of, colliding entity's left edge
 | ||||||||||||
| 55352 | LD A,(IY+7) | If Berk's right edge... | ||||||||||
| 55355 | CP (IX+7) | ...is at or to the right of the colliding entity's right edge... | ||||||||||
| 55358 | JR NC,55285 | ...then jump back to 55285 (continue moving downwards) | ||||||||||
| 
Berk's right edge is to the left of colliding entity's right edge
 | ||||||||||||
| 55360 | LD E,8 | Load E with 8 (jumper is Berk, and he is between left and right edges of colliding, class=129, entity) | ||||||||||
| 55362 | RET | Return | ||||||||||
| 
Downward phase, and collision with entity of class 35 (platform, level 1 or level 3) or no collision at bottom of screen
 | ||||||||||||
| 55363 | RES 6,(IX+12) | Reset downward-jump-phase flag (i.e. prepare to jump up again) | ||||||||||
| 55367 | LD A,(55022) | Load A with cached control input... | ||||||||||
| 55370 | BIT 3,A | ...and if back bit is reset... | ||||||||||
| 55372 | JR Z,55377 | ...then skip ahead to 55377 | ||||||||||
| 55374 | LD E,1 | Load E with 1 (jumper landed on floor / platform and back control input bit set) | ||||||||||
| 55376 | RET | Return | ||||||||||
| 
Back bit is reset
 | ||||||||||||
| 55377 | LD A,(IX+12) | If current velocity of jumper's jump is at least 4... | ||||||||||
| 55380 | AND 15 | ... | ||||||||||
| 55382 | CP 4 | ... | ||||||||||
| 55384 | JR NC,55393 | ...then skip ahead to 55393 | ||||||||||
| 55386 | LD (IX+12),0 | Reset jumper's is-jumping flag and set current velocity of jump to zero | ||||||||||
| 55390 | LD E,3 | Load E with 3 (jumper's jump velocity less than 4, and back not pressed, i.e. terminate jumping) | ||||||||||
| 55392 | RET | Return | ||||||||||
| 
Current velocity of jumper's jump is at least 4, and back bit is reset
 | ||||||||||||
| 55393 | LD A,(55022) | Load A with cached control input... | ||||||||||
| 55396 | BIT 1,A | ...and if left bit is reset... | ||||||||||
| 55398 | JR Z,55404 | ...then skip ahead to 55404 | ||||||||||
| 
Left bit is set
 | ||||||||||||
| 55400 | LD E,4 | Load E with 4 (jumper's jump velocity at least 4 and left control input bit set) | ||||||||||
| 55402 | JR 55410 | Decrease current velocity of jumper's jump by two and return | ||||||||||
| 
Left bit is reset
 | ||||||||||||
| 55404 | BIT 0,A | If right bit is reset... | ||||||||||
| 55406 | JR Z,55417 | ...then skip ahead to 55417 | ||||||||||
| 
Right bit is set
 | ||||||||||||
| 55408 | LD E,5 | Load E with 5 (jumper's jump velocity at least 4 and right control input bit set) | ||||||||||
| 55410 | DEC (IX+12) | Decrease current velocity of jumper's jump by two... | ||||||||||
| 55413 | DEC (IX+12) | ... | ||||||||||
| 55416 | RET | Return | ||||||||||
| 
Right bit (and left and back bits) reset
 | ||||||||||||
| 55417 | LD E,0 | Load E with zero (current velocity of jumper's jump is at least 4 and back, left and right control input bits are reset) | ||||||||||
| 55419 | JR 55410 | Decrease current velocity of jumper's jump by two and return | ||||||||||
| Prev: 55187 | Up: Map | Next: 55421 |