Patch:Demo Sign

From KeenWiki
Jump to navigation Jump to search

The Demo Sign in Keen Galaxy is a sprite that appears onscreen when a demo is playing. It is not just an image but an actual object that can be patched to behave just like any other sprite. This page contains patches relating to the Demo Sign as a sprite for all three episodes of Keen Galaxy.


Sprite Type

The Demo Sign uses sprite type 1, or 'Misc' as its sprite type is of no real importance. Changing this can cause problems when demos run. (If it is set to Keen's sprite type for example Keen will die when the demo sign touches an enemy.)

Keen 4

#Demo Sign sprite type
%patch $D8FC  $01

Keen 5

#Demo Sign sprite type
%patch $CCC0  $01


Sprite Actions

The Demo Sign has three actions; the first two are invisible and in effect do nothing. The third is the actual Demo sign itself. All three are called when spawned (under various conditions) and do nothing once called. The end result is that the demo sign never appears in the High Scores level or during normal gameplay, only in a (non H.S.!) demo.

Keen 4

Actions -Keen 4:
$089CW #In High Scores (Invisible)
$1456W #Normal Gameplay (Invisible)
$1474W #Demo Sign

Keen 4

#Spawn
%patch $D92B {$089CW} #In High Scores
%patch $D937 {$1456W} #Normal Gameplay
%patch $D949 {$1474W} #Demo sign

#In High Scores action
%patch $2F728 {$0000W}

#Normal Gameplay action
%patch $302E2 {$0000W}

#Demo Sign
%patch $30300 {$0000W}


Keen 5

Actions -Keen 5:
$0788W #In High Scores (Invisible)
$133EW #Normal Gameplay (Invisible)
$135CW #Demo Sign

Keen 5

#Spawn
%patch $CCEF {$0788W} #In High Scores
%patch $CCFB {$133EW} #Normal Gameplay
%patch $CD0D {$135CW} #Demo sign

#In High Scores action
%patch $30AE4 {$0000W}

#Normal Gameplay action
%patch $3169A {$0000W}

#Demo Sign
%patch $316B8 {$0000W}


Sprite Behavior

The Demo Sign has no behavior at all and does not need one by default.

Keen 4 behaviors

#In High Scores
%patch $2F71C $00000000L  #Nothing

#Normal Gameplay
%patch $302D6 $00000000L  #Nothing

#Demo Sign
%patch $302F4 $00000000L  #Nothing

Keen 5 behaviors

#In High Scores
%patch $30AD8 $00000000L  #Nothing

#Normal Gameplay
%patch $3168E $00000000L  #Nothing

#Demo Sign
%patch $316AC $00000000L  #Nothing


Speed

The speed of the Demo Sign actions is controlled by screen movement and as such animation motion is not used. Indeed in a sense the Demo Sign itself does not move at all.

Keen 4 animation motion

#In High Scores
%patch $2F718 [$0000W $0000W]

#Normal Gameplay
%patch $302D2 [$0000W $0000W]

#Demo Sign
%patch $302F0 [$0000W $0000W]

Keen 5 animation motion

#In High Scores
%patch $30AD4 [$0000W $0000W]

#Normal Gameplay
%patch $3168A [$0000W $0000W]

#Demo Sign
%patch $316A8 [$0000W $0000W]


Sprite Collision

Demo Signs have no sprite collision.


Collision values

None of the Demo Sign actions have any collision of any kind. Adding one is a bad idea.

Keen 4 collision values

#In High Scores
%patch $2F720 $00000000L  #Nothing

#Normal Gameplay
%patch $302DA $00000000L  #Nothing

#Demo Sign
%patch $302F8 $00000000L  #Nothing

Keen 5 collision values

#In High Scores
%patch $30ADC $00000000L  #Nothing

#Normal Gameplay
%patch $31692 $00000000L  #Nothing

#Demo Sign
%patch $316B0 $00000000L  #Nothing


Animations

The Demo Sign uses only one animation by default for its frame. It has no cache as its animation is cached when it is spawned. The other two actions are invisible and have no animations. None of the actions use an animation speed.

Keen 4

#Cache animation for Demo Sign
%patch $D964 [$0081W]

#In High Scores
%patch $2F70C $0000W $0000W
%patch $2F716 $0000W        #Animation speed

#Normal Gameplay
%patch $302C6 $0000W $0000W
%patch $302D0 $0000W        #Animation speed

#Demo Sign
%patch $302E4 $0081W $0081W
%patch $302EE $0000W        #Animation speed

Keen 5

#Cache animation for Demo Sign
%patch $CD28 [$006BW]

#In High Scores
%patch $30AC8 $0000W $0000W
%patch $30AD2 $0000W        #Animation speed

#Normal Gameplay
%patch $3167E $0000W $0000W
%patch $31688 $0000W        #Animation speed

#Demo Sign
%patch $3169C $006BW $006BW
%patch $316A6 $0000W        #Animation speed


Sprite-tile interaction

The Demo Sign and invisible actions do not have any tile interaction at all. As such it is not known how the Demo Sign remains visible onscreen.

Keen 4

#In High Scores
%patch $2F724 $00000000L

#Normal Gameplay
%patch $302DE $00000000L

#Demo Sign
%patch $302FC $00000000L

Keen 5

#In High Scores
%patch $30AE0 $00000000L

#Normal Gameplay
%patch $31696 $00000000L

#Demo Sign
%patch $316B4 $00000000L


Action type

Oddly all actions use type 2 suggesting that even the invisible sprites are present and reacting somehow.

Keen 4

#In High Scores
%patch $2F710 [$0002W]

#Normal Gameplay
%patch $302CA [$0002W]

#Demo Sign
%patch $302E8 [$0002W]

Keen 5

#In High Scores
%patch $30ACC [$0002W]

#Normal Gameplay
%patch $31682 [$0002W]

#Demo Sign
%patch $316A0 [$0002W]


Deprotect and stick to ground

The Demo Sign needs neither of these variables and so both are set to 0 in all actions.

Keen 4

#Demo Sign
%patch $2F712 [$0000W $0000W]

#Normal Gameplay
%patch $302CC [$0000W $0000W]

#Demo Sign
%patch $302EA [$0000W $0000W]

Keen 5

#Demo Sign
%patch $30ACE [$0000W $0000W]

#Normal Gameplay
%patch $31684 [$0000W $0000W]

#Demo Sign
%patch $316A2 [$0000W $0000W]


Clipping and foreground

The Demo Sign has a foreground variable of 3, meaning it appears in front of all sprites and foreground tiles. The clipping is 0; having no clipping allows the Sign to move through all solid tiles.

Keen 4

#Demo Sign foreground variable
%patch $D901 $0003W

#Demo Sign clipping variable
%patch $D90B $0000W

Keen 5

#Demo Sign foreground variable
%patch $CCC5 $0003W

#Demo Sign clipping variable
%patch $CCCF $0000W


Sprite spawn code

The Demo sign spawn code is unlike any other in the game; unlike other sprites the Demo Sign is not specifically placed in any level, rather the demo sign spawning code is always called in every level. The Demo sign is thus always present, even if not visible.

The first section of the spawn code is quite straightforward; $C7 $02 $xxxxW sets the sprite activity, $C7 $47 $06 $xxxxW sets the clipping, $C7 $07 $xxxxW sets the sprite type, $C7 $20 $xxxxW sets the foreground value. A number of other sprite variables are set to -1 as part of how the demo sign works.

However on the fourth line a check of 'InHighScores' is made. If the player is in the High Scores level then an invisible sprite is created. ($089CW\$0788W -Keen4\5; oddly this sprite appears not to spawn properly.) If not then the game checks to see if the game is in demo mode. If it isn't then another, equivalent, invisible sprite is produced. ($1456W\$133EW -Keen4\5) If both checks have been passed however then the demo sign sprite action is set and the demo sign animation cached. (The last blue value in the third section.)

Keen 4 Demo Sign spawning

#Demo Sign spawn code
%patch $D8F3 $55 $8B $EC $8B $1E $D4 $A7 $C7 $07 [$0001W]  $C7 $47 $20 [$0003W]
             $C7 $47 $02 [$0002W]  $C7 $47 $06 [$0000W]  $C7 $47 $40 [$FFFFW]  $C7
             $47 $3E [$FFFFW]  $C7 $47 $42 [$FFFFW]  $C7 $47 $44 [$FFFFW]  $83 $3E
             {$A52FW}  [$00] {$74} $07 $C7 $47 $1C [$089CW]  $5D $CB
                                                             $83 $3E {$3BD6W}
             [$00] {$75} $12 $B8 [$1456W]  $50 $FF $36 $D4 $A7 $9A $09DC118CRL   
             $83 $C4 $04 $5D $CB
                                 $B8 [$1474W]  $50 $FF $36 $D4 $A7 $9A $09DC118CRL
                     $83 $C4 $04 $B8 $2A3AW  $8A $16 $EC $7A $8E $C0 $26 $08
             $16 [$0081W]  $5D $CB

Keen 5 Demo Sign spawning

#Demo Sign spawn code
%patch $CCB7 $55 $8B $EC $8B $1E $3C $9E $C7 $07 [$0001W]  $C7 $47 $20 [$0003W]
             $C7 $47 $02 [$0002W]  $C7 $47 $06 [$0000W]  $C7 $47 $40 [$FFFFW]  $C7
             $47 $3E [$FFFFW]  $C7 $47 $42 [$FFFFW]  $C7 $47 $44 [$FFFFW]  $83 $3E
             {$9B97W}  [$00] {$74} $07 $C7 $47 $1C [$0788W]  $5D $CB
                                                             $83 $3E {$332CW}
             [$00] {$75} $12 $B8 [$133EW]  $50 $FF $36 $3C $9E $9A $090B11C4RL
             $83 $C4 $04 $5D $CB
                                 $B8 [$135CW]  $50 $FF $36 $3C $9E $9A $090B11C4RL
                     $83 $C4 $04 $B8 $2B7BW  $8A $16 $EC $6F $8E $C0 $26 $08
             $16 [$006BW]  $5D $CB