diff --git a/ReflexToQ3/includes/oopless-parser.cpp b/ReflexToQ3/includes/oopless-parser.cpp index 94dc062..d6a8a67 100644 --- a/ReflexToQ3/includes/oopless-parser.cpp +++ b/ReflexToQ3/includes/oopless-parser.cpp @@ -5,7 +5,7 @@ #include using namespace std; -bool is_ebrush(std::vector input) { +bool is_ebrush(const std::vector &input) { #define KEYWORD_ENTBRUSH1 "type Teleporter" #define KEYWORD_ENTBRUSH2 "type JumpPad" for (const string &str : input) { @@ -36,6 +36,18 @@ bool write(const struct TBrush &geometry, return ok; } +// currently for the specific case to specify trigger to brush entities +struct TBrush override_textures(struct TBrush x, const char *texture) { + struct TBrush output = x; + for (struct TFace &z : output.m_Faces) { + // prevent appending color infomation to texture file path + // may need re-ordering on when to append that. + z.hex = string(); + z.m_Material = texture; + } + return output; +} + void write(const vector &entity, ofstream &fo, void (*b) (stringstream &, const vector &), @@ -73,7 +85,7 @@ void write(const vector &entity, string line; copy(brush.begin(), brush.end(), ostream_iterator(ss, "\n")); getline(ss, line); // this both discards the brush keyboard and prevents a crash - write(parse_brush(ss), fo, b); + write(override_textures(parse_brush(ss), "common/trigger"), fo, b); } fo << "}" << endl; } diff --git a/ReflexToQ3/includes/oopless-parser.hpp b/ReflexToQ3/includes/oopless-parser.hpp index 096e9cb..92ccbae 100644 --- a/ReflexToQ3/includes/oopless-parser.hpp +++ b/ReflexToQ3/includes/oopless-parser.hpp @@ -10,7 +10,9 @@ #include #include "EntityConverter.hpp" -bool is_ebrush(std::vector); +bool is_ebrush(const std::vector&); + +struct TBrush override_textures(struct TBrush, const char*); bool write(const struct TBrush &, std::ofstream &,