Prev: 55525 Up: Map Next: 55698
55616: Change entity's room down one if appropriate
Used by the routines at 55196 and 55525.
Input
IX Address of complex state data for an entity
55616 LD A,122 If y-coordinate of bottom of entity is smaller than 122 (i.e. bottom of entity is above bottom of room)...
55618 CP (IX+6) ...
55621 RET NC ...then return
55622 PUSH BC Store BC
55623 PUSH DE Store DE
55624 LD IY,(34254) Load start address of current level's vertical room connectivity data into IY
55628 LD D,(IX+0) Load current room of entity into D
55631 LD A,(IY+0) Load first byte (upper room index) of current entry into A
55634 CP 255 If byte is 255 (i.e. the end marker)...
55636 JR Z,55695 ...then skip ahead to 55695
55638 CP D If byte is the same as the entity's current room...
55639 JR Z,55647 ...then skip ahead to 55647
55641 INC IY Advance by two bytes to the next entry...
55643 INC IY ...
55645 JR 55631 Loop back to 55631
55647 LD B,(IY+1) Load second byte (lower room index) of current entry into B
55650 LD A,(34231) Load position (chars) of left side of current room (old, that entity is leaving) into D...
55653 LD D,A ...
55654 CALL 54480 Set room of entity to B, store room size data for new room and load E with entity's width minus one
55657 LD A,(34231) Load position (chars) of left side of current room (new, that entity has entered) into A
55660 SUB D Subtract x-coordinate of old room's left edge from x-coordinate of new room's left edge...
55661 LD D,A ...and place result in D
55662 LD A,(IX+5) Load A with x-coordinate of left of entity...
55665 SUB D ...subtract difference in positions of rooms' left edges...
55666 LD (IX+5),A ...and store
55669 ADD A,E Update x-coordinate of right of entity by adding entity's (width - 1) value...
55670 LD (IX+7),A ...
55673 LD A,(IX+4) Subtract 20 from y-coordinate of top of entity...
55676 SUB 20 ...
55678 LD (IX+4),A ...
55681 LD A,(IX+6) Subtract 20 from y-coordinate of bottom of entity...
55684 SUB 20 ...
55686 LD (IX+6),A ...
55689 CALL 54456 Paint red areas outside current character's room if IX points to current character's complex state data
55692 POP DE Restore DE
55693 POP BC Restore BC
55694 RET Return
55695 POP DE Restore DE
55696 POP BC Restore BC
55697 RET Return
Prev: 55525 Up: Map Next: 55698