diff options
Diffstat (limited to 'src/cgame')
-rw-r--r-- | src/cgame/cg_local.h | 1 | ||||
-rw-r--r-- | src/cgame/cg_main.c | 1 | ||||
-rw-r--r-- | src/cgame/cg_players.c | 51 | ||||
-rw-r--r-- | src/cgame/cg_weapons.c | 18 |
4 files changed, 36 insertions, 35 deletions
diff --git a/src/cgame/cg_local.h b/src/cgame/cg_local.h index 0ddf6574..3f95b9f5 100644 --- a/src/cgame/cg_local.h +++ b/src/cgame/cg_local.h @@ -942,6 +942,7 @@ typedef struct qhandle_t larmourTorsoSkin; qhandle_t jetpackModel; + qhandle_t jetpackFlashModel; } cgMedia_t; diff --git a/src/cgame/cg_main.c b/src/cgame/cg_main.c index f41de737..28d7120e 100644 --- a/src/cgame/cg_main.c +++ b/src/cgame/cg_main.c @@ -887,6 +887,7 @@ static void CG_RegisterClients( void ) cgs.media.larmourTorsoSkin = trap_R_RegisterSkin( "models/players/sarge/upper_red.skin" ); cgs.media.jetpackModel = trap_R_RegisterModel( "models/players/human_base/jetpack.md3" ); + cgs.media.jetpackFlashModel = trap_R_RegisterModel( "models/players/human_base/jetpack_flash.md3" ); cg.charModelFraction = 1.0f; trap_UpdateScreen( ); diff --git a/src/cgame/cg_players.c b/src/cgame/cg_players.c index 4bfd4969..276b384a 100644 --- a/src/cgame/cg_players.c +++ b/src/cgame/cg_players.c @@ -1501,19 +1501,19 @@ static void CG_PlayerNonSegAngles( centity_t *cent, vec3_t srcAngles, vec3_t non CG_PlayerUpgrade =============== */ -static void CG_PlayerUpgrades( centity_t *cent, refEntity_t *legs, - vec3_t torsoAxis[ 3 ], qhandle_t legsModel ) +static void CG_PlayerUpgrades( centity_t *cent, refEntity_t *torso ) { int held, active; vec3_t acc = { 0.0f, 0.0f, 10.0f }; vec3_t vel = { 0.0f, 0.0f, 0.0f }; vec3_t origin; - vec3_t back; vec3_t forward = { 1.0f, 0.0f, 0.0f }; vec3_t right = { 0.0f, 1.0f, 0.0f }; vec3_t pvel; + vec3_t angles; int addTime; refEntity_t jetpack; + refEntity_t flash; held = cent->currentState.modelindex; active = cent->currentState.modelindex2; @@ -1521,17 +1521,17 @@ static void CG_PlayerUpgrades( centity_t *cent, refEntity_t *legs, if( held & ( 1 << UP_JETPACK ) ) { memset( &jetpack, 0, sizeof( jetpack ) ); + VectorCopy( torso->lightingOrigin, jetpack.lightingOrigin ); + jetpack.shadowPlane = torso->shadowPlane; + jetpack.renderfx = torso->renderfx; jetpack.hModel = cgs.media.jetpackModel; - AxisCopy( torsoAxis, jetpack.axis ); - VectorCopy( cent->lerpOrigin, jetpack.lightingOrigin ); + //identity matrix + AxisCopy( axisDefault, jetpack.axis ); //FIXME: change to tag_back when it exists - CG_PositionRotatedEntityOnTag( &jetpack, legs, legsModel, "tag_torso" ); - - jetpack.shadowPlane = legs->shadowPlane; - jetpack.renderfx = legs->renderfx; + CG_PositionRotatedEntityOnTag( &jetpack, torso, torso->hModel, "tag_head" ); trap_R_AddRefEntityToScene( &jetpack ); @@ -1559,16 +1559,26 @@ static void CG_PlayerUpgrades( centity_t *cent, refEntity_t *legs, vel[ 2 ] = -50.0f; } + memset( &flash, 0, sizeof( flash ) ); + VectorCopy( torso->lightingOrigin, flash.lightingOrigin ); + flash.shadowPlane = torso->shadowPlane; + flash.renderfx = torso->renderfx; + + flash.hModel = cgs.media.jetpackFlashModel; + if( !flash.hModel ) + return; + + angles[ YAW ] = 0; + angles[ PITCH ] = 0; + angles[ ROLL ] = 0; + AnglesToAxis( angles, flash.axis ); + + CG_PositionRotatedEntityOnTag( &flash, &jetpack, jetpack.hModel, "tag_flash" ); + trap_R_AddRefEntityToScene( &flash ); + if( cent->jetTime < cg.time ) { - VectorCopy( cent->lerpOrigin, origin ); - AngleVectors( cent->lerpAngles, back, NULL, NULL ); - VectorInverse( back ); - back[ 2 ] = 0.0f; - VectorNormalize( back ); - - VectorMA( origin, 10.0f, back, origin ); - origin[ 2 ] += 10.0f; + VectorCopy( flash.origin, origin ); VectorScale( cent->currentState.pos.trDelta, 0.75f, pvel ); VectorAdd( vel, pvel, vel ); @@ -1940,7 +1950,7 @@ void CG_Player( centity_t *cent ) entityState_t *es = ¢->currentState; int class = ( es->powerups >> 8 ) & 0xFF; float scale; - vec3_t tempAxis[ 3 ], tempAxis2[ 3 ], torsoAxis[ 3 ]; + vec3_t tempAxis[ 3 ], tempAxis2[ 3 ]; vec3_t angles; int held = es->modelindex; pTeam_t team = es->powerups & 0xFF; @@ -1993,9 +2003,6 @@ void CG_Player( centity_t *cent ) else CG_PlayerNonSegAngles( cent, angles, legs.axis ); - //for CG_PlayerUpgrades - AxisCopy( torso.axis, torsoAxis ); - //rotate the legs axis to back to the wall if( es->eFlags & EF_WALLCLIMB && BG_rotateAxis( es->angles2, legs.axis, tempAxis, qfalse, es->eFlags & EF_WALLCLIMBCEILING ) ) @@ -2146,7 +2153,7 @@ void CG_Player( centity_t *cent ) if( team == PTE_HUMANS ) CG_AddPlayerWeapon( &torso, NULL, cent ); - CG_PlayerUpgrades( cent, &legs, torsoAxis, ci->legsModel ); + CG_PlayerUpgrades( cent, &torso ); } /* diff --git a/src/cgame/cg_weapons.c b/src/cgame/cg_weapons.c index e5b5fc9d..a8e173b4 100644 --- a/src/cgame/cg_weapons.c +++ b/src/cgame/cg_weapons.c @@ -789,7 +789,7 @@ static void CG_PoisonCloud( centity_t *cent, int firstPoisonTime ) CG_FlameTrail =============== */ -static void CG_FlameTrail( centity_t *cent ) +static void CG_FlameTrail( centity_t *cent, vec3_t origin ) { vec3_t forward, right, up; vec3_t muzzlePoint; @@ -803,29 +803,21 @@ static void CG_FlameTrail( centity_t *cent ) if( cg.time < cent->flamerTime ) return; + VectorCopy( origin, muzzlePoint ); + if( cent->currentState.clientNum == cg.predictedPlayerState.clientNum && !cg.renderingThirdPerson ) { AngleVectors( cg.refdefViewAngles, forward, right, up ); - VectorCopy( cg.refdef.vieworg, muzzlePoint ); VectorScale( cg.predictedPlayerState.velocity, FLAMER_LAG, pVelocity ); } else { AngleVectors( cent->lerpAngles, forward, right, up ); - VectorCopy( cent->lerpOrigin, muzzlePoint ); - - //FIXME: this is gonna look weird when crouching - muzzlePoint[ 2 ] += DEFAULT_VIEWHEIGHT; VectorScale( cent->currentState.pos.trDelta, FLAMER_LAG, pVelocity ); } VectorMA( pVelocity, FLAMER_SPEED, forward, velocity ); - //FIXME: tweak these numbers when (if?) the flamer model is done - VectorMA( muzzlePoint, 24.0f, forward, muzzlePoint ); - VectorMA( muzzlePoint, 6.0f, right, muzzlePoint ); - VectorMA( muzzlePoint, -6.0f, up, muzzlePoint ); - CG_LaunchSprite( muzzlePoint, velocity, vec3_origin, 0.0f, 0.1f, 4.0f, 40.0f, 255.0f, 255.0f, rand( ) % 360, cg.time, cg.time, FLAMER_LIFETIME, @@ -1030,7 +1022,7 @@ void CG_AddPlayerWeapon( refEntity_t *parent, playerState_t *ps, centity_t *cent // add lightning bolt CG_LightningBolt( nonPredictedCent, flash.origin ); - CG_FlameTrail( nonPredictedCent ); + CG_FlameTrail( nonPredictedCent, flash.origin ); // make a dlight for the flash if( weapon->flashDlightColor[ 0 ] || weapon->flashDlightColor[ 1 ] || weapon->flashDlightColor[ 2 ] ) @@ -1089,7 +1081,7 @@ void CG_AddViewWeapon( playerState_t *ps ) VectorCopy( cg.refdef.vieworg, origin ); VectorMA( origin, -8, cg.refdef.viewaxis[ 2 ], origin ); CG_LightningBolt( &cg_entities[ ps->clientNum ], origin ); - CG_FlameTrail( &cg_entities[ ps->clientNum ] ); + CG_FlameTrail( &cg_entities[ ps->clientNum ], cg.refdef.vieworg ); } return; |