diff options
-rw-r--r-- | scumm/actor.cpp | 8 | ||||
-rw-r--r-- | scumm/intern.h | 122 | ||||
-rw-r--r-- | scumm/saveload.cpp | 4 | ||||
-rw-r--r-- | scumm/script_v100he.cpp | 188 | ||||
-rw-r--r-- | scumm/script_v90he.cpp | 202 | ||||
-rw-r--r-- | scumm/scumm.cpp | 14 | ||||
-rw-r--r-- | scumm/sprite_he.cpp | 271 | ||||
-rw-r--r-- | scumm/sprite_he.h | 119 |
8 files changed, 475 insertions, 453 deletions
diff --git a/scumm/actor.cpp b/scumm/actor.cpp index 6c25fc923a..483629579e 100644 --- a/scumm/actor.cpp +++ b/scumm/actor.cpp @@ -1022,8 +1022,8 @@ void ScummEngine_v71he::processActors() { void ScummEngine_v90he::processActors() { preProcessAuxQueue(); - spritesMarkDirty(false); - spritesProcessWiz(true); + _sprite->spritesMarkDirty(false); + _sprite->spritesProcessWiz(true); if (!_skipProcessActors) ScummEngine::processActors(); @@ -1032,8 +1032,8 @@ void ScummEngine_v90he::processActors() { postProcessAuxQueue(); - spritesMarkDirty(true); - spritesProcessWiz(false); + _sprite->spritesMarkDirty(true); + _sprite->spritesProcessWiz(false); } #endif diff --git a/scumm/intern.h b/scumm/intern.h index b750937305..ab1942f095 100644 --- a/scumm/intern.h +++ b/scumm/intern.h @@ -24,6 +24,7 @@ #define INTERN_H #include "scumm/scumm.h" +#include "scumm/sprite_he.h" #include "scumm/wiz_he.h" namespace Scumm { @@ -1064,11 +1065,9 @@ protected: void o80_pickVarRandom(); }; -struct SpriteInfo; -struct SpriteGroup; - class ScummEngine_v90he : public ScummEngine_v80he { friend class LogicHE; + friend class Sprite; protected: typedef void (ScummEngine_v90he::*OpcodeProcV90he)(); @@ -1095,22 +1094,15 @@ protected: int32 _curMaxSpriteId; int32 _curSpriteId; int32 _curSpriteGroupId; - int32 _numSpritesToProcess; - int32 _varNumSpriteGroups; - int32 _varNumSprites; - int32 _varMaxSprites; - SpriteInfo *_spriteTable; - SpriteGroup *_spriteGroups; - SpriteInfo **_activeSpritesTable; public: - ScummEngine_v90he(GameDetector *detector, OSystem *syst, const ScummGameSettings &gs, uint8 md5sum[16], int substResFileNameIndex) : ScummEngine_v80he(detector, syst, gs, md5sum, substResFileNameIndex) {} - + ScummEngine_v90he(GameDetector *detector, OSystem *syst, const ScummGameSettings &gs, uint8 md5sum[16], int substResFileNameIndex); ~ScummEngine_v90he(); virtual void scummInit(); LogicHE *_logicHE; + Sprite *_sprite; protected: virtual void allocateArrays(); @@ -1129,7 +1121,11 @@ protected: int computeWizHistogram(int resnum, int state, int x, int y, int w, int h); void getArrayDim(int array, int *dim2start, int *dim2end, int *dim1start, int *dim1end); void sortArray(int array, int dim2start, int dim2end, int dim1start, int dim1end, int sortOrder); - + +public: + int getGroupallocateGroupSpritesList(int spriteGroupId); + +protected: uint8 *getHEPaletteIndex(int palSlot); int getHEPaletteColor(int palSlot, int color); int getHEPaletteSimilarColor(int palSlot, int red, int green, int start, int end); @@ -1143,109 +1139,9 @@ protected: void copyHEPalette(int dstPalSlot, int srcPalSlot); void copyHEPaletteColor(int palSlot, uint8 dstColor, uint8 srcColor); - void getSpriteBounds(int spriteId, bool checkGroup, Common::Rect &bound); - int findSpriteWithClassOf(int x, int y, int spriteGroupId, int d, int num, int *args); - int spriteInfoGet_classFlags(int spriteId, int num, int *args); - int spriteInfoGet_flagDoubleBuffered(int spriteId); - int spriteInfoGet_flagYFlipped(int spriteId); - int spriteInfoGet_flagXFlipped(int spriteId); - int spriteInfoGet_flagActive(int spriteId); - int spriteInfoGet_flagNeedPaletteRemap(int spriteId); - int spriteInfoGet_flagDelayed(int spriteId); - int spriteInfoGet_flagMarkDirty(int spriteId); - int spriteInfoGet_flagHasImage(int spriteId); - int spriteInfoGet_resId(int spriteId); - int spriteInfoGet_resState(int spriteId); - int spriteInfoGet_groupNum(int spriteId); - int spriteInfoGet_paletteNum(int spriteId); - int spriteInfoGet_zorderPriority(int spriteId); - int spriteInfoGet_grp_tx(int spriteId); - int spriteInfoGet_grp_ty(int spriteId); - int spriteInfoGet_field_44(int spriteId); - int spriteInfoGet_xmapNum(int spriteId); - int spriteInfoGet_wizSize(int spriteId); - int spriteInfoGet_zoom(int spriteId); - int spriteInfoGet_delayAmount(int spriteId); - int spriteInfoGet_maskImgResNum(int spriteId); - int spriteInfoGet_field_80(int spriteId); - int spriteInfoGet_field_8C_90(int spriteId, int type); - void getSpriteImageDim(int spriteId, int32 &w, int32 &h); - void spriteInfoGet_tx_ty(int spriteId, int32 &tx, int32 &ty); - void spriteInfoGet_dx_dy(int spriteId, int32 &dx, int32 &dy); - - int spriteGroupGet_allocateGroupSpritesList(int spriteGroupId); - int spriteGroupGet_zorderPriority(int spriteGroupId); - int spriteGroupGet_dstResNum(int spriteGroupId); - int spriteGroupGet_scale_x_ratio_mul(int spriteGroupId); - int spriteGroupGet_scale_x_ratio_div(int spriteGroupId); - int spriteGroupGet_scale_y_ratio_mul(int spriteGroupId); - int spriteGroupGet_scale_y_ratio_div(int spriteGroupId); - void spriteGroupGet_tx_ty(int spriteGroupId, int32 &tx, int32 &ty); - - void spriteInfoSet_paletteNum(int spriteId, int value); - void spriteInfoSet_maskImgResNum(int spriteId, int value); - void spriteInfoSet_field_80(int spriteId, int value); - void spriteInfoSet_resetSprite(int spriteId); - void spriteInfoSet_resState(int spriteId, int value); - void spriteInfoSet_tx_ty(int spriteId, int value1, int value2); - void spriteInfoSet_groupNum(int spriteId, int value); - void spriteInfoSet_dx_dy(int spriteId, int value1, int value2); - void spriteInfoSet_xmapNum(int spriteId, int value); - void spriteInfoSet_field_44(int spriteId, int value1, int value2); - void spriteInfoSet_zorderPriority(int spriteId, int value); - void spriteInfoSet_Inc_tx_ty(int spriteId, int value1, int value2); - void spriteInfoSet_zoom(int spriteId, int value); - void spriteInfoSet_angle(int spriteId, int value); - void spriteInfoSet_flagDoubleBuffered(int spriteId, int value); - void spriteInfoSet_flagYFlipped(int spriteId, int value); - void spriteInfoSet_flagXFlipped(int spriteId, int value); - void spriteInfoSet_flagActive(int spriteId, int value); - void spriteInfoSet_flagNeedPaletteRemap(int spriteId, int value); - void spriteInfoSet_flagDelayed(int spriteId, int value); - void spriteInfoSet_flagMarkDirty(int spriteId, int value); - void spriteInfoSet_flagHasImage(int spriteId, int value); - void spriteInfoSet_delay(int spriteId, int value); - void spriteInfoSet_setClassFlag(int spriteId, int classId, int toggle); - void spriteInfoSet_resetClassFlags(int spriteId); - void spriteInfoSet_field_84(int spriteId, int value); - void spriteInfoSet_field_8C_90(int spriteId, int type, int value); - - void redrawSpriteGroup(int spriteGroupId); - void spriteGroupSet_case0_0(int spriteGroupId, int value1, int value2); - void spriteGroupSet_case0_1(int spriteGroupId, int value); - void spriteGroupSet_case0_2(int spriteGroupId, int value); - void spriteGroupSet_case0_3(int spriteGroupId, int value); - void spriteGroupSet_case0_4(int spriteGroupId); - void spriteGroupSet_case0_5(int spriteGroupId, int value); - void spriteGroupSet_case0_6(int spriteGroupId, int value); - void spriteGroupSet_case0_7(int spriteGroupId, int value); - void spriteGroupSet_bbox(int spriteGroupId, int x1, int y1, int x2, int y2); - void spriteGroupSet_zorderPriority(int spriteGroupId, int value); - void spriteGroupSet_tx_ty(int spriteGroupId, int value1, int value2); - void spriteGroupSet_inc_tx_ty(int spriteGroupId, int value1, int value2); - void spriteGroupSet_dstResNum(int spriteGroupId, int value); - void spriteGroupSet_scaling(int spriteGroupId); - void spriteGroupSet_scale_x_ratio_mul(int spriteGroupId, int value); - void spriteGroupSet_scale_x_ratio_div(int spriteGroupId, int value); - void spriteGroupSet_scale_y_ratio_mul(int spriteGroupId, int value); - void spriteGroupSet_scale_y_ratio_div(int spriteGroupId, int value); - void spriteGroupSet_flagClipBoxAnd(int spriteGroupId); - - void spritesAllocTables(int numSprites, int numGroups, int numMaxSprites); - void spritesResetGroup(int spriteGroupId); - void spritesResetTables(bool refreshScreen); - void spriteAddImageToList(int spriteId, int imageNum, int *spriteIdptr); void setDefaultCursor(); -public: - void saveOrLoadSpriteData(Serializer *s, uint32 savegameVersion); - void spritesBlitToScreen(); - void spritesMarkDirty(bool checkZOrder); - void spritesSortActiveSprites(); - void spritesProcessWiz(bool arg); - void spritesUpdateImages(); - protected: /* HE version 90 script opcodes */ void o90_dup_n(); diff --git a/scumm/saveload.cpp b/scumm/saveload.cpp index a5064607f1..d276c8257a 100644 --- a/scumm/saveload.cpp +++ b/scumm/saveload.cpp @@ -1077,14 +1077,14 @@ void ScummEngine_v90he::saveOrLoad(Serializer *s, uint32 savegameVersion) { MKLINE(ScummEngine_v90he, _curMaxSpriteId, sleInt32, VER(51)), MKLINE(ScummEngine_v90he, _curSpriteId, sleInt32, VER(51)), MKLINE(ScummEngine_v90he, _curSpriteGroupId, sleInt32, VER(51)), - MKLINE(ScummEngine_v90he, _numSpritesToProcess, sleInt32, VER(51)), + MKLINE(ScummEngine_v90he, _sprite->_numSpritesToProcess, sleInt32, VER(51)), MKLINE(ScummEngine_v90he, _heObject, sleInt32, VER(51)), MKLINE(ScummEngine_v90he, _heObjectNum, sleInt32, VER(51)), MKLINE(ScummEngine_v90he, _hePaletteNum, sleInt32, VER(51)), MKEND() }; - saveOrLoadSpriteData(&*s, savegameVersion); + _sprite->saveOrLoadSpriteData(&*s, savegameVersion); s->saveLoadArrayOf(&_floodStateParams, 1, sizeof(_floodStateParams), floodStateEntries); s->saveLoadEntries(this, HE90Entries); diff --git a/scumm/script_v100he.cpp b/scumm/script_v100he.cpp index c158c4daa2..0f74500bab 100644 --- a/scumm/script_v100he.cpp +++ b/scumm/script_v100he.cpp @@ -884,7 +884,7 @@ void ScummEngine_v100he::o100_setSpriteGroupInfo() { if (!_curSpriteGroupId) break; - spriteGroupSet_tx_ty(_curSpriteGroupId, value1, value2); + _sprite->setGrouptx_ty(_curSpriteGroupId, value1, value2); break; case 18: value4 = pop(); @@ -894,7 +894,7 @@ void ScummEngine_v100he::o100_setSpriteGroupInfo() { if (!_curSpriteGroupId) break; - spriteGroupSet_bbox(_curSpriteGroupId, value1, value2, value3, value4); + _sprite->setGroupbbox(_curSpriteGroupId, value1, value2, value3, value4); break; case 38: type = pop() - 1; @@ -905,55 +905,55 @@ void ScummEngine_v100he::o100_setSpriteGroupInfo() { if (!_curSpriteGroupId) break; - spriteGroupSet_case0_0(_curSpriteGroupId, value1, value2); + _sprite->setGroupCase0_0(_curSpriteGroupId, value1, value2); break; case 1: value1 = pop(); if (!_curSpriteGroupId) break; - spriteGroupSet_case0_1(_curSpriteGroupId, value1); + _sprite->setGroupCase0_1(_curSpriteGroupId, value1); break; case 2: value1 = pop(); if (!_curSpriteGroupId) break; - spriteGroupSet_case0_2(_curSpriteGroupId, value1); + _sprite->setGroupCase0_2(_curSpriteGroupId, value1); break; case 3: value1 = pop(); if (!_curSpriteGroupId) break; - spriteGroupSet_case0_3(_curSpriteGroupId, value1); + _sprite->setGroupCase0_3(_curSpriteGroupId, value1); break; case 4: if (!_curSpriteGroupId) break; - spriteGroupSet_case0_4(_curSpriteGroupId); + _sprite->setGroupCase0_4(_curSpriteGroupId); break; case 5: value1 = pop(); if (!_curSpriteGroupId) break; - spriteGroupSet_case0_5(_curSpriteGroupId, value1); + _sprite->setGroupCase0_5(_curSpriteGroupId, value1); break; case 6: value1 = pop(); if (!_curSpriteGroupId) break; - spriteGroupSet_case0_6(_curSpriteGroupId, value1); + _sprite->setGroupCase0_6(_curSpriteGroupId, value1); break; case 7: value1 = pop(); if (!_curSpriteGroupId) break; - spriteGroupSet_case0_7(_curSpriteGroupId, value1); + _sprite->setGroupCase0_7(_curSpriteGroupId, value1); break; default: error("o100_setSpriteGroupInfo subOp 38: Unknown case %d", subOp); @@ -964,7 +964,7 @@ void ScummEngine_v100he::o100_setSpriteGroupInfo() { if (!_curSpriteGroupId) break; - spriteGroupSet_dstResNum(_curSpriteGroupId, value1); + _sprite->setGroupdstResNum(_curSpriteGroupId, value1); break; case 49: value2 = pop(); @@ -972,7 +972,7 @@ void ScummEngine_v100he::o100_setSpriteGroupInfo() { if (!_curSpriteGroupId) break; - spriteGroupSet_inc_tx_ty(_curSpriteGroupId, value1, value2); + _sprite->setGroupinc_tx_ty(_curSpriteGroupId, value1, value2); break; case 52: copyScriptString(string, sizeof(string)); @@ -981,7 +981,7 @@ void ScummEngine_v100he::o100_setSpriteGroupInfo() { if (!_curSpriteGroupId) break; - spritesResetGroup(_curSpriteGroupId); + _sprite->spritesResetGroup(_curSpriteGroupId); break; case 54: // dummy case @@ -993,7 +993,7 @@ void ScummEngine_v100he::o100_setSpriteGroupInfo() { if (!_curSpriteGroupId) break; - spriteGroupSet_zorderPriority(_curSpriteGroupId, value1); + _sprite->setGroupzorderPriority(_curSpriteGroupId, value1); break; case 60: type = pop(); @@ -1003,16 +1003,16 @@ void ScummEngine_v100he::o100_setSpriteGroupInfo() { switch (type) { case 0: - spriteGroupSet_scale_x_ratio_mul(_curSpriteGroupId, value1); + _sprite->setGroupScale_x_ratio_mul(_curSpriteGroupId, value1); break; case 1: - spriteGroupSet_scale_x_ratio_div(_curSpriteGroupId, value1); + _sprite->setGroupScale_x_ratio_div(_curSpriteGroupId, value1); break; case 2: - spriteGroupSet_scale_y_ratio_mul(_curSpriteGroupId, value1); + _sprite->setGroupScale_y_ratio_mul(_curSpriteGroupId, value1); break; case 3: - spriteGroupSet_scale_y_ratio_div(_curSpriteGroupId, value1); + _sprite->setGroupScale_y_ratio_div(_curSpriteGroupId, value1); break; default: error("o100_setSpriteGroupInfo subOp 60: Unknown case %d", subOp); @@ -1022,7 +1022,7 @@ void ScummEngine_v100he::o100_setSpriteGroupInfo() { if (!_curSpriteGroupId) break; - spriteGroupSet_flagClipBoxAnd(_curSpriteGroupId); + _sprite->setGroupflagClipBoxAnd(_curSpriteGroupId); break; default: error("o100_setSpriteGroupInfo: Unknown case %d", subOp); @@ -1715,7 +1715,7 @@ void ScummEngine_v100he::o100_setSpriteInfo() { spriteId++; for (; spriteId <= _curMaxSpriteId; spriteId++) - spriteInfoSet_angle(spriteId, args[0]); + _sprite->setSpriteAngle(spriteId, args[0]); break; case 3: args[0] = pop(); @@ -1726,7 +1726,7 @@ void ScummEngine_v100he::o100_setSpriteInfo() { spriteId++; for (; spriteId <= _curMaxSpriteId; spriteId++) - spriteInfoSet_flagDelayed(spriteId, args[0]); + _sprite->setSpriteFlagDelayed(spriteId, args[0]); break; case 4: args[0] = pop(); @@ -1737,7 +1737,7 @@ void ScummEngine_v100he::o100_setSpriteInfo() { spriteId++; for (; spriteId <= _curMaxSpriteId; spriteId++) - spriteInfoSet_delay(spriteId, args[0]); + _sprite->setSpriteDelay(spriteId, args[0]); break; case 6: args[1] = pop(); @@ -1749,7 +1749,7 @@ void ScummEngine_v100he::o100_setSpriteInfo() { spriteId++; for (; spriteId <= _curMaxSpriteId; spriteId++) - spriteInfoSet_tx_ty(spriteId, args[0], args[1]); + _sprite->setSpritetx_ty(spriteId, args[0], args[1]); break; case 7: args[0] = pop(); @@ -1760,7 +1760,7 @@ void ScummEngine_v100he::o100_setSpriteInfo() { spriteId++; for (; spriteId <= _curMaxSpriteId; spriteId++) - spriteInfoSet_maskImgResNum(spriteId, args[0]); + _sprite->setSpriteMaskImgResNum(spriteId, args[0]); break; case 16: n = getStackList(args, ARRAYSIZE(args)); @@ -1770,15 +1770,15 @@ void ScummEngine_v100he::o100_setSpriteInfo() { int code = *p; if (code == 0) { for (int i = _curSpriteId; i <= _curMaxSpriteId; ++i) { - spriteInfoSet_resetClassFlags(i); + _sprite->setSpriteResetClassFlags(i); } } else if (code & 0x80) { for (int i = _curSpriteId; i <= _curMaxSpriteId; ++i) { - spriteInfoSet_setClassFlag(i, code & 0x7F, 1); + _sprite->setSpriteSetClassFlag(i, code & 0x7F, 1); } } else { for (int i = _curSpriteId; i <= _curMaxSpriteId; ++i) { - spriteInfoSet_setClassFlag(i, code & 0x7F, 0); + _sprite->setSpriteSetClassFlag(i, code & 0x7F, 0); } } --p; @@ -1794,7 +1794,7 @@ void ScummEngine_v100he::o100_setSpriteInfo() { spriteId++; for (; spriteId <= _curMaxSpriteId; spriteId++) - spriteInfoSet_flagHasImage(spriteId, args[0]); + _sprite->setSpriteFlagHasImage(spriteId, args[0]); break; case 38: args[0] = pop(); @@ -1805,7 +1805,7 @@ void ScummEngine_v100he::o100_setSpriteInfo() { spriteId++; for (; spriteId <= _curMaxSpriteId; spriteId++) - spriteInfoSet_groupNum(spriteId, args[0]); + _sprite->setSpriteGroupNum(spriteId, args[0]); break; case 40: args[0] = pop(); @@ -1816,7 +1816,7 @@ void ScummEngine_v100he::o100_setSpriteInfo() { spriteId++; for (; spriteId <= _curMaxSpriteId; spriteId++) - spriteAddImageToList(spriteId, 1, &args[0]); + _sprite->spriteAddImageToList(spriteId, 1, &args[0]); break; case 48: args[0] = pop(); @@ -1827,7 +1827,7 @@ void ScummEngine_v100he::o100_setSpriteInfo() { spriteId++; for (; spriteId <= _curMaxSpriteId; spriteId++) - spriteInfoSet_field_80(spriteId, args[0]); + _sprite->setSpriteField80(spriteId, args[0]); break; case 49: args[1] = pop(); @@ -1839,7 +1839,7 @@ void ScummEngine_v100he::o100_setSpriteInfo() { spriteId++; for (; spriteId <= _curMaxSpriteId; spriteId++) - spriteInfoSet_Inc_tx_ty(spriteId, args[0], args[1]); + _sprite->setSpriteInc_tx_ty(spriteId, args[0], args[1]); break; case 52: copyScriptString(string, sizeof(string)); @@ -1852,7 +1852,7 @@ void ScummEngine_v100he::o100_setSpriteInfo() { spriteId++; for (; spriteId <= _curMaxSpriteId; spriteId++) - spriteInfoSet_resetSprite(spriteId); + _sprite->setSpriteResetSprite(spriteId); break; case 54: args[1] = pop(); @@ -1864,7 +1864,7 @@ void ScummEngine_v100he::o100_setSpriteInfo() { spriteId++; for (; spriteId <= _curMaxSpriteId; spriteId++) - spriteInfoSet_field_8C_90(spriteId, args[0], args[1]); + _sprite->setSpriteField8C_90(spriteId, args[0], args[1]); break; case 57: args[0] = pop(); @@ -1875,7 +1875,7 @@ void ScummEngine_v100he::o100_setSpriteInfo() { spriteId++; for (; spriteId <= _curMaxSpriteId; spriteId++) - spriteInfoSet_paletteNum(spriteId, args[0]); + _sprite->setSpritePaletteNum(spriteId, args[0]); break; case 59: args[0] = pop(); @@ -1886,7 +1886,7 @@ void ScummEngine_v100he::o100_setSpriteInfo() { spriteId++; for (; spriteId <= _curMaxSpriteId; spriteId++) - spriteInfoSet_zorderPriority(spriteId, args[0]); + _sprite->setSpriteZorderPriority(spriteId, args[0]); break; case 60: args[1] = pop(); @@ -1900,26 +1900,26 @@ void ScummEngine_v100he::o100_setSpriteInfo() { for (; spriteId <= _curMaxSpriteId; spriteId++) switch(args[1]) { case 0: - spriteInfoSet_flagXFlipped(spriteId, args[0]); + _sprite->setSpriteFlagXFlipped(spriteId, args[0]); break; case 1: - spriteInfoSet_flagYFlipped(spriteId, args[0]); + _sprite->setSpriteFlagYFlipped(spriteId, args[0]); break; case 2: - spriteInfoSet_flagActive(spriteId, args[0]); + _sprite->setSpriteFlagActive(spriteId, args[0]); break; case 3: - spriteInfoSet_flagDoubleBuffered(spriteId, args[0]); + _sprite->setSpriteFlagDoubleBuffered(spriteId, args[0]); break; case 4: - spriteInfoSet_flagNeedPaletteRemap(spriteId, args[0]); + _sprite->setSpriteFlagNeedPaletteRemap(spriteId, args[0]); break; default: break; } break; case 61: - spritesResetTables(true); + _sprite->spritesResetTables(true); break; case 65: args[0] = pop(); @@ -1930,7 +1930,7 @@ void ScummEngine_v100he::o100_setSpriteInfo() { spriteId++; for (; spriteId <= _curMaxSpriteId; spriteId++) - spriteInfoSet_zoom(spriteId, args[0]); + _sprite->setSpriteZoom(spriteId, args[0]); break; case 70: args[0] = pop(); @@ -1941,7 +1941,7 @@ void ScummEngine_v100he::o100_setSpriteInfo() { spriteId++; for (; spriteId <= _curMaxSpriteId; spriteId++) - spriteInfoSet_xmapNum(spriteId, args[0]); + _sprite->setSpriteXmapNum(spriteId, args[0]); break; case 73: args[0] = pop(); @@ -1952,7 +1952,7 @@ void ScummEngine_v100he::o100_setSpriteInfo() { spriteId++; for (; spriteId <= _curMaxSpriteId; spriteId++) - spriteInfoSet_resState(spriteId, args[0]); + _sprite->setSpriteResState(spriteId, args[0]); break; case 74: args[1] = pop(); @@ -1964,7 +1964,7 @@ void ScummEngine_v100he::o100_setSpriteInfo() { spriteId++; for (; spriteId <= _curMaxSpriteId; spriteId++) - spriteInfoSet_dx_dy(spriteId, args[0], args[1]); + _sprite->setSpritedx_dy(spriteId, args[0], args[1]); break; case 75: args[0] = pop(); @@ -1975,8 +1975,8 @@ void ScummEngine_v100he::o100_setSpriteInfo() { spriteId++; for (; spriteId <= _curMaxSpriteId; spriteId++) { - spriteInfoGet_dx_dy(spriteId, tmp[0], tmp[1]); - spriteInfoSet_dx_dy(spriteId, args[0], tmp[1]); + _sprite->getSpritedx_dy(spriteId, tmp[0], tmp[1]); + _sprite->setSpritedx_dy(spriteId, args[0], tmp[1]); } break; case 76: @@ -1988,8 +1988,8 @@ void ScummEngine_v100he::o100_setSpriteInfo() { spriteId++; for (; spriteId <= _curMaxSpriteId; spriteId++) { - spriteInfoGet_dx_dy(spriteId, tmp[0], tmp[1]); - spriteInfoSet_dx_dy(spriteId, tmp[0], args[0]); + _sprite->getSpritedx_dy(spriteId, tmp[0], tmp[1]); + _sprite->setSpritedx_dy(spriteId, tmp[0], args[0]); } break; case 82: @@ -2001,7 +2001,7 @@ void ScummEngine_v100he::o100_setSpriteInfo() { spriteId++; for (; spriteId <= _curMaxSpriteId; spriteId++) - spriteInfoSet_flagMarkDirty(spriteId, args[0]); + _sprite->setSpriteFlagMarkDirty(spriteId, args[0]); break; case 83: args[1] = pop(); @@ -2013,7 +2013,7 @@ void ScummEngine_v100he::o100_setSpriteInfo() { spriteId++; for (; spriteId <= _curMaxSpriteId; spriteId++) - spriteInfoSet_field_44(spriteId, args[0], args[1]); + _sprite->setSpriteField44(spriteId, args[0], args[1]); break; case 88: args[0] = pop(); @@ -2024,7 +2024,7 @@ void ScummEngine_v100he::o100_setSpriteInfo() { spriteId++; for (; spriteId <= _curMaxSpriteId; spriteId++) - spriteInfoSet_field_84(spriteId, args[0]); + _sprite->setSpriteField84(spriteId, args[0]); break; case 89: if (_curSpriteId > _curMaxSpriteId) @@ -2034,7 +2034,7 @@ void ScummEngine_v100he::o100_setSpriteInfo() { spriteId++; for (; spriteId <= _curMaxSpriteId; spriteId++) - spriteInfoSet_field_84(spriteId, 0); + _sprite->setSpriteField84(spriteId, 0); break; default: error("o100_setSpriteInfo: Unknown case %d", subOp); @@ -2273,14 +2273,14 @@ void ScummEngine_v100he::o100_getSpriteGroupInfo() { case 5: spriteGroupId = pop(); if (spriteGroupId) - push(spriteGroupGet_allocateGroupSpritesList(spriteGroupId)); + push(getGroupallocateGroupSpritesList(spriteGroupId)); else push(0); break; case 40: spriteGroupId = pop(); if (spriteGroupId) - push(spriteGroupGet_dstResNum(spriteGroupId)); + push(_sprite->getGroupdstResNum(spriteGroupId)); else push(0); break; @@ -2293,7 +2293,7 @@ void ScummEngine_v100he::o100_getSpriteGroupInfo() { case 59: spriteGroupId = pop(); if (spriteGroupId) - push(spriteGroupGet_zorderPriority(spriteGroupId)); + push(_sprite->getGroupzorderPriority(spriteGroupId)); else push(0); break; @@ -2303,16 +2303,16 @@ void ScummEngine_v100he::o100_getSpriteGroupInfo() { if (spriteGroupId) { switch(type) { case 0: - push(spriteGroupGet_scale_x_ratio_mul(spriteGroupId)); + push(_sprite->getGroupScale_x_ratio_mul(spriteGroupId)); break; case 1: - push(spriteGroupGet_scale_x_ratio_div(spriteGroupId)); + push(_sprite->getGroupScale_x_ratio_div(spriteGroupId)); break; case 2: - push(spriteGroupGet_scale_y_ratio_mul(spriteGroupId)); + push(_sprite->getGroupScale_y_ratio_mul(spriteGroupId)); break; case 3: - push(spriteGroupGet_scale_y_ratio_div(spriteGroupId)); + push(_sprite->getGroupScale_y_ratio_div(spriteGroupId)); break; default: push(0); @@ -2324,7 +2324,7 @@ void ScummEngine_v100he::o100_getSpriteGroupInfo() { case 85: spriteGroupId = pop(); if (spriteGroupId) { - spriteGroupGet_tx_ty(spriteGroupId, tx, ty); + _sprite->getGrouptx_ty(spriteGroupId, tx, ty); push(tx); } else { push(0); @@ -2333,7 +2333,7 @@ void ScummEngine_v100he::o100_getSpriteGroupInfo() { case 86: spriteGroupId = pop(); if (spriteGroupId) { - spriteGroupGet_tx_ty(spriteGroupId, tx, ty); + _sprite->getGrouptx_ty(spriteGroupId, tx, ty); push(ty); } else { push(0); @@ -2523,21 +2523,21 @@ void ScummEngine_v100he::o100_getSpriteInfo() { case 3: spriteId = pop(); if (spriteId) - push(spriteInfoGet_flagDelayed(spriteId)); + push(_sprite->getSpriteFlagDelayed(spriteId)); else push(0); break; case 4: spriteId = pop(); if (spriteId) - push(spriteInfoGet_delayAmount(spriteId)); + push(_sprite->getSpritedelayAmount(spriteId)); else push(1); break; case 7: spriteId = pop(); if (spriteId) - push(spriteInfoGet_maskImgResNum(spriteId)); + push(_sprite->getSpritemaskImgResNum(spriteId)); else push(0); break; @@ -2545,7 +2545,7 @@ void ScummEngine_v100he::o100_getSpriteInfo() { flags = getStackList(args, ARRAYSIZE(args)); spriteId = pop(); if (spriteId) { - push(spriteInfoGet_classFlags(spriteId, flags, args)); + push(_sprite->getSpriteclassFlags(spriteId, flags, args)); } else { push(0); } @@ -2553,28 +2553,28 @@ void ScummEngine_v100he::o100_getSpriteInfo() { case 26: spriteId = pop(); if (spriteId) - push(spriteInfoGet_wizSize(spriteId)); + push(_sprite->getSpritewizSize(spriteId)); else push(0); break; case 30: spriteId = pop(); if (spriteId) - push(spriteInfoGet_grp_tx(spriteId)); + push(_sprite->getSpritegrp_tx(spriteId)); else push(0); break; case 31: spriteId = pop(); if (spriteId) - push(spriteInfoGet_grp_ty(spriteId)); + push(_sprite->getSpritegrp_ty(spriteId)); else push(0); break; case 32: spriteId = pop(); if (spriteId) - push(spriteInfoGet_flagHasImage(spriteId)); + push(_sprite->getSpriteFlagHasImage(spriteId)); else push(1); break; @@ -2584,19 +2584,19 @@ void ScummEngine_v100he::o100_getSpriteInfo() { d = pop(); e = pop(); f = pop(); - push(findSpriteWithClassOf(f, e, d, c, flags, args)); + push(_sprite->findSpriteWithClassOf(f, e, d, c, flags, args)); break; case 38: spriteId = pop(); if (spriteId) - push(spriteInfoGet_groupNum(spriteId)); + push(_sprite->getSpriteGroupNum(spriteId)); else push(0); break; case 39: spriteId = pop(); if (spriteId) { - getSpriteImageDim(spriteId, a, b); + _sprite->getSpriteImageDim(spriteId, a, b); push(b); } else { push(0); @@ -2605,14 +2605,14 @@ void ScummEngine_v100he::o100_getSpriteInfo() { case 40: spriteId = pop(); if (spriteId) - push(spriteInfoGet_resId(spriteId)); + push(_sprite->getSpriteResId(spriteId)); else push(0); break; case 48: spriteId = pop(); if (spriteId) - push(spriteInfoGet_field_80(spriteId)); + push(_sprite->getSpriteField_80(spriteId)); else push(0); break; @@ -2620,21 +2620,21 @@ void ScummEngine_v100he::o100_getSpriteInfo() { flags = pop(); spriteId = pop(); if (spriteId) - push(spriteInfoGet_field_8C_90(spriteId, flags)); + push(_sprite->getSpriteField_8C_90(spriteId, flags)); else push(0); break; case 57: spriteId = pop(); if (spriteId) - push(spriteInfoGet_paletteNum(spriteId)); + push(_sprite->getSpritePaletteNum(spriteId)); else push(0); break; case 59: spriteId = pop(); if (spriteId) - push(spriteInfoGet_zorderPriority(spriteId)); + push(_sprite->getSpriteZorderPriority(spriteId)); else push(0); break; @@ -2644,19 +2644,19 @@ void ScummEngine_v100he::o100_getSpriteInfo() { if (spriteId) { switch(flags) { case 0: - push(spriteInfoGet_flagXFlipped(spriteId)); + push(_sprite->getSpriteFlagXFlipped(spriteId)); break; case 1: - push(spriteInfoGet_flagYFlipped(spriteId)); + push(_sprite->getSpriteFlagYFlipped(spriteId)); break; case 2: - push(spriteInfoGet_flagActive(spriteId)); + push(_sprite->getSpriteFlagActive(spriteId)); break; case 3: - push(spriteInfoGet_flagDoubleBuffered(spriteId)); + push(_sprite->getSpriteFlagDoubleBuffered(spriteId)); break; case 4: - push(spriteInfoGet_flagNeedPaletteRemap(spriteId)); + push(_sprite->getSpriteFlagNeedPaletteRemap(spriteId)); break; default: push(0); @@ -2668,28 +2668,28 @@ void ScummEngine_v100he::o100_getSpriteInfo() { case 65: spriteId = pop(); if (spriteId) - push(spriteInfoGet_zoom(spriteId)); + push(_sprite->getSpritezoom(spriteId)); else push(0); break; case 70: spriteId = pop(); if (spriteId) - push(spriteInfoGet_xmapNum(spriteId)); + push(_sprite->getSpriteXmapNum(spriteId)); else push(0); break; case 73: spriteId = pop(); if (spriteId) - push(spriteInfoGet_resState(spriteId)); + push(_sprite->getSpriteResState(spriteId)); else push(0); break; case 75: spriteId = pop(); if (spriteId) { - spriteInfoGet_dx_dy(spriteId, a, b); + _sprite->getSpritedx_dy(spriteId, a, b); push(a); } else { push(0); @@ -2698,7 +2698,7 @@ void ScummEngine_v100he::o100_getSpriteInfo() { case 76: spriteId = pop(); if (spriteId) { - spriteInfoGet_dx_dy(spriteId, a, b); + _sprite->getSpritedx_dy(spriteId, a, b); push(b); } else { push(0); @@ -2707,7 +2707,7 @@ void ScummEngine_v100he::o100_getSpriteInfo() { case 82: spriteId = pop(); if (spriteId) - push(spriteInfoGet_flagMarkDirty(spriteId)); + push(_sprite->getSpriteFlagMarkDirty(spriteId)); else push(0); break; @@ -2715,14 +2715,14 @@ void ScummEngine_v100he::o100_getSpriteInfo() { pop(); spriteId = pop(); if (spriteId) - push(spriteInfoGet_field_44(spriteId)); + push(_sprite->getSpriteField_44(spriteId)); else push(0); break; case 84: spriteId = pop(); if (spriteId) { - getSpriteImageDim(spriteId, a, b); + _sprite->getSpriteImageDim(spriteId, a, b); push(a); } else { push(0); @@ -2731,7 +2731,7 @@ void ScummEngine_v100he::o100_getSpriteInfo() { case 85: spriteId = pop(); if (spriteId) { - spriteInfoGet_tx_ty(spriteId, a, b); + _sprite->getSpritetx_ty(spriteId, a, b); push(a); } else { push(0); @@ -2740,7 +2740,7 @@ void ScummEngine_v100he::o100_getSpriteInfo() { case 86: spriteId = pop(); if (spriteId) { - spriteInfoGet_tx_ty(spriteId, a, b); + _sprite->getSpritetx_ty(spriteId, a, b); push(b); } else { push(0); diff --git a/scumm/script_v90he.cpp b/scumm/script_v90he.cpp index 3cf4500840..b42f2166df 100644 --- a/scumm/script_v90he.cpp +++ b/scumm/script_v90he.cpp @@ -846,7 +846,7 @@ void ScummEngine_v90he::o90_getSpriteInfo() { case 0: spriteId = pop(); if (spriteId) { - spriteInfoGet_tx_ty(spriteId, a, b); + _sprite->getSpritetx_ty(spriteId, a, b); push(a); } else { push(0); @@ -855,7 +855,7 @@ void ScummEngine_v90he::o90_getSpriteInfo() { case 1: spriteId = pop(); if (spriteId) { - spriteInfoGet_tx_ty(spriteId, a, b); + _sprite->getSpritetx_ty(spriteId, a, b); push(b); } else { push(0); @@ -864,7 +864,7 @@ void ScummEngine_v90he::o90_getSpriteInfo() { case 2: spriteId = pop(); if (spriteId) { - getSpriteImageDim(spriteId, a, b); + _sprite->getSpriteImageDim(spriteId, a, b); push(a); } else { push(0); @@ -873,7 +873,7 @@ void ScummEngine_v90he::o90_getSpriteInfo() { case 3: spriteId = pop(); if (spriteId) { - getSpriteImageDim(spriteId, a, b); + _sprite->getSpriteImageDim(spriteId, a, b); push(b); } else { push(0); @@ -882,7 +882,7 @@ void ScummEngine_v90he::o90_getSpriteInfo() { case 4: spriteId = pop(); if (spriteId) { - spriteInfoGet_dx_dy(spriteId, a, b); + _sprite->getSpritedx_dy(spriteId, a, b); push(a); } else { push(0); @@ -891,7 +891,7 @@ void ScummEngine_v90he::o90_getSpriteInfo() { case 5: spriteId = pop(); if (spriteId) { - spriteInfoGet_dx_dy(spriteId, a, b); + _sprite->getSpritedx_dy(spriteId, a, b); push(b); } else { push(0); @@ -900,28 +900,28 @@ void ScummEngine_v90he::o90_getSpriteInfo() { case 6: spriteId = pop(); if (spriteId) - push(spriteInfoGet_wizSize(spriteId)); + push(_sprite->getSpritewizSize(spriteId)); else push(0); break; case 7: spriteId = pop(); if (spriteId) - push(spriteInfoGet_groupNum(spriteId)); + push(_sprite->getSpriteGroupNum(spriteId)); else push(0); break; case 8: spriteId = pop(); if (spriteId) - push(spriteInfoGet_grp_tx(spriteId)); + push(_sprite->getSpritegrp_tx(spriteId)); else push(0); break; case 9: spriteId = pop(); if (spriteId) - push(spriteInfoGet_grp_ty(spriteId)); + push(_sprite->getSpritegrp_ty(spriteId)); else push(0); break; @@ -931,19 +931,19 @@ void ScummEngine_v90he::o90_getSpriteInfo() { if (spriteId) { switch(flags) { case 0: - push(spriteInfoGet_flagXFlipped(spriteId)); + push(_sprite->getSpriteFlagXFlipped(spriteId)); break; case 1: - push(spriteInfoGet_flagYFlipped(spriteId)); + push(_sprite->getSpriteFlagYFlipped(spriteId)); break; case 2: - push(spriteInfoGet_flagActive(spriteId)); + push(_sprite->getSpriteFlagActive(spriteId)); break; case 3: - push(spriteInfoGet_flagDoubleBuffered(spriteId)); + push(_sprite->getSpriteFlagDoubleBuffered(spriteId)); break; case 4: - push(spriteInfoGet_flagNeedPaletteRemap(spriteId)); + push(_sprite->getSpriteFlagNeedPaletteRemap(spriteId)); break; default: push(0); @@ -955,7 +955,7 @@ void ScummEngine_v90he::o90_getSpriteInfo() { case 13: spriteId = pop(); if (spriteId) - push(spriteInfoGet_zorderPriority(spriteId)); + push(_sprite->getSpriteZorderPriority(spriteId)); else push(0); break; @@ -966,87 +966,87 @@ void ScummEngine_v90he::o90_getSpriteInfo() { d = pop(); e = pop(); f = pop(); - push(findSpriteWithClassOf(f, e, d, c, flags, args)); + push(_sprite->findSpriteWithClassOf(f, e, d, c, flags, args)); } else if (_heversion == 98) { c = pop(); d = pop(); e = pop(); f = pop(); - push(findSpriteWithClassOf(f, e, d, c, 0, 0)); + push(_sprite->findSpriteWithClassOf(f, e, d, c, 0, 0)); } else { d = pop(); e = pop(); f = pop(); - push(findSpriteWithClassOf(f, e, d, 0, 0, 0)); + push(_sprite->findSpriteWithClassOf(f, e, d, 0, 0, 0)); } break; case 22: spriteId = pop(); if (spriteId) - push(spriteInfoGet_resState(spriteId)); + push(_sprite->getSpriteResState(spriteId)); else push(0); break; case 32: spriteId = pop(); if (spriteId) - push(spriteInfoGet_maskImgResNum(spriteId)); + push(_sprite->getSpritemaskImgResNum(spriteId)); else push(0); break; case 33: spriteId = pop(); if (spriteId) - push(spriteInfoGet_resId(spriteId)); + push(_sprite->getSpriteResId(spriteId)); else push(0); break; case 38: spriteId = pop(); if (spriteId) - push(spriteInfoGet_flagHasImage(spriteId)); + push(_sprite->getSpriteFlagHasImage(spriteId)); else push(1); break; case 52: spriteId = pop(); if (spriteId) - push(spriteInfoGet_flagDelayed(spriteId)); + push(_sprite->getSpriteFlagDelayed(spriteId)); else push(0); break; case 56: spriteId = pop(); if (spriteId) - push(spriteInfoGet_paletteNum(spriteId)); + push(_sprite->getSpritePaletteNum(spriteId)); else push(0); break; case 62: spriteId = pop(); if (spriteId) - push(spriteInfoGet_zoom(spriteId)); + push(_sprite->getSpritezoom(spriteId)); else push(0); break; case 67: spriteId = pop(); if (spriteId) - push(spriteInfoGet_delayAmount(spriteId)); + push(_sprite->getSpritedelayAmount(spriteId)); else push(1); break; case 68: spriteId = pop(); if (spriteId) - push(spriteInfoGet_xmapNum(spriteId)); + push(_sprite->getSpriteXmapNum(spriteId)); else push(0); break; case 94: spriteId = pop(); if (spriteId) - push(spriteInfoGet_flagMarkDirty(spriteId)); + push(_sprite->getSpriteFlagMarkDirty(spriteId)); else push(0); break; @@ -1054,7 +1054,7 @@ void ScummEngine_v90he::o90_getSpriteInfo() { flags = getStackList(args, ARRAYSIZE(args)); spriteId = pop(); if (spriteId) { - push(spriteInfoGet_classFlags(spriteId, flags, args)); + push(_sprite->getSpriteclassFlags(spriteId, flags, args)); } else { push(0); } @@ -1063,14 +1063,14 @@ void ScummEngine_v90he::o90_getSpriteInfo() { flags = pop(); spriteId = pop(); if (spriteId) - push(spriteInfoGet_field_8C_90(spriteId, flags)); + push(_sprite->getSpriteField_8C_90(spriteId, flags)); else push(0); break; case 110: spriteId = pop(); if (spriteId) - push(spriteInfoGet_field_80(spriteId)); + push(_sprite->getSpriteField_80(spriteId)); else push(0); break; @@ -1078,7 +1078,7 @@ void ScummEngine_v90he::o90_getSpriteInfo() { pop(); spriteId = pop(); if (spriteId) - push(spriteInfoGet_field_44(spriteId)); + push(_sprite->getSpriteField_44(spriteId)); else push(0); break; @@ -1107,8 +1107,8 @@ void ScummEngine_v90he::o90_setSpriteInfo() { spriteId++; for (; spriteId <= _curMaxSpriteId; spriteId++) { - spriteInfoGet_dx_dy(spriteId, tmp[0], tmp[1]); - spriteInfoSet_dx_dy(spriteId, args[0], tmp[1]); + _sprite->getSpritedx_dy(spriteId, tmp[0], tmp[1]); + _sprite->setSpritedx_dy(spriteId, args[0], tmp[1]); } break; case 1: @@ -1120,8 +1120,8 @@ void ScummEngine_v90he::o90_setSpriteInfo() { spriteId++; for (; spriteId <= _curMaxSpriteId; spriteId++) { - spriteInfoGet_dx_dy(spriteId, tmp[0], tmp[1]); - spriteInfoSet_dx_dy(spriteId, tmp[0], args[0]); + _sprite->getSpritedx_dy(spriteId, tmp[0], tmp[1]); + _sprite->setSpritedx_dy(spriteId, tmp[0], args[0]); } break; case 3: @@ -1133,7 +1133,7 @@ void ScummEngine_v90he::o90_setSpriteInfo() { spriteId++; for (; spriteId <= _curMaxSpriteId; spriteId++) - spriteInfoSet_groupNum(spriteId, args[0]); + _sprite->setSpriteGroupNum(spriteId, args[0]); break; case 8: args[1] = pop(); @@ -1147,19 +1147,19 @@ void ScummEngine_v90he::o90_setSpriteInfo() { for (; spriteId <= _curMaxSpriteId; spriteId++) switch(args[1]) { case 0: - spriteInfoSet_flagXFlipped(spriteId, args[0]); + _sprite->setSpriteFlagXFlipped(spriteId, args[0]); break; case 1: - spriteInfoSet_flagYFlipped(spriteId, args[0]); + _sprite->setSpriteFlagYFlipped(spriteId, args[0]); break; case 2: - spriteInfoSet_flagActive(spriteId, args[0]); + _sprite->setSpriteFlagActive(spriteId, args[0]); break; case 3: - spriteInfoSet_flagDoubleBuffered(spriteId, args[0]); + _sprite->setSpriteFlagDoubleBuffered(spriteId, args[0]); break; case 4: - spriteInfoSet_flagNeedPaletteRemap(spriteId, args[0]); + _sprite->setSpriteFlagNeedPaletteRemap(spriteId, args[0]); break; default: break; @@ -1174,7 +1174,7 @@ void ScummEngine_v90he::o90_setSpriteInfo() { spriteId++; for (; spriteId <= _curMaxSpriteId; spriteId++) - spriteInfoSet_zorderPriority(spriteId, args[0]); + _sprite->setSpriteZorderPriority(spriteId, args[0]); break; case 10: args[1] = pop(); @@ -1186,7 +1186,7 @@ void ScummEngine_v90he::o90_setSpriteInfo() { spriteId++; for (; spriteId <= _curMaxSpriteId; spriteId++) - spriteInfoSet_Inc_tx_ty(spriteId, args[0], args[1]); + _sprite->setSpriteInc_tx_ty(spriteId, args[0], args[1]); break; case 18: args[0] = pop(); @@ -1197,7 +1197,7 @@ void ScummEngine_v90he::o90_setSpriteInfo() { spriteId++; for (; spriteId <= _curMaxSpriteId; spriteId++) - spriteInfoSet_resState(spriteId, args[0]); + _sprite->setSpriteResState(spriteId, args[0]); break; case 19: args[0] = pop(); @@ -1208,7 +1208,7 @@ void ScummEngine_v90he::o90_setSpriteInfo() { spriteId++; for (; spriteId <= _curMaxSpriteId; spriteId++) - spriteInfoSet_angle(spriteId, args[0]); + _sprite->setSpriteAngle(spriteId, args[0]); break; case 23: if (_features & GF_HE_985 || _heversion >= 99) { @@ -1231,7 +1231,7 @@ void ScummEngine_v90he::o90_setSpriteInfo() { spriteId++; for (; spriteId <= _curMaxSpriteId; spriteId++) - spriteInfoSet_maskImgResNum(spriteId, args[0]); + _sprite->setSpriteMaskImgResNum(spriteId, args[0]); break; case 29: args[0] = pop(); @@ -1242,7 +1242,7 @@ void ScummEngine_v90he::o90_setSpriteInfo() { spriteId++; for (; spriteId <= _curMaxSpriteId; spriteId++) - spriteAddImageToList(spriteId, 1, &args[0]); + _sprite->spriteAddImageToList(spriteId, 1, &args[0]); break; case 31: args[1] = pop(); @@ -1254,7 +1254,7 @@ void ScummEngine_v90he::o90_setSpriteInfo() { spriteId++; for (; spriteId <= _curMaxSpriteId; spriteId++) - spriteInfoSet_tx_ty(spriteId, args[0], args[1]); + _sprite->setSpritetx_ty(spriteId, args[0], args[1]); break; case 34: args[0] = pop(); @@ -1265,7 +1265,7 @@ void ScummEngine_v90he::o90_setSpriteInfo() { spriteId++; for (; spriteId <= _curMaxSpriteId; spriteId++) - spriteInfoSet_flagHasImage(spriteId, args[0]); + _sprite->setSpriteFlagHasImage(spriteId, args[0]); break; case 43: args[1] = pop(); @@ -1277,7 +1277,7 @@ void ScummEngine_v90he::o90_setSpriteInfo() { spriteId++; for (; spriteId <= _curMaxSpriteId; spriteId++) - spriteInfoSet_dx_dy(spriteId, args[0], args[1]); + _sprite->setSpritedx_dy(spriteId, args[0], args[1]); break; case 48: args[0] = pop(); @@ -1288,7 +1288,7 @@ void ScummEngine_v90he::o90_setSpriteInfo() { spriteId++; for (; spriteId <= _curMaxSpriteId; spriteId++) - spriteInfoSet_flagDelayed(spriteId, args[0]); + _sprite->setSpriteFlagDelayed(spriteId, args[0]); break; case 52: // HE 98+ args[0] = pop(); @@ -1299,7 +1299,7 @@ void ScummEngine_v90he::o90_setSpriteInfo() { spriteId++; for (; spriteId <= _curMaxSpriteId; spriteId++) - spriteInfoSet_paletteNum(spriteId, args[0]); + _sprite->setSpritePaletteNum(spriteId, args[0]); break; case 58: // HE 99+ args[0] = pop(); @@ -1310,7 +1310,7 @@ void ScummEngine_v90he::o90_setSpriteInfo() { spriteId++; for (; spriteId <= _curMaxSpriteId; spriteId++) - spriteInfoSet_zoom(spriteId, args[0]); + _sprite->setSpriteZoom(spriteId, args[0]); break; case 63: // HE 98+ args[0] = pop(); @@ -1321,7 +1321,7 @@ void ScummEngine_v90he::o90_setSpriteInfo() { spriteId++; for (; spriteId <= _curMaxSpriteId; spriteId++) - spriteInfoSet_delay(spriteId, args[0]); + _sprite->setSpriteDelay(spriteId, args[0]); break; case 64: args[0] = pop(); @@ -1332,7 +1332,7 @@ void ScummEngine_v90he::o90_setSpriteInfo() { spriteId++; for (; spriteId <= _curMaxSpriteId; spriteId++) - spriteInfoSet_xmapNum(spriteId, args[0]); + _sprite->setSpriteXmapNum(spriteId, args[0]); break; case 90: args[0] = pop(); @@ -1343,7 +1343,7 @@ void ScummEngine_v90he::o90_setSpriteInfo() { spriteId++; for (; spriteId <= _curMaxSpriteId; spriteId++) - spriteInfoSet_flagMarkDirty(spriteId, args[0]); + _sprite->setSpriteFlagMarkDirty(spriteId, args[0]); break; case 91: n = getStackList(args, ARRAYSIZE(args)); @@ -1353,15 +1353,15 @@ void ScummEngine_v90he::o90_setSpriteInfo() { int code = *p; if (code == 0) { for (int i = _curSpriteId; i <= _curMaxSpriteId; ++i) { - spriteInfoSet_resetClassFlags(i); + _sprite->setSpriteResetClassFlags(i); } } else if (code & 0x80) { for (int i = _curSpriteId; i <= _curMaxSpriteId; ++i) { - spriteInfoSet_setClassFlag(i, code & 0x7F, 1); + _sprite->setSpriteSetClassFlag(i, code & 0x7F, 1); } } else { for (int i = _curSpriteId; i <= _curMaxSpriteId; ++i) { - spriteInfoSet_setClassFlag(i, code & 0x7F, 0); + _sprite->setSpriteSetClassFlag(i, code & 0x7F, 0); } } --p; @@ -1378,7 +1378,7 @@ void ScummEngine_v90he::o90_setSpriteInfo() { spriteId++; for (; spriteId <= _curMaxSpriteId; spriteId++) - spriteInfoSet_field_8C_90(spriteId, args[0], args[1]); + _sprite->setSpriteField8C_90(spriteId, args[0], args[1]); break; case 106: // HE 99+ args[0] = pop(); @@ -1389,10 +1389,10 @@ void ScummEngine_v90he::o90_setSpriteInfo() { spriteId++; for (; spriteId <= _curMaxSpriteId; spriteId++) - spriteInfoSet_field_80(spriteId, args[0]); + _sprite->setSpriteField80(spriteId, args[0]); break; case 124: - spritesResetTables(true); + _sprite->spritesResetTables(true); break; case 164: args[1] = pop(); @@ -1404,7 +1404,7 @@ void ScummEngine_v90he::o90_setSpriteInfo() { spriteId++; for (; spriteId <= _curMaxSpriteId; spriteId++) - spriteInfoSet_field_44(spriteId, args[0], args[1]); + _sprite->setSpriteField44(spriteId, args[0], args[1]); break; case 183: if (_curSpriteId > _curMaxSpriteId) @@ -1414,7 +1414,7 @@ void ScummEngine_v90he::o90_setSpriteInfo() { spriteId++; for (; spriteId <= _curMaxSpriteId; spriteId++) - spriteInfoSet_resetSprite(spriteId); + _sprite->setSpriteResetSprite(spriteId); break; default: error("o90_setSpriteInfo: Unknown case %d", subOp); @@ -1432,14 +1432,14 @@ void ScummEngine_v90he::o90_getSpriteGroupInfo() { case 8: // HE 99+ spriteGroupId = pop(); if (spriteGroupId) - push(spriteGroupGet_allocateGroupSpritesList(spriteGroupId)); + push(getGroupallocateGroupSpritesList(spriteGroupId)); else push(0); break; case 30: spriteGroupId = pop(); if (spriteGroupId) { - spriteGroupGet_tx_ty(spriteGroupId, tx, ty); + _sprite->getGrouptx_ty(spriteGroupId, tx, ty); push(tx); } else { push(0); @@ -1448,7 +1448,7 @@ void ScummEngine_v90he::o90_getSpriteGroupInfo() { case 31: spriteGroupId = pop(); if (spriteGroupId) { - spriteGroupGet_tx_ty(spriteGroupId, tx, ty); + _sprite->getGrouptx_ty(spriteGroupId, tx, ty); push(ty); } else { push(0); @@ -1460,16 +1460,16 @@ void ScummEngine_v90he::o90_getSpriteGroupInfo() { if (spriteGroupId) { switch(type) { case 0: - push(spriteGroupGet_scale_x_ratio_mul(spriteGroupId)); + push(_sprite->getGroupScale_x_ratio_mul(spriteGroupId)); break; case 1: - push(spriteGroupGet_scale_x_ratio_div(spriteGroupId)); + push(_sprite->getGroupScale_x_ratio_div(spriteGroupId)); break; case 2: - push(spriteGroupGet_scale_y_ratio_mul(spriteGroupId)); + push(_sprite->getGroupScale_y_ratio_mul(spriteGroupId)); break; case 3: - push(spriteGroupGet_scale_y_ratio_div(spriteGroupId)); + push(_sprite->getGroupScale_y_ratio_div(spriteGroupId)); break; default: push(0); @@ -1481,14 +1481,14 @@ void ScummEngine_v90he::o90_getSpriteGroupInfo() { case 43: spriteGroupId = pop(); if (spriteGroupId) - push(spriteGroupGet_zorderPriority(spriteGroupId)); + push(_sprite->getGroupzorderPriority(spriteGroupId)); else push(0); break; case 63: // HE 99+ spriteGroupId = pop(); if (spriteGroupId) - push(spriteGroupGet_dstResNum(spriteGroupId)); + push(_sprite->getGroupdstResNum(spriteGroupId)); else push(0); break; @@ -1520,55 +1520,55 @@ void ScummEngine_v90he::o90_setSpriteGroupInfo() { if (!_curSpriteGroupId) break; - spriteGroupSet_case0_0(_curSpriteGroupId, value1, value2); + _sprite->setGroupCase0_0(_curSpriteGroupId, value1, value2); break; case 1: value1 = pop(); if (!_curSpriteGroupId) break; - spriteGroupSet_case0_1(_curSpriteGroupId, value1); + _sprite->setGroupCase0_1(_curSpriteGroupId, value1); break; case 2: value1 = pop(); if (!_curSpriteGroupId) break; - spriteGroupSet_case0_2(_curSpriteGroupId, value1); + _sprite->setGroupCase0_2(_curSpriteGroupId, value1); break; case 3: value1 = pop(); if (!_curSpriteGroupId) break; - spriteGroupSet_case0_3(_curSpriteGroupId, value1); + _sprite->setGroupCase0_3(_curSpriteGroupId, value1); break; case 4: if (!_curSpriteGroupId) break; - spriteGroupSet_case0_4(_curSpriteGroupId); + _sprite->setGroupCase0_4(_curSpriteGroupId); break; case 5: value1 = pop(); if (!_curSpriteGroupId) break; - spriteGroupSet_case0_5(_curSpriteGroupId, value1); + _sprite->setGroupCase0_5(_curSpriteGroupId, value1); break; case 6: value1 = pop(); if (!_curSpriteGroupId) break; - spriteGroupSet_case0_6(_curSpriteGroupId, value1); + _sprite->setGroupCase0_6(_curSpriteGroupId, value1); break; case 7: value1 = pop(); if (!_curSpriteGroupId) break; - spriteGroupSet_case0_7(_curSpriteGroupId, value1); + _sprite->setGroupCase0_7(_curSpriteGroupId, value1); break; default: error("o90_setSpriteGroupInfo subOp 0: Unknown case %d", subOp); @@ -1582,16 +1582,16 @@ void ScummEngine_v90he::o90_setSpriteGroupInfo() { switch (type) { case 0: - spriteGroupSet_scale_x_ratio_mul(_curSpriteGroupId, value1); + _sprite->setGroupScale_x_ratio_mul(_curSpriteGroupId, value1); break; case 1: - spriteGroupSet_scale_x_ratio_div(_curSpriteGroupId, value1); + _sprite->setGroupScale_x_ratio_div(_curSpriteGroupId, value1); break; case 2: - spriteGroupSet_scale_y_ratio_mul(_curSpriteGroupId, value1); + _sprite->setGroupScale_y_ratio_mul(_curSpriteGroupId, value1); break; case 3: - spriteGroupSet_scale_y_ratio_div(_curSpriteGroupId, value1); + _sprite->setGroupScale_y_ratio_div(_curSpriteGroupId, value1); break; default: error("o90_setSpriteGroupInfo subOp 5: Unknown case %d", subOp); @@ -1602,7 +1602,7 @@ void ScummEngine_v90he::o90_setSpriteGroupInfo() { if (!_curSpriteGroupId) break; - spriteGroupSet_zorderPriority(_curSpriteGroupId, value1); + _sprite->setGroupzorderPriority(_curSpriteGroupId, value1); break; case 7: value2 = pop(); @@ -1610,7 +1610,7 @@ void ScummEngine_v90he::o90_setSpriteGroupInfo() { if (!_curSpriteGroupId) break; - spriteGroupSet_inc_tx_ty(_curSpriteGroupId, value1, value2); + _sprite->setGroupinc_tx_ty(_curSpriteGroupId, value1, value2); break; case 20: _curSpriteGroupId = pop(); @@ -1620,7 +1620,7 @@ void ScummEngine_v90he::o90_setSpriteGroupInfo() { if (!_curSpriteGroupId) break; - spriteGroupSet_dstResNum(_curSpriteGroupId, value1); + _sprite->setGroupdstResNum(_curSpriteGroupId, value1); break; case 28: value2 = pop(); @@ -1628,7 +1628,7 @@ void ScummEngine_v90he::o90_setSpriteGroupInfo() { if (!_curSpriteGroupId) break; - spriteGroupSet_tx_ty(_curSpriteGroupId, value1, value2); + _sprite->setGrouptx_ty(_curSpriteGroupId, value1, value2); break; case 30: value4 = pop(); @@ -1638,19 +1638,19 @@ void ScummEngine_v90he::o90_setSpriteGroupInfo() { if (!_curSpriteGroupId) break; - spriteGroupSet_bbox(_curSpriteGroupId, value1, value2, value3, value4); + _sprite->setGroupbbox(_curSpriteGroupId, value1, value2, value3, value4); break; case 56: if (!_curSpriteGroupId) break; - spriteGroupSet_flagClipBoxAnd(_curSpriteGroupId); + _sprite->setGroupflagClipBoxAnd(_curSpriteGroupId); break; case 180: if (!_curSpriteGroupId) break; - spritesResetGroup(_curSpriteGroupId); + _sprite->spritesResetGroup(_curSpriteGroupId); break; default: error("o90_setSpriteGroupInfo: Unknown case %d", subOp); @@ -1907,8 +1907,8 @@ void ScummEngine_v90he::o90_getPolygonOverlap() { case 6: { Common::Rect r1, r2; - getSpriteBounds(args2[0], false, r2); - getSpriteBounds(args1[0], false, r1); + _sprite->getSpriteBounds(args2[0], false, r2); + _sprite->getSpriteBounds(args1[0], false, r1); if (r2.isValidRect() == false) { push(0); break; @@ -1932,7 +1932,7 @@ void ScummEngine_v90he::o90_getPolygonOverlap() { case 7: { Common::Rect r2; - getSpriteBounds(args2[0], false, r2); + _sprite->getSpriteBounds(args2[0], false, r2); Common::Rect r1(args1[0], args1[1], args1[2], args1[3]); if (r2.isValidRect() == false) { push(0); @@ -1952,8 +1952,8 @@ void ScummEngine_v90he::o90_getPolygonOverlap() { case 10: // TODO: redraw image { Common::Rect r1, r2; - getSpriteBounds(args2[0], true, r2); - getSpriteBounds(args1[0], true, r1); + _sprite->getSpriteBounds(args2[0], true, r2); + _sprite->getSpriteBounds(args1[0], true, r1); if (r2.isValidRect() == false) { push(0); break; @@ -1977,7 +1977,7 @@ void ScummEngine_v90he::o90_getPolygonOverlap() { case 9: { Common::Rect r2; - getSpriteBounds(args2[0], true, r2); + _sprite->getSpriteBounds(args2[0], true, r2); Common::Rect r1(args1[0], args1[1], args1[2], args1[3]); if (r2.isValidRect() == false) { push(0); @@ -2603,7 +2603,7 @@ void ScummEngine_v90he::o90_kernelSetFunctions() { case 714: break; case 1492: - spriteInfoSet_flagDoubleBuffered(args[1], args[2]); + _sprite->setSpriteFlagDoubleBuffered(args[1], args[2]); break; case 1969: a = derefActor(args[1], "o90_kernelSetFunctions: 1969"); diff --git a/scumm/scumm.cpp b/scumm/scumm.cpp index 9d69bf1995..7b6b28cea4 100644 --- a/scumm/scumm.cpp +++ b/scumm/scumm.cpp @@ -1372,6 +1372,12 @@ ScummEngine_v80he::ScummEngine_v80he(GameDetector *detector, OSystem *syst, cons _heSBNGId = 0; } +ScummEngine_v90he::ScummEngine_v90he(GameDetector *detector, OSystem *syst, const ScummGameSettings &gs, uint8 md5sum[16], int substResFileNameIndex) + : ScummEngine_v80he(detector, syst, gs, md5sum, substResFileNameIndex) { + + _sprite = new Sprite(this); +} + ScummEngine_v90he::~ScummEngine_v90he() { if (_heversion >= 98) { delete _logicHE; @@ -1830,7 +1836,7 @@ void ScummEngine_v90he::scummInit() { _heObjectNum = 0; _hePaletteNum = 0; - spritesResetTables(0); + _sprite->spritesResetTables(0); memset(&_wizParams, 0, sizeof(_wizParams)); if (_features & GF_HE_CURSORLESS) @@ -2262,8 +2268,8 @@ load_game: #ifndef DISABLE_HE if (_heversion >= 90) { - ((ScummEngine_v90he *)this)->spritesBlitToScreen(); - ((ScummEngine_v90he *)this)->spritesSortActiveSprites(); + ((ScummEngine_v90he *)this)->_sprite->spritesBlitToScreen(); + ((ScummEngine_v90he *)this)->_sprite->spritesSortActiveSprites(); } #endif @@ -2323,7 +2329,7 @@ load_game: #ifndef DISABLE_HE if (_heversion >= 90) { - ((ScummEngine_v90he *)this)->spritesUpdateImages(); + ((ScummEngine_v90he *)this)->_sprite->spritesUpdateImages(); } if (_heversion >= 98) { ((ScummEngine_v90he *)this)->_logicHE->endOfFrame(); diff --git a/scumm/sprite_he.cpp b/scumm/sprite_he.cpp index 1565551979..039d9194e2 100644 --- a/scumm/sprite_he.cpp +++ b/scumm/sprite_he.cpp @@ -33,12 +33,15 @@ namespace Scumm { +Sprite::Sprite(ScummEngine_v90he *vm) : _vm(vm) { +} + void ScummEngine_v90he::allocateArrays() { ScummEngine::allocateArrays(); - spritesAllocTables(_numSprites, MAX(64, _numSprites / 4), 64); + _sprite->spritesAllocTables(_numSprites, MAX(64, _numSprites / 4), 64); } -void ScummEngine_v90he::getSpriteBounds(int spriteId, bool checkGroup, Common::Rect &bound) { +void Sprite::getSpriteBounds(int spriteId, bool checkGroup, Common::Rect &bound) { checkRange(_varNumSprites, 1, spriteId, "Invalid sprite %d"); int16 spr_wiz_x, spr_wiz_y; int angle, zoom, x1, y1; @@ -46,7 +49,7 @@ void ScummEngine_v90he::getSpriteBounds(int spriteId, bool checkGroup, Common::R SpriteInfo *spi = &_spriteTable[spriteId]; - _wiz->loadImgSpot(spi->resId, spi->resState, spr_wiz_x, spr_wiz_y); + _vm->_wiz->loadImgSpot(spi->resId, spi->resState, spr_wiz_x, spr_wiz_y); if (checkGroup && spi->groupNum) { SpriteGroup *spg = &_spriteGroups[spi->groupNum]; @@ -65,7 +68,7 @@ void ScummEngine_v90he::getSpriteBounds(int spriteId, bool checkGroup, Common::R if (spi->resId) { angle = spi->angle; zoom = spi->zoom; - _wiz->getWizImageDim(spi->resId, spi->resState, w, h); + _vm->_wiz->getWizImageDim(spi->resId, spi->resState, w, h); if (!(spi->flags & (kSFZoomed | kSFRotated))) { bound.left = x1; bound.top = y1; @@ -85,14 +88,14 @@ void ScummEngine_v90he::getSpriteBounds(int spriteId, bool checkGroup, Common::R } } if ((spi->flags & kSFRotated) && angle) - _wiz->polygonRotatePoints(pts, 4, angle); + _vm->_wiz->polygonRotatePoints(pts, 4, angle); for (int j = 0; j < 4; ++j) { pts[j].x += x1; pts[j].y += y1; } - _wiz->polygonCalcBoundBox(pts, 4, bound); + _vm->_wiz->polygonCalcBoundBox(pts, 4, bound); } } else { bound.left = 1234; @@ -105,7 +108,7 @@ void ScummEngine_v90he::getSpriteBounds(int spriteId, bool checkGroup, Common::R // // spriteInfoGet functions // -int ScummEngine_v90he::findSpriteWithClassOf(int x_pos, int y_pos, int spriteGroupId, int type, int num, int *args) { +int Sprite::findSpriteWithClassOf(int x_pos, int y_pos, int spriteGroupId, int type, int num, int *args) { bool cond; int code, classId, x, y; debug(1, "findSprite: x %d, y %d, spriteGroup %d, type %d, num %d", x_pos, y_pos, spriteGroupId, type, num); @@ -156,13 +159,13 @@ int ScummEngine_v90he::findSpriteWithClassOf(int x_pos, int y_pos, int spriteGro if (spi->field_80) { int16 x1, x2, y1, y2; - resState = spi->curImageState % _wiz->getWizImageStates(spi->field_80); + resState = spi->curImageState % _vm->_wiz->getWizImageStates(spi->field_80); x = x_pos - spi->pos.x; y = y_pos - spi->pos.y; - _wiz->loadImgSpot(spi->curResId, resState, x1, y1); - _wiz->loadImgSpot(spi->field_80, resState, x2, y2); + _vm->_wiz->loadImgSpot(spi->curResId, resState, x1, y1); + _vm->_wiz->loadImgSpot(spi->field_80, resState, x2, y2); x += (x2 - x1); y += (y2 - y1); @@ -195,15 +198,15 @@ int ScummEngine_v90he::findSpriteWithClassOf(int x_pos, int y_pos, int spriteGro if (spi->flags & kSFRotated && angle) { angle = (360 - angle) % 360; Common::Point pts[1]; - _wiz->polygonRotatePoints(pts, 1, angle); + _vm->_wiz->polygonRotatePoints(pts, 1, angle); } - _wiz->getWizImageDim(resId, resState, w, h); + _vm->_wiz->getWizImageDim(resId, resState, w, h); x += w / 2; y += h / 2; } - if (_wiz->isWizPixelNonTransparent(resId, resState, x, y, spi->curImgFlags)) + if (_vm->_wiz->isWizPixelNonTransparent(resId, resState, x, y, spi->curImgFlags)) return spi->id; } } @@ -211,7 +214,7 @@ int ScummEngine_v90he::findSpriteWithClassOf(int x_pos, int y_pos, int spriteGro return 0; } -int ScummEngine_v90he::spriteInfoGet_classFlags(int spriteId, int num, int *args) { +int Sprite::getSpriteclassFlags(int spriteId, int num, int *args) { checkRange(_varNumSprites, 1, spriteId, "Invalid sprite %d"); int code, classId; @@ -234,85 +237,85 @@ int ScummEngine_v90he::spriteInfoGet_classFlags(int spriteId, int num, int *args return 1; } -int ScummEngine_v90he::spriteInfoGet_flagDoubleBuffered(int spriteId) { +int Sprite::getSpriteFlagDoubleBuffered(int spriteId) { checkRange(_varNumSprites, 1, spriteId, "Invalid sprite %d"); return ((_spriteTable[spriteId].flags & kSFDoubleBuffered) != 0) ? 1 : 0; } -int ScummEngine_v90he::spriteInfoGet_flagYFlipped(int spriteId) { +int Sprite::getSpriteFlagYFlipped(int spriteId) { checkRange(_varNumSprites, 1, spriteId, "Invalid sprite %d"); return ((_spriteTable[spriteId].flags & kSFYFlipped) != 0) ? 1 : 0; } -int ScummEngine_v90he::spriteInfoGet_flagXFlipped(int spriteId) { +int Sprite::getSpriteFlagXFlipped(int spriteId) { checkRange(_varNumSprites, 1, spriteId, "Invalid sprite %d"); return ((_spriteTable[spriteId].flags & kSFXFlipped) != 0) ? 1 : 0; } -int ScummEngine_v90he::spriteInfoGet_flagActive(int spriteId) { +int Sprite::getSpriteFlagActive(int spriteId) { checkRange(_varNumSprites, 1, spriteId, "Invalid sprite %d"); return ((_spriteTable[spriteId].flags & kSFActive) != 0) ? 1 : 0; } -int ScummEngine_v90he::spriteInfoGet_flagNeedPaletteRemap(int spriteId) { +int Sprite::getSpriteFlagNeedPaletteRemap(int spriteId) { checkRange(_varNumSprites, 1, spriteId, "Invalid sprite %d"); return ((_spriteTable[spriteId].flags & kSFNeedPaletteRemap) != 0) ? 1 : 0; } -int ScummEngine_v90he::spriteInfoGet_flagDelayed(int spriteId) { +int Sprite::getSpriteFlagDelayed(int spriteId) { checkRange(_varNumSprites, 1, spriteId, "Invalid sprite %d"); return ((_spriteTable[spriteId].flags & kSFDelayed) != 0) ? 1 : 0; } -int ScummEngine_v90he::spriteInfoGet_flagMarkDirty(int spriteId) { +int Sprite::getSpriteFlagMarkDirty(int spriteId) { checkRange(_varNumSprites, 1, spriteId, "Invalid sprite %d"); return ((_spriteTable[spriteId].flags & kSFMarkDirty) != 0) ? 1 : 0; } -int ScummEngine_v90he::spriteInfoGet_flagHasImage(int spriteId) { +int Sprite::getSpriteFlagHasImage(int spriteId) { checkRange(_varNumSprites, 1, spriteId, "Invalid sprite %d"); return ((_spriteTable[spriteId].flags & kSFImageless) != 0) ? 1 : 0; } -int ScummEngine_v90he::spriteInfoGet_resId(int spriteId) { +int Sprite::getSpriteResId(int spriteId) { checkRange(_varNumSprites, 1, spriteId, "Invalid sprite %d"); return _spriteTable[spriteId].resId; } -int ScummEngine_v90he::spriteInfoGet_resState(int spriteId) { +int Sprite::getSpriteResState(int spriteId) { checkRange(_varNumSprites, 1, spriteId, "Invalid sprite %d"); return _spriteTable[spriteId].resState; } -int ScummEngine_v90he::spriteInfoGet_groupNum(int spriteId) { +int Sprite::getSpriteGroupNum(int spriteId) { checkRange(_varNumSprites, 1, spriteId, "Invalid sprite %d"); return _spriteTable[spriteId].groupNum; } -int ScummEngine_v90he::spriteInfoGet_paletteNum(int spriteId) { +int Sprite::getSpritePaletteNum(int spriteId) { checkRange(_varNumSprites, 1, spriteId, "Invalid sprite %d"); return _spriteTable[spriteId].paletteNum; } -int ScummEngine_v90he::spriteInfoGet_zorderPriority(int spriteId) { +int Sprite::getSpriteZorderPriority(int spriteId) { checkRange(_varNumSprites, 1, spriteId, "Invalid sprite %d"); return _spriteTable[spriteId].zorderPriority; } -int ScummEngine_v90he::spriteInfoGet_grp_tx(int spriteId) { +int Sprite::getSpritegrp_tx(int spriteId) { checkRange(_varNumSprites, 1, spriteId, "Invalid sprite %d"); if (_spriteTable[spriteId].groupNum) @@ -321,7 +324,7 @@ int ScummEngine_v90he::spriteInfoGet_grp_tx(int spriteId) { return _spriteTable[spriteId].tx; } -int ScummEngine_v90he::spriteInfoGet_grp_ty(int spriteId) { +int Sprite::getSpritegrp_ty(int spriteId) { checkRange(_varNumSprites, 1, spriteId, "Invalid sprite %d"); if (_spriteTable[spriteId].groupNum) @@ -330,50 +333,50 @@ int ScummEngine_v90he::spriteInfoGet_grp_ty(int spriteId) { return _spriteTable[spriteId].ty; } -int ScummEngine_v90he::spriteInfoGet_field_44(int spriteId) { +int Sprite::getSpriteField_44(int spriteId) { checkRange(_varNumSprites, 1, spriteId, "Invalid sprite %d"); return _spriteTable[spriteId].field_44; } -int ScummEngine_v90he::spriteInfoGet_xmapNum(int spriteId) { +int Sprite::getSpriteXmapNum(int spriteId) { checkRange(_varNumSprites, 1, spriteId, "Invalid sprite %d"); return _spriteTable[spriteId].xmapNum; } -int ScummEngine_v90he::spriteInfoGet_wizSize(int spriteId) { +int Sprite::getSpritewizSize(int spriteId) { checkRange(_varNumSprites, 1, spriteId, "Invalid sprite %d"); return _spriteTable[spriteId].res_wiz_states; } -int ScummEngine_v90he::spriteInfoGet_zoom(int spriteId) { +int Sprite::getSpritezoom(int spriteId) { checkRange(_varNumSprites, 1, spriteId, "Invalid sprite %d"); return _spriteTable[spriteId].zoom; } -int ScummEngine_v90he::spriteInfoGet_delayAmount(int spriteId) { +int Sprite::getSpritedelayAmount(int spriteId) { checkRange(_varNumSprites, 1, spriteId, "Invalid sprite %d"); return _spriteTable[spriteId].delayAmount; } -int ScummEngine_v90he::spriteInfoGet_maskImgResNum(int spriteId) { +int Sprite::getSpritemaskImgResNum(int spriteId) { checkRange(_varNumSprites, 1, spriteId, "Invalid sprite %d"); return _spriteTable[spriteId].maskImgResNum; } -int ScummEngine_v90he::spriteInfoGet_field_80(int spriteId) { +int Sprite::getSpriteField_80(int spriteId) { checkRange(_varNumSprites, 1, spriteId, "Invalid sprite %d"); return _spriteTable[spriteId].field_80; } -int ScummEngine_v90he::spriteInfoGet_field_8C_90(int spriteId, int type) { - debug(0, "spriteInfoGet_field_8C_90: spriteId %d type 0x%x", spriteId, type); +int Sprite::getSpriteField_8C_90(int spriteId, int type) { + debug(0, "getSpriteField_8C_90: spriteId %d type 0x%x", spriteId, type); checkRange(_varNumSprites, 1, spriteId, "Invalid sprite %d"); // XXX U32 related check @@ -386,29 +389,29 @@ int ScummEngine_v90he::spriteInfoGet_field_8C_90(int spriteId, int type) { case 0x7E: return _spriteTable[spriteId].delayCount; default: - error("spriteInfoGet_field_8C_90: Invalid type %d", type); + error("getSpriteField_8C_90: Invalid type %d", type); } } -void ScummEngine_v90he::getSpriteImageDim(int spriteId, int32 &w, int32 &h) { +void Sprite::getSpriteImageDim(int spriteId, int32 &w, int32 &h) { checkRange(_varNumSprites, 1, spriteId, "Invalid sprite %d"); if (_spriteTable[spriteId].resId) { - _wiz->getWizImageDim(_spriteTable[spriteId].resId, _spriteTable[spriteId].resState, w, h); + _vm->_wiz->getWizImageDim(_spriteTable[spriteId].resId, _spriteTable[spriteId].resState, w, h); } else { w = 0; h = 0; } } -void ScummEngine_v90he::spriteInfoGet_tx_ty(int spriteId, int32 &tx, int32 &ty) { +void Sprite::getSpritetx_ty(int spriteId, int32 &tx, int32 &ty) { checkRange(_varNumSprites, 1, spriteId, "Invalid sprite %d"); tx = _spriteTable[spriteId].tx; ty = _spriteTable[spriteId].ty; } -void ScummEngine_v90he::spriteInfoGet_dx_dy(int spriteId, int32 &dx, int32 &dy) { +void Sprite::getSpritedx_dy(int spriteId, int32 &dx, int32 &dy) { checkRange(_varNumSprites, 1, spriteId, "Invalid sprite %d"); dx = _spriteTable[spriteId].dx; @@ -418,13 +421,13 @@ void ScummEngine_v90he::spriteInfoGet_dx_dy(int spriteId, int32 &dx, int32 &dy) // // spriteGroupGet functions // -int ScummEngine_v90he::spriteGroupGet_allocateGroupSpritesList(int spriteGroupId) { +int ScummEngine_v90he::getGroupallocateGroupSpritesList(int spriteGroupId) { int i, numSprites = 0; - checkRange(_varNumSpriteGroups, 1, spriteGroupId, "Invalid sprite group %d"); + checkRange(_sprite->_varNumSpriteGroups, 1, spriteGroupId, "Invalid sprite group %d"); - for (i = (_varNumSprites - 1); i > 0; i--) { - if (_spriteTable[i].groupNum == spriteGroupId) + for (i = (_sprite->_varNumSprites - 1); i > 0; i--) { + if (_sprite->_spriteTable[i].groupNum == spriteGroupId) numSprites++; } @@ -436,8 +439,8 @@ int ScummEngine_v90he::spriteGroupGet_allocateGroupSpritesList(int spriteGroupId writeArray(0, 0, 0, numSprites); numSprites = 1; - for (i = (_varNumSprites - 1); i > 0; i--) { - if (_spriteTable[i].groupNum == spriteGroupId) { + for (i = (_sprite->_varNumSprites - 1); i > 0; i--) { + if (_sprite->_spriteTable[i].groupNum == spriteGroupId) { writeArray(0, 0, numSprites, i); numSprites++; } @@ -446,43 +449,43 @@ int ScummEngine_v90he::spriteGroupGet_allocateGroupSpritesList(int spriteGroupId return readVar(0); } -int ScummEngine_v90he::spriteGroupGet_zorderPriority(int spriteGroupId) { +int Sprite::getGroupzorderPriority(int spriteGroupId) { checkRange(_varNumSpriteGroups, 1, spriteGroupId, "Invalid sprite group %d"); return _spriteGroups[spriteGroupId].zorderPriority; } -int ScummEngine_v90he::spriteGroupGet_dstResNum(int spriteGroupId) { +int Sprite::getGroupdstResNum(int spriteGroupId) { checkRange(_varNumSpriteGroups, 1, spriteGroupId, "Invalid sprite group %d"); return _spriteGroups[spriteGroupId].dstResNum; } -int ScummEngine_v90he::spriteGroupGet_scale_x_ratio_mul(int spriteGroupId) { +int Sprite::getGroupScale_x_ratio_mul(int spriteGroupId) { checkRange(_varNumSpriteGroups, 1, spriteGroupId, "Invalid sprite group %d"); return _spriteGroups[spriteGroupId].scale_x_ratio_mul; } -int ScummEngine_v90he::spriteGroupGet_scale_x_ratio_div(int spriteGroupId) { +int Sprite::getGroupScale_x_ratio_div(int spriteGroupId) { checkRange(_varNumSpriteGroups, 1, spriteGroupId, "Invalid sprite group %d"); return _spriteGroups[spriteGroupId].scale_x_ratio_div; } -int ScummEngine_v90he::spriteGroupGet_scale_y_ratio_mul(int spriteGroupId) { +int Sprite::getGroupScale_y_ratio_mul(int spriteGroupId) { checkRange(_varNumSpriteGroups, 1, spriteGroupId, "Invalid sprite group %d"); return _spriteGroups[spriteGroupId].scale_y_ratio_mul; } -int ScummEngine_v90he::spriteGroupGet_scale_y_ratio_div(int spriteGroupId) { +int Sprite::getGroupScale_y_ratio_div(int spriteGroupId) { checkRange(_varNumSpriteGroups, 1, spriteGroupId, "Invalid sprite group %d"); return _spriteGroups[spriteGroupId].scale_y_ratio_div; } -void ScummEngine_v90he::spriteGroupGet_tx_ty(int spriteGroupId, int32 &tx, int32 &ty) { +void Sprite::getGrouptx_ty(int spriteGroupId, int32 &tx, int32 &ty) { checkRange(_varNumSpriteGroups, 1, spriteGroupId, "Invalid sprite group %d"); tx = _spriteGroups[spriteGroupId].tx; @@ -492,7 +495,7 @@ void ScummEngine_v90he::spriteGroupGet_tx_ty(int spriteGroupId, int32 &tx, int32 // // spriteInfoSet functions // -void ScummEngine_v90he::spriteInfoSet_paletteNum(int spriteId, int value) { +void Sprite::setSpritePaletteNum(int spriteId, int value) { checkRange(_varNumSprites, 1, spriteId, "Invalid sprite %d"); if (_spriteTable[spriteId].paletteNum != value) { @@ -501,7 +504,7 @@ void ScummEngine_v90he::spriteInfoSet_paletteNum(int spriteId, int value) { } } -void ScummEngine_v90he::spriteInfoSet_maskImgResNum(int spriteId, int value) { +void Sprite::setSpriteMaskImgResNum(int spriteId, int value) { checkRange(_varNumSprites, 1, spriteId, "Invalid sprite %d"); if (_spriteTable[spriteId].maskImgResNum != value) { @@ -510,13 +513,13 @@ void ScummEngine_v90he::spriteInfoSet_maskImgResNum(int spriteId, int value) { } } -void ScummEngine_v90he::spriteInfoSet_field_80(int spriteId, int value) { +void Sprite::setSpriteField80(int spriteId, int value) { checkRange(_varNumSprites, 1, spriteId, "Invalid sprite %d"); _spriteTable[spriteId].field_80 = value; } -void ScummEngine_v90he::spriteInfoSet_resState(int spriteId, int state) { +void Sprite::setSpriteResState(int spriteId, int state) { checkRange(_varNumSprites, 1, spriteId, "Invalid sprite %d"); if (_spriteTable[spriteId].resId) { @@ -531,7 +534,7 @@ void ScummEngine_v90he::spriteInfoSet_resState(int spriteId, int state) { } } -void ScummEngine_v90he::spriteInfoSet_tx_ty(int spriteId, int value1, int value2) { +void Sprite::setSpritetx_ty(int spriteId, int value1, int value2) { checkRange(_varNumSprites, 1, spriteId, "Invalid sprite %d"); if (_spriteTable[spriteId].tx != value1 || _spriteTable[spriteId].ty != value2) { @@ -541,7 +544,7 @@ void ScummEngine_v90he::spriteInfoSet_tx_ty(int spriteId, int value1, int value2 } } -void ScummEngine_v90he::spriteInfoSet_groupNum(int spriteId, int value) { +void Sprite::setSpriteGroupNum(int spriteId, int value) { checkRange(_varNumSprites, 1, spriteId, "Invalid sprite %d"); checkRange(_varNumSpriteGroups, 0, value, "Invalid sprite group %d"); @@ -549,14 +552,14 @@ void ScummEngine_v90he::spriteInfoSet_groupNum(int spriteId, int value) { _spriteTable[spriteId].flags |= kSFChanged | kSFNeedRedraw; } -void ScummEngine_v90he::spriteInfoSet_dx_dy(int spriteId, int value1, int value2) { +void Sprite::setSpritedx_dy(int spriteId, int value1, int value2) { checkRange(_varNumSprites, 1, spriteId, "Invalid sprite %d"); _spriteTable[spriteId].dx = value1; _spriteTable[spriteId].dy = value2; } -void ScummEngine_v90he::spriteInfoSet_xmapNum(int spriteId, int value) { +void Sprite::setSpriteXmapNum(int spriteId, int value) { checkRange(_varNumSprites, 1, spriteId, "Invalid sprite %d"); _spriteTable[spriteId].xmapNum = value; @@ -564,19 +567,19 @@ void ScummEngine_v90he::spriteInfoSet_xmapNum(int spriteId, int value) { _spriteTable[spriteId].flags |= kSFChanged | kSFNeedRedraw; } -void ScummEngine_v90he::spriteInfoSet_field_44(int spriteId, int value1, int value2) { +void Sprite::setSpriteField44(int spriteId, int value1, int value2) { checkRange(_varNumSprites, 1, spriteId, "Invalid sprite %d"); _spriteTable[spriteId].field_44 = value2; } -void ScummEngine_v90he::spriteInfoSet_zorderPriority(int spriteId, int value) { +void Sprite::setSpriteZorderPriority(int spriteId, int value) { checkRange(_varNumSprites, 1, spriteId, "Invalid sprite %d"); _spriteTable[spriteId].zorderPriority = value; } -void ScummEngine_v90he::spriteInfoSet_Inc_tx_ty(int spriteId, int value1, int value2) { +void Sprite::setSpriteInc_tx_ty(int spriteId, int value1, int value2) { checkRange(_varNumSprites, 1, spriteId, "Invalid sprite %d"); _spriteTable[spriteId].tx += value1; @@ -586,7 +589,7 @@ void ScummEngine_v90he::spriteInfoSet_Inc_tx_ty(int spriteId, int value1, int va _spriteTable[spriteId].flags |= kSFChanged | kSFNeedRedraw; } -void ScummEngine_v90he::spriteInfoSet_zoom(int spriteId, int value) { +void Sprite::setSpriteZoom(int spriteId, int value) { checkRange(_varNumSprites, 1, spriteId, "Invalid sprite %d"); _spriteTable[spriteId].flags |= kSFZoomed; @@ -599,7 +602,7 @@ void ScummEngine_v90he::spriteInfoSet_zoom(int spriteId, int value) { } } -void ScummEngine_v90he::spriteInfoSet_angle(int spriteId, int value) { +void Sprite::setSpriteAngle(int spriteId, int value) { checkRange(_varNumSprites, 1, spriteId, "Invalid sprite %d"); _spriteTable[spriteId].flags |= kSFRotated; @@ -612,7 +615,7 @@ void ScummEngine_v90he::spriteInfoSet_angle(int spriteId, int value) { } } -void ScummEngine_v90he::spriteInfoSet_flagDoubleBuffered(int spriteId, int value) { +void Sprite::setSpriteFlagDoubleBuffered(int spriteId, int value) { checkRange(_varNumSprites, 1, spriteId, "Invalid sprite %d"); int oldFlags = _spriteTable[spriteId].flags; @@ -625,7 +628,7 @@ void ScummEngine_v90he::spriteInfoSet_flagDoubleBuffered(int spriteId, int value _spriteTable[spriteId].flags |= kSFChanged | kSFNeedRedraw; } -void ScummEngine_v90he::spriteInfoSet_flagYFlipped(int spriteId, int value) { +void Sprite::setSpriteFlagYFlipped(int spriteId, int value) { checkRange(_varNumSprites, 1, spriteId, "Invalid sprite %d"); int oldFlags = _spriteTable[spriteId].flags; @@ -638,7 +641,7 @@ void ScummEngine_v90he::spriteInfoSet_flagYFlipped(int spriteId, int value) { _spriteTable[spriteId].flags |= kSFChanged | kSFNeedRedraw; } -void ScummEngine_v90he::spriteInfoSet_flagXFlipped(int spriteId, int value) { +void Sprite::setSpriteFlagXFlipped(int spriteId, int value) { checkRange(_varNumSprites, 1, spriteId, "Invalid sprite %d"); int oldFlags = _spriteTable[spriteId].flags; @@ -651,7 +654,7 @@ void ScummEngine_v90he::spriteInfoSet_flagXFlipped(int spriteId, int value) { _spriteTable[spriteId].flags |= kSFChanged | kSFNeedRedraw; } -void ScummEngine_v90he::spriteInfoSet_flagActive(int spriteId, int value) { +void Sprite::setSpriteFlagActive(int spriteId, int value) { checkRange(_varNumSprites, 1, spriteId, "Invalid sprite %d"); if (value) @@ -660,7 +663,7 @@ void ScummEngine_v90he::spriteInfoSet_flagActive(int spriteId, int value) { _spriteTable[spriteId].flags &= ~kSFActive; } -void ScummEngine_v90he::spriteInfoSet_flagNeedPaletteRemap(int spriteId, int value) { +void Sprite::setSpriteFlagNeedPaletteRemap(int spriteId, int value) { checkRange(_varNumSprites, 1, spriteId, "Invalid sprite %d"); int oldFlags = _spriteTable[spriteId].flags; @@ -673,7 +676,7 @@ void ScummEngine_v90he::spriteInfoSet_flagNeedPaletteRemap(int spriteId, int val _spriteTable[spriteId].flags |= kSFChanged | kSFNeedRedraw; } -void ScummEngine_v90he::spriteInfoSet_flagDelayed(int spriteId, int value) { +void Sprite::setSpriteFlagDelayed(int spriteId, int value) { checkRange(_varNumSprites, 1, spriteId, "Invalid sprite %d"); if (value) @@ -682,7 +685,7 @@ void ScummEngine_v90he::spriteInfoSet_flagDelayed(int spriteId, int value) { _spriteTable[spriteId].flags &= ~kSFDelayed; } -void ScummEngine_v90he::spriteInfoSet_flagMarkDirty(int spriteId, int value) { +void Sprite::setSpriteFlagMarkDirty(int spriteId, int value) { checkRange(_varNumSprites, 1, spriteId, "Invalid sprite %d"); switch(value) { @@ -697,11 +700,11 @@ void ScummEngine_v90he::spriteInfoSet_flagMarkDirty(int spriteId, int value) { _spriteTable[spriteId].flags &= ~(kSFMarkDirty | kSFBlitDirectly); break; default: - error("spriteInfoSet_flagMarkDirty: Invalid value %d", value); + error("setSpriteFlagMarkDirty: Invalid value %d", value); } } -void ScummEngine_v90he::spriteInfoSet_flagHasImage(int spriteId, int value) { +void Sprite::setSpriteFlagHasImage(int spriteId, int value) { checkRange(_varNumSprites, 1, spriteId, "Invalid sprite %d"); // Note that condition is inverted @@ -711,14 +714,14 @@ void ScummEngine_v90he::spriteInfoSet_flagHasImage(int spriteId, int value) { _spriteTable[spriteId].flags &= ~kSFImageless; } -void ScummEngine_v90he::spriteInfoSet_delay(int spriteId, int value) { +void Sprite::setSpriteDelay(int spriteId, int value) { checkRange(_varNumSprites, 1, spriteId, "Invalid sprite %d"); _spriteTable[spriteId].delayAmount = value; _spriteTable[spriteId].delayCount = value; } -void ScummEngine_v90he::spriteInfoSet_setClassFlag(int spriteId, int classId, int toggle) { +void Sprite::setSpriteSetClassFlag(int spriteId, int classId, int toggle) { checkRange(_varNumSprites, 1, spriteId, "Invalid sprite %d"); checkRange(32, 1, classId, "class %d out of range in statement"); @@ -729,20 +732,20 @@ void ScummEngine_v90he::spriteInfoSet_setClassFlag(int spriteId, int classId, in } } -void ScummEngine_v90he::spriteInfoSet_resetClassFlags(int spriteId) { +void Sprite::setSpriteResetClassFlags(int spriteId) { checkRange(_varNumSprites, 1, spriteId, "Invalid sprite %d"); _spriteTable[spriteId].classFlags = 0; } -void ScummEngine_v90he::spriteInfoSet_field_84(int spriteId, int value) { +void Sprite::setSpriteField84(int spriteId, int value) { checkRange(_varNumSprites, 1, spriteId, "Invalid sprite %d"); _spriteTable[spriteId].field_84 = value; } -void ScummEngine_v90he::spriteInfoSet_field_8C_90(int spriteId, int type, int value) { - debug(0, "spriteInfoSet_field_8C_90: spriteId %d type 0x%x", spriteId, type); +void Sprite::setSpriteField8C_90(int spriteId, int type, int value) { + debug(0, "setSpriteField8C_90: spriteId %d type 0x%x", spriteId, type); checkRange(_varNumSprites, 1, spriteId, "Invalid sprite %d"); int delay; @@ -764,11 +767,11 @@ void ScummEngine_v90he::spriteInfoSet_field_8C_90(int spriteId, int type, int va _spriteTable[spriteId].delayCount = value; break; default: - error("spriteInfoSet_field_8C_90: Invalid value %d", type); + error("setSpriteField8C_90: Invalid value %d", type); } } -void ScummEngine_v90he::spriteInfoSet_resetSprite(int spriteId) { +void Sprite::setSpriteResetSprite(int spriteId) { checkRange(_varNumSprites, 1, spriteId, "Invalid sprite %d"); _spriteTable[spriteId].angle = 0; @@ -799,7 +802,7 @@ void ScummEngine_v90he::spriteInfoSet_resetSprite(int spriteId) { _spriteTable[spriteId].field_90 = 0; } -void ScummEngine_v90he::spriteAddImageToList(int spriteId, int imageNum, int *spriteIdptr) { +void Sprite::spriteAddImageToList(int spriteId, int imageNum, int *spriteIdptr) { int origResId, origResWizStates; checkRange(_varNumSprites, 1, spriteId, "Invalid sprite %d"); @@ -812,7 +815,7 @@ void ScummEngine_v90he::spriteAddImageToList(int spriteId, int imageNum, int *sp _spriteTable[spriteId].resState = 0; if (_spriteTable[spriteId].resId) { - _spriteTable[spriteId].res_wiz_states = _wiz->getWizImageStates(_spriteTable[spriteId].resId); + _spriteTable[spriteId].res_wiz_states = _vm->_wiz->getWizImageStates(_spriteTable[spriteId].resId); _spriteTable[spriteId].flags |= kSFActive | kSFDelayed | kSFMarkDirty | kSFBlitDirectly; if (_spriteTable[spriteId].resId != origResId || _spriteTable[spriteId].res_wiz_states != origResWizStates) @@ -831,7 +834,7 @@ void ScummEngine_v90he::spriteAddImageToList(int spriteId, int imageNum, int *sp // // spriteGroupSet functions // -void ScummEngine_v90he::redrawSpriteGroup(int spriteGroupId) { +void Sprite::redrawSpriteGroup(int spriteGroupId) { for (int i = 0; i < _numSpritesToProcess; ++i) { SpriteInfo *spi = _activeSpritesTable[i]; if (spi->groupNum == spriteGroupId) { @@ -840,7 +843,7 @@ void ScummEngine_v90he::redrawSpriteGroup(int spriteGroupId) { } } -void ScummEngine_v90he::spriteGroupSet_case0_0(int spriteGroupId, int value1, int value2) { +void Sprite::setGroupCase0_0(int spriteGroupId, int value1, int value2) { checkRange(_varNumSpriteGroups, 1, spriteGroupId, "Invalid sprite group %d"); for (int i = 1; i < _varNumSprites; i++) { @@ -854,7 +857,7 @@ void ScummEngine_v90he::spriteGroupSet_case0_0(int spriteGroupId, int value1, in } } -void ScummEngine_v90he::spriteGroupSet_case0_1(int spriteGroupId, int value) { +void Sprite::setGroupCase0_1(int spriteGroupId, int value) { checkRange(_varNumSpriteGroups, 1, spriteGroupId, "Invalid sprite group %d"); for (int i = 1; i < _varNumSprites; i++) { @@ -863,7 +866,7 @@ void ScummEngine_v90he::spriteGroupSet_case0_1(int spriteGroupId, int value) { } } -void ScummEngine_v90he::spriteGroupSet_case0_2(int spriteGroupId, int value) { +void Sprite::setGroupCase0_2(int spriteGroupId, int value) { checkRange(_varNumSpriteGroups, 1, spriteGroupId, "Invalid sprite group %d"); for (int i = 1; i < _varNumSprites; i++) { @@ -874,25 +877,25 @@ void ScummEngine_v90he::spriteGroupSet_case0_2(int spriteGroupId, int value) { } } -void ScummEngine_v90he::spriteGroupSet_case0_3(int spriteGroupId, int value) { +void Sprite::setGroupCase0_3(int spriteGroupId, int value) { checkRange(_varNumSpriteGroups, 1, spriteGroupId, "Invalid sprite group %d"); for (int i = 1; i < _varNumSprites; i++) { if (_spriteTable[i].groupNum == spriteGroupId) - spriteInfoSet_flagMarkDirty(i, value); + setSpriteFlagMarkDirty(i, value); } } -void ScummEngine_v90he::spriteGroupSet_case0_4(int spriteGroupId) { +void Sprite::setGroupCase0_4(int spriteGroupId) { checkRange(_varNumSpriteGroups, 1, spriteGroupId, "Invalid sprite group %d"); for (int i = 1; i < _varNumSprites; i++) { if (_spriteTable[i].groupNum == spriteGroupId) - spriteInfoSet_resetSprite(i); + setSpriteResetSprite(i); } } -void ScummEngine_v90he::spriteGroupSet_case0_5(int spriteGroupId, int value) { +void Sprite::setGroupCase0_5(int spriteGroupId, int value) { checkRange(_varNumSpriteGroups, 1, spriteGroupId, "Invalid sprite group %d"); for (int i = 1; i < _varNumSprites; i++) { @@ -903,7 +906,7 @@ void ScummEngine_v90he::spriteGroupSet_case0_5(int spriteGroupId, int value) { } } -void ScummEngine_v90he::spriteGroupSet_case0_6(int spriteGroupId, int value) { +void Sprite::setGroupCase0_6(int spriteGroupId, int value) { checkRange(_varNumSpriteGroups, 1, spriteGroupId, "Invalid sprite group %d"); for (int i = 1; i < _varNumSprites; i++) { @@ -916,7 +919,7 @@ void ScummEngine_v90he::spriteGroupSet_case0_6(int spriteGroupId, int value) { } } -void ScummEngine_v90he::spriteGroupSet_case0_7(int spriteGroupId, int value) { +void Sprite::setGroupCase0_7(int spriteGroupId, int value) { checkRange(_varNumSpriteGroups, 1, spriteGroupId, "Invalid sprite group %d"); for (int i = 1; i < _varNumSprites; i++) { @@ -928,7 +931,7 @@ void ScummEngine_v90he::spriteGroupSet_case0_7(int spriteGroupId, int value) { } } -void ScummEngine_v90he::spriteGroupSet_bbox(int spriteGroupId, int x1, int y1, int x2, int y2) { +void Sprite::setGroupbbox(int spriteGroupId, int x1, int y1, int x2, int y2) { checkRange(_varNumSpriteGroups, 1, spriteGroupId, "Invalid sprite group %d"); _spriteGroups[spriteGroupId].flags |= kSGFClipBox; @@ -940,7 +943,7 @@ void ScummEngine_v90he::spriteGroupSet_bbox(int spriteGroupId, int x1, int y1, i redrawSpriteGroup(spriteGroupId); } -void ScummEngine_v90he::spriteGroupSet_zorderPriority(int spriteGroupId, int value) { +void Sprite::setGroupzorderPriority(int spriteGroupId, int value) { checkRange(_varNumSpriteGroups, 1, spriteGroupId, "Invalid sprite group %d"); if (_spriteGroups[spriteGroupId].zorderPriority != value) { @@ -949,7 +952,7 @@ void ScummEngine_v90he::spriteGroupSet_zorderPriority(int spriteGroupId, int val } } -void ScummEngine_v90he::spriteGroupSet_tx_ty(int spriteGroupId, int value1, int value2) { +void Sprite::setGrouptx_ty(int spriteGroupId, int value1, int value2) { checkRange(_varNumSpriteGroups, 1, spriteGroupId, "Invalid sprite group %d"); if (_spriteGroups[spriteGroupId].tx != value1 || _spriteGroups[spriteGroupId].ty != value2) { @@ -959,7 +962,7 @@ void ScummEngine_v90he::spriteGroupSet_tx_ty(int spriteGroupId, int value1, int } } -void ScummEngine_v90he::spriteGroupSet_inc_tx_ty(int spriteGroupId, int value1, int value2) { +void Sprite::setGroupinc_tx_ty(int spriteGroupId, int value1, int value2) { checkRange(_varNumSpriteGroups, 1, spriteGroupId, "Invalid sprite group %d"); if (value1 || value2) { @@ -969,7 +972,7 @@ void ScummEngine_v90he::spriteGroupSet_inc_tx_ty(int spriteGroupId, int value1, } } -void ScummEngine_v90he::spriteGroupSet_dstResNum(int spriteGroupId, int value) { +void Sprite::setGroupdstResNum(int spriteGroupId, int value) { checkRange(_varNumSpriteGroups, 1, spriteGroupId, "Invalid sprite group %d"); if (_spriteGroups[spriteGroupId].dstResNum != value) { @@ -978,7 +981,7 @@ void ScummEngine_v90he::spriteGroupSet_dstResNum(int spriteGroupId, int value) { } } -void ScummEngine_v90he::spriteGroupSet_scaling(int spriteGroupId) { +void Sprite::setGroupscaling(int spriteGroupId) { if ((_spriteGroups[spriteGroupId].scale_x_ratio_mul != _spriteGroups[spriteGroupId].scale_x_ratio_div) || (_spriteGroups[spriteGroupId].scale_y_ratio_mul != _spriteGroups[spriteGroupId].scale_y_ratio_div)) _spriteGroups[spriteGroupId].scaling = 1; else @@ -986,60 +989,60 @@ void ScummEngine_v90he::spriteGroupSet_scaling(int spriteGroupId) { } -void ScummEngine_v90he::spriteGroupSet_scale_x_ratio_mul(int spriteGroupId, int value) { +void Sprite::setGroupScale_x_ratio_mul(int spriteGroupId, int value) { checkRange(_varNumSpriteGroups, 1, spriteGroupId, "Invalid sprite group %d"); if (_spriteGroups[spriteGroupId].scale_x_ratio_mul != value) { _spriteGroups[spriteGroupId].scale_x_ratio_mul = value; - spriteGroupSet_scaling(spriteGroupId); + setGroupscaling(spriteGroupId); redrawSpriteGroup(spriteGroupId); } } -void ScummEngine_v90he::spriteGroupSet_scale_x_ratio_div(int spriteGroupId, int value) { +void Sprite::setGroupScale_x_ratio_div(int spriteGroupId, int value) { checkRange(_varNumSpriteGroups, 1, spriteGroupId, "Invalid sprite group %d"); if (value == 0) - error("spriteGroupSet_scale_x_ratio_div: Divisor must not be 0"); + error("setGroupScale_x_ratio_div: Divisor must not be 0"); if (_spriteGroups[spriteGroupId].scale_x_ratio_div != value) { _spriteGroups[spriteGroupId].scale_x_ratio_div = value; - spriteGroupSet_scaling(spriteGroupId); + setGroupscaling(spriteGroupId); redrawSpriteGroup(spriteGroupId); } } -void ScummEngine_v90he::spriteGroupSet_scale_y_ratio_mul(int spriteGroupId, int value) { +void Sprite::setGroupScale_y_ratio_mul(int spriteGroupId, int value) { checkRange(_varNumSpriteGroups, 1, spriteGroupId, "Invalid sprite group %d"); if (_spriteGroups[spriteGroupId].scale_y_ratio_mul != value) { _spriteGroups[spriteGroupId].scale_y_ratio_mul = value; - spriteGroupSet_scaling(spriteGroupId); + setGroupscaling(spriteGroupId); redrawSpriteGroup(spriteGroupId); } } -void ScummEngine_v90he::spriteGroupSet_scale_y_ratio_div(int spriteGroupId, int value) { +void Sprite::setGroupScale_y_ratio_div(int spriteGroupId, int value) { checkRange(_varNumSpriteGroups, 1, spriteGroupId, "Invalid sprite group %d"); if (value == 0) - error("spriteGroupSet_scale_y_ratio_div: Divisor must not be 0"); + error("setGroupScale_y_ratio_div: Divisor must not be 0"); if (_spriteGroups[spriteGroupId].scale_y_ratio_div != value) { _spriteGroups[spriteGroupId].scale_y_ratio_div = value; - spriteGroupSet_scaling(spriteGroupId); + setGroupscaling(spriteGroupId); redrawSpriteGroup(spriteGroupId); } } -void ScummEngine_v90he::spriteGroupSet_flagClipBoxAnd(int spriteGroupId) { +void Sprite::setGroupflagClipBoxAnd(int spriteGroupId) { checkRange(_varNumSpriteGroups, 1, spriteGroupId, "Invalid sprite group %d"); _spriteGroups[spriteGroupId].flags &= ~(kSGFClipBox); redrawSpriteGroup(spriteGroupId); } -void ScummEngine_v90he::spritesAllocTables(int numSprites, int numGroups, int numMaxSprites) { +void Sprite::spritesAllocTables(int numSprites, int numGroups, int numMaxSprites) { _varNumSpriteGroups = numGroups; _numSpritesToProcess = 0; _varNumSprites = numSprites; @@ -1049,7 +1052,7 @@ void ScummEngine_v90he::spritesAllocTables(int numSprites, int numGroups, int nu _activeSpritesTable = (SpriteInfo **)malloc((_varNumSprites + 1) * sizeof(SpriteInfo *)); } -void ScummEngine_v90he::spritesResetGroup(int spriteGroupId) { +void Sprite::spritesResetGroup(int spriteGroupId) { checkRange(_varNumSpriteGroups, 1, spriteGroupId, "Invalid sprite group %d"); SpriteGroup *spg = &_spriteGroups[spriteGroupId]; @@ -1067,19 +1070,19 @@ void ScummEngine_v90he::spritesResetGroup(int spriteGroupId) { spg->scale_y_ratio_div = 1; } -void ScummEngine_v90he::spritesResetTables(bool refreshScreen) { +void Sprite::spritesResetTables(bool refreshScreen) { memset(_spriteTable, 0, (_varNumSprites + 1) * sizeof(SpriteInfo)); memset(_spriteGroups, 0, (_varNumSpriteGroups + 1) * sizeof(SpriteGroup)); for (int curGrp = 1; curGrp < _varNumSpriteGroups; ++curGrp) spritesResetGroup(curGrp); if (refreshScreen) { - gdi.copyVirtScreenBuffers(Common::Rect(_screenWidth, _screenHeight)); + _vm->gdi.copyVirtScreenBuffers(Common::Rect(_vm->_screenWidth, _vm->_screenHeight)); } _numSpritesToProcess = 0; } -void ScummEngine_v90he::spritesBlitToScreen() { +void Sprite::spritesBlitToScreen() { int xmin, xmax, ymin, ymax; xmin = ymin = 1234; xmax = ymax = -1234; @@ -1092,7 +1095,7 @@ void ScummEngine_v90he::spritesBlitToScreen() { spi->flags &= ~kSFChanged; if (spi->bbox.left <= spi->bbox.right && spi->bbox.top <= spi->bbox.bottom) { if (spi->flags & kSFBlitDirectly) { - gdi.copyVirtScreenBuffers(spi->bbox, USAGE_BIT_RESTORED); + _vm->gdi.copyVirtScreenBuffers(spi->bbox, USAGE_BIT_RESTORED); } else if (firstLoop) { xmin = spi->bbox.left; ymin = spi->bbox.top; @@ -1121,12 +1124,12 @@ void ScummEngine_v90he::spritesBlitToScreen() { } } if (refreshScreen) { - gdi.copyVirtScreenBuffers(Common::Rect(xmin, ymin, xmax, ymax), USAGE_BIT_RESTORED); + _vm->gdi.copyVirtScreenBuffers(Common::Rect(xmin, ymin, xmax, ymax), USAGE_BIT_RESTORED); } } -void ScummEngine_v90he::spritesMarkDirty(bool checkZOrder) { - VirtScreen *vs = &virtscr[kMainVirtScreen]; +void Sprite::spritesMarkDirty(bool checkZOrder) { + VirtScreen *vs = &_vm->virtscr[kMainVirtScreen]; for (int i = 0; i < _numSpritesToProcess; ++i) { SpriteInfo *spi = _activeSpritesTable[i]; if (!(spi->flags & (kSFNeedRedraw | kSF30))) { @@ -1154,7 +1157,7 @@ void ScummEngine_v90he::spritesMarkDirty(bool checkZOrder) { } } -void ScummEngine_v90he::spritesUpdateImages() { +void Sprite::spritesUpdateImages() { for (int i = 0; i < _numSpritesToProcess; ++i) { SpriteInfo *spi = _activeSpritesTable[i]; if (spi->dx || spi->dy) { @@ -1199,7 +1202,7 @@ static int compareSprTable(const void *a, const void *b) { return 0; } -void ScummEngine_v90he::spritesSortActiveSprites() { +void Sprite::spritesSortActiveSprites() { int groupZorder; _numSpritesToProcess = 0; @@ -1235,7 +1238,7 @@ void ScummEngine_v90he::spritesSortActiveSprites() { qsort(_activeSpritesTable, _numSpritesToProcess, sizeof(SpriteInfo *), compareSprTable); } -void ScummEngine_v90he::spritesProcessWiz(bool arg) { +void Sprite::spritesProcessWiz(bool arg) { int spr_flags; int16 spr_wiz_x, spr_wiz_y; int resId, resState; @@ -1263,7 +1266,7 @@ void ScummEngine_v90he::spritesProcessWiz(bool arg) { spi->flags &= ~kSFNeedRedraw; resId = spi->resId; resState = spi->resState; - _wiz->loadImgSpot(spi->resId, spi->resState, spr_wiz_x, spr_wiz_y); + _vm->_wiz->loadImgSpot(spi->resId, spi->resState, spr_wiz_x, spr_wiz_y); if (spi->groupNum) { SpriteGroup *spg = &_spriteGroups[spi->groupNum]; @@ -1294,7 +1297,7 @@ void ScummEngine_v90he::spritesProcessWiz(bool arg) { if (resId) { angle = spi->angle; zoom = spi->zoom; - _wiz->getWizImageDim(resId, resState, w, h); + _vm->_wiz->getWizImageDim(resId, resState, w, h); if (!(spi->flags & (kSFZoomed | kSFRotated))) { bboxPtr->left = wiz.img.x1; bboxPtr->top = wiz.img.y1; @@ -1314,14 +1317,14 @@ void ScummEngine_v90he::spritesProcessWiz(bool arg) { } } if ((spi->flags & kSFRotated) && angle) - _wiz->polygonRotatePoints(pts, 4, angle); + _vm->_wiz->polygonRotatePoints(pts, 4, angle); for (int j = 0; j < 4; ++j) { pts[j].x += wiz.img.x1; pts[j].y += wiz.img.y1; } - _wiz->polygonCalcBoundBox(pts, 4, spi->bbox); + _vm->_wiz->polygonCalcBoundBox(pts, 4, spi->bbox); } } else { bboxPtr->left = 1234; @@ -1389,11 +1392,11 @@ void ScummEngine_v90he::spritesProcessWiz(bool arg) { wiz.processFlags |= kWPFDstResNum; wiz.dstResNum = _spriteGroups[spi->groupNum].dstResNum; } - _wiz->displayWizComplexImage(&wiz); + _vm->_wiz->displayWizComplexImage(&wiz); } } -void ScummEngine_v90he::saveOrLoadSpriteData(Serializer *s, uint32 savegameVersion) { +void Sprite::saveOrLoadSpriteData(Serializer *s, uint32 savegameVersion) { static const SaveLoadEntry spriteEntries[] = { MKLINE(SpriteInfo, id, sleInt32, VER(48)), MKLINE(SpriteInfo, zorder, sleInt32, VER(48)), diff --git a/scumm/sprite_he.h b/scumm/sprite_he.h index 318821157a..ccfd6edea6 100644 --- a/scumm/sprite_he.h +++ b/scumm/sprite_he.h @@ -20,7 +20,7 @@ * */ -#ifndef SPRITE_HE_H +#if !defined(SPRITE_HE_H) && !defined(DISABLE_HE) #define SPRITE_HE_H namespace Scumm { @@ -97,6 +97,123 @@ struct SpriteGroup { int32 scale_y_ratio_div; }; +class ScummEngine_v90he; + +class Sprite { +public: + Sprite(ScummEngine_v90he *vm); + + SpriteInfo *_spriteTable; + SpriteGroup *_spriteGroups; + SpriteInfo **_activeSpritesTable; + + int32 _numSpritesToProcess; + int32 _varNumSpriteGroups; + int32 _varNumSprites; + int32 _varMaxSprites; + + void saveOrLoadSpriteData(Serializer *s, uint32 savegameVersion); + void spritesBlitToScreen(); + void spritesMarkDirty(bool checkZOrder); + void spritesSortActiveSprites(); + void spritesProcessWiz(bool arg); + void spritesUpdateImages(); + + void getSpriteBounds(int spriteId, bool checkGroup, Common::Rect &bound); + int findSpriteWithClassOf(int x, int y, int spriteGroupId, int d, int num, int *args); + int getSpriteclassFlags(int spriteId, int num, int *args); + int getSpriteFlagDoubleBuffered(int spriteId); + int getSpriteFlagYFlipped(int spriteId); + int getSpriteFlagXFlipped(int spriteId); + int getSpriteFlagActive(int spriteId); + int getSpriteFlagNeedPaletteRemap(int spriteId); + int getSpriteFlagDelayed(int spriteId); + int getSpriteFlagMarkDirty(int spriteId); + int getSpriteFlagHasImage(int spriteId); + int getSpriteResId(int spriteId); + int getSpriteResState(int spriteId); + int getSpriteGroupNum(int spriteId); + int getSpritePaletteNum(int spriteId); + int getSpriteZorderPriority(int spriteId); + int getSpritegrp_tx(int spriteId); + int getSpritegrp_ty(int spriteId); + int getSpriteField_44(int spriteId); + int getSpriteXmapNum(int spriteId); + int getSpritewizSize(int spriteId); + int getSpritezoom(int spriteId); + int getSpritedelayAmount(int spriteId); + int getSpritemaskImgResNum(int spriteId); + int getSpriteField_80(int spriteId); + int getSpriteField_8C_90(int spriteId, int type); + void getSpriteImageDim(int spriteId, int32 &w, int32 &h); + void getSpritetx_ty(int spriteId, int32 &tx, int32 &ty); + void getSpritedx_dy(int spriteId, int32 &dx, int32 &dy); + + int getGroupzorderPriority(int spriteGroupId); + int getGroupdstResNum(int spriteGroupId); + int getGroupScale_x_ratio_mul(int spriteGroupId); + int getGroupScale_x_ratio_div(int spriteGroupId); + int getGroupScale_y_ratio_mul(int spriteGroupId); + int getGroupScale_y_ratio_div(int spriteGroupId); + void getGrouptx_ty(int spriteGroupId, int32 &tx, int32 &ty); + + void setSpritePaletteNum(int spriteId, int value); + void setSpriteMaskImgResNum(int spriteId, int value); + void setSpriteField80(int spriteId, int value); + void setSpriteResetSprite(int spriteId); + void setSpriteResState(int spriteId, int value); + void setSpritetx_ty(int spriteId, int value1, int value2); + void setSpriteGroupNum(int spriteId, int value); + void setSpritedx_dy(int spriteId, int value1, int value2); + void setSpriteXmapNum(int spriteId, int value); + void setSpriteField44(int spriteId, int value1, int value2); + void setSpriteZorderPriority(int spriteId, int value); + void setSpriteInc_tx_ty(int spriteId, int value1, int value2); + void setSpriteZoom(int spriteId, int value); + void setSpriteAngle(int spriteId, int value); + void setSpriteFlagDoubleBuffered(int spriteId, int value); + void setSpriteFlagYFlipped(int spriteId, int value); + void setSpriteFlagXFlipped(int spriteId, int value); + void setSpriteFlagActive(int spriteId, int value); + void setSpriteFlagNeedPaletteRemap(int spriteId, int value); + void setSpriteFlagDelayed(int spriteId, int value); + void setSpriteFlagMarkDirty(int spriteId, int value); + void setSpriteFlagHasImage(int spriteId, int value); + void setSpriteDelay(int spriteId, int value); + void setSpriteSetClassFlag(int spriteId, int classId, int toggle); + void setSpriteResetClassFlags(int spriteId); + void setSpriteField84(int spriteId, int value); + void setSpriteField8C_90(int spriteId, int type, int value); + + void redrawSpriteGroup(int spriteGroupId); + void setGroupCase0_0(int spriteGroupId, int value1, int value2); + void setGroupCase0_1(int spriteGroupId, int value); + void setGroupCase0_2(int spriteGroupId, int value); + void setGroupCase0_3(int spriteGroupId, int value); + void setGroupCase0_4(int spriteGroupId); + void setGroupCase0_5(int spriteGroupId, int value); + void setGroupCase0_6(int spriteGroupId, int value); + void setGroupCase0_7(int spriteGroupId, int value); + void setGroupbbox(int spriteGroupId, int x1, int y1, int x2, int y2); + void setGroupzorderPriority(int spriteGroupId, int value); + void setGrouptx_ty(int spriteGroupId, int value1, int value2); + void setGroupinc_tx_ty(int spriteGroupId, int value1, int value2); + void setGroupdstResNum(int spriteGroupId, int value); + void setGroupscaling(int spriteGroupId); + void setGroupScale_x_ratio_mul(int spriteGroupId, int value); + void setGroupScale_x_ratio_div(int spriteGroupId, int value); + void setGroupScale_y_ratio_mul(int spriteGroupId, int value); + void setGroupScale_y_ratio_div(int spriteGroupId, int value); + void setGroupflagClipBoxAnd(int spriteGroupId); + + void spritesAllocTables(int numSprites, int numGroups, int numMaxSprites); + void spritesResetGroup(int spriteGroupId); + void spritesResetTables(bool refreshScreen); + void spriteAddImageToList(int spriteId, int imageNum, int *spriteIdptr); +private: + ScummEngine_v90he *_vm; +}; + } // End of namespace Scumm #endif |