//----------------------------------------------------- void SP_misc_turretG2( gentity_t *base ) //----------------------------------------------------- { int customscaleVal; char* s; turretG2_set_models( base, qfalse ); G_SpawnInt("painwait", "0", &base->genericValue4); base->genericValue8 = 0; G_SpawnInt("customscale", "0", &customscaleVal); base->s.iModelScale = customscaleVal; if (base->s.iModelScale) { if (base->s.iModelScale > 1023) { base->s.iModelScale = 1023; } base->modelScale[0] = base->modelScale[1] = base->modelScale[2] = base->s.iModelScale/100.0f; } 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); } finish_spawning_turretG2( base ); if (( base->spawnflags & 1 )) // Start_Off { base->s.frame = 1; // black } else { base->s.frame = 0; // glow } if ( !(base->spawnflags&SPF_TURRETG2_TURBO) ) { base->s.eFlags |= EF_SHADER_ANIM; } if (base->spawnflags & SPF_SHOWONRADAR) { base->s.eFlags |= EF_RADAROBJECT; } #undef name #undef name2 #undef name3 }
void turretG2_respawn( gentity_t *self ) { self->use = turretG2_base_use; self->pain = TurretG2Pain; self->die = turretG2_die; self->takedamage = qtrue; self->s.shouldtarget = qtrue; //self->s.owner = MAX_CLIENTS; //not owned by any client if ( self->s.eFlags & EF_SHADER_ANIM ) { self->s.frame = 0; // normal } self->s.weapon = WP_TURRET; // crosshair code uses this to mark crosshair red turretG2_set_models( self, qfalse ); self->s.health = self->health = self->genericValue6; if ( self->maxHealth ) { G_ScaleNetHealth( self ); } self->genericValue5 = 0;//clear this now }
//------------------------------------------------------------------------------------------------------------ void turretG2_die ( gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int damage, int meansOfDeath ) //------------------------------------------------------------------------------------------------------------ { vec3_t forward = { 0,0,-1 }, pos; // Turn off the thinking of the base & use it's targets //self->think = NULL; self->use = NULL; // clear my data self->die = NULL; self->pain = NULL; self->takedamage = qfalse; self->s.health = self->health = 0; self->s.loopSound = 0; self->s.shouldtarget = qfalse; //self->s.owner = MAX_CLIENTS; //not owned by any client // hack the effect angle so that explode death can orient the effect properly if ( self->spawnflags & 2 ) { VectorSet( forward, 0, 0, 1 ); } // VectorCopy( self->r.currentOrigin, self->s.pos.trBase ); VectorMA( self->r.currentOrigin, 12, forward, pos ); G_PlayEffect( EFFECT_EXPLOSION_TURRET, pos, forward ); if ( self->splashDamage > 0 && self->splashRadius > 0 ) { G_RadiusDamage( self->r.currentOrigin, attacker, self->splashDamage, self->splashRadius, attacker, NULL, MOD_UNKNOWN ); } if ( self->s.eFlags & EF_SHADER_ANIM ) { self->s.frame = 1; // black } self->s.weapon = 0; // crosshair code uses this to mark crosshair red if ( self->s.modelindex2 ) { // switch to damage model if we should turretG2_set_models( self, qtrue ); VectorCopy( self->r.currentAngles, self->s.apos.trBase ); VectorClear( self->s.apos.trDelta ); if ( self->target ) { G_UseTargets( self, attacker ); } if (self->spawnflags & SPF_TURRETG2_CANRESPAWN) { //respawn if (self->health < 1 && !self->genericValue5) { //we are dead, set our respawn delay if we have one self->genericValue5 = level.time + self->count; } } } else { ObjectDie( self, inflictor, attacker, damage, meansOfDeath ); } }