当前位置: 首页>>代码示例>>C++>>正文


C++ KillBox函数代码示例

本文整理汇总了C++中KillBox函数的典型用法代码示例。如果您正苦于以下问题:C++ KillBox函数的具体用法?C++ KillBox怎么用?C++ KillBox使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了KillBox函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: DBall_BallRespawn

void DBall_BallRespawn (edict_t *self)
{
	edict_t		*start;

	// do the splash effect
	gi.WriteByte (svc_temp_entity);
	gi.WriteByte (TE_DBALL_GOAL);
	gi.WritePosition (self->s.origin);
	gi.multicast (self->s.origin, MULTICAST_PVS);

	// move the ball and stop it
	start = PickBallStart(self);
	if(start)
	{
		VectorCopy(start->s.origin, self->s.origin);
		VectorCopy(start->s.origin, self->s.old_origin);
	}

	VectorClear(self->s.angles);
	VectorClear(self->velocity);
	VectorClear(self->avelocity);
	
	self->solid = SOLID_BBOX;
	self->s.modelindex = gi.modelindex ("models/objects/dball/tris.md2");
	self->s.event = EV_PLAYER_TELEPORT;
	self->groundentity = NULL;

	// kill anything at the destination
	KillBox (self);

	gi.linkentity (self);
}
开发者ID:DrItanium,项目名称:rogue,代码行数:32,代码来源:ball.c

示例2: G_TeleportPlayer

/*
* G_TeleportPlayer
*/
void G_TeleportPlayer( edict_t *player, edict_t *dest )
{
	int i;
	vec3_t velocity;
	mat3_t axis;
	float speed;
	gclient_t *client = player->r.client;

	if( !dest ) {
		return;
	}
	if( !client ) {
		return;
	}

	// draw the teleport entering effect
	G_TeleportEffect( player, false );

	//
	// teleport the player
	//

	// from racesow - use old pmove velocity
	VectorCopy( client->old_pmove.velocity, velocity );

	velocity[2] = 0; // ignore vertical velocity
	speed = VectorLengthFast( velocity );

	AnglesToAxis( dest->s.angles, axis );
	VectorScale( &axis[AXIS_FORWARD], speed, client->ps.pmove.velocity );

	VectorCopy( dest->s.angles, client->ps.viewangles );
	VectorCopy( dest->s.origin, client->ps.pmove.origin );

	// set the delta angle
	for ( i = 0; i < 3; i++ )
		client->ps.pmove.delta_angles[i] = ANGLE2SHORT( client->ps.viewangles[i] ) - client->ucmd.angles[i];

	client->ps.pmove.pm_flags |= PMF_TIME_TELEPORT;
	client->ps.pmove.pm_time = 1; // force the minimum no control delay
	player->s.teleported = true;

	// update the entity from the pmove
	VectorCopy( client->ps.viewangles, player->s.angles );
	VectorCopy( client->ps.pmove.origin, player->s.origin );
	VectorCopy( client->ps.pmove.origin, player->s.old_origin );
	VectorCopy( client->ps.pmove.origin, player->olds.origin );
	VectorCopy( client->ps.pmove.velocity, player->velocity );

	// unlink to make sure it can't possibly interfere with KillBox
	GClip_UnlinkEntity( player );

	// kill anything at the destination
	KillBox( player );

	GClip_LinkEntity( player );

	// add the teleport effect at the destination
	G_TeleportEffect( player, true );
}
开发者ID:Clever-Boy,项目名称:qfusion,代码行数:63,代码来源:p_client.cpp

示例3: func_explosive_spawn

static void func_explosive_spawn( edict_t *self, edict_t *other, edict_t *activator )
{
	self->r.solid = SOLID_YES;
	self->r.svflags &= ~SVF_NOCLIENT;
	self->use = NULL;
	KillBox( self );
	GClip_LinkEntity( self );
}
开发者ID:codetwister,项目名称:qfusion,代码行数:8,代码来源:g_misc.cpp

示例4: func_object_use

void func_object_use (edict_t *self, edict_t *other, edict_t *activator)
{
	self->solid = SOLID_BSP;
	self->svflags &= ~SVF_NOCLIENT;
	self->use = NULL;
	KillBox (self);
	func_object_release (self);
}
开发者ID:AJenbo,项目名称:Quake-2,代码行数:8,代码来源:g_misc.c

