PDA

View Full Version : Input needed


WD_Rage
06-04-2002, 02:53 PM
One little diddy I've been working on is adding the sith saber sounds: namely, if someone uses dark side powers the sith saber sound is used; if they're light side, the normal saber sound is used.

I believe my logic is sound in this, but it still doesn't work.

I found every reference to the saber sound variables:

saberOffSound
saberOnSound

There two others but they are the spin and the hum. When the sound is set:

saberOffSound = G_SoundIndex("sound/weapons/saber/saberoffquick.wav");
saberOnSound = G_SoundIndex("sound/weapons/saber/saberon.wav");

I added an if statement:

if (ent->client->ps.fd.forceSide != FORCE_LIGHTSIDE) {
saberOffSound = G_SoundIndex("sound/weapons/saber/sithsaberoff.wav");
saberOnSound = G_SoundIndex("sound/weapons/saber/sithsaberon.wav");
} else {
saberOffSound = G_SoundIndex("sound/weapons/saber/saberoffquick.wav");
saberOnSound = G_SoundIndex("sound/weapons/saber/saberon.wav");
}

I did this at every assignment of saberOffSound and saberOnSound. Logically, this would work, but it seems that the sith saber sounds take over and are played no matter the force side (sometimes it's only the original saber sound).

Any ideas?

UniKorn
06-04-2002, 02:59 PM
I'm not a coder, at work I am, but for games I map. I think that your code only checks if the person playing is lightside or darkside. Meaning, that if you test it in multiplayer and you are darkside, you will hear all sith sounds, no matter wether the person wielding the sword is light or dark.

(just an idea)

Iceplode
06-04-2002, 03:08 PM
forceSide can be initialized to 0. FORCE_LIGHTSIDE is 1 and FORCE_DARKSIDE is 2. Check explicitly for FORCE_DARKSIDE and FORCE_LIGHTSIDE.

And don't forget to change the sounds everywhere you see the saberOffSound and saberOnSound stuff. (g_active.c, g_cmds.c, w_saber.c)

Subject452
06-04-2002, 03:10 PM
The FORCE_LIGHTSIDE is for Teamplay only, you could try this:

if (team == TEAM_BLUE && ent->client->ps.fd.forceSide == FORCE_LIGHTSIDE) {
saberOffSound = G_SoundIndex("sound/weapons/saber/saberoffquick.wav");
saberOnSound = G_SoundIndex("sound/weapons/saber/saberon.wav");
}
else { // not lightside so dark it is
saberOffSound = G_SoundIndex("sound/weapons/saber/sithsaberoff.wav");
saberOnSound = G_SoundIndex("sound/weapons/saber/sithsaberon.wav");
}

This is just from the top of my head, i can understand if this isnt the only code that must be changed. Goodluck

WD_Rage
06-04-2002, 03:11 PM
Originally posted by UniKorn
I'm not a coder, at work I am, but for games I map. I think that your code only checks if the person playing is lightside or darkside. Meaning, that if you test it in multiplayer and you are darkside, you will hear all sith sounds, no matter wether the person wielding the sword is light or dark.

(just an idea)

I understand what you are saying, and that makes perfect sense, and that is something that I will need to address once I get the first part working. However, that is not my main objective at this point in time.

I have two computers. When I test, I have one as lightside and one as darkside, and the speakers are off on the machine I am not at. So when I go to the light side computer, I turn on and off the saber. Usually the first ignition of the saber is the original sound. After I close it for the first time and ignite it again, it's the sith sound.

Xzzy
06-04-2002, 03:15 PM
that's possible, you'll notice the function that those sounds are set within is only run when the user connects to the server.

To do what you want you'll have to find the point where the client is told that an enemy is drawing or sheathing their saber and calculate which sound to play at that point.

WD_Rage
06-04-2002, 03:49 PM
Originally posted by Iceplode
forceSide can be initialized to 0. FORCE_LIGHTSIDE is 1 and FORCE_DARKSIDE is 2. Check explicitly for FORCE_DARKSIDE and FORCE_LIGHTSIDE.

And don't forget to change the sounds everywhere you see the saberOffSound and saberOnSound stuff. (g_active.c, g_cmds.c, w_saber.c)

I've already done that. I chose to check only for != FORCE_LIGHTSIDE simply because only darkside would get the sith sound. Anyone other than darkside gets the original sound.

WD_Rage
06-04-2002, 03:52 PM
Originally posted by Subject452
The FORCE_LIGHTSIDE is for Teamplay only, you could try this:

if (team == TEAM_BLUE && ent->client->ps.fd.forceSide == FORCE_LIGHTSIDE) {
saberOffSound = G_SoundIndex("sound/weapons/saber/saberoffquick.wav");
saberOnSound = G_SoundIndex("sound/weapons/saber/saberon.wav");
}
else { // not lightside so dark it is
saberOffSound = G_SoundIndex("sound/weapons/saber/sithsaberoff.wav");
saberOnSound = G_SoundIndex("sound/weapons/saber/sithsaberon.wav");
}

This is just from the top of my head, i can understand if this isnt the only code that must be changed. Goodluck

Well then I should be trying to find how else to check if someone was light or dark sided. However, I could use that for team games.

Thanks for the insight everyone! You've been extremely helpful.

Iceplode
06-04-2002, 04:01 PM
ok. I'll clarify what my original point was. I was just saying
that != FORCE_LIGHTSIDE does not mean == FORCE_DARKSIDE, necessarily. I'm sure they try to enforce the values to not remain at the value of 0.

Originally posted by WD_Rage


I've already done that. I chose to check only for != FORCE_LIGHTSIDE simply because only darkside would get the sith sound. Anyone other than darkside gets the original sound.

Xzzy
06-04-2002, 04:45 PM
> != FORCE_LIGHTSIDE does not mean == FORCE_DARKSIDE,

That's probably precisely it.

forceSide apparently has three possible values: 0, 1, and 2.

I don't know under what conditions the value will remain zero, it just appears to be a default value, but apparently it can stay live in-game. It's also possible that the server doesn't keep track of who's on what side beyond initial login so the value spends most of it's time at zero.

in other words you need three if statements:

if(light_side) {
lightnoise;
} elseif(dark_side) {
darknoise;
} else {
defaultnoise;
}

Subject452
06-04-2002, 05:01 PM
Anybody even read my above post???????
anyway 0 must be spectator

Iceplode
06-04-2002, 05:49 PM
Yes, I read your post.

Look in WP_InitForcePowers (which is called by either Cmd_ForceChanged_f or WP_HasForcePowers which in turn is called by ClientSpawn). You see if g_forceBasedTeams is not set, then BG_LegalizedForcePowers gets called with a teamForce value of 0. BG_LegalizedForcePowers then takes the forcepowers passed in (originally from the userinfo's forcepowers) and uses the force side in there to set the initial value. If the teamForce was set, then it tries to enforce the whole blue/light red/dark thing. Otherwise it just sticks with what was in the userinfo's forcepowers. (userinfo retrieved by trap_GetUserInfo)

In BG_LegalizedForcePowers, if the value for the force side that was passed in wasn't valid, the programmer chose to automatically place the person on the dark side.

As for why the WD_Rage could see inconsistencies even after combing through the code for the sounds, I'd prefer seeing results of his debugging, first. Otherwise, I can only make guesses.