/* KI_67 - Decompiled by JODE
 * Visit http://jode.sourceforge.net/
 */
package com.maddox.il2.objects.air;
import java.io.IOException;

import com.maddox.JGP.Point3d;
import com.maddox.il2.ai.Shot;
import com.maddox.il2.ai.World;
import com.maddox.il2.engine.Actor;
import com.maddox.il2.engine.HierMesh;
import com.maddox.il2.game.AircraftHotKeys;
import com.maddox.il2.game.HUD;
import com.maddox.rts.NetMsgGuaranted;
import com.maddox.rts.NetMsgInput;
import com.maddox.rts.Property;

public abstract class KI_67 extends Scheme2
{
    private boolean bSightAutomation = false;
    private boolean bSightBombDump = false;
    private float fSightCurDistance = 0.0F;
    public float fSightCurForwardAngle = 0.0F;
    public float fSightCurSideslip = 0.0F;
    public float fSightCurAltitude = 850.0F;
    public float fSightCurSpeed = 150.0F;
    public float fSightCurReadyness = 0.0F;
    /*synthetic*/ static Class class$com$maddox$il2$objects$air$KI_67;
    
    public void onAircraftLoaded() {
	super.onAircraftLoaded();
	FM.AS.wantBeaconsNet(true);
    }
    
    public static void moveGear(HierMesh hiermesh, float f, float f_0_,
				float f_1_) {
	hiermesh.chunkSetAngles("GearL2_D0", 0.0F, -120.0F * f, 0.0F);
	hiermesh.chunkSetAngles("GearL4_D0", 0.0F,
				Aircraft.cvt(f, 0.01F, 0.1F, 0.0F, -90.0F),
				0.0F);
	hiermesh.chunkSetAngles("GearL5_D0", 0.0F,
				Aircraft.cvt(f, 0.01F, 0.1F, 0.0F, -90.0F),
				0.0F);
	hiermesh.chunkSetAngles("GearR2_D0", 0.0F, -120.0F * f, 0.0F);
	hiermesh.chunkSetAngles("GearR4_D0", 0.0F,
				Aircraft.cvt(f, 0.01F, 0.1F, 0.0F, -90.0F),
				0.0F);
	hiermesh.chunkSetAngles("GearR5_D0", 0.0F,
				Aircraft.cvt(f, 0.01F, 0.1F, 0.0F, -90.0F),
				0.0F);
	hiermesh.chunkSetAngles("GearC3_D0", 0.0F, -90.0F * f, 0.0F);
	hiermesh.chunkSetAngles("GearC4_D0", 0.0F,
				Aircraft.cvt(f, 0.01F, 0.1F, 0.0F, -80.0F),
				0.0F);
	hiermesh.chunkSetAngles("GearC5_D0", 0.0F,
				Aircraft.cvt(f, 0.01F, 0.1F, 0.0F, -80.0F),
				0.0F);
    }
    
    protected void moveGear(float f, float f_2_, float f_3_) {
	moveGear(hierMesh(), f, f_2_, f_3_);
    }
    
    public void moveSteering(float f) {
	hierMesh().chunkSetAngles("GearC2_D0", 0.0F,
				  Aircraft.cvt(f, -65.0F, 65.0F, 65.0F,
					       -65.0F),
				  0.0F);
    }
    
    public void moveWheelSink() {
	resetYPRmodifier();
	Aircraft.xyz[1] = Aircraft.cvt(FM.Gears.gWheelSinking[0], 0.0F,
				       0.2375F, 0.0F, 0.2375F);
	hierMesh().chunkSetLocate("GearL3_D0", Aircraft.xyz, Aircraft.ypr);
	Aircraft.xyz[1] = Aircraft.cvt(FM.Gears.gWheelSinking[1], 0.0F,
				       0.2375F, 0.0F, 0.2375F);
	hierMesh().chunkSetLocate("GearR3_D0", Aircraft.xyz, Aircraft.ypr);
    }
    
