КОД Ил-2

Сообщение Karabas-Barabas » 22 дек 2011, 21:56

private void computeTemperature(float f) {
float f_41_ = Pitot.Indicator((float) reference.Loc.z,
reference.getSpeedKMH());
float f_42_
= Atmosphere.temperature((float) reference.Loc.z) - 273.15F;
if (stage == 6) {
float f_43_
= ((1.05F
* (float) (Math.sqrt
(Math.sqrt
((double) (getPowerOutput() > 0.2F
? (getPowerOutput()
+ (float) (reference.AS
.astateOilStates
[number]) * 0.33F)
: 0.2F))))
* (float) Math.sqrt(w / wMax > 0.75F ? (double) (w / wMax)
: 0.75)
* tOilOutMaxRPM * (1.0F - 0.11F * controlRadiator)
* (1.0F - f_41_ * 2.0E-4F))
+ 22.0F);
if (getPowerOutput() > 1.0F)
f_43_ *= getPowerOutput();
tOilOut += (f_43_ - tOilOut) * f * tChangeSpeed;
} else {
float f_44_
= (w / wMax * tOilOutMaxRPM * (1.0F - 0.2F * controlRadiator)
+ f_42_);
Motor motor_45_ = this;
motor_45_.tOilOut
= motor_45_.tOilOut + ((f_44_ - tOilOut) * f * tChangeSpeed
* (type == 0 ? 0.42F : 1.07F));
}
float f_46_ = 0.8F - 0.05F * controlRadiator;
float f_47_ = (tOilOut * (f_46_ - f_41_ * 5.0E-4F)
+ f_42_ * (1.0F - f_46_ + f_41_ * 5.0E-4F));
tOilIn += (f_47_ - tOilIn) * f * tChangeSpeed * 0.5F;
f_47_ = (1.05F * (float) Math.sqrt((double) getPowerOutput())
* (1.0F - f_41_ * 2.0E-4F) * tWaterMaxRPM
* (controlAfterburner ? 1.1F : 1.0F)) + f_42_;
Motor motor_48_ = this;
motor_48_.tWaterOut
= motor_48_.tWaterOut + ((f_47_ - tWaterOut) * f * tChangeSpeed
* (tWaterOut < 50.0F ? 0.4F : 1.0F)
* (1.0F - f_41_ * 6.0E-4F));
if (tOilOut < f_42_)
tOilOut = f_42_;
if (tOilIn < f_42_)
tOilIn = f_42_;
if (tWaterOut < f_42_)
tWaterOut = f_42_;
if (World.cur().diffCur.Engine_Overheat
&& (tWaterOut > tWaterCritMax || tOilOut > tOilCritMax)) {
if (heatStringID == -1)
heatStringID = HUD.makeIdLog();
if (reference.isPlayers())
HUD.log(heatStringID, "EngineOverheat");
timeCounter += f;
if (timeCounter > timeOverheat) {
if (readyness > 0.32F) {
setReadyness(readyness - 0.00666F * f);
tOilCritMax
-= 0.00666F * f * (tOilCritMax - tOilOutMaxRPM);
} else
setEngineDies(reference.actor);
}
} else if (timeCounter > 0.0F) {
timeCounter = 0.0F;
if (heatStringID == -1)
heatStringID = HUD.makeIdLog();
if (reference.isPlayers())
HUD.log(heatStringID, "EngineRestored");
}
}

public void updateRadiator(float f) {
if (reference.actor instanceof GLADIATOR)
controlRadiator = 0.0F;
else if (reference.actor instanceof P_51
|| reference.actor instanceof P_38
|| reference.actor instanceof YAK_3
|| reference.actor instanceof YAK_3P
|| reference.actor instanceof YAK_9M
|| reference.actor instanceof YAK_9U
|| reference.actor instanceof YAK_9UT
|| reference.actor instanceof P_63C) {
if (tOilOut > tOilOutMaxRPM) {
controlRadiator += 0.1F * f;
if (controlRadiator > 1.0F)
controlRadiator = 1.0F;
} else {
controlRadiator
= 1.0F - reference.getSpeed() / reference.VmaxH;
if (controlRadiator < 0.0F)
controlRadiator = 0.0F;
}
} else if (reference.actor instanceof SPITFIRE9
|| reference.actor instanceof SPITFIRE8
|| reference.actor instanceof SPITFIRE8CLP) {
float f_49_ = 0.0F;
if (tOilOut > tOilCritMin) {
float f_50_ = tOilCritMax - tOilCritMin;
f_49_ = 1.4F * (tOilOut - tOilCritMin) / f_50_;
if (f_49_ > 1.4F)
f_49_ = 1.4F;
}
float f_51_ = 0.0F;
if (tWaterOut > tWaterCritMin) {
float f_52_ = tWaterCritMax - tWaterCritMin;
f_51_ = 1.4F * (tWaterOut - tWaterCritMin) / f_52_;
if (f_51_ > 1.4F)
f_51_ = 1.4F;
}
float f_53_ = Math.max(f_49_, f_51_);
float f_54_ = 1.0F;
float f_55_ = reference.getSpeed();
if (f_55_ > reference.Vmin * 1.5F) {
float f_56_ = reference.Vmax - reference.Vmin * 1.5F;
f_54_ = 1.0F - 1.65F * (f_55_ - reference.Vmin * 1.5F) / f_56_;
if (f_54_ < -1.0F)
f_54_ = -1.0F;
}
controlRadiator = 0.5F * (f_53_ + f_54_);
if (tWaterOut > tWaterCritMax || tOilOut > tOilCritMax)
controlRadiator += 0.05F * timeCounter;
if (controlRadiator < 0.0F)
controlRadiator = 0.0F;
if (controlRadiator > 1.0F)
controlRadiator = 1.0F;
} else if (reference.actor instanceof GLADIATOR)
controlRadiator = 0.0F;
else {
switch (propAngleDeviceType) {
default:
controlRadiator = 1.0F - getPowerOutput();
break;
case 5:
case 6:
controlRadiator
= 1.0F - reference.getSpeed() / reference.VmaxH;
if (controlRadiator < 0.0F)
controlRadiator = 0.0F;
break;
case 1:
case 2:
if (controlRadiator > 1.0F - getPowerOutput()) {
controlRadiator -= 0.15F * f;
if (controlRadiator < 0.0F)
controlRadiator = 0.0F;
} else
controlRadiator += 0.15F * f;
break;
case 8:
if (type == 0) {
if (tOilOut > tOilOutMaxRPM) {
controlRadiator += 0.1F * f;
if (controlRadiator > 1.0F)
controlRadiator = 1.0F;
} else if (tOilOut < tOilOutMaxRPM - 10.0F) {
controlRadiator -= 0.1F * f;
if (controlRadiator < 0.0F)
controlRadiator = 0.0F;
}
} else if (controlRadiator > 1.0F - getPowerOutput()) {
controlRadiator -= 0.15F * f;
if (controlRadiator < 0.0F)
controlRadiator = 0.0F;
} else
controlRadiator += 0.15F * f;
break;
case 7:
if (tOilOut > tOilOutMaxRPM) {
controlRadiator += 0.1F * f;
if (controlRadiator > 1.0F)
controlRadiator = 1.0F;
} else {
controlRadiator
= 1.0F - reference.getSpeed() / reference.VmaxH;
if (controlRadiator < 0.0F)
controlRadiator = 0.0F;
}
}
}
}

