summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Angus <tim@ngus.net>2001-04-01 02:38:15 +0000
committerTim Angus <tim@ngus.net>2001-04-01 02:38:15 +0000
commit8984c48f6db7d5705af9cdf7eeeb2ffce6ca1a21 (patch)
tree48e652ed447aff2929e938a2ed8ee604bf91cd06
parentf5392aaef785aeaf7eb56b448c6deeb42fea00e2 (diff)
Added hivemind and associated infacstructure
-rw-r--r--src/cgame/cg_draw.c24
-rw-r--r--src/cgame/cg_event.c22
-rw-r--r--src/game/bg_misc.c48
-rw-r--r--src/game/bg_public.h9
-rw-r--r--src/game/g_buildable.c55
-rw-r--r--src/game/g_cmds.c17
-rw-r--r--src/game/g_combat.c2
-rw-r--r--src/game/g_local.h4
8 files changed, 161 insertions, 20 deletions
diff --git a/src/cgame/cg_draw.c b/src/cgame/cg_draw.c
index 02e77449..1c2067ca 100644
--- a/src/cgame/cg_draw.c
+++ b/src/cgame/cg_draw.c
@@ -548,8 +548,6 @@ static void CG_DrawStatusBar( void ) {
int awidth = (int)( (float)allocated / ( total / PWR_WIDTH ) );
int pwidth = (int)( (float)powered / ( total / PWR_WIDTH ) );
vec4_t bcolor = { 0.5, 0.5, 0.5, 0.5 };
-
- //Com_Printf( "%d %d %d\n", allocated, powered, total );
trap_R_SetColor( bcolor ); // white
CG_DrawPic( PWR_X, PWR_Y, PWR_WIDTH, PWR_HEIGHT, cgs.media.whiteShader );
@@ -565,6 +563,28 @@ static void CG_DrawStatusBar( void ) {
}
//
+ // hive
+ //
+ #define HV_HEIGHT 10
+ #define HV_WIDTH 80
+ #define HV_X 555
+ #define HV_Y 20
+ if( ps->stats[ STAT_PTEAM ] == PTE_DROIDS )
+ {
+ int total = cgs.dBuildPointsTotal;
+ int allocated = total - cgs.dBuildPoints;
+
+ int awidth = (int)( (float)allocated / ( total / HV_WIDTH ) );
+ vec4_t bcolor = { 0.5, 0.5, 0.5, 0.5 };
+
+ trap_R_SetColor( bcolor ); // white
+ CG_DrawPic( HV_X, HV_Y, HV_WIDTH, HV_HEIGHT, cgs.media.whiteShader );
+
+ trap_R_SetColor( colors[0] ); // green
+ CG_DrawPic( HV_X, HV_Y, awidth, HV_HEIGHT, cgs.media.whiteShader );
+ }
+
+ //
// health+armor
//
if( ps->stats[ STAT_PTEAM ] == PTE_DROIDS )
diff --git a/src/cgame/cg_event.c b/src/cgame/cg_event.c
index 851022b8..0e62f75d 100644
--- a/src/cgame/cg_event.c
+++ b/src/cgame/cg_event.c
@@ -147,10 +147,10 @@ static void CG_Obituary( entityState_t *ent ) {
message = "was in the wrong place";
break;
case MOD_HSPAWN:
- message = "should have run further";
+ message = "should have run further";
break;
- case MOD_ASPAWN:
- message = "was melted by the acid blood";
+ case MOD_DSPAWN:
+ message = "was melted by the acid blood";
break;
default:
message = NULL;
@@ -466,6 +466,22 @@ void CG_Menu( int eventParm )
trap_SendConsoleCommand( "menu dnocreep\n" );
break;
+ case MN_D_NOHVMND:
+ trap_SendConsoleCommand( "menu dnohvmnd\n" );
+ break;
+
+ case MN_D_HIVEMIND:
+ trap_SendConsoleCommand( "menu dhivemind\n" );
+ break;
+
+ case MN_D_NOASSERT:
+ trap_SendConsoleCommand( "menu dnoassert\n" );
+ break;
+
+ case MN_D_SPWNWARN:
+ trap_SendConsoleCommand( "menu dspwnwarn\n" );
+ break;
+
case MN_H_REACTOR:
trap_SendConsoleCommand( "menu hreactor\n" );
break;
diff --git a/src/game/bg_misc.c b/src/game/bg_misc.c
index a96cc0d9..ca39fcef 100644
--- a/src/game/bg_misc.c
+++ b/src/game/bg_misc.c
@@ -771,6 +771,22 @@ TA: droid defense item
"" //sounds
},
+/*QUAKED team_droid_hivemind (0 0 1) (-16 -16 -16) (16 16 16)
+TA: droid build limitation item
+*/
+ {
+ "team_droid_hivemind",
+ "sound/items/holdable.wav",
+ { "models/powerups/instant/invis.md3", 0, 0, 0 },
+ "icons/teleporter", //icon
+ "Droid Hivemind", //pickup
+ 0,
+ IT_BUILDABLE,
+ BA_D_HIVEMIND,
+ "", //precache
+ "" //sounds
+ },
+
/*QUAKED team_human_spawn (0 0 1) (-16 -16 -16) (16 16 16)
TA: human spawn item
*/
@@ -931,12 +947,12 @@ buildableAttributes_t bg_buildableList[ ] =
"team_droid_spawn",
{ -15, -15, -15 },
{ 15, 15, 15 },
- 0,
+ 100,
1000,
50,
50,
200,
- MOD_ASPAWN,
+ MOD_DSPAWN,
BIT_DROIDS,
EV_ITEM_GROW,
100,
@@ -949,12 +965,12 @@ buildableAttributes_t bg_buildableList[ ] =
"team_droid_def1",
{ -15, -15, -15 },
{ 15, 15, 15 },
- 0,
+ 80,
1000,
50,
20,
50,
- MOD_ASPAWN,
+ MOD_DSPAWN,
BIT_DROIDS,
EV_ITEM_GROW,
100,
@@ -962,6 +978,24 @@ buildableAttributes_t bg_buildableList[ ] =
qfalse
},
{
+ BA_D_HIVEMIND,
+ "hivemind",
+ "team_droid_hivemind",
+ { -15, -15, -15 },
+ { 15, 15, 15 },
+ 0,
+ 1000,
+ 50,
+ 20,
+ 50,
+ MOD_DSPAWN,
+ BIT_DROIDS,
+ EV_ITEM_GROW,
+ -1,
+ qfalse,
+ qtrue
+ },
+ {
BA_H_SPAWN,
"replicator",
"team_human_spawn",
@@ -990,7 +1024,7 @@ buildableAttributes_t bg_buildableList[ ] =
50,
20,
50,
- MOD_ASPAWN,
+ MOD_HSPAWN,
BIT_HUMANS,
EV_NONE,
50,
@@ -1363,10 +1397,10 @@ int BG_FindCreepTestForBuildable( int bclass )
/*
==============
-BG_FindReactorTestForBuildable
+BG_FindUniqueTestForBuildable
==============
*/
-int BG_FindReactorTestForBuildable( int bclass )
+int BG_FindUniqueTestForBuildable( int bclass )
{
int i;
diff --git a/src/game/bg_public.h b/src/game/bg_public.h
index ea60c52f..4d6fc8a6 100644
--- a/src/game/bg_public.h
+++ b/src/game/bg_public.h
@@ -374,6 +374,7 @@ typedef enum {
BA_D_SPAWN,
BA_D_DEF1,
+ BA_D_HIVEMIND,
BA_H_SPAWN,
BA_H_DEF1,
BA_H_MCU,
@@ -521,6 +522,10 @@ typedef enum
MN_D_INFEST,
MN_D_NOROOM,
MN_D_NOCREEP,
+ MN_D_NOHVMND,
+ MN_D_HIVEMIND,
+ MN_D_NOASSERT,
+ MN_D_SPWNWARN,
MN_H_SPAWN,
MN_H_BUILD,
MN_H_MCU,
@@ -675,7 +680,7 @@ typedef enum {
MOD_GRAPPLE,
MOD_VENOM,
MOD_HSPAWN,
- MOD_ASPAWN
+ MOD_DSPAWN
} meansOfDeath_t;
@@ -808,7 +813,7 @@ int BG_FindTeamForBuildable( int bclass );
int BG_FindEventForBuildable( int bclass );
int BG_FindNextThinkForBuildable( int bclass );
int BG_FindCreepTestForBuildable( int bclass );
-int BG_FindReactorTestForBuildable( int bclass );
+int BG_FindUniqueTestForBuildable( int bclass );
int BG_FindClassNumForName( char *name );
char *BG_FindNameForClassNum( int pclass );
diff --git a/src/game/g_buildable.c b/src/game/g_buildable.c
index 4ca06519..f73a0b5e 100644
--- a/src/game/g_buildable.c
+++ b/src/game/g_buildable.c
@@ -41,6 +41,7 @@ qboolean findPower( gentity_t *self )
int distance = 0;
int minDistance = 10000;
vec3_t temp_v;
+ qboolean foundPower = qfalse;
if( self->parentNode && self->parentNode->active )
return qtrue;
@@ -50,6 +51,9 @@ qboolean findPower( gentity_t *self )
for ( i = 1, ent = g_entities + i; i < level.num_entities; i++, ent++ )
{
+ if( !ent->classname )
+ continue;
+
if( !Q_stricmp( ent->classname, "team_human_reactor" ) ||
!Q_stricmp( ent->classname, "team_human_repeater" ) )
{
@@ -59,9 +63,13 @@ qboolean findPower( gentity_t *self )
{
closestPower = ent;
minDistance = distance;
+ foundPower = qtrue;
}
}
}
+
+ if( !foundPower )
+ return qfalse;
if( (
!Q_stricmp( closestPower->classname, "team_human_reactor" ) &&
@@ -131,9 +139,11 @@ Called when an droid spawn dies
*/
void DSpawn_Melt( gentity_t *self )
{
- G_SelectiveRadiusDamage( self->s.pos.trBase, self->parent, 2,
- self->splashRadius, self, self->splashMethodOfDeath, PTE_DROIDS );
+ //FIXME: this line crashes the QVM (but not binary when MOD is set to MOD_[H/D]SPAWN
+ G_SelectiveRadiusDamage( self->s.pos.trBase, self->parent, self->splashDamage,
+ self->splashRadius, self, MOD_SHOTGUN, PTE_DROIDS );
+
if( ( self->timestamp + 500 ) == level.time )
G_AddEvent( self, EV_ITEM_RECEDE, 0 );
@@ -239,7 +249,8 @@ void DDef1_Think( gentity_t *self )
{
for ( i = 1, ent = g_entities + i; i < level.num_entities; i++, ent++ )
{
- if( !Q_stricmp( ent->classname, "team_droid_spawn" ) )
+ if( !Q_stricmp( ent->classname, "team_droid_spawn" ) ||
+ !Q_stricmp( ent->classname, "team_droid_hivemind" ) )
{
VectorSubtract( self->s.origin, ent->s.origin, temp_v );
distance = VectorLength( temp_v );
@@ -601,11 +612,15 @@ itemBuildError_t itemFits( gentity_t *ent, buildable_t buildable, int distance )
if( ent->client->ps.stats[ STAT_PTEAM ] == PTE_DROIDS )
{
//droid criteria
+ if( level.droidBuildPoints - BG_FindBuildPointsForBuildable( buildable ) < 0 )
+ reason = IBE_NOASSERT;
+
if( BG_FindCreepTestForBuildable( buildable ) )
{
for ( i = 1, tempent = g_entities + i; i < level.num_entities; i++, tempent++ )
{
- if( !Q_stricmp( tempent->classname, "team_droid_spawn" ) )
+ if( !Q_stricmp( tempent->classname, "team_droid_spawn" ) ||
+ !Q_stricmp( tempent->classname, "team_droid_hivemind" ) )
{
VectorSubtract( entity_origin, tempent->s.origin, temp_v );
if( VectorLength( temp_v ) <= ( CREEP_BASESIZE * 3 ) )
@@ -616,6 +631,32 @@ itemBuildError_t itemFits( gentity_t *ent, buildable_t buildable, int distance )
if( i >= level.num_entities )
reason = IBE_NOCREEP;
}
+
+ for ( i = 1, tempent = g_entities + i; i < level.num_entities; i++, tempent++ )
+ {
+ if( !Q_stricmp( tempent->classname, "team_droid_hivemind" ) )
+ break;
+ }
+
+ if( i >= level.num_entities && buildable != BA_D_HIVEMIND )
+ {
+ if( buildable == BA_D_SPAWN )
+ reason = IBE_SPWNWARN;
+ else
+ reason = IBE_NOHIVEMIND;
+ }
+
+ if( BG_FindUniqueTestForBuildable( buildable ) )
+ {
+ for ( i = 1, tempent = g_entities + i; i < level.num_entities; i++, tempent++ )
+ {
+ if( !Q_stricmp( tempent->classname, "team_droid_hivemind" ) )
+ {
+ reason = IBE_HIVEMIND;
+ break;
+ }
+ }
+ }
}
else if( ent->client->ps.stats[ STAT_PTEAM ] == PTE_HUMANS )
{
@@ -659,7 +700,7 @@ itemBuildError_t itemFits( gentity_t *ent, buildable_t buildable, int distance )
reason = IBE_RPTWARN;
}
- if( BG_FindReactorTestForBuildable( buildable ) )
+ if( BG_FindUniqueTestForBuildable( buildable ) )
{
for ( i = 1, tempent = g_entities + i; i < level.num_entities; i++, tempent++ )
{
@@ -729,6 +770,10 @@ gentity_t *Build_Item( gentity_t *ent, buildable_t buildable, int distance ) {
built->die = DDef1_Die;
built->think = DDef1_Think;
}
+ else if( buildable == BA_D_HIVEMIND )
+ {
+ built->die = DSpawn_Die;
+ }
else if( buildable == BA_H_SPAWN )
{
built->die = HSpawn_Die;
diff --git a/src/game/g_cmds.c b/src/game/g_cmds.c
index cf7af411..b97dcefb 100644
--- a/src/game/g_cmds.c
+++ b/src/game/g_cmds.c
@@ -1928,9 +1928,26 @@ void Cmd_Build_f( gentity_t *ent )
G_AddPredictableEvent( ent, EV_MENU, MN_D_NOCREEP );
break;
+ case IBE_NOASSERT:
+ G_AddPredictableEvent( ent, EV_MENU, MN_D_NOASSERT );
+ break;
+
+ case IBE_NOHIVEMIND:
+ G_AddPredictableEvent( ent, EV_MENU, MN_D_NOHVMND );
+ break;
+
+ case IBE_HIVEMIND:
+ G_AddPredictableEvent( ent, EV_MENU, MN_D_HIVEMIND );
+ break;
+
case IBE_NOROOM:
G_AddPredictableEvent( ent, EV_MENU, MN_D_NOROOM );
break;
+
+ case IBE_SPWNWARN:
+ G_AddPredictableEvent( ent, EV_MENU, MN_D_SPWNWARN );
+ Build_Item( ent, buildable, -50 );
+ break;
}
}
}
diff --git a/src/game/g_combat.c b/src/game/g_combat.c
index fbefaf26..69c65d60 100644
--- a/src/game/g_combat.c
+++ b/src/game/g_combat.c
@@ -250,7 +250,7 @@ char *modNames[] = {
"MOD_GRAPPLE",
"MOD_VENOM",
"MOD_HSPAWN",
- "MOD_ASPAWN"
+ "MOD_DSPAWN"
};
diff --git a/src/game/g_local.h b/src/game/g_local.h
index b6c0aeb1..66aa53de 100644
--- a/src/game/g_local.h
+++ b/src/game/g_local.h
@@ -482,6 +482,10 @@ typedef enum
IBE_NOROOM,
IBE_NOCREEP,
+ IBE_NOHIVEMIND,
+ IBE_HIVEMIND,
+ IBE_NOASSERT,
+ IBE_SPWNWARN,
IBE_REACTOR,
IBE_REPEATER,
IBE_RPLWARN,