Switching sounds

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

Switching sounds

Post by levellord » Fri Sep 09, 2005 2:04 am

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:

#Exit sound is Highscore sound:
%patch $12820 $E2 $0E $FF


Where we use the exit sound offset but the highscore sound 3-bit prefix.

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:

#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:

#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.

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

Code: Select all

#Keen walk on map 
%patch $12740 $00 $04 $80 

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

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

#Keen walking 
%patch $12770 $08 $05 $80 

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

#Keen jump 
%patch $12790 $22 $05 $80 

#Keen lands on ground 
%patch $127A0 $4E $05 $80 

#Keen dies 
%patch $127B0 $72 $05 $FF 

#Keen get points 
%patch $127C0 $30 $07 $BE 

#Keen gets an item 
%patch $127D0 $7E $07 $BE 

#Keen gets a spaceship part 
%patch $127E0 $22 $08 $FF 

#Keen shoots 
%patch $127F0 $E0 $09 $C8 

#Keen pogo 
%patch $12800 $58 $0A $A0 

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

#Exit sound 
%patch $12820 $CC $0A $FF 

#Game over! 
%patch $12830 $B0 $0C $FF 

#Hiscore sound 
%patch $12840 $E2 $0E $FF 

#Teleport 
%patch $12850 $8C $0F $FA 

#Icecube smash 
%patch $12860 $48 $11 $C8 

#Odd beepy sound 
%patch $12870 $A2 $12 $FA 

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

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

#Ice cannon fires 
%patch $128A0 $4C $14 $80 

#Slam [Keen hits ground hard] 
%patch $128B0 $D2 $14 $FA 

#Click [switch] 
%patch $128C0 $4C $15 $FA 

#Crystal [Cool sound] 
%patch $128D0 $64 $15 $FF 

#Keen 'plummets' 
%patch $128E0 $90 $16 $80 

#Extra Keen 
%patch $128F0 $7E $17 $FF 

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

#Second Keen walking sound 
%patch $12910 $D0 $19 $80 

#Yorp stunned 
%patch $12920 $D8 $19 $C8 

#get a keycard 
%patch $12930 $72 $1A $F0 

#Door opens 
%patch $12940 $9C $1B $E6 

#Yorp dies 
%patch $12950 $AE $1C $FA 

#Garg dies 
%patch $12960 $44 $1D $FA 

#Out of ammo 
%patch $12970 $08 $1E $C8 

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

#Robot shoots 
%patch $12990 $52 $1E $C8 

#Vorticon dies 
%patch $129A0 $B0 $1E $FF 

#Keen frozen 
%patch $129B0 $36 $20 $C8 

#Keens Left sound [after dying] 
%patch $129C0 $66 $21 $FF 

#The earth explodes 
%patch $129D0 $6A $22 $FF 

#Unamed 
%patch $129E0 $6E $22 $01  
Last edited by levellord on Sat Sep 10, 2005 1:21 am, edited 1 time in total.

User avatar
grafix
Posts: 199
Joined: Fri Oct 29, 2004 8:38 am

Post by grafix » Fri Sep 09, 2005 3:52 pm

I wrote a quick guide to this here.

Post Reply