HOPKINS: Some renaming and refactoring

This commit is contained in:
Strangerke 2012-12-26 21:30:51 +01:00
parent 145b593e22
commit 10a61a8124
4 changed files with 64 additions and 72 deletions

View File

@ -844,7 +844,9 @@ bool HopkinsEngine::runOS2Full() {
_graphicsManager.unlockScreen();
_graphicsManager.clearPalette();
_animationManager.playAnim("MP.ANM", 10, 0, 200);
// Add 16ms delay in order to match the Linux and Win95 versions
_animationManager.playAnim("MP.ANM", 10, 16, 200);
_graphicsManager.FADE_OUTW();
if (!_eventsManager._escKeyFl)
playIntro();
@ -1727,7 +1729,9 @@ bool HopkinsEngine::runBeOSFull() {
_graphicsManager.unlockScreen();
_graphicsManager.clearPalette();
_animationManager.playAnim("MP.ANM", 10, 0, 200);
// Add 16ms delay in order to match the Linux and Win95 versions
_animationManager.playAnim("MP.ANM", 10, 16, 200);
_graphicsManager.FADE_OUTW();
if (!_eventsManager._escKeyFl)
playIntro();

View File

@ -5357,7 +5357,7 @@ void ObjectsManager::PERSONAGE2(const Common::String &backgroundFile, const Comm
if (!s4.empty()) {
if (!_vm->_globals.NOSPRECRAN)
_vm->_graphicsManager.INI_ECRAN(s4);
if (!s4.empty() && _vm->_globals.NOSPRECRAN)
else
_vm->_graphicsManager.INI_ECRAN2(s4);
}
_vm->_eventsManager.mouseOn();
@ -5366,15 +5366,14 @@ void ObjectsManager::PERSONAGE2(const Common::String &backgroundFile, const Comm
_vm->_graphicsManager.SETCOLOR3(253, 100, 100, 100);
_vm->_graphicsManager.SETCOLOR3(251, 100, 100, 100);
_vm->_graphicsManager.SETCOLOR3(254, 0, 0, 0);
if (!_vm->_globals.PERSO_TYPE)
goto LABEL_70;
if (!_vm->_globals._saveData->data[svField122] && !_vm->_globals._saveData->data[svField356]) {
_vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, "PERSO.SPR");
_vm->_globals.PERSO = _vm->_fileManager.loadFile(_vm->_globals.NFICHIER);
_vm->_globals.PERSO_TYPE = 0;
if (_vm->_globals.PERSO_TYPE) {
if (!_vm->_globals._saveData->data[svField122] && !_vm->_globals._saveData->data[svField356]) {
_vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, "PERSO.SPR");
_vm->_globals.PERSO = _vm->_fileManager.loadFile(_vm->_globals.NFICHIER);
_vm->_globals.PERSO_TYPE = 0;
}
}
if (!_vm->_globals.PERSO_TYPE) {
LABEL_70:
if (_vm->_globals._saveData->data[svField122] == 1) {
_vm->_fileManager.constructFilename(_vm->_globals.HOPSYSTEM, "HOPFEM.SPR");
_vm->_globals.PERSO = _vm->_fileManager.loadFile(_vm->_globals.NFICHIER);
@ -5387,12 +5386,17 @@ LABEL_70:
_vm->_globals.PERSO_TYPE = 2;
}
_vm->_globals.HOPKINS_DATA();
if (!_vm->_globals.PERSO_TYPE)
switch (_vm->_globals.PERSO_TYPE) {
case 0:
SPRITE(_vm->_globals.PERSO, _characterPos, 0, PERI, 0, 0, 34, 190);
if (_vm->_globals.PERSO_TYPE == 1)
break;
case 1:
SPRITE(_vm->_globals.PERSO, _characterPos, 0, PERI, 0, 0, 28, 155);
if (_vm->_globals.PERSO_TYPE == 2)
break;
case 2:
SPRITE(_vm->_globals.PERSO, _characterPos, 0, PERI, 0, 0, 20, 127);
break;
}
_vm->_eventsManager.setMouseXY(_characterPos);
if (_vm->_graphicsManager.DOUBLE_ECRAN)
_vm->_graphicsManager.SCROLL = (int16)getSpriteX(0) - 320;
@ -5409,9 +5413,8 @@ LABEL_70:
_vm->_globals.Compteur = 0;
_vm->_globals.BPP_NOAFF = true;
for (int idx = 0; idx < 5; ++idx) {
for (int idx = 0; idx < 5; ++idx)
_vm->_eventsManager.VBL();
}
_vm->_globals.BPP_NOAFF = false;
_vm->_globals.iRegul = 1;
@ -5432,13 +5435,11 @@ LABEL_70:
xp = _vm->_eventsManager.getMouseX();
yp = _vm->_eventsManager.getMouseY();
if (xCheck == xp) {
if (yCheck == yp) {
_vm->_globals.chemin = (int16 *)g_PTRNUL;
PARADISE();
if (_vm->_globals._exitId)
breakFlag = true;
}
if ((xCheck == xp) && (yCheck == yp)) {
_vm->_globals.chemin = (int16 *)g_PTRNUL;
PARADISE();
if (_vm->_globals._exitId)
breakFlag = true;
}
xCheck = xp;
yCheck = yp;

View File

@ -50,19 +50,15 @@ void TalkManager::setParent(HopkinsEngine *vm) {
}
void TalkManager::PARLER_PERSO(const Common::String &filename) {
int v2;
int v3;
int v4;
int v5;
int v7;
byte *v8;
byte *v9;
byte *v10;
int v14;
int v15;
Common::String v16;
Common::String spriteFilename;
v15 = 0;
int answer = 0;
_vm->_fontManager.hideText(5);
_vm->_fontManager.hideText(9);
_vm->_eventsManager.VBL();
@ -77,9 +73,9 @@ void TalkManager::PARLER_PERSO(const Common::String &filename) {
_characterSize = _vm->_fileManager.fileSize(_vm->_globals.NFICHIER);
}
_vm->_globals._saveData->data[svField4] = 0;
RENVOIE_FICHIER(40, v16, (const char *)_characterBuffer);
RENVOIE_FICHIER(0, _questionsFilename, (const char *)_characterBuffer);
RENVOIE_FICHIER(20, _answersFilename, (const char *)_characterBuffer);
getStringFromBuffer(40, spriteFilename, (const char *)_characterBuffer);
getStringFromBuffer(0, _questionsFilename, (const char *)_characterBuffer);
getStringFromBuffer(20, _answersFilename, (const char *)_characterBuffer);
if (_vm->_globals._language == LANG_FR) {
_answersFilename = _questionsFilename = "RUE.TXT";
} else if (_vm->_globals._language == LANG_EN) {
@ -87,12 +83,11 @@ void TalkManager::PARLER_PERSO(const Common::String &filename) {
} else if (_vm->_globals._language == LANG_SP) {
_answersFilename = _questionsFilename = "RUEES.TXT";
}
v2 = (int16)READ_LE_UINT16((uint16 *)_characterBuffer + 40);
v3 = 20 * (int16)READ_LE_UINT16((uint16 *)_characterBuffer + 42) + 110;
PLIGNE1 = (int16)READ_LE_UINT16((uint16 *)_characterBuffer + 40);
PCHERCHE = 20 * (int16)READ_LE_UINT16((uint16 *)_characterBuffer + 42) + 110;
_characterSprite = _vm->_fileManager.searchCat(v16, 7);
_characterSprite = _vm->_fileManager.searchCat(spriteFilename, 7);
if (_characterSprite) {
_vm->_fileManager.constructFilename(_vm->_globals.HOPANIM, v16);
_vm->_fileManager.constructFilename(_vm->_globals.HOPANIM, spriteFilename);
} else {
_vm->_fileManager.constructFilename(_vm->_globals.HOPANIM, "RES_SAN.RES");
}
@ -108,28 +103,26 @@ void TalkManager::PARLER_PERSO(const Common::String &filename) {
_vm->_graphicsManager.ofscroll = 0;
_vm->_graphicsManager.NB_SCREEN();
_vm->_objectsManager.PERSO_ON = true;
CHERCHE_PAL(v3, 0);
CHERCHE_ANIM0(v3, 0);
CHERCHE_PAL(PCHERCHE, 0);
CHERCHE_ANIM0(PCHERCHE, 0);
initCharacterAnim();
PLIGNE1 = v2;
PLIGNE2 = v2 + 1;
PLIGNE3 = v2 + 2;
PLIGNE4 = v2 + 3;
PLIGNE2 = PLIGNE1 + 1;
PLIGNE3 = PLIGNE1 + 2;
PLIGNE4 = PLIGNE1 + 3;
v14 = _vm->_eventsManager._mouseCursorId;
_vm->_eventsManager._mouseCursorId = 4;
_vm->_eventsManager.changeMouseCursor(0);
if (!_vm->_globals.NOPARLE) {
v4 = v2 + 3;
do {
v5 = DIALOGUE();
if (v5 != v4)
v15 = DIALOGUE_REP(v5);
if (v15 == -1)
v5 = v2 + 3;
if (v5 != PLIGNE4)
answer = DIALOGUE_REP(v5);
if (answer == -1)
v5 = PLIGNE4;
_vm->_eventsManager.VBL();
} while (v5 != v4);
} while (v5 != PLIGNE4);
}
if (_vm->_globals.NOPARLE == true) {
if (_vm->_globals.NOPARLE) {
int v6 = 1;
do
v7 = DIALOGUE_REP(v6++);
@ -190,8 +183,8 @@ void TalkManager::PARLER_PERSO2(const Common::String &filename) {
}
_vm->_globals._saveData->data[svField4] = 0;
RENVOIE_FICHIER(0, _questionsFilename, (const char *)_characterBuffer);
RENVOIE_FICHIER(20, _answersFilename, (const char *)_characterBuffer);
getStringFromBuffer(0, _questionsFilename, (const char *)_characterBuffer);
getStringFromBuffer(20, _answersFilename, (const char *)_characterBuffer);
switch (_vm->_globals._language) {
case LANG_EN:
@ -208,27 +201,25 @@ void TalkManager::PARLER_PERSO2(const Common::String &filename) {
break;
}
int v1 = (int16)READ_LE_UINT16((uint16 *)_characterBuffer + 40);
PLIGNE1 = (int16)READ_LE_UINT16((uint16 *)_characterBuffer + 40);
PCHERCHE = 20 * (int16)READ_LE_UINT16((uint16 *)_characterBuffer + 42) + 110;
CHERCHE_PAL(PCHERCHE, 0);
PLIGNE1 = v1;
PLIGNE2 = v1 + 1;
PLIGNE3 = v1 + 2;
PLIGNE4 = v1 + 3;
PLIGNE2 = PLIGNE1 + 1;
PLIGNE3 = PLIGNE1 + 2;
PLIGNE4 = PLIGNE1 + 3;
int v8 = _vm->_eventsManager._mouseCursorId;
_vm->_eventsManager._mouseCursorId = 4;
_vm->_eventsManager.changeMouseCursor(0);
if (!_vm->_globals.NOPARLE) {
int v2 = v1 + 3;
int v3;
do {
v3 = DIALOGUE();
if (v3 != v2) {
if (v3 != PLIGNE4) {
if (DIALOGUE_REP(v3) == -1)
v3 = v1 + 3;
v3 = PLIGNE4;
}
} while (v3 != v2);
} while (v3 != PLIGNE4);
}
if (_vm->_globals.NOPARLE) {
@ -250,7 +241,7 @@ void TalkManager::PARLER_PERSO2(const Common::String &filename) {
STATI = 0;
}
void TalkManager::RENVOIE_FICHIER(int srcStart, Common::String &dest, const char *srcData) {
void TalkManager::getStringFromBuffer(int srcStart, Common::String &dest, const char *srcData) {
dest = Common::String(srcData + srcStart);
}
@ -1141,10 +1132,8 @@ void TalkManager::OBJET_VIVANT(const Common::String &a2) {
int v5;
int v10;
byte *v11;
int v12;
byte *v14;
byte *v15;
byte *v16;
Common::String s;
Common::String v20;
Common::String v22;
@ -1171,9 +1160,9 @@ void TalkManager::OBJET_VIVANT(const Common::String &a2) {
_characterBuffer = _vm->_fileManager.loadFile(_vm->_globals.NFICHIER);
_characterSize = _vm->_fileManager.fileSize(_vm->_globals.NFICHIER);
}
RENVOIE_FICHIER(40, v23, (const char *)_characterBuffer);
RENVOIE_FICHIER(0, v22, (const char *)_characterBuffer);
RENVOIE_FICHIER(20, v20, (const char *)_characterBuffer);
getStringFromBuffer(40, v23, (const char *)_characterBuffer);
getStringFromBuffer(0, v22, (const char *)_characterBuffer);
getStringFromBuffer(20, v20, (const char *)_characterBuffer);
v5 = 5;
if (v20 == "NULL")
@ -1217,13 +1206,12 @@ void TalkManager::OBJET_VIVANT(const Common::String &a2) {
_vm->_objectsManager._forceZoneFl = true;
_vm->_objectsManager.NUMZONE = -1;
do {
v12 = _vm->_eventsManager.getMouseButton();
if (v12 == 1) {
int mouseButton = _vm->_eventsManager.getMouseButton();
if (mouseButton == 1)
_vm->_objectsManager.handleLeftButton();
v12 = 1;
}
if (v12 == 2)
else if (mouseButton == 2)
_vm->_objectsManager.handleRightButton();
_vm->_objectsManager.checkZone();
if (_vm->_globals.GOACTION)
_vm->_objectsManager.PARADISE();
@ -1280,7 +1268,6 @@ void TalkManager::OBJET_VIVANT(const Common::String &a2) {
WRITE_LE_UINT16(v14, (int16)READ_LE_UINT16(v15));
v14 = v14 + 2;
*v14 = *(v15 + 2);
v16 = v14 + 1;
_vm->_globals._disableInventFl = false;
_vm->_graphicsManager.DD_VBL();
for (int i = 0; i <= 4; i++)

View File

@ -51,7 +51,7 @@ public:
void PARLER_PERSO2(const Common::String &filename);
void PARLER_PERSO(const Common::String &filename);
void RENVOIE_FICHIER(int srcStart, Common::String &dest, const char *srcData);
void getStringFromBuffer(int srcStart, Common::String &dest, const char *srcData);
int DIALOGUE();
int DIALOGUE_REP(int idx);
void CHERCHE_PAL(int a1, int a2);