![]() |
Routines |
| Prev: 730D | Up: Map | Next: 7378 |
|
Used by the routines at HandleMonster, HandlePeel, HandlePikeAndTinCan, HandleCheese, HandleTackWasherBolt, HandleChocolate, HandleSugar and HandleCustard.
Tests whether the actor has been hit by a flour shot (they are in the two actor slots after Charlie). A shot is within range if it is between 0A pixels to the left and 12 pixels to the right of the actor, and between 12 pixels above and 0A pixels below it. If it is then the actor is coloured white, bit 7 of its ID is set and the counter in byte 07 is set to 40. The speeds of the shot are copied to the actor, the shot is made to explode, and the rising tone is played.
|
||||||||
| TestFlourCollision | 7317 | LD DE,$0008 | Set the size of an actor to 08. | |||||
| 731A | LD HL,$5F3D | Point HL at ActorFlourShots. | ||||||
| 731D | LD B,$02 | Set the slot counter to 02 (the number of slots for flour shots). | ||||||
| TestFlourCollision_Loop | 731F | PUSH HL | Stash the address of the slot on the stack. | |||||
| 7320 | LD A,(HL) | Fetch the actor ID of the slot. | ||||||
| 7321 | AND A | Is the slot empty? | ||||||
| 7322 | JR Z,TestFlourCollision_Next | Jump to TestFlourCollision_Next if it is. | ||||||
| 7324 | CP $26 | Jump to TestFlourCollision_Next if the shot has exploded. | ||||||
| 7326 | JR NC,TestFlourCollision_Next | |||||||
| 7328 | INC HL | Move on to the horizontal co-ordinate of the shot. | ||||||
| 7329 | LD A,(HL) | Fetch the horizontal co-ordinate of the shot. | ||||||
| 732A | SUB (IX+$01) | Subtract the horizontal co-ordinate of the actor. | ||||||
| 732D | JP P,TestFlourCollision_Right | Jump to TestFlourCollision_Right if the shot is to the right of the actor. | ||||||
| 7330 | NEG | Make the distance positive. | ||||||
| 7332 | LD C,$0A | Set the distance which is allowed to the left to 0A. | ||||||
| 7334 | JR TestFlourCollision_Horizontal | Jump to TestFlourCollision_Horizontal. | ||||||
| TestFlourCollision_Right | 7336 | LD C,$12 | Set the distance which is allowed to the right to 12. | |||||
| TestFlourCollision_Horizontal | 7338 | CP C | Compare the distance with the distance which is allowed. | |||||
| 7339 | JR NC,TestFlourCollision_Next | Jump to TestFlourCollision_Next if the shot is too far away. | ||||||
| 733B | INC HL | Move on to the vertical co-ordinate of the shot. | ||||||
| 733C | LD A,(HL) | Fetch the vertical co-ordinate of the shot. | ||||||
| 733D | SUB (IX+$02) | Subtract the vertical co-ordinate of the actor. | ||||||
| 7340 | JP P,TestFlourCollision_Below | Jump to TestFlourCollision_Below if the shot is below the actor. | ||||||
| 7343 | NEG | Make the distance positive. | ||||||
| 7345 | LD C,$12 | Set the distance which is allowed above to 12. | ||||||
| 7347 | JR TestFlourCollision_Vertical | Jump to TestFlourCollision_Vertical. | ||||||
| TestFlourCollision_Below | 7349 | LD C,$0A | Set the distance which is allowed below to 0A. | |||||
| TestFlourCollision_Vertical | 734B | CP C | Compare the distance with the distance which is allowed. | |||||
| 734C | JR C,TestFlourCollision_Hit | Jump to TestFlourCollision_Hit if the shot has hit the actor. | ||||||
| TestFlourCollision_Next | 734E | POP HL | Restore the address of the slot from the stack. | |||||
| 734F | ADD HL,DE | Move on to the next slot. | ||||||
| 7350 | DJNZ TestFlourCollision_Loop | Decrease the slot counter by one and loop back to TestFlourCollision_Loop until both slots have been tried. | ||||||
| 7352 | RET | Return. | ||||||
|
The shot has hit the actor.
|
||||||||
| TestFlourCollision_Hit | 7353 | LD (IX+$03),$47 | Set the actor colour to 47 (white). | |||||
| 7357 | SET 7,(IX+$00) | Set bit 7 of the actor ID. | ||||||
| 735B | LD (IX+$07),$40 | Set the hit counter (byte 07 of the actor) to 40. | ||||||
| 735F | INC HL | Move on to the horizontal speed of the shot. | ||||||
| 7360 | INC HL | |||||||
| 7361 | LD A,(HL) | Fetch the horizontal speed of the shot. | ||||||
| 7362 | LD (IX+$04),A | Update the horizontal speed of the actor. | ||||||
| 7365 | INC HL | Move on to the vertical speed of the shot. | ||||||
| 7366 | LD A,(HL) | Fetch the vertical speed of the shot. | ||||||
| 7367 | LD (IX+$05),A | Update the vertical speed of the actor. | ||||||
| 736A | POP HL | Restore the address of the shot from the stack. | ||||||
| 736B | PUSH IX | Save the pointer to the current actor on the stack. | ||||||
| 736D | PUSH HL | Save the address of the shot on the stack. | ||||||
| 736E | POP IX | Point IX at the shot. | ||||||
| 7370 | CALL ExplodeFlourShot | Make the shot explode using ExplodeFlourShot. | ||||||
| 7373 | POP IX | Restore the pointer to the current actor from the stack. | ||||||
| 7375 | JP PlayRisingTone | Jump to PlayRisingTone to play the rising tone. | ||||||
| Prev: 730D | Up: Map | Next: 7378 |