From fd65393a26be093d770d4b77e17381fab2862aed Mon Sep 17 00:00:00 2001 From: Tim Angus Date: Fri, 2 Dec 2005 01:58:49 +0000 Subject: * Added target_alien_win and target_human_win * Made the test for particles at rest less strict * Fixed a bug with the game element disabling stuff --- src/cgame/cg_particles.c | 2 +- src/game/g_cmds.c | 2 +- src/game/g_local.h | 3 +++ src/game/g_main.c | 14 ++++++++------ src/game/g_spawn.c | 4 ++++ src/game/g_target.c | 40 ++++++++++++++++++++++++++++++++++++++++ 6 files changed, 57 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/cgame/cg_particles.c b/src/cgame/cg_particles.c index 8e77f075..64587360 100644 --- a/src/cgame/cg_particles.c +++ b/src/cgame/cg_particles.c @@ -2129,7 +2129,7 @@ static void CG_EvaluateParticlePhysics( particle_t *p ) VectorScale( p->velocity, bounce, p->velocity ); - if( trace.plane.normal[ 2 ] > 0.0f && + if( trace.plane.normal[ 2 ] > 0.5f && ( p->velocity[ 2 ] < 40.0f || p->velocity[ 2 ] < -cg.frametime * p->velocity[ 2 ] ) ) p->atRest = qtrue; diff --git a/src/game/g_cmds.c b/src/game/g_cmds.c index 540bedd0..819fbb75 100644 --- a/src/game/g_cmds.c +++ b/src/game/g_cmds.c @@ -1119,7 +1119,7 @@ void Cmd_Class_f( gentity_t *ent ) if( G_ClassIsAllowed( PCL_ALIEN_BUILDER0_UPG ) && BG_FindStagesForClass( PCL_ALIEN_BUILDER0_UPG, g_alienStage.integer ) ) - allowedClasses[ numClasses++ ] = PCL_ALIEN_BUILDER0; + allowedClasses[ numClasses++ ] = PCL_ALIEN_BUILDER0_UPG; if( G_ClassIsAllowed( PCL_ALIEN_LEVEL0 ) ) allowedClasses[ numClasses++ ] = PCL_ALIEN_LEVEL0; diff --git a/src/game/g_local.h b/src/game/g_local.h index 002d4cb5..ee8a8a57 100644 --- a/src/game/g_local.h +++ b/src/game/g_local.h @@ -595,6 +595,9 @@ typedef struct int alienStage3Time; int humanStage2Time; int humanStage3Time; + + qboolean uncondAlienWin; + qboolean uncondHumanWin; } level_locals_t; // diff --git a/src/game/g_main.c b/src/game/g_main.c index 1afb6744..52fec4e0 100644 --- a/src/game/g_main.c +++ b/src/game/g_main.c @@ -1812,9 +1812,10 @@ void CheckExitRules( void ) } //TA: end the game on these conditions - if( ( level.time > level.startTime + 1000 ) && - ( level.numAlienSpawns == 0 ) && - ( level.numLiveAlienClients == 0 ) ) + if( level.uncondHumanWin || + ( ( level.time > level.startTime + 1000 ) && + ( level.numAlienSpawns == 0 ) && + ( level.numLiveAlienClients == 0 ) ) ) { //humans win level.lastWin = PTE_HUMANS; @@ -1831,9 +1832,10 @@ void CheckExitRules( void ) LogExit( "Humans win." ); return; } - else if( ( level.time > level.startTime + 1000 ) && - ( level.numHumanSpawns == 0 ) && - ( level.numLiveHumanClients == 0 ) ) + else if( level.uncondAlienWin || + ( ( level.time > level.startTime + 1000 ) && + ( level.numHumanSpawns == 0 ) && + ( level.numLiveHumanClients == 0 ) ) ) { //aliens win level.lastWin = PTE_ALIENS; diff --git a/src/game/g_spawn.c b/src/game/g_spawn.c index 39db22be..080f7b41 100644 --- a/src/game/g_spawn.c +++ b/src/game/g_spawn.c @@ -199,6 +199,8 @@ void SP_target_position( gentity_t *ent ); void SP_target_location( gentity_t *ent ); void SP_target_push( gentity_t *ent ); void SP_target_rumble( gentity_t *ent ); +void SP_target_alien_win( gentity_t *ent ); +void SP_target_human_win( gentity_t *ent ); void SP_light( gentity_t *self ); void SP_info_null( gentity_t *self ); @@ -280,6 +282,8 @@ spawn_t spawns[ ] = { "target_location", SP_target_location }, { "target_push", SP_target_push }, { "target_rumble", SP_target_rumble }, + { "target_alien_win", SP_target_alien_win }, + { "target_human_win", SP_target_human_win }, { "light", SP_light }, { "path_corner", SP_path_corner }, diff --git a/src/game/g_target.c b/src/game/g_target.c index 216b2550..c704d72f 100644 --- a/src/game/g_target.c +++ b/src/game/g_target.c @@ -390,3 +390,43 @@ void SP_target_rumble( gentity_t *self ) self->think = target_rumble_think; self->use = target_rumble_use; } + +/* +=============== +target_alien_win_use +=============== +*/ +void target_alien_win_use( gentity_t *self, gentity_t *other, gentity_t *activator ) +{ + level.uncondAlienWin = qtrue; +} + +/* +=============== +SP_target_alien_win +=============== +*/ +void SP_target_alien_win( gentity_t *self ) +{ + self->use = target_alien_win_use; +} + +/* +=============== +target_human_win_use +=============== +*/ +void target_human_win_use( gentity_t *self, gentity_t *other, gentity_t *activator ) +{ + level.uncondHumanWin = qtrue; +} + +/* +=============== +SP_target_human_win +=============== +*/ +void SP_target_human_win( gentity_t *self ) +{ + self->use = target_human_win_use; +} -- cgit