示例5: func_explosive_spawn

void func_explosive_spawn (edict_t *self, edict_t *other, edict_t *activator)
{
	self->solid = SOLID_BSP;
	self->svflags &= ~SVF_NOCLIENT;
	self->use = NULL;
	KillBox (self);
	gi.linkentity (self);
}
开发者ID:AJenbo,项目名称:Quake-2,代码行数:8,代码来源:g_misc.c

示例6: BOT_DMClass_JoinGame

//==========================================
// BOT_DMClass_JoinGame
// put the bot into the game.
//==========================================
void BOT_DMClass_JoinGame (edict_t *ent, char *team_name)
{
	char *s;
	//int rnd = CLASS_PALADIN;

	if ( !BOT_JoinCTFTeam(ent, team_name) )
		gi.bprintf (PRINT_HIGH,  "[BOT] %s joined the game.\n",
		ent->client->pers.netname);

	ent->think = AI_Think;
	ent->nextthink = level.time + FRAMETIME;

	// az: Vortex stuff
	disableAbilities(ent);

	ent->myskills.level = AveragePlayerLevel();
	ent->myskills.speciality_points = ent->myskills.level * 2;

	s = Info_ValueForKey (ent->client->pers.userinfo, "skin");

	/*while (1) // except the knight, any class.
	{
		rnd = GetRandom(1, CLASS_MAX);
		if (rnd != CLASS_PALADIN && rnd != CLASS_POLTERGEIST)
			break;
	}

	ent->myskills.class_num = rnd;*/
	ent->myskills.class_num = CLASS_SOLDIER; 
	ent->myskills.respawn_weapon = GetRandom(1, 11);

	ent->client->pers.spectator = false;
	ent->client->resp.spectator = false;

    vrx_add_respawn_items(ent);
    vrx_add_respawn_weapon(ent, ent->myskills.respawn_weapon);

    vrx_assign_abilities(ent);
    vrx_set_talents(ent);
	ent->myskills.streak = 0;

	BOT_VortexAssignSkills(ent);

	//join game
	ent->movetype = MOVETYPE_WALK;
	ent->solid = SOLID_BBOX;
	ent->svflags &= ~SVF_NOCLIENT;
	ent->client->ps.gunindex = 0;

	PutClientInServer(ent);

	if (!KillBox (ent))
	{	// could't spawn in?
	}
	gi.linkentity (ent);
}
开发者ID:zardoru,项目名称:vrxcl,代码行数:60,代码来源:bot_spawn.c

示例7: Summon

static void Summon(edict_t *ent, edict_t *other)
{
	vec3_t offset, forward, right, start;
	trace_t		tr;

	if (other->client->blinky_client.nosummon)
		return;

	VectorSet(offset, 40, 0, ent->viewheight-8);
	AngleVectors (ent->client->v_angle, forward, right, NULL);
	P_ProjectSource (ent->client, ent->s.origin, offset, forward, right, start);
	
	// code mostly copied from KillBox

	// unlink to make sure it can't possibly interfere with KillBox
	gi.unlinkentity (other);

	tr = gi.trace (start, other->mins, other->maxs, start, NULL, MASK_PLAYERSOLID);
	if (tr.fraction < 1.0)
	{
		gi.linkentity (other);
		return;
	}


	VectorCopy (start, other->s.origin);
	VectorCopy (start, other->s.old_origin);
	other->s.origin[2] += 10;

	// clear the velocity and hold them in place briefly
	VectorClear (other->velocity);
	other->client->ps.pmove.pm_time = 160>>3;		// hold time
	other->client->ps.pmove.pm_flags |= PMF_TIME_TELEPORT;

	// draw the teleport splash at source and on the player
	other->s.event = EV_PLAYER_TELEPORT;

	// set angles
	MoveToAngles(other, ent->s.angles);

	VectorClear (other->s.angles);
	VectorClear (other->client->ps.viewangles);
	VectorClear (other->client->v_angle);

	// kill anything at the destination
	KillBox (other);

	gi.linkentity (other);
}
开发者ID:ZwS,项目名称:qudos,代码行数:49,代码来源:b_coopcam.c

示例8: func_wall_use