private void computeForces(float f) {
switch (type) {
case 0:
case 1:
case 7: {
if (Math.abs(w) < 1.0E-5F)
propPhiW = 1.5707964F;
else if (type == 7)
propPhiW
= (float) Math.atan(Math.abs(reference.Vflow.x)
/ (double) (w * propReductor * propr));
else
propPhiW
= (float) Math.atan(reference.Vflow.x
/ (double) (w * propReductor * propr));
propAoA = propPhi - propPhiW;
if (type == 7)
computePropForces(w * propReductor,
(float) Math.abs(reference.Vflow.x), propPhi,
propAoA, reference.getAltitude());
else
computePropForces(w * propReductor, (float) reference.Vflow.x,
propPhi, propAoA, reference.getAltitude());
switch (propAngleDeviceType) {
case 0:
break;
case 3:
case 4: {
float f_57_ = controlThrottle;
if (f_57_ > 1.0F)
f_57_ = 1.0F;
compressorManifoldThreshold
= 0.5F + (compressorRPMtoWMaxATA - 0.5F) * f_57_;
if (isPropAngleDeviceOperational()) {
if (bControlPropAuto)
propTarget = propPhiW + propAoA0;
else
propTarget = propPhiMax - controlProp * (propPhiMax
- propPhiMin);
} else if (propAngleDeviceType == 3)
propTarget = 0.0F;
else
propTarget = 3.1415927F;
break;
}
case 9:
if (bControlPropAuto) {
float f_58_ = propAngleDeviceMaxParam;
if (controlAfterburner)
f_58_ = propAngleDeviceAfterburnerParam;
controlProp += (float) controlPropDirection * f / 5.0F;
if (controlProp > 1.0F)
controlProp = 1.0F;
else if (controlProp < 0.0F)
controlProp = 0.0F;
float f_59_
= (propAngleDeviceMinParam
+ (f_58_ - propAngleDeviceMinParam) * controlProp);
float f_60_ = controlThrottle;
if (f_60_ > 1.0F)
f_60_ = 1.0F;
compressorManifoldThreshold
= getATA(toRPM(propAngleDeviceMinParam
+ (propAngleDeviceMaxParam
- propAngleDeviceMinParam) * f_60_));
if (isPropAngleDeviceOperational()) {
if (w < f_59_) {
f_59_
= Math.min(1.0F,
0.01F * (f_59_ - w) - 0.012F * aw);
propTarget
-= f_59_ * getPropAngleDeviceSpeed() * f;
} else {
f_59_
= Math.min(1.0F,
0.01F * (w - f_59_) + 0.012F * aw);
propTarget
+= f_59_ * getPropAngleDeviceSpeed() * f;
}
if (stage == 6 && propTarget < propPhiW - 0.12F) {
propTarget = propPhiW - 0.12F;
if (propPhi < propTarget)
propPhi += 0.2F * f;
}
} else
propTarget = propPhi;
} else {
compressorManifoldThreshold
= 0.5F + ((compressorRPMtoWMaxATA - 0.5F)
* (controlThrottle > 1.0F ? 1.0F
: controlThrottle));
propTarget = propPhi;
if (isPropAngleDeviceOperational()) {
if (controlPropDirection > 0)
propTarget = propPhiMin;
else if (controlPropDirection < 0)
propTarget = propPhiMax;
}
}
break;
case 1:
case 2: {
if (bControlPropAuto) {
if (engineBoostFactor > 1.0F)
controlProp = 0.75F + 0.227272F * controlThrottle;
else
controlProp = 0.75F + 0.25F * controlThrottle;
}
float f_61_ = propAngleDeviceMaxParam;
if (controlAfterburner
&& (!bWepRpmInLowGear
|| controlCompressor != compressorMaxStep))
f_61_ = propAngleDeviceAfterburnerParam;
float f_62_
= (propAngleDeviceMinParam
+ (f_61_ - propAngleDeviceMinParam) * controlProp);
float f_63_ = controlThrottle;
if (f_63_ > 1.0F)
f_63_ = 1.0F;
compressorManifoldThreshold
= getATA(toRPM(propAngleDeviceMinParam
+ (propAngleDeviceMaxParam
- propAngleDeviceMinParam) * f_63_));
if (isPropAngleDeviceOperational()) {
if (w < f_62_) {
f_62_ = Math.min(1.0F,
0.01F * (f_62_ - w) - 0.012F * aw);
propTarget -= f_62_ * getPropAngleDeviceSpeed() * f;
} else {
f_62_ = Math.min(1.0F,
0.01F * (w - f_62_) + 0.012F * aw);
propTarget += f_62_ * getPropAngleDeviceSpeed() * f;
}
if (stage == 6 && propTarget < propPhiW - 0.12F) {
propTarget = propPhiW - 0.12F;
if (propPhi < propTarget)
propPhi += 0.2F * f;
}
} else if (propAngleDeviceType == 1)
propTarget = 0.0F;
else
propTarget = 1.5708F;
break;
}
case 7: {
float f_64_ = controlThrottle;
if (engineBoostFactor > 1.0F)
f_64_ = 0.90909094F * controlThrottle;
float f_65_ = propAngleDeviceMaxParam;
if (controlAfterburner) {
if (afterburnerType == 1) {
if (controlThrottle > 1.0F)
f_65_ = (propAngleDeviceMaxParam
+ (10.0F * (controlThrottle - 1.0F)
* (propAngleDeviceAfterburnerParam
- propAngleDeviceMaxParam)));
} else
f_65_ = propAngleDeviceAfterburnerParam;
}
float f_66_ = (propAngleDeviceMinParam
+ (f_65_ - propAngleDeviceMinParam) * f_64_);
float f_67_ = controlThrottle;
if (f_67_ > 1.0F)
f_67_ = 1.0F;
compressorManifoldThreshold
= getATA(toRPM(propAngleDeviceMinParam
+ ((f_65_ - propAngleDeviceMinParam)
* f_67_)));
if (isPropAngleDeviceOperational()) {
if (bControlPropAuto) {
if (w < f_66_) {
f_66_
= Math.min(1.0F,
0.01F * (f_66_ - w) - 0.012F * aw);
propTarget
-= f_66_ * getPropAngleDeviceSpeed() * f;
} else {
f_66_
= Math.min(1.0F,
0.01F * (w - f_66_) + 0.012F * aw);
propTarget
+= f_66_ * getPropAngleDeviceSpeed() * f;
}
if (stage == 6 && propTarget < propPhiW - 0.12F) {
propTarget = propPhiW - 0.12F;
if (propPhi < propTarget)
propPhi += 0.2F * f;
}
if (propTarget
< propPhiMin + (float) Math.toRadians(3.0))
propTarget
= propPhiMin + (float) Math.toRadians(3.0);
} else {
propTarget
= ((1.0F - f * 0.1F) * propTarget
+ f * 0.1F * (propPhiMax
- controlProp * (propPhiMax
- propPhiMin)));
if (w > 1.02F * wMax)
wMaxAllowed
= ((1.0F - 4.0E-7F * (w - 1.02F * wMax))
* wMaxAllowed);
if (w > wMax) {
float f_68_ = w - wMax;
f_68_ *= f_68_;
float f_69_ = 1.0F - 0.001F * f_68_;
if (f_69_ < 0.0F)
f_69_ = 0.0F;
propForce *= f_69_;
}
}
}
break;
}
case 8: {
float f_70_ = controlThrottle;
if (engineBoostFactor > 1.0F)
f_70_ = 0.90909094F * controlThrottle;
float f_71_ = propAngleDeviceMaxParam;
if (controlAfterburner) {
if (afterburnerType == 1) {
if (controlThrottle > 1.0F)
f_71_ = (propAngleDeviceMaxParam
+ (10.0F * (controlThrottle - 1.0F)
* (propAngleDeviceAfterburnerParam
- propAngleDeviceMaxParam)));
} else
f_71_ = propAngleDeviceAfterburnerParam;
}
float f_72_ = (propAngleDeviceMinParam
+ (f_71_ - propAngleDeviceMinParam) * f_70_
+ (bControlPropAuto ? 0.0F
: -25.0F + 50.0F * controlProp));
float f_73_ = controlThrottle;
if (f_73_ > 1.0F)
f_73_ = 1.0F;
compressorManifoldThreshold
= getATA(toRPM(propAngleDeviceMinParam
+ ((f_71_ - propAngleDeviceMinParam)
* f_73_)));
if (isPropAngleDeviceOperational()) {
if (w < f_72_) {
f_72_ = Math.min(1.0F,
0.01F * (f_72_ - w) - 0.012F * aw);
propTarget -= f_72_ * getPropAngleDeviceSpeed() * f;
} else {
f_72_ = Math.min(1.0F,
0.01F * (w - f_72_) + 0.012F * aw);
propTarget += f_72_ * getPropAngleDeviceSpeed() * f;
}
if (stage == 6 && propTarget < propPhiW - 0.12F) {
propTarget = propPhiW - 0.12F;
if (propPhi < propTarget)
propPhi += 0.2F * f;
}
if (propTarget < propPhiMin + (float) Math.toRadians(3.0))
propTarget = propPhiMin + (float) Math.toRadians(3.0);
}
break;
}
case 6: {
float f_74_ = controlThrottle;
if (f_74_ > 1.0F)
f_74_ = 1.0F;
compressorManifoldThreshold
= 0.5F + (compressorRPMtoWMaxATA - 0.5F) * f_74_;
if (isPropAngleDeviceOperational()) {
if (bControlPropAuto) {
float f_75_
= (25.0F
+ (wMax - 25.0F) * (0.25F
+ 0.75F * controlThrottle));
if (w < f_75_) {
f_75_
= Math.min(1.0F,
0.01F * (f_75_ - w) - 0.012F * aw);
propTarget
-= f_75_ * getPropAngleDeviceSpeed() * f;
} else {
f_75_
= Math.min(1.0F,
0.01F * (w - f_75_) + 0.012F * aw);
propTarget
+= f_75_ * getPropAngleDeviceSpeed() * f;
}
if (stage == 6 && propTarget < propPhiW - 0.12F) {
propTarget = propPhiW - 0.12F;
if (propPhi < propTarget)
propPhi += 0.2F * f;
}
controlProp = ((propAngleDeviceMaxParam - propTarget)
/ (propAngleDeviceMaxParam
- propAngleDeviceMinParam));
if (controlProp < 0.0F)
controlProp = 0.0F;
if (controlProp > 1.0F)
controlProp = 1.0F;
} else
propTarget
= (propAngleDeviceMaxParam
- controlProp * (propAngleDeviceMaxParam
- propAngleDeviceMinParam));
}
break;
}
case 5: {
float f_76_ = controlThrottle;
if (f_76_ > 1.0F)
f_76_ = 1.0F;
compressorManifoldThreshold
= 0.5F + (compressorRPMtoWMaxATA - 0.5F) * f_76_;
if (bControlPropAuto) {
if (reference.isPlayers()
&& reference instanceof RealFlightModel
&& ((RealFlightModel) reference).isRealMode()) {
if (World.cur().diffCur.ComplexEManagement)
controlProp = -controlThrottle;
else
controlProp
= -Aircraft.cvt(reference.getSpeed(),
reference.Vmin, reference.Vmax,
0.0F, 1.0F);
} else
controlProp
= -Aircraft.cvt(reference.getSpeed(),
reference.Vmin, reference.Vmax,
0.0F, 1.0F);
}
propTarget = (propAngleDeviceMaxParam
- controlProp * (propAngleDeviceMaxParam
- propAngleDeviceMinParam));
propPhi = propTarget;
break;
}
}
if (controlFeather == 1 && bHasFeatherControl
&& isPropAngleDeviceOperational())
propTarget = 1.55F;
if (propPhi > propTarget) {
float f_77_
= Math.min(1.0F, 157.29578F * (propPhi - propTarget));
propPhi -= f_77_ * getPropAngleDeviceSpeed() * f;
} else if (propPhi < propTarget) {
float f_78_
= Math.min(1.0F, 157.29578F * (propTarget - propPhi));
propPhi += f_78_ * getPropAngleDeviceSpeed() * f;
}
if (propTarget > propPhiMax)
propTarget = propPhiMax;
else if (propTarget < propPhiMin)
propTarget = propPhiMin;
if (propPhi > propPhiMax && controlFeather == 0)
propPhi = propPhiMax;
else if (propPhi < propPhiMin)
propPhi = propPhiMin;
engineMoment = getN();
float f_79_ = getCompressorMultiplier(f);
engineMoment *= f_79_;
momForFuel = (double) engineMoment;
engineMoment *= getReadyness();
engineMoment *= getMagnetoMultiplier();
engineMoment *= getMixMultiplier();
engineMoment *= getStageMultiplier();
engineMoment *= getDistabilisationMultiplier();
engineMoment += getFrictionMoment(f);
float f_80_ = engineMoment - propMoment;
aw = f_80_ / (propI + engineI);
if (aw > 0.0F)
aw *= engineAcceleration;
oldW = w;
w += aw * f;
if (w < 0.0F)
w = 0.0F;
if (w > wMaxAllowed + wMaxAllowed)
w = wMaxAllowed + wMaxAllowed;
if (oldW == 0.0F) {
if (w < 10.0F * fricCoeffT)
w = 0.0F;
} else if (w < 2.0F * fricCoeffT)
w = 0.0F;
if (reference.isPlayers()
&& World.cur().diffCur.Torque_N_Gyro_Effects
&& reference instanceof RealFlightModel
&& ((RealFlightModel) reference).isRealMode()) {
propIW.set((double) (propI * w * propReductor), 0.0, 0.0);
if (propDirection == 1)
propIW.x = -propIW.x;
engineTorque.set(0.0F, 0.0F, 0.0F);
float f_81_ = propI * aw * propReductor;
if (propDirection == 0) {
engineTorque.x += propMoment;
engineTorque.x += f_81_;
} else {
engineTorque.x -= propMoment;
engineTorque.x -= f_81_;
}
} else
engineTorque.set(0.0F, 0.0F, 0.0F);
engineForce.set(engineVector);
engineForce.scale(propForce);
tmpV3f.cross(propPos, engineForce);
engineTorque.add(tmpV3f);
rearRush = 0.0F;
rpm = toRPM(w);
double d = reference.Vflow.x + addVflow;
if (d < 1.0)
d = 1.0;
double d_82_
= 1.0 / ((double) (Atmosphere.density(reference.getAltitude())
* 6.0F)
* d);
addVflow = 0.95 * addVflow + 0.05 * (double) propForce * d_82_;
addVside = (0.95 * addVside
+ 0.05 * (double) (propMoment / propr) * d_82_);
if (addVside < 0.0)
addVside = 0.0;
break;
}
case 2: {
float f_83_ = pressureExtBar;
engineMoment
= (propAngleDeviceMinParam
+ getControlThrottle() * (propAngleDeviceMaxParam
- propAngleDeviceMinParam));
engineMoment /= propAngleDeviceMaxParam;
engineMoment *= engineMomentMax;
engineMoment *= getReadyness();
engineMoment *= getDistabilisationMultiplier();
engineMoment *= getStageMultiplier();
engineMoment += getJetFrictionMoment(f);
computePropForces(w, 0.0F, 0.0F, propAoA0, 0.0F);
float f_84_ = w * _1_wMax;
float f_85_ = f_84_ * pressureExtBar;
float f_86_ = f_84_ * f_84_;
float f_87_
= (1.0F
- 0.006F * (Atmosphere.temperature((float) reference.Loc.z)
- 290.0F));
float f_88_ = 1.0F - 0.0011F * reference.getSpeed();
propForce = (thrustMax * f_85_ * f_86_ * f_87_ * f_88_
* getStageMultiplier());
float f_89_ = engineMoment - propMoment;
aw = f_89_ / (propI + engineI) * 1.0F;
if (aw > 0.0F)
aw *= engineAcceleration;
w += aw * f;
if (w < -wMaxAllowed)
w = -wMaxAllowed;
if (w > wMaxAllowed + wMaxAllowed)
w = wMaxAllowed + wMaxAllowed;
engineForce.set(engineVector);
engineForce.scale(propForce);
engineTorque.cross(enginePos, engineForce);
rpm = toRPM(w);
break;
}
case 3:
case 4: {
w = wMin + (wMax - wMin) * controlThrottle;
if (w < wMin || w < 0.0F || reference.M.fuel == 0.0F || stage != 6)
w = 0.0F;
propForce = w / wMax * thrustMax;
propForce *= getStageMultiplier();
float f_90_ = (float) reference.Vwld.length();
if (f_90_ > 208.333F) {
if (f_90_ > 291.666F)
propForce = 0.0F;
else
propForce *= (float) Math.sqrt((double) ((291.666F - f_90_)
/ 83.33299F));
}
engineForce.set(engineVector);
engineForce.scale(propForce);
engineTorque.cross(enginePos, engineForce);
rpm = toRPM(w);
break;
}
case 6: {
w = wMin + (wMax - wMin) * controlThrottle;
if (w < wMin || w < 0.0F || stage != 6)
w = 0.0F;
float f_91_ = reference.getSpeed() / 94.0F;
if (f_91_ < 1.0F)
w = 0.0F;
else
f_91_ = (float) Math.sqrt((double) f_91_);
propForce = w / wMax * thrustMax * f_91_;
propForce *= getStageMultiplier();
float f_92_ = (float) reference.Vwld.length();
if (f_92_ > 208.333F) {
if (f_92_ > 291.666F)
propForce = 0.0F;
else
propForce *= (float) Math.sqrt((double) ((291.666F - f_92_)
/ 83.33299F));
}
engineForce.set(engineVector);
engineForce.scale(propForce);
engineTorque.cross(enginePos, engineForce);
rpm = toRPM(w);
if (reference instanceof RealFlightModel) {
RealFlightModel realflightmodel = (RealFlightModel) reference;
f_92_ = Aircraft.cvt(propForce, 0.0F, thrustMax, 0.0F, 0.21F);
if (realflightmodel.producedShakeLevel < f_92_)
realflightmodel.producedShakeLevel = f_92_;
}
break;
}
case 5:
engineForce.set(engineVector);
engineForce.scale(propForce);
engineTorque.cross(enginePos, engineForce);
break;
}
}

