![]() |
Routines |
| Prev: 25180 | Up: Map | Next: 25368 |
|
Used by the routine at 25180.
|
||||
| CollisionCup | 25306 | LD HL,(24069) | HL=PlayerMapPosition. | |
| 25309 | SLA L | |||
| 25311 | RL H | |||
| 25313 | CALL 25171 | Call 25171. | ||
| 25316 | LD C,H | |||
| 25317 | LD HL,29215 | HL=pointer to CupTable. | ||
| 25320 | LD B,8 | B=8 (set a counter for the 8 cups). | ||
|
Fetch the address of the cup from CupTable.
|
||||
| CollisionCup_Loop | 25322 | LD E,(HL) | E=LSB of the cup map address. | |
| 25323 | INC HL | Increment HL by one. | ||
| 25324 | LD D,(HL) | D=MSB of the cup map address. | ||
| 25325 | INC HL | Increment HL by one, ready to process the next cup. | ||
|
Check this is still a valid cup (that it hasn't been collected already).
|
||||
| 25326 | INC DE | Increment DE by two (point to the sprite ID). | ||
| 25327 | INC DE | |||
| 25328 | LD A,(DE) | If this is not a cup (the sprite ID is not 32), then jump to CollisionCup_Next. | ||
| 25329 | CP 32 | |||
| 25331 | JR NZ,CollisionCup_Next | |||
|
This is still a valid cup, so process it.
|
||||
| 25333 | DEC DE | Decrease DE by two (go back to the start of the map record). | ||
| 25334 | DEC DE | |||
| 25335 | LD A,(DE) | Fetch the cup X position. | ||
| 25336 | SUB C | |||
| 25337 | JR NC,CollisionCup_Test_X | Make sure we have a positive byte. | ||
| 25339 | NEG | |||
| CollisionCup_Test_X | 25341 | CP 12 | If 12 is jump to CollisionCup_Test_Y. | |
| 25343 | JR C,CollisionCup_Test_Y | |||
| CollisionCup_Next | 25345 | DJNZ CollisionCup_Loop | Decrease counter by one and loop back to CollisionCup_Loop until counter is zero. | |
| 25347 | JP 25165 | Jump to 25165. | ||
| CollisionCup_Test_Y | 25350 | LD A,(DE) | Fetch the cup X position. | |
| 25351 | INC DE | Increment DE by one. | ||
| 25352 | LD H,A | H=cup X position. | ||
| 25353 | LD A,(DE) | Fetch the cup Y position. | ||
| 25354 | LD D,A | D=cup Y position. | ||
| 25355 | CALL 27440 | Call 27440. | ||
| 25358 | EX DE,HL | Swap the DE and HL registers. | ||
| 25359 | CALL 27435 | Call 27435. | ||
| 25362 | EX DE,HL | Swap the DE and HL registers. | ||
| 25363 | LD B,H | B=H. | ||
| 25364 | LD C,L | C=L. | ||
| 25365 | JP 25106 | Jump to 25106. | ||
|
View the equivalent code in;
|
||||
| Prev: 25180 | Up: Map | Next: 25368 |