![]() |
Routines |
| Prev: 43031 | Up: Map | Next: 43118 |
|
Used by the routine at DrawRoom.
Writes a sprite into the room buffer, starting from sprite ID A with width E and height D. Clone of WriteGameSpriteBuffer.
|
||||||||||||||||
| WriteSpriteBuffer | 43071 | PUSH AF | Stash the registers this tile walk uses. | |||||||||||||
| 43072 | PUSH BC | |||||||||||||||
| 43073 | PUSH DE | |||||||||||||||
| 43074 | PUSH HL | |||||||||||||||
| 43075 | DEC A | Start one ID before the first tile so the increment lands on it. | ||||||||||||||
| 43076 | LD (47778),A | Write the tile ID to *DrawSpriteID. | ||||||||||||||
| 43079 | LD A,E | Remember the remaining width in *DrawSpriteWidth. | ||||||||||||||
| 43080 | LD (47779),A | |||||||||||||||
| WriteSpriteBuffer_NextRow | 43083 | LD A,(47779) | Reload the remaining width. | |||||||||||||
| 43086 | LD E,A | |||||||||||||||
| 43087 | PUSH BC | Stash the position and size. | ||||||||||||||
| 43088 | PUSH DE | |||||||||||||||
| 43089 | CALL ConvertDrawCoordinate | Convert this tile into a room-buffer offset. | ||||||||||||||
| 43092 | POP DE | Restore the position and size. | ||||||||||||||
| 43093 | POP BC | |||||||||||||||
| WriteSpriteBuffer_NextTile | 43094 | LD A,(47778) | Advance *DrawSpriteID to the next tile ID. | |||||||||||||
| 43097 | INC A | |||||||||||||||
| 43098 | LD (47778),A | |||||||||||||||
| 43101 | CALL PopulateRoomBuffer | Write that tile into the room buffer. | ||||||||||||||
| 43104 | DEC E | Move one column across. | ||||||||||||||
| 43105 | JR NZ,WriteSpriteBuffer_NextTile | Jump to WriteSpriteBuffer_NextTile until this row is complete. | ||||||||||||||
| 43107 | DEC D | Move on to the next row of tiles. | ||||||||||||||
| 43108 | JR Z,WriteSpriteBuffer_Done | Jump to WriteSpriteBuffer_Done if every row is written. | ||||||||||||||
| 43110 | DEC B | Move one row up. | ||||||||||||||
| 43111 | JR WriteSpriteBuffer_NextRow | Jump to WriteSpriteBuffer_NextRow. | ||||||||||||||
| WriteSpriteBuffer_Done | 43113 | POP HL | Restore HL, DE, BC and AF from the stack. | |||||||||||||
| 43114 | POP DE | |||||||||||||||
| 43115 | POP BC | |||||||||||||||
| 43116 | POP AF | |||||||||||||||
| 43117 | RET | Return. | ||||||||||||||
| Prev: 43031 | Up: Map | Next: 43118 |