From 06bce68860696f67f0a0ac1e9682635081918801 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Thu, 2 Sep 2010 17:11:45 +0000 Subject: SWORD25: Comply to the code conventions for several classes svn-id: r53310 --- engines/sword25/fmv/movieplayer.cpp | 34 +- engines/sword25/gfx/animation.cpp | 345 +++++++-------- engines/sword25/gfx/animation.h | 69 ++- engines/sword25/gfx/animationdescription.cpp | 34 +- engines/sword25/gfx/animationdescription.h | 58 +-- engines/sword25/gfx/animationresource.cpp | 88 ++-- engines/sword25/gfx/animationresource.h | 46 +- engines/sword25/gfx/animationtemplate.cpp | 116 ++--- engines/sword25/gfx/animationtemplate.h | 28 +- engines/sword25/gfx/animationtemplateregistry.cpp | 22 +- engines/sword25/gfx/animationtemplateregistry.h | 4 +- engines/sword25/gfx/bitmap.cpp | 148 ++++--- engines/sword25/gfx/bitmap.h | 70 +-- engines/sword25/gfx/bitmapresource.cpp | 20 +- engines/sword25/gfx/bitmapresource.h | 72 +-- engines/sword25/gfx/dynamicbitmap.cpp | 104 ++--- engines/sword25/gfx/dynamicbitmap.h | 26 +- engines/sword25/gfx/fontresource.cpp | 20 +- engines/sword25/gfx/graphicengine.cpp | 10 +- engines/sword25/gfx/graphicengine.h | 6 +- engines/sword25/gfx/graphicengine_script.cpp | 332 +++++++------- engines/sword25/gfx/image/image.h | 34 +- engines/sword25/gfx/image/vectorimage.cpp | 365 ++++++++-------- engines/sword25/gfx/image/vectorimage.h | 154 +++---- engines/sword25/gfx/opengl/glimage.cpp | 122 +++--- engines/sword25/gfx/opengl/glimage.h | 46 +- engines/sword25/gfx/opengl/glvectorimageblit.cpp | 2 +- engines/sword25/gfx/opengl/openglgfx.cpp | 40 +- engines/sword25/gfx/opengl/openglgfx.h | 8 +- engines/sword25/gfx/opengl/swimage.cpp | 50 +-- engines/sword25/gfx/opengl/swimage.h | 46 +- engines/sword25/gfx/panel.cpp | 67 +-- engines/sword25/gfx/panel.h | 22 +- engines/sword25/gfx/renderobject.cpp | 505 +++++++++++----------- engines/sword25/gfx/renderobject.h | 204 ++++----- engines/sword25/gfx/renderobjectmanager.cpp | 92 ++-- engines/sword25/gfx/renderobjectmanager.h | 24 +- engines/sword25/gfx/renderobjectptr.h | 20 +- engines/sword25/gfx/rootrenderobject.h | 10 +- engines/sword25/gfx/staticbitmap.cpp | 149 +++---- engines/sword25/gfx/staticbitmap.h | 26 +- engines/sword25/gfx/text.cpp | 114 ++--- engines/sword25/gfx/text.h | 20 +- engines/sword25/gfx/timedrenderobject.cpp | 12 +- engines/sword25/gfx/timedrenderobject.h | 4 +- engines/sword25/input/scummvminput.cpp | 22 +- engines/sword25/input/scummvminput.h | 4 +- engines/sword25/kernel/inputpersistenceblock.cpp | 22 +- engines/sword25/kernel/inputpersistenceblock.h | 18 +- engines/sword25/kernel/objectregistry.h | 2 +- engines/sword25/kernel/outputpersistenceblock.cpp | 16 +- engines/sword25/kernel/outputpersistenceblock.h | 12 +- engines/sword25/kernel/persistable.h | 4 +- engines/sword25/kernel/persistenceservice.cpp | 20 +- engines/sword25/kernel/resmanager.cpp | 16 +- engines/sword25/kernel/resource.cpp | 18 +- engines/sword25/kernel/resource.h | 26 +- engines/sword25/math/geometry_script.cpp | 10 +- engines/sword25/math/polygon.cpp | 20 +- engines/sword25/math/polygon.h | 4 +- engines/sword25/math/region.cpp | 54 +-- engines/sword25/math/region.h | 4 +- engines/sword25/math/regionregistry.cpp | 28 +- engines/sword25/math/regionregistry.h | 4 +- engines/sword25/math/walkregion.cpp | 40 +- engines/sword25/math/walkregion.h | 4 +- engines/sword25/script/luascript.cpp | 8 +- engines/sword25/script/luascript.h | 4 +- engines/sword25/script/script.h | 4 +- engines/sword25/sfx/fmodexsound.cpp | 4 +- engines/sword25/sfx/fmodexsound.h | 4 +- 71 files changed, 2099 insertions(+), 2061 deletions(-) (limited to 'engines') diff --git a/engines/sword25/fmv/movieplayer.cpp b/engines/sword25/fmv/movieplayer.cpp index 4aad57d435..355a1a14cc 100644 --- a/engines/sword25/fmv/movieplayer.cpp +++ b/engines/sword25/fmv/movieplayer.cpp @@ -67,35 +67,35 @@ bool MoviePlayer::LoadMovie(const Common::String &filename, uint z) { // Ausgabebitmap erstellen GraphicEngine *pGfx = Kernel::GetInstance()->GetGfx(); - _outputBitmap = pGfx->GetMainPanel()->AddDynamicBitmap(_decoder.getWidth(), _decoder.getHeight()); - if (!_outputBitmap.IsValid()) { + _outputBitmap = pGfx->GetMainPanel()->addDynamicBitmap(_decoder.getWidth(), _decoder.getHeight()); + if (!_outputBitmap.isValid()) { BS_LOG_ERRORLN("Output bitmap for movie playback could not be created."); return false; } // Skalierung des Ausgabebitmaps berechnen, so dass es möglichst viel Bildschirmfläche einnimmt. - float ScreenToVideoWidth = (float) pGfx->GetDisplayWidth() / (float) _outputBitmap->GetWidth(); - float ScreenToVideoHeight = (float) pGfx->GetDisplayHeight() / (float) _outputBitmap->GetHeight(); - float ScaleFactor = MIN(ScreenToVideoWidth, ScreenToVideoHeight); + float screenToVideoWidth = (float)pGfx->GetDisplayWidth() / (float)_outputBitmap->getWidth(); + float screenToVideoHeight = (float)pGfx->GetDisplayHeight() / (float)_outputBitmap->getHeight(); + float scaleFactor = MIN(screenToVideoWidth, screenToVideoHeight); - if (abs(ScaleFactor - 1.0f) < FLT_EPSILON) - ScaleFactor = 1.0f; + if (abs(scaleFactor - 1.0f) < FLT_EPSILON) + scaleFactor = 1.0f; - _outputBitmap->SetScaleFactor(ScaleFactor); + _outputBitmap->setScaleFactor(scaleFactor); // Z-Wert setzen - _outputBitmap->SetZ(z); + _outputBitmap->setZ(z); // Ausgabebitmap auf dem Bildschirm zentrieren - _outputBitmap->SetX((pGfx->GetDisplayWidth() - _outputBitmap->GetWidth()) / 2); - _outputBitmap->SetY((pGfx->GetDisplayHeight() - _outputBitmap->GetHeight()) / 2); + _outputBitmap->setX((pGfx->GetDisplayWidth() - _outputBitmap->getWidth()) / 2); + _outputBitmap->setY((pGfx->GetDisplayHeight() - _outputBitmap->getHeight()) / 2); return true; } bool MoviePlayer::UnloadMovie() { _decoder.close(); - _outputBitmap.Erase(); + _outputBitmap.erase(); return true; } @@ -117,7 +117,7 @@ void MoviePlayer::Update() { // Transfer the next frame assert(s->bytesPerPixel == 4); byte *frameData = (byte *)s->getBasePtr(0, 0); - _outputBitmap->SetContent(frameData, s->pitch * s->h, 0, s->pitch); + _outputBitmap->setContent(frameData, s->pitch * s->h, 0, s->pitch); } } @@ -131,19 +131,19 @@ bool MoviePlayer::IsPaused() { float MoviePlayer::GetScaleFactor() { if (_decoder.isVideoLoaded()) - return _outputBitmap->GetScaleFactorX(); + return _outputBitmap->getScaleFactorX(); else return 0; } void MoviePlayer::SetScaleFactor(float scaleFactor) { if (_decoder.isVideoLoaded()) { - _outputBitmap->SetScaleFactor(scaleFactor); + _outputBitmap->setScaleFactor(scaleFactor); // Ausgabebitmap auf dem Bildschirm zentrieren GraphicEngine *gfxPtr = Kernel::GetInstance()->GetGfx(); - _outputBitmap->SetX((gfxPtr->GetDisplayWidth() - _outputBitmap->GetWidth()) / 2); - _outputBitmap->SetY((gfxPtr->GetDisplayHeight() - _outputBitmap->GetHeight()) / 2); + _outputBitmap->setX((gfxPtr->GetDisplayWidth() - _outputBitmap->getWidth()) / 2); + _outputBitmap->setY((gfxPtr->GetDisplayHeight() - _outputBitmap->getHeight()) / 2); } } diff --git a/engines/sword25/gfx/animation.cpp b/engines/sword25/gfx/animation.cpp index 481c020f13..e7430fc062 100644 --- a/engines/sword25/gfx/animation.cpp +++ b/engines/sword25/gfx/animation.cpp @@ -57,17 +57,17 @@ namespace Sword25 { Animation::Animation(RenderObjectPtr 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 (!m_InitSuccess) return; + if (!_initSuccess) return; InitMembers(); // Vom negativen Fall ausgehen. - m_InitSuccess = false; + _initSuccess = false; InitializeAnimationResource(FileName); // Erfolg signalisieren. - m_InitSuccess = true; + _initSuccess = true; } // ----------------------------------------------------------------------------- @@ -75,17 +75,17 @@ Animation::Animation(RenderObjectPtr ParentPtr, const Common::Stri Animation::Animation(RenderObjectPtr ParentPtr, const AnimationTemplate &Template) : TimedRenderObject(ParentPtr, RenderObject::TYPE_ANIMATION) { // Das BS_RenderObject konnte nicht erzeugt werden, daher muss an dieser Stelle abgebrochen werden. - if (!m_InitSuccess) return; + if (!_initSuccess) return; InitMembers(); // Vom negativen Fall ausgehen. - m_InitSuccess = false; + _initSuccess = false; m_AnimationTemplateHandle = AnimationTemplate::Create(Template); // Erfolg signalisieren. - m_InitSuccess = true; + _initSuccess = true; } // ----------------------------------------------------------------------------- @@ -93,12 +93,12 @@ Animation::Animation(RenderObjectPtr ParentPtr, const AnimationTem Animation::Animation(InputPersistenceBlock &Reader, RenderObjectPtr ParentPtr, uint Handle) : TimedRenderObject(ParentPtr, RenderObject::TYPE_ANIMATION, Handle) { // Das BS_RenderObject konnte nicht erzeugt werden, daher muss an dieser Stelle abgebrochen werden. - if (!m_InitSuccess) return; + if (!_initSuccess) return; InitMembers(); // Objekt vom Stream laden. - m_InitSuccess = Unpersist(Reader); + _initSuccess = unpersist(Reader); } // ----------------------------------------------------------------------------- @@ -125,11 +125,11 @@ void Animation::InitMembers() { m_Direction = FORWARD; m_Running = false; m_Finished = false; - m_RelX = 0; - m_RelY = 0; - m_ScaleFactorX = 1.0f; - m_ScaleFactorY = 1.0f; - m_ModulationColor = 0xffffffff; + _relX = 0; + _relY = 0; + _scaleFactorX = 1.0f; + _scaleFactorY = 1.0f; + _modulationColor = 0xffffffff; m_AnimationResourcePtr = 0; m_AnimationTemplateHandle = 0; m_FramesLocked = false; @@ -140,7 +140,7 @@ void Animation::InitMembers() { Animation::~Animation() { if (GetAnimationDescription()) { Stop(); - GetAnimationDescription()->Unlock(); + GetAnimationDescription()->unlock(); } // Delete Callbacks @@ -183,29 +183,29 @@ 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(); - ForceRefresh(); + forceRefresh(); } // ----------------------------------------------------------------------------- // Rendern // ----------------------------------------------------------------------------- -bool Animation::DoRender() { +bool Animation::doRender() { AnimationDescription *animationDescriptionPtr = GetAnimationDescription(); BS_ASSERT(animationDescriptionPtr); - BS_ASSERT(m_CurrentFrame < animationDescriptionPtr->GetFrameCount()); + BS_ASSERT(m_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(m_CurrentFrame).FileName); BS_ASSERT(pResource); BS_ASSERT(pResource->GetType() == Resource::TYPE_BITMAP); BitmapResource *pBitmapResource = static_cast(pResource); @@ -216,20 +216,20 @@ bool Animation::DoRender() { // Bitmap zeichnen bool Result; - if (IsScalingAllowed() && (m_Width != pBitmapResource->GetWidth() || m_Height != pBitmapResource->GetHeight())) { - Result = pBitmapResource->Blit(m_AbsoluteX, m_AbsoluteY, - (animationDescriptionPtr->GetFrame(m_CurrentFrame).FlipV ? BitmapResource::FLIP_V : 0) | - (animationDescriptionPtr->GetFrame(m_CurrentFrame).FlipH ? BitmapResource::FLIP_H : 0), - 0, m_ModulationColor, m_Width, m_Height); + 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), + 0, _modulationColor, _width, _height); } else { - Result = pBitmapResource->Blit(m_AbsoluteX, m_AbsoluteY, - (animationDescriptionPtr->GetFrame(m_CurrentFrame).FlipV ? BitmapResource::FLIP_V : 0) | - (animationDescriptionPtr->GetFrame(m_CurrentFrame).FlipH ? BitmapResource::FLIP_H : 0), - 0, m_ModulationColor, -1, -1); + Result = pBitmapResource->blit(_absoluteX, _absoluteY, + (animationDescriptionPtr->getFrame(m_CurrentFrame).FlipV ? BitmapResource::FLIP_V : 0) | + (animationDescriptionPtr->getFrame(m_CurrentFrame).FlipH ? BitmapResource::FLIP_H : 0), + 0, _modulationColor, -1, -1); } // Resource freigeben - pBitmapResource->Release(); + pBitmapResource->release(); return Result; } @@ -238,7 +238,7 @@ bool Animation::DoRender() { // Frame Notifikation // ----------------------------------------------------------------------------- -void Animation::FrameNotification(int TimeElapsed) { +void Animation::frameNotification(int TimeElapsed) { AnimationDescription *animationDescriptionPtr = GetAnimationDescription(); BS_ASSERT(animationDescriptionPtr); BS_ASSERT(TimeElapsed >= 0); @@ -249,10 +249,10 @@ void Animation::FrameNotification(int TimeElapsed) { m_CurrentFrameTime += TimeElapsed; // Anzahl an zu überpringenden Frames bestimmen - int SkipFrames = animationDescriptionPtr->GetMillisPerFrame() == 0 ? 0 : m_CurrentFrameTime / animationDescriptionPtr->GetMillisPerFrame(); + int SkipFrames = animationDescriptionPtr->getMillisPerFrame() == 0 ? 0 : m_CurrentFrameTime / animationDescriptionPtr->getMillisPerFrame(); // Neue Frame-Restzeit bestimmen - m_CurrentFrameTime -= animationDescriptionPtr->GetMillisPerFrame() * SkipFrames; + m_CurrentFrameTime -= animationDescriptionPtr->getMillisPerFrame() * SkipFrames; // Neuen Frame bestimmen (je nach aktuellener Abspielrichtung wird addiert oder subtrahiert) int TmpCurFrame = m_CurrentFrame; @@ -280,10 +280,10 @@ void Animation::FrameNotification(int TimeElapsed) { } // Ein Unterlauf darf nur auftreten, wenn der Animationstyp JOJO ist. - BS_ASSERT(animationDescriptionPtr->GetAnimationType() == AT_JOJO); + BS_ASSERT(animationDescriptionPtr->getAnimationType() == AT_JOJO); TmpCurFrame = - TmpCurFrame; m_Direction = FORWARD; - } else if (static_cast(TmpCurFrame) >= animationDescriptionPtr->GetFrameCount()) { + } else if (static_cast(TmpCurFrame) >= animationDescriptionPtr->getFrameCount()) { // Loop-Point Callbacks for (uint i = 0; i < m_LoopPointCallbacks.size();) { if ((m_LoopPointCallbacks[i].Callback)(m_LoopPointCallbacks[i].Data) == false) { @@ -292,19 +292,19 @@ void Animation::FrameNotification(int TimeElapsed) { i++; } - switch (animationDescriptionPtr->GetAnimationType()) { + switch (animationDescriptionPtr->getAnimationType()) { case AT_ONESHOT: - TmpCurFrame = animationDescriptionPtr->GetFrameCount() - 1; + TmpCurFrame = animationDescriptionPtr->getFrameCount() - 1; m_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; + TmpCurFrame = animationDescriptionPtr->getFrameCount() - (TmpCurFrame % animationDescriptionPtr->getFrameCount()) - 1; m_Direction = BACKWARD; break; @@ -314,9 +314,9 @@ void Animation::FrameNotification(int TimeElapsed) { } if ((int)m_CurrentFrame != TmpCurFrame) { - ForceRefresh(); + forceRefresh(); - if (animationDescriptionPtr->GetFrame(m_CurrentFrame).Action != "") { + if (animationDescriptionPtr->getFrame(m_CurrentFrame).Action != "") { // Action Callbacks for (uint i = 0; i < m_ActionCallbacks.size();) { if ((m_ActionCallbacks[i].Callback)(m_ActionCallbacks[i].Data) == false) { @@ -333,7 +333,7 @@ void Animation::FrameNotification(int TimeElapsed) { // Größe und Position der Animation anhand des aktuellen Frames bestimmen ComputeCurrentCharacteristics(); - BS_ASSERT(m_CurrentFrame < animationDescriptionPtr->GetFrameCount()); + BS_ASSERT(m_CurrentFrame < animationDescriptionPtr->getFrameCount()); BS_ASSERT(m_CurrentFrameTime >= 0); } @@ -342,7 +342,7 @@ void Animation::FrameNotification(int TimeElapsed) { void Animation::ComputeCurrentCharacteristics() { AnimationDescription *animationDescriptionPtr = GetAnimationDescription(); BS_ASSERT(animationDescriptionPtr); - const AnimationResource::Frame &CurFrame = animationDescriptionPtr->GetFrame(m_CurrentFrame); + const AnimationResource::Frame &CurFrame = animationDescriptionPtr->getFrame(m_CurrentFrame); Resource *pResource = Kernel::GetInstance()->GetResourceManager()->RequestResource(CurFrame.FileName); BS_ASSERT(pResource); @@ -350,16 +350,16 @@ void Animation::ComputeCurrentCharacteristics() { BitmapResource *pBitmap = static_cast(pResource); // Größe des Bitmaps auf die Animation übertragen - m_Width = static_cast(pBitmap->GetWidth() * m_ScaleFactorX); - m_Height = static_cast(pBitmap->GetHeight() * m_ScaleFactorY); + _width = static_cast(pBitmap->getWidth() * _scaleFactorX); + _height = static_cast(pBitmap->getHeight() * _scaleFactorY); // Position anhand des Hotspots berechnen und setzen - int PosX = m_RelX + ComputeXModifier(); - int PosY = m_RelY + ComputeYModifier(); + int PosX = _relX + ComputeXModifier(); + int PosY = _relY + ComputeYModifier(); - RenderObject::SetPos(PosX, PosY); + RenderObject::setPos(PosX, PosY); - pBitmap->Release(); + pBitmap->release(); } // ----------------------------------------------------------------------------- @@ -368,8 +368,8 @@ bool Animation::LockAllFrames() { if (!m_FramesLocked) { AnimationDescription *animationDescriptionPtr = GetAnimationDescription(); BS_ASSERT(animationDescriptionPtr); - for (uint i = 0; i < animationDescriptionPtr->GetFrameCount(); ++i) { - if (!Kernel::GetInstance()->GetResourceManager()->RequestResource(animationDescriptionPtr->GetFrame(i).FileName)) { + for (uint i = 0; i < animationDescriptionPtr->getFrameCount(); ++i) { + if (!Kernel::GetInstance()->GetResourceManager()->RequestResource(animationDescriptionPtr->getFrame(i).FileName)) { BS_LOG_ERRORLN("Could not lock all animation frames."); return false; } @@ -387,16 +387,17 @@ bool Animation::UnlockAllFrames() { if (m_FramesLocked) { AnimationDescription *animationDescriptionPtr = GetAnimationDescription(); BS_ASSERT(animationDescriptionPtr); - for (uint i = 0; i < animationDescriptionPtr->GetFrameCount(); ++i) { + 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; } // Zwei mal freigeben um den Request von LockAllFrames() und den jetzigen Request aufzuheben - pResource->Release(); - if (pResource->GetLockCount()) pResource->Release(); + pResource->release(); + if (pResource->GetLockCount()) + pResource->release(); } m_FramesLocked = false; @@ -409,75 +410,75 @@ bool Animation::UnlockAllFrames() { // Getter // ----------------------------------------------------------------------------- -Animation::ANIMATION_TYPES Animation::GetAnimationType() const { +Animation::ANIMATION_TYPES Animation::getAnimationType() const { AnimationDescription *animationDescriptionPtr = GetAnimationDescription(); BS_ASSERT(animationDescriptionPtr); - return animationDescriptionPtr->GetAnimationType(); + return animationDescriptionPtr->getAnimationType(); } // ----------------------------------------------------------------------------- -int Animation::GetFPS() const { +int Animation::getFPS() const { AnimationDescription *animationDescriptionPtr = GetAnimationDescription(); BS_ASSERT(animationDescriptionPtr); - return animationDescriptionPtr->GetFPS(); + return animationDescriptionPtr->getFPS(); } // ----------------------------------------------------------------------------- -int Animation::GetFrameCount() const { +int Animation::getFrameCount() const { AnimationDescription *animationDescriptionPtr = GetAnimationDescription(); BS_ASSERT(animationDescriptionPtr); - return animationDescriptionPtr->GetFrameCount(); + return animationDescriptionPtr->getFrameCount(); } // ----------------------------------------------------------------------------- -bool Animation::IsScalingAllowed() const { +bool Animation::isScalingAllowed() const { AnimationDescription *animationDescriptionPtr = GetAnimationDescription(); BS_ASSERT(animationDescriptionPtr); - return animationDescriptionPtr->IsScalingAllowed(); + return animationDescriptionPtr->isScalingAllowed(); } // ----------------------------------------------------------------------------- -bool Animation::IsAlphaAllowed() const { +bool Animation::isAlphaAllowed() const { AnimationDescription *animationDescriptionPtr = GetAnimationDescription(); BS_ASSERT(animationDescriptionPtr); - return animationDescriptionPtr->IsAlphaAllowed(); + return animationDescriptionPtr->isAlphaAllowed(); } // ----------------------------------------------------------------------------- -bool Animation::IsColorModulationAllowed() const { +bool Animation::isColorModulationAllowed() const { AnimationDescription *animationDescriptionPtr = GetAnimationDescription(); BS_ASSERT(animationDescriptionPtr); - return animationDescriptionPtr->IsColorModulationAllowed(); + return animationDescriptionPtr->isColorModulationAllowed(); } // ----------------------------------------------------------------------------- // Positionieren // ----------------------------------------------------------------------------- -void Animation::SetPos(int RelX, int RelY) { - m_RelX = RelX; - m_RelY = RelY; +void Animation::setPos(int relX, int relY) { + _relX = relX; + _relY = relY; ComputeCurrentCharacteristics(); } // ----------------------------------------------------------------------------- -void Animation::SetX(int RelX) { - m_RelX = RelX; +void Animation::setX(int relX) { + _relX = relX; ComputeCurrentCharacteristics(); } // ----------------------------------------------------------------------------- -void Animation::SetY(int RelY) { - m_RelY = RelY; +void Animation::setY(int relY) { + _relY = relY; ComputeCurrentCharacteristics(); } @@ -486,77 +487,79 @@ void Animation::SetY(int RelY) { // Darstellungsart festlegen // ----------------------------------------------------------------------------- -void Animation::SetAlpha(int Alpha) { +void Animation::setAlpha(int alpha) { AnimationDescription *animationDescriptionPtr = GetAnimationDescription(); BS_ASSERT(animationDescriptionPtr); - if (!animationDescriptionPtr->IsAlphaAllowed()) { + if (!animationDescriptionPtr->isAlphaAllowed()) { BS_LOG_WARNINGLN("Tried to set alpha value on an animation that does not support alpha. Call was ignored."); return; } - uint NewModulationColor = (m_ModulationColor & 0x00ffffff) | Alpha << 24; - if (NewModulationColor != m_ModulationColor) { - m_ModulationColor = NewModulationColor; - ForceRefresh(); + uint newModulationColor = (_modulationColor & 0x00ffffff) | alpha << 24; + if (newModulationColor != _modulationColor) { + _modulationColor = newModulationColor; + forceRefresh(); } } // ----------------------------------------------------------------------------- -void Animation::SetModulationColor(uint ModulationColor) { +void Animation::setModulationColor(uint modulationColor) { AnimationDescription *animationDescriptionPtr = GetAnimationDescription(); BS_ASSERT(animationDescriptionPtr); - if (!animationDescriptionPtr->IsColorModulationAllowed()) { + if (!animationDescriptionPtr->isColorModulationAllowed()) { BS_LOG_WARNINGLN("Tried to set modulation color on an animation that does not support color modulation. Call was ignored"); return; } - uint NewModulationColor = (ModulationColor & 0x00ffffff) | (m_ModulationColor & 0xff000000); - if (NewModulationColor != m_ModulationColor) { - m_ModulationColor = NewModulationColor; - ForceRefresh(); + uint newModulationColor = (modulationColor & 0x00ffffff) | (_modulationColor & 0xff000000); + if (newModulationColor != _modulationColor) { + _modulationColor = newModulationColor; + forceRefresh(); } } // ----------------------------------------------------------------------------- -void Animation::SetScaleFactor(float ScaleFactor) { - SetScaleFactorX(ScaleFactor); - SetScaleFactorY(ScaleFactor); +void Animation::setScaleFactor(float scaleFactor) { + setScaleFactorX(scaleFactor); + setScaleFactorY(scaleFactor); } // ----------------------------------------------------------------------------- -void Animation::SetScaleFactorX(float ScaleFactorX) { +void Animation::setScaleFactorX(float scaleFactorX) { AnimationDescription *animationDescriptionPtr = GetAnimationDescription(); BS_ASSERT(animationDescriptionPtr); - if (!animationDescriptionPtr->IsScalingAllowed()) { + if (!animationDescriptionPtr->isScalingAllowed()) { BS_LOG_WARNINGLN("Tried to set x scale factor on an animation that does not support scaling. Call was ignored"); return; } - if (ScaleFactorX != m_ScaleFactorX) { - m_ScaleFactorX = ScaleFactorX; - if (m_ScaleFactorX <= 0.0f) m_ScaleFactorX = 0.001f; - ForceRefresh(); + if (scaleFactorX != _scaleFactorX) { + _scaleFactorX = scaleFactorX; + if (_scaleFactorX <= 0.0f) + _scaleFactorX = 0.001f; + forceRefresh(); ComputeCurrentCharacteristics(); } } // ----------------------------------------------------------------------------- -void Animation::SetScaleFactorY(float ScaleFactorY) { +void Animation::setScaleFactorY(float scaleFactorY) { AnimationDescription *animationDescriptionPtr = GetAnimationDescription(); BS_ASSERT(animationDescriptionPtr); - if (!animationDescriptionPtr->IsScalingAllowed()) { + if (!animationDescriptionPtr->isScalingAllowed()) { BS_LOG_WARNINGLN("Tried to set y scale factor on an animation that does not support scaling. Call was ignored"); return; } - if (ScaleFactorY != m_ScaleFactorY) { - m_ScaleFactorY = ScaleFactorY; - if (m_ScaleFactorY <= 0.0f) m_ScaleFactorY = 0.001f; - ForceRefresh(); + if (scaleFactorY != _scaleFactorY) { + _scaleFactorY = scaleFactorY; + if (_scaleFactorY <= 0.0f) + _scaleFactorY = 0.001f; + forceRefresh(); ComputeCurrentCharacteristics(); } } @@ -566,31 +569,31 @@ void Animation::SetScaleFactorY(float ScaleFactorY) { const Common::String &Animation::GetCurrentAction() const { AnimationDescription *animationDescriptionPtr = GetAnimationDescription(); BS_ASSERT(animationDescriptionPtr); - return animationDescriptionPtr->GetFrame(m_CurrentFrame).Action; + return animationDescriptionPtr->getFrame(m_CurrentFrame).Action; } // ----------------------------------------------------------------------------- -int Animation::GetX() const { - return m_RelX; +int Animation::getX() const { + return _relX; } // ----------------------------------------------------------------------------- -int Animation::GetY() const { - return m_RelY; +int Animation::getY() const { + return _relY; } // ----------------------------------------------------------------------------- -int Animation::GetAbsoluteX() const { - return m_AbsoluteX + (m_RelX - m_X); +int Animation::getAbsoluteX() const { + return _absoluteX + (_relX - _x); } // ----------------------------------------------------------------------------- -int Animation::GetAbsoluteY() const { - return m_AbsoluteY + (m_RelY - m_Y); +int Animation::getAbsoluteY() const { + return _absoluteY + (_relY - _y); } // ----------------------------------------------------------------------------- @@ -598,17 +601,17 @@ int Animation::GetAbsoluteY() const { int Animation::ComputeXModifier() const { AnimationDescription *animationDescriptionPtr = GetAnimationDescription(); BS_ASSERT(animationDescriptionPtr); - const AnimationResource::Frame &CurFrame = animationDescriptionPtr->GetFrame(m_CurrentFrame); + const AnimationResource::Frame &CurFrame = animationDescriptionPtr->getFrame(m_CurrentFrame); Resource *pResource = Kernel::GetInstance()->GetResourceManager()->RequestResource(CurFrame.FileName); BS_ASSERT(pResource); BS_ASSERT(pResource->GetType() == Resource::TYPE_BITMAP); BitmapResource *pBitmap = static_cast(pResource); - int Result = CurFrame.FlipV ? - static_cast((pBitmap->GetWidth() - 1 - CurFrame.HotspotX) * m_ScaleFactorX) : - - static_cast(CurFrame.HotspotX * m_ScaleFactorX); + int Result = CurFrame.FlipV ? - static_cast((pBitmap->getWidth() - 1 - CurFrame.HotspotX) * _scaleFactorX) : + - static_cast(CurFrame.HotspotX * _scaleFactorX); - pBitmap->Release(); + pBitmap->release(); return Result; } @@ -618,17 +621,17 @@ int Animation::ComputeXModifier() const { int Animation::ComputeYModifier() const { AnimationDescription *animationDescriptionPtr = GetAnimationDescription(); BS_ASSERT(animationDescriptionPtr); - const AnimationResource::Frame &CurFrame = animationDescriptionPtr->GetFrame(m_CurrentFrame); + const AnimationResource::Frame &CurFrame = animationDescriptionPtr->getFrame(m_CurrentFrame); Resource *pResource = Kernel::GetInstance()->GetResourceManager()->RequestResource(CurFrame.FileName); BS_ASSERT(pResource); BS_ASSERT(pResource->GetType() == Resource::TYPE_BITMAP); BitmapResource *pBitmap = static_cast(pResource); - int Result = CurFrame.FlipH ? - static_cast((pBitmap->GetHeight() - 1 - CurFrame.HotspotY) * m_ScaleFactorY) : - - static_cast(CurFrame.HotspotY * m_ScaleFactorY); + int Result = CurFrame.FlipH ? - static_cast((pBitmap->getHeight() - 1 - CurFrame.HotspotY) * _scaleFactorY) : + - static_cast(CurFrame.HotspotY * _scaleFactorY); - pBitmap->Release(); + pBitmap->release(); return Result; } @@ -666,13 +669,13 @@ void Animation::RegisterDeleteCallback(ANIMATION_CALLBACK Callback, uint Data) { void Animation::PersistCallbackVector(OutputPersistenceBlock &Writer, const Common::Array & Vector) { // Anzahl an Callbacks persistieren. - Writer.Write(Vector.size()); + Writer.write(Vector.size()); // Alle Callbacks einzeln persistieren. Common::Array::const_iterator It = Vector.begin(); while (It != Vector.end()) { - Writer.Write(CallbackRegistry::getInstance().resolveCallbackPointer((void (*)(int))It->Callback)); - Writer.Write(It->Data); + Writer.write(CallbackRegistry::getInstance().resolveCallbackPointer((void (*)(int))It->Callback)); + Writer.write(It->Data); ++It; } @@ -686,17 +689,17 @@ void Animation::UnpersistCallbackVector(InputPersistenceBlock &Reader, Common::A // Anzahl an Callbacks einlesen. uint CallbackCount; - Reader.Read(CallbackCount); + Reader.read(CallbackCount); // Alle Callbacks einzeln wieder herstellen. for (uint i = 0; i < CallbackCount; ++i) { ANIMATION_CALLBACK_DATA CallbackData; Common::String CallbackFunctionName; - Reader.Read(CallbackFunctionName); + Reader.read(CallbackFunctionName); CallbackData.Callback = reinterpret_cast(CallbackRegistry::getInstance().resolveCallbackFunction(CallbackFunctionName)); - Reader.Read(CallbackData.Data); + Reader.read(CallbackData.Data); Vector.push_back(CallbackData); } @@ -704,97 +707,97 @@ void Animation::UnpersistCallbackVector(InputPersistenceBlock &Reader, Common::A // ----------------------------------------------------------------------------- -bool Animation::Persist(OutputPersistenceBlock &Writer) { - bool Result = true; +bool Animation::persist(OutputPersistenceBlock &writer) { + bool result = true; - Result &= RenderObject::Persist(Writer); + result &= RenderObject::persist(writer); - Writer.Write(m_RelX); - Writer.Write(m_RelY); - Writer.Write(m_ScaleFactorX); - Writer.Write(m_ScaleFactorY); - Writer.Write(m_ModulationColor); - Writer.Write(m_CurrentFrame); - Writer.Write(m_CurrentFrameTime); - Writer.Write(m_Running); - Writer.Write(m_Finished); - Writer.Write(static_cast(m_Direction)); + writer.write(_relX); + writer.write(_relY); + 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(m_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()); + writer.write(Marker); + writer.write(m_AnimationResourcePtr->getFileName()); } else if (m_AnimationTemplateHandle) { uint Marker = 1; - Writer.Write(Marker); - Writer.Write(m_AnimationTemplateHandle); + writer.write(Marker); + writer.write(m_AnimationTemplateHandle); } else { BS_ASSERT(false); } - //Writer.Write(m_AnimationDescriptionPtr); + //writer.write(m_AnimationDescriptionPtr); - Writer.Write(m_FramesLocked); - PersistCallbackVector(Writer, m_LoopPointCallbacks); - PersistCallbackVector(Writer, m_ActionCallbacks); - PersistCallbackVector(Writer, m_DeleteCallbacks); + writer.write(m_FramesLocked); + PersistCallbackVector(writer, m_LoopPointCallbacks); + PersistCallbackVector(writer, m_ActionCallbacks); + PersistCallbackVector(writer, m_DeleteCallbacks); - Result &= RenderObject::PersistChildren(Writer); + result &= RenderObject::persistChildren(writer); - return Result; + return result; } // ----------------------------------------------------------------------------- -bool Animation::Unpersist(InputPersistenceBlock &Reader) { - bool Result = true; +bool Animation::unpersist(InputPersistenceBlock &reader) { + bool result = true; - Result &= RenderObject::Unpersist(Reader); + result &= RenderObject::unpersist(reader); - Reader.Read(m_RelX); - Reader.Read(m_RelY); - Reader.Read(m_ScaleFactorX); - Reader.Read(m_ScaleFactorY); - Reader.Read(m_ModulationColor); - Reader.Read(m_CurrentFrame); - Reader.Read(m_CurrentFrameTime); - Reader.Read(m_Running); - Reader.Read(m_Finished); + reader.read(_relX); + reader.read(_relY); + 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); + reader.read(Direction); m_Direction = static_cast(Direction); // Animationstyp einlesen. uint Marker; - Reader.Read(Marker); + reader.read(Marker); if (Marker == 0) { Common::String ResourceFilename; - Reader.Read(ResourceFilename); + reader.read(ResourceFilename); InitializeAnimationResource(ResourceFilename); } else if (Marker == 1) { - Reader.Read(m_AnimationTemplateHandle); + reader.read(m_AnimationTemplateHandle); } else { BS_ASSERT(false); } - Reader.Read(m_FramesLocked); + reader.read(m_FramesLocked); if (m_FramesLocked) LockAllFrames(); - UnpersistCallbackVector(Reader, m_LoopPointCallbacks); - UnpersistCallbackVector(Reader, m_ActionCallbacks); - UnpersistCallbackVector(Reader, m_DeleteCallbacks); + UnpersistCallbackVector(reader, m_LoopPointCallbacks); + UnpersistCallbackVector(reader, m_ActionCallbacks); + UnpersistCallbackVector(reader, m_DeleteCallbacks); - Result &= RenderObject::UnpersistChildren(Reader); + result &= RenderObject::unpersistChildren(reader); - return Reader.IsGood() && Result; + return reader.isGood() && result; } // ----------------------------------------------------------------------------- AnimationDescription *Animation::GetAnimationDescription() const { if (m_AnimationResourcePtr) return m_AnimationResourcePtr; - else return AnimationTemplateRegistry::GetInstance().ResolveHandle(m_AnimationTemplateHandle); + else return AnimationTemplateRegistry::GetInstance().resolveHandle(m_AnimationTemplateHandle); } } // End of namespace Sword25 diff --git a/engines/sword25/gfx/animation.h b/engines/sword25/gfx/animation.h index 2d6c9c95fd..de684ce395 100644 --- a/engines/sword25/gfx/animation.h +++ b/engines/sword25/gfx/animation.h @@ -43,7 +43,6 @@ namespace Sword25 { // Forward declarations class Kernel; -class BS_PackageManager; class AnimationResource; class AnimationTemplate; class AnimationDescription; @@ -53,9 +52,9 @@ class Animation : public TimedRenderObject { friend class RenderObject; private: - Animation(RenderObjectPtr ParentPtr, const Common::String &FileName); - Animation(RenderObjectPtr ParentPtr, const AnimationTemplate &Template); - Animation(InputPersistenceBlock &Reader, RenderObjectPtr ParentPtr, uint Handle); + Animation(RenderObjectPtr parentPtr, const Common::String &fileName); + Animation(RenderObjectPtr parentPtr, const AnimationTemplate &template_); + Animation(InputPersistenceBlock &reader, RenderObjectPtr parentPtr, uint handle); public: enum ANIMATION_TYPES { @@ -71,77 +70,77 @@ public: void Stop(); void SetFrame(uint Nr); - virtual void SetPos(int X, int Y); - virtual void SetX(int X); - virtual void SetY(int Y); + virtual void setPos(int x, int y); + virtual void setX(int x); + virtual void setY(int y); - virtual int GetX() const; - virtual int GetY() const; - virtual int GetAbsoluteX() const; - virtual int GetAbsoluteY() const; + virtual int getX() const; + virtual int getY() const; + virtual int getAbsoluteX() const; + virtual int getAbsoluteY() const; /** @brief Setzt den Alphawert der Animation. @param Alpha der neue Alphawert der Animation (0 = keine Deckung, 255 = volle Deckung). @remark Diese Methode darf nur aufgerufen werden, wenn die Methode IsAlphaAllowed() true zurückgibt. */ - void SetAlpha(int Alpha); + void setAlpha(int alpha); /** @brief Setzt die Modulationfarbe der Animation. @param Color eine 24-Bit Farbe, die die Modulationsfarbe der Animation festlegt. @remark Diese Methode darf nur aufgerufen werden, wenn die Methode IsColorModulationAllowed() true zurückgibt. */ - void SetModulationColor(uint ModulationColor); + void setModulationColor(uint modulationColor); /** @brief Setzt den Skalierungsfaktor der Animation. @param ScaleFactor der Faktor um den die Animation in beide Richtungen gestreckt werden soll. @remark Diese Methode darf nur aufgerufen werden, wenn die Methode IsScalingAllowed() true zurückgibt. */ - void SetScaleFactor(float ScaleFactor); + void setScaleFactor(float scaleFactor); /** @brief Setzt den Skalierungsfaktor der Animation auf der X-Achse. @param ScaleFactor der Faktor um den die Animation in Richtungen der X-Achse gestreckt werden soll. @remark Diese Methode darf nur aufgerufen werden, wenn die Methode IsScalingAllowed() true zurückgibt. */ - void SetScaleFactorX(float ScaleFactorX); + void setScaleFactorX(float scaleFactorX); /** @brief Setzt den Skalierungsfaktor der Animation auf der Y-Achse. @param ScaleFactor der Faktor um den die Animation in Richtungen der Y-Achse gestreckt werden soll. @remark Diese Methode darf nur aufgerufen werden, wenn die Methode IsScalingAllowed() true zurückgibt. */ - void SetScaleFactorY(float ScaleFactorY); + void setScaleFactorY(float scaleFactorY); /** @brief Gibt den Skalierungsfakter der Animation auf der X-Achse zurück. @remark Diese Methode darf nur aufgerufen werden, wenn die Methode IsScalingAllowed() true zurückgibt. */ - float GetScaleFactorX() const { - return m_ScaleFactorX; + float getScaleFactorX() const { + return _scaleFactorX; } /** @brief Gibt den Skalierungsfakter der Animation auf der Y-Achse zurück. @remark Diese Methode darf nur aufgerufen werden, wenn die Methode IsScalingAllowed() true zurückgibt. */ - float GetScaleFactorY() const { - return m_ScaleFactorY; + float getScaleFactorY() const { + return _scaleFactorY; } - virtual bool Persist(OutputPersistenceBlock &Writer); - virtual bool Unpersist(InputPersistenceBlock &Reader); + virtual bool persist(OutputPersistenceBlock &writer); + virtual bool unpersist(InputPersistenceBlock &reader); - virtual void FrameNotification(int TimeElapsed); + virtual void frameNotification(int timeElapsed); - ANIMATION_TYPES GetAnimationType() const; - int GetFPS() const; - int GetFrameCount() const; - bool IsScalingAllowed() const; - bool IsAlphaAllowed() const; - bool IsColorModulationAllowed() const; + ANIMATION_TYPES getAnimationType() const; + int getFPS() const; + int getFrameCount() const; + bool isScalingAllowed() const; + bool isAlphaAllowed() const; + bool isColorModulationAllowed() const; uint GetCurrentFrame() const { return m_CurrentFrame; } @@ -157,7 +156,7 @@ public: void RegisterDeleteCallback(ANIMATION_CALLBACK Callback, uint Data = 0); protected: - virtual bool DoRender(); + virtual bool doRender(); private: enum DIRECTION { @@ -165,11 +164,11 @@ private: BACKWARD }; - int m_RelX; - int m_RelY; - float m_ScaleFactorX; - float m_ScaleFactorY; - uint m_ModulationColor; + int _relX; + int _relY; + float _scaleFactorX; + float _scaleFactorY; + uint _modulationColor; uint m_CurrentFrame; int m_CurrentFrameTime; bool m_Running; diff --git a/engines/sword25/gfx/animationdescription.cpp b/engines/sword25/gfx/animationdescription.cpp index 82fa03240c..a2a8c9bcf0 100644 --- a/engines/sword25/gfx/animationdescription.cpp +++ b/engines/sword25/gfx/animationdescription.cpp @@ -46,30 +46,30 @@ namespace Sword25 { // Persistenz // ----------------------------------------------------------------------------- -bool AnimationDescription::Persist(OutputPersistenceBlock &Writer) { - Writer.Write(static_cast(m_AnimationType)); - Writer.Write(m_FPS); - Writer.Write(m_MillisPerFrame); - Writer.Write(m_ScalingAllowed); - Writer.Write(m_AlphaAllowed); - Writer.Write(m_ColorModulationAllowed); +bool AnimationDescription::persist(OutputPersistenceBlock &writer) { + writer.write(static_cast(_animationType)); + writer.write(_FPS); + writer.write(_millisPerFrame); + writer.write(_scalingAllowed); + writer.write(_alphaAllowed); + writer.write(_colorModulationAllowed); return true; } // ----------------------------------------------------------------------------- -bool AnimationDescription::Unpersist(InputPersistenceBlock &Reader) { - uint AnimationType; - Reader.Read(AnimationType); - m_AnimationType = static_cast(AnimationType); - Reader.Read(m_FPS); - Reader.Read(m_MillisPerFrame); - Reader.Read(m_ScalingAllowed); - Reader.Read(m_AlphaAllowed); - Reader.Read(m_ColorModulationAllowed); +bool AnimationDescription::unpersist(InputPersistenceBlock &reader) { + uint animationType; + reader.read(animationType); + _animationType = static_cast(animationType); + reader.read(_FPS); + reader.read(_millisPerFrame); + reader.read(_scalingAllowed); + reader.read(_alphaAllowed); + reader.read(_colorModulationAllowed); - return Reader.IsGood(); + return reader.isGood(); } } // End of namespace Sword25 diff --git a/engines/sword25/gfx/animationdescription.h b/engines/sword25/gfx/animationdescription.h index 7170320a15..8b54dcbf15 100644 --- a/engines/sword25/gfx/animationdescription.h +++ b/engines/sword25/gfx/animationdescription.h @@ -52,12 +52,12 @@ namespace Sword25 { class AnimationDescription : public Persistable { protected: AnimationDescription() : - m_AnimationType(Animation::AT_LOOP), - m_FPS(10), - m_MillisPerFrame(0), - m_ScalingAllowed(true), - m_AlphaAllowed(true), - m_ColorModulationAllowed(true) + _animationType(Animation::AT_LOOP), + _FPS(10), + _millisPerFrame(0), + _scalingAllowed(true), + _alphaAllowed(true), + _colorModulationAllowed(true) {}; public: @@ -75,43 +75,43 @@ public: // Abstrakte Methoden // ----------------------------------------------------------------------------- - virtual const Frame &GetFrame(uint Index) const = 0; - virtual uint GetFrameCount() const = 0; - virtual void Unlock() = 0; + 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 m_AnimationType; + Animation::ANIMATION_TYPES getAnimationType() const { + return _animationType; } - int GetFPS() const { - return m_FPS; + int getFPS() const { + return _FPS; } - int GetMillisPerFrame() const { - return m_MillisPerFrame; + int getMillisPerFrame() const { + return _millisPerFrame; } - bool IsScalingAllowed() const { - return m_ScalingAllowed; + bool isScalingAllowed() const { + return _scalingAllowed; } - bool IsAlphaAllowed() const { - return m_AlphaAllowed; + bool isAlphaAllowed() const { + return _alphaAllowed; } - bool IsColorModulationAllowed() const { - return m_ColorModulationAllowed; + bool isColorModulationAllowed() const { + return _colorModulationAllowed; } - virtual bool Persist(OutputPersistenceBlock &Writer); - virtual bool Unpersist(InputPersistenceBlock &Reader); + virtual bool persist(OutputPersistenceBlock &writer); + virtual bool unpersist(InputPersistenceBlock &reader); protected: - Animation::ANIMATION_TYPES m_AnimationType; - int m_FPS; - int m_MillisPerFrame; - bool m_ScalingAllowed; - bool m_AlphaAllowed; - bool m_ColorModulationAllowed; + Animation::ANIMATION_TYPES _animationType; + int _FPS; + int _millisPerFrame; + bool _scalingAllowed; + bool _alphaAllowed; + bool _colorModulationAllowed; }; } // End of namespace Sword25 diff --git a/engines/sword25/gfx/animationresource.cpp b/engines/sword25/gfx/animationresource.cpp index 5dc37a1c56..6a1e3d4f2c 100644 --- a/engines/sword25/gfx/animationresource.cpp +++ b/engines/sword25/gfx/animationresource.cpp @@ -66,7 +66,7 @@ const int MAX_FPS = 200; AnimationResource::AnimationResource(const Common::String &filename) : Resource(filename, Resource::TYPE_ANIMATION), Common::XMLParser(), - m_Valid(false) { + _valid(false) { // Get a pointer to the package manager Kernel *pKernel = Kernel::GetInstance(); _pPackage = static_cast(pKernel->GetService("package")); @@ -74,16 +74,16 @@ AnimationResource::AnimationResource(const Common::String &filename) : // Switch to the folder the specified Xml fiile is in Common::String oldDirectory = _pPackage->GetCurrentDirectory(); - if (GetFileName().contains('/')) { - Common::String dir = Common::String(GetFileName().c_str(), strrchr(GetFileName().c_str(), '/')); + if (getFileName().contains('/')) { + Common::String dir = Common::String(getFileName().c_str(), strrchr(getFileName().c_str(), '/')); _pPackage->ChangeDirectory(dir); } // Load the contents of the file uint fileSize; - char *xmlData = _pPackage->GetXmlFile(GetFileName(), &fileSize); + char *xmlData = _pPackage->GetXmlFile(getFileName(), &fileSize); if (!xmlData) { - BS_LOG_ERRORLN("Could not read \"%s\".", GetFileName().c_str()); + BS_LOG_ERRORLN("Could not read \"%s\".", getFileName().c_str()); return; } @@ -91,7 +91,7 @@ AnimationResource::AnimationResource(const Common::String &filename) : if (!loadBuffer((const byte *)xmlData, fileSize)) return; - m_Valid = parse(); + _valid = parse(); close(); free(xmlData); @@ -99,24 +99,24 @@ AnimationResource::AnimationResource(const Common::String &filename) : _pPackage->ChangeDirectory(oldDirectory); // Give an error message if there weren't any frames specified - if (m_Frames.empty()) { - BS_LOG_ERRORLN("\"%s\" does not have any frames.", GetFileName().c_str()); + if (_frames.empty()) { + BS_LOG_ERRORLN("\"%s\" does not have any frames.", getFileName().c_str()); return; } // Pre-cache all the frames if (!PrecacheAllFrames()) { - BS_LOG_ERRORLN("Could not precache all frames of \"%s\".", GetFileName().c_str()); + BS_LOG_ERRORLN("Could not precache all frames of \"%s\".", getFileName().c_str()); return; } // Post processing to compute animation features if (!ComputeFeatures()) { - BS_LOG_ERRORLN("Could not determine the features of \"%s\".", GetFileName().c_str()); + BS_LOG_ERRORLN("Could not determine the features of \"%s\".", getFileName().c_str()); return; } - m_Valid = true; + _valid = true; } // ----------------------------------------------------------------------------- @@ -135,29 +135,29 @@ bool AnimationResource::parseBooleanKey(Common::String s, bool &result) { // ----------------------------------------------------------------------------- bool AnimationResource::parserCallback_animation(ParserNode *node) { - if (!parseIntegerKey(node->values["fps"].c_str(), 1, &m_FPS) || (m_FPS < MIN_FPS) || (m_FPS > MAX_FPS)) { + if (!parseIntegerKey(node->values["fps"].c_str(), 1, &_FPS) || (_FPS < MIN_FPS) || (_FPS > MAX_FPS)) { return parserError("Illegal or missing fps attribute in tag in \"%s\". Assuming default (\"%d\").", - GetFileName().c_str(), DEFAULT_FPS); + getFileName().c_str(), DEFAULT_FPS); } // Loop type value const char *loopTypeString = node->values["type"].c_str(); if (strcmp(loopTypeString, "oneshot") == 0) { - m_AnimationType = Animation::AT_ONESHOT; + _animationType = Animation::AT_ONESHOT; } else if (strcmp(loopTypeString, "loop") == 0) { - m_AnimationType = Animation::AT_LOOP; + _animationType = Animation::AT_LOOP; } else if (strcmp(loopTypeString, "jojo") == 0) { - m_AnimationType = Animation::AT_JOJO; + _animationType = Animation::AT_JOJO; } else { BS_LOG_WARNINGLN("Illegal type value (\"%s\") in tag in \"%s\". Assuming default (\"loop\").", - loopTypeString, GetFileName().c_str()); - m_AnimationType = Animation::AT_LOOP; + loopTypeString, getFileName().c_str()); + _animationType = Animation::AT_LOOP; } // Calculate the milliseconds required per frame // FIXME: Double check variable naming. Based on the constant, it may be microseconds - m_MillisPerFrame = 1000000 / m_FPS; + _millisPerFrame = 1000000 / _FPS; return true; } @@ -169,13 +169,13 @@ bool AnimationResource::parserCallback_frame(ParserNode *node) { const char *fileString = node->values["file"].c_str(); if (!fileString) { - BS_LOG_ERRORLN(" tag without file attribute occurred in \"%s\".", GetFileName().c_str()); + BS_LOG_ERRORLN(" tag without file attribute occurred in \"%s\".", getFileName().c_str()); return false; } frame.FileName = _pPackage->GetAbsolutePath(fileString); if (frame.FileName.empty()) { BS_LOG_ERRORLN("Could not create absolute path for file specified in tag in \"%s\": \"%s\".", - GetFileName().c_str(), fileString); + getFileName().c_str(), fileString); return false; } @@ -190,23 +190,23 @@ bool AnimationResource::parserCallback_frame(ParserNode *node) { BS_LOG_WARNINGLN("%s attribute occurred without %s attribute in tag in \"%s\". Assuming default (\"0\").", hotspotxString ? "hotspotx" : "hotspoty", !hotspotyString ? "hotspoty" : "hotspotx", - GetFileName().c_str()); + getFileName().c_str()); 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)) 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)) { BS_LOG_WARNINGLN("Illegal flipv value (\"%s\") in tag in \"%s\". Assuming default (\"false\").", - flipVString.c_str(), GetFileName().c_str()); + flipVString.c_str(), getFileName().c_str()); frame.FlipV = false; } } else @@ -216,13 +216,13 @@ bool AnimationResource::parserCallback_frame(ParserNode *node) { if (!flipHString.empty()) { if (!parseBooleanKey(flipVString, frame.FlipV)) { BS_LOG_WARNINGLN("Illegal fliph value (\"%s\") in tag in \"%s\". Assuming default (\"false\").", - flipHString.c_str(), GetFileName().c_str()); + flipHString.c_str(), getFileName().c_str()); frame.FlipH = false; } } else frame.FlipH = false; - m_Frames.push_back(frame); + _frames.push_back(frame); return true; } @@ -234,10 +234,10 @@ AnimationResource::~AnimationResource() { // ----------------------------------------------------------------------------- bool AnimationResource::PrecacheAllFrames() const { - Common::Array::const_iterator Iter = m_Frames.begin(); - for (; Iter != m_Frames.end(); ++Iter) { - if (!Kernel::GetInstance()->GetResourceManager()->PrecacheResource((*Iter).FileName)) { - BS_LOG_ERRORLN("Could not precache \"%s\".", (*Iter).FileName.c_str()); + Common::Array::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()); return false; } } @@ -248,30 +248,30 @@ bool AnimationResource::PrecacheAllFrames() const { // ----------------------------------------------------------------------------- bool AnimationResource::ComputeFeatures() { - BS_ASSERT(m_Frames.size()); + BS_ASSERT(_frames.size()); // Alle Features werden als vorhanden angenommen - m_ScalingAllowed = true; - m_AlphaAllowed = true; - m_ColorModulationAllowed = true; + _scalingAllowed = true; + _alphaAllowed = true; + _colorModulationAllowed = true; // Alle Frame durchgehen und alle Features deaktivieren, die auch nur von einem Frame nicht unterstützt werden. - Common::Array::const_iterator Iter = m_Frames.begin(); - for (; Iter != m_Frames.end(); ++Iter) { + Common::Array::const_iterator Iter = _frames.begin(); + for (; Iter != _frames.end(); ++Iter) { BitmapResource *pBitmap; if (!(pBitmap = static_cast(Kernel::GetInstance()->GetResourceManager()->RequestResource((*Iter).FileName)))) { BS_LOG_ERRORLN("Could not request \"%s\".", (*Iter).FileName.c_str()); return false; } - if (!pBitmap->IsScalingAllowed()) - m_ScalingAllowed = false; - if (!pBitmap->IsAlphaAllowed()) - m_AlphaAllowed = false; - if (!pBitmap->IsColorModulationAllowed()) - m_ColorModulationAllowed = false; + if (!pBitmap->isScalingAllowed()) + _scalingAllowed = false; + if (!pBitmap->isAlphaAllowed()) + _alphaAllowed = false; + if (!pBitmap->isColorModulationAllowed()) + _colorModulationAllowed = false; - pBitmap->Release(); + pBitmap->release(); } return true; diff --git a/engines/sword25/gfx/animationresource.h b/engines/sword25/gfx/animationresource.h index 503f502e79..b2ff82d1bf 100644 --- a/engines/sword25/gfx/animationresource.h +++ b/engines/sword25/gfx/animationresource.h @@ -63,43 +63,43 @@ public: AnimationResource(const Common::String &filename); virtual ~AnimationResource(); - virtual const Frame &GetFrame(uint Index) const { - BS_ASSERT(Index < m_Frames.size()); - return m_Frames[Index]; + virtual const Frame &getFrame(uint index) const { + BS_ASSERT(index < _frames.size()); + return _frames[index]; } - virtual uint GetFrameCount() const { - return m_Frames.size(); + virtual uint getFrameCount() const { + return _frames.size(); } - virtual void Unlock() { - Release(); + virtual void unlock() { + release(); } - Animation::ANIMATION_TYPES GetAnimationType() const { - return m_AnimationType; + Animation::ANIMATION_TYPES getAnimationType() const { + return _animationType; } - int GetFPS() const { - return m_FPS; + int getFPS() const { + return _FPS; } - int GetMillisPerFrame() const { - return m_MillisPerFrame; + int getMillisPerFrame() const { + return _millisPerFrame; } - bool IsScalingAllowed() const { - return m_ScalingAllowed; + bool isScalingAllowed() const { + return _scalingAllowed; } - bool IsAlphaAllowed() const { - return m_AlphaAllowed; + bool isAlphaAllowed() const { + return _alphaAllowed; } - bool IsColorModulationAllowed() const { - return m_ColorModulationAllowed; + bool isColorModulationAllowed() const { + return _colorModulationAllowed; } - bool IsValid() const { - return m_Valid; + bool isValid() const { + return _valid; } private: - bool m_Valid; + bool _valid; - Common::Array m_Frames; + Common::Array _frames; PackageManager * _pPackage; diff --git a/engines/sword25/gfx/animationtemplate.cpp b/engines/sword25/gfx/animationtemplate.cpp index 0c6f28c07e..9770dd8cc0 100644 --- a/engines/sword25/gfx/animationtemplate.cpp +++ b/engines/sword25/gfx/animationtemplate.cpp @@ -56,7 +56,7 @@ namespace Sword25 { uint AnimationTemplate::Create(const Common::String &SourceAnimation) { AnimationTemplate *AnimationTemplatePtr = new AnimationTemplate(SourceAnimation); - if (AnimationTemplatePtr->IsValid()) { + if (AnimationTemplatePtr->isValid()) { return AnimationTemplateRegistry::GetInstance().ResolvePtr(AnimationTemplatePtr); } else { delete AnimationTemplatePtr; @@ -69,7 +69,7 @@ uint AnimationTemplate::Create(const Common::String &SourceAnimation) { uint AnimationTemplate::Create(const AnimationTemplate &Other) { AnimationTemplate *AnimationTemplatePtr = new AnimationTemplate(Other); - if (AnimationTemplatePtr->IsValid()) { + if (AnimationTemplatePtr->isValid()) { return AnimationTemplateRegistry::GetInstance().ResolvePtr(AnimationTemplatePtr); } else { delete AnimationTemplatePtr; @@ -82,7 +82,7 @@ uint AnimationTemplate::Create(const AnimationTemplate &Other) { uint AnimationTemplate::Create(InputPersistenceBlock &Reader, uint Handle) { AnimationTemplate *AnimationTemplatePtr = new AnimationTemplate(Reader, Handle); - if (AnimationTemplatePtr->IsValid()) { + if (AnimationTemplatePtr->isValid()) { return AnimationTemplateRegistry::GetInstance().ResolvePtr(AnimationTemplatePtr); } else { delete AnimationTemplatePtr; @@ -96,13 +96,13 @@ AnimationTemplate::AnimationTemplate(const Common::String &SourceAnimation) { // Objekt registrieren. AnimationTemplateRegistry::GetInstance().RegisterObject(this); - m_Valid = false; + _valid = false; // Die Animations-Resource wird für die gesamte Lebensdauer des Objektes gelockt - m_SourceAnimationPtr = RequestSourceAnimation(SourceAnimation); + _sourceAnimationPtr = RequestSourceAnimation(SourceAnimation); // Erfolg signalisieren - m_Valid = (m_SourceAnimationPtr != 0); + _valid = (_sourceAnimationPtr != 0); } // ----------------------------------------------------------------------------- @@ -111,24 +111,24 @@ AnimationTemplate::AnimationTemplate(const AnimationTemplate &Other) { // Objekt registrieren. AnimationTemplateRegistry::GetInstance().RegisterObject(this); - m_Valid = false; + _valid = false; // Die Animations-Resource wird für die gesamte Lebensdauer des Objektes gelockt. - if (!Other.m_SourceAnimationPtr) return; - m_SourceAnimationPtr = RequestSourceAnimation(Other.m_SourceAnimationPtr->GetFileName()); + if (!Other._sourceAnimationPtr) return; + _sourceAnimationPtr = RequestSourceAnimation(Other._sourceAnimationPtr->getFileName()); // Alle Member kopieren. - m_AnimationType = Other.m_AnimationType; - m_FPS = Other.m_FPS; - m_MillisPerFrame = Other.m_MillisPerFrame; - m_ScalingAllowed = Other.m_ScalingAllowed; - m_AlphaAllowed = Other.m_AlphaAllowed; - m_ColorModulationAllowed = Other.m_ColorModulationAllowed; - m_Frames = Other.m_Frames; - m_SourceAnimationPtr = Other.m_SourceAnimationPtr; - m_Valid = Other.m_Valid; - - m_Valid &= (m_SourceAnimationPtr != 0); + _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); } // ----------------------------------------------------------------------------- @@ -138,7 +138,7 @@ AnimationTemplate::AnimationTemplate(InputPersistenceBlock &Reader, uint Handle) AnimationTemplateRegistry::GetInstance().RegisterObject(this, Handle); // Objekt laden. - m_Valid = Unpersist(Reader); + _valid = unpersist(Reader); } // ----------------------------------------------------------------------------- @@ -157,8 +157,8 @@ AnimationResource *AnimationTemplate::RequestSourceAnimation(const Common::Strin AnimationTemplate::~AnimationTemplate() { // Animations-Resource freigeben - if (m_SourceAnimationPtr) { - m_SourceAnimationPtr->Release(); + if (_sourceAnimationPtr) { + _sourceAnimationPtr->release(); } // Objekt deregistrieren @@ -169,7 +169,7 @@ AnimationTemplate::~AnimationTemplate() { void AnimationTemplate::AddFrame(int Index) { if (ValidateSourceIndex(Index)) { - m_Frames.push_back(m_SourceAnimationPtr->GetFrame(Index)); + _frames.push_back(_sourceAnimationPtr->getFrame(Index)); } } @@ -177,16 +177,16 @@ void AnimationTemplate::AddFrame(int Index) { void AnimationTemplate::SetFrame(int DestIndex, int SrcIndex) { if (ValidateDestIndex(DestIndex) && ValidateSourceIndex(SrcIndex)) { - m_Frames[DestIndex] = m_SourceAnimationPtr->GetFrame(SrcIndex); + _frames[DestIndex] = _sourceAnimationPtr->getFrame(SrcIndex); } } // ----------------------------------------------------------------------------- bool AnimationTemplate::ValidateSourceIndex(uint Index) const { - if (Index > m_SourceAnimationPtr->GetFrameCount()) { + 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, m_SourceAnimationPtr->GetFileName().c_str()); + Index, _sourceAnimationPtr->getFileName().c_str()); return false; } else return true; @@ -195,7 +195,7 @@ bool AnimationTemplate::ValidateSourceIndex(uint Index) const { // ----------------------------------------------------------------------------- bool AnimationTemplate::ValidateDestIndex(uint Index) const { - if (Index > m_Frames.size()) { + if (Index > _frames.size()) { BS_LOG_WARNINGLN("Tried to change a nonexistent frame (\"%d\") in a template animation. Ignoring call.", Index); return false; @@ -206,73 +206,73 @@ bool AnimationTemplate::ValidateDestIndex(uint Index) const { // ----------------------------------------------------------------------------- void AnimationTemplate::SetFPS(int FPS) { - m_FPS = FPS; - m_MillisPerFrame = 1000000 / m_FPS; + _FPS = FPS; + _millisPerFrame = 1000000 / _FPS; } // ----------------------------------------------------------------------------- -bool AnimationTemplate::Persist(OutputPersistenceBlock &Writer) { +bool AnimationTemplate::persist(OutputPersistenceBlock &writer) { bool Result = true; // Parent persistieren. - Result &= AnimationDescription::Persist(Writer); + Result &= AnimationDescription::persist(writer); // Frameanzahl schreiben. - Writer.Write(m_Frames.size()); + writer.write(_frames.size()); // Frames einzeln persistieren. - Common::Array::const_iterator Iter = m_Frames.begin(); - while (Iter != m_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); + Common::Array::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); ++Iter; } // Restliche Member persistieren. - Writer.Write(m_SourceAnimationPtr->GetFileName()); - Writer.Write(m_Valid); + writer.write(_sourceAnimationPtr->getFileName()); + writer.write(_valid); return Result; } // ----------------------------------------------------------------------------- -bool AnimationTemplate::Unpersist(InputPersistenceBlock &Reader) { +bool AnimationTemplate::unpersist(InputPersistenceBlock &reader) { bool Result = true; // Parent wieder herstellen. - Result &= AnimationDescription::Unpersist(Reader); + Result &= AnimationDescription::unpersist(reader); // Frameanzahl lesen. uint FrameCount; - Reader.Read(FrameCount); + reader.read(FrameCount); // Frames einzeln wieder herstellen. 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); - - m_Frames.push_back(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); + + _frames.push_back(frame); } // Die Animations-Resource wird für die gesamte Lebensdauer des Objektes gelockt Common::String SourceAnimation; - Reader.Read(SourceAnimation); - m_SourceAnimationPtr = RequestSourceAnimation(SourceAnimation); + reader.read(SourceAnimation); + _sourceAnimationPtr = RequestSourceAnimation(SourceAnimation); - Reader.Read(m_Valid); + reader.read(_valid); - return m_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 65e0470426..e39fb64880 100644 --- a/engines/sword25/gfx/animationtemplate.h +++ b/engines/sword25/gfx/animationtemplate.h @@ -70,19 +70,19 @@ private: public: ~AnimationTemplate(); - virtual const Frame &GetFrame(uint Index) const { - BS_ASSERT(Index < m_Frames.size()); - return m_Frames[Index]; + virtual const Frame &getFrame(uint Index) const { + BS_ASSERT(Index < _frames.size()); + return _frames[Index]; } - virtual uint GetFrameCount() const { - return m_Frames.size(); + virtual uint getFrameCount() const { + return _frames.size(); } - virtual void Unlock() { + virtual void unlock() { delete this; } - bool IsValid() const { - return m_Valid; + bool isValid() const { + return _valid; } /** @@ -106,7 +106,7 @@ public: @param Type der Typ der Animation. Muss aus den enum BS_Animation::ANIMATION_TYPES sein. */ void SetAnimationType(Animation::ANIMATION_TYPES Type) { - m_AnimationType = Type; + _animationType = Type; } /** @@ -115,13 +115,13 @@ public: */ void SetFPS(int FPS); - virtual bool Persist(OutputPersistenceBlock &Writer); - virtual bool Unpersist(InputPersistenceBlock &Reader); + virtual bool persist(OutputPersistenceBlock &writer); + virtual bool unpersist(InputPersistenceBlock &reader); private: - Common::Array m_Frames; - AnimationResource *m_SourceAnimationPtr; - bool m_Valid; + Common::Array _frames; + AnimationResource *_sourceAnimationPtr; + bool _valid; AnimationResource *RequestSourceAnimation(const Common::String &SourceAnimation) const; bool ValidateSourceIndex(uint Index) const; diff --git a/engines/sword25/gfx/animationtemplateregistry.cpp b/engines/sword25/gfx/animationtemplateregistry.cpp index dc23588f17..6cf9256433 100644 --- a/engines/sword25/gfx/animationtemplateregistry.cpp +++ b/engines/sword25/gfx/animationtemplateregistry.cpp @@ -63,23 +63,23 @@ void AnimationTemplateRegistry::LogWarningLn(const char *Message) const { // ----------------------------------------------------------------------------- -bool AnimationTemplateRegistry::Persist(OutputPersistenceBlock &Writer) { +bool AnimationTemplateRegistry::persist(OutputPersistenceBlock &writer) { bool Result = true; // Das nächste zu vergebene Handle schreiben. - Writer.Write(m_NextHandle); + writer.write(m_NextHandle); // Anzahl an BS_AnimationTemplates schreiben. - Writer.Write(m_Handle2PtrMap.size()); + writer.write(m_Handle2PtrMap.size()); // Alle BS_AnimationTemplates persistieren. HANDLE2PTR_MAP::const_iterator Iter = m_Handle2PtrMap.begin(); while (Iter != m_Handle2PtrMap.end()) { // Handle persistieren. - Writer.Write(Iter->_key); + writer.write(Iter->_key); // Objekt persistieren. - Result &= Iter->_value->Persist(Writer); + Result &= Iter->_value->persist(writer); ++Iter; } @@ -89,11 +89,11 @@ bool AnimationTemplateRegistry::Persist(OutputPersistenceBlock &Writer) { // ----------------------------------------------------------------------------- -bool AnimationTemplateRegistry::Unpersist(InputPersistenceBlock &Reader) { +bool AnimationTemplateRegistry::unpersist(InputPersistenceBlock &reader) { bool Result = true; // Das nächste zu vergebene Handle wieder herstellen. - Reader.Read(m_NextHandle); + reader.read(m_NextHandle); // Alle vorhandenen BS_AnimationTemplates zerstören. while (!m_Handle2PtrMap.empty()) @@ -101,19 +101,19 @@ bool AnimationTemplateRegistry::Unpersist(InputPersistenceBlock &Reader) { // Anzahl an BS_AnimationTemplates einlesen. uint AnimationTemplateCount; - Reader.Read(AnimationTemplateCount); + reader.read(AnimationTemplateCount); // Alle gespeicherten BS_AnimationTemplates wieder herstellen. for (uint i = 0; i < AnimationTemplateCount; ++i) { // Handle lesen. uint Handle; - Reader.Read(Handle); + reader.read(Handle); // BS_AnimationTemplate wieder herstellen. - Result &= (AnimationTemplate::Create(Reader, Handle) != 0); + Result &= (AnimationTemplate::Create(reader, Handle) != 0); } - return Reader.IsGood() && Result; + return reader.isGood() && Result; } } // End of namespace Sword25 diff --git a/engines/sword25/gfx/animationtemplateregistry.h b/engines/sword25/gfx/animationtemplateregistry.h index b4bdeff5ab..e4f7e9d304 100644 --- a/engines/sword25/gfx/animationtemplateregistry.h +++ b/engines/sword25/gfx/animationtemplateregistry.h @@ -64,8 +64,8 @@ public: return *m_InstancePtr.get(); } - virtual bool Persist(OutputPersistenceBlock &Writer); - virtual bool Unpersist(InputPersistenceBlock &Reader); + virtual bool persist(OutputPersistenceBlock &Writer); + virtual bool unpersist(InputPersistenceBlock &Reader); private: virtual void LogErrorLn(const char *Message) const; diff --git a/engines/sword25/gfx/bitmap.cpp b/engines/sword25/gfx/bitmap.cpp index 85e0d28dfa..3a6ffb4a98 100644 --- a/engines/sword25/gfx/bitmap.cpp +++ b/engines/sword25/gfx/bitmap.cpp @@ -52,13 +52,13 @@ namespace Sword25 { // Konstruktion / Destruktion // ----------------------------------------------------------------------------- -Bitmap::Bitmap(RenderObjectPtr ParentPtr, TYPES Type, uint Handle) : - RenderObject(ParentPtr, Type, Handle), - m_ModulationColor(0xffffffff), - m_ScaleFactorX(1.0f), - m_ScaleFactorY(1.0f), - m_FlipH(false), - m_FlipV(false) { +Bitmap::Bitmap(RenderObjectPtr parentPtr, TYPES type, uint handle) : + RenderObject(parentPtr, type, handle), + _modulationColor(0xffffffff), + _scaleFactorX(1.0f), + _scaleFactorY(1.0f), + _flipH(false), + _flipV(false) { } // ----------------------------------------------------------------------------- @@ -70,142 +70,146 @@ Bitmap::~Bitmap() { // Darstellungsart festlegen // ----------------------------------------------------------------------------- -void Bitmap::SetAlpha(int Alpha) { - if (!IsAlphaAllowed()) { +void Bitmap::setAlpha(int alpha) { + if (!isAlphaAllowed()) { BS_LOG_WARNINGLN("Tried to set alpha value on a bitmap that does not support alpha blending. Call was ignored."); return; } - if (Alpha < 0 || Alpha > 255) { - int OldAlpha = Alpha; - if (Alpha < 0) Alpha = 0; - if (Alpha > 255) Alpha = 255; - BS_LOG_WARNINGLN("Tried to set an invalid alpha value (%d) on a bitmap. Value was changed to %d.", OldAlpha, Alpha); + if (alpha < 0 || alpha > 255) { + int oldAlpha = alpha; + if (alpha < 0) + alpha = 0; + if (alpha > 255) + alpha = 255; + BS_LOG_WARNINGLN("Tried to set an invalid alpha value (%d) on a bitmap. Value was changed to %d.", oldAlpha, alpha); return; } - uint NewModulationColor = (m_ModulationColor & 0x00ffffff) | Alpha << 24; - if (NewModulationColor != m_ModulationColor) { - m_ModulationColor = NewModulationColor; - ForceRefresh(); + uint newModulationColor = (_modulationColor & 0x00ffffff) | alpha << 24; + if (newModulationColor != _modulationColor) { + _modulationColor = newModulationColor; + forceRefresh(); } } // ----------------------------------------------------------------------------- -void Bitmap::SetModulationColor(uint ModulationColor) { - if (!IsColorModulationAllowed()) { +void Bitmap::setModulationColor(uint modulationColor) { + if (!isColorModulationAllowed()) { BS_LOG_WARNINGLN("Tried to set modulation color of a bitmap that does not support color modulation. Call was ignored."); return; } - uint NewModulationColor = (ModulationColor & 0x00ffffff) | (m_ModulationColor & 0xff000000); - if (NewModulationColor != m_ModulationColor) { - m_ModulationColor = NewModulationColor; - ForceRefresh(); + uint newModulationColor = (modulationColor & 0x00ffffff) | (_modulationColor & 0xff000000); + if (newModulationColor != _modulationColor) { + _modulationColor = newModulationColor; + forceRefresh(); } } // ----------------------------------------------------------------------------- -void Bitmap::SetScaleFactor(float ScaleFactor) { - SetScaleFactorX(ScaleFactor); - SetScaleFactorY(ScaleFactor); +void Bitmap::setScaleFactor(float scaleFactor) { + setScaleFactorX(scaleFactor); + setScaleFactorY(scaleFactor); } // ----------------------------------------------------------------------------- -void Bitmap::SetScaleFactorX(float ScaleFactorX) { - if (!IsScalingAllowed()) { +void Bitmap::setScaleFactorX(float scaleFactorX) { + if (!isScalingAllowed()) { BS_LOG_WARNINGLN("Tried to set scale factor of a bitmap that does not support scaling. Call was ignored."); return; } - if (ScaleFactorX < 0) { + if (scaleFactorX < 0) { BS_LOG_WARNINGLN("Tried to set scale factor of a bitmap to a negative value. Call was ignored."); return; } - if (ScaleFactorX != m_ScaleFactorX) { - m_ScaleFactorX = ScaleFactorX; - m_Width = static_cast(m_OriginalWidth * m_ScaleFactorX); - if (m_ScaleFactorX <= 0.0f) m_ScaleFactorX = 0.001f; - ForceRefresh(); + if (scaleFactorX != _scaleFactorX) { + _scaleFactorX = scaleFactorX; + _width = static_cast(_originalWidth * _scaleFactorX); + if (_scaleFactorX <= 0.0f) + _scaleFactorX = 0.001f; + forceRefresh(); } } // ----------------------------------------------------------------------------- -void Bitmap::SetScaleFactorY(float ScaleFactorY) { - if (!IsScalingAllowed()) { +void Bitmap::setScaleFactorY(float scaleFactorY) { + if (!isScalingAllowed()) { BS_LOG_WARNINGLN("Tried to set scale factor of a bitmap that does not support scaling. Call was ignored."); return; } - if (ScaleFactorY < 0) { + if (scaleFactorY < 0) { BS_LOG_WARNINGLN("Tried to set scale factor of a bitmap to a negative value. Call was ignored."); return; } - if (ScaleFactorY != m_ScaleFactorY) { - m_ScaleFactorY = ScaleFactorY; - m_Height = static_cast(m_OriginalHeight * ScaleFactorY); - if (m_ScaleFactorY <= 0.0f) m_ScaleFactorY = 0.001f; - ForceRefresh(); + if (scaleFactorY != _scaleFactorY) { + _scaleFactorY = scaleFactorY; + _height = static_cast(_originalHeight * scaleFactorY); + if (_scaleFactorY <= 0.0f) + _scaleFactorY = 0.001f; + forceRefresh(); } } // ----------------------------------------------------------------------------- -void Bitmap::SetFlipH(bool FlipH) { - m_FlipH = FlipH; - ForceRefresh(); +void Bitmap::setFlipH(bool flipH) { + _flipH = flipH; + forceRefresh(); } // ----------------------------------------------------------------------------- -void Bitmap::SetFlipV(bool FlipV) { - m_FlipV = FlipV; - ForceRefresh(); +void Bitmap::setFlipV(bool flipV) { + _flipV = flipV; + forceRefresh(); } // ----------------------------------------------------------------------------- // Persistenz // ----------------------------------------------------------------------------- -bool Bitmap::Persist(OutputPersistenceBlock &Writer) { - bool Result = true; +bool Bitmap::persist(OutputPersistenceBlock &writer) { + bool result = true; - Result &= RenderObject::Persist(Writer); - Writer.Write(m_FlipH); - Writer.Write(m_FlipV); - Writer.Write(m_ScaleFactorX); - Writer.Write(m_ScaleFactorY); - Writer.Write(m_ModulationColor); - Writer.Write(m_OriginalWidth); - Writer.Write(m_OriginalHeight); + result &= RenderObject::persist(writer); + writer.write(_flipH); + writer.write(_flipV); + writer.write(_scaleFactorX); + writer.write(_scaleFactorY); + writer.write(_modulationColor); + writer.write(_originalWidth); + writer.write(_originalHeight); - return Result; + return result; } // ----------------------------------------------------------------------------- -bool Bitmap::Unpersist(InputPersistenceBlock &Reader) { - bool Result = true; +bool Bitmap::unpersist(InputPersistenceBlock &reader) { + bool result = true; - Result &= RenderObject::Unpersist(Reader); - Reader.Read(m_FlipH); - Reader.Read(m_FlipV); - Reader.Read(m_ScaleFactorX); - Reader.Read(m_ScaleFactorY); - Reader.Read(m_ModulationColor); - Reader.Read(m_OriginalWidth); - Reader.Read(m_OriginalHeight); + result &= RenderObject::unpersist(reader); + reader.read(_flipH); + reader.read(_flipV); + reader.read(_scaleFactorX); + reader.read(_scaleFactorY); + reader.read(_modulationColor); + reader.read(_originalWidth); + reader.read(_originalHeight); - ForceRefresh(); + forceRefresh(); - return Reader.IsGood() && Result; + return reader.isGood() && result; } } // End of namespace Sword25 diff --git a/engines/sword25/gfx/bitmap.h b/engines/sword25/gfx/bitmap.h index 1ecbd2061e..a00baf37a4 100644 --- a/engines/sword25/gfx/bitmap.h +++ b/engines/sword25/gfx/bitmap.h @@ -50,7 +50,7 @@ namespace Sword25 { class Bitmap : public RenderObject { protected: - Bitmap(RenderObjectPtr ParentPtr, TYPES Type, uint Handle = 0); + Bitmap(RenderObjectPtr parentPtr, TYPES type, uint handle = 0); public: @@ -61,90 +61,90 @@ public: @param Alpha der neue Alphawert der Bitmaps (0 = keine Deckung, 255 = volle Deckung). @remark Diese Methode darf nur aufgerufen werden, wenn die Methode IsAlphaAllowed() true zurückgibt. */ - void SetAlpha(int Alpha); + void setAlpha(int alpha); /** @brief Setzt die Modulationfarbe der Bitmaps. @param Color eine 24-Bit Farbe, die die Modulationsfarbe des Bitmaps festlegt. @remark Diese Methode darf nur aufgerufen werden, wenn die Methode IsColorModulationAllowed() true zurückgibt. */ - void SetModulationColor(uint ModulationColor); + void setModulationColor(uint modulationColor); /** @brief Setzt den Skalierungsfaktor des Bitmaps. @param ScaleFactor der Faktor um den das Bitmap in beide Richtungen gestreckt werden soll. @remark Diese Methode darf nur aufgerufen werden, wenn die Methode IsScalingAllowed() true zurückgibt. */ - void SetScaleFactor(float ScaleFactor); + void setScaleFactor(float scaleFactor); /** @brief Setzt den Skalierungsfaktor der Bitmap auf der X-Achse. @param ScaleFactor der Faktor um den die Bitmap in Richtungen der X-Achse gestreckt werden soll. Dieser Wert muss positiv sein. @remark Diese Methode darf nur aufgerufen werden, wenn die Methode IsScalingAllowed() true zurückgibt. */ - void SetScaleFactorX(float ScaleFactorX); + void setScaleFactorX(float scaleFactorX); /** @brief Setzt den Skalierungsfaktor der Bitmap auf der Y-Achse. @param ScaleFactor der Faktor um den die Bitmap in Richtungen der Y-Achse gestreckt werden soll. Dieser Wert muss positiv sein. @remark Diese Methode darf nur aufgerufen werden, wenn die Methode IsScalingAllowed() true zurückgibt. */ - void SetScaleFactorY(float ScaleFactorY); + void setScaleFactorY(float scaleFactorY); /** @brief Legt fest, ob das Bild an der X-Achse gespiegelt werden soll. */ - void SetFlipH(bool FlipH); + void setFlipH(bool flipH); /** @brief Legt fest, ob das Bild an der Y-Achse gespiegelt werden soll. */ - void SetFlipV(bool FlipV); + void setFlipV(bool flipV); /** @brief Gibt den aktuellen Alphawert des Bildes zurück. @remark Diese Methode darf nur aufgerufen werden, wenn die Methode IsAlphaAllowed() true zurückgibt. */ - int GetAlpha() { - return m_ModulationColor >> 24; + int getAlpha() { + return _modulationColor >> 24; } /** @brief Gibt die aktuelle 24bit RGB Modulationsfarde des Bildes zurück. @remark Diese Methode darf nur aufgerufen werden, wenn die Methode IsColorModulationAllowed() true zurückgibt. */ - int GetModulationColor() { - return m_ModulationColor & 0x00ffffff; + int getModulationColor() { + return _modulationColor & 0x00ffffff; } /** @brief Gibt den Skalierungsfakter des Bitmaps auf der X-Achse zurück. @remark Diese Methode darf nur aufgerufen werden, wenn die Methode IsScalingAllowed() true zurückgibt. */ - float GetScaleFactorX() const { - return m_ScaleFactorX; + float getScaleFactorX() const { + return _scaleFactorX; } /** @brief Gibt den Skalierungsfakter des Bitmaps auf der Y-Achse zurück. @remark Diese Methode darf nur aufgerufen werden, wenn die Methode IsScalingAllowed() true zurückgibt. */ - float GetScaleFactorY() const { - return m_ScaleFactorY; + float getScaleFactorY() const { + return _scaleFactorY; } /** @brief Gibt zurück, ob das Bild an der X-Achse gespiegelt angezeigt wird. */ - bool IsFlipH() { - return m_FlipH; + bool isFlipH() { + return _flipH; } /** @brief Gibt zurück, ob das Bild an der Y-Achse gespiegelt angezeigt wird. */ - bool IsFlipV() { - return m_FlipV; + bool isFlipV() { + return _flipV; } // ----------------------------------------------------------------------------- @@ -159,7 +159,7 @@ public: @remark Diese Methode sollte auf keine Fall benutzt werden um größere Teile des Bildes zu lesen, da sie sehr langsam ist. Sie ist eher dafür gedacht einzelne Pixel des Bildes auszulesen. */ - virtual uint GetPixel(int X, int Y) const = 0; + virtual uint getPixel(int x, int y) const = 0; /** @brief Füllt den Inhalt des Bildes mit Pixeldaten. @@ -172,24 +172,24 @@ public: @return Gibt false zurück, falls der Aufruf fehlgeschlagen ist. @remark Ein Aufruf dieser Methode ist nur erlaubt, wenn IsSetContentAllowed() true zurückgibt. */ - virtual bool SetContent(const byte *Pixeldata, uint size, uint Offset = 0, uint Stride = 0) = 0; + virtual bool setContent(const byte *pixeldata, uint size, uint offset = 0, uint stride = 0) = 0; - virtual bool IsScalingAllowed() const = 0; - virtual bool IsAlphaAllowed() const = 0; - virtual bool IsColorModulationAllowed() const = 0; - virtual bool IsSetContentAllowed() const = 0; + virtual bool isScalingAllowed() const = 0; + virtual bool isAlphaAllowed() const = 0; + virtual bool isColorModulationAllowed() const = 0; + virtual bool isSetContentAllowed() const = 0; - virtual bool Persist(OutputPersistenceBlock &Writer); - virtual bool Unpersist(InputPersistenceBlock &Reader); + virtual bool persist(OutputPersistenceBlock &writer); + virtual bool unpersist(InputPersistenceBlock &reader); protected: - bool m_FlipH; - bool m_FlipV; - float m_ScaleFactorX; - float m_ScaleFactorY; - uint m_ModulationColor; - int m_OriginalWidth; - int m_OriginalHeight; + bool _flipH; + bool _flipV; + float _scaleFactorX; + float _scaleFactorY; + uint _modulationColor; + int _originalWidth; + int _originalHeight; }; } // End of namespace Sword25 diff --git a/engines/sword25/gfx/bitmapresource.cpp b/engines/sword25/gfx/bitmapresource.cpp index 0cbf111af0..46e6ca77ce 100644 --- a/engines/sword25/gfx/bitmapresource.cpp +++ b/engines/sword25/gfx/bitmapresource.cpp @@ -45,24 +45,24 @@ namespace Sword25 { // Konstruktion / Destruktion // -------------------------- -BitmapResource::BitmapResource(const Common::String &Filename, Image *pImage) : - m_Valid(false), - m_pImage(pImage), - Resource(Filename, Resource::TYPE_BITMAP) { - m_Valid = m_pImage != 0; +BitmapResource::BitmapResource(const Common::String &filename, Image *pImage) : + _valid(false), + _pImage(pImage), + Resource(filename, Resource::TYPE_BITMAP) { + _valid = _pImage != 0; } BitmapResource::~BitmapResource() { - delete m_pImage; + delete _pImage; } // ----------------------------------------------------------------------------- -uint BitmapResource::GetPixel(int X, int Y) const { - BS_ASSERT(X >= 0 && X < m_pImage->GetWidth()); - BS_ASSERT(Y >= 0 && Y < m_pImage->GetHeight()); +uint BitmapResource::getPixel(int x, int y) const { + BS_ASSERT(x >= 0 && x < _pImage->getWidth()); + BS_ASSERT(y >= 0 && y < _pImage->getHeight()); - return m_pImage->GetPixel(X, Y); + return _pImage->getPixel(x, y); } } // End of namespace Sword25 diff --git a/engines/sword25/gfx/bitmapresource.h b/engines/sword25/gfx/bitmapresource.h index e40878da8e..1054770e79 100644 --- a/engines/sword25/gfx/bitmapresource.h +++ b/engines/sword25/gfx/bitmapresource.h @@ -60,30 +60,30 @@ public: FLIP_VH = FLIP_H | FLIP_V }; - BitmapResource(const Common::String &Filename, Image *pImage); + BitmapResource(const Common::String &filename, Image *pImage); virtual ~BitmapResource(); /** @brief Gibt zurück, ob das Objekt einen gültigen Zustand hat. */ - bool IsValid() const { - return m_Valid; + bool isValid() const { + return _valid; } /** @brief Gibt die Breite des Bitmaps zurück. */ - int GetWidth() const { - BS_ASSERT(m_pImage); - return m_pImage->GetWidth(); + int getWidth() const { + BS_ASSERT(_pImage); + return _pImage->getWidth(); } /** @brief Gibt die Höhe des Bitmaps zurück. */ - int GetHeight() const { - BS_ASSERT(m_pImage); - return m_pImage->GetHeight(); + int getHeight() const { + BS_ASSERT(_pImage); + return _pImage->getHeight(); } /** @@ -122,13 +122,13 @@ public: - IsAlphaAllowed() - IsColorModulationAllowed() */ - bool Blit(int PosX = 0, int PosY = 0, - int Flipping = FLIP_NONE, + bool blit(int posX = 0, int posY = 0, + int flipping = FLIP_NONE, Common::Rect *pSrcPartRect = NULL, - uint Color = BS_ARGB(255, 255, 255, 255), - int Width = -1, int Height = -1) { - BS_ASSERT(m_pImage); - return m_pImage->Blit(PosX, PosY, Flipping, pSrcPartRect, Color, Width, Height); + uint color = BS_ARGB(255, 255, 255, 255), + int width = -1, int height = -1) { + BS_ASSERT(_pImage); + return _pImage->blit(posX, posY, flipping, pSrcPartRect, color, width, height); } /** @@ -144,9 +144,9 @@ public: BS_RGB und BS_ARGB benutzt werden. @remark Falls das Rechteck nicht völlig innerhalb des Bildschirms ist, wird es automatisch zurechtgestutzt. */ - bool Fill(const Common::Rect *pFillRect = 0, uint Color = BS_RGB(0, 0, 0)) { - BS_ASSERT(m_pImage); - return m_pImage->Fill(pFillRect, Color); + bool fill(const Common::Rect *pFillRect = 0, uint color = BS_RGB(0, 0, 0)) { + BS_ASSERT(_pImage); + return _pImage->fill(pFillRect, color); } /** @@ -157,7 +157,7 @@ public: @remark Diese Methode sollte auf keine Fall benutzt werden um größere Teile des Bildes zu lesen, da sie sehr langsam ist. Sie ist eher dafür gedacht einzelne Pixel des Bildes auszulesen. */ - uint GetPixel(int X, int Y) const; + uint getPixel(int x, int y) const; //@{ /** @name Auskunfts-Methoden */ @@ -166,46 +166,46 @@ public: @brief Überprüft, ob das BS_Image ein Zielbild für einen Blit-Aufruf sein kann. @return Gibt false zurück, falls ein Blit-Aufruf mit diesem Objekt als Ziel nicht gestattet ist. */ - bool IsBlitTarget() { - BS_ASSERT(m_pImage); - return m_pImage->IsBlitTarget(); + bool isBlitTarget() { + BS_ASSERT(_pImage); + return _pImage->isBlitTarget(); } /** @brief Gibt true zurück, falls das BS_Image bei einem Aufruf von Blit() skaliert dargestellt werden kann. */ - bool IsScalingAllowed() { - BS_ASSERT(m_pImage); - return m_pImage->IsScalingAllowed(); + bool isScalingAllowed() { + BS_ASSERT(_pImage); + return _pImage->isScalingAllowed(); } /** @brief Gibt true zurück, wenn das BS_Image mit einem Aufruf von Fill() gefüllt werden kann. */ - bool IsFillingAllowed() { - BS_ASSERT(m_pImage); - return m_pImage->IsFillingAllowed(); + bool isFillingAllowed() { + BS_ASSERT(_pImage); + return _pImage->isFillingAllowed(); } /** @brief Gibt true zurück, wenn das BS_Image bei einem Aufruf von Blit() mit einem Alphawert dargestellt werden kann. */ - bool IsAlphaAllowed() { - BS_ASSERT(m_pImage); - return m_pImage->IsAlphaAllowed(); + bool isAlphaAllowed() { + BS_ASSERT(_pImage); + return _pImage->isAlphaAllowed(); } /** @brief Gibt true zurück, wenn das BS_Image bei einem Aufruf von Blit() mit Farbmodulation dargestellt werden kann. */ - bool IsColorModulationAllowed() { - BS_ASSERT(m_pImage); - return m_pImage->IsColorModulationAllowed(); + bool isColorModulationAllowed() { + BS_ASSERT(_pImage); + return _pImage->isColorModulationAllowed(); } private: - Image *m_pImage; - bool m_Valid; + Image *_pImage; + bool _valid; }; } // End of namespace Sword25 diff --git a/engines/sword25/gfx/dynamicbitmap.cpp b/engines/sword25/gfx/dynamicbitmap.cpp index 4bff452d25..0446e6fee7 100644 --- a/engines/sword25/gfx/dynamicbitmap.cpp +++ b/engines/sword25/gfx/dynamicbitmap.cpp @@ -53,32 +53,32 @@ namespace Sword25 { // Konstruktion / Destruktion // ----------------------------------------------------------------------------- -DynamicBitmap::DynamicBitmap(RenderObjectPtr ParentPtr, uint Width, uint Height) : - Bitmap(ParentPtr, TYPE_DYNAMICBITMAP) { +DynamicBitmap::DynamicBitmap(RenderObjectPtr parentPtr, uint width, uint height) : + Bitmap(parentPtr, TYPE_DYNAMICBITMAP) { // Das BS_Bitmap konnte nicht erzeugt werden, daher muss an dieser Stelle abgebrochen werden. - if (!m_InitSuccess) return; + if (!_initSuccess) return; - m_InitSuccess = CreateGLImage(Width, Height); + _initSuccess = createGLImage(width, height); } // ----------------------------------------------------------------------------- -DynamicBitmap::DynamicBitmap(InputPersistenceBlock &Reader, RenderObjectPtr ParentPtr, uint Handle) : - Bitmap(ParentPtr, TYPE_DYNAMICBITMAP, Handle) { - m_InitSuccess = Unpersist(Reader); +DynamicBitmap::DynamicBitmap(InputPersistenceBlock &reader, RenderObjectPtr parentPtr, uint handle) : + Bitmap(parentPtr, TYPE_DYNAMICBITMAP, handle) { + _initSuccess = unpersist(reader); } // ----------------------------------------------------------------------------- -bool DynamicBitmap::CreateGLImage(uint Width, uint Height) { +bool DynamicBitmap::createGLImage(uint width, uint height) { // GLImage mit den gewünschten Maßen erstellen - bool Result = false; - m_Image.reset(new GLImage(Width, Height, Result)); + bool result = false; + _image.reset(new GLImage(width, height, result)); - m_OriginalWidth = m_Width = Width; - m_OriginalHeight = m_Height = Height; + _originalWidth = _width = width; + _originalHeight = _height = height; - return Result; + return result; } // ----------------------------------------------------------------------------- @@ -88,66 +88,66 @@ DynamicBitmap::~DynamicBitmap() { // ----------------------------------------------------------------------------- -uint DynamicBitmap::GetPixel(int X, int Y) const { - BS_ASSERT(X >= 0 && X < m_Width); - BS_ASSERT(Y >= 0 && Y < m_Height); +uint DynamicBitmap::getPixel(int x, int y) const { + BS_ASSERT(x >= 0 && x < _width); + BS_ASSERT(y >= 0 && y < _height); - return m_Image->GetPixel(X, Y); + return _image->getPixel(x, y); } // ----------------------------------------------------------------------------- -bool DynamicBitmap::DoRender() { +bool DynamicBitmap::doRender() { // Framebufferobjekt holen GraphicEngine *pGfx = static_cast(Kernel::GetInstance()->GetService("gfx")); BS_ASSERT(pGfx); // Bitmap zeichnen - bool Result; - if (m_ScaleFactorX == 1.0f && m_ScaleFactorY == 1.0f) { - Result = m_Image->Blit(m_AbsoluteX, m_AbsoluteY, - (m_FlipV ? BitmapResource::FLIP_V : 0) | - (m_FlipH ? BitmapResource::FLIP_H : 0), - 0, m_ModulationColor, -1, -1); + bool result; + if (_scaleFactorX == 1.0f && _scaleFactorY == 1.0f) { + result = _image->blit(_absoluteX, _absoluteY, + (_flipV ? BitmapResource::FLIP_V : 0) | + (_flipH ? BitmapResource::FLIP_H : 0), + 0, _modulationColor, -1, -1); } else { - Result = m_Image->Blit(m_AbsoluteX, m_AbsoluteY, - (m_FlipV ? BitmapResource::FLIP_V : 0) | - (m_FlipH ? BitmapResource::FLIP_H : 0), - 0, m_ModulationColor, m_Width, m_Height); + result = _image->blit(_absoluteX, _absoluteY, + (_flipV ? BitmapResource::FLIP_V : 0) | + (_flipH ? BitmapResource::FLIP_H : 0), + 0, _modulationColor, _width, _height); } - return Result; + return result; } // ----------------------------------------------------------------------------- -bool DynamicBitmap::SetContent(const byte *Pixeldata, uint size, uint Offset, uint Stride) { - return m_Image->SetContent(Pixeldata, size, Offset, Stride); +bool DynamicBitmap::setContent(const byte *pixeldata, uint size, uint offset, uint stride) { + return _image->setContent(pixeldata, size, offset, stride); } // ----------------------------------------------------------------------------- // Auskunftsmethoden // ----------------------------------------------------------------------------- -bool DynamicBitmap::IsScalingAllowed() const { - return m_Image->IsScalingAllowed(); +bool DynamicBitmap::isScalingAllowed() const { + return _image->isScalingAllowed(); } // ----------------------------------------------------------------------------- -bool DynamicBitmap::IsAlphaAllowed() const { - return m_Image->IsAlphaAllowed(); +bool DynamicBitmap::isAlphaAllowed() const { + return _image->isAlphaAllowed(); } // ----------------------------------------------------------------------------- -bool DynamicBitmap::IsColorModulationAllowed() const { - return m_Image->IsColorModulationAllowed(); +bool DynamicBitmap::isColorModulationAllowed() const { + return _image->isColorModulationAllowed(); } // ----------------------------------------------------------------------------- -bool DynamicBitmap::IsSetContentAllowed() const { +bool DynamicBitmap::isSetContentAllowed() const { return true; } @@ -155,39 +155,39 @@ bool DynamicBitmap::IsSetContentAllowed() const { // Persistenz // ----------------------------------------------------------------------------- -bool DynamicBitmap::Persist(OutputPersistenceBlock &Writer) { - bool Result = true; +bool DynamicBitmap::persist(OutputPersistenceBlock &writer) { + bool result = true; - Result &= Bitmap::Persist(Writer); + result &= Bitmap::persist(writer); // Bilddaten werden nicht gespeichert. Dies ist auch nicht weiter von bedeutung, da BS_DynamicBitmap nur vom Videoplayer benutzt wird. // Während ein Video abläuft kann niemals gespeichert werden. BS_DynamicBitmap kann nur der Vollständigkeit halber persistiert werden. BS_LOG_WARNINGLN("Persisting a BS_DynamicBitmap. Bitmap content is not persisted."); - Result &= RenderObject::PersistChildren(Writer); + result &= RenderObject::persistChildren(writer); - return Result; + return result; } -bool DynamicBitmap::Unpersist(InputPersistenceBlock &Reader) { - bool Result = true; +bool DynamicBitmap::unpersist(InputPersistenceBlock &reader) { + bool result = true; - Result &= Bitmap::Unpersist(Reader); + result &= Bitmap::unpersist(reader); // Ein BS_GLImage mit den gespeicherten Maßen erstellen. - Result &= CreateGLImage(m_Width, m_Height); + result &= createGLImage(_width, _height); // Bilddaten werden nicht gespeichert (s.o.). BS_LOG_WARNINGLN("Unpersisting a BS_DynamicBitmap. Bitmap contents are missing."); // Bild mit durchsichtigen Bilddaten initialisieren. - byte *TransparentImageData = (byte *)calloc(m_Width * m_Height * 4, 1); - m_Image->SetContent(TransparentImageData, m_Width * m_Height); - free(TransparentImageData); + byte *transparentImageData = (byte *)calloc(_width * _height * 4, 1); + _image->setContent(transparentImageData, _width * _height); + free(transparentImageData); - Result &= RenderObject::UnpersistChildren(Reader); + result &= RenderObject::unpersistChildren(reader); - return Reader.IsGood() && Result; + return reader.isGood() && result; } } // End of namespace Sword25 diff --git a/engines/sword25/gfx/dynamicbitmap.h b/engines/sword25/gfx/dynamicbitmap.h index 69877d66c5..fbdf344338 100644 --- a/engines/sword25/gfx/dynamicbitmap.h +++ b/engines/sword25/gfx/dynamicbitmap.h @@ -58,28 +58,28 @@ class DynamicBitmap : public Bitmap { public: virtual ~DynamicBitmap(); - virtual uint GetPixel(int X, int Y) const; + virtual uint getPixel(int x, int y) const; - virtual bool SetContent(const byte *Pixeldata, uint size, uint Offset, uint Stride); + virtual bool setContent(const byte *pixeldata, uint size, uint offset, uint stride); - virtual bool IsScalingAllowed() const; - virtual bool IsAlphaAllowed() const; - virtual bool IsColorModulationAllowed() const; - virtual bool IsSetContentAllowed() const; + virtual bool isScalingAllowed() const; + virtual bool isAlphaAllowed() const; + virtual bool isColorModulationAllowed() const; + virtual bool isSetContentAllowed() const; - virtual bool Persist(OutputPersistenceBlock &Writer); - virtual bool Unpersist(InputPersistenceBlock &Reader); + virtual bool persist(OutputPersistenceBlock &writer); + virtual bool unpersist(InputPersistenceBlock &reader); protected: - virtual bool DoRender(); + virtual bool doRender(); private: - DynamicBitmap(RenderObjectPtr ParentPtr, uint Width, uint Height); - DynamicBitmap(InputPersistenceBlock &Reader, RenderObjectPtr ParentPtr, uint Handle); + DynamicBitmap(RenderObjectPtr parentPtr, uint width, uint height); + DynamicBitmap(InputPersistenceBlock &reader, RenderObjectPtr parentPtr, uint handle); - bool CreateGLImage(uint Width, uint Height); + bool createGLImage(uint width, uint height); - Common::ScopedPtr m_Image; + Common::ScopedPtr _image; }; } // End of namespace Sword25 diff --git a/engines/sword25/gfx/fontresource.cpp b/engines/sword25/gfx/fontresource.cpp index ce9930d4df..d48f849743 100644 --- a/engines/sword25/gfx/fontresource.cpp +++ b/engines/sword25/gfx/fontresource.cpp @@ -70,9 +70,9 @@ FontResource::FontResource(Kernel *pKernel, const Common::String &FileName) : // Load the contents of the file uint fileSize; - char *xmlData = pPackage->GetXmlFile(GetFileName(), &fileSize); + char *xmlData = pPackage->GetXmlFile(getFileName(), &fileSize); if (!xmlData) { - BS_LOG_ERRORLN("Could not read \"%s\".", GetFileName().c_str()); + BS_LOG_ERRORLN("Could not read \"%s\".", getFileName().c_str()); return; } @@ -93,13 +93,13 @@ bool FontResource::parserCallback_font(ParserNode *node) { if (!parseIntegerKey(node->values["lineheight"].c_str(), 1, &_LineHeight)) { BS_LOG_WARNINGLN("Illegal or missing lineheight attribute in tag in \"%s\". Assuming default (\"%d\").", - GetFileName().c_str(), DEFAULT_LINEHEIGHT); + getFileName().c_str(), DEFAULT_LINEHEIGHT); _LineHeight = DEFAULT_LINEHEIGHT; } if (!parseIntegerKey(node->values["gap"].c_str(), 1, &_GapWidth)) { BS_LOG_WARNINGLN("Illegal or missing gap attribute in tag in \"%s\". Assuming default (\"%d\").", - GetFileName().c_str(), DEFAULT_GAPWIDTH); + getFileName().c_str(), DEFAULT_GAPWIDTH); _GapWidth = DEFAULT_GAPWIDTH; } @@ -112,7 +112,7 @@ bool FontResource::parserCallback_font(ParserNode *node) { _BitmapFileName = pPackage->GetAbsolutePath(bitmapFilename); if (_BitmapFileName == "") { BS_LOG_ERRORLN("Image file \"%s\" was specified in tag of \"%s\" but could not be found.", - _BitmapFileName.c_str(), GetFileName().c_str()); + _BitmapFileName.c_str(), getFileName().c_str()); } // Pre-cache the resource @@ -130,20 +130,20 @@ bool FontResource::parserCallback_character(ParserNode *node) { int charCode, top, left, right, bottom; if (!parseIntegerKey(node->values["code"].c_str(), 1, &charCode) || (charCode < 0) || (charCode >= 256)) { - return parserError("Illegal or missing code attribute in tag in \"%s\".", GetFileName().c_str()); + return parserError("Illegal or missing code attribute in tag in \"%s\".", getFileName().c_str()); } if (!parseIntegerKey(node->values["top"].c_str(), 1, &top) || (top < 0)) { - return parserError("Illegal or missing top attribute in tag in \"%s\".", GetFileName().c_str()); + return parserError("Illegal or missing top attribute in tag in \"%s\".", getFileName().c_str()); } if (!parseIntegerKey(node->values["left"].c_str(), 1, &left) || (left < 0)) { - return parserError("Illegal or missing left attribute in tag in \"%s\".", GetFileName().c_str()); + return parserError("Illegal or missing left attribute in tag in \"%s\".", getFileName().c_str()); } if (!parseIntegerKey(node->values["right"].c_str(), 1, &right) || (right < 0)) { - return parserError("Illegal or missing right attribute in tag in \"%s\".", GetFileName().c_str()); + return parserError("Illegal or missing right attribute in tag in \"%s\".", getFileName().c_str()); } if (!parseIntegerKey(node->values["bottom"].c_str(), 1, &bottom) || (bottom < 0)) { - return parserError("Illegal or missing bottom attribute in tag in \"%s\".", GetFileName().c_str()); + return parserError("Illegal or missing bottom attribute in tag in \"%s\".", getFileName().c_str()); } this->_CharacterRects[charCode] = Common::Rect(left, top, right, bottom); diff --git a/engines/sword25/gfx/graphicengine.cpp b/engines/sword25/gfx/graphicengine.cpp index edbf34ed35..f36993784d 100644 --- a/engines/sword25/gfx/graphicengine.cpp +++ b/engines/sword25/gfx/graphicengine.cpp @@ -196,16 +196,16 @@ uint GraphicEngine::LuaColorToARGBColor(lua_State *L, int StackIndex) { // ----------------------------------------------------------------------------- -bool GraphicEngine::Persist(OutputPersistenceBlock &Writer) { - Writer.Write(m_TimerActive); +bool GraphicEngine::persist(OutputPersistenceBlock &writer) { + writer.write(m_TimerActive); return true; } // ----------------------------------------------------------------------------- -bool GraphicEngine::Unpersist(InputPersistenceBlock &Reader) { - Reader.Read(m_TimerActive); - return Reader.IsGood(); +bool GraphicEngine::unpersist(InputPersistenceBlock &reader) { + reader.read(m_TimerActive); + return reader.isGood(); } } // End of namespace Sword25 diff --git a/engines/sword25/gfx/graphicengine.h b/engines/sword25/gfx/graphicengine.h index 6a693ed913..07e15b83e3 100644 --- a/engines/sword25/gfx/graphicengine.h +++ b/engines/sword25/gfx/graphicengine.h @@ -291,7 +291,7 @@ public: * @param Color The 32-bit colour with which the area is to be filled. The default is BS_RGB(0, 0, 0) (black) @remark Falls das Rechteck nicht völlig innerhalb des Bildschirms ist, wird es automatisch zurechtgestutzt. */ - virtual bool Fill(const Common::Rect *FillRectPtr = 0, uint Color = BS_RGB(0, 0, 0)) = 0; + virtual bool fill(const Common::Rect *FillRectPtr = 0, uint Color = BS_RGB(0, 0, 0)) = 0; // Debugging Methods @@ -359,8 +359,8 @@ public: // Persistence Methods // ------------------- - virtual bool Persist(OutputPersistenceBlock &Writer); - virtual bool Unpersist(InputPersistenceBlock &Reader); + virtual bool persist(OutputPersistenceBlock &Writer); + virtual bool unpersist(InputPersistenceBlock &Reader); static void ARGBColorToLuaColor(lua_State *L, uint Color); static uint LuaColorToARGBColor(lua_State *L, int StackIndex); diff --git a/engines/sword25/gfx/graphicengine_script.cpp b/engines/sword25/gfx/graphicengine_script.cpp index 810a8ed549..9d3a0665f2 100644 --- a/engines/sword25/gfx/graphicengine_script.cpp +++ b/engines/sword25/gfx/graphicengine_script.cpp @@ -144,7 +144,7 @@ static AnimationTemplate *CheckAnimationTemplate(lua_State *L, int idx = 1) { // Der erste Parameter muss vom Typ userdata sein und die Metatable der Klasse Gfx.AnimationTemplate uint AnimationTemplateHandle; if ((AnimationTemplateHandle = *reinterpret_cast(my_checkudata(L, idx, ANIMATION_TEMPLATE_CLASS_NAME))) != 0) { - AnimationTemplate *AnimationTemplatePtr = AnimationTemplateRegistry::GetInstance().ResolveHandle(AnimationTemplateHandle); + AnimationTemplate *AnimationTemplatePtr = AnimationTemplateRegistry::GetInstance().resolveHandle(AnimationTemplateHandle); if (!AnimationTemplatePtr) luaL_error(L, "The animation template with the handle %d does no longer exist.", AnimationTemplateHandle); return AnimationTemplatePtr; @@ -159,8 +159,8 @@ static AnimationTemplate *CheckAnimationTemplate(lua_State *L, int idx = 1) { static int NewAnimationTemplate(lua_State *L) { uint AnimationTemplateHandle = AnimationTemplate::Create(luaL_checkstring(L, 1)); - AnimationTemplate *AnimationTemplatePtr = AnimationTemplateRegistry::GetInstance().ResolveHandle(AnimationTemplateHandle); - if (AnimationTemplatePtr && AnimationTemplatePtr->IsValid()) { + AnimationTemplate *AnimationTemplatePtr = AnimationTemplateRegistry::GetInstance().resolveHandle(AnimationTemplateHandle); + if (AnimationTemplatePtr && AnimationTemplatePtr->isValid()) { NewUintUserData(L, AnimationTemplateHandle); //luaL_getmetatable(L, ANIMATION_TEMPLATE_CLASS_NAME); LuaBindhelper::GetMetatable(L, ANIMATION_TEMPLATE_CLASS_NAME); @@ -292,13 +292,13 @@ static int Init(lua_State *L) { // Main-Panel zum Gfx-Modul hinzufügen RenderObjectPtr MainPanelPtr(GetGE()->GetMainPanel()); - BS_ASSERT(MainPanelPtr.IsValid()); + BS_ASSERT(MainPanelPtr.isValid()); lua_pushstring(L, GFX_LIBRARY_NAME); lua_gettable(L, LUA_GLOBALSINDEX); BS_ASSERT(!lua_isnil(L, -1)); - NewUintUserData(L, MainPanelPtr->GetHandle()); + NewUintUserData(L, MainPanelPtr->getHandle()); BS_ASSERT(!lua_isnil(L, -1)); // luaL_getmetatable(L, PANEL_CLASS_NAME); LuaBindhelper::GetMetatable(L, PANEL_CLASS_NAME); @@ -520,7 +520,7 @@ static RenderObjectPtr CheckRenderObject(lua_State *L, bool ErrorI (UserDataPtr = (uint *) my_checkudata(L, 1, PANEL_CLASS_NAME)) != 0 || (UserDataPtr = (uint *) my_checkudata(L, 1, TEXT_CLASS_NAME)) != 0) { RenderObjectPtr ROPtr(* UserDataPtr); - if (ROPtr.IsValid()) + if (ROPtr.isValid()) return ROPtr; else { if (ErrorIfRemoved) @@ -537,10 +537,10 @@ static RenderObjectPtr CheckRenderObject(lua_State *L, bool ErrorI static int RO_SetPos(lua_State *L) { RenderObjectPtr ROPtr = CheckRenderObject(L); - BS_ASSERT(ROPtr.IsValid()); + BS_ASSERT(ROPtr.isValid()); Vertex Pos; Vertex::LuaVertexToVertex(L, 2, Pos); - ROPtr->SetPos(Pos.X, Pos.Y); + ROPtr->setPos(Pos.X, Pos.Y); return 0; } @@ -548,8 +548,8 @@ static int RO_SetPos(lua_State *L) { static int RO_SetX(lua_State *L) { RenderObjectPtr ROPtr = CheckRenderObject(L); - BS_ASSERT(ROPtr.IsValid()); - ROPtr->SetX(static_cast(luaL_checknumber(L, 2))); + BS_ASSERT(ROPtr.isValid()); + ROPtr->setX(static_cast(luaL_checknumber(L, 2))); return 0; } @@ -557,8 +557,8 @@ static int RO_SetX(lua_State *L) { static int RO_SetY(lua_State *L) { RenderObjectPtr ROPtr = CheckRenderObject(L); - BS_ASSERT(ROPtr.IsValid()); - ROPtr->SetY(static_cast(luaL_checknumber(L, 2))); + BS_ASSERT(ROPtr.isValid()); + ROPtr->setY(static_cast(luaL_checknumber(L, 2))); return 0; } @@ -566,8 +566,8 @@ static int RO_SetY(lua_State *L) { static int RO_SetZ(lua_State *L) { RenderObjectPtr ROPtr = CheckRenderObject(L); - BS_ASSERT(ROPtr.IsValid()); - ROPtr->SetZ(static_cast(luaL_checknumber(L, 2))); + BS_ASSERT(ROPtr.isValid()); + ROPtr->setZ(static_cast(luaL_checknumber(L, 2))); return 0; } @@ -575,8 +575,8 @@ static int RO_SetZ(lua_State *L) { static int RO_SetVisible(lua_State *L) { RenderObjectPtr ROPtr = CheckRenderObject(L); - BS_ASSERT(ROPtr.IsValid()); - ROPtr->SetVisible(lua_tobooleancpp(L, 2)); + BS_ASSERT(ROPtr.isValid()); + ROPtr->setVisible(lua_tobooleancpp(L, 2)); return 0; } @@ -584,8 +584,8 @@ static int RO_SetVisible(lua_State *L) { static int RO_GetX(lua_State *L) { RenderObjectPtr ROPtr = CheckRenderObject(L); - BS_ASSERT(ROPtr.IsValid()); - lua_pushnumber(L, ROPtr->GetX()); + BS_ASSERT(ROPtr.isValid()); + lua_pushnumber(L, ROPtr->getX()); return 1; } @@ -594,8 +594,8 @@ static int RO_GetX(lua_State *L) { static int RO_GetY(lua_State *L) { RenderObjectPtr ROPtr = CheckRenderObject(L); - BS_ASSERT(ROPtr.IsValid()); - lua_pushnumber(L, ROPtr->GetY()); + BS_ASSERT(ROPtr.isValid()); + lua_pushnumber(L, ROPtr->getY()); return 1; } @@ -604,8 +604,8 @@ static int RO_GetY(lua_State *L) { static int RO_GetZ(lua_State *L) { RenderObjectPtr ROPtr = CheckRenderObject(L); - BS_ASSERT(ROPtr.IsValid()); - lua_pushnumber(L, ROPtr->GetZ()); + BS_ASSERT(ROPtr.isValid()); + lua_pushnumber(L, ROPtr->getZ()); return 1; } @@ -614,8 +614,8 @@ static int RO_GetZ(lua_State *L) { static int RO_GetAbsoluteX(lua_State *L) { RenderObjectPtr ROPtr = CheckRenderObject(L); - BS_ASSERT(ROPtr.IsValid()); - lua_pushnumber(L, ROPtr->GetAbsoluteX()); + BS_ASSERT(ROPtr.isValid()); + lua_pushnumber(L, ROPtr->getAbsoluteX()); return 1; } @@ -624,8 +624,8 @@ static int RO_GetAbsoluteX(lua_State *L) { static int RO_GetAbsoluteY(lua_State *L) { RenderObjectPtr ROPtr = CheckRenderObject(L); - BS_ASSERT(ROPtr.IsValid()); - lua_pushnumber(L, ROPtr->GetAbsoluteY()); + BS_ASSERT(ROPtr.isValid()); + lua_pushnumber(L, ROPtr->getAbsoluteY()); return 1; } @@ -634,8 +634,8 @@ static int RO_GetAbsoluteY(lua_State *L) { static int RO_GetWidth(lua_State *L) { RenderObjectPtr ROPtr = CheckRenderObject(L); - BS_ASSERT(ROPtr.IsValid()); - lua_pushnumber(L, ROPtr->GetWidth()); + BS_ASSERT(ROPtr.isValid()); + lua_pushnumber(L, ROPtr->getWidth()); return 1; } @@ -644,8 +644,8 @@ static int RO_GetWidth(lua_State *L) { static int RO_GetHeight(lua_State *L) { RenderObjectPtr ROPtr = CheckRenderObject(L); - BS_ASSERT(ROPtr.IsValid()); - lua_pushnumber(L, ROPtr->GetHeight()); + BS_ASSERT(ROPtr.isValid()); + lua_pushnumber(L, ROPtr->getHeight()); return 1; } @@ -654,8 +654,8 @@ static int RO_GetHeight(lua_State *L) { static int RO_IsVisible(lua_State *L) { RenderObjectPtr ROPtr = CheckRenderObject(L); - BS_ASSERT(ROPtr.IsValid()); - lua_pushbooleancpp(L, ROPtr->IsVisible()); + BS_ASSERT(ROPtr.isValid()); + lua_pushbooleancpp(L, ROPtr->isVisible()); return 1; } @@ -664,12 +664,12 @@ static int RO_IsVisible(lua_State *L) { static int RO_AddPanel(lua_State *L) { RenderObjectPtr ROPtr = CheckRenderObject(L); - BS_ASSERT(ROPtr.IsValid()); - RenderObjectPtr PanelPtr = ROPtr->AddPanel(static_cast(luaL_checknumber(L, 2)), + BS_ASSERT(ROPtr.isValid()); + RenderObjectPtr PanelPtr = ROPtr->addPanel(static_cast(luaL_checknumber(L, 2)), static_cast(luaL_checknumber(L, 3)), GraphicEngine::LuaColorToARGBColor(L, 4)); - if (PanelPtr.IsValid()) { - NewUintUserData(L, PanelPtr->GetHandle()); + if (PanelPtr.isValid()) { + NewUintUserData(L, PanelPtr->getHandle()); // luaL_getmetatable(L, PANEL_CLASS_NAME); LuaBindhelper::GetMetatable(L, PANEL_CLASS_NAME); BS_ASSERT(!lua_isnil(L, -1)); @@ -684,10 +684,10 @@ static int RO_AddPanel(lua_State *L) { static int RO_AddBitmap(lua_State *L) { RenderObjectPtr ROPtr = CheckRenderObject(L); - BS_ASSERT(ROPtr.IsValid()); - RenderObjectPtr BitmaPtr = ROPtr->AddBitmap(luaL_checkstring(L, 2)); - if (BitmaPtr.IsValid()) { - NewUintUserData(L, BitmaPtr->GetHandle()); + BS_ASSERT(ROPtr.isValid()); + RenderObjectPtr BitmaPtr = ROPtr->addBitmap(luaL_checkstring(L, 2)); + if (BitmaPtr.isValid()) { + NewUintUserData(L, BitmaPtr->getHandle()); // luaL_getmetatable(L, BITMAP_CLASS_NAME); LuaBindhelper::GetMetatable(L, BITMAP_CLASS_NAME); BS_ASSERT(!lua_isnil(L, -1)); @@ -702,14 +702,14 @@ static int RO_AddBitmap(lua_State *L) { static int RO_AddText(lua_State *L) { RenderObjectPtr ROPtr = CheckRenderObject(L); - BS_ASSERT(ROPtr.IsValid()); + BS_ASSERT(ROPtr.isValid()); RenderObjectPtr TextPtr; - if (lua_gettop(L) >= 3) TextPtr = ROPtr->AddText(luaL_checkstring(L, 2), luaL_checkstring(L, 3)); - else TextPtr = ROPtr->AddText(luaL_checkstring(L, 2)); + if (lua_gettop(L) >= 3) TextPtr = ROPtr->addText(luaL_checkstring(L, 2), luaL_checkstring(L, 3)); + else TextPtr = ROPtr->addText(luaL_checkstring(L, 2)); - if (TextPtr.IsValid()) { - NewUintUserData(L, TextPtr->GetHandle()); + if (TextPtr.isValid()) { + NewUintUserData(L, TextPtr->getHandle()); // luaL_getmetatable(L, TEXT_CLASS_NAME); LuaBindhelper::GetMetatable(L, TEXT_CLASS_NAME); BS_ASSERT(!lua_isnil(L, -1)); @@ -724,25 +724,25 @@ static int RO_AddText(lua_State *L) { static int RO_AddAnimation(lua_State *L) { RenderObjectPtr ROPtr = CheckRenderObject(L); - BS_ASSERT(ROPtr.IsValid()); + BS_ASSERT(ROPtr.isValid()); RenderObjectPtr AnimationPtr; if (lua_type(L, 2) == LUA_TUSERDATA) - AnimationPtr = ROPtr->AddAnimation(*CheckAnimationTemplate(L, 2)); + AnimationPtr = ROPtr->addAnimation(*CheckAnimationTemplate(L, 2)); else - AnimationPtr = ROPtr->AddAnimation(luaL_checkstring(L, 2)); + AnimationPtr = ROPtr->addAnimation(luaL_checkstring(L, 2)); - if (AnimationPtr.IsValid()) { - NewUintUserData(L, AnimationPtr->GetHandle()); + if (AnimationPtr.isValid()) { + NewUintUserData(L, AnimationPtr->getHandle()); // luaL_getmetatable(L, ANIMATION_CLASS_NAME); LuaBindhelper::GetMetatable(L, ANIMATION_CLASS_NAME); BS_ASSERT(!lua_isnil(L, -1)); 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); @@ -779,8 +779,8 @@ static RenderObjectPtr CheckPanel(lua_State *L) { uint *UserDataPtr; if ((UserDataPtr = (uint *) my_checkudata(L, 1, PANEL_CLASS_NAME)) != 0) { RenderObjectPtr ROPtr(*UserDataPtr); - if (ROPtr.IsValid()) { - return ROPtr->ToPanel(); + if (ROPtr.isValid()) { + return ROPtr->toPanel(); } else luaL_error(L, "The panel with the handle %d does no longer exist.", *UserDataPtr); } else { @@ -794,8 +794,8 @@ static RenderObjectPtr CheckPanel(lua_State *L) { static int P_GetColor(lua_State *L) { RenderObjectPtr PanelPtr = CheckPanel(L); - BS_ASSERT(PanelPtr.IsValid()); - GraphicEngine::ARGBColorToLuaColor(L, PanelPtr->GetColor()); + BS_ASSERT(PanelPtr.isValid()); + GraphicEngine::ARGBColorToLuaColor(L, PanelPtr->getColor()); return 1; } @@ -804,8 +804,8 @@ static int P_GetColor(lua_State *L) { static int P_SetColor(lua_State *L) { RenderObjectPtr PanelPtr = CheckPanel(L); - BS_ASSERT(PanelPtr.IsValid()); - PanelPtr->SetColor(GraphicEngine::LuaColorToARGBColor(L, 2)); + BS_ASSERT(PanelPtr.isValid()); + PanelPtr->setColor(GraphicEngine::LuaColorToARGBColor(L, 2)); return 0; } @@ -813,8 +813,8 @@ static int P_SetColor(lua_State *L) { static int P_Remove(lua_State *L) { RenderObjectPtr ROPtr = CheckRenderObject(L); - BS_ASSERT(ROPtr.IsValid()); - ROPtr.Erase(); + BS_ASSERT(ROPtr.isValid()); + ROPtr.erase(); return 0; } @@ -834,8 +834,8 @@ static RenderObjectPtr CheckBitmap(lua_State *L) { uint *UserDataPtr; if ((UserDataPtr = (uint *) my_checkudata(L, 1, BITMAP_CLASS_NAME)) != 0) { RenderObjectPtr ROPtr(*UserDataPtr); - if (ROPtr.IsValid()) { - return ROPtr->ToBitmap(); + if (ROPtr.isValid()) { + return ROPtr->toBitmap(); } else luaL_error(L, "The bitmap with the handle %d does no longer exist.", *UserDataPtr); } else { @@ -849,8 +849,8 @@ static RenderObjectPtr CheckBitmap(lua_State *L) { static int B_SetAlpha(lua_State *L) { RenderObjectPtr BitmapPtr = CheckBitmap(L); - BS_ASSERT(BitmapPtr.IsValid()); - BitmapPtr->SetAlpha(static_cast(luaL_checknumber(L, 2))); + BS_ASSERT(BitmapPtr.isValid()); + BitmapPtr->setAlpha(static_cast(luaL_checknumber(L, 2))); return 0; } @@ -858,8 +858,8 @@ static int B_SetAlpha(lua_State *L) { static int B_SetTintColor(lua_State *L) { RenderObjectPtr BitmapPtr = CheckBitmap(L); - BS_ASSERT(BitmapPtr.IsValid()); - BitmapPtr->SetModulationColor(GraphicEngine::LuaColorToARGBColor(L, 2)); + BS_ASSERT(BitmapPtr.isValid()); + BitmapPtr->setModulationColor(GraphicEngine::LuaColorToARGBColor(L, 2)); return 0; } @@ -867,8 +867,8 @@ static int B_SetTintColor(lua_State *L) { static int B_SetScaleFactor(lua_State *L) { RenderObjectPtr BitmapPtr = CheckBitmap(L); - BS_ASSERT(BitmapPtr.IsValid()); - BitmapPtr->SetScaleFactor(static_cast(luaL_checknumber(L, 2))); + BS_ASSERT(BitmapPtr.isValid()); + BitmapPtr->setScaleFactor(static_cast(luaL_checknumber(L, 2))); return 0; } @@ -876,8 +876,8 @@ static int B_SetScaleFactor(lua_State *L) { static int B_SetScaleFactorX(lua_State *L) { RenderObjectPtr BitmapPtr = CheckBitmap(L); - BS_ASSERT(BitmapPtr.IsValid()); - BitmapPtr->SetScaleFactorX(static_cast(luaL_checknumber(L, 2))); + BS_ASSERT(BitmapPtr.isValid()); + BitmapPtr->setScaleFactorX(static_cast(luaL_checknumber(L, 2))); return 0; } @@ -885,8 +885,8 @@ static int B_SetScaleFactorX(lua_State *L) { static int B_SetScaleFactorY(lua_State *L) { RenderObjectPtr BitmapPtr = CheckBitmap(L); - BS_ASSERT(BitmapPtr.IsValid()); - BitmapPtr->SetScaleFactorY(static_cast(luaL_checknumber(L, 2))); + BS_ASSERT(BitmapPtr.isValid()); + BitmapPtr->setScaleFactorY(static_cast(luaL_checknumber(L, 2))); return 0; } @@ -894,8 +894,8 @@ static int B_SetScaleFactorY(lua_State *L) { static int B_SetFlipH(lua_State *L) { RenderObjectPtr BitmapPtr = CheckBitmap(L); - BS_ASSERT(BitmapPtr.IsValid()); - BitmapPtr->SetFlipH(lua_tobooleancpp(L, 2)); + BS_ASSERT(BitmapPtr.isValid()); + BitmapPtr->setFlipH(lua_tobooleancpp(L, 2)); return 0; } @@ -903,8 +903,8 @@ static int B_SetFlipH(lua_State *L) { static int B_SetFlipV(lua_State *L) { RenderObjectPtr BitmapPtr = CheckBitmap(L); - BS_ASSERT(BitmapPtr.IsValid()); - BitmapPtr->SetFlipV(lua_tobooleancpp(L, 2)); + BS_ASSERT(BitmapPtr.isValid()); + BitmapPtr->setFlipV(lua_tobooleancpp(L, 2)); return 0; } @@ -912,8 +912,8 @@ static int B_SetFlipV(lua_State *L) { static int B_GetAlpha(lua_State *L) { RenderObjectPtr BitmapPtr = CheckBitmap(L); - BS_ASSERT(BitmapPtr.IsValid()); - lua_pushnumber(L, BitmapPtr->GetAlpha()); + BS_ASSERT(BitmapPtr.isValid()); + lua_pushnumber(L, BitmapPtr->getAlpha()); return 1; } @@ -921,8 +921,8 @@ static int B_GetAlpha(lua_State *L) { static int B_GetTintColor(lua_State *L) { RenderObjectPtr BitmapPtr = CheckBitmap(L); - BS_ASSERT(BitmapPtr.IsValid()); - GraphicEngine::ARGBColorToLuaColor(L, BitmapPtr->GetModulationColor()); + BS_ASSERT(BitmapPtr.isValid()); + GraphicEngine::ARGBColorToLuaColor(L, BitmapPtr->getModulationColor()); return 1; } @@ -930,8 +930,8 @@ static int B_GetTintColor(lua_State *L) { static int B_GetScaleFactorX(lua_State *L) { RenderObjectPtr BitmapPtr = CheckBitmap(L); - BS_ASSERT(BitmapPtr.IsValid()); - lua_pushnumber(L, BitmapPtr->GetScaleFactorX()); + BS_ASSERT(BitmapPtr.isValid()); + lua_pushnumber(L, BitmapPtr->getScaleFactorX()); return 1; } @@ -939,8 +939,8 @@ static int B_GetScaleFactorX(lua_State *L) { static int B_GetScaleFactorY(lua_State *L) { RenderObjectPtr BitmapPtr = CheckBitmap(L); - BS_ASSERT(BitmapPtr.IsValid()); - lua_pushnumber(L, BitmapPtr->GetScaleFactorY()); + BS_ASSERT(BitmapPtr.isValid()); + lua_pushnumber(L, BitmapPtr->getScaleFactorY()); return 1; } @@ -948,8 +948,8 @@ static int B_GetScaleFactorY(lua_State *L) { static int B_IsFlipH(lua_State *L) { RenderObjectPtr BitmapPtr = CheckBitmap(L); - BS_ASSERT(BitmapPtr.IsValid()); - lua_pushbooleancpp(L, BitmapPtr->IsFlipH()); + BS_ASSERT(BitmapPtr.isValid()); + lua_pushbooleancpp(L, BitmapPtr->isFlipH()); return 1; } @@ -957,8 +957,8 @@ static int B_IsFlipH(lua_State *L) { static int B_IsFlipV(lua_State *L) { RenderObjectPtr BitmapPtr = CheckBitmap(L); - BS_ASSERT(BitmapPtr.IsValid()); - lua_pushbooleancpp(L, BitmapPtr->IsFlipV()); + BS_ASSERT(BitmapPtr.isValid()); + lua_pushbooleancpp(L, BitmapPtr->isFlipV()); return 1; } @@ -966,10 +966,10 @@ static int B_IsFlipV(lua_State *L) { static int B_GetPixel(lua_State *L) { RenderObjectPtr BitmapPtr = CheckBitmap(L); - BS_ASSERT(BitmapPtr.IsValid()); + BS_ASSERT(BitmapPtr.isValid()); Vertex Pos; Vertex::LuaVertexToVertex(L, 2, Pos); - GraphicEngine::ARGBColorToLuaColor(L, BitmapPtr->GetPixel(Pos.X, Pos.Y)); + GraphicEngine::ARGBColorToLuaColor(L, BitmapPtr->getPixel(Pos.X, Pos.Y)); return 1; } @@ -977,8 +977,8 @@ static int B_GetPixel(lua_State *L) { static int B_IsScalingAllowed(lua_State *L) { RenderObjectPtr BitmapPtr = CheckBitmap(L); - BS_ASSERT(BitmapPtr.IsValid()); - lua_pushbooleancpp(L, BitmapPtr->IsScalingAllowed()); + BS_ASSERT(BitmapPtr.isValid()); + lua_pushbooleancpp(L, BitmapPtr->isScalingAllowed()); return 1; } @@ -986,8 +986,8 @@ static int B_IsScalingAllowed(lua_State *L) { static int B_IsAlphaAllowed(lua_State *L) { RenderObjectPtr BitmapPtr = CheckBitmap(L); - BS_ASSERT(BitmapPtr.IsValid()); - lua_pushbooleancpp(L, BitmapPtr->IsAlphaAllowed()); + BS_ASSERT(BitmapPtr.isValid()); + lua_pushbooleancpp(L, BitmapPtr->isAlphaAllowed()); return 1; } @@ -995,16 +995,16 @@ static int B_IsAlphaAllowed(lua_State *L) { static int B_IsTintingAllowed(lua_State *L) { RenderObjectPtr BitmapPtr = CheckBitmap(L); - BS_ASSERT(BitmapPtr.IsValid()); - lua_pushbooleancpp(L, BitmapPtr->IsColorModulationAllowed()); + BS_ASSERT(BitmapPtr.isValid()); + lua_pushbooleancpp(L, BitmapPtr->isColorModulationAllowed()); return 1; } // ----------------------------------------------------------------------------- static int B_Remove(lua_State *L) { RenderObjectPtr ROPtr = CheckRenderObject(L); - BS_ASSERT(ROPtr.IsValid()); - ROPtr.Erase(); + BS_ASSERT(ROPtr.isValid()); + ROPtr.erase(); return 0; } @@ -1039,8 +1039,8 @@ static RenderObjectPtr CheckAnimation(lua_State *L) { uint *UserDataPtr; if ((UserDataPtr = (uint *) my_checkudata(L, 1, ANIMATION_CLASS_NAME)) != 0) { RenderObjectPtr ROPtr(*UserDataPtr); - if (ROPtr.IsValid()) - return ROPtr->ToAnimation(); + if (ROPtr.isValid()) + return ROPtr->toAnimation(); else { luaL_error(L, "The animation with the handle %d does no longer exist.", *UserDataPtr); } @@ -1055,7 +1055,7 @@ static RenderObjectPtr CheckAnimation(lua_State *L) { static int A_Play(lua_State *L) { RenderObjectPtr AnimationPtr = CheckAnimation(L); - BS_ASSERT(AnimationPtr.IsValid()); + BS_ASSERT(AnimationPtr.isValid()); AnimationPtr->Play(); return 0; } @@ -1064,7 +1064,7 @@ static int A_Play(lua_State *L) { static int A_Pause(lua_State *L) { RenderObjectPtr AnimationPtr = CheckAnimation(L); - BS_ASSERT(AnimationPtr.IsValid()); + BS_ASSERT(AnimationPtr.isValid()); AnimationPtr->Pause(); return 0; } @@ -1073,7 +1073,7 @@ static int A_Pause(lua_State *L) { static int A_Stop(lua_State *L) { RenderObjectPtr AnimationPtr = CheckAnimation(L); - BS_ASSERT(AnimationPtr.IsValid()); + BS_ASSERT(AnimationPtr.isValid()); AnimationPtr->Stop(); return 0; } @@ -1082,7 +1082,7 @@ static int A_Stop(lua_State *L) { static int A_SetFrame(lua_State *L) { RenderObjectPtr AnimationPtr = CheckAnimation(L); - BS_ASSERT(AnimationPtr.IsValid()); + BS_ASSERT(AnimationPtr.isValid()); AnimationPtr->SetFrame(static_cast(luaL_checknumber(L, 2))); return 0; } @@ -1091,16 +1091,16 @@ static int A_SetFrame(lua_State *L) { static int A_SetAlpha(lua_State *L) { RenderObjectPtr AnimationPtr = CheckAnimation(L); - BS_ASSERT(AnimationPtr.IsValid()); - AnimationPtr->SetAlpha(static_cast(luaL_checknumber(L, 2))); + BS_ASSERT(AnimationPtr.isValid()); + AnimationPtr->setAlpha(static_cast(luaL_checknumber(L, 2))); return 0; } // ----------------------------------------------------------------------------- static int A_SetTintColor(lua_State *L) { RenderObjectPtr AnimationPtr = CheckAnimation(L); - BS_ASSERT(AnimationPtr.IsValid()); - AnimationPtr->SetModulationColor(GraphicEngine::LuaColorToARGBColor(L, 2)); + BS_ASSERT(AnimationPtr.isValid()); + AnimationPtr->setModulationColor(GraphicEngine::LuaColorToARGBColor(L, 2)); return 0; } @@ -1108,8 +1108,8 @@ static int A_SetTintColor(lua_State *L) { static int A_SetScaleFactor(lua_State *L) { RenderObjectPtr AnimationPtr = CheckAnimation(L); - BS_ASSERT(AnimationPtr.IsValid()); - AnimationPtr->SetScaleFactor(static_cast(luaL_checknumber(L, 2))); + BS_ASSERT(AnimationPtr.isValid()); + AnimationPtr->setScaleFactor(static_cast(luaL_checknumber(L, 2))); return 0; } @@ -1117,8 +1117,8 @@ static int A_SetScaleFactor(lua_State *L) { static int A_SetScaleFactorX(lua_State *L) { RenderObjectPtr AnimationPtr = CheckAnimation(L); - BS_ASSERT(AnimationPtr.IsValid()); - AnimationPtr->SetScaleFactorX(static_cast(luaL_checknumber(L, 2))); + BS_ASSERT(AnimationPtr.isValid()); + AnimationPtr->setScaleFactorX(static_cast(luaL_checknumber(L, 2))); return 0; } @@ -1126,8 +1126,8 @@ static int A_SetScaleFactorX(lua_State *L) { static int A_SetScaleFactorY(lua_State *L) { RenderObjectPtr AnimationPtr = CheckAnimation(L); - BS_ASSERT(AnimationPtr.IsValid()); - AnimationPtr->SetScaleFactorY(static_cast(luaL_checknumber(L, 2))); + BS_ASSERT(AnimationPtr.isValid()); + AnimationPtr->setScaleFactorY(static_cast(luaL_checknumber(L, 2))); return 0; } @@ -1135,8 +1135,8 @@ static int A_SetScaleFactorY(lua_State *L) { static int A_GetScaleFactorX(lua_State *L) { RenderObjectPtr AnimationPtr = CheckAnimation(L); - BS_ASSERT(AnimationPtr.IsValid()); - lua_pushnumber(L, AnimationPtr->GetScaleFactorX()); + BS_ASSERT(AnimationPtr.isValid()); + lua_pushnumber(L, AnimationPtr->getScaleFactorX()); return 1; } @@ -1144,8 +1144,8 @@ static int A_GetScaleFactorX(lua_State *L) { static int A_GetScaleFactorY(lua_State *L) { RenderObjectPtr AnimationPtr = CheckAnimation(L); - BS_ASSERT(AnimationPtr.IsValid()); - lua_pushnumber(L, AnimationPtr->GetScaleFactorY()); + BS_ASSERT(AnimationPtr.isValid()); + lua_pushnumber(L, AnimationPtr->getScaleFactorY()); return 1; } @@ -1153,8 +1153,8 @@ static int A_GetScaleFactorY(lua_State *L) { static int A_GetAnimationType(lua_State *L) { RenderObjectPtr AnimationPtr = CheckAnimation(L); - BS_ASSERT(AnimationPtr.IsValid()); - switch (AnimationPtr->GetAnimationType()) { + BS_ASSERT(AnimationPtr.isValid()); + switch (AnimationPtr->getAnimationType()) { case Animation::AT_JOJO: lua_pushstring(L, "jojo"); break; @@ -1174,8 +1174,8 @@ static int A_GetAnimationType(lua_State *L) { static int A_GetFPS(lua_State *L) { RenderObjectPtr AnimationPtr = CheckAnimation(L); - BS_ASSERT(AnimationPtr.IsValid()); - lua_pushnumber(L, AnimationPtr->GetFPS()); + BS_ASSERT(AnimationPtr.isValid()); + lua_pushnumber(L, AnimationPtr->getFPS()); return 1; } @@ -1184,8 +1184,8 @@ static int A_GetFPS(lua_State *L) { static int A_GetFrameCount(lua_State *L) { RenderObjectPtr AnimationPtr = CheckAnimation(L); - BS_ASSERT(AnimationPtr.IsValid()); - lua_pushnumber(L, AnimationPtr->GetFrameCount()); + BS_ASSERT(AnimationPtr.isValid()); + lua_pushnumber(L, AnimationPtr->getFrameCount()); return 1; } @@ -1193,8 +1193,8 @@ static int A_GetFrameCount(lua_State *L) { static int A_IsScalingAllowed(lua_State *L) { RenderObjectPtr AnimationPtr = CheckAnimation(L); - BS_ASSERT(AnimationPtr.IsValid()); - lua_pushbooleancpp(L, AnimationPtr->IsScalingAllowed()); + BS_ASSERT(AnimationPtr.isValid()); + lua_pushbooleancpp(L, AnimationPtr->isScalingAllowed()); return 1; } @@ -1202,8 +1202,8 @@ static int A_IsScalingAllowed(lua_State *L) { static int A_IsAlphaAllowed(lua_State *L) { RenderObjectPtr AnimationPtr = CheckAnimation(L); - BS_ASSERT(AnimationPtr.IsValid()); - lua_pushbooleancpp(L, AnimationPtr->IsAlphaAllowed()); + BS_ASSERT(AnimationPtr.isValid()); + lua_pushbooleancpp(L, AnimationPtr->isAlphaAllowed()); return 1; } @@ -1211,8 +1211,8 @@ static int A_IsAlphaAllowed(lua_State *L) { static int A_IsTintingAllowed(lua_State *L) { RenderObjectPtr AnimationPtr = CheckAnimation(L); - BS_ASSERT(AnimationPtr.IsValid()); - lua_pushbooleancpp(L, AnimationPtr->IsColorModulationAllowed()); + BS_ASSERT(AnimationPtr.isValid()); + lua_pushbooleancpp(L, AnimationPtr->isColorModulationAllowed()); return 1; } @@ -1220,7 +1220,7 @@ static int A_IsTintingAllowed(lua_State *L) { static int A_GetCurrentFrame(lua_State *L) { RenderObjectPtr AnimationPtr = CheckAnimation(L); - BS_ASSERT(AnimationPtr.IsValid()); + BS_ASSERT(AnimationPtr.isValid()); lua_pushnumber(L, AnimationPtr->GetCurrentFrame()); return 1; } @@ -1229,7 +1229,7 @@ static int A_GetCurrentFrame(lua_State *L) { static int A_GetCurrentAction(lua_State *L) { RenderObjectPtr AnimationPtr = CheckAnimation(L); - BS_ASSERT(AnimationPtr.IsValid()); + BS_ASSERT(AnimationPtr.isValid()); lua_pushstring(L, AnimationPtr->GetCurrentAction().c_str()); return 1; } @@ -1238,7 +1238,7 @@ static int A_GetCurrentAction(lua_State *L) { static int A_IsPlaying(lua_State *L) { RenderObjectPtr AnimationPtr = CheckAnimation(L); - BS_ASSERT(AnimationPtr.IsValid()); + BS_ASSERT(AnimationPtr.isValid()); lua_pushbooleancpp(L, AnimationPtr->IsRunning()); return 1; } @@ -1256,11 +1256,11 @@ static bool AnimationLoopPointCallback(uint Handle) { static int A_RegisterLoopPointCallback(lua_State *L) { RenderObjectPtr AnimationPtr = CheckAnimation(L); - BS_ASSERT(AnimationPtr.IsValid()); + BS_ASSERT(AnimationPtr.isValid()); luaL_checktype(L, 2, LUA_TFUNCTION); lua_pushvalue(L, 2); - LoopPointCallbackPtr->RegisterCallbackFunction(L, AnimationPtr->GetHandle()); + LoopPointCallbackPtr->RegisterCallbackFunction(L, AnimationPtr->getHandle()); return 0; } @@ -1269,11 +1269,11 @@ static int A_RegisterLoopPointCallback(lua_State *L) { static int A_UnregisterLoopPointCallback(lua_State *L) { RenderObjectPtr AnimationPtr = CheckAnimation(L); - BS_ASSERT(AnimationPtr.IsValid()); + BS_ASSERT(AnimationPtr.isValid()); luaL_checktype(L, 2, LUA_TFUNCTION); lua_pushvalue(L, 2); - LoopPointCallbackPtr->UnregisterCallbackFunction(L, AnimationPtr->GetHandle()); + LoopPointCallbackPtr->UnregisterCallbackFunction(L, AnimationPtr->getHandle()); return 0; } @@ -1282,10 +1282,10 @@ static int A_UnregisterLoopPointCallback(lua_State *L) { static bool AnimationActionCallback(uint Handle) { RenderObjectPtr AnimationPtr(Handle); - if (AnimationPtr.IsValid()) { + if (AnimationPtr.isValid()) { ActionCallbackPtr->Action = AnimationPtr->GetCurrentAction(); lua_State *L = static_cast(Kernel::GetInstance()->GetScript()->GetScriptObject()); - ActionCallbackPtr->InvokeCallbackFunctions(L, AnimationPtr->GetHandle()); + ActionCallbackPtr->InvokeCallbackFunctions(L, AnimationPtr->getHandle()); } return true; @@ -1295,11 +1295,11 @@ static bool AnimationActionCallback(uint Handle) { static int A_RegisterActionCallback(lua_State *L) { RenderObjectPtr AnimationPtr = CheckAnimation(L); - BS_ASSERT(AnimationPtr.IsValid()); + BS_ASSERT(AnimationPtr.isValid()); luaL_checktype(L, 2, LUA_TFUNCTION); lua_pushvalue(L, 2); - ActionCallbackPtr->RegisterCallbackFunction(L, AnimationPtr->GetHandle()); + ActionCallbackPtr->RegisterCallbackFunction(L, AnimationPtr->getHandle()); return 0; } @@ -1308,11 +1308,11 @@ static int A_RegisterActionCallback(lua_State *L) { static int A_UnregisterActionCallback(lua_State *L) { RenderObjectPtr AnimationPtr = CheckAnimation(L); - BS_ASSERT(AnimationPtr.IsValid()); + BS_ASSERT(AnimationPtr.isValid()); luaL_checktype(L, 2, LUA_TFUNCTION); lua_pushvalue(L, 2); - ActionCallbackPtr->UnregisterCallbackFunction(L, AnimationPtr->GetHandle()); + ActionCallbackPtr->UnregisterCallbackFunction(L, AnimationPtr->getHandle()); return 0; } @@ -1330,8 +1330,8 @@ static bool AnimationDeleteCallback(uint Handle) { static int A_Remove(lua_State *L) { RenderObjectPtr AnimationPtr = CheckAnimation(L); - BS_ASSERT(AnimationPtr.IsValid()); - AnimationPtr.Erase(); + BS_ASSERT(AnimationPtr.isValid()); + AnimationPtr.erase(); return 0; } @@ -1373,8 +1373,8 @@ static RenderObjectPtr CheckText(lua_State *L) { uint *UserDataPtr; if ((UserDataPtr = (uint *) my_checkudata(L, 1, TEXT_CLASS_NAME)) != 0) { RenderObjectPtr ROPtr(*UserDataPtr); - if (ROPtr.IsValid()) - return ROPtr->ToText(); + if (ROPtr.isValid()) + return ROPtr->toText(); else luaL_error(L, "The text with the handle %d does no longer exist.", *UserDataPtr); } else { @@ -1388,7 +1388,7 @@ static RenderObjectPtr CheckText(lua_State *L) { static int T_SetFont(lua_State *L) { RenderObjectPtr TextPtr = CheckText(L); - BS_ASSERT(TextPtr.IsValid()); + BS_ASSERT(TextPtr.isValid()); TextPtr->SetFont(luaL_checkstring(L, 2)); return 0; } @@ -1397,7 +1397,7 @@ static int T_SetFont(lua_State *L) { static int T_SetText(lua_State *L) { RenderObjectPtr TextPtr = CheckText(L); - BS_ASSERT(TextPtr.IsValid()); + BS_ASSERT(TextPtr.isValid()); TextPtr->SetText(luaL_checkstring(L, 2)); return 0; } @@ -1406,8 +1406,8 @@ static int T_SetText(lua_State *L) { static int T_SetAlpha(lua_State *L) { RenderObjectPtr TextPtr = CheckText(L); - BS_ASSERT(TextPtr.IsValid()); - TextPtr->SetAlpha(static_cast(luaL_checknumber(L, 2))); + BS_ASSERT(TextPtr.isValid()); + TextPtr->setAlpha(static_cast(luaL_checknumber(L, 2))); return 0; } @@ -1415,8 +1415,8 @@ static int T_SetAlpha(lua_State *L) { static int T_SetColor(lua_State *L) { RenderObjectPtr TextPtr = CheckText(L); - BS_ASSERT(TextPtr.IsValid()); - TextPtr->SetColor(GraphicEngine::LuaColorToARGBColor(L, 2)); + BS_ASSERT(TextPtr.isValid()); + TextPtr->setColor(GraphicEngine::LuaColorToARGBColor(L, 2)); return 0; } @@ -1424,7 +1424,7 @@ static int T_SetColor(lua_State *L) { static int T_SetAutoWrap(lua_State *L) { RenderObjectPtr TextPtr = CheckText(L); - BS_ASSERT(TextPtr.IsValid()); + BS_ASSERT(TextPtr.isValid()); TextPtr->SetAutoWrap(lua_tobooleancpp(L, 2)); return 0; } @@ -1433,7 +1433,7 @@ static int T_SetAutoWrap(lua_State *L) { static int T_SetAutoWrapThreshold(lua_State *L) { RenderObjectPtr TextPtr = CheckText(L); - BS_ASSERT(TextPtr.IsValid()); + BS_ASSERT(TextPtr.isValid()); TextPtr->SetAutoWrapThreshold(static_cast(luaL_checknumber(L, 2))); return 0; } @@ -1442,7 +1442,7 @@ static int T_SetAutoWrapThreshold(lua_State *L) { static int T_GetText(lua_State *L) { RenderObjectPtr TextPtr = CheckText(L); - BS_ASSERT(TextPtr.IsValid()); + BS_ASSERT(TextPtr.isValid()); lua_pushstring(L, TextPtr->GetText().c_str()); return 1; } @@ -1451,7 +1451,7 @@ static int T_GetText(lua_State *L) { static int T_GetFont(lua_State *L) { RenderObjectPtr TextPtr = CheckText(L); - BS_ASSERT(TextPtr.IsValid()); + BS_ASSERT(TextPtr.isValid()); lua_pushstring(L, TextPtr->GetFont().c_str()); return 1; } @@ -1460,8 +1460,8 @@ static int T_GetFont(lua_State *L) { static int T_GetAlpha(lua_State *L) { RenderObjectPtr TextPtr = CheckText(L); - BS_ASSERT(TextPtr.IsValid()); - lua_pushnumber(L, TextPtr->GetAlpha()); + BS_ASSERT(TextPtr.isValid()); + lua_pushnumber(L, TextPtr->getAlpha()); return 1; } @@ -1469,8 +1469,8 @@ static int T_GetAlpha(lua_State *L) { static int T_GetColor(lua_State *L) { RenderObjectPtr TextPtr = CheckText(L); - BS_ASSERT(TextPtr.IsValid()); - lua_pushnumber(L, TextPtr->GetColor()); + BS_ASSERT(TextPtr.isValid()); + lua_pushnumber(L, TextPtr->getColor()); return 1; } @@ -1478,7 +1478,7 @@ static int T_GetColor(lua_State *L) { static int T_IsAutoWrap(lua_State *L) { RenderObjectPtr TextPtr = CheckText(L); - BS_ASSERT(TextPtr.IsValid()); + BS_ASSERT(TextPtr.isValid()); lua_pushbooleancpp(L, TextPtr->IsAutoWrapActive()); return 1; } @@ -1487,7 +1487,7 @@ static int T_IsAutoWrap(lua_State *L) { static int T_GetAutoWrapThreshold(lua_State *L) { RenderObjectPtr TextPtr = CheckText(L); - BS_ASSERT(TextPtr.IsValid()); + BS_ASSERT(TextPtr.isValid()); lua_pushnumber(L, TextPtr->GetAutoWrapThreshold()); return 1; } @@ -1496,8 +1496,8 @@ static int T_GetAutoWrapThreshold(lua_State *L) { static int T_Remove(lua_State *L) { RenderObjectPtr TextPtr = CheckText(L); - BS_ASSERT(TextPtr.IsValid()); - TextPtr.Erase(); + BS_ASSERT(TextPtr.isValid()); + TextPtr.erase(); return 0; } diff --git a/engines/sword25/gfx/image/image.h b/engines/sword25/gfx/image/image.h index 0404c50d6f..bc0ff20d77 100644 --- a/engines/sword25/gfx/image/image.h +++ b/engines/sword25/gfx/image/image.h @@ -76,17 +76,17 @@ public: /** @brief Gibt die Breite des Bildes in Pixeln zurück */ - virtual int GetWidth() const = 0; + virtual int getWidth() const = 0; /** @brief Gibt die Höhe des Bildes in Pixeln zurück */ - virtual int GetHeight() const = 0; + virtual int getHeight() const = 0; /** @brief Gibt das Farbformat des Bildes zurück */ - virtual GraphicEngine::COLOR_FORMATS GetColorFormat() const = 0; + virtual GraphicEngine::COLOR_FORMATS getColorFormat() const = 0; //@} @@ -131,11 +131,11 @@ public: - IsColorModulationAllowed() - IsSetContentAllowed() */ - virtual bool Blit(int PosX = 0, int PosY = 0, - int Flipping = FLIP_NONE, + virtual bool blit(int posX = 0, int posY = 0, + int flipping = FLIP_NONE, Common::Rect *pPartRect = NULL, - uint Color = BS_ARGB(255, 255, 255, 255), - int Width = -1, int Height = -1) = 0; + uint color = BS_ARGB(255, 255, 255, 255), + int width = -1, int height = -1) = 0; /** @brief Füllt einen Rechteckigen Bereich des Bildes mit einer Farbe. @@ -149,7 +149,7 @@ public: BS_RGB und BS_ARGB benutzt werden. @remark Falls das Rechteck nicht völlig innerhalb des Bildschirms ist, wird es automatisch zurechtgestutzt. */ - virtual bool Fill(const Common::Rect *pFillRect = 0, uint Color = BS_RGB(0, 0, 0)) = 0; + virtual bool fill(const Common::Rect *pFillRect = 0, uint color = BS_RGB(0, 0, 0)) = 0; /** @brief Füllt den Inhalt des Bildes mit Pixeldaten. @@ -162,7 +162,7 @@ public: @return Gibt false zurück, falls der Aufruf fehlgeschlagen ist. @remark Ein Aufruf dieser Methode ist nur erlaubt, wenn IsSetContentAllowed() true zurückgibt. */ - virtual bool SetContent(const byte *Pixeldata, uint size, uint Offset, uint Stride) = 0; + virtual bool setContent(const byte *pixeldata, uint size, uint offset, uint stride) = 0; /** @brief Liest einen Pixel des Bildes. @@ -172,7 +172,7 @@ public: @remark Diese Methode sollte auf keine Fall benutzt werden um größere Teile des Bildes zu lesen, da sie sehr langsam ist. Sie ist eher dafür gedacht einzelne Pixel des Bildes auszulesen. */ - virtual uint GetPixel(int X, int Y) = 0; + virtual uint getPixel(int x, int y) = 0; //@{ /** @name Auskunfts-Methoden */ @@ -181,38 +181,38 @@ public: @brief Überprüft, ob an dem BS_Image Blit() aufgerufen werden darf. @return Gibt false zurück, falls ein Blit()-Aufruf an diesem Objekt nicht gestattet ist. */ - virtual bool IsBlitSource() const = 0; + virtual bool isBlitSource() const = 0; /** @brief Überprüft, ob das BS_Image ein Zielbild für einen Blit-Aufruf sein kann. @return Gibt false zurück, falls ein Blit-Aufruf mit diesem Objekt als Ziel nicht gestattet ist. */ - virtual bool IsBlitTarget() const = 0; + virtual bool isBlitTarget() const = 0; /** @brief Gibt true zurück, falls das BS_Image bei einem Aufruf von Blit() skaliert dargestellt werden kann. */ - virtual bool IsScalingAllowed() const = 0; + virtual bool isScalingAllowed() const = 0; /** @brief Gibt true zurück, wenn das BS_Image mit einem Aufruf von Fill() gefüllt werden kann. */ - virtual bool IsFillingAllowed() const = 0; + virtual bool isFillingAllowed() const = 0; /** @brief Gibt true zurück, wenn das BS_Image bei einem Aufruf von Blit() mit einem Alphawert dargestellt werden kann. */ - virtual bool IsAlphaAllowed() const = 0; + virtual bool isAlphaAllowed() const = 0; /** @brief Gibt true zurück, wenn das BS_Image bei einem Aufruf von Blit() mit Farbmodulation dargestellt werden kann. */ - virtual bool IsColorModulationAllowed() const = 0; + virtual bool isColorModulationAllowed() const = 0; /** @brief Gibt true zurück, wenn der Inhalt des BS_Image durch eine Aufruf von SetContent() ausgetauscht werden kann. */ - virtual bool IsSetContentAllowed() const = 0; + virtual bool isSetContentAllowed() const = 0; //@} }; diff --git a/engines/sword25/gfx/image/vectorimage.cpp b/engines/sword25/gfx/image/vectorimage.cpp index 894cc73b6f..7ec47e8a71 100644 --- a/engines/sword25/gfx/image/vectorimage.cpp +++ b/engines/sword25/gfx/image/vectorimage.cpp @@ -60,66 +60,67 @@ namespace Sword25 { class VectorImage::SWFBitStream { public: - SWFBitStream(const byte *pData, uint DataSize) : - m_Pos(pData), m_End(pData + DataSize), m_WordMask(0) + SWFBitStream(const byte *pData, uint dataSize) : + m_Pos(pData), m_End(pData + dataSize), m_WordMask(0) {} - inline uint32 GetBits(uint BitCount) { - if (BitCount == 0 || BitCount > 32) { + inline uint32 getBits(uint bitCount) { + if (bitCount == 0 || bitCount > 32) { error("SWFBitStream::GetBits() must read at least 1 and at most 32 bits at a time"); } uint32 value = 0; - while (BitCount) { - if (m_WordMask == 0) FlushByte(); + while (bitCount) { + if (m_WordMask == 0) + flushByte(); value <<= 1; value |= ((m_Word & m_WordMask) != 0) ? 1 : 0; m_WordMask >>= 1; - --BitCount; + --bitCount; } return value; } - inline int32 GetSignedBits(uint BitCount) { + inline int32 getSignedBits(uint bitCount) { // Bits einlesen - uint32 Temp = GetBits(BitCount); + uint32 temp = getBits(bitCount); // Falls das Sign-Bit gesetzt ist, den Rest des Rückgabewertes mit 1-Bits auffüllen (Sign Extension) - if (Temp & 1 << (BitCount - 1)) - return (0xffffffff << BitCount) | Temp; + if (temp & 1 << (bitCount - 1)) + return (0xffffffff << bitCount) | temp; else - return Temp; + return temp; } - inline uint32 GetUInt32() { - uint32 Byte1 = GetByte(); - uint32 Byte2 = GetByte(); - uint32 Byte3 = GetByte(); - uint32 Byte4 = GetByte(); + inline uint32 getUInt32() { + uint32 byte1 = getByte(); + uint32 byte2 = getByte(); + uint32 byte3 = getByte(); + uint32 byte4 = getByte(); - return Byte1 | (Byte2 << 8) | (Byte3 << 16) | (Byte4 << 24); + return byte1 | (byte2 << 8) | (byte3 << 16) | (byte4 << 24); } - inline uint16 GetUInt16() { - uint32 Byte1 = GetByte(); - uint32 Byte2 = GetByte(); + inline uint16 getUInt16() { + uint32 byte1 = getByte(); + uint32 byte2 = getByte(); - return Byte1 | (Byte2 << 8); + return byte1 | (byte2 << 8); } - inline byte GetByte() { - FlushByte(); - byte Value = m_Word; + inline byte getByte() { + flushByte(); + byte value = m_Word; m_WordMask = 0; - FlushByte(); + flushByte(); - return Value; + return value; } - inline void FlushByte() { + inline void flushByte() { if (m_WordMask != 128) { if (m_Pos >= m_End) { error("Attempted to read past end of file"); @@ -130,12 +131,12 @@ public: } } - inline void SkipBytes(uint SkipLength) { - FlushByte(); - if (m_Pos + SkipLength >= m_End) { + inline void skipBytes(uint skipLength) { + flushByte(); + if (m_Pos + skipLength >= m_End) { error("Attempted to read past end of file"); } else { - m_Pos += SkipLength; + m_Pos += skipLength; m_Word = *(m_Pos - 1); } } @@ -144,8 +145,8 @@ private: const byte *m_Pos; const byte *m_End; - byte m_Word; - uint m_WordMask; + byte m_Word; + uint m_WordMask; }; @@ -165,19 +166,19 @@ const uint32 MAX_ACCEPTED_FLASH_VERSION = 3; // Die h // Konvertiert SWF-Rechteckdaten in einem Bitstrom in Common::Rect-Objekte // ----------------------------------------------------------------------------- -Common::Rect FlashRectToBSRect(VectorImage::SWFBitStream &bs) { - bs.FlushByte(); +Common::Rect flashRectToBSRect(VectorImage::SWFBitStream &bs) { + bs.flushByte(); // Feststellen mit wie vielen Bits die einzelnen Komponenten kodiert sind - uint32 BitsPerValue = bs.GetBits(5); + uint32 bitsPerValue = bs.getBits(5); // Die einzelnen Komponenten einlesen - int32 XMin = bs.GetSignedBits(BitsPerValue); - int32 XMax = bs.GetSignedBits(BitsPerValue); - int32 YMin = bs.GetSignedBits(BitsPerValue); - int32 YMax = bs.GetSignedBits(BitsPerValue); + int32 xMin = bs.getSignedBits(bitsPerValue); + int32 xMax = bs.getSignedBits(bitsPerValue); + int32 yMin = bs.getSignedBits(bitsPerValue); + int32 yMax = bs.getSignedBits(bitsPerValue); - return Common::Rect(XMin, YMin, XMax + 1, YMax + 1); + return Common::Rect(xMin, yMin, xMax + 1, yMax + 1); } @@ -185,10 +186,10 @@ Common::Rect FlashRectToBSRect(VectorImage::SWFBitStream &bs) { // Konvertiert SWF-Farben in AntiGrain Farben // ----------------------------------------------------------------------------- -uint32 FlashColorToAGGRGBA8(uint FlashColor) { - uint32 ResultColor = Graphics::ARGBToColor >(FlashColor >> 24, (FlashColor >> 16) & 0xff, (FlashColor >> 8) & 0xff, FlashColor & 0xff); +uint32 flashColorToAGGRGBA8(uint flashColor) { + uint32 resultColor = Graphics::ARGBToColor >(flashColor >> 24, (flashColor >> 16) & 0xff, (flashColor >> 8) & 0xff, flashColor & 0xff); - return ResultColor; + return resultColor; } @@ -199,7 +200,7 @@ uint32 FlashColorToAGGRGBA8(uint FlashColor) { struct CBBGetId { CBBGetId(const VectorImageElement &vectorImageElement_) : vectorImageElement(vectorImageElement_) {} unsigned operator [](unsigned i) const { - return vectorImageElement.GetPathInfo(i).GetID(); + return vectorImageElement.getPathInfo(i).getId(); } const VectorImageElement &vectorImageElement; }; @@ -224,75 +225,75 @@ Common::Rect CalculateBoundingBox(const VectorImageElement &vectorImageElement) // Konstruktion // ----------------------------------------------------------------------------- -VectorImage::VectorImage(const byte *pFileData, uint FileSize, bool &Success) { - Success = false; +VectorImage::VectorImage(const byte *pFileData, uint fileSize, bool &success) { + success = false; // Bitstream-Objekt erzeugen // Im Folgenden werden die Dateidaten aus diesem ausgelesen. - SWFBitStream bs(pFileData, FileSize); + SWFBitStream bs(pFileData, fileSize); // SWF-Signatur überprüfen - uint32 Signature[3]; - Signature[0] = bs.GetByte(); - Signature[1] = bs.GetByte(); - Signature[2] = bs.GetByte(); - if (Signature[0] != 'F' || - Signature[1] != 'W' || - Signature[2] != 'S') { + uint32 signature[3]; + signature[0] = bs.getByte(); + signature[1] = bs.getByte(); + signature[2] = bs.getByte(); + if (signature[0] != 'F' || + signature[1] != 'W' || + signature[2] != 'S') { BS_LOG_ERRORLN("File is not a valid SWF-file"); return; } // Versionsangabe überprüfen - uint32 Version = bs.GetByte(); - if (Version > MAX_ACCEPTED_FLASH_VERSION) { - BS_LOG_ERRORLN("File is of version %d. Highest accepted version is %d.", Version, MAX_ACCEPTED_FLASH_VERSION); + uint32 version = bs.getByte(); + if (version > MAX_ACCEPTED_FLASH_VERSION) { + BS_LOG_ERRORLN("File is of version %d. Highest accepted version is %d.", version, MAX_ACCEPTED_FLASH_VERSION); return; } // Dateigröße auslesen und mit der tatsächlichen Größe vergleichen - uint32 StoredFileSize = bs.GetUInt32(); - if (StoredFileSize != FileSize) { + uint32 storedFileSize = bs.getUInt32(); + if (storedFileSize != fileSize) { BS_LOG_ERRORLN("File is not a valid SWF-file"); return; } // SWF-Maße auslesen - Common::Rect MovieRect = FlashRectToBSRect(bs); + Common::Rect movieRect = flashRectToBSRect(bs); // Framerate und Frameanzahl auslesen - /* uint32 FrameRate = */bs.GetUInt16(); - /* uint32 FrameCount = */bs.GetUInt16(); + /* uint32 frameRate = */bs.getUInt16(); + /* uint32 frameCount = */bs.getUInt16(); // Tags parsen // Da wir uns nur für das erste DefineShape-Tag interessieren - bool KeepParsing = true; - while (KeepParsing) { + bool keepParsing = true; + while (keepParsing) { // Tags beginnen immer an Bytegrenzen - bs.FlushByte(); + bs.flushByte(); // Tagtyp und Länge auslesen - uint16 TagTypeAndLength = bs.GetUInt16(); - uint32 TagType = TagTypeAndLength >> 6; - uint32 TagLength = TagTypeAndLength & 0x3f; - if (TagLength == 0x3f) - TagLength = bs.GetUInt32(); + uint16 tagTypeAndLength = bs.getUInt16(); + uint32 tagType = tagTypeAndLength >> 6; + uint32 tagLength = tagTypeAndLength & 0x3f; + if (tagLength == 0x3f) + tagLength = bs.getUInt32(); - switch (TagType) { + switch (tagType) { case 2: // DefineShape - Success = ParseDefineShape(2, bs); + success = parseDefineShape(2, bs); return; case 22: // DefineShape2 - Success = ParseDefineShape(2, bs); + success = parseDefineShape(2, bs); return; case 32: - Success = ParseDefineShape(3, bs); + success = parseDefineShape(3, bs); return; default: // Unbekannte Tags ignorieren - bs.SkipBytes(TagLength); + bs.skipBytes(tagLength); } } @@ -303,147 +304,149 @@ VectorImage::VectorImage(const byte *pFileData, uint FileSize, bool &Success) { // ----------------------------------------------------------------------------- -bool VectorImage::ParseDefineShape(uint ShapeType, SWFBitStream &bs) { - /*uint32 ShapeID = */bs.GetUInt16(); +bool VectorImage::parseDefineShape(uint shapeType, SWFBitStream &bs) { + /*uint32 shapeID = */bs.getUInt16(); // Bounding Box auslesen - m_BoundingBox = FlashRectToBSRect(bs); + _boundingBox = flashRectToBSRect(bs); // Erstes Image-Element erzeugen - m_Elements.resize(1); + _elements.resize(1); // Styles einlesen - uint NumFillBits; - uint NumLineBits; - if (!ParseStyles(ShapeType, bs, NumFillBits, NumLineBits)) + uint numFillBits; + uint numLineBits; + if (!parseStyles(shapeType, bs, numFillBits, numLineBits)) return false; - uint LineStyle = 0; - uint FillStyle0 = 0; - uint FillStyle1 = 0; + uint lineStyle = 0; + uint fillStyle0 = 0; + uint fillStyle1 = 0; // Shaperecord parsen // ------------------ - bool EndOfShapeDiscovered = false; - while (!EndOfShapeDiscovered) { - uint32 TypeFlag = bs.GetBits(1); + bool endOfShapeDiscovered = false; + while (!endOfShapeDiscovered) { + uint32 typeFlag = bs.getBits(1); // Non-Edge Record - if (TypeFlag == 0) { + if (typeFlag == 0) { // Feststellen welche Parameter gesetzt werden - uint32 StateNewStyles = bs.GetBits(1); - uint32 StateLineStyle = bs.GetBits(1); - uint32 StateFillStyle1 = bs.GetBits(1); - uint32 StateFillStyle0 = bs.GetBits(1); - uint32 StateMoveTo = bs.GetBits(1); + uint32 stateNewStyles = bs.getBits(1); + uint32 stateLineStyle = bs.getBits(1); + uint32 stateFillStyle1 = bs.getBits(1); + uint32 stateFillStyle0 = bs.getBits(1); + uint32 stateMoveTo = bs.getBits(1); // End der Shape-Definition erreicht? - if (!StateNewStyles && !StateLineStyle && !StateFillStyle0 && !StateFillStyle1 && !StateMoveTo) - EndOfShapeDiscovered = true; + if (!stateNewStyles && !stateLineStyle && !stateFillStyle0 && !stateFillStyle1 && !stateMoveTo) + endOfShapeDiscovered = true; // Parameter dekodieren else { - int32 MoveDeltaX = 0; - int32 MoveDeltaY = 0; - if (StateMoveTo) { - uint32 MoveToBits = bs.GetBits(5); - MoveDeltaX = bs.GetSignedBits(MoveToBits); - MoveDeltaY = bs.GetSignedBits(MoveToBits); + int32 moveDeltaX = 0; + int32 moveDeltaY = 0; + if (stateMoveTo) { + uint32 moveToBits = bs.getBits(5); + moveDeltaX = bs.getSignedBits(moveToBits); + moveDeltaY = bs.getSignedBits(moveToBits); } - if (StateFillStyle0) { - if (NumFillBits > 0) - FillStyle0 = bs.GetBits(NumFillBits); + if (stateFillStyle0) { + if (numFillBits > 0) + fillStyle0 = bs.getBits(numFillBits); else - FillStyle0 = 0; + fillStyle0 = 0; } - if (StateFillStyle1) { - if (NumFillBits > 0) - FillStyle1 = bs.GetBits(NumFillBits); + if (stateFillStyle1) { + if (numFillBits > 0) + fillStyle1 = bs.getBits(numFillBits); else - FillStyle1 = 0; + fillStyle1 = 0; } - if (StateLineStyle) { - if (NumLineBits) - LineStyle = bs.GetBits(NumLineBits); + if (stateLineStyle) { + if (numLineBits) + lineStyle = bs.getBits(numLineBits); else - NumLineBits = 0; + numLineBits = 0; } - if (StateNewStyles) { + if (stateNewStyles) { // An dieser Stelle werden in Flash die alten Style-Definitionen verworfen und mit den neuen überschrieben. // Es wird ein neues Element begonnen. - m_Elements.resize(m_Elements.size() + 1); - if (!ParseStyles(ShapeType, bs, NumFillBits, NumLineBits)) return false; + _elements.resize(_elements.size() + 1); + if (!parseStyles(shapeType, bs, numFillBits, numLineBits)) + return false; } // Ein neuen Pfad erzeugen, es sei denn, es wurden nur neue Styles definiert - if (StateLineStyle || StateFillStyle0 || StateFillStyle1 || StateMoveTo) { + if (stateLineStyle || stateFillStyle0 || stateFillStyle1 || stateMoveTo) { // Letzte Zeichenposition merken, beim Aufruf von start_new_path() wird die Zeichenpostionen auf 0, 0 zurückgesetzt #if 0 // TODO - double LastX = m_Elements.back().m_Paths.last_x(); - double LastY = m_Elements.back().m_Paths.last_y(); + double lastX = _elements.back()._paths.last_x(); + double lastY = _elements.back()._paths.last_y(); // Neue Pfadinformation erzeugen - m_Elements.back().m_PathInfos.push_back(BS_VectorPathInfo(m_Elements.back().m_Paths.start_new_path(), LineStyle, FillStyle0, FillStyle1)); + _elements.back()._pathInfos.push_back(VectorPathInfo(_elements.back()._paths.start_new_path(), lineStyle, fillStyle0, fillStyle1)); // Falls eine Bewegung definiert wurde, wird die Zeichenpositionen an die entsprechende Position gesetzt. // Ansonsten wird die Zeichenposition auf die letzte Zeichenposition gesetzt. - if (StateMoveTo) - m_Elements.back().m_Paths.move_to(MoveDeltaX, MoveDeltaY); + if (stateMoveTo) + _elements.back()._paths.move_to(moveDeltaX, moveDeltaY); else - m_Elements.back().m_Paths.move_to(LastX, LastY); + _elements.back()._paths.move_to(lastX, lastY); #endif } } } else { // Edge Record - uint32 EdgeFlag = bs.GetBits(1); - uint32 NumBits = bs.GetBits(4) + 2; + uint32 edgeFlag = bs.getBits(1); + uint32 numBits = bs.getBits(4) + 2; // Curved edge - if (EdgeFlag == 0) { - /* int32 ControlDeltaX = */bs.GetSignedBits(NumBits); - /* int32 ControlDeltaY = */bs.GetSignedBits(NumBits); - /* int32 AnchorDeltaX = */bs.GetSignedBits(NumBits); - /* int32 AnchorDeltaY = */bs.GetSignedBits(NumBits); + if (edgeFlag == 0) { + /* int32 ControlDeltaX = */bs.getSignedBits(numBits); + /* int32 ControlDeltaY = */bs.getSignedBits(numBits); + /* int32 AnchorDeltaX = */bs.getSignedBits(numBits); + /* int32 AnchorDeltaY = */bs.getSignedBits(numBits); #if 0 // TODO - double ControlX = m_Elements.back().m_Paths.last_x() + ControlDeltaX; - double ControlY = m_Elements.back().m_Paths.last_y() + ControlDeltaY; - double AnchorX = ControlX + AnchorDeltaX; - double AnchorY = ControlY + AnchorDeltaY; - m_Elements.back().m_Paths.curve3(ControlX, ControlY, AnchorX, AnchorY); + double controlX = _elements.back()._paths.last_x() + controlDeltaX; + double controlY = _elements.back()._paths.last_y() + controlDeltaY; + double anchorX = controlX + AnchorDeltaX; + double anchorY = controlY + AnchorDeltaY; + _elements.back()._paths.curve3(controlX, controlY, anchorX, anchorY); #endif } else { // Staight edge - int32 DeltaX = 0; - int32 DeltaY = 0; + int32 deltaX = 0; + int32 deltaY = 0; - uint32 GeneralLineFlag = bs.GetBits(1); - if (GeneralLineFlag) { - DeltaX = bs.GetSignedBits(NumBits); - DeltaY = bs.GetSignedBits(NumBits); + uint32 generalLineFlag = bs.getBits(1); + if (generalLineFlag) { + deltaX = bs.getSignedBits(numBits); + deltaY = bs.getSignedBits(numBits); } else { - uint32 VertLineFlag = bs.GetBits(1); - if (VertLineFlag) - DeltaY = bs.GetSignedBits(NumBits); + uint32 vertLineFlag = bs.getBits(1); + if (vertLineFlag) + deltaY = bs.getSignedBits(numBits); else - DeltaX = bs.GetSignedBits(NumBits); + deltaX = bs.getSignedBits(numBits); } #if 0 // TODO - m_Elements.back().m_Paths.line_rel(DeltaX, DeltaY); + _elements.back()._paths.line_rel(deltaX, deltaY); #endif } } } // Bounding-Boxes der einzelnen Elemente berechnen - Common::Array::iterator it = m_Elements.begin(); - for (; it != m_Elements.end(); ++it) it->m_BoundingBox = CalculateBoundingBox(*it); + Common::Array::iterator it = _elements.begin(); + for (; it != _elements.end(); ++it) + it->_boundingBox = CalculateBoundingBox(*it); return true; } @@ -451,55 +454,57 @@ bool VectorImage::ParseDefineShape(uint ShapeType, SWFBitStream &bs) { // ----------------------------------------------------------------------------- -bool VectorImage::ParseStyles(uint ShapeType, SWFBitStream &bs, uint &NumFillBits, uint &NumLineBits) { - bs.FlushByte(); +bool VectorImage::parseStyles(uint shapeType, SWFBitStream &bs, uint &numFillBits, uint &numLineBits) { + bs.flushByte(); // Fillstyles parsen // ----------------- // Anzahl an Fillstyles bestimmen - uint FillStyleCount = bs.GetByte(); - if (FillStyleCount == 0xff) FillStyleCount = bs.GetUInt16(); + uint fillStyleCount = bs.getByte(); + if (fillStyleCount == 0xff) + fillStyleCount = bs.getUInt16(); // Alle Fillstyles einlesen, falls ein Fillstyle mit Typ != 0 gefunden wird, wird das Parsen abgebrochen. // Es wird nur "solid fill" (Typ 0) unterstützt. - m_Elements.back().m_FillStyles.reserve(FillStyleCount); - for (uint i = 0; i < FillStyleCount; ++i) { - byte Type = bs.GetByte(); - uint32 Color; - if (ShapeType == 3) { - Color = (bs.GetByte() << 16) | (bs.GetByte() << 8) | bs.GetByte() | (bs.GetByte() << 24); + _elements.back()._fillStyles.reserve(fillStyleCount); + for (uint i = 0; i < fillStyleCount; ++i) { + byte type = bs.getByte(); + uint32 color; + if (shapeType == 3) { + color = (bs.getByte() << 16) | (bs.getByte() << 8) | bs.getByte() | (bs.getByte() << 24); } else - Color = bs.GetBits(24) | (0xff << 24); - if (Type != 0) return false; + color = bs.getBits(24) | (0xff << 24); + if (type != 0) + return false; - m_Elements.back().m_FillStyles.push_back(FlashColorToAGGRGBA8(Color)); + _elements.back()._fillStyles.push_back(flashColorToAGGRGBA8(color)); } // Linestyles parsen // ----------------- // Anzahl an Linestyles bestimmen - uint LineStyleCount = bs.GetByte(); - if (LineStyleCount == 0xff) - LineStyleCount = bs.GetUInt16(); + uint lineStyleCount = bs.getByte(); + if (lineStyleCount == 0xff) + lineStyleCount = bs.getUInt16(); // Alle Linestyles einlesen - m_Elements.back().m_LineStyles.reserve(LineStyleCount); - for (uint i = 0; i < LineStyleCount; ++i) { - double Width = bs.GetUInt16(); - uint32 Color; - if (ShapeType == 3) - Color = (bs.GetByte() << 16) | (bs.GetByte() << 8) | bs.GetByte() | (bs.GetByte() << 24); + _elements.back()._lineStyles.reserve(lineStyleCount); + for (uint i = 0; i < lineStyleCount; ++i) { + double width = bs.getUInt16(); + uint32 color; + if (shapeType == 3) + color = (bs.getByte() << 16) | (bs.getByte() << 8) | bs.getByte() | (bs.getByte() << 24); else - Color = bs.GetBits(24) | (0xff << 24); + color = bs.getBits(24) | (0xff << 24); - m_Elements.back().m_LineStyles.push_back(VectorImageElement::LineStyleType(Width, FlashColorToAGGRGBA8(Color))); + _elements.back()._lineStyles.push_back(VectorImageElement::LineStyleType(width, flashColorToAGGRGBA8(color))); } // Bitbreite für die folgenden Styleindizes auslesen - NumFillBits = bs.GetBits(4); - NumLineBits = bs.GetBits(4); + numFillBits = bs.getBits(4); + numLineBits = bs.getBits(4); return true; } @@ -507,7 +512,7 @@ bool VectorImage::ParseStyles(uint ShapeType, SWFBitStream &bs, uint &NumFillBit // ----------------------------------------------------------------------------- -bool VectorImage::Fill(const Common::Rect *pFillRect, uint Color) { +bool VectorImage::fill(const Common::Rect *pFillRect, uint color) { BS_LOG_ERRORLN("Fill() is not supported."); return false; } @@ -515,14 +520,14 @@ bool VectorImage::Fill(const Common::Rect *pFillRect, uint Color) { // ----------------------------------------------------------------------------- -uint VectorImage::GetPixel(int X, int Y) { +uint VectorImage::getPixel(int x, int y) { BS_LOG_ERRORLN("GetPixel() is not supported. Returning black."); return 0; } // ----------------------------------------------------------------------------- -bool VectorImage::SetContent(const byte *Pixeldata, uint size, uint Offset, uint Stride) { +bool VectorImage::setContent(const byte *pixeldata, uint size, uint offset, uint stride) { BS_LOG_ERRORLN("SetContent() is not supported."); return 0; } diff --git a/engines/sword25/gfx/image/vectorimage.h b/engines/sword25/gfx/image/vectorimage.h index 213775c618..7f14da907c 100644 --- a/engines/sword25/gfx/image/vectorimage.h +++ b/engines/sword25/gfx/image/vectorimage.h @@ -60,31 +60,31 @@ class VectorImage; class VectorPathInfo { public: - VectorPathInfo(uint ID, uint LineStyle, uint FillStyle0, uint FillStyle1) : - m_ID(ID), m_LineStyle(LineStyle), m_FillStyle0(FillStyle0), m_FillStyle1(FillStyle1) {} + VectorPathInfo(uint id, uint lineStyle, uint fillStyle0, uint fillStyle1) : + _id(id), _lineStyle(lineStyle), _fillStyle0(fillStyle0), _fillStyle1(fillStyle1) {} VectorPathInfo() { - m_ID = m_LineStyle = m_FillStyle0 = m_FillStyle1 = 0; + _id = _lineStyle = _fillStyle0 = _fillStyle1 = 0; } - uint GetID() const { - return m_ID; + uint getId() const { + return _id; } - uint GetLineStyle() const { - return m_LineStyle; + uint getLineStyle() const { + return _lineStyle; } - uint GetFillStyle0() const { - return m_FillStyle0; + uint getFillStyle0() const { + return _fillStyle0; } - uint GetFillStyle1() const { - return m_FillStyle1; + uint getFillStyle1() const { + return _fillStyle1; } private: - uint m_ID; - uint m_LineStyle; - uint m_FillStyle0; - uint m_FillStyle1; + uint _id; + uint _lineStyle; + uint _fillStyle0; + uint _fillStyle1; }; @@ -96,61 +96,61 @@ class VectorImageElement { friend class VectorImage; public: #if 0 // TODO - const agg::path_storage &GetPaths() const { - return m_Paths; + const agg::path_storage &getPaths() const { + return _paths; } #endif - uint GetPathCount() const { - return m_PathInfos.size(); + uint getPathCount() const { + return _pathInfos.size(); } - const VectorPathInfo &GetPathInfo(uint PathNr) const { - BS_ASSERT(PathNr < GetPathCount()); - return m_PathInfos[PathNr]; + const VectorPathInfo &getPathInfo(uint pathNr) const { + BS_ASSERT(pathNr < getPathCount()); + return _pathInfos[pathNr]; } - double GetLineStyleWidth(uint LineStyle) const { - BS_ASSERT(LineStyle < m_LineStyles.size()); - return m_LineStyles[LineStyle].Width; + double getLineStyleWidth(uint lineStyle) const { + BS_ASSERT(lineStyle < _lineStyles.size()); + return _lineStyles[lineStyle].width; } - uint GetLineStyleCount() const { - return m_LineStyles.size(); + uint getLineStyleCount() const { + return _lineStyles.size(); } - uint32 GetLineStyleColor(uint LineStyle) const { - BS_ASSERT(LineStyle < m_LineStyles.size()); - return m_LineStyles[LineStyle].Color; + uint32 getLineStyleColor(uint lineStyle) const { + BS_ASSERT(lineStyle < _lineStyles.size()); + return _lineStyles[lineStyle].color; } - uint GetFillStyleCount() const { - return m_FillStyles.size(); + uint getFillStyleCount() const { + return _fillStyles.size(); } - uint32 GetFillStyleColor(uint FillStyle) const { - BS_ASSERT(FillStyle < m_FillStyles.size()); - return m_FillStyles[FillStyle]; + uint32 getFillStyleColor(uint fillStyle) const { + BS_ASSERT(fillStyle < _fillStyles.size()); + return _fillStyles[fillStyle]; } - const Common::Rect &GetBoundingBox() const { - return m_BoundingBox; + const Common::Rect &getBoundingBox() const { + return _boundingBox; } private: struct LineStyleType { - LineStyleType(double Width_, uint32 Color_) : Width(Width_), Color(Color_) {} - LineStyleType() { Width = 0; Color = 0; } - double Width; - uint32 Color; + LineStyleType(double width_, uint32 color_) : width(width_), color(color_) {} + LineStyleType() { width = 0; color = 0; } + double width; + uint32 color; }; #if 0 // TODO - agg::path_storage m_Paths; + agg::path_storage _paths; #endif - Common::Array m_PathInfos; - Common::Array m_LineStyles; - Common::Array m_FillStyles; - Common::Rect m_BoundingBox; + Common::Array _pathInfos; + Common::Array _lineStyles; + Common::Array _fillStyles; + Common::Rect _boundingBox; }; @@ -162,69 +162,69 @@ private: class VectorImage : public Image { public: - VectorImage(const byte *pFileData, uint FileSize, bool &Success); + VectorImage(const byte *pFileData, uint fileSize, bool &success); - uint GetElementCount() const { - return m_Elements.size(); + uint getElementCount() const { + return _elements.size(); } - const VectorImageElement &GetElement(uint ElementNr) const { - BS_ASSERT(ElementNr < m_Elements.size()); - return m_Elements[ElementNr]; + const VectorImageElement &getElement(uint elementNr) const { + BS_ASSERT(elementNr < _elements.size()); + return _elements[elementNr]; } - const Common::Rect &GetBoundingBox() const { - return m_BoundingBox; + const Common::Rect &getBoundingBox() const { + return _boundingBox; } // // Die abstrakten Methoden von BS_Image // - virtual int GetWidth() const { - return m_BoundingBox.width(); + virtual int getWidth() const { + return _boundingBox.width(); } - virtual int GetHeight() const { - return m_BoundingBox.height(); + virtual int getHeight() const { + return _boundingBox.height(); } - virtual GraphicEngine::COLOR_FORMATS GetColorFormat() const { + virtual GraphicEngine::COLOR_FORMATS getColorFormat() const { return GraphicEngine::CF_ARGB32; } - virtual bool Fill(const Common::Rect *pFillRect = 0, uint Color = BS_RGB(0, 0, 0)); - virtual uint GetPixel(int X, int Y); - virtual bool IsBlitSource() const { + virtual bool fill(const Common::Rect *pFillRect = 0, uint color = BS_RGB(0, 0, 0)); + virtual uint getPixel(int x, int y); + virtual bool isBlitSource() const { return true; } - virtual bool IsBlitTarget() const { + virtual bool isBlitTarget() const { return false; } - virtual bool IsScalingAllowed() const { + virtual bool isScalingAllowed() const { return true; } - virtual bool IsFillingAllowed() const { + virtual bool isFillingAllowed() const { return false; } - virtual bool IsAlphaAllowed() const { + virtual bool isAlphaAllowed() const { return true; } - virtual bool IsColorModulationAllowed() const { + virtual bool isColorModulationAllowed() const { return true; } - virtual bool IsSetContentAllowed() const { + virtual bool isSetContentAllowed() const { return false; } - virtual bool SetContent(const byte *Pixeldata, uint size, uint Offset, uint Stride); - virtual bool Blit(int PosX = 0, int PosY = 0, - int Flipping = FLIP_NONE, + virtual bool setContent(const byte *pixeldata, uint size, uint offset, uint stride); + virtual bool blit(int posX = 0, int posY = 0, + int flipping = FLIP_NONE, Common::Rect *pPartRect = NULL, - uint Color = BS_ARGB(255, 255, 255, 255), - int Width = -1, int Height = -1); + uint color = BS_ARGB(255, 255, 255, 255), + int width = -1, int height = -1); class SWFBitStream; private: - bool ParseDefineShape(uint ShapeType, SWFBitStream &bs); - bool ParseStyles(uint ShapeType, SWFBitStream &bs, uint &NumFillBits, uint &NumLineBits); + bool parseDefineShape(uint shapeType, SWFBitStream &bs); + bool parseStyles(uint shapeType, SWFBitStream &bs, uint &numFillBits, uint &numLineBits); - Common::Array m_Elements; - Common::Rect m_BoundingBox; + Common::Array _elements; + Common::Rect _boundingBox; }; } // End of namespace Sword25 diff --git a/engines/sword25/gfx/opengl/glimage.cpp b/engines/sword25/gfx/opengl/glimage.cpp index c54f7829c0..bccd18660d 100644 --- a/engines/sword25/gfx/opengl/glimage.cpp +++ b/engines/sword25/gfx/opengl/glimage.cpp @@ -51,11 +51,11 @@ namespace Sword25 { // CONSTRUCTION / DESTRUCTION // ----------------------------------------------------------------------------- -GLImage::GLImage(const Common::String &Filename, bool &Result) : +GLImage::GLImage(const Common::String &filename, bool &result) : _data(0), - m_Width(0), - m_Height(0) { - Result = false; + _width(0), + _height(0) { + result = false; PackageManager *pPackage = static_cast(Kernel::GetInstance()->GetService("package")); BS_ASSERT(pPackage); @@ -64,22 +64,22 @@ GLImage::GLImage(const Common::String &Filename, bool &Result) : // Datei laden byte *pFileData; - uint FileSize; - if (!(pFileData = (byte *) pPackage->GetFile(Filename, &FileSize))) { - BS_LOG_ERRORLN("File \"%s\" could not be loaded.", Filename.c_str()); + uint fileSize; + if (!(pFileData = (byte *)pPackage->GetFile(filename, &fileSize))) { + BS_LOG_ERRORLN("File \"%s\" could not be loaded.", filename.c_str()); return; } // Bildeigenschaften bestimmen - GraphicEngine::COLOR_FORMATS ColorFormat; - int Pitch; - if (!ImageLoader::ExtractImageProperties(pFileData, FileSize, ColorFormat, m_Width, m_Height)) { + GraphicEngine::COLOR_FORMATS colorFormat; + int pitch; + if (!ImageLoader::ExtractImageProperties(pFileData, fileSize, colorFormat, _width, _height)) { BS_LOG_ERRORLN("Could not read image properties."); return; } // Das Bild dekomprimieren - if (!ImageLoader::LoadImage(pFileData, FileSize, GraphicEngine::CF_ARGB32, _data, m_Width, m_Height, Pitch)) { + if (!ImageLoader::LoadImage(pFileData, fileSize, GraphicEngine::CF_ARGB32, _data, _width, _height, pitch)) { BS_LOG_ERRORLN("Could not decode image."); return; } @@ -87,22 +87,22 @@ GLImage::GLImage(const Common::String &Filename, bool &Result) : // Dateidaten freigeben delete[] pFileData; - Result = true; + result = true; return; } // ----------------------------------------------------------------------------- -GLImage::GLImage(uint Width, uint Height, bool &Result) : - m_Width(Width), - m_Height(Height) { - Result = false; +GLImage::GLImage(uint width, uint height, bool &result) : + _width(width), + _height(height) { + result = false; - _data = new byte[Width * Height * 4]; + _data = new byte[width * height * 4]; _backSurface = (static_cast(Kernel::GetInstance()->GetService("gfx")))->getSurface(); - Result = true; + result = true; return; } @@ -114,27 +114,27 @@ GLImage::~GLImage() { // ----------------------------------------------------------------------------- -bool GLImage::Fill(const Common::Rect *pFillRect, uint Color) { +bool GLImage::fill(const Common::Rect *pFillRect, uint color) { BS_LOG_ERRORLN("Fill() is not supported."); return false; } // ----------------------------------------------------------------------------- -bool GLImage::SetContent(const byte *Pixeldata, uint size, uint Offset, uint Stride) { +bool GLImage::setContent(const byte *pixeldata, uint size, uint offset, uint stride) { // Überprüfen, ob PixelData ausreichend viele Pixel enthält um ein Bild der Größe Width * Height zu erzeugen - if (size < static_cast(m_Width * m_Height * 4)) { - BS_LOG_ERRORLN("PixelData vector is too small to define a 32 bit %dx%d image.", m_Width, m_Height); + if (size < static_cast(_width * _height * 4)) { + BS_LOG_ERRORLN("PixelData vector is too small to define a 32 bit %dx%d image.", _width, _height); return false; } - const byte *in = &Pixeldata[Offset]; + const byte *in = &pixeldata[offset]; byte *out = _data; - for (int i = 0; i < m_Height; i++) { - memcpy(out, in, m_Width * 4); - out += m_Width * 4; - in += Stride; + for (int i = 0; i < _height; i++) { + memcpy(out, in, _width * 4); + out += _width * 4; + in += stride; } return true; @@ -142,16 +142,16 @@ bool GLImage::SetContent(const byte *Pixeldata, uint size, uint Offset, uint Str // ----------------------------------------------------------------------------- -uint GLImage::GetPixel(int X, int Y) { +uint GLImage::getPixel(int x, int y) { BS_LOG_ERRORLN("GetPixel() is not supported. Returning black."); return 0; } // ----------------------------------------------------------------------------- -bool GLImage::Blit(int PosX, int PosY, int Flipping, Common::Rect *pPartRect, uint Color, int Width, int Height) { +bool GLImage::blit(int posX, int posY, int flipping, Common::Rect *pPartRect, uint color, int width, int height) { int x1 = 0, y1 = 0; - int w = m_Width, h = m_Height; + int w = _width, h = _height; if (pPartRect) { x1 = pPartRect->left; y1 = pPartRect->top; @@ -159,43 +159,43 @@ bool GLImage::Blit(int PosX, int PosY, int Flipping, Common::Rect *pPartRect, ui h = pPartRect->bottom - pPartRect->top; } - debug(6, "Blit(%d, %d, %d, [%d, %d, %d, %d], %d, %d, %d)", PosX, PosY, Flipping, x1, y1, w, h, Color, Width, Height); + debug(6, "Blit(%d, %d, %d, [%d, %d, %d, %d], %d, %d, %d)", posX, posY, flipping, x1, y1, w, h, color, width, height); // Skalierungen berechnen - float ScaleX, ScaleY; - if (Width == -1) - Width = m_Width; - ScaleX = (float) Width / (float) m_Width; + float scaleX, scaleY; + if (width == -1) + width = _width; + scaleX = (float)width / (float)_width; - if (Height == -1) - Height = m_Height; - ScaleY = (float) Height / (float) m_Height; + if (height == -1) + height = _height; + scaleY = (float)height / (float)_height; - if ((Color & 0xff000000) != 0xff000000) { - warning("STUB: Image transparent bg color: %x", Color); + if ((color & 0xff000000) != 0xff000000) { + warning("STUB: Image transparent bg color: %x", color); } - int cr = (Color >> 16) & 0xff; - int cg = (Color >> 8) & 0xff; - int cb = (Color >> 0) & 0xff; + int cr = (color >> 16) & 0xff; + int cg = (color >> 8) & 0xff; + int cb = (color >> 0) & 0xff; - if (ScaleX != 1.0 || ScaleY != 1.0) { - warning("STUB: Sprite scaling (%f x %f)", ScaleX, ScaleY); + if (scaleX != 1.0 || scaleY != 1.0) { + warning("STUB: Sprite scaling (%f x %f)", scaleX, scaleY); } - if (PosX < 0) { - w -= PosX; - x1 = -PosX; - PosX = 0; + if (posX < 0) { + w -= posX; + x1 = -posX; + posX = 0; } - if (PosY < 0) { - h -= PosY; - y1 = -PosY; - PosY = 0; + if (posY < 0) { + h -= posY; + y1 = -posY; + posY = 0; } - w = CLIP(w, 0, MAX((int)_backSurface->w - PosX - 1, 0)); - h = CLIP(h, 0, MAX((int)_backSurface->h - PosY - 1, 0)); + w = CLIP(w, 0, MAX((int)_backSurface->w - posX - 1, 0)); + h = CLIP(h, 0, MAX((int)_backSurface->h - posY - 1, 0)); if (w == 0 || h == 0) return true; @@ -207,19 +207,19 @@ bool GLImage::Blit(int PosX, int PosY, int Flipping, Common::Rect *pPartRect, ui // TODO: scaling int inStep = 4; - int inoStep = m_Width * 4; - if (Flipping & Image::FLIP_V) { + int inoStep = _width * 4; + if (flipping & Image::FLIP_V) { inStep = -inStep; x1 = x1 + w - 1; } - if (Flipping & Image::FLIP_H) { + if (flipping & Image::FLIP_H) { inoStep = -inoStep; y1 = y1 + h - 1; } - byte *ino = &_data[y1 * m_Width * 4 + x1 * 4]; - byte *outo = (byte *)_backSurface->getBasePtr(PosX, PosY); + byte *ino = &_data[y1 * _width * 4 + x1 * 4]; + byte *outo = (byte *)_backSurface->getBasePtr(posX, posY); byte *in, *out; for (int i = 0; i < h; i++) { @@ -278,7 +278,7 @@ bool GLImage::Blit(int PosX, int PosY, int Flipping, Common::Rect *pPartRect, ui ino += inoStep; } - g_system->copyRectToScreen((byte *)_backSurface->getBasePtr(PosX, PosY), _backSurface->pitch, PosX, PosY, w, h); + g_system->copyRectToScreen((byte *)_backSurface->getBasePtr(posX, posY), _backSurface->pitch, posX, posY, w, h); return true; } diff --git a/engines/sword25/gfx/opengl/glimage.h b/engines/sword25/gfx/opengl/glimage.h index d5986eacd9..5f019d2bc0 100644 --- a/engines/sword25/gfx/opengl/glimage.h +++ b/engines/sword25/gfx/opengl/glimage.h @@ -57,7 +57,7 @@ typedef void *GLS_Sprite; class GLImage : public Image { public: - GLImage(const Common::String &Filename, bool &Result); + GLImage(const Common::String &filename, bool &result); /** @brief Erzeugt ein leeres BS_GLImage @@ -67,53 +67,53 @@ public: @param Result gibt dem Aufrufer bekannt, ob der Konstruktor erfolgreich ausgeführt wurde. Wenn es nach dem Aufruf false enthalten sollte, dürfen keine Methoden am Objekt aufgerufen werden und das Objekt ist sofort zu zerstören. */ - GLImage(uint Width, uint Height, bool &Result); + GLImage(uint width, uint height, bool &result); virtual ~GLImage(); - virtual int GetWidth() const { - return m_Width; + virtual int getWidth() const { + return _width; } - virtual int GetHeight() const { - return m_Height; + virtual int getHeight() const { + return _height; } - virtual GraphicEngine::COLOR_FORMATS GetColorFormat() const { + virtual GraphicEngine::COLOR_FORMATS getColorFormat() const { return GraphicEngine::CF_ARGB32; } - virtual bool Blit(int PosX = 0, int PosY = 0, - int Flipping = Image::FLIP_NONE, + virtual bool blit(int posX = 0, int posY = 0, + int flipping = Image::FLIP_NONE, Common::Rect *pPartRect = NULL, - uint Color = BS_ARGB(255, 255, 255, 255), - int Width = -1, int Height = -1); - virtual bool Fill(const Common::Rect *pFillRect, uint Color); - virtual bool SetContent(const byte *Pixeldata, uint size, uint Offset = 0, uint Stride = 0); - virtual uint GetPixel(int X, int Y); + uint color = BS_ARGB(255, 255, 255, 255), + int width = -1, int height = -1); + virtual bool fill(const Common::Rect *pFillRect, uint color); + virtual bool setContent(const byte *pixeldata, uint size, uint offset = 0, uint stride = 0); + virtual uint getPixel(int x, int y); - virtual bool IsBlitSource() const { + virtual bool isBlitSource() const { return true; } - virtual bool IsBlitTarget() const { + virtual bool isBlitTarget() const { return false; } - virtual bool IsScalingAllowed() const { + virtual bool isScalingAllowed() const { return true; } - virtual bool IsFillingAllowed() const { + virtual bool isFillingAllowed() const { return false; } - virtual bool IsAlphaAllowed() const { + virtual bool isAlphaAllowed() const { return true; } - virtual bool IsColorModulationAllowed() const { + virtual bool isColorModulationAllowed() const { return true; } - virtual bool IsSetContentAllowed() const { + virtual bool isSetContentAllowed() const { return true; } private: byte *_data; - int m_Width; - int m_Height; + int _width; + int _height; Graphics::Surface *_backSurface; }; diff --git a/engines/sword25/gfx/opengl/glvectorimageblit.cpp b/engines/sword25/gfx/opengl/glvectorimageblit.cpp index 3347d424c5..664d9c16b0 100644 --- a/engines/sword25/gfx/opengl/glvectorimageblit.cpp +++ b/engines/sword25/gfx/opengl/glvectorimageblit.cpp @@ -51,7 +51,7 @@ const float LINE_SCALE_FACTOR = 1.0f; // ----------------------------------------------------------------------------- -bool VectorImage::Blit(int PosX, int PosY, +bool VectorImage::blit(int PosX, int PosY, int Flipping, Common::Rect *pPartRect, uint Color, diff --git a/engines/sword25/gfx/opengl/openglgfx.cpp b/engines/sword25/gfx/opengl/openglgfx.cpp index ec4f1221a1..0401a99e4d 100644 --- a/engines/sword25/gfx/opengl/openglgfx.cpp +++ b/engines/sword25/gfx/opengl/openglgfx.cpp @@ -127,12 +127,12 @@ bool OpenGLGfx::Init(int Width, int Height, int BitDepth, int BackbufferCount, b SetVsync(true); // Layer-Manager initialisieren. - m_RenderObjectManagerPtr.reset(new RenderObjectManager(Width, Height, BackbufferCount + 1)); + _renderObjectManagerPtr.reset(new RenderObjectManager(Width, Height, BackbufferCount + 1)); // Hauptpanel erstellen - m_MainPanelPtr = m_RenderObjectManagerPtr->GetTreeRoot()->AddPanel(Width, Height, BS_ARGB(0, 0, 0, 0)); - if (!m_MainPanelPtr.IsValid()) return false; - m_MainPanelPtr->SetVisible(true); + m_MainPanelPtr = _renderObjectManagerPtr->getTreeRoot()->addPanel(Width, Height, BS_ARGB(0, 0, 0, 0)); + if (!m_MainPanelPtr.isValid()) return false; + m_MainPanelPtr->setVisible(true); return true; } @@ -145,7 +145,7 @@ bool OpenGLGfx::StartFrame(bool UpdateAll) { UpdateLastFrameDuration(); // Den Layer-Manager auf den nächsten Frame vorbereiten - m_RenderObjectManagerPtr->StartFrame(); + _renderObjectManagerPtr->startFrame(); return true; } @@ -154,7 +154,7 @@ bool OpenGLGfx::StartFrame(bool UpdateAll) { bool OpenGLGfx::EndFrame() { // Scene zeichnen - m_RenderObjectManagerPtr->Render(); + _renderObjectManagerPtr->render(); g_system->updateScreen(); @@ -212,7 +212,7 @@ bool OpenGLGfx::GetVsync() const { // ----------------------------------------------------------------------------- -bool OpenGLGfx::Fill(const Common::Rect *fillRectPtr, uint color) { +bool OpenGLGfx::fill(const Common::Rect *fillRectPtr, uint color) { Common::Rect rect(m_Width - 1, m_Height - 1); if (fillRectPtr) { @@ -297,7 +297,7 @@ Resource *OpenGLGfx::LoadResource(const Common::String &FileName) { } BitmapResource *pResource = new BitmapResource(FileName, pImage); - if (!pResource->IsValid()) { + if (!pResource->isValid()) { delete pResource; return 0; } @@ -315,7 +315,7 @@ Resource *OpenGLGfx::LoadResource(const Common::String &FileName) { } BitmapResource *pResource = new BitmapResource(FileName, pImage); - if (!pResource->IsValid()) { + if (!pResource->isValid()) { delete pResource; return 0; } @@ -347,20 +347,20 @@ Resource *OpenGLGfx::LoadResource(const Common::String &FileName) { } BitmapResource *pResource = new BitmapResource(FileName, pImage); - if (!pResource->IsValid()) { + if (!pResource->isValid()) { delete pResource; - delete [] pFileData; + delete[] pFileData; return 0; } - delete [] pFileData; + delete[] pFileData; return pResource; } // Animation laden if (FileName.hasSuffix(ANI_EXTENSION)) { AnimationResource *pResource = new AnimationResource(FileName); - if (pResource->IsValid()) + if (pResource->isValid()) return pResource; else { delete pResource; @@ -406,24 +406,24 @@ void OpenGLGfx::DrawDebugLine(const Vertex &Start, const Vertex &End, uint Color // PERSISTENZ // ----------------------------------------------------------------------------- -bool OpenGLGfx::Persist(OutputPersistenceBlock &Writer) { +bool OpenGLGfx::persist(OutputPersistenceBlock &writer) { bool result = true; - result &= GraphicEngine::Persist(Writer); - result &= m_RenderObjectManagerPtr->Persist(Writer); + result &= GraphicEngine::persist(writer); + result &= _renderObjectManagerPtr->persist(writer); return result; } // ----------------------------------------------------------------------------- -bool OpenGLGfx::Unpersist(InputPersistenceBlock &Reader) { +bool OpenGLGfx::unpersist(InputPersistenceBlock &reader) { bool result = true; - result &= GraphicEngine::Unpersist(Reader); - result &= m_RenderObjectManagerPtr->Unpersist(Reader); + result &= GraphicEngine::unpersist(reader); + result &= _renderObjectManagerPtr->unpersist(reader); - return result && Reader.IsGood(); + return result && reader.isGood(); } } // End of namespace Sword25 diff --git a/engines/sword25/gfx/opengl/openglgfx.h b/engines/sword25/gfx/opengl/openglgfx.h index b3416185a0..e8f312ad28 100644 --- a/engines/sword25/gfx/opengl/openglgfx.h +++ b/engines/sword25/gfx/opengl/openglgfx.h @@ -77,7 +77,7 @@ public: virtual void SetVsync(bool Vsync); virtual bool GetVsync() const; - virtual bool Fill(const Common::Rect *FillRectPtr = 0, uint Color = BS_RGB(0, 0, 0)); + virtual bool fill(const Common::Rect *FillRectPtr = 0, uint Color = BS_RGB(0, 0, 0)); virtual bool GetScreenshot(uint &Width, uint &Height, byte **Data); // Resource-Managing Methoden @@ -91,8 +91,8 @@ public: // Persistenz Methoden // ------------------- - virtual bool Persist(OutputPersistenceBlock &Writer); - virtual bool Unpersist(InputPersistenceBlock &Reader); + virtual bool persist(OutputPersistenceBlock &writer); + virtual bool unpersist(InputPersistenceBlock &reader); private: bool m_GLspritesInitialized; @@ -100,7 +100,7 @@ private: RenderObjectPtr m_MainPanelPtr; - Common::ScopedPtr m_RenderObjectManagerPtr; + Common::ScopedPtr _renderObjectManagerPtr; struct DebugLine { DebugLine(const Vertex &_Start, const Vertex &_End, uint _Color) : diff --git a/engines/sword25/gfx/opengl/swimage.cpp b/engines/sword25/gfx/opengl/swimage.cpp index 2ea6c72c27..33d7435e02 100644 --- a/engines/sword25/gfx/opengl/swimage.cpp +++ b/engines/sword25/gfx/opengl/swimage.cpp @@ -50,34 +50,34 @@ namespace Sword25 { // CONSTRUCTION / DESTRUCTION // ----------------------------------------------------------------------------- -SWImage::SWImage(const Common::String &Filename, bool &Result) : - _ImageDataPtr(0), - m_Width(0), - m_Height(0) { - Result = false; +SWImage::SWImage(const Common::String &filename, bool &result) : + _imageDataPtr(0), + _width(0), + _height(0) { + result = false; PackageManager *pPackage = static_cast(Kernel::GetInstance()->GetService("package")); BS_ASSERT(pPackage); // Datei laden byte *pFileData; - uint FileSize; - if (!(pFileData = (byte *) pPackage->GetFile(Filename, &FileSize))) { - BS_LOG_ERRORLN("File \"%s\" could not be loaded.", Filename.c_str()); + uint fileSize; + if (!(pFileData = (byte *)pPackage->GetFile(filename, &fileSize))) { + BS_LOG_ERRORLN("File \"%s\" could not be loaded.", filename.c_str()); return; } // Bildeigenschaften bestimmen - GraphicEngine::COLOR_FORMATS ColorFormat; - int Pitch; - if (!ImageLoader::ExtractImageProperties(pFileData, FileSize, ColorFormat, m_Width, m_Height)) { + GraphicEngine::COLOR_FORMATS colorFormat; + int pitch; + if (!ImageLoader::ExtractImageProperties(pFileData, fileSize, colorFormat, _width, _height)) { BS_LOG_ERRORLN("Could not read image properties."); return; } // Das Bild dekomprimieren byte *pUncompressedData; - if (!ImageLoader::LoadImage(pFileData, FileSize, GraphicEngine::CF_ABGR32, pUncompressedData, m_Width, m_Height, Pitch)) { + if (!ImageLoader::LoadImage(pFileData, fileSize, GraphicEngine::CF_ABGR32, pUncompressedData, _width, _height, pitch)) { BS_LOG_ERRORLN("Could not decode image."); return; } @@ -85,51 +85,51 @@ SWImage::SWImage(const Common::String &Filename, bool &Result) : // Dateidaten freigeben delete[] pFileData; - _ImageDataPtr = (uint *) pUncompressedData; + _imageDataPtr = (uint *)pUncompressedData; - Result = true; + result = true; return; } // ----------------------------------------------------------------------------- SWImage::~SWImage() { - delete [] _ImageDataPtr; + delete[] _imageDataPtr; } // ----------------------------------------------------------------------------- -bool SWImage::Blit(int PosX, int PosY, - int Flipping, +bool SWImage::blit(int posX, int posY, + int flipping, Common::Rect *pPartRect, - uint Color, - int Width, int Height) { + uint color, + int width, int height) { BS_LOG_ERRORLN("Blit() is not supported."); return false; } // ----------------------------------------------------------------------------- -bool SWImage::Fill(const Common::Rect *pFillRect, uint Color) { +bool SWImage::fill(const Common::Rect *pFillRect, uint color) { BS_LOG_ERRORLN("Fill() is not supported."); return false; } // ----------------------------------------------------------------------------- - bool SWImage::SetContent(const byte *Pixeldata, uint size, uint Offset, uint Stride) { +bool SWImage::setContent(const byte *pixeldata, uint size, uint offset, uint stride) { BS_LOG_ERRORLN("SetContent() is not supported."); return false; } // ----------------------------------------------------------------------------- -uint SWImage::GetPixel(int X, int Y) { - BS_ASSERT(X >= 0 && X < m_Width); - BS_ASSERT(Y >= 0 && Y < m_Height); +uint SWImage::getPixel(int x, int y) { + BS_ASSERT(x >= 0 && x < _width); + BS_ASSERT(y >= 0 && y < _height); - return _ImageDataPtr[m_Width * Y + X]; + return _imageDataPtr[_width * y + x]; } } // End of namespace Sword25 diff --git a/engines/sword25/gfx/opengl/swimage.h b/engines/sword25/gfx/opengl/swimage.h index eaf8a6cb61..caf6bdcc71 100644 --- a/engines/sword25/gfx/opengl/swimage.h +++ b/engines/sword25/gfx/opengl/swimage.h @@ -52,54 +52,54 @@ namespace Sword25 { class SWImage : public Image { public: - SWImage(const Common::String &Filename, bool &Result); + SWImage(const Common::String &filename, bool &result); virtual ~SWImage(); - virtual int GetWidth() const { - return m_Width; + virtual int getWidth() const { + return _width; } - virtual int GetHeight() const { - return m_Height; + virtual int getHeight() const { + return _height; } - virtual GraphicEngine::COLOR_FORMATS GetColorFormat() const { + virtual GraphicEngine::COLOR_FORMATS getColorFormat() const { return GraphicEngine::CF_ARGB32; } - virtual bool Blit(int PosX = 0, int PosY = 0, - int Flipping = Image::FLIP_NONE, + virtual bool blit(int posX = 0, int posY = 0, + int flipping = Image::FLIP_NONE, Common::Rect *pPartRect = NULL, - uint Color = BS_ARGB(255, 255, 255, 255), - int Width = -1, int Height = -1); - virtual bool Fill(const Common::Rect *FillRectPtr, uint Color); - virtual bool SetContent(const byte *Pixeldata, uint size, uint Offset, uint Stride); - virtual uint GetPixel(int X, int Y); + uint color = BS_ARGB(255, 255, 255, 255), + int width = -1, int height = -1); + virtual bool fill(const Common::Rect *fillRectPtr, uint color); + virtual bool setContent(const byte *pixeldata, uint size, uint offset, uint stride); + virtual uint getPixel(int x, int y); - virtual bool IsBlitSource() const { + virtual bool isBlitSource() const { return false; } - virtual bool IsBlitTarget() const { + virtual bool isBlitTarget() const { return false; } - virtual bool IsScalingAllowed() const { + virtual bool isScalingAllowed() const { return false; } - virtual bool IsFillingAllowed() const { + virtual bool isFillingAllowed() const { return false; } - virtual bool IsAlphaAllowed() const { + virtual bool isAlphaAllowed() const { return false; } - virtual bool IsColorModulationAllowed() const { + virtual bool isColorModulationAllowed() const { return false; } - virtual bool IsSetContentAllowed() const { + virtual bool isSetContentAllowed() const { return false; } private: - uint *_ImageDataPtr; + uint *_imageDataPtr; - int m_Width; - int m_Height; + int _width; + int _height; }; } // End of namespace Sword25 diff --git a/engines/sword25/gfx/panel.cpp b/engines/sword25/gfx/panel.cpp index c78bd7c30c..3aa0516835 100644 --- a/engines/sword25/gfx/panel.cpp +++ b/engines/sword25/gfx/panel.cpp @@ -53,32 +53,32 @@ namespace Sword25 { // Construction/Destruction // ----------------------------------------------------------------------------- -Panel::Panel(RenderObjectPtr ParentPtr, int Width, int Height, uint Color) : - RenderObject(ParentPtr, RenderObject::TYPE_PANEL), - m_Color(Color) { - m_InitSuccess = false; +Panel::Panel(RenderObjectPtr parentPtr, int width, int height, uint color) : + RenderObject(parentPtr, RenderObject::TYPE_PANEL), + _color(color) { + _initSuccess = false; - m_Width = Width; - m_Height = Height; + _width = width; + _height = height; - if (m_Width < 0) { - BS_LOG_ERRORLN("Tried to initialise a panel with an invalid width (%d).", m_Width); + if (_width < 0) { + BS_LOG_ERRORLN("Tried to initialise a panel with an invalid width (%d).", _width); return; } - if (m_Height < 0) { - BS_LOG_ERRORLN("Tried to initialise a panel with an invalid height (%d).", m_Height); + if (_height < 0) { + BS_LOG_ERRORLN("Tried to initialise a panel with an invalid height (%d).", _height); return; } - m_InitSuccess = true; + _initSuccess = true; } // ----------------------------------------------------------------------------- -Panel::Panel(InputPersistenceBlock &Reader, RenderObjectPtr ParentPtr, uint Handle) : - RenderObject(ParentPtr, RenderObject::TYPE_PANEL, Handle) { - m_InitSuccess = Unpersist(Reader); +Panel::Panel(InputPersistenceBlock &reader, RenderObjectPtr parentPtr, uint handle) : + RenderObject(parentPtr, RenderObject::TYPE_PANEL, handle) { + _initSuccess = unpersist(reader); } // ----------------------------------------------------------------------------- @@ -90,45 +90,46 @@ Panel::~Panel() { // Rendern // ----------------------------------------------------------------------------- -bool Panel::DoRender() { +bool Panel::doRender() { // Falls der Alphawert 0 ist, ist das Panel komplett durchsichtig und es muss nichts gezeichnet werden. - if (m_Color >> 24 == 0) return true; + if (_color >> 24 == 0) + return true; - GraphicEngine *GfxPtr = static_cast(Kernel::GetInstance()->GetService("gfx")); - BS_ASSERT(GfxPtr); + GraphicEngine *gfxPtr = static_cast(Kernel::GetInstance()->GetService("gfx")); + BS_ASSERT(gfxPtr); - return GfxPtr->Fill(&m_BBox, m_Color); + return gfxPtr->fill(&_bbox, _color); } // ----------------------------------------------------------------------------- // Persistenz // ----------------------------------------------------------------------------- -bool Panel::Persist(OutputPersistenceBlock &Writer) { - bool Result = true; +bool Panel::persist(OutputPersistenceBlock &writer) { + bool result = true; - Result &= RenderObject::Persist(Writer); - Writer.Write(m_Color); + result &= RenderObject::persist(writer); + writer.write(_color); - Result &= RenderObject::PersistChildren(Writer); + result &= RenderObject::persistChildren(writer); - return Result; + return result; } // ----------------------------------------------------------------------------- -bool Panel::Unpersist(InputPersistenceBlock &Reader) { - bool Result = true; +bool Panel::unpersist(InputPersistenceBlock &reader) { + bool result = true; - Result &= RenderObject::Unpersist(Reader); + result &= RenderObject::unpersist(reader); - uint Color; - Reader.Read(Color); - SetColor(Color); + uint color; + reader.read(color); + setColor(color); - Result &= RenderObject::UnpersistChildren(Reader); + result &= RenderObject::unpersistChildren(reader); - return Reader.IsGood() && Result; + return reader.isGood() && result; } } // End of namespace Sword25 diff --git a/engines/sword25/gfx/panel.h b/engines/sword25/gfx/panel.h index 4201b3c11b..5fbcec5f34 100644 --- a/engines/sword25/gfx/panel.h +++ b/engines/sword25/gfx/panel.h @@ -52,28 +52,28 @@ class Panel : public RenderObject { friend class RenderObject; private: - Panel(RenderObjectPtr ParentPtr, int Width, int Height, uint Color); - Panel(InputPersistenceBlock &Reader, RenderObjectPtr ParentPtr, uint Handle); + Panel(RenderObjectPtr parentPtr, int width, int height, uint color); + Panel(InputPersistenceBlock &reader, RenderObjectPtr parentPtr, uint handle); public: virtual ~Panel(); - uint GetColor() const { - return m_Color; + uint getColor() const { + return _color; } - void SetColor(uint Color) { - m_Color = Color; - ForceRefresh(); + void setColor(uint color) { + _color = color; + forceRefresh(); } - virtual bool Persist(OutputPersistenceBlock &Writer); - virtual bool Unpersist(InputPersistenceBlock &Reader); + virtual bool persist(OutputPersistenceBlock &writer); + virtual bool unpersist(InputPersistenceBlock &reader); protected: - virtual bool DoRender(); + virtual bool doRender(); private: - uint m_Color; + uint _color; }; } // End of namespace Sword25 diff --git a/engines/sword25/gfx/renderobject.cpp b/engines/sword25/gfx/renderobject.cpp index d9d2bc396a..a130dc533a 100644 --- a/engines/sword25/gfx/renderobject.cpp +++ b/engines/sword25/gfx/renderobject.cpp @@ -55,56 +55,59 @@ namespace Sword25 { // Konstruktion / Destruktion // -------------------------- -RenderObject::RenderObject(RenderObjectPtr ParentPtr, TYPES Type, uint Handle) : - m_ManagerPtr(0), - m_ParentPtr(ParentPtr), - m_X(0), - m_Y(0), - m_Z(0), - m_OldX(-1), - m_OldY(-1), - m_OldZ(-1), - m_Width(0), - m_Height(0), - m_Visible(true), - m_OldVisible(false), - m_ChildChanged(true), - m_Type(Type), - m_InitSuccess(false), - m_RefreshForced(true), - m_Handle(0) { +RenderObject::RenderObject(RenderObjectPtr parentPtr, TYPES type, uint handle) : + _managerPtr(0), + _parentPtr(parentPtr), + _x(0), + _y(0), + _z(0), + _oldX(-1), + _oldY(-1), + _oldZ(-1), + _width(0), + _height(0), + _visible(true), + _oldVisible(false), + _childChanged(true), + _type(type), + _initSuccess(false), + _refreshForced(true), + _handle(0) { // Renderobject registrieren, abhängig vom Handle-Parameter entweder mit beliebigem oder vorgegebenen Handle. - if (Handle == 0) - m_Handle = RenderObjectRegistry::GetInstance().RegisterObject(this); + if (handle == 0) + _handle = RenderObjectRegistry::GetInstance().RegisterObject(this); else - m_Handle = RenderObjectRegistry::GetInstance().RegisterObject(this, Handle); - if (m_Handle == 0) return; + _handle = RenderObjectRegistry::GetInstance().RegisterObject(this, handle); - UpdateAbsolutePos(); + if (_handle == 0) + return; + + updateAbsolutePos(); // Dieses Objekt zu den Kindern der Elternobjektes hinzufügen, falls nicht Wurzel (ParentPtr ungültig) und dem // selben RenderObjektManager zuweisen. - if (m_ParentPtr.IsValid()) { - m_ManagerPtr = m_ParentPtr->GetManager(); - m_ParentPtr->AddObject(this->GetHandle()); + if (_parentPtr.isValid()) { + _managerPtr = _parentPtr->getManager(); + _parentPtr->addObject(this->getHandle()); } else { - if (GetType() != TYPE_ROOT) { + if (getType() != TYPE_ROOT) { BS_LOG_ERRORLN("Tried to create a non-root render object and has no parent. All non-root render objects have to have a parent."); return; } } - UpdateObjectState(); + updateObjectState(); - m_InitSuccess = true; + _initSuccess = true; } RenderObject::~RenderObject() { // Objekt aus dem Elternobjekt entfernen. - if (m_ParentPtr.IsValid()) m_ParentPtr->DetatchChildren(this->GetHandle()); + if (_parentPtr.isValid()) + _parentPtr->detatchChildren(this->getHandle()); - DeleteAllChildren(); + deleteAllChildren(); // Objekt deregistrieren. RenderObjectRegistry::GetInstance().DeregisterObject(this); @@ -112,26 +115,27 @@ RenderObject::~RenderObject() { // Rendern // ------- -bool RenderObject::Render() { +bool RenderObject::render() { // Objektänderungen validieren - ValidateObject(); + validateObject(); // Falls das Objekt nicht sichtbar ist, muss gar nichts gezeichnet werden - if (!m_Visible) return true; + if (!_visible) + return true; // Falls notwendig, wird die Renderreihenfolge der Kinderobjekte aktualisiert. - if (m_ChildChanged) { - SortRenderObjects(); - m_ChildChanged = false; + if (_childChanged) { + sortRenderObjects(); + _childChanged = false; } // Objekt zeichnen. - DoRender(); + doRender(); // Dann müssen die Kinder gezeichnet werden - RENDEROBJECT_ITER it = m_Children.begin(); - for (; it != m_Children.end(); ++it) - if (!(*it)->Render()) + RENDEROBJECT_ITER it = _children.begin(); + for (; it != _children.end(); ++it) + if (!(*it)->render()) return false; return true; @@ -140,115 +144,118 @@ bool RenderObject::Render() { // Objektverwaltung // ---------------- -void RenderObject::ValidateObject() { +void RenderObject::validateObject() { // Die Veränderungen in den Objektvariablen aufheben - m_OldBBox = m_BBox; - m_OldVisible = m_Visible; - m_OldX = m_X; - m_OldY = m_Y; - m_OldZ = m_Z; - m_RefreshForced = false; + _oldBbox = _bbox; + _oldVisible = _visible; + _oldX = _x; + _oldY = _y; + _oldZ = _z; + _refreshForced = false; } -bool RenderObject::UpdateObjectState() { +bool RenderObject::updateObjectState() { // Falls sich das Objekt verändert hat, muss der interne Zustand neu berechnet werden und evtl. Update-Regions für den nächsten Frame // registriert werden. - if ((CalcBoundingBox() != m_OldBBox) || - (m_Visible != m_OldVisible) || - (m_X != m_OldX) || - (m_Y != m_OldY) || - (m_Z != m_OldZ) || - m_RefreshForced) { + if ((calcBoundingBox() != _oldBbox) || + (_visible != _oldVisible) || + (_x != _oldX) || + (_y != _oldY) || + (_z != _oldZ) || + _refreshForced) { // Renderrang des Objektes neu bestimmen, da sich dieser verändert haben könnte - if (m_ParentPtr.IsValid()) m_ParentPtr->SignalChildChange(); + if (_parentPtr.isValid()) + _parentPtr->signalChildChange(); // Die Bounding-Box neu berechnen und Update-Regions registrieren. - UpdateBoxes(); + updateBoxes(); // Änderungen Validieren - ValidateObject(); + validateObject(); } // Dann muss der Objektstatus der Kinder aktualisiert werden. - RENDEROBJECT_ITER it = m_Children.begin(); - for (; it != m_Children.end(); ++it) - if (!(*it)->UpdateObjectState()) return false; + RENDEROBJECT_ITER it = _children.begin(); + for (; it != _children.end(); ++it) + if (!(*it)->updateObjectState()) + return false; return true; } -void RenderObject::UpdateBoxes() { +void RenderObject::updateBoxes() { // Bounding-Box aktualisieren - m_BBox = CalcBoundingBox(); + _bbox = calcBoundingBox(); } -Common::Rect RenderObject::CalcBoundingBox() const { +Common::Rect RenderObject::calcBoundingBox() const { // Die Bounding-Box mit der Objektgröße initialisieren. - Common::Rect BBox(0, 0, m_Width, m_Height); + Common::Rect bbox(0, 0, _width, _height); // Die absolute Position der Bounding-Box berechnen. - BBox.translate(m_AbsoluteX, m_AbsoluteY); + bbox.translate(_absoluteX, _absoluteY); // Die Bounding-Box am Elternobjekt clippen. - if (m_ParentPtr.IsValid()) { - BBox.clip(m_ParentPtr->GetBBox()); + if (_parentPtr.isValid()) { + bbox.clip(_parentPtr->getBbox()); } - return BBox; + return bbox; } -void RenderObject::CalcAbsolutePos(int &X, int &Y) const { - X = CalcAbsoluteX(); - Y = CalcAbsoluteY(); +void RenderObject::calcAbsolutePos(int &x, int &y) const { + x = calcAbsoluteX(); + y = calcAbsoluteY(); } -int RenderObject::CalcAbsoluteX() const { - if (m_ParentPtr.IsValid()) - return m_ParentPtr->GetAbsoluteX() + m_X; +int RenderObject::calcAbsoluteX() const { + if (_parentPtr.isValid()) + return _parentPtr->getAbsoluteX() + _x; else - return m_X; + return _x; } -int RenderObject::CalcAbsoluteY() const { - if (m_ParentPtr.IsValid()) - return m_ParentPtr->GetAbsoluteY() + m_Y; +int RenderObject::calcAbsoluteY() const { + if (_parentPtr.isValid()) + return _parentPtr->getAbsoluteY() + _y; else - return m_Y; + return _y; } // Baumverwaltung // -------------- -void RenderObject::DeleteAllChildren() { +void RenderObject::deleteAllChildren() { // Es ist nicht notwendig die Liste zu iterieren, da jedes Kind für sich DetatchChildren an diesem Objekt aufruft und sich somit // selber entfernt. Daher muss immer nur ein beliebiges Element (hier das letzte) gelöscht werden, bis die Liste leer ist. - while (!m_Children.empty()) { - RenderObjectPtr CurPtr = m_Children.back(); - CurPtr.Erase(); + while (!_children.empty()) { + RenderObjectPtr curPtr = _children.back(); + curPtr.erase(); } } -bool RenderObject::AddObject(RenderObjectPtr pObject) { - if (!pObject.IsValid()) { +bool RenderObject::addObject(RenderObjectPtr pObject) { + if (!pObject.isValid()) { BS_LOG_ERRORLN("Tried to add a null object to a renderobject."); return false; } // Objekt in die Kinderliste einfügen. - m_Children.push_back(pObject); + _children.push_back(pObject); // Sicherstellen, dass vor dem nächsten Rendern die Renderreihenfolge aktualisiert wird. - if (m_ParentPtr.IsValid()) m_ParentPtr->SignalChildChange(); + if (_parentPtr.isValid()) + _parentPtr->signalChildChange(); return true; } -bool RenderObject::DetatchChildren(RenderObjectPtr pObject) { +bool RenderObject::detatchChildren(RenderObjectPtr pObject) { // Kinderliste durchgehen und Objekt entfernen falls vorhanden - RENDEROBJECT_ITER it = m_Children.begin(); - for (; it != m_Children.end(); ++it) + RENDEROBJECT_ITER it = _children.begin(); + for (; it != _children.end(); ++it) if (*it == pObject) { - m_Children.erase(it); + _children.erase(it); return true; } @@ -256,66 +263,67 @@ bool RenderObject::DetatchChildren(RenderObjectPtr pObject) { return false; } -void RenderObject::SortRenderObjects() { - Common::sort(m_Children.begin(), m_Children.end(), Greater); +void RenderObject::sortRenderObjects() { + Common::sort(_children.begin(), _children.end(), greater); } -void RenderObject::UpdateAbsolutePos() { - CalcAbsolutePos(m_AbsoluteX, m_AbsoluteY); +void RenderObject::updateAbsolutePos() { + calcAbsolutePos(_absoluteX, _absoluteY); - RENDEROBJECT_ITER it = m_Children.begin(); - for (; it != m_Children.end(); ++it) - (*it)->UpdateAbsolutePos(); + RENDEROBJECT_ITER it = _children.begin(); + for (; it != _children.end(); ++it) + (*it)->updateAbsolutePos(); } // Get-Methoden // ------------ -bool RenderObject::GetObjectIntersection(RenderObjectPtr pObject, Common::Rect &Result) { - Result = pObject->GetBBox(); - Result.clip(m_BBox); - return Result.isValidRect(); +bool RenderObject::getObjectIntersection(RenderObjectPtr pObject, Common::Rect &result) { + result = pObject->getBbox(); + result.clip(_bbox); + return result.isValidRect(); } // Set-Methoden // ------------ -void RenderObject::SetPos(int X, int Y) { - m_X = X; - m_Y = Y; - UpdateAbsolutePos(); +void RenderObject::setPos(int x, int y) { + _x = x; + _y = y; + updateAbsolutePos(); } -void RenderObject::SetX(int X) { - m_X = X; - UpdateAbsolutePos(); +void RenderObject::setX(int x) { + _x = x; + updateAbsolutePos(); } -void RenderObject::SetY(int Y) { - m_Y = Y; - UpdateAbsolutePos(); +void RenderObject::setY(int y) { + _y = y; + updateAbsolutePos(); } -void RenderObject::SetZ(int Z) { - if (Z < 0) - BS_LOG_ERRORLN("Tried to set a negative Z value (%d).", Z); +void RenderObject::setZ(int z) { + if (z < 0) + BS_LOG_ERRORLN("Tried to set a negative Z value (%d).", z); else - m_Z = Z; + _z = z; } -void RenderObject::SetVisible(bool Visible) { - m_Visible = Visible; +void RenderObject::setVisible(bool visible) { + _visible = visible; } // ----------------------------------------------------------------------------- // Objekterzeuger // ----------------------------------------------------------------------------- -RenderObjectPtr RenderObject::AddAnimation(const Common::String &Filename) { - RenderObjectPtr AniPtr((new Animation(this->GetHandle(), Filename))->GetHandle()); - if (AniPtr.IsValid() && AniPtr->GetInitSuccess()) - return AniPtr; +RenderObjectPtr RenderObject::addAnimation(const Common::String &filename) { + RenderObjectPtr aniPtr((new Animation(this->getHandle(), filename))->getHandle()); + if (aniPtr.isValid() && aniPtr->getInitSuccess()) + return aniPtr; else { - if (AniPtr.IsValid()) AniPtr.Erase(); + if (aniPtr.isValid()) + aniPtr.erase(); return RenderObjectPtr(); } } @@ -323,61 +331,65 @@ RenderObjectPtr RenderObject::AddAnimation(const Common::String &File // ----------------------------------------------------------------------------- -RenderObjectPtr RenderObject::AddAnimation(const AnimationTemplate &AnimationTemplate) { - Animation *AniPtr = new Animation(this->GetHandle(), AnimationTemplate); - if (AniPtr && AniPtr->GetInitSuccess()) - return AniPtr->GetHandle(); +RenderObjectPtr RenderObject::addAnimation(const AnimationTemplate &animationTemplate) { + Animation *aniPtr = new Animation(this->getHandle(), animationTemplate); + if (aniPtr && aniPtr->getInitSuccess()) + return aniPtr->getHandle(); else { - delete AniPtr; + delete aniPtr; return RenderObjectPtr(); } } // ----------------------------------------------------------------------------- -RenderObjectPtr RenderObject::AddBitmap(const Common::String &Filename) { - RenderObjectPtr BitmapPtr((new StaticBitmap(this->GetHandle(), Filename))->GetHandle()); - if (BitmapPtr.IsValid() && BitmapPtr->GetInitSuccess()) - return RenderObjectPtr(BitmapPtr); +RenderObjectPtr RenderObject::addBitmap(const Common::String &filename) { + RenderObjectPtr bitmapPtr((new StaticBitmap(this->getHandle(), filename))->getHandle()); + if (bitmapPtr.isValid() && bitmapPtr->getInitSuccess()) + return RenderObjectPtr(bitmapPtr); else { - if (BitmapPtr.IsValid()) BitmapPtr.Erase(); + if (bitmapPtr.isValid()) + bitmapPtr.erase(); return RenderObjectPtr(); } } // ----------------------------------------------------------------------------- -RenderObjectPtr RenderObject::AddDynamicBitmap(uint Width, uint Height) { - RenderObjectPtr BitmapPtr((new DynamicBitmap(this->GetHandle(), Width, Height))->GetHandle()); - if (BitmapPtr.IsValid() && BitmapPtr->GetInitSuccess()) - return BitmapPtr; +RenderObjectPtr RenderObject::addDynamicBitmap(uint width, uint height) { + RenderObjectPtr bitmapPtr((new DynamicBitmap(this->getHandle(), width, height))->getHandle()); + if (bitmapPtr.isValid() && bitmapPtr->getInitSuccess()) + return bitmapPtr; else { - if (BitmapPtr.IsValid()) BitmapPtr.Erase(); + if (bitmapPtr.isValid()) + bitmapPtr.erase(); return RenderObjectPtr(); } } // ----------------------------------------------------------------------------- -RenderObjectPtr RenderObject::AddPanel(int Width, int Height, uint Color) { - RenderObjectPtr PanelPtr((new Panel(this->GetHandle(), Width, Height, Color))->GetHandle()); - if (PanelPtr.IsValid() && PanelPtr->GetInitSuccess()) - return PanelPtr; +RenderObjectPtr RenderObject::addPanel(int width, int height, uint color) { + RenderObjectPtr panelPtr((new Panel(this->getHandle(), width, height, color))->getHandle()); + if (panelPtr.isValid() && panelPtr->getInitSuccess()) + return panelPtr; else { - if (PanelPtr.IsValid()) PanelPtr.Erase(); + if (panelPtr.isValid()) + panelPtr.erase(); return RenderObjectPtr(); } } // ----------------------------------------------------------------------------- -RenderObjectPtr RenderObject::AddText(const Common::String &Font, const Common::String &text) { - RenderObjectPtr TextPtr((new Text(this->GetHandle()))->GetHandle()); - if (TextPtr.IsValid() && TextPtr->GetInitSuccess() && TextPtr->SetFont(Font)) { - TextPtr->SetText(text); - return TextPtr; +RenderObjectPtr RenderObject::addText(const Common::String &font, const Common::String &text) { + RenderObjectPtr textPtr((new Text(this->getHandle()))->getHandle()); + if (textPtr.isValid() && textPtr->getInitSuccess() && textPtr->SetFont(font)) { + textPtr->SetText(text); + return textPtr; } else { - if (TextPtr.IsValid()) TextPtr.Erase(); + if (textPtr.isValid()) + textPtr.erase(); return RenderObjectPtr(); } } @@ -385,161 +397,164 @@ RenderObjectPtr RenderObject::AddText(const Common::String &Font, const Co // Persistenz-Methoden // ------------------- -bool RenderObject::Persist(OutputPersistenceBlock &Writer) { +bool RenderObject::persist(OutputPersistenceBlock &writer) { // Typ und Handle werden als erstes gespeichert, damit beim Laden ein Objekt vom richtigen Typ mit dem richtigen Handle erzeugt werden kann. - Writer.Write(static_cast(m_Type)); - Writer.Write(m_Handle); + writer.write(static_cast(_type)); + writer.write(_handle); // Restliche Objekteigenschaften speichern. - Writer.Write(m_X); - Writer.Write(m_Y); - Writer.Write(m_AbsoluteX); - Writer.Write(m_AbsoluteY); - Writer.Write(m_Z); - Writer.Write(m_Width); - Writer.Write(m_Height); - Writer.Write(m_Visible); - Writer.Write(m_ChildChanged); - Writer.Write(m_InitSuccess); - Writer.Write(m_BBox.left); - Writer.Write(m_BBox.top); - Writer.Write(m_BBox.right); - Writer.Write(m_BBox.bottom); - Writer.Write(m_OldBBox.left); - Writer.Write(m_OldBBox.top); - Writer.Write(m_OldBBox.right); - Writer.Write(m_OldBBox.bottom); - Writer.Write(m_OldX); - Writer.Write(m_OldY); - Writer.Write(m_OldZ); - Writer.Write(m_OldVisible); - Writer.Write(m_ParentPtr.IsValid() ? m_ParentPtr->GetHandle() : 0); - Writer.Write(m_RefreshForced); + writer.write(_x); + writer.write(_y); + writer.write(_absoluteX); + writer.write(_absoluteY); + writer.write(_z); + writer.write(_width); + writer.write(_height); + writer.write(_visible); + writer.write(_childChanged); + writer.write(_initSuccess); + writer.write(_bbox.left); + writer.write(_bbox.top); + writer.write(_bbox.right); + writer.write(_bbox.bottom); + writer.write(_oldBbox.left); + writer.write(_oldBbox.top); + writer.write(_oldBbox.right); + writer.write(_oldBbox.bottom); + writer.write(_oldX); + writer.write(_oldY); + writer.write(_oldZ); + writer.write(_oldVisible); + writer.write(_parentPtr.isValid() ? _parentPtr->getHandle() : 0); + writer.write(_refreshForced); return true; } // ----------------------------------------------------------------------------- -bool RenderObject::Unpersist(InputPersistenceBlock &Reader) { +bool RenderObject::unpersist(InputPersistenceBlock &reader) { // Typ und Handle wurden schon von RecreatePersistedRenderObject() ausgelesen. Jetzt werden die restlichen Objekteigenschaften ausgelesen. - Reader.Read(m_X); - Reader.Read(m_Y); - Reader.Read(m_AbsoluteX); - Reader.Read(m_AbsoluteY); - Reader.Read(m_Z); - Reader.Read(m_Width); - Reader.Read(m_Height); - Reader.Read(m_Visible); - Reader.Read(m_ChildChanged); - Reader.Read(m_InitSuccess); - Reader.Read(m_BBox.left); - Reader.Read(m_BBox.top); - Reader.Read(m_BBox.right); - Reader.Read(m_BBox.bottom); - Reader.Read(m_OldBBox.left); - Reader.Read(m_OldBBox.top); - Reader.Read(m_OldBBox.right); - Reader.Read(m_OldBBox.bottom); - Reader.Read(m_OldX); - Reader.Read(m_OldY); - Reader.Read(m_OldZ); - Reader.Read(m_OldVisible); - uint ParentHandle; - Reader.Read(ParentHandle); - m_ParentPtr = RenderObjectPtr(ParentHandle); - Reader.Read(m_RefreshForced); - - UpdateAbsolutePos(); - UpdateObjectState(); - - return Reader.IsGood(); + reader.read(_x); + reader.read(_y); + reader.read(_absoluteX); + reader.read(_absoluteY); + reader.read(_z); + reader.read(_width); + reader.read(_height); + reader.read(_visible); + reader.read(_childChanged); + reader.read(_initSuccess); + reader.read(_bbox.left); + reader.read(_bbox.top); + reader.read(_bbox.right); + reader.read(_bbox.bottom); + reader.read(_oldBbox.left); + reader.read(_oldBbox.top); + reader.read(_oldBbox.right); + reader.read(_oldBbox.bottom); + reader.read(_oldX); + reader.read(_oldY); + reader.read(_oldZ); + reader.read(_oldVisible); + uint parentHandle; + reader.read(parentHandle); + _parentPtr = RenderObjectPtr(parentHandle); + reader.read(_refreshForced); + + updateAbsolutePos(); + updateObjectState(); + + return reader.isGood(); } // ----------------------------------------------------------------------------- -bool RenderObject::PersistChildren(OutputPersistenceBlock &Writer) { - bool Result = true; +bool RenderObject::persistChildren(OutputPersistenceBlock &writer) { + bool result = true; // Kinderanzahl speichern. - Writer.Write(m_Children.size()); + writer.write(_children.size()); // Rekursiv alle Kinder speichern. - RENDEROBJECT_LIST::iterator It = m_Children.begin(); - while (It != m_Children.end()) { - Result &= (*It)->Persist(Writer); - ++It; + RENDEROBJECT_LIST::iterator it = _children.begin(); + while (it != _children.end()) { + result &= (*it)->persist(writer); + ++it; } - return Result; + return result; } // ----------------------------------------------------------------------------- -bool RenderObject::UnpersistChildren(InputPersistenceBlock &Reader) { - bool Result = true; +bool RenderObject::unpersistChildren(InputPersistenceBlock &reader) { + bool result = true; // Kinderanzahl einlesen. - uint ChildrenCount; - Reader.Read(ChildrenCount); - if (!Reader.IsGood()) return false; + uint childrenCount; + reader.read(childrenCount); + if (!reader.isGood()) + return false; // Alle Kinder rekursiv wieder herstellen. - for (uint i = 0; i < ChildrenCount; ++i) { - if (!RecreatePersistedRenderObject(Reader).IsValid()) return false; + for (uint i = 0; i < childrenCount; ++i) { + if (!recreatePersistedRenderObject(reader).isValid()) + return false; } - return Result && Reader.IsGood(); + return result && reader.isGood(); } // ----------------------------------------------------------------------------- -RenderObjectPtr RenderObject::RecreatePersistedRenderObject(InputPersistenceBlock &Reader) { - RenderObjectPtr Result; +RenderObjectPtr RenderObject::recreatePersistedRenderObject(InputPersistenceBlock &reader) { + RenderObjectPtr result; // Typ und Handle auslesen. - uint Type; - uint Handle; - Reader.Read(Type); - Reader.Read(Handle); - if (!Reader.IsGood()) return Result; - - switch (Type) { + uint type; + uint handle; + reader.read(type); + reader.read(handle); + if (!reader.isGood()) + return result; + + switch (type) { case TYPE_PANEL: - Result = (new Panel(Reader, this->GetHandle(), Handle))->GetHandle(); + result = (new Panel(reader, this->getHandle(), handle))->getHandle(); break; case TYPE_STATICBITMAP: - Result = (new StaticBitmap(Reader, this->GetHandle(), Handle))->GetHandle(); + result = (new StaticBitmap(reader, this->getHandle(), handle))->getHandle(); break; case TYPE_DYNAMICBITMAP: - Result = (new DynamicBitmap(Reader, this->GetHandle(), Handle))->GetHandle(); + result = (new DynamicBitmap(reader, this->getHandle(), handle))->getHandle(); break; case TYPE_TEXT: - Result = (new Text(Reader, this->GetHandle(), Handle))->GetHandle(); + result = (new Text(reader, this->getHandle(), handle))->getHandle(); break; case TYPE_ANIMATION: - Result = (new Animation(Reader, this->GetHandle(), Handle))->GetHandle(); + result = (new Animation(reader, this->getHandle(), handle))->getHandle(); break; default: - BS_LOG_ERRORLN("Cannot recreate render object of unknown type %d.", Type); + BS_LOG_ERRORLN("Cannot recreate render object of unknown type %d.", type); } - return Result; + return result; } // Hilfs-Methoden // -------------- -bool RenderObject::Greater(const RenderObjectPtr lhs, const RenderObjectPtr rhs) { +bool RenderObject::greater(const RenderObjectPtr lhs, const RenderObjectPtr rhs) { // Das Objekt mit dem kleinem Z-Wert müssen zuerst gerendert werden. - if (lhs->m_Z != rhs->m_Z) - return lhs->m_Z < rhs->m_Z; + if (lhs->_z != rhs->_z) + return lhs->_z < rhs->_z; // Falls der Z-Wert gleich ist, wird das weiter oben gelegenen Objekte zuerst gezeichnet. - return lhs->m_Y < rhs->m_Y; + return lhs->_y < rhs->_y; } } // End of namespace Sword25 diff --git a/engines/sword25/gfx/renderobject.h b/engines/sword25/gfx/renderobject.h index d4fa11b807..c090ad75c9 100644 --- a/engines/sword25/gfx/renderobject.h +++ b/engines/sword25/gfx/renderobject.h @@ -104,7 +104,7 @@ public: @return Gibt einen BS_RenderObjectPtr auf das erzeugte Objekt zurück.
Falls ein Fehler aufgetreten ist wird ein ungültiger BS_RenderObjectPtr zurückgegeben. */ - RenderObjectPtr AddBitmap(const Common::String &FileName); + RenderObjectPtr addBitmap(const Common::String &fileName); /** @brief Erzeugt ein veränderbares Bitmap als Kinderobjekt des Renderobjektes. @param Width die Breite des Bitmaps @@ -112,14 +112,14 @@ public: @return Gibt einen BS_RenderObjectPtr auf das erzeugte Objekt zurück.
Falls ein Fehler aufgetreten ist wird ein ungültiger BS_RenderObjectPtr zurückgegeben. */ - RenderObjectPtr AddDynamicBitmap(uint Width, uint Height); + RenderObjectPtr addDynamicBitmap(uint width, uint height); /** @brief Erzeugt eine Animation auf Basis einer Animationsdatei als Kinderobjekt des Renderobjektes. @param FileName der Dateiname der Quelldatei @return Gibt einen BS_RenderObjectPtr auf das erzeugte Objekt zurück.
Falls ein Fehler aufgetreten ist wird ein ungültiger BS_RenderObjectPtr zurückgegeben. */ - RenderObjectPtr AddAnimation(const Common::String &FileName); + RenderObjectPtr addAnimation(const Common::String &fileName); /** @brief Erzeugt eine Animation auf Basis eines Animationstemplate als Kinderobjekt des Renderobjektes. @param pAnimationTemplate ein Pointer auf das Animationstemplate @@ -127,7 +127,7 @@ public: Falls ein Fehler aufgetreten ist wird ein ungültiger BS_RenderObjectPtr zurückgegeben. @remark Das Renderobjekt übernimmt die Verwaltung des Animationstemplate. */ - RenderObjectPtr AddAnimation(const AnimationTemplate &AnimationTemplate); + RenderObjectPtr addAnimation(const AnimationTemplate &animationTemplate); /** @brief Erzeugt ein neues Farbpanel als Kinderobjekt des Renderobjektes. @param Width die Breite des Panels @@ -138,7 +138,7 @@ public: Falls ein Fehler aufgetreten ist wird ein ungültiger BS_RenderObjectPtr zurückgegeben. */ - RenderObjectPtr AddPanel(int Width, int Height, uint Color = 0xff000000); + RenderObjectPtr addPanel(int width, int height, uint color = 0xff000000); /** @brief Erzeugt ein Textobjekt als Kinderobjekt des Renderobjektes. @param Font der Dateiname des zu verwendenen Fonts @@ -147,7 +147,7 @@ public: @return Gibt einen BS_RenderObjectPtr auf das erzeugte Objekt zurück.
Falls ein Fehler aufgetreten ist wird ein ungültiger BS_RenderObjectPtr zurückgegeben. */ - RenderObjectPtr AddText(const Common::String &Font, const Common::String &text = ""); + RenderObjectPtr addText(const Common::String &font, const Common::String &text = ""); // Cast-Methoden // ------------- @@ -156,36 +156,44 @@ public: @return Gibt einen BS_RenderObjectPtr auf das Objekt zurück.
Falls der Cast nicht zulässig ist, wird ein ungültiger BS_RenderObjectPtr zurückgegeben. */ - RenderObjectPtr ToBitmap() { - if (m_Type == TYPE_STATICBITMAP || m_Type == TYPE_DYNAMICBITMAP) return RenderObjectPtr(this->GetHandle()); - else return RenderObjectPtr(); + RenderObjectPtr toBitmap() { + if (_type == TYPE_STATICBITMAP || _type == TYPE_DYNAMICBITMAP) + return RenderObjectPtr(this->getHandle()); + else + return RenderObjectPtr(); } /** @brief Castet das Objekt zu einem BS_Animation-Objekt wenn zulässig. @return Gibt einen BS_RenderObjectPtr auf das Objekt zurück.
Falls der Cast nicht zulässig ist, wird ein ungültiger BS_RenderObjectPtr zurückgegeben. */ - RenderObjectPtr ToAnimation() { - if (m_Type == TYPE_ANIMATION) return RenderObjectPtr(this->GetHandle()); - else return RenderObjectPtr(); + RenderObjectPtr toAnimation() { + if (_type == TYPE_ANIMATION) + return RenderObjectPtr(this->getHandle()); + else + return RenderObjectPtr(); } /** @brief Castet das Objekt zu einem BS_Panel-Objekt wenn zulässig. @return Gibt einen BS_RenderObjectPtr auf das Objekt zurück.
Falls der Cast nicht zulässig ist, wird ein ungültiger BS_RenderObjectPtr zurückgegeben. */ - RenderObjectPtr ToPanel() { - if (m_Type == TYPE_PANEL) return RenderObjectPtr(this->GetHandle()); - else return RenderObjectPtr(); + RenderObjectPtr toPanel() { + if (_type == TYPE_PANEL) + return RenderObjectPtr(this->getHandle()); + else + return RenderObjectPtr(); } /** @brief Castet das Object zu einem BS_Text-Objekt wenn zulässig. @return Gibt einen BS_RenderObjectPtr auf das Objekt zurück.
Falls der Cast nicht zulässig ist, wird ein ungültiger BS_RenderObjectPtr zurückgegeben. */ - RenderObjectPtr ToText() { - if (m_Type == TYPE_TEXT) return RenderObjectPtr(this->GetHandle()); - else return RenderObjectPtr(); + RenderObjectPtr toText() { + if (_type == TYPE_TEXT) + return RenderObjectPtr(this->getHandle()); + else + return RenderObjectPtr(); } // Konstruktor / Desktruktor @@ -206,7 +214,7 @@ public: Es ist nicht notwendig alle BS_RenderObject Instanzen einzeln zu löschen. Dieses geschiet automatisch beim Löschen eines Vorfahren oder beim Löschen des zuständigen BS_RenderObjectManager. */ - RenderObject(RenderObjectPtr pParent, TYPES Type, uint Handle = 0); + RenderObject(RenderObjectPtr pParent, TYPES type, uint handle = 0); virtual ~RenderObject(); // Interface @@ -218,18 +226,18 @@ public: Dieses kann entweder direkt geschehen oder durch den Aufruf von UpdateObjectState() an einem Vorfahren-Objekt.
Diese Methode darf nur von BS_RenderObjectManager aufgerufen werden. */ - bool Render(); + bool render(); /** @brief Bereitet das Objekt und alle seine Unterobjekte auf einen Rendervorgang vor. Hierbei werden alle Dirty-Rectangles berechnet und die Renderreihenfolge aktualisiert. @return Gibt false zurück, falls ein Fehler aufgetreten ist. @remark Diese Methode darf nur von BS_RenderObjectManager aufgerufen werden. */ - bool UpdateObjectState(); + bool updateObjectState(); /** @brief Löscht alle Kinderobjekte. */ - void DeleteAllChildren(); + void deleteAllChildren(); // Accessor-Methoden // ----------------- @@ -238,17 +246,17 @@ public: @param X die neue X-Koordinate des Objektes relativ zum Elternobjekt. @param Y die neue Y-Koordinate des Objektes relativ zum Elternobjekt. */ - virtual void SetPos(int X, int Y); + virtual void setPos(int x, int y); /** @brief Setzt die Position des Objektes auf der X-Achse. @param X die neue X-Koordinate des Objektes relativ zum Elternobjekt. */ - virtual void SetX(int X); + virtual void setX(int x); /** @brief Setzt die Position des Objektes auf der Y-Achse. @param Y die neue Y-Koordinate des Objektes relativ zum Elternobjekt. */ - virtual void SetY(int Y); + virtual void setY(int y); /** @brief Setzt den Z-Wert des Objektes. @param Z der neue Z-Wert des Objektes relativ zum Elternobjekt
@@ -258,36 +266,36 @@ public: Wie alle andere Attribute ist auch dieses relativ zum Elternobjekt, ein Kinderobjekt kann also nie unter seinem Elternobjekt liegen, auch wenn es einen Z-Wert von 0 hat. */ - virtual void SetZ(int Z); + virtual void setZ(int z); /** @brief Setzt die Sichtbarkeit eine Objektes. @param Visible der neue Sichtbarkeits-Zustand des Objektes
true entspricht sichtbar, false entspricht unsichtbar. */ - virtual void SetVisible(bool Visible); + virtual void setVisible(bool visible); /** @brief Gibt die Position des Objektes auf der X-Achse relativ zum Elternobjekt zurück. */ - virtual int GetX() const { - return m_X; + virtual int getX() const { + return _x; } /** @brief Gibt die Position des Objektes auf der Y-Achse relativ zum Elternobjekt zurück. */ - virtual int GetY() const { - return m_Y; + virtual int getY() const { + return _y; } /** @brief Gibt die absolute Position des Objektes auf der X-Achse zurück. */ - virtual int GetAbsoluteX() const { - return m_AbsoluteX; + virtual int getAbsoluteX() const { + return _absoluteX; } /** @brief Gibt die absolute Position des Objektes auf der Y-Achse zurück. */ - virtual int GetAbsoluteY() const { - return m_AbsoluteY; + virtual int getAbsoluteY() const { + return _absoluteY; } /** @brief Gibt den Z-Wert des Objektes relativ zum Elternobjekt zurück. @@ -296,71 +304,71 @@ public: Wie alle andere Attribute ist auch dieses relativ zum Elternobjekt, ein Kinderobjekt kann also nie unter seinem Elternobjekt liegen, auch wenn es einen Z-Wert von 0 hat. */ - int GetZ() const { - return m_Z; + int getZ() const { + return _z; } /** @brief Gibt die Breite des Objektes zurück. */ - int GetWidth() const { - return m_Width; + int getWidth() const { + return _width; } /** @brief Gibt die Höhe des Objektes zurück. */ - int GetHeight() const { - return m_Height; + int getHeight() const { + return _height; } /** @brief Gibt den Sichtbarkeitszustand des Objektes zurück. @return Gibt den Sichtbarkeitszustand des Objektes zurück.
true entspricht sichtbar, false entspricht unsichtbar. */ - bool IsVisible() const { - return m_Visible; + bool isVisible() const { + return _visible; } /** @brief Gibt den Typ des Objektes zurück. */ - TYPES GetType() const { - return m_Type; + TYPES getType() const { + return _type; } /** @brief Gibt zurück, ob das Objekt erfolgreich initialisiert wurde. @remark Hässlicher Workaround um das Problem, dass Konstruktoren keine Rückgabewerte haben. */ - bool GetInitSuccess() const { - return m_InitSuccess; + bool getInitSuccess() const { + return _initSuccess; } /** @brief Gibt die Bounding-Box des Objektes zurück. @remark Diese Angabe erfolgt ausnahmsweise in Bildschirmkoordianten und nicht relativ zum Elternobjekt. */ - const Common::Rect &GetBBox() const { - return m_BBox; + const Common::Rect &getBbox() const { + return _bbox; } /** @brief Stellt sicher, dass das Objekt im nächsten Frame neu gezeichnet wird. */ - void ForceRefresh() { - m_RefreshForced = true; + void forceRefresh() { + _refreshForced = true; }; /** @brief Gibt das Handle des Objekte zurück. */ - uint GetHandle() const { - return m_Handle; + uint getHandle() const { + return _handle; } // Persistenz-Methoden // ------------------- - virtual bool Persist(OutputPersistenceBlock &Writer); - virtual bool Unpersist(InputPersistenceBlock &Reader); + virtual bool persist(OutputPersistenceBlock &writer); + virtual bool unpersist(InputPersistenceBlock &reader); // TODO: Evtl. protected - bool PersistChildren(OutputPersistenceBlock &Writer); - bool UnpersistChildren(InputPersistenceBlock &Reader); + bool persistChildren(OutputPersistenceBlock &writer); + bool unpersistChildren(InputPersistenceBlock &reader); // TODO: Evtl. private - RenderObjectPtr RecreatePersistedRenderObject(InputPersistenceBlock &Reader); + RenderObjectPtr recreatePersistedRenderObject(InputPersistenceBlock &reader); protected: // Typen @@ -368,28 +376,28 @@ protected: typedef Common::List > RENDEROBJECT_LIST; typedef Common::List >::iterator RENDEROBJECT_ITER; - int m_X; ///< Die X-Position des Objektes relativ zum Eltern-Objekt - int m_Y; ///< Die Y-Position des Objektes relativ zum Eltern-Objekt - int m_AbsoluteX; ///< Die absolute X-Position des Objektes - int m_AbsoluteY; ///< Die absolute Y-Position des Objektes - int m_Z; ///< Der Z-Wert des Objektes relativ zum Eltern-Objekt - int m_Width; ///< Die Breite des Objektes - int m_Height; ///< Die Höhe des Objektes - bool m_Visible; ///< Ist true, wenn das Objekt sichtbar ist - bool m_ChildChanged; ///< Ist true, wenn sich ein Kinderobjekt verändert hat - TYPES m_Type; ///< Der Objekttyp - bool m_InitSuccess; ///< Ist true, wenn Objekt erfolgreich intialisiert werden konnte - Common::Rect m_BBox; ///< Die Bounding-Box des Objektes in Bildschirmkoordinaten + int _x; ///< Die X-Position des Objektes relativ zum Eltern-Objekt + int _y; ///< Die Y-Position des Objektes relativ zum Eltern-Objekt + int _absoluteX; ///< Die absolute X-Position des Objektes + int _absoluteY; ///< Die absolute Y-Position des Objektes + int _z; ///< Der Z-Wert des Objektes relativ zum Eltern-Objekt + int _width; ///< Die Breite des Objektes + int _height; ///< Die Höhe des Objektes + bool _visible; ///< Ist true, wenn das Objekt sichtbar ist + bool _childChanged; ///< Ist true, wenn sich ein Kinderobjekt verändert hat + TYPES _type; ///< Der Objekttyp + bool _initSuccess; ///< Ist true, wenn Objekt erfolgreich intialisiert werden konnte + Common::Rect _bbox; ///< Die Bounding-Box des Objektes in Bildschirmkoordinaten // Kopien der Variablen, die für die Errechnung des Dirty-Rects und zur Bestimmung der Objektveränderung notwendig sind - Common::Rect m_OldBBox; - int m_OldX; - int m_OldY; - int m_OldZ; - bool m_OldVisible; + Common::Rect _oldBbox; + int _oldX; + int _oldY; + int _oldZ; + bool _oldVisible; /// Ein Pointer auf den BS_RenderObjektManager, der das Objekt verwaltet. - RenderObjectManager *m_ManagerPtr; + RenderObjectManager *_managerPtr; // Render-Methode // -------------- @@ -402,7 +410,7 @@ protected: @return Gibt false zurück, falls das Rendern fehlgeschlagen ist. @remark */ - virtual bool DoRender() = 0; // { return true; }; + virtual bool doRender() = 0; // { return true; }; // RenderObject-Baum Variablen // --------------------------- @@ -426,82 +434,82 @@ protected: // Wenn der Hintergrund bewegt wird (Scrolling), bewegen sich auch die darauf befindlichen Gegenstände und Personen. /// Ein Pointer auf das Elternobjekt. - RenderObjectPtr m_ParentPtr; + RenderObjectPtr _parentPtr; /// Die Liste der Kinderobjekte nach der Renderreihenfolge geordnet - RENDEROBJECT_LIST m_Children; + RENDEROBJECT_LIST _children; /** @brief Gibt einen Pointer auf den BS_RenderObjektManager zurück, der das Objekt verwaltet. */ - RenderObjectManager *GetManager() const { - return m_ManagerPtr; + RenderObjectManager *getManager() const { + return _managerPtr; } /** @brief Fügt dem Objekt ein neues Kinderobjekt hinzu. @param pObject ein Pointer auf das einzufügende Objekt @return Gibt false zurück, falls das Objekt nicht eingefügt werden konnte. */ - bool AddObject(RenderObjectPtr pObject); + bool addObject(RenderObjectPtr pObject); private: /// Ist true, wenn das Objekt in nächsten Frame neu gezeichnet werden soll - bool m_RefreshForced; + bool _refreshForced; - uint m_Handle; + uint _handle; /** @brief Entfernt ein Objekt aus der Kinderliste. @param pObject ein Pointer auf das zu entfernende Objekt @return Gibt false zurück, falls das zu entfernende Objekt nicht in der Liste gefunden werden konnte. */ - bool DetatchChildren(RenderObjectPtr pObject); + bool detatchChildren(RenderObjectPtr pObject); /** @brief Berechnet die Bounding-Box und registriert das Dirty-Rect beim BS_RenderObjectManager. */ - void UpdateBoxes(); + void updateBoxes(); /** @brief Berechnet die Bounding-Box des Objektes. @return Gibt die Bounding-Box des Objektes in Bildschirmkoordinaten zurück. */ - Common::Rect CalcBoundingBox() const; + Common::Rect calcBoundingBox() const; /** @brief Berechnet das Dirty-Rectangle des Objektes. @return Gibt das Dirty-Rectangle des Objektes in Bildschirmkoordinaten zurück. */ - Common::Rect CalcDirtyRect() const; + Common::Rect calcDirtyRect() const; /** @brief Berechnet die absolute Position des Objektes. */ - void CalcAbsolutePos(int &X, int &Y) const; + void calcAbsolutePos(int &x, int &y) const; /** @brief Berechnet die absolute Position des Objektes auf der X-Achse. */ - int CalcAbsoluteX() const; + int calcAbsoluteX() const; /** @brief Berechnet die absolute Position des Objektes. */ - int CalcAbsoluteY() const; + int calcAbsoluteY() const; /** @brief Sortiert alle Kinderobjekte nach ihrem Renderang. */ - void SortRenderObjects(); + void sortRenderObjects(); /** @brief Validiert den Zustand eines Objektes nachdem die durch die Veränderung verursachten Folgen abgearbeitet wurden. */ - void ValidateObject(); + void validateObject(); /** @brief Berechnet die absolute Position des Objektes und aller seiner Kinderobjekte neu. Diese Methode muss aufgerufen werden, wann immer sich die Position des Objektes verändert. Damit die Kinderobjekte immer die richtige absolute Position haben. */ - void UpdateAbsolutePos(); + void updateAbsolutePos(); /** @brief Teilt dem Objekt mit, dass sich eines seiner Kinderobjekte dahingehend verändert hat, die eine erneute Bestimmung der Rendereihenfolge verlangt. */ - void SignalChildChange() { - m_ChildChanged = true; + void signalChildChange() { + _childChanged = true; } /** @brief Berechnet des Schnittrechteck der Bounding-Box des Objektes mit einem anderen Objekt. @@ -509,12 +517,12 @@ private: @param Result das Ergebnisrechteck @return Gibt false zurück, falls sich die Objekte gar nicht schneiden. */ - bool GetObjectIntersection(RenderObjectPtr pObject, Common::Rect &Result); + bool getObjectIntersection(RenderObjectPtr pObject, Common::Rect &result); /** @brief Vergleichsoperator der auf Objektpointern basiert statt auf Objekten. @remark Diese Methode wird fürs Sortieren der Kinderliste nach der Rendereihenfolge benutzt. */ - static bool Greater(const RenderObjectPtr lhs, const RenderObjectPtr rhs); + static bool greater(const RenderObjectPtr lhs, const RenderObjectPtr rhs); }; } // End of namespace Sword25 diff --git a/engines/sword25/gfx/renderobjectmanager.cpp b/engines/sword25/gfx/renderobjectmanager.cpp index 8ba0a9a663..d67e1c0361 100644 --- a/engines/sword25/gfx/renderobjectmanager.cpp +++ b/engines/sword25/gfx/renderobjectmanager.cpp @@ -56,61 +56,62 @@ namespace Sword25 { // Konstruktion / Desktruktion // ----------------------------------------------------------------------------- -RenderObjectManager::RenderObjectManager(int Width, int Height, int FramebufferCount) : - m_FrameStarted(false) { +RenderObjectManager::RenderObjectManager(int width, int height, int framebufferCount) : + _frameStarted(false) { // Wurzel des BS_RenderObject-Baumes erzeugen. - m_RootPtr = (new RootRenderObject(this, Width, Height))->GetHandle(); + _rootPtr = (new RootRenderObject(this, width, height))->getHandle(); } // ----------------------------------------------------------------------------- RenderObjectManager::~RenderObjectManager() { // Die Wurzel des Baumes löschen, damit werden alle BS_RenderObjects mitgelöscht. - m_RootPtr.Erase(); + _rootPtr.erase(); } // ----------------------------------------------------------------------------- // Interface // ----------------------------------------------------------------------------- -void RenderObjectManager::StartFrame() { - m_FrameStarted = true; +void RenderObjectManager::startFrame() { + _frameStarted = true; // Verstrichene Zeit bestimmen - int TimeElapsed = Kernel::GetInstance()->GetGfx()->GetLastFrameDurationMicro(); + int timeElapsed = Kernel::GetInstance()->GetGfx()->GetLastFrameDurationMicro(); // Alle BS_TimedRenderObject Objekte über den Framestart und die verstrichene Zeit in Kenntnis setzen - RenderObjectList::iterator Iter = m_TimedRenderObjects.begin(); - for (; Iter != m_TimedRenderObjects.end(); ++Iter) - (*Iter)->FrameNotification(TimeElapsed); + RenderObjectList::iterator iter = _timedRenderObjects.begin(); + for (; iter != _timedRenderObjects.end(); ++iter) + (*iter)->frameNotification(timeElapsed); } // ----------------------------------------------------------------------------- -bool RenderObjectManager::Render() { +bool RenderObjectManager::render() { // Den Objekt-Status des Wurzelobjektes aktualisieren. Dadurch werden rekursiv alle Baumelemente aktualisiert. // Beim aktualisieren des Objekt-Status werden auch die Update-Rects gefunden, so dass feststeht, was neu gezeichnet // werden muss. - if (!m_RootPtr.IsValid() || !m_RootPtr->UpdateObjectState()) return false; + if (!_rootPtr.isValid() || !_rootPtr->updateObjectState()) + return false; - m_FrameStarted = false; + _frameStarted = false; // Die Render-Methode der Wurzel aufrufen. Dadurch wird das rekursive Rendern der Baumelemente angestoßen. - return m_RootPtr->Render(); + return _rootPtr->render(); } // ----------------------------------------------------------------------------- -void RenderObjectManager::AttatchTimedRenderObject(RenderObjectPtr RenderObjectPtr) { - m_TimedRenderObjects.push_back(RenderObjectPtr); +void RenderObjectManager::attatchTimedRenderObject(RenderObjectPtr renderObjectPtr) { + _timedRenderObjects.push_back(renderObjectPtr); } // ----------------------------------------------------------------------------- -void RenderObjectManager::DetatchTimedRenderObject(RenderObjectPtr RenderObjectPtr) { - for (uint i = 0; i < m_TimedRenderObjects.size(); i++) - if (m_TimedRenderObjects[i] == RenderObjectPtr) { - m_TimedRenderObjects.remove_at(i); +void RenderObjectManager::detatchTimedRenderObject(RenderObjectPtr renderObjectPtr) { + for (uint i = 0; i < _timedRenderObjects.size(); i++) + if (_timedRenderObjects[i] == renderObjectPtr) { + _timedRenderObjects.remove_at(i); break; } } @@ -119,57 +120,58 @@ void RenderObjectManager::DetatchTimedRenderObject(RenderObjectPtrPersistChildren(Writer); + result &= _rootPtr->persistChildren(writer); - Writer.Write(m_FrameStarted); + writer.write(_frameStarted); // Referenzen auf die TimedRenderObjects persistieren. - Writer.Write(m_TimedRenderObjects.size()); - RenderObjectList::const_iterator Iter = m_TimedRenderObjects.begin(); - while (Iter != m_TimedRenderObjects.end()) { - Writer.Write((*Iter)->GetHandle()); - ++Iter; + writer.write(_timedRenderObjects.size()); + RenderObjectList::const_iterator iter = _timedRenderObjects.begin(); + while (iter != _timedRenderObjects.end()) { + writer.write((*iter)->getHandle()); + ++iter; } // Alle BS_AnimationTemplates persistieren. - Result &= AnimationTemplateRegistry::GetInstance().Persist(Writer); + result &= AnimationTemplateRegistry::GetInstance().persist(writer); - return Result; + return result; } // ----------------------------------------------------------------------------- -bool RenderObjectManager::Unpersist(InputPersistenceBlock &Reader) { - bool Result = true; +bool RenderObjectManager::unpersist(InputPersistenceBlock &reader) { + bool result = true; // Alle Kinder des Wurzelknotens löschen. Damit werden alle BS_RenderObjects gelöscht. - m_RootPtr->DeleteAllChildren(); + _rootPtr->deleteAllChildren(); // Alle BS_RenderObjects wieder hestellen. - if (!m_RootPtr->UnpersistChildren(Reader)) return false; + if (!_rootPtr->unpersistChildren(reader)) + return false; - Reader.Read(m_FrameStarted); + reader.read(_frameStarted); // Momentan gespeicherte Referenzen auf TimedRenderObjects löschen. - m_TimedRenderObjects.resize(0); + _timedRenderObjects.resize(0); // Referenzen auf die TimedRenderObjects wieder herstellen. - uint TimedObjectCount; - Reader.Read(TimedObjectCount); - for (uint i = 0; i < TimedObjectCount; ++i) { - uint Handle; - Reader.Read(Handle); - m_TimedRenderObjects.push_back(Handle); + uint timedObjectCount; + reader.read(timedObjectCount); + for (uint i = 0; i < timedObjectCount; ++i) { + uint handle; + reader.read(handle); + _timedRenderObjects.push_back(handle); } // Alle BS_AnimationTemplates wieder herstellen. - Result &= AnimationTemplateRegistry::GetInstance().Unpersist(Reader); + result &= AnimationTemplateRegistry::GetInstance().unpersist(reader); - return Result; + return result; } } // End of namespace Sword25 diff --git a/engines/sword25/gfx/renderobjectmanager.h b/engines/sword25/gfx/renderobjectmanager.h index 7d9015d117..05bba37cd0 100644 --- a/engines/sword25/gfx/renderobjectmanager.h +++ b/engines/sword25/gfx/renderobjectmanager.h @@ -72,7 +72,7 @@ public: @param Height die vertikale Bildschirmauflösung in Pixeln @param Die Anzahl an Framebuffern, die eingesetzt wird (Backbuffer + Primary). */ - RenderObjectManager(int Width, int Height, int FramebufferCount); + RenderObjectManager(int width, int height, int framebufferCount); virtual ~RenderObjectManager(); // Interface @@ -85,17 +85,17 @@ public: zurückgesetzt. Wenn man also mit diesen Werten arbeiten möchten, muss man dies nach einem Aufruf von Render() und vor einem Aufruf von StartFrame() tun. */ - void StartFrame(); + void startFrame(); /** @brief Rendert alle Objekte die sich während des letzten Aufrufes von Render() verändert haben. @return Gibt false zurück, falls das Rendern fehlgeschlagen ist. */ - bool Render(); + bool render(); /** @brief Gibt einen Pointer auf die Wurzel des Objektbaumes zurück. */ - RenderObjectPtr GetTreeRoot() { - return m_RootPtr; + RenderObjectPtr getTreeRoot() { + return _rootPtr; } /** @brief Fügt ein BS_TimedRenderObject in die Liste der zeitabhängigen Render-Objekte. @@ -105,25 +105,25 @@ public: @param RenderObject das einzufügende BS_TimedRenderObject */ - void AttatchTimedRenderObject(RenderObjectPtr pRenderObject); + void attatchTimedRenderObject(RenderObjectPtr pRenderObject); /** @brief Entfernt ein BS_TimedRenderObject aus der Liste für zeitabhängige Render-Objekte. */ - void DetatchTimedRenderObject(RenderObjectPtr pRenderObject); + void detatchTimedRenderObject(RenderObjectPtr pRenderObject); - virtual bool Persist(OutputPersistenceBlock &Writer); - virtual bool Unpersist(InputPersistenceBlock &Reader); + virtual bool persist(OutputPersistenceBlock &writer); + virtual bool unpersist(InputPersistenceBlock &reader); private: - bool m_FrameStarted; + bool _frameStarted; typedef Common::Array > RenderObjectList; - RenderObjectList m_TimedRenderObjects; + RenderObjectList _timedRenderObjects; // RenderObject-Tree Variablen // --------------------------- // Der Baum legt die hierachische Ordnung der BS_RenderObjects fest. // Zu weiteren Informationen siehe: "renderobject.h" - RenderObjectPtr m_RootPtr; // Die Wurzel der Baumes + RenderObjectPtr _rootPtr; // Die Wurzel der Baumes }; } // End of namespace Sword25 diff --git a/engines/sword25/gfx/renderobjectptr.h b/engines/sword25/gfx/renderobjectptr.h index 0768d7a6ca..4acb2b4dcd 100644 --- a/engines/sword25/gfx/renderobjectptr.h +++ b/engines/sword25/gfx/renderobjectptr.h @@ -57,29 +57,29 @@ class RenderObject; template class RenderObjectPtr { public: - RenderObjectPtr() : m_Handle(0) {} + RenderObjectPtr() : _handle(0) {} - RenderObjectPtr(uint Handle) : m_Handle(Handle) {} + RenderObjectPtr(uint handle) : _handle(handle) {} T *operator->() const { - return static_cast(RenderObjectRegistry::GetInstance().ResolveHandle(m_Handle)); + return static_cast(RenderObjectRegistry::GetInstance().resolveHandle(_handle)); } bool operator==(const RenderObjectPtr & other) { - return m_Handle == other.m_Handle; + return _handle == other._handle; } - bool IsValid() const { - return RenderObjectRegistry::GetInstance().ResolveHandle(m_Handle) != 0; + bool isValid() const { + return RenderObjectRegistry::GetInstance().resolveHandle(_handle) != 0; } - void Erase() { - delete static_cast(RenderObjectRegistry::GetInstance().ResolveHandle(m_Handle)); - m_Handle = 0; + void erase() { + delete static_cast(RenderObjectRegistry::GetInstance().resolveHandle(_handle)); + _handle = 0; } private: - uint m_Handle; + uint _handle; }; } // End of namespace Sword25 diff --git a/engines/sword25/gfx/rootrenderobject.h b/engines/sword25/gfx/rootrenderobject.h index 76665c9444..e4e3fba3c8 100644 --- a/engines/sword25/gfx/rootrenderobject.h +++ b/engines/sword25/gfx/rootrenderobject.h @@ -54,15 +54,15 @@ class RootRenderObject : public RenderObject { friend class RenderObjectManager; private: - RootRenderObject(RenderObjectManager *ManagerPtr, int Width, int Height) : + RootRenderObject(RenderObjectManager *managerPtr, int width, int height) : RenderObject(RenderObjectPtr(), TYPE_ROOT) { - m_ManagerPtr = ManagerPtr; - m_Width = Width; - m_Height = Height; + _managerPtr = managerPtr; + _width = width; + _height = height; } protected: - virtual bool DoRender() { + virtual bool doRender() { return true; } }; diff --git a/engines/sword25/gfx/staticbitmap.cpp b/engines/sword25/gfx/staticbitmap.cpp index 13ecda86c7..7771eb8100 100644 --- a/engines/sword25/gfx/staticbitmap.cpp +++ b/engines/sword25/gfx/staticbitmap.cpp @@ -54,46 +54,47 @@ namespace Sword25 { // Konstruktion / Destruktion // ----------------------------------------------------------------------------- -StaticBitmap::StaticBitmap(RenderObjectPtr ParentPtr, const Common::String &Filename) : - Bitmap(ParentPtr, TYPE_STATICBITMAP) { +StaticBitmap::StaticBitmap(RenderObjectPtr parentPtr, const Common::String &filename) : + Bitmap(parentPtr, TYPE_STATICBITMAP) { // Das BS_Bitmap konnte nicht erzeugt werden, daher muss an dieser Stelle abgebrochen werden. - if (!m_InitSuccess) return; + if (!_initSuccess) + return; - m_InitSuccess = InitBitmapResource(Filename); + _initSuccess = initBitmapResource(filename); } // ----------------------------------------------------------------------------- -StaticBitmap::StaticBitmap(InputPersistenceBlock &Reader, RenderObjectPtr ParentPtr, uint Handle) : - Bitmap(ParentPtr, TYPE_STATICBITMAP, Handle) { - m_InitSuccess = Unpersist(Reader); +StaticBitmap::StaticBitmap(InputPersistenceBlock &reader, RenderObjectPtr parentPtr, uint handle) : + Bitmap(parentPtr, TYPE_STATICBITMAP, handle) { + _initSuccess = unpersist(reader); } // ----------------------------------------------------------------------------- -bool StaticBitmap::InitBitmapResource(const Common::String &Filename) { +bool StaticBitmap::initBitmapResource(const Common::String &filename) { // Bild-Resource laden - Resource *ResourcePtr = Kernel::GetInstance()->GetResourceManager()->RequestResource(Filename); - if (!ResourcePtr) { - BS_LOG_ERRORLN("Could not request resource \"%s\".", Filename.c_str()); + Resource *resourcePtr = Kernel::GetInstance()->GetResourceManager()->RequestResource(filename); + if (!resourcePtr) { + BS_LOG_ERRORLN("Could not request resource \"%s\".", filename.c_str()); return false; } - if (ResourcePtr->GetType() != Resource::TYPE_BITMAP) { - BS_LOG_ERRORLN("Requested resource \"%s\" is not a bitmap.", Filename.c_str()); + if (resourcePtr->GetType() != Resource::TYPE_BITMAP) { + BS_LOG_ERRORLN("Requested resource \"%s\" is not a bitmap.", filename.c_str()); return false; } - BitmapResource *BitmapPtr = static_cast(ResourcePtr); + BitmapResource *bitmapPtr = static_cast(resourcePtr); // Den eindeutigen Dateinamen zum späteren Referenzieren speichern - m_ResourceFilename = BitmapPtr->GetFileName(); + _resourceFilename = bitmapPtr->getFileName(); // RenderObject Eigenschaften aktualisieren - m_OriginalWidth = m_Width = BitmapPtr->GetWidth(); - m_OriginalHeight = m_Height = BitmapPtr->GetHeight(); + _originalWidth = _width = bitmapPtr->getWidth(); + _originalHeight = _height = bitmapPtr->getHeight(); // Bild-Resource freigeben - BitmapPtr->Release(); + bitmapPtr->release(); return true; } @@ -105,54 +106,54 @@ StaticBitmap::~StaticBitmap() { // ----------------------------------------------------------------------------- -bool StaticBitmap::DoRender() { +bool StaticBitmap::doRender() { // Bitmap holen - Resource *ResourcePtr = Kernel::GetInstance()->GetResourceManager()->RequestResource(m_ResourceFilename); - BS_ASSERT(ResourcePtr); - BS_ASSERT(ResourcePtr->GetType() == Resource::TYPE_BITMAP); - BitmapResource *BitmapResourcePtr = static_cast(ResourcePtr); + Resource *resourcePtr = Kernel::GetInstance()->GetResourceManager()->RequestResource(_resourceFilename); + BS_ASSERT(resourcePtr); + BS_ASSERT(resourcePtr->GetType() == Resource::TYPE_BITMAP); + BitmapResource *bitmapResourcePtr = static_cast(resourcePtr); // Framebufferobjekt holen - GraphicEngine *GfxPtr = static_cast(Kernel::GetInstance()->GetService("gfx")); - BS_ASSERT(GfxPtr); + GraphicEngine *gfxPtr = static_cast(Kernel::GetInstance()->GetService("gfx")); + BS_ASSERT(gfxPtr); // Bitmap zeichnen - bool Result; - if (m_ScaleFactorX == 1.0f && m_ScaleFactorY == 1.0f) { - Result = BitmapResourcePtr->Blit(m_AbsoluteX, m_AbsoluteY, - (m_FlipV ? BitmapResource::FLIP_V : 0) | - (m_FlipH ? BitmapResource::FLIP_H : 0), - 0, m_ModulationColor, -1, -1); + bool result; + if (_scaleFactorX == 1.0f && _scaleFactorY == 1.0f) { + result = bitmapResourcePtr->blit(_absoluteX, _absoluteY, + (_flipV ? BitmapResource::FLIP_V : 0) | + (_flipH ? BitmapResource::FLIP_H : 0), + 0, _modulationColor, -1, -1); } else { - Result = BitmapResourcePtr->Blit(m_AbsoluteX, m_AbsoluteY, - (m_FlipV ? BitmapResource::FLIP_V : 0) | - (m_FlipH ? BitmapResource::FLIP_H : 0), - 0, m_ModulationColor, m_Width, m_Height); + result = bitmapResourcePtr->blit(_absoluteX, _absoluteY, + (_flipV ? BitmapResource::FLIP_V : 0) | + (_flipH ? BitmapResource::FLIP_H : 0), + 0, _modulationColor, _width, _height); } // Resource freigeben - BitmapResourcePtr->Release(); + bitmapResourcePtr->release(); - return Result; + return result; } // ----------------------------------------------------------------------------- -uint StaticBitmap::GetPixel(int X, int Y) const { - BS_ASSERT(X >= 0 && X < m_Width); - BS_ASSERT(Y >= 0 && Y < m_Height); +uint StaticBitmap::getPixel(int x, int y) const { + BS_ASSERT(x >= 0 && x < _width); + BS_ASSERT(y >= 0 && y < _height); - Resource *pResource = Kernel::GetInstance()->GetResourceManager()->RequestResource(m_ResourceFilename); + Resource *pResource = Kernel::GetInstance()->GetResourceManager()->RequestResource(_resourceFilename); BS_ASSERT(pResource->GetType() == Resource::TYPE_BITMAP); BitmapResource *pBitmapResource = static_cast(pResource); - uint Result = pBitmapResource->GetPixel(X, Y); - pResource->Release(); - return Result; + uint result = pBitmapResource->getPixel(x, y); + pResource->release(); + return result; } // ----------------------------------------------------------------------------- -bool StaticBitmap::SetContent(const byte *Pixeldata, uint size, uint Offset, uint Stride) { +bool StaticBitmap::setContent(const byte *pixeldata, uint size, uint offset, uint stride) { BS_LOG_ERRORLN("SetContent() ist not supported with this object."); return false; } @@ -161,60 +162,60 @@ bool StaticBitmap::SetContent(const byte *Pixeldata, uint size, uint Offset, uin // Auskunftsmethoden // ----------------------------------------------------------------------------- -bool StaticBitmap::IsAlphaAllowed() const { - Resource *pResource = Kernel::GetInstance()->GetResourceManager()->RequestResource(m_ResourceFilename); +bool StaticBitmap::isAlphaAllowed() const { + Resource *pResource = Kernel::GetInstance()->GetResourceManager()->RequestResource(_resourceFilename); BS_ASSERT(pResource->GetType() == Resource::TYPE_BITMAP); - bool Result = static_cast(pResource)->IsAlphaAllowed(); - pResource->Release(); - return Result; + bool result = static_cast(pResource)->isAlphaAllowed(); + pResource->release(); + return result; } // ----------------------------------------------------------------------------- -bool StaticBitmap::IsColorModulationAllowed() const { - Resource *pResource = Kernel::GetInstance()->GetResourceManager()->RequestResource(m_ResourceFilename); +bool StaticBitmap::isColorModulationAllowed() const { + Resource *pResource = Kernel::GetInstance()->GetResourceManager()->RequestResource(_resourceFilename); BS_ASSERT(pResource->GetType() == Resource::TYPE_BITMAP); - bool Result = static_cast(pResource)->IsColorModulationAllowed(); - pResource->Release(); - return Result; + bool result = static_cast(pResource)->isColorModulationAllowed(); + pResource->release(); + return result; } // ----------------------------------------------------------------------------- -bool StaticBitmap::IsScalingAllowed() const { - Resource *pResource = Kernel::GetInstance()->GetResourceManager()->RequestResource(m_ResourceFilename); +bool StaticBitmap::isScalingAllowed() const { + Resource *pResource = Kernel::GetInstance()->GetResourceManager()->RequestResource(_resourceFilename); BS_ASSERT(pResource->GetType() == Resource::TYPE_BITMAP); - bool Result = static_cast(pResource)->IsScalingAllowed(); - pResource->Release(); - return Result; + bool result = static_cast(pResource)->isScalingAllowed(); + pResource->release(); + return result; } // ----------------------------------------------------------------------------- // Persistenz // ----------------------------------------------------------------------------- -bool StaticBitmap::Persist(OutputPersistenceBlock &Writer) { - bool Result = true; +bool StaticBitmap::persist(OutputPersistenceBlock &writer) { + bool result = true; - Result &= Bitmap::Persist(Writer); - Writer.Write(m_ResourceFilename); + result &= Bitmap::persist(writer); + writer.write(_resourceFilename); - Result &= RenderObject::PersistChildren(Writer); + result &= RenderObject::persistChildren(writer); - return Result; + return result; } -bool StaticBitmap::Unpersist(InputPersistenceBlock &Reader) { - bool Result = true; +bool StaticBitmap::unpersist(InputPersistenceBlock &reader) { + bool result = true; - Result &= Bitmap::Unpersist(Reader); - Common::String ResourceFilename; - Reader.Read(ResourceFilename); - Result &= InitBitmapResource(ResourceFilename); + result &= Bitmap::unpersist(reader); + Common::String resourceFilename; + reader.read(resourceFilename); + result &= initBitmapResource(resourceFilename); - Result &= RenderObject::UnpersistChildren(Reader); + result &= RenderObject::unpersistChildren(reader); - return Reader.IsGood() && Result; + return reader.isGood() && result; } } // End of namespace Sword25 diff --git a/engines/sword25/gfx/staticbitmap.h b/engines/sword25/gfx/staticbitmap.h index 6251c78121..a325487213 100644 --- a/engines/sword25/gfx/staticbitmap.h +++ b/engines/sword25/gfx/staticbitmap.h @@ -55,33 +55,33 @@ private: /** @remark Filename muss absoluter Pfad sein */ - StaticBitmap(RenderObjectPtr ParentPtr, const Common::String &Filename); - StaticBitmap(InputPersistenceBlock &Reader, RenderObjectPtr ParentPtr, uint Handle); + StaticBitmap(RenderObjectPtr parentPtr, const Common::String &filename); + StaticBitmap(InputPersistenceBlock &reader, RenderObjectPtr parentPtr, uint handle); public: virtual ~StaticBitmap(); - virtual uint GetPixel(int X, int Y) const; + virtual uint getPixel(int x, int y) const; - virtual bool SetContent(const byte *Pixeldata, uint size, uint Offset, uint Stride); + virtual bool setContent(const byte *pixeldata, uint size, uint offset, uint stride); - virtual bool IsScalingAllowed() const; - virtual bool IsAlphaAllowed() const; - virtual bool IsColorModulationAllowed() const; - virtual bool IsSetContentAllowed() const { + virtual bool isScalingAllowed() const; + virtual bool isAlphaAllowed() const; + virtual bool isColorModulationAllowed() const; + virtual bool isSetContentAllowed() const { return false; } - virtual bool Persist(OutputPersistenceBlock &Writer); - virtual bool Unpersist(InputPersistenceBlock &Reader); + virtual bool persist(OutputPersistenceBlock &writer); + virtual bool unpersist(InputPersistenceBlock &reader); protected: - virtual bool DoRender(); + virtual bool doRender(); private: - Common::String m_ResourceFilename; + Common::String _resourceFilename; - bool InitBitmapResource(const Common::String &Filename); + bool initBitmapResource(const Common::String &filename); }; } // End of namespace Sword25 diff --git a/engines/sword25/gfx/text.cpp b/engines/sword25/gfx/text.cpp index 15f0bb9c74..1b0c3a78f0 100644 --- a/engines/sword25/gfx/text.cpp +++ b/engines/sword25/gfx/text.cpp @@ -66,7 +66,7 @@ const uint AUTO_WRAP_THRESHOLD_DEFAULT = 300; Text::Text(RenderObjectPtr ParentPtr) : RenderObject(ParentPtr, RenderObject::TYPE_TEXT), - m_ModulationColor(0xffffffff), + _modulationColor(0xffffffff), m_AutoWrap(false), m_AutoWrapThreshold(AUTO_WRAP_THRESHOLD_DEFAULT) { @@ -76,7 +76,7 @@ Text::Text(RenderObjectPtr ParentPtr) : Text::Text(InputPersistenceBlock &Reader, RenderObjectPtr ParentPtr, uint Handle) : RenderObject(ParentPtr, TYPE_TEXT, Handle) { - m_InitSuccess = Unpersist(Reader); + _initSuccess = unpersist(Reader); } // ----------------------------------------------------------------------------- @@ -86,7 +86,7 @@ bool Text::SetFont(const Common::String &Font) { if (GetResourceManager()->PrecacheResource(Font)) { m_Font = Font; UpdateFormat(); - ForceRefresh(); + forceRefresh(); return true; } else { BS_LOG_ERRORLN("Could not precache font \"%s\". Font probably does not exist.", Font.c_str()); @@ -100,27 +100,27 @@ bool Text::SetFont(const Common::String &Font) { void Text::SetText(const Common::String &text) { m_Text = text; UpdateFormat(); - ForceRefresh(); + forceRefresh(); } // ----------------------------------------------------------------------------- -void Text::SetColor(uint ModulationColor) { - uint NewModulationColor = (ModulationColor & 0x00ffffff) | (m_ModulationColor & 0xff000000); - if (NewModulationColor != m_ModulationColor) { - m_ModulationColor = NewModulationColor; - ForceRefresh(); +void Text::setColor(uint modulationColor) { + uint newModulationColor = (modulationColor & 0x00ffffff) | (_modulationColor & 0xff000000); + if (newModulationColor != _modulationColor) { + _modulationColor = newModulationColor; + forceRefresh(); } } // ----------------------------------------------------------------------------- -void Text::SetAlpha(int Alpha) { - BS_ASSERT(Alpha >= 0 && Alpha < 256); - uint NewModulationColor = (m_ModulationColor & 0x00ffffff) | Alpha << 24; - if (NewModulationColor != m_ModulationColor) { - m_ModulationColor = NewModulationColor; - ForceRefresh(); +void Text::setAlpha(int alpha) { + BS_ASSERT(alpha >= 0 && alpha < 256); + uint newModulationColor = (_modulationColor & 0x00ffffff) | alpha << 24; + if (newModulationColor != _modulationColor) { + _modulationColor = newModulationColor; + forceRefresh(); } } @@ -130,7 +130,7 @@ void Text::SetAutoWrap(bool AutoWrap) { if (AutoWrap != m_AutoWrap) { m_AutoWrap = AutoWrap; UpdateFormat(); - ForceRefresh(); + forceRefresh(); } } @@ -140,13 +140,13 @@ void Text::SetAutoWrapThreshold(uint AutoWrapThreshold) { if (AutoWrapThreshold != m_AutoWrapThreshold) { m_AutoWrapThreshold = AutoWrapThreshold; UpdateFormat(); - ForceRefresh(); + forceRefresh(); } } // ----------------------------------------------------------------------------- -bool Text::DoRender() { +bool Text::doRender() { // Font-Resource locken. FontResource *FontPtr = LockFontResource(); if (!FontPtr) return false; @@ -177,11 +177,11 @@ bool Text::DoRender() { for (; Iter != m_Lines.end(); ++Iter) { // Feststellen, ob überhaupt Buchstaben der aktuellen Zeile vom Update betroffen sind. Common::Rect CheckRect = (*Iter).BBox; - CheckRect.translate(m_AbsoluteX, m_AbsoluteY); + CheckRect.translate(_absoluteX, _absoluteY); // Jeden Buchstaben einzeln Rendern. - int CurX = m_AbsoluteX + (*Iter).BBox.left; - int CurY = m_AbsoluteY + (*Iter).BBox.top; + int CurX = _absoluteX + (*Iter).BBox.left; + int CurY = _absoluteY + (*Iter).BBox.top; for (uint i = 0; i < (*Iter).Text.size(); ++i) { Common::Rect CurRect = FontPtr->GetCharacterRect((byte)(*Iter).Text[i]); @@ -189,7 +189,7 @@ bool Text::DoRender() { int RenderX = CurX + (RenderRect.left - RenderRect.left); int RenderY = CurY + (RenderRect.top - RenderRect.top); RenderRect.translate(CurRect.left - CurX, CurRect.top - CurY); - Result = CharMapPtr->Blit(RenderX, RenderY, Image::FLIP_NONE, &RenderRect, m_ModulationColor); + Result = CharMapPtr->blit(RenderX, RenderY, Image::FLIP_NONE, &RenderRect, _modulationColor); if (!Result) break; CurX += CurRect.width() + FontPtr->GetGapWidth(); @@ -197,10 +197,10 @@ bool Text::DoRender() { } // Charactermap-Resource freigeben. - CharMapPtr->Release(); + CharMapPtr->release(); // Font-Resource freigeben. - FontPtr->Release(); + FontPtr->release(); return Result; } @@ -245,8 +245,8 @@ void Text::UpdateFormat() { UpdateMetrics(*FontPtr); m_Lines.resize(1); - if (m_AutoWrap && (uint) m_Width >= m_AutoWrapThreshold && m_Text.size() >= 2) { - m_Width = 0; + if (m_AutoWrap && (uint) _width >= m_AutoWrapThreshold && m_Text.size() >= 2) { + _width = 0; uint CurLineWidth = 0; uint CurLineHeight = 0; uint CurLine = 0; @@ -283,7 +283,7 @@ void Text::UpdateFormat() { m_Lines[CurLine].BBox.right = CurLineWidth; m_Lines[CurLine].BBox.bottom = CurLineHeight; - if ((uint) m_Width < CurLineWidth) m_Width = CurLineWidth; + if ((uint) _width < CurLineWidth) _width = CurLineWidth; if (LastSpace < m_Text.size()) { ++CurLine; @@ -296,36 +296,36 @@ void Text::UpdateFormat() { } // Bounding-Box der einzelnen Zeilen relativ zur ersten festlegen (vor allem zentrieren). - m_Height = 0; + _height = 0; Common::Array::iterator Iter = m_Lines.begin(); for (; Iter != m_Lines.end(); ++Iter) { Common::Rect &BBox = (*Iter).BBox; - BBox.left = (m_Width - BBox.right) / 2; + BBox.left = (_width - BBox.right) / 2; BBox.right = BBox.left + BBox.right; BBox.top = (Iter - m_Lines.begin()) * FontPtr->GetLineHeight(); BBox.bottom = BBox.top + BBox.bottom; - m_Height += BBox.height(); + _height += BBox.height(); } } else { // Keine automatische Formatierung, also wird der gesamte Text in nur eine Zeile kopiert. m_Lines[0].Text = m_Text; - m_Lines[0].BBox = Common::Rect(0, 0, m_Width, m_Height); + m_Lines[0].BBox = Common::Rect(0, 0, _width, _height); } - FontPtr->Release(); + FontPtr->release(); } // ----------------------------------------------------------------------------- void Text::UpdateMetrics(FontResource &FontResource) { - m_Width = 0; - m_Height = 0; + _width = 0; + _height = 0; for (uint i = 0; i < m_Text.size(); ++i) { const Common::Rect &CurRect = FontResource.GetCharacterRect((byte)m_Text[i]); - m_Width += CurRect.width(); - if (i != m_Text.size() - 1) m_Width += FontResource.GetGapWidth(); - if (m_Height < CurRect.height()) m_Height = CurRect.height(); + _width += CurRect.width(); + if (i != m_Text.size() - 1) _width += FontResource.GetGapWidth(); + if (_height < CurRect.height()) _height = CurRect.height(); } } @@ -333,52 +333,52 @@ void Text::UpdateMetrics(FontResource &FontResource) { // Persistenz // ----------------------------------------------------------------------------- -bool Text::Persist(OutputPersistenceBlock &Writer) { - bool Result = true; +bool Text::persist(OutputPersistenceBlock &writer) { + bool result = true; - Result &= RenderObject::Persist(Writer); + result &= RenderObject::persist(writer); - Writer.Write(m_ModulationColor); - Writer.Write(m_Font); - Writer.Write(m_Text); - Writer.Write(m_AutoWrap); - Writer.Write(m_AutoWrapThreshold); + writer.write(_modulationColor); + writer.write(m_Font); + writer.write(m_Text); + writer.write(m_AutoWrap); + writer.write(m_AutoWrapThreshold); - Result &= RenderObject::PersistChildren(Writer); + result &= RenderObject::persistChildren(writer); - return Result; + return result; } -bool Text::Unpersist(InputPersistenceBlock &Reader) { - bool Result = true; +bool Text::unpersist(InputPersistenceBlock &reader) { + bool result = true; - Result &= RenderObject::Unpersist(Reader); + result &= RenderObject::unpersist(reader); // Farbe und Alpha einlesen. - Reader.Read(m_ModulationColor); + reader.read(_modulationColor); // Beim Laden der anderen Member werden die Set-Methoden benutzt statt der tatsächlichen Member. // So wird das Layout automatisch aktualisiert und auch alle anderen notwendigen Methoden ausgeführt. Common::String Font; - Reader.Read(Font); + reader.read(Font); SetFont(Font); Common::String text; - Reader.Read(text); + reader.read(text); SetText(text); bool AutoWrap; - Reader.Read(AutoWrap); + reader.read(AutoWrap); SetAutoWrap(AutoWrap); uint AutoWrapThreshold; - Reader.Read(AutoWrapThreshold); + reader.read(AutoWrapThreshold); SetAutoWrapThreshold(AutoWrapThreshold); - Result &= RenderObject::UnpersistChildren(Reader); + result &= RenderObject::unpersistChildren(reader); - return Reader.IsGood() && Result; + return reader.isGood() && result; } } // End of namespace Sword25 diff --git a/engines/sword25/gfx/text.h b/engines/sword25/gfx/text.h index 126f7ad0d6..ed3a83e630 100644 --- a/engines/sword25/gfx/text.h +++ b/engines/sword25/gfx/text.h @@ -78,7 +78,7 @@ public: @brief Setzt den Alphawert des Textes. @param Alpha der neue Alphawert des Textes (0 = keine Deckung, 255 = volle Deckung). */ - void SetAlpha(int Alpha); + void setAlpha(int alpha); /** @brief Legt fest, ob der Text automatisch umgebrochen werden soll. @@ -115,22 +115,22 @@ public: @brief Setzt die Farbe des Textes. @param Color eine 24-Bit RGB Farbe, die die Farbe des Textes festlegt. */ - void SetColor(uint ModulationColor); + void setColor(uint modulationColor); /** @brief Gibt den Alphawert des Textes zurück. @return Der Alphawert des Textes (0 = keine Deckung, 255 = volle Deckung). */ - int GetAlpha() const { - return m_ModulationColor >> 24; + int getAlpha() const { + return _modulationColor >> 24; } /** @brief Gibt die Farbe des Textes zurück. @return Eine 24-Bit RGB Farbe, die die Farbe des Textes angibt. */ - int GetColor() const { - return m_ModulationColor & 0x00ffffff; + int getColor() const { + return _modulationColor & 0x00ffffff; } /** @@ -147,17 +147,17 @@ public: return m_AutoWrapThreshold; } - virtual bool Persist(OutputPersistenceBlock &Writer); - virtual bool Unpersist(InputPersistenceBlock &Reader); + virtual bool persist(OutputPersistenceBlock &writer); + virtual bool unpersist(InputPersistenceBlock &reader); protected: - virtual bool DoRender(); + virtual bool doRender(); private: Text(RenderObjectPtr ParentPtr); Text(InputPersistenceBlock &Reader, RenderObjectPtr ParentPtr, uint Handle); - uint m_ModulationColor; + uint _modulationColor; Common::String m_Font; Common::String m_Text; bool m_AutoWrap; diff --git a/engines/sword25/gfx/timedrenderobject.cpp b/engines/sword25/gfx/timedrenderobject.cpp index 363aa912b8..aa6ffe7dc8 100644 --- a/engines/sword25/gfx/timedrenderobject.cpp +++ b/engines/sword25/gfx/timedrenderobject.cpp @@ -42,15 +42,15 @@ namespace Sword25 { // Konstruktion / Destruktion // ----------------------------------------------------------------------------- -TimedRenderObject::TimedRenderObject(RenderObjectPtr pParent, TYPES Type, uint Handle) : - RenderObject(pParent, Type, Handle) { - BS_ASSERT(GetManager()); - GetManager()->AttatchTimedRenderObject(this->GetHandle()); +TimedRenderObject::TimedRenderObject(RenderObjectPtr pParent, TYPES type, uint handle) : + RenderObject(pParent, type, handle) { + BS_ASSERT(getManager()); + getManager()->attatchTimedRenderObject(this->getHandle()); } TimedRenderObject::~TimedRenderObject() { - BS_ASSERT(GetManager()); - GetManager()->DetatchTimedRenderObject(this->GetHandle()); + BS_ASSERT(getManager()); + getManager()->detatchTimedRenderObject(this->getHandle()); } } // End of namespace Sword25 diff --git a/engines/sword25/gfx/timedrenderobject.h b/engines/sword25/gfx/timedrenderobject.h index 0b4e58fdee..2a5335cb2b 100644 --- a/engines/sword25/gfx/timedrenderobject.h +++ b/engines/sword25/gfx/timedrenderobject.h @@ -59,7 +59,7 @@ namespace Sword25 { class TimedRenderObject : public RenderObject { public: - TimedRenderObject(RenderObjectPtr pParent, TYPES Type, uint Handle = 0); + TimedRenderObject(RenderObjectPtr pParent, TYPES type, uint handle = 0); ~TimedRenderObject(); /** @@ -69,7 +69,7 @@ public: ihren Zustand Zeitabhängig zu verändern (z.B. Animationen).
@param int TimeElapsed gibt an wie viel Zeit (in Microsekunden) seit dem letzten Frame vergangen ist. */ - virtual void FrameNotification(int TimeElapsed) = 0; + virtual void frameNotification(int timeElapsed) = 0; }; } // End of namespace Sword25 diff --git a/engines/sword25/input/scummvminput.cpp b/engines/sword25/input/scummvminput.cpp index 0b8f4fbb66..34763b0125 100644 --- a/engines/sword25/input/scummvminput.cpp +++ b/engines/sword25/input/scummvminput.cpp @@ -335,27 +335,27 @@ void ScummVMInput::ReportCommand(KEY_COMMANDS Command) { // Persistenz // ----------------------------------------------------------------------------- -bool ScummVMInput::Persist(OutputPersistenceBlock &Writer) { +bool ScummVMInput::persist(OutputPersistenceBlock &writer) { // Anzahl an Command-Callbacks persistieren. - Writer.Write(m_CommandCallbacks.size()); + writer.write(m_CommandCallbacks.size()); // Alle Command-Callbacks einzeln persistieren. { Common::List::const_iterator It = m_CommandCallbacks.begin(); while (It != m_CommandCallbacks.end()) { - Writer.Write(CallbackRegistry::getInstance().resolveCallbackPointer(*It)); + writer.write(CallbackRegistry::getInstance().resolveCallbackPointer(*It)); ++It; } } // Anzahl an Character-Callbacks persistieren. - Writer.Write(m_CharacterCallbacks.size()); + writer.write(m_CharacterCallbacks.size()); // Alle Character-Callbacks einzeln persistieren. { Common::List::const_iterator It = m_CharacterCallbacks.begin(); while (It != m_CharacterCallbacks.end()) { - Writer.Write(CallbackRegistry::getInstance().resolveCallbackPointer(*It)); + writer.write(CallbackRegistry::getInstance().resolveCallbackPointer(*It)); ++It; } } @@ -365,18 +365,18 @@ bool ScummVMInput::Persist(OutputPersistenceBlock &Writer) { // ----------------------------------------------------------------------------- -bool ScummVMInput::Unpersist(InputPersistenceBlock &Reader) { +bool ScummVMInput::unpersist(InputPersistenceBlock &reader) { // Command-Callbackliste leeren. m_CommandCallbacks.clear(); // Anzahl an Command-Callbacks lesen. uint CommandCallbackCount; - Reader.Read(CommandCallbackCount); + reader.read(CommandCallbackCount); // Alle Command-Callbacks wieder herstellen. for (uint i = 0; i < CommandCallbackCount; ++i) { Common::String CallbackFunctionName; - Reader.Read(CallbackFunctionName); + reader.read(CallbackFunctionName); m_CommandCallbacks.push_back(reinterpret_cast( CallbackRegistry::getInstance().resolveCallbackFunction(CallbackFunctionName))); @@ -387,17 +387,17 @@ bool ScummVMInput::Unpersist(InputPersistenceBlock &Reader) { // Anzahl an Character-Callbacks lesen. uint CharacterCallbackCount; - Reader.Read(CharacterCallbackCount); + reader.read(CharacterCallbackCount); // Alle Character-Callbacks wieder herstellen. for (uint i = 0; i < CharacterCallbackCount; ++i) { Common::String CallbackFunctionName; - Reader.Read(CallbackFunctionName); + reader.read(CallbackFunctionName); m_CharacterCallbacks.push_back(reinterpret_cast(CallbackRegistry::getInstance().resolveCallbackFunction(CallbackFunctionName))); } - return Reader.IsGood(); + return reader.isGood(); } } // End of namespace Sword25 diff --git a/engines/sword25/input/scummvminput.h b/engines/sword25/input/scummvminput.h index 23ab179a64..dcb6b8733f 100644 --- a/engines/sword25/input/scummvminput.h +++ b/engines/sword25/input/scummvminput.h @@ -72,8 +72,8 @@ public: virtual void ReportCharacter(byte Character); virtual void ReportCommand(KEY_COMMANDS Command); - bool Persist(OutputPersistenceBlock &Writer); - bool Unpersist(InputPersistenceBlock &Reader); + bool persist(OutputPersistenceBlock &writer); + bool unpersist(InputPersistenceBlock &reader); private: void TestForLeftDoubleClick(); diff --git a/engines/sword25/kernel/inputpersistenceblock.cpp b/engines/sword25/kernel/inputpersistenceblock.cpp index cbf2e5b1f9..b51b1037a7 100644 --- a/engines/sword25/kernel/inputpersistenceblock.cpp +++ b/engines/sword25/kernel/inputpersistenceblock.cpp @@ -62,15 +62,15 @@ InputPersistenceBlock::~InputPersistenceBlock() { // Reading // ----------------------------------------------------------------------------- -void InputPersistenceBlock::Read(int16 &Value) { +void InputPersistenceBlock::read(int16 &Value) { signed int v; - Read(v); + read(v); Value = static_cast(v); } // ----------------------------------------------------------------------------- -void InputPersistenceBlock::Read(signed int &Value) { +void InputPersistenceBlock::read(signed int &Value) { if (CheckMarker(SINT_MARKER)) { RawRead(&Value, sizeof(signed int)); Value = ConvertEndianessFromStorageToSystem(Value); @@ -81,7 +81,7 @@ void InputPersistenceBlock::Read(signed int &Value) { // ----------------------------------------------------------------------------- -void InputPersistenceBlock::Read(uint &Value) { +void InputPersistenceBlock::read(uint &Value) { if (CheckMarker(UINT_MARKER)) { RawRead(&Value, sizeof(uint)); Value = ConvertEndianessFromStorageToSystem(Value); @@ -92,7 +92,7 @@ void InputPersistenceBlock::Read(uint &Value) { // ----------------------------------------------------------------------------- -void InputPersistenceBlock::Read(float &Value) { +void InputPersistenceBlock::read(float &Value) { if (CheckMarker(FLOAT_MARKER)) { RawRead(&Value, sizeof(float)); Value = ConvertEndianessFromStorageToSystem(Value); @@ -103,7 +103,7 @@ void InputPersistenceBlock::Read(float &Value) { // ----------------------------------------------------------------------------- -void InputPersistenceBlock::Read(bool &Value) { +void InputPersistenceBlock::read(bool &Value) { if (CheckMarker(BOOL_MARKER)) { uint UIntBool; RawRead(&UIntBool, sizeof(float)); @@ -116,12 +116,12 @@ void InputPersistenceBlock::Read(bool &Value) { // ----------------------------------------------------------------------------- -void InputPersistenceBlock::Read(Common::String &Value) { +void InputPersistenceBlock::read(Common::String &Value) { Value = ""; if (CheckMarker(STRING_MARKER)) { uint Size; - Read(Size); + read(Size); if (CheckBlockSize(Size)) { Value = Common::String(reinterpret_cast(&*m_Iter), Size); @@ -132,10 +132,10 @@ void InputPersistenceBlock::Read(Common::String &Value) { // ----------------------------------------------------------------------------- -void InputPersistenceBlock::Read(Common::Array &Value) { +void InputPersistenceBlock::read(Common::Array &Value) { if (CheckMarker(BLOCK_MARKER)) { uint Size; - Read(Size); + read(Size); if (CheckBlockSize(Size)) { Value = Common::Array(m_Iter, Size); @@ -168,7 +168,7 @@ bool InputPersistenceBlock::CheckBlockSize(int Size) { // ----------------------------------------------------------------------------- bool InputPersistenceBlock::CheckMarker(byte Marker) { - if (!IsGood() || !CheckBlockSize(1)) return false; + if (!isGood() || !CheckBlockSize(1)) return false; if (*m_Iter++ == Marker) { return true; diff --git a/engines/sword25/kernel/inputpersistenceblock.h b/engines/sword25/kernel/inputpersistenceblock.h index 3e39a69918..a6978e5899 100644 --- a/engines/sword25/kernel/inputpersistenceblock.h +++ b/engines/sword25/kernel/inputpersistenceblock.h @@ -60,15 +60,15 @@ public: InputPersistenceBlock(const void *Data, uint DataLength); virtual ~InputPersistenceBlock(); - void Read(int16 &Value); - void Read(signed int &Value); - void Read(uint &Value); - void Read(float &Value); - void Read(bool &Value); - void Read(Common::String &Value); - void Read(Common::Array &Value); - - bool IsGood() const { + void read(int16 &Value); + void read(signed int &Value); + void read(uint &Value); + void read(float &Value); + void read(bool &Value); + void read(Common::String &Value); + void read(Common::Array &Value); + + bool isGood() const { return m_ErrorState == NONE; } ErrorState GetErrorState() const { diff --git a/engines/sword25/kernel/objectregistry.h b/engines/sword25/kernel/objectregistry.h index 3e80ec9321..0ae3915edb 100644 --- a/engines/sword25/kernel/objectregistry.h +++ b/engines/sword25/kernel/objectregistry.h @@ -129,7 +129,7 @@ public: // ----------------------------------------------------------------------------- - T *ResolveHandle(uint Handle) { + T *resolveHandle(uint Handle) { // Zum Handle gehöriges Objekt in der Hash-Map finden. T *ObjectPtr = FindPtrByHandle(Handle); diff --git a/engines/sword25/kernel/outputpersistenceblock.cpp b/engines/sword25/kernel/outputpersistenceblock.cpp index 0394aa1808..438fa7b222 100644 --- a/engines/sword25/kernel/outputpersistenceblock.cpp +++ b/engines/sword25/kernel/outputpersistenceblock.cpp @@ -62,7 +62,7 @@ OutputPersistenceBlock::OutputPersistenceBlock() { // Writing // ----------------------------------------------------------------------------- -void OutputPersistenceBlock::Write(signed int Value) { +void OutputPersistenceBlock::write(signed int Value) { WriteMarker(SINT_MARKER); Value = ConvertEndianessFromSystemToStorage(Value); RawWrite(&Value, sizeof(Value)); @@ -70,7 +70,7 @@ void OutputPersistenceBlock::Write(signed int Value) { // ----------------------------------------------------------------------------- -void OutputPersistenceBlock::Write(uint Value) { +void OutputPersistenceBlock::write(uint Value) { WriteMarker(UINT_MARKER); Value = ConvertEndianessFromSystemToStorage(Value); RawWrite(&Value, sizeof(Value)); @@ -78,7 +78,7 @@ void OutputPersistenceBlock::Write(uint Value) { // ----------------------------------------------------------------------------- -void OutputPersistenceBlock::Write(float Value) { +void OutputPersistenceBlock::write(float Value) { WriteMarker(FLOAT_MARKER); Value = ConvertEndianessFromSystemToStorage(Value); RawWrite(&Value, sizeof(Value)); @@ -86,7 +86,7 @@ void OutputPersistenceBlock::Write(float Value) { // ----------------------------------------------------------------------------- -void OutputPersistenceBlock::Write(bool Value) { +void OutputPersistenceBlock::write(bool Value) { WriteMarker(BOOL_MARKER); uint UIntBool = Value ? 1 : 0; @@ -96,19 +96,19 @@ void OutputPersistenceBlock::Write(bool Value) { // ----------------------------------------------------------------------------- -void OutputPersistenceBlock::Write(const Common::String &String) { +void OutputPersistenceBlock::write(const Common::String &String) { WriteMarker(STRING_MARKER); - Write(String.size()); + write(String.size()); RawWrite(String.c_str(), String.size()); } // ----------------------------------------------------------------------------- -void OutputPersistenceBlock::Write(const void *BufferPtr, size_t Size) { +void OutputPersistenceBlock::write(const void *BufferPtr, size_t Size) { WriteMarker(BLOCK_MARKER); - Write(Size); + write(Size); RawWrite(BufferPtr, Size); } diff --git a/engines/sword25/kernel/outputpersistenceblock.h b/engines/sword25/kernel/outputpersistenceblock.h index fab0552d31..154dbc9763 100644 --- a/engines/sword25/kernel/outputpersistenceblock.h +++ b/engines/sword25/kernel/outputpersistenceblock.h @@ -52,12 +52,12 @@ class OutputPersistenceBlock : public PersistenceBlock { public: OutputPersistenceBlock(); - void Write(signed int Value); - void Write(uint Value); - void Write(float Value); - void Write(bool Value); - void Write(const Common::String &String); - void Write(const void *BufferPtr, size_t Size); + void write(signed int Value); + void write(uint Value); + void write(float Value); + void write(bool Value); + void write(const Common::String &String); + void write(const void *BufferPtr, size_t Size); const void *GetData() const { return &m_Data[0]; diff --git a/engines/sword25/kernel/persistable.h b/engines/sword25/kernel/persistable.h index 020bd2477c..fc314688d5 100644 --- a/engines/sword25/kernel/persistable.h +++ b/engines/sword25/kernel/persistable.h @@ -44,8 +44,8 @@ class Persistable { public: virtual ~Persistable() {}; - virtual bool Persist(OutputPersistenceBlock &Writer) = 0; - virtual bool Unpersist(InputPersistenceBlock &Reader) = 0; + virtual bool persist(OutputPersistenceBlock &writer) = 0; + virtual bool unpersist(InputPersistenceBlock &reader) = 0; }; } // End of namespace Sword25 diff --git a/engines/sword25/kernel/persistenceservice.cpp b/engines/sword25/kernel/persistenceservice.cpp index 696f85459e..46e9bbea3b 100644 --- a/engines/sword25/kernel/persistenceservice.cpp +++ b/engines/sword25/kernel/persistenceservice.cpp @@ -318,11 +318,11 @@ bool PersistenceService::SaveGame(uint SlotID, const Common::String &ScreenshotF // Alle notwendigen Module persistieren. OutputPersistenceBlock Writer; bool Success = true; - Success &= Kernel::GetInstance()->GetScript()->Persist(Writer); - Success &= RegionRegistry::GetInstance().Persist(Writer); - Success &= Kernel::GetInstance()->GetGfx()->Persist(Writer); - Success &= Kernel::GetInstance()->GetSfx()->Persist(Writer); - Success &= Kernel::GetInstance()->GetInput()->Persist(Writer); + Success &= Kernel::GetInstance()->GetScript()->persist(Writer); + Success &= RegionRegistry::GetInstance().persist(Writer); + Success &= Kernel::GetInstance()->GetGfx()->persist(Writer); + Success &= Kernel::GetInstance()->GetSfx()->persist(Writer); + Success &= Kernel::GetInstance()->GetInput()->persist(Writer); if (!Success) { error("Unable to persist modules for savegame file \"%s\".", Filename.c_str()); } @@ -433,12 +433,12 @@ bool PersistenceService::LoadGame(uint SlotID) { // Einzelne Engine-Module depersistieren. bool Success = true; - Success &= Kernel::GetInstance()->GetScript()->Unpersist(Reader); + Success &= Kernel::GetInstance()->GetScript()->unpersist(Reader); // Muss unbedingt nach Script passieren. Da sonst die bereits wiederhergestellten Regions per Garbage-Collection gekillt werden. - Success &= RegionRegistry::GetInstance().Unpersist(Reader); - Success &= Kernel::GetInstance()->GetGfx()->Unpersist(Reader); - Success &= Kernel::GetInstance()->GetSfx()->Unpersist(Reader); - Success &= Kernel::GetInstance()->GetInput()->Unpersist(Reader); + Success &= RegionRegistry::GetInstance().unpersist(Reader); + Success &= Kernel::GetInstance()->GetGfx()->unpersist(Reader); + Success &= Kernel::GetInstance()->GetSfx()->unpersist(Reader); + Success &= Kernel::GetInstance()->GetInput()->unpersist(Reader); delete[] CompressedDataBuffer; delete[] UncompressedDataBuffer; diff --git a/engines/sword25/kernel/resmanager.cpp b/engines/sword25/kernel/resmanager.cpp index 59f1034704..a671f9568d 100644 --- a/engines/sword25/kernel/resmanager.cpp +++ b/engines/sword25/kernel/resmanager.cpp @@ -50,11 +50,11 @@ ResourceManager::~ResourceManager() { // All remaining resources are not released, so print warnings and release Common::List::iterator Iter = m_Resources.begin(); for (; Iter != m_Resources.end(); ++Iter) { - BS_LOG_WARNINGLN("Resource \"%s\" was not released.", (*Iter)->GetFileName().c_str()); + BS_LOG_WARNINGLN("Resource \"%s\" was not released.", (*Iter)->getFileName().c_str()); // Set the lock count to zero while ((*Iter)->GetLockCount() > 0) { - (*Iter)->Release(); + (*Iter)->release(); }; // Delete the resource @@ -208,11 +208,11 @@ bool ResourceManager::PrecacheResource(const Common::String &FileName, bool Forc */ void ResourceManager::MoveToFront(Resource *pResource) { // Erase the resource from it's current position - m_Resources.erase(pResource->_Iterator); + m_Resources.erase(pResource->_iterator); // Re-add the resource at the front of the list m_Resources.push_front(pResource); // Reset the resource iterator to the repositioned item - pResource->_Iterator = m_Resources.begin(); + pResource->_iterator = m_Resources.begin(); } /** @@ -237,7 +237,7 @@ Resource *ResourceManager::LoadResource(const Common::String &FileName) { // Add the resource to the front of the list m_Resources.push_front(pResource); - pResource->_Iterator = m_Resources.begin(); + pResource->_iterator = m_Resources.begin(); // Also store the resource in the hash table for quick lookup m_ResourceHashTable[pResource->GetFileNameHash() % HASH_TABLE_BUCKETS].push_front(pResource); @@ -280,7 +280,7 @@ Common::List::iterator ResourceManager::DeleteResource(Resource *pRe Resource *pDummy = pResource; // Delete the resource from the resource list - Common::List::iterator Result = m_Resources.erase(pResource->_Iterator); + Common::List::iterator Result = m_Resources.erase(pResource->_iterator); // Delete the resource delete(pDummy); @@ -302,7 +302,7 @@ Resource *ResourceManager::GetResource(const Common::String &UniqueFileName) con Common::List::const_iterator Iter = HashBucket.begin(); for (; Iter != HashBucket.end(); ++Iter) { // Wenn die Resource gefunden wurde wird sie zurückgegeben. - if ((*Iter)->GetFileName() == UniqueFileName) + if ((*Iter)->getFileName() == UniqueFileName) return *Iter; } } @@ -317,7 +317,7 @@ Resource *ResourceManager::GetResource(const Common::String &UniqueFileName) con void ResourceManager::DumpLockedResources() { for (Common::List::iterator Iter = m_Resources.begin(); Iter != m_Resources.end(); ++Iter) { if ((*Iter)->GetLockCount() > 0) { - BS_LOGLN("%s", (*Iter)->GetFileName().c_str()); + BS_LOGLN("%s", (*Iter)->getFileName().c_str()); } } } diff --git a/engines/sword25/kernel/resource.cpp b/engines/sword25/kernel/resource.cpp index 9456270034..813ee54cd3 100644 --- a/engines/sword25/kernel/resource.cpp +++ b/engines/sword25/kernel/resource.cpp @@ -41,20 +41,20 @@ namespace Sword25 { #define BS_LOG_PREFIX "RESOURCE" -Resource::Resource(const Common::String &FileName, RESOURCE_TYPES Type) : - _Type(Type), - _RefCount(0) { +Resource::Resource(const Common::String &fileName, RESOURCE_TYPES type) : + _type(type), + _refCount(0) { BS_ASSERT(Kernel::GetInstance()->GetService("package")); - _FileName = static_cast(Kernel::GetInstance()->GetService("package"))->GetAbsolutePath(FileName); - _FileNameHash = BS_String::GetHash(FileName); + _fileName = static_cast(Kernel::GetInstance()->GetService("package"))->GetAbsolutePath(fileName); + _fileNameHash = BS_String::GetHash(fileName); } -void Resource::Release() { - if (_RefCount) { - --_RefCount; +void Resource::release() { + if (_refCount) { + --_refCount; } else - BS_LOG_WARNINGLN("Released unlocked resource \"%s\".", _FileName.c_str()); + BS_LOG_WARNINGLN("Released unlocked resource \"%s\".", _fileName.c_str()); } } // End of namespace Sword25 diff --git a/engines/sword25/kernel/resource.h b/engines/sword25/kernel/resource.h index a78129666e..2a4d197138 100644 --- a/engines/sword25/kernel/resource.h +++ b/engines/sword25/kernel/resource.h @@ -56,14 +56,14 @@ public: TYPE_FONT }; - Resource(const Common::String &UniqueFileName, RESOURCE_TYPES Type); + Resource(const Common::String &uniqueFileName, RESOURCE_TYPES type); /** * Prevents the resource from being released. * @remarks This method allows a resource to be locked multiple times. **/ void AddReference() { - ++_RefCount; + ++_refCount; } /** @@ -71,46 +71,46 @@ public: * @remarks The resource can still be released more times than it was 'locked', although it is * not recommended. **/ - void Release(); + void release(); /** * Returns the current lock count for the resource * @return The current lock count **/ int GetLockCount() const { - return _RefCount; + return _refCount; } /** * Returns the absolute path of the given resource */ - const Common::String &GetFileName() const { - return _FileName; + const Common::String &getFileName() const { + return _fileName; } /** * Returns the hash of the filename of a resource */ uint GetFileNameHash() const { - return _FileNameHash; + return _fileNameHash; } /** * Returns a resource's type */ uint GetType() const { - return _Type; + return _type; } protected: virtual ~Resource() {}; private: - Common::String _FileName; ///< The absolute filename - uint _FileNameHash; ///< The hash value of the filename - uint _RefCount; ///< The number of locks - uint _Type; ///< The type of the resource - Common::List::iterator _Iterator; ///< Points to the resource position in the LRU list + Common::String _fileName; ///< The absolute filename + uint _fileNameHash; ///< The hash value of the filename + uint _refCount; ///< The number of locks + uint _type; ///< The type of the resource + Common::List::iterator _iterator; ///< Points to the resource position in the LRU list }; } // End of namespace Sword25 diff --git a/engines/sword25/math/geometry_script.cpp b/engines/sword25/math/geometry_script.cpp index 8160199c4d..e8de73b7c7 100644 --- a/engines/sword25/math/geometry_script.cpp +++ b/engines/sword25/math/geometry_script.cpp @@ -221,7 +221,7 @@ static uint TableRegionToRegion(lua_State *L, const char *ClassName) { case LUA_TNUMBER: { Polygon polygon; TablePolygonToPolygon(L, polygon); - RegionRegistry::GetInstance().ResolveHandle(RegionHandle)->Init(polygon); + RegionRegistry::GetInstance().resolveHandle(RegionHandle)->Init(polygon); } break; @@ -233,7 +233,7 @@ static uint TableRegionToRegion(lua_State *L, const char *ClassName) { int PolygonCount = luaL_getn(L, -1); if (PolygonCount == 1) - RegionRegistry::GetInstance().ResolveHandle(RegionHandle)->Init(polygon); + RegionRegistry::GetInstance().resolveHandle(RegionHandle)->Init(polygon); else { Common::Array Holes; Holes.reserve(PolygonCount - 1); @@ -246,7 +246,7 @@ static uint TableRegionToRegion(lua_State *L, const char *ClassName) { } BS_ASSERT((int)Holes.size() == PolygonCount - 1); - RegionRegistry::GetInstance().ResolveHandle(RegionHandle)->Init(polygon, &Holes); + RegionRegistry::GetInstance().resolveHandle(RegionHandle)->Init(polygon, &Holes); } } break; @@ -309,7 +309,7 @@ static Region *CheckRegion(lua_State *L) { uint *RegionHandlePtr; if ((RegionHandlePtr = reinterpret_cast(my_checkudata(L, 1, REGION_CLASS_NAME))) != 0 || (RegionHandlePtr = reinterpret_cast(my_checkudata(L, 1, WALKREGION_CLASS_NAME))) != 0) { - return RegionRegistry::GetInstance().ResolveHandle(*RegionHandlePtr); + return RegionRegistry::GetInstance().resolveHandle(*RegionHandlePtr); } else { luaL_argcheck(L, 0, 1, "'" REGION_CLASS_NAME "' expected"); } @@ -492,7 +492,7 @@ static WalkRegion *CheckWalkRegion(lua_State *L) { // The first parameter must be of type 'userdate', and the Metatable class Geo.WalkRegion uint RegionHandle; if ((RegionHandle = *reinterpret_cast(my_checkudata(L, 1, WALKREGION_CLASS_NAME))) != 0) { - return reinterpret_cast(RegionRegistry::GetInstance().ResolveHandle(RegionHandle)); + return reinterpret_cast(RegionRegistry::GetInstance().resolveHandle(RegionHandle)); } else { luaL_argcheck(L, 0, 1, "'" WALKREGION_CLASS_NAME "' expected"); } diff --git a/engines/sword25/math/polygon.cpp b/engines/sword25/math/polygon.cpp index a775c75b16..9fcfd50158 100644 --- a/engines/sword25/math/polygon.cpp +++ b/engines/sword25/math/polygon.cpp @@ -59,7 +59,7 @@ Polygon::Polygon(const Polygon &Other) : VertexCount(0), Vertecies(NULL) { } Polygon::Polygon(InputPersistenceBlock &Reader) : VertexCount(0), Vertecies(NULL) { - Unpersist(Reader); + unpersist(Reader); } Polygon::~Polygon() { @@ -414,31 +414,31 @@ bool Polygon::IsPointInPolygon(const Vertex &Point, bool EdgesBelongToPolygon) c else return false; } -bool Polygon::Persist(OutputPersistenceBlock &Writer) { - Writer.Write(VertexCount); +bool Polygon::persist(OutputPersistenceBlock &writer) { + writer.write(VertexCount); for (int i = 0; i < VertexCount; ++i) { - Writer.Write(Vertecies[i].X); - Writer.Write(Vertecies[i].Y); + writer.write(Vertecies[i].X); + writer.write(Vertecies[i].Y); } return true; } -bool Polygon::Unpersist(InputPersistenceBlock &Reader) { +bool Polygon::unpersist(InputPersistenceBlock &reader) { int StoredVertexCount; - Reader.Read(StoredVertexCount); + reader.read(StoredVertexCount); Common::Array StoredVertecies; for (int i = 0; i < StoredVertexCount; ++i) { int x, y; - Reader.Read(x); - Reader.Read(y); + reader.read(x); + reader.read(y); StoredVertecies.push_back(Vertex(x, y)); } Init(StoredVertexCount, &StoredVertecies[0]); - return Reader.IsGood(); + return reader.isGood(); } // Main Focus diff --git a/engines/sword25/math/polygon.h b/engines/sword25/math/polygon.h index 24592c3376..f84630772d 100644 --- a/engines/sword25/math/polygon.h +++ b/engines/sword25/math/polygon.h @@ -194,8 +194,8 @@ public: /// COntains the Vertecies of the polygon Vertex *Vertecies; - virtual bool Persist(OutputPersistenceBlock &Writer); - virtual bool Unpersist(InputPersistenceBlock &Reader); + virtual bool persist(OutputPersistenceBlock &writer); + virtual bool unpersist(InputPersistenceBlock &reader); private: bool m_IsCW; diff --git a/engines/sword25/math/region.cpp b/engines/sword25/math/region.cpp index 97a49dd2f9..50dc873a2d 100644 --- a/engines/sword25/math/region.cpp +++ b/engines/sword25/math/region.cpp @@ -54,7 +54,7 @@ Region::Region() : m_Valid(false), m_Type(RT_REGION) { Region::Region(InputPersistenceBlock &Reader, uint Handle) : m_Valid(false), m_Type(RT_REGION) { RegionRegistry::GetInstance().RegisterObject(this, Handle); - Unpersist(Reader); + unpersist(Reader); } // ----------------------------------------------------------------------------- @@ -79,17 +79,17 @@ uint Region::Create(REGION_TYPE Type) { // ----------------------------------------------------------------------------- -uint Region::Create(InputPersistenceBlock &Reader, uint Handle) { +uint Region::Create(InputPersistenceBlock &reader, uint Handle) { // Read type uint Type; - Reader.Read(Type); + reader.read(Type); // Depending on the type, create a new BS_Region or BS_WalkRegion object Region *RegionPtr = NULL; if (Type == RT_REGION) { - RegionPtr = new Region(Reader, Handle); + RegionPtr = new Region(reader, Handle); } else if (Type == RT_WALKREGION) { - RegionPtr = new WalkRegion(Reader, Handle); + RegionPtr = new WalkRegion(reader, Handle); } else { BS_ASSERT(false); } @@ -334,49 +334,49 @@ bool Region::IsLineOfSight(const Vertex &a, const Vertex &b) const { // Persistence // ----------------------------------------------------------------------------- -bool Region::Persist(OutputPersistenceBlock &Writer) { +bool Region::persist(OutputPersistenceBlock &writer) { bool Result = true; - Writer.Write(static_cast(m_Type)); - Writer.Write(m_Valid); - Writer.Write(m_Position.X); - Writer.Write(m_Position.Y); + writer.write(static_cast(m_Type)); + writer.write(m_Valid); + writer.write(m_Position.X); + writer.write(m_Position.Y); - Writer.Write(m_Polygons.size()); + writer.write(m_Polygons.size()); Common::Array::iterator It = m_Polygons.begin(); while (It != m_Polygons.end()) { - Result &= It->Persist(Writer); + Result &= It->persist(writer); ++It; } - Writer.Write(m_BoundingBox.left); - Writer.Write(m_BoundingBox.top); - Writer.Write(m_BoundingBox.right); - Writer.Write(m_BoundingBox.bottom); + writer.write(m_BoundingBox.left); + writer.write(m_BoundingBox.top); + writer.write(m_BoundingBox.right); + writer.write(m_BoundingBox.bottom); return Result; } // ----------------------------------------------------------------------------- -bool Region::Unpersist(InputPersistenceBlock &Reader) { - Reader.Read(m_Valid); - Reader.Read(m_Position.X); - Reader.Read(m_Position.Y); +bool Region::unpersist(InputPersistenceBlock &reader) { + reader.read(m_Valid); + reader.read(m_Position.X); + reader.read(m_Position.Y); m_Polygons.clear(); uint PolygonCount; - Reader.Read(PolygonCount); + reader.read(PolygonCount); for (uint i = 0; i < PolygonCount; ++i) { - m_Polygons.push_back(Polygon(Reader)); + m_Polygons.push_back(Polygon(reader)); } - Reader.Read(m_BoundingBox.left); - Reader.Read(m_BoundingBox.top); - Reader.Read(m_BoundingBox.right); - Reader.Read(m_BoundingBox.bottom); + reader.read(m_BoundingBox.left); + reader.read(m_BoundingBox.top); + reader.read(m_BoundingBox.right); + reader.read(m_BoundingBox.bottom); - return Reader.IsGood(); + return reader.isGood(); } // ----------------------------------------------------------------------------- diff --git a/engines/sword25/math/region.h b/engines/sword25/math/region.h index 40d52e38d6..e7c160b223 100644 --- a/engines/sword25/math/region.h +++ b/engines/sword25/math/region.h @@ -200,8 +200,8 @@ public: // Manipulation Methods // - virtual bool Persist(OutputPersistenceBlock &Writer); - virtual bool Unpersist(InputPersistenceBlock &Reader); + virtual bool persist(OutputPersistenceBlock &writer); + virtual bool unpersist(InputPersistenceBlock &reader); protected: /// This specifies the type of object diff --git a/engines/sword25/math/regionregistry.cpp b/engines/sword25/math/regionregistry.cpp index 6be4c1fa2a..4e49963397 100644 --- a/engines/sword25/math/regionregistry.cpp +++ b/engines/sword25/math/regionregistry.cpp @@ -69,23 +69,23 @@ void RegionRegistry::LogWarningLn(const char *Message) const { // ----------------------------------------------------------------------------- -bool RegionRegistry::Persist(OutputPersistenceBlock &Writer) { +bool RegionRegistry::persist(OutputPersistenceBlock &writer) { bool Result = true; - // Write out the next handle - Writer.Write(m_NextHandle); + // write out the next handle + writer.write(m_NextHandle); // Number of regions to write - Writer.Write(m_Handle2PtrMap.size()); + writer.write(m_Handle2PtrMap.size()); // Persist all the BS_Regions HANDLE2PTR_MAP::const_iterator Iter = m_Handle2PtrMap.begin(); while (Iter != m_Handle2PtrMap.end()) { // Handle persistence - Writer.Write(Iter->_key); + writer.write(Iter->_key); // Persist object - Result &= Iter->_value->Persist(Writer); + Result &= Iter->_value->persist(writer); ++Iter; } @@ -95,31 +95,31 @@ bool RegionRegistry::Persist(OutputPersistenceBlock &Writer) { // ----------------------------------------------------------------------------- -bool RegionRegistry::Unpersist(InputPersistenceBlock &Reader) { +bool RegionRegistry::unpersist(InputPersistenceBlock &reader) { bool Result = true; - // Read in the next handle - Reader.Read(m_NextHandle); + // read in the next handle + reader.read(m_NextHandle); // Destroy all existing BS_Regions //FIXME: This doesn't seem right - the value is being deleted but not the actual hash node itself? while (!m_Handle2PtrMap.empty()) delete m_Handle2PtrMap.begin()->_value; - // Read in the number of BS_Regions + // read in the number of BS_Regions uint RegionCount; - Reader.Read(RegionCount); + reader.read(RegionCount); // Restore all the BS_Regions objects for (uint i = 0; i < RegionCount; ++i) { // Handle read uint Handle; - Reader.Read(Handle); + reader.read(Handle); // BS_Region restore - Result &= Region::Create(Reader, Handle) != 0; + Result &= Region::Create(reader, Handle) != 0; } - return Reader.IsGood() && Result; + return reader.isGood() && Result; } } // End of namespace Sword25 diff --git a/engines/sword25/math/regionregistry.h b/engines/sword25/math/regionregistry.h index f3befe8439..b50b261856 100644 --- a/engines/sword25/math/regionregistry.h +++ b/engines/sword25/math/regionregistry.h @@ -63,8 +63,8 @@ public: return *m_InstancePtr.get(); } - virtual bool Persist(OutputPersistenceBlock &Writer); - virtual bool Unpersist(InputPersistenceBlock &Reader); + virtual bool persist(OutputPersistenceBlock &writer); + virtual bool unpersist(InputPersistenceBlock &reader); private: virtual void LogErrorLn(const char *Message) const; diff --git a/engines/sword25/math/walkregion.cpp b/engines/sword25/math/walkregion.cpp index 8416662d58..5a0102e305 100644 --- a/engines/sword25/math/walkregion.cpp +++ b/engines/sword25/math/walkregion.cpp @@ -61,7 +61,7 @@ WalkRegion::WalkRegion() { WalkRegion::WalkRegion(InputPersistenceBlock &Reader, uint Handle) : Region(Reader, Handle) { m_Type = RT_WALKREGION; - Unpersist(Reader); + unpersist(Reader); } // ----------------------------------------------------------------------------- @@ -340,78 +340,78 @@ void WalkRegion::SetPos(int X, int Y) { // ----------------------------------------------------------------------------- -bool WalkRegion::Persist(OutputPersistenceBlock &Writer) { - bool Result = true; +bool WalkRegion::persist(OutputPersistenceBlock &writer) { + bool result = true; // Persist the parent region - Result &= Region::Persist(Writer); + result &= Region::persist(writer); // Persist the nodes - Writer.Write(m_Nodes.size()); + writer.write(m_Nodes.size()); Common::Array::const_iterator It = m_Nodes.begin(); while (It != m_Nodes.end()) { - Writer.Write(It->X); - Writer.Write(It->Y); + writer.write(It->X); + writer.write(It->Y); ++It; } // Persist the visibility matrix - Writer.Write(m_VisibilityMatrix.size()); + writer.write(m_VisibilityMatrix.size()); Common::Array< Common::Array >::const_iterator RowIter = m_VisibilityMatrix.begin(); while (RowIter != m_VisibilityMatrix.end()) { - Writer.Write(RowIter->size()); + writer.write(RowIter->size()); Common::Array::const_iterator ColIter = RowIter->begin(); while (ColIter != RowIter->end()) { - Writer.Write(*ColIter); + writer.write(*ColIter); ++ColIter; } ++RowIter; } - return Result; + return result; } // ----------------------------------------------------------------------------- -bool WalkRegion::Unpersist(InputPersistenceBlock &Reader) { - bool Result = true; +bool WalkRegion::unpersist(InputPersistenceBlock &reader) { + bool result = true; // The parent object was already loaded in the constructor of BS_Region, so at // this point only the additional data from BS_WalkRegion needs to be loaded // Node load uint NodeCount; - Reader.Read(NodeCount); + reader.read(NodeCount); m_Nodes.clear(); m_Nodes.resize(NodeCount); Common::Array::iterator It = m_Nodes.begin(); while (It != m_Nodes.end()) { - Reader.Read(It->X); - Reader.Read(It->Y); + reader.read(It->X); + reader.read(It->Y); ++It; } // Visibility matrix load uint RowCount; - Reader.Read(RowCount); + reader.read(RowCount); m_VisibilityMatrix.clear(); m_VisibilityMatrix.resize(RowCount); Common::Array< Common::Array >::iterator RowIter = m_VisibilityMatrix.begin(); while (RowIter != m_VisibilityMatrix.end()) { uint ColCount; - Reader.Read(ColCount); + reader.read(ColCount); RowIter->resize(ColCount); Common::Array::iterator ColIter = RowIter->begin(); while (ColIter != RowIter->end()) { - Reader.Read(*ColIter); + reader.read(*ColIter); ++ColIter; } ++RowIter; } - return Result && Reader.IsGood(); + return result && reader.isGood(); } } // End of namespace Sword25 diff --git a/engines/sword25/math/walkregion.h b/engines/sword25/math/walkregion.h index feb40949ce..e258f9e344 100644 --- a/engines/sword25/math/walkregion.h +++ b/engines/sword25/math/walkregion.h @@ -103,8 +103,8 @@ public: return m_VisibilityMatrix; } - virtual bool Persist(OutputPersistenceBlock &Writer); - virtual bool Unpersist(InputPersistenceBlock &Reader); + virtual bool persist(OutputPersistenceBlock &writer); + virtual bool unpersist(InputPersistenceBlock &reader); private: Common::Array m_Nodes; diff --git a/engines/sword25/script/luascript.cpp b/engines/sword25/script/luascript.cpp index 4055c5fc06..d57bd5e7b0 100644 --- a/engines/sword25/script/luascript.cpp +++ b/engines/sword25/script/luascript.cpp @@ -448,7 +448,7 @@ int Chunkwriter(lua_State *L, const void *p, size_t sz, void *ud) { } } -bool LuaScriptEngine::Persist(OutputPersistenceBlock &Writer) { +bool LuaScriptEngine::persist(OutputPersistenceBlock &Writer) { // Empty the Lua stack. pluto_persist() xepects that the stack is empty except for its parameters lua_settop(m_State, 0); @@ -465,7 +465,7 @@ bool LuaScriptEngine::Persist(OutputPersistenceBlock &Writer) { pluto_persist(m_State, Chunkwriter, &chunkData); // Persistenzdaten in den Writer schreiben. - Writer.Write(&chunkData[0], chunkData.size()); + Writer.write(&chunkData[0], chunkData.size()); // Die beiden Tabellen vom Stack nehmen. lua_pop(m_State, 2); @@ -540,7 +540,7 @@ void ClearGlobalTable(lua_State *L, const char **Exceptions) { // ----------------------------------------------------------------------------- -bool LuaScriptEngine::Unpersist(InputPersistenceBlock &Reader) { +bool LuaScriptEngine::unpersist(InputPersistenceBlock &Reader) { // Empty the Lua stack. pluto_persist() xepects that the stack is empty except for its parameters lua_settop(m_State, 0); @@ -570,7 +570,7 @@ bool LuaScriptEngine::Unpersist(InputPersistenceBlock &Reader) { // Persisted Lua data Common::Array chunkData; - Reader.Read(chunkData); + Reader.read(chunkData); // Chunk-Reader initialisation. It is used with pluto_unpersist to restore read data ChunkreaderData cd; diff --git a/engines/sword25/script/luascript.h b/engines/sword25/script/luascript.h index f2773eef06..831a994ea2 100644 --- a/engines/sword25/script/luascript.h +++ b/engines/sword25/script/luascript.h @@ -112,11 +112,11 @@ public: /** * @remark The Lua stack is cleared by this method */ - virtual bool Persist(OutputPersistenceBlock &Writer); + virtual bool persist(OutputPersistenceBlock &writer); /** * @remark The Lua stack is cleared by this method */ - virtual bool Unpersist(InputPersistenceBlock &Reader); + virtual bool unpersist(InputPersistenceBlock &reader); private: lua_State *m_State; diff --git a/engines/sword25/script/script.h b/engines/sword25/script/script.h index e2750dbd5d..fded5e442c 100644 --- a/engines/sword25/script/script.h +++ b/engines/sword25/script/script.h @@ -103,8 +103,8 @@ public: */ virtual void SetCommandLine(const Common::Array &CommandLineParameters) = 0; - virtual bool Persist(OutputPersistenceBlock &Writer) = 0; - virtual bool Unpersist(InputPersistenceBlock &Reader) = 0; + virtual bool persist(OutputPersistenceBlock &writer) = 0; + virtual bool unpersist(InputPersistenceBlock &reader) = 0; }; } // End of namespace Sword25 diff --git a/engines/sword25/sfx/fmodexsound.cpp b/engines/sword25/sfx/fmodexsound.cpp index fb529a7621..c67db28401 100644 --- a/engines/sword25/sfx/fmodexsound.cpp +++ b/engines/sword25/sfx/fmodexsound.cpp @@ -764,7 +764,7 @@ bool FMODExSound::CanLoadResource(const Common::String &FileName) { // Persistenz // ----------------------------------------------------------------------------- -bool FMODExSound::Persist(OutputPersistenceBlock &Writer) { +bool FMODExSound::persist(OutputPersistenceBlock &writer) { #if 0 BS_ASSERT(m_FMOD); @@ -815,7 +815,7 @@ bool FMODExSound::Persist(OutputPersistenceBlock &Writer) { // ----------------------------------------------------------------------------- -bool FMODExSound::Unpersist(InputPersistenceBlock &Reader) { +bool FMODExSound::unpersist(InputPersistenceBlock &reader) { #if 0 BS_ASSERT(m_FMOD); diff --git a/engines/sword25/sfx/fmodexsound.h b/engines/sword25/sfx/fmodexsound.h index 10d383cfd5..b599334d1c 100644 --- a/engines/sword25/sfx/fmodexsound.h +++ b/engines/sword25/sfx/fmodexsound.h @@ -78,8 +78,8 @@ public: // Persistenz // ----------------------------------------------------------------------------- - bool Persist(OutputPersistenceBlock &Writer); - bool Unpersist(InputPersistenceBlock &Reader); + bool persist(OutputPersistenceBlock &writer); + bool unpersist(InputPersistenceBlock &reader); #if 0 private: -- cgit v1.2.3