|  | Routines | 
| Prev: 39151 | Up: Map | Next: 39584 | 
| 
Used by the routine at 39137.
 | ||||
| 39278 | LD A,(34228) | If clawed foot's attack timer is zero... | ||
| 39281 | OR A | ... | ||
| 39282 | JR Z,39289 | ...then skip ahead to 39289 | ||
| 39284 | DEC A | Decrease clawed foot's attack timer... | ||
| 39285 | LD (34228),A | ... | ||
| 39288 | RET | Return | ||
| 
Clawed foot is attacking
 | ||||
| 39289 | LD IY,44881 | Load IY with address of complex state data for clawed foot (level 3) | ||
| 39293 | LD IX,(34240) | Load IX with address of current level's complex state data for Berk | ||
| 39297 | CALL 53848 | Store room size data for Berk's current room | ||
| 39300 | LD A,(44890) | Load A with clawed foot's flags... | ||
| 39303 | OR A | ...and if any are set... | ||
| 39304 | JR NZ,39337 | ...then skip ahead to 39337 | ||
| 
Clawed foot attack not yet started
 | ||||
| 39306 | LD A,(IY+0) | If the clawed foot's room... | ||
| 39309 | CP (IX+0) | ...is not the same as Berk's room... | ||
| 39312 | RET NZ | ...then return | ||
| 39313 | LD A,(IX+11) | If Berk's walking-left flag or walking-right flag is set... | ||
| 39316 | AND 3 | ... | ||
| 39318 | RET NZ | ...then return | ||
| 39319 | LD A,(IX+5) | Set the clawed foot's left edge... | ||
| 39322 | INC A | ...to be one character to the right of Berk's left edge... | ||
| 39323 | LD (IY+5),A | ... | ||
| 39326 | ADD A,2 | Set the clawed foot's right edge... | ||
| 39328 | LD (IY+7),A | ...to be two characters to the right of its left edge | ||
| 39331 | SET 1,(IY+9) | Set clawed foot's moving-down flag | ||
| 39335 | JR 39341 | Skip ahead to 39341 | ||
| 
Clawed foot attack underway
 | ||||
| 39337 | BIT 1,A | If clawed foot's moving-down flag is reset... | ||
| 39339 | JR Z,39420 | ...then skip ahead to 39420 | ||
| 39341 | LD B,3 | Load B with 3 (as the clawed foot moves down three characters at time) | ||
| 39343 | INC (IY+4) | Advance clawed foot one character down... | ||
| 39346 | INC (IY+6) | ... | ||
| 39349 | LD A,(IY+6) | If y-coordinate of bottom edge of clawed foot is 115... | ||
| 39352 | CP 115 | ... | ||
| 39354 | JR Z,39359 | ...then skip ahead to 39359 | ||
| 39356 | DJNZ 39343 | Decrease remaining number of characters to move and loop back to 39343 if not zero | ||
| 39358 | RET | Return | ||
| 
Clawed foot attempting to grab Berk
 | ||||
