Reorganized, expanded pickup file to include other entities, now .ent
This commit is contained in:
1 parent
40f9432321
commit
3d6896e6ff
28 files changed
+110
-61
No files matched your search
@@ -14,6 +14,5 @@
|
||||
|
||||
# executables
|
||||
reflex2q3
|
||||
test/catch
|
||||
test/test-parser
|
||||
runtests
|
||||
|
||||
+4
-4
@@ -1,6 +1,6 @@
|
||||
[submodule "ReflexToQ3/includes/cxxopts"]
|
||||
path = ReflexToQ3/includes/cxxopts
|
||||
[submodule "includes/cxxopts"]
|
||||
path = includes/cxxopts
|
||||
url = https://github.com/jarro2783/cxxopts.git
|
||||
[submodule "ReflexToQ3/includes/Catch"]
|
||||
path = ReflexToQ3/includes/Catch
|
||||
[submodule "includes/Catch"]
|
||||
path = includes/Catch
|
||||
url = https://github.com/philsquared/Catch.git
|
||||
@@ -0,0 +1,32 @@
|
||||
EX=reflex2q3
|
||||
CC=g++
|
||||
CFLAGS=-std=c++11 -I"./src" -I"./includes" -I"./includes/Catch/single_include" -I"./includes/cxxopts/include" -I"/usr/include/eigen3"
|
||||
TESTEX=runtests
|
||||
|
||||
all: main test
|
||||
|
||||
main: planes.o brushdef.o oopless-parser.o EntityConverter.o
|
||||
$(CC) $^ src/main.cpp $(CFLAGS) -o $(EX) #2>error8.log
|
||||
|
||||
test: planes.o brushdef.o oopless-parser.o EntityConverter.o catch.o
|
||||
$(CC) $^ $(CFLAGS) -o $(TESTEX)
|
||||
cp runtests .git/hooks/pre-commit
|
||||
|
||||
catch.o: test/catch.cpp
|
||||
$(CC) -c $^ $(CFLAGS)
|
||||
|
||||
oopless-parser.o: src/oopless-parser.cpp
|
||||
$(CC) -c $^ $(CFLAGS)
|
||||
|
||||
brushdef.o: src/brushdef.cpp
|
||||
$(CC) -c $^ $(CFLAGS)
|
||||
|
||||
planes.o: src/planes.cpp
|
||||
$(CC) -c $^ $(CFLAGS)
|
||||
|
||||
EntityConverter.o: src/EntityConverter.cpp
|
||||
$(CC) -c $^ $(CFLAGS)
|
||||
|
||||
clean:
|
||||
rm *.o *.log $(EX)
|
||||
|
||||
@@ -1,32 +0,0 @@
|
||||
EX=reflex2q3
|
||||
CC=g++
|
||||
CFLAGS=-std=c++11 -I"./includes" -I"./includes/Catch/single_include" -I"./includes/cxxopts/include" -I"/usr/include/eigen3"
|
||||
TESTEX=test/catch
|
||||
|
||||
all: main test
|
||||
|
||||
main: planes.o brushdef.o oopless-parser.o EntityConverter.o
|
||||
$(CC) $^ main.cpp $(CFLAGS) -o $(EX) 2>error8.log
|
||||
|
||||
test: planes.o brushdef.o oopless-parser.o EntityConverter.o catch.o
|
||||
$(CC) $^ $(CFLAGS) -o $(TESTEX)
|
||||
mv test/catch ../.git/hooks/pre-commit
|
||||
|
||||
catch.o: test/catch.cpp
|
||||
$(CC) -c $^ $(CFLAGS)
|
||||
|
||||
oopless-parser.o: includes/oopless-parser.cpp
|
||||
$(CC) -c $^ $(CFLAGS)
|
||||
|
||||
brushdef.o: includes/brushdef.cpp
|
||||
$(CC) -c $^ $(CFLAGS)
|
||||
|
||||
planes.o: includes/planes.cpp
|
||||
$(CC) -c $^ $(CFLAGS)
|
||||
|
||||
EntityConverter.o: includes/EntityConverter.cpp
|
||||
$(CC) -c $^ $(CFLAGS)
|
||||
|
||||
clean:
|
||||
rm *.o *.log $(EX)
|
||||
|
||||
Submodule ReflexToQ3/includes/Catch deleted from 6f32db35af.
Submodule ReflexToQ3/includes/cxxopts deleted from 11faadeba7.
Submodule
+1
Submodule includes/Catch added at 27640a5a96.
Submodule
+1
Submodule includes/cxxopts added at c2c2262626.
+25
@@ -0,0 +1,25 @@
|
||||
40 item_health_small
|
||||
41 item_health
|
||||
42 item_health_large
|
||||
43 item_health_mega
|
||||
50 item_armor_shard
|
||||
51 item_armor_jacket
|
||||
52 item_armor_combat
|
||||
53 item_armor_body
|
||||
1 weapon_shotgun
|
||||
2 weapon_grenadelauncher
|
||||
3 weapon_plasmagun
|
||||
4 weapon_rocketlauncher
|
||||
5 weapon_lightning
|
||||
6 weapon_railgun
|
||||
20 ammo_bullets
|
||||
21 ammo_shells
|
||||
22 ammo_rockets
|
||||
23 ammo_lightning
|
||||
24 ammo_rockets
|
||||
25 ammo_bullets
|
||||
26 ammo_lightning
|
||||
60 item_quad
|
||||
62 item_enviro
|
||||
70 team_CTF_redflag
|
||||
71 team_CTF_blueflag
|
||||
@@ -0,0 +1,25 @@
|
||||
40 item_health_small
|
||||
41 item_health
|
||||
42 item_health_large
|
||||
43 item_health_mega
|
||||
50 item_armor_shard
|
||||
51 item_armor_small
|
||||
52 item_armor_big
|
||||
53 item_armor_mega
|
||||
1 weapon_shotgun
|
||||
2 weapon_grenadelauncher
|
||||
3 weapon_plasmagun
|
||||
4 weapon_rocketlauncher
|
||||
5 weapon_lightning
|
||||
6 weapon_railgun
|
||||
20 item_bullets
|
||||
21 item_shells
|
||||
22 item_rockets
|
||||
23 item_lightning
|
||||
24 item_rockets
|
||||
25 item_bullets
|
||||
26 item_lightning
|
||||
60 item_quad
|
||||
62 item_shield?
|
||||
70 item_flag_team1
|
||||
71 item_flag_team2
|
||||
@@ -12,7 +12,7 @@
|
||||
4 weapon_rocketlauncher
|
||||
5 weapon_electro
|
||||
6 weapon_nex
|
||||
20 burst
|
||||
20 item_shells
|
||||
21 item_shells
|
||||
22 item_rockets
|
||||
23 item_cells
|
||||
@@ -243,7 +243,7 @@ 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] = {"0.0", "0.0", "0.0"};
|
||||
int pickupID;
|
||||
std::string pickupID;
|
||||
std::string trash;
|
||||
bool havePickupID = false;
|
||||
|
||||
@@ -275,8 +275,8 @@ EntityConverter::convertPickup(const std::vector<std::string> &lines) const
|
||||
}
|
||||
|
||||
if ( havePickupID ) {
|
||||
auto pickupIter = pickupMap_.find(pickupID);
|
||||
if ( pickupIter == pickupMap_.end() ) {
|
||||
auto pickupIter = entityMap_.find(pickupID);
|
||||
if ( pickupIter == entityMap_.end() ) {
|
||||
throw std::runtime_error(
|
||||
makeErrorMessage( "error: Pickup ID is invalid", lines ));
|
||||
}
|
||||
@@ -681,12 +681,12 @@ EntityConverter::mapEntities(const std::string &mapFile)
|
||||
while (std::getline(fin, line)) {
|
||||
std::istringstream iss(line);
|
||||
// Reflex ID corresponds to xonotic pickup name
|
||||
int id;
|
||||
std::string id;
|
||||
std::string pickup;
|
||||
if ( ! (iss >> id >> pickup)) {
|
||||
throw std::runtime_error( "format error in Pickup .pck file " + mapFile );
|
||||
}
|
||||
pickupMap_.insert ( std::pair<int, std::string>(id, pickup) );
|
||||
entityMap_.insert ( std::pair<std::string, std::string>(id, pickup) );
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -816,8 +816,8 @@ void
|
||||
EntityConverter::printMapping() const
|
||||
{
|
||||
std::cout << std::endl << "Reflex pickup ID mapped to Xonotic pickup names: " << std::endl;
|
||||
std::map<int, std::string>::const_iterator it;
|
||||
for ( it=pickupMap_.begin(); it!=pickupMap_.end(); ++it )
|
||||
std::map<std::string, std::string>::const_iterator it;
|
||||
for ( it=entityMap_.begin(); it!=entityMap_.end(); ++it )
|
||||
std::cout << it->first << " => " << it->second << std::endl;
|
||||
}
|
||||
|
||||
@@ -219,7 +219,7 @@ class EntityConverter
|
||||
|
||||
|
||||
// Map Reflex pickup IDs to Xonotic pickup identifiers
|
||||
std::map<int, std::string> pickupMap_;
|
||||
std::map<std::string, std::string> entityMap_;
|
||||
// Map targets (by name) to their source type
|
||||
std::map<std::string, std::string> targetMap_;
|
||||
// Related entities must be matched prior to entity conversion
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -21,7 +21,7 @@
|
||||
|
||||
#include "EntityConverter.hpp"
|
||||
|
||||
#define PICKUP_FILENAME "ReflexToQ3/r2x.pck"
|
||||
#define ENTITY_FILENAME "r2xonotic.ent"
|
||||
#define DELTA 0.00001
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
TEST_CASE( "r2x: Unsupported entity types cause return of empty vector", "[EntityConverter]" ) {
|
||||
|
||||
// Instantiate object
|
||||
EntityConverter ec (PICKUP_FILENAME);
|
||||
EntityConverter ec (ENTITY_FILENAME);
|
||||
|
||||
// Mock up entity
|
||||
std::vector<std::string> entity;
|
||||
@@ -53,7 +53,7 @@ TEST_CASE( "r2x: Unsupported entity types cause return of empty vector", "[Entit
|
||||
TEST_CASE( "r2x: a single Pickup entity can be converted", "[EntityConverter]" ) {
|
||||
|
||||
// Instantiate object
|
||||
EntityConverter ec (PICKUP_FILENAME);
|
||||
EntityConverter ec (ENTITY_FILENAME);
|
||||
|
||||
// Mock up entity
|
||||
std::vector<std::string> entity;
|
||||
@@ -92,7 +92,7 @@ TEST_CASE( "r2x: a single Pickup entity can be converted", "[EntityConverter]" )
|
||||
TEST_CASE( "r2x: a single PlayerSpawn (race) entity can be converted", "[EntityConverter]" ) {
|
||||
|
||||
// Instantiate object
|
||||
EntityConverter ec (PICKUP_FILENAME);
|
||||
EntityConverter ec (ENTITY_FILENAME);
|
||||
|
||||
// Mock up WorldSpawn entity
|
||||
// (needed for mode info)
|
||||
@@ -182,7 +182,7 @@ TEST_CASE( "r2x: a single PlayerSpawn (race) entity can be converted", "[EntityC
|
||||
TEST_CASE( "r2x: a single PlayerSpawn (teamA) entity can be converted", "[EntityConverter]" ) {
|
||||
|
||||
// Instantiate object
|
||||
EntityConverter ec (PICKUP_FILENAME);
|
||||
EntityConverter ec (ENTITY_FILENAME);
|
||||
|
||||
// Mock up entity
|
||||
std::vector<std::string> entity;
|
||||
@@ -222,7 +222,7 @@ TEST_CASE( "r2x: a single PlayerSpawn (teamA) entity can be converted", "[Entity
|
||||
TEST_CASE( "r2x: a single PlayerSpawn (non-team) entity can be converted", "[EntityConverter]" ) {
|
||||
|
||||
// Instantiate object
|
||||
EntityConverter ec (PICKUP_FILENAME);
|
||||
EntityConverter ec (ENTITY_FILENAME);
|
||||
|
||||
// Mock up entity
|
||||
std::vector<std::string> entity;
|
||||
@@ -261,7 +261,7 @@ TEST_CASE( "r2x: a single PlayerSpawn (non-team) entity can be converted", "[Ent
|
||||
TEST_CASE( "r2x: a single RaceStart entity can be converted", "[EntityConverter]" ) {
|
||||
|
||||
// Instantiate object
|
||||
EntityConverter ec (PICKUP_FILENAME);
|
||||
EntityConverter ec (ENTITY_FILENAME);
|
||||
|
||||
// Mock up entity
|
||||
std::vector<std::string> entity;
|
||||
@@ -287,7 +287,7 @@ TEST_CASE( "r2x: a single RaceStart entity can be converted", "[EntityConverter]
|
||||
TEST_CASE( "r2x: a single RaceFinish entity can be converted", "[EntityConverter]" ) {
|
||||
|
||||
// Instantiate object
|
||||
EntityConverter ec (PICKUP_FILENAME);
|
||||
EntityConverter ec (ENTITY_FILENAME);
|
||||
|
||||
// Mock up entity
|
||||
std::vector<std::string> entity;
|
||||
@@ -313,7 +313,7 @@ TEST_CASE( "r2x: a single RaceFinish entity can be converted", "[EntityConverter
|
||||
TEST_CASE( "r2x: a single Teleporter and related Target can be converted", "[EntityConverter]" ) {
|
||||
|
||||
// Instantiate object
|
||||
EntityConverter ec (PICKUP_FILENAME);
|
||||
EntityConverter ec (ENTITY_FILENAME);
|
||||
|
||||
// Mock up Teleporter entity
|
||||
std::vector<std::string> entity;
|
||||
@@ -376,7 +376,7 @@ TEST_CASE( "r2x: a single Teleporter and related Target can be converted", "[Ent
|
||||
TEST_CASE( "r2x: a single JumpPad and related Target can be converted", "[EntityConverter]" ) {
|
||||
|
||||
// Instantiate object
|
||||
EntityConverter ec (PICKUP_FILENAME);
|
||||
EntityConverter ec (ENTITY_FILENAME);
|
||||
|
||||
// Mock up JumpPad entity
|
||||
std::vector<std::string> entity;
|
||||
@@ -413,7 +413,7 @@ TEST_CASE( "r2x: a single JumpPad and related Target can be converted", "[Entity
|
||||
TEST_CASE( "r2x: a single PointLight entity can be converted", "[EntityConverter]" ) {
|
||||
|
||||
// Instantiate object
|
||||
EntityConverter ec (PICKUP_FILENAME);
|
||||
EntityConverter ec (ENTITY_FILENAME);
|
||||
|
||||
// Mock up entity
|
||||
std::vector<std::string> entity;
|
||||
@@ -461,7 +461,7 @@ TEST_CASE( "r2x: a single PointLight entity can be converted", "[EntityConverter
|
||||
TEST_CASE( "r2x: PointLight defaults to white light of typical intensity", "[EntityConverter]" ) {
|
||||
|
||||
// Instantiate object
|
||||
EntityConverter ec (PICKUP_FILENAME);
|
||||
EntityConverter ec (ENTITY_FILENAME);
|
||||
|
||||
// Mock up entity
|
||||
std::vector<std::string> entity;
|
||||
File renamed without changes.
File renamed without changes.
Reference in new issue
Block a user