Moved the cel count calculation to the new graphics code
svn-id: r45379
This commit is contained in:
parent
1a4b617398
commit
b5feeb60b6
6 changed files with 21 additions and 44 deletions
|
@ -1077,9 +1077,9 @@ bool Console::cmdViewInfo(int argc, const char **argv) {
|
||||||
DebugPrintf("has %d loops:\n", loops);
|
DebugPrintf("has %d loops:\n", loops);
|
||||||
|
|
||||||
for (i = 0; i < loops; i++) {
|
for (i = 0; i < loops; i++) {
|
||||||
int j, cels;
|
int j, cels = _vm->_gamestate->_gui->getCelCount(view, i);
|
||||||
|
|
||||||
DebugPrintf("Loop %d: %d cels.\n", i, cels = gfxop_lookup_view_get_cels(_vm->_gamestate->gfx_state, view, i));
|
DebugPrintf("Loop %d: %d cels.\n", i, cels);
|
||||||
for (j = 0; j < cels; j++) {
|
for (j = 0; j < cels; j++) {
|
||||||
int width;
|
int width;
|
||||||
int height;
|
int height;
|
||||||
|
|
|
@ -413,30 +413,23 @@ reg_t kNumLoops(EngineState *s, int argc, reg_t *argv) {
|
||||||
SegManager *segMan = s->_segMan;
|
SegManager *segMan = s->_segMan;
|
||||||
reg_t obj = argv[0];
|
reg_t obj = argv[0];
|
||||||
int view = GET_SEL32V(segMan, obj, view);
|
int view = GET_SEL32V(segMan, obj, view);
|
||||||
int loops_nr = s->_gui->getLoopCount(view);
|
int loopCount = s->_gui->getLoopCount(view);
|
||||||
|
|
||||||
if (loops_nr < 0) {
|
debugC(2, kDebugLevelGraphics, "NumLoops(view.%d) = %d\n", view, loopCount);
|
||||||
error("view.%d (0x%x) not found", view, view);
|
|
||||||
return NULL_REG;
|
|
||||||
}
|
|
||||||
|
|
||||||
debugC(2, kDebugLevelGraphics, "NumLoops(view.%d) = %d\n", view, loops_nr);
|
return make_reg(0, loopCount);
|
||||||
|
|
||||||
return make_reg(0, loops_nr);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
reg_t kNumCels(EngineState *s, int argc, reg_t *argv) {
|
reg_t kNumCels(EngineState *s, int argc, reg_t *argv) {
|
||||||
SegManager *segMan = s->_segMan;
|
SegManager *segMan = s->_segMan;
|
||||||
reg_t obj = argv[0];
|
reg_t obj = argv[0];
|
||||||
int loop = GET_SEL32V(segMan, obj, loop);
|
|
||||||
int view = GET_SEL32V(segMan, obj, view);
|
int view = GET_SEL32V(segMan, obj, view);
|
||||||
int cel = 0xffff;
|
int loop = GET_SEL32V(segMan, obj, loop);
|
||||||
|
int celCount = s->_gui->getCelCount(view, loop);
|
||||||
|
|
||||||
s->gfx_state->gfxResMan->getView(view, &loop, &cel, 0);
|
debugC(2, kDebugLevelGraphics, "NumCels(view.%d, %d) = %d\n", view, loop, celCount);
|
||||||
|
|
||||||
debugC(2, kDebugLevelGraphics, "NumCels(view.%d, %d) = %d\n", view, loop, cel + 1);
|
return make_reg(0, celCount);
|
||||||
|
|
||||||
return make_reg(0, cel + 1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
reg_t kOnControl(EngineState *s, int argc, reg_t *argv) {
|
reg_t kOnControl(EngineState *s, int argc, reg_t *argv) {
|
||||||
|
|
|
@ -1284,22 +1284,6 @@ sci_event_t gfxop_get_event(GfxState *state, unsigned int mask) {
|
||||||
|
|
||||||
// View operations
|
// View operations
|
||||||
|
|
||||||
int gfxop_lookup_view_get_cels(GfxState *state, int nr, int loop) {
|
|
||||||
int real_loop = loop, cel = 0;
|
|
||||||
gfxr_view_t *view = NULL;
|
|
||||||
|
|
||||||
view = state->gfxResMan->getView(nr, &real_loop, &cel, 0);
|
|
||||||
|
|
||||||
if (!view) {
|
|
||||||
warning("[GFX] Attempt to retrieve number of cels from invalid/broken view %d", nr);
|
|
||||||
return 0;
|
|
||||||
} else if (real_loop != loop) {
|
|
||||||
warning("[GFX] Loop number was corrected from %d to %d in view %d", loop, real_loop, nr);
|
|
||||||
}
|
|
||||||
|
|
||||||
return view->loops[real_loop].cels_nr;
|
|
||||||
}
|
|
||||||
|
|
||||||
void gfxop_get_cel_parameters(GfxState *state, int nr, int loop, int cel, int *width, int *height, Common::Point *offset) {
|
void gfxop_get_cel_parameters(GfxState *state, int nr, int loop, int cel, int *width, int *height, Common::Point *offset) {
|
||||||
gfxr_view_t *view = NULL;
|
gfxr_view_t *view = NULL;
|
||||||
gfx_pixmap_t *pxm = NULL;
|
gfx_pixmap_t *pxm = NULL;
|
||||||
|
|
|
@ -333,18 +333,6 @@ sci_event_t gfxop_get_event(GfxState *state, unsigned int mask);
|
||||||
/** @name View operations */
|
/** @name View operations */
|
||||||
/** @{ */
|
/** @{ */
|
||||||
|
|
||||||
/**
|
|
||||||
* Determines the number of cels associated stored in a loop.
|
|
||||||
*
|
|
||||||
* @param[in] state The state to look up in
|
|
||||||
* @param[in] nr Number of the view to look up in
|
|
||||||
* @param[in] loop Number of the loop the number of cels of are to be
|
|
||||||
* investigated
|
|
||||||
* @return The number of cels in that loop, or GFX_ERROR if either the
|
|
||||||
* view or the loop didn't exist
|
|
||||||
*/
|
|
||||||
int gfxop_lookup_view_get_cels(GfxState *state, int nr, int loop);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves the width and height of a cel.
|
* Retrieves the width and height of a cel.
|
||||||
*
|
*
|
||||||
|
|
|
@ -690,6 +690,17 @@ int16 SciGui::getLoopCount(int view) {
|
||||||
return loopCount;
|
return loopCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int16 SciGui::getCelCount(int view, int loop) {
|
||||||
|
SciGuiView *tmpView = new SciGuiView(_s->resMan, _screen, _palette, view);
|
||||||
|
if (!tmpView)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
uint16 celCount = tmpView->getLoopInfo(loop)->celCount;
|
||||||
|
delete tmpView;
|
||||||
|
|
||||||
|
return celCount;
|
||||||
|
}
|
||||||
|
|
||||||
bool SciGui::debugUndither(bool flag) {
|
bool SciGui::debugUndither(bool flag) {
|
||||||
_screen->unditherSetState(flag);
|
_screen->unditherSetState(flag);
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -127,6 +127,7 @@ public:
|
||||||
int16 getCelHeight(int view, int loop, int cel);
|
int16 getCelHeight(int view, int loop, int cel);
|
||||||
|
|
||||||
int16 getLoopCount(int view);
|
int16 getLoopCount(int view);
|
||||||
|
int16 getCelCount(int view, int loop);
|
||||||
|
|
||||||
virtual bool debugUndither(bool flag);
|
virtual bool debugUndither(bool flag);
|
||||||
virtual bool debugShowMap(int mapNo);
|
virtual bool debugShowMap(int mapNo);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue