Тема: Aviaskins sounds
Показать сообщение отдельно
Старый 06.06.2010, 23:47   #118
SLON
Местный
 
Аватар для SLON
 
Регистрация: 29.11.2009
Сообщений: 649
По умолчанию

И в хэшах нужно поизучать \com\maddox\il2\objects\sounds
Цитата:
package com.maddox.il2.objects.sounds;
import java.util.Random;

import com.maddox.JGP.Point3d;
import com.maddox.il2.fm.FmSounds;
import com.maddox.il2.fm.Motor;
import com.maddox.sound.BaseObject;
import com.maddox.sound.SamplePool;
import com.maddox.sound.SoundFX;

public class MotorSound implements FmSounds
{
protected SndAircraft owner = null;
protected Motor motor = null;
protected int sndStartState = 0;
protected Random dmgRnd = new Random();
protected long nextTime = 0L;
protected long prevTime = 0L;
protected float tDmg = 0.5F;
protected float kDmg = 0.0F;
protected SoundFX sndMotor = null;
protected SoundFX sndProp = null;
protected SamplePool spStart = null;
protected SamplePool spEnd = null;
private int prevState = 0;
private boolean bRunning = false;

public MotorSound(Motor motor, SndAircraft sndaircraft) {
owner = sndaircraft;
this.motor = motor;
if (BaseObject.isEnabled()) {
String string = motor.soundName;
String string_0_ = motor.propName;
String string_1_ = motor.startStopName;
if (string == null)
string = "db605";
string = "motor." + string;
if (string_1_ == null)
string_1_ = "std_p";
else if (string_1_.compareToIgnoreCase("none") == 0)
string_1_ = null;
if (string_1_ != null) {
spStart
= new SamplePool("motor." + string_1_ + ".start.begin");
spEnd = new SamplePool("motor." + string_1_ + ".start.end");
}
sndMotor = sndaircraft.newSound(string, true);
if (sndMotor != null) {
sndMotor.setParent(sndaircraft.getRootFX());
sndMotor.setPosition(motor.getEnginePos());
sndMotor.setControl(500, 0.0F);
}
if (string_0_ != null && !"".equals(string_0_)) {
string_0_ = "propeller." + string_0_;
sndProp = sndaircraft.newSound(string_0_, true);
if (sndProp != null) {
sndProp.setParent(sndaircraft.getRootFX());
sndProp.setPosition(motor.getEnginePos());
}
}
motor.isnd = this;
}
}

public void setPos(Point3d point3d) {
/* empty */
}

public void onEngineState(int i) {
if (sndMotor != null) {
if (i != prevState) {
if (i == 2 && spStart != null)
sndMotor.play(spStart);
if (i == 4 && spEnd != null)
sndMotor.play(spEnd);
}
if (i > 2 && i <= 6) {
if (i == 3) {
sndMotor.setControl(500, 1.0F);
sndMotor.setControl(501, 10.0F);
}
if (i == 5)
sndMotor.setControl(501, 20.0F);
if (i == 6) {
sndMotor.setControl(500, 1.0F);
bRunning = true;
}
}
sndMotor.setControl(106, i > 1 && i < 4 ? 1.0F : 0.0F);
sndMotor.setControl(112, (float) i);
}
prevState = i;
}

public void update() {
float f = motor.getRPM();
if (sndMotor != null) {
int i = motor.getType();
int i_2_ = i;
if (motor != null) {
/* empty */
}
boolean bool;
while_1_:
do {
do {
if (i_2_ != 0) {
int i_3_ = i;
if (motor != null) {
/* empty */
}
if (i_3_ != 1)
break;
}
bool = true;
break while_1_;
} while (false);
bool = false;
} while (false);
boolean bool_4_ = bool;
float f_5_ = motor.getReadyness();
float f_6_ = f;
if (f_5_ < 0.0F)
f_5_ = 0.0F;
f_5_ = 1.0F - f_5_;
if (bool_4_ && prevState == 0)
bRunning = f > 5.0F;
if (bRunning) {
if (!bool_4_ && f < 60.0F && prevState == 0)
bRunning = false;
if (f < 1200.0F) {
sndMotor.setControl(501, f / 30.0F);
sndMotor.setControl(502, f_5_ * 0.7F);
if (f > 400.0F)
sndMotor.setControl(503,
0.8F * (1200.0F - f) / 800.0F);
else
sndMotor.setControl(503, 0.8F);
} else
sndMotor.setControl(501, 0.0F);
} else
sndMotor.setControl(501, 0.0F);
float f_7_ = f;
if (f_5_ > 0.0F)
f_7_ *= 1.0F - f_5_ * 0.15F * dmgRnd.nextFloat();
sndMotor.setControl(100, f_7_);
sndMotor.setControl(101, f_5_);
}
if (sndProp != null) {
float f_8_ = motor.getPropRPM();
sndProp.setControl(100, f_8_);
}
}
}
__________________
"И создал бог землю, и компилировались её исходники 7 дней"
Уроки по модингу
Жизнь слишком коротка чтобы извлекать флешку безопасно. (с)

Последний раз редактировалось SLON; 06.06.2010 в 23:55.
SLON вне форума   Ответить с цитированием