aboutsummaryrefslogtreecommitdiff
path: root/engines/sword25/gfx/animationresource.cpp
diff options
context:
space:
mode:
authorEugene Sandulenko2010-10-12 19:38:40 +0000
committerEugene Sandulenko2010-10-13 00:10:18 +0000
commiteb66750137c1f32276ed4d66512deca2ee6aae93 (patch)
tree6e312550817d985f49c37add98b9081e458d2381 /engines/sword25/gfx/animationresource.cpp
parent063cb5d84ca5846ac0eff9388759a9b6662e764f (diff)
downloadscummvm-rg350-eb66750137c1f32276ed4d66512deca2ee6aae93.tar.gz
scummvm-rg350-eb66750137c1f32276ed4d66512deca2ee6aae93.tar.bz2
scummvm-rg350-eb66750137c1f32276ed4d66512deca2ee6aae93.zip
SWORD25: Enforce code naming conventions in gfx/animation*
svn-id: r53393
Diffstat (limited to 'engines/sword25/gfx/animationresource.cpp')
-rw-r--r--engines/sword25/gfx/animationresource.cpp76
1 files changed, 25 insertions, 51 deletions
diff --git a/engines/sword25/gfx/animationresource.cpp b/engines/sword25/gfx/animationresource.cpp
index 4a6bfc34db..93b5934041 100644
--- a/engines/sword25/gfx/animationresource.cpp
+++ b/engines/sword25/gfx/animationresource.cpp
@@ -32,10 +32,6 @@
*
*/
-// -----------------------------------------------------------------------------
-// Includes
-// -----------------------------------------------------------------------------
-
#include "sword25/gfx/animationresource.h"
#include "sword25/kernel/kernel.h"
@@ -45,24 +41,14 @@
namespace Sword25 {
-// -----------------------------------------------------------------------------
-
#define BS_LOG_PREFIX "ANIMATIONRESOURCE"
-// -----------------------------------------------------------------------------
-// Constants
-// -----------------------------------------------------------------------------
-
namespace {
const int DEFAULT_FPS = 10;
const int MIN_FPS = 1;
const int MAX_FPS = 200;
}
-// -----------------------------------------------------------------------------
-// Construction / Destruction
-// -----------------------------------------------------------------------------
-
AnimationResource::AnimationResource(const Common::String &filename) :
Resource(filename, Resource::TYPE_ANIMATION),
Common::XMLParser(),
@@ -105,13 +91,13 @@ AnimationResource::AnimationResource(const Common::String &filename) :
}
// Pre-cache all the frames
- if (!PrecacheAllFrames()) {
+ if (!precacheAllFrames()) {
BS_LOG_ERRORLN("Could not precache all frames of \"%s\".", getFileName().c_str());
return;
}
// Post processing to compute animation features
- if (!ComputeFeatures()) {
+ if (!computeFeatures()) {
BS_LOG_ERRORLN("Could not determine the features of \"%s\".", getFileName().c_str());
return;
}
@@ -119,8 +105,6 @@ AnimationResource::AnimationResource(const Common::String &filename) :
_valid = true;
}
-// -----------------------------------------------------------------------------
-
bool AnimationResource::parseBooleanKey(Common::String s, bool &result) {
s.toLowercase();
if (!strcmp(s.c_str(), "true"))
@@ -132,8 +116,6 @@ bool AnimationResource::parseBooleanKey(Common::String s, bool &result) {
return true;
}
-// -----------------------------------------------------------------------------
-
bool AnimationResource::parserCallback_animation(ParserNode *node) {
if (!parseIntegerKey(node->values["fps"].c_str(), 1, &_FPS) || (_FPS < MIN_FPS) || (_FPS > MAX_FPS)) {
return parserError("Illegal or missing fps attribute in <animation> tag in \"%s\". Assuming default (\"%d\").",
@@ -162,8 +144,6 @@ bool AnimationResource::parserCallback_animation(ParserNode *node) {
return true;
}
-// -----------------------------------------------------------------------------
-
bool AnimationResource::parserCallback_frame(ParserNode *node) {
Frame frame;
@@ -172,8 +152,8 @@ bool AnimationResource::parserCallback_frame(ParserNode *node) {
BS_LOG_ERRORLN("<frame> tag without file attribute occurred in \"%s\".", getFileName().c_str());
return false;
}
- frame.FileName = _pPackage->getAbsolutePath(fileString);
- if (frame.FileName.empty()) {
+ frame.fileName = _pPackage->getAbsolutePath(fileString);
+ if (frame.fileName.empty()) {
BS_LOG_ERRORLN("Could not create absolute path for file specified in <frame> tag in \"%s\": \"%s\".",
getFileName().c_str(), fileString);
return false;
@@ -181,7 +161,7 @@ bool AnimationResource::parserCallback_frame(ParserNode *node) {
const char *actionString = node->values["action"].c_str();
if (actionString)
- frame.Action = actionString;
+ frame.action = actionString;
const char *hotspotxString = node->values["hotspotx"].c_str();
const char *hotspotyString = node->values["hotspoty"].c_str();
@@ -192,52 +172,48 @@ bool AnimationResource::parserCallback_frame(ParserNode *node) {
!hotspotyString ? "hotspoty" : "hotspotx",
getFileName().c_str());
- frame.HotspotX = 0;
- if (hotspotxString && !parseIntegerKey(hotspotxString, 1, &frame.HotspotX))
+ frame.hotspotX = 0;
+ if (hotspotxString && !parseIntegerKey(hotspotxString, 1, &frame.hotspotX))
BS_LOG_WARNINGLN("Illegal hotspotx value (\"%s\") in frame tag in \"%s\". Assuming default (\"%s\").",
- hotspotxString, getFileName().c_str(), frame.HotspotX);
+ hotspotxString, getFileName().c_str(), frame.hotspotX);
- frame.HotspotY = 0;
- if (hotspotyString && !parseIntegerKey(hotspotyString, 1, &frame.HotspotY))
+ frame.hotspotY = 0;
+ if (hotspotyString && !parseIntegerKey(hotspotyString, 1, &frame.hotspotY))
BS_LOG_WARNINGLN("Illegal hotspoty value (\"%s\") in frame tag in \"%s\". Assuming default (\"%s\").",
- hotspotyString, getFileName().c_str(), frame.HotspotY);
+ hotspotyString, getFileName().c_str(), frame.hotspotY);
Common::String flipVString = node->values["flipv"];
if (!flipVString.empty()) {
- if (!parseBooleanKey(flipVString, frame.FlipV)) {
+ if (!parseBooleanKey(flipVString, frame.flipV)) {
BS_LOG_WARNINGLN("Illegal flipv value (\"%s\") in <frame> tag in \"%s\". Assuming default (\"false\").",
flipVString.c_str(), getFileName().c_str());
- frame.FlipV = false;
+ frame.flipV = false;
}
} else
- frame.FlipV = false;
+ frame.flipV = false;
Common::String flipHString = node->values["fliph"];
if (!flipHString.empty()) {
- if (!parseBooleanKey(flipVString, frame.FlipV)) {
+ if (!parseBooleanKey(flipVString, frame.flipV)) {
BS_LOG_WARNINGLN("Illegal fliph value (\"%s\") in <frame> tag in \"%s\". Assuming default (\"false\").",
flipHString.c_str(), getFileName().c_str());
- frame.FlipH = false;
+ frame.flipH = false;
}
} else
- frame.FlipH = false;
+ frame.flipH = false;
_frames.push_back(frame);
return true;
}
-// -----------------------------------------------------------------------------
-
AnimationResource::~AnimationResource() {
}
-// -----------------------------------------------------------------------------
-
-bool AnimationResource::PrecacheAllFrames() const {
+bool AnimationResource::precacheAllFrames() const {
Common::Array<Frame>::const_iterator iter = _frames.begin();
for (; iter != _frames.end(); ++iter) {
- if (!Kernel::GetInstance()->GetResourceManager()->PrecacheResource((*iter).FileName)) {
- BS_LOG_ERRORLN("Could not precache \"%s\".", (*iter).FileName.c_str());
+ if (!Kernel::GetInstance()->GetResourceManager()->PrecacheResource((*iter).fileName)) {
+ BS_LOG_ERRORLN("Could not precache \"%s\".", (*iter).fileName.c_str());
return false;
}
}
@@ -245,9 +221,7 @@ bool AnimationResource::PrecacheAllFrames() const {
return true;
}
-// -----------------------------------------------------------------------------
-
-bool AnimationResource::ComputeFeatures() {
+bool AnimationResource::computeFeatures() {
BS_ASSERT(_frames.size());
// Alle Features werden als vorhanden angenommen
@@ -256,11 +230,11 @@ bool AnimationResource::ComputeFeatures() {
_colorModulationAllowed = true;
// Alle Frame durchgehen und alle Features deaktivieren, die auch nur von einem Frame nicht unterstützt werden.
- Common::Array<Frame>::const_iterator Iter = _frames.begin();
- for (; Iter != _frames.end(); ++Iter) {
+ Common::Array<Frame>::const_iterator iter = _frames.begin();
+ for (; iter != _frames.end(); ++iter) {
BitmapResource *pBitmap;
- if (!(pBitmap = static_cast<BitmapResource *>(Kernel::GetInstance()->GetResourceManager()->RequestResource((*Iter).FileName)))) {
- BS_LOG_ERRORLN("Could not request \"%s\".", (*Iter).FileName.c_str());
+ if (!(pBitmap = static_cast<BitmapResource *>(Kernel::GetInstance()->GetResourceManager()->RequestResource((*iter).fileName)))) {
+ BS_LOG_ERRORLN("Could not request \"%s\".", (*iter).fileName.c_str());
return false;
}