Prev: D390 Up: Map Next: D400
D3A7: Draw Town Panel
Used by the routine at DrawGameScreen.
Draws the panel at the left of the screen of the town, which is 08 tiles wide and 12 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 D3A7 LD A,($A267) Fetch TownOffset, and test it.
D3AA AND A
D3AB RET Z Return if this is not the town.
Draw the panel tiles.
D3AC LD HL,$4000 Point HL at 4000 (in the screen buffer).
D3AF LD DE,$5E91 Point DE at PanelTiles.
D3B2 LD C,$12 Set a count of 12 rows.
Draw a row.
DrawTownPanel_Row D3B4 LD B,$08 Set a count of 08 tiles.
D3B6 PUSH HL Stash the screen address of the row on the stack.
Draw a tile.
DrawTownPanel_Tile D3B7 LD A,(DE) Fetch the attribute and then the tile.
D3B8 INC DE
D3B9 EX AF,AF'
D3BA LD A,(DE)
D3BB INC DE
D3BC PUSH BC Stash the counters on the stack.
D3BD LD BC,$8B48 Point BC at PanelTileSet.
D3C0 CALL DrawTile Call DrawTile.
D3C3 POP BC Restore the counters from the stack.
D3C4 INC L Move on to the next column.
D3C5 DJNZ DrawTownPanel_Tile Jump to DrawTownPanel_Tile if there are any left.
D3C7 POP HL Restore the screen address of the row from the stack.
Move down a row.
D3C8 CALL MoveDownRow Call MoveDownRow.
D3CB DEC C Jump to DrawTownPanel_Row if there are rows left.
D3CC JR NZ,DrawTownPanel_Row
Print the name of the outlaw.
D3CE CALL PrintOutlawName Call PrintOutlawName.
Find the face images.
D3D1 LD A,($A260) Fetch Level.
D3D4 LD HL,$B494 Point HL at OutlawNumbers.
D3D7 CALL AddAToHL Call AddAToHL.
D3DA LD L,(HL) Fetch the number of the outlaw.
D3DB LD H,$00
D3DD LD C,L Keep it in BC.
D3DE LD B,H
D3DF ADD HL,HL Multiply it by four.
D3E0 ADD HL,HL
D3E1 ADD HL,BC Add it, which makes it five times the number.
D3E2 LD BC,$B5B0 Add the address of FaceImageNumbers.
D3E5 ADD HL,BC
D3E6 INC HL Skip the first byte of the record.
D3E7 EX DE,HL Keep the address of the images in DE.
Draw the face.
D3E8 LD HL,$4F42 Point HL at 4F42 (in the screen buffer).
D3EB LD B,$04 Set a count of 04 images.
DrawTownPanel_Face D3ED LD A,(DE) Fetch the number of the next image.
D3EE INC DE
D3EF PUSH BC Stash the registers on the stack.
D3F0 PUSH DE
D3F1 PUSH HL
Draw the image.
D3F2 CALL DrawPosterImage Call DrawPosterImage.
D3F5 POP HL Restore the screen address from the stack.
Move up a row.
D3F6 CALL MoveUpRow Call MoveUpRow.
D3F9 POP DE Restore the registers from the stack.
D3FA POP BC
D3FB DJNZ DrawTownPanel_Face Jump to DrawTownPanel_Face if there are any left.
D3FD JP DrawReward Jump to DrawReward.
Prev: D390 Up: Map Next: D400