From 930459365b1ca8842acd1d36299bf8820e43242f Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Tue, 10 Jul 2012 03:52:01 -0700 Subject: [PATCH] Rename getShort->getUShort and getByte->getChar --- components/nif/controller.hpp | 8 +++---- components/nif/data.hpp | 39 ++++++++++++++++------------------- components/nif/nif_file.hpp | 6 +++--- components/nif/node.hpp | 2 +- components/nif/property.hpp | 12 +++++------ 5 files changed, 32 insertions(+), 35 deletions(-) diff --git a/components/nif/controller.hpp b/components/nif/controller.hpp index d00c1bc0e..cbc19cd8f 100644 --- a/components/nif/controller.hpp +++ b/components/nif/controller.hpp @@ -44,7 +44,7 @@ public: { next.read(nif); - flags = nif->getShort(); + flags = nif->getUShort(); frequency = nif->getFloat(); phase = nif->getFloat(); @@ -71,7 +71,7 @@ public: // At the moment, just skip it all nif->skip(111); - int s = nif->getShort(); + int s = nif->getUShort(); nif->skip(15 + s*40); } }; @@ -133,7 +133,7 @@ public: { Controller::read(nif); - nif->getShort(); // always 0 + nif->getUShort(); // always 0 data.read(nif); } @@ -189,7 +189,7 @@ public: { Controller::read(nif); data.read(nif); - nif->getByte(); // always 0 + nif->getChar(); // always 0 } void post(NIFFile *nif) diff --git a/components/nif/data.hpp b/components/nif/data.hpp index babc07545..e77fd6239 100644 --- a/components/nif/data.hpp +++ b/components/nif/data.hpp @@ -69,12 +69,12 @@ public: { Named::read(nif); - external = !!nif->getByte(); + external = !!nif->getChar(); if(external) filename = nif->getString(); else { - nif->getByte(); // always 1 + nif->getChar(); // always 1 data.read(nif); } @@ -82,7 +82,7 @@ public: mipmap = nif->getInt(); alpha = nif->getInt(); - nif->getByte(); // always 1 + nif->getChar(); // always 1 } void post(NIFFile *nif) @@ -102,7 +102,7 @@ public: void read(NIFFile *nif) { - int verts = nif->getShort(); + int verts = nif->getUShort(); if(nif->getInt()) 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 // flags of some sort. - int uvs = nif->getShort(); + int uvs = nif->getUShort(); uvs &= 0x3f; if(nif->getInt()) @@ -136,7 +136,7 @@ public: { ShapeData::read(nif); - int tris = nif->getShort(); + int tris = nif->getUShort(); if(tris) { // We have three times as many vertices as triangles, so this @@ -148,15 +148,12 @@ public: // Read the match list, which lists the vertices that are equal to // vertices. We don't actually need need this for anything, so // just skip it. - int verts = nif->getShort(); - if(verts) + int verts = nif->getUShort(); + for(int i=0;igetShort(); - nif->skip(num*sizeof(short)); - } + // Number of vertices matching vertex 'i' + int num = nif->getUShort(); + nif->skip(num*sizeof(short)); } } }; @@ -171,11 +168,11 @@ public: ShapeData::read(nif); // Should always match the number of vertices - activeCount = nif->getShort(); + activeCount = nif->getUShort(); // Skip all the info, we don't support particles yet - nif->getFloat(); // Active radius ? - nif->getShort(); // Number of valid entries in the following arrays ? + nif->getFloat(); // Active radius ? + nif->getUShort(); // Number of valid entries in the following arrays ? if(nif->getInt()) { @@ -421,11 +418,11 @@ public: bi.unknown = nif->getVector4(); // Number of vertex weights - bi.weights.resize(nif->getShort()); + bi.weights.resize(nif->getUShort()); for(size_t j = 0;j < bi.weights.size();j++) { - nif->load(bi.weights[j].vertex); - nif->load(bi.weights[j].weight); + bi.weights[j].vertex = nif->getUShort(); + bi.weights[j].weight = nif->getFloat(); } } } @@ -464,7 +461,7 @@ public: { int morphCount = nif->getInt(); int vertCount = nif->getInt(); - nif->getByte(); + nif->getChar(); int magic = nif->getInt(); /*int type =*/ nif->getInt(); diff --git a/components/nif/nif_file.hpp b/components/nif/nif_file.hpp index 6165f5811..2b46f84f3 100644 --- a/components/nif/nif_file.hpp +++ b/components/nif/nif_file.hpp @@ -164,8 +164,8 @@ public: } - char getByte() { char c; return load(c); } - unsigned short getShort() { unsigned short s; return load(s); } + char getChar() { char c; return load(c); } + unsigned short getUShort() { unsigned short s; return load(s); } int getInt() { int i; return load(i); } float getFloat() { float f; return load(f); } Ogre::Vector3 getVector() @@ -193,7 +193,7 @@ public: Transformation t; t.pos = getVector(); t.rotation = getMatrix(); - load(t.scale); + t.scale = getFloat(); t.velocity = getVector(); return t; } diff --git a/components/nif/node.hpp b/components/nif/node.hpp index 6ba3ce61d..f86ea5af9 100644 --- a/components/nif/node.hpp +++ b/components/nif/node.hpp @@ -55,7 +55,7 @@ public: { Named::read(nif); - flags = nif->getShort(); + flags = nif->getUShort(); trafo = nif->getTrafo(); props.read(nif); diff --git a/components/nif/property.hpp b/components/nif/property.hpp index 6ec277a62..1b455b14f 100644 --- a/components/nif/property.hpp +++ b/components/nif/property.hpp @@ -38,7 +38,7 @@ public: void read(NIFFile *nif) { Named::read(nif); - flags = nif->getShort(); + flags = nif->getUShort(); } }; @@ -176,8 +176,8 @@ struct S_MaterialProperty diffuse = nif->getVector(); specular = nif->getVector(); emissive = nif->getVector(); - nif->load(glossiness); - nif->load(alpha); + glossiness = nif->getFloat(); + alpha = nif->getFloat(); } }; @@ -196,8 +196,8 @@ struct S_VertexColorProperty void read(NIFFile *nif) { - nif->load(vertmode); - nif->load(lightmode); + vertmode = nif->getInt(); + lightmode = nif->getInt(); } }; @@ -253,7 +253,7 @@ struct S_AlphaProperty void read(NIFFile *nif) { - nif->load(threshold); + threshold = nif->getChar(); } };