Files
micro-counter-strike-decomp…/p000/BulletHoleManager.java
2026-03-18 12:51:32 +03:00

135 lines
4.6 KiB
Java

package p000;
import java.util.Vector;
import javax.microedition.m3g.Mesh;
import javax.microedition.m3g.Node;
import javax.microedition.m3g.RayIntersection;
import javax.microedition.m3g.Texture2D;
import javax.microedition.m3g.Transform;
import javax.microedition.m3g.World;
/* renamed from: x */
/* loaded from: microcounterstrike.jar:x.class */
public final class BulletHoleManager {
/* renamed from: a */
private static BulletHoleManager bulletHoleManager280;
/* renamed from: b */
private static Mesh mesh281;
/* renamed from: e */
private static Texture2D[] texture284;
/* renamed from: g */
private Vector list286;
/* renamed from: c */
private static float value282 = 0.1f;
/* renamed from: d */
private static float value283 = 1.0f;
/* renamed from: f */
private static float[] value285 = {0.0f, 0.0f, 1.0f};
private BulletHoleManager() {
}
/* renamed from: a */
public static BulletHoleManager getInstance() {
if (bulletHoleManager280 == null) {
bulletHoleManager280 = new BulletHoleManager();
}
return bulletHoleManager280;
}
/* renamed from: a */
public static void execute303(World world) {
StringBuffer stringBuffer = new StringBuffer("/res/image2d/crater");
stringBuffer.append(0);
stringBuffer.append(".png");
mesh281 = ResourceLoader.loadM3G(stringBuffer.toString(), 160);
mesh281.scale(0.5f, 0.5f, 0.5f);
texture284 = new Texture2D[1];
texture284[0] = mesh281.getAppearance(0).getTexture(0);
world.addChild(mesh281);
mesh281.setPickingEnable(false);
Transform transform = new Transform();
mesh281.getTransformTo(world, transform);
world.removeChild(mesh281);
float[] fArr = {0.0f, 0.0f, 1.0f, 0.0f};
transform.transform(fArr);
value285[0] = fArr[0];
value285[1] = fArr[1];
value285[2] = fArr[2];
}
/* renamed from: a */
public final void compute304(int i, RayIntersection rayIntersection, World world) {
float distance = rayIntersection.getDistance();
float[] fArr = new float[6];
rayIntersection.getRay(fArr);
float f = fArr[0] + (fArr[3] * distance);
float f2 = fArr[1] + (fArr[4] * distance);
float f3 = fArr[2] + (fArr[5] * distance);
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[] fArr2 = {normalX, normalY, normalZ, 0.0f};
transform.transform(fArr2);
float[] fArr3 = {fArr2[0], fArr2[1], fArr2[2]};
if (VectorMath.getFloat259(fArr3, new float[]{fArr[3], fArr[4], fArr[5]}) > 0.0f) {
fArr3[0] = -fArr3[0];
fArr3[1] = -fArr3[1];
fArr3[2] = -fArr3[2];
}
float degrees = (float) Math.toDegrees((float) FastAcos.getDouble78(VectorMath.getFloat259(value285, fArr3) / (Math.sqrt(((value285[0] * value285[0]) + (value285[1] * value285[1])) + (value285[2] * value285[2])) * Math.sqrt(((fArr3[0] * fArr3[0]) + (fArr3[1] * fArr3[1])) + (fArr3[2] * fArr3[2])))));
float[] fArrM260b = VectorMath.getFloatArray260(value285, fArr3);
if (fArrM260b[0] == 0.0f && fArrM260b[1] == 0.0f && fArrM260b[2] == 0.0f) {
fArrM260b[1] = 1.0f;
}
float f4 = value282;
if (i == 2) {
f4 = value283;
}
Mesh meshDuplicate = mesh281.duplicate();
meshDuplicate.setTranslation(f, f2, f3);
meshDuplicate.setScale(f4, f4, f4);
if (fArrM260b[0] != 0.0f || fArrM260b[1] != 0.0f || fArrM260b[2] != 0.0f) {
meshDuplicate.postRotate(degrees, fArrM260b[0], fArrM260b[1], fArrM260b[2]);
}
world.addChild(meshDuplicate);
if (this.list286 == null) {
this.list286 = new Vector();
}
this.list286.addElement(meshDuplicate);
}
/* renamed from: b */
public final void execute305(World world) {
if (this.list286 != null) {
for (int i = 0; i < this.list286.size(); i++) {
world.removeChild((Mesh) this.list286.elementAt(i));
}
}
this.list286 = null;
this.list286 = new Vector();
}
/* renamed from: b */
public final void execute306() {
this.list286 = null;
}
/* renamed from: c */
public static void execute307() {
mesh281 = null;
texture284 = null;
value285 = null;
}
}