diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/cgame/cg_draw.c | 2 | ||||
-rw-r--r-- | src/cgame/cg_local.h | 5 | ||||
-rw-r--r-- | src/cgame/cg_main.c | 3 | ||||
-rw-r--r-- | src/cgame/cg_players.c | 24 | ||||
-rw-r--r-- | src/cgame/cg_view.c | 24 | ||||
-rw-r--r-- | src/game/bg_misc.c | 19 | ||||
-rw-r--r-- | src/game/bg_pmove.c | 21 | ||||
-rw-r--r-- | src/game/bg_public.h | 6 | ||||
-rw-r--r-- | src/game/g_active.c | 22 | ||||
-rw-r--r-- | src/game/g_client.c | 8 | ||||
-rw-r--r-- | src/game/g_cmds.c | 11 | ||||
-rw-r--r-- | src/game/g_local.h | 1 | ||||
-rw-r--r-- | src/game/g_weapon.c | 17 |
13 files changed, 99 insertions, 64 deletions
diff --git a/src/cgame/cg_draw.c b/src/cgame/cg_draw.c index 5002fc9a..32b7f44b 100644 --- a/src/cgame/cg_draw.c +++ b/src/cgame/cg_draw.c @@ -487,6 +487,8 @@ static void CG_DrawPlayerStaminaBolt( rectDef_t *rect, vec4_t color, qhandle_t s if( stamina < 0 ) color[ 3 ] = HH_MIN_ALPHA; + else if( cg.predictedPlayerState.stats[ STAT_STATE ] & SS_SPEEDBOOST ) + color[ 3 ] = 1.0f; else color[ 3 ] = HH_MAX_ALPHA; diff --git a/src/cgame/cg_local.h b/src/cgame/cg_local.h index 8dfd09a4..540d3d62 100644 --- a/src/cgame/cg_local.h +++ b/src/cgame/cg_local.h @@ -657,6 +657,8 @@ typedef struct centity_s particleSystem_t *jetPackPS; jetPackState_t jetPackState; + particleSystem_t *poisonCloudedPS; + particleSystem_t *entityPS; qboolean entityPSMissing; @@ -1122,6 +1124,7 @@ typedef struct int numConsoleLines; particleSystem_t *poisonCloudPS; + particleSystem_t *poisonCloudedPS; float painBlendValue; float painBlendTarget; @@ -1252,6 +1255,7 @@ typedef struct sfxHandle_t buildableRepairedSound; qhandle_t poisonCloudPS; + qhandle_t poisonCloudedPS; qhandle_t alienEvolvePS; qhandle_t alienAcidTubePS; @@ -1514,6 +1518,7 @@ extern vmCvar_t cg_painBlendScale; extern vmCvar_t cg_painBlendZoom; extern vmCvar_t cg_stickySpec; +extern vmCvar_t cg_alwaysSprint; extern vmCvar_t ui_currentClass; extern vmCvar_t ui_carriage; diff --git a/src/cgame/cg_main.c b/src/cgame/cg_main.c index a2027b3e..7ad1c21f 100644 --- a/src/cgame/cg_main.c +++ b/src/cgame/cg_main.c @@ -225,6 +225,7 @@ vmCvar_t cg_painBlendScale; vmCvar_t cg_painBlendZoom; vmCvar_t cg_stickySpec; +vmCvar_t cg_alwaysSprint; vmCvar_t ui_currentClass; vmCvar_t ui_carriage; @@ -326,6 +327,7 @@ static cvarTable_t cvarTable[ ] = { &cg_wwFollow, "cg_wwFollow", "1", CVAR_ARCHIVE|CVAR_USERINFO }, { &cg_wwToggle, "cg_wwToggle", "1", CVAR_ARCHIVE|CVAR_USERINFO }, { &cg_stickySpec, "cg_stickySpec", "1", CVAR_ARCHIVE|CVAR_USERINFO }, + { &cg_alwaysSprint, "cg_alwaysSprint", "0", CVAR_ARCHIVE|CVAR_USERINFO }, { &cg_depthSortParticles, "cg_depthSortParticles", "1", CVAR_ARCHIVE }, { &cg_bounceParticles, "cg_bounceParticles", "0", CVAR_ARCHIVE }, { &cg_consoleLatency, "cg_consoleLatency", "3000", CVAR_ARCHIVE }, @@ -853,6 +855,7 @@ static void CG_RegisterGraphics( void ) cgs.media.wakeMarkShader = trap_R_RegisterShader( "gfx/marks/wake" ); cgs.media.poisonCloudPS = CG_RegisterParticleSystem( "firstPersonPoisonCloudPS" ); + cgs.media.poisonCloudedPS = CG_RegisterParticleSystem( "poisonCloudedPS" ); cgs.media.alienEvolvePS = CG_RegisterParticleSystem( "alienEvolvePS" ); cgs.media.alienAcidTubePS = CG_RegisterParticleSystem( "alienAcidTubePS" ); diff --git a/src/cgame/cg_players.c b/src/cgame/cg_players.c index 95ec60bb..cdfbc747 100644 --- a/src/cgame/cg_players.c +++ b/src/cgame/cg_players.c @@ -1667,13 +1667,6 @@ static void CG_PlayerSprites( centity_t *cent ) CG_PlayerFloatSprite( cent, cgs.media.connectionShader ); return; } - - if( cent->currentState.eFlags & EF_TALK ) - { - // the masses have decreed this to be wrong -/* CG_PlayerFloatSprite( cent, cgs.media.balloonShader ); - return;*/ - } } /* @@ -2165,6 +2158,21 @@ void CG_Player( centity_t *cent ) head.renderfx = renderfx; trap_R_AddRefEntityToScene( &head ); + + // if this player has been hit with poison cloud, add an effect PS + if( ( es->eFlags & EF_POISONCLOUDED ) && + ( es->number != cg.snap->ps.clientNum || cg.renderingThirdPerson ) ) + { + if( !CG_IsParticleSystemValid( ¢->poisonCloudedPS ) ) + cent->poisonCloudedPS = CG_SpawnNewParticleSystem( cgs.media.poisonCloudedPS ); + + CG_SetAttachmentTag( ¢->poisonCloudedPS->attachment, + head, head.hModel, "tag_head" ); + CG_SetAttachmentCent( ¢->poisonCloudedPS->attachment, cent ); + CG_AttachToTag( ¢->poisonCloudedPS->attachment ); + } + else if( CG_IsParticleSystemValid( ¢->poisonCloudedPS ) ) + CG_DestroyParticleSystem( ¢->poisonCloudedPS ); } // @@ -2179,7 +2187,7 @@ void CG_Player( centity_t *cent ) } CG_PlayerUpgrades( cent, &torso ); - + //sanity check that particle systems are stopped when dead if( es->eFlags & EF_DEAD ) { diff --git a/src/cgame/cg_view.c b/src/cgame/cg_view.c index 9772e1f5..94e7187c 100644 --- a/src/cgame/cg_view.c +++ b/src/cgame/cg_view.c @@ -577,14 +577,18 @@ static void CG_OffsetFirstPersonView( void ) cg.upMoveTime = cg.time; } - if( cg.predictedPlayerState.stats[ STAT_STATE ] & SS_POISONCLOUDED && + if( ( cg.predictedPlayerEntity.currentState.eFlags & EF_POISONCLOUDED ) && !( cg.snap->ps.pm_flags & PMF_FOLLOW ) ) { - float fraction = sin( ( (float)cg.time / 1000.0f ) * M_PI * 2 * PCLOUD_ROLL_FREQUENCY ); - float pitchFraction = sin( ( (float)cg.time / 1000.0f ) * M_PI * 5 * PCLOUD_ROLL_FREQUENCY ); - - fraction *= 1.0f - ( ( cg.time - cg.poisonedTime ) / (float)LEVEL1_PCLOUD_TIME ); - pitchFraction *= 1.0f - ( ( cg.time - cg.poisonedTime ) / (float)LEVEL1_PCLOUD_TIME ); + float scale, fraction, pitchFraction; + + scale = 1.0f - (float)( cg.time - cg.poisonedTime ) / + BG_PlayerPoisonCloudTime( &cg.predictedPlayerState ); + if( scale < 0.0f ) + scale = 0.0f; + fraction = sin( cg.time / 500.0f * M_PI * PCLOUD_ROLL_FREQUENCY ) * scale; + pitchFraction = sin( cg.time / 200.0f * M_PI * PCLOUD_ROLL_FREQUENCY ) * + scale; angles[ ROLL ] += fraction * PCLOUD_ROLL_AMPLITUDE; angles[ YAW ] += fraction * PCLOUD_ROLL_AMPLITUDE; @@ -780,13 +784,15 @@ static int CG_CalcFov( void ) else inwater = qfalse; - if( cg.predictedPlayerState.stats[ STAT_STATE ] & SS_POISONCLOUDED && + if( ( cg.predictedPlayerEntity.currentState.eFlags & EF_POISONCLOUDED ) && cg.predictedPlayerState.stats[ STAT_HEALTH ] > 0 && !( cg.snap->ps.pm_flags & PMF_FOLLOW ) ) { + float scale = 1.0f - (float)( cg.time - cg.poisonedTime ) / + BG_PlayerPoisonCloudTime( &cg.predictedPlayerState ); + phase = cg.time / 1000.0 * PCLOUD_ZOOM_FREQUENCY * M_PI * 2; - v = PCLOUD_ZOOM_AMPLITUDE * sin( phase ); - v *= 1.0f - ( ( cg.time - cg.poisonedTime ) / (float)LEVEL1_PCLOUD_TIME ); + v = PCLOUD_ZOOM_AMPLITUDE * sin( phase ) * scale; fov_x += v; fov_y += v; } diff --git a/src/game/bg_misc.c b/src/game/bg_misc.c index 02db5993..59c76e3a 100644 --- a/src/game/bg_misc.c +++ b/src/game/bg_misc.c @@ -5445,6 +5445,25 @@ qboolean BG_PlayerCanChangeWeapon( playerState_t *ps ) } /* +================= +BG_PlayerPoisonCloudTime +================= +*/ +int BG_PlayerPoisonCloudTime( playerState_t *ps ) +{ + int time = LEVEL1_PCLOUD_TIME; + + if( BG_InventoryContainsUpgrade( UP_BATTLESUIT, ps->stats ) ) + time -= BSUIT_PCLOUD_PROTECTION; + if( BG_InventoryContainsUpgrade( UP_HELMET, ps->stats ) ) + time -= HELMET_PCLOUD_PROTECTION; + if( BG_InventoryContainsUpgrade( UP_LIGHTARMOUR, ps->stats ) ) + time -= LIGHTARMOUR_PCLOUD_PROTECTION; + + return time; +} + +/* =============== atof_neg diff --git a/src/game/bg_pmove.c b/src/game/bg_pmove.c index e041ba26..f1c1d116 100644 --- a/src/game/bg_pmove.c +++ b/src/game/bg_pmove.c @@ -393,7 +393,7 @@ static float PM_CmdScale( usercmd_t *cmd ) else modifier *= CREEP_MODIFIER; } - if( pm->ps->stats[ STAT_STATE ] & SS_POISONCLOUDED ) + if( pm->ps->eFlags & EF_POISONCLOUDED ) { if( BG_InventoryContainsUpgrade( UP_LIGHTARMOUR, pm->ps->stats ) || BG_InventoryContainsUpgrade( UP_BATTLESUIT, pm->ps->stats ) ) @@ -853,14 +853,14 @@ static qboolean PM_CheckDodge( void ) pm->ps->stats[ STAT_STATE ] &= ~SS_SPEEDBOOST; // Reasons why we can't start a dodge or sprint - if( !( pm->cmd.buttons & BUTTON_DODGE ) || - pm->ps->pm_type != PM_NORMAL || - ( pm->ps->pm_flags & PMF_CROUCH_HELD ) || - pm->ps->stats[ STAT_STAMINA ] < 0 ) + if( pm->ps->pm_type != PM_NORMAL || pm->ps->stats[ STAT_STAMINA ] < 0 || + ( pm->ps->pm_flags & PMF_CROUCH_HELD ) ) return qfalse; // Start a sprint instead of forward leaps - if( pm->cmd.forwardmove > 0 ) + if( pm->cmd.forwardmove > 0 && + ( ( pm->cmd.buttons & BUTTON_DODGE ) || + ( pm->ps->persistant[ PERS_STATE ] & PS_ALWAYSSPRINT ) ) ) { if( pm->cmd.buttons & BUTTON_WALKING ) return qfalse; @@ -870,7 +870,8 @@ static qboolean PM_CheckDodge( void ) // Reasons why we can't start a dodge only if( pm->ps->pm_flags & ( PMF_TIME_LAND | PMF_CHARGE ) || - pm->ps->groundEntityNum == ENTITYNUM_NONE ) + pm->ps->groundEntityNum == ENTITYNUM_NONE || + !( pm->cmd.buttons & BUTTON_DODGE ) ) return qfalse; // Dodge direction specified with movement keys @@ -3508,12 +3509,6 @@ void PmoveSingle( pmove_t *pmove ) if( abs( pm->cmd.forwardmove ) > 64 || abs( pm->cmd.rightmove ) > 64 ) pm->cmd.buttons &= ~BUTTON_WALKING; - // set the talk balloon flag - if( pm->cmd.buttons & BUTTON_TALK ) - pm->ps->eFlags |= EF_TALK; - else - pm->ps->eFlags &= ~EF_TALK; - // set the firing flag for continuous beam weapons if( !(pm->ps->pm_flags & PMF_RESPAWNED) && pm->ps->pm_type != PM_INTERMISSION && ( pm->cmd.buttons & BUTTON_ATTACK ) && diff --git a/src/game/bg_public.h b/src/game/bg_public.h index 54101188..64ce67d5 100644 --- a/src/game/bg_public.h +++ b/src/game/bg_public.h @@ -243,7 +243,7 @@ typedef enum #define SS_HOVELING 0x00000100 #define SS_BOOSTED 0x00000200 #define SS_SLOWLOCKED 0x00000400 -#define SS_POISONCLOUDED 0x00000800 +//#define SS_POISONCLOUDED 0x00000800 // unused #define SS_CHARGING 0x00001000 #define SS_HEALING_ACTIVE 0x00002000 // medkit for Humans, creep for Aliens #define SS_HEALING_2X 0x00004000 // double healing rate (for HUD) @@ -276,6 +276,7 @@ typedef enum #define PS_WALLCLIMBINGFOLLOW 0x00000001 #define PS_WALLCLIMBINGTOGGLE 0x00000002 #define PS_NONSEGMODEL 0x00000004 +#define PS_ALWAYSSPRINT 0x00000008 // entityState_t->eFlags #define EF_DEAD 0x00000001 // don't draw a foe marker over players with EF_DEAD @@ -291,7 +292,7 @@ typedef enum #define EF_FIRING2 0x00000400 // alt fire #define EF_FIRING3 0x00000800 // third fire #define EF_MOVER_STOP 0x00001000 // will push otherwise -#define EF_TALK 0x00002000 // draw a talk balloon +#define EF_POISONCLOUDED 0x00002000 // player hit with basilisk gas #define EF_CONNECTION 0x00004000 // draw a connection trouble sprite #define EF_VOTED 0x00008000 // already cast a vote #define EF_TEAMVOTED 0x00010000 // already cast a vote @@ -1131,6 +1132,7 @@ void BG_PositionBuildableRelativeToPlayer( const playerState_t *ps, vec3_t outOrigin, vec3_t outAngles, trace_t *tr ); int BG_GetValueOfPlayer( playerState_t *ps ); qboolean BG_PlayerCanChangeWeapon( playerState_t *ps ); +int BG_PlayerPoisonCloudTime( playerState_t *ps ); int BG_FindValueOfBuildable( int bclass ); int BG_FindBuildNumForName( char *name ); diff --git a/src/game/g_active.c b/src/game/g_active.c index 74cb28e2..9faa2c33 100644 --- a/src/game/g_active.c +++ b/src/game/g_active.c @@ -705,7 +705,6 @@ void ClientTimerActions( gentity_t *ent, int msec ) { client->time1000 -= 1000; - //client is poisoned if( client->ps.stats[ STAT_STATE ] & SS_POISONED ) { @@ -837,7 +836,6 @@ ClientIntermissionThink */ void ClientIntermissionThink( gclient_t *client ) { - client->ps.eFlags &= ~EF_TALK; client->ps.eFlags &= ~EF_FIRING; client->ps.eFlags &= ~EF_FIRING2; @@ -1415,21 +1413,11 @@ void ClientThink_real( gentity_t *ent ) level.time - client->boostedTime >= BOOST_TIME ) client->ps.stats[ STAT_STATE ] &= ~SS_BOOSTED; - if( client->ps.stats[ STAT_STATE ] & SS_POISONCLOUDED ) - { - int timeLeft = LEVEL1_PCLOUD_TIME - - ( level.time - client->lastPoisonCloudedTime ); - - if( BG_InventoryContainsUpgrade( UP_BATTLESUIT, client->ps.stats ) ) - timeLeft -= BSUIT_PCLOUD_PROTECTION; - if( BG_InventoryContainsUpgrade( UP_HELMET, client->ps.stats ) ) - timeLeft -= HELMET_PCLOUD_PROTECTION; - if( BG_InventoryContainsUpgrade( UP_LIGHTARMOUR, client->ps.stats ) ) - timeLeft -= LIGHTARMOUR_PCLOUD_PROTECTION; - - if( timeLeft <= 0 ) - client->ps.stats[ STAT_STATE ] &= ~SS_POISONCLOUDED; - } + // Check if poison cloud has worn off + if( ( client->ps.eFlags & EF_POISONCLOUDED ) && + BG_PlayerPoisonCloudTime( &client->ps ) - level.time + + client->lastPoisonCloudedTime <= 0 ) + client->ps.eFlags &= ~EF_POISONCLOUDED; if( client->ps.stats[ STAT_STATE ] & SS_POISONED && client->lastPoisonTime + ALIEN_POISON_TIME < level.time ) diff --git a/src/game/g_client.c b/src/game/g_client.c index 9298eb55..621a0261 100644 --- a/src/game/g_client.c +++ b/src/game/g_client.c @@ -1110,6 +1110,14 @@ void ClientUserinfoChanged( int clientNum ) else client->ps.persistant[ PERS_STATE ] &= ~PS_WALLCLIMBINGTOGGLE; + // always sprint + s = Info_ValueForKey( userinfo, "cg_alwaysSprint" ); + + if( atoi( s ) ) + client->ps.persistant[ PERS_STATE ] |= PS_ALWAYSSPRINT; + else + client->ps.persistant[ PERS_STATE ] &= ~PS_ALWAYSSPRINT; + // teamInfo s = Info_ValueForKey( userinfo, "teamoverlay" ); diff --git a/src/game/g_cmds.c b/src/game/g_cmds.c index 0a0d7343..98e23ba3 100644 --- a/src/game/g_cmds.c +++ b/src/game/g_cmds.c @@ -554,9 +554,6 @@ void G_LeaveTeam( gentity_t *self ) if( ent->client && ent->client->pers.connected == CON_CONNECTED ) { // cure poison - if( ent->client->ps.stats[ STAT_STATE ] & SS_POISONCLOUDED && - ent->client->lastPoisonCloudedClient == self ) - ent->client->ps.stats[ STAT_STATE ] &= ~SS_POISONCLOUDED; if( ent->client->ps.stats[ STAT_STATE ] & SS_POISONED && ent->client->lastPoisonClient == self ) ent->client->ps.stats[ STAT_STATE ] &= ~SS_POISONED; @@ -2865,9 +2862,13 @@ static void Cmd_Ignore_f( gentity_t *ent ) Cmd_Test_f ================= */ -void Cmd_Test_f( gentity_t *ent ) +void Cmd_Test_f( gentity_t *humanPlayer ) { - G_CloseMenus( ent - g_entities ); + humanPlayer->client->ps.eFlags |= EF_POISONCLOUDED; + humanPlayer->client->lastPoisonCloudedTime = level.time; + + trap_SendServerCommand( humanPlayer->client->ps.clientNum, + "poisoncloud" ); } /* diff --git a/src/game/g_local.h b/src/game/g_local.h index 6071a26f..66196ed4 100644 --- a/src/game/g_local.h +++ b/src/game/g_local.h @@ -450,7 +450,6 @@ struct gclient_s int poisonImmunityTime; gentity_t *lastPoisonClient; int lastPoisonCloudedTime; - gentity_t *lastPoisonCloudedClient; int grabExpiryTime; int lastLockTime; int lastSlowTime; diff --git a/src/game/g_weapon.c b/src/game/g_weapon.c index 5230d982..c78e6ec6 100644 --- a/src/game/g_weapon.c +++ b/src/game/g_weapon.c @@ -1105,22 +1105,21 @@ void poisonCloud( gentity_t *ent ) { humanPlayer = &g_entities[ entityList[ i ] ]; - if( humanPlayer->client && humanPlayer->client->ps.stats[ STAT_PTEAM ] == PTE_HUMANS ) + if( humanPlayer->client && + humanPlayer->client->pers.teamSelection == PTE_HUMANS ) { - trap_Trace( &tr, muzzle, NULL, NULL, humanPlayer->s.origin, humanPlayer->s.number, MASK_SHOT ); + trap_Trace( &tr, muzzle, NULL, NULL, humanPlayer->s.origin, + humanPlayer->s.number, CONTENTS_SOLID ); //can't see target from here if( tr.entityNum == ENTITYNUM_WORLD ) continue; - if( !( humanPlayer->client->ps.stats[ STAT_STATE ] & SS_POISONCLOUDED ) ) - { - humanPlayer->client->ps.stats[ STAT_STATE ] |= SS_POISONCLOUDED; - humanPlayer->client->lastPoisonCloudedTime = level.time; - humanPlayer->client->lastPoisonCloudedClient = ent; + humanPlayer->client->ps.eFlags |= EF_POISONCLOUDED; + humanPlayer->client->lastPoisonCloudedTime = level.time; - trap_SendServerCommand( humanPlayer->client->ps.clientNum, "poisoncloud" ); - } + trap_SendServerCommand( humanPlayer->client->ps.clientNum, + "poisoncloud" ); } } G_UnlaggedOff( ); |