From KeenWiki
(Redirected from Patch:Camera)
Jump to: navigation, search

This page covers patches that affect how the screen moves or appears in Keen games. The screen is also sometimes known as the 'camera' and its setup is a fundamental to how the game is played. Patches here involve both how the camera follows the player as well as any patches that alter scrolling in levels.

Patches that relate to the colors of things onscreen (And their changing, fading in or out, lights off or on, etc) are found at Patch:Palette, the command prompt-like screen that can be made to appear during gameplay is located at Patch:Boss Cheat

Fix choppy scrolling

On certain EGA cards Keen Galaxy games (But not Dreams or related games like BioMenace) experience choppy scrolling. These patches correct this by using an alternate coding for VW_SetScreen taken from the Keen 4 Demo that appears to work better.

These patches should only be used when trying to run (mods of) Keen 4-6 on actual hardware instead of using an emulator like DOSBox, and only if the scrolling is extremely choppy without these patches. The scrolling might actually get more choppy when using these patches in DOSBox or on a system that does not have the choppy scrolling issue to begin with.

Patch: Fix choppy scrolling -Keen 4
#Fix choppy scrolling -Keen 4
%patch $1E87A $E9 $FF7CW %patch $1E7F9 $55 $8B $EC $BA $DA $03 $FA $EC $A8 $01 $74 $FB $EC $A8 $01 $75 $FB $8B $4E $06 $BA $D4 $03 $B0 $0C $EE $42 $8A $C5 $EE $4A $B0 $0D $EE $8A $C1 $42 $EE $C7 $06 $E6F4W $0000W $8B $16 $E6F4W $83 $FA $09 $73 $19 $FB $90 $90 $90 $90 $90 $90 $90 $90 $90 $FA $90 $90 $90 $90 $90 $90 $BA $DA $03 $EC $A8 $08 $74 $DE $BA $C0 $03 $B0 $33 $EE $EB $00 $8A $46 $08 $EE $FB $5D $CB

Patch: Fix choppy scrolling -Keen 5
#Fix choppy scrolling -Keen 5
%patch $1F816 $E9 $FF7CW %patch $1F795 $55 $8B $EC $BA $DA $03 $FA $EC $A8 $01 $74 $FB $EC $A8 $01 $75 $FB $8B $4E $06 $BA $D4 $03 $B0 $0C $EE $42 $8A $C5 $EE $4A $B0 $0D $EE $8A $C1 $42 $EE $C7 $06 $DE5EW $0000W $8B $16 $DE5EW $83 $FA $09 $73 $19 $FB $90 $90 $90 $90 $90 $90 $90 $90 $90 $FA $90 $90 $90 $90 $90 $90 $BA $DA $03 $EC $A8 $08 $74 $DE $BA $C0 $03 $B0 $33 $EE $EB $00 $8A $46 $08 $EE $FB $5D $CB

Patch: Fix choppy scrolling -Keen 6
#Fix choppy scrolling -Keen 6
%patch $1E3EC $E9 $FF7CW %patch $1E36B $55 $8B $EC $BA $DA $03 $FA $EC $A8 $01 $74 $FB $EC $A8 $01 $75 $FB $8B $4E $06 $BA $D4 $03 $B0 $0C $EE $42 $8A $C5 $EE $4A $B0 $0D $EE $8A $C1 $42 $EE $C7 $06 $E6BAW $0000W $8B $16 $E6BAW $83 $FA $09 $73 $19 $FB $90 $90 $90 $90 $90 $90 $90 $90 $90 $FA $90 $90 $90 $90 $90 $90 $BA $DA $03 $EC $A8 $08 $74 $DE $BA $C0 $03 $B0 $33 $EE $EB $00 $8A $46 $08 $EE $FB $5D $CB

Screen fade-in and fade-out

These patches relate to the screen fading out to black and fading back in. These screen transitions are used to 'punctuate' gameplay and provide a natural transition between gameplay modes.

Prevent fade-in\fade-out

These patches stop the game fading in or out. Note that disabling a screen fade-in may cause the screen to go black. Disabling also reduces the transition time since the fades are responsible for the small pause between gameplay modes.

