Switching sounds

Completed patches for Keen3.
Post Reply
User avatar
Crazy pAtChEr
Posts: 1401
Joined: Thu Nov 20, 2003 11:35 pm
Location: NewZealand

Switching sounds

Post by levellord »

The Keen 2 and 3 engines have an internal sound file which therefore can't be edited or changed in length. [In theory its possible to replace sounds with ones of exactly the same length.] The executable however, references this file using a three variable prefix in a certain location. [So several actions can be sent to the location and told where to read the sound from.]

This means that every sound in Keen has a unique adress and prefix. Switching the prefix will make the sound change to another sound.

So if we wanted the exit sound to be the same as the highscore sound:

#Foob uses Garg sound
%patch $13C90 $44 $1D $FA

Where we use the Foob sound offset but the Garg attack sound 3-bit prefix.

All sounds shown have the prefix they usually use, so its easy to swap 'em.

Code: Select all

#Keen walk on map 
%patch $13A80 $00 $04 $80 

#Keen blocked on map 
%patch $13A90 $1A $04 $C8 

#Keen enters a level 
%patch $13AA0 $2A $04 $FF 

#Keen walking 
%patch $13AB0 $08 $05 $80 

#Keen blocked by wall 
%patch $13AC0 $0E $05 $C8 

#Keen jump 
%patch $13AD0 $22 $05 $80 

#Keen lands on ground 
%patch $13AE0 $4E $05 $80 

#Keen dies 
%patch $13AF0 $72 $05 $FF 

#Keen get points 
%patch $13B00 $30 $07 $BE 

#Keen gets an item 
%patch $13B10 $7E $07 $BE 

#Keen gets a spaceship part 
%patch $13B20 $22 $08 $FF 

#Keen shoots 
%patch $13B30 $E0 $09 $C8 

#Keen pogo 
%patch $13B40 $58 $0A $A0 

#Keen pogo high 
%patch $13B50 $8E $0A $B4 

#Exit sound 
%patch $13B60 $CC $0A $FF 

#Game over! 
%patch $13B70 $B0 $0C $FF 

#Hiscore sound 
%patch $13B80 $E2 $0E $FF 

%patch $13B90 $8C $0F $FA 

#Icecube smash 
%patch $13BA0 $48 $11 $C8 

#Odd beepy sound 
%patch $13BB0 $A2 $12 $FA 

#Bump head 
%patch $13BC0 $3C $13 $96 

#Use key sound 
%patch $13BD0 $5A $13 $FA 

#Ice cannon fires 
%patch $13BE0 $4C $14 $80 

#Slam [Keen hits ground hard] 
%patch $13BF0 $D2 $14 $FA 

#Click [switch] 
%patch $13C00 $4C $15 $FA 

#Crystal [Cool sound] 
%patch $13C10 $64 $15 $FF 

#Keen 'plummets' 
%patch $13C20 $90 $16 $80 

#Xtra Keen 
%patch $13C30 $7E $17 $FF 

#Yorp/robot bumps Keen 
%patch $13C40 $B8 $19 $FA 

#Second Keen walking sound 
%patch $13C50 $D0 $19 $80 

#Yorp stunned 
%patch $13C60 $D8 $19 $C8 

#get a keycard 
%patch $13C70 $72 $1A $F0 

#Door opens 
%patch $13C80 $9C $1B $E6 

#Yorp dies 
%patch $13C90 $AE $1C $FA 

#Garg dies 
%patch $13CA0 $44 $1D $FA 

#Out of ammo 
%patch $13CB0 $08 $1E $C8 

#Keens shot hits a wall 
%patch $13CC0 $20 $1E $C8 

#Robot shoots 
%patch $13CD0 $52 $1E $C8 

#Vorticon dies 
%patch $13CE0 $B0 $1E $FF 

#Keen frozen 
%patch $13CF0 $36 $20 $C8 

#Keens Left sound [after dying] 
%patch $13D00 $66 $21 $FF 

%patch $13D10 $6A $22 $FF 

#Meep [oddly, blank, use Yorp death] 
%patch $13D20 $FA $23 $C8 

#Keen meets Mort 
%patch $13D30 $40 $25 $FF 

#Boss foot hit ground 
%patch $13D40 $A0 $27 $FA 

%patch $13D20 $20 $29 $01
User avatar
Posts: 199
Joined: Fri Oct 29, 2004 8:38 am

Post by grafix »

In that list, the offset for each action (for example, Keen shooting) is the first number after %patch - this is the address the game looks at when a certain action is performed to see what sound to play. The next three numbers reference the prefix of the sound that the game will play when that action is performed. For example, here are the default instructions for shooting and Keen walking:

Code: Select all

#Keen shoots
%patch $13B30 $E0 $09 $C8

#Keen walking
%patch $13AB0 $08 $05 $80
Now, if I want to swap those sounds (so that the shooting sound is played when Keen walks and the walking sound is played when Keen shoots) I swap those last three numbers:

Code: Select all

#Keen shoots (sounds like walking)
%patch $13B30 $08 $05 $80                 #was $E0 $09 $C8

#Keen walking (sounds like shooting)
%patch $13AB0 $E0 $09 $C8                 #was $08 $05 $80
That should make it clearer.
Post Reply