Prev: AEB0 Up: Map Next: AF43
AF21: Set Entity Size
Fetches the sprite for the entity with FindSpriteFrame and copies the width and the height of the sprite to fields 16 and 17. If either is too big, the game crashes with FlashBorder.
Input
IX The entity
SetEntitySize AF21 CALL FindSpriteFrame Find the sprite of the entity.
AF24 EX DE,HL Point HL at the sprite.
AF25 LD A,(HL) Fetch the width of the sprite.
AF26 CP $05 Jump to FlashBorder to crash if the width is 05 bytes or more.
AF28 JR NC,FlashBorder
AF2A LD A,(IX+$16) Fetch the width byte of the entity.
AF2D AND %11110000 Keep the flags in bits 4-7.
AF2F OR (HL) Combine them with the width of the sprite.
AF30 LD (IX+$16),A Store the width of the entity.
AF33 INC HL Move on to the height of the sprite.
AF34 LD A,(HL) Fetch the height of the sprite.
AF35 CP $28 Jump to FlashBorder to crash if the height is 28 or more.
AF37 JR NC,FlashBorder
AF39 LD A,(IX+$17) Fetch the height byte of the entity.
AF3C AND %11000000 Keep the flags in bits 6-7.
AF3E OR (HL) Combine them with the height of the sprite.
AF3F LD (IX+$17),A Store the height of the entity.
AF42 RET Return.
Prev: AEB0 Up: Map Next: AF43