diff options
author | Stijn Buys <ingar@osirion.org> | 2010-11-18 15:36:02 +0000 |
---|---|---|
committer | Stijn Buys <ingar@osirion.org> | 2010-11-18 15:36:02 +0000 |
commit | 138dbc83d5720c8baa7270ece183ce356f619fce (patch) | |
tree | 94cebeb8c5cef1a2550ea4d6414af6729c832def /src/core | |
parent | 847f84e1e3797277407bc34f5acc51b801b2bf29 (diff) |
Have core::Parser handle axis rotations in the same manner as model::MapFile.
Diffstat (limited to 'src/core')
-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)) { |