lentity_t *CG_AllocExpandingPoly ( letype_t type, const vec3_t origin, const vec3_t angles, int frames, float scale,
				float light, float lr, float lg, float lb, struct model_s *model, struct shader_s *shader  );
void CG_PBExplosion ( vec3_t start )
{
	int		i;
	vec3_t	Vec[8];
	int	x=128;
	int y;
	lentity_t	*le,*le2,*le3;

	for (y=1; y<3; y++)
	{

		VectorSet(Vec[0],x/y,x/y,0);
		VectorSet(Vec[1],x/y,-x/y,0);
		VectorSet(Vec[2],-x/y,-x/y,0);
		VectorSet(Vec[3],-x/y,x/y,0);
		VectorSet(Vec[4],0,0,x/y);
		VectorSet(Vec[5],0,0,-x/y);

		for (i=0;i<8; i++)
			VectorAdd(Vec[i],start,Vec[i]);

		for (i=0;i<4; i++)
			CG_RailTrail (start,Vec[i],0);
		for (i=0;i<4; i++)
			CG_RailTrail (Vec[i],Vec[4],0);
		for (i=0;i<4; i++)
			CG_RailTrail (Vec[i],Vec[5],0);

		CG_RailBeam(start,Vec[5]);
		CG_RailBeam(start,Vec[4]);
	}

	le = CG_AllocExpandingPoly ( LE_RGB_FADE|LE_EXPANDING, start, vec3_origin, 4, 5, 600, 255, 0, 255, CG_MediaModel (cgs.media.modExplodeball), NULL);
	le->light = 60;
	le->ent.rotation = rand () % 360;
	le2 = CG_AllocExpandingPoly ( LE_RGB_FADE|LE_EXPANDING, start, vec3_origin, 4, 7, 600, 255, 0, 255, CG_MediaModel (cgs.media.modExplodeball), NULL);
	le2->light = 60;
	le2->ent.rotation = rand () % 360;
	le3 = CG_AllocExpandingPoly ( LE_RGB_FADE|LE_EXPANDING, start, vec3_origin, 5, 8, 600, 255, 0, 255, CG_MediaModel (cgs.media.modEmpwave), NULL);
	le3->light = 60;
	le3->ent.rotation = rand () % 360;
}
void CG_ShockView (void)
{
	float p=0;
	if (cg.shocktime > cg.time)
	{
		p = (cg.shocktime-cg.time);
		p /=250;
		cg.refdef.viewangles[PITCH] -=p*crandom();
		cg.refdef.viewangles[YAW] -=p*crandom();
		cg.refdef.viewangles[ROLL] -=p*crandom();
		p *=crandom();
	}
	
	cg.refdef.vieworg[0] += (1.0/16) + p;
	cg.refdef.vieworg[1] += (1.0/16) + p;
	cg.refdef.vieworg[2] += (1.0/16) + p;

	cg.refdef.x = scr_vrect.x;
	cg.refdef.y = scr_vrect.y;
}