Prev: AECF Up: Map Next: AFAC
AEEF: Game Play Start
Used by the routine at GamePlayEntry.
Handles Sabreman while walking (sprite IDs 10 to 1F). The controls are read, with the effects of the orchids applied, and turned into an acceleration of 07 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 AEEF CALL StoreEntity Remember the previous position of the player.
AEF2 CALL TestPlayerProgress Check the progress of the player.
Is Sabreman yellow?
AEF5 LD A,(IX+$05) Fetch the colour of the player.
AEF8 CP $46 Jump to HandlerYellowOrchid if the player is yellow (INK:YELLOW, PAPER:BLACK (BRIGHT)).
AEFA JR Z,HandlerYellowOrchid
AEFC CALL HandlerOrchidTimer Count down the orchid effect.
AEFF LD A,$10 Set the width of the player in Actor_Width to 10.
AF01 LD ($96AD),A
Check whether the player has been hit.
AF04 LD A,(IX+$02) Fetch the hit direction of the player.
AF07 AND A Jump to KnockPlayerBack if the player has been hit.
AF08 JP NZ,KnockPlayerBack
AF0B LD DE,$0000 Clear the movement of the player in DE.
AF0E CALL HandlerControls Read the controls.
Is Sabreman magenta?
AF11 LD A,(IX+$05) Fetch the colour of the player.
AF14 CP $43 Jump to GamePlay_Controls if the player is not magenta (INK:MAGENTA, PAPER:BLACK (BRIGHT)).
AF16 JR NZ,GamePlay_Controls
Handles reversing the controls as a result of the magenta orchid.
AF18 LD A,C Fetch the controls.
AF19 XOR %00001111 Flip bits 0-3 (swapping left with right and up with down).
AF1B LD C,A Store the reversed controls in C.
This entry point is used by the routine at StopAttack.
GamePlay_Controls AF1C LD A,C Fetch the controls.
AF1D LD ($96AC),A Store the controls in Player_Controls.
Turn the controls into an acceleration in E (X) and D (Y).
AF20 LD A,E Fetch the X acceleration.
AF21 LD B,$07 Set the amount to accelerate by in B to 07.
AF23 BIT 1,C Jump to GamePlay_Left if "right" is not being pressed.
AF25 JR Z,GamePlay_Left
AF27 ADD A,B Add the acceleration for "right".
GamePlay_Left AF28 BIT 0,C Jump to GamePlay_AccelerationX if "left" is not being pressed.
AF2A JR Z,GamePlay_AccelerationX
AF2C SUB B Subtract the acceleration for "left".
GamePlay_AccelerationX AF2D LD E,A Store the X acceleration in E.
AF2E LD A,D Fetch the Y acceleration.
AF2F BIT 3,C Jump to GamePlay_Up if "down" is not being pressed.
AF31 JR Z,GamePlay_Up
AF33 ADD A,B Add the acceleration for "down".
GamePlay_Up AF34 BIT 2,C Jump to GamePlay_AccelerationY if "up" is not being pressed.
AF36 JR Z,GamePlay_AccelerationY
AF38 SUB B Subtract the acceleration for "up".
GamePlay_AccelerationY AF39 LD D,A Store the Y acceleration in D.
AF3A CALL AcceleratePlayer Accelerate the player.
AF3D CALL MoveActor Work out the new position of the player.
AF40 LD BC,$160E Set the height of the player in B to 16 and the width in C to 0E.
AF43 CALL SlideActorPastObjects Stop the player passing through objects in the room.
AF46 CALL UpdatePlayerDirection Update the direction the player is facing.
AF49 CALL TestPositionUnchanged Test whether the player has stayed where it was.
AF4C LD (IX+$03),E Set the X position of the player.
AF4F LD (IX+$04),D Set the Y position of the player.
AF52 CALL NZ,PlayFootstepSound Play the footstep sound if the player has moved.
Is Sabreman white?
AF55 LD A,(IX+$05) Fetch the colour of the player.
AF58 CP $47 Jump to GamePlay_Friction if the player is not white (INK:WHITE, PAPER:BLACK (BRIGHT)).
AF5A JR NZ,GamePlay_Friction
AF5C LD A,($96AC) Fetch the controls from Player_Controls.
AF5F BIT 4,A Jump to GamePlay_Friction if "fire" is not being pressed.
AF61 JR Z,GamePlay_Friction
AF63 CALL StartAttack Start an attack.
Reduce the velocities by one.
GamePlay_Friction AF66 LD A,(IX+$06) Fetch the X velocity of the player.
AF69 LD B,$01 Set the amount to reduce the velocity by in B to 01.
AF6B CALL ReduceVelocity Reduce the X velocity.
AF6E LD (IX+$06),A Set the new X velocity of the player.
AF71 LD A,(IX+$07) Fetch the Y velocity of the player.
AF74 CALL ReduceVelocity Reduce the Y velocity.
AF77 LD (IX+$07),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 2F) the player flashes between the colour of the orchid and white, with a sound at the start of each phase.
GamePlay_Display AF7A CALL DisplayEntity Move the player on the screen.
AF7D LD A,($96B0) Fetch the orchid effect timer from OrchidEffectTimer.
AF80 AND A Jump to ColourEntity to colour the player if there is no orchid effect.
AF81 JP Z,ColourEntity
AF84 CP $2F Jump to ColourEntity to colour the player if the orchid effect timer is 2F or more.
AF86 JP NC,ColourEntity
AF89 AND %00001111 Keep only bits 0-3.
AF8B CP $08 Jump to GamePlay_OrchidPhase if bit 3 of the orchid effect timer is set.
AF8D JR NC,GamePlay_OrchidPhase
AF8F AND %00000111 Keep only bits 0-2.
AF91 CALL Z,PlayOrchidFlashBeep Play the orchid flash beep if the timer is at the start of the white phase.
AF94 LD A,(IX+$05) Fetch the colour of the player (the colour of the orchid).
AF97 PUSH AF Stash the colour of the orchid on the stack.
AF98 LD (IX+$05),$47 Set the colour of the player to INK:WHITE, PAPER:BLACK (BRIGHT).
AF9C CALL ColourEntity Colour the player.
AF9F POP AF Restore the colour of the orchid from the stack.
AFA0 LD (IX+$05),A Set the colour of the player back to the colour of the orchid.
AFA3 RET Return.
The player is drawn in the colour of the orchid.
GamePlay_OrchidPhase AFA4 AND %00000111 Keep only bits 0-2.
AFA6 CALL Z,PlayOrchidFlashBeep Play the orchid flash beep if the timer is at the start of the orchid phase.
AFA9 JP ColourEntity Jump to ColourEntity to colour the player.
Prev: AECF Up: Map Next: AFAC