diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/cgame/cg_draw.c | 3 | ||||
-rw-r--r-- | src/cgame/cg_ents.c | 32 | ||||
-rw-r--r-- | src/cgame/cg_local.h | 45 | ||||
-rw-r--r-- | src/cgame/cg_main.c | 4 | ||||
-rw-r--r-- | src/cgame/cg_scanner.c | 152 | ||||
-rw-r--r-- | src/game/bg_misc.c | 2 | ||||
-rw-r--r-- | src/game/bg_public.h | 1 | ||||
-rw-r--r-- | src/game/g_active.c | 2 | ||||
-rw-r--r-- | src/game/g_combat.c | 22 | ||||
-rw-r--r-- | src/game/g_weapon.c | 6 |
10 files changed, 188 insertions, 81 deletions
diff --git a/src/cgame/cg_draw.c b/src/cgame/cg_draw.c index 8510504e..2a802d52 100644 --- a/src/cgame/cg_draw.c +++ b/src/cgame/cg_draw.c @@ -2045,6 +2045,9 @@ static void CG_Draw2D( void ) if( BG_gotItem( UP_HELMET, cg.snap->ps.stats ) ) CG_Scanner( ); + + if( BG_ClassHasAbility( cg.predictedPlayerState.stats[ STAT_PCLASS ], SCA_ALIENSENSE ) ) + CG_AlienSense( ); } } diff --git a/src/cgame/cg_ents.c b/src/cgame/cg_ents.c index 8cc0fe1b..560dbbf2 100644 --- a/src/cgame/cg_ents.c +++ b/src/cgame/cg_ents.c @@ -906,10 +906,10 @@ void CG_AddPacketEntities( void ) { CG_CalcEntityLerpPositions( &cg_entities[ cg.snap->ps.clientNum ] ); //TA: "empty" item position arrays - cgIP.numAlienItems = 0; - cgIP.numHumanItems = 0; - cgIP.numAlienClients = 0; - cgIP.numHumanClients = 0; + cg.ep.numAlienBuildables = 0; + cg.ep.numHumanBuildables = 0; + cg.ep.numAlienClients = 0; + cg.ep.numHumanClients = 0; for( num = 0 ; num < cg.snap->numEntities ; num++ ) { @@ -920,33 +920,29 @@ void CG_AddPacketEntities( void ) { //TA: add to list of item positions (for creep) if( cent->currentState.modelindex2 == BIT_ALIENS ) { - VectorCopy( cent->lerpOrigin, cgIP.alienItemPositions[ cgIP.numAlienItems ] ); - cgIP.alienItemTimes[ cgIP.numAlienItems ] = cent->miscTime; - cgIP.numAlienItems++; + VectorCopy( cent->lerpOrigin, cg.ep.alienBuildablePos[ cg.ep.numAlienBuildables ] ); + cg.ep.alienBuildableTimes[ cg.ep.numAlienBuildables ] = cent->miscTime; + cg.ep.numAlienBuildables++; } else if( cent->currentState.modelindex2 == BIT_HUMANS ) { - VectorCopy( cent->lerpOrigin, cgIP.humanItemPositions[ cgIP.numHumanItems ] ); - cgIP.numHumanItems++; + VectorCopy( cent->lerpOrigin, cg.ep.humanBuildablePos[ cg.ep.numHumanBuildables ] ); + cg.ep.numHumanBuildables++; } } - - if( cent->currentState.eType == ET_PLAYER ) + else if( cent->currentState.eType == ET_PLAYER ) { int team = cent->currentState.powerups & 0x00FF; - int class = ( cent->currentState.powerups & 0xFF00 ) >> 8; if( team == PTE_ALIENS ) { - VectorCopy( cent->lerpOrigin, cgIP.alienClientPositions[ cgIP.numAlienClients ] ); - cgIP.alienClientClass = class; - cgIP.numAlienClients++; + VectorCopy( cent->lerpOrigin, cg.ep.alienClientPos[ cg.ep.numAlienClients ] ); + cg.ep.numAlienClients++; } else if( team == PTE_HUMANS ) { - VectorCopy( cent->lerpOrigin, cgIP.humanClientPositions[ cgIP.numHumanClients ] ); - cgIP.humanClientClass = class; - cgIP.numHumanClients++; + VectorCopy( cent->lerpOrigin, cg.ep.humanClientPos[ cg.ep.numHumanClients ] ); + cg.ep.numHumanClients++; } } } diff --git a/src/cgame/cg_local.h b/src/cgame/cg_local.h index e1aed132..92a2cae4 100644 --- a/src/cgame/cg_local.h +++ b/src/cgame/cg_local.h @@ -471,6 +471,23 @@ typedef struct //====================================================================== +//TA: +typedef struct +{ + vec3_t alienBuildablePos[ BA_NUM_BUILDABLES ]; + int alienBuildableTimes[ BA_NUM_BUILDABLES ]; + int numAlienBuildables; + + vec3_t humanBuildablePos[ BA_NUM_BUILDABLES ]; + int numHumanBuildables; + + vec3_t alienClientPos[ MAX_CLIENTS ]; + int numAlienClients; + + vec3_t humanClientPos[ MAX_CLIENTS ]; + int numHumanClients; +} entityPos_t; + // all cg.stepTime, cg.duckTime, cg.landTime, etc are set to cg.time when the action // occurs, and they will have visible effects for #define STEP_TIME or whatever msec after @@ -680,6 +697,8 @@ typedef struct { int forwardMoveTime; //TA: for struggling int rightMoveTime; int upMoveTime; + + entityPos_t ep; } cg_t; @@ -1112,29 +1131,6 @@ extern buildableInfo_t cg_buildables[ BA_NUM_BUILDABLES ]; extern markPoly_t cg_markPolys[MAX_MARK_POLYS]; -//TA: -typedef struct -{ - vec3_t alienItemPositions[ MAX_ITEMS ]; - int alienItemTimes[ MAX_ITEMS ]; - int numAlienItems; - - vec3_t humanItemPositions[ MAX_ITEMS ]; - int numHumanItems; - - vec3_t alienClientPositions[ MAX_CLIENTS ]; - int alienClientClass; - int numAlienClients; - - vec3_t humanClientPositions[ MAX_CLIENTS ]; - int humanClientClass; - int numHumanClients; - -} cgItemPos_t; - -extern cgItemPos_t cgIP; - - extern vmCvar_t cg_centertime; extern vmCvar_t cg_runpitch; extern vmCvar_t cg_runroll; @@ -1459,7 +1455,8 @@ void CG_Creep( centity_t *cent ); // // cg_scanner.c // -void CG_Scanner( void ); +void CG_Scanner( ); +void CG_AlienSense( ); // // cg_marks.c diff --git a/src/cgame/cg_main.c b/src/cgame/cg_main.c index 384ef030..e3752458 100644 --- a/src/cgame/cg_main.c +++ b/src/cgame/cg_main.c @@ -82,10 +82,6 @@ upgradeInfo_t cg_upgrades[32]; itemInfo_t cg_items[MAX_ITEMS]; buildableInfo_t cg_buildables[ BA_NUM_BUILDABLES ]; -//TA: -cgItemPos_t cgIP; - - vmCvar_t cg_teslaTrailTime; vmCvar_t cg_railTrailTime; vmCvar_t cg_centertime; diff --git a/src/cgame/cg_scanner.c b/src/cgame/cg_scanner.c index c4a7a067..b3c37fbe 100644 --- a/src/cgame/cg_scanner.c +++ b/src/cgame/cg_scanner.c @@ -13,16 +13,16 @@ #include "cg_local.h" -#define RANGE 1000.0f +#define RANGE 1000.0f -#define XPOS 0.0f -#define YPOS 0.0f -#define WIDTH 640.0f -#define HEIGHT 480.0f +#define XPOS 0.0f +#define YPOS 0.0f +#define WIDTH 640.0f +#define HEIGHT 480.0f #define STALKWIDTH 2.0f -#define BLIPX 16.0f -#define BLIPY 8.0f +#define BLIPX 16.0f +#define BLIPY 8.0f static void CG_DrawBlips( vec3_t origin, vec4_t colour ) { @@ -51,36 +51,120 @@ static void CG_DrawBlips( vec3_t origin, vec4_t colour ) trap_R_SetColor( NULL ); } +#define RANGE2 1000.0f + +#define XPOS2 20.0f +#define YPOS2 20.0f +#define WIDTH2 600.0f +#define HEIGHT2 440.0f + +#define BLIPX2 24.0f +#define BLIPY2 24.0f + +static void CG_DrawDir( vec3_t origin, vec4_t colour ) +{ + vec3_t drawOrigin; + vec3_t up = { 0.0f, 0.0f, 1.0f }; + + RotatePointAroundVector( drawOrigin, up, origin, -cg.refdefViewAngles[ 1 ] - 90 ); + drawOrigin[ 2 ] = 0.0f; + VectorNormalize( drawOrigin ); + + trap_R_SetColor( colour ); + CG_DrawPic( XPOS2 + ( WIDTH2 / 2 ) - ( BLIPX2 / 2 ) - drawOrigin[ 0 ] * ( WIDTH2 / 2 ), + YPOS2 + ( HEIGHT2 / 2 ) - ( BLIPY2 / 2 ) + drawOrigin[ 1 ] * ( HEIGHT2 / 2 ), + BLIPX2, BLIPY2, cgs.media.scannerBlipShader ); + trap_R_SetColor( NULL ); +} + +/* +============= +CG_AlienSense +============= +*/ +void CG_AlienSense( ) +{ + int i; + vec3_t origin; + vec3_t relOrigin; + vec4_t buildable = { 1.0f, 0.0f, 1.0f, 1.0f }; + vec4_t client = { 0.0f, 0.0f, 1.0f, 1.0f }; + + VectorCopy( cg.refdef.vieworg, origin ); + + //draw human buildables + for( i = 0; i < cg.ep.numHumanBuildables; i++ ) + { + VectorClear( relOrigin ); + VectorSubtract( cg.ep.humanBuildablePos[ i ], origin, relOrigin ); + + if( VectorLength( relOrigin ) < RANGE2 ) + CG_DrawDir( relOrigin, buildable ); + } + + //draw human clients + for( i = 0; i < cg.ep.numHumanClients; i++ ) + { + VectorClear( relOrigin ); + VectorSubtract( cg.ep.humanClientPos[ i ], origin, relOrigin ); + + if( VectorLength( relOrigin ) < RANGE2 ) + CG_DrawDir( relOrigin, client ); + } +} + /* -Global Scanner draw +============= +CG_Scanner +============= */ void CG_Scanner( ) { int i; vec3_t origin; vec3_t relOrigin; - vec4_t hIabove = { 0, 1, 0, 1 }; - vec4_t hIbelow = { 0, 0.5, 0, 1 }; - vec4_t aIabove = { 1, 0, 0, 1 }; - vec4_t aIbelow = { 0.5, 0, 0, 1 }; + vec4_t hIabove = { 0.0f, 1.0f, 0.0f, 1.0f }; + vec4_t hIbelow = { 0.0f, 0.5f, 0.0f, 1.0f }; + vec4_t aIabove = { 1.0f, 0.0f, 0.0f, 1.0f }; + vec4_t aIbelow = { 0.5f, 0.0f, 0.0f, 1.0f }; VectorCopy( cg.refdef.vieworg, origin ); - //draw human items below scanner plane - for( i = 0; i < cgIP.numHumanItems; i++ ) + //draw human buildables below scanner plane + for( i = 0; i < cg.ep.numHumanBuildables; i++ ) + { + VectorClear( relOrigin ); + VectorSubtract( cg.ep.humanBuildablePos[ i ], origin, relOrigin ); + + if( VectorLength( relOrigin ) < RANGE && ( relOrigin[ 2 ] < 0 ) ) + CG_DrawBlips( relOrigin, hIbelow ); + } + + //draw alien buildables below scanner plane + for( i = 0; i < cg.ep.numAlienBuildables; i++ ) + { + VectorClear( relOrigin ); + VectorSubtract( cg.ep.alienBuildablePos[ i ], origin, relOrigin ); + + if( VectorLength( relOrigin ) < RANGE && ( relOrigin[ 2 ] < 0 ) ) + CG_DrawBlips( relOrigin, aIbelow ); + } + + //draw human clients below scanner plane + for( i = 0; i < cg.ep.numHumanClients; i++ ) { VectorClear( relOrigin ); - VectorSubtract( cgIP.humanItemPositions[ i ], origin, relOrigin ); + VectorSubtract( cg.ep.humanClientPos[ i ], origin, relOrigin ); if( VectorLength( relOrigin ) < RANGE && ( relOrigin[ 2 ] < 0 ) ) CG_DrawBlips( relOrigin, hIbelow ); } - //draw alien items below scanner plane - for( i = 0; i < cgIP.numAlienItems; i++ ) + //draw alien buildables below scanner plane + for( i = 0; i < cg.ep.numAlienClients; i++ ) { VectorClear( relOrigin ); - VectorSubtract( cgIP.alienItemPositions[ i ], origin, relOrigin ); + VectorSubtract( cg.ep.alienClientPos[ i ], origin, relOrigin ); if( VectorLength( relOrigin ) < RANGE && ( relOrigin[ 2 ] < 0 ) ) CG_DrawBlips( relOrigin, aIbelow ); @@ -88,21 +172,41 @@ void CG_Scanner( ) /*CG_DrawPic( XPOS, YPOS, WIDTH, HEIGHT, cgs.media.scannerShader );*/ - //draw human items above scanner plane - for( i = 0; i < cgIP.numHumanItems; i++ ) + //draw human buildables above scanner plane + for( i = 0; i < cg.ep.numHumanBuildables; i++ ) + { + VectorClear( relOrigin ); + VectorSubtract( cg.ep.humanBuildablePos[ i ], origin, relOrigin ); + + if( VectorLength( relOrigin ) < RANGE && ( relOrigin[ 2 ] > 0 ) ) + CG_DrawBlips( relOrigin, hIabove ); + } + + //draw alien buildables above scanner plane + for( i = 0; i < cg.ep.numAlienBuildables; i++ ) + { + VectorClear( relOrigin ); + VectorSubtract( cg.ep.alienBuildablePos[ i ], origin, relOrigin ); + + if( VectorLength( relOrigin ) < RANGE && ( relOrigin[ 2 ] > 0 ) ) + CG_DrawBlips( relOrigin, aIabove ); + } + + //draw human clients above scanner plane + for( i = 0; i < cg.ep.numHumanClients; i++ ) { VectorClear( relOrigin ); - VectorSubtract( cgIP.humanItemPositions[ i ], origin, relOrigin ); + VectorSubtract( cg.ep.humanClientPos[ i ], origin, relOrigin ); if( VectorLength( relOrigin ) < RANGE && ( relOrigin[ 2 ] > 0 ) ) CG_DrawBlips( relOrigin, hIabove ); } - //draw alien items above scanner plane - for( i = 0; i < cgIP.numAlienItems; i++ ) + //draw alien clients above scanner plane + for( i = 0; i < cg.ep.numAlienClients; i++ ) { VectorClear( relOrigin ); - VectorSubtract( cgIP.alienItemPositions[ i ], origin, relOrigin ); + VectorSubtract( cg.ep.alienClientPos[ i ], origin, relOrigin ); if( VectorLength( relOrigin ) < RANGE && ( relOrigin[ 2 ] > 0 ) ) CG_DrawBlips( relOrigin, aIabove ); diff --git a/src/game/bg_misc.c b/src/game/bg_misc.c index cd54f3d0..d4d75462 100644 --- a/src/game/bg_misc.c +++ b/src/game/bg_misc.c @@ -1273,7 +1273,7 @@ classAttributes_t bg_classList[ ] = 0, 0, //int viewheight, crouchviewheight; 25, //int health; 0, //int armor; - SCA_WALLCLIMBER|SCA_CANJUMP|SCA_NOWEAPONDRIFT|SCA_FOVWARPS, //int abilities; + SCA_WALLCLIMBER|SCA_CANJUMP|SCA_NOWEAPONDRIFT|SCA_FOVWARPS|SCA_ALIENSENSE, //int abilities; 0.0f, //float buildDist; 140, //int fov; 0.0f, //float bob; diff --git a/src/game/bg_public.h b/src/game/bg_public.h index 69843c79..da8d65fa 100644 --- a/src/game/bg_public.h +++ b/src/game/bg_public.h @@ -234,6 +234,7 @@ typedef enum { #define SCA_CANJUMP 8 #define SCA_NOWEAPONDRIFT 16 #define SCA_FOVWARPS 32 +#define SCA_ALIENSENSE 64 #define SS_WALLCLIMBING 1 #define SS_WALLCLIMBINGCEILING 2 diff --git a/src/game/g_active.c b/src/game/g_active.c index 691f1559..a3ddecd5 100644 --- a/src/game/g_active.c +++ b/src/game/g_active.c @@ -466,7 +466,7 @@ void ClientTimerActions( gentity_t *ent, int msec ) //client is poisoned if( client->ps.stats[ STAT_STATE ] & SS_POISONED ) { - int damage = ( level.time - client->lastPoisonTime ) / 100; + int damage = ( level.time - client->lastPoisonTime ) / 1000; G_Damage( ent, NULL, NULL, NULL, NULL, damage, 0, MOD_VENOM ); } diff --git a/src/game/g_combat.c b/src/game/g_combat.c index 8ec9dd93..fbb13547 100644 --- a/src/game/g_combat.c +++ b/src/game/g_combat.c @@ -1027,7 +1027,7 @@ void G_Damage( gentity_t *targ, gentity_t *inflictor, gentity_t *attacker, if( knockback && targ->client ) { vec3_t kvel; - float mass; + float mass; mass = 200; @@ -1053,12 +1053,12 @@ void G_Damage( gentity_t *targ, gentity_t *inflictor, gentity_t *attacker, } // check for completely getting out of the damage - if( !(dflags & DAMAGE_NO_PROTECTION) ) + if( !( dflags & DAMAGE_NO_PROTECTION ) ) { // if TF_NO_FRIENDLY_FIRE is set, don't do damage to the target // if the attacker was on the same team - if( targ != attacker && OnSameTeam (targ, attacker) ) + if( targ != attacker && OnSameTeam( targ, attacker ) ) { if( !g_friendlyFire.integer ) return; @@ -1080,9 +1080,9 @@ void G_Damage( gentity_t *targ, gentity_t *inflictor, gentity_t *attacker, }*/ // add to the attacker's hit counter - if ( attacker->client && targ != attacker && targ->health > 0 + if( attacker->client && targ != attacker && targ->health > 0 && targ->s.eType != ET_MISSILE - && targ->s.eType != ET_GENERAL) + && targ->s.eType != ET_GENERAL ) { if( OnSameTeam( targ, attacker ) ) attacker->client->ps.persistant[ PERS_HITS ]--; @@ -1149,12 +1149,22 @@ void G_Damage( gentity_t *targ, gentity_t *inflictor, gentity_t *attacker, if( g_gametype.integer == GT_CTF) Team_CheckHurtCarrier(targ, attacker); - if(targ->client) + if( targ->client ) { // set the last client who damaged the target targ->client->lasthurt_client = attacker->s.number; targ->client->lasthurt_mod = mod; take = (int)( (float)take * G_CalcDamageModifier( point, targ, attacker, client->ps.stats[ STAT_PCLASS ] ) ); + + //if boosted poison every attack + if( client && client->ps.stats[ STAT_STATE ] & SS_BOOSTED ) + { + if( !( targ->client->ps.stats[ STAT_STATE ] & SS_POISONED ) ) + { + targ->client->ps.stats[ STAT_STATE ] |= SS_POISONED; + targ->client->lastPoisonTime = level.time; + } + } } // do the damage diff --git a/src/game/g_weapon.c b/src/game/g_weapon.c index 1d8180dd..1b1fcf33 100644 --- a/src/game/g_weapon.c +++ b/src/game/g_weapon.c @@ -358,15 +358,15 @@ qboolean CheckVenomAttack( gentity_t *ent ) tent->s.weapon = ent->s.weapon; } - G_Damage( traceEnt, ent, ent, forward, tr.endpos, 5, DAMAGE_NO_KNOCKBACK, MOD_VENOM ); - if( traceEnt->client ) + G_Damage( traceEnt, ent, ent, forward, tr.endpos, 100, DAMAGE_NO_KNOCKBACK, MOD_VENOM ); +/* if( traceEnt->client ) { if( !( traceEnt->client->ps.stats[ STAT_STATE ] & SS_POISONED ) ) { traceEnt->client->ps.stats[ STAT_STATE ] |= SS_POISONED; traceEnt->client->lastPoisonTime = level.time; } - } + }*/ return qtrue; } |