Prev: 39204 Up: Map Next: 39280
39266: Draw Graphic
Used by the routine at DrawItemGraphic.
Draws a graphic on the screen. The way that it is drawn depends on bits 5-7 of the attribute, which choose one of the handlers in DrawGraphicHandlers. Bits 0-1 choose how it is mixed with what is already on the screen (see GetBlendInstruction).
Bits 5-7 Handler Orientation
0 DrawGraphic_Upright Upright
1 DrawGraphic_Mirrored Mirrored left to right
2 DrawGraphic_RotatedLeft Rotated a quarter turn anti-clockwise
3 DrawGraphic_Transposed Transposed (flipped along the main diagonal)
4 DrawGraphic_Flipped Flipped top to bottom
5 DrawGraphic_RotatedHalf Rotated a half turn
6 DrawGraphic_TransposedFlipped Transposed (flipped along the other diagonal)
7 DrawGraphic_RotatedRight Rotated a quarter turn clockwise
Input
B The attribute
C The graphic ID
D The Y position
E The X position
DrawGraphic 39266 LD HL,39280 Point HL at the draw graphic handlers at DrawGraphicHandlers.
This entry point is used by the routine at SetGraphicAttributes.
This is also used by SetGraphicAttributes, with a different table of handlers.
DrawGraphic_Dispatch 39269 PUSH BC Stash the attribute and graphic ID on the stack.
39270 LD A,B Fetch the attribute.
39271 RLCA Rotate A left three times, to move bits 5-7 to bits 0-2.
39272 RLCA
39273 RLCA
39274 AND %00000111 Keep only bits 0-2.
39276 LD C,A Keep the type of handler in C.
39277 JP ProcessAction_Offset Jump to ProcessAction_Offset, which jumps to the handler in the table at HL.
Prev: 39204 Up: Map Next: 39280