Unused |
Prev: 48760 | Up: Map | Next: 48850 |
Assuming that IX and IY contain the addresses of two entities' complex state data, this routine will position the entity at IX such that it is horizontally centred with respect to, and B characters below the entity at IY.
|
||||||||||||
48791 | LD A,(IX+6) | Load C with height of entity 1 minus one... | ||||||||||
48794 | SUB (IX+4) | ... | ||||||||||
48797 | LD C,A | ... | ||||||||||
48798 | LD A,(IY+6) | Load A with y-coordinate of bottom edge of entity 2 plus B... | ||||||||||
48801 | ADD A,B | ... | ||||||||||
48802 | LD (IX+6),A | Set y-coordinate of bottom edge of entity 1 to A | ||||||||||
48805 | SUB C | Update y-coordinate of top edge of entity 1 accordingly... | ||||||||||
48806 | LD (IX+4),A | ... | ||||||||||
48809 | LD A,(IX+7) | Load B with width of entity 1 minus one... | ||||||||||
48812 | SUB (IX+5) | ... | ||||||||||
48815 | LD B,A | ... | ||||||||||
48816 | SRL A | Load C with half of width of entity 1 minus one... | ||||||||||
48818 | LD C,A | ... | ||||||||||
48819 | LD A,(IY+7) | Load A with half of width of entity 2 minus one... | ||||||||||
48822 | SUB (IY+5) | ... | ||||||||||
48825 | SRL A | ... | ||||||||||
48827 | ADD A,(IY+5) | ...and add x-coordinate of left edge of entity 2 | ||||||||||
At this point, A holds the x-coordinate of the mid-point of entity 2
|
||||||||||||
48830 | SUB C | Subtract half of width of entity 1 minus one... | ||||||||||
48831 | LD (IX+5),A | ...and set as x-coordinate of left edge of entity 1 | ||||||||||
48834 | ADD A,B | Update x-coordinate of right edge of entity 2 accordingly... | ||||||||||
48835 | LD (IX+7),A | ... | ||||||||||
48838 | LD A,(IX+8) | If entity 1 is not Berk... | ||||||||||
48841 | CP 31 | ... | ||||||||||
48843 | RET NZ | ...then return | ||||||||||
48844 | PUSH HL | Store HL | ||||||||||
48845 | CALL 53887 | Paint red areas outside accessible areas of current character's current room | ||||||||||
48848 | POP HL | Restore HL | ||||||||||
48849 | RET | Return |
Prev: 48760 | Up: Map | Next: 48850 |