Commit 2a7f88fc authored by hybrid's avatar hybrid

Reindentation.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@1092 dfc29bdd-3216-0410-991c-e03cc46cb475
parent fbb1d585
...@@ -26,7 +26,7 @@ using namespace video; ...@@ -26,7 +26,7 @@ using namespace video;
#include "irrString.h" #include "irrString.h"
/** A structure representing some DeleD infos. /** A structure representing some DeleD infos.
This structure contains data about DeleD level file like: version, ambient colour, number of objects etc...*/ This structure contains data about DeleD level file like: version, ambient colour, number of objects etc...*/
struct dmfHeader struct dmfHeader
{ {
//main file header //main file header
...@@ -107,7 +107,6 @@ This function converts an hex string (i.e. FF) to its int value (i.e. 255). ...@@ -107,7 +107,6 @@ This function converts an hex string (i.e. FF) to its int value (i.e. 255).
int axtoi(const char *hexStg) int axtoi(const char *hexStg)
{ {
unsigned int intValue = 0; // integer value of hex string unsigned int intValue = 0; // integer value of hex string
sscanf(hexStg, "%x", &intValue); sscanf(hexStg, "%x", &intValue);
return (intValue); return (intValue);
} }
...@@ -115,7 +114,6 @@ int axtoi(const char *hexStg) ...@@ -115,7 +114,6 @@ int axtoi(const char *hexStg)
/** A standard string. /** A standard string.
A standard string created with standard template libraries.*/ A standard string created with standard template libraries.*/
typedef core::stringc stdstring;
typedef core::stringc String; typedef core::stringc String;
//Define a class StringList based on core::array and the defined class String //Define a class StringList based on core::array and the defined class String
...@@ -153,7 +151,7 @@ public: ...@@ -153,7 +151,7 @@ public:
//Loads a stringlist from a file //Loads a stringlist from a file
//note that each String added to StringList //note that each String added to StringList
//is separed by a \\n character and it's present //is separated by a \\n character and it's present
//at the end of line. //at the end of line.
/** Loads a StringList from a file. /** Loads a StringList from a file.
This function loads a StringList from a file where each string is divided by a \\n char.*/ This function loads a StringList from a file where each string is divided by a \\n char.*/
...@@ -190,7 +188,7 @@ public: ...@@ -190,7 +188,7 @@ public:
} }
}; };
//This function subdivides a string in a list of strings //This function subdivides a string in a list of strings
/** This function subdivides strings divided by divider in a list of strings. /** This function subdivides strings divided by divider in a list of strings.
\return A StringList made of all strings divided by divider.*/ \return A StringList made of all strings divided by divider.*/
StringList SubdivideString(String str, String divider) StringList SubdivideString(String str, String divider)
...@@ -210,7 +208,7 @@ StringList SubdivideString(String str, String divider) ...@@ -210,7 +208,7 @@ StringList SubdivideString(String str, String divider)
while((str[c]!=divider[0]) && c<l) while((str[c]!=divider[0]) && c<l)
{ {
resultstr += str[c]; resultstr += str[c];
c++; ++c;
} }
//Remove spaces \t and \n from string in my implementation... //Remove spaces \t and \n from string in my implementation...
...@@ -218,7 +216,7 @@ StringList SubdivideString(String str, String divider) ...@@ -218,7 +216,7 @@ StringList SubdivideString(String str, String divider)
//a particular char. //a particular char.
resultstr.trim();//trims string resultstr resultstr.trim();//trims string resultstr
strings.Add(resultstr);//add trimmed string strings.Add(resultstr);//add trimmed string
c++; ++c;
} }
return strings; return strings;
...@@ -270,8 +268,8 @@ bool GetDMFHeader (StringList RawFile, dmfHeader & header) ...@@ -270,8 +268,8 @@ bool GetDMFHeader (StringList RawFile, dmfHeader & header)
//set Materials Number //set Materials Number
header.numMaterials=atoi(RawFile[offs].c_str()); header.numMaterials=atoi(RawFile[offs].c_str());
offs=offs + header.numMaterials; offs+=header.numMaterials;
offs++; ++offs;
//set Object Number //set Object Number
header.numObjects=atoi(RawFile[offs].c_str()); header.numObjects=atoi(RawFile[offs].c_str());
...@@ -291,9 +289,9 @@ bool GetDMFHeader (StringList RawFile, dmfHeader & header) ...@@ -291,9 +289,9 @@ bool GetDMFHeader (StringList RawFile, dmfHeader & header)
StringList wat=SubdivideString(RawFile[offs],String(";")); StringList wat=SubdivideString(RawFile[offs],String(";"));
StringList wat1=SubdivideString(wat[0],String("_")); StringList wat1=SubdivideString(wat[0],String("_"));
offs++; ++offs;
offs = offs + atoi(RawFile[offs].c_str()); offs += atoi(RawFile[offs].c_str());
offs++; ++offs;
fac=atoi(RawFile[offs].c_str()); fac=atoi(RawFile[offs].c_str());
...@@ -305,10 +303,12 @@ bool GetDMFHeader (StringList RawFile, dmfHeader & header) ...@@ -305,10 +303,12 @@ bool GetDMFHeader (StringList RawFile, dmfHeader & header)
offs++; offs++;
for(int j=0; j<fac; j++) for(int j=0; j<fac; j++)
{
if(!(wat1[0] == String("water") && wat[2] == String("0"))) if(!(wat1[0] == String("water") && wat[2] == String("0")))
header.numVertices=header.numVertices + atoi(RawFile[offs+j].c_str()); header.numVertices=header.numVertices + atoi(RawFile[offs+j].c_str());
else else
header.numWatVertices=header.numWatVertices + atoi(RawFile[offs + j].c_str()); header.numWatVertices=header.numWatVertices + atoi(RawFile[offs + j].c_str());
}
offs = offs + fac; offs = offs + fac;
} }
...@@ -418,7 +418,9 @@ You must give in input a StringList representing a DMF file loaded with LoadFrom ...@@ -418,7 +418,9 @@ You must give in input a StringList representing a DMF file loaded with LoadFrom
\return true if function succeed or false on fail.*/ \return true if function succeed or false on fail.*/
bool GetDMFWaterMaterials(StringList RawFile /**<StringList representing a DMF file.*/, bool GetDMFWaterMaterials(StringList RawFile /**<StringList representing a DMF file.*/,
dmfMaterial materials[]/**<Materials returned.*/, dmfMaterial materials[]/**<Materials returned.*/,
int num_material/**<Number of materials contained in DMF file.*/){ int num_material/**<Number of materials contained in DMF file.*/
)
{
int offs=4; int offs=4;
StringList temp; StringList temp;
StringList temp1; StringList temp1;
...@@ -470,13 +472,16 @@ bool GetDMFWaterMaterials(StringList RawFile /**<StringList representing a DMF f ...@@ -470,13 +472,16 @@ bool GetDMFWaterMaterials(StringList RawFile /**<StringList representing a DMF f
} }
return true; return true;
} }
/**This function extract an array of dmfVert and dmfFace from a DMF file. /**This function extract an array of dmfVert and dmfFace from a DMF file.
You must give in input a StringList representing a DMF file loaded with LoadFromFile and two arrays long enough. You must give in input a StringList representing a DMF file loaded with LoadFromFile and two arrays long enough.
Please use GetDMFHeader() before this function to know number of vertices and faces. Please use GetDMFHeader() before this function to know number of vertices and faces.
\return true if function succeed or false on fail.*/ \return true if function succeed or false on fail.*/
bool GetDMFVerticesFaces(StringList RawFile/**<StringList representing a DMF file.*/, bool GetDMFVerticesFaces(StringList RawFile/**<StringList representing a DMF file.*/,
dmfVert vertices[]/**<Vertices returned*/, dmfVert vertices[]/**<Vertices returned*/,
dmfFace faces[]/**Faces returned*/){ dmfFace faces[]/**Faces returned*/
)
{
int offs=3; int offs=3;
int offs1=0; int offs1=0;
StringList temp,temp1; StringList temp,temp1;
...@@ -493,8 +498,8 @@ bool GetDMFVerticesFaces(StringList RawFile/**<StringList representing a DMF fil ...@@ -493,8 +498,8 @@ bool GetDMFVerticesFaces(StringList RawFile/**<StringList representing a DMF fil
if (atof(temp1[0].c_str()) < 0.91) if (atof(temp1[0].c_str()) < 0.91)
return false;//not correct version return false;//not correct version
//end checking
//end checking
temp.clear(); temp.clear();
temp1.clear(); temp1.clear();
offs=offs + atoi(RawFile[offs].c_str()); offs=offs + atoi(RawFile[offs].c_str());
...@@ -561,13 +566,14 @@ bool GetDMFVerticesFaces(StringList RawFile/**<StringList representing a DMF fil ...@@ -561,13 +566,14 @@ bool GetDMFVerticesFaces(StringList RawFile/**<StringList representing a DMF fil
} }
/**This function extract an array of dmfLights from a DMF file. /**This function extract an array of dmfLights from a DMF file.
You must give in input a StringList representing a DMF file loaded with LoadFromFile You must give in input a StringList representing a DMF file loaded with
and one array long enough. LoadFromFile and one array long enough. Please use GetDMFHeader() before this
Please use GetDMFHeader() before this function to know number of dynamic lights. function to know number of dynamic lights.
\return true if function succeed or false on fail.*/ \return true if function succeed or false on fail.*/
bool GetDMFLights(StringList RawFile/**<StringList representing a DMF file.*/, bool GetDMFLights(StringList RawFile/**<StringList representing a DMF file.*/,
dmfLight lights[]/**<Lights returned.*/){ dmfLight lights[]/**<Lights returned.*/
)
{
int offs=3; int offs=3;
StringList temp,temp1; StringList temp,temp1;
...@@ -615,7 +621,8 @@ bool GetDMFLights(StringList RawFile/**<StringList representing a DMF file.*/, ...@@ -615,7 +621,8 @@ bool GetDMFLights(StringList RawFile/**<StringList representing a DMF file.*/,
{ {
offs++; offs++;
temp=SubdivideString(RawFile[offs],String(";")); temp=SubdivideString(RawFile[offs],String(";"));
if(atoi(temp[0].c_str())==1){ if(atoi(temp[0].c_str())==1)
{
temp1=SubdivideString(temp[18],String("_")); temp1=SubdivideString(temp[18],String("_"));
if(temp1[0]==String("dynamic")) if(temp1[0]==String("dynamic"))
{ {
...@@ -641,6 +648,7 @@ bool GetDMFLights(StringList RawFile/**<StringList representing a DMF file.*/, ...@@ -641,6 +648,7 @@ bool GetDMFLights(StringList RawFile/**<StringList representing a DMF file.*/,
return true; return true;
} }
/**This function extract an array of dmfWaterPlain,dmfVert and dmfFace from a DMF file. /**This function extract an array of dmfWaterPlain,dmfVert and dmfFace from a DMF file.
You must give in input a StringList representing a DMF file loaded with LoadFromFile and three arrays long enough. You must give in input a StringList representing a DMF file loaded with LoadFromFile and three arrays long enough.
Please use GetDMFHeader() before this function to know number of water plains and water faces as well as water vertices. Please use GetDMFHeader() before this function to know number of water plains and water faces as well as water vertices.
...@@ -648,7 +656,9 @@ Please use GetDMFHeader() before this function to know number of water plains an ...@@ -648,7 +656,9 @@ Please use GetDMFHeader() before this function to know number of water plains an
bool GetDMFWaterPlains(StringList RawFile/**<StringList representing a DMF file.*/, bool GetDMFWaterPlains(StringList RawFile/**<StringList representing a DMF file.*/,
dmfWaterPlain wat_planes[]/**<Water planes returned.*/, dmfWaterPlain wat_planes[]/**<Water planes returned.*/,
dmfVert vertices[]/**<Vertices returned*/, dmfVert vertices[]/**<Vertices returned*/,
dmfFace faces[]/**Faces returned*/){ dmfFace faces[]/**Faces returned*/
)
{
int offs=3; int offs=3;
int offs1=0; int offs1=0;
StringList temp,temp1; StringList temp,temp1;
...@@ -721,7 +731,6 @@ bool GetDMFWaterPlains(StringList RawFile/**<StringList representing a DMF file. ...@@ -721,7 +731,6 @@ bool GetDMFWaterPlains(StringList RawFile/**<StringList representing a DMF file.
case 4: case 4:
if(atof(userinfo[4].c_str())) if(atof(userinfo[4].c_str()))
wavelength = (float)atof(userinfo[4].c_str()); wavelength = (float)atof(userinfo[4].c_str());
break; break;
} }
} }
...@@ -769,7 +778,7 @@ bool GetDMFWaterPlains(StringList RawFile/**<StringList representing a DMF file. ...@@ -769,7 +778,7 @@ bool GetDMFWaterPlains(StringList RawFile/**<StringList representing a DMF file.
} }
face_cnt++; face_cnt++;
temp.clear(); temp.clear();
}; }
} }
offs=offs+fac; offs=offs+fac;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment