Compare commits

..

10 Commits

11 changed files with 63 additions and 56 deletions

1
.gitignore vendored
View File

@ -13,6 +13,7 @@
*.orig
# executables
build
reflex2q3
runtests

31
CMakeLists.txt Normal file
View 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"
)

View File

@ -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)

View File

@ -1,35 +1,40 @@
# 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
* cmake
* [Eigen 3, C++ template library](http://eigen.tuxfamily.org/index.php?title=Main_Page)
#### Building:
```bash
git submodule update --init --recursive
make
mkdir build
cd build
cmake ..
make
```
#### Convert map geometry:
```bash
./reflex2q3 [input].map [output].map
./reflex2q3 input.map output.map
```
#### Convert map geometry and entities:
```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:
```bash
./reflex2q3 --help
```
#### Compiler(s)
* mingw-w64, GCC 5.3.0
* gcc version 7.1.1 20170528
#### Compiler(s) Tested
* gcc (Debian 10.2.1-6) 10.2.1 20210110
* gcc (GCC) 11.3.0 (Windows)
* gcc version 12.2.0 (GCC)
#### Tested With
* netradiant-1.5.0-20120301

View File

@ -17,7 +17,7 @@
* Revision: none
* Compiler: gcc
*
* Author: surkeh@protonmail.com
* Author: suhrke@protonmail.com
*
* =====================================================================================
*/

View File

@ -52,12 +52,13 @@ using namespace std;
line.find(KEYWORD_PREFAB) != string::npos) || (
line.find(KEYWORD_BRUSH) != string::npos && !is_ebrush(output))) {
f.seekg(pos);
return output;
break;
} else {
output.push_back(line);
}
pos = f.tellg();
}
return output;
}
template <class STREAMOBJ>

@ -1 +1 @@
Subproject commit d2d8455b571b6c66c4b7003500a77f9a93ecdc28
Subproject commit 182c910b4b63ff587a3440e08f84f70497e49a81

@ -1 +1 @@
Subproject commit d7b930846cdccfc8bcecc4d7150ddcbadffac360
Subproject commit eb787304d67ec22f7c3a184ee8b4c481d04357fd

View File

@ -10,7 +10,7 @@
* Revision: none
* Compiler: gcc
*
* Author: surkeh@protonmail.com
* Author: suhrke@protonmail.com
*
* =====================================================================================
*/

View File

@ -8,6 +8,7 @@
#include <iostream>
#include <exception>
#include <fstream>
#include <iterator>
#include <sstream>
#include <string>
#include <vector>
@ -16,7 +17,6 @@
#include "oopless-parser.hpp"
#include "brushdef.hpp"
#include <iterator>
using namespace std;
@ -46,12 +46,12 @@ cxxopts::Options arguments(int ac, char ** av) {
cxxopts::value<string>(), "FILE")
;
o.parse_positional(parg);
o.parse(ac, av);
if (o.count("help")) {
auto options = o.parse(ac, av);
if (options.count("help")) {
cout << o.help() << endl;
}
if (o.count(ARG_INPUT_SHORTALIAS) < 1 ||
o.count(ARG_OUTPUT_SHORTALIAS) < 1) {
if (options.count(ARG_INPUT_SHORTALIAS) < 1 ||
options.count(ARG_OUTPUT_SHORTALIAS) < 1) {
cerr << "error: no input or output file given" << endl;
exit(EXIT_FAILURE);
}
@ -74,7 +74,7 @@ stringstream loadmap(const char *filename) {
return output;
}
bool convert_worldspawn(const cxxopts::Options &o,
bool convert_worldspawn(const cxxopts::ParseResult &o,
vector<vector<string> > &q) {
bool is_ok = false;
brushdef fn = &brushdef_net;
@ -119,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>();
if (entfile.empty()) {
cout << "No entity data file given"
@ -147,12 +147,13 @@ int main(int argc, char** argv)
{
try {
cxxopts::Options p = arguments(argc, argv);
auto options = p.parse(argc, argv);
vector<vector<string> > entities;
bool is_ok = convert_worldspawn(p, entities);
bool is_ok = convert_worldspawn(options, 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
<< "./reflex2q3 -h for usage information" << endl;
return -1;

View File

@ -21,7 +21,7 @@
#include "EntityConverter.hpp"
#define ENTITY_FILENAME "r2xonotic.rem"
#define ENTITY_FILENAME "../r2xonotic.rem"
#define DELTA 0.00001