private void computePropForces(float f, float f_93_, float f_94_,
float f_95_, float f_96_) {
float f_97_ = f * propr;
float f_98_ = f_93_ * f_93_ + f_97_ * f_97_;
float f_99_ = (float) Math.sqrt((double) f_98_);
float f_100_ = (0.5F * getFanCy((float) Math.toDegrees((double) f_95_))
* Atmosphere.density(f_96_) * f_98_ * propSEquivalent);
float f_101_ = (0.5F * getFanCx((float) Math.toDegrees((double) f_95_))
* Atmosphere.density(f_96_) * f_98_ * propSEquivalent);
if (f_99_ > 300.0F) {
float f_102_ = 1.0F + 0.02F * (f_99_ - 300.0F);
if (f_102_ > 2.0F)
f_102_ = 2.0F;
f_101_ *= f_102_;
}
if (f_99_ < 0.001F)
f_99_ = 0.001F;
float f_103_ = 1.0F / f_99_;
float f_104_ = f_93_ * f_103_;
float f_105_ = f_97_ * f_103_;
float f_106_ = 1.0F;
if (f_93_ < Vopt) {
float f_107_ = Vopt - f_93_;
f_106_ = 1.0F - 5.0E-5F * f_107_ * f_107_;
}
propForce = f_106_ * (f_100_ * f_105_ - f_101_ * f_104_);
propMoment = (f_101_ * f_105_ + f_100_ * f_104_) * propr;
}

