Prev: 40217 Up: Map Next: 40263
40229: Set Attributes Upright
The handler of SetGraphicAttributes for a graphic that is as it is stored. Each attribute byte is written to the attribute buffer, unless it is 0 (which leaves the attribute as it is) or 255 (which uses the attribute of the room from CurrentRoom_Attribute). Each row is a line up from the last, as in DrawGraphic_Upright.
SetAttributes_Upright 40229 POP BC Restore the attribute and graphic ID from the stack.
40230 CALL GetGraphicAttributeDetails Call GetGraphicAttributeDetails to get the details of the attributes.
SetAttributes_Upright_Row 40233 PUSH BC Stash the width and height on the stack.
40234 PUSH HL Stash the attribute buffer address on the stack.
SetAttributes_Upright_Cell 40235 LD A,(DE) Fetch the next attribute.
40236 INC DE Move DE on to the next byte.
40237 AND A Jump to SetAttributes_Upright_Next if it is 0.
40238 JR Z,SetAttributes_Upright_Next
40240 CP 255 Jump to SetAttributes_Upright_Write if it is not 255.
40242 JR NZ,SetAttributes_Upright_Write
40244 LD A,(24090) Fetch the room attribute from CurrentRoom_Attribute.
SetAttributes_Upright_Write 40247 LD (HL),A Write A to the attribute buffer.
SetAttributes_Upright_Next 40248 INC L Move HL on to the next cell.
40249 DJNZ SetAttributes_Upright_Cell Decrease the width by one and loop back to SetAttributes_Upright_Cell until all of the cells in the row have been set.
40251 POP HL Restore the attribute buffer address from the stack.
40252 LD BC,32 BC=0032 (the size of a row of the attribute buffer).
40255 AND A Move up a row.
40256 SBC HL,BC
40258 POP BC Restore the width and height from the stack.
40259 DEC C Decrease the height by one and loop back to SetAttributes_Upright_Row until all of the rows have been set.
40260 JR NZ,SetAttributes_Upright_Row
40262 RET Return.
Prev: 40217 Up: Map Next: 40263