void func_wall_use(edict_t *self, edict_t *other, edict_t *activator)
{
    if (self->solid == SOLID_NOT) {
        self->solid = SOLID_BSP;
        self->svflags &= ~SVF_NOCLIENT;
        KillBox(self);
    } else {
        self->solid = SOLID_NOT;
        self->svflags |= SVF_NOCLIENT;
    }
    gi.linkentity(self);

    if (!(self->spawnflags & 2))
        self->use = NULL;
}
开发者ID:AndreyNazarov,项目名称:q2pro,代码行数:15,代码来源:g_misc.c

示例9: use_target_spawner

void use_target_spawner (edict_t *self, edict_t *other, edict_t *activator)
{
	edict_t	*ent;

	ent = G_Spawn();
	ent->classname = self->target;
	VectorCopy (self->s.origin, ent->s.origin);
	VectorCopy (self->s.angles, ent->s.angles);
	ED_CallSpawn (ent);
	gi.unlinkentity (ent);
	KillBox (ent);
	gi.linkentity (ent);
	if (self->speed)
		VectorCopy (self->movedir, ent->velocity);
}
开发者ID:AJenbo,项目名称:Quake-2,代码行数:15,代码来源:g_target.c

示例10: func_wall_use

static void func_wall_use( edict_t *self, edict_t *other, edict_t *activator )
{
	if( self->r.solid == SOLID_NOT )
	{
		self->r.solid = SOLID_YES;
		self->r.svflags &= ~SVF_NOCLIENT;
		KillBox( self );
	}
	else
	{
		self->r.solid = SOLID_NOT;
		self->r.svflags |= SVF_NOCLIENT;
	}
	GClip_LinkEntity( self );

	if( !( self->spawnflags & 2 ) )
		self->use = NULL;
}
开发者ID:codetwister,项目名称:qfusion,代码行数:18,代码来源:g_misc.cpp

示例11: BOT_DMClass_JoinGame

//==========================================
// BOT_DMClass_JoinGame
// put the bot into the game.
//==========================================
void BOT_DMClass_JoinGame (edict_t *ent, char *team_name)
{
	if ( !BOT_JoinCTFTeam(ent, team_name) )
		Com_Printf ( "%s joined the game.\n",
		ent->client->pers.netname);

	ent->think = AI_Think;
	ent->nextthink = level.time + FRAMETIME;

	//join game
	ent->movetype = MOVETYPE_WALK;
	ent->solid = SOLID_BBOX;
	ent->svflags &= ~SVF_NOCLIENT;
	ent->client->ps.gunindex = 0;

	if (!KillBox (ent))
	{	// could't spawn in?
	}
	gi.linkentity (ent);
}
开发者ID:ZwS,项目名称:qudos,代码行数:24,代码来源:bot_spawn.c

示例12: ACESP_HoldSpawn

///////////////////////////////////////////////////////////////////////
// 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);

}
开发者ID:m-x-d,项目名称:Mission64-src,代码行数:28,代码来源:acebot_spawn.c

示例13: ACESP_PutClientInServer


//.........这里部分代码省略.........
	
	if (ctf->value)
	{
		client->resp.ctf_team = team;
		client->resp.ctf_state = CTF_STATE_START;
		s = Info_ValueForKey(client->pers.userinfo, "skin");
		CTFAssignSkin(bot, s);
	}

	VectorCopy(mins, bot->mins);
	VectorCopy(maxs, bot->maxs);
	VectorClear(bot->velocity);

	// clear playerstate values
	memset(&bot->client->ps, 0, sizeof(client->ps));
	
	client->ps.pmove.origin[0] = spawn_origin[0]*8;
	client->ps.pmove.origin[1] = spawn_origin[1]*8;
	client->ps.pmove.origin[2] = spawn_origin[2]*8;

//ZOID
	client->ps.pmove.pm_flags &= ~PMF_NO_PREDICTION;
