2015-02-02 08:11:03 +05:30
|
|
|
//
|
|
|
|
// Author: Michael Cameron
|
|
|
|
// Email: chronokun@hotmail.com
|
|
|
|
//
|
|
|
|
|
2017-04-12 12:48:29 +05:30
|
|
|
|
|
|
|
#include <vector>
|
|
|
|
#include <string>
|
|
|
|
#include <sstream>
|
|
|
|
#include <fstream>
|
|
|
|
#include <iostream>
|
2017-05-06 08:03:26 +05:30
|
|
|
|
|
|
|
#include "oopless-parser.hpp"
|
2017-04-11 20:57:10 +05:30
|
|
|
#include "brushdef.hpp"
|
2015-02-02 08:11:03 +05:30
|
|
|
|
2017-04-11 02:59:47 +05:30
|
|
|
using namespace std;
|
|
|
|
// .map files for GTKRadiant
|
2017-04-11 20:57:10 +05:30
|
|
|
bool writemap(const TWorldSpawn &x,
|
|
|
|
const char *fn,
|
|
|
|
void (*f) (std::stringstream &, const vector<TPlanePoints> &)) {
|
2017-04-11 02:59:47 +05:30
|
|
|
ofstream OutFile;
|
|
|
|
OutFile.open(fn);
|
|
|
|
if(!OutFile.is_open())
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
OutFile << "{" << std::endl
|
|
|
|
<< "\"classname\" \"worldspawn\"" << std::endl;
|
|
|
|
|
|
|
|
for(const TBrush& krBrush : x.m_Brushes)
|
|
|
|
{
|
2017-04-11 20:57:10 +05:30
|
|
|
OutFile << GetBrushString(krBrush, f);
|
2017-04-11 02:59:47 +05:30
|
|
|
}
|
|
|
|
|
|
|
|
OutFile << "}" << std::endl;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2015-02-02 08:11:03 +05:30
|
|
|
int main(const int _kiArgC, const char** _kppcArgv)
|
|
|
|
{
|
|
|
|
// Check we have correct number of parameters
|
|
|
|
if(_kiArgC < 3)
|
|
|
|
{
|
|
|
|
return(3);
|
|
|
|
}
|
|
|
|
|
2017-05-06 08:03:26 +05:30
|
|
|
convertmap(_kppcArgv[1], _kppcArgv[2], &brushdef_net);
|
|
|
|
/* CMapParser Parser;
|
2015-02-02 08:11:03 +05:30
|
|
|
|
|
|
|
const bool kbSuccess = Parser.LoadMap(_kppcArgv[1]);
|
|
|
|
if(!kbSuccess)
|
|
|
|
{
|
|
|
|
return(1);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2017-04-11 20:57:10 +05:30
|
|
|
if (writemap(Parser.m_WorldSpawn, _kppcArgv[2], &brushdef_net)) {
|
2017-04-11 02:59:47 +05:30
|
|
|
cout << "Successfully exported map." << endl;
|
|
|
|
} else {
|
|
|
|
cout << "Failed to write output file." << endl;
|
|
|
|
}
|
2017-05-06 08:03:26 +05:30
|
|
|
} */
|
2015-02-02 08:11:03 +05:30
|
|
|
|
|
|
|
return(0);
|
2017-04-02 19:34:09 +05:30
|
|
|
}
|