[Scummvm-cvs-logs] SF.net SVN: scummvm:[47759] scummvm/trunk/engines/sci
m_kiewitz at users.sourceforge.net
m_kiewitz at users.sourceforge.net
Sun Jan 31 18:15:03 CET 2010
Revision: 47759
http://scummvm.svn.sourceforge.net/scummvm/?rev=47759&view=rev
Author: m_kiewitz
Date: 2010-01-31 17:14:58 +0000 (Sun, 31 Jan 2010)
Log Message:
-----------
SCI: GfxCache is now also called directly w/o SciGui nor SciGui32
Modified Paths:
--------------
scummvm/trunk/engines/sci/engine/kgraphics.cpp
scummvm/trunk/engines/sci/engine/state.h
scummvm/trunk/engines/sci/graphics/cache.cpp
scummvm/trunk/engines/sci/graphics/cache.h
scummvm/trunk/engines/sci/graphics/gui.cpp
scummvm/trunk/engines/sci/graphics/gui.h
scummvm/trunk/engines/sci/graphics/gui32.cpp
scummvm/trunk/engines/sci/graphics/gui32.h
scummvm/trunk/engines/sci/sci.cpp
Modified: scummvm/trunk/engines/sci/engine/kgraphics.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/kgraphics.cpp 2010-01-31 17:05:07 UTC (rev 47758)
+++ scummvm/trunk/engines/sci/engine/kgraphics.cpp 2010-01-31 17:14:58 UTC (rev 47759)
@@ -38,6 +38,7 @@
#include "sci/graphics/gui32.h"
#include "sci/graphics/ports.h"
#include "sci/graphics/animate.h"
+#include "sci/graphics/cache.h"
#include "sci/graphics/cursor.h"
#include "sci/graphics/palette.h"
#include "sci/graphics/screen.h"
@@ -80,12 +81,7 @@
else loopNo = -1;
}
-#ifdef ENABLE_SCI32
- if (s->_gui32)
- maxLoops = s->_gui32->getLoopCount(viewId);
- else
-#endif
- maxLoops = s->_gui->getLoopCount(viewId);
+ maxLoops = s->_gfxCache->kernelViewGetLoopCount(viewId);
if ((loopNo > 1) && (maxLoops < 4))
@@ -466,12 +462,7 @@
int16 celNo = (argc >= 3) ? argv[2].toSint16() : 0;
int16 celHeight;
-#ifdef ENABLE_SCI32
- if (s->_gui32)
- celHeight = s->_gui32->getCelHeight(viewId, loopNo, celNo);
- else
-#endif
- celHeight = s->_gui->getCelHeight(viewId, loopNo, celNo);
+ celHeight = s->_gfxCache->kernelViewGetCelHeight(viewId, loopNo, celNo);
return make_reg(0, celHeight);
}
@@ -484,12 +475,7 @@
int16 celNo = (argc >= 3) ? argv[2].toSint16() : 0;
int16 celWidth;
-#ifdef ENABLE_SCI32
- if (s->_gui32)
- celWidth = s->_gui32->getCelWidth(viewId, loopNo, celNo);
- else
-#endif
- celWidth = s->_gui->getCelWidth(viewId, loopNo, celNo);
+ celWidth = s->_gfxCache->kernelViewGetCelWidth(viewId, loopNo, celNo);
return make_reg(0, celWidth);
}
@@ -499,12 +485,7 @@
GuiResourceId viewId = GET_SEL32V(s->_segMan, object, view);
int16 loopCount;
-#ifdef ENABLE_SCI32
- if (s->_gui32)
- loopCount = s->_gui32->getLoopCount(viewId);
- else
-#endif
- loopCount = s->_gui->getLoopCount(viewId);
+ loopCount = s->_gfxCache->kernelViewGetLoopCount(viewId);
debugC(2, kDebugLevelGraphics, "NumLoops(view.%d) = %d", viewId, loopCount);
@@ -517,12 +498,7 @@
int16 loopNo = GET_SEL32V(s->_segMan, object, loop);
int16 celCount;
-#ifdef ENABLE_SCI32
- if (s->_gui32)
- celCount = s->_gui32->getCelCount(viewId, loopNo);
- else
-#endif
- celCount = s->_gui->getCelCount(viewId, loopNo);
+ celCount = s->_gfxCache->kernelViewGetCelCount(viewId, loopNo);
debugC(2, kDebugLevelGraphics, "NumCels(view.%d, %d) = %d", viewId, loopNo, celCount);
Modified: scummvm/trunk/engines/sci/engine/state.h
===================================================================
--- scummvm/trunk/engines/sci/engine/state.h 2010-01-31 17:05:07 UTC (rev 47758)
+++ scummvm/trunk/engines/sci/engine/state.h 2010-01-31 17:14:58 UTC (rev 47759)
@@ -55,6 +55,7 @@
class GfxPorts;
class GfxScreen;
class GfxPalette;
+class GfxCache;
class SciGui;
class Cursor;
class MessageState;
@@ -155,6 +156,7 @@
GfxPorts *_gfxPorts; // Port managment for 16-bit gfx
GfxScreen *_gfxScreen;
GfxPalette *_gfxPalette;
+ GfxCache *_gfxCache;
SciGui *_gui; /* Currently active Gui */
#ifdef ENABLE_SCI32
Modified: scummvm/trunk/engines/sci/graphics/cache.cpp
===================================================================
--- scummvm/trunk/engines/sci/graphics/cache.cpp 2010-01-31 17:05:07 UTC (rev 47758)
+++ scummvm/trunk/engines/sci/graphics/cache.cpp 2010-01-31 17:14:58 UTC (rev 47759)
@@ -53,14 +53,30 @@
_cachedViews.clear();
}
-View *GfxCache::getView(GuiResourceId viewNum) {
+View *GfxCache::getView(GuiResourceId viewId) {
if (_cachedViews.size() >= MAX_CACHED_VIEWS)
purgeCache();
- if (!_cachedViews.contains(viewNum))
- _cachedViews[viewNum] = new View(_resMan, _screen, _palette, viewNum);
+ if (!_cachedViews.contains(viewId))
+ _cachedViews[viewId] = new View(_resMan, _screen, _palette, viewId);
- return _cachedViews[viewNum];
+ return _cachedViews[viewId];
}
+int16 GfxCache::kernelViewGetCelWidth(GuiResourceId viewId, int16 loopNo, int16 celNo) {
+ return getView(viewId)->getCelInfo(loopNo, celNo)->width;
+}
+
+int16 GfxCache::kernelViewGetCelHeight(GuiResourceId viewId, int16 loopNo, int16 celNo) {
+ return getView(viewId)->getCelInfo(loopNo, celNo)->height;
+}
+
+int16 GfxCache::kernelViewGetLoopCount(GuiResourceId viewId) {
+ return getView(viewId)->getLoopCount();
+}
+
+int16 GfxCache::kernelViewGetCelCount(GuiResourceId viewId, int16 loopNo) {
+ return getView(viewId)->getLoopInfo(loopNo)->celCount;
+}
+
} // End of namespace Sci
Modified: scummvm/trunk/engines/sci/graphics/cache.h
===================================================================
--- scummvm/trunk/engines/sci/graphics/cache.h 2010-01-31 17:05:07 UTC (rev 47758)
+++ scummvm/trunk/engines/sci/graphics/cache.h 2010-01-31 17:14:58 UTC (rev 47759)
@@ -43,6 +43,10 @@
~GfxCache();
View *getView(GuiResourceId viewNum);
+ int16 kernelViewGetCelWidth(GuiResourceId viewId, int16 loopNo, int16 celNo);
+ int16 kernelViewGetCelHeight(GuiResourceId viewId, int16 loopNo, int16 celNo);
+ int16 kernelViewGetLoopCount(GuiResourceId viewId);
+ int16 kernelViewGetCelCount(GuiResourceId viewId, int16 loopNo);
private:
void purgeCache();
Modified: scummvm/trunk/engines/sci/graphics/gui.cpp
===================================================================
--- scummvm/trunk/engines/sci/graphics/gui.cpp 2010-01-31 17:05:07 UTC (rev 47758)
+++ scummvm/trunk/engines/sci/graphics/gui.cpp 2010-01-31 17:14:58 UTC (rev 47759)
@@ -50,10 +50,9 @@
namespace Sci {
-SciGui::SciGui(EngineState *state, GfxScreen *screen, GfxPalette *palette, Cursor *cursor, GfxPorts *ports, AudioPlayer *audio)
- : _s(state), _screen(screen), _palette(palette), _cursor(cursor), _ports(ports), _audio(audio) {
+SciGui::SciGui(EngineState *state, GfxScreen *screen, GfxPalette *palette, GfxCache *cache, Cursor *cursor, GfxPorts *ports, AudioPlayer *audio)
+ : _s(state), _screen(screen), _palette(palette), _cache(cache), _cursor(cursor), _ports(ports), _audio(audio) {
- _cache = new GfxCache(_s->resMan, _screen, _palette);
_compare = new GfxCompare(_s->_segMan, _s->_kernel, _cache, _screen);
_paint16 = new GfxPaint16(_s->resMan, _s->_segMan, _s->_kernel, _cache, _ports, _screen, _palette);
_transitions = new Transitions(this, _screen, _palette, _s->resMan->isVGA());
@@ -655,22 +654,6 @@
_cursor->setMoveZone(zone);
}
-int16 SciGui::getCelWidth(GuiResourceId viewId, int16 loopNo, int16 celNo) {
- return _cache->getView(viewId)->getCelInfo(loopNo, celNo)->width;
-}
-
-int16 SciGui::getCelHeight(GuiResourceId viewId, int16 loopNo, int16 celNo) {
- return _cache->getView(viewId)->getCelInfo(loopNo, celNo)->height;
-}
-
-int16 SciGui::getLoopCount(GuiResourceId viewId) {
- return _cache->getView(viewId)->getLoopCount();
-}
-
-int16 SciGui::getCelCount(GuiResourceId viewId, int16 loopNo) {
- return _cache->getView(viewId)->getLoopInfo(loopNo)->celCount;
-}
-
void SciGui::syncWithFramebuffer() {
_screen->syncWithFramebuffer();
}
Modified: scummvm/trunk/engines/sci/graphics/gui.h
===================================================================
--- scummvm/trunk/engines/sci/graphics/gui.h 2010-01-31 17:05:07 UTC (rev 47758)
+++ scummvm/trunk/engines/sci/graphics/gui.h 2010-01-31 17:14:58 UTC (rev 47759)
@@ -57,8 +57,8 @@
class SciGui {
public:
- SciGui(EngineState *s, GfxScreen *screen, GfxPalette *palette, Cursor *cursor, GfxPorts *ports, AudioPlayer *audio);
- virtual ~SciGui();
+ SciGui(EngineState *s, GfxScreen *screen, GfxPalette *palette, GfxCache *cache, Cursor *cursor, GfxPorts *ports, AudioPlayer *audio);
+ ~SciGui();
virtual void init(bool usesOldGfxFunctions);
@@ -123,12 +123,6 @@
virtual void moveCursor(Common::Point pos);
void setCursorZone(Common::Rect zone);
- virtual int16 getCelWidth(GuiResourceId viewId, int16 loopNo, int16 celNo);
- virtual int16 getCelHeight(GuiResourceId viewId, int16 loopNo, int16 celNo);
-
- virtual int16 getLoopCount(GuiResourceId viewId);
- virtual int16 getCelCount(GuiResourceId viewId, int16 loopNo);
-
virtual void syncWithFramebuffer();
virtual reg_t portraitLoad(Common::String resourceName);
Modified: scummvm/trunk/engines/sci/graphics/gui32.cpp
===================================================================
--- scummvm/trunk/engines/sci/graphics/gui32.cpp 2010-01-31 17:05:07 UTC (rev 47758)
+++ scummvm/trunk/engines/sci/graphics/gui32.cpp 2010-01-31 17:14:58 UTC (rev 47759)
@@ -44,10 +44,9 @@
namespace Sci {
-SciGui32::SciGui32(EngineState *state, GfxScreen *screen, GfxPalette *palette, Cursor *cursor)
- : _s(state), _screen(screen), _palette(palette), _cursor(cursor) {
+SciGui32::SciGui32(EngineState *state, GfxScreen *screen, GfxPalette *palette, GfxCache *cache, Cursor *cursor)
+ : _s(state), _screen(screen), _palette(palette), _cache(cache), _cursor(cursor) {
- _cache = new GfxCache(_s->resMan, _screen, _palette);
_compare = new GfxCompare(_s->_segMan, _s->_kernel, _cache, _screen);
}
@@ -217,22 +216,6 @@
_cursor->setMoveZone(zone);
}
-int16 SciGui32::getCelWidth(GuiResourceId viewId, int16 loopNo, int16 celNo) {
- return _cache->getView(viewId)->getCelInfo(loopNo, celNo)->width;
-}
-
-int16 SciGui32::getCelHeight(GuiResourceId viewId, int16 loopNo, int16 celNo) {
- return _cache->getView(viewId)->getCelInfo(loopNo, celNo)->height;
-}
-
-int16 SciGui32::getLoopCount(GuiResourceId viewId) {
- return _cache->getView(viewId)->getLoopCount();
-}
-
-int16 SciGui32::getCelCount(GuiResourceId viewId, int16 loopNo) {
- return _cache->getView(viewId)->getLoopInfo(loopNo)->celCount;
-}
-
void SciGui32::syncWithFramebuffer() {
_screen->syncWithFramebuffer();
}
Modified: scummvm/trunk/engines/sci/graphics/gui32.h
===================================================================
--- scummvm/trunk/engines/sci/graphics/gui32.h 2010-01-31 17:05:07 UTC (rev 47758)
+++ scummvm/trunk/engines/sci/graphics/gui32.h 2010-01-31 17:14:58 UTC (rev 47759)
@@ -39,7 +39,7 @@
class SciGui32 {
public:
- SciGui32(EngineState *s, GfxScreen *screen, GfxPalette *palette, Cursor *cursor);
+ SciGui32(EngineState *s, GfxScreen *screen, GfxPalette *palette, GfxCache *cache, Cursor *cursor);
~SciGui32();
void init();
@@ -64,12 +64,6 @@
void moveCursor(Common::Point pos);
void setCursorZone(Common::Rect zone);
- int16 getCelWidth(GuiResourceId viewId, int16 loopNo, int16 celNo);
- int16 getCelHeight(GuiResourceId viewId, int16 loopNo, int16 celNo);
-
- int16 getLoopCount(GuiResourceId viewId);
- int16 getCelCount(GuiResourceId viewId, int16 loopNo);
-
void syncWithFramebuffer();
void addScreenItem(reg_t object);
Modified: scummvm/trunk/engines/sci/sci.cpp
===================================================================
--- scummvm/trunk/engines/sci/sci.cpp 2010-01-31 17:05:07 UTC (rev 47758)
+++ scummvm/trunk/engines/sci/sci.cpp 2010-01-31 17:14:58 UTC (rev 47759)
@@ -44,6 +44,7 @@
#include "sci/graphics/palette.h"
#include "sci/graphics/cursor.h"
#include "sci/graphics/screen.h"
+#include "sci/graphics/cache.h"
#ifdef ENABLE_SCI32
#include "sci/graphics/gui32.h"
@@ -150,6 +151,7 @@
screen = new GfxScreen(_resMan, 320, 200, upscaledHires);
GfxPalette *palette = new GfxPalette(_resMan, screen);
+ GfxCache *cache = new GfxCache(_resMan, screen, palette);
Cursor *cursor = new Cursor(_resMan, palette, screen);
// Create debugger console. It requires GFX to be initialized
@@ -174,10 +176,10 @@
_gamestate->_gfxPorts = 0;
_gamestate->_gfxAnimate = 0;
_gamestate->_gui = 0;
- _gamestate->_gui32 = new SciGui32(_gamestate, screen, palette, cursor);
+ _gamestate->_gui32 = new SciGui32(_gamestate, screen, palette, cache, cursor);
} else {
_gamestate->_gfxPorts = new GfxPorts(segMan, screen);
- _gamestate->_gui = new SciGui(_gamestate, screen, palette, cursor, _gamestate->_gfxPorts, _audio);
+ _gamestate->_gui = new SciGui(_gamestate, screen, palette, cache, cursor, _gamestate->_gfxPorts, _audio);
_gamestate->_gui32 = 0;
}
#else
@@ -186,6 +188,7 @@
#endif
_gamestate->_gfxPalette = palette;
_gamestate->_gfxScreen = screen;
+ _gamestate->_gfxCache = cache;
if (game_init(_gamestate)) { /* Initialize */
warning("Game initialization failed: Aborting...");
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list