Prev: CFD2 Up: Map Next: D013
CFFE: Find an object's sprite and make it face the right way
Used by the routines at CALC_2D_INFO and CALC_PIXEL_XY_AND_RENDER.
The graphic (+0) indexes GRAPHICS for the sprite. A sprite whose first byte is 0 draws nothing: the routine then drops its own return address, so its RET leaves its caller too. Otherwise it jumps to VFLIP_SPRITE_DATA, which turns the sprite's data to match the object's flags and returns to the caller with DE on the width byte. As Knight Lore's flip_sprite.
Input
IX the object
Output
DE the sprite's width byte
FLIP_SPRITE CFFE LD L,(IX+$00) DE = the sprite, from the graphic table
D001 LD H,$00
D003 ADD HL,HL
D004 LD BC,GRAPHICS
D007 ADD HL,BC
D008 LD E,(HL)
D009 INC HL
D00A LD D,(HL)
D00B LD A,(DE) A real sprite: turn it, and return from there
D00C AND A
D00D JP NZ,VFLIP_SPRITE_DATA
D010 INC SP None: return from the caller as well
D011 INC SP
D012 RET
Prev: CFD2 Up: Map Next: D013