Patch:Mangling Machine
This page contains patches that relate to the Mangling Machine in Keen 3. The machine is made of eleven sprites, six purple sparks, one heart, two 'arm' sprites and two 'leg' sprites, and is found in level 16 of Keen 3.
When Keen enters the level a sound plays and a series of text boxes appear. (The conversation with Mortimer McMire.) Keen must shoot the six spark sprites, after which the arm sprites will be destroyed. Then Keen must destroy the heart sprite to destroy the machine and all sprites in the level, winning the game.
Related patches are Patch:Heart and Patch:Purple spark, both sprites used in the machine.
How the machine works
The 'Mangling Machine' is not one entity, but a number of things placed together and can even be said to be the level itself. The components do not have to be arranged in the way they are by default (Which is a humanoid blue machine.) and many can be left out.
There are three basic components to the machine. The first are the arm and leg sprites; invisible sprites that move tiles around making the machine appear to move. The second are the purple sparks, when enough have been destroyed the arm sprites and their tiles are also destroyed. The third is the heart which wins the level when destroyed. All the other things in the level are just added to make things harder for Keen. (Such as the Meeps.)
Disable
There are two things that can be disabled; the first is the sequence of Mangling Machine text boxes, if this is disabled Keen can still win the game by destroying the Mangling Machine. The second patch removes the 'win game' sequence, so, by default there is no way to win the game at all. The Mangling Machine text sequence will still play. The following section is also helpful.
Keen 3
#No MM text boxes
%patch $85D5 $90 $90 $90
Keen 3
#Don't win game in MM level
%patch $8DF4 $EB
Mangling Machine level
This is the level where the conversation with Mortimer occurs and which will win the game if it is completed. If the Mangling Machine is placed in other levels it will be destroyable but will lack the conversation. (And Keen will just win the level when he destroys it, not the game.) by default this level is level 16.
Keen 3
#MM level
%patch $8DF2 [$0010W] $75 #Win game
%patch $85D2 [$10] $75 #MM text sequence
Mortimer McMire conversation
These patches relate to the series of text boxes that appear when Keen enters the MM level. There is also an impressive sound played when the level starts.
Spark counter reset in Mortimer conversation window
When the Mortimer McMire conversation window plays,t he number of sparks shot is set to 0. This means that this value is only reset at the start of level 16 by default. See Patch:Purple spark and Patch:Game stats.
Keen 3
#Spark counter set to this when Mortimer window plays
%patch $507A {$990CW} [$0000W]
Level entrance sound
This is the sound played when the conversation with Mortimer begins.
Keen 3
#Keen enters MM level sound
%patch $570F [$2C]
#Don't play sound
%patch $570E $EB $06
Text box centering
the text boxes in this conversation are 'centered' around at a certain height on the screen. This means the text boxes cannot be placed all over the screen, they must all be centered around a certain vertical height. There are two values used, one for most of the boxes (That are small and thus towards the bottom of the screen.) and one for Mortimer's lengthy replies (Which are taller and thus higher up the screen.) The position of the first text box can be seen in the image above.
Keen 3
#MM conversation text box positioning
%patch $55F4 [$0014W] #Height 1 (Most boxes)
%patch $5634 [$0012W] #Height 2 (Mortimer's 2 replies)
Text box size and text
Each text box has five patches associated with it; the height, the width, the time it remains onscreen (to be read), where the text is read from and the text itself. The page Patch:Text patches is useful for patching these things as it explains the text patch format. Here each window is shown in sequence, from first to last.
The height and width of the window are in text squares (Lines or letters) A 1x8 window can contain one line 8 characters long. The time onscreen value is in 144ths of a second, the default time is shown in the patch. All values below are the default ones.
It is also possible to completely remove some text boxes from appearing, making the conversation simpler. A small utility to make entirely custom conversations can be downloaded here: https://dl.dropboxusercontent.com/u/3940020/MORTEXT.zip
Box 1 (No) patches
#First box:
%patch $5722 [$0001W] #Height
%patch $5726 [$0005W] #Width
%patch $5744 [$00B4W] #Pause to read ( 1.25s)
%patch $5732 [$286DW] #Text read from
#Text
%patch $1C08D "No..." $00
#Stop first textbox appearing
%patch $5721 $EB $38
Box 2 (Can't be) patches
#Second box
%patch $575C [$0001W] #Height
%patch $5760 [$0005W] #Width
%patch $577B [$00B4W] #Pause to read ( 1.25s)
%patch $5769 [$2873W] #Text read from
#Text
%patch $1C093 "It can't be!" $00
#Stop second textbox appearing
%patch $575B $EB $35
Box 3 (MORTIMER!) patches
#Third box
%patch $5793 [$0001W] #Height
%patch $5797 [$0012W] #Width
%patch $57B2 [$00F0W] #Pause to read ( 1.66s)
%patch $57A0 [$2880W] #Text read from
#Text
%patch $1C0A0 "MORTIMER McMIRE!!!" $00
#Stop third textbox appearing
%patch $5792 $EB $35
Box 4 (Thorn in side) patches
#Forth box
%patch $57CA [$0005W] #Height
%patch $57CE [$0026W] #Width
%patch $5831 [$00F0W] #Pause to read ( 1.66s)
%patch $57D7 [$2893W] #First line of text read from
%patch $57E9 [$28BBW] #Second line of text read from
%patch $57FB [$28E3W] #Third line of text read from
%patch $580D [$290AW] #Fourth line of text read from
%patch $581F [$292FW] #Fifth line of text read from
#Text
%patch $1C0B3 "Mortimer has been a thorn in your side" $0A $00
%patch $1C0DB "for as long as you can remember. Your" $0A $00
%patch $1C103 "IQ test score was 314--Mortimer's was" $0A $00
%patch $1C12A "315. He always held that over you," $0A $00
%patch $1C14F "never letting you forget for one day." $0A $00
#Stop 4th textbox appearing
%patch $57C9 $EB $7D
Box 5 (Swirlies) patches
#Fifth box
%patch $5849 [$0005W] #Height
%patch $584D [$0026W] #Width
%patch $58B0 [$00F0W] #Pause to read ( 1.66s)
%patch $5856 [$2956W] #1st line of text read from
%patch $5868 [$2978W] #2nd line of text read from
%patch $587A [$299FW] #3rd line of text read from
%patch $588C [$29C7W] #4th line of text read from
%patch $589E [$29EDW] #5th line of text read from
#Text
%patch $1C176 "All the practical jokes, the mental" $0A $00
%patch $1C19B "cruelty, the swirlies--each memory" $0A $00
%patch $1C1BF "makes your teeth grit harder. And now" $0A $00
%patch $1C1E7 "he's out to destroy earth! You have" $0A $00
%patch $1C20D "had enough!" $0A $00
#Stop 5th textbox appearing
%patch $5848 $EB $7D
Box 6 (All right) patches
#Sixth box
%patch $58C8 [$0002W] #Height
%patch $58CC [$001FW] #Width
%patch $58F9 [$00B4W] #Pause to read ( 1.25s)
%patch $58D5 [$29FAW] #1st line of text read from
%patch $58E7 [$2A1BW] #2nd line of text read from
#Text
%patch $1C21A "'ALL RIGHT MORTIMER, WHAT'S THE" $0A $00
%patch $1C23B "PROBLEM? WHY DESTROY EARTH?'" $0A $00
#Stop 6th textbox appearing
%patch $58C7 $EB $47
Box 7 (All right) patches
#Seventh box
%patch $5911 [$0004W] #Height
%patch $5915 [$0023W] #Width
%patch $5966 [$00B4W] #Pause to read ( 1.25s)
%patch $591E [$2A3AW] #1st line of text read from
%patch $5930 [$2A5BW] #2nd line of text read from
%patch $5942 [$2A7EW] #3rd line of text read from
%patch $5954 [$2AA0W] #4th line of text read from
#Text
%patch $1C25A "'You and all those mental wimps" $0A $00
%patch $1C27B "deserve to die! I'm the smartest" $0A $00
%patch $1C29E "person in the galaxy. Aren't I," $0A $00
%patch $1C2C0 "mister THREE FOURTEEN! Ah ha ha!'" $00
#Stop 7th textbox appearing
%patch $5910 $EB $6B
Box 8 (I'll get you) patches
#8th box
%patch $597E [$0001W] #Height
%patch $5982 [$0022W] #Width
%patch $599C [$00B4W] #Pause to read ( 1.25s)
%patch $598B [$2AC2W] #First line of text read from
#Text
%patch $1C2E2 "'I'll get you for that, Mortimer!'" $00
#Stop 8th textbox appearing
%patch $597D $EB $33
Box 9 (Come and try) patches
#9th box
%patch $59B3 [$0003W] #Height
%patch $59B7 [$0026W] #Width
%patch $59F3 [$00F0W] #Pause to read ( 1.66s)
%patch $59C0 [$2AE5W] #1st line of text read from
%patch $59D1 [$2B0CW] #2nd line of text read from
%patch $59E2 [$2B33W] #3rd line of text read from
#Text
%patch $1C305 "'Come and try! You'll never get past" $0A $00
%patch $1C32C "my hideous Mangling Machine! Prepare" $0A $00
%patch $1C353 "to die, Commander Clown!'" $00
#Stop 9th textbox appearing
%patch $59B2 $EB $52
Heart, Spark, Arms and Legs
Most of the patches relating to the shootable sprites can be found on the Patch:Heart and Patch:Purple spark pages. The arm and leg sprites are entirely tile based., thus most of the patches for them will involve what tiles are placed and where.
Although the arms and legs seem to 'grow' and shrink, in reality the sprite is moving, leaving tiles as it goes, much like the Patch:Falling block in Keen 1. Thus tile locations will always be relative to the moving sprite. Arms and legs stop moving when they hit a 'stop tile'; they will easily move right through solid ground if it is the wrong type of tile, and right out of the bottom of the level.
Sparks and Heart
These patches control the amount of points Keen gets when he shoots a spark or heart, and the number of sparks needed to be destroyed before the arm sprites are destroyed. (For the meaning of the $75 byte see Patch:Jump conditions) See also Patch:Heart and Patch:Purple spark. By default Keen gets 1'000 points for shooting either.
Heart and spark patches
#Points you get for shooting a spark
%patch $4E44 [$03E8W]
#Points you get for shooting a heart
%patch $4EE9 [$03E8W]
#How many sparks need to be shot to destroy the arms
%patch $4E53 [$0006W] $75
Arms
There are two arm sprites, one on either side of the MM by default. Their job is to shield the heart sprite so Keen can't win the level in a single shot. Unlike the legs, both arm sprites are the same, just in different locations, so patching one affects both of them the same way. Arms can thus be placed anywhere in the level, and many may be used.
The arm's center is the tile between the top of its 'fingers' and all other tile positions are relative to this. Some tile positions can be changed, some can't. If two tiles are patched to the same place, only one will appear. An easy way to make a tile 'not appear' is to make it the same as the background tiles. If you really want to stop a tile being replaced make sure both it and its 'replacement tiles' are stopped.
The 'stop' or 'floor' tile will stop the arm when it is two tiles below it. For the meaning of the $75 byte see Patch:Jump conditions; it is possible to make a large number of tiles floor tiles. (By changing the $75) to make a more versatile machine.
Like the legs the arms move down until they hit a stop tile, then move back up to until they run out of arm tiles. (Thus you need to place your arm sprite ON an arm tile to make it work properly.) If the arm sprite is not placed on an arm tile then it will not rise after it falls, this can be used deliberately to 'lock Keen in' someplace. As they move they leave tiles behind, both solid, and 'wallpaper.' The best way to figure out how the arms work is to experiment with patching.
The arm consists of the arm itself, and two fingers, left and right. It is possible to change how fast the arm moves.
Arm speed
#How fast arms move (Less = faster)
%patch $5220 [$0028W]
Arm tile patches
#Stop tile (Floor tile)
%patch $5214 [$01D7W] $75
#Arm tiles
%patch $51E3 [$0255W] #Arm start tile
%patch $5237 [$0255W] #Main arm tile (Must match above tile)
%patch $5255 [$0255W] #Tile between top of two fingers (Must be the same or larger value as two above values)
#Left finger
%patch $526D [$026AW] #Top
%patch $5286 [$026CW] #Middle
%patch $52A0 [$026BW] #Bottom
#Right finger
%patch $52B8 [$026AW] #Top
%patch $52D1 [$026CW] #Middle
%patch $52EB [$026BW] #Bottom
#Wallpaper tiles that appear when... (Should all be the same)
%patch $5149 [$00A9W] #...top of left finger moves down
%patch $5162 [$00A9W] #Unused?
%patch $517C [$00A9W] #...bottom of left finger moves up
%patch $5131 [$00A9W] #Lifting arm
%patch $5194 [$00A9W] #...top of right finger moves down
%patch $51AD [$00A9W] #Unused?
%patch $51C7 [$00A9W] #...bottom of right finger moves up
#Stop tiles being replaced:
%patch $5235 $90 $90 $90 $90 #Main arm tile
%patch $5253 $90 $90 $90 $90 #tile between top of two fingers
%patch $526B $90 $90 $90 $90 #Left finger top
%patch $5284 $90 $90 $90 $90 #Middle
%patch $529E $90 $90 $90 $90 #Bottom
%patch $52B6 $90 $90 $90 $90 #Right finger top
%patch $52CF $90 $90 $90 $90 #Middle
%patch $52E9 $90 $90 $90 $90 #Bottom
%patch $5147 $90 $90 $90 $90 #Wallpaper tiles that appear when...top of left finger moves down
%patch $5160 $90 $90 $90 $90 #Unused?
%patch $517A $90 $90 $90 $90 #...bottom of left finger moves up
%patch $512F $90 $90 $90 $90 #Lifting arm
%patch $5192 $90 $90 $90 $90 #...top of right finger moves down
%patch $51AB $90 $90 $90 $90 #Unused?
%patch $51C5 $90 $90 $90 $90 #...bottom of right finger moves up
Legs
The legs consist of two parts, the leg and the foot. Left legs and right legs are different sprites (Though they DO share some code!) and there is one of each by default. They are at the bottom of the MM and try to kill Keen by putting deadly-type tiles on him. (The legs are not in themselves lethal, the tiles are.) They move up and down until there is a 'stop' or 'floor' tile beneath them, like the arms.
The center of the leg is where the foot meets the leg. For the left leg the floor tile must be one to the right of it, for the right leg this tile must be 1 tile to the left. (In the default level they are the same grey block, between the legs.) Like the arms, the $75 byte can be changed to allow multiple types of tile to act as floor tiles.
While both legs use the same *leg* tiles, they can use different foot tiles. Leg sprites must be placed on a leg tile. If the leg start tile is not the same as the leg tiles, then the foot will not rise after it has fallen. This can be used to 'trap' Keen someplace.
It is notable that the left leg will rise first after it has landed, even if it has landed at the same time as a right foot. The leg speed is odd, it is 0 by default (So the legs can't be made slower) but making it larger speeds the legs up. (Good values are 0040 and 0080)
Leg rising
#Right foot waits this long before rising
%patch $5542 [$00C8W]
#Leg speed (Larger = faster)
%patch $5549 [$00000W]
#Neither foot rises after falling
%patch $5534 $00
Leg tile patches
#Floor tile for BOTH legs
%patch $541B [$01AEW] $75
#Legs
%patch $53F0 [$0255W] #Leg start tile
%patch $544C [$0255W] #Main leg tile
%patch $57AF [$0255W] #Unused?
#Left foot
%patch $5471 [$026DW] #Left foot heel
%patch $548A [$026FW] #Left foot right middle
%patch $54A5 [$026FW] #Left foot left middle
%patch $54C0 [$026CW] #Left foot toe
#Right foot
%patch $54D8 [$026CW] #Right foot heel
%patch $54F1 [$026FW] #Right foot right middle
%patch $550B [$026FW] #Right foot left middle
%patch $5526 [$026DW] #Right foot toe
#Wallpaper tiles that appear when... (Should all be the same)
%patch $532E [$00A9W] #...the heel of BOTH feet rises
%patch $534D [$00A9W] #Left foot right middle rising/falling
%patch $5368 [$00A9W] #Left foot left middle rising/falling
%patch $5383 [$00A9W] #Left foot toe rising/falling
%patch $539E [$00A9W] #Right foot left middle rising/falling
%patch $53B8 [$00A9W] #Right foot right middle rising/falling
%patch $53D3 [$00A9W] #Right foot toe rising/falling
#Stop tiles being replaced:
%patch $544A $90 $90 $90 $90 #Main leg tile
%patch $546F $90 $90 $90 $90 #Left foot heel
%patch $5488 $90 $90 $90 $90 #Left foot right middle
%patch $54A3 $90 $90 $90 $90 #Left foot left middle
%patch $54BE $90 $90 $90 $90 #Left foot toe
%patch $54D6 $90 $90 $90 $90 #Right foot heel
%patch $54EF $90 $90 $90 $90 #Right foot right middle
%patch $5509 $90 $90 $90 $90 #Right foot left middle
%patch $5524 $90 $90 $90 $90 #Right foot toe
%patch $532C $90 $90 $90 $90 #Wallpaper tiles that appear when...the heel of BOTH feet rises
%patch $534B $90 $90 $90 $90 #Left foot right middle rising/falling
%patch $5366 $90 $90 $90 $90 #Left foot left middle rising/falling
%patch $5381 $90 $90 $90 $90 #Left foot toe rising/falling
%patch $539C $90 $90 $90 $90 #Right foot left middle rising/falling
%patch $53B6 $90 $90 $90 $90 #Right foot right middle rising/falling
%patch $53D1 $90 $90 $90 $90 #Right foot toe rising/falling
The destruction of the Mangling Machine
There are two events of destruction involved with the MM. The first is the destruction of the arms. First the arm sprites are removed, then two areas of the level are replaced with background tiles, erasing the arm tiles. The second is the destruction of the heart, ALL sprites in a level are removed, another area of the level is replaced with background tiles and Keen wins the level (Or game.)
These can be used in normal levels too, they do not need the MM sprites to work. (Just the sparks or heart.)
All Sparks destroyed
The first destructive event will remove arm sprites. The 'destruction zones' are not related to the arm sprites AT ALL, they can be in totally different places/ Any arm sprites not in the two 'destruction zones' will simply stop; any tiles in the destruction zone, whatever they are, will be destroyed. The level does not even need arm sprites in it to use this destruction, just enough sparks.
When a tile is being destroyed it will have a Patch:Zap and zot sprite placed over it. (See that page for more patches.) If that sprite is changed it is possible to make the destroyed arms produce dozens of Vorticons say, a scary prospect. Certain tiles are not replaced, by changing the $74 byte to $EB the destruction zone is not affected at all. (You can also be more inventive and have multiple tiles not replaced, allowing some parts of the level to survive.
Below the two destruction zones will be called 'left' and right'. They can be placed anywhere in a level, even outside it. (In which case nothing in the level will be harmed.)
The 'move down x rows' patch changes how many rows the destruction moves down each turn. By default this is one row, so row 1 is destroyed, then row 2, then 3... but this can be made larger, destroying only every second or third row for example.
The h and v values for the location of the destruction zones are 2 less than they appear in the level because of the level border.
Arm destruction zones
#Tiles that replace destroyed areas
%patch $5019 [$00A9W] #Left zone
%patch $504A [$00A9W] #Right zone
%patch $5014 [$00A9W] $74 #Don't replace these tiles in left zone
%patch $5045 [$00A9W] $74 #Don't replace these tiles in right zone
#Size of destruction zones (Both zones 3 tiles wide by default)
%patch $4FFC [$05] #Left zone h start
%patch $5029 [$07] #Left zone h end
%patch $502D [$11] #Right zone h start
%patch $505A [$13] #Right zone h end
%patch $4E93 [$06] #BOTH zones top
%patch $4FEA [$13] #BOTH zones bottom
#Move down x rows
%patch $4FDA $01
Misc destruction zones patches
#Both arm destruction zones keep going until they hit the bottom of the level
%patch $4FDD $00
#Stop zone from being destroyed
%patch $5052 $F0 $FE #Right
%patch $5021 $21 $FF #Left
#The arms don't stop moving when six sparks are shot.
%patch $40EC $01
Heart destroyed
This is the final destructive sequence, another tile replacement zone, by default destroying the MM entirely. ALL sprites are removed from the level and the level is won. This works very similarly to the arm destruction sequence, so that too should be read.
It is also possible to patch how long it takes before the level is won. Changing the $75 byte to $EB means Keen cannot win the level by destroying the MM.
Body destruction zone
#Tiles that replace destroyed area
%patch $50DB [$00A9W] #Replacement tile
%patch $50D6 [$00A9W] $74 #Don't replace these tiles in zone
#Size of destruction zone
%patch $50BE [$08] #Left
%patch $50EB [$10] #Right
%patch $4F2C [$02] #Top
%patch $50B2 [$13] #Bottom
Winning the level
There will be a pause of a certain length before the level is won. The length of this can be changed, or it can be removed entirely, meaning that destroying the heart will not in fact win the level.
Time after starting destruction that Keen wins the level
#Time after starting destruction that Keen wins the level
%patch $5096 [$0018W] $75
Don't win the level
This patch stops Keen winning the level even if he destroys the heart. he will need to find an exit instead.
Destroying the Heart doesn't win the level
#Destroying the Heart doesn't win the level
%patch $5095 $EB $10
Misc
Misc patches that don't really fit anywhere else.
Destroying sparks destroys part of MM, wins level
This patch is slightly unstable and may have unforeseen effects.
Destroying sparks destroys part of MM, wins level
#When 6 sparks are shot, MM body *below* arm sprites blows up, Keen goes to ending
%patch $5062 $90
External links
- A small utility for making custom Mangling Machine conversations: https://dl.dropboxusercontent.com/u/3940020/MORTEXT.zip