Patch:Keen pogoing (Galaxy)

From KeenWiki
Jump to navigation Jump to search

This page contains patches relating to how the player acts when the pogo is equipped in Keen Galaxy. For patches affecting the pogo tile in Keen Vorticons see Patch:Pogo (Item). For patches affecting the player in general see Patch:Keen (Keen 4), Patch:Keen (Keen 5) and Patch:Keen (Keen 6).


Disable

These patches disable pogoing completely. This means that the player cannot, under any circumstances, pogo. There are two lines to the patch, one for two button firing and one for spacebar firing.

Keen 5

#Disable pogoing completely
%patch $8B62 $5D $CB     #Two button on
%patch $8BA2 $90 $90 $90 #Two button off


Pogoing Keen lands on ground

This patch changes things so that keen goes to standing when he lands on the ground while pogoing. This includes using the landing sound. This makes it impossible to use a high pogo jump.

Keen 4

#Pogoing Keen lands on ground
%patch $D839 [$03]
%patch $D830 $0000W
%patch $D836 $0000W
%patch $D845 [$098CW]


Disable shooting while pogoing

This patch stops Keen from shooting while pogoing. (See also Patch:Keen shooting (Galaxy).) Keen can still shoot while doing other things.

Disable shooting while pogoing

#Disable shooting while pogoing
%patch $C5DE $EB


Keen cannot pogo without an item

These patches modify the button handling code so that the player cannot use the pogo without first obtaining another item. (See Patch:Game stats.) The actual code itself is rather complex so the only values highlighted is the variable needed (in brown), the number needed (in blue) and the jump condition (again in brown). There are two identical instances, one for two button firing and one for spacebar firing.

In the examples given here the vital items acting the part of the Pogo Stick from Vorticons are the Wetsuit and V-card. (Keen 4 and 5.)

The last line of the patches force the player to use two button firing, as in the original Vorticons games. This is not vital to the patch and can be removed if desired. (It has to be specially modified for this patch and the default 'no two button firing' patch cannot be used.)

Since this patch alters some basic code it is incompatible with patches elsewhere on the page that disable pogoing. As a side effect Keen cannot enter levels by pressing Alt on the map unless he has the required item.

Keen 4

#Rewrite HandleInput to not pogo without Wetsuit
%patch $8B43 $3B
%patch $8B3C $42
%patch $8B75 $75 $06 $C7 $06 $C5BFW  $0000W  $5D $CB $83 $3E $C5CFW  $00 $75
             $0A $83 $3E $3BD6W  $00 $75 $03 $E9 $008BW  $83 $3E $A7C6W  $00
             $74 $1D $83 $3E $A7C8W  $00 $74 $16 $C7 $06 $C5C1W  $0001W  $33
             $C0 $A3 $C5C3W  $A3 $C5C7W  $A3 $C5C5W  $A3 $C5C9W  $5D $CB $33
             $C0 $A3 $C5BFW  $A3 $C5C1W  $83 $3E $A7C6W  $00 $74 $08 $C7 $06
             $C5C9W  $0001W  $EB $08 $33 $C0 $A3 $C5C7W  $A3 $C5C9W  $83 $3E
             $A7C8W  $00 $74 $22 $83 $3E {$7A5CW}  [$00] {$74} $19 $83 $3E $A7F1W
             $08 $7F $0C $A1 $A7F1W  $03 $06 $A54CW  $A3 $A7F1W  $5D $CB $C7
             $06 $C5C5W  $0001W  $5D $CB $83 $3E $A7F1W  $00 $74 $08 $C7 $06
             $C5C5W  $0001W  $EB $08 $33 $C0 $A3 $C5C3W  $A3 $C5C5W  $C7 $06
             $A7F1W  $0000W  $5D $CB $A1 $A7C6W  $A3 $C5C9W  $A1 $A7C8W  $83
             $3E {$7A5CW}  [$00] {$74} $03 $A3 $C5C5W  $A0 $94 $03 $B4 $00 $D1 $E0
             $8B $D8 $8B $87 $C647W  $A3 $C5C1W  $33 $C0 $83 $3E $C5C9W  $00
             $75 $03 $A3 $C5C7W  $83 $3E $C5C5W  $00 $75 $03 $A3 $C5C3W  $83
             $3E $C5C1W  $00 $75 $03 $A3 $C5BFW  $5D $CB

