Patch:Well Of Wishes
The Well of Wishes is a level in Keen 4. It is special in that Keen's movement is entirely different in it, he swims rather than walks, and cannot shoot. There are a number of other small differences that also apply making the level subtly different. This page deal in patches that make the WoW either the same as other levels, or allows different\more levels to be used as WoW-like levels.
Note that Keen himself has a number of different tweaks applied to him when he swims. These have nothing to do with the WoW, but the swimming Keen sprite. It may pay to check Patch:Keen (Keen 4)
Dying in WoW and dead swimming Keen
There are two possible ways for Keen to die, swimming or not. Which one is chosen depends on what level he is in. The patch below has three parts, first what is checked for in brown (The current level), second the value in blue ($11 = 17, that is, level 17) and thirdly, the jump, again in brown ($74, only jump if...) The net result is that if the current level is 17, Keen dies using the swimming frames.
To make Keen die normally in WoW, simply replace the jump with $90 $90 (See exiting WoW section below.)
Keen 4
#The level that produces dead swimming Keen
%patch $CC2A $83 $3E {$A7EDW} [$11] {$75 $30}
Well of Wishes type scrolling
This patch allows the modder to change what levels behave as WoW-type levels. By default both the map (level 0) and level 17 are WoW-type levels. WoW-type levels scroll differently and cannot be 'won' by moving off the left or right sides of the level. They also don't directly kill Keen when he leaves the top or the bottom; another piece of code does this.
The patch below has three parts, first what is checked for in brown ($A7EDW, the current level); second the value in blue ($00\$11 = 0\17, so level 0\17); and thirdly the jump, again in brown. ($74, only jump if...) The net result is that if the current level is 17 or 0, the 'normal level' code is skipped.
Keen 4
#Which levels are WoW levels
%patch $9051 {$A7EDW} [$00] {$74}
%patch $9058 {$A7EDW} [$11] {$74}
Remove W.O.W scrolling, can exit off level sides
This patch changes the well of wishes scrolling so that it behaves like other levels in Keen 4; this has the side effect of allowing Keen to exit the level by walking off the level edges (just like normal levels.)
Keen 4
#WoW exits and scrolls normally
%patch $905B $90 $90
Can exit off of level top
This patch alters the WoW scrolling so that the player can exit off of the top of the level in the same way he exits off the sides of regular levels. Any patches that alter the WoW scrolling will be incompatible with this.
The key to the patch is changing the level state variable to 2, winning the level. Changing this value allows other things to be triggered, such as death or saving an Oracle Council Member. Changing the brown $24 in the second line to $22 will make this patch affect the left side of the level. (But not the right.)
The second section of this patch makes this the case for regular levels as well. It must be used in conjunction with the first.
Keen 4
#W.O.W scrolling code -exit when off level top
%patch $8553 $55 $8B $EC $83 $EC $02 $56 $57 $8B $76 $06 $83 $3E $A7DAW $00
$74 $03 $E9 $012FW $8B $44 {$24} $3B $06 $C74BW $77 $0C $C7 $06
{$7A70W} [$0002W] $5F $5E $8B $E5 $5D $CB
$A1 $C753W $05 $0900W $39 $44 $22 $73 $11
$8B $44 $22 $8B $16 $53 $C7 $81 $C2 $0900W $2B $C2 $8B $F8 $EB
$21 $A1 $C753W $05 $0C00W $39 $44 $26 $76 $14 $8B $44 $26 $05
$10 $00 $8B $16 $53 $C7 $81 $C2 $0C00W $2B $C2 $8B $F8 $EB $02
$33 $FF $A1 $C751W $05 $00 $05 $39 $44 $24 $73 $12 $8B $44 $24
$8B $16 $51 $C7 $81 $C2 $00 $05 $2B $C2 $89 $46 $FE $EB $22 $A1
$C751W $05 $00 $07 $39 $44 $28 $76 $12 $8B $44 $28 $8B $16 $51
$C7 $81 $C2 $00 $07 $2B $C2 $89 $46 $FE $EB $05 $C7 $46 $FE $00
$00 $0B $FF $75 $09 $83 $7E $FE $00 $75 $03 $E9 $0091W $81 $FF
$00 $01 $7C $05 $BF $FF $00 $EB $09 $81 $FF $00 $FF $7F $03 $BF
$01 $FF $81 $7E $FE $00 $01 $7C $07 $C7 $46 $FE $FF $00 $EB $0C
$81 $7E $FE $00 $FF $7F $05 $C7 $46 $FE $01 $FF $FF $76 $FE $57
$9A $165413DDRL $83 $C4 $04 $E9 $02B9W
#Extend top-exit to regular levels (OPTIONAL)
%patch $869D $55 $8B $EC $83 $EC $08 $56 $57 $8B $76 $06 $83 $3E $DA $A7 $00
$74 $03 $E9 $02B6W $8B $44 {$24} $3B $06 $C74BW $72 $14
$8B $44 {$22} $3B $06 $C74BW $72 $0B $A1 $C749W
$05 $1400W $39 $44 {$26} $76 $03 $E9 $FE9FW