Patch:Scrollbars

From KeenWiki
Jump to navigation Jump to search

Scrollbars are 'sprites' that stop the camera from moving past them in Keen Galaxy. Keen 5 has horizontal scrollbars only while Keen 4 and Keen 6 have both horizontal and vertical scrollbars. Both types are essentially the same; they are used to divide a single level up into sections and often to hide object or passageways from the player.

As they are so simple and similar between games all three Galaxy episodes will be covered on a single page.


Sprite spawn code

For Keen 4\6 there are two initiation codes, one for each scrollbar. For Keen 5 only one. Both initiation codes are the same; they run the spawn scrollbar code, but horizontal bars run it with a value of 0, vertical bars with a value of 1.

The spawning code does not spawn a sprite as such, instead it creates a 'scroll block'; remembering where the scrollbar is and storing that in memory. It should be noted that Keen 5 has the possibility of spawning vertical scrollbars even though it does not use them.

Keen 4

#Location of initiation codes
%patch $EEB5 [$034DW] #Horizontal Scrollbar (At $EC3D)
%patch $EEB7 [$0360W] #Vertical Scrollbar (At $EC50)

#Horizontal Scrollbar
%patch $EC3D $B8 $0001W  $50 $FF $76 $FC $57 $9A {$16540B08RL}     $83 $C4 $06
             $E9 $01ADW  

#Vertical Scrollbar
%patch $EC50 $33 $C0 $50 $FF $76 $FC $57 $9A {$16540B08RL}     $83 $C4 $06 $E9
             $019BW

#Scrollbar 'spawning' code
%patch $17048 $55 $8B $EC $83 $7E $0A $00 $74 $29 $8B $1E $AC $CC $D1 $E3 $8B
              $46 $08 $89 $87 $9E $CC $A1 $AC $CC $FF $06 $AC $CC $3D $06 [$00]
              {$75} $35 $B8 [$4244W]  $50 $9A $037D022FRL     $83 $C4 $02 $5D $CB
              $5D $CB
                      $8B $1E $AA $CC $D1 $E3 $8B $46 $06 $89 $87 $92 $CC $A1
              $AA $CC $FF $06 $AA $CC $3D $06 [$00] {$75} $0C $B8 [$4279W]  $50 $9A
              $037D022FRL     $83 $C4 $02 $5D $CB


Scroll block errors

If too many scrollbars are placed in a single level then the game will run out of memory to store them in. When this happens the game crashes with an error message. See also Patch:Game errors.

Scroll bar errors

#Keen 4 :
%patch $1706B  [$4244W] #Text called from
%patch $330B4 "RF_SetScrollBlock: Too many horizontal scroll blocks" $00
%patch $17094  [$4279W] #Text called from
%patch $330E9 "RF_SetScrollBlock: Too many vertical scroll blocks" $00


#Keen 5 :
%patch $18008  [$3895W] #Text called from
%patch $33BD5 "RF_SetScrollBlock: Too many horizontal scroll blocks" $00
%patch $18031  [$38CAW] #Text called from
%patch $33C0A "RF_SetScrollBlock: Too many vertical scroll blocks" $00


#Keen 6 :
%patch $16CDB  [$3C44W] #Text called from
%patch $34974 "RF_SetScrollBlock: Too many horizontal scroll blocks" $00
%patch $16D04  [$3C79W] #Text called from
%patch $349A9 "RF_SetScrollBlock: Too many vertical scroll blocks" $00