Prev: BB0B Up: Map Next: BB45
BB24: Colour Entity
Used by the routines at ColourPickup, DisplayActor, DrawActor and GamePlay_Start.
Colours the attribute cells covered by the sprite that has just been drawn with DrawEntity using the colour held in byte 05 of the actor. Only cells with a black paper are changed (see ColourRows), so the colour of anything already drawn behind the sprite is kept.
Input
IX Actor Entity
ColourEntity BB24 LD L,(IX+$03) Fetch the X position of the actor.
BB27 LD H,(IX+$04) Fetch the Y position of the actor.
BB2A LD D,(IX+$05) Fetch the colour of the actor.
BB2D LD A,($96A6) Fetch the number of columns the sprite covers from New_Sprite_Width into B.
BB30 LD B,A
BB31 LD A,H Invert the Y position.
BB32 CPL
BB33 AND %00000111 Keep only bits 0-2.
BB35 LD C,A Stash the pixel line offset in C.
BB36 LD A,($96A5) Fetch the height of the sprite from New_Sprite_Height.
BB39 ADD A,C Add the pixel line offset.
BB3A ADD A,$08 Add 08.
BB3C RRCA Divide by eight to get the number of attribute rows.
BB3D RRCA
BB3E RRCA
BB3F AND %00011111 Keep only bits 0-4.
BB41 LD C,A Set the number of rows to colour in C.
BB42 CALL AttributeAddress Convert the position into an attribute address.
View the equivalent code in;
Continue on to ColourRows.
Prev: BB0B Up: Map Next: BB45