![]() |
Routines |
| Prev: 9ABE | Up: Map | Next: 9B63 |
|
Updates an entity of the type 08. Field 20 counts the frames and field 23 holds the state of the entity. The entity moves up or down on its third coordinate depending on field 1F.
|
||||||||
| UpdateGrowingBubbleEntity | 9AD9 | INC (IX+$20) | Increase field 20 of the entity by one. | |||||
| 9ADC | LD A,(IX+$01) | Fetch the frame of the entity. | ||||||
| 9ADF | AND %00011111 | Keep the number of the frame. | ||||||
| 9AE1 | CP $06 | Jump to UpdateGrowingBubbleEntity_Speed unless it is 06. | ||||||
| 9AE3 | JR NZ,UpdateGrowingBubbleEntity_Speed | |||||||
| 9AE5 | BIT 1,(IX+$23) | Jump to MakeCreature if bit 1 of field 23 of the entity is set. | ||||||
| 9AE9 | JP NZ,MakeCreature | |||||||
| UpdateGrowingBubbleEntity_Speed | 9AEC | LD A,(IX+$1F) | Read field 1F of the entity. | |||||
| 9AEF | INC A | Add one. | ||||||
| 9AF0 | LD HL,$0028 | Set the speed to 28 to move up. | ||||||
| 9AF3 | CP $24 | Jump to UpdateGrowingBubbleEntity_SetSpeed if it is below 24. | ||||||
| 9AF5 | JR C,UpdateGrowingBubbleEntity_SetSpeed | |||||||
| 9AF7 | LD HL,$FFD8 | Set the speed to FFD8 to move down. | ||||||
| UpdateGrowingBubbleEntity_SetSpeed | 9AFA | LD (IX+$14),H | Store the first byte of the speed in field 14 of the entity. | |||||
| 9AFD | LD (IX+$15),L | Store the second byte of the speed in field 15 of the entity. | ||||||
| 9B00 | LD L,(IX+$23) | Read field 23 of the entity. | ||||||
| 9B03 | BIT 0,L | Jump to UpdateGrowingBubbleEntity_Change if bit 0 is set. | ||||||
| 9B05 | JR NZ,UpdateGrowingBubbleEntity_Change | |||||||
| 9B07 | LD A,(IX+$01) | Fetch the frame of the entity. | ||||||
| 9B0A | AND %00011111 | Keep the number of the frame. | ||||||
| 9B0C | CP $05 | Jump to MakeEntitySound if it is below 05. | ||||||
| 9B0E | JP C,MakeEntitySound | |||||||
| 9B11 | JR NZ,UpdateGrowingBubbleEntity_Countdown | Jump to UpdateGrowingBubbleEntity_Countdown if it is above 05. | ||||||
| 9B13 | LD A,($5F9A) | Fetch the low byte of the seed from RandomNumber_Seed and keep it in B. | ||||||
| 9B16 | LD B,A | |||||||
| 9B17 | AND %11000000 | Use bits 6-7. | ||||||
| 9B19 | JR Z,UpdateGrowingBubbleEntity_Change | Jump to UpdateGrowingBubbleEntity_Change if they are zero. | ||||||
| 9B1B | LD A,B | Fetch the random number. | ||||||
| 9B1C | AND %00111111 | Use bits 0-5. | ||||||
| 9B1E | OR %10000000 | Set bit 7. | ||||||
| 9B20 | LD (IX+$11),A | Set the heading. | ||||||
| 9B23 | LD A,($5F9B) | Fetch the random number from 5F9B. | ||||||
| 9B26 | AND %10111100 | Use bits 2-5 and 7. | ||||||
| 9B28 | ADD A,$40 | Add 40. | ||||||
| 9B2A | LD (IX+$23),A | Store it in field 23 of the entity. | ||||||
| 9B2D | INC (IX+$01) | Move onto the next frame. | ||||||
| 9B30 | CALL SetEntitySize | Call SetEntitySize to set the sprite of the entity. | ||||||
| 9B33 | JP UpdateEntity_Move | Jump to UpdateEntity_Move to carry on updating the entity. | ||||||
| UpdateGrowingBubbleEntity_Countdown | 9B36 | LD A,($A2DD) | Fetch the low byte of the frame counter from FrameCounter. | |||||
| 9B39 | RRA | Rotate bit 0 into the carry flag. | ||||||
| 9B3A | JR C,UpdateGrowingBubbleEntity_Done | Jump to UpdateGrowingBubbleEntity_Done if it is set. | ||||||
| 9B3C | LD A,L | Read field 23 of the entity. | ||||||
| 9B3D | SUB $04 | Subtract 04. | ||||||
| 9B3F | JR NC,UpdateGrowingBubbleEntity_Store | Jump to UpdateGrowingBubbleEntity_Store if there was no carry. | ||||||
| 9B41 | LD A,$01 | Set the value to 01. | ||||||
| UpdateGrowingBubbleEntity_Store | 9B43 | LD (IX+$23),A | Store it in field 23 of the entity. | |||||
| UpdateGrowingBubbleEntity_Done | 9B46 | JP UpdateEntity_Move | Jump to UpdateEntity_Move to carry on updating the entity. | |||||
| UpdateGrowingBubbleEntity_Change | 9B49 | CALL PlaySlowFall | Call PlaySlowFall. | |||||
| 9B4C | LD A,(IX+$01) | Fetch the frame of the entity. | ||||||
| 9B4F | AND %11100000 | Use bits 5-7. | ||||||
| 9B51 | OR %00001000 | Set the number of the frame to 08. | ||||||
| 9B53 | LD (IX+$01),A | Store it. | ||||||
| 9B56 | CALL SetEntitySize | Call SetEntitySize to set the sprite of the entity. | ||||||
| 9B59 | LD (IX+$1C),$51 | Set field 1C of the entity to 51. | ||||||
| 9B5D | LD (IX+$23),$82 | Set field 23 of the entity to 82. | ||||||
| 9B61 | JR UpdateGrowingBubbleEntity_Done | Jump to UpdateGrowingBubbleEntity_Done. | ||||||
| Prev: 9ABE | Up: Map | Next: 9B63 |