Patch: Keen 1
#Stop screen fading in when...
%patch $4CA1 $90 $90 $90
#Entering a level
%patch $7EA2 $90 $90 $90
#Entering the map
%patch $8052 $90 $90 $90
%patch $822B $90 $90 $90
#Before flight-to-Earth sequence
%patch $8285 $90 $90 $90
#flight-to-Earth sequence
%patch $855B $90 $90 $90
#At start of house sequence
%patch $8815 $90 $90 $90
#At start of endtext
%patch $89C4 $90 $90 $90
#At start of Game Over screen
%patch $8EB7 $90 $90 $90
#After entering highscore
%patch $90BF $90 $90 $90
%patch $90FA $90 $90 $90
%patch $922C $90 $90 $90
%patch $92A9 $90 $90 $90
%patch $96EE $90 $90 $90
#Before showing a preview image 1
%patch $9706 $90 $90 $90
#Before showing a preview image 2
%patch $9759 $90 $90 $90
#When starting About Id
%patch $9A62 $90 $90 $90
#When starting high Scores
%patch $9D97 $90 $90 $90
#When showing story
%patch $A384 $90 $90 $90
#When showing Ordering Info
#Stop screen fading out when...
%patch $4C8F $90 $90 $90
#Entering a level
%patch $4F40 $90 $90 $90
#Exiting a level
%patch $7AAB $90 $90 $90
%patch $8264 $90 $90 $90
#Flight-to-Earth sequence
%patch $851F $90 $90 $90
#At end of flight-to-Earth sequence
%patch $87D0 $90 $90 $90
#At end of house sequence
%patch $8EA5 $90 $90 $90
#Before entering highscore
%patch $8F1D $90 $90 $90
#After entering highscore
%patch $90CB $90 $90 $90
%patch $9161 $90 $90 $90
%patch $91F8 $90 $90 $90
%patch $9267 $90 $90 $90
%patch $927D $90 $90 $90
%patch $958E $90 $90 $90
#Before About Id
%patch $959B $90 $90 $90
#Before highscores
%patch $95A8 $90 $90 $90
#Before Ordering Info
%patch $95BA $90 $90 $90
#Before Previws
%patch $95C7 $90 $90 $90
#When restarting demo
%patch $96FA $90 $90 $90
#After preview image 1
%patch $9D76 $90 $90 $90
#Before showing story screen
%patch $9DAF $90 $90 $90
#After showing story

How closely the screen follows Keen

The screen follows the player by moving when the player is a certain distance from the screen boundary. That is, these patches control how close to the edge of the screen the player can get when not at a level edge. For Keen Vorticons the values are in 256ths of a pixel, which is astonishingly precise. (It is best to round values to the nearest pixels, though all default values are rounded to the nearest tile.) Thus the player must be $3000 or $30 pixels (48 pixels, = 3 tiles) from the top of the screen before the screen moves up.

For Keen Galaxy the values are in 16ths of a pixel and there are two, a 'check' and a 'set'. Both values for each lag should match to avoid jerky motion. In Keen 4 there are two types of scrolling, 'normal' and 'Well Of Wishes'.

Patch: Keen 1
#How closely the screen follows Keen
%patch $3472 $B000W
#Scroll Right lag
%patch $34C0 $9000W
#Scroll Left lag
%patch $350C $7000W
#Scroll Down lag
%patch $355A $3000W
#Scroll Up lag

Patch: Keen 2
#How closely the screen follows Keen
%patch $62B4 $B000W
#Scroll Right lag
%patch $6302 $9000W
#Scroll Left lag
%patch $634E $7000W
#Scroll Down lag
%patch $639C $3000W
#Scroll Up lag

Patch: Keen 3
#How closely the screen follows Keen
%patch $6B17 $B000W
#Scroll Right lag
%patch $6B65 $9000W
#Scroll Left lag
%patch $6BB1 $7000W
#Scroll Down lag
%patch $6BFF $3000W
#Scroll Up lag

