Prev: 55367 Up: Map Next: 55438
55397: Check Monsters Defeated
Used by the routine at StartGame.
Checks whether all four monsters have been destroyed and their fragments have gone. If so, the game is over (see GameOver). Returns if any monster is still alive, or any of its fragments is still moving.
Return if any monster is still alive.
CheckMonstersDefeated 55397 LD HL,48478 Point HL at the first monster, set the distance from one object to the next (16 bytes), set a counter for four monsters and clear A.
55400 LD DE,16
55403 LD B,4
55405 XOR A
CheckMonstersDefeated_Monsters 55406 OR (HL) Combine the type of the monster with the others, and loop back until all four have been checked.
55407 ADD HL,DE
55408 DJNZ CheckMonstersDefeated_Monsters
55410 RET NZ Return if any monster is still alive.
Return if any fragment is still in the view.
55411 LD IX,48334 Point IX at the first of the four fragments, and set a counter for four.
55415 LD B,4
CheckMonstersDefeated_Fragments 55417 LD A,(IX+0) Jump to CheckMonstersDefeated_Next if the object is not a fragment.
55420 SUB 140
55422 CP 4
55424 JR NC,CheckMonstersDefeated_Next
55426 BIT 1,(IX+7) Return if the fragment has been drawn, because it is still in view.
55430 RET NZ
CheckMonstersDefeated_Next 55431 ADD IX,DE Move on to the next object and loop back until all four have been checked.
55433 DJNZ CheckMonstersDefeated_Fragments
55435 JP GameOver Finish the game.
Prev: 55367 Up: Map Next: 55438