Only one frame of an animating tile kills Keen?

Request patches for Keens 1-3.
Post Reply
User avatar
8bit-herpetology
Posts: 11
Joined: Mon Jan 15, 2018 9:53 am

Only one frame of an animating tile kills Keen?

Post by 8bit-herpetology »

Hello,
New member here...
I am working on my first mod of Keen1, which has Keen as the protagonist, and will be a cross-over/unofficial sequel to an 80'ies game I always found to be rather keenish in tone and setting (which one it is will be revealed later in another post). Progress is good with the following parts already done:
Storytxt completely rewritten and put into the game.
Tileset about 75% done, including new tileinfo.
Sprites completely replaced for vorticon, yorp, garg, butler-bot, ice cube, and "frozen Keen".
A handful of levels done.
Loading graphics, title screen and title screen level are all done.

I have used a few of the simpler published patches, like changing the speed of the butler-bot etc. Making brand new patches is however beyond my abilities. To realize some of the neat ideas I have for this mod, I would need a few novel patches, and so ask you good people for help. In return I can offer a new mod which would hopefully be enjoyable to play!

First: Would it be possible to have a 4-frame animating tile, where only one of those frames kills Keen? I have already tried to use TileInfo for this, (setting 3 tiles of the sequence to "Nothing" and 1 to "Killing"), but it appears that the tile-property of the whole sequence is dictated by that of the first frame...

The idea is of course to have, for example, a spear coming out of a hole in the ground, but it only kills when fully out, allowing Keen to pass unharmed when it is retracted, like in the Keen-Galaxy games.

Thank you for your time!
User avatar
Nisaba
Posts: 320
Joined: Fri Jan 01, 2016 11:15 pm
Location: patch.pat
Contact:

Re: Only one frame of an animating tile kills Keen?

Post by Nisaba »

hey there 8bit-herpetology
and welcome to the forums!

it sounds like you've already had some modding experience, right?!

concering your patch request...
someone else has an idea on that?! For Galaxy mods it's pretty straight forward but for Vorticons... to be honest, I don't really know if anything similar exists. need to look into that but not before Sunday. maybe someone else can help (@Fleex, @Lass, @Rush)?!

anyways, I'm looking forward for further updates of yours.
User avatar
CommanderSpleen
Posts: 1017
Joined: Sun Aug 31, 2003 12:11 pm
Location: The Land of Sparkly Things
Contact:

Re: Only one frame of an animating tile kills Keen?

Post by CommanderSpleen »

Maybe you could patch the chain sprite to kill Keen on contact and set an animation sequence with one of the frames having a higher bounding box, then place it one tile below the ground...
User avatar
8bit-herpetology
Posts: 11
Joined: Mon Jan 15, 2018 9:53 am

Re: Only one frame of an animating tile kills Keen?

Post by 8bit-herpetology »

Hi Nisaba,
Thanks for the welcome!
Back in the mid-nineties I poked around in the keen1 files with a hex-editor (one build into Norton Commander, I think?)... actually succeeded in replacing all Keen's sprites with those of the yorp. Except for pogoing to the right - that would always become the dead yorp no matter what I did... Also did a lot of levels and graphics modding for Doom in the late nineties - made the imp into a yorp (yeah I like yorps...). Unfortunately all that stuff has been lost over the years.
So, I would say this is my first serious modding attempt with a clear end-goal. With all the great tools that have been made available during the last decade or so, it seems easier than ever to get into, so there is really no excuse not to mod, I think ;)

Cmdr. Spleen: If a kill-tile-based approach is not possible, it is certainly not a bad idea to use the chain.
The only thing is, I already have plans for it in the penultimate level where shooting it, causing a block to fall, will be part of the story...
levellass
Posts: 3001
Joined: Wed Oct 11, 2006 12:03 pm
Location: Ngaruawahia New Zealand

Re: Only one frame of an animating tile kills Keen?

Post by levellass »

Sadly the properties of tiles are pretty hard-baked into the game; the tile placed in a level will set the properties for the entire animation loop; only the image changes unlike Keen Galaxy. This is also why it uses strict 2 and 4 tile animation loops.

To do this would require the creation of a new tile type 'Sometimes deadly' that would be very tricky to accomplish. Not impossible but certainly very involved at this end and yours.

