![]() |
Routines |
| Prev: 40832 | Up: Map | Next: 40906 |
|
Used by the routines at DrawEntity and DisplayEntity.
Does the same as PrepDraw23 for the sprite of the entity in IX (the new sprite). As well as the screen address, it records the width of the sprite in bytes in SpriteWidth, the number of rows to draw in New_Sprite_Row_Count and its height in SpriteHeight. The shifting routine at DrawActorSpriteRow_Aligned is set up for it.
|
||||||||||||||||
| PrepDraw2 | 40863 | CALL FetchActorSprite | Fetch the address of the sprite of the entity with FetchActorSprite. | |||||||||||||
| PrepDraw2_NoFetch | 40866 | LD L,(IX+3) | L=the entity X position, and H=the entity Y position. | |||||||||||||
| 40869 | LD H,(IX+4) | |||||||||||||||
| 40872 | LD A,L | Fetch the X position. | ||||||||||||||
| 40873 | DEC A | Decrease A by one. | ||||||||||||||
| 40874 | RLCA | Multiply by 2. | ||||||||||||||
| 40875 | AND %00001110 | Keep only bits 1-3. | ||||||||||||||
| 40877 | CP 14 | Jump to PrepDraw2_Shift if this is not the maximum offset. | ||||||||||||||
| 40879 | JR NZ,PrepDraw2_Shift | |||||||||||||||
| 40881 | LD A,232 | Use the offset which jumps to the code for sprites which are aligned to a character cell. | ||||||||||||||
|
Self modifying code; this updates the operand of the JR command at 40746.
|
||||||||||||||||
| PrepDraw2_Shift | 40883 | LD (40746),A | Write the offset to 40746. | |||||||||||||
|
A sprite which is aligned to a character cell is two bytes wide, otherwise it is three bytes wide.
|
||||||||||||||||
| 40886 | LD A,2 | A=2. | ||||||||||||||
| 40888 | JR Z,PrepDraw2_Width | Jump to PrepDraw2_Width if the offset was the maximum offset. | ||||||||||||||
| 40890 | INC A | A=3. | ||||||||||||||
| PrepDraw2_Width | 40891 | LD (24080),A | Write the width to SpriteWidth. | |||||||||||||
| 40894 | CALL ScreenAddress | Call ScreenAddress to get the screen address of the position. | ||||||||||||||
| 40897 | LD A,(DE) | Fetch the number of rows in the sprite (the first byte of the sprite data). | ||||||||||||||
| 40898 | LD (24089),A | Write the number of rows to New_Sprite_Row_Count. | ||||||||||||||
| 40901 | LD (24081),A | Write the number of rows to SpriteHeight. | ||||||||||||||
| 40904 | JR PrepDraw23_Finish | Jump to PrepDraw23_Finish to finish preparing the sprite. | ||||||||||||||
|
View the equivalent code in;
|
||||||||||||||||
| Prev: 40832 | Up: Map | Next: 40906 |