From da874257a50f82150ae475c3938e3422d6fa4984 Mon Sep 17 00:00:00 2001 From: Gregory Montoir Date: Sun, 19 Dec 2004 12:30:40 +0000 Subject: to please PalmOS, I moved the _wiz member to ScummEngine_v70he, where it actually belongs, I don't quite like the upcasts I introduced, but I don't know how to deal without them svn-id: r16132 --- scumm/actor.cpp | 3 ++- scumm/akos.cpp | 3 ++- scumm/charset.cpp | 3 ++- scumm/gfx.cpp | 3 ++- scumm/intern.h | 4 +++- scumm/saveload.cpp | 8 ++++++-- scumm/scumm.cpp | 28 +++------------------------- scumm/scumm.h | 4 ---- scumm/wiz_he.cpp | 30 ++++++++++++++++++++++++++++++ scumm/wiz_he.h | 10 ++++++---- 10 files changed, 56 insertions(+), 40 deletions(-) (limited to 'scumm') diff --git a/scumm/actor.cpp b/scumm/actor.cpp index 6d6f953d3c..d3423bcb98 100644 --- a/scumm/actor.cpp +++ b/scumm/actor.cpp @@ -31,6 +31,7 @@ #include "scumm/saveload.h" #include "scumm/sound.h" #include "scumm/usage_bits.h" +#include "scumm/wiz_he.h" namespace Scumm { @@ -1921,7 +1922,7 @@ void ScummEngine::postProcessAuxQueue() { uint8 *dst2 = pvs->getBackPixels(0, pvs->topline); switch (comp) { case 1: - _wiz.copyAuxImage(dst1, dst2, axfd + 10, pvs->w, pvs->h, x, y, w, h); + Wiz::copyAuxImage(dst1, dst2, axfd + 10, pvs->w, pvs->h, x, y, w, h); break; default: warning("unimplemented compression type %d", comp); diff --git a/scumm/akos.cpp b/scumm/akos.cpp index 1aadc1fdec..be1bbbb3c5 100644 --- a/scumm/akos.cpp +++ b/scumm/akos.cpp @@ -28,6 +28,7 @@ #include "scumm/imuse.h" #include "scumm/imuse_digi/dimuse.h" #include "scumm/sound.h" +#include "scumm/wiz_he.h" namespace Scumm { @@ -1238,7 +1239,7 @@ byte AkosRenderer::codec32(int xmoveCur, int ymoveCur) { _draw_bottom = dst.bottom; byte *dstPtr = (byte *)_out.pixels + dst.left + dst.top * _out.pitch; - _vm->_wiz.decompressWizImage(dstPtr, _out.pitch, dst, _srcptr, src); + Wiz::decompressWizImage(dstPtr, _out.pitch, dst, _srcptr, src); return 0; } diff --git a/scumm/charset.cpp b/scumm/charset.cpp index b997110a65..155837e8f4 100644 --- a/scumm/charset.cpp +++ b/scumm/charset.cpp @@ -22,6 +22,7 @@ #include "scumm/charset.h" #include "scumm/scumm.h" #include "scumm/nut_renderer.h" +#include "scumm/wiz_he.h" namespace Scumm { @@ -1397,7 +1398,7 @@ void CharsetRendererClassic::printChar(int chr) { byte imagePalette[256]; memset(imagePalette, 255, sizeof(imagePalette)); memcpy(imagePalette, _vm->_charsetColorMap, 16); - _vm->_wiz.decompressWizImage(dstPtr, vs->w, dst, charPtr, src, imagePalette); + Wiz::decompressWizImage(dstPtr, vs->w, dst, charPtr, src, imagePalette); if (_blitAlso && vs->hasTwoBuffers) _vm->gdi.copyVirtScreenBuffers(dst); diff --git a/scumm/gfx.cpp b/scumm/gfx.cpp index e73cc9dbdd..d956852c17 100644 --- a/scumm/gfx.cpp +++ b/scumm/gfx.cpp @@ -26,6 +26,7 @@ #include "scumm/intern.h" #include "scumm/resource.h" #include "scumm/usage_bits.h" +#include "scumm/wiz_he.h" #if defined(__PALM_OS__) #include "init_arm.h" @@ -1438,7 +1439,7 @@ void Gdi::drawBMAPObject(const byte *ptr, VirtScreen *vs, int obj, int x, int y, if (code == 8 || code == 9) { Common::Rect rScreen(0, 0, vs->w, vs->h); byte *dst = (byte *)_vm->virtscr[0].backBuf + scrX; - _vm->_wiz.copyWizImage(dst, bmap_ptr, vs->w, vs->h, x - scrX, y, w, h, &rScreen); + Wiz::copyWizImage(dst, bmap_ptr, vs->w, vs->h, x - scrX, y, w, h, &rScreen); } Common::Rect rect1(x, y, x + w, y + h); diff --git a/scumm/intern.h b/scumm/intern.h index c0a2f1c9a1..f3cf64fc05 100644 --- a/scumm/intern.h +++ b/scumm/intern.h @@ -24,7 +24,7 @@ #define INTERN_H #include "scumm/scumm.h" - +#include "scumm/wiz_he.h" namespace Scumm { @@ -649,6 +649,8 @@ protected: public: ScummEngine_v70he(GameDetector *detector, OSystem *syst, const ScummGameSettings &gs, uint8 md5sum[16]); + Wiz _wiz; + protected: virtual void setupOpcodes(); virtual void executeOpcode(byte i); diff --git a/scumm/saveload.cpp b/scumm/saveload.cpp index d4ee6c2d62..b528054a55 100644 --- a/scumm/saveload.cpp +++ b/scumm/saveload.cpp @@ -28,12 +28,14 @@ #include "scumm/charset.h" #include "scumm/imuse_digi/dimuse.h" #include "scumm/imuse.h" +#include "scumm/intern.h" #include "scumm/object.h" #include "scumm/resource.h" #include "scumm/saveload.h" #include "scumm/scumm.h" #include "scumm/sound.h" #include "scumm/verbs.h" +#include "scumm/wiz_he.h" #include "sound/audiocd.h" #include "sound/mixer.h" @@ -726,8 +728,10 @@ void ScummEngine::saveOrLoad(Serializer *s, uint32 savegameVersion) { else s->saveLoadArrayOf(vm.slot, NUM_SCRIPT_SLOT, sizeof(vm.slot[0]), scriptSlotEntries); - if (_heversion >= 71) - s->saveLoadArrayOf(_wiz._polygons, ARRAYSIZE(_wiz._polygons), sizeof(_wiz._polygons[0]), polygonEntries); + if (_heversion >= 71) { + Wiz *wiz = &((ScummEngine_v70he *)this)->_wiz; + s->saveLoadArrayOf(wiz->_polygons, ARRAYSIZE(wiz->_polygons), sizeof(wiz->_polygons[0]), polygonEntries); + } s->saveLoadArrayOf(_objs, _numLocalObjects, sizeof(_objs[0]), objectEntries); if (s->isLoading() && savegameVersion < VER(13)) { // Since roughly v13 of the save games, the objs storage has changed a bit diff --git a/scumm/scumm.cpp b/scumm/scumm.cpp index 310a0ecc8e..c9bba5650f 100644 --- a/scumm/scumm.cpp +++ b/scumm/scumm.cpp @@ -1311,6 +1311,7 @@ void ScummEngine_v60he::scummInit() { void ScummEngine_v90he::scummInit() { ScummEngine_v80he::scummInit(); +debug(0, "sizeof(_wiz) = %d", sizeof(_wiz)); _heObject = 0; _heObjectNum = 0; _hePaletteNum = 0; @@ -1818,7 +1819,7 @@ void ScummEngine::startScene(int room, Actor *a, int objectNr) { _sound->processSoundQues(); if (_heversion >= 71) { - memset(_wiz._polygons, 0, sizeof(_wiz._polygons)); + ((ScummEngine_v70he *)this)->_wiz.polygonClear(); } // For HE80+ games @@ -2353,31 +2354,8 @@ void ScummEngine::initRoomSubBlocks() { if (_heversion >= 80) { ptr = findResourceData(MKID('POLD'), roomptr); if (ptr) { - int slots = READ_LE_UINT32(ptr); - ptr += 4; - debug(1, "Loading %d polygon slots", slots); - - bool flag = 1; - int id, points, vert1x, vert1y, vert2x, vert2y, vert3x, vert3y, vert4x, vert4y; - while (slots--) { - id = READ_LE_UINT32(ptr); - points = READ_LE_UINT32(ptr + 4); - if (points != 4) - error("Illegal polygon with %d points", points); - vert1x = READ_LE_UINT32(ptr + 8); - vert1y = READ_LE_UINT32(ptr + 12); - vert2x = READ_LE_UINT32(ptr + 16); - vert2y = READ_LE_UINT32(ptr + 20); - vert3x = READ_LE_UINT32(ptr + 24); - vert3y = READ_LE_UINT32(ptr + 28); - vert4x = READ_LE_UINT32(ptr + 32); - vert4y = READ_LE_UINT32(ptr + 36); - - ptr += 40; - _wiz.polygonStore(id, flag, vert1x, vert1y, vert2x, vert2y, vert3x, vert3y, vert4x, vert4y); - } + ((ScummEngine_v70he *)this)->_wiz.polygonLoad(ptr); } - } if (_PALS_offs || _CLUT_offs) diff --git a/scumm/scumm.h b/scumm/scumm.h index df1fddfa7b..06237281f6 100644 --- a/scumm/scumm.h +++ b/scumm/scumm.h @@ -32,7 +32,6 @@ #include "scumm/gfx.h" #include "scumm/script.h" #include "scumm/util.h" -#include "scumm/wiz_he.h" namespace GUI { class Dialog; @@ -334,9 +333,6 @@ public: /** Graphics manager */ Gdi gdi; - /** Wiz graphics manager (HE) */ - Wiz _wiz; - protected: /** Central resource data. */ struct { diff --git a/scumm/wiz_he.cpp b/scumm/wiz_he.cpp index 6e68454a7d..d16adaa2ad 100644 --- a/scumm/wiz_he.cpp +++ b/scumm/wiz_he.cpp @@ -35,6 +35,36 @@ Wiz::Wiz() { memset(&_polygons, 0, sizeof(_polygons)); } +void Wiz::polygonClear() { + memset(&_polygons, 0, sizeof(_polygons)); +} + +void Wiz::polygonLoad(const uint8 *polData) { + int slots = READ_LE_UINT32(polData); + polData += 4; + debug(1, "Loading %d polygon slots", slots); + + bool flag = 1; + int id, points, vert1x, vert1y, vert2x, vert2y, vert3x, vert3y, vert4x, vert4y; + while (slots--) { + id = READ_LE_UINT32(polData); + points = READ_LE_UINT32(polData + 4); + if (points != 4) + error("Illegal polygon with %d points", points); + vert1x = READ_LE_UINT32(polData + 8); + vert1y = READ_LE_UINT32(polData + 12); + vert2x = READ_LE_UINT32(polData + 16); + vert2y = READ_LE_UINT32(polData + 20); + vert3x = READ_LE_UINT32(polData + 24); + vert3y = READ_LE_UINT32(polData + 28); + vert4x = READ_LE_UINT32(polData + 32); + vert4y = READ_LE_UINT32(polData + 36); + + polData += 40; + polygonStore(id, flag, vert1x, vert1y, vert2x, vert2y, vert3x, vert3y, vert4x, vert4y); + } +} + void Wiz::polygonStore(int id, bool flag, int vert1x, int vert1y, int vert2x, int vert2y, int vert3x, int vert3y, int vert4x, int vert4y) { WizPolygon *wp = NULL; for (int i = 0; i < ARRAYSIZE(_polygons); ++i) { diff --git a/scumm/wiz_he.h b/scumm/wiz_he.h index 277d0d1498..c536083539 100644 --- a/scumm/wiz_he.h +++ b/scumm/wiz_he.h @@ -89,16 +89,18 @@ struct Wiz { Wiz(); + void polygonClear(); + void polygonLoad(const uint8 *polData); void polygonStore(int id, bool flag, int vert1x, int vert1y, int vert2x, int vert2y, int vert3x, int vert3y, int vert4x, int vert4y); void polygonErase(int fromId, int toId); int polygonHit(int id, int x, int y); bool polygonDefined(int id); bool polygonContains(const WizPolygon &pol, int x, int y); - void copyAuxImage(uint8 *dst1, uint8 *dst2, const uint8 *src, int dstw, int dsth, int srcx, int srcy, int srcw, int srch); - void copyWizImage(uint8 *dst, const uint8 *src, int dstw, int dsth, int srcx, int srcy, int srcw, int srch, const Common::Rect *rect); - void copyRawWizImage(uint8 *dst, const uint8 *src, int dstw, int dsth, int srcx, int srcy, int srcw, int srch, const Common::Rect *rect, int flags, const uint8 *palPtr, int transColor); - void decompressWizImage(uint8 *dst, int dstPitch, const Common::Rect &dstRect, const uint8 *src, const Common::Rect &srcRect, const uint8 *imagePal = NULL); + static void copyAuxImage(uint8 *dst1, uint8 *dst2, const uint8 *src, int dstw, int dsth, int srcx, int srcy, int srcw, int srch); + static void copyWizImage(uint8 *dst, const uint8 *src, int dstw, int dsth, int srcx, int srcy, int srcw, int srch, const Common::Rect *rect); + static void copyRawWizImage(uint8 *dst, const uint8 *src, int dstw, int dsth, int srcx, int srcy, int srcw, int srch, const Common::Rect *rect, int flags, const uint8 *palPtr, int transColor); + static void decompressWizImage(uint8 *dst, int dstPitch, const Common::Rect &dstRect, const uint8 *src, const Common::Rect &srcRect, const uint8 *imagePal = NULL); int isWizPixelNonTransparent(const uint8 *data, int x, int y, int w, int h); uint8 getWizPixelColor(const uint8 *data, int x, int y, int w, int h, uint8 color); uint8 getRawWizPixelColor(const uint8 *data, int x, int y, int w, int h, uint8 color); -- cgit v1.2.3