![]() |
Routines |
| Prev: CBE3 | Up: Map | Next: CC6D |
|
Used by the routine at BuildRoomObjects.
Puts the player in the right place when it has come into a room through an arch. The routine that moved the player out of the last room set one of its positions to 00 or FF, which tells which way the player came. The player is put at the opposite edge of the room, just outside the wall, and at the height of the arch. If the positions are not one of these, as when the player starts the game or starts again after losing a life, nothing is changed.
|
||||||||
|
Fetch the wall distances, then see which way the player came.
|
||||||||
| PlacePlayerAtDoor | CC01 | LD A,($5B0B) | Fetch RoomSize_X. | |||||
| CC04 | SUB $02 | Subtract 02. | ||||||
| CC06 | LD L,A | Copy it to L. | ||||||
| CC07 | LD A,($5B0C) | Fetch RoomSize_Y. | ||||||
| CC0A | SUB $02 | Subtract 02. | ||||||
| CC0C | LD H,A | Copy it to H. | ||||||
| CC0D | LD A,(IX+$01) | Fetch the x position of the player. | ||||||
| CC10 | AND A | Jump to PlacePlayerAtDoor_East if it is zero. | ||||||
| CC11 | JR Z,PlacePlayerAtDoor_East | |||||||
| CC13 | INC A | Jump to PlacePlayerAtDoor_West if it is FF. | ||||||
| CC14 | JR Z,PlacePlayerAtDoor_West | |||||||
| CC16 | LD A,(IX+$02) | Fetch the y position of the player. | ||||||
| CC19 | AND A | Jump to PlacePlayerAtDoor_North if it is zero. | ||||||
| CC1A | JR Z,PlacePlayerAtDoor_North | |||||||
| CC1C | INC A | Jump to PlacePlayerAtDoor_South if it is FF. | ||||||
| CC1D | JR Z,PlacePlayerAtDoor_South | |||||||
| CC1F | RET | Return. | ||||||
|
The player came from the north.
|
||||||||
| PlacePlayerAtDoor_South | CC20 | LD C,$C8 | Set C to C8. | |||||
| CC22 | CALL FindDoorHeight | Call FindDoorHeight. | ||||||
| CC25 | LD A,$80 | Set A to 80. | ||||||
| CC27 | SUB H | Subtract H. | ||||||
| CC28 | SUB (IX+$05) | Subtract the depth of the player. | ||||||
| PlacePlayerAtDoor_SetY | CC2B | LD (IX+$02),A | Set the y position of the player. | |||||
| PlacePlayerAtDoor_Draw | CC2E | SET 4,(IX+$07) | Set bit 4 of the flags. | |||||
| CC32 | SET 4,(IX+$27) | Set bit 4 of the flags of the top half. | ||||||
| CC36 | LD A,(IX+$01) | Fetch the x position of the player. | ||||||
| CC39 | LD (IX+$21),A | Set the x position of the top half. | ||||||
| CC3C | LD A,(IX+$02) | Fetch the y position of the player. | ||||||
| CC3F | LD (IX+$22),A | Set the y position of the top half. | ||||||
| CC42 | RET | Return. | ||||||
|
The player came from the south.
|
||||||||
| PlacePlayerAtDoor_North | CC43 | LD C,$52 | Set C to 52. | |||||
| CC45 | CALL FindDoorHeight | Call FindDoorHeight. | ||||||
| CC48 | LD A,H | Fetch H. | ||||||
| CC49 | ADD A,$80 | Add 80. | ||||||
| CC4B | ADD A,(IX+$05) | Add the depth of the player. | ||||||
| CC4E | JR PlacePlayerAtDoor_SetY | Jump to PlacePlayerAtDoor_SetY. | ||||||
|
The player came from the east.
|
||||||||
| PlacePlayerAtDoor_West | CC50 | LD C,$AE | Set C to AE. | |||||
| CC52 | CALL FindDoorHeight | Call FindDoorHeight. | ||||||
| CC55 | LD A,$80 | Set A to 80. | ||||||
| CC57 | SUB L | Subtract L. | ||||||
| CC58 | SUB (IX+$04) | Subtract the width of the player. | ||||||
| PlacePlayerAtDoor_SetX | CC5B | LD (IX+$01),A | Set the x position of the player. | |||||
| CC5E | JR PlacePlayerAtDoor_Draw | Jump to PlacePlayerAtDoor_Draw. | ||||||
|
The player came from the west.
|
||||||||
| PlacePlayerAtDoor_East | CC60 | LD C,$38 | Set C to 38. | |||||
| CC62 | CALL FindDoorHeight | Call FindDoorHeight. | ||||||
| CC65 | LD A,L | Fetch L. | ||||||
| CC66 | ADD A,$80 | Add 80. | ||||||
| CC68 | ADD A,(IX+$04) | Add the width of the player. | ||||||
| CC6B | JR PlacePlayerAtDoor_SetX | Jump to PlacePlayerAtDoor_SetX. | ||||||
|
View the equivalent code in;
|
||||||||
| Prev: CBE3 | Up: Map | Next: CC6D |