    public void rareAction(float f, boolean bool) {
	super.rareAction(f, bool);
	if (bool) {
	    if (FM.AS.astateEngineStates[0] > 3) {
		if (World.Rnd().nextFloat() < 0.02F)
		    FM.AS.hitTank(this, 0, 1);
		if (World.Rnd().nextFloat() < 0.02F)
		    FM.AS.hitTank(this, 1, 1);
	    }
	    if (FM.AS.astateEngineStates[1] > 3) {
		if (World.Rnd().nextFloat() < 0.02F)
		    FM.AS.hitTank(this, 2, 1);
		if (World.Rnd().nextFloat() < 0.02F)
		    FM.AS.hitTank(this, 3, 1);
	    }
	    if (FM.AS.astateTankStates[0] > 5
		&& World.Rnd().nextFloat() < 0.02F)
		FM.AS.hitTank(this, 1, 1);
	    if (FM.AS.astateTankStates[1] > 5
		&& World.Rnd().nextFloat() < 0.02F)
		FM.AS.hitTank(this, 0, 1);
	    if (FM.AS.astateTankStates[1] > 5
		&& World.Rnd().nextFloat() < 0.02F)
		FM.AS.hitTank(this, 2, 1);
	    if (FM.AS.astateTankStates[2] > 5
		&& World.Rnd().nextFloat() < 0.02F)
		FM.AS.hitTank(this, 1, 1);
	    if (FM.AS.astateTankStates[2] > 5
		&& World.Rnd().nextFloat() < 0.02F)
		FM.AS.hitTank(this, 3, 1);
	    if (FM.AS.astateTankStates[3] > 5
		&& World.Rnd().nextFloat() < 0.02F)
		FM.AS.hitTank(this, 2, 1);
	}
	if (FM.getAltitude() < 3000.0F) {
	    for (int i = 1; i < 4; i++)
		hierMesh().chunkVisible("HMask" + i + "_D0", false);
	} else {
	    for (int i = 1; i < 4; i++)
		hierMesh().chunkVisible("HMask" + i + "_D0",
					hierMesh()
					    .isChunkVisible("Pilot1_D0"));
	}
    }
    
    public boolean turretAngles(int i, float[] fs) {
	boolean bool = super.turretAngles(i, fs);
	float f = -fs[0];
	float f_4_ = fs[1];
	switch (i) {
	default:
	    break;
	case 0:
	    if (f < -35.0F) {
		f = -35.0F;
		bool = false;
	    }
	    if (f > 35.0F) {
		f = 35.0F;
		bool = false;
	    }
	    if (f_4_ < -45.0F) {
		f_4_ = -45.0F;
		bool = false;
	    }
	    if (f_4_ > 25.0F) {
		f_4_ = 25.0F;
		bool = false;
	    }
	    break;
	case 1:
	    if (f < -45.0F) {
		f = -45.0F;
		bool = false;
	    }
	    if (f > 45.0F) {
		f = 45.0F;
		bool = false;
	    }
	    if (f_4_ < -45.0F) {
		f_4_ = -45.0F;
		bool = false;
	    }
	    if (f_4_ > 25.0F) {
		f_4_ = 25.0F;
		bool = false;
	    }
	    break;
	case 2:
	    if (f < -50.0F) {
		f = -50.0F;
		bool = false;
	    }
	    if (f > 50.0F) {
		f = 50.0F;
		bool = false;
	    }
	    if (f_4_ > Aircraft.cvt(Math.abs(f), 0.0F, 50.0F, 40.0F, 25.0F))
		f_4_ = Aircraft.cvt(Math.abs(f), 0.0F, 50.0F, 40.0F, 25.0F);
	    if (f_4_ < Aircraft.cvt(Math.abs(f), 0.0F, 50.0F, -10.0F, -3.5F))
		f_4_ = Aircraft.cvt(Math.abs(f), 0.0F, 50.0F, -10.0F, -3.5F);
	    break;
	case 3:
	    if (f < -55.0F) {
		f = -55.0F;
		bool = false;
	    }
	    if (f > 30.0F) {
		f = 30.0F;
		bool = false;
	    }
	    if (f_4_ < -40.0F) {
		f_4_ = -40.0F;
		bool = false;
	    }
	    if (f_4_ > 45.0F) {
		f_4_ = 45.0F;
		bool = false;
	    }
	    break;
	case 4:
	    if (f < -30.0F) {
		f = -30.0F;
		bool = false;
	    }
	    if (f > 55.0F) {
		f = 55.0F;
		bool = false;
	    }
	    if (f_4_ < -40.0F) {
		f_4_ = -40.0F;
		bool = false;
	    }
	    if (f_4_ > 45.0F) {
		f_4_ = 45.0F;
		bool = false;
	    }
	}
	fs[0] = -f;
	fs[1] = f_4_;
	return bool;
    }
    
