![]() |
Routines |
| Prev: 93A6 | Up: Map | Next: 945C |
|
Drop a thrown platform (type 2F): speed it up under gravity and move it along. When it reaches the ground line, stamp it into the terrain and free the slot.
|
||||||||
|
Increase the downward thrust by two, up to a cap of 30.
|
||||||||
| Handler_FallingPlatform | 93E8 | LD A,(IX+$06) | Fetch the vertical thrust. | |||||
| 93EB | CP $30 | Jump to Handler_FallingPlatform_ApplyGravity if it is already at least 30. | ||||||
| 93ED | JR NC,Handler_FallingPlatform_ApplyGravity | |||||||
| 93EF | INC (IX+$06) | Increase the thrust by two. | ||||||
| 93F2 | INC (IX+$06) | |||||||
|
Turn the thrust into a Y movement and test for the ground.
|
||||||||
| Handler_FallingPlatform_ApplyGravity | 93F5 | SRA A | Divide the thrust by 10. | |||||
| 93F7 | SRA A | |||||||
| 93F9 | SRA A | |||||||
| 93FB | SRA A | |||||||
| 93FD | ADD A,(IX+$04) | Add it to the actor's Y position. | ||||||
| 9400 | LD (IX+$04),A | Write the Y position back. | ||||||
| 9403 | CP $B0 | Jump to Handler_FallingPlatform_AddSpeed if the actor is still above the ground line. | ||||||
| 9405 | JR C,Handler_FallingPlatform_AddSpeed | |||||||
|
When the actor has hit the ground, stamp tile 03 into two terrain cells.
|
||||||||
| 9407 | CALL ReadTerrainCell | Call ReadTerrainCell. | ||||||
|
Snap the actor to the ground line.
|
||||||||
| 940A | LD A,$B7 | Write B7 to the actor's Y position. | ||||||
| 940C | LD (IX+$04),A | |||||||
| 940F | LD DE,$7000 | DE=TerrainData_Active. | ||||||
| 9412 | EX DE,HL | Point HL at the terrain cell. | ||||||
| 9413 | ADD HL,DE | |||||||
| 9414 | LD (HL),$03 | Write tile 03 into that cell. | ||||||
|
Step to the next cell, wrapping the index, and stamp it too.
|
||||||||
| 9416 | INC DE | Move onto the next cell. | ||||||
| 9417 | LD A,D | Fetch the high byte. | ||||||
| 9418 | AND %00000011 | Keep only bits 0-1. | ||||||
| 941A | LD D,A | Write it back to D. | ||||||
| 941B | LD HL,$7000 | Point HL at that terrain cell. | ||||||
| 941E | ADD HL,DE | |||||||
| 941F | LD (HL),$03 | Write tile 03 into that cell. | ||||||
|
Align the actor to a character column, clear the terrain pixels beneath it and free the slot.
|
||||||||
| 9421 | LD A,(IX+$02) | Fetch the low byte of the world X. | ||||||
| 9424 | AND %11111000 | Keep only bits 3-7. | ||||||
| 9426 | LD L,A | Align the world X to a character column. | ||||||
| 9427 | LD (IX+$02),L | |||||||
| 942A | CALL ClearTerrainUnderActor | Call ClearTerrainUnderActor. | ||||||
| 942D | CALL DrawSprite | Call DrawSprite. | ||||||
| 9430 | LD (IX+$00),$00 | Write 00 to the actor type. | ||||||
| 9434 | RET | Return. | ||||||
|
Add the horizontal speed and redraw the actor.
|
||||||||
| Handler_FallingPlatform_AddSpeed | 9435 | LD A,(IX+$05) | Fetch the horizontal speed. | |||||
| 9438 | SRA A | Divide it by 10. | ||||||
| 943A | SRA A | |||||||
| 943C | SRA A | |||||||
| 943E | SRA A | |||||||
| 9440 | LD C,A | Copy the step into C and clear B. | ||||||
| 9441 | LD B,$00 | |||||||
| 9443 | JP P,Handler_FallingPlatform_WriteWorldX | Jump to Handler_FallingPlatform_WriteWorldX if the step is positive. | ||||||
| 9446 | LD B,$FF | Set B=FF for a negative step. | ||||||
|
Add the step to the world X and redraw the actor.
|
||||||||
| Handler_FallingPlatform_WriteWorldX | 9448 | LD L,(IX+$02) | Fetch the low byte of the world X. | |||||
| 944B | LD H,(IX+$03) | Fetch the high byte of the world X. | ||||||
| 944E | ADD HL,BC | Add the step to the world X. | ||||||
| 944F | LD (IX+$03),H | Write the high byte back. | ||||||
| 9452 | LD (IX+$02),L | Write the low byte back. | ||||||
| 9455 | CALL DrawSprite | Call DrawSprite. | ||||||
| 9458 | CALL ColouriseSprite | Call ColouriseSprite. | ||||||
| 945B | RET | Return. | ||||||
| Prev: 93A6 | Up: Map | Next: 945C |