Prev: DA71 Up: Map Next: DBB4
DB7E: Target A Monster
Used by the routines at Human_Lobber and Human_Shooter.
TargetMonster DB7E XOR A Write 00 to *D214.
DB7F LD ($D214),A
DB82 CALL RandomNumber Get a random number between 0-3.
DB85 AND %00000011
Note; CharacterPicker increments A on entry.
ConvertToMonsterId DB87 CALL CharacterPicker Call CharacterPicker.
This entry point is used by the routine at DBD9.
CheckIfMonsterIsAlive DB8A CP $C8 Jump to SetTargetedMonster_XPos if the monster state is lower than C8.
DB8C JR C,SetTargetedMonster_XPos
DB8E LD A,$80 Write 80 to *D214.
DB90 LD ($D214),A
The monster ID e.g. 01 - George, 02 - Lizzy and 03 Ralph.
DB93 LD A,B A=the selected monster ID.
Try again with the next monster in sequence.
DB94 JR ConvertToMonsterId Jump to ConvertToMonsterId.
SetTargetedMonster_XPos DB96 LD A,($D214) A=*D214.
DB99 OR B Set the bits from B.
DB9A EX AF,AF' Exchange the AF register with the shadow AF register.
DB9B LD A,(DE) A=the targeted monsters X position.
DB9C INC A Increment A by two.
DB9D INC A
DB9E LD B,A B=A.
DB9F CP $64 Jump to SetTargetedMonster_YPos if A is lower than 64.
DBA1 JR C,SetTargetedMonster_YPos
DBA3 LD B,$00 B=00.
SetTargetedMonster_YPos DBA5 INC DE Increment DE by one.
DBA6 LD A,(DE) A=the targeted monsters y position.
DBA7 INC A Increment A by one.
DBA8 LD C,A C=A.
DBA9 CP $64 Jump to TargetMonster_0 if A is lower than 64.
DBAB JR C,TargetMonster_0
DBAD LD C,$00 C=00.
TargetMonster_0 DBAF XOR A Write 00 to *D214.
DBB0 LD ($D214),A
DBB3 RET Return.
Prev: DA71 Up: Map Next: DBB4