Prev: 48164 Up: Map Next: 48341
48191: Set terrain interaction data for character blocks spanned by an object and draw the object
Used by the routine at 42638.
Input
A Index of object to draw (entry at 48191 only)
B y-coordinate (entry at 48191 only)
C x-coordinate (entry at 48191 only)
IX Position data for an object (entry at 48202 only)
48191 LD IX,23296 Store object's position data temporarily at 23296 - 23298...
48195 LD (IX+1),C ...x-coordinate...
48198 LD (IX+2),B ...y-coordinate...
48201 LD C,A Load index of object of interest into C
This entry point is used by the routine at 48164.
48202 PUSH BC Store BC
48203 PUSH IX Store IX
48205 LD A,C Load HL with eight times current object index...
48206 ADD A,A ...
48207 ADD A,A ...
48208 LD L,A ...
48209 LD H,0 ...
48211 ADD HL,HL ...
48212 LD DE,49361 Point DE at last byte (graphic index) of "nothing at all" properties
48215 ADD HL,DE Add eight times current object index as offset
48216 LD A,(HL) Load graphic index into A
48217 PUSH AF Store AF (A = graphic index)
48218 DEC HL Move pointer back one byte to point at attribute of object...
48219 LD A,(HL) ...
48220 LD (23695),A ...and store this value at 23695
48223 DEC HL Move pointer back one byte to point at object's terrain interaction parameter...
48224 LD A,(HL) ...and store at 23473...
48225 LD (23473),A ...
48228 DEC HL Move pointer back one byte to point at object's attribute flags...
48229 LD A,(HL) ...load into A...
48230 AND 15 ...clear upper four bits...
48232 LD (48271),A ...and store as operand of instruction at 48270
48235 LD C,(IX+1) Load C with x-coordinate of current object
48238 LD B,(IX+2) Load B with y-coordinate of current object
48241 DEC B Decrease y-coordinate by one to point to object's top-left character block
48242 POP AF Restore AF (A = graphic index)
48243 PUSH IX Store IX (pointer to position data for object)
48245 PUSH BC Store BC (x- and y-coordinates of object's top-left character block)
48246 CALL 63499 Draw 2 × 2 graphic with lookup index A at character coordinates (C, B)
48249 POP BC Restore BC (x- and y-coordinates of object's top-left character block)
48250 PUSH BC Store BC (x- and y-coordinates of object's top-left character block)
48251 LD A,B If object's y-coordinate is 4 (i.e. drawn in window at top while carrying Mirror)...
48252 CP 4 ...
48254 JR Z,48263 ...then skip ahead to 48263
48256 LD A,(23706) If player-attribute-update flag is reset (player attribute ignore mode)...
48259 OR A ...
48260 JP Z,48298 ...then skip ahead to 48298
48263 CALL 63219 Load HL with attribute file address for coordinates (C, B)
48266 LD A,(23695) Load E with attribute stored at 23695...
48269 LD E,A ...
The operand of the instruction at 48270 represents the object's attribute flags. This is modified by the instruction at 48232.
48270 LD A,0 Load A with object's attribute flags
48272 BIT 0,A If paint-top-left flag is reset...
48274 JR Z,48277 ...then skip ahead to 36190
48276 LD (HL),E Paint top-left character block of object with object attribute
48277 INC HL Increase HL to move to top-right character block
48278 BIT 1,A If paint-top-right flag is reset...
48280 JR Z,48283 ...then skip ahead to 48283
48282 LD (HL),E Paint top-right character block of object with object attribute
48283 LD BC,31 Advance HL by 31 bytes...
48286 ADD HL,BC ...to point to bottom-left character block of object
48287 BIT 2,A If paint-bottom-left flag is reset...
48289 JR Z,48292 ...then skip ahead to 48292
48291 LD (HL),E Paint bottom-left character block of object with object attribute
48292 INC HL Increase HL to move to bottom-right character block
48293 BIT 3,A If paint-bottom-right flag is reset...
48295 JR Z,48298 ...then skip ahead to 48298
48297 LD (HL),E Paint bottom-right character block of object with object attribute
48298 POP BC Store BC (x- and y-coordinates of object's top-left character block)
48299 CALL 63233 Point HL at terrain interaction data for character coordinates x=C, y=B
48302 LD A,(23473) Load E with object's terrain interaction parameter...
48305 LD E,A ...
48306 LD A,(48271) Load A with object's attribute flags
48309 BIT 0,A If paint-top-left flag is reset...
48311 JR Z,48314 ...then skip ahead to 48314
48313 LD (HL),E Paint object's terrain interaction parameter into terrain interaction data table for top-left character block
48314 INC HL Increase HL to move to top-right character block
48315 BIT 1,A If paint-top-right flag is reset...
48317 JR Z,48320 ...then skip ahead to 48320
48319 LD (HL),E Paint object's terrain interaction parameter into terrain interaction data table for top-right character block
48320 LD BC,31 Advance HL by 31 bytes...
48323 ADD HL,BC ...to point to bottom-left character block of object
48324 BIT 2,A If paint-bottom-left flag is reset...
48326 JR Z,48329 ...then skip ahead to 48329
48328 LD (HL),E Paint object's terrain interaction parameter into terrain interaction data table for bottom-left character block
48329 INC HL Increase HL to move to bottom-right character block
48330 BIT 3,A If paint-bottom-right flag is reset...
48332 JR Z,48335 ...then skip ahead to 48335
48334 LD (HL),E Paint object's terrain interaction parameter into terrain interaction data table for bottom-right character block
48335 POP IX Restore IX (pointer to position data for object)
48337 POP IX Restore IX
48339 POP BC Restore BC
48340 RET Return
Prev: 48164 Up: Map Next: 48341