mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-17 23:39:18 +02:00
improve trainingmode collision sound
This commit is contained in:
@@ -87,7 +87,7 @@ bool TEventLauncher::Load(cParser *parser)
|
|||||||
parser->getTokens();
|
parser->getTokens();
|
||||||
*parser >> token;
|
*parser >> token;
|
||||||
asEvent2Name = token; // drugi event
|
asEvent2Name = token; // drugi event
|
||||||
if ((asEvent2Name == "end") || (asEvent2Name == "condition"))
|
if ((asEvent2Name == "end") || (asEvent2Name == "condition") || (asEvent2Name == "traintriggered"))
|
||||||
{ // drugiego eventu może nie być, bo są z tym problemy, ale ciii...
|
{ // drugiego eventu może nie być, bo są z tym problemy, ale ciii...
|
||||||
token = asEvent2Name; // rozpoznane słowo idzie do dalszego przetwarzania
|
token = asEvent2Name; // rozpoznane słowo idzie do dalszego przetwarzania
|
||||||
asEvent2Name = "none"; // a drugiego eventu nie ma
|
asEvent2Name = "none"; // a drugiego eventu nie ma
|
||||||
@@ -129,6 +129,10 @@ bool TEventLauncher::Load(cParser *parser)
|
|||||||
parser->getTokens(); // słowo zamykające
|
parser->getTokens(); // słowo zamykające
|
||||||
*parser >> token;
|
*parser >> token;
|
||||||
}
|
}
|
||||||
|
if (token == "traintriggered")
|
||||||
|
{
|
||||||
|
train_triggered = true;
|
||||||
|
}
|
||||||
|
|
||||||
if( DeltaTime < 0 )
|
if( DeltaTime < 0 )
|
||||||
DeltaTime = -DeltaTime; // dla ujemnego zmieniamy na dodatni
|
DeltaTime = -DeltaTime; // dla ujemnego zmieniamy na dodatni
|
||||||
|
|||||||
@@ -48,6 +48,7 @@ public:
|
|||||||
TMemCell *MemCell { nullptr };
|
TMemCell *MemCell { nullptr };
|
||||||
int iCheckMask { 0 };
|
int iCheckMask { 0 };
|
||||||
double dRadius { 0.0 };
|
double dRadius { 0.0 };
|
||||||
|
bool train_triggered { false };
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// methods
|
// methods
|
||||||
|
|||||||
11
scene.cpp
11
scene.cpp
@@ -124,9 +124,16 @@ basic_cell::update_events() {
|
|||||||
|
|
||||||
// event launchers
|
// event launchers
|
||||||
for( auto *launcher : m_eventlaunchers ) {
|
for( auto *launcher : m_eventlaunchers ) {
|
||||||
|
glm::dvec3 campos = Global.pCamera.Pos;
|
||||||
|
double radius = launcher->dRadius;
|
||||||
|
if (launcher->train_triggered && simulation::Train) {
|
||||||
|
campos = simulation::Train->Dynamic()->HeadPosition();
|
||||||
|
radius *= Timer::GetDeltaTime() * simulation::Train->Dynamic()->GetVelocity() * 0.277;
|
||||||
|
}
|
||||||
|
|
||||||
if( launcher->check_conditions()
|
if( launcher->check_conditions()
|
||||||
&& ( launcher->dRadius < 0.0
|
&& ( radius < 0.0
|
||||||
|| SquareMagnitude( launcher->location() - Global.pCamera.Pos ) < launcher->dRadius ) ) {
|
|| glm::distance2( launcher->location(), campos ) < launcher->dRadius ) ) {
|
||||||
if( launcher->check_activation() )
|
if( launcher->check_activation() )
|
||||||
launch_event( launcher, true );
|
launch_event( launcher, true );
|
||||||
if( launcher->check_activation_key() )
|
if( launcher->check_activation_key() )
|
||||||
|
|||||||
@@ -343,8 +343,7 @@ void state_manager::process_commands() {
|
|||||||
std::getline(ss, data, ':');
|
std::getline(ss, data, ':');
|
||||||
|
|
||||||
TAnimModel *model = simulation::State.create_model(data, name, commanddata.location);
|
TAnimModel *model = simulation::State.create_model(data, name, commanddata.location);
|
||||||
simulation::State.create_eventlauncher("node -1 0 launcher eventlauncher 0 0 0 " + std::to_string(model->radius())
|
simulation::State.create_eventlauncher("node -1 0 launcher eventlauncher 0 0 0 0.8 none -10000.0 obstacle_collision traintriggered end", name + "_snd", commanddata.location);
|
||||||
+ " none -10000.0 obstacle_collision end", name + "_snd", commanddata.location);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (commanddata.command == user_command::deletemodel) {
|
if (commanddata.command == user_command::deletemodel) {
|
||||||
|
|||||||
Reference in New Issue
Block a user