summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Angus <tim@ngus.net>2007-09-16 21:38:35 +0000
committerTim Angus <tim@ngus.net>2007-09-16 21:38:35 +0000
commitd102b33653c85fe635d9addf9513c16dce941584 (patch)
tree0c0f433b28eac5ef9bdd1d740afaa2dcf49ea7bb
parent97a546ab92c1684de7e552cde36bcfe3f406e2fa (diff)
* (bug 2783) Rework lcannon firing logic
* Remove STAT_BOOSTEDTIME, instead inferring it via SS_BOOSTED * Set EF_TELEPORT_BIT when buying or selling the bsuit
-rw-r--r--src/cgame/cg_draw.c13
-rw-r--r--src/cgame/cg_local.h1
-rw-r--r--src/cgame/cg_main.c1
-rw-r--r--src/cgame/cg_predict.c12
-rw-r--r--src/cgame/cg_view.c6
-rw-r--r--src/game/bg_pmove.c26
-rw-r--r--src/game/bg_public.h1
-rw-r--r--src/game/g_active.c2
-rw-r--r--src/game/g_cmds.c2
9 files changed, 39 insertions, 25 deletions
diff --git a/src/cgame/cg_draw.c b/src/cgame/cg_draw.c
index 82df413a..ef15b798 100644
--- a/src/cgame/cg_draw.c
+++ b/src/cgame/cg_draw.c
@@ -798,10 +798,7 @@ CG_DrawPlayerBoosted
*/
static void CG_DrawPlayerBoosted( rectDef_t *rect, vec4_t color, qhandle_t shader )
{
- playerState_t *ps = &cg.snap->ps;
- qboolean boosted = ps->stats[ STAT_STATE ] & SS_BOOSTED;
-
- if( boosted )
+ if( cg.boostedTime >= 0 )
color[ 3 ] = AH_MAX_ALPHA;
else
color[ 3 ] = AH_MIN_ALPHA;
@@ -818,17 +815,15 @@ CG_DrawPlayerBoosterBolt
*/
static void CG_DrawPlayerBoosterBolt( rectDef_t *rect, vec4_t color, qhandle_t shader )
{
- playerState_t *ps = &cg.snap->ps;
- qboolean boosted = ps->stats[ STAT_STATE ] & SS_BOOSTED;
vec4_t localColor;
Vector4Copy( color, localColor );
- if( boosted )
+ if( cg.boostedTime >= 0 )
{
- if( ps->stats[ STAT_BOOSTTIME ] > BOOST_TIME - 3000 )
+ if( ( cg.time - cg.boostedTime ) > BOOST_TIME - 3000 )
{
- qboolean flash = ( ps->stats[ STAT_BOOSTTIME ] / 500 ) % 2;
+ qboolean flash = ( cg.time / 500 ) % 2;
if( flash )
localColor[ 3 ] = 1.0f;
diff --git a/src/cgame/cg_local.h b/src/cgame/cg_local.h
index 05cbcbdf..38ee43e9 100644
--- a/src/cgame/cg_local.h
+++ b/src/cgame/cg_local.h
@@ -1107,6 +1107,7 @@ typedef struct
qboolean weapon2Firing;
qboolean weapon3Firing;
+ int boostedTime;
int poisonedTime;
vec3_t lastNormal; //TA: view smoothage
diff --git a/src/cgame/cg_main.c b/src/cgame/cg_main.c
index 1797b972..eab3d0f2 100644
--- a/src/cgame/cg_main.c
+++ b/src/cgame/cg_main.c
@@ -1757,6 +1757,7 @@ void CG_Init( int serverMessageNum, int serverCommandSequence, int clientNum )
CG_LoadHudMenu( ); // load new hud stuff
cg.weaponSelect = WP_NONE;
+ cg.boostedTime = -1;
// old servers
diff --git a/src/cgame/cg_predict.c b/src/cgame/cg_predict.c
index 34f00c4f..e34fe8df 100644
--- a/src/cgame/cg_predict.c
+++ b/src/cgame/cg_predict.c
@@ -476,13 +476,13 @@ static int CG_IsUnacceptableError( playerState_t *ps, playerState_t *pps )
if( fabs( AngleDelta( ps->viewangles[ 0 ], pps->viewangles[ 0 ] ) ) > 1.0f ||
fabs( AngleDelta( ps->viewangles[ 1 ], pps->viewangles[ 1 ] ) ) > 1.0f ||
- fabs( AngleDelta( ps->viewangles[ 2 ], pps->viewangles[ 2 ] ) ) > 1.0f )
+ fabs( AngleDelta( ps->viewangles[ 2 ], pps->viewangles[ 2 ] ) ) > 1.0f )
{
return 12;
}
if( pps->viewheight != ps->viewheight )
- return 13;
+ return 13;
if( pps->damageEvent != ps->damageEvent ||
pps->damageYaw != ps->damageYaw ||
@@ -699,22 +699,22 @@ void CG_PredictPlayerState( void )
// make sure the state differences are acceptable
errorcode = CG_IsUnacceptableError( &cg.predictedPlayerState,
&cg.savedPmoveStates[ i ] );
-
+
if( errorcode )
{
if( cg_showmiss.integer )
CG_Printf("errorcode %d at %d\n", errorcode, cg.time);
break;
}
-
+
// this one is almost exact, so we'll copy it in as the starting point
*cg_pmove.ps = cg.savedPmoveStates[ i ];
// advance the head
cg.stateHead = ( i + 1 ) % NUM_SAVED_STATES;
-
+
// set the next command to predict
predictCmd = cg.lastPredictedCommand + 1;
-
+
// a saved state matched, so flag it
error = qfalse;
break;
diff --git a/src/cgame/cg_view.c b/src/cgame/cg_view.c
index 477196c5..dfd9e34b 100644
--- a/src/cgame/cg_view.c
+++ b/src/cgame/cg_view.c
@@ -1264,6 +1264,12 @@ void CG_DrawActiveFrame( int serverTime, stereoFrame_t stereoView, qboolean demo
// decide on third person view
cg.renderingThirdPerson = cg_thirdPerson.integer || ( cg.snap->ps.stats[ STAT_HEALTH ] <= 0 );
+ // Infer when we first became boosted
+ if( cg.snap->ps.stats[ STAT_STATE ] && SS_BOOSTED && cg.boostedTime < 0 )
+ cg.boostedTime = cg.time;
+ else if( !( cg.snap->ps.stats[ STAT_STATE ] && SS_BOOSTED ) && cg.boostedTime >= 0 )
+ cg.boostedTime = -1;
+
// build cg.refdef
inwater = CG_CalcViewValues( );
diff --git a/src/game/bg_pmove.c b/src/game/bg_pmove.c
index 94571799..85a97526 100644
--- a/src/game/bg_pmove.c
+++ b/src/game/bg_pmove.c
@@ -2856,30 +2856,42 @@ static void PM_Weapon( void )
case WP_LUCIFER_CANNON:
attack1 = pm->cmd.buttons & BUTTON_ATTACK;
attack2 = pm->cmd.buttons & BUTTON_ATTACK2;
- attack3 = pm->cmd.buttons & BUTTON_USE_HOLDABLE;
+ attack3 = qfalse;
- if( ( attack1 || pm->ps->stats[ STAT_MISC ] == 0 ) && !attack2 && !attack3 )
+ if( attack1 )
{
+ attack2 = qfalse;
+
if( pm->ps->stats[ STAT_MISC ] < LCANNON_TOTAL_CHARGE )
{
+ // Charging
pm->ps->weaponTime = 0;
pm->ps->weaponstate = WEAPON_READY;
return;
}
- else
- attack1 = !attack1;
}
- //erp this looks confusing
if( pm->ps->stats[ STAT_MISC ] > LCANNON_MIN_CHARGE )
- attack1 = !attack1;
+ {
+ // Fire primary attack
+ attack1 = qtrue;
+ attack2 = qfalse;
+ }
else if( pm->ps->stats[ STAT_MISC ] > 0 )
{
+ // Not enough charge
pm->ps->stats[ STAT_MISC ] = 0;
pm->ps->weaponTime = 0;
pm->ps->weaponstate = WEAPON_READY;
return;
}
+ else if( !attack2 )
+ {
+ // Idle
+ pm->ps->weaponTime = 0;
+ pm->ps->weaponstate = WEAPON_READY;
+ return;
+ }
break;
case WP_MASS_DRIVER:
@@ -3034,7 +3046,7 @@ static void PM_Weapon( void )
// take an ammo away if not infinite
if( !BG_FindInfinteAmmoForWeapon( pm->ps->weapon ) )
{
- //special case for lCanon
+ //special case for lcannon
if( pm->ps->weapon == WP_LUCIFER_CANNON && attack1 && !attack2 )
{
ammo -= (int)( ceil( ( (float)pm->ps->stats[ STAT_MISC ] / (float)LCANNON_TOTAL_CHARGE ) * 10.0f ) );
diff --git a/src/game/bg_public.h b/src/game/bg_public.h
index bad2ffa4..2f4f3a1a 100644
--- a/src/game/bg_public.h
+++ b/src/game/bg_public.h
@@ -217,7 +217,6 @@ typedef enum
STAT_STATE, //TA: client states e.g. wall climbing
STAT_MISC, //TA: for uh...misc stuff
STAT_BUILDABLE, //TA: which ghost model to display for building
- STAT_BOOSTTIME, //TA: time left for boost (alien only)
STAT_FALLDIST, //TA: the distance the player fell
STAT_VIEWLOCK //TA: direction to lock the view in
} statIndex_t;
diff --git a/src/game/g_active.c b/src/game/g_active.c
index 4fb9624a..7acf6a9b 100644
--- a/src/game/g_active.c
+++ b/src/game/g_active.c
@@ -1375,8 +1375,6 @@ void ClientThink_real( gentity_t *ent )
client->lastSlowTime + ABUILDER_BLOB_TIME < level.time )
client->ps.stats[ STAT_STATE ] &= ~SS_SLOWLOCKED;
- client->ps.stats[ STAT_BOOSTTIME ] = level.time - client->lastBoostedTime;
-
if( client->ps.stats[ STAT_STATE ] & SS_BOOSTED &&
client->lastBoostedTime + BOOST_TIME < level.time )
client->ps.stats[ STAT_STATE ] &= ~SS_BOOSTED;
diff --git a/src/game/g_cmds.c b/src/game/g_cmds.c
index 54928853..e383635b 100644
--- a/src/game/g_cmds.c
+++ b/src/game/g_cmds.c
@@ -2139,6 +2139,7 @@ void Cmd_Buy_f( gentity_t *ent )
}
VectorCopy( newOrigin, ent->s.pos.trBase );
ent->client->ps.stats[ STAT_PCLASS ] = PCL_HUMAN_BSUIT;
+ ent->client->ps.eFlags ^= EF_TELEPORT_BIT;
}
//add to inventory
@@ -2246,6 +2247,7 @@ void Cmd_Sell_f( gentity_t *ent )
}
VectorCopy( newOrigin, ent->s.pos.trBase );
ent->client->ps.stats[ STAT_PCLASS ] = PCL_HUMAN;
+ ent->client->ps.eFlags ^= EF_TELEPORT_BIT;
}
//add to inventory