public void toggle() {
if (stage == 0)
setEngineStarts(reference.actor);
else if (stage < 7) {
setEngineStops(reference.actor);
if (reference.isPlayers())
HUD.log("EngineI0");
}
}

public float getPowerOutput() {
if (stage == 0 || stage > 6)
return 0.0F;
return controlThrottle * readyness;
}

public float getThrustOutput() {
if (stage == 0 || stage > 6)
return 0.0F;
float f = w * _1_wMax * readyness;
if (f > 1.1F)
f = 1.1F;
return f;
}

public float getReadyness() {
return readyness;
}

public float getPropPhi() {
return propPhi;
}

private float getPropAngleDeviceSpeed() {
if (isPropAngleDeviceHydroOperable)
return propAngleChangeSpeed;
return propAngleChangeSpeed * 10.0F;
}

public int getPropDir() {
return propDirection;
}

public float getPropAoA() {
return propAoA;
}

public Vector3f getForce() {
return engineForce;
}

public float getRearRush() {
return rearRush;
}

public float getw() {
return w;
}

public float getRPM() {
return rpm;
}

public float getPropw() {
return w * propReductor;
}

public float getPropRPM() {
return rpm * propReductor;
}

public int getType() {
return type;
}

public float getControlThrottle() {
return controlThrottle;
}

public boolean getControlAfterburner() {
return controlAfterburner;
}

public boolean isHasControlThrottle() {
return bHasThrottleControl;
}

public boolean isHasControlAfterburner() {
return bHasAfterburnerControl;
}

public float getControlProp() {
return controlProp;
}

public float getElPropPos() {
float f;
if (bControlPropAuto)
f = controlProp;
else
f = (propPhiMax - propPhi) / (propPhiMax - propPhiMin);
if (f < 0.1F)
return 0.0F;
if (f > 0.9F)
return 1.0F;
return f;
}

public boolean getControlPropAuto() {
return bControlPropAuto;
}

public boolean isHasControlProp() {
return bHasPropControl;
}

public boolean isAllowsAutoProp() {
if (reference.isPlayers() && reference instanceof RealFlightModel
&& ((RealFlightModel) reference).isRealMode()) {
if (World.cur().diffCur.ComplexEManagement) {
switch (propAngleDeviceType) {
case 0:
return false;
case 5:
return true;
case 6:
return false;
case 3:
case 4:
return false;
case 1:
case 2:
if (reference.actor instanceof SPITFIRE9
|| reference.actor instanceof SPITFIRE8
|| reference.actor instanceof SPITFIRE8CLP)
return true;
return false;
case 7:
case 8:
return true;
default:
break;
}
} else
return bHasPropControl;
}
return true;
}

public float getControlMix() {
return controlMix;
}

public boolean isHasControlMix() {
return bHasMixControl;
}

public int getControlMagnetos() {
return controlMagneto;
}

public int getControlCompressor() {
return controlCompressor;
}

public boolean isHasControlMagnetos() {
return bHasMagnetoControl;
}

public boolean isHasControlCompressor() {
return bHasCompressorControl;
}

public int getControlFeather() {
return controlFeather;
}

public boolean isHasControlFeather() {
return bHasFeatherControl;
}

public boolean isAllowsAutoRadiator() {
if (World.cur().diffCur.ComplexEManagement) {
if (reference.actor instanceof P_51
|| reference.actor instanceof P_38
|| reference.actor instanceof YAK_3
|| reference.actor instanceof YAK_3P
|| reference.actor instanceof YAK_9M
|| reference.actor instanceof YAK_9U
|| reference.actor instanceof YAK_9UT
|| reference.actor instanceof SPITFIRE8
|| reference.actor instanceof SPITFIRE8CLP
|| reference.actor instanceof SPITFIRE9
|| reference.actor instanceof P_63C)
return true;
switch (propAngleDeviceType) {
case 7:
return true;
case 8:
if (type == 0)
return true;
return false;
default:
return false;
}
}
return true;
}

public boolean isHasControlRadiator() {
return bHasRadiatorControl;
}

public float getControlRadiator() {
return controlRadiator;
}

public int getExtinguishers() {
return extinguishers;
}

private float getFanCy(float f) {
if (f > 34.0F)
f = 34.0F;
if (f < -8.0F)
f = -8.0F;
if (f < 16.0F)
return -0.004688F * f * f + 0.15F * f + 0.4F;
float f_108_ = 0.0F;
if (f > 22.0F) {
f_108_ = 0.01F * (f - 22.0F);
f = 22.0F;
}
return 9.7222E-4F * f * f - 0.070833F * f + 2.4844F + f_108_;
}

private float getFanCx(float f) {
if (f < -4.0F)
f = -8.0F - f;
if (f > 34.0F)
f = 34.0F;
if ((double) f < 16.0)
return 3.5E-4F * f * f + 0.0028F * f + 0.0256F;
float f_109_ = 0.0F;
if (f > 22.0F) {
f_109_ = 0.04F * (f - 22.0F);
f = 22.0F;
}
return -0.00555F * f * f + 0.24444F * f - 2.32888F + f_109_;
}

public int getCylinders() {
return cylinders;
}

public int getCylindersOperable() {
return cylindersOperable;
}

public float getCylindersRatio() {
return (float) cylindersOperable / (float) cylinders;
}

public int getStage() {
return stage;
}

public float getBoostFactor() {
return engineBoostFactor;
}

public float getManifoldPressure() {
return compressorManifoldPressure;
}

public void setManifoldPressure(float f) {
compressorManifoldPressure = f;
}

public boolean getSootState() {
return false;
}

public Point3f getEnginePos() {
return enginePos;
}

public Point3f getPropPos() {
return propPos;
}

public Vector3f getEngineVector() {
return engineVector;
}

