Routines |
Prev: 51765 | Up: Map | Next: 51890 |
Used by the routine at 48096.
|
||||||||||||
51779 | CALL 54768 | Check Drutt for collision with another entity at same depth whose interaction-(11,6) flag is set... | ||||||||||
51782 | CP 129 | ...and if collision was not with entity of class 129 (causes other entities to start falling)... | ||||||||||
51784 | JR NZ,51792 | ...then skip ahead to 51792 | ||||||||||
51786 | CALL 55516 | Set Drutt's can-fall flag and initial velocity factor to 2 | ||||||||||
51789 | JP 52038 | Move Drutt down one character, advance HL to next script instruction and execute | ||||||||||
51792 | LD IY,(34244) | Load IY with address of current level's complex state data for worm | ||||||||||
51796 | LD A,(34208) | If Drutt-mode flag is reset... | ||||||||||
51799 | BIT 0,A | ... | ||||||||||
51801 | JR Z,51841 | ...then skip ahead to 51841 | ||||||||||
Drutt-mode flag is set (i.e. Drutt mode)
|
||||||||||||
51803 | SET 1,(IX+9) | Set Drutt's under-player-control flag | ||||||||||
51807 | LD A,(34219) | Load A with control input | ||||||||||
51810 | BIT 0,A | If right has been pressed... | ||||||||||
51812 | JR NZ,51904 | ...then randomly select script data for rightward hop of size three or four, and execute | ||||||||||
51814 | BIT 1,A | If left has been pressed... | ||||||||||
51816 | JR NZ,51924 | ...then randomly select script data for leftward hop of size three or four, and execute | ||||||||||
51818 | BIT 2,A | If forward has been pressed... | ||||||||||
51820 | JP NZ,51954 | ...then point HL at script data for Drutt swapping depth levels and execute | ||||||||||
51823 | BIT 3,A | If back has been pressed... | ||||||||||
51825 | JP NZ,51944 | ...then jump to 51944 (start Drutt jumping) | ||||||||||
At this point, no control has been pressed, so Drutt is effectively not under player control
|
||||||||||||
51828 | RES 1,(IX+9) | Reset Drutt's under-player-control flag | ||||||||||
51832 | LD A,(IY+1) | If worm's depth is zero (i.e. not in play area)... | ||||||||||
51835 | OR A | ... | ||||||||||
51836 | JR Z,51875 | ...then randomly select an action for Drutt and execute | ||||||||||
51838 | JP 51960 | Move Drutt closer to the worm and eat it if close enough | ||||||||||
Drutt-mode flag is reset (i.e. Berk mode)
|
||||||||||||
51841 | RES 1,(IX+9) | Reset Drutt's under-player-control flag | ||||||||||
51845 | LD A,(IY+1) | If worm's depth is not zero (i.e. is in play area)... | ||||||||||
51848 | OR A | ... | ||||||||||
51849 | JP NZ,51960 | ...then move Drutt closer to the worm and eat it if close enough | ||||||||||
51852 | LD IY,(34240) | Load IY with address of current level's complex state data for Berk | ||||||||||
51856 | LD A,(IY+0) | If Drutt is in the same room as Berk... | ||||||||||
51859 | CP (IX+0) | ... | ||||||||||
51862 | JR Z,51875 | ...then randomly select an action for Drutt and execute | ||||||||||
This entry point is used by the routine at 51960.
The following code will make Drutt move closer to the target (a worm, or Berk if in Berk mode) if the target's room is directly to the left or right of Drutt's room (i.e. no vertical separation). Otherwise, Drutt will perform a random action.
|
||||||||||||
51864 | CALL 53194 | Load A with value indicating which direction room A lies relative to Drutt's current room | ||||||||||
51867 | CP 1 | If target room is to the right... | ||||||||||
51869 | JR Z,51904 | ...then randomly select script data for rightward hop of size three or four, and execute | ||||||||||
51871 | CP 2 | If target room is to the left... | ||||||||||
51873 | JR Z,51924 | ...then randomly select script data for leftward hop of size three or four, and execute | ||||||||||
This entry point is used by the routine at 51960.
|
||||||||||||
51875 | LD A,7 | Load A with a random number, 0-6... | ||||||||||
51877 | CALL 54222 | ... | ||||||||||
51880 | LD DE,51890 | Point DE at table of addresses of script data for Drutt's actions... | ||||||||||
51883 | CALL 53814 | ...and load DE with entry of index A in this table | ||||||||||
51886 | EX DE,HL | Switch DE and HL (now contains address of randomly selected script data) | ||||||||||
51887 | JP 48098 | Execute script data at address in HL |
Prev: 51765 | Up: Map | Next: 51890 |