![]() |
Routines |
| Prev: 39817 | Up: Map | Next: 39962 |
|
Updates an entity of the type 17 which is made from the third kind of creature at CreatureTemplates. Field 35 counts down the frames between random changes of its speed and its direction.
|
||||||||
| UpdateWhirlerEntity | 39865 | CALL IncreaseEntityCounter | Call IncreaseEntityCounter. | |||||
| 39868 | BIT 7,(IX+35) | Test bit 7 of field 35 of the entity. | ||||||
| 39872 | CALL NZ,ResetEntityMovement | Call ResetEntityMovement if it is set. | ||||||
| 39875 | DEC (IX+35) | Decrease field 35 of the entity by one. | ||||||
| 39878 | JP NZ,UpdateEntity_Move | Jump to UpdateEntity_Move to carry on updating the entity unless it is zero. | ||||||
| 39881 | LD A,(24475) | Fetch the random number from 24475. | ||||||
| 39884 | LD (IX+29),48 | Set field 29 of the entity to 48. | ||||||
| 39888 | RLA | Rotate bit 7 of the random number into the carry flag. | ||||||
| 39889 | JR C,UpdateWhirlerEntity_Speed | Jump to UpdateWhirlerEntity_Speed if it is set. | ||||||
| 39891 | LD (IX+29),99 | Set field 29 of the entity to 99. | ||||||
| UpdateWhirlerEntity_Speed | 39895 | AND %11100000 | Use bits 5-7 of the rotated value. | |||||
| 39897 | JR NZ,UpdateWhirlerEntity_Delay | Jump to UpdateWhirlerEntity_Delay unless they are all zero. | ||||||
| 39899 | LD (IX+18),3 | Set field 18 of the entity to 3. | ||||||
| UpdateWhirlerEntity_Delay | 39903 | LD A,(24474) | Fetch the low byte of the seed from RandomNumber_Seed and keep it in B. | |||||
| 39906 | LD B,A | |||||||
| 39907 | AND %00111111 | Use bits 0-5. | ||||||
| 39909 | LD (IX+35),A | Store it as the new delay in field 35 of the entity. | ||||||
| 39912 | LD A,B | Fetch the random number. | ||||||
| 39913 | AND %11000000 | Use bits 6-7. | ||||||
| 39915 | JR NZ,UpdateWhirlerEntity_Direction | Jump to UpdateWhirlerEntity_Direction unless they are both zero. | ||||||
| 39917 | LD (IX+16),0 | Set the speed to 0. | ||||||
| 39921 | JP UpdateEntity_Move | Jump to UpdateEntity_Move to carry on updating the entity. | ||||||
| UpdateWhirlerEntity_Direction | 39924 | RRA | Shift bits 6-7 of the random number... | |||||
| 39925 | RRA | ...down to bits 4-5. | ||||||
| 39926 | AND %00110000 | Use bits 4-5. | ||||||
| 39928 | ADD A,16 | Add 16. | ||||||
| 39930 | LD B,A | Keep the new value in B. | ||||||
| 39931 | LD A,(IX+16) | Fetch the speed. | ||||||
| 39934 | AND %00001111 | Use bits 0-3. | ||||||
| 39936 | OR B | Combine them with the new value. | ||||||
| 39937 | LD (IX+16),A | Set the speed. | ||||||
| 39940 | LD A,(24475) | Fetch the random number from 24475. | ||||||
| 39943 | AND %00001111 | Use bits 0-3. | ||||||
| 39945 | LD (IX+32),A | Set field 32 of the entity, the wanted heading. | ||||||
| 39948 | CALL FacePlayer | Call FacePlayer to choose the direction towards the player. | ||||||
| 39951 | LD A,(IX+32) | Read field 32 of the entity. | ||||||
| 39954 | OR %10000000 | Set bit 7. | ||||||
| 39956 | LD (IX+17),A | Set the heading. | ||||||
| 39959 | JP UpdateEntity_Move | Jump to UpdateEntity_Move to carry on updating the entity. | ||||||
| Prev: 39817 | Up: Map | Next: 39962 |