您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ G_SetOrigin函数代码示例

51自学网 2021-06-01 21:01:59
  C++
这篇教程C++ G_SetOrigin函数代码示例写得很实用,希望能帮到您。

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

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

示例1: FinishSpawningItem

void FinishSpawningItem( gentity_t *ent ) {	trace_t		tr;	vec3_t		dest;	gitem_t		*item;	int			itemNum;	itemNum=1;	for ( item = bg_itemlist + 1 ; item->classname ; item++,itemNum++) 	{		if (!strcmp(item->classname,ent->classname))		{			break;		}	}	// Set bounding box for item	VectorSet( ent->mins, item->mins[0],item->mins[1] ,item->mins[2]);	VectorSet( ent->maxs, item->maxs[0],item->maxs[1] ,item->maxs[2]);	if ((!ent->mins[0] && !ent->mins[1] && !ent->mins[2]) && 		(!ent->maxs[0] && !ent->maxs[1] && !ent->maxs[2]))	{		VectorSet (ent->mins, -ITEM_RADIUS, -ITEM_RADIUS, -2);//to match the comments in the items.dat file!		VectorSet (ent->maxs, ITEM_RADIUS, ITEM_RADIUS, ITEM_RADIUS);	}	if ((item->quantity) && (item->giType == IT_AMMO))	{		ent->count = item->quantity;	}	if ((item->quantity) && (item->giType == IT_BATTERY))	{		ent->count = item->quantity; 	}//	if ( item->giType == IT_WEAPON ) // NOTE: james thought it was ok to just always do this?	{		ent->s.radius = 20;		VectorSet( ent->s.modelScale, 1.0f, 1.0f, 1.0f );		gi.G2API_InitGhoul2Model( ent->ghoul2, ent->item->world_model, G_ModelIndex( ent->item->world_model ), NULL, NULL, 0, 0);	}	// Set crystal ammo amount based on skill level/*	if ((itemNum == ITM_AMMO_CRYSTAL_BORG) ||		(itemNum == ITM_AMMO_CRYSTAL_DN) ||		(itemNum == ITM_AMMO_CRYSTAL_FORGE) ||		(itemNum == ITM_AMMO_CRYSTAL_SCAVENGER) ||		(itemNum == ITM_AMMO_CRYSTAL_STASIS))	{		CrystalAmmoSettings(ent);	}*/	ent->s.eType = ET_ITEM;	ent->s.modelindex = ent->item - bg_itemlist;		// store item number in modelindex	ent->s.modelindex2 = 0; // zero indicates this isn't a dropped item	ent->contents = CONTENTS_TRIGGER|CONTENTS_ITEM;//CONTENTS_BODY;//CONTENTS_TRIGGER|	ent->e_TouchFunc = touchF_Touch_Item;	// useing an item causes it to respawn	ent->e_UseFunc = useF_Use_Item;	ent->svFlags |= SVF_PLAYER_USABLE;//so player can pick it up	// Hang in air?	ent->s.origin[2] += 1;//just to get it off the damn ground because coplanar = insolid	if ( ent->spawnflags & ITMSF_SUSPEND) 	{		// suspended		G_SetOrigin( ent, ent->s.origin );	} 	else 	{		// drop to floor		VectorSet( dest, ent->s.origin[0], ent->s.origin[1], MIN_WORLD_COORD );		gi.trace( &tr, ent->s.origin, ent->mins, ent->maxs, dest, ent->s.number, MASK_SOLID|CONTENTS_PLAYERCLIP, G2_NOCOLLIDE, 0 );		if ( tr.startsolid ) 		{			if ( &g_entities[tr.entityNum] != NULL )			{				gi.Printf (S_COLOR_RED"FinishSpawningItem: removing %s startsolid at %s (in a %s)/n", ent->classname, vtos(ent->s.origin), g_entities[tr.entityNum].classname );			}			else			{				gi.Printf (S_COLOR_RED"FinishSpawningItem: removing %s startsolid at %s (in a %s)/n", ent->classname, vtos(ent->s.origin) );			}			assert( 0 && "item starting in solid");#ifndef FINAL_BUILD			if (!g_entities[ENTITYNUM_WORLD].s.radius){	//not a region				delayedShutDown = level.time + 100;			}#endif			G_FreeEntity( ent );			return;		}		// allow to ride movers		ent->s.groundEntityNum = tr.entityNum;		G_SetOrigin( ent, tr.endpos );//.........这里部分代码省略.........
开发者ID:Agustinlv,项目名称:BlueHarvest,代码行数:101,


示例2: SP_target_gravity_change

/*QUAKED target_gravity_change (1 0 0) (-4 -4 -4) (4 4 4) GLOBAL"gravity" - Normal = 800, Valid range: anyGLOBAL - Apply to entire world, not just the activator*/void SP_target_gravity_change( gentity_t *self ){	G_SetOrigin( self, self->s.origin );	G_SpawnFloat( "gravity", "0", &self->speed );	self->e_UseFunc = useF_target_gravity_change_use;}
开发者ID:Joanxt,项目名称:OpenJK,代码行数:12,


示例3: FinishSpawningItem

/*================FinishSpawningItemTraces down to find where an item should rest, instead of letting themfree fall from their spawn points================*/void FinishSpawningItem( gentity_t *ent ) {	trace_t		tr;	vec3_t		dest;	VectorSet( ent->r.mins, -ITEM_RADIUS, -ITEM_RADIUS, -ITEM_RADIUS );	VectorSet( ent->r.maxs, ITEM_RADIUS, ITEM_RADIUS, ITEM_RADIUS );	ent->s.eType = ET_ITEM;	ent->s.modelindex = ent->item - bg_itemlist;		// store item number in modelindex	ent->s.modelindex2 = 0; // zero indicates this isn't a dropped item	ent->r.contents = CONTENTS_TRIGGER;	ent->touch = Touch_Item;	// useing an item causes it to respawn	ent->use = Use_Item;	if ( ent->spawnflags & 1 ) {		// suspended		G_SetOrigin( ent, ent->s.origin );	} else {		// drop to floor		VectorSet( dest, ent->s.origin[0], ent->s.origin[1], ent->s.origin[2] - 4096 );		trap_Trace( &tr, ent->s.origin, ent->r.mins, ent->r.maxs, dest, ent->s.number, MASK_SOLID );		if ( tr.startsolid ) {			G_Printf ("FinishSpawningItem: %s startsolid at %s/n", ent->classname, vtos(ent->s.origin));			G_FreeEntity( ent );			return;		}		// allow to ride movers		ent->s.groundEntityNum = tr.entityNum;		G_SetOrigin( ent, tr.endpos );	}	// team slaves and targeted items aren't present at start	if ( ( ent->flags & FL_TEAMSLAVE ) || ent->targetname ) {		ent->s.eFlags |= EF_NODRAW;		ent->r.contents = 0;		return;	}	// powerups don't spawn in for a while	if ( ent->item->giType == IT_POWERUP ) {		float	respawn;		respawn = 45 + crandom() * 15;		ent->s.eFlags |= EF_NODRAW;		ent->r.contents = 0;		ent->nextthink = level.time + respawn * 1000;		ent->think = RespawnItem;		return;	}	if ( ent->item->giType == IT_HOLDABLE ) {		if ( ( ent->item->giTag == HI_BAMBAM ) && ( g_gametype.integer != GT_CTF ) ) {			return;		}		else if ( ( ent->item->giTag == HI_BOOMIES ) &&		          ( ( g_gametype.integer != GT_CTF ) && ( g_gametype.integer != GT_BALLOON ) ) ) {			return;		}	}	trap_LinkEntity (ent);}
开发者ID:PadWorld-Entertainment,项目名称:wop-gamesource,代码行数:75,


示例4: assert

//.........这里部分代码省略.........		if (stopCol<=startCol)		{			assert(0);	// Should Not Happen			continue;		}		// Force It To Center		//--------------------		if (mover->mCenter && stopCol!=(startCol+1))		{			startCol	= ((mCols/2) - (mover->mCols/2));			stopCol		= startCol+1;		}		// Construct A List Of Columns To Test For Insertion		//---------------------------------------------------		mTestCols.clear();		for (int i=startCol; i<stopCol; i++)		{			mTestCols.push_back(i);		}		// Now Try All The Cols To See If The Building Can Fit		//-----------------------------------------------------		while (!mTestCols.empty())		{			// Randomly Pick A Column, Then Remove It From The Vector			//--------------------------------------------------------			testColIndex = Q_irand(0, mTestCols.size()-1);			atCol = mTestCols[testColIndex];			mTestCols.erase_swap(testColIndex);			if (TestMoverInCells(mover, atCol))			{				// Ok, We've Found A Safe Column To Insert This Mover				//----------------------------------------------------				InsertMoverInCells(mover, atCol);				// Now Transport The Actual Mover Entity Into Position, Link It & Send It Off				//----------------------------------------------------------------------------				CVec3	StartPos(mGridBottomLeftCorner);				StartPos[mWAxis] += ((atCol * mGridCellSize) + ((mover->mCols/2.0f) * mGridCellSize));				StartPos[mHAxis] += (((mover->mRows/2.0f) * mGridCellSize) * ((mNegative)?(1):(-1)));				StartPos[2] = 0;				// If Centered, Actually Put It At EXACTLY The Right Position On The Width Axis				//------------------------------------------------------------------------------				if (mover->mCenter)				{					StartPos[mWAxis] = mGridCenter[mWAxis];					float	deltaOffset = mGridCenter[mWAxis] - mover->mOriginOffset[mWAxis];					if (deltaOffset<(mGridCellSize*0.5f) )					{						StartPos[mWAxis] -= deltaOffset;					}				}				StartPos -= mover->mOriginOffset;				G_SetOrigin(mover->mEnt, StartPos.v);				// Start It Moving				//-----------------				VectorCopy(StartPos.v, mover->mEnt->s.pos.trBase);				VectorCopy(mVelocity.v, mover->mEnt->s.pos.trDelta);				mover->mEnt->s.pos.trTime		= level.time;				mover->mEnt->s.pos.trDuration	= mTravelTimeMilliseconds + (mNextUpdateDelay*mover->mRows);				mover->mEnt->s.pos.trType		= TR_LINEAR_STOP;				mover->mEnt->s.eFlags			&= ~EF_NODRAW;				mover->mSoundPlayed				= false;				// Successfully Inserted This Mover.  Now Move On To The Next Mover				//------------------------------------------------------------------				break;			}		}	}	// Incriment The Current Row	//---------------------------	mRow++;	if (mRow>=mRows)	{		mRow = 0;	}	// Erase The Erase Row	//---------------------	int	EraseRow = mRow - MAX_ROW_HISTORY;	if (EraseRow<0)	{		EraseRow += mRows;	}	for (int col=0; col<mCols; col++)	{		mCells.get(col, EraseRow) = 0;	}}
开发者ID:Almightygir,项目名称:OpenJK,代码行数:101,


示例5: SP_target_position

/*QUAKED target_position (0 0.5 0) (-4 -4 -4) (4 4 4)Used as a positional target for in-game calculation, like jumppad targets.info_notnull does the same thing*/void SP_target_position( gentity_t *self ){	G_SetOrigin( self, self->s.origin );}
开发者ID:Joanxt,项目名称:OpenJK,代码行数:7,


示例6: SP_target_smoke

/** * @brief SP_target_smoke * @param[in,out] ent */void SP_target_smoke(gentity_t *ent){	char *buffer;	if (G_SpawnString("shader", "", &buffer))	{		ent->s.modelindex2 = G_ShaderIndex(buffer);	}	else	{		ent->s.modelindex2 = 0;	}	// modified this a lot to be sent to the client as one entity and then is shown at the client	if (ent->delay == 0.f)	{		ent->delay = 100;	}	ent->use = smoke_toggle;	ent->think     = smoke_init;	ent->nextthink = level.time + FRAMETIME;	G_SetOrigin(ent, ent->s.origin);	ent->r.svFlags = 0;	ent->s.eType   = ET_SMOKER;	if (ent->spawnflags & 2)	{		ent->s.density = 4;	}	else	{		ent->s.density = 0;	}	// using "time"	ent->s.time = ent->speed;	if (!ent->s.time)	{		ent->s.time = 5000; // 5 seconds	}	ent->s.time2 = ent->duration;	if (!ent->s.time2)	{		ent->s.time2 = 2000;	}	ent->s.angles2[0] = ent->start_size;	if (ent->s.angles2[0] == 0.f)	{		ent->s.angles2[0] = 24;	}	ent->s.angles2[1] = ent->end_size;	if (ent->s.angles2[1] == 0.f)	{		ent->s.angles2[1] = 96;	}	ent->s.angles2[2] = ent->wait;	if (ent->s.angles2[2] == 0.f)	{		ent->s.angles2[2] = 50;	}	// idiot check	if (ent->s.time < ent->s.time2)	{		ent->s.time = ent->s.time2 + 100;	}	if (ent->spawnflags & 8)	{		ent->s.frame = 1;	}	ent->s.dl_intensity  = ent->health;	ent->s.constantLight = ent->delay;	if (ent->spawnflags & 4)	{		trap_LinkEntity(ent);	}}
开发者ID:ioid3-games,项目名称:ioid3-wet,代码行数:91,


示例7: G_Spawn

gentity_t *SpawnObelisk( vec3_t origin, int team, int spawnflags) {	trace_t		tr;	vec3_t		dest;	gentity_t	*ent;	ent = G_Spawn();	VectorCopy( origin, ent->s.origin );	VectorCopy( origin, ent->s.pos.trBase );	VectorCopy( origin, ent->r.currentOrigin );	VectorSet( ent->r.mins, -15, -15, 0 );	VectorSet( ent->r.maxs, 15, 15, 87 );	ent->s.eType = ET_GENERAL;	ent->flags = FL_NO_KNOCKBACK;	if( g_gametype.integer == GT_OBELISK ) {		ent->r.contents = CONTENTS_SOLID;		ent->takedamage = qtrue;		ent->health = g_obeliskHealth.integer;		ent->die = ObeliskDie;		ent->pain = ObeliskPain;		ent->think = ObeliskRegen;		ent->nextthink = level.time + g_obeliskRegenPeriod.integer * 1000;	}	if( g_gametype.integer == GT_HARVESTER ) {		ent->r.contents = CONTENTS_TRIGGER;		ent->touch = ObeliskTouch;	}	if ( spawnflags & 1 ) {		// suspended		G_SetOrigin( ent, ent->s.origin );	} else {		// mappers like to put them exactly on the floor, but being coplanar		// will sometimes show up as starting in solid, so lif it up one pixel		ent->s.origin[2] += 1;		// drop to floor		VectorSet( dest, ent->s.origin[0], ent->s.origin[1], ent->s.origin[2] - 4096 );		trap_Trace( &tr, ent->s.origin, ent->r.mins, ent->r.maxs, dest, ent->s.number, MASK_SOLID );		if ( tr.startsolid ) {			ent->s.origin[2] -= 1;			G_Printf( "SpawnObelisk: %s startsolid at %s/n", ent->classname, vtos(ent->s.origin) );			ent->s.groundEntityNum = ENTITYNUM_NONE;			G_SetOrigin( ent, ent->s.origin );		}		else {			// allow to ride movers			ent->s.groundEntityNum = tr.entityNum;			G_SetOrigin( ent, tr.endpos );		}	}	ent->spawnflags = team;	trap_LinkEntity( ent );	return ent;}
开发者ID:bboozzoo,项目名称:ioquake3,代码行数:62,


示例8: FinishSpawningItem

/*** @brief Traces down to find where an item should rest, instead of letting them*        free fall from their spawn points.*/void FinishSpawningItem(gentity_t *ent){    trace_t tr;    vec3_t  dest;    vec3_t  maxs;    if (ent->spawnflags & 1)     // suspended    {        VectorSet(ent->r.mins, -ITEM_RADIUS, -ITEM_RADIUS, -ITEM_RADIUS);        VectorSet(ent->r.maxs, ITEM_RADIUS, ITEM_RADIUS, ITEM_RADIUS);        VectorCopy(ent->r.maxs, maxs);    }    else    {        // had to modify this so that items would spawn in shelves        VectorSet(ent->r.mins, -ITEM_RADIUS, -ITEM_RADIUS, 0);        VectorSet(ent->r.maxs, ITEM_RADIUS, ITEM_RADIUS, ITEM_RADIUS);        VectorCopy(ent->r.maxs, maxs);        maxs[2] /= 2;    }    ent->r.contents   = CONTENTS_TRIGGER | CONTENTS_ITEM;    ent->touch        = Touch_Item_Auto;    ent->s.eType      = ET_ITEM;    ent->s.modelindex = ent->item - bg_itemlist;        // store item number in modelindex    ent->s.otherEntityNum2 = 0;     // takes modelindex2's place in signaling a dropped item    // we don't use this (yet, anyway) so I'm taking it so you can specify a model for treasure items and clipboards    //ent->s.modelindex2 = 0; // zero indicates this isn't a dropped item    if (ent->model)    {        ent->s.modelindex2 = G_ModelIndex(ent->model);    }    // using an item causes it to respawn    ent->use = Use_Item;    // moved this up so it happens for suspended items too (and made it a function)    G_SetAngle(ent, ent->s.angles);    if (ent->spawnflags & 1)        // suspended    {        G_SetOrigin(ent, ent->s.origin);    }    else    {        VectorSet(dest, ent->s.origin[0], ent->s.origin[1], ent->s.origin[2] - 4096);        trap_Trace(&tr, ent->s.origin, ent->r.mins, maxs, dest, ent->s.number, MASK_SOLID);        if (tr.startsolid)        {            vec3_t temp;            VectorCopy(ent->s.origin, temp);            temp[2] -= ITEM_RADIUS;            VectorSet(dest, ent->s.origin[0], ent->s.origin[1], ent->s.origin[2] - 4096);            trap_Trace(&tr, temp, ent->r.mins, maxs, dest, ent->s.number, MASK_SOLID);        }        if (tr.startsolid)        {            G_Printf("FinishSpawningItem: %s startsolid at %s/n", ent->classname, vtos(ent->s.origin));            G_FreeEntity(ent);            return;        }        // allow to ride movers        ent->s.groundEntityNum = tr.entityNum;        G_SetOrigin(ent, tr.endpos);    }    if (ent->spawnflags & 2)          // spin    {        ent->s.eFlags |= EF_SPINNING;    }    // team slaves and targeted items aren't present at start    if ((ent->flags & FL_TEAMSLAVE) || ent->targetname)    {        ent->flags |= FL_NODRAW;        //ent->s.eFlags |= EF_NODRAW;        ent->r.contents = 0;        return;    }    // health/ammo can potentially be multi-stage (multiple use)    if (ent->item->giType == IT_HEALTH || ent->item->giType == IT_AMMO)    {        int i;        // having alternate models defined in bg_misc.c for a health or ammo item specify it as "multi-stage"        // - left-hand operand of comma expression has no effect        // initial line: for(i=0;i<4,ent->item->world_model[i];i++) {}        for (i = 0; i < 4 && ent->item->world_model[i] ; i++)//.........这里部分代码省略.........
开发者ID:rafal1137,项目名称:etlegacy,代码行数:101,


示例9: G_Spawn

/*** @brief Spawns an item and tosses it forward.*/gentity_t *LaunchItem(gitem_t *item, vec3_t origin, vec3_t velocity, int ownerNum){    gentity_t *dropped = G_Spawn();    trace_t   tr;    vec3_t    vec, temp;    dropped->s.eType           = ET_ITEM;    dropped->s.modelindex      = item - bg_itemlist; // store item number in modelindex    dropped->s.otherEntityNum2 = 1; // this is taking modelindex2's place for a dropped item    dropped->classname = item->classname;    dropped->item      = item;    VectorSet(dropped->r.mins, -ITEM_RADIUS, -ITEM_RADIUS, 0);              // so items sit on the ground    VectorSet(dropped->r.maxs, ITEM_RADIUS, ITEM_RADIUS, 2 * ITEM_RADIUS);    // so items sit on the ground    dropped->r.contents = CONTENTS_TRIGGER | CONTENTS_ITEM;    dropped->clipmask = CONTENTS_SOLID | CONTENTS_MISSILECLIP;      // fix for items falling through grates    dropped->touch = Touch_Item_Auto;    trap_Trace(&tr, origin, dropped->r.mins, dropped->r.maxs, origin, ownerNum, MASK_SOLID);    if (tr.startsolid)    {        int i;        VectorSubtract(g_entities[ownerNum].s.origin, origin, temp);        VectorNormalize(temp);        for (i = 16; i <= 48; i += 16)        {            VectorScale(temp, i, vec);            VectorAdd(origin, vec, origin);            trap_Trace(&tr, origin, dropped->r.mins, dropped->r.maxs, origin, ownerNum, MASK_SOLID);            if (!tr.startsolid)            {                break;            }        }    }    G_SetOrigin(dropped, origin);    dropped->s.pos.trType = TR_GRAVITY;    dropped->s.pos.trTime = level.time;    VectorCopy(velocity, dropped->s.pos.trDelta);    // set yaw to parent angles    temp[PITCH] = 0;    temp[YAW]   = g_entities[ownerNum].s.apos.trBase[YAW];    temp[ROLL]  = 0;    G_SetAngle(dropped, temp);    dropped->s.eFlags |= EF_BOUNCE_HALF;    if (item->giType == IT_TEAM)     // Special case for CTF flags    {        gentity_t *flag = &g_entities[g_entities[ownerNum].client->flagParent];        dropped->s.otherEntityNum = g_entities[ownerNum].client->flagParent;    // store the entitynum of our original flag spawner        dropped->s.density        = 1;        dropped->think            = Team_DroppedFlagThink;        dropped->nextthink        = level.time + 30000;        if (level.gameManager)        {            G_Script_ScriptEvent(level.gameManager, "trigger", flag->item->giTag == PW_REDFLAG ? "allied_object_dropped" : "axis_object_dropped");        }        G_Script_ScriptEvent(flag, "trigger", "dropped");    }    else     // auto-remove after 30 seconds    {        dropped->think     = G_FreeEntity;        dropped->nextthink = level.time + 30000;    }    dropped->flags = FL_DROPPED_ITEM;    trap_LinkEntity(dropped);    return dropped;}
开发者ID:rafal1137,项目名称:etlegacy,代码行数:84,


示例10: SpawnCorpse

//.........这里部分代码省略.........  trace_t     tr;  float       vDiff;  //just return right away so bodies never appear and its cleaner + faster  return;  VectorCopy( ent->r.currentOrigin, origin );  trap_UnlinkEntity( ent );  // if client is in a nodrop area, don't leave the body  contents = trap_PointContents( origin, -1 );  if( contents & CONTENTS_NODROP )    return;  body = G_Spawn( );  VectorCopy( ent->s.apos.trBase, body->s.angles );  body->s.eFlags = EF_DEAD;  body->s.eType = ET_CORPSE;  body->s.number = body - g_entities;  body->timestamp = level.time;  body->s.event = 0;  body->r.contents = CONTENTS_CORPSE;  body->s.clientNum = ent->client->ps.stats[ STAT_PCLASS ];  body->nonSegModel = ent->client->ps.persistant[ PERS_STATE ] & PS_NONSEGMODEL;  if( ent->client->ps.stats[ STAT_PTEAM ] == PTE_HUMANS )    body->classname = "humanCorpse";  else    body->classname = "alienCorpse";  body->s.powerups = MAX_CLIENTS;  body->think = BodySink;  body->nextthink = level.time + 20000;  body->s.legsAnim = ent->s.legsAnim;  if( !body->nonSegModel )  {    switch( body->s.legsAnim & ~ANIM_TOGGLEBIT )    {      case BOTH_DEATH1:      case BOTH_DEAD1:        body->s.torsoAnim = body->s.legsAnim = BOTH_DEAD1;        break;      case BOTH_DEATH2:      case BOTH_DEAD2:        body->s.torsoAnim = body->s.legsAnim = BOTH_DEAD2;        break;      case BOTH_DEATH3:      case BOTH_DEAD3:      default:        body->s.torsoAnim = body->s.legsAnim = BOTH_DEAD3;        break;    }  }  else  {    switch( body->s.legsAnim & ~ANIM_TOGGLEBIT )    {      case NSPA_DEATH1:      case NSPA_DEAD1:        body->s.legsAnim = NSPA_DEAD1;        break;      case NSPA_DEATH2:      case NSPA_DEAD2:        body->s.legsAnim = NSPA_DEAD2;        break;      case NSPA_DEATH3:      case NSPA_DEAD3:      default:        body->s.legsAnim = NSPA_DEAD3;        break;    }  }  body->takedamage = qfalse;  body->health = ent->health = ent->client->ps.stats[ STAT_HEALTH ];  ent->health = 0;  //change body dimensions  BG_FindBBoxForClass( ent->client->ps.stats[ STAT_PCLASS ], NULL, NULL, NULL, body->r.mins, body->r.maxs );  vDiff = body->r.mins[ 2 ] - ent->r.mins[ 2 ];  //drop down to match the *model* origins of ent and body  VectorSet( dest, origin[ 0 ], origin[ 1 ], origin[ 2 ] - vDiff );  trap_Trace( &tr, origin, body->r.mins, body->r.maxs, dest, body->s.number, body->clipmask );  VectorCopy( tr.endpos, origin );  G_SetOrigin( body, origin );  VectorCopy( origin, body->s.origin );  body->s.pos.trType = TR_GRAVITY;  body->s.pos.trTime = level.time;  VectorCopy( ent->client->ps.velocity, body->s.pos.trDelta );  VectorCopy ( body->s.pos.trBase, body->r.currentOrigin );  trap_LinkEntity( body );}
开发者ID:asker,项目名称:OmgHaxQVM,代码行数:101,


示例11: ClientSpawn

//.........这里部分代码省略.........	if ( g_gametype.integer == GT_TEAM ) {		client->ps.ammo[WP_BRYAR_PISTOL] = 50;	} else {		client->ps.ammo[WP_BRYAR_PISTOL] = 100;	}*/	client->ps.rocketLockIndex = MAX_CLIENTS;	client->ps.rocketLockTime = 0;	//rww - Set here to initialize the circling seeker drone to off.	//A quick note about this so I don't forget how it works again:	//ps.genericEnemyIndex is kept in sync between the server and client.	//When it gets set then an entitystate value of the same name gets	//set along with an entitystate flag in the shared bg code. Which	//is why a value needs to be both on the player state and entity state.	//(it doesn't seem to just carry over the entitystate value automatically	//because entity state value is derived from player state data or some	//such)	client->ps.genericEnemyIndex = -1;	client->ps.isJediMaster = qfalse;	client->ps.fallingToDeath = 0;	//Do per-spawn force power initialization	WP_SpawnInitForcePowers( ent );	// health will count down towards max_health	ent->health = client->ps.stats[STAT_HEALTH] = client->ps.stats[STAT_MAX_HEALTH];// * 1.25;		Boot - no extra 25 hp on start.	// Start with a small amount of armor as well.	client->ps.stats[STAT_ARMOR] = client->ps.stats[STAT_MAX_HEALTH] * 0.25;	G_SetOrigin( ent, spawn_origin );	VectorCopy( spawn_origin, client->ps.origin );	// the respawned flag will be cleared after the attack and jump keys come up	client->ps.pm_flags |= PMF_RESPAWNED;	trap_GetUsercmd( client - level.clients, &ent->client->pers.cmd );	SetClientViewAngle( ent, spawn_angles );	if ( ent->client->sess.sessionTeam == TEAM_SPECTATOR ) {	} else {		G_KillBox( ent );		trap_LinkEntity (ent);		// force the base weapon up		client->ps.weapon = WP_BRYAR_PISTOL;		client->ps.weaponstate = FIRST_WEAPON;	}	// don't allow full run speed for a bit	client->ps.pm_flags |= PMF_TIME_KNOCKBACK;	client->ps.pm_time = 100;	client->respawnTime = level.time;	client->inactivityTime = level.time + g_inactivity.integer * 1000;	client->latched_buttons = 0;	// set default animations	client->ps.torsoAnim = WeaponReadyAnim[client->ps.weapon];	client->ps.legsAnim = WeaponReadyAnim[client->ps.weapon];
开发者ID:Boothand,项目名称:SaberShenanigans,代码行数:66,


示例12: G_MissileImpact

//.........这里部分代码省略.........        return;    }    else if( !strcmp( ent->classname, "lockblob" ) )    {        if( other->client && other->client->ps.stats[ STAT_TEAM ] == TEAM_HUMANS )        {            other->client->ps.stats[ STAT_STATE ] |= SS_BLOBLOCKED;            other->client->lastLockTime = level.time;            AngleVectors( other->client->ps.viewangles, dir, NULL, NULL );            other->client->ps.stats[ STAT_VIEWLOCK ] = DirToByte( dir );        }    }    else if( !strcmp( ent->classname, "slowblob" ) )    {        if( other->client && other->client->ps.stats[ STAT_TEAM ] == TEAM_HUMANS )        {            other->client->ps.stats[ STAT_STATE ] |= SS_SLOWLOCKED;            other->client->lastSlowTime = level.time;            AngleVectors( other->client->ps.viewangles, dir, NULL, NULL );            other->client->ps.stats[ STAT_VIEWLOCK ] = DirToByte( dir );        }    }    else if( !strcmp( ent->classname, "hive" ) )    {        if( other->s.eType == ET_BUILDABLE && other->s.modelindex == BA_A_HIVE )        {            if( !ent->parent )                G_Printf( S_COLOR_YELLOW "WARNING: hive entity has no parent in G_MissileImpact/n" );            else                ent->parent->active = qfalse;            G_FreeEntity( ent );            return;        }        else        {            //prevent collision with the client when returning            ent->r.ownerNum = other->s.number;            ent->think = G_ExplodeMissile;            ent->nextthink = level.time + FRAMETIME;            //only damage humans            if( other->client && other->client->ps.stats[ STAT_TEAM ] == TEAM_HUMANS )                returnAfterDamage = qtrue;            else                return;        }    }    // impact damage    if( other->takedamage )    {        // FIXME: wrong damage direction?        if( ent->damage )        {            vec3_t  velocity;            BG_EvaluateTrajectoryDelta( &ent->s.pos, level.time, velocity );            if( VectorLength( velocity ) == 0 )                velocity[ 2 ] = 1;  // stepped on a grenade            G_Damage( other, ent, attacker, velocity, ent->s.origin, ent->damage,                      DAMAGE_NO_LOCDAMAGE, ent->methodOfDeath );        }    }    if( returnAfterDamage )        return;    // is it cheaper in bandwidth to just remove this ent and create a new    // one, rather than changing the missile into the explosion?    if( other->takedamage &&            ( other->s.eType == ET_PLAYER || other->s.eType == ET_BUILDABLE ) )    {        G_AddEvent( ent, EV_MISSILE_HIT, DirToByte( trace->plane.normal ) );        ent->s.otherEntityNum = other->s.number;    }    else if( trace->surfaceFlags & SURF_METALSTEPS )        G_AddEvent( ent, EV_MISSILE_MISS_METAL, DirToByte( trace->plane.normal ) );    else        G_AddEvent( ent, EV_MISSILE_MISS, DirToByte( trace->plane.normal ) );    ent->freeAfterEvent = qtrue;    // change over to a normal entity right at the point of impact    ent->s.eType = ET_GENERAL;    SnapVectorTowards( trace->endpos, ent->s.pos.trBase );  // save net bandwidth    G_SetOrigin( ent, trace->endpos );    // splash damage (doesn't apply to person directly hit)    if( ent->splashDamage )        G_RadiusDamage( trace->endpos, ent->parent, ent->splashDamage, ent->splashRadius,                        other, ent->splashMethodOfDeath );    trap_LinkEntity( ent );}
开发者ID:GrangerHub,项目名称:tremulous,代码行数:101,


示例13: Think_SetupObjectiveInfo

// links the trigger to it's objective, determining if it's a func_explosive// of func_constructible and spawning the right indicatorvoid Think_SetupObjectiveInfo(gentity_t *ent){	ent->target_ent = G_FindByTargetname(NULL, ent->target);	if (!ent->target_ent)	{		G_Error("'trigger_objective_info' has a missing target '%s'/n", ent->target);	}	if (ent->target_ent->s.eType == ET_EXPLOSIVE)	{		// this is for compass usage		if ((ent->spawnflags & AXIS_OBJECTIVE) || (ent->spawnflags & ALLIED_OBJECTIVE))		{			gentity_t *e = G_Spawn();			e->r.svFlags = SVF_BROADCAST;			e->classname = "explosive_indicator";			if (ent->spawnflags & 8)			{				e->s.eType = ET_TANK_INDICATOR;			}			else			{				e->s.eType = ET_EXPLOSIVE_INDICATOR;			}			e->parent       = ent;			e->s.pos.trType = TR_STATIONARY;			if (ent->spawnflags & AXIS_OBJECTIVE)			{				e->s.teamNum = 1;			}			else if (ent->spawnflags & ALLIED_OBJECTIVE)			{				e->s.teamNum = 2;			}			G_SetOrigin(e, ent->r.currentOrigin);			e->s.modelindex2 = ent->s.teamNum;			e->r.ownerNum    = ent->s.number;			e->think         = explosive_indicator_think;			e->nextthink     = level.time + FRAMETIME;			e->s.effect1Time = ent->target_ent->constructibleStats.weaponclass;			if (ent->tagParent)			{				e->tagParent = ent->tagParent;				Q_strncpyz(e->tagName, ent->tagName, MAX_QPATH);			}			else			{				VectorCopy(ent->r.absmin, e->s.pos.trBase);				VectorAdd(ent->r.absmax, e->s.pos.trBase, e->s.pos.trBase);				VectorScale(e->s.pos.trBase, 0.5, e->s.pos.trBase);			}			SnapVector(e->s.pos.trBase);			trap_LinkEntity(e);			ent->target_ent->parent = ent;		}	}	else if (ent->target_ent->s.eType == ET_CONSTRUCTIBLE)	{		gentity_t *constructibles[2];		int       team[2] = { 0 };		ent->target_ent->parent = ent;		constructibles[0] = ent->target_ent;		constructibles[1] = G_FindByTargetname(constructibles[0], ent->target);     // see if we are targetting a 2nd one for two team constructibles		team[0] = constructibles[0]->spawnflags & AXIS_CONSTRUCTIBLE ? TEAM_AXIS : TEAM_ALLIES;		constructibles[0]->s.otherEntityNum2 = ent->s.teamNum;		if (constructibles[1])		{			team[1] = constructibles[1]->spawnflags & AXIS_CONSTRUCTIBLE ? TEAM_AXIS : TEAM_ALLIES;			if (constructibles[1]->s.eType != ET_CONSTRUCTIBLE)			{				G_Error("'trigger_objective_info' targets multiple entities with targetname '%s', the second one isn't a 'func_constructible' [%d]/n", ent->target, constructibles[1]->s.eType);			}			if (team[0] == team[1])			{				G_Error("'trigger_objective_info' targets two 'func_constructible' entities with targetname '%s' that are constructible by the same team/n", ent->target);			}			constructibles[1]->s.otherEntityNum2 = ent->s.teamNum;			ent->chain         = constructibles[1];			ent->chain->parent = ent;//.........这里部分代码省略.........
开发者ID:Mailaender,项目名称:etlegacy,代码行数:101,


示例14: G_smvRunCamera

// Set up snapshot merge based on this portalqboolean G_smvRunCamera( gentity_t *ent ) {	int id = ent->TargetFlag;	int chargeTime, sprintTime, hintTime, weapHeat;	playerState_t *tps, *ps;	// Opt out if not a real MV portal	if ( ent->tagParent == NULL || ent->tagParent->client == NULL ) {		return( qfalse );	}	if ( ( ps = &ent->tagParent->client->ps ) == NULL ) {		return( qfalse );	}	// If viewing client is no longer connected, delete this camera	if ( ent->tagParent->client->pers.connected != CON_CONNECTED ) {		G_FreeEntity( ent );		return( qtrue );	}	// Also remove if the target player is no longer in the game playing	if ( ent->target_ent->client->pers.connected != CON_CONNECTED ||		 ent->target_ent->client->sess.sessionTeam == TEAM_SPECTATOR ) {		G_smvLocateEntityInMVList( ent->tagParent, ent->target_ent - g_entities, qtrue );		return( qtrue );	}	// Seems that depending on player's state, we pull from either r.currentOrigin, or s.origin	//		if(!spec) then use: r.currentOrigin	//		if(spec) then use:  s.origin	//	// This is true for both the portal origin and its target (origin2)	//	VectorCopy( ent->tagParent->s.origin, ent->s.origin );	G_SetOrigin( ent, ent->s.origin );	VectorCopy( ent->target_ent->r.currentOrigin, ent->s.origin2 );	trap_LinkEntity( ent );	// Only allow client ids 0 to (MAX_MVCLIENTS-1) to be updated with extra info	if ( id >= MAX_MVCLIENTS ) {		return( qtrue );	}	tps = &ent->target_ent->client->ps;	if ( tps->stats[STAT_PLAYER_CLASS] == PC_ENGINEER ) {		chargeTime = g_engineerChargeTime.value;	} else if ( tps->stats[STAT_PLAYER_CLASS] == PC_MEDIC ) {		chargeTime = g_medicChargeTime.value;	} else if ( tps->stats[STAT_PLAYER_CLASS] == PC_FIELDOPS )                                                                                                {		chargeTime = g_LTChargeTime.value;	} else if ( tps->stats[STAT_PLAYER_CLASS] == PC_COVERTOPS )                                                                                                                                                                                               {		chargeTime = g_covertopsChargeTime.value;	} else { chargeTime = g_soldierChargeTime.value;}	chargeTime = ( level.time - tps->classWeaponTime >= (int)chargeTime ) ? 0 : ( 1 + floor( 15.0f * (float)( level.time - tps->classWeaponTime ) / chargeTime ) );	sprintTime = ( ent->target_ent->client->pmext.sprintTime >= 20000 ) ? 0.0f : ( 1 + floor( 7.0f * (float)ent->target_ent->client->pmext.sprintTime / 20000.0f ) );	weapHeat   = floor( (float)tps->curWeapHeat * 15.0f / 255.0f );	hintTime   = ( tps->serverCursorHint != HINT_BUILD && ( tps->serverCursorHintVal >= 255 || tps->serverCursorHintVal == 0 ) ) ?				 0 : ( 1 + floor( 15.0f * (float)tps->serverCursorHintVal / 255.0f ) );	// (Remaining bits)	// ammo      : 0	// ammo-1    : 0	// ammiclip  : 0	// ammoclip-1: 16	id = MAX_WEAPONS - 1 - ( id * 2 );	if ( tps->pm_flags & PMF_LIMBO ) {		ps->ammo[id] = 0;		ps->ammo[id - 1] = 0;		ps->ammoclip[id - 1] = 0;	} else {		ps->ammo[id]  = ( ( ( ent->target_ent->health > 0 ) ? ent->target_ent->health : 0 ) & 0xFF ); // Meds up to 140 :(		ps->ammo[id] |= ( hintTime & 0x0F ) << 8; // 4 bits for work on current item (dynamite, weapon repair, etc.)		ps->ammo[id] |= ( weapHeat & 0x0F ) << 12; // 4 bits for weapon heat info		ps->ammo[id - 1]  = tps->ammo[BG_FindAmmoForWeapon( tps->weapon )] & 0x3FF;   // 11 bits needed to cover 1500 Venom ammo		ps->ammo[id - 1] |= ( BG_simpleWeaponState( tps->weaponstate ) & 0x03 ) << 11;  // 2 bits for current weapon state		ps->ammo[id - 1] |= ( ( tps->persistant[PERS_HWEAPON_USE] ) ? 1 : 0 ) << 13;    // 1 bit for mg42 use		ps->ammo[id - 1] |= ( BG_simpleHintsCollapse( tps->serverCursorHint, hintTime ) & 0x03 ) << 14; // 2 bits for cursor hints//	G_Printf("tps->hint: %d, dr: %d, collapse: %d/n", tps->serverCursorHint, HINT_DOOR_ROTATING, G_simpleHintsCollapse(tps->serverCursorHint, hintTime));		ps->ammoclip[id - 1]  = tps->ammoclip[BG_FindClipForWeapon( tps->weapon )] & 0x1FF;   // 9 bits to cover 500 Venom ammo clip		ps->ammoclip[id - 1] |= ( chargeTime & 0x0F ) << 9;   // 4 bits for weapon charge time		ps->ammoclip[id - 1] |= ( sprintTime & 0x07 ) << 13;  // 3 bits for fatigue	}	return( qtrue );}
开发者ID:AdrienJaguenet,项目名称:Enemy-Territory,代码行数:92,


示例15: Cmd_Fx

//------------------void Cmd_Fx( gentity_t *ent ){	vec3_t		dir;	gentity_t	*fx_ent = NULL;	if ( Q_stricmp( gi.argv(1), "play" ) == 0 )	{		if ( gi.argc() == 3 )		{			// I guess, only allow one active at a time			while (( fx_ent = G_Find( fx_ent, FOFS(classname), "cmd_fx")) != NULL ) 			{				G_FreeEntity( fx_ent );			}			fx_ent = G_Spawn();			fx_ent->fxFile = gi.argv( 2 );			// Move out in front of the person spawning the effect			AngleVectors( ent->currentAngles, dir, NULL, NULL );			VectorMA( ent->currentOrigin, 32, dir, fx_ent->s.origin );extern void SP_fx_runner( gentity_t *ent );			SP_fx_runner( fx_ent );			fx_ent->delay = 2000;			// adjusting delay			fx_ent->classname = "cmd_fx";	//	and classname			return;		}	}	else if ( Q_stricmp( gi.argv(1), "stop" ) == 0 )	{		while (( fx_ent = G_Find( fx_ent, FOFS(classname), "cmd_fx")) != NULL ) 		{			G_FreeEntity( fx_ent );		}		return;	}	else if ( Q_stricmp( gi.argv(1), "delay" ) == 0 )	{		while (( fx_ent = G_Find( fx_ent, FOFS(classname), "cmd_fx")) != NULL ) 		{			if ( gi.argc() == 3 )			{				fx_ent->delay = atoi( gi.argv( 2 ));			}			else			{				gi.Printf( S_COLOR_GREEN"FX: current delay is: %i/n", fx_ent->delay );			}			return;		}	}	else if ( Q_stricmp( gi.argv(1), "random" ) == 0 )	{		while (( fx_ent = G_Find( fx_ent, FOFS(classname), "cmd_fx")) != NULL ) 		{			if ( gi.argc() == 3 )			{				fx_ent->random = atoi( gi.argv( 2 ));			}			else			{				gi.Printf( S_COLOR_GREEN"FX: current random is: %6.2f/n", fx_ent->random );			}			return;		}	}	else if ( Q_stricmp( gi.argv(1), "origin" ) == 0 )	{		while (( fx_ent = G_Find( fx_ent, FOFS(classname), "cmd_fx")) != NULL ) 		{			if ( gi.argc() == 5 )			{				fx_ent->s.origin[0] = atof( gi.argv( 2 ));				fx_ent->s.origin[1] = atof( gi.argv( 3 ));				fx_ent->s.origin[2] = atof( gi.argv( 4 ));				G_SetOrigin( fx_ent, fx_ent->s.origin );			}			else			{				gi.Printf( S_COLOR_GREEN"FX: current origin is: <%6.2f %6.2f %6.2f>/n", 									fx_ent->currentOrigin[0], fx_ent->currentOrigin[1], fx_ent->currentOrigin[2] );			}			return;		}	}	else if ( Q_stricmp( gi.argv(1), "dir" ) == 0 )	{		while (( fx_ent = G_Find( fx_ent, FOFS(classname), "cmd_fx")) != NULL ) 		{			if ( gi.argc() == 5 )//.........这里部分代码省略.........
开发者ID:PJayB,项目名称:jk3src,代码行数:101,


示例16: G_RunExPhys

//.........这里部分代码省略.........		VectorSubtract( &ent->r.currentOrigin, &projectedOrigin, &trajDif );		while ( i < numG2Bolts ) {			//Get the position of the actual bolt for this frame			trap->G2API_GetBoltMatrix( ent->ghoul2, 0, g2Bolts[i], &matrix, &gbmAngles, &ent->r.currentOrigin, level.time, NULL, &ent->modelScale );			BG_GiveMeVectorFromMatrix( &matrix, ORIGIN, &boneOrg );			//Now add the projected positional difference into the result			VectorAdd( &boneOrg, &trajDif, &projectedBoneOrg );			trap->Trace( &tr, &boneOrg, &tMins, &tMaxs, &projectedBoneOrg, ent->s.number, ent->clipmask, qfalse, 0, 0 );			if ( tr.fraction != 1.0f || tr.startsolid || tr.allsolid ) { //we've hit something				//Store the "deepest" collision we have				if ( !hasFirstCollision ) { //don't have one yet so just use this one					bestCollision = tr;					VectorCopy( &boneOrg, &collisionRootPos );					hasFirstCollision = qtrue;				}				else {					if ( tr.allsolid && !bestCollision.allsolid ) { //If the whole trace is solid then this one is deeper						bestCollision = tr;						VectorCopy( &boneOrg, &collisionRootPos );					}					else if ( tr.startsolid && !bestCollision.startsolid && !bestCollision.allsolid ) { //Next deepest is if it's startsolid						bestCollision = tr;						VectorCopy( &boneOrg, &collisionRootPos );					}					else if ( !bestCollision.startsolid && !bestCollision.allsolid &&						tr.fraction < bestCollision.fraction ) { //and finally, if neither is startsolid/allsolid, but the new one has a smaller fraction, then it's closer to an impact point so we will use it						bestCollision = tr;						VectorCopy( &boneOrg, &collisionRootPos );					}				}			}			i++;		}		if ( hasFirstCollision ) { //at least one bolt collided			//We'll get the offset between the collided bolt and endpos, then trace there			//from the origin so that our desired position becomes that point.			VectorSubtract( &collisionRootPos, &bestCollision.endpos, &trajDif );			VectorAdd( &ent->r.currentOrigin, &trajDif, &projectedOrigin );		}	}	//If we didn't collide with any bolts projectedOrigin will still be the original desired	//projected position so all is well. If we did then projectedOrigin will be modified	//to provide us with a relative position which does not place the bolt in a solid.	trap->Trace( &tr, &ent->r.currentOrigin, &ent->r.mins, &ent->r.maxs, &projectedOrigin, ent->s.number, ent->clipmask, qfalse, 0, 0 );	if ( tr.startsolid || tr.allsolid ) { //can't go anywhere from here#ifdef _DEBUG		Com_Printf( "ExPhys object in solid (%i)/n", ent->s.number );#endif		if ( autoKill ) {			ent->think = G_FreeEntity;			ent->nextthink = level.time;		}		return;	}	//Go ahead and set it to the trace endpoint regardless of what it hit	G_SetOrigin( ent, &tr.endpos );	trap->LinkEntity( (sharedEntity_t *)ent );	if ( tr.fraction == 1.0f ) { //Nothing was in the way.		return;	}	if ( bounce ) {		vTotal *= bounce; //scale it by bounce		VectorScale( &tr.plane.normal, vTotal, &vNorm ); //scale the trace plane normal by the bounce factor		if ( vNorm.z > 0 ) {			ent->epGravFactor -= vNorm.z*(1.0f - mass); //The lighter it is the more gravity will be reduced by bouncing vertically.			if ( ent->epGravFactor < 0 ) {				ent->epGravFactor = 0;			}		}		//call touch first so we can check velocity upon impact if we want		if ( tr.entityNum != ENTITYNUM_NONE && ent->touch ) { //then call the touch function			ent->touch( ent, &g_entities[tr.entityNum], &tr );		}		VectorAdd( &ent->epVelocity, &vNorm, &ent->epVelocity ); //add it into the existing velocity.	}	else { //if no bounce, kill when it hits something.		ent->epVelocity.x = 0;		ent->epVelocity.y = 0;		if ( !gravity ) {			ent->epVelocity.z = 0;		}	}}
开发者ID:MatthewCZ,项目名称:Ja,代码行数:101,


示例17: G_Spawn

/*================LaunchItemSpawns an item and tosses it forward================*/gentity_t *LaunchItem( gitem_t *item, vec3_t origin, vec3_t velocity ) {	gentity_t	*dropped;	dropped = G_Spawn();	dropped->s.eType = ET_ITEM;	dropped->s.modelindex = item - bg_itemlist;	// store item number in modelindex	dropped->s.modelindex2 = 1; // This is non-zero is it's a dropped item	dropped->classname = item->classname;	dropped->item = item;	VectorSet (dropped->r.mins, -ITEM_RADIUS, -ITEM_RADIUS, -ITEM_RADIUS);	VectorSet (dropped->r.maxs, ITEM_RADIUS, ITEM_RADIUS, ITEM_RADIUS);	dropped->r.contents = CONTENTS_TRIGGER;	dropped->touch = Touch_Item;	G_SetOrigin( dropped, origin );	dropped->s.pos.trType = TR_GRAVITY;	dropped->s.pos.trTime = level.time;	VectorCopy( velocity, dropped->s.pos.trDelta );	dropped->s.eFlags |= EF_BOUNCE_HALF;#ifdef MISSIONPACK	if ((g_gametype.integer == GT_CTF || g_gametype.integer == GT_1FCTF)			&& item->giType == IT_TEAM) { // Special case for CTF flags#else	if (g_gametype.integer == GT_CTF && item->giType == IT_TEAM) { // Special case for CTF flags#endif		dropped->think = Team_DroppedFlagThink;		dropped->nextthink = level.time + 30000;		Team_CheckDroppedItem( dropped );	} else { // auto-remove after 30 seconds		dropped->think = G_FreeEntity;		dropped->nextthink = level.time + 30000;	}	dropped->flags = FL_DROPPED_ITEM;	trap_LinkEntity (dropped);	return dropped;}/*================Drop_ItemSpawns an item and tosses it forward================*/gentity_t *Drop_Item( gentity_t *ent, gitem_t *item, float angle ) {	vec3_t	velocity;	vec3_t	angles;	VectorCopy( ent->s.apos.trBase, angles );	angles[YAW] += angle;	angles[PITCH] = 0;	// always forward	AngleVectors( angles, velocity, NULL, NULL );	VectorScale( velocity, 150, velocity );	velocity[2] += 200 + crandom() * 50;		return LaunchItem( item, ent->s.pos.trBase, velocity );}
开发者ID:ArtanAhmeti,项目名称:lab,代码行数:71,


示例18: ClientSpawn

//.........这里部分代码省略.........	client->ps.eFlags = flags;	ent->s.groundEntityNum = ENTITYNUM_NONE;	ent->client = &level.clients[index];	ent->takedamage = qtrue;	ent->inuse = qtrue;	ent->classname = "player";	ent->r.contents = CONTENTS_BODY;	ent->clipmask = MASK_PLAYERSOLID;	ent->die = player_die;	ent->waterlevel = 0;	ent->watertype = 0;	ent->flags = 0;		VectorCopy (playerMins, ent->r.mins);	VectorCopy (playerMaxs, ent->r.maxs);	client->ps.clientNum = index;	client->ps.stats[STAT_WEAPONS] = ( 1 << WP_MACHINEGUN );	if ( g_gametype.integer == GT_TEAM ) {		client->ps.ammo[WP_MACHINEGUN] = 50;	} else {		client->ps.ammo[WP_MACHINEGUN] = 100;	}	client->ps.stats[STAT_WEAPONS] |= ( 1 << WP_GAUNTLET );	client->ps.ammo[WP_GAUNTLET] = -1;	client->ps.ammo[WP_GRAPPLING_HOOK] = -1;	// health will count down towards max_health	ent->health = client->ps.stats[STAT_HEALTH] = client->ps.stats[STAT_MAX_HEALTH] + 25;	G_SetOrigin( ent, spawn_origin );	VectorCopy( spawn_origin, client->ps.origin );	// the respawned flag will be cleared after the attack and jump keys come up	client->ps.pm_flags |= PMF_RESPAWNED;	trap_GetUsercmd( client - level.clients, &ent->client->pers.cmd );	SetClientViewAngle( ent, spawn_angles );	if ( ent->client->sess.sessionTeam == TEAM_SPECTATOR ) {	} else {		G_KillBox( ent );		trap_LinkEntity (ent);		// force the base weapon up		client->ps.weapon = WP_MACHINEGUN;		client->ps.weaponstate = WEAPON_READY;	}	// don't allow full run speed for a bit	client->ps.pm_flags |= PMF_TIME_KNOCKBACK;	client->ps.pm_time = 100;	client->respawnTime = level.time;	client->inactivityTime = level.time + g_inactivity.integer * 1000;	client->latched_buttons = 0;	// set default animations	client->ps.torsoAnim = TORSO_STAND;	client->ps.legsAnim = LEGS_IDLE;
开发者ID:mtrencseni,项目名称:quake3,代码行数:66,


示例19: destroyed

//.........这里部分代码省略.........set size better?multiple damage models?custom explosion effect/sound?*/void SP_misc_model_breakable( gentity_t *ent ) {	char	damageModel[MAX_QPATH];	char	chunkModel[MAX_QPATH];	char	useModel[MAX_QPATH];	int		len;		// Chris F. requested default for misc_model_breakable to be NONE...so don't arbitrarily change this.	G_SpawnInt( "material", "8", (int*)&ent->material );	G_SpawnFloat( "radius", "1", &ent->radius ); // used to scale chunk code if desired by a designer	CacheChunkEffects( ent->material );	misc_model_breakable_init( ent );	len = strlen( ent->model ) - 4;	strncpy( damageModel, ent->model, len );	damageModel[len] = 0;	//chop extension	strncpy( chunkModel, damageModel, sizeof(chunkModel));	strncpy( useModel, damageModel, sizeof(useModel));		if (ent->takedamage) {		//Dead/damaged model		if( !(ent->spawnflags & 8) ) {	//no dmodel			strcat( damageModel, "_d1.md3" );			ent->s.modelindex2 = G_ModelIndex( damageModel );		}				//Chunk model		strcat( chunkModel, "_c1.md3" );		ent->s.modelindex3 = G_ModelIndex( chunkModel );	}	//Use model	if( ent->spawnflags & 32 ) {	//has umodel		strcat( useModel, "_u1.md3" );		ent->sound1to2 = G_ModelIndex( useModel );	}	if ( !ent->mins[0] && !ent->mins[1] && !ent->mins[2] )	{		VectorSet (ent->mins, -16, -16, -16);	}	if ( !ent->maxs[0] && !ent->maxs[1] && !ent->maxs[2] )	{		VectorSet (ent->maxs, 16, 16, 16);	}	if ( ent->spawnflags & 2 )	{		ent->s.eFlags |= EF_ANIM_ALLFAST;	}	G_SetOrigin( ent, ent->s.origin );	G_SetAngles( ent, ent->s.angles );	gi.linkentity (ent);	if ( ent->spawnflags & 128 )	{//Can be used by the player's BUTTON_USE		ent->svFlags |= SVF_PLAYER_USABLE;	}	if ( ent->team && ent->team[0] )	{		ent->noDamageTeam = TranslateTeamName( ent->team );		if ( ent->noDamageTeam == TEAM_FREE )		{			G_Error("team name %s not recognized/n", ent->team);		}	}		ent->team = NULL;	//HACK	if ( ent->model && Q_stricmp( "models/map_objects/ships/tie_fighter.md3", ent->model ) == 0 )	{//run a think		G_EffectIndex( "fighter_explosion2" );		G_SoundIndex( "sound/weapons/tie_fighter/tiepass1.wav" );		G_SoundIndex( "sound/weapons/tie_fighter/tiepass2.wav" );		G_SoundIndex( "sound/weapons/tie_fighter/tiepass3.wav" );		G_SoundIndex( "sound/weapons/tie_fighter/tiepass4.wav" );		G_SoundIndex( "sound/weapons/tie_fighter/tiepass5.wav" );		G_SoundIndex( "sound/weapons/tie_fighter/tie_fire.wav" );		G_SoundIndex( "sound/weapons/tie_fighter/tie_fire2.wav" );		G_SoundIndex( "sound/weapons/tie_fighter/tie_fire3.wav" );		G_SoundIndex( "sound/weapons/tie_fighter/TIEexplode.wav" );		ent->e_ThinkFunc = thinkF_TieFighterThink;		ent->nextthink = level.time + FRAMETIME;	}	float grav = 0;	G_SpawnFloat( "gravity", "0", &grav );	if ( grav )	{//affected by gravity		G_SetAngles( ent, ent->s.angles );		G_SetOrigin( ent, ent->currentOrigin );		misc_model_breakable_gravity_init( ent, qtrue );	}}
开发者ID:blaenk,项目名称:jedioutcast,代码行数:101,


示例20: target

/*QUAKED target_deactivate (1 0 0) (-4 -4 -4) (4 4 4)Will set the target(s) to be non-usable/triggerable*/void SP_target_deactivate( gentity_t *self ){	G_SetOrigin( self, self->s.origin );	self->use = target_deactivate_use;}
开发者ID:stasoo,项目名称:base_enhanced,代码行数:8,


示例21: finish_spawning_turretG2

//-----------------------------------------------------void finish_spawning_turretG2( gentity_t *base ){	vec3_t		fwd;	int			t;	if ( (base->spawnflags&2) )	{		base->s.angles[ROLL] += 180;		base->s.origin[2] -= 22.0f;	}	G_SetAngles( base, base->s.angles );	AngleVectors( base->r.currentAngles, fwd, NULL, NULL );	G_SetOrigin(base, base->s.origin);	base->s.eType = ET_GENERAL;	if ( base->team && base->team[0] && //g_gametype.integer == GT_SIEGE &&		!base->teamnodmg)	{		base->teamnodmg = atoi(base->team);	}	base->team = NULL;	// Set up our explosion effect for the ExplodeDeath code....	G_EffectIndex( "turret/explode" );	G_EffectIndex( "sparks/spark_exp_nosnd" );	base->use = turretG2_base_use;	base->pain = TurretG2Pain;	// don't start working right away	base->think = turretG2_base_think;	base->nextthink = level.time + FRAMETIME * 5;	// this is really the pitch angle.....	base->speed = 0;	// respawn time defaults to 20 seconds	if ( (base->spawnflags&SPF_TURRETG2_CANRESPAWN) && !base->count )	{		base->count = 20000;	}	G_SpawnFloat( "shotspeed", "0", &base->mass );	if ( (base->spawnflags&SPF_TURRETG2_TURBO) )	{		if ( !base->random )		{//error worked into projectile direction			base->random = 2.0f;		}		if ( !base->mass )		{//misnomer: speed of projectile			base->mass = 20000;		}		if ( !base->health )		{			base->health = 2000;		}		// search radius		if ( !base->radius )		{			base->radius = 32768;		}		// How quickly to fire		if ( !base->wait )		{			base->wait = 1000;// + random() * 500;		}		if ( !base->splashDamage )		{			base->splashDamage = 200;		}		if ( !base->splashRadius )		{			base->splashRadius = 500;		}		// how much damage each shot does		if ( !base->damage )		{			base->damage = 500;		}		if ( (base->spawnflags&SPF_TURRETG2_TURBO) )		{			VectorSet( base->r.maxs, 64.0f, 64.0f, 30.0f );			VectorSet( base->r.mins, -64.0f, -64.0f, -30.0f );		}		//start in "off" anim		TurboLaser_SetBoneAnim( base, 4, 5 );	}//.........这里部分代码省略.........
开发者ID:Stoiss,项目名称:JediKnightGalaxies,代码行数:101,


示例22: utilities

/*QUAKED info_camp (0 0.5 0) (-4 -4 -4) (4 4 4)Used as a positional target for calculations in the utilities (spotlights, etc), but removed during gameplay.*/void SP_info_camp(gentity_t * self){	G_SetOrigin(self, self->s.origin);}
开发者ID:SinSiXX,项目名称:Rogue-Reborn,代码行数:7,


示例23: SP_target_autosave

/*QUAKED target_autosave (1 0 0) (-4 -4 -4) (4 4 4)Auto save the game in two frames.Make sure it won't trigger during dialogue or cinematic or it will stutter!*/void SP_target_autosave( gentity_t *self ){	G_SetOrigin( self, self->s.origin );	self->e_UseFunc = useF_target_autosave_use;}
开发者ID:Joanxt,项目名称:OpenJK,代码行数:9,


示例24: SP_info_notnull

/*QUAKED info_notnull (0 0.5 0) (-4 -4 -4) (4 4 4)Used as a positional target for in-game calculation, like jumppad targets.target_position does the same thing*/void SP_info_notnull(gentity_t * self){	G_SetOrigin(self, self->s.origin);}
开发者ID:SinSiXX,项目名称:Rogue-Reborn,代码行数:8,


示例25: SP_target_location

/*QUAKED target_location (0 0.5 0) (-8 -8 -8) (8 8 8)Set "message" to the name of this location.Set "count" to 0-7 for color.0:white 1:red 2:green 3:yellow 4:blue 5:cyan 6:magenta 7:whiteClosest target_location in sight used for the location, if nonein site, closest in distance*/void SP_target_location( gentity_t *self ){	self->e_ThinkFunc = thinkF_target_location_linkup;	self->nextthink = level.time + 1000;  // Let them all spawn first	G_SetOrigin( self, self->s.origin );}
开发者ID:Joanxt,项目名称:OpenJK,代码行数:14,


示例26: SP_target_friction_change

/*QUAKED target_friction_change (1 0 0) (-4 -4 -4) (4 4 4)"friction" Normal = 6, Valid range 0 - 10*/void SP_target_friction_change( gentity_t *self ){	G_SetOrigin( self, self->s.origin );	self->e_UseFunc = useF_target_friction_change_use;}
开发者ID:Joanxt,项目名称:OpenJK,代码行数:10,


示例27: G_Spawn

static gentity_t *SpawnModelOnVictoryPad( gentity_t *pad, vec3_t offset, gentity_t *ent, int place ) {	gentity_t	*body;	vec3_t		vec;	vec3_t		f, r, u;	body = G_Spawn();	if ( !body ) {		G_Printf( S_COLOR_RED "ERROR: out of gentities/n" );		return NULL;	}	body->classname = ent->client->pers.netname;	body->client = ent->client;	body->s = ent->s;	body->s.eType = ET_PLAYER;		// could be ET_INVISIBLE	body->s.eFlags = 0;				// clear EF_TALK, etc	body->s.powerups = 0;			// clear powerups	body->s.loopSound = 0;			// clear lava burning	body->s.number = body - g_entities;	body->timestamp = level.time;	body->physicsObject = qtrue;	body->physicsBounce = 0;		// don't bounce	body->s.event = 0;	body->s.pos.trType = TR_STATIONARY;	body->s.groundEntityNum = ENTITYNUM_WORLD;	body->s.legsAnim = LEGS_IDLE;	body->s.torsoAnim = TORSO_STAND;	if( body->s.weapon == WP_NONE ) {		body->s.weapon = WP_MACHINEGUN;	}	if( body->s.weapon == WP_GAUNTLET) {		body->s.torsoAnim = TORSO_STAND2;	}	body->s.event = 0;	body->r.svFlags = ent->r.svFlags;	VectorCopy (ent->r.mins, body->r.mins);	VectorCopy (ent->r.maxs, body->r.maxs);	VectorCopy (ent->r.absmin, body->r.absmin);	VectorCopy (ent->r.absmax, body->r.absmax);	body->clipmask = CONTENTS_SOLID | CONTENTS_PLAYERCLIP;	body->r.contents = CONTENTS_BODY;	body->r.ownerNum = ent->r.ownerNum;	body->takedamage = qfalse;	VectorSubtract( level.intermission_origin, pad->r.currentOrigin, vec );	vectoangles( vec, body->s.apos.trBase );	body->s.apos.trBase[PITCH] = 0;	body->s.apos.trBase[ROLL] = 0;	AngleVectors( body->s.apos.trBase, f, r, u );	VectorMA( pad->r.currentOrigin, offset[0], f, vec );	VectorMA( vec, offset[1], r, vec );	VectorMA( vec, offset[2], u, vec );	G_SetOrigin( body, vec );	trap_LinkEntity (body);	body->count = place;	return body;}
开发者ID:linux26,项目名称:corkscrew,代码行数:62,


示例28: ClientSpawn

//.........这里部分代码省略.........  maxAmmo = BG_Weapon( weapon )->maxAmmo;  maxClips = BG_Weapon( weapon )->maxClips;  client->ps.stats[ STAT_WEAPON ] = weapon;  client->ps.ammo = maxAmmo;  client->ps.clips = maxClips;  // We just spawned, not changing weapons  client->ps.persistant[ PERS_NEWWEAPON ] = 0;  ent->client->ps.stats[ STAT_CLASS ] = ent->client->pers.classSelection;  ent->client->ps.stats[ STAT_TEAM ] = ent->client->pers.teamSelection;  ent->client->ps.stats[ STAT_BUILDABLE ] = BA_NONE;  ent->client->ps.stats[ STAT_STATE ] = 0;  VectorSet( ent->client->ps.grapplePoint, 0.0f, 0.0f, 1.0f );  // health will count down towards max_health  ent->health = client->ps.stats[ STAT_HEALTH ] = client->ps.stats[ STAT_MAX_HEALTH ]; //* 1.25;  //if evolving scale health  if( ent == spawn )  {    ent->health *= ent->client->pers.evolveHealthFraction;    client->ps.stats[ STAT_HEALTH ] *= ent->client->pers.evolveHealthFraction;  }  //clear the credits array  for( i = 0; i < MAX_CLIENTS; i++ )    ent->credits[ i ] = 0;  client->ps.stats[ STAT_STAMINA ] = STAMINA_MAX;  G_SetOrigin( ent, spawn_origin );  VectorCopy( spawn_origin, client->ps.origin );#define UP_VEL  150.0f#define F_VEL   50.0f  //give aliens some spawn velocity  if( client->sess.spectatorState == SPECTATOR_NOT &&      client->ps.stats[ STAT_TEAM ] == TEAM_ALIENS )  {    if( ent == spawn )    {      //evolution particle system      G_AddPredictableEvent( ent, EV_ALIEN_EVOLVE, DirToByte( up ) );    }    else    {      spawn_angles[ YAW ] += 180.0f;      AngleNormalize360( spawn_angles[ YAW ] );      if( spawnPoint->s.origin2[ 2 ] > 0.0f )      {        vec3_t  forward, dir;        AngleVectors( spawn_angles, forward, NULL, NULL );        VectorScale( forward, F_VEL, forward );        VectorAdd( spawnPoint->s.origin2, forward, dir );        VectorNormalize( dir );        VectorScale( dir, UP_VEL, client->ps.velocity );      }      G_AddPredictableEvent( ent, EV_PLAYER_RESPAWN, 0 );
开发者ID:librelous,项目名称:librelous,代码行数:67,


示例29: G_Spawn

/*================LaunchItemSpawns an item and tosses it forward================*/gentity_t *LaunchItem( gitem_t *item, vec3_t origin, vec3_t velocity, char *target ) {	gentity_t	*dropped;	dropped = G_Spawn();	dropped->s.eType = ET_ITEM;	dropped->s.modelindex = item - bg_itemlist;	// store item number in modelindex	dropped->s.modelindex2 = 1; // This is non-zero is it's a dropped item	dropped->classname = item->classname;	dropped->item = item;	// try using the "correct" mins/maxs first	VectorSet( dropped->mins, item->mins[0], item->mins[1], item->mins[2] );	VectorSet( dropped->maxs, item->maxs[0], item->maxs[1], item->maxs[2] );	if ((!dropped->mins[0] && !dropped->mins[1] && !dropped->mins[2]) && 		(!dropped->maxs[0] && !dropped->maxs[1] && !dropped->maxs[2]))	{		VectorSet( dropped->maxs, ITEM_RADIUS, ITEM_RADIUS, ITEM_RADIUS );		VectorScale( dropped->maxs, -1, dropped->mins );	}	dropped->contents = CONTENTS_TRIGGER|CONTENTS_ITEM;//CONTENTS_TRIGGER;//not CONTENTS_BODY for dropped items, don't need to ID them	if ( target && target[0] )	{		dropped->target = G_NewString( target );	}	else	{		// if not targeting something, auto-remove after 30 seconds		// only if it's NOT a security or goodie key		if (dropped->item->giTag != INV_SECURITY_KEY )		{			dropped->e_ThinkFunc = thinkF_G_FreeEntity;			dropped->nextthink = level.time + 30000;		}		if ( dropped->item->giType == IT_AMMO && dropped->item->giTag == AMMO_FORCE )		{			dropped->nextthink = -1;			dropped->e_ThinkFunc = thinkF_NULL;		}	}	dropped->e_TouchFunc = touchF_Touch_Item;	if ( item->giType == IT_WEAPON )	{		// give weapon items zero pitch, a random yaw, and rolled onto their sides...but would be bad to do this for a bowcaster		if ( item->giTag != WP_BOWCASTER			&& item->giTag != WP_THERMAL			&& item->giTag != WP_TRIP_MINE			&& item->giTag != WP_DET_PACK )		{			VectorSet( dropped->s.angles, 0, crandom() * 180, 90.0f );			G_SetAngles( dropped, dropped->s.angles );		}	}	G_SetOrigin( dropped, origin );	dropped->s.pos.trType = TR_GRAVITY;	dropped->s.pos.trTime = level.time;	VectorCopy( velocity, dropped->s.pos.trDelta );	dropped->s.eFlags |= EF_BOUNCE_HALF;	dropped->flags = FL_DROPPED_ITEM;	gi.linkentity (dropped);	return dropped;}
开发者ID:Agustinlv,项目名称:BlueHarvest,代码行数:81,



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


C++ G_Sound函数代码示例
C++ G_SetEnemy函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。