Patch:Oracle Council Member

From KeenWiki
(Redirected from Patch:Council member)
Jump to navigation Jump to search

Council Members are characters in Keen 4 who must be 'rescued' by Keen whenever he comes across them. By default he will encounter eight of them before winning the game. Related patches are

This page deals with the member as a sprite. The window that appears when the member is rescued is dealt with on the Patch:Oracle Council Message page. See also Patch:Oracle.


Sprite Type

Members use type 6 which is used only by them and doesn't affect anything else. This type reacts specifically with Keen to bring up the text messages, if this is changed, Members will no longer interact with Keen.

Keen 4

#Member sprite type
%patch $FCFD  $06


Sprite Actions

Members have three actions, one of the most limited in the game. Two of the actions are walking back and forth, the third is pausing to think. Members are created walking and will randomly pause, after which they will resume walking again.

Actions:
$1FB8W #Walking Council member 1
$1FD6W #Walking Council member 2
$1FF4W #Thinking Council Member

Keen 4

#Member placed in-level
%patch $FD46  $1FB8W #Spawn member (Walk)

#Walking cycle
%patch $30E44 $1FD6W #Walking council member 1
%patch $30E62 $1FB8W #Walking council member 2

#When walking
%patch $FD77  $1FF4W #Randomly think

#Thinking member
%patch $30E80 $1FB8W #Return to walking


Sprite Behavior

Members have only one behavior, walk and randomly think. This is sued when walking, but not when thinking.

Behaviors:
$0FA802D4RL #Council member walking

Keen 4

#Walking
%patch $30E38 $0FA802D4RL #Council member walking
%patch $30E56 $0FA802D4RL #Council member walking

#Thinking
%patch $30E74 $00000000L  #Sit


Members don't stop to think

This patch makes the Member walk back and forth without stopping to think.

Keen 4

#Oracle members don't stop to think (Frees $FD55 - $FD7D)
%patch $FD54 $CB


Behavior code

This is the behavior code the members use when walking. It basically randomly changes the sprite's action, in this case to a thinking Member.

Keen 4

#Member behavior code
%patch $FD54  $55 $8B $EC $83 $EC $02 $56 $8B $76 $06 $9A $1D02002ARL     $89
              $46 $FE $A1 $4C $A5 $D1 $E0 $D1 $E0 $D1 $E0 $3B $46 $FE $76 $05
              $C7 $44 $1C [$1FF4W]  $5E $8B $E5 $5D $CB


Speed and Jump Height

Member's only motion is animation motion, that is, their speed depends on how fast they animate. The speed after thinking is twice that of walking, to give them a 'head start'.

Note that the thinking speed causes a possible bug; if a Member thinks near the edge of a platform, he may walk off it and start spinning about in the air. This can be fixed by either making sure Members never encounter the edge of platforms (Having them in a walled enclosure.) or by setting the thinking speed to zero.

Animation motion

#Walking
%patch $30E34 [$0040W $0000W]
%patch $30E52 [$0040W $0000W]

#Thinking
%patch $30E70 [$0080W $0000W]


Sprite Collision

Members have no collision. This means, technically nothing can affect them, instead, when Keen touches them, his code responds to their sprite type (see above section) making them vanish. (And the level end, etc.)

Keen 4 collision values

#Walking
%patch $30E3C $00000000L #No collision
%patch $30E5A $00000000L #No collision

#Thinking
%patch $30E78 $00000000L #No collision


Keen doesn't exit level after meeting a Member

This patch allows Keen to continue playing the level after meeting the Member. This is done by first changing the Member's type so it doesn't trigger the exit level sequence. The collision causes the Member to transform into a raindrop splash when Keen hits it (This can be changed.) so that Keen is not stuck in an infinite loop of messages. This patch uses the EGAGRAPH skip so is incompatible with other patches that use it. It also removes the only way to win the game by default, so some other way to win must be used.

Keen 4

#Disable level end type
%patch $FCFD  $01

#Disable EGAGRAPH check in Keen 4 (Frees 389 bytes at $3CF6)
%patch $3CE5 $90 $90

#Member collision; if Keen run oracle windows and transform = $037D0526RL
%patch $3CF6 $55 $8B $EC $56 $57 $8B $76 $06 $8B $7E $08 $83 $3D [$02] {$75} $0F
             $C7 $44 $1C [$1F46W]  $9A $0E8F0BA5RL     $9A $16540D59RL     $5F
             $5E $8B $E5 $5D $CB

#Use new collision
%patch $30E3C $037D0526RL #No collision
%patch $30E5A $037D0526RL #No collision
%patch $30E78 $037D0526RL #No collision


