Turn the icecubes into a simple new enemy?

Request patches for Keens 1-3.
Nospike
Posts: 160
Joined: Fri Apr 23, 2010 1:54 pm
Location: Some cool place, idk

Turn the icecubes into a simple new enemy?

Post by Nospike »

I won't be using the icecubes and my enemy list looks rather bland (at the moment I have 3 enemies that kill Keen and are killable, 1 passive creature and, of course, the boss). I think having a slicestar-like enemy that slowly moves around, kills Keen and is invincible could freshen the levels up a little and might make for some interesting puzzles. (Bridges anyone?)
I'd love it if someone could make this patch for me. How would I spawn the actual icecubes without using the cannons though?
levellass
Posts: 3001
Joined: Wed Oct 11, 2006 12:03 pm
Location: Ngaruawahia New Zealand

Post by levellass »

Whoo, this could be a bit complex. The first thing we want to do is standardize all those sprites

Code: Select all

#Re-write the core switch statement.
%patch $161D $4B $83 $FB $09 $76 $0A $81 $FB $FE $00 $0F $84 $A0 $00 $E9 $C1
             $00 $D1 $E4 $2E $D1 $E3 $2E $FF $A7 $168AW

#Locations of jumps to sprite spawn code
%patch $168A $1656W #Yorp
             $1661W #Garg
             $166CW #Vorticon
             $1676W #Butler
             $1680W #Tank
             $0AF2W #Ice Launcher 1
             $0AF2W #Ice Launcher 2
             $0AF2W #Ice Launcher 3
             $0AF2W #Ice Launcher 4
             $16C1W #Falling Block
This gives us four new spawn points. From this I can set up some initiation and spawning code. I will make all four ice launchers the same sprite in this example, but you can have three other new enemies if you wish.

Code: Select all

#Initiation code
%patch $0AF2 $57 $56 $E8 $0006W $83 $C4 $04 $E9 $0BF2W

#New sprite spawn code
%patch $0AFD $55 $8B $EC $56 $E8 $1E31W  $8B $F0 $C7 $04 $0003W  $8B $46 $04
             $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 $0BA5W
             $C7 $44 $34 $1E94W  $C7 $44 $28 $0073W  $5E $5D $C3

This enemy uses the butler robot's collision (It will stop keen's shots, but not be destroyed.) and use the Garg's sprite type (Kill Keen on contact.)

Now all we need is the behavior. This will require two behaviors, one to walk, and one to seek Keen, like the Yorp uses.

Code: Select all

#New sprite walks, randomly look
%patch $0B3A $55 $8B $EC $56 $83 $3E $42 $82 $00 $75 $15 $E8 $B586W  $3B $06
             $14 $5B $73 $0C $C7 $06 $52
             $82 $0BA5W  $C7 $06 $4A $82 $0000W  $83 $3E $40 $82 $00 $7E $08
             $C7 $06 $48 $82 $0034W  $EB $06 $C7 $06 $48 $82 $0036W  $A1 $35
             $51 $B1 $04 $D3 $E8 $25 $01 $00 $8B $16 $48 $82 $03 $D0 $89 $16
             $48 $82 $E8 $20A4W  $E8 $20E4W  $8B $F0 $A9 $04 $00 $74 $06 $C7
             $06 $40 $82 $FFC4W  $F7 $C6 $01 $00 $74 $06 $C7 $06 $40 $82 $003CW
                 $5E $5D $C3

#Sprite searching code
%patch $0BA5 $55 $8B $EC $C7 $06 $40 $82 $0000W  $A1 $35 $51 $B1 $05 $D3 $E8
             $25 $0003W  $05 $0030W  $A3 $48 $82 $A1 $4A $82 $03 $06 $14 $5B
             $A3 $4A $82 $3D $00C8W  $7C $29 $A1 $26 $82 $8B $16 $24 $82 $3B
             $06 $E0 $6E $7F $10 $7C $06 $3B $16 $DE $6E $73 $08 $C7 $06 $40
             $82 $003CW  $EB $06 $C7 $06 $40 $82 $FFC4W  $C7 $06 $52 $82 $0B3AW
                 $E8 $2031W  $E8 $2071W  $5D $C3
This will produce a Yorp-like enemy that cannot be stunned and doesn't jump. I even set the animations to be Yorp, until you change them to use other things. (If you're using Keengraph, just insert some new sprite frames after the icecube and such.)

The following things can be patched:

* FFC4 and 003C are the left and right speeds
* 0030 is the searching animation, seen in the searching code and the sprite spawn
* 0034 and 0036 are the left and right walking animations
* In the walking code $B1 $04 $D3 $E8 $25 $01 $00; 04 is the animation speed, 01 is the frames (1 + 1 = 2 frames.)
* In the searching code $05 $D3 $E8 $25 $0003W 05 is the animation speed, 03 the frames (3 + 1 = 4 frames)


