![]() |
Routines |
| Prev: CDDF | Up: Map | Next: CE49 |
|
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 0C 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 | CDE2 | LD A,($5BC3) | Fetch the final animation flag from FinalAnimationFlag. | |||||
| CDE5 | AND A | |||||||
| CDE6 | JR NZ,HandlePlayerTop_Copy | Jump to HandlePlayerTop_Copy if it is set. | ||||||
| CDE8 | BIT 6,(IX+$0D) | Jump to StartDeathSparkles to start the death sparkles if the top half is flagged as dead. | ||||||
| CDEC | JP NZ,StartDeathSparkles | |||||||
|
Copy the bottom half and place the top half 0C above it.
|
||||||||
| HandlePlayerTop_Copy | CDEF | PUSH IX | Point DE at the top half (using the stack). | |||||
| CDF1 | POP DE | |||||||
| CDF2 | LD HL,$FFE0 | Point HL at the bottom half, which is 20 bytes before. | ||||||
| CDF5 | ADD HL,DE | |||||||
| CDF6 | PUSH HL | Point IY at the bottom half (using the stack). | ||||||
| CDF7 | POP IY | |||||||
| CDF9 | INC DE | Point DE at the X coordinate of the top half. | ||||||
| CDFA | INC HL | Point HL at the X coordinate of the bottom half. | ||||||
| CDFB | LD BC,$0007 | Set the number of bytes to 07. | ||||||
| CDFE | LDIR | Copy the coordinates, the size and the flags. | ||||||
| CE00 | LD (IX+$06),$00 | Set the height of the top half to zero. | ||||||
| CE04 | SET 1,(IX+$07) | Flag the top half to be ignored in the 3D calculations. | ||||||
| CE08 | LD A,(IX+$0D) | Fetch the flags. | ||||||
| CE0B | AND %00001111 | Keep the counter for looking to one side. | ||||||
| CE0D | JR Z,HandlePlayerTop_Look | Jump to HandlePlayerTop_Look if the counter has run out. | ||||||
| CE0F | DEC (IX+$0D) | Count it down. | ||||||
| CE12 | JR HandlePlayerTop_SetZ | Jump to HandlePlayerTop_SetZ. | ||||||
|
Pick a head that looks to one side, or keep the current one.
|
||||||||
| HandlePlayerTop_Look | CE14 | LD A,($5BA5) | Fetch a random number from RandomSeed2. | |||||
| CE17 | CP $02 | Jump to HandlePlayerTop_LookOneWay if it is less than 02. | ||||||
| CE19 | JR C,HandlePlayerTop_LookOneWay | |||||||
| CE1B | CP $FE | Jump to HandlePlayerTop_LookOtherWay if it is at least FE. | ||||||
| CE1D | JR NC,HandlePlayerTop_LookOtherWay | |||||||
| CE1F | LD A,(IY+$00) | Fetch the graphic number of the bottom half. | ||||||
| HandlePlayerTop_SetGraphic | CE22 | ADD A,$10 | Add 10 to it to get the graphic number of the top half. | |||||
| CE24 | LD (IX+$00),A | Set the graphic number of the top half. | ||||||
| HandlePlayerTop_SetZ | CE27 | LD A,(IY+$03) | Fetch the Z coordinate of the bottom half. | |||||
| CE2A | ADD A,$0C | Add 0C to it. | ||||||
| CE2C | LD (IX+$03),A | Set the Z coordinate of the top half. | ||||||
| CE2F | CALL FlagOverlappingObjects | Flag the objects that overlap the player to be drawn. | ||||||
| CE32 | RET | Return. | ||||||
| HandlePlayerTop_LookOneWay | CE33 | LD A,(IY+$00) | Fetch the graphic number of the bottom half. | |||||
| CE36 | AND %11111000 | Keep the direction the player is facing. | ||||||
| CE38 | OR %00000110 | Choose the head that looks one way. | ||||||
| HandlePlayerTop_SetCounter | CE3A | LD (IX+$0D),$08 | Make the player look that way for eight frames. | |||||
| CE3E | JR HandlePlayerTop_SetGraphic | Jump to HandlePlayerTop_SetGraphic. | ||||||
| HandlePlayerTop_LookOtherWay | CE40 | LD A,(IY+$00) | Fetch the graphic number of the bottom half. | |||||
| CE43 | AND %11111000 | Keep the direction the player is facing. | ||||||
| CE45 | OR %00000111 | Choose the head that looks the other way. | ||||||
| CE47 | JR HandlePlayerTop_SetCounter | Jump to HandlePlayerTop_SetCounter. | ||||||
| Prev: CDDF | Up: Map | Next: CE49 |