Prev: EC43 Up: Map Next: ECD8
EC45: Room Event : Book Baddies.
Used by the routine at Update_Room00.
Input
Output
Crash helmet stops Wally from being hit.
Handler_Books EC45 LD A,(Flag_BaddyInit) See if books are already initialised.
EC48 OR A
EC49 JR NZ,Handler_Books_0
Initialise
EC4B LD A,$01 Initialise flag set.
EC4D LD (Flag_BaddyInit),A
EC50 LD A,$58 Set Y position of book 1.
EC52 LD (Book1_Ypos),A
EC55 LD H,A
EC56 LD A,$7A Bitmap for book 1.
EC58 LD L,$70 Set X position and draw.
EC5A LD (BitmapX),HL
EC5D CALL Bitmap16Draw
EC60 LD A,$77 Set Y position for book 2.
EC62 LD (Book2_Ypos),A
EC65 LD H,A
EC66 LD A,$C7 Bitmap for book 2.
EC68 LD (BitmapX),HL Draw book 2 at same X pos as book 1.
EC6B CALL Bitmap16Draw
EC6E RET
Draw
Handler_Books_0 EC6F LD A,(Book1_Ypos) Get y position of book 1.
EC72 LD B,A
EC73 LD H,A
EC74 LD L,$70 Fix x position.
EC76 LD (BitmapX),HL
EC79 LD A,$7A Set bitmap and erase from position.
EC7B CALL Bitmap16Draw
EC7E INC B Move down a pixel.
EC7F LD A,B See if book has hit table.
EC80 CP $80
EC82 JR C,Handler_Books_1
EC84 LD A,$46 If it has, reset to top again.
Handler_Books_1 EC86 LD (Book1_Ypos),A Store new position.
EC89 LD (BitmapY),A
EC8C LD A,$7A Draw book.
EC8E CALL Bitmap16Draw
EC91 LD A,(Pocket1) See if Wally is carrying the Crash Helmet (0F)
EC94 CP $0F
EC96 JR Z,Handler_Books_2
EC98 LD A,(Pocket2)
EC9B CP $0F
EC9D JR Z,Handler_Books_2
EC9F LD B,$10 If he isn't check for a hit and remove 10 energy points.
ECA1 CALL Wally_HitTest
Handler_Books_2 ECA4 LD A,(Book2_Ypos) Do the same for book 2.
ECA7 LD B,A
ECA8 LD H,A
ECA9 LD L,$70
ECAB LD (BitmapX),HL
ECAE LD A,$C7
ECB0 CALL Bitmap16Draw
ECB3 INC B
ECB4 LD A,B
ECB5 CP $80
ECB7 JR C,Handler_Books_3
ECB9 LD A,$46
Handler_Books_3 ECBB LD (Book2_Ypos),A
ECBE LD (BitmapY),A
ECC1 LD A,$C7
ECC3 CALL Bitmap16Draw
ECC6 LD A,(Pocket1)
ECC9 CP $0F
ECCB RET Z
ECCC LD A,(Pocket2)
ECCF CP $0F
ECD1 RET Z
ECD2 LD B,$10
ECD4 CALL Wally_HitTest
ECD7 RET
Prev: EC43 Up: Map Next: ECD8