![]() |
Routines |
| Prev: CBF9 | Up: Map | Next: CC6D |
|
Used by the routine at ENTER_ROOM.
Called when a room has been built (ENTER_ROOM). The exit code leaves a U or V of 0 or $FF as a marker of the wall he walked out through: 0 in U means he left by a wall at low U and comes in by this room's wall at high U, $FF the other way, and the same for V. He is put with his inner edge 2 inside the wall's line, the rest of him in the doorway, and ADJUST_PLYR_Z_FOR_ARCH finds the arch in that wall and stands him on its floor. Without a marker -- a new game, or a life started where he last came in -- he stays where his record says.
Both his records are flagged to be drawn, and the top is put at the legs' U and V. The walls are where the room's size puts them, so the doorway's place is worked out from ROOM_HALF_U and ROOM_HALF_V. As Knight Lore's adjust_plyr_xyz_for_room_size, with the same four U+V values for the arches.
|
||||||||
| ADJUST_PLYR_UVZ_FOR_ROOM_SIZE | CC01 | LD A,(ROOM_HALF_U) | L, H = the room's half-sizes in U and V, less 2 | |||||
| CC04 | SUB $02 | |||||||
| CC06 | LD L,A | |||||||
| CC07 | LD A,(ROOM_HALF_V) | |||||||
| CC0A | SUB $02 | |||||||
| CC0C | LD H,A | |||||||
| CC0D | LD A,(IX+$01) | U 0: in at high U | ||||||
| CC10 | AND A | |||||||
| CC11 | JR Z,ADJUST_PLYR_UVZ_FOR_ROOM_SIZE_6 | |||||||
| CC13 | INC A | U $FF: in at low U | ||||||
| CC14 | JR Z,ADJUST_PLYR_UVZ_FOR_ROOM_SIZE_4 | |||||||
| CC16 | LD A,(IX+$02) | V 0: in at high V | ||||||
| CC19 | AND A | |||||||
| CC1A | JR Z,ADJUST_PLYR_UVZ_FOR_ROOM_SIZE_3 | |||||||
| CC1C | INC A | V $FF: in at low V; no marker, nothing to do | ||||||
| CC1D | JR Z,ADJUST_PLYR_UVZ_FOR_ROOM_SIZE_0 | |||||||
| CC1F | RET | |||||||
| ADJUST_PLYR_UVZ_FOR_ROOM_SIZE_0 | CC20 | LD C,$C8 | At low V: Z from the arch whose U+V is $C8, and V puts his inner edge 2 inside the wall | |||||
| CC22 | CALL ADJUST_PLYR_Z_FOR_ARCH | |||||||
| CC25 | LD A,$80 | |||||||
| CC27 | SUB H | |||||||
| CC28 | SUB (IX+$05) | |||||||
| ADJUST_PLYR_UVZ_FOR_ROOM_SIZE_1 | CC2B | LD (IX+$02),A | Store V | |||||
| ADJUST_PLYR_UVZ_FOR_ROOM_SIZE_2 | CC2E | SET 4,(IX+$07) | Both his records to be drawn (bit 4 of the flags) | |||||
| CC32 | SET 4,(IX+$27) | |||||||
| CC36 | LD A,(IX+$01) | The top at the legs' U and V | ||||||
| CC39 | LD (IX+$21),A | |||||||
| CC3C | LD A,(IX+$02) | |||||||
| CC3F | LD (IX+$22),A | |||||||
| CC42 | RET | |||||||
| ADJUST_PLYR_UVZ_FOR_ROOM_SIZE_3 | CC43 | LD C,$52 | At high V: the arch whose U+V is $52 | |||||
| CC45 | CALL ADJUST_PLYR_Z_FOR_ARCH | |||||||
| CC48 | LD A,H | |||||||
| CC49 | ADD A,$80 | |||||||
| CC4B | ADD A,(IX+$05) | |||||||
| CC4E | JR ADJUST_PLYR_UVZ_FOR_ROOM_SIZE_1 | |||||||
| ADJUST_PLYR_UVZ_FOR_ROOM_SIZE_4 | CC50 | LD C,$AE | At low U: the arch whose U+V is $AE | |||||
| CC52 | CALL ADJUST_PLYR_Z_FOR_ARCH | |||||||
| CC55 | LD A,$80 | |||||||
| CC57 | SUB L | |||||||
| CC58 | SUB (IX+$04) | |||||||
| ADJUST_PLYR_UVZ_FOR_ROOM_SIZE_5 | CC5B | LD (IX+$01),A | Store U | |||||
| CC5E | JR ADJUST_PLYR_UVZ_FOR_ROOM_SIZE_2 | |||||||
| ADJUST_PLYR_UVZ_FOR_ROOM_SIZE_6 | CC60 | LD C,$38 | At high U: the arch whose U+V is $38 | |||||
| CC62 | CALL ADJUST_PLYR_Z_FOR_ARCH | |||||||
| CC65 | LD A,L | |||||||
| CC66 | ADD A,$80 | |||||||
| CC68 | ADD A,(IX+$04) | |||||||
| CC6B | JR ADJUST_PLYR_UVZ_FOR_ROOM_SIZE_5 | |||||||
| Prev: CBF9 | Up: Map | Next: CC6D |