Routines |
Prev: E3E1 | Up: Map | Next: E447 |
|
|||||||
Human_WavingSideToSide | E414 | POP HL | Restore human table pointer from the stack. | ||||
WavingSideToSide_DecreaseCountdown | E415 | LD A,(HL) | Decrease the humans action countdown by one. | ||||
E416 | DEC A | ||||||
E417 | LD (HL),A | ||||||
E418 | CP $C8 | Jump to WavingSideToSide_AboutToHide if the humans action countdown (A) is higher than C8. | |||||
E41A | JR NC,WavingSideToSide_AboutToHide | ||||||
E41C | CP $80 | Jump to WavingSideToSide_Action if the humans action countdown (A) is equal to 80. | |||||
E41E | JR Z,WavingSideToSide_Action | ||||||
E420 | JR C,WavingSideToSide_EndCycle | Jump to WavingSideToSide_EndCycle if the humans action countdown (A) is lower than 80. | |||||
Turn the countdown into a number between 0-7 - so it's four cycles left, four cycles right.
|
|||||||
E422 | AND %00000111 | Keep only bits 0-2. | |||||
E424 | CP $04 | Jump to WavingSideToSide_Left if A is lower than 04. | |||||
E426 | JR C,WavingSideToSide_Left | ||||||
E428 | JR WavingSideToSide_Right | Jump to WavingSideToSide_Right. | |||||
Handle the waving, but also give a small chance the human should hide.
|
|||||||
WavingSideToSide_Action | E42A | CALL ShouldHumanHide | Call ShouldHumanHide. | ||||
E42D | JR C,WavingSideToSide_DecreaseCountdown | Jump to WavingSideToSide_DecreaseCountdown if the human is set to start hiding. | |||||
E42F | LD (HL),$C0 | Update the countdown to C0. | |||||
Print the "normal" waving sprite.
|
|||||||
WavingSideToSide_Left | E431 | LD A,$C4 |
|
||||
E433 | JP Draw_Human_Sprite | Jump to Draw_Human_Sprite. | |||||
Print the "mirrored" waving sprite.
|
|||||||
WavingSideToSide_Right | E436 | LD A,$C4 |
|
||||
E438 | JP Draw_Human_Sprite_Mirrored | Jump to Draw_Human_Sprite_Mirrored. | |||||
When the countdown reaches 0A (from 80), jump to WavingSideToSide_Action to start a new cycle.
|
|||||||
WavingSideToSide_EndCycle | E43B | CP $0A | Jump to WavingSideToSide_Action if A is equal to 0A. | ||||
E43D | JR Z,WavingSideToSide_Action | ||||||
The countdown between CE-C9 handles the delay before C8 will hide the human.
|
|||||||
WavingSideToSide_AboutToHide | E43F | LD A,$C0 |
|
||||
E441 | JP NZ,Draw_Human_Sprite | Jump to Draw_Human_Sprite until the countdown equals C8 (from line E418). | |||||
E444 | JP Handler_Human_Hide | Jump to Handler_Human_Hide. |
Prev: E3E1 | Up: Map | Next: E447 |