Prev: 34684 Up: Map Next: 34745
34695: Draw Actor Sprite
Reload the actor graphic and XOR it via FetchAndDraw.
Input
IX Actor slot
Before After DrawActorSprite After ColouriseSprite
rover-before rover-drawn rover-coloured
Reload the actor graphic and XOR it via FetchAndDraw.
DrawActorSprite 34695 CALL LoadSpritePointers Call LoadSpritePointers.
34698 EXX Switch to the shadow registers.
34699 CALL FetchAndDraw Call FetchAndDraw.
34702 EXX Switch back to the normal registers.
Compare the cached screen MSB with the actor Y.
DrawActorSprite_Fetch 34703 LD A,(24150) Subtract the actor Y from SpriteCachedY.
34706 SUB (IX+4)
34709 JP Z,ContinueSpriteWrite_Row Jump to ContinueSpriteWrite_Row if they match.
34712 JP M,DrawActorSprite_Draw Jump to DrawActorSprite_Draw if the result is negative.
34715 LD C,A Store the row difference in the row counter.
34716 LD A,(24154) Jump to ContinueSpriteWrite_Row if the difference is taller than the old sprite's rows in SpriteCachedRows.
34719 CP C
34720 JP C,ContinueSpriteWrite_Row
34723 SUB C Subtract it from SpriteCachedRows and jump to WriteSpriteRow.
34724 LD (24154),A
34727 JP WriteSpriteRow
DrawActorSprite_Draw 34730 EXX Switch register sets and negate the row difference.
34731 NEG
34733 LD C,A
34734 LD A,(24153) Jump to ContinueSpriteWrite_Next if the difference is taller than the new sprite's rows in SpriteRowsLeft.
34737 CP C
34738 JP C,ContinueSpriteWrite_Next
34741 SUB C Subtract it from the row count and jump to ContinueSpriteWrite_Done.
34742 JP ContinueSpriteWrite_Done
Prev: 34684 Up: Map Next: 34745