![]() |
Routines |
| Prev: AF43 | Up: Map | Next: AF87 |
|
Used by the routines at RunFrame and UpdateEntities.
Moves the entity on to the next frame of its animation every other frame. The counter in field 1C controls the speed, and field 1D holds the first and last frame numbers.
|
||||||||
| AnimateEntity | AF48 | LD A,($A2DD) | Fetch the frame counter. | |||||
| AF4B | RRA | Move its low bit into the carry flag. | ||||||
| AF4C | RET NC | Return on every other frame. | ||||||
| AF4D | LD A,(IX+$1C) | Fetch the animation counter and keep it in B. | ||||||
| AF50 | LD B,A | |||||||
| AF51 | SUB $40 | Count it down by 40. | ||||||
| AF53 | JR NC,AnimateEntity_Store | Jump to AnimateEntity_Store if it had not yet reached the next frame. | ||||||
| AF55 | LD A,(IX+$01) | Fetch the frame of the entity. | ||||||
| AF58 | AND %00001111 | Keep the frame number. | ||||||
| AF5A | INC A | Move on to the next frame. | ||||||
| AF5B | LD E,A | Keep the next frame in E. | ||||||
| AF5C | LD A,(IX+$1D) | Fetch the first and last frame numbers and keep them in D. | ||||||
| AF5F | LD D,A | |||||||
| AF60 | RRCA | Move the last frame number down to bits 0-3. | ||||||
| AF61 | RRCA | |||||||
| AF62 | RRCA | |||||||
| AF63 | RRCA | |||||||
| AF64 | AND %00001111 | Keep the last frame number. | ||||||
| AF66 | CP E | Compare it with the next frame. | ||||||
| AF67 | JR NC,AnimateEntity_Frame | Jump to AnimateEntity_Frame if the next frame is still within the animation. | ||||||
| AF69 | LD A,D | Fetch the first and last frame numbers again. | ||||||
| AF6A | AND %00001111 | Keep the first frame number. | ||||||
| AF6C | LD E,A | Use the first frame, so that the animation repeats. | ||||||
| AnimateEntity_Frame | AF6D | LD A,(IX+$01) | Fetch the frame of the entity. | |||||
| AF70 | AND %11110000 | Keep the flags in bits 4-7. | ||||||
| AF72 | OR E | Combine them with the new frame number. | ||||||
| AF73 | LD (IX+$01),A | Store the new frame. | ||||||
| AF76 | LD A,B | Move bits 4-5 of the animation counter up to bits 6-7. | ||||||
| AF77 | ADD A,A | |||||||
| AF78 | ADD A,A | |||||||
| AF79 | AND %11000000 | Keep those bits. | ||||||
| AF7B | OR (IX+$1C) | Combine them with the animation counter. | ||||||
| AF7E | EX AF,AF' | Save it. | ||||||
| AF7F | CALL SetEntitySize | Set the sprite size for the new frame. | ||||||
| AF82 | EX AF,AF' | Restore the animation counter. | ||||||
| AnimateEntity_Store | AF83 | LD (IX+$1C),A | Store the animation counter. | |||||
| AF86 | RET | Return. | ||||||
| Prev: AF43 | Up: Map | Next: AF87 |