public float forcePropAOA(float f, float f_110_, float f_111_,
boolean bool) {
switch (type) {
default:
return -1.0F;
case 0:
case 1:
case 7: {
float f_112_ = controlThrottle;
boolean bool_113_ = controlAfterburner;
int i = stage;
safeLoc.set(reference.Loc);
safeVwld.set(reference.Vwld);
safeVflow.set(reference.Vflow);
if (bool)
w = wWEP;
else
w = wMax;
controlThrottle = f_111_;
if ((double) engineBoostFactor <= 1.0 && controlThrottle > 1.0F)
controlThrottle = 1.0F;
if (afterburnerType > 0 && bool)
controlAfterburner = true;
stage = 6;
fastATA = true;
reference.Loc.set(0.0, 0.0, (double) f_110_);
reference.Vwld.set((double) f, 0.0, 0.0);
reference.Vflow.set((double) f, 0.0, 0.0);
pressureExtBar
= (Atmosphere.pressure(reference.getAltitude())
+ (compressorSpeedManifold * 0.5F
* Atmosphere.density(reference.getAltitude()) * f * f));
pressureExtBar /= Atmosphere.P0();
float f_114_ = getCompressorMultiplier(0.033F);
f_114_ *= getN();
if (bool && bWepRpmInLowGear
&& controlCompressor == compressorMaxStep) {
w = wMax;
float f_115_ = getCompressorMultiplier(0.033F);
f_115_ *= getN();
f_114_ = f_115_;
}
boolean bool_116_ = false;
float f_117_ = propPhiMin;
float f_118_ = -1.0E8F;
boolean bool_119_ = false;
if ((Aircraft) reference.actor instanceof SM79)
bool_119_ = true;
while (propAngleDeviceType == 0 || bool_119_) {
float f_120_ = 2.0F;
int i_121_ = 0;
float f_122_ = 0.1F;
float f_123_ = 0.5F;
for (;;) {
if (bool)
w = wWEP * f_123_;
else
w = wMax * f_123_;
float f_124_
= (float) Math.sqrt((double) (f * f
+ (w * propr
* propReductor * w
* propr
* propReductor)));
float f_125_
= f_117_ - (float) Math.asin((double) (f / f_124_));
computePropForces(w * propReductor, f, 0.0F, f_125_,
f_110_);
f_114_ = getN() * getCompressorMultiplier(0.033F);
if (i_121_ > 32 || !((double) f_122_ > 1.0E-5))
break;
if (propMoment < f_114_) {
if (f_120_ == 1.0F)
f_122_ /= 2.0F;
f_123_ *= 1.0F + f_122_;
f_120_ = 0.0F;
} else {
if (f_120_ == 0.0F)
f_122_ /= 2.0F;
f_123_ /= 1.0F + f_122_;
f_120_ = 1.0F;
}
i_121_++;
}
if (!bool_119_)
break;
if (f_117_ == propPhiMin) {
f_118_ = propForce;
f_117_ = propPhiMax;
} else {
if (f_118_ > propForce)
propForce = f_118_;
break;
}
}
controlThrottle = f_112_;
controlAfterburner = bool_113_;
stage = i;
reference.Loc.set(safeLoc);
reference.Vwld.set(safeVwld);
reference.Vflow.set(safeVflow);
fastATA = false;
w = 0.0F;
if (bool_119_ || propAngleDeviceType == 0)
return propForce;
float f_126_ = 1.5F;
float f_127_ = -0.06F;
float f_128_ = 0.5F * (f_126_ + f_127_);
int i_129_ = 0;
for (;;) {
f_128_ = 0.5F * (f_126_ + f_127_);
if (bool && (!bWepRpmInLowGear
|| controlCompressor != compressorMaxStep))
computePropForces(wWEP * propReductor, f, 0.0F, f_128_,
f_110_);
else
computePropForces(wMax * propReductor, f, 0.0F, f_128_,
f_110_);
if (propForce > 0.0F && Math.abs(propMoment - f_114_) < 1.0E-5F
|| i_129_ > 32)
break;
if (propForce > 0.0F && propMoment > f_114_)
f_126_ = f_128_;
else
f_127_ = f_128_;
i_129_++;
}
return propForce;
}
case 2: {
pressureExtBar
= Atmosphere.pressure(f_110_) + (compressorSpeedManifold * 0.5F
* Atmosphere.density(f_110_)
* f * f);
pressureExtBar /= Atmosphere.P0();
float f_130_ = pressureExtBar;
float f_131_
= 1.0F - 0.006F * (Atmosphere.temperature(f_110_) - 290.0F);
float f_132_ = 1.0F - 0.0011F * f;
propForce = thrustMax * f_130_ * f_131_ * f_132_;
return propForce;
}
case 3:
case 4:
case 6:
propForce = thrustMax;
if (f > 208.333F) {
if (f > 291.666F)
propForce = 0.0F;
else
propForce *= (float) Math.sqrt((double) ((291.666F - f)
/ 83.33299F));
}
return propForce;
case 5:
return thrustMax;
case 8:
return -1.0F;
}
}

public float getEngineLoad() {
float f = 0.1F + getControlThrottle() * 0.81818175F;
float f_133_ = getw() / wMax;
return f_133_ / f;
}

private void overrevving() {
if (reference instanceof RealFlightModel
&& ((RealFlightModel) reference).isRealMode()
&& World.cur().diffCur.ComplexEManagement
&& World.cur().diffCur.Engine_Overheat && w > wMaxAllowed
&& bIsMaster) {
wMaxAllowed = 0.999965F * wMaxAllowed;
_1_wMaxAllowed = 1.0F / wMaxAllowed;
tmpF *= 1.0F - (wMaxAllowed - w) * 0.01F;
engineDamageAccum
+= 0.01F + 0.05F * (w - wMaxAllowed) * _1_wMaxAllowed;
if (engineDamageAccum > 1.0F) {
if (heatStringID == -1)
heatStringID = HUD.makeIdLog();
if (reference.isPlayers())
HUD.log(heatStringID, "EngineOverheat");
setReadyness(getReadyness()
- (engineDamageAccum - 1.0F) * 0.005F);
}
if (getReadyness() < 0.2F)
setEngineDies(reference.actor);
}
}

