Render Special Effects on hand/weapon when force power is activated for protection etc

This commit is contained in:
Simon 2023-03-27 21:37:49 +01:00
parent 50db9039df
commit 3b5121e349
4 changed files with 23 additions and 15 deletions

View file

@ -831,7 +831,7 @@ void CG_AddGhoul2Mark(int type, float size, vec3_t hitloc, vec3_t hitdirection,
int entnum, vec3_t entposition, float entangle, CGhoul2Info_v &ghoul2, vec3_t modelScale, int lifeTime = 0, int firstModel = 0, vec3_t uaxis = 0);
void CG_Player( centity_t *cent );
void CG_ResetPlayerEntity( centity_t *cent );
void CG_AddRefEntityWithPowerups( refEntity_t *ent, int powerups, centity_t *cent );
void CG_AddRefEntityWithPowerups( refEntity_t *ent, int powerups, centity_t *cent, bool forceShownInFirstPerson = false );
void CG_GetTagWorldPosition( refEntity_t *model, char *tag, vec3_t pos, vec3_t axis[3] );
//

View file

@ -4607,7 +4607,7 @@ CG_AddRefEntityWithPowerups
Adds a piece with modifications or duplications for powerups
===============
*/
void CG_AddRefEntityWithPowerups( refEntity_t *ent, int powerups, centity_t *cent )
void CG_AddRefEntityWithPowerups( refEntity_t *ent, int powerups, centity_t *cent, bool forceShownInFirstPerson )
{
if ( !cent )
{
@ -4630,7 +4630,9 @@ void CG_AddRefEntityWithPowerups( refEntity_t *ent, int powerups, centity_t *cen
}
}
bool player1stPersonSaber = CG_getPlayer1stPersonSaber(cent);
if (CG_getPlayer1stPersonSaber(cent) && !forceShownInFirstPerson) {
ent->renderfx = RF_THIRD_PERSON;
}
// if ( gent->client->ps.powerups[PW_WEAPON_OVERCHARGE] > 0 )
// {
@ -4638,10 +4640,6 @@ void CG_AddRefEntityWithPowerups( refEntity_t *ent, int powerups, centity_t *cen
// cgi_S_AddLoopingSound( 0, cent->lerpOrigin, vec3_origin, cgs.media.overchargeLoopSound );
// }
if (player1stPersonSaber) {
ent->renderfx = RF_THIRD_PERSON;
}
//get the dude's color choice in
ent->shaderRGBA[0] = gent->client->renderInfo.customRGBA[0];
ent->shaderRGBA[1] = gent->client->renderInfo.customRGBA[1];
@ -6119,8 +6117,8 @@ Ghoul2 Insert Start
gi.G2API_GiveMeVectorFromMatrix(boltMatrix, NEGATIVE_Y, axis_[1]);//right
gi.G2API_GiveMeVectorFromMatrix(boltMatrix, POSITIVE_Z, axis_[2]);//up
if (!cent->gent->client->ps.saberInFlight &&
CG_getPlayer1stPersonSaber(cent) &&
if (CG_getPlayer1stPersonSaber(cent) &&
(!cent->gent->client->ps.saberInFlight || saberNum == 1) &&
!in_misccamera &&
!in_camera &&
cent->gent->client->ps.saberLockEnemy == ENTITYNUM_NONE)
@ -8412,7 +8410,7 @@ Ghoul2 Insert End
{
CG_AddRefEntityWithPowerups( &gun,
(cent->currentState.powerups & ((1<<PW_CLOAKED)|(1<<PW_BATTLESUIT)) ),
cent );
cent, true );
}
//
@ -8508,6 +8506,7 @@ Ghoul2 Insert End
{
numSabers = 2;
}
for ( int saberNum = 0; saberNum < numSabers; saberNum++ )
{
if (saberNum == 0 && cent->currentState.saberInFlight)
@ -8542,7 +8541,7 @@ Ghoul2 Insert End
VectorCopy(axis[0], hiltEnt.axis[2]);
VectorCopy(hiltEnt.origin, hiltEnt.oldorigin);
cgi_R_AddRefEntityToScene(&hiltEnt);
CG_AddRefEntityWithPowerups(&hiltEnt, cent->currentState.powerups, cent, true);
}
}

View file

@ -2385,7 +2385,15 @@ void CG_DrawActiveFrame( int serverTime, stereoFrame_t stereoView ) {
VectorScale( handEnt.axis[i], (vr->right_handed || i != 1) ? 1.0f : -1.0f, handEnt.axis[i] );
}
centity_t *cent = &cg_entities[cg.snap->ps.clientNum];
if (!cent)
{
cgi_R_AddRefEntityToScene(&handEnt);
}
else
{
CG_AddRefEntityWithPowerups(&handEnt, cent->currentState.powerups, cent, true);
}
if (cg.snap->ps.weapon == WP_NONE)
{
@ -2402,7 +2410,8 @@ void CG_DrawActiveFrame( int serverTime, stereoFrame_t stereoView ) {
VectorScale( handEnt.axis[i], (!vr->right_handed || i != 1) ? 1.0f : -1.0f, handEnt.axis[i] );
}
cgi_R_AddRefEntityToScene(&handEnt);
//cgi_R_AddRefEntityToScene(&handEnt);
CG_AddRefEntityWithPowerups(&handEnt, cent->currentState.powerups, cent, true);
}
}
}

View file

@ -1359,8 +1359,8 @@ void CG_AddViewWeapon( playerState_t *ps )
}
//---------
// CG_AddRefEntityWithPowerups( &gun, cent->currentState.powerups, cent->gent );
cgi_R_AddRefEntityToScene( &gun );
CG_AddRefEntityWithPowerups( &gun, cent->currentState.powerups, cent, true );
// cgi_R_AddRefEntityToScene( &gun );
/* if ( ps->weapon == WP_STUN_BATON )
{