//ZOID

	if (deathmatch->value && ((int)dmflags->value & DF_FIXED_FOV))
	{
		client->ps.fov = 90;
	}
	else
	{
		client->ps.fov = atoi(Info_ValueForKey(client->pers.userinfo, "fov"));
		if (client->ps.fov < 1)
			client->ps.fov = 90;
		else if (client->ps.fov > 160)
			client->ps.fov = 160;
	}

	// Knightmare- fix for null model?
	if (client->pers.weapon && client->pers.weapon->view_model)
		client->ps.gunindex = gi.modelindex(client->pers.weapon->view_model);

	// clear entity state values
	bot->s.effects = 0;
	bot->s.skinnum = bot - g_edicts - 1;
	bot->s.modelindex = MAX_MODELS-1;		// will use the skin specified model
	bot->s.modelindex2 = MAX_MODELS-1;		// custom gun model
	bot->s.frame = 0;
	VectorCopy(spawn_origin, bot->s.origin);
	bot->s.origin[2] += 1;	// make sure off ground

	// set the delta angle
	for (int i = 0; i < 3; i++)
		client->ps.pmove.delta_angles[i] = ANGLE2SHORT(spawn_angles[i] - client->resp.cmd_angles[i]);

	bot->s.angles[PITCH] = 0;
	bot->s.angles[YAW] = spawn_angles[YAW];
	bot->s.angles[ROLL] = 0;
	VectorCopy(bot->s.angles, client->ps.viewangles);
	VectorCopy(bot->s.angles, client->v_angle);
	
	// force the current weapon up
	client->newweapon = client->pers.weapon;
	ChangeWeapon (bot);

	bot->enemy = NULL;
	bot->movetarget = NULL; 
	bot->state = STATE_MOVE;

	// Set the current node
	bot->current_node = ACEND_FindClosestReachableNode(bot,NODE_DENSITY, NODE_ALL);
	bot->goal_node = bot->current_node;
	bot->next_node = bot->current_node;
	bot->next_move_time = level.time;		
	bot->suicide_timeout = level.time + 15.0;

	// If we are not respawning hold off for up to three seconds before releasing into game
    if (!respawn)
	{
		bot->think = ACESP_HoldSpawn;
		//bot->nextthink = level.time + 0.1; //mxd
		bot->nextthink = level.time + random()*3.0f; // up to three seconds
	}
	else
	{
		if (!KillBox(bot))
		{	// could't spawn in?
		}

		gi.linkentity(bot);

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

		// send effect
		gi.WriteByte(svc_muzzleflash);
		gi.WriteShort(bot-g_edicts);
		gi.WriteByte(MZ_LOGIN);
		gi.multicast(bot->s.origin, MULTICAST_PVS);
	}
}
开发者ID:m-x-d,项目名称:Mission64-src,代码行数:101,代码来源:acebot_spawn.c

示例14: teleporter_touch

void teleporter_touch (edict_t *self, edict_t *other, cplane_t *plane, csurface_t *surf)
{
	edict_t		*dest;
	int			i;
	vec3_t		nodeo;

	if (!other->client)
		return;
	dest = G_Find (NULL, FOFS(targetname), self->target);
	if (!dest)
	{
		gi.dprintf(DEVELOPER_MSG_GAME, "Couldn't find destination\n");
		return;
	}

	if (!Bot_FindNode(self, 120, TELEPORT_NODE)
		&& dntg->value)
	{
		//start node
		VectorCopy (other->s.origin, nodeo);
		
		if (!(other->client->ps.pmove.pm_flags & PMF_DUCKED))
		{
			nodeo[2] += 5;
			Bot_PlaceNode(nodeo, TELEPORT_NODE, 0);
		}
		else
			Bot_PlaceNode(nodeo, TELEPORT_NODE, 1);
		
		Bot_CalcNode(other, numnodes);

		//dest node
		VectorCopy (dest->s.origin, nodeo);
		nodeo[2] += 20;
		Bot_PlaceNode(nodeo, NORMAL_NODE, 0);
		Bot_CalcNode(other, numnodes);
		
		//connection
		nodes[numnodes-1].dist[numnodes] = 1;

		nprintf(PRINT_HIGH, "Teleporter nodes placed and connected!\n");
	}

	// unlink to make sure it can't possibly interfere with KillBox
	gi.unlinkentity (other);

	VectorCopy (dest->s.origin, other->s.origin);
	VectorCopy (dest->s.origin, other->s.old_origin);
	other->s.origin[2] += 10;

	// clear the velocity and hold them in place briefly
	VectorClear (other->velocity);
	other->client->ps.pmove.pm_time = 160>>3;		// hold time
	other->client->ps.pmove.pm_flags |= PMF_TIME_TELEPORT;

	// draw the teleport splash at source and on the player
	self->owner->s.event = EV_PLAYER_TELEPORT;
	other->s.event = EV_PLAYER_TELEPORT;

	// set angles
	for (i=0 ; i<3 ; i++)
		other->client->ps.pmove.delta_angles[i] = ANGLE2SHORT(dest->s.angles[i] - other->client->resp.cmd_angles[i]);

	VectorClear (other->s.angles);
	VectorClear (other->client->ps.viewangles);
	VectorClear (other->client->v_angle);

	// kill anything at the destination
	KillBox (other);

	gi.linkentity (other);
}
开发者ID:basecq,项目名称:q2dos,代码行数:72,代码来源:g_misc.c

