package p000; import java.util.Enumeration; import java.util.Hashtable; import javax.microedition.m3g.Image2D; import javax.microedition.m3g.RayIntersection; import javax.microedition.m3g.World; /* renamed from: af */ /* loaded from: microcounterstrike.jar:af.class */ public final class GrenadeController { /* renamed from: a */ public PlayerEntityBase playerEntityBase49; /* renamed from: c */ private static Image2D texture50; /* renamed from: d */ private static float value51 = 2.5f; /* renamed from: e */ private BillboardSprite billboardSprite52; /* renamed from: f */ private float[] value53; /* renamed from: g */ private float[] value54; /* renamed from: h */ private int value55 = 0; /* renamed from: i */ private boolean flag56 = true; /* renamed from: b */ public int value57 = -1; public GrenadeController(PlayerEntityBase abstractC0052u) { this.playerEntityBase49 = abstractC0052u; } /* renamed from: a */ public static void execute72() { texture50 = ResourceLoader.loadImages132("/res/image2d/grenade.png"); } /* renamed from: a */ public final void execute73(World world, float[] fArr, float[] fArr2) { this.flag56 = false; this.value53 = fArr; this.value57 = 0; this.value54 = VectorMath.getFloatArray263(fArr2); this.value54[0] = this.value54[0] * value51; this.value54[1] = this.value54[1] * value51; this.value54[2] = this.value54[2] * value51; this.value55 = 0; if (this.billboardSprite52 == null) { this.billboardSprite52 = new BillboardSprite(texture50, world.getActiveCamera(), fArr[0], fArr[1], fArr[2], 0.3f); world.addChild(this.billboardSprite52.mesh75); this.billboardSprite52.mesh75.setPickingEnable(false); } this.billboardSprite52.mesh75.setTranslation(fArr[0], fArr[1], fArr[2]); this.billboardSprite52.mesh75.setRenderingEnable(true); } /* renamed from: a */ public final void execute74(World world) { if (this.flag56) { return; } this.value57++; float[] fArr = {this.value53[0] + (this.value54[0] * this.value55), this.value53[1] + (this.value54[1] * this.value55) + (0.5f * (-0.2f) * this.value55 * this.value55), this.value53[2] + (this.value54[2] * this.value55)}; this.billboardSprite52.mesh75.setTranslation(fArr[0], fArr[1], fArr[2]); this.billboardSprite52.execute106(); this.value55++; float[] fArrM263b = VectorMath.getFloatArray263(new float[]{this.value54[0], this.value54[1] + ((-0.2f) * this.value55), this.value54[2]}); RayIntersection rayIntersection = new RayIntersection(); world.pick(-1, fArr[0], fArr[1], fArr[2], fArrM263b[0], fArrM263b[1], fArrM263b[2], rayIntersection); float distance = rayIntersection.getDistance(); float[] fArr2 = {this.value53[0] + (this.value54[0] * this.value55), this.value53[1] + (this.value54[1] * this.value55) + (0.5f * (-0.2f) * this.value55 * this.value55), this.value53[2] + (this.value54[2] * this.value55)}; if (((fArr2[0] - fArr[0]) * (fArr2[0] - fArr[0])) + ((fArr2[1] - fArr[1]) * (fArr2[1] - fArr[1])) + ((fArr2[2] - fArr[2]) * (fArr2[2] - fArr[2])) > distance * distance) { this.billboardSprite52.mesh75.setRenderingEnable(false); if (fArr[1] < 3.0f) { fArr[1] = 3.0f; } ParticleEffectManager.getInstance().execute294(fArr, world, CameraManager.getInstance().camera89); if (MainUiCanvasBase.getInstance().soundEnabled) { SoundManager.getInstance().execute199(4); } if (PlayerManager.getInstance().localPlayer == this.playerEntityBase49) { Hashtable hashtable = PlayerManager.getInstance().playersById; Enumeration enumerationKeys = hashtable.keys(); while (enumerationKeys.hasMoreElements()) { PlayerEntityBase abstractC0052u = (PlayerEntityBase) hashtable.get((Integer) enumerationKeys.nextElement()); if (abstractC0052u.value257 != 1) { execute75(abstractC0052u, fArr); } } } this.flag56 = true; this.value57 = -1; } } /* JADX WARN: Multi-variable type inference failed */ /* renamed from: a */ private void execute75(PlayerEntityBase abstractC0052u, float[] fArr) { if (abstractC0052u != this.playerEntityBase49 && ((Combatant) abstractC0052u).getHealth() > 0) { float[] fArrM289i = abstractC0052u.getFloatArray289(); if (((fArrM289i[0] - fArr[0]) * (fArrM289i[0] - fArr[0])) + ((fArrM289i[1] - fArr[1]) * (fArrM289i[1] - fArr[1])) + ((fArrM289i[2] - fArr[2]) * (fArrM289i[2] - fArr[2])) < 36.0f) { ((Combatant) abstractC0052u).onHit(this.playerEntityBase49, 4, null, null); } } } /* renamed from: b */ public final void execute76() { this.value53 = null; this.value54 = null; this.billboardSprite52 = null; } /* renamed from: c */ public static void execute77() { texture50 = null; } }