![]() |
Routines |
| Prev: 52703 | Up: Map | Next: 52809 |
|
Used by the routine at HandleHumanTop.
Does all of the work for the top half of the player, which is a copy of the bottom half, placed 12 above it. The top half has no height, and is ignored in the 3D calculations. If it has been flagged as dead, this starts the death sparkles. Every so often the player looks to one side or the other: this picks a head that looks that way and keeps it for eight frames.
|
||||||||
|
Start the death sparkles if the top half is flagged as dead.
|
||||||||
| HandlePlayerTop | 52706 | LD A,(23491) | Fetch the final animation flag from FinalAnimationFlag. | |||||
| 52709 | AND A | |||||||
| 52710 | JR NZ,HandlePlayerTop_Copy | Jump to HandlePlayerTop_Copy if it is set. | ||||||
| 52712 | BIT 6,(IX+13) | Jump to StartDeathSparkles to start the death sparkles if the top half is flagged as dead. | ||||||
| 52716 | JP NZ,StartDeathSparkles | |||||||
|
Copy the bottom half and place the top half 12 above it.
|
||||||||
| HandlePlayerTop_Copy | 52719 | PUSH IX | Point DE at the top half (using the stack). | |||||
| 52721 | POP DE | |||||||
| 52722 | LD HL,65504 | Point HL at the bottom half, which is 32 bytes before. | ||||||
| 52725 | ADD HL,DE | |||||||
| 52726 | PUSH HL | Point IY at the bottom half (using the stack). | ||||||
| 52727 | POP IY | |||||||
| 52729 | INC DE | Point DE at the X coordinate of the top half. | ||||||
| 52730 | INC HL | Point HL at the X coordinate of the bottom half. | ||||||
| 52731 | LD BC,7 | Set the number of bytes to 7. | ||||||
| 52734 | LDIR | Copy the coordinates, the size and the flags. | ||||||
| 52736 | LD (IX+6),0 | Set the height of the top half to zero. | ||||||
| 52740 | SET 1,(IX+7) | Flag the top half to be ignored in the 3D calculations. | ||||||
| 52744 | LD A,(IX+13) | Fetch the flags. | ||||||
| 52747 | AND %00001111 | Keep the counter for looking to one side. | ||||||
| 52749 | JR Z,HandlePlayerTop_Look | Jump to HandlePlayerTop_Look if the counter has run out. | ||||||
| 52751 | DEC (IX+13) | Count it down. | ||||||
| 52754 | JR HandlePlayerTop_SetZ | Jump to HandlePlayerTop_SetZ. | ||||||
|
Pick a head that looks to one side, or keep the current one.
|
||||||||
| HandlePlayerTop_Look | 52756 | LD A,(23461) | Fetch a random number from RandomSeed2. | |||||
| 52759 | CP 2 | Jump to HandlePlayerTop_LookOneWay if it is less than 2. | ||||||
| 52761 | JR C,HandlePlayerTop_LookOneWay | |||||||
| 52763 | CP 254 | Jump to HandlePlayerTop_LookOtherWay if it is at least 254. | ||||||
| 52765 | JR NC,HandlePlayerTop_LookOtherWay | |||||||
| 52767 | LD A,(IY+0) | Fetch the graphic number of the bottom half. | ||||||
| HandlePlayerTop_SetGraphic | 52770 | ADD A,16 | Add 16 to it to get the graphic number of the top half. | |||||
| 52772 | LD (IX+0),A | Set the graphic number of the top half. | ||||||
| HandlePlayerTop_SetZ | 52775 | LD A,(IY+3) | Fetch the Z coordinate of the bottom half. | |||||
| 52778 | ADD A,12 | Add 12 to it. | ||||||
| 52780 | LD (IX+3),A | Set the Z coordinate of the top half. | ||||||
| 52783 | CALL FlagOverlappingObjects | Flag the objects that overlap the player to be drawn. | ||||||
| 52786 | RET | Return. | ||||||
| HandlePlayerTop_LookOneWay | 52787 | LD A,(IY+0) | Fetch the graphic number of the bottom half. | |||||
| 52790 | AND %11111000 | Keep the direction the player is facing. | ||||||
| 52792 | OR %00000110 | Choose the head that looks one way. | ||||||
| HandlePlayerTop_SetCounter | 52794 | LD (IX+13),8 | Make the player look that way for eight frames. | |||||
| 52798 | JR HandlePlayerTop_SetGraphic | Jump to HandlePlayerTop_SetGraphic. | ||||||
| HandlePlayerTop_LookOtherWay | 52800 | LD A,(IY+0) | Fetch the graphic number of the bottom half. | |||||
| 52803 | AND %11111000 | Keep the direction the player is facing. | ||||||
| 52805 | OR %00000111 | Choose the head that looks the other way. | ||||||
| 52807 | JR HandlePlayerTop_SetCounter | Jump to HandlePlayerTop_SetCounter. | ||||||
| Prev: 52703 | Up: Map | Next: 52809 |