本文整理汇总了C++中CalcMuzzlePoint函数的典型用法代码示例。如果您正苦于以下问题:C++ CalcMuzzlePoint函数的具体用法?C++ CalcMuzzlePoint怎么用?C++ CalcMuzzlePoint使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了CalcMuzzlePoint函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: FireWeapon3
/*
===============
FireWeapon3
===============
*/
void FireWeapon3( gentity_t *ent )
{
if ( ent->client )
{
// set aiming directions
AngleVectors( ent->client->ps.viewangles, forward, right, up );
CalcMuzzlePoint( ent, forward, right, up, muzzle );
}
else
{
AngleVectors( ent->s.angles2, forward, right, up );
VectorCopy( ent->s.pos.trBase, muzzle );
}
// fire the specific weapon
switch ( ent->s.weapon )
{
case WP_ALEVEL3_UPG:
bounceBallFire( ent );
break;
case WP_ABUILD2:
slowBlobFire( ent );
break;
default:
break;
}
}
开发者ID:bmorel,项目名称:Unvanquished,代码行数:34,代码来源:g_weapon.c
示例2: areaZapFire
/*
===============
areaZapFire
===============
*/
void areaZapFire( gentity_t *ent )
{
trace_t tr;
vec3_t end;
gentity_t *traceEnt;
vec3_t mins, maxs;
VectorSet( mins, -LEVEL2_AREAZAP_WIDTH, -LEVEL2_AREAZAP_WIDTH, -LEVEL2_AREAZAP_WIDTH );
VectorSet( maxs, LEVEL2_AREAZAP_WIDTH, LEVEL2_AREAZAP_WIDTH, LEVEL2_AREAZAP_WIDTH );
// set aiming directions
AngleVectors( ent->client->ps.viewangles, forward, right, up );
CalcMuzzlePoint( ent, forward, right, up, muzzle );
VectorMA( muzzle, LEVEL2_AREAZAP_RANGE, forward, end );
trap_Trace( &tr, muzzle, mins, maxs, end, ent->s.number, MASK_SHOT );
if( tr.surfaceFlags & SURF_NOIMPACT )
return;
traceEnt = &g_entities[ tr.entityNum ];
if( ( ( traceEnt->client && traceEnt->client->ps.stats[ STAT_PTEAM ] == PTE_HUMANS ) ||
( traceEnt->s.eType == ET_BUILDABLE &&
BG_FindTeamForBuildable( traceEnt->s.modelindex ) == BIT_HUMANS ) ) && traceEnt->health > 0 )
{
G_CreateNewZap( ent, traceEnt );
}
}
开发者ID:wtfbbqhax,项目名称:thz,代码行数:36,代码来源:g_weapon.c
示例3: CheckPounceAttack
/*
===============
CheckPounceAttack
===============
*/
qboolean CheckPounceAttack( gentity_t *ent )
{
trace_t tr;
gentity_t *traceEnt;
int damage, timeMax, pounceRange, pounceWidth, payload;
if( ent->client->pmext.pouncePayload <= 0 )
return qfalse;
// In case the goon lands on his target, he get's one shot after landing
payload = ent->client->pmext.pouncePayload;
if( !( ent->client->ps.pm_flags & PMF_CHARGE/* || ent->client->ps.weapon == WP_ALEVEL5 */) )
ent->client->pmext.pouncePayload = 0;
// Calculate muzzle point
AngleVectors( ent->client->ps.viewangles, forward, right, up );
CalcMuzzlePoint( ent, forward, right, up, muzzle );
// Trace from muzzle to see what we hit
if( ent->client->ps.weapon == WP_ALEVEL5)
{
pounceRange = LEVEL5_POUNCE_RANGE;
pounceWidth = LEVEL5_POUNCE_WIDTH;
}
else
{
pounceRange = ent->client->ps.weapon == WP_ALEVEL3 ? LEVEL3_POUNCE_RANGE : LEVEL3_POUNCE_UPG_RANGE;
pounceWidth = LEVEL3_POUNCE_WIDTH;
}
G_WideTrace( &tr, ent, pounceRange, pounceWidth, pounceWidth, &traceEnt );
if( traceEnt == NULL )
return qfalse;
// Send blood impact
if( traceEnt->takedamage )
WideBloodSpurt( ent, traceEnt, &tr, MOD_LEVEL3_POUNCE );
if( !traceEnt->takedamage )
return qfalse;
// Deal damage
if( ent->client->ps.weapon == WP_ALEVEL5)
{
timeMax = LEVEL5_POUNCE_TIME;
damage = payload * LEVEL5_POUNCE_DMG / timeMax;
ent->client->pmext.pouncePayload = 0;
G_Damage( traceEnt, ent, ent, forward, tr.endpos, damage,
DAMAGE_NO_LOCDAMAGE, MOD_LEVEL5_POUNCE );
}
else
{
timeMax = ent->client->ps.weapon == WP_ALEVEL3 ? LEVEL3_POUNCE_TIME : LEVEL3_POUNCE_TIME_UPG;
damage = payload * LEVEL3_POUNCE_DMG / timeMax;
ent->client->pmext.pouncePayload = 0;
G_Damage( traceEnt, ent, ent, forward, tr.endpos, damage,
DAMAGE_NO_LOCDAMAGE, MOD_LEVEL3_POUNCE );
}
return qtrue;
}
开发者ID:massivehaxxor,项目名称:new-edge,代码行数:64,代码来源:g_weapon.c
示例4: G_MeleeFireCheck
/*
===============
G_MeleeFireCheck
===============
*/
qboolean G_MeleeFireCheck( gentity_t *ent ) {
trace_t tr;
vec3_t end;
gentity_t *tent;
gentity_t *traceEnt;
// only living beeings can attack
if ( ent->client->ps.stats[STAT_HEALTH] <= 0 ) {
return qfalse;
}
// set aiming directions
AngleVectors ( ent->client->ps.viewangles, forward, right, up);
CalcMuzzlePoint ( ent, forward, right, up, muzzle );
VectorMA (muzzle, 32, forward, end);
// compensate for lag
G_CalcLagTimeAndShiftAllClients( ent );
trap_Trace (&tr, muzzle, NULL, NULL, end, ent->s.number, MASK_SHOT);
// move the clients back to their proper positions
if ( level.delagWeapons && ent->client && !(ent->r.svFlags & SVF_BOT) ) {
G_UnTimeShiftAllClients( ent );
}
if ( tr.surfaceFlags & SURF_NOIMPACT ) {
return qfalse;
}
traceEnt = &g_entities[ tr.entityNum ];
// send blood impact
if ( traceEnt->takedamage && traceEnt->client ) {
// compensate for lag effects
if ( level.delagWeapons && ent->client && !(ent->r.svFlags & SVF_BOT) ) {
VectorSubtract( traceEnt->client->saved.currentOrigin, traceEnt->r.currentOrigin, end );
VectorAdd( tr.endpos, end, tr.endpos );
}
// snap the endpos to integers, but nudged towards the line
SnapVectorTowards( tr.endpos, muzzle );
// create impact entity
tent = G_TempEntity( tr.endpos, EV_BULLET_HIT_FLESH );
tent->s.eventParm = traceEnt->s.number;
}
if ( !traceEnt->takedamage) {
return qfalse;
}
G_Damage( traceEnt, ent, ent, forward, tr.endpos,
weLi[WP_SHOCKER].damage, 0, MOD_SHOCKER );
return qtrue;
}
开发者ID:ElderPlayerX,项目名称:Afterwards,代码行数:63,代码来源:g_weapon.c
示例5: CheckGrabAttack
/*
===============
CheckGrabAttack
===============
*/
void CheckGrabAttack( gentity_t *ent )
{
trace_t tr;
vec3_t end, dir;
gentity_t *traceEnt;
// set aiming directions
AngleVectors( ent->client->ps.viewangles, forward, right, up );
CalcMuzzlePoint( ent, forward, right, up, muzzle );
VectorMA( muzzle, LEVEL1_GRAB_RANGE, forward, end );
trap_Trace( &tr, muzzle, NULL, NULL, end, ent->s.number, MASK_SHOT );
if( tr.surfaceFlags & SURF_NOIMPACT )
return;
traceEnt = &g_entities[ tr.entityNum ];
if( !traceEnt->takedamage )
return;
if( traceEnt->client )
{
if( traceEnt->client->ps.stats[ STAT_PTEAM ] == PTE_ALIENS )
return;
if( traceEnt->client->ps.stats[ STAT_HEALTH ] <= 0 )
return;
if( !( traceEnt->client->ps.stats[ STAT_STATE ] & SS_GRABBED ) )
{
AngleVectors( traceEnt->client->ps.viewangles, dir, NULL, NULL );
traceEnt->client->ps.stats[ STAT_VIEWLOCK ] = DirToByte( dir );
//event for client side grab effect
G_AddPredictableEvent( ent, EV_LEV1_GRAB, 0 );
}
traceEnt->client->ps.stats[ STAT_STATE ] |= SS_GRABBED;
if( ent->client->ps.weapon == WP_ALEVEL1 )
traceEnt->client->grabExpiryTime = level.time + LEVEL1_GRAB_TIME;
else if( ent->client->ps.weapon == WP_ALEVEL1_UPG )
traceEnt->client->grabExpiryTime = level.time + LEVEL1_GRAB_U_TIME;
}
else if( traceEnt->s.eType == ET_BUILDABLE &&
traceEnt->s.modelindex == BA_H_MGTURRET )
{
if( !traceEnt->lev1Grabbed )
G_AddPredictableEvent( ent, EV_LEV1_GRAB, 0 );
traceEnt->lev1Grabbed = qtrue;
traceEnt->lev1GrabTime = level.time;
}
}
开发者ID:wtfbbqhax,项目名称:thz,代码行数:61,代码来源:g_weapon.c
示例6: CheckVenomAttack
/*
===============
CheckVenomAttack
===============
*/
qboolean CheckVenomAttack( gentity_t *ent )
{
trace_t tr;
gentity_t *traceEnt;
int damage = LEVEL0_BITE_DMG;
if( ent->client->ps.weaponTime )
return qfalse;
// Calculate muzzle point
AngleVectors( ent->client->ps.viewangles, forward, right, up );
CalcMuzzlePoint( ent, forward, right, up, muzzle );
G_WideTrace( &tr, ent, LEVEL0_BITE_RANGE, LEVEL0_BITE_WIDTH,
LEVEL0_BITE_WIDTH, &traceEnt );
if( traceEnt == NULL )
return qfalse;
if( !traceEnt->takedamage )
return qfalse;
if( traceEnt->health <= 0 )
return qfalse;
// only allow bites to work against buildings as they are constructing
if( traceEnt->s.eType == ET_BUILDABLE )
{
if( traceEnt->buildableTeam == TEAM_ALIENS )
return qfalse;
if ( !( traceEnt->s.modelindex == BA_H_MGTURRET || traceEnt->s.modelindex == BA_H_MGTURRET2 || traceEnt->s.modelindex == BA_H_TESLAGEN || !traceEnt->spawned ) )
damage = (int)(damage * g_DretchBuildingDamage.value);
else
damage = (int)(damage * g_DretchTurretDamage.value);
if (damage <= 0)
return qfalse;
}
if( traceEnt->client )
{
if( traceEnt->client->ps.stats[ STAT_TEAM ] == TEAM_ALIENS )
return qfalse;
if( traceEnt->client->ps.stats[ STAT_HEALTH ] <= 0 )
return qfalse;
}
// send blood impact
WideBloodSpurt( ent, traceEnt, &tr, MOD_LEVEL0_BITE );
G_Damage( traceEnt, ent, ent, forward, tr.endpos, damage, DAMAGE_NO_KNOCKBACK, MOD_LEVEL0_BITE );
ent->client->ps.weaponTime += LEVEL0_BITE_REPEAT;
return qtrue;
}
开发者ID:massivehaxxor,项目名称:new-edge,代码行数:60,代码来源:g_weapon.c
示例7: CheckGauntletAttack
/*
===============
CheckGauntletAttack
===============
*/
qboolean CheckGauntletAttack( gentity_t *ent ) {
trace_t tr;
vec3_t end;
gentity_t *tent;
gentity_t *traceEnt;
int damage;
// set aiming directions
AngleVectors (ent->client->ps.viewangles, forward, right, up);
CalcMuzzlePoint ( ent, forward, right, up, muzzle );
VectorMA (muzzle, 32, forward, end);
trap_Trace (&tr, muzzle, NULL, NULL, end, ent->s.number, MASK_SHOT);
if ( tr.surfaceFlags & SURF_NOIMPACT ) {
return qfalse;
}
if ( ent->client->noclip ) {
return qfalse;
}
traceEnt = &g_entities[ tr.entityNum ];
// send blood impact
if ( traceEnt->takedamage && traceEnt->client ) {
tent = G_TempEntity( tr.endpos, EV_MISSILE_HIT );
tent->s.otherEntityNum = traceEnt->s.number;
tent->s.eventParm = DirToByte( tr.plane.normal );
tent->s.weapon = ent->s.weapon;
}
if ( !traceEnt->takedamage) {
return qfalse;
}
if (ent->client->ps.powerups[PW_QUAD] ) {
G_AddEvent( ent, EV_POWERUP_QUAD, 0 );
s_quadFactor = g_quadfactor.value;
} else {
s_quadFactor = 1;
}
#if 1
if( ent->client->persistantPowerup && ent->client->persistantPowerup->item && ent->client->persistantPowerup->item->giTag == PW_DOUBLER ) {
s_quadFactor *= 2;
}
#endif
damage = 50 * s_quadFactor;
G_Damage( traceEnt, ent, ent, forward, tr.endpos,
damage, 0, MOD_GAUNTLET );
return qtrue;
}
开发者ID:jangroothuijse,项目名称:openpromode,代码行数:60,代码来源:g_weapon.c
示例8: CheckGauntletAttack
qbool
CheckGauntletAttack(Gentity *ent)
{
Trace tr;
Vec3 end;
Gentity *tent;
Gentity *traceEnt;
int damage;
/* set aiming directions */
anglev3s (ent->client->ps.viewangles, forward, right, up);
CalcMuzzlePoint (ent, forward, right, up, muzzle);
saddv3 (muzzle, 32, forward, end);
trap_Trace (&tr, muzzle, NULL, NULL, end, ent->s.number, MASK_SHOT);
if(tr.surfaceFlags & SURF_NOIMPACT)
return qfalse;
if(ent->client->noclip)
return qfalse;
traceEnt = &g_entities[tr.entityNum];
/* send blood impact */
if(traceEnt->takedamage && traceEnt->client){
tent = G_TempEntity(tr.endpos, EV_MISSILE_HIT);
tent->s.otherEntityNum = traceEnt->s.number;
tent->s.eventParm = DirToByte(tr.plane.normal);
tent->s.weap[WSpri] = ent->s.weap[WSpri];
tent->s.weap[WSsec] = ent->s.weap[WSsec];
tent->s.weap[WShook] = ent->s.weap[WShook];
}
if(!traceEnt->takedamage)
return qfalse;
if(ent->client->ps.powerups[PW_QUAD]){
G_AddEvent(ent, EV_POWERUP_QUAD, 0);
s_quadFactor = g_quadfactor.value;
}else
s_quadFactor = 1;
#ifdef MISSIONPACK
if(ent->client->persistantPowerup &&
ent->client->persistantPowerup->item &&
ent->client->persistantPowerup->item->tag == PW_DOUBLER)
then
s_quadFactor *= 2;
#endif
damage = 50 * s_quadFactor;
G_Damage(traceEnt, ent, ent, forward, tr.endpos, damage, 0, MOD_GAUNTLET);
return qtrue;
}
开发者ID:icanhas,项目名称:yantar,代码行数:55,代码来源:weapon.c
示例9: FireWeapon2
/*
===============
FireWeapon2
===============
*/
void FireWeapon2( gentity_t *ent )
{
if( ent->client )
{
// set aiming directions
AngleVectors( ent->client->ps.viewangles, forward, right, up );
CalcMuzzlePoint( ent, forward, right, up, muzzle );
}
else
{
AngleVectors( ent->s.angles2, forward, right, up );
VectorCopy( ent->s.pos.trBase, muzzle );
}
// fire the specific weapon
switch( ent->s.weapon )
{
case WP_MACHINEGUN:
bulletFire( ent, RIFLE_SPREAD2, RIFLE_DMG2, MOD_MACHINEGUN );
break;
case WP_ALEVEL2_UPG:
areaZapFire( ent );
break;
case WP_PAIN_SAW:
painSawFire2( ent );
break;
case WP_LUCIFER_CANNON:
LCChargeFire( ent, qtrue );
break;
case WP_CHAINGUN:
bulletFire( ent, CHAINGUN_SPREAD2, CHAINGUN_DMG2, MOD_CHAINGUN );
break;
case WP_LAS_GUN:
lasGunFire2( ent );
break;
case WP_PULSE_RIFLE:
prifleStasisFire( ent );
break;
case WP_ABUILD:
case WP_HBUILD:
cancelBuildFire( ent );
break;
default:
break;
}
}
开发者ID:massivehaxxor,项目名称:new-edge,代码行数:60,代码来源:g_weapon.c
示例10: Weapon_GrapplingHook_Fire
void Weapon_GrapplingHook_Fire (gentity_t *ent)
{
//freeze
AngleVectors( ent->client->ps.viewangles, forward, right, up );
CalcMuzzlePoint( ent, forward, right, up, muzzle );
//freeze
if (!ent->client->fireHeld && !ent->client->hook)
fire_grapple (ent, muzzle, forward);
ent->client->fireHeld = qtrue;
}
开发者ID:dbircsak,项目名称:freeze-tag,代码行数:11,代码来源:g_weapon.c
示例11: Weapon_GrapplingHook_Fire
void Weapon_GrapplingHook_Fire (gentity_t *ent)
{
/* LQ3A: Take the direction from the viewangles. */
AngleVectors(ent->client->ps.viewangles, forward, right, up);
CalcMuzzlePoint(ent, forward, right, up, muzzle);
if (!ent->client->fireHeld && !ent->client->hook)
fire_grapple (ent, muzzle, forward);
ent->client->fireHeld = qtrue;
}
开发者ID:monoknot,项目名称:loaded-q3a,代码行数:11,代码来源:g_weapon.c
示例12: Offhand_Grapple_Fire
/*
===============
Offhand_Grapple_Fire
===============
*/
void Offhand_Grapple_Fire(gentity_t *ent)
{
AngleVectors(ent->client->ps.viewangles, forward, right, up);
CalcMuzzlePoint(ent, forward, right, up, muzzle);
if (!ent->client->fireHeld && !ent->client->hook)
fire_grapple(ent, muzzle, forward);
ent->client->hookhasbeenfired = qtrue;
ent->client->fireHeld = qtrue;
}
开发者ID:eserozvataf,项目名称:q3now,代码行数:16,代码来源:g_weapon.c
示例13: FireWeapon2
/*
===============
FireWeapon2
===============
*/
void FireWeapon2( gentity_t *ent )
{
if( ent->client )
{
// set aiming directions
AngleVectors( ent->client->ps.viewangles, forward, right, up );
CalcMuzzlePoint( ent, forward, right, up, muzzle );
}
else
{
AngleVectors( ent->s.angles2, forward, right, up );
VectorCopy( ent->s.pos.trBase, muzzle );
}
// fire the specific weapon
switch( ent->s.weapon )
{
/*case WP_ALEVEL1:
//Blaster_ball( ent, 0);
break;*/
case WP_ALEVEL0:
explodedretch( ent );
break;
case WP_ALEVEL1_UPG:
poisonCloud( ent );
break;
case WP_ALEVEL2_UPG:
areaZapFire( ent );
break;
case WP_LUCIFER_CANNON:
LCChargeFire( ent, qtrue );
break;
case WP_ABUILD:
case WP_ABUILD2:
case WP_HBUILD:
case WP_HBUILD2:
cancelBuildFire( ent );
break;
case WP_BLASTER:
detonate( ent );
break;
default:
break;
}
}
开发者ID:AlienHoboken,项目名称:Tremulous-W-Server,代码行数:55,代码来源:g_weapon.c
示例14: FireWeapon3
/*
===============
FireWeapon3
===============
*/
void FireWeapon3( gentity_t *ent )
{
if( ent->client )
{
// set aiming directions
AngleVectors( ent->client->ps.viewangles, forward, right, up );
CalcMuzzlePoint( ent, forward, right, up, muzzle );
}
else
{
AngleVectors( ent->s.angles2, forward, right, up );
VectorCopy( ent->s.pos.trBase, muzzle );
}
// fire the specific weapon
switch( ent->s.weapon )
{
case WP_ALEVEL3_UPG:
bounceBallFire( ent );
break;
case WP_ABUILD:
slowBlobFire( ent );
break;
case WP_ALEVEL2_UPG:
bounceBallFire_level2( ent );
break;
case WP_ALEVEL5:
Prickles( ent );
break;
case WP_ALEVEL4:
// FireBreath_tyrant( ent );
break;
case WP_MASS_DRIVER:
if(g_humanStage.integer == S5 && BG_InventoryContainsUpgrade( UP_BATTPACK, ent->client->ps.stats ))
{
massDriverFire2( ent );
}
break;
default:
break;
}
}
开发者ID:massivehaxxor,项目名称:new-edge,代码行数:53,代码来源:g_weapon.c
示例15: painSawFire
void painSawFire( gentity_t *ent )
{
trace_t tr;
vec3_t end;
gentity_t *tent;
gentity_t *traceEnt;
// set aiming directions
AngleVectors( ent->client->ps.viewangles, forward, right, up );
CalcMuzzlePoint( ent, forward, right, up, muzzle );
VectorMA( muzzle, PAINSAW_RANGE, forward, end );
G_UnlaggedOn( ent, muzzle, PAINSAW_RANGE );
trap_Trace( &tr, muzzle, NULL, NULL, end, ent->s.number, MASK_SHOT );
G_UnlaggedOff( );
if( tr.surfaceFlags & SURF_NOIMPACT )
return;
traceEnt = &g_entities[ tr.entityNum ];
// send blood impact
if( traceEnt->takedamage )
{
vec3_t temp;
//hack to get the particle system to line up with the weapon
VectorCopy( tr.endpos, temp );
temp[ 2 ] -= 10.0f;
if( traceEnt->client )
{
tent = G_TempEntity( temp, EV_MISSILE_HIT );
tent->s.otherEntityNum = traceEnt->s.number;
}
else
tent = G_TempEntity( temp, EV_MISSILE_MISS );
tent->s.eventParm = DirToByte( tr.plane.normal );
tent->s.weapon = ent->s.weapon;
tent->s.generic1 = ent->s.generic1; //weaponMode
}
if( traceEnt->takedamage )
G_Damage( traceEnt, ent, ent, forward, tr.endpos, PAINSAW_DAMAGE, DAMAGE_NO_KNOCKBACK, MOD_PAINSAW );
}
开发者ID:AlienHoboken,项目名称:Tremulous-W-Server,代码行数:48,代码来源:g_weapon.c
示例16: Rune_Phase_Use
void Rune_Phase_Use(gentity_t *ent)
{
vec3_t oldmuzzle,muzzle,forward,right,up,end;
trace_t trace, trace2;
AngleVectors (ent->client->ps.viewangles, forward, right, up);
CalcMuzzlePoint ( ent, forward, right, up, muzzle );
if (ent->runetime<level.time)
{
VectorMA (muzzle, 250, forward, end);
trap_Trace (&trace, muzzle, NULL, NULL, end, ent->s.number, MASK_SHOT );
// we didn't hit anything, so exit
if ( trace.fraction == 1)
return;
SnapVectorTowards( trace.endpos, muzzle );
// prepare for firing through the wall
VectorCopy (muzzle, oldmuzzle);
VectorCopy (trace.endpos, muzzle);
VectorMA (muzzle, 96, forward, muzzle);
if ( !( trap_PointContents( muzzle, -1 ) & CONTENTS_SOLID ))
{
// the point isn't inside a wall, so check to see if we are outside the bounds of the level
VectorCopy(muzzle,end);
end[2]=-10000;
trap_Trace (&trace2, muzzle, NULL, NULL, end, ent->s.number, MASK_SHOT );
// if we didn't hit anything after that big a trace, we are outside the level
if (trace2.fraction==1)
return;
TeleportPlayer(ent,muzzle,ent->client->ps.viewangles, qtrue, qtrue);
ent->runetime = level.time + RUNE_PHASE_RECHARGE;
}
}
else
{
//trap_SendServerCommand( ent->s.clientNum, va("print \"Phase is recharging\n\""));
}
}
开发者ID:ElderPlayerX,项目名称:Rune,代码行数:46,代码来源:runes20-29.c
示例17: WP_DropDetPack
//---------------------------------------------------------
static void WP_DropDetPack( gentity_t *self, vec3_t start, vec3_t dir )
//---------------------------------------------------------
{
// Chucking a new one
AngleVectors( self->client->ps.viewangles, forwardVec, vrightVec, up );
CalcMuzzlePoint( self, forwardVec, vrightVec, up, muzzle, 0 );
VectorNormalize( forwardVec );
VectorMA( muzzle, -4, forwardVec, muzzle );
VectorCopy( muzzle, start );
WP_TraceSetStart( self, start, vec3_origin, vec3_origin );//make sure our start point isn't on the other side of a wall
gentity_t *missile = CreateMissile( start, forwardVec, 300, 10000, self, qfalse );
missile->fxID = G_EffectIndex( "detpack/explosion" ); // if we set an explosion effect, explode death can use that instead
missile->classname = "detpack";
missile->s.weapon = WP_DET_PACK;
missile->s.pos.trType = TR_GRAVITY;
missile->s.eFlags |= EF_MISSILE_STICK;
missile->e_TouchFunc = touchF_charge_stick;
missile->damage = weaponData[WP_DET_PACK].damage;
missile->methodOfDeath = MOD_DETPACK;
missile->splashDamage = weaponData[WP_DET_PACK].splashDamage;
missile->splashRadius = weaponData[WP_DET_PACK].splashRadius;
missile->splashMethodOfDeath = MOD_DETPACK;// ?SPLASH;
missile->clipmask = (CONTENTS_SOLID|CONTENTS_BODY|CONTENTS_SHOTCLIP);//MASK_SHOT;
// we don't want it to ever bounce
missile->bounceCount = 0;
missile->s.radius = 30;
VectorSet( missile->s.modelScale, 1.0f, 1.0f, 1.0f );
gi.G2API_InitGhoul2Model( missile->ghoul2, weaponData[WP_DET_PACK].missileMdl, G_ModelIndex( weaponData[WP_DET_PACK].missileMdl ),
NULL_HANDLE, NULL_HANDLE, 0, 0);
AddSoundEvent( NULL, missile->currentOrigin, 128, AEL_MINOR, qtrue );
AddSightEvent( NULL, missile->currentOrigin, 128, AEL_SUSPICIOUS, 10 );
}
开发者ID:Almightygir,项目名称:OpenJK,代码行数:45,代码来源:wp_det_pack.cpp
示例18: FireWeapon3
/*
===============
FireWeapon3
===============
*/
void FireWeapon3( gentity_t *ent )
{
if( ent->client )
{
// set aiming directions
AngleVectors( ent->client->ps.viewangles, forward, right, up );
CalcMuzzlePoint( ent, forward, right, up, muzzle );
}
else
{
AngleVectors( ent->s.angles2, forward, right, up );
VectorCopy( ent->s.pos.trBase, muzzle );
}
// fire the specific weapon
switch( ent->s.weapon )
{
case WP_ALEVEL3_UPG:
bounceBallFire( ent );
break;
case WP_ABUILD2:
slowBlobFire( ent );
break;
// case WP_ALEVEL4:
// lockBlobLauncherFire( ent ); //thats right bitch, i'll trap you!
//N/B: Trap as in trap, not males dressing up as women.
break;
/*
case WP_HBUILD2:
bulletFire( ent, 300, 1, MOD_TRIGGER_HURT );
bulletFire( ent, 300, 1, MOD_TRIGGER_HURT );
bulletFire( ent, 300, 1, MOD_TRIGGER_HURT );
break;
*/
default:
break;
}
}
开发者ID:ZdrytchX,项目名称:Lolards_old,代码行数:46,代码来源:g_weapon.c
示例19: meleeAttack
/*
===============
meleeAttack
===============
*/
void meleeAttack( gentity_t *ent, float range, float width, int damage, meansOfDeath_t mod )
{
trace_t tr;
vec3_t end;
gentity_t *tent;
gentity_t *traceEnt;
vec3_t mins, maxs;
VectorSet( mins, -width, -width, -width );
VectorSet( maxs, width, width, width );
// set aiming directions
AngleVectors( ent->client->ps.viewangles, forward, right, up );
CalcMuzzlePoint( ent, forward, right, up, muzzle );
VectorMA( muzzle, range, forward, end );
G_UnlaggedOn( ent, muzzle, range );
trap_Trace( &tr, muzzle, mins, maxs, end, ent->s.number, MASK_SHOT );
G_UnlaggedOff( );
if( tr.surfaceFlags & SURF_NOIMPACT )
return;
traceEnt = &g_entities[ tr.entityNum ];
// send blood impact
if( traceEnt->takedamage && traceEnt->client )
{
tent = G_TempEntity( tr.endpos, EV_MISSILE_HIT );
tent->s.otherEntityNum = traceEnt->s.number;
tent->s.eventParm = DirToByte( tr.plane.normal );
tent->s.weapon = ent->s.weapon;
tent->s.generic1 = ent->s.generic1; //weaponMode
}
if( traceEnt->takedamage )
G_Damage( traceEnt, ent, ent, forward, tr.endpos, damage, DAMAGE_NO_KNOCKBACK, mod );
}
开发者ID:AlienHoboken,项目名称:Tremulous-W-Server,代码行数:45,代码来源:g_weapon.c
示例20: target
/*
===============
G_MedkitTarget
Look for a possible healing target (a client) in the front.
===============
*/
gentity_t *G_MedkitTarget( gentity_t *ent )
{
trace_t tr;
gentity_t *targetEnt = NULL;
if( g_humanMedkitRange.value <= 0 ||
g_humanMedkitWidth.value <= 0 )
return NULL;
// Calculate muzzle point
AngleVectors( ent->client->ps.viewangles, forward, right, up );
CalcMuzzlePoint( ent, forward, right, up, muzzle );
G_WideTrace( &tr, ent, g_humanMedkitRange.value,
g_humanMedkitWidth.value, g_humanMedkitWidth.value, &targetEnt );
if( ( targetEnt != NULL ) &&
( targetEnt->client != NULL ) )
return targetEnt;
else
return NULL;
}
开发者ID:massivehaxxor,项目名称:new-edge,代码行数:29,代码来源:g_weapon.c
注:本文中的CalcMuzzlePoint函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论