A sprite-based solution is actually remarkably easy; adding a new sprite is very simple and this following patch does so. (It's just a copy of the existing chain using a different sprite since I don't know if this solution appeals as yet.) If you're using Keengraph to edit you can also add extra new sprite frames to Keen 1-3 by simply expanding the LIST.TXT file. The biggest question is how many of these sprites you'd need per level; Keen has a set limit of around 70 sprites total and sprinkling them everywhere like confetti isn't possible.

Code: Select all

#SECTION 1: Re-write the core switch statement. (Note $168AW is where our sprite list is)
%patch $161D $4B $83 $FB $0A $76 $0A $81 $FB $FE $00 $0F $84 $A0 $00 $E9 $C1
             $00 $D1 $E4 $2E $D1 $E3 $2E $FF $A7 $168AW
#Combine the ice-launchers
%patch $16B1 $D1 $EB $83 $EB $05 $53

#SECTION 2: Locations of primary sprite code
%patch $168A $1656W #Yorp
             $1661W #Garg
             $166CW #Vorticon
             $1676W #Butler
             $1680W #Tank
             $16B1W #Ice Launcher 1
             $16B1W #Ice Launcher 2
             $16B1W #Ice Launcher 3
             $16B1W #Ice Launcher 4
             $16C1W #Falling Block
             $0AF2W #New sprite

#SECTION 3: Primary sprite spawn code
%patch $0AF2 $57 $56 $E8 $0006W  $83 $C4 $04 $E9 $0BF2W

#SECTION 4: New sprite spawned code
%patch $0AFD $55 $8B $EC $56 $E8 $1E31W  $8B $F0 $C7 $04 $0008W  $8B $46 $04 #Sprite type = 8
             $99 $B1 $0C $E8 $D63EW  $89 $44 $04 $89 $54 $06 $8B $46 $06 $99
             $B1 $0C $E8 $D62FW  $89 $44 $08 $89 $54 $0A $C7 $44 $32 $3360W  #Start behavior at $3360 (Nothing)
             $C7 $44 $34 $22BBW  $C7 $44 $28 $0071W  $5E $5D $C3             #Death $22BB, start (and only) animation $71
User avatar
8bit-herpetology
Posts: 11
Joined: Mon Jan 15, 2018 9:53 am

Re: Only one frame of an animating tile kills Keen?

Post by 8bit-herpetology »

The sprite-based approach is definitely interesting, if the original Chain can be kept, and another sprite, with it's own characteristics, can be added for the "Periodic Environmental Hazard", hereafter abbreviated PEH.

Is the patch you show, made so that the PEH cannot be shot, or can it be modified in that way? That would be most appropriate for an environmental hazard, I think.
How many frames of animation is it set to have (only one of which is lethal)?
How about the speed of animation? Can it be tweaked so it is difficult, but not impossible, to pass the PEH?

As for the total number of sprites in my levels, I would probably have maximum 10 of the PEH, Keen himself, a few Ice Launchers, maybe 10-15 creatures. So nowhere near 70 sprites per level. Speaking of Ice Launchers; I see something (combine?) is done with them in your patch - would the "up-left" and "up-right" Ice Launchers still be available to use with this patch?

Please forgive all the "novice-modder questions", I'm just excited about the possibilities :)

I will start looking into KeenGraph, as I have not used it yet...
levellass
Posts: 3001
Joined: Wed Oct 11, 2006 12:03 pm
Location: Ngaruawahia New Zealand

Re: Only one frame of an animating tile kills Keen?

Post by levellass »

In the patch above there's a duplicate chain with one frame of animation that looks different from the default chain. (You can add it to your patchfile and see the results.) It can be shot but changing this is trifling. I can make a complete patch if I'm just given the frames the new sprite will need to use.
User avatar
8bit-herpetology
Posts: 11
Joined: Mon Jan 15, 2018 9:53 am

Re: Only one frame of an animating tile kills Keen?

Post by 8bit-herpetology »

Thanks levellass.
I have tried to add your patch to my patch file, and used KeenGraph to add two additional sprites (1SPR0119 and 1SPR0120). However, I must admit, I am just not competent enough to get it to work in my mod. The first obstacle is that I don't know the sprite number to use in Mindbelt?

