summaryrefslogtreecommitdiff
path: root/src/game
diff options
context:
space:
mode:
authorTim Angus <tim@ngus.net>2005-08-04 22:33:57 +0000
committerTim Angus <tim@ngus.net>2005-08-04 22:33:57 +0000
commitf312c4912674b13fa07b8576f2e6c4ed96c9ec79 (patch)
treec45a539966bd29a4a500956de1f79752ae225a9e /src/game
parent27d040ddd22fdc5874d3135f58a5e475520e9bc1 (diff)
* Added trigger_win
Diffstat (limited to 'src/game')
-rw-r--r--src/game/g_main.c17
-rw-r--r--src/game/g_spawn.c2
-rw-r--r--src/game/g_trigger.c20
3 files changed, 39 insertions, 0 deletions
diff --git a/src/game/g_main.c b/src/game/g_main.c
index dc4a3064..f80bf043 100644
--- a/src/game/g_main.c
+++ b/src/game/g_main.c
@@ -1433,6 +1433,7 @@ void LogExit( const char *string )
{
int i, numSorted;
gclient_t *cl;
+ gentity_t *ent;
G_LogPrintf( "Exit: %s\n", string );
@@ -1466,6 +1467,18 @@ void LogExit( const char *string )
cl->pers.netname );
}
+
+ for( i = 1, ent = g_entities + i ; i < level.num_entities ; i++, ent++ )
+ {
+ if( !ent->inuse )
+ continue;
+
+ if( !Q_stricmp( ent->classname, "trigger_win" ) )
+ {
+ if( level.lastWin == ent->stageTeam )
+ ent->use( ent, ent, ent );
+ }
+ }
}
@@ -1604,6 +1617,7 @@ void CheckExitRules( void )
G_LogPrintf( "STATS T:L A:%f H:%f M:%s D:%d\n", level.averageNumAlienClients,
level.averageNumHumanClients,
s, level.time - level.startTime );
+ level.lastWin = PTE_NONE;
LogExit( "Timelimit hit." );
return;
}
@@ -1667,7 +1681,10 @@ void CheckVote( void )
//SUPAR HAK
if( !Q_stricmp( level.voteString, "vstr nextmap" ) )
+ {
+ level.lastWin = PTE_NONE;
LogExit( "Vote for next map." );
+ }
else
trap_SendConsoleCommand( EXEC_APPEND, va( "%s\n", level.voteString ) );
}
diff --git a/src/game/g_spawn.c b/src/game/g_spawn.c
index eae5c724..9a2fa1e9 100644
--- a/src/game/g_spawn.c
+++ b/src/game/g_spawn.c
@@ -179,6 +179,7 @@ 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_trigger_win( gentity_t *ent );
void SP_trigger_buildable( gentity_t *ent );
void SP_trigger_class( gentity_t *ent );
void SP_trigger_equipment( gentity_t *ent );
@@ -258,6 +259,7 @@ spawn_t spawns[ ] =
{ "trigger_teleport", SP_trigger_teleport },
{ "trigger_hurt", SP_trigger_hurt },
{ "trigger_stage", SP_trigger_stage },
+ { "trigger_win", SP_trigger_win },
{ "trigger_buildable", SP_trigger_buildable },
{ "trigger_class", SP_trigger_class },
{ "trigger_equipment", SP_trigger_equipment },
diff --git a/src/game/g_trigger.c b/src/game/g_trigger.c
index c3edef8d..fbcf4c4f 100644
--- a/src/game/g_trigger.c
+++ b/src/game/g_trigger.c
@@ -526,6 +526,26 @@ void SP_trigger_stage( gentity_t *self )
/*
===============
+trigger_win
+===============
+*/
+void trigger_win( gentity_t *self, gentity_t *other, gentity_t *activator )
+{
+ G_UseTargets( self, self );
+}
+
+void SP_trigger_win( gentity_t *self )
+{
+ G_SpawnInt( "team", "0", (int *)&self->stageTeam );
+
+ self->use = trigger_win;
+
+ self->r.svFlags = SVF_NOCLIENT;
+}
+
+
+/*
+===============
trigger_buildable_trigger
===============
*/