Patch: Keen 4
#How closely the screen follows Keen -Well of Wishes
%patch $8588 $0C00W
#Scroll Right lag 1
%patch $859B $0C00W
#Scroll Right lag 2
%patch $856C $0900W
#Scroll Left lag 1
%patch $857C $0900W
#Scroll Left lag 2
%patch $85C6 $7000W
#Scroll Down lag 1
%patch $85D6 $7000W
#Scroll Down lag 2
%patch $85A9 $0500W
#Scroll Up lag 1
%patch $85B9 $0500W
#Scroll Up lag 2

Disable vertical scrolling

This patch disables the vertical scrolling in levels. This makes the gameplay somewhat like Super Mario Bros., allowing the player to move left and right but move off the screen vertically.

Patch: Keen 1
#Disable vertical scrolling only
%patch $34F2 $5F $5E $8B $E5 $5D $C3

Scroll left only

This patch makes it so levels only scroll left, this is even more like old games. Keen can still move offscreen however.

Patch: Keen 1
#Only scroll left
%patch $34A4 $90 $90 $5F $5E $8B $E5 $5D $C3

When screen doesn't follow Keen

By default the screen does not follow Keen when he has died; instead the level restarts when he moves offscreen. It is possible to make the screen follow Keen even when he is dead and\or not when he is doing other things. See also Patch:Jump conditions.

Patch: Screen doesn't follow dead Keen
#Camera don't follow player if using this behavior: Keen 1
%patch $342F $41F8W $75
#Camera don't follow player if using this behavior: Keen 2
%patch $6271 $703AW $75
#Camera don't follow player if using this behavior: Keen 3
%patch $6AD4 $789EW $75

Screen follows dead Keen

This patch makes the screen always follow Keen, dead or not. When dead Keen will head to the top of the level by default, only exiting to the map when he reaches the level top.

Patch: Screen follows dead Keen
#Screen follows dead Keen: Keen 1
%patch $342B $EB $09
#Screen follows dead Keen: Keen 2
%patch $626D $EB $09
#Screen follows dead Keen: Keen 3
%patch $6AD0 $EB $09

Screen never follows Keen

This patch makes it so that only one screen appears in-level. (But not the map.) Keen can move offscreen but the screen itself will not move. Certain actions however will 'reset' the screen, such as using an in-level teleporter.

Patch: Screen never follows Keen
#Screen doesn't follow Keen in-level -Keen 1
%patch $3418 $C3

Screen can move past level edges (Looping levels)

This patch allows Keen to move off of the right side of the level. When this happens he will loop back to the left side of the level, one tile higher. This turns the level into a giant 'loop' that Keen can walk across indefinitely. There are several limitations. Firstly all sprites are left behind on the first pass of the level, they do not appear when the level loops. Secondly one row is removed from the level's boundary each loop so unless there is a way for Keen to move up and down the entire level he will gradually be forced lower and lower in the level. Thirdly Keen can move right as many loops as he wants and move back a loop but cannot loop left of his starting loop. This limits the function of the patch somewhat. It will also not affect the map level.

Patch: Levels loop left-right
#Levels loop left-right -Keen 1
%patch $345A $90 $90 %patch $34A8 $90 $90 %patch $3379 $EB %patch $33A5 $EB
#Levels loop left-right -Keen 2
%patch $629C $90 $90 %patch $62EA $90 $90 %patch $61BB $EB %patch $61E7 $EB
#Levels loop left-right -Keen 3
%patch $6AFF $90 $90 %patch $6B4D $90 $90 %patch $6A19 $EB %patch $6A4C $EB

Well of Wishes\Map type scrolling

This patch allows the modder to change what levels behave as WoW\Map-type levels. By default both the map (level 0) and level 17 are WoW-type levels in Keen 4, while Keen 5 and 6 have only the map level set up this way. Map-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. (Keen will still die by default; another piece of code does this.)

The patch below has three parts, first what is checked for in brown, 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.

Patch: Which levels are WoW levels
#Which levels are WoW levels -Keen 4
%patch $9051 $A7EDW $00 $74 %patch $9058 $A7EDW $11 $74
#Which levels are WoW levels -Keen 5
%patch $8FC3 $9E55W $00 $74
#Which levels are WoW levels -Keen 6
%patch $8E2B $A97BW $00 $74

