本文整理汇总了C++中G_SetAngles函数的典型用法代码示例。如果您正苦于以下问题:C++ G_SetAngles函数的具体用法?C++ G_SetAngles怎么用?C++ G_SetAngles使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了G_SetAngles函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: fx_explosion_trail_link
//----------------------------------------------------------
void fx_explosion_trail_link( gentity_t *ent )
{
vec3_t dir;
gentity_t *target = NULL;
// we ony activate when used
ent->e_UseFunc = useF_fx_explosion_trail_use;
if ( ent->target )
{
// try to use the target to override the orientation
target = G_Find( target, FOFS(targetname), ent->target );
if ( !target )
{
gi.Printf( S_COLOR_RED"ERROR: fx_explosion_trail %s could not find target %s\n", ent->targetname, ent->target );
G_FreeEntity( ent );
return;
}
// Our target is valid so lets use that
VectorSubtract( target->s.origin, ent->s.origin, dir );
VectorNormalize( dir );
}
else
{
// we are assuming that we have angles, but there are no checks to verify this
AngleVectors( ent->s.angles, dir, NULL, NULL );
}
// NOTE: this really isn't an angle, but rather an orientation vector
G_SetAngles( ent, dir );
}
示例2: SP_misc_turret
//-----------------------------------------------------
void SP_misc_turret( gentity_t *base )
//-----------------------------------------------------
{
base->s.modelindex2 = G_ModelIndex( "models/map_objects/hoth/turret_bottom.md3" );
base->s.modelindex = G_ModelIndex( "models/map_objects/hoth/turret_base.md3" );
//base->playerModel = gi.G2API_InitGhoul2Model( base->ghoul2, "models/map_objects/imp_mine/turret_canon.glm", base->s.modelindex );
//base->s.radius = 80.0f;
//gi.G2API_SetBoneAngles( &base->ghoul2[base->playerModel], "Bone_body", vec3_origin, BONE_ANGLES_POSTMULT, POSITIVE_Y, POSITIVE_Z, POSITIVE_X, NULL );
//base->torsoBolt = gi.G2API_AddBolt( &base->ghoul2[base->playerModel], "*flash03" );
G_SetAngles( base, base->s.angles );
G_SetOrigin( base, base->s.origin );
base->r.contents = CONTENTS_BODY;
VectorSet( base->r.maxs, 32.0f, 32.0f, 128.0f );
VectorSet( base->r.mins, -32.0f, -32.0f, 0.0f );
base->use = turret_base_use;
base->think = turret_base_think;
// don't start working right away
base->nextthink = level.time + FRAMETIME * 5;
trap_LinkEntity( base );
if ( !turret_base_spawn_top( base ) )
{
G_FreeEntity( base );
}
}
示例3: SP_misc_turret
//[/CoOp]
//-----------------------------------------------------
void SP_misc_turret( gentity_t *base )
//-----------------------------------------------------
{
char* s;
//[CoOp]
//wahoo turret - actually a spawn flag of 5 spawns a huge space turbo turret
//and others spawn the normal g2 turret so fixed this if statement. In sp, spawnflags
//are checked for the value of 5 to spawn the turbo turrets, but in mp it checks for
//a spawn flag of 8 in sp_misc_turretg2, so setting to 8 before spawning. No hoth style
//turrets can be found in sp so far.
if( g_gametype.integer == GT_SINGLE_PLAYER )
{//SP uses this same map entity name for the ceiling turrets. Override to use them
//in CoOp.
if( base->spawnflags & 5 )
base->spawnflags |= 8;
SP_misc_turretG2( base );
return;
}
//[/CoOp]
base->s.modelindex2 = G_ModelIndex( "models/map_objects/hoth/turret_bottom.md3" );
base->s.modelindex = G_ModelIndex( "models/map_objects/hoth/turret_base.md3" );
//base->playerModel = gi.G2API_InitGhoul2Model( base->ghoul2, "models/map_objects/imp_mine/turret_canon.glm", base->s.modelindex );
//base->s.radius = 80.0f;
//gi.G2API_SetBoneAngles( &base->ghoul2[base->playerModel], "Bone_body", vec3_origin, BONE_ANGLES_POSTMULT, POSITIVE_Y, POSITIVE_Z, POSITIVE_X, NULL );
//base->torsoBolt = gi.G2API_AddBolt( &base->ghoul2[base->playerModel], "*flash03" );
G_SpawnString( "icon", "", &s );
if (s && s[0])
{
// We have an icon, so index it now. We are reusing the genericenemyindex
// variable rather than adding a new one to the entity state.
base->s.genericenemyindex = G_IconIndex(s);
}
G_SetAngles( base, base->s.angles );
G_SetOrigin( base, base->s.origin );
base->r.contents = CONTENTS_BODY;
VectorSet( base->r.maxs, 32.0f, 32.0f, 128.0f );
VectorSet( base->r.mins, -32.0f, -32.0f, 0.0f );
base->use = turret_base_use;
base->think = turret_base_think;
// don't start working right away
base->nextthink = level.time + FRAMETIME * 5;
trap_LinkEntity( base );
if ( !turret_base_spawn_top( base ) )
{
G_FreeEntity( base );
}
}
示例4: fx_explosion_trail_use
//----------------------------------------------------------
void fx_explosion_trail_use( gentity_t *self, gentity_t *other, gentity_t *activator )
{
gentity_t *missile = G_Spawn();
// We aren't a missile in the truest sense, rather we just move through the world and spawn effects
if ( missile )
{
missile->classname = "fx_exp_trail";
missile->nextthink = level.time + 50;
missile->e_ThinkFunc = thinkF_fx_explosion_trail_think;
missile->s.eType = ET_MOVER;
missile->owner = self;
missile->s.modelindex = self->s.modelindex2;
missile->s.pos.trTime = level.time;
G_SetOrigin( missile, self->currentOrigin );
if ( self->spawnflags & 1 ) // gravity
{
missile->s.pos.trType = TR_GRAVITY;
}
else
{
missile->s.pos.trType = TR_LINEAR;
}
missile->spawnflags = self->spawnflags;
G_SetAngles( missile, self->currentAngles );
VectorScale( self->currentAngles, self->speed, missile->s.pos.trDelta );
missile->s.pos.trTime = level.time;
missile->radius = self->radius;
missile->damage = self->damage;
missile->splashDamage = self->splashDamage;
missile->splashRadius = self->splashRadius;
missile->fxID = self->fxID;
missile->fullName = self->fullName;
missile->clipmask = MASK_SHOT;
gi.linkentity( missile );
if ( VALIDSTRING( self->soundSet ) == true )
{
G_AddEvent( self, EV_BMODEL_SOUND, CAS_GetBModelSound( self->soundSet, BMS_START ));
missile->s.loopSound = CAS_GetBModelSound( self->soundSet, BMS_MID );
missile->soundSet = self->soundSet;
if ( missile->s.loopSound < 0 )
{
missile->s.loopSound = 0;
}
}
}
}
示例5: Rancor_DropVictim
void Rancor_DropVictim( gentity_t *self )
{
//FIXME: if Rancor dies, it should drop its victim.
//FIXME: if Rancor is removed, it must remove its victim.
if ( self->activator )
{
if ( self->activator->client )
{
self->activator->client->ps.eFlags2 &= ~EF2_HELD_BY_MONSTER;
self->activator->client->ps.hasLookTarget = qfalse;
self->activator->client->ps.lookTarget = ENTITYNUM_NONE;
self->activator->client->ps.viewangles[ROLL] = 0;
SetClientViewAngle( self->activator, self->activator->client->ps.viewangles );
self->activator->r.currentAngles[PITCH] = self->activator->r.currentAngles[ROLL] = 0;
G_SetAngles( self->activator, self->activator->r.currentAngles );
}
if ( self->activator->health <= 0 )
{
//if ( self->activator->s.number )
{//never free player
if ( self->count == 1 )
{//in my hand, just drop them
if ( self->activator->client )
{
self->activator->client->ps.legsTimer = self->activator->client->ps.torsoTimer = 0;
//FIXME: ragdoll?
}
}
else
{
if ( self->activator->client )
{
self->activator->client->ps.eFlags |= EF_NODRAW;//so his corpse doesn't drop out of me...
}
//G_FreeEntity( self->activator );
}
}
}
else
{
if ( self->activator->NPC )
{//start thinking again
self->activator->NPC->nextBStateThink = level.time;
}
//clear their anim and let them fall
self->activator->client->ps.legsTimer = self->activator->client->ps.torsoTimer = 0;
}
if ( self->enemy == self->activator )
{
self->enemy = NULL;
}
self->activator = NULL;
}
self->count = 0;//drop him
}
示例6: fx_runner_link
//----------------------------------------------------------
void fx_runner_link( gentity_t *ent )
{
vec3_t dir;
if ( ent->roffname && ent->roffname[0] )
{
// try to use the target to override the orientation
gentity_t *target = NULL;
target = G_Find( target, FOFS(targetname), ent->roffname );
if ( !target )
{
// Bah, no good, dump a warning, but continue on and use the UP vector
Com_Printf( "fx_runner_link: target specified but not found: %s\n", ent->roffname );
Com_Printf( " -assuming UP orientation.\n" );
}
else
{
// Our target is valid so let's override the default UP vector
VectorSubtract( target->s.origin, ent->s.origin, dir );
VectorNormalize( dir );
vectoangles( dir, ent->s.angles );
}
}
// don't really do anything with this right now other than do a check to warn the designers if the target is bogus
if ( ent->target )
{
gentity_t *target = NULL;
target = G_Find( target, FOFS(targetname), ent->target );
if ( !target )
{
// Target is bogus, but we can still continue
Com_Printf( "fx_runner_link: target was specified but is not valid: %s\n", ent->target );
}
}
G_SetAngles( ent, ent->s.angles );
if ( ent->spawnflags & 1 || ent->spawnflags & 2 ) // STARTOFF || ONESHOT
{
// We won't even consider thinking until we are used
ent->nextthink = -1;
}
else
{
// Let's get to work right now!
ent->think = fx_runner_think;
ent->nextthink = level.time + 100; // wait a small bit, then start working
}
}
示例7: SP_misc_model_ammo_rack
//---------------------------------------------
void SP_misc_model_ammo_rack( gentity_t *ent )
{
// If BLASTER is checked...or nothing is checked then we'll do blasters
if (( ent->spawnflags & RACK_BLASTER ) || !(ent->spawnflags & ( RACK_BLASTER | RACK_METAL_BOLTS | RACK_ROCKETS | RACK_PWR_CELL )))
{
if ( ent->spawnflags & RACK_WEAPONS )
{
RegisterItem( FindItemForWeapon( WP_BLASTER ));
}
RegisterItem( FindItemForAmmo( AMMO_BLASTER ));
}
if (( ent->spawnflags & RACK_METAL_BOLTS ))
{
if ( ent->spawnflags & RACK_WEAPONS )
{
RegisterItem( FindItemForWeapon( WP_REPEATER ));
}
RegisterItem( FindItemForAmmo( AMMO_METAL_BOLTS ));
}
if (( ent->spawnflags & RACK_ROCKETS ))
{
if ( ent->spawnflags & RACK_WEAPONS )
{
RegisterItem( FindItemForWeapon( WP_ROCKET_LAUNCHER ));
}
RegisterItem( FindItemForAmmo( AMMO_ROCKETS ));
}
if (( ent->spawnflags & RACK_PWR_CELL ))
{
RegisterItem( FindItemForAmmo( AMMO_POWERCELL ));
}
if (( ent->spawnflags & RACK_HEALTH ))
{
RegisterItem( FindItem( "item_medpak_instant" ));
}
ent->e_ThinkFunc = thinkF_spawn_rack_goods;
ent->nextthink = level.time + 100;
G_SetOrigin( ent, ent->s.origin );
G_SetAngles( ent, ent->s.angles );
ent->contents = CONTENTS_SHOTCLIP|CONTENTS_PLAYERCLIP|CONTENTS_MONSTERCLIP|CONTENTS_BOTCLIP;//CONTENTS_SOLID;//so use traces can go through them
gi.linkentity( ent );
}
示例8: AOTCTC_Create_Holocron
//===========================================================================
// Routine : AOTCTC_Create_Holocron
// Description : Put a single holocron on the map...
void AOTCTC_Create_Holocron( int type, vec3_t point )
{// Put a single holocron on the map...
gentity_t *holocron = G_Spawn();
vec3_t angles;
VectorSet(angles, 0, 0, 0);
G_SetOrigin( holocron, point );
G_SetAngles( holocron, angles );
holocron->count = type;
holocron->classname = "misc_holocron";
VectorCopy(point, holocron->s.pos.trBase);
VectorCopy(point, holocron->s.origin);
trap_LinkEntity(holocron);
SP_misc_holocron( holocron );
}
示例9: SP_misc_turret
//-----------------------------------------------------
void SP_misc_turret( gentity_t *base )
//-----------------------------------------------------
{
char* s;
base->s.modelindex2 = G_ModelIndex( "models/map_objects/hoth/turret_bottom.md3" );
base->s.modelindex = G_ModelIndex( "models/map_objects/hoth/turret_base.md3" );
//base->playerModel = trap->G2API_InitGhoul2Model( base->ghoul2, "models/map_objects/imp_mine/turret_canon.glm", base->s.modelindex );
//base->s.radius = 80.0f;
//trap->G2API_SetBoneAngles( &base->ghoul2[base->playerModel], "Bone_body", vec3_origin, BONE_ANGLES_POSTMULT, POSITIVE_Y, POSITIVE_Z, POSITIVE_X, NULL );
//base->torsoBolt = trap->G2API_AddBolt( &base->ghoul2[base->playerModel], "*flash03" );
G_SpawnString( "icon", "", &s );
if (s && s[0])
{
// We have an icon, so index it now. We are reusing the genericenemyindex
// variable rather than adding a new one to the entity state.
base->s.genericenemyindex = G_IconIndex(s);
}
G_SetAngles( base, base->s.angles );
G_SetOrigin( base, base->s.origin );
base->r.contents = CONTENTS_BODY;
VectorSet( base->r.maxs, 32.0f, 32.0f, 128.0f );
VectorSet( base->r.mins, -32.0f, -32.0f, 0.0f );
base->use = turret_base_use;
base->think = turret_base_think;
// don't start working right away
base->nextthink = level.time + FRAMETIME * 5;
trap->LinkEntity( (sharedEntity_t *)base );
if ( !turret_base_spawn_top( base ) )
{
G_FreeEntity( base );
}
}
示例10: WP_Stick
//-----------------------------------------------------------------------------
void WP_Stick( gentity_t *missile, trace_t *trace, float fudge_distance )
//-----------------------------------------------------------------------------
{
vec3_t org, ang;
// not moving or rotating
missile->s.pos.trType = TR_STATIONARY;
VectorClear( missile->s.pos.trDelta );
VectorClear( missile->s.apos.trDelta );
// so we don't stick into the wall
VectorMA( trace->endpos, fudge_distance, trace->plane.normal, org );
G_SetOrigin( missile, org );
vectoangles( trace->plane.normal, ang );
G_SetAngles( missile, ang );
// I guess explode death wants me as the normal?
// VectorCopy( trace->plane.normal, missile->pos1 );
gi.linkentity( missile );
}
示例11: Cmd_UseSeeker_f
/*
================
Cmd_UseSeeker_f
================
*/
void Cmd_UseSeeker_f( gentity_t *ent )
{
if ( ent->health < 1 || in_camera )
{
return;
}
// don't use them if we don't have any...also don't use them if one is already going
if ( ent->client && ent->client->ps.inventory[INV_SEEKER] > 0 && level.time > ent->client->ps.powerups[PW_SEEKER] )
{
gentity_t *tent = G_Spawn();
if ( tent )
{
vec3_t fwd, right, spot;
AngleVectors( ent->client->ps.viewangles, fwd, right, NULL );
VectorCopy( ent->currentOrigin, spot ); // does nothing really, just initialize the goods...
if ( PickSeekerSpawnPoint( ent->currentOrigin, fwd, right, ent->s.number, spot ))
{
VectorCopy( spot, tent->s.origin );
G_SetOrigin( tent, spot );
G_SetAngles( tent, ent->currentAngles );
extern void SP_NPC_Droid_Seeker( gentity_t *ent );
SP_NPC_Droid_Seeker( tent );
G_Sound( tent, G_SoundIndex( "sound/chars/seeker/misc/hiss" ));
// make sure that we even have some
ent->client->ps.inventory[INV_SEEKER]--;
ent->client->ps.powerups[PW_SEEKER] = level.time + 1000;// can only drop one every second..maybe this is annoying?
}
}
}
}
示例12: G_Spawn
gentity_t *G_DropSaberItem( const char *saberType, saber_colors_t saberColor, vec3_t saberPos, vec3_t saberVel, vec3_t saberAngles, gentity_t *copySaber )
{//turn it into a pick-uppable item!
gentity_t *newItem = NULL;
if ( saberType
&& saberType[0] )
{//have a valid string to use for saberType
newItem = G_Spawn();
if ( newItem )
{
newItem->classname = G_NewString( "weapon_saber" );
VectorCopy( saberPos, newItem->s.origin );
G_SetOrigin( newItem, newItem->s.origin );
VectorCopy( saberAngles, newItem->s.angles );
G_SetAngles( newItem, newItem->s.angles );
newItem->spawnflags = 128;/*ITMSF_USEPICKUP*/
newItem->spawnflags |= 64;/*ITMSF_NOGLOW*/
newItem->NPC_type = G_NewString( saberType );//saberType
//FIXME: transfer per-blade color somehow?
newItem->NPC_targetname = (char *)saberColorStringForColor[saberColor];
newItem->count = 1;
newItem->flags = FL_DROPPED_ITEM;
G_SpawnItem( newItem, FindItemForWeapon( WP_SABER ) );
newItem->s.pos.trType = TR_GRAVITY;
newItem->s.pos.trTime = level.time;
VectorCopy( saberVel, newItem->s.pos.trDelta );
//newItem->s.eFlags |= EF_BOUNCE_HALF;
//copy some values from another saber, if provided:
G_CopySaberItemValues( copySaber, newItem );
//don't *think* about calling FinishSpawningItem, just do it!
newItem->e_ThinkFunc = thinkF_NULL;
newItem->nextthink = -1;
FinishSpawningItem( newItem );
newItem->delay = level.time + 500;//so you can't pick it back up right away
}
}
return newItem;
}
示例13: SP_misc_turret
//-----------------------------------------------------
void SP_misc_turret( gentity_t *base )
//-----------------------------------------------------
{
char* s;
base->s.modelindex2 = G_ModelIndex( "models/map_objects/hoth/turret_bottom.md3" );
base->s.modelindex = G_ModelIndex( "models/map_objects/hoth/turret_base.md3" );
G_SpawnString( "icon", "", &s );
if (s && s[0])
{
// We have an icon, so index it now. We are reusing the genericenemyindex
// variable rather than adding a new one to the entity state.
base->s.genericenemyindex = G_IconIndex(s);
}
G_SetAngles( base, base->s.angles );
G_SetOrigin( base, base->s.origin );
base->r.contents = CONTENTS_BODY;
VectorSet( base->r.maxs, 32.0f, 32.0f, 128.0f );
VectorSet( base->r.mins, -32.0f, -32.0f, 0.0f );
base->use = turret_base_use;
base->think = turret_base_think;
// don't start working right away
base->nextthink = level.time + FRAMETIME * 5;
trap_LinkEntity( base );
if ( !turret_base_spawn_top( base ) )
{
G_FreeEntity( base );
}
}
示例14: SP_misc_model_gun_rack
//---------------------------------------------
void SP_misc_model_gun_rack( gentity_t *ent )
{
gitem_t *blaster = NULL, *repeater = NULL, *rocket = NULL;
int ct = 0;
float ofz[3];
gitem_t *itemList[3];
// If BLASTER is checked...or nothing is checked then we'll do blasters
if (( ent->spawnflags & RACK_BLASTER ) || !(ent->spawnflags & ( RACK_BLASTER | RACK_REPEATER | RACK_ROCKET )))
{
blaster = FindItemForWeapon( WP_BLASTER );
}
if (( ent->spawnflags & RACK_REPEATER ))
{
repeater = FindItemForWeapon( WP_REPEATER );
}
if (( ent->spawnflags & RACK_ROCKET ))
{
rocket = FindItemForWeapon( WP_ROCKET_LAUNCHER );
}
//---------weapon types
if ( blaster )
{
ofz[ct] = 23.0f;
itemList[ct++] = blaster;
}
if ( repeater )
{
ofz[ct] = 24.5f;
itemList[ct++] = repeater;
}
if ( rocket )
{
ofz[ct] = 25.5f;
itemList[ct++] = rocket;
}
if ( ct ) //..should always have at least one item on their, but just being safe
{
for ( ; ct < 3 ; ct++ )
{
ofz[ct] = ofz[0];
itemList[ct] = itemList[0]; // first weapon ALWAYS propagates to fill up the shelf
}
}
// now actually add the items to the shelf...validate that we have a list to add
if ( ct )
{
for ( int i = 0; i < ct; i++ )
{
GunRackAddItem( itemList[i], ent->s.origin, ent->s.angles, crandom() * 2, ( i - 1 ) * 9 + crandom() * 2, ofz[i] );
}
}
ent->s.modelindex = G_ModelIndex( "models/map_objects/kejim/weaponsrack.md3" );
G_SetOrigin( ent, ent->s.origin );
G_SetAngles( ent, ent->s.angles );
ent->contents = CONTENTS_SOLID;
gi.linkentity( ent );
}
示例15: GunRackAddItem
//.........这里部分代码省略.........
// Set base ammo per type
if ( gun->giType == IT_WEAPON )
{
it_ent->spawnflags |= 16;// VERTICAL
switch( gun->giTag )
{
case WP_BLASTER:
it_ent->count = 15;
break;
case WP_REPEATER:
it_ent->count = 100;
break;
case WP_ROCKET_LAUNCHER:
it_ent->count = 4;
break;
}
}
else
{
rotate = qfalse;
// must deliberately make it small, or else the objects will spawn inside of each other.
VectorSet( it_ent->maxs, 6.75f, 6.75f, 6.75f );
VectorScale( it_ent->maxs, -1, it_ent->mins );
}
it_ent->spawnflags |= 1;// ITMSF_SUSPEND
it_ent->classname = G_NewString(gun->classname); //copy it so it can be freed safely
G_SpawnItem( it_ent, gun );
// FinishSpawningItem handles everything, so clear the thinkFunc that was set in G_SpawnItem
FinishSpawningItem( it_ent );
if ( gun->giType == IT_AMMO )
{
if ( gun->giTag == AMMO_BLASTER ) // I guess this just has to use different logic??
{
if ( g_spskill->integer >= 2 )
{
it_ent->count += 10; // give more on higher difficulty because there will be more/harder enemies?
}
}
else
{
// scale ammo based on skill
switch ( g_spskill->integer )
{
case 0: // do default
break;
case 1:
it_ent->count *= 0.75f;
break;
case 2:
it_ent->count *= 0.5f;
break;
}
}
}
it_ent->nextthink = 0;
VectorCopy( org, it_ent->s.origin );
VectorMA( it_ent->s.origin, fright, right, it_ent->s.origin );
VectorMA( it_ent->s.origin, ffwd, fwd, it_ent->s.origin );
it_ent->s.origin[2] += fup;
VectorCopy( angs, it_ent->s.angles );
// by doing this, we can force the amount of ammo we desire onto the weapon for when it gets picked-up
it_ent->flags |= ( FL_DROPPED_ITEM | FL_FORCE_PULLABLE_ONLY );
it_ent->physicsBounce = 0.1f;
for ( int t = 0; t < 3; t++ )
{
if ( rotate )
{
if ( t == YAW )
{
it_ent->s.angles[t] = AngleNormalize180( it_ent->s.angles[t] + 180 + crandom() * 14 );
}
else
{
it_ent->s.angles[t] = AngleNormalize180( it_ent->s.angles[t] + crandom() * 4 );
}
}
else
{
if ( t == YAW )
{
it_ent->s.angles[t] = AngleNormalize180( it_ent->s.angles[t] + 90 + crandom() * 4 );
}
}
}
G_SetAngles( it_ent, it_ent->s.angles );
G_SetOrigin( it_ent, it_ent->s.origin );
gi.linkentity( it_ent );
}
}