aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorStrangerke2013-03-25 08:02:07 +0100
committerStrangerke2013-03-25 08:02:07 +0100
commit91469d7d386d5eca3f471d0a57cc5bf333212b89 (patch)
tree8652223ce96426a46c64725828229043dbadea87 /engines
parent6f2eb50d2affac01556f068e6efd1888ed5e9b99 (diff)
downloadscummvm-rg350-91469d7d386d5eca3f471d0a57cc5bf333212b89.tar.gz
scummvm-rg350-91469d7d386d5eca3f471d0a57cc5bf333212b89.tar.bz2
scummvm-rg350-91469d7d386d5eca3f471d0a57cc5bf333212b89.zip
HOPKINS: More work on Globals
Diffstat (limited to 'engines')
-rw-r--r--engines/hopkins/anim.cpp76
-rw-r--r--engines/hopkins/anim.h18
-rw-r--r--engines/hopkins/globals.cpp51
-rw-r--r--engines/hopkins/globals.h59
-rw-r--r--engines/hopkins/graphics.cpp8
-rw-r--r--engines/hopkins/objects.cpp45
-rw-r--r--engines/hopkins/objects.h43
-rw-r--r--engines/hopkins/talk.cpp44
8 files changed, 172 insertions, 172 deletions
diff --git a/engines/hopkins/anim.cpp b/engines/hopkins/anim.cpp
index 8967281640..7debc1f274 100644
--- a/engines/hopkins/anim.cpp
+++ b/engines/hopkins/anim.cpp
@@ -38,6 +38,14 @@ namespace Hopkins {
AnimationManager::AnimationManager(HopkinsEngine *vm) {
_vm = vm;
_clearAnimationFl = false;
+ for (int i = 0; i < 8; ++i)
+ Common::fill((byte *)&Bank[i], (byte *)&Bank[i] + sizeof(BankItem), 0);
+ for (int i = 0; i < 35; ++i)
+ Common::fill((byte *)&_animBqe[i], (byte *)&_animBqe[i] + sizeof(BqeAnimItem), 0);
+}
+
+void AnimationManager::clearAll() {
+ initAnimBqe();
}
/**
@@ -475,15 +483,15 @@ void AnimationManager::loadAnim(const Common::String &animName) {
*/
void AnimationManager::clearAnim() {
for (int idx = 0; idx < 35; ++idx) {
- _vm->_globals->_animBqe[idx]._data = _vm->_globals->freeMemory(_vm->_globals->_animBqe[idx]._data);
- _vm->_globals->_animBqe[idx]._enabledFl = false;
+ _animBqe[idx]._data = _vm->_globals->freeMemory(_animBqe[idx]._data);
+ _animBqe[idx]._enabledFl = false;
}
for (int idx = 0; idx < 8; ++idx) {
- _vm->_globals->Bank[idx]._data = _vm->_globals->freeMemory(_vm->_globals->Bank[idx]._data);
- _vm->_globals->Bank[idx]._loadedFl = false;
- _vm->_globals->Bank[idx]._filename = "";
- _vm->_globals->Bank[idx]._fileHeader = 0;
+ Bank[idx]._data = _vm->_globals->freeMemory(Bank[idx]._data);
+ Bank[idx]._loadedFl = false;
+ Bank[idx]._filename = "";
+ Bank[idx]._fileHeader = 0;
}
}
@@ -492,24 +500,24 @@ void AnimationManager::clearAnim() {
*/
int AnimationManager::loadSpriteBank(int idx, const Common::String &filename) {
int result = 0;
- _vm->_globals->Bank[idx]._loadedFl = true;
- _vm->_globals->Bank[idx]._filename = filename;
+ Bank[idx]._loadedFl = true;
+ Bank[idx]._filename = filename;
byte *fileDataPtr = _vm->_fileManager->loadFile(filename);
- _vm->_globals->Bank[idx]._fileHeader = 0;
+ Bank[idx]._fileHeader = 0;
if (fileDataPtr[1] == 'L' && fileDataPtr[2] == 'E')
- _vm->_globals->Bank[idx]._fileHeader = 1;
+ Bank[idx]._fileHeader = 1;
else if (fileDataPtr[1] == 'O' && fileDataPtr[2] == 'R')
- _vm->_globals->Bank[idx]._fileHeader = 2;
+ Bank[idx]._fileHeader = 2;
- if (!_vm->_globals->Bank[idx]._fileHeader) {
+ if (!Bank[idx]._fileHeader) {
_vm->_globals->freeMemory(fileDataPtr);
- _vm->_globals->Bank[idx]._loadedFl = false;
+ Bank[idx]._loadedFl = false;
result = -1;
}
- _vm->_globals->Bank[idx]._data = fileDataPtr;
+ Bank[idx]._data = fileDataPtr;
int objectDataIdx = 0;
for(objectDataIdx = 0; objectDataIdx <= 249; objectDataIdx++) {
@@ -521,12 +529,12 @@ int AnimationManager::loadSpriteBank(int idx, const Common::String &filename) {
if (objectDataIdx > 249) {
_vm->_globals->freeMemory(fileDataPtr);
- _vm->_globals->Bank[idx]._loadedFl = false;
+ Bank[idx]._loadedFl = false;
result = -2;
}
- _vm->_globals->Bank[idx]._objDataIdx = objectDataIdx;
+ Bank[idx]._objDataIdx = objectDataIdx;
- Common::String ofsFilename = _vm->_globals->Bank[idx]._filename;
+ Common::String ofsFilename = Bank[idx]._filename;
char ch;
do {
ch = ofsFilename.lastChar();
@@ -538,15 +546,15 @@ int AnimationManager::loadSpriteBank(int idx, const Common::String &filename) {
if (f.exists(ofsFilename)) {
byte *ofsData = _vm->_fileManager->loadFile(ofsFilename);
byte *curOfsData = ofsData;
- for (int objIdx = 0; objIdx < _vm->_globals->Bank[idx]._objDataIdx; ++objIdx, curOfsData += 8) {
+ for (int objIdx = 0; objIdx < Bank[idx]._objDataIdx; ++objIdx, curOfsData += 8) {
int x1 = READ_LE_INT16(curOfsData);
int y1 = READ_LE_INT16(curOfsData + 2);
int x2 = READ_LE_INT16(curOfsData + 4);
int y2 = READ_LE_INT16(curOfsData + 6);
- _vm->_objectsManager->setOffsetXY(_vm->_globals->Bank[idx]._data, objIdx, x1, y1, 0);
- if (_vm->_globals->Bank[idx]._fileHeader == 2)
- _vm->_objectsManager->setOffsetXY(_vm->_globals->Bank[idx]._data, objIdx, x2, y2, 1);
+ _vm->_objectsManager->setOffsetXY(Bank[idx]._data, objIdx, x1, y1, 0);
+ if (Bank[idx]._fileHeader == 2)
+ _vm->_objectsManager->setOffsetXY(Bank[idx]._data, objIdx, x2, y2, 1);
}
_vm->_globals->freeMemory(ofsData);
@@ -571,18 +579,18 @@ void AnimationManager::searchAnim(const byte *data, int animIndex, int bufSize)
if (READ_BE_UINT32(&data[curBufferPos]) == MKTAG('A', 'N', 'I', 'M') || READ_BE_UINT24(&data[curBufferPos]) == MKTAG24('F', 'I', 'N'))
innerLoopCond = true;
if (bufSize < curBufferPos) {
- _vm->_globals->_animBqe[animIndex]._enabledFl = false;
- _vm->_globals->_animBqe[animIndex]._data = g_PTRNUL;
+ _animBqe[animIndex]._enabledFl = false;
+ _animBqe[animIndex]._data = g_PTRNUL;
return;
}
++curBufferPos;
++count;
} while (!innerLoopCond);
- _vm->_globals->_animBqe[animIndex]._data = _vm->_globals->allocMemory(count + 50);
- _vm->_globals->_animBqe[animIndex]._enabledFl = true;
- memcpy(_vm->_globals->_animBqe[animIndex]._data, data + dataIdx + 5, 20);
+ _animBqe[animIndex]._data = _vm->_globals->allocMemory(count + 50);
+ _animBqe[animIndex]._enabledFl = true;
+ memcpy(_animBqe[animIndex]._data, data + dataIdx + 5, 20);
- byte *dataP = _vm->_globals->_animBqe[animIndex]._data;
+ byte *dataP = _animBqe[animIndex]._data;
int curDestDataIndx = 20;
int curSrcDataIndx = dataIdx + 25;
@@ -904,4 +912,18 @@ void AnimationManager::playSequence2(const Common::String &file, uint32 rate1, u
_vm->_eventsManager->_mouseFl = true;
}
+void AnimationManager::initAnimBqe() {
+ for (int idx = 0; idx < 35; ++idx) {
+ _animBqe[idx]._data = g_PTRNUL;
+ _animBqe[idx]._enabledFl = false;
+ }
+
+ for (int idx = 0; idx < 8; ++idx) {
+ Bank[idx]._data = g_PTRNUL;
+ Bank[idx]._loadedFl = false;
+ Bank[idx]._filename = "";
+ Bank[idx]._fileHeader = 0;
+ }
+}
+
} // End of namespace Hopkins
diff --git a/engines/hopkins/anim.h b/engines/hopkins/anim.h
index 93256f9110..6becd544af 100644
--- a/engines/hopkins/anim.h
+++ b/engines/hopkins/anim.h
@@ -30,6 +30,19 @@
namespace Hopkins {
+struct BankItem {
+ byte *_data;
+ bool _loadedFl;
+ Common::String _filename;
+ int _fileHeader;
+ int _objDataIdx;
+};
+
+struct BqeAnimItem {
+ byte *_data;
+ bool _enabledFl;
+};
+
class HopkinsEngine;
class AnimationManager {
@@ -38,11 +51,16 @@ private:
HopkinsEngine *_vm;
+ void initAnimBqe();
int loadSpriteBank(int idx, const Common::String &filename);
void searchAnim(const byte *data, int animIndex, int count);
public:
+ BqeAnimItem _animBqe[35];
+ BankItem Bank[8];
+
AnimationManager(HopkinsEngine *vm);
+ void clearAll();
void loadAnim(const Common::String &animName);
void clearAnim();
diff --git a/engines/hopkins/globals.cpp b/engines/hopkins/globals.cpp
index 0d97789052..459bf565f8 100644
--- a/engines/hopkins/globals.cpp
+++ b/engines/hopkins/globals.cpp
@@ -70,16 +70,10 @@ Globals::Globals(HopkinsEngine *vm) {
strcpy((char *)g_PTRNUL, "POINTERNULL");
// Initialize array properties
- for (int i = 0; i < 35; ++i)
- Common::fill((byte *)&_animBqe[i], (byte *)&_animBqe[i] + sizeof(BqeAnimItem), 0);
- for (int i = 0; i < 8; ++i)
- Common::fill((byte *)&Bank[i], (byte *)&Bank[i] + sizeof(BankItem), 0);
for (int i = 0; i < 6; ++i)
Common::fill((byte *)&Liste[i], (byte *)&Liste[i] + sizeof(ListeItem), 0);
for (int i = 0; i < 35; ++i)
Common::fill((byte *)&Liste2[i], (byte *)&Liste2[i] + sizeof(ListeItem), 0);
- for (int i = 0; i < 30; ++i)
- Common::fill((byte *)&VBob[i], (byte *)&VBob[i] + sizeof(VBobItem), 0);
for (int i = 0; i < 500; ++i)
_spriteSize[i] = 0;
for (int i = 0; i < 70; ++i)
@@ -143,9 +137,6 @@ Globals::~Globals() {
freeMemory((byte *)_saveData);
freeMemory(_answerBuffer);
freeMemory(_characterSpriteBuf);
-
- clearVBob();
-
free(g_PTRNUL);
}
@@ -186,11 +177,7 @@ void Globals::setConfig() {
}
void Globals::clearAll() {
- initAnimBqe();
-
_vm->_fontManager->clearAll();
-
- initVBob();
_vm->_dialogsManager->clearAll();
_answerBuffer = g_PTRNUL;
_levelSpriteBuf = g_PTRNUL;
@@ -221,44 +208,6 @@ void Globals::loadCharacterData() {
_vm->_objectsManager->resetOldDirection();
}
-void Globals::initAnimBqe() {
- for (int idx = 0; idx < 35; ++idx) {
- _animBqe[idx]._data = g_PTRNUL;
- _animBqe[idx]._enabledFl = false;
- }
-
- for (int idx = 0; idx < 8; ++idx) {
- Bank[idx]._data = g_PTRNUL;
- Bank[idx]._loadedFl = false;
- Bank[idx]._filename = "";
- Bank[idx]._fileHeader = 0;
- }
-}
-
-void Globals::initVBob() {
- for (int idx = 0; idx < 30; ++idx) {
- VBob[idx]._displayMode = 0;
- VBob[idx]._xp = 0;
- VBob[idx]._yp = 0;
- VBob[idx]._frameIndex = 0;
- VBob[idx]._surface = g_PTRNUL;
- VBob[idx]._spriteData = g_PTRNUL;
- VBob[idx]._oldSpriteData = g_PTRNUL;
- }
-}
-
-void Globals::clearVBob() {
- for (int idx = 0; idx < 30; ++idx) {
- VBob[idx]._displayMode = 0;
- VBob[idx]._xp = 0;
- VBob[idx]._yp = 0;
- VBob[idx]._frameIndex = 0;
- VBob[idx]._surface = freeMemory(VBob[idx]._surface);
- VBob[idx]._spriteData = g_PTRNUL;
- VBob[idx]._oldSpriteData = g_PTRNUL;
- }
-}
-
byte *Globals::allocMemory(int count) {
byte *result = (byte *)malloc(count);
if (!result)
diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h
index 519ad51f38..76439fcf23 100644
--- a/engines/hopkins/globals.h
+++ b/engines/hopkins/globals.h
@@ -29,19 +29,6 @@
namespace Hopkins {
-struct BqeAnimItem {
- byte *_data;
- bool _enabledFl;
-};
-
-struct BankItem {
- byte *_data;
- bool _loadedFl;
- Common::String _filename;
- int _fileHeader;
- int _objDataIdx;
-};
-
struct ListeItem {
bool _visibleFl;
int _posX;
@@ -50,45 +37,6 @@ struct ListeItem {
int _height;
};
-struct VBobItem {
- byte *_spriteData;
- int _displayMode;
- int _xp;
- int _yp;
- int _frameIndex;
- byte *_surface;
- int _oldX;
- int _oldY;
- int _oldFrameIndex;
- byte *_oldSpriteData;
-};
-
-/**
- * Mode for SortItem records
- */
-enum SortMode { SORT_NONE = 0, SORT_BOB = 1, SORT_SPRITE = 2, SORT_HIDING = 3 };
-
-/**
- * Structure to represent a pending display of either a Bob, Sprite, or Cache Item.
- */
-struct SortItem {
- SortMode _sortMode;
- int _index;
- int _priority;
-};
-
-struct HidingItem {
- int _x;
- int _y;
- int _spriteIndex;
- int _width;
- int _height;
- int _useCount;
- byte *_spriteData;
- bool _resetUseCount;
- int _yOffset;
-};
-
struct HopkinsItem {
int _speedX;
int _speedY;
@@ -211,9 +159,6 @@ class Globals {
private:
HopkinsEngine *_vm;
- void initAnimBqe();
- void initVBob();
-
public:
bool _disableInventFl;
bool _cityMapEnabledFl;
@@ -259,7 +204,6 @@ public:
bool _actionMoveTo;
bool _freezeCharacterFl;
bool _checkDistanceFl;
- BqeAnimItem _animBqe[35];
byte *_characterSpriteBuf;
Common::String _zoneFilename;
Common::String _textFilename;
@@ -268,8 +212,6 @@ public:
int iRegul;
ListeItem Liste[6];
ListeItem Liste2[35];
- BankItem Bank[8];
- VBobItem VBob[30];
Globals(HopkinsEngine *vm);
~Globals();
@@ -278,7 +220,6 @@ public:
void setConfig();
void clearAll();
void loadCharacterData();
- void clearVBob();
void B_CACHE_OFF(int idx);
};
diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp
index 14f23ad06a..a0cd39c069 100644
--- a/engines/hopkins/graphics.cpp
+++ b/engines/hopkins/graphics.cpp
@@ -1061,7 +1061,7 @@ void GraphicsManager::Sprite_Vesa(byte *surface, const byte *spriteData, int xp,
void GraphicsManager::endDisplayBob() {
for (int idx = 1; idx <= 20; ++idx) {
- if (_vm->_globals->_animBqe[idx]._enabledFl)
+ if (_vm->_animationManager->_animBqe[idx]._enabledFl)
_vm->_objectsManager->hideBob(idx);
}
@@ -1069,7 +1069,7 @@ void GraphicsManager::endDisplayBob() {
_vm->_eventsManager->refreshScreenAndEvents();
for (int idx = 1; idx <= 20; ++idx) {
- if (_vm->_globals->_animBqe[idx]._enabledFl)
+ if (_vm->_animationManager->_animBqe[idx]._enabledFl)
_vm->_objectsManager->resetBob(idx);
}
@@ -1078,13 +1078,13 @@ void GraphicsManager::endDisplayBob() {
}
for (int idx = 1; idx <= 20; ++idx) {
- _vm->_globals->_animBqe[idx]._enabledFl = false;
+ _vm->_animationManager->_animBqe[idx]._enabledFl = false;
}
}
void GraphicsManager::displayAllBob() {
for (int idx = 1; idx <= 20; ++idx) {
- if (_vm->_globals->_animBqe[idx]._enabledFl)
+ if (_vm->_animationManager->_animBqe[idx]._enabledFl)
_vm->_objectsManager->displayBob(idx);
}
}
diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp
index 5810daad7b..531c32c831 100644
--- a/engines/hopkins/objects.cpp
+++ b/engines/hopkins/objects.cpp
@@ -45,6 +45,7 @@ ObjectsManager::ObjectsManager(HopkinsEngine *vm) {
Common::fill((byte *)&_bob[i], (byte *)&_bob[i] + sizeof(BobItem), 0);
for (int i = 0; i < 30; ++i) {
+ Common::fill((byte *)&VBob[i], (byte *)&VBob[i] + sizeof(VBobItem), 0);
Common::fill((byte *)&_lockedAnims[i], (byte *)&_lockedAnims[i] + sizeof(LockAnimItem), 0);
}
@@ -116,6 +117,7 @@ ObjectsManager::~ObjectsManager() {
_vm->_globals->freeMemory(_gestureBuf);
_vm->_globals->freeMemory(_headSprites);
_vm->_globals->freeMemory(_objectDataBuf);
+ clearVBob();
for (int idx = 0; idx < 6; ++idx)
_hidingItemData[idx] = _vm->_globals->freeMemory(_hidingItemData[idx]);
@@ -132,6 +134,7 @@ void ObjectsManager::clearAll() {
_hidingItemData[idx] = _vm->_globals->freeMemory(_hidingItemData[idx]);
_objectDataBuf = _vm->_globals->freeMemory(_objectDataBuf);
+ initVBob();
}
// Load Object
@@ -652,11 +655,11 @@ void ObjectsManager::displayBob(int idx) {
resetBob(idx);
- const byte *data = _vm->_globals->_animBqe[idx]._data;
+ const byte *data = _vm->_animationManager->_animBqe[idx]._data;
int bankIdx = READ_LE_INT16(data);
if (!bankIdx)
return;
- if ((!_vm->_globals->Bank[bankIdx]._loadedFl) || (!READ_LE_UINT16(data + 24)))
+ if ((!_vm->_animationManager->Bank[bankIdx]._loadedFl) || (!READ_LE_UINT16(data + 24)))
return;
@@ -672,15 +675,15 @@ void ObjectsManager::displayBob(int idx) {
_bob[idx]._isSpriteFl = false;
- if (_vm->_globals->Bank[bankIdx]._fileHeader == 1) {
+ if (_vm->_animationManager->Bank[bankIdx]._fileHeader == 1) {
_bob[idx]._isSpriteFl = true;
_bob[idx]._zoomFactor = 0;
_bob[idx]._flipFl = false;
}
- _bob[idx]._animData = _vm->_globals->_animBqe[idx]._data;
+ _bob[idx]._animData = _vm->_animationManager->_animBqe[idx]._data;
_bob[idx]._bobMode = 10;
- _bob[idx]._spriteData = _vm->_globals->Bank[bankIdx]._data;
+ _bob[idx]._spriteData = _vm->_animationManager->Bank[bankIdx]._data;
_bob[idx]._bobModeChange = bobModeChange;
_bob[idx].field20 = newField20;
@@ -1139,7 +1142,7 @@ void ObjectsManager::displayVBob() {
int width, height;
for (int idx = 0; idx <= 29; idx++) {
- VBobItem *vbob = &_vm->_globals->VBob[idx];
+ VBobItem *vbob = &VBob[idx];
if (vbob->_displayMode == 4) {
width = getWidth(vbob->_spriteData, vbob->_frameIndex);
height = getHeight(vbob->_spriteData, vbob->_frameIndex);
@@ -2120,7 +2123,7 @@ void ObjectsManager::clearScreen() {
_vm->_graphicsManager->endDisplayBob();
_vm->_fontManager->hideText(5);
_vm->_fontManager->hideText(9);
- _vm->_globals->clearVBob();
+ clearVBob();
_vm->_animationManager->clearAnim();
_vm->_linesManager->clearAllZones();
_vm->_linesManager->resetLines();
@@ -2776,7 +2779,7 @@ void ObjectsManager::VBOB(byte *src, int idx, int xp, int yp, int frameIndex) {
if (idx > 29)
error("MAX_VBOB exceeded");
- VBobItem *vbob = &_vm->_globals->VBob[idx];
+ VBobItem *vbob = &VBob[idx];
if (vbob->_displayMode <= 1) {
vbob->_displayMode = 1;
vbob->_xp = xp;
@@ -2805,7 +2808,7 @@ void ObjectsManager::VBOB_OFF(int idx) {
if (idx > 29)
error("MAX_VBOB exceeded");
- VBobItem *vbob = &_vm->_globals->VBob[idx];
+ VBobItem *vbob = &VBob[idx];
if (vbob->_displayMode <= 1)
vbob->_displayMode = 0;
else
@@ -4007,6 +4010,30 @@ void ObjectsManager::loadHidingItems(const Common::String &file) {
_vm->_globals->freeMemory(ptr);
}
+void ObjectsManager::initVBob() {
+ for (int idx = 0; idx < 30; ++idx) {
+ VBob[idx]._displayMode = 0;
+ VBob[idx]._xp = 0;
+ VBob[idx]._yp = 0;
+ VBob[idx]._frameIndex = 0;
+ VBob[idx]._surface = g_PTRNUL;
+ VBob[idx]._spriteData = g_PTRNUL;
+ VBob[idx]._oldSpriteData = g_PTRNUL;
+ }
+}
+
+void ObjectsManager::clearVBob() {
+ for (int idx = 0; idx < 30; ++idx) {
+ VBob[idx]._displayMode = 0;
+ VBob[idx]._xp = 0;
+ VBob[idx]._yp = 0;
+ VBob[idx]._frameIndex = 0;
+ VBob[idx]._surface = _vm->_globals->freeMemory(VBob[idx]._surface);
+ VBob[idx]._spriteData = g_PTRNUL;
+ VBob[idx]._oldSpriteData = g_PTRNUL;
+ }
+}
+
void ObjectsManager::enableHiding() {
_hidingActiveFl = true;
}
diff --git a/engines/hopkins/objects.h b/engines/hopkins/objects.h
index 00317c064d..c1bfaddb96 100644
--- a/engines/hopkins/objects.h
+++ b/engines/hopkins/objects.h
@@ -91,11 +91,50 @@ struct BobItem {
int _zoomOutFactor;
};
+struct HidingItem {
+ int _x;
+ int _y;
+ int _spriteIndex;
+ int _width;
+ int _height;
+ int _useCount;
+ byte *_spriteData;
+ bool _resetUseCount;
+ int _yOffset;
+};
+
struct LockAnimItem {
bool _enableFl;
int _posX;
};
+struct VBobItem {
+ byte *_spriteData;
+ int _displayMode;
+ int _xp;
+ int _yp;
+ int _frameIndex;
+ byte *_surface;
+ int _oldX;
+ int _oldY;
+ int _oldFrameIndex;
+ byte *_oldSpriteData;
+};
+
+/**
+ * Mode for SortItem records
+ */
+enum SortMode { SORT_NONE = 0, SORT_BOB = 1, SORT_SPRITE = 2, SORT_HIDING = 3 };
+
+/**
+ * Structure to represent a pending display of either a Bob, Sprite, or Cache Item.
+ */
+struct SortItem {
+ SortMode _sortMode;
+ int _index;
+ int _priority;
+};
+
class HopkinsEngine;
class ObjectsManager {
@@ -125,6 +164,10 @@ private:
ObjectAuthIcon _objectAuthIcons[300];
int _curObjectFileNum;
byte *_objectDataBuf;
+ VBobItem VBob[30];
+
+ void initVBob();
+ void clearVBob();
void sprite_alone(const byte *objectData, byte *sprite, int objIndex);
void removeObjectDataBuf();
diff --git a/engines/hopkins/talk.cpp b/engines/hopkins/talk.cpp
index 2c1281f59d..3404399014 100644
--- a/engines/hopkins/talk.cpp
+++ b/engines/hopkins/talk.cpp
@@ -470,26 +470,26 @@ void TalkManager::searchCharacterPalette(int startIdx, bool dark) {
void TalkManager::dialogWait() {
for (int idx = 26; idx <= 30; ++idx) {
- if (_vm->_globals->_animBqe[idx]._enabledFl)
+ if (_vm->_animationManager->_animBqe[idx]._enabledFl)
BOB_VISU_PARLE(idx);
}
}
void TalkManager::dialogTalk() {
for (int idx = 26; idx <= 30; ++idx) {
- if (_vm->_globals->_animBqe[idx]._enabledFl)
+ if (_vm->_animationManager->_animBqe[idx]._enabledFl)
_vm->_objectsManager->hideBob(idx);
}
for (int idx = 26; idx <= 30; ++idx) {
- if (_vm->_globals->_animBqe[idx]._enabledFl)
+ if (_vm->_animationManager->_animBqe[idx]._enabledFl)
_vm->_objectsManager->resetBob(idx);
}
}
void TalkManager::dialogEndTalk() {
for (int idx = 21; idx <= 25; ++idx) {
- if (_vm->_globals->_animBqe[idx]._enabledFl)
+ if (_vm->_animationManager->_animBqe[idx]._enabledFl)
_vm->_objectsManager->hideBob(idx);
}
@@ -497,7 +497,7 @@ void TalkManager::dialogEndTalk() {
_vm->_eventsManager->refreshScreenAndEvents();
for (int idx = 21; idx <= 25; ++idx) {
- if (_vm->_globals->_animBqe[idx]._enabledFl)
+ if (_vm->_animationManager->_animBqe[idx]._enabledFl)
_vm->_objectsManager->resetBob(idx);
}
}
@@ -592,7 +592,7 @@ int TalkManager::countBoxLines(int idx, const Common::String &file) {
void TalkManager::VISU_PARLE() {
for (int idx = 21; idx <= 25; ++idx) {
- if (_vm->_globals->_animBqe[idx]._enabledFl)
+ if (_vm->_animationManager->_animBqe[idx]._enabledFl)
BOB_VISU_PARLE(idx);
}
}
@@ -601,7 +601,7 @@ void TalkManager::BOB_VISU_PARLE(int idx) {
_vm->_objectsManager->_priorityFl = true;
if (!_vm->_objectsManager->_bob[idx]._bobMode) {
_vm->_objectsManager->resetBob(idx);
- byte *bqeData = _vm->_globals->_animBqe[idx]._data;
+ byte *bqeData = _vm->_animationManager->_animBqe[idx]._data;
int newMode = READ_LE_INT16(bqeData + 2);
if (!newMode)
newMode = 1;
@@ -609,7 +609,7 @@ void TalkManager::BOB_VISU_PARLE(int idx) {
_vm->_objectsManager->_bob[idx]._isSpriteFl = true;
_vm->_objectsManager->_bob[idx]._zoomFactor = 0;
_vm->_objectsManager->_bob[idx]._flipFl = false;
- _vm->_objectsManager->_bob[idx]._animData = _vm->_globals->_animBqe[idx]._data;
+ _vm->_objectsManager->_bob[idx]._animData = _vm->_animationManager->_animBqe[idx]._data;
_vm->_objectsManager->_bob[idx]._bobMode = 10;
bqeData = _characterSprite;
_vm->_objectsManager->_bob[idx]._spriteData = _characterSprite;
@@ -695,8 +695,8 @@ void TalkManager::initCharacterAnim() {
void TalkManager::clearCharacterAnim() {
for (int idx = 21; idx <= 34; ++idx) {
- _vm->_globals->_animBqe[idx]._data = _vm->_globals->freeMemory(_vm->_globals->_animBqe[idx]._data);
- _vm->_globals->_animBqe[idx]._enabledFl = false;
+ _vm->_animationManager->_animBqe[idx]._data = _vm->_globals->freeMemory(_vm->_animationManager->_animBqe[idx]._data);
+ _vm->_animationManager->_animBqe[idx]._enabledFl = false;
}
}
@@ -713,25 +713,25 @@ bool TalkManager::searchCharacterAnim(int idx, const byte *bufPerso, int animId,
if (READ_BE_UINT32(curPtr) == MKTAG('A', 'N', 'I', 'M') || READ_BE_UINT24(curPtr) == MKTAG24('F', 'I', 'N'))
loopCond = true;
if (bufIndx > bufferSize) {
- _vm->_globals->_animBqe[idx]._enabledFl = false;
- _vm->_globals->_animBqe[idx]._data = g_PTRNUL;
+ _vm->_animationManager->_animBqe[idx]._enabledFl = false;
+ _vm->_animationManager->_animBqe[idx]._data = g_PTRNUL;
return false;
}
++bufIndx;
++animLength;
++curPtr;
} while (!loopCond);
- _vm->_globals->_animBqe[idx]._data = _vm->_globals->allocMemory(animLength + 50);
- _vm->_globals->_animBqe[idx]._enabledFl = true;
- memcpy(_vm->_globals->_animBqe[idx]._data, (const byte *)(bufPerso + bufPos + 5), 20);
+ _vm->_animationManager->_animBqe[idx]._data = _vm->_globals->allocMemory(animLength + 50);
+ _vm->_animationManager->_animBqe[idx]._enabledFl = true;
+ memcpy(_vm->_animationManager->_animBqe[idx]._data, (const byte *)(bufPerso + bufPos + 5), 20);
int bqeVal = READ_LE_INT16(bufPos + bufPerso + 29);
- WRITE_LE_UINT16(_vm->_globals->_animBqe[idx]._data + 20, READ_LE_INT16(bufPos + bufPerso + 25));
- WRITE_LE_UINT16(_vm->_globals->_animBqe[idx]._data + 22, READ_LE_INT16(bufPos + bufPerso + 27));
- WRITE_LE_UINT16(_vm->_globals->_animBqe[idx]._data + 24, bqeVal);
- WRITE_LE_UINT16(_vm->_globals->_animBqe[idx]._data + 26, READ_LE_INT16(bufPos + bufPerso + 31));
- _vm->_globals->_animBqe[idx]._data[28] = bufPerso[bufPos + 33];
- _vm->_globals->_animBqe[idx]._data[29] = bufPerso[bufPos + 34];
- byte *bqeCurData = _vm->_globals->_animBqe[idx]._data + 20;
+ WRITE_LE_UINT16(_vm->_animationManager->_animBqe[idx]._data + 20, READ_LE_INT16(bufPos + bufPerso + 25));
+ WRITE_LE_UINT16(_vm->_animationManager->_animBqe[idx]._data + 22, READ_LE_INT16(bufPos + bufPerso + 27));
+ WRITE_LE_UINT16(_vm->_animationManager->_animBqe[idx]._data + 24, bqeVal);
+ WRITE_LE_UINT16(_vm->_animationManager->_animBqe[idx]._data + 26, READ_LE_INT16(bufPos + bufPerso + 31));
+ _vm->_animationManager->_animBqe[idx]._data[28] = bufPerso[bufPos + 33];
+ _vm->_animationManager->_animBqe[idx]._data[29] = bufPerso[bufPos + 34];
+ byte *bqeCurData = _vm->_animationManager->_animBqe[idx]._data + 20;
const byte *curBufPerso = bufPos + bufPerso + 25;
for (int i = 1; i < 5000; i++) {
bqeCurData += 10;