package p000; import java.util.Vector; import javax.microedition.m3g.Camera; import javax.microedition.m3g.Image2D; import javax.microedition.m3g.Node; import javax.microedition.m3g.RayIntersection; import javax.microedition.m3g.Transform; import javax.microedition.m3g.World; /* renamed from: v */ /* loaded from: microcounterstrike.jar:v.class */ public final class ParticleEffectManager { /* renamed from: a */ private static ParticleEffectManager particleEffectManager267; /* renamed from: b */ private static Image2D[] texture268; /* renamed from: c */ private static Image2D[] texture269; /* renamed from: d */ private static Image2D[] texture270; /* renamed from: e */ private static Image2D[] texture271; /* renamed from: f */ private Vector list272; /* renamed from: g */ private Vector list273; /* renamed from: h */ private Vector list274; /* renamed from: i */ private Vector list275; private ParticleEffectManager() { } /* renamed from: a */ public static ParticleEffectManager getInstance() { if (particleEffectManager267 == null) { particleEffectManager267 = new ParticleEffectManager(); } return particleEffectManager267; } /* renamed from: b */ public static void execute291() { texture268 = ResourceLoader.loadImages130("/res/image2d/bloodspray.png", 4, 32); if (PlatformServices.getInstance().getBoolean142()) { texture269 = ResourceLoader.loadImages130("/res/image2d/smokepuff.png", 4, 32); } if (PlatformServices.getInstance().getBoolean143()) { texture270 = ResourceLoader.loadImages130("/res/image2d/wallsplash.png", 4, 32); } texture271 = ResourceLoader.loadImages130("/res/image2d/explosion.png", 6, 64); } /* renamed from: a */ public final void execute292(int i, RayIntersection rayIntersection, World world, Camera camera) { Vector vector = null; Image2D[] image2DArr = (Image2D[]) null; float f = 1.0f; if (this.list272 == null) { this.list272 = new Vector(); } if (this.list273 == null) { this.list273 = new Vector(); } if (this.list274 == null) { this.list274 = new Vector(); } if (i == 1) { vector = this.list272; image2DArr = texture268; f = 16.0f; } else if (i == 2) { vector = this.list273; image2DArr = texture269; f = 6.0f; } else if (i == 3) { vector = this.list274; image2DArr = texture270; f = 16.0f; } AnimatedBillboardSprite c0027b = null; int i2 = 0; while (true) { if (i2 >= vector.size()) { break; } AnimatedBillboardSprite c0027b2 = (AnimatedBillboardSprite) vector.elementAt(i2); if (!c0027b2.flag126) { c0027b = c0027b2; break; } i2++; } if (c0027b == null) { AnimatedBillboardSprite c0027b3 = null; if (vector.size() > 0) { c0027b3 = (AnimatedBillboardSprite) vector.elementAt(0); } c0027b = c0027b3 != null ? new AnimatedBillboardSprite(c0027b3.mesh121, c0027b3.texture123, camera) : new AnimatedBillboardSprite(image2DArr, camera, f); world.addChild(c0027b.mesh121); vector.addElement(c0027b); } c0027b.execute183(true); float f2 = 0.0f; float f3 = 0.0f; float f4 = 0.0f; if (rayIntersection != null) { float distance = rayIntersection.getDistance(); float[] fArr = new float[6]; rayIntersection.getRay(fArr); f2 = fArr[0] + (fArr[3] * distance); f3 = fArr[1] + (fArr[4] * distance); f4 = fArr[2] + (fArr[5] * distance); } c0027b.execute182(f2, f3, f4); if (i == 2) { execute293(c0027b, rayIntersection, world); } } /* renamed from: a */ private static void execute293(AnimatedBillboardSprite c0027b, RayIntersection rayIntersection, World world) { float normalX = rayIntersection.getNormalX(); float normalY = rayIntersection.getNormalY(); float normalZ = rayIntersection.getNormalZ(); Node intersected = rayIntersection.getIntersected(); Transform transform = new Transform(); intersected.getTransformTo(world, transform); float[] fArr = {normalX, normalY, normalZ, 0.0f}; transform.transform(fArr); float[] fArr2 = {fArr[0], fArr[1], fArr[2]}; float[] fArr3 = new float[6]; rayIntersection.getRay(fArr3); if (VectorMath.getFloat259(fArr2, new float[]{fArr3[3], fArr3[4], fArr3[5]}) > 0.0f) { fArr2[0] = -fArr2[0]; fArr2[1] = -fArr2[1]; fArr2[2] = -fArr2[2]; } float fM261a = 0.2f / VectorMath.getFloat261(fArr2); fArr2[0] = fArr2[0] * fM261a; fArr2[1] = (fArr2[1] * fM261a) + 0.08f; fArr2[2] = fArr2[2] * fM261a; c0027b.execute185(fArr2); } /* renamed from: a */ public final void execute294(float[] fArr, World world, Camera camera) { if (this.list275 == null) { this.list275 = new Vector(); } AnimatedBillboardSprite c0027b = null; int i = 0; while (true) { if (i >= this.list275.size()) { break; } AnimatedBillboardSprite c0027b2 = (AnimatedBillboardSprite) this.list275.elementAt(i); if (!c0027b2.flag126) { c0027b = c0027b2; break; } i++; } if (c0027b == null) { c0027b = new AnimatedBillboardSprite(texture271, camera, 32.0f); world.addChild(c0027b.mesh121); this.list275.addElement(c0027b); } c0027b.execute183(true); c0027b.execute182(fArr[0], fArr[1], fArr[2]); } /* renamed from: c */ public final void execute295() { execute296(this.list272); execute296(this.list273); execute296(this.list274); execute296(this.list275); } /* renamed from: a */ private static void execute296(Vector vector) { if (vector != null) { for (int i = 0; i < vector.size(); i++) { Object objElementAt = vector.elementAt(i); if (objElementAt != null) { ((AnimatedBillboardSprite) objElementAt).execute184(); } } } } /* renamed from: d */ public final void execute297() { this.list272 = null; this.list273 = null; this.list274 = null; this.list275 = null; } /* renamed from: e */ public static void execute298() { texture268 = null; texture269 = null; texture270 = null; texture271 = null; } }