Rename getShort->getUShort and getByte->getChar

This commit is contained in:
Chris Robinson 2012-07-10 03:52:01 -07:00
parent 95b804a104
commit 930459365b
5 changed files with 32 additions and 35 deletions

View file

@ -44,7 +44,7 @@ public:
{ {
next.read(nif); next.read(nif);
flags = nif->getShort(); flags = nif->getUShort();
frequency = nif->getFloat(); frequency = nif->getFloat();
phase = nif->getFloat(); phase = nif->getFloat();
@ -71,7 +71,7 @@ public:
// At the moment, just skip it all // At the moment, just skip it all
nif->skip(111); nif->skip(111);
int s = nif->getShort(); int s = nif->getUShort();
nif->skip(15 + s*40); nif->skip(15 + s*40);
} }
}; };
@ -133,7 +133,7 @@ public:
{ {
Controller::read(nif); Controller::read(nif);
nif->getShort(); // always 0 nif->getUShort(); // always 0
data.read(nif); data.read(nif);
} }
@ -189,7 +189,7 @@ public:
{ {
Controller::read(nif); Controller::read(nif);
data.read(nif); data.read(nif);
nif->getByte(); // always 0 nif->getChar(); // always 0
} }
void post(NIFFile *nif) void post(NIFFile *nif)

View file

@ -69,12 +69,12 @@ public:
{ {
Named::read(nif); Named::read(nif);
external = !!nif->getByte(); external = !!nif->getChar();
if(external) if(external)
filename = nif->getString(); filename = nif->getString();
else else
{ {
nif->getByte(); // always 1 nif->getChar(); // always 1
data.read(nif); data.read(nif);
} }
@ -82,7 +82,7 @@ public:
mipmap = nif->getInt(); mipmap = nif->getInt();
alpha = nif->getInt(); alpha = nif->getInt();
nif->getByte(); // always 1 nif->getChar(); // always 1
} }
void post(NIFFile *nif) void post(NIFFile *nif)
@ -102,7 +102,7 @@ public:
void read(NIFFile *nif) void read(NIFFile *nif)
{ {
int verts = nif->getShort(); int verts = nif->getUShort();
if(nif->getInt()) if(nif->getInt())
nif->load(vertices, verts*3); nif->load(vertices, verts*3);
@ -118,7 +118,7 @@ public:
// Only the first 6 bits are used as a count. I think the rest are // Only the first 6 bits are used as a count. I think the rest are
// flags of some sort. // flags of some sort.
int uvs = nif->getShort(); int uvs = nif->getUShort();
uvs &= 0x3f; uvs &= 0x3f;
if(nif->getInt()) if(nif->getInt())
@ -136,7 +136,7 @@ public:
{ {
ShapeData::read(nif); ShapeData::read(nif);
int tris = nif->getShort(); int tris = nif->getUShort();
if(tris) if(tris)
{ {
// We have three times as many vertices as triangles, so this // We have three times as many vertices as triangles, so this
@ -148,17 +148,14 @@ public:
// Read the match list, which lists the vertices that are equal to // Read the match list, which lists the vertices that are equal to
// vertices. We don't actually need need this for anything, so // vertices. We don't actually need need this for anything, so
// just skip it. // just skip it.
int verts = nif->getShort(); int verts = nif->getUShort();
if(verts)
{
for(int i=0;i<verts;i++) for(int i=0;i<verts;i++)
{ {
// Number of vertices matching vertex 'i' // Number of vertices matching vertex 'i'
short num = nif->getShort(); int num = nif->getUShort();
nif->skip(num*sizeof(short)); nif->skip(num*sizeof(short));
} }
} }
}
}; };
class NiAutoNormalParticlesData : public ShapeData class NiAutoNormalParticlesData : public ShapeData
@ -171,11 +168,11 @@ public:
ShapeData::read(nif); ShapeData::read(nif);
// Should always match the number of vertices // Should always match the number of vertices
activeCount = nif->getShort(); activeCount = nif->getUShort();
// Skip all the info, we don't support particles yet // Skip all the info, we don't support particles yet
nif->getFloat(); // Active radius ? nif->getFloat(); // Active radius ?
nif->getShort(); // Number of valid entries in the following arrays ? nif->getUShort(); // Number of valid entries in the following arrays ?
if(nif->getInt()) if(nif->getInt())
{ {
@ -421,11 +418,11 @@ public:
bi.unknown = nif->getVector4(); bi.unknown = nif->getVector4();
// Number of vertex weights // Number of vertex weights
bi.weights.resize(nif->getShort()); bi.weights.resize(nif->getUShort());
for(size_t j = 0;j < bi.weights.size();j++) for(size_t j = 0;j < bi.weights.size();j++)
{ {
nif->load(bi.weights[j].vertex); bi.weights[j].vertex = nif->getUShort();
nif->load(bi.weights[j].weight); bi.weights[j].weight = nif->getFloat();
} }
} }
} }
@ -464,7 +461,7 @@ public:
{ {
int morphCount = nif->getInt(); int morphCount = nif->getInt();
int vertCount = nif->getInt(); int vertCount = nif->getInt();
nif->getByte(); nif->getChar();
int magic = nif->getInt(); int magic = nif->getInt();
/*int type =*/ nif->getInt(); /*int type =*/ nif->getInt();

View file

@ -164,8 +164,8 @@ public:
} }
char getByte() { char c; return load(c); } char getChar() { char c; return load(c); }
unsigned short getShort() { unsigned short s; return load(s); } unsigned short getUShort() { unsigned short s; return load(s); }
int getInt() { int i; return load(i); } int getInt() { int i; return load(i); }
float getFloat() { float f; return load(f); } float getFloat() { float f; return load(f); }
Ogre::Vector3 getVector() Ogre::Vector3 getVector()
@ -193,7 +193,7 @@ public:
Transformation t; Transformation t;
t.pos = getVector(); t.pos = getVector();
t.rotation = getMatrix(); t.rotation = getMatrix();
load(t.scale); t.scale = getFloat();
t.velocity = getVector(); t.velocity = getVector();
return t; return t;
} }

View file

@ -55,7 +55,7 @@ public:
{ {
Named::read(nif); Named::read(nif);
flags = nif->getShort(); flags = nif->getUShort();
trafo = nif->getTrafo(); trafo = nif->getTrafo();
props.read(nif); props.read(nif);

View file

@ -38,7 +38,7 @@ public:
void read(NIFFile *nif) void read(NIFFile *nif)
{ {
Named::read(nif); Named::read(nif);
flags = nif->getShort(); flags = nif->getUShort();
} }
}; };
@ -176,8 +176,8 @@ struct S_MaterialProperty
diffuse = nif->getVector(); diffuse = nif->getVector();
specular = nif->getVector(); specular = nif->getVector();
emissive = nif->getVector(); emissive = nif->getVector();
nif->load(glossiness); glossiness = nif->getFloat();
nif->load(alpha); alpha = nif->getFloat();
} }
}; };
@ -196,8 +196,8 @@ struct S_VertexColorProperty
void read(NIFFile *nif) void read(NIFFile *nif)
{ {
nif->load(vertmode); vertmode = nif->getInt();
nif->load(lightmode); lightmode = nif->getInt();
} }
}; };
@ -253,7 +253,7 @@ struct S_AlphaProperty
void read(NIFFile *nif) void read(NIFFile *nif)
{ {
nif->load(threshold); threshold = nif->getChar();
} }
}; };