Routines |
Prev: 58253 | Up: Map | Next: 58388 |
|
|||||||
Human_WavingOverHead | 58337 | POP HL | Restore human table pointer from the stack. | ||||
WavingOverHead_DecreaseCountdown | 58338 | LD A,(HL) | Decrease the humans action countdown by one. | ||||
58339 | DEC A | ||||||
58340 | LD (HL),A | ||||||
58341 | CP 200 | Jump to WavingOverHead_AboutToHide if the humans action countdown (A) is higher than 200. | |||||
58343 | JR NC,WavingOverHead_AboutToHide | ||||||
58345 | CP 128 | Jump to WavingOverHead_Action if the humans action countdown (A) is equal to 128. | |||||
58347 | JR Z,WavingOverHead_Action | ||||||
58349 | JR C,WavingOverHead_EndCycle | Jump to WavingOverHead_EndCycle if the humans action countdown (A) is lower than 128. | |||||
Turn the countdown into a number between 0-3 - so it's two cycles left, two cycles right.
|
|||||||
58351 | AND %00000011 | Keep only bits 0-1. | |||||
58353 | CP 2 | Jump to WavingOverHead_Left if A is lower than 2. | |||||
58355 | JR C,WavingOverHead_Left | ||||||
58357 | JR WavingOverHead_Right | Jump to WavingOverHead_Right. | |||||
Handle the waving, but also give a small chance the human should hide.
|
|||||||
WavingOverHead_Action | 58359 | CALL ShouldHumanHide | Call ShouldHumanHide. | ||||
58362 | JR C,WavingOverHead_DecreaseCountdown | Jump to WavingOverHead_DecreaseCountdown if the human is set to start hiding. | |||||
58364 | LD (HL),160 | Update the countdown to 160. | |||||
Print the "normal" waving sprite.
|
|||||||
WavingOverHead_Left | 58366 | LD A,200 |
|
||||
58368 | JP Draw_Human_Sprite | Jump to Draw_Human_Sprite. | |||||
Print the "mirrored" waving sprite.
|
|||||||
WavingOverHead_Right | 58371 | LD A,200 |
|
||||
58373 | JP Draw_Human_Sprite_Mirrored | Jump to Draw_Human_Sprite_Mirrored. | |||||
When the countdown reaches 10 (from 128), jump to WavingOverHead_Action to start a new cycle.
|
|||||||
WavingOverHead_EndCycle | 58376 | CP 10 | Jump to WavingOverHead_Action if A is equal to 10. | ||||
58378 | JR Z,WavingOverHead_Action | ||||||
The countdown between 206-201 handles the delay before 200 will hide the human.
|
|||||||
WavingOverHead_AboutToHide | 58380 | LD A,192 |
|
||||
58382 | JP NZ,Draw_Human_Sprite | Jump to Draw_Human_Sprite until the countdown equals 200 (from line 58341). | |||||
58385 | JP Handler_Human_Hide | Jump to Handler_Human_Hide. |
Prev: 58253 | Up: Map | Next: 58388 |