Animations

Council members animate quite simply, cycling through two walking frames. Notice that the speed of animation will also affect how fast they move. The animation speed on the thinking frame is how long the member will think.

Keen 4

#Cache
%patch $306F2 $0164W #Council Member Cache start
%patch $3073C $0169W #Council member cache end

#Walking council member
%patch $30E28 $0166W $0164W
%patch $30E32 $000AW        #Animation speed
%patch $30E46 $0167W $0165W
%patch $30E50 $000AW        #Animation speed

#Thinking Council member
%patch $30E64 $0168W $0169W
%patch $30E6E $0078W        #Animation speed


Sprite positioning

Members are spawned one tile, 7 pixels up from their placed position.

Keen 4

#Spawn height
%patch $FD19 [$FE8FW] #Spawn height: 1 tile 7 pixels up


Clipping and foreground

Members' foreground is set to 1, which means they appear behind foreground tiles and sprites only.

Keen 4

#Member Foreground variable
%patch $FD02  $0001W


Sprite-tile interaction

Members use 'walk back and forth' as a tile collision, which makes them turn around whenever they hit a wall or run out of floor. This is used by several sprites.

Keen 4

3walk
%patch $30E40 $09DC1795RL
%patch $30E5E $09DC1795RL

#Think
%patch $30E7C $09DC176ERL


Action type

Lindsey uses type 3 for its actions, allowing it to move smoothly.

Keen 4

#Walking
%patch $30E2C [$0000W] #Walking council member 1 [Sit]
%patch $30E4A [$0000W] #Walking council member 2 [Sit]

#Thinking
%patch $30E68 [$0000W]


Deprotect and stick to ground

Council members have a value of 1 for 'change vertical' when walking, meaning they can walk up and down hills. Thinking council members have a value of 0, which can lead to problems if they ever start thinking while walking down a slope.

Keen 4

#Walking
%patch $30E2E [$0000W $0001W]
%patch $30E4C [$0000W $0001W]

#Thinking
%patch $30E6A [$0000W $0000W]


Probability and randomness

There are two random choices a Member may make, the first is whether to be spawned moving right or left. (This is a 50:50 chance.) and when to think. However the think frequency cannot yet be patched.

Keen 4

#Probability of starting right or left
%patch $FD24 $80


Sprite spawn code

In the initiation code notice the Inchworm cache being set ($C7 $06 $5D $CB $0001W.)

In the spawning code the last blue highlighted value is the sprite action the sprite uses as it proceeds to act in-level. $C7 $02 $xxxxW sets the sprite activity, $C7 $07 $xxxxW sets the sprite type, $C7 $20 $xxxxW sets the foreground value. Finally $D3 $E0 $05 $xxxx is how far down (Or more usually up) the sprite is spawned from where it is placed. This is necessary for sprites that walk on the ground as they can only be placed in the level at multiples of 16 pixels high while their actual height can be anything.

The Member has a 50/50 chance of starting the level moving left or right. (This is the $0080W variable.) $C7 $47 $10 $xxxxW is the vertical direction the sprite starts moving in, either $0001W (Facing down), $FFFFW (Facing up) or $0000W (Neither, never used.) $C7 $47 $0E $xxxxW is the horizontal direction.

Keen 4

#Location of initiation code
%patch $EE8B [$00E4W] #Council Member (At $E9D4)

#Member Initiation code
%patch $E9D4 $FF $76 $FC $57 $9A {$0FA80269RL}     $83 $C4 $04 $C7 $06 $5D $CB
             $0001W  $E9 $0414W

#Member spawning code
%patch $FCE9  $55 $8B $EC $33 $C0 $50 $9A $06BD1E11RL     $83 $C4 $02 $8B $1E
              $D8 $A7 $C7 $07 [$0006W]  $C7 $47 $02 [$0001W]  $C7 $47 $20 [$0000W]
              $8B $46 $06 $B1 $08 $D3 $E0 $89 $47 $0A $8B $46 $08 $D3 $E0 $05
              [$FE8FW]  $89 $47 $0C $9A $1D02002ARL     $3D [$0080W]  $7D $0B $8B
              $1E $D8 $A7 $C7 $47 $0E [$0001W]  $EB $09 $8B $1E $D8 $A7 $C7 $47
              $0E [$FFFFW]  $8B $1E $D8 $A7 $C7 $47 $10 [$0001W]  $B8 [$1FB8W]  $50
              $53 $9A $09DC118CRL     $83 $C4 $04 $5D $CB