mirror of
https://github.com/libretro/scummvm.git
synced 2025-02-14 07:48:58 +00:00
SCI: GfxCache is now also called directly w/o SciGui nor SciGui32
svn-id: r47759
This commit is contained in:
parent
6a3308150f
commit
66c88b98f5
@ -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 @@ void _k_dirloop(reg_t object, uint16 angle, EngineState *s, int argc, reg_t *arg
|
||||
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 @@ reg_t kCelHigh(EngineState *s, int argc, reg_t *argv) {
|
||||
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 @@ reg_t kCelWide(EngineState *s, int argc, reg_t *argv) {
|
||||
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 @@ reg_t kNumLoops(EngineState *s, int argc, reg_t *argv) {
|
||||
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 @@ reg_t kNumCels(EngineState *s, int argc, reg_t *argv) {
|
||||
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);
|
||||
|
||||
|
@ -55,6 +55,7 @@ class GfxAnimate;
|
||||
class GfxPorts;
|
||||
class GfxScreen;
|
||||
class GfxPalette;
|
||||
class GfxCache;
|
||||
class SciGui;
|
||||
class Cursor;
|
||||
class MessageState;
|
||||
@ -155,6 +156,7 @@ public:
|
||||
GfxPorts *_gfxPorts; // Port managment for 16-bit gfx
|
||||
GfxScreen *_gfxScreen;
|
||||
GfxPalette *_gfxPalette;
|
||||
GfxCache *_gfxCache;
|
||||
SciGui *_gui; /* Currently active Gui */
|
||||
|
||||
#ifdef ENABLE_SCI32
|
||||
|
@ -53,14 +53,30 @@ void GfxCache::purgeCache() {
|
||||
_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
|
||||
|
@ -43,6 +43,10 @@ public:
|
||||
~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();
|
||||
|
@ -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 @@ void SciGui::setCursorZone(Common::Rect zone) {
|
||||
_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();
|
||||
}
|
||||
|
@ -57,8 +57,8 @@ class Transitions;
|
||||
|
||||
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 @@ public:
|
||||
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);
|
||||
|
@ -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 @@ void SciGui32::setCursorZone(Common::Rect zone) {
|
||||
_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();
|
||||
}
|
||||
|
@ -39,7 +39,7 @@ class Text;
|
||||
|
||||
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 @@ public:
|
||||
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);
|
||||
|
@ -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 @@ Common::Error SciEngine::run() {
|
||||
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 @@ Common::Error SciEngine::run() {
|
||||
_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 @@ Common::Error SciEngine::run() {
|
||||
#endif
|
||||
_gamestate->_gfxPalette = palette;
|
||||
_gamestate->_gfxScreen = screen;
|
||||
_gamestate->_gfxCache = cache;
|
||||
|
||||
if (game_init(_gamestate)) { /* Initialize */
|
||||
warning("Game initialization failed: Aborting...");
|
||||
|
Loading…
x
Reference in New Issue
Block a user