Prev: 54160 Up: Map Next: 54272
54183: Draw Town Panel
Used by the routine at DrawGameScreen.
Draws the panel at the left of the screen of the town, which is 8 tiles wide and 18 high and has the wanted poster in it. The panel is drawn from pairs of bytes, which are the attribute and the tile, at PanelTiles. Then it prints the name of the outlaw, draws the picture of his face from four images, one above another, and draws the reward. This does nothing when TownOffset is zero.
town-panel
Return if this is not the town.
DrawTownPanel 54183 LD A,(41575) Fetch TownOffset, and test it.
54186 AND A
54187 RET Z Return if this is not the town.
Draw the panel tiles.
54188 LD HL,16384 Point HL at 16384 (in the screen buffer).
54191 LD DE,24209 Point DE at PanelTiles.
54194 LD C,18 Set a count of 18 rows.
Draw a row.
DrawTownPanel_Row 54196 LD B,8 Set a count of 8 tiles.
54198 PUSH HL Stash the screen address of the row on the stack.
Draw a tile.
DrawTownPanel_Tile 54199 LD A,(DE) Fetch the attribute and then the tile.
54200 INC DE
54201 EX AF,AF'
54202 LD A,(DE)
54203 INC DE
54204 PUSH BC Stash the counters on the stack.
54205 LD BC,35656 Point BC at PanelTileSet.
54208 CALL DrawTile Call DrawTile.
54211 POP BC Restore the counters from the stack.
54212 INC L Move on to the next column.
54213 DJNZ DrawTownPanel_Tile Jump to DrawTownPanel_Tile if there are any left.
54215 POP HL Restore the screen address of the row from the stack.
Move down a row.
54216 CALL MoveDownRow Call MoveDownRow.
54219 DEC C Jump to DrawTownPanel_Row if there are rows left.
54220 JR NZ,DrawTownPanel_Row
Print the name of the outlaw.
54222 CALL PrintOutlawName Call PrintOutlawName.
Find the face images.
54225 LD A,(41568) Fetch Level.
54228 LD HL,46228 Point HL at OutlawNumbers.
54231 CALL AddAToHL Call AddAToHL.
54234 LD L,(HL) Fetch the number of the outlaw.
54235 LD H,0
54237 LD C,L Keep it in BC.
54238 LD B,H
54239 ADD HL,HL Multiply it by four.
54240 ADD HL,HL
54241 ADD HL,BC Add it, which makes it five times the number.
54242 LD BC,46512 Add the address of FaceImageNumbers.
54245 ADD HL,BC
54246 INC HL Skip the first byte of the record.
54247 EX DE,HL Keep the address of the images in DE.
Draw the face.
54248 LD HL,20290 Point HL at 20290 (in the screen buffer).
54251 LD B,4 Set a count of 4 images.
DrawTownPanel_Face 54253 LD A,(DE) Fetch the number of the next image.
54254 INC DE
54255 PUSH BC Stash the registers on the stack.
54256 PUSH DE
54257 PUSH HL
Draw the image.
54258 CALL DrawPosterImage Call DrawPosterImage.
54261 POP HL Restore the screen address from the stack.
Move up a row.
54262 CALL MoveUpRow Call MoveUpRow.
54265 POP DE Restore the registers from the stack.
54266 POP BC
54267 DJNZ DrawTownPanel_Face Jump to DrawTownPanel_Face if there are any left.
54269 JP DrawReward Jump to DrawReward.
Prev: 54160 Up: Map Next: 54272