HOPKINS: Remove setParent() from Globals

This commit is contained in:
Strangerke 2013-03-20 07:27:42 +01:00
parent d9b596ad18
commit 852e65bd02
18 changed files with 1756 additions and 1758 deletions

View File

@ -86,7 +86,7 @@ void AnimationManager::playAnim(const Common::String &filename, uint32 rate1, ui
}
if (_vm->_graphicsManager.WinScan / 2 > SCREEN_WIDTH) {
hasScreenCopy = true;
screenCopy = _vm->_globals.allocMemory(307200);
screenCopy = _vm->_globals->allocMemory(307200);
memcpy(screenCopy, screenP, 307200);
}
if (NO_SEQ) {
@ -109,7 +109,7 @@ void AnimationManager::playAnim(const Common::String &filename, uint32 rate1, ui
_vm->_eventsManager->_escKeyFl = false;
_vm->_soundManager.loadAnimSound();
if (_vm->_globals.iRegul == 1) {
if (_vm->_globals->iRegul == 1) {
// Do pre-animation delay
do {
if (_vm->_eventsManager->_escKeyFl)
@ -136,7 +136,7 @@ void AnimationManager::playAnim(const Common::String &filename, uint32 rate1, ui
f.read(screenP, READ_LE_UINT32(imageStr + 8));
if (_vm->_globals.iRegul == 1) {
if (_vm->_globals->iRegul == 1) {
do {
if (_vm->_eventsManager->_escKeyFl)
break;
@ -166,7 +166,7 @@ void AnimationManager::playAnim(const Common::String &filename, uint32 rate1, ui
}
}
if (_vm->_globals.iRegul == 1 && !_vm->_eventsManager->_escKeyFl) {
if (_vm->_globals->iRegul == 1 && !_vm->_eventsManager->_escKeyFl) {
// Do post-animation delay
do {
if (_vm->_eventsManager->_escKeyFl)
@ -183,7 +183,7 @@ void AnimationManager::playAnim(const Common::String &filename, uint32 rate1, ui
}
if (_vm->_graphicsManager.FADE_LINUX == 2 && !hasScreenCopy) {
screenCopy = _vm->_globals.allocMemory(307200);
screenCopy = _vm->_globals->allocMemory(307200);
f.seek(6);
f.read(_vm->_graphicsManager._palette, 800);
@ -208,12 +208,12 @@ void AnimationManager::playAnim(const Common::String &filename, uint32 rate1, ui
_vm->_graphicsManager.copyWinscanVbe3(screenP, screenCopy);
}
_vm->_graphicsManager.fadeOutDefaultLength(screenCopy);
screenCopy = _vm->_globals.freeMemory(screenCopy);
screenCopy = _vm->_globals->freeMemory(screenCopy);
}
if (hasScreenCopy) {
if (_vm->_graphicsManager.FADE_LINUX == 2)
_vm->_graphicsManager.fadeOutDefaultLength(screenCopy);
screenCopy = _vm->_globals.freeMemory(screenCopy);
screenCopy = _vm->_globals->freeMemory(screenCopy);
}
_vm->_graphicsManager.FADE_LINUX = 0;
@ -272,7 +272,7 @@ void AnimationManager::playAnim2(const Common::String &filename, uint32 rate1, u
_vm->_graphicsManager._maxX = SCREEN_WIDTH;
if (_vm->_graphicsManager.WinScan / 2 > SCREEN_WIDTH) {
hasScreenCopy = true;
screenCopy = _vm->_globals.allocMemory(307200);
screenCopy = _vm->_globals->allocMemory(307200);
memcpy(screenCopy, screenP, 307200);
}
if (NO_SEQ) {
@ -295,7 +295,7 @@ void AnimationManager::playAnim2(const Common::String &filename, uint32 rate1, u
_vm->_eventsManager->_rateCounter = 0;
_vm->_eventsManager->_escKeyFl = false;
_vm->_soundManager.loadAnimSound();
if (_vm->_globals.iRegul == 1) {
if (_vm->_globals->iRegul == 1) {
while (!_vm->_eventsManager->_escKeyFl && _vm->_eventsManager->_rateCounter < rate1) {
_vm->_eventsManager->refreshEvents();
}
@ -320,7 +320,7 @@ void AnimationManager::playAnim2(const Common::String &filename, uint32 rate1, u
break;
f.read(screenP, READ_LE_UINT32(imageStr + 8));
if (_vm->_globals.iRegul == 1) {
if (_vm->_globals->iRegul == 1) {
while (!_vm->_eventsManager->_escKeyFl && _vm->_eventsManager->_rateCounter < rate2) {
_vm->_eventsManager->refreshEvents();
_vm->_soundManager.checkSoundEnd();
@ -344,7 +344,7 @@ void AnimationManager::playAnim2(const Common::String &filename, uint32 rate1, u
_vm->_soundManager.checkSoundEnd();
}
if (_vm->_globals.iRegul == 1) {
if (_vm->_globals->iRegul == 1) {
while (!_vm->_eventsManager->_escKeyFl && _vm->_eventsManager->_rateCounter < rate3) {
_vm->_eventsManager->refreshEvents();
_vm->_soundManager.checkSoundEnd();
@ -362,7 +362,7 @@ void AnimationManager::playAnim2(const Common::String &filename, uint32 rate1, u
size_t nbytes = f.readUint32LE();
f.skip(14);
f.read(screenP, nbytes);
byte *ptra = _vm->_globals.allocMemory(307200);
byte *ptra = _vm->_globals->allocMemory(307200);
memcpy(ptra, screenP, 307200);
for (;;) {
@ -379,12 +379,12 @@ void AnimationManager::playAnim2(const Common::String &filename, uint32 rate1, u
_vm->_graphicsManager.copyWinscanVbe3(screenP, ptra);
}
_vm->_graphicsManager.fadeOutDefaultLength(ptra);
ptra = _vm->_globals.freeMemory(ptra);
ptra = _vm->_globals->freeMemory(ptra);
}
if (hasScreenCopy) {
if (_vm->_graphicsManager.FADE_LINUX == 2)
_vm->_graphicsManager.fadeOutDefaultLength(screenCopy);
_vm->_globals.freeMemory(screenCopy);
_vm->_globals->freeMemory(screenCopy);
}
_vm->_graphicsManager.FADE_LINUX = 0;
@ -467,14 +467,14 @@ void AnimationManager::loadAnim(const Common::String &animName) {
}
}
byte *data = _vm->_globals.allocMemory(nbytes + 1);
byte *data = _vm->_globals->allocMemory(nbytes + 1);
f.read(data, nbytes);
f.close();
for (int idx = 1; idx <= 20; ++idx)
searchAnim(data, idx, nbytes);
_vm->_globals.freeMemory(data);
_vm->_globals->freeMemory(data);
}
/**
@ -482,15 +482,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;
_vm->_globals->_animBqe[idx]._data = _vm->_globals->freeMemory(_vm->_globals->_animBqe[idx]._data);
_vm->_globals->_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;
_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;
}
}
@ -499,24 +499,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;
_vm->_globals->Bank[idx]._loadedFl = true;
_vm->_globals->Bank[idx]._filename = filename;
byte *fileDataPtr = _vm->_fileManager->loadFile(filename);
_vm->_globals.Bank[idx]._fileHeader = 0;
_vm->_globals->Bank[idx]._fileHeader = 0;
if (fileDataPtr[1] == 'L' && fileDataPtr[2] == 'E')
_vm->_globals.Bank[idx]._fileHeader = 1;
_vm->_globals->Bank[idx]._fileHeader = 1;
else if (fileDataPtr[1] == 'O' && fileDataPtr[2] == 'R')
_vm->_globals.Bank[idx]._fileHeader = 2;
_vm->_globals->Bank[idx]._fileHeader = 2;
if (!_vm->_globals.Bank[idx]._fileHeader) {
_vm->_globals.freeMemory(fileDataPtr);
_vm->_globals.Bank[idx]._loadedFl = false;
if (!_vm->_globals->Bank[idx]._fileHeader) {
_vm->_globals->freeMemory(fileDataPtr);
_vm->_globals->Bank[idx]._loadedFl = false;
result = -1;
}
_vm->_globals.Bank[idx]._data = fileDataPtr;
_vm->_globals->Bank[idx]._data = fileDataPtr;
int objectDataIdx = 0;
for(objectDataIdx = 0; objectDataIdx <= 249; objectDataIdx++) {
@ -527,13 +527,13 @@ int AnimationManager::loadSpriteBank(int idx, const Common::String &filename) {
}
if (objectDataIdx > 249) {
_vm->_globals.freeMemory(fileDataPtr);
_vm->_globals.Bank[idx]._loadedFl = false;
_vm->_globals->freeMemory(fileDataPtr);
_vm->_globals->Bank[idx]._loadedFl = false;
result = -2;
}
_vm->_globals.Bank[idx]._objDataIdx = objectDataIdx;
_vm->_globals->Bank[idx]._objDataIdx = objectDataIdx;
Common::String ofsFilename = _vm->_globals.Bank[idx]._filename;
Common::String ofsFilename = _vm->_globals->Bank[idx]._filename;
char ch;
do {
ch = ofsFilename.lastChar();
@ -545,18 +545,18 @@ 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 < _vm->_globals->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(_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->_globals.freeMemory(ofsData);
_vm->_globals->freeMemory(ofsData);
result = 0;
}
@ -578,18 +578,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;
_vm->_globals->_animBqe[animIndex]._enabledFl = false;
_vm->_globals->_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);
_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);
byte *dataP = _vm->_globals._animBqe[animIndex]._data;
byte *dataP = _vm->_globals->_animBqe[animIndex]._data;
int curDestDataIndx = 20;
int curSrcDataIndx = dataIdx + 25;
@ -642,7 +642,7 @@ void AnimationManager::playSequence(const Common::String &file, uint32 rate1, ui
byte *screenCopy = NULL;
if (_vm->_graphicsManager.WinScan / 2 > SCREEN_WIDTH) {
hasScreenCopy = true;
screenCopy = _vm->_globals.allocMemory(307200);
screenCopy = _vm->_globals->allocMemory(307200);
memcpy(screenCopy, screenP, 307200);
}
if (NO_SEQ) {
@ -671,7 +671,7 @@ void AnimationManager::playSequence(const Common::String &file, uint32 rate1, ui
_vm->_eventsManager->_rateCounter = 0;
_vm->_eventsManager->_escKeyFl = false;
_vm->_soundManager.loadAnimSound();
if (_vm->_globals.iRegul == 1) {
if (_vm->_globals->iRegul == 1) {
do {
if (_vm->shouldQuit() || (_vm->_eventsManager->_escKeyFl && !skipEscFl)) {
skipFl = true;
@ -689,7 +689,7 @@ void AnimationManager::playSequence(const Common::String &file, uint32 rate1, ui
_vm->_eventsManager->_rateCounter = 0;
_vm->_eventsManager->_escKeyFl = false;
_vm->_soundManager.loadAnimSound();
if (_vm->_globals.iRegul == 1) {
if (_vm->_globals->iRegul == 1) {
do {
if (_vm->shouldQuit() || (_vm->_eventsManager->_escKeyFl && !skipEscFl)) {
skipFl = true;
@ -717,7 +717,7 @@ void AnimationManager::playSequence(const Common::String &file, uint32 rate1, ui
break;
f.read(screenP, READ_LE_UINT32(imageStr + 8));
if (_vm->_globals.iRegul == 1) {
if (_vm->_globals->iRegul == 1) {
do {
if (_vm->shouldQuit() || (_vm->_eventsManager->_escKeyFl && !skipEscFl)) {
skipFl = true;
@ -751,7 +751,7 @@ void AnimationManager::playSequence(const Common::String &file, uint32 rate1, ui
}
}
if (_vm->_globals.iRegul == 1 && !skipFl) {
if (_vm->_globals->iRegul == 1 && !skipFl) {
do {
if (_vm->shouldQuit() || (_vm->_eventsManager->_escKeyFl && !skipEscFl)) {
skipFl = true;
@ -777,7 +777,7 @@ void AnimationManager::playSequence(const Common::String &file, uint32 rate1, ui
_vm->_eventsManager->_mouseFl = true;
}
if (hasScreenCopy)
_vm->_globals.freeMemory(screenCopy);
_vm->_globals->freeMemory(screenCopy);
}
/**
@ -809,7 +809,7 @@ void AnimationManager::playSequence2(const Common::String &file, uint32 rate1, u
if (_vm->_graphicsManager.WinScan / 2 > SCREEN_WIDTH) {
multiScreenFl = true;
screenCopy = _vm->_globals.allocMemory(307200);
screenCopy = _vm->_globals->allocMemory(307200);
memcpy((void *)screenCopy, screenP, 307200);
}
if (NO_SEQ) {
@ -833,7 +833,7 @@ void AnimationManager::playSequence2(const Common::String &file, uint32 rate1, u
_vm->_eventsManager->_rateCounter = 0;
_vm->_eventsManager->_escKeyFl = false;
_vm->_soundManager.loadAnimSound();
if (_vm->_globals.iRegul == 1) {
if (_vm->_globals->iRegul == 1) {
do {
_vm->_eventsManager->refreshEvents();
_vm->_soundManager.checkSoundEnd();
@ -857,7 +857,7 @@ void AnimationManager::playSequence2(const Common::String &file, uint32 rate1, u
break;
f.read(screenP, READ_LE_UINT32(imageStr + 8));
if (_vm->_globals.iRegul == 1) {
if (_vm->_globals->iRegul == 1) {
do {
_vm->_eventsManager->refreshEvents();
} while (!_vm->shouldQuit() && !_vm->_eventsManager->_escKeyFl && _vm->_eventsManager->_rateCounter < rate2);
@ -881,7 +881,7 @@ void AnimationManager::playSequence2(const Common::String &file, uint32 rate1, u
}
}
if (_vm->_globals.iRegul == 1) {
if (_vm->_globals->iRegul == 1) {
// Wait for third rate delay
do {
_vm->_eventsManager->refreshEvents();
@ -892,7 +892,7 @@ void AnimationManager::playSequence2(const Common::String &file, uint32 rate1, u
_vm->_eventsManager->_rateCounter = 0;
if (_vm->_graphicsManager.FADE_LINUX == 2 && !multiScreenFl) {
byte *ptra = _vm->_globals.allocMemory(307200);
byte *ptra = _vm->_globals->allocMemory(307200);
f.seek(6);
f.read(_vm->_graphicsManager._palette, 800);
@ -916,12 +916,12 @@ void AnimationManager::playSequence2(const Common::String &file, uint32 rate1, u
_vm->_graphicsManager.copyWinscanVbe(screenP, ptra);
}
_vm->_graphicsManager.fadeOutDefaultLength(ptra);
ptra = _vm->_globals.freeMemory(ptra);
ptra = _vm->_globals->freeMemory(ptra);
}
if (multiScreenFl) {
if (_vm->_graphicsManager.FADE_LINUX == 2)
_vm->_graphicsManager.fadeOutDefaultLength(screenCopy);
_vm->_globals.freeMemory(screenCopy);
_vm->_globals->freeMemory(screenCopy);
}
_vm->_graphicsManager.FADE_LINUX = 0;

View File

@ -77,7 +77,7 @@ void ComputerManager::setTextMode() {
_vm->_graphicsManager.unlockScreen();
_vm->_graphicsManager._lineNbr = SCREEN_WIDTH;
_vm->_fontManager->_font = _vm->_globals.freeMemory(_vm->_fontManager->_font);
_vm->_fontManager->_font = _vm->_globals->freeMemory(_vm->_fontManager->_font);
Common::String filename = "STFONT.SPR";
Common::File f;
@ -253,7 +253,7 @@ void ComputerManager::showComputer(ComputerEnum mode) {
break;
case '6':
readText(10);
_vm->_globals._saveData->_data[svField270] = 4;
_vm->_globals->_saveData->_data[svField270] = 4;
break;
}
}
@ -281,9 +281,9 @@ void ComputerManager::showComputer(ComputerEnum mode) {
}
if (mode == COMPUTER_HOPKINS)
_vm->_globals._exitId = 13;
_vm->_globals->_exitId = 13;
else // Free access or Samantha
_vm->_globals._exitId = 14;
_vm->_globals->_exitId = 14;
_vm->_graphicsManager.resetDirtyRects();
}
@ -354,14 +354,14 @@ void ComputerManager::loadMenu() {
char *ptr;
if (_vm->_fileManager->fileExists("COMPUTAN.TXT")) {
ptr = (char *)_vm->_fileManager->loadFile("COMPUTAN.TXT");
} else if (_vm->_globals._language == LANG_FR) {
ptr = (char *)_vm->_globals.allocMemory(sizeof(_frenchText));
} else if (_vm->_globals->_language == LANG_FR) {
ptr = (char *)_vm->_globals->allocMemory(sizeof(_frenchText));
strcpy(ptr, _frenchText);
} else if (_vm->_globals._language == LANG_SP) {
ptr = (char *)_vm->_globals.allocMemory(sizeof(_spanishText));
} else if (_vm->_globals->_language == LANG_SP) {
ptr = (char *)_vm->_globals->allocMemory(sizeof(_spanishText));
strcpy(ptr, _spanishText);
} else {
ptr = (char *)_vm->_globals.allocMemory(sizeof(_englishText));
ptr = (char *)_vm->_globals->allocMemory(sizeof(_englishText));
strcpy(ptr, _englishText);
}
@ -392,7 +392,7 @@ void ComputerManager::loadMenu() {
}
++tmpPtr;
} while (!loopCond);
_vm->_globals.freeMemory((byte *)ptr);
_vm->_globals->freeMemory((byte *)ptr);
}
void ComputerManager::displayMessage(int xp, int yp, int textIdx) {
@ -467,7 +467,7 @@ void ComputerManager::outText2(const Common::String &msg) {
* Restores the scene for the FBI headquarters room
*/
void ComputerManager::restoreFBIRoom() {
_vm->_globals.freeMemory(_vm->_fontManager->_font);
_vm->_globals->freeMemory(_vm->_fontManager->_font);
_vm->_fontManager->_font = _vm->_fileManager->loadFile("FONTE3.SPR");
_vm->_fontManager->_fontFixedWidth = 12;
_vm->_fontManager->_fontFixedHeight = 21;
@ -482,11 +482,11 @@ void ComputerManager::readText(int idx) {
_vm->_eventsManager->_escKeyFl = false;
Common::String filename;
if (_vm->_globals._language == LANG_EN)
if (_vm->_globals->_language == LANG_EN)
filename = "THOPKAN.TXT";
else if (_vm->_globals._language == LANG_FR)
else if (_vm->_globals->_language == LANG_FR)
filename = "THOPK.TXT";
else if (_vm->_globals._language == LANG_SP)
else if (_vm->_globals->_language == LANG_SP)
filename = "THOPKES.TXT";
byte *ptr = _vm->_fileManager->loadFile(filename);
@ -523,7 +523,7 @@ void ComputerManager::readText(int idx) {
} while (curChar != '%');
_vm->_eventsManager->waitKeyPress();
ptr = _vm->_globals.freeMemory(ptr);
ptr = _vm->_globals->freeMemory(ptr);
}
/**
@ -531,9 +531,9 @@ void ComputerManager::readText(int idx) {
*/
void ComputerManager::displayGamesSubMenu() {
const byte *oldSpriteData = _vm->_objectsManager._sprite[0]._spriteData;
uint oldSpeed = _vm->_globals._speed;
uint oldSpeed = _vm->_globals->_speed;
_vm->_globals._speed = 1;
_vm->_globals->_speed = 1;
_vm->_eventsManager->changeMouseCursor(0);
_breakoutSpr = g_PTRNUL;
_vm->_eventsManager->_breakoutFl = true;
@ -560,14 +560,14 @@ void ComputerManager::displayGamesSubMenu() {
playBreakout();
_vm->_graphicsManager.resetDirtyRects();
_breakoutSpr = _vm->_globals.freeMemory(_breakoutSpr);
_breakoutLevel = (int16 *)_vm->_globals.freeMemory((byte *)_breakoutLevel);
_breakoutSpr = _vm->_globals->freeMemory(_breakoutSpr);
_breakoutLevel = (int16 *)_vm->_globals->freeMemory((byte *)_breakoutLevel);
_vm->_objectsManager._sprite[0]._spriteData = oldSpriteData;
_vm->_soundManager.removeSample(1);
_vm->_soundManager.removeSample(2);
_vm->_soundManager.removeSample(3);
_vm->_globals._speed = oldSpeed;
_vm->_globals->_speed = oldSpeed;
_vm->_eventsManager->_breakoutFl = false;
setVideoMode();
setTextColor(15);
@ -581,7 +581,7 @@ void ComputerManager::displayGamesSubMenu() {
* Load Highscore from file
*/
void ComputerManager::loadHiscore() {
byte *ptr = _vm->_globals.allocMemory(100);
byte *ptr = _vm->_globals->allocMemory(100);
_vm->_saveLoadManager.load("HISCORE.DAT", ptr);
for (int scoreIndex = 0; scoreIndex < 6; ++scoreIndex) {
@ -600,7 +600,7 @@ void ComputerManager::loadHiscore() {
}
}
_vm->_globals.freeMemory(ptr);
_vm->_globals->freeMemory(ptr);
_breakoutHiscore = atol(_score[5]._score.c_str());
}
@ -626,7 +626,7 @@ void ComputerManager::newLevel() {
_breakoutLives = 11;
_vm->_graphicsManager.loadVgaImage("CASSEF.PCX");
displayLives();
_breakoutLevel = (int16 *)_vm->_globals.freeMemory((byte *)_breakoutLevel);
_breakoutLevel = (int16 *)_vm->_globals->freeMemory((byte *)_breakoutLevel);
++_breakoutLevelNbr;
Common::String file;
@ -850,7 +850,7 @@ int ComputerManager::displayHiscores() {
_vm->_eventsManager->mouseOff();
_vm->_graphicsManager.fadeOutBreakout();
_vm->_globals.freeMemory(ptr);
_vm->_globals->freeMemory(ptr);
return buttonIndex;
}
@ -893,7 +893,7 @@ void ComputerManager::getScoreName() {
_score[5]._score.setChar(score[i], scorePos--);
}
_vm->_graphicsManager.fadeOutBreakout();
_vm->_globals.freeMemory(ptr);
_vm->_globals->freeMemory(ptr);
saveScore();
}
@ -970,7 +970,7 @@ void ComputerManager::saveScore() {
}
}
byte *ptr = _vm->_globals.allocMemory(100);
byte *ptr = _vm->_globals->allocMemory(100);
memset(ptr, 0, 99);
for (int scorePlaceIdx = 0; scorePlaceIdx <= 5; scorePlaceIdx++) {
int curBufPtr = 16 * scorePlaceIdx;
@ -993,7 +993,7 @@ void ComputerManager::saveScore() {
}
_vm->_saveLoadManager.saveFile("HISCORE.DAT", ptr, 100);
_vm->_globals.freeMemory(ptr);
_vm->_globals->freeMemory(ptr);
}
/**

View File

@ -50,8 +50,8 @@ DialogsManager::DialogsManager(HopkinsEngine *vm) {
}
DialogsManager::~DialogsManager() {
_vm->_globals.freeMemory(_inventWin1);
_vm->_globals.freeMemory(_inventoryIcons);
_vm->_globals->freeMemory(_inventWin1);
_vm->_globals->freeMemory(_inventoryIcons);
}
void DialogsManager::showOptionsDialog() {
@ -61,16 +61,16 @@ void DialogsManager::showOptionsDialog() {
if (_vm->getPlatform() == Common::kPlatformOS2 || _vm->getPlatform() == Common::kPlatformBeOS)
filename = "OPTION.SPR";
else {
if (_vm->_globals._language == LANG_FR)
if (_vm->_globals->_language == LANG_FR)
filename = "OPTIFR.SPR";
else if (_vm->_globals._language == LANG_EN)
else if (_vm->_globals->_language == LANG_EN)
filename = "OPTIAN.SPR";
else if (_vm->_globals._language == LANG_SP)
else if (_vm->_globals->_language == LANG_SP)
filename = "OPTIES.SPR";
}
_vm->_globals._optionDialogSpr = _vm->_fileManager->loadFile(filename);
_vm->_globals._optionDialogFl = true;
_vm->_globals->_optionDialogSpr = _vm->_fileManager->loadFile(filename);
_vm->_globals->_optionDialogFl = true;
int scrollOffset = _vm->_graphicsManager._scrollOffset;
bool doneFlag = false;
@ -190,7 +190,7 @@ void DialogsManager::showOptionsDialog() {
}
if (mousePos.x >= scrollOffset + 175 && mousePos.y > 285 && mousePos.x <= scrollOffset + 281 && mousePos.y <= 310) {
_vm->_globals._exitId = 300;
_vm->_globals->_exitId = 300;
doneFlag = true;
}
if (mousePos.x >= scrollOffset + 355 && mousePos.y > 285 && mousePos.x <= scrollOffset + 490 && mousePos.y <= 310)
@ -235,63 +235,63 @@ void DialogsManager::showOptionsDialog() {
// Values are blocked, thus handling the zone is useless
//if (mousePos.x >= _vm->_graphicsManager.ofscroll + 348 && mousePos.y > 248 && mousePos.x <= _vm->_graphicsManager.ofscroll + 394 && mousePos.y <= 273)
// _vm->_globals._speed = 2;
// _vm->_globals->_speed = 2;
if ( mousePos.x < scrollOffset + 165 || mousePos.x > scrollOffset + 496
|| mousePos.y < 107 || mousePos.y > 318)
doneFlag = true;
}
if (_vm->_globals._speed == 1)
_vm->_globals._menuSpeed = 6;
else if (_vm->_globals._speed == 2)
_vm->_globals._menuSpeed = 5;
else if (_vm->_globals._speed == 3)
_vm->_globals._menuSpeed = 4;
if (_vm->_globals->_speed == 1)
_vm->_globals->_menuSpeed = 6;
else if (_vm->_globals->_speed == 2)
_vm->_globals->_menuSpeed = 5;
else if (_vm->_globals->_speed == 3)
_vm->_globals->_menuSpeed = 4;
_vm->_globals._menuTextOff = !_vm->_soundManager._textOffFl ? 7 : 8;
_vm->_globals._menuVoiceOff = !_vm->_soundManager._voiceOffFl ? 7 : 8;
_vm->_globals._menuSoundOff = !_vm->_soundManager._soundOffFl ? 7 : 8;
_vm->_globals._menuMusicOff = !_vm->_soundManager._musicOffFl ? 7 : 8;
_vm->_globals->_menuTextOff = !_vm->_soundManager._textOffFl ? 7 : 8;
_vm->_globals->_menuVoiceOff = !_vm->_soundManager._voiceOffFl ? 7 : 8;
_vm->_globals->_menuSoundOff = !_vm->_soundManager._soundOffFl ? 7 : 8;
_vm->_globals->_menuMusicOff = !_vm->_soundManager._musicOffFl ? 7 : 8;
_vm->_globals._menuDisplayType = 9;
_vm->_globals->_menuDisplayType = 9;
switch (_vm->_graphicsManager._scrollSpeed) {
case 1:
_vm->_globals._menuScrollSpeed = 12;
_vm->_globals->_menuScrollSpeed = 12;
break;
case 2:
_vm->_globals._menuScrollSpeed = 13;
_vm->_globals->_menuScrollSpeed = 13;
break;
case 4:
_vm->_globals._menuScrollSpeed = 14;
_vm->_globals->_menuScrollSpeed = 14;
break;
case 8:
_vm->_globals._menuScrollSpeed = 15;
_vm->_globals->_menuScrollSpeed = 15;
break;
case 16:
_vm->_globals._menuScrollSpeed = 16;
_vm->_globals->_menuScrollSpeed = 16;
break;
case 32:
_vm->_globals._menuScrollSpeed = 17;
_vm->_globals->_menuScrollSpeed = 17;
break;
case 48:
_vm->_globals._menuScrollSpeed = 18;
_vm->_globals->_menuScrollSpeed = 18;
break;
case 64:
_vm->_globals._menuScrollSpeed = 19;
_vm->_globals->_menuScrollSpeed = 19;
break;
case 128:
_vm->_globals._menuScrollSpeed = 20;
_vm->_globals->_menuScrollSpeed = 20;
break;
case 160:
_vm->_globals._menuScrollSpeed = 21;
_vm->_globals->_menuScrollSpeed = 21;
break;
case 320:
_vm->_globals._menuScrollSpeed = 22;
_vm->_globals->_menuScrollSpeed = 22;
break;
case 640:
_vm->_globals._menuScrollSpeed = 23;
_vm->_globals->_menuScrollSpeed = 23;
break;
}
@ -302,12 +302,12 @@ void DialogsManager::showOptionsDialog() {
107, 335, 215, _vm->_graphicsManager._vesaBuffer, scrollOffset + 164, 107);
_vm->_graphicsManager.addDirtyRect(scrollOffset + 164, 107, scrollOffset + 498, 320);
_vm->_globals._optionDialogSpr = _vm->_globals.freeMemory(_vm->_globals._optionDialogSpr);
_vm->_globals._optionDialogFl = false;
_vm->_globals->_optionDialogSpr = _vm->_globals->freeMemory(_vm->_globals->_optionDialogSpr);
_vm->_globals->_optionDialogFl = false;
}
void DialogsManager::showInventory() {
if (_removeInventFl || _inventDisplayedFl || _vm->_globals._disableInventFl)
if (_removeInventFl || _inventDisplayedFl || _vm->_globals->_disableInventFl)
return;
_vm->_graphicsManager._scrollStatus = 1;
@ -326,14 +326,14 @@ void DialogsManager::showInventory() {
loopFl = false;
_vm->_eventsManager->_curMouseButton = 0;
_vm->_eventsManager->_mouseButton = 0;
_vm->_globals._disableInventFl = true;
_vm->_globals->_disableInventFl = true;
_vm->_graphicsManager.SETCOLOR4(251, 100, 100, 100);
Common::String filename;
if (_vm->getPlatform() == Common::kPlatformOS2 || _vm->getPlatform() == Common::kPlatformBeOS)
filename = "INVENT.SPR";
else {
switch (_vm->_globals._language) {
switch (_vm->_globals->_language) {
case LANG_EN:
filename = "INVENTAN.SPR";
break;
@ -351,7 +351,7 @@ void DialogsManager::showInventory() {
error("Error opening file - %s", filename.c_str());
size_t filesize = f.size();
_inventWin1 = _vm->_globals.allocMemory(filesize);
_inventWin1 = _vm->_globals->allocMemory(filesize);
_vm->_fileManager->readStream(f, _inventWin1, filesize);
f.close();
@ -369,13 +369,13 @@ void DialogsManager::showInventory() {
int curPosX = 0;
for (int inventCol = 1; inventCol <= 6; inventCol++) {
++inventCount;
int inventIdx = _vm->_globals._inventory[inventCount];
int inventIdx = _vm->_globals->_inventory[inventCount];
// The last two zones are not reserved for the inventory: Options and Save/Load
if (inventIdx && inventCount <= 29) {
byte *obj = _vm->_objectsManager.loadObjectFromFile(inventIdx, false);
_vm->_graphicsManager.restoreSurfaceRect(_vm->_graphicsManager._vesaBuffer, obj, _inventX + curPosX + 6,
curPosY + 120, _vm->_globals._objectWidth, _vm->_globals._objectHeight);
_vm->_globals.freeMemory(obj);
curPosY + 120, _vm->_globals->_objectWidth, _vm->_globals->_objectHeight);
_vm->_globals->freeMemory(obj);
}
curPosX += 54;
};
@ -407,32 +407,32 @@ void DialogsManager::showInventory() {
if (mouseButton == 1) {
if (_vm->_eventsManager->_mouseCursorId == 1 || _vm->_eventsManager->_mouseCursorId == 2 || _vm->_eventsManager->_mouseCursorId == 3 || _vm->_eventsManager->_mouseCursorId == 16 || !_vm->_eventsManager->_mouseCursorId)
break;
_vm->_objectsManager.takeInventoryObject(_vm->_globals._inventory[newInventoryItem]);
_vm->_objectsManager.takeInventoryObject(_vm->_globals->_inventory[newInventoryItem]);
if (_vm->_eventsManager->_mouseCursorId == 8)
break;
_vm->_scriptManager._tempObjectFl = true;
_vm->_globals._saveData->_data[svLastObjectIndex] = _vm->_objectsManager._curObjectIndex;
_vm->_globals._saveData->_data[svLastInventoryItem] = _vm->_globals._inventory[newInventoryItem];
_vm->_globals._saveData->_data[svLastInvMouseCursor] = _vm->_eventsManager->_mouseCursorId;
_vm->_globals->_saveData->_data[svLastObjectIndex] = _vm->_objectsManager._curObjectIndex;
_vm->_globals->_saveData->_data[svLastInventoryItem] = _vm->_globals->_inventory[newInventoryItem];
_vm->_globals->_saveData->_data[svLastInvMouseCursor] = _vm->_eventsManager->_mouseCursorId;
_vm->_objectsManager.OPTI_OBJET();
_vm->_scriptManager._tempObjectFl = false;
if (_vm->_soundManager._voiceOffFl) {
do
_vm->_eventsManager->refreshScreenAndEvents();
while (!_vm->_globals._exitId && _vm->_eventsManager->getMouseButton() != 1);
while (!_vm->_globals->_exitId && _vm->_eventsManager->getMouseButton() != 1);
_vm->_fontManager->hideText(9);
}
if (_vm->_globals._exitId) {
if (_vm->_globals._exitId == 2) {
_vm->_globals._exitId = 0;
if (_vm->_globals->_exitId) {
if (_vm->_globals->_exitId == 2) {
_vm->_globals->_exitId = 0;
break;
}
_vm->_globals._exitId = 0;
_inventBuf2 = _vm->_globals.freeMemory(_inventBuf2);
_inventWin1 = _vm->_globals.freeMemory(_inventWin1);
_vm->_globals->_exitId = 0;
_inventBuf2 = _vm->_globals->freeMemory(_inventBuf2);
_inventWin1 = _vm->_globals->freeMemory(_inventWin1);
loopFl = true;
break;
} else
@ -441,7 +441,7 @@ void DialogsManager::showInventory() {
if (_removeInventFl)
break;
_vm->_eventsManager->refreshScreenAndEvents();
if (_vm->_globals._screenId >= 35 && _vm->_globals._screenId <= 40)
if (_vm->_globals->_screenId >= 35 && _vm->_globals->_screenId <= 40)
_vm->_objectsManager.handleSpecialGames();
}
} while (loopFl);
@ -454,8 +454,8 @@ void DialogsManager::showInventory() {
_vm->_objectsManager.BOBTOUS = true;
}
_inventWin1 = _vm->_globals.freeMemory(_inventWin1);
_inventBuf2 = _vm->_globals.freeMemory(_inventBuf2);
_inventWin1 = _vm->_globals->freeMemory(_inventWin1);
_inventBuf2 = _vm->_globals->freeMemory(_inventBuf2);
if (_vm->_eventsManager->_mouseCursorId == 1)
showOptionsDialog();
@ -468,7 +468,7 @@ void DialogsManager::showInventory() {
_vm->_eventsManager->changeMouseCursor(4);
_vm->_objectsManager._oldBorderPos = Common::Point(0, 0);
_vm->_objectsManager._borderPos = Common::Point(0, 0);
_vm->_globals._disableInventFl = false;
_vm->_globals->_disableInventFl = false;
_vm->_graphicsManager._scrollStatus = 0;
}
@ -476,7 +476,7 @@ void DialogsManager::showInventory() {
* Inventory Animations
*/
void DialogsManager::inventAnim() {
if (_vm->_globals._disableInventFl)
if (_vm->_globals->_disableInventFl)
return;
if (_vm->_objectsManager._eraseVisibleCounter && !_vm->_objectsManager._visibleFl) {
@ -499,20 +499,20 @@ void DialogsManager::inventAnim() {
_vm->_objectsManager._oldInventoryPosX = newOffset;
}
if (_vm->_globals._saveData->_data[svField357] == 1) {
if (_vm->_globals._saveData->_data[svField353] == 1)
if (_vm->_globals->_saveData->_data[svField357] == 1) {
if (_vm->_globals->_saveData->_data[svField353] == 1)
_vm->_graphicsManager.Affiche_Perfect(_vm->_graphicsManager._vesaBuffer, _vm->_objectsManager._headSprites, 832, 325, 0, 0, 0, false);
if (_vm->_globals._saveData->_data[svField355] == 1)
if (_vm->_globals->_saveData->_data[svField355] == 1)
_vm->_graphicsManager.Affiche_Perfect(_vm->_graphicsManager._vesaBuffer, _vm->_objectsManager._headSprites, 866, 325, 1, 0, 0, false);
_vm->_graphicsManager.addDirtyRect(532, 25, 560, 60);
_vm->_graphicsManager.addDirtyRect(566, 25, 594, 60);
}
if (_vm->_globals._saveData->_data[svField356] == 1) {
if (_vm->_globals->_saveData->_data[svField356] == 1) {
_vm->_graphicsManager.Affiche_Perfect(_vm->_graphicsManager._vesaBuffer, _vm->_objectsManager._headSprites, 832, 325, 0, 0, 0, false);
_vm->_graphicsManager.addDirtyRect(532, 25, 560, 60);
}
if (_vm->_globals._saveData->_data[svField354] == 1) {
if (_vm->_globals->_saveData->_data[svField354] == 1) {
_vm->_graphicsManager.Affiche_Perfect(_vm->_graphicsManager._vesaBuffer, _vm->_objectsManager._headSprites, 832, 325, 0, 0, 0, false);
_vm->_graphicsManager.addDirtyRect(532, 25, 560, 60);
}
@ -522,7 +522,7 @@ void DialogsManager::inventAnim() {
* Test dialog opening
*/
void DialogsManager::testDialogOpening() {
if (_vm->_globals._cityMapEnabledFl)
if (_vm->_globals->_cityMapEnabledFl)
_vm->_eventsManager->_gameKey = KEY_NONE;
if ((_vm->_eventsManager->_gameKey == KEY_NONE) || _inventFl)
@ -575,8 +575,8 @@ void DialogsManager::showLoadGame() {
_vm->_graphicsManager.copySurface(_vm->_graphicsManager._vesaScreen, _vm->_eventsManager->_startPos.x + 183, 60, 274, 353, _vm->_graphicsManager._vesaBuffer, _vm->_eventsManager->_startPos.x + 183, 60);
_vm->_graphicsManager.addDirtyRect(_vm->_eventsManager->_startPos.x + 183, 60, 457, 413);
_vm->_objectsManager.BOBTOUS = true;
_vm->_objectsManager._saveLoadSprite = _vm->_globals.freeMemory(_vm->_objectsManager._saveLoadSprite);
_vm->_objectsManager._saveLoadSprite2 = _vm->_globals.freeMemory(_vm->_objectsManager._saveLoadSprite2);
_vm->_objectsManager._saveLoadSprite = _vm->_globals->freeMemory(_vm->_objectsManager._saveLoadSprite);
_vm->_objectsManager._saveLoadSprite2 = _vm->_globals->freeMemory(_vm->_objectsManager._saveLoadSprite2);
_vm->_objectsManager._saveLoadX = 0;
_vm->_objectsManager._saveLoadY = 0;
@ -604,8 +604,8 @@ void DialogsManager::showSaveGame() {
_vm->_graphicsManager.copySurface(_vm->_graphicsManager._vesaScreen, _vm->_eventsManager->_startPos.x + 183, 60, 274, 353, _vm->_graphicsManager._vesaBuffer, _vm->_eventsManager->_startPos.x + 183, 60);
_vm->_graphicsManager.addDirtyRect(_vm->_eventsManager->_startPos.x + 183, 60, _vm->_eventsManager->_startPos.x + 457, 413);
_vm->_objectsManager.BOBTOUS = true;
_vm->_objectsManager._saveLoadSprite = _vm->_globals.freeMemory(_vm->_objectsManager._saveLoadSprite);
_vm->_objectsManager._saveLoadSprite2 = _vm->_globals.freeMemory(_vm->_objectsManager._saveLoadSprite2);
_vm->_objectsManager._saveLoadSprite = _vm->_globals->freeMemory(_vm->_objectsManager._saveLoadSprite);
_vm->_objectsManager._saveLoadSprite2 = _vm->_globals->freeMemory(_vm->_objectsManager._saveLoadSprite2);
_vm->_objectsManager._saveLoadX = 0;
_vm->_objectsManager._saveLoadY = 0;
@ -627,7 +627,7 @@ void DialogsManager::showSaveLoad(SaveLoadMode mode) {
if (_vm->getPlatform() == Common::kPlatformOS2 || _vm->getPlatform() == Common::kPlatformBeOS)
filename = "SAVE.SPR";
else {
switch (_vm->_globals._language) {
switch (_vm->_globals->_language) {
case LANG_EN:
filename = "SAVEAN.SPR";
break;
@ -644,7 +644,7 @@ void DialogsManager::showSaveLoad(SaveLoadMode mode) {
_vm->_objectsManager._saveLoadSprite2 = _vm->_objectsManager.loadSprite("SAVE2.SPR");
_vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager._vesaBuffer, _vm->_objectsManager._saveLoadSprite, _vm->_eventsManager->_startPos.x + 483, 360, 0);
if (_vm->_globals._language == LANG_FR) {
if (_vm->_globals->_language == LANG_FR) {
if (mode == MODE_SAVE)
_vm->_graphicsManager.Sprite_Vesa(_vm->_graphicsManager._vesaBuffer, _vm->_objectsManager._saveLoadSprite, _vm->_eventsManager->_startPos.x + 525, 375, 1);
else if (mode == MODE_LOAD)

View File

@ -59,8 +59,8 @@ EventsManager::EventsManager(HopkinsEngine *vm) {
}
EventsManager::~EventsManager() {
_vm->_globals.freeMemory(_objectBuf);
_vm->_globals.freeMemory(_mouseCursor);
_vm->_globals->freeMemory(_objectBuf);
_vm->_globals->freeMemory(_mouseCursor);
}
void EventsManager::initMouseData() {
@ -77,7 +77,7 @@ void EventsManager::initMouseData() {
_mouseSizeY = 20;
}
switch (_vm->_globals._language) {
switch (_vm->_globals->_language) {
case LANG_EN:
if (!_mouseLinuxFl)
_mouseCursor = _vm->_fileManager->loadFile("SOUAN.SPR");
@ -185,7 +185,7 @@ void EventsManager::changeMouseCursor(int id) {
if (_mouseCursorId == 23)
return;
if (id == 4 && _mouseCursorId == 4 && _vm->_globals._freezeCharacterFl)
if (id == 4 && _mouseCursorId == 4 && _vm->_globals->_freezeCharacterFl)
cursorId = 0;
if (cursorId == 25)
cursorId = 5;
@ -364,8 +364,8 @@ void EventsManager::refreshScreenAndEvents() {
width = _mouseSizeX;
height = _mouseSizeY;
if (_mouseCursorId == 23) {
width = _vm->_globals._objectWidth;
height = _vm->_globals._objectHeight;
width = _vm->_globals->_objectWidth;
height = _vm->_globals->_objectHeight;
} else {
if (_breakoutFl) {
if (xp < _vm->_graphicsManager._minX)
@ -392,7 +392,7 @@ void EventsManager::refreshScreenAndEvents() {
}
}
if (!_vm->_globals._linuxEndDemoFl)
if (!_vm->_globals->_linuxEndDemoFl)
_vm->_objectsManager.displaySprite();
if (!_mouseFl) {
updateCursor();
@ -411,14 +411,14 @@ void EventsManager::refreshScreenAndEvents() {
_vm->_graphicsManager.addDirtyRect(xp, yp, right, bottom);
}
_vm->_globals._speed = 2;
_vm->_globals->_speed = 2;
bool externalLoopFl = false;
do {
while (!_vm->shouldQuit()) {
checkForNextFrameCounter();
bool innerLoopFl = false;
while (_breakoutFl || _vm->_globals.iRegul != 1) {
while (_breakoutFl || _vm->_globals->iRegul != 1) {
checkForNextFrameCounter();
if (!_breakoutFl) {
@ -430,7 +430,7 @@ void EventsManager::refreshScreenAndEvents() {
break;
}
}
if (innerLoopFl || _vm->_globals._speed != 2)
if (innerLoopFl || _vm->_globals->_speed != 2)
break;
if (externalLoopFl ||_rateCounter > 9) {
externalLoopFl = true;
@ -439,8 +439,8 @@ void EventsManager::refreshScreenAndEvents() {
}
if (externalLoopFl)
break;
} while (!_vm->shouldQuit() && _vm->_globals.iRegul == 3 && _rateCounter <= 15);
_vm->_globals._speed = 2;
} while (!_vm->shouldQuit() && _vm->_globals->iRegul == 3 && _rateCounter <= 15);
_vm->_globals->_speed = 2;
_rateCounter = 0;
if (!_vm->_graphicsManager._largeScreenFl || _vm->_graphicsManager._scrollStatus == 1) {
_vm->_graphicsManager.displayDirtyRects();
@ -487,14 +487,14 @@ void EventsManager::updateCursor() {
Common::Rect clipBounds(_vm->_graphicsManager._minX, _vm->_graphicsManager._minY,
_vm->_graphicsManager._maxX, _vm->_graphicsManager._maxY);
_vm->_graphicsManager._minX = _vm->_graphicsManager._minY = 0;
_vm->_graphicsManager._maxX = _vm->_globals._objectWidth;
_vm->_graphicsManager._maxY = _vm->_globals._objectHeight;
_vm->_graphicsManager._maxX = _vm->_globals->_objectWidth;
_vm->_graphicsManager._maxY = _vm->_globals->_objectHeight;
int pitch = _vm->_graphicsManager._lineNbr2;
_vm->_graphicsManager._lineNbr2 = _vm->_globals._objectWidth;
_vm->_graphicsManager._lineNbr2 = _vm->_globals->_objectWidth;
// Create the temporary cursor surface
byte *cursorSurface = new byte[_vm->_globals._objectHeight * _vm->_globals._objectWidth];
Common::fill(cursorSurface, cursorSurface + _vm->_globals._objectHeight * _vm->_globals._objectWidth, 0);
byte *cursorSurface = new byte[_vm->_globals->_objectHeight * _vm->_globals->_objectWidth];
Common::fill(cursorSurface, cursorSurface + _vm->_globals->_objectHeight * _vm->_globals->_objectWidth, 0);
if (_mouseCursorId != 23) {
// Draw standard cursor
@ -530,7 +530,7 @@ void EventsManager::updateCursor() {
// Set the ScummVM cursor from the surface
CursorMan.replaceCursorPalette(cursorPalette, 0, PALETTE_SIZE - 1);
CursorMan.replaceCursor(cursorSurface, _vm->_globals._objectWidth, _vm->_globals._objectHeight,
CursorMan.replaceCursor(cursorSurface, _vm->_globals->_objectWidth, _vm->_globals->_objectHeight,
xOffset, 0, 0, true);
// Delete the cursor surface and palette

View File

@ -47,7 +47,7 @@ byte *FileManager::loadFile(const Common::String &file) {
// Allocate space for the file contents
size_t filesize = f.size();
byte *data = _vm->_globals.allocMemory(filesize);
byte *data = _vm->_globals->allocMemory(filesize);
if (!data)
error("Error allocating space for file being loaded - %s", file.c_str());
@ -68,16 +68,16 @@ int FileManager::readStream(Common::ReadStream &stream, void *buf, size_t nbytes
* Initialize censorship based on blood.dat file
*/
void FileManager::initCensorship() {
_vm->_globals._censorshipFl = false;
_vm->_globals->_censorshipFl = false;
// If file doesn't exist, fallback to uncensored
if (fileExists("BLOOD.DAT")) {
char *data = (char *)loadFile("BLOOD.DAT");
if ((data[6] == 'u' && data[7] == 'k') || (data[6] == 'U' && data[7] == 'K'))
_vm->_globals._censorshipFl = true;
_vm->_globals->_censorshipFl = true;
_vm->_globals.freeMemory((byte *)data);
_vm->_globals->freeMemory((byte *)data);
}
}
@ -169,7 +169,7 @@ byte *FileManager::searchCat(const Common::String &file, CatMode mode) {
tmpFilename = "ENG_VOI.CAT";
// Win95 and Linux versions uses another set of names
else {
switch (_vm->_globals._language) {
switch (_vm->_globals->_language) {
case LANG_EN:
tmpFilename = "RES_VAN.CAT";
break;
@ -204,32 +204,32 @@ byte *FileManager::searchCat(const Common::String &file, CatMode mode) {
if (name == filename) {
// Found entry for file, so get it's details from the catalogue entry
const byte *pData = ptr + offsetVal;
_vm->_globals._catalogPos = READ_LE_UINT32(pData + 15);
_vm->_globals._catalogSize = READ_LE_UINT32(pData + 19);
_vm->_globals->_catalogPos = READ_LE_UINT32(pData + 15);
_vm->_globals->_catalogSize = READ_LE_UINT32(pData + 19);
matchFlag = true;
}
if (name == "FINIS") {
_vm->_globals.freeMemory(ptr);
_vm->_globals->freeMemory(ptr);
return g_PTRNUL;
}
offsetVal += 23;
}
_vm->_globals.freeMemory(ptr);
_vm->_globals->freeMemory(ptr);
if (secondaryFilename != "") {
if (!f.open(secondaryFilename))
error("CHARGE_FICHIER");
f.seek(_vm->_globals._catalogPos);
f.seek(_vm->_globals->_catalogPos);
byte *catData = _vm->_globals.allocMemory(_vm->_globals._catalogSize);
byte *catData = _vm->_globals->allocMemory(_vm->_globals->_catalogSize);
if (catData == g_PTRNUL)
error("CHARGE_FICHIER");
readStream(f, catData, _vm->_globals._catalogSize);
readStream(f, catData, _vm->_globals->_catalogSize);
f.close();
result = catData;
} else {

View File

@ -40,12 +40,12 @@ FontManager::FontManager(HopkinsEngine *vm) {
}
FontManager::~FontManager() {
_vm->_globals.freeMemory(_font);
_vm->_globals.freeMemory(_zoneText);
_vm->_globals->freeMemory(_font);
_vm->_globals->freeMemory(_zoneText);
}
void FontManager::loadZoneText() {
switch (_vm->_globals._language) {
switch (_vm->_globals->_language) {
case LANG_EN:
_zoneText = _vm->_fileManager->loadFile("ZONEAN.TXT");
break;
@ -103,7 +103,7 @@ void FontManager::showText(int idx) {
txt._textOnFl = true;
txt._textLoadedFl = false;
txt._textBlock = _vm->_globals.freeMemory(txt._textBlock);
txt._textBlock = _vm->_globals->freeMemory(txt._textBlock);
}
/**
@ -116,7 +116,7 @@ void FontManager::hideText(int idx) {
TxtItem &txt = _text[idx - 5];
txt._textOnFl = false;
txt._textLoadedFl = false;
txt._textBlock = _vm->_globals.freeMemory(txt._textBlock);
txt._textBlock = _vm->_globals->freeMemory(txt._textBlock);
}
/**
@ -160,7 +160,7 @@ void FontManager::box(int idx, int messageId, const Common::String &filename, in
error("Bad number for text");
_fontFixedWidth = 11;
_vm->_globals._boxWidth = 11 * _text[idx]._length;
_vm->_globals->_boxWidth = 11 * _text[idx]._length;
if (_text[idx]._textLoadedFl) {
int textType = _text[idx]._textType;
if (textType != 6 && textType != 1 && textType != 3 && textType != 5) {
@ -211,7 +211,7 @@ void FontManager::box(int idx, int messageId, const Common::String &filename, in
bufSize = 2048;
f.seek(_index[messageId]);
_tempText = _vm->_globals.allocMemory(2058);
_tempText = _vm->_globals->allocMemory(2058);
if (_tempText == g_PTRNUL)
error("Error allocating text");
@ -220,7 +220,7 @@ void FontManager::box(int idx, int messageId, const Common::String &filename, in
f.close();
} else {
bufSize = 100;
_tempText = _vm->_globals.allocMemory(110);
_tempText = _vm->_globals->allocMemory(110);
Common::fill(&_tempText[0], &_tempText[110], 0);
memcpy(_tempText, _zoneText + _index[messageId], 96);
WRITE_LE_UINT16((uint16 *)_tempText + 48, READ_LE_INT16(_zoneText + _index[messageId] + 96));
@ -254,29 +254,29 @@ void FontManager::box(int idx, int messageId, const Common::String &filename, in
if (bufSize && bufSize > textLength) {
_text[idx]._length = textLength;
_vm->_globals._boxWidth = 0;
_vm->_globals->_boxWidth = 0;
for (int curStrIdx = 0; curStrIdx < textLength + 1; curStrIdx++) {
byte curChar = _tempText[curStrIdx];
if (curChar <= 31)
curChar = ' ';
_vm->_globals._boxWidth += _vm->_objectsManager.getWidth(_font, curChar - 32);
_vm->_globals->_boxWidth += _vm->_objectsManager.getWidth(_font, curChar - 32);
}
_vm->_globals._boxWidth += 2;
_text[idx]._pos.x = 320 - abs(_vm->_globals._boxWidth / 2);
_vm->_globals->_boxWidth += 2;
_text[idx]._pos.x = 320 - abs(_vm->_globals->_boxWidth / 2);
textPosX = _vm->_eventsManager->_startPos.x + _text[idx]._pos.x;
lineCount = 1;
_text[idx]._lines[0] = Common::String((const char *)_tempText, textLength);
} else {
if (!_vm->_globals._boxWidth)
_vm->_globals._boxWidth = 240;
if (!_vm->_globals->_boxWidth)
_vm->_globals->_boxWidth = 240;
int tempTextIdx = 0;
int lineSize;
byte curChar;
do {
int curLineSize = 0;
int ptrb = _vm->_globals._boxWidth - 4;
int ptrb = _vm->_globals->_boxWidth - 4;
for (;;) {
lineSize = curLineSize;
do
@ -330,12 +330,12 @@ void FontManager::box(int idx, int messageId, const Common::String &filename, in
for (int i = 0; i <= 19; i++) {
if (_textSortArray[i])
_vm->_globals._boxWidth = _textSortArray[i];
_vm->_globals->_boxWidth = _textSortArray[i];
}
if ((_text[idx]._textType < 2) || (_text[idx]._textType > 3)) {
int i;
for (i = xp - _vm->_eventsManager->_startPos.x; _vm->_globals._boxWidth + i > 638 && i > -2 && _text[idx]._textType; i -= 2)
for (i = xp - _vm->_eventsManager->_startPos.x; _vm->_globals->_boxWidth + i > 638 && i > -2 && _text[idx]._textType; i -= 2)
;
_text[idx]._pos.x = i;
textPosX = _vm->_eventsManager->_startPos.x + i;
@ -345,7 +345,7 @@ void FontManager::box(int idx, int messageId, const Common::String &filename, in
}
int posX = textPosX;
int posY = yp;
int saveWidth = _vm->_globals._boxWidth + 10;
int saveWidth = _vm->_globals->_boxWidth + 10;
int saveHeight = (_fontFixedHeight + 1) * lineCount + 12;
if (_text[idx]._textType == 6) {
_text[idx]._pos.x = 315 - abs(saveWidth / 2);
@ -355,14 +355,14 @@ void FontManager::box(int idx, int messageId, const Common::String &filename, in
int textType = _text[idx]._textType;
if (textType == 1 || textType == 3 || textType == 5 || textType == 6) {
int size = saveHeight * saveWidth;
byte *ptrd = _vm->_globals.allocMemory(size);
byte *ptrd = _vm->_globals->allocMemory(size);
if (ptrd == g_PTRNUL)
error("Cutting a block for text box (%d)", size);
_vm->_graphicsManager.copySurfaceRect(_vm->_graphicsManager._vesaBuffer, ptrd, posX, posY, saveWidth, saveHeight);
_vm->_graphicsManager.Trans_bloc2(ptrd, _vm->_graphicsManager._colorTable, size);
_vm->_graphicsManager.restoreSurfaceRect(_vm->_graphicsManager._vesaBuffer, ptrd, posX, posY, saveWidth, saveHeight);
_vm->_globals.freeMemory(ptrd);
_vm->_globals->freeMemory(ptrd);
_vm->_graphicsManager.drawHorizontalLine(_vm->_graphicsManager._vesaBuffer, posX, posY, saveWidth, (byte)-2);
_vm->_graphicsManager.drawHorizontalLine(_vm->_graphicsManager._vesaBuffer, posX, saveHeight + posY, saveWidth, (byte)-2);
@ -384,9 +384,9 @@ void FontManager::box(int idx, int messageId, const Common::String &filename, in
_text[idx]._height = blockHeight;
textType = _text[idx]._textType;
if (textType == 6 || textType == 1 || textType == 3 || textType == 5) {
_text[idx]._textBlock = _vm->_globals.freeMemory(_text[idx]._textBlock);
_text[idx]._textBlock = _vm->_globals->freeMemory(_text[idx]._textBlock);
int blockSize = blockHeight * blockWidth;
byte *ptre = _vm->_globals.allocMemory(blockSize + 20);
byte *ptre = _vm->_globals->allocMemory(blockSize + 20);
if (ptre == g_PTRNUL)
error("Cutting a block for text box (%d)", blockSize);
@ -395,7 +395,7 @@ void FontManager::box(int idx, int messageId, const Common::String &filename, in
_text[idx]._height = blockHeight;
_vm->_graphicsManager.copySurfaceRect(_vm->_graphicsManager._vesaBuffer, _text[idx]._textBlock, posX, posY, _text[idx]._width, blockHeight);
}
_tempText = _vm->_globals.freeMemory(_tempText);
_tempText = _vm->_globals->freeMemory(_tempText);
}
}
@ -478,12 +478,12 @@ void FontManager::renderTextDisplay(int xp, int yp, const Common::String &msg, i
charEndPosX += charWidth;
_vm->_graphicsManager.addDirtyRect(charStartPosX, yp, charEndPosX, yp + 12);
if (_vm->_eventsManager->_escKeyFl) {
_vm->_globals.iRegul = 1;
_vm->_globals->iRegul = 1;
_vm->_eventsManager->refreshScreenAndEvents();
} else {
_vm->_globals.iRegul = 4;
_vm->_globals->iRegul = 4;
_vm->_eventsManager->refreshScreenAndEvents();
_vm->_globals.iRegul = 1;
_vm->_globals->iRegul = 1;
}
}
curChar = *srcP++;

View File

@ -62,7 +62,9 @@ const int HOPKINS_PERSO_2[] = {
0, 2, 0, 2, 0, 2, 0, 1, 0, 2, 0, 2
};
Globals::Globals() {
Globals::Globals(HopkinsEngine *vm) {
_vm = vm;
// Set up the special g_PTRNUL variable
g_PTRNUL = (byte *)malloc(16);
strcpy((char *)g_PTRNUL, "POINTERNULL");
@ -187,10 +189,6 @@ Globals::~Globals() {
free(g_PTRNUL);
}
void Globals::setParent(HopkinsEngine *vm) {
_vm = vm;
}
void Globals::setConfig() {
// CHECKME: Should be in Globals() but it doesn't work
// The Polish version is a translation of the English version. The filenames are the same.

View File

@ -314,9 +314,8 @@ public:
int Compteur;
int compteur_71;
Globals();
Globals(HopkinsEngine *vm);
~Globals();
void setParent(HopkinsEngine *vm);
byte *allocMemory(int count);
byte *freeMemory(byte *p);
void setConfig();

View File

@ -78,9 +78,9 @@ GraphicsManager::GraphicsManager() {
}
GraphicsManager::~GraphicsManager() {
_vm->_globals.freeMemory(_vesaScreen);
_vm->_globals.freeMemory(_vesaBuffer);
_vm->_globals.freeMemory(_screenBuffer);
_vm->_globals->freeMemory(_vesaScreen);
_vm->_globals->freeMemory(_vesaBuffer);
_vm->_globals->freeMemory(_screenBuffer);
}
void GraphicsManager::setParent(HopkinsEngine *vm) {
@ -105,9 +105,9 @@ void GraphicsManager::setGraphicalMode(int width, int height) {
initGraphics(width, height, true, &pixelFormat16);
// Init surfaces
_vesaScreen = _vm->_globals.allocMemory(SCREEN_WIDTH * 2 * SCREEN_HEIGHT);
_vesaBuffer = _vm->_globals.allocMemory(SCREEN_WIDTH * 2 * SCREEN_HEIGHT);
_screenBuffer = _vm->_globals.allocMemory(SCREEN_WIDTH * 2 * SCREEN_HEIGHT);
_vesaScreen = _vm->_globals->allocMemory(SCREEN_WIDTH * 2 * SCREEN_HEIGHT);
_vesaBuffer = _vm->_globals->allocMemory(SCREEN_WIDTH * 2 * SCREEN_HEIGHT);
_screenBuffer = _vm->_globals->allocMemory(SCREEN_WIDTH * 2 * SCREEN_HEIGHT);
_videoPtr = NULL;
_screenWidth = width;
@ -312,7 +312,7 @@ void GraphicsManager::loadPCX640(byte *surface, const Common::String &file, byte
// Load PCX from within the PIC resource
if (!f.open("PIC.RES"))
error("Error opening PIC.RES.");
f.seek(_vm->_globals._catalogPos);
f.seek(_vm->_globals->_catalogPos);
} else {
// Load stand alone PCX file
if (!f.open(file))
@ -345,7 +345,7 @@ void GraphicsManager::loadPCX320(byte *surface, const Common::String &file, byte
f.read(surface, 128);
int imageSize = filesize - 896;
byte *ptr = _vm->_globals.allocMemory(65024);
byte *ptr = _vm->_globals->allocMemory(65024);
size_t curBufSize;
int imageNumb;
int imageDataSize;
@ -396,7 +396,7 @@ void GraphicsManager::loadPCX320(byte *surface, const Common::String &file, byte
f.read(palette, 768);
f.close();
_vm->_globals.freeMemory(ptr);
_vm->_globals->freeMemory(ptr);
}
// Clear Palette
@ -1063,7 +1063,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->_globals->_animBqe[idx]._enabledFl)
_vm->_objectsManager.hideBob(idx);
}
@ -1071,22 +1071,22 @@ void GraphicsManager::endDisplayBob() {
_vm->_eventsManager->refreshScreenAndEvents();
for (int idx = 1; idx <= 20; ++idx) {
if (_vm->_globals._animBqe[idx]._enabledFl)
if (_vm->_globals->_animBqe[idx]._enabledFl)
_vm->_objectsManager.resetBob(idx);
}
for (int idx = 1; idx <= 29; ++idx) {
_vm->_globals._lockedAnims[idx]._enableFl = false;
_vm->_globals->_lockedAnims[idx]._enableFl = false;
}
for (int idx = 1; idx <= 20; ++idx) {
_vm->_globals._animBqe[idx]._enabledFl = false;
_vm->_globals->_animBqe[idx]._enabledFl = false;
}
}
void GraphicsManager::displayAllBob() {
for (int idx = 1; idx <= 20; ++idx) {
if (_vm->_globals._animBqe[idx]._enabledFl)
if (_vm->_globals->_animBqe[idx]._enabledFl)
_vm->_objectsManager.displayBob(idx);
}
}
@ -1747,13 +1747,13 @@ void GraphicsManager::initScreen(const Common::String &file, int mode, bool init
}
if (!mode) {
filename = file + ".spr";
_vm->_globals.SPRITE_ECRAN = _vm->_globals.freeMemory(_vm->_globals.SPRITE_ECRAN);
_vm->_globals->SPRITE_ECRAN = _vm->_globals->freeMemory(_vm->_globals->SPRITE_ECRAN);
if (initializeScreen) {
_vm->_globals.SPRITE_ECRAN = _vm->_fileManager->searchCat(filename, RES_SLI);
if (_vm->_globals.SPRITE_ECRAN) {
_vm->_globals.SPRITE_ECRAN = _vm->_fileManager->loadFile(filename);
_vm->_globals->SPRITE_ECRAN = _vm->_fileManager->searchCat(filename, RES_SLI);
if (_vm->_globals->SPRITE_ECRAN) {
_vm->_globals->SPRITE_ECRAN = _vm->_fileManager->loadFile(filename);
} else {
_vm->_globals.SPRITE_ECRAN = _vm->_fileManager->loadFile("RES_SLI.RES");
_vm->_globals->SPRITE_ECRAN = _vm->_fileManager->loadFile("RES_SLI.RES");
}
}
}
@ -1780,15 +1780,15 @@ void GraphicsManager::initScreen(const Common::String &file, int mode, bool init
doneFlag = true;
} while (!doneFlag);
}
_vm->_globals.freeMemory(ptr);
_vm->_globals._answerBuffer = _vm->_globals.freeMemory(_vm->_globals._answerBuffer);
_vm->_globals->freeMemory(ptr);
_vm->_globals->_answerBuffer = _vm->_globals->freeMemory(_vm->_globals->_answerBuffer);
filename = file + ".rep";
byte *dataP = _vm->_fileManager->searchCat(filename, RES_REP);
if (dataP == g_PTRNUL)
dataP = _vm->_fileManager->loadFile(filename);
_vm->_globals._answerBuffer = dataP;
_vm->_globals->_answerBuffer = dataP;
_vm->_objectsManager._forceZoneFl = true;
_vm->_objectsManager._changeVerbFl = false;
}

File diff suppressed because it is too large Load Diff

View File

@ -149,8 +149,8 @@ public:
EventsManager *_eventsManager;
FileManager *_fileManager;
FontManager *_fontManager;
Globals *_globals;
Globals _globals;
GraphicsManager _graphicsManager;
LinesManager _linesManager;
MenuManager _menuManager;

View File

@ -94,10 +94,10 @@ LinesManager::LinesManager() {
}
LinesManager::~LinesManager() {
_vm->_globals.freeMemory(_largeBuf);
_vm->_globals.freeMemory((byte *) _testRoute0);
_vm->_globals.freeMemory((byte *) _testRoute1);
_vm->_globals.freeMemory((byte *) _testRoute2);
_vm->_globals->freeMemory(_largeBuf);
_vm->_globals->freeMemory((byte *) _testRoute0);
_vm->_globals->freeMemory((byte *) _testRoute1);
_vm->_globals->freeMemory((byte *) _testRoute2);
}
void LinesManager::setParent(HopkinsEngine *vm) {
@ -121,7 +121,7 @@ void LinesManager::loadLines(const Common::String &file) {
READ_LE_INT16((uint16 *)ptr + (idx * 5) + 4));
}
initRoute();
_vm->_globals.freeMemory(ptr);
_vm->_globals->freeMemory(ptr);
}
/**
@ -199,7 +199,7 @@ void LinesManager::addZoneLine(int idx, int fromX, int fromY, int destX, int des
BOBZONE[bobZoneIdx] = fromY;
} else {
assert (idx <= MAX_LINES);
_zoneLine[idx]._zoneData = (int16 *)_vm->_globals.freeMemory((byte *)_zoneLine[idx]._zoneData);
_zoneLine[idx]._zoneData = (int16 *)_vm->_globals->freeMemory((byte *)_zoneLine[idx]._zoneData);
int distX = abs(fromX - destX);
int distY = abs(fromY - destY);
@ -209,7 +209,7 @@ void LinesManager::addZoneLine(int idx, int fromX, int fromY, int destX, int des
else
maxDist += distX;
zoneData = (int16 *)_vm->_globals.allocMemory(2 * sizeof(int16) * maxDist + (4 * sizeof(int16)));
zoneData = (int16 *)_vm->_globals->allocMemory(2 * sizeof(int16) * maxDist + (4 * sizeof(int16)));
assert(zoneData != (int16 *)g_PTRNUL);
_zoneLine[idx]._zoneData = zoneData;
@ -247,14 +247,14 @@ void LinesManager::addLine(int lineIdx, Directions direction, int fromX, int fro
if (_linesNumb < lineIdx)
_linesNumb = lineIdx;
_lineItem[lineIdx]._lineData = (int16 *)_vm->_globals.freeMemory((byte *)_lineItem[lineIdx]._lineData);
_lineItem[lineIdx]._lineData = (int16 *)_vm->_globals->freeMemory((byte *)_lineItem[lineIdx]._lineData);
int distX = abs(fromX - destX) + 1;
int distY = abs(fromY - destY) + 1;
int maxDist = distY;
if (distX > maxDist)
maxDist = distX;
byte *zoneData = _vm->_globals.allocMemory(4 * maxDist + 8);
byte *zoneData = _vm->_globals->allocMemory(4 * maxDist + 8);
assert (zoneData != g_PTRNUL);
Common::fill(zoneData, zoneData + 4 * maxDist + 8, 0);
@ -935,7 +935,7 @@ int LinesManager::GENIAL(int lineIdx, int dataIdx, int fromX, int fromY, int des
break;
lineIdxDown = foundLineIdx;
if (_vm->_globals._characterMaxPosY <= curY || maxLineY <= curY)
if (_vm->_globals->_characterMaxPosY <= curY || maxLineY <= curY)
break;
}
int curX = destX;
@ -1081,23 +1081,23 @@ RouteItem *LinesManager::PARCOURS2(int fromX, int fromY, int destX, int destY) {
Directions newDir = DIR_NONE;
if (destY <= 24)
clipDestY = 25;
if (!_vm->_globals._checkDistanceFl) {
if (abs(fromX - _vm->_globals._oldRouteFromX) <= 4 && abs(fromY - _vm->_globals._oldRouteFromY) <= 4 &&
abs(_vm->_globals._oldRouteDestX - destX) <= 4 && abs(_vm->_globals._oldRouteDestY - clipDestY) <= 4)
if (!_vm->_globals->_checkDistanceFl) {
if (abs(fromX - _vm->_globals->_oldRouteFromX) <= 4 && abs(fromY - _vm->_globals->_oldRouteFromY) <= 4 &&
abs(_vm->_globals->_oldRouteDestX - destX) <= 4 && abs(_vm->_globals->_oldRouteDestY - clipDestY) <= 4)
return (RouteItem *)g_PTRNUL;
if (abs(fromX - destX) <= 4 && abs(fromY - clipDestY) <= 4)
return (RouteItem *)g_PTRNUL;
if (_vm->_globals._oldZoneNum > 0 && _vm->_objectsManager._zoneNum > 0 && _vm->_globals._oldZoneNum == _vm->_objectsManager._zoneNum)
if (_vm->_globals->_oldZoneNum > 0 && _vm->_objectsManager._zoneNum > 0 && _vm->_globals->_oldZoneNum == _vm->_objectsManager._zoneNum)
return (RouteItem *)g_PTRNUL;
}
_vm->_globals._checkDistanceFl = false;
_vm->_globals._oldZoneNum = _vm->_objectsManager._zoneNum;
_vm->_globals._oldRouteFromX = fromX;
_vm->_globals._oldRouteDestX = destX;
_vm->_globals._oldRouteFromY = fromY;
_vm->_globals._oldRouteDestY = clipDestY;
_vm->_globals->_checkDistanceFl = false;
_vm->_globals->_oldZoneNum = _vm->_objectsManager._zoneNum;
_vm->_globals->_oldRouteFromX = fromX;
_vm->_globals->_oldRouteDestX = destX;
_vm->_globals->_oldRouteFromY = fromY;
_vm->_globals->_oldRouteDestY = clipDestY;
_pathFindingMaxDepth = 0;
int routeIdx = 0;
if (destX <= 19)
@ -1106,8 +1106,8 @@ RouteItem *LinesManager::PARCOURS2(int fromX, int fromY, int destX, int destY) {
clipDestY = 20;
if (clipDestX > _vm->_graphicsManager._maxX - 10)
clipDestX = _vm->_graphicsManager._maxX - 10;
if (clipDestY > _vm->_globals._characterMaxPosY)
clipDestY = _vm->_globals._characterMaxPosY;
if (clipDestY > _vm->_globals->_characterMaxPosY)
clipDestY = _vm->_globals->_characterMaxPosY;
if (abs(fromX - clipDestX) <= 3 && abs(fromY - clipDestY) <= 3)
return (RouteItem *)g_PTRNUL;
@ -2196,9 +2196,9 @@ bool LinesManager::makeSmoothMove(int fromX, int fromY, int destX, int destY) {
int smoothIdx = 0;
int stepCount = 0;
while (curX > destX && destY > curY) {
int realSpeedX = _vm->_globals._hopkinsItem[hopkinsIdx]._speedX;
int realSpeedY = _vm->_globals._hopkinsItem[hopkinsIdx]._speedY;
int spriteSize = _vm->_globals._spriteSize[curY];
int realSpeedX = _vm->_globals->_hopkinsItem[hopkinsIdx]._speedX;
int realSpeedY = _vm->_globals->_hopkinsItem[hopkinsIdx]._speedY;
int spriteSize = _vm->_globals->_spriteSize[curY];
if (spriteSize < 0) {
realSpeedX = _vm->_graphicsManager.zoomOut(realSpeedX, -spriteSize);
realSpeedY = _vm->_graphicsManager.zoomOut(realSpeedY, -spriteSize);
@ -2230,9 +2230,9 @@ bool LinesManager::makeSmoothMove(int fromX, int fromY, int destX, int destY) {
int smoothIdx = 0;
int stepCount = 0;
while (curX < destX && destY > curY) {
int realSpeedX = _vm->_globals._hopkinsItem[hopkinsIdx]._speedX;
int realSpeedY = _vm->_globals._hopkinsItem[hopkinsIdx]._speedY;
int spriteSize = _vm->_globals._spriteSize[curY];
int realSpeedX = _vm->_globals->_hopkinsItem[hopkinsIdx]._speedX;
int realSpeedY = _vm->_globals->_hopkinsItem[hopkinsIdx]._speedY;
int spriteSize = _vm->_globals->_spriteSize[curY];
if (spriteSize < 0) {
realSpeedX = _vm->_graphicsManager.zoomOut(realSpeedX, -spriteSize);
realSpeedY = _vm->_graphicsManager.zoomOut(realSpeedY, -spriteSize);
@ -2264,8 +2264,8 @@ bool LinesManager::makeSmoothMove(int fromX, int fromY, int destX, int destY) {
int smoothIdx = 0;
int stepCount = 0;
while (curX > destX && destY < curY) {
int realSpeedX = _vm->_graphicsManager.zoomOut(_vm->_globals._hopkinsItem[hopkinsIdx]._speedX, 25);
int realSpeedY = _vm->_graphicsManager.zoomOut(_vm->_globals._hopkinsItem[hopkinsIdx]._speedY, 25);
int realSpeedX = _vm->_graphicsManager.zoomOut(_vm->_globals->_hopkinsItem[hopkinsIdx]._speedX, 25);
int realSpeedY = _vm->_graphicsManager.zoomOut(_vm->_globals->_hopkinsItem[hopkinsIdx]._speedY, 25);
int oldY = curY;
for (int i = 0; i < realSpeedX; i++) {
--curX;
@ -2292,8 +2292,8 @@ bool LinesManager::makeSmoothMove(int fromX, int fromY, int destX, int destY) {
int stepCount = 0;
while (curX < destX && destY < curY) {
int oldY = curY;
int realSpeedX = _vm->_graphicsManager.zoomOut(_vm->_globals._hopkinsItem[hopkinsIdx]._speedX, 25);
int realSpeedY = _vm->_graphicsManager.zoomOut(_vm->_globals._hopkinsItem[hopkinsIdx]._speedY, 25);
int realSpeedX = _vm->_graphicsManager.zoomOut(_vm->_globals->_hopkinsItem[hopkinsIdx]._speedX, 25);
int realSpeedY = _vm->_graphicsManager.zoomOut(_vm->_globals->_hopkinsItem[hopkinsIdx]._speedY, 25);
for (int i = 0; i < realSpeedX; i++) {
++curX;
_smoothRoute[smoothIdx]._posX = curX;
@ -2460,12 +2460,12 @@ int LinesManager::testLine(int paramX, int paramY, int *a3, int *foundLineIdx, i
}
int LinesManager::CALC_PROPRE(int idx) {
int size = _vm->_globals._spriteSize[idx];
if (_vm->_globals._characterType == 1) {
int size = _vm->_globals->_spriteSize[idx];
if (_vm->_globals->_characterType == 1) {
if (size < 0)
size = -size;
size = 20 * (5 * size - 100) / -80;
} else if (_vm->_globals._characterType == 2) {
} else if (_vm->_globals->_characterType == 2) {
if (size < 0)
size = -size;
size = 20 * (5 * size - 165) / -67;
@ -2748,7 +2748,7 @@ void LinesManager::clearAll() {
if (!_testRoute2)
_testRoute2 = (RouteItem*)g_PTRNUL;
_largeBuf = _vm->_globals.allocMemory(10000);
_largeBuf = _vm->_globals->allocMemory(10000);
_lineBuf = (int16 *)(_largeBuf);
}
@ -2765,7 +2765,7 @@ void LinesManager::clearAllZones() {
*/
void LinesManager::removeZoneLine(int idx) {
assert (idx <= MAX_LINES);
_zoneLine[idx]._zoneData = (int16 *)_vm->_globals.freeMemory((byte *)_zoneLine[idx]._zoneData);
_zoneLine[idx]._zoneData = (int16 *)_vm->_globals->freeMemory((byte *)_zoneLine[idx]._zoneData);
}
void LinesManager::resetLines() {
@ -2780,7 +2780,7 @@ void LinesManager::resetLines() {
void LinesManager::removeLine(int idx) {
if (idx > MAX_LINES)
error("Attempting to add a line obstacle > MAX_LIGNE.");
_lineItem[idx]._lineData = (int16 *)_vm->_globals.freeMemory((byte *)_lineItem[idx]._lineData);
_lineItem[idx]._lineData = (int16 *)_vm->_globals->freeMemory((byte *)_lineItem[idx]._lineData);
}
void LinesManager::setMaxLineIdx(int idx) {
@ -2815,7 +2815,7 @@ void LinesManager::checkZone() {
int mouseX = _vm->_eventsManager->getMouseX();
int mouseY = _vm->_eventsManager->getMouseY();
int oldMouseY = mouseY;
if (_vm->_globals._cityMapEnabledFl
if (_vm->_globals->_cityMapEnabledFl
|| _vm->_eventsManager->_startPos.x >= mouseX
|| (mouseY = _vm->_graphicsManager._scrollOffset + 54, mouseX >= mouseY)
|| (mouseY = oldMouseY - 1, mouseY < 0 || mouseY > 59)) {
@ -2826,32 +2826,32 @@ void LinesManager::checkZone() {
_vm->_objectsManager._visibleFl = true;
}
if (_vm->_objectsManager._forceZoneFl) {
_vm->_globals.compteur_71 = 100;
_vm->_globals._oldMouseZoneId = -1;
_vm->_globals._oldMouseX = -200;
_vm->_globals._oldMouseY = -220;
_vm->_globals->compteur_71 = 100;
_vm->_globals->_oldMouseZoneId = -1;
_vm->_globals->_oldMouseX = -200;
_vm->_globals->_oldMouseY = -220;
_vm->_objectsManager._forceZoneFl = false;
}
_vm->_globals.compteur_71++;
if (_vm->_globals.compteur_71 <= 1)
_vm->_globals->compteur_71++;
if (_vm->_globals->compteur_71 <= 1)
return;
if (_vm->_globals._freezeCharacterFl || (_route == (RouteItem *)g_PTRNUL) || _vm->_globals.compteur_71 > 4) {
_vm->_globals.compteur_71 = 0;
if (_vm->_globals->_freezeCharacterFl || (_route == (RouteItem *)g_PTRNUL) || _vm->_globals->compteur_71 > 4) {
_vm->_globals->compteur_71 = 0;
int zoneId;
if (_vm->_globals._oldMouseX != mouseX || _vm->_globals._oldMouseY != oldMouseY) {
if (_vm->_globals->_oldMouseX != mouseX || _vm->_globals->_oldMouseY != oldMouseY) {
zoneId = getMouseZone();
} else {
zoneId = _vm->_globals._oldMouseZoneId;
zoneId = _vm->_globals->_oldMouseZoneId;
}
if (_vm->_globals._oldMouseZoneId != zoneId) {
if (_vm->_globals->_oldMouseZoneId != zoneId) {
_vm->_graphicsManager.SETCOLOR4(251, 100, 100, 100);
_vm->_eventsManager->_mouseCursorId = 4;
_vm->_eventsManager->changeMouseCursor(4);
if (_vm->_globals._forceHideText) {
if (_vm->_globals->_forceHideText) {
_vm->_fontManager->hideText(5);
_vm->_globals._forceHideText = false;
_vm->_globals->_forceHideText = false;
return;
}
}
@ -2861,16 +2861,16 @@ void LinesManager::checkZone() {
ZONEP[zoneId]._verbFl5 || ZONEP[zoneId]._verbFl6 ||
ZONEP[zoneId]._verbFl7 || ZONEP[zoneId]._verbFl8 ||
ZONEP[zoneId]._verbFl9 || ZONEP[zoneId]._verbFl10) {
if (_vm->_globals._oldMouseZoneId != zoneId) {
_vm->_fontManager->initTextBuffers(5, ZONEP[zoneId]._messageId, _vm->_globals._zoneFilename, 0, 430, 0, 0, 252);
if (_vm->_globals->_oldMouseZoneId != zoneId) {
_vm->_fontManager->initTextBuffers(5, ZONEP[zoneId]._messageId, _vm->_globals->_zoneFilename, 0, 430, 0, 0, 252);
_vm->_fontManager->showText(5);
_vm->_globals._forceHideText = true;
_vm->_globals->_forceHideText = true;
}
_vm->_globals._hotspotTextColor += 25;
if (_vm->_globals._hotspotTextColor > 100)
_vm->_globals._hotspotTextColor = 0;
_vm->_graphicsManager.SETCOLOR4(251, _vm->_globals._hotspotTextColor, _vm->_globals._hotspotTextColor,
_vm->_globals._hotspotTextColor);
_vm->_globals->_hotspotTextColor += 25;
if (_vm->_globals->_hotspotTextColor > 100)
_vm->_globals->_hotspotTextColor = 0;
_vm->_graphicsManager.SETCOLOR4(251, _vm->_globals->_hotspotTextColor, _vm->_globals->_hotspotTextColor,
_vm->_globals->_hotspotTextColor);
if (_vm->_eventsManager->_mouseCursorId == 4) {
if (ZONEP[zoneId]._verbFl1 == 2) {
_vm->_eventsManager->changeMouseCursor(16);
@ -2885,14 +2885,14 @@ void LinesManager::checkZone() {
}
}
_vm->_objectsManager._zoneNum = zoneId;
_vm->_globals._oldMouseX = mouseX;
_vm->_globals._oldMouseY = oldMouseY;
_vm->_globals._oldMouseZoneId = zoneId;
if (_vm->_globals._freezeCharacterFl && (_vm->_eventsManager->_mouseCursorId == 4)) {
_vm->_globals->_oldMouseX = mouseX;
_vm->_globals->_oldMouseY = oldMouseY;
_vm->_globals->_oldMouseZoneId = zoneId;
if (_vm->_globals->_freezeCharacterFl && (_vm->_eventsManager->_mouseCursorId == 4)) {
if (zoneId != -1 && zoneId != 0)
_vm->_objectsManager.handleRightButton();
}
if ((_vm->_globals._cityMapEnabledFl && zoneId == -1) || !zoneId) {
if ((_vm->_globals->_cityMapEnabledFl && zoneId == -1) || !zoneId) {
_vm->_objectsManager.setVerb(0);
_vm->_eventsManager->_mouseCursorId = 0;
_vm->_eventsManager->changeMouseCursor(0);

View File

@ -57,34 +57,34 @@ int MenuManager::menu() {
while (!g_system->getEventManager()->shouldQuit()) {
_vm->_objectsManager._forestFl = false;
_vm->_eventsManager->_breakoutFl = false;
_vm->_globals._disableInventFl = true;
_vm->_globals._exitId = 0;
_vm->_globals->_disableInventFl = true;
_vm->_globals->_exitId = 0;
for (int idx = 0; idx < 31; ++idx)
_vm->_globals._inventory[idx] = 0;
_vm->_globals->_inventory[idx] = 0;
memset(_vm->_globals._saveData, 0, 2000);
memset(_vm->_globals->_saveData, 0, 2000);
_vm->_objectsManager.addObject(14);
memset(frameIndex, 0, sizeof(int) * ARRAYSIZE(frameIndex));
if (_vm->getPlatform() == Common::kPlatformOS2 || _vm->getPlatform() == Common::kPlatformBeOS)
_vm->_graphicsManager.loadImage("MENU");
else if (_vm->_globals._language == LANG_EN)
else if (_vm->_globals->_language == LANG_EN)
_vm->_graphicsManager.loadImage("MENUAN");
else if (_vm->_globals._language == LANG_FR)
else if (_vm->_globals->_language == LANG_FR)
_vm->_graphicsManager.loadImage("MENUFR");
else if (_vm->_globals._language == LANG_SP)
else if (_vm->_globals->_language == LANG_SP)
_vm->_graphicsManager.loadImage("MENUES");
_vm->_graphicsManager.fadeInLong();
if (_vm->getPlatform() == Common::kPlatformOS2 || _vm->getPlatform() == Common::kPlatformBeOS)
spriteData = _vm->_objectsManager.loadSprite("MENU.SPR");
else if (_vm->_globals._language == LANG_EN)
else if (_vm->_globals->_language == LANG_EN)
spriteData = _vm->_objectsManager.loadSprite("MENUAN.SPR");
else if (_vm->_globals._language == LANG_FR)
else if (_vm->_globals->_language == LANG_FR)
spriteData = _vm->_objectsManager.loadSprite("MENUFR.SPR");
else if (_vm->_globals._language == LANG_SP)
else if (_vm->_globals->_language == LANG_SP)
spriteData = _vm->_objectsManager.loadSprite("MENUES.SPR");
_vm->_eventsManager->mouseOn();
@ -141,14 +141,14 @@ int MenuManager::menu() {
result = 1;
break;
} else if (menuIndex == LOAD_GAME) {
_vm->_globals._exitId = -1;
_vm->_globals->_exitId = -1;
_vm->_dialogsManager->showLoadGame();
if (_vm->_globals._exitId != -1) {
result = _vm->_globals._exitId;
if (_vm->_globals->_exitId != -1) {
result = _vm->_globals->_exitId;
break;
}
_vm->_globals._exitId = 0;
_vm->_globals->_exitId = 0;
} else if (menuIndex == OPTIONS) {
_vm->_dialogsManager->showOptionsDialog();
} else if (menuIndex == INTRODUCTION) {
@ -159,8 +159,8 @@ int MenuManager::menu() {
}
}
_vm->_globals.freeMemory(spriteData);
_vm->_globals._disableInventFl = false;
_vm->_globals->freeMemory(spriteData);
_vm->_globals->_disableInventFl = false;
_vm->_graphicsManager.fadeOutLong();
return result;
}

File diff suppressed because it is too large Load Diff

View File

@ -142,14 +142,14 @@ void SaveLoadManager::writeSavegameHeader(Common::OutSaveFile *out, hopkinsSaveg
Common::Error SaveLoadManager::saveGame(int slot, const Common::String &saveName) {
/* Pack any necessary data into the savegame data structure */
// Set the selected slot number
_vm->_globals._saveData->_data[svLastSavegameSlot] = slot;
_vm->_globals->_saveData->_data[svLastSavegameSlot] = slot;
// Set up the inventory
for (int i = 0; i < 35; ++i)
_vm->_globals._saveData->_inventory[i] = _vm->_globals._inventory[i];
_vm->_globals->_saveData->_inventory[i] = _vm->_globals->_inventory[i];
_vm->_globals._saveData->_mapCarPosX = _vm->_objectsManager._mapCarPosX;
_vm->_globals._saveData->_mapCarPosY = _vm->_objectsManager._mapCarPosY;
_vm->_globals->_saveData->_mapCarPosX = _vm->_objectsManager._mapCarPosX;
_vm->_globals->_saveData->_mapCarPosY = _vm->_objectsManager._mapCarPosY;
/* Create the savegame */
Common::OutSaveFile *savefile = g_system->getSavefileManager()->openForSaving(_vm->generateSaveName(slot));
@ -200,15 +200,15 @@ Common::Error SaveLoadManager::loadGame(int slot) {
// Unpack the inventory
for (int i = 0; i < 35; ++i)
_vm->_globals._inventory[i] = _vm->_globals._saveData->_inventory[i];
_vm->_globals->_inventory[i] = _vm->_globals->_saveData->_inventory[i];
// Set variables from loaded data as necessary
_vm->_globals._saveData->_data[svLastSavegameSlot] = slot;
_vm->_globals._exitId = _vm->_globals._saveData->_data[svLastScreenId];
_vm->_globals._saveData->_data[svLastPrevScreenId] = 0;
_vm->_globals._screenId = 0;
_vm->_objectsManager._mapCarPosX = _vm->_globals._saveData->_mapCarPosX;
_vm->_objectsManager._mapCarPosY = _vm->_globals._saveData->_mapCarPosY;
_vm->_globals->_saveData->_data[svLastSavegameSlot] = slot;
_vm->_globals->_exitId = _vm->_globals->_saveData->_data[svLastScreenId];
_vm->_globals->_saveData->_data[svLastPrevScreenId] = 0;
_vm->_globals->_screenId = 0;
_vm->_objectsManager._mapCarPosX = _vm->_globals->_saveData->_mapCarPosX;
_vm->_objectsManager._mapCarPosY = _vm->_globals->_saveData->_mapCarPosY;
return Common::kNoError;
}
@ -259,19 +259,19 @@ void SaveLoadManager::createThumbnail(Graphics::Surface *s) {
}
void SaveLoadManager::syncSavegameData(Common::Serializer &s, int version) {
s.syncBytes(&_vm->_globals._saveData->_data[0], 2050);
syncCharacterLocation(s, _vm->_globals._saveData->_cloneHopkins);
syncCharacterLocation(s, _vm->_globals._saveData->_realHopkins);
syncCharacterLocation(s, _vm->_globals._saveData->_samantha);
s.syncBytes(&_vm->_globals->_saveData->_data[0], 2050);
syncCharacterLocation(s, _vm->_globals->_saveData->_cloneHopkins);
syncCharacterLocation(s, _vm->_globals->_saveData->_realHopkins);
syncCharacterLocation(s, _vm->_globals->_saveData->_samantha);
for (int i = 0; i < 35; ++i)
s.syncAsSint16LE(_vm->_globals._saveData->_inventory[i]);
s.syncAsSint16LE(_vm->_globals->_saveData->_inventory[i]);
if (version > 1) {
s.syncAsSint16LE(_vm->_globals._saveData->_mapCarPosX);
s.syncAsSint16LE(_vm->_globals._saveData->_mapCarPosY);
s.syncAsSint16LE(_vm->_globals->_saveData->_mapCarPosX);
s.syncAsSint16LE(_vm->_globals->_saveData->_mapCarPosY);
} else {
_vm->_globals._saveData->_mapCarPosX = _vm->_globals._saveData->_mapCarPosY = 0;
_vm->_globals->_saveData->_mapCarPosX = _vm->_globals->_saveData->_mapCarPosY = 0;
}
}

File diff suppressed because it is too large Load Diff

View File

@ -273,7 +273,7 @@ void SoundManager::loadAnimSound() {
}
void SoundManager::playAnimSound(int soundNumber) {
if (!_vm->_globals._censorshipFl && _specialSoundNum == 2) {
if (!_vm->_globals->_censorshipFl && _specialSoundNum == 2) {
switch (soundNumber) {
case 20:
playSample(5);
@ -524,41 +524,41 @@ bool SoundManager::mixVoice(int voiceId, int voiceMode, bool dispTxtFl) {
if (_vm->getPlatform() == Common::kPlatformOS2 || _vm->getPlatform() == Common::kPlatformBeOS)
filename = "ENG_VOI.RES";
// Win95 and Linux versions uses another set of names
else if (_vm->_globals._language == LANG_FR)
else if (_vm->_globals->_language == LANG_FR)
filename = "RES_VFR.RES";
else if (_vm->_globals._language == LANG_EN)
else if (_vm->_globals->_language == LANG_EN)
filename = "RES_VAN.RES";
else if (_vm->_globals._language == LANG_SP)
else if (_vm->_globals->_language == LANG_SP)
filename = "RES_VES.RES";
catPos = _vm->_globals._catalogPos;
catLen = _vm->_globals._catalogSize;
catPos = _vm->_globals->_catalogPos;
catLen = _vm->_globals->_catalogSize;
} else if (!_vm->_fileManager->searchCat(filename + ".APC", RES_VOI)) {
if (_vm->getPlatform() == Common::kPlatformOS2 || _vm->getPlatform() == Common::kPlatformBeOS)
filename = "ENG_VOI.RES";
// Win95 and Linux versions uses another set of names
else if (_vm->_globals._language == LANG_FR)
else if (_vm->_globals->_language == LANG_FR)
filename = "RES_VFR.RES";
else if (_vm->_globals._language == LANG_EN)
else if (_vm->_globals->_language == LANG_EN)
filename = "RES_VAN.RES";
else if (_vm->_globals._language == LANG_SP)
else if (_vm->_globals->_language == LANG_SP)
filename = "RES_VES.RES";
catPos = _vm->_globals._catalogPos;
catLen = _vm->_globals._catalogSize;
catPos = _vm->_globals->_catalogPos;
catLen = _vm->_globals->_catalogSize;
} else if (!_vm->_fileManager->searchCat(filename + ".RAW", RES_VOI)) {
if (_vm->getPlatform() == Common::kPlatformOS2 || _vm->getPlatform() == Common::kPlatformBeOS)
filename = "ENG_VOI.RES";
// Win95 and Linux versions uses another set of names
else if (_vm->_globals._language == LANG_FR)
else if (_vm->_globals->_language == LANG_FR)
filename = "RES_VFR.RES";
else if (_vm->_globals._language == LANG_EN)
else if (_vm->_globals->_language == LANG_EN)
filename = "RES_VAN.RES";
else if (_vm->_globals._language == LANG_SP)
else if (_vm->_globals->_language == LANG_SP)
filename = "RES_VES.RES";
catPos = _vm->_globals._catalogPos;
catLen = _vm->_globals._catalogSize;
catPos = _vm->_globals->_catalogPos;
catLen = _vm->_globals->_catalogSize;
} else {
if (!f.exists(filename + ".WAV")) {
if (!f.exists(filename + ".APC"))

View File

@ -56,25 +56,25 @@ void TalkManager::startAnimatedCharacterDialogue(const Common::String &filename)
_vm->_fontManager->hideText(9);
_vm->_eventsManager->refreshScreenAndEvents();
_vm->_graphicsManager._scrollStatus = 1;
bool oldDisableInventFl = _vm->_globals._disableInventFl;
_vm->_globals._disableInventFl = true;
bool oldDisableInventFl = _vm->_globals->_disableInventFl;
_vm->_globals->_disableInventFl = true;
_characterBuffer = _vm->_fileManager->searchCat(filename, RES_PER);
_characterSize = _vm->_globals._catalogSize;
_characterSize = _vm->_globals->_catalogSize;
if (_characterBuffer == g_PTRNUL) {
_characterBuffer = _vm->_fileManager->loadFile(filename);
_characterSize = _vm->_fileManager->fileSize(filename);
}
_vm->_globals._saveData->_data[svDialogField4] = 0;
_vm->_globals->_saveData->_data[svDialogField4] = 0;
getStringFromBuffer(40, spriteFilename, (const char *)_characterBuffer);
getStringFromBuffer(0, _questionsFilename, (const char *)_characterBuffer);
getStringFromBuffer(20, _answersFilename, (const char *)_characterBuffer);
if (_vm->_globals._language == LANG_FR) {
if (_vm->_globals->_language == LANG_FR) {
_answersFilename = _questionsFilename = "RUE.TXT";
} else if (_vm->_globals._language == LANG_EN) {
} else if (_vm->_globals->_language == LANG_EN) {
_answersFilename = _questionsFilename = "RUEAN.TXT";
} else if (_vm->_globals._language == LANG_SP) {
} else if (_vm->_globals->_language == LANG_SP) {
_answersFilename = _questionsFilename = "RUEES.TXT";
}
_dialogueMesgId1 = READ_LE_INT16((uint16 *)_characterBuffer + 40);
@ -104,7 +104,7 @@ void TalkManager::startAnimatedCharacterDialogue(const Common::String &filename)
int oldMouseCursorId = _vm->_eventsManager->_mouseCursorId;
_vm->_eventsManager->_mouseCursorId = 4;
_vm->_eventsManager->changeMouseCursor(0);
if (!_vm->_globals._introSpeechOffFl) {
if (!_vm->_globals->_introSpeechOffFl) {
int answer = 0;
int dlgAnswer;
do {
@ -116,7 +116,7 @@ void TalkManager::startAnimatedCharacterDialogue(const Common::String &filename)
_vm->_eventsManager->refreshScreenAndEvents();
} while (dlgAnswer != _dialogueMesgId4);
}
if (_vm->_globals._introSpeechOffFl) {
if (_vm->_globals->_introSpeechOffFl) {
int idx = 1;
int answer;
do
@ -124,9 +124,9 @@ void TalkManager::startAnimatedCharacterDialogue(const Common::String &filename)
while (answer != -1);
}
clearCharacterAnim();
_vm->_globals._introSpeechOffFl = false;
_characterBuffer = _vm->_globals.freeMemory(_characterBuffer);
_characterSprite = _vm->_globals.freeMemory(_characterSprite);
_vm->_globals->_introSpeechOffFl = false;
_characterBuffer = _vm->_globals->freeMemory(_characterBuffer);
_characterSprite = _vm->_globals->freeMemory(_characterSprite);
_vm->_graphicsManager.NB_SCREEN(false);
_vm->_saveLoadManager.load("TEMP.SCR", _vm->_graphicsManager._vesaScreen);
@ -147,7 +147,7 @@ void TalkManager::startAnimatedCharacterDialogue(const Common::String &filename)
_vm->_graphicsManager.m_scroll16(_vm->_graphicsManager._vesaScreen, _vm->_eventsManager->_startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0);
_vm->_graphicsManager.unlockScreen();
memcpy(_vm->_graphicsManager._vesaBuffer, _vm->_graphicsManager._vesaScreen, 614399);
_vm->_globals._disableInventFl = oldDisableInventFl;
_vm->_globals->_disableInventFl = oldDisableInventFl;
_vm->_graphicsManager.updateScreen();
for (int i = 0; i <= 4; i++)
_vm->_eventsManager->refreshScreenAndEvents();
@ -156,21 +156,21 @@ void TalkManager::startAnimatedCharacterDialogue(const Common::String &filename)
void TalkManager::startStaticCharacterDialogue(const Common::String &filename) {
// TODO: The original disables the mouse cursor here
bool oldDisableInventFl = _vm->_globals._disableInventFl;
_vm->_globals._disableInventFl = true;
bool oldDisableInventFl = _vm->_globals->_disableInventFl;
_vm->_globals->_disableInventFl = true;
_characterBuffer = _vm->_fileManager->searchCat(filename, RES_PER);
_characterSize = _vm->_globals._catalogSize;
_characterSize = _vm->_globals->_catalogSize;
if (_characterBuffer == g_PTRNUL) {
_characterBuffer = _vm->_fileManager->loadFile(filename);
_characterSize = _vm->_fileManager->fileSize(filename);
}
_vm->_globals._saveData->_data[svDialogField4] = 0;
_vm->_globals->_saveData->_data[svDialogField4] = 0;
getStringFromBuffer(0, _questionsFilename, (const char *)_characterBuffer);
getStringFromBuffer(20, _answersFilename, (const char *)_characterBuffer);
switch (_vm->_globals._language) {
switch (_vm->_globals->_language) {
case LANG_EN:
_questionsFilename = "RUEAN.TXT";
_answersFilename = "RUEAN.TXT";
@ -195,7 +195,7 @@ void TalkManager::startStaticCharacterDialogue(const Common::String &filename) {
_vm->_eventsManager->_mouseCursorId = 4;
_vm->_eventsManager->changeMouseCursor(0);
if (!_vm->_globals._introSpeechOffFl) {
if (!_vm->_globals->_introSpeechOffFl) {
int answer;
do {
answer = dialogQuestion(true);
@ -206,7 +206,7 @@ void TalkManager::startStaticCharacterDialogue(const Common::String &filename) {
} while (answer != _dialogueMesgId4);
}
if (_vm->_globals._introSpeechOffFl) {
if (_vm->_globals->_introSpeechOffFl) {
int idx = 1;
int answer;
do
@ -214,14 +214,14 @@ void TalkManager::startStaticCharacterDialogue(const Common::String &filename) {
while (answer != -1);
}
_characterBuffer = _vm->_globals.freeMemory(_characterBuffer);
_characterBuffer = _vm->_globals->freeMemory(_characterBuffer);
_vm->_eventsManager->_mouseCursorId = oldMouseCursorId;
_vm->_eventsManager->changeMouseCursor(oldMouseCursorId);
_vm->_graphicsManager.initColorTable(145, 150, _vm->_graphicsManager._palette);
_vm->_graphicsManager.setPaletteVGA256(_vm->_graphicsManager._palette);
// TODO: The original re-enables the mouse cursor here
_vm->_globals._disableInventFl = oldDisableInventFl;
_vm->_globals->_disableInventFl = oldDisableInventFl;
}
void TalkManager::getStringFromBuffer(int srcStart, Common::String &dest, const char *srcData) {
@ -349,7 +349,7 @@ int TalkManager::dialogAnswer(int idx, bool animatedFl) {
int curBufVal = READ_LE_INT16((uint16 *)charBuf + 9);
if (curBufVal)
_vm->_globals._saveData->_data[svDialogField4] = curBufVal;
_vm->_globals->_saveData->_data[svDialogField4] = curBufVal;
if (!frameNumb)
frameNumb = 10;
@ -473,26 +473,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->_globals->_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->_globals->_animBqe[idx]._enabledFl)
_vm->_objectsManager.hideBob(idx);
}
for (int idx = 26; idx <= 30; ++idx) {
if (_vm->_globals._animBqe[idx]._enabledFl)
if (_vm->_globals->_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->_globals->_animBqe[idx]._enabledFl)
_vm->_objectsManager.hideBob(idx);
}
@ -500,7 +500,7 @@ void TalkManager::dialogEndTalk() {
_vm->_eventsManager->refreshScreenAndEvents();
for (int idx = 21; idx <= 25; ++idx) {
if (_vm->_globals._animBqe[idx]._enabledFl)
if (_vm->_globals->_animBqe[idx]._enabledFl)
_vm->_objectsManager.resetBob(idx);
}
}
@ -531,7 +531,7 @@ int TalkManager::countBoxLines(int idx, const Common::String &file) {
error("Error opening file - %s", dest.c_str());
f.seek(indexData[idx]);
byte *decryptBuf = _vm->_globals.allocMemory(2058);
byte *decryptBuf = _vm->_globals->allocMemory(2058);
assert(decryptBuf != g_PTRNUL);
f.read(decryptBuf, 2048);
@ -589,13 +589,13 @@ int TalkManager::countBoxLines(int idx, const Common::String &file) {
++lineCount;
curBufIndx += lineSize;
} while (curChar != '%');
_vm->_globals.freeMemory(decryptBuf);
_vm->_globals->freeMemory(decryptBuf);
return lineCount;
}
void TalkManager::VISU_PARLE() {
for (int idx = 21; idx <= 25; ++idx) {
if (_vm->_globals._animBqe[idx]._enabledFl)
if (_vm->_globals->_animBqe[idx]._enabledFl)
BOB_VISU_PARLE(idx);
}
}
@ -604,7 +604,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->_globals->_animBqe[idx]._data;
int newMode = READ_LE_INT16(bqeData + 2);
if (!newMode)
newMode = 1;
@ -612,7 +612,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->_globals->_animBqe[idx]._data;
_vm->_objectsManager._bob[idx]._bobMode = 10;
bqeData = _characterSprite;
_vm->_objectsManager._bob[idx]._spriteData = _characterSprite;
@ -641,11 +641,11 @@ void TalkManager::startCharacterAnim0(int startIdx, bool readOnlyFl) {
do {
if (!READ_LE_INT16(&_characterAnim[2 * idx + 4]))
break;
if (_vm->_globals._speed != 501)
if (_vm->_globals->_speed != 501)
_vm->_graphicsManager.fastDisplay(_characterSprite, _vm->_eventsManager->_startPos.x + READ_LE_INT16(&_characterAnim[2 * idx]),
READ_LE_INT16(&_characterAnim[2 * idx + 2]), _characterAnim[2 * idx + 8]);
idx += 5;
} while (_vm->_globals._speed != 501);
} while (_vm->_globals->_speed != 501);
}
}
@ -698,8 +698,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->_globals->_animBqe[idx]._data = _vm->_globals->freeMemory(_vm->_globals->_animBqe[idx]._data);
_vm->_globals->_animBqe[idx]._enabledFl = false;
}
}
@ -716,25 +716,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->_globals->_animBqe[idx]._enabledFl = false;
_vm->_globals->_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->_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);
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->_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;
const byte *curBufPerso = bufPos + bufPerso + 25;
for (int i = 1; i < 5000; i++) {
bqeCurData += 10;
@ -770,10 +770,10 @@ void TalkManager::REPONSE(int zone, int verb) {
do {
outerLoopFl = false;
bool tagFound = false;
if (_vm->_globals._answerBuffer == g_PTRNUL)
if (_vm->_globals->_answerBuffer == g_PTRNUL)
return;
byte *curAnswerBuf = _vm->_globals._answerBuffer;
byte *curAnswerBuf = _vm->_globals->_answerBuffer;
for (;;) {
if (READ_BE_UINT24(curAnswerBuf) == MKTAG24('F', 'I', 'N'))
return;
@ -789,7 +789,7 @@ void TalkManager::REPONSE(int zone, int verb) {
// 'COD' tag found
curAnswerBuf += 5;
ptr = _vm->_globals.allocMemory(620);
ptr = _vm->_globals->allocMemory(620);
assert(ptr != g_PTRNUL);
memset(ptr, 0, 620);
uint16 curAnswerIdx = 0;
@ -847,7 +847,7 @@ void TalkManager::REPONSE(int zone, int verb) {
innerLoopCond = true;
else if (opcodeType == 6) {
// JUMP
_vm->_globals.freeMemory(ptr);
_vm->_globals->freeMemory(ptr);
zoneObj = _vm->_objectsManager._jumpZone;
verbObj = _vm->_objectsManager._jumpVerb;
outerLoopFl = true;
@ -855,14 +855,14 @@ void TalkManager::REPONSE(int zone, int verb) {
}
} while (!innerLoopCond);
} while (outerLoopFl);
_vm->_globals.freeMemory(ptr);
_vm->_globals._saveData->_data[svLastZoneNum] = 0;
_vm->_globals->freeMemory(ptr);
_vm->_globals->_saveData->_data[svLastZoneNum] = 0;
return;
}
void TalkManager::REPONSE2(int zone, int verb) {
int indx = 0;
if (verb != 5 || _vm->_globals._saveData->_data[svLastObjectIndex] != 4)
if (verb != 5 || _vm->_globals->_saveData->_data[svLastObjectIndex] != 4)
return;
if (zone == 22 || zone == 23) {
@ -887,7 +887,7 @@ void TalkManager::REPONSE2(int zone, int verb) {
_vm->_objectsManager.stopBobAnimation(6);
_vm->_objectsManager.setBobAnimation(8);
switch (_vm->_globals._screenId) {
switch (_vm->_globals->_screenId) {
case 35:
indx = 201;
break;
@ -910,7 +910,7 @@ void TalkManager::REPONSE2(int zone, int verb) {
indx = 213;
break;
}
_vm->_globals._saveData->_data[indx] = 2;
_vm->_globals->_saveData->_data[indx] = 2;
_vm->_linesManager.disableZone(22);
_vm->_linesManager.disableZone(23);
} else if (zone == 20 || zone == 21) {
@ -934,7 +934,7 @@ void TalkManager::REPONSE2(int zone, int verb) {
while (_vm->_objectsManager.getBobAnimDataIdx(5) < 12);
_vm->_objectsManager.stopBobAnimation(5);
_vm->_objectsManager.setBobAnimation(7);
switch (_vm->_globals._screenId) {
switch (_vm->_globals->_screenId) {
case 35:
indx = 200;
break;
@ -957,7 +957,7 @@ void TalkManager::REPONSE2(int zone, int verb) {
indx = 212;
break;
}
_vm->_globals._saveData->_data[indx] = 2;
_vm->_globals->_saveData->_data[indx] = 2;
_vm->_linesManager.disableZone(21);
_vm->_linesManager.disableZone(20);
}
@ -970,7 +970,7 @@ void TalkManager::animateObject(const Common::String &filename) {
_vm->_graphicsManager._scrollStatus = 1;
_vm->_linesManager.clearAllZones();
_vm->_linesManager.resetLines();
_vm->_globals.resetHidingItems();
_vm->_globals->resetHidingItems();
for (int i = 0; i <= 44; i++)
_vm->_linesManager.BOBZONE[i] = 0;
@ -979,7 +979,7 @@ void TalkManager::animateObject(const Common::String &filename) {
_vm->_eventsManager->_mouseCursorId = 4;
_vm->_eventsManager->changeMouseCursor(0);
_characterBuffer = _vm->_fileManager->searchCat(filename, RES_PER);
_characterSize = _vm->_globals._catalogSize;
_characterSize = _vm->_globals->_catalogSize;
if (_characterBuffer == g_PTRNUL) {
_characterBuffer = _vm->_fileManager->loadFile(filename);
_characterSize = _vm->_fileManager->fileSize(filename);
@ -992,7 +992,7 @@ void TalkManager::animateObject(const Common::String &filename) {
getStringFromBuffer(20, curScreenFilename, (const char *)_characterBuffer);
if (curScreenFilename == "NULL")
curScreenFilename = Common::String::format("IM%d", _vm->_globals._screenId);
curScreenFilename = Common::String::format("IM%d", _vm->_globals->_screenId);
_characterSprite = _vm->_fileManager->searchCat(spriteFilename, RES_SAN);
if (_characterSprite)
@ -1013,18 +1013,18 @@ void TalkManager::animateObject(const Common::String &filename) {
_vm->_objectsManager.PERSO_ON = true;
searchCharacterPalette(_paletteBufferIdx, true);
startCharacterAnim0(_paletteBufferIdx, false);
byte *oldAnswerBufferPtr = _vm->_globals._answerBuffer;
_vm->_globals._answerBuffer = g_PTRNUL;
_vm->_globals._freezeCharacterFl = true;
byte *oldAnswerBufferPtr = _vm->_globals->_answerBuffer;
_vm->_globals->_answerBuffer = g_PTRNUL;
_vm->_globals->_freezeCharacterFl = true;
_vm->_objectsManager.loadLinkFile(screenFilename);
_vm->_objectsManager.PERSO_ON = true;
_vm->_globals._actionMoveTo = false;
_vm->_globals->_actionMoveTo = false;
_vm->_objectsManager._zoneNum = -1;
initCharacterAnim();
VISU_PARLE();
dialogWait();
_vm->_graphicsManager.initScreen(screenFilename, 2, true);
_vm->_globals._freezeCharacterFl = true;
_vm->_globals->_freezeCharacterFl = true;
_vm->_objectsManager._forceZoneFl = true;
_vm->_objectsManager._zoneNum = -1;
do {
@ -1035,33 +1035,33 @@ void TalkManager::animateObject(const Common::String &filename) {
_vm->_objectsManager.handleRightButton();
_vm->_linesManager.checkZone();
if (_vm->_globals._actionMoveTo)
if (_vm->_globals->_actionMoveTo)
_vm->_objectsManager.PARADISE();
_vm->_eventsManager->refreshScreenAndEvents();
} while (!_vm->_globals._exitId);
} while (!_vm->_globals->_exitId);
dialogEndTalk();
dialogTalk();
clearCharacterAnim();
clearCharacterAnim();
_vm->_globals._introSpeechOffFl = false;
_characterBuffer = _vm->_globals.freeMemory(_characterBuffer);
_characterSprite = _vm->_globals.freeMemory(_characterSprite);
_vm->_globals->_introSpeechOffFl = false;
_characterBuffer = _vm->_globals->freeMemory(_characterBuffer);
_characterSprite = _vm->_globals->freeMemory(_characterSprite);
_vm->_graphicsManager.NB_SCREEN(false);
_vm->_linesManager.clearAllZones();
_vm->_linesManager.resetLines();
_vm->_globals.resetHidingItems();
_vm->_globals->resetHidingItems();
for (int i = 0; i <= 44; i++)
_vm->_linesManager.BOBZONE[i] = 0;
_vm->_globals.freeMemory(_vm->_globals._answerBuffer);
_vm->_globals._answerBuffer = oldAnswerBufferPtr;
_vm->_globals->freeMemory(_vm->_globals->_answerBuffer);
_vm->_globals->_answerBuffer = oldAnswerBufferPtr;
_vm->_objectsManager._disableFl = true;
_vm->_objectsManager.loadLinkFile(curScreenFilename);
_vm->_graphicsManager.initScreen(curScreenFilename, 2, true);
_vm->_objectsManager._disableFl = false;
_vm->_globals._freezeCharacterFl = false;
if (_vm->_globals._exitId == 101)
_vm->_globals._exitId = 0;
_vm->_globals->_freezeCharacterFl = false;
if (_vm->_globals->_exitId == 101)
_vm->_globals->_exitId = 0;
_vm->_saveLoadManager.load("TEMP.SCR", _vm->_graphicsManager._vesaScreen);
g_system->getSavefileManager()->removeSavefile("TEMP.SCR");
@ -1081,7 +1081,7 @@ void TalkManager::animateObject(const Common::String &filename) {
_vm->_graphicsManager.unlockScreen();
_vm->_graphicsManager.setPaletteVGA256(_vm->_graphicsManager._palette);
memcpy(_vm->_graphicsManager._vesaBuffer, _vm->_graphicsManager._vesaScreen, 614399);
_vm->_globals._disableInventFl = false;
_vm->_globals->_disableInventFl = false;
_vm->_graphicsManager.updateScreen();
for (int i = 0; i <= 4; i++)
_vm->_eventsManager->refreshScreenAndEvents();