Prev: 47883 Up: Map Next: 47941
47908: 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 5 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 47908 LD L,(IX+3) Fetch the X position of the actor.
47911 LD H,(IX+4) Fetch the Y position of the actor.
47914 LD D,(IX+5) Fetch the colour of the actor.
47917 LD A,(38566) Fetch the number of columns the sprite covers from New_Sprite_Width into B.
47920 LD B,A
47921 LD A,H Invert the Y position.
47922 CPL
47923 AND %00000111 Keep only bits 0-2.
47925 LD C,A Stash the pixel line offset in C.
47926 LD A,(38565) Fetch the height of the sprite from New_Sprite_Height.
47929 ADD A,C Add the pixel line offset.
47930 ADD A,8 Add 8.
47932 RRCA Divide by eight to get the number of attribute rows.
47933 RRCA
47934 RRCA
47935 AND %00011111 Keep only bits 0-4.
47937 LD C,A Set the number of rows to colour in C.
47938 CALL AttributeAddress Convert the position into an attribute address.
View the equivalent code in;
Continue on to ColourRows.
Prev: 47883 Up: Map Next: 47941