lfnetwork.com mark read register faq members calendar

Thread: Blaster alt_fire sound (E-11 with scope mod) / need help
Thread Tools Display Modes
Post a new thread. Add a reply to this thread. Indicate all threads in this forum as read. Subscribe to this forum. RSS feed: this forum RSS feed: all forums
Old 01-21-2011, 06:02 PM   #1
Path-x
Rookie
 
Path-x's Avatar
 
Join Date: Dec 2010
Posts: 36
Blaster alt_fire sound (E-11 with scope mod) / need help

Hey,

I am making a mod where you can use scope on E-11. Basically the scope script is the same as for the sniper rifle which is: mouse1 for rapid fire and mouse two for zooming/scope and then converting alt_attack from mouse2 to mouse1.

Everything works fine I only have one minor problem that I just can't seem to fix. When you press mouse2 to start zooming it also makes an alt_fire sound. It doesn't take any energy/ammo (I scripted it so) but it still makes the sound of alt fire.

I am about to give up so if anyone did anything similar or is more expert at this please help. It would also help if anyone know where the code that sets the relation between the keys and blaster sounds is located.
Path-x is offline   you may: quote & reply,
Old 01-22-2011, 04:28 AM   #2
nizwiz
Rookie
 
nizwiz's Avatar
 
Join Date: Jul 2007
Posts: 159
My guess is line 1912 in cg_waepons.c (I don't have VS installed at the moment, so I can't try it out myself):
Code:
	// play a sound
	if (altFire)
	{
		// play a sound
		for ( c = 0 ; c < 4 ; c++ ) {
			if ( !weap->altFlashSound[c] ) {
				break;
			}
		}
		if ( c > 0 ) {
			c = rand() % c;
			if ( weap->altFlashSound[c] )
			{
				trap_S_StartSound( NULL, ent->number, CHAN_WEAPON, weap->altFlashSound[c] );
			}
		}
	}
The blaster's altFlashSound is set to sound/weapons/blaster/alt_fire.wav BTW, so you should try and override that file with silence first.
nizwiz is offline   you may: quote & reply,
Old 01-22-2011, 08:40 AM   #3
Path-x
Rookie
 
Path-x's Avatar
 
Join Date: Dec 2010
Posts: 36
Thanks for the quick reply. I tried to experiment with that a little but I couldn't fix it. I think if you mute the sound based on altFire it doesn't solve the problem. I think I should find the way to remove the sound based on BUTTON_ALT_ATTACK which is mouse2 key.

Here are some prepositions from bg_pmove.c file.

line6222
Code:
if ( pm->ps->weaponstate == WEAPON_CHARGING )
	{
		// weapon has a charge, so let us do an attack
#ifdef _DEBUG
		Com_Printf("Firing.  Charge time=%d\n", pm->cmd.serverTime - pm->ps->weaponChargeTime);
#endif

		// dumb, but since we shoot a charged weapon on button-up, we need to repress this button for now
		pm->cmd.buttons |= BUTTON_ATTACK;
		pm->ps->eFlags |= EF_FIRING;
	}
	else if ( pm->ps->weaponstate == WEAPON_CHARGING_ALT )
	{
		// weapon has a charge, so let us do an alt-attack
#ifdef _DEBUG
		Com_Printf("Firing.  Charge time=%d\n", pm->cmd.serverTime - pm->ps->weaponChargeTime);
#endif

		
                // dumb, but since we shoot a charged weapon on button-up, we need to repress this button for now
		pm->cmd.buttons |= BUTTON_ALT_ATTACK;
		pm->ps->eFlags |= (EF_FIRING|EF_ALT_FIRING);
	}
This one is basically from charged weapon section. Sniper rifle belongs to this section so the tirck might be in this. The reason I brought up this code is the comment: "// dumb, but since we shoot a charged weapon on button-up, we need to repress this button for now".

