![]() |
Routines |
| Prev: ECBD | Up: Map | Next: ED2E |
|
Handler for the object types 80 to 87 the four guardians that stand in the caves: the imps (80 81 84 and 85 see Sprite_Imp_1), the spiders (82 and 83 see Sprite_Spider_1) and the bats (86 and 87 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 6C and 6D) destroy a spider, the arrows (6E and 6F) destroy the imp of the type 84 and the fire (70 and 71) destroys a bat. The imp of the type 80 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 FE).
|
||||||||
| Handle_Guardian | ECCA | CALL StoreEntity | Save the state of the guardian. | |||||
| ECCD | LD A,($8F1C) | Fetch the room x of Sabreman. | ||||||
| ECD0 | CP (IX+$02) | Jump to Handle_Collectable_Remove to remove the guardian if it is in a different room x. | ||||||
| ECD3 | JP NZ,Handle_Collectable_Remove | |||||||
| ECD6 | LD A,($8F1E) | Fetch the room y of Sabreman. | ||||||
| ECD9 | CP (IX+$04) | Jump to Handle_Collectable_Remove to remove the guardian if it is in a different room y. | ||||||
| ECDC | JP NZ,Handle_Collectable_Remove | |||||||
| ECDF | LD A,($8ED6) | Fetch the tick counter. | ||||||
| ECE2 | AND %00000001 | Test bit 0 of the tick counter. | ||||||
| ECE4 | JR Z,Handle_Guardian_Check_Weapon | Jump to Handle_Guardian_Check_Weapon if it is not set. | ||||||
| ECE6 | LD A,(IX+$00) | Fetch the type of the guardian. | ||||||
| ECE9 | XOR %00000001 | Flip the frame of the animation. | ||||||
| ECEB | LD (IX+$00),A | Store the type. | ||||||
| Handle_Guardian_Check_Weapon | ECEE | CALL Check_Weapon_Hit | Check whether a weapon has hit the guardian. | |||||
| ECF1 | LD A,D | Jump to Handle_Guardian_Check_Sabreman if no weapon has hit it. | ||||||
| ECF2 | AND A | |||||||
| ECF3 | JR Z,Handle_Guardian_Check_Sabreman | |||||||
| ECF5 | LD A,E | Fetch the type of the weapon into A. | ||||||
| ECF6 | CP $6C | Jump to Handle_Guardian_Check_Sabreman if the weapon is not a dagger, an arrow or fire. | ||||||
| ECF8 | JR C,Handle_Guardian_Check_Sabreman | |||||||
| ECFA | RRA | Halve the type of the weapon. | ||||||
| ECFB | DEC A | Subtract one. | ||||||
| ECFC | AND %00000011 | Keep the two low bits, which gives the kind of weapon (01 for the daggers, 02 for the arrows and 03 for the fire). | ||||||
| ECFE | LD E,A | Store the kind in E. | ||||||
| ECFF | LD A,(IX+$00) | Fetch the type of the guardian. | ||||||
| ED02 | RRA | Halve it. | ||||||
| ED03 | AND %00000011 | Keep the two low bits, which gives the kind of weapon that destroys the guardian. | ||||||
| ED05 | CP E | Jump to Handle_Guardian_Check_Sabreman if the weapon is not the right one for the guardian. | ||||||
| ED06 | JR NZ,Handle_Guardian_Check_Sabreman | |||||||
| ED08 | LD HL,$EDF6 | Point HL at Guardian_Table_First_Flag. | ||||||
| ED0B | CALL Set_Collected_Flag | Set the collected flag of this guardian. | ||||||
| ED0E | LD A,$01 | Set the flag that shows that a guardian has been destroyed. | ||||||
| ED10 | LD ($8EF9),A | |||||||
| ED13 | JP Destroy_Creature | Jump to Destroy_Creature to make the guardian explode. | ||||||
| Handle_Guardian_Check_Sabreman | ED16 | CALL Check_Sabreman_Contact_Clear_Result | Check for contact with Sabreman, without testing his sprite id. | |||||
| ED19 | BIT 2,C | Jump to Update_Object_Sprite to draw the guardian if Sabreman is not touching it. | ||||||
| ED1B | JP Z,Update_Object_Sprite | |||||||
| ED1E | LD A,($8F29) | Fetch the redraw flags of Sabreman. | ||||||
| ED21 | OR %10000000 | Set bit 7, which makes him tumble. | ||||||
| ED23 | LD ($8F29),A | Store the flags. | ||||||
| ED26 | LD A,$FE | Set the x velocity of Sabreman to FE which pushes him to the left. | ||||||
| ED28 | LD ($8F20),A | Store the velocity. | ||||||
| ED2B | JP Update_Object_Sprite | Jump to Update_Object_Sprite to draw the guardian. | ||||||
| Prev: ECBD | Up: Map | Next: ED2E |