Dopefish stun and win game

Request patches for Keens 4-6.
Post Reply
Dave216
Posts: 19
Joined: Thu Apr 14, 2022 8:33 am

Dopefish stun and win game

Post by Dave216 »

I would like to request that Dopefish takes x (I can't specify how much without some playtesting) shots to stun. It would also be neat if it could be patched so that it flashes when shot. I know Keen 4 doesn't have multiple-shot enemies, so I am unsure how to produce this on my own with existing patches found on the wiki.

Finally, stunning the dopefish wins the game. If the conditions to patch this would be easier for the patcher to link to council members, I won't use council members in the mod. If this can't be done, or it's too much of a hassle to pull off, do let me know. Thanks in advance either way!
nwe74
Posts: 11
Joined: Mon Jul 18, 2022 7:46 pm

Re: Dopefish stun and win game

Post by nwe74 »

Interesting ideas, I will certainly implement this, but I need some additional information. First, do you want to use the "eating" behavior of the creature?

The Dopefish has no "dead" sprite, so a sprite from the original game must be "sacrificed" for it (e.g. eating Dopefish, if you are not going to use that).

"Flashing" (If I understand correctly what you need) could be implemented by switching to a different sprite for a short time interval after the creature being hit by a bullet. This again needs a sprite. (or probably two, left+right.)

The "health" part is easy to implement, but again I would need to know whether I can overwrite the "eating" code with patches.

The "win game" patch is also not difficult. I have already created a patch that makes the condition for winning the game not dependent on the number of Council Members rescued. However, it still allows winning levels by rescuing a Member. I will post it along with the Dopefish patches once they are ready.
Dave216
Posts: 19
Joined: Thu Apr 14, 2022 8:33 am

Re: Dopefish stun and win game

Post by Dave216 »

That's wonderful news! Yes, I won't be using eating behaviour, so sprites using eating behaviour are free, as well as the code itself to implement over the existing one.
nwe74
Posts: 11
Joined: Mon Jul 18, 2022 7:46 pm

Re: Dopefish stun and win game

Post by nwe74 »

I have finished the patches you have requested. Some notes about the patches:
  • The following sprites are used for the new sprite behavior:
    • 4SPR0282 and 4SPR0296 (ModKeen names) are the "flashed" sprites, which are shown temporarily if a bullet hits the enemy.
    • 4SPR0283 is used for the dead creature.
  • No stars will be shown for the stunned Dopefish replacement, I can modify this
  • It is still possible to win a level by rescuing a Council Members. Like in the original game, the number of rescued members are still shown in High scores. I can change this into a "Dopefish replacement killed" indicator if you want.

Code: Select all

# New Dopefish spawn code, rewritten to set the health (by default $0005W)

%patch $120EF  $8B $1E $A7D8W $B9 $0001W $89 $4F $10 $3D $0080W $7C $02 $F7
    $D9 $89 $4F $0E $C7 $47 $40 $0005W $B8 $35C0W $50 $53 $9A $09DC118CRL $83
    $C4 $04 $5D $CB
    
# Dopefish sprite interaction. 1. Kills Keen on touch. 2. Decrements health 
#   if hit by a neural stunner shot, shows a different sprite temporarily.
#   3. Dies when the health counter becomes 0. 4. Cannot eat Keen 
#   or Schoolfish.

%patch $123DD  $02 $75 $07 $9A $0B8013E9RL $EB $35 $83 $3D $03 $75 $30 $FF $4C
    $40 $75 $15 $C7 $44 $06 $0001W $B8 $361AW $50 $57 $56 $9A $09DC1695RL $83
    $C4 $06 $EB $16 $57 $9A $0D8F0D43RL $83 $C4 $02 $B8 $35FCW $50 $56 $9A
    $09DC120ARL $83 $C4 $04 $5F $5E $5D $CB
    
# "Think" code for second "killed" state, win game
%patch $12451  $C7 $06 $7A70W $0009W $EA $09DC16C9RL

# No stars for stunned Dopefish
%patch  $B802  $1A1BW
    
# New Dopefish object state, "flash" when shot
%patch $32470  $0000W
%patch $32476  $000AW
%patch $3247C  $00000000L $11A209B0RL
%patch $32488  $35C0W

# First Dopefish dead state
%patch $3248A  $0197W $0197W $0003W
%patch $32494  $0014W
%patch $3249A  $09DC16C9RL
%patch $324A2  $09DC1913RL

# Second Dopefish dead state, win game
%patch $324AC  $0002W
%patch $324B2  $0000W
%patch $324B8  $11A20A31RL
%patch $324C0  $09DC1913RL $0000W

# New condition for winning the game. Levels can still be won by rescuing
#   a Council Member, but collecting then no longer triggers the ending
#   sequence.

%patch  $6ACB  $9A $0E8F0BA5RL $EB $5F $A1 $A7EDW $A3 $A7C2W $89 $C3 $D1 $E3
    $C7 $87 $7A1EW $0001W $EB $0E
%patch  $6BD1  $0E92W

# Fix E-N-D cheat due to new win condition
%patch  $9139  $7A70W $0009W $EB $04

Dave216
Posts: 19
Joined: Thu Apr 14, 2022 8:33 am

Re: Dopefish stun and win game

Post by Dave216 »

Flawlessly done as expected. Man, is there something you can't patch? Respect and thanks!
Post Reply