本文整理汇总了C++中CG_AllocLocalEntity函数的典型用法代码示例。如果您正苦于以下问题:C++ CG_AllocLocalEntity函数的具体用法?C++ CG_AllocLocalEntity怎么用?C++ CG_AllocLocalEntity使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了CG_AllocLocalEntity函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CG_AllocLocalEntity
/*
* CG_AllocModel
*/
static lentity_t *CG_AllocModel( letype_t type, const vec3_t origin, const vec3_t angles, int frames,
float r, float g, float b, float a, float light, float lr, float lg, float lb, struct model_s *model, struct shader_s *shader )
{
lentity_t *le;
le = CG_AllocLocalEntity( type, r, g, b, a );
le->frames = frames;
le->light = light;
le->lightcolor[0] = lr;
le->lightcolor[1] = lg;
le->lightcolor[2] = lb;
le->ent.rtype = RT_MODEL;
le->ent.renderfx = RF_NOSHADOW;
le->ent.model = model;
le->ent.customShader = shader;
le->ent.shaderTime = cg.time;
le->ent.scale = 1.0f;
VectorCopy( angles, le->angles );
AnglesToAxis( angles, le->ent.axis );
VectorCopy( origin, le->ent.origin );
return le;
}
示例2: Com_Error
/*
====================
CG_MakeExplosion
====================
*/
localEntity_t *CG_MakeExplosion( vec3_t origin, vec3_t dir,
qhandle_t hModel, qhandle_t shader,
int offset, int duration, bool isSprite )
{
float ang;
localEntity_t *ex;
vec3_t tmpVec, newOrigin;
if ( duration <= 0 ) {
Com_Error( ERR_DROP, "CG_MakeExplosion: duration = %i", duration );
}
// skew the time a bit so they aren't all in sync
offset += rand() & 63;
ex = CG_AllocLocalEntity();
if ( isSprite )
{
ex->leType = LE_SPRITE_EXPLOSION;
// randomly rotate sprite orientation
ex->refEntity.rotation = rand() % 360;
VectorScale( dir, 16, tmpVec );
VectorAdd( tmpVec, origin, newOrigin );
}
else
{
ex->leType = LE_EXPLOSION;
VectorCopy( origin, newOrigin );
// set axis with random rotate
if ( !dir )
{
AxisClear( ex->refEntity.axis );
} else
{
ang = rand() % 360;
VectorCopy( dir, ex->refEntity.axis[0] );
RotateAroundDirection( ex->refEntity.axis, ang );
}
}
// calc the timings
ex->startTime = cg.time + offset;
ex->endTime = ex->startTime + duration;
// bias the time so all shader effects start correctly
ex->refEntity.shaderTime = ex->startTime / 1000.0f;
ex->refEntity.hModel = hModel;
ex->refEntity.customShader = shader;
// set origin
VectorCopy( newOrigin, ex->refEntity.origin );
VectorCopy( newOrigin, ex->refEntity.oldorigin );
ex->color[0] = ex->color[1] = ex->color[2] = 1;
return ex;
}
示例3: CG_NukeEffect
/*
==================
CG_NukeEffect
==================
*/
void CG_NukeEffect( centity_t * cent, entityState_t * es ) {
localEntity_t *le;
refEntity_t *re;
le = CG_AllocLocalEntity();
le->leFlags = 0;
le->leType = LE_NUKE;
le->startTime = cg.time;
le->endTime = cg.time + NUKE_CLOUD_ENDTIME;// 3000;//2250;
le->lifeRate = 1.0 / ( le->endTime - le->startTime );
le->color[0] = le->color[1] = le->color[2] = le->color[3] = 1.0;
VectorClear(le->angles.trBase);
re = &le->refEntity;
re->radius = availableWeapons[es->weaponIndex].damageRadius;
re->reType = RT_MODEL;
re->shaderTime = cg.time / 1000.0f;
re->hModel = cgs.media.nukeEffectModel;
VectorCopy( cent->lerpOrigin, re->origin );
//CG_NukeCloud(cent, es);
}
示例4: CG_LaunchGib
/*
==================
CG_LaunchGib
==================
*/
void CG_LaunchGib( vec3_t origin, vec3_t velocity, qhandle_t hModel ) {
localEntity_t *le;
refEntity_t *re;
le = CG_AllocLocalEntity();
re = &le->refEntity;
le->leType = LE_FRAGMENT;
le->startTime = cg.time;
le->endTime = le->startTime + 5000 + random() * 3000;
VectorCopy( origin, re->origin );
AxisCopy( axisDefault, re->axis );
re->hModel = hModel;
le->pos.trType = TR_GRAVITY;
VectorCopy( origin, le->pos.trBase );
VectorCopy( velocity, le->pos.trDelta );
le->pos.trTime = cg.time;
le->bounceFactor = 0.6f;
le->leBounceSoundType = LEBS_BLOOD;
le->leMarkType = LEMT_BLOOD;
if ( cg_leiSuperGoreyAwesome.integer ) {
CG_SpurtBlood( origin, velocity, 7); // LEILEI toss some extra juice
CG_SpurtBlood( origin, velocity, 22);
CG_SpurtBlood( origin, velocity, 11);
}
}
示例5: CG_SpawnEffect
/*
==================
CG_SpawnEffect
Player teleporting in or out
==================
*/
void CG_SpawnEffect( bvec3_t org ) {
localEntity_t *le;
refEntity_t *re;
le = CG_AllocLocalEntity();
le->leFlags = 0;
le->leType = LE_FADE_RGB;
le->startTime = cg.time;
le->endTime = cg.time + 500;
le->lifeRate = FIXED_INT32RATIO_G(1,( le->endTime - le->startTime ));
le->color[0] = le->color[1] = le->color[2] = le->color[3] = GFIXED_1;
re = &le->refEntity;
re->reType = RT_MODEL;
re->shaderTime = MSECTIME_G(cg.time);
#ifndef MISSIONPACK
re->customShader = cgs.media.teleportEffectShader;
#endif
re->hModel = cgs.media.teleportEffectModel;
AxisClear( re->axis );
VectorCopy( org, re->origin );
#ifdef MISSIONPACK
re->origin[2] += BFIXED(16,0);
#else
re->origin[2] -= BFIXED(24,0);
#endif
}
示例6: CG_InvulnerabilityJuiced
/*
==================
CG_InvulnerabilityJuiced
==================
*/
void CG_InvulnerabilityJuiced( vec3_t org ) {
localEntity_t *le;
refEntity_t *re;
vec3_t angles;
le = CG_AllocLocalEntity();
le->leFlags = 0;
le->leType = LE_INVULJUICED;
le->startTime = cg.time;
le->endTime = cg.time + 10000;
le->lifeRate = 1.0 / ( le->endTime - le->startTime );
le->color[0] = le->color[1] = le->color[2] = le->color[3] = 1.0;
re = &le->refEntity;
re->reType = RT_MODEL;
re->shaderTime = cg.time / 1000.0f;
re->hModel = cgs.media.invulnerabilityJuicedModel;
VectorCopy( org, re->origin );
VectorClear(angles);
AnglesToAxis( angles, re->axis );
trap_S_StartSound (org, ENTITYNUM_NONE, CHAN_BODY, cgs.media.invulnerabilityJuicedSound );
}
示例7: CG_SpawnEffect
/*
==================
CG_SpawnEffect
Player teleporting in or out
RPG-X: RedTechie Added refEntity_t *ent_legs, refEntity_t *ent_torso, refEntity_t *ent_head
==================
*/
void CG_SpawnEffect( vec3_t org, refEntity_t *ent_legs, refEntity_t *ent_torso, refEntity_t *ent_head ) {
localEntity_t *le;
refEntity_t *re;
FX_Transporter(org);
le = CG_AllocLocalEntity();
le->leFlags = 0;
le->leType = LE_FADE_RGB;
le->startTime = cg.time;
le->endTime = cg.time + 500;
le->lifeRate = 1.0 / ( le->endTime - le->startTime );
le->color[0] = le->color[1] = le->color[2] = le->color[3] = 1.0;
re = &le->refEntity;
//RPG-X: RedTechie - Playing with transporter crap
re->shaderTime = cg.time * 0.001f;
re = &le->refEntity;
re->reType = RT_MODEL;
re->shaderTime = cg.time * 0.001f;
re->customShader = cgs.media.teleportEffectShader;
re->hModel = cgs.media.teleportEffectModel;
AxisClear( re->axis );
VectorCopy( org, re->origin );
re->origin[2] -= 24;
}
示例8: CG_LaunchRocketSpark
/*
==================
CG_LaunchRocketSpark
==================
*/
void CG_LaunchRocketSpark( vec3_t origin, vec3_t velocity ) {
localEntity_t *le;
refEntity_t *re;
le = CG_AllocLocalEntity();
re = &le->refEntity;
le->leType = LE_FRAGMENT;
le->startTime = cg.time;
le->endTime = le->startTime + 4000;
VectorCopy( origin, re->origin );
AxisCopy( axisDefault, re->axis );
re->hModel = cgs.media.nullModel;
// re->reType = RT_SPRITE;
le->pos.trType = TR_GRAVITY;
VectorCopy( origin, le->pos.trBase );
VectorCopy( velocity, le->pos.trDelta );
le->pos.trTime = cg.time;
le->bounceFactor = 0.5;
// re->radius = 16;
// le->radius = 1;
le->leBounceSoundType = LEBS_SPARK;
// le->leMarkType = LEMT_BLOOD;
}
示例9: CG_ThrowChunk
/*
==================
CG_ThrowChunk
==================
*/
void CG_ThrowChunk( vec3_t origin, vec3_t velocity, qhandle_t hModel, int optionalSound, int startalpha ) {
localEntity_t *le;
refEntity_t *re;
le = CG_AllocLocalEntity();
re = &le->refEntity;
le->leType = LE_FRAGMENT;
le->startTime = cg.time;
le->endTime = le->startTime + 5000 + random() * 3000;
VectorCopy( origin, re->origin );
AxisCopy( axisDefault, re->axis );
re->hModel = hModel;
le->pos.trType = TR_GRAVITY;
le->angles.trType = TR_GRAVITY;
VectorCopy( origin, le->pos.trBase );
VectorCopy( velocity, le->pos.trDelta );
VectorSet(le->angles.trBase, 20, 20, 20);
VectorCopy( velocity, le->angles.trDelta );
le->pos.trTime = cg.time;
le->angles.trTime = cg.time;
le->leFlags = LEF_TUMBLE;
le->angles.trBase[YAW] = 180;
le->bounceFactor = 0.3f;
le->bounceSound = optionalSound;
le->forceAlpha = startalpha;
}
示例10: CG_Bubble
/*
==================
CG_Bubble
Bullets shot underwater
==================
*/
void CG_Bubble( vec3_t start, vec3_t velocity, int time, float radius, float alpha ) {
localEntity_t *le;
refEntity_t *re;
// advance a random amount first
le = CG_AllocLocalEntity();
le->leFlags = LEF_PUFF_DONT_SCALE;
le->leType = LE_MOVE_SCALE_FADE;
le->startTime = cg.time;
le->endTime = cg.time + time + random() * 250;
le->lifeRate = 1.0 / ( le->endTime - le->startTime );
re = &le->refEntity;
re->shaderTime = cg.time / 1000.0f;
re->reType = RT_SPRITE;
re->rotation = 0;
re->radius = radius;
re->customShader = cgs.media.waterBubbleShader;
re->shaderRGBA[0] = 0xff;
re->shaderRGBA[1] = 0xff;
re->shaderRGBA[2] = 0xff;
re->shaderRGBA[3] = 0xff;
le->color[3] = alpha;
le->pos.trType = TR_LINEAR;
le->pos.trTime = cg.time;
VectorCopy( start, le->pos.trBase );
VectorScale( velocity, 150 + test_h.value, le->pos.trDelta );
}
示例11: CG_SpawnEffect
/*
==================
CG_SpawnEffect
Player teleporting in or out
==================
*/
void CG_SpawnEffect(vec3_t org)
{
localEntity_t *le;
refEntity_t *re;
return; // (SA) don't play spawn in effect right now
le = CG_AllocLocalEntity();
le->leFlags = 0;
le->leType = LE_FADE_RGB;
le->startTime = cg.time;
le->endTime = cg.time + 500;
le->lifeRate = 1.0 / (le->endTime - le->startTime);
le->color[0] = le->color[1] = le->color[2] = le->color[3] = 1.0;
re = &le->refEntity;
re->reType = RT_MODEL;
re->shaderTime = cg.time / 1000.0f;
re->customShader = cgs.media.teleportEffectShader;
re->hModel = cgs.media.teleportEffectModel;
AxisClear(re->axis);
VectorCopy(org, re->origin);
re->origin[2] -= 24;
}
示例12: CG_SparklerSparks
/*
==============
CG_SparklerSparks
==============
*/
void CG_SparklerSparks( vec3_t origin, int count ) {
// these effect the look of the, umm, effect
int FUSE_SPARK_LIFE = 100;
int FUSE_SPARK_LENGTH = 30;
// these are calculated from the above
int FUSE_SPARK_SPEED = ( FUSE_SPARK_LENGTH * 1000 / FUSE_SPARK_LIFE );
int i;
localEntity_t *le;
refEntity_t *re;
for ( i = 0; i < count; i++ ) {
// spawn the spark
le = CG_AllocLocalEntity();
re = &le->refEntity;
le->leType = LE_FUSE_SPARK;
le->startTime = cg.time;
le->endTime = cg.time + FUSE_SPARK_LIFE;
le->lastTrailTime = cg.time;
VectorCopy( origin, re->origin );
le->pos.trType = TR_GRAVITY;
VectorCopy( origin, le->pos.trBase );
VectorSet( le->pos.trDelta, crandom(), crandom(), crandom() );
VectorNormalize( le->pos.trDelta );
VectorScale( le->pos.trDelta, FUSE_SPARK_SPEED, le->pos.trDelta );
le->pos.trTime = cg.time;
}
}
示例13: CG_LaunchExplode
/*
==================
CG_LaunchGib
==================
*/
void CG_LaunchExplode( vec3_t origin, vec3_t velocity, qhandle_t hModel ) {
localEntity_t *le;
refEntity_t *re;
le = CG_AllocLocalEntity();
re = &le->refEntity;
le->leType = LE_FRAGMENT;
le->startTime = cg.time;
le->endTime = le->startTime + 10000 + random() * 6000;
VectorCopy( origin, re->origin );
AxisCopy( axisDefault, re->axis );
re->hModel = hModel;
le->pos.trType = TR_GRAVITY;
VectorCopy( origin, le->pos.trBase );
VectorCopy( velocity, le->pos.trDelta );
le->pos.trTime = cg.time;
le->bounceFactor = 0.1f;
le->leBounceSoundType = LEBS_BRASS;
le->leMarkType = LEMT_NONE;
}
示例14: CG_LaunchGib
/*
==================
CG_LaunchGib
==================
*/
void CG_LaunchGib( vector3 *origin, vector3 *velocity, qhandle_t hModel ) {
localEntity_t *le;
refEntity_t *re;
le = CG_AllocLocalEntity();
re = &le->refEntity;
le->leType = LE_FRAGMENT;
le->startTime = cg.time;
le->endTime = le->startTime + 5000 + random() * 3000;
VectorCopy( origin, &re->origin );
AxisCopy( axisDefault, re->axis );
re->hModel = hModel;
le->pos.trType = TR_GRAVITY;
VectorCopy( origin, &le->pos.trBase );
VectorCopy( velocity, &le->pos.trDelta );
le->pos.trTime = cg.time;
le->bounceFactor = 0.6f;
le->leBounceSoundType = LEBS_BLOOD;
le->leMarkType = LEMT_BLOOD;
}
示例15: CG_InvulnerabilityImpact
/*
==================
CG_InvulnerabilityImpact
==================
*/
void CG_InvulnerabilityImpact( vec3_t org, vec3_t angles ) {
localEntity_t *le;
refEntity_t *re;
int r;
sfxHandle_t sfx;
le = CG_AllocLocalEntity();
le->leFlags = 0;
le->leType = LE_INVULIMPACT;
le->startTime = cg.time;
le->endTime = cg.time + 1000;
le->lifeRate = 1.0 / ( le->endTime - le->startTime );
le->color[0] = le->color[1] = le->color[2] = le->color[3] = 1.0;
re = &le->refEntity;
re->reType = RT_MODEL;
re->shaderTime = cg.time / 1000.0f;
re->hModel = cgs.media.invulnerabilityImpactModel;
VectorCopy( org, re->origin );
AnglesToAxis( angles, re->axis );
r = rand() & 3;
if ( r < 2 ) {
sfx = cgs.media.invulnerabilityImpactSound1;
} else if ( r == 2 ) {
sfx = cgs.media.invulnerabilityImpactSound2;
} else {
sfx = cgs.media.invulnerabilityImpactSound3;
}
trap_S_StartSound (org, ENTITYNUM_NONE, CHAN_BODY, sfx );
}