Prev: E414 Up: Map Next: E535
E447: Human 07-0C: Human With Rifle (Shooter)
Human_Shooter E447 POP HL Restore human table pointer from the stack.
Shooter_DecreaseCountdown E448 LD A,(HL) Decrease the humans action countdown by one.
E449 DEC A
E44A LD (HL),A
E44B CP $C8 Jump to Shooter_AboutToHide if the humans action countdown (A) is higher than C8.
E44D JP NC,Shooter_AboutToHide
E450 CP $14 Jump to Shooter_EndCycle if the humans action countdown (A) is lower than 14.
E452 JR C,Shooter_EndCycle
E454 AND %00011111 Keep only bits 0-4.
E456 JR Z,Shooter_Action Jump to Shooter_Action if the result is zero.
E458 LD A,(HL) A=*HL.
E459 RLCA RLCA.
E45A RLCA
E45B RLCA
E45C AND %00000011 Keep only bits 0-1.
E45E CALL $DBD9 Call DBD9.
E461 JR Human_Shooter_0 Jump to Human_Shooter_0.
Handle the action, but also give a small chance the human should hide.
Shooter_Action E463 CALL ShouldHumanHide Call ShouldHumanHide.
E466 JR C,Shooter_DecreaseCountdown Jump to Shooter_DecreaseCountdown if the human is set to start hiding.
E468 CALL TargetMonster Call TargetMonster.
E46B EX AF,AF' Exchange the AF register with the shadow AF register.
E46C AND %00000011 Keep only bits 0-1.
E46E RRCA Rotate A right three positions (bits 0 to 2 are now in positions 5 to 7).
E46F RRCA
E470 RRCA
E471 OR %00011111 Set bits 0-4.
E473 LD (HL),A Write A to *HL.
Human_Shooter_0 E474 INC HL Increment HL by one.
E475 LD A,(HL) A=*HL.
E476 CP B Compare A with B.
E477 INC HL Increment HL by one.
E478 LD A,(HL) A=*HL.
E479 DEC HL Decrease HL by two.
E47A DEC HL
E47B JR Z,Human_Shooter_1 Jump to Human_Shooter_1 if HL is zero.
E47D JR NC,Human_Shooter_2 Jump to Human_Shooter_2 if {} is higher.
E47F CP C Jump to Human_Shooter_5 if A is equal to C.
E480 JR Z,Human_Shooter_5
E482 JR C,Human_Shooter_4 Jump to Human_Shooter_4 if A is lower than C.
E484 JR Human_Shooter_6 Jump to Human_Shooter_6.
Human_Shooter_1 E486 CP C Jump to Human_Shooter_3 if A is lower than C.
E487 JR C,Human_Shooter_3
E489 JR Human_Shooter_11 Jump to Human_Shooter_11.
Human_Shooter_2 E48B CP C Jump to Human_Shooter_9 if A is equal to C.
E48C JR Z,Human_Shooter_9
E48E JR C,Human_Shooter_8 Jump to Human_Shooter_8 if A is lower than C.
E490 JR Human_Shooter_10 Jump to Human_Shooter_10.
Human_Shooter_3 E492 LD B,$CA
ID Sprite
CA human-202-left
E494 JR Human_Shooter_12 Jump to Human_Shooter_12.
Human_Shooter_4 E496 LD B,$CC
ID Sprite
CC human-204-left
E498 JR Human_Shooter_7 Jump to Human_Shooter_7.
Human_Shooter_5 E49A LD B,$CE
ID Sprite
CE human-206-left
E49C JR Human_Shooter_7 Jump to Human_Shooter_7.
Human_Shooter_6 E49E LD B,$D0
ID Sprite
D0 human-208-left
Human_Shooter_7 E4A0 CALL RandomNumber Call RandomNumber.
E4A3 CP $04 Compare A with 04.
E4A5 LD A,B A=B.
E4A6 JP NC,Draw_Human_Sprite Jump to Draw_Human_Sprite if {} is higher.
E4A9 LD C,$00 C=00.
E4AB CALL Human_Shooter_13 Call Human_Shooter_13.
E4AE JP Draw_Human_Sprite Jump to Draw_Human_Sprite.
Human_Shooter_8 E4B1 LD B,$CC
ID Sprite
CC human-204-left
E4B3 JR Human_Shooter_12 Jump to Human_Shooter_12.
Human_Shooter_9 E4B5 LD B,$CE
ID Sprite
CE human-206-left
E4B7 JR Human_Shooter_12 Jump to Human_Shooter_12.
Human_Shooter_10 E4B9 LD B,$D0
ID Sprite
D0 human-208-left
E4BB JR Human_Shooter_12 Jump to Human_Shooter_12.
Human_Shooter_11 E4BD LD B,$D2
ID Sprite
D2 human-210-left
E4BF JR Human_Shooter_7 Jump to Human_Shooter_7.
Human_Shooter_12 E4C1 CALL RandomNumber Call RandomNumber.
E4C4 CP $04 Compare A with 04...
E4C6 LD A,B A=B.
E4C7 JP NC,Draw_Human_Sprite_Mirrored Jump to Draw_Human_Sprite_Mirrored if A is higher than 04.
E4CA LD C,$80 C=80.
E4CC CALL Human_Shooter_13 Call Human_Shooter_13.
E4CF JP Draw_Human_Sprite_Mirrored Jump to Draw_Human_Sprite_Mirrored.
When the countdown reaches 0A (from 80), jump to Shooter_Action to start a new cycle.
Shooter_EndCycle E4D2 CP $0A Jump to Shooter_Action if A is equal to 0A.
E4D4 JR Z,Shooter_Action
The countdown between CE-C9 handles the delay before C8 will hide the human.
Shooter_AboutToHide E4D6 LD A,$C0
ID Sprite
C0 human-192-left
E4D8 JP NZ,Draw_Human_Sprite Jump to Draw_Human_Sprite until the countdown equals C8 (from line E44B).
E4DB JP Handler_Human_Hide Jump to Handler_Human_Hide.
Human_Shooter_13 E4DE LD A,($D3F8) Compare *NumberBullets with 08...
E4E1 CP $08
E4E3 LD A,B A=B.
E4E4 RET Z Return if *NumberBullets is equal to 08 on line E4E1.
E4E5 LD DE,$D2BC DE=D2BC.
E4E8 EX AF,AF' Exchange the AF register with the shadow AF register.
Human_Shooter_14 E4E9 INC DE Increment DE by three.
E4EA INC DE
E4EB INC DE
E4EC LD A,(DE) Jump to Human_Shooter_14 if *DE is not zero.
E4ED AND A
E4EE JR NZ,Human_Shooter_14
E4F0 LD A,B A=B.
E4F1 SUB $C8 A-=C8.
E4F3 RRCA RRCA.
E4F4 OR C Set the bits from C.
E4F5 LD (DE),A Write A to *DE.
E4F6 INC DE Increment DE by one.
E4F7 INC HL Increment HL by one.
E4F8 LD C,(HL) C=*HL.
E4F9 INC HL Increment HL by one.
E4FA LD B,(HL) B=*HL.
E4FB CP $04 Jump to Human_Shooter_15 if A is not equal to 04.
E4FD JR NZ,Human_Shooter_15
E4FF INC C Increment C by one.
E500 JR Human_Shooter_19 Jump to Human_Shooter_19.
Human_Shooter_15 E502 CP $82 Jump to Human_Shooter_16 if A is not equal to 82.
E504 JR NZ,Human_Shooter_16
E506 INC B Increment B by one.
E507 JR Human_Shooter_19 Jump to Human_Shooter_19.
Human_Shooter_16 E509 CP $02 Jump to Human_Shooter_17 if A is equal to 02.
E50B JR Z,Human_Shooter_17
E50D CP $01 Jump to Human_Shooter_17 if A is equal to 01.
E50F JR Z,Human_Shooter_17
E511 CP $85 Jump to Human_Shooter_18 if A is not equal to 85.
E513 JR NZ,Human_Shooter_18
Human_Shooter_17 E515 INC B Increment B by one.
E516 INC C Increment C by one.
E517 JR Human_Shooter_19 Jump to Human_Shooter_19.
Human_Shooter_18 E519 AND %00000011 Keep only bits 0-1.
E51B CP $03 Jump to Human_Shooter_19 if A is not equal to 03.
E51D JR NZ,Human_Shooter_19
E51F INC B Increment B by one.
Human_Shooter_19 E520 LD A,C Write C to *DE.
E521 LD (DE),A
E522 INC DE Increment DE by one.
E523 LD A,B Write B to *DE.
E524 LD (DE),A
E525 DEC HL Decrease HL by two.
E526 DEC HL
E527 LD A,($D3F8) Increment *NumberBullets by one.
E52A INC A
E52B LD ($D3F8),A
E52E LD A,$02 Write melody ID 02 to *MelodyID.
E530 LD ($FF8D),A
E533 EX AF,AF' Exchange the AF register with the shadow AF register.
E534 RET Return.
Prev: E414 Up: Map Next: E535