summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/cgame/cg_ents.c6
-rw-r--r--src/game/bg_misc.c30
-rw-r--r--src/game/bg_public.h5
-rw-r--r--src/game/g_client.c43
-rw-r--r--src/game/g_cmds.c6
-rw-r--r--src/game/g_local.h3
6 files changed, 80 insertions, 13 deletions
diff --git a/src/cgame/cg_ents.c b/src/cgame/cg_ents.c
index 66e6e8f9..4a73d643 100644
--- a/src/cgame/cg_ents.c
+++ b/src/cgame/cg_ents.c
@@ -651,8 +651,10 @@ static void CG_TorchLight( centity_t *cent )
VectorSubtract( tr.endpos, from, length );
veclength = VectorLength( length );
+
+ trap_R_AddLightToScene( tr.endpos, 200, 0.0, 0.0, 1.0 );
- size = veclength / 2.0f;
+/* size = veclength / 2.0f;
if( size > 255 ) size = 255;
if( size < 0 ) size = 0;
@@ -741,7 +743,7 @@ static void CG_TorchLight( centity_t *cent )
else if( lum >= 46 )
trap_R_AddPolyToScene( cgs.media.humanTorch1, mf->numPoints, verts );
}
- }
+ }*/
}
/*
diff --git a/src/game/bg_misc.c b/src/game/bg_misc.c
index 4cfcfc70..61ac0e23 100644
--- a/src/game/bg_misc.c
+++ b/src/game/bg_misc.c
@@ -1439,7 +1439,8 @@ classAttributes_t bg_classList[ ] =
0.5f,
1.0f,
{ PCL_D_D_BASE, PCL_D_O_BASE, PCL_NONE },
- 2000
+ 2000,
+ 100
},
{
PCL_D_O_BASE,
@@ -1461,7 +1462,8 @@ classAttributes_t bg_classList[ ] =
2.0f,
5.0f,
{ PCL_D_D_BASE, PCL_D_B_BASE, PCL_NONE },
- 3000
+ 3000,
+ 100
},
{
PCL_D_D_BASE,
@@ -1483,7 +1485,8 @@ classAttributes_t bg_classList[ ] =
1.5f,
3.0f,
{ PCL_D_O_BASE, PCL_D_B_BASE, PCL_NONE },
- 1000
+ 1000,
+ 100
},
{
PCL_H_BASE,
@@ -1505,6 +1508,7 @@ classAttributes_t bg_classList[ ] =
1.0f,
1.0f,
{ PCL_NONE, PCL_NONE, PCL_NONE },
+ 0,
0
}
};
@@ -1856,6 +1860,26 @@ int BG_FindEvolveTimeForClass( int pclass )
return 5000;
}
+/*
+==============
+BG_FindValueOfClass
+==============
+*/
+int BG_FindValueOfClass( int pclass )
+{
+ int i;
+
+ for( i = 0; i < bg_numPclasses; i++ )
+ {
+ if( bg_classList[ i ].classNum == pclass )
+ {
+ return bg_classList[ i ].value;
+ }
+ }
+
+ return 0;
+}
+
////////////////////////////////////////////////////////////////////////////////
weaponAttributes_t bg_weapons[ ] =
diff --git a/src/game/bg_public.h b/src/game/bg_public.h
index 07353455..74767474 100644
--- a/src/game/bg_public.h
+++ b/src/game/bg_public.h
@@ -241,7 +241,8 @@ typedef enum {
STAT_PCLASS, //TA: player class (for droids AND humans)
STAT_PTEAM, //TA: player team
STAT_STAMINA, //TA: stamina (human only)
- STAT_STATE //TA: client states e.g. wall climbing
+ STAT_STATE, //TA: client states e.g. wall climbing
+ STAT_CREDIT //TA: human credit
} statIndex_t;
#define SCA_WALLCLIMBER 1
@@ -772,6 +773,7 @@ typedef struct
int children[ 3 ];
int timeToEvolve;
+ int value;
} classAttributes_t;
//TA: buildable item record
@@ -879,6 +881,7 @@ int BG_FindSteptimeForClass( int pclass );
qboolean BG_ClassHasAbility( int pclass, int ability );
qboolean BG_ClassCanEvolveFromTo( int fclass, int tclass );
int BG_FindEvolveTimeForClass( int pclass );
+int BG_FindValueOfClass( int pclass );
int BG_FindPriceForWeapon( int weapon );
int BG_FindSlotsForWeapon( int weapon );
diff --git a/src/game/g_client.c b/src/game/g_client.c
index 810ad6d6..96fb3651 100644
--- a/src/game/g_client.c
+++ b/src/game/g_client.c
@@ -533,16 +533,46 @@ void BodySink( gentity_t *ent ) {
/*
================
-InfestBody
+useBody
-Called when a droid infests a body
+Called when a body is used
================
*/
-void InfestBody( gentity_t *self, gentity_t *other, gentity_t *activator )
+void useBody( gentity_t *self, gentity_t *other, gentity_t *activator )
{
- if( activator->client->ps.stats[ STAT_PTEAM ] != PTE_DROIDS ) return;
+ int i, class;
+ int total = 0;
+ float numerator, denominator;
+
+ if( activator->client->ps.stats[ STAT_PTEAM ] == PTE_DROIDS )
+ {
+ G_AddPredictableEvent( activator, EV_MENU, MN_D_INFEST );
+ }
+ else
+ {
+ //client has already raided this corpse
+ if( self->creditsHash[ activator->client->ps.clientNum ] ) return;
+
+ numerator = self->credits[ activator->client->ps.clientNum ];
+ class = self->s.clientNum;
+
+ //total up all the damage done by every client
+ for( i = 0; i < MAX_CLIENTS; i++ )
+ total += self->credits[ i ];
+
+ denominator = total;
+
+ //if no one did any damage client must have been killed by defense or suicide
+ //body is a "free for all"
+ if( total == 0.0f ) numerator = denominator = 1.0f;
+
+ //add credit
+ activator->client->ps.stats[ STAT_CREDIT ] += (int)( (float)BG_FindValueOfClass( class ) *
+ ( numerator / denominator ) );
- G_AddPredictableEvent( activator, EV_MENU, MN_D_INFEST );
+ //prevent clients claiming credit twice
+ self->creditsHash[ activator->client->ps.clientNum ] = qtrue;
+ }
}
/*
@@ -587,8 +617,7 @@ void SpawnCorpse( gentity_t *ent ) {
body->clipmask = MASK_PLAYERSOLID;
body->s.clientNum = ent->client->ps.stats[ STAT_PCLASS ];
- if( ent->client->ps.stats[ STAT_PTEAM ] == PTE_HUMANS )
- body->use = InfestBody;
+ body->use = useBody;
switch ( body->s.legsAnim & ~ANIM_TOGGLEBIT ) {
case BOTH_DEATH1:
diff --git a/src/game/g_cmds.c b/src/game/g_cmds.c
index 9f0d4c6a..2c42896c 100644
--- a/src/game/g_cmds.c
+++ b/src/game/g_cmds.c
@@ -2072,6 +2072,10 @@ void Cmd_Boost_f( gentity_t *ent )
ent->client->ps.stats[ STAT_STATE ] |= SS_SPEEDBOOST;
}
+void Cmd_Credit_f( gentity_t *ent )
+{
+ trap_SendServerCommand( ent-g_entities, va("print \"%d\n\"", ent->client->ps.stats[ STAT_CREDIT ] ) );
+}
/*
=================
@@ -2198,6 +2202,8 @@ void ClientCommand( int clientNum ) {
Cmd_SetViewpos_f( ent );
else if (Q_stricmp (cmd, "stats") == 0)
Cmd_Stats_f( ent );
+ else if (Q_stricmp (cmd, "credit") == 0)
+ Cmd_Credit_f( ent );
else
trap_SendServerCommand( clientNum, va("print \"unknown cmd %s\n\"", cmd ) );
}
diff --git a/src/game/g_local.h b/src/game/g_local.h
index 1a1dbfa0..a84c7c49 100644
--- a/src/game/g_local.h
+++ b/src/game/g_local.h
@@ -179,6 +179,9 @@ struct gentity_s {
vec3_t turloc; //TA: direction human defense turrets are pointing
qboolean active; //TA: for power repeater, but could be useful elsewhere
qboolean powered; //TA: for human buildables
+
+ int credits[ MAX_CLIENTS ]; //TA: human credits for each client
+ qboolean creditsHash[ MAX_CLIENTS ]; //TA: track who has claimed credit
};
typedef enum {