Changed position default to 0,0,0 for all objects to reflect reflex map file generation
This commit is contained in:
parent
11f8989558
commit
32e6e092c2
@ -242,15 +242,14 @@ EntityConverter::convertPickup(const std::vector<std::string> &lines) const
|
||||
{
|
||||
std::vector<std::string> convertedLines;
|
||||
//can ignore angle of pickups in xonotic format
|
||||
std::string coords[3];
|
||||
std::string coords[3] = {"0.0", "0.0", "0.0"};
|
||||
int pickupID;
|
||||
std::string trash;
|
||||
bool havePosition = false;
|
||||
bool havePickupID = false;
|
||||
|
||||
if ( lines.size() < 3 ) {
|
||||
if ( lines.size() < 2 ) {
|
||||
throw std::runtime_error(
|
||||
makeErrorMessage( "error: Pickup entity requires at least 3 lines", lines ));
|
||||
makeErrorMessage( "error: Pickup entity requires at least type and ID", lines ));
|
||||
}
|
||||
|
||||
for (int i = 1; i < lines.size(); i++) {
|
||||
@ -263,7 +262,6 @@ EntityConverter::convertPickup(const std::vector<std::string> &lines) const
|
||||
throw std::runtime_error(
|
||||
makeErrorMessage( "error: Pickup entity requires coordinates", lines ));
|
||||
}
|
||||
havePosition = true;
|
||||
}
|
||||
else if ( type == "pickupType" ) {
|
||||
std::istringstream iss(lines[i]);
|
||||
@ -276,7 +274,7 @@ EntityConverter::convertPickup(const std::vector<std::string> &lines) const
|
||||
}
|
||||
}
|
||||
|
||||
if ( havePosition && havePickupID ) {
|
||||
if ( havePickupID ) {
|
||||
auto pickupIter = pickupMap_.find(pickupID);
|
||||
if ( pickupIter == pickupMap_.end() ) {
|
||||
throw std::runtime_error(
|
||||
@ -416,7 +414,7 @@ EntityConverter::convertJumpPad(const std::vector<std::string> &lines) const
|
||||
|
||||
if ( lines.size() < 2 ) {
|
||||
throw std::runtime_error(
|
||||
makeErrorMessage( "error: JumpPad entity requires at least 2 lines", lines ));
|
||||
makeErrorMessage( "error: JumpPad entity requires at least type and target name", lines ));
|
||||
}
|
||||
std::istringstream iss(lines[1]);
|
||||
// String32 target targetName
|
||||
@ -443,7 +441,7 @@ EntityConverter::convertTeleporter(const std::vector<std::string> &lines) const
|
||||
|
||||
if ( lines.size() < 2 ) {
|
||||
throw std::runtime_error(
|
||||
makeErrorMessage( "error: Teleport entity requires at least 2 lines", lines ));
|
||||
makeErrorMessage( "error: Teleport entity requires at least type and target name", lines ));
|
||||
}
|
||||
std::istringstream iss(lines[1]);
|
||||
// String32 target targetName
|
||||
@ -466,18 +464,17 @@ EntityConverter::convertTarget(const std::vector<std::string> &lines) const
|
||||
{
|
||||
std::vector<std::string> convertedLines;
|
||||
//position and name required, angles optional
|
||||
std::string coords[3];
|
||||
std::string coords[3] = {"0.0", "0.0", "0.0"};
|
||||
std::string targetName;
|
||||
std::string angle;
|
||||
std::string trash;
|
||||
bool havePosition = false;
|
||||
bool haveName = false;
|
||||
bool haveAngle = false;
|
||||
|
||||
|
||||
if ( lines.size() < 3 ) {
|
||||
throw std::runtime_error(
|
||||
makeErrorMessage( "error: Target entity requires at least 3 lines", lines ));
|
||||
makeErrorMessage( "error: Target entity requires at least type and name", lines ));
|
||||
}
|
||||
|
||||
for (int i = 1; i < lines.size(); i++) {
|
||||
@ -490,7 +487,6 @@ EntityConverter::convertTarget(const std::vector<std::string> &lines) const
|
||||
throw std::runtime_error(
|
||||
makeErrorMessage( "error: Target entity requires coordinates", lines ));
|
||||
}
|
||||
havePosition = true;
|
||||
}
|
||||
else if ( type == "name" ) {
|
||||
std::istringstream iss(lines[i]);
|
||||
@ -513,7 +509,7 @@ EntityConverter::convertTarget(const std::vector<std::string> &lines) const
|
||||
|
||||
}
|
||||
|
||||
if ( havePosition && haveName) {
|
||||
if ( haveName) {
|
||||
auto targetIter = targetMap_.find(targetName);
|
||||
if ( targetIter == targetMap_.end() ) {
|
||||
std::cerr << makeErrorMessage("EntityConverter doesn't know what the source of a Target entity with the following attributes. This entity will not be converted. It is probably an unsupported entity type or feature. (e.g. game over camera)", lines);
|
||||
@ -588,20 +584,19 @@ EntityConverter::convertPointLight(const std::vector<std::string> &lines) const
|
||||
{
|
||||
std::vector<std::string> convertedLines;
|
||||
//position and intensity required, color optional
|
||||
std::string coords[3];
|
||||
std::string coords[3] = {"0.0", "0.0", "0.0"};
|
||||
//default to a typical value
|
||||
std::string intensity = "1.0";
|
||||
//color is hex 8 digits
|
||||
//default to white if no color specified
|
||||
std::string color = "ff000000";
|
||||
std::string trash;
|
||||
bool havePosition = false;
|
||||
bool haveColor = false;
|
||||
|
||||
|
||||
if ( lines.size() < 2 ) {
|
||||
throw std::runtime_error(
|
||||
makeErrorMessage( "error: PointLight entity requires at least 2 lines", lines ));
|
||||
makeErrorMessage( "error: PointLight entity requires at least type", lines ));
|
||||
}
|
||||
|
||||
for (int i = 1; i < lines.size(); i++) {
|
||||
@ -614,7 +609,6 @@ EntityConverter::convertPointLight(const std::vector<std::string> &lines) const
|
||||
throw std::runtime_error(
|
||||
makeErrorMessage( "error: PointLight entity requires valid position coordinates", lines ));
|
||||
}
|
||||
havePosition = true;
|
||||
}
|
||||
else if ( type == "intensity" ) {
|
||||
std::istringstream iss(lines[i]);
|
||||
@ -637,7 +631,6 @@ EntityConverter::convertPointLight(const std::vector<std::string> &lines) const
|
||||
}
|
||||
|
||||
|
||||
if ( havePosition ) {
|
||||
convertedLines.push_back ( "\"classname\" \"light\"\n" );
|
||||
// coordinates reordered to x, z, y
|
||||
std::stringstream positionStream;
|
||||
@ -662,12 +655,6 @@ EntityConverter::convertPointLight(const std::vector<std::string> &lines) const
|
||||
convertedLines.push_back (colorStream.str() );
|
||||
|
||||
return convertedLines;
|
||||
}
|
||||
else {
|
||||
throw std::runtime_error(
|
||||
makeErrorMessage( "error: PointLight entity requires position coordinates", lines ));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user