Prev: 36077 Up: Map Next: 36254
36104: Set terrain interaction data for character blocks spanned by an object and draw the object
Used by the routine at 30145.
Input
A Index of object to draw (entry at 36104 only)
B y-coordinate (entry at 36104 only)
C x-coordinate (entry at 36104 only)
IX Position data for an object (entry at 36115 only)
36104 LD IX,23296 Store object's position data temporarily at 23296 - 23298...
36108 LD (IX+1),C ...x-coordinate...
36111 LD (IX+2),B ...y-coordinate...
36114 LD C,A Load index of object of interest into C
This entry point is used by the routine at 36077.
36115 PUSH BC Store BC
36116 PUSH IX Store IX
36118 LD A,C Load HL with eight times current object index...
36119 ADD A,A ...
36120 ADD A,A ...
36121 LD L,A ...
36122 LD H,0 ...
36124 ADD HL,HL ...
36125 LD DE,37448 Point DE at last byte (graphic index) of "nothing at all" properties
36128 ADD HL,DE Add eight times current object index as offset
36129 LD A,(HL) Load graphic index into A
36130 PUSH AF Store AF (A = graphic index)
36131 DEC HL Move pointer back one byte to point at attribute of object...
36132 LD A,(HL) ...
36133 LD (23695),A ...and store this value at 23695
36136 DEC HL Move pointer back one byte to point at object's terrain interaction parameter...
36137 LD A,(HL) ...and store at 23473...
36138 LD (23473),A ...
36141 DEC HL Move pointer back one byte to point at object's attribute flags...
36142 LD A,(HL) ...load into A...
36143 AND 15 ...clear upper four bits...
36145 LD (36184),A ...and store as operand of instruction at 36183
36148 LD C,(IX+1) Load C with x-coordinate of current object
36151 LD B,(IX+2) Load B with y-coordinate of current object
36154 DEC B Decrease y-coordinate by one to point to object's top-left character block
36155 POP AF Restore AF (A = graphic index)
36156 PUSH IX Store IX (pointer to position data for object)
36158 PUSH BC Store BC (x- and y-coordinates of object's top-left character block)
36159 CALL 54406 Draw object with lookup index A at character coordinates (C, B)
36162 POP BC Restore BC (x- and y-coordinates of object's top-left character block)
36163 PUSH BC Store BC (x- and y-coordinates of object's top-left character block)
36164 LD A,B If object's y-coordinate is 4 (i.e. drawn in window at top while carrying Mirror)...
36165 CP 4 ...
36167 JR Z,36176 ...then skip ahead to 36176
36169 LD A,(23705) If player-attribute-update flag is reset (player attribute ignore mode)...
36172 OR A ...
36173 JP Z,36211 ...then skip ahead to 36211
36176 CALL 54148 Load HL with attribute file address for coordinates (C, B)
36179 LD A,(23695) Load E with attribute stored at 23695...
36182 LD E,A ...
The operand of the instruction at 36183 represents the object's attribute flags. This is modified by the instruction at 36145.
36183 LD A,0 Load A with object's attribute flags
36185 BIT 0,A If paint-top-left flag is reset...
36187 JR Z,36190 ...then skip ahead to 36190
36189 LD (HL),E Paint top-left character block of object with object attribute
36190 INC HL Increase HL to move to top-right character block
36191 BIT 1,A If paint-top-right flag is reset...
36193 JR Z,36196 ...then skip ahead to 36196
36195 LD (HL),E Paint top-right character block of object with object attribute
36196 LD BC,31 Advance HL by 31 bytes...
36199 ADD HL,BC ...to point to bottom-left character block of object
36200 BIT 2,A If paint-bottom-left flag is reset...
36202 JR Z,36205 ...then skip ahead to 36205
36204 LD (HL),E Paint bottom-left character block of object with object attribute
36205 INC HL Increase HL to move to bottom-right character block
36206 BIT 3,A If paint-bottom-right flag is reset...
36208 JR Z,36211 ...then skip ahead to 36211
36210 LD (HL),E Paint bottom-right character block of object with object attribute
36211 POP BC Store BC (x- and y-coordinates of object's top-left character block)
36212 CALL 54162 Point HL at terrain interaction data for character coordinates x=C, y=B
36215 LD A,(23473) Load E with object's terrain interaction parameter...
36218 LD E,A ...
36219 LD A,(36184) Load A with object's attribute flags
36222 BIT 0,A If paint-top-left flag is reset...
36224 JR Z,36227 ...then skip ahead to 36227
36226 LD (HL),E Paint object's terrain interaction parameter into terrain interaction data table for top-left character block
36227 INC HL Increase HL to move to top-right character block
36228 BIT 1,A If paint-top-right flag is reset...
36230 JR Z,36233 ...then skip ahead to 36233
36232 LD (HL),E Paint object's terrain interaction parameter into terrain interaction data table for top-right character block
36233 LD BC,31 Advance HL by 31 bytes...
36236 ADD HL,BC ...to point to bottom-left character block of object
36237 BIT 2,A If paint-bottom-left flag is reset...
36239 JR Z,36242 ...then skip ahead to 36242
36241 LD (HL),E Paint object's terrain interaction parameter into terrain interaction data table for bottom-left character block
36242 INC HL Increase HL to move to bottom-right character block
36243 BIT 3,A If paint-bottom-right flag is reset...
36245 JR Z,36248 ...then skip ahead to 36248
36247 LD (HL),E Paint object's terrain interaction parameter into terrain interaction data table for bottom-right character block
36248 POP IX Restore IX (pointer to position data for object)
36250 POP IX Restore IX
36252 POP BC Restore BC
36253 RET Return
Prev: 36077 Up: Map Next: 36254