In summary, here is the patch in its entirety, just for easy copy-paste (It will also be uploaded as an example to the Keenwiki.)

Code: Select all

#Re-write the core switch statement.
%patch $161D $4B $83 $FB $09 $76 $0A $81 $FB $FE $00 $0F $84 $A0 $00 $E9 $C1
             $00 $D1 $E4 $2E $D1 $E3 $2E $FF $A7 $168AW

#Locations of jumps to sprite spawn code
%patch $168A $1656W #Yorp
             $1661W #Garg
             $166CW #Vorticon
             $1676W #Butler
             $1680W #Tank
             $0AF2W #New sprite
             $0AF2W #New sprite
             $0AF2W #New sprite
             $0AF2W #New sprite
             $16C1W #Falling Block

#Initiation code
%patch $0AF2 $57 $56 $E8 $0006W $83 $C4 $04 $E9 $0BF2W

#New sprite spawn code
%patch $0AFD $55 $8B $EC $56 $E8 $1E31W  $8B $F0 $C7 $04 $0003W  $8B $46 $04
             $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 $0B3AW
             $C7 $44 $34 $1E94W  $C7 $44 $28 $0030W  $5E $5D $C3

#New sprite walks, randomly look
%patch $0B3A $55 $8B $EC $56 $83 $3E $42 $82 $00 $75 $15 $E8 $B586W  $3B $06
             $14 $5B $73 $0C $C7 $06 $52
             $82 $19D3W  $C7 $06 $4A $82 $0000W  $83 $3E $40 $82 $00 $7E $08
             $C7 $06 $48 $82 $0034W  $EB $06 $C7 $06 $48 $82 $0036W  $A1 $35
             $51 $B1 $04 $D3 $E8 $25 $01 $00 $8B $16 $48 $82 $03 $D0 $89 $16
             $48 $82 $E8 $20A4W  $E8 $20E4W  $8B $F0 $A9 $04 $00 $74 $06 $C7
             $06 $40 $82 $FFC4W  $F7 $C6 $01 $00 $74 $06 $C7 $06 $40 $82 $003CW
                 $5E $5D $C3

#Sprite searching code
%patch $0BA5 $55 $8B $EC $C7 $06 $40 $82 $0000W  $A1 $35 $51 $B1 $05 $D3 $E8
             $25 $0003W  $05 $0030W  $A3 $48 $82 $A1 $4A $82 $03 $06 $14 $5B
             $A3 $4A $82 $3D $00C8W  $7C $29 $A1 $26 $82 $8B $16 $24 $82 $3B
             $06 $E0 $6E $7F $10 $7C $06 $3B $16 $DE $6E $73 $08 $C7 $06 $40
             $82 $003CW  $EB $06 $C7 $06 $40 $82 $FFC4W  $C7 $06 $52 $82 $0B3AW
                 $E8 $2031W  $E8 $2071W  $5D $C3
Nospike
Posts: 160
Joined: Fri Apr 23, 2010 1:54 pm
Location: Some cool place, idk

Post by Nospike »

Thanks a lot, whoa this seems hefty. It'll help me enlarge the cast of characters significantly though.
Benvolio
Posts: 228
Joined: Sun Aug 29, 2004 4:44 pm
Location: Ireland
Contact:

Post by Benvolio »

Are there still Keenest Person of the Year Awards? I think Levellass should get one!

Looking forward to your mod, Nospike!
Nospike
Posts: 160
Joined: Fri Apr 23, 2010 1:54 pm
Location: Some cool place, idk

Post by Nospike »

Thanks, and I fully agree with Lass' nomination.
levellass
Posts: 3001
Joined: Wed Oct 11, 2006 12:03 pm
Location: Ngaruawahia New Zealand

Post by levellass »

I don't think there's been one for like 5 years.


There's still extra space in this patch, probably at least enough for another enemy.
Nospike
Posts: 160
Joined: Fri Apr 23, 2010 1:54 pm
Location: Some cool place, idk

Post by Nospike »

Just tried getting this patch ingame and realized that I wasn't clear enough. I'd like the new enemy to use the butler bot behavior (walk around, turn on edges) I didn't find the butler bot code on the keenwiki so I'm stumped.
To make it even simpler, I want a slicestar in keen 1. Turns around when it reaches an edge, moves slowly, kills keen and can't be destroyed. It also uses only 1 animation frame, which is the icecube frame. Can you do that for me levellass? Please? :p
levellass
Posts: 3001
Joined: Wed Oct 11, 2006 12:03 pm
Location: Ngaruawahia New Zealand

Post by levellass »

Righto then! This patch utilizes a Butler Robot like behavior, using only one frame of animation:

Code: Select all