    protected boolean cutFM(int i, int i_5_, Actor actor) {
	switch (i) {
	default:
	    break;
	case 33:
	    hitProp(0, i_5_, actor);
	    break;
	case 36:
	    hitProp(1, i_5_, actor);
	    break;
	case 34:
	    FM.AS.hitEngine(this, 0, 2);
	    if (World.Rnd().nextInt(0, 99) < 66)
		FM.AS.hitEngine(this, 0, 2);
	    break;
	case 37:
	    FM.AS.hitEngine(this, 1, 2);
	    if (World.Rnd().nextInt(0, 99) < 66)
		FM.AS.hitEngine(this, 1, 2);
	    break;
	case 19:
	    killPilot(actor, 6);
	}
	return super.cutFM(i, i_5_, actor);
    }
    
    protected void hitBone(String string, Shot shot, Point3d point3d) {
	if (string.startsWith("xx")) {
	    if (string.startsWith("xxcontrol")) {
		int i = string.charAt(9) - 48;
		switch (i) {
		default:
		    break;
		case 1:
		    if (!(getEnergyPastArmor(2.2F, shot) <= 0.0F)) {
			if (World.Rnd().nextFloat() < 0.1F)
			    FM.AS.setControlsDamage(shot.initiator, 2);
			if (World.Rnd().nextFloat() < 0.1F)
			    FM.AS.setControlsDamage(shot.initiator, 1);
		    }
		    break;
		case 2:
		case 3:
		    if (getEnergyPastArmor(2.2F, shot) > 0.0F
			&& World.Rnd().nextFloat() < 0.25F)
			FM.AS.setControlsDamage(shot.initiator, 0);
		}
	    } else if (string.startsWith("xxeng")) {
		int i = string.charAt(5) - 49;
		if (string.endsWith("case")) {
		    if (getEnergyPastArmor(1.7F, shot) > 0.0F) {
			if (World.Rnd().nextFloat(20000.0F, 140000.0F)
			    < shot.power) {
			    FM.AS.setEngineStuck(shot.initiator, i);
			    debuggunnery
				("*** Engine" + i
				 + " Crank Case Hit - Engine Stucks..");
			}
			if (World.Rnd().nextFloat(10000.0F, 50000.0F)
			    < shot.power) {
			    FM.AS.hitEngine(shot.initiator, i, 2);
			    debuggunnery
				("*** Engine" + i
				 + " Crank Case Hit - Engine Damaged..");
			}
		    } else if (World.Rnd().nextFloat() < 0.04F)
			FM.EI.engines[i].setCyliderKnockOut(shot.initiator, 1);
		    else {
			FM.EI.engines[i].setReadyness(shot.initiator,
						      (FM.EI.engines[i]
							   .getReadyness()
						       - 0.02F));
			debuggunnery
			    ("*** Engine" + i
			     + " Crank Case Hit - Readyness Reduced to "
			     + FM.EI.engines[i].getReadyness() + "..");
		    }
		    getEnergyPastArmor(12.0F, shot);
		}
		if (string.endsWith("cyls")) {
		    if (getEnergyPastArmor(0.85F, shot) > 0.0F
			&& (World.Rnd().nextFloat()
			    < (FM.EI.engines[i].getCylindersRatio()
			       * 0.9878F))) {
			FM.EI.engines[i].setCyliderKnockOut
			    (shot.initiator,
			     World.Rnd().nextInt(1, (int) (shot.power
							   / 19000.0F)));
			debuggunnery("*** Engine" + i + " Cylinders Hit, "
				     + FM.EI.engines[i].getCylindersOperable()
				     + "/" + FM.EI.engines[i].getCylinders()
				     + " Left..");
			if (World.Rnd().nextFloat() < shot.power / 48000.0F) {
			    FM.AS.hitEngine(shot.initiator, 0, 2);
			    debuggunnery
				("*** Engine Cylinders Hit - Engine Fires..");
			}
		    }
		    getEnergyPastArmor(25.0F, shot);
		}
		if (string.endsWith("supc")) {
		    if (getEnergyPastArmor(0.05F, shot) > 0.0F)
			FM.EI.engines[i].setKillCompressor(shot.initiator);
		    getEnergyPastArmor(2.0F, shot);
		}
		if (string.endsWith("gear")) {
		    if (getEnergyPastArmor(0.1F, shot) > 0.0F) {
			if (Aircraft.Pd.y > 0.0
			    && Aircraft.Pd.z < 0.1889999955892563
			    && (World.Rnd().nextFloat(0.0F, 16000.0F)
				< shot.power))
			    FM.EI.engines[i].setMagnetoKnockOut(shot.initiator,
								0);
			if (Aircraft.Pd.y < 0.0
			    && Aircraft.Pd.z < 0.1889999955892563
			    && (World.Rnd().nextFloat(0.0F, 16000.0F)
				< shot.power))
			    FM.EI.engines[i].setMagnetoKnockOut(shot.initiator,
								1);
			if (World.Rnd().nextFloat(0.0F, 26700.0F) < shot.power)
			    FM.AS.setEngineSpecificDamage(shot.initiator, i,
							  4);
			if (World.Rnd().nextFloat(0.0F, 26700.0F) < shot.power)
			    FM.AS.setEngineSpecificDamage(shot.initiator, i,
							  0);
			if (World.Rnd().nextFloat(0.0F, 26700.0F) < shot.power)
			    FM.AS.setEngineSpecificDamage(shot.initiator, i,
							  6);
			if (World.Rnd().nextFloat(0.0F, 26700.0F) < shot.power)
			    FM.AS.setEngineSpecificDamage(shot.initiator, i,
							  1);
		    }
		    getEnergyPastArmor(2.0F, shot);
		}
		if (string.endsWith("oil1")
		    && getEnergyPastArmor(4.21F, shot) > 0.0F) {
		    FM.AS.hitOil(shot.initiator, i);
		    getEnergyPastArmor(0.42F, shot);
		}
	    } else if (string.startsWith("xxfuel")) {
		int i = string.charAt(6) - 48;
		int i_6_;
		switch (i) {
		default:
		    if (World.Rnd().nextFloat() < 0.1F)
			hitBone("xxfuel2", shot, point3d);
		    if (World.Rnd().nextFloat() < 0.1F)
			hitBone("xxfuel3", shot, point3d);
		    if (World.Rnd().nextFloat() < 0.1F)
			hitBone("xxfuel5", shot, point3d);
		    if (World.Rnd().nextFloat() < 0.1F)
			hitBone("xxfuel6", shot, point3d);
		    return;
		case 2:
		    i_6_ = 1;
		    break;
		case 3:
		    i_6_ = World.Rnd().nextInt(0, 1);
		    break;
		case 4:
		    i_6_ = 0;
		    break;
		case 5:
		    i_6_ = 2;
		    break;
		case 6:
		    i_6_ = World.Rnd().nextInt(2, 3);
		    break;
		case 7:
		    i_6_ = 3;
		}
		if (getEnergyPastArmor(0.8F, shot) > 0.0F
		    && World.Rnd().nextFloat() < 0.2F) {
		    if (FM.AS.astateTankStates[i_6_] == 0) {
			FM.AS.hitTank(shot.initiator, i_6_, 2);
			FM.AS.doSetTankState(shot.initiator, i_6_, 2);
		    }
		    if (World.Rnd().nextFloat() < 0.15F)
			FM.AS.hitTank(shot.initiator, i_6_, 1);
		    if (shot.powerType == 3 && World.Rnd().nextFloat() < 0.5F)
			FM.AS.hitTank(shot.initiator, i_6_, 2);
		}
	    } else if (string.startsWith("xxgun")) {
		int i = string.charAt(5) - 49;
		if (World.Rnd().nextFloat() < 0.5F)
		    FM.AS.setJamBullets(10 + i, 0);
		getEnergyPastArmor(22.7F, shot);
	    } else if (string.startsWith("xxlock")) {
		if (string.startsWith("xxlockal")) {
		    if (getEnergyPastArmor(4.35F, shot) > 0.0F) {
			debuggunnery("*** AroneL Lock Damaged..");
			nextDMGLevels(1, 2, "AroneL_D0", shot.initiator);
		    }
		} else if (string.startsWith("xxlockar")) {
		    if (getEnergyPastArmor(4.35F, shot) > 0.0F) {
			debuggunnery("*** AroneR Lock Damaged..");
			nextDMGLevels(1, 2, "AroneR_D0", shot.initiator);
		    }
		} else if (string.startsWith("xxlocksl")) {
		    if (getEnergyPastArmor(4.32F, shot) > 0.0F) {
			debuggunnery("*** VatorL Lock Damaged..");
			nextDMGLevels(1, 2, "VatorL_D0", shot.initiator);
		    }
		} else if (string.startsWith("xxlocksr")) {
		    if (getEnergyPastArmor(4.32F, shot) > 0.0F) {
			debuggunnery("*** VatorR Lock Damaged..");
			nextDMGLevels(1, 2, "VatorR_D0", shot.initiator);
		    }
		} else if (string.startsWith("xxlockk")
			   && getEnergyPastArmor(4.32F, shot) > 0.0F) {
		    debuggunnery("*** Rudder1 Lock Damaged..");
		    nextDMGLevels(1, 2, "Rudder1_D0", shot.initiator);
		}
	    } else if (string.startsWith("xxpar")) {
		if (string.startsWith("xxpark")
		    && chunkDamageVisible("Keel1") > 1
		    && getEnergyPastArmor((10.699999809265137
					   / (1.000100016593933
					      - Math.abs(Aircraft.v1.y))),
					  shot) > 0.0F) {
		    debuggunnery("*** Keel1 Spars Damaged..");
		    nextDMGLevels(1, 2, "Keel1_D2", shot.initiator);
		}
		if (string.startsWith("xxparli")
		    && chunkDamageVisible("WingLIn") > 2
		    && getEnergyPastArmor((12.800000190734863
					   / (1.000100016593933
					      - Math.abs(Aircraft.v1.y))),
					  shot) > 0.0F) {
		    debuggunnery("*** WingLIn Spars Damaged..");
		    nextDMGLevels(1, 2, "WingLIn_D3", shot.initiator);
		}
		if (string.startsWith("xxparri")
		    && chunkDamageVisible("WingRIn") > 2
		    && getEnergyPastArmor((12.800000190734863
					   / (1.000100016593933
					      - Math.abs(Aircraft.v1.y))),
					  shot) > 0.0F) {
		    debuggunnery("*** WingRIn Spars Damaged..");
		    nextDMGLevels(1, 2, "WingRIn_D3", shot.initiator);
		}
		if (string.startsWith("xxparlm")
		    && chunkDamageVisible("WingLMid") > 2
		    && getEnergyPastArmor((10.800000190734863
					   / (1.000100016593933
					      - Math.abs(Aircraft.v1.y))),
					  shot) > 0.0F) {
		    debuggunnery("*** WingLMid Spars Damaged..");
		    nextDMGLevels(1, 2, "WingLMid_D3", shot.initiator);
		}
		if (string.startsWith("xxparrm")
		    && chunkDamageVisible("WingRMid") > 2
		    && getEnergyPastArmor((10.800000190734863
					   / (1.000100016593933
					      - Math.abs(Aircraft.v1.y))),
					  shot) > 0.0F) {
		    debuggunnery("*** WingRMid Spars Damaged..");
		    nextDMGLevels(1, 2, "WingRMid_D3", shot.initiator);
		}
		if (string.startsWith("xxparlo")
		    && chunkDamageVisible("WingLOut") > 2
		    && getEnergyPastArmor((8.800000190734863
					   / (1.000100016593933
					      - Math.abs(Aircraft.v1.y))),
					  shot) > 0.0F) {
		    debuggunnery("*** WingLOut Spars Damaged..");
		    nextDMGLevels(1, 2, "WingLOut_D3", shot.initiator);
		}
		if (string.startsWith("xxparro")
		    && chunkDamageVisible("WingROut") > 2
		    && getEnergyPastArmor((8.800000190734863
					   / (1.000100016593933
					      - Math.abs(Aircraft.v1.y))),
					  shot) > 0.0F) {
		    debuggunnery("*** WingROut Spars Damaged..");
		    nextDMGLevels(1, 2, "WingROut_D3", shot.initiator);
		}
		if (string.startsWith("xxparrs")
		    && chunkDamageVisible("StabL") > 1
		    && getEnergyPastArmor((8.800000190734863
					   / (1.000100016593933
					      - Math.abs(Aircraft.v1.y))),
					  shot) > 0.0F) {
		    debuggunnery("*** StabL Spars Damaged..");
		    nextDMGLevels(1, 2, "StabL_D2", shot.initiator);
		}
		if (string.startsWith("xxparls")
		    && chunkDamageVisible("StabR") > 1
		    && getEnergyPastArmor((8.800000190734863
					   / (1.000100016593933
					      - Math.abs(Aircraft.v1.y))),
					  shot) > 0.0F) {
		    debuggunnery("*** StabR Spars Damaged..");
		    nextDMGLevels(1, 2, "StabR_D2", shot.initiator);
		}
	    }
	} else if (string.startsWith("xcf")) {
	    if (chunkDamageVisible("CF") < 3)
		hitChunk("CF", shot);
	} else if (string.startsWith("xtail")) {
	    if (chunkDamageVisible("Tail1") < 3)
		hitChunk("Tail1", shot);
	} else if (string.startsWith("xkeel")) {
	    if (chunkDamageVisible("Keel1") < 2)
		hitChunk("Keel1", shot);
	} else if (string.startsWith("xrudder")) {
	    if (chunkDamageVisible("Rudder1") < 2)
		hitChunk("Rudder1", shot);
	} else if (string.startsWith("xstabl")) {
	    if (chunkDamageVisible("StabL") < 2)
		hitChunk("StabL", shot);
	} else if (string.startsWith("xstabr")) {
	    if (chunkDamageVisible("StabR") < 2)
		hitChunk("StabR", shot);
	} else if (string.startsWith("xvatorl")) {
	    if (chunkDamageVisible("VatorL") < 2)
		hitChunk("VatorL", shot);
	} else if (string.startsWith("xvatorr")) {
	    if (chunkDamageVisible("VatorR") < 2)
		hitChunk("VatorR", shot);
	} else if (string.startsWith("xwinglin")) {
	    if (chunkDamageVisible("WingLIn") < 3)
		hitChunk("WingLIn", shot);
	} else if (string.startsWith("xwingrin")) {
	    if (chunkDamageVisible("WingRIn") < 3)
		hitChunk("WingRIn", shot);
	} else if (string.startsWith("xwinglmid")) {
	    if (chunkDamageVisible("WingLMid") < 3)
		hitChunk("WingLMid", shot);
	} else if (string.startsWith("xwingrmid")) {
	    if (chunkDamageVisible("WingRMid") < 3)
		hitChunk("WingRMid", shot);
	} else if (string.startsWith("xwinglout")) {
	    if (chunkDamageVisible("WingLOut") < 3)
		hitChunk("WingLOut", shot);
	} else if (string.startsWith("xwingrout")) {
	    if (chunkDamageVisible("WingROut") < 3)
		hitChunk("WingROut", shot);
	} else if (string.startsWith("xaronel")) {
	    if (chunkDamageVisible("AroneL") < 2)
		hitChunk("AroneL", shot);
	} else if (string.startsWith("xaroner")) {
	    if (chunkDamageVisible("AroneR") < 2)
		hitChunk("AroneR", shot);
	} else if (string.startsWith("xengine1")) {
	    if (chunkDamageVisible("Engine1") < 2)
		hitChunk("Engine1", shot);
	} else if (string.startsWith("xengine2")) {
	    if (chunkDamageVisible("Engine2") < 2)
		hitChunk("Engine2", shot);
	} else if (string.startsWith("xgear")) {
	    if (string.endsWith("1") && World.Rnd().nextFloat() < 0.05F) {
		debuggunnery("Hydro System: Disabled..");
		FM.AS.setInternalDamage(shot.initiator, 0);
	    }
	    if (string.endsWith("2") && World.Rnd().nextFloat() < 0.1F
		&& getEnergyPastArmor(World.Rnd().nextFloat(12.88F, 16.96F),
				      shot) > 0.0F) {
		debuggunnery("Undercarriage: Stuck..");
		FM.AS.setInternalDamage(shot.initiator, 3);
	    }
	} else if (string.startsWith("xpilot") || string.startsWith("xhead")) {
	    int i = 0;
	    int i_7_;
	    if (string.endsWith("a") || string.endsWith("a2")) {
		i = 1;
		i_7_ = string.charAt(6) - 49;
	    } else if (string.endsWith("b") || string.endsWith("b2")) {
		i = 2;
		i_7_ = string.charAt(6) - 49;
	    } else
		i_7_ = string.charAt(5) - 49;
	    hitFlesh(i_7_, shot, i);
	}
    }
    
