D:\cygwin\wf_fusion_src_r8\CVSROOT\WeaponsFactory\wf_warmup.c

/*
==============================================================================
The Weapons Factory - 
  
Modified code by Keith Pase

Copyright (C) 1997-2003 Weapons Factory Software

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  

See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.


  wf_warmup.c -- Reset everyone after warmup.
  

==============================================================================
*/

#include "../game/g_local.h"

void DoRespawn (edict_t *ent);

void CTFResetAllPlayers(void)
{
    int i;
    edict_t *ent;

    for (i = 1; i <= maxclients->value; i++) {
        ent = game.edicts + i;
        if (!ent->r.inuse)
            continue;

        if (ent->r.client->menu)
            PMenu_Close(ent);

        CTFPlayerResetGrapple(ent);
        CTFDeadDropFlag(ent);

        ent->r.svflags = SVF_NOCLIENT;
        ent->flags &= ~FL_GODMODE;
        WFPlayer_ChangeClassTeam(ent);
        ent->deadflag = DEAD_DEAD;
        respawn (ent);
    }

    CTFResetFlags();

    for (ent = game.edicts + 1, i = 1; i < game.numentities; i++, ent++)
    {
        if (ent->r.inuse && !ent->r.client)
        {
            if (ent->r.solid == SOLID_NOT && ent->think == DoRespawn &&
                ent->nextthink >= level.time)
            {
                ent->nextthink = 0;
                DoRespawn(ent);
            }
        }
    }
}


void DoCountdown (void)
{
    if (level.time <= 30)
    {
        if ( level.time == 1)
        {
            G_PrintMsg (NULL, PRINT_HIGH,"-- 30 Seconds Till Game Start --\n");
        }
        if ( level.time == 10)
        {
            G_PrintMsg (NULL, PRINT_HIGH,"-- 20 Seconds Till Game Start --\n");
        }
        if ( level.time == 15)
        {
            G_PrintMsg (NULL, PRINT_HIGH,"-- 15 Seconds Till Game Start --\n");
        }
        if ( level.time == 20)
        {
            G_PrintMsg (NULL, PRINT_HIGH,"-- 10 Seconds Till Game Start --\n");
        }
        if ( level.time == 25)
        {
            G_PrintMsg (NULL, PRINT_HIGH,"-- 5 Seconds Till Game Start --\n");
        }
        if ( level.time == 26)
        {
            G_PrintMsg (NULL, PRINT_HIGH,"4\n");
        }
        if ( level.time == 27)
        {
            G_PrintMsg (NULL, PRINT_HIGH,"3\n");
            G_GlobalSound (CHAN_VOICE, trap_SoundIndex(COUNTDOWN_THREE));
        }
        if ( level.time == 28)
        {
            G_PrintMsg (NULL, PRINT_HIGH,"2\n");
            G_GlobalSound (CHAN_VOICE, trap_SoundIndex(COUNTDOWN_TWO));
        }
        if ( level.time == 29)
        {
            G_PrintMsg (NULL, PRINT_HIGH,"1\n");
            G_GlobalSound (CHAN_VOICE, trap_SoundIndex(COUNTDOWN_ONE));
        }
        if ( level.time == 30)
        {
            G_PrintMsg (NULL, PRINT_HIGH," Game Started\n");
            CTFResetAllPlayers();
            G_GlobalSound (CHAN_VOICE, trap_SoundIndex(COUNTDOWN_FIGHT));
        }
    }
}