public float getN() {
if (stage == 6) {
switch (engineCarburetorType) {
case 0: {
float f = 0.05F + 0.95F * getControlThrottle();
float f_134_ = w / wMax;
tmpF = engineMomentMax * (-1.0F / f * f_134_ * f_134_
+ 2.0F * f_134_);
if (getControlThrottle() > 1.0F)
tmpF *= engineBoostFactor;
overrevving();
break;
}
case 3: {
float f = 0.1F + 0.9F * getControlThrottle();
float f_135_ = w / wNom;
tmpF = engineMomentMax * (-1.0F / f * f_135_ * f_135_
+ 2.0F * f_135_);
if (getControlThrottle() > 1.0F)
tmpF *= engineBoostFactor;
float f_136_ = getControlThrottle() - neg_G_Counter * 0.1F;
if (f_136_ <= 0.3F)
f_136_ = 0.3F;
if (reference.getOverload() < 0.0F && neg_G_Counter >= 0.0F) {
neg_G_Counter += 0.03F;
producedDistabilisation += 10.0F + 5.0F * neg_G_Counter;
tmpF *= f_136_;
if (reference.isPlayers()
&& reference instanceof RealFlightModel
&& ((RealFlightModel) reference).isRealMode()
&& bIsMaster
&& neg_G_Counter > World.Rnd().nextFloat(5.0F, 8.0F))
setEngineStops(reference.actor);
} else if (reference.getOverload() >= 0.0F
&& neg_G_Counter > 0.0F) {
neg_G_Counter -= 0.015F;
producedDistabilisation += 10.0F + 5.0F * neg_G_Counter;
tmpF *= f_136_;
bFloodCarb = true;
} else {
bFloodCarb = false;
neg_G_Counter = 0.0F;
}
overrevving();
break;
}
case 1:
case 2: {
float f = 0.1F + 0.9F * getControlThrottle();
if (f > 1.0F)
f = 1.0F;
float f_137_
= engineMomentMax * (-0.5F * f * f + 1.0F * f + 0.5F);
float f_138_;
if (controlAfterburner)
f_138_ = w / (wWEP * f);
else
f_138_ = w / (wNom * f);
tmpF = f_137_ * (2.0F * f_138_ - 1.0F * f_138_ * f_138_);
if (getControlThrottle() > 1.0F)
tmpF *= 1.0F + ((getControlThrottle() - 1.0F) * 10.0F
* (engineBoostFactor - 1.0F));
overrevving();
break;
}
case 4: {
float f = 0.1F + 0.9F * getControlThrottle();
if (f > 1.0F)
f = 1.0F;
float f_139_
= engineMomentMax * (-0.5F * f * f + 1.0F * f + 0.5F);
float f_140_;
if (controlAfterburner) {
f_140_ = w / (wWEP * f);
if (f >= 0.95F)
bFullT = true;
else
bFullT = false;
} else {
f_140_ = w / (wNom * f);
bFullT = false;
if (reference.actor instanceof SPITFIRE5B && f >= 0.95F)
bFullT = true;
}
tmpF = f_139_ * (2.0F * f_140_ - 1.0F * f_140_ * f_140_);
if (getControlThrottle() > 1.0F)
tmpF *= 1.0F + ((getControlThrottle() - 1.0F) * 10.0F
* (engineBoostFactor - 1.0F));
float f_141_ = getControlThrottle() - neg_G_Counter * 0.2F;
if (f_141_ <= 0.0F)
f_141_ = 0.1F;
if (reference.getOverload() < 0.0F && neg_G_Counter >= 0.0F) {
neg_G_Counter += 0.03F;
if (bFullT && neg_G_Counter < 0.5F) {
producedDistabilisation
+= 15.0F + 5.0F * neg_G_Counter;
tmpF *= 0.52F - neg_G_Counter;
} else if (bFullT && neg_G_Counter >= 0.5F
&& neg_G_Counter <= 0.8F) {
neg_G_Counter = 0.51F;
bFloodCarb = false;
} else if (bFullT && neg_G_Counter > 0.8F) {
neg_G_Counter -= 0.045F;
producedDistabilisation
+= 10.0F + 5.0F * neg_G_Counter;
tmpF *= f_141_;
bFloodCarb = true;
} else {
producedDistabilisation
+= 10.0F + 5.0F * neg_G_Counter;
tmpF *= f_141_;
if (reference.isPlayers()
&& reference instanceof RealFlightModel
&& ((RealFlightModel) reference).isRealMode()
&& bIsMaster
&& neg_G_Counter > World.Rnd().nextFloat(7.5F,
9.5F))
setEngineStops(reference.actor);
}
} else if (reference.getOverload() >= 0.0F
&& neg_G_Counter > 0.0F) {
neg_G_Counter -= 0.03F;
if (!bFullT) {
producedDistabilisation
+= 10.0F + 5.0F * neg_G_Counter;
tmpF *= f_141_;
}
bFloodCarb = true;
} else {
neg_G_Counter = 0.0F;
bFloodCarb = false;
}
overrevving();
break;
}
}
if (controlAfterburner) {
if (afterburnerType == 1) {
if (controlThrottle > 1.0F && reference.M.nitro > 0.0F)
tmpF *= engineAfterburnerBoostFactor;
} else if (afterburnerType == 8 || afterburnerType == 7) {
if (controlCompressor < compressorMaxStep)
tmpF *= engineAfterburnerBoostFactor;
} else
tmpF *= engineAfterburnerBoostFactor;
}
if (engineDamageAccum > 0.0F)
engineDamageAccum -= 0.01F;
if (engineDamageAccum < 0.0F)
engineDamageAccum = 0.0F;
if (tmpF < 0.0F)
tmpF = Math.max(tmpF, -0.8F * w * _1_wMax * engineMomentMax);
return tmpF;
}
tmpF = -1500.0F * w * _1_wMax * engineMomentMax;
if (stage == 8)
w = 0.0F;
return tmpF;
}

private float getDistabilisationMultiplier() {
if (engineMoment < 0.0F)
return 1.0F;
float f = 1.0F + (World.Rnd().nextFloat(-1.0F, 0.1F)
* getDistabilisationAmplitude());
if (f < 0.0F && w < 0.5F * (wMax + wMin))
return 0.0F;
return f;
}

public float getDistabilisationAmplitude() {
if (getCylindersOperable() > 2) {
float f = 1.0F - getCylindersRatio();
return (engineDistAM * w * w + engineDistBM * w + engineDistCM
+ 9.25F * f * f + producedDistabilisation);
}
return 11.25F;
}

