Fight Sounds


(Xterm1n8or) #1

Hi all :smiley:

Been looking at adding the ‘Fight’ and ‘Prepare to fight’ sounds, and came accross this in cg_main.c:

cgs.media.countFight =       trap_S_RegisterSound( "sound/osp/fight.wav", qfalse );
cgs.media.countPrepare =     trap_S_RegisterSound( "sound/osp/prepare.wav", qfalse );

And this in cg_servercmds.c:

if(cg_announcer.integer > 0) trap_S_StartLocalSound(cgs.media.countFight, CHAN_ANNOUNCER);
if(cg_announcer.integer > 0) trap_S_StartLocalSound( cgs.media.countPrepare, CHAN_ANNOUNCER );

I added this to cg_local.h:

sfxHandle_t countFight;
sfxHandle_t countPrepare;

I also added the wav files to the right dir.

The compiler complained about the ‘if(cg_announcer.integer > 0)’, so i recompiled with just:

trap_S_StartLocalSound(cgs.media.countFight, CHAN_ANNOUNCER);
trap_S_StartLocalSound( cgs.media.countPrepare, CHAN_ANNOUNCER );

To my complete surprise, this worked. ( So much so, i nearly fell off my chair when it suddenly boomed ‘FIGHT!’ )

The thing is, in my relatively short experience in programming, this has been a bit too easy. I’m wondering if the top 4 lines were commented out for a reason and whether this will mess something up somewhere along the line.
I know it works, i just wanted to know if it is right.

Many thanks :smiley:


(jaybird) #2

What did the compiler complain about?


(Xterm1n8or) #3

Hi Jaybird :smiley:

Ok, i just re-did it again with just the ‘fight’ one (as opposed to ‘prepare’), and this is what the error says:

cg_servercmds.c(272) : error C2065: 'cg_announcer' : undeclared identifier
cg_servercmds.c(272) : error C2224: left of '.integer' must have struct/union type

Just to clarify, this is when i use:

if(cg_announcer.integer > 0) trap_S_StartLocalSound(cgs.media.countFight, CHAN_ANNOUNCER);

At the moment this seems to work:

trap_S_StartLocalSound(cgs.media.countFight, CHAN_ANNOUNCER);

Hope that helps :slight_smile:


(Elite) #4

Just uncomment all the cg_announcer stuff. It is all in the proepr places, just commented out. Especially make sure in cg_local and cg_main you uncomment it.


(Xterm1n8or) #5

Thanks :smiley:

It compiled without error, not tested it yet though. Can assume that this is now CORRECT?

On a side note: It seems a bit wierd doesn’t it that all the coding for this is here ( bar from the sfxHandle bit ), the only thing missing were the wavs. Is there a reason you know of why this was omitted?

Cheers :smiley:


(Elite) #6

Not sure. Perhaps someone forgot about it. Many features are all coded in, some with bugs, some that are all working, but these are all disabled. Just enable them and test them to see if they work, and fix them if you want them to work. Maybe because it is a mod sdk they are just there for examples, idk. But go ahead and make them all work if you liek them :slight_smile:


(Xterm1n8or) #7

Hi :smiley:

Ok, just an update to say i have tried it and it all seems to work fine. :slight_smile:

I will look out for these other things, it makes life so much easier when the bulk of it is already there :stuck_out_tongue:

Thanks for the help :smiley:


(Xterm1n8or) #8

Hello :smiley:

I wantd to get this function in my menu, so that i can turn it on/off. So this is what i did:

outpost.munu:

	SUBWINDOW( 6, 66, (SUBWINDOW_WIDTH), 40, "Sounds" )
        YESNO( 8, 94, (SUBWINDOW_WIDTH)-4, 10, "Fight Sounds:", .2, 8, "cg_fightSounds", "Enable/Disable FIGHT! and PREPARE TO FIGHT! sounds" )

cg_local.h:

extern  vmCvar_t        cg_fightSounds;

cg_main.c:

vmCvar_t    cg_fightSounds;


cvarTable_t		cvarTable[] = {
	{ &cg_fightSounds, "cg_fightSounds", "1", CVAR_ARCHIVE },

I also found this cvar table in ui_main.c:

	{ NULL, "cg_fightSounds", "1", CVAR_ARCHIVE },

cg_servercmds.c:

        if(cg_fightSounds.integer > 0) trap_S_StartLocalSound( cgs.media.countFight, CHAN_ANNOUNCER );

        if(cg_fightSounds.integer > 0) trap_S_StartLocalSound( cgs.media.countPrepare, CHAN_ANNOUNCER );

When i got to the last bit and changed cg_announcer.integer to cg_fightSounds.integer, i searched for announcer just to see if i could be messing something else up.
However, it seems to me that cg_announcer and my cg_fightSounds are the same, and all i needed to do was use cg_announcer in my outpost.menu.

:?: So my question is: Are they indeed the same thing? Should i use the announcer or my fightSounds? All i want to do is to be able to turn off functions that i add to the game, i don’t want to affect anything else that the announcer might do. (Although i can’t find that it does)

Many thanks :smiley: