Permalink
Browse files

ALL: Assorted coding style fixes

  • Loading branch information...
1 parent 5c851e8 commit ac73b55ff210a6be31c108f47101369a3940cb58 @DrMcCoy DrMcCoy committed Apr 27, 2012
View
10 src/common/fft.cpp
@@ -71,7 +71,7 @@ void FFT::permute(Complex *z) {
int np = 1 << _bits;
if (_tmpBuf) {
- for(int j = 0; j < np; j++)
+ for (int j = 0; j < np; j++)
_tmpBuf[_revTab[j]] = z[j];
std::memcpy(z, _tmpBuf, np * sizeof(Complex));
@@ -80,7 +80,7 @@ void FFT::permute(Complex *z) {
}
// Reverse
- for(int j = 0; j < np; j++) {
+ for (int j = 0; j < np; j++) {
int k = _revTab[j];
if (k < j)
@@ -94,12 +94,12 @@ int FFT::splitRadixPermutation(int i, int n, bool inverse) {
int m = n >> 1;
- if(!(i & m))
+ if (!(i & m))
return splitRadixPermutation(i, m, inverse) * 2;
m >>= 1;
- if(inverse == !(i & m))
+ if (inverse == !(i & m))
return splitRadixPermutation(i, m, inverse) * 4 + 1;
return splitRadixPermutation(i, m, inverse) * 4 - 1;
@@ -169,7 +169,7 @@ static void name(Complex *z, const float *wre, unsigned int n)\
wim -= 2;\
TRANSFORM(z[0],z[o1],z[o2],z[o3],wre[0],wim[0]);\
TRANSFORM(z[1],z[o1+1],z[o2+1],z[o3+1],wre[1],wim[-1]);\
- } while(--n);\
+ } while (--n);\
}
PASS(pass)
View
8 src/common/mdct.cpp
@@ -80,7 +80,7 @@ void MDCT::calcMDCT(float *output, const float *input) {
const uint16 *revTab = _fft->getRevTab();
// Pre rotation
- for(int i = 0; i < size8; i++) {
+ for (int i = 0; i < size8; i++) {
float re = -input[2 * i + size3] - input[size3 - 1 - 2 * i];
float im = -input[2 * i + size4] + input[size4 - 1 - 2 * i];
int j = revTab[i];
@@ -97,7 +97,7 @@ void MDCT::calcMDCT(float *output, const float *input) {
_fft->calc(x);
// Post rotation
- for(int i = 0; i < size8; i++) {
+ for (int i = 0; i < size8; i++) {
float r0, i0, r1, i1;
CMUL(i1, r0, x[size8-i-1].re, x[size8-i-1].im, -_tSin[size8-i-1], -_tCos[size8-i-1]);
@@ -134,7 +134,7 @@ void MDCT::calcHalfIMDCT(float *output, const float *input) {
// Pre rotation
const float *in1 = input;
const float *in2 = input + size2 - 1;
- for(int k = 0; k < size4; k++) {
+ for (int k = 0; k < size4; k++) {
const int j = revTab[k];
CMUL(z[j].re, z[j].im, *in2, *in1, _tCos[k], _tSin[k]);
@@ -146,7 +146,7 @@ void MDCT::calcHalfIMDCT(float *output, const float *input) {
_fft->calc(z);
// Post rotation + reordering
- for(int k = 0; k < size8; k++) {
+ for (int k = 0; k < size8; k++) {
float r0, i0, r1, i1;
CMUL(r0, i1, z[size8-k-1].im, z[size8-k-1].re, _tSin[size8-k-1], _tCos[size8-k-1]);
View
12 src/engines/nwn/creature.cpp
@@ -391,13 +391,13 @@ void Creature::getArmorModels() {
}
status("Equipping armour \"%s\" on model \"%s\"", item.getName().c_str(), _tag.c_str());
- //set the body part models
+ // Set the body part models
for (uint i = 0; i < kBodyPartMAX; i++) {
int id = item.getArmorPart(i);
if (id > 0)
_bodyParts[i].armor_id = id;
}
- //set the armour color channels
+ // Set the armour color channels
_colorMetal1 = item._colorMetal1;
_colorMetal2 = item._colorMetal2;
_colorLeather1 = item._colorLeather1;
@@ -460,7 +460,7 @@ void Creature::loadModel() {
// Add the loaded model to the appropriate part node
Graphics::Aurora::ModelNode *part_node = _model->getNode(kBodyPartNodes[i]);
- if(part_node)
+ if (part_node)
part_node->addChild(part_model);
TextureMan.getNewPLTs(_bodyParts[i].plts);
@@ -708,7 +708,7 @@ void Creature::loadProperties(const Aurora::GFFStruct &gff) {
_colorTattoo1 = gff.getUint("Color_Tattoo1", _colorTattoo1);
_colorTattoo2 = gff.getUint("Color_Tattoo2", _colorTattoo2);
- //Equipped Items
+ // Equipped Items
loadEquippedItems(gff);
// Scripts
@@ -729,7 +729,7 @@ void Creature::loadPortrait(const Aurora::GFFStruct &gff, Common::UString &portr
}
void Creature::loadEquippedItems(const Aurora::GFFStruct &gff) {
- if(!gff.hasField("Equip_ItemList"))
+ if (!gff.hasField("Equip_ItemList"))
return;
const Aurora::GFFList &cEquipped = gff.getList("Equip_ItemList");
@@ -753,7 +753,7 @@ void Creature::loadEquippedItems(const Aurora::GFFStruct &gff) {
item->load(cItem, uti ? &uti->getTopLevel() : 0);
- //add it to the equipped list
+ // Add it to the equipped list
_equippedItems.push_back(*item);
delete uti;
View
18 src/engines/nwn/door.cpp
@@ -220,10 +220,10 @@ bool Door::open(Object *opener) {
}
_state = kStateOpened1;
- //setModelState();
+ // setModelState();
playSound(_soundOpened);
- if(_model)
+ if (_model)
_model->playAnimation("opening1");
runScript(kScriptOpen, this, opener);
@@ -243,10 +243,10 @@ bool Door::close(Object *closer) {
return false;
_state = kStateClosed;
- //setModelState();
+ // setModelState();
playSound(_soundClosed);
- if(_model)
+ if (_model)
_model->playAnimation("closing1");
runScript(kScriptClosed, this, closer);
@@ -283,36 +283,36 @@ void Door::playAnimation(Animation animation) {
switch (animation) {
case kAnimationDoorClose:
playSound(_soundClosed);
- if(_model)
+ if (_model)
_model->playAnimation("closing1");
_state = kStateClosed;
break;
case kAnimationDoorOpen1:
playSound(_soundOpened);
- if(_model)
+ if (_model)
_model->playAnimation("opening1");
_state = kStateOpened1;
break;
case kAnimationDoorOpen2:
playSound(_soundOpened);
- if(_model)
+ if (_model)
_model->playAnimation("opening2");
_state = kStateOpened2;
break;
case kAnimationDoorDestroy:
warning("TODO: Door::playAnimation(): kAnimationDoorDestroy");
- if(_model)
+ if (_model)
_model->playAnimation("die");
break;
default:
break;
}
- //setModelState();
+ // setModelState();
}
} // End of namespace NWN
View
37 src/engines/nwn/item.cpp
@@ -107,11 +107,11 @@ void Item::hide() {
}
void Item::load(const Aurora::GFFStruct &instance, const Aurora::GFFStruct *blueprint) {
- //UTI def has a baseitem (index into baseitem.2da, determines equippable slots, model type)
- //armour is 16, modeltype 3
- //can look up armorpart_bodypart id
- //them use that to construct model names
- //
+ // UTI def has a baseitem (index into baseitem.2da, determines equippable slots, model type)
+ // armour is 16, modeltype 3
+ // can look up armorpart_bodypart id
+ // them use that to construct model names
+
// General properties
if (blueprint)
@@ -121,21 +121,20 @@ void Item::load(const Aurora::GFFStruct &instance, const Aurora::GFFStruct *blue
// Specialized object properties
-// if (blueprint)
-// loadObject(*blueprint); // Blueprint
-// loadObject(instance); // Instance
-
+ // if (blueprint)
+ // loadObject(*blueprint); // Blueprint
+ // loadObject(instance); // Instance
- //TODO:
- // baseitem -- needed for inventory UI interactions
- // stacksize -- used by inventory UI
+ // TODO:
+ // baseitem -- needed for inventory UI interactions
+ // stacksize -- used by inventory UI
// Appearance
- //if (_appearanceID == Aurora::kFieldIDInvalid)
- //throw Common::Exception("Item object without an appearance");
+ // if (_appearanceID == Aurora::kFieldIDInvalid)
+ // throw Common::Exception("Item object without an appearance");
-// loadAppearance();
+ // loadAppearance();
loadSounds();
}
@@ -159,10 +158,10 @@ void Item::loadProperties(const Aurora::GFFStruct &gff) {
_description = description.getString();
}
- //this is an index into basitem.2da which contains inventory slot info
+ // This is an index into basitem.2da which contains inventory slot info
_baseitem = gff.getUint("BaseItem", _baseitem);
- //TODO: are these armor only?
+ // TODO: Are these armor only?
_colorMetal1 = gff.getUint("Metal1Color", _colorMetal1);
_colorMetal2 = gff.getUint("Metal2Color", _colorMetal2);
_colorLeather1 = gff.getUint("Leather1Color", _colorLeather1);
@@ -199,7 +198,7 @@ void Item::loadSounds() {
}
static const char *kArmorPartFields[] = {
- "Appearance_Head", //heads appear to be a special case
+ "Appearance_Head", // Heads appear to be a special case
"ArmorPart_Neck" ,
"ArmorPart_Torso" ,
"ArmorPart_Pelvis",
@@ -224,7 +223,7 @@ void Item::loadArmorParts(const Aurora::GFFStruct &gff)
}
bool Item::isArmor() {
- //TODO: this should really be based on the baseitem.2da
+ // TODO: This should really be based on the baseitem.2da
return _armorParts[kArmorPartTorso].id > 0;
}
View
16 src/engines/nwn/item.h
@@ -57,13 +57,13 @@ class Item : public Object {
bool isArmor();
int getArmorPart(int index);
- //TODO: use _colors array like plt file
- uint32 _colorMetal1; ///< The 1. color of the creature's metal armor.
- uint32 _colorMetal2; ///< The 2. color of the creature's metal armor.
+ // TODO: Use _colors array like plt file
+ uint32 _colorMetal1; ///< The 1. color of the creature's metal armor.
+ uint32 _colorMetal2; ///< The 2. color of the creature's metal armor.
uint32 _colorLeather1; ///< The 1. color of the creature's leather armor.
uint32 _colorLeather2; ///< The 2. color of the creature's leather armor.
- uint32 _colorCloth1; ///< The 1. color of the creature's cloth armor.
- uint32 _colorCloth2; ///< The 2. color of the creature's cloth armor.
+ uint32 _colorCloth1; ///< The 1. color of the creature's cloth armor.
+ uint32 _colorCloth2; ///< The 2. color of the creature's cloth armor.
protected:
Common::UString _modelName; ///< The model's resource name.
@@ -78,9 +78,9 @@ class Item : public Object {
/** Load the situated object from an instance and its blueprint. */
/** Load object-specific properties. */
- //virtual void loadObject(const Aurora::GFFStruct &gff) = 0;
+ // virtual void loadObject(const Aurora::GFFStruct &gff) = 0;
/** Load appearance-specific properties. */
- //virtual void loadAppearance() = 0;
+ // virtual void loadAppearance() = 0;
private:
@@ -112,7 +112,7 @@ class Item : public Object {
void loadArmorParts(const Aurora::GFFStruct &gff);
void loadSounds();
- /** index to appropriate armor part. */
+ /** Index to appropriate armor part. */
struct ArmorPart {
uint32 id; ///< Index of the part variant.
};
View
6 src/engines/nwn/modelloader.cpp
@@ -52,9 +52,9 @@ Graphics::Aurora::Model *NWNModelLoader::load(const Common::UString &resref,
throw;
}
- //if supermodel
- //check model cache
- //else load supermodel and insert into cache
+ // if supermodel
+ // check model cache
+ // else load supermodel and insert into cache
return model;
}
View
6 src/graphics/aurora/animation.cpp
@@ -72,8 +72,8 @@ void Animation::setTransTime(float transtime) {
}
void Animation::update(Model *model, float lastFrame, float nextFrame) {
- //TODO: also need to fire off associated events
- //for event in _events event->fire()
+ // TODO: Also need to fire off associated events
+ // for event in _events event->fire()
float scale = model->getAnimationScale(_name);
@@ -83,7 +83,7 @@ void Animation::update(Model *model, float lastFrame, float nextFrame) {
}
}
-void Animation::addAnimNode(AnimNode* node) {
+void Animation::addAnimNode(AnimNode *node) {
nodeList.push_back(node);
nodeMap.insert(std::make_pair(node->getName(), node));
}
View
2 src/graphics/aurora/animation.h
@@ -82,7 +82,7 @@ class Animation {
void setTransTime(float transtime);
void update(Model *model, float lastFrame, float nextFrame);
- void addAnimNode(AnimNode* node);
+ void addAnimNode(AnimNode *node);
};
} // End of namespace Aurora
View
14 src/graphics/aurora/animnode.cpp
@@ -42,7 +42,7 @@ namespace Aurora {
AnimNode::AnimNode(ModelNode *modelnode) :
_parent(0) {
- // actual data is loaded as a generic modelnode
+ // Actual data is loaded as a generic modelnode
_nodedata = modelnode;
if (modelnode)
_name = modelnode->getName();
@@ -68,19 +68,23 @@ const Common::UString &AnimNode::getName() const {
}
void AnimNode::update(Model *model, float lastFrame, float nextFrame, float scale) {
- if(!_nodedata)
+ if (!_nodedata)
return;
- //determine the corresponding keyframes
+
+ // Determine the corresponding keyframes
float curX, curY, curZ;
_nodedata->interpolatePosition(nextFrame, curX, curY, curZ);
+
float oX, oY, oZ, oA;
_nodedata->interpolateOrientation(nextFrame, oX, oY, oZ, oA);
+
ModelNode *target = model->getNode(_name);
- if(target) {
+ if (target) {
target->setPosition(curX * scale, curY * scale, curZ * scale);
target->setOrientation(oX, oY, oZ, oA);
}
- //update the position/orientation of corresponding modelnode
+
+ // Update the position/orientation of corresponding modelnode
}
} // End of namespace Aurora
View
6 src/graphics/aurora/animnode.h
@@ -50,7 +50,7 @@ class ModelNode;
class AnimNode {
public:
- AnimNode(ModelNode* modelnode);
+ AnimNode(ModelNode *modelnode);
~AnimNode();
/** Get the node's name. */
@@ -59,7 +59,7 @@ class AnimNode {
/** Update the model properties interpolating between frames */
void update(Model *model, float lastFrame, float nextFrame, float scale);
protected:
-// Animation *_animation; ///< The animation this node belongs to.
+ // Animation *_animation; ///< The animation this node belongs to.
AnimNode *_parent; ///< The node's parent.
std::list<AnimNode *> _children; ///< The node's children.
@@ -75,7 +75,7 @@ class AnimNode {
void setParent(AnimNode *parent); ///< Set the node's parent.
- //void reparent(AnimNode &parent);
+ // void reparent(AnimNode &parent);
friend class Animation;
View
56 src/graphics/aurora/model.cpp
@@ -57,7 +57,8 @@ Model::Model(ModelType type) : Renderable((RenderableType) type),
_rotation[0] = 0.0; _rotation[1] = 0.0; _rotation[2] = 0.0;
_modelScale[0] = 1.0; _modelScale[1] = 1.0; _modelScale[2] = 1.0;
- //TODO: is this the same as modelScale for non-UI?
+
+ // TODO: Is this the same as modelScale for non-UI?
_animationScale = 1.0;
_elapsedTime = 0.0;
}
@@ -138,7 +139,7 @@ void Model::drawBound(bool enabled) {
}
void Model::playAnimation(const Common::UString &anim) {
- Animation* nextanim = getAnimation(anim);
+ Animation *nextanim = getAnimation(anim);
_nextAnimation = nextanim;
}
@@ -157,18 +158,18 @@ static const char *kDefaultAnims[] = {
void Model::populateDefaultAnimations() {
_defaultAnimations.clear();
- Animation *anim;
- //TODO: there's probably a cleaner way to do this, but its late
- for(int i = 0; i < 9; i++) {
- anim = getAnimation(kDefaultAnims[i]);
- if(anim)
+
+ // TODO: There's probably a cleaner way to do this, but it's late
+ for (int i = 0; i < 9; i++) {
+ Animation *anim = getAnimation(kDefaultAnims[i]);
+ if (anim)
_defaultAnimations.push_back(anim);
}
}
void Model::selectDefaultAnimation() {
- //TODO: select a default animation randomly instead of just the first one
- if(_defaultAnimations.empty()) {
+ // TODO: Select a default animation randomly instead of just the first one
+ if (_defaultAnimations.empty()) {
_currentAnimation = 0;
return;
}
@@ -299,6 +300,7 @@ void Model::setState(const Common::UString &name) {
_currentState = state;
// TODO: Do we need to recreate the bounding box on a state change?
+
// createBound();
if (visible)
@@ -334,7 +336,7 @@ ModelNode *Model::getNode(const Common::UString &node) {
NodeMap::iterator n = _currentState->nodeMap.find(node);
if (n == _currentState->nodeMap.end()) {
- if(_supermodel)
+ if (_supermodel)
return _supermodel->getNode(node);
return 0;
@@ -349,7 +351,7 @@ const ModelNode *Model::getNode(const Common::UString &node) const {
NodeMap::const_iterator n = _currentState->nodeMap.find(node);
if (n == _currentState->nodeMap.end()) {
- if(_supermodel)
+ if (_supermodel)
return _supermodel->getNode(node);
return 0;
@@ -362,7 +364,7 @@ Animation *Model::getAnimation(const Common::UString &anim) {
AnimationMap::iterator n = _animationMap.find(anim);
if (n == _animationMap.end()) {
- if(_supermodel)
+ if (_supermodel)
return _supermodel->getAnimation(anim);
return 0;
@@ -372,16 +374,16 @@ Animation *Model::getAnimation(const Common::UString &anim) {
}
float Model::getAnimationScale(const Common::UString &anim) {
- //TODO: we can cache this for performance
+ // TODO: We can cache this for performance
AnimationMap::iterator n = _animationMap.find(anim);
if (n == _animationMap.end()) {
- //animation scaling only applies to inherited animations
- if(_supermodel)
+ // Animation scaling only applies to inherited animations
+ if (_supermodel)
return _animationScale * _supermodel->getAnimationScale(anim);
- //can't find it, return sensible default
+ // Can't find it, return sensible default
return 1.0f;
}
- //we found it, don't scale further
+ // We found it, don't scale further
return 1.0f;
}
@@ -463,32 +465,30 @@ void Model::manageAnimations(float dt) {
float nextFrame = _elapsedTime + dt;
_elapsedTime = nextFrame;
- // start a new animation if scheduled
- if(_nextAnimation) {
- // note that this interrupts the current animation!
+ // Start a new animation if scheduled
+ if (_nextAnimation) {
+ // Note that this interrupts the current animation!
_currentAnimation = _nextAnimation;
_nextAnimation = 0;
_elapsedTime = 0;
lastFrame = 0;
nextFrame = 0;
}
- // if there is no current animation,
- // select a default animation
- if(!_currentAnimation)
+ // If there is no current animation, select a default animation
+ if (!_currentAnimation)
selectDefaultAnimation();
- // if the current animation has finished,
- // start a default animation
- if(_currentAnimation && nextFrame >= _currentAnimation->getLength()) {
- //debug output
+ // If the current animation has finished, start a default animation
+ if (_currentAnimation && nextFrame >= _currentAnimation->getLength()) {
+ // Debug output
selectDefaultAnimation();
_elapsedTime = 0.0f;
lastFrame = 0;
nextFrame = 0;
}
- if(_currentAnimation)
+ if (_currentAnimation)
_currentAnimation->update(this, lastFrame, nextFrame);
}
View
8 src/graphics/aurora/model.h
@@ -129,13 +129,13 @@ class Model : public GLContainer, public Renderable {
/** Get the specified node, from the current state. */
Animation *getAnimation(const Common::UString &anim);
- /** play a named animation */
+ /** Play a named animation */
void playAnimation(const Common::UString &anim);
- /** create the list of default animations */
+ /** Create the list of default animations */
void populateDefaultAnimations();
- /** select the default idle animation */
+ /** Select the default idle animation */
void selectDefaultAnimation();
- /** determine what animation scaling applies */
+ /** Determine what animation scaling applies */
float getAnimationScale(const Common::UString &anim);
// Renderable
View
42 src/graphics/aurora/model_nwn.cpp
@@ -169,7 +169,7 @@ bool Model_NWN::ParserContext::findNode(const Common::UString &name,
Model_NWN::Model_NWN(const Common::UString &name, ModelType type,
- const Common::UString &texture, std::map<Common::UString, Model*, Common::UString::iless> *modelCache) :
+ const Common::UString &texture, std::map<Common::UString, Model *, Common::UString::iless> *modelCache) :
Model(type) {
if (_type == kModelTypeGUIFront) {
@@ -187,16 +187,16 @@ Model_NWN::Model_NWN(const Common::UString &name, ModelType type,
else
loadBinary(ctx);
- if(!_superModelName.empty() && _superModelName != "NULL") {
- if((*modelCache).count(_superModelName)>0)
+ if (!_superModelName.empty() && _superModelName != "NULL") {
+ if ((*modelCache).count(_superModelName)>0)
_supermodel = (*modelCache)[_superModelName];
else {
_supermodel = new Model_NWN(_superModelName, type, "", modelCache);
(*modelCache)[_superModelName] = _supermodel;
}
}
- // these are usually inherited from a supermodel
+ // These are usually inherited from a supermodel
populateDefaultAnimations();
finalize();
@@ -330,7 +330,7 @@ void Model_NWN::loadASCII(ParserContext &ctx) {
} else if (line[0] == "donemodel") {
break;
} else
- ;//warning("Unknown MDL command \"%s\"", line[0].c_str());
+ ; // warning("Unknown MDL command \"%s\"", line[0].c_str());
}
addState(ctx);
@@ -376,12 +376,12 @@ void Model_NWN::skipAnimASCII(ParserContext &ctx) {
void Model_NWN::readAnimASCII(ParserContext &ctx) {
// TODO: Model_NWN_ASCII::readAnimASCII
- // read in the animation name
- // there should be a list of animations
- // each with a bunch of animnodes
- // each animnode targets a model node
- // and has a list of position, orientation keyframes
- // (at time t, position, orientation = x)
+ // read in the animation name
+ // there should be a list of animations
+ // each with a bunch of animnodes
+ // each animnode targets a model node
+ // and has a list of position, orientation keyframes
+ // (at time t, position, orientation = x)
}
void Model_NWN::addState(ParserContext &ctx) {
@@ -437,7 +437,7 @@ void Model_NWN::readAnimBinary(ParserContext &ctx, uint32 offset) {
readArrayDef(*ctx.mdl, eventOffset, eventCount);
// Associated events
- // TODO: save in array, then pass to animation class
+ // TODO: Save in array, then pass to animation class
ctx.mdl->seekTo(ctx.offModelData + eventOffset);
for (uint32 i = 0; i < eventCount; i++) {
float after = ctx.mdl->readIEEEFloatLE();
@@ -452,10 +452,10 @@ void Model_NWN::readAnimBinary(ParserContext &ctx, uint32 offset) {
ctx.mdl->seek(ctx.offModelData + nodeHeadPointer);
rootNode->load(ctx);
- //we read this in, but what do we do with it??
- //ah, we call addState, interesting
- //need to look at interaction with placeable states?
- Animation* anim = new Animation();
+ // We read this in, but what do we do with it??
+ // Ah, we call addState, interesting
+ // Need to look at interaction with placeable states?
+ Animation *anim = new Animation();
anim->setName(ctx.state->name);
anim->setLength(animLength);
anim->setTransTime(transTime);
@@ -464,7 +464,7 @@ void Model_NWN::readAnimBinary(ParserContext &ctx, uint32 offset) {
for (std::list<ModelNode *>::iterator n = ctx.nodes.begin();
n != ctx.nodes.end(); ++n) {
- AnimNode* animnode = new AnimNode(*n);
+ AnimNode *animnode = new AnimNode(*n);
anim->addAnimNode(animnode);
}
@@ -826,7 +826,7 @@ void ModelNode_NWN_Binary::readNodeControllers(Model_NWN::ParserContext &ctx,
if (type == kControllerTypePosition) {
if (columnCount != 3)
throw Common::Exception("Position controller with %d values", columnCount);
- for(int r = 0; r < rowCount; r++) {
+ for (int r = 0; r < rowCount; r++) {
PositionKeyFrame p;
p.time = data[timeIndex + r];
p.x = data[dataIndex + (r * columnCount) + 0];
@@ -847,7 +847,7 @@ void ModelNode_NWN_Binary::readNodeControllers(Model_NWN::ParserContext &ctx,
if (columnCount != 4)
throw Common::Exception("Orientation controller with %d values", columnCount);
- for(int r = 0; r < rowCount; r++) {
+ for (int r = 0; r < rowCount; r++) {
QuaternionKeyFrame q;
q.time = data[timeIndex + r];
q.x = data[dataIndex + (r * columnCount) + 0];
@@ -856,7 +856,7 @@ void ModelNode_NWN_Binary::readNodeControllers(Model_NWN::ParserContext &ctx,
q.q = data[dataIndex + (r * columnCount) + 3];
_orientationFrames.push_back(q);
// Starting orientation
- // TODO: handle animation orientation correctly
+ // TODO: Handle animation orientation correctly
if (data[timeIndex + 0] == 0.0) {
_orientation[0] = data[dataIndex + 0];
_orientation[1] = data[dataIndex + 1];
@@ -989,7 +989,7 @@ void ModelNode_NWN_ASCII::load(Model_NWN::ParserContext &ctx,
readFaces(ctx, mesh);
} else
- ;//warning("Unknown MDL node command \"%s\"", line[0].c_str());
+ ; // warning("Unknown MDL node command \"%s\"", line[0].c_str());
}
if (!end)
View
26 src/graphics/aurora/modelnode.cpp
@@ -244,7 +244,7 @@ void ModelNode::addChild(Model *model) {
for (Model::NodeList::iterator r = model->_currentState->rootNodes.begin();
r != model->_currentState->rootNodes.end(); ++r) {
- //TODO: Maybe we're REPLACING an existing node?
+ // TODO: Maybe we're REPLACING an existing node?
_children.push_back(*r);
(*r)->reparent(*this);
@@ -503,23 +503,22 @@ void ModelNode::render(RenderPass pass) {
}
void ModelNode::interpolatePosition(float time, float &x, float &y, float &z) const {
- //if less than 2 keyframes, don't interpolate
- //just return the only position
- if(_positionFrames.size() < 2) {
+ // If less than 2 keyframes, don't interpolate, just return the only position
+ if (_positionFrames.size() < 2) {
getPosition(x, y, z);
return;
}
uint32 lastFrame = 0;
- for(uint32 i = 0; i < _positionFrames.size(); i++) {
+ for (uint32 i = 0; i < _positionFrames.size(); i++) {
PositionKeyFrame pos = _positionFrames[i];
- if(pos.time < time)
+ if (pos.time < time)
lastFrame = i;
else
break;
}
PositionKeyFrame last = _positionFrames[lastFrame];
- if(lastFrame + 1 >= _positionFrames.size() || last.time == time) {
+ if (lastFrame + 1 >= _positionFrames.size() || last.time == time) {
x = last.x;
y = last.y;
z = last.z;
@@ -533,24 +532,23 @@ void ModelNode::interpolatePosition(float time, float &x, float &y, float &z) co
z = f * next.z + (1.0f - f) * last.z;
}
-void ModelNode::interpolateOrientation(float time, float &x, float &y, float &z, float& a) const {
- //if less than 2 keyframes, don't interpolate
- //just return the only orientation
- if(_orientationFrames.size() < 2) {
+void ModelNode::interpolateOrientation(float time, float &x, float &y, float &z, float &a) const {
+ // If less than 2 keyframes, don't interpolate just return the only orientation
+ if (_orientationFrames.size() < 2) {
getOrientation(x, y, z, a);
return;
}
uint32 lastFrame = 0;
- for(uint32 i = 0; i < _orientationFrames.size(); i++) {
+ for (uint32 i = 0; i < _orientationFrames.size(); i++) {
QuaternionKeyFrame pos = _orientationFrames[i];
- if(pos.time < time)
+ if (pos.time < time)
lastFrame = i;
else
break;
}
QuaternionKeyFrame last = _orientationFrames[lastFrame];
- if(lastFrame + 1 >= _orientationFrames.size() || last.time == time) {
+ if (lastFrame + 1 >= _orientationFrames.size() || last.time == time) {
x = last.x;
y = last.y;
z = last.z;
View
4 src/graphics/aurora/modelnode.h
@@ -220,9 +220,9 @@ class ModelNode {
void reparent(ModelNode &parent);
- //animation helpers
+ // Animation helpers
void interpolatePosition(float time, float &x, float &y, float &z) const;
- void interpolateOrientation(float time, float &x, float &y, float &z, float& a) const;
+ void interpolateOrientation(float time, float &x, float &y, float &z, float &a) const;
friend class Model;
};
View
12 src/graphics/graphics.cpp
@@ -812,14 +812,16 @@ bool GraphicsManager::renderWorld() {
buildNewTextures();
- //get the current time
+ // Get the current time
uint32 now = EventMan.getTimestamp();
- if(_lastSampled == 0)
+ if (_lastSampled == 0)
_lastSampled = now;
- //calc elapsed time
- float elapsedTime = (now-_lastSampled) / 1000.0f;
+
+ // Calc elapsed time
+ float elapsedTime = (now - _lastSampled) / 1000.0f;
_lastSampled = now;
- //if game paused, skip the advanceTime loop below
+
+ // If game paused, skip the advanceTime loop below
// Advance time for animation queues
for (std::list<Queueable *>::const_reverse_iterator o = objects.rbegin();
View
4 src/sound/decoders/util.h
@@ -49,8 +49,8 @@ static inline void floatToInt16Interleave(int16 *dst, const float **src,
dst[2 * i + 1] = floatToInt16(src[1][i]);
}
} else {
- for(uint8 c = 0; c < channels; c++)
- for(uint32 i = 0, j = c; i < length; i++, j += channels)
+ for (uint8 c = 0; c < channels; c++)
+ for (uint32 i = 0, j = c; i < length; i++, j += channels)
dst[j] = floatToInt16(src[c][i]);
}
}
View
4 src/video/bink.cpp
@@ -610,9 +610,9 @@ void Bink::initAudioTrack(AudioTrack &audio) {
uint32 frameLenBits;
// Calculate frame length
- if (audio.sampleRate < 22050)
+ if (audio.sampleRate < 22050)
frameLenBits = 9;
- else if(audio.sampleRate < 44100)
+ else if (audio.sampleRate < 44100)
frameLenBits = 10;
else
frameLenBits = 11;

0 comments on commit ac73b55

Please sign in to comment.