summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/game/bg_misc.c71
-rw-r--r--src/game/bg_public.h4
-rw-r--r--src/game/g_active.c5
-rw-r--r--src/game/g_cmds.c2
-rw-r--r--src/game/g_local.h3
-rw-r--r--src/game/g_main.c2
-rw-r--r--src/game/g_weapon.c41
7 files changed, 123 insertions, 5 deletions
diff --git a/src/game/bg_misc.c b/src/game/bg_misc.c
index d9dedb63..5acdbb01 100644
--- a/src/game/bg_misc.c
+++ b/src/game/bg_misc.c
@@ -33,6 +33,7 @@ buildableAttributes_t bg_buildableList[ ] =
100, //int buildPoints;
( 1 << S1 )|( 1 << S2 )|( 1 << S3 ), //int stages
1000, //int health;
+ 50, //int regenRate;
50, //int damage;
50, //int splashDamage;
200, //int splashRadius;
@@ -64,6 +65,7 @@ buildableAttributes_t bg_buildableList[ ] =
80, //int buildPoints;
( 1 << S1 )|( 1 << S2 )|( 1 << S3 ), //int stages
1000, //int health;
+ 50, //int regenRate;
50, //int damage;
20, //int splashDamage;
50, //int splashRadius;
@@ -95,6 +97,7 @@ buildableAttributes_t bg_buildableList[ ] =
80, //int buildPoints;
( 1 << S1 )|( 1 << S2 )|( 1 << S3 ), //int stages
1000, //int health;
+ 50, //int regenRate;
50, //int damage;
20, //int splashDamage;
50, //int splashRadius;
@@ -126,6 +129,7 @@ buildableAttributes_t bg_buildableList[ ] =
80, //int buildPoints;
( 1 << S1 )|( 1 << S2 )|( 1 << S3 ), //int stages
1000, //int health;
+ 50, //int regenRate;
50, //int damage;
20, //int splashDamage;
400, //int splashRadius;
@@ -157,6 +161,7 @@ buildableAttributes_t bg_buildableList[ ] =
80, //int buildPoints;
( 1 << S1 )|( 1 << S2 )|( 1 << S3 ), //int stages
1000, //int health;
+ 50, //int regenRate;
50, //int damage;
20, //int splashDamage;
50, //int splashRadius;
@@ -188,6 +193,7 @@ buildableAttributes_t bg_buildableList[ ] =
0, //int buildPoints;
( 1 << S1 )|( 1 << S2 )|( 1 << S3 ), //int stages
1000, //int health;
+ 50, //int regenRate;
50, //int damage;
50, //int splashDamage;
300, //int splashRadius;
@@ -219,6 +225,7 @@ buildableAttributes_t bg_buildableList[ ] =
80, //int buildPoints;
( 1 << S1 )|( 1 << S2 )|( 1 << S3 ), //int stages
1000, //int health;
+ 50, //int regenRate;
50, //int damage;
20, //int splashDamage;
50, //int splashRadius;
@@ -250,6 +257,7 @@ buildableAttributes_t bg_buildableList[ ] =
100, //int buildPoints;
( 1 << S1 )|( 1 << S2 )|( 1 << S3 ), //int stages
1000, //int health;
+ 50, //int regenRate;
50, //int damage;
50, //int splashDamage;
200, //int splashRadius;
@@ -281,6 +289,7 @@ buildableAttributes_t bg_buildableList[ ] =
100, //int buildPoints;
( 1 << S1 )|( 1 << S2 )|( 1 << S3 ), //int stages
1000, //int health;
+ 0, //int regenRate;
50, //int damage;
50, //int splashDamage;
150, //int splashRadius;
@@ -312,6 +321,7 @@ buildableAttributes_t bg_buildableList[ ] =
100, //int buildPoints;
( 1 << S1 )|( 1 << S2 )|( 1 << S3 ), //int stages
1000, //int health;
+ 0, //int regenRate;
50, //int damage;
50, //int splashDamage;
150, //int splashRadius;
@@ -343,6 +353,7 @@ buildableAttributes_t bg_buildableList[ ] =
100, //int buildPoints;
( 1 << S3 ), //int stages
1000, //int health;
+ 0, //int regenRate;
50, //int damage;
50, //int splashDamage;
150, //int splashRadius;
@@ -374,6 +385,7 @@ buildableAttributes_t bg_buildableList[ ] =
80, //int buildPoints;
( 1 << S2 )|( 1 << S3 ), //int stages
1000, //int health;
+ 0, //int regenRate;
50, //int damage;
20, //int splashDamage;
50, //int splashRadius;
@@ -407,6 +419,7 @@ buildableAttributes_t bg_buildableList[ ] =
80, //int buildPoints;
( 1 << S1 )|( 1 << S2 )|( 1 << S3 ), //int stages
1000, //int health;
+ 0, //int regenRate;
50, //int damage;
20, //int splashDamage;
50, //int splashRadius;
@@ -438,6 +451,7 @@ buildableAttributes_t bg_buildableList[ ] =
80, //int buildPoints;
( 1 << S3 ), //int stages
1000, //int health;
+ 0, //int regenRate;
50, //int damage;
20, //int splashDamage;
50, //int splashRadius;
@@ -469,6 +483,7 @@ buildableAttributes_t bg_buildableList[ ] =
200, //int buildPoints;
( 1 << S3 ), //int stages
1000, //int health;
+ 0, //int regenRate;
50, //int damage;
50, //int splashDamage;
150, //int splashRadius;
@@ -500,6 +515,7 @@ buildableAttributes_t bg_buildableList[ ] =
200, //int buildPoints;
( 1 << S2 )|( 1 << S3 ), //int stages
1000, //int health;
+ 0, //int regenRate;
50, //int damage;
50, //int splashDamage;
150, //int splashRadius;
@@ -531,6 +547,7 @@ buildableAttributes_t bg_buildableList[ ] =
200, //int buildPoints;
( 1 << S1 )|( 1 << S2 )|( 1 << S3 ), //int stages
1000, //int health;
+ 0, //int regenRate;
50, //int damage;
50, //int splashDamage;
150, //int splashRadius;
@@ -562,6 +579,7 @@ buildableAttributes_t bg_buildableList[ ] =
0, //int buildPoints;
( 1 << S1 )|( 1 << S2 )|( 1 << S3 ), //int stages
1000, //int health;
+ 0, //int regenRate;
50, //int damage;
50, //int splashDamage;
150, //int splashRadius;
@@ -593,6 +611,7 @@ buildableAttributes_t bg_buildableList[ ] =
10, //int buildPoints;
( 1 << S2 )|( 1 << S3 ), //int stages
1000, //int health;
+ 0, //int regenRate;
50, //int damage;
50, //int splashDamage;
150, //int splashRadius;
@@ -624,6 +643,7 @@ buildableAttributes_t bg_buildableList[ ] =
10, //int buildPoints;
( 1 << S2 )|( 1 << S3 ), //int stages
100, //int health;
+ 0, //int regenRate;
50, //int damage;
50, //int splashDamage;
150, //int splashRadius;
@@ -895,6 +915,26 @@ int BG_FindHealthForBuildable( int bclass )
/*
==============
+BG_FindRegenRateForBuildable
+==============
+*/
+int BG_FindRegenRateForBuildable( int bclass )
+{
+ int i;
+
+ for( i = 0; i < bg_numBuildables; i++ )
+ {
+ if( bg_buildableList[ i ].buildNum == bclass )
+ {
+ return bg_buildableList[ i ].regenRate;
+ }
+ }
+
+ return 0;
+}
+
+/*
+==============
BG_FindDamageForBuildable
==============
*/
@@ -1252,6 +1292,7 @@ classAttributes_t bg_classList[ ] =
{ 15, 15, 4 }, //vec3_t deadmaxs;
12, 12, //int viewheight, crouchviewheight;
50, //int health;
+ 5, //int regenRate;
0, //int armor;
SCA_TAKESFALLDAMAGE|SCA_FOVWARPS, //int abilities;
95.0f, //float buildDist;
@@ -1279,6 +1320,7 @@ classAttributes_t bg_classList[ ] =
{ 20, 20, 4 }, //vec3_t deadmaxs;
0, 0, //int viewheight, crouchviewheight;
75, //int health;
+ 5, //int regenRate;
10, //int armor;
SCA_CANJUMP|SCA_FOVWARPS|SCA_WALLCLIMBER, //int abilities;
95.0f, //float buildDist;
@@ -1306,6 +1348,7 @@ classAttributes_t bg_classList[ ] =
{ 15, 15, 4 }, //vec3_t deadmaxs;
0, 0, //int viewheight, crouchviewheight;
25, //int health;
+ 5, //int regenRate;
0, //int armor;
SCA_WALLCLIMBER|SCA_CANJUMP|SCA_NOWEAPONDRIFT|SCA_FOVWARPS|SCA_ALIENSENSE, //int abilities;
0.0f, //float buildDist;
@@ -1333,6 +1376,7 @@ classAttributes_t bg_classList[ ] =
{ 24, 24, 4 }, //vec3_t deadmaxs;
6, 6, //int viewheight, crouchviewheight;
50, //int health;
+ 5, //int regenRate;
5, //int armor;
SCA_CANJUMP|SCA_NOWEAPONDRIFT|SCA_FOVWARPS, //int abilities;
0.0f, //float buildDist;
@@ -1360,6 +1404,7 @@ classAttributes_t bg_classList[ ] =
{ 24, 24, 4 }, //vec3_t deadmaxs;
6, 6, //int viewheight, crouchviewheight;
50, //int health;
+ 5, //int regenRate;
5, //int armor;
SCA_CANJUMP|SCA_NOWEAPONDRIFT|SCA_FOVWARPS, //int abilities;
0.0f, //float buildDist;
@@ -1387,6 +1432,7 @@ classAttributes_t bg_classList[ ] =
{ 24, 24, 4 }, //vec3_t deadmaxs;
6, 6, //int viewheight, crouchviewheight;
50, //int health;
+ 5, //int regenRate;
10, //int armor;
SCA_CANJUMP|SCA_NOWEAPONDRIFT|SCA_FOVWARPS, //int abilities;
0.0f, //float buildDist;
@@ -1414,6 +1460,7 @@ classAttributes_t bg_classList[ ] =
{ 24, 24, 4 }, //vec3_t deadmaxs;
6, 6, //int viewheight, crouchviewheight;
50, //int health;
+ 5, //int regenRate;
10, //int armor;
SCA_CANJUMP|SCA_NOWEAPONDRIFT|SCA_FOVWARPS, //int abilities;
0.0f, //float buildDist;
@@ -1441,6 +1488,7 @@ classAttributes_t bg_classList[ ] =
{ 15, 15, 4 }, //vec3_t deadmaxs;
4, 4, //int viewheight, crouchviewheight;
100, //int health;
+ 5, //int regenRate;
20, //int armor;
SCA_CANJUMP|SCA_NOWEAPONDRIFT|SCA_FOVWARPS, //int abilities;
0.0f, //float buildDist;
@@ -1468,6 +1516,7 @@ classAttributes_t bg_classList[ ] =
{ 15, 15, 4 }, //vec3_t deadmaxs;
4, 4, //int viewheight, crouchviewheight;
100, //int health;
+ 5, //int regenRate;
20, //int armor;
SCA_CANJUMP|SCA_NOWEAPONDRIFT|SCA_FOVWARPS, //int abilities;
0.0f, //float buildDist;
@@ -1495,6 +1544,7 @@ classAttributes_t bg_classList[ ] =
{ 15, 15, 4 }, //vec3_t deadmaxs;
4, 4, //int viewheight, crouchviewheight;
100, //int health;
+ 5, //int regenRate;
30, //int armor;
SCA_CANJUMP|SCA_NOWEAPONDRIFT|SCA_FOVWARPS, //int abilities;
0.0f, //float buildDist;
@@ -1522,6 +1572,7 @@ classAttributes_t bg_classList[ ] =
{ 15, 15, 4 }, //vec3_t deadmaxs;
26, 12, //int viewheight, crouchviewheight;
100, //int health;
+ 0, //int regenRate;
0, //int armor;
SCA_TAKESFALLDAMAGE|SCA_CANJUMP, //int abilities;
110.0f, //float buildDist;
@@ -1775,6 +1826,26 @@ int BG_FindHealthForClass( int pclass )
/*
==============
+BG_FindRegenRateForClass
+==============
+*/
+int BG_FindRegenRateForClass( int pclass )
+{
+ int i;
+
+ for( i = 0; i < bg_numPclasses; i++ )
+ {
+ if( bg_classList[ i ].classNum == pclass )
+ {
+ return bg_classList[ i ].regenRate;
+ }
+ }
+
+ return 0;
+}
+
+/*
+==============
BG_FindArmorForClass
==============
*/
diff --git a/src/game/bg_public.h b/src/game/bg_public.h
index 95ec9feb..ed0f0328 100644
--- a/src/game/bg_public.h
+++ b/src/game/bg_public.h
@@ -866,6 +866,7 @@ typedef struct
int crouchViewheight;
int health;
+ int regenRate;
int armor;
int abilities;
@@ -912,6 +913,7 @@ typedef struct
int stages;
int health;
+ int regenRate;
int damage;
int splashDamage;
@@ -1019,6 +1021,7 @@ char *BG_FindEntityNameForBuildable( int bclass );
char *BG_FindModelsForBuildable( int bclass, int modelNum );
void BG_FindBBoxForBuildable( int bclass, vec3_t mins, vec3_t maxs );
int BG_FindHealthForBuildable( int bclass );
+int BG_FindRegenRateForBuildable( int bclass );
trType_t BG_FindTrajectoryForBuildable( int bclass );
float BG_FindBounceForBuildable( int bclass );
int BG_FindBuildPointsForBuildable( int bclass );
@@ -1051,6 +1054,7 @@ qboolean BG_FindStagesForClass( int pclass, stage_t stage );
void BG_FindBBoxForClass( int pclass, vec3_t mins, vec3_t maxs, vec3_t cmaxs, vec3_t dmins, vec3_t dmaxs );
void BG_FindViewheightForClass( int pclass, int *viewheight, int *cViewheight );
int BG_FindHealthForClass( int pclass );
+int BG_FindRegenRateForClass( int pclass );
int BG_FindArmorForClass( int pclass );
int BG_FindFovForClass( int pclass );
float BG_FindBobForClass( int pclass );
diff --git a/src/game/g_active.c b/src/game/g_active.c
index d423ca74..f1d77c97 100644
--- a/src/game/g_active.c
+++ b/src/game/g_active.c
@@ -549,7 +549,10 @@ void ClientTimerActions( gentity_t *ent, int msec )
if( client->ps.stats[ STAT_PTEAM ] == PTE_ALIENS )
{
if( ent->health < client->ps.stats[ STAT_MAX_HEALTH ] )
- ent->health++;
+ BG_FindRegenRateForClass( client->ps.stats[ STAT_PCLASS ] );
+
+ if( ent->health > client->ps.stats[ STAT_MAX_HEALTH ] )
+ ent->health = client->ps.stats[ STAT_MAX_HEALTH ];
}
}
}
diff --git a/src/game/g_cmds.c b/src/game/g_cmds.c
index 090762bc..5e65240a 100644
--- a/src/game/g_cmds.c
+++ b/src/game/g_cmds.c
@@ -1741,7 +1741,7 @@ void Cmd_Destroy_f( gentity_t *ent, qboolean deconstruct )
if( !( ent->client->ps.stats[ STAT_STATE ] & SS_INFESTING ) )
{
AngleVectors( ent->client->ps.viewangles, forward, NULL, NULL );
- VectorMA( ent->client->ps.origin, 50, forward, end );
+ VectorMA( ent->client->ps.origin, 100, forward, end );
trap_Trace( &tr, ent->client->ps.origin, NULL, NULL, end, ent->s.number, MASK_PLAYERSOLID );
traceEnt = &g_entities[ tr.entityNum ];
diff --git a/src/game/g_local.h b/src/game/g_local.h
index c163b20f..4967751a 100644
--- a/src/game/g_local.h
+++ b/src/game/g_local.h
@@ -176,6 +176,7 @@ struct gentity_s {
int builtBy; //TA: clientNum of person that built this
gentity_t *dccNode; //TA: controlling dcc
qboolean dcced; //TA: controlled by a dcc or not?
+ int time1000; //TA: timer evaluated every second
int credits[ MAX_CLIENTS ]; //TA: human credits for each client
qboolean creditsHash[ MAX_CLIENTS ]; //TA: track who has claimed credit
@@ -510,7 +511,7 @@ void Cmd_FollowCycle_f( gentity_t *ent, int dir );
// g_items.c
//
void G_CheckTeamItems( void );
-void G_RunItem( gentity_t *ent );
+void G_RunItem( gentity_t *ent, int msec );
void RespawnItem( gentity_t *ent );
void UseHoldableItem( gentity_t *ent );
diff --git a/src/game/g_main.c b/src/game/g_main.c
index 1e40e341..1bc024ca 100644
--- a/src/game/g_main.c
+++ b/src/game/g_main.c
@@ -1963,7 +1963,7 @@ start = trap_Milliseconds();
if ( ent->s.eType == ET_ITEM || ent->s.eType == ET_BUILDABLE ||
ent->s.eType == ET_CORPSE || ent->physicsObject ) {
- G_RunItem( ent );
+ G_RunItem( ent, msec );
continue;
}
diff --git a/src/game/g_weapon.c b/src/game/g_weapon.c
index 6174a3b4..29800953 100644
--- a/src/game/g_weapon.c
+++ b/src/game/g_weapon.c
@@ -408,7 +408,46 @@ BUILD GUN
void cancelBuildFire( gentity_t *ent )
{
- ent->client->ps.stats[ STAT_BUILDABLE ] = BA_NONE;
+ vec3_t forward, end;
+ trace_t tr;
+ gentity_t *traceEnt;
+ int bHealth;
+
+ if( ent->client->ps.stats[ STAT_BUILDABLE ] != BA_NONE )
+ {
+ ent->client->ps.stats[ STAT_BUILDABLE ] = BA_NONE;
+ return;
+ }
+
+ //repair buildable
+ if( ent->client->pers.pteam == PTE_HUMANS )
+ {
+ AngleVectors( ent->client->ps.viewangles, forward, NULL, NULL );
+ VectorMA( ent->client->ps.origin, 100, forward, end );
+
+ trap_Trace( &tr, ent->client->ps.origin, NULL, NULL, end, ent->s.number, MASK_PLAYERSOLID );
+ traceEnt = &g_entities[ tr.entityNum ];
+
+ if( tr.fraction < 1.0 &&
+ ( traceEnt->s.eType == ET_BUILDABLE ) &&
+ ( traceEnt->biteam == ent->client->pers.pteam ) &&
+ ( ( ent->client->ps.weapon >= WP_HBUILD2 ) &&
+ ( ent->client->ps.weapon <= WP_HBUILD ) ) )
+ {
+ if( ent->client->ps.stats[ STAT_MISC ] > 0 )
+ {
+ G_AddPredictableEvent( ent, EV_BUILD_DELAY, 0 );
+ return;
+ }
+
+ bHealth = BG_FindHealthForBuildable( traceEnt->s.modelindex );
+
+ traceEnt->health += ( bHealth / 10.0f );
+
+ if( traceEnt->health > bHealth )
+ traceEnt->health = bHealth;
+ }
+ }
}
void buildFire( gentity_t *ent, dynMenu_t menu )