| 39359 | BIT 6,(IX+9) | If Berk is flying... | ||
| 39363 | JR NZ,39386 | ...then skip ahead to 39386 (set clawed foot's moving-up flag and return) | ||
| 39365 | BIT 6,(IX+10) | If Berk is falling... | ||
| 39369 | JR NZ,39386 | ...then skip ahead to 39386 (set clawed foot's moving-up flag and return) | ||
| 39371 | LD A,(IY+5) | If clawed foot's left edge... | ||
| 39374 | DEC A | ...is one character to the right of Berk's left edge... | ||
| 39375 | CP (IX+5) | ... | ||
| 39378 | JR Z,39391 | ...then skip ahead to 39391 | ||
| 39380 | DEC A | If clawed foot's left edge... | ||
| 39381 | CP (IX+5) | ...is two characters to the right of Berk's left edge... | ||
| 39384 | JR Z,39391 | ...then skip ahead to 39391 | ||
| 
Berk is flying or falling, or clawed foot has missed
 | ||||
| 39386 | LD (IY+9),4 | Set clawed foot's moving-up flag | ||
| 39390 | RET | Return | ||
| 
Make clawed foot grab Berk (clawed foot is one or two characters to the right of Berk's left edge)
 | ||||
| 39391 | LD BC,35515 | Set current position in Berk's script data to... | ||
| 39394 | LD (35687),BC | ...Berk in floating position | ||
| 39398 | SET 0,(IX+9) | Set Berk's must-process-current-script-data flag | ||
| 39402 | LD A,12 | Set clawed foot's moving-up flag and holding-Berk flag... | ||
| 39404 | LD (IY+9),A | ... | ||
| 39407 | LD BC,40368 | Set clawed foot's graphic layout data address to point to 40368 (reaching, closed)... | ||
| 39410 | LD (IY+2),C | ... | ||
| 39413 | LD (IY+3),B | ... | ||
| 39416 | CALL 36296 | Make Berk drop the entity he is holding and load IY with its complex state data address | ||
| 39419 | RET | Return | ||
| 
Check clawed foot's moving-up flag
 | ||||
| 39420 | BIT 2,A | If clawed foot's moving-up flag is reset... | ||
| 39422 | JR Z,39532 | ...then skip ahead to 39532 | ||
| 39424 | DEC (IY+4) | Move clawed foot up one character... | ||
| 39427 | DEC (IY+6) | ... | ||
| 39430 | LD A,(IY+6) | If y-coordinate of bottom of clawed foot... | ||
| 39433 | CP 95 | ...is 95... | ||
| 39435 | JR Z,39449 | ...then skip ahead to 39449 | ||
| 39437 | BIT 3,(IY+9) | If clawed foot's holding-Berk flag is reset... | ||
| 39441 | RET Z | ...then return | ||
| 
This entry point is used by the routine at 39151.
 | ||||
| 39442 | DEC (IX+4) | Move entity at IX (Berk) up one character... | ||
| 39445 | DEC (IX+6) | ... | ||
| 39448 | RET | Return | ||
| 39449 | BIT 3,(IY+9) | If clawed foot's holding-Berk flag is reset... | ||
| 39453 | JR Z,39527 | ...then skip ahead to 39527 (reset clawed foot to inactive state and return) | ||
| 39455 | LD A,(34229) | Increase clawed foot's action index... | ||
| 39458 | INC A | ... | ||
| 39459 | LD (34229),A | ... | ||
| 39462 | CP 7 | ...and if less than 7... | ||
| 39464 | JR C,39470 | ...then skip ahead to 39470 | ||
| 39466 | LD A,1 | Set clawed foot's action index to 1... | ||
| 39468 | JR 39459 | ...and jump to 39470 (via 39459) | ||
| 39470 | CP 3 | If clawed foot's action index is less than 3... | ||
| 39472 | JR C,39501 | ...then skip ahead to 39501 (i.e. make clawed foot release Berk, and return) | ||
| 39474 | CP 5 | If clawed foot's action index is less than 5... | ||
| 39476 | JR C,39482 | ...then skip ahead to 39482 | ||
| 39478 | LD E,112 | Load E with 112 (prepare to set clawed foot's destination x-coordinate) | ||
| 39480 | JR 39484 | Skip ahead to 39484 | ||
| 39482 | LD E,122 | Load E with 122 (prepare to set clawed foot's destination x-coordinate) | ||
| 39484 | LD (IX+12),E | Store destination x-coordinate in byte 12 of Berk's complex state data | ||
| 39487 | BIT 0,A | If clawed foot's action index is even... | ||
| 39489 | JR Z,39496 | ...then skip ahead to 39496 | ||
| 39491 | LD (IY+9),16 | Set clawed foot's moving-left flag | ||
| 39495 | RET | Return | ||
| 39496 | LD (IY+9),32 | Set clawed foot's moving-right flag | ||
| 39500 | RET | Return | ||
| 39501 | LD A,100 | Set clawed foot's attack timer to 100... | ||
| 39503 | LD (34228),A | ...i.e. clawed foot will attack again in 100 cycles | ||
| 39506 | SET 6,(IX+10) | Set Berk's can-fall flag | ||
| 39510 | LD (IX+12),2 | Set Berk's velocity factor to 2 | ||
| 39514 | LD BC,35359 | Set current position in Berk's script data to... | ||
| 39517 | LD (35687),BC | ...Berk starting to fall downwards | ||
| 39521 | LD BC,40320 | Set clawed foot's graphic layout data address to point to 40320 (reaching, open)... | ||
| 39524 | CALL 39410 | ...make Berk drop the entity he is holding and load IY with its complex state data address | ||
| 
Reset clawed foot to inactive state
 | ||||
| 39527 | LD (IY+9),0 | Reset clawed foot's flags | ||
| 39531 | RET | Return | ||
| 
Check clawed foot's moving-left flag
 | ||||
| 39532 | BIT 4,A | If clawed foot's moving-left flag is reset... | ||
| 39534 | JR Z,39552 | ...then skip ahead to 39552 | ||
| 39536 | DEC (IX+5) | Move Berk one character left... | ||
| 39539 | DEC (IX+7) | ... | ||
| 39542 | CALL 54348 | Move Berk into room to the left, if appropriate | ||
| 39545 | LD A,(IX+0) | If Berk's room is 5 (room to the left of the coloured creatures' room)... | ||
| 39548 | CP 5 | ...then set zero flag | ||
| 39550 | JR 39569 | Skip ahead to 39569 | ||
| 
Check clawed foot's moving-right flag
 | ||||
| 39552 | BIT 5,A | If clawed foot's moving-right flag is reset... | ||
| 39554 | RET Z | ...then return | ||
| 39555 | INC (IX+5) | Move Berk one character right... | ||
| 39558 | INC (IX+7) | ... | ||
| 39561 | CALL 54313 | Move Berk into room to the right, if appropriate | ||
| 39564 | LD A,(IX+0) | If Berk's room is 7 (room to the right of the coloured creatures' room)... | ||
| 39567 | CP 7 | ...then set zero flag | ||
| 39569 | RET NZ | If zero flag is not set (i.e. Berk is not in room 5 or room 7) then return | ||
| 39570 | LD A,(IX+12) | If the x-coordinate of Berk's left edge... | ||
| 39573 | CP (IX+5) | ...is not the same as the clawed foot's destination x-coordinate... | ||
| 39576 | RET NZ | ...then return | ||
| 39577 | LD IY,44881 | Load IY with address of complex state data for clawed foot (level 3) | ||
| 39581 | JP 39501 | Make clawed foot release Berk, and return | ||
| Prev: 39151 | Up: Map | Next: 39584 |