User login

Navigation

Poll

I downloaded the ETQW demo and....
...I'm too busy playing for polls.
0%
...it's awesome.
60%
...it's okay, I expected better.
20%
...I'm lost in the valley, anyone have a map?
0%
...my machine won't run it. :-(
20%
Total votes: 5

Who's online

There are currently 0 users and 39 guests online.

Welcome to RUST | Gamedesign.net

Custom door/plat/button sounds

Submitted by Gard on Sun, 2004-08-08 01:30.

Quake II

Custom door/plat/button sounds by Knightmare .

I've found a quick way to add support for custom door, plat and button sounds to Q2. This will be in the next release of KMQuake2, but it can easily be added to any MOD.


Methodology

Step 1:

In g_func.c, look for this code in the function SP_func_plat:

ent->moveinfo.sound_start = gi.soundindex ("plats/pt1_strt.wav");
ent->moveinfo.sound_middle = gi.soundindex ("plats/pt1_mid.wav");
ent->moveinfo.sound_end = gi.soundindex ("plats/pt1_end.wav");

and replace it with this:

if (ent->style > 0 && ent->style < 100) // custom sounds
{
ent->moveinfo.sound_start = gi.soundindex (va("plats/pt%02i_strt.wav", ent->style));
ent->moveinfo.sound_middle = gi.soundindex (va("plats/pt%02i_mid.wav", ent->style));
ent->moveinfo.sound_end = gi.soundindex (va("plats/pt%02i_end.wav", ent->style));
}
else
{
ent->moveinfo.sound_start = gi.soundindex ("plats/pt1_strt.wav");
ent->moveinfo.sound_middle = gi.soundindex ("plats/pt1_mid.wav");
ent->moveinfo.sound_end = gi.soundindex ("plats/pt1_end.wav");
}

This change could also be added to the func_trackchange entity in Lazarus.

Step 2:

In the SP_func_button, replace the following:

if (ent->sounds != 1)
ent->moveinfo.sound_start = gi.soundindex("switches/butn2.wav");

with this:

if (ent->style > 0 && ent->style < 100) // custom sounds
ent->moveinfo.sound_start = gi.soundindex (va("switches/butn%02i.wav", ent->style));
else if (ent->sounds != 1)
ent->moveinfo.sound_start = gi.soundindex ("switches/butn2.wav");
else
ent->moveinfo.sound_start = 0;

Step 3:

In both the SP_func_door and SP_func_door_rotating, replace this:

if (ent->sounds != 1)
{
ent->moveinfo.sound_start = gi.soundindex ("doors/dr1_strt.wav");
ent->moveinfo.sound_middle = gi.soundindex ("doors/dr1_mid.wav");
ent->moveinfo.sound_end = gi.soundindex ("doors/dr1_end.wav");
}

and replace it with this:

if (ent->style > 0 && ent->style < 100) // custom sounds
{
ent->moveinfo.sound_start = gi.soundindex (va("doors/dr%02i_strt.wav", ent->style));
ent->moveinfo.sound_middle = gi.soundindex (va("doors/dr%02i_mid.wav", ent->style));
ent->moveinfo.sound_end = gi.soundindex (va("doors/dr%02i_end.wav", ent->style));
}
else if (ent->sounds != 1)
{
ent->moveinfo.sound_start = gi.soundindex ("doors/dr1_strt.wav");
ent->moveinfo.sound_middle = gi.soundindex ("doors/dr1_mid.wav");
ent->moveinfo.sound_end = gi.soundindex ("doors/dr1_end.wav");
}
else
{
ent->moveinfo.sound_start = 0;
ent->moveinfo.sound_middle = 0;
ent->moveinfo.sound_end = 0;
}

FILES

The custom filenames for doors are:

  • doors/drxx_strt.wav,
  • doors/drxx_mid.wav,
  • doors/drxx_end.wav

The custom filenames for plats are:

  • plats/ptxx_strt.wav,
  • plats/ptxx_mid.wav,
  • plats/ptxx_end.wav

The custom filenames for buttons are:

  • switches/butnxx.wav

Where xx is a 2-digit number from 01 to 99 that corresponds to the style value.


Comments

I decided to use the style key for custom sounds because many maps may have different sounds values set for doors. The default QERadiant .def file has door sound sets listed that are from Q1, and many mappers may have given their doors sounds values other than 0 and 1 (default and no sound). I didn't want to change the behavior of existing maps.

RUST | Gamedesign.net is your source for all the latest game-editing news and tutorials. If you are seeing this message, this means that you are using a browser that does not support CSS. Please upgrade your browser and enjoy your stay at RUST and if you have any questions, comments, or suggestions, please contact a site administrator.