Prev: 44751 Up: Map Next: 44972
44783: Game Play Start
Used by the routine at GamePlayEntry.
Handles Sabreman while walking (sprite IDs 16 to 31). The controls are read, with the effects of the orchids applied, and turned into an acceleration of 7 in each direction. The player is then moved, tested against the objects in the room and the walking animation is updated. If "fire" is pressed then the player starts to attack (see StartAttack). The velocities are then reduced by one so the player slides to a halt. Finally the player is displayed.
The effect of an orchid depends on the colour of the player: yellow (INK:YELLOW, PAPER:BLACK (BRIGHT)) makes the player sit down, magenta (INK:MAGENTA, PAPER:BLACK (BRIGHT)) reverses the controls, red (INK:RED, PAPER:BLACK (BRIGHT)) lowers the top speed and cyan (INK:CYAN, PAPER:BLACK (BRIGHT)) increases the top speed. The colour white (INK:WHITE, PAPER:BLACK (BRIGHT)) is normal.
Input
IX Actor record of the player
GamePlay_Start 44783 CALL StoreEntity Remember the previous position of the player.
44786 CALL TestPlayerProgress Check the progress of the player.
Is Sabreman yellow?
44789 LD A,(IX+5) Fetch the colour of the player.
44792 CP 70 Jump to HandlerYellowOrchid if the player is yellow (INK:YELLOW, PAPER:BLACK (BRIGHT)).
44794 JR Z,HandlerYellowOrchid
44796 CALL HandlerOrchidTimer Count down the orchid effect.
44799 LD A,16 Set the width of the player in Actor_Width to 16.
44801 LD (38573),A
Check whether the player has been hit.
44804 LD A,(IX+2) Fetch the hit direction of the player.
44807 AND A Jump to KnockPlayerBack if the player has been hit.
44808 JP NZ,KnockPlayerBack
44811 LD DE,0 Clear the movement of the player in DE.
44814 CALL HandlerControls Read the controls.
Is Sabreman magenta?
44817 LD A,(IX+5) Fetch the colour of the player.
44820 CP 67 Jump to GamePlay_Controls if the player is not magenta (INK:MAGENTA, PAPER:BLACK (BRIGHT)).
44822 JR NZ,GamePlay_Controls
Handles reversing the controls as a result of the magenta orchid.
44824 LD A,C Fetch the controls.
44825 XOR %00001111 Flip bits 0-3 (swapping left with right and up with down).
44827 LD C,A Store the reversed controls in C.
This entry point is used by the routine at StopAttack.
GamePlay_Controls 44828 LD A,C Fetch the controls.
44829 LD (38572),A Store the controls in Player_Controls.
Turn the controls into an acceleration in E (X) and D (Y).
44832 LD A,E Fetch the X acceleration.
44833 LD B,7 Set the amount to accelerate by in B to 7.
44835 BIT 1,C Jump to GamePlay_Left if "right" is not being pressed.
44837 JR Z,GamePlay_Left
44839 ADD A,B Add the acceleration for "right".
GamePlay_Left 44840 BIT 0,C Jump to GamePlay_AccelerationX if "left" is not being pressed.
44842 JR Z,GamePlay_AccelerationX
44844 SUB B Subtract the acceleration for "left".
GamePlay_AccelerationX 44845 LD E,A Store the X acceleration in E.
44846 LD A,D Fetch the Y acceleration.
44847 BIT 3,C Jump to GamePlay_Up if "down" is not being pressed.
44849 JR Z,GamePlay_Up
44851 ADD A,B Add the acceleration for "down".
GamePlay_Up 44852 BIT 2,C Jump to GamePlay_AccelerationY if "up" is not being pressed.
44854 JR Z,GamePlay_AccelerationY
44856 SUB B Subtract the acceleration for "up".
GamePlay_AccelerationY 44857 LD D,A Store the Y acceleration in D.
44858 CALL AcceleratePlayer Accelerate the player.
44861 CALL MoveActor Work out the new position of the player.
44864 LD BC,5646 Set the height of the player in B to 22 and the width in C to 14.
44867 CALL SlideActorPastObjects Stop the player passing through objects in the room.
44870 CALL UpdatePlayerDirection Update the direction the player is facing.
44873 CALL TestPositionUnchanged Test whether the player has stayed where it was.
44876 LD (IX+3),E Set the X position of the player.
44879 LD (IX+4),D Set the Y position of the player.
44882 CALL NZ,PlayFootstepSound Play the footstep sound if the player has moved.
Is Sabreman white?
44885 LD A,(IX+5) Fetch the colour of the player.
44888 CP 71 Jump to GamePlay_Friction if the player is not white (INK:WHITE, PAPER:BLACK (BRIGHT)).
44890 JR NZ,GamePlay_Friction
44892 LD A,(38572) Fetch the controls from Player_Controls.
44895 BIT 4,A Jump to GamePlay_Friction if "fire" is not being pressed.
44897 JR Z,GamePlay_Friction
44899 CALL StartAttack Start an attack.
Reduce the velocities by one.
GamePlay_Friction 44902 LD A,(IX+6) Fetch the X velocity of the player.
44905 LD B,1 Set the amount to reduce the velocity by in B to 1.
44907 CALL ReduceVelocity Reduce the X velocity.
44910 LD (IX+6),A Set the new X velocity of the player.
44913 LD A,(IX+7) Fetch the Y velocity of the player.
44916 CALL ReduceVelocity Reduce the Y velocity.
44919 LD (IX+7),A Set the new Y velocity of the player.
This entry point is used by the routine at HandlerYellowOrchid_StandUp.
Display the player. While an orchid effect is about to wear off (the timer in OrchidEffectTimer is below 47) the player flashes between the colour of the orchid and white, with a sound at the start of each phase.
GamePlay_Display 44922 CALL DisplayEntity Move the player on the screen.
44925 LD A,(38576) Fetch the orchid effect timer from OrchidEffectTimer.
44928 AND A Jump to ColourEntity to colour the player if there is no orchid effect.
44929 JP Z,ColourEntity
44932 CP 47 Jump to ColourEntity to colour the player if the orchid effect timer is 47 or more.
44934 JP NC,ColourEntity
44937 AND %00001111 Keep only bits 0-3.
44939 CP 8 Jump to GamePlay_OrchidPhase if bit 3 of the orchid effect timer is set.
44941 JR NC,GamePlay_OrchidPhase
44943 AND %00000111 Keep only bits 0-2.
44945 CALL Z,PlayOrchidFlashBeep Play the orchid flash beep if the timer is at the start of the white phase.
44948 LD A,(IX+5) Fetch the colour of the player (the colour of the orchid).
44951 PUSH AF Stash the colour of the orchid on the stack.
44952 LD (IX+5),71 Set the colour of the player to INK:WHITE, PAPER:BLACK (BRIGHT).
44956 CALL ColourEntity Colour the player.
44959 POP AF Restore the colour of the orchid from the stack.
44960 LD (IX+5),A Set the colour of the player back to the colour of the orchid.
44963 RET Return.
The player is drawn in the colour of the orchid.
GamePlay_OrchidPhase 44964 AND %00000111 Keep only bits 0-2.
44966 CALL Z,PlayOrchidFlashBeep Play the orchid flash beep if the timer is at the start of the orchid phase.
44969 JP ColourEntity Jump to ColourEntity to colour the player.
Prev: 44751 Up: Map Next: 44972