diff options
Diffstat (limited to 'src/core/parser.cc')
-rw-r--r-- | src/core/parser.cc | 34 |
1 files changed, 26 insertions, 8 deletions
diff --git a/src/core/parser.cc b/src/core/parser.cc index 22b2fc3..efcc58b 100644 --- a/src/core/parser.cc +++ b/src/core/parser.cc @@ -19,10 +19,7 @@ bool Parser::got_entity_key(filesystem::IniFile &inifile, core::Entity *entity) std::string shapename; std::string strval; - float direction; - float pitch; - float roll; - + float yaw, pitch, roll; float f; bool blnval; @@ -75,16 +72,37 @@ bool Parser::got_entity_key(filesystem::IniFile &inifile, core::Entity *entity) entity->unset_flag(Entity::ShowOnMap); return true; - } else if (inifile.got_key_angle("direction", direction)) { - entity->get_axis().change_direction(direction); + } else if (inifile.got_key_float("angle", yaw)) { + + if (yaw == model::ANGLEUP) { + entity->get_axis().change_pitch(-90.0f); + } else if (yaw == model::ANGLEDOWN) { + entity->get_axis().change_pitch(90.0f); + } else { + entity->get_axis().change_direction(yaw); + } + return true; + + } else if (inifile.got_key("angles")) { + + std::istringstream str(inifile.value()); + if (str >> pitch >> yaw >> roll) { + entity->get_axis().assign(yaw, pitch, roll); + } else { + inifile.unknown_value(); + } + return true; + + } else if (inifile.got_key_angle("yaw", yaw)) { + entity->get_axis().change_direction(yaw); return true; } else if (inifile.got_key_angle("pitch", pitch)) { - entity->get_axis().change_pitch(pitch); + entity->get_axis().change_pitch(-pitch); return true; } else if (inifile.got_key_angle("roll", roll)) { - entity->get_axis().change_roll(roll); + entity->get_axis().change_roll(-roll); return true; } else if (inifile.got_key_angle("radius", f)) { |