summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/cgame/cg_event.c1
-rw-r--r--src/game/bg_misc.c43
-rw-r--r--src/game/bg_public.h3
-rw-r--r--src/game/g_buildable.c58
-rw-r--r--src/game/g_cmds.c4
-rw-r--r--src/game/g_local.h1
6 files changed, 96 insertions, 14 deletions
diff --git a/src/cgame/cg_event.c b/src/cgame/cg_event.c
index 20725c36..1da5612c 100644
--- a/src/cgame/cg_event.c
+++ b/src/cgame/cg_event.c
@@ -445,6 +445,7 @@ void CG_Menu( int eventParm )
case MN_A_NORMAL: trap_SendConsoleCommand( "menu tremulous_alien_surface\n" ); break;
case MN_H_REACTOR: trap_SendConsoleCommand( "menu tremulous_human_one_reactor\n" ); break;
case MN_H_REPEATER: trap_SendConsoleCommand( "menu tremulous_human_repeater\n" ); break;
+ case MN_H_NODCC: trap_SendConsoleCommand( "menu tremulous_human_dcc\n" ); break;
case MN_H_RPLWARN: trap_SendConsoleCommand( "menu tremulous_human_replicator_warning\n" ); break;
case MN_H_RPTWARN: trap_SendConsoleCommand( "menu tremulous_human_repeater_warning\n" ); break;
case MN_H_NOSLOTS: trap_SendConsoleCommand( "menu tremulous_human_no_slots\n" ); break;
diff --git a/src/game/bg_misc.c b/src/game/bg_misc.c
index ea004514..564cdef0 100644
--- a/src/game/bg_misc.c
+++ b/src/game/bg_misc.c
@@ -48,6 +48,7 @@ buildableAttributes_t bg_buildableList[ ] =
qtrue, //qboolean invertNormal;
qfalse, //qboolean creepTest;
120, //int creepSize;
+ qfalse, //qboolean dccTest;
qfalse //qboolean reactorTest;
},
{
@@ -78,6 +79,7 @@ buildableAttributes_t bg_buildableList[ ] =
qfalse, //qboolean invertNormal;
qtrue, //qboolean creepTest;
120, //int creepSize;
+ qfalse, //qboolean dccTest;
qfalse //qboolean reactorTest;
},
{
@@ -108,6 +110,7 @@ buildableAttributes_t bg_buildableList[ ] =
qfalse, //qboolean invertNormal;
qtrue, //qboolean creepTest;
120, //int creepSize;
+ qfalse, //qboolean dccTest;
qfalse //qboolean reactorTest;
},
{
@@ -138,6 +141,7 @@ buildableAttributes_t bg_buildableList[ ] =
qtrue, //qboolean invertNormal;
qtrue, //qboolean creepTest;
120, //int creepSize;
+ qfalse, //qboolean dccTest;
qfalse //qboolean reactorTest;
},
{
@@ -168,6 +172,7 @@ buildableAttributes_t bg_buildableList[ ] =
qtrue, //qboolean invertNormal;
qtrue, //qboolean creepTest;
30, //int creepSize;
+ qfalse, //qboolean dccTest;
qfalse //qboolean reactorTest;
},
{
@@ -198,6 +203,7 @@ buildableAttributes_t bg_buildableList[ ] =
qfalse, //qboolean invertNormal;
qfalse, //qboolean creepTest;
120, //int creepSize;
+ qfalse, //qboolean dccTest;
qtrue //qboolean reactorTest;
},
{
@@ -228,6 +234,7 @@ buildableAttributes_t bg_buildableList[ ] =
qtrue, //qboolean invertNormal;
qtrue, //qboolean creepTest;
120, //int creepSize;
+ qfalse, //qboolean dccTest;
qfalse //qboolean reactorTest;
},
{
@@ -258,6 +265,7 @@ buildableAttributes_t bg_buildableList[ ] =
qfalse, //qboolean invertNormal;
qfalse, //qboolean creepTest;
0, //int creepSize;
+ qfalse, //qboolean dccTest;
qfalse //qboolean reactorTest;
},
{
@@ -288,6 +296,7 @@ buildableAttributes_t bg_buildableList[ ] =
qfalse, //qboolean invertNormal;
qfalse, //qboolean creepTest;
0, //int creepSize;
+ qfalse, //qboolean dccTest;
qfalse //qboolean reactorTest;
},
{
@@ -318,6 +327,7 @@ buildableAttributes_t bg_buildableList[ ] =
qfalse, //qboolean invertNormal;
qfalse, //qboolean creepTest;
0, //int creepSize;
+ qtrue, //qboolean dccTest;
qfalse //qboolean reactorTest;
},
{
@@ -348,6 +358,7 @@ buildableAttributes_t bg_buildableList[ ] =
qfalse, //qboolean invertNormal;
qfalse, //qboolean creepTest;
0, //int creepSize;
+ qfalse, //qboolean dccTest;
qfalse //qboolean reactorTest;
},
{
@@ -380,6 +391,7 @@ buildableAttributes_t bg_buildableList[ ] =
qfalse, //qboolean invertNormal;
qfalse, //qboolean creepTest;
0, //int creepSize;
+ qfalse, //qboolean dccTest;
qfalse //qboolean reactorTest;
},
{
@@ -410,6 +422,7 @@ buildableAttributes_t bg_buildableList[ ] =
qfalse, //qboolean invertNormal;
qfalse, //qboolean creepTest;
0, //int creepSize;
+ qtrue, //qboolean dccTest;
qfalse //qboolean reactorTest;
},
{
@@ -440,6 +453,7 @@ buildableAttributes_t bg_buildableList[ ] =
qfalse, //qboolean invertNormal;
qfalse, //qboolean creepTest;
0, //int creepSize;
+ qfalse, //qboolean dccTest;
qfalse //qboolean reactorTest;
},
{
@@ -470,6 +484,7 @@ buildableAttributes_t bg_buildableList[ ] =
qfalse, //qboolean invertNormal;
qfalse, //qboolean creepTest;
0, //int creepSize;
+ qfalse, //qboolean dccTest;
qfalse //qboolean reactorTest;
},
{
@@ -500,6 +515,7 @@ buildableAttributes_t bg_buildableList[ ] =
qfalse, //qboolean invertNormal;
qfalse, //qboolean creepTest;
0, //int creepSize;
+ qfalse, //qboolean dccTest;
qfalse //qboolean reactorTest;
},
{
@@ -530,6 +546,7 @@ buildableAttributes_t bg_buildableList[ ] =
qfalse, //qboolean invertNormal;
qfalse, //qboolean creepTest;
0, //int creepSize;
+ qfalse, //qboolean dccTest;
qtrue //qboolean reactorTest;
},
{
@@ -560,6 +577,7 @@ buildableAttributes_t bg_buildableList[ ] =
qfalse, //qboolean invertNormal;
qfalse, //qboolean creepTest;
0, //int creepSize;
+ qfalse, //qboolean dccTest;
qfalse //qboolean reactorTest;
},
{
@@ -568,8 +586,8 @@ buildableAttributes_t bg_buildableList[ ] =
"Floatmine", //char *humanName;
"team_human_floatmine",//char *entityName;
{ "models/buildables/floatmine/floatmine.md3", 0, 0, 0 },
- { -15, -15, -15 }, //vec3_t mins;
- { 15, 15, 15 }, //vec3_t maxs;
+ { -25, -25, -25 }, //vec3_t mins;
+ { 25, 25, 25 }, //vec3_t maxs;
TR_BUOYANCY, //trType_t traj;
0.2, //float bounce;
10, //int buildPoints;
@@ -590,6 +608,7 @@ buildableAttributes_t bg_buildableList[ ] =
qfalse, //qboolean invertNormal;
qfalse, //qboolean creepTest;
0, //int creepSize;
+ qfalse, //qboolean dccTest;
qfalse //qboolean reactorTest;
}
};
@@ -1145,6 +1164,26 @@ int BG_FindCreepSizeForBuildable( int bclass )
/*
==============
+BG_FindDCCTestForBuildable
+==============
+*/
+int BG_FindDCCTestForBuildable( int bclass )
+{
+ int i;
+
+ for( i = 0; i < bg_numBuildables; i++ )
+ {
+ if( bg_buildableList[ i ].buildNum == bclass )
+ {
+ return bg_buildableList[ i ].dccTest;
+ }
+ }
+
+ return qfalse;
+}
+
+/*
+==============
BG_FindUniqueTestForBuildable
==============
*/
diff --git a/src/game/bg_public.h b/src/game/bg_public.h
index 551b6bbd..8c68c80b 100644
--- a/src/game/bg_public.h
+++ b/src/game/bg_public.h
@@ -588,6 +588,7 @@ typedef enum
MN_H_RPTWARN,
MN_H_NOSLOTS,
MN_H_NOFUNDS,
+ MN_H_NODCC,
MN_H_ITEMHELD
} dynMenu_t;
@@ -906,6 +907,7 @@ typedef struct
qboolean creepTest;
int creepSize;
+ qboolean dccTest;
qboolean reactorTest;
} buildableAttributes_t;
@@ -986,6 +988,7 @@ float BG_FindMinNormalForBuildable( int bclass );
qboolean BG_FindInvertNormalForBuildable( int bclass );
int BG_FindCreepTestForBuildable( int bclass );
int BG_FindCreepSizeForBuildable( int bclass );
+int BG_FindDCCTestForBuildable( int bclass );
int BG_FindUniqueTestForBuildable( int bclass );
int BG_FindClassNumForName( char *name );
diff --git a/src/game/g_buildable.c b/src/game/g_buildable.c
index 0a8557ae..eb5312a3 100644
--- a/src/game/g_buildable.c
+++ b/src/game/g_buildable.c
@@ -177,6 +177,22 @@ static qboolean findDCC( gentity_t *self )
/*
================
+isDCC
+
+simple wrapper to findDCC to check for a dcc
+================
+*/
+static qboolean isDCC( )
+{
+ gentity_t dummy;
+
+ dummy.dccNode = NULL;
+
+ return findDCC( &dummy );
+}
+
+/*
+================
findCreep
attempt to find creep for self, return qtrue if successful
@@ -1071,6 +1087,27 @@ void HMedistat_Think( gentity_t *self )
gentity_t *player;
int healCount = 0;
int maxclients;
+
+ //make sure we have power
+ if( !( self->dcced = findPower( self ) ) )
+ {
+ self->nextthink = level.time + REFRESH_TIME;
+ return;
+ }
+
+ if( self->s.modelindex == BA_H_ADVMEDISTAT )
+ {
+ maxclients = MAX_ADVMEDISTAT_CLIENTS;
+
+ //the advanced medistat requires a DCC
+ if( !( self->dcced = findDCC( self ) ) )
+ {
+ self->nextthink = level.time + REFRESH_TIME;
+ return;
+ }
+ }
+ else
+ maxclients = MAX_MEDISTAT_CLIENTS;
VectorAdd( self->s.origin, self->r.maxs, maxs );
VectorAdd( self->s.origin, self->r.mins, mins );
@@ -1078,18 +1115,10 @@ void HMedistat_Think( gentity_t *self )
mins[ 2 ] += fabs( self->r.mins[ 2 ] ) + self->r.maxs[ 2 ];
maxs[ 2 ] += 60; //player height
- //make sure we have power
- self->powered = findPower( self );
-
//if active use the healing idle
if( self->active )
G_setIdleBuildableAnim( self, BANIM_IDLE2 );
- if( self->s.modelindex == BA_H_ADVMEDISTAT )
- maxclients = MAX_ADVMEDISTAT_CLIENTS;
- else
- maxclients = MAX_MEDISTAT_CLIENTS;
-
//do some healage
num = trap_EntitiesInBox( mins, maxs, entityList, MAX_GENTITIES );
for( i = 0; i < num; i++ )
@@ -1393,6 +1422,10 @@ void hdef3_fireonenemy( gentity_t *self, int firespeed )
{
vec3_t dirToTarget;
+ //this doesn't operate without a dcc
+ if( !self->dcced )
+ return;
+
VectorSubtract( self->enemy->s.pos.trBase, self->s.pos.trBase, dirToTarget );
VectorNormalize( dirToTarget );
vectoangles( dirToTarget, self->turretAim );
@@ -1505,11 +1538,8 @@ void HDef_Think( gentity_t *self )
self->nextthink = level.time + BG_FindNextThinkForBuildable( self->s.modelindex );
- //find power for self
- self->powered = findPower( self );
-
//if not powered don't do anything and check again for power next think
- if( !self->powered )
+ if( !( self->powered = findPower( self ) ) )
{
self->nextthink = level.time + REFRESH_TIME;
return;
@@ -1796,6 +1826,10 @@ itemBuildError_t G_itemFits( gentity_t *ent, buildable_t buildable, int distance
reason = IBE_RPLWARN;
}
+ //this buildable requires a DCC
+ if( BG_FindDCCTestForBuildable( buildable ) && !isDCC( ) )
+ reason = IBE_NODCC;
+
//check that there is a parent reactor when building a repeater
if( buildable == BA_H_REPEATER )
{
diff --git a/src/game/g_cmds.c b/src/game/g_cmds.c
index 9d307a09..10680949 100644
--- a/src/game/g_cmds.c
+++ b/src/game/g_cmds.c
@@ -2209,6 +2209,10 @@ void Cmd_Build_f( gentity_t *ent )
case IBE_NOCREEP:
G_AddPredictableEvent( ent, EV_MENU, MN_A_NOCREEP );
break;
+
+ case IBE_NODCC:
+ G_AddPredictableEvent( ent, EV_MENU, MN_H_NODCC );
+ break;
}
}
else
diff --git a/src/game/g_local.h b/src/game/g_local.h
index b4d71604..aeba3c64 100644
--- a/src/game/g_local.h
+++ b/src/game/g_local.h
@@ -544,6 +544,7 @@ typedef enum
IBE_NOPOWER,
IBE_NORMAL,
IBE_NOCREEP,
+ IBE_NODCC,
IBE_MAXERRORS
} itemBuildError_t;