    public void doWoundPilot(int i, float f) {
	switch (i) {
	case 2:
	    FM.turret[0].setHealth(f);
	    break;
	case 3:
	    FM.turret[2].setHealth(f);
	    break;
	case 4:
	    FM.turret[4].setHealth(f);
	    break;
	case 5:
	    FM.turret[3].setHealth(f);
	    break;
	case 6:
	    FM.turret[1].setHealth(f);
	    break;
	}
    }
    
    public void doMurderPilot(int i) {
	hierMesh().chunkVisible("Pilot" + (i + 1) + "_D0", false);
	hierMesh().chunkVisible("Head" + (i + 1) + "_D0", false);
	hierMesh().chunkVisible("Pilot" + (i + 1) + "_D1", true);
    }
    
    public boolean typeBomberToggleAutomation() {
	bSightAutomation = !bSightAutomation;
	bSightBombDump = false;
	HUD.log(AircraftHotKeys.hudLogWeaponId,
		"BombsightAutomation" + (bSightAutomation ? "ON" : "OFF"));
	return bSightAutomation;
    }
    
    public void typeBomberAdjDistanceReset() {
	fSightCurDistance = 0.0F;
	fSightCurForwardAngle = 0.0F;
    }
    
    public void typeBomberAdjDistancePlus() {
	fSightCurForwardAngle++;
	if (fSightCurForwardAngle > 85.0F)
	    fSightCurForwardAngle = 85.0F;
	fSightCurDistance
	    = (fSightCurAltitude
	       * (float) (Math.tan
			  (Math.toRadians((double) fSightCurForwardAngle))));
	HUD.log(AircraftHotKeys.hudLogWeaponId, "BombsightElevation",
		new Object[] { new Integer((int) fSightCurForwardAngle) });
	if (bSightAutomation)
	    typeBomberToggleAutomation();
    }
    
