Prev: 38512 Up: Map Next: 38660
38539: Set terrain interaction data for character blocks spanned by an object and draw the object
Used by the routine at 31370.
Input
A Index of current object (call to 38539 only)
B y-coordinate (call to 38539 only)
C x-coordinate (call to 38539 only)
IX Points at object's position data (call to 38550 only)
38539 LD IX,23296 Store object's position data temporarily at 23296 - 23298...
38543 LD (IX+1),C ...x-coordinate...
38546 LD (IX+2),B ...y-coordinate...
38549 LD C,A Load index of object of interest into C
This entry point is used by the routine at 38512.
38550 PUSH BC Store BC
38551 PUSH IX Store IX
38553 LD A,C Load HL with eight times current object number...
38554 ADD A,A ...
38555 ADD A,A ...
38556 LD L,A ...
38557 LD H,0 ...
38559 ADD HL,HL ...
38560 LD DE,42249 Point DE at last byte (graphic index) of "nothing at all" properties
38563 ADD HL,DE Add eight times current object index as offset
38564 LD A,(HL) Load graphic index into A...
38565 PUSH AF ...and store
38566 DEC HL Move pointer back one byte to point at attribute of object...
38567 LD A,(HL) ...
38568 LD (23695),A ...and store value at 23695
38571 LD C,(IX+1) Load C with x-coordinate of current object
38574 LD B,(IX+2) Load B with y-coordinate of current object
38577 DEC B Decrease y-coordinate by one
38578 XOR A Set A to zero
38579 LD (23483),A Reset all terrain interaction parameter flags
38582 POP AF Restore graphic index to A
38583 PUSH AF And store again
38584 PUSH IX Store IX (pointer to position data for current object)
38586 CALL 29955 Draw the object in OR mode
38589 POP IX Restore IX
38591 POP AF Restore graphic index to A
38592 ADD A,A Load into HL...
38593 LD L,A ...
38594 LD H,0 ...
38596 ADD HL,HL ...and multiply by four
38597 LD DE,42643 Point DE at height property of first object in graphics data lookup table...
38600 ADD HL,DE ...and add four times graphic index (as entries are 4 bytes wide) as offset to get entry for current object
38601 LD A,(HL) Load height property of current object into A...
38602 LD (38616),A ...and modify later instruction with this data
38605 LD C,(IX+1) Load C with x-coordinate of current object
38608 LD B,(IX+2) Load B with y-coordinate of current object
38611 DEC B Decrease y-coordinate by one
38612 CALL 36586 Point HL at terrain interaction data for character coordinates x=C, y=B
The operand of the instruction at 38615 represents the height of the object. This is modified by the instruction at 38602.
38615 LD A,0 Load A with "height" property of graphic of current object (x=height property of current object's graphic)
38617 AND 192 Discard all but the two most significant bits
38619 OR (HL) Combine with terrain interaction data already present for that block...
38620 LD (HL),A ...
38621 INC HL Advance HL to next byte in terrain interaction data
38622 LD A,(38616) Load A with height property of graphic of current object
38625 RLCA Next two bits correspond to next character block's terrain interaction data...
38626 RLCA ...
38627 AND 192 Discard all but the two most significant bits
38629 OR (HL) Combine with terrain interaction data already present for that block...
38630 LD (HL),A ...
38631 LD BC,31 Advance HL by 31 bytes in terrain interaction data (i.e. down a character row and to the left one character)...
38634 ADD HL,BC ...
38635 LD A,(38616) Load A with height property of graphic of current object
38638 RLCA Next two bits correspond to next character block's terrain interaction data...
38639 RLCA ...
38640 RLCA ...
38641 RLCA ...
38642 AND 192 Discard all but the two most significant bits
38644 OR (HL) Combine with terrain interaction data already present for that block...
38645 LD (HL),A ...
38646 INC HL Advance HL to next byte in terrain interaction data
38647 LD A,(38616) Load A with height property of graphic of current object
38650 RRCA Next two bits correspond to next character block's terrain interaction data...
38651 RRCA ...
38652 AND 192 Discard all but the two most significant bits
38654 OR (HL) Combine with terrain interaction data already present for that block...
38655 LD (HL),A ...
38656 POP IX Restore IX
38658 POP BC Restore BC
38659 RET Return
Prev: 38512 Up: Map Next: 38660