TFace attributes offset, scale, and rotation are assigned.

This commit is contained in:
2017-04-11 04:30:36 -07:00
parent 4c529c4f82
commit 697cce13ef

View File

@ -226,56 +226,35 @@ EParserState CMapParser::ParseVertex(const std::string _Line)
return(PARSERSTATE_VERTEX);
}
EParserState CMapParser::ParseFace(const std::string _Line)
{
const size_t kszLineSize = 2048;
char pcLine[kszLineSize];
const char* kpcDelim = " \t";
char* pcToken;
char* pcContext;
strcpy_s(pcLine, _Line.c_str());
pcToken = strtok_s(pcLine, kpcDelim, &pcContext);
int iTokenNum = 0;
std::string material;
std::vector<int> Indices;
while(pcToken != nullptr)
{
if(iTokenNum < 5)
{
if(std::isdigit(pcToken[0], std::locale()) || pcToken[0] == '-')
{
double dValue = std::stod(pcToken);
}
else
{
return(PARSERSTATE_BRUSH);
}
} else if (iTokenNum == 9) {
// this should be '0x' something, which wasn't in V6.
EParserState CMapParser::ParseFace(const std::string _Line) {
stringstream ss(_Line);
string material;
vector<int> Indices;
TFace Face;
float *f = &Face.m_fXOffset;
string data;
unsigned int i = 0;
// For a primitive in Reflex, there is at least 9 and at most 10 fields.
while (ss >> data) {
if (i < 5) {
if (isdigit(data[0], std::locale()) || data[0] == '-') {
double dvalue = stod(data);
*f = (float)dvalue;
f++;
} else {
return PARSERSTATE_BRUSH;
}
} else if (i == 9) {
;
} else {
if (isdigit(data[0], std::locale()) || data[0] == '-') {
Indices.push_back(stoi(data));
} else {
material = data;
}
}
else
{
if(std::isdigit(pcToken[0], std::locale()) || pcToken[0] == '-')
{
int iValue = std::stoi(pcToken);
Indices.push_back(iValue);
}
else
{
material = pcToken;
}
}
iTokenNum++;
pcToken = strtok_s(nullptr, kpcDelim, &pcContext);
}
TFace Face;
i++;
}
Face.m_Indices = Indices;
Face.m_Material = material;
m_WorldSpawn.m_Brushes[m_WorldSpawn.m_Brushes.size()-1].m_Faces.push_back(Face);