lfnetwork.com mark read register faq members calendar

Thread: [Fix] 2handed Lightning
Thread Tools Display Modes
Post a new thread. Indicate all threads in this forum as read. Subscribe to this forum. RSS feed: this forum RSS feed: all forums
Prev Previous Post   Next Post Next
Old 03-31-2010, 03:31 PM   #1
Kimberly
Rookie
 
Join Date: Mar 2010
Posts: 11
[Fix] 2handed Lightning

I just want to share this fix you guys

----------------------------------------
The following code is made by the author
----------------------------------------

In w_force.c
(that part handles the damage)

Search "jackin' 'em up" and replace the conditions with this code:
Code:
/*
 *
 * Added by Kimmy
 * Conditions for 2handed lightning
 *
 */
if ( self->client->ps.weapon == WP_NONE
|| self->client->ps.weapon == WP_MELEE
|| self->client->ps.weapon == WP_SABER 
&& self->client->ps.saberHolstered
&& self->client->ps.fd.forcePowerLevel[FP_LIGHTNING] > FORCE_LEVEL_2 )
				{//2-handed lightning
					//jackin' 'em up, Palpatine-style
					dmg *= 2;
				}

In cg_players.c
(the origin and such stuff)

Search "doing the electrocuting"

And add this part

Code:
/*
 * Added by Kimmy
 * 2handed lightning should work now
 *
 */

		vec3_t axis[3];
		vec3_t tAng, fAng, fxDir;
		vec3_t efOrgL; //origin left hand
		vec3_t efOrgR; //origin right hand

		VectorSet( tAng, cent->turAngles[PITCH], cent->turAngles[YAW], cent->turAngles[ROLL] );

		VectorSet( fAng, cent->pe.torso.pitchAngle, cent->pe.torso.yawAngle, 0 );

		AngleVectors( fAng, fxDir, NULL, NULL );

		if ( cent->currentState.torsoAnim == BOTH_FORCE_2HANDEDLIGHTNING_HOLD )
		{
			mdxaBone_t 	rHandMatrix;
			trap_G2API_GetBoltMatrix(cent->ghoul2, 0, ci->bolt_rhand, &rHandMatrix, cent->turAngles, cent->lerpOrigin, cg.time, cgs.gameModels, cent->modelScale);
			efOrgR[0] = rHandMatrix.matrix[0][3]; //right hand matrix -> efOrgR
			efOrgR[1] = rHandMatrix.matrix[1][3];
			efOrgR[2] = rHandMatrix.matrix[2][3];	
			
			if (!gotLHandMatrix)
			{
				trap_G2API_GetBoltMatrix(cent->ghoul2, 0, ci->bolt_lhand, &lHandMatrix, cent->turAngles, cent->lerpOrigin, cg.time, cgs.gameModels, cent->modelScale);
				gotLHandMatrix = qtrue;
			}
			efOrgL[0] = lHandMatrix.matrix[0][3]; //left hand matrix -> efOrgL
			efOrgL[1] = lHandMatrix.matrix[1][3];
			efOrgL[2] = lHandMatrix.matrix[2][3];
		}
		else
		{
			if (!gotLHandMatrix)
			{
				trap_G2API_GetBoltMatrix(cent->ghoul2, 0, ci->bolt_lhand, &lHandMatrix, cent->turAngles, cent->lerpOrigin, cg.time, cgs.gameModels, cent->modelScale);
				gotLHandMatrix = qtrue;
			}
			efOrgL[0] = lHandMatrix.matrix[0][3]; //just for the simple lightning from the left hand
			efOrgL[1] = lHandMatrix.matrix[1][3];
			efOrgL[2] = lHandMatrix.matrix[2][3];
		}

		AnglesToAxis( fAng, axis );

/* 
 * Added by Kimmy
 * This should fix playing the single hand effect at two places
 *
 */
		if ( cent->currentState.activeForcePass > FORCE_LEVEL_2 )

		{//arc
			//trap_FX_PlayEffectID( cgs.effects.forceLightningWide, efOrg, fxDir );
			//trap_FX_PlayEntityEffectID(cgs.effects.forceLightningWide, efOrg, axis, cent->boltInfo, cent->currentState.number, -1, -1);
			if ( pm->ps->weapon == WP_NONE || pm->ps->weapon == WP_MELEE || ( pm->ps->weapon == WP_SABER && pm->ps->saberHolstered ) )
			{
				trap_FX_PlayEntityEffectID(cgs.effects.forceLightningWide, efOrgR, axis, -1, -1, -1, -1); // thats the solution - we need to play the fx from two origins
			}

			trap_FX_PlayEntityEffectID(cgs.effects.forceLightningWide, efOrgL, axis, -1, -1, -1, -1);
		}
		else
		{//line
			//trap_FX_PlayEffectID( cgs.effects.forceLightning, efOrg, fxDir );
			//trap_FX_PlayEntityEffectID(cgs.effects.forceLightning, efOrg, axis, cent->boltInfo, cent->currentState.number, -1, -1);
			trap_FX_PlayEntityEffectID(cgs.effects.forceLightning, efOrgL, axis, -1, -1, -1, -1);
		}

		/*
		if (cent->bolt4 < cg.time)
		{
			cent->bolt4 = cg.time + 100;
			trap_S_StartSound(NULL, cent->currentState.number, CHAN_AUTO, trap_S_RegisterSound("sound/weapons/force/lightning.wav") );
		}
		*/
	}
The end is "fullbody push effect"



In bg_pmove.c
(animation)


Between "gripping" and "draining"

Code:
/* 
 * Added by Kimmy
 * improved 2handed animation fix
 *
 */

			else if ( (pm->ps->fd.forcePowersActive&(1<<FP_LIGHTNING)) )
			{//lightning
				if ( pm->ps->weapon == WP_MELEE ||
					 pm->ps->weapon == WP_NONE ||
					 pm->ps->weapon == WP_SABER && pm->ps->saberHolstered )
				{//2-handed lightning
					desiredAnim = BOTH_FORCE_2HANDEDLIGHTNING_HOLD;
				}
				else
				{
					desiredAnim = BOTH_FORCELIGHTNING_HOLD;
				}
			}



If you want you can give me credit

-Kimberly aka Nomi Halcyon-
Kimberly is offline   you may: quote & reply,
Post a new 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 > [Fix] 2handed Lightning

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 03:08 PM.

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