aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/sword25/gfx/animation.cpp554
-rw-r--r--engines/sword25/gfx/animation.h78
-rw-r--r--engines/sword25/gfx/animationdescription.cpp10
-rw-r--r--engines/sword25/gfx/animationdescription.h28
-rw-r--r--engines/sword25/gfx/animationresource.cpp76
-rw-r--r--engines/sword25/gfx/animationresource.h22
-rw-r--r--engines/sword25/gfx/animationtemplate.cpp179
-rw-r--r--engines/sword25/gfx/animationtemplate.h44
-rw-r--r--engines/sword25/gfx/animationtemplateregistry.cpp2
-rw-r--r--engines/sword25/gfx/graphicengine_script.cpp32
-rw-r--r--engines/sword25/gfx/timedrenderobject.cpp4
-rw-r--r--engines/sword25/gfx/timedrenderobject.h8
12 files changed, 413 insertions, 624 deletions
diff --git a/engines/sword25/gfx/animation.cpp b/engines/sword25/gfx/animation.cpp
index 45d0c9fc25..7ec445acb8 100644
--- a/engines/sword25/gfx/animation.cpp
+++ b/engines/sword25/gfx/animation.cpp
@@ -51,161 +51,138 @@ namespace Sword25 {
#define BS_LOG_PREFIX "ANIMATION"
-// Konstruktion / Destruktion
-// --------------------------
-
-Animation::Animation(RenderObjectPtr<RenderObject> ParentPtr, const Common::String &FileName) :
- TimedRenderObject(ParentPtr, RenderObject::TYPE_ANIMATION) {
+Animation::Animation(RenderObjectPtr<RenderObject> parentPtr, const Common::String &fileName) :
+ TimedRenderObject(parentPtr, RenderObject::TYPE_ANIMATION) {
// Das BS_RenderObject konnte nicht erzeugt werden, daher muss an dieser Stelle abgebrochen werden.
- if (!_initSuccess) return;
+ if (!_initSuccess)
+ return;
- InitMembers();
+ initMembers();
// Vom negativen Fall ausgehen.
_initSuccess = false;
- InitializeAnimationResource(FileName);
+ initializeAnimationResource(fileName);
// Erfolg signalisieren.
_initSuccess = true;
}
-// -----------------------------------------------------------------------------
-
-Animation::Animation(RenderObjectPtr<RenderObject> ParentPtr, const AnimationTemplate &Template) :
- TimedRenderObject(ParentPtr, RenderObject::TYPE_ANIMATION) {
+Animation::Animation(RenderObjectPtr<RenderObject> parentPtr, const AnimationTemplate &templ) :
+ TimedRenderObject(parentPtr, RenderObject::TYPE_ANIMATION) {
// Das BS_RenderObject konnte nicht erzeugt werden, daher muss an dieser Stelle abgebrochen werden.
- if (!_initSuccess) return;
+ if (!_initSuccess)
+ return;
- InitMembers();
+ initMembers();
// Vom negativen Fall ausgehen.
_initSuccess = false;
- m_AnimationTemplateHandle = AnimationTemplate::Create(Template);
+ _animationTemplateHandle = AnimationTemplate::create(templ);
// Erfolg signalisieren.
_initSuccess = true;
}
-// -----------------------------------------------------------------------------
-
-Animation::Animation(InputPersistenceBlock &Reader, RenderObjectPtr<RenderObject> ParentPtr, uint Handle) :
- TimedRenderObject(ParentPtr, RenderObject::TYPE_ANIMATION, Handle) {
+Animation::Animation(InputPersistenceBlock &reader, RenderObjectPtr<RenderObject> parentPtr, uint handle) :
+ TimedRenderObject(parentPtr, RenderObject::TYPE_ANIMATION, handle) {
// Das BS_RenderObject konnte nicht erzeugt werden, daher muss an dieser Stelle abgebrochen werden.
- if (!_initSuccess) return;
+ if (!_initSuccess)
+ return;
- InitMembers();
+ initMembers();
// Objekt vom Stream laden.
- _initSuccess = unpersist(Reader);
+ _initSuccess = unpersist(reader);
}
-// -----------------------------------------------------------------------------
-
-void Animation::InitializeAnimationResource(const Common::String &FileName) {
+void Animation::initializeAnimationResource(const Common::String &fileName) {
// Die Resource wird für die gesamte Lebensdauer des Animations-Objektes gelockt.
- Resource *ResourcePtr = Kernel::GetInstance()->GetResourceManager()->RequestResource(FileName);
- if (ResourcePtr && ResourcePtr->GetType() == Resource::TYPE_ANIMATION)
- m_AnimationResourcePtr = static_cast<AnimationResource *>(ResourcePtr);
+ Resource *resourcePtr = Kernel::GetInstance()->GetResourceManager()->RequestResource(fileName);
+ if (resourcePtr && resourcePtr->GetType() == Resource::TYPE_ANIMATION)
+ _animationResourcePtr = static_cast<AnimationResource *>(resourcePtr);
else {
- BS_LOG_ERRORLN("The resource \"%s\" could not be requested. The Animation can't be created.", FileName.c_str());
+ BS_LOG_ERRORLN("The resource \"%s\" could not be requested. The Animation can't be created.", fileName.c_str());
return;
}
// Größe und Position der Animation anhand des aktuellen Frames bestimmen.
- ComputeCurrentCharacteristics();
+ computeCurrentCharacteristics();
}
-// -----------------------------------------------------------------------------
-
-void Animation::InitMembers() {
- m_CurrentFrame = 0;
- m_CurrentFrameTime = 0;
- m_Direction = FORWARD;
- m_Running = false;
- m_Finished = false;
+void Animation::initMembers() {
+ _currentFrame = 0;
+ _currentFrameTime = 0;
+ _direction = FORWARD;
+ _running = false;
+ _finished = false;
_relX = 0;
_relY = 0;
_scaleFactorX = 1.0f;
_scaleFactorY = 1.0f;
_modulationColor = 0xffffffff;
- m_AnimationResourcePtr = 0;
- m_AnimationTemplateHandle = 0;
- m_FramesLocked = false;
+ _animationResourcePtr = 0;
+ _animationTemplateHandle = 0;
+ _framesLocked = false;
}
-// -----------------------------------------------------------------------------
-
Animation::~Animation() {
- if (GetAnimationDescription()) {
- Stop();
- GetAnimationDescription()->unlock();
+ if (getAnimationDescription()) {
+ stop();
+ getAnimationDescription()->unlock();
}
// Delete Callbacks
- Common::Array<ANIMATION_CALLBACK_DATA>::iterator it = m_DeleteCallbacks.begin();
- for (; it != m_DeleteCallbacks.end(); it++)((*it).Callback)((*it).Data);
+ Common::Array<ANIMATION_CALLBACK_DATA>::iterator it = _deleteCallbacks.begin();
+ for (; it != _deleteCallbacks.end(); it++)((*it).Callback)((*it).Data);
}
-// -----------------------------------------------------------------------------
-// Steuermethoden
-// -----------------------------------------------------------------------------
-
-void Animation::Play() {
+void Animation::play() {
// Wenn die Animation zuvor komplett durchgelaufen ist, wird sie wieder von Anfang abgespielt
- if (m_Finished) Stop();
+ if (_finished)
+ stop();
- m_Running = true;
- LockAllFrames();
+ _running = true;
+ lockAllFrames();
}
-// -----------------------------------------------------------------------------
-
-void Animation::Pause() {
- m_Running = false;
- UnlockAllFrames();
+void Animation::pause() {
+ _running = false;
+ unlockAllFrames();
}
-// -----------------------------------------------------------------------------
-
-void Animation::Stop() {
- m_CurrentFrame = 0;
- m_CurrentFrameTime = 0;
- m_Direction = FORWARD;
- Pause();
+void Animation::stop() {
+ _currentFrame = 0;
+ _currentFrameTime = 0;
+ _direction = FORWARD;
+ pause();
}
-// -----------------------------------------------------------------------------
-
-void Animation::SetFrame(uint Nr) {
- AnimationDescription *animationDescriptionPtr = GetAnimationDescription();
+void Animation::setFrame(uint nr) {
+ AnimationDescription *animationDescriptionPtr = getAnimationDescription();
BS_ASSERT(animationDescriptionPtr);
- if (Nr >= animationDescriptionPtr->getFrameCount()) {
+ if (nr >= animationDescriptionPtr->getFrameCount()) {
BS_LOG_ERRORLN("Tried to set animation to illegal frame (%d). Value must be between 0 and %d.",
- Nr, animationDescriptionPtr->getFrameCount());
+ nr, animationDescriptionPtr->getFrameCount());
return;
}
- m_CurrentFrame = Nr;
- m_CurrentFrameTime = 0;
- ComputeCurrentCharacteristics();
+ _currentFrame = nr;
+ _currentFrameTime = 0;
+ computeCurrentCharacteristics();
forceRefresh();
}
-// -----------------------------------------------------------------------------
-// Rendern
-// -----------------------------------------------------------------------------
-
bool Animation::doRender() {
- AnimationDescription *animationDescriptionPtr = GetAnimationDescription();
+ AnimationDescription *animationDescriptionPtr = getAnimationDescription();
BS_ASSERT(animationDescriptionPtr);
- BS_ASSERT(m_CurrentFrame < animationDescriptionPtr->getFrameCount());
+ BS_ASSERT(_currentFrame < animationDescriptionPtr->getFrameCount());
// Bitmap des aktuellen Frames holen
- Resource *pResource = Kernel::GetInstance()->GetResourceManager()->RequestResource(animationDescriptionPtr->getFrame(m_CurrentFrame).FileName);
+ Resource *pResource = Kernel::GetInstance()->GetResourceManager()->RequestResource(animationDescriptionPtr->getFrame(_currentFrame).fileName);
BS_ASSERT(pResource);
BS_ASSERT(pResource->GetType() == Resource::TYPE_BITMAP);
BitmapResource *pBitmapResource = static_cast<BitmapResource *>(pResource);
@@ -215,54 +192,50 @@ bool Animation::doRender() {
BS_ASSERT(pGfx);
// Bitmap zeichnen
- bool Result;
+ bool result;
if (isScalingAllowed() && (_width != pBitmapResource->getWidth() || _height != pBitmapResource->getHeight())) {
- Result = pBitmapResource->blit(_absoluteX, _absoluteY,
- (animationDescriptionPtr->getFrame(m_CurrentFrame).FlipV ? BitmapResource::FLIP_V : 0) |
- (animationDescriptionPtr->getFrame(m_CurrentFrame).FlipH ? BitmapResource::FLIP_H : 0),
+ result = pBitmapResource->blit(_absoluteX, _absoluteY,
+ (animationDescriptionPtr->getFrame(_currentFrame).flipV ? BitmapResource::FLIP_V : 0) |
+ (animationDescriptionPtr->getFrame(_currentFrame).flipH ? BitmapResource::FLIP_H : 0),
0, _modulationColor, _width, _height);
} else {
- Result = pBitmapResource->blit(_absoluteX, _absoluteY,
- (animationDescriptionPtr->getFrame(m_CurrentFrame).FlipV ? BitmapResource::FLIP_V : 0) |
- (animationDescriptionPtr->getFrame(m_CurrentFrame).FlipH ? BitmapResource::FLIP_H : 0),
+ result = pBitmapResource->blit(_absoluteX, _absoluteY,
+ (animationDescriptionPtr->getFrame(_currentFrame).flipV ? BitmapResource::FLIP_V : 0) |
+ (animationDescriptionPtr->getFrame(_currentFrame).flipH ? BitmapResource::FLIP_H : 0),
0, _modulationColor, -1, -1);
}
// Resource freigeben
pBitmapResource->release();
- return Result;
+ return result;
}
-// -----------------------------------------------------------------------------
-// Frame Notifikation
-// -----------------------------------------------------------------------------
-
-void Animation::frameNotification(int TimeElapsed) {
- AnimationDescription *animationDescriptionPtr = GetAnimationDescription();
+void Animation::frameNotification(int timeElapsed) {
+ AnimationDescription *animationDescriptionPtr = getAnimationDescription();
BS_ASSERT(animationDescriptionPtr);
- BS_ASSERT(TimeElapsed >= 0);
+ BS_ASSERT(timeElapsed >= 0);
// Nur wenn die Animation läuft wird sie auch weiterbewegt
- if (m_Running) {
+ if (_running) {
// Gesamte vergangene Zeit bestimmen (inkl. Restzeit des aktuellen Frames)
- m_CurrentFrameTime += TimeElapsed;
+ _currentFrameTime += timeElapsed;
// Anzahl an zu überpringenden Frames bestimmen
- int SkipFrames = animationDescriptionPtr->getMillisPerFrame() == 0 ? 0 : m_CurrentFrameTime / animationDescriptionPtr->getMillisPerFrame();
+ int skipFrames = animationDescriptionPtr->getMillisPerFrame() == 0 ? 0 : _currentFrameTime / animationDescriptionPtr->getMillisPerFrame();
// Neue Frame-Restzeit bestimmen
- m_CurrentFrameTime -= animationDescriptionPtr->getMillisPerFrame() * SkipFrames;
+ _currentFrameTime -= animationDescriptionPtr->getMillisPerFrame() * skipFrames;
// Neuen Frame bestimmen (je nach aktuellener Abspielrichtung wird addiert oder subtrahiert)
- int TmpCurFrame = m_CurrentFrame;
- switch (m_Direction) {
+ int tmpCurFrame = _currentFrame;
+ switch (_direction) {
case FORWARD:
- TmpCurFrame += SkipFrames;
+ tmpCurFrame += skipFrames;
break;
case BACKWARD:
- TmpCurFrame -= SkipFrames;
+ tmpCurFrame -= skipFrames;
break;
default:
@@ -270,42 +243,42 @@ void Animation::frameNotification(int TimeElapsed) {
}
// Überläufe behandeln
- if (TmpCurFrame < 0) {
+ if (tmpCurFrame < 0) {
// Loop-Point Callbacks
- for (uint i = 0; i < m_LoopPointCallbacks.size();) {
- if ((m_LoopPointCallbacks[i].Callback)(m_LoopPointCallbacks[i].Data) == false) {
- m_LoopPointCallbacks.remove_at(i);
+ for (uint i = 0; i < _loopPointCallbacks.size();) {
+ if ((_loopPointCallbacks[i].Callback)(_loopPointCallbacks[i].Data) == false) {
+ _loopPointCallbacks.remove_at(i);
} else
i++;
}
// Ein Unterlauf darf nur auftreten, wenn der Animationstyp JOJO ist.
BS_ASSERT(animationDescriptionPtr->getAnimationType() == AT_JOJO);
- TmpCurFrame = - TmpCurFrame;
- m_Direction = FORWARD;
- } else if (static_cast<uint>(TmpCurFrame) >= animationDescriptionPtr->getFrameCount()) {
+ tmpCurFrame = - tmpCurFrame;
+ _direction = FORWARD;
+ } else if (static_cast<uint>(tmpCurFrame) >= animationDescriptionPtr->getFrameCount()) {
// Loop-Point Callbacks
- for (uint i = 0; i < m_LoopPointCallbacks.size();) {
- if ((m_LoopPointCallbacks[i].Callback)(m_LoopPointCallbacks[i].Data) == false) {
- m_LoopPointCallbacks.remove_at(i);
+ for (uint i = 0; i < _loopPointCallbacks.size();) {
+ if ((_loopPointCallbacks[i].Callback)(_loopPointCallbacks[i].Data) == false) {
+ _loopPointCallbacks.remove_at(i);
} else
i++;
}
switch (animationDescriptionPtr->getAnimationType()) {
case AT_ONESHOT:
- TmpCurFrame = animationDescriptionPtr->getFrameCount() - 1;
- m_Finished = true;
- Pause();
+ tmpCurFrame = animationDescriptionPtr->getFrameCount() - 1;
+ _finished = true;
+ pause();
break;
case AT_LOOP:
- TmpCurFrame = TmpCurFrame % animationDescriptionPtr->getFrameCount();
+ tmpCurFrame = tmpCurFrame % animationDescriptionPtr->getFrameCount();
break;
case AT_JOJO:
- TmpCurFrame = animationDescriptionPtr->getFrameCount() - (TmpCurFrame % animationDescriptionPtr->getFrameCount()) - 1;
- m_Direction = BACKWARD;
+ tmpCurFrame = animationDescriptionPtr->getFrameCount() - (tmpCurFrame % animationDescriptionPtr->getFrameCount()) - 1;
+ _direction = BACKWARD;
break;
default:
@@ -313,38 +286,36 @@ void Animation::frameNotification(int TimeElapsed) {
}
}
- if ((int)m_CurrentFrame != TmpCurFrame) {
+ if ((int)_currentFrame != tmpCurFrame) {
forceRefresh();
- if (animationDescriptionPtr->getFrame(m_CurrentFrame).Action != "") {
+ if (animationDescriptionPtr->getFrame(_currentFrame).action != "") {
// Action Callbacks
- for (uint i = 0; i < m_ActionCallbacks.size();) {
- if ((m_ActionCallbacks[i].Callback)(m_ActionCallbacks[i].Data) == false) {
- m_ActionCallbacks.remove_at(i);
+ for (uint i = 0; i < _actionCallbacks.size();) {
+ if ((_actionCallbacks[i].Callback)(_actionCallbacks[i].Data) == false) {
+ _actionCallbacks.remove_at(i);
} else
i++;
}
}
}
- m_CurrentFrame = static_cast<uint>(TmpCurFrame);
+ _currentFrame = static_cast<uint>(tmpCurFrame);
}
// Größe und Position der Animation anhand des aktuellen Frames bestimmen
- ComputeCurrentCharacteristics();
+ computeCurrentCharacteristics();
- BS_ASSERT(m_CurrentFrame < animationDescriptionPtr->getFrameCount());
- BS_ASSERT(m_CurrentFrameTime >= 0);
+ BS_ASSERT(_currentFrame < animationDescriptionPtr->getFrameCount());
+ BS_ASSERT(_currentFrameTime >= 0);
}
-// -----------------------------------------------------------------------------
-
-void Animation::ComputeCurrentCharacteristics() {
- AnimationDescription *animationDescriptionPtr = GetAnimationDescription();
+void Animation::computeCurrentCharacteristics() {
+ AnimationDescription *animationDescriptionPtr = getAnimationDescription();
BS_ASSERT(animationDescriptionPtr);
- const AnimationResource::Frame &CurFrame = animationDescriptionPtr->getFrame(m_CurrentFrame);
+ const AnimationResource::Frame &curFrame = animationDescriptionPtr->getFrame(_currentFrame);
- Resource *pResource = Kernel::GetInstance()->GetResourceManager()->RequestResource(CurFrame.FileName);
+ Resource *pResource = Kernel::GetInstance()->GetResourceManager()->RequestResource(curFrame.fileName);
BS_ASSERT(pResource);
BS_ASSERT(pResource->GetType() == Resource::TYPE_BITMAP);
BitmapResource *pBitmap = static_cast<BitmapResource *>(pResource);
@@ -354,42 +325,38 @@ void Animation::ComputeCurrentCharacteristics() {
_height = static_cast<int>(pBitmap->getHeight() * _scaleFactorY);
// Position anhand des Hotspots berechnen und setzen
- int PosX = _relX + ComputeXModifier();
- int PosY = _relY + ComputeYModifier();
+ int posX = _relX + computeXModifier();
+ int posY = _relY + computeYModifier();
- RenderObject::setPos(PosX, PosY);
+ RenderObject::setPos(posX, posY);
pBitmap->release();
}
-// -----------------------------------------------------------------------------
-
-bool Animation::LockAllFrames() {
- if (!m_FramesLocked) {
- AnimationDescription *animationDescriptionPtr = GetAnimationDescription();
+bool Animation::lockAllFrames() {
+ if (!_framesLocked) {
+ AnimationDescription *animationDescriptionPtr = getAnimationDescription();
BS_ASSERT(animationDescriptionPtr);
for (uint i = 0; i < animationDescriptionPtr->getFrameCount(); ++i) {
- if (!Kernel::GetInstance()->GetResourceManager()->RequestResource(animationDescriptionPtr->getFrame(i).FileName)) {
+ if (!Kernel::GetInstance()->GetResourceManager()->RequestResource(animationDescriptionPtr->getFrame(i).fileName)) {
BS_LOG_ERRORLN("Could not lock all animation frames.");
return false;
}
}
- m_FramesLocked = true;
+ _framesLocked = true;
}
return true;
}
-// -----------------------------------------------------------------------------
-
-bool Animation::UnlockAllFrames() {
- if (m_FramesLocked) {
- AnimationDescription *animationDescriptionPtr = GetAnimationDescription();
+bool Animation::unlockAllFrames() {
+ if (_framesLocked) {
+ AnimationDescription *animationDescriptionPtr = getAnimationDescription();
BS_ASSERT(animationDescriptionPtr);
for (uint i = 0; i < animationDescriptionPtr->getFrameCount(); ++i) {
Resource *pResource;
- if (!(pResource = Kernel::GetInstance()->GetResourceManager()->RequestResource(animationDescriptionPtr->getFrame(i).FileName))) {
+ if (!(pResource = Kernel::GetInstance()->GetResourceManager()->RequestResource(animationDescriptionPtr->getFrame(i).fileName))) {
BS_LOG_ERRORLN("Could not unlock all animation frames.");
return false;
}
@@ -400,95 +367,69 @@ bool Animation::UnlockAllFrames() {
pResource->release();
}
- m_FramesLocked = false;
+ _framesLocked = false;
}
return true;
}
-// -----------------------------------------------------------------------------
-// Getter
-// -----------------------------------------------------------------------------
-
Animation::ANIMATION_TYPES Animation::getAnimationType() const {
- AnimationDescription *animationDescriptionPtr = GetAnimationDescription();
+ AnimationDescription *animationDescriptionPtr = getAnimationDescription();
BS_ASSERT(animationDescriptionPtr);
return animationDescriptionPtr->getAnimationType();
}
-// -----------------------------------------------------------------------------
-
int Animation::getFPS() const {
- AnimationDescription *animationDescriptionPtr = GetAnimationDescription();
+ AnimationDescription *animationDescriptionPtr = getAnimationDescription();
BS_ASSERT(animationDescriptionPtr);
return animationDescriptionPtr->getFPS();
}
-// -----------------------------------------------------------------------------
-
int Animation::getFrameCount() const {
- AnimationDescription *animationDescriptionPtr = GetAnimationDescription();
+ AnimationDescription *animationDescriptionPtr = getAnimationDescription();
BS_ASSERT(animationDescriptionPtr);
return animationDescriptionPtr->getFrameCount();
}
-// -----------------------------------------------------------------------------
-
bool Animation::isScalingAllowed() const {
- AnimationDescription *animationDescriptionPtr = GetAnimationDescription();
+ AnimationDescription *animationDescriptionPtr = getAnimationDescription();
BS_ASSERT(animationDescriptionPtr);
return animationDescriptionPtr->isScalingAllowed();
}
-// -----------------------------------------------------------------------------
-
bool Animation::isAlphaAllowed() const {
- AnimationDescription *animationDescriptionPtr = GetAnimationDescription();
+ AnimationDescription *animationDescriptionPtr = getAnimationDescription();
BS_ASSERT(animationDescriptionPtr);
return animationDescriptionPtr->isAlphaAllowed();
}
-// -----------------------------------------------------------------------------
-
bool Animation::isColorModulationAllowed() const {
- AnimationDescription *animationDescriptionPtr = GetAnimationDescription();
+ AnimationDescription *animationDescriptionPtr = getAnimationDescription();
BS_ASSERT(animationDescriptionPtr);
return animationDescriptionPtr->isColorModulationAllowed();
}
-// -----------------------------------------------------------------------------
-// Positionieren
-// -----------------------------------------------------------------------------
-
void Animation::setPos(int relX, int relY) {
_relX = relX;
_relY = relY;
- ComputeCurrentCharacteristics();
+ computeCurrentCharacteristics();
}
-// -----------------------------------------------------------------------------
-
void Animation::setX(int relX) {
_relX = relX;
- ComputeCurrentCharacteristics();
+ computeCurrentCharacteristics();
}
-// -----------------------------------------------------------------------------
-
void Animation::setY(int relY) {
_relY = relY;
- ComputeCurrentCharacteristics();
+ computeCurrentCharacteristics();
}
-// -----------------------------------------------------------------------------
-// Darstellungsart festlegen
-// -----------------------------------------------------------------------------
-
void Animation::setAlpha(int alpha) {
- AnimationDescription *animationDescriptionPtr = GetAnimationDescription();
+ AnimationDescription *animationDescriptionPtr = getAnimationDescription();
BS_ASSERT(animationDescriptionPtr);
if (!animationDescriptionPtr->isAlphaAllowed()) {
BS_LOG_WARNINGLN("Tried to set alpha value on an animation that does not support alpha. Call was ignored.");
@@ -502,10 +443,8 @@ void Animation::setAlpha(int alpha) {
}
}
-// -----------------------------------------------------------------------------
-
void Animation::setModulationColor(uint modulationColor) {
- AnimationDescription *animationDescriptionPtr = GetAnimationDescription();
+ AnimationDescription *animationDescriptionPtr = getAnimationDescription();
BS_ASSERT(animationDescriptionPtr);
if (!animationDescriptionPtr->isColorModulationAllowed()) {
BS_LOG_WARNINGLN("Tried to set modulation color on an animation that does not support color modulation. Call was ignored");
@@ -519,17 +458,13 @@ void Animation::setModulationColor(uint modulationColor) {
}
}
-// -----------------------------------------------------------------------------
-
void Animation::setScaleFactor(float scaleFactor) {
setScaleFactorX(scaleFactor);
setScaleFactorY(scaleFactor);
}
-// -----------------------------------------------------------------------------
-
void Animation::setScaleFactorX(float scaleFactorX) {
- AnimationDescription *animationDescriptionPtr = GetAnimationDescription();
+ AnimationDescription *animationDescriptionPtr = getAnimationDescription();
BS_ASSERT(animationDescriptionPtr);
if (!animationDescriptionPtr->isScalingAllowed()) {
BS_LOG_WARNINGLN("Tried to set x scale factor on an animation that does not support scaling. Call was ignored");
@@ -541,14 +476,12 @@ void Animation::setScaleFactorX(float scaleFactorX) {
if (_scaleFactorX <= 0.0f)
_scaleFactorX = 0.001f;
forceRefresh();
- ComputeCurrentCharacteristics();
+ computeCurrentCharacteristics();
}
}
-// -----------------------------------------------------------------------------
-
void Animation::setScaleFactorY(float scaleFactorY) {
- AnimationDescription *animationDescriptionPtr = GetAnimationDescription();
+ AnimationDescription *animationDescriptionPtr = getAnimationDescription();
BS_ASSERT(animationDescriptionPtr);
if (!animationDescriptionPtr->isScalingAllowed()) {
BS_LOG_WARNINGLN("Tried to set y scale factor on an animation that does not support scaling. Call was ignored");
@@ -560,153 +493,125 @@ void Animation::setScaleFactorY(float scaleFactorY) {
if (_scaleFactorY <= 0.0f)
_scaleFactorY = 0.001f;
forceRefresh();
- ComputeCurrentCharacteristics();
+ computeCurrentCharacteristics();
}
}
-// -----------------------------------------------------------------------------
-
-const Common::String &Animation::GetCurrentAction() const {
- AnimationDescription *animationDescriptionPtr = GetAnimationDescription();
+const Common::String &Animation::getCurrentAction() const {
+ AnimationDescription *animationDescriptionPtr = getAnimationDescription();
BS_ASSERT(animationDescriptionPtr);
- return animationDescriptionPtr->getFrame(m_CurrentFrame).Action;
+ return animationDescriptionPtr->getFrame(_currentFrame).action;
}
-// -----------------------------------------------------------------------------
-
int Animation::getX() const {
return _relX;
}
-// -----------------------------------------------------------------------------
-
int Animation::getY() const {
return _relY;
}
-// -----------------------------------------------------------------------------
-
int Animation::getAbsoluteX() const {
return _absoluteX + (_relX - _x);
}
-// -----------------------------------------------------------------------------
-
int Animation::getAbsoluteY() const {
return _absoluteY + (_relY - _y);
}
-// -----------------------------------------------------------------------------
-
-int Animation::ComputeXModifier() const {
- AnimationDescription *animationDescriptionPtr = GetAnimationDescription();
+int Animation::computeXModifier() const {
+ AnimationDescription *animationDescriptionPtr = getAnimationDescription();
BS_ASSERT(animationDescriptionPtr);
- const AnimationResource::Frame &CurFrame = animationDescriptionPtr->getFrame(m_CurrentFrame);
+ const AnimationResource::Frame &curFrame = animationDescriptionPtr->getFrame(_currentFrame);
- Resource *pResource = Kernel::GetInstance()->GetResourceManager()->RequestResource(CurFrame.FileName);
+ Resource *pResource = Kernel::GetInstance()->GetResourceManager()->RequestResource(curFrame.fileName);
BS_ASSERT(pResource);
BS_ASSERT(pResource->GetType() == Resource::TYPE_BITMAP);
BitmapResource *pBitmap = static_cast<BitmapResource *>(pResource);
- int Result = CurFrame.FlipV ? - static_cast<int>((pBitmap->getWidth() - 1 - CurFrame.HotspotX) * _scaleFactorX) :
- - static_cast<int>(CurFrame.HotspotX * _scaleFactorX);
+ int result = curFrame.flipV ? - static_cast<int>((pBitmap->getWidth() - 1 - curFrame.hotspotX) * _scaleFactorX) :
+ - static_cast<int>(curFrame.hotspotX * _scaleFactorX);
pBitmap->release();
- return Result;
+ return result;
}
-// -----------------------------------------------------------------------------
-
-int Animation::ComputeYModifier() const {
- AnimationDescription *animationDescriptionPtr = GetAnimationDescription();
+int Animation::computeYModifier() const {
+ AnimationDescription *animationDescriptionPtr = getAnimationDescription();
BS_ASSERT(animationDescriptionPtr);
- const AnimationResource::Frame &CurFrame = animationDescriptionPtr->getFrame(m_CurrentFrame);
+ const AnimationResource::Frame &curFrame = animationDescriptionPtr->getFrame(_currentFrame);
- Resource *pResource = Kernel::GetInstance()->GetResourceManager()->RequestResource(CurFrame.FileName);
+ Resource *pResource = Kernel::GetInstance()->GetResourceManager()->RequestResource(curFrame.fileName);
BS_ASSERT(pResource);
BS_ASSERT(pResource->GetType() == Resource::TYPE_BITMAP);
BitmapResource *pBitmap = static_cast<BitmapResource *>(pResource);
- int Result = CurFrame.FlipH ? - static_cast<int>((pBitmap->getHeight() - 1 - CurFrame.HotspotY) * _scaleFactorY) :
- - static_cast<int>(CurFrame.HotspotY * _scaleFactorY);
+ int result = curFrame.flipH ? - static_cast<int>((pBitmap->getHeight() - 1 - curFrame.hotspotY) * _scaleFactorY) :
+ - static_cast<int>(curFrame.hotspotY * _scaleFactorY);
pBitmap->release();
- return Result;
+ return result;
}
-// -----------------------------------------------------------------------------
-
-void Animation::RegisterActionCallback(ANIMATION_CALLBACK Callback, uint Data) {
- ANIMATION_CALLBACK_DATA CD;
- CD.Callback = Callback;
- CD.Data = Data;
- m_ActionCallbacks.push_back(CD);
+void Animation::registerActionCallback(ANIMATION_CALLBACK callback, uint data) {
+ ANIMATION_CALLBACK_DATA cd;
+ cd.Callback = callback;
+ cd.Data = data;
+ _actionCallbacks.push_back(cd);
}
-// -----------------------------------------------------------------------------
-
-void Animation::RegisterLoopPointCallback(ANIMATION_CALLBACK Callback, uint Data) {
- ANIMATION_CALLBACK_DATA CD;
- CD.Callback = Callback;
- CD.Data = Data;
- m_LoopPointCallbacks.push_back(CD);
+void Animation::registerLoopPointCallback(ANIMATION_CALLBACK callback, uint data) {
+ ANIMATION_CALLBACK_DATA cd;
+ cd.Callback = callback;
+ cd.Data = data;
+ _loopPointCallbacks.push_back(cd);
}
-// -----------------------------------------------------------------------------
-
-void Animation::RegisterDeleteCallback(ANIMATION_CALLBACK Callback, uint Data) {
- ANIMATION_CALLBACK_DATA CD;
- CD.Callback = Callback;
- CD.Data = Data;
- m_DeleteCallbacks.push_back(CD);
+void Animation::registerDeleteCallback(ANIMATION_CALLBACK callback, uint data) {
+ ANIMATION_CALLBACK_DATA cd;
+ cd.Callback = callback;
+ cd.Data = data;
+ _deleteCallbacks.push_back(cd);
}
-// -----------------------------------------------------------------------------
-// Persistenz
-// -----------------------------------------------------------------------------
-
-void Animation::PersistCallbackVector(OutputPersistenceBlock &Writer, const Common::Array<ANIMATION_CALLBACK_DATA> & Vector) {
+void Animation::persistCallbackVector(OutputPersistenceBlock &writer, const Common::Array<ANIMATION_CALLBACK_DATA> &vector) {
// Anzahl an Callbacks persistieren.
- Writer.write(Vector.size());
+ writer.write(vector.size());
// Alle Callbacks einzeln persistieren.
- Common::Array<ANIMATION_CALLBACK_DATA>::const_iterator It = Vector.begin();
- while (It != Vector.end()) {
- Writer.write(CallbackRegistry::getInstance().resolveCallbackPointer((void (*)(int))It->Callback));
- Writer.write(It->Data);
+ Common::Array<ANIMATION_CALLBACK_DATA>::const_iterator it = vector.begin();
+ while (it != vector.end()) {
+ writer.write(CallbackRegistry::getInstance().resolveCallbackPointer((void (*)(int))it->Callback));
+ writer.write(it->Data);
- ++It;
+ ++it;
}
}
-// -----------------------------------------------------------------------------
-
-void Animation::UnpersistCallbackVector(InputPersistenceBlock &Reader, Common::Array<ANIMATION_CALLBACK_DATA> & Vector) {
+void Animation::unpersistCallbackVector(InputPersistenceBlock &reader, Common::Array<ANIMATION_CALLBACK_DATA> &vector) {
// Callbackvector leeren.
- Vector.resize(0);
+ vector.resize(0);
// Anzahl an Callbacks einlesen.
- uint CallbackCount;
- Reader.read(CallbackCount);
+ uint callbackCount;
+ reader.read(callbackCount);
// Alle Callbacks einzeln wieder herstellen.
- for (uint i = 0; i < CallbackCount; ++i) {
- ANIMATION_CALLBACK_DATA CallbackData;
+ for (uint i = 0; i < callbackCount; ++i) {
+ ANIMATION_CALLBACK_DATA callbackData;
- Common::String CallbackFunctionName;
- Reader.read(CallbackFunctionName);
- CallbackData.Callback = reinterpret_cast<ANIMATION_CALLBACK>(CallbackRegistry::getInstance().resolveCallbackFunction(CallbackFunctionName));
+ Common::String callbackFunctionName;
+ reader.read(callbackFunctionName);
+ callbackData.Callback = reinterpret_cast<ANIMATION_CALLBACK>(CallbackRegistry::getInstance().resolveCallbackFunction(callbackFunctionName));
- Reader.read(CallbackData.Data);
+ reader.read(callbackData.Data);
- Vector.push_back(CallbackData);
+ vector.push_back(callbackData);
}
}
-// -----------------------------------------------------------------------------
-
bool Animation::persist(OutputPersistenceBlock &writer) {
bool result = true;
@@ -717,31 +622,31 @@ bool Animation::persist(OutputPersistenceBlock &writer) {
writer.write(_scaleFactorX);
writer.write(_scaleFactorY);
writer.write(_modulationColor);
- writer.write(m_CurrentFrame);
- writer.write(m_CurrentFrameTime);
- writer.write(m_Running);
- writer.write(m_Finished);
- writer.write(static_cast<uint>(m_Direction));
+ writer.write(_currentFrame);
+ writer.write(_currentFrameTime);
+ writer.write(_running);
+ writer.write(_finished);
+ writer.write(static_cast<uint>(_direction));
// Je nach Animationstyp entweder das Template oder die Ressource speichern.
- if (m_AnimationResourcePtr) {
- uint Marker = 0;
- writer.write(Marker);
- writer.write(m_AnimationResourcePtr->getFileName());
- } else if (m_AnimationTemplateHandle) {
- uint Marker = 1;
- writer.write(Marker);
- writer.write(m_AnimationTemplateHandle);
+ if (_animationResourcePtr) {
+ uint marker = 0;
+ writer.write(marker);
+ writer.write(_animationResourcePtr->getFileName());
+ } else if (_animationTemplateHandle) {
+ uint marker = 1;
+ writer.write(marker);
+ writer.write(_animationTemplateHandle);
} else {
BS_ASSERT(false);
}
- //writer.write(m_AnimationDescriptionPtr);
+ //writer.write(_AnimationDescriptionPtr);
- writer.write(m_FramesLocked);
- PersistCallbackVector(writer, m_LoopPointCallbacks);
- PersistCallbackVector(writer, m_ActionCallbacks);
- PersistCallbackVector(writer, m_DeleteCallbacks);
+ writer.write(_framesLocked);
+ persistCallbackVector(writer, _loopPointCallbacks);
+ persistCallbackVector(writer, _actionCallbacks);
+ persistCallbackVector(writer, _deleteCallbacks);
result &= RenderObject::persistChildren(writer);
@@ -760,33 +665,34 @@ bool Animation::unpersist(InputPersistenceBlock &reader) {
reader.read(_scaleFactorX);
reader.read(_scaleFactorY);
reader.read(_modulationColor);
- reader.read(m_CurrentFrame);
- reader.read(m_CurrentFrameTime);
- reader.read(m_Running);
- reader.read(m_Finished);
- uint Direction;
- reader.read(Direction);
- m_Direction = static_cast<DIRECTION>(Direction);
+ reader.read(_currentFrame);
+ reader.read(_currentFrameTime);
+ reader.read(_running);
+ reader.read(_finished);
+ uint direction;
+ reader.read(direction);
+ _direction = static_cast<Direction>(direction);
// Animationstyp einlesen.
- uint Marker;
- reader.read(Marker);
- if (Marker == 0) {
- Common::String ResourceFilename;
- reader.read(ResourceFilename);
- InitializeAnimationResource(ResourceFilename);
- } else if (Marker == 1) {
- reader.read(m_AnimationTemplateHandle);
+ uint marker;
+ reader.read(marker);
+ if (marker == 0) {
+ Common::String resourceFilename;
+ reader.read(resourceFilename);
+ initializeAnimationResource(resourceFilename);
+ } else if (marker == 1) {
+ reader.read(_animationTemplateHandle);
} else {
BS_ASSERT(false);
}
- reader.read(m_FramesLocked);
- if (m_FramesLocked) LockAllFrames();
+ reader.read(_framesLocked);
+ if (_framesLocked)
+ lockAllFrames();
- UnpersistCallbackVector(reader, m_LoopPointCallbacks);
- UnpersistCallbackVector(reader, m_ActionCallbacks);
- UnpersistCallbackVector(reader, m_DeleteCallbacks);
+ unpersistCallbackVector(reader, _loopPointCallbacks);
+ unpersistCallbackVector(reader, _actionCallbacks);
+ unpersistCallbackVector(reader, _deleteCallbacks);
result &= RenderObject::unpersistChildren(reader);
@@ -795,9 +701,11 @@ bool Animation::unpersist(InputPersistenceBlock &reader) {
// -----------------------------------------------------------------------------
-AnimationDescription *Animation::GetAnimationDescription() const {
- if (m_AnimationResourcePtr) return m_AnimationResourcePtr;
- else return AnimationTemplateRegistry::getInstance().resolveHandle(m_AnimationTemplateHandle);
+AnimationDescription *Animation::getAnimationDescription() const {
+ if (_animationResourcePtr)
+ return _animationResourcePtr;
+ else
+ return AnimationTemplateRegistry::getInstance().resolveHandle(_animationTemplateHandle);
}
} // End of namespace Sword25
diff --git a/engines/sword25/gfx/animation.h b/engines/sword25/gfx/animation.h
index de684ce395..0676c0c116 100644
--- a/engines/sword25/gfx/animation.h
+++ b/engines/sword25/gfx/animation.h
@@ -65,10 +65,10 @@ public:
virtual ~Animation();
- void Play();
- void Pause();
- void Stop();
- void SetFrame(uint Nr);
+ void play();
+ void pause();
+ void stop();
+ void setFrame(uint nr);
virtual void setPos(int x, int y);
virtual void setX(int x);
@@ -141,85 +141,85 @@ public:
bool isScalingAllowed() const;
bool isAlphaAllowed() const;
bool isColorModulationAllowed() const;
- uint GetCurrentFrame() const {
- return m_CurrentFrame;
+ uint getCurrentFrame() const {
+ return _currentFrame;
}
- const Common::String &GetCurrentAction() const ;
- bool IsRunning() const {
- return m_Running;
+ const Common::String &getCurrentAction() const;
+ bool isRunning() const {
+ return _running;
}
typedef bool (*ANIMATION_CALLBACK)(uint);
- void RegisterLoopPointCallback(ANIMATION_CALLBACK Callback, uint Data = 0);
- void RegisterActionCallback(ANIMATION_CALLBACK Callback, uint Data = 0);
- void RegisterDeleteCallback(ANIMATION_CALLBACK Callback, uint Data = 0);
+ void registerLoopPointCallback(ANIMATION_CALLBACK callback, uint data = 0);
+ void registerActionCallback(ANIMATION_CALLBACK callback, uint data = 0);
+ void registerDeleteCallback(ANIMATION_CALLBACK Callback, uint Data = 0);
protected:
virtual bool doRender();
private:
- enum DIRECTION {
+ enum Direction {
FORWARD,
BACKWARD
};
- int _relX;
- int _relY;
- float _scaleFactorX;
- float _scaleFactorY;
- uint _modulationColor;
- uint m_CurrentFrame;
- int m_CurrentFrameTime;
- bool m_Running;
- bool m_Finished;
- DIRECTION m_Direction;
- AnimationResource *m_AnimationResourcePtr;
- uint m_AnimationTemplateHandle;
- bool m_FramesLocked;
+ int _relX;
+ int _relY;
+ float _scaleFactorX;
+ float _scaleFactorY;
+ uint _modulationColor;
+ uint _currentFrame;
+ int _currentFrameTime;
+ bool _running;
+ bool _finished;
+ Direction _direction;
+ AnimationResource *_animationResourcePtr;
+ uint _animationTemplateHandle;
+ bool _framesLocked;
struct ANIMATION_CALLBACK_DATA {
ANIMATION_CALLBACK Callback;
uint Data;
};
- Common::Array<ANIMATION_CALLBACK_DATA> m_LoopPointCallbacks;
- Common::Array<ANIMATION_CALLBACK_DATA> m_ActionCallbacks;
- Common::Array<ANIMATION_CALLBACK_DATA> m_DeleteCallbacks;
+ Common::Array<ANIMATION_CALLBACK_DATA> _loopPointCallbacks;
+ Common::Array<ANIMATION_CALLBACK_DATA> _actionCallbacks;
+ Common::Array<ANIMATION_CALLBACK_DATA> _deleteCallbacks;
/**
@brief Lockt alle Frames.
@return Gibt false zurück, falls nicht alle Frames gelockt werden konnten.
*/
- bool LockAllFrames();
+ bool lockAllFrames();
/**
@brief Unlockt alle Frames.
@return Gibt false zurück, falls nicht alles Frames freigegeben werden konnten.
*/
- bool UnlockAllFrames();
+ bool unlockAllFrames();
/**
@brief Diese Methode aktualisiert die Parameter (Größe, Position) der Animation anhand des aktuellen Frames.
Diese Methode muss bei jedem Framewechsel aufgerufen werden damit der RenderObject-Manager immer aktuelle Daten hat.
*/
- void ComputeCurrentCharacteristics();
+ void computeCurrentCharacteristics();
/**
@brief Berechnet den Abstand zwischen dem linken Rand und dem Hotspot auf X-Achse in der aktuellen Darstellung.
*/
- int ComputeXModifier() const;
+ int computeXModifier() const;
/**
@brief Berechnet den Abstand zwischen dem linken Rand und dem Hotspot auf X-Achse in der aktuellen Darstellung.
*/
- int ComputeYModifier() const;
+ int computeYModifier() const;
- void InitMembers();
- void PersistCallbackVector(OutputPersistenceBlock &Writer, const Common::Array<ANIMATION_CALLBACK_DATA> & Vector);
- void UnpersistCallbackVector(InputPersistenceBlock &Reader, Common::Array<ANIMATION_CALLBACK_DATA> & Vector);
- AnimationDescription *GetAnimationDescription() const;
- void InitializeAnimationResource(const Common::String &FileName);
+ void initMembers();
+ void persistCallbackVector(OutputPersistenceBlock &writer, const Common::Array<ANIMATION_CALLBACK_DATA> &vector);
+ void unpersistCallbackVector(InputPersistenceBlock &reader, Common::Array<ANIMATION_CALLBACK_DATA> &vector);
+ AnimationDescription *getAnimationDescription() const;
+ void initializeAnimationResource(const Common::String &fileName);
};
} // End of namespace Sword25
diff --git a/engines/sword25/gfx/animationdescription.cpp b/engines/sword25/gfx/animationdescription.cpp
index a2a8c9bcf0..68ba7b63a6 100644
--- a/engines/sword25/gfx/animationdescription.cpp
+++ b/engines/sword25/gfx/animationdescription.cpp
@@ -32,20 +32,12 @@
*
*/
-// -----------------------------------------------------------------------------
-// Includes
-// -----------------------------------------------------------------------------
-
#include "sword25/kernel/outputpersistenceblock.h"
#include "sword25/kernel/inputpersistenceblock.h"
#include "sword25/gfx/animationdescription.h"
namespace Sword25 {
-// -----------------------------------------------------------------------------
-// Persistenz
-// -----------------------------------------------------------------------------
-
bool AnimationDescription::persist(OutputPersistenceBlock &writer) {
writer.write(static_cast<uint>(_animationType));
writer.write(_FPS);
@@ -57,8 +49,6 @@ bool AnimationDescription::persist(OutputPersistenceBlock &writer) {
return true;
}
-// -----------------------------------------------------------------------------
-
bool AnimationDescription::unpersist(InputPersistenceBlock &reader) {
uint animationType;
reader.read(animationType);
diff --git a/engines/sword25/gfx/animationdescription.h b/engines/sword25/gfx/animationdescription.h
index 8b54dcbf15..a52f5d3f68 100644
--- a/engines/sword25/gfx/animationdescription.h
+++ b/engines/sword25/gfx/animationdescription.h
@@ -35,20 +35,12 @@
#ifndef SWORD25_ANIMATIONDESCRIPTION_H
#define SWORD25_ANIMATIONDESCRIPTION_H
-// -----------------------------------------------------------------------------
-// Includes
-// -----------------------------------------------------------------------------
-
#include "sword25/kernel/common.h"
#include "sword25/kernel/persistable.h"
#include "sword25/gfx/animation.h"
namespace Sword25 {
-// -----------------------------------------------------------------------------
-// Klassendefinition
-// -----------------------------------------------------------------------------
-
class AnimationDescription : public Persistable {
protected:
AnimationDescription() :
@@ -63,26 +55,18 @@ protected:
public:
struct Frame {
// Die Hotspot-Angabe bezieht sich auf das ungeflippte Bild!!
- int HotspotX;
- int HotspotY;
- bool FlipV;
- bool FlipH;
- Common::String FileName;
- Common::String Action;
+ int hotspotX;
+ int hotspotY;
+ bool flipV;
+ bool flipH;
+ Common::String fileName;
+ Common::String action;
};
- // -----------------------------------------------------------------------------
- // Abstrakte Methoden
- // -----------------------------------------------------------------------------
-
virtual const Frame &getFrame(uint index) const = 0;
virtual uint getFrameCount() const = 0;
virtual void unlock() = 0;
- // -----------------------------------------------------------------------------
- // Getter Methoden
- // -----------------------------------------------------------------------------
-
Animation::ANIMATION_TYPES getAnimationType() const {
return _animationType;
}
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;
}
diff --git a/engines/sword25/gfx/animationresource.h b/engines/sword25/gfx/animationresource.h
index b2ff82d1bf..da07b55c3b 100644
--- a/engines/sword25/gfx/animationresource.h
+++ b/engines/sword25/gfx/animationresource.h
@@ -35,10 +35,6 @@
#ifndef SWORD25_ANIMATIONRESOURCE_H
#define SWORD25_ANIMATIONRESOURCE_H
-// -----------------------------------------------------------------------------
-// Includes
-// -----------------------------------------------------------------------------
-
#include "common/xmlparser.h"
#include "sword25/kernel/common.h"
#include "sword25/kernel/resource.h"
@@ -47,17 +43,9 @@
namespace Sword25 {
-// -----------------------------------------------------------------------------
-// Forward Declarations
-// -----------------------------------------------------------------------------
-
class Kernel;
class PackageManager;
-// -----------------------------------------------------------------------------
-// Class Definition
-// -----------------------------------------------------------------------------
-
class AnimationResource : public Resource, public AnimationDescription, public Common::XMLParser {
public:
AnimationResource(const Common::String &filename);
@@ -97,15 +85,15 @@ public:
}
private:
- bool _valid;
+ bool _valid;
- Common::Array<Frame> _frames;
+ Common::Array<Frame> _frames;
- PackageManager * _pPackage;
+ PackageManager *_pPackage;
- bool ComputeFeatures();
- bool PrecacheAllFrames() const;
+ bool computeFeatures();
+ bool precacheAllFrames() const;
// Parser
CUSTOM_XML_PARSER(AnimationResource) {
diff --git a/engines/sword25/gfx/animationtemplate.cpp b/engines/sword25/gfx/animationtemplate.cpp
index 8b537a5848..2019d19565 100644
--- a/engines/sword25/gfx/animationtemplate.cpp
+++ b/engines/sword25/gfx/animationtemplate.cpp
@@ -34,10 +34,6 @@
#define BS_LOG_PREFIX "ANIMATIONTEMPLATE"
-// -----------------------------------------------------------------------------
-// Includes
-// -----------------------------------------------------------------------------
-
#include "sword25/kernel/kernel.h"
#include "sword25/kernel/resource.h"
#include "sword25/kernel/outputpersistenceblock.h"
@@ -49,112 +45,95 @@
namespace Sword25 {
-// -----------------------------------------------------------------------------
-// Konstruktion / Destruktion
-// -----------------------------------------------------------------------------
-
-uint AnimationTemplate::Create(const Common::String &SourceAnimation) {
- AnimationTemplate *AnimationTemplatePtr = new AnimationTemplate(SourceAnimation);
+uint AnimationTemplate::create(const Common::String &sourceAnimation) {
+ AnimationTemplate *animationTemplatePtr = new AnimationTemplate(sourceAnimation);
- if (AnimationTemplatePtr->isValid()) {
- return AnimationTemplateRegistry::getInstance().resolvePtr(AnimationTemplatePtr);
+ if (animationTemplatePtr->isValid()) {
+ return AnimationTemplateRegistry::getInstance().resolvePtr(animationTemplatePtr);
} else {
- delete AnimationTemplatePtr;
+ delete animationTemplatePtr;
return 0;
}
}
-// -----------------------------------------------------------------------------
-
-uint AnimationTemplate::Create(const AnimationTemplate &Other) {
- AnimationTemplate *AnimationTemplatePtr = new AnimationTemplate(Other);
+uint AnimationTemplate::create(const AnimationTemplate &other) {
+ AnimationTemplate *animationTemplatePtr = new AnimationTemplate(other);
- if (AnimationTemplatePtr->isValid()) {
- return AnimationTemplateRegistry::getInstance().resolvePtr(AnimationTemplatePtr);
+ if (animationTemplatePtr->isValid()) {
+ return AnimationTemplateRegistry::getInstance().resolvePtr(animationTemplatePtr);
} else {
- delete AnimationTemplatePtr;
+ delete animationTemplatePtr;
return 0;
}
}
-// -----------------------------------------------------------------------------
+uint AnimationTemplate::create(InputPersistenceBlock &reader, uint handle) {
+ AnimationTemplate *animationTemplatePtr = new AnimationTemplate(reader, handle);
-uint AnimationTemplate::Create(InputPersistenceBlock &Reader, uint Handle) {
- AnimationTemplate *AnimationTemplatePtr = new AnimationTemplate(Reader, Handle);
-
- if (AnimationTemplatePtr->isValid()) {
- return AnimationTemplateRegistry::getInstance().resolvePtr(AnimationTemplatePtr);
+ if (animationTemplatePtr->isValid()) {
+ return AnimationTemplateRegistry::getInstance().resolvePtr(animationTemplatePtr);
} else {
- delete AnimationTemplatePtr;
+ delete animationTemplatePtr;
return 0;
}
}
-// -----------------------------------------------------------------------------
-
-AnimationTemplate::AnimationTemplate(const Common::String &SourceAnimation) {
+AnimationTemplate::AnimationTemplate(const Common::String &sourceAnimation) {
// Objekt registrieren.
AnimationTemplateRegistry::getInstance().registerObject(this);
_valid = false;
// Die Animations-Resource wird für die gesamte Lebensdauer des Objektes gelockt
- _sourceAnimationPtr = RequestSourceAnimation(SourceAnimation);
+ _sourceAnimationPtr = requestSourceAnimation(sourceAnimation);
// Erfolg signalisieren
_valid = (_sourceAnimationPtr != 0);
}
-// -----------------------------------------------------------------------------
-
-AnimationTemplate::AnimationTemplate(const AnimationTemplate &Other) : AnimationDescription(){
+AnimationTemplate::AnimationTemplate(const AnimationTemplate &other) : AnimationDescription() {
// Objekt registrieren.
AnimationTemplateRegistry::getInstance().registerObject(this);
_valid = false;
// Die Animations-Resource wird für die gesamte Lebensdauer des Objektes gelockt.
- if (!Other._sourceAnimationPtr) return;
- _sourceAnimationPtr = RequestSourceAnimation(Other._sourceAnimationPtr->getFileName());
+ if (!other._sourceAnimationPtr)
+ return;
+ _sourceAnimationPtr = requestSourceAnimation(other._sourceAnimationPtr->getFileName());
// Alle Member kopieren.
- _animationType = Other._animationType;
- _FPS = Other._FPS;
- _millisPerFrame = Other._millisPerFrame;
- _scalingAllowed = Other._scalingAllowed;
- _alphaAllowed = Other._alphaAllowed;
- _colorModulationAllowed = Other._colorModulationAllowed;
- _frames = Other._frames;
- _sourceAnimationPtr = Other._sourceAnimationPtr;
- _valid = Other._valid;
+ _animationType = other._animationType;
+ _FPS = other._FPS;
+ _millisPerFrame = other._millisPerFrame;
+ _scalingAllowed = other._scalingAllowed;
+ _alphaAllowed = other._alphaAllowed;
+ _colorModulationAllowed = other._colorModulationAllowed;
+ _frames = other._frames;
+ _sourceAnimationPtr = other._sourceAnimationPtr;
+ _valid = other._valid;
_valid &= (_sourceAnimationPtr != 0);
}
-// -----------------------------------------------------------------------------
-
-AnimationTemplate::AnimationTemplate(InputPersistenceBlock &Reader, uint Handle) {
+AnimationTemplate::AnimationTemplate(InputPersistenceBlock &reader, uint handle) {
// Objekt registrieren.
- AnimationTemplateRegistry::getInstance().registerObject(this, Handle);
+ AnimationTemplateRegistry::getInstance().registerObject(this, handle);
// Objekt laden.
- _valid = unpersist(Reader);
+ _valid = unpersist(reader);
}
-// -----------------------------------------------------------------------------
-
-AnimationResource *AnimationTemplate::RequestSourceAnimation(const Common::String &SourceAnimation) const {
+AnimationResource *AnimationTemplate::requestSourceAnimation(const Common::String &sourceAnimation) const {
ResourceManager *RMPtr = Kernel::GetInstance()->GetResourceManager();
- Resource *ResourcePtr;
- if (NULL == (ResourcePtr = RMPtr->RequestResource(SourceAnimation)) || ResourcePtr->GetType() != Resource::TYPE_ANIMATION) {
- BS_LOG_ERRORLN("The resource \"%s\" could not be requested or is has an invalid type. The animation template can't be created.", SourceAnimation.c_str());
+ Resource *resourcePtr;
+ if (NULL == (resourcePtr = RMPtr->RequestResource(sourceAnimation)) || resourcePtr->GetType() != Resource::TYPE_ANIMATION) {
+ BS_LOG_ERRORLN("The resource \"%s\" could not be requested or is has an invalid type. The animation template can't be created.", sourceAnimation.c_str());
return 0;
}
- return static_cast<AnimationResource *>(ResourcePtr);
+ return static_cast<AnimationResource *>(resourcePtr);
}
-// -----------------------------------------------------------------------------
-
AnimationTemplate::~AnimationTemplate() {
// Animations-Resource freigeben
if (_sourceAnimationPtr) {
@@ -165,53 +144,41 @@ AnimationTemplate::~AnimationTemplate() {
AnimationTemplateRegistry::getInstance().deregisterObject(this);
}
-// -----------------------------------------------------------------------------
-
-void AnimationTemplate::AddFrame(int Index) {
- if (ValidateSourceIndex(Index)) {
- _frames.push_back(_sourceAnimationPtr->getFrame(Index));
+void AnimationTemplate::addFrame(int index) {
+ if (validateSourceIndex(index)) {
+ _frames.push_back(_sourceAnimationPtr->getFrame(index));
}
}
-// -----------------------------------------------------------------------------
-
-void AnimationTemplate::SetFrame(int DestIndex, int SrcIndex) {
- if (ValidateDestIndex(DestIndex) && ValidateSourceIndex(SrcIndex)) {
- _frames[DestIndex] = _sourceAnimationPtr->getFrame(SrcIndex);
+void AnimationTemplate::setFrame(int destIndex, int srcIndex) {
+ if (validateDestIndex(destIndex) && validateSourceIndex(srcIndex)) {
+ _frames[destIndex] = _sourceAnimationPtr->getFrame(srcIndex);
}
}
-// -----------------------------------------------------------------------------
-
-bool AnimationTemplate::ValidateSourceIndex(uint Index) const {
- if (Index > _sourceAnimationPtr->getFrameCount()) {
+bool AnimationTemplate::validateSourceIndex(uint index) const {
+ if (index > _sourceAnimationPtr->getFrameCount()) {
BS_LOG_WARNINGLN("Tried to insert a frame (\"%d\") that does not exist in the source animation (\"%s\"). Ignoring call.",
- Index, _sourceAnimationPtr->getFileName().c_str());
+ index, _sourceAnimationPtr->getFileName().c_str());
return false;
} else
return true;
}
-// -----------------------------------------------------------------------------
-
-bool AnimationTemplate::ValidateDestIndex(uint Index) const {
- if (Index > _frames.size()) {
+bool AnimationTemplate::validateDestIndex(uint index) const {
+ if (index > _frames.size()) {
BS_LOG_WARNINGLN("Tried to change a nonexistent frame (\"%d\") in a template animation. Ignoring call.",
- Index);
+ index);
return false;
} else
return true;
}
-// -----------------------------------------------------------------------------
-
-void AnimationTemplate::SetFPS(int FPS) {
+void AnimationTemplate::setFPS(int FPS) {
_FPS = FPS;
_millisPerFrame = 1000000 / _FPS;
}
-// -----------------------------------------------------------------------------
-
bool AnimationTemplate::persist(OutputPersistenceBlock &writer) {
bool Result = true;
@@ -224,12 +191,12 @@ bool AnimationTemplate::persist(OutputPersistenceBlock &writer) {
// Frames einzeln persistieren.
Common::Array<const Frame>::const_iterator Iter = _frames.begin();
while (Iter != _frames.end()) {
- writer.write(Iter->HotspotX);
- writer.write(Iter->HotspotY);
- writer.write(Iter->FlipV);
- writer.write(Iter->FlipH);
- writer.write(Iter->FileName);
- writer.write(Iter->Action);
+ writer.write(Iter->hotspotX);
+ writer.write(Iter->hotspotY);
+ writer.write(Iter->flipV);
+ writer.write(Iter->flipH);
+ writer.write(Iter->fileName);
+ writer.write(Iter->action);
++Iter;
}
@@ -240,39 +207,37 @@ bool AnimationTemplate::persist(OutputPersistenceBlock &writer) {
return Result;
}
-// -----------------------------------------------------------------------------
-
bool AnimationTemplate::unpersist(InputPersistenceBlock &reader) {
- bool Result = true;
+ bool result = true;
// Parent wieder herstellen.
- Result &= AnimationDescription::unpersist(reader);
+ result &= AnimationDescription::unpersist(reader);
// Frameanzahl lesen.
- uint FrameCount;
- reader.read(FrameCount);
+ uint frameCount;
+ reader.read(frameCount);
// Frames einzeln wieder herstellen.
- for (uint i = 0; i < FrameCount; ++i) {
+ for (uint i = 0; i < frameCount; ++i) {
Frame frame;
- reader.read(frame.HotspotX);
- reader.read(frame.HotspotY);
- reader.read(frame.FlipV);
- reader.read(frame.FlipH);
- reader.read(frame.FileName);
- reader.read(frame.Action);
+ reader.read(frame.hotspotX);
+ reader.read(frame.hotspotY);
+ reader.read(frame.flipV);
+ reader.read(frame.flipH);
+ reader.read(frame.fileName);
+ reader.read(frame.action);
_frames.push_back(frame);
}
// Die Animations-Resource wird für die gesamte Lebensdauer des Objektes gelockt
- Common::String SourceAnimation;
- reader.read(SourceAnimation);
- _sourceAnimationPtr = RequestSourceAnimation(SourceAnimation);
+ Common::String sourceAnimation;
+ reader.read(sourceAnimation);
+ _sourceAnimationPtr = requestSourceAnimation(sourceAnimation);
reader.read(_valid);
- return _sourceAnimationPtr && reader.isGood() && Result;
+ return _sourceAnimationPtr && reader.isGood() && result;
}
} // End of namespace Sword25
diff --git a/engines/sword25/gfx/animationtemplate.h b/engines/sword25/gfx/animationtemplate.h
index e39fb64880..294f249f81 100644
--- a/engines/sword25/gfx/animationtemplate.h
+++ b/engines/sword25/gfx/animationtemplate.h
@@ -45,34 +45,26 @@
namespace Sword25 {
-// -----------------------------------------------------------------------------
-// Forward declarations
-// -----------------------------------------------------------------------------
-
class AnimationResource;
-// -----------------------------------------------------------------------------
-// Klassendefinition
-// -----------------------------------------------------------------------------
-
class AnimationTemplate : public AnimationDescription {
public:
- static uint Create(const Common::String &SourceAnimation);
- static uint Create(const AnimationTemplate &Other);
- static uint Create(InputPersistenceBlock &Reader, uint Handle);
- AnimationTemplate *ResolveHandle(uint Handle) const;
+ static uint create(const Common::String &sourceAnimation);
+ static uint create(const AnimationTemplate &other);
+ static uint create(InputPersistenceBlock &reader, uint handle);
+ AnimationTemplate *resolveHandle(uint handle) const;
private:
- AnimationTemplate(const Common::String &SourceAnimation);
- AnimationTemplate(const AnimationTemplate &Other);
- AnimationTemplate(InputPersistenceBlock &Reader, uint Handle);
+ AnimationTemplate(const Common::String &sourceAnimation);
+ AnimationTemplate(const AnimationTemplate &other);
+ AnimationTemplate(InputPersistenceBlock &reader, uint handle);
public:
~AnimationTemplate();
- virtual const Frame &getFrame(uint Index) const {
- BS_ASSERT(Index < _frames.size());
- return _frames[Index];
+ virtual const Frame &getFrame(uint index) const {
+ BS_ASSERT(index < _frames.size());
+ return _frames[index];
}
virtual uint getFrameCount() const {
return _frames.size();
@@ -92,28 +84,28 @@ public:
@param Index der Index des Frames in der Quellanimation
*/
- void AddFrame(int Index);
+ void addFrame(int index);
/**
@brief Ändert einen bereits in der Animation vorhandenen Frame.
@param DestIndex der Index des Frames der überschrieben werden soll
@param SrcIndex der Index des einzufügenden Frames in der Quellanimation
*/
- void SetFrame(int DestIndex, int SrcIndex);
+ void setFrame(int destIndex, int srcIndex);
/**
@brief Setzt den Animationstyp.
@param Type der Typ der Animation. Muss aus den enum BS_Animation::ANIMATION_TYPES sein.
*/
- void SetAnimationType(Animation::ANIMATION_TYPES Type) {
- _animationType = Type;
+ void setAnimationType(Animation::ANIMATION_TYPES type) {
+ _animationType = type;
}
/**
@brief Setzt die Abspielgeschwindigkeit.
@param FPS die Abspielgeschwindigkeit in Frames pro Sekunde.
*/
- void SetFPS(int FPS);
+ void setFPS(int FPS);
virtual bool persist(OutputPersistenceBlock &writer);
virtual bool unpersist(InputPersistenceBlock &reader);
@@ -123,9 +115,9 @@ private:
AnimationResource *_sourceAnimationPtr;
bool _valid;
- AnimationResource *RequestSourceAnimation(const Common::String &SourceAnimation) const;
- bool ValidateSourceIndex(uint Index) const;
- bool ValidateDestIndex(uint Index) const;
+ AnimationResource *requestSourceAnimation(const Common::String &sourceAnimation) const;
+ bool validateSourceIndex(uint index) const;
+ bool validateDestIndex(uint index) const;
};
} // End of namespace Sword25
diff --git a/engines/sword25/gfx/animationtemplateregistry.cpp b/engines/sword25/gfx/animationtemplateregistry.cpp
index 9a052471b6..6f4af690c6 100644
--- a/engines/sword25/gfx/animationtemplateregistry.cpp
+++ b/engines/sword25/gfx/animationtemplateregistry.cpp
@@ -98,7 +98,7 @@ bool AnimationTemplateRegistry::unpersist(InputPersistenceBlock &reader) {
reader.read(handle);
// BS_AnimationTemplate wieder herstellen.
- result &= (AnimationTemplate::Create(reader, handle) != 0);
+ result &= (AnimationTemplate::create(reader, handle) != 0);
}
return reader.isGood() && result;
diff --git a/engines/sword25/gfx/graphicengine_script.cpp b/engines/sword25/gfx/graphicengine_script.cpp
index 51a6a75111..d443023436 100644
--- a/engines/sword25/gfx/graphicengine_script.cpp
+++ b/engines/sword25/gfx/graphicengine_script.cpp
@@ -158,7 +158,7 @@ static AnimationTemplate *CheckAnimationTemplate(lua_State *L, int idx = 1) {
// -----------------------------------------------------------------------------
static int NewAnimationTemplate(lua_State *L) {
- uint AnimationTemplateHandle = AnimationTemplate::Create(luaL_checkstring(L, 1));
+ uint AnimationTemplateHandle = AnimationTemplate::create(luaL_checkstring(L, 1));
AnimationTemplate *AnimationTemplatePtr = AnimationTemplateRegistry::getInstance().resolveHandle(AnimationTemplateHandle);
if (AnimationTemplatePtr && AnimationTemplatePtr->isValid()) {
NewUintUserData(L, AnimationTemplateHandle);
@@ -177,7 +177,7 @@ static int NewAnimationTemplate(lua_State *L) {
static int AT_AddFrame(lua_State *L) {
AnimationTemplate *pAT = CheckAnimationTemplate(L);
- pAT->AddFrame(static_cast<int>(luaL_checknumber(L, 2)));
+ pAT->addFrame(static_cast<int>(luaL_checknumber(L, 2)));
return 0;
}
@@ -185,7 +185,7 @@ static int AT_AddFrame(lua_State *L) {
static int AT_SetFrame(lua_State *L) {
AnimationTemplate *pAT = CheckAnimationTemplate(L);
- pAT->SetFrame(static_cast<int>(luaL_checknumber(L, 2)), static_cast<int>(luaL_checknumber(L, 3)));
+ pAT->setFrame(static_cast<int>(luaL_checknumber(L, 2)), static_cast<int>(luaL_checknumber(L, 3)));
return 0;
}
@@ -211,7 +211,7 @@ static int AT_SetAnimationType(lua_State *L) {
AnimationTemplate *pAT = CheckAnimationTemplate(L);
Animation::ANIMATION_TYPES AnimationType;
if (AnimationTypeStringToNumber(luaL_checkstring(L, 2), AnimationType)) {
- pAT->SetAnimationType(AnimationType);
+ pAT->setAnimationType(AnimationType);
} else {
luaL_argcheck(L, 0, 2, "Invalid animation type");
}
@@ -223,7 +223,7 @@ static int AT_SetAnimationType(lua_State *L) {
static int AT_SetFPS(lua_State *L) {
AnimationTemplate *pAT = CheckAnimationTemplate(L);
- pAT->SetFPS(static_cast<int>(luaL_checknumber(L, 2)));
+ pAT->setFPS(static_cast<int>(luaL_checknumber(L, 2)));
return 0;
}
@@ -740,9 +740,9 @@ static int RO_AddAnimation(lua_State *L) {
lua_setmetatable(L, -2);
// Alle Animationscallbacks registrieren.
- AnimationPtr->RegisterDeleteCallback(AnimationDeleteCallback, AnimationPtr->getHandle());
- AnimationPtr->RegisterLoopPointCallback(AnimationLoopPointCallback, AnimationPtr->getHandle());
- AnimationPtr->RegisterActionCallback(AnimationActionCallback, AnimationPtr->getHandle());
+ AnimationPtr->registerDeleteCallback(AnimationDeleteCallback, AnimationPtr->getHandle());
+ AnimationPtr->registerLoopPointCallback(AnimationLoopPointCallback, AnimationPtr->getHandle());
+ AnimationPtr->registerActionCallback(AnimationActionCallback, AnimationPtr->getHandle());
} else
lua_pushnil(L);
@@ -1056,7 +1056,7 @@ static RenderObjectPtr<Animation> CheckAnimation(lua_State *L) {
static int A_Play(lua_State *L) {
RenderObjectPtr<Animation> AnimationPtr = CheckAnimation(L);
BS_ASSERT(AnimationPtr.isValid());
- AnimationPtr->Play();
+ AnimationPtr->play();
return 0;
}
@@ -1065,7 +1065,7 @@ static int A_Play(lua_State *L) {
static int A_Pause(lua_State *L) {
RenderObjectPtr<Animation> AnimationPtr = CheckAnimation(L);
BS_ASSERT(AnimationPtr.isValid());
- AnimationPtr->Pause();
+ AnimationPtr->pause();
return 0;
}
@@ -1074,7 +1074,7 @@ static int A_Pause(lua_State *L) {
static int A_Stop(lua_State *L) {
RenderObjectPtr<Animation> AnimationPtr = CheckAnimation(L);
BS_ASSERT(AnimationPtr.isValid());
- AnimationPtr->Stop();
+ AnimationPtr->stop();
return 0;
}
@@ -1083,7 +1083,7 @@ static int A_Stop(lua_State *L) {
static int A_SetFrame(lua_State *L) {
RenderObjectPtr<Animation> AnimationPtr = CheckAnimation(L);
BS_ASSERT(AnimationPtr.isValid());
- AnimationPtr->SetFrame(static_cast<uint>(luaL_checknumber(L, 2)));
+ AnimationPtr->setFrame(static_cast<uint>(luaL_checknumber(L, 2)));
return 0;
}
@@ -1221,7 +1221,7 @@ static int A_IsTintingAllowed(lua_State *L) {
static int A_GetCurrentFrame(lua_State *L) {
RenderObjectPtr<Animation> AnimationPtr = CheckAnimation(L);
BS_ASSERT(AnimationPtr.isValid());
- lua_pushnumber(L, AnimationPtr->GetCurrentFrame());
+ lua_pushnumber(L, AnimationPtr->getCurrentFrame());
return 1;
}
@@ -1230,7 +1230,7 @@ static int A_GetCurrentFrame(lua_State *L) {
static int A_GetCurrentAction(lua_State *L) {
RenderObjectPtr<Animation> AnimationPtr = CheckAnimation(L);
BS_ASSERT(AnimationPtr.isValid());
- lua_pushstring(L, AnimationPtr->GetCurrentAction().c_str());
+ lua_pushstring(L, AnimationPtr->getCurrentAction().c_str());
return 1;
}
@@ -1239,7 +1239,7 @@ static int A_GetCurrentAction(lua_State *L) {
static int A_IsPlaying(lua_State *L) {
RenderObjectPtr<Animation> AnimationPtr = CheckAnimation(L);
BS_ASSERT(AnimationPtr.isValid());
- lua_pushbooleancpp(L, AnimationPtr->IsRunning());
+ lua_pushbooleancpp(L, AnimationPtr->isRunning());
return 1;
}
@@ -1283,7 +1283,7 @@ static int A_UnregisterLoopPointCallback(lua_State *L) {
static bool AnimationActionCallback(uint Handle) {
RenderObjectPtr<Animation> AnimationPtr(Handle);
if (AnimationPtr.isValid()) {
- ActionCallbackPtr->Action = AnimationPtr->GetCurrentAction();
+ ActionCallbackPtr->Action = AnimationPtr->getCurrentAction();
lua_State *L = static_cast<lua_State *>(Kernel::GetInstance()->GetScript()->getScriptObject());
ActionCallbackPtr->invokeCallbackFunctions(L, AnimationPtr->getHandle());
}
diff --git a/engines/sword25/gfx/timedrenderobject.cpp b/engines/sword25/gfx/timedrenderobject.cpp
index aa6ffe7dc8..eaa9b90d26 100644
--- a/engines/sword25/gfx/timedrenderobject.cpp
+++ b/engines/sword25/gfx/timedrenderobject.cpp
@@ -38,10 +38,6 @@
namespace Sword25 {
-// -----------------------------------------------------------------------------
-// Konstruktion / Destruktion
-// -----------------------------------------------------------------------------
-
TimedRenderObject::TimedRenderObject(RenderObjectPtr<RenderObject> pParent, TYPES type, uint handle) :
RenderObject(pParent, type, handle) {
BS_ASSERT(getManager());
diff --git a/engines/sword25/gfx/timedrenderobject.h b/engines/sword25/gfx/timedrenderobject.h
index 2a5335cb2b..94d882d18e 100644
--- a/engines/sword25/gfx/timedrenderobject.h
+++ b/engines/sword25/gfx/timedrenderobject.h
@@ -45,14 +45,6 @@
namespace Sword25 {
-// -----------------------------------------------------------------------------
-// Forward Declarations
-// -----------------------------------------------------------------------------
-
-// -----------------------------------------------------------------------------
-// Class Definition
-// -----------------------------------------------------------------------------
-
/**
@brief
*/