![]() |
Routines |
| Prev: 45018 | Up: Map | Next: 45770 |
|
Handler for the object types 48 to 51 (eagles) and 64 to 67 (vultures). The creature flies towards Sabreman, bounces off the decorations and the bubbles, bounces off the frame of the room and flies out of the room through its gaps.
If the creature is in a different room from Sabreman it is moved by Move_Creature_Horizontally (when the room x is different) or by Move_Creature_Vertically (when the room y is different).
In Sabreman's room, an eagle that is above him and touches him picks him up (the type changes to 92 and Handle_Carrying_Eagle takes over). Bit 0 of the type is the frame of the animation and changes every two ticks, and bit 1 follows the direction of the x velocity.
The x velocity and the y velocity (bytes 8 and 9 of the record) each change by two on every call, in the direction of Sabreman, up to a limit of 64. A thrown weapon destroys the creature (see Destroy_Flying_Creature). If the creature touches Sabreman he is pushed away with an x velocity of 3 and tumbles.
The contact flags (byte 11 of the record) use the same bits as the flags of the room (see Draw_Room), and they are combined with those flags in E.
|
||||||||
| Handle_Flying_Creature | 45177 | CALL Read_World_Map | Read the world map entry of the room that the creature is in. The flags of the room are returned in E. | |||||
| 45180 | LD A,(IX+11) | Fetch the contact flags of the creature. | ||||||
| 45183 | OR E | Combine them with the flags of the room. | ||||||
| 45184 | LD E,A | Store the result in E. | ||||||
| 45185 | LD A,(36636) | Fetch the room x of Sabreman. | ||||||
| 45188 | CP (IX+2) | Jump to Move_Creature_Horizontally if the creature is in a different room x. | ||||||
| 45191 | JP NZ,Move_Creature_Horizontally | |||||||
| 45194 | LD A,(36638) | Fetch the room y of Sabreman. | ||||||
| 45197 | CP (IX+4) | Jump to Move_Creature_Vertically if the creature is in a different room y. | ||||||
| 45200 | JP NZ,Move_Creature_Vertically | |||||||
| 45203 | CALL StoreEntity | Save the state of the creature. | ||||||
|
Only an eagle that has been drawn and is inside the room can pick up Sabreman, and only if he is not hanging on the rope.
|
||||||||
| 45206 | LD A,(IX+0) | Fetch the type of the creature. | ||||||
| 45209 | AND %11111100 | Ignore the low two bits. | ||||||
| 45211 | CP 48 | Jump to Handle_Flying_Creature_Animate if the creature is not an eagle. | ||||||
| 45213 | JR NZ,Handle_Flying_Creature_Animate | |||||||
| 45215 | BIT 0,(IX+15) | Jump to Handle_Flying_Creature_Animate if the creature has just been created. | ||||||
| 45219 | JR NZ,Handle_Flying_Creature_Animate | |||||||
| 45221 | LD A,(IX+1) | Fetch the x position of the creature. | ||||||
| 45224 | CP 208 | Jump to Handle_Flying_Creature_Animate if the x position is 208 or more. | ||||||
| 45226 | JR NC,Handle_Flying_Creature_Animate | |||||||
| 45228 | CP 24 | Jump to Handle_Flying_Creature_Animate if the x position is less than 24. | ||||||
| 45230 | JR C,Handle_Flying_Creature_Animate | |||||||
| 45232 | LD A,(IX+3) | Fetch the y position of the creature. | ||||||
| 45235 | CP 168 | Jump to Handle_Flying_Creature_Animate if the y position is 168 or more. | ||||||
| 45237 | JR NC,Handle_Flying_Creature_Animate | |||||||
| 45239 | CP 65 | Jump to Handle_Flying_Creature_Animate if the y position is less than 65. | ||||||
| 45241 | JR C,Handle_Flying_Creature_Animate | |||||||
| 45243 | LD A,(36634) | Fetch the type of Sabreman. | ||||||
| 45246 | CP 9 | Jump to Handle_Flying_Creature_Animate if Sabreman is hanging on the rope (the type is less than 9). | ||||||
| 45248 | JR C,Handle_Flying_Creature_Animate | |||||||
| 45250 | CALL Check_Sabreman_Contact | Check for contact with Sabreman. Bit 2 of C is set if the creature touches him and bit 1 is set if he is above the creature. | ||||||
| 45253 | LD A,C | Copy the result to A. | ||||||
| 45254 | AND %00000110 | Keep only bits 1 and 2. | ||||||
| 45256 | CP 4 | Jump to Handle_Flying_Creature_Animate unless the creature touches Sabreman and he is not above it. | ||||||
| 45258 | JR NZ,Handle_Flying_Creature_Animate | |||||||
| 45260 | DI | Disable interrupts while the frame counter is changed. | ||||||
| 45261 | LD (IX+0),92 | Change the type of the creature to 92 which makes it carry Sabreman (see Handle_Carrying_Eagle). | ||||||
| 45265 | LD A,64 | Write 64 to the redraw flags of Sabreman (Sabreman_Redraw_Flags), which marks him as being carried (bit 6). | ||||||
| 45267 | LD (36649),A | |||||||
| 45270 | LD A,(23672) | Fetch the low byte of the frame counter. | ||||||
| 45273 | OR %01000000 | Set bit 6. | ||||||
| 45275 | LD (23672),A | Store it. The carry ends when this byte next wraps round to zero (see Handle_Carrying_Eagle). | ||||||
| 45278 | LD (36594),A | Store it in Previous_Type_5C_Active_Flag as well, as a non-zero value. | ||||||
| 45281 | JP Handle_Carrying_Eagle_Carry | Jump to Handle_Carrying_Eagle_Carry to carry on as an eagle that carries Sabreman. | ||||||
|
Work out the type of the creature. Bit 0 follows bit 1 of the tick counter and bit 1 is set when the x velocity is negative.
|
||||||||
| Handle_Flying_Creature_Animate | 45284 | LD A,(36566) | Fetch the tick counter. | |||||
| 45287 | RRA | Move bit 1 into bit 0. | ||||||
| 45288 | AND %00000001 | Keep only that bit. | ||||||
| 45290 | LD C,A | Keep the frame bit in C. | ||||||
| 45291 | LD A,(IX+0) | Fetch the type of the creature. | ||||||
| 45294 | AND %11111110 | Clear bit 0. | ||||||
| 45296 | ADD A,C | Add the frame bit. | ||||||
| 45297 | BIT 7,(IX+8) | Jump to Handle_Flying_Creature_Clear_Direction if the x velocity is positive. | ||||||
| 45301 | JR Z,Handle_Flying_Creature_Clear_Direction | |||||||
| 45303 | OR %00000010 | Set bit 1. | ||||||
| 45305 | JR Handle_Flying_Creature_Store_Type | Jump to Handle_Flying_Creature_Store_Type. | ||||||
| Handle_Flying_Creature_Clear_Direction | 45307 | AND %11111101 | Clear bit 1. | |||||
| Handle_Flying_Creature_Store_Type | 45309 | LD (IX+0),A | Store the type of the creature. | |||||
|
Change the x velocity by two in the direction of Sabreman, up to a limit of 64 in either direction.
|
||||||||
| 45312 | LD A,(36635) | Fetch the x position of Sabreman. | ||||||
| 45315 | SUB (IX+1) | Subtract the x position of the creature. | ||||||
| 45318 | LD A,(IX+8) | Fetch the x velocity of the creature. | ||||||
| 45321 | JP C,Handle_Flying_Creature_Steer_Left | Jump to Handle_Flying_Creature_Steer_Left if Sabreman is on the left of the creature. | ||||||
| 45324 | ADD A,2 | Add two to the x velocity. | ||||||
| 45326 | BIT 7,A | Jump to Handle_Flying_Creature_Store_X_Velocity if the x velocity is negative. | ||||||
| 45328 | JR NZ,Handle_Flying_Creature_Store_X_Velocity | |||||||
| 45330 | CP 64 | Jump to Handle_Flying_Creature_Steer_Vertically if the x velocity has reached 64. | ||||||
| 45332 | JR NC,Handle_Flying_Creature_Steer_Vertically | |||||||
| Handle_Flying_Creature_Store_X_Velocity | 45334 | LD (IX+8),A | Store the x velocity. | |||||
|
Do the same with the y velocity.
|
||||||||
| Handle_Flying_Creature_Steer_Vertically | 45337 | LD A,(36637) | Fetch the y position of Sabreman. | |||||
| 45340 | SUB (IX+3) | Subtract the y position of the creature. | ||||||
| 45343 | LD A,(IX+9) | Fetch the y velocity of the creature. | ||||||
| 45346 | JP C,Handle_Flying_Creature_Steer_Up | Jump to Handle_Flying_Creature_Steer_Up if Sabreman is above the creature. | ||||||
| 45349 | ADD A,2 | Add two to the y velocity. | ||||||
| 45351 | BIT 7,A | Jump to Handle_Flying_Creature_Store_Y_Velocity if the y velocity is negative. | ||||||
| 45353 | JR NZ,Handle_Flying_Creature_Store_Y_Velocity | |||||||
| 45355 | CP 64 | Jump to Handle_Flying_Creature_Check_Contact if the y velocity has reached 64. | ||||||
| 45357 | JR NC,Handle_Flying_Creature_Check_Contact | |||||||
| Handle_Flying_Creature_Store_Y_Velocity | 45359 | LD (IX+9),A | Store the y velocity. | |||||
|
This entry point is used by the routine at Handle_Jellyfish.
Check for contact with a thrown weapon and with Sabreman. This is also the entry point for the jellyfish.
|
||||||||
| Handle_Flying_Creature_Check_Contact | 45362 | PUSH DE | Stash the flags of the room on the stack. | |||||
| 45363 | BIT 0,(IX+15) | Jump to Handle_Flying_Creature_Check_Obstacles if the creature has just been created. | ||||||
| 45367 | JR NZ,Handle_Flying_Creature_Check_Obstacles | |||||||
| 45369 | CALL Check_Weapon_Hit | Check whether a thrown weapon has hit the creature. D is 255 if one has. | ||||||
| 45372 | LD A,D | Copy the result to A. | ||||||
| 45373 | AND A | Jump to Destroy_Flying_Creature if a weapon has hit the creature. | ||||||
| 45374 | JP NZ,Destroy_Flying_Creature | |||||||
| 45377 | CALL Check_Sabreman_Contact | Check for contact with Sabreman. | ||||||
| 45380 | BIT 2,C | Jump to Handle_Flying_Creature_Check_Obstacles if the creature is not touching him. | ||||||
| 45382 | JR Z,Handle_Flying_Creature_Check_Obstacles | |||||||
| 45384 | XOR A | Clear A, which collects the new redraw flags of Sabreman. | ||||||
| 45385 | BIT 7,C | Test bit 7 of C, which is set when the creature is on the right of Sabreman. | ||||||
| 45387 | LD B,3 | Use an x velocity of 3 to push Sabreman to the right. | ||||||
| 45389 | JR Z,Handle_Flying_Creature_Push_Sabreman | Jump to Handle_Flying_Creature_Push_Sabreman if the creature is on the left of Sabreman. | ||||||
| 45391 | LD B,253 | Use an x velocity of 253 to push Sabreman to the left. | ||||||
| 45393 | LD A,16 | Set bit 4 of A. | ||||||
| Handle_Flying_Creature_Push_Sabreman | 45395 | OR %00001000 | Set bit 3 of A. | |||||
| 45397 | LD C,A | Copy the new redraw flags to C. | ||||||
| 45398 | LD A,(36649) | Fetch the redraw flags of Sabreman. | ||||||
| 45401 | OR C | Combine them with the new bits. Bit 3 makes him tumble (see Tumble_Sabreman). | ||||||
| 45402 | LD (36649),A | Store the redraw flags of Sabreman. | ||||||
| 45405 | LD A,B | Copy the x velocity to A. | ||||||
| 45406 | LD (36640),A | Store it as the x velocity of Sabreman (Sabreman_X_Velocity). | ||||||
|
Check for contact with the decorations and the bubbles, and bounce off them.
|
||||||||
| Handle_Flying_Creature_Check_Obstacles | 45409 | CALL Check_Decoration_Contact | Check for contact with the decorations. C holds the result. | |||||
| 45412 | LD D,C | Store the result in D. | ||||||
| 45413 | CALL Check_Bubble_Contact | Check for contact with the bubbles. | ||||||
| 45416 | LD A,C | Copy the result to A. | ||||||
| 45417 | OR D | Combine it with the result for the decorations. | ||||||
| 45418 | LD C,A | Store the combined result in C. | ||||||
| 45419 | POP DE | Restore DE from the stack. | ||||||
| 45420 | BIT 2,C | Jump to Handle_Flying_Creature_Move_Sideways if the creature is not touching anything. | ||||||
| 45422 | JR Z,Handle_Flying_Creature_Move_Sideways | |||||||
| 45424 | BIT 1,C | Jump to Handle_Flying_Creature_Test_Underside if the creature is not on top of the object. | ||||||
| 45426 | JR Z,Handle_Flying_Creature_Test_Underside | |||||||
| 45428 | BIT 5,C | Jump to Handle_Flying_Creature_Bounce_Sideways if the object is a bubble and the creature is away from the middle of it. | ||||||
| 45430 | JR NZ,Handle_Flying_Creature_Bounce_Sideways | |||||||
| 45432 | LD A,(IX+9) | Fetch the y velocity. | ||||||
| 45435 | DEC A | Subtract two. | ||||||
| 45436 | DEC A | |||||||
| 45437 | JP M,Handle_Flying_Creature_Move_Sideways | Jump to Handle_Flying_Creature_Move_Sideways if the result is negative, as the creature is already moving up. | ||||||
| 45440 | CPL | Invert the y velocity, to send the creature up. | ||||||
| 45441 | LD (IX+9),A | Store the y velocity. | ||||||
| 45444 | LD A,(IX+3) | Fetch the y position. | ||||||
| 45447 | SUB 2 | Subtract two. | ||||||
| 45449 | LD (IX+3),A | Store the y position. | ||||||
| 45452 | JR Handle_Flying_Creature_Move_Sideways | Jump to Handle_Flying_Creature_Move_Sideways. | ||||||
| Handle_Flying_Creature_Test_Underside | 45454 | BIT 0,C | Jump to Handle_Flying_Creature_Bounce_Sideways if the creature is away from the middle of the object. | |||||
| 45456 | JR NZ,Handle_Flying_Creature_Bounce_Sideways | |||||||
| 45458 | LD A,(IX+9) | Fetch the y velocity. | ||||||
| 45461 | INC A | Add two. | ||||||
| 45462 | INC A | |||||||
| 45463 | JP P,Handle_Flying_Creature_Bounce_Sideways | Jump to Handle_Flying_Creature_Bounce_Sideways if the result is positive, as the creature is already moving down. | ||||||
| 45466 | CPL | Invert the y velocity, to send the creature down. | ||||||
| 45467 | LD (IX+9),A | Store the y velocity. | ||||||
| Handle_Flying_Creature_Bounce_Sideways | 45470 | LD A,(IX+8) | Fetch the x velocity. | |||||
| 45473 | BIT 7,C | Jump to Handle_Flying_Creature_Bounce_Left if the creature is on the left of the object. | ||||||
| 45475 | JR Z,Handle_Flying_Creature_Bounce_Left | |||||||
| 45477 | INC A | Add two. | ||||||
| 45478 | INC A | |||||||
| 45479 | JP P,Handle_Flying_Creature_Move_Sideways | Jump to Handle_Flying_Creature_Move_Sideways if the result is positive, as the creature is already moving right. | ||||||
| 45482 | CPL | Invert the x velocity, to send the creature right. | ||||||
| 45483 | LD (IX+8),A | Store the x velocity. | ||||||
| 45486 | JR Handle_Flying_Creature_Move_Sideways | Jump to Handle_Flying_Creature_Move_Sideways. | ||||||
| Handle_Flying_Creature_Bounce_Left | 45488 | DEC A | Subtract two. | |||||
| 45489 | DEC A | |||||||
| 45490 | JP M,Handle_Flying_Creature_Move_Sideways | Jump to Handle_Flying_Creature_Move_Sideways if the result is negative, as the creature is already moving left. | ||||||
| 45493 | CPL | Invert the x velocity, to send the creature left. | ||||||
| 45494 | LD (IX+8),A | Store the x velocity. | ||||||
|
Move the creature sideways. Reset bits 0 and 4 of the contact flags first.
|
||||||||
| Handle_Flying_Creature_Move_Sideways | 45497 | LD A,(IX+11) | Fetch the contact flags. | |||||
| 45500 | AND %11101110 | Reset bits 0 and 4. | ||||||
| 45502 | LD (IX+11),A | Store the contact flags. | ||||||
| 45505 | LD L,(IX+8) | Fetch the x velocity into L. | ||||||
| 45508 | BIT 7,L | Test the sign of the x velocity. | ||||||
| 45510 | LD H,0 | Clear the high byte of the x velocity (as a word). | ||||||
| 45512 | JR Z,Handle_Flying_Creature_Add_X_Velocity | Jump to Handle_Flying_Creature_Add_X_Velocity if the x velocity is positive. | ||||||
| 45514 | LD H,255 | Set the high byte of the x velocity to 255 to extend the sign. | ||||||
| Handle_Flying_Creature_Add_X_Velocity | 45516 | CALL Move_Object_Horizontally | Add the x velocity to the x position (see Move_Object_Horizontally). A is the new x position, and the zero flag is set when it is less than 128. | |||||
| 45519 | JP Z,Handle_Flying_Creature_Test_Left_Edge | Jump to Handle_Flying_Creature_Test_Left_Edge if the x position is less than 128. | ||||||
| 45522 | CP 208 | Jump to Handle_Flying_Creature_Store_X if the x position is less than 208. | ||||||
| 45524 | JR C,Handle_Flying_Creature_Store_X | |||||||
| 45526 | BIT 2,E | Jump to Handle_Flying_Creature_Test_Right_Gap if the room has no right wall. | ||||||
| 45528 | JP Z,Handle_Flying_Creature_Test_Right_Gap | |||||||
| 45531 | LD A,(IX+8) | Fetch the x velocity. | ||||||
| 45534 | CPL | Invert it, to bounce off the right wall. | ||||||
| 45535 | LD (IX+8),A | Store the x velocity. | ||||||
| 45538 | LD A,207 | Set the x position to 207. | ||||||
| Handle_Flying_Creature_Store_X | 45540 | LD (IX+1),A | Store the x position. | |||||
|
Move the creature up or down. Reset bits 2 and 6 of the contact flags first.
|
||||||||
| 45543 | LD A,(IX+11) | Fetch the contact flags. | ||||||
| 45546 | AND %10111011 | Reset bits 2 and 6. | ||||||
| 45548 | LD (IX+11),A | Store the contact flags. | ||||||
| 45551 | LD L,(IX+9) | Fetch the y velocity into L. | ||||||
| 45554 | BIT 7,L | Test the sign of the y velocity. | ||||||
| 45556 | LD H,0 | Clear the high byte of the y velocity (as a word). | ||||||
| 45558 | JR Z,Handle_Flying_Creature_Add_Y_Velocity | Jump to Handle_Flying_Creature_Add_Y_Velocity if the y velocity is positive. | ||||||
| 45560 | LD H,255 | Set the high byte of the y velocity to 255 to extend the sign. | ||||||
| Handle_Flying_Creature_Add_Y_Velocity | 45562 | CALL Move_Object_Vertically | Add the y velocity to the y position (see Move_Object_Vertically). A is the new y position, and the zero flag is set when it is less than 128. | |||||
| 45565 | JP Z,Handle_Flying_Creature_Test_Top_Edge | Jump to Handle_Flying_Creature_Test_Top_Edge if the y position is less than 128. | ||||||
| 45568 | CP 159 | Jump to Handle_Flying_Creature_Store_Y if the y position is less than 159. | ||||||
| 45570 | JR C,Handle_Flying_Creature_Store_Y | |||||||
| 45572 | BIT 4,E | Jump to Handle_Flying_Creature_Test_Bottom_Gap if the room has no floor. | ||||||
| 45574 | JP Z,Handle_Flying_Creature_Test_Bottom_Gap | |||||||
| 45577 | LD A,(IX+9) | Fetch the y velocity. | ||||||
| 45580 | CPL | Invert it, to bounce off the floor. | ||||||
| 45581 | LD (IX+9),A | Store the y velocity. | ||||||
| 45584 | LD A,159 | Set the y position to 159. | ||||||
| Handle_Flying_Creature_Store_Y | 45586 | LD (IX+3),A | Store the y position. | |||||
| 45589 | JP Update_Object_Sprite | Jump to Update_Object_Sprite. | ||||||
|
Sabreman is on the left of the creature, so subtract two from the x velocity, down to a limit of 192.
|
||||||||
| Handle_Flying_Creature_Steer_Left | 45592 | SUB 2 | Subtract two from the x velocity. | |||||
| 45594 | BIT 7,A | Jump to Handle_Flying_Creature_Store_X_Velocity if the x velocity is positive. | ||||||
| 45596 | JP Z,Handle_Flying_Creature_Store_X_Velocity | |||||||
| 45599 | CP 192 | Jump to Handle_Flying_Creature_Steer_Vertically if the x velocity is less than 192. | ||||||
| 45601 | JP C,Handle_Flying_Creature_Steer_Vertically | |||||||
| 45604 | JP Handle_Flying_Creature_Store_X_Velocity | Jump to Handle_Flying_Creature_Store_X_Velocity. | ||||||
|
Sabreman is above the creature, so subtract two from the y velocity, down to a limit of 192.
|
||||||||
| Handle_Flying_Creature_Steer_Up | 45607 | SUB 2 | Subtract two from the y velocity. | |||||
| 45609 | BIT 7,A | Jump to Handle_Flying_Creature_Store_Y_Velocity if the y velocity is positive. | ||||||
| 45611 | JP Z,Handle_Flying_Creature_Store_Y_Velocity | |||||||
| 45614 | CP 192 | Jump to Handle_Flying_Creature_Check_Contact if the y velocity is less than 192. | ||||||
| 45616 | JP C,Handle_Flying_Creature_Check_Contact | |||||||
| 45619 | JP Handle_Flying_Creature_Store_Y_Velocity | Jump to Handle_Flying_Creature_Store_Y_Velocity. | ||||||
|
The x position is less than 128. The creature bounces off the left wall if there is one, and leaves the room by the gap otherwise.
|
||||||||
| Handle_Flying_Creature_Test_Left_Edge | 45622 | CP 24 | Jump to Handle_Flying_Creature_Store_X if the x position is 24 or more. | |||||
| 45624 | JP NC,Handle_Flying_Creature_Store_X | |||||||
| 45627 | BIT 6,E | Jump to Handle_Flying_Creature_Test_Left_Gap if the room has no left wall. | ||||||
| 45629 | JR Z,Handle_Flying_Creature_Test_Left_Gap | |||||||
| 45631 | LD A,(IX+8) | Fetch the x velocity. | ||||||
| 45634 | CPL | Invert it, to bounce off the left wall. | ||||||
| 45635 | LD (IX+8),A | Store the x velocity. | ||||||
| 45638 | LD A,24 | Set the x position to 24. | ||||||
| 45640 | JP Handle_Flying_Creature_Store_X | Jump to Handle_Flying_Creature_Store_X. | ||||||
| Handle_Flying_Creature_Test_Left_Gap | 45643 | CP 8 | Jump to Handle_Flying_Creature_Set_Gap_Flags if the x position is 8 or more. | |||||
| 45645 | JR NC,Handle_Flying_Creature_Set_Gap_Flags | |||||||
| 45647 | DEC (IX+2) | Move the creature to the room on the left. | ||||||
| 45650 | LD (IX+1),208 | Set the x position to 208. | ||||||
| 45654 | BIT 0,(IX+15) | Return if the creature has not been drawn yet. | ||||||
| 45658 | RET NZ | |||||||
| 45659 | JP RemoveEntity | Erase the sprite of the creature. | ||||||
| Handle_Flying_Creature_Test_Right_Gap | 45662 | CP 231 | Jump to Handle_Flying_Creature_Set_Gap_Flags if the x position is less than 231. | |||||
| 45664 | JR C,Handle_Flying_Creature_Set_Gap_Flags | |||||||
| 45666 | INC (IX+2) | Move the creature to the room on the right. | ||||||
| 45669 | LD (IX+1),24 | Set the x position to 24. | ||||||
| 45673 | BIT 0,(IX+15) | Return if the creature has not been drawn yet. | ||||||
| 45677 | RET NZ | |||||||
| 45678 | JP RemoveEntity | Erase the sprite of the creature. | ||||||
|
The creature is in a gap in the left or right wall, so set bits 0 and 4 in the contact flags and in E, which makes the ceiling and the floor seem to be present.
|
||||||||
| Handle_Flying_Creature_Set_Gap_Flags | 45681 | EX AF,AF' | Save the new position in AF'. | |||||
| 45682 | LD A,(IX+11) | Fetch the contact flags. | ||||||
| 45685 | OR %00010001 | Set bits 0 and 4. | ||||||
| 45687 | LD (IX+11),A | Store the contact flags. | ||||||
| 45690 | LD A,E | Copy the flags of the room to A. | ||||||
| 45691 | OR %00010001 | Set bits 0 and 4. | ||||||
| 45693 | LD E,A | Store them in E. | ||||||
| 45694 | EX AF,AF' | Restore the new position from AF'. | ||||||
| 45695 | JP Handle_Flying_Creature_Store_X | Jump to Handle_Flying_Creature_Store_X. | ||||||
|
The y position is less than 128. The creature bounces off the ceiling if there is one, and leaves the room by the gap otherwise.
|
||||||||
| Handle_Flying_Creature_Test_Top_Edge | 45698 | CP 76 | Jump to Handle_Flying_Creature_Store_Y if the y position is 76 or more. | |||||
| 45700 | JR NC,Handle_Flying_Creature_Store_Y | |||||||
| 45702 | BIT 0,E | Jump to Handle_Flying_Creature_Test_Top_Gap if the room has no ceiling. | ||||||
| 45704 | JP Z,Handle_Flying_Creature_Test_Top_Gap | |||||||
| 45707 | LD A,(IX+9) | Fetch the y velocity. | ||||||
| 45710 | CPL | Invert it, to bounce off the ceiling. | ||||||
| 45711 | LD (IX+9),A | Store the y velocity. | ||||||
| 45714 | LD A,76 | Set the y position to 76. | ||||||
| 45716 | JP Handle_Flying_Creature_Store_Y | Jump to Handle_Flying_Creature_Store_Y. | ||||||
| Handle_Flying_Creature_Test_Top_Gap | 45719 | CP 42 | Jump to Handle_Flying_Creature_Set_Vertical_Gap_Flags if the y position is 42 or more. | |||||
| 45721 | JR NC,Handle_Flying_Creature_Set_Vertical_Gap_Flags | |||||||
| 45723 | DEC (IX+4) | Move the creature to the room above. | ||||||
| 45726 | LD (IX+3),144 | Set the y position to 144. | ||||||
| 45730 | BIT 0,(IX+15) | Return if the creature has not been drawn yet. | ||||||
| 45734 | RET NZ | |||||||
| 45735 | JP RemoveEntity | Erase the sprite of the creature. | ||||||
| Handle_Flying_Creature_Test_Bottom_Gap | 45738 | CP 191 | Jump to Handle_Flying_Creature_Set_Vertical_Gap_Flags if the y position is less than 191. | |||||
| 45740 | JR C,Handle_Flying_Creature_Set_Vertical_Gap_Flags | |||||||
| 45742 | INC (IX+4) | Move the creature to the room below. | ||||||
| 45745 | LD (IX+3),64 | Set the y position to 64. | ||||||
| 45749 | BIT 0,(IX+15) | Return if the creature has not been drawn yet. | ||||||
| 45753 | RET NZ | |||||||
| 45754 | JP RemoveEntity | Erase the sprite of the creature. | ||||||
|
The creature is in a gap in the ceiling or the floor, so set bits 2 and 6 in the contact flags and in AF', which makes the side walls seem to be present.
|
||||||||
| Handle_Flying_Creature_Set_Vertical_Gap_Flags | 45757 | EX AF,AF' | Save the new position in AF'. | |||||
| 45758 | LD A,(IX+11) | Fetch the contact flags. | ||||||
| 45761 | OR %01000100 | Set bits 2 and 6. | ||||||
| 45763 | LD (IX+11),A | Store the contact flags. | ||||||
| 45766 | EX AF,AF' | Restore the new position from AF'. | ||||||
| 45767 | JP Handle_Flying_Creature_Store_Y | Jump to Handle_Flying_Creature_Store_Y. | ||||||
| Prev: 45018 | Up: Map | Next: 45770 |