diff options
author | Filippos Karapetis | 2009-10-22 05:41:50 +0000 |
---|---|---|
committer | Filippos Karapetis | 2009-10-22 05:41:50 +0000 |
commit | 1f4ad52c61e2dbaca95a99bfcf20f4c298fdd41c (patch) | |
tree | 43138827b37d84177bd25426df4467478935c48c | |
parent | 3f3353c520341ec0813b165be6ba1accf87d6f3d (diff) | |
download | scummvm-rg350-1f4ad52c61e2dbaca95a99bfcf20f4c298fdd41c.tar.gz scummvm-rg350-1f4ad52c61e2dbaca95a99bfcf20f4c298fdd41c.tar.bz2 scummvm-rg350-1f4ad52c61e2dbaca95a99bfcf20f4c298fdd41c.zip |
Moved the view loop counting code in the new GUI
svn-id: r45322
-rw-r--r-- | engines/sci/console.cpp | 2 | ||||
-rw-r--r-- | engines/sci/engine/kgraphics.cpp | 7 | ||||
-rw-r--r-- | engines/sci/gfx/operations.cpp | 13 | ||||
-rw-r--r-- | engines/sci/gfx/operations.h | 9 | ||||
-rw-r--r-- | engines/sci/gui/gui.cpp | 11 | ||||
-rw-r--r-- | engines/sci/gui/gui.h | 2 |
6 files changed, 17 insertions, 27 deletions
diff --git a/engines/sci/console.cpp b/engines/sci/console.cpp index baf43f925a..d805a088cf 100644 --- a/engines/sci/console.cpp +++ b/engines/sci/console.cpp @@ -1069,7 +1069,7 @@ bool Console::cmdViewInfo(int argc, const char **argv) { DebugPrintf("Resource view.%d ", view); - loops = gfxop_lookup_view_get_loops(_vm->_gamestate->gfx_state, view); + loops = _vm->_gamestate->_gui->getLoopCount(view); if (loops < 0) DebugPrintf("does not exist.\n"); diff --git a/engines/sci/engine/kgraphics.cpp b/engines/sci/engine/kgraphics.cpp index 29f3e632d3..3faaef6364 100644 --- a/engines/sci/engine/kgraphics.cpp +++ b/engines/sci/engine/kgraphics.cpp @@ -33,8 +33,7 @@ #include "sci/seq_decoder.h" #include "sci/engine/state.h" #include "sci/engine/kernel.h" -#include "sci/gfx/gfx_widgets.h" -//#include "sci/gfx/gfx_state_internal.h" // required for GfxContainer, GfxPort, GfxVisual +#include "sci/gfx/operations.h" #include "sci/gui/gui.h" #include "sci/gui/gui_animate.h" #include "sci/gui/gui_cursor.h" @@ -95,7 +94,7 @@ void _k_dirloop(reg_t obj, uint16 angle, EngineState *s, int argc, reg_t *argv) else loop = 0xffff; } - maxloops = gfxop_lookup_view_get_loops(s->gfx_state, view); + maxloops = s->_gui->getLoopCount(view); if ((loop > 1) && (maxloops < 4)) return; @@ -414,7 +413,7 @@ reg_t kNumLoops(EngineState *s, int argc, reg_t *argv) { SegManager *segMan = s->_segMan; reg_t obj = argv[0]; int view = GET_SEL32V(segMan, obj, view); - int loops_nr = gfxop_lookup_view_get_loops(s->gfx_state, view); + int loops_nr = s->_gui->getLoopCount(view); if (loops_nr < 0) { error("view.%d (0x%x) not found", view, view); diff --git a/engines/sci/gfx/operations.cpp b/engines/sci/gfx/operations.cpp index 1c5f6a32bc..2f9930fc68 100644 --- a/engines/sci/gfx/operations.cpp +++ b/engines/sci/gfx/operations.cpp @@ -1300,19 +1300,6 @@ sci_event_t gfxop_get_event(GfxState *state, unsigned int mask) { // View operations -int gfxop_lookup_view_get_loops(GfxState *state, int nr) { - int loop = 0, cel = 0; - gfxr_view_t *view = NULL; - - view = state->gfxResMan->getView(nr, &loop, &cel, 0); - - if (!view) { - error("[GFX] Attempt to retrieve number of loops from invalid view %d", nr); - } - - return view->loops_nr; -} - int gfxop_lookup_view_get_cels(GfxState *state, int nr, int loop) { int real_loop = loop, cel = 0; gfxr_view_t *view = NULL; diff --git a/engines/sci/gfx/operations.h b/engines/sci/gfx/operations.h index 2ae5bf80d6..6359985731 100644 --- a/engines/sci/gfx/operations.h +++ b/engines/sci/gfx/operations.h @@ -359,15 +359,6 @@ sci_event_t gfxop_get_event(GfxState *state, unsigned int mask); /** @{ */ /** - * Determines the number of loops associated with a view. - * - * @param[in] state The state to use - * @param[in] nr Number of the view to investigate - * @return The number of loops, or GFX_ERROR if the view didn't exist - */ -int gfxop_lookup_view_get_loops(GfxState *state, int nr); - -/** * Determines the number of cels associated stored in a loop. * * @param[in] state The state to look up in diff --git a/engines/sci/gui/gui.cpp b/engines/sci/gui/gui.cpp index 1ad267f05d..9872351340 100644 --- a/engines/sci/gui/gui.cpp +++ b/engines/sci/gui/gui.cpp @@ -668,6 +668,17 @@ int16 SciGui::getCelHeight(int view, int loop, int cel) { return height; } +int16 SciGui::getLoopCount(int view) { + SciGuiView *tmpView = new SciGuiView(_s->resMan, _screen, _palette, view); + if (!tmpView) + return -1; + + uint16 loopCount = tmpView->getLoopCount(); + delete tmpView; + + return loopCount; +} + bool SciGui::debugUndither(bool flag) { _screen->unditherSetState(flag); return false; diff --git a/engines/sci/gui/gui.h b/engines/sci/gui/gui.h index 697ad539f7..5298c3a2e4 100644 --- a/engines/sci/gui/gui.h +++ b/engines/sci/gui/gui.h @@ -126,6 +126,8 @@ public: int16 getCelWidth(int view, int loop, int cel); int16 getCelHeight(int view, int loop, int cel); + int16 getLoopCount(int view); + virtual bool debugUndither(bool flag); virtual bool debugShowMap(int mapNo); |