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: 5466
Author: andrewbroad
Date: 02/02/2006
Subject: Andrew's ideas for implementing lifts in JSW
-------------------------------------------
Top-down attack: Alternatives and solutions
-------------------------------------------
1. How to identify a guardian as being a lift:
(a) Guardian-class Offset 0 (Bits 2:0). Values 1-4 identify a
horizontal guardian, vertical guardian, rope or arrow, but values 0,
5, 6, 7 are unused (Geoff-mode uses values 5 and 6 for wraparound
guardians; JSW128 and JSW64 use values 5 and 6 for diagonal
guardians, and 7 for a colour-cycling vertical guardian).
(b) Guardian-class Offset 0 (Bits 6, 5 and 3 are unused, although
Geoff-mode uses Bits 4:3 for diagonal guardians, and Bits 6:5 for
the phase of the guardian; JSW128 and JSW64 use Bits 3:0 for a 4-bit
guardian-type, and Bits 7:4 for extended guardian-types - only when
Bits 3:0 are 1000b).
(c) Guardian-class Offset 1 (Bit 4 is unused, although Geoff-mode
uses it for diagonal guardians; JSW128 and JSW64 use it only for
arrows).
(d) Guardian-class Offset 1, where lifts have a distinguished colour-
attribute (my least-favourite idea).
(e) Guardian-class Offset 5, where lifts have a distinguished sprite-
page (need 4 sprites for a horizontal lift, one sprite for a
vertical lift). This means that the player need never doubt whether
a guardian is a lift or not.
2. How to make lifts stand-onable:
(a) Draw lifts before Willy. This would work fine for horizontal
lifts, but vertical lifts would simply let him fall down one cell-
row at a time, and would not take him up at all. It would also
prevent lifts from killing Willy by colliding with his pixels.
(b) Detect that Willy is standing on the lift by comparing its
position with his (Willy's head must be two cells above the top of
the lift, and Willy must be either in the same cell-column as the
lift or one cell to the left or right). If Willy is standing on the
lift, then go into walking-mode (i.e. branch to 8ED4h).
3. Which object detects Willy standing on a lift?
(a) Willy himself. When he checks what he's standing on (8E36h), he
also executes 2.(b) for each guardian in the room. This could slow
the game down unnecessarily in rooms without lifts.
(b) The lift itself executes 2.(b) every time-frame. This could
catch Willy at inappropriate times during a jump (Willy only checks
what he's standing on after 13, 16 and 18 time-frames since the
start of a jump), but it certainly feels better than 3.(a).
4. How to move Willy on a vertical lift:
(a) Simply set WillyY:= (LiftY - 16 pixels). Might this have nasty
side-effects when Willy jumps off the lift, like the superjump POKE
when Willy gets misaligned and falls through stand-onable cells?
(b) Set WillyY:= (LiftY - 16 pixels), rounded to align WillyY to the
cell-row above. Then draw Willy the remaining number of pixel-rows
lower, like when he's on a ramp.
5. How to move Willy on a horizontal lift:
(a) Don't - he must walk to keep up!
(b) Use 2.(a), and let the colour-attribute of the lift determine
whether it behaves as a conveyor (Willy would not be able to turn).
(c) Always walk Willy in the direction he's facing, à la the
perpetual-motion POKE.
(d) Walk Willy in the direction the lift is going unless he walks in
the other direction.
----------------------------------------------------------------
Bottom-up attack: What mean'st thou to disassemble with me thus?
----------------------------------------------------------------
I'm also attacking the problem from the other direction - by reverse-
engineering the JSW64:MM variant known as "m.z80", which contains a
thing like a lift:
> java Disassemble -hl m.z80 0x9945 0x99909945: jp 93B3
9948: call 9193
994B: jp 91B6
994E: call 9974
9951: jr z,996C
9953: ld a,(85CF)
9956: ld c,(ix+3)
9959: cp c
995A: jr nc,996C
995C: ld a,(ix+3)
995F: sub 1E
9961: ld (85CF),a
9964: ld hl,6818
9967: ld (8E6A),hl
996A: jr 9945
996C: ld hl,D021
996F: ld (8E6A),hl
9972: jr 9945
9974: ld a,C9
9976: ld (922E),a
9979: call 91D6
997C: push de
997D: push hl
997E: call 9456
9981: pop hl
9982: pop de
9983: jr z,998B
9985: ld c,0
9987: call 9456
998A: inc a
998B: ld a,CD
998D: ld (922E),a
9990: ret
This code corresponds, to a large extent, with the "Experimental
lift support" in dmm64.zsm of JSW64:Dragon.
--
Dr. Andrew Broad
http://geocities.com/andrewbroad/
http://geocities.com/andrewbroad/spectrum/
http://geocities.com/andrewbroad/spectrum/willy/
