本文整理汇总了C++中CalcMuzzlePoint函数的典型用法代码示例。如果您正苦于以下问题:C++ CalcMuzzlePoint函数的具体用法?C++ CalcMuzzlePoint怎么用?C++ CalcMuzzlePoint使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了CalcMuzzlePoint函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
}
示例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 );
}
}
示例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;
}
示例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;
}
示例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;
}
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
}
示例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;
}
}
示例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 );
}