diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/cgame/cg_servercmds.c | 22 | ||||
-rw-r--r-- | src/game/bg_public.h | 1 | ||||
-rw-r--r-- | src/game/g_cmds.c | 25 | ||||
-rw-r--r-- | src/game/g_local.h | 4 | ||||
-rw-r--r-- | src/game/g_main.c | 14 | ||||
-rw-r--r-- | src/game/g_spawn.c | 2 | ||||
-rw-r--r-- | src/game/g_trigger.c | 40 | ||||
-rw-r--r-- | src/game/g_utils.c | 2 | ||||
-rw-r--r-- | src/game/tremulous.h | 4 |
9 files changed, 102 insertions, 12 deletions
diff --git a/src/cgame/cg_servercmds.c b/src/cgame/cg_servercmds.c index da0ef801..3083e37b 100644 --- a/src/cgame/cg_servercmds.c +++ b/src/cgame/cg_servercmds.c @@ -717,15 +717,6 @@ void CG_Menu( int menu ) } break; - case MN_A_NOEROOM: - if( !cg_disableBuildWarnings.integer ) - { - trap_Cvar_Set( "ui_dialog", "There is no room to evolve here. Move away from walls or other " - "nearby objects and try again." ); - trap_SendConsoleCommand( "menu tremulous_alien_dialog\n" ); - } - break; - case MN_A_OVERMIND: if( !cg_disableBuildWarnings.integer ) { @@ -762,6 +753,19 @@ void CG_Menu( int menu ) } break; + case MN_A_NOEROOM: + trap_Cvar_Set( "ui_dialog", "There is no room to evolve here. Move away from walls or other " + "nearby objects and try again." ); + trap_SendConsoleCommand( "menu tremulous_alien_dialog\n" ); + break; + + case MN_A_TOOCLOSE: + trap_Cvar_Set( "ui_dialog", "This location is too close to the enemy to evolve. " + "Move away until you are no longer aware of the enemy's " + "presence and try again." ); + trap_SendConsoleCommand( "menu tremulous_alien_dialog\n" ); + break; + case MN_A_HOVEL_OCCUPIED: trap_Cvar_Set( "ui_dialog", "This Hovel is occupied by another builder. Please find or build " "another." ); diff --git a/src/game/bg_public.h b/src/game/bg_public.h index ff3ecf62..f00ad321 100644 --- a/src/game/bg_public.h +++ b/src/game/bg_public.h @@ -573,6 +573,7 @@ typedef enum MN_A_HOVEL_OCCUPIED, MN_A_HOVEL_BLOCKED, MN_A_NOEROOM, + MN_A_TOOCLOSE, //alien build MN_A_SPWNWARN, diff --git a/src/game/g_cmds.c b/src/game/g_cmds.c index 5e7f4138..3a98c468 100644 --- a/src/game/g_cmds.c +++ b/src/game/g_cmds.c @@ -1049,6 +1049,7 @@ void Cmd_SetViewpos_f( gentity_t *ent ) } #define EVOLVE_TRACE_HEIGHT 128.0f +#define AS_OVER_RT3 (ALIENSENSE_RANGE/M_ROOT3) /* ================= @@ -1074,6 +1075,12 @@ void Cmd_Class_f( gentity_t *ent ) vec3_t fromMins, fromMaxs, toMins, toMaxs; vec3_t temp; + int entityList[ MAX_GENTITIES ]; + vec3_t range = { AS_OVER_RT3, AS_OVER_RT3, AS_OVER_RT3 }; + vec3_t mins, maxs, dir; + int num; + gentity_t *other; + clientNum = ent->client - level.clients; trap_Argv( 1, s, sizeof( s ) ); @@ -1100,6 +1107,24 @@ void Cmd_Class_f( gentity_t *ent ) //if we are not currently spectating, we are attempting evolution if( ent->client->ps.stats[ STAT_PCLASS ] != PCL_NONE ) { + //check there are no humans nearby + VectorAdd( ent->client->ps.origin, range, maxs ); + VectorSubtract( ent->client->ps.origin, range, mins ); + + num = trap_EntitiesInBox( mins, maxs, entityList, MAX_GENTITIES ); + for( i = 0; i < num; i++ ) + { + other = &g_entities[ entityList[ i ] ]; + + if( ( other->client && other->client->ps.stats[ STAT_PTEAM ] == PTE_HUMANS ) || + ( other->s.eType == ET_BUILDABLE && other->biteam == BIT_HUMANS ) ) + { + ent->client->pers.classSelection = PCL_NONE; + G_TriggerMenu( clientNum, MN_A_TOOCLOSE ); + return; + } + } + //evolve now ent->client->pers.classSelection = BG_FindClassNumForName( s ); diff --git a/src/game/g_local.h b/src/game/g_local.h index 34491015..fdffbbb6 100644 --- a/src/game/g_local.h +++ b/src/game/g_local.h @@ -183,6 +183,9 @@ struct gentity_s float wait; float random; + pTeam_t stageTeam; + stage_t stageStage; + int biteam; //TA: buildable item team gentity_t *parentNode; //TA: for creep and defence/spawn dependencies qboolean active; //TA: for power repeater, but could be useful elsewhere @@ -707,6 +710,7 @@ void Touch_DoorTrigger( gentity_t *ent, gentity_t *other, trace_t *trace ); // g_trigger.c // void trigger_teleporter_touch( gentity_t *self, gentity_t *other, trace_t *trace ); +void G_Checktrigger_stages( pTeam_t team, stage_t stage ); // diff --git a/src/game/g_main.c b/src/game/g_main.c index 7b45b28e..b0107826 100644 --- a/src/game/g_main.c +++ b/src/game/g_main.c @@ -973,20 +973,34 @@ void G_CalculateStages( void ) if( g_alienKills.integer >= (int)( (float)g_alienStage2Threshold.integer * alienPlayerCountMod ) && g_alienStage.integer == S1 && g_alienMaxStage.integer > S1 ) + { + G_Checktrigger_stages( PTE_ALIENS, S2 ); trap_Cvar_Set( "g_alienStage", va( "%d", S2 ) ); + } + if( g_alienKills.integer >= (int)( (float)g_alienStage3Threshold.integer * alienPlayerCountMod ) && g_alienStage.integer == S2 && g_alienMaxStage.integer > S2 ) + { + G_Checktrigger_stages( PTE_ALIENS, S3 ); trap_Cvar_Set( "g_alienStage", va( "%d", S3 ) ); + } if( g_humanKills.integer >= (int)( (float)g_humanStage2Threshold.integer * humanPlayerCountMod ) && g_humanStage.integer == S1 && g_humanMaxStage.integer > S1 ) + { + G_Checktrigger_stages( PTE_HUMANS, S2 ); trap_Cvar_Set( "g_humanStage", va( "%d", S2 ) ); + } + if( g_humanKills.integer >= (int)( (float)g_humanStage3Threshold.integer * humanPlayerCountMod ) && g_humanStage.integer == S2 && g_humanMaxStage.integer > S2 ) + { + G_Checktrigger_stages( PTE_HUMANS, S3 ); trap_Cvar_Set( "g_humanStage", va( "%d", S3 ) ); + } } /* diff --git a/src/game/g_spawn.c b/src/game/g_spawn.c index 185823a8..29967e1c 100644 --- a/src/game/g_spawn.c +++ b/src/game/g_spawn.c @@ -178,6 +178,7 @@ void SP_trigger_multiple( gentity_t *ent ); void SP_trigger_push( gentity_t *ent ); void SP_trigger_teleport( gentity_t *ent ); void SP_trigger_hurt( gentity_t *ent ); +void SP_trigger_stage( gentity_t *ent ); void SP_target_delay( gentity_t *ent ); void SP_target_speaker( gentity_t *ent ); @@ -250,6 +251,7 @@ spawn_t spawns[ ] = { "trigger_push", SP_trigger_push }, { "trigger_teleport", SP_trigger_teleport }, { "trigger_hurt", SP_trigger_hurt }, + { "trigger_stage", SP_trigger_stage }, // targets perform no action by themselves, but must be triggered // by another entity diff --git a/src/game/g_trigger.c b/src/game/g_trigger.c index 95359f7a..1bd05a38 100644 --- a/src/game/g_trigger.c +++ b/src/game/g_trigger.c @@ -477,3 +477,43 @@ void SP_func_timer( gentity_t *self ) } +/* +=============== +G_Checktrigger_stages + +Called when stages change +=============== +*/ +void G_Checktrigger_stages( pTeam_t team, stage_t stage ) +{ + int i; + gentity_t *ent; + + for( i = 1, ent = g_entities + i ; i < level.num_entities ; i++, ent++ ) + { + if( !ent->inuse ) + continue; + + if( !Q_stricmp( ent->classname, "trigger_stage" ) ) + { + if( team == ent->stageTeam && stage == ent->stageStage ) + ent->use( ent, ent, ent ); + } + } +} + + +void trigger_stage_use( gentity_t *self, gentity_t *other, gentity_t *activator ) +{ + G_UseTargets( self, self ); +} + +void SP_trigger_stage( gentity_t *self ) +{ + G_SpawnInt( "team", "0", &self->stageTeam ); + G_SpawnInt( "stage", "0", &self->stageStage ); + + self->use = trigger_stage_use; + + self->r.svFlags = SVF_NOCLIENT; +} diff --git a/src/game/g_utils.c b/src/game/g_utils.c index e38fb01a..95e117d2 100644 --- a/src/game/g_utils.c +++ b/src/game/g_utils.c @@ -272,7 +272,7 @@ void G_UseTargets( gentity_t *ent, gentity_t *activator ) return; t = NULL; - while( ( t = G_Find( t, FOFS( targetname ), ent->target) ) != NULL ) + while( ( t = G_Find( t, FOFS( targetname ), ent->target ) ) != NULL ) { if( t == ent ) G_Printf( "WARNING: Entity used itself.\n" ); diff --git a/src/game/tremulous.h b/src/game/tremulous.h index 7d2c423b..2f519cf2 100644 --- a/src/game/tremulous.h +++ b/src/game/tremulous.h @@ -307,7 +307,7 @@ * */ -#define HUMAN_WDMG_MODIFIER 1.1f +#define HUMAN_WDMG_MODIFIER 1.07f #define HDM(d) ((int)((float)d*HUMAN_WDMG_MODIFIER)) #define BLASTER_REPEAT 600 @@ -502,7 +502,7 @@ #define REACTOR_BP 0 #define REACTOR_BT 20000 -#define REACTOR_HEALTH HBHM(1500) +#define REACTOR_HEALTH HBHM(1250) #define REACTOR_SPLASHDAMAGE 200 #define REACTOR_SPLASHRADIUS 300 #define REACTOR_VALUE 2 |