Offset height for teleport desinations, pickups, and player spawns
This commit is contained in:
@@ -18,12 +18,15 @@
|
||||
#ifndef CATCH_CONFIG_MAIN
|
||||
#define CATCH_CONFIG_MAIN
|
||||
#include "catch.hpp"
|
||||
#include <cmath>
|
||||
#include <queue>
|
||||
#include <vector>
|
||||
#include <sstream>
|
||||
|
||||
#include "EntityConverter.hpp"
|
||||
|
||||
#define PICKUP_FILENAME "r2x.pck"
|
||||
#define DELTA 0.00001
|
||||
|
||||
|
||||
|
||||
@@ -74,7 +77,18 @@ TEST_CASE( "r2x: a single Pickup entity can be converted", "[EntityConverter]" )
|
||||
std::vector<std::string> converted = ec.convert(entity);
|
||||
|
||||
REQUIRE( converted[0] == "\"classname\" \"weapon_grenadelauncher\"\n" );
|
||||
REQUIRE( converted[1] == "\"origin\" \"-216.00000 -1488.000488 -132.00000\"\n" );
|
||||
|
||||
// The z (vertical) is offset
|
||||
std::istringstream iss(converted[1]);
|
||||
std::string attribute;
|
||||
std::string coords[2];
|
||||
float offsetCoord;
|
||||
iss >> attribute >> coords[0] >> coords[1] >> offsetCoord;
|
||||
|
||||
REQUIRE( attribute == "\"origin\"" );
|
||||
REQUIRE( coords[0] == "\"-216.00000" );
|
||||
REQUIRE( coords[1] == "-1488.000488" );
|
||||
REQUIRE( fabs(-100.00000 - offsetCoord) <= DELTA );
|
||||
}
|
||||
|
||||
|
||||
@@ -103,8 +117,19 @@ TEST_CASE( "r2x: a single PlayerSpawn (teamA) entity can be converted", "[Entity
|
||||
std::vector<std::string> converted = ec.convert(entity);
|
||||
|
||||
REQUIRE( converted[0] == "\"classname\" \"info_player_team1\"\n" );
|
||||
REQUIRE( converted[1] == "\"origin\" \"-216.00000 -1488.000488 -132.00000\"\n" );
|
||||
REQUIRE( converted[2] == "\"angle\" \"180.00000\"\n" );
|
||||
|
||||
// The z (vertical) is offset
|
||||
std::istringstream iss(converted[1]);
|
||||
std::string attribute;
|
||||
std::string coords[2];
|
||||
float offsetCoord;
|
||||
iss >> attribute >> coords[0] >> coords[1] >> offsetCoord;
|
||||
|
||||
REQUIRE( attribute == "\"origin\"" );
|
||||
REQUIRE( coords[0] == "\"-216.00000" );
|
||||
REQUIRE( coords[1] == "-1488.000488" );
|
||||
REQUIRE( fabs(-100.00000 - offsetCoord) <= DELTA );
|
||||
}
|
||||
|
||||
|
||||
@@ -192,8 +217,19 @@ TEST_CASE( "r2x: a single Teleporter and related Target can be converted", "[Ent
|
||||
|
||||
std::vector<std::string> converted2 = ec.convert(entity2);
|
||||
REQUIRE( converted2[0] == "\"classname\" \"misc_teleporter_dest\"\n" );
|
||||
REQUIRE( converted2[1] == "\"origin\" \"-216.00000 -1488.000488 -132.00000\"\n" );
|
||||
REQUIRE( converted2[2] == "\"targetname\" \"tp1\"\n" );
|
||||
//
|
||||
// The z (vertical) is offset
|
||||
std::istringstream iss(converted2[1]);
|
||||
std::string attribute;
|
||||
std::string coords[2];
|
||||
float offsetCoord;
|
||||
iss >> attribute >> coords[0] >> coords[1] >> offsetCoord;
|
||||
|
||||
REQUIRE( attribute == "\"origin\"" );
|
||||
REQUIRE( coords[0] == "\"-216.00000" );
|
||||
REQUIRE( coords[1] == "-1488.000488" );
|
||||
REQUIRE( fabs(-100.00000 - offsetCoord) <= DELTA );
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user