Remove W.O.W\Map scrolling, can exit off level sides

These patches change the Map (And 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.)

Patch: Keen 4
#Map exits and scrolls normally
%patch $904F $EB $05
#WoW exits and scrolls normally
%patch $905B $90 $90

Patch: Keen 5
#Map exits and scrolls normally
%patch $8FC1 $EB $05

Patch: Keen 6
#Map exits and scrolls normally
%patch $8E29 $EB $05

Split screen

This patch puts Keen into split screen mode, dividing the screen vertically into two. Sadly both views are the same so this patch currently has little utility outside of curiosity.

Patch: Primitive splitscreen patch
#Keen 1 spitscreen
%patch $6E47 $0E
#Keen 2 spitscreen
%patch $3046 $0E
#Keen 3 spitscreen
%patch $2FE1 $0E

Screen automatically scrolls from left to right

This patch makes the screen scroll left or right, killing Keen when he touches the left edge. The speed of the scrolling can be changed. As a side effect levels 'loop'; there is not left or right level edge, instead going off the right level 'edge' will make Keen appear on the left 'edge' of the level. (However the player will not notice the transition, it is seamless.) The camera will also not follow the player.

Keen can also not pass the right edge of the screen, though he may fall or climb as much as he wants. The right edge is the first blue value in the patch below. (It is set here to the visible edge of the screen, but this is not necessary.)

The remaining blue variables control other aspects oft he game. The right side pushback is how much the right side of the screen pushes Keen back when he tries to leave the right side of the screen. This should be at least $10 more than the scrolling speed. The left side push forward is similar, but should be no more than given here ($40) and should be made smaller if it starts pushing Keen through solid tiles.

The scrolling speed controls how fast and in what direction the screen scrolls. (It is advised you stick with a right scrolling screen.) Finally the two breeze strengths move all objects in the level in a certain direction at a certain, fixed speed. The first breeze is positive (right) and the second negative and equal (and left.) In this patch they are set to be equal to the scroll speed, but you can also make them zero.

Patch: Keen 1
#Right screen boundary (22 tiles)
%patch $800 $B8 $0016W
#add boundary checking to pogo ground
%patch $40E7 $E8 $7B $F2
#update keen movement boundaries
%patch $3368 $66 $A1 $2C $82 $66 $3B $06 $4A $56 $7F $21 $C7 $06 $3C $82 $0210W $C7 $06 $40 $82 $30 $00 $E8
#Right side pushback
$15 $F9 $A9 $04 $00 $74 $0D $33 $C0 $A3 $40 $82 $A3 $42 $82 $E8 $1A $0F $EB $31 $66 $A1 $34 $82 $66 $3B $06 $AC $5D $7C $26 $C7 $06 $3C $82 $A0 $FF $66 $A1 $AC $5D $66 $A3 $34 $82 $EB $16
#Auto screen scroll
%patch $3458 $66 $A1 $D0 $6E $66 $0040W $00
#Left push forward
$00 $7D $15 $66 $B8 $0200W $00 $00 $66 $01 $06 $D0 $6E $66 $01
#Scroll speed
$06 $4A $56 $66 $01 $06 $AC $5D $1E $68 $20 $82 $1E $68 $DA $6E $B9 $36 $00 $E8 $15 $AE $C7 $06 $3C $82 $0200W $E8 $08 $F8 $A9
#Right breeze strength
$04 $00 $74 $06 $C7 $06 $3C $82 $FE00W $A1 $3C $82 $66 $98 $66
#Left breeze strength
$01 $06 $24 $82 $E8 $94 $F5 $66 $A1 $2C $82 $66 $05 $80 $00 $00 $00 $66 $3B $06 $D0 $6E $7D $0B $33 $C0 $A3 $40 $82 $A3 $42 $82 $E8 $E9 $0D $1E $68 $DA $6E $1E $68 $20 $82 $B9 $36 $00 $E8 $CA $AD $EB $1F