    public void typeBomberAdjDistanceMinus() {
	fSightCurForwardAngle--;
	if (fSightCurForwardAngle < 0.0F)
	    fSightCurForwardAngle = 0.0F;
	fSightCurDistance
	    = (fSightCurAltitude
	       * (float) (Math.tan
			  (Math.toRadians((double) fSightCurForwardAngle))));
	HUD.log(AircraftHotKeys.hudLogWeaponId, "BombsightElevation",
		new Object[] { new Integer((int) fSightCurForwardAngle) });
	if (bSightAutomation)
	    typeBomberToggleAutomation();
    }
    
    public void typeBomberAdjSideslipReset() {
	fSightCurSideslip = 0.0F;
    }
    
    public void typeBomberAdjSideslipPlus() {
	fSightCurSideslip += 0.05F;
	if (fSightCurSideslip > 3.0F)
	    fSightCurSideslip = 3.0F;
	HUD.log(AircraftHotKeys.hudLogWeaponId, "BombsightSlip",
		new Object[] { new Float(fSightCurSideslip * 10.0F) });
    }
    
    public void typeBomberAdjSideslipMinus() {
	fSightCurSideslip -= 0.05F;
	if (fSightCurSideslip < -3.0F)
	    fSightCurSideslip = -3.0F;
	HUD.log(AircraftHotKeys.hudLogWeaponId, "BombsightSlip",
		new Object[] { new Float(fSightCurSideslip * 10.0F) });
    }
    
