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
This commit is contained in:
Gregory Montoir 2004-12-19 12:30:40 +00:00
parent ec2099a902
commit da874257a5
10 changed files with 56 additions and 40 deletions

View file

@ -31,6 +31,7 @@
#include "scumm/saveload.h" #include "scumm/saveload.h"
#include "scumm/sound.h" #include "scumm/sound.h"
#include "scumm/usage_bits.h" #include "scumm/usage_bits.h"
#include "scumm/wiz_he.h"
namespace Scumm { namespace Scumm {
@ -1921,7 +1922,7 @@ void ScummEngine::postProcessAuxQueue() {
uint8 *dst2 = pvs->getBackPixels(0, pvs->topline); uint8 *dst2 = pvs->getBackPixels(0, pvs->topline);
switch (comp) { switch (comp) {
case 1: 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; break;
default: default:
warning("unimplemented compression type %d", comp); warning("unimplemented compression type %d", comp);

View file

@ -28,6 +28,7 @@
#include "scumm/imuse.h" #include "scumm/imuse.h"
#include "scumm/imuse_digi/dimuse.h" #include "scumm/imuse_digi/dimuse.h"
#include "scumm/sound.h" #include "scumm/sound.h"
#include "scumm/wiz_he.h"
namespace Scumm { namespace Scumm {
@ -1238,7 +1239,7 @@ byte AkosRenderer::codec32(int xmoveCur, int ymoveCur) {
_draw_bottom = dst.bottom; _draw_bottom = dst.bottom;
byte *dstPtr = (byte *)_out.pixels + dst.left + dst.top * _out.pitch; 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; return 0;
} }

View file

@ -22,6 +22,7 @@
#include "scumm/charset.h" #include "scumm/charset.h"
#include "scumm/scumm.h" #include "scumm/scumm.h"
#include "scumm/nut_renderer.h" #include "scumm/nut_renderer.h"
#include "scumm/wiz_he.h"
namespace Scumm { namespace Scumm {
@ -1397,7 +1398,7 @@ void CharsetRendererClassic::printChar(int chr) {
byte imagePalette[256]; byte imagePalette[256];
memset(imagePalette, 255, sizeof(imagePalette)); memset(imagePalette, 255, sizeof(imagePalette));
memcpy(imagePalette, _vm->_charsetColorMap, 16); 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) if (_blitAlso && vs->hasTwoBuffers)
_vm->gdi.copyVirtScreenBuffers(dst); _vm->gdi.copyVirtScreenBuffers(dst);

View file

@ -26,6 +26,7 @@
#include "scumm/intern.h" #include "scumm/intern.h"
#include "scumm/resource.h" #include "scumm/resource.h"
#include "scumm/usage_bits.h" #include "scumm/usage_bits.h"
#include "scumm/wiz_he.h"
#if defined(__PALM_OS__) #if defined(__PALM_OS__)
#include "init_arm.h" #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) { if (code == 8 || code == 9) {
Common::Rect rScreen(0, 0, vs->w, vs->h); Common::Rect rScreen(0, 0, vs->w, vs->h);
byte *dst = (byte *)_vm->virtscr[0].backBuf + scrX; 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); Common::Rect rect1(x, y, x + w, y + h);

View file

@ -24,7 +24,7 @@
#define INTERN_H #define INTERN_H
#include "scumm/scumm.h" #include "scumm/scumm.h"
#include "scumm/wiz_he.h"
namespace Scumm { namespace Scumm {
@ -649,6 +649,8 @@ protected:
public: public:
ScummEngine_v70he(GameDetector *detector, OSystem *syst, const ScummGameSettings &gs, uint8 md5sum[16]); ScummEngine_v70he(GameDetector *detector, OSystem *syst, const ScummGameSettings &gs, uint8 md5sum[16]);
Wiz _wiz;
protected: protected:
virtual void setupOpcodes(); virtual void setupOpcodes();
virtual void executeOpcode(byte i); virtual void executeOpcode(byte i);

View file

@ -28,12 +28,14 @@
#include "scumm/charset.h" #include "scumm/charset.h"
#include "scumm/imuse_digi/dimuse.h" #include "scumm/imuse_digi/dimuse.h"
#include "scumm/imuse.h" #include "scumm/imuse.h"
#include "scumm/intern.h"
#include "scumm/object.h" #include "scumm/object.h"
#include "scumm/resource.h" #include "scumm/resource.h"
#include "scumm/saveload.h" #include "scumm/saveload.h"
#include "scumm/scumm.h" #include "scumm/scumm.h"
#include "scumm/sound.h" #include "scumm/sound.h"
#include "scumm/verbs.h" #include "scumm/verbs.h"
#include "scumm/wiz_he.h"
#include "sound/audiocd.h" #include "sound/audiocd.h"
#include "sound/mixer.h" #include "sound/mixer.h"
@ -726,8 +728,10 @@ void ScummEngine::saveOrLoad(Serializer *s, uint32 savegameVersion) {
else else
s->saveLoadArrayOf(vm.slot, NUM_SCRIPT_SLOT, sizeof(vm.slot[0]), scriptSlotEntries); s->saveLoadArrayOf(vm.slot, NUM_SCRIPT_SLOT, sizeof(vm.slot[0]), scriptSlotEntries);
if (_heversion >= 71) if (_heversion >= 71) {
s->saveLoadArrayOf(_wiz._polygons, ARRAYSIZE(_wiz._polygons), sizeof(_wiz._polygons[0]), polygonEntries); 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); s->saveLoadArrayOf(_objs, _numLocalObjects, sizeof(_objs[0]), objectEntries);
if (s->isLoading() && savegameVersion < VER(13)) { if (s->isLoading() && savegameVersion < VER(13)) {
// Since roughly v13 of the save games, the objs storage has changed a bit // Since roughly v13 of the save games, the objs storage has changed a bit

View file

@ -1311,6 +1311,7 @@ void ScummEngine_v60he::scummInit() {
void ScummEngine_v90he::scummInit() { void ScummEngine_v90he::scummInit() {
ScummEngine_v80he::scummInit(); ScummEngine_v80he::scummInit();
debug(0, "sizeof(_wiz) = %d", sizeof(_wiz));
_heObject = 0; _heObject = 0;
_heObjectNum = 0; _heObjectNum = 0;
_hePaletteNum = 0; _hePaletteNum = 0;
@ -1818,7 +1819,7 @@ void ScummEngine::startScene(int room, Actor *a, int objectNr) {
_sound->processSoundQues(); _sound->processSoundQues();
if (_heversion >= 71) { if (_heversion >= 71) {
memset(_wiz._polygons, 0, sizeof(_wiz._polygons)); ((ScummEngine_v70he *)this)->_wiz.polygonClear();
} }
// For HE80+ games // For HE80+ games
@ -2353,33 +2354,10 @@ void ScummEngine::initRoomSubBlocks() {
if (_heversion >= 80) { if (_heversion >= 80) {
ptr = findResourceData(MKID('POLD'), roomptr); ptr = findResourceData(MKID('POLD'), roomptr);
if (ptr) { if (ptr) {
int slots = READ_LE_UINT32(ptr); ((ScummEngine_v70he *)this)->_wiz.polygonLoad(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);
} }
} }
}
if (_PALS_offs || _CLUT_offs) if (_PALS_offs || _CLUT_offs)
setPalette(0, _roomResource); setPalette(0, _roomResource);

View file

@ -32,7 +32,6 @@
#include "scumm/gfx.h" #include "scumm/gfx.h"
#include "scumm/script.h" #include "scumm/script.h"
#include "scumm/util.h" #include "scumm/util.h"
#include "scumm/wiz_he.h"
namespace GUI { namespace GUI {
class Dialog; class Dialog;
@ -334,9 +333,6 @@ public:
/** Graphics manager */ /** Graphics manager */
Gdi gdi; Gdi gdi;
/** Wiz graphics manager (HE) */
Wiz _wiz;
protected: protected:
/** Central resource data. */ /** Central resource data. */
struct { struct {

View file

@ -35,6 +35,36 @@ Wiz::Wiz() {
memset(&_polygons, 0, sizeof(_polygons)); 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) { 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; WizPolygon *wp = NULL;
for (int i = 0; i < ARRAYSIZE(_polygons); ++i) { for (int i = 0; i < ARRAYSIZE(_polygons); ++i) {

View file

@ -89,16 +89,18 @@ struct Wiz {
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 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); void polygonErase(int fromId, int toId);
int polygonHit(int id, int x, int y); int polygonHit(int id, int x, int y);
bool polygonDefined(int id); bool polygonDefined(int id);
bool polygonContains(const WizPolygon &pol, int x, int y); 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); static 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); static 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); 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);
void decompressWizImage(uint8 *dst, int dstPitch, const Common::Rect &dstRect, const uint8 *src, const Common::Rect &srcRect, const uint8 *imagePal = NULL); 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); 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 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); uint8 getRawWizPixelColor(const uint8 *data, int x, int y, int w, int h, uint8 color);