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

328 lines
12 KiB
Java

package p000;
import java.util.Enumeration;
import java.util.Hashtable;
import java.util.Vector;
import javax.microedition.m3g.World;
/* renamed from: u */
/* loaded from: microcounterstrike.jar:u.class */
public abstract class PlayerEntityBase {
/* renamed from: g */
public int value255;
/* renamed from: h */
public String text256;
/* renamed from: i */
public int value257;
/* renamed from: j */
public static float value258 = 0.5f;
/* renamed from: k */
public static float value259 = 8.0f;
/* renamed from: m */
public PlayerModelBase playerModelBase261;
/* renamed from: l */
public int value260 = 0;
/* renamed from: n */
public SphereCollider sphereCollider262 = new SphereCollider();
/* renamed from: a */
private SphereCollider sphereCollider263 = new SphereCollider(new float[3], 0.0f);
/* renamed from: o */
public float value264 = 0.0f;
/* renamed from: p */
public float value265 = 0.0f;
/* renamed from: q */
public boolean flag266 = true;
public PlayerEntityBase(int i, String str, int i2) {
this.value255 = i;
this.text256 = str;
this.value257 = i2;
}
/* renamed from: a */
public abstract void addToWorld(World world);
/* renamed from: a */
public void removeFromWorld() {
this.playerModelBase261.execute271();
this.playerModelBase261 = null;
this.sphereCollider262 = null;
this.sphereCollider263 = null;
}
/* renamed from: d */
public abstract float getFloat246();
/* renamed from: a */
public abstract float getFloat248(float f);
/* renamed from: b */
public abstract float getFloat249(float f);
/* renamed from: c */
public abstract float getFloat250(float f);
/* renamed from: d */
public abstract float getFloat251(float f);
/* renamed from: c */
public abstract void execute245();
/* renamed from: b */
public void respawn() {
this.value264 = 0.0f;
this.value265 = 0.0f;
float[] fArr = MapManager.getInstance().getCurrentMapInfo().spawnPoints;
switch (GameSessionLoop.getInstance().sessionType) {
case 0:
int i = (this.value255 - 1) * 3;
this.playerModelBase261.node234.setTranslation(fArr[i], fArr[i + 1], fArr[i + 2]);
break;
case 1:
int i2 = (this.value255 - 1) * 3;
this.playerModelBase261.node234.setTranslation(fArr[i2], fArr[i2 + 1], fArr[i2 + 2]);
break;
case 2:
if (this.value255 != 1) {
if (this.value255 == 2) {
this.playerModelBase261.node234.setTranslation(fArr[0], fArr[4], fArr[2]);
break;
}
} else {
this.playerModelBase261.node234.setTranslation(fArr[3], fArr[1], fArr[5]);
break;
}
break;
}
execute281();
}
/* renamed from: h */
public final void execute281() {
float[] fArr = MapManager.getInstance().getCurrentMapInfo().spawnPoints;
int i = (this.value255 - 1) * 3;
this.sphereCollider262.value99 = getFloat246();
if (GameSessionLoop.getInstance().sessionType != 2) {
this.sphereCollider262.execute140(fArr[i], 0.0f, fArr[i + 2]);
} else if (this.value255 == 1) {
this.sphereCollider262.execute140(fArr[3], 0.0f, fArr[5]);
} else if (this.value255 == 2) {
this.sphereCollider262.execute140(fArr[0], 0.0f, fArr[2]);
}
}
/* renamed from: b */
public final void execute282(float[] fArr) {
float[] fArr2 = this.sphereCollider262.value98;
fArr2[0] = fArr2[0] + fArr[0];
fArr2[1] = fArr2[1] + fArr[1];
fArr2[2] = fArr2[2] + fArr[2];
}
/* renamed from: c */
public final SphereCollider getSphereCollider283(float[] fArr) {
float[] fArr2 = this.sphereCollider262.value98;
this.sphereCollider263.value98[0] = fArr2[0] + fArr[0];
this.sphereCollider263.value98[1] = fArr2[1] + fArr[1];
this.sphereCollider263.value98[2] = fArr2[2] + fArr[2];
this.sphereCollider263.value99 = this.sphereCollider262.value99;
return this.sphereCollider263;
}
/* renamed from: a */
public PlayerEntityBase findHitTarget(SphereCollider c0023aw) {
PlayerEntityBase abstractC0052u = null;
Hashtable hashtable = PlayerManager.getInstance().playersById;
Enumeration enumerationKeys = hashtable.keys();
while (true) {
if (!enumerationKeys.hasMoreElements()) {
break;
}
PlayerEntityBase abstractC0052u2 = (PlayerEntityBase) hashtable.get((Integer) enumerationKeys.nextElement());
if (abstractC0052u2 != this && abstractC0052u2.sphereCollider262.getBoolean139(c0023aw)) {
abstractC0052u = abstractC0052u2;
break;
}
}
return abstractC0052u;
}
/* renamed from: a */
public final boolean getBoolean284(PlayerEntityBase abstractC0052u) {
int iFloor;
int iFloor2;
float[] fArrM289i = abstractC0052u.getFloatArray289();
float[] fArrM289i2 = getFloatArray289();
float[] fArr = {fArrM289i[0] - fArrM289i2[0], 0.0f, fArrM289i[2] - fArrM289i2[2]};
float[] fArr2 = MapManager.getInstance().worldBoundsXZ;
float f = (fArrM289i[2] - fArr2[1]) / 20.0f;
int iFloor3 = f < 1.0f ? 0 : (int) Math.floor(f);
float f2 = (fArrM289i[0] - fArr2[0]) / 20.0f;
int iFloor4 = f2 < 1.0f ? 0 : (int) Math.floor(f2);
float f3 = (fArrM289i2[2] - fArr2[1]) / 20.0f;
int iFloor5 = f3 < 1.0f ? 0 : (int) Math.floor(f3);
float f4 = (fArrM289i2[0] - fArr2[0]) / 20.0f;
int iFloor6 = f4 < 1.0f ? 0 : (int) Math.floor(f4);
float[] fArr3 = {iFloor4 - iFloor6, 0.0f, iFloor3 - iFloor5};
float[] fArrM263b = VectorMath.getFloatArray263(fArr3);
float[] fArr4 = {(fArrM263b[0] * 20.0f) / 2.0f, 0.0f, (fArrM263b[2] * 20.0f) / 2.0f};
int i = -1;
int i2 = -1;
int i3 = 0;
while (true) {
float[] fArr5 = {fArrM289i2[0], this.sphereCollider262.value99 / 2.0f, fArrM289i2[2]};
if (i3 == 0) {
iFloor2 = iFloor6;
iFloor = iFloor5;
} else {
float f5 = fArrM289i2[0] + (i3 * fArr4[0]);
float f6 = fArrM289i2[2] + (i3 * fArr4[2]);
if (fArr[0] >= 0.0f) {
if (f5 > fArrM289i[0]) {
return false;
}
} else if (f5 < fArrM289i[0]) {
return false;
}
if (fArr[2] >= 0.0f) {
if (f6 > fArrM289i[2]) {
return false;
}
} else if (f6 < fArrM289i[2]) {
return false;
}
float f7 = (f6 - fArr2[1]) / 20.0f;
iFloor = f7 < 1.0f ? 0 : (int) Math.floor(f7);
float f8 = (f5 - fArr2[0]) / 20.0f;
iFloor2 = f8 < 1.0f ? 0 : (int) Math.floor(f8);
}
i3++;
if (iFloor2 != i || iFloor != i2) {
Vector vector = MapManager.getInstance().collisionCells[iFloor][iFloor2];
if (vector != null) {
for (int i4 = 0; i4 < vector.size(); i4++) {
if (((AxisAlignedBoundingBox) vector.elementAt(i4)).getBoolean168(fArrM289i2, fArr)) {
return true;
}
}
}
if (fArr3[0] == 0.0f && fArr3[2] == 0.0f) {
return false;
}
i = iFloor2;
i2 = iFloor;
}
}
}
/* renamed from: b */
public final boolean getBoolean285(PlayerEntityBase abstractC0052u) {
float[] fArrM289i = abstractC0052u.getFloatArray289();
return compute286(fArrM289i[0], fArrM289i[2]);
}
/* renamed from: a */
public final boolean compute286(float f, float f2) {
float[] fArrM289i = getFloatArray289();
float[] fArr = {f - fArrM289i[0], 0.0f, f2 - fArrM289i[2]};
float[] fArrM287a = compute287(1, 1.0f);
return ((float) Math.toDegrees((double) ((float) FastAcos.getDouble78(((double) VectorMath.getFloat259(fArrM287a, fArr)) / (Math.sqrt((double) (((fArrM287a[0] * fArrM287a[0]) + (fArrM287a[1] * fArrM287a[1])) + (fArrM287a[2] * fArrM287a[2]))) * Math.sqrt((double) (((fArr[0] * fArr[0]) + (fArr[1] * fArr[1])) + (fArr[2] * fArr[2])))))))) <= 40.0f;
}
/* renamed from: a */
public final float[] compute287(int i, float f) {
float f2 = 0.0f;
switch (i) {
case 1:
f2 = this.value265 + 180.0f;
break;
case 2:
f2 = this.value265;
break;
case 3:
f2 = this.value265 - 90.0f;
break;
case 4:
f2 = this.value265 + 90.0f;
break;
}
float[] fArr = new float[3];
double dSin = Math.sin(Math.toRadians(f2));
double dCos = Math.cos(Math.toRadians(f2));
if (Math.abs(dCos) == 1.0d) {
fArr[0] = 0.0f;
fArr[2] = (float) (f * dCos);
fArr[1] = 0.0f;
} else if (Math.abs(dSin) == 1.0d) {
fArr[2] = 0.0f;
fArr[0] = (float) (f * dSin);
fArr[1] = 0.0f;
} else {
double d = f;
fArr[0] = (float) (d * dSin);
fArr[2] = (float) (d * dCos);
fArr[1] = 0.0f;
}
return fArr;
}
/* renamed from: d */
public final AxisAlignedBoundingBox getAxisAlignedBoundingBox288(float[] fArr) {
MapManager.getInstance();
SphereCollider c0023awM283c = getSphereCollider283(fArr);
SphereCollider c0023aw = new SphereCollider(c0023awM283c.value98, c0023awM283c.value99 * 2.0f);
float[] fArr2 = this.sphereCollider262.value98;
float f = c0023aw.value99;
float f2 = fArr2[0] - f;
float f3 = fArr2[2] - f;
float f4 = fArr2[0] + f;
float f5 = fArr2[2] + f;
float[] fArr3 = MapManager.getInstance().worldBoundsXZ;
float f6 = (f3 - fArr3[1]) / 20.0f;
int iFloor = f6 < 1.0f ? 0 : (int) Math.floor(f6);
float f7 = (f2 - fArr3[0]) / 20.0f;
int iFloor2 = f7 < 1.0f ? 0 : (int) Math.floor(f7);
float f8 = (f5 - fArr3[1]) / 20.0f;
int iFloor3 = f8 < 1.0f ? 0 : (int) Math.floor(f8);
float f9 = (f4 - fArr3[0]) / 20.0f;
int iFloor4 = f9 < 1.0f ? 0 : (int) Math.floor(f9);
Vector[][] vectorArr = MapManager.getInstance().collisionCells;
for (int i = iFloor; i <= iFloor3; i++) {
for (int i2 = iFloor2; i2 <= iFloor4; i2++) {
if (i >= vectorArr.length || i2 >= vectorArr[i].length) {
return null;
}
if (vectorArr[i][i2] != null) {
Vector vector = vectorArr[i][i2];
for (int i3 = 0; i3 < vector.size(); i3++) {
AxisAlignedBoundingBox c0025ay = (AxisAlignedBoundingBox) vector.elementAt(i3);
if (c0025ay.getBoolean166(c0023aw)) {
return c0025ay;
}
}
}
}
}
return null;
}
/* renamed from: i */
public final float[] getFloatArray289() {
float[] fArr = new float[3];
this.playerModelBase261.node234.getTranslation(fArr);
return fArr;
}
}