Prev: E6DC Up: Map Next: E762
E72F: Write Game Sprite Buffer
Writes a sprite into the in-game room buffer. Clone of WriteSpriteBuffer.
Input
A Starting sprite ID
B Vertical position
C Horizontal position
D Height
E Width
WriteGameSpriteBuffer E72F PUSH AF Stash the registers this tile walk uses.
E730 PUSH BC
E731 PUSH DE
E732 PUSH HL
E733 DEC A Start one ID before the first tile so the increment lands on it.
E734 LD ($F336),A Write the tile ID to *ActiveSpriteID.
E737 LD A,E Remember the remaining width in *ActiveSpriteWidth.
E738 LD ($F335),A
WriteGameSpriteBuffer_NextRow E73B LD A,($F335) Reload the remaining width.
E73E LD E,A
E73F PUSH BC Stash the position and size.
E740 PUSH DE
E741 CALL ConvertCoordinateToBufferOffset Convert this tile into a room-buffer offset.
E744 POP DE Restore the position and size.
E745 POP BC
WriteGameSpriteBuffer_NextTile E746 LD A,($F336) A=*ActiveSpriteID.
E749 INC A Advance to the next tile ID.
E74A CP $00 Jump to WriteGameSpriteBuffer_WriteTile if the tile ID wrapped.
E74C JR Z,WriteGameSpriteBuffer_WriteTile
E74E LD ($F336),A Write it back to *ActiveSpriteID.
WriteGameSpriteBuffer_WriteTile E751 CALL PopulateGameRoomBuffer Write that tile into the game room buffer.
E754 DEC E Move one column across.
E755 JR NZ,WriteGameSpriteBuffer_NextTile Jump to WriteGameSpriteBuffer_NextTile until this row is complete.
E757 DEC D Move on to the next row of tiles.
E758 JR Z,WriteGameSpriteBuffer_Done Jump to WriteGameSpriteBuffer_Done if every row is written.
E75A DEC B Move one row up.
E75B JR WriteGameSpriteBuffer_NextRow Jump to WriteGameSpriteBuffer_NextRow.
WriteGameSpriteBuffer_Done E75D POP HL Restore HL, DE, BC and AF from the stack.
E75E POP DE
E75F POP BC
E760 POP AF
E761 RET Return.
Prev: E6DC Up: Map Next: E762