If, as you say, you could make the complete patch (for dummies, I guess), I would be very grateful. Would two frames of animation be enough, you think? Or would it need 4, to better fine-tune the "safe time" where Keen is able to pass the hazard?
levellass
Posts: 3001
Joined: Wed Oct 11, 2006 12:03 pm
Location: Ngaruawahia New Zealand

Re: Only one frame of an animating tile kills Keen?

Post by levellass »

Ok, this patch does what you need.

Code: Select all

#SECTION 1: Re-write the core switch statement. (Note $168AW is where our sprite list is)
%patch $161D $4B $83 $FB $0A $76 $0A $81 $FB $FE $00 $0F $84 $A0 $00 $E9 $C1
             $00 $D1 $E4 $2E $D1 $E3 $2E $FF $A7 $168AW
#Combine the ice-launchers
%patch $16B1 $D1 $EB $83 $EB $05 $53

#SECTION 2: Locations of primary sprite code
%patch $168A $1656W #Yorp
             $1661W #Garg
             $166CW #Vorticon
             $1676W #Butler
             $1680W #Tank
             $16B1W #Ice Launcher 1
             $16B1W #Ice Launcher 2
             $16B1W #Ice Launcher 3
             $16B1W #Ice Launcher 4
             $16C1W #Falling Block
             $0AF2W #New sprite


#SECTION 3: Primary sprite spawn code
%patch $0AF2 $57 $56 $E8 $0006W  $83 $C4 $04 $E9 $0BF2W

#SECTION 4: New sprite spawned code
%patch $0AFD $55 $8B $EC $56 $E8 $1E31W  $8B $F0 $C7 $04 $0005W  $8B $46 $04 #Sprite type = 5
             $99 $B1 $0C $E8 $D63EW  $89 $44 $04 $89 $54 $06 $8B $46 $06 $99
             $B1 $0C $E8 $D62FW  $89 $44 $08 $89 $54 $0A $C7 $44 $20 $0090W  #Speed = $90 = 144
             $8B $44 $06 $8B $54 $04 $3B $06 $E0 $6E $7F $10 $7C $06 $3B $16
             $DE $6E $73 $08 $8B $44 $20 $F7 $D8 $89 $44 $20 $C7 $44 $32 
         $0B5BW  $C7 $44 $34 $1E94W  $C7 $44 $28 $0060W  $5E $5D $C3

#Sprite kills Keen in second animation only
%patch $0B5B $55 $8B $EC $C7 $06 $8240W  $0000W  $A1 $5135W  $B1 $08 $D3 $E8
             $25 $0001W  $05 $0030W  $A3 $8248W  $83 $3E $8248W  $30 $75 $08
             $C7 $06 $8220W  $0001W  $EB $06 $C7 $06 $8220W  $0003W  $5D $C3
The very last part is what you need to pay attention to, here it uses two Yorp animations, $0030W and $0031W. When it's using $0031W it will kill Keen otherwise he can pass. If you're using extra frames you want to change $0030W and $30 in the second line of the last paragraph to $0077W and $77.

The first line of the last paragraph contains '$B1 $08 $D3 $E8' where $08 is the animation speed. Values of 6-9 work pretty decently as a hazard, but if they aren't quite right you'll need to use four frames and I'll need to tweak the patch slightly. I suggest trying it out as-is then tweaking it to what you want.
User avatar
8bit-herpetology
Posts: 11
Joined: Mon Jan 15, 2018 9:53 am

Re: Only one frame of an animating tile kills Keen?

Post by 8bit-herpetology »

Thank you so much, I can't wait for tomorrow, when I will have some time to try it out!

Quick question: Which sprite number do I use in Mindbelt to insert the hazard? (EDIT: I found out it was 11)

Further edit:
I made a test-level and tried it as-is with the two alternating yorp frames, and the speed is perfect at 7.

However, when I try to make use of the two new sprite frames I made (119 and 120), by replacing 30 with 77 (=119 in hex) in the patch, the result is that neither Keen nor the hazard shows up in the test-level and the keyboard seems to be disabled. Any idea what's wrong?

Final edit: Problem solved. I had a mess in my modding tools and was sort of using Modkeen and Keengraph at the same time... With just Keengraph it works. Thanks again, the mod is coming along nicely!
Post Reply