private float getCompressorMultiplier(float f) {
float f_142_ = controlThrottle;
if (f_142_ > 1.0F)
f_142_ = 1.0F;
float f_143_;
switch (propAngleDeviceType) {
case 1:
case 2:
case 7:
case 8:
f_143_ = getATA(toRPM(propAngleDeviceMinParam
+ (propAngleDeviceMaxParam
- propAngleDeviceMinParam) * f_142_));
break;
default:
f_143_ = compressorRPMtoWMaxATA * (0.55F + 0.45F * f_142_);
}
coolMult = 1.0F;
compressorManifoldThreshold = f_143_;
switch (compressorType) {
case 0: {
float f_144_
= (Atmosphere.pressure(reference.getAltitude())
+ (0.5F * Atmosphere.density(reference.getAltitude())
* reference.getSpeed() * reference.getSpeed()));
float f_145_ = f_144_ / Atmosphere.P0();
coolMult = f_145_;
return f_145_;
}
case 1: {
float f_146_ = pressureExtBar;
if ((!bHasCompressorControl || !reference.isPlayers()
|| !(reference instanceof RealFlightModel)
|| !((RealFlightModel) reference).isRealMode()
|| !World.cur().diffCur.ComplexEManagement || fastATA)
&& (reference.isTick(128, 0) || fastATA)) {
compressorStepFound = false;
controlCompressor = 0;
}
float f_147_ = -1.0F;
float f_148_ = -1.0F;
int i = -1;
float f_149_;
if (fastATA) {
for (controlCompressor = 0;
controlCompressor <= compressorMaxStep;
controlCompressor++) {
compressorManifoldThreshold = f_143_;
float f_150_ = compressorPressure[controlCompressor];
float f_151_ = compressorRPMtoWMaxATA / f_150_;
float f_152_ = 1.0F;
float f_153_ = 1.0F;
if (f_146_ > f_150_) {
float f_154_ = 1.0F - f_150_;
if (f_154_ < 1.0E-4F)
f_154_ = 1.0E-4F;
float f_155_ = 1.0F - f_146_;
if (f_155_ < 0.0F)
f_155_ = 0.0F;
float f_156_ = 1.0F;
for (int i_157_ = 1; i_157_ <= controlCompressor;
i_157_++) {
if (compressorAltMultipliers[controlCompressor]
>= 1.0F)
f_156_ *= 0.8F;
else
f_156_ *= 0.8F * (compressorAltMultipliers
[controlCompressor]);
}
f_152_ = f_156_ + (f_155_ / f_154_
* ((compressorAltMultipliers
[controlCompressor])
- f_156_));
} else
f_152_ = compressorAltMultipliers[controlCompressor];
compressorManifoldPressure
= ((compressorPAt0
+ (1.0F - compressorPAt0) * w * _1_wMax)
* f_146_ * f_151_);
float f_158_
= compressorRPMtoWMaxATA / compressorManifoldPressure;
if (controlAfterburner
&& (afterburnerType != 8 && afterburnerType != 7
|| controlCompressor != compressorMaxStep)
&& (afterburnerType != 1 || !(controlThrottle > 1.0F)
|| !(reference.M.nitro <= 0.0F))) {
f_158_ *= afterburnerCompressorFactor;
compressorManifoldThreshold
*= afterburnerCompressorFactor;
}
compressor2ndThrottle = f_158_;
if (compressor2ndThrottle > 1.0F)
compressor2ndThrottle = 1.0F;
compressorManifoldPressure *= compressor2ndThrottle;
compressor1stThrottle = f_143_ / compressorRPMtoWMaxATA;
if (compressor1stThrottle > 1.0F)
compressor1stThrottle = 1.0F;
compressorManifoldPressure *= compressor1stThrottle;
f_153_ = (f_152_ * compressorManifoldPressure
/ compressorManifoldThreshold);
if (controlAfterburner
&& (afterburnerType == 8 || afterburnerType == 7)
&& controlCompressor == compressorMaxStep) {
if (f_153_ / engineAfterburnerBoostFactor > f_147_) {
f_147_ = f_153_;
i = controlCompressor;
}
} else if (f_153_ > f_147_) {
f_147_ = f_153_;
i = controlCompressor;
}
}
f_149_ = f_147_;
controlCompressor = i;
} else {
float f_159_ = f_143_;
if (controlAfterburner)
f_159_ *= afterburnerCompressorFactor;
do {
float f_160_ = compressorPressure[controlCompressor];
float f_161_ = compressorRPMtoWMaxATA / f_160_;
float f_162_ = 1.0F;
float f_163_ = 1.0F;
if (f_146_ > f_160_) {
float f_164_ = 1.0F - f_160_;
if (f_164_ < 1.0E-4F)
f_164_ = 1.0E-4F;
float f_165_ = 1.0F - f_146_;
if (f_165_ < 0.0F)
f_165_ = 0.0F;
float f_166_ = 1.0F;
for (int i_167_ = 1; i_167_ <= controlCompressor;
i_167_++) {
if (compressorAltMultipliers[controlCompressor]
>= 1.0F)
f_166_ *= 0.8F;
else
f_166_ *= 0.8F * (compressorAltMultipliers
[controlCompressor]);
}
f_162_ = f_166_ + (f_165_ / f_164_
* ((compressorAltMultipliers
[controlCompressor])
- f_166_));
f_163_ = f_162_;
} else {
f_162_ = compressorAltMultipliers[controlCompressor];
f_163_ = f_162_ * f_146_ * f_161_ / f_159_;
}
if (f_163_ > f_147_) {
f_147_ = f_163_;
f_148_ = f_162_;
i = controlCompressor;
}
if (!compressorStepFound) {
controlCompressor++;
if (controlCompressor == compressorMaxStep + 1)
compressorStepFound = true;
}
} while (!compressorStepFound);
if (i < 0)
i = 0;
controlCompressor = i;
float f_168_ = compressorPressure[controlCompressor];
float f_169_ = compressorRPMtoWMaxATA / f_168_;
compressorManifoldPressure
= ((compressorPAt0 + (1.0F - compressorPAt0) * w * _1_wMax)
* f_146_ * f_169_);
float f_170_
= compressorRPMtoWMaxATA / compressorManifoldPressure;
if (controlAfterburner
&& (afterburnerType != 8 && afterburnerType != 7
|| controlCompressor != compressorMaxStep)
&& (afterburnerType != 1 || !(controlThrottle > 1.0F)
|| !(reference.M.nitro <= 0.0F))) {
f_170_ *= afterburnerCompressorFactor;
compressorManifoldThreshold *= afterburnerCompressorFactor;
}
if (fastATA)
compressor2ndThrottle = f_170_;
else
compressor2ndThrottle
-= 3.0F * f * (compressor2ndThrottle - f_170_);
if (compressor2ndThrottle > 1.0F)
compressor2ndThrottle = 1.0F;
compressorManifoldPressure *= compressor2ndThrottle;
compressor1stThrottle = f_143_ / compressorRPMtoWMaxATA;
if (compressor1stThrottle > 1.0F)
compressor1stThrottle = 1.0F;
compressorManifoldPressure *= compressor1stThrottle;
f_149_
= compressorManifoldPressure / compressorManifoldThreshold;
coolMult = f_149_;
f_149_ *= f_148_;
}
if (w <= 20.0F && w < 150.0F)
compressorManifoldPressure
= Math.min(compressorManifoldPressure,
f_146_ * (0.4F + (w - 20.0F) * 0.04F));
if (w < 20.0F)
compressorManifoldPressure = f_146_ * (1.0F - w * 0.03F);
if (mixerType == 1 && stage == 6)
compressorManifoldPressure *= getMixMultiplier();
return f_149_;
}
case 2: {
float f_171_ = pressureExtBar;
float f_172_ = compressorPressure[controlCompressor];
float f_173_ = compressorRPMtoWMaxATA / f_172_;
compressorManifoldPressure
= ((compressorPAt0 + (1.0F - compressorPAt0) * w * _1_wMax)
* f_171_ * f_173_);
float f_174_ = compressorRPMtoWMaxATA / compressorManifoldPressure;
if (controlAfterburner
&& (afterburnerType != 1 || !(controlThrottle > 1.0F)
|| !(reference.M.nitro <= 0.0F))) {
f_174_ *= afterburnerCompressorFactor;
compressorManifoldThreshold *= afterburnerCompressorFactor;
}
if (fastATA)
compressor2ndThrottle = f_174_;
else
compressor2ndThrottle
-= 0.1F * (compressor2ndThrottle - f_174_);
if (compressor2ndThrottle > 1.0F)
compressor2ndThrottle = 1.0F;
compressorManifoldPressure *= compressor2ndThrottle;
compressor1stThrottle = f_143_ / compressorRPMtoWMaxATA;
if (compressor1stThrottle > 1.0F)
compressor1stThrottle = 1.0F;
compressorManifoldPressure *= compressor1stThrottle;
float f_175_;
if (controlAfterburner && afterburnerType == 2
&& reference.isPlayers()
&& reference instanceof RealFlightModel
&& ((RealFlightModel) reference).isRealMode()
&& reference.M.nitro > 0.0F) {
float f_176_ = compressorManifoldPressure + 0.2F;
if (f_176_ > compressorRPMtoWMaxATA + 0.199F && !fastATA
&& World.Rnd().nextFloat() < 0.001F) {
readyness = 0.0F;
setEngineDies(reference.actor);
}
if (f_176_ > compressorManifoldThreshold)
f_176_ = compressorManifoldThreshold;
f_175_ = f_176_ / compressorManifoldThreshold;
} else
f_175_
= compressorManifoldPressure / compressorManifoldThreshold;
if (w <= 20.0F && w < 150.0F)
compressorManifoldPressure
= Math.min(compressorManifoldPressure,
f_171_ * (0.4F + (w - 20.0F) * 0.04F));
if (w < 20.0F)
compressorManifoldPressure = f_171_ * (1.0F - w * 0.03F);
if (f_171_ > f_172_) {
float f_177_ = 1.0F - f_172_;
if (f_177_ < 1.0E-4F)
f_177_ = 1.0E-4F;
float f_178_ = 1.0F - f_171_;
if (f_178_ < 0.0F)
f_178_ = 0.0F;
float f_179_ = 1.0F;
float f_180_
= f_179_ + (f_178_ / f_177_
* (compressorAltMultipliers[controlCompressor]
- f_179_));
f_175_ *= f_180_;
} else
f_175_ *= compressorAltMultipliers[controlCompressor];
coolMult
= compressorManifoldPressure / compressorManifoldThreshold;
return f_175_;
}
case 3: {
float f_181_ = pressureExtBar;
controlCompressor = 0;
float f_182_ = -1.0F;
float f_183_ = compressorPressure[controlCompressor];
float f_184_ = compressorRPMtoWMaxATA / f_183_;
float f_185_ = 1.0F;
float f_186_ = 1.0F;
if (f_181_ > f_183_) {
float f_187_ = 1.0F - f_183_;
if (f_187_ < 1.0E-4F)
f_187_ = 1.0E-4F;
float f_188_ = 1.0F - f_181_;
if (f_188_ < 0.0F)
f_188_ = 0.0F;
float f_189_ = 1.0F;
f_185_ = f_189_ + f_188_ / f_187_ * ((compressorAltMultipliers
[controlCompressor])
- f_189_);
} else
f_185_ = compressorAltMultipliers[controlCompressor];
f_182_ = f_185_;
f_184_ = compressorRPMtoWMaxATA / f_183_;
if (f_181_ < f_183_)
f_181_ = 0.1F * f_181_ + 0.9F * f_183_;
float f_190_ = f_181_ * f_184_;
compressorManifoldPressure
= ((compressorPAt0 + (1.0F - compressorPAt0) * w * _1_wMax)
* f_190_);
float f_191_ = compressorRPMtoWMaxATA / compressorManifoldPressure;
if (fastATA)
compressor2ndThrottle = f_191_;
else
compressor2ndThrottle
-= 3.0F * f * (compressor2ndThrottle - f_191_);
if (compressor2ndThrottle > 1.0F)
compressor2ndThrottle = 1.0F;
compressorManifoldPressure *= compressor2ndThrottle;
compressor1stThrottle = f_143_ / compressorRPMtoWMaxATA;
if (compressor1stThrottle > 1.0F)
compressor1stThrottle = 1.0F;
compressorManifoldPressure *= compressor1stThrottle;
float f_192_
= compressorManifoldPressure / compressorManifoldThreshold;
f_192_ *= f_182_;
if (w <= 20.0F && w < 150.0F)
compressorManifoldPressure
= Math.min(compressorManifoldPressure,
f_181_ * (0.4F + (w - 20.0F) * 0.04F));
if (w < 20.0F)
compressorManifoldPressure = f_181_ * (1.0F - w * 0.03F);
return f_192_;
}
default:
return 1.0F;
}
}

