Prev: 55421 Up: Map Next: 55516
55433: Change entity's room up one if appropriate
Used by the routines at 36542, 48487 and 55196.
Input
IX Address of complex state data for an entity
55433 LD A,99 If y-coordinate of top of entity is larger than 99 (i.e. top of entity is below top of room)...
55435 CP (IX+4) ...
55438 RET C ...then return
55439 PUSH HL Store HL
55440 PUSH BC Store BC
55441 PUSH DE Store DE
55442 LD IY,(34254) Load start address of current level's vertical room connectivity data into IY
55446 INC IY Advance by one byte to second byte (lower room index) of first entry
55448 LD D,(IX+0) Load current room of entity into D
55451 LD A,(IY+0) Load second byte (lower room index) of current entry into A
55454 CP 255 If byte is 255 (i.e. the end marker)...
55456 JR Z,55512 ...then skip ahead to 55512
55458 CP D If byte is the same as the entity's current room...
55459 JR Z,55467 ...then skip ahead to 55467
55461 INC IY Advance by two bytes to the next entry...
55463 INC IY ...
55465 JR 55451 Loop back to 55451
55467 LD B,(IY-1) Load first byte (upper room index) of current entry into B
55470 LD A,(34231) Load position (chars) of left side of current room (old, that entity is leaving) into D...
55473 LD D,A ...
55474 CALL 54480 Set room of entity to B, store room size data for new room and load E with entity's width minus one
55477 LD A,(34231) Load position (chars) of left side of current room (new, that entity has entered) into A
55480 SUB D Subtract x-coordinate of old room's left edge from x-coordinate of new room's left edge...
55481 LD D,A ...and place result in D
55482 LD A,(IX+5) Load A with x-coordinate of left of entity...
55485 SUB D ...subtract difference in positions of rooms' left edges...
55486 LD (IX+5),A ...and store
55489 ADD A,E Update x-coordinate of right of entity by adding entity's (width - 1) value...
55490 LD (IX+7),A ...
55493 LD A,(IX+4) Add 22 to y-coordinate of top of entity...
55496 ADD A,22 ...
55498 LD (IX+4),A ...
55501 LD A,(IX+6) Add 22 to y-coordinate of bottom of entity...
55504 ADD A,22 ...
55506 LD (IX+6),A ...
55509 CALL 54456 Paint red areas outside current character's room if IX points to current character's complex state data
55512 POP DE Restore DE
55513 POP BC Restore BC
55514 POP HL Restore HL
55515 RET Return
Prev: 55421 Up: Map Next: 55516