Resource centre for ZX Spectrum games
using Manic Miner and Jet Set Willy game engines
Archive of the
Manic Miner & Jet Set Willy Yahoo! Group
messages
|
|
||
|
|
Message: 7164
Author: ian.rushforth
Date: 15/01/2018
Subject: Re: Willy's behaviour on conveyors during the toilet-run
Carl Woffenden wrote (in message 3999, in a separate thread - note that I've corrected a typo in bold):
> - the conveyor direction has 3 subtracted, so we end up with:
> - 253 for left
> - 254 for right
> - 255 for off
> - 0 for sticky.
> - this value is then ANDed with key presses (which are active low)
> - a mask of 010101 is used for RIGHT, and 101010 for LEFT
>
> So 'off' allows through both left and right presses while 'sticky' allows none.
I would invert the logic of the above explanation:
- a Left Conveyor simulates the 'O' Left key being pressed (253 = 11111101 in binary, Bit 1 reset);
- a Right Conveyor simulates the 'P' Right key being pressed (254 = 11111110 in binary, Bit 0 reset);
- an Off Conveyor doesn't simulate any keypresses (255 = 11111111, no bits reset);
- a Class #03 Sticky Conveyor simulates all the Left and Right keys being pressed simultaneously (0 = 00000000, all bits reset).
This explains why pressing 'P' can't stop Willy if he runs across a (Class #03) Sticky Conveyor during the toilet run - even though the toilet run causes Bit 0 to be toggled (reversing the effect of pressing the 'P' key because of a bug/quirky feature? in the code), all the other Right keys are effectively being pressed at the same time (because Bits 2 and 4 are also reset).
However, I have devised a Class #FF (255 in the antiquated decimal counting system) Sticky Conveyor, which has different behaviour during the toilet run!
Once the code has subtracted 3 from the value of the conveyor direction byte, we end up with 252 = 11111100 in binary. Bit 0 and 1 are both reset, but all other bits remain set. So it still simulates the 'O' Left and 'P' Right keys being pressed simultaneously during the normal course of the game. Therefore the Class #03 and Class #FF Sticky Conveyors behave in exactly the same way during Game Modes 0/1.
But once Game Mode 2 (the toilet run) kicks into effect, Bit 0 is toggled - 'P' is 'unpressed' - and this time none of the other Right movement keypresses are being simulated by the #FF Sticky Conveyor, so the behaviour of this Class of Sticky Conveyor is more akin to that of a Left Conveyor (Bit 1 remains reset, simulating 'O' being pressed).
In fact, a Class #FF Sticky Conveyor behaves in exactly the same way as a Left Conveyor when Willy falls onto it during the toilet run. But the way that the Class #FF Sticky responds to keypresses as Willy runs over it during the toilet run, is rather different to the way that a Left Conveyor responds to the keys in that circumstance (as described in my previous post 7162 on this thread).
