Jump to content


Photo

Rationale behind a couple of 'oddities' in the JSW game mechanics


  • Please log in to reply
No replies to this topic

#1 IRF

IRF

    Advanced Member

  • Contributor
  • 4,150 posts

Posted 30 June 2016 - 10:50 AM

I thought I would clarify the likely reasons behind a couple of elements of the JSW code that controls Willy's motion, as I see them:

(1) When Willy finishes a jump, the Airborne Status Indicator at #85D1 is changed from 1 (the value that determines that Willy is jumping) to 6 (by the command at #8EB0), rather than a value of 2 which is what it is set to when Willy begins falling after walking off a platform (or dropping off the end of a rope).
During a fall, Willy's y-coordinate is increased by four pixels (half a cell-height) in each time-frame, and the Airborne Status Indicator is incremented by 1. So the difference between 2 (at the start of a fall) and 6 (at the end of a jump) represents the two cell-rows of descent that took place during the latter half of the jump. (Actually, Willy's jumps take him a couple of pixels higher than two cell-rows above his starting point in the jump, so it's rounded down slightly.)
If it wasn't for this adjustment, i.e. if the Airborne Status Indicator was set to 2 at the end of a jump, then Willy would effectively be able to fall the height of six cells from the apex of his jump, without being killed.

(2) The checks at #92C0-92CB determine if and when Willy gets picked up by a Rope - this occurs if the Rope Status Indicator at #85D6 is set to 0 AND if a segment of Rope touches Willy's sprite [or any other filled-in pixel that is drawn before the Rope - which normally means any other room element or guardian, apart from Arrows or collectable Items].
However, when Willy jumps off a Rope (or falls off the bottom of it), the Rope Status Indicator is set to a value of 240 (#F0), or to look at it another way -16 (-#10). This is then incremented by 1 in each subsequent time-frame, until it reaches 256 and wraps round to 00.
Thus for the first 16 time-frames after Willy jumps or falls off a Rope, he can't be caught by it again.
I believe the rationale behind this is that it gives Willy a chance to get clear of the Rope when he jumps or falls off - otherwise it would be very difficult to gain sufficient clearance when trying to dismount Ropes (an adjacent segment of the Rope could pick him up again in the next time-frame, immediately after he's jumped off).
To prove the point, try POKing 36778 (#8FAA) and 37796 (#93A4) to 0 [so that the Rope Status Indicator is set to 0 as soon as Willy jumps or falls off a Rope], and then see how awkward it is to disentangle Willy from a Rope!


Edited by IRF, 31 August 2018 - 02:01 PM.





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users