![]() |
Routines |
| Prev: 50063 | Up: Map | Next: 50160 |
|
Sends the player to the room to the west if it has gone past the west edge of the room. The x position is set to 0, which PlacePlayerAtDoor takes as the sign that the player has come out of the west and puts it at the east side of the new room.
|
||||||||||
|
Leave if past the west edge.
|
||||||||||
| LeaveRoomToWest | 50071 | POP HL | Restore HL from the stack. | |||||||
| 50072 | LD A,128 | Set A to 128. | ||||||||
| 50074 | SUB L | Subtract L. | ||||||||
| 50075 | LD L,A | Copy it to L. | ||||||||
| 50076 | LD A,(IX+1) | Fetch the x position of the player. | ||||||||
| 50079 | ADD A,(IX+9) | Add the speed along the x axis. | ||||||||
| 50082 | ADD A,(IX+4) | Add the width of the player. | ||||||||
| 50085 | CP L | Return if the player is still in the room. | ||||||||
| 50086 | RET NC | |||||||||
| 50087 | LD (IX+1),0 | Write 0 to the x position. | ||||||||
| 50091 | LD A,(IX+8) | Fetch the room number. | ||||||||
| 50094 | LD L,A | Copy it to L. | ||||||||
| 50095 | DEC A | Decrement A. | ||||||||
|
This entry point is used by the routine at LeaveRoomToEast.
Change the column. The room number has the row in the high nibble and the column in the low nibble.
|
||||||||||
| ChangeRoomEastWest | 50096 | AND %00001111 | Keep only bits 0-3. | |||||||
| 50098 | LD H,A | Copy it to H. | ||||||||
| 50099 | LD A,L | Copy L to A. | ||||||||
| 50100 | AND %11110000 | Keep only bits 4-7. | ||||||||
| 50102 | OR H | Merge H. | ||||||||
|
This entry point is used by the routines at LeaveRoomToNorth and LeaveRoomToSouth.
Change the room of the player. Bit 6 of the collision flags starts the entering-room counter at 4. If the object is the player then it is copied and replaced by sparkles, and the game loop is started again.
|
||||||||||
| ChangeRoom | 50103 | LD (IX+8),A | Store the room number. | |||||||
| 50106 | LD A,(IX+12) | Fetch the collision flags. | ||||||||
| 50109 | OR %01000000 | Set bit 6. | ||||||||
| 50111 | LD (IX+12),A | Store the collision flags. | ||||||||
| 50114 | LD A,(IX+0) | Fetch the sprite number of the object. | ||||||||
| 50117 | SUB 16 | Subtract 16. | ||||||||
| 50119 | CP 64 | Return if it is not the player. | ||||||||
| 50121 | RET NC | |||||||||
| 50122 | INC SP | Drop two return addresses from the stack. | ||||||||
| 50123 | INC SP | |||||||||
| 50124 | INC SP | |||||||||
| 50125 | INC SP | |||||||||
| 50126 | PUSH IX | Copy IX to HL (using the stack). | ||||||||
| 50128 | POP HL | |||||||||
| 50129 | LD DE,51741 | Point DE at PlayerCopy. | ||||||||
| 50132 | LD BC,64 | Set BC to 0064. | ||||||||
| 50135 | LDIR | Copy the player. | ||||||||
|
Remember the sprites, then turn the copy into sparkles.
|
||||||||||
| 50137 | LD A,(51741) | Fetch the sprite of the bottom half. | ||||||||
| 50140 | LD (51757),A | Keep it as the sprite that the bottom half will appear as. | ||||||||
| 50143 | LD A,(51773) | Fetch the sprite of the top half. | ||||||||
| 50146 | LD (51789),A | Keep it as the sprite that the top half will appear as. | ||||||||
| 50149 | LD A,56 | Write 56 to PlayerCopy and PlayerCopy_TopHalf. | ||||||||
| 50151 | LD (51741),A | |||||||||
| 50154 | LD (51773),A | |||||||||
| 50157 | JP RunGame | Jump to RunGame. | ||||||||
|
View the equivalent code in;
|
||||||||||
| Prev: 50063 | Up: Map | Next: 50160 |