diff options
-rw-r--r-- | src/cgame/cg_buildable.c | 72 | ||||
-rw-r--r-- | src/cgame/cg_ents.c | 3 | ||||
-rw-r--r-- | src/cgame/cg_view.c | 11 | ||||
-rw-r--r-- | src/game/g_active.c | 2 | ||||
-rw-r--r-- | src/game/g_buildable.c | 2 | ||||
-rw-r--r-- | src/game/g_client.c | 4 | ||||
-rw-r--r-- | src/game/g_cmds.c | 27 | ||||
-rw-r--r-- | src/game/g_local.h | 2 | ||||
-rw-r--r-- | src/game/tremulous.h | 4 |
9 files changed, 80 insertions, 47 deletions
diff --git a/src/cgame/cg_buildable.c b/src/cgame/cg_buildable.c index f44df8e8..dd008dee 100644 --- a/src/cgame/cg_buildable.c +++ b/src/cgame/cg_buildable.c @@ -609,7 +609,7 @@ static void CG_RunBuildableLerpFrame( centity_t *cent ) else lf->frame = anim->firstFrame + f; - if ( cg.time > lf->frameTime ) + if( cg.time > lf->frameTime ) { lf->frameTime = cg.time; if( cg_debugAnim.integer ) @@ -624,7 +624,7 @@ static void CG_RunBuildableLerpFrame( centity_t *cent ) lf->oldFrameTime = cg.time; // calculate current lerp value - if ( lf->frameTime == lf->oldFrameTime ) + if( lf->frameTime == lf->oldFrameTime ) lf->backlerp = 0; else lf->backlerp = 1.0 - (float)( cg.time - lf->oldFrameTime ) / ( lf->frameTime - lf->oldFrameTime ); @@ -642,20 +642,47 @@ static void CG_BuildableAnimation( centity_t *cent, int *old, int *now, float *b //if no animation is set default to idle anim if( cent->buildableAnim == BANIM_NONE ) cent->buildableAnim = es->torsoAnim; - - if( ( cent->oldBuildableAnim ^ es->legsAnim ) & ANIM_TOGGLEBIT ) + + //display the first frame of the construction anim if not yet spawned + if( !( es->generic1 & B_SPAWNED_TOGGLEBIT ) ) { - if( cent->buildableAnim == es->torsoAnim || es->legsAnim & ANIM_FORCEBIT ) - cent->buildableAnim = cent->oldBuildableAnim = es->legsAnim; - else - cent->buildableAnim = cent->oldBuildableAnim = es->torsoAnim; + animation_t *anim = &cg_buildables[ es->modelindex ].animations[ BANIM_CONSTRUCT1 ]; + + //so that when animation starts for real it has sensible numbers + cent->lerpFrame.oldFrameTime = + cent->lerpFrame.frameTime = + cent->lerpFrame.animationTime = + cg.time; + + *old = cent->lerpFrame.oldFrame = anim->firstFrame; + *now = cent->lerpFrame.frame = anim->firstFrame; + *backLerp = cent->lerpFrame.backlerp = 0.0f; + + //ensure that an animation is triggered once the buildable has spawned + cent->oldBuildableAnim = BANIM_NONE; } - - CG_RunBuildableLerpFrame( cent ); + else + { + if( ( cent->oldBuildableAnim ^ es->legsAnim ) & ANIM_TOGGLEBIT ) + { + if( cg_debugAnim.integer ) + CG_Printf( "%d->%d l:%d t:%d %s(%d)\n", + cent->oldBuildableAnim, cent->buildableAnim, + es->legsAnim, es->torsoAnim, + BG_FindHumanNameForBuildable( es->modelindex ), es->number ); - *old = cent->lerpFrame.oldFrame; - *now = cent->lerpFrame.frame; - *backLerp = cent->lerpFrame.backlerp; + if( cent->buildableAnim == es->torsoAnim || es->legsAnim & ANIM_FORCEBIT ) + cent->buildableAnim = cent->oldBuildableAnim = es->legsAnim; + else + cent->buildableAnim = cent->oldBuildableAnim = es->torsoAnim; + } + + CG_RunBuildableLerpFrame( cent ); + + *old = cent->lerpFrame.oldFrame; + *now = cent->lerpFrame.frame; + *backLerp = cent->lerpFrame.backlerp; + } } #define TRACE_DEPTH 128.0f @@ -957,21 +984,10 @@ void CG_Buildable( centity_t *cent ) ent.nonNormalizedAxes = qfalse; - if( team == BIT_ALIENS ) - { - if( es->generic1 & B_SPAWNED_TOGGLEBIT ) - { - //run animations - CG_BuildableAnimation( cent, &ent.oldframe, &ent.frame, &ent.backlerp ); - } - } - else if( team == BIT_HUMANS ) - { - if( !( es->generic1 & B_SPAWNED_TOGGLEBIT ) ) - ent.customShader = cgs.media.humanSpawningShader; - else - CG_BuildableAnimation( cent, &ent.oldframe, &ent.frame, &ent.backlerp ); - } + if( team == BIT_HUMANS && !( es->generic1 & B_SPAWNED_TOGGLEBIT ) ) + ent.customShader = cgs.media.humanSpawningShader; + + CG_BuildableAnimation( cent, &ent.oldframe, &ent.frame, &ent.backlerp ); // add to refresh list trap_R_AddRefEntityToScene( &ent ); diff --git a/src/cgame/cg_ents.c b/src/cgame/cg_ents.c index 1ae81676..b56a1a40 100644 --- a/src/cgame/cg_ents.c +++ b/src/cgame/cg_ents.c @@ -879,9 +879,6 @@ static void CG_CEntityPVSEnter( centity_t *cent ) cent->buildablePS = NULL; cent->entityPS = NULL; - - //make sure entities entering the PVS don't get stale animation data - memset( ¢->lerpFrame, 0, sizeof( lerpFrame_t ) ); } diff --git a/src/cgame/cg_view.c b/src/cgame/cg_view.c index 149188a5..c3e13457 100644 --- a/src/cgame/cg_view.c +++ b/src/cgame/cg_view.c @@ -462,17 +462,20 @@ static void CG_OffsetFirstPersonView( void ) else bob2 = BG_FindBobForClass( cg.predictedPlayerState.stats[ STAT_PCLASS ] ); + +#define BMOFO_FEEDBACK 10.0f + //give a charging player some feedback - if( cg.predictedPlayerState.weapon == WP_BIGMOFO ) + if( ps->weapon == WP_BIGMOFO ) { - if( cg.predictedPlayerState.stats[ STAT_MISC ] > 0 ) + if( ps->stats[ STAT_MISC ] > 0 ) { - float fraction = (float)( cg.time - cg.weapon2Time ) / (float)BMOFO_CHARGE_TIME; + float fraction = (float)ps->stats[ STAT_MISC ] / (float)BMOFO_CHARGE_TIME; if( fraction > 1.0f ) fraction = 1.0f; - bob2 *= ( 1.0f + fraction * 6.0f ); + bob2 *= ( 1.0f + fraction * BMOFO_FEEDBACK ); } } diff --git a/src/game/g_active.c b/src/game/g_active.c index 3cc01607..1ce30162 100644 --- a/src/game/g_active.c +++ b/src/game/g_active.c @@ -500,7 +500,7 @@ void ClientTimerActions( gentity_t *ent, int msec ) { client->charging = qfalse; //should already be off, just making sure - client->ps.stats[ STAT_MISC ] += 100; + client->ps.stats[ STAT_MISC ] += (int)( 100 * (float)BMOFO_CHARGE_CHARGE_RATIO ); if( client->ps.stats[ STAT_MISC ] > BMOFO_CHARGE_TIME ) client->ps.stats[ STAT_MISC ] = BMOFO_CHARGE_TIME; diff --git a/src/game/g_buildable.c b/src/game/g_buildable.c index 75284a09..c5478aff 100644 --- a/src/game/g_buildable.c +++ b/src/game/g_buildable.c @@ -470,7 +470,7 @@ void ASpawn_Think( gentity_t *self ) VectorSet( maxs, MAX_ALIEN_BBOX, MAX_ALIEN_BBOX, MAX_ALIEN_BBOX ); VectorCopy( self->s.origin, origin ); - displacement = ( self->r.maxs[ 2 ] + MAX_ALIEN_BBOX ) * M_ROOT3 + 1.0f; + displacement = ( self->r.maxs[ 2 ] + MAX_ALIEN_BBOX ) * M_ROOT3; VectorMA( origin, displacement, self->s.origin2, origin ); //only suicide if at rest diff --git a/src/game/g_client.c b/src/game/g_client.c index 688b730e..29b94512 100644 --- a/src/game/g_client.c +++ b/src/game/g_client.c @@ -303,7 +303,7 @@ gentity_t *SelectAlienSpawnPoint( void ) continue; VectorCopy( spot->s.origin, origin ); - displacement = ( spot->r.maxs[ 2 ] + MAX_ALIEN_BBOX ) * M_ROOT3 + 1.0f; + displacement = ( spot->r.maxs[ 2 ] + MAX_ALIEN_BBOX ) * M_ROOT3; VectorMA( origin, displacement, spot->s.origin2, origin ); trap_Trace( &tr, origin, mins, maxs, origin, spot->s.number, MASK_SHOT ); @@ -466,7 +466,7 @@ gentity_t *SelectTremulousSpawnPoint( int team, vec3_t origin, vec3_t angles ) BG_FindBBoxForBuildable( BA_A_SPAWN, spawnMins, spawnMaxs ); //TA: really a *safe* extreme upper limit - displacement = ( spawnMaxs[ 2 ] + MAX_ALIEN_BBOX + 1.0f ) * M_ROOT3; + displacement = ( spawnMaxs[ 2 ] + MAX_ALIEN_BBOX ) * M_ROOT3; VectorMA( origin, displacement, spot->s.origin2, origin ); } else if( team == PTE_HUMANS ) diff --git a/src/game/g_cmds.c b/src/game/g_cmds.c index 2fb5febd..3039b1ee 100644 --- a/src/game/g_cmds.c +++ b/src/game/g_cmds.c @@ -919,6 +919,7 @@ void Cmd_SetViewpos_f( gentity_t *ent ) TeleportPlayer( ent, origin, angles ); } +#define EVOLVE_TRACE_HEIGHT 128.0f /* ================= @@ -942,6 +943,7 @@ void Cmd_Class_f( gentity_t *ent ) int numLevels; vec3_t fromMins, fromMaxs, toMins, toMaxs; + vec3_t temp; clientNum = ent->client - level.clients; trap_Argv( 1, s, sizeof( s ) ); @@ -978,7 +980,8 @@ void Cmd_Class_f( gentity_t *ent ) return; } - numLevels = BG_ClassCanEvolveFromTo( ent->client->ps.stats[ STAT_PCLASS ], ent->client->pers.classSelection, + numLevels = BG_ClassCanEvolveFromTo( ent->client->ps.stats[ STAT_PCLASS ], + ent->client->pers.classSelection, (short)ent->client->ps.persistant[ PERS_CREDIT ], 0 ); BG_FindBBoxForClass( ent->client->ps.stats[ STAT_PCLASS ], @@ -989,11 +992,20 @@ void Cmd_Class_f( gentity_t *ent ) VectorCopy( ent->s.pos.trBase, infestOrigin ); infestOrigin[ 2 ] += ( fabs( toMins[ 2 ] ) - fabs( fromMins[ 2 ] ) ) + 1; + VectorCopy( infestOrigin, temp ); + temp[ 2 ] += EVOLVE_TRACE_HEIGHT; - trap_Trace( &tr, infestOrigin, toMins, toMaxs, infestOrigin, ent->s.number, MASK_SHOT ); + //compute a place up in the air to start the real trace + trap_Trace( &tr, infestOrigin, toMins, toMaxs, temp, ent->s.number, MASK_SHOT ); + VectorCopy( infestOrigin, temp ); + temp[ 2 ] += ( EVOLVE_TRACE_HEIGHT * tr.fraction ) - 1.0f; + + //trace down to the ground so that we can evolve on slopes + trap_Trace( &tr, temp, toMins, toMaxs, infestOrigin, ent->s.number, MASK_SHOT ); + VectorCopy( tr.endpos, infestOrigin ); //check there is room to evolve - if( tr.fraction == 1.0f ) + if( !tr.startsolid ) { //...check we can evolve to that class if( numLevels && BG_FindStagesForClass( ent->client->pers.classSelection, g_alienStage.integer ) ) @@ -1009,7 +1021,8 @@ void Cmd_Class_f( gentity_t *ent ) else { ent->client->pers.classSelection = PCL_NONE; - trap_SendServerCommand( ent-g_entities, va( "print \"You cannot evolve from your current class\n\"" ) ); + trap_SendServerCommand( ent-g_entities, + va( "print \"You cannot evolve from your current class\n\"" ) ); return; } } @@ -1032,7 +1045,8 @@ void Cmd_Class_f( gentity_t *ent ) if( allowedClasses[ i ] == ent->client->pers.classSelection && BG_FindStagesForClass( ent->client->pers.classSelection, g_alienStage.integer ) ) { - if( ( spawn = SelectTremulousSpawnPoint( ent->client->pers.teamSelection, spawn_origin, spawn_angles ) ) && + if( ( spawn = SelectTremulousSpawnPoint( ent->client->pers.teamSelection, + spawn_origin, spawn_angles ) ) && level.numAlienSpawns > 0 ) //sanity check { ent->client->sess.sessionTeam = TEAM_FREE; @@ -1081,7 +1095,8 @@ void Cmd_Class_f( gentity_t *ent ) return; } - if( ( spawn = SelectTremulousSpawnPoint( ent->client->pers.teamSelection, spawn_origin, spawn_angles ) ) && + if( ( spawn = SelectTremulousSpawnPoint( ent->client->pers.teamSelection, + spawn_origin, spawn_angles ) ) && level.numHumanSpawns > 0 ) //sanity check { ent->client->sess.sessionTeam = TEAM_FREE; diff --git a/src/game/g_local.h b/src/game/g_local.h index ba1ff47d..ad4044e2 100644 --- a/src/game/g_local.h +++ b/src/game/g_local.h @@ -546,7 +546,7 @@ void G_Physics( gentity_t *ent, int msec ); // #define M_ROOT3 1.732050808f -#define MAX_ALIEN_BBOX 20 +#define MAX_ALIEN_BBOX 25 typedef enum { diff --git a/src/game/tremulous.h b/src/game/tremulous.h index 42dc922f..acfc4608 100644 --- a/src/game/tremulous.h +++ b/src/game/tremulous.h @@ -81,7 +81,9 @@ #define BMOFO_REGEN_RANGE 200.0f #define BMOFO_REGEN_MOD 2.0f #define BMOFO_CHARGE_SPEED 2.0f -#define BMOFO_CHARGE_TIME 2000 +#define BMOFO_CHARGE_TIME 3000 +#define BMOFO_CHARGE_CHARGE_TIME 1000 +#define BMOFO_CHARGE_CHARGE_RATIO (BMOFO_CHARGE_TIME/BMOFO_CHARGE_CHARGE_TIME) #define BMOFO_CHARGE_REPEAT 500 #define BMOFO_CHARGE_DMG ADM(200) |