示例15: PutClientInServer


//.........这里部分代码省略.........
		memcpy (userinfo, client->pers.userinfo, sizeof(userinfo));
		InitClientPersistant(client);
		ClientUserinfoChanged (ent, userinfo);
		client->pers.health = health;
	}
	client->resp = resp;

	// copy some data from the client to the entity
	FetchClientEntData (ent);

	// clear entity values
	ent->groundentity = NULL;
	ent->client = &game.clients[index];
	ent->takedamage = DAMAGE_AIM;
	ent->movetype = MOVETYPE_WALK;
	ent->viewheight = 22;
	ent->inuse = true;
	ent->classname = "player";
	ent->mass = 200;
	ent->solid = SOLID_BBOX;
	ent->deadflag = DEAD_NO;
	ent->air_finished = level.time + 12;
	ent->clipmask = MASK_PLAYERSOLID;
	ent->model = "players/male/tris.md2";
	ent->pain = player_pain;
	ent->die = player_die;
	ent->waterlevel = 0;
	ent->watertype = 0;
	ent->flags &= ~FL_NO_KNOCKBACK;
	ent->svflags &= ~SVF_DEADMONSTER;
#ifdef WITH_ACEBOT
// ACEBOT_ADD
	ent->is_bot = false;
	ent->last_node = -1;
	ent->is_jumping = false;
// ACEBOT_END
#endif
	VectorCopy (mins, ent->mins);
	VectorCopy (maxs, ent->maxs);
	VectorClear (ent->velocity);

	// clear playerstate values
	memset (&ent->client->ps, 0, sizeof(client->ps));

	client->ps.pmove.origin[0] = spawn_origin[0]*8;
	client->ps.pmove.origin[1] = spawn_origin[1]*8;
	client->ps.pmove.origin[2] = spawn_origin[2]*8;

	if (deathmatch->value && ((int)dmflags->value & DF_FIXED_FOV))
	{
		client->ps.fov = 90;
	}
	else
	{
		client->ps.fov = atoi(Info_ValueForKey(client->pers.userinfo, "fov"));
		if (client->ps.fov < 1)
			client->ps.fov = 90;
		else if (client->ps.fov > 160)
			client->ps.fov = 160;
	}

	client->ps.gunindex = gi.modelindex(client->pers.weapon->view_model);

	// clear entity state values
	ent->s.effects = 0;
	ent->s.skinnum = ent - g_edicts - 1;
	ent->s.modelindex = 255;		// will use the skin specified model
	ent->s.modelindex2 = 255;		// custom gun model
	ent->s.frame = 0;
#ifdef WITH_ACEBOT
//botchat>
	ent->last_insult = level.time;
 	ent->last_taunt = level.time;
 	ent->last_chat = level.time;
//<botchat
#endif
	VectorCopy (spawn_origin, ent->s.origin);
	ent->s.origin[2] += 1;	// make sure off ground
	VectorCopy (ent->s.origin, ent->s.old_origin);

	// set the delta angle
	for (i=0 ; i<3 ; i++)
		client->ps.pmove.delta_angles[i] = ANGLE2SHORT(spawn_angles[i] - client->resp.cmd_angles[i]);

	ent->s.angles[PITCH] = 0;
	ent->s.angles[YAW] = spawn_angles[YAW];
	ent->s.angles[ROLL] = 0;
	VectorCopy (ent->s.angles, client->ps.viewangles);
	VectorCopy (ent->s.angles, client->v_angle);

	if (!KillBox (ent))
	{	// could't spawn in?
	}

	gi.linkentity (ent);

	// force the current weapon up
	client->newweapon = client->pers.weapon;
	ChangeWeapon (ent);
}
开发者ID:ZwS,项目名称:qudos,代码行数:101,代码来源:p_client.c


注:本文中的KillBox函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。