![]() |
Routines |
| Prev: 60605 | Up: Map | Next: 60718 |
|
Handler for the object types 128 to 135 the four guardians that stand in the caves: the imps (128 129 132 and 133 see Sprite_Imp_1), the spiders (130 and 131 see Sprite_Spider_1) and the bats (134 and 135 see Sprite_Bat_1). Bit 0 of the type is the frame of the animation and it is flipped whenever bit 0 of the tick counter is set. Place_Guardian puts a guardian in its room, where it stays until Sabreman leaves the room (see Handle_Collectable_Remove).
A guardian is destroyed by one kind of weapon, which depends on bits 1 and 2 of its type: the daggers (the types 108 and 109) destroy a spider, the arrows (110 and 111) destroy the imp of the type 132 and the fire (112 and 113) destroys a bat. The imp of the type 128 cannot be destroyed. When a guardian is destroyed its collected flag is set (see Set_Collected_Flag), the flag at Creature_Spawn_Flag is set and the guardian explodes (see Destroy_Creature).
A guardian that is touched by Sabreman makes him tumble (bit 7 of his redraw flags is set) and pushes him to the left (his x velocity is set to 254).
|
||||||||
| Handle_Guardian | 60618 | CALL StoreEntity | Save the state of the guardian. | |||||
| 60621 | LD A,(36636) | Fetch the room x of Sabreman. | ||||||
| 60624 | CP (IX+2) | Jump to Handle_Collectable_Remove to remove the guardian if it is in a different room x. | ||||||
| 60627 | JP NZ,Handle_Collectable_Remove | |||||||
| 60630 | LD A,(36638) | Fetch the room y of Sabreman. | ||||||
| 60633 | CP (IX+4) | Jump to Handle_Collectable_Remove to remove the guardian if it is in a different room y. | ||||||
| 60636 | JP NZ,Handle_Collectable_Remove | |||||||
| 60639 | LD A,(36566) | Fetch the tick counter. | ||||||
| 60642 | AND %00000001 | Test bit 0 of the tick counter. | ||||||
| 60644 | JR Z,Handle_Guardian_Check_Weapon | Jump to Handle_Guardian_Check_Weapon if it is not set. | ||||||
| 60646 | LD A,(IX+0) | Fetch the type of the guardian. | ||||||
| 60649 | XOR %00000001 | Flip the frame of the animation. | ||||||
| 60651 | LD (IX+0),A | Store the type. | ||||||
| Handle_Guardian_Check_Weapon | 60654 | CALL Check_Weapon_Hit | Check whether a weapon has hit the guardian. | |||||
| 60657 | LD A,D | Jump to Handle_Guardian_Check_Sabreman if no weapon has hit it. | ||||||
| 60658 | AND A | |||||||
| 60659 | JR Z,Handle_Guardian_Check_Sabreman | |||||||
| 60661 | LD A,E | Fetch the type of the weapon into A. | ||||||
| 60662 | CP 108 | Jump to Handle_Guardian_Check_Sabreman if the weapon is not a dagger, an arrow or fire. | ||||||
| 60664 | JR C,Handle_Guardian_Check_Sabreman | |||||||
| 60666 | RRA | Halve the type of the weapon. | ||||||
| 60667 | DEC A | Subtract one. | ||||||
| 60668 | AND %00000011 | Keep the two low bits, which gives the kind of weapon (1 for the daggers, 2 for the arrows and 3 for the fire). | ||||||
| 60670 | LD E,A | Store the kind in E. | ||||||
| 60671 | LD A,(IX+0) | Fetch the type of the guardian. | ||||||
| 60674 | RRA | Halve it. | ||||||
| 60675 | AND %00000011 | Keep the two low bits, which gives the kind of weapon that destroys the guardian. | ||||||
| 60677 | CP E | Jump to Handle_Guardian_Check_Sabreman if the weapon is not the right one for the guardian. | ||||||
| 60678 | JR NZ,Handle_Guardian_Check_Sabreman | |||||||
| 60680 | LD HL,60918 | Point HL at Guardian_Table_First_Flag. | ||||||
| 60683 | CALL Set_Collected_Flag | Set the collected flag of this guardian. | ||||||
| 60686 | LD A,1 | Set the flag that shows that a guardian has been destroyed. | ||||||
| 60688 | LD (36601),A | |||||||
| 60691 | JP Destroy_Creature | Jump to Destroy_Creature to make the guardian explode. | ||||||
| Handle_Guardian_Check_Sabreman | 60694 | CALL Check_Sabreman_Contact_Clear_Result | Check for contact with Sabreman, without testing his sprite id. | |||||
| 60697 | BIT 2,C | Jump to Update_Object_Sprite to draw the guardian if Sabreman is not touching it. | ||||||
| 60699 | JP Z,Update_Object_Sprite | |||||||
| 60702 | LD A,(36649) | Fetch the redraw flags of Sabreman. | ||||||
| 60705 | OR %10000000 | Set bit 7, which makes him tumble. | ||||||
| 60707 | LD (36649),A | Store the flags. | ||||||
| 60710 | LD A,254 | Set the x velocity of Sabreman to 254 which pushes him to the left. | ||||||
| 60712 | LD (36640),A | Store the velocity. | ||||||
| 60715 | JP Update_Object_Sprite | Jump to Update_Object_Sprite to draw the guardian. | ||||||
| Prev: 60605 | Up: Map | Next: 60718 |