Jump to content

Home

[Fix] 2handed Lightning


Kimberly

Recommended Posts

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:

/*
*
* 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

 

/*
* 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"

 

/* 
* 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-

Link to comment
Share on other sites

I tried to add new force powers, but the way the bases are defined in q_shared.h makes it hard to expand. I replaced force team heal and energize and integrated them into force heal and force drain when at full health. Ooh, read up on coremod, i was trying to implement some of the same stuff with lua script.

Link to comment
Share on other sites

well i thought so ;)

 

but you can add new force level and implent so similar forces

 

Lightning Level 1

-> Force Bolt

 

Lightning Level 2

-> Force Shock

 

Lightning Level 3

-> Force Lightning

 

Lightning Level 4

-> Force Lightningstorm

 

Lightning Level 5

-> Force Lightningbomb

 

:p

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...