    public void typeBomberAdjAltitudeReset() {
	fSightCurAltitude = 850.0F;
    }
    
    public void typeBomberAdjAltitudePlus() {
	fSightCurAltitude += 10.0F;
	if (fSightCurAltitude > 10000.0F)
	    fSightCurAltitude = 10000.0F;
	HUD.log(AircraftHotKeys.hudLogWeaponId, "BombsightAltitude",
		new Object[] { new Integer((int) fSightCurAltitude) });
	fSightCurDistance
	    = (fSightCurAltitude
	       * (float) (Math.tan
			  (Math.toRadians((double) fSightCurForwardAngle))));
    }
    
    public void typeBomberAdjAltitudeMinus() {
	fSightCurAltitude -= 10.0F;
	if (fSightCurAltitude < 850.0F)
	    fSightCurAltitude = 850.0F;
	HUD.log(AircraftHotKeys.hudLogWeaponId, "BombsightAltitude",
		new Object[] { new Integer((int) fSightCurAltitude) });
	fSightCurDistance
	    = (fSightCurAltitude
	       * (float) (Math.tan
			  (Math.toRadians((double) fSightCurForwardAngle))));
    }
    
    public void typeBomberAdjSpeedReset() {
	fSightCurSpeed = 150.0F;
    }
    