#Re-write the core switch statement.
%patch $161D $4B $83 $FB $09 $76 $0A $81 $FB $FE $00 $0F $84 $A0 $00 $E9 $C1
             $00 $D1 $E4 $2E $D1 $E3 $2E $FF $A7 $168AW

#Locations of jumps to sprite spawn code
%patch $168A $1656W #Yorp
             $1661W #Garg
             $166CW #Vorticon
             $1676W #Butler
             $1680W #Tank
             $0AF2W #New sprite
             $0AF2W #New sprite
             $0AF2W #New sprite
             $0AF2W #New sprite
             $16C1W #Falling Block

#Initiation code
%patch $0AF2 $57 $56 $E8 $0006W $83 $C4 $04 $E9 $0BF2W

#New sprite spawn code
%patch $0AFD $55 $8B $EC $56 $E8 $1E31W  $8B $F0 $C7 $04 $0003W  $8B $46 $04
             $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 $0B3AW
             $C7 $44 $34 $1E94W  $C7 $44 $28 $0070W  $5E $5D $C3

#New sprite walks back and forth
%patch $0B3A $55 $8B $EC $56 $83 $3E $40 $82 $00 $7E $08 $C7 $06 $48 $82 $0070W
                 $EB $06 $C7 $06 $48 $82 $0070W  $A1 $35 $51 $B1 $05 $D3 $E8
             $25 $0000W  $8B $16 $48 $82 $03 $D0 $89 $16 $48 $82 $E8 $20C0W
             $E8 $2100W  $8B $F0 $A9 $02 $00 $75 $1A $A1 $3C $82 $F7 $D8 $D1
             $E0 $A3 $3C $82 $C7 $06 $3E $82 $0000W  $A1 $40 $82 $F7 $D8 $A3
             $4C $82 $EB $1A $F7 $C6 $04 $00 $74 $08 $C7 $06 $4C $82 $FFA6W
             $EB $0C $F7 $C6 $01 $00 $74 $14 $C7 $06 $4C $82 $005AW  $C7 $06
             $52 $82 $0BB9W  $33 $C0 $A3 $40 $82 $A3 $4A $82 $5E $5D $C3

#New sprite turns
%patch $0BB9 $55 $8B $EC $A1 $4A $82 $03 $06 $14 $5B $A3 $4A $82 $3D $0032W
             $7E $0C $C7 $06 $52 $82 $0B3AW  $A1 $4C $82 $A3 $40 $82 $A1 $35
             $51 $B1 $05 $D3 $E8 $25 $0000W  $05 $0070W  $A3 $48 $82 $E8 $2040W
                 $E8 $2080W  $5D $C3

The following can be edited:

* $0070W is the animation used, the icecube here. $000W following it is the number of extra animation frames. (None here.)
* $005AW and $FFA6 are the right and left speeds respectively, they may be a bit fast for you here.
* $0032W is the turning time, larger means it will stop longer when turning
Nospike
Posts: 160
Joined: Fri Apr 23, 2010 1:54 pm
Location: Some cool place, idk

Post by Nospike »

A million thanks. Now we just need lemm to make vertical bridges in Vorticons.
Just kidding, even though it would really be neat.
levellass
Posts: 3001
Joined: Wed Oct 11, 2006 12:03 pm
Location: Ngaruawahia New Zealand

Post by levellass »

Would that be *with* horizontal bridges too, or without?
Nospike
Posts: 160
Joined: Fri Apr 23, 2010 1:54 pm
Location: Some cool place, idk

Post by Nospike »

With of course. The problem is that it's apparently a lot of code and we don't have much code space with V2 in use.
Dr. Kylstein
Posts: 120
Joined: Wed Dec 16, 2009 5:20 pm

Post by Dr. Kylstein »

If you must have vertical bridges, I have patch for that for my mod. I was hoping I would have the exclusive debut, but I will be changing a lot of other things anyway. The patch as it stands doesn't animate, but it can do bridges in either direction and uses Galaxy-style switch coordinates along with an additional flag to decide the direction and size. I'll need time to package it up though.
Nospike
Posts: 160
Joined: Fri Apr 23, 2010 1:54 pm
Location: Some cool place, idk

Post by Nospike »

Oooooh that does sound good. I don't need the vertical bridges, so if you don't want to release them then feel free not too. Just thought it would be a pretty interesting idea.
Dr. Kylstein
Posts: 120
Joined: Wed Dec 16, 2009 5:20 pm

Post by Dr. Kylstein »

Well, if levellass thinks she can do it with the classic design/animation I won't stop anyone. My patch was intended for some different uses and is maybe a bit cumbersome for just bridges. I just felt I needed to say something... I'm not sure what.
levellass
Posts: 3001
Joined: Wed Oct 11, 2006 12:03 pm
Location: Ngaruawahia New Zealand

Post by levellass »

I think we'll go with yours, it sounds very nifty. Indeed, feel free to keep it under your hat until release if you wish.
Post Reply