Prev: AC60 Up: Map Next: AD1B
ACDD: Trim a ground object's colour patch
Used by the routine at update_ground_objects.
For graphic $1B and the kinds 0, 1, 3, $0A and $0C, after the drawing: when the new image's bottom row is not the bottom line of a character cell, its height (new_sprite_rows) is cut by four and its y (new_sprite_y) moved up seven lines, so the colour patch (colour_sprite) stops a character row short and does not colour the cells its bottom shares with the ground; none at all if that would put it above line $18. Only the colouring reads them now. Why four and seven is not yet worked out.
Input
IY The record
trim_colour_patch ACDD LD A,(IY+$00) Only these graphics and kinds
ACE0 CP $1B
ACE2 JR Z,trim_colour_patch_0
ACE4 LD A,(IY+$13)
ACE7 AND $0F
ACE9 JR Z,trim_colour_patch_0
ACEB CP $01
ACED JR Z,trim_colour_patch_0
ACEF CP $03
ACF1 JR Z,trim_colour_patch_0
ACF3 CP $0A
ACF5 JR Z,trim_colour_patch_0
ACF7 CP $0C
ACF9 RET NZ
trim_colour_patch_0 ACFA LD A,(new_sprite_y) Not when the bottom row is a cell's bottom line
ACFD XOR $07
ACFF AND $07
AD01 RET Z
AD02 LD A,(new_sprite_rows) Four rows fewer
AD05 SUB $04
AD07 LD (new_sprite_rows),A
AD0A LD A,(new_sprite_y) Seven lines up; no patch at all if that is above line $18
AD0D SUB $07
AD0F CP $18
AD11 JR NC,trim_colour_patch_1
AD13 XOR A
AD14 LD (new_sprite_rows),A
trim_colour_patch_1 AD17 LD (new_sprite_y),A
AD1A RET
Prev: AC60 Up: Map Next: AD1B