    public void typeBomberAdjSpeedPlus() {
	fSightCurSpeed += 10.0F;
	if (fSightCurSpeed > 600.0F)
	    fSightCurSpeed = 600.0F;
	HUD.log(AircraftHotKeys.hudLogWeaponId, "BombsightSpeed",
		new Object[] { new Integer((int) fSightCurSpeed) });
    }
    
    public void typeBomberAdjSpeedMinus() {
	fSightCurSpeed -= 10.0F;
	if (fSightCurSpeed < 150.0F)
	    fSightCurSpeed = 150.0F;
	HUD.log(AircraftHotKeys.hudLogWeaponId, "BombsightSpeed",
		new Object[] { new Integer((int) fSightCurSpeed) });
    }
    
    public void typeBomberUpdate(float f) {
	if ((double) Math.abs(FM.Or.getKren()) > 4.5) {
	    fSightCurReadyness -= 0.0666666F * f;
	    if (fSightCurReadyness < 0.0F)
		fSightCurReadyness = 0.0F;
	}
	if (fSightCurReadyness < 1.0F)
	    fSightCurReadyness += 0.0333333F * f;
	else if (bSightAutomation) {
	    fSightCurDistance -= fSightCurSpeed / 3.6F * f;
	    if (fSightCurDistance < 0.0F) {
		fSightCurDistance = 0.0F;
		typeBomberToggleAutomation();
	    }
	    fSightCurForwardAngle
		= (float) (Math.toDegrees
			   (Math.atan((double) (fSightCurDistance
						/ fSightCurAltitude))));
	    if ((double) fSightCurDistance
		< ((double) (fSightCurSpeed / 3.6F)
		   * Math.sqrt((double) (fSightCurAltitude * 0.2038736F))))
		bSightBombDump = true;
	    if (bSightBombDump) {
		if (FM.isTick(3, 0)) {
		    if (FM.CT.Weapons[3] != null
			&& (FM.CT.Weapons[3][FM.CT.Weapons[3].length - 1]
			    != null)
			&& FM.CT.Weapons[3][FM.CT.Weapons[3].length - 1]
			       .haveBullets()) {
			FM.CT.WeaponControl[3] = true;
			HUD.log(AircraftHotKeys.hudLogWeaponId,
				"BombsightBombdrop");
		    }
		} else
		    FM.CT.WeaponControl[3] = false;
	    }
	}
    }
    
