//----------------------------------------------------- void funcGlassDie( gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int damage, int mod,int dFlags,int hitLoc ) { vec3_t verts[4], normal; // if a missile is stuck to us, blow it up so we don't look dumb....we could, alternately, just let the missile drop off?? for ( int i = 0; i < MAX_GENTITIES; i++ ) { if ( g_entities[i].s.groundEntityNum == self->s.number && ( g_entities[i].s.eFlags & EF_MISSILE_STICK )) { G_Damage( &g_entities[i], self, self, NULL, NULL, 99999, 0, MOD_CRUSH ); //?? MOD? } } // Really naughty cheating. Put in an EVENT at some point... cgi_R_GetBModelVerts( cgs.inlineDrawModel[self->s.modelindex], verts, normal ); CG_DoGlass( verts, normal, self->pos1, self->pos2, self->splashRadius ); self->takedamage = qfalse;//stop chain reaction runaway loops G_SetEnemy( self, self->enemy ); //So chunks don't get stuck inside me self->s.solid = 0; self->contents = 0; self->clipmask = 0; gi.linkentity(self); if ( self->target && attacker != NULL ) { G_UseTargets( self, attacker ); } gi.AdjustAreaPortalState( self, qtrue ); G_FreeEntity( self ); }
/* ================== CG_GlassShatter Break glass with fancy method ================== */ void CG_GlassShatter(int entnum, vec3_t dmgPt, vec3_t dmgDir, float dmgRadius, int maxShards) { vec3_t verts[4], normal; if (cgs.inlineDrawModel[cg_entities[entnum].currentState.modelindex]) { trap->R_GetBModelVerts(cgs.inlineDrawModel[cg_entities[entnum].currentState.modelindex], verts, normal); CG_DoGlass(verts, normal, dmgPt, dmgDir, dmgRadius, maxShards); } //otherwise something awful has happened. }