Compare commits
10 Commits
master
...
fix_Depend
Author | SHA1 | Date | |
---|---|---|---|
|
39027fc892 | ||
|
12bf62f51e | ||
|
d3f55f7704 | ||
|
e89de6a57f | ||
|
ea7627830c | ||
|
8f916bad20 | ||
|
e018389452 | ||
|
7b18f42dde | ||
|
e91b74655e | ||
|
c795352b28 |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -13,6 +13,7 @@
|
|||||||
*.orig
|
*.orig
|
||||||
|
|
||||||
# executables
|
# executables
|
||||||
|
build
|
||||||
reflex2q3
|
reflex2q3
|
||||||
runtests
|
runtests
|
||||||
|
|
||||||
|
31
CMakeLists.txt
Normal file
31
CMakeLists.txt
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
|
||||||
|
cmake_minimum_required(VERSION 3.10)
|
||||||
|
project(reflex2q3 CXX)
|
||||||
|
|
||||||
|
set(OBJ_SRC "src/planes.cpp" "src/brushdef.cpp" "src/oopless-parser.cpp" "src/EntityConverter.cpp")
|
||||||
|
add_library(objects OBJECT ${OBJ_SRC})
|
||||||
|
|
||||||
|
|
||||||
|
add_executable(reflex2q3 src/main.cpp)
|
||||||
|
add_executable(runtests test/catch.cpp)
|
||||||
|
target_link_libraries(reflex2q3 objects)
|
||||||
|
target_link_libraries(runtests objects)
|
||||||
|
|
||||||
|
set(CMAKE_CXX_STANDARD 11)
|
||||||
|
set(CMAKE_CXX_STANDARD_REQUIRED True)
|
||||||
|
|
||||||
|
find_package(PkgConfig)
|
||||||
|
pkg_check_modules(EIGEN eigen3)
|
||||||
|
if ( NOT EIGEN_FOUND) #use local
|
||||||
|
message ( WARNING "Install eigen3 using your package manager. If using git eigen3 or a non-standard install location, ensure environment variable EIGEN3_INCLUDE_DIR is set." )
|
||||||
|
include_directories ( "$ENV{EIGEN3_INCLUDE_DIR}" )
|
||||||
|
find_package(Eigen3 REQUIRED NO_MODULE)
|
||||||
|
endif ( NOT EIGEN_FOUND)
|
||||||
|
|
||||||
|
include_directories(
|
||||||
|
${EIGEN_INCLUDE_DIRS} #set by pkg_check_modules
|
||||||
|
"lib/Catch/single_include/catch2"
|
||||||
|
"lib/cxxopts/include"
|
||||||
|
"include"
|
||||||
|
"test"
|
||||||
|
)
|
32
Makefile
32
Makefile
@@ -1,32 +0,0 @@
|
|||||||
EX=reflex2q3
|
|
||||||
CC=g++
|
|
||||||
CFLAGS=-std=c++11 -static -static-libgcc -static-libstdc++ -I"/mingw64/include/eigen3" -I"include" -I"lib/Catch/single_include" -I"lib/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)
|
|
||||||
|
|
||||||
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 $(EX)
|
|
||||||
|
|
21
README.md
21
README.md
@@ -1,35 +1,40 @@
|
|||||||
# reflex2q3
|
# reflex2q3
|
||||||
Converts Reflex maps (Version 8 and below) into id Tech map files. A pre-compiled [Windows executable](https://u.teknik.io/eOmo5.zip) is available.
|
Converts Reflex maps (Version 8 and below) into id Tech map files.
|
||||||
|
|
||||||
#### Build Requirements
|
#### Build Requirements
|
||||||
|
* cmake
|
||||||
* [Eigen 3, C++ template library](http://eigen.tuxfamily.org/index.php?title=Main_Page)
|
* [Eigen 3, C++ template library](http://eigen.tuxfamily.org/index.php?title=Main_Page)
|
||||||
|
|
||||||
#### Building:
|
#### Building:
|
||||||
```bash
|
```bash
|
||||||
git submodule update --init --recursive
|
git submodule update --init --recursive
|
||||||
make
|
mkdir build
|
||||||
|
cd build
|
||||||
|
cmake ..
|
||||||
|
make
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Convert map geometry:
|
#### Convert map geometry:
|
||||||
```bash
|
```bash
|
||||||
./reflex2q3 [input].map [output].map
|
./reflex2q3 input.map output.map
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Convert map geometry and entities:
|
#### Convert map geometry and entities:
|
||||||
```bash
|
```bash
|
||||||
./reflex2q3 [input].map [output].map -e [entity file].rem
|
./reflex2q3 input.map output.map -e ../entity-file.rem
|
||||||
```
|
```
|
||||||
|
|
||||||
We've provided Quake 3 and Xonotic entity conversion files (r2q3.rem and r2xonotic.rem). To create entity files for other games built on the [id Tech 3](https://en.wikipedia.org/wiki/Id_Tech_3) engine or previous [id Tech](https://en.wikipedia.org/wiki/Id_Tech) engines, refer to our [Reflex entity documentation](https://git.teknik.io/scuti/reflex2q3/src/f2b0341da38b82ad4f0a0cf258b0f6e6d8335fda/docs/doc-entities.txt), our sample .rem files, and relevant documentation for your game.
|
We've provided Quake 3 and Xonotic entity conversion files (r2q3.rem and r2xonotic.rem). To create entity files for other games built on the [id Tech 3](https://en.wikipedia.org/wiki/Id_Tech_3) engine or previous [id Tech](https://en.wikipedia.org/wiki/Id_Tech) engines, refer to our [Reflex entity documentation](https://notabug.org/scuti/reflex2q3/src/master/docs/doc-entities.txt), our sample .rem files, and relevant documentation for your game.
|
||||||
|
|
||||||
#### List all command line arguments:
|
#### List all command line arguments:
|
||||||
```bash
|
```bash
|
||||||
./reflex2q3 --help
|
./reflex2q3 --help
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Compiler(s)
|
#### Compiler(s) Tested
|
||||||
* mingw-w64, GCC 5.3.0
|
* gcc (Debian 10.2.1-6) 10.2.1 20210110
|
||||||
* gcc version 7.1.1 20170528
|
* gcc (GCC) 11.3.0 (Windows)
|
||||||
|
* gcc version 12.2.0 (GCC)
|
||||||
|
|
||||||
#### Tested With
|
#### Tested With
|
||||||
* netradiant-1.5.0-20120301
|
* netradiant-1.5.0-20120301
|
||||||
|
@@ -17,7 +17,7 @@
|
|||||||
* Revision: none
|
* Revision: none
|
||||||
* Compiler: gcc
|
* Compiler: gcc
|
||||||
*
|
*
|
||||||
* Author: surkeh@protonmail.com
|
* Author: suhrke@protonmail.com
|
||||||
*
|
*
|
||||||
* =====================================================================================
|
* =====================================================================================
|
||||||
*/
|
*/
|
||||||
|
@@ -52,12 +52,13 @@ using namespace std;
|
|||||||
line.find(KEYWORD_PREFAB) != string::npos) || (
|
line.find(KEYWORD_PREFAB) != string::npos) || (
|
||||||
line.find(KEYWORD_BRUSH) != string::npos && !is_ebrush(output))) {
|
line.find(KEYWORD_BRUSH) != string::npos && !is_ebrush(output))) {
|
||||||
f.seekg(pos);
|
f.seekg(pos);
|
||||||
return output;
|
break;
|
||||||
} else {
|
} else {
|
||||||
output.push_back(line);
|
output.push_back(line);
|
||||||
}
|
}
|
||||||
pos = f.tellg();
|
pos = f.tellg();
|
||||||
}
|
}
|
||||||
|
return output;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class STREAMOBJ>
|
template <class STREAMOBJ>
|
||||||
|
Submodule lib/Catch updated: d2d8455b57...182c910b4b
Submodule lib/cxxopts updated: d7b930846c...eb787304d6
@@ -10,7 +10,7 @@
|
|||||||
* Revision: none
|
* Revision: none
|
||||||
* Compiler: gcc
|
* Compiler: gcc
|
||||||
*
|
*
|
||||||
* Author: surkeh@protonmail.com
|
* Author: suhrke@protonmail.com
|
||||||
*
|
*
|
||||||
* =====================================================================================
|
* =====================================================================================
|
||||||
*/
|
*/
|
||||||
|
20
src/main.cpp
20
src/main.cpp
@@ -8,6 +8,7 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <exception>
|
#include <exception>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
|
#include <iterator>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
@@ -45,12 +46,12 @@ cxxopts::Options arguments(int ac, char ** av) {
|
|||||||
cxxopts::value<string>(), "FILE")
|
cxxopts::value<string>(), "FILE")
|
||||||
;
|
;
|
||||||
o.parse_positional(parg);
|
o.parse_positional(parg);
|
||||||
o.parse(ac, av);
|
auto options = o.parse(ac, av);
|
||||||
if (o.count("help")) {
|
if (options.count("help")) {
|
||||||
cout << o.help() << endl;
|
cout << o.help() << endl;
|
||||||
}
|
}
|
||||||
if (o.count(ARG_INPUT_SHORTALIAS) < 1 ||
|
if (options.count(ARG_INPUT_SHORTALIAS) < 1 ||
|
||||||
o.count(ARG_OUTPUT_SHORTALIAS) < 1) {
|
options.count(ARG_OUTPUT_SHORTALIAS) < 1) {
|
||||||
cerr << "error: no input or output file given" << endl;
|
cerr << "error: no input or output file given" << endl;
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
@@ -73,7 +74,7 @@ stringstream loadmap(const char *filename) {
|
|||||||
return output;
|
return output;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool convert_worldspawn(const cxxopts::Options &o,
|
bool convert_worldspawn(const cxxopts::ParseResult &o,
|
||||||
vector<vector<string> > &q) {
|
vector<vector<string> > &q) {
|
||||||
bool is_ok = false;
|
bool is_ok = false;
|
||||||
brushdef fn = &brushdef_net;
|
brushdef fn = &brushdef_net;
|
||||||
@@ -118,7 +119,7 @@ void print_entities(vector<vector<string> > &q) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void convert_entities(const cxxopts::Options &o, const vector<vector<string> > &q) {
|
void convert_entities(const cxxopts::ParseResult &o, const vector<vector<string> > &q) {
|
||||||
string entfile = o["e"].as<string>();
|
string entfile = o["e"].as<string>();
|
||||||
if (entfile.empty()) {
|
if (entfile.empty()) {
|
||||||
cout << "No entity data file given"
|
cout << "No entity data file given"
|
||||||
@@ -146,12 +147,13 @@ int main(int argc, char** argv)
|
|||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
cxxopts::Options p = arguments(argc, argv);
|
cxxopts::Options p = arguments(argc, argv);
|
||||||
|
auto options = p.parse(argc, argv);
|
||||||
vector<vector<string> > entities;
|
vector<vector<string> > entities;
|
||||||
bool is_ok = convert_worldspawn(p, entities);
|
bool is_ok = convert_worldspawn(options, entities);
|
||||||
// print_entities(entities);
|
// print_entities(entities);
|
||||||
convert_entities(p, entities);
|
convert_entities(options, entities);
|
||||||
}
|
}
|
||||||
catch (cxxopts::option_not_exists_exception e) {
|
catch (cxxopts::exceptions::no_such_option e) {
|
||||||
cerr << e.what() << endl
|
cerr << e.what() << endl
|
||||||
<< "./reflex2q3 -h for usage information" << endl;
|
<< "./reflex2q3 -h for usage information" << endl;
|
||||||
return -1;
|
return -1;
|
||||||
|
@@ -21,7 +21,7 @@
|
|||||||
|
|
||||||
#include "EntityConverter.hpp"
|
#include "EntityConverter.hpp"
|
||||||
|
|
||||||
#define ENTITY_FILENAME "r2xonotic.rem"
|
#define ENTITY_FILENAME "../r2xonotic.rem"
|
||||||
#define DELTA 0.00001
|
#define DELTA 0.00001
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user