    public void typeBomberReplicateToNet(NetMsgGuaranted netmsgguaranted)
	throws IOException {
	netmsgguaranted.writeByte((bSightAutomation ? 1 : 0) | (bSightBombDump
								? 2 : 0));
	netmsgguaranted.writeFloat(fSightCurDistance);
	netmsgguaranted.writeByte((int) fSightCurForwardAngle);
	netmsgguaranted.writeByte((int) ((fSightCurSideslip + 3.0F)
					 * 33.33333F));
	netmsgguaranted.writeFloat(fSightCurAltitude);
	netmsgguaranted.writeByte((int) (fSightCurSpeed / 2.5F));
	netmsgguaranted.writeByte((int) (fSightCurReadyness * 200.0F));
    }
    
    public void typeBomberReplicateFromNet(NetMsgInput netmsginput)
	throws IOException {
	int i = netmsginput.readUnsignedByte();
	bSightAutomation = (i & 0x1) != 0;
	bSightBombDump = (i & 0x2) != 0;
	fSightCurDistance = netmsginput.readFloat();
	fSightCurForwardAngle = (float) netmsginput.readUnsignedByte();
	fSightCurSideslip
	    = -3.0F + (float) netmsginput.readUnsignedByte() / 33.33333F;
	fSightCurAltitude = netmsginput.readFloat();
	fSightCurSpeed = (float) netmsginput.readUnsignedByte() * 2.5F;
	fSightCurReadyness = (float) netmsginput.readUnsignedByte() / 200.0F;
    }
    
    protected void moveBayDoor(float f) {
	hierMesh().chunkSetAngles("Bay01_D0", 0.0F, -90.0F * f, 0.0F);
	hierMesh().chunkSetAngles("Bay02_D0", 0.0F, -90.0F * f, 0.0F);
    }
    
    /*synthetic*/ static Class class$(String string) {
	try {
	    return Class.forName(string);
	} catch (ClassNotFoundException classnotfoundexception) {
	    throw new NoClassDefFoundError(classnotfoundexception
					       .getMessage());
	}
    }
    
    static {
	Class var_class = (class$com$maddox$il2$objects$air$KI_67 == null
			   ? (class$com$maddox$il2$objects$air$KI_67
			      = class$("com.maddox.il2.objects.air.KI_67"))
			   : class$com$maddox$il2$objects$air$KI_67);
	Property.set(var_class, "originCountry", PaintScheme.countryJapan);
    }
}
