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: 5783

Author: andrewbroad

Date: 06/04/2006

Subject: Arbitrary POKEs on a room-by-room basis

 

I am working on a full reply to Daniel's suggestions for Advanced
MM/JSW Trainer (Message 5766), but I thought the following part
warranted a message of its own, so here it is:


> 9. Special effects
>
> Does JSW64 allow to have arbitrary POKEs turned on/off on a room-
> by-room basis?
>
> If it does, I would say that it would be very interesting to have
> a room with the perpetual motion POKE applied.

It doesn't support this feature explicitly, but it could be achieved
using patch-vectors. So to apply the perpetual-motion POKE (36801,0)
in a particular room, its room-setup vector would be something like
this:

LD HL,36801
LD (HL),0
RET

The problem is how to turn off the POKE when leaving the room.
Unfortunately JSW64 doesn't have room-exit patch-vectors (except
when you leave via a portal), so you can't just say:

LD HL,36801
LD (HL),200
RET

One solution would be to have a subroutine to turn off all POKEs, to
be called by every room in the game. This subroutine would have to
turn off every POKE that is used in some room in the game.

e.g. For a game in which some rooms use perpetual motion (POKE
36801,0), some rooms have harmless guardians (POKE 37050,58) and
some rooms have no gravity (POKE 36358,0), this subroutine would be
as follows:

pokes_off:
LD HL,36801
LD (HL),200 ; perpetual motion off
LD HL,37050
LD (HL),50 ;; harmless guardians off
LD HL,36358
LD (HL),60 ;; no gravity off
RET

Every room in the game would have to call this subroutine in its
room-setup vector. So a room with no special effects would use the
address of pokes_off itself as its room-setup vector, while a room
with special effects would have to call pokes_off before setting the
POKEs for these effects, so its room-setup vector would be something
like this:

CALL pokes_off
LD HL,36801
LD (HL),0 ;;;;;; apply perpetual-motion POKE
RET

Whereas I plan to write a patch for JSW48 to allow each room to
apply one arbitrary POKE, whose address will be stored in Offsets
238/239 and whose value will be stored in Offset 237.

The game-engine will be patched so that whenever a room is entered,
the value already in the address specified by Offsets 238/239 will
be stored in an unused memory-location, and the value in Offset 237
will be written to the specified address. On leaving a room, the old
value will be restored to the specified address.

Using this patch, I intend to write a JSW48 game which will use
every known single-POKE special effect. I'm talking about Afrikaan,
or maybe the little demo-game I created as a test-bed for my lifts-
patch (Files/Broadsoft/Lift-patch.zip) and vertical-conveyors patch
(when written).

I don't intend to use any special effects in v1.0 of Advanced MM/JSW
Trainer, other than those that are already built into JSW64
(including the superjump and fall-without-dying POKEs, which can be
applied on a room-by-room basis).

--
Dr. Andrew Broad
http://geocities.com/andrewbroad/
http://geocities.com/andrewbroad/spectrum/
http://geocities.com/andrewbroad/spectrum/willy/

 

 

arrowleft
arrowright