Routines |
Prev: 63368 | Up: Map | Next: 63678 |
Used by the routine at 63368.
|
||||||||
B is used as the "currently processed monster ID"; we work backwards from Ralph, to Lizzy and last George.
|
||||||||
Handler_CollisionMonsters | 63381 | LD B,3 | B=3 (total number of monsters/ players). | |||||
Handler_CollisionMonsters_Loop | 63383 | LD A,(HL) | A=*HL. | |||||
63384 | AND A | Jump to Handler_CollisionMonsters_Next if A is zero. | ||||||
63385 | JR Z,Handler_CollisionMonsters_Next | |||||||
63387 | CP 193 | Jump to Handler_CollisionMonsters_0 if A is higher than 193. | ||||||
63389 | JR NC,Handler_CollisionMonsters_0 | |||||||
63391 | AND %00111111 | Keep only bits 0-5. | ||||||
63393 | CP 50 | Jump to Handler_CollisionMonsters_0 if A is higher than 50. | ||||||
63395 | JR NC,Handler_CollisionMonsters_0 | |||||||
63397 | LD A,B | A=currently processed monster ID. | ||||||
63398 | CALL SetIYMonsterData | Call SetIYMonsterData. | ||||||
IX now contains a pointer to the currently processed monster state data.
|
||||||||
63401 | PUSH IY | IX=IY using the stack. | ||||||
63403 | POP IX | |||||||
63405 | LD A,(HL) | A=*HL. | ||||||
63406 | CALL Convert_To_MonsterData | Call Convert_To_MonsterData, on return - A will contain the action monster ID and IY the monster state. | ||||||
Is the action targeting the currently processed monster?
|
||||||||
63409 | CP B | Jump to Handler_CollisionMonsters_Next if the action is for the monster currently being processed. | ||||||
63410 | JR Z,Handler_CollisionMonsters_Next | |||||||
63412 | LD A,(IY+2) | Jump to Handler_CollisionMonsters_Punched if *IY+2 is not zero. | ||||||
63415 | AND A | |||||||
63416 | JR NZ,Handler_CollisionMonsters_Punched | |||||||
63418 | LD A,(IY+3) | A=*IY+3. | ||||||
63421 | XOR (IX+3) | |||||||
63424 | JR Z,Handler_CollisionMonsters_Punched | Jump to Handler_CollisionMonsters_Punched if the result is zero. | ||||||
63426 | LD A,(IX+3) | A=*IX+3. | ||||||
63429 | LD (IY+3),A | Write A to *IY+3. | ||||||
Handler_CollisionMonsters_Punched | 63432 | LD (IY+0),10 | Write 10 to *IY+0. | |||||
63436 | LD (IY+4),1 | Write 1 to *IY+4. | ||||||
Take off two hit points from the monsters energy.
|
||||||||
63440 | LD A,2 | A=2. | ||||||
63442 | CALL Handler_DecreaseEnergy | Call Handler_DecreaseEnergy. | ||||||
|
||||||||
63445 | LD A,6 | Write melody ID 6 to *MelodyID. | ||||||
63447 | LD (65421),A | |||||||
Handler_CollisionMonsters_Next | 63450 | DEC HL | Decrease HL by one. | |||||
63451 | DJNZ Handler_CollisionMonsters_Loop | Decrease counter by one and loop back to Handler_CollisionMonsters_Loop until counter is zero. | ||||||
63453 | RET | Return. | ||||||
Handler_CollisionMonsters_0 | 63454 | LD A,(HL) | A=*HL. | |||||
63455 | PUSH HL | Stash HL and BC on the stack. | ||||||
63456 | PUSH BC | |||||||
63457 | CP 5 | Jump to Housekeeping_CollisionMonsters_Next if A is equal to 5. | ||||||
63459 | JR Z,Housekeeping_CollisionMonsters_Next | |||||||
63461 | CP 64 | Jump to Handler_Vehicle_Punched if A is lower than 64. | ||||||
63463 | JR C,Handler_Vehicle_Punched | |||||||
63465 | CP 121 | Jump to Handler_CollisionMonsters_1 if A is equal to 121. | ||||||
63467 | JR Z,Handler_CollisionMonsters_1 | |||||||
63469 | CP 123 | Jump to Housekeeping_CollisionMonsters_Next if A is equal to 123. | ||||||
63471 | JR Z,Housekeeping_CollisionMonsters_Next | |||||||
63473 | CP 127 | Jump to Housekeeping_CollisionMonsters_Next if A is equal to 127. | ||||||
63475 | JR Z,Housekeeping_CollisionMonsters_Next | |||||||
63477 | CP 117 | Jump to Housekeeping_CollisionMonsters_Next if A is equal to 117. | ||||||
63479 | JR Z,Housekeeping_CollisionMonsters_Next | |||||||
63481 | CP 119 | Jump to Housekeeping_CollisionMonsters_Next if A is equal to 119. | ||||||
63483 | JR Z,Housekeeping_CollisionMonsters_Next | |||||||
63485 | CP 221 | Jump to Handler_CollisionMonsters_3 if A is lower than 221. | ||||||
63487 | JR C,Handler_CollisionMonsters_3 | |||||||
63489 | JP Handler_Helicopter_Punched | Jump to Handler_Helicopter_Punched. | ||||||
Tidies the stack before moving onto the next monster.
|
||||||||
Housekeeping_CollisionMonsters_Next | 63492 | POP BC | Restore BC and HL from the stack. | |||||
63493 | POP HL | |||||||
63494 | JR Handler_CollisionMonsters_Next | Jump to Handler_CollisionMonsters_Next. | ||||||
Handles when a vehicle has been punched.
|
||||||||
Handler_Vehicle_Punched | 63496 | LD A,24 | Reset *VehicleCounter back to 24. | |||||
63498 | LD (54273),A | |||||||
63501 | LD A,B | A=currently processed monster ID. | ||||||
63502 | LD DE,1283 | DE=1283. | ||||||
63505 | CALL Handler_AddPoints | Call Handler_AddPoints. | ||||||
63508 | LD A,(54276) | A=*VehicleYPosition. | ||||||
63511 | AND %00111111 | Keep only bits 0-5. | ||||||
63513 | INC A | Increment A by one. | ||||||
63514 | LD B,A | B=A. | ||||||
63515 | LD A,(54275) | C=*VehicleXPosition. | ||||||
63518 | LD C,A | |||||||
63519 | LD A,119 | A=explosion sprite (119).
|
||||||
63521 | CALL PrintSprite | Call PrintSprite. | ||||||
|
||||||||
63524 | LD A,6 | Write melody ID 6 to *MelodyID. | ||||||
63526 | LD (65421),A | |||||||
63529 | JR Housekeeping_CollisionMonsters_Next | Jump to Housekeeping_CollisionMonsters_Next. | ||||||
Handler_CollisionMonsters_1 | 63531 | LD A,B | A=B. | |||||
63532 | CALL SetIYMonsterData | Call SetIYMonsterData. | ||||||
63535 | LD A,(54278) | A=*TrainXPosition. | ||||||
63538 | SUB 4 | A-=4. | ||||||
63540 | CP (IY+9) | Compare A with *IY+9. | ||||||
63543 | LD A,(54279) | A=*TrainYPosition. | ||||||
63546 | JR NC,Handler_CollisionMonsters_2 | Jump to Handler_CollisionMonsters_2 if {} is higher. | ||||||
63548 | XOR %10000000 | Flip bit 7. | ||||||
Handler_CollisionMonsters_2 | 63550 | OR %01000000 | Set bit 6. | |||||
63552 | LD (54279),A | Write A to *TrainYPosition. | ||||||
63555 | LD A,B | A=B. | ||||||
63556 | LD DE,515 | DE=515. | ||||||
63559 | CALL Handler_AddPoints | Call Handler_AddPoints. | ||||||
|
||||||||
63562 | LD A,6 | Write melody ID 6 to *MelodyID. | ||||||
63564 | LD (65421),A | |||||||
63567 | JR Housekeeping_CollisionMonsters_Next | Jump to Housekeeping_CollisionMonsters_Next. | ||||||
Handler_CollisionMonsters_3 | 63569 | LD A,B | A=B. | |||||
63570 | CALL SetIYMonsterData | Call SetIYMonsterData. | ||||||
63573 | LD A,(IY+4) | Jump to Housekeeping_CollisionMonsters_Next if *IY+4 is not zero. | ||||||
63576 | AND A | |||||||
63577 | JR NZ,Housekeeping_CollisionMonsters_Next | |||||||
63579 | LD A,(IY+2) | Jump to Housekeeping_CollisionMonsters_Next if *IY+2 is zero. | ||||||
63582 | AND A | |||||||
63583 | JR Z,Housekeeping_CollisionMonsters_Next | |||||||
63585 | LD (IY+0),26 | Write 26 to *IY+0. | ||||||
63589 | LD (IY+7),4 | Write 4 to *IY+7. | ||||||
63593 | LD A,B | A=B. | ||||||
63594 | LD D,1 | D=1. | ||||||
63596 | LD E,3 | E=3. | ||||||
63598 | CALL Handler_AddPoints | Call Handler_AddPoints. | ||||||
|
||||||||
63601 | LD A,6 | Write melody ID 6 to *MelodyID. | ||||||
63603 | LD (65421),A | |||||||
63606 | JR Housekeeping_CollisionMonsters_Next | Jump to Housekeeping_CollisionMonsters_Next. | ||||||
Handles when a helicopter has been punched.
|
||||||||
Handler_Helicopter_Punched | 63608 | PUSH AF | Stash AF on the stack. | |||||
63609 | LD A,B | A=B. | ||||||
63610 | LD D,5 | D=5. | ||||||
63612 | LD E,3 | E=3. | ||||||
63614 | CALL Handler_AddPoints | Call Handler_AddPoints. | ||||||
63617 | POP AF | Restore AF from the stack. | ||||||
63618 | SUB 230 | A-=230. | ||||||
63620 | ADD A,A | A*=4. | ||||||
63621 | ADD A,A | |||||||
63622 | LD H,0 | H=0. | ||||||
63624 | LD L,A | L=A. | ||||||
63625 | LD DE,53927 | HL+=Table_SomethingHelicopters. | ||||||
63628 | ADD HL,DE | |||||||
63629 | LD A,(HL) | Jump to Housekeeping_CollisionMonsters_Next if *HL is zero. | ||||||
63630 | AND A | |||||||
63631 | JP Z,Housekeeping_CollisionMonsters_Next | |||||||
63634 | LD A,(54262) | Decrease *NumberOnScreenHelicopters by one. | ||||||
63637 | DEC A | |||||||
63638 | LD (54262),A | |||||||
63641 | LD A,(HL) | A=*HL. | ||||||
63642 | LD (HL),0 | Write 0 to *HL. | ||||||
63644 | INC HL | Increment HL by one. | ||||||
63645 | RRCA | RRCA. | ||||||
63646 | AND %00000111 | Keep only bits 0-2. | ||||||
63648 | CP 3 | Jump to SetExplosionCoordinates if A is lower than 3. | ||||||
63650 | JR C,SetExplosionCoordinates | |||||||
63652 | CP 6 | Jump to SetExplosionCoordinates if A is higher than 6. | ||||||
63654 | JR NC,SetExplosionCoordinates | |||||||
Set BC to the screen co-ordinates for the explosion.
|
||||||||
63656 | LD B,(HL) | B=*HL. | ||||||
63657 | INC HL | Increment HL by one. | ||||||
63658 | LD C,(HL) | C=*HL. | ||||||
Displays an explosion sprite.
|
||||||||
Handler_Helicopter_Explosion | 63659 | LD A,119 | A=explosion sprite (119).
|
|||||
63661 | CALL PrintSprite | Call PrintSprite. | ||||||
|
||||||||
63664 | LD A,6 | Write melody ID 6 to *MelodyID. | ||||||
63666 | LD (65421),A | |||||||
63669 | JP Housekeeping_CollisionMonsters_Next | Jump to Housekeeping_CollisionMonsters_Next. | ||||||
Set BC to the screen co-ordinates for the explosion.
|
||||||||
SetExplosionCoordinates | 63672 | LD C,(HL) | C=*HL. | |||||
63673 | INC HL | Increment HL by two. | ||||||
63674 | INC HL | |||||||
63675 | LD B,(HL) | B=*HL. | ||||||
63676 | JR Handler_Helicopter_Explosion | Jump to Handler_Helicopter_Explosion. |
Prev: 63368 | Up: Map | Next: 63678 |