private float getMagnetoMultiplier() {
switch (controlMagneto) {
case 0:
return 0.0F;
case 1:
return bMagnetos[0] ? 0.87F : 0.0F;
case 2:
return bMagnetos[1] ? 0.87F : 0.0F;
case 3: {
float f = 0.0F;
f = f + (bMagnetos[0] ? 0.87F : 0.0F);
f = f + (bMagnetos[1] ? 0.87F : 0.0F);
if (f > 1.0F)
f = 1.0F;
return f;
}
default:
return 1.0F;
}
}

private float getMixMultiplier() {
float f = 0.0F;
switch (mixerType) {
case 0:
return 1.0F;
case 1:
if (controlMix == 1.0F) {
if (bFloodCarb)
reference.AS.setSootState(reference.actor, number, 1);
else
reference.AS.setSootState(reference.actor, number, 0);
return 1.0F;
}
/* fall through */
case 2: {
if (reference.isPlayers() && reference instanceof RealFlightModel
&& ((RealFlightModel) reference).isRealMode()) {
if (!World.cur().diffCur.ComplexEManagement)
return 1.0F;
float f_193_ = mixerLowPressureBar * controlMix;
if (f_193_ < pressureExtBar - f) {
if (f_193_ < 0.03F)
setEngineStops(reference.actor);
if (bFloodCarb)
reference.AS.setSootState(reference.actor, number, 1);
else
reference.AS.setSootState(reference.actor, number, 0);
if (f_193_ > (pressureExtBar - f) * 0.25F)
return 1.0F;
float f_194_ = f_193_ / ((pressureExtBar - f) * 0.25F);
return f_194_;
}
if (f_193_ > pressureExtBar) {
producedDistabilisation
+= 0.0F + 35.0F * (1.0F - ((pressureExtBar + f)
/ (f_193_ + 1.0E-4F)));
reference.AS.setSootState(reference.actor, number, 1);
float f_195_ = (pressureExtBar + f) / (f_193_ + 1.0E-4F);
return f_195_;
}
if (bFloodCarb)
reference.AS.setSootState(reference.actor, number, 1);
else
reference.AS.setSootState(reference.actor, number, 0);
return 1.0F;
}
float f_196_ = mixerLowPressureBar * controlMix;
if (f_196_ < pressureExtBar - f && f_196_ < 0.03F)
setEngineStops(reference.actor);
return 1.0F;
}
default:
return 1.0F;
}
}

private float getStageMultiplier() {
if (stage == 6)
return 1.0F;
return 0.0F;
}

public void setFricCoeffT(float f) {
fricCoeffT = f;
}

private float getFrictionMoment(float f) {
float f_197_ = 0.0F;
if (bIsInoperable || stage == 0 || controlMagneto == 0) {
fricCoeffT += 0.1F * f;
if (fricCoeffT > 1.0F)
fricCoeffT = 1.0F;
float f_198_ = w * _1_wMax;
f_197_
= -fricCoeffT * (6.0F + 3.8F * f_198_) * (propI + engineI) / f;
float f_199_ = -0.99F * w * (propI + engineI) / f;
if (f_197_ < f_199_)
f_197_ = f_199_;
} else
fricCoeffT = 0.0F;
return f_197_;
}

private float getJetFrictionMoment(float f) {
float f_200_ = 0.0F;
if (bIsInoperable || stage == 0)
f_200_ = -0.002F * w * (propI + engineI) / f;
return f_200_;
}

public Vector3f getEngineForce() {
return engineForce;
}

public Vector3f getEngineTorque() {
return engineTorque;
}

public Vector3d getEngineGyro() {
tmpV3d1.cross(reference.getW(), propIW);
return tmpV3d1;
}

public float getEngineMomentRatio() {
return engineMoment / engineMomentMax;
}

public boolean isPropAngleDeviceOperational() {
return bIsAngleDeviceOperational;
}

public float getCriticalW() {
return wMaxAllowed;
}

public float getPropPhiMin() {
return propPhiMin;
}

public int getAfterburnerType() {
return afterburnerType;
}

private float toRadianPerSecond(float f) {
return f * 3.1415927F * 2.0F / 60.0F;
}

private float toRPM(float f) {
return f * 60.0F / 2.0F / 3.1415927F;
}

private float getKforH(float f, float f_201_, float f_202_) {
float f_203_ = (Atmosphere.density(f_202_) * (f_201_ * f_201_)
/ (Atmosphere.density(0.0F) * (f * f)));
if (type != 2)
f_203_ = f_203_ * kV(f) / kV(f_201_);
return f_203_;
}

private float kV(float f) {
return 1.0F - 0.0032F * f;
}

public final void setAfterburnerType(int i) {
afterburnerType = i;
}

public final void setPropReductorValue(float f) {
propReductor = f;
}

public void replicateToNet(NetMsgGuaranted netmsgguaranted)
throws IOException {
netmsgguaranted.writeByte(controlMagneto | stage << 4);
netmsgguaranted.writeByte(cylinders);
netmsgguaranted.writeByte(cylindersOperable);
netmsgguaranted.writeByte((int) (255.0F * readyness));
netmsgguaranted.writeByte((int) (255.0F
* ((propPhi - propPhiMin)
/ (propPhiMax - propPhiMin))));
netmsgguaranted.writeFloat(w);
}

public void replicateFromNet(NetMsgInput netmsginput) throws IOException {
int i = netmsginput.readUnsignedByte();
stage = (i & 0xf0) >> 4;
controlMagneto = i & 0xf;
cylinders = netmsginput.readUnsignedByte();
cylindersOperable = netmsginput.readUnsignedByte();
readyness = (float) netmsginput.readUnsignedByte() / 255.0F;
propPhi = ((float) netmsginput.readUnsignedByte() / 255.0F
* (propPhiMax - propPhiMin)) + propPhiMin;
w = netmsginput.readFloat();
}
}


Например можно посмотреть на FuelConsumption моторов.
Аватара пользователя
Karabas-Barabas
Новичок
Новичок
 
Автор темы
Сообщения: 181
Зарегистрирован:
13 ноя 2011, 22:44
Has thanked: 0 time
Have thanks: 2 times

Сообщение =RUDOLF= » 22 дек 2011, 22:29

Karabas-Barabas писал(а):ДТ сделали новую на основе модели Не-111, т.к. они очень похожи по агрегатам, по размерениям, а моторы просто одинаковые стоят.

А чем тогда обусловлена разница в скорости на целые 50 км/ч?
1/JGr125Rudolf
Аватара пользователя
=RUDOLF=
Новичок
Новичок
 
Сообщения: 100
Зарегистрирован:
26 сен 2010, 04:59
Has thanked: 18 times
Have thanks: 4 times

Сообщение Karabas-Barabas » 22 дек 2011, 22:40

=RUDOLF= писал(а):
Karabas-Barabas писал(а):ДТ сделали новую на основе модели Не-111, т.к. они очень похожи по агрегатам, по размерениям, а моторы просто одинаковые стоят.

А чем тогда обусловлена разница в скорости на целые 50 км/ч?


Аэродинамикой.
ДМ - это модель повреждений, а на скорость влияет ФМ.
Разница, скажем, в площади крыльев в 20% для расчетов повреждений роли не играет, ну кроме истребителя пытающегося сбить :) , а вот на скорость...
И "без мотров" они поэтому по-разному летают :)
Аватара пользователя
Karabas-Barabas
Новичок
Новичок
 
Автор темы
Сообщения: 181
Зарегистрирован:
13 ноя 2011, 22:44
Has thanked: 0 time
Have thanks: 2 times

Сообщение =RF=ODESSA » 23 дек 2011, 10:56

Karabas-Barabas писал(а):Извини, Спиты не интересуют.
А потому что там сделали, хоть метлу в ступе... :)


Ну хоть кусками кода 4.08 и 4.10.1 На примере 8 ки. Буду очень, очень, очень признателен. Рили-рили.
Аватара пользователя
=RF=ODESSA
Школота
Школота
 
Сообщения: 2
Зарегистрирован:
22 дек 2011, 09:40
Has thanked: 0 time
Have thanks: 0 time

Пред.

Вернуться в Ил-2 Air Domination War

Кто сейчас на конференции

Посетителей: 3, из них зарегистрированных: 0, скрытых: 0 и гостей: 3 (находятся на конференции)
Этот раздел просматривают: нет зарегистрированных пользователей и гости: 3