Exemplo n.º 1
0
void
BecomeExplosion1(edict_t *self)
{
	/* flags are important */
	if (strcmp(self->classname, "item_flag_team1") == 0)
	{
		CTFResetFlag(CTF_TEAM1); /* this will free self! */
		gi.bprintf(PRINT_HIGH, "The %s flag has returned!\n",
				CTFTeamName(CTF_TEAM1));
		return;
	}

	if (strcmp(self->classname, "item_flag_team2") == 0)
	{
		CTFResetFlag(CTF_TEAM2); /* this will free self! */
		gi.bprintf(PRINT_HIGH, "The %s flag has returned!\n",
				CTFTeamName(CTF_TEAM1));
		return;
	}

	/* techs are important too */
	if (self->item && (self->item->flags & IT_TECH))
	{
		CTFRespawnTech(self); /* this frees self! */
		return;
	}

	gi.WriteByte(svc_temp_entity);
	gi.WriteByte(TE_EXPLOSION1);
	gi.WritePosition(self->s.origin);
	gi.multicast(self->s.origin, MULTICAST_PVS);

	G_FreeEdict(self);
}
Exemplo n.º 2
0
void
BecomeExplosion1 (edict_t * self)
{
  //flags are important
  if (ctf->value)
    {
      if (strcmp (self->classname, "item_flag_team1") == 0)
	{
	  CTFResetFlag (TEAM1);	// this will free self!
	  gi.bprintf (PRINT_HIGH, "The %s flag has returned!\n",
		      CTFTeamName (TEAM1));
	  return;
	}
      if (strcmp (self->classname, "item_flag_team2") == 0)
	{
	  CTFResetFlag (TEAM2);	// this will free self!
	  gi.bprintf (PRINT_HIGH, "The %s flag has returned!\n",
		      CTFTeamName (TEAM1));
	  return;
	}
    }
  gi.WriteByte (svc_temp_entity);
  gi.WriteByte (TE_EXPLOSION1);
  gi.WritePosition (self->s.origin);
  gi.multicast (self->s.origin, MULTICAST_PVS);

  G_FreeEdict (self);
}
Exemplo n.º 3
0
Arquivo: timer.c Projeto: qbism/tmg
//#define rndnum(y,z) ((random()*((z)-((y)+1)))+(y))
void RestartLevel()
{
	edict_t *player;
	int i;
	edict_t *dropped = NULL;
	techspawn = false;
	ResetItems();
	match_nextthink = level.time + 1;
	match_state = STATE_NEEDPLAYERS;
	match_state_end = 1;
	ResetCaps();
	hstime = level.time - 10;
	mapvoteactive = false;
	for_each_player(player, i)
	{
		player->client->resp.score = 0;
		player->client->resp.frags = 0;
		player->client->resp.spree = 0;
		player->client->resp.deaths = 0;
		player->client->pers.db_hud = true;
		if(player->client->pers.pl_state == 2)
			player->client->pers.pl_state = 3;
		player->client->resp.startframe = level.newframenum;
		if (ctf->value)
		{
			if ((!flag1_item || !flag2_item) && ctf->value)
				CTFInit();
			if (player->client->pers.inventory[ITEM_INDEX(flag1_item)])
			{
				dropped = Drop_Item(player, flag1_item);
				player->client->pers.inventory[ITEM_INDEX(flag1_item)] = 0;
				my_bprintf(PRINT_HIGH, "%s lost the %s flag!\n",
					player->client->pers.netname, CTFTeamName(CTF_TEAM1));
			}
			else if (player->client->pers.inventory[ITEM_INDEX(flag2_item)])
			{
				dropped = Drop_Item(player, flag2_item);
				player->client->pers.inventory[ITEM_INDEX(flag2_item)] = 0;
				my_bprintf(PRINT_HIGH, "%s lost the %s flag!\n",
					player->client->pers.netname, CTFTeamName(CTF_TEAM2));
			}
			if (dropped)
			{
				dropped->think = G_FreeEdict;
				dropped->timestamp = level.time;
				dropped->nextthink = level.time + 0.2;
			}
			//JSW - clear flag carrier var
			player->hasflag = 0;
		}
	}
Exemplo n.º 4
0
void BecomeExplosion1 (edict_t *self)
{
//ZOID
	//flags are important
	if (strcmp(self->classname, "item_flag_team1") == 0) {
		CTFResetFlag(CTF_TEAM1); // this will free self!
		bprintf2(PRINT_HIGH, "The %s flag has returned!\n",
			CTFTeamName(CTF_TEAM1));
		return;
	}
	if (strcmp(self->classname, "item_flag_team2") == 0) {
		CTFResetFlag(CTF_TEAM2); // this will free self!
		bprintf2(PRINT_HIGH, "The %s flag has returned!\n",
			CTFTeamName(CTF_TEAM1));
		return;
	}
	// techs are important too
	if (self->item && (self->item->flags & IT_TECH)) {
		CTFRespawnTech(self); // this frees self!
		return;
	}
//ZOID

	if (Q_stricmp(self->classname, "rocket_turret") == 0
		|| Q_stricmp(self->classname, "laser_turret") == 0)
		numturrets--;

	gi.WriteByte (svc_temp_entity);
	gi.WriteByte (TE_EXPLOSION1);
	gi.WritePosition (self->s.origin);
	gi.multicast (self->s.origin, MULTICAST_PVS);

// FWP fix for weapon killer bug - respawn weapon after showing cute explosion

        if (self->item && (self->item->flags & (IT_WEAPON | IT_POWERUP | IT_AMMO | IT_ARMOR))) {
	   if (self->spawnorigin) {
	      DoRespawn(self); // this frees self!
             return;
	   }
	}

	G_FreeEdict (self);

}
Exemplo n.º 5
0
//==========================================
// BOT_JoinCTFTeam
// Assign a team for the bot
//==========================================
qboolean BOT_JoinCTFTeam (edict_t *ent, char *team_name)
{
	char	*s;
	int		team;
//	edict_t	*event;


	if (ent->client->resp.ctf_team != CTF_NOTEAM)
		return false;
	
	// find what ctf team
	if ((team_name !=NULL) && (strcmp(team_name, "blue") == 0))
		team = CTF_TEAM2;
	else if ((team_name !=NULL) && (strcmp(team_name, "red") == 0))
		team = CTF_TEAM1;
	else
		team = BOT_NextCTFTeam();

	if (team == CTF_NOTEAM)
		return false;
	
	//join ctf team
	ent->svflags &= ~SVF_NOCLIENT;
	ent->client->resp.ctf_state = 1;//0?
	ent->client->resp.ctf_team = team;
	s = Info_ValueForKey (ent->client->pers.userinfo, "skin");
	CTFAssignSkin(ent, s);

	PutClientInServer(ent);

	// hold in place briefly
	ent->client->ps.pmove.pm_flags = PMF_TIME_TELEPORT;
	ent->client->ps.pmove.pm_time = 14;

	Com_Printf ( "%s joined the %s team.\n",
		ent->client->pers.netname, CTFTeamName(ent->client->resp.ctf_team));

	return true;
}
Exemplo n.º 6
0
///////////////////////////////////////////////////////////////////////
// Called by PutClient in Server to actually release the bot into the game
// Keep from killin' each other when all spawned at once
///////////////////////////////////////////////////////////////////////
void ACESP_HoldSpawn(edict_t *self)
{
	if (!KillBox(self))
	{	// could't spawn in?
	}

	gi.linkentity(self);

	self->think = ACEAI_Think;
	self->nextthink = level.time + FRAMETIME;

	// send effect
	gi.WriteByte(svc_muzzleflash);
	gi.WriteShort(self-g_edicts);
	gi.WriteByte(MZ_LOGIN);
	gi.multicast(self->s.origin, MULTICAST_PVS);

	if (ctf->value)
	safe_bprintf(PRINT_MEDIUM, "%s joined the %s team.\n",
		self->client->pers.netname, CTFTeamName(self->client->resp.ctf_team));
	else
		safe_bprintf(PRINT_MEDIUM, "%s entered the game\n", self->client->pers.netname);

}