#Force 2-button firing -OPTIONAL
%patch $8B8B $EB

Keen 5

#Rewrite HandleInput to not pogo without V Keycard
%patch $8ABF $3B
%patch $8AB8 $42
%patch $8AF1 $75 $06 $C7 $06 $BC27W  $0000W  $5D $CB $83 $3E $BC37W  $00 $75
             $0A $83 $3E $332CW  $00 $75 $03 $E9 $008BW  $83 $3E $9E2EW  $00
             $74 $1D $83 $3E $9E30W  $00 $74 $16 $C7 $06 $BC29W  $0001W  $33
             $C0 $A3 $BC2BW  $A3 $BC2FW  $A3 $BC2DW  $A3 $BC31W  $5D $CB $33
             $C0 $A3 $BC27W  $A3 $BC29W  $83 $3E $9E2EW  $00 $74 $08 $C7 $06
             $BC31W  $0001W  $EB $08 $33 $C0 $A3 $BC2FW  $A3 $BC31W  $83 $3E
             $9E30W  $00 $74 $22 $83 $3E {$6F5AW}  [$00] {$74} $19 $83 $3E $9E59W
             $08 $7F $0C $A1 $9E59W  $03 $06 $9BB4W  $A3 $9E59W  $5D $CB $C7
             $06 $BC2DW  $0001W  $5D $CB $83 $3E $9E59W  $00 $74 $08 $C7 $06
             $BC2DW  $0001W  $EB $08 $33 $C0 $A3 $BC2BW  $A3 $BC2DW  $C7 $06
             $9E59W  $0000W  $5D $CB $A1 $9E2EW  $A3 $BC31W  $A1 $9E30W  $83
             $3E {$6F5AW}  [$00] {$74} $03 $A3 $BC2DW  $A0 $38 $03 $B4 $00 $D1 $E0
             $8B $D8 $8B $87 $BCAFW  $A3 $BC29W  $33 $C0 $83 $3E $BC31W  $00
             $75 $03 $A3 $BC2FW  $83 $3E $BC2DW  $00 $75 $03 $A3 $BC2BW  $83
             $3E $BC29W  $00 $75 $03 $A3 $BC27W  $5D $CB

#Force 2-button firing -OPTIONAL
%patch $8B07 $EB

Keen 6

#Rewrite HandleInput to not pogo without Grappling Hook
%patch $8927 $3B
%patch $8920 $42
%patch $8959 $75 $06 $C7 $06 $C74DW  $0000W  $5D $CB $83 $3E $C75DW  $00 $75
             $0A $83 $3E $35D6W  $00 $75 $03 $E9 $008BW  $83 $3E $A954W  $00
             $74 $1D $83 $3E $A956W  $00 $74 $16 $C7 $06 $C74FW  $0001W  $33
             $C0 $A3 $C751W  $A3 $C755W  $A3 $C753W  $A3 $C757W  $5D $CB $33
             $C0 $A3 $C74DW  $A3 $C74FW  $83 $3E $A954W  $00 $74 $08 $C7 $06
             $C757W  $0001W  $EB $08 $33 $C0 $A3 $C755W  $A3 $C757W  $83 $3E
             $A956W  $00 $74 $22 $83 $3E {$7596W}  [$00] {$74} $19 $83 $3E $A97FW
             $08 $7F $0C $A1 $A97FW  $03 $06 $A6DAW  $A3 $A97FW  $5D $CB $C7
             $06 $C753W  $0001W  $5D $CB $83 $3E $A97FW  $00 $74 $08 $C7 $06
             $C753W  $0001W  $EB $08 $33 $C0 $A3 $C751W  $A3 $C753W  $C7 $06
             $A97FW  $0000W  $5D $CB $A1 $A954W  $A3 $C757W  $A1 $A956W  $83
             $3E {$7596W}  [$00] {$74} $03 $A3 $C753W  $A0 $DA $02 $B4 $00 $D1 $E0
             $8B $D8 $8B $87 $C7D5W  $A3 $C74FW  $33 $C0 $83 $3E $C757W  $00
             $75 $03 $A3 $C755W  $83 $3E $C753W  $00 $75 $03 $A3 $C751W  $83
             $3E $C74FW  $00 $75 $03 $A3 $C74DW  $5D $CB

