MORTEVIELLE: Use a specific buffer instead of _mem for the animations

This commit is contained in:
Strangerke 2013-07-25 10:32:21 +02:00
parent e86ec8bc81
commit 8e2fe73afa
6 changed files with 13 additions and 9 deletions

View File

@ -481,9 +481,9 @@ void DialogManager::displayIntroScreen(bool drawFrame2Fl) {
*/
void DialogManager::displayIntroFrame2() {
_vm->_crep = _vm->getAnimOffset(1, 1);
_vm->displayPicture(&_vm->_mem[(kAdrAni * 16) + _vm->_crep], 63, 12);
_vm->displayPicture(&_vm->_curAnim[_vm->_crep], 63, 12);
_vm->_crep = _vm->getAnimOffset(2, 1);
_vm->displayPicture(&_vm->_mem[(kAdrAni * 16) + _vm->_crep], 63, 12);
_vm->displayPicture(&_vm->_curAnim[_vm->_crep], 63, 12);
_vm->_largestClearScreen = (_vm->_resolutionScaler == 1);
_vm->handleDescriptionText(2, kDialogStringIndex + 143);
}

View File

@ -102,11 +102,13 @@ MortevielleEngine::MortevielleEngine(OSystem *system, const ADGameDescription *g
memset(_mem, 0, sizeof(_mem));
_curPict = nullptr;
_curAnim = nullptr;
_rightFramePict = nullptr;
}
MortevielleEngine::~MortevielleEngine() {
free(_curPict);
free(_curAnim);
free(_rightFramePict);
}

View File

@ -476,8 +476,9 @@ public:
// TODO: Replace the following with proper implementations, or refactor out the code using them
byte _mem[65536 * 16];
byte *_curPict;
byte *_curAnim;
byte *_rightFramePict;
Debugger _debugger;
ScreenSurface _screenSurface;
PaletteManager _paletteManager;

View File

@ -159,8 +159,11 @@ void TextHandler::loadAniFile(Common::String filename, int32 skipSize, int lengt
error("Missing file - %s", filename.c_str());
assert(skipSize + length <= f.size());
free(_vm->_curAnim);
_vm->_curAnim = (byte *)malloc(sizeof(byte) * length);
f.seek(skipSize);
f.read(&_vm->_mem[(kAdrAni * 16)], length);
f.read(_vm->_curAnim, length);
f.close();
}

View File

@ -33,8 +33,6 @@
namespace Mortevielle {
class MortevielleEngine;
const int kAdrAni = 0x7314;
class TextHandler {
private:
MortevielleEngine *_vm;

View File

@ -2581,12 +2581,12 @@ void MortevielleEngine::adzon() {
* @remarks Originally called 'animof'
*/
int MortevielleEngine::getAnimOffset(int frameNum, int animNum) {
int animCount = _mem[(kAdrAni * 16) + 1];
int animCount = _curAnim[1];
int aux = animNum;
if (frameNum != 1)
aux += animCount;
return (animCount << 2) + 2 + READ_BE_UINT16(&_mem[(kAdrAni * 16) + (aux << 1)]);
return (animCount << 2) + 2 + READ_BE_UINT16(&_curAnim[aux << 1]);
}
/**
@ -2969,7 +2969,7 @@ void MortevielleEngine::displayAnimFrame(int frameNum, int animId) {
int offset = getAnimOffset(frameNum, animId);
GfxSurface surface;
surface.decode(&_mem[(kAdrAni * 16) + offset]);
surface.decode(&_curAnim[offset]);
_screenSurface.drawPicture(surface, 0, 12);
prepareScreenType1();