line7659
Code:
if ( pm->cmd.buttons & BUTTON_ALT_ATTACK ) 	{
		//if ( pm->ps->weapon == WP_BRYAR_PISTOL && pm->gametype != GT_SIEGE )
		if (0)
		{ //kind of a hack for now
			PM_AddEvent( EV_FIRE_WEAPON );
			addTime = weaponData[pm->ps->weapon].fireTime;
		}
		else if (pm->ps->weapon == WP_DISRUPTOR && pm->ps->zoomMode != 1)
		{
			PM_AddEvent( EV_FIRE_WEAPON );
			addTime = weaponData[pm->ps->weapon].fireTime;
		}
		else if (pm->ps->weapon == WP_BLASTER && pm->ps->zoomMode != 1)
		{
			PM_AddEvent( EV_FIRE_WEAPON );
			addTime = weaponData[pm->ps->weapon].fireTime;
		}
Another reference to alt_attack button. Only that I already set it for WP_BLASTER too.

line8229
Code:
if ( pm->ps->weapon == WP_DISRUPTOR || pm->ps->weapon == WP_BLASTER)
	{
		if ( pm->cmd.buttons & BUTTON_ATTACK && pm->ps->zoomMode == 1 && pm->ps->zoomLocked)
		{
			// converting the main fire to an alt-fire
			pm->cmd.buttons |= BUTTON_ALT_ATTACK;
			pm->ps->eFlags |= EF_ALT_FIRING;
		}
		else if ( pm->cmd.buttons & BUTTON_ALT_ATTACK && pm->ps->zoomMode == 1 && pm->ps->zoomLocked)
		{
			pm->cmd.buttons &= ~BUTTON_ALT_ATTACK;
			pm->ps->eFlags &= ~EF_ALT_FIRING;
		}
	}
This is a segment of code within the scope script that converts alt_attack from mouse button 2 to mouse button 1 once you zoomed the scope. I included WP_BLASTER too so this works fine.

Now I think the problem is that somewhere it is set for WP_BLASTER (or perhaps all the non special weapon) that when you press BUTTON_ALT_ATTACK (mouse2) it also executes the alt_fire sound. Obviously sniper rifle does no attack sound when you are pressing mouse2 but it only does the zoomin sound. So I think I should be looking for relation between the BUTTON_ALT_ATTACK and ALT_FIRE.mp3 sound rather than relation between altFire function and ALT_FIRE.mp3 sound. AltFire function is necessary for executing sound when pressing mouse1 when scope is on so I don't think I should mess with it.

Last edited by Path-x; 01-22-2011 at 08:47 AM.
Path-x is offline   you may: quote & reply,
Old 01-22-2011, 10:36 PM   #4
Tinny
 
Tinny's Avatar
 
Join Date: Apr 2002
Posts: 1,188
Any luck? Also i think that's a sweet idea, when you get the scope add-on for the blaster rifle in mots that was one of the funnest parts of the game i thought and the tenloss didn't quite feel as fun.


Redeemed!

An old school mod for jedi academy.
Tinny is offline   you may: quote & reply,
Old 01-23-2011, 07:54 AM   #5
nizwiz
Rookie
 
nizwiz's Avatar
 
Join Date: Jul 2007
Posts: 159
Have you tried overriding sound/weapons/blaster/alt_fire.mp3, yet? Just to be sure that it is really the sound that you hear. If so, that sound is only referenced once throughout the code, namely where the blaster's altFlashSound is intialized. And altFlashSound in turn is only referenced once (in the piece of code from my first reply). I don' think there's a direct binding between pressing alt_attack button and playing alt fire sound. If I were you, I'd put a breakpoint on line 1916 of cg_weapons.c and see if it triggers, then inspect the callstack (actually, if I were you, I'd be content in overriding blaster/alt_fire.mp3 - if it works).

Last edited by nizwiz; 01-23-2011 at 08:36 AM.
nizwiz is offline   you may: quote & reply,
Old 01-23-2011, 03:12 PM   #6
Path-x
Rookie
 
Path-x's Avatar
 
Join Date: Dec 2010
Posts: 36
I finally managed to fix it. I added separate CASE structure for WP_BLASTER where the sounds are defined and modified/added few lines there. Works perfectly. Thanks for the replies.

Nizwiz, I didn't try to overriding it but if you wish I can try that too?

Last edited by Path-x; 01-23-2011 at 04:51 PM.
Path-x is offline   you may: quote & reply,
Old 01-23-2011, 05:22 PM   #7
Path-x
Rookie
 
Path-x's Avatar
 
Join Date: Dec 2010
Posts: 36
Anyway the E-11 with scope is only a segment in a larger project I am trying to make. I always wanted to make a mod for Siege. I always found the current Siege a bit unattractive since all the combat is pretty much carried out by explosive weapons and area attack weapons (DEMP2, concussion launcher). Iconic weapons like E-11, DL-44 and Bowcaster are pretty much redundant.

So far I have made most of the coding to modify weapons and classes. Reducing almost all explosive/area weapons to minimum. Increasing blaster bolt speed. Detpack would now play the key role for objectives, I set a timer for it and a primitive defuse concept which is if you hit and blow the detpack it does 0 damage but if the timer goes off it does 9999 damage. Etc. Etc.

Well a huge amount of work still awaits since I want a map for it. Well my brother is pretty skilled at mapping but at this point is he say it's not worth it since so little people still play JKA. Yes it is a reasonable question I should ask my self too.
Path-x is offline   you may: quote & reply,
Old 01-24-2011, 01:53 AM   #8
nizwiz
Rookie
 
nizwiz's Avatar
 
Join Date: Jul 2007
Posts: 159
Quote:
Originally Posted by Path-x View Post
Nizwiz, I didn't try to overriding it but if you wish I can try that too?
No sweat. Since you've managed to fix it, where's the point in pursuing the matter any futher?

BTW, very neat idea, this mod of yours. Don't listen to your brother (at least in this regard).
nizwiz is offline   you may: quote & reply,
Old 01-24-2011, 02:08 AM   #9
-=*Raz0r*=-
Rookie
 
-=*Raz0r*=-'s Avatar
 
Join Date: Oct 2006
Location: Australia
Posts: 243
Also, if "so little people still play JKA", then why not make awesome mods and get more people playing it, especially if you enjoy it?
Do stick around =]
-=*Raz0r*=- is offline   you may: quote & reply,
Old 01-24-2011, 08:34 PM   #10
Path-x
Rookie
 
Path-x's Avatar
 
Join Date: Dec 2010
Posts: 36
Hehe, thanks for the encouragement guys. I guess I will continue working on it.
Path-x is offline   you may: quote & reply,
Old 04-24-2011, 03:16 PM   #11
The One n Only
Rookie
 
Join Date: Dec 2004
Posts: 22
Argh, I've had exactly the same problem a couple of time and I can't for the life of me remember how I fixed it. It's something to do with it still trying to call a function related to the alt-fire. The best advice I can give off-hand is just to search through every point where the blaster's alt-fire is mentioned, and cut out anything you don't want.
The One n Only is offline   you may: quote & reply,
Post a new thread. Add a reply to this thread. Indicate all threads in this forum as read. Subscribe to this forum. RSS feed: this forum RSS feed: all forums
Go Back   LucasForums > Network > JediKnight Series > Editing Central > JA Coding > Blaster alt_fire sound (E-11 with scope mod) / need help

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 02:40 AM.

LFNetwork, LLC ©2002-2011 - All rights reserved.
Powered by vBulletin®
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.