#Force 2-button firing -OPTIONAL
%patch $896F $EB


Sprite Actions

Keen has three pogoing actions, the first starts his pogoing, setting various variables and conditions. This is triggered when the player presses the Alt key. The second is his 'moving through the air' action in which he spends most of his time. The third is used when Keen hits solid tiles and 'bounces' off of them.

Keen's pogoing sequence is three actions long and ends in the third action which does nothing, waiting for input from the player of hitting the ground.

Actions - Keen 4:
$110CW #Keen start pogoing
$112AW #Keen pogoing
$1148W #Keen pogoing

Keen 4

#Start pogoing
%patch $BB29  [$110CW] #When standing
%patch $BF36  [$110CW] #When walking
%patch $C4AC  [$112AW] #When in air

#When pogoing Keen hits ground
%patch $D845 [$112AW]

#Pogoing sequence
%patch $2FF98 [$112AW]
%patch $2FFB6 [$1148W]
%patch $2FFD4 [$0000W]


Sprite Behavior

There are two behaviors relating to Keen pogoing. The first is used when he starts pogoing while the second is used while he is in the air or bouncing off the ground.

Behaviors:
$0B800CC9RL #Pogoing start (Bounce up in air)
$0B800CF5RL #Pogoing (Fall and bounce of ground, move with arrows)

Keen 4 behaviors

#Start pogoing
%patch $2FF8C $0B800CC9RL

#Pogoing
%patch $2FFAA $0B800CF5RL #In air
%patch $2FFC8 $0B800CF5RL #Landing


Start pogoing behavior

This is the complete code for Keen's starting to pogo behavior. It sets Keen's upwards pogo speed, $FFD0W and horizontal speed ($0006W in either direction.) and plays sound $07.

Keen 4 behaviors

#Keen start pogoing behavior
%patch $C4C9 $55 $8B $EC $56 $8B $76 $06 $C7 $44 $18 [$FFD0W]  $8B $44 $18 $BA
             [$0006W]  $F7 $EA $A3 $C921W  $C7 $06 $BB $CA $18 $00 $B8 [$0007W]
             $50 $9A $187409F1RL     $83 $C4 $02 $5E $5D $CB


Speed and pogo Height

The variables that control the height and duration of Keen's pogo bounces are spread over several behaviors. There are two important parameters: initial velocity, and duration. The velocity is the initial speed of the pogo, while the duration is the maximum time that this initial velocity can be sustained before Keen feels gravity. That is, the initial velocity is how fast Keen bounces, while the duration is how long.

Since distance is speed * time, increasing either will increase Keen's pogo height. However the most 'natural' looking way to increase Keen's pogo height is to increase the duration, 'faster' bounces can look choppy. Also, the speed and duration only apply to the start of Keen's bounce, when the time runs out, he will still be moving upwards, but will start slowing and then start falling.

The duration can be considered a 'timer' that counts down. When it reaches zero Keen will experience gravity. However, if the pogo button is released, then Keen will start to feel gravity even if the timer has not expired. The timer is measured in tics (70 Hz), so a timer of 70 means that Keen can bounce upwards for 1 second before feeling gravity. The initial velocity is in map units per tic, which is 256ths of a tile per 70ths of a second.

Pogo Physics

