shader fix, vehicle move feature

This commit is contained in:
milek7
2019-03-17 23:55:40 +01:00
parent a0738d109b
commit e6e5d6645b
11 changed files with 42 additions and 32 deletions

View File

@@ -351,7 +351,6 @@ TTrain::commandhandler_map const TTrain::m_commandhandlers = {
{ user_command::generictoggle8, &TTrain::OnCommand_generictoggle },
{ user_command::generictoggle9, &TTrain::OnCommand_generictoggle },
{ user_command::vehiclemove, &TTrain::OnCommand_vehiclemove },
{ user_command::vehiclemoveforwards, &TTrain::OnCommand_vehiclemoveforwards },
{ user_command::vehiclemovebackwards, &TTrain::OnCommand_vehiclemovebackwards },
{ user_command::vehicleboost, &TTrain::OnCommand_vehicleboost },
@@ -5008,38 +5007,18 @@ void TTrain::OnCommand_cabchangebackward( TTrain *Train, command_data const &Com
}
}
void TTrain::vehiclemove(float distance) {
TDynamicObject *d = DynamicObject;
while( d ) {
d->Move( distance * d->DirectionGet() );
d = d->Next(); // pozostałe też
}
d = DynamicObject->Prev();
while( d ) {
d->Move( distance * d->DirectionGet() );
d = d->Prev(); // w drugą stronę też
}
}
void TTrain::OnCommand_vehiclemove(TTrain *Train, const command_data &Command) {
if (Command.action == GLFW_RELEASE || !DebugModeFlag)
return;
Train->vehiclemove(Command.param1);
}
void TTrain::OnCommand_vehiclemoveforwards(TTrain *Train, const command_data &Command) {
if (Command.action == GLFW_RELEASE || !DebugModeFlag)
return;
Train->vehiclemove(100.0);
Train->DynamicObject->move_set(100.0);
}
void TTrain::OnCommand_vehiclemovebackwards(TTrain *Train, const command_data &Command) {
if (Command.action == GLFW_RELEASE || !DebugModeFlag)
return;
Train->vehiclemove(-100.0);
Train->DynamicObject->move_set(-100.0);
}
void TTrain::OnCommand_vehicleboost(TTrain *Train, const command_data &Command) {