![]() |
Routines |
| Prev: 44139 | Up: Map | Next: 44372 |
|
The handler for the top half of a broken egg (object 73), which is deadly to touch. Only one is active at a time (EggTopFlag is set), and none are while EggTopDisabledFlag is set. An inactive egg top becomes active with a chance of one in sixteen on each frame. While it is active it is moved with gravity and makes a sound when it lands. Until then it hangs in the air.
|
||||||||
|
Hang in the air until this egg is chosen to drop.
|
||||||||
| HandleEggTop | 44307 | CALL SetDeadlyFlags | Call SetDeadlyFlags. | |||||
| 44310 | CALL SetPixelAdjustments_Appearing | Call SetPixelAdjustments_Appearing. | ||||||
| 44313 | LD A,(23355) | Return if EggTopDisabledFlag is set. | ||||||
| 44316 | AND A | |||||||
| 44317 | RET NZ | |||||||
| 44318 | BIT 2,(IX+13) | Jump to HandleEggTop_MoveActive if this egg top is already active. | ||||||
| 44322 | JR NZ,HandleEggTop_MoveActive | |||||||
| 44324 | LD HL,23354 | Point HL at EggTopFlag. | ||||||
| 44327 | LD A,(HL) | Return if EggTopFlag is set. | ||||||
| 44328 | AND A | |||||||
| 44329 | RET NZ | |||||||
| 44330 | LD A,(23301) | Fetch RandomSeed2. | ||||||
| 44333 | CP 16 | Return unless it is less than 16. | ||||||
| 44335 | RET NC | |||||||
| 44336 | SET 2,(IX+13) | Set bit 2 of the state. | ||||||
| 44340 | LD (HL),1 | Write 1 to EggTopFlag. | ||||||
| 44342 | RET | Return. | ||||||
|
The egg top is active, so let it fall.
|
||||||||
| HandleEggTop_MoveActive | 44343 | CALL ApplyGravityAndMove | Call ApplyGravityAndMove. | |||||
| 44346 | CALL PlayLandingSoundOnce | Call PlayLandingSoundOnce. | ||||||
| 44349 | BIT 2,(IX+12) | Jump to HandleEggTop_Landed if it has landed. | ||||||
| 44353 | JR NZ,HandleEggTop_Landed | |||||||
| 44355 | CALL PlaySoundFromHeight | Call PlaySoundFromHeight. | ||||||
| HandleEggTop_Redraw | 44358 | JP SetWipeAndDrawFlags | Jump to SetWipeAndDrawFlags. | |||||
|
The egg top has landed, so another one may drop.
|
||||||||
| HandleEggTop_Landed | 44361 | RES 2,(IX+13) | Reset bit 2 of the state. | |||||
| 44365 | LD HL,23354 | Point HL at EggTopFlag. | ||||||
| 44368 | LD (HL),0 | Write 0 to EggTopFlag. | ||||||
| 44370 | JR HandleEggTop_Redraw | Jump to HandleEggTop_Redraw. | ||||||
|
View the equivalent code in;
|
||||||||
| Prev: 44139 | Up: Map | Next: 44372 |