#Pogo from standstill
%patch $BB33 [$FFD0W]				#Starting speed
%patch $BB3F [$0018W]				#Duration

#Pogo from walking
%patch $BF51 [$FFD0W]				#Starting speed
%patch $BF5D [$0018W]				#Duration

#Pogo start bounce
%patch $C4D3 [$FFD0W]				#Starting speed
%patch $C4E4 [$0018W]				#Duration

#Pogo air
%patch $C50E [$09]					#Duration, after this gravity takes hold

#Pogo Bounce off ground
%patch $D830 [$FFD0W]				#Starting speed
%patch $D836 [$0018W]				#Duration


Head bump speeds

These patches control what happens to Keen's vertical speed when he hits his head on ceilings while pogoing. The first value is a 'downward push' that reduces Keen's vertical speed when he first hits a ceiling. If this is not enough to make him move downwards two other values set his speed to zero. The net effect of this is that if Keen hits his head on a ceiling he'll either stop in midair a moment or be knocked down slightly.

Keen 4

#Keen's vertical speed when hitting ceilings while pogoing
%patch $D7E9 [$10]    #Downwards bump
%patch $D7F3 [$0000W] #Halt 1
%patch $D7FC [$0000W] #Halt 2

Keen 5

#Keen's vertical speed when hitting ceilings while pogoing
%patch $CB63 [$10]    #Downwards bump
%patch $CB6D [$0000W] #Halt 1
%patch $CB76 [$0000W] #Halt 2

Keen 6

#Keen's vertical speed when hitting ceilings while pogoing
%patch $C91A [$10]    #Downwards bump
%patch $C924 [$0000W] #Halt 1
%patch $C92D [$0000W] #Halt 2


Animations

Keen has two pogo animations of two each (On for each direction he faces.) The first is used by his starting pogo actions and the second by his pogo falling action.

Keen 4

%patch $2FF7C [$00D6W $00D4W] #Start pogo
%patch $2FF86 [$0001W]        #Quick bounce
%patch $2FF9A [$00D6W $00D4W] #Pogoing
%patch $2FFA4 [$0000W]        #Animation speed
%patch $2FFB8 [$00D5W $00D3W] #Pogo fall
%patch $2FFC2 [$0000W]        #Animation speed


Sprite-tile interaction

Keen uses a special tile collision when pogoing. This lets him hit his head on ceilings as well as bounce on solid ground. It is unique to his pogoing actions. In Keen 5 this also lets him break fuses.

Keen 4 tile collisions

#Starting
%patch $2FF94 $0B801F81RL

#In air
%patch $2FFB2 $0B801F81RL

#Bouncing
%patch $2FFD0 $0B801F81RL

Keen 5 tile collisions

#Starting
%patch $31342 $0AAF200BRL

#In air
%patch $31360 $0AAF200BRL

#Bouncing
%patch $3137E $0AAF200BRL


Interaction code

This is the complete tile interaction code for Keen pogoing. The first two lines check to see if Keen is touching a left or right wall while facing it. If he is then his horizontal speed is set to 0. (If he is not facing the wall there is no reason to stop him moving.) This involves checking the wall and then Keen's direction.

At the end of line 3 ceilings are checked for. If a ceiling is present then the ceiling type 'pole going through' is checked for; this is something Keen can pogo past. These set Keen's horizontal speed is to 0 and his vertical direction and speed to $20 (downwards). 'Normal' ceilings check an unknown variable (probably related to whether Keen is moving upwards towards the ceiling.) and play sound $0F if it is not 0. Following this $10 is added to Keen's vertical speed, which is checked to see if it is still positive. In all cases Keen's vertical speed is then set to 0, along with Keen's pogo timer.

Floors are checked for on line 9 and this is the most complex section of code. If found Keen's x-speed per frame is set to 0 on line 10. After this Keen's location is tweaked by -8 pixels and floor type is checked for. Type 8 is lethal to Keen, if found the 'kill Keen' code is run and everything else skipped. Type 19 (set when Keen is on Platform-type sprites)skips Keen's pogo timer check, letting him do interesting pogo tricks with them. For 'normal floors' the game checks to see if Keen's pogo timer is 0, if so, Keen's vertical speed and pogo timer are set, sound $07 are played and Keen's action is set to 'start pogo'. In sum this makes Keen pogo bounce off of the floor.

The last two lines draw Keen's sprite in the level.

Keen 4 tile collision code

#Keen 4 pogoing tile interaction code
%patch $D781 $55 $8B $EC $56 $8B $76 $06 $83 $7C {$38} [$00] {$74} $06 $83 $7C {$0E}
             [$FF] {$74} $0C $83 $7C {$3C} [$00] {$74} $0B $83 $7C {$0E} [$01] {$75} $05 $C7
             $44 $16 [$0000W]  $83 $7C {$3A} [$00] {$74} $59 $83 $7C {$3A} [$11] {$75} $1C
             $83 $6C $0C [$20] $83 $6C $24 [$20] $C7 $44 $16 [$0000W] $8B $44 $34
             $B1 $08 $D3 $E0 $2D [$0020W]  $89 $44 $0A $EB $37 $83 $3E {$C62BW}
             [$00] {$75} $30 $B8 [$000FW]  $50 $9A $187409F1RL     $83 $C4 $02 $83
             $7C {$3A} [$01] {$7E} $13 $83 $44 $18 [$10] $83 $7C $18 [$00] {$7D} $0E $C7
             $44 {$18} [$0000W]  $EB $07 $EB $05 $C7 $44 {$18} [$0000W]  $C7 $06 {$CABBW}
                 [$0000W]  $83 $7C {$36} [$00] {$74} $47 $C7 $44 {$14} [$0000W]  $8B $44
             $36 $25 [$FFF8W]  $3D [$0008W]  {$75} $06 $0E $E8 $F3CBW  $EB $31 $83
             $7C {$36} [$19] {$75} $07 $83 $3E {$CABBW}  [$00] {$75} $24 $C7 $44 $18 [$FFD0W]
                 $C7 $06 {$CABBW}  [$0018W]  $B8 [$0007W]  $50 $9A $187409F1RL    
             $83 $C4 $02 $B8 [$112AW]  $50 $56 $9A $09DC120ARL     $83 $C4 $04
             $FF $74 $20 $33 $C0 $50 $FF $74 $1E $FF $74 $0C $FF $74 $0A $8B
             $C6 $05 $46 $00 $50 $9A $16541641RL     $83 $C4 $0C $5E $5D $CB


Head bump speeds

These patches control what happens to Keen's vertical speed when he hits his head on ceilings. The first value is a 'downward push' that reduces Keen's vertical speed when he first hits a ceiling. If this is not enough to make him move downwards two other values set his speed to zero. The net effect of this is that if Keen hits his head on a ceiling he'll either stop in midair a moment or be knocked down slightly.

Keen 4

#Keen's vertical speed when hitting ceilings while pogoing
%patch $D7E9 [$10]   #Downwards bump
%patch $D7F3 [$0000] #Halt 1
%patch $D7FC [$0000] #Halt 2


Fix repeated headbump glitch

This (mostly pointless) patch fixes a glitch that occurs when the player pogos up and into a sloped ceiling. This can cause Keen's head to bump repeatedly. This patch prevents this, which is barely noticeable. The first blue variable is the bump-head sound, the second Keen's downward push when hitting his head on slopes and the third his halted speed if this is not enough.

Fix repeated headbump glitch

#Fix repeated headbump glitch -Keen 4
%patch $D7D4 $83 $3E $CABBW  $00 $74 $0C $B8 [$000FW]  $50 $9A $187409F1RL    
             $83 $C4 $02 $83 $7C $3A $01 $7E $0A $83 $44 $18 [$10] $83 $7C $18
             $00 $7D $05 $C7 $44 $18 [$